@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.
Files changed (221) hide show
  1. package/GENERATIVE.md +101 -0
  2. package/INTERACTIONS.md +51 -0
  3. package/LICENSE +21 -0
  4. package/README.md +57 -0
  5. package/REUSE.md +170 -0
  6. package/REVIEW.md +68 -0
  7. package/THIRD-PARTY-NOTICES.md +28 -0
  8. package/ai-sdk/index.js +96 -0
  9. package/assets/ibm-plex-mono-cyrillic-400-normal.woff2 +0 -0
  10. package/assets/ibm-plex-mono-cyrillic-500-normal.woff2 +0 -0
  11. package/assets/ibm-plex-mono-cyrillic-ext-400-normal.woff2 +0 -0
  12. package/assets/ibm-plex-mono-cyrillic-ext-500-normal.woff2 +0 -0
  13. package/assets/ibm-plex-mono-latin-400-normal.woff2 +0 -0
  14. package/assets/ibm-plex-mono-latin-500-normal.woff2 +0 -0
  15. package/assets/ibm-plex-mono-latin-ext-400-normal.woff2 +0 -0
  16. package/assets/ibm-plex-mono-latin-ext-500-normal.woff2 +0 -0
  17. package/assets/ibm-plex-mono-vietnamese-400-normal.woff2 +0 -0
  18. package/assets/ibm-plex-mono-vietnamese-500-normal.woff2 +0 -0
  19. package/assets/instrument-sans-latin-ext-wght-normal.woff2 +0 -0
  20. package/assets/instrument-sans-latin-wght-normal.woff2 +0 -0
  21. package/assistant-ui/index.js +139 -0
  22. package/chunks/callout-DKMHSnjc.js +342 -0
  23. package/chunks/canvas-BJ15-XxE.js +598 -0
  24. package/chunks/controller-Cfpg0C7v.js +180 -0
  25. package/chunks/core-BCqVRLUy.js +312 -0
  26. package/chunks/text-field-BLtoaZFn.js +41 -0
  27. package/chunks/types-BGF7r1my.js +115 -0
  28. package/chunks/ui-9DyNsYXY.js +967 -0
  29. package/core/index.js +4 -0
  30. package/custom/index.js +64 -0
  31. package/examples/ai-sdk-backend/package.json +11 -0
  32. package/examples/ai-sdk-backend/server.mjs +316 -0
  33. package/examples/custom-backend/copy.mjs +7 -0
  34. package/examples/custom-backend/server.mjs +118 -0
  35. package/examples/generative/specs.json +2094 -0
  36. package/examples/review-backend/copy.mjs +27 -0
  37. package/examples/review-backend/package.json +11 -0
  38. package/examples/review-backend/server.mjs +276 -0
  39. package/examples/web-ai-sdk/index.html +12 -0
  40. package/examples/web-ai-sdk/package.json +21 -0
  41. package/examples/web-ai-sdk/src/copy.ts +1 -0
  42. package/examples/web-ai-sdk/src/main.tsx +64 -0
  43. package/examples/web-ai-sdk/tsconfig.json +13 -0
  44. package/examples/web-generative/index.html +12 -0
  45. package/examples/web-generative/package.json +23 -0
  46. package/examples/web-generative/src/copy.ts +42 -0
  47. package/examples/web-generative/src/main.tsx +74 -0
  48. package/examples/web-generative/tsconfig.json +14 -0
  49. package/examples/web-independent/index.html +12 -0
  50. package/examples/web-independent/package.json +20 -0
  51. package/examples/web-independent/src/main.tsx +32 -0
  52. package/examples/web-independent/tsconfig.json +14 -0
  53. package/examples/web-interactions/index.html +12 -0
  54. package/examples/web-interactions/package.json +21 -0
  55. package/examples/web-interactions/src/copy.ts +215 -0
  56. package/examples/web-interactions/src/examples.tsx +628 -0
  57. package/examples/web-interactions/src/main.tsx +116 -0
  58. package/examples/web-interactions/tsconfig.json +14 -0
  59. package/examples/web-review/index.html +12 -0
  60. package/examples/web-review/package.json +20 -0
  61. package/examples/web-review/src/main.tsx +59 -0
  62. package/examples/web-review/tsconfig.json +14 -0
  63. package/fonts.css +117 -0
  64. package/generative/index.js +1560 -0
  65. package/interactions/index.js +1591 -0
  66. package/langgraph-review/index.js +36 -0
  67. package/licenses/ai-sdk.txt +13 -0
  68. package/licenses/assistant-ui-generative.txt +21 -0
  69. package/licenses/assistant-ui.txt +23 -0
  70. package/licenses/ibm-plex-mono.txt +93 -0
  71. package/licenses/instrument-sans.txt +93 -0
  72. package/licenses/internationalized-date.txt +201 -0
  73. package/licenses/langgraph.txt +21 -0
  74. package/licenses/lucide.txt +43 -0
  75. package/licenses/react-markdown.txt +21 -0
  76. package/licenses/remark-gfm.txt +22 -0
  77. package/licenses/zod.txt +21 -0
  78. package/package.json +138 -0
  79. package/review/index.js +31 -0
  80. package/source/components/avatar.tsx +50 -0
  81. package/source/components/button.tsx +155 -0
  82. package/source/components/callout.tsx +65 -0
  83. package/source/components/canvas/connector.tsx +14 -0
  84. package/source/components/canvas/copy.ts +34 -0
  85. package/source/components/canvas/index.tsx +257 -0
  86. package/source/components/canvas/recorder.ts +36 -0
  87. package/source/components/date-time-field.tsx +77 -0
  88. package/source/components/flow-motion.tsx +109 -0
  89. package/source/components/icons.tsx +275 -0
  90. package/source/components/responsive-overlay.tsx +91 -0
  91. package/source/components/scenario-picker/copy.ts +5 -0
  92. package/source/components/scenario-picker/index.tsx +142 -0
  93. package/source/components/scroll-area.tsx +59 -0
  94. package/source/components/search-picker.tsx +127 -0
  95. package/source/components/segmented-control.tsx +123 -0
  96. package/source/components/skeleton.tsx +11 -0
  97. package/source/components/spinner.tsx +19 -0
  98. package/source/components/superxd-arrow.tsx +22 -0
  99. package/source/components/switch.tsx +45 -0
  100. package/source/components/text-field.tsx +81 -0
  101. package/source/components/thinking.tsx +16 -0
  102. package/source/components/ui/copy.ts +12 -0
  103. package/source/components/ui/display.tsx +276 -0
  104. package/source/components/ui/navigation.tsx +346 -0
  105. package/source/components/ui/portal-theme.tsx +28 -0
  106. package/source/components/ui/selection.tsx +336 -0
  107. package/source/lib/cn.ts +23 -0
  108. package/source/reusable/ai-sdk/index.ts +114 -0
  109. package/source/reusable/assistant-ui/index.tsx +266 -0
  110. package/source/reusable/core/attachments.ts +163 -0
  111. package/source/reusable/core/index.ts +417 -0
  112. package/source/reusable/custom/index.ts +90 -0
  113. package/source/reusable/generative/actions.ts +188 -0
  114. package/source/reusable/generative/copy.ts +47 -0
  115. package/source/reusable/generative/data.tsx +126 -0
  116. package/source/reusable/generative/index.tsx +517 -0
  117. package/source/reusable/generative/schema.ts +327 -0
  118. package/source/reusable/generative/timeline.tsx +214 -0
  119. package/source/reusable/generative/vocabulary.tsx +847 -0
  120. package/source/reusable/interactions/agent.ts +259 -0
  121. package/source/reusable/interactions/artifact.ts +236 -0
  122. package/source/reusable/interactions/context.tsx +38 -0
  123. package/source/reusable/interactions/copy.ts +117 -0
  124. package/source/reusable/interactions/feedback.ts +73 -0
  125. package/source/reusable/interactions/index.ts +11 -0
  126. package/source/reusable/interactions/presentation.tsx +483 -0
  127. package/source/reusable/interactions/store.ts +74 -0
  128. package/source/reusable/interactions/threads.ts +126 -0
  129. package/source/reusable/interactions/web.tsx +574 -0
  130. package/source/reusable/langgraph-review/index.ts +73 -0
  131. package/source/reusable/review/controller.ts +263 -0
  132. package/source/reusable/review/index.ts +47 -0
  133. package/source/reusable/review/types.ts +189 -0
  134. package/source/reusable/ui/index.ts +25 -0
  135. package/source/reusable/uploads/index.ts +48 -0
  136. package/source/reusable/web/attachments/copy.ts +23 -0
  137. package/source/reusable/web/attachments/index.tsx +233 -0
  138. package/source/reusable/web/copy.ts +22 -0
  139. package/source/reusable/web/index.tsx +470 -0
  140. package/source/reusable/web/message/copy.ts +26 -0
  141. package/source/reusable/web/message/index.tsx +388 -0
  142. package/source/reusable/web/message/streaming.ts +64 -0
  143. package/source/reusable/web/message/styles.css +21 -0
  144. package/source/reusable/web/review/copy.ts +78 -0
  145. package/source/reusable/web/review/flow.ts +24 -0
  146. package/source/reusable/web/review/index.tsx +506 -0
  147. package/source/reusable/web/styles.ts +2 -0
  148. package/source/styles/library.css +612 -0
  149. package/source/styles/theme.css +228 -0
  150. package/styles.css +3 -0
  151. package/styles.d.ts +1 -0
  152. package/types/components/avatar.d.ts +14 -0
  153. package/types/components/button.d.ts +36 -0
  154. package/types/components/callout.d.ts +19 -0
  155. package/types/components/canvas/connector.d.ts +2 -0
  156. package/types/components/canvas/copy.d.ts +34 -0
  157. package/types/components/canvas/index.d.ts +33 -0
  158. package/types/components/canvas/recorder.d.ts +10 -0
  159. package/types/components/date-time-field.d.ts +11 -0
  160. package/types/components/flow-motion.d.ts +38 -0
  161. package/types/components/icons.d.ts +138 -0
  162. package/types/components/responsive-overlay.d.ts +15 -0
  163. package/types/components/scenario-picker/copy.d.ts +5 -0
  164. package/types/components/scenario-picker/index.d.ts +14 -0
  165. package/types/components/scroll-area.d.ts +14 -0
  166. package/types/components/search-picker.d.ts +27 -0
  167. package/types/components/segmented-control.d.ts +23 -0
  168. package/types/components/skeleton.d.ts +4 -0
  169. package/types/components/spinner.d.ts +4 -0
  170. package/types/components/superxd-arrow.d.ts +5 -0
  171. package/types/components/switch.d.ts +8 -0
  172. package/types/components/text-field.d.ts +19 -0
  173. package/types/components/thinking.d.ts +8 -0
  174. package/types/components/ui/copy.d.ts +12 -0
  175. package/types/components/ui/display.d.ts +50 -0
  176. package/types/components/ui/navigation.d.ts +63 -0
  177. package/types/components/ui/portal-theme.d.ts +8 -0
  178. package/types/components/ui/selection.d.ts +37 -0
  179. package/types/lib/cn.d.ts +3 -0
  180. package/types/reusable/ai-sdk/index.d.ts +15 -0
  181. package/types/reusable/assistant-ui/index.d.ts +12 -0
  182. package/types/reusable/core/attachments.d.ts +54 -0
  183. package/types/reusable/core/index.d.ts +107 -0
  184. package/types/reusable/custom/index.d.ts +14 -0
  185. package/types/reusable/generative/actions.d.ts +45 -0
  186. package/types/reusable/generative/copy.d.ts +48 -0
  187. package/types/reusable/generative/data.d.ts +4 -0
  188. package/types/reusable/generative/index.d.ts +30 -0
  189. package/types/reusable/generative/schema.d.ts +303 -0
  190. package/types/reusable/generative/timeline.d.ts +21 -0
  191. package/types/reusable/generative/vocabulary.d.ts +34 -0
  192. package/types/reusable/interactions/agent.d.ts +98 -0
  193. package/types/reusable/interactions/artifact.d.ts +118 -0
  194. package/types/reusable/interactions/context.d.ts +130 -0
  195. package/types/reusable/interactions/copy.d.ts +115 -0
  196. package/types/reusable/interactions/feedback.d.ts +34 -0
  197. package/types/reusable/interactions/index.d.ts +10 -0
  198. package/types/reusable/interactions/presentation.d.ts +97 -0
  199. package/types/reusable/interactions/store.d.ts +29 -0
  200. package/types/reusable/interactions/threads.d.ts +38 -0
  201. package/types/reusable/interactions/web.d.ts +22 -0
  202. package/types/reusable/langgraph-review/index.d.ts +5 -0
  203. package/types/reusable/review/controller.d.ts +52 -0
  204. package/types/reusable/review/index.d.ts +12 -0
  205. package/types/reusable/review/types.d.ts +61 -0
  206. package/types/reusable/ui/index.d.ts +19 -0
  207. package/types/reusable/uploads/index.d.ts +11 -0
  208. package/types/reusable/web/attachments/copy.d.ts +25 -0
  209. package/types/reusable/web/attachments/index.d.ts +24 -0
  210. package/types/reusable/web/copy.d.ts +24 -0
  211. package/types/reusable/web/index.d.ts +41 -0
  212. package/types/reusable/web/message/copy.d.ts +27 -0
  213. package/types/reusable/web/message/index.d.ts +56 -0
  214. package/types/reusable/web/message/streaming.d.ts +27 -0
  215. package/types/reusable/web/review/copy.d.ts +72 -0
  216. package/types/reusable/web/review/flow.d.ts +3 -0
  217. package/types/reusable/web/review/index.d.ts +38 -0
  218. package/types/reusable/web/styles.d.ts +2 -0
  219. package/ui/index.js +4 -0
  220. package/uploads/index.js +34 -0
  221. package/web/index.js +931 -0
@@ -0,0 +1,96 @@
1
+ import { n as e } from "../chunks/core-BCqVRLUy.js";
2
+ import { DefaultChatTransport as t, readUIMessageStream as n } from "ai";
3
+ //#region src/reusable/ai-sdk/index.ts
4
+ function r(e) {
5
+ let t = e.metadata?.aiSdk;
6
+ return {
7
+ id: e.id,
8
+ role: e.role,
9
+ metadata: {
10
+ provider: t?.metadata,
11
+ superxdFiles: e.files ?? []
12
+ },
13
+ parts: [
14
+ ...e.text ? [{
15
+ type: "text",
16
+ text: e.text
17
+ }] : [],
18
+ ...(e.files ?? []).map((e) => ({
19
+ type: "file",
20
+ mediaType: e.mediaType,
21
+ filename: e.name,
22
+ url: e.url
23
+ })),
24
+ ...(t?.parts ?? []).filter((e) => e.type !== "text" && e.type !== "file")
25
+ ]
26
+ };
27
+ }
28
+ function i(i) {
29
+ let a = i.chatId ?? globalThis.crypto.randomUUID(), o = new t({
30
+ api: i.endpoint,
31
+ headers: async () => new Headers(await i.headers?.()),
32
+ credentials: i.credentials ?? "same-origin",
33
+ fetch: i.fetch
34
+ });
35
+ return {
36
+ capabilities: {
37
+ send: !0,
38
+ cancel: !0,
39
+ retry: i.retry ?? !0,
40
+ attachments: !0,
41
+ ...i.conversationActions ? {
42
+ edit: !0,
43
+ regenerate: !0,
44
+ branches: !0
45
+ } : {}
46
+ },
47
+ async *run(t, i) {
48
+ let s = await o.sendMessages({
49
+ trigger: "submit-message",
50
+ chatId: a,
51
+ messageId: t.messages.at(-1)?.id,
52
+ messages: t.messages.map(r),
53
+ abortSignal: i,
54
+ body: { requestId: t.requestId }
55
+ }), c = !1, l = !1, u = s.pipeThrough(new TransformStream({ transform(e, t) {
56
+ if (JSON.stringify(e).length > 2e5) throw Error("SDK part too large");
57
+ if (e.type.startsWith("tool-")) throw Error("Tool capabilities are not supported by this slice");
58
+ e.type === "finish" && (c = !0), e.type === "abort" && (l = !0), t.enqueue(e);
59
+ } })), d = "";
60
+ try {
61
+ for await (let e of n({
62
+ stream: u,
63
+ terminateOnError: !0
64
+ })) {
65
+ if (i.aborted) return;
66
+ let t = e.parts.filter((e) => e.type === "text").map((e) => e.text).join("");
67
+ if (t.length > 1e5) throw Error("Response too large");
68
+ t !== d && (yield t.startsWith(d) ? {
69
+ type: "text",
70
+ text: t.slice(d.length)
71
+ } : {
72
+ type: "replace-text",
73
+ text: t
74
+ }, d = t);
75
+ let n = { aiSdk: {
76
+ metadata: e.metadata,
77
+ parts: e.parts
78
+ } };
79
+ if (JSON.stringify(n).length > 2e5) throw Error("Metadata too large");
80
+ yield {
81
+ type: "metadata",
82
+ metadata: n
83
+ };
84
+ }
85
+ if (i.aborted) return;
86
+ if (!c || l) throw new e();
87
+ yield { type: "finish" };
88
+ } catch (t) {
89
+ if (i.aborted) return;
90
+ throw t instanceof TypeError ? new e() : t;
91
+ }
92
+ }
93
+ };
94
+ }
95
+ //#endregion
96
+ export { i as createAiSdkChatAdapter };
@@ -0,0 +1,139 @@
1
+ "use client";
2
+ import { i as e, n as t } from "../chunks/core-BCqVRLUy.js";
3
+ import { useMemo as n } from "react";
4
+ import { jsx as r } from "react/jsx-runtime";
5
+ import { AssistantRuntimeProvider as i, useAui as a, useAuiState as o, useLocalRuntime as s } from "@assistant-ui/react";
6
+ //#region src/reusable/assistant-ui/index.tsx
7
+ function c({ adapter: a, children: o }) {
8
+ let c = n(() => ({ async *run({ messages: n, abortSignal: r }) {
9
+ let i = "", o = {};
10
+ try {
11
+ for await (let t of a.run({
12
+ requestId: globalThis.crypto.randomUUID(),
13
+ messages: n.map((t) => ({
14
+ id: t.id,
15
+ role: t.role === "user" ? "user" : "assistant",
16
+ text: t.content.filter((e) => e.type === "text").map((e) => e.text).join(""),
17
+ metadata: t.metadata.custom,
18
+ files: Array.isArray(t.metadata.custom.superxdFiles) ? t.metadata.custom.superxdFiles.map(e) : void 0
19
+ }))
20
+ }, r)) {
21
+ if (t.type === "error") throw Error("Response failed");
22
+ if (t.type === "finish") return;
23
+ if (t.type === "metadata" ? o = t.metadata : i = t.type === "replace-text" ? t.text : i + t.text, i.length > 1e5) throw Error("Response too large");
24
+ yield {
25
+ content: [{
26
+ type: "text",
27
+ text: i
28
+ }],
29
+ metadata: { custom: { ...o } }
30
+ };
31
+ }
32
+ if (!r.aborted) throw Error("Response interrupted");
33
+ } catch (e) {
34
+ throw e instanceof t ? Error("Response interrupted", { cause: e }) : e;
35
+ }
36
+ } }), [a]), u = s(c);
37
+ return /* @__PURE__ */ r(i, {
38
+ runtime: u,
39
+ children: /* @__PURE__ */ r(l, {
40
+ adapter: a,
41
+ children: o
42
+ })
43
+ });
44
+ }
45
+ function l({ adapter: t, children: n }) {
46
+ let r = a().thread, i = o((e) => e.thread), s = i.messages.at(-1), c = s?.role === "assistant" && s.status.type === "incomplete" && typeof s.status.error == "object" && s.status.error !== null && "message" in s.status.error && s.status.error.message === "Response interrupted", l = i.isRunning ? s?.content.some((e) => e.type === "text" && e.text) ? "streaming" : "waiting" : s?.role === "assistant" ? s.status.type === "incomplete" ? s.status.reason === "cancelled" ? "cancelled" : c ? "interrupted" : "error" : "complete" : "idle";
47
+ return n({
48
+ snapshot: {
49
+ status: l,
50
+ capabilities: t.capabilities,
51
+ branches: Object.fromEntries(i.messages.flatMap((e) => {
52
+ let t = r.message({ id: e.id }).getState();
53
+ return t.branchCount > 1 ? [[e.id, {
54
+ index: t.branchNumber - 1,
55
+ count: t.branchCount
56
+ }]] : [];
57
+ })),
58
+ messages: i.messages.map((t) => ({
59
+ id: t.id,
60
+ role: t.role === "user" ? "user" : "assistant",
61
+ text: t.content.filter((e) => e.type === "text").map((e) => e.text).join(""),
62
+ metadata: t.metadata.custom,
63
+ files: Array.isArray(t.metadata.custom.superxdFiles) ? t.metadata.custom.superxdFiles.map(e) : void 0
64
+ }))
65
+ },
66
+ actions: {
67
+ send(n, i = []) {
68
+ if (r.getState().isRunning || r.getState().messages.length >= 98 || !t.capabilities.send || !n.trim() && !i.length || i.length > 0 && !t.capabilities.attachments || i.length > 4 || n.length > 2e4) return !1;
69
+ let a;
70
+ try {
71
+ a = i.map(e);
72
+ } catch {
73
+ return !1;
74
+ }
75
+ return a.length ? r.append({
76
+ role: "user",
77
+ content: [...n ? [{
78
+ type: "text",
79
+ text: n
80
+ }] : [], ...a.map((e) => ({
81
+ type: "file",
82
+ data: e.url,
83
+ mimeType: e.mediaType,
84
+ filename: e.name,
85
+ sourceType: "url"
86
+ }))],
87
+ metadata: { custom: { superxdFiles: a } }
88
+ }) : r.append(n), !0;
89
+ },
90
+ cancel() {
91
+ t.capabilities.cancel && r.cancelRun();
92
+ },
93
+ retry() {
94
+ if (r.getState().isRunning || !t.capabilities.retry || ![
95
+ "error",
96
+ "interrupted",
97
+ "cancelled"
98
+ ].includes(l)) return !1;
99
+ let e = [...i.messages].reverse().find((e) => e.role === "user");
100
+ return e ? (r.startRun({ parentId: e.id }), !0) : !1;
101
+ },
102
+ edit(n, a) {
103
+ if (r.getState().isRunning || !r.getState().messages.some((e) => e.id === n)) return !1;
104
+ let o = r.message({ id: n }).getState(), s = Array.isArray(o.metadata.custom.superxdFiles) ? o.metadata.custom.superxdFiles.map(e) : [], c = o.content.filter((e) => e.type === "text").map((e) => e.text).join("");
105
+ return r.getState().isRunning || !t.capabilities.send || !t.capabilities.edit || o.role !== "user" || !i.messages.some((e) => e.id === n) || a.length > 2e4 || !a.trim() && !s.length || a === c || o.branchCount >= 20 ? !1 : (r.append({
106
+ role: "user",
107
+ parentId: o.parentId,
108
+ sourceId: o.id,
109
+ content: [...a ? [{
110
+ type: "text",
111
+ text: a
112
+ }] : [], ...s.map((e) => ({
113
+ type: "file",
114
+ data: e.url,
115
+ mimeType: e.mediaType,
116
+ filename: e.name,
117
+ sourceType: "url"
118
+ }))],
119
+ metadata: { custom: {
120
+ ...o.metadata.custom,
121
+ superxdFiles: s
122
+ } }
123
+ }), !0);
124
+ },
125
+ regenerate(e) {
126
+ if (r.getState().isRunning || !r.getState().messages.some((t) => t.id === e)) return !1;
127
+ let n = r.message({ id: e }).getState();
128
+ return r.getState().isRunning || !t.capabilities.send || !t.capabilities.regenerate || n.role !== "assistant" || n.branchCount >= 20 || !i.messages.some((t) => t.id === e) ? !1 : (r.message({ id: e }).reload(), !0);
129
+ },
130
+ selectBranch(e, n) {
131
+ if (r.getState().isRunning || !r.getState().messages.some((t) => t.id === e)) return !1;
132
+ let a = r.message({ id: e }).getState();
133
+ return r.getState().isRunning || !t.capabilities.branches || !i.messages.some((t) => t.id === e) || (n === "previous" ? a.branchNumber <= 1 : a.branchNumber >= a.branchCount) ? !1 : (r.message({ id: e }).switchToBranch({ position: n }), !0);
134
+ }
135
+ }
136
+ });
137
+ }
138
+ //#endregion
139
+ export { c as AssistantChat };
@@ -0,0 +1,342 @@
1
+ import { Button as e, Link as t, composeRenderProps as n } from "react-aria-components";
2
+ import { clsx as r } from "clsx";
3
+ import { extendTailwindMerge as i } from "tailwind-merge";
4
+ import { Fragment as a, jsx as o, jsxs as s } from "react/jsx-runtime";
5
+ //#region src/lib/cn.ts
6
+ var c = i({ extend: {
7
+ theme: {
8
+ radius: [
9
+ "control",
10
+ "cell",
11
+ "surface",
12
+ "pill"
13
+ ],
14
+ shadow: [
15
+ "control",
16
+ "popover",
17
+ "dialog"
18
+ ],
19
+ ease: ["standard", "exit"],
20
+ animate: [
21
+ "fade-in",
22
+ "rise-in",
23
+ "slide-in",
24
+ "dialog-in",
25
+ "pulse-soft"
26
+ ]
27
+ },
28
+ classGroups: { "type-role": [
29
+ "type-title",
30
+ "type-heading",
31
+ "type-body",
32
+ "type-label",
33
+ "type-caption"
34
+ ] }
35
+ } });
36
+ function l(...e) {
37
+ return c(r(e));
38
+ }
39
+ //#endregion
40
+ //#region src/components/icons.tsx
41
+ function u(e, t) {
42
+ function n({ className: e, ...n }) {
43
+ return /* @__PURE__ */ o("svg", {
44
+ viewBox: "0 0 24 24",
45
+ fill: "none",
46
+ stroke: "currentColor",
47
+ strokeLinecap: "round",
48
+ strokeLinejoin: "round",
49
+ "aria-hidden": "true",
50
+ focusable: "false",
51
+ className: l("size-4 shrink-0 [stroke-width:var(--icon-stroke)]", e),
52
+ ...n,
53
+ children: t
54
+ });
55
+ }
56
+ return n.displayName = `Icon${e}`, n;
57
+ }
58
+ var d = u("Clock", /* @__PURE__ */ s(a, { children: [/* @__PURE__ */ o("circle", {
59
+ cx: "12",
60
+ cy: "12",
61
+ r: "10"
62
+ }), /* @__PURE__ */ o("path", { d: "M12 6v6l4 2" })] }));
63
+ u("Video", /* @__PURE__ */ s(a, { children: [/* @__PURE__ */ o("path", { d: "m16 13 5.223 3.482a.5.5 0 0 0 .777-.416V7.87a.5.5 0 0 0-.752-.432L16 10.5" }), /* @__PURE__ */ o("rect", {
64
+ x: "2",
65
+ y: "6",
66
+ width: "14",
67
+ height: "12",
68
+ rx: "2"
69
+ })] })), u("Globe", /* @__PURE__ */ s(a, { children: [
70
+ /* @__PURE__ */ o("circle", {
71
+ cx: "12",
72
+ cy: "12",
73
+ r: "10"
74
+ }),
75
+ /* @__PURE__ */ o("path", { d: "M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20" }),
76
+ /* @__PURE__ */ o("path", { d: "M2 12h20" })
77
+ ] }));
78
+ var f = u("Calendar", /* @__PURE__ */ s(a, { children: [
79
+ /* @__PURE__ */ o("path", { d: "M8 2v4" }),
80
+ /* @__PURE__ */ o("path", { d: "M16 2v4" }),
81
+ /* @__PURE__ */ o("rect", {
82
+ width: "18",
83
+ height: "18",
84
+ x: "3",
85
+ y: "4",
86
+ rx: "2"
87
+ }),
88
+ /* @__PURE__ */ o("path", { d: "M3 10h18" })
89
+ ] }));
90
+ u("CalendarPlus", /* @__PURE__ */ s(a, { children: [
91
+ /* @__PURE__ */ o("path", { d: "M8 2v4" }),
92
+ /* @__PURE__ */ o("path", { d: "M16 2v4" }),
93
+ /* @__PURE__ */ o("path", { d: "M21 13V6a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h8" }),
94
+ /* @__PURE__ */ o("path", { d: "M3 10h18" }),
95
+ /* @__PURE__ */ o("path", { d: "M16 19h6" }),
96
+ /* @__PURE__ */ o("path", { d: "M19 16v6" })
97
+ ] })), u("Grid", /* @__PURE__ */ s(a, { children: [
98
+ /* @__PURE__ */ o("rect", {
99
+ width: "18",
100
+ height: "18",
101
+ x: "3",
102
+ y: "3",
103
+ rx: "2"
104
+ }),
105
+ /* @__PURE__ */ o("path", { d: "M3 9h18" }),
106
+ /* @__PURE__ */ o("path", { d: "M3 15h18" }),
107
+ /* @__PURE__ */ o("path", { d: "M9 3v18" }),
108
+ /* @__PURE__ */ o("path", { d: "M15 3v18" })
109
+ ] })), u("Columns", /* @__PURE__ */ s(a, { children: [
110
+ /* @__PURE__ */ o("rect", {
111
+ width: "18",
112
+ height: "18",
113
+ x: "3",
114
+ y: "3",
115
+ rx: "2"
116
+ }),
117
+ /* @__PURE__ */ o("path", { d: "M9 3v18" }),
118
+ /* @__PURE__ */ o("path", { d: "M15 3v18" })
119
+ ] }));
120
+ var p = u("ChevronLeft", /* @__PURE__ */ o("path", { d: "m15 18-6-6 6-6" })), m = u("ChevronRight", /* @__PURE__ */ o("path", { d: "m9 18 6-6-6-6" })), h = u("ChevronDown", /* @__PURE__ */ o("path", { d: "m6 9 6 6 6-6" })), g = u("ArrowUp", /* @__PURE__ */ o("path", { d: "m5 12 7-7 7 7M12 5v14" }));
121
+ u("Download", /* @__PURE__ */ s(a, { children: [/* @__PURE__ */ o("path", { d: "M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4" }), /* @__PURE__ */ o("path", { d: "m7 10 5 5 5-5M12 15V3" })] }));
122
+ var _ = u("ArrowDown", /* @__PURE__ */ o("path", { d: "m5 12 7 7 7-7M12 5v14" })), v = u("Square", /* @__PURE__ */ o("rect", {
123
+ x: "6",
124
+ y: "6",
125
+ width: "12",
126
+ height: "12",
127
+ rx: "2"
128
+ })), y = u("Copy", /* @__PURE__ */ s(a, { children: [/* @__PURE__ */ o("rect", {
129
+ x: "9",
130
+ y: "9",
131
+ width: "13",
132
+ height: "13",
133
+ rx: "2"
134
+ }), /* @__PURE__ */ o("path", { d: "M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1" })] })), b = u("Edit", /* @__PURE__ */ s(a, { children: [/* @__PURE__ */ o("path", { d: "M12 20h9M16.5 3.5a2.1 2.1 0 0 1 3 3L9 17l-4 1 1-4Z" }), /* @__PURE__ */ o("path", { d: "m15 5 3 3" })] })), x = u("Check", /* @__PURE__ */ o("path", { d: "M20 6 9 17l-5-5" })), S = u("X", /* @__PURE__ */ s(a, { children: [/* @__PURE__ */ o("path", { d: "M18 6 6 18" }), /* @__PURE__ */ o("path", { d: "m6 6 12 12" })] })), C = u("Paperclip", /* @__PURE__ */ o("path", { d: "m21.44 11.05-9.19 9.19a6 6 0 0 1-8.49-8.49l9.9-9.9a4 4 0 0 1 5.66 5.66l-9.9 9.9a2 2 0 0 1-2.83-2.83l9.2-9.19" })), w = u("File", /* @__PURE__ */ s(a, { children: [/* @__PURE__ */ o("path", { d: "M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8Z" }), /* @__PURE__ */ o("path", { d: "M14 2v6h6M8 13h8M8 17h5" })] }));
135
+ u("ArrowLeft", /* @__PURE__ */ s(a, { children: [/* @__PURE__ */ o("path", { d: "m12 19-7-7 7-7" }), /* @__PURE__ */ o("path", { d: "M19 12H5" })] }));
136
+ var T = u("Info", /* @__PURE__ */ s(a, { children: [
137
+ /* @__PURE__ */ o("circle", {
138
+ cx: "12",
139
+ cy: "12",
140
+ r: "10"
141
+ }),
142
+ /* @__PURE__ */ o("path", { d: "M12 16v-4" }),
143
+ /* @__PURE__ */ o("path", { d: "M12 8h.01" })
144
+ ] })), E = u("Alert", /* @__PURE__ */ s(a, { children: [
145
+ /* @__PURE__ */ o("path", { d: "m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3" }),
146
+ /* @__PURE__ */ o("path", { d: "M12 9v4" }),
147
+ /* @__PURE__ */ o("path", { d: "M12 17h.01" })
148
+ ] })), D = u("CircleCheck", /* @__PURE__ */ s(a, { children: [/* @__PURE__ */ o("circle", {
149
+ cx: "12",
150
+ cy: "12",
151
+ r: "10"
152
+ }), /* @__PURE__ */ o("path", { d: "m9 12 2 2 4-4" })] })), O = u("CircleAlert", /* @__PURE__ */ s(a, { children: [
153
+ /* @__PURE__ */ o("circle", {
154
+ cx: "12",
155
+ cy: "12",
156
+ r: "10"
157
+ }),
158
+ /* @__PURE__ */ o("path", { d: "M12 8v4" }),
159
+ /* @__PURE__ */ o("path", { d: "M12 16h.01" })
160
+ ] }));
161
+ u("Hourglass", /* @__PURE__ */ s(a, { children: [
162
+ /* @__PURE__ */ o("path", { d: "M5 22h14" }),
163
+ /* @__PURE__ */ o("path", { d: "M5 2h14" }),
164
+ /* @__PURE__ */ o("path", { d: "M17 22v-4.172a2 2 0 0 0-.586-1.414L12 12l-4.414 4.414A2 2 0 0 0 7 17.828V22" }),
165
+ /* @__PURE__ */ o("path", { d: "M7 2v4.172a2 2 0 0 0 .586 1.414L12 12l4.414-4.414A2 2 0 0 0 17 6.172V2" })
166
+ ] }));
167
+ var k = u("MapPin", /* @__PURE__ */ s(a, { children: [/* @__PURE__ */ o("path", { d: "M20 10c0 4.993-5.539 10.193-7.399 11.799a1 1 0 0 1-1.202 0C9.539 20.193 4 14.993 4 10a8 8 0 0 1 16 0" }), /* @__PURE__ */ o("circle", {
168
+ cx: "12",
169
+ cy: "10",
170
+ r: "3"
171
+ })] })), A = u("Search", /* @__PURE__ */ s(a, { children: [/* @__PURE__ */ o("circle", {
172
+ cx: "11",
173
+ cy: "11",
174
+ r: "8"
175
+ }), /* @__PURE__ */ o("path", { d: "m21 21-4.3-4.3" })] })), j = u("Rotate", /* @__PURE__ */ s(a, { children: [/* @__PURE__ */ o("path", { d: "M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8" }), /* @__PURE__ */ o("path", { d: "M3 3v5h5" })] })), M = u("User", /* @__PURE__ */ s(a, { children: [/* @__PURE__ */ o("path", { d: "M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2" }), /* @__PURE__ */ o("circle", {
176
+ cx: "12",
177
+ cy: "7",
178
+ r: "4"
179
+ })] }));
180
+ u("Mail", /* @__PURE__ */ s(a, { children: [/* @__PURE__ */ o("rect", {
181
+ width: "20",
182
+ height: "16",
183
+ x: "2",
184
+ y: "4",
185
+ rx: "2"
186
+ }), /* @__PURE__ */ o("path", { d: "m22 7-8.97 5.7a1.94 1.94 0 0 1-2.06 0L2 7" })] })), u("Plus", /* @__PURE__ */ s(a, { children: [/* @__PURE__ */ o("path", { d: "M5 12h14" }), /* @__PURE__ */ o("path", { d: "M12 5v14" })] }));
187
+ var N = u("Sun", /* @__PURE__ */ s(a, { children: [
188
+ /* @__PURE__ */ o("circle", {
189
+ cx: "12",
190
+ cy: "12",
191
+ r: "4"
192
+ }),
193
+ /* @__PURE__ */ o("path", { d: "M12 2v2" }),
194
+ /* @__PURE__ */ o("path", { d: "M12 20v2" }),
195
+ /* @__PURE__ */ o("path", { d: "m4.93 4.93 1.41 1.41" }),
196
+ /* @__PURE__ */ o("path", { d: "m17.66 17.66 1.41 1.41" }),
197
+ /* @__PURE__ */ o("path", { d: "M2 12h2" }),
198
+ /* @__PURE__ */ o("path", { d: "M20 12h2" }),
199
+ /* @__PURE__ */ o("path", { d: "m6.34 17.66-1.41 1.41" }),
200
+ /* @__PURE__ */ o("path", { d: "m19.07 4.93-1.41 1.41" })
201
+ ] })), P = u("Moon", /* @__PURE__ */ o("path", { d: "M12 3a6 6 0 0 0 9 9 9 9 0 1 1-9-9Z" }));
202
+ //#endregion
203
+ //#region src/components/spinner.tsx
204
+ function F({ className: e }) {
205
+ return /* @__PURE__ */ o("svg", {
206
+ viewBox: "0 0 24 24",
207
+ "aria-hidden": "true",
208
+ focusable: "false",
209
+ className: l("size-4 shrink-0", e),
210
+ children: /* @__PURE__ */ s("g", {
211
+ fill: "currentColor",
212
+ className: "loader-dots",
213
+ children: [
214
+ /* @__PURE__ */ o("circle", {
215
+ cx: "4",
216
+ cy: "12",
217
+ r: "2.5"
218
+ }),
219
+ /* @__PURE__ */ o("circle", {
220
+ cx: "12",
221
+ cy: "12",
222
+ r: "2.5"
223
+ }),
224
+ /* @__PURE__ */ o("circle", {
225
+ cx: "20",
226
+ cy: "12",
227
+ r: "2.5"
228
+ })
229
+ ]
230
+ })
231
+ });
232
+ }
233
+ //#endregion
234
+ //#region src/components/button.tsx
235
+ var I = "relative inline-flex select-none items-center justify-center gap-2 whitespace-nowrap rounded-control type-label outline-none press data-focus-visible:focus-ring data-disabled:cursor-not-allowed data-disabled:opacity-50 data-done:border-done! data-done:bg-done! data-done:text-on-done! data-done:shadow-none!", L = {
236
+ primary: "bg-brand text-on-brand shadow-control data-hovered:bg-brand-emphasis data-pressed:bg-brand-emphasis",
237
+ secondary: "border border-line bg-surface text-fg-emphasis shadow-control data-hovered:border-line-emphasis data-hovered:bg-surface-muted data-pressed:bg-surface-subtle",
238
+ ghost: "text-fg-emphasis data-hovered:bg-surface-subtle data-pressed:bg-surface-emphasis",
239
+ destructive: "bg-destructive text-on-destructive shadow-control data-hovered:bg-destructive/90 data-pressed:bg-destructive/85"
240
+ }, R = {
241
+ sm: "h-control-sm px-control-sm-x",
242
+ md: "h-control-md px-control-md-x",
243
+ lg: "h-control-lg px-control-lg-x",
244
+ "icon-sm": "size-control-sm",
245
+ "icon-md": "size-control-md"
246
+ };
247
+ function z({ variant: e = "secondary", size: t = "md", className: n } = {}) {
248
+ return l(I, L[e], R[t], n);
249
+ }
250
+ function B({ variant: t = "secondary", size: r = "md", pendingLabel: i, isDone: c = !1, doneLabel: l, className: u, children: d, ...f }) {
251
+ return /* @__PURE__ */ o(e, {
252
+ ...f,
253
+ "data-done": c || void 0,
254
+ className: n(u, (e) => z({
255
+ variant: t,
256
+ size: r,
257
+ className: e
258
+ })),
259
+ children: n(d, (e, { isPending: t }) => c && !t ? /* @__PURE__ */ s(a, { children: [/* @__PURE__ */ o("span", {
260
+ className: "invisible inline-flex items-center gap-2",
261
+ children: e
262
+ }), /* @__PURE__ */ s("span", {
263
+ className: "absolute inset-0 flex animate-reveal-in items-center justify-center gap-2",
264
+ children: [/* @__PURE__ */ o(x, {}), l ?? e]
265
+ })] }) : t ? i ? /* @__PURE__ */ s(a, { children: [/* @__PURE__ */ o(F, {}), i] }) : /* @__PURE__ */ s(a, { children: [/* @__PURE__ */ o("span", {
266
+ className: "invisible inline-flex items-center gap-2",
267
+ children: e
268
+ }), /* @__PURE__ */ o("span", {
269
+ className: "absolute inset-0 flex items-center justify-center",
270
+ children: /* @__PURE__ */ o(F, {})
271
+ })] }) : e)
272
+ });
273
+ }
274
+ function V({ variant: e = "secondary", size: r = "md", className: i, ...a }) {
275
+ return /* @__PURE__ */ o(t, {
276
+ ...a,
277
+ className: n(i, (t) => z({
278
+ variant: e,
279
+ size: r,
280
+ className: t
281
+ }))
282
+ });
283
+ }
284
+ function H({ className: e, ...r }) {
285
+ return /* @__PURE__ */ o(t, {
286
+ ...r,
287
+ className: n(e, (e) => l("cursor-pointer rounded-[2px] font-medium text-fg-emphasis underline decoration-line-emphasis underline-offset-[3px] transition-colors duration-(--duration-fast) outline-none data-focus-visible:focus-ring data-hovered:decoration-fg-emphasis", e))
288
+ });
289
+ }
290
+ //#endregion
291
+ //#region src/components/callout.tsx
292
+ var U = {
293
+ neutral: {
294
+ box: "border-line-subtle bg-surface-muted text-fg",
295
+ icon: /* @__PURE__ */ o(T, { className: "text-fg-subtle" })
296
+ },
297
+ info: {
298
+ box: "border-info-line bg-info-subtle text-info",
299
+ icon: /* @__PURE__ */ o(T, {})
300
+ },
301
+ success: {
302
+ box: "border-success-line bg-success-subtle text-success",
303
+ icon: /* @__PURE__ */ o(D, {})
304
+ },
305
+ attention: {
306
+ box: "border-attention-line bg-attention-subtle text-attention",
307
+ icon: /* @__PURE__ */ o(E, {})
308
+ },
309
+ error: {
310
+ box: "border-error-line bg-error-subtle text-error",
311
+ icon: /* @__PURE__ */ o(O, {})
312
+ }
313
+ };
314
+ function W({ tone: e = "neutral", title: t, children: n, actions: r, icon: i, live: a, className: c }) {
315
+ let u = U[e];
316
+ return /* @__PURE__ */ s("div", {
317
+ role: a === "assertive" ? "alert" : a === "polite" ? "status" : void 0,
318
+ className: l("flex gap-2.5 rounded-control border px-control-md-x py-control-y type-body", u.box, c),
319
+ children: [i === null ? null : /* @__PURE__ */ o("span", {
320
+ className: "mt-0.5 flex",
321
+ children: i ?? u.icon
322
+ }), /* @__PURE__ */ s("div", {
323
+ className: "flex min-w-0 flex-1 flex-col gap-1",
324
+ children: [
325
+ t ? /* @__PURE__ */ o("p", {
326
+ className: "font-medium",
327
+ children: t
328
+ }) : null,
329
+ n ? /* @__PURE__ */ o("div", {
330
+ className: "text-pretty",
331
+ children: n
332
+ }) : null,
333
+ r ? /* @__PURE__ */ o("div", {
334
+ className: "mt-1.5 flex flex-wrap gap-2",
335
+ children: r
336
+ }) : null
337
+ ]
338
+ })]
339
+ });
340
+ }
341
+ //#endregion
342
+ export { A as C, S as D, M as E, l as O, j as S, N as T, b as _, z as a, P as b, g as c, h as d, p as f, y as g, d as h, H as i, f as l, O as m, B as n, F as o, m as p, V as r, _ as s, W as t, x as u, w as v, v as w, C as x, k as y };