@astralbeam/sdk 0.5.0 → 0.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +34 -27
- package/dist/client.d.ts +7 -7
- package/dist/client.js +1 -1
- package/dist/{core-BZxnUlwg.js → core-DYXxodYg.js} +20 -20
- package/dist/core.d.ts +1 -1
- package/dist/core.js +1 -1
- package/dist/{index-8NUgB59m.d.ts → index-TbZxlv54.d.ts} +3 -3
- package/dist/react.d.ts +4 -4
- package/dist/react.js +5 -5
- package/dist/server.d.ts +9 -28
- package/dist/server.js +12 -46
- package/dist/{widget-DiGFLZyX.js → widget-CfLWAtV7.js} +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -33,29 +33,36 @@ const handle = mountAstralBeamChat(document.getElementById("sidebar"), {})
|
|
|
33
33
|
|
|
34
34
|
## Authentication
|
|
35
35
|
|
|
36
|
-
The widget will not chat until your app mints it a short-lived token; it never sees your API key. See [Authentication](https://app.astralbeam.ai/docs/sdk/authentication).
|
|
36
|
+
The widget will not chat until your app mints it a short-lived chat auth token; it never sees your API key. That token is the credential your server signs for AstralBeam, never your app's own session cookie or access token. See [Authentication](https://app.astralbeam.ai/docs/sdk/authentication).
|
|
37
37
|
|
|
38
38
|
```ts
|
|
39
|
-
import {
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
39
|
+
import { createChatAuthToken } from "@astralbeam/sdk/server"
|
|
40
|
+
|
|
41
|
+
const apiKey = process.env.ASTRALBEAM_API_KEY // key_<organization>_<key>_abo_<secret>
|
|
42
|
+
|
|
43
|
+
export async function POST(request: Request) {
|
|
44
|
+
if (!apiKey) return Response.json({ error: "Not configured" }, { status: 503 })
|
|
45
|
+
const session = await getApplicationSession(request)
|
|
46
|
+
if (!session) return Response.json({ error: "Unauthenticated" }, { status: 401 })
|
|
47
|
+
const token = await createChatAuthToken({
|
|
48
|
+
apiKey,
|
|
49
|
+
user: {
|
|
50
|
+
id: session.user.id,
|
|
51
|
+
name: session.user.name,
|
|
52
|
+
metadata: { email: session.user.email },
|
|
53
|
+
},
|
|
54
|
+
tenant: {
|
|
55
|
+
id: session.tenant.id,
|
|
56
|
+
name: session.tenant.name,
|
|
57
|
+
metadata: { plan: session.tenant.plan },
|
|
58
|
+
},
|
|
59
|
+
})
|
|
60
|
+
return Response.json({ token }, { headers: { "cache-control": "no-store" } })
|
|
61
|
+
}
|
|
55
62
|
```
|
|
56
63
|
|
|
57
64
|
- Add one endpoint, `/api/astralbeam/token` by default, that authenticates your own session first.
|
|
58
|
-
-
|
|
65
|
+
- Your handler owns the response: answer `cache-control: no-store`, and fail closed with a 401 or 503.
|
|
59
66
|
- Authenticate once, then derive `user` and `tenant` separately from that same application session.
|
|
60
67
|
- Derive `user` and `tenant` from trusted server-side state, never from anything the browser sent.
|
|
61
68
|
- Provide stable tenant-local `user.id` and stable `tenant.id` values; names are optional, and set `user.admin` only from trusted state.
|
|
@@ -64,7 +71,7 @@ export const POST = createAstralBeamTokenRoute({
|
|
|
64
71
|
- Tokens use the API key's organization slug as issuer and the platform audience `astralbeam`; AstralBeam does not require or interpret `sub`.
|
|
65
72
|
- Tokens are signed, not encrypted: never put a secret in them.
|
|
66
73
|
- Lifetimes are 60–600 seconds; the SDK renews in memory before expiry.
|
|
67
|
-
- `
|
|
74
|
+
- `fetchChatAuthToken` says where the chat auth token comes from: `{ url, ...init }`, which the widget calls as `fetch(url, init)` with a standard `RequestInit`, or a function returning `{ token }` (or a promise of it, or `undefined` when it cannot mint one).
|
|
68
75
|
- It defaults to `{ url: "/api/astralbeam/token" }`, posted with the page's cookies, and runs again on every renewal, so a rotating credential stays current.
|
|
69
76
|
|
|
70
77
|
## Options
|
|
@@ -75,7 +82,7 @@ Every option is also a prop on `<AstralBeamChat>`; `handle.update(options)` appl
|
|
|
75
82
|
| ------------------------------------ | ---------------------------------- | ------------------------------------------------------------------ |
|
|
76
83
|
| `agentId` | organization's default | `agt_<organization>_<agent>` from the dashboard |
|
|
77
84
|
| `apiUrl` | `https://app.astralbeam.ai/api` | Base URL of the AstralBeam API; the widget calls `/chat` there |
|
|
78
|
-
| `
|
|
85
|
+
| `fetchChatAuthToken` | `{ url: "/api/astralbeam/token" }` | Chat auth token endpoint as `{ url, ...RequestInit }`, or a minter |
|
|
79
86
|
| `title`, `showHeader` | `"AstralBeam"`, `true` | Header text, and whether the header and reset button show |
|
|
80
87
|
| `emptyTitle`, `emptyDescription` | generic copy | Headline and subtitle of the empty transcript |
|
|
81
88
|
| `colorScheme`, `theme` | `"system"`, built-in palette | Light/dark/system, and shadcn token overrides |
|
|
@@ -133,13 +140,13 @@ Each guide is short and self-contained.
|
|
|
133
140
|
|
|
134
141
|
There is no root export. Conversation history is not built yet.
|
|
135
142
|
|
|
136
|
-
| Entry point | Contents
|
|
137
|
-
| ------------------------ |
|
|
138
|
-
| `@astralbeam/sdk/client` | `mountAstralBeamChat`, the vanilla loader
|
|
139
|
-
| `@astralbeam/sdk/core` | `createAstralBeamChat`, the headless session
|
|
140
|
-
| `@astralbeam/sdk/react` | `<AstralBeamChat>`, `useAstralBeamChat`
|
|
141
|
-
| `@astralbeam/sdk/server` | `
|
|
142
|
-
| `@astralbeam/sdk/vue` | Vue components (placeholder)
|
|
143
|
+
| Entry point | Contents | Peer dependency |
|
|
144
|
+
| ------------------------ | -------------------------------------------- | -------------------- |
|
|
145
|
+
| `@astralbeam/sdk/client` | `mountAstralBeamChat`, the vanilla loader | none |
|
|
146
|
+
| `@astralbeam/sdk/core` | `createAstralBeamChat`, the headless session | none |
|
|
147
|
+
| `@astralbeam/sdk/react` | `<AstralBeamChat>`, `useAstralBeamChat` | `react`, `react-dom` |
|
|
148
|
+
| `@astralbeam/sdk/server` | `createChatAuthToken`, the token minter | none |
|
|
149
|
+
| `@astralbeam/sdk/vue` | Vue components (placeholder) | `vue` |
|
|
143
150
|
|
|
144
151
|
Types resolve under every TypeScript module resolution mode, including the classic `"moduleResolution": "node"` that Ionic, Capacitor, and Create React App templates still ship. TypeScript 5.0 or later is required, because the declarations use `const` type parameters; on TypeScript 4.x the `.d.ts` files fail to parse.
|
|
145
152
|
|
package/dist/client.d.ts
CHANGED
|
@@ -108,14 +108,14 @@ interface AstralBeamChatAuthTokenRequest extends RequestInit {
|
|
|
108
108
|
url: string;
|
|
109
109
|
}
|
|
110
110
|
/**
|
|
111
|
-
* Where the widget's short-lived chat
|
|
111
|
+
* Where the widget's short-lived chat auth token comes from: an endpoint to POST, or a function that
|
|
112
112
|
* mints the token in the host page and returns `{ token }`, optionally as a promise.
|
|
113
113
|
*
|
|
114
114
|
* Either form runs again on every renewal — near expiry and after a token is rejected — so a
|
|
115
115
|
* rotating credential stays current rather than being captured once. A function that returns
|
|
116
116
|
* `undefined`, or throws, fails authentication closed; the composer's retry link asks again.
|
|
117
117
|
*/
|
|
118
|
-
type
|
|
118
|
+
type AstralBeamChatAuthTokenSource = AstralBeamChatAuthTokenRequest | (() => {
|
|
119
119
|
token: string;
|
|
120
120
|
} | undefined | Promise<{
|
|
121
121
|
token: string;
|
|
@@ -155,12 +155,12 @@ interface MountAstralBeamChatOptions {
|
|
|
155
155
|
*/
|
|
156
156
|
apiUrl?: string | undefined;
|
|
157
157
|
/**
|
|
158
|
-
* Where the short-lived chat
|
|
159
|
-
* a function that mints `{ token }` in the host page. Read for every token, so a
|
|
160
|
-
* to the next one, which is minted when the cached token nears expiry. Default
|
|
158
|
+
* Where the short-lived chat auth token comes from: `{ url, ...RequestInit }` for a token
|
|
159
|
+
* endpoint, or a function that mints `{ token }` in the host page. Read for every token, so a
|
|
160
|
+
* change applies to the next one, which is minted when the cached token nears expiry. Default
|
|
161
161
|
* `{ url: "/api/astralbeam/token" }`, posted with the page's cookies.
|
|
162
162
|
*/
|
|
163
|
-
|
|
163
|
+
fetchChatAuthToken?: AstralBeamChatAuthTokenSource | undefined;
|
|
164
164
|
/** Host-defined tools the agent can call, executed in the host page, keyed by tool name. */
|
|
165
165
|
tools?: Record<string, ToolDefinition> | undefined;
|
|
166
166
|
/** Host-defined widgets the agent can render inline in the conversation, keyed by identifier. */
|
|
@@ -227,4 +227,4 @@ declare function defineWidget<const S extends ParametersSchema = JsonSchemaObjec
|
|
|
227
227
|
//#region src/client/index.d.ts
|
|
228
228
|
declare function mountAstralBeamChat(target: HTMLElement, options: MountAstralBeamChatOptions): AstralBeamChatHandle;
|
|
229
229
|
//#endregion
|
|
230
|
-
export { type AstralBeamChatAttachmentOptions, type AstralBeamChatAuthTokenRequest, type
|
|
230
|
+
export { type AstralBeamChatAttachmentOptions, type AstralBeamChatAuthTokenRequest, type AstralBeamChatAuthTokenSource, type AstralBeamChatColorScheme, type AstralBeamChatHandle, type AstralBeamChatSlotRenderer, type AstralBeamChatSlots, type AstralBeamChatTheme, type AstralBeamChatThemeVariables, type AstralBeamChatUpdate, type InferParameters, type JsonSchemaObject, type MountAstralBeamChatOptions, type ParametersSchema, type StandardSchemaV1, type ToolDefinition, type TypedToolDefinition, type TypedWidgetDefinition, type WidgetDefinition, defineTool, defineWidget, mountAstralBeamChat };
|
package/dist/client.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{c as e,t}from"./debug-DyjRg3e0.js";function n(e){return e}function r(e){return e}function i(n,r){let i={...r},a=t(i.debug);a?.(`mount`,`mounting chat widget`,{agentId:i.agentId??`(organization default)`,title:i.title??`AstralBeam`,showHeader:i.showHeader??!0,emptyTitle:i.emptyTitle??`Ask the assistant`,emptyDescription:i.emptyDescription??`It can answer questions and act through this app's own tools and widgets.`,apiUrl:i.apiUrl??`https://app.astralbeam.ai/api`,authentication:`configured`,colorScheme:i.colorScheme??`system`,theme:i.theme,tools:Object.keys(i.tools??{}),widgets:Object.keys(i.widgets??{}),attachments:i.attachments??!0});let o=n.shadowRoot??n.attachShadow({mode:`open`}),s=document.createElement(`div`);s.className=e,s.style.height=`100%`,o.append(s);let c=matchMedia(`(prefers-color-scheme: dark)`),l=new Set,u=e=>{for(let e of l)s.style.removeProperty(e);l.clear();let t={...i.theme?.light,...e?i.theme?.dark:void 0};for(let[e,n]of Object.entries(t))e.startsWith(`--`)&&(s.style.setProperty(e,n),l.add(e))},d=()=>{let e=i.colorScheme??`system`,t=e===`dark`||e===`system`&&c.matches;s.classList.toggle(`dark`,t),u(t),a?.(`theme`,`color scheme "${e}" resolved to ${t?`dark`:`light`}`,{themeVariables:[...l]})};d(),c.addEventListener(`change`,d);let f=!1,p;return import(`./widget-
|
|
1
|
+
import{c as e,t}from"./debug-DyjRg3e0.js";function n(e){return e}function r(e){return e}function i(n,r){let i={...r},a=t(i.debug);a?.(`mount`,`mounting chat widget`,{agentId:i.agentId??`(organization default)`,title:i.title??`AstralBeam`,showHeader:i.showHeader??!0,emptyTitle:i.emptyTitle??`Ask the assistant`,emptyDescription:i.emptyDescription??`It can answer questions and act through this app's own tools and widgets.`,apiUrl:i.apiUrl??`https://app.astralbeam.ai/api`,authentication:`configured`,colorScheme:i.colorScheme??`system`,theme:i.theme,tools:Object.keys(i.tools??{}),widgets:Object.keys(i.widgets??{}),attachments:i.attachments??!0});let o=n.shadowRoot??n.attachShadow({mode:`open`}),s=document.createElement(`div`);s.className=e,s.style.height=`100%`,o.append(s);let c=matchMedia(`(prefers-color-scheme: dark)`),l=new Set,u=e=>{for(let e of l)s.style.removeProperty(e);l.clear();let t={...i.theme?.light,...e?i.theme?.dark:void 0};for(let[e,n]of Object.entries(t))e.startsWith(`--`)&&(s.style.setProperty(e,n),l.add(e))},d=()=>{let e=i.colorScheme??`system`,t=e===`dark`||e===`system`&&c.matches;s.classList.toggle(`dark`,t),u(t),a?.(`theme`,`color scheme "${e}" resolved to ${t?`dark`:`light`}`,{themeVariables:[...l]})};d(),c.addEventListener(`change`,d);let f=!1,p;return import(`./widget-CfLWAtV7.js`).then(({renderChat:e})=>{a?.(`mount`,`chat chunk loaded`),f||(p=e(o,s,i))}),{update:e=>{i={...i,...e},a=t(i.debug),a?.(`mount`,`options updated`,{changed:Object.keys(e)}),d(),p?.update(i)},reset:()=>p?.reset(),stop:()=>p?.stop(),unmount:()=>{a?.(`mount`,`unmounting chat widget`),f=!0,c.removeEventListener(`change`,d),p?.dispose(),p=void 0,s.remove()}}}export{n as defineTool,r as defineWidget,i as mountAstralBeamChat};
|
|
@@ -7842,29 +7842,29 @@ function buildHostTools(tools, debug) {
|
|
|
7842
7842
|
const REFRESH_SKEW_MS = 6e4;
|
|
7843
7843
|
const MAX_TOKEN_LENGTH = 16384;
|
|
7844
7844
|
function tokenExpiry(token) {
|
|
7845
|
-
if (token.length > MAX_TOKEN_LENGTH) throw new Error("The
|
|
7845
|
+
if (token.length > MAX_TOKEN_LENGTH) throw new Error("The chat auth token is too large");
|
|
7846
7846
|
const parts = token.split(".");
|
|
7847
|
-
if (parts.length !== 3 || !parts[1]) throw new Error("The
|
|
7847
|
+
if (parts.length !== 3 || !parts[1]) throw new Error("The chat auth token is not a JWT");
|
|
7848
7848
|
const encoded = parts[1].replaceAll("-", "+").replaceAll("_", "/");
|
|
7849
7849
|
const padded = encoded.padEnd(Math.ceil(encoded.length / 4) * 4, "=");
|
|
7850
7850
|
let payload;
|
|
7851
7851
|
try {
|
|
7852
7852
|
payload = JSON.parse(atob(padded));
|
|
7853
7853
|
} catch {
|
|
7854
|
-
throw new Error("The
|
|
7854
|
+
throw new Error("The chat auth token has an invalid payload");
|
|
7855
7855
|
}
|
|
7856
7856
|
const exp = payload?.exp;
|
|
7857
|
-
if (!Number.isInteger(exp) || Number(exp) <= 0) throw new Error("The
|
|
7857
|
+
if (!Number.isInteger(exp) || Number(exp) <= 0) throw new Error("The chat auth token has no valid expiry");
|
|
7858
7858
|
return Number(exp) * 1e3;
|
|
7859
7859
|
}
|
|
7860
7860
|
function bearerToken(headers) {
|
|
7861
7861
|
const authorization = headers.get("authorization");
|
|
7862
7862
|
return authorization?.startsWith("Bearer ") ? authorization.slice(7) : void 0;
|
|
7863
7863
|
}
|
|
7864
|
-
async function
|
|
7865
|
-
const {
|
|
7866
|
-
if (typeof
|
|
7867
|
-
const { url, ...init } =
|
|
7864
|
+
async function requestChatAuthToken(options, signal) {
|
|
7865
|
+
const { fetchChatAuthToken, fetchClient } = options;
|
|
7866
|
+
if (typeof fetchChatAuthToken === "function") return (await fetchChatAuthToken())?.token;
|
|
7867
|
+
const { url, ...init } = fetchChatAuthToken;
|
|
7868
7868
|
const headers = new Headers(init.headers);
|
|
7869
7869
|
if (!headers.has("accept")) headers.set("accept", "application/json");
|
|
7870
7870
|
const response = await fetchClient(url, {
|
|
@@ -7878,12 +7878,12 @@ async function requestChatToken(options, signal) {
|
|
|
7878
7878
|
if (!response.ok) throw new Error(`Authentication endpoint returned HTTP ${response.status}`);
|
|
7879
7879
|
return (await response.json())?.token;
|
|
7880
7880
|
}
|
|
7881
|
-
async function
|
|
7881
|
+
async function loadChatAuthToken(options) {
|
|
7882
7882
|
const { session, onStateChange, debug } = options;
|
|
7883
7883
|
const { signal } = session.abortController;
|
|
7884
|
-
const source = typeof options.
|
|
7884
|
+
const source = typeof options.fetchChatAuthToken === "function" ? "fetchChatAuthToken" : "Authentication endpoint";
|
|
7885
7885
|
try {
|
|
7886
|
-
const token = await
|
|
7886
|
+
const token = await requestChatAuthToken(options, signal);
|
|
7887
7887
|
if (typeof token !== "string" || !token) throw new Error(`${source} did not return a token`);
|
|
7888
7888
|
const expiresAt = tokenExpiry(token);
|
|
7889
7889
|
if (expiresAt <= Date.now()) throw new Error(`${source} returned an expired token`);
|
|
@@ -7906,13 +7906,13 @@ async function fetchChatToken(options) {
|
|
|
7906
7906
|
throw error;
|
|
7907
7907
|
}
|
|
7908
7908
|
}
|
|
7909
|
-
async function
|
|
7909
|
+
async function getValidChatAuthToken(options) {
|
|
7910
7910
|
const { session, force = false, onStateChange } = options;
|
|
7911
7911
|
const now = Date.now();
|
|
7912
7912
|
if (!force && session.cached && session.cached.expiresAt - now > REFRESH_SKEW_MS) return session.cached.value;
|
|
7913
7913
|
if (session.refreshPromise) return await session.refreshPromise;
|
|
7914
7914
|
onStateChange({ status: "loading" });
|
|
7915
|
-
const refresh =
|
|
7915
|
+
const refresh = loadChatAuthToken(options);
|
|
7916
7916
|
session.refreshPromise = refresh;
|
|
7917
7917
|
try {
|
|
7918
7918
|
return await refresh;
|
|
@@ -7922,7 +7922,7 @@ async function getValidChatToken(options) {
|
|
|
7922
7922
|
}
|
|
7923
7923
|
async function initializeChatAuthentication(options) {
|
|
7924
7924
|
if (options.session.abortController.signal.aborted) options.session.abortController = new AbortController();
|
|
7925
|
-
await
|
|
7925
|
+
await getValidChatAuthToken(options);
|
|
7926
7926
|
}
|
|
7927
7927
|
function disposeChatAuthentication({ session }) {
|
|
7928
7928
|
session.abortController.abort();
|
|
@@ -7935,8 +7935,8 @@ async function fetchAuthenticatedChat(options) {
|
|
|
7935
7935
|
const usedToken = bearerToken(new Headers(init?.headers));
|
|
7936
7936
|
const rejectedCurrentToken = !usedToken || session.cached?.value === usedToken;
|
|
7937
7937
|
if (rejectedCurrentToken) session.cached = void 0;
|
|
7938
|
-
debug?.("auth", "chat token was rejected; refreshing once");
|
|
7939
|
-
const token = await
|
|
7938
|
+
debug?.("auth", "chat auth token was rejected; refreshing once");
|
|
7939
|
+
const token = await getValidChatAuthToken({
|
|
7940
7940
|
...options,
|
|
7941
7941
|
force: rejectedCurrentToken
|
|
7942
7942
|
});
|
|
@@ -8105,7 +8105,7 @@ function createAstralBeamChat(options) {
|
|
|
8105
8105
|
for (const listener of listeners) listener();
|
|
8106
8106
|
};
|
|
8107
8107
|
const authentication = {
|
|
8108
|
-
|
|
8108
|
+
fetchChatAuthToken: live.fetchChatAuthToken ?? { url: "/api/astralbeam/token" },
|
|
8109
8109
|
session: {
|
|
8110
8110
|
cached: void 0,
|
|
8111
8111
|
refreshPromise: void 0,
|
|
@@ -8120,7 +8120,7 @@ function createAstralBeamChat(options) {
|
|
|
8120
8120
|
try {
|
|
8121
8121
|
const url = new URL(chatApiUrls(live.apiUrl).config, globalThis.location?.href);
|
|
8122
8122
|
if (live.agentId) url.searchParams.set("agentId", live.agentId);
|
|
8123
|
-
const token = await
|
|
8123
|
+
const token = await getValidChatAuthToken(authentication);
|
|
8124
8124
|
const response = await fetch(url, { headers: { authorization: `Bearer ${token}` } });
|
|
8125
8125
|
if (!response.ok) throw new Error(`The config request answered ${response.status}`);
|
|
8126
8126
|
const body = await response.json();
|
|
@@ -8161,7 +8161,7 @@ function createAstralBeamChat(options) {
|
|
|
8161
8161
|
});
|
|
8162
8162
|
const client = new ChatClient({
|
|
8163
8163
|
connection: fetchServerSentEvents(() => chatApiUrls(live.apiUrl).chat, async () => ({
|
|
8164
|
-
headers: { authorization: `Bearer ${await
|
|
8164
|
+
headers: { authorization: `Bearer ${await getValidChatAuthToken(authentication)}` },
|
|
8165
8165
|
fetchClient: (input, init) => fetchAuthenticatedChat({
|
|
8166
8166
|
...authentication,
|
|
8167
8167
|
input,
|
|
@@ -8224,7 +8224,7 @@ function createAstralBeamChat(options) {
|
|
|
8224
8224
|
...next
|
|
8225
8225
|
};
|
|
8226
8226
|
debug = createDebugLogger(live.debug);
|
|
8227
|
-
authentication.
|
|
8227
|
+
authentication.fetchChatAuthToken = live.fetchChatAuthToken ?? { url: "/api/astralbeam/token" };
|
|
8228
8228
|
authentication.debug = debug;
|
|
8229
8229
|
client.updateOptions({
|
|
8230
8230
|
tools: agentTools(),
|
package/dist/core.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { A as SandboxActivity, C as AstralBeamChatState, D as WidgetDeclaration, E as ChatAuthenticationState, F as InferParameters, I as JsonSchemaObject, L as ParametersSchema, M as SandboxCommandRun, N as SandboxFileWrite, O as buildAgentTools, P as SandboxStatus, R as StandardSchemaV1, S as AstralBeamChatCoreOptions, T as createAstralBeamChat, _ as sandboxRefusal, a as SANDBOX_LIST_FILES_TOOL, b as lastPartInProgress, c as SANDBOX_RUN_COMMAND_TOOL, d as collectSandboxActivity, f as describeSandboxCommandRun, g as readSandboxFileWrite, h as readSandboxCommandRun, i as RENDER_WIDGET_TOOL, j as SandboxArtifact, k as RenderWidgetInput, l as SANDBOX_STATUS_EVENT, m as readSandboxArtifact, n as defineWidget, o as SANDBOX_PUBLISH_ARTIFACT_TOOL, p as isSandboxTool, r as ASK_QUESTIONNAIRE_TOOL, s as SANDBOX_READ_FILE_TOOL, t as defineTool, u as SANDBOX_WRITE_FILE_TOOL, v as hasPendingToolRun, w as WidgetRenderRequest, x as AstralBeamChatCore, y as isSettledToolCall, z as ToolDefinition } from "./index-
|
|
1
|
+
import { A as SandboxActivity, C as AstralBeamChatState, D as WidgetDeclaration, E as ChatAuthenticationState, F as InferParameters, I as JsonSchemaObject, L as ParametersSchema, M as SandboxCommandRun, N as SandboxFileWrite, O as buildAgentTools, P as SandboxStatus, R as StandardSchemaV1, S as AstralBeamChatCoreOptions, T as createAstralBeamChat, _ as sandboxRefusal, a as SANDBOX_LIST_FILES_TOOL, b as lastPartInProgress, c as SANDBOX_RUN_COMMAND_TOOL, d as collectSandboxActivity, f as describeSandboxCommandRun, g as readSandboxFileWrite, h as readSandboxCommandRun, i as RENDER_WIDGET_TOOL, j as SandboxArtifact, k as RenderWidgetInput, l as SANDBOX_STATUS_EVENT, m as readSandboxArtifact, n as defineWidget, o as SANDBOX_PUBLISH_ARTIFACT_TOOL, p as isSandboxTool, r as ASK_QUESTIONNAIRE_TOOL, s as SANDBOX_READ_FILE_TOOL, t as defineTool, u as SANDBOX_WRITE_FILE_TOOL, v as hasPendingToolRun, w as WidgetRenderRequest, x as AstralBeamChatCore, y as isSettledToolCall, z as ToolDefinition } from "./index-TbZxlv54.js";
|
|
2
2
|
export { ASK_QUESTIONNAIRE_TOOL, type AstralBeamChatCore, type AstralBeamChatCoreOptions, type AstralBeamChatState, type ChatAuthenticationState, type InferParameters, type JsonSchemaObject, type ParametersSchema, RENDER_WIDGET_TOOL, type RenderWidgetInput, SANDBOX_LIST_FILES_TOOL, SANDBOX_PUBLISH_ARTIFACT_TOOL, SANDBOX_READ_FILE_TOOL, SANDBOX_RUN_COMMAND_TOOL, SANDBOX_STATUS_EVENT, SANDBOX_WRITE_FILE_TOOL, type SandboxActivity, type SandboxArtifact, type SandboxCommandRun, type SandboxFileWrite, type SandboxStatus, type StandardSchemaV1, type ToolDefinition, type WidgetDeclaration, type WidgetRenderRequest, buildAgentTools, collectSandboxActivity, createAstralBeamChat, defineTool, defineWidget, describeSandboxCommandRun, hasPendingToolRun, isSandboxTool, isSettledToolCall, lastPartInProgress, readSandboxArtifact, readSandboxCommandRun, readSandboxFileWrite, sandboxRefusal };
|
package/dist/core.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { S as SANDBOX_WRITE_FILE_TOOL, _ as SANDBOX_LIST_FILES_TOOL, a as describeSandboxCommandRun, b as SANDBOX_RUN_COMMAND_TOOL, c as readSandboxCommandRun, d as hasPendingToolRun, f as isSettledToolCall, g as RENDER_WIDGET_TOOL, h as ASK_QUESTIONNAIRE_TOOL, i as collectSandboxActivity, l as readSandboxFileWrite, m as buildAgentTools, n as defineWidget, o as isSandboxTool, p as lastPartInProgress, r as createAstralBeamChat, s as readSandboxArtifact, t as defineTool, u as sandboxRefusal, v as SANDBOX_PUBLISH_ARTIFACT_TOOL, x as SANDBOX_STATUS_EVENT, y as SANDBOX_READ_FILE_TOOL } from "./core-
|
|
1
|
+
import { S as SANDBOX_WRITE_FILE_TOOL, _ as SANDBOX_LIST_FILES_TOOL, a as describeSandboxCommandRun, b as SANDBOX_RUN_COMMAND_TOOL, c as readSandboxCommandRun, d as hasPendingToolRun, f as isSettledToolCall, g as RENDER_WIDGET_TOOL, h as ASK_QUESTIONNAIRE_TOOL, i as collectSandboxActivity, l as readSandboxFileWrite, m as buildAgentTools, n as defineWidget, o as isSandboxTool, p as lastPartInProgress, r as createAstralBeamChat, s as readSandboxArtifact, t as defineTool, u as sandboxRefusal, v as SANDBOX_PUBLISH_ARTIFACT_TOOL, x as SANDBOX_STATUS_EVENT, y as SANDBOX_READ_FILE_TOOL } from "./core-DYXxodYg.js";
|
|
2
2
|
export { ASK_QUESTIONNAIRE_TOOL, RENDER_WIDGET_TOOL, SANDBOX_LIST_FILES_TOOL, SANDBOX_PUBLISH_ARTIFACT_TOOL, SANDBOX_READ_FILE_TOOL, SANDBOX_RUN_COMMAND_TOOL, SANDBOX_STATUS_EVENT, SANDBOX_WRITE_FILE_TOOL, buildAgentTools, collectSandboxActivity, createAstralBeamChat, defineTool, defineWidget, describeSandboxCommandRun, hasPendingToolRun, isSandboxTool, isSettledToolCall, lastPartInProgress, readSandboxArtifact, readSandboxCommandRun, readSandboxFileWrite, sandboxRefusal };
|
|
@@ -3315,14 +3315,14 @@ interface AstralBeamChatAuthTokenRequest extends RequestInit {
|
|
|
3315
3315
|
url: string;
|
|
3316
3316
|
}
|
|
3317
3317
|
/**
|
|
3318
|
-
* Where the widget's short-lived chat
|
|
3318
|
+
* Where the widget's short-lived chat auth token comes from: an endpoint to POST, or a function that
|
|
3319
3319
|
* mints the token in the host page and returns `{ token }`, optionally as a promise.
|
|
3320
3320
|
*
|
|
3321
3321
|
* Either form runs again on every renewal — near expiry and after a token is rejected — so a
|
|
3322
3322
|
* rotating credential stays current rather than being captured once. A function that returns
|
|
3323
3323
|
* `undefined`, or throws, fails authentication closed; the composer's retry link asks again.
|
|
3324
3324
|
*/
|
|
3325
|
-
type
|
|
3325
|
+
type AstralBeamChatAuthTokenSource = AstralBeamChatAuthTokenRequest | (() => {
|
|
3326
3326
|
token: string;
|
|
3327
3327
|
} | undefined | Promise<{
|
|
3328
3328
|
token: string;
|
|
@@ -3619,7 +3619,7 @@ interface AstralBeamChatCoreOptions {
|
|
|
3619
3619
|
* function minting `{ token }` in the host page. Either runs again on every renewal.
|
|
3620
3620
|
* Default `{ url: "/api/astralbeam/token" }`.
|
|
3621
3621
|
*/
|
|
3622
|
-
|
|
3622
|
+
fetchChatAuthToken?: AstralBeamChatAuthTokenSource | undefined;
|
|
3623
3623
|
/** Host tools the agent can call; `execute` runs wherever this session lives. */
|
|
3624
3624
|
tools?: Record<string, ToolDefinition> | undefined;
|
|
3625
3625
|
/** Widgets declared to the agent; `onRenderWidget` is asked to draw them. */
|
package/dist/react.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { C as AstralBeamChatState, S as AstralBeamChatCoreOptions, x as AstralBeamChatCore } from "./index-
|
|
1
|
+
import { C as AstralBeamChatState, S as AstralBeamChatCoreOptions, x as AstralBeamChatCore } from "./index-TbZxlv54.js";
|
|
2
2
|
import { ReactNode } from "react";
|
|
3
|
-
import { AstralBeamChatAttachmentOptions, AstralBeamChatAuthTokenRequest,
|
|
3
|
+
import { AstralBeamChatAttachmentOptions, AstralBeamChatAuthTokenRequest, AstralBeamChatAuthTokenSource, AstralBeamChatColorScheme, AstralBeamChatTheme, InferParameters, JsonSchemaObject, ParametersSchema, ToolDefinition, WidgetDefinition as WidgetDefinition$1, defineTool } from "@astralbeam/sdk/client";
|
|
4
4
|
|
|
5
5
|
//#region src/react/index.d.ts
|
|
6
6
|
interface WidgetDefinition extends Omit<WidgetDefinition$1, "render"> {
|
|
@@ -73,7 +73,7 @@ interface AstralBeamChatProps {
|
|
|
73
73
|
* the function form runs in the host's React tree, so an inline closure over current auth state
|
|
74
74
|
* is fine and needs no memoization. Default `{ url: "/api/astralbeam/token" }`.
|
|
75
75
|
*/
|
|
76
|
-
|
|
76
|
+
fetchChatAuthToken?: AstralBeamChatAuthTokenSource;
|
|
77
77
|
/** Host-defined tools the agent can call, executed in the host's React app, keyed by name. */
|
|
78
78
|
tools?: Record<string, ToolDefinition>;
|
|
79
79
|
/** Host-defined widgets the agent can render inline in the conversation, keyed by identifier. */
|
|
@@ -94,4 +94,4 @@ interface AstralBeamChatProps {
|
|
|
94
94
|
}
|
|
95
95
|
declare const AstralBeamChat: import("react").ForwardRefExoticComponent<AstralBeamChatProps & import("react").RefAttributes<AstralBeamChatRef>>;
|
|
96
96
|
//#endregion
|
|
97
|
-
export { AstralBeamChat, type AstralBeamChatAttachmentOptions, type AstralBeamChatAuthTokenRequest, type
|
|
97
|
+
export { AstralBeamChat, type AstralBeamChatAttachmentOptions, type AstralBeamChatAuthTokenRequest, type AstralBeamChatAuthTokenSource, type AstralBeamChatColorScheme, type AstralBeamChatCore, type AstralBeamChatCoreOptions, AstralBeamChatProps, AstralBeamChatRef, type AstralBeamChatState, type AstralBeamChatTheme, type InferParameters, type ParametersSchema, type ToolDefinition, TypedReactWidgetDefinition, UseAstralBeamChatResult, WidgetDefinition, defineTool, defineWidget, useAstralBeamChat };
|
package/dist/react.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { C as DEFAULT_COLOR_SCHEME, r as createAstralBeamChat } from "./core-
|
|
1
|
+
import { C as DEFAULT_COLOR_SCHEME, r as createAstralBeamChat } from "./core-DYXxodYg.js";
|
|
2
2
|
import { forwardRef, useEffect, useImperativeHandle, useMemo, useRef, useState, useSyncExternalStore } from "react";
|
|
3
3
|
import { createPortal } from "react-dom";
|
|
4
4
|
import { defineTool, mountAstralBeamChat } from "@astralbeam/sdk/client";
|
|
@@ -22,7 +22,7 @@ function useAstralBeamChat(options) {
|
|
|
22
22
|
core,
|
|
23
23
|
options.agentId,
|
|
24
24
|
options.apiUrl,
|
|
25
|
-
options.
|
|
25
|
+
options.fetchChatAuthToken,
|
|
26
26
|
options.tools,
|
|
27
27
|
options.widgets,
|
|
28
28
|
options.onRenderWidget,
|
|
@@ -39,7 +39,7 @@ function useAstralBeamChat(options) {
|
|
|
39
39
|
core
|
|
40
40
|
};
|
|
41
41
|
}
|
|
42
|
-
const AstralBeamChat = forwardRef(function AstralBeamChat({ agentId, title, showHeader, header, empty, composerActions, emptyTitle, emptyDescription, apiUrl,
|
|
42
|
+
const AstralBeamChat = forwardRef(function AstralBeamChat({ agentId, title, showHeader, header, empty, composerActions, emptyTitle, emptyDescription, apiUrl, fetchChatAuthToken, tools, widgets = {}, colorScheme = DEFAULT_COLOR_SCHEME, theme, attachments, sandboxPanel, debug }, ref) {
|
|
43
43
|
const targetRef = useRef(null);
|
|
44
44
|
const handleRef = useRef(null);
|
|
45
45
|
const [activeRenders, setActiveRenders] = useState(/* @__PURE__ */ new Map());
|
|
@@ -106,7 +106,7 @@ const AstralBeamChat = forwardRef(function AstralBeamChat({ agentId, title, show
|
|
|
106
106
|
const live = useMemo(() => ({
|
|
107
107
|
agentId,
|
|
108
108
|
apiUrl,
|
|
109
|
-
|
|
109
|
+
fetchChatAuthToken,
|
|
110
110
|
title,
|
|
111
111
|
showHeader,
|
|
112
112
|
emptyTitle,
|
|
@@ -122,7 +122,7 @@ const AstralBeamChat = forwardRef(function AstralBeamChat({ agentId, title, show
|
|
|
122
122
|
}), [
|
|
123
123
|
agentId,
|
|
124
124
|
apiUrl,
|
|
125
|
-
|
|
125
|
+
fetchChatAuthToken,
|
|
126
126
|
title,
|
|
127
127
|
showHeader,
|
|
128
128
|
emptyTitle,
|
package/dist/server.d.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import * as Schema from "effect/Schema";
|
|
2
2
|
|
|
3
3
|
//#region src/server/index.d.ts
|
|
4
|
-
declare const
|
|
5
|
-
declare const
|
|
6
|
-
declare const
|
|
7
|
-
declare const
|
|
8
|
-
declare const
|
|
4
|
+
declare const CHAT_AUTH_TOKEN_AUDIENCE = "astralbeam";
|
|
5
|
+
declare const CHAT_AUTH_TOKEN_TYPE = "astralbeam+jwt";
|
|
6
|
+
declare const CHAT_AUTH_TOKEN_VERSION = 4;
|
|
7
|
+
declare const CHAT_AUTH_TOKEN_LIFETIME_SECONDS = 300;
|
|
8
|
+
declare const CHAT_AUTH_TOKEN_MAX_LIFETIME_SECONDS = 600;
|
|
9
9
|
declare const TenantSchema: Schema.Struct<{
|
|
10
10
|
readonly id: Schema.String;
|
|
11
11
|
readonly name: Schema.optional<Schema.String>;
|
|
@@ -21,37 +21,18 @@ declare const TenantUserSchema: Schema.Struct<{
|
|
|
21
21
|
type Tenant = typeof TenantSchema.Type;
|
|
22
22
|
/** User of an Organization's Tenant who interacts with AstralBeam. */
|
|
23
23
|
type TenantUser = typeof TenantUserSchema.Type;
|
|
24
|
-
interface
|
|
24
|
+
interface CreateChatAuthTokenOptions<TTenantUser extends TenantUser = TenantUser, TTenant extends Tenant = Tenant> {
|
|
25
25
|
readonly apiKey: string;
|
|
26
26
|
readonly user: TTenantUser;
|
|
27
27
|
readonly tenant: TTenant;
|
|
28
28
|
readonly expiresInSeconds?: number | undefined;
|
|
29
29
|
}
|
|
30
|
-
interface CreateAstralBeamTokenRouteOptions<TSession extends object = object, TTenantUser extends TenantUser = TenantUser, TTenant extends Tenant = Tenant> {
|
|
31
|
-
/** The full API key, or a thunk read per request; missing or empty answers 503. */
|
|
32
|
-
readonly apiKey: string | undefined | (() => string | undefined);
|
|
33
|
-
/**
|
|
34
|
-
* Authenticates the request against the application's own session. Returning nothing, or
|
|
35
|
-
* throwing, answers 401.
|
|
36
|
-
*/
|
|
37
|
-
readonly authenticate: (request: Request) => TSession | null | undefined | Promise<TSession | null | undefined>;
|
|
38
|
-
/** Maps the authenticated session to the tenant user minted into the token. */
|
|
39
|
-
readonly user: (session: TSession) => TTenantUser;
|
|
40
|
-
/** Maps the same authenticated session to the tenant minted into the token. */
|
|
41
|
-
readonly tenant: (session: TSession) => TTenant;
|
|
42
|
-
readonly expiresInSeconds?: number | undefined;
|
|
43
|
-
}
|
|
44
|
-
/**
|
|
45
|
-
* Builds the fetch-standard `POST` handler for an application's token endpoint, owning the
|
|
46
|
-
* method check, the unconfigured-key 503, the unauthenticated 401, and the `no-store` header.
|
|
47
|
-
*/
|
|
48
|
-
declare function createAstralBeamTokenRoute<TSession extends object, TTenantUser extends TenantUser = TenantUser, TTenant extends Tenant = Tenant>(options: CreateAstralBeamTokenRouteOptions<TSession, TTenantUser, TTenant>): (request: Request) => Promise<Response>;
|
|
49
30
|
/** Creates the short-lived bearer token returned by an application's server auth endpoint. */
|
|
50
|
-
declare function
|
|
31
|
+
declare function createChatAuthToken<TTenantUser extends TenantUser = TenantUser, TTenant extends Tenant = Tenant>({
|
|
51
32
|
apiKey,
|
|
52
33
|
user,
|
|
53
34
|
tenant,
|
|
54
35
|
expiresInSeconds
|
|
55
|
-
}:
|
|
36
|
+
}: CreateChatAuthTokenOptions<TTenantUser, TTenant>): Promise<string>;
|
|
56
37
|
//#endregion
|
|
57
|
-
export {
|
|
38
|
+
export { CHAT_AUTH_TOKEN_AUDIENCE, CHAT_AUTH_TOKEN_LIFETIME_SECONDS, CHAT_AUTH_TOKEN_MAX_LIFETIME_SECONDS, CHAT_AUTH_TOKEN_TYPE, CHAT_AUTH_TOKEN_VERSION, CreateChatAuthTokenOptions, Tenant, TenantSchema, TenantUser, TenantUserSchema, createChatAuthToken };
|
package/dist/server.js
CHANGED
|
@@ -638,12 +638,12 @@ var SignJWT = class {
|
|
|
638
638
|
};
|
|
639
639
|
//#endregion
|
|
640
640
|
//#region src/server/index.ts
|
|
641
|
-
const
|
|
642
|
-
const
|
|
643
|
-
const
|
|
644
|
-
const
|
|
645
|
-
const
|
|
646
|
-
const
|
|
641
|
+
const CHAT_AUTH_TOKEN_AUDIENCE = "astralbeam";
|
|
642
|
+
const CHAT_AUTH_TOKEN_TYPE = "astralbeam+jwt";
|
|
643
|
+
const CHAT_AUTH_TOKEN_VERSION = 4;
|
|
644
|
+
const CHAT_AUTH_TOKEN_LIFETIME_SECONDS = 300;
|
|
645
|
+
const CHAT_AUTH_TOKEN_MAX_LIFETIME_SECONDS = 600;
|
|
646
|
+
const CHAT_AUTH_TOKEN_MAX_BYTES = 16384;
|
|
647
647
|
const IDENTITY_MAX_BYTES = 8192;
|
|
648
648
|
const textEncoder = new TextEncoder();
|
|
649
649
|
const SlugSchema = Schema.String.pipe(Schema.check(Schema.isPattern(/^[0-9a-z-]{1,63}$/)));
|
|
@@ -701,43 +701,9 @@ async function signingKey(secret) {
|
|
|
701
701
|
const digest = await crypto.subtle.digest("SHA-256", textEncoder.encode(secret));
|
|
702
702
|
return textEncoder.encode(encode(new Uint8Array(digest)));
|
|
703
703
|
}
|
|
704
|
-
function tokenRouteResponse(body, status) {
|
|
705
|
-
return Response.json(body, {
|
|
706
|
-
status,
|
|
707
|
-
headers: { "cache-control": "no-store" }
|
|
708
|
-
});
|
|
709
|
-
}
|
|
710
|
-
/**
|
|
711
|
-
* Builds the fetch-standard `POST` handler for an application's token endpoint, owning the
|
|
712
|
-
* method check, the unconfigured-key 503, the unauthenticated 401, and the `no-store` header.
|
|
713
|
-
*/
|
|
714
|
-
function createAstralBeamTokenRoute(options) {
|
|
715
|
-
return async (request) => {
|
|
716
|
-
if (request.method !== "POST") return tokenRouteResponse({ error: "Use POST" }, 405);
|
|
717
|
-
const apiKey = typeof options.apiKey === "function" ? options.apiKey() : options.apiKey;
|
|
718
|
-
if (!apiKey) return tokenRouteResponse({ error: "The AstralBeam API key is not configured" }, 503);
|
|
719
|
-
let session;
|
|
720
|
-
try {
|
|
721
|
-
session = await options.authenticate(request);
|
|
722
|
-
} catch {
|
|
723
|
-
session = void 0;
|
|
724
|
-
}
|
|
725
|
-
if (!session) return tokenRouteResponse({ error: "The session could not be verified" }, 401);
|
|
726
|
-
try {
|
|
727
|
-
return tokenRouteResponse({ token: await createAstralBeamChatToken({
|
|
728
|
-
apiKey,
|
|
729
|
-
user: options.user(session),
|
|
730
|
-
tenant: options.tenant(session),
|
|
731
|
-
...options.expiresInSeconds === void 0 ? {} : { expiresInSeconds: options.expiresInSeconds }
|
|
732
|
-
}) }, 200);
|
|
733
|
-
} catch {
|
|
734
|
-
return tokenRouteResponse({ error: "The chat token could not be created" }, 500);
|
|
735
|
-
}
|
|
736
|
-
};
|
|
737
|
-
}
|
|
738
704
|
/** Creates the short-lived bearer token returned by an application's server auth endpoint. */
|
|
739
|
-
async function
|
|
740
|
-
if (!Number.isInteger(expiresInSeconds) || expiresInSeconds < 60 || expiresInSeconds > 600) throw new Error("
|
|
705
|
+
async function createChatAuthToken({ apiKey, user, tenant, expiresInSeconds = 300 }) {
|
|
706
|
+
if (!Number.isInteger(expiresInSeconds) || expiresInSeconds < 60 || expiresInSeconds > 600) throw new Error("chat auth tokens must live for 60-600 seconds");
|
|
741
707
|
const { keyId, organizationSlug, keySecret } = parseApiKey(apiKey);
|
|
742
708
|
const identity = validatedIdentity(user, tenant);
|
|
743
709
|
const now = Math.floor(Date.now() / 1e3);
|
|
@@ -747,11 +713,11 @@ async function createAstralBeamChatToken({ apiKey, user, tenant, expiresInSecond
|
|
|
747
713
|
tenant: identity.tenant
|
|
748
714
|
}).setProtectedHeader({
|
|
749
715
|
alg: "HS256",
|
|
750
|
-
typ:
|
|
716
|
+
typ: CHAT_AUTH_TOKEN_TYPE,
|
|
751
717
|
kid: keyId
|
|
752
|
-
}).setIssuer(organizationSlug).setAudience(
|
|
753
|
-
if (textEncoder.encode(token).byteLength >
|
|
718
|
+
}).setIssuer(organizationSlug).setAudience(CHAT_AUTH_TOKEN_AUDIENCE).setIssuedAt(now).setExpirationTime(now + expiresInSeconds).sign(await signingKey(keySecret));
|
|
719
|
+
if (textEncoder.encode(token).byteLength > CHAT_AUTH_TOKEN_MAX_BYTES) throw new Error(`chat auth tokens must not exceed ${CHAT_AUTH_TOKEN_MAX_BYTES} bytes`);
|
|
754
720
|
return token;
|
|
755
721
|
}
|
|
756
722
|
//#endregion
|
|
757
|
-
export {
|
|
723
|
+
export { CHAT_AUTH_TOKEN_AUDIENCE, CHAT_AUTH_TOKEN_LIFETIME_SECONDS, CHAT_AUTH_TOKEN_MAX_LIFETIME_SECONDS, CHAT_AUTH_TOKEN_TYPE, CHAT_AUTH_TOKEN_VERSION, TenantSchema, TenantUserSchema, createChatAuthToken };
|
|
@@ -75,5 +75,5 @@ var Yo=c((e=>{var t=Symbol.for(`react.transitional.element`),n=Symbol.for(`react
|
|
|
75
75
|
`),n,zd()).parse()})}for(let e of r){let r=n.footnoteCounts?.[t[e.number-1]]??1;r>1&&(e.referenceCount=r)}return{type:`footnotes`,items:r}}function mf(e){let t=new Set;for(let n of e.split(`,`)){let e=n.trim().match(/^(\d+)(?:-(\d+))?$/);if(!e)continue;let r=Number(e[1]),i=Number(e[2]??e[1]);for(let e=r;e<=i&&e<r+1e3;e++)t.add(e)}return[...t].sort((e,t)=>e-t)}function hf(e){let t=e.match(/^(\s{0,8})([-+*]|\d{1,9}[.)])(?:([ \t]+)(.*))?$/);if(!t)return;let n=t[2],r=/\d/.test(n[0]);return{ordered:r,...r?{number:Number.parseInt(n,10)}:{},indent:t[1].length,marker:r?n.at(-1):n,contentIndent:t[1].length+n.length+(t[3]?.length??1),content:t[4]??``}}function gf(e,t){return e.ordered===t.ordered&&e.marker===t.marker}function _f(e){return e.match(/^ */)?.[0].length??0}function vf(e,t){let n=hf(e);return/^ {0,3}(`{3,}|~{3,})/.test(e)||/^ {0,3}#{1,6}(?:\s+|$)/.test(e)||/^ {0,3}([-*_])(?:\s*\1){2,}\s*$/.test(e)||/^ {0,3}>\s?/.test(e)||n!==void 0&&(!n.ordered||n.number===1)||!!t&&yf(e,t)}function yf(e,t){if(!e.includes(`|`))return!1;let n=bf(t);return n.length===bf(e).length&&n.every(e=>/^:?-+:?$/.test(e.trim()))}function bf(e){let t=e.trim();t.startsWith(`|`)&&(t=t.slice(1)),t.endsWith(`|`)&&(t=t.slice(0,-1));let n=[],r=``;for(let e=0;e<t.length;e++){let i=t[e];if(i===`\\`&&t[e+1]===`|`){r+=`|`,e++;continue}if(i===`|`){n.push(r.trim()),r=``;continue}r+=i}return n.push(r.trim()),n}function xf(e){let t=e.trim();if(t.startsWith(`:`)&&t.endsWith(`:`))return`center`;if(t.endsWith(`:`))return`right`;if(t.startsWith(`:`))return`left`}function Sf(e,t){return{type:`tableCell`,children:Ud(e,t)}}function Cf({children:e,...t}){return(0,y.createElement)(y.Fragment,null,wf(e,t))}function wf(e,t={}){return(typeof e==`string`?lf(e,t):e).children.map((e,n)=>Tf(e,t,`b:${n}`))}function Tf(e,t={},n){switch(e.type){case`heading`:return $(t,`h${e.depth}`,{key:n,...e.id?{id:e.id}:{},...e.framework?{"data-framework":e.framework}:{}},Df(e.children,t),Lf(e.id,t));case`paragraph`:return $(t,`p`,{key:n},Df(e.children,t));case`code`:return Of(e,t,n);case`list`:return $(t,e.ordered?`ol`:`ul`,{key:n,...e.ordered&&e.start&&e.start!==1?{start:e.start}:{}},e.items.map((n,r)=>$(t,`li`,{key:r},kf(n.children,n.checked,e.loose,t,`${r}`))));case`blockquote`:return $(t,`blockquote`,{key:n},e.children.map((e,r)=>Tf(e,t,`${n}:${r}`)));case`table`:return $(t,`table`,{key:n},$(t,`thead`,null,$(t,`tr`,null,e.header.map((n,r)=>jf(`th`,n,e.align[r],t,r)))),e.rows.length?$(t,`tbody`,null,e.rows.map((n,r)=>$(t,`tr`,{key:r},n.map((n,r)=>jf(`td`,n,e.align[r],t,r))))):null);case`footnotes`:return Mf(e.items,t,n);case`thematicBreak`:return $(t,`hr`,{key:n});case`html`:return t.allowHtml?$(t,`div`,{key:n,dangerouslySetInnerHTML:{__html:e.value}}):$(t,`p`,{key:n},e.value);case`callout`:return $(t,`div`,{key:n,className:`markdown-alert markdown-alert-${e.kind.toLowerCase()}`},$(t,`p`,{className:`markdown-alert-title`},e.title),$(t,`div`,{className:`markdown-alert-content`},e.children.map((e,r)=>Tf(e,t,`${n}:${r}`))));case`component`:return If(e,t,n)}}function Ef(e,t={},n){switch(e.type){case`text`:return e.value;case`inlineCode`:return $(t,`code`,{key:n},e.value);case`strong`:return $(t,`strong`,{key:n},Df(e.children,t));case`emphasis`:return $(t,`em`,{key:n},Df(e.children,t));case`strike`:return $(t,`del`,{key:n},Df(e.children,t));case`footnoteReference`:return $(t,`sup`,{key:n},$(t,`a`,{id:`user-content-fnref-${Ff(e)}`,"data-footnote-ref":``,"aria-describedby":`footnote-label`,href:`#user-content-fn-${e.id}`},e.number));case`link`:return $(t,`a`,{key:n,href:e.href,...e.title?{title:e.title}:{}},Df(e.children,t));case`image`:return $(t,`img`,{key:n,src:e.src,alt:e.alt,...e.title?{title:e.title}:{}});case`break`:return $(t,`br`,{key:n});case`inlineHtml`:return t.allowHtml?$(t,`span`,{key:n,dangerouslySetInnerHTML:{__html:e.value}}):e.value}}function Df(e,t){return e.map((e,n)=>Ef(e,t,`i:${n}`))}function Of(e,t,n){let r=e.lang??`plaintext`,i=t.highlighter,a={className:`language-${r}`},o=i?void 0:e.value,s=i?{dangerouslySetInnerHTML:{__html:i(e.value,r,{...e.highlightLines&&{highlightLines:e.highlightLines},...t.codeLineNumbers!==void 0&&{lineNumbers:t.codeLineNumbers}})}}:void 0,c=$(t,`pre`,{className:`tm-code${t.codeLineNumbers?` tm-code--line-numbers`:``}`,"data-lang":r,...e.title?{"data-code-title":e.title}:{},...e.file?{"data-filename":e.file}:{},...e.framework?{"data-framework":e.framework}:{}},$(t,`code`,{...a,...s},o));return e.title?$(t,`figure`,{key:n,className:`tm-code-frame`,"data-lang":r},$(t,`figcaption`,null,e.title),c):$(t,y.Fragment,{key:n},c)}function kf(e,t,n,r,i){let[a,...o]=e,s=t===void 0?[]:[$(r,`input`,{key:`${i}:checkbox`,type:`checkbox`,disabled:!0,checked:t,readOnly:!0}),` `];if(a?.type===`paragraph`){let e=[...s,...Df(a.children,r)];return[...n?[$(r,`p`,{key:`${i}:paragraph`},e)]:e,...o.flatMap((e,t)=>Af(e,n,r,`${i}:${t+1}`))]}return[...s,...e.flatMap((e,t)=>Af(e,n,r,`${i}:${t}`))]}function Af(e,t,n,r){return!t&&e.type===`paragraph`?Df(e.children,n):[Tf(e,n,r)]}function jf(e,t,n,r,i){return $(r,e,{key:i,...n?{style:{textAlign:n}}:{}},Df(t.children,r))}function Mf(e,t,n){return $(t,`section`,{key:n,"data-footnotes":``,className:`footnotes`},$(t,`h2`,{id:`footnote-label`,className:`sr-only`},`Footnotes`,Lf(`footnote-label`,t)),$(t,`ol`,null,e.map(e=>$(t,`li`,{key:e.id,id:`user-content-fn-${e.id}`},Nf(e,t)))))}function Nf(e,t){let n=e.children.length-1,r=Pf(e,t);return n<0?[$(t,`p`,{key:`backref-wrapper`},r.slice(1))]:e.children.map((e,i)=>i===n&&e.type===`paragraph`?$(t,`p`,{key:i},Df(e.children,t),r):Tf(e,t,`${i}`))}function Pf(e,t){let n=[];for(let r=1;r<=(e.referenceCount??1);r++){let i=r===1?e.id:`${e.id}-${r}`,a=r===1?`${e.number}`:`${e.number}-${r}`;n.push(` `,$(t,`a`,{key:r,"data-footnote-backref":``,"aria-label":`Back to reference ${a}`,className:`data-footnote-backref`,href:`#user-content-fnref-${i}`},`↩`))}return n}function Ff(e){return e.referenceIndex&&e.referenceIndex>1?`${e.id}-${e.referenceIndex}`:e.id}function $(e,t,n,...r){return(0,y.createElement)(typeof t==`string`?e.components?.[t]??t:t,n,...r)}function If(e,t,n){let r=e.tagName??`md-comment-component`,i={...e.properties??{}};return e.tagName||(i[`data-component`]=e.name,i[`data-attributes`]||=JSON.stringify(e.attributes)),$(t,r,{key:n,...i},e.children.map((e,r)=>Tf(e,t,`${n}:${r}`)))}function Lf(e,t){if(!e||!t.headingAnchors)return null;let n=typeof t.headingAnchors==`object`?t.headingAnchors:{};return $(t,`a`,{href:`#${e}`,"aria-hidden":n.ariaHidden??!0,className:n.className??`anchor-heading anchor-heading-link`,tabIndex:n.tabIndex??-1},n.content??`#`)}const Rf=[jd()],zf=Object.fromEntries(Object.entries({p:`my-2 first:mt-0 last:mb-0`,h1:`mt-4 mb-2 font-heading text-base font-semibold first:mt-0`,h2:`mt-4 mb-2 font-heading text-base font-medium first:mt-0`,h3:`mt-3 mb-1.5 font-heading text-sm font-semibold first:mt-0`,h4:`mt-3 mb-1.5 font-heading text-sm font-medium first:mt-0`,h5:`mt-3 mb-1.5 font-heading text-sm font-medium first:mt-0`,h6:`mt-3 mb-1.5 font-heading text-sm font-medium first:mt-0`,ul:`my-2 list-disc space-y-1 ps-5 first:mt-0 last:mb-0`,ol:`my-2 list-decimal space-y-1 ps-5 first:mt-0 last:mb-0`,li:`marker:text-muted-foreground [&>ol]:my-1 [&>ul]:my-1`,blockquote:`my-2 border-s-2 ps-3 text-muted-foreground italic`,code:`rounded-sm bg-muted px-1 py-0.5 font-mono text-xs`,pre:`my-2 overflow-x-auto rounded-md bg-muted p-3 font-mono text-xs [&_code]:bg-transparent [&_code]:p-0`,hr:`my-3`,thead:`border-b`,th:`px-2 py-1 text-start font-medium`,td:`border-t px-2 py-1`,strong:`font-medium`,del:`line-through`,sup:`text-[0.7em]`,section:`mt-3 border-t pt-2 text-xs text-muted-foreground`}).map(([e,t])=>[e,n=>(0,y.createElement)(e,{...n,className:t})]));function Bf({href:e,...t}){let n=/^https?:\/\//i.test(e??``);return(0,J.jsx)(`a`,{...t,href:e,className:`font-medium underline underline-offset-2`,...n?{target:`_blank`,rel:`nofollow noopener noreferrer`,referrerPolicy:`no-referrer`}:{}})}function Vf({alt:e,...t}){return(0,J.jsx)(`img`,{...t,alt:e??``,loading:`lazy`,referrerPolicy:`no-referrer`,className:`my-2 max-w-full rounded-md`})}function Hf(e){return(0,J.jsx)(`div`,{className:`my-2 overflow-x-auto`,children:(0,J.jsx)(`table`,{...e,className:`w-full border-collapse text-xs`})})}const Uf={...zf,a:Bf,img:Vf,table:Hf};function Wf({children:e}){return(0,J.jsx)(Cf,{extensions:Rf,components:Uf,frontmatter:!1,headingIds:!1,children:e})}function Gf(e,t){return`${e}?ticket=${encodeURIComponent(t)}`}function Kf(e){let t=e.lastIndexOf(`/`);return t===-1?e:e.slice(t+1)}async function qf(e,t){if(!e.ticket)return!1;try{let n=await fetch(Gf(t,e.ticket));return n.ok?(Dc(Kf(e.path),await n.blob()),!0):!1}catch{return!1}}function Jf({artifact:e,filesEndpoint:t}){let[n,r]=(0,y.useState)(void 0),[i,a]=(0,y.useState)(!1),o=()=>{qf(e,t).then(e=>{e||a(!0)})},s=e.ticket;return(0,y.useEffect)(()=>{if(!s)return;let e,n=!1;return(async()=>{try{let i=await fetch(Gf(t,s));if(!i.ok)throw Error(`The artifact request answered ${i.status}`);let a=URL.createObjectURL(await i.blob());if(n){URL.revokeObjectURL(a);return}e=a,r(a)}catch{n||a(!0)}})(),()=>{n=!0,e&&URL.revokeObjectURL(e)}},[s,t]),i?(0,J.jsx)(Yf,{label:e.label}):n?(0,J.jsxs)(`figure`,{className:`my-1 flex max-w-full flex-col gap-1`,children:[(0,J.jsx)(`img`,{src:n,alt:e.label,className:`max-h-80 w-fit max-w-full rounded-md border object-contain`}),(0,J.jsxs)(`figcaption`,{className:`flex items-center gap-1 text-xs text-muted-foreground`,children:[(0,J.jsx)(`span`,{className:`min-w-0 flex-1 truncate font-mono`,children:e.label}),kc(e.size),(0,J.jsx)(Zo,{variant:`ghost`,size:`icon-sm`,"aria-label":`Download ${e.label}`,title:`Download`,onClick:o,children:(0,J.jsx)(fe,{})})]})]}):(0,J.jsxs)(sl,{role:`status`,children:[(0,J.jsx)(cl,{children:(0,J.jsx)(Xc,{})}),(0,J.jsxs)(ll,{className:`shimmer`,children:[`Loading `,(0,J.jsx)(`span`,{className:`font-mono`,children:e.label})]})]})}function Yf({label:e}){return(0,J.jsxs)(sl,{children:[(0,J.jsx)(cl,{children:(0,J.jsx)(ke,{})}),(0,J.jsxs)(ll,{children:[(0,J.jsx)(`span`,{className:`font-mono`,children:e}),` `,`is no longer available; ask the agent to publish it again.`]})]})}function Xf({part:e,filesEndpoint:t}){let[n,r]=(0,y.useState)(!1),i=Tu(e),a=Su(e);return e.state===`error`||a!==void 0?(0,J.jsxs)(sl,{children:[(0,J.jsx)(cl,{children:(0,J.jsx)(ke,{})}),(0,J.jsxs)(ll,{children:[`Could not share `,(0,J.jsx)(`span`,{className:`font-mono`,children:i?.label||`the file`}),a&&(0,J.jsx)(`span`,{className:`block text-muted-foreground`,children:a})]})]}):i?.published?n?(0,J.jsx)(Yf,{label:i.label}):i.mimeType?.startsWith(`image/`)?(0,J.jsx)(Jf,{artifact:i,filesEndpoint:t}):(0,J.jsxs)(`div`,{className:`flex w-fit max-w-full items-center gap-2 rounded-lg border bg-muted/30 px-3 py-2 text-sm`,children:[(0,J.jsx)(pe,{className:`size-4 shrink-0 text-muted-foreground`}),(0,J.jsx)(`span`,{className:`min-w-0 flex-1 truncate font-mono`,children:i.label}),kc(i.size)&&(0,J.jsx)(`span`,{className:`shrink-0 text-xs text-muted-foreground`,children:kc(i.size)}),(0,J.jsx)(Zo,{variant:`ghost`,size:`icon-sm`,"aria-label":`Download ${i.label}`,title:`Download`,onClick:()=>{qf(i,t).then(e=>{e||r(!0)})},children:(0,J.jsx)(fe,{})})]}):(0,J.jsxs)(sl,{role:wc(e)?void 0:`status`,children:[(0,J.jsx)(cl,{children:(0,J.jsx)(Xc,{})}),(0,J.jsxs)(ll,{className:`shimmer`,children:[`Sharing `,i?.label?(0,J.jsx)(`span`,{className:`font-mono`,children:i.label}):`a file`]})]})}function Zf({children:e,tone:t=`default`,emptyLabel:n,caption:r}){let i=r===void 0?null:(0,J.jsx)(`p`,{className:`mb-1 font-mono text-xs text-muted-foreground wrap-anywhere`,children:r});return e.length===0&&n?(0,J.jsxs)(J.Fragment,{children:[i,(0,J.jsx)(`p`,{className:`text-xs text-muted-foreground italic`,children:n})]}):(0,J.jsxs)(J.Fragment,{children:[i,(0,J.jsx)(`pre`,{className:q(`max-h-72 overflow-auto rounded-md border border-border bg-muted p-2 font-mono text-xs leading-relaxed whitespace-pre`,t===`error`&&`text-destructive`),children:(0,J.jsx)(`code`,{children:e})})]})}function Qf({run:e}){return e.finished?(0,J.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-1.5`,children:[(0,J.jsx)(Zf,{children:`$ ${e.command}`}),!e.timedOut&&(0,J.jsx)(Zf,{emptyLabel:`No output`,children:e.stdout}),e.stderr.length>0&&(0,J.jsx)(Zf,{tone:`error`,children:e.stderr}),(0,J.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:Ou(e)})]}):(0,J.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-1.5`,children:[(0,J.jsx)(Zf,{children:`$ ${e.command}`}),(0,J.jsx)(`p`,{className:`text-xs text-muted-foreground italic`,children:`Still running…`})]})}function $f(e){let{open:t,defaultOpen:n,onOpenChange:r,disabled:i}=e,[a,o]=Ms({controlled:t,default:n,name:`Collapsible`,state:`open`}),{mounted:s,setMounted:c,transitionStatus:l}=js(a,!0,!0),u=cs(),[d,f]=y.useState(),p=d===null?void 0:d??u,m=ua(e=>{let t=!a,n=Is(`trigger-press`,e.nativeEvent);r(t,n),!n.isCanceled&&o(t)});return y.useMemo(()=>({defaultPanelId:u,disabled:i,handleTrigger:m,mounted:s,open:a,panelId:p,setMounted:c,setOpen:o,setPanelIdState:f,transitionStatus:l}),[u,i,m,s,a,p,c,o,f,l])}const ep=y.createContext(void 0);function tp(){let e=y.useContext(ep);if(e===void 0)throw Error(ja(15));return e}let np=function(e){return e.open=`data-open`,e.closed=`data-closed`,e[e.startingStyle=Ds.startingStyle]=`startingStyle`,e[e.endingStyle=Ds.endingStyle]=`endingStyle`,e}({}),rp=function(e){return e.panelOpen=`data-panel-open`,e}({});const ip={[np.open]:``},ap={[np.closed]:``},op={open(e){return e?{[rp.panelOpen]:``}:null}},sp={open(e){return e?ip:ap},...As},cp=y.forwardRef(function(e,t){let{render:n,className:r,defaultOpen:i=!1,disabled:a=!1,onOpenChange:o,open:s,style:c,...l}=e,u=ua(o),d=$f({open:s,defaultOpen:i,onOpenChange:u,disabled:a}),f=y.useMemo(()=>({open:d.open,disabled:d.disabled,transitionStatus:d.transitionStatus}),[d.open,d.disabled,d.transitionStatus]),p=y.useMemo(()=>({...d,onOpenChange:u,state:f}),[d,u,f]),m=$a(`div`,e,{state:f,ref:t,props:l,stateAttributesMapping:sp});return(0,J.jsx)(ep.Provider,{value:p,children:m})}),lp={...op,...As},up=y.forwardRef(function(e,t){let{panelId:n,open:r,handleTrigger:i,state:a,disabled:o}=tp(),{className:s,disabled:c=o,render:l,nativeButton:u=!0,style:d,...f}=e,{getButtonProps:p,buttonRef:m}=La({disabled:c,focusableWhenDisabled:!0,native:u});return $a(`button`,e,{state:a,ref:[t,m],props:[{"aria-controls":r?n:void 0,"aria-expanded":r,onClick:i},f,p],stateAttributesMapping:lp})});function dp(e,t,n,r){return e.addEventListener(t,n,r),()=>{e.removeEventListener(t,n,r)}}function fp(e){let t=sa(pp,e).current;return t.next=e,pa(t.effect),t}function pp(e){let t={current:e,next:e,effect:()=>{t.current=t.next}};return t}const mp={height:void 0,width:void 0};function hp(e){let{externalRef:t,hiddenUntilFound:n,id:r,keepMounted:i,mounted:a,onOpenChange:o,open:s,setMounted:c,setOpen:l,transitionStatus:u}=e,d=y.useRef(null),f=y.useRef(null),[p,m]=y.useState(mp),h=y.useRef(mp),g=y.useRef(!1),_=y.useRef(s),v=y.useRef(!1),[b,x]=y.useState(!1),S=y.useRef(null),C=Ba(t,d),w=fp(s),T=Ts(d),E=!s&&!a,D=b?`idle`:u,O=s&&(_.current||v.current),k=!s&&a&&f.current===`css-animation`&&p.height===void 0&&p.width===void 0?h.current:p,A=n&&E&&f.current!==`css-animation`,j=ua((e,t=!0)=>{t&&(h.current=e),m(e)}),M=ua(()=>{S.current?.(),S.current=null}),N=ua(e=>{M(),S.current=()=>{S.current=null,e()}}),P=ua(()=>{s&&a&&f.current===`css-animation`&&(v.current=!0)});pa(()=>{!b||u===`starting`||x(!1)},[b,u]),y.useEffect(()=>()=>{P(),M()},[P,M]),pa(()=>{let e=d.current;if(!e)return;!s&&S.current&&M();let t=_p(e,O);if(f.current=t,s&&u===`idle`&&_.current&&t===`css-animation`){h.current=gp(e);return}if(s&&u===`starting`){let n=g.current;if(g.current=!1,t===`none`){j(gp(e)),x(!0);return}if(t===`css-transition`){let t=bp(e);if(j(gp(e)),!n)return t;let r=yp(e,`transition-duration`,`0s`);return N(r),x(!0),t}j(gp(e));let r=yp(e,`animation-name`,`none`);if(!n){r();return}let i=yp(e,`animation-duration`,`0s`);r(),N(i),x(!0);return}if(!s&&a&&(u===`idle`||u===`starting`)){if(_.current=!1,v.current=!1,t===`none`){j(mp,!1),c(!1);return}j(gp(e));return}if(u!==`ending`)return;if(t===`none`){c(!1);return}let n=gp(e);if(!(n.height>0||n.width>0)){c(!1);return}j(n),t===`css-animation`&&yp(e,`animation-name`,`none`)()},[a,s,M,j,c,N,O,u]),Es({enabled:s&&a&&D===`idle`,open:!0,ref:d,onComplete(){s&&j(mp,!1)}}),y.useEffect(()=>{if(s||!a||D!==`ending`||!d.current)return;let e=new AbortController,t=-1;function n(){w.current||(c(!1),j(mp,!1))}return t=xs.request(()=>{T(n,e.signal)}),()=>{xs.cancel(t),e.abort()}},[w,a,s,D,T,j,c]),pa(()=>{let e=d.current;!e||!n||!E||e.setAttribute(`hidden`,`until-found`)},[E,n]),y.useEffect(function(){let e=d.current;if(!e)return;function t(e){let t=Is(Ns,e);o(!0,t),!t.isCanceled&&(g.current=!0,l(!0))}return dp(e,`beforematch`,t)},[o,l]);let ee=i||n||a||s;return{height:k.height,props:{...A?{[np.startingStyle]:``}:void 0,hidden:E,id:r},ref:C,shouldPreventOpenAnimation:O,shouldRender:ee,transitionStatus:D,width:k.width}}function gp(e){return{height:e.scrollHeight,width:e.scrollWidth}}function _p(e,t){let n=ta(e).getComputedStyle(e),r=(n.animationName.split(`,`).map(e=>e.trim()).some(e=>e!==``&&e!==`none`)||t)&&vp(n.animationDuration),i=vp(n.transitionDuration);return r&&i||i?`css-transition`:r?`css-animation`:`none`}function vp(e){return e.split(`,`).map(e=>e.trim()).some(e=>e!==``&&Number.parseFloat(e)>0)}function yp(e,t,n){let r=e.style.getPropertyValue(t),i=e.style.getPropertyPriority(t);return e.style.setProperty(t,n),()=>{if(r===``){e.style.removeProperty(t);return}e.style.setProperty(t,r,i)}}function bp(e){let t={"justify-content":e.style.justifyContent,"align-items":e.style.alignItems,"align-content":e.style.alignContent,"justify-items":e.style.justifyItems};Object.keys(t).forEach(t=>{e.style.setProperty(t,`initial`,`important`)});function n(){Object.entries(t).forEach(([t,n])=>{if(n===``){e.style.removeProperty(t);return}e.style.setProperty(t,n)})}let r=xs.request(n);return()=>{xs.cancel(r),n()}}let xp=function(e){return e.collapsiblePanelHeight=`--collapsible-panel-height`,e.collapsiblePanelWidth=`--collapsible-panel-width`,e}({});const Sp=y.forwardRef(function(e,t){let{className:n,hiddenUntilFound:r,keepMounted:i,render:a,id:o,style:s,...c}=e,{defaultPanelId:l,mounted:u,onOpenChange:d,open:f,setMounted:p,setPanelIdState:m,setOpen:h,state:g,transitionStatus:_}=tp(),v=r??!1,y=i??!1,b=o||void 0,x=b??l;pa(()=>(m(e=>b??(e===null?void 0:e)),()=>{m(e=>e===b?null:e)}),[b,m]);let{height:S,props:C,ref:w,shouldPreventOpenAnimation:T,shouldRender:E,transitionStatus:D,width:O}=hp({externalRef:t,hiddenUntilFound:v,id:x,keepMounted:y,mounted:u,onOpenChange:d,open:f,setMounted:p,setOpen:h,transitionStatus:_}),k={...g,transitionStatus:D},A=Qa(s,k),j=$a(`div`,{...e,style:void 0},{state:k,ref:w,props:[C,{style:{[xp.collapsiblePanelHeight]:S===void 0?`auto`:`${S}px`,[xp.collapsiblePanelWidth]:O===void 0?`auto`:`${O}px`}},c,A?{style:A}:void 0,T?{style:{animationName:`none`}}:void 0],stateAttributesMapping:sp});return E?j:null});function Cp({...e}){return(0,J.jsx)(cp,{"data-slot":`collapsible`,...e})}function wp({...e}){return(0,J.jsx)(up,{"data-slot":`collapsible-trigger`,...e})}function Tp({...e}){return(0,J.jsx)(Sp,{"data-slot":`collapsible-content`,...e})}function Ep({icon:e,label:t,running:n=!1,detail:r,children:i}){return(0,J.jsxs)(Cp,{children:[(0,J.jsxs)(sl,{render:(0,J.jsx)(wp,{}),className:`cursor-pointer items-start hover:text-foreground`,children:[(0,J.jsx)(cl,{className:`mt-0.5`,children:e}),(0,J.jsxs)(ll,{"aria-live":n?`polite`:void 0,className:n?`shimmer`:void 0,children:[t,(0,J.jsx)(ce,{className:`ms-1 inline shrink-0 align-middle transition-transform group-data-[panel-open]/marker:rotate-90`}),r]})]}),(0,J.jsx)(Tp,{className:`ps-6`,children:i})]})}function Dp({part:e,filesEndpoint:t}){if(e.name===`sandbox_publish_artifact`)return(0,J.jsx)(Xf,{part:e,filesEndpoint:t});let n=e.state===`error`,r=Su(e),i=!n&&!wc(e),a=n?(0,J.jsx)(ke,{}):i?(0,J.jsx)(Xc,{}):Op[e.name]??(0,J.jsx)(Oe,{}),o=r!==void 0||n?(0,J.jsx)(`span`,{className:`block text-muted-foreground`,children:r??Mp(e)??`The sandbox step did not finish.`}):void 0,s=Eu(e);if(s)return(0,J.jsx)(Ep,{icon:a,running:i,label:(0,J.jsxs)(J.Fragment,{children:[i?`Running`:`Ran`,` `,(0,J.jsx)(kp,{children:s.command}),s.finished&&r===void 0&&!n&&(0,J.jsxs)(`span`,{className:`text-muted-foreground`,children:[` · `,Ou(s)]})]}),detail:o,children:(0,J.jsx)(Ap,{children:(0,J.jsx)(Qf,{run:s})})});let c=Cu(e);if(c)return(0,J.jsx)(Ep,{icon:a,running:i,label:(0,J.jsxs)(J.Fragment,{children:[i?`Writing`:n||r!==void 0?`Could not write`:`Wrote`,` `,(0,J.jsx)(kp,{children:c.label}),c.written&&(0,J.jsxs)(`span`,{className:`text-muted-foreground`,children:[` · `,c.lines===1?`1 line`:`${c.lines} lines`]})]}),detail:o,children:(0,J.jsx)(Ap,{children:(0,J.jsx)(Zf,{emptyLabel:`Empty file`,caption:c.label===c.path?void 0:c.path,children:c.content})})});let l=wu(e);return(0,J.jsx)(Ep,{icon:a,running:i,label:(0,J.jsxs)(J.Fragment,{children:[jp(e.name,i),` `,l?(0,J.jsx)(kp,{children:l}):`the sandbox`]}),detail:o,children:(0,J.jsx)(Ap,{children:(0,J.jsx)(Zf,{emptyLabel:`Waiting for the result…`,children:Np(e)})})})}const Op={[bc]:(0,J.jsx)(be,{}),[xc]:(0,J.jsx)(_e,{}),[Sc]:(0,J.jsx)(Se,{}),[Cc]:(0,J.jsx)(Oe,{})};function kp({children:e}){return(0,J.jsx)(`span`,{className:`font-mono wrap-anywhere`,children:e})}function Ap({children:e}){return(0,J.jsx)(`div`,{className:`mt-1 flex min-w-0 flex-col`,children:e})}function jp(e,t){return e===`sandbox_list_files`?t?`Listing`:`Listed`:t?`Reading`:`Read`}function Mp(e){let t=e.output?.error;return typeof t==`string`&&t.length>0?t:void 0}function Np(e){let t=e.output;return t==null?``:typeof t.content==`string`?t.content:Array.isArray(t.entries)?t.entries.length===0?`(empty directory)`:t.entries.map(e=>{let{name:t,type:n}=e,r=typeof t==`string`?t:Pc(e);return n===`dir`?`${r}/`:r}).join(`
|
|
76
76
|
`):Pc(t)}function Pp({children:e}){return(0,J.jsxs)(sl,{children:[(0,J.jsx)(cl,{children:(0,J.jsx)(ke,{})}),(0,J.jsx)(ll,{children:e})]})}function Fp({running:e,children:t}){return(0,J.jsxs)(sl,{role:e?`status`:void 0,children:[(0,J.jsx)(cl,{children:e?(0,J.jsx)(Xc,{}):(0,J.jsx)(Ae,{})}),(0,J.jsx)(ll,{className:e?`shimmer`:void 0,children:t})]})}function Ip({title:e,children:t}){return(0,J.jsxs)(`div`,{className:`min-w-0`,children:[(0,J.jsx)(`div`,{className:`text-xs font-medium text-foreground`,children:e}),(0,J.jsx)(`pre`,{className:`mt-0.5 max-h-40 overflow-auto font-mono text-xs whitespace-pre-wrap wrap-break-word`,children:t})]})}function Lp({part:e,title:t,failed:n}){let r=wc(e),i=!n&&!r,a=t?(0,J.jsxs)(`span`,{children:[`“`,t,`”`]}):(0,J.jsx)(`span`,{className:`font-mono`,children:e.name}),o=n?e.output?.error:void 0;return(0,J.jsx)(Ep,{icon:n?(0,J.jsx)(ke,{}):i?(0,J.jsx)(Xc,{}):(0,J.jsx)(Ae,{}),running:i,label:n?(0,J.jsxs)(J.Fragment,{children:[a,` failed`]}):(0,J.jsxs)(J.Fragment,{children:[i?`Running`:`Ran`,` `,a]}),detail:typeof o==`string`&&o.length>0?(0,J.jsx)(`span`,{className:`block text-muted-foreground`,children:o}):void 0,children:(0,J.jsxs)(`div`,{className:`mt-1 flex flex-col gap-2 rounded-md border border-border bg-muted p-2`,children:[(0,J.jsx)(Ip,{title:`Input`,children:Pc(e.input)||`—`}),(0,J.jsx)(Ip,{title:`Output`,children:r?Pc(e.output)||`—`:`Waiting for the result…`})]})})}function Rp({part:e,widgets:t,activeSlots:n}){let r=e.input,i=r?Ac(t,r.widget):void 0;if(!r||!i)return wc(e)?null:(0,J.jsx)(Fp,{running:!0,children:`Preparing a widget`});let a=jc(e.id);if(!n.has(a)){let t=e.output==null;return(0,J.jsxs)(Fp,{running:t,children:[t?`Rendering`:`Rendered`,` `,(0,J.jsx)(`span`,{className:`font-mono`,children:r.widget})]})}return(0,J.jsx)(`slot`,{name:a})}function zp({part:e,onQuestionnaireAnswers:t}){if(e.output!=null){let t=e.output.skipped===!0;return(0,J.jsxs)(sl,{children:[(0,J.jsx)(cl,{children:(0,J.jsx)(ue,{})}),(0,J.jsx)(ll,{children:t?`Questionnaire skipped`:`Answers sent`})]})}if(e.state!==`input-complete`)return(0,J.jsx)(Fp,{running:!0,children:`Preparing a questionnaire`});let n=Nc(e.input);return n.length===0?(0,J.jsx)(Pp,{children:`The questionnaire could not be displayed`}):(0,J.jsx)(Ad,{items:n,onAnswers:n=>t(e.id,n)})}function Bp({part:e,filesEndpoint:t,widgets:n,toolTitles:r,activeSlots:i,onQuestionnaireAnswers:a}){switch(e.type){case`text`:return(0,J.jsx)(hu,{variant:`ghost`,children:(0,J.jsx)(gu,{children:(0,J.jsx)(Wf,{children:e.content})})});case`thinking`:return(0,J.jsx)(`div`,{className:`px-1 text-xs text-muted-foreground italic`,children:e.content});case`tool-call`:{let o=Object.hasOwn(r,e.name)?r[e.name]:void 0;return vu(e.name)?(0,J.jsx)(Dp,{part:e,filesEndpoint:t}):e.state===`error`?(0,J.jsx)(Lp,{part:e,title:o,failed:!0}):e.name===`render_widget`?(0,J.jsx)(Rp,{part:e,widgets:n,activeSlots:i}):e.name===`ask_questionnaire`?(0,J.jsx)(zp,{part:e,onQuestionnaireAnswers:a}):(0,J.jsx)(Lp,{part:e,title:o,failed:!1})}default:return null}}var Vp=class extends y.Component{constructor(...e){super(...e),this.state={failed:!1}}static getDerivedStateFromError(){return{failed:!0}}render(){return this.state.failed?(0,J.jsxs)(sl,{children:[(0,J.jsx)(cl,{children:(0,J.jsx)(ke,{})}),(0,J.jsx)(ll,{children:`Part of this response could not be displayed`})]}):this.props.children}};function Hp({part:e}){let{kind:t,title:n,description:r,href:i}=_c(e),a=t===`image`?i:void 0;return(0,J.jsxs)(Bc,{size:`sm`,children:[(0,J.jsx)(Hc,{variant:a?`image`:`icon`,children:a?(0,J.jsx)(`img`,{src:a,alt:``}):(0,J.jsx)(Qc,{kind:t,mimeType:e.source.mimeType})}),(0,J.jsxs)(Uc,{children:[(0,J.jsx)(Wc,{children:n}),r&&(0,J.jsx)(Gc,{children:r})]}),i&&(0,J.jsx)(Jc,{render:(0,J.jsx)(`a`,{href:i,download:n,target:`_blank`,rel:`noreferrer`,"aria-label":`Download ${n}`,title:`Download ${n}`})})]})}function Up({message:e}){let t=Mc(e),n=e.parts.filter(e=>e.type===`image`||e.type===`document`);return(0,J.jsxs)(J.Fragment,{children:[n.length>0&&(0,J.jsx)(`div`,{className:`flex w-full flex-wrap justify-end gap-2`,children:n.map((e,t)=>(0,J.jsx)(Hp,{part:e},t))}),t.length>0&&(0,J.jsx)(hu,{children:(0,J.jsx)(gu,{children:(0,J.jsx)(`span`,{className:`whitespace-pre-wrap`,children:t})})})]})}function Wp({messages:e,filesEndpoint:t,emptySlot:n,emptyTitle:r,emptyDescription:i,widgets:a,toolTitles:o,activeSlots:s,isBusy:c,awaitingReply:l,onQuestionnaireAnswers:u}){return e.length===0?n?(0,J.jsx)(`div`,{className:`h-full overflow-y-auto`,children:(0,J.jsx)(`slot`,{name:n})}):(0,J.jsx)(nl,{className:`h-full`,children:(0,J.jsxs)(rl,{children:[(0,J.jsx)(il,{children:r??`Ask the assistant`}),(0,J.jsx)(al,{children:i??`It can answer questions and act through this app's own tools and widgets.`})]})}):(0,J.jsx)(cu,{autoScroll:!0,children:(0,J.jsxs)(lu,{className:`h-full`,children:[(0,J.jsx)(uu,{children:(0,J.jsxs)(du,{"aria-busy":c,className:`p-(--card-spacing)`,children:[e.map(e=>(0,J.jsx)(fu,{messageId:e.id,children:(0,J.jsx)(ul,{align:e.role===`user`?`end`:`start`,children:(0,J.jsx)(dl,{children:e.role===`user`?(0,J.jsx)(Up,{message:e}):e.parts.map((e,n)=>(0,J.jsx)(Vp,{children:(0,J.jsx)(Bp,{part:e,filesEndpoint:t,widgets:a,toolTitles:o,activeSlots:s,onQuestionnaireAnswers:u})},n))})})},e.id)),l&&(0,J.jsx)(fu,{messageId:`astralbeam-thinking`,children:(0,J.jsxs)(sl,{role:`status`,children:[(0,J.jsx)(cl,{children:(0,J.jsx)(Xc,{})}),(0,J.jsx)(ll,{className:`shimmer`,children:`Thinking…`})]})})]})}),(0,J.jsx)(pu,{})]})})}const Gp=y.createContext({register:()=>{},unregister:()=>{},subscribeMapChange:()=>()=>{},nextIndexRef:{current:0}});function Kp(){return y.useContext(Gp)}function qp(e){let{children:t,elementsRef:n,labelsRef:r,onMapChange:i}=e,a=ua(i),[,o]=y.useState(!1),s=sa(Yp).current,c=sa(Jp).current,l=y.useRef(0),u=y.useRef(!0),d=y.useRef([]),f=y.useRef(null),p=ua(()=>{u.current||(u.current=!0,o(e=>!e))}),m=ua((e,t)=>{c.set(e,t),p()}),h=ua(e=>{c.delete(e),p()}),g=ua(e=>{let t=new Map;return n.current.length=0,r&&(r.current.length=0),e.forEach(e=>{t.set(e.element,{...e.registration.metadata??{},index:e.index}),n.current[e.index]=e.element,r&&(r.current[e.index]=e.registration.label===void 0?e.registration.textRef?.current?.textContent??e.element.textContent:e.registration.label)}),l.current=n.current.length,t});function _(e){if(f.current?.disconnect(),f.current=null,typeof MutationObserver!=`function`||e.length<2)return;let t=new MutationObserver(n=>{if(!Qp(n))return;let r=null;for(let n of e)if(n.isConnected){if(r&&$p(r,n)>0){t.disconnect(),p();return}r=n}});f.current=t;let n=new Set;for(let t=1;t<e.length;t+=1){let r=Zp(e[t-1],e[t]);r&&n.add(r)}n.forEach(e=>t.observe(e,{childList:!0}))}let v=ua(()=>{let[e,t]=Xp(c),n=g(e);_(t),d.current=e,u.current=!1,s.forEach(e=>e(n)),a(n)});pa(()=>(u.current||g(d.current),()=>{n.current=[],r&&(r.current=[])}),[n,r,g]),pa(()=>{u.current&&v()}),pa(()=>()=>{f.current?.disconnect(),u.current=!0},[]);let b=ua(e=>(s.add(e),()=>{s.delete(e)})),x=y.useMemo(()=>({register:m,unregister:h,subscribeMapChange:b,nextIndexRef:l}),[m,h,b,l]);return(0,J.jsx)(Gp.Provider,{value:x,children:t})}function Jp(){return new Map}function Yp(){return new Set}function Xp(e){let t=new Set,n=[],r=[];e.forEach((e,i)=>{if(!i.isConnected)return;let a=e.index,o={index:a??-1,element:i,registration:e};a===null?r.push(o):a>=0&&(t.add(a),n.push(o))});let i=0;return r.sort((e,t)=>$p(e.element,t.element)),r.forEach(e=>{for(;t.has(i);)i+=1;e.index=i,n.push(e),i+=1}),t.size>0&&n.sort((e,t)=>e.index-t.index),[n,r.map(e=>e.element)]}function Zp(e,t){let n=e.parentElement;for(;n&&!n.contains(t);)n=n.parentElement;return n}function Qp(e){for(let t of e)for(let e=0;e<t.removedNodes.length;e+=1)if(t.removedNodes[e].isConnected)return!0;return!1}function $p(e,t){return e.compareDocumentPosition(t)&Node.DOCUMENT_POSITION_FOLLOWING?-1:1}const em=y.createContext(void 0);function tm(){let e=y.useContext(em);if(e===void 0)throw Error(ja(64));return e}const nm={tabActivationDirection:e=>({"data-activation-direction":e})},rm=y.forwardRef(function(e,t){let{className:n,defaultValue:r=0,onValueChange:i,orientation:a=`horizontal`,render:o,value:s,style:c,...l}=e,u=e.defaultValue!==void 0,d=y.useRef([]),[f,p]=y.useState(()=>new Map),[m,h]=Ms({controlled:s,default:r,name:`Tabs`,state:`value`}),g=s!==void 0,[_,v]=y.useState(()=>new Map),b=y.useRef(void 0),x=y.useCallback(e=>im(_,e),[_]),[S,C]=y.useState(()=>({previousValue:m,tabActivationDirection:`none`})),{previousValue:w,tabActivationDirection:T}=S,E=T,D=!1;w!==m&&(E=am(w,m,a,_),D=w!=null&&m!=null&&x(m)==null);let O=D?w:m,k=w!==O||T!==E;pa(()=>{k&&C({previousValue:O,tabActivationDirection:E})},[O,k,E]);let A=ua((e,t)=>{t.activationDirection=am(m,e,a,_),i?.(e,t),!t.isCanceled&&h(e)}),j=ua((e,t)=>{i?.(e,Is(t,void 0,void 0,{activationDirection:`none`}))}),M=ua((e,t)=>(p(n=>{let r=new Map(n);return r.set(e,t),r}),()=>{p(n=>{if(n.get(e)!==t)return n;let r=new Map(n);return r.delete(e),r})})),N=y.useCallback(e=>f.get(e),[f]),P=y.useCallback(e=>{for(let t of _.values())if(e===t.value)return t.id},[_]),ee=y.useMemo(()=>({getTabElementBySelectedValue:x,getTabIdByPanelValue:P,getTabPanelIdByValue:N,onValueChange:A,orientation:a,registerMountedTabPanel:M,setTabMap:v,tabActivationDirection:E,value:m}),[x,P,N,A,a,M,v,E,m]),F=y.useMemo(()=>{for(let e of _.values())if(e.value===m)return e},[_,m]),I=y.useMemo(()=>{for(let e of _.values())if(!e.disabled)return e.value},[_]),L=y.useRef(!u),R=y.useRef(r),z=y.useRef(u),B=y.useRef(!1);pa(()=>{if(g)return;function e(e,t){h(e),C({previousValue:e,tabActivationDirection:`none`}),j(e,t),L.current=!1}if(_.size===0){B.current&&m!==null&&!b.current?.isConnected&&e(null,Ps);return}B.current=!0,b.current=_.keys().next().value;let t=F?.disabled,n=F==null&&m!==null;if(!t&&m===R.current&&(z.current=!1),z.current&&t&&m===R.current)return;let r=L.current;if(t||n){let n=I??null;if(m===n){L.current=!1;return}let i=Ps;r?i=Fs:t&&(i=`disabled`),e(n,i);return}r&&F!=null&&(j(m,Fs),L.current=!1)},[I,g,j,F,h,_,m]);let V=$a(`div`,e,{state:{orientation:a,tabActivationDirection:E},ref:t,props:l,stateAttributesMapping:nm});return(0,J.jsx)(em.Provider,{value:ee,children:(0,J.jsx)(qp,{elementsRef:d,children:V})})});function im(e,t){for(let[n,r]of e.entries())if(t===r.value)return n;return null}function am(e,t,n,r){if(e==null||t==null)return`none`;let[i,a,o]=n===`horizontal`?[`left`,`left`,`right`]:[`top`,`up`,`down`],s=im(r,e),c=im(r,t);if(s==null||c==null)return s!==c&&(typeof e==`number`||typeof e==`string`)&&typeof e==typeof t?t>e?o:a:`none`;let l=s.getBoundingClientRect()[i],u=c.getBoundingClientRect()[i];return u<l?a:u>l?o:`none`}function om(e={}){let{guess:t,label:n,metadata:r,textRef:i,index:a}=e,{register:o,unregister:s,subscribeMapChange:c,nextIndexRef:l}=Kp(),u=y.useRef(-1),[d,f]=y.useState(a==null&&t?()=>{if(u.current===-1){let e=l.current;l.current+=1,u.current=e}return u.current}:-1),p=a??d,m=y.useRef(null),h=y.useCallback(e=>{let t=m.current;t&&s(t),m.current=e,e&&o(e,{metadata:r??null,index:a??null,label:n,textRef:i})},[a,o,s,r,n,i]);return pa(()=>{if(a==null)return c(e=>{let t=m.current?e.get(m.current)?.index:null;t!=null&&f(t)})},[a,c]),{ref:h,index:p}}function sm(e={}){let{highlightItemOnHover:t,highlightedIndex:n,onHighlightedIndexChange:r}=Na(),{ref:i,index:a}=om(e),o=n===a,s=y.useRef(null),c=Ba(i,s);return{compositeProps:{tabIndex:o?0:-1,onFocus(){r(a)},onMouseMove(){let e=s.current;if(!t||!e)return;let n=e.hasAttribute(`disabled`)||e.ariaDisabled===`true`;!o&&!n&&e.focus()}},compositeRef:c,index:a}}const cm=y.createContext(void 0);function lm(){let e=y.useContext(cm);if(e===void 0)throw Error(ja(65));return e}const um=y.forwardRef(function(e,t){let{className:n,disabled:r=!1,render:i,value:a,id:o,nativeButton:s=!0,style:c,...l}=e,{value:u,getTabPanelIdByValue:d,onValueChange:f,orientation:p,tabActivationDirection:m}=tm(),{activateOnFocus:h,registerTabResizeObserverElement:g,tabsListElement:_}=lm(),{highlightedIndex:v,onHighlightedIndexChange:b}=Na(),x=cs(o),{compositeProps:S,compositeRef:C,index:w}=sm({metadata:y.useMemo(()=>({disabled:r,id:x,value:a}),[r,x,a])}),T=a===u,E=y.useRef(!1),D=y.useRef(null),O=ua(e=>{D.current?.(),D.current=e?g(e):null});pa(()=>{if(E.current){E.current=!1;return}if(!(T&&w>-1&&v!==w))return;let e=_;if(e!=null){let t=ls(Fa(e));if(t&&us(e,t))return}r||b(w)},[T,w,v,b,r,_]);let{getButtonProps:k,buttonRef:A}=La({disabled:r,native:s,focusableWhenDisabled:!0}),j=d(a),M=y.useRef(!1),N=y.useRef(!1);function P(e){f(a,Is(Ns,e.nativeEvent,void 0,{activationDirection:`none`}))}function ee(e){T||r||P(e)}function F(e){T||r||h&&(!M.current||N.current)&&P(e)}function I(e){if(T||r)return;M.current=!0,N.current=e.button===0;let t=Fa(e.currentTarget);function n(){M.current=!1,N.current=!1,t.removeEventListener(`pointerup`,n),t.removeEventListener(`pointercancel`,n)}t.addEventListener(`pointerup`,n),t.addEventListener(`pointercancel`,n)}return $a(`button`,e,{state:{disabled:r,active:T,orientation:p,tabActivationDirection:m},ref:[t,A,C,O],props:[S,{role:`tab`,"aria-controls":j,"aria-selected":T,id:x,onClick:ee,onFocus:F,onPointerDown:I,"data-composite-item-active":T?``:void 0,onKeyDownCapture(){E.current=!0}},l,k],stateAttributesMapping:nm})});function dm(e){return Ka(19)?e:e?`true`:void 0}const fm={...nm,...As},pm=y.forwardRef(function(e,t){let{className:n,value:r,render:i,keepMounted:a=!1,style:o,...s}=e,{value:c,getTabIdByPanelValue:l,orientation:u,tabActivationDirection:d,registerMountedTabPanel:f}=tm(),p=cs(),{ref:m,index:h}=om(),g=r===c,{mounted:_,transitionStatus:v,setMounted:b}=js(g),x=!_,S=l(r),C={hidden:x,orientation:u,tabActivationDirection:d,transitionStatus:v},w=y.useRef(null),T=$a(`div`,e,{state:C,ref:[t,m,w],props:[{"aria-labelledby":S,hidden:x,id:p,role:`tabpanel`,tabIndex:g?0:-1,inert:dm(!g),"data-index":h},s],stateAttributesMapping:fm});return Es({open:g,ref:w,onComplete(){g||b(!1)}}),pa(()=>{if(!(p==null||x&&!a))return f(r,p)},[x,a,r,p,f]),a||_?T:null});function mm(e){return e==null||e.hasAttribute(`disabled`)||e.getAttribute(`aria-disabled`)===`true`}const hm=`ArrowUp`,gm=`ArrowDown`,_m=`ArrowLeft`,vm=`ArrowRight`,ym=new Set([hm,gm,_m,vm,`Home`,`End`]),bm=[`Shift`,`Control`,`Alt`,`Meta`];function xm(e){return na(e)&&e.tagName===`INPUT`}function Sm(e){return!!(xm(e)&&e.selectionStart!=null||na(e)&&e.tagName===`TEXTAREA`)}function Cm(e,t,n,r){if(!e||!t||!t.scrollTo)return;let i=e.scrollLeft,a=e.scrollTop,o=e.clientWidth<e.scrollWidth,s=e.clientHeight<e.scrollHeight;if(o&&r!==`vertical`){let r=wm(e,t,`left`),a=Tm(e),o=Tm(t);n===`ltr`&&(r+t.offsetWidth+o.scrollMarginRight>e.scrollLeft+e.clientWidth-a.scrollPaddingRight?i=r+t.offsetWidth+o.scrollMarginRight-e.clientWidth+a.scrollPaddingRight:r-o.scrollMarginLeft<e.scrollLeft+a.scrollPaddingLeft&&(i=r-o.scrollMarginLeft-a.scrollPaddingLeft)),n===`rtl`&&(r-o.scrollMarginLeft<e.scrollLeft+a.scrollPaddingLeft?i=r-o.scrollMarginLeft-a.scrollPaddingLeft:r+t.offsetWidth+o.scrollMarginRight>e.scrollLeft+e.clientWidth-a.scrollPaddingRight&&(i=r+t.offsetWidth+o.scrollMarginRight-e.clientWidth+a.scrollPaddingRight))}if(s&&r!==`horizontal`){let n=wm(e,t,`top`),r=Tm(e),i=Tm(t);n-i.scrollMarginTop<e.scrollTop+r.scrollPaddingTop?a=n-i.scrollMarginTop-r.scrollPaddingTop:n+t.offsetHeight+i.scrollMarginBottom>e.scrollTop+e.clientHeight-r.scrollPaddingBottom&&(a=n+t.offsetHeight+i.scrollMarginBottom-e.clientHeight+r.scrollPaddingBottom)}e.scrollTo({left:i,top:a,behavior:`auto`})}function wm(e,t,n){let r=n===`left`?`offsetLeft`:`offsetTop`,i=0;for(;t.offsetParent&&(i+=t[r],t.offsetParent!==e);)t=t.offsetParent;return i}function Tm(e){let t=getComputedStyle(e);return{scrollMarginTop:parseFloat(t.scrollMarginTop)||0,scrollMarginRight:parseFloat(t.scrollMarginRight)||0,scrollMarginBottom:parseFloat(t.scrollMarginBottom)||0,scrollMarginLeft:parseFloat(t.scrollMarginLeft)||0,scrollPaddingTop:parseFloat(t.scrollPaddingTop)||0,scrollPaddingRight:parseFloat(t.scrollPaddingRight)||0,scrollPaddingBottom:parseFloat(t.scrollPaddingBottom)||0,scrollPaddingLeft:parseFloat(t.scrollPaddingLeft)||0}}const Em=[];function Dm(e){let{loopFocus:t=!0,orientation:n=`both`,grid:r,onLoop:i,direction:a,highlightedIndex:o,onHighlightedIndexChange:s,rootRef:c,enableHomeAndEndKeys:l=!1,stopEventPropagation:u,disabledIndices:d,modifierKeys:f=Em}=e,[p,m]=y.useState(0),h=r!=null,g=y.useRef(null),_=Ba(g,c),v=y.useRef([]),b=y.useRef(!1),x=o??p,S=ua((e,t=!1)=>{if((s??m)(e),t){let t=v.current[e];Cm(g.current,t,a,n)}}),C=ua(e=>{if(e.size===0||b.current)return;b.current=!0;let t=Array.from(e.keys()),r=t.find(e=>e?.hasAttribute(`data-composite-item-active`))??null,i=r?e.get(r)?.index??-1:-1;if(i!==-1)S(i);else if(gs(t,x,d)){let e=hs(t,{disabledIndices:d});fs(t,e)||S(e)}Cm(g.current,r,a,n)});pa(()=>{if(d==null||o!=null||!b.current)return;let e=v.current;if(gs(e,x,d)){let t=hs(e,{disabledIndices:d});fs(e,t)||S(t)}},[d,o,x,v,S]);let w=ua((e,t,n)=>i?i(e,t,n,v):n),T=ua(e=>{let o=e.key===`Home`||e.key===`End`;if(!ym.has(e.key)||!l&&o||Om(e,f)||!g.current)return;let s=a===`rtl`,c=s?_m:vm,p=s?vm:_m,m=n===`vertical`?gm:c,_=n===`vertical`?hm:p,y=ds(e.nativeEvent);if(y!=null&&Sm(y)&&!mm(y)){let t=y.selectionStart,n=y.selectionEnd,r=y.value;if(t==null||e.shiftKey||t!==n||e.key!==_&&t<r.length||e.key!==m&&t>0)return}let b=x,C=ps(v,d),T=ms(v,d);r!=null&&(b=r({disabledIndices:d,elementsRef:v,event:e,highlightedIndex:x,loopFocus:t,maxIndex:T,minIndex:C,onLoop:w,orientation:n,rtl:s}));let E=n!==`vertical`&&e.key===c||n!==`horizontal`&&e.key===`ArrowDown`,D=n!==`vertical`&&e.key===p||n!==`horizontal`&&e.key===`ArrowUp`;l&&(e.key===`Home`?b=C:e.key===`End`&&(b=T)),b===x&&(E||D)&&(t&&b===T&&E?(b=C,i&&(b=i(e,x,b,v))):t&&b===C&&D?(b=T,i&&(b=i(e,x,b,v))):b=hs(v.current,{startingIndex:b,decrement:D,disabledIndices:d})),b!==x&&!fs(v.current,b)&&(u&&e.stopPropagation(),(h||o||E||D)&&e.preventDefault(),S(b,!0),queueMicrotask(()=>{v.current[b]?.focus()}))});return{props:{ref:_,onFocus(e){let t=g.current,n=ds(e.nativeEvent);!t||n==null||!Sm(n)||n.setSelectionRange(0,n.value.length)},onKeyDown:T},highlightedIndex:x,onHighlightedIndexChange:S,elementsRef:v,onMapChange:C,relayKeyboardEvent:T}}function Om(e,t){for(let n of bm)if(!t.includes(n)&&e.getModifierState(n))return!0;return!1}const km=y.createContext(void 0);function Am(){return y.useContext(km)?.direction??`ltr`}function jm(e){let{render:t,className:n,style:r,refs:i=Ja,props:a=Ja,state:o=Ya,stateAttributesMapping:s,highlightedIndex:c,onHighlightedIndexChange:l,orientation:u,grid:d,loopFocus:f,onLoop:p,enableHomeAndEndKeys:m,onMapChange:h,stopEventPropagation:g=!0,rootRef:_,disabledIndices:v,modifierKeys:b,highlightItemOnHover:x=!1,tag:S=`div`,...C}=e,{props:w,highlightedIndex:T,onHighlightedIndexChange:E,elementsRef:D,onMapChange:O,relayKeyboardEvent:k}=Dm({grid:d,loopFocus:f,onLoop:p,orientation:u,highlightedIndex:c,onHighlightedIndexChange:l,rootRef:_,stopEventPropagation:g,enableHomeAndEndKeys:m,direction:Am(),disabledIndices:v,modifierKeys:b}),A=$a(S,e,{state:o,ref:i,props:[w,...a,C],stateAttributesMapping:s}),j=y.useMemo(()=>({highlightedIndex:T,onHighlightedIndexChange:E,highlightItemOnHover:x,relayKeyboardEvent:k}),[T,E,x,k]);return(0,J.jsx)(Ma.Provider,{value:j,children:(0,J.jsx)(qp,{elementsRef:D,onMapChange:e=>{h?.(e),O(e)},children:A})})}const Mm=y.forwardRef(function(e,t){let{activateOnFocus:n=!1,className:r,loopFocus:i=!0,render:a,style:o,...s}=e,{orientation:c,setTabMap:l,tabActivationDirection:u}=tm(),[d,f]=y.useState(0),[p,m]=y.useState(null),h=y.useRef(new Set),g=y.useRef(new Set),_=y.useRef(null);pa(()=>{if(typeof ResizeObserver>`u`)return;let e=new ResizeObserver(()=>{h.current.forEach(e=>{e()})});return _.current=e,p&&e.observe(p),g.current.forEach(t=>{e.observe(t)}),()=>{e.disconnect(),_.current=null}},[p]);let v=ua(e=>(h.current.add(e),()=>{h.current.delete(e)})),b=ua(e=>(g.current.add(e),_.current?.observe(e),()=>{g.current.delete(e),_.current?.unobserve(e)})),x={orientation:c,tabActivationDirection:u},S={"aria-orientation":c===`vertical`?`vertical`:void 0,role:`tablist`},C=y.useMemo(()=>({activateOnFocus:n,registerIndicatorUpdateListener:v,registerTabResizeObserverElement:b,tabsListElement:p}),[n,v,b,p]);return(0,J.jsx)(cm.Provider,{value:C,children:(0,J.jsx)(jm,{render:a,className:r,style:o,state:x,refs:[t,m],props:[S,s],stateAttributesMapping:nm,highlightedIndex:d,enableHomeAndEndKeys:!0,loopFocus:i,orientation:c,onHighlightedIndexChange:f,onMapChange:l,disabledIndices:Ja})})});function Nm({className:e,orientation:t=`horizontal`,...n}){return(0,J.jsx)(rm,{"data-slot":`tabs`,"data-orientation":t,className:q(`group/tabs flex gap-2 data-horizontal:flex-col`,e),...n})}const Pm=lo(`group/tabs-list inline-flex w-fit items-center justify-center rounded-lg p-[3px] text-muted-foreground group-data-horizontal/tabs:h-8 group-data-vertical/tabs:h-fit group-data-vertical/tabs:flex-col data-[variant=line]:rounded-none`,{variants:{variant:{default:`bg-muted`,line:`gap-1 bg-transparent`}},defaultVariants:{variant:`default`}});function Fm({className:e,variant:t=`default`,...n}){return(0,J.jsx)(Mm,{"data-slot":`tabs-list`,"data-variant":t,className:q(Pm({variant:t}),e),...n})}function Im({className:e,...t}){return(0,J.jsx)(um,{"data-slot":`tabs-trigger`,className:q(`relative inline-flex h-[calc(100%-1px)] flex-1 items-center justify-center gap-1.5 rounded-md border border-transparent px-1.5 py-0.5 text-sm font-medium whitespace-nowrap text-foreground/60 transition-all group-data-vertical/tabs:w-full group-data-vertical/tabs:justify-start hover:text-foreground focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-1 focus-visible:outline-ring disabled:pointer-events-none disabled:opacity-50 has-data-[icon=inline-end]:pe-1 has-data-[icon=inline-start]:ps-1 aria-disabled:pointer-events-none aria-disabled:opacity-50 dark:text-muted-foreground dark:hover:text-foreground group-data-[variant=default]/tabs-list:data-active:shadow-sm group-data-[variant=line]/tabs-list:data-active:shadow-none [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4`,`group-data-[variant=line]/tabs-list:bg-transparent group-data-[variant=line]/tabs-list:data-active:bg-transparent dark:group-data-[variant=line]/tabs-list:data-active:border-transparent dark:group-data-[variant=line]/tabs-list:data-active:bg-transparent`,`data-active:bg-background data-active:text-foreground dark:data-active:border-input dark:data-active:bg-input/30 dark:data-active:text-foreground`,`after:absolute after:bg-foreground after:opacity-0 after:transition-opacity group-data-horizontal/tabs:after:inset-x-0 group-data-horizontal/tabs:after:bottom-[-5px] group-data-horizontal/tabs:after:h-0.5 group-data-vertical/tabs:after:inset-y-0 group-data-vertical/tabs:after:-end-1 group-data-vertical/tabs:after:w-0.5 group-data-[variant=line]/tabs-list:data-active:after:opacity-100`,e),...t})}function Lm({className:e,...t}){return(0,J.jsx)(pm,{"data-slot":`tabs-content`,className:q(`flex-1 text-sm outline-none`,e),...t})}const Rm=new Set([`c`,`cpp`,`css`,`go`,`html`,`js`,`json`,`jsx`,`mjs`,`py`,`rb`,`rs`,`sh`,`sql`,`toml`,`ts`,`tsx`,`yaml`,`yml`]);function zm(e){let t=e.slice(e.lastIndexOf(`.`)+1).toLowerCase();return Rm.has(t)?(0,J.jsx)(me,{}):t===`csv`||t===`tsv`?(0,J.jsx)(he,{}):(0,J.jsx)(be,{})}function Bm(e){let t=e.lastIndexOf(`/`);return t===-1?e:e.slice(t+1)}function Vm({file:e}){return(0,J.jsxs)(`div`,{className:`flex items-start gap-1`,children:[(0,J.jsx)(`div`,{className:`min-w-0 flex-1`,children:(0,J.jsx)(Ep,{icon:zm(e.path),label:(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(`span`,{className:`font-mono wrap-anywhere`,children:e.label}),(0,J.jsxs)(`span`,{className:`text-muted-foreground`,children:[` · `,e.lines===1?`1 line`:`${e.lines} lines`]})]}),children:(0,J.jsx)(`div`,{className:`mt-1 flex min-w-0 flex-col`,children:(0,J.jsx)(Zf,{emptyLabel:`Empty file`,caption:e.label===e.path?void 0:e.path,children:e.content})})})}),(0,J.jsx)(Zo,{variant:`ghost`,size:`icon-sm`,"aria-label":`Download ${e.label}`,title:`Download`,onClick:()=>Oc(Bm(e.path),e.content),children:(0,J.jsx)(fe,{})})]})}function Hm({run:e}){let t=e.timedOut||e.exitCode!==void 0&&e.exitCode!==0;return(0,J.jsx)(Ep,{icon:(0,J.jsx)(Oe,{}),running:!e.finished,label:(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(`span`,{className:`font-mono wrap-anywhere`,children:e.command}),e.finished&&(0,J.jsx)(`span`,{className:q(`ms-1`,t?`text-destructive`:`text-muted-foreground`),children:Ou(e)})]}),children:(0,J.jsx)(`div`,{className:`mt-1 flex min-w-0 flex-col`,children:(0,J.jsx)(Qf,{run:e})})})}function Um({activity:e}){let[t,n]=(0,y.useState)(!1),r=e.files.length,i=e.commands.length;return(0,J.jsxs)(`div`,{className:`relative w-full`,children:[t&&(0,J.jsx)(`div`,{className:`absolute inset-x-0 bottom-full z-10 mb-2 flex max-h-80 flex-col overflow-hidden rounded-lg border bg-background shadow-lg`,children:(0,J.jsxs)(Nm,{defaultValue:`files`,className:`flex min-h-0 flex-col gap-0`,children:[(0,J.jsxs)(Fm,{variant:`line`,className:`w-full shrink-0 px-2`,children:[(0,J.jsxs)(Im,{value:`files`,children:[(0,J.jsx)(be,{}),`Files`,r>0&&(0,J.jsx)(`span`,{className:`text-muted-foreground`,children:r})]}),(0,J.jsxs)(Im,{value:`log`,children:[(0,J.jsx)(Oe,{}),`Log`,i>0&&(0,J.jsx)(`span`,{className:`text-muted-foreground`,children:i})]})]}),(0,J.jsx)(Lm,{value:`files`,className:`min-h-0 overflow-y-auto p-2`,children:r===0?(0,J.jsx)(Wm,{children:`The agent has not written any files yet.`}):e.files.map(e=>(0,J.jsx)(Vm,{file:e},e.toolCallId))}),(0,J.jsx)(Lm,{value:`log`,className:`min-h-0 overflow-y-auto p-2`,children:i===0?(0,J.jsx)(Wm,{children:`The agent has not run any commands yet.`}):e.commands.map(e=>(0,J.jsx)(Hm,{run:e},e.toolCallId))})]})}),(0,J.jsxs)(`button`,{type:`button`,"aria-expanded":t,onClick:()=>n(e=>!e),className:`flex w-full cursor-pointer items-center gap-2 rounded-full border bg-muted/50 px-3 py-1.5 text-start text-xs text-muted-foreground hover:text-foreground [&_svg:not([class*='size-'])]:size-4`,children:[(0,J.jsx)(de,{}),(0,J.jsxs)(`span`,{className:`flex-1`,children:[`Sandbox · `,r,` `,r===1?`file`:`files`,` · `,i,` `,i===1?`command`:`commands`]}),(0,J.jsx)(le,{className:q(`shrink-0 transition-transform`,t&&`rotate-180`)})]})]})}function Wm({children:e}){return(0,J.jsx)(`p`,{className:`px-1 py-2 text-xs text-muted-foreground italic`,children:e})}function Gm({status:e}){if(e===`ready`)return null;let t=e===`starting`;return(0,J.jsxs)(sl,{role:`status`,className:`w-full rounded-full border bg-muted/50 px-3 py-1.5`,children:[(0,J.jsx)(cl,{children:t?(0,J.jsx)(Xc,{}):(0,J.jsx)(ke,{})}),(0,J.jsx)(ll,{className:t?`shimmer`:void 0,children:t?`Starting the sandbox…`:`The sandbox could not be started`})]})}function Km(e){if(e)return{onChunk:Jm(e),onResponse:t=>e(`run`,t?`endpoint responded with HTTP ${t.status}`:`request sent`),onFinish:t=>e(`run`,`assistant turn finished`,t),onError:t=>e(`error`,t.message,t)}}function qm(e){try{return JSON.parse(e)}catch{return e}}function Jm(e){let t=new Map,n=new Map,r=(e,n)=>{t.set(e,(t.get(e)??``)+n)},i=e=>{let n=t.get(e)??``;return t.delete(e),n};return t=>{let a=t;switch(a.type){case`TEXT_MESSAGE_CONTENT`:case`TEXT_MESSAGE_CHUNK`:r(a.messageId??`text`,a.delta??``);break;case`TEXT_MESSAGE_END`:e(`text`,i(a.messageId??`text`),{messageId:a.messageId});break;case`REASONING_MESSAGE_CONTENT`:case`REASONING_MESSAGE_CHUNK`:case`THINKING_TEXT_MESSAGE_CONTENT`:r(`reasoning:${a.messageId??`thinking`}`,a.delta??``);break;case`REASONING_MESSAGE_END`:case`THINKING_TEXT_MESSAGE_END`:e(`reasoning`,i(`reasoning:${a.messageId??`thinking`}`),{messageId:a.messageId});break;case`TOOL_CALL_START`:e(`tool`,`${a.toolCallName} call started`,t),n.set(a.toolCallId??``,{name:a.toolCallName??``,args:``});break;case`TOOL_CALL_ARGS`:{let e=n.get(a.toolCallId??``);e&&(e.args+=a.delta??``);break}case`TOOL_CALL_END`:{let t=n.get(a.toolCallId??``);n.delete(a.toolCallId??``),e(`tool`,`${t?.name??`tool`} input complete`,{toolCallId:a.toolCallId,input:qm(t?.args??``)});break}case`TOOL_CALL_RESULT`:e(`tool`,`result for tool call ${a.toolCallId}`,{toolCallId:a.toolCallId,messageId:a.messageId,content:qm(a.content??``)});break;case`TEXT_MESSAGE_START`:case`REASONING_MESSAGE_START`:case`THINKING_TEXT_MESSAGE_START`:break;case`RUN_STARTED`:e(`run`,`run ${a.runId} started`,t);break;case`RUN_FINISHED`:e(`run`,`run ${a.runId} finished`,t);break;case`RUN_ERROR`:e(`error`,`run failed: ${a.message}`,t);break;default:e(`stream`,a.type,t)}}}function Ym(e){if(!e)return{type:`object`};if(!(`~standard`in e))return e;try{return lt(e)}catch{return{type:`object`}}}async function Xm(e,t){if(!e||!(`~standard`in e))return t;let n=await e[`~standard`].validate(t);return n.issues?null:n.value??{}}function Zm(e,t,n,r){return[...Object.keys(e).length>0?[Qm(e,n)]:[],$m(),...eh(t,r)]}function Qm(e,t){return bn({name:`render_widget`,description:`Render one of the host application's own UI widgets inline in the conversation. The widget appears in the transcript at the point of the call, so prefer it over describing the same information in text. Available widgets:
|
|
77
77
|
`+Object.entries(e).map(([e,{description:t,parameters:n}])=>`- ${e}: ${t} Props schema: ${JSON.stringify(Ym(n))}`).join(`
|
|
78
|
-
`),inputSchema:{type:`object`,properties:{widget:{type:`string`,enum:Object.keys(e),description:`Name of the widget to render.`},props:{type:`object`,description:`Props for the widget, matching its props schema.`}},required:[`widget`]}}).client((e,n)=>t(e,n?.toolCallId??``))}function $m(){return bn({name:yc,description:`Ask the user a short structured questionnaire rendered inline in the chat. Use it when the next step genuinely depends on their choices instead of asking in prose. The call stays pending until the user submits; their answers arrive as the tool output. Skipped optional questions come back with an empty answers array. An output with skipped: true means the user dismissed the questionnaire by continuing the conversation instead — do not re-ask; address their next message.`,inputSchema:{type:`object`,properties:{items:{type:`array`,minItems:1,description:`Questions shown one at a time, in order.`,items:{type:`object`,properties:{name:{type:`string`,description:`Unique key identifying the question.`},title:{type:`string`,description:`The question itself.`},description:{type:`string`,description:`Optional helper text.`},required:{type:`boolean`,description:`Whether an answer is mandatory.`},multiple:{type:`boolean`,description:`Whether several choices may be selected.`},choices:{type:`array`,minItems:1,items:{type:`object`,properties:{value:{type:`string`},label:{type:`string`},description:{type:`string`}},required:[`value`,`label`]}},input:{type:`object`,description:`Optional free-form alternative to the fixed choices.`,properties:{label:{type:`string`},placeholder:{type:`string`}},required:[`label`,`placeholder`]}},required:[`name`,`title`,`choices`]}}},required:[`items`]}}).client()}function eh(e,t){return Object.entries(e).map(([e,n])=>bn({name:e,description:n.description,inputSchema:Ym(n.parameters),...n.metadata?{metadata:n.metadata}:{}}).client(async r=>{t?.(`tool`,`executing host tool "${e}"`,{input:r});let i=await Xm(n.parameters,r??{});if(i==null)throw t?.(`error`,`input for host tool "${e}" failed schema validation`,{input:r}),Error(`Input for tool "${e}" failed schema validation`);try{let r=await n.execute(i);return t?.(`tool`,`host tool "${e}" returned`,{output:r}),r}catch(n){throw t?.(`error`,`host tool "${e}" threw`,{error:n}),n}}))}function th(e){if(e.length>16384)throw Error(`The authentication token is too large`);let t=e.split(`.`);if(t.length!==3||!t[1])throw Error(`The authentication token is not a JWT`);let n=t[1].replaceAll(`-`,`+`).replaceAll(`_`,`/`),r=n.padEnd(Math.ceil(n.length/4)*4,`=`),i;try{i=JSON.parse(atob(r))}catch{throw Error(`The authentication token has an invalid payload`)}let a=i?.exp;if(!Number.isInteger(a)||Number(a)<=0)throw Error(`The authentication token has no valid expiry`);return Number(a)*1e3}function nh(e){let t=e.get(`authorization`);return t?.startsWith(`Bearer `)?t.slice(7):void 0}async function rh(e,t){let{generateAuthToken:n,fetchClient:r}=e;if(typeof n==`function`)return(await n())?.token;let{url:i,...a}=n,o=new Headers(a.headers);o.has(`accept`)||o.set(`accept`,`application/json`);let s=await r(i,{method:`POST`,credentials:`include`,cache:`no-store`,...a,headers:o,signal:a.signal?AbortSignal.any([t,a.signal]):t});if(!s.ok)throw Error(`Authentication endpoint returned HTTP ${s.status}`);return(await s.json())?.token}async function ih(e){let{session:t,onStateChange:n,debug:r}=e,{signal:i}=t.abortController,a=typeof e.generateAuthToken==`function`?`generateAuthToken`:`Authentication endpoint`;try{let o=await rh(e,i);if(typeof o!=`string`||!o)throw Error(`${a} did not return a token`);let s=th(o);if(s<=Date.now())throw Error(`${a} returned an expired token`);return t.cached={value:o,expiresAt:s},n({status:`ready`}),r?.(`auth`,`chat authentication ready`,{expiresAt:new Date(s)}),o}catch(e){let t=e instanceof Error?e:Error(`Chat authentication failed`);throw i.aborted||(n({status:`error`,error:t}),r?.(`error`,`chat authentication failed: ${t.message}`)),t}}async function ah(e){let{session:t,force:n=!1,onStateChange:r}=e,i=Date.now();if(!n&&t.cached&&t.cached.expiresAt-i>6e4)return t.cached.value;if(t.refreshPromise)return await t.refreshPromise;r({status:`loading`});let a=ih(e);t.refreshPromise=a;try{return await a}finally{t.refreshPromise===a&&(t.refreshPromise=void 0)}}async function oh(e){e.session.abortController.signal.aborted&&(e.session.abortController=new AbortController),await ah(e)}function sh({session:e}){e.abortController.abort(),e.refreshPromise=void 0}async function ch(e){let{input:t,init:n,session:r,fetchClient:i,debug:a}=e,o=await i(t,n);if(o.status!==401||r.abortController.signal.aborted)return o;let s=nh(new Headers(n?.headers)),c=!s||r.cached?.value===s;c&&(r.cached=void 0),a?.(`auth`,`chat token was rejected; refreshing once`);let l=await ah({...e,force:c}),u=new Headers(n?.headers);return u.set(`authorization`,`Bearer ${l}`),await o.body?.cancel(),await i(t,{...n,headers:u})}const lh=[`header`,`empty`,`composerActions`];function uh(e){return`${$s}${e===`composerActions`?`composer-actions`:e}`}function dh(e,t,n){let[r,i]=(0,y.useState)(new Set),a=(0,y.useRef)(new Map);return(0,y.useEffect)(()=>{for(let r of lh){let i=e?.[r],o=a.current.get(r);if(o?.renderer===i||(o&&(o.cleanup?.(),o.container.remove(),a.current.delete(r),n?.(`mount`,`host slot "${r}" disposed`)),!i))continue;let s=document.createElement(`div`);s.slot=uh(r),t.append(s);let c=i(s);a.current.set(r,{renderer:i,container:s,cleanup:c??void 0}),n?.(`mount`,`host slot "${r}" rendered`)}i(e=>{let t=new Set(a.current.keys());return t.size===e.size&&[...t].every(t=>e.has(t))?e:t})},[e,t,n]),(0,y.useEffect)(()=>()=>{for(let e of a.current.values())e.cleanup?.(),e.container.remove();a.current.clear()},[]),r}function fh({container:e,cleanup:t}){t?.(),e.remove()}function ph(e,t,n){let[r,i]=(0,y.useState)(new Set),a=(0,y.useRef)(new Map),o=e=>{let t=[];for(let[n,r]of a.current)e(r)&&(fh(r),a.current.delete(n),t.push(jc(n)));return t.length>0&&i(e=>{let n=new Set(e);for(let e of t)n.delete(e);return n}),t.length},s=(0,y.useRef)(!0);(0,y.useEffect)(()=>(s.current=!0,()=>{s.current=!1,o(()=>!0)}),[]);let c=(0,y.useRef)(e);c.current=e;let l=(0,y.useRef)(n);l.current=n;let u=(0,y.useCallback)(async({widget:e,props:n},r)=>{let u=l.current;u?.(`widget`,`agent requested widget "${e}"`,{toolCallId:r,props:n});let d=Ac(c.current,e);if(!d)throw Error(`Unknown widget "${e}"`);let f=await Xm(d.parameters,n??{});if(f==null)throw u?.(`error`,`props for widget "${e}" failed validation`,{props:n}),Error(`Props for widget "${e}" failed validation`);if(!s.current)throw Error(`The chat is no longer mounted`);let p=jc(r),m=a.current.get(r);m&&(u?.(`widget`,`replacing previous render of "${e}"`,{toolCallId:r}),fh(m));let h=document.createElement(`div`);h.slot=p,t.append(h);let g=d.render(f,h);a.current.set(r,{widget:e,container:h,cleanup:g??void 0});let _=o(()=>a.current.size>20);return _>0&&u?.(`widget`,`evicted ${_} widget render(s) past the active cap`,{cap:20}),i(e=>new Set(e).add(p)),u?.(`widget`,`widget "${e}" rendered`,{slotName:p}),{widget:e,rendered:!0}},[t]);return(0,y.useEffect)(()=>{let t=o(t=>!Ac(e,t.widget));t>0&&n?.(`widget`,`disposed ${t} render(s) of widgets no longer registered`)},[e,n]),{activeSlots:r,renderWidget:u,discardAllRenders:()=>o(()=>!0)}}const mh={};function hh({options:n,host:r,controller:i}){let a=n.widgets??mh,o=(0,y.useMemo)(()=>t(n.debug),[n.debug]),{activeSlots:s,renderWidget:c,discardAllRenders:l}=ph(a,r,o),u=dh(n.slots,r,o),[d,f]=(0,y.useState)({status:`loading`}),p=(0,y.useRef)(n);p.current=n;let[m]=(0,y.useState)(()=>({generateAuthToken:n.generateAuthToken??{url:`/api/astralbeam/token`},session:{cached:void 0,refreshPromise:void 0,abortController:new AbortController},onStateChange:f,fetchClient:globalThis.fetch.bind(globalThis),debug:o}));m.debug=o,m.generateAuthToken=n.generateAuthToken??{url:`/api/astralbeam/token`},(0,y.useEffect)(()=>(oh(m).catch(()=>void 0),()=>sh(m)),[m]);let h=(0,y.useMemo)(()=>Zm(a,n.tools??{},c,o),[a,n.tools,o,c]),g=(0,y.useMemo)(()=>new Set(h.map(e=>e.name)),[h]),_=(0,y.useMemo)(()=>{let e={};for(let t of h){let n=t.metadata?.title;typeof n==`string`&&n.length>0&&(e[t.name]=n)}return e},[h]);(0,y.useEffect)(()=>{o?.(`mount`,`tool set declared to the agent`,{tools:[...g],widgets:Object.keys(a)})},[o,g,a]);let[v]=(0,y.useState)(()=>wr(()=>e(p.current.apiUrl).chat,async()=>({headers:{authorization:`Bearer ${await ah(m)}`},fetchClient:(e,t)=>ch({...m,input:e,init:t})}))),b=(0,y.useMemo)(()=>Km(o),[o]),x=(0,y.useMemo)(()=>({...n.agentId?{agentId:n.agentId}:{},...n.debug?{debug:!0}:{}}),[n.agentId,n.debug]),[S,C]=(0,y.useState)(void 0),{messages:w,sendMessage:T,clear:E,status:D,error:O,addToolResult:k,stop:A,reload:j}=$i({initialMessages:[],connection:v,tools:h,forwardedProps:x,...b||{},onCustomEvent:(e,t)=>{let n=t?.state,r=e===`astralbeam.sandbox.status`&&(n===`starting`||n===`ready`||n===`error`)?n:void 0;if(r===void 0){o?.(`stream`,`custom event "${e}"`,t);return}o?.(`sandbox`,`sandbox ${r}`),C(r)}}),[M,N]=(0,y.useState)(!0);(0,y.useEffect)(()=>{let t=!1,r=new URL(e(n.apiUrl).config,globalThis.location.href);return n.agentId&&r.searchParams.set(`agentId`,n.agentId),(async()=>{try{let e=await ah(m),n=await fetch(r,{headers:{authorization:`Bearer ${e}`}});if(!n.ok)throw Error(`The config request answered ${n.status}`);let i=await n.json();if(t)return;let a=i.capabilities?.attachments!==!1;N(a),o?.(`mount`,`agent capabilities resolved`,{attachments:a})}catch(e){o?.(`error`,`agent capabilities could not be resolved; keeping the defaults`,e)}})(),()=>{t=!0}},[m,o,n.agentId,n.apiUrl]);let P=(0,y.useMemo)(()=>e(n.apiUrl).files,[n.apiUrl]),ee=(0,y.useMemo)(()=>Du(w),[w]),F=ee.files.length>0||ee.commands.length>0;(0,y.useEffect)(()=>{o?.(`status`,`chat status is "${D}"`)},[o,D]);let[I,L]=(0,y.useState)(``),[R,z]=(0,y.useState)([]),B=(0,y.useMemo)(()=>nc(M?n.attachments:!1),[n.attachments,M]),V=(0,y.useRef)(0);(0,y.useEffect)(()=>{B.enabled||z([])},[B.enabled]);let H=D===`submitted`||D===`streaming`,te=H&&!Tc(w),ne=d.status===`loading`,re=d.status===`error`?d.error:void 0,ie=ne||re!==void 0||H||Ec(w,g),U=()=>{for(let e of w)for(let t of e.parts)t.type!==`tool-call`||wc(t)||(t.name===`ask_questionnaire`?(o?.(`questionnaire`,`skipping pending questionnaire before send`,{id:t.id}),k({toolCallId:t.id,tool:t.name,output:{answers:[],skipped:!0}})):(o?.(`tool`,`settling unimplemented tool call "${t.name}" as error`,{id:t.id}),k({toolCallId:t.id,tool:t.name,output:null,state:`output-error`,errorText:`The page hosting this chat has no implementation for "${t.name}"`})))},oe=e=>{let t=pc({files:e,existing:R,limits:B,createId:()=>`attachment-${V.current++}`});z(e=>[...e,...t.map(({draft:e})=>e)]);let n=(e,t)=>z(n=>n.map(n=>n.id===e?{...n,...t}:n));for(let{draft:e,file:r}of t){if(e.status===`error`){o?.(`attachment`,`rejected "${e.name}"`,{reason:e.error,size:e.size,type:r.type});continue}o?.(`attachment`,`attached "${e.name}"`,{kind:e.kind,mimeType:e.mimeType,size:e.size}),mc(r).then(t=>n(e.id,{status:`ready`,data:t}),t=>{o?.(`error`,`attachment "${e.name}" could not be read`,t),n(e.id,{status:`error`,error:`The file could not be read`})})}},se=e=>{o?.(`attachment`,`attachment removed`,{id:e}),z(t=>t.filter(t=>t.id!==e))},ce=()=>{let e=I.trim(),t=vc(R),n=R.some(e=>e.status===`reading`);ie||n||e.length===0&&t.length===0||(U(),o?.(`send`,e.length>0?e:`${t.length} attachment(s), no message text`,t.length===0?void 0:{attachments:R.filter(e=>e.status===`ready`).map(e=>({name:e.name,kind:e.kind,size:e.size}))}),T(t.length===0?e:{content:[...t,...e.length>0?[{type:`text`,content:e}]:[]]}),L(``),z([]))},le=(e,t)=>{o?.(`questionnaire`,`answers submitted`,{toolCallId:e,answers:t}),k({toolCallId:e,tool:yc,output:{answers:t}})},ue=()=>{o?.(`status`,`conversation reset`),E(),L(``),z([]),C(void 0),l()};(0,y.useEffect)(()=>(i.reset=ue,i.stop=A,()=>{i.reset=void 0,i.stop=void 0}));let de=n.showHeader!==!1;return(0,J.jsxs)(Qo,{className:q(`h-full w-full gap-0 rounded-none bg-background text-foreground ring-0`,!de&&`pt-0`),children:[de&&(0,J.jsx)($o,{className:`gap-1 border-b`,children:u.has(`header`)?(0,J.jsx)(`slot`,{name:uh(`header`)}):(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(es,{children:n.title??`AstralBeam`}),(0,J.jsx)(ts,{children:(0,J.jsx)(Zo,{variant:`outline`,size:`icon-sm`,"aria-label":`Reset conversation`,disabled:H||w.length===0,onClick:ue,children:(0,J.jsx)(ae,{})})})]})}),(0,J.jsx)(ns,{className:`min-h-0 flex-1 overflow-hidden p-0`,children:(0,J.jsx)(Wp,{messages:w,filesEndpoint:P,emptySlot:u.has(`empty`)?uh(`empty`):void 0,emptyTitle:n.emptyTitle,emptyDescription:n.emptyDescription,widgets:a,toolTitles:_,activeSlots:s,isBusy:ie,awaitingReply:te,onQuestionnaireAnswers:le})}),(0,J.jsxs)(rs,{className:`flex-col gap-2 rounded-none border-t-0 bg-transparent pt-1`,children:[S!==void 0&&(0,J.jsx)(Gm,{status:S}),n.sandboxPanel===!0&&F&&(0,J.jsx)(Um,{activity:ee}),(0,J.jsx)(tl,{title:n.title??`AstralBeam`,actionsSlot:u.has(`composerActions`)?uh(`composerActions`):void 0,draft:I,onDraftChange:L,onSend:ce,onStop:()=>{o?.(`status`,`generation stopped by user`),A()},onRetry:w.length>0?()=>void j():void 0,showError:D===`error`,error:O,streamBusy:H,isBusy:ie,authPending:ne,authError:re,onAuthRetry:m?()=>void ah({...m,force:!0}).catch(()=>void 0):void 0,attachments:R,attachmentLimits:B,onAddFiles:oe,onRemoveAttachment:se})]})]})}function gh(e,t){let n=e.host.parentElement??document.body,r=Ic(),i=document.createElement(`style`);e.append(i);let a=()=>{i.textContent=Lc(n,r),t()?.(`theme`,`host style bridged onto widget slots`,{rule:i.textContent})};a();let o=0,s=()=>{cancelAnimationFrame(o),o=requestAnimationFrame(a)},c=[];for(let e=n;e;e=e.parentElement){let t=new MutationObserver(s);t.observe(e,{attributeFilter:[`class`,`style`]}),c.push(t)}return()=>{cancelAnimationFrame(o);for(let e of c)e.disconnect();i.remove()}}function _h(e,n,r){let i=document.createElement(`style`);i.textContent=`/*! tailwindcss v4.3.3 | MIT License | https://tailwindcss.com */
|
|
78
|
+
`),inputSchema:{type:`object`,properties:{widget:{type:`string`,enum:Object.keys(e),description:`Name of the widget to render.`},props:{type:`object`,description:`Props for the widget, matching its props schema.`}},required:[`widget`]}}).client((e,n)=>t(e,n?.toolCallId??``))}function $m(){return bn({name:yc,description:`Ask the user a short structured questionnaire rendered inline in the chat. Use it when the next step genuinely depends on their choices instead of asking in prose. The call stays pending until the user submits; their answers arrive as the tool output. Skipped optional questions come back with an empty answers array. An output with skipped: true means the user dismissed the questionnaire by continuing the conversation instead — do not re-ask; address their next message.`,inputSchema:{type:`object`,properties:{items:{type:`array`,minItems:1,description:`Questions shown one at a time, in order.`,items:{type:`object`,properties:{name:{type:`string`,description:`Unique key identifying the question.`},title:{type:`string`,description:`The question itself.`},description:{type:`string`,description:`Optional helper text.`},required:{type:`boolean`,description:`Whether an answer is mandatory.`},multiple:{type:`boolean`,description:`Whether several choices may be selected.`},choices:{type:`array`,minItems:1,items:{type:`object`,properties:{value:{type:`string`},label:{type:`string`},description:{type:`string`}},required:[`value`,`label`]}},input:{type:`object`,description:`Optional free-form alternative to the fixed choices.`,properties:{label:{type:`string`},placeholder:{type:`string`}},required:[`label`,`placeholder`]}},required:[`name`,`title`,`choices`]}}},required:[`items`]}}).client()}function eh(e,t){return Object.entries(e).map(([e,n])=>bn({name:e,description:n.description,inputSchema:Ym(n.parameters),...n.metadata?{metadata:n.metadata}:{}}).client(async r=>{t?.(`tool`,`executing host tool "${e}"`,{input:r});let i=await Xm(n.parameters,r??{});if(i==null)throw t?.(`error`,`input for host tool "${e}" failed schema validation`,{input:r}),Error(`Input for tool "${e}" failed schema validation`);try{let r=await n.execute(i);return t?.(`tool`,`host tool "${e}" returned`,{output:r}),r}catch(n){throw t?.(`error`,`host tool "${e}" threw`,{error:n}),n}}))}function th(e){if(e.length>16384)throw Error(`The chat auth token is too large`);let t=e.split(`.`);if(t.length!==3||!t[1])throw Error(`The chat auth token is not a JWT`);let n=t[1].replaceAll(`-`,`+`).replaceAll(`_`,`/`),r=n.padEnd(Math.ceil(n.length/4)*4,`=`),i;try{i=JSON.parse(atob(r))}catch{throw Error(`The chat auth token has an invalid payload`)}let a=i?.exp;if(!Number.isInteger(a)||Number(a)<=0)throw Error(`The chat auth token has no valid expiry`);return Number(a)*1e3}function nh(e){let t=e.get(`authorization`);return t?.startsWith(`Bearer `)?t.slice(7):void 0}async function rh(e,t){let{fetchChatAuthToken:n,fetchClient:r}=e;if(typeof n==`function`)return(await n())?.token;let{url:i,...a}=n,o=new Headers(a.headers);o.has(`accept`)||o.set(`accept`,`application/json`);let s=await r(i,{method:`POST`,credentials:`include`,cache:`no-store`,...a,headers:o,signal:a.signal?AbortSignal.any([t,a.signal]):t});if(!s.ok)throw Error(`Authentication endpoint returned HTTP ${s.status}`);return(await s.json())?.token}async function ih(e){let{session:t,onStateChange:n,debug:r}=e,{signal:i}=t.abortController,a=typeof e.fetchChatAuthToken==`function`?`fetchChatAuthToken`:`Authentication endpoint`;try{let o=await rh(e,i);if(typeof o!=`string`||!o)throw Error(`${a} did not return a token`);let s=th(o);if(s<=Date.now())throw Error(`${a} returned an expired token`);return t.cached={value:o,expiresAt:s},n({status:`ready`}),r?.(`auth`,`chat authentication ready`,{expiresAt:new Date(s)}),o}catch(e){let t=e instanceof Error?e:Error(`Chat authentication failed`);throw i.aborted||(n({status:`error`,error:t}),r?.(`error`,`chat authentication failed: ${t.message}`)),t}}async function ah(e){let{session:t,force:n=!1,onStateChange:r}=e,i=Date.now();if(!n&&t.cached&&t.cached.expiresAt-i>6e4)return t.cached.value;if(t.refreshPromise)return await t.refreshPromise;r({status:`loading`});let a=ih(e);t.refreshPromise=a;try{return await a}finally{t.refreshPromise===a&&(t.refreshPromise=void 0)}}async function oh(e){e.session.abortController.signal.aborted&&(e.session.abortController=new AbortController),await ah(e)}function sh({session:e}){e.abortController.abort(),e.refreshPromise=void 0}async function ch(e){let{input:t,init:n,session:r,fetchClient:i,debug:a}=e,o=await i(t,n);if(o.status!==401||r.abortController.signal.aborted)return o;let s=nh(new Headers(n?.headers)),c=!s||r.cached?.value===s;c&&(r.cached=void 0),a?.(`auth`,`chat auth token was rejected; refreshing once`);let l=await ah({...e,force:c}),u=new Headers(n?.headers);return u.set(`authorization`,`Bearer ${l}`),await o.body?.cancel(),await i(t,{...n,headers:u})}const lh=[`header`,`empty`,`composerActions`];function uh(e){return`${$s}${e===`composerActions`?`composer-actions`:e}`}function dh(e,t,n){let[r,i]=(0,y.useState)(new Set),a=(0,y.useRef)(new Map);return(0,y.useEffect)(()=>{for(let r of lh){let i=e?.[r],o=a.current.get(r);if(o?.renderer===i||(o&&(o.cleanup?.(),o.container.remove(),a.current.delete(r),n?.(`mount`,`host slot "${r}" disposed`)),!i))continue;let s=document.createElement(`div`);s.slot=uh(r),t.append(s);let c=i(s);a.current.set(r,{renderer:i,container:s,cleanup:c??void 0}),n?.(`mount`,`host slot "${r}" rendered`)}i(e=>{let t=new Set(a.current.keys());return t.size===e.size&&[...t].every(t=>e.has(t))?e:t})},[e,t,n]),(0,y.useEffect)(()=>()=>{for(let e of a.current.values())e.cleanup?.(),e.container.remove();a.current.clear()},[]),r}function fh({container:e,cleanup:t}){t?.(),e.remove()}function ph(e,t,n){let[r,i]=(0,y.useState)(new Set),a=(0,y.useRef)(new Map),o=e=>{let t=[];for(let[n,r]of a.current)e(r)&&(fh(r),a.current.delete(n),t.push(jc(n)));return t.length>0&&i(e=>{let n=new Set(e);for(let e of t)n.delete(e);return n}),t.length},s=(0,y.useRef)(!0);(0,y.useEffect)(()=>(s.current=!0,()=>{s.current=!1,o(()=>!0)}),[]);let c=(0,y.useRef)(e);c.current=e;let l=(0,y.useRef)(n);l.current=n;let u=(0,y.useCallback)(async({widget:e,props:n},r)=>{let u=l.current;u?.(`widget`,`agent requested widget "${e}"`,{toolCallId:r,props:n});let d=Ac(c.current,e);if(!d)throw Error(`Unknown widget "${e}"`);let f=await Xm(d.parameters,n??{});if(f==null)throw u?.(`error`,`props for widget "${e}" failed validation`,{props:n}),Error(`Props for widget "${e}" failed validation`);if(!s.current)throw Error(`The chat is no longer mounted`);let p=jc(r),m=a.current.get(r);m&&(u?.(`widget`,`replacing previous render of "${e}"`,{toolCallId:r}),fh(m));let h=document.createElement(`div`);h.slot=p,t.append(h);let g=d.render(f,h);a.current.set(r,{widget:e,container:h,cleanup:g??void 0});let _=o(()=>a.current.size>20);return _>0&&u?.(`widget`,`evicted ${_} widget render(s) past the active cap`,{cap:20}),i(e=>new Set(e).add(p)),u?.(`widget`,`widget "${e}" rendered`,{slotName:p}),{widget:e,rendered:!0}},[t]);return(0,y.useEffect)(()=>{let t=o(t=>!Ac(e,t.widget));t>0&&n?.(`widget`,`disposed ${t} render(s) of widgets no longer registered`)},[e,n]),{activeSlots:r,renderWidget:u,discardAllRenders:()=>o(()=>!0)}}const mh={};function hh({options:n,host:r,controller:i}){let a=n.widgets??mh,o=(0,y.useMemo)(()=>t(n.debug),[n.debug]),{activeSlots:s,renderWidget:c,discardAllRenders:l}=ph(a,r,o),u=dh(n.slots,r,o),[d,f]=(0,y.useState)({status:`loading`}),p=(0,y.useRef)(n);p.current=n;let[m]=(0,y.useState)(()=>({fetchChatAuthToken:n.fetchChatAuthToken??{url:`/api/astralbeam/token`},session:{cached:void 0,refreshPromise:void 0,abortController:new AbortController},onStateChange:f,fetchClient:globalThis.fetch.bind(globalThis),debug:o}));m.debug=o,m.fetchChatAuthToken=n.fetchChatAuthToken??{url:`/api/astralbeam/token`},(0,y.useEffect)(()=>(oh(m).catch(()=>void 0),()=>sh(m)),[m]);let h=(0,y.useMemo)(()=>Zm(a,n.tools??{},c,o),[a,n.tools,o,c]),g=(0,y.useMemo)(()=>new Set(h.map(e=>e.name)),[h]),_=(0,y.useMemo)(()=>{let e={};for(let t of h){let n=t.metadata?.title;typeof n==`string`&&n.length>0&&(e[t.name]=n)}return e},[h]);(0,y.useEffect)(()=>{o?.(`mount`,`tool set declared to the agent`,{tools:[...g],widgets:Object.keys(a)})},[o,g,a]);let[v]=(0,y.useState)(()=>wr(()=>e(p.current.apiUrl).chat,async()=>({headers:{authorization:`Bearer ${await ah(m)}`},fetchClient:(e,t)=>ch({...m,input:e,init:t})}))),b=(0,y.useMemo)(()=>Km(o),[o]),x=(0,y.useMemo)(()=>({...n.agentId?{agentId:n.agentId}:{},...n.debug?{debug:!0}:{}}),[n.agentId,n.debug]),[S,C]=(0,y.useState)(void 0),{messages:w,sendMessage:T,clear:E,status:D,error:O,addToolResult:k,stop:A,reload:j}=$i({initialMessages:[],connection:v,tools:h,forwardedProps:x,...b||{},onCustomEvent:(e,t)=>{let n=t?.state,r=e===`astralbeam.sandbox.status`&&(n===`starting`||n===`ready`||n===`error`)?n:void 0;if(r===void 0){o?.(`stream`,`custom event "${e}"`,t);return}o?.(`sandbox`,`sandbox ${r}`),C(r)}}),[M,N]=(0,y.useState)(!0);(0,y.useEffect)(()=>{let t=!1,r=new URL(e(n.apiUrl).config,globalThis.location.href);return n.agentId&&r.searchParams.set(`agentId`,n.agentId),(async()=>{try{let e=await ah(m),n=await fetch(r,{headers:{authorization:`Bearer ${e}`}});if(!n.ok)throw Error(`The config request answered ${n.status}`);let i=await n.json();if(t)return;let a=i.capabilities?.attachments!==!1;N(a),o?.(`mount`,`agent capabilities resolved`,{attachments:a})}catch(e){o?.(`error`,`agent capabilities could not be resolved; keeping the defaults`,e)}})(),()=>{t=!0}},[m,o,n.agentId,n.apiUrl]);let P=(0,y.useMemo)(()=>e(n.apiUrl).files,[n.apiUrl]),ee=(0,y.useMemo)(()=>Du(w),[w]),F=ee.files.length>0||ee.commands.length>0;(0,y.useEffect)(()=>{o?.(`status`,`chat status is "${D}"`)},[o,D]);let[I,L]=(0,y.useState)(``),[R,z]=(0,y.useState)([]),B=(0,y.useMemo)(()=>nc(M?n.attachments:!1),[n.attachments,M]),V=(0,y.useRef)(0);(0,y.useEffect)(()=>{B.enabled||z([])},[B.enabled]);let H=D===`submitted`||D===`streaming`,te=H&&!Tc(w),ne=d.status===`loading`,re=d.status===`error`?d.error:void 0,ie=ne||re!==void 0||H||Ec(w,g),U=()=>{for(let e of w)for(let t of e.parts)t.type!==`tool-call`||wc(t)||(t.name===`ask_questionnaire`?(o?.(`questionnaire`,`skipping pending questionnaire before send`,{id:t.id}),k({toolCallId:t.id,tool:t.name,output:{answers:[],skipped:!0}})):(o?.(`tool`,`settling unimplemented tool call "${t.name}" as error`,{id:t.id}),k({toolCallId:t.id,tool:t.name,output:null,state:`output-error`,errorText:`The page hosting this chat has no implementation for "${t.name}"`})))},oe=e=>{let t=pc({files:e,existing:R,limits:B,createId:()=>`attachment-${V.current++}`});z(e=>[...e,...t.map(({draft:e})=>e)]);let n=(e,t)=>z(n=>n.map(n=>n.id===e?{...n,...t}:n));for(let{draft:e,file:r}of t){if(e.status===`error`){o?.(`attachment`,`rejected "${e.name}"`,{reason:e.error,size:e.size,type:r.type});continue}o?.(`attachment`,`attached "${e.name}"`,{kind:e.kind,mimeType:e.mimeType,size:e.size}),mc(r).then(t=>n(e.id,{status:`ready`,data:t}),t=>{o?.(`error`,`attachment "${e.name}" could not be read`,t),n(e.id,{status:`error`,error:`The file could not be read`})})}},se=e=>{o?.(`attachment`,`attachment removed`,{id:e}),z(t=>t.filter(t=>t.id!==e))},ce=()=>{let e=I.trim(),t=vc(R),n=R.some(e=>e.status===`reading`);ie||n||e.length===0&&t.length===0||(U(),o?.(`send`,e.length>0?e:`${t.length} attachment(s), no message text`,t.length===0?void 0:{attachments:R.filter(e=>e.status===`ready`).map(e=>({name:e.name,kind:e.kind,size:e.size}))}),T(t.length===0?e:{content:[...t,...e.length>0?[{type:`text`,content:e}]:[]]}),L(``),z([]))},le=(e,t)=>{o?.(`questionnaire`,`answers submitted`,{toolCallId:e,answers:t}),k({toolCallId:e,tool:yc,output:{answers:t}})},ue=()=>{o?.(`status`,`conversation reset`),E(),L(``),z([]),C(void 0),l()};(0,y.useEffect)(()=>(i.reset=ue,i.stop=A,()=>{i.reset=void 0,i.stop=void 0}));let de=n.showHeader!==!1;return(0,J.jsxs)(Qo,{className:q(`h-full w-full gap-0 rounded-none bg-background text-foreground ring-0`,!de&&`pt-0`),children:[de&&(0,J.jsx)($o,{className:`gap-1 border-b`,children:u.has(`header`)?(0,J.jsx)(`slot`,{name:uh(`header`)}):(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(es,{children:n.title??`AstralBeam`}),(0,J.jsx)(ts,{children:(0,J.jsx)(Zo,{variant:`outline`,size:`icon-sm`,"aria-label":`Reset conversation`,disabled:H||w.length===0,onClick:ue,children:(0,J.jsx)(ae,{})})})]})}),(0,J.jsx)(ns,{className:`min-h-0 flex-1 overflow-hidden p-0`,children:(0,J.jsx)(Wp,{messages:w,filesEndpoint:P,emptySlot:u.has(`empty`)?uh(`empty`):void 0,emptyTitle:n.emptyTitle,emptyDescription:n.emptyDescription,widgets:a,toolTitles:_,activeSlots:s,isBusy:ie,awaitingReply:te,onQuestionnaireAnswers:le})}),(0,J.jsxs)(rs,{className:`flex-col gap-2 rounded-none border-t-0 bg-transparent pt-1`,children:[S!==void 0&&(0,J.jsx)(Gm,{status:S}),n.sandboxPanel===!0&&F&&(0,J.jsx)(Um,{activity:ee}),(0,J.jsx)(tl,{title:n.title??`AstralBeam`,actionsSlot:u.has(`composerActions`)?uh(`composerActions`):void 0,draft:I,onDraftChange:L,onSend:ce,onStop:()=>{o?.(`status`,`generation stopped by user`),A()},onRetry:w.length>0?()=>void j():void 0,showError:D===`error`,error:O,streamBusy:H,isBusy:ie,authPending:ne,authError:re,onAuthRetry:m?()=>void ah({...m,force:!0}).catch(()=>void 0):void 0,attachments:R,attachmentLimits:B,onAddFiles:oe,onRemoveAttachment:se})]})]})}function gh(e,t){let n=e.host.parentElement??document.body,r=Ic(),i=document.createElement(`style`);e.append(i);let a=()=>{i.textContent=Lc(n,r),t()?.(`theme`,`host style bridged onto widget slots`,{rule:i.textContent})};a();let o=0,s=()=>{cancelAnimationFrame(o),o=requestAnimationFrame(a)},c=[];for(let e=n;e;e=e.parentElement){let t=new MutationObserver(s);t.observe(e,{attributeFilter:[`class`,`style`]}),c.push(t)}return()=>{cancelAnimationFrame(o);for(let e of c)e.disconnect();i.remove()}}function _h(e,n,r){let i=document.createElement(`style`);i.textContent=`/*! tailwindcss v4.3.3 | MIT License | https://tailwindcss.com */
|
|
79
79
|
@layer properties{:root,:host{--shimmer-angle:20deg}*,:before,:after,::backdrop{--tw-translate-x:0;--tw-translate-y:0;--tw-translate-z:0;--tw-scroll-snap-strictness:proximity;--tw-space-y-reverse:0;--tw-border-style:solid;--tw-leading:initial;--tw-font-weight:initial;--tw-tracking:initial;--tw-ordinal:initial;--tw-slashed-zero:initial;--tw-numeric-figure:initial;--tw-numeric-spacing:initial;--tw-numeric-fraction:initial;--tw-shadow:0 0 #0000;--tw-shadow-color:initial;--tw-shadow-alpha:100%;--tw-inset-shadow:0 0 #0000;--tw-inset-shadow-color:initial;--tw-inset-shadow-alpha:100%;--tw-ring-color:initial;--tw-ring-shadow:0 0 #0000;--tw-inset-ring-color:initial;--tw-inset-ring-shadow:0 0 #0000;--tw-ring-inset:initial;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-offset-shadow:0 0 #0000;--tw-outline-style:solid;--tw-duration:initial;--tw-ease:initial;--tw-content:"";--tw-scrollbar-thumb:#0000;--tw-scrollbar-track:#0000;--tw-scale-x:1;--tw-scale-y:1;--tw-scale-z:1;--tw-animation-delay:0s;--tw-animation-direction:normal;--tw-animation-duration:initial;--tw-animation-fill-mode:none;--tw-animation-iteration-count:1;--tw-enter-blur:0;--tw-enter-opacity:1;--tw-enter-rotate:0;--tw-enter-scale:1;--tw-enter-translate-x:0;--tw-enter-translate-y:0;--tw-exit-blur:0;--tw-exit-opacity:1;--tw-exit-rotate:0;--tw-exit-scale:1;--tw-exit-translate-x:0;--tw-exit-translate-y:0;--scroll-fade-t:0px;--scroll-fade-b:0px;--scroll-fade-s:0px;--scroll-fade-e:0px;--scroll-fade-mask:initial;--shimmer-image:initial;--shimmer-text-fill:initial}}@layer theme{:root,:host{--font-sans:var(--font-sans);--font-mono:ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;--spacing:.25rem;--container-sm:24rem;--text-xs:.75rem;--text-xs--line-height:calc(1 / .75);--text-sm:.875rem;--text-sm--line-height:calc(1.25 / .875);--text-base:1rem;--text-base--line-height:calc(1.5 / 1);--font-weight-medium:500;--font-weight-semibold:600;--tracking-tight:-.025em;--leading-tight:1.25;--leading-snug:1.375;--leading-relaxed:1.625;--radius-md:calc(var(--radius) * .8);--ease-in-out:cubic-bezier(.4, 0, .2, 1);--animate-spin:spin 1s linear infinite;--default-transition-duration:.15s;--default-transition-timing-function:cubic-bezier(.4, 0, .2, 1);--default-font-family:var(--font-sans);--default-mono-font-family:var(--font-mono);--font-heading:var(--font-heading)}}@layer base{*,:after,:before,::backdrop{box-sizing:border-box;border:0 solid;margin:0;padding:0}::file-selector-button{box-sizing:border-box;border:0 solid;margin:0;padding:0}html,:host{-webkit-text-size-adjust:100%;tab-size:4;line-height:1.5;font-family:var(--default-font-family,-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", "Noto Sans", Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji");font-feature-settings:var(--default-font-feature-settings,normal);font-variation-settings:var(--default-font-variation-settings,normal);-webkit-tap-highlight-color:transparent}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;-webkit-text-decoration:inherit;-webkit-text-decoration:inherit;-webkit-text-decoration:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,samp,pre{font-family:var(--default-mono-font-family,ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace);font-feature-settings:var(--default-mono-font-feature-settings,normal);font-variation-settings:var(--default-mono-font-variation-settings,normal);font-size:1em}small{font-size:80%}sub,sup{vertical-align:baseline;font-size:75%;line-height:0;position:relative}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}:-moz-focusring:where(:not(iframe)){outline:auto}progress{vertical-align:baseline}summary{display:list-item}ol,ul,menu{list-style:none}img,svg,video,canvas,audio,iframe,embed,object{vertical-align:middle;display:block}img,video{max-width:100%;height:auto}button,input,select,optgroup,textarea{font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;color:inherit;opacity:1;background-color:#0000;border-radius:0}::file-selector-button{font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;color:inherit;opacity:1;background-color:#0000;border-radius:0}:where(select:is([multiple],[size])) optgroup{font-weight:bolder}:where(select:is([multiple],[size])) optgroup option{padding-inline-start:20px}::file-selector-button{margin-inline-end:4px}::placeholder{opacity:1}@supports (not ((-webkit-appearance:-apple-pay-button))) or (contain-intrinsic-size:1px){::placeholder{color:currentColor}@supports (color:color-mix(in lab, red, red)){::placeholder{color:color-mix(in oklab, currentcolor 50%, transparent)}}}textarea{resize:vertical}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-date-and-time-value{min-height:1lh;text-align:inherit}::-webkit-datetime-edit{display:inline-flex}::-webkit-datetime-edit-fields-wrapper{padding:0}::-webkit-datetime-edit{padding-block:0}::-webkit-datetime-edit-year-field{padding-block:0}::-webkit-datetime-edit-month-field{padding-block:0}::-webkit-datetime-edit-day-field{padding-block:0}::-webkit-datetime-edit-hour-field{padding-block:0}::-webkit-datetime-edit-minute-field{padding-block:0}::-webkit-datetime-edit-second-field{padding-block:0}::-webkit-datetime-edit-millisecond-field{padding-block:0}::-webkit-datetime-edit-meridiem-field{padding-block:0}::-webkit-calendar-picker-indicator{line-height:1}:-moz-ui-invalid{box-shadow:none}button,input:where([type=button],[type=reset],[type=submit]){appearance:button}::file-selector-button{appearance:button}::-webkit-inner-spin-button{height:auto}::-webkit-outer-spin-button{height:auto}[hidden]:where(:not([hidden=until-found])){display:none!important}*{border-color:var(--border);outline-color:var(--ring)}@supports (color:color-mix(in lab, red, red)){*{outline-color:color-mix(in oklab, var(--ring) 50%, transparent)}}:host{font-family:var(--font-sans);font-size:var(--text-sm);line-height:var(--tw-leading,var(--text-sm--line-height));color-scheme:light;font-style:normal;line-height:1.5;display:block}.astralbeam-root{background-color:var(--background);font-family:var(--font-sans);color:var(--foreground)}.dark{color-scheme:dark}button:not(:disabled),[role=button]:not(:disabled){cursor:pointer}}@layer components;@layer utilities{.\\@container\\/card-header{container:card-header/inline-size}.pointer-events-none{pointer-events:none}.collapse{visibility:collapse}.visible{visibility:visible}.sr-only{clip-path:inset(50%);white-space:nowrap;border-width:0;width:1px;height:1px;margin:-1px;padding:0;position:absolute;overflow:hidden}.absolute{position:absolute}.fixed{position:fixed}.relative{position:relative}.static{position:static}.inset-0{inset:0}.inset-x-0{inset-inline:0}.inset-s-1{inset-inline-start:var(--spacing)}.inset-s-1\\/2{inset-inline-start:50%}.start-3{inset-inline-start:calc(var(--spacing) * 3)}.end-3{inset-inline-end:calc(var(--spacing) * 3)}.top-0{top:0}.bottom-0{bottom:0}.bottom-full{bottom:100%}.z-10{z-index:10}.z-20{z-index:20}.order-first{order:-9999}.order-last{order:9999}.col-start-1{grid-column-start:1}.col-start-2{grid-column-start:2}.col-start-3{grid-column-start:3}.row-span-2{grid-row:span 2/span 2}.row-start-1{grid-row-start:1}.container{width:100%}@media (min-width:40rem){.container{max-width:40rem}}@media (min-width:48rem){.container{max-width:48rem}}@media (min-width:64rem){.container{max-width:64rem}}@media (min-width:80rem){.container{max-width:80rem}}@media (min-width:96rem){.container{max-width:96rem}}.my-1{margin-block:var(--spacing)}.my-2{margin-block:calc(var(--spacing) * 2)}.my-3{margin-block:calc(var(--spacing) * 3)}.ms-1{margin-inline-start:var(--spacing)}.ms-auto{margin-inline-start:auto}.mt-0{margin-top:0}.mt-0\\.5{margin-top:calc(var(--spacing) * .5)}.mt-1{margin-top:var(--spacing)}.mt-2{margin-top:calc(var(--spacing) * 2)}.mt-3{margin-top:calc(var(--spacing) * 3)}.mt-4{margin-top:calc(var(--spacing) * 4)}.mb-1{margin-bottom:var(--spacing)}.mb-1\\.5{margin-bottom:calc(var(--spacing) * 1.5)}.mb-2{margin-bottom:calc(var(--spacing) * 2)}.ml-auto{margin-left:auto}.block{display:block}.flex{display:flex}.grid{display:grid}.hidden{display:none}.inline{display:inline}.inline-flex{display:inline-flex}.table{display:table}.field-sizing-content{field-sizing:content}.aspect-square{aspect-ratio:1}.size-2{width:calc(var(--spacing) * 2);height:calc(var(--spacing) * 2)}.size-3{width:calc(var(--spacing) * 3);height:calc(var(--spacing) * 3)}.size-3\\.5{width:calc(var(--spacing) * 3.5);height:calc(var(--spacing) * 3.5)}.size-4{width:calc(var(--spacing) * 4);height:calc(var(--spacing) * 4)}.size-5{width:calc(var(--spacing) * 5);height:calc(var(--spacing) * 5)}.size-6{width:calc(var(--spacing) * 6);height:calc(var(--spacing) * 6)}.size-7{width:calc(var(--spacing) * 7);height:calc(var(--spacing) * 7)}.size-8{width:calc(var(--spacing) * 8);height:calc(var(--spacing) * 8)}.size-9{width:calc(var(--spacing) * 9);height:calc(var(--spacing) * 9)}.size-full{width:100%;height:100%}.h-6{height:calc(var(--spacing) * 6)}.h-7{height:calc(var(--spacing) * 7)}.h-8{height:calc(var(--spacing) * 8)}.h-9{height:calc(var(--spacing) * 9)}.h-\\[calc\\(100\\%-1px\\)\\]{height:calc(100% - 1px)}.h-auto{height:auto}.h-full{height:100%}.h-max{height:max-content}.max-h-24{max-height:calc(var(--spacing) * 24)}.max-h-40{max-height:calc(var(--spacing) * 40)}.max-h-72{max-height:calc(var(--spacing) * 72)}.max-h-80{max-height:calc(var(--spacing) * 80)}.min-h-0{min-height:0}.min-h-4{min-height:calc(var(--spacing) * 4)}.min-h-9{min-height:calc(var(--spacing) * 9)}.min-h-11{min-height:calc(var(--spacing) * 11)}.min-h-16{min-height:calc(var(--spacing) * 16)}.min-h-\\[1lh\\]{min-height:1lh}.min-h-full{min-height:100%}.w-10{width:calc(var(--spacing) * 10)}.w-24{width:calc(var(--spacing) * 24)}.w-fit{width:fit-content}.w-full{width:100%}.max-w-\\[80\\%\\]{max-width:80%}.max-w-full{max-width:100%}.max-w-sm{max-width:var(--container-sm)}.min-w-0{min-width:0}.min-w-8{min-width:calc(var(--spacing) * 8)}.min-w-40{min-width:calc(var(--spacing) * 40)}.min-w-\\[14ch\\]{min-width:14ch}.flex-1{flex:1}.shrink-0{flex-shrink:0}.border-collapse{border-collapse:collapse}.-translate-x-1{--tw-translate-x:calc(var(--spacing) * -1);translate:var(--tw-translate-x) var(--tw-translate-y)}.-translate-x-1\\/2{--tw-translate-x:calc(calc(1 / 2 * 100%) * -1);translate:var(--tw-translate-x) var(--tw-translate-y)}.-translate-y-3{--tw-translate-y:calc(var(--spacing) * -3);translate:var(--tw-translate-x) var(--tw-translate-y)}.-translate-y-3\\/4{--tw-translate-y:calc(calc(3 / 4 * 100%) * -1);translate:var(--tw-translate-x) var(--tw-translate-y)}.translate-y-3{--tw-translate-y:calc(var(--spacing) * 3);translate:var(--tw-translate-x) var(--tw-translate-y)}.translate-y-3\\/4{--tw-translate-y:calc(3 / 4 * 100%);translate:var(--tw-translate-x) var(--tw-translate-y)}.translate-y-\\[--spacing\\(0\\.45\\)\\]{--tw-translate-y:calc(var(--spacing) * .45);translate:var(--tw-translate-x) var(--tw-translate-y)}.rotate-180{rotate:180deg}.shimmer{--_spread:var(--shimmer-spread,calc(3ch + 40px));--_base:currentColor;--_highlight:var(--shimmer-color,oklch(from currentColor l c h / calc(alpha* .2)));background-image:var(--shimmer-image,linear-gradient(calc(90deg + var(--shimmer-angle)), var(--_base) calc(50% - var(--_spread)), var(--_highlight) calc(50% - var(--_spread) * .5), var(--_highlight) 50%, var(--_highlight) calc(50% + var(--_spread) * .5), var(--_base) calc(50% + var(--_spread))))}@supports (color:color-mix(in lab, red, red)){.shimmer{background-image:var(--shimmer-image,linear-gradient(calc(90deg + var(--shimmer-angle)), var(--_base) calc(50% - var(--_spread)), color-mix(in oklch, var(--_highlight), var(--_base) 50%) calc(50% - var(--_spread) * .5), var(--_highlight) 50%, color-mix(in oklch, var(--_highlight), var(--_base) 50%) calc(50% + var(--_spread) * .5), var(--_base) calc(50% + var(--_spread))))}}.shimmer{background-repeat:no-repeat;background-size:calc(200% + var(--_spread) * 2) 100%;-webkit-text-fill-color:var(--shimmer-text-fill,transparent);animation:tw-shimmer var(--shimmer-duration,2s) linear infinite;background-position:0 0;-webkit-background-clip:text;background-clip:text}.shimmer:is(.dark *){--_highlight:var(--shimmer-color,oklch(from currentColor max(.8, calc(l + .4)) c h / calc(alpha + .4)))}.shimmer:where([dir=rtl],[dir=rtl] *){animation-direction:reverse}.scroll-fade-x{--_scroll-fade-size-s:var(--scroll-fade-s-size,var(--scroll-fade-size,min(12%, calc(var(--spacing) * 10))));--_scroll-fade-size-e:var(--scroll-fade-e-size,var(--scroll-fade-size,min(12%, calc(var(--spacing) * 10))));--scroll-fade-inline:linear-gradient(to right, transparent 0, #000 var(--scroll-fade-s,0px), #000 calc(100% - var(--scroll-fade-e,0px)), transparent 100%)}.scroll-fade-x:where([dir=rtl],[dir=rtl] *){--scroll-fade-inline:linear-gradient(to left, transparent 0, #000 var(--scroll-fade-s,0px), #000 calc(100% - var(--scroll-fade-e,0px)), transparent 100%)}.scroll-fade-x{-webkit-mask-image:var(--scroll-fade-mask,var(--scroll-fade-inline));-webkit-mask-image:var(--scroll-fade-mask,var(--scroll-fade-inline));-webkit-mask-image:var(--scroll-fade-mask,var(--scroll-fade-inline));mask-image:var(--scroll-fade-mask,var(--scroll-fade-inline));-webkit-mask-composite:source-in;-webkit-mask-composite:source-in;-webkit-mask-repeat:no-repeat;mask-repeat:no-repeat;-webkit-mask-composite:source-in;mask-composite:intersect}@supports (animation-timeline:scroll()){.scroll-fade-x{animation:1ms ease-in-out scroll-fade-reveal-s,1ms ease-in-out scroll-fade-reveal-e;animation-timeline:scroll(self inline),scroll(self inline);animation-range:0 var(--scroll-fade-reveal,calc(var(--spacing) * 24)), calc(100% - var(--scroll-fade-reveal,calc(var(--spacing) * 24))) 100%;animation-fill-mode:both}}@supports not (animation-timeline:scroll()){.scroll-fade-x{--scroll-fade-s:var(--_scroll-fade-size-s);--scroll-fade-e:var(--_scroll-fade-size-e)}}.scroll-fade-b{--_scroll-fade-size-b:var(--scroll-fade-b-size,var(--scroll-fade-size,min(12%, calc(var(--spacing) * 10))));--scroll-fade-mask:linear-gradient(to bottom, #000 0, #000 calc(100% - var(--scroll-fade-b,0px)), transparent 100%);-webkit-mask-image:var(--scroll-fade-mask);-webkit-mask-image:var(--scroll-fade-mask);-webkit-mask-image:var(--scroll-fade-mask);mask-image:var(--scroll-fade-mask);-webkit-mask-composite:source-in;-webkit-mask-composite:source-in;-webkit-mask-repeat:no-repeat;mask-repeat:no-repeat;-webkit-mask-composite:source-in;mask-composite:intersect}@supports (animation-timeline:scroll()){.scroll-fade-b{animation:1ms ease-in-out scroll-fade-reveal-b;animation-timeline:scroll(self y);animation-range:calc(100% - var(--scroll-fade-reveal,calc(var(--spacing) * 24))) 100%;animation-fill-mode:both}}@supports not (animation-timeline:scroll()){.scroll-fade-b{--scroll-fade-b:var(--_scroll-fade-size-b)}}.animate-spin{animation:var(--animate-spin)}.cursor-pointer{cursor:pointer}.cursor-text{cursor:text}.resize-none{resize:none}.snap-x{scroll-snap-type:x var(--tw-scroll-snap-strictness)}.snap-mandatory{--tw-scroll-snap-strictness:mandatory}.scroll-px-1{scroll-padding-inline:var(--spacing)}.scrollbar-none{scrollbar-width:none}.scrollbar-thin{scrollbar-width:thin}.scrollbar-gutter-stable{scrollbar-gutter:stable}.list-decimal{list-style-type:decimal}.list-disc{list-style-type:disc}.auto-rows-min{grid-auto-rows:min-content}.grid-cols-\\[minmax\\(0\\,1fr\\)_auto_auto\\]{grid-template-columns:minmax(0,1fr) auto auto}.flex-col{flex-direction:column}.flex-wrap{flex-wrap:wrap}.items-center{align-items:center}.items-start{align-items:flex-start}.justify-center{justify-content:center}.justify-end{justify-content:flex-end}.justify-start{justify-content:flex-start}.gap-\\(--card-spacing\\){gap:var(--card-spacing)}.gap-0{gap:0}.gap-0\\.5{gap:calc(var(--spacing) * .5)}.gap-1{gap:var(--spacing)}.gap-1\\.5{gap:calc(var(--spacing) * 1.5)}.gap-2{gap:calc(var(--spacing) * 2)}.gap-2\\.5{gap:calc(var(--spacing) * 2.5)}.gap-3{gap:calc(var(--spacing) * 3)}.gap-4{gap:calc(var(--spacing) * 4)}.gap-6{gap:calc(var(--spacing) * 6)}:where(.space-y-1>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(var(--spacing) * var(--tw-space-y-reverse));margin-block-end:calc(var(--spacing) * calc(1 - var(--tw-space-y-reverse)))}.self-end{align-self:flex-end}.self-start{align-self:flex-start}.justify-self-end{justify-self:flex-end}.justify-self-start{justify-self:flex-start}.truncate{text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.overflow-auto{overflow:auto}.overflow-hidden{overflow:hidden}.overflow-x-auto{overflow-x:auto}.overflow-y-auto{overflow-y:auto}.overscroll-contain{overscroll-behavior:contain}.overscroll-x-contain{overscroll-behavior-x:contain}.rounded-\\[4px\\]{border-radius:4px}.rounded-\\[calc\\(var\\(--radius\\)-3px\\)\\]{border-radius:calc(var(--radius) - 3px)}.rounded-\\[min\\(var\\(--radius-md\\)\\,10px\\)\\]{border-radius:min(var(--radius-md), 10px)}.rounded-\\[min\\(var\\(--radius-md\\)\\,12px\\)\\]{border-radius:min(var(--radius-md), 12px)}.rounded-full{border-radius:3.40282e38px}.rounded-lg{border-radius:var(--radius)}.rounded-md{border-radius:calc(var(--radius) * .8)}.rounded-none{border-radius:0}.rounded-sm{border-radius:calc(var(--radius) * .6)}.rounded-xl{border-radius:calc(var(--radius) * 1.4)}.rounded-t-xl{border-top-left-radius:calc(var(--radius) * 1.4);border-top-right-radius:calc(var(--radius) * 1.4)}.rounded-b-xl{border-bottom-right-radius:calc(var(--radius) * 1.4);border-bottom-left-radius:calc(var(--radius) * 1.4)}.border{border-style:var(--tw-border-style);border-width:1px}.border-0{border-style:var(--tw-border-style);border-width:0}.border-s-2{border-inline-start-style:var(--tw-border-style);border-inline-start-width:2px}.border-t{border-top-style:var(--tw-border-style);border-top-width:1px}.border-t-0{border-top-style:var(--tw-border-style);border-top-width:0}.border-b{border-bottom-style:var(--tw-border-style);border-bottom-width:1px}.border-dashed{--tw-border-style:dashed;border-style:dashed}.border-none{--tw-border-style:none;border-style:none}.border-border{border-color:var(--border)}.border-destructive,.border-destructive\\/50{border-color:var(--destructive)}@supports (color:color-mix(in lab, red, red)){.border-destructive\\/50{border-color:color-mix(in oklab, var(--destructive) 50%, transparent)}}.border-input{border-color:var(--input)}.border-ring{border-color:var(--ring)}.border-transparent{border-color:#0000}.bg-background{background-color:var(--background)}.bg-card{background-color:var(--card)}.bg-destructive,.bg-destructive\\/10{background-color:var(--destructive)}@supports (color:color-mix(in lab, red, red)){.bg-destructive\\/10{background-color:color-mix(in oklab, var(--destructive) 10%, transparent)}}.bg-muted,.bg-muted\\/30{background-color:var(--muted)}@supports (color:color-mix(in lab, red, red)){.bg-muted\\/30{background-color:color-mix(in oklab, var(--muted) 30%, transparent)}}.bg-muted\\/50{background-color:var(--muted)}@supports (color:color-mix(in lab, red, red)){.bg-muted\\/50{background-color:color-mix(in oklab, var(--muted) 50%, transparent)}}.bg-primary{background-color:var(--primary)}.bg-primary-foreground{background-color:var(--primary-foreground)}.bg-secondary{background-color:var(--secondary)}.bg-transparent{background-color:#0000}.bg-clip-padding{background-clip:padding-box}.object-contain{object-fit:contain}.p-\\(--card-spacing\\){padding:var(--card-spacing)}.p-0{padding:0}.p-2{padding:calc(var(--spacing) * 2)}.p-3{padding:calc(var(--spacing) * 3)}.p-4{padding:calc(var(--spacing) * 4)}.p-6{padding:calc(var(--spacing) * 6)}.p-\\[3px\\]{padding:3px}.px-\\(--card-spacing\\){padding-inline:var(--card-spacing)}.px-1{padding-inline:var(--spacing)}.px-1\\.5{padding-inline:calc(var(--spacing) * 1.5)}.px-2{padding-inline:calc(var(--spacing) * 2)}.px-2\\.5{padding-inline:calc(var(--spacing) * 2.5)}.px-3{padding-inline:calc(var(--spacing) * 3)}.py-\\(--card-spacing\\){padding-block:var(--card-spacing)}.py-0{padding-block:0}.py-0\\.5{padding-block:calc(var(--spacing) * .5)}.py-1{padding-block:var(--spacing)}.py-1\\.5{padding-block:calc(var(--spacing) * 1.5)}.py-2{padding-block:calc(var(--spacing) * 2)}.py-2\\.5{padding-block:calc(var(--spacing) * 2.5)}.ps-2{padding-inline-start:calc(var(--spacing) * 2)}.ps-3{padding-inline-start:calc(var(--spacing) * 3)}.ps-5{padding-inline-start:calc(var(--spacing) * 5)}.ps-6{padding-inline-start:calc(var(--spacing) * 6)}.pe-2{padding-inline-end:calc(var(--spacing) * 2)}.pt-0{padding-top:0}.pt-1{padding-top:var(--spacing)}.pt-2{padding-top:calc(var(--spacing) * 2)}.pb-2{padding-bottom:calc(var(--spacing) * 2)}.text-center{text-align:center}.text-justify{text-align:justify}.text-start{text-align:start}.align-middle{vertical-align:middle}.font-heading{font-family:var(--font-heading)}.font-mono{font-family:var(--font-mono)}.text-base{font-size:var(--text-base);line-height:var(--tw-leading,var(--text-base--line-height))}.text-sm{font-size:var(--text-sm);line-height:var(--tw-leading,var(--text-sm--line-height))}.text-sm\\/relaxed{font-size:var(--text-sm);line-height:var(--leading-relaxed)}.text-xs{font-size:var(--text-xs);line-height:var(--tw-leading,var(--text-xs--line-height))}.text-\\[0\\.7em\\]{font-size:.7em}.text-\\[0\\.8rem\\]{font-size:.8rem}.text-\\[0\\.625rem\\]{font-size:.625rem}.leading-none{--tw-leading:1;line-height:1}.leading-relaxed{--tw-leading:var(--leading-relaxed);line-height:var(--leading-relaxed)}.leading-snug{--tw-leading:var(--leading-snug);line-height:var(--leading-snug)}.leading-tight{--tw-leading:var(--leading-tight);line-height:var(--leading-tight)}.font-medium{--tw-font-weight:var(--font-weight-medium);font-weight:var(--font-weight-medium)}.font-semibold{--tw-font-weight:var(--font-weight-semibold);font-weight:var(--font-weight-semibold)}.tracking-tight{--tw-tracking:var(--tracking-tight);letter-spacing:var(--tracking-tight)}.text-balance{text-wrap:balance}.text-pretty{text-wrap:pretty}.text-wrap{text-wrap:wrap}.wrap-anywhere{overflow-wrap:anywhere}.wrap-break-word{overflow-wrap:break-word}.whitespace-nowrap{white-space:nowrap}.whitespace-pre{white-space:pre}.whitespace-pre-wrap{white-space:pre-wrap}.text-card-foreground{color:var(--card-foreground)}.text-destructive{color:var(--destructive)}.text-foreground,.text-foreground\\/60{color:var(--foreground)}@supports (color:color-mix(in lab, red, red)){.text-foreground\\/60{color:color-mix(in oklab, var(--foreground) 60%, transparent)}}.text-muted-foreground{color:var(--muted-foreground)}.text-primary{color:var(--primary)}.text-primary-foreground{color:var(--primary-foreground)}.text-secondary-foreground{color:var(--secondary-foreground)}.italic{font-style:italic}.tabular-nums{--tw-numeric-spacing:tabular-nums;font-variant-numeric:var(--tw-ordinal,) var(--tw-slashed-zero,) var(--tw-numeric-figure,) var(--tw-numeric-spacing,) var(--tw-numeric-fraction,)}.line-through{text-decoration-line:line-through}.underline{text-decoration-line:underline}.underline-offset-2{text-underline-offset:2px}.underline-offset-4{text-underline-offset:4px}.opacity-0{opacity:0}.opacity-60{opacity:.6}.shadow{--tw-shadow:0 1px 3px 0 var(--tw-shadow-color,#0000001a), 0 1px 2px -1px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}.shadow-lg{--tw-shadow:0 10px 15px -3px var(--tw-shadow-color,#0000001a), 0 4px 6px -4px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}.shadow-none{--tw-shadow:0 0 #0000;box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}.ring{--tw-ring-shadow:var(--tw-ring-inset,) 0 0 0 calc(1px + var(--tw-ring-offset-width)) var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}.ring-0{--tw-ring-shadow:var(--tw-ring-inset,) 0 0 0 calc(0px + var(--tw-ring-offset-width)) var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}.ring-1{--tw-ring-shadow:var(--tw-ring-inset,) 0 0 0 calc(1px + var(--tw-ring-offset-width)) var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}.ring-3{--tw-ring-shadow:var(--tw-ring-inset,) 0 0 0 calc(3px + var(--tw-ring-offset-width)) var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}.ring-card{--tw-ring-color:var(--card)}.ring-foreground,.ring-foreground\\/10{--tw-ring-color:var(--foreground)}@supports (color:color-mix(in lab, red, red)){.ring-foreground\\/10{--tw-ring-color:color-mix(in oklab, var(--foreground) 10%, transparent)}}.ring-ring,.ring-ring\\/50{--tw-ring-color:var(--ring)}@supports (color:color-mix(in lab, red, red)){.ring-ring\\/50{--tw-ring-color:color-mix(in oklab, var(--ring) 50%, transparent)}}.outline{outline-style:var(--tw-outline-style);outline-width:1px}.transition-\\[color\\,box-shadow\\,background-color\\]{transition-property:color,box-shadow,background-color;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-\\[translate\\,scale\\,opacity\\]{transition-property:translate,scale,opacity;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-all{transition-property:all;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-colors{transition-property:color,background-color,border-color,outline-color,text-decoration-color,fill,stroke,--tw-gradient-from,--tw-gradient-via,--tw-gradient-to;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-transform{transition-property:transform,translate,scale,rotate;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.duration-200{--tw-duration:.2s;transition-duration:.2s}.ease-in-out{--tw-ease:var(--ease-in-out);transition-timing-function:var(--ease-in-out)}.contain-content{contain:content}.outline-none{--tw-outline-style:none;outline-style:none}.select-none{-webkit-user-select:none;user-select:none}.\\[--card-spacing\\:--spacing\\(4\\)\\]{--card-spacing:calc(var(--spacing) * 4)}.\\[contain-intrinsic-size\\:auto_10rem\\]{contain-intrinsic-size:auto 10rem}.\\[content-visibility\\:auto\\]{content-visibility:auto}.running{animation-play-state:running}.group-has-data-\\[slot\\=message-footer\\]\\/message\\:-translate-y-8:is(:where(.group\\/message):has([data-slot=message-footer]) *){--tw-translate-y:calc(var(--spacing) * -8);translate:var(--tw-translate-x) var(--tw-translate-y)}.group-has-data-\\[slot\\=questionnaire-choice-description\\]\\/questionnaire-choice\\:translate-y-0\\.5:is(:where(.group\\/questionnaire-choice):has([data-slot=questionnaire-choice-description]) *){--tw-translate-y:calc(var(--spacing) * .5);translate:var(--tw-translate-x) var(--tw-translate-y)}.group-has-data-\\[variant\\=ghost\\]\\/message\\:px-0:is(:where(.group\\/message):has([data-variant=ghost]) *){padding-inline:0}.group-has-\\[\\>input\\]\\/input-group\\:pt-2:is(:where(.group\\/input-group):has(>input) *){padding-top:calc(var(--spacing) * 2)}.group-has-\\[\\>input\\]\\/input-group\\:pb-2:is(:where(.group\\/input-group):has(>input) *){padding-bottom:calc(var(--spacing) * 2)}.group-data-\\[align\\=end\\]\\/bubble\\:self-end:is(:where(.group\\/bubble)[data-align=end] *){align-self:flex-end}.group-data-\\[align\\=end\\]\\/message\\:justify-end:is(:where(.group\\/message)[data-align=end] *){justify-content:flex-end}.group-data-\\[align\\=end\\]\\/message\\:self-end:is(:where(.group\\/message)[data-align=end] *){align-self:flex-end}.group-data-\\[disabled\\=true\\]\\/input-group\\:opacity-50:is(:where(.group\\/input-group)[data-disabled=true] *){opacity:.5}.group-data-\\[orientation\\=vertical\\]\\/attachment\\:absolute:is(:where(.group\\/attachment)[data-orientation=vertical] *){position:absolute}.group-data-\\[orientation\\=vertical\\]\\/attachment\\:end-3:is(:where(.group\\/attachment)[data-orientation=vertical] *){inset-inline-end:calc(var(--spacing) * 3)}.group-data-\\[orientation\\=vertical\\]\\/attachment\\:top-3:is(:where(.group\\/attachment)[data-orientation=vertical] *){top:calc(var(--spacing) * 3)}.group-data-\\[orientation\\=vertical\\]\\/attachment\\:w-full:is(:where(.group\\/attachment)[data-orientation=vertical] *){width:100%}.group-data-\\[orientation\\=vertical\\]\\/attachment\\:gap-1:is(:where(.group\\/attachment)[data-orientation=vertical] *){gap:var(--spacing)}.group-data-\\[orientation\\=vertical\\]\\/attachment\\:px-1:is(:where(.group\\/attachment)[data-orientation=vertical] *){padding-inline:var(--spacing)}.group-data-\\[panel-open\\]\\/marker\\:rotate-90:is(:where(.group\\/marker)[data-panel-open] *){rotate:90deg}.group-data-\\[shortcut\\]\\/questionnaire-choice\\:inline-flex:is(:where(.group\\/questionnaire-choice)[data-shortcut] *){display:inline-flex}.group-data-\\[size\\=sm\\]\\/attachment\\:w-8:is(:where(.group\\/attachment)[data-size=sm] *){width:calc(var(--spacing) * 8)}.group-data-\\[size\\=sm\\]\\/card\\:text-sm:is(:where(.group\\/card)[data-size=sm] *){font-size:var(--text-sm);line-height:var(--tw-leading,var(--text-sm--line-height))}.group-data-\\[size\\=xs\\]\\/attachment\\:w-7:is(:where(.group\\/attachment)[data-size=xs] *){width:calc(var(--spacing) * 7)}.group-data-\\[size\\=xs\\]\\/attachment\\:rounded-md:is(:where(.group\\/attachment)[data-size=xs] *){border-radius:calc(var(--radius) * .8)}.group-data-\\[state\\=done\\]\\/attachment\\:opacity-100:is(:where(.group\\/attachment)[data-state=done] *){opacity:1}.group-data-\\[state\\=error\\]\\/attachment\\:bg-destructive\\/10:is(:where(.group\\/attachment)[data-state=error] *){background-color:var(--destructive)}@supports (color:color-mix(in lab, red, red)){.group-data-\\[state\\=error\\]\\/attachment\\:bg-destructive\\/10:is(:where(.group\\/attachment)[data-state=error] *){background-color:color-mix(in oklab, var(--destructive) 10%, transparent)}}.group-data-\\[state\\=error\\]\\/attachment\\:text-destructive:is(:where(.group\\/attachment)[data-state=error] *),.group-data-\\[state\\=error\\]\\/attachment\\:text-destructive\\/80:is(:where(.group\\/attachment)[data-state=error] *){color:var(--destructive)}@supports (color:color-mix(in lab, red, red)){.group-data-\\[state\\=error\\]\\/attachment\\:text-destructive\\/80:is(:where(.group\\/attachment)[data-state=error] *){color:color-mix(in oklab, var(--destructive) 80%, transparent)}}.group-data-\\[state\\=idle\\]\\/attachment\\:opacity-100:is(:where(.group\\/attachment)[data-state=idle] *){opacity:1}.group-data-\\[state\\=processing\\]\\/attachment\\:shimmer:is(:where(.group\\/attachment)[data-state=processing] *){--_spread:var(--shimmer-spread,calc(3ch + 40px));--_base:currentColor;--_highlight:var(--shimmer-color,oklch(from currentColor l c h / calc(alpha* .2)));background-image:var(--shimmer-image,linear-gradient(calc(90deg + var(--shimmer-angle)), var(--_base) calc(50% - var(--_spread)), var(--_highlight) calc(50% - var(--_spread) * .5), var(--_highlight) 50%, var(--_highlight) calc(50% + var(--_spread) * .5), var(--_base) calc(50% + var(--_spread))))}@supports (color:color-mix(in lab, red, red)){.group-data-\\[state\\=processing\\]\\/attachment\\:shimmer:is(:where(.group\\/attachment)[data-state=processing] *){background-image:var(--shimmer-image,linear-gradient(calc(90deg + var(--shimmer-angle)), var(--_base) calc(50% - var(--_spread)), color-mix(in oklch, var(--_highlight), var(--_base) 50%) calc(50% - var(--_spread) * .5), var(--_highlight) 50%, color-mix(in oklch, var(--_highlight), var(--_base) 50%) calc(50% + var(--_spread) * .5), var(--_base) calc(50% + var(--_spread))))}}.group-data-\\[state\\=processing\\]\\/attachment\\:shimmer:is(:where(.group\\/attachment)[data-state=processing] *){background-repeat:no-repeat;background-size:calc(200% + var(--_spread) * 2) 100%;-webkit-text-fill-color:var(--shimmer-text-fill,transparent);animation:tw-shimmer var(--shimmer-duration,2s) linear infinite;background-position:0 0;-webkit-background-clip:text;background-clip:text}.group-data-\\[state\\=processing\\]\\/attachment\\:shimmer:is(:where(.group\\/attachment)[data-state=processing] *):is(.dark *){--_highlight:var(--shimmer-color,oklch(from currentColor max(.8, calc(l + .4)) c h / calc(alpha + .4)))}.group-data-\\[state\\=processing\\]\\/attachment\\:shimmer:is(:where(.group\\/attachment)[data-state=processing] *):where([dir=rtl],[dir=rtl] *){animation-direction:reverse}.group-data-\\[state\\=uploading\\]\\/attachment\\:shimmer:is(:where(.group\\/attachment)[data-state=uploading] *){--_spread:var(--shimmer-spread,calc(3ch + 40px));--_base:currentColor;--_highlight:var(--shimmer-color,oklch(from currentColor l c h / calc(alpha* .2)));background-image:var(--shimmer-image,linear-gradient(calc(90deg + var(--shimmer-angle)), var(--_base) calc(50% - var(--_spread)), var(--_highlight) calc(50% - var(--_spread) * .5), var(--_highlight) 50%, var(--_highlight) calc(50% + var(--_spread) * .5), var(--_base) calc(50% + var(--_spread))))}@supports (color:color-mix(in lab, red, red)){.group-data-\\[state\\=uploading\\]\\/attachment\\:shimmer:is(:where(.group\\/attachment)[data-state=uploading] *){background-image:var(--shimmer-image,linear-gradient(calc(90deg + var(--shimmer-angle)), var(--_base) calc(50% - var(--_spread)), color-mix(in oklch, var(--_highlight), var(--_base) 50%) calc(50% - var(--_spread) * .5), var(--_highlight) 50%, color-mix(in oklch, var(--_highlight), var(--_base) 50%) calc(50% + var(--_spread) * .5), var(--_base) calc(50% + var(--_spread))))}}.group-data-\\[state\\=uploading\\]\\/attachment\\:shimmer:is(:where(.group\\/attachment)[data-state=uploading] *){background-repeat:no-repeat;background-size:calc(200% + var(--_spread) * 2) 100%;-webkit-text-fill-color:var(--shimmer-text-fill,transparent);animation:tw-shimmer var(--shimmer-duration,2s) linear infinite;background-position:0 0;-webkit-background-clip:text;background-clip:text}.group-data-\\[state\\=uploading\\]\\/attachment\\:shimmer:is(:where(.group\\/attachment)[data-state=uploading] *):is(.dark *){--_highlight:var(--shimmer-color,oklch(from currentColor max(.8, calc(l + .4)) c h / calc(alpha + .4)))}.group-data-\\[state\\=uploading\\]\\/attachment\\:shimmer:is(:where(.group\\/attachment)[data-state=uploading] *):where([dir=rtl],[dir=rtl] *){animation-direction:reverse}.group-data-\\[type\\=checkbox\\]\\/questionnaire-choice\\:hidden:is(:where(.group\\/questionnaire-choice)[data-type=checkbox] *),.group-data-\\[type\\=radio\\]\\/questionnaire-choice\\:hidden:is(:where(.group\\/questionnaire-choice)[data-type=radio] *){display:none}.group-data-\\[type\\=radio\\]\\/questionnaire-choice\\:rounded-full:is(:where(.group\\/questionnaire-choice)[data-type=radio] *){border-radius:3.40282e38px}.group-data-\\[variant\\=line\\]\\/tabs-list\\:bg-transparent:is(:where(.group\\/tabs-list)[data-variant=line] *){background-color:#0000}.group-data-\\[variant\\=separator\\]\\/marker\\:flex-none:is(:where(.group\\/marker)[data-variant=separator] *){flex:none}.group-data-\\[variant\\=separator\\]\\/marker\\:text-center:is(:where(.group\\/marker)[data-variant=separator] *){text-align:center}.group-data-checked\\/questionnaire-choice\\:block:is(:is(:where(.group\\/questionnaire-choice):where([data-state=checked]),:where(.group\\/questionnaire-choice):where([data-checked]:not([data-checked=false]))) *){display:block}.group-data-checked\\/questionnaire-choice\\:border-primary:is(:is(:where(.group\\/questionnaire-choice):where([data-state=checked]),:where(.group\\/questionnaire-choice):where([data-checked]:not([data-checked=false]))) *){border-color:var(--primary)}.group-data-checked\\/questionnaire-choice\\:bg-primary:is(:is(:where(.group\\/questionnaire-choice):where([data-state=checked]),:where(.group\\/questionnaire-choice):where([data-checked]:not([data-checked=false]))) *){background-color:var(--primary)}.group-data-checked\\/questionnaire-choice\\:text-primary-foreground:is(:is(:where(.group\\/questionnaire-choice):where([data-state=checked]),:where(.group\\/questionnaire-choice):where([data-checked]:not([data-checked=false]))) *){color:var(--primary-foreground)}.group-data-horizontal\\/tabs\\:h-8:is(:where(.group\\/tabs):where([data-orientation=horizontal]) *){height:calc(var(--spacing) * 8)}.group-data-vertical\\/tabs\\:h-fit:is(:where(.group\\/tabs):where([data-orientation=vertical]) *){height:fit-content}.group-data-vertical\\/tabs\\:w-full:is(:where(.group\\/tabs):where([data-orientation=vertical]) *){width:100%}.group-data-vertical\\/tabs\\:flex-col:is(:where(.group\\/tabs):where([data-orientation=vertical]) *){flex-direction:column}.group-data-vertical\\/tabs\\:justify-start:is(:where(.group\\/tabs):where([data-orientation=vertical]) *){justify-content:flex-start}.marker\\:text-muted-foreground ::marker{color:var(--muted-foreground)}.marker\\:text-muted-foreground::marker{color:var(--muted-foreground)}.marker\\:text-muted-foreground ::-webkit-details-marker{color:var(--muted-foreground)}.marker\\:text-muted-foreground::-webkit-details-marker{color:var(--muted-foreground)}.selection\\:bg-primary ::selection{background-color:var(--primary)}.selection\\:bg-primary::selection{background-color:var(--primary)}.selection\\:text-primary-foreground ::selection{color:var(--primary-foreground)}.selection\\:text-primary-foreground::selection{color:var(--primary-foreground)}.file\\:inline-flex::file-selector-button{display:inline-flex}.file\\:h-6::file-selector-button{height:calc(var(--spacing) * 6)}.file\\:border-0::file-selector-button{border-style:var(--tw-border-style);border-width:0}.file\\:bg-transparent::file-selector-button{background-color:#0000}.file\\:text-sm::file-selector-button{font-size:var(--text-sm);line-height:var(--tw-leading,var(--text-sm--line-height))}.file\\:font-medium::file-selector-button{--tw-font-weight:var(--font-weight-medium);font-weight:var(--font-weight-medium)}.file\\:text-foreground::file-selector-button{color:var(--foreground)}.placeholder\\:text-muted-foreground::placeholder{color:var(--muted-foreground)}.before\\:me-1:before{content:var(--tw-content);margin-inline-end:var(--spacing)}.before\\:h-px:before{content:var(--tw-content);height:1px}.before\\:min-w-0:before{content:var(--tw-content);min-width:0}.before\\:flex-1:before{content:var(--tw-content);flex:1}.before\\:bg-border:before{content:var(--tw-content);background-color:var(--border)}.after\\:absolute:after{content:var(--tw-content);position:absolute}.after\\:ms-1:after{content:var(--tw-content);margin-inline-start:var(--spacing)}.after\\:h-px:after{content:var(--tw-content);height:1px}.after\\:min-w-0:after{content:var(--tw-content);min-width:0}.after\\:flex-1:after{content:var(--tw-content);flex:1}.after\\:bg-border:after{content:var(--tw-content);background-color:var(--border)}.after\\:bg-foreground:after{content:var(--tw-content);background-color:var(--foreground)}.after\\:opacity-0:after{content:var(--tw-content);opacity:0}.after\\:transition-opacity:after{content:var(--tw-content);transition-property:opacity;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.group-data-horizontal\\/tabs\\:after\\:inset-x-0:is(:where(.group\\/tabs):where([data-orientation=horizontal]) *):after{content:var(--tw-content);inset-inline:0}.group-data-horizontal\\/tabs\\:after\\:bottom-\\[-5px\\]:is(:where(.group\\/tabs):where([data-orientation=horizontal]) *):after{content:var(--tw-content);bottom:-5px}.group-data-horizontal\\/tabs\\:after\\:h-0\\.5:is(:where(.group\\/tabs):where([data-orientation=horizontal]) *):after{content:var(--tw-content);height:calc(var(--spacing) * .5)}.group-data-vertical\\/tabs\\:after\\:inset-y-0:is(:where(.group\\/tabs):where([data-orientation=vertical]) *):after{content:var(--tw-content);inset-block:0}.group-data-vertical\\/tabs\\:after\\:-end-1:is(:where(.group\\/tabs):where([data-orientation=vertical]) *):after{content:var(--tw-content);inset-inline-end:calc(var(--spacing) * -1)}.group-data-vertical\\/tabs\\:after\\:w-0\\.5:is(:where(.group\\/tabs):where([data-orientation=vertical]) *):after{content:var(--tw-content);width:calc(var(--spacing) * .5)}.first\\:mt-0:first-child{margin-top:0}.last\\:mb-0:last-child{margin-bottom:0}.focus-within\\:ring-1:focus-within{--tw-ring-shadow:var(--tw-ring-inset,) 0 0 0 calc(1px + var(--tw-ring-offset-width)) var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}.focus-within\\:ring-ring\\/50:focus-within{--tw-ring-color:var(--ring)}@supports (color:color-mix(in lab, red, red)){.focus-within\\:ring-ring\\/50:focus-within{--tw-ring-color:color-mix(in oklab, var(--ring) 50%, transparent)}}@media (hover:hover){.hover\\:bg-\\[color-mix\\(in_oklch\\,var\\(--secondary\\)\\,var\\(--foreground\\)_5\\%\\)\\]:hover{background-color:var(--secondary)}@supports (color:color-mix(in lab, red, red)){.hover\\:bg-\\[color-mix\\(in_oklch\\,var\\(--secondary\\)\\,var\\(--foreground\\)_5\\%\\)\\]:hover{background-color:color-mix(in oklch,var(--secondary),var(--foreground) 5%)}}.hover\\:bg-destructive\\/20:hover{background-color:var(--destructive)}@supports (color:color-mix(in lab, red, red)){.hover\\:bg-destructive\\/20:hover{background-color:color-mix(in oklab, var(--destructive) 20%, transparent)}}.hover\\:bg-muted:hover,.hover\\:bg-muted\\/50:hover{background-color:var(--muted)}@supports (color:color-mix(in lab, red, red)){.hover\\:bg-muted\\/50:hover{background-color:color-mix(in oklab, var(--muted) 50%, transparent)}}.hover\\:bg-primary\\/80:hover{background-color:var(--primary)}@supports (color:color-mix(in lab, red, red)){.hover\\:bg-primary\\/80:hover{background-color:color-mix(in oklab, var(--primary) 80%, transparent)}}.hover\\:text-foreground:hover{color:var(--foreground)}.hover\\:underline:hover{text-decoration-line:underline}}.focus-visible\\:border-destructive\\/40:focus-visible{border-color:var(--destructive)}@supports (color:color-mix(in lab, red, red)){.focus-visible\\:border-destructive\\/40:focus-visible{border-color:color-mix(in oklab, var(--destructive) 40%, transparent)}}.focus-visible\\:border-ring:focus-visible{border-color:var(--ring)}.focus-visible\\:ring-0:focus-visible{--tw-ring-shadow:var(--tw-ring-inset,) 0 0 0 calc(0px + var(--tw-ring-offset-width)) var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}.focus-visible\\:ring-3:focus-visible,.focus-visible\\:ring-\\[3px\\]:focus-visible{--tw-ring-shadow:var(--tw-ring-inset,) 0 0 0 calc(3px + var(--tw-ring-offset-width)) var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}.focus-visible\\:ring-destructive\\/20:focus-visible{--tw-ring-color:var(--destructive)}@supports (color:color-mix(in lab, red, red)){.focus-visible\\:ring-destructive\\/20:focus-visible{--tw-ring-color:color-mix(in oklab, var(--destructive) 20%, transparent)}}.focus-visible\\:ring-ring\\/50:focus-visible{--tw-ring-color:var(--ring)}@supports (color:color-mix(in lab, red, red)){.focus-visible\\:ring-ring\\/50:focus-visible{--tw-ring-color:color-mix(in oklab, var(--ring) 50%, transparent)}}.focus-visible\\:outline-1:focus-visible{outline-style:var(--tw-outline-style);outline-width:1px}.focus-visible\\:outline-ring:focus-visible{outline-color:var(--ring)}.active\\:not-aria-\\[haspopup\\]\\:translate-y-px:active:not([aria-haspopup]){--tw-translate-y:1px;translate:var(--tw-translate-x) var(--tw-translate-y)}.disabled\\:pointer-events-none:disabled{pointer-events:none}.disabled\\:cursor-not-allowed:disabled{cursor:not-allowed}.disabled\\:bg-input\\/50:disabled{background-color:var(--input)}@supports (color:color-mix(in lab, red, red)){.disabled\\:bg-input\\/50:disabled{background-color:color-mix(in oklab, var(--input) 50%, transparent)}}.disabled\\:bg-transparent:disabled{background-color:#0000}.disabled\\:opacity-50:disabled{opacity:.5}:where([data-slot=button-group]) .in-data-\\[slot\\=button-group\\]\\:rounded-lg{border-radius:var(--radius)}:where([data-slot=combobox-content]) .in-data-\\[slot\\=combobox-content\\]\\:focus-within\\:border-inherit:focus-within{border-color:inherit}:where([data-slot=combobox-content]) .in-data-\\[slot\\=combobox-content\\]\\:focus-within\\:ring-0:focus-within{--tw-ring-shadow:var(--tw-ring-inset,) 0 0 0 calc(0px + var(--tw-ring-offset-width)) var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}.has-disabled\\:bg-input\\/50:has(:disabled){background-color:var(--input)}@supports (color:color-mix(in lab, red, red)){.has-disabled\\:bg-input\\/50:has(:disabled){background-color:color-mix(in oklab, var(--input) 50%, transparent)}}.has-disabled\\:opacity-50:has(:disabled){opacity:.5}.has-data-\\[icon\\=inline-end\\]\\:pe-1:has([data-icon=inline-end]){padding-inline-end:var(--spacing)}.has-data-\\[icon\\=inline-end\\]\\:pe-1\\.5:has([data-icon=inline-end]){padding-inline-end:calc(var(--spacing) * 1.5)}.has-data-\\[icon\\=inline-end\\]\\:pe-2:has([data-icon=inline-end]){padding-inline-end:calc(var(--spacing) * 2)}.has-data-\\[icon\\=inline-start\\]\\:ps-1:has([data-icon=inline-start]){padding-inline-start:var(--spacing)}.has-data-\\[icon\\=inline-start\\]\\:ps-1\\.5:has([data-icon=inline-start]){padding-inline-start:calc(var(--spacing) * 1.5)}.has-data-\\[icon\\=inline-start\\]\\:ps-2:has([data-icon=inline-start]){padding-inline-start:calc(var(--spacing) * 2)}.has-data-\\[slot\\=attachment-content\\]\\:w-30:has([data-slot=attachment-content]){width:calc(var(--spacing) * 30)}.has-data-\\[slot\\=attachment-content\\]\\:px-1\\.5:has([data-slot=attachment-content]){padding-inline:calc(var(--spacing) * 1.5)}.has-data-\\[slot\\=attachment-content\\]\\:px-2:has([data-slot=attachment-content]){padding-inline:calc(var(--spacing) * 2)}.has-data-\\[slot\\=attachment-content\\]\\:px-2\\.5:has([data-slot=attachment-content]){padding-inline:calc(var(--spacing) * 2.5)}.has-data-\\[slot\\=attachment-content\\]\\:py-1:has([data-slot=attachment-content]){padding-block:var(--spacing)}.has-data-\\[slot\\=attachment-content\\]\\:py-1\\.5:has([data-slot=attachment-content]){padding-block:calc(var(--spacing) * 1.5)}.has-data-\\[slot\\=attachment-content\\]\\:py-2:has([data-slot=attachment-content]){padding-block:calc(var(--spacing) * 2)}.has-data-\\[slot\\=attachment-media\\]\\:p-1:has([data-slot=attachment-media]){padding:var(--spacing)}.has-data-\\[slot\\=attachment-media\\]\\:p-1\\.5:has([data-slot=attachment-media]){padding:calc(var(--spacing) * 1.5)}.has-data-\\[slot\\=attachment-media\\]\\:p-2:has([data-slot=attachment-media]){padding:calc(var(--spacing) * 2)}.has-data-\\[slot\\=card-action\\]\\:grid-cols-\\[1fr_auto\\]:has([data-slot=card-action]){grid-template-columns:1fr auto}.has-data-\\[slot\\=card-description\\]\\:grid-rows-\\[auto_auto\\]:has([data-slot=card-description]){grid-template-rows:auto auto}.has-data-\\[slot\\=card-footer\\]\\:pb-0:has([data-slot=card-footer]){padding-bottom:0}.has-\\[\\[data-slot\\=input-group-control\\]\\:focus-visible\\]\\:border-ring:has([data-slot=input-group-control]:focus-visible){border-color:var(--ring)}.has-\\[\\[data-slot\\=input-group-control\\]\\:focus-visible\\]\\:ring-3:has([data-slot=input-group-control]:focus-visible){--tw-ring-shadow:var(--tw-ring-inset,) 0 0 0 calc(3px + var(--tw-ring-offset-width)) var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}.has-\\[\\[data-slot\\=input-group-control\\]\\:focus-visible\\]\\:ring-ring\\/50:has([data-slot=input-group-control]:focus-visible){--tw-ring-color:var(--ring)}@supports (color:color-mix(in lab, red, red)){.has-\\[\\[data-slot\\=input-group-control\\]\\:focus-visible\\]\\:ring-ring\\/50:has([data-slot=input-group-control]:focus-visible){--tw-ring-color:color-mix(in oklab, var(--ring) 50%, transparent)}}.has-\\[\\[data-slot\\]\\[aria-invalid\\=true\\]\\]\\:border-destructive:has([data-slot][aria-invalid=true]){border-color:var(--destructive)}.has-\\[\\[data-slot\\]\\[aria-invalid\\=true\\]\\]\\:ring-3:has([data-slot][aria-invalid=true]){--tw-ring-shadow:var(--tw-ring-inset,) 0 0 0 calc(3px + var(--tw-ring-offset-width)) var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}.has-\\[\\[data-slot\\]\\[aria-invalid\\=true\\]\\]\\:ring-destructive\\/20:has([data-slot][aria-invalid=true]){--tw-ring-color:var(--destructive)}@supports (color:color-mix(in lab, red, red)){.has-\\[\\[data-slot\\]\\[aria-invalid\\=true\\]\\]\\:ring-destructive\\/20:has([data-slot][aria-invalid=true]){--tw-ring-color:color-mix(in oklab, var(--destructive) 20%, transparent)}}.has-\\[button\\]\\:p-0:has(:is(button)){padding:0}.has-\\[\\>\\[data-align\\=block-end\\]\\]\\:h-auto:has(>[data-align=block-end]){height:auto}.has-\\[\\>\\[data-align\\=block-end\\]\\]\\:flex-col:has(>[data-align=block-end]){flex-direction:column}.has-\\[\\>\\[data-align\\=block-start\\]\\]\\:h-auto:has(>[data-align=block-start]){height:auto}.has-\\[\\>\\[data-align\\=block-start\\]\\]\\:flex-col:has(>[data-align=block-start]){flex-direction:column}@media (hover:hover){.has-\\[\\>a\\,\\>button\\]\\:hover\\:bg-muted\\/50:has(>a,>button):hover{background-color:var(--muted)}@supports (color:color-mix(in lab, red, red)){.has-\\[\\>a\\,\\>button\\]\\:hover\\:bg-muted\\/50:has(>a,>button):hover{background-color:color-mix(in oklab, var(--muted) 50%, transparent)}}}.has-\\[\\>button\\]\\:ms-\\[-0\\.3rem\\]:has(>button){margin-inline-start:-.3rem}.has-\\[\\>button\\]\\:me-\\[-0\\.3rem\\]:has(>button){margin-inline-end:-.3rem}.has-\\[\\>img\\:first-child\\]\\:pt-0:has(>img:first-child){padding-top:0}.has-\\[\\>input\\:focus-visible\\]\\:border-ring:has(>input:focus-visible){border-color:var(--ring)}.has-\\[\\>input\\:focus-visible\\]\\:ring-3:has(>input:focus-visible){--tw-ring-shadow:var(--tw-ring-inset,) 0 0 0 calc(3px + var(--tw-ring-offset-width)) var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}.has-\\[\\>input\\:focus-visible\\]\\:ring-ring\\/50:has(>input:focus-visible){--tw-ring-color:var(--ring)}@supports (color:color-mix(in lab, red, red)){.has-\\[\\>input\\:focus-visible\\]\\:ring-ring\\/50:has(>input:focus-visible){--tw-ring-color:color-mix(in oklab, var(--ring) 50%, transparent)}}.has-\\[\\>kbd\\]\\:ms-\\[-0\\.15rem\\]:has(>kbd){margin-inline-start:-.15rem}.has-\\[\\>kbd\\]\\:me-\\[-0\\.15rem\\]:has(>kbd){margin-inline-end:-.15rem}.has-\\[\\>svg\\]\\:p-0:has(>svg){padding:0}.has-\\[\\>textarea\\]\\:h-auto:has(>textarea){height:auto}.aria-disabled\\:pointer-events-none[aria-disabled=true]{pointer-events:none}.aria-disabled\\:opacity-50[aria-disabled=true]{opacity:.5}.aria-expanded\\:bg-muted[aria-expanded=true]{background-color:var(--muted)}.aria-expanded\\:bg-secondary[aria-expanded=true]{background-color:var(--secondary)}.aria-expanded\\:text-foreground[aria-expanded=true]{color:var(--foreground)}.aria-expanded\\:text-secondary-foreground[aria-expanded=true]{color:var(--secondary-foreground)}.aria-invalid\\:border-destructive[aria-invalid=true]{border-color:var(--destructive)}.aria-invalid\\:ring-0[aria-invalid=true]{--tw-ring-shadow:var(--tw-ring-inset,) 0 0 0 calc(0px + var(--tw-ring-offset-width)) var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}.aria-invalid\\:ring-3[aria-invalid=true]{--tw-ring-shadow:var(--tw-ring-inset,) 0 0 0 calc(3px + var(--tw-ring-offset-width)) var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}.aria-invalid\\:ring-destructive\\/20[aria-invalid=true]{--tw-ring-color:var(--destructive)}@supports (color:color-mix(in lab, red, red)){.aria-invalid\\:ring-destructive\\/20[aria-invalid=true]{--tw-ring-color:color-mix(in oklab, var(--destructive) 20%, transparent)}}.data-autoscrolling\\:scrollbar-thumb-transparent[data-autoscrolling]{--tw-scrollbar-thumb:transparent;scrollbar-color:var(--tw-scrollbar-thumb) var(--tw-scrollbar-track)}.data-autoscrolling\\:scrollbar-track-transparent[data-autoscrolling]{--tw-scrollbar-track:transparent;scrollbar-color:var(--tw-scrollbar-thumb) var(--tw-scrollbar-track)}.data-invalid\\:border-destructive[data-invalid]{border-color:var(--destructive)}:is(.group-data-\\[align\\=end\\]\\/message\\:\\*\\:data-slot\\:self-end:is(:where(.group\\/message)[data-align=end] *)>*)[data-slot]{align-self:flex-end}.data-\\[active\\=false\\]\\:pointer-events-none[data-active=false]{pointer-events:none}.data-\\[active\\=false\\]\\:scale-95[data-active=false]{--tw-scale-x:95%;--tw-scale-y:95%;--tw-scale-z:95%;scale:var(--tw-scale-x) var(--tw-scale-y)}.data-\\[active\\=false\\]\\:opacity-0[data-active=false]{opacity:0}.data-\\[active\\=false\\]\\:duration-400[data-active=false]{--tw-duration:.4s;transition-duration:.4s}.data-\\[active\\=false\\]\\:ease-\\[cubic-bezier\\(0\\.7\\,0\\,0\\.84\\,0\\)\\][data-active=false]{--tw-ease:cubic-bezier(.7,0,.84,0);transition-timing-function:cubic-bezier(.7,0,.84,0)}.data-\\[active\\=true\\]\\:translate-y-0[data-active=true]{--tw-translate-y:0px;translate:var(--tw-translate-x) var(--tw-translate-y)}.data-\\[active\\=true\\]\\:scale-100[data-active=true]{--tw-scale-x:100%;--tw-scale-y:100%;--tw-scale-z:100%;scale:var(--tw-scale-x) var(--tw-scale-y)}.data-\\[active\\=true\\]\\:opacity-100[data-active=true]{opacity:1}.data-\\[active\\=true\\]\\:ease-\\[cubic-bezier\\(0\\.23\\,1\\,0\\.32\\,1\\)\\][data-active=true]{--tw-ease:cubic-bezier(.23,1,.32,1);transition-timing-function:cubic-bezier(.23,1,.32,1)}.data-\\[align\\=end\\]\\:flex-row-reverse[data-align=end]{flex-direction:row-reverse}.data-\\[align\\=end\\]\\:self-end[data-align=end]{align-self:flex-end}.data-\\[direction\\=end\\]\\:bottom-4[data-direction=end]{bottom:calc(var(--spacing) * 4)}.data-\\[direction\\=end\\]\\:data-\\[active\\=false\\]\\:translate-y-full[data-direction=end][data-active=false]{--tw-translate-y:100%;translate:var(--tw-translate-x) var(--tw-translate-y)}.data-\\[direction\\=start\\]\\:top-4[data-direction=start]{top:calc(var(--spacing) * 4)}.data-\\[direction\\=start\\]\\:data-\\[active\\=false\\]\\:-translate-y-full[data-direction=start][data-active=false]{--tw-translate-y:-100%;translate:var(--tw-translate-x) var(--tw-translate-y)}.data-\\[size\\=sm\\]\\:\\[--card-spacing\\:--spacing\\(3\\)\\][data-size=sm]{--card-spacing:calc(var(--spacing) * 3)}.data-\\[size\\=sm\\]\\:has-data-\\[slot\\=card-footer\\]\\:pb-0[data-size=sm]:has([data-slot=card-footer]){padding-bottom:0}:is(.\\*\\:data-\\[slot\\=attachment\\]\\:flex-none>*)[data-slot=attachment]{flex:none}:is(.\\*\\:data-\\[slot\\=attachment\\]\\:snap-start>*)[data-slot=attachment]{scroll-snap-align:start}:is(.\\*\\:data-\\[slot\\=bubble-content\\]\\:rounded-none>*)[data-slot=bubble-content]{border-radius:0}:is(.\\*\\:data-\\[slot\\=bubble-content\\]\\:border-border>*)[data-slot=bubble-content]{border-color:var(--border)}:is(.\\*\\:data-\\[slot\\=bubble-content\\]\\:bg-\\[oklch\\(from_var\\(--primary\\)_0\\.93_calc\\(c\\*0\\.4\\)_h\\)\\]>*)[data-slot=bubble-content]{background-color:oklch(from var(--primary) .93 calc(c * .4) h)}:is(.\\*\\:data-\\[slot\\=bubble-content\\]\\:bg-background>*)[data-slot=bubble-content]{background-color:var(--background)}:is(.\\*\\:data-\\[slot\\=bubble-content\\]\\:bg-destructive\\/10>*)[data-slot=bubble-content]{background-color:var(--destructive)}@supports (color:color-mix(in lab, red, red)){:is(.\\*\\:data-\\[slot\\=bubble-content\\]\\:bg-destructive\\/10>*)[data-slot=bubble-content]{background-color:color-mix(in oklab, var(--destructive) 10%, transparent)}}:is(.\\*\\:data-\\[slot\\=bubble-content\\]\\:bg-muted>*)[data-slot=bubble-content]{background-color:var(--muted)}:is(.\\*\\:data-\\[slot\\=bubble-content\\]\\:bg-primary>*)[data-slot=bubble-content]{background-color:var(--primary)}:is(.\\*\\:data-\\[slot\\=bubble-content\\]\\:bg-secondary>*)[data-slot=bubble-content]{background-color:var(--secondary)}:is(.\\*\\:data-\\[slot\\=bubble-content\\]\\:bg-transparent>*)[data-slot=bubble-content]{background-color:#0000}:is(.\\*\\:data-\\[slot\\=bubble-content\\]\\:p-0>*)[data-slot=bubble-content]{padding:0}:is(.\\*\\:data-\\[slot\\=bubble-content\\]\\:text-destructive>*)[data-slot=bubble-content]{color:var(--destructive)}:is(.\\*\\:data-\\[slot\\=bubble-content\\]\\:text-foreground>*)[data-slot=bubble-content]{color:var(--foreground)}:is(.\\*\\:data-\\[slot\\=bubble-content\\]\\:text-primary-foreground>*)[data-slot=bubble-content]{color:var(--primary-foreground)}:is(.\\*\\:data-\\[slot\\=bubble-content\\]\\:text-secondary-foreground>*)[data-slot=bubble-content]{color:var(--secondary-foreground)}:is(.group-data-\\[orientation\\=vertical\\]\\/attachment\\:\\*\\:data-\\[slot\\=spinner\\]\\:size-6\\!:is(:where(.group\\/attachment)[data-orientation=vertical] *)>*)[data-slot=spinner]{width:calc(var(--spacing) * 6)!important;height:calc(var(--spacing) * 6)!important}.data-\\[state\\=error\\]\\:border-destructive\\/30[data-state=error]{border-color:var(--destructive)}@supports (color:color-mix(in lab, red, red)){.data-\\[state\\=error\\]\\:border-destructive\\/30[data-state=error]{border-color:color-mix(in oklab, var(--destructive) 30%, transparent)}}.data-\\[state\\=idle\\]\\:border-dashed[data-state=idle]{--tw-border-style:dashed;border-style:dashed}.data-\\[variant\\=ghost\\]\\:max-w-full[data-variant=ghost]{max-width:100%}.data-\\[variant\\=line\\]\\:rounded-none[data-variant=line]{border-radius:0}@media (min-width:40rem){.sm\\:min-h-0{min-height:0}.sm\\:min-h-8{min-height:calc(var(--spacing) * 8)}}@media (min-width:48rem){.md\\:text-sm{font-size:var(--text-sm);line-height:var(--tw-leading,var(--text-sm--line-height))}}.rtl\\:translate-x-1\\/2:where(:dir(rtl),[dir=rtl],[dir=rtl] *){--tw-translate-x:calc(1 / 2 * 100%);translate:var(--tw-translate-x) var(--tw-translate-y)}.dark\\:border-input:is(.dark *){border-color:var(--input)}.dark\\:bg-destructive\\/20:is(.dark *){background-color:var(--destructive)}@supports (color:color-mix(in lab, red, red)){.dark\\:bg-destructive\\/20:is(.dark *){background-color:color-mix(in oklab, var(--destructive) 20%, transparent)}}.dark\\:bg-input\\/20:is(.dark *){background-color:var(--input)}@supports (color:color-mix(in lab, red, red)){.dark\\:bg-input\\/20:is(.dark *){background-color:color-mix(in oklab, var(--input) 20%, transparent)}}.dark\\:bg-input\\/30:is(.dark *){background-color:var(--input)}@supports (color:color-mix(in lab, red, red)){.dark\\:bg-input\\/30:is(.dark *){background-color:color-mix(in oklab, var(--input) 30%, transparent)}}.dark\\:bg-transparent:is(.dark *){background-color:#0000}.dark\\:text-muted-foreground:is(.dark *){color:var(--muted-foreground)}.dark\\:group-data-checked\\/questionnaire-choice\\:bg-primary:is(.dark *):is(:is(:where(.group\\/questionnaire-choice):where([data-state=checked]),:where(.group\\/questionnaire-choice):where([data-checked]:not([data-checked=false]))) *){background-color:var(--primary)}@media (hover:hover){.dark\\:hover\\:bg-destructive\\/30:is(.dark *):hover{background-color:var(--destructive)}@supports (color:color-mix(in lab, red, red)){.dark\\:hover\\:bg-destructive\\/30:is(.dark *):hover{background-color:color-mix(in oklab, var(--destructive) 30%, transparent)}}.dark\\:hover\\:bg-input\\/50:is(.dark *):hover{background-color:var(--input)}@supports (color:color-mix(in lab, red, red)){.dark\\:hover\\:bg-input\\/50:is(.dark *):hover{background-color:color-mix(in oklab, var(--input) 50%, transparent)}}.dark\\:hover\\:bg-muted\\/50:is(.dark *):hover{background-color:var(--muted)}@supports (color:color-mix(in lab, red, red)){.dark\\:hover\\:bg-muted\\/50:is(.dark *):hover{background-color:color-mix(in oklab, var(--muted) 50%, transparent)}}.dark\\:hover\\:text-foreground:is(.dark *):hover{color:var(--foreground)}}.dark\\:focus-visible\\:ring-destructive\\/40:is(.dark *):focus-visible{--tw-ring-color:var(--destructive)}@supports (color:color-mix(in lab, red, red)){.dark\\:focus-visible\\:ring-destructive\\/40:is(.dark *):focus-visible{--tw-ring-color:color-mix(in oklab, var(--destructive) 40%, transparent)}}.dark\\:disabled\\:bg-input\\/80:is(.dark *):disabled{background-color:var(--input)}@supports (color:color-mix(in lab, red, red)){.dark\\:disabled\\:bg-input\\/80:is(.dark *):disabled{background-color:color-mix(in oklab, var(--input) 80%, transparent)}}.dark\\:disabled\\:bg-transparent:is(.dark *):disabled{background-color:#0000}.dark\\:has-disabled\\:bg-input\\/80:is(.dark *):has(:disabled){background-color:var(--input)}@supports (color:color-mix(in lab, red, red)){.dark\\:has-disabled\\:bg-input\\/80:is(.dark *):has(:disabled){background-color:color-mix(in oklab, var(--input) 80%, transparent)}}.dark\\:has-\\[\\[data-slot\\]\\[aria-invalid\\=true\\]\\]\\:ring-destructive\\/40:is(.dark *):has([data-slot][aria-invalid=true]){--tw-ring-color:var(--destructive)}@supports (color:color-mix(in lab, red, red)){.dark\\:has-\\[\\[data-slot\\]\\[aria-invalid\\=true\\]\\]\\:ring-destructive\\/40:is(.dark *):has([data-slot][aria-invalid=true]){--tw-ring-color:color-mix(in oklab, var(--destructive) 40%, transparent)}}.dark\\:aria-invalid\\:border-destructive\\/50:is(.dark *)[aria-invalid=true]{border-color:var(--destructive)}@supports (color:color-mix(in lab, red, red)){.dark\\:aria-invalid\\:border-destructive\\/50:is(.dark *)[aria-invalid=true]{border-color:color-mix(in oklab, var(--destructive) 50%, transparent)}}.dark\\:aria-invalid\\:ring-destructive\\/40:is(.dark *)[aria-invalid=true]{--tw-ring-color:var(--destructive)}@supports (color:color-mix(in lab, red, red)){.dark\\:aria-invalid\\:ring-destructive\\/40:is(.dark *)[aria-invalid=true]{--tw-ring-color:color-mix(in oklab, var(--destructive) 40%, transparent)}}:is(.dark\\:\\*\\:data-\\[slot\\=bubble-content\\]\\:bg-\\[oklch\\(from_var\\(--primary\\)_0\\.3_calc\\(c\\*0\\.4\\)_h\\)\\]:is(.dark *)>*)[data-slot=bubble-content]{background-color:oklch(from var(--primary) .3 calc(c * .4) h)}:is(.dark\\:\\*\\:data-\\[slot\\=bubble-content\\]\\:bg-destructive\\/20:is(.dark *)>*)[data-slot=bubble-content]{background-color:var(--destructive)}@supports (color:color-mix(in lab, red, red)){:is(.dark\\:\\*\\:data-\\[slot\\=bubble-content\\]\\:bg-destructive\\/20:is(.dark *)>*)[data-slot=bubble-content]{background-color:color-mix(in oklab, var(--destructive) 20%, transparent)}}.data-checked\\:border-primary\\/40:where([data-state=checked]),.data-checked\\:border-primary\\/40:where([data-checked]:not([data-checked=false])){border-color:var(--primary)}@supports (color:color-mix(in lab, red, red)){.data-checked\\:border-primary\\/40:where([data-state=checked]),.data-checked\\:border-primary\\/40:where([data-checked]:not([data-checked=false])){border-color:color-mix(in oklab, var(--primary) 40%, transparent)}}.data-checked\\:bg-muted:where([data-state=checked]),.data-checked\\:bg-muted:where([data-checked]:not([data-checked=false])),.dark\\:data-checked\\:bg-muted:is(.dark *):where([data-state=checked]),.dark\\:data-checked\\:bg-muted:is(.dark *):where([data-checked]:not([data-checked=false])){background-color:var(--muted)}.data-disabled\\:pointer-events-none:where([data-disabled=true]),.data-disabled\\:pointer-events-none:where([data-disabled]:not([data-disabled=false])){pointer-events:none}.data-disabled\\:cursor-not-allowed:where([data-disabled=true]),.data-disabled\\:cursor-not-allowed:where([data-disabled]:not([data-disabled=false])){cursor:not-allowed}.data-disabled\\:opacity-50:where([data-disabled=true]),.data-disabled\\:opacity-50:where([data-disabled]:not([data-disabled=false])){opacity:.5}.data-active\\:bg-background:where([data-state=active]),.data-active\\:bg-background:where([data-active]:not([data-active=false])){background-color:var(--background)}.data-active\\:text-foreground:where([data-state=active]),.data-active\\:text-foreground:where([data-active]:not([data-active=false])){color:var(--foreground)}.group-data-\\[variant\\=default\\]\\/tabs-list\\:data-active\\:shadow-sm:is(:where(.group\\/tabs-list)[data-variant=default] *):where([data-state=active]),.group-data-\\[variant\\=default\\]\\/tabs-list\\:data-active\\:shadow-sm:is(:where(.group\\/tabs-list)[data-variant=default] *):where([data-active]:not([data-active=false])){--tw-shadow:0 1px 3px 0 var(--tw-shadow-color,#0000001a), 0 1px 2px -1px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}.group-data-\\[variant\\=line\\]\\/tabs-list\\:data-active\\:bg-transparent:is(:where(.group\\/tabs-list)[data-variant=line] *):where([data-state=active]),.group-data-\\[variant\\=line\\]\\/tabs-list\\:data-active\\:bg-transparent:is(:where(.group\\/tabs-list)[data-variant=line] *):where([data-active]:not([data-active=false])){background-color:#0000}.group-data-\\[variant\\=line\\]\\/tabs-list\\:data-active\\:shadow-none:is(:where(.group\\/tabs-list)[data-variant=line] *):where([data-state=active]),.group-data-\\[variant\\=line\\]\\/tabs-list\\:data-active\\:shadow-none:is(:where(.group\\/tabs-list)[data-variant=line] *):where([data-active]:not([data-active=false])){--tw-shadow:0 0 #0000;box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}:is(.group-data-\\[variant\\=line\\]\\/tabs-list\\:data-active\\:after\\:opacity-100:is(:where(.group\\/tabs-list)[data-variant=line] *):where([data-state=active]),.group-data-\\[variant\\=line\\]\\/tabs-list\\:data-active\\:after\\:opacity-100:is(:where(.group\\/tabs-list)[data-variant=line] *):where([data-active]:not([data-active=false]))):after{content:var(--tw-content);opacity:1}.dark\\:data-active\\:border-input:is(.dark *):where([data-state=active]),.dark\\:data-active\\:border-input:is(.dark *):where([data-active]:not([data-active=false])){border-color:var(--input)}.dark\\:data-active\\:bg-input\\/30:is(.dark *):where([data-state=active]),.dark\\:data-active\\:bg-input\\/30:is(.dark *):where([data-active]:not([data-active=false])){background-color:var(--input)}@supports (color:color-mix(in lab, red, red)){.dark\\:data-active\\:bg-input\\/30:is(.dark *):where([data-state=active]),.dark\\:data-active\\:bg-input\\/30:is(.dark *):where([data-active]:not([data-active=false])){background-color:color-mix(in oklab, var(--input) 30%, transparent)}}.dark\\:data-active\\:text-foreground:is(.dark *):where([data-state=active]),.dark\\:data-active\\:text-foreground:is(.dark *):where([data-active]:not([data-active=false])){color:var(--foreground)}.dark\\:group-data-\\[variant\\=line\\]\\/tabs-list\\:data-active\\:border-transparent:is(.dark *):is(:where(.group\\/tabs-list)[data-variant=line] *):where([data-state=active]),.dark\\:group-data-\\[variant\\=line\\]\\/tabs-list\\:data-active\\:border-transparent:is(.dark *):is(:where(.group\\/tabs-list)[data-variant=line] *):where([data-active]:not([data-active=false])){border-color:#0000}.dark\\:group-data-\\[variant\\=line\\]\\/tabs-list\\:data-active\\:bg-transparent:is(.dark *):is(:where(.group\\/tabs-list)[data-variant=line] *):where([data-state=active]),.dark\\:group-data-\\[variant\\=line\\]\\/tabs-list\\:data-active\\:bg-transparent:is(.dark *):is(:where(.group\\/tabs-list)[data-variant=line] *):where([data-active]:not([data-active=false])){background-color:#0000}.data-horizontal\\:flex-col:where([data-orientation=horizontal]){flex-direction:column}.\\[\\&_code\\]\\:bg-transparent code{background-color:#0000}.\\[\\&_code\\]\\:p-0 code{padding:0}.\\[\\&_svg\\]\\:pointer-events-none svg{pointer-events:none}.\\[\\&_svg\\]\\:shrink-0 svg{flex-shrink:0}.data-\\[direction\\=start\\]\\:\\[\\&_svg\\]\\:rotate-180[data-direction=start] svg{rotate:180deg}.\\[\\&_svg\\:not\\(\\[class\\*\\=\\'size-\\'\\]\\)\\]\\:size-3 svg:not([class*=size-]){width:calc(var(--spacing) * 3);height:calc(var(--spacing) * 3)}.\\[\\&_svg\\:not\\(\\[class\\*\\=\\'size-\\'\\]\\)\\]\\:size-3\\.5 svg:not([class*=size-]){width:calc(var(--spacing) * 3.5);height:calc(var(--spacing) * 3.5)}.\\[\\&_svg\\:not\\(\\[class\\*\\=\\'size-\\'\\]\\)\\]\\:size-4 svg:not([class*=size-]){width:calc(var(--spacing) * 4);height:calc(var(--spacing) * 4)}.group-data-\\[orientation\\=vertical\\]\\/attachment\\:\\[\\&_svg\\:not\\(\\[class\\*\\=\\'size-\\'\\]\\)\\]\\:size-6:is(:where(.group\\/attachment)[data-orientation=vertical] *) svg:not([class*=size-]){width:calc(var(--spacing) * 6);height:calc(var(--spacing) * 6)}.group-data-\\[size\\=xs\\]\\/attachment\\:\\[\\&_svg\\:not\\(\\[class\\*\\=\\'size-\\'\\]\\)\\]\\:size-3\\.5:is(:where(.group\\/attachment)[data-size=xs] *) svg:not([class*=size-]){width:calc(var(--spacing) * 3.5);height:calc(var(--spacing) * 3.5)}.\\[\\.border-b\\]\\:pb-\\(--card-spacing\\).border-b{padding-bottom:var(--card-spacing)}.\\[\\.border-b\\]\\:pb-2.border-b{padding-bottom:calc(var(--spacing) * 2)}.\\[\\.border-t\\]\\:pt-2.border-t{padding-top:calc(var(--spacing) * 2)}.\\[a\\]\\:underline:is(a){text-decoration-line:underline}.\\[a\\]\\:underline-offset-3:is(a){text-underline-offset:3px}:is(.\\*\\:\\[a\\]\\:underline>*):is(a){text-decoration-line:underline}:is(.\\*\\:\\[a\\]\\:underline-offset-3>*):is(a){text-underline-offset:3px}@media (hover:hover){.\\[a\\]\\:hover\\:text-foreground:is(a):hover,:is(.\\*\\:\\[a\\]\\:hover\\:text-foreground>*):is(a):hover{color:var(--foreground)}}.\\[button\\]\\:text-start:is(button){text-align:start}.\\[button\\,a\\]\\:transition-colors:is(button,a){transition-property:color,background-color,border-color,outline-color,text-decoration-color,fill,stroke,--tw-gradient-from,--tw-gradient-via,--tw-gradient-to;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.\\[button\\,a\\]\\:outline-none:is(button,a){--tw-outline-style:none;outline-style:none}.\\[button\\,a\\]\\:focus-visible\\:border-ring:is(button,a):focus-visible{border-color:var(--ring)}.\\[button\\,a\\]\\:focus-visible\\:ring-3:is(button,a):focus-visible{--tw-ring-shadow:var(--tw-ring-inset,) 0 0 0 calc(3px + var(--tw-ring-offset-width)) var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}.\\[button\\,a\\]\\:focus-visible\\:ring-ring\\/50:is(button,a):focus-visible{--tw-ring-color:var(--ring)}@supports (color:color-mix(in lab, red, red)){.\\[button\\,a\\]\\:focus-visible\\:ring-ring\\/50:is(button,a):focus-visible{--tw-ring-color:color-mix(in oklab, var(--ring) 50%, transparent)}}:is(.\\*\\:\\[img\\]\\:aspect-square>*):is(img){aspect-ratio:1}:is(.\\*\\:\\[img\\]\\:w-full>*):is(img){width:100%}:is(.\\*\\:\\[img\\]\\:object-cover>*):is(img){object-fit:cover}:is(.\\*\\:\\[img\\:first-child\\]\\:rounded-t-xl>*):is(img:first-child){border-top-left-radius:calc(var(--radius) * 1.4);border-top-right-radius:calc(var(--radius) * 1.4)}:is(.\\*\\:\\[img\\:last-child\\]\\:rounded-b-xl>*):is(img:last-child){border-bottom-right-radius:calc(var(--radius) * 1.4);border-bottom-left-radius:calc(var(--radius) * 1.4)}.\\[\\&\\:not\\(\\:has\\(\\~\\[data-slot\\=questionnaire-description\\]\\)\\)\\]\\:mb-4:not(:has(~[data-slot=questionnaire-description])){margin-bottom:calc(var(--spacing) * 4)}.\\[\\&\\>\\[data-slot\\=bubble-content\\]\\:is\\(button\\,a\\)\\:hover\\]\\:bg-\\[color-mix\\(in_oklch\\,var\\(--muted\\)\\,var\\(--foreground\\)_5\\%\\)\\]>[data-slot=bubble-content]:is(button,a):hover{background-color:var(--muted)}@supports (color:color-mix(in lab, red, red)){.\\[\\&\\>\\[data-slot\\=bubble-content\\]\\:is\\(button\\,a\\)\\:hover\\]\\:bg-\\[color-mix\\(in_oklch\\,var\\(--muted\\)\\,var\\(--foreground\\)_5\\%\\)\\]>[data-slot=bubble-content]:is(button,a):hover{background-color:color-mix(in oklch,var(--muted),var(--foreground) 5%)}}.\\[\\&\\>\\[data-slot\\=bubble-content\\]\\:is\\(button\\,a\\)\\:hover\\]\\:bg-\\[color-mix\\(in_oklch\\,var\\(--secondary\\)\\,var\\(--foreground\\)_5\\%\\)\\]>[data-slot=bubble-content]:is(button,a):hover{background-color:var(--secondary)}@supports (color:color-mix(in lab, red, red)){.\\[\\&\\>\\[data-slot\\=bubble-content\\]\\:is\\(button\\,a\\)\\:hover\\]\\:bg-\\[color-mix\\(in_oklch\\,var\\(--secondary\\)\\,var\\(--foreground\\)_5\\%\\)\\]>[data-slot=bubble-content]:is(button,a):hover{background-color:color-mix(in oklch,var(--secondary),var(--foreground) 5%)}}.\\[\\&\\>\\[data-slot\\=bubble-content\\]\\:is\\(button\\,a\\)\\:hover\\]\\:bg-\\[oklch\\(from_var\\(--primary\\)_0\\.88_calc\\(c\\*0\\.5\\)_h\\)\\]>[data-slot=bubble-content]:is(button,a):hover{background-color:oklch(from var(--primary) .88 calc(c * .5) h)}.\\[\\&\\>\\[data-slot\\=bubble-content\\]\\:is\\(button\\,a\\)\\:hover\\]\\:bg-destructive\\/20>[data-slot=bubble-content]:is(button,a):hover{background-color:var(--destructive)}@supports (color:color-mix(in lab, red, red)){.\\[\\&\\>\\[data-slot\\=bubble-content\\]\\:is\\(button\\,a\\)\\:hover\\]\\:bg-destructive\\/20>[data-slot=bubble-content]:is(button,a):hover{background-color:color-mix(in oklab, var(--destructive) 20%, transparent)}}.\\[\\&\\>\\[data-slot\\=bubble-content\\]\\:is\\(button\\,a\\)\\:hover\\]\\:bg-muted>[data-slot=bubble-content]:is(button,a):hover{background-color:var(--muted)}.\\[\\&\\>\\[data-slot\\=bubble-content\\]\\:is\\(button\\,a\\)\\:hover\\]\\:bg-primary\\/80>[data-slot=bubble-content]:is(button,a):hover{background-color:var(--primary)}@supports (color:color-mix(in lab, red, red)){.\\[\\&\\>\\[data-slot\\=bubble-content\\]\\:is\\(button\\,a\\)\\:hover\\]\\:bg-primary\\/80>[data-slot=bubble-content]:is(button,a):hover{background-color:color-mix(in oklab, var(--primary) 80%, transparent)}}.\\[\\&\\>\\[data-slot\\=bubble-content\\]\\:is\\(button\\,a\\)\\:hover\\]\\:text-foreground>[data-slot=bubble-content]:is(button,a):hover{color:var(--foreground)}.dark\\:\\[\\&\\>\\[data-slot\\=bubble-content\\]\\:is\\(button\\,a\\)\\:hover\\]\\:bg-\\[oklch\\(from_var\\(--primary\\)_0\\.35_calc\\(c\\*0\\.5\\)_h\\)\\]:is(.dark *)>[data-slot=bubble-content]:is(button,a):hover{background-color:oklch(from var(--primary) .35 calc(c * .5) h)}.dark\\:\\[\\&\\>\\[data-slot\\=bubble-content\\]\\:is\\(button\\,a\\)\\:hover\\]\\:bg-destructive\\/30:is(.dark *)>[data-slot=bubble-content]:is(button,a):hover{background-color:var(--destructive)}@supports (color:color-mix(in lab, red, red)){.dark\\:\\[\\&\\>\\[data-slot\\=bubble-content\\]\\:is\\(button\\,a\\)\\:hover\\]\\:bg-destructive\\/30:is(.dark *)>[data-slot=bubble-content]:is(button,a):hover{background-color:color-mix(in oklab, var(--destructive) 30%, transparent)}}.dark\\:\\[\\&\\>\\[data-slot\\=bubble-content\\]\\:is\\(button\\,a\\)\\:hover\\]\\:bg-input\\/30:is(.dark *)>[data-slot=bubble-content]:is(button,a):hover{background-color:var(--input)}@supports (color:color-mix(in lab, red, red)){.dark\\:\\[\\&\\>\\[data-slot\\=bubble-content\\]\\:is\\(button\\,a\\)\\:hover\\]\\:bg-input\\/30:is(.dark *)>[data-slot=bubble-content]:is(button,a):hover{background-color:color-mix(in oklab, var(--input) 30%, transparent)}}.dark\\:\\[\\&\\>\\[data-slot\\=bubble-content\\]\\:is\\(button\\,a\\)\\:hover\\]\\:bg-muted\\/50:is(.dark *)>[data-slot=bubble-content]:is(button,a):hover{background-color:var(--muted)}@supports (color:color-mix(in lab, red, red)){.dark\\:\\[\\&\\>\\[data-slot\\=bubble-content\\]\\:is\\(button\\,a\\)\\:hover\\]\\:bg-muted\\/50:is(.dark *)>[data-slot=bubble-content]:is(button,a):hover{background-color:color-mix(in oklab, var(--muted) 50%, transparent)}}.\\[\\&\\>a\\]\\:underline>a{text-decoration-line:underline}.\\[\\&\\>a\\]\\:underline-offset-4>a{text-underline-offset:4px}.\\[\\&\\>a\\:hover\\]\\:text-primary>a:hover{color:var(--primary)}.has-\\[\\>\\[data-align\\=block-end\\]\\]\\:\\[\\&\\>input\\]\\:pt-3:has(>[data-align=block-end])>input{padding-top:calc(var(--spacing) * 3)}.has-\\[\\>\\[data-align\\=block-start\\]\\]\\:\\[\\&\\>input\\]\\:pb-3:has(>[data-align=block-start])>input{padding-bottom:calc(var(--spacing) * 3)}.has-\\[\\>\\[data-align\\=inline-end\\]\\]\\:\\[\\&\\>input\\]\\:pe-1\\.5:has(>[data-align=inline-end])>input{padding-inline-end:calc(var(--spacing) * 1.5)}.has-\\[\\>\\[data-align\\=inline-start\\]\\]\\:\\[\\&\\>input\\]\\:ps-1\\.5:has(>[data-align=inline-start])>input{padding-inline-start:calc(var(--spacing) * 1.5)}.\\[\\&\\>kbd\\]\\:rounded-\\[calc\\(var\\(--radius\\)-5px\\)\\]>kbd{border-radius:calc(var(--radius) - 5px)}.\\[\\&\\>ol\\]\\:my-1>ol{margin-block:var(--spacing)}.\\[\\&\\>svg\\:not\\(\\[class\\*\\=\\'size-\\'\\]\\)\\]\\:size-3\\.5>svg:not([class*=size-]){width:calc(var(--spacing) * 3.5);height:calc(var(--spacing) * 3.5)}.\\[\\&\\>svg\\:not\\(\\[class\\*\\=\\'size-\\'\\]\\)\\]\\:size-4>svg:not([class*=size-]){width:calc(var(--spacing) * 4);height:calc(var(--spacing) * 4)}.\\[\\&\\>ul\\]\\:my-1>ul{margin-block:var(--spacing)}}@property --tw-animation-delay{syntax:"*";inherits:false;initial-value:0s}@property --tw-animation-direction{syntax:"*";inherits:false;initial-value:normal}@property --tw-animation-duration{syntax:"*";inherits:false}@property --tw-animation-fill-mode{syntax:"*";inherits:false;initial-value:none}@property --tw-animation-iteration-count{syntax:"*";inherits:false;initial-value:1}@property --tw-enter-blur{syntax:"*";inherits:false;initial-value:0}@property --tw-enter-opacity{syntax:"*";inherits:false;initial-value:1}@property --tw-enter-rotate{syntax:"*";inherits:false;initial-value:0}@property --tw-enter-scale{syntax:"*";inherits:false;initial-value:1}@property --tw-enter-translate-x{syntax:"*";inherits:false;initial-value:0}@property --tw-enter-translate-y{syntax:"*";inherits:false;initial-value:0}@property --tw-exit-blur{syntax:"*";inherits:false;initial-value:0}@property --tw-exit-opacity{syntax:"*";inherits:false;initial-value:1}@property --tw-exit-rotate{syntax:"*";inherits:false;initial-value:0}@property --tw-exit-scale{syntax:"*";inherits:false;initial-value:1}@property --tw-exit-translate-x{syntax:"*";inherits:false;initial-value:0}@property --tw-exit-translate-y{syntax:"*";inherits:false;initial-value:0}@property --scroll-fade-t{syntax:"<length-percentage>";inherits:false;initial-value:0}@property --scroll-fade-b{syntax:"<length-percentage>";inherits:false;initial-value:0}@property --scroll-fade-s{syntax:"<length-percentage>";inherits:false;initial-value:0}@property --scroll-fade-e{syntax:"<length-percentage>";inherits:false;initial-value:0}@property --scroll-fade-mask{syntax:"*";inherits:false}@property --shimmer-angle{syntax:"<angle>";inherits:true;initial-value:20deg}@property --shimmer-image{syntax:"*";inherits:false}@property --shimmer-text-fill{syntax:"*";inherits:false}@media (prefers-reduced-motion:reduce){.shimmer{-webkit-text-fill-color:currentColor;background-image:none;animation:none}}:host{--font-sans:system-ui, sans-serif;--font-heading:system-ui, sans-serif;--background:oklch(100% 0 0);--foreground:oklch(14.5% 0 0);--card:oklch(100% 0 0);--card-foreground:oklch(14.5% 0 0);--popover:oklch(100% 0 0);--popover-foreground:oklch(14.5% 0 0);--primary:oklch(20.5% 0 0);--primary-foreground:oklch(98.5% 0 0);--secondary:oklch(97% 0 0);--secondary-foreground:oklch(20.5% 0 0);--muted:oklch(97% 0 0);--muted-foreground:oklch(55.6% 0 0);--accent:oklch(97% 0 0);--accent-foreground:oklch(20.5% 0 0);--destructive:oklch(57.7% .245 27.325);--border:oklch(92.2% 0 0);--input:oklch(92.2% 0 0);--ring:oklch(70.8% 0 0);--chart-1:oklch(87% 0 0);--chart-2:oklch(55.6% 0 0);--chart-3:oklch(43.9% 0 0);--chart-4:oklch(37.1% 0 0);--chart-5:oklch(26.9% 0 0);--radius:.625rem;--sidebar:oklch(98.5% 0 0);--sidebar-foreground:oklch(14.5% 0 0);--sidebar-primary:oklch(20.5% 0 0);--sidebar-primary-foreground:oklch(98.5% 0 0);--sidebar-accent:oklch(97% 0 0);--sidebar-accent-foreground:oklch(20.5% 0 0);--sidebar-border:oklch(92.2% 0 0);--sidebar-ring:oklch(70.8% 0 0)}.dark{--background:oklch(14.5% 0 0);--foreground:oklch(98.5% 0 0);--card:oklch(20.5% 0 0);--card-foreground:oklch(98.5% 0 0);--popover:oklch(20.5% 0 0);--popover-foreground:oklch(98.5% 0 0);--primary:oklch(92.2% 0 0);--primary-foreground:oklch(20.5% 0 0);--secondary:oklch(26.9% 0 0);--secondary-foreground:oklch(98.5% 0 0);--muted:oklch(26.9% 0 0);--muted-foreground:oklch(70.8% 0 0);--accent:oklch(26.9% 0 0);--accent-foreground:oklch(98.5% 0 0);--destructive:oklch(70.4% .191 22.216);--border:oklch(100% 0 0/.1);--input:oklch(100% 0 0/.15);--ring:oklch(55.6% 0 0);--chart-1:oklch(87% 0 0);--chart-2:oklch(55.6% 0 0);--chart-3:oklch(43.9% 0 0);--chart-4:oklch(37.1% 0 0);--chart-5:oklch(26.9% 0 0);--sidebar:oklch(20.5% 0 0);--sidebar-foreground:oklch(98.5% 0 0);--sidebar-primary:oklch(48.8% .243 264.376);--sidebar-primary-foreground:oklch(98.5% 0 0);--sidebar-accent:oklch(26.9% 0 0);--sidebar-accent-foreground:oklch(98.5% 0 0);--sidebar-border:oklch(100% 0 0/.1);--sidebar-ring:oklch(55.6% 0 0)}@property --tw-translate-x{syntax:"*";inherits:false;initial-value:0}@property --tw-translate-y{syntax:"*";inherits:false;initial-value:0}@property --tw-translate-z{syntax:"*";inherits:false;initial-value:0}@property --tw-scroll-snap-strictness{syntax:"*";inherits:false;initial-value:proximity}@property --tw-space-y-reverse{syntax:"*";inherits:false;initial-value:0}@property --tw-border-style{syntax:"*";inherits:false;initial-value:solid}@property --tw-leading{syntax:"*";inherits:false}@property --tw-font-weight{syntax:"*";inherits:false}@property --tw-tracking{syntax:"*";inherits:false}@property --tw-ordinal{syntax:"*";inherits:false}@property --tw-slashed-zero{syntax:"*";inherits:false}@property --tw-numeric-figure{syntax:"*";inherits:false}@property --tw-numeric-spacing{syntax:"*";inherits:false}@property --tw-numeric-fraction{syntax:"*";inherits:false}@property --tw-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-shadow-color{syntax:"*";inherits:false}@property --tw-shadow-alpha{syntax:"<percentage>";inherits:false;initial-value:100%}@property --tw-inset-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-inset-shadow-color{syntax:"*";inherits:false}@property --tw-inset-shadow-alpha{syntax:"<percentage>";inherits:false;initial-value:100%}@property --tw-ring-color{syntax:"*";inherits:false}@property --tw-ring-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-inset-ring-color{syntax:"*";inherits:false}@property --tw-inset-ring-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-ring-inset{syntax:"*";inherits:false}@property --tw-ring-offset-width{syntax:"<length>";inherits:false;initial-value:0}@property --tw-ring-offset-color{syntax:"*";inherits:false;initial-value:#fff}@property --tw-ring-offset-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-outline-style{syntax:"*";inherits:false;initial-value:solid}@property --tw-duration{syntax:"*";inherits:false}@property --tw-ease{syntax:"*";inherits:false}@property --tw-content{syntax:"*";inherits:false;initial-value:""}@property --tw-scrollbar-thumb{syntax:"<color>";inherits:false;initial-value:#0000}@property --tw-scrollbar-track{syntax:"<color>";inherits:false;initial-value:#0000}@property --tw-scale-x{syntax:"*";inherits:false;initial-value:1}@property --tw-scale-y{syntax:"*";inherits:false;initial-value:1}@property --tw-scale-z{syntax:"*";inherits:false;initial-value:1}@keyframes spin{to{transform:rotate(360deg)}}@keyframes scroll-fade-reveal-b{0%{--scroll-fade-b:var(--_scroll-fade-size-b,var(--scroll-fade-size,min(12%, calc(var(--spacing) * 10))))}to{--scroll-fade-b:0px}}@keyframes scroll-fade-reveal-s{0%{--scroll-fade-s:0px}to{--scroll-fade-s:var(--_scroll-fade-size-s,var(--scroll-fade-size,min(12%, calc(var(--spacing) * 10))))}}@keyframes scroll-fade-reveal-e{0%{--scroll-fade-e:var(--_scroll-fade-size-e,var(--scroll-fade-size,min(12%, calc(var(--spacing) * 10))))}to{--scroll-fade-e:0px}}@keyframes tw-shimmer{0%{background-position:100% 0}to{background-position:0 0}}`,e.append(i);let a=r,o=gh(e,()=>t(a.debug)),s=(0,Le.createRoot)(n),c={},l=t=>{a=t,s.render((0,J.jsx)(hh,{options:t,host:e.host,controller:c}))};return l(r),{update:l,reset:()=>c.reset?.(),stop:()=>c.stop?.(),dispose:()=>{s.unmount(),o(),i.remove()}}}export{_h as renderChat};
|