@vantageos/mosaic-blocks 0.5.34-alpha → 0.5.36-alpha

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 (149) hide show
  1. package/README.md +9 -8
  2. package/dist/index.cjs +1517 -101
  3. package/dist/index.cjs.map +1 -1
  4. package/dist/index.d.cts +1283 -15
  5. package/dist/index.d.ts +1283 -15
  6. package/dist/index.js +1487 -102
  7. package/dist/index.js.map +1 -1
  8. package/dist/styles.css +18 -0
  9. package/package.json +38 -26
  10. package/r/mosaic-accordion.json +18 -0
  11. package/r/mosaic-activity-feed.json +16 -0
  12. package/r/mosaic-adaptive-grid.json +18 -0
  13. package/r/mosaic-adaptive-modal.json +18 -0
  14. package/r/mosaic-adaptive-navigation.json +18 -0
  15. package/r/mosaic-add-memory-form.json +25 -0
  16. package/r/mosaic-admin-only-guard.json +18 -0
  17. package/r/mosaic-agent-builder-modal.json +23 -0
  18. package/r/mosaic-agent-card.json +16 -0
  19. package/r/mosaic-agent-chat.json +26 -0
  20. package/r/mosaic-agent-composer.json +28 -0
  21. package/r/mosaic-agent-editor.json +25 -0
  22. package/r/mosaic-agent-list.json +21 -0
  23. package/r/mosaic-agent-preview.json +21 -0
  24. package/r/mosaic-alert-dialog.json +23 -0
  25. package/r/mosaic-animated-list.json +16 -0
  26. package/r/mosaic-api-key-panel.json +21 -0
  27. package/r/mosaic-app-sidebar.json +18 -0
  28. package/r/mosaic-approval-prompt.json +21 -0
  29. package/r/mosaic-artifact-canvas-adapter.json +26 -0
  30. package/r/mosaic-artifact-chart.json +18 -0
  31. package/r/mosaic-artifact-checklist.json +18 -0
  32. package/r/mosaic-artifact-data-table.json +18 -0
  33. package/r/mosaic-artifact-document.json +16 -0
  34. package/r/mosaic-artifact-library.json +18 -0
  35. package/r/mosaic-artifact-save-as-memory-form.json +24 -0
  36. package/r/mosaic-artifact-version-history.json +16 -0
  37. package/r/mosaic-avatar.json +18 -0
  38. package/r/mosaic-badge.json +23 -0
  39. package/r/mosaic-blurred-orb.json +16 -0
  40. package/r/mosaic-button.json +24 -0
  41. package/r/mosaic-callout.json +23 -0
  42. package/r/mosaic-card.json +16 -0
  43. package/r/mosaic-chat-composer.json +21 -0
  44. package/r/mosaic-chat-message.json +23 -0
  45. package/r/mosaic-chat-sidebar.json +21 -0
  46. package/r/mosaic-chat-thread.json +21 -0
  47. package/r/mosaic-checkbox.json +18 -0
  48. package/r/mosaic-clerk-org-switcher.json +18 -0
  49. package/r/mosaic-clerk-webhook-handler.json +18 -0
  50. package/r/mosaic-collapsible.json +18 -0
  51. package/r/mosaic-combobox.json +18 -0
  52. package/r/mosaic-counter.json +16 -0
  53. package/r/mosaic-dashboard-content.json +18 -0
  54. package/r/mosaic-dashboard-header.json +18 -0
  55. package/r/mosaic-dashboard-layout.json +20 -0
  56. package/r/mosaic-data-table.json +16 -0
  57. package/r/mosaic-delete-confirmation-dialog.json +18 -0
  58. package/r/mosaic-device-provider.json +16 -0
  59. package/r/mosaic-document-table.json +52 -0
  60. package/r/mosaic-document-upload.json +21 -0
  61. package/r/mosaic-drawer.json +23 -0
  62. package/r/mosaic-dropdown-menu.json +18 -0
  63. package/r/mosaic-edit-memory-dialog.json +27 -0
  64. package/r/mosaic-edit-session-dialog.json +25 -0
  65. package/r/mosaic-editable-cell.json +23 -0
  66. package/r/mosaic-empty-state.json +16 -0
  67. package/r/mosaic-falling-pattern.json +16 -0
  68. package/r/mosaic-feature-3col.json +16 -0
  69. package/r/mosaic-feature-centered-media.json +16 -0
  70. package/r/mosaic-field.json +18 -0
  71. package/r/mosaic-filter-bar.json +18 -0
  72. package/r/mosaic-filter-sidebar.json +18 -0
  73. package/r/mosaic-footer-simple.json +16 -0
  74. package/r/mosaic-hero-split.json +16 -0
  75. package/r/mosaic-input-group.json +16 -0
  76. package/r/mosaic-input.json +18 -0
  77. package/r/mosaic-integrations-badge.json +16 -0
  78. package/r/mosaic-kanban-board.json +21 -0
  79. package/r/mosaic-logos-grid.json +16 -0
  80. package/r/mosaic-main-nav.json +18 -0
  81. package/r/mosaic-markdown.json +21 -0
  82. package/r/mosaic-marketplace-card.json +24 -0
  83. package/r/mosaic-marketplace-list.json +20 -0
  84. package/r/mosaic-match-input.json +23 -0
  85. package/r/mosaic-memory-card.json +21 -0
  86. package/r/mosaic-memory-dashboard.json +23 -0
  87. package/r/mosaic-memory-grid.json +21 -0
  88. package/r/mosaic-memory-list.json +21 -0
  89. package/r/mosaic-memory-search.json +23 -0
  90. package/r/mosaic-mention-input.json +23 -0
  91. package/r/mosaic-message-card.json +16 -0
  92. package/r/mosaic-message-list.json +19 -0
  93. package/r/mosaic-message-search.json +18 -0
  94. package/r/mosaic-model-selector.json +23 -0
  95. package/r/mosaic-module-card.json +16 -0
  96. package/r/mosaic-module-library.json +18 -0
  97. package/r/mosaic-multi-tenant-provider.json +19 -0
  98. package/r/mosaic-navbar.json +16 -0
  99. package/r/mosaic-org-context-display.json +18 -0
  100. package/r/mosaic-org-panel.json +19 -0
  101. package/r/mosaic-org-profile-page.json +18 -0
  102. package/r/mosaic-org-switcher.json +16 -0
  103. package/r/mosaic-pdf-viewer.json +23 -0
  104. package/r/mosaic-popover.json +23 -0
  105. package/r/mosaic-preferences-panel.json +18 -0
  106. package/r/mosaic-pricing-card.json +16 -0
  107. package/r/mosaic-profile-panel.json +18 -0
  108. package/r/mosaic-progress.json +18 -0
  109. package/r/mosaic-quick-action-card.json +16 -0
  110. package/r/mosaic-quick-actions-menu.json +18 -0
  111. package/r/mosaic-quick-agent-selector.json +19 -0
  112. package/r/mosaic-radio-group.json +18 -0
  113. package/r/mosaic-reply-input.json +21 -0
  114. package/r/mosaic-resizable-split-pane.json +23 -0
  115. package/r/mosaic-save-chat-as-memory-form.json +25 -0
  116. package/r/mosaic-save-template-modal.json +27 -0
  117. package/r/mosaic-scroll-area.json +18 -0
  118. package/r/mosaic-select.json +18 -0
  119. package/r/mosaic-selector-modal.json +18 -0
  120. package/r/mosaic-separator.json +18 -0
  121. package/r/mosaic-session-card.json +24 -0
  122. package/r/mosaic-session-list.json +21 -0
  123. package/r/mosaic-sign-in-layout.json +18 -0
  124. package/r/mosaic-sign-up-layout.json +18 -0
  125. package/r/mosaic-skeleton.json +23 -0
  126. package/r/mosaic-slider.json +18 -0
  127. package/r/mosaic-stats-grid.json +16 -0
  128. package/r/mosaic-step-pipeline.json +21 -0
  129. package/r/mosaic-switch.json +18 -0
  130. package/r/mosaic-tabs.json +18 -0
  131. package/r/mosaic-tag-input.json +23 -0
  132. package/r/mosaic-template-agent-card.json +21 -0
  133. package/r/mosaic-template-category-chips.json +21 -0
  134. package/r/mosaic-template-gallery.json +20 -0
  135. package/r/mosaic-template-list.json +21 -0
  136. package/r/mosaic-template-management-panel.json +25 -0
  137. package/r/mosaic-testimonials-grid.json +16 -0
  138. package/r/mosaic-textarea.json +16 -0
  139. package/r/mosaic-theme-provider.json +18 -0
  140. package/r/mosaic-theme-toggle.json +16 -0
  141. package/r/mosaic-thread-indicator.json +21 -0
  142. package/r/mosaic-thread-view.json +21 -0
  143. package/r/mosaic-toast.json +28 -0
  144. package/r/mosaic-tool-toggle-list.json +23 -0
  145. package/r/mosaic-tooltip.json +18 -0
  146. package/r/mosaic-url-scraper.json +21 -0
  147. package/r/mosaic-user-button.json +18 -0
  148. package/r/use-effective-workspace-id.json +18 -0
  149. package/registry.json +179 -130
package/dist/index.js CHANGED
@@ -29,7 +29,7 @@ import { AlertDialog } from '@base-ui/react/alert-dialog';
29
29
  import { Popover } from '@base-ui/react/popover';
30
30
 
31
31
  // src/version.ts
32
- var version = "0.5.34-alpha";
32
+ var version = "0.5.36-alpha";
33
33
  function Placeholder({ label = "mosaic-blocks placeholder" }) {
34
34
  return /* @__PURE__ */ jsx("div", { "data-mosaic-block": "placeholder", children: label });
35
35
  }
@@ -796,7 +796,9 @@ function MosaicThemeToggle({
796
796
  "aria-pressed": isDark,
797
797
  onClick: handleToggle,
798
798
  className: cn12(
799
- "inline-flex size-9 items-center justify-center rounded-full border border-[oklch(0.9_0.005_250)] bg-[oklch(var(--mosaic-surface,1_0_0))] transition-colors hover:bg-[oklch(0.95_0.005_250)] focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-[oklch(0.5_0.15_250)]",
799
+ "inline-flex size-9 items-center justify-center rounded-full border border-border",
800
+ "bg-secondary text-foreground transition-colors hover:bg-accent",
801
+ "focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",
800
802
  className
801
803
  ),
802
804
  children: isDark ? /* @__PURE__ */ jsxs(
@@ -2198,7 +2200,11 @@ function MosaicCombobox({
2198
2200
  disabled,
2199
2201
  name,
2200
2202
  emptyMessage,
2201
- className
2203
+ className,
2204
+ side,
2205
+ align,
2206
+ collisionBoundary,
2207
+ collisionPadding
2202
2208
  }) {
2203
2209
  const [inputValue, setInputValue] = React30.useState("");
2204
2210
  const filter = Combobox.useFilter({ sensitivity: "base" });
@@ -2230,39 +2236,46 @@ function MosaicCombobox({
2230
2236
  )
2231
2237
  }
2232
2238
  ),
2233
- /* @__PURE__ */ jsx(Combobox.Portal, { children: /* @__PURE__ */ jsx(Combobox.Positioner, { sideOffset: 4, children: /* @__PURE__ */ jsx(
2234
- Combobox.Popup,
2239
+ /* @__PURE__ */ jsx(Combobox.Portal, { children: /* @__PURE__ */ jsx(
2240
+ Combobox.Positioner,
2235
2241
  {
2236
- className: cn35(
2237
- "z-50 min-w-[8rem] overflow-hidden rounded-md border border-border",
2238
- "bg-popover p-1 text-popover-foreground shadow-md",
2239
- "origin-[var(--transform-origin)]",
2240
- "transition-[transform,scale,opacity]",
2241
- "data-[open]:scale-100 data-[open]:opacity-100",
2242
- "data-[ending-style]:scale-95 data-[ending-style]:opacity-0",
2243
- "data-[starting-style]:scale-95 data-[starting-style]:opacity-0"
2244
- ),
2245
- children: /* @__PURE__ */ jsxs(Combobox.List, { children: [
2246
- filteredItems.map((item) => /* @__PURE__ */ jsx(
2247
- Combobox.Item,
2248
- {
2249
- value: item.value,
2250
- disabled: item.disabled,
2251
- className: cn35(
2252
- "relative flex cursor-pointer select-none items-center rounded-sm px-2 py-1.5",
2253
- "text-sm text-popover-foreground outline-none",
2254
- "data-[highlighted]:bg-accent data-[highlighted]:text-accent-foreground",
2255
- "data-[disabled]:cursor-not-allowed data-[disabled]:opacity-50",
2256
- "data-[selected]:font-medium"
2257
- ),
2258
- children: item.label
2259
- },
2260
- item.value
2261
- )),
2262
- /* @__PURE__ */ jsx(Combobox.Empty, { className: "py-2 text-center text-sm text-muted-foreground", children: emptyMessage })
2263
- ] })
2242
+ sideOffset: 4,
2243
+ side,
2244
+ align,
2245
+ collisionBoundary,
2246
+ collisionPadding,
2247
+ children: /* @__PURE__ */ jsx(
2248
+ Combobox.Popup,
2249
+ {
2250
+ className: cn35(
2251
+ "z-50 min-w-[8rem] overflow-hidden rounded-md border border-border",
2252
+ "bg-popover p-1 text-popover-foreground shadow-md",
2253
+ "origin-[var(--transform-origin)]",
2254
+ "transition-[transform,scale,opacity]",
2255
+ "data-[open]:scale-100 data-[open]:opacity-100",
2256
+ "data-[ending-style]:scale-95 data-[ending-style]:opacity-0",
2257
+ "data-[starting-style]:scale-95 data-[starting-style]:opacity-0"
2258
+ ),
2259
+ children: /* @__PURE__ */ jsx(Combobox.List, { children: filteredItems.length === 0 ? /* @__PURE__ */ jsx(Combobox.Empty, { className: "py-2 text-center text-sm text-muted-foreground", children: emptyMessage }) : filteredItems.map((item) => /* @__PURE__ */ jsx(
2260
+ Combobox.Item,
2261
+ {
2262
+ value: item.value,
2263
+ disabled: item.disabled,
2264
+ className: cn35(
2265
+ "relative flex cursor-pointer select-none items-center rounded-sm px-2 py-1.5",
2266
+ "text-sm text-popover-foreground outline-none",
2267
+ "data-[highlighted]:bg-accent data-[highlighted]:text-accent-foreground",
2268
+ "data-[disabled]:cursor-not-allowed data-[disabled]:opacity-50",
2269
+ "data-[selected]:font-medium"
2270
+ ),
2271
+ children: item.label
2272
+ },
2273
+ item.value
2274
+ )) })
2275
+ }
2276
+ )
2264
2277
  }
2265
- ) }) })
2278
+ ) })
2266
2279
  ] })
2267
2280
  }
2268
2281
  );
@@ -2303,7 +2316,11 @@ function MosaicModelSelector({
2303
2316
  emptyMessage,
2304
2317
  disabled,
2305
2318
  name,
2306
- className
2319
+ className,
2320
+ side,
2321
+ align,
2322
+ collisionBoundary,
2323
+ collisionPadding
2307
2324
  }) {
2308
2325
  const [inputValue, setInputValue] = React30.useState("");
2309
2326
  const filter = Combobox.useFilter({ sensitivity: "base" });
@@ -2342,40 +2359,47 @@ function MosaicModelSelector({
2342
2359
  }
2343
2360
  ),
2344
2361
  value != null && value in labelMap && inputValue === "" && /* @__PURE__ */ jsx("span", { className: "pointer-events-none absolute inset-y-0 left-3 flex items-center text-sm text-foreground", children: labelMap[value] }),
2345
- /* @__PURE__ */ jsx(Combobox.Portal, { children: /* @__PURE__ */ jsx(Combobox.Positioner, { sideOffset: 4, children: /* @__PURE__ */ jsx(
2346
- Combobox.Popup,
2362
+ /* @__PURE__ */ jsx(Combobox.Portal, { children: /* @__PURE__ */ jsx(
2363
+ Combobox.Positioner,
2347
2364
  {
2348
- className: cn36(
2349
- "z-50 min-w-[16rem] overflow-hidden rounded-md border border-border",
2350
- "bg-popover p-1 text-popover-foreground shadow-md",
2351
- "origin-[var(--transform-origin)]",
2352
- "transition-[transform,scale,opacity]",
2353
- "data-[open]:scale-100 data-[open]:opacity-100",
2354
- "data-[ending-style]:scale-95 data-[ending-style]:opacity-0",
2355
- "data-[starting-style]:scale-95 data-[starting-style]:opacity-0"
2356
- ),
2357
- children: /* @__PURE__ */ jsxs(Combobox.List, { children: [
2358
- filteredModels.map((model) => /* @__PURE__ */ jsxs(
2359
- Combobox.Item,
2360
- {
2361
- value: model.value,
2362
- disabled: model.disabled,
2363
- className: modelSelectorItemVariants({ className: void 0 }),
2364
- children: [
2365
- /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between gap-2", children: [
2366
- /* @__PURE__ */ jsx("span", { className: "font-medium", children: model.label }),
2367
- model.badge && /* @__PURE__ */ jsx("span", { className: "rounded-full bg-secondary px-2 py-0.5 text-xs text-secondary-foreground", children: model.badge })
2368
- ] }),
2369
- model.description && /* @__PURE__ */ jsx("span", { className: "text-xs text-muted-foreground", children: model.description }),
2370
- model.meta && /* @__PURE__ */ jsx("span", { className: "text-xs text-muted-foreground", children: model.meta })
2371
- ]
2372
- },
2373
- model.value
2374
- )),
2375
- /* @__PURE__ */ jsx(Combobox.Empty, { className: "py-2 text-center text-sm text-muted-foreground", children: emptyMessage })
2376
- ] })
2365
+ sideOffset: 4,
2366
+ side,
2367
+ align,
2368
+ collisionBoundary,
2369
+ collisionPadding,
2370
+ children: /* @__PURE__ */ jsx(
2371
+ Combobox.Popup,
2372
+ {
2373
+ className: cn36(
2374
+ "z-50 min-w-[16rem] overflow-hidden rounded-md border border-border",
2375
+ "bg-popover p-1 text-popover-foreground shadow-md",
2376
+ "origin-[var(--transform-origin)]",
2377
+ "transition-[transform,scale,opacity]",
2378
+ "data-[open]:scale-100 data-[open]:opacity-100",
2379
+ "data-[ending-style]:scale-95 data-[ending-style]:opacity-0",
2380
+ "data-[starting-style]:scale-95 data-[starting-style]:opacity-0"
2381
+ ),
2382
+ children: /* @__PURE__ */ jsx(Combobox.List, { children: filteredModels.length === 0 ? /* @__PURE__ */ jsx(Combobox.Empty, { className: "py-2 text-center text-sm text-muted-foreground", children: emptyMessage }) : filteredModels.map((model) => /* @__PURE__ */ jsxs(
2383
+ Combobox.Item,
2384
+ {
2385
+ value: model.value,
2386
+ disabled: model.disabled,
2387
+ className: modelSelectorItemVariants({ className: void 0 }),
2388
+ children: [
2389
+ /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between gap-2", children: [
2390
+ /* @__PURE__ */ jsx("span", { className: "font-medium", children: model.label }),
2391
+ model.badge && /* @__PURE__ */ jsx("span", { className: "rounded-full bg-secondary px-2 py-0.5 text-xs text-secondary-foreground", children: model.badge })
2392
+ ] }),
2393
+ model.description && /* @__PURE__ */ jsx("span", { className: "text-xs text-muted-foreground", children: model.description }),
2394
+ model.meta && /* @__PURE__ */ jsx("span", { className: "text-xs text-muted-foreground", children: model.meta })
2395
+ ]
2396
+ },
2397
+ model.value
2398
+ )) })
2399
+ }
2400
+ )
2377
2401
  }
2378
- ) }) })
2402
+ ) })
2379
2403
  ] })
2380
2404
  }
2381
2405
  );
@@ -2825,6 +2849,7 @@ function MosaicAdaptiveNavigation({
2825
2849
  tabNavAriaLabel,
2826
2850
  completeStatusLabel,
2827
2851
  inProgressStatusLabel,
2852
+ formatDuration,
2828
2853
  className,
2829
2854
  ref
2830
2855
  }) {
@@ -2867,10 +2892,7 @@ function MosaicAdaptiveNavigation({
2867
2892
  ] })
2868
2893
  ] }),
2869
2894
  /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2 shrink-0", children: [
2870
- item.duration !== void 0 && /* @__PURE__ */ jsxs("span", { className: "rounded bg-primary px-2 py-0.5 text-xs text-primary-foreground", children: [
2871
- item.duration,
2872
- "s"
2873
- ] }),
2895
+ item.duration !== void 0 && /* @__PURE__ */ jsx("span", { className: "rounded bg-primary px-2 py-0.5 text-xs text-primary-foreground", children: formatDuration(item.duration) }),
2874
2896
  /* @__PURE__ */ jsx(ChevronDownIcon2, { rotated: isExpanded })
2875
2897
  ] })
2876
2898
  ]
@@ -2922,17 +2944,14 @@ function MosaicAdaptiveNavigation({
2922
2944
  }
2923
2945
  ),
2924
2946
  /* @__PURE__ */ jsx("span", { className: "hidden sm:inline", children: item.title }),
2925
- item.duration !== void 0 && /* @__PURE__ */ jsxs(
2947
+ item.duration !== void 0 && /* @__PURE__ */ jsx(
2926
2948
  "span",
2927
2949
  {
2928
2950
  className: cn40(
2929
2951
  "rounded px-1 py-0.5 text-xs",
2930
2952
  isActive ? "bg-primary-foreground/20" : "bg-muted"
2931
2953
  ),
2932
- children: [
2933
- item.duration,
2934
- "s"
2935
- ]
2954
+ children: formatDuration(item.duration)
2936
2955
  }
2937
2956
  )
2938
2957
  ]
@@ -3692,7 +3711,12 @@ function ArrowRightIcon() {
3692
3711
  }
3693
3712
  );
3694
3713
  }
3695
- function MosaicActivityItem({ activity, icon, className }) {
3714
+ function MosaicActivityItem({
3715
+ activity,
3716
+ formatMessageCount,
3717
+ icon,
3718
+ className
3719
+ }) {
3696
3720
  return /* @__PURE__ */ jsxs(
3697
3721
  "div",
3698
3722
  {
@@ -3720,10 +3744,7 @@ function MosaicActivityItem({ activity, icon, className }) {
3720
3744
  label
3721
3745
  );
3722
3746
  }) }),
3723
- activity.messages !== void 0 && /* @__PURE__ */ jsxs("span", { className: "text-xs text-muted-foreground", children: [
3724
- activity.messages,
3725
- " messages"
3726
- ] })
3747
+ activity.messages !== void 0 && /* @__PURE__ */ jsx("span", { className: "text-xs text-muted-foreground", children: formatMessageCount(activity.messages) })
3727
3748
  ] }),
3728
3749
  activity.excerpt && /* @__PURE__ */ jsx("p", { className: "mt-0.5 text-xs text-muted-foreground line-clamp-1", children: activity.excerpt })
3729
3750
  ] }),
@@ -3752,6 +3773,7 @@ function MosaicActivityFeed({
3752
3773
  viewAllHref,
3753
3774
  viewAllLabel,
3754
3775
  emptyMessage,
3776
+ formatMessageCount,
3755
3777
  iconMap,
3756
3778
  renderLink,
3757
3779
  className,
@@ -3791,7 +3813,14 @@ function MosaicActivityFeed({
3791
3813
  {
3792
3814
  className: "mosaic-activity-row",
3793
3815
  style: { animationDelay: `${idx * 80}ms` },
3794
- children: /* @__PURE__ */ jsx(MosaicActivityItem, { activity, icon: iconMap?.[activity.type] })
3816
+ children: /* @__PURE__ */ jsx(
3817
+ MosaicActivityItem,
3818
+ {
3819
+ activity,
3820
+ formatMessageCount,
3821
+ icon: iconMap?.[activity.type]
3822
+ }
3823
+ )
3795
3824
  },
3796
3825
  activity.id
3797
3826
  )) })
@@ -3986,6 +4015,7 @@ function MosaicAgentComposerDesktop({
3986
4015
  customInstructionsPreviewLabel,
3987
4016
  selectAllModulesLabel,
3988
4017
  unnamedAgentLabel,
4018
+ formatContextWindow,
3989
4019
  roleSublabel,
3990
4020
  personaSublabel,
3991
4021
  frameworkSublabel,
@@ -4091,7 +4121,7 @@ function MosaicAgentComposerDesktop({
4091
4121
  ] }),
4092
4122
  selectedModel.provider && /* @__PURE__ */ jsx("p", { className: "text-xs capitalize text-muted-foreground", children: selectedModel.provider }),
4093
4123
  (selectedModel.contextWindow || selectedModel.pricingLabel) && /* @__PURE__ */ jsxs("p", { className: "text-xs text-muted-foreground", children: [
4094
- selectedModel.contextWindow && `${selectedModel.contextWindow.toLocaleString()} context`,
4124
+ selectedModel.contextWindow && formatContextWindow(selectedModel.contextWindow),
4095
4125
  selectedModel.contextWindow && selectedModel.pricingLabel && " \u2022 ",
4096
4126
  selectedModel.pricingLabel
4097
4127
  ] })
@@ -4457,7 +4487,8 @@ function MosaicAgentComposerMobile({
4457
4487
  editModuleAriaLabel,
4458
4488
  removeModuleAriaLabel,
4459
4489
  selectModuleAriaLabel,
4460
- changeModuleLabel
4490
+ changeModuleLabel,
4491
+ formatContextWindow
4461
4492
  }) {
4462
4493
  const L = labels;
4463
4494
  const instructionsId = React30.useId();
@@ -4571,7 +4602,7 @@ function MosaicAgentComposerMobile({
4571
4602
  ] }),
4572
4603
  selectedModel.provider && /* @__PURE__ */ jsx("p", { className: "text-xs capitalize text-muted-foreground", children: selectedModel.provider }),
4573
4604
  (selectedModel.contextWindow || selectedModel.pricingLabel) && /* @__PURE__ */ jsxs("p", { className: "text-xs text-muted-foreground", children: [
4574
- selectedModel.contextWindow && `${selectedModel.contextWindow.toLocaleString()} context`,
4605
+ selectedModel.contextWindow && formatContextWindow(selectedModel.contextWindow),
4575
4606
  selectedModel.contextWindow && selectedModel.pricingLabel && " \u2022 ",
4576
4607
  selectedModel.pricingLabel
4577
4608
  ] })
@@ -9075,7 +9106,9 @@ function MosaicTemplateCard({
9075
9106
  showActions = false,
9076
9107
  compact = false,
9077
9108
  previewLabel,
9078
- duplicateLabel
9109
+ duplicateLabel,
9110
+ formatAgentCount,
9111
+ formatUsageCount
9079
9112
  }) {
9080
9113
  const isPopular = (template.metadata?.usageCount ?? 0) > 10;
9081
9114
  const isTrending = (template.metadata?.usageCount ?? 0) > 5;
@@ -9106,14 +9139,8 @@ function MosaicTemplateCard({
9106
9139
  ] }),
9107
9140
  /* @__PURE__ */ jsxs("div", { className: "mt-2 flex flex-wrap items-center gap-1.5", children: [
9108
9141
  /* @__PURE__ */ jsx("span", { className: "rounded-md bg-secondary px-2 py-0.5 text-xs text-secondary-foreground", children: template.category }),
9109
- template.agents && template.agents.length > 0 && /* @__PURE__ */ jsxs("span", { className: "rounded-md border border-border px-2 py-0.5 text-xs text-muted-foreground", children: [
9110
- template.agents.length,
9111
- " agents"
9112
- ] }),
9113
- (template.metadata?.usageCount ?? 0) > 0 && /* @__PURE__ */ jsxs("span", { className: "rounded-md border border-border px-2 py-0.5 text-xs text-muted-foreground", children: [
9114
- template.metadata?.usageCount,
9115
- " uses"
9116
- ] }),
9142
+ template.agents && template.agents.length > 0 && /* @__PURE__ */ jsx("span", { className: "rounded-md border border-border px-2 py-0.5 text-xs text-muted-foreground", children: formatAgentCount(template.agents.length) }),
9143
+ (template.metadata?.usageCount ?? 0) > 0 && /* @__PURE__ */ jsx("span", { className: "rounded-md border border-border px-2 py-0.5 text-xs text-muted-foreground", children: formatUsageCount(template.metadata?.usageCount ?? 0) }),
9117
9144
  tags.slice(0, compact ? 1 : 2).map((tag) => /* @__PURE__ */ jsxs(
9118
9145
  "span",
9119
9146
  {
@@ -9377,6 +9404,8 @@ function TemplateGalleryContent({
9377
9404
  expandSidebarAriaLabel,
9378
9405
  previewLabel,
9379
9406
  duplicateLabel,
9407
+ formatAgentCount,
9408
+ formatUsageCount,
9380
9409
  isMobile
9381
9410
  }) {
9382
9411
  const [query, setQuery] = React30.useState("");
@@ -9453,6 +9482,8 @@ function TemplateGalleryContent({
9453
9482
  showActions,
9454
9483
  previewLabel,
9455
9484
  duplicateLabel,
9485
+ formatAgentCount,
9486
+ formatUsageCount,
9456
9487
  compact: true
9457
9488
  },
9458
9489
  template.id
@@ -9502,7 +9533,9 @@ function TemplateGalleryContent({
9502
9533
  onDuplicate: onDuplicateTemplate,
9503
9534
  showActions,
9504
9535
  previewLabel,
9505
- duplicateLabel
9536
+ duplicateLabel,
9537
+ formatAgentCount,
9538
+ formatUsageCount
9506
9539
  },
9507
9540
  template.id
9508
9541
  )) }),
@@ -10092,6 +10125,7 @@ function MosaicOrgRoleBadge({
10092
10125
  MosaicOrgRoleBadge.displayName = "MosaicOrgRoleBadge";
10093
10126
  function MosaicMultiOrgIndicator({
10094
10127
  orgCount,
10128
+ formatOrgCount,
10095
10129
  currentOrgName,
10096
10130
  onSwitchOrg,
10097
10131
  className
@@ -10128,14 +10162,10 @@ function MosaicMultiOrgIndicator({
10128
10162
  ]
10129
10163
  }
10130
10164
  ),
10131
- orgCount,
10132
- " orgs"
10165
+ formatOrgCount(orgCount)
10133
10166
  ]
10134
10167
  }
10135
- ) : /* @__PURE__ */ jsxs("span", { className: "inline-flex items-center gap-1.5 rounded-full bg-secondary px-2.5 py-1 text-xs font-medium text-secondary-foreground", children: [
10136
- orgCount,
10137
- " orgs"
10138
- ] }),
10168
+ ) : /* @__PURE__ */ jsx("span", { className: "inline-flex items-center gap-1.5 rounded-full bg-secondary px-2.5 py-1 text-xs font-medium text-secondary-foreground", children: formatOrgCount(orgCount) }),
10139
10169
  currentOrgName && /* @__PURE__ */ jsx("span", { className: "text-xs text-muted-foreground", children: currentOrgName })
10140
10170
  ] });
10141
10171
  }
@@ -17102,6 +17132,1361 @@ function MosaicEditableCell({
17102
17132
  }
17103
17133
  MosaicEditableCell.displayName = "MosaicEditableCell";
17104
17134
 
17105
- export { MosaicAccordion, MosaicAccordionItem, MosaicAccordionPanel, MosaicAccordionTrigger, MosaicActivityFeed, MosaicActivityItem, MosaicAdaptiveGrid, MosaicAdaptiveModal, MosaicAdaptiveNavigation, MosaicAddMemoryForm, MosaicAgentBuilderModal, MosaicAgentCard, MosaicAgentChat, MosaicAgentComposer, MosaicAgentComposerDesktop, MosaicAgentComposerMobile, MosaicAgentEditor, MosaicAgentList, AgentListDesktop as MosaicAgentListDesktop, AgentListMobile as MosaicAgentListMobile, MosaicAgentPreview, MosaicAgentTeamPreview, MosaicAlertDialog, MosaicAlertDialogAction, MosaicAlertDialogCancel, MosaicAlertDialogContent, MosaicAlertDialogDescription, MosaicAlertDialogFooter, MosaicAlertDialogHeader, MosaicAlertDialogOverlay, MosaicAlertDialogPortal, MosaicAlertDialogTitle, MosaicAlertDialogTrigger, MosaicAnimatedList, MosaicApiKeyPanel, MosaicAppSidebar, MosaicApprovalPrompt, MosaicAvatar, MosaicBadge, MosaicBlurredOrb, MosaicButton, MosaicCallout, MosaicCard, MosaicCardContent, MosaicCardDescription, MosaicCardFooter, MosaicCardHeader, MosaicCardTitle, MosaicChatComposer, MosaicChatMessage, MosaicChatSidebar, MosaicChatThread, MosaicCheckbox, MosaicClerkOrgSwitcher, MosaicClerkWebhookHandler, MosaicCollapsible, MosaicCollapsiblePanel, MosaicCollapsibleTrigger, MosaicCombobox, MosaicCounter, MosaicCreateOrgDialog, MosaicDashboardContent, MosaicDashboardHeader, MosaicDashboardLayout, MosaicDataTable, MosaicDeleteConfirmationDialog, MosaicDeviceProvider, MosaicDocumentUpload, MosaicDrawer, MosaicDropdownMenu, MosaicEditMemoryDialog, MosaicEditSessionDialog, MosaicEditableCell, MosaicEmptyState, MosaicFallingPattern, MosaicFeature3Col, MosaicFeatureCenteredMedia, MosaicField, MosaicFieldControl, MosaicFieldDescription, MosaicFieldError, MosaicFieldLabel, MosaicFilterBar, MosaicFilterSidebar, MosaicFooterSimple, MosaicHeroSplit, MosaicInput, MosaicInputGroup, MosaicIntegrationsBadge, MosaicInviteMemberDialog, MosaicKanbanBoard, MosaicKanbanColumn, MosaicLogosGrid, MosaicMainNav, MosaicMarkdown, MosaicMarketplaceCard, MosaicMarketplaceList, MarketplaceListDesktop as MosaicMarketplaceListDesktop, MarketplaceListMobile as MosaicMarketplaceListMobile, MosaicMatchInput, MosaicMemberList, MosaicMemoryCard, MosaicMemoryDashboard, MosaicMemoryGrid, MosaicMemoryList, MosaicMemorySearch, MosaicMentionInput, MosaicMessageCard, MosaicMessageList, MessageListDesktop as MosaicMessageListDesktop, MessageListMobile as MosaicMessageListMobile, MosaicMessageSearch, MosaicModelSelector, MosaicModuleCard, MosaicModuleForm, MosaicModuleLibrary, MosaicMultiOrgIndicator, MosaicMultiTenantProvider, MosaicNavbar, MosaicOrgPanel, MosaicOrgProfilePage, MosaicOrgRoleBadge, MosaicOrgSwitcher, MosaicPdfViewer, MosaicPopover, MosaicPreferencesPanel, MosaicPricingCard, MosaicProfilePanel, MosaicProgress, MosaicQuickActionCard, MosaicQuickActionsMenu, MosaicQuickAgentSelector, MosaicQuickStartPanel, MosaicRadioGroup, MosaicRadioGroupItem, MosaicReplyInput, MosaicResizableSplitPane, MosaicSaveChatAsMemoryForm, MosaicSaveTemplateModal, MosaicScrollArea, MosaicSelect, MosaicSelectorModal, MosaicSeparator, MosaicSessionCard, MosaicSessionList, MosaicSignInLayout, MosaicSignUpLayout, MosaicSkeleton, MosaicSlider, MosaicStatsGrid, MosaicStepPipeline, MosaicSwitch, MosaicTabs, MosaicTabsList, MosaicTabsPanel, MosaicTabsTrigger, MosaicTagInput, MosaicTemplateAgentCard, MosaicTemplateCard, MosaicTemplateCategoryChips, MosaicTemplateGallery, MosaicTemplateList, MosaicTemplateManagementPanel, MosaicTemplatePreview, MosaicTestimonialsGrid, MosaicTextarea, MosaicThemeProvider, MosaicThemeToggle, MosaicThreadIndicator, MosaicThreadView, MosaicToast, MosaicToastProvider, MosaicToolToggleList, MosaicTooltip, MosaicTooltipContent, MosaicTooltipProvider, MosaicTooltipRoot, MosaicTooltipTrigger, MosaicUrlScraper, MosaicUserButton, Placeholder, addMemoryFormButtonVariants, addMemoryFormErrorVariants, addMemoryFormFieldVariants, addMemoryFormFooterVariants, addMemoryFormRootVariants, agentBuilderModalBackdropVariants, agentBuilderModalPopupVariants, agentChatRootVariants, agentEditorVariants, agentPreviewVariants, alertDialogContentVariants, alertDialogOverlayVariants, badgeVariants, buttonVariants, calloutVariants, chatMessageBubbleVariants, chatMessageContainerVariants, chatMessageToolStatusVariants, chatSidebarThreadVariants, drawerBackdropVariants, drawerPopupVariants, editMemoryDialogBackdropVariants, editMemoryDialogErrorVariants, editMemoryDialogFieldVariants, editMemoryDialogPopupVariants, editSessionDialogBodyVariants, editSessionDialogButtonVariants, editSessionDialogErrorVariants, editSessionDialogFieldVariants, editSessionDialogFooterVariants, editableCellVariants, marketplaceCardVariants, matchStateVariants, memoryDashboardViewToggleButtonVariants, memoryGridVariants, memoryListItemVariants, memoryListVariants, memorySearchFilterChipVariants, mentionInputFieldVariants, mentionListItemVariants, mentionListVariants, pdfViewerFrameVariants, pdfViewerStatusVariants, pdfViewerToolbarButtonVariants, popoverPopupVariants, replyInputActionButtonVariants, replyInputContextVariants, replyInputRootVariants, replyInputTextareaVariants, saveChatAsMemoryFormButtonVariants, saveChatAsMemoryFormErrorVariants, saveChatAsMemoryFormFieldVariants, saveChatAsMemoryFormFooterVariants, saveChatAsMemoryFormRootVariants, saveTemplateModalBodyVariants, saveTemplateModalButtonVariants, saveTemplateModalErrorVariants, saveTemplateModalFieldVariants, saveTemplateModalFooterVariants, sessionCardVariants, sessionListItemVariants, sessionListVariants, skeletonVariants, splitPaneCollapseButtonVariants, splitPaneHandleVariants, splitPaneRootVariants, tagInputFieldVariants, tagInputRemoveButtonVariants, tagInputRootVariants, tagInputTagVariants, templateAgentCardBadgeVariants, templateAgentCardTagVariants, templateAgentCardVariants, templateCategoryChipVariants, templateListVariants, templateManagementRowVariants, threadIndicatorCountVariants, threadIndicatorRootVariants, threadViewEmptyVariants, threadViewRepliesVariants, threadViewReplyVariants, threadViewRootMessageVariants, threadViewRootVariants, toastCardVariants, toastDismissButtonVariants, toastProviderPositionVariants, toastTitleVariants, toolToggleListRowVariants, toolToggleListSectionVariants, useBreakpoint, useDevice, useMosaicWorkspace as useEffectiveWorkspaceId, useIsDesktop, useIsMobile, useIsTablet, useMediaQuery, useMosaicWorkspace, useOrientation, useViewport, version };
17135
+ // src/components/artifact-canvas-adapter/normalize.ts
17136
+ var KNOWN_TYPES = ["document", "data-table", "checklist", "chart"];
17137
+ function isArtifactType(value) {
17138
+ return KNOWN_TYPES.includes(value);
17139
+ }
17140
+ function titleFromData(data) {
17141
+ return typeof data.title === "string" ? data.title : "";
17142
+ }
17143
+ function normalizeFromAiSdkArtifacts(source) {
17144
+ if (!source.activeId) return null;
17145
+ const entry = source.artifacts.find((a) => a.id === source.activeId);
17146
+ if (!entry) return null;
17147
+ if (!isArtifactType(entry.type)) return null;
17148
+ return {
17149
+ id: entry.id,
17150
+ type: entry.type,
17151
+ title: titleFromData(entry.data),
17152
+ data: entry.data
17153
+ };
17154
+ }
17155
+ function normalizeFromMcpToolResult(source) {
17156
+ const resourceUri = source.toolResult?._meta?.ui?.resourceUri;
17157
+ if (!resourceUri) return null;
17158
+ const segments = resourceUri.split("/").filter(Boolean);
17159
+ const typeSegment = segments[segments.length - 1];
17160
+ if (!typeSegment || !isArtifactType(typeSegment)) return null;
17161
+ const data = source.toolResult.structuredContent ?? {};
17162
+ const id = typeof data.id === "string" ? data.id : resourceUri;
17163
+ return {
17164
+ id,
17165
+ type: typeSegment,
17166
+ title: titleFromData(data),
17167
+ data
17168
+ };
17169
+ }
17170
+ function normalizeArtifact(source) {
17171
+ if (source.kind === "ai-sdk-artifacts") return normalizeFromAiSdkArtifacts(source);
17172
+ if (source.kind === "mcp-ui") return normalizeFromMcpToolResult(source);
17173
+ return null;
17174
+ }
17175
+ function cn117(...classes) {
17176
+ return classes.filter(Boolean).join(" ");
17177
+ }
17178
+ function MosaicArtifactCanvasAdapter({
17179
+ source,
17180
+ isOpen,
17181
+ onToggle,
17182
+ onClose,
17183
+ labels,
17184
+ className,
17185
+ ref
17186
+ }) {
17187
+ const artifact = source ? normalizeArtifact(source) : null;
17188
+ return /* @__PURE__ */ jsxs("div", { ref, "data-slot": "artifact-canvas-adapter", className: cn117("relative", className), children: [
17189
+ /* @__PURE__ */ jsx(
17190
+ "button",
17191
+ {
17192
+ type: "button",
17193
+ "data-slot": "artifact-canvas-toggle",
17194
+ "aria-label": labels.toggleLabel,
17195
+ "aria-expanded": isOpen,
17196
+ onClick: onToggle,
17197
+ className: cn117(
17198
+ "inline-flex items-center justify-center rounded-md px-3 py-1.5 text-sm font-medium",
17199
+ "outline-none transition-colors",
17200
+ "focus-visible:ring-ring focus-visible:ring-[3px]",
17201
+ "bg-muted text-muted-foreground hover:text-foreground"
17202
+ ),
17203
+ children: labels.toggleLabel
17204
+ }
17205
+ ),
17206
+ isOpen && /* @__PURE__ */ jsxs(
17207
+ "section",
17208
+ {
17209
+ "aria-label": labels.toolbarHeading,
17210
+ "data-slot": "artifact-canvas",
17211
+ className: cn117(
17212
+ "mt-2 flex flex-col rounded-lg border border-border bg-background",
17213
+ "shadow-xs"
17214
+ ),
17215
+ children: [
17216
+ /* @__PURE__ */ jsxs(
17217
+ "div",
17218
+ {
17219
+ "data-slot": "artifact-canvas-toolbar",
17220
+ className: "flex items-center justify-between border-border border-b px-4 py-2",
17221
+ children: [
17222
+ /* @__PURE__ */ jsx("span", { className: "font-medium text-sm", children: labels.toolbarHeading }),
17223
+ /* @__PURE__ */ jsx(
17224
+ "button",
17225
+ {
17226
+ type: "button",
17227
+ "aria-label": labels.closeLabel,
17228
+ onClick: onClose,
17229
+ className: cn117(
17230
+ "rounded-md p-1 outline-none transition-colors",
17231
+ "focus-visible:ring-ring focus-visible:ring-[3px]",
17232
+ "hover:bg-muted"
17233
+ ),
17234
+ children: labels.closeLabel
17235
+ }
17236
+ )
17237
+ ]
17238
+ }
17239
+ ),
17240
+ /* @__PURE__ */ jsxs("div", { "data-slot": "artifact-canvas-body", className: "flex-1 p-4", children: [
17241
+ !source && /* @__PURE__ */ jsxs("div", { className: "text-center", children: [
17242
+ /* @__PURE__ */ jsx("p", { className: "font-medium text-muted-foreground", children: labels.emptyTitle }),
17243
+ /* @__PURE__ */ jsx("p", { className: "mt-1 text-muted-foreground/70 text-sm", children: labels.emptyBody })
17244
+ ] }),
17245
+ source && !artifact && /* @__PURE__ */ jsxs("div", { className: "text-center", children: [
17246
+ /* @__PURE__ */ jsx("p", { className: "font-medium text-muted-foreground", children: labels.notFoundTitle }),
17247
+ /* @__PURE__ */ jsx("p", { className: "mt-1 text-muted-foreground/70 text-sm", children: labels.notFoundBody })
17248
+ ] }),
17249
+ artifact && /* @__PURE__ */ jsx("div", { "data-slot": "artifact-canvas-artifact", "data-artifact-type": artifact.type, children: /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
17250
+ /* @__PURE__ */ jsx(
17251
+ "span",
17252
+ {
17253
+ "data-slot": "artifact-canvas-type-badge",
17254
+ className: "rounded-full bg-secondary px-2 py-0.5 text-secondary-foreground text-xs",
17255
+ children: labels.typeLabel(artifact.type)
17256
+ }
17257
+ ),
17258
+ /* @__PURE__ */ jsx("h3", { className: "font-semibold text-base", children: artifact.title })
17259
+ ] }) })
17260
+ ] })
17261
+ ]
17262
+ }
17263
+ )
17264
+ ] });
17265
+ }
17266
+ MosaicArtifactCanvasAdapter.displayName = "MosaicArtifactCanvasAdapter";
17267
+ function cn118(...classes) {
17268
+ return classes.filter(Boolean).join(" ");
17269
+ }
17270
+ function MosaicArtifactDocument({
17271
+ data,
17272
+ labels,
17273
+ className,
17274
+ ref
17275
+ }) {
17276
+ const sortedSections = data.sections ? [...data.sections].sort((a, b) => a.order - b.order) : [];
17277
+ return /* @__PURE__ */ jsxs(
17278
+ "div",
17279
+ {
17280
+ ref,
17281
+ "data-slot": "artifact-document",
17282
+ className: cn118(
17283
+ "flex h-full flex-col rounded-lg border border-border bg-background",
17284
+ className
17285
+ ),
17286
+ children: [
17287
+ /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between gap-3 border-border border-b px-4 py-3", children: [
17288
+ /* @__PURE__ */ jsxs("div", { className: "flex min-w-0 flex-1 items-center gap-3", children: [
17289
+ /* @__PURE__ */ jsx("h3", { className: "truncate font-medium text-base", children: data.title }),
17290
+ /* @__PURE__ */ jsx(
17291
+ "span",
17292
+ {
17293
+ "data-slot": "artifact-document-type-badge",
17294
+ className: "rounded-full bg-secondary px-2 py-0.5 text-secondary-foreground text-xs",
17295
+ children: labels.typeBadgeLabel
17296
+ }
17297
+ )
17298
+ ] }),
17299
+ data.metadata?.updatedAt && /* @__PURE__ */ jsx("span", { className: "shrink-0 text-muted-foreground text-xs", children: labels.updatedLabel(new Date(data.metadata.updatedAt).toLocaleDateString()) })
17300
+ ] }),
17301
+ /* @__PURE__ */ jsx("div", { className: "flex-1 overflow-auto p-6", children: /* @__PURE__ */ jsx("div", { className: "whitespace-pre-wrap text-sm leading-relaxed", children: data.content || labels.emptyContentMessage }) }),
17302
+ sortedSections.length > 0 && /* @__PURE__ */ jsxs("div", { className: "border-border border-t p-4", children: [
17303
+ /* @__PURE__ */ jsx("h4", { className: "mb-3 font-medium text-sm", children: labels.sectionsHeading }),
17304
+ /* @__PURE__ */ jsx("ul", { className: "space-y-2", children: sortedSections.map((section) => /* @__PURE__ */ jsxs(
17305
+ "li",
17306
+ {
17307
+ "data-slot": "artifact-document-section",
17308
+ className: "flex items-center gap-2 rounded bg-muted/50 p-2",
17309
+ children: [
17310
+ /* @__PURE__ */ jsx("span", { className: "h-4 w-1 shrink-0 rounded-full bg-primary" }),
17311
+ /* @__PURE__ */ jsx("span", { className: "font-medium text-sm", children: section.title }),
17312
+ /* @__PURE__ */ jsx("span", { className: "ml-auto rounded-full border border-border px-2 py-0.5 text-muted-foreground text-xs", children: labels.charsLabel(section.content.length) })
17313
+ ]
17314
+ },
17315
+ section.id
17316
+ )) })
17317
+ ] }),
17318
+ data.metadata?.tags && data.metadata.tags.length > 0 && /* @__PURE__ */ jsx("div", { className: "border-border border-t p-4", children: /* @__PURE__ */ jsxs("div", { className: "flex flex-wrap items-center gap-2", children: [
17319
+ /* @__PURE__ */ jsx("span", { className: "text-muted-foreground text-xs", children: labels.tagsLabel }),
17320
+ data.metadata.tags.map((tag) => /* @__PURE__ */ jsx(
17321
+ "span",
17322
+ {
17323
+ "data-slot": "artifact-document-tag",
17324
+ className: "rounded-full bg-secondary px-2 py-0.5 text-secondary-foreground text-xs",
17325
+ children: tag
17326
+ },
17327
+ tag
17328
+ ))
17329
+ ] }) })
17330
+ ]
17331
+ }
17332
+ );
17333
+ }
17334
+ MosaicArtifactDocument.displayName = "MosaicArtifactDocument";
17335
+ function cn119(...classes) {
17336
+ return classes.filter(Boolean).join(" ");
17337
+ }
17338
+ function MosaicArtifactDataTable({
17339
+ data,
17340
+ labels,
17341
+ className,
17342
+ ref
17343
+ }) {
17344
+ return /* @__PURE__ */ jsxs(
17345
+ "div",
17346
+ {
17347
+ ref,
17348
+ "data-slot": "artifact-data-table",
17349
+ className: cn119(
17350
+ "flex h-full flex-col rounded-lg border border-border bg-background",
17351
+ className
17352
+ ),
17353
+ children: [
17354
+ /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-3 border-border border-b px-4 py-3", children: [
17355
+ /* @__PURE__ */ jsx("h3", { className: "font-medium text-base", children: data.title }),
17356
+ /* @__PURE__ */ jsx(
17357
+ "span",
17358
+ {
17359
+ "data-slot": "artifact-data-table-type-badge",
17360
+ className: "rounded-full bg-secondary px-2 py-0.5 text-secondary-foreground text-xs",
17361
+ children: labels.typeBadgeLabel
17362
+ }
17363
+ ),
17364
+ /* @__PURE__ */ jsx("span", { className: "rounded-full border border-border px-2 py-0.5 text-muted-foreground text-xs", children: labels.rowsColsLabel(data.rows.length, data.columns.length) })
17365
+ ] }),
17366
+ /* @__PURE__ */ jsx("div", { className: "flex-1 overflow-auto", children: /* @__PURE__ */ jsx(
17367
+ MosaicDataTable,
17368
+ {
17369
+ columns: data.columns.map((column) => ({
17370
+ key: column.id,
17371
+ header: column.name,
17372
+ render: (row) => {
17373
+ const value = row[column.id];
17374
+ if (column.type === "boolean") {
17375
+ return /* @__PURE__ */ jsx("span", { className: "rounded-full bg-secondary px-2 py-0.5 text-secondary-foreground text-xs", children: value ? labels.yesLabel : labels.noLabel });
17376
+ }
17377
+ if (column.type === "number") {
17378
+ return /* @__PURE__ */ jsx("span", { className: "font-mono", children: String(value ?? "") });
17379
+ }
17380
+ return String(value ?? "");
17381
+ }
17382
+ })),
17383
+ rows: data.rows,
17384
+ emptyMessage: labels.emptyMessage
17385
+ }
17386
+ ) })
17387
+ ]
17388
+ }
17389
+ );
17390
+ }
17391
+ MosaicArtifactDataTable.displayName = "MosaicArtifactDataTable";
17392
+ function cn120(...classes) {
17393
+ return classes.filter(Boolean).join(" ");
17394
+ }
17395
+ var CHART_COLORS = [
17396
+ "var(--color-chart-1)",
17397
+ "var(--color-chart-2)",
17398
+ "var(--color-chart-3)",
17399
+ "var(--color-chart-4)",
17400
+ "var(--color-chart-5)"
17401
+ ];
17402
+ function seriesKeys(rows, xAxisKey) {
17403
+ return Object.keys(rows[0] ?? {}).filter((key) => key !== xAxisKey);
17404
+ }
17405
+ function renderChart(data, labels, recharts) {
17406
+ const {
17407
+ BarChart,
17408
+ Bar,
17409
+ LineChart,
17410
+ Line,
17411
+ PieChart,
17412
+ Pie,
17413
+ Cell,
17414
+ XAxis,
17415
+ YAxis,
17416
+ CartesianGrid,
17417
+ Tooltip: Tooltip2,
17418
+ Legend,
17419
+ ResponsiveContainer
17420
+ } = recharts;
17421
+ const xAxisKey = data.config?.xAxis ?? Object.keys(data.data[0] ?? {})[0] ?? "";
17422
+ const colors = data.config?.colors ?? CHART_COLORS;
17423
+ if (data.type === "bar") {
17424
+ return /* @__PURE__ */ jsx(ResponsiveContainer, { width: "100%", height: "100%", children: /* @__PURE__ */ jsxs(BarChart, { data: data.data, margin: { top: 20, right: 30, left: 20, bottom: 5 }, children: [
17425
+ data.config?.grid && /* @__PURE__ */ jsx(CartesianGrid, { strokeDasharray: "3 3" }),
17426
+ /* @__PURE__ */ jsx(XAxis, { dataKey: xAxisKey }),
17427
+ /* @__PURE__ */ jsx(YAxis, {}),
17428
+ /* @__PURE__ */ jsx(Tooltip2, {}),
17429
+ data.config?.legend && /* @__PURE__ */ jsx(Legend, {}),
17430
+ seriesKeys(data.data, xAxisKey).map((key, index) => /* @__PURE__ */ jsx(Bar, { dataKey: key, fill: colors[index % colors.length] }, key))
17431
+ ] }) });
17432
+ }
17433
+ if (data.type === "line") {
17434
+ return /* @__PURE__ */ jsx(ResponsiveContainer, { width: "100%", height: "100%", children: /* @__PURE__ */ jsxs(LineChart, { data: data.data, margin: { top: 20, right: 30, left: 20, bottom: 5 }, children: [
17435
+ data.config?.grid && /* @__PURE__ */ jsx(CartesianGrid, { strokeDasharray: "3 3" }),
17436
+ /* @__PURE__ */ jsx(XAxis, { dataKey: xAxisKey }),
17437
+ /* @__PURE__ */ jsx(YAxis, {}),
17438
+ /* @__PURE__ */ jsx(Tooltip2, {}),
17439
+ data.config?.legend && /* @__PURE__ */ jsx(Legend, {}),
17440
+ seriesKeys(data.data, xAxisKey).map((key, index) => /* @__PURE__ */ jsx(
17441
+ Line,
17442
+ {
17443
+ type: "monotone",
17444
+ dataKey: key,
17445
+ stroke: colors[index % colors.length],
17446
+ strokeWidth: 2
17447
+ },
17448
+ key
17449
+ ))
17450
+ ] }) });
17451
+ }
17452
+ if (data.type === "pie") {
17453
+ const nameKey = Object.keys(data.data[0] ?? {})[0] ?? "name";
17454
+ const valueKey = Object.keys(data.data[0] ?? {})[1] ?? "value";
17455
+ return /* @__PURE__ */ jsx(ResponsiveContainer, { width: "100%", height: "100%", children: /* @__PURE__ */ jsxs(PieChart, { children: [
17456
+ /* @__PURE__ */ jsx(Pie, { data: data.data, cx: "50%", cy: "50%", outerRadius: 80, dataKey: valueKey, children: data.data.map((entry, index) => /* @__PURE__ */ jsx(Cell, { fill: colors[index % colors.length] }, String(entry[nameKey] ?? index))) }),
17457
+ /* @__PURE__ */ jsx(Tooltip2, {}),
17458
+ data.config?.legend && /* @__PURE__ */ jsx(Legend, {})
17459
+ ] }) });
17460
+ }
17461
+ return /* @__PURE__ */ jsx("div", { className: "flex h-full items-center justify-center text-muted-foreground text-sm", children: labels.unsupportedTypeMessage(data.type) });
17462
+ }
17463
+ function MosaicArtifactChart({
17464
+ data,
17465
+ labels,
17466
+ recharts,
17467
+ className,
17468
+ ref
17469
+ }) {
17470
+ return /* @__PURE__ */ jsxs(
17471
+ "div",
17472
+ {
17473
+ ref,
17474
+ "data-slot": "artifact-chart",
17475
+ className: cn120(
17476
+ "flex h-full flex-col rounded-lg border border-border bg-background",
17477
+ className
17478
+ ),
17479
+ children: [
17480
+ /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-3 border-border border-b px-4 py-3", children: [
17481
+ /* @__PURE__ */ jsx("h3", { className: "font-medium text-base", children: data.title }),
17482
+ /* @__PURE__ */ jsx(
17483
+ "span",
17484
+ {
17485
+ "data-slot": "artifact-chart-type-badge",
17486
+ className: "rounded-full bg-secondary px-2 py-0.5 text-secondary-foreground text-xs",
17487
+ children: labels.typeBadgeLabel(data.type)
17488
+ }
17489
+ ),
17490
+ /* @__PURE__ */ jsx("span", { className: "rounded-full border border-border px-2 py-0.5 text-muted-foreground text-xs", children: labels.pointsLabel(data.data.length) })
17491
+ ] }),
17492
+ /* @__PURE__ */ jsx("div", { className: "min-h-64 flex-1 p-6", children: recharts ? renderChart(data, labels, recharts) : /* @__PURE__ */ jsx(
17493
+ "div",
17494
+ {
17495
+ "data-slot": "artifact-chart-unavailable",
17496
+ className: "flex h-full items-center justify-center text-muted-foreground text-sm",
17497
+ children: labels.unavailableMessage
17498
+ }
17499
+ ) }),
17500
+ (data.metadata?.dataSource || data.metadata?.description) && /* @__PURE__ */ jsx("div", { className: "border-border border-t px-4 py-3", children: /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-4 text-muted-foreground text-xs", children: [
17501
+ data.metadata?.dataSource && /* @__PURE__ */ jsx("span", { children: data.metadata.dataSource }),
17502
+ data.metadata?.description && /* @__PURE__ */ jsx("span", { children: data.metadata.description })
17503
+ ] }) })
17504
+ ]
17505
+ }
17506
+ );
17507
+ }
17508
+ MosaicArtifactChart.displayName = "MosaicArtifactChart";
17509
+ function cn121(...classes) {
17510
+ return classes.filter(Boolean).join(" ");
17511
+ }
17512
+ function MosaicArtifactChecklist({
17513
+ data,
17514
+ labels,
17515
+ className,
17516
+ ref
17517
+ }) {
17518
+ const completedCount = data.items.filter((item) => item.completed).length;
17519
+ const totalCount = data.items.length;
17520
+ const progress = totalCount > 0 ? completedCount / totalCount * 100 : 0;
17521
+ return /* @__PURE__ */ jsxs(
17522
+ "div",
17523
+ {
17524
+ ref,
17525
+ "data-slot": "artifact-checklist",
17526
+ className: cn121(
17527
+ "flex h-full flex-col rounded-lg border border-border bg-background",
17528
+ className
17529
+ ),
17530
+ children: [
17531
+ /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-3 border-border border-b px-4 py-3", children: [
17532
+ /* @__PURE__ */ jsx("h3", { className: "font-medium text-base", children: data.title }),
17533
+ /* @__PURE__ */ jsx(
17534
+ "span",
17535
+ {
17536
+ "data-slot": "artifact-checklist-type-badge",
17537
+ className: "rounded-full bg-secondary px-2 py-0.5 text-secondary-foreground text-xs",
17538
+ children: labels.typeBadgeLabel
17539
+ }
17540
+ ),
17541
+ /* @__PURE__ */ jsx("span", { className: "rounded-full border border-border px-2 py-0.5 text-muted-foreground text-xs", children: labels.progressLabel(completedCount, totalCount) })
17542
+ ] }),
17543
+ /* @__PURE__ */ jsxs("div", { className: "space-y-3 border-border border-b bg-muted/20 p-4", children: [
17544
+ /* @__PURE__ */ jsx("div", { className: "flex items-center justify-between text-sm", children: /* @__PURE__ */ jsx("span", { className: "text-muted-foreground", children: labels.completedOfTotalLabel(completedCount, totalCount, Math.round(progress)) }) }),
17545
+ /* @__PURE__ */ jsx(MosaicProgress, { value: progress, "aria-label": labels.typeBadgeLabel }),
17546
+ data.description && /* @__PURE__ */ jsx("p", { className: "text-muted-foreground text-sm", children: data.description })
17547
+ ] }),
17548
+ /* @__PURE__ */ jsx("div", { className: "flex-1 overflow-auto p-4", children: totalCount === 0 ? /* @__PURE__ */ jsx("p", { className: "py-8 text-center text-muted-foreground text-sm", children: labels.emptyMessage }) : /* @__PURE__ */ jsx("ul", { className: "space-y-3", children: data.items.map((item) => /* @__PURE__ */ jsxs(
17549
+ "li",
17550
+ {
17551
+ "data-slot": "artifact-checklist-item",
17552
+ className: cn121(
17553
+ "flex items-start gap-3 rounded-lg border p-3",
17554
+ item.completed ? "border-primary/20 bg-primary/10" : "border-border bg-background"
17555
+ ),
17556
+ children: [
17557
+ /* @__PURE__ */ jsx(
17558
+ "span",
17559
+ {
17560
+ "aria-hidden": "true",
17561
+ className: cn121(
17562
+ "mt-0.5 h-4 w-4 shrink-0 rounded border-2",
17563
+ item.completed ? "border-primary bg-primary" : "border-muted-foreground"
17564
+ )
17565
+ }
17566
+ ),
17567
+ /* @__PURE__ */ jsxs("div", { className: "min-w-0 flex-1", children: [
17568
+ /* @__PURE__ */ jsxs("div", { className: "flex items-start justify-between gap-2", children: [
17569
+ /* @__PURE__ */ jsx(
17570
+ "span",
17571
+ {
17572
+ className: cn121(
17573
+ "text-sm leading-relaxed",
17574
+ item.completed && "text-muted-foreground line-through"
17575
+ ),
17576
+ children: item.text
17577
+ }
17578
+ ),
17579
+ item.priority && /* @__PURE__ */ jsx("span", { className: "shrink-0 rounded-full border border-border px-2 py-0.5 text-xs", children: labels.priorityLabel(item.priority) })
17580
+ ] }),
17581
+ item.notes && /* @__PURE__ */ jsx("p", { className: "mt-2 rounded bg-muted/50 p-2 text-muted-foreground text-xs", children: item.notes })
17582
+ ] })
17583
+ ]
17584
+ },
17585
+ item.id
17586
+ )) }) }),
17587
+ data.metadata?.category && /* @__PURE__ */ jsx("div", { className: "border-border border-t bg-muted/20 px-4 py-3 text-muted-foreground text-xs", children: data.metadata.category })
17588
+ ]
17589
+ }
17590
+ );
17591
+ }
17592
+ MosaicArtifactChecklist.displayName = "MosaicArtifactChecklist";
17593
+ function cn122(...classes) {
17594
+ return classes.filter(Boolean).join(" ");
17595
+ }
17596
+ function SearchIcon10() {
17597
+ return /* @__PURE__ */ jsxs(
17598
+ "svg",
17599
+ {
17600
+ xmlns: "http://www.w3.org/2000/svg",
17601
+ width: "16",
17602
+ height: "16",
17603
+ viewBox: "0 0 24 24",
17604
+ fill: "none",
17605
+ stroke: "currentColor",
17606
+ strokeWidth: "2",
17607
+ strokeLinecap: "round",
17608
+ strokeLinejoin: "round",
17609
+ "aria-hidden": "true",
17610
+ children: [
17611
+ /* @__PURE__ */ jsx("circle", { cx: "11", cy: "11", r: "8" }),
17612
+ /* @__PURE__ */ jsx("line", { x1: "21", y1: "21", x2: "16.65", y2: "16.65" })
17613
+ ]
17614
+ }
17615
+ );
17616
+ }
17617
+ function MosaicArtifactLibrary({
17618
+ items,
17619
+ selectedId,
17620
+ onSelect,
17621
+ source,
17622
+ isCanvasOpen,
17623
+ onToggleCanvas,
17624
+ onCloseCanvas,
17625
+ title,
17626
+ searchPlaceholder,
17627
+ searchAriaLabel,
17628
+ emptyMessage,
17629
+ typeLabel,
17630
+ countLabel,
17631
+ adapterLabels,
17632
+ className
17633
+ }) {
17634
+ const [query, setQuery] = React30.useState("");
17635
+ const filtered = React30.useMemo(() => {
17636
+ const q = query.trim().toLowerCase();
17637
+ if (!q) return items;
17638
+ return items.filter((item) => item.title.toLowerCase().includes(q));
17639
+ }, [items, query]);
17640
+ return /* @__PURE__ */ jsxs("div", { "data-slot": "artifact-library", className: cn122("flex h-full flex-col", className), children: [
17641
+ /* @__PURE__ */ jsxs("div", { className: "border-border border-b px-4 py-3", children: [
17642
+ /* @__PURE__ */ jsxs("div", { className: "mb-3 flex items-center justify-between", children: [
17643
+ /* @__PURE__ */ jsx("h2", { className: "font-semibold text-lg", children: title }),
17644
+ /* @__PURE__ */ jsx("span", { className: "text-muted-foreground text-xs", children: countLabel(filtered.length) })
17645
+ ] }),
17646
+ /* @__PURE__ */ jsxs("div", { className: "relative", children: [
17647
+ /* @__PURE__ */ jsx("span", { className: "-translate-y-1/2 absolute top-1/2 left-3 text-muted-foreground", children: /* @__PURE__ */ jsx(SearchIcon10, {}) }),
17648
+ /* @__PURE__ */ jsx(
17649
+ "input",
17650
+ {
17651
+ type: "search",
17652
+ "data-slot": "artifact-library-search",
17653
+ value: query,
17654
+ onChange: (e) => setQuery(e.target.value),
17655
+ placeholder: searchPlaceholder,
17656
+ "aria-label": searchAriaLabel,
17657
+ className: cn122(
17658
+ "w-full rounded-md border border-input bg-background py-2 pr-3 pl-9",
17659
+ "text-sm placeholder:text-muted-foreground",
17660
+ "outline-none focus-visible:ring-[3px] focus-visible:ring-ring"
17661
+ )
17662
+ }
17663
+ )
17664
+ ] })
17665
+ ] }),
17666
+ /* @__PURE__ */ jsxs("div", { className: "flex-1 overflow-y-auto p-4", children: [
17667
+ filtered.length === 0 && /* @__PURE__ */ jsx("p", { className: "py-10 text-center text-muted-foreground text-sm", children: emptyMessage }),
17668
+ /* @__PURE__ */ jsx("ul", { "data-slot": "artifact-library-list", className: "space-y-2", children: filtered.map((item) => /* @__PURE__ */ jsx("li", { children: /* @__PURE__ */ jsxs(
17669
+ "button",
17670
+ {
17671
+ type: "button",
17672
+ "data-slot": "artifact-library-item",
17673
+ "aria-current": selectedId === item.id ? "true" : void 0,
17674
+ onClick: () => onSelect(item.id),
17675
+ className: cn122(
17676
+ "flex w-full items-start justify-between gap-3 rounded-md border border-border px-3 py-2 text-left",
17677
+ "outline-none transition-colors hover:bg-muted",
17678
+ "focus-visible:ring-[3px] focus-visible:ring-ring",
17679
+ selectedId === item.id && "border-primary bg-primary/5"
17680
+ ),
17681
+ children: [
17682
+ /* @__PURE__ */ jsxs("div", { className: "min-w-0 flex-1", children: [
17683
+ /* @__PURE__ */ jsx("p", { className: "truncate font-medium text-sm", children: item.title }),
17684
+ /* @__PURE__ */ jsx("p", { className: "mt-1 text-muted-foreground text-xs", children: item.updatedAtLabel })
17685
+ ] }),
17686
+ /* @__PURE__ */ jsx(
17687
+ "span",
17688
+ {
17689
+ "data-slot": "artifact-library-item-type",
17690
+ className: "shrink-0 rounded-full bg-secondary px-2 py-0.5 text-secondary-foreground text-xs",
17691
+ children: typeLabel(item.type)
17692
+ }
17693
+ )
17694
+ ]
17695
+ }
17696
+ ) }, item.id)) })
17697
+ ] }),
17698
+ /* @__PURE__ */ jsx("div", { "data-slot": "artifact-library-canvas", className: "border-border border-t p-4", children: /* @__PURE__ */ jsx(
17699
+ MosaicArtifactCanvasAdapter,
17700
+ {
17701
+ source,
17702
+ isOpen: isCanvasOpen,
17703
+ onToggle: onToggleCanvas,
17704
+ onClose: onCloseCanvas,
17705
+ labels: adapterLabels
17706
+ }
17707
+ ) })
17708
+ ] });
17709
+ }
17710
+ MosaicArtifactLibrary.displayName = "MosaicArtifactLibrary";
17711
+ var artifactSaveAsMemoryFormRootVariants = cva(["flex flex-col gap-4"]);
17712
+ var artifactSaveAsMemoryFormPreviewVariants = cva([
17713
+ "flex items-start gap-3 rounded-md border border-border p-3"
17714
+ ]);
17715
+ var artifactSaveAsMemoryFormFieldVariants = cva(["flex flex-col gap-1.5"]);
17716
+ var artifactSaveAsMemoryFormErrorVariants = cva(["text-xs font-medium text-destructive"]);
17717
+ var artifactSaveAsMemoryFormLearningVariants = cva([
17718
+ "flex items-start gap-2 rounded-md border border-border p-2"
17719
+ ]);
17720
+ var artifactSaveAsMemoryFormFooterVariants = cva([
17721
+ "flex items-center justify-end gap-3 border-t border-border pt-4"
17722
+ ]);
17723
+ var artifactSaveAsMemoryFormButtonVariants = cva(
17724
+ [
17725
+ "inline-flex min-h-9 items-center justify-center gap-2 rounded-md px-4 text-sm font-medium",
17726
+ "transition-colors disabled:cursor-not-allowed disabled:opacity-50"
17727
+ ],
17728
+ {
17729
+ variants: {
17730
+ intent: {
17731
+ cancel: "border border-border bg-background hover:bg-muted",
17732
+ save: "border border-transparent bg-primary text-primary-foreground hover:bg-primary/90",
17733
+ ghost: "border border-transparent bg-transparent hover:bg-muted"
17734
+ }
17735
+ },
17736
+ defaultVariants: {
17737
+ intent: "cancel"
17738
+ }
17739
+ }
17740
+ );
17741
+ function cn123(...classes) {
17742
+ return classes.filter(Boolean).join(" ");
17743
+ }
17744
+ function MosaicArtifactSaveAsMemoryForm({
17745
+ artifact,
17746
+ typeLabel,
17747
+ title,
17748
+ onTitleChange,
17749
+ titleLabel,
17750
+ titlePlaceholder,
17751
+ titleError,
17752
+ learnings,
17753
+ onEditLearning,
17754
+ onRemoveLearning,
17755
+ learningsLabel,
17756
+ learningsDescription,
17757
+ editLearningAriaLabel,
17758
+ removeLearningAriaLabel,
17759
+ scope,
17760
+ onScopeChange,
17761
+ scopeLabel,
17762
+ scopeOptions,
17763
+ tags,
17764
+ onAddTag,
17765
+ onRemoveTag,
17766
+ tagsLabel,
17767
+ tagInputPlaceholder,
17768
+ removeTagAriaLabel,
17769
+ suggestedTags,
17770
+ maxTags,
17771
+ isSaving,
17772
+ canSave,
17773
+ onSave,
17774
+ onCancel,
17775
+ saveLabel,
17776
+ savingLabel,
17777
+ cancelLabel,
17778
+ className
17779
+ }) {
17780
+ const titleErrorId = useId();
17781
+ const scopeId = useId();
17782
+ return /* @__PURE__ */ jsxs(
17783
+ "div",
17784
+ {
17785
+ "data-slot": "artifact-save-as-memory-form",
17786
+ className: cn123(artifactSaveAsMemoryFormRootVariants(), className),
17787
+ children: [
17788
+ /* @__PURE__ */ jsx(
17789
+ "div",
17790
+ {
17791
+ "data-slot": "artifact-save-as-memory-form-preview",
17792
+ className: artifactSaveAsMemoryFormPreviewVariants(),
17793
+ children: /* @__PURE__ */ jsxs("div", { className: "min-w-0 flex-1", children: [
17794
+ /* @__PURE__ */ jsx("p", { className: "truncate font-medium text-sm", children: artifact.title }),
17795
+ /* @__PURE__ */ jsx("p", { className: "mt-1 line-clamp-2 text-muted-foreground text-xs", children: artifact.preview || artifact.content }),
17796
+ /* @__PURE__ */ jsx(
17797
+ "span",
17798
+ {
17799
+ "data-slot": "artifact-save-as-memory-form-type",
17800
+ className: "mt-2 inline-block shrink-0 rounded-full bg-secondary px-2 py-0.5 text-secondary-foreground text-xs",
17801
+ children: typeLabel(artifact.type)
17802
+ }
17803
+ )
17804
+ ] })
17805
+ }
17806
+ ),
17807
+ /* @__PURE__ */ jsxs("div", { className: artifactSaveAsMemoryFormFieldVariants(), children: [
17808
+ /* @__PURE__ */ jsx(
17809
+ "label",
17810
+ {
17811
+ htmlFor: "mosaic-artifact-save-as-memory-title",
17812
+ className: "text-sm font-medium text-foreground",
17813
+ children: titleLabel
17814
+ }
17815
+ ),
17816
+ /* @__PURE__ */ jsx(
17817
+ MosaicInput,
17818
+ {
17819
+ id: "mosaic-artifact-save-as-memory-title",
17820
+ value: title,
17821
+ placeholder: titlePlaceholder,
17822
+ onChange: (e) => onTitleChange(e.target.value),
17823
+ "aria-invalid": titleError ? "true" : "false",
17824
+ "aria-describedby": titleError ? titleErrorId : void 0
17825
+ }
17826
+ ),
17827
+ titleError && /* @__PURE__ */ jsx("p", { id: titleErrorId, className: artifactSaveAsMemoryFormErrorVariants(), children: titleError })
17828
+ ] }),
17829
+ /* @__PURE__ */ jsxs("div", { className: artifactSaveAsMemoryFormFieldVariants(), children: [
17830
+ /* @__PURE__ */ jsx("span", { className: "text-sm font-medium text-foreground", children: learningsLabel }),
17831
+ learningsDescription && /* @__PURE__ */ jsx("p", { className: "text-muted-foreground text-xs", children: learningsDescription }),
17832
+ /* @__PURE__ */ jsx("div", { className: "flex flex-col gap-2", children: learnings.map((learning, index) => /* @__PURE__ */ jsxs(
17833
+ "div",
17834
+ {
17835
+ "data-slot": "artifact-save-as-memory-form-learning",
17836
+ className: artifactSaveAsMemoryFormLearningVariants(),
17837
+ children: [
17838
+ /* @__PURE__ */ jsx("p", { className: "flex-1 text-sm", children: learning }),
17839
+ /* @__PURE__ */ jsxs("div", { className: "flex shrink-0 gap-1", children: [
17840
+ /* @__PURE__ */ jsx(
17841
+ "button",
17842
+ {
17843
+ type: "button",
17844
+ "data-slot": "artifact-save-as-memory-form-learning-edit",
17845
+ onClick: () => onEditLearning(index),
17846
+ "aria-label": editLearningAriaLabel(index),
17847
+ className: artifactSaveAsMemoryFormButtonVariants({ intent: "ghost" }),
17848
+ children: editLearningAriaLabel(index)
17849
+ }
17850
+ ),
17851
+ /* @__PURE__ */ jsx(
17852
+ "button",
17853
+ {
17854
+ type: "button",
17855
+ "data-slot": "artifact-save-as-memory-form-learning-remove",
17856
+ onClick: () => onRemoveLearning(index),
17857
+ "aria-label": removeLearningAriaLabel(index),
17858
+ className: artifactSaveAsMemoryFormButtonVariants({ intent: "ghost" }),
17859
+ children: removeLearningAriaLabel(index)
17860
+ }
17861
+ )
17862
+ ] })
17863
+ ]
17864
+ },
17865
+ `${index}-${learning}`
17866
+ )) })
17867
+ ] }),
17868
+ /* @__PURE__ */ jsxs("div", { className: artifactSaveAsMemoryFormFieldVariants(), children: [
17869
+ /* @__PURE__ */ jsx("label", { htmlFor: scopeId, className: "text-sm font-medium text-foreground", children: scopeLabel }),
17870
+ /* @__PURE__ */ jsx(
17871
+ "select",
17872
+ {
17873
+ id: scopeId,
17874
+ "data-slot": "artifact-save-as-memory-form-scope",
17875
+ value: scope,
17876
+ onChange: (e) => onScopeChange(e.target.value),
17877
+ className: cn123(
17878
+ "h-9 rounded-md border border-input bg-background px-3 text-sm",
17879
+ "outline-none focus-visible:ring-[3px] focus-visible:ring-ring"
17880
+ ),
17881
+ children: scopeOptions.map((option) => /* @__PURE__ */ jsx("option", { value: option.value, children: option.label }, option.value))
17882
+ }
17883
+ )
17884
+ ] }),
17885
+ /* @__PURE__ */ jsxs("div", { className: artifactSaveAsMemoryFormFieldVariants(), children: [
17886
+ /* @__PURE__ */ jsx("span", { className: "text-sm font-medium text-foreground", children: tagsLabel }),
17887
+ /* @__PURE__ */ jsx(
17888
+ MosaicTagInput,
17889
+ {
17890
+ tags,
17891
+ onAddTag,
17892
+ onRemoveTag,
17893
+ placeholder: tagInputPlaceholder,
17894
+ removeTagAriaLabel,
17895
+ suggestions: suggestedTags,
17896
+ maxTags
17897
+ }
17898
+ )
17899
+ ] }),
17900
+ /* @__PURE__ */ jsxs("div", { className: artifactSaveAsMemoryFormFooterVariants(), children: [
17901
+ /* @__PURE__ */ jsx(
17902
+ "button",
17903
+ {
17904
+ type: "button",
17905
+ "data-slot": "artifact-save-as-memory-form-cancel-button",
17906
+ onClick: onCancel,
17907
+ disabled: isSaving,
17908
+ className: artifactSaveAsMemoryFormButtonVariants({ intent: "cancel" }),
17909
+ children: cancelLabel
17910
+ }
17911
+ ),
17912
+ /* @__PURE__ */ jsx(
17913
+ "button",
17914
+ {
17915
+ type: "button",
17916
+ "data-slot": "artifact-save-as-memory-form-save-button",
17917
+ onClick: onSave,
17918
+ disabled: !canSave || isSaving,
17919
+ "aria-busy": isSaving ? "true" : "false",
17920
+ className: artifactSaveAsMemoryFormButtonVariants({ intent: "save" }),
17921
+ children: isSaving ? savingLabel : saveLabel
17922
+ }
17923
+ )
17924
+ ] })
17925
+ ]
17926
+ }
17927
+ );
17928
+ }
17929
+ MosaicArtifactSaveAsMemoryForm.displayName = "MosaicArtifactSaveAsMemoryForm";
17930
+ function cn124(...classes) {
17931
+ return classes.filter(Boolean).join(" ");
17932
+ }
17933
+ function MosaicArtifactVersionHistory(props) {
17934
+ const {
17935
+ versions,
17936
+ selectedId,
17937
+ onSelectVersion,
17938
+ title,
17939
+ emptyMessage,
17940
+ currentLabel,
17941
+ selectAriaLabel,
17942
+ className
17943
+ } = props;
17944
+ return /* @__PURE__ */ jsxs("div", { "data-slot": "artifact-version-history", className: cn124("flex h-full flex-col", className), children: [
17945
+ /* @__PURE__ */ jsx("div", { className: "border-border border-b px-4 py-3", children: /* @__PURE__ */ jsx("h2", { className: "font-semibold text-lg", children: title }) }),
17946
+ /* @__PURE__ */ jsxs("div", { className: "flex-1 overflow-y-auto p-4", children: [
17947
+ versions.length === 0 && /* @__PURE__ */ jsx("p", { className: "py-10 text-center text-muted-foreground text-sm", children: emptyMessage }),
17948
+ /* @__PURE__ */ jsx("ul", { "data-slot": "artifact-version-history-list", className: "space-y-2", children: versions.map((version2) => /* @__PURE__ */ jsx("li", { "data-slot": "artifact-version-history-item", children: /* @__PURE__ */ jsxs(
17949
+ "div",
17950
+ {
17951
+ className: cn124(
17952
+ "flex items-start justify-between gap-3 rounded-md border border-border px-3 py-2",
17953
+ selectedId === version2.id && "border-primary bg-primary/5"
17954
+ ),
17955
+ children: [
17956
+ /* @__PURE__ */ jsxs(
17957
+ "button",
17958
+ {
17959
+ type: "button",
17960
+ "aria-current": selectedId === version2.id ? "true" : void 0,
17961
+ onClick: () => onSelectVersion(version2.id),
17962
+ className: cn124(
17963
+ "min-w-0 flex-1 text-left",
17964
+ "outline-none transition-colors",
17965
+ "focus-visible:ring-[3px] focus-visible:ring-ring"
17966
+ ),
17967
+ "aria-label": selectAriaLabel(version2),
17968
+ children: [
17969
+ /* @__PURE__ */ jsxs("div", { className: "mb-1 flex flex-wrap items-center gap-2", children: [
17970
+ /* @__PURE__ */ jsx("span", { className: "rounded-full border border-border px-2 py-0.5 text-xs", children: version2.versionLabel }),
17971
+ /* @__PURE__ */ jsx("span", { className: "rounded-full bg-secondary px-2 py-0.5 text-secondary-foreground text-xs", children: version2.changeTypeLabel }),
17972
+ version2.isCurrent && /* @__PURE__ */ jsx("span", { className: "rounded-full bg-primary px-2 py-0.5 text-primary-foreground text-xs", children: currentLabel })
17973
+ ] }),
17974
+ version2.descriptionLabel && /* @__PURE__ */ jsx("p", { className: "mb-1 truncate font-medium text-sm", children: version2.descriptionLabel }),
17975
+ /* @__PURE__ */ jsxs("div", { className: "flex flex-wrap items-center gap-3 text-muted-foreground text-xs", children: [
17976
+ /* @__PURE__ */ jsx("span", { children: version2.authorLabel }),
17977
+ /* @__PURE__ */ jsx("span", { children: version2.timestampLabel })
17978
+ ] })
17979
+ ]
17980
+ }
17981
+ ),
17982
+ props.onRestoreVersion && !version2.isCurrent && /* @__PURE__ */ jsx(
17983
+ "button",
17984
+ {
17985
+ type: "button",
17986
+ onClick: () => props.onRestoreVersion?.(version2.id),
17987
+ className: cn124(
17988
+ "shrink-0 rounded-md border border-input px-2 py-1 text-xs",
17989
+ "outline-none transition-colors hover:bg-muted",
17990
+ "focus-visible:ring-[3px] focus-visible:ring-ring"
17991
+ ),
17992
+ "aria-label": props.restoreAriaLabel(version2),
17993
+ children: props.restoreLabel
17994
+ }
17995
+ )
17996
+ ]
17997
+ }
17998
+ ) }, version2.id)) })
17999
+ ] })
18000
+ ] });
18001
+ }
18002
+ MosaicArtifactVersionHistory.displayName = "MosaicArtifactVersionHistory";
18003
+ function cn125(...classes) {
18004
+ return classes.filter(Boolean).join(" ");
18005
+ }
18006
+ function ChevronDownIcon6() {
18007
+ return /* @__PURE__ */ jsx(
18008
+ "svg",
18009
+ {
18010
+ xmlns: "http://www.w3.org/2000/svg",
18011
+ width: "16",
18012
+ height: "16",
18013
+ viewBox: "0 0 24 24",
18014
+ fill: "none",
18015
+ stroke: "currentColor",
18016
+ strokeWidth: "2",
18017
+ strokeLinecap: "round",
18018
+ strokeLinejoin: "round",
18019
+ "aria-hidden": "true",
18020
+ className: "h-4 w-4 shrink-0 text-muted-foreground",
18021
+ children: /* @__PURE__ */ jsx("path", { d: "m6 9 6 6 6-6" })
18022
+ }
18023
+ );
18024
+ }
18025
+ function OrgAvatar({ org }) {
18026
+ if (org.avatarUrl) {
18027
+ return /* @__PURE__ */ jsx(
18028
+ "img",
18029
+ {
18030
+ src: org.avatarUrl,
18031
+ alt: "",
18032
+ className: "h-8 w-8 shrink-0 rounded-full object-cover md:h-10 md:w-10"
18033
+ }
18034
+ );
18035
+ }
18036
+ return /* @__PURE__ */ jsx("div", { className: "flex h-8 w-8 shrink-0 items-center justify-center rounded-full bg-primary/10 md:h-10 md:w-10", children: /* @__PURE__ */ jsx("span", { "aria-hidden": "true", className: "text-primary text-sm font-medium", children: org.name.charAt(0).toUpperCase() }) });
18037
+ }
18038
+ function MosaicOrgContextDisplay(props) {
18039
+ const { org, roleLabel, roleDescription, memberCountLabel, className } = props;
18040
+ const content = /* @__PURE__ */ jsxs(Fragment, { children: [
18041
+ /* @__PURE__ */ jsx(OrgAvatar, { org }),
18042
+ /* @__PURE__ */ jsxs("div", { className: "min-w-0 flex-1 text-left", children: [
18043
+ /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
18044
+ /* @__PURE__ */ jsx("span", { className: "truncate font-medium text-sm md:text-base", children: org.name }),
18045
+ /* @__PURE__ */ jsx("span", { className: "hidden md:inline-flex", children: /* @__PURE__ */ jsx(MosaicOrgRoleBadge, { role: org.role, label: roleLabel, description: roleDescription }) })
18046
+ ] }),
18047
+ /* @__PURE__ */ jsx("div", { className: "hidden text-muted-foreground text-xs md:block", children: memberCountLabel(org.memberCount) })
18048
+ ] })
18049
+ ] });
18050
+ if (!props.onSwitchOrg) {
18051
+ return /* @__PURE__ */ jsx(
18052
+ "div",
18053
+ {
18054
+ "data-slot": "org-context-display",
18055
+ className: cn125("flex w-full items-center gap-3 min-h-[44px] p-2 md:p-3", className),
18056
+ children: content
18057
+ }
18058
+ );
18059
+ }
18060
+ return /* @__PURE__ */ jsxs(
18061
+ "button",
18062
+ {
18063
+ type: "button",
18064
+ "data-slot": "org-context-display",
18065
+ onClick: props.onSwitchOrg,
18066
+ "aria-label": props.switchAriaLabel,
18067
+ className: cn125(
18068
+ "flex w-full items-center gap-3 justify-start rounded-md border border-border",
18069
+ "outline-none transition-colors hover:bg-accent min-h-[44px] p-2 md:p-3",
18070
+ "focus-visible:ring-[3px] focus-visible:ring-ring",
18071
+ className
18072
+ ),
18073
+ children: [
18074
+ content,
18075
+ /* @__PURE__ */ jsx(ChevronDownIcon6, {})
18076
+ ]
18077
+ }
18078
+ );
18079
+ }
18080
+ MosaicOrgContextDisplay.displayName = "MosaicOrgContextDisplay";
18081
+ function cn126(...classes) {
18082
+ return classes.filter(Boolean).join(" ");
18083
+ }
18084
+ function ShieldIcon() {
18085
+ return /* @__PURE__ */ jsx(
18086
+ "svg",
18087
+ {
18088
+ xmlns: "http://www.w3.org/2000/svg",
18089
+ width: "16",
18090
+ height: "16",
18091
+ viewBox: "0 0 24 24",
18092
+ fill: "none",
18093
+ stroke: "currentColor",
18094
+ strokeWidth: "2",
18095
+ strokeLinecap: "round",
18096
+ strokeLinejoin: "round",
18097
+ "aria-hidden": "true",
18098
+ className: "size-3 shrink-0 md:size-4",
18099
+ children: /* @__PURE__ */ jsx("path", { d: "M20 13c0 5-3.5 7.5-7.35 8.95a1 1 0 0 1-1.3 0C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.79 17 5 19 5a1 1 0 0 1 1 1z" })
18100
+ }
18101
+ );
18102
+ }
18103
+ function AlertTriangleIcon() {
18104
+ return /* @__PURE__ */ jsxs(
18105
+ "svg",
18106
+ {
18107
+ xmlns: "http://www.w3.org/2000/svg",
18108
+ width: "16",
18109
+ height: "16",
18110
+ viewBox: "0 0 24 24",
18111
+ fill: "none",
18112
+ stroke: "currentColor",
18113
+ strokeWidth: "2",
18114
+ strokeLinecap: "round",
18115
+ strokeLinejoin: "round",
18116
+ "aria-hidden": "true",
18117
+ className: "size-8 shrink-0 text-destructive md:size-10",
18118
+ children: [
18119
+ /* @__PURE__ */ jsx("path", { d: "m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3Z" }),
18120
+ /* @__PURE__ */ jsx("path", { d: "M12 9v4" }),
18121
+ /* @__PURE__ */ jsx("path", { d: "M12 17h.01" })
18122
+ ]
18123
+ }
18124
+ );
18125
+ }
18126
+ function ArrowLeftIcon2() {
18127
+ return /* @__PURE__ */ jsxs(
18128
+ "svg",
18129
+ {
18130
+ xmlns: "http://www.w3.org/2000/svg",
18131
+ width: "16",
18132
+ height: "16",
18133
+ viewBox: "0 0 24 24",
18134
+ fill: "none",
18135
+ stroke: "currentColor",
18136
+ strokeWidth: "2",
18137
+ strokeLinecap: "round",
18138
+ strokeLinejoin: "round",
18139
+ "aria-hidden": "true",
18140
+ className: "size-4 shrink-0",
18141
+ children: [
18142
+ /* @__PURE__ */ jsx("path", { d: "m12 19-7-7 7-7" }),
18143
+ /* @__PURE__ */ jsx("path", { d: "M19 12H5" })
18144
+ ]
18145
+ }
18146
+ );
18147
+ }
18148
+ function DefaultLoadingFallback() {
18149
+ return /* @__PURE__ */ jsx("div", { className: "flex min-h-screen items-center justify-center p-4 md:p-8", children: /* @__PURE__ */ jsx(
18150
+ "div",
18151
+ {
18152
+ "data-slot": "admin-only-guard-loading",
18153
+ "aria-hidden": "true",
18154
+ className: "size-8 animate-spin rounded-full border-2 border-muted-foreground/30 border-t-primary md:size-10"
18155
+ }
18156
+ ) });
18157
+ }
18158
+ function MosaicAdminOnlyGuard(props) {
18159
+ const {
18160
+ children,
18161
+ isAdmin,
18162
+ isLoaded,
18163
+ title,
18164
+ description,
18165
+ requiredRoleLabel,
18166
+ loadingFallback,
18167
+ className
18168
+ } = props;
18169
+ if (!isLoaded) {
18170
+ return /* @__PURE__ */ jsx(Fragment, { children: loadingFallback ?? /* @__PURE__ */ jsx(DefaultLoadingFallback, {}) });
18171
+ }
18172
+ if (!isAdmin) {
18173
+ return /* @__PURE__ */ jsx(
18174
+ "div",
18175
+ {
18176
+ "data-slot": "admin-only-guard",
18177
+ className: cn126(
18178
+ "flex min-h-screen flex-col items-center justify-center p-4 md:p-8",
18179
+ className
18180
+ ),
18181
+ children: /* @__PURE__ */ jsxs("div", { className: "flex w-full max-w-md flex-col items-center gap-4 rounded-lg border bg-card p-6 md:gap-6 md:p-8", children: [
18182
+ /* @__PURE__ */ jsx("div", { className: "flex size-16 items-center justify-center rounded-full bg-destructive/10 md:size-20", children: /* @__PURE__ */ jsx(AlertTriangleIcon, {}) }),
18183
+ /* @__PURE__ */ jsx("h2", { className: "text-center font-semibold text-lg md:text-xl", children: title }),
18184
+ /* @__PURE__ */ jsx("p", { className: "text-center text-muted-foreground text-sm md:text-base", children: description }),
18185
+ /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2 rounded-md bg-primary/10 px-3 py-2 text-primary text-xs md:text-sm", children: [
18186
+ /* @__PURE__ */ jsx(ShieldIcon, {}),
18187
+ /* @__PURE__ */ jsx("span", { className: "font-medium", children: requiredRoleLabel })
18188
+ ] }),
18189
+ props.onExit ? /* @__PURE__ */ jsxs(
18190
+ MosaicButton,
18191
+ {
18192
+ onClick: props.onExit,
18193
+ "aria-label": props.exitAriaLabel,
18194
+ className: "mt-2 min-h-[44px] w-full",
18195
+ children: [
18196
+ /* @__PURE__ */ jsx(ArrowLeftIcon2, {}),
18197
+ props.exitLabel
18198
+ ]
18199
+ }
18200
+ ) : null
18201
+ ] })
18202
+ }
18203
+ );
18204
+ }
18205
+ return /* @__PURE__ */ jsx(Fragment, { children });
18206
+ }
18207
+ MosaicAdminOnlyGuard.displayName = "MosaicAdminOnlyGuard";
18208
+
18209
+ // src/components/document-review/panel-tab.ts
18210
+ var REVIEW_PANEL_TABS = ["compare", "document", "row"];
18211
+ var INITIAL_REVIEW_PANEL_TAB = "compare";
18212
+
18213
+ // src/components/document-review/row-navigation.ts
18214
+ function isEditableTarget(target) {
18215
+ return target instanceof HTMLInputElement || target instanceof HTMLTextAreaElement || target instanceof HTMLSelectElement || target instanceof HTMLElement && target.isContentEditable === true;
18216
+ }
18217
+ function neighbourRowId(orderedRowIds, currentRowId, direction) {
18218
+ const index = orderedRowIds.indexOf(currentRowId);
18219
+ if (index === -1) return null;
18220
+ const neighbourIndex = index + (direction === "next" ? 1 : -1);
18221
+ if (neighbourIndex < 0 || neighbourIndex >= orderedRowIds.length) return null;
18222
+ return orderedRowIds[neighbourIndex] ?? null;
18223
+ }
18224
+
18225
+ // src/components/document-review/column-model.ts
18226
+ var COLUMN_MODEL_ERRORS = {
18227
+ // allow-hardcoded-word: developer-facing invariant error, never rendered to an end user
18228
+ unknownColumn: (id) => `document-review: visibility names unknown column "${id}"`
18229
+ };
18230
+ function assertKnown(columns, ids) {
18231
+ const known = new Set(columns.map((c) => c.id));
18232
+ for (const id of ids) {
18233
+ if (!known.has(id)) {
18234
+ throw new Error(COLUMN_MODEL_ERRORS.unknownColumn(id));
18235
+ }
18236
+ }
18237
+ }
18238
+ function initialColumnVisibility(columns) {
18239
+ return Object.fromEntries(columns.map((c) => [c.id, c.defaultVisible]));
18240
+ }
18241
+ function toggleColumnVisibility(columns, visibility, id) {
18242
+ assertKnown(columns, [id]);
18243
+ const column = columns.find((c) => c.id === id);
18244
+ const current = visibility[id] ?? column.defaultVisible;
18245
+ return { ...visibility, [id]: !current };
18246
+ }
18247
+ function visibleColumns(columns, visibility) {
18248
+ assertKnown(columns, Object.keys(visibility));
18249
+ return columns.filter((c) => visibility[c.id] ?? c.defaultVisible);
18250
+ }
18251
+
18252
+ // src/components/document-review/field-correction.ts
18253
+ async function applyFieldCorrection(args) {
18254
+ const { row, field, input, by, provenance, write, validate, now } = args;
18255
+ const checked = validate ? validate(field, input, row) : { ok: true, value: input };
18256
+ if (!checked.ok) return { ok: false, row, message: checked.message };
18257
+ let response;
18258
+ try {
18259
+ response = await write({ rowId: row.id, field, input, by, provenance });
18260
+ } catch (e) {
18261
+ return { ok: false, row, message: e instanceof Error ? e.message : String(e) };
18262
+ }
18263
+ if (!response.ok) return { ok: false, row, message: response.message };
18264
+ const confirmed = "value" in response;
18265
+ const corrected = confirmed ? response.value ?? null : checked.value;
18266
+ const original = row.corrections?.[field]?.original ?? row.values[field] ?? null;
18267
+ const record = {
18268
+ original,
18269
+ corrected,
18270
+ by,
18271
+ at: now ? now() : (/* @__PURE__ */ new Date()).toISOString(),
18272
+ provenance
18273
+ };
18274
+ return {
18275
+ ok: true,
18276
+ confirmed,
18277
+ row: {
18278
+ ...row,
18279
+ values: { ...row.values, [field]: corrected },
18280
+ corrections: { ...row.corrections, [field]: record }
18281
+ }
18282
+ };
18283
+ }
18284
+ function correctionOutcome(result) {
18285
+ if (!result.ok) return "failed";
18286
+ return result.confirmed ? "ok" : "uncertain";
18287
+ }
18288
+ function MosaicDocumentTable({
18289
+ columns,
18290
+ rows,
18291
+ getRowId,
18292
+ columnVisibility,
18293
+ selectedRowId: controlledSelectedRowId,
18294
+ onSelectedRowChange,
18295
+ renderPanel,
18296
+ emptyMessage,
18297
+ className
18298
+ }) {
18299
+ const [internalSelectedRowId, setInternalSelectedRowId] = useState(null);
18300
+ const isControlled = controlledSelectedRowId !== void 0;
18301
+ const selectedRowId = isControlled ? controlledSelectedRowId : internalSelectedRowId;
18302
+ function select(rowId) {
18303
+ if (!isControlled) setInternalSelectedRowId(rowId);
18304
+ onSelectedRowChange?.(rowId);
18305
+ }
18306
+ const shown = visibleColumns(columns, columnVisibility ?? initialColumnVisibility(columns));
18307
+ const tableColumns = shown.map((column, columnIndex) => ({
18308
+ key: column.id,
18309
+ header: column.label,
18310
+ render: (row) => {
18311
+ const value = column.accessor(row);
18312
+ const text = value === null ? "" : String(value);
18313
+ if (columnIndex !== 0) return text;
18314
+ const isSelected = getRowId(row) === selectedRowId;
18315
+ return /* @__PURE__ */ jsx(
18316
+ "button",
18317
+ {
18318
+ type: "button",
18319
+ "data-slot": "document-table-open",
18320
+ "aria-current": isSelected ? "true" : void 0,
18321
+ "data-selected": isSelected ? "true" : void 0,
18322
+ className: "text-left underline-offset-2 hover:underline focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",
18323
+ children: text
18324
+ }
18325
+ );
18326
+ }
18327
+ }));
18328
+ function handleClick(event) {
18329
+ const tr = event.target.closest("tr[data-slot='data-table-row']");
18330
+ if (!(tr instanceof HTMLTableRowElement)) return;
18331
+ const row = rows[tr.sectionRowIndex];
18332
+ if (row !== void 0) select(getRowId(row));
18333
+ }
18334
+ const orderedRowIds = rows.map(getRowId);
18335
+ const selectedRow = selectedRowId === null ? void 0 : rows.find((row) => getRowId(row) === selectedRowId);
18336
+ return (
18337
+ // biome-ignore lint/a11y/useKeyWithClickEvents: keyboard path is the first column's real <button>; this only resolves mouse clicks on other cells to their row
18338
+ /* @__PURE__ */ jsxs("div", { "data-slot": "document-table", className, onClick: handleClick, children: [
18339
+ /* @__PURE__ */ jsx(
18340
+ MosaicDataTable,
18341
+ {
18342
+ columns: tableColumns,
18343
+ rows,
18344
+ getRowKey: (row) => getRowId(row),
18345
+ sortable: false,
18346
+ emptyMessage
18347
+ }
18348
+ ),
18349
+ selectedRow !== void 0 && renderPanel ? renderPanel(selectedRow, {
18350
+ rowId: getRowId(selectedRow),
18351
+ orderedRowIds,
18352
+ selectRow: (rowId) => select(rowId),
18353
+ closeRow: () => select(null)
18354
+ }) : null
18355
+ ] })
18356
+ );
18357
+ }
18358
+ MosaicDocumentTable.displayName = "MosaicDocumentTable";
18359
+ function MosaicDocumentCriteriaPanel({
18360
+ row,
18361
+ rowId,
18362
+ columns,
18363
+ columnVisibility,
18364
+ documentUrl,
18365
+ orderedRowIds,
18366
+ onNavigate,
18367
+ onCorrect,
18368
+ actor,
18369
+ correctionProvenance,
18370
+ provenanceLabel,
18371
+ labels,
18372
+ defaultTab = INITIAL_REVIEW_PANEL_TAB,
18373
+ className
18374
+ }) {
18375
+ const [tab, setTab] = useState(defaultTab);
18376
+ const [sideWidth, setSideWidth] = useState(45);
18377
+ const [isSideCollapsed, setIsSideCollapsed] = useState(false);
18378
+ const previousId = neighbourRowId(orderedRowIds, rowId, "prev");
18379
+ const nextId = neighbourRowId(orderedRowIds, rowId, "next");
18380
+ const tabLabel = {
18381
+ compare: labels.tabCompare,
18382
+ document: labels.tabDocument,
18383
+ row: labels.tabRow
18384
+ };
18385
+ const document_ = /* @__PURE__ */ jsx(
18386
+ MosaicPdfViewer,
18387
+ {
18388
+ fileUrl: documentUrl,
18389
+ loadingLabel: labels.documentLoading,
18390
+ errorLabel: labels.documentError
18391
+ }
18392
+ );
18393
+ const fields = /* @__PURE__ */ jsx("dl", { "data-slot": "document-criteria-fields", className: "flex flex-col gap-3 p-3", children: visibleColumns(columns, columnVisibility ?? initialColumnVisibility(columns)).map(
18394
+ (column) => {
18395
+ const value = column.accessor(row);
18396
+ const provenance = provenanceLabel(row, column);
18397
+ return /* @__PURE__ */ jsxs(
18398
+ "div",
18399
+ {
18400
+ "data-slot": "document-criteria-field",
18401
+ className: "flex flex-col gap-1",
18402
+ children: [
18403
+ /* @__PURE__ */ jsx("dt", { className: "text-xs font-medium text-muted-foreground", children: column.label }),
18404
+ /* @__PURE__ */ jsxs("dd", { className: "m-0 flex flex-col gap-1", children: [
18405
+ /* @__PURE__ */ jsx(
18406
+ MosaicEditableCell,
18407
+ {
18408
+ value: value === null ? "" : String(value),
18409
+ disabled: column.editable === false,
18410
+ editAriaLabel: labels.editField(column.label),
18411
+ onCommit: (input) => {
18412
+ onCorrect({
18413
+ rowId,
18414
+ field: column.id,
18415
+ input,
18416
+ by: actor,
18417
+ provenance: correctionProvenance
18418
+ });
18419
+ }
18420
+ }
18421
+ ),
18422
+ provenance ? /* @__PURE__ */ jsx(
18423
+ "span",
18424
+ {
18425
+ "data-slot": "document-criteria-provenance",
18426
+ className: "text-xs text-muted-foreground",
18427
+ children: provenance
18428
+ }
18429
+ ) : null
18430
+ ] })
18431
+ ]
18432
+ },
18433
+ column.id
18434
+ );
18435
+ }
18436
+ ) });
18437
+ return /* @__PURE__ */ jsx(
18438
+ "section",
18439
+ {
18440
+ "data-slot": "document-criteria-panel",
18441
+ "data-row-id": rowId,
18442
+ className: ["flex flex-col gap-2 rounded-md border border-border p-2", className].filter(Boolean).join(" "),
18443
+ children: /* @__PURE__ */ jsxs(MosaicTabs, { value: tab, onValueChange: (next) => setTab(next), children: [
18444
+ /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between gap-2", children: [
18445
+ /* @__PURE__ */ jsx(MosaicTabsList, { children: REVIEW_PANEL_TABS.map((value) => /* @__PURE__ */ jsx(MosaicTabsTrigger, { value, children: tabLabel[value] }, value)) }),
18446
+ /* @__PURE__ */ jsxs("div", { className: "flex gap-2", children: [
18447
+ /* @__PURE__ */ jsx(
18448
+ "button",
18449
+ {
18450
+ type: "button",
18451
+ disabled: previousId === null,
18452
+ onClick: () => previousId !== null && onNavigate(previousId),
18453
+ className: "rounded-md border border-border px-3 py-1 text-sm disabled:opacity-50",
18454
+ children: labels.previous
18455
+ }
18456
+ ),
18457
+ /* @__PURE__ */ jsx(
18458
+ "button",
18459
+ {
18460
+ type: "button",
18461
+ disabled: nextId === null,
18462
+ onClick: () => nextId !== null && onNavigate(nextId),
18463
+ className: "rounded-md border border-border px-3 py-1 text-sm disabled:opacity-50",
18464
+ children: labels.next
18465
+ }
18466
+ )
18467
+ ] })
18468
+ ] }),
18469
+ /* @__PURE__ */ jsx(MosaicTabsPanel, { value: "compare", children: /* @__PURE__ */ jsx(
18470
+ MosaicResizableSplitPane,
18471
+ {
18472
+ main: document_,
18473
+ side: fields,
18474
+ sideWidth,
18475
+ onSideWidthChange: setSideWidth,
18476
+ isSideCollapsed,
18477
+ onToggleSideCollapsed: () => setIsSideCollapsed((c) => !c),
18478
+ collapseButtonAriaLabel: labels.collapse,
18479
+ resizeHandleAriaLabel: labels.resize
18480
+ }
18481
+ ) }),
18482
+ /* @__PURE__ */ jsx(MosaicTabsPanel, { value: "document", children: document_ }),
18483
+ /* @__PURE__ */ jsx(MosaicTabsPanel, { value: "row", children: fields })
18484
+ ] })
18485
+ }
18486
+ );
18487
+ }
18488
+ MosaicDocumentCriteriaPanel.displayName = "MosaicDocumentCriteriaPanel";
18489
+
18490
+ export { INITIAL_REVIEW_PANEL_TAB, MosaicAccordion, MosaicAccordionItem, MosaicAccordionPanel, MosaicAccordionTrigger, MosaicActivityFeed, MosaicActivityItem, MosaicAdaptiveGrid, MosaicAdaptiveModal, MosaicAdaptiveNavigation, MosaicAddMemoryForm, MosaicAdminOnlyGuard, MosaicAgentBuilderModal, MosaicAgentCard, MosaicAgentChat, MosaicAgentComposer, MosaicAgentComposerDesktop, MosaicAgentComposerMobile, MosaicAgentEditor, MosaicAgentList, AgentListDesktop as MosaicAgentListDesktop, AgentListMobile as MosaicAgentListMobile, MosaicAgentPreview, MosaicAgentTeamPreview, MosaicAlertDialog, MosaicAlertDialogAction, MosaicAlertDialogCancel, MosaicAlertDialogContent, MosaicAlertDialogDescription, MosaicAlertDialogFooter, MosaicAlertDialogHeader, MosaicAlertDialogOverlay, MosaicAlertDialogPortal, MosaicAlertDialogTitle, MosaicAlertDialogTrigger, MosaicAnimatedList, MosaicApiKeyPanel, MosaicAppSidebar, MosaicApprovalPrompt, MosaicArtifactCanvasAdapter, MosaicArtifactChart, MosaicArtifactChecklist, MosaicArtifactDataTable, MosaicArtifactDocument, MosaicArtifactLibrary, MosaicArtifactSaveAsMemoryForm, MosaicArtifactVersionHistory, MosaicAvatar, MosaicBadge, MosaicBlurredOrb, MosaicButton, MosaicCallout, MosaicCard, MosaicCardContent, MosaicCardDescription, MosaicCardFooter, MosaicCardHeader, MosaicCardTitle, MosaicChatComposer, MosaicChatMessage, MosaicChatSidebar, MosaicChatThread, MosaicCheckbox, MosaicClerkOrgSwitcher, MosaicClerkWebhookHandler, MosaicCollapsible, MosaicCollapsiblePanel, MosaicCollapsibleTrigger, MosaicCombobox, MosaicCounter, MosaicCreateOrgDialog, MosaicDashboardContent, MosaicDashboardHeader, MosaicDashboardLayout, MosaicDataTable, MosaicDeleteConfirmationDialog, MosaicDeviceProvider, MosaicDocumentCriteriaPanel, MosaicDocumentTable, MosaicDocumentUpload, MosaicDrawer, MosaicDropdownMenu, MosaicEditMemoryDialog, MosaicEditSessionDialog, MosaicEditableCell, MosaicEmptyState, MosaicFallingPattern, MosaicFeature3Col, MosaicFeatureCenteredMedia, MosaicField, MosaicFieldControl, MosaicFieldDescription, MosaicFieldError, MosaicFieldLabel, MosaicFilterBar, MosaicFilterSidebar, MosaicFooterSimple, MosaicHeroSplit, MosaicInput, MosaicInputGroup, MosaicIntegrationsBadge, MosaicInviteMemberDialog, MosaicKanbanBoard, MosaicKanbanColumn, MosaicLogosGrid, MosaicMainNav, MosaicMarkdown, MosaicMarketplaceCard, MosaicMarketplaceList, MarketplaceListDesktop as MosaicMarketplaceListDesktop, MarketplaceListMobile as MosaicMarketplaceListMobile, MosaicMatchInput, MosaicMemberList, MosaicMemoryCard, MosaicMemoryDashboard, MosaicMemoryGrid, MosaicMemoryList, MosaicMemorySearch, MosaicMentionInput, MosaicMessageCard, MosaicMessageList, MessageListDesktop as MosaicMessageListDesktop, MessageListMobile as MosaicMessageListMobile, MosaicMessageSearch, MosaicModelSelector, MosaicModuleCard, MosaicModuleForm, MosaicModuleLibrary, MosaicMultiOrgIndicator, MosaicMultiTenantProvider, MosaicNavbar, MosaicOrgContextDisplay, MosaicOrgPanel, MosaicOrgProfilePage, MosaicOrgRoleBadge, MosaicOrgSwitcher, MosaicPdfViewer, MosaicPopover, MosaicPreferencesPanel, MosaicPricingCard, MosaicProfilePanel, MosaicProgress, MosaicQuickActionCard, MosaicQuickActionsMenu, MosaicQuickAgentSelector, MosaicQuickStartPanel, MosaicRadioGroup, MosaicRadioGroupItem, MosaicReplyInput, MosaicResizableSplitPane, MosaicSaveChatAsMemoryForm, MosaicSaveTemplateModal, MosaicScrollArea, MosaicSelect, MosaicSelectorModal, MosaicSeparator, MosaicSessionCard, MosaicSessionList, MosaicSignInLayout, MosaicSignUpLayout, MosaicSkeleton, MosaicSlider, MosaicStatsGrid, MosaicStepPipeline, MosaicSwitch, MosaicTabs, MosaicTabsList, MosaicTabsPanel, MosaicTabsTrigger, MosaicTagInput, MosaicTemplateAgentCard, MosaicTemplateCard, MosaicTemplateCategoryChips, MosaicTemplateGallery, MosaicTemplateList, MosaicTemplateManagementPanel, MosaicTemplatePreview, MosaicTestimonialsGrid, MosaicTextarea, MosaicThemeProvider, MosaicThemeToggle, MosaicThreadIndicator, MosaicThreadView, MosaicToast, MosaicToastProvider, MosaicToolToggleList, MosaicTooltip, MosaicTooltipContent, MosaicTooltipProvider, MosaicTooltipRoot, MosaicTooltipTrigger, MosaicUrlScraper, MosaicUserButton, Placeholder, REVIEW_PANEL_TABS, addMemoryFormButtonVariants, addMemoryFormErrorVariants, addMemoryFormFieldVariants, addMemoryFormFooterVariants, addMemoryFormRootVariants, agentBuilderModalBackdropVariants, agentBuilderModalPopupVariants, agentChatRootVariants, agentEditorVariants, agentPreviewVariants, alertDialogContentVariants, alertDialogOverlayVariants, applyFieldCorrection, artifactSaveAsMemoryFormButtonVariants, artifactSaveAsMemoryFormErrorVariants, artifactSaveAsMemoryFormFieldVariants, artifactSaveAsMemoryFormFooterVariants, artifactSaveAsMemoryFormLearningVariants, artifactSaveAsMemoryFormPreviewVariants, artifactSaveAsMemoryFormRootVariants, badgeVariants, buttonVariants, calloutVariants, chatMessageBubbleVariants, chatMessageContainerVariants, chatMessageToolStatusVariants, chatSidebarThreadVariants, correctionOutcome, drawerBackdropVariants, drawerPopupVariants, editMemoryDialogBackdropVariants, editMemoryDialogErrorVariants, editMemoryDialogFieldVariants, editMemoryDialogPopupVariants, editSessionDialogBodyVariants, editSessionDialogButtonVariants, editSessionDialogErrorVariants, editSessionDialogFieldVariants, editSessionDialogFooterVariants, editableCellVariants, initialColumnVisibility, isEditableTarget, marketplaceCardVariants, matchStateVariants, memoryDashboardViewToggleButtonVariants, memoryGridVariants, memoryListItemVariants, memoryListVariants, memorySearchFilterChipVariants, mentionInputFieldVariants, mentionListItemVariants, mentionListVariants, neighbourRowId, normalizeArtifact, normalizeFromAiSdkArtifacts, normalizeFromMcpToolResult, pdfViewerFrameVariants, pdfViewerStatusVariants, pdfViewerToolbarButtonVariants, popoverPopupVariants, replyInputActionButtonVariants, replyInputContextVariants, replyInputRootVariants, replyInputTextareaVariants, saveChatAsMemoryFormButtonVariants, saveChatAsMemoryFormErrorVariants, saveChatAsMemoryFormFieldVariants, saveChatAsMemoryFormFooterVariants, saveChatAsMemoryFormRootVariants, saveTemplateModalBodyVariants, saveTemplateModalButtonVariants, saveTemplateModalErrorVariants, saveTemplateModalFieldVariants, saveTemplateModalFooterVariants, sessionCardVariants, sessionListItemVariants, sessionListVariants, skeletonVariants, splitPaneCollapseButtonVariants, splitPaneHandleVariants, splitPaneRootVariants, tagInputFieldVariants, tagInputRemoveButtonVariants, tagInputRootVariants, tagInputTagVariants, templateAgentCardBadgeVariants, templateAgentCardTagVariants, templateAgentCardVariants, templateCategoryChipVariants, templateListVariants, templateManagementRowVariants, threadIndicatorCountVariants, threadIndicatorRootVariants, threadViewEmptyVariants, threadViewRepliesVariants, threadViewReplyVariants, threadViewRootMessageVariants, threadViewRootVariants, toastCardVariants, toastDismissButtonVariants, toastProviderPositionVariants, toastTitleVariants, toggleColumnVisibility, toolToggleListRowVariants, toolToggleListSectionVariants, useBreakpoint, useDevice, useMosaicWorkspace as useEffectiveWorkspaceId, useIsDesktop, useIsMobile, useIsTablet, useMediaQuery, useMosaicWorkspace, useOrientation, useViewport, version, visibleColumns };
17106
18491
  //# sourceMappingURL=index.js.map
17107
18492
  //# sourceMappingURL=index.js.map