ain-ui 0.2.1 → 1.0.3
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/NOTICE +37 -0
- package/README.md +179 -76
- package/dist/agent.d.ts +131 -0
- package/dist/agent.js +802 -0
- package/dist/ainui.d.ts +15 -1
- package/dist/ainui.js +59 -16
- package/dist/basic.d.ts +5 -47
- package/dist/basic.js +11 -25
- package/dist/catalog/standard.gen.d.ts +5 -0
- package/dist/catalog/standard.gen.js +6 -0
- package/dist/catalog-v1.json +2560 -0
- package/dist/catalog.json +19924 -2047
- package/dist/chat.js +6 -7
- package/dist/expression.d.ts +23 -0
- package/dist/expression.js +222 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +2 -0
- package/dist/macros.d.ts +12 -0
- package/dist/macros.js +57 -0
- package/dist/payment.js +6 -7
- package/dist/pickers.d.ts +158 -0
- package/dist/pickers.js +110 -0
- package/dist/protocol.d.ts +100 -0
- package/dist/protocol.js +232 -0
- package/dist/react/ain.d.ts +1 -0
- package/dist/react/ain.js +225 -0
- package/dist/react/catalog.d.ts +9 -0
- package/dist/react/catalog.js +23 -0
- package/dist/react/core.d.ts +84 -0
- package/dist/react/core.js +158 -0
- package/dist/react/functions.d.ts +2 -0
- package/dist/react/functions.js +29 -0
- package/dist/react/standard/composites.d.ts +1 -0
- package/dist/react/standard/composites.js +110 -0
- package/dist/react/standard/data.d.ts +1 -0
- package/dist/react/standard/data.js +481 -0
- package/dist/react/standard/feedback.d.ts +11 -0
- package/dist/react/standard/feedback.js +111 -0
- package/dist/react/standard/inputs.d.ts +5 -0
- package/dist/react/standard/inputs.js +467 -0
- package/dist/react/standard/layout.d.ts +5 -0
- package/dist/react/standard/layout.js +104 -0
- package/dist/react/standard/media.d.ts +33 -0
- package/dist/react/standard/media.js +208 -0
- package/dist/react/standard/rich.d.ts +1 -0
- package/dist/react/standard/rich.js +146 -0
- package/dist/react/standard/text.d.ts +9 -0
- package/dist/react/standard/text.js +209 -0
- package/dist/react/surface.d.ts +44 -0
- package/dist/react/surface.js +134 -0
- package/dist/react.d.ts +3 -36
- package/dist/react.js +3 -240
- package/dist/renderer.d.ts +1 -1
- package/dist/renderer.js +307 -4
- package/dist/styles.css +850 -0
- package/package.json +28 -11
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { type A2uiAction, type A2uiMessage } from "../protocol.js";
|
|
3
|
+
import { type ChatUpdate, type FolderChatAgent } from "../chat.js";
|
|
4
|
+
import { type AssetResolver, type FileViewRenderer } from "./core.js";
|
|
5
|
+
/**
|
|
6
|
+
* What this renderer can draw, in the form an agent reads it (`a2uiRendererCapabilities`): the catalog ids, and
|
|
7
|
+
* with `inline` the catalogs themselves so an agent that has never seen AIN-UI can still write for it.
|
|
8
|
+
*/
|
|
9
|
+
export declare function ainuiCapabilities(options?: {
|
|
10
|
+
inline?: boolean;
|
|
11
|
+
}): Record<string, unknown>;
|
|
12
|
+
export type AinuiSurfaceProps = {
|
|
13
|
+
/** A2UI messages, 1.0 or v0.9. Appending to the list updates the surfaces in place; any other change redraws. */
|
|
14
|
+
messages: readonly A2uiMessage[];
|
|
15
|
+
onAction: (action: A2uiAction) => void | Promise<void>;
|
|
16
|
+
/** Every renderer→agent message as the 1.0 envelope: actions, errors, function calls and responses. */
|
|
17
|
+
onMessage?: (message: Record<string, unknown>) => void;
|
|
18
|
+
onError?: (error: Error) => void;
|
|
19
|
+
resolveAsset?: AssetResolver;
|
|
20
|
+
renderFile?: FileViewRenderer;
|
|
21
|
+
/** A follow-up suggestion was chosen: send its text as the user's next message. */
|
|
22
|
+
sendMessage?: (text: string) => void;
|
|
23
|
+
openUrl?: (href: string) => void;
|
|
24
|
+
/** Design system: "ain" (default), "plain" or "material", or any name the host styles via `[data-ainui-theme]`. */
|
|
25
|
+
theme?: string;
|
|
26
|
+
className?: string;
|
|
27
|
+
};
|
|
28
|
+
export declare function AinuiSurface({ messages, onAction, onMessage, onError, resolveAsset, renderFile, sendMessage, openUrl, theme, className }: AinuiSurfaceProps): React.JSX.Element;
|
|
29
|
+
export type FolderChatSend = (turn: {
|
|
30
|
+
q: string;
|
|
31
|
+
agentId: string;
|
|
32
|
+
contextId?: string;
|
|
33
|
+
signal: AbortSignal;
|
|
34
|
+
onUpdate: (update: ChatUpdate) => void;
|
|
35
|
+
}) => Promise<ChatUpdate>;
|
|
36
|
+
/** Scope changes unmount the old chat, abort its request and drop its context ids. */
|
|
37
|
+
export declare function AinuiFolderChat(props: {
|
|
38
|
+
driveId: string;
|
|
39
|
+
path: string;
|
|
40
|
+
agents: FolderChatAgent[];
|
|
41
|
+
onSend: FolderChatSend;
|
|
42
|
+
theme?: string;
|
|
43
|
+
className?: string;
|
|
44
|
+
}): React.JSX.Element;
|
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
+
import { useEffect, useMemo, useRef, useState } from "react";
|
|
4
|
+
import { A2uiSurface, MarkdownContext } from "@a2ui/react";
|
|
5
|
+
import { MessageProcessor, STRICT_VALIDATION } from "@a2ui/web_core";
|
|
6
|
+
import { basicCatalog, injectBasicCatalogStyles } from "@a2ui/web_core/catalogs/basic/v1";
|
|
7
|
+
import { renderMarkdown } from "@a2ui/markdown-it";
|
|
8
|
+
import { upgradeMessages } from "../protocol.js";
|
|
9
|
+
import { ainuiFolderChat } from "../chat.js";
|
|
10
|
+
import { ainuiCatalog } from "./catalog.js";
|
|
11
|
+
import { HostContext } from "./core.js";
|
|
12
|
+
const catalogs = [ainuiCatalog, basicCatalog];
|
|
13
|
+
/**
|
|
14
|
+
* What this renderer can draw, in the form an agent reads it (`a2uiRendererCapabilities`): the catalog ids, and
|
|
15
|
+
* with `inline` the catalogs themselves so an agent that has never seen AIN-UI can still write for it.
|
|
16
|
+
*/
|
|
17
|
+
export function ainuiCapabilities(options = {}) {
|
|
18
|
+
const p = new MessageProcessor(catalogs);
|
|
19
|
+
try {
|
|
20
|
+
return p.getRendererCapabilities({ versions: ["1.0"], includeInlineCatalogs: !!options.inline });
|
|
21
|
+
}
|
|
22
|
+
finally {
|
|
23
|
+
p.dispose?.();
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
export function AinuiSurface({ messages, onAction, onMessage, onError, resolveAsset, renderFile, sendMessage, openUrl, theme, className }) {
|
|
27
|
+
const handlers = useRef({ onAction, onMessage, onError });
|
|
28
|
+
handlers.current = { onAction, onMessage, onError };
|
|
29
|
+
const live = useRef(null);
|
|
30
|
+
const [state, setState] = useState({ processor: null, error: "", tick: 0 });
|
|
31
|
+
useEffect(() => { injectBasicCatalogStyles?.(); }, []);
|
|
32
|
+
useEffect(() => {
|
|
33
|
+
const fail = (e) => { const error = e instanceof Error ? e : new Error(String(e)); handlers.current.onError?.(error); return error.message; };
|
|
34
|
+
const current = live.current;
|
|
35
|
+
const appended = current && messages.length >= current.seen.length && current.seen.every((m, i) => m === messages[i]);
|
|
36
|
+
if (current && appended) {
|
|
37
|
+
// The same conversation grew: apply only what is new, so the surface keeps its state (inputs, scroll, tabs).
|
|
38
|
+
const tail = messages.slice(current.seen.length);
|
|
39
|
+
current.seen = messages;
|
|
40
|
+
if (!tail.length)
|
|
41
|
+
return;
|
|
42
|
+
try {
|
|
43
|
+
current.processor.processMessages(upgradeMessages(tail));
|
|
44
|
+
setState((s) => ({ ...s, error: "", tick: s.tick + 1 }));
|
|
45
|
+
}
|
|
46
|
+
catch (e) {
|
|
47
|
+
setState((s) => ({ ...s, error: fail(e) }));
|
|
48
|
+
}
|
|
49
|
+
return;
|
|
50
|
+
}
|
|
51
|
+
current?.processor.dispose?.();
|
|
52
|
+
const processor = new MessageProcessor(catalogs, undefined, {
|
|
53
|
+
version: "1.0",
|
|
54
|
+
// What an agent sent is checked against the catalog before it is drawn: a wrong component is an error
|
|
55
|
+
// the host hears about, not a blank space.
|
|
56
|
+
validationConfig: STRICT_VALIDATION,
|
|
57
|
+
unifiedOutbound: true,
|
|
58
|
+
outboundListener: (message) => {
|
|
59
|
+
handlers.current.onMessage?.(message);
|
|
60
|
+
const action = message.action;
|
|
61
|
+
if (action && typeof action.name === "string")
|
|
62
|
+
return handlers.current.onAction(action);
|
|
63
|
+
},
|
|
64
|
+
});
|
|
65
|
+
live.current = { processor, seen: messages };
|
|
66
|
+
try {
|
|
67
|
+
processor.processMessages(upgradeMessages(messages));
|
|
68
|
+
setState((s) => ({ processor, error: "", tick: s.tick + 1 }));
|
|
69
|
+
}
|
|
70
|
+
catch (e) {
|
|
71
|
+
setState((s) => ({ processor: null, error: fail(e), tick: s.tick + 1 }));
|
|
72
|
+
}
|
|
73
|
+
}, [messages]);
|
|
74
|
+
useEffect(() => () => { live.current?.processor.dispose?.(); live.current = null; }, []);
|
|
75
|
+
const host = useMemo(() => ({ resolveAsset: resolveAsset ?? (() => ""), renderFile, sendMessage, openUrl }), [resolveAsset, renderFile, sendMessage, openUrl]);
|
|
76
|
+
const shell = `ain-ui${className ? ` ${className}` : ""}`;
|
|
77
|
+
if (state.error)
|
|
78
|
+
return _jsx("div", { className: shell, "data-ainui-theme": theme, role: "alert", children: state.error });
|
|
79
|
+
if (!state.processor)
|
|
80
|
+
return _jsx("div", { className: shell, "data-ainui-theme": theme, "aria-busy": "true" });
|
|
81
|
+
return _jsx(MarkdownContext.Provider, { value: renderMarkdown, children: _jsx(HostContext.Provider, { value: host, children: _jsx("div", { className: shell, "data-ainui-theme": theme, children: Array.from(state.processor.model.surfacesMap.values()).map((surface) => _jsx(A2uiSurface, { surface: surface }, surface.id)) }) }) });
|
|
82
|
+
}
|
|
83
|
+
/** Scope changes unmount the old chat, abort its request and drop its context ids. */
|
|
84
|
+
export function AinuiFolderChat(props) {
|
|
85
|
+
return _jsx(FolderChatSession, { ...props }, `${props.driveId}:${props.path}`);
|
|
86
|
+
}
|
|
87
|
+
function FolderChatSession({ driveId, path, agents, onSend, theme, className }) {
|
|
88
|
+
const [agentId, select] = useState(agents[0]?.id ?? "");
|
|
89
|
+
const [messages, setMessages] = useState([]);
|
|
90
|
+
const [busy, setBusy] = useState(false);
|
|
91
|
+
const pending = useRef(null);
|
|
92
|
+
const contexts = useRef(new Map());
|
|
93
|
+
useEffect(() => () => { pending.current?.abort(); pending.current = null; }, []);
|
|
94
|
+
const selected = agents.some(a => a.id === agentId) ? agentId : agents[0]?.id ?? "";
|
|
95
|
+
const surface = ainuiFolderChat({ driveId, path, agents, agentId: selected, messages, busy });
|
|
96
|
+
return _jsx(AinuiSurface, { messages: surface, theme: theme, className: className, onAction: async (action) => {
|
|
97
|
+
const c = action.context ?? {};
|
|
98
|
+
if (c.operation === "cancel") {
|
|
99
|
+
pending.current?.abort();
|
|
100
|
+
return;
|
|
101
|
+
}
|
|
102
|
+
if (c.operation === "select" && !pending.current) {
|
|
103
|
+
select(String(c.agentId));
|
|
104
|
+
setMessages([]);
|
|
105
|
+
return;
|
|
106
|
+
}
|
|
107
|
+
if (c.operation !== "send" || pending.current || typeof c.q !== "string" || !selected)
|
|
108
|
+
return;
|
|
109
|
+
const controller = new AbortController();
|
|
110
|
+
pending.current = controller;
|
|
111
|
+
setBusy(true);
|
|
112
|
+
setMessages(m => [...m.slice(-98), { role: "user", text: c.q }, { role: "agent", text: "" }]);
|
|
113
|
+
const onUpdate = (u) => {
|
|
114
|
+
if (pending.current !== controller || controller.signal.aborted)
|
|
115
|
+
return;
|
|
116
|
+
if (u.contextId)
|
|
117
|
+
contexts.current.set(selected, u.contextId);
|
|
118
|
+
setMessages(m => [...m.slice(0, -1), { role: "agent", text: u.text }]);
|
|
119
|
+
};
|
|
120
|
+
try {
|
|
121
|
+
onUpdate(await onSend({ q: c.q, agentId: selected, contextId: contexts.current.get(selected), signal: controller.signal, onUpdate }));
|
|
122
|
+
}
|
|
123
|
+
catch (e) {
|
|
124
|
+
if (pending.current === controller)
|
|
125
|
+
setMessages(m => [...m, { role: "error", text: controller.signal.aborted ? "Stopped" : e.message }]);
|
|
126
|
+
}
|
|
127
|
+
finally {
|
|
128
|
+
if (pending.current === controller) {
|
|
129
|
+
pending.current = null;
|
|
130
|
+
setBusy(false);
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
} });
|
|
134
|
+
}
|
package/dist/react.d.ts
CHANGED
|
@@ -1,36 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
import { type FolderChatAgent, type ChatUpdate } from "./chat.js";
|
|
5
|
-
import type { A2uiAction, A2uiMessage } from "./basic.js";
|
|
6
|
-
export type AssetResolver = (asset: AssetRef["$asset"], options?: {
|
|
7
|
-
download?: boolean;
|
|
8
|
-
}) => string;
|
|
9
|
-
export type FileViewRenderer = (file: {
|
|
10
|
-
src: string;
|
|
11
|
-
download: string;
|
|
12
|
-
name: string;
|
|
13
|
-
mime: string;
|
|
14
|
-
size?: number;
|
|
15
|
-
}) => React.ReactNode;
|
|
16
|
-
export declare const ainuiCatalog: Catalog<import("@a2ui/react/v0_9").ReactComponentImplementation, import("@a2ui/web_core/v0_9").FunctionImplementation>;
|
|
17
|
-
export declare function AinuiSurface({ messages, onAction, resolveAsset, renderFile }: {
|
|
18
|
-
messages: A2uiMessage[];
|
|
19
|
-
onAction: (action: A2uiAction) => void | Promise<void>;
|
|
20
|
-
resolveAsset?: AssetResolver;
|
|
21
|
-
renderFile?: FileViewRenderer;
|
|
22
|
-
}): React.JSX.Element;
|
|
23
|
-
export type FolderChatSend = (turn: {
|
|
24
|
-
q: string;
|
|
25
|
-
agentId: string;
|
|
26
|
-
contextId?: string;
|
|
27
|
-
signal: AbortSignal;
|
|
28
|
-
onUpdate: (update: ChatUpdate) => void;
|
|
29
|
-
}) => Promise<ChatUpdate>;
|
|
30
|
-
/** Scope changes unmount the old chat, abort its request and drop its context ids. */
|
|
31
|
-
export declare function AinuiFolderChat(props: {
|
|
32
|
-
driveId: string;
|
|
33
|
-
path: string;
|
|
34
|
-
agents: FolderChatAgent[];
|
|
35
|
-
onSend: FolderChatSend;
|
|
36
|
-
}): React.JSX.Element;
|
|
1
|
+
export { AinuiSurface, AinuiFolderChat, ainuiCapabilities, type AinuiSurfaceProps, type FolderChatSend } from "./react/surface.js";
|
|
2
|
+
export { ainuiCatalog, standardComponents, missingStandardViews, AINUI_INSTRUCTIONS } from "./react/catalog.js";
|
|
3
|
+
export { STANDARD, HostContext, useHost, standard, type AssetResolver, type FileViewRenderer, type Host, type ViewProps } from "./react/core.js";
|
package/dist/react.js
CHANGED
|
@@ -1,241 +1,4 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
import { Catalog, CommonSchemas, MessageProcessor } from "@a2ui/web_core/v0_9";
|
|
6
|
-
import { z } from "zod";
|
|
7
|
-
import { renderMarkdown } from "@a2ui/markdown-it";
|
|
8
|
-
import { AINUI_CATALOG, AINUI_UPLOAD_MAX_BYTES } from "./ainui.js";
|
|
9
|
-
import { ainuiFolderChat } from "./chat.js";
|
|
10
|
-
const FileRenderer = createContext(undefined);
|
|
11
|
-
const Assets = createContext(() => "");
|
|
12
|
-
const box = { display: "flex", flexDirection: "column", gap: 8, minWidth: 0 };
|
|
13
|
-
const button = { padding: "8px 12px", border: "1px solid #8885", borderRadius: 8, color: "inherit", background: "transparent" };
|
|
14
|
-
function useValue(ctx, raw) {
|
|
15
|
-
const signal = useMemo(() => ctx.dataContext.resolveSignal(raw), [ctx, raw]);
|
|
16
|
-
return useSignalValue(signal);
|
|
17
|
-
}
|
|
18
|
-
function urlOf(value, resolver, download = false) {
|
|
19
|
-
const raw = value && typeof value === "object" && "$asset" in value
|
|
20
|
-
? resolver(value.$asset, { download }) : value;
|
|
21
|
-
if (typeof raw !== "string")
|
|
22
|
-
return "";
|
|
23
|
-
if (/^\/(?!\/)/.test(raw) || /^https?:\/\//i.test(raw) || /^blob:/i.test(raw))
|
|
24
|
-
return raw;
|
|
25
|
-
return "";
|
|
26
|
-
}
|
|
27
|
-
async function fire(ctx, extra = {}) {
|
|
28
|
-
const raw = ctx.componentModel.properties.action;
|
|
29
|
-
if (!raw)
|
|
30
|
-
return;
|
|
31
|
-
const action = ctx.dataContext.resolveAction(raw);
|
|
32
|
-
if (action?.event)
|
|
33
|
-
await ctx.dispatchAction({ event: { ...action.event, context: { ...action.event.context, ...extra } } });
|
|
34
|
-
}
|
|
35
|
-
// A2UI owns state, bindings, action validation and surface lifecycle. These
|
|
36
|
-
// implementations add only AIN-UI's component views to the official catalog.
|
|
37
|
-
const api = (name, shape) => ({ name, schema: z.object(shape).passthrough() });
|
|
38
|
-
const dynamic = z.union([CommonSchemas.DynamicValue, z.object({ $asset: z.object({
|
|
39
|
-
drive_id: z.string(), path: z.string(), variant: z.enum(["thumb", "original"]), mime: z.string(), v: z.number().optional(),
|
|
40
|
-
}) }), z.null()]).optional();
|
|
41
|
-
const Grid = createBinderlessComponentImplementation(api("Grid", { children: CommonSchemas.ChildList, minItemWidth: z.number().optional(), gap: z.number().optional() }), ({ context, buildChild }) => {
|
|
42
|
-
const p = context.componentModel.properties;
|
|
43
|
-
const spec = p.children;
|
|
44
|
-
const rows = useValue(context, !Array.isArray(spec) && spec ? { path: spec.path } : []);
|
|
45
|
-
return _jsx("div", { className: "ainui-grid", style: { display: "grid", width: "100%", minWidth: 0, gridTemplateColumns: `repeat(auto-fill,minmax(min(100%,${Math.max(64, Number(p.minItemWidth) || 128)}px),1fr))`, gap: Number(p.gap) || 8 }, children: Array.isArray(spec) ? spec.map((id) => _jsx(React.Fragment, { children: buildChild(id) }, id)) :
|
|
46
|
-
(Array.isArray(rows) ? rows : []).map((_, i) => _jsx(React.Fragment, { children: buildChild(spec.componentId, `${spec.path}/${i}`) }, i)) });
|
|
47
|
-
});
|
|
48
|
-
const Tile = createBinderlessComponentImplementation(api("Tile", { media: dynamic, label: dynamic, caption: dynamic, kind: dynamic, action: CommonSchemas.Action.optional() }), ({ context }) => {
|
|
49
|
-
const p = context.componentModel.properties;
|
|
50
|
-
const media = useValue(context, p.media);
|
|
51
|
-
const label = useValue(context, p.label);
|
|
52
|
-
const caption = useValue(context, p.caption);
|
|
53
|
-
const kind = useValue(context, p.kind);
|
|
54
|
-
const resolver = useContext(Assets);
|
|
55
|
-
const src = urlOf(media, resolver);
|
|
56
|
-
const [failed, setFailed] = useState(false);
|
|
57
|
-
useEffect(() => setFailed(false), [src]);
|
|
58
|
-
return _jsxs("button", { className: "ainui-tile", style: { ...box, ...button, width: "100%", height: "100%", textAlign: "left", overflow: "hidden" }, onClick: () => void fire(context), children: [_jsx("span", { className: "ainui-tile-media", style: { display: "flex", flex: "0 0 auto", alignItems: "center", justifyContent: "center", width: "100%", aspectRatio: "1", overflow: "hidden", borderRadius: 8, background: "#8882" }, children: src && !failed ? _jsx("img", { src: src, alt: "", loading: "lazy", onError: () => setFailed(true), style: { width: "100%", height: "100%", objectFit: "cover" } }) :
|
|
59
|
-
_jsx("span", { style: { fontSize: 40 }, children: kind === "folder" ? "📁" : "📄" }) }), _jsx("span", { className: "ainui-tile-name", title: label, style: { display: "-webkit-box", WebkitBoxOrient: "vertical", WebkitLineClamp: 2, overflow: "hidden", overflowWrap: "anywhere", lineHeight: "1.35em", height: "2.7em" }, children: label }), _jsx("small", { style: { whiteSpace: "nowrap", overflow: "hidden", textOverflow: "ellipsis", maxWidth: "100%" }, children: caption })] });
|
|
60
|
-
});
|
|
61
|
-
const FileView = createBinderlessComponentImplementation(api("FileView", { src: dynamic, name: dynamic, mime: dynamic, size: dynamic }), ({ context }) => {
|
|
62
|
-
const p = context.componentModel.properties;
|
|
63
|
-
const asset = useValue(context, p.src);
|
|
64
|
-
const name = useValue(context, p.name);
|
|
65
|
-
const mime = useValue(context, p.mime) || "";
|
|
66
|
-
const resolver = useContext(Assets);
|
|
67
|
-
const src = urlOf(asset, resolver);
|
|
68
|
-
const render = useContext(FileRenderer);
|
|
69
|
-
const size = useValue(context, p.size);
|
|
70
|
-
if (render && src)
|
|
71
|
-
return _jsx(_Fragment, { children: render({ src, download: urlOf(asset, resolver, true), name, mime, size }) });
|
|
72
|
-
return _jsxs("div", { style: box, children: [src && (mime.startsWith("image/") ? _jsx("img", { src: src, alt: name, style: { maxHeight: "70vh", objectFit: "contain" } }) :
|
|
73
|
-
mime.startsWith("video/") ? _jsx("video", { controls: true, src: src }) : mime.startsWith("audio/") ? _jsx("audio", { controls: true, src: src }) :
|
|
74
|
-
mime === "application/pdf" ? _jsx("iframe", { title: name, src: src, style: { height: "70vh", border: 0 } }) : null), _jsx("strong", { children: name }), _jsx("a", { href: urlOf(asset, resolver, true), download: name, children: "Download" })] });
|
|
75
|
-
});
|
|
76
|
-
const Breadcrumbs = createBinderlessComponentImplementation(api("Breadcrumbs", { items: dynamic, action: CommonSchemas.Action.optional() }), ({ context }) => {
|
|
77
|
-
const items = useValue(context, context.componentModel.properties.items) || [];
|
|
78
|
-
return _jsx("nav", { "aria-label": "Folder path", style: { display: "flex", flexWrap: "wrap", gap: 4 }, children: items.map((item, i) => i === items.length - 1 ? _jsx("span", { "aria-current": "page", children: item.label }, i) :
|
|
79
|
-
_jsx("button", { style: button, onClick: () => void fire(context, { path: item.path }), children: item.label }, i)) });
|
|
80
|
-
});
|
|
81
|
-
const Segmented = createBinderlessComponentImplementation(api("Segmented", { options: z.array(z.object({ value: z.string(), label: z.string() })), value: dynamic, action: CommonSchemas.Action.optional() }), ({ context }) => {
|
|
82
|
-
const p = context.componentModel.properties;
|
|
83
|
-
const value = useValue(context, p.value);
|
|
84
|
-
return _jsx("div", { role: "group", style: { display: "flex", gap: 4 }, children: p.options.map((o) => _jsx("button", { style: { ...button, fontWeight: value === o.value ? "bold" : "normal" }, "aria-pressed": value === o.value, onClick: () => {
|
|
85
|
-
const binding = p.value;
|
|
86
|
-
if (binding?.path)
|
|
87
|
-
context.dataContext.set(binding.path, o.value);
|
|
88
|
-
void fire(context, { value: o.value });
|
|
89
|
-
}, children: o.label }, o.value)) });
|
|
90
|
-
});
|
|
91
|
-
const FileUpload = createBinderlessComponentImplementation(api("FileUpload", { label: dynamic, maxBytes: z.number().optional(), action: CommonSchemas.Action.optional() }), ({ context }) => {
|
|
92
|
-
const p = context.componentModel.properties;
|
|
93
|
-
const label = useValue(context, p.label) || "Upload file";
|
|
94
|
-
const [busy, setBusy] = useState(false);
|
|
95
|
-
const [error, setError] = useState("");
|
|
96
|
-
const limit = Math.min(Number(p.maxBytes) || AINUI_UPLOAD_MAX_BYTES, AINUI_UPLOAD_MAX_BYTES);
|
|
97
|
-
return _jsxs("label", { style: box, children: [label, _jsx("input", { type: "file", disabled: busy, onChange: async (e) => {
|
|
98
|
-
const file = e.target.files?.[0];
|
|
99
|
-
e.target.value = "";
|
|
100
|
-
if (!file)
|
|
101
|
-
return;
|
|
102
|
-
if (file.size > limit) {
|
|
103
|
-
setError(`Maximum file size: ${limit / 1024 / 1024} MiB`);
|
|
104
|
-
return;
|
|
105
|
-
}
|
|
106
|
-
setBusy(true);
|
|
107
|
-
setError("");
|
|
108
|
-
try {
|
|
109
|
-
const bytes = new Uint8Array(await file.arrayBuffer());
|
|
110
|
-
let binary = "";
|
|
111
|
-
for (let i = 0; i < bytes.length; i += 8192)
|
|
112
|
-
binary += String.fromCharCode(...bytes.subarray(i, i + 8192));
|
|
113
|
-
await fire(context, { name: file.name, content: btoa(binary), encoding: "base64" });
|
|
114
|
-
}
|
|
115
|
-
catch (e) {
|
|
116
|
-
setError(e.message);
|
|
117
|
-
}
|
|
118
|
-
finally {
|
|
119
|
-
setBusy(false);
|
|
120
|
-
}
|
|
121
|
-
} }), busy && _jsx("small", { children: "Uploading\u2026" }), error && _jsx("small", { role: "alert", children: error })] });
|
|
122
|
-
});
|
|
123
|
-
const X402Payment = createBinderlessComponentImplementation(api("X402Payment", { amount: dynamic, currency: dynamic, network: dynamic, payTo: dynamic, action: CommonSchemas.Action.optional() }), ({ context }) => {
|
|
124
|
-
const p = context.componentModel.properties;
|
|
125
|
-
const amount = useValue(context, p.amount);
|
|
126
|
-
const currency = useValue(context, p.currency);
|
|
127
|
-
const network = useValue(context, p.network);
|
|
128
|
-
const payTo = useValue(context, p.payTo);
|
|
129
|
-
const [busy, setBusy] = useState(false);
|
|
130
|
-
const [error, setError] = useState("");
|
|
131
|
-
return _jsxs("div", { style: box, children: [_jsxs("strong", { children: [amount, " ", currency] }), _jsxs("small", { children: ["Network: ", network] }), _jsxs("small", { style: { overflowWrap: "anywhere" }, children: ["To: ", payTo] }), _jsx("button", { style: button, disabled: busy, onClick: async () => {
|
|
132
|
-
if (busy)
|
|
133
|
-
return;
|
|
134
|
-
setBusy(true);
|
|
135
|
-
setError("");
|
|
136
|
-
try {
|
|
137
|
-
await fire(context);
|
|
138
|
-
}
|
|
139
|
-
catch (e) {
|
|
140
|
-
setError(e.message);
|
|
141
|
-
}
|
|
142
|
-
finally {
|
|
143
|
-
setBusy(false);
|
|
144
|
-
}
|
|
145
|
-
}, children: busy ? "Confirm in your wallet…" : `Pay ${amount} ${currency}` }), error && _jsx("small", { role: "alert", children: error })] });
|
|
146
|
-
});
|
|
147
|
-
const FolderChat = createBinderlessComponentImplementation(api("FolderChat", { value: dynamic, action: CommonSchemas.Action.optional() }), ({ context }) => {
|
|
148
|
-
const state = useValue(context, context.componentModel.properties.value);
|
|
149
|
-
const [input, setInput] = useState("");
|
|
150
|
-
if (!state)
|
|
151
|
-
return null;
|
|
152
|
-
return _jsxs("section", { "aria-label": "Folder chat", style: box, children: [_jsxs("strong", { children: ["Folder chat \u00B7 ", state.path || "/"] }), _jsxs("label", { children: ["Agent ", _jsx("select", { "aria-label": "Chat agent", disabled: state.busy, value: state.agentId, onChange: e => void fire(context, { operation: "select", agentId: e.target.value }), children: state.agents.map(a => _jsx("option", { value: a.id, children: a.label }, a.id)) })] }), _jsx("div", { role: "log", "aria-live": "polite", style: { maxHeight: 400, overflowY: "auto" }, children: state.messages.map((m, i) => _jsxs("div", { role: m.role === "error" ? "alert" : undefined, style: { whiteSpace: "pre-wrap", overflowWrap: "anywhere", paddingBlock: 8 }, children: [_jsx("strong", { children: m.role === "user" ? "You" : m.role === "error" ? "Error" : state.agents.find(a => a.id === state.agentId)?.label || "Agent" }), _jsx("div", { children: m.text })] }, i)) }), _jsxs("form", { onSubmit: e => { e.preventDefault(); if (input.trim() && !state.busy) {
|
|
153
|
-
void fire(context, { operation: "send", q: input.trim(), agentId: state.agentId });
|
|
154
|
-
setInput("");
|
|
155
|
-
} }, style: box, children: [_jsx("textarea", { "aria-label": "Message", disabled: state.busy, value: input, onChange: e => setInput(e.target.value) }), state.busy ? _jsx("button", { type: "button", style: button, onClick: () => void fire(context, { operation: "cancel" }), children: "Stop" }) : _jsx("button", { style: button, disabled: !input.trim() || !state.agentId, children: "Send" })] })] });
|
|
156
|
-
});
|
|
157
|
-
// Preserve AIN-UI's confirmation extension on the basic Button.
|
|
158
|
-
const Button = createBinderlessComponentImplementation(api("Button", { child: CommonSchemas.ComponentId, action: CommonSchemas.Action.optional(), confirm: dynamic, variant: dynamic, tone: dynamic }), ({ context, buildChild }) => {
|
|
159
|
-
const p = context.componentModel.properties;
|
|
160
|
-
const confirm = useValue(context, p.confirm);
|
|
161
|
-
return _jsx("button", { style: button, onClick: () => { if (!confirm || window.confirm(confirm))
|
|
162
|
-
void fire(context); }, children: buildChild(String(p.child)) });
|
|
163
|
-
});
|
|
164
|
-
export const ainuiCatalog = new Catalog(AINUI_CATALOG, [...basicCatalog.components.values()].filter((c) => c.name !== "Button").concat([Button, Grid, Tile, FileView, Breadcrumbs, Segmented, FileUpload, X402Payment, FolderChat]), [...basicCatalog.functions.values()]);
|
|
165
|
-
export function AinuiSurface({ messages, onAction, resolveAsset, renderFile }) {
|
|
166
|
-
const handler = useRef(onAction);
|
|
167
|
-
handler.current = onAction;
|
|
168
|
-
const [processor, setProcessor] = useState(null);
|
|
169
|
-
const [error, setError] = useState("");
|
|
170
|
-
useEffect(() => {
|
|
171
|
-
const p = new MessageProcessor([ainuiCatalog, basicCatalog], (action) => handler.current(action));
|
|
172
|
-
try {
|
|
173
|
-
p.processMessages(messages);
|
|
174
|
-
setProcessor(p);
|
|
175
|
-
setError("");
|
|
176
|
-
}
|
|
177
|
-
catch (e) {
|
|
178
|
-
setProcessor(null);
|
|
179
|
-
setError(e.message);
|
|
180
|
-
}
|
|
181
|
-
return () => { for (const surface of p.model.surfacesMap.values())
|
|
182
|
-
surface.dispose(); };
|
|
183
|
-
}, [messages]);
|
|
184
|
-
if (error)
|
|
185
|
-
return _jsx("div", { className: "ain-ui", role: "alert", children: error });
|
|
186
|
-
if (!processor)
|
|
187
|
-
return _jsx("div", { className: "ain-ui", "aria-busy": "true" });
|
|
188
|
-
return _jsx(MarkdownContext.Provider, { value: renderMarkdown, children: _jsx(Assets.Provider, { value: resolveAsset ?? (() => ""), children: _jsx(FileRenderer.Provider, { value: renderFile, children: _jsx("div", { className: "ain-ui", children: Array.from(processor.model.surfacesMap.values()).map((surface) => _jsx(A2uiSurface, { surface: surface }, surface.id)) }) }) }) });
|
|
189
|
-
}
|
|
190
|
-
/** Scope changes unmount the old chat, abort its request and drop its context ids. */
|
|
191
|
-
export function AinuiFolderChat(props) {
|
|
192
|
-
return _jsx(FolderChatSession, { ...props }, `${props.driveId}:${props.path}`);
|
|
193
|
-
}
|
|
194
|
-
function FolderChatSession({ driveId, path, agents, onSend }) {
|
|
195
|
-
const [agentId, select] = useState(agents[0]?.id ?? "");
|
|
196
|
-
const [messages, setMessages] = useState([]);
|
|
197
|
-
const [busy, setBusy] = useState(false);
|
|
198
|
-
const pending = useRef(null);
|
|
199
|
-
const contexts = useRef(new Map());
|
|
200
|
-
useEffect(() => () => { pending.current?.abort(); pending.current = null; }, []);
|
|
201
|
-
const selected = agents.some(a => a.id === agentId) ? agentId : agents[0]?.id ?? "";
|
|
202
|
-
const surface = ainuiFolderChat({ driveId, path, agents, agentId: selected, messages, busy });
|
|
203
|
-
return _jsx(AinuiSurface, { messages: surface, onAction: async (action) => {
|
|
204
|
-
const c = action.context ?? {};
|
|
205
|
-
if (c.operation === "cancel") {
|
|
206
|
-
pending.current?.abort();
|
|
207
|
-
return;
|
|
208
|
-
}
|
|
209
|
-
if (c.operation === "select" && !pending.current) {
|
|
210
|
-
select(String(c.agentId));
|
|
211
|
-
setMessages([]);
|
|
212
|
-
return;
|
|
213
|
-
}
|
|
214
|
-
if (c.operation !== "send" || pending.current || typeof c.q !== "string" || !selected)
|
|
215
|
-
return;
|
|
216
|
-
const controller = new AbortController();
|
|
217
|
-
pending.current = controller;
|
|
218
|
-
setBusy(true);
|
|
219
|
-
setMessages(m => [...m.slice(-98), { role: "user", text: c.q }, { role: "agent", text: "" }]);
|
|
220
|
-
const onUpdate = (u) => {
|
|
221
|
-
if (pending.current !== controller || controller.signal.aborted)
|
|
222
|
-
return;
|
|
223
|
-
if (u.contextId)
|
|
224
|
-
contexts.current.set(selected, u.contextId);
|
|
225
|
-
setMessages(m => [...m.slice(0, -1), { role: "agent", text: u.text }]);
|
|
226
|
-
};
|
|
227
|
-
try {
|
|
228
|
-
onUpdate(await onSend({ q: c.q, agentId: selected, contextId: contexts.current.get(selected), signal: controller.signal, onUpdate }));
|
|
229
|
-
}
|
|
230
|
-
catch (e) {
|
|
231
|
-
if (pending.current === controller)
|
|
232
|
-
setMessages(m => [...m, { role: "error", text: controller.signal.aborted ? "Stopped" : e.message }]);
|
|
233
|
-
}
|
|
234
|
-
finally {
|
|
235
|
-
if (pending.current === controller) {
|
|
236
|
-
pending.current = null;
|
|
237
|
-
setBusy(false);
|
|
238
|
-
}
|
|
239
|
-
}
|
|
240
|
-
} });
|
|
241
|
-
}
|
|
2
|
+
export { AinuiSurface, AinuiFolderChat, ainuiCapabilities } from "./react/surface.js";
|
|
3
|
+
export { ainuiCatalog, standardComponents, missingStandardViews, AINUI_INSTRUCTIONS } from "./react/catalog.js";
|
|
4
|
+
export { STANDARD, HostContext, useHost, standard } from "./react/core.js";
|
package/dist/renderer.d.ts
CHANGED
|
@@ -31,4 +31,4 @@ export function createA2uiRenderer(container: HTMLElement, { onAction, resolveAs
|
|
|
31
31
|
replace: (messages: any) => void;
|
|
32
32
|
surfaces: Map<any, any>;
|
|
33
33
|
};
|
|
34
|
-
export const A2UI_RENDERER_CSS: "\n.a2ui-surface{font:14px/1.5 system-ui,-apple-system,\"Segoe UI\",sans-serif;color:#0f1319}\n.a2ui-column,.a2ui-row,.a2ui-list{display:flex;gap:8px}\n.a2ui-list{gap:2px}\n.a2ui-card{border:1px solid #dce3ec;border-radius:12px;padding:12px;background:#fff;overflow:auto;max-height:480px}\n.a2ui-text p,.a2ui-text ul,.a2ui-text ol{margin:0 0 6px}.a2ui-text ul{list-style:disc;padding-left:20px}.a2ui-text ol{list-style:decimal;padding-left:20px}.a2ui-text h1,.a2ui-text h2,.a2ui-text h3{margin:4px 0}\n.a2ui-text-h1{font-size:24px;font-weight:600}.a2ui-text-h2{font-size:20px;font-weight:600}.a2ui-text-h3{font-size:16px;font-weight:600}\n.a2ui-text-caption{font-size:12px;color:#54607a}.a2ui-text-caption p{margin:0}\n.a2ui-text pre{background:#f2f5f9;padding:8px;border-radius:8px;overflow:auto;white-space:pre-wrap;word-break:break-word}\n.a2ui-button{font:inherit;border:1px solid #dce3ec;background:#fff;border-radius:999px;padding:4px 12px;cursor:pointer}\n.a2ui-button:hover{background:#eaeef4}\n.a2ui-button-primary{background:#0b57d0;border-color:#0b57d0;color:#fff}.a2ui-button-primary:hover{background:#0842a0}\n.a2ui-button-borderless{border:0;background:none;padding:2px 4px;text-align:left}.a2ui-button-borderless:hover{background:#eaeef4}\n.a2ui-button .a2ui-text p{margin:0}\n.a2ui-textfield{display:flex;flex-direction:column;flex:1}.a2ui-textfield span{display:none}\n.a2ui-textfield input{font:inherit;border:1px solid #dce3ec;border-radius:999px;padding:4px 12px;min-width:120px}\n.a2ui-image{max-width:100%;max-height:420px;object-fit:contain}\n.a2ui-divider{border-top:1px solid #dce3ec;margin:4px 0}\n.a2ui-row .a2ui-text-caption{white-space:nowrap}\n.a2ui-button-danger{color:#b3261e;border-color:#f2b8b5}.a2ui-button-danger.a2ui-button-primary,.a2ui-confirm .a2ui-button-danger{background:#b3261e;border-color:#b3261e;color:#fff}\n.a2ui-confirm{display:inline-flex;flex-wrap:wrap;align-items:center;gap:6px}\n.a2ui-text-mono{font-family:ui-monospace,SFMono-Regular,Menlo,monospace;font-size:13px}\n.a2ui-textfield-long{min-width:0}.a2ui-textfield-long textarea{font:13px/1.5 ui-monospace,SFMono-Regular,Menlo,monospace;border:1px solid #dce3ec;border-radius:12px;padding:8px 12px;resize:vertical;min-height:240px;width:100%;box-sizing:border-box}\n.a2ui-row{flex-wrap:wrap}\n.a2ui-grid{display:grid}\n.a2ui-tile-wrap{min-width:0}\n.a2ui-tile{display:flex;flex-direction:column;gap:4px;width:100%;font:inherit;color:inherit;text-align:left;border:0;background:none;padding:4px;border-radius:12px;cursor:pointer}\n.a2ui-tile:hover,.a2ui-tile:focus-visible{background:#eaeef4}\n.a2ui-tile-media{display:flex;align-items:center;justify-content:center;aspect-ratio:1;width:100%;border-radius:10px;overflow:hidden;background:#f2f5f9}\n.a2ui-tile-media img{width:100%;height:100%;object-fit:cover}\n.a2ui-tile-media .a2ui-kind-icon{font-size:40px}\n.a2ui-tile-label{font-size:13px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}\n.a2ui-tile-caption{font-size:12px;color:#54607a;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}\n.a2ui-fileview{display:flex;flex-direction:column;gap:8px}\n.a2ui-fileview-img,.a2ui-fileview-video{max-width:100%;max-height:70vh;object-fit:contain;border-radius:10px;background:#f2f5f9}\n.a2ui-fileview-audio{width:100%}\n.a2ui-fileview-icon{display:flex;align-items:center;justify-content:center;height:160px;border-radius:10px;background:#f2f5f9;font-size:56px}\n.a2ui-fileview-info{display:flex;gap:8px;align-items:baseline;flex-wrap:wrap}.a2ui-fileview-name{font-weight:600;word-break:break-all}\n.a2ui-fileview-download{display:inline-flex;align-items:center;min-height:36px;box-sizing:border-box;margin-left:auto;color:inherit;text-decoration:none}\n.a2ui-breadcrumbs{display:flex;flex-wrap:wrap;align-items:center;gap:2px;font-size:13px}\n.a2ui-crumb{display:inline-flex;align-items:center;font:inherit;color:#0b57d0;border:0;background:none;padding:0 6px;border-radius:8px;cursor:pointer;min-height:36px;box-sizing:border-box}\n.a2ui-crumb:hover{background:#eaeef4}.a2ui-crumb-current{color:inherit;font-weight:600;cursor:default}\n.a2ui-crumb-sep{color:#54607a}\n.a2ui-segmented{display:inline-flex;border:1px solid #dce3ec;border-radius:999px;overflow:hidden}\n.a2ui-segment{font:inherit;border:0;background:#fff;color:inherit;padding:4px 14px;cursor:pointer;min-height:36px}\n.a2ui-segment[aria-pressed=true]{background:#0b57d0;color:#fff}\n@media (prefers-color-scheme:dark){.a2ui-surface{color:#e6e9ef}.a2ui-card,.a2ui-button,.a2ui-textfield input,.a2ui-textfield textarea,.a2ui-segment{background:#1b1f27;border-color:#343b48;color:inherit}.a2ui-segmented{border-color:#343b48}.a2ui-segment[aria-pressed=true]{background:#0b57d0;color:#fff}.a2ui-button:hover,.a2ui-button-borderless:hover,.a2ui-tile:hover,.a2ui-crumb:hover{background:#262c36}.a2ui-text pre,.a2ui-tile-media,.a2ui-fileview-icon,.a2ui-fileview-img,.a2ui-fileview-video{background:#262c36}.a2ui-text-caption,.a2ui-tile-caption,.a2ui-crumb-sep{color:#9aa4b8}.a2ui-crumb{color:#a8c7fa}.a2ui-button-danger{color:#f2b8b5;border-color:#8c1d18}}\n";
|
|
34
|
+
export const A2UI_RENDERER_CSS: "\n.a2ui-surface{font:14px/1.5 system-ui,-apple-system,\"Segoe UI\",sans-serif;color:#0f1319}\n.a2ui-column,.a2ui-row,.a2ui-list{display:flex;gap:8px}\n.a2ui-list{gap:2px}\n.a2ui-card{border:1px solid #dce3ec;border-radius:12px;padding:12px;background:#fff;overflow:auto;max-height:480px}\n.a2ui-text p,.a2ui-text ul,.a2ui-text ol{margin:0 0 6px}.a2ui-text ul{list-style:disc;padding-left:20px}.a2ui-text ol{list-style:decimal;padding-left:20px}.a2ui-text h1,.a2ui-text h2,.a2ui-text h3{margin:4px 0}\n.a2ui-text-h1{font-size:24px;font-weight:600}.a2ui-text-h2{font-size:20px;font-weight:600}.a2ui-text-h3{font-size:16px;font-weight:600}\n.a2ui-text-caption{font-size:12px;color:#54607a}.a2ui-text-caption p{margin:0}\n.a2ui-text pre{background:#f2f5f9;padding:8px;border-radius:8px;overflow:auto;white-space:pre-wrap;word-break:break-word}\n.a2ui-button{font:inherit;border:1px solid #dce3ec;background:#fff;border-radius:999px;padding:4px 12px;cursor:pointer}\n.a2ui-button:hover{background:#eaeef4}\n.a2ui-button-primary{background:#0b57d0;border-color:#0b57d0;color:#fff}.a2ui-button-primary:hover{background:#0842a0}\n.a2ui-button-borderless{border:0;background:none;padding:2px 4px;text-align:left}.a2ui-button-borderless:hover{background:#eaeef4}\n.a2ui-button .a2ui-text p{margin:0}\n.a2ui-textfield{display:flex;flex-direction:column;flex:1}.a2ui-textfield span{display:none}\n.a2ui-textfield input{font:inherit;border:1px solid #dce3ec;border-radius:999px;padding:4px 12px;min-width:120px}\n.a2ui-image{max-width:100%;max-height:420px;object-fit:contain}\n.a2ui-divider{border-top:1px solid #dce3ec;margin:4px 0}\n.a2ui-row .a2ui-text-caption{white-space:nowrap}\n.a2ui-button-danger{color:#b3261e;border-color:#f2b8b5}.a2ui-button-danger.a2ui-button-primary,.a2ui-confirm .a2ui-button-danger{background:#b3261e;border-color:#b3261e;color:#fff}\n.a2ui-confirm{display:inline-flex;flex-wrap:wrap;align-items:center;gap:6px}\n.a2ui-text-mono{font-family:ui-monospace,SFMono-Regular,Menlo,monospace;font-size:13px}\n.a2ui-textfield-long{min-width:0}.a2ui-textfield-long textarea{font:13px/1.5 ui-monospace,SFMono-Regular,Menlo,monospace;border:1px solid #dce3ec;border-radius:12px;padding:8px 12px;resize:vertical;min-height:240px;width:100%;box-sizing:border-box}\n.a2ui-row{flex-wrap:wrap}\n.a2ui-grid{display:grid}\n.a2ui-tile-wrap{min-width:0}\n.a2ui-tile{display:flex;flex-direction:column;gap:4px;width:100%;font:inherit;color:inherit;text-align:left;border:0;background:none;padding:4px;border-radius:12px;cursor:pointer}\n.a2ui-tile:hover,.a2ui-tile:focus-visible{background:#eaeef4}\n.a2ui-tile-media{display:flex;align-items:center;justify-content:center;aspect-ratio:1;width:100%;border-radius:10px;overflow:hidden;background:#f2f5f9}\n.a2ui-tile-media img{width:100%;height:100%;object-fit:cover}\n.a2ui-tile-media .a2ui-kind-icon{font-size:40px}\n.a2ui-tile-label{font-size:13px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}\n.a2ui-tile-caption{font-size:12px;color:#54607a;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}\n.a2ui-fileview{display:flex;flex-direction:column;gap:8px}\n.a2ui-fileview-img,.a2ui-fileview-video{max-width:100%;max-height:70vh;object-fit:contain;border-radius:10px;background:#f2f5f9}\n.a2ui-fileview-audio{width:100%}\n.a2ui-fileview-icon{display:flex;align-items:center;justify-content:center;height:160px;border-radius:10px;background:#f2f5f9;font-size:56px}\n.a2ui-fileview-info{display:flex;gap:8px;align-items:baseline;flex-wrap:wrap}.a2ui-fileview-name{font-weight:600;word-break:break-all}\n.a2ui-fileview-download{display:inline-flex;align-items:center;min-height:36px;box-sizing:border-box;margin-left:auto;color:inherit;text-decoration:none}\n.a2ui-breadcrumbs{display:flex;flex-wrap:wrap;align-items:center;gap:2px;font-size:13px}\n.a2ui-crumb{display:inline-flex;align-items:center;font:inherit;color:#0b57d0;border:0;background:none;padding:0 6px;border-radius:8px;cursor:pointer;min-height:36px;box-sizing:border-box}\n.a2ui-crumb:hover{background:#eaeef4}.a2ui-crumb-current{color:inherit;font-weight:600;cursor:default}\n.a2ui-crumb-sep{color:#54607a}\n.a2ui-segmented{display:inline-flex;border:1px solid #dce3ec;border-radius:999px;overflow:hidden}\n.a2ui-segment{font:inherit;border:0;background:#fff;color:inherit;padding:4px 14px;cursor:pointer;min-height:36px}\n.a2ui-segment[aria-pressed=true]{background:#0b57d0;color:#fff}\n.ainui-picker{display:flex;flex-direction:column;gap:10px;min-width:0}\n.ainui-picker-scopes{display:flex;flex-wrap:wrap;gap:4px;padding:3px;border:1px solid #dce3ec;border-radius:10px;background:#f2f5f9}\n.ainui-picker-scope{font:inherit;border:0;border-radius:7px;background:transparent;color:#54607a;padding:6px 12px;min-height:36px;cursor:pointer}\n.ainui-picker-scope[aria-selected=true]{background:#fff;color:inherit;box-shadow:0 1px 3px #00000014}\n.ainui-picker-search{display:flex;gap:6px}.ainui-picker-search input{flex:1;min-width:0;font:inherit;border:1px solid #dce3ec;border-radius:999px;padding:6px 12px}\n.ainui-picker-asof{display:flex;flex-wrap:wrap;gap:8px;align-items:center;font-size:12px;color:#54607a}\n.ainui-picker-list{list-style:none;margin:0;padding:0;display:flex;flex-direction:column;gap:2px}\n.ainui-picker-row{display:flex;align-items:center;gap:10px;padding:8px;border-radius:10px}\n.ainui-picker-row:hover{background:#eaeef4}.ainui-picker-row-selected{background:#e3ecfb}\n.ainui-picker-row-unavailable .ainui-picker-main{opacity:.55}\n.ainui-picker-icon{font-size:22px}.ainui-picker-main{display:flex;flex:1;flex-direction:column;gap:3px;min-width:0}\n.ainui-picker-name{font-weight:600;overflow-wrap:anywhere}.ainui-picker-description{font-size:13px;color:#54607a}\n.ainui-picker-meta{display:flex;flex-wrap:wrap;gap:4px}\n.ainui-picker-badge{font-size:11px;line-height:18px;padding:0 7px;border-radius:999px;background:#eaeef4;color:inherit}\n.ainui-picker-badge-muted{background:transparent;border:1px solid #dce3ec;color:#54607a}.ainui-picker-badge-warn{background:#fff3cd;color:#7a4b00}.ainui-picker-badge-danger{background:#fde7e6;color:#8c1d18}\n.ainui-picker-capabilities{display:flex;flex-wrap:wrap;gap:8px;font-size:12px;color:#54607a}.ainui-picker-fallbacks{color:#7a4b00}\n.ainui-picker-reason{font-size:12px;color:#8c1d18;opacity:1}\n.ainui-picker-actions{display:flex;flex-direction:column;gap:4px;flex:0 0 auto}\n.ainui-picker-footer{display:flex;flex-wrap:wrap;gap:8px;justify-content:space-between}.ainui-picker-footer:empty{display:none}\n.ainui-picker-empty{margin:0;color:#54607a}\n@media (max-width:600px){.ainui-picker-row{flex-wrap:wrap}.ainui-picker-actions{flex-direction:row;width:100%;justify-content:flex-end}}\n@media (prefers-color-scheme:dark){.ainui-picker-scopes{background:#1b1f27;border-color:#343b48}.ainui-picker-scope[aria-selected=true]{background:#262c36}.ainui-picker-search input{background:#1b1f27;border-color:#343b48;color:inherit}.ainui-picker-row:hover{background:#262c36}.ainui-picker-row-selected{background:#1e2a44}.ainui-picker-badge{background:#262c36}.ainui-picker-badge-muted{border-color:#343b48;color:#9aa4b8}.ainui-picker-badge-warn{background:#4a3200;color:#ffd77a}.ainui-picker-badge-danger{background:#4a1512;color:#f2b8b5}.ainui-picker-reason{color:#f2b8b5}.ainui-picker-fallbacks{color:#ffd77a}}\n@media (prefers-color-scheme:dark){.a2ui-surface{color:#e6e9ef}.a2ui-card,.a2ui-button,.a2ui-textfield input,.a2ui-textfield textarea,.a2ui-segment{background:#1b1f27;border-color:#343b48;color:inherit}.a2ui-segmented{border-color:#343b48}.a2ui-segment[aria-pressed=true]{background:#0b57d0;color:#fff}.a2ui-button:hover,.a2ui-button-borderless:hover,.a2ui-tile:hover,.a2ui-crumb:hover{background:#262c36}.a2ui-text pre,.a2ui-tile-media,.a2ui-fileview-icon,.a2ui-fileview-img,.a2ui-fileview-video{background:#262c36}.a2ui-text-caption,.a2ui-tile-caption,.a2ui-crumb-sep{color:#9aa4b8}.a2ui-crumb{color:#a8c7fa}.a2ui-button-danger{color:#f2b8b5;border-color:#8c1d18}}\n";
|