@superxd-studio/adptr 0.5.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/GENERATIVE.md +101 -0
- package/INTERACTIONS.md +51 -0
- package/LICENSE +21 -0
- package/README.md +57 -0
- package/REUSE.md +170 -0
- package/REVIEW.md +68 -0
- package/THIRD-PARTY-NOTICES.md +28 -0
- package/ai-sdk/index.js +96 -0
- package/assets/ibm-plex-mono-cyrillic-400-normal.woff2 +0 -0
- package/assets/ibm-plex-mono-cyrillic-500-normal.woff2 +0 -0
- package/assets/ibm-plex-mono-cyrillic-ext-400-normal.woff2 +0 -0
- package/assets/ibm-plex-mono-cyrillic-ext-500-normal.woff2 +0 -0
- package/assets/ibm-plex-mono-latin-400-normal.woff2 +0 -0
- package/assets/ibm-plex-mono-latin-500-normal.woff2 +0 -0
- package/assets/ibm-plex-mono-latin-ext-400-normal.woff2 +0 -0
- package/assets/ibm-plex-mono-latin-ext-500-normal.woff2 +0 -0
- package/assets/ibm-plex-mono-vietnamese-400-normal.woff2 +0 -0
- package/assets/ibm-plex-mono-vietnamese-500-normal.woff2 +0 -0
- package/assets/instrument-sans-latin-ext-wght-normal.woff2 +0 -0
- package/assets/instrument-sans-latin-wght-normal.woff2 +0 -0
- package/assistant-ui/index.js +139 -0
- package/chunks/callout-DKMHSnjc.js +342 -0
- package/chunks/canvas-BJ15-XxE.js +598 -0
- package/chunks/controller-Cfpg0C7v.js +180 -0
- package/chunks/core-BCqVRLUy.js +312 -0
- package/chunks/text-field-BLtoaZFn.js +41 -0
- package/chunks/types-BGF7r1my.js +115 -0
- package/chunks/ui-9DyNsYXY.js +967 -0
- package/core/index.js +4 -0
- package/custom/index.js +64 -0
- package/examples/ai-sdk-backend/package.json +11 -0
- package/examples/ai-sdk-backend/server.mjs +316 -0
- package/examples/custom-backend/copy.mjs +7 -0
- package/examples/custom-backend/server.mjs +118 -0
- package/examples/generative/specs.json +2094 -0
- package/examples/review-backend/copy.mjs +27 -0
- package/examples/review-backend/package.json +11 -0
- package/examples/review-backend/server.mjs +276 -0
- package/examples/web-ai-sdk/index.html +12 -0
- package/examples/web-ai-sdk/package.json +21 -0
- package/examples/web-ai-sdk/src/copy.ts +1 -0
- package/examples/web-ai-sdk/src/main.tsx +64 -0
- package/examples/web-ai-sdk/tsconfig.json +13 -0
- package/examples/web-generative/index.html +12 -0
- package/examples/web-generative/package.json +23 -0
- package/examples/web-generative/src/copy.ts +42 -0
- package/examples/web-generative/src/main.tsx +74 -0
- package/examples/web-generative/tsconfig.json +14 -0
- package/examples/web-independent/index.html +12 -0
- package/examples/web-independent/package.json +20 -0
- package/examples/web-independent/src/main.tsx +32 -0
- package/examples/web-independent/tsconfig.json +14 -0
- package/examples/web-interactions/index.html +12 -0
- package/examples/web-interactions/package.json +21 -0
- package/examples/web-interactions/src/copy.ts +215 -0
- package/examples/web-interactions/src/examples.tsx +628 -0
- package/examples/web-interactions/src/main.tsx +116 -0
- package/examples/web-interactions/tsconfig.json +14 -0
- package/examples/web-review/index.html +12 -0
- package/examples/web-review/package.json +20 -0
- package/examples/web-review/src/main.tsx +59 -0
- package/examples/web-review/tsconfig.json +14 -0
- package/fonts.css +117 -0
- package/generative/index.js +1560 -0
- package/interactions/index.js +1591 -0
- package/langgraph-review/index.js +36 -0
- package/licenses/ai-sdk.txt +13 -0
- package/licenses/assistant-ui-generative.txt +21 -0
- package/licenses/assistant-ui.txt +23 -0
- package/licenses/ibm-plex-mono.txt +93 -0
- package/licenses/instrument-sans.txt +93 -0
- package/licenses/internationalized-date.txt +201 -0
- package/licenses/langgraph.txt +21 -0
- package/licenses/lucide.txt +43 -0
- package/licenses/react-markdown.txt +21 -0
- package/licenses/remark-gfm.txt +22 -0
- package/licenses/zod.txt +21 -0
- package/package.json +138 -0
- package/review/index.js +31 -0
- package/source/components/avatar.tsx +50 -0
- package/source/components/button.tsx +155 -0
- package/source/components/callout.tsx +65 -0
- package/source/components/canvas/connector.tsx +14 -0
- package/source/components/canvas/copy.ts +34 -0
- package/source/components/canvas/index.tsx +257 -0
- package/source/components/canvas/recorder.ts +36 -0
- package/source/components/date-time-field.tsx +77 -0
- package/source/components/flow-motion.tsx +109 -0
- package/source/components/icons.tsx +275 -0
- package/source/components/responsive-overlay.tsx +91 -0
- package/source/components/scenario-picker/copy.ts +5 -0
- package/source/components/scenario-picker/index.tsx +142 -0
- package/source/components/scroll-area.tsx +59 -0
- package/source/components/search-picker.tsx +127 -0
- package/source/components/segmented-control.tsx +123 -0
- package/source/components/skeleton.tsx +11 -0
- package/source/components/spinner.tsx +19 -0
- package/source/components/superxd-arrow.tsx +22 -0
- package/source/components/switch.tsx +45 -0
- package/source/components/text-field.tsx +81 -0
- package/source/components/thinking.tsx +16 -0
- package/source/components/ui/copy.ts +12 -0
- package/source/components/ui/display.tsx +276 -0
- package/source/components/ui/navigation.tsx +346 -0
- package/source/components/ui/portal-theme.tsx +28 -0
- package/source/components/ui/selection.tsx +336 -0
- package/source/lib/cn.ts +23 -0
- package/source/reusable/ai-sdk/index.ts +114 -0
- package/source/reusable/assistant-ui/index.tsx +266 -0
- package/source/reusable/core/attachments.ts +163 -0
- package/source/reusable/core/index.ts +417 -0
- package/source/reusable/custom/index.ts +90 -0
- package/source/reusable/generative/actions.ts +188 -0
- package/source/reusable/generative/copy.ts +47 -0
- package/source/reusable/generative/data.tsx +126 -0
- package/source/reusable/generative/index.tsx +517 -0
- package/source/reusable/generative/schema.ts +327 -0
- package/source/reusable/generative/timeline.tsx +214 -0
- package/source/reusable/generative/vocabulary.tsx +847 -0
- package/source/reusable/interactions/agent.ts +259 -0
- package/source/reusable/interactions/artifact.ts +236 -0
- package/source/reusable/interactions/context.tsx +38 -0
- package/source/reusable/interactions/copy.ts +117 -0
- package/source/reusable/interactions/feedback.ts +73 -0
- package/source/reusable/interactions/index.ts +11 -0
- package/source/reusable/interactions/presentation.tsx +483 -0
- package/source/reusable/interactions/store.ts +74 -0
- package/source/reusable/interactions/threads.ts +126 -0
- package/source/reusable/interactions/web.tsx +574 -0
- package/source/reusable/langgraph-review/index.ts +73 -0
- package/source/reusable/review/controller.ts +263 -0
- package/source/reusable/review/index.ts +47 -0
- package/source/reusable/review/types.ts +189 -0
- package/source/reusable/ui/index.ts +25 -0
- package/source/reusable/uploads/index.ts +48 -0
- package/source/reusable/web/attachments/copy.ts +23 -0
- package/source/reusable/web/attachments/index.tsx +233 -0
- package/source/reusable/web/copy.ts +22 -0
- package/source/reusable/web/index.tsx +470 -0
- package/source/reusable/web/message/copy.ts +26 -0
- package/source/reusable/web/message/index.tsx +388 -0
- package/source/reusable/web/message/streaming.ts +64 -0
- package/source/reusable/web/message/styles.css +21 -0
- package/source/reusable/web/review/copy.ts +78 -0
- package/source/reusable/web/review/flow.ts +24 -0
- package/source/reusable/web/review/index.tsx +506 -0
- package/source/reusable/web/styles.ts +2 -0
- package/source/styles/library.css +612 -0
- package/source/styles/theme.css +228 -0
- package/styles.css +3 -0
- package/styles.d.ts +1 -0
- package/types/components/avatar.d.ts +14 -0
- package/types/components/button.d.ts +36 -0
- package/types/components/callout.d.ts +19 -0
- package/types/components/canvas/connector.d.ts +2 -0
- package/types/components/canvas/copy.d.ts +34 -0
- package/types/components/canvas/index.d.ts +33 -0
- package/types/components/canvas/recorder.d.ts +10 -0
- package/types/components/date-time-field.d.ts +11 -0
- package/types/components/flow-motion.d.ts +38 -0
- package/types/components/icons.d.ts +138 -0
- package/types/components/responsive-overlay.d.ts +15 -0
- package/types/components/scenario-picker/copy.d.ts +5 -0
- package/types/components/scenario-picker/index.d.ts +14 -0
- package/types/components/scroll-area.d.ts +14 -0
- package/types/components/search-picker.d.ts +27 -0
- package/types/components/segmented-control.d.ts +23 -0
- package/types/components/skeleton.d.ts +4 -0
- package/types/components/spinner.d.ts +4 -0
- package/types/components/superxd-arrow.d.ts +5 -0
- package/types/components/switch.d.ts +8 -0
- package/types/components/text-field.d.ts +19 -0
- package/types/components/thinking.d.ts +8 -0
- package/types/components/ui/copy.d.ts +12 -0
- package/types/components/ui/display.d.ts +50 -0
- package/types/components/ui/navigation.d.ts +63 -0
- package/types/components/ui/portal-theme.d.ts +8 -0
- package/types/components/ui/selection.d.ts +37 -0
- package/types/lib/cn.d.ts +3 -0
- package/types/reusable/ai-sdk/index.d.ts +15 -0
- package/types/reusable/assistant-ui/index.d.ts +12 -0
- package/types/reusable/core/attachments.d.ts +54 -0
- package/types/reusable/core/index.d.ts +107 -0
- package/types/reusable/custom/index.d.ts +14 -0
- package/types/reusable/generative/actions.d.ts +45 -0
- package/types/reusable/generative/copy.d.ts +48 -0
- package/types/reusable/generative/data.d.ts +4 -0
- package/types/reusable/generative/index.d.ts +30 -0
- package/types/reusable/generative/schema.d.ts +303 -0
- package/types/reusable/generative/timeline.d.ts +21 -0
- package/types/reusable/generative/vocabulary.d.ts +34 -0
- package/types/reusable/interactions/agent.d.ts +98 -0
- package/types/reusable/interactions/artifact.d.ts +118 -0
- package/types/reusable/interactions/context.d.ts +130 -0
- package/types/reusable/interactions/copy.d.ts +115 -0
- package/types/reusable/interactions/feedback.d.ts +34 -0
- package/types/reusable/interactions/index.d.ts +10 -0
- package/types/reusable/interactions/presentation.d.ts +97 -0
- package/types/reusable/interactions/store.d.ts +29 -0
- package/types/reusable/interactions/threads.d.ts +38 -0
- package/types/reusable/interactions/web.d.ts +22 -0
- package/types/reusable/langgraph-review/index.d.ts +5 -0
- package/types/reusable/review/controller.d.ts +52 -0
- package/types/reusable/review/index.d.ts +12 -0
- package/types/reusable/review/types.d.ts +61 -0
- package/types/reusable/ui/index.d.ts +19 -0
- package/types/reusable/uploads/index.d.ts +11 -0
- package/types/reusable/web/attachments/copy.d.ts +25 -0
- package/types/reusable/web/attachments/index.d.ts +24 -0
- package/types/reusable/web/copy.d.ts +24 -0
- package/types/reusable/web/index.d.ts +41 -0
- package/types/reusable/web/message/copy.d.ts +27 -0
- package/types/reusable/web/message/index.d.ts +56 -0
- package/types/reusable/web/message/streaming.d.ts +27 -0
- package/types/reusable/web/review/copy.d.ts +72 -0
- package/types/reusable/web/review/flow.d.ts +3 -0
- package/types/reusable/web/review/index.d.ts +38 -0
- package/types/reusable/web/styles.d.ts +2 -0
- package/ui/index.js +4 -0
- package/uploads/index.js +34 -0
- package/web/index.js +931 -0
|
@@ -0,0 +1,1560 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { C as e, D as t, E as n, O as r, T as i, b as a, d as o, h as s, l as c, n as l, o as u, p as d, t as f, u as p, y as m } from "../chunks/callout-DKMHSnjc.js";
|
|
3
|
+
import { a as h, i as g, n as _, o as v, p as y, s as b, t as ee } from "../chunks/canvas-BJ15-XxE.js";
|
|
4
|
+
import { t as x } from "../chunks/text-field-BLtoaZFn.js";
|
|
5
|
+
import { createContext as S, useCallback as C, useContext as w, useEffect as T, useId as te, useLayoutEffect as E, useMemo as ne, useRef as D, useState as O, useSyncExternalStore as re } from "react";
|
|
6
|
+
import { Checkbox as ie, DateField as ae, DateInput as k, DateSegment as A, FieldError as j, I18nProvider as M, Label as N, ListBox as oe, ListBoxItem as P, Popover as F, ProgressBar as se, Radio as ce, RadioGroup as le, Select as ue, SelectValue as de } from "react-aria-components";
|
|
7
|
+
import { Fragment as I, jsx as L, jsxs as R } from "react/jsx-runtime";
|
|
8
|
+
import { defaultGenerativeUILibrary as fe, renderGenerativeUI as pe } from "@assistant-ui/react-generative-ui";
|
|
9
|
+
import { z } from "zod";
|
|
10
|
+
import { parseDate as B } from "@internationalized/date";
|
|
11
|
+
//#region src/reusable/generative/copy.ts
|
|
12
|
+
var V = {
|
|
13
|
+
stepReady: "Ready",
|
|
14
|
+
stepLoading: "Loading",
|
|
15
|
+
stepReview: "Review",
|
|
16
|
+
stepFailed: "Not applied",
|
|
17
|
+
stepUncertain: "Unconfirmed",
|
|
18
|
+
stepResult: "Result",
|
|
19
|
+
stepPast: "Previous state",
|
|
20
|
+
loading: "Preparing your response",
|
|
21
|
+
streaming: "The response is arriving. Actions will be available when it’s complete.",
|
|
22
|
+
empty: "There’s nothing to show yet.",
|
|
23
|
+
invalid: "We couldn’t display this response.",
|
|
24
|
+
invalidNote: "Your work is still here. Try requesting the response again.",
|
|
25
|
+
retry: "Try again",
|
|
26
|
+
back: "Back",
|
|
27
|
+
confirm: "Confirm action",
|
|
28
|
+
working: "Applying",
|
|
29
|
+
checking: "Checking",
|
|
30
|
+
review: "Review before continuing",
|
|
31
|
+
input: "Your details",
|
|
32
|
+
noHandler: "This action isn’t available here.",
|
|
33
|
+
failed: "The action wasn’t applied.",
|
|
34
|
+
failedNote: "Your details are saved here. You can try again.",
|
|
35
|
+
uncertain: "We haven’t received confirmation.",
|
|
36
|
+
uncertainNote: "Check the result before trying again. Your details are kept here.",
|
|
37
|
+
check: "Check status",
|
|
38
|
+
noReceipt: "There’s no confirmation yet. Check again or retry this same request.",
|
|
39
|
+
complete: "Action complete",
|
|
40
|
+
dismissed: "Dismissed",
|
|
41
|
+
fieldRequired: "Enter a value to continue.",
|
|
42
|
+
email: "Enter an email address like name@company.com.",
|
|
43
|
+
date: "Enter a valid date.",
|
|
44
|
+
imageMissing: "Image unavailable",
|
|
45
|
+
data: "View data",
|
|
46
|
+
point: "Point",
|
|
47
|
+
series: "Value",
|
|
48
|
+
mediaSelected: "Track selected",
|
|
49
|
+
quoted: "Quoted amount",
|
|
50
|
+
validation: "Check the highlighted fields.",
|
|
51
|
+
updated: "A new response is available. Finish or dismiss this action before opening it.",
|
|
52
|
+
next: "Open new response",
|
|
53
|
+
quoteUnavailable: "We couldn’t confirm the amount. Try again before continuing.",
|
|
54
|
+
actionInvalid: "We couldn’t prepare this action.",
|
|
55
|
+
actionInvalidNote: "Your details are still here. Check the entries, shorten long text and try again."
|
|
56
|
+
}, H = z.string().max(8e3), U = z.string().min(1).max(160), W = H.optional(), me = z.array(z.strictObject({
|
|
57
|
+
label: U,
|
|
58
|
+
value: U
|
|
59
|
+
})).min(1).max(50).refine((e) => new Set(e.map((e) => e.value)).size === e.length), G = z.string().regex(/^[a-zA-Z][a-zA-Z0-9_]{0,63}$/), K = z.record(z.string(), z.json()).and(z.object({ type: G })), he = z.strictObject({
|
|
60
|
+
label: U,
|
|
61
|
+
$action: K.optional()
|
|
62
|
+
}), ge = {
|
|
63
|
+
gap: z.number().int().min(0).max(8).optional(),
|
|
64
|
+
align: z.enum([
|
|
65
|
+
"start",
|
|
66
|
+
"center",
|
|
67
|
+
"end"
|
|
68
|
+
]).optional()
|
|
69
|
+
}, q = {
|
|
70
|
+
name: G,
|
|
71
|
+
label: U,
|
|
72
|
+
defaultValue: W,
|
|
73
|
+
required: z.boolean().optional()
|
|
74
|
+
}, _e = z.strictObject({
|
|
75
|
+
label: U,
|
|
76
|
+
value: z.number().finite().min(-0xe8d4a51000).max(0xe8d4a51000)
|
|
77
|
+
}), ve = z.strictObject({
|
|
78
|
+
label: U,
|
|
79
|
+
variant: z.enum([
|
|
80
|
+
"bar",
|
|
81
|
+
"line",
|
|
82
|
+
"area",
|
|
83
|
+
"sparkline"
|
|
84
|
+
]),
|
|
85
|
+
data: z.array(_e).max(100).optional(),
|
|
86
|
+
series: z.array(z.strictObject({
|
|
87
|
+
label: U,
|
|
88
|
+
data: z.array(_e).max(100)
|
|
89
|
+
})).max(5).optional(),
|
|
90
|
+
stacked: z.boolean().optional(),
|
|
91
|
+
showAxis: z.boolean().optional(),
|
|
92
|
+
showLegend: z.boolean().optional()
|
|
93
|
+
}).superRefine((e, t) => {
|
|
94
|
+
let n = e.series;
|
|
95
|
+
if (n?.length) {
|
|
96
|
+
let e = n[0]?.data.map((e) => e.label).join("\0");
|
|
97
|
+
n.some((t) => t.data.map((e) => e.label).join("\0") !== e) && t.addIssue({
|
|
98
|
+
code: "custom",
|
|
99
|
+
message: "Series labels must align"
|
|
100
|
+
});
|
|
101
|
+
}
|
|
102
|
+
}), ye = z.strictObject({
|
|
103
|
+
label: U,
|
|
104
|
+
columns: z.array(z.strictObject({
|
|
105
|
+
label: U,
|
|
106
|
+
align: z.enum(["start", "end"]).optional()
|
|
107
|
+
})).min(1).max(12),
|
|
108
|
+
rows: z.array(z.array(z.union([
|
|
109
|
+
H,
|
|
110
|
+
z.number().finite(),
|
|
111
|
+
z.boolean()
|
|
112
|
+
])).max(12)).max(200),
|
|
113
|
+
sortable: z.boolean().optional()
|
|
114
|
+
}).refine((e) => e.rows.every((t) => t.length === e.columns.length)), J = {
|
|
115
|
+
Card: z.strictObject({
|
|
116
|
+
title: W,
|
|
117
|
+
asForm: z.boolean().optional(),
|
|
118
|
+
confirm: he.optional(),
|
|
119
|
+
cancel: he.optional()
|
|
120
|
+
}),
|
|
121
|
+
Form: z.strictObject({}),
|
|
122
|
+
Row: z.strictObject({
|
|
123
|
+
...ge,
|
|
124
|
+
justify: z.enum([
|
|
125
|
+
"start",
|
|
126
|
+
"center",
|
|
127
|
+
"end",
|
|
128
|
+
"between"
|
|
129
|
+
]).optional()
|
|
130
|
+
}),
|
|
131
|
+
Col: z.strictObject(ge),
|
|
132
|
+
Text: z.strictObject({
|
|
133
|
+
value: H,
|
|
134
|
+
size: z.enum([
|
|
135
|
+
"sm",
|
|
136
|
+
"md",
|
|
137
|
+
"lg",
|
|
138
|
+
"xl",
|
|
139
|
+
"2xl",
|
|
140
|
+
"3xl"
|
|
141
|
+
]).optional(),
|
|
142
|
+
weight: z.enum([
|
|
143
|
+
"normal",
|
|
144
|
+
"medium",
|
|
145
|
+
"semibold",
|
|
146
|
+
"bold"
|
|
147
|
+
]).optional(),
|
|
148
|
+
color: z.enum(["emphasis", "secondary"]).optional()
|
|
149
|
+
}),
|
|
150
|
+
Header: z.strictObject({
|
|
151
|
+
text: H,
|
|
152
|
+
size: z.enum([
|
|
153
|
+
"sm",
|
|
154
|
+
"md",
|
|
155
|
+
"lg",
|
|
156
|
+
"xl",
|
|
157
|
+
"2xl",
|
|
158
|
+
"3xl"
|
|
159
|
+
]).optional()
|
|
160
|
+
}),
|
|
161
|
+
Caption: z.strictObject({ value: H }),
|
|
162
|
+
Markdown: z.strictObject({ value: H }),
|
|
163
|
+
Badge: z.strictObject({
|
|
164
|
+
value: U,
|
|
165
|
+
variant: z.enum([
|
|
166
|
+
"success",
|
|
167
|
+
"info",
|
|
168
|
+
"warning",
|
|
169
|
+
"neutral"
|
|
170
|
+
]).optional()
|
|
171
|
+
}),
|
|
172
|
+
Fact: z.strictObject({
|
|
173
|
+
label: U,
|
|
174
|
+
value: H,
|
|
175
|
+
binding: G.optional()
|
|
176
|
+
}),
|
|
177
|
+
Divider: z.strictObject({}),
|
|
178
|
+
Spacer: z.strictObject({}),
|
|
179
|
+
Accent: z.strictObject({}),
|
|
180
|
+
Icon: z.strictObject({
|
|
181
|
+
name: z.enum([
|
|
182
|
+
"sun",
|
|
183
|
+
"moon",
|
|
184
|
+
"cloud",
|
|
185
|
+
"rain",
|
|
186
|
+
"snow",
|
|
187
|
+
"wind",
|
|
188
|
+
"play",
|
|
189
|
+
"pause",
|
|
190
|
+
"check",
|
|
191
|
+
"x",
|
|
192
|
+
"star",
|
|
193
|
+
"heart",
|
|
194
|
+
"arrow-right",
|
|
195
|
+
"arrow-up-right",
|
|
196
|
+
"chevron-right",
|
|
197
|
+
"calendar",
|
|
198
|
+
"clock",
|
|
199
|
+
"map-pin",
|
|
200
|
+
"plane",
|
|
201
|
+
"truck",
|
|
202
|
+
"credit-card",
|
|
203
|
+
"user",
|
|
204
|
+
"search",
|
|
205
|
+
"bell"
|
|
206
|
+
]),
|
|
207
|
+
size: z.enum([
|
|
208
|
+
"sm",
|
|
209
|
+
"md",
|
|
210
|
+
"lg"
|
|
211
|
+
]).optional()
|
|
212
|
+
}),
|
|
213
|
+
Image: z.strictObject({
|
|
214
|
+
src: H,
|
|
215
|
+
alt: H,
|
|
216
|
+
size: z.enum([
|
|
217
|
+
"sm",
|
|
218
|
+
"md",
|
|
219
|
+
"lg"
|
|
220
|
+
]).optional(),
|
|
221
|
+
round: z.boolean().optional()
|
|
222
|
+
}),
|
|
223
|
+
Avatar: z.strictObject({ name: U }),
|
|
224
|
+
Alert: z.strictObject({
|
|
225
|
+
tone: z.enum([
|
|
226
|
+
"info",
|
|
227
|
+
"success",
|
|
228
|
+
"warning",
|
|
229
|
+
"danger"
|
|
230
|
+
]),
|
|
231
|
+
title: U,
|
|
232
|
+
description: W
|
|
233
|
+
}),
|
|
234
|
+
ListView: z.strictObject({}),
|
|
235
|
+
ListViewItem: z.strictObject({}),
|
|
236
|
+
Input: z.strictObject({
|
|
237
|
+
...q,
|
|
238
|
+
placeholder: W,
|
|
239
|
+
multiline: z.boolean().optional(),
|
|
240
|
+
inputType: z.enum(["text", "email"]).optional()
|
|
241
|
+
}),
|
|
242
|
+
Select: z.strictObject({
|
|
243
|
+
...q,
|
|
244
|
+
options: me,
|
|
245
|
+
placeholder: W
|
|
246
|
+
}).refine((e) => !e.defaultValue || e.options.some((t) => t.value === e.defaultValue)),
|
|
247
|
+
DatePicker: z.strictObject(q).refine((e) => {
|
|
248
|
+
try {
|
|
249
|
+
return e.defaultValue && B(e.defaultValue), !0;
|
|
250
|
+
} catch {
|
|
251
|
+
return !1;
|
|
252
|
+
}
|
|
253
|
+
}),
|
|
254
|
+
RadioGroup: z.strictObject({
|
|
255
|
+
...q,
|
|
256
|
+
options: me
|
|
257
|
+
}).refine((e) => !e.defaultValue || e.options.some((t) => t.value === e.defaultValue)),
|
|
258
|
+
Checkbox: z.strictObject({
|
|
259
|
+
name: G,
|
|
260
|
+
label: U,
|
|
261
|
+
defaultChecked: z.boolean().optional()
|
|
262
|
+
}),
|
|
263
|
+
Button: z.strictObject({
|
|
264
|
+
label: U,
|
|
265
|
+
buttonStyle: z.enum([
|
|
266
|
+
"primary",
|
|
267
|
+
"secondary",
|
|
268
|
+
"outline",
|
|
269
|
+
"ghost",
|
|
270
|
+
"danger"
|
|
271
|
+
]).optional(),
|
|
272
|
+
block: z.boolean().optional(),
|
|
273
|
+
submit: z.boolean().optional()
|
|
274
|
+
}),
|
|
275
|
+
Progress: z.strictObject({
|
|
276
|
+
label: U,
|
|
277
|
+
value: z.number().min(0).max(100),
|
|
278
|
+
max: z.number().positive().max(100)
|
|
279
|
+
}).refine((e) => e.value <= e.max),
|
|
280
|
+
Chart: ve,
|
|
281
|
+
Table: ye
|
|
282
|
+
};
|
|
283
|
+
function be(e, t = 12e4) {
|
|
284
|
+
let n = 0, r = 0, i = /* @__PURE__ */ new Set();
|
|
285
|
+
function a(e, o) {
|
|
286
|
+
if (o > 24 || ++n > 6e3) throw Error("Response too large");
|
|
287
|
+
if (e !== null && typeof e != "boolean") {
|
|
288
|
+
if (typeof e == "string") {
|
|
289
|
+
if (r += e.length, r > t) throw Error("Response too large");
|
|
290
|
+
return;
|
|
291
|
+
}
|
|
292
|
+
if (!(typeof e == "number" && Number.isFinite(e))) {
|
|
293
|
+
if (typeof e != "object" || i.has(e)) throw Error("Expected JSON");
|
|
294
|
+
if (!Array.isArray(e) && ![Object.prototype, null].includes(Object.getPrototypeOf(e))) throw Error("Expected plain JSON");
|
|
295
|
+
i.add(e);
|
|
296
|
+
for (let [t, n] of Object.entries(e)) {
|
|
297
|
+
if ([
|
|
298
|
+
"__proto__",
|
|
299
|
+
"constructor",
|
|
300
|
+
"prototype"
|
|
301
|
+
].includes(t)) throw Error("Unsafe key");
|
|
302
|
+
r += t.length, a(n, o + 1);
|
|
303
|
+
}
|
|
304
|
+
i.delete(e);
|
|
305
|
+
}
|
|
306
|
+
}
|
|
307
|
+
}
|
|
308
|
+
a(e, 0);
|
|
309
|
+
}
|
|
310
|
+
function Y(e) {
|
|
311
|
+
be(e);
|
|
312
|
+
let t = 0, n = /* @__PURE__ */ new Set(), r = 0;
|
|
313
|
+
function i(e, a, o, s, c = !1) {
|
|
314
|
+
if (a > 16 || ++t > 300 || !e || typeof e != "object" || Array.isArray(e) || n.has(e)) throw Error("Invalid response tree");
|
|
315
|
+
n.add(e);
|
|
316
|
+
let { $type: l, $key: u, $action: d, children: f, ...p } = e;
|
|
317
|
+
if (typeof l != "string" || !Object.hasOwn(J, l)) throw Error("Unsupported component");
|
|
318
|
+
if (c && ![
|
|
319
|
+
"Text",
|
|
320
|
+
"Badge",
|
|
321
|
+
"Icon"
|
|
322
|
+
].includes(l)) throw Error("Inline content cannot contain a layout or control");
|
|
323
|
+
let m = J[l].parse(p);
|
|
324
|
+
if (f !== void 0 && [
|
|
325
|
+
"Input",
|
|
326
|
+
"Select",
|
|
327
|
+
"DatePicker",
|
|
328
|
+
"RadioGroup",
|
|
329
|
+
"Checkbox",
|
|
330
|
+
"Image",
|
|
331
|
+
"Avatar",
|
|
332
|
+
"Fact",
|
|
333
|
+
"Chart",
|
|
334
|
+
"Table",
|
|
335
|
+
"Progress",
|
|
336
|
+
"Divider",
|
|
337
|
+
"Spacer",
|
|
338
|
+
"Accent",
|
|
339
|
+
"Caption",
|
|
340
|
+
"Markdown",
|
|
341
|
+
"Header",
|
|
342
|
+
"Alert",
|
|
343
|
+
"Icon"
|
|
344
|
+
].includes(l)) throw Error("A leaf cannot have children");
|
|
345
|
+
if (l === "Button" && m.submit && !o) throw Error("A submit button needs a form");
|
|
346
|
+
if (l === "ListView" && f !== void 0 && (Array.isArray(f) ? f : [f]).some((e) => !e || typeof e != "object" || e.$type !== "ListViewItem")) throw Error("A list needs list items");
|
|
347
|
+
if (u !== void 0 && !(typeof u == "string" && u.length <= 160) && !(typeof u == "number" && Number.isFinite(u))) throw Error("Invalid key");
|
|
348
|
+
let h = d === void 0 ? void 0 : K.parse(d);
|
|
349
|
+
if (h && !["Button", "Form"].includes(l)) throw Error("Action on a passive component");
|
|
350
|
+
let g = l === "Form" || l === "Card" && m.asForm;
|
|
351
|
+
if (g && o) throw Error("Nested forms");
|
|
352
|
+
let _ = g ? /* @__PURE__ */ new Set() : s;
|
|
353
|
+
if ([
|
|
354
|
+
"Input",
|
|
355
|
+
"Select",
|
|
356
|
+
"DatePicker",
|
|
357
|
+
"RadioGroup",
|
|
358
|
+
"Checkbox"
|
|
359
|
+
].includes(l) && "name" in m && typeof m.name == "string") {
|
|
360
|
+
if (!o || _.has(m.name)) throw Error("A field needs a unique form name");
|
|
361
|
+
_.add(m.name);
|
|
362
|
+
}
|
|
363
|
+
for (let e of Object.values(m)) typeof e == "string" && (r += e.length);
|
|
364
|
+
if (r > 48e3) throw Error("Response too large");
|
|
365
|
+
if (h && JSON.stringify(h).length > 4e3) throw Error("Action too large");
|
|
366
|
+
let v;
|
|
367
|
+
if (f !== void 0) {
|
|
368
|
+
if (Array.isArray(f)) {
|
|
369
|
+
if (f.length > 100) throw Error("Too many children");
|
|
370
|
+
let e = f.map((e) => e && typeof e == "object" ? e.$key : void 0).filter((e) => e !== void 0);
|
|
371
|
+
if (new Set(e).size !== e.length) throw Error("Duplicate child keys");
|
|
372
|
+
v = f.map((e) => i(e, a + 1, !!(g || o), _, c || [
|
|
373
|
+
"Text",
|
|
374
|
+
"Badge",
|
|
375
|
+
"Button"
|
|
376
|
+
].includes(l)));
|
|
377
|
+
} else v = i(f, a + 1, !!(g || o), _, c || [
|
|
378
|
+
"Text",
|
|
379
|
+
"Badge",
|
|
380
|
+
"Button"
|
|
381
|
+
].includes(l));
|
|
382
|
+
}
|
|
383
|
+
return n.delete(e), {
|
|
384
|
+
...m,
|
|
385
|
+
$type: l,
|
|
386
|
+
...u === void 0 ? {} : { $key: u },
|
|
387
|
+
...h ? { $action: h } : {},
|
|
388
|
+
...v ? { children: v } : {}
|
|
389
|
+
};
|
|
390
|
+
}
|
|
391
|
+
return i(e, 0, !1, /* @__PURE__ */ new Set());
|
|
392
|
+
}
|
|
393
|
+
//#endregion
|
|
394
|
+
//#region src/reusable/generative/data.tsx
|
|
395
|
+
function xe({ label: e, columns: t, rows: n, sortable: r = !1 }) {
|
|
396
|
+
let [i, a] = O(), o = i ? [...n].sort((e, t) => {
|
|
397
|
+
let n = e[i.index], r = t[i.index];
|
|
398
|
+
return i.direction * (typeof n == "number" && typeof r == "number" ? n - r : String(n).localeCompare(String(r), "en", { numeric: !0 }));
|
|
399
|
+
}) : n;
|
|
400
|
+
return /* @__PURE__ */ L("div", {
|
|
401
|
+
className: "min-w-0 overflow-x-auto rounded-control border border-line-subtle",
|
|
402
|
+
tabIndex: 0,
|
|
403
|
+
role: "region",
|
|
404
|
+
"aria-label": e,
|
|
405
|
+
children: /* @__PURE__ */ R("table", {
|
|
406
|
+
className: "w-full type-body text-fg numeric",
|
|
407
|
+
children: [
|
|
408
|
+
/* @__PURE__ */ L("caption", {
|
|
409
|
+
className: "sr-only",
|
|
410
|
+
children: e
|
|
411
|
+
}),
|
|
412
|
+
/* @__PURE__ */ L("thead", {
|
|
413
|
+
className: "bg-surface-muted",
|
|
414
|
+
children: /* @__PURE__ */ L("tr", { children: t.map((e, t) => /* @__PURE__ */ L("th", {
|
|
415
|
+
scope: "col",
|
|
416
|
+
"aria-sort": i?.index === t ? i.direction === 1 ? "ascending" : "descending" : void 0,
|
|
417
|
+
className: "px-4 py-2 text-left type-label",
|
|
418
|
+
style: { textAlign: e.align === "end" ? "right" : "left" },
|
|
419
|
+
children: r ? /* @__PURE__ */ R(l, {
|
|
420
|
+
size: "sm",
|
|
421
|
+
variant: "ghost",
|
|
422
|
+
className: "-mx-2",
|
|
423
|
+
onPress: () => a({
|
|
424
|
+
index: t,
|
|
425
|
+
direction: i?.index === t && i.direction === 1 ? -1 : 1
|
|
426
|
+
}),
|
|
427
|
+
children: [e.label, i?.index === t ? /* @__PURE__ */ L("span", {
|
|
428
|
+
"aria-hidden": !0,
|
|
429
|
+
children: i.direction === 1 ? "↑" : "↓"
|
|
430
|
+
}) : null]
|
|
431
|
+
}) : e.label
|
|
432
|
+
}, t)) })
|
|
433
|
+
}),
|
|
434
|
+
/* @__PURE__ */ L("tbody", { children: o.map((e, n) => /* @__PURE__ */ L("tr", {
|
|
435
|
+
className: "border-t border-line-subtle",
|
|
436
|
+
children: e.map((e, n) => /* @__PURE__ */ L("td", {
|
|
437
|
+
className: "px-4 py-3",
|
|
438
|
+
style: { textAlign: t[n]?.align === "end" ? "right" : "left" },
|
|
439
|
+
children: String(e)
|
|
440
|
+
}, n))
|
|
441
|
+
}, n)) })
|
|
442
|
+
]
|
|
443
|
+
})
|
|
444
|
+
});
|
|
445
|
+
}
|
|
446
|
+
function Se(e) {
|
|
447
|
+
let [t, n] = O(!1), r = e.series?.length ? e.series : [{
|
|
448
|
+
label: V.series,
|
|
449
|
+
data: e.data ?? []
|
|
450
|
+
}];
|
|
451
|
+
return /* @__PURE__ */ R("figure", {
|
|
452
|
+
className: "generative-chart flex min-w-0 flex-col gap-4",
|
|
453
|
+
"aria-label": e.label,
|
|
454
|
+
children: [
|
|
455
|
+
r.every((e) => e.data.length === 0) ? /* @__PURE__ */ L("p", {
|
|
456
|
+
className: "type-body text-fg-subtle",
|
|
457
|
+
children: V.empty
|
|
458
|
+
}) : fe.Chart?.render({
|
|
459
|
+
...e,
|
|
460
|
+
$status: "done"
|
|
461
|
+
}),
|
|
462
|
+
/* @__PURE__ */ L(l, {
|
|
463
|
+
size: "sm",
|
|
464
|
+
variant: "ghost",
|
|
465
|
+
className: "self-start",
|
|
466
|
+
"aria-expanded": t,
|
|
467
|
+
onPress: () => n((e) => !e),
|
|
468
|
+
children: V.data
|
|
469
|
+
}),
|
|
470
|
+
t ? /* @__PURE__ */ L(xe, {
|
|
471
|
+
label: e.label,
|
|
472
|
+
columns: [{ label: V.point }, ...r.map((e) => ({
|
|
473
|
+
label: e.label,
|
|
474
|
+
align: "end"
|
|
475
|
+
}))],
|
|
476
|
+
rows: (r[0]?.data ?? []).map((e, t) => [e.label, ...r.map((e) => e.data[t]?.value ?? 0)])
|
|
477
|
+
}) : null
|
|
478
|
+
]
|
|
479
|
+
});
|
|
480
|
+
}
|
|
481
|
+
//#endregion
|
|
482
|
+
//#region src/reusable/generative/vocabulary.tsx
|
|
483
|
+
var X = S({
|
|
484
|
+
blocked: !1,
|
|
485
|
+
available: void 0,
|
|
486
|
+
captureInput: void 0,
|
|
487
|
+
initialValues: void 0
|
|
488
|
+
}), Z = S(void 0);
|
|
489
|
+
function Q(e, t, n, r, i) {
|
|
490
|
+
let a = w(Z), { initialValues: o } = w(X), [s, c] = O(o?.[e] ?? t);
|
|
491
|
+
return T(() => (a?.fields.set(e, {
|
|
492
|
+
value: s,
|
|
493
|
+
required: n,
|
|
494
|
+
inputType: r,
|
|
495
|
+
date: i
|
|
496
|
+
}), () => {
|
|
497
|
+
a?.fields.delete(e);
|
|
498
|
+
}), [
|
|
499
|
+
a?.fields,
|
|
500
|
+
e,
|
|
501
|
+
s,
|
|
502
|
+
n,
|
|
503
|
+
r,
|
|
504
|
+
i
|
|
505
|
+
]), {
|
|
506
|
+
value: s,
|
|
507
|
+
error: a?.errors[e],
|
|
508
|
+
onChange: (t) => {
|
|
509
|
+
a?.fields.set(e, {
|
|
510
|
+
value: t,
|
|
511
|
+
required: n,
|
|
512
|
+
inputType: r,
|
|
513
|
+
date: i
|
|
514
|
+
}), c(t), a?.setError(e);
|
|
515
|
+
}
|
|
516
|
+
};
|
|
517
|
+
}
|
|
518
|
+
function Ce(e) {
|
|
519
|
+
let t = {}, n = Object.create(null);
|
|
520
|
+
return e.forEach((e, r) => {
|
|
521
|
+
if (n[r] = e.value, e.required && !String(e.value).trim()) t[r] = V.fieldRequired;
|
|
522
|
+
else if (e.inputType === "email" && e.value && !/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(String(e.value))) t[r] = V.email;
|
|
523
|
+
else if (e.date && e.value) try {
|
|
524
|
+
B(String(e.value));
|
|
525
|
+
} catch {
|
|
526
|
+
t[r] = V.date;
|
|
527
|
+
}
|
|
528
|
+
}), n.startDate && n.endDate && String(n.endDate) <= String(n.startDate) && (t.endDate = V.date), {
|
|
529
|
+
errors: t,
|
|
530
|
+
values: n
|
|
531
|
+
};
|
|
532
|
+
}
|
|
533
|
+
function we({ children: e, action: t, dispatch: n, title: r, confirm: i, cancel: a, resolveFact: o }) {
|
|
534
|
+
let [s] = O(() => /* @__PURE__ */ new Map()), [c] = O(() => /* @__PURE__ */ new Set()), [, u] = O(0), [d, f] = O(!1), [p, m] = O({}), { blocked: h, available: g, captureInput: _ } = w(X), v = i?.$action ?? t, y = !(!n || !v || g && !g.has(v.type));
|
|
535
|
+
return /* @__PURE__ */ L(Z.Provider, {
|
|
536
|
+
value: {
|
|
537
|
+
fields: s,
|
|
538
|
+
bindings: c,
|
|
539
|
+
canSubmit: y,
|
|
540
|
+
errors: p,
|
|
541
|
+
setError: (e) => {
|
|
542
|
+
u((e) => e + 1), f(!1), m((t) => t[e] ? Object.fromEntries(Object.entries(t).filter(([t]) => t !== e)) : t);
|
|
543
|
+
}
|
|
544
|
+
},
|
|
545
|
+
children: /* @__PURE__ */ R("form", {
|
|
546
|
+
className: "flex min-w-0 flex-col gap-5",
|
|
547
|
+
noValidate: !0,
|
|
548
|
+
onSubmit: (e) => {
|
|
549
|
+
if (e.preventDefault(), h || !y) return;
|
|
550
|
+
let { errors: t, values: r } = Ce(s);
|
|
551
|
+
if (m(t), Object.keys(t).length) {
|
|
552
|
+
let t = e.currentTarget;
|
|
553
|
+
requestAnimationFrame(() => t.querySelector("[aria-invalid=\"true\"]")?.focus());
|
|
554
|
+
return;
|
|
555
|
+
}
|
|
556
|
+
let i = {};
|
|
557
|
+
for (let e of c) {
|
|
558
|
+
let t;
|
|
559
|
+
try {
|
|
560
|
+
t = o?.(e, r);
|
|
561
|
+
} catch {}
|
|
562
|
+
if (t === void 0) {
|
|
563
|
+
f(!0);
|
|
564
|
+
return;
|
|
565
|
+
}
|
|
566
|
+
i[e] = t;
|
|
567
|
+
}
|
|
568
|
+
v && n && n({
|
|
569
|
+
...v,
|
|
570
|
+
$input: r,
|
|
571
|
+
...c.size ? { $bindings: i } : {}
|
|
572
|
+
});
|
|
573
|
+
},
|
|
574
|
+
children: [
|
|
575
|
+
r ? /* @__PURE__ */ L("h3", {
|
|
576
|
+
className: "type-title text-fg-emphasis",
|
|
577
|
+
children: r
|
|
578
|
+
}) : null,
|
|
579
|
+
e,
|
|
580
|
+
Object.keys(p).length ? /* @__PURE__ */ L("p", {
|
|
581
|
+
role: "alert",
|
|
582
|
+
className: "type-body text-error",
|
|
583
|
+
children: V.validation
|
|
584
|
+
}) : null,
|
|
585
|
+
d ? /* @__PURE__ */ L("p", {
|
|
586
|
+
role: "alert",
|
|
587
|
+
className: "type-body text-error",
|
|
588
|
+
children: V.quoteUnavailable
|
|
589
|
+
}) : null,
|
|
590
|
+
i || a ? /* @__PURE__ */ R("footer", {
|
|
591
|
+
className: "flex flex-wrap items-center gap-3 border-t border-line-subtle pt-5",
|
|
592
|
+
children: [i ? /* @__PURE__ */ L(l, {
|
|
593
|
+
className: "h-auto min-h-control-md max-w-full py-control-y wrap-anywhere whitespace-normal",
|
|
594
|
+
type: "submit",
|
|
595
|
+
variant: "primary",
|
|
596
|
+
isDisabled: h || !y,
|
|
597
|
+
children: i.label
|
|
598
|
+
}) : null, a ? /* @__PURE__ */ L(l, {
|
|
599
|
+
variant: "ghost",
|
|
600
|
+
className: "h-auto min-h-control-md max-w-full py-control-y wrap-anywhere whitespace-normal",
|
|
601
|
+
isDisabled: h || !n || !a.$action || !(!g || g.has(a.$action.type)),
|
|
602
|
+
onPress: () => {
|
|
603
|
+
a.$action && (_?.({
|
|
604
|
+
...a.$action,
|
|
605
|
+
$input: Ce(s).values
|
|
606
|
+
}), n?.(a.$action));
|
|
607
|
+
},
|
|
608
|
+
children: a.label
|
|
609
|
+
}) : null]
|
|
610
|
+
}) : null
|
|
611
|
+
]
|
|
612
|
+
})
|
|
613
|
+
});
|
|
614
|
+
}
|
|
615
|
+
function Te(e) {
|
|
616
|
+
let t = Q(e.name, e.defaultValue ?? "", e.required, e.inputType), { blocked: n } = w(X);
|
|
617
|
+
return /* @__PURE__ */ L(x, {
|
|
618
|
+
className: "min-w-0 flex-1",
|
|
619
|
+
label: e.label,
|
|
620
|
+
name: e.name,
|
|
621
|
+
value: String(t.value),
|
|
622
|
+
onChange: t.onChange,
|
|
623
|
+
multiline: e.multiline,
|
|
624
|
+
placeholder: e.placeholder,
|
|
625
|
+
error: t.error,
|
|
626
|
+
isRequired: e.required,
|
|
627
|
+
isDisabled: n,
|
|
628
|
+
type: e.inputType ?? "text"
|
|
629
|
+
});
|
|
630
|
+
}
|
|
631
|
+
function Ee(e) {
|
|
632
|
+
let t = Q(e.name, e.defaultValue ?? "", e.required), { blocked: n } = w(X);
|
|
633
|
+
return /* @__PURE__ */ R(ue, {
|
|
634
|
+
placeholder: e.placeholder,
|
|
635
|
+
name: e.name,
|
|
636
|
+
value: String(t.value) || null,
|
|
637
|
+
onChange: (e) => t.onChange(String(e ?? "")),
|
|
638
|
+
isRequired: e.required,
|
|
639
|
+
isInvalid: !!t.error,
|
|
640
|
+
isDisabled: n,
|
|
641
|
+
validationBehavior: "aria",
|
|
642
|
+
className: "flex min-w-0 flex-1 flex-col gap-1.5",
|
|
643
|
+
children: [
|
|
644
|
+
/* @__PURE__ */ L(N, {
|
|
645
|
+
className: "type-label text-fg-emphasis",
|
|
646
|
+
children: e.label
|
|
647
|
+
}),
|
|
648
|
+
/* @__PURE__ */ R(l, {
|
|
649
|
+
className: "group/trigger justify-between",
|
|
650
|
+
isDisabled: n,
|
|
651
|
+
children: [/* @__PURE__ */ L(de, { className: "min-w-0 truncate" }), /* @__PURE__ */ L(o, { className: "transition-[rotate] duration-(--duration-settle) ease-settle group-aria-expanded/trigger:rotate-180 motion-reduce:transition-none" })]
|
|
652
|
+
}),
|
|
653
|
+
/* @__PURE__ */ L(F, {
|
|
654
|
+
className: "min-w-(--trigger-width) origin-(--trigger-anchor-point) rounded-control border border-line-subtle bg-surface p-1 shadow-popover outline-none data-entering:animate-pop-in data-exiting:animate-pop-out",
|
|
655
|
+
children: /* @__PURE__ */ L(oe, {
|
|
656
|
+
className: "outline-none",
|
|
657
|
+
items: e.options,
|
|
658
|
+
children: (e) => /* @__PURE__ */ L(P, {
|
|
659
|
+
id: e.value,
|
|
660
|
+
textValue: e.label,
|
|
661
|
+
className: "cursor-pointer rounded-cell px-control-md-x py-control-y type-body text-fg-emphasis outline-none data-focus-visible:focus-ring data-focused:bg-surface-subtle data-selected:font-medium",
|
|
662
|
+
children: e.label
|
|
663
|
+
})
|
|
664
|
+
})
|
|
665
|
+
}),
|
|
666
|
+
/* @__PURE__ */ L(j, {
|
|
667
|
+
className: "type-caption text-error",
|
|
668
|
+
children: t.error
|
|
669
|
+
})
|
|
670
|
+
]
|
|
671
|
+
});
|
|
672
|
+
}
|
|
673
|
+
function De(e) {
|
|
674
|
+
let t = Q(e.name, e.defaultValue ?? "", e.required, void 0, !0), { blocked: n } = w(X);
|
|
675
|
+
return /* @__PURE__ */ L(M, {
|
|
676
|
+
locale: "en-AU",
|
|
677
|
+
children: /* @__PURE__ */ R(ae, {
|
|
678
|
+
name: e.name,
|
|
679
|
+
value: t.value ? B(String(t.value)) : null,
|
|
680
|
+
onChange: (e) => t.onChange(e?.toString() ?? ""),
|
|
681
|
+
isRequired: e.required,
|
|
682
|
+
isInvalid: !!t.error,
|
|
683
|
+
isDisabled: n,
|
|
684
|
+
validationBehavior: "aria",
|
|
685
|
+
className: "flex min-w-0 flex-1 flex-col gap-1.5",
|
|
686
|
+
children: [
|
|
687
|
+
/* @__PURE__ */ L(N, {
|
|
688
|
+
className: "type-label text-fg-emphasis",
|
|
689
|
+
children: e.label
|
|
690
|
+
}),
|
|
691
|
+
/* @__PURE__ */ L(k, {
|
|
692
|
+
className: "flex h-control-md items-center rounded-control border border-line-input bg-surface px-control-md-x type-body text-fg-emphasis data-disabled:opacity-50 data-focus-within:border-brand data-focus-within:focus-ring",
|
|
693
|
+
children: (e) => /* @__PURE__ */ L(A, {
|
|
694
|
+
segment: e,
|
|
695
|
+
className: "rounded-cell px-0.5 numeric outline-none data-focused:bg-brand data-focused:text-on-brand data-placeholder:text-fg-subtle"
|
|
696
|
+
})
|
|
697
|
+
}),
|
|
698
|
+
/* @__PURE__ */ L(j, {
|
|
699
|
+
className: "type-caption text-error",
|
|
700
|
+
children: t.error
|
|
701
|
+
})
|
|
702
|
+
]
|
|
703
|
+
})
|
|
704
|
+
});
|
|
705
|
+
}
|
|
706
|
+
function Oe(e) {
|
|
707
|
+
let t = Q(e.name, e.defaultValue ?? "", e.required), { blocked: n } = w(X);
|
|
708
|
+
return /* @__PURE__ */ R(le, {
|
|
709
|
+
name: e.name,
|
|
710
|
+
value: String(t.value),
|
|
711
|
+
onChange: t.onChange,
|
|
712
|
+
isRequired: e.required,
|
|
713
|
+
isInvalid: !!t.error,
|
|
714
|
+
isDisabled: n,
|
|
715
|
+
validationBehavior: "aria",
|
|
716
|
+
className: "flex flex-col gap-2",
|
|
717
|
+
children: [
|
|
718
|
+
/* @__PURE__ */ L(N, {
|
|
719
|
+
className: "type-label text-fg-emphasis",
|
|
720
|
+
children: e.label
|
|
721
|
+
}),
|
|
722
|
+
/* @__PURE__ */ L("div", {
|
|
723
|
+
className: "flex flex-wrap gap-3",
|
|
724
|
+
children: e.options.map((e) => /* @__PURE__ */ R(ce, {
|
|
725
|
+
value: e.value,
|
|
726
|
+
className: "group flex cursor-pointer items-center gap-2 rounded-control border border-line px-control-md-x py-control-y type-body text-fg data-disabled:opacity-50 data-focus-visible:focus-ring data-selected:border-brand data-selected:bg-surface-muted",
|
|
727
|
+
children: [/* @__PURE__ */ L("span", {
|
|
728
|
+
className: "grid size-4 place-items-center rounded-full border border-line-input",
|
|
729
|
+
children: /* @__PURE__ */ L("span", { className: "size-2 rounded-full group-data-selected:bg-brand" })
|
|
730
|
+
}), e.label]
|
|
731
|
+
}, e.value))
|
|
732
|
+
}),
|
|
733
|
+
/* @__PURE__ */ L(j, {
|
|
734
|
+
className: "type-caption text-error",
|
|
735
|
+
children: t.error
|
|
736
|
+
})
|
|
737
|
+
]
|
|
738
|
+
});
|
|
739
|
+
}
|
|
740
|
+
function ke(e) {
|
|
741
|
+
let t = Q(e.name, e.defaultChecked ?? !1), { blocked: n } = w(X);
|
|
742
|
+
return /* @__PURE__ */ R(ie, {
|
|
743
|
+
name: e.name,
|
|
744
|
+
isSelected: !!t.value,
|
|
745
|
+
onChange: t.onChange,
|
|
746
|
+
isDisabled: n,
|
|
747
|
+
className: "group flex cursor-pointer items-center gap-2 rounded-cell type-body text-fg data-disabled:opacity-50 data-focus-visible:focus-ring",
|
|
748
|
+
children: [/* @__PURE__ */ L("span", {
|
|
749
|
+
className: "grid size-4 shrink-0 place-items-center rounded-cell border border-line-input group-data-selected:border-brand group-data-selected:bg-brand",
|
|
750
|
+
children: /* @__PURE__ */ L(p, { className: "invisible size-3 text-on-brand group-data-selected:visible" })
|
|
751
|
+
}), e.label]
|
|
752
|
+
});
|
|
753
|
+
}
|
|
754
|
+
var Ae = {
|
|
755
|
+
sm: "type-body",
|
|
756
|
+
md: "type-heading",
|
|
757
|
+
lg: "type-title",
|
|
758
|
+
xl: "type-title",
|
|
759
|
+
"2xl": "text-2xl leading-tight",
|
|
760
|
+
"3xl": "text-3xl leading-tight"
|
|
761
|
+
}, je = [
|
|
762
|
+
"gap-0",
|
|
763
|
+
"gap-1",
|
|
764
|
+
"gap-2",
|
|
765
|
+
"gap-3",
|
|
766
|
+
"gap-4",
|
|
767
|
+
"gap-5",
|
|
768
|
+
"gap-6",
|
|
769
|
+
"gap-7",
|
|
770
|
+
"gap-8"
|
|
771
|
+
], Me = {
|
|
772
|
+
sun: /* @__PURE__ */ L(i, {}),
|
|
773
|
+
moon: /* @__PURE__ */ L(a, {}),
|
|
774
|
+
clock: /* @__PURE__ */ L(s, {}),
|
|
775
|
+
calendar: /* @__PURE__ */ L(c, {}),
|
|
776
|
+
"map-pin": /* @__PURE__ */ L(m, {}),
|
|
777
|
+
check: /* @__PURE__ */ L(p, {}),
|
|
778
|
+
x: /* @__PURE__ */ L(t, {}),
|
|
779
|
+
user: /* @__PURE__ */ L(n, {}),
|
|
780
|
+
search: /* @__PURE__ */ L(e, {}),
|
|
781
|
+
"chevron-right": /* @__PURE__ */ L(d, {})
|
|
782
|
+
};
|
|
783
|
+
function Ne({ name: e, size: t }) {
|
|
784
|
+
let n = {
|
|
785
|
+
plane: /* @__PURE__ */ L("path", { d: "m3 16 7-4-1-9 3 1 3 7 6 1v2l-6 1-3 7-3 1 1-9-7-2Z" }),
|
|
786
|
+
play: /* @__PURE__ */ L("path", { d: "m8 5 11 7-11 7Z" }),
|
|
787
|
+
pause: /* @__PURE__ */ L(I, { children: /* @__PURE__ */ L("path", { d: "M8 5v14M16 5v14" }) }),
|
|
788
|
+
cloud: /* @__PURE__ */ L("path", { d: "M6 18h12a4 4 0 0 0 0-8 6 6 0 0 0-11-2 5 5 0 0 0-1 10Z" }),
|
|
789
|
+
star: /* @__PURE__ */ L("path", { d: "m12 3 3 6 7 1-5 5 1 7-6-3-6 3 1-7-5-5 7-1Z" }),
|
|
790
|
+
heart: /* @__PURE__ */ L("path", { d: "M20 5a5 5 0 0 0-8 1 5 5 0 0 0-8-1C-2 11 12 21 12 21S26 11 20 5Z" }),
|
|
791
|
+
"arrow-right": /* @__PURE__ */ L("path", { d: "M4 12h16m-6-6 6 6-6 6" }),
|
|
792
|
+
"arrow-up-right": /* @__PURE__ */ L("path", { d: "M6 18 18 6M6 6h12v12" }),
|
|
793
|
+
"credit-card": /* @__PURE__ */ R(I, { children: [/* @__PURE__ */ L("rect", {
|
|
794
|
+
x: "3",
|
|
795
|
+
y: "5",
|
|
796
|
+
width: "18",
|
|
797
|
+
height: "14",
|
|
798
|
+
rx: "2"
|
|
799
|
+
}), /* @__PURE__ */ L("path", { d: "M3 10h18" })] }),
|
|
800
|
+
truck: /* @__PURE__ */ R(I, { children: [
|
|
801
|
+
/* @__PURE__ */ L("path", { d: "M3 4h12v13H3Zm12 5h3l3 4v4h-6" }),
|
|
802
|
+
/* @__PURE__ */ L("circle", {
|
|
803
|
+
cx: "7",
|
|
804
|
+
cy: "18",
|
|
805
|
+
r: "2"
|
|
806
|
+
}),
|
|
807
|
+
/* @__PURE__ */ L("circle", {
|
|
808
|
+
cx: "18",
|
|
809
|
+
cy: "18",
|
|
810
|
+
r: "2"
|
|
811
|
+
})
|
|
812
|
+
] }),
|
|
813
|
+
bell: /* @__PURE__ */ L("path", { d: "M4 17h16l-2-3V9a6 6 0 0 0-12 0v5ZM10 21h4" }),
|
|
814
|
+
wind: /* @__PURE__ */ L("path", { d: "M3 8h12a3 3 0 1 0-3-3M3 12h16a3 3 0 1 1-3 3M3 16h5a3 3 0 1 1-3 3" }),
|
|
815
|
+
rain: /* @__PURE__ */ R(I, { children: [/* @__PURE__ */ L("path", { d: "M6 14h12a3 3 0 0 0 0-6 6 6 0 0 0-11-1 4 4 0 0 0-1 7Z" }), /* @__PURE__ */ L("path", { d: "m8 18-1 3m6-3-1 3m6-3-1 3" })] }),
|
|
816
|
+
snow: /* @__PURE__ */ L("path", { d: "M12 2v20M3 7l18 10M3 17 21 7M9 3l3 3 3-3M9 21l3-3 3 3" })
|
|
817
|
+
};
|
|
818
|
+
return /* @__PURE__ */ L("span", {
|
|
819
|
+
"aria-hidden": !0,
|
|
820
|
+
className: r("inline-flex shrink-0 items-center justify-center text-fg-subtle [&>svg]:size-full", t === "lg" ? "size-10" : "size-5"),
|
|
821
|
+
children: Me[e] ?? /* @__PURE__ */ L("svg", {
|
|
822
|
+
viewBox: "0 0 24 24",
|
|
823
|
+
fill: "none",
|
|
824
|
+
stroke: "currentColor",
|
|
825
|
+
strokeWidth: "1.5",
|
|
826
|
+
strokeLinecap: "round",
|
|
827
|
+
strokeLinejoin: "round",
|
|
828
|
+
children: n[e]
|
|
829
|
+
})
|
|
830
|
+
});
|
|
831
|
+
}
|
|
832
|
+
function Pe({ label: e, value: t, binding: n, resolveFact: r }) {
|
|
833
|
+
let i = w(Z);
|
|
834
|
+
T(() => (n && i?.bindings.add(n), () => {
|
|
835
|
+
n && i?.bindings.delete(n);
|
|
836
|
+
}), [n, i?.bindings]);
|
|
837
|
+
let a = t;
|
|
838
|
+
if (n) try {
|
|
839
|
+
a = r?.(n, Object.fromEntries([...i?.fields ?? []].map(([e, t]) => [e, t.value]))) ?? V.quoteUnavailable;
|
|
840
|
+
} catch {
|
|
841
|
+
a = V.quoteUnavailable;
|
|
842
|
+
}
|
|
843
|
+
return /* @__PURE__ */ R("dl", {
|
|
844
|
+
className: "flex min-w-0 flex-col gap-1",
|
|
845
|
+
children: [/* @__PURE__ */ L("dt", {
|
|
846
|
+
className: "type-caption font-normal text-fg-subtle",
|
|
847
|
+
children: e
|
|
848
|
+
}), /* @__PURE__ */ L("dd", {
|
|
849
|
+
className: "type-heading wrap-anywhere text-fg-emphasis numeric",
|
|
850
|
+
"aria-live": n ? "polite" : void 0,
|
|
851
|
+
children: a
|
|
852
|
+
})]
|
|
853
|
+
});
|
|
854
|
+
}
|
|
855
|
+
function Fe({ src: e, alt: t, size: n, round: i, resolveImage: a }) {
|
|
856
|
+
let [o, s] = O(!1), c;
|
|
857
|
+
try {
|
|
858
|
+
c = a?.(e);
|
|
859
|
+
} catch {}
|
|
860
|
+
return c && (/^https:\/\//.test(c) || /^\/(?!\/)/.test(c)) && !o ? /* @__PURE__ */ L("img", {
|
|
861
|
+
src: c,
|
|
862
|
+
alt: t,
|
|
863
|
+
loading: "lazy",
|
|
864
|
+
referrerPolicy: "no-referrer",
|
|
865
|
+
onError: () => s(!0),
|
|
866
|
+
className: r("max-w-full object-cover", n === "sm" ? "size-avatar-lg shrink-0" : "aspect-video w-full rounded-control", i && "rounded-full")
|
|
867
|
+
}, c) : /* @__PURE__ */ L("div", {
|
|
868
|
+
role: t ? "img" : void 0,
|
|
869
|
+
"aria-label": t ? `${t} · ${V.imageMissing}` : void 0,
|
|
870
|
+
className: r("flex items-center justify-center bg-surface-subtle text-fg-subtle", n === "sm" ? "size-avatar-lg shrink-0" : "aspect-video rounded-control", i && "rounded-full"),
|
|
871
|
+
children: /* @__PURE__ */ L("span", {
|
|
872
|
+
"aria-hidden": !0,
|
|
873
|
+
children: "▧"
|
|
874
|
+
})
|
|
875
|
+
});
|
|
876
|
+
}
|
|
877
|
+
function Ie(e = {}) {
|
|
878
|
+
let t = (e, t, n) => ({
|
|
879
|
+
properties: e,
|
|
880
|
+
description: t,
|
|
881
|
+
render: n
|
|
882
|
+
});
|
|
883
|
+
return {
|
|
884
|
+
Card: t(J.Card, "A related set of content, optionally with a form and actions.", ({ title: t, asForm: n, confirm: r, cancel: i, children: a, $dispatch: o }) => /* @__PURE__ */ L("section", {
|
|
885
|
+
className: "flex min-w-0 flex-col gap-5 rounded-surface border border-line-subtle bg-surface p-5 text-fg shadow-control sm:p-6",
|
|
886
|
+
children: n ? /* @__PURE__ */ L(we, {
|
|
887
|
+
title: t,
|
|
888
|
+
confirm: r,
|
|
889
|
+
cancel: i,
|
|
890
|
+
dispatch: o,
|
|
891
|
+
resolveFact: e.resolveFact,
|
|
892
|
+
children: a
|
|
893
|
+
}) : /* @__PURE__ */ R(I, { children: [
|
|
894
|
+
t ? /* @__PURE__ */ L("h3", {
|
|
895
|
+
className: "type-title text-fg-emphasis",
|
|
896
|
+
children: t
|
|
897
|
+
}) : null,
|
|
898
|
+
a,
|
|
899
|
+
r || i ? /* @__PURE__ */ R("div", {
|
|
900
|
+
className: "flex flex-wrap gap-3 border-t border-line-subtle pt-5",
|
|
901
|
+
children: [r ? /* @__PURE__ */ L(Le, {
|
|
902
|
+
label: r.label,
|
|
903
|
+
action: r.$action,
|
|
904
|
+
dispatch: o,
|
|
905
|
+
buttonStyle: "primary"
|
|
906
|
+
}) : null, i ? /* @__PURE__ */ L(Le, {
|
|
907
|
+
label: i.label,
|
|
908
|
+
action: i.$action,
|
|
909
|
+
dispatch: o,
|
|
910
|
+
buttonStyle: "ghost"
|
|
911
|
+
}) : null]
|
|
912
|
+
}) : null
|
|
913
|
+
] })
|
|
914
|
+
})),
|
|
915
|
+
Form: t(J.Form, "A form collecting named, labelled controls.", ({ children: t, $action: n, $dispatch: r }) => /* @__PURE__ */ L(we, {
|
|
916
|
+
action: n,
|
|
917
|
+
dispatch: r,
|
|
918
|
+
resolveFact: e.resolveFact,
|
|
919
|
+
children: t
|
|
920
|
+
})),
|
|
921
|
+
Row: t(J.Row, "A wrapping row.", ({ children: e, gap: t = 3, align: n, justify: i }) => /* @__PURE__ */ L("div", {
|
|
922
|
+
className: r("flex min-w-0 flex-wrap", je[t], n === "center" ? "items-center" : n === "end" ? "items-end" : "items-start", i === "between" ? "justify-between" : i === "end" ? "justify-end" : i === "center" ? "justify-center" : "justify-start"),
|
|
923
|
+
children: e
|
|
924
|
+
})),
|
|
925
|
+
Col: t(J.Col, "A vertical stack.", ({ children: e, gap: t = 3, align: n }) => /* @__PURE__ */ L("div", {
|
|
926
|
+
className: r("flex min-w-0 flex-col", je[t], n === "center" ? "items-center" : n === "end" ? "items-end" : "items-stretch"),
|
|
927
|
+
children: e
|
|
928
|
+
})),
|
|
929
|
+
Text: t(J.Text, "Plain text.", ({ value: e, size: t = "sm", weight: n, color: i, children: a }) => /* @__PURE__ */ R("p", {
|
|
930
|
+
className: r("min-w-0 wrap-anywhere", Ae[t], n && n !== "normal" && "font-medium", i === "secondary" ? "text-fg-subtle" : "text-fg-emphasis"),
|
|
931
|
+
children: [e, a]
|
|
932
|
+
})),
|
|
933
|
+
Header: t(J.Header, "A section heading.", ({ text: e, size: t = "md" }) => /* @__PURE__ */ L("h3", {
|
|
934
|
+
className: r("text-fg-emphasis", Ae[t]),
|
|
935
|
+
children: e
|
|
936
|
+
})),
|
|
937
|
+
Caption: t(J.Caption, "Quiet supporting text.", ({ value: e }) => /* @__PURE__ */ L("p", {
|
|
938
|
+
className: "type-caption font-normal wrap-anywhere text-fg-subtle",
|
|
939
|
+
children: e
|
|
940
|
+
})),
|
|
941
|
+
Markdown: t(J.Markdown, "Safe formatted text.", ({ value: e }) => /* @__PURE__ */ L(y, { text: e })),
|
|
942
|
+
Fact: t(J.Fact, "A labelled value.", (t) => /* @__PURE__ */ L(Pe, {
|
|
943
|
+
...t,
|
|
944
|
+
resolveFact: e.resolveFact
|
|
945
|
+
})),
|
|
946
|
+
Badge: t(J.Badge, "A status with text as well as colour.", ({ value: e, variant: t, children: n }) => /* @__PURE__ */ R("span", {
|
|
947
|
+
className: r("inline-flex items-center gap-1.5 self-start rounded-cell border px-2 py-1 font-mono type-caption", t === "success" ? "border-success-line bg-success-subtle text-success" : t === "warning" ? "border-attention-line bg-attention-subtle text-attention" : t === "info" ? "border-info-line bg-info-subtle text-info" : "border-line-subtle bg-surface-muted text-fg"),
|
|
948
|
+
children: [n, e]
|
|
949
|
+
})),
|
|
950
|
+
Divider: t(J.Divider, "A quiet separator.", () => /* @__PURE__ */ L("hr", { className: "border-line-subtle" })),
|
|
951
|
+
Spacer: t(J.Spacer, "Flexible space.", () => /* @__PURE__ */ L("span", { className: "flex-1" })),
|
|
952
|
+
Accent: t(J.Accent, "A neutral event marker.", () => /* @__PURE__ */ L("span", {
|
|
953
|
+
"aria-hidden": !0,
|
|
954
|
+
className: "h-control-sm w-1 rounded-full bg-line-emphasis"
|
|
955
|
+
})),
|
|
956
|
+
Icon: t(J.Icon, "A supporting decorative symbol.", (e) => /* @__PURE__ */ L(Ne, { ...e })),
|
|
957
|
+
Image: t(J.Image, "A host-approved image with an alternative.", (t) => /* @__PURE__ */ L(Fe, {
|
|
958
|
+
...t,
|
|
959
|
+
...e
|
|
960
|
+
}, t.src)),
|
|
961
|
+
Avatar: t(J.Avatar, "Initials for a person.", ({ name: e }) => /* @__PURE__ */ L("span", {
|
|
962
|
+
role: "img",
|
|
963
|
+
"aria-label": e,
|
|
964
|
+
className: "grid size-avatar-lg shrink-0 place-items-center rounded-full bg-surface-emphasis type-label text-fg-emphasis",
|
|
965
|
+
children: e.split(/\s+/).slice(0, 2).map((e) => e[0]).join("")
|
|
966
|
+
})),
|
|
967
|
+
Alert: t(J.Alert, "A contextual message.", ({ title: e, description: t, tone: n }) => /* @__PURE__ */ L(f, {
|
|
968
|
+
title: e,
|
|
969
|
+
tone: n === "warning" ? "attention" : n === "danger" ? "error" : n,
|
|
970
|
+
children: t
|
|
971
|
+
})),
|
|
972
|
+
ListView: t(J.ListView, "A set of related rows.", ({ children: e }) => /* @__PURE__ */ L("ul", {
|
|
973
|
+
className: "flex list-none flex-col divide-y divide-line-subtle p-0",
|
|
974
|
+
children: e
|
|
975
|
+
})),
|
|
976
|
+
ListViewItem: t(J.ListViewItem, "A passive list row. Put explicit buttons within it.", ({ children: e }) => /* @__PURE__ */ L("li", {
|
|
977
|
+
className: "min-w-0 py-3 first:pt-0 last:pb-0",
|
|
978
|
+
children: e
|
|
979
|
+
})),
|
|
980
|
+
Input: t(J.Input, "A labelled text field.", (e) => /* @__PURE__ */ L(Te, { ...e })),
|
|
981
|
+
Select: t(J.Select, "A labelled choice.", (e) => /* @__PURE__ */ L(Ee, { ...e })),
|
|
982
|
+
DatePicker: t(J.DatePicker, "A calendar date, with segmented keyboard input.", (e) => /* @__PURE__ */ L(De, { ...e })),
|
|
983
|
+
RadioGroup: t(J.RadioGroup, "A small set of choices.", (e) => /* @__PURE__ */ L(Oe, { ...e })),
|
|
984
|
+
Checkbox: t(J.Checkbox, "An optional choice.", (e) => /* @__PURE__ */ L(ke, { ...e })),
|
|
985
|
+
Button: t(J.Button, "An explicit action routed to the host.", ({ $action: e, $dispatch: t, children: n, ...r }) => /* @__PURE__ */ L(Le, {
|
|
986
|
+
...r,
|
|
987
|
+
action: e,
|
|
988
|
+
dispatch: t,
|
|
989
|
+
children: n
|
|
990
|
+
})),
|
|
991
|
+
Progress: t(J.Progress, "A labelled measure of progress.", ({ label: e, value: t, max: n }) => /* @__PURE__ */ L(se, {
|
|
992
|
+
"aria-label": e,
|
|
993
|
+
value: t,
|
|
994
|
+
maxValue: n,
|
|
995
|
+
className: "h-1.5 overflow-hidden rounded-full bg-surface-emphasis",
|
|
996
|
+
children: /* @__PURE__ */ L("div", {
|
|
997
|
+
className: "h-full rounded-full bg-brand",
|
|
998
|
+
style: { width: `${t / n * 100}%` }
|
|
999
|
+
})
|
|
1000
|
+
})),
|
|
1001
|
+
Chart: t(J.Chart, "A bounded chart with a data-table alternative.", (e) => /* @__PURE__ */ L(Se, { ...e })),
|
|
1002
|
+
Table: t(J.Table, "A bounded data table, optionally sortable.", (e) => /* @__PURE__ */ L(xe, { ...e }))
|
|
1003
|
+
};
|
|
1004
|
+
}
|
|
1005
|
+
function Le({ label: e, buttonStyle: t, block: n, submit: i, children: a, action: o, dispatch: s }) {
|
|
1006
|
+
let { blocked: c, available: u, captureInput: d } = w(X), f = w(Z);
|
|
1007
|
+
return /* @__PURE__ */ R(l, {
|
|
1008
|
+
type: i ? "submit" : "button",
|
|
1009
|
+
variant: t === "danger" ? "destructive" : t === "primary" ? "primary" : t === "ghost" ? "ghost" : "secondary",
|
|
1010
|
+
className: r("h-auto min-h-control-md max-w-full py-control-y wrap-anywhere whitespace-normal", n && "w-full"),
|
|
1011
|
+
isDisabled: c || !s || (i ? !f?.canSubmit : !o || !(!u || u.has(o.type))),
|
|
1012
|
+
onPress: i ? void 0 : () => {
|
|
1013
|
+
o && (f && d?.({
|
|
1014
|
+
...o,
|
|
1015
|
+
$input: Ce(f.fields).values
|
|
1016
|
+
}), s?.(o));
|
|
1017
|
+
},
|
|
1018
|
+
children: [a, e]
|
|
1019
|
+
});
|
|
1020
|
+
}
|
|
1021
|
+
//#endregion
|
|
1022
|
+
//#region src/reusable/generative/actions.ts
|
|
1023
|
+
var Re = z.strictObject({
|
|
1024
|
+
key: z.string().min(1).max(160),
|
|
1025
|
+
type: z.string().min(1).max(160),
|
|
1026
|
+
state: z.enum(["complete", "not-applied"]),
|
|
1027
|
+
message: z.string().min(1).max(1e3)
|
|
1028
|
+
});
|
|
1029
|
+
function ze(e) {
|
|
1030
|
+
return e && typeof e == "object" && (Object.values(e).forEach(ze), Object.freeze(e)), e;
|
|
1031
|
+
}
|
|
1032
|
+
function Be(e, t = () => crypto.randomUUID()) {
|
|
1033
|
+
let n = Object.fromEntries(Object.entries(e).map(([e, t]) => [e, { ...t }])), r = { stage: "ready" }, i, a = !1, o = /* @__PURE__ */ new Set(), s = (e) => {
|
|
1034
|
+
a || (r = ze(e), o.forEach((e) => e()));
|
|
1035
|
+
}, c = () => r.request && Object.hasOwn(n, r.request.action.type) ? n[r.request.action.type] : void 0, l = async (e = !1) => {
|
|
1036
|
+
let t = c(), n = r.request;
|
|
1037
|
+
if (a || !t || !n || i) return;
|
|
1038
|
+
let o = r, l = new AbortController();
|
|
1039
|
+
i = l, s({
|
|
1040
|
+
...o,
|
|
1041
|
+
stage: e ? "checking" : "submitting",
|
|
1042
|
+
message: void 0,
|
|
1043
|
+
noReceipt: !1
|
|
1044
|
+
});
|
|
1045
|
+
try {
|
|
1046
|
+
let r = e ? await t.lookup?.(n, l.signal) : await t.execute(n, l.signal);
|
|
1047
|
+
if (a || i !== l) return;
|
|
1048
|
+
if (r == null) {
|
|
1049
|
+
if (!e) throw Error("Missing receipt");
|
|
1050
|
+
s({
|
|
1051
|
+
...o,
|
|
1052
|
+
stage: "uncertain",
|
|
1053
|
+
noReceipt: !0
|
|
1054
|
+
});
|
|
1055
|
+
} else {
|
|
1056
|
+
let e = Re.parse(r);
|
|
1057
|
+
if (e.key !== n.key || e.type !== n.action.type) throw Error("Receipt does not match");
|
|
1058
|
+
s({
|
|
1059
|
+
...o,
|
|
1060
|
+
stage: e.state === "complete" ? "complete" : "failed",
|
|
1061
|
+
message: e.message,
|
|
1062
|
+
noReceipt: !1
|
|
1063
|
+
});
|
|
1064
|
+
}
|
|
1065
|
+
} catch {
|
|
1066
|
+
!a && i === l && s({
|
|
1067
|
+
...o,
|
|
1068
|
+
stage: "uncertain",
|
|
1069
|
+
message: void 0
|
|
1070
|
+
});
|
|
1071
|
+
} finally {
|
|
1072
|
+
i === l && (i = void 0);
|
|
1073
|
+
}
|
|
1074
|
+
};
|
|
1075
|
+
return {
|
|
1076
|
+
subscribe: (e) => (o.add(e), () => {
|
|
1077
|
+
o.delete(e);
|
|
1078
|
+
}),
|
|
1079
|
+
getSnapshot: () => r,
|
|
1080
|
+
request: (e) => {
|
|
1081
|
+
if (a || r.stage !== "ready") return !1;
|
|
1082
|
+
try {
|
|
1083
|
+
be(e, 8e3);
|
|
1084
|
+
} catch {
|
|
1085
|
+
return !1;
|
|
1086
|
+
}
|
|
1087
|
+
let i = K.safeParse(e);
|
|
1088
|
+
if (!i.success || JSON.stringify(i.data).length > 8e3) return !1;
|
|
1089
|
+
let o = Object.hasOwn(n, i.data.type) ? n[i.data.type] : void 0;
|
|
1090
|
+
if (!o) return !1;
|
|
1091
|
+
if (o.kind === "dismiss") return s({
|
|
1092
|
+
stage: "dismissed",
|
|
1093
|
+
message: o.label
|
|
1094
|
+
}), !0;
|
|
1095
|
+
let c = t();
|
|
1096
|
+
if (typeof c != "string" || !c || c.length > 160) return !1;
|
|
1097
|
+
let u = ze({
|
|
1098
|
+
key: c,
|
|
1099
|
+
action: structuredClone(i.data)
|
|
1100
|
+
});
|
|
1101
|
+
return s({
|
|
1102
|
+
stage: o.kind === "mutate" ? "confirm" : "ready",
|
|
1103
|
+
request: u,
|
|
1104
|
+
label: o.label,
|
|
1105
|
+
description: o.description
|
|
1106
|
+
}), o.kind === "inspect" && l(), !0;
|
|
1107
|
+
},
|
|
1108
|
+
confirm: () => r.stage === "confirm" && (l(), !0),
|
|
1109
|
+
back: () => ["confirm", "failed"].includes(r.stage) ? (s({ stage: "ready" }), !0) : !1,
|
|
1110
|
+
retry: () => ["failed", "uncertain"].includes(r.stage) ? (l(), !0) : !1,
|
|
1111
|
+
check: () => r.stage !== "uncertain" || !c()?.lookup ? !1 : (l(!0), !0),
|
|
1112
|
+
reset: () => ["complete", "dismissed"].includes(r.stage) ? (s({ stage: "ready" }), !0) : !1,
|
|
1113
|
+
dispose: () => {
|
|
1114
|
+
a = !0, i?.abort(), i = void 0, o.clear();
|
|
1115
|
+
}
|
|
1116
|
+
};
|
|
1117
|
+
}
|
|
1118
|
+
V.noHandler;
|
|
1119
|
+
//#endregion
|
|
1120
|
+
//#region src/reusable/generative/timeline.tsx
|
|
1121
|
+
function Ve({ controller: e, spec: t, status: n, actions: r, copy: i, children: a }) {
|
|
1122
|
+
let [o, s] = O(() => [{
|
|
1123
|
+
snapshot: e.getSnapshot(),
|
|
1124
|
+
spec: t,
|
|
1125
|
+
status: n
|
|
1126
|
+
}]), c = D(null), [l] = O(() => (e) => {
|
|
1127
|
+
let t = c.current;
|
|
1128
|
+
t?.terminal || (c.current = e, t && t.phase !== e.phase && s((n) => {
|
|
1129
|
+
let r = n[n.length - 1];
|
|
1130
|
+
return r ? [
|
|
1131
|
+
...n.slice(0, -1),
|
|
1132
|
+
{
|
|
1133
|
+
...r,
|
|
1134
|
+
result: /* @__PURE__ */ L("div", {
|
|
1135
|
+
"data-generative-result": !0,
|
|
1136
|
+
className: "rounded-surface border border-line-subtle bg-surface p-5 sm:p-6",
|
|
1137
|
+
children: h(t.node)
|
|
1138
|
+
})
|
|
1139
|
+
},
|
|
1140
|
+
{
|
|
1141
|
+
...r,
|
|
1142
|
+
result: /* @__PURE__ */ L("div", {
|
|
1143
|
+
"data-generative-result": !0,
|
|
1144
|
+
className: "rounded-surface border border-line-subtle bg-surface p-5 sm:p-6",
|
|
1145
|
+
children: e.node
|
|
1146
|
+
}),
|
|
1147
|
+
label: e.label
|
|
1148
|
+
}
|
|
1149
|
+
] : n;
|
|
1150
|
+
}));
|
|
1151
|
+
}), u = D({
|
|
1152
|
+
spec: t,
|
|
1153
|
+
status: n
|
|
1154
|
+
}), d = D(void 0), f = D(-1), p = D(!1), m = D(null), _ = D(e.getSnapshot());
|
|
1155
|
+
T(() => {
|
|
1156
|
+
u.current = {
|
|
1157
|
+
spec: t,
|
|
1158
|
+
status: n
|
|
1159
|
+
};
|
|
1160
|
+
}, [t, n]), T(() => {
|
|
1161
|
+
let t = () => {
|
|
1162
|
+
let t = e.getSnapshot();
|
|
1163
|
+
if (_.current === t || _.current.stage === "complete" || _.current.stage === "dismissed" || (_.current = t, t.stage === "ready" && t.request)) return;
|
|
1164
|
+
let n = {
|
|
1165
|
+
snapshot: t,
|
|
1166
|
+
...u.current,
|
|
1167
|
+
input: d.current
|
|
1168
|
+
};
|
|
1169
|
+
s((e) => [...e, n]);
|
|
1170
|
+
};
|
|
1171
|
+
return t(), e.subscribe(t);
|
|
1172
|
+
}, [e]), T(() => {
|
|
1173
|
+
if (!p.current) return;
|
|
1174
|
+
let e = m.current?.querySelector("[data-current=\"true\"]");
|
|
1175
|
+
e && (o[o.length - 1]?.snapshot.stage === "ready" ? (e.querySelectorAll("[data-generative-content] button")[f.current] ?? e).focus({ preventScroll: !0 }) : (e.querySelector("[data-generative-action]") ?? e).focus({ preventScroll: !0 }), e.scrollIntoView({
|
|
1176
|
+
block: "nearest",
|
|
1177
|
+
behavior: "instant"
|
|
1178
|
+
}));
|
|
1179
|
+
}, [o]);
|
|
1180
|
+
let v = (e) => {
|
|
1181
|
+
let t = K.safeParse(e), n = t.success ? t.data.$input : void 0;
|
|
1182
|
+
n && typeof n == "object" && !Array.isArray(n) && (d.current = Object.fromEntries(Object.entries(n).filter((e) => typeof e[1] == "string" || typeof e[1] == "boolean")));
|
|
1183
|
+
let r = m.current?.querySelector("[data-current=\"true\"]");
|
|
1184
|
+
f.current = Array.from(r?.querySelectorAll("[data-generative-content] button") ?? []).indexOf(document.activeElement), p.current = !0;
|
|
1185
|
+
};
|
|
1186
|
+
function y(e) {
|
|
1187
|
+
if (e.label) return e.label;
|
|
1188
|
+
let t = e.snapshot.stage;
|
|
1189
|
+
return t === "ready" ? e.status === "done" ? i.stepReady : i.stepLoading : t === "submitting" ? e.snapshot.request && r[e.snapshot.request.action.type]?.kind === "inspect" ? i.stepLoading : i.working : {
|
|
1190
|
+
confirm: i.stepReview,
|
|
1191
|
+
checking: i.checking,
|
|
1192
|
+
failed: i.stepFailed,
|
|
1193
|
+
uncertain: i.stepUncertain,
|
|
1194
|
+
complete: i.stepResult,
|
|
1195
|
+
dismissed: i.dismissed
|
|
1196
|
+
}[t];
|
|
1197
|
+
}
|
|
1198
|
+
return /* @__PURE__ */ L("div", {
|
|
1199
|
+
ref: m,
|
|
1200
|
+
"data-generative-timeline": !0,
|
|
1201
|
+
className: "mx-auto flex w-full max-w-2xl min-w-0 flex-col gap-20",
|
|
1202
|
+
children: o.map((e, r) => {
|
|
1203
|
+
let s = r === o.length - 1, c = s && e.snapshot.stage === "ready" ? {
|
|
1204
|
+
...e,
|
|
1205
|
+
spec: r === 0 ? t : e.spec,
|
|
1206
|
+
status: n
|
|
1207
|
+
} : e;
|
|
1208
|
+
return /* @__PURE__ */ R("div", {
|
|
1209
|
+
"data-generative-step": e.snapshot.stage,
|
|
1210
|
+
"data-current": s,
|
|
1211
|
+
tabIndex: -1,
|
|
1212
|
+
className: "relative min-w-0 scroll-mt-6 outline-none",
|
|
1213
|
+
children: [
|
|
1214
|
+
r > 0 ? /* @__PURE__ */ L(b, {}) : null,
|
|
1215
|
+
/* @__PURE__ */ R("p", {
|
|
1216
|
+
className: "mb-3 flex items-center gap-3 font-mono type-caption text-system-blue",
|
|
1217
|
+
children: [
|
|
1218
|
+
/* @__PURE__ */ L("span", { children: String(r + 1).padStart(2, "0") }),
|
|
1219
|
+
/* @__PURE__ */ L("span", { children: y(c) }),
|
|
1220
|
+
s ? null : /* @__PURE__ */ L("span", {
|
|
1221
|
+
className: "ml-auto",
|
|
1222
|
+
children: i.stepPast
|
|
1223
|
+
})
|
|
1224
|
+
]
|
|
1225
|
+
}),
|
|
1226
|
+
/* @__PURE__ */ L("div", {
|
|
1227
|
+
inert: !s,
|
|
1228
|
+
"aria-hidden": !s,
|
|
1229
|
+
children: /* @__PURE__ */ L(ee.Provider, {
|
|
1230
|
+
value: !s,
|
|
1231
|
+
children: /* @__PURE__ */ L(g, {
|
|
1232
|
+
publish: l,
|
|
1233
|
+
children: e.result ?? /* @__PURE__ */ L(He, {
|
|
1234
|
+
step: c,
|
|
1235
|
+
render: a,
|
|
1236
|
+
onRequest: v
|
|
1237
|
+
})
|
|
1238
|
+
})
|
|
1239
|
+
})
|
|
1240
|
+
})
|
|
1241
|
+
]
|
|
1242
|
+
}, r);
|
|
1243
|
+
})
|
|
1244
|
+
});
|
|
1245
|
+
}
|
|
1246
|
+
function He({ step: e, render: t, onRequest: n }) {
|
|
1247
|
+
return t(e, n);
|
|
1248
|
+
}
|
|
1249
|
+
//#endregion
|
|
1250
|
+
//#region src/reusable/generative/index.tsx
|
|
1251
|
+
var Ue = {};
|
|
1252
|
+
function We(e) {
|
|
1253
|
+
return /* @__PURE__ */ L(_, { children: /* @__PURE__ */ L(Ge, { ...e }, e.responseId) }, e.responseId);
|
|
1254
|
+
}
|
|
1255
|
+
function Ge(e) {
|
|
1256
|
+
let [t] = O(() => Be(e.actions ?? Ue)), n = e.controller ?? t, r = re(n.subscribe, n.getSnapshot, n.getSnapshot), i = Ke(e, n), a = D(0);
|
|
1257
|
+
return T(() => {
|
|
1258
|
+
let n = a, r = ++n.current;
|
|
1259
|
+
return () => {
|
|
1260
|
+
queueMicrotask(() => {
|
|
1261
|
+
n.current === r && !e.controller && t.dispose();
|
|
1262
|
+
});
|
|
1263
|
+
};
|
|
1264
|
+
}, [e.controller, t]), e.retainSteps ? /* @__PURE__ */ L(Ve, {
|
|
1265
|
+
controller: n,
|
|
1266
|
+
spec: e.spec,
|
|
1267
|
+
status: e.status ?? "done",
|
|
1268
|
+
actions: e.actions ?? Ue,
|
|
1269
|
+
copy: e.copy ?? V,
|
|
1270
|
+
children: (t, r) => /* @__PURE__ */ L($, {
|
|
1271
|
+
...e,
|
|
1272
|
+
spec: t.spec,
|
|
1273
|
+
status: t.status,
|
|
1274
|
+
controller: n,
|
|
1275
|
+
snapshot: t.snapshot,
|
|
1276
|
+
actionOnly: t.snapshot.stage !== "ready",
|
|
1277
|
+
onRequest: r,
|
|
1278
|
+
inputSnapshot: t.input
|
|
1279
|
+
})
|
|
1280
|
+
}) : /* @__PURE__ */ L($, {
|
|
1281
|
+
...e,
|
|
1282
|
+
controller: n,
|
|
1283
|
+
snapshot: r,
|
|
1284
|
+
onRequest: i
|
|
1285
|
+
});
|
|
1286
|
+
}
|
|
1287
|
+
function Ke(e, t) {
|
|
1288
|
+
let n = v(), r = te(), i = D(e), a = D(void 0), o = D(null);
|
|
1289
|
+
E(() => {
|
|
1290
|
+
i.current = e;
|
|
1291
|
+
}, [e]);
|
|
1292
|
+
let s = C((e, s = !1) => {
|
|
1293
|
+
if (!n || !s && o.current === e || o.current?.stage === "complete" || o.current?.stage === "dismissed" || e.stage === "ready" && e.request) return;
|
|
1294
|
+
o.current = e;
|
|
1295
|
+
let c = i.current, l = c.copy ?? V, u = c.status ?? "done", d = u;
|
|
1296
|
+
if (u === "done") {
|
|
1297
|
+
if (c.spec == null) d = "empty";
|
|
1298
|
+
else try {
|
|
1299
|
+
Y(c.spec);
|
|
1300
|
+
} catch {
|
|
1301
|
+
d = "invalid";
|
|
1302
|
+
}
|
|
1303
|
+
}
|
|
1304
|
+
let f = e.request && c.actions?.[e.request.action.type]?.kind === "inspect", p = {
|
|
1305
|
+
ready: d === "empty" ? l.empty : d === "invalid" || u === "error" ? l.invalid : u === "done" ? l.stepReady : l.stepLoading,
|
|
1306
|
+
confirm: l.stepReview,
|
|
1307
|
+
submitting: f ? l.stepLoading : l.working,
|
|
1308
|
+
checking: l.checking,
|
|
1309
|
+
failed: l.stepFailed,
|
|
1310
|
+
uncertain: l.stepUncertain,
|
|
1311
|
+
complete: l.stepResult,
|
|
1312
|
+
dismissed: l.dismissed
|
|
1313
|
+
}, m = e.stage === "complete" && e.request ? c.renderResult?.(e.request) : null;
|
|
1314
|
+
n({
|
|
1315
|
+
phase: `generative-${e.stage}-${d}`,
|
|
1316
|
+
label: p[e.stage],
|
|
1317
|
+
className: "max-w-2xl",
|
|
1318
|
+
yieldToChild: !!m,
|
|
1319
|
+
terminal: e.stage === "dismissed" || e.stage === "complete" && !m,
|
|
1320
|
+
node: /* @__PURE__ */ L($, {
|
|
1321
|
+
...c,
|
|
1322
|
+
controller: t,
|
|
1323
|
+
snapshot: e,
|
|
1324
|
+
retainSteps: !0,
|
|
1325
|
+
actionOnly: e.stage !== "ready",
|
|
1326
|
+
inputSnapshot: a.current
|
|
1327
|
+
}, JSON.stringify(a.current))
|
|
1328
|
+
}, r);
|
|
1329
|
+
}, [
|
|
1330
|
+
n,
|
|
1331
|
+
r,
|
|
1332
|
+
t
|
|
1333
|
+
]);
|
|
1334
|
+
return T(() => {
|
|
1335
|
+
if (n) return s(t.getSnapshot(), !0), t.subscribe(() => s(t.getSnapshot()));
|
|
1336
|
+
}, [
|
|
1337
|
+
n,
|
|
1338
|
+
s,
|
|
1339
|
+
t,
|
|
1340
|
+
e.spec,
|
|
1341
|
+
e.status
|
|
1342
|
+
]), (e) => {
|
|
1343
|
+
if (!n || !e || typeof e != "object") return;
|
|
1344
|
+
let r = e.$input;
|
|
1345
|
+
r && typeof r == "object" && !Array.isArray(r) && (a.current = Object.fromEntries(Object.entries(r).filter((e) => typeof e[1] == "string" || typeof e[1] == "boolean")), s(t.getSnapshot(), !0));
|
|
1346
|
+
};
|
|
1347
|
+
}
|
|
1348
|
+
function $({ spec: e, status: t = "done", actions: n = Ue, controller: r, snapshot: i, actionOnly: a = !1, retainSteps: o = !1, inputSnapshot: s, onRequest: c, onRetry: d, renderResult: p, resolveImage: m, resolveFact: h, copy: g = V, className: _ }) {
|
|
1349
|
+
let v = ne(() => Ie({
|
|
1350
|
+
resolveImage: m,
|
|
1351
|
+
resolveFact: h
|
|
1352
|
+
}), [m, h]), y;
|
|
1353
|
+
try {
|
|
1354
|
+
e != null && (y = Y(e));
|
|
1355
|
+
} catch {}
|
|
1356
|
+
let [b, ee] = O(), x = [
|
|
1357
|
+
"confirm",
|
|
1358
|
+
"submitting",
|
|
1359
|
+
"failed",
|
|
1360
|
+
"uncertain",
|
|
1361
|
+
"checking"
|
|
1362
|
+
].includes(i.stage), S = x ? b ?? y : y, C = te(), w = D(null), [E, re] = O(null), [ie, ae] = O(!1), k = i.stage === "complete" && i.request ? p?.(i.request) : null, A = k != null && k !== !1, j = i.request && n[i.request.action.type]?.kind === "inspect", M = D(i.stage);
|
|
1363
|
+
T(() => {
|
|
1364
|
+
M.current !== i.stage && M.current === "ready" && i.stage !== "ready" && E && w.current?.focus({ preventScroll: !0 }), M.current !== i.stage && A && E && w.current?.focus(), M.current !== i.stage && i.stage === "ready" && E?.focus({ preventScroll: !0 }), M.current = i.stage;
|
|
1365
|
+
}, [
|
|
1366
|
+
i.stage,
|
|
1367
|
+
E,
|
|
1368
|
+
A
|
|
1369
|
+
]);
|
|
1370
|
+
let N = (e) => {
|
|
1371
|
+
c?.(e), re(document.activeElement), ee(y), ae(!r.request(e));
|
|
1372
|
+
}, oe = x && b !== void 0 && JSON.stringify(y) !== JSON.stringify(b), P = i.request?.action, F = P ? Object.entries(P).flatMap(([e, t]) => e === "type" ? [] : ["$input", "$bindings"].includes(e) && t && typeof t == "object" && !Array.isArray(t) ? Object.entries(t) : [[e, t]]) : [];
|
|
1373
|
+
return /* @__PURE__ */ R("section", {
|
|
1374
|
+
"aria-labelledby": C,
|
|
1375
|
+
className: `wrap-anywhere ${_ ?? ""}`,
|
|
1376
|
+
"data-structured-response": !0,
|
|
1377
|
+
children: [/* @__PURE__ */ L("h2", {
|
|
1378
|
+
id: C,
|
|
1379
|
+
className: "sr-only",
|
|
1380
|
+
children: g.input
|
|
1381
|
+
}), /* @__PURE__ */ R("div", {
|
|
1382
|
+
className: "mx-auto flex w-full max-w-2xl min-w-0 flex-col gap-4",
|
|
1383
|
+
children: [
|
|
1384
|
+
oe ? /* @__PURE__ */ L(f, { children: g.updated }) : null,
|
|
1385
|
+
ie ? /* @__PURE__ */ L(f, {
|
|
1386
|
+
tone: "error",
|
|
1387
|
+
live: "assertive",
|
|
1388
|
+
title: g.actionInvalid,
|
|
1389
|
+
children: g.actionInvalidNote
|
|
1390
|
+
}) : null,
|
|
1391
|
+
a ? null : x || t === "done" ? S ? /* @__PURE__ */ L(X.Provider, {
|
|
1392
|
+
value: {
|
|
1393
|
+
blocked: i.stage !== "ready",
|
|
1394
|
+
available: new Set(Object.keys(n)),
|
|
1395
|
+
captureInput: c,
|
|
1396
|
+
initialValues: s
|
|
1397
|
+
},
|
|
1398
|
+
children: /* @__PURE__ */ L("div", {
|
|
1399
|
+
className: S.$type === "Form" ? "min-w-0 rounded-surface border border-line-subtle bg-surface p-5 shadow-control sm:p-6" : "min-w-0",
|
|
1400
|
+
hidden: i.stage !== "ready",
|
|
1401
|
+
"data-generative-content": !0,
|
|
1402
|
+
children: pe(S, v, {
|
|
1403
|
+
status: "done",
|
|
1404
|
+
dispatch: N
|
|
1405
|
+
})
|
|
1406
|
+
})
|
|
1407
|
+
}) : /* @__PURE__ */ L(f, {
|
|
1408
|
+
tone: e == null ? "neutral" : "error",
|
|
1409
|
+
title: e == null ? g.empty : g.invalid,
|
|
1410
|
+
actions: d ? /* @__PURE__ */ L(l, {
|
|
1411
|
+
onPress: d,
|
|
1412
|
+
children: g.retry
|
|
1413
|
+
}) : void 0,
|
|
1414
|
+
children: e == null ? void 0 : g.invalidNote
|
|
1415
|
+
}) : t === "error" ? /* @__PURE__ */ L(f, {
|
|
1416
|
+
tone: "error",
|
|
1417
|
+
title: g.invalid,
|
|
1418
|
+
actions: d ? /* @__PURE__ */ L(l, {
|
|
1419
|
+
onPress: d,
|
|
1420
|
+
children: g.retry
|
|
1421
|
+
}) : void 0,
|
|
1422
|
+
children: g.invalidNote
|
|
1423
|
+
}) : /* @__PURE__ */ R("div", {
|
|
1424
|
+
role: "status",
|
|
1425
|
+
className: "flex flex-col gap-4 rounded-surface border border-line-subtle bg-surface p-6",
|
|
1426
|
+
children: [
|
|
1427
|
+
/* @__PURE__ */ R("div", {
|
|
1428
|
+
className: "flex items-center gap-3 type-body text-fg",
|
|
1429
|
+
children: [/* @__PURE__ */ L(u, {}), g.loading]
|
|
1430
|
+
}),
|
|
1431
|
+
t === "streaming" ? /* @__PURE__ */ L("p", {
|
|
1432
|
+
className: "type-body text-fg-subtle",
|
|
1433
|
+
children: g.streaming
|
|
1434
|
+
}) : null,
|
|
1435
|
+
/* @__PURE__ */ R("div", {
|
|
1436
|
+
"aria-hidden": !0,
|
|
1437
|
+
className: "flex flex-col gap-3",
|
|
1438
|
+
children: [
|
|
1439
|
+
/* @__PURE__ */ L("span", { className: "h-control-md w-full rounded-control bg-surface-subtle" }),
|
|
1440
|
+
/* @__PURE__ */ L("span", { className: "h-4 w-2/3 rounded-cell bg-surface-subtle" }),
|
|
1441
|
+
/* @__PURE__ */ L("span", { className: "h-4 w-1/2 rounded-cell bg-surface-subtle" })
|
|
1442
|
+
]
|
|
1443
|
+
})
|
|
1444
|
+
]
|
|
1445
|
+
}),
|
|
1446
|
+
i.stage === "ready" ? null : /* @__PURE__ */ L("div", {
|
|
1447
|
+
ref: w,
|
|
1448
|
+
tabIndex: -1,
|
|
1449
|
+
className: "rounded-surface border border-line-subtle bg-surface p-5 outline-none focus-visible:focus-ring sm:p-6",
|
|
1450
|
+
"data-generative-action": !0,
|
|
1451
|
+
children: A ? /* @__PURE__ */ R("div", {
|
|
1452
|
+
className: "flex flex-col gap-5",
|
|
1453
|
+
"data-generative-result": !0,
|
|
1454
|
+
children: [o ? null : /* @__PURE__ */ L(l, {
|
|
1455
|
+
size: "sm",
|
|
1456
|
+
variant: "ghost",
|
|
1457
|
+
className: "self-start",
|
|
1458
|
+
onPress: () => r.reset(),
|
|
1459
|
+
children: g.back
|
|
1460
|
+
}), k]
|
|
1461
|
+
}) : j && ["submitting", "checking"].includes(i.stage) ? /* @__PURE__ */ R("div", {
|
|
1462
|
+
role: "status",
|
|
1463
|
+
className: "flex items-center gap-3 type-body text-fg",
|
|
1464
|
+
children: [/* @__PURE__ */ L(u, {}), i.stage === "checking" ? g.checking : g.loading]
|
|
1465
|
+
}) : [
|
|
1466
|
+
"confirm",
|
|
1467
|
+
"submitting",
|
|
1468
|
+
"checking"
|
|
1469
|
+
].includes(i.stage) ? /* @__PURE__ */ R("div", {
|
|
1470
|
+
className: "flex flex-col gap-4",
|
|
1471
|
+
children: [
|
|
1472
|
+
/* @__PURE__ */ L("p", {
|
|
1473
|
+
className: "font-mono type-caption text-fg-subtle",
|
|
1474
|
+
children: g.review
|
|
1475
|
+
}),
|
|
1476
|
+
/* @__PURE__ */ L("h3", {
|
|
1477
|
+
className: "type-heading text-fg-emphasis",
|
|
1478
|
+
children: i.label
|
|
1479
|
+
}),
|
|
1480
|
+
/* @__PURE__ */ L("p", {
|
|
1481
|
+
className: "type-body text-fg",
|
|
1482
|
+
children: i.description
|
|
1483
|
+
}),
|
|
1484
|
+
F.length ? /* @__PURE__ */ L("dl", {
|
|
1485
|
+
className: "flex flex-col gap-3 border-y border-line-subtle py-4",
|
|
1486
|
+
children: F.map(([e, t], n) => /* @__PURE__ */ R("div", {
|
|
1487
|
+
className: "flex flex-col gap-1",
|
|
1488
|
+
children: [/* @__PURE__ */ L("dt", {
|
|
1489
|
+
className: "font-mono type-caption text-fg-subtle",
|
|
1490
|
+
children: String(e).replace(/^\$/, "").replace(/([A-Z])/g, " $1").replace(/^./, (e) => e.toUpperCase())
|
|
1491
|
+
}), /* @__PURE__ */ L("dd", {
|
|
1492
|
+
className: "type-body wrap-anywhere whitespace-pre-wrap text-fg-emphasis",
|
|
1493
|
+
children: t && typeof t == "object" ? JSON.stringify(t, null, 2) : String(t)
|
|
1494
|
+
})]
|
|
1495
|
+
}, n))
|
|
1496
|
+
}) : null,
|
|
1497
|
+
/* @__PURE__ */ R("div", {
|
|
1498
|
+
className: "flex flex-wrap gap-3",
|
|
1499
|
+
children: [/* @__PURE__ */ R(l, {
|
|
1500
|
+
variant: "primary",
|
|
1501
|
+
isDisabled: i.stage !== "confirm",
|
|
1502
|
+
"aria-busy": i.stage !== "confirm",
|
|
1503
|
+
"aria-label": i.stage === "checking" ? g.checking : i.stage === "submitting" ? g.working : g.confirm,
|
|
1504
|
+
onPress: () => r.confirm(),
|
|
1505
|
+
children: [i.stage === "confirm" ? null : /* @__PURE__ */ L(u, {}), i.stage === "checking" ? g.checking : i.stage === "submitting" ? g.working : g.confirm]
|
|
1506
|
+
}), /* @__PURE__ */ L(l, {
|
|
1507
|
+
variant: "ghost",
|
|
1508
|
+
isDisabled: i.stage !== "confirm",
|
|
1509
|
+
onPress: () => r.back(),
|
|
1510
|
+
children: g.back
|
|
1511
|
+
})]
|
|
1512
|
+
}),
|
|
1513
|
+
i.stage === "confirm" ? null : /* @__PURE__ */ L("p", {
|
|
1514
|
+
role: "status",
|
|
1515
|
+
className: "sr-only",
|
|
1516
|
+
children: i.stage === "checking" ? g.checking : g.working
|
|
1517
|
+
})
|
|
1518
|
+
]
|
|
1519
|
+
}) : i.stage === "failed" ? /* @__PURE__ */ L(f, {
|
|
1520
|
+
tone: "error",
|
|
1521
|
+
title: g.failed,
|
|
1522
|
+
live: "polite",
|
|
1523
|
+
actions: /* @__PURE__ */ R(I, { children: [/* @__PURE__ */ L(l, {
|
|
1524
|
+
onPress: () => r.retry(),
|
|
1525
|
+
children: g.retry
|
|
1526
|
+
}), /* @__PURE__ */ L(l, {
|
|
1527
|
+
variant: "ghost",
|
|
1528
|
+
onPress: () => r.back(),
|
|
1529
|
+
children: g.back
|
|
1530
|
+
})] }),
|
|
1531
|
+
children: i.message ?? g.failedNote
|
|
1532
|
+
}) : i.stage === "uncertain" ? /* @__PURE__ */ L(f, {
|
|
1533
|
+
tone: "attention",
|
|
1534
|
+
title: g.uncertain,
|
|
1535
|
+
live: "polite",
|
|
1536
|
+
actions: /* @__PURE__ */ R(I, { children: [i.request && n[i.request.action.type]?.lookup ? /* @__PURE__ */ L(l, {
|
|
1537
|
+
onPress: () => r.check(),
|
|
1538
|
+
children: g.check
|
|
1539
|
+
}) : null, /* @__PURE__ */ L(l, {
|
|
1540
|
+
onPress: () => r.retry(),
|
|
1541
|
+
children: g.retry
|
|
1542
|
+
})] }),
|
|
1543
|
+
children: i.noReceipt ? g.noReceipt : g.uncertainNote
|
|
1544
|
+
}) : /* @__PURE__ */ L(f, {
|
|
1545
|
+
tone: i.stage === "complete" ? "success" : "neutral",
|
|
1546
|
+
title: i.stage === "complete" ? g.complete : g.dismissed,
|
|
1547
|
+
live: "polite",
|
|
1548
|
+
actions: o ? void 0 : /* @__PURE__ */ L(l, {
|
|
1549
|
+
onPress: () => r.reset(),
|
|
1550
|
+
children: g.back
|
|
1551
|
+
}),
|
|
1552
|
+
children: i.message
|
|
1553
|
+
})
|
|
1554
|
+
})
|
|
1555
|
+
]
|
|
1556
|
+
})]
|
|
1557
|
+
});
|
|
1558
|
+
}
|
|
1559
|
+
//#endregion
|
|
1560
|
+
export { Se as GenerativeChart, we as GenerativeForm, xe as GenerativeTable, We as StructuredResponse, ve as chartSchema, Be as createGenerativeActionController, Ie as createSuperxdGenerativeLibrary, V as generativeCopy, J as nodeSchemas, Y as parseStructuredSpec, ye as tableSchema };
|