@mastra/playground-ui 66.0.0-alpha.1 → 66.0.0-alpha.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (39) hide show
  1. package/dist/components/CodeDiff.cjs.js +137 -18
  2. package/dist/components/CodeDiff.cjs.js.map +1 -1
  3. package/dist/components/CodeDiff.es.js +140 -22
  4. package/dist/components/CodeDiff.es.js.map +1 -1
  5. package/dist/components/DiffStat.cjs.js +30 -0
  6. package/dist/components/DiffStat.cjs.js.map +1 -0
  7. package/dist/components/DiffStat.d.ts +1 -0
  8. package/dist/components/DiffStat.es.js +29 -0
  9. package/dist/components/DiffStat.es.js.map +1 -0
  10. package/dist/domains/workflows/workflow/workflow-graph.cjs.js +2 -2
  11. package/dist/domains/workflows/workflow/workflow-graph.cjs.js.map +1 -1
  12. package/dist/domains/workflows/workflow/workflow-graph.es.js +1 -1
  13. package/dist/new/layout/app-shell.cjs.js +6 -4
  14. package/dist/new/layout/app-shell.cjs.js.map +1 -1
  15. package/dist/new/layout/app-shell.es.js +6 -4
  16. package/dist/new/layout/app-shell.es.js.map +1 -1
  17. package/dist/src/ds/components/CodeDiff/code-diff-header.d.ts +16 -0
  18. package/dist/src/ds/components/CodeDiff/code-diff-list.d.ts +7 -0
  19. package/dist/src/ds/components/CodeDiff/code-diff.d.ts +23 -6
  20. package/dist/src/ds/components/CodeDiff/index.d.ts +3 -0
  21. package/dist/src/ds/components/DiffStat/diff-stat.d.ts +6 -0
  22. package/dist/src/ds/components/DiffStat/index.d.ts +1 -0
  23. package/dist/src/ds/new/layout/app-shell/app-shell.d.ts +2 -1
  24. package/dist/src/ds/new/layout/app-shell/main-card.d.ts +2 -1
  25. package/dist/src/utils/model.d.ts +2 -0
  26. package/dist/string-Bu8NTsPl.cjs +24 -0
  27. package/dist/string-Bu8NTsPl.cjs.map +1 -0
  28. package/dist/string-CuGKN25d.js +13 -0
  29. package/dist/string-CuGKN25d.js.map +1 -0
  30. package/dist/style.css +40 -0
  31. package/dist/utils/model.cjs.js +10 -0
  32. package/dist/utils/model.cjs.js.map +1 -1
  33. package/dist/utils/model.es.js +10 -1
  34. package/dist/utils/model.es.js.map +1 -1
  35. package/dist/utils/string.cjs.js +3 -14
  36. package/dist/utils/string.es.js +1 -13
  37. package/package.json +8 -8
  38. package/dist/utils/string.cjs.js.map +0 -1
  39. package/dist/utils/string.es.js.map +0 -1
@@ -1,8 +1,100 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
2
  require('../CodeDiff.css');const require_utils = require("../utils-01CRPdxi.cjs");
3
+ const require_Txt = require("../Txt-B8V-pmTx.cjs");
4
+ const require_components_DisclosureChevron = require("./DisclosureChevron.cjs.js");
3
5
  const require_ThemeProvider = require("../ThemeProvider-CP5NGZzA.cjs");
6
+ let react = require("react");
4
7
  let react_jsx_runtime = require("react/jsx-runtime");
5
8
  let _pierre_diffs_react = require("@pierre/diffs/react");
9
+ //#region src/ds/components/CodeDiff/code-diff-header.tsx
10
+ function FilePath({ path, variant }) {
11
+ const nameStart = path.lastIndexOf("/") + 1;
12
+ const directory = path.slice(0, nameStart);
13
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
14
+ className: "flex min-w-0",
15
+ children: [directory ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_Txt.Txt, {
16
+ as: "span",
17
+ dir: "rtl",
18
+ variant,
19
+ font: "mono",
20
+ tone: "muted",
21
+ className: "min-w-[2ch] truncate",
22
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("bdi", {
23
+ dir: "ltr",
24
+ children: directory
25
+ })
26
+ }) : null, /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_Txt.Txt, {
27
+ as: "span",
28
+ variant,
29
+ font: "mono",
30
+ tone: variant === "body-sm" ? "ink" : "muted",
31
+ className: require_utils.cn("shrink-0 truncate", directory ? "max-w-[calc(100%-2ch)]" : "max-w-full"),
32
+ children: path.slice(nameStart)
33
+ })]
34
+ });
35
+ }
36
+ function HeaderTitle({ path, previousPath }) {
37
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
38
+ className: "flex min-w-0 flex-col",
39
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(FilePath, {
40
+ path,
41
+ variant: "body-sm"
42
+ }), previousPath && previousPath !== path ? /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
43
+ className: "flex min-w-0 gap-1",
44
+ children: [
45
+ " ",
46
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_Txt.Txt, {
47
+ as: "span",
48
+ variant: "meta",
49
+ tone: "muted",
50
+ className: "shrink-0",
51
+ children: "from"
52
+ }),
53
+ " ",
54
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(FilePath, {
55
+ path: previousPath,
56
+ variant: "meta"
57
+ })
58
+ ]
59
+ }) : null]
60
+ });
61
+ }
62
+ function FirstLineSlot({ children }) {
63
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
64
+ className: "flex h-5 shrink-0 items-center gap-2 [&_svg]:size-4",
65
+ children
66
+ });
67
+ }
68
+ function CodeDiffHeader({ path, previousPath, icon, meta, collapsed, onToggle }) {
69
+ const title = /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [icon ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(FirstLineSlot, { children: icon }) : null, /* @__PURE__ */ (0, react_jsx_runtime.jsx)(HeaderTitle, {
70
+ path,
71
+ previousPath
72
+ })] });
73
+ const titleClass = "flex min-w-0 flex-1 items-start gap-1.5 py-2 pl-2 text-left";
74
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
75
+ className: "sticky top-0 z-10 flex items-start gap-2 bg-card pr-3 not-last:border-b not-last:border-border",
76
+ children: [onToggle ? /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("button", {
77
+ type: "button",
78
+ "aria-expanded": !collapsed,
79
+ onClick: onToggle,
80
+ className: titleClass,
81
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(FirstLineSlot, { children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_components_DisclosureChevron.DisclosureChevron, {
82
+ direction: "right",
83
+ className: "text-muted-foreground"
84
+ }) }), title]
85
+ }) : /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
86
+ className: titleClass,
87
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(FirstLineSlot, { children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
88
+ "aria-hidden": true,
89
+ className: "size-4"
90
+ }) }), title]
91
+ }), meta ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
92
+ className: "py-2",
93
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(FirstLineSlot, { children: meta })
94
+ }) : null]
95
+ });
96
+ }
97
+ //#endregion
6
98
  //#region src/ds/components/CodeDiff/code-diff.tsx
7
99
  var PATCH_METADATA_PREFIXES = [
8
100
  "Binary files ",
@@ -24,7 +116,7 @@ function PatchMetadata({ patch }) {
24
116
  children: "No textual changes."
25
117
  });
26
118
  return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
27
- className: "p-3 font-mono text-caption",
119
+ className: "p-3 font-mono text-caption wrap-anywhere",
28
120
  children: lines.map((line) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", { children: line }, line))
29
121
  });
30
122
  }
@@ -35,9 +127,30 @@ function PatchContent({ patch, options }) {
35
127
  options
36
128
  });
37
129
  }
38
- function CodeDiff({ className, layout, ...source }) {
130
+ function DiffContent({ source, options }) {
131
+ if (source.patch !== void 0) return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(PatchContent, {
132
+ patch: source.patch,
133
+ options
134
+ });
135
+ if (source.codeA === void 0) return null;
136
+ const name = source.filename ?? "content.txt";
137
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_pierre_diffs_react.MultiFileDiff, {
138
+ oldFile: {
139
+ name,
140
+ contents: source.codeA
141
+ },
142
+ newFile: {
143
+ name,
144
+ contents: source.codeB
145
+ },
146
+ options
147
+ });
148
+ }
149
+ function CodeDiff({ className, layout, overflow = "wrap", header, ref, ...source }) {
39
150
  const { resolvedTheme } = require_ThemeProvider.useTheme();
151
+ const [collapsed, setCollapsed] = (0, react.useState)(false);
40
152
  const isPatch = source.patch !== void 0;
153
+ const hasDiff = isPatch || source.codeA !== void 0;
41
154
  const options = {
42
155
  theme: {
43
156
  dark: "pierre-dark",
@@ -47,27 +160,33 @@ function CodeDiff({ className, layout, ...source }) {
47
160
  diffStyle: layout ?? (isPatch ? "unified" : "split"),
48
161
  diffIndicators: "classic",
49
162
  disableFileHeader: true,
50
- overflow: "wrap"
163
+ overflow
51
164
  };
52
- return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
53
- className: require_utils.cn("code-diff min-w-0 overflow-auto rounded-md border border-border bg-card", className),
54
- children: source.patch !== void 0 ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(PatchContent, {
55
- patch: source.patch,
56
- options
57
- }) : /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_pierre_diffs_react.MultiFileDiff, {
58
- oldFile: {
59
- name: source.filename ?? "content.txt",
60
- contents: source.codeA
61
- },
62
- newFile: {
63
- name: source.filename ?? "content.txt",
64
- contents: source.codeB
65
- },
165
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
166
+ ref,
167
+ className: require_utils.cn("code-diff min-w-0 overflow-clip rounded-md border border-border bg-card", className),
168
+ children: [header ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(CodeDiffHeader, {
169
+ ...header,
170
+ collapsed,
171
+ onToggle: hasDiff ? () => setCollapsed((current) => !current) : void 0
172
+ }) : null, collapsed ? null : /* @__PURE__ */ (0, react_jsx_runtime.jsx)(DiffContent, {
173
+ source,
66
174
  options
67
- })
175
+ })]
176
+ });
177
+ }
178
+ //#endregion
179
+ //#region src/ds/components/CodeDiff/code-diff-list.tsx
180
+ /** Stacks `CodeDiff`s edge to edge like a pull request, rendering only the lines in view so long change sets stay fast. */
181
+ function CodeDiffList({ children, className }) {
182
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_pierre_diffs_react.Virtualizer, {
183
+ className: require_utils.cn("min-h-0 overflow-auto", className),
184
+ contentClassName: "flex flex-col *:rounded-none *:border-x-0 *:border-t-0",
185
+ children
68
186
  });
69
187
  }
70
188
  //#endregion
71
189
  exports.CodeDiff = CodeDiff;
190
+ exports.CodeDiffList = CodeDiffList;
72
191
 
73
192
  //# sourceMappingURL=CodeDiff.cjs.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"CodeDiff.cjs.js","names":["PatchDiff","useTheme","cn","MultiFileDiff"],"sources":["../../src/ds/components/CodeDiff/code-diff.tsx"],"sourcesContent":["'use client';\n\nimport { MultiFileDiff, PatchDiff } from '@pierre/diffs/react';\nimport type { FileDiffOptions } from '@pierre/diffs/react';\nimport { useTheme } from '@/ds/components/ThemeProvider';\nimport { cn } from '@/lib/utils';\nimport './code-diff.css';\n\nexport type CodeDiffProps = {\n className?: string;\n layout?: 'split' | 'unified';\n} & (\n | { codeA: string; codeB: string; filename?: string; patch?: never }\n | { patch: string; codeA?: never; codeB?: never; filename?: never }\n);\n\nconst PATCH_METADATA_PREFIXES = [\n 'Binary files ',\n 'GIT binary patch',\n 'similarity index ',\n 'rename from ',\n 'rename to ',\n 'copy from ',\n 'copy to ',\n 'new file mode ',\n 'deleted file mode ',\n 'old mode ',\n 'new mode ',\n];\n\nfunction PatchMetadata({ patch }: { patch: string }) {\n const lines = patch.split('\\n').filter(line => PATCH_METADATA_PREFIXES.some(prefix => line.startsWith(prefix)));\n\n if (lines.length === 0) {\n return <p className=\"p-3 text-caption text-muted-foreground\">No textual changes.</p>;\n }\n\n return (\n <div className=\"p-3 font-mono text-caption\">\n {lines.map(line => (\n <div key={line}>{line}</div>\n ))}\n </div>\n );\n}\n\nfunction PatchContent({ patch, options }: { patch: string; options: FileDiffOptions<undefined, undefined> }) {\n if (!/^@@ -\\d/m.test(patch)) return <PatchMetadata patch={patch} />;\n return <PatchDiff patch={patch} options={options} />;\n}\n\nexport function CodeDiff({ className, layout, ...source }: CodeDiffProps) {\n const { resolvedTheme } = useTheme();\n const isPatch = source.patch !== undefined;\n const options: FileDiffOptions<undefined, undefined> = {\n theme: { dark: 'pierre-dark', light: 'pierre-light' },\n themeType: resolvedTheme,\n diffStyle: layout ?? (isPatch ? 'unified' : 'split'),\n diffIndicators: 'classic',\n disableFileHeader: true,\n overflow: 'wrap',\n };\n\n return (\n <div className={cn('code-diff min-w-0 overflow-auto rounded-md border border-border bg-card', className)}>\n {source.patch !== undefined ? (\n <PatchContent patch={source.patch} options={options} />\n ) : (\n <MultiFileDiff\n oldFile={{ name: source.filename ?? 'content.txt', contents: source.codeA }}\n newFile={{ name: source.filename ?? 'content.txt', contents: source.codeB }}\n options={options}\n />\n )}\n </div>\n );\n}\n"],"mappings":";;;;;;AAgBA,IAAM,0BAA0B;CAC9B;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACF;AAEA,SAAS,cAAc,EAAE,SAA4B;CACnD,MAAM,QAAQ,MAAM,MAAM,IAAI,CAAC,CAAC,QAAO,SAAQ,wBAAwB,MAAK,WAAU,KAAK,WAAW,MAAM,CAAC,CAAC;CAE9G,IAAI,MAAM,WAAW,GACnB,OAAO,iBAAA,GAAA,kBAAA,IAAA,CAAC,KAAD;EAAG,WAAU;EAAyC,UAAA;CAAsB,CAAA;CAGrF,OACE,iBAAA,GAAA,kBAAA,IAAA,CAAC,OAAD;EAAK,WAAU;EACZ,UAAA,MAAM,KAAI,SACT,iBAAA,GAAA,kBAAA,IAAA,CAAC,OAAD,EAAA,UAAiB,KAAU,GAAjB,IAAiB,CAC5B;CACE,CAAA;AAET;AAEA,SAAS,aAAa,EAAE,OAAO,WAA8E;CAC3G,IAAI,CAAC,WAAW,KAAK,KAAK,GAAG,OAAO,iBAAA,GAAA,kBAAA,IAAA,CAAC,eAAD,EAAsB,MAAQ,CAAA;CAClE,OAAO,iBAAA,GAAA,kBAAA,IAAA,CAACA,oBAAAA,WAAD;EAAkB;EAAgB;CAAU,CAAA;AACrD;AAEA,SAAgB,SAAS,EAAE,WAAW,QAAQ,GAAG,UAAyB;CACxE,MAAM,EAAE,kBAAkBC,sBAAAA,SAAS;CACnC,MAAM,UAAU,OAAO,UAAU,KAAA;CACjC,MAAM,UAAiD;EACrD,OAAO;GAAE,MAAM;GAAe,OAAO;EAAe;EACpD,WAAW;EACX,WAAW,WAAW,UAAU,YAAY;EAC5C,gBAAgB;EAChB,mBAAmB;EACnB,UAAU;CACZ;CAEA,OACE,iBAAA,GAAA,kBAAA,IAAA,CAAC,OAAD;EAAK,WAAWC,cAAAA,GAAG,2EAA2E,SAAS;EACpG,UAAA,OAAO,UAAU,KAAA,IAChB,iBAAA,GAAA,kBAAA,IAAA,CAAC,cAAD;GAAc,OAAO,OAAO;GAAgB;EAAU,CAAA,IAEtD,iBAAA,GAAA,kBAAA,IAAA,CAACC,oBAAAA,eAAD;GACE,SAAS;IAAE,MAAM,OAAO,YAAY;IAAe,UAAU,OAAO;GAAM;GAC1E,SAAS;IAAE,MAAM,OAAO,YAAY;IAAe,UAAU,OAAO;GAAM;GACjE;EACV,CAAA;CAEA,CAAA;AAET"}
1
+ {"version":3,"file":"CodeDiff.cjs.js","names":["Txt","cn","_Fragment","DisclosureChevron","PatchDiff","MultiFileDiff","useTheme","useState","cn","Virtualizer","cn"],"sources":["../../src/ds/components/CodeDiff/code-diff-header.tsx","../../src/ds/components/CodeDiff/code-diff.tsx","../../src/ds/components/CodeDiff/code-diff-list.tsx"],"sourcesContent":["import type { ReactNode } from 'react';\nimport { DisclosureChevron } from '@/ds/components/DisclosureChevron';\nimport { Txt } from '@/ds/components/Txt';\nimport { cn } from '@/lib/utils';\n\nexport interface CodeDiffFileHeader {\n path: string;\n /** The path before a rename or move, shown under the current one. */\n previousPath?: string;\n /** Shown before the path, e.g. the kind of change. Give it an accessible name. */\n icon?: ReactNode;\n /** Shown at the header's right edge, e.g. the line counts. */\n meta?: ReactNode;\n}\n\nfunction FilePath({ path, variant }: { path: string; variant: 'body-sm' | 'meta' }) {\n const nameStart = path.lastIndexOf('/') + 1;\n const directory = path.slice(0, nameStart);\n return (\n <span className=\"flex min-w-0\">\n {/* rtl box + ltr isolate puts the ellipsis at the start, so the nearest folder stays visible */}\n {directory ? (\n <Txt as=\"span\" dir=\"rtl\" variant={variant} font=\"mono\" tone=\"muted\" className=\"min-w-[2ch] truncate\">\n <bdi dir=\"ltr\">{directory}</bdi>\n </Txt>\n ) : null}\n <Txt\n as=\"span\"\n variant={variant}\n font=\"mono\"\n tone={variant === 'body-sm' ? 'ink' : 'muted'}\n className={cn('shrink-0 truncate', directory ? 'max-w-[calc(100%-2ch)]' : 'max-w-full')}\n >\n {path.slice(nameStart)}\n </Txt>\n </span>\n );\n}\n\nfunction HeaderTitle({ path, previousPath }: Pick<CodeDiffFileHeader, 'path' | 'previousPath'>) {\n return (\n <span className=\"flex min-w-0 flex-col\">\n <FilePath path={path} variant=\"body-sm\" />\n {previousPath && previousPath !== path ? (\n <span className=\"flex min-w-0 gap-1\">\n {' '}\n <Txt as=\"span\" variant=\"meta\" tone=\"muted\" className=\"shrink-0\">\n from\n </Txt>{' '}\n <FilePath path={previousPath} variant=\"meta\" />\n </span>\n ) : null}\n </span>\n );\n}\n\nfunction FirstLineSlot({ children }: { children?: ReactNode }) {\n return <span className=\"flex h-5 shrink-0 items-center gap-2 [&_svg]:size-4\">{children}</span>;\n}\n\ninterface CodeDiffHeaderProps extends CodeDiffFileHeader {\n collapsed: boolean;\n onToggle?(): void;\n}\n\nexport function CodeDiffHeader({ path, previousPath, icon, meta, collapsed, onToggle }: CodeDiffHeaderProps) {\n const title = (\n <>\n {icon ? <FirstLineSlot>{icon}</FirstLineSlot> : null}\n <HeaderTitle path={path} previousPath={previousPath} />\n </>\n );\n const titleClass = 'flex min-w-0 flex-1 items-start gap-1.5 py-2 pl-2 text-left';\n\n return (\n <div className=\"sticky top-0 z-10 flex items-start gap-2 bg-card pr-3 not-last:border-b not-last:border-border\">\n {onToggle ? (\n <button type=\"button\" aria-expanded={!collapsed} onClick={onToggle} className={titleClass}>\n <FirstLineSlot>\n <DisclosureChevron direction=\"right\" className=\"text-muted-foreground\" />\n </FirstLineSlot>\n {title}\n </button>\n ) : (\n <div className={titleClass}>\n <FirstLineSlot>\n <span aria-hidden className=\"size-4\" />\n </FirstLineSlot>\n {title}\n </div>\n )}\n {meta ? (\n <span className=\"py-2\">\n <FirstLineSlot>{meta}</FirstLineSlot>\n </span>\n ) : null}\n </div>\n );\n}\n","'use client';\n\nimport { MultiFileDiff, PatchDiff } from '@pierre/diffs/react';\nimport type { FileDiffOptions } from '@pierre/diffs/react';\nimport { useState } from 'react';\nimport type { Ref } from 'react';\nimport { CodeDiffHeader } from './code-diff-header';\nimport type { CodeDiffFileHeader } from './code-diff-header';\nimport { useTheme } from '@/ds/components/ThemeProvider';\nimport { cn } from '@/lib/utils';\nimport './code-diff.css';\n\ntype CodeDiffSource =\n | { codeA: string; codeB: string; filename?: string; patch?: never }\n | { patch: string; codeA?: never; codeB?: never; filename?: never };\n\ntype NoCodeDiffSource = { patch?: never; codeA?: never; codeB?: never; filename?: never };\n\nexport type CodeDiffProps = {\n className?: string;\n layout?: 'split' | 'unified';\n /** `wrap` (default) breaks long lines — best for prose. `scroll` keeps columns behind a horizontal scroll — best for source code. */\n overflow?: 'wrap' | 'scroll';\n ref?: Ref<HTMLDivElement>;\n} & (({ header?: CodeDiffFileHeader } & CodeDiffSource) | ({ header: CodeDiffFileHeader } & NoCodeDiffSource));\n\nconst PATCH_METADATA_PREFIXES = [\n 'Binary files ',\n 'GIT binary patch',\n 'similarity index ',\n 'rename from ',\n 'rename to ',\n 'copy from ',\n 'copy to ',\n 'new file mode ',\n 'deleted file mode ',\n 'old mode ',\n 'new mode ',\n];\n\nfunction PatchMetadata({ patch }: { patch: string }) {\n const lines = patch.split('\\n').filter(line => PATCH_METADATA_PREFIXES.some(prefix => line.startsWith(prefix)));\n\n if (lines.length === 0) {\n return <p className=\"p-3 text-caption text-muted-foreground\">No textual changes.</p>;\n }\n\n return (\n <div className=\"p-3 font-mono text-caption wrap-anywhere\">\n {lines.map(line => (\n <div key={line}>{line}</div>\n ))}\n </div>\n );\n}\n\nfunction PatchContent({ patch, options }: { patch: string; options: FileDiffOptions<undefined, undefined> }) {\n if (!/^@@ -\\d/m.test(patch)) return <PatchMetadata patch={patch} />;\n return <PatchDiff patch={patch} options={options} />;\n}\n\nfunction DiffContent({\n source,\n options,\n}: {\n source: CodeDiffSource | NoCodeDiffSource;\n options: FileDiffOptions<undefined, undefined>;\n}) {\n if (source.patch !== undefined) return <PatchContent patch={source.patch} options={options} />;\n if (source.codeA === undefined) return null;\n const name = source.filename ?? 'content.txt';\n return (\n <MultiFileDiff\n oldFile={{ name, contents: source.codeA }}\n newFile={{ name, contents: source.codeB }}\n options={options}\n />\n );\n}\n\nexport function CodeDiff({ className, layout, overflow = 'wrap', header, ref, ...source }: CodeDiffProps) {\n const { resolvedTheme } = useTheme();\n const [collapsed, setCollapsed] = useState(false);\n const isPatch = source.patch !== undefined;\n const hasDiff = isPatch || source.codeA !== undefined;\n const options: FileDiffOptions<undefined, undefined> = {\n theme: { dark: 'pierre-dark', light: 'pierre-light' },\n themeType: resolvedTheme,\n diffStyle: layout ?? (isPatch ? 'unified' : 'split'),\n diffIndicators: 'classic',\n disableFileHeader: true,\n overflow,\n };\n\n return (\n <div ref={ref} className={cn('code-diff min-w-0 overflow-clip rounded-md border border-border bg-card', className)}>\n {header ? (\n <CodeDiffHeader\n {...header}\n collapsed={collapsed}\n onToggle={hasDiff ? () => setCollapsed(current => !current) : undefined}\n />\n ) : null}\n {collapsed ? null : <DiffContent source={source} options={options} />}\n </div>\n );\n}\n","'use client';\n\nimport { Virtualizer } from '@pierre/diffs/react';\nimport type { ReactNode } from 'react';\nimport { cn } from '@/lib/utils';\n\nexport interface CodeDiffListProps {\n children: ReactNode;\n className?: string;\n}\n\n/** Stacks `CodeDiff`s edge to edge like a pull request, rendering only the lines in view so long change sets stay fast. */\nexport function CodeDiffList({ children, className }: CodeDiffListProps) {\n return (\n <Virtualizer\n className={cn('min-h-0 overflow-auto', className)}\n contentClassName=\"flex flex-col *:rounded-none *:border-x-0 *:border-t-0\"\n >\n {children}\n </Virtualizer>\n );\n}\n"],"mappings":";;;;;;;;;AAeA,SAAS,SAAS,EAAE,MAAM,WAA0D;CAClF,MAAM,YAAY,KAAK,YAAY,GAAG,IAAI;CAC1C,MAAM,YAAY,KAAK,MAAM,GAAG,SAAS;CACzC,OACE,iBAAA,GAAA,kBAAA,KAAA,CAAC,QAAD;EAAM,WAAU;EAAhB,UAAA,CAEG,YACC,iBAAA,GAAA,kBAAA,IAAA,CAACA,YAAAA,KAAD;GAAK,IAAG;GAAO,KAAI;GAAe;GAAS,MAAK;GAAO,MAAK;GAAQ,WAAU;GAC5E,UAAA,iBAAA,GAAA,kBAAA,IAAA,CAAC,OAAD;IAAK,KAAI;IAAO,UAAA;GAAe,CAAA;EAC5B,CAAA,IACH,MACJ,iBAAA,GAAA,kBAAA,IAAA,CAACA,YAAAA,KAAD;GACE,IAAG;GACM;GACT,MAAK;GACL,MAAM,YAAY,YAAY,QAAQ;GACtC,WAAWC,cAAAA,GAAG,qBAAqB,YAAY,2BAA2B,YAAY;GAErF,UAAA,KAAK,MAAM,SAAS;EAClB,CAAA,CACD;;AAEV;AAEA,SAAS,YAAY,EAAE,MAAM,gBAAmE;CAC9F,OACE,iBAAA,GAAA,kBAAA,KAAA,CAAC,QAAD;EAAM,WAAU;EAAhB,UAAA,CACE,iBAAA,GAAA,kBAAA,IAAA,CAAC,UAAD;GAAgB;GAAM,SAAQ;EAAW,CAAA,GACxC,gBAAgB,iBAAiB,OAChC,iBAAA,GAAA,kBAAA,KAAA,CAAC,QAAD;GAA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Chevron } from "./DisclosureChevron.es.js";
2
4
  import { n as useTheme } from "../ThemeProvider-D-_g7dej.js";
3
- import { jsx } from "react/jsx-runtime";
4
- import { MultiFileDiff, PatchDiff } from "@pierre/diffs/react";
5
- import '../CodeDiff.css';//#region src/ds/components/CodeDiff/code-diff.tsx
5
+ import { useState } from "react";
6
+ import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
7
+ import { MultiFileDiff, PatchDiff, Virtualizer } from "@pierre/diffs/react";
8
+ import '../CodeDiff.css';//#region src/ds/components/CodeDiff/code-diff-header.tsx
9
+ function FilePath({ path, variant }) {
10
+ const nameStart = path.lastIndexOf("/") + 1;
11
+ const directory = path.slice(0, nameStart);
12
+ return /* @__PURE__ */ jsxs("span", {
13
+ className: "flex min-w-0",
14
+ children: [directory ? /* @__PURE__ */ jsx(Txt, {
15
+ as: "span",
16
+ dir: "rtl",
17
+ variant,
18
+ font: "mono",
19
+ tone: "muted",
20
+ className: "min-w-[2ch] truncate",
21
+ children: /* @__PURE__ */ jsx("bdi", {
22
+ dir: "ltr",
23
+ children: directory
24
+ })
25
+ }) : null, /* @__PURE__ */ jsx(Txt, {
26
+ as: "span",
27
+ variant,
28
+ font: "mono",
29
+ tone: variant === "body-sm" ? "ink" : "muted",
30
+ className: cn("shrink-0 truncate", directory ? "max-w-[calc(100%-2ch)]" : "max-w-full"),
31
+ children: path.slice(nameStart)
32
+ })]
33
+ });
34
+ }
35
+ function HeaderTitle({ path, previousPath }) {
36
+ return /* @__PURE__ */ jsxs("span", {
37
+ className: "flex min-w-0 flex-col",
38
+ children: [/* @__PURE__ */ jsx(FilePath, {
39
+ path,
40
+ variant: "body-sm"
41
+ }), previousPath && previousPath !== path ? /* @__PURE__ */ jsxs("span", {
42
+ className: "flex min-w-0 gap-1",
43
+ children: [
44
+ " ",
45
+ /* @__PURE__ */ jsx(Txt, {
46
+ as: "span",
47
+ variant: "meta",
48
+ tone: "muted",
49
+ className: "shrink-0",
50
+ children: "from"
51
+ }),
52
+ " ",
53
+ /* @__PURE__ */ jsx(FilePath, {
54
+ path: previousPath,
55
+ variant: "meta"
56
+ })
57
+ ]
58
+ }) : null]
59
+ });
60
+ }
61
+ function FirstLineSlot({ children }) {
62
+ return /* @__PURE__ */ jsx("span", {
63
+ className: "flex h-5 shrink-0 items-center gap-2 [&_svg]:size-4",
64
+ children
65
+ });
66
+ }
67
+ function CodeDiffHeader({ path, previousPath, icon, meta, collapsed, onToggle }) {
68
+ const title = /* @__PURE__ */ jsxs(Fragment$1, { children: [icon ? /* @__PURE__ */ jsx(FirstLineSlot, { children: icon }) : null, /* @__PURE__ */ jsx(HeaderTitle, {
69
+ path,
70
+ previousPath
71
+ })] });
72
+ const titleClass = "flex min-w-0 flex-1 items-start gap-1.5 py-2 pl-2 text-left";
73
+ return /* @__PURE__ */ jsxs("div", {
74
+ className: "sticky top-0 z-10 flex items-start gap-2 bg-card pr-3 not-last:border-b not-last:border-border",
75
+ children: [onToggle ? /* @__PURE__ */ jsxs("button", {
76
+ type: "button",
77
+ "aria-expanded": !collapsed,
78
+ onClick: onToggle,
79
+ className: titleClass,
80
+ children: [/* @__PURE__ */ jsx(FirstLineSlot, { children: /* @__PURE__ */ jsx(DisclosureChevron, {
81
+ direction: "right",
82
+ className: "text-muted-foreground"
83
+ }) }), title]
84
+ }) : /* @__PURE__ */ jsxs("div", {
85
+ className: titleClass,
86
+ children: [/* @__PURE__ */ jsx(FirstLineSlot, { children: /* @__PURE__ */ jsx("span", {
87
+ "aria-hidden": true,
88
+ className: "size-4"
89
+ }) }), title]
90
+ }), meta ? /* @__PURE__ */ jsx("span", {
91
+ className: "py-2",
92
+ children: /* @__PURE__ */ jsx(FirstLineSlot, { children: meta })
93
+ }) : null]
94
+ });
95
+ }
96
+ //#endregion
97
+ //#region src/ds/components/CodeDiff/code-diff.tsx
6
98
  var PATCH_METADATA_PREFIXES = [
7
99
  "Binary files ",
8
100
  "GIT binary patch",
@@ -23,7 +115,7 @@ function PatchMetadata({ patch }) {
23
115
  children: "No textual changes."
24
116
  });
25
117
  return /* @__PURE__ */ jsx("div", {
26
- className: "p-3 font-mono text-caption",
118
+ className: "p-3 font-mono text-caption wrap-anywhere",
27
119
  children: lines.map((line) => /* @__PURE__ */ jsx("div", { children: line }, line))
28
120
  });
29
121
  }
@@ -34,9 +126,30 @@ function PatchContent({ patch, options }) {
34
126
  options
35
127
  });
36
128
  }
37
- function CodeDiff({ className, layout, ...source }) {
129
+ function DiffContent({ source, options }) {
130
+ if (source.patch !== void 0) return /* @__PURE__ */ jsx(PatchContent, {
131
+ patch: source.patch,
132
+ options
133
+ });
134
+ if (source.codeA === void 0) return null;
135
+ const name = source.filename ?? "content.txt";
136
+ return /* @__PURE__ */ jsx(MultiFileDiff, {
137
+ oldFile: {
138
+ name,
139
+ contents: source.codeA
140
+ },
141
+ newFile: {
142
+ name,
143
+ contents: source.codeB
144
+ },
145
+ options
146
+ });
147
+ }
148
+ function CodeDiff({ className, layout, overflow = "wrap", header, ref, ...source }) {
38
149
  const { resolvedTheme } = useTheme();
150
+ const [collapsed, setCollapsed] = useState(false);
39
151
  const isPatch = source.patch !== void 0;
152
+ const hasDiff = isPatch || source.codeA !== void 0;
40
153
  const options = {
41
154
  theme: {
42
155
  dark: "pierre-dark",
@@ -46,27 +159,32 @@ function CodeDiff({ className, layout, ...source }) {
46
159
  diffStyle: layout ?? (isPatch ? "unified" : "split"),
47
160
  diffIndicators: "classic",
48
161
  disableFileHeader: true,
49
- overflow: "wrap"
162
+ overflow
50
163
  };
51
- return /* @__PURE__ */ jsx("div", {
52
- className: cn("code-diff min-w-0 overflow-auto rounded-md border border-border bg-card", className),
53
- children: source.patch !== void 0 ? /* @__PURE__ */ jsx(PatchContent, {
54
- patch: source.patch,
55
- options
56
- }) : /* @__PURE__ */ jsx(MultiFileDiff, {
57
- oldFile: {
58
- name: source.filename ?? "content.txt",
59
- contents: source.codeA
60
- },
61
- newFile: {
62
- name: source.filename ?? "content.txt",
63
- contents: source.codeB
64
- },
164
+ return /* @__PURE__ */ jsxs("div", {
165
+ ref,
166
+ className: cn("code-diff min-w-0 overflow-clip rounded-md border border-border bg-card", className),
167
+ children: [header ? /* @__PURE__ */ jsx(CodeDiffHeader, {
168
+ ...header,
169
+ collapsed,
170
+ onToggle: hasDiff ? () => setCollapsed((current) => !current) : void 0
171
+ }) : null, collapsed ? null : /* @__PURE__ */ jsx(DiffContent, {
172
+ source,
65
173
  options
66
- })
174
+ })]
175
+ });
176
+ }
177
+ //#endregion
178
+ //#region src/ds/components/CodeDiff/code-diff-list.tsx
179
+ /** Stacks `CodeDiff`s edge to edge like a pull request, rendering only the lines in view so long change sets stay fast. */
180
+ function CodeDiffList({ children, className }) {
181
+ return /* @__PURE__ */ jsx(Virtualizer, {
182
+ className: cn("min-h-0 overflow-auto", className),
183
+ contentClassName: "flex flex-col *:rounded-none *:border-x-0 *:border-t-0",
184
+ children
67
185
  });
68
186
  }
69
187
  //#endregion
70
- export { CodeDiff };
188
+ export { CodeDiff, CodeDiffList };
71
189
 
72
190
  //# sourceMappingURL=CodeDiff.es.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"CodeDiff.es.js","names":[],"sources":["../../src/ds/components/CodeDiff/code-diff.tsx"],"sourcesContent":["'use client';\n\nimport { MultiFileDiff, PatchDiff } from '@pierre/diffs/react';\nimport type { FileDiffOptions } from '@pierre/diffs/react';\nimport { useTheme } from '@/ds/components/ThemeProvider';\nimport { cn } from '@/lib/utils';\nimport './code-diff.css';\n\nexport type CodeDiffProps = {\n className?: string;\n layout?: 'split' | 'unified';\n} & (\n | { codeA: string; codeB: string; filename?: string; patch?: never }\n | { patch: string; codeA?: never; codeB?: never; filename?: never }\n);\n\nconst PATCH_METADATA_PREFIXES = [\n 'Binary files ',\n 'GIT binary patch',\n 'similarity index ',\n 'rename from ',\n 'rename to ',\n 'copy from ',\n 'copy to ',\n 'new file mode ',\n 'deleted file mode ',\n 'old mode ',\n 'new mode ',\n];\n\nfunction PatchMetadata({ patch }: { patch: string }) {\n const lines = patch.split('\\n').filter(line => PATCH_METADATA_PREFIXES.some(prefix => line.startsWith(prefix)));\n\n if (lines.length === 0) {\n return <p className=\"p-3 text-caption text-muted-foreground\">No textual changes.</p>;\n }\n\n return (\n <div className=\"p-3 font-mono text-caption\">\n {lines.map(line => (\n <div key={line}>{line}</div>\n ))}\n </div>\n );\n}\n\nfunction PatchContent({ patch, options }: { patch: string; options: FileDiffOptions<undefined, undefined> }) {\n if (!/^@@ -\\d/m.test(patch)) return <PatchMetadata patch={patch} />;\n return <PatchDiff patch={patch} options={options} />;\n}\n\nexport function CodeDiff({ className, layout, ...source }: CodeDiffProps) {\n const { resolvedTheme } = useTheme();\n const isPatch = source.patch !== undefined;\n const options: FileDiffOptions<undefined, undefined> = {\n theme: { dark: 'pierre-dark', light: 'pierre-light' },\n themeType: resolvedTheme,\n diffStyle: layout ?? (isPatch ? 'unified' : 'split'),\n diffIndicators: 'classic',\n disableFileHeader: true,\n overflow: 'wrap',\n };\n\n return (\n <div className={cn('code-diff min-w-0 overflow-auto rounded-md border border-border bg-card', className)}>\n {source.patch !== undefined ? (\n <PatchContent patch={source.patch} options={options} />\n ) : (\n <MultiFileDiff\n oldFile={{ name: source.filename ?? 'content.txt', contents: source.codeA }}\n newFile={{ name: source.filename ?? 'content.txt', contents: source.codeB }}\n options={options}\n />\n )}\n </div>\n );\n}\n"],"mappings":";;;;;AAgBA,IAAM,0BAA0B;CAC9B;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACF;AAEA,SAAS,cAAc,EAAE,SAA4B;CACnD,MAAM,QAAQ,MAAM,MAAM,IAAI,CAAC,CAAC,QAAO,SAAQ,wBAAwB,MAAK,WAAU,KAAK,WAAW,MAAM,CAAC,CAAC;CAE9G,IAAI,MAAM,WAAW,GACnB,OAAO,oBAAC,KAAD;EAAG,WAAU;EAAyC,UAAA;CAAsB,CAAA;CAGrF,OACE,oBAAC,OAAD;EAAK,WAAU;EACZ,UAAA,MAAM,KAAI,SACT,oBAAC,OAAD,EAAA,UAAiB,KAAU,GAAjB,IAAiB,CAC5B;CACE,CAAA;AAET;AAEA,SAAS,aAAa,EAAE,OAAO,WAA8E;CAC3G,IAAI,CAAC,WAAW,KAAK,KAAK,GAAG,OAAO,oBAAC,eAAD,EAAsB,MAAQ,CAAA;CAClE,OAAO,oBAAC,WAAD;EAAkB;EAAgB;CAAU,CAAA;AACrD;AAEA,SAAgB,SAAS,EAAE,WAAW,QAAQ,GAAG,UAAyB;CACxE,MAAM,EAAE,kBAAkB,SAAS;CACnC,MAAM,UAAU,OAAO,UAAU,KAAA;CACjC,MAAM,UAAiD;EACrD,OAAO;GAAE,MAAM;GAAe,OAAO;EAAe;EACpD,WAAW;EACX,WAAW,WAAW,UAAU,YAAY;EAC5C,gBAAgB;EAChB,mBAAmB;EACnB,UAAU;CACZ;CAEA,OACE,oBAAC,OAAD;EAAK,WAAW,GAAG,2EAA2E,SAAS;EACpG,UAAA,OAAO,UAAU,KAAA,IAChB,oBAAC,cAAD;GAAc,OAAO,OAAO;GAAgB;EAAU,CAAA,IAEtD,oBAAC,eAAD;GACE,SAAS;IAAE,MAAM,OAAO,YAAY;IAAe,UAAU,OAAO;GAAM;GAC1E,SAAS;IAAE,MAAM,OAAO,YAAY;IAAe,UAAU,OAAO;GAAM;GACjE;EACV,CAAA;CAEA,CAAA;AAET"}
1
+ {"version":3,"file":"CodeDiff.es.js","names":["_Fragment"],"sources":["../../src/ds/components/CodeDiff/code-diff-header.tsx","../../src/ds/components/CodeDiff/code-diff.tsx","../../src/ds/components/CodeDiff/code-diff-list.tsx"],"sourcesContent":["import type { ReactNode } from 'react';\nimport { DisclosureChevron } from '@/ds/components/DisclosureChevron';\nimport { Txt } from '@/ds/components/Txt';\nimport { cn } from '@/lib/utils';\n\nexport interface CodeDiffFileHeader {\n path: string;\n /** The path before a rename or move, shown under the current one. */\n previousPath?: string;\n /** Shown before the path, e.g. the kind of change. Give it an accessible name. */\n icon?: ReactNode;\n /** Shown at the header's right edge, e.g. the line counts. */\n meta?: ReactNode;\n}\n\nfunction FilePath({ path, variant }: { path: string; variant: 'body-sm' | 'meta' }) {\n const nameStart = path.lastIndexOf('/') + 1;\n const directory = path.slice(0, nameStart);\n return (\n <span className=\"flex min-w-0\">\n {/* rtl box + ltr isolate puts the ellipsis at the start, so the nearest folder stays visible */}\n {directory ? (\n <Txt as=\"span\" dir=\"rtl\" variant={variant} font=\"mono\" tone=\"muted\" className=\"min-w-[2ch] truncate\">\n <bdi dir=\"ltr\">{directory}</bdi>\n </Txt>\n ) : null}\n <Txt\n as=\"span\"\n variant={variant}\n font=\"mono\"\n tone={variant === 'body-sm' ? 'ink' : 'muted'}\n className={cn('shrink-0 truncate', directory ? 'max-w-[calc(100%-2ch)]' : 'max-w-full')}\n >\n {path.slice(nameStart)}\n </Txt>\n </span>\n );\n}\n\nfunction HeaderTitle({ path, previousPath }: Pick<CodeDiffFileHeader, 'path' | 'previousPath'>) {\n return (\n <span className=\"flex min-w-0 flex-col\">\n <FilePath path={path} variant=\"body-sm\" />\n {previousPath && previousPath !== path ? (\n <span className=\"flex min-w-0 gap-1\">\n {' '}\n <Txt as=\"span\" variant=\"meta\" tone=\"muted\" className=\"shrink-0\">\n from\n </Txt>{' '}\n <FilePath path={previousPath} variant=\"meta\" />\n </span>\n ) : null}\n </span>\n );\n}\n\nfunction FirstLineSlot({ children }: { children?: ReactNode }) {\n return <span className=\"flex h-5 shrink-0 items-center gap-2 [&_svg]:size-4\">{children}</span>;\n}\n\ninterface CodeDiffHeaderProps extends CodeDiffFileHeader {\n collapsed: boolean;\n onToggle?(): void;\n}\n\nexport function CodeDiffHeader({ path, previousPath, icon, meta, collapsed, onToggle }: CodeDiffHeaderProps) {\n const title = (\n <>\n {icon ? <FirstLineSlot>{icon}</FirstLineSlot> : null}\n <HeaderTitle path={path} previousPath={previousPath} />\n </>\n );\n const titleClass = 'flex min-w-0 flex-1 items-start gap-1.5 py-2 pl-2 text-left';\n\n return (\n <div className=\"sticky top-0 z-10 flex items-start gap-2 bg-card pr-3 not-last:border-b not-last:border-border\">\n {onToggle ? (\n <button type=\"button\" aria-expanded={!collapsed} onClick={onToggle} className={titleClass}>\n <FirstLineSlot>\n <DisclosureChevron direction=\"right\" className=\"text-muted-foreground\" />\n </FirstLineSlot>\n {title}\n </button>\n ) : (\n <div className={titleClass}>\n <FirstLineSlot>\n <span aria-hidden className=\"size-4\" />\n </FirstLineSlot>\n {title}\n </div>\n )}\n {meta ? (\n <span className=\"py-2\">\n <FirstLineSlot>{meta}</FirstLineSlot>\n </span>\n ) : null}\n </div>\n );\n}\n","'use client';\n\nimport { MultiFileDiff, PatchDiff } from '@pierre/diffs/react';\nimport type { FileDiffOptions } from '@pierre/diffs/react';\nimport { useState } from 'react';\nimport type { Ref } from 'react';\nimport { CodeDiffHeader } from './code-diff-header';\nimport type { CodeDiffFileHeader } from './code-diff-header';\nimport { useTheme } from '@/ds/components/ThemeProvider';\nimport { cn } from '@/lib/utils';\nimport './code-diff.css';\n\ntype CodeDiffSource =\n | { codeA: string; codeB: string; filename?: string; patch?: never }\n | { patch: string; codeA?: never; codeB?: never; filename?: never };\n\ntype NoCodeDiffSource = { patch?: never; codeA?: never; codeB?: never; filename?: never };\n\nexport type CodeDiffProps = {\n className?: string;\n layout?: 'split' | 'unified';\n /** `wrap` (default) breaks long lines — best for prose. `scroll` keeps columns behind a horizontal scroll — best for source code. */\n overflow?: 'wrap' | 'scroll';\n ref?: Ref<HTMLDivElement>;\n} & (({ header?: CodeDiffFileHeader } & CodeDiffSource) | ({ header: CodeDiffFileHeader } & NoCodeDiffSource));\n\nconst PATCH_METADATA_PREFIXES = [\n 'Binary files ',\n 'GIT binary patch',\n 'similarity index ',\n 'rename from ',\n 'rename to ',\n 'copy from ',\n 'copy to ',\n 'new file mode ',\n 'deleted file mode ',\n 'old mode ',\n 'new mode ',\n];\n\nfunction PatchMetadata({ patch }: { patch: string }) {\n const lines = patch.split('\\n').filter(line => PATCH_METADATA_PREFIXES.some(prefix => line.startsWith(prefix)));\n\n if (lines.length === 0) {\n return <p className=\"p-3 text-caption text-muted-foreground\">No textual changes.</p>;\n }\n\n return (\n <div className=\"p-3 font-mono text-caption wrap-anywhere\">\n {lines.map(line => (\n <div key={line}>{line}</div>\n ))}\n </div>\n );\n}\n\nfunction PatchContent({ patch, options }: { patch: string; options: FileDiffOptions<undefined, undefined> }) {\n if (!/^@@ -\\d/m.test(patch)) return <PatchMetadata patch={patch} />;\n return <PatchDiff patch={patch} options={options} />;\n}\n\nfunction DiffContent({\n source,\n options,\n}: {\n source: CodeDiffSource | NoCodeDiffSource;\n options: FileDiffOptions<undefined, undefined>;\n}) {\n if (source.patch !== undefined) return <PatchContent patch={source.patch} options={options} />;\n if (source.codeA === undefined) return null;\n const name = source.filename ?? 'content.txt';\n return (\n <MultiFileDiff\n oldFile={{ name, contents: source.codeA }}\n newFile={{ name, contents: source.codeB }}\n options={options}\n />\n );\n}\n\nexport function CodeDiff({ className, layout, overflow = 'wrap', header, ref, ...source }: CodeDiffProps) {\n const { resolvedTheme } = useTheme();\n const [collapsed, setCollapsed] = useState(false);\n const isPatch = source.patch !== undefined;\n const hasDiff = isPatch || source.codeA !== undefined;\n const options: FileDiffOptions<undefined, undefined> = {\n theme: { dark: 'pierre-dark', light: 'pierre-light' },\n themeType: resolvedTheme,\n diffStyle: layout ?? (isPatch ? 'unified' : 'split'),\n diffIndicators: 'classic',\n disableFileHeader: true,\n overflow,\n };\n\n return (\n <div ref={ref} className={cn('code-diff min-w-0 overflow-clip rounded-md border border-border bg-card', className)}>\n {header ? (\n <CodeDiffHeader\n {...header}\n collapsed={collapsed}\n onToggle={hasDiff ? () => setCollapsed(current => !current) : undefined}\n />\n ) : null}\n {collapsed ? null : <DiffContent source={source} options={options} />}\n </div>\n );\n}\n","'use client';\n\nimport { Virtualizer } from '@pierre/diffs/react';\nimport type { ReactNode } from 'react';\nimport { cn } from '@/lib/utils';\n\nexport interface CodeDiffListProps {\n children: ReactNode;\n className?: string;\n}\n\n/** Stacks `CodeDiff`s edge to edge like a pull request, rendering only the lines in view so long change sets stay fast. */\nexport function CodeDiffList({ children, className }: CodeDiffListProps) {\n return (\n <Virtualizer\n className={cn('min-h-0 overflow-auto', className)}\n contentClassName=\"flex flex-col *:rounded-none *:border-x-0 *:border-t-0\"\n >\n {children}\n </Virtualizer>\n );\n}\n"],"mappings":";;;;;;;;AAeA,SAAS,SAAS,EAAE,MAAM,WAA0D;CAClF,MAAM,YAAY,KAAK,YAAY,GAAG,IAAI;CAC1C,MAAM,YAAY,KAAK,MAAM,GAAG,SAAS;CACzC,OACE,qBAAC,QAAD;EAAM,WAAU;EAAhB,UAAA,CAEG,YACC,oBAAC,KAAD;GAAK,IAAG;GAAO,KAAI;GAAe;GAAS,MAAK;GAAO,MAAK;GAAQ,WAAU;GAC5E,UAAA,oBAAC,OAAD;IAAK,KAAI;IAAO,UAAA;GAAe,CAAA;EAC5B,CAAA,IACH,MACJ,oBAAC,KAAD;GACE,IAAG;GACM;GACT,MAAK;GACL,MAAM,YAAY,YAAY,QAAQ;GACtC,WAAW,GAAG,qBAAqB,YAAY,2BAA2B,YAAY;GAErF,UAAA,KAAK,MAAM,SAAS;EAClB,CAAA,CACD;;AAEV;AAEA,SAAS,YAAY,EAAE,MAAM,gBAAmE;CAC9F,OACE,qBAAC,QAAD;EAAM,WAAU;EAAhB,UAAA,CACE,oBAAC,UAAD;GAAgB;GAAM,SAAQ;EAAW,CAAA,GACxC,gBAAgB,iBAAiB,OAChC,qBAAC,QAAD;GAAM,WAAU;GAAhB,UAAA;IACG;IACD,oBAAC,KAAD;KAAK,IAAG;KAAO,SAAQ;KAAO,MAAK;KAAQ,WAAU;KAAW,UAAA;IAE3D,CAAA;IAAE;IACP,oBAAC,UAAD;KAAU,MAAM;KAAc,SAAQ;IAAQ,CAAA;GAC1C;EACJ,CAAA,IAAA,IACA;;AAEV;AAEA,SAAS,cAAc,EAAE,YAAsC;CAC7D,OAAO,oBAAC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;CACvE,OACE,oBAAC,aAAD;EACE,WAAW,GAAG,yBAAyB,SAAS;EAChD,kBAAiB;EAEhB;CACU,CAAA;AAEjB"}
@@ -0,0 +1,30 @@
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
+ const require_utils = require("../utils-01CRPdxi.cjs");
3
+ const require_string = require("../string-Bu8NTsPl.cjs");
4
+ let react_jsx_runtime = require("react/jsx-runtime");
5
+ //#region src/ds/components/DiffStat/diff-stat.tsx
6
+ function DiffStat({ additions, deletions, className }) {
7
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
8
+ className: require_utils.cn("inline-flex shrink-0 items-center gap-1 tabular-nums", className),
9
+ children: [
10
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
11
+ "aria-hidden": "true",
12
+ className: "text-success-indicator",
13
+ children: ["+", additions]
14
+ }),
15
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
16
+ "aria-hidden": "true",
17
+ className: "text-destructive-foreground",
18
+ children: ["−", deletions]
19
+ }),
20
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
21
+ className: "sr-only",
22
+ children: `${require_string.pluralize(additions, "addition")} and ${require_string.pluralize(deletions, "deletion")}`
23
+ })
24
+ ]
25
+ });
26
+ }
27
+ //#endregion
28
+ exports.DiffStat = DiffStat;
29
+
30
+ //# sourceMappingURL=DiffStat.cjs.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DiffStat.cjs.js","names":["cn","pluralize"],"sources":["../../src/ds/components/DiffStat/diff-stat.tsx"],"sourcesContent":["import { pluralize } from '@/lib/string';\nimport { cn } from '@/lib/utils';\n\nexport interface DiffStatProps {\n additions: number;\n deletions: number;\n className?: string;\n}\n\nexport function DiffStat({ additions, deletions, className }: DiffStatProps) {\n return (\n <span className={cn('inline-flex shrink-0 items-center gap-1 tabular-nums', className)}>\n <span aria-hidden=\"true\" className=\"text-success-indicator\">\n +{additions}\n </span>\n <span aria-hidden=\"true\" className=\"text-destructive-foreground\">\n −{deletions}\n </span>\n <span className=\"sr-only\">{`${pluralize(additions, 'addition')} and ${pluralize(deletions, 'deletion')}`}</span>\n </span>\n );\n}\n"],"mappings":";;;;;AASA,SAAgB,SAAS,EAAE,WAAW,WAAW,aAA4B;CAC3E,OACE,iBAAA,GAAA,kBAAA,KAAA,CAAC,QAAD;EAAM,WAAWA,cAAAA,GAAG,wDAAwD,SAAS;EAArF,UAAA;GACE,iBAAA,GAAA,kBAAA,KAAA,CAAC,QAAD;IAAM,eAAY;IAAO,WAAU;IAAnC,UAAA,CAA4D,KACxD,SACE;;GACN,iBAAA,GAAA,kBAAA,KAAA,CAAC,QAAD;IAAM,eAAY;IAAO,WAAU;IAAnC,UAAA,CAAiE,KAC7D,SACE;;GACN,iBAAA,GAAA,kBAAA,IAAA,CAAC,QAAD;IAAM,WAAU;IAAW,UAAA,GAAGC,eAAAA,UAAU,WAAW,UAAU,EAAE,OAAOA,eAAAA,UAAU,WAAW,UAAU;GAAU,CAAA;EAC3G;;AAEV"}
@@ -0,0 +1 @@
1
+ export * from '../src/ds/components/DiffStat/index';
@@ -0,0 +1,29 @@
1
+ import { t as cn } from "../utils-BiHZnbcQ.js";
2
+ import { n as pluralize } from "../string-CuGKN25d.js";
3
+ import { jsx, jsxs } from "react/jsx-runtime";
4
+ //#region src/ds/components/DiffStat/diff-stat.tsx
5
+ function DiffStat({ additions, deletions, className }) {
6
+ return /* @__PURE__ */ jsxs("span", {
7
+ className: cn("inline-flex shrink-0 items-center gap-1 tabular-nums", className),
8
+ children: [
9
+ /* @__PURE__ */ jsxs("span", {
10
+ "aria-hidden": "true",
11
+ className: "text-success-indicator",
12
+ children: ["+", additions]
13
+ }),
14
+ /* @__PURE__ */ jsxs("span", {
15
+ "aria-hidden": "true",
16
+ className: "text-destructive-foreground",
17
+ children: ["−", deletions]
18
+ }),
19
+ /* @__PURE__ */ jsx("span", {
20
+ className: "sr-only",
21
+ children: `${pluralize(additions, "addition")} and ${pluralize(deletions, "deletion")}`
22
+ })
23
+ ]
24
+ });
25
+ }
26
+ //#endregion
27
+ export { DiffStat };
28
+
29
+ //# sourceMappingURL=DiffStat.es.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DiffStat.es.js","names":[],"sources":["../../src/ds/components/DiffStat/diff-stat.tsx"],"sourcesContent":["import { pluralize } from '@/lib/string';\nimport { cn } from '@/lib/utils';\n\nexport interface DiffStatProps {\n additions: number;\n deletions: number;\n className?: string;\n}\n\nexport function DiffStat({ additions, deletions, className }: DiffStatProps) {\n return (\n <span className={cn('inline-flex shrink-0 items-center gap-1 tabular-nums', className)}>\n <span aria-hidden=\"true\" className=\"text-success-indicator\">\n +{additions}\n </span>\n <span aria-hidden=\"true\" className=\"text-destructive-foreground\">\n −{deletions}\n </span>\n <span className=\"sr-only\">{`${pluralize(additions, 'addition')} and ${pluralize(deletions, 'deletion')}`}</span>\n </span>\n );\n}\n"],"mappings":";;;;AASA,SAAgB,SAAS,EAAE,WAAW,WAAW,aAA4B;CAC3E,OACE,qBAAC,QAAD;EAAM,WAAW,GAAG,wDAAwD,SAAS;EAArF,UAAA;GACE,qBAAC,QAAD;IAAM,eAAY;IAAO,WAAU;IAAnC,UAAA,CAA4D,KACxD,SACE;;GACN,qBAAC,QAAD;IAAM,eAAY;IAAO,WAAU;IAAnC,UAAA,CAAiE,KAC7D,SACE;;GACN,oBAAC,QAAD;IAAM,WAAU;IAAW,UAAA,GAAG,UAAU,WAAW,UAAU,EAAE,OAAO,UAAU,WAAW,UAAU;GAAU,CAAA;EAC3G;;AAEV"}
@@ -1,5 +1,5 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
- const require_utils_string = require("../../../utils/string.cjs.js");
2
+ const require_string = require("../../../string-Bu8NTsPl.cjs");
3
3
  const require_domains_workflows_context_workflow_run_context = require("../context/workflow-run-context.cjs.js");
4
4
  const require_domains_workflows_workflow_workflow_graph_boundary = require("./workflow-graph-boundary.cjs.js");
5
5
  const require_Workflow = require("../../../Workflow-D3UHbL5e.cjs");
@@ -13,7 +13,7 @@ function WorkflowGraph({ workflowId, workflow, isLoading, requestContext }) {
13
13
  const stepGraph = runSnapshot?.serializedStepGraph ?? snapshot?.serializedStepGraph ?? workflow?.stepGraph;
14
14
  const layoutKey = (0, react.useMemo)(() => `${workflowId}:${JSON.stringify(stepGraph)}`, [workflowId, stepGraph]);
15
15
  if (isLoading) return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_Workflow.WorkflowGraphPlaceholder, { isLoading: true });
16
- if (!workflow || !stepGraph) return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_Workflow.WorkflowGraphPlaceholder, { workflowName: require_utils_string.lodashTitleCase(workflowId) });
16
+ if (!workflow || !stepGraph) return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_Workflow.WorkflowGraphPlaceholder, { workflowName: require_string.lodashTitleCase(workflowId) });
17
17
  return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_xyflow_react.ReactFlowProvider, { children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_domains_workflows_workflow_workflow_graph_boundary.WorkflowGraphBoundary, {
18
18
  stepGraph,
19
19
  children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_domains_workflows_workflow_workflow_graph_inner.WorkflowGraphInner, {
@@ -1 +1 @@
1
- {"version":3,"file":"workflow-graph.cjs.js","names":["useContext","WorkflowRunContext","useMemo","WorkflowGraphPlaceholder","lodashTitleCase","ReactFlowProvider","WorkflowGraphBoundary","WorkflowGraphInner"],"sources":["../../../../src/domains/workflows/workflow/workflow-graph.tsx"],"sourcesContent":["import type { GetWorkflowResponse } from '@mastra/client-js';\nimport { ReactFlowProvider } from '@xyflow/react';\nimport { useContext, useMemo } from 'react';\nimport { WorkflowRunContext } from '../context/workflow-run-context';\nimport { WorkflowGraphBoundary } from './workflow-graph-boundary';\nimport { WorkflowGraphInner } from './workflow-graph-inner';\nimport { WorkflowGraphPlaceholder } from '@/ds/components/Workflow';\nimport { lodashTitleCase } from '@/utils/string';\n\nexport interface WorkflowGraphProps {\n workflowId: string;\n isLoading?: boolean;\n workflow?: GetWorkflowResponse;\n requestContext: Record<string, any>;\n}\n\nexport function WorkflowGraph({ workflowId, workflow, isLoading, requestContext }: WorkflowGraphProps) {\n const { runSnapshot, snapshot } = useContext(WorkflowRunContext);\n const stepGraph = runSnapshot?.serializedStepGraph ?? snapshot?.serializedStepGraph ?? workflow?.stepGraph;\n const layoutKey = useMemo(() => `${workflowId}:${JSON.stringify(stepGraph)}`, [workflowId, stepGraph]);\n\n if (isLoading) return <WorkflowGraphPlaceholder isLoading />;\n if (!workflow || !stepGraph) return <WorkflowGraphPlaceholder workflowName={lodashTitleCase(workflowId)} />;\n\n return (\n <ReactFlowProvider key={layoutKey}>\n <WorkflowGraphBoundary stepGraph={stepGraph}>\n <WorkflowGraphInner stepGraph={stepGraph} requestContext={requestContext} />\n </WorkflowGraphBoundary>\n </ReactFlowProvider>\n );\n}\n"],"mappings":";;;;;;;;;;AAgBA,SAAgB,cAAc,EAAE,YAAY,UAAU,WAAW,kBAAsC;CACrG,MAAM,EAAE,aAAa,cAAA,GAAaA,MAAAA,WAAAA,CAAWC,uDAAAA,kBAAkB;CAC/D,MAAM,YAAY,aAAa,uBAAuB,UAAU,uBAAuB,UAAU;CACjG,MAAM,aAAA,GAAYC,MAAAA,QAAAA,OAAc,GAAG,WAAW,GAAG,KAAK,UAAU,SAAS,KAAK,CAAC,YAAY,SAAS,CAAC;CAErG,IAAI,WAAW,OAAO,iBAAA,GAAA,kBAAA,IAAA,CAACC,iBAAAA,0BAAD,EAA0B,WAAA,KAAW,CAAA;CAC3D,IAAI,CAAC,YAAY,CAAC,WAAW,OAAO,iBAAA,GAAA,kBAAA,IAAA,CAACA,iBAAAA,0BAAD,EAA0B,cAAcC,qBAAAA,gBAAgB,UAAU,EAAI,CAAA;CAE1G,OACE,iBAAA,GAAA,kBAAA,IAAA,CAACC,cAAAA,mBAAD,EAAA,UACE,iBAAA,GAAA,kBAAA,IAAA,CAACC,2DAAAA,uBAAD;EAAkC;EAChC,UAAA,iBAAA,GAAA,kBAAA,IAAA,CAACC,wDAAAA,oBAAD;GAA+B;GAA2B;EAAiB,CAAA;CACtD,CAAA,EACN,GAJK,SAIL;AAEvB"}
1
+ {"version":3,"file":"workflow-graph.cjs.js","names":["useContext","WorkflowRunContext","useMemo","WorkflowGraphPlaceholder","lodashTitleCase","ReactFlowProvider","WorkflowGraphBoundary","WorkflowGraphInner"],"sources":["../../../../src/domains/workflows/workflow/workflow-graph.tsx"],"sourcesContent":["import type { GetWorkflowResponse } from '@mastra/client-js';\nimport { ReactFlowProvider } from '@xyflow/react';\nimport { useContext, useMemo } from 'react';\nimport { WorkflowRunContext } from '../context/workflow-run-context';\nimport { WorkflowGraphBoundary } from './workflow-graph-boundary';\nimport { WorkflowGraphInner } from './workflow-graph-inner';\nimport { WorkflowGraphPlaceholder } from '@/ds/components/Workflow';\nimport { lodashTitleCase } from '@/utils/string';\n\nexport interface WorkflowGraphProps {\n workflowId: string;\n isLoading?: boolean;\n workflow?: GetWorkflowResponse;\n requestContext: Record<string, any>;\n}\n\nexport function WorkflowGraph({ workflowId, workflow, isLoading, requestContext }: WorkflowGraphProps) {\n const { runSnapshot, snapshot } = useContext(WorkflowRunContext);\n const stepGraph = runSnapshot?.serializedStepGraph ?? snapshot?.serializedStepGraph ?? workflow?.stepGraph;\n const layoutKey = useMemo(() => `${workflowId}:${JSON.stringify(stepGraph)}`, [workflowId, stepGraph]);\n\n if (isLoading) return <WorkflowGraphPlaceholder isLoading />;\n if (!workflow || !stepGraph) return <WorkflowGraphPlaceholder workflowName={lodashTitleCase(workflowId)} />;\n\n return (\n <ReactFlowProvider key={layoutKey}>\n <WorkflowGraphBoundary stepGraph={stepGraph}>\n <WorkflowGraphInner stepGraph={stepGraph} requestContext={requestContext} />\n </WorkflowGraphBoundary>\n </ReactFlowProvider>\n );\n}\n"],"mappings":";;;;;;;;;;AAgBA,SAAgB,cAAc,EAAE,YAAY,UAAU,WAAW,kBAAsC;CACrG,MAAM,EAAE,aAAa,cAAA,GAAaA,MAAAA,WAAAA,CAAWC,uDAAAA,kBAAkB;CAC/D,MAAM,YAAY,aAAa,uBAAuB,UAAU,uBAAuB,UAAU;CACjG,MAAM,aAAA,GAAYC,MAAAA,QAAAA,OAAc,GAAG,WAAW,GAAG,KAAK,UAAU,SAAS,KAAK,CAAC,YAAY,SAAS,CAAC;CAErG,IAAI,WAAW,OAAO,iBAAA,GAAA,kBAAA,IAAA,CAACC,iBAAAA,0BAAD,EAA0B,WAAA,KAAW,CAAA;CAC3D,IAAI,CAAC,YAAY,CAAC,WAAW,OAAO,iBAAA,GAAA,kBAAA,IAAA,CAACA,iBAAAA,0BAAD,EAA0B,cAAcC,eAAAA,gBAAgB,UAAU,EAAI,CAAA;CAE1G,OACE,iBAAA,GAAA,kBAAA,IAAA,CAACC,cAAAA,mBAAD,EAAA,UACE,iBAAA,GAAA,kBAAA,IAAA,CAACC,2DAAAA,uBAAD;EAAkC;EAChC,UAAA,iBAAA,GAAA,kBAAA,IAAA,CAACC,wDAAAA,oBAAD;GAA+B;GAA2B;EAAiB,CAAA;CACtD,CAAA,EACN,GAJK,SAIL;AAEvB"}
@@ -1,4 +1,4 @@
1
- import { lodashTitleCase } from "../../../utils/string.es.js";
1
+ import { t as lodashTitleCase } from "../../../string-CuGKN25d.js";
2
2
  import { WorkflowRunContext } from "../context/workflow-run-context.es.js";
3
3
  import { WorkflowGraphBoundary } from "./workflow-graph-boundary.es.js";
4
4
  import { i as WorkflowGraphPlaceholder } from "../../../Workflow-CDr2xxyj.js";
@@ -3,7 +3,8 @@ require('../../app-shell.css');const require_utils = require("../../utils-01CRPd
3
3
  const require_primitives_raised_surface = require("../../primitives/raised-surface.cjs.js");
4
4
  let react_jsx_runtime = require("react/jsx-runtime");
5
5
  //#region src/ds/new/layout/app-shell/app-shell.tsx
6
- function AppShell({ children, className, mobileHeader, ref, sidebar, ...props }) {
6
+ function AppShell({ children, className, edgeToEdge, mobileHeader, ref, sidebar, ...props }) {
7
+ const animatesEdgeToEdge = edgeToEdge !== void 0;
7
8
  return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
8
9
  ref,
9
10
  "data-slot": "app-shell",
@@ -14,7 +15,7 @@ function AppShell({ children, className, mobileHeader, ref, sidebar, ...props })
14
15
  className: "flex h-full min-h-0 min-w-0 flex-col",
15
16
  children: [mobileHeader, /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
16
17
  "data-slot": "app-shell-body",
17
- className: require_utils.cn("flex min-h-0 flex-1 flex-col", "lg:py-2 lg:pr-2", sidebar ? "lg:pl-0" : "lg:pl-2"),
18
+ className: require_utils.cn("flex min-h-0 flex-1 flex-col", animatesEdgeToEdge && "transition-[padding] duration-(--resize-dur) ease-(--resize-ease) motion-reduce:transition-none!", animatesEdgeToEdge && "in-data-[sidebar-gesture=active]:transition-none!", !edgeToEdge && "lg:py-2 lg:pr-2", !edgeToEdge && (sidebar ? "lg:pl-0" : "lg:pl-2")),
18
19
  children
19
20
  })]
20
21
  })]
@@ -22,10 +23,11 @@ function AppShell({ children, className, mobileHeader, ref, sidebar, ...props })
22
23
  }
23
24
  //#endregion
24
25
  //#region src/ds/new/layout/app-shell/main-card.tsx
25
- function MainCard({ children, className }) {
26
+ function MainCard({ children, className, edgeToEdge }) {
27
+ const animatesEdgeToEdge = edgeToEdge !== void 0;
26
28
  return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
27
29
  "data-slot": "main-card",
28
- className: require_utils.cn("relative min-h-0 flex-1 overflow-hidden lg:rounded-studio-frame lg:p-px lg:shadow-raised", require_primitives_raised_surface.frameFillStyle, className),
30
+ className: require_utils.cn("relative min-h-0 flex-1 overflow-hidden", animatesEdgeToEdge && "transition-[border-radius,padding,box-shadow] duration-(--resize-dur) ease-(--resize-ease) motion-reduce:transition-none!", animatesEdgeToEdge && "in-data-[sidebar-gesture=active]:transition-none!", !edgeToEdge && "lg:rounded-studio-frame lg:p-px lg:shadow-raised", require_primitives_raised_surface.frameFillStyle, className),
29
31
  children
30
32
  });
31
33
  }
@@ -1 +1 @@
1
- {"version":3,"file":"app-shell.cjs.js","names":["cn","cn","frameFillStyle"],"sources":["../../../src/ds/new/layout/app-shell/app-shell.tsx","../../../src/ds/new/layout/app-shell/main-card.tsx"],"sourcesContent":["import type { ComponentPropsWithRef, ReactNode } from 'react';\n\nimport { cn } from '@/lib/utils';\n\nimport './app-shell.css';\n\nexport interface AppShellProps extends Omit<ComponentPropsWithRef<'div'>, 'children'> {\n children: ReactNode;\n mobileHeader?: ReactNode;\n sidebar?: ReactNode;\n}\n\nexport function AppShell({ children, className, mobileHeader, ref, sidebar, ...props }: AppShellProps) {\n return (\n <div\n ref={ref}\n data-slot=\"app-shell\"\n className={cn(\n 'h-full min-h-0',\n sidebar && 'lg:grid lg:grid-cols-[auto_minmax(0,1fr)] lg:grid-rows-[1fr]',\n className,\n )}\n {...props}\n >\n {sidebar}\n <div data-slot=\"app-shell-content\" className=\"flex h-full min-h-0 min-w-0 flex-col\">\n {mobileHeader}\n <div\n data-slot=\"app-shell-body\"\n className={cn(\n 'flex min-h-0 flex-1 flex-col',\n // Below lg the sidebar is a drawer and the content runs edge to edge under the mobile header.\n // From lg it's inset on every side; with a sidebar column the sidebar's own padding provides the left gap.\n // Longhands only: consumer CSS that also emits a padding shorthand can't override the lg inset.\n 'lg:py-2 lg:pr-2',\n sidebar ? 'lg:pl-0' : 'lg:pl-2',\n )}\n >\n {children}\n </div>\n </div>\n </div>\n );\n}\n","import type { ReactNode } from 'react';\n\nimport { frameFillStyle } from '@/ds/primitives/raised-surface';\nimport { cn } from '@/lib/utils';\n\n// The app frame surface inside `AppShell`. Spacing around it is owned by the shell, not the card.\n// Framed only from lg, where the sidebar sits beside it (the sidebar's drawer breakpoint); below lg it is\n// flat page content under the mobile header. lg-only classes, not max-lg overrides, so consumer CSS that\n// also emits the base classes can't undo the flat state by source order.\n// Reserve the 1px inset rim so child dividers don't paint over it and stack their alpha.\nexport function MainCard({ children, className }: { children: ReactNode; className?: string }) {\n return (\n <div\n data-slot=\"main-card\"\n className={cn(\n 'relative min-h-0 flex-1 overflow-hidden lg:rounded-studio-frame lg:p-px lg:shadow-raised',\n frameFillStyle,\n className,\n )}\n >\n {children}\n </div>\n );\n}\n"],"mappings":";;;;;AAYA,SAAgB,SAAS,EAAE,UAAU,WAAW,cAAc,KAAK,SAAS,GAAG,SAAwB;CACrG,OACE,iBAAA,GAAA,kBAAA,KAAA,CAAC,OAAD;EACO;EACL,aAAU;EACV,WAAWA,cAAAA,GACT,kBACA,WAAW,gEACX,SACF;EACA,GAAI;EARN,UAAA,CAUG,SACD,iBAAA,GAAA,kBAAA,KAAA,CAAC,OAAD;GAAK,aAAU;GAAoB,WAAU;GAA7C,UAAA,CACG,cACD,iBAAA,GAAA,kBAAA,IAAA,CAAC,OAAD;IACE,aAAU;IACV,WAAWA,cAAAA,GACT,gCAIA,mBACA,UAAU,YAAY,SACxB;IAEC;GACE,CAAA,CACF;EACF,CAAA,CAAA;;AAET;;;ACjCA,SAAgB,SAAS,EAAE,UAAU,aAA0D;CAC7F,OACE,iBAAA,GAAA,kBAAA,IAAA,CAAC,OAAD;EACE,aAAU;EACV,WAAWC,cAAAA,GACT,4FACAC,kCAAAA,gBACA,SACF;EAEC;CACE,CAAA;AAET"}
1
+ {"version":3,"file":"app-shell.cjs.js","names":["cn","cn","frameFillStyle"],"sources":["../../../src/ds/new/layout/app-shell/app-shell.tsx","../../../src/ds/new/layout/app-shell/main-card.tsx"],"sourcesContent":["import type { ComponentPropsWithRef, ReactNode } from 'react';\n\nimport { cn } from '@/lib/utils';\n\nimport './app-shell.css';\n\nexport interface AppShellProps extends Omit<ComponentPropsWithRef<'div'>, 'children'> {\n children: ReactNode;\n mobileHeader?: ReactNode;\n sidebar?: ReactNode;\n edgeToEdge?: boolean;\n}\n\nexport function AppShell({ children, className, edgeToEdge, mobileHeader, ref, sidebar, ...props }: AppShellProps) {\n const animatesEdgeToEdge = edgeToEdge !== undefined;\n\n return (\n <div\n ref={ref}\n data-slot=\"app-shell\"\n className={cn(\n 'h-full min-h-0',\n sidebar && 'lg:grid lg:grid-cols-[auto_minmax(0,1fr)] lg:grid-rows-[1fr]',\n className,\n )}\n {...props}\n >\n {sidebar}\n <div data-slot=\"app-shell-content\" className=\"flex h-full min-h-0 min-w-0 flex-col\">\n {mobileHeader}\n <div\n data-slot=\"app-shell-body\"\n className={cn(\n 'flex min-h-0 flex-1 flex-col',\n animatesEdgeToEdge &&\n 'transition-[padding] duration-(--resize-dur) ease-(--resize-ease) motion-reduce:transition-none!',\n animatesEdgeToEdge && 'in-data-[sidebar-gesture=active]:transition-none!',\n // Below lg the sidebar is a drawer and the content runs edge to edge under the mobile header.\n // From lg it's inset on every side; with a sidebar column the sidebar's own padding provides the left gap.\n // Longhands only: consumer CSS that also emits a padding shorthand can't override the lg inset.\n !edgeToEdge && 'lg:py-2 lg:pr-2',\n !edgeToEdge && (sidebar ? 'lg:pl-0' : 'lg:pl-2'),\n )}\n >\n {children}\n </div>\n </div>\n </div>\n );\n}\n","import type { ReactNode } from 'react';\n\nimport { frameFillStyle } from '@/ds/primitives/raised-surface';\nimport { cn } from '@/lib/utils';\n\n// The app frame surface inside `AppShell`. Spacing around it is owned by the shell, not the card.\n// Framed only from lg, where the sidebar sits beside it (the sidebar's drawer breakpoint); below lg it is\n// flat page content under the mobile header. lg-only classes, not max-lg overrides, so consumer CSS that\n// also emits the base classes can't undo the flat state by source order.\n// Reserve the 1px inset rim so child dividers don't paint over it and stack their alpha.\nexport function MainCard({\n children,\n className,\n edgeToEdge,\n}: {\n children: ReactNode;\n className?: string;\n edgeToEdge?: boolean;\n}) {\n const animatesEdgeToEdge = edgeToEdge !== undefined;\n\n return (\n <div\n data-slot=\"main-card\"\n className={cn(\n 'relative min-h-0 flex-1 overflow-hidden',\n animatesEdgeToEdge &&\n 'transition-[border-radius,padding,box-shadow] duration-(--resize-dur) ease-(--resize-ease) motion-reduce:transition-none!',\n animatesEdgeToEdge && 'in-data-[sidebar-gesture=active]:transition-none!',\n !edgeToEdge && 'lg:rounded-studio-frame lg:p-px lg:shadow-raised',\n frameFillStyle,\n className,\n )}\n >\n {children}\n </div>\n );\n}\n"],"mappings":";;;;;AAaA,SAAgB,SAAS,EAAE,UAAU,WAAW,YAAY,cAAc,KAAK,SAAS,GAAG,SAAwB;CACjH,MAAM,qBAAqB,eAAe,KAAA;CAE1C,OACE,iBAAA,GAAA,kBAAA,KAAA,CAAC,OAAD;EACO;EACL,aAAU;EACV,WAAWA,cAAAA,GACT,kBACA,WAAW,gEACX,SACF;EACA,GAAI;EARN,UAAA,CAUG,SACD,iBAAA,GAAA,kBAAA,KAAA,CAAC,OAAD;GAAK,aAAU;GAAoB,WAAU;GAA7C,UAAA,CACG,cACD,iBAAA,GAAA,kBAAA,IAAA,CAAC,OAAD;IACE,aAAU;IACV,WAAWA,cAAAA,GACT,gCACA,sBACE,oGACF,sBAAsB,qDAItB,CAAC,cAAc,mBACf,CAAC,eAAe,UAAU,YAAY,UACxC;IAEC;GACE,CAAA,CACF;EACF,CAAA,CAAA;;AAET;;;ACvCA,SAAgB,SAAS,EACvB,UACA,WACA,cAKC;CACD,MAAM,qBAAqB,eAAe,KAAA;CAE1C,OACE,iBAAA,GAAA,kBAAA,IAAA,CAAC,OAAD;EACE,aAAU;EACV,WAAWC,cAAAA,GACT,2CACA,sBACE,6HACF,sBAAsB,qDACtB,CAAC,cAAc,oDACfC,kCAAAA,gBACA,SACF;EAEC;CACE,CAAA;AAET"}
@@ -2,7 +2,8 @@ import { t as cn } from "../../utils-BiHZnbcQ.js";
2
2
  import { frameFillStyle } from "../../primitives/raised-surface.es.js";
3
3
  import { jsx, jsxs } from "react/jsx-runtime";
4
4
  import '../../app-shell.css';//#region src/ds/new/layout/app-shell/app-shell.tsx
5
- function AppShell({ children, className, mobileHeader, ref, sidebar, ...props }) {
5
+ function AppShell({ children, className, edgeToEdge, mobileHeader, ref, sidebar, ...props }) {
6
+ const animatesEdgeToEdge = edgeToEdge !== void 0;
6
7
  return /* @__PURE__ */ jsxs("div", {
7
8
  ref,
8
9
  "data-slot": "app-shell",
@@ -13,7 +14,7 @@ function AppShell({ children, className, mobileHeader, ref, sidebar, ...props })
13
14
  className: "flex h-full min-h-0 min-w-0 flex-col",
14
15
  children: [mobileHeader, /* @__PURE__ */ jsx("div", {
15
16
  "data-slot": "app-shell-body",
16
- className: cn("flex min-h-0 flex-1 flex-col", "lg:py-2 lg:pr-2", sidebar ? "lg:pl-0" : "lg:pl-2"),
17
+ className: cn("flex min-h-0 flex-1 flex-col", animatesEdgeToEdge && "transition-[padding] duration-(--resize-dur) ease-(--resize-ease) motion-reduce:transition-none!", animatesEdgeToEdge && "in-data-[sidebar-gesture=active]:transition-none!", !edgeToEdge && "lg:py-2 lg:pr-2", !edgeToEdge && (sidebar ? "lg:pl-0" : "lg:pl-2")),
17
18
  children
18
19
  })]
19
20
  })]
@@ -21,10 +22,11 @@ function AppShell({ children, className, mobileHeader, ref, sidebar, ...props })
21
22
  }
22
23
  //#endregion
23
24
  //#region src/ds/new/layout/app-shell/main-card.tsx
24
- function MainCard({ children, className }) {
25
+ function MainCard({ children, className, edgeToEdge }) {
26
+ const animatesEdgeToEdge = edgeToEdge !== void 0;
25
27
  return /* @__PURE__ */ jsx("div", {
26
28
  "data-slot": "main-card",
27
- className: cn("relative min-h-0 flex-1 overflow-hidden lg:rounded-studio-frame lg:p-px lg:shadow-raised", frameFillStyle, className),
29
+ className: cn("relative min-h-0 flex-1 overflow-hidden", animatesEdgeToEdge && "transition-[border-radius,padding,box-shadow] duration-(--resize-dur) ease-(--resize-ease) motion-reduce:transition-none!", animatesEdgeToEdge && "in-data-[sidebar-gesture=active]:transition-none!", !edgeToEdge && "lg:rounded-studio-frame lg:p-px lg:shadow-raised", frameFillStyle, className),
28
30
  children
29
31
  });
30
32
  }
@@ -1 +1 @@
1
- {"version":3,"file":"app-shell.es.js","names":[],"sources":["../../../src/ds/new/layout/app-shell/app-shell.tsx","../../../src/ds/new/layout/app-shell/main-card.tsx"],"sourcesContent":["import type { ComponentPropsWithRef, ReactNode } from 'react';\n\nimport { cn } from '@/lib/utils';\n\nimport './app-shell.css';\n\nexport interface AppShellProps extends Omit<ComponentPropsWithRef<'div'>, 'children'> {\n children: ReactNode;\n mobileHeader?: ReactNode;\n sidebar?: ReactNode;\n}\n\nexport function AppShell({ children, className, mobileHeader, ref, sidebar, ...props }: AppShellProps) {\n return (\n <div\n ref={ref}\n data-slot=\"app-shell\"\n className={cn(\n 'h-full min-h-0',\n sidebar && 'lg:grid lg:grid-cols-[auto_minmax(0,1fr)] lg:grid-rows-[1fr]',\n className,\n )}\n {...props}\n >\n {sidebar}\n <div data-slot=\"app-shell-content\" className=\"flex h-full min-h-0 min-w-0 flex-col\">\n {mobileHeader}\n <div\n data-slot=\"app-shell-body\"\n className={cn(\n 'flex min-h-0 flex-1 flex-col',\n // Below lg the sidebar is a drawer and the content runs edge to edge under the mobile header.\n // From lg it's inset on every side; with a sidebar column the sidebar's own padding provides the left gap.\n // Longhands only: consumer CSS that also emits a padding shorthand can't override the lg inset.\n 'lg:py-2 lg:pr-2',\n sidebar ? 'lg:pl-0' : 'lg:pl-2',\n )}\n >\n {children}\n </div>\n </div>\n </div>\n );\n}\n","import type { ReactNode } from 'react';\n\nimport { frameFillStyle } from '@/ds/primitives/raised-surface';\nimport { cn } from '@/lib/utils';\n\n// The app frame surface inside `AppShell`. Spacing around it is owned by the shell, not the card.\n// Framed only from lg, where the sidebar sits beside it (the sidebar's drawer breakpoint); below lg it is\n// flat page content under the mobile header. lg-only classes, not max-lg overrides, so consumer CSS that\n// also emits the base classes can't undo the flat state by source order.\n// Reserve the 1px inset rim so child dividers don't paint over it and stack their alpha.\nexport function MainCard({ children, className }: { children: ReactNode; className?: string }) {\n return (\n <div\n data-slot=\"main-card\"\n className={cn(\n 'relative min-h-0 flex-1 overflow-hidden lg:rounded-studio-frame lg:p-px lg:shadow-raised',\n frameFillStyle,\n className,\n )}\n >\n {children}\n </div>\n );\n}\n"],"mappings":";;;;AAYA,SAAgB,SAAS,EAAE,UAAU,WAAW,cAAc,KAAK,SAAS,GAAG,SAAwB;CACrG,OACE,qBAAC,OAAD;EACO;EACL,aAAU;EACV,WAAW,GACT,kBACA,WAAW,gEACX,SACF;EACA,GAAI;EARN,UAAA,CAUG,SACD,qBAAC,OAAD;GAAK,aAAU;GAAoB,WAAU;GAA7C,UAAA,CACG,cACD,oBAAC,OAAD;IACE,aAAU;IACV,WAAW,GACT,gCAIA,mBACA,UAAU,YAAY,SACxB;IAEC;GACE,CAAA,CACF;EACF,CAAA,CAAA;;AAET;;;ACjCA,SAAgB,SAAS,EAAE,UAAU,aAA0D;CAC7F,OACE,oBAAC,OAAD;EACE,aAAU;EACV,WAAW,GACT,4FACA,gBACA,SACF;EAEC;CACE,CAAA;AAET"}
1
+ {"version":3,"file":"app-shell.es.js","names":[],"sources":["../../../src/ds/new/layout/app-shell/app-shell.tsx","../../../src/ds/new/layout/app-shell/main-card.tsx"],"sourcesContent":["import type { ComponentPropsWithRef, ReactNode } from 'react';\n\nimport { cn } from '@/lib/utils';\n\nimport './app-shell.css';\n\nexport interface AppShellProps extends Omit<ComponentPropsWithRef<'div'>, 'children'> {\n children: ReactNode;\n mobileHeader?: ReactNode;\n sidebar?: ReactNode;\n edgeToEdge?: boolean;\n}\n\nexport function AppShell({ children, className, edgeToEdge, mobileHeader, ref, sidebar, ...props }: AppShellProps) {\n const animatesEdgeToEdge = edgeToEdge !== undefined;\n\n return (\n <div\n ref={ref}\n data-slot=\"app-shell\"\n className={cn(\n 'h-full min-h-0',\n sidebar && 'lg:grid lg:grid-cols-[auto_minmax(0,1fr)] lg:grid-rows-[1fr]',\n className,\n )}\n {...props}\n >\n {sidebar}\n <div data-slot=\"app-shell-content\" className=\"flex h-full min-h-0 min-w-0 flex-col\">\n {mobileHeader}\n <div\n data-slot=\"app-shell-body\"\n className={cn(\n 'flex min-h-0 flex-1 flex-col',\n animatesEdgeToEdge &&\n 'transition-[padding] duration-(--resize-dur) ease-(--resize-ease) motion-reduce:transition-none!',\n animatesEdgeToEdge && 'in-data-[sidebar-gesture=active]:transition-none!',\n // Below lg the sidebar is a drawer and the content runs edge to edge under the mobile header.\n // From lg it's inset on every side; with a sidebar column the sidebar's own padding provides the left gap.\n // Longhands only: consumer CSS that also emits a padding shorthand can't override the lg inset.\n !edgeToEdge && 'lg:py-2 lg:pr-2',\n !edgeToEdge && (sidebar ? 'lg:pl-0' : 'lg:pl-2'),\n )}\n >\n {children}\n </div>\n </div>\n </div>\n );\n}\n","import type { ReactNode } from 'react';\n\nimport { frameFillStyle } from '@/ds/primitives/raised-surface';\nimport { cn } from '@/lib/utils';\n\n// The app frame surface inside `AppShell`. Spacing around it is owned by the shell, not the card.\n// Framed only from lg, where the sidebar sits beside it (the sidebar's drawer breakpoint); below lg it is\n// flat page content under the mobile header. lg-only classes, not max-lg overrides, so consumer CSS that\n// also emits the base classes can't undo the flat state by source order.\n// Reserve the 1px inset rim so child dividers don't paint over it and stack their alpha.\nexport function MainCard({\n children,\n className,\n edgeToEdge,\n}: {\n children: ReactNode;\n className?: string;\n edgeToEdge?: boolean;\n}) {\n const animatesEdgeToEdge = edgeToEdge !== undefined;\n\n return (\n <div\n data-slot=\"main-card\"\n className={cn(\n 'relative min-h-0 flex-1 overflow-hidden',\n animatesEdgeToEdge &&\n 'transition-[border-radius,padding,box-shadow] duration-(--resize-dur) ease-(--resize-ease) motion-reduce:transition-none!',\n animatesEdgeToEdge && 'in-data-[sidebar-gesture=active]:transition-none!',\n !edgeToEdge && 'lg:rounded-studio-frame lg:p-px lg:shadow-raised',\n frameFillStyle,\n className,\n )}\n >\n {children}\n </div>\n );\n}\n"],"mappings":";;;;AAaA,SAAgB,SAAS,EAAE,UAAU,WAAW,YAAY,cAAc,KAAK,SAAS,GAAG,SAAwB;CACjH,MAAM,qBAAqB,eAAe,KAAA;CAE1C,OACE,qBAAC,OAAD;EACO;EACL,aAAU;EACV,WAAW,GACT,kBACA,WAAW,gEACX,SACF;EACA,GAAI;EARN,UAAA,CAUG,SACD,qBAAC,OAAD;GAAK,aAAU;GAAoB,WAAU;GAA7C,UAAA,CACG,cACD,oBAAC,OAAD;IACE,aAAU;IACV,WAAW,GACT,gCACA,sBACE,oGACF,sBAAsB,qDAItB,CAAC,cAAc,mBACf,CAAC,eAAe,UAAU,YAAY,UACxC;IAEC;GACE,CAAA,CACF;EACF,CAAA,CAAA;;AAET;;;ACvCA,SAAgB,SAAS,EACvB,UACA,WACA,cAKC;CACD,MAAM,qBAAqB,eAAe,KAAA;CAE1C,OACE,oBAAC,OAAD;EACE,aAAU;EACV,WAAW,GACT,2CACA,sBACE,6HACF,sBAAsB,qDACtB,CAAC,cAAc,oDACf,gBACA,SACF;EAEC;CACE,CAAA;AAET"}
@@ -0,0 +1,16 @@
1
+ import type { ReactNode } from 'react';
2
+ export interface CodeDiffFileHeader {
3
+ path: string;
4
+ /** The path before a rename or move, shown under the current one. */
5
+ previousPath?: string;
6
+ /** Shown before the path, e.g. the kind of change. Give it an accessible name. */
7
+ icon?: ReactNode;
8
+ /** Shown at the header's right edge, e.g. the line counts. */
9
+ meta?: ReactNode;
10
+ }
11
+ interface CodeDiffHeaderProps extends CodeDiffFileHeader {
12
+ collapsed: boolean;
13
+ onToggle?(): void;
14
+ }
15
+ export declare function CodeDiffHeader({ path, previousPath, icon, meta, collapsed, onToggle }: CodeDiffHeaderProps): import("react").JSX.Element;
16
+ export {};
@@ -0,0 +1,7 @@
1
+ import type { ReactNode } from 'react';
2
+ export interface CodeDiffListProps {
3
+ children: ReactNode;
4
+ className?: string;
5
+ }
6
+ /** Stacks `CodeDiff`s edge to edge like a pull request, rendering only the lines in view so long change sets stay fast. */
7
+ export declare function CodeDiffList({ children, className }: CodeDiffListProps): import("react").JSX.Element;
@@ -1,7 +1,6 @@
1
- export type CodeDiffProps = {
2
- className?: string;
3
- layout?: 'split' | 'unified';
4
- } & ({
1
+ import type { Ref } from 'react';
2
+ import type { CodeDiffFileHeader } from './code-diff-header';
3
+ type CodeDiffSource = {
5
4
  codeA: string;
6
5
  codeB: string;
7
6
  filename?: string;
@@ -11,5 +10,23 @@ export type CodeDiffProps = {
11
10
  codeA?: never;
12
11
  codeB?: never;
13
12
  filename?: never;
14
- });
15
- export declare function CodeDiff({ className, layout, ...source }: CodeDiffProps): import("react").JSX.Element;
13
+ };
14
+ type NoCodeDiffSource = {
15
+ patch?: never;
16
+ codeA?: never;
17
+ codeB?: never;
18
+ filename?: never;
19
+ };
20
+ export type CodeDiffProps = {
21
+ className?: string;
22
+ layout?: 'split' | 'unified';
23
+ /** `wrap` (default) breaks long lines — best for prose. `scroll` keeps columns behind a horizontal scroll — best for source code. */
24
+ overflow?: 'wrap' | 'scroll';
25
+ ref?: Ref<HTMLDivElement>;
26
+ } & (({
27
+ header?: CodeDiffFileHeader;
28
+ } & CodeDiffSource) | ({
29
+ header: CodeDiffFileHeader;
30
+ } & NoCodeDiffSource));
31
+ export declare function CodeDiff({ className, layout, overflow, header, ref, ...source }: CodeDiffProps): import("react").JSX.Element;
32
+ export {};
@@ -1,2 +1,5 @@
1
1
  export { CodeDiff } from './code-diff';
2
2
  export type { CodeDiffProps } from './code-diff';
3
+ export type { CodeDiffFileHeader } from './code-diff-header';
4
+ export { CodeDiffList } from './code-diff-list';
5
+ export type { CodeDiffListProps } from './code-diff-list';
@@ -0,0 +1,6 @@
1
+ export interface DiffStatProps {
2
+ additions: number;
3
+ deletions: number;
4
+ className?: string;
5
+ }
6
+ export declare function DiffStat({ additions, deletions, className }: DiffStatProps): import("react").JSX.Element;
@@ -0,0 +1 @@
1
+ export * from './diff-stat';
@@ -3,5 +3,6 @@ export interface AppShellProps extends Omit<ComponentPropsWithRef<'div'>, 'child
3
3
  children: ReactNode;
4
4
  mobileHeader?: ReactNode;
5
5
  sidebar?: ReactNode;
6
+ edgeToEdge?: boolean;
6
7
  }
7
- export declare function AppShell({ children, className, mobileHeader, ref, sidebar, ...props }: AppShellProps): import("react").JSX.Element;
8
+ export declare function AppShell({ children, className, edgeToEdge, mobileHeader, ref, sidebar, ...props }: AppShellProps): import("react").JSX.Element;
@@ -1,5 +1,6 @@
1
1
  import type { ReactNode } from 'react';
2
- export declare function MainCard({ children, className }: {
2
+ export declare function MainCard({ children, className, edgeToEdge, }: {
3
3
  children: ReactNode;
4
4
  className?: string;
5
+ edgeToEdge?: boolean;
5
6
  }): import("react").JSX.Element;
@@ -6,4 +6,6 @@ export type ResolvedModel = {
6
6
  };
7
7
  export declare function formatModelName(model: string): string;
8
8
  export declare function formatProviderName(provider: string): string;
9
+ /** Compare catalog release dates newest first; unknown or invalid dates follow known dates. */
10
+ export declare function compareModelReleaseDates(a?: string, b?: string): number;
9
11
  export declare function resolveModel(value: string): ResolvedModel;
@@ -0,0 +1,24 @@
1
+ //#region src/lib/string.ts
2
+ var lodashTitleCase = (str) => {
3
+ return str.replace(/[-_\s]+(.)?/g, (_, char) => char ? char.toUpperCase() : "").replace(/^(.)/, (char) => char.toLowerCase()).replace(/([A-Z])/g, " $1").replace(/^./, (str) => str.toUpperCase()).trim();
4
+ };
5
+ var pluralRules = new Intl.PluralRules("en-US");
6
+ var count = new Intl.NumberFormat("en-US");
7
+ function pluralize(amount, singular, plural = `${singular}s`) {
8
+ return `${count.format(amount)} ${pluralRules.select(amount) === "one" ? singular : plural}`;
9
+ }
10
+ //#endregion
11
+ Object.defineProperty(exports, "lodashTitleCase", {
12
+ enumerable: true,
13
+ get: function() {
14
+ return lodashTitleCase;
15
+ }
16
+ });
17
+ Object.defineProperty(exports, "pluralize", {
18
+ enumerable: true,
19
+ get: function() {
20
+ return pluralize;
21
+ }
22
+ });
23
+
24
+ //# sourceMappingURL=string-Bu8NTsPl.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"string-Bu8NTsPl.cjs","names":[],"sources":["../src/lib/string.ts"],"sourcesContent":["export const lodashTitleCase = (str: string): string => {\n // First convert to camel case (handles various separators like spaces, hyphens, underscores)\n const camelCased = str\n .replace(/[-_\\s]+(.)?/g, (_, char) => (char ? char.toUpperCase() : ''))\n .replace(/^(.)/, char => char.toLowerCase());\n\n // Then convert to start case (capitalize first letter of each word)\n return camelCased\n .replace(/([A-Z])/g, ' $1')\n .replace(/^./, str => str.toUpperCase())\n .trim();\n};\n\nconst pluralRules = new Intl.PluralRules('en-US');\nconst count = new Intl.NumberFormat('en-US');\n\nexport function pluralize(amount: number, singular: string, plural = `${singular}s`): string {\n return `${count.format(amount)} ${pluralRules.select(amount) === 'one' ? singular : plural}`;\n}\n"],"mappings":";AAAA,IAAa,mBAAmB,QAAwB;CAOtD,OALmB,IAChB,QAAQ,iBAAiB,GAAG,SAAU,OAAO,KAAK,YAAY,IAAI,EAAG,CAAC,CACtE,QAAQ,SAAQ,SAAQ,KAAK,YAAY,CAGrC,CAAA,CACJ,QAAQ,YAAY,KAAK,CAAC,CAC1B,QAAQ,OAAM,QAAO,IAAI,YAAY,CAAC,CAAC,CACvC,KAAK;AACV;AAEA,IAAM,cAAc,IAAI,KAAK,YAAY,OAAO;AAChD,IAAM,QAAQ,IAAI,KAAK,aAAa,OAAO;AAE3C,SAAgB,UAAU,QAAgB,UAAkB,SAAS,GAAG,SAAS,IAAY;CAC3F,OAAO,GAAG,MAAM,OAAO,MAAM,EAAE,GAAG,YAAY,OAAO,MAAM,MAAM,QAAQ,WAAW;AACtF"}
@@ -0,0 +1,13 @@
1
+ //#region src/lib/string.ts
2
+ var lodashTitleCase = (str) => {
3
+ return str.replace(/[-_\s]+(.)?/g, (_, char) => char ? char.toUpperCase() : "").replace(/^(.)/, (char) => char.toLowerCase()).replace(/([A-Z])/g, " $1").replace(/^./, (str) => str.toUpperCase()).trim();
4
+ };
5
+ var pluralRules = new Intl.PluralRules("en-US");
6
+ var count = new Intl.NumberFormat("en-US");
7
+ function pluralize(amount, singular, plural = `${singular}s`) {
8
+ return `${count.format(amount)} ${pluralRules.select(amount) === "one" ? singular : plural}`;
9
+ }
10
+ //#endregion
11
+ export { pluralize as n, lodashTitleCase as t };
12
+
13
+ //# sourceMappingURL=string-CuGKN25d.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"string-CuGKN25d.js","names":[],"sources":["../src/lib/string.ts"],"sourcesContent":["export const lodashTitleCase = (str: string): string => {\n // First convert to camel case (handles various separators like spaces, hyphens, underscores)\n const camelCased = str\n .replace(/[-_\\s]+(.)?/g, (_, char) => (char ? char.toUpperCase() : ''))\n .replace(/^(.)/, char => char.toLowerCase());\n\n // Then convert to start case (capitalize first letter of each word)\n return camelCased\n .replace(/([A-Z])/g, ' $1')\n .replace(/^./, str => str.toUpperCase())\n .trim();\n};\n\nconst pluralRules = new Intl.PluralRules('en-US');\nconst count = new Intl.NumberFormat('en-US');\n\nexport function pluralize(amount: number, singular: string, plural = `${singular}s`): string {\n return `${count.format(amount)} ${pluralRules.select(amount) === 'one' ? singular : plural}`;\n}\n"],"mappings":";AAAA,IAAa,mBAAmB,QAAwB;CAOtD,OALmB,IAChB,QAAQ,iBAAiB,GAAG,SAAU,OAAO,KAAK,YAAY,IAAI,EAAG,CAAC,CACtE,QAAQ,SAAQ,SAAQ,KAAK,YAAY,CAGrC,CAAA,CACJ,QAAQ,YAAY,KAAK,CAAC,CAC1B,QAAQ,OAAM,QAAO,IAAI,YAAY,CAAC,CAAC,CACvC,KAAK;AACV;AAEA,IAAM,cAAc,IAAI,KAAK,YAAY,OAAO;AAChD,IAAM,QAAQ,IAAI,KAAK,aAAa,OAAO;AAE3C,SAAgB,UAAU,QAAgB,UAAkB,SAAS,GAAG,SAAS,IAAY;CAC3F,OAAO,GAAG,MAAM,OAAO,MAAM,EAAE,GAAG,YAAY,OAAO,MAAM,MAAM,QAAQ,WAAW;AACtF"}
package/dist/style.css CHANGED
@@ -2416,6 +2416,14 @@
2416
2416
  height: 400px;
2417
2417
  }
2418
2418
 
2419
+ .h-\[480px\] {
2420
+ height: 480px;
2421
+ }
2422
+
2423
+ .h-\[640px\] {
2424
+ height: 640px;
2425
+ }
2426
+
2419
2427
  .h-\[calc\(85dvh\+1\.5rem\)\] {
2420
2428
  height: calc(85dvh + 1.5rem);
2421
2429
  }
@@ -3544,6 +3552,10 @@
3544
3552
  max-width: 85vw;
3545
3553
  }
3546
3554
 
3555
+ .max-w-\[calc\(100\%-2ch\)\] {
3556
+ max-width: calc(100% - 2ch);
3557
+ }
3558
+
3547
3559
  .max-w-\[calc\(100\%-16px\)\] {
3548
3560
  max-width: calc(100% - 16px);
3549
3561
  }
@@ -3708,6 +3720,10 @@
3708
3720
  min-width: calc(var(--spacing) * 108);
3709
3721
  }
3710
3722
 
3723
+ .min-w-\[2ch\] {
3724
+ min-width: 2ch;
3725
+ }
3726
+
3711
3727
  .min-w-\[3px\] {
3712
3728
  min-width: 3px;
3713
3729
  }
@@ -7603,6 +7619,12 @@
7603
7619
  transition-duration: var(--tw-duration, var(--default-transition-duration));
7604
7620
  }
7605
7621
 
7622
+ .transition-\[border-radius\,padding\,box-shadow\] {
7623
+ transition-property: border-radius, padding, box-shadow;
7624
+ transition-timing-function: var(--tw-ease, var(--default-transition-timing-function));
7625
+ transition-duration: var(--tw-duration, var(--default-transition-duration));
7626
+ }
7627
+
7606
7628
  .transition-\[clip-path\] {
7607
7629
  transition-property: clip-path;
7608
7630
  transition-timing-function: var(--tw-ease, var(--default-transition-timing-function));
@@ -8332,10 +8354,24 @@
8332
8354
  gap: var(--spacing);
8333
8355
  }
8334
8356
 
8357
+ :is(.\*\:rounded-none > *) {
8358
+ border-radius: var(--radius-none);
8359
+ }
8360
+
8335
8361
  :is(.\*\:rounded-sm > *) {
8336
8362
  border-radius: var(--radius-sm);
8337
8363
  }
8338
8364
 
8365
+ :is(.\*\:border-x-0 > *) {
8366
+ border-inline-style: var(--tw-border-style);
8367
+ border-inline-width: 0;
8368
+ }
8369
+
8370
+ :is(.\*\:border-t-0 > *) {
8371
+ border-top-style: var(--tw-border-style);
8372
+ border-top-width: 0;
8373
+ }
8374
+
8339
8375
  :is(.\*\:transition-colors > *) {
8340
8376
  transition-property: color, background-color, border-color, outline-color, text-decoration-color, fill, stroke, --tw-gradient-from, --tw-gradient-via, --tw-gradient-to;
8341
8377
  transition-timing-function: var(--tw-ease, var(--default-transition-timing-function));
@@ -8357,6 +8393,10 @@
8357
8393
  border-bottom-width: 1px;
8358
8394
  }
8359
8395
 
8396
+ .not-last\:border-border:not(:last-child) {
8397
+ border-color: var(--border);
8398
+ }
8399
+
8360
8400
  .not-last\:border-surface-rim:not(:last-child) {
8361
8401
  border-color: var(--surface-rim);
8362
8402
  }
@@ -56,6 +56,15 @@ function formatModelName(model) {
56
56
  function formatProviderName(provider) {
57
57
  return PROVIDER_NAMES.get(provider) ?? provider.split(/[-_]/).filter(Boolean).map(titleCase).join(" ");
58
58
  }
59
+ /** Compare catalog release dates newest first; unknown or invalid dates follow known dates. */
60
+ function compareModelReleaseDates(a, b) {
61
+ const aTime = Date.parse(a ?? "");
62
+ const bTime = Date.parse(b ?? "");
63
+ const aKnown = Number.isFinite(aTime);
64
+ const bKnown = Number.isFinite(bTime);
65
+ if (aKnown && bKnown) return bTime - aTime;
66
+ return Number(bKnown) - Number(aKnown);
67
+ }
59
68
  function resolveModel(value) {
60
69
  const trimmed = value.trim();
61
70
  const slash = trimmed.indexOf("/");
@@ -73,6 +82,7 @@ function resolveModel(value) {
73
82
  };
74
83
  }
75
84
  //#endregion
85
+ exports.compareModelReleaseDates = compareModelReleaseDates;
76
86
  exports.formatModelName = formatModelName;
77
87
  exports.formatProviderName = formatProviderName;
78
88
  exports.resolveModel = resolveModel;
@@ -1 +1 @@
1
- {"version":3,"file":"model.cjs.js","names":[],"sources":["../../src/utils/model.ts"],"sourcesContent":["export type ResolvedModel = {\n provider?: string;\n providerName?: string;\n model: string;\n modelName: string;\n};\n\nconst PROVIDER_NAMES = new Map([\n ['anthropic', 'Anthropic'],\n ['openai', 'OpenAI'],\n ['google', 'Google'],\n ['xai', 'xAI'],\n ['mistral', 'Mistral'],\n ['groq', 'Groq'],\n ['deepseek', 'DeepSeek'],\n ['openrouter', 'OpenRouter'],\n ['meta', 'Meta'],\n ['perplexity', 'Perplexity'],\n ['togetherai', 'Together AI'],\n ['fireworks-ai', 'Fireworks AI'],\n ['cerebras', 'Cerebras'],\n ['vercel', 'Vercel AI Gateway'],\n ['netlify', 'Netlify'],\n ['deepinfra', 'Deep Infra'],\n ['moonshotai', 'Moonshot AI'],\n ['alibaba', 'Alibaba'],\n ['zai', 'Z.AI'],\n ['huggingface', 'Hugging Face'],\n ['nvidia', 'Nvidia'],\n ['lmstudio', 'LMStudio'],\n]);\n\nconst WORD_NAMES = new Map([\n ['gpt', 'GPT'],\n ['oss', 'OSS'],\n ['deepseek', 'DeepSeek'],\n ['glm', 'GLM'],\n ['qwq', 'QwQ'],\n]);\n\nconst DATE_SUFFIX = /(-\\d{8}|-\\d{4}-\\d{2}-\\d{2}|-\\d{2}-\\d{4}|-\\d{4})$/;\nconst BEDROCK_VENDOR_PREFIXES = /^(?:[a-z]+\\.)+/i;\nconst BEDROCK_API_VERSION = /-v\\d+:0$/;\nconst WORD_WITH_MAJOR_VERSION = /^([a-z]{2,})(\\d+)$/;\n\nconst titleCase = (word: string) => WORD_NAMES.get(word) ?? word.charAt(0).toUpperCase() + word.slice(1);\n\nfunction formatWord(word: string) {\n if (/^o\\d/.test(word)) return word;\n if (/^\\d+(\\.\\d+)?[bkm]$/.test(word)) return word.toUpperCase();\n return titleCase(word);\n}\n\nexport function formatModelName(model: string): string {\n const base = (model.split('/').pop() || model).replace(BEDROCK_VENDOR_PREFIXES, '').replace(BEDROCK_API_VERSION, '');\n const tokens = base\n .toLowerCase()\n .replace(DATE_SUFFIX, '')\n .split(/[-_\\s]+/)\n .filter(Boolean);\n\n const words: string[] = [];\n for (const token of tokens) {\n const previous = words[words.length - 1];\n const wordWithMajor = previous?.match(WORD_WITH_MAJOR_VERSION);\n if (previous && /^\\d+$/.test(previous) && /^\\d$/.test(token)) {\n words[words.length - 1] = `${previous}.${token}`;\n } else if (wordWithMajor?.[1] && wordWithMajor[2] && /^\\d$/.test(token)) {\n words.splice(-1, 1, wordWithMajor[1], `${wordWithMajor[2]}.${token}`);\n } else {\n words.push(token);\n }\n }\n\n return words\n .map(formatWord)\n .join(' ')\n .replace(/^GPT (\\S)/, 'GPT-$1');\n}\n\nexport function formatProviderName(provider: string): string {\n return PROVIDER_NAMES.get(provider) ?? provider.split(/[-_]/).filter(Boolean).map(titleCase).join(' ');\n}\n\nexport function resolveModel(value: string): ResolvedModel {\n const trimmed = value.trim();\n const slash = trimmed.indexOf('/');\n if (slash <= 0 || slash === trimmed.length - 1) return { model: trimmed, modelName: formatModelName(trimmed) };\n const provider = (trimmed.slice(0, slash).split('.')[0] ?? '').toLowerCase();\n const model = trimmed.slice(slash + 1);\n return { provider, providerName: formatProviderName(provider), model, modelName: formatModelName(model) };\n}\n"],"mappings":";;AAOA,IAAM,iCAAiB,IAAI,IAAI;CAC7B,CAAC,aAAa,WAAW;CACzB,CAAC,UAAU,QAAQ;CACnB,CAAC,UAAU,QAAQ;CACnB,CAAC,OAAO,KAAK;CACb,CAAC,WAAW,SAAS;CACrB,CAAC,QAAQ,MAAM;CACf,CAAC,YAAY,UAAU;CACvB,CAAC,cAAc,YAAY;CAC3B,CAAC,QAAQ,MAAM;CACf,CAAC,cAAc,YAAY;CAC3B,CAAC,cAAc,aAAa;CAC5B,CAAC,gBAAgB,cAAc;CAC/B,CAAC,YAAY,UAAU;CACvB,CAAC,UAAU,mBAAmB;CAC9B,CAAC,WAAW,SAAS;CACrB,CAAC,aAAa,YAAY;CAC1B,CAAC,cAAc,aAAa;CAC5B,CAAC,WAAW,SAAS;CACrB,CAAC,OAAO,MAAM;CACd,CAAC,eAAe,cAAc;CAC9B,CAAC,UAAU,QAAQ;CACnB,CAAC,YAAY,UAAU;AACzB,CAAC;AAED,IAAM,6BAAa,IAAI,IAAI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,SAAgB,mBAAmB,UAA0B;CAC3D,OAAO,eAAe,IAAI,QAAQ,KAAK,SAAS,MAAM,MAAM,CAAC,CAAC,OAAO,OAAO,CAAC,CAAC,IAAI,SAAS,CAAC,CAAC,KAAK,GAAG;AACvG;AAEA,SAAgB,aAAa,OAA8B;CACzD,MAAM,UAAU,MAAM,KAAK;CAC3B,MAAM,QAAQ,QAAQ,QAAQ,GAAG;CACjC,IAAI,SAAS,KAAK,UAAU,QAAQ,SAAS,GAAG,OAAO;EAAE,OAAO;EAAS,WAAW,gBAAgB,OAAO;CAAE;CAC7G,MAAM,YAAY,QAAQ,MAAM,GAAG,KAAK,CAAC,CAAC,MAAM,GAAG,CAAC,CAAC,MAAM,GAAA,CAAI,YAAY;CAC3E,MAAM,QAAQ,QAAQ,MAAM,QAAQ,CAAC;CACrC,OAAO;EAAE;EAAU,cAAc,mBAAmB,QAAQ;EAAG;EAAO,WAAW,gBAAgB,KAAK;CAAE;AAC1G"}
1
+ {"version":3,"file":"model.cjs.js","names":[],"sources":["../../src/utils/model.ts"],"sourcesContent":["export type ResolvedModel = {\n provider?: string;\n providerName?: string;\n model: string;\n modelName: string;\n};\n\nconst PROVIDER_NAMES = new Map([\n ['anthropic', 'Anthropic'],\n ['openai', 'OpenAI'],\n ['google', 'Google'],\n ['xai', 'xAI'],\n ['mistral', 'Mistral'],\n ['groq', 'Groq'],\n ['deepseek', 'DeepSeek'],\n ['openrouter', 'OpenRouter'],\n ['meta', 'Meta'],\n ['perplexity', 'Perplexity'],\n ['togetherai', 'Together AI'],\n ['fireworks-ai', 'Fireworks AI'],\n ['cerebras', 'Cerebras'],\n ['vercel', 'Vercel AI Gateway'],\n ['netlify', 'Netlify'],\n ['deepinfra', 'Deep Infra'],\n ['moonshotai', 'Moonshot AI'],\n ['alibaba', 'Alibaba'],\n ['zai', 'Z.AI'],\n ['huggingface', 'Hugging Face'],\n ['nvidia', 'Nvidia'],\n ['lmstudio', 'LMStudio'],\n]);\n\nconst WORD_NAMES = new Map([\n ['gpt', 'GPT'],\n ['oss', 'OSS'],\n ['deepseek', 'DeepSeek'],\n ['glm', 'GLM'],\n ['qwq', 'QwQ'],\n]);\n\nconst DATE_SUFFIX = /(-\\d{8}|-\\d{4}-\\d{2}-\\d{2}|-\\d{2}-\\d{4}|-\\d{4})$/;\nconst BEDROCK_VENDOR_PREFIXES = /^(?:[a-z]+\\.)+/i;\nconst BEDROCK_API_VERSION = /-v\\d+:0$/;\nconst WORD_WITH_MAJOR_VERSION = /^([a-z]{2,})(\\d+)$/;\n\nconst titleCase = (word: string) => WORD_NAMES.get(word) ?? word.charAt(0).toUpperCase() + word.slice(1);\n\nfunction formatWord(word: string) {\n if (/^o\\d/.test(word)) return word;\n if (/^\\d+(\\.\\d+)?[bkm]$/.test(word)) return word.toUpperCase();\n return titleCase(word);\n}\n\nexport function formatModelName(model: string): string {\n const base = (model.split('/').pop() || model).replace(BEDROCK_VENDOR_PREFIXES, '').replace(BEDROCK_API_VERSION, '');\n const tokens = base\n .toLowerCase()\n .replace(DATE_SUFFIX, '')\n .split(/[-_\\s]+/)\n .filter(Boolean);\n\n const words: string[] = [];\n for (const token of tokens) {\n const previous = words[words.length - 1];\n const wordWithMajor = previous?.match(WORD_WITH_MAJOR_VERSION);\n if (previous && /^\\d+$/.test(previous) && /^\\d$/.test(token)) {\n words[words.length - 1] = `${previous}.${token}`;\n } else if (wordWithMajor?.[1] && wordWithMajor[2] && /^\\d$/.test(token)) {\n words.splice(-1, 1, wordWithMajor[1], `${wordWithMajor[2]}.${token}`);\n } else {\n words.push(token);\n }\n }\n\n return words\n .map(formatWord)\n .join(' ')\n .replace(/^GPT (\\S)/, 'GPT-$1');\n}\n\nexport function formatProviderName(provider: string): string {\n return PROVIDER_NAMES.get(provider) ?? provider.split(/[-_]/).filter(Boolean).map(titleCase).join(' ');\n}\n\n/** Compare catalog release dates newest first; unknown or invalid dates follow known dates. */\nexport function compareModelReleaseDates(a?: string, b?: string): number {\n const aTime = Date.parse(a ?? '');\n const bTime = Date.parse(b ?? '');\n const aKnown = Number.isFinite(aTime);\n const bKnown = Number.isFinite(bTime);\n if (aKnown && bKnown) return bTime - aTime;\n return Number(bKnown) - Number(aKnown);\n}\n\nexport function resolveModel(value: string): ResolvedModel {\n const trimmed = value.trim();\n const slash = trimmed.indexOf('/');\n if (slash <= 0 || slash === trimmed.length - 1) return { model: trimmed, modelName: formatModelName(trimmed) };\n const provider = (trimmed.slice(0, slash).split('.')[0] ?? '').toLowerCase();\n const model = trimmed.slice(slash + 1);\n return { provider, providerName: formatProviderName(provider), model, modelName: formatModelName(model) };\n}\n"],"mappings":";;AAOA,IAAM,iCAAiB,IAAI,IAAI;CAC7B,CAAC,aAAa,WAAW;CACzB,CAAC,UAAU,QAAQ;CACnB,CAAC,UAAU,QAAQ;CACnB,CAAC,OAAO,KAAK;CACb,CAAC,WAAW,SAAS;CACrB,CAAC,QAAQ,MAAM;CACf,CAAC,YAAY,UAAU;CACvB,CAAC,cAAc,YAAY;CAC3B,CAAC,QAAQ,MAAM;CACf,CAAC,cAAc,YAAY;CAC3B,CAAC,cAAc,aAAa;CAC5B,CAAC,gBAAgB,cAAc;CAC/B,CAAC,YAAY,UAAU;CACvB,CAAC,UAAU,mBAAmB;CAC9B,CAAC,WAAW,SAAS;CACrB,CAAC,aAAa,YAAY;CAC1B,CAAC,cAAc,aAAa;CAC5B,CAAC,WAAW,SAAS;CACrB,CAAC,OAAO,MAAM;CACd,CAAC,eAAe,cAAc;CAC9B,CAAC,UAAU,QAAQ;CACnB,CAAC,YAAY,UAAU;AACzB,CAAC;AAED,IAAM,6BAAa,IAAI,IAAI;CACzB,CAAC,OAAO,KAAK;CACb,CAAC,OAAO,KAAK;CACb,CAAC,YAAY,UAAU;CACvB,CAAC,OAAO,KAAK;CACb,CAAC,OAAO,KAAK;AACf,CAAC;AAED,IAAM,cAAc;AACpB,IAAM,0BAA0B;AAChC,IAAM,sBAAsB;AAC5B,IAAM,0BAA0B;AAEhC,IAAM,aAA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,KAAK,EAAE;CAChC,MAAM,QAAQ,KAAK,MAAM,KAAK,EAAE;CAChC,MAAM,SAAS,OAAO,SAAS,KAAK;CACpC,MAAM,SAAS,OAAO,SAAS,KAAK;CACpC,IAAI,UAAU,QAAQ,OAAO,QAAQ;CACrC,OAAO,OAAO,MAAM,IAAI,OAAO,MAAM;AACvC;AAEA,SAAgB,aAAa,OAA8B;CACzD,MAAM,UAAU,MAAM,KAAK;CAC3B,MAAM,QAAQ,QAAQ,QAAQ,GAAG;CACjC,IAAI,SAAS,KAAK,UAAU,QAAQ,SAAS,GAAG,OAAO;EAAE,OAAO;EAAS,WAAW,gBAAgB,OAAO;CAAE;CAC7G,MAAM,YAAY,QAAQ,MAAM,GAAG,KAAK,CAAC,CAAC,MAAM,GAAG,CAAC,CAAC,MAAM,GAAA,CAAI,YAAY;CAC3E,MAAM,QAAQ,QAAQ,MAAM,QAAQ,CAAC;CACrC,OAAO;EAAE;EAAU,cAAc,mBAAmB,QAAQ;EAAG;EAAO,WAAW,gBAAgB,KAAK;CAAE;AAC1G"}
@@ -55,6 +55,15 @@ function formatModelName(model) {
55
55
  function formatProviderName(provider) {
56
56
  return PROVIDER_NAMES.get(provider) ?? provider.split(/[-_]/).filter(Boolean).map(titleCase).join(" ");
57
57
  }
58
+ /** Compare catalog release dates newest first; unknown or invalid dates follow known dates. */
59
+ function compareModelReleaseDates(a, b) {
60
+ const aTime = Date.parse(a ?? "");
61
+ const bTime = Date.parse(b ?? "");
62
+ const aKnown = Number.isFinite(aTime);
63
+ const bKnown = Number.isFinite(bTime);
64
+ if (aKnown && bKnown) return bTime - aTime;
65
+ return Number(bKnown) - Number(aKnown);
66
+ }
58
67
  function resolveModel(value) {
59
68
  const trimmed = value.trim();
60
69
  const slash = trimmed.indexOf("/");
@@ -72,6 +81,6 @@ function resolveModel(value) {
72
81
  };
73
82
  }
74
83
  //#endregion
75
- export { formatModelName, formatProviderName, resolveModel };
84
+ export { compareModelReleaseDates, formatModelName, formatProviderName, resolveModel };
76
85
 
77
86
  //# sourceMappingURL=model.es.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"model.es.js","names":[],"sources":["../../src/utils/model.ts"],"sourcesContent":["export type ResolvedModel = {\n provider?: string;\n providerName?: string;\n model: string;\n modelName: string;\n};\n\nconst PROVIDER_NAMES = new Map([\n ['anthropic', 'Anthropic'],\n ['openai', 'OpenAI'],\n ['google', 'Google'],\n ['xai', 'xAI'],\n ['mistral', 'Mistral'],\n ['groq', 'Groq'],\n ['deepseek', 'DeepSeek'],\n ['openrouter', 'OpenRouter'],\n ['meta', 'Meta'],\n ['perplexity', 'Perplexity'],\n ['togetherai', 'Together AI'],\n ['fireworks-ai', 'Fireworks AI'],\n ['cerebras', 'Cerebras'],\n ['vercel', 'Vercel AI Gateway'],\n ['netlify', 'Netlify'],\n ['deepinfra', 'Deep Infra'],\n ['moonshotai', 'Moonshot AI'],\n ['alibaba', 'Alibaba'],\n ['zai', 'Z.AI'],\n ['huggingface', 'Hugging Face'],\n ['nvidia', 'Nvidia'],\n ['lmstudio', 'LMStudio'],\n]);\n\nconst WORD_NAMES = new Map([\n ['gpt', 'GPT'],\n ['oss', 'OSS'],\n ['deepseek', 'DeepSeek'],\n ['glm', 'GLM'],\n ['qwq', 'QwQ'],\n]);\n\nconst DATE_SUFFIX = /(-\\d{8}|-\\d{4}-\\d{2}-\\d{2}|-\\d{2}-\\d{4}|-\\d{4})$/;\nconst BEDROCK_VENDOR_PREFIXES = /^(?:[a-z]+\\.)+/i;\nconst BEDROCK_API_VERSION = /-v\\d+:0$/;\nconst WORD_WITH_MAJOR_VERSION = /^([a-z]{2,})(\\d+)$/;\n\nconst titleCase = (word: string) => WORD_NAMES.get(word) ?? word.charAt(0).toUpperCase() + word.slice(1);\n\nfunction formatWord(word: string) {\n if (/^o\\d/.test(word)) return word;\n if (/^\\d+(\\.\\d+)?[bkm]$/.test(word)) return word.toUpperCase();\n return titleCase(word);\n}\n\nexport function formatModelName(model: string): string {\n const base = (model.split('/').pop() || model).replace(BEDROCK_VENDOR_PREFIXES, '').replace(BEDROCK_API_VERSION, '');\n const tokens = base\n .toLowerCase()\n .replace(DATE_SUFFIX, '')\n .split(/[-_\\s]+/)\n .filter(Boolean);\n\n const words: string[] = [];\n for (const token of tokens) {\n const previous = words[words.length - 1];\n const wordWithMajor = previous?.match(WORD_WITH_MAJOR_VERSION);\n if (previous && /^\\d+$/.test(previous) && /^\\d$/.test(token)) {\n words[words.length - 1] = `${previous}.${token}`;\n } else if (wordWithMajor?.[1] && wordWithMajor[2] && /^\\d$/.test(token)) {\n words.splice(-1, 1, wordWithMajor[1], `${wordWithMajor[2]}.${token}`);\n } else {\n words.push(token);\n }\n }\n\n return words\n .map(formatWord)\n .join(' ')\n .replace(/^GPT (\\S)/, 'GPT-$1');\n}\n\nexport function formatProviderName(provider: string): string {\n return PROVIDER_NAMES.get(provider) ?? provider.split(/[-_]/).filter(Boolean).map(titleCase).join(' ');\n}\n\nexport function resolveModel(value: string): ResolvedModel {\n const trimmed = value.trim();\n const slash = trimmed.indexOf('/');\n if (slash <= 0 || slash === trimmed.length - 1) return { model: trimmed, modelName: formatModelName(trimmed) };\n const provider = (trimmed.slice(0, slash).split('.')[0] ?? '').toLowerCase();\n const model = trimmed.slice(slash + 1);\n return { provider, providerName: formatProviderName(provider), model, modelName: formatModelName(model) };\n}\n"],"mappings":";AAOA,IAAM,iCAAiB,IAAI,IAAI;CAC7B,CAAC,aAAa,WAAW;CACzB,CAAC,UAAU,QAAQ;CACnB,CAAC,UAAU,QAAQ;CACnB,CAAC,OAAO,KAAK;CACb,CAAC,WAAW,SAAS;CACrB,CAAC,QAAQ,MAAM;CACf,CAAC,YAAY,UAAU;CACvB,CAAC,cAAc,YAAY;CAC3B,CAAC,QAAQ,MAAM;CACf,CAAC,cAAc,YAAY;CAC3B,CAAC,cAAc,aAAa;CAC5B,CAAC,gBAAgB,cAAc;CAC/B,CAAC,YAAY,UAAU;CACvB,CAAC,UAAU,mBAAmB;CAC9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AM,cAAc,MAAM,OAAO,KAAK,KAAK,GACpE,MAAM,OAAO,IAAI,GAAG,cAAc,IAAI,GAAG,cAAc,GAAG,GAAG,OAAO;OAEpE,MAAM,KAAK,KAAK;CAEpB;CAEA,OAAO,MACJ,IAAI,UAAU,CAAC,CACf,KAAK,GAAG,CAAC,CACT,QAAQ,aAAa,QAAQ;AAClC;AAEA,SAAgB,mBAAmB,UAA0B;CAC3D,OAAO,eAAe,IAAI,QAAQ,KAAK,SAAS,MAAM,MAAM,CAAC,CAAC,OAAO,OAAO,CAAC,CAAC,IAAI,SAAS,CAAC,CAAC,KAAK,GAAG;AACvG;AAEA,SAAgB,aAAa,OAA8B;CACzD,MAAM,UAAU,MAAM,KAAK;CAC3B,MAAM,QAAQ,QAAQ,QAAQ,GAAG;CACjC,IAAI,SAAS,KAAK,UAAU,QAAQ,SAAS,GAAG,OAAO;EAAE,OAAO;EAAS,WAAW,gBAAgB,OAAO;CAAE;CAC7G,MAAM,YAAY,QAAQ,MAAM,GAAG,KAAK,CAAC,CAAC,MAAM,GAAG,CAAC,CAAC,MAAM,GAAA,CAAI,YAAY;CAC3E,MAAM,QAAQ,QAAQ,MAAM,QAAQ,CAAC;CACrC,OAAO;EAAE;EAAU,cAAc,mBAAmB,QAAQ;EAAG;EAAO,WAAW,gBAAgB,KAAK;CAAE;AAC1G"}
1
+ {"version":3,"file":"model.es.js","names":[],"sources":["../../src/utils/model.ts"],"sourcesContent":["export type ResolvedModel = {\n provider?: string;\n providerName?: string;\n model: string;\n modelName: string;\n};\n\nconst PROVIDER_NAMES = new Map([\n ['anthropic', 'Anthropic'],\n ['openai', 'OpenAI'],\n ['google', 'Google'],\n ['xai', 'xAI'],\n ['mistral', 'Mistral'],\n ['groq', 'Groq'],\n ['deepseek', 'DeepSeek'],\n ['openrouter', 'OpenRouter'],\n ['meta', 'Meta'],\n ['perplexity', 'Perplexity'],\n ['togetherai', 'Together AI'],\n ['fireworks-ai', 'Fireworks AI'],\n ['cerebras', 'Cerebras'],\n ['vercel', 'Vercel AI Gateway'],\n ['netlify', 'Netlify'],\n ['deepinfra', 'Deep Infra'],\n ['moonshotai', 'Moonshot AI'],\n ['alibaba', 'Alibaba'],\n ['zai', 'Z.AI'],\n ['huggingface', 'Hugging Face'],\n ['nvidia', 'Nvidia'],\n ['lmstudio', 'LMStudio'],\n]);\n\nconst WORD_NAMES = new Map([\n ['gpt', 'GPT'],\n ['oss', 'OSS'],\n ['deepseek', 'DeepSeek'],\n ['glm', 'GLM'],\n ['qwq', 'QwQ'],\n]);\n\nconst DATE_SUFFIX = /(-\\d{8}|-\\d{4}-\\d{2}-\\d{2}|-\\d{2}-\\d{4}|-\\d{4})$/;\nconst BEDROCK_VENDOR_PREFIXES = /^(?:[a-z]+\\.)+/i;\nconst BEDROCK_API_VERSION = /-v\\d+:0$/;\nconst WORD_WITH_MAJOR_VERSION = /^([a-z]{2,})(\\d+)$/;\n\nconst titleCase = (word: string) => WORD_NAMES.get(word) ?? word.charAt(0).toUpperCase() + word.slice(1);\n\nfunction formatWord(word: string) {\n if (/^o\\d/.test(word)) return word;\n if (/^\\d+(\\.\\d+)?[bkm]$/.test(word)) return word.toUpperCase();\n return titleCase(word);\n}\n\nexport function formatModelName(model: string): string {\n const base = (model.split('/').pop() || model).replace(BEDROCK_VENDOR_PREFIXES, '').replace(BEDROCK_API_VERSION, '');\n const tokens = base\n .toLowerCase()\n .replace(DATE_SUFFIX, '')\n .split(/[-_\\s]+/)\n .filter(Boolean);\n\n const words: string[] = [];\n for (const token of tokens) {\n const previous = words[words.length - 1];\n const wordWithMajor = previous?.match(WORD_WITH_MAJOR_VERSION);\n if (previous && /^\\d+$/.test(previous) && /^\\d$/.test(token)) {\n words[words.length - 1] = `${previous}.${token}`;\n } else if (wordWithMajor?.[1] && wordWithMajor[2] && /^\\d$/.test(token)) {\n words.splice(-1, 1, wordWithMajor[1], `${wordWithMajor[2]}.${token}`);\n } else {\n words.push(token);\n }\n }\n\n return words\n .map(formatWord)\n .join(' ')\n .replace(/^GPT (\\S)/, 'GPT-$1');\n}\n\nexport function formatProviderName(provider: string): string {\n return PROVIDER_NAMES.get(provider) ?? provider.split(/[-_]/).filter(Boolean).map(titleCase).join(' ');\n}\n\n/** Compare catalog release dates newest first; unknown or invalid dates follow known dates. */\nexport function compareModelReleaseDates(a?: string, b?: string): number {\n const aTime = Date.parse(a ?? '');\n const bTime = Date.parse(b ?? '');\n const aKnown = Number.isFinite(aTime);\n const bKnown = Number.isFinite(bTime);\n if (aKnown && bKnown) return bTime - aTime;\n return Number(bKnown) - Number(aKnown);\n}\n\nexport function resolveModel(value: string): ResolvedModel {\n const trimmed = value.trim();\n const slash = trimmed.indexOf('/');\n if (slash <= 0 || slash === trimmed.length - 1) return { model: trimmed, modelName: formatModelName(trimmed) };\n const provider = (trimmed.slice(0, slash).split('.')[0] ?? '').toLowerCase();\n const model = trimmed.slice(slash + 1);\n return { provider, providerName: formatProviderName(provider), model, modelName: formatModelName(model) };\n}\n"],"mappings":";AAOA,IAAM,iCAAiB,IAAI,IAAI;CAC7B,CAAC,aAAa,WAAW;CACzB,CAAC,UAAU,QAAQ;CACnB,CAAC,UAAU,QAAQ;CACnB,CAAC,OAAO,KAAK;CACb,CAAC,WAAW,SAAS;CACrB,CAAC,QAAQ,MAAM;CACf,CAAC,YAAY,UAAU;CACvB,CAAC,cAAc,YAAY;CAC3B,CAAC,QAAQ,MAAM;CACf,CAAC,cAAc,YAAY;CAC3B,CAAC,cAAc,aAAa;CAC5B,CAAC,gBAAgB,cAAc;CAC/B,CAAC,YAAY,UAAU;CACvB,CAAC,UAAU,mBAAmB;CAC9B,CAAC,WAAW,SAAS;CACrB,CAAC,aAAa,YAAY;CAC1B,CAAC,cAAc,aAAa;CAC5B,CAAC,WAAW,SAAS;CACrB,CAAC,OAAO,MAAM;CACd,CAAC,eAAe,cAAc;CAC9B,CAAC,UAAU,QAAQ;CACnB,CAAC,YAAY,UAAU;AACzB,CAAC;AAED,IAAM,6BAAa,IAAI,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AAEA,SAAgB,mBAAmB,UAA0B;CAC3D,OAAO,eAAe,IAAI,QAAQ,KAAK,SAAS,MAAM,MAAM,CAAC,CAAC,OAAO,OAAO,CAAC,CAAC,IAAI,SAAS,CAAC,CAAC,KAAK,GAAG;AACvG;;AAGA,SAAgB,yBAAyB,GAAY,GAAoB;CACvE,MAAM,QAAQ,KAAK,MAAM,KAAK,EAAE;CAChC,MAAM,QAAQ,KAAK,MAAM,KAAK,EAAE;CAChC,MAAM,SAAS,OAAO,SAAS,KAAK;CACpC,MAAM,SAAS,OAAO,SAAS,KAAK;CACpC,IAAI,UAAU,QAAQ,OAAO,QAAQ;CACrC,OAAO,OAAO,MAAM,IAAI,OAAO,MAAM;AACvC;AAEA,SAAgB,aAAa,OAA8B;CACzD,MAAM,UAAU,MAAM,KAAK;CAC3B,MAAM,QAAQ,QAAQ,QAAQ,GAAG;CACjC,IAAI,SAAS,KAAK,UAAU,QAAQ,SAAS,GAAG,OAAO;EAAE,OAAO;EAAS,WAAW,gBAAgB,OAAO;CAAE;CAC7G,MAAM,YAAY,QAAQ,MAAM,GAAG,KAAK,CAAC,CAAC,MAAM,GAAG,CAAC,CAAC,MAAM,GAAA,CAAI,YAAY;CAC3E,MAAM,QAAQ,QAAQ,MAAM,QAAQ,CAAC;CACrC,OAAO;EAAE;EAAU,cAAc,mBAAmB,QAAQ;EAAG;EAAO,WAAW,gBAAgB,KAAK;CAAE;AAC1G"}
@@ -1,15 +1,4 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
- //#region src/lib/string.ts
3
- var lodashTitleCase = (str) => {
4
- return str.replace(/[-_\s]+(.)?/g, (_, char) => char ? char.toUpperCase() : "").replace(/^(.)/, (char) => char.toLowerCase()).replace(/([A-Z])/g, " $1").replace(/^./, (str) => str.toUpperCase()).trim();
5
- };
6
- var pluralRules = new Intl.PluralRules("en-US");
7
- var count = new Intl.NumberFormat("en-US");
8
- function pluralize(amount, singular, plural = `${singular}s`) {
9
- return `${count.format(amount)} ${pluralRules.select(amount) === "one" ? singular : plural}`;
10
- }
11
- //#endregion
12
- exports.lodashTitleCase = lodashTitleCase;
13
- exports.pluralize = pluralize;
14
-
15
- //# sourceMappingURL=string.cjs.js.map
2
+ const require_string = require("../string-Bu8NTsPl.cjs");
3
+ exports.lodashTitleCase = require_string.lodashTitleCase;
4
+ exports.pluralize = require_string.pluralize;
@@ -1,13 +1 @@
1
- //#region src/lib/string.ts
2
- var lodashTitleCase = (str) => {
3
- return str.replace(/[-_\s]+(.)?/g, (_, char) => char ? char.toUpperCase() : "").replace(/^(.)/, (char) => char.toLowerCase()).replace(/([A-Z])/g, " $1").replace(/^./, (str) => str.toUpperCase()).trim();
4
- };
5
- var pluralRules = new Intl.PluralRules("en-US");
6
- var count = new Intl.NumberFormat("en-US");
7
- function pluralize(amount, singular, plural = `${singular}s`) {
8
- return `${count.format(amount)} ${pluralRules.select(amount) === "one" ? singular : plural}`;
9
- }
10
- //#endregion
11
- export { lodashTitleCase, pluralize };
12
-
13
- //# sourceMappingURL=string.es.js.map
1
+ export { t as lodashTitleCase, n as pluralize } from "../string-CuGKN25d.js";
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@mastra/playground-ui",
3
3
  "type": "module",
4
- "version": "66.0.0-alpha.1",
4
+ "version": "66.0.0-alpha.3",
5
5
  "description": "Mastra Playground components",
6
6
  "sideEffects": [
7
7
  "**/*.css"
@@ -220,8 +220,8 @@
220
220
  "react-dom": ">=19.0.0",
221
221
  "tailwindcss": "^4.0.0",
222
222
  "@mastra/ai-sdk": "^1.11.2",
223
- "@mastra/client-js": "^1.57.0-alpha.1",
224
- "@mastra/react": "1.13.0-alpha.1"
223
+ "@mastra/client-js": "^1.57.0-alpha.3",
224
+ "@mastra/react": "1.13.0-alpha.3"
225
225
  },
226
226
  "devDependencies": {
227
227
  "@modelcontextprotocol/sdk": "^1.32.1",
@@ -263,11 +263,11 @@
263
263
  "vitest": "4.1.12",
264
264
  "@internal/lint": "0.0.145",
265
265
  "@mastra/ai-sdk": "1.11.2",
266
- "@mastra/client-js": "^1.57.0-alpha.1",
267
- "@mastra/core": "1.80.0-alpha.1",
268
- "@mastra/react": "1.13.0-alpha.1",
269
- "@mastra/schema-compat": "1.3.16",
270
- "@mastra/memory": "1.39.1-alpha.0"
266
+ "@mastra/client-js": "^1.57.0-alpha.3",
267
+ "@mastra/core": "1.80.0-alpha.3",
268
+ "@mastra/memory": "1.39.1-alpha.1",
269
+ "@mastra/react": "1.13.0-alpha.3",
270
+ "@mastra/schema-compat": "1.3.16"
271
271
  },
272
272
  "homepage": "https://mastra.ai",
273
273
  "repository": {
@@ -1 +0,0 @@
1
- {"version":3,"file":"string.cjs.js","names":[],"sources":["../../src/lib/string.ts"],"sourcesContent":["export const lodashTitleCase = (str: string): string => {\n // First convert to camel case (handles various separators like spaces, hyphens, underscores)\n const camelCased = str\n .replace(/[-_\\s]+(.)?/g, (_, char) => (char ? char.toUpperCase() : ''))\n .replace(/^(.)/, char => char.toLowerCase());\n\n // Then convert to start case (capitalize first letter of each word)\n return camelCased\n .replace(/([A-Z])/g, ' $1')\n .replace(/^./, str => str.toUpperCase())\n .trim();\n};\n\nconst pluralRules = new Intl.PluralRules('en-US');\nconst count = new Intl.NumberFormat('en-US');\n\nexport function pluralize(amount: number, singular: string, plural = `${singular}s`): string {\n return `${count.format(amount)} ${pluralRules.select(amount) === 'one' ? singular : plural}`;\n}\n"],"mappings":";;AAAA,IAAa,mBAAmB,QAAwB;CAOtD,OALmB,IAChB,QAAQ,iBAAiB,GAAG,SAAU,OAAO,KAAK,YAAY,IAAI,EAAG,CAAC,CACtE,QAAQ,SAAQ,SAAQ,KAAK,YAAY,CAGrC,CAAA,CACJ,QAAQ,YAAY,KAAK,CAAC,CAC1B,QAAQ,OAAM,QAAO,IAAI,YAAY,CAAC,CAAC,CACvC,KAAK;AACV;AAEA,IAAM,cAAc,IAAI,KAAK,YAAY,OAAO;AAChD,IAAM,QAAQ,IAAI,KAAK,aAAa,OAAO;AAE3C,SAAgB,UAAU,QAAgB,UAAkB,SAAS,GAAG,SAAS,IAAY;CAC3F,OAAO,GAAG,MAAM,OAAO,MAAM,EAAE,GAAG,YAAY,OAAO,MAAM,MAAM,QAAQ,WAAW;AACtF"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"string.es.js","names":[],"sources":["../../src/lib/string.ts"],"sourcesContent":["export const lodashTitleCase = (str: string): string => {\n // First convert to camel case (handles various separators like spaces, hyphens, underscores)\n const camelCased = str\n .replace(/[-_\\s]+(.)?/g, (_, char) => (char ? char.toUpperCase() : ''))\n .replace(/^(.)/, char => char.toLowerCase());\n\n // Then convert to start case (capitalize first letter of each word)\n return camelCased\n .replace(/([A-Z])/g, ' $1')\n .replace(/^./, str => str.toUpperCase())\n .trim();\n};\n\nconst pluralRules = new Intl.PluralRules('en-US');\nconst count = new Intl.NumberFormat('en-US');\n\nexport function pluralize(amount: number, singular: string, plural = `${singular}s`): string {\n return `${count.format(amount)} ${pluralRules.select(amount) === 'one' ? singular : plural}`;\n}\n"],"mappings":";AAAA,IAAa,mBAAmB,QAAwB;CAOtD,OALmB,IAChB,QAAQ,iBAAiB,GAAG,SAAU,OAAO,KAAK,YAAY,IAAI,EAAG,CAAC,CACtE,QAAQ,SAAQ,SAAQ,KAAK,YAAY,CAGrC,CAAA,CACJ,QAAQ,YAAY,KAAK,CAAC,CAC1B,QAAQ,OAAM,QAAO,IAAI,YAAY,CAAC,CAAC,CACvC,KAAK;AACV;AAEA,IAAM,cAAc,IAAI,KAAK,YAAY,OAAO;AAChD,IAAM,QAAQ,IAAI,KAAK,aAAa,OAAO;AAE3C,SAAgB,UAAU,QAAgB,UAAkB,SAAS,GAAG,SAAS,IAAY;CAC3F,OAAO,GAAG,MAAM,OAAO,MAAM,EAAE,GAAG,YAAY,OAAO,MAAM,MAAM,QAAQ,WAAW;AACtF"}