@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,598 @@
1
+ import { O as e, f as t, g as n, n as r, p as i, u as a } from "./callout-DKMHSnjc.js";
2
+ import { Children as o, cloneElement as s, createContext as c, isValidElement as l, useContext as u, useEffect as d, useId as f, useLayoutEffect as p, useMemo as m, useRef as h, useState as g } from "react";
3
+ import { Label as _, Link as v, TextArea as y, TextField as b } from "react-aria-components";
4
+ import { jsx as x, jsxs as S } from "react/jsx-runtime";
5
+ import C from "react-markdown";
6
+ import w from "remark-gfm";
7
+ //#region src/reusable/web/message/copy.ts
8
+ var T = {
9
+ copy: "Copy response",
10
+ copyCode: "Copy code",
11
+ copying: "Copying",
12
+ copied: "Copied",
13
+ copyFailed: "Couldn’t copy. Select the text and copy it instead.",
14
+ code: "Code",
15
+ table: "Response table",
16
+ footnotes: "Notes",
17
+ back: "Back to the reference",
18
+ previous: "Previous version",
19
+ next: "Next version",
20
+ versions: "Message versions",
21
+ version: "Version",
22
+ edit: "Edit your message",
23
+ editInput: "Edit message",
24
+ save: "Save and resend",
25
+ cancel: "Cancel edit",
26
+ editNote: "Resending creates a new version. The original conversation stays available.",
27
+ editFailed: "This message couldn’t be resent. Your edit is still here. Try again when the response has stopped.",
28
+ regenerate: "Regenerate response",
29
+ latest: "Jump to latest message",
30
+ transcript: "Conversation messages"
31
+ }, E = /* @__PURE__ */ new Set(["code", "pre"]);
32
+ function D({ fresh: e = 2 } = {}) {
33
+ return (t) => {
34
+ let n = [], r = (e) => {
35
+ e.children = e.children.flatMap((e) => {
36
+ if (e.type === "element") {
37
+ let t = e;
38
+ return E.has(t.tagName) || r(t), [t];
39
+ }
40
+ return e.type === "text" ? e.value.split(/(\s+)/).filter(Boolean).map((e) => {
41
+ if (/^\s+$/.test(e)) return {
42
+ type: "text",
43
+ value: e
44
+ };
45
+ let t = {
46
+ type: "element",
47
+ tagName: "span",
48
+ properties: { className: ["stream-word"] },
49
+ children: [{
50
+ type: "text",
51
+ value: e
52
+ }]
53
+ };
54
+ return n.push(t), t;
55
+ }) : [e];
56
+ });
57
+ };
58
+ r(t);
59
+ for (let t of n.slice(-e)) t.properties.className.push("stream-word--fresh");
60
+ n.at(-1)?.children.push({
61
+ type: "element",
62
+ tagName: "span",
63
+ properties: {
64
+ className: ["stream-caret"],
65
+ ariaHidden: "true"
66
+ },
67
+ children: []
68
+ });
69
+ };
70
+ }
71
+ //#endregion
72
+ //#region src/reusable/web/message/index.tsx
73
+ function O({ text: e, label: t, iconOnly: i = !1, isDisabled: o, copy: s = T, writeText: c }) {
74
+ let [l, u] = g({
75
+ text: e,
76
+ phase: "idle"
77
+ }), f = h(0), p = h(void 0), m = l.text === e ? l.phase : "idle";
78
+ d(() => () => {
79
+ ++f.current, clearTimeout(p.current);
80
+ }, [e]);
81
+ let _ = async () => {
82
+ let t = ++f.current;
83
+ clearTimeout(p.current), u({
84
+ text: e,
85
+ phase: "pending"
86
+ });
87
+ try {
88
+ if (c) await c(e);
89
+ else {
90
+ if (!navigator.clipboard) throw Error("Clipboard unavailable");
91
+ await navigator.clipboard.writeText(e);
92
+ }
93
+ if (t !== f.current) return;
94
+ u({
95
+ text: e,
96
+ phase: "copied"
97
+ }), p.current = setTimeout(() => {
98
+ t === f.current && u({
99
+ text: e,
100
+ phase: "idle"
101
+ });
102
+ }, 2500);
103
+ } catch {
104
+ t === f.current && u({
105
+ text: e,
106
+ phase: "error"
107
+ });
108
+ }
109
+ }, v = m === "copied" ? s.copied : m === "pending" ? s.copying : t ?? s.copy;
110
+ return /* @__PURE__ */ S("div", {
111
+ className: "flex min-w-0 flex-wrap items-center gap-2",
112
+ children: [/* @__PURE__ */ S(r, {
113
+ variant: "ghost",
114
+ size: i ? "icon-sm" : "sm",
115
+ "aria-label": v,
116
+ isDisabled: o || !e || m === "pending",
117
+ onPress: _,
118
+ children: [x(m === "copied" ? a : n, {}), i ? null : v]
119
+ }), /* @__PURE__ */ x("span", {
120
+ role: "status",
121
+ "aria-live": "polite",
122
+ className: m === "error" ? "type-caption text-fg-subtle" : "sr-only",
123
+ children: m === "error" ? s.copyFailed : m === "copied" ? s.copied : ""
124
+ })]
125
+ });
126
+ }
127
+ function k({ code: t, language: n, className: r, isStreaming: i, writeText: a, copy: o = T }) {
128
+ let s = n?.trim().slice(0, 50) || o.code;
129
+ return /* @__PURE__ */ S("div", {
130
+ className: e("reusable-code min-w-0 overflow-hidden rounded-control border border-line-subtle bg-surface-muted", r),
131
+ children: [/* @__PURE__ */ S("div", {
132
+ className: "flex flex-wrap items-center justify-between gap-2 border-b border-line-subtle px-4 py-2",
133
+ children: [/* @__PURE__ */ x("span", {
134
+ className: "font-mono type-caption text-fg-subtle",
135
+ children: s
136
+ }), /* @__PURE__ */ x(O, {
137
+ text: t,
138
+ label: o.copyCode,
139
+ isDisabled: i,
140
+ writeText: a,
141
+ copy: o
142
+ })]
143
+ }), /* @__PURE__ */ x("pre", {
144
+ tabIndex: 0,
145
+ role: "group",
146
+ "aria-label": `${o.code}: ${s}`,
147
+ className: "m-0 max-w-full overflow-x-auto rounded-cell px-4 py-control-y font-mono type-caption text-fg-emphasis outline-none focus-visible:focus-ring",
148
+ children: /* @__PURE__ */ x("code", { children: t })
149
+ })]
150
+ });
151
+ }
152
+ function A(e) {
153
+ if (/^[#]/.test(e) || /^\/(?!\/)/.test(e) && !e.includes("\\") && !Array.from(e).some((e) => e.charCodeAt(0) <= 32)) return e;
154
+ try {
155
+ let t = new URL(e);
156
+ if (["https:", "http:"].includes(t.protocol) && !t.username && !t.password || t.protocol === "mailto:") return e;
157
+ } catch {}
158
+ return "";
159
+ }
160
+ function j({ text: t, className: n, copy: r = T, writeText: i, isStreaming: a, streamingTail: s = !1 }) {
161
+ let c = f().replace(/[^\w-]/g, ""), u = m(() => ({
162
+ a: ({ href: e, children: t, id: n, ...r }) => e ? /* @__PURE__ */ x(v, {
163
+ href: e,
164
+ id: n,
165
+ "aria-label": r["aria-label"],
166
+ "aria-describedby": r["aria-describedby"] === "footnote-label" ? `sxd-${c}-notes` : r["aria-describedby"],
167
+ className: "rounded-cell text-fg-emphasis underline decoration-line-emphasis underline-offset-4 outline-none data-focus-visible:focus-ring",
168
+ children: t
169
+ }) : /* @__PURE__ */ x("span", { children: t }),
170
+ img: ({ alt: e }) => /* @__PURE__ */ x("span", { children: e }),
171
+ h2: ({ id: e, children: t, className: n }) => /* @__PURE__ */ x("h2", {
172
+ id: e === "footnote-label" ? `sxd-${c}-notes` : e,
173
+ className: n,
174
+ children: t
175
+ }),
176
+ pre: ({ children: e }) => {
177
+ let t = o.toArray(e).find(l)?.props;
178
+ return /* @__PURE__ */ x(k, {
179
+ code: String(t?.children ?? "").replace(/\n$/, ""),
180
+ language: t?.className?.replace(/^language-/, ""),
181
+ copy: r,
182
+ writeText: i,
183
+ isStreaming: a
184
+ });
185
+ },
186
+ table: ({ children: e }) => /* @__PURE__ */ x("div", {
187
+ role: "group",
188
+ tabIndex: 0,
189
+ "aria-label": r.table,
190
+ className: "max-w-full overflow-x-auto rounded-control border border-line-subtle outline-none focus-visible:focus-ring",
191
+ children: /* @__PURE__ */ x("table", {
192
+ className: "w-full border-collapse type-caption",
193
+ children: e
194
+ })
195
+ })
196
+ }), [
197
+ r,
198
+ c,
199
+ i,
200
+ a
201
+ ]);
202
+ return /* @__PURE__ */ x("div", {
203
+ className: e("conversation-markdown reusable-markdown min-w-0 type-body whitespace-normal text-fg-emphasis", n),
204
+ children: /* @__PURE__ */ x(C, {
205
+ skipHtml: !0,
206
+ remarkPlugins: [w],
207
+ rehypePlugins: s ? [D] : [],
208
+ urlTransform: A,
209
+ remarkRehypeOptions: {
210
+ clobberPrefix: `sxd-${c}-`,
211
+ footnoteLabel: r.footnotes,
212
+ footnoteBackLabel: r.back
213
+ },
214
+ components: u,
215
+ children: t
216
+ })
217
+ });
218
+ }
219
+ function M(e) {
220
+ return /* @__PURE__ */ x(j, {
221
+ ...e,
222
+ isStreaming: !0,
223
+ streamingTail: !0
224
+ });
225
+ }
226
+ function N({ branch: e, isDisabled: n, onPrevious: a, onNext: o, copy: s = T }) {
227
+ return e.count < 2 ? null : /* @__PURE__ */ S("div", {
228
+ role: "group",
229
+ "aria-label": s.versions,
230
+ className: "flex items-center gap-1",
231
+ children: [
232
+ a ? /* @__PURE__ */ x(r, {
233
+ size: "icon-sm",
234
+ variant: "ghost",
235
+ "aria-label": s.previous,
236
+ isDisabled: n || e.index < 1,
237
+ onPress: a,
238
+ children: /* @__PURE__ */ x(t, {})
239
+ }) : null,
240
+ /* @__PURE__ */ S("span", {
241
+ "aria-label": `${s.version} ${e.index + 1} / ${e.count}`,
242
+ className: "font-mono type-caption text-fg-subtle numeric",
243
+ children: [
244
+ e.index + 1,
245
+ " / ",
246
+ e.count
247
+ ]
248
+ }),
249
+ o ? /* @__PURE__ */ x(r, {
250
+ size: "icon-sm",
251
+ variant: "ghost",
252
+ "aria-label": s.next,
253
+ isDisabled: n || e.index >= e.count - 1,
254
+ onPress: o,
255
+ children: /* @__PURE__ */ x(i, {})
256
+ }) : null
257
+ ]
258
+ });
259
+ }
260
+ function P({ text: e, autoFocus: t = !1, hasFiles: n, isDisabled: i, onSave: a, onCancel: o, copy: s = T }) {
261
+ let [c, l] = g(e), [u, p] = g(!1), m = h(null), v = f();
262
+ return d(() => {
263
+ t && m.current?.focus({ preventScroll: !0 });
264
+ }, [t]), /* @__PURE__ */ S("div", {
265
+ className: "flex w-full min-w-0 flex-col gap-3 rounded-surface border border-line-input bg-surface p-4 shadow-control",
266
+ children: [
267
+ /* @__PURE__ */ S(b, {
268
+ value: c,
269
+ onChange: (e) => {
270
+ l(e), p(!1);
271
+ },
272
+ isDisabled: i,
273
+ children: [/* @__PURE__ */ x(_, {
274
+ className: "sr-only",
275
+ children: s.editInput
276
+ }), /* @__PURE__ */ x(y, {
277
+ ref: m,
278
+ rows: 3,
279
+ maxLength: 2e4,
280
+ "aria-describedby": v,
281
+ onKeyDown: (e) => {
282
+ e.key === "Escape" && !e.nativeEvent.isComposing && (e.preventDefault(), e.stopPropagation(), o());
283
+ },
284
+ className: "max-h-48 min-h-24 w-full resize-y rounded-control border border-line-input bg-surface px-control-md-x py-control-y type-body text-fg-emphasis outline-none focus-visible:focus-ring"
285
+ })]
286
+ }),
287
+ /* @__PURE__ */ x("p", {
288
+ id: v,
289
+ className: "type-caption text-fg-subtle",
290
+ children: s.editNote
291
+ }),
292
+ /* @__PURE__ */ x("p", {
293
+ role: "status",
294
+ className: u ? "type-caption text-error" : "sr-only",
295
+ children: u ? s.editFailed : ""
296
+ }),
297
+ /* @__PURE__ */ S("div", {
298
+ className: "flex flex-wrap justify-end gap-2",
299
+ children: [/* @__PURE__ */ x(r, {
300
+ size: "sm",
301
+ onPress: o,
302
+ children: s.cancel
303
+ }), /* @__PURE__ */ x(r, {
304
+ size: "sm",
305
+ variant: "primary",
306
+ isDisabled: i || c === e || !c.trim() && !n,
307
+ onPress: () => {
308
+ a(c) || p(!0);
309
+ },
310
+ children: s.save
311
+ })]
312
+ })
313
+ ]
314
+ });
315
+ }
316
+ //#endregion
317
+ //#region src/components/canvas/copy.ts
318
+ var F = {
319
+ previous: "Previous state",
320
+ loading: "Loading",
321
+ ready: "Ready",
322
+ details: "Your details",
323
+ holding: "Holding the time",
324
+ submitting: "Submitting",
325
+ failed: "Try again",
326
+ checking: "Checking status",
327
+ confirm: "Confirm the change",
328
+ booked: "Booked",
329
+ requested: "Requested",
330
+ moved: "Booking moved",
331
+ manage: "Manage booking",
332
+ cancelling: "Cancelling",
333
+ cancelled: "Cancelled",
334
+ closed: "Closed",
335
+ calendar: "Calendar",
336
+ event: "Event details",
337
+ edit: "Edit event",
338
+ saving: "Saving changes",
339
+ saved: "Changes saved",
340
+ discard: "Unsaved changes",
341
+ review: "Choose changes",
342
+ applying: "Applying changes",
343
+ partial: "Review remaining changes",
344
+ complete: "Changes applied",
345
+ denied: "Changes declined",
346
+ conflict: "Draft changed",
347
+ blocked: "View only",
348
+ uncertain: "Check the outcome",
349
+ support: "Support request",
350
+ supportSaved: "Request saved"
351
+ };
352
+ //#endregion
353
+ //#region src/components/canvas/recorder.ts
354
+ function I() {
355
+ let e = !1, t = [], n, r = /* @__PURE__ */ new Map();
356
+ return Object.assign((i, a) => {
357
+ let o = t.at(-1);
358
+ if (o?.terminal) return;
359
+ let s = r.get(a) === i.phase;
360
+ if (s && a !== n) return;
361
+ if (r.set(a, i.phase), !e || !t.length && s) {
362
+ n = a;
363
+ return;
364
+ }
365
+ let c = s || o?.yieldToChild && a !== n;
366
+ return n = a, t = c ? [...t.slice(0, -1), i] : [...t, i], t;
367
+ }, { start: () => {
368
+ e = !0;
369
+ } });
370
+ }
371
+ //#endregion
372
+ //#region src/components/superxd-arrow.tsx
373
+ var L = "M5 12h14m-6-6 6 6-6 6";
374
+ function R({ className: t }) {
375
+ return /* @__PURE__ */ x("svg", {
376
+ className: e("sxd-icon", t),
377
+ viewBox: "0 0 24 24",
378
+ fill: "none",
379
+ stroke: "currentColor",
380
+ strokeWidth: 1.7,
381
+ strokeLinecap: "round",
382
+ strokeLinejoin: "round",
383
+ "aria-hidden": "true",
384
+ focusable: "false",
385
+ children: /* @__PURE__ */ x("path", { d: L })
386
+ });
387
+ }
388
+ //#endregion
389
+ //#region src/components/canvas/connector.tsx
390
+ function z() {
391
+ return /* @__PURE__ */ x("span", {
392
+ "data-canvas-connector": !0,
393
+ "aria-hidden": "true",
394
+ className: "pointer-events-none absolute -top-10 left-1/2 -translate-x-1/2 -translate-y-1/2 text-system-blue",
395
+ children: /* @__PURE__ */ x(R, { className: "size-6 rotate-90" })
396
+ });
397
+ }
398
+ //#endregion
399
+ //#region src/components/canvas/index.tsx
400
+ var B = c(!1), V = c(!1), H = c(null), U = c(null), W = c(null);
401
+ function G() {
402
+ let e = u(W);
403
+ return u(V) ? null : e;
404
+ }
405
+ function K({ children: t }) {
406
+ let n = u(H), [r, i] = g([]), [a] = g(() => I()), [o] = g(() => (e, t) => {
407
+ let n = a({
408
+ ...e,
409
+ node: Z(e.node)
410
+ }, t);
411
+ n && i(n);
412
+ });
413
+ return /* @__PURE__ */ S("div", {
414
+ className: "flex min-w-0 flex-col gap-20",
415
+ "data-observed-canvas": !0,
416
+ children: [/* @__PURE__ */ x("div", {
417
+ "data-live-demo": !0,
418
+ "data-canvas-current": "true",
419
+ "data-current": "true",
420
+ className: "min-w-0",
421
+ onPointerDownCapture: a.start,
422
+ onKeyDownCapture: a.start,
423
+ onClickCapture: a.start,
424
+ children: /* @__PURE__ */ x(W.Provider, {
425
+ value: o,
426
+ children: t
427
+ })
428
+ }), /* @__PURE__ */ x("div", {
429
+ "data-state-history": !0,
430
+ hidden: !n || !r.length,
431
+ className: "flex min-w-0 flex-col gap-20 empty:hidden",
432
+ children: r.map((t, n) => /* @__PURE__ */ S("div", {
433
+ "data-canvas-phase": t.phase,
434
+ "data-canvas-snapshot": !0,
435
+ "data-canvas-current": "false",
436
+ "data-current": "false",
437
+ "data-generative-step": t.phase.startsWith("generative-") ? t.phase.split("-")[1] : void 0,
438
+ className: e("relative mx-auto w-full min-w-0", t.className),
439
+ children: [
440
+ n > 0 ? /* @__PURE__ */ x(z, {}) : null,
441
+ /* @__PURE__ */ x(Y, {
442
+ index: n,
443
+ label: t.label,
444
+ previous: n < r.length - 1
445
+ }),
446
+ /* @__PURE__ */ x("div", {
447
+ "data-canvas-content": !0,
448
+ inert: !0,
449
+ "aria-hidden": "true",
450
+ children: /* @__PURE__ */ x(V.Provider, {
451
+ value: !0,
452
+ children: t.node
453
+ })
454
+ })
455
+ ]
456
+ }, n))
457
+ })]
458
+ });
459
+ }
460
+ function q({ children: e }) {
461
+ let t = u(B), n = u(U), r = u(H), i = u(W), a = u(V);
462
+ return r !== null && !i && !a ? /* @__PURE__ */ x(K, { children: e }) : t && !n ? /* @__PURE__ */ x(J, { children: e }) : e;
463
+ }
464
+ function J({ children: t }) {
465
+ let [n, r] = g([]), [i, a] = g(null), o = h(null), s = h(null), c = h(!1), [l] = g(() => (e) => {
466
+ let t = o.current;
467
+ t?.terminal || (t && t.phase !== e.phase && r((e) => [...e, {
468
+ ...t,
469
+ node: Z(t.node)
470
+ }]), o.current = e, a((t) => t?.phase === e.phase && t.label === e.label && t.terminal === e.terminal ? t : {
471
+ phase: e.phase,
472
+ label: e.label,
473
+ terminal: e.terminal
474
+ }));
475
+ });
476
+ return d(() => {
477
+ if (!c.current || !i) return;
478
+ let e = s.current?.querySelector("[data-canvas-current=\"true\"]");
479
+ e && (e.contains(document.activeElement) || e.focus({ preventScroll: !0 }), e.scrollIntoView({
480
+ block: "nearest",
481
+ behavior: "instant"
482
+ }));
483
+ }, [i]), /* @__PURE__ */ S("div", {
484
+ ref: s,
485
+ "data-canvas-sequence": !0,
486
+ className: "flex w-full min-w-0 flex-col gap-20",
487
+ onPointerDownCapture: () => {
488
+ c.current = !0;
489
+ },
490
+ onKeyDownCapture: () => {
491
+ c.current = !0;
492
+ },
493
+ children: [n.map((t, n) => /* @__PURE__ */ S("div", {
494
+ "data-canvas-phase": t.phase,
495
+ "data-canvas-current": "false",
496
+ className: e("relative mx-auto w-full min-w-0", t.className),
497
+ children: [
498
+ n > 0 ? /* @__PURE__ */ x(z, {}) : null,
499
+ /* @__PURE__ */ x(Y, {
500
+ index: n,
501
+ label: t.label,
502
+ previous: !0
503
+ }),
504
+ /* @__PURE__ */ x("div", {
505
+ inert: !0,
506
+ "aria-hidden": "true",
507
+ children: /* @__PURE__ */ x(V.Provider, {
508
+ value: !0,
509
+ children: t.node
510
+ })
511
+ })
512
+ ]
513
+ }, n)), /* @__PURE__ */ S("div", {
514
+ "data-canvas-phase": i?.phase,
515
+ "data-canvas-current": "true",
516
+ "data-canvas-terminal": i?.terminal || void 0,
517
+ tabIndex: -1,
518
+ className: "relative min-w-0 scroll-mt-6 outline-none",
519
+ children: [
520
+ n.length > 0 ? /* @__PURE__ */ x(z, {}) : null,
521
+ i ? /* @__PURE__ */ x(Y, {
522
+ index: n.length,
523
+ label: i.label
524
+ }) : null,
525
+ /* @__PURE__ */ x(U.Provider, {
526
+ value: l,
527
+ children: t
528
+ })
529
+ ]
530
+ })]
531
+ });
532
+ }
533
+ function Y({ index: e, label: t, previous: n }) {
534
+ return /* @__PURE__ */ S("div", {
535
+ "data-canvas-caption": !0,
536
+ className: "mb-3 flex flex-wrap justify-between gap-2 font-mono type-caption text-system-blue",
537
+ children: [/* @__PURE__ */ S("span", { children: [
538
+ String(e + 1).padStart(2, "0"),
539
+ " ",
540
+ t
541
+ ] }), n ? /* @__PURE__ */ x("span", { children: F.previous }) : null]
542
+ });
543
+ }
544
+ function X({ phase: e, label: t, terminal: n = !1, frameClassName: r, snapshot: i, children: a }) {
545
+ let o = u(U), s = G(), c = f(), l = u(V);
546
+ return p(() => {
547
+ l || o?.({
548
+ phase: e,
549
+ label: t,
550
+ terminal: n,
551
+ node: a
552
+ }), s?.({
553
+ phase: e,
554
+ label: t,
555
+ terminal: n,
556
+ className: r,
557
+ node: i ?? a
558
+ }, c);
559
+ }, [
560
+ o,
561
+ s,
562
+ c,
563
+ l,
564
+ e,
565
+ t,
566
+ n,
567
+ r,
568
+ i,
569
+ a
570
+ ]), a;
571
+ }
572
+ function Z(e) {
573
+ return o.map(e, (e) => {
574
+ if (!l(e)) return e;
575
+ let t = {};
576
+ "ref" in e.props && (t.ref = null);
577
+ for (let n of [
578
+ "measureRef",
579
+ "triggerRef",
580
+ "eventTriggerRef"
581
+ ]) n in e.props && (t[n] = void 0);
582
+ if (typeof e.type == "string") for (let n of [
583
+ "id",
584
+ "aria-labelledby",
585
+ "aria-describedby",
586
+ "htmlFor"
587
+ ]) n in e.props && (t[n] = void 0);
588
+ return "autoFocus" in e.props && (t.autoFocus = !1), "children" in e.props && (t.children = Z(e.props.children)), s(e, t);
589
+ });
590
+ }
591
+ function Q({ publish: e, children: t }) {
592
+ return /* @__PURE__ */ x(U.Provider, {
593
+ value: e,
594
+ children: t
595
+ });
596
+ }
597
+ //#endregion
598
+ export { Z as a, F as c, O as d, P as f, T as h, Q as i, N as l, M as m, q as n, G as o, j as p, X as r, z as s, V as t, k as u };