@vantageos/mosaic-blocks 0.5.29-alpha → 0.5.31-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.
package/dist/index.cjs CHANGED
@@ -48,7 +48,7 @@ function _interopNamespace(e) {
48
48
  var React30__namespace = /*#__PURE__*/_interopNamespace(React30);
49
49
 
50
50
  // src/version.ts
51
- var version = "0.5.29-alpha";
51
+ var version = "0.5.31-alpha";
52
52
  function Placeholder({ label = "mosaic-blocks placeholder" }) {
53
53
  return /* @__PURE__ */ jsxRuntime.jsx("div", { "data-mosaic-block": "placeholder", children: label });
54
54
  }
@@ -2569,10 +2569,14 @@ function MosaicDeviceProvider({ children }) {
2569
2569
  return /* @__PURE__ */ jsxRuntime.jsx(DeviceContext.Provider, { value, children });
2570
2570
  }
2571
2571
  MosaicDeviceProvider.displayName = "MosaicDeviceProvider";
2572
+ var DEVICE_PROVIDER_ERRORS = {
2573
+ // allow-hardcoded-word: developer-facing invariant error, never rendered to an end user
2574
+ missingProvider: "useDevice must be used within a MosaicDeviceProvider"
2575
+ };
2572
2576
  function useDevice() {
2573
2577
  const ctx = React30__namespace.useContext(DeviceContext);
2574
2578
  if (!ctx) {
2575
- throw new Error("useDevice must be used within a MosaicDeviceProvider");
2579
+ throw new Error(DEVICE_PROVIDER_ERRORS.missingProvider);
2576
2580
  }
2577
2581
  return ctx;
2578
2582
  }
@@ -3103,6 +3107,9 @@ function MosaicAppSidebar({
3103
3107
  recentItems = [],
3104
3108
  logoSlot,
3105
3109
  footerStatus,
3110
+ chevronPosition = "top",
3111
+ bottomNavItems = [],
3112
+ bottomNavAriaLabel,
3106
3113
  sidebarAriaLabel,
3107
3114
  mainNavAriaLabel,
3108
3115
  quickActionsHeading,
@@ -3132,6 +3139,21 @@ function MosaicAppSidebar({
3132
3139
  const handleNavClick = (href) => {
3133
3140
  onNavigate?.(href);
3134
3141
  };
3142
+ const collapseToggleButton = !isMobile && /* @__PURE__ */ jsxRuntime.jsx(
3143
+ "button",
3144
+ {
3145
+ type: "button",
3146
+ onClick: onToggleCollapse,
3147
+ "aria-label": isCollapsed ? expandSidebarAriaLabel : collapseSidebarAriaLabel,
3148
+ className: cn41(
3149
+ "flex h-9 w-9 items-center justify-center rounded-lg transition-colors",
3150
+ "hover:bg-sidebar-accent text-sidebar-foreground",
3151
+ "focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",
3152
+ isCollapsed && "mx-auto"
3153
+ ),
3154
+ children: isCollapsed ? /* @__PURE__ */ jsxRuntime.jsx(ChevronRightIcon, {}) : /* @__PURE__ */ jsxRuntime.jsx(ChevronLeftIcon, {})
3155
+ }
3156
+ );
3135
3157
  return /* @__PURE__ */ jsxRuntime.jsxs(
3136
3158
  "div",
3137
3159
  {
@@ -3151,21 +3173,7 @@ function MosaicAppSidebar({
3151
3173
  children: [
3152
3174
  /* @__PURE__ */ jsxRuntime.jsx("div", { className: "shrink-0 border-b border-sidebar-border p-4", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center justify-between", children: [
3153
3175
  !isCollapsed && logoSlot && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "mosaic-sidebar-label-in flex items-center gap-2 min-w-0", children: logoSlot }),
3154
- !isMobile && /* @__PURE__ */ jsxRuntime.jsx(
3155
- "button",
3156
- {
3157
- type: "button",
3158
- onClick: onToggleCollapse,
3159
- "aria-label": isCollapsed ? expandSidebarAriaLabel : collapseSidebarAriaLabel,
3160
- className: cn41(
3161
- "flex h-9 w-9 items-center justify-center rounded-lg transition-colors",
3162
- "hover:bg-sidebar-accent text-sidebar-foreground",
3163
- "focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",
3164
- isCollapsed && "mx-auto"
3165
- ),
3166
- children: isCollapsed ? /* @__PURE__ */ jsxRuntime.jsx(ChevronRightIcon, {}) : /* @__PURE__ */ jsxRuntime.jsx(ChevronLeftIcon, {})
3167
- }
3168
- )
3176
+ chevronPosition === "top" && collapseToggleButton
3169
3177
  ] }) }),
3170
3178
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex-1 overflow-y-auto p-2", style: { scrollbarWidth: "thin" }, children: [
3171
3179
  navItems.length > 0 && /* @__PURE__ */ jsxRuntime.jsx("nav", { "aria-label": mainNavAriaLabel, children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "space-y-0.5", children: navItems.map((item) => {
@@ -3278,7 +3286,48 @@ function MosaicAppSidebar({
3278
3286
  /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-sm font-medium text-sidebar-foreground", children: footerStatus.label }),
3279
3287
  footerStatus.sublabel && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-xs text-sidebar-foreground/60", children: footerStatus.sublabel })
3280
3288
  ] })
3281
- ] }) : /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex justify-center", children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex h-8 w-8 items-center justify-center rounded-lg bg-sidebar-accent/30 text-green-500", children: footerStatus.icon ?? /* @__PURE__ */ jsxRuntime.jsx(TrendingUpIcon, {}) }) }) })
3289
+ ] }) : /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex justify-center", children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex h-8 w-8 items-center justify-center rounded-lg bg-sidebar-accent/30 text-green-500", children: footerStatus.icon ?? /* @__PURE__ */ jsxRuntime.jsx(TrendingUpIcon, {}) }) }) }),
3290
+ bottomNavItems.length > 0 && /* @__PURE__ */ jsxRuntime.jsx(
3291
+ "div",
3292
+ {
3293
+ "data-slot": "app-sidebar-bottom-nav",
3294
+ className: cn41("shrink-0 border-t border-sidebar-border p-2", isCollapsed && "px-2"),
3295
+ children: /* @__PURE__ */ jsxRuntime.jsx("nav", { "aria-label": bottomNavAriaLabel, children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "space-y-0.5", children: bottomNavItems.map((item) => {
3296
+ const isActive = activePath === item.href;
3297
+ return /* @__PURE__ */ jsxRuntime.jsx(
3298
+ "button",
3299
+ {
3300
+ type: "button",
3301
+ onClick: () => handleNavClick(item.href),
3302
+ "aria-current": isActive ? "page" : void 0,
3303
+ className: cn41(
3304
+ "group flex w-full min-h-[44px] items-center rounded-lg p-3 transition-colors",
3305
+ "hover:bg-sidebar-accent",
3306
+ "focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",
3307
+ isActive && "bg-sidebar-accent",
3308
+ isCollapsed ? "justify-center" : "justify-start gap-3"
3309
+ ),
3310
+ children: isCollapsed ? /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-sidebar-foreground", title: item.label, children: item.icon ?? /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-xs font-bold", children: item.label.charAt(0) }) }) : /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
3311
+ item.icon && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-sidebar-foreground", children: item.icon }),
3312
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "mosaic-sidebar-label-in text-sm font-medium text-sidebar-foreground", children: item.label })
3313
+ ] })
3314
+ },
3315
+ item.id
3316
+ );
3317
+ }) }) })
3318
+ }
3319
+ ),
3320
+ chevronPosition === "bottom" && collapseToggleButton && /* @__PURE__ */ jsxRuntime.jsx(
3321
+ "div",
3322
+ {
3323
+ "data-slot": "app-sidebar-toggle-zone",
3324
+ className: cn41(
3325
+ "shrink-0 border-t border-sidebar-border p-2 flex",
3326
+ isCollapsed ? "justify-center" : "justify-end"
3327
+ ),
3328
+ children: collapseToggleButton
3329
+ }
3330
+ )
3282
3331
  ]
3283
3332
  }
3284
3333
  );
@@ -3821,7 +3870,16 @@ function SaveIcon() {
3821
3870
  }
3822
3871
  );
3823
3872
  }
3824
- function ModuleSlot({ label, sublabel, module, onSelect, onRemove }) {
3873
+ function ModuleSlot({
3874
+ label,
3875
+ sublabel,
3876
+ module,
3877
+ onSelect,
3878
+ onRemove,
3879
+ editAriaLabel,
3880
+ removeAriaLabel,
3881
+ selectAriaLabel
3882
+ }) {
3825
3883
  return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "rounded-xl border border-border bg-card", children: [
3826
3884
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "border-b border-border px-4 pt-4 pb-3", children: [
3827
3885
  /* @__PURE__ */ jsxRuntime.jsx("h3", { className: "text-sm font-semibold text-foreground", children: label }),
@@ -3840,7 +3898,7 @@ function ModuleSlot({ label, sublabel, module, onSelect, onRemove }) {
3840
3898
  {
3841
3899
  type: "button",
3842
3900
  onClick: onSelect,
3843
- "aria-label": `Edit ${label}`,
3901
+ "aria-label": editAriaLabel,
3844
3902
  className: "flex h-7 w-7 items-center justify-center rounded-md text-muted-foreground hover:bg-muted hover:text-foreground transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",
3845
3903
  children: /* @__PURE__ */ jsxRuntime.jsxs(
3846
3904
  "svg",
@@ -3867,7 +3925,7 @@ function ModuleSlot({ label, sublabel, module, onSelect, onRemove }) {
3867
3925
  {
3868
3926
  type: "button",
3869
3927
  onClick: onRemove,
3870
- "aria-label": `Remove ${label}`,
3928
+ "aria-label": removeAriaLabel,
3871
3929
  className: "flex h-7 w-7 items-center justify-center rounded-md text-destructive hover:bg-destructive/10 transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",
3872
3930
  children: /* @__PURE__ */ jsxRuntime.jsxs(
3873
3931
  "svg",
@@ -3895,12 +3953,11 @@ function ModuleSlot({ label, sublabel, module, onSelect, onRemove }) {
3895
3953
  {
3896
3954
  type: "button",
3897
3955
  onClick: onSelect,
3898
- "aria-label": `Select ${label}`,
3956
+ "aria-label": selectAriaLabel,
3899
3957
  className: "flex w-full min-h-[72px] items-center justify-center gap-2 rounded-lg border border-dashed border-border text-sm text-muted-foreground transition-colors hover:border-primary hover:text-primary focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",
3900
3958
  children: [
3901
3959
  /* @__PURE__ */ jsxRuntime.jsx(PlusIcon, {}),
3902
- "Select ",
3903
- label
3960
+ selectAriaLabel
3904
3961
  ]
3905
3962
  }
3906
3963
  ) })
@@ -3937,10 +3994,24 @@ function MosaicAgentComposerDesktop({
3937
3994
  previewConfigLabel,
3938
3995
  customInstructionsPreviewLabel,
3939
3996
  selectAllModulesLabel,
3940
- unnamedAgentLabel
3997
+ unnamedAgentLabel,
3998
+ roleSublabel,
3999
+ personaSublabel,
4000
+ frameworkSublabel,
4001
+ editModuleAriaLabel,
4002
+ removeModuleAriaLabel,
4003
+ selectModuleAriaLabel,
4004
+ changeModuleLabel,
4005
+ previewRequires = ["role", "persona", "framework", "model"]
3941
4006
  }) {
3942
4007
  const L = labels;
3943
- const allModulesSelected = !!selectedRole && !!selectedPersona && !!selectedFramework && !!selectedModel;
4008
+ const moduleBySlot = {
4009
+ role: selectedRole,
4010
+ persona: selectedPersona,
4011
+ framework: selectedFramework,
4012
+ model: selectedModel
4013
+ };
4014
+ const allModulesSelected = previewRequires.every((slot) => !!moduleBySlot[slot]);
3944
4015
  return /* @__PURE__ */ jsxRuntime.jsxs("div", { "data-slot": "agent-composer-desktop", className: "grid h-full grid-cols-2 gap-6", children: [
3945
4016
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-5 overflow-y-auto pr-3", children: [
3946
4017
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-2", children: [
@@ -3981,30 +4052,39 @@ function MosaicAgentComposerDesktop({
3981
4052
  ModuleSlot,
3982
4053
  {
3983
4054
  label: L.role,
3984
- sublabel: "Professional expertise and domain knowledge",
4055
+ sublabel: roleSublabel,
3985
4056
  module: selectedRole,
3986
4057
  onSelect: onSelectRole,
3987
- onRemove: onRemoveRole
4058
+ onRemove: onRemoveRole,
4059
+ editAriaLabel: editModuleAriaLabel(L.role),
4060
+ removeAriaLabel: removeModuleAriaLabel(L.role),
4061
+ selectAriaLabel: selectModuleAriaLabel(L.role)
3988
4062
  }
3989
4063
  ),
3990
4064
  /* @__PURE__ */ jsxRuntime.jsx(
3991
4065
  ModuleSlot,
3992
4066
  {
3993
4067
  label: L.persona,
3994
- sublabel: "Communication style and personality traits",
4068
+ sublabel: personaSublabel,
3995
4069
  module: selectedPersona,
3996
4070
  onSelect: onSelectPersona,
3997
- onRemove: onRemovePersona
4071
+ onRemove: onRemovePersona,
4072
+ editAriaLabel: editModuleAriaLabel(L.persona),
4073
+ removeAriaLabel: removeModuleAriaLabel(L.persona),
4074
+ selectAriaLabel: selectModuleAriaLabel(L.persona)
3998
4075
  }
3999
4076
  ),
4000
4077
  /* @__PURE__ */ jsxRuntime.jsx(
4001
4078
  ModuleSlot,
4002
4079
  {
4003
4080
  label: L.framework,
4004
- sublabel: "Thinking approach and decision-making process",
4081
+ sublabel: frameworkSublabel,
4005
4082
  module: selectedFramework,
4006
4083
  onSelect: onSelectFramework,
4007
- onRemove: onRemoveFramework
4084
+ onRemove: onRemoveFramework,
4085
+ editAriaLabel: editModuleAriaLabel(L.framework),
4086
+ removeAriaLabel: removeModuleAriaLabel(L.framework),
4087
+ selectAriaLabel: selectModuleAriaLabel(L.framework)
4008
4088
  }
4009
4089
  ),
4010
4090
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "rounded-xl border border-border bg-card", children: [
@@ -4025,16 +4105,13 @@ function MosaicAgentComposerDesktop({
4025
4105
  selectedModel.pricingLabel
4026
4106
  ] })
4027
4107
  ] }) }),
4028
- /* @__PURE__ */ jsxRuntime.jsxs(
4108
+ /* @__PURE__ */ jsxRuntime.jsx(
4029
4109
  "button",
4030
4110
  {
4031
4111
  type: "button",
4032
4112
  onClick: onSelectModel,
4033
4113
  className: "flex w-full min-h-[44px] items-center justify-center rounded-lg border border-border text-sm text-muted-foreground transition-colors hover:border-primary hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",
4034
- children: [
4035
- "Change ",
4036
- L.model
4037
- ]
4114
+ children: changeModuleLabel(L.model)
4038
4115
  }
4039
4116
  )
4040
4117
  ] }) : /* @__PURE__ */ jsxRuntime.jsxs(
@@ -4042,12 +4119,11 @@ function MosaicAgentComposerDesktop({
4042
4119
  {
4043
4120
  type: "button",
4044
4121
  onClick: onSelectModel,
4045
- "aria-label": `Select ${L.model}`,
4122
+ "aria-label": selectModuleAriaLabel(L.model),
4046
4123
  className: "flex w-full min-h-[72px] items-center justify-center gap-2 rounded-lg border border-dashed border-border text-sm text-muted-foreground transition-colors hover:border-primary hover:text-primary focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",
4047
4124
  children: [
4048
4125
  /* @__PURE__ */ jsxRuntime.jsx(PlusIcon, {}),
4049
- "Select ",
4050
- L.model
4126
+ selectModuleAriaLabel(L.model)
4051
4127
  ]
4052
4128
  }
4053
4129
  ) })
@@ -4262,7 +4338,10 @@ function MobileModuleSlot({
4262
4338
  onSelect,
4263
4339
  onRemove,
4264
4340
  isLoading,
4265
- requiredLabel
4341
+ requiredLabel,
4342
+ editAriaLabel,
4343
+ removeAriaLabel,
4344
+ selectAriaLabel
4266
4345
  }) {
4267
4346
  return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "rounded-xl border border-border bg-card", children: [
4268
4347
  /* @__PURE__ */ jsxRuntime.jsx("div", { className: "border-b border-border px-4 pt-3 pb-2", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center justify-between", children: [
@@ -4286,7 +4365,7 @@ function MobileModuleSlot({
4286
4365
  type: "button",
4287
4366
  onClick: onSelect,
4288
4367
  disabled: isLoading,
4289
- "aria-label": `Edit ${label}`,
4368
+ "aria-label": editAriaLabel,
4290
4369
  className: "flex h-8 w-8 items-center justify-center rounded-md text-muted-foreground transition-colors hover:bg-muted hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring disabled:opacity-50",
4291
4370
  children: /* @__PURE__ */ jsxRuntime.jsxs(
4292
4371
  "svg",
@@ -4314,7 +4393,7 @@ function MobileModuleSlot({
4314
4393
  type: "button",
4315
4394
  onClick: onRemove,
4316
4395
  disabled: isLoading,
4317
- "aria-label": `Remove ${label}`,
4396
+ "aria-label": removeAriaLabel,
4318
4397
  className: "flex h-8 w-8 items-center justify-center rounded-md text-destructive transition-colors hover:bg-destructive/10 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring disabled:opacity-50",
4319
4398
  children: /* @__PURE__ */ jsxRuntime.jsxs(
4320
4399
  "svg",
@@ -4343,12 +4422,11 @@ function MobileModuleSlot({
4343
4422
  type: "button",
4344
4423
  onClick: onSelect,
4345
4424
  disabled: isLoading,
4346
- "aria-label": `Select ${label}`,
4425
+ "aria-label": selectAriaLabel,
4347
4426
  className: "flex w-full min-h-[64px] items-center justify-center gap-2 rounded-lg border border-dashed border-border text-sm text-muted-foreground transition-colors hover:border-primary hover:text-primary focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring disabled:opacity-50",
4348
4427
  children: [
4349
4428
  /* @__PURE__ */ jsxRuntime.jsx(PlusIcon2, {}),
4350
- "Select ",
4351
- label
4429
+ selectAriaLabel
4352
4430
  ]
4353
4431
  }
4354
4432
  ) })
@@ -4384,7 +4462,11 @@ function MosaicAgentComposerMobile({
4384
4462
  goBackAriaLabel,
4385
4463
  savingLabel,
4386
4464
  creatingLabel,
4387
- optionalInstructionsHelp
4465
+ optionalInstructionsHelp,
4466
+ editModuleAriaLabel,
4467
+ removeModuleAriaLabel,
4468
+ selectModuleAriaLabel,
4469
+ changeModuleLabel
4388
4470
  }) {
4389
4471
  const L = labels;
4390
4472
  const instructionsId = React30__namespace.useId();
@@ -4446,7 +4528,10 @@ function MosaicAgentComposerMobile({
4446
4528
  onSelect: onSelectRole,
4447
4529
  onRemove: onRemoveRole,
4448
4530
  isLoading,
4449
- requiredLabel
4531
+ requiredLabel,
4532
+ editAriaLabel: editModuleAriaLabel(L.role),
4533
+ removeAriaLabel: removeModuleAriaLabel(L.role),
4534
+ selectAriaLabel: selectModuleAriaLabel(L.role)
4450
4535
  }
4451
4536
  ),
4452
4537
  /* @__PURE__ */ jsxRuntime.jsx(
@@ -4458,7 +4543,10 @@ function MosaicAgentComposerMobile({
4458
4543
  onSelect: onSelectPersona,
4459
4544
  onRemove: onRemovePersona,
4460
4545
  isLoading,
4461
- requiredLabel
4546
+ requiredLabel,
4547
+ editAriaLabel: editModuleAriaLabel(L.persona),
4548
+ removeAriaLabel: removeModuleAriaLabel(L.persona),
4549
+ selectAriaLabel: selectModuleAriaLabel(L.persona)
4462
4550
  }
4463
4551
  ),
4464
4552
  /* @__PURE__ */ jsxRuntime.jsx(
@@ -4470,7 +4558,10 @@ function MosaicAgentComposerMobile({
4470
4558
  onSelect: onSelectFramework,
4471
4559
  onRemove: onRemoveFramework,
4472
4560
  isLoading,
4473
- requiredLabel
4561
+ requiredLabel,
4562
+ editAriaLabel: editModuleAriaLabel(L.framework),
4563
+ removeAriaLabel: removeModuleAriaLabel(L.framework),
4564
+ selectAriaLabel: selectModuleAriaLabel(L.framework)
4474
4565
  }
4475
4566
  ),
4476
4567
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "rounded-xl border border-border bg-card", children: [
@@ -4494,17 +4585,14 @@ function MosaicAgentComposerMobile({
4494
4585
  selectedModel.pricingLabel
4495
4586
  ] })
4496
4587
  ] }) }),
4497
- /* @__PURE__ */ jsxRuntime.jsxs(
4588
+ /* @__PURE__ */ jsxRuntime.jsx(
4498
4589
  "button",
4499
4590
  {
4500
4591
  type: "button",
4501
4592
  onClick: onSelectModel,
4502
4593
  disabled: isLoading,
4503
4594
  className: "flex w-full min-h-[44px] items-center justify-center rounded-lg border border-border text-sm text-muted-foreground transition-colors hover:border-primary hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring disabled:opacity-50",
4504
- children: [
4505
- "Change ",
4506
- L.model
4507
- ]
4595
+ children: changeModuleLabel(L.model)
4508
4596
  }
4509
4597
  )
4510
4598
  ] }) : /* @__PURE__ */ jsxRuntime.jsxs(
@@ -4513,12 +4601,11 @@ function MosaicAgentComposerMobile({
4513
4601
  type: "button",
4514
4602
  onClick: onSelectModel,
4515
4603
  disabled: isLoading,
4516
- "aria-label": `Select ${L.model}`,
4604
+ "aria-label": selectModuleAriaLabel(L.model),
4517
4605
  className: "flex w-full min-h-[64px] items-center justify-center gap-2 rounded-lg border border-dashed border-border text-sm text-muted-foreground transition-colors hover:border-primary hover:text-primary focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring disabled:opacity-50",
4518
4606
  children: [
4519
4607
  /* @__PURE__ */ jsxRuntime.jsx(PlusIcon2, {}),
4520
- "Select ",
4521
- L.model
4608
+ selectModuleAriaLabel(L.model)
4522
4609
  ]
4523
4610
  }
4524
4611
  ) })
@@ -6194,6 +6281,7 @@ function MosaicQuickAgentSelector({
6194
6281
  availableAgents = [],
6195
6282
  onAddAgent,
6196
6283
  onRemoveAgent,
6284
+ removeAgentAriaLabel,
6197
6285
  onOpenBuilder,
6198
6286
  maxAgents = 4,
6199
6287
  addLabel,
@@ -6254,7 +6342,7 @@ function MosaicQuickAgentSelector({
6254
6342
  "focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring",
6255
6343
  isMobile ? "opacity-100" : "opacity-0 transition-opacity group-hover:opacity-100"
6256
6344
  ),
6257
- "aria-label": `Remove ${agent.name}`,
6345
+ "aria-label": removeAgentAriaLabel(agent.name),
6258
6346
  children: /* @__PURE__ */ jsxRuntime.jsx(XIcon, {})
6259
6347
  }
6260
6348
  )
@@ -9083,7 +9171,8 @@ function MosaicTemplatePreview({
9083
9171
  onSelect,
9084
9172
  onClose,
9085
9173
  selectLabel,
9086
- cancelLabel
9174
+ cancelLabel,
9175
+ formatAgentsHeading
9087
9176
  }) {
9088
9177
  return /* @__PURE__ */ jsxRuntime.jsxs("div", { "data-slot": "template-preview", className: "flex flex-col gap-4 p-4", children: [
9089
9178
  /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
@@ -9095,11 +9184,7 @@ function MosaicTemplatePreview({
9095
9184
  template.type && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "rounded-md border border-border px-2 py-1 text-xs text-muted-foreground", children: template.type })
9096
9185
  ] }),
9097
9186
  template.agents && template.agents.length > 0 && /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
9098
- /* @__PURE__ */ jsxRuntime.jsxs("p", { className: "mb-2 text-sm font-medium", children: [
9099
- "Agents (",
9100
- template.agents.length,
9101
- ")"
9102
- ] }),
9187
+ formatAgentsHeading && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "mb-2 text-sm font-medium", children: formatAgentsHeading(template.agents.length) }),
9103
9188
  /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex flex-wrap gap-2", children: template.agents.map((agent) => /* @__PURE__ */ jsxRuntime.jsxs(
9104
9189
  "div",
9105
9190
  {
@@ -9541,7 +9626,8 @@ function MosaicModuleForm(props) {
9541
9626
  namePlaceholder,
9542
9627
  descriptionPlaceholder,
9543
9628
  cancelLabel,
9544
- tagListAddPlaceholder
9629
+ tagListAddPlaceholder,
9630
+ removeTagAriaLabel
9545
9631
  } = props;
9546
9632
  const [formData, setFormData] = React30__namespace.useState({
9547
9633
  name: item?.name ?? "",
@@ -9713,7 +9799,7 @@ function MosaicModuleForm(props) {
9713
9799
  type: "button",
9714
9800
  onClick: () => removeTag(field.id, tag),
9715
9801
  className: "hover:text-destructive",
9716
- "aria-label": `Remove ${tag}`,
9802
+ "aria-label": removeTagAriaLabel?.(tag),
9717
9803
  children: /* @__PURE__ */ jsxRuntime.jsx(XIcon2, {})
9718
9804
  }
9719
9805
  )
@@ -9856,7 +9942,8 @@ function LibraryContent({
9856
9942
  deleteItemLabel,
9857
9943
  closeEditorAriaLabel,
9858
9944
  editModalTitle,
9859
- tagListAddPlaceholder
9945
+ tagListAddPlaceholder,
9946
+ removeTagAriaLabel
9860
9947
  }) {
9861
9948
  const [query, setQuery] = React30__namespace.useState("");
9862
9949
  const [activeTab, setActiveTab] = React30__namespace.useState(tabs?.[0]?.id ?? "all");
@@ -9970,6 +10057,7 @@ function LibraryContent({
9970
10057
  descriptionPlaceholder,
9971
10058
  cancelLabel,
9972
10059
  tagListAddPlaceholder,
10060
+ removeTagAriaLabel,
9973
10061
  ...editorMode === "edit" ? { mode: "edit", saveChangesLabel } : { mode: "create", createItemLabel }
9974
10062
  }
9975
10063
  )
@@ -9984,36 +10072,29 @@ MosaicModuleLibrary.displayName = "MosaicModuleLibrary";
9984
10072
  function cn69(...classes) {
9985
10073
  return classes.filter(Boolean).join(" ");
9986
10074
  }
9987
- var roleConfig = {
9988
- owner: {
9989
- label: "Owner",
9990
- className: "bg-primary text-primary-foreground",
9991
- description: "Full access including billing and organization deletion"
9992
- },
9993
- admin: {
9994
- label: "Admin",
9995
- className: "bg-secondary text-secondary-foreground",
9996
- description: "Full access to organization settings and member management"
9997
- },
9998
- member: {
9999
- label: "Member",
10000
- className: "bg-muted text-muted-foreground",
10001
- description: "Standard access to workspaces and content"
10002
- }
10075
+ var roleClassName = {
10076
+ owner: "bg-primary text-primary-foreground",
10077
+ admin: "bg-secondary text-secondary-foreground",
10078
+ member: "bg-muted text-muted-foreground"
10003
10079
  };
10004
- function MosaicOrgRoleBadge({ role, className }) {
10005
- const config = roleConfig[role] ?? roleConfig.member;
10080
+ function MosaicOrgRoleBadge({
10081
+ role,
10082
+ label,
10083
+ description,
10084
+ className
10085
+ }) {
10086
+ const config = roleClassName[role] ?? roleClassName.member;
10006
10087
  return /* @__PURE__ */ jsxRuntime.jsx(
10007
10088
  "span",
10008
10089
  {
10009
10090
  "data-slot": "org-role-badge",
10010
- title: config.description,
10091
+ title: description,
10011
10092
  className: cn69(
10012
10093
  "inline-flex items-center rounded-full px-2 py-0.5 text-xs font-medium",
10013
- config.className,
10094
+ config,
10014
10095
  className
10015
10096
  ),
10016
- children: config.label
10097
+ children: label
10017
10098
  }
10018
10099
  );
10019
10100
  }
@@ -10083,7 +10164,10 @@ function MosaicCreateOrgDialog({
10083
10164
  descriptionPlaceholder,
10084
10165
  cancelLabel,
10085
10166
  creatingLabel,
10086
- createLabel
10167
+ createLabel,
10168
+ nameRequiredMessage,
10169
+ slugRequiredMessage,
10170
+ slugFormatMessage
10087
10171
  }) {
10088
10172
  const [name, setName] = React30__namespace.useState("");
10089
10173
  const [slug, setSlug] = React30__namespace.useState("");
@@ -10091,10 +10175,9 @@ function MosaicCreateOrgDialog({
10091
10175
  const [errors, setErrors] = React30__namespace.useState({});
10092
10176
  const validate = () => {
10093
10177
  const errs = {};
10094
- if (!name.trim()) errs.name = "Name is required";
10095
- if (!slug.trim()) errs.slug = "Slug is required";
10096
- else if (!/^[a-z0-9-]+$/.test(slug))
10097
- errs.slug = "Slug: lowercase letters, numbers, hyphens only";
10178
+ if (!name.trim()) errs.name = true;
10179
+ if (!slug.trim()) errs.slug = "required";
10180
+ else if (!/^[a-z0-9-]+$/.test(slug)) errs.slug = "format";
10098
10181
  setErrors(errs);
10099
10182
  return Object.keys(errs).length === 0;
10100
10183
  };
@@ -10153,7 +10236,7 @@ function MosaicCreateOrgDialog({
10153
10236
  )
10154
10237
  }
10155
10238
  ),
10156
- errors.name && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-xs text-destructive", children: errors.name })
10239
+ errors.name && nameRequiredMessage && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-xs text-destructive", children: nameRequiredMessage })
10157
10240
  ] }),
10158
10241
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-1.5", children: [
10159
10242
  /* @__PURE__ */ jsxRuntime.jsx("label", { htmlFor: "org-slug", className: "text-sm font-medium", children: slugFieldLabel }),
@@ -10173,7 +10256,8 @@ function MosaicCreateOrgDialog({
10173
10256
  )
10174
10257
  }
10175
10258
  ),
10176
- errors.slug && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-xs text-destructive", children: errors.slug })
10259
+ errors.slug === "required" && slugRequiredMessage && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-xs text-destructive", children: slugRequiredMessage }),
10260
+ errors.slug === "format" && slugFormatMessage && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-xs text-destructive", children: slugFormatMessage })
10177
10261
  ] }),
10178
10262
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-1.5", children: [
10179
10263
  /* @__PURE__ */ jsxRuntime.jsx("label", { htmlFor: "org-desc", className: "text-sm font-medium", children: descriptionFieldLabel }),
@@ -10216,16 +10300,12 @@ function MosaicCreateOrgDialog({
10216
10300
  );
10217
10301
  }
10218
10302
  MosaicCreateOrgDialog.displayName = "MosaicCreateOrgDialog";
10219
- var DEFAULT_ROLES = [
10220
- { value: "admin", label: "Admin" },
10221
- { value: "member", label: "Member" }
10222
- ];
10223
10303
  function MosaicInviteMemberDialog({
10224
10304
  open,
10225
10305
  onOpenChange,
10226
10306
  onInvite,
10227
10307
  isLoading = false,
10228
- roles = DEFAULT_ROLES,
10308
+ roles,
10229
10309
  title,
10230
10310
  closeAriaLabel,
10231
10311
  emailFieldLabel,
@@ -10233,15 +10313,17 @@ function MosaicInviteMemberDialog({
10233
10313
  roleFieldLabel,
10234
10314
  cancelLabel,
10235
10315
  sendingLabel,
10236
- sendInvitationLabel
10316
+ sendInvitationLabel,
10317
+ emailRequiredMessage,
10318
+ emailInvalidMessage
10237
10319
  }) {
10238
10320
  const [email, setEmail] = React30__namespace.useState("");
10239
10321
  const [role, setRole] = React30__namespace.useState("member");
10240
10322
  const [errors, setErrors] = React30__namespace.useState({});
10241
10323
  const validate = () => {
10242
10324
  const errs = {};
10243
- if (!email.trim()) errs.email = "Email is required";
10244
- else if (!/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(email)) errs.email = "Invalid email";
10325
+ if (!email.trim()) errs.email = "required";
10326
+ else if (!/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(email)) errs.email = "invalid";
10245
10327
  setErrors(errs);
10246
10328
  return Object.keys(errs).length === 0;
10247
10329
  };
@@ -10286,7 +10368,8 @@ function MosaicInviteMemberDialog({
10286
10368
  )
10287
10369
  }
10288
10370
  ),
10289
- errors.email && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-xs text-destructive", children: errors.email })
10371
+ errors.email === "required" && emailRequiredMessage && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-xs text-destructive", children: emailRequiredMessage }),
10372
+ errors.email === "invalid" && emailInvalidMessage && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-xs text-destructive", children: emailInvalidMessage })
10290
10373
  ] }),
10291
10374
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-1.5", children: [
10292
10375
  /* @__PURE__ */ jsxRuntime.jsx("label", { htmlFor: "invite-role", className: "text-sm font-medium", children: roleFieldLabel }),
@@ -10336,7 +10419,11 @@ function MemberRow({
10336
10419
  roles,
10337
10420
  youLabel,
10338
10421
  memberActionsAriaLabel,
10339
- removeMemberLabel
10422
+ removeMemberLabel,
10423
+ roleDescriptions,
10424
+ roleLabels,
10425
+ joinedLabel,
10426
+ makeRoleLabel
10340
10427
  }) {
10341
10428
  const [menuOpen, setMenuOpen] = React30__namespace.useState(false);
10342
10429
  const menuRef = React30__namespace.useRef(null);
@@ -10366,12 +10453,16 @@ function MemberRow({
10366
10453
  isSelf && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "shrink-0 rounded-full bg-muted px-1.5 py-0.5 text-[10px] text-muted-foreground", children: youLabel })
10367
10454
  ] }),
10368
10455
  /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-xs text-muted-foreground truncate", children: member.email }),
10369
- joinedDate && /* @__PURE__ */ jsxRuntime.jsxs("p", { className: "text-xs text-muted-foreground", children: [
10370
- "Joined ",
10371
- joinedDate
10372
- ] })
10456
+ joinedDate && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-xs text-muted-foreground", children: joinedLabel(joinedDate) })
10373
10457
  ] }),
10374
- /* @__PURE__ */ jsxRuntime.jsx(MosaicOrgRoleBadge, { role: member.role }),
10458
+ /* @__PURE__ */ jsxRuntime.jsx(
10459
+ MosaicOrgRoleBadge,
10460
+ {
10461
+ role: member.role,
10462
+ label: roleLabels[member.role],
10463
+ description: roleDescriptions[member.role]
10464
+ }
10465
+ ),
10375
10466
  !isSelf && (onChangeRole || onRemoveMember) && /* @__PURE__ */ jsxRuntime.jsxs("div", { ref: menuRef, className: "relative shrink-0", children: [
10376
10467
  /* @__PURE__ */ jsxRuntime.jsx(
10377
10468
  "button",
@@ -10409,7 +10500,7 @@ function MemberRow({
10409
10500
  className: "absolute right-0 top-full z-50 mt-1 min-w-[160px] rounded-md border border-border bg-popover py-1 shadow-md",
10410
10501
  children: [
10411
10502
  onChangeRole && roles?.map(
10412
- (r) => r.value !== member.role && /* @__PURE__ */ jsxRuntime.jsxs(
10503
+ (r) => r.value !== member.role && /* @__PURE__ */ jsxRuntime.jsx(
10413
10504
  "button",
10414
10505
  {
10415
10506
  type: "button",
@@ -10419,10 +10510,7 @@ function MemberRow({
10419
10510
  setMenuOpen(false);
10420
10511
  },
10421
10512
  className: "flex w-full items-center gap-2 px-3 py-2 text-sm text-foreground hover:bg-accent hover:text-accent-foreground",
10422
- children: [
10423
- "Make ",
10424
- r.label
10425
- ]
10513
+ children: makeRoleLabel(r.label)
10426
10514
  },
10427
10515
  r.value
10428
10516
  )
@@ -10452,7 +10540,7 @@ function MosaicMemberList({
10452
10540
  onChangeRole,
10453
10541
  onRemoveMember,
10454
10542
  onInvite,
10455
- roles = DEFAULT_ROLES,
10543
+ roles,
10456
10544
  isLoading,
10457
10545
  searchPlaceholder,
10458
10546
  youLabel,
@@ -10460,6 +10548,10 @@ function MosaicMemberList({
10460
10548
  removeMemberLabel,
10461
10549
  emptyMessage,
10462
10550
  inviteLabel,
10551
+ roleDescriptions,
10552
+ roleLabels,
10553
+ joinedLabel,
10554
+ makeRoleLabel,
10463
10555
  className
10464
10556
  }) {
10465
10557
  const [query, setQuery] = React30__namespace.useState("");
@@ -10532,7 +10624,7 @@ function MosaicMemberList({
10532
10624
  }
10533
10625
  )
10534
10626
  ] }),
10535
- isLoading ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "space-y-3", children: [0, 1, 2].map((i) => /* @__PURE__ */ jsxRuntime.jsx("div", { className: "h-14 animate-pulse rounded-lg bg-muted" }, i)) }) : /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "divide-y divide-border", children: [
10627
+ isLoading ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "space-y-3", children: ["skeleton-1", "skeleton-2", "skeleton-3"].map((skeletonId) => /* @__PURE__ */ jsxRuntime.jsx("div", { className: "h-14 animate-pulse rounded-lg bg-muted" }, skeletonId)) }) : /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "divide-y divide-border", children: [
10536
10628
  filtered.map((member) => /* @__PURE__ */ jsxRuntime.jsx(
10537
10629
  MemberRow,
10538
10630
  {
@@ -10543,7 +10635,11 @@ function MosaicMemberList({
10543
10635
  roles,
10544
10636
  youLabel,
10545
10637
  memberActionsAriaLabel,
10546
- removeMemberLabel
10638
+ removeMemberLabel,
10639
+ roleDescriptions,
10640
+ roleLabels,
10641
+ joinedLabel,
10642
+ makeRoleLabel
10547
10643
  },
10548
10644
  member.id
10549
10645
  )),
@@ -10742,6 +10838,7 @@ function MosaicDashboardHeader({
10742
10838
  subtitle,
10743
10839
  notificationCount = 0,
10744
10840
  onNotificationsClick,
10841
+ notificationsAriaLabel,
10745
10842
  onSearchChange,
10746
10843
  actions,
10747
10844
  logoSlot,
@@ -10810,7 +10907,7 @@ function MosaicDashboardHeader({
10810
10907
  type: "button",
10811
10908
  onClick: onNotificationsClick,
10812
10909
  className: "relative inline-flex h-8 w-8 items-center justify-center rounded-md text-muted-foreground hover:bg-accent hover:text-accent-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",
10813
- "aria-label": `Notifications${notificationCount > 0 ? ` (${notificationCount})` : ""}`,
10910
+ "aria-label": notificationsAriaLabel?.(notificationCount),
10814
10911
  children: [
10815
10912
  /* @__PURE__ */ jsxRuntime.jsx(BellIcon, {}),
10816
10913
  notificationCount > 0 && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "absolute -right-1 -top-1 flex h-4 w-4 items-center justify-center rounded-full bg-primary text-[10px] font-bold text-primary-foreground", children: notificationCount > 9 ? "9+" : notificationCount })
@@ -12467,9 +12564,11 @@ function MosaicChatThread({
12467
12564
  children,
12468
12565
  scrollToBottomLabel,
12469
12566
  className,
12470
- ref
12567
+ ref,
12568
+ onVisibleRangeChange
12471
12569
  }) {
12472
12570
  const containerRef = React30.useRef(null);
12571
+ const contentRef = React30.useRef(null);
12473
12572
  const isAtBottomRef = React30.useRef(true);
12474
12573
  const [isAtBottom, setIsAtBottom] = React30.useState(true);
12475
12574
  function setRefs(node) {
@@ -12525,6 +12624,37 @@ function MosaicChatThread({
12525
12624
  document.removeEventListener("selectionchange", handleSelectionChange);
12526
12625
  };
12527
12626
  }, []);
12627
+ React30.useEffect(() => {
12628
+ if (!onVisibleRangeChange) {
12629
+ return;
12630
+ }
12631
+ const content = contentRef.current;
12632
+ if (!content) {
12633
+ return;
12634
+ }
12635
+ const visibility = /* @__PURE__ */ new Map();
12636
+ const observer = new IntersectionObserver((entries) => {
12637
+ for (const entry of entries) {
12638
+ visibility.set(entry.target, entry.isIntersecting);
12639
+ }
12640
+ const visibleMessageIds = [];
12641
+ for (const child of Array.from(content.children)) {
12642
+ if (child.id && visibility.get(child)) {
12643
+ visibleMessageIds.push(child.id);
12644
+ }
12645
+ }
12646
+ onVisibleRangeChange({
12647
+ visibleMessageIds,
12648
+ currentAnchorId: visibleMessageIds[0] ?? null
12649
+ });
12650
+ });
12651
+ for (const child of Array.from(content.children)) {
12652
+ observer.observe(child);
12653
+ }
12654
+ return () => {
12655
+ observer.disconnect();
12656
+ };
12657
+ }, [children, onVisibleRangeChange]);
12528
12658
  React30.useLayoutEffect(() => {
12529
12659
  const element = containerRef.current;
12530
12660
  if (element && isAtBottomRef.current) {
@@ -12541,7 +12671,7 @@ function MosaicChatThread({
12541
12671
  onKeyDown: handleKeyDown,
12542
12672
  className: cn80(chatThreadRootVariants(), className),
12543
12673
  children: [
12544
- /* @__PURE__ */ jsxRuntime.jsx("div", { "data-slot": "chat-thread-content", className: chatThreadContentVariants(), children }),
12674
+ /* @__PURE__ */ jsxRuntime.jsx("div", { ref: contentRef, "data-slot": "chat-thread-content", className: chatThreadContentVariants(), children }),
12545
12675
  !isAtBottom && /* @__PURE__ */ jsxRuntime.jsx(
12546
12676
  "button",
12547
12677
  {
@@ -15823,6 +15953,962 @@ function MosaicMemorySearch({
15823
15953
  ] });
15824
15954
  }
15825
15955
  MosaicMemorySearch.displayName = "MosaicMemorySearch";
15956
+ var replyInputRootVariants = classVarianceAuthority.cva([
15957
+ "min-w-0 rounded-[14px] border border-border bg-card shadow-sm transition-colors",
15958
+ "focus-within:ring-[1px] focus-within:ring-ring"
15959
+ ]);
15960
+ var replyInputContextVariants = classVarianceAuthority.cva([
15961
+ "truncate border-border border-b px-3 py-2 text-muted-foreground text-xs"
15962
+ ]);
15963
+ var replyInputTextareaVariants = classVarianceAuthority.cva([
15964
+ "max-h-40 min-h-12 w-full resize-none bg-transparent px-3 pt-3 pb-1 text-sm outline-none",
15965
+ "placeholder:text-muted-foreground disabled:cursor-not-allowed disabled:opacity-60"
15966
+ ]);
15967
+ var replyInputActionButtonVariants = classVarianceAuthority.cva(
15968
+ [
15969
+ "inline-flex h-7 shrink-0 items-center justify-center rounded-md px-2.5 text-xs transition-colors",
15970
+ "disabled:cursor-not-allowed disabled:opacity-30"
15971
+ ],
15972
+ {
15973
+ variants: {
15974
+ tone: {
15975
+ send: "bg-foreground text-background hover:bg-foreground/90",
15976
+ cancel: "bg-foreground/10 text-foreground hover:bg-foreground/20"
15977
+ }
15978
+ },
15979
+ defaultVariants: {
15980
+ tone: "send"
15981
+ }
15982
+ }
15983
+ );
15984
+ function cn105(...classes) {
15985
+ return classes.filter(Boolean).join(" ");
15986
+ }
15987
+ function MosaicReplyInput(props) {
15988
+ const {
15989
+ value,
15990
+ onValueChange,
15991
+ onSubmit,
15992
+ onCancel,
15993
+ context,
15994
+ contextAriaLabel,
15995
+ textareaAriaLabel,
15996
+ placeholder,
15997
+ sendButtonAriaLabel,
15998
+ cancelButtonAriaLabel,
15999
+ disabled = false,
16000
+ className,
16001
+ ref
16002
+ } = props;
16003
+ const textareaRef = React30.useRef(null);
16004
+ const trimmedValue = value.trim();
16005
+ React30.useEffect(() => {
16006
+ const textarea = textareaRef.current;
16007
+ if (!textarea) {
16008
+ return;
16009
+ }
16010
+ textarea.style.height = "auto";
16011
+ textarea.style.height = `${textarea.scrollHeight}px`;
16012
+ }, [value]);
16013
+ const submitValue = React30.useCallback(() => {
16014
+ const text = value.trim();
16015
+ if (!text || disabled) {
16016
+ return;
16017
+ }
16018
+ onSubmit(text);
16019
+ }, [disabled, onSubmit, value]);
16020
+ const handleSubmit = React30.useCallback(
16021
+ (event) => {
16022
+ event.preventDefault();
16023
+ submitValue();
16024
+ },
16025
+ [submitValue]
16026
+ );
16027
+ const handleKeyDown = React30.useCallback(
16028
+ (event) => {
16029
+ if (event.key === "Enter" && !event.shiftKey) {
16030
+ event.preventDefault();
16031
+ submitValue();
16032
+ }
16033
+ },
16034
+ [submitValue]
16035
+ );
16036
+ return /* @__PURE__ */ jsxRuntime.jsxs(
16037
+ "form",
16038
+ {
16039
+ ref,
16040
+ "data-slot": "reply-input",
16041
+ className: cn105(replyInputRootVariants(), className),
16042
+ onSubmit: handleSubmit,
16043
+ children: [
16044
+ /* @__PURE__ */ jsxRuntime.jsx(
16045
+ "div",
16046
+ {
16047
+ "aria-label": contextAriaLabel,
16048
+ className: replyInputContextVariants(),
16049
+ "data-slot": "reply-input-context",
16050
+ children: context
16051
+ }
16052
+ ),
16053
+ /* @__PURE__ */ jsxRuntime.jsx(
16054
+ "textarea",
16055
+ {
16056
+ "data-slot": "reply-input-textarea",
16057
+ "aria-label": textareaAriaLabel,
16058
+ className: replyInputTextareaVariants(),
16059
+ disabled,
16060
+ onChange: (event) => onValueChange(event.target.value),
16061
+ onKeyDown: handleKeyDown,
16062
+ placeholder,
16063
+ ref: textareaRef,
16064
+ rows: 1,
16065
+ value
16066
+ }
16067
+ ),
16068
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex min-h-9 items-center justify-end gap-2 px-3 pt-1 pb-2", children: [
16069
+ /* @__PURE__ */ jsxRuntime.jsx(
16070
+ "button",
16071
+ {
16072
+ "aria-label": cancelButtonAriaLabel,
16073
+ className: replyInputActionButtonVariants({ tone: "cancel" }),
16074
+ "data-slot": "reply-input-cancel-button",
16075
+ disabled,
16076
+ onClick: onCancel,
16077
+ type: "button",
16078
+ children: /* @__PURE__ */ jsxRuntime.jsx("span", { "aria-hidden": "true", children: "\xD7" })
16079
+ }
16080
+ ),
16081
+ /* @__PURE__ */ jsxRuntime.jsx(
16082
+ "button",
16083
+ {
16084
+ "aria-label": sendButtonAriaLabel,
16085
+ className: replyInputActionButtonVariants({ tone: "send" }),
16086
+ "data-slot": "reply-input-send-button",
16087
+ disabled: disabled || trimmedValue.length === 0,
16088
+ type: "submit",
16089
+ children: /* @__PURE__ */ jsxRuntime.jsx("span", { "aria-hidden": "true", children: "\u2191" })
16090
+ }
16091
+ )
16092
+ ] })
16093
+ ]
16094
+ }
16095
+ );
16096
+ }
16097
+ MosaicReplyInput.displayName = "MosaicReplyInput";
16098
+ var threadViewRootVariants = classVarianceAuthority.cva(["flex min-w-0 flex-col gap-3"]);
16099
+ var threadViewRootMessageVariants = classVarianceAuthority.cva([
16100
+ "rounded-lg border border-border bg-card p-4 shadow-sm"
16101
+ ]);
16102
+ var threadViewRepliesVariants = classVarianceAuthority.cva(["flex flex-col gap-2 border-border border-l-2 pl-4"]);
16103
+ var threadViewReplyVariants = classVarianceAuthority.cva([
16104
+ "rounded-lg border border-border bg-muted/40 p-3 text-sm"
16105
+ ]);
16106
+ var threadViewEmptyVariants = classVarianceAuthority.cva(["px-1 py-2 text-muted-foreground text-sm"]);
16107
+ function cn106(...classes) {
16108
+ return classes.filter(Boolean).join(" ");
16109
+ }
16110
+ function MosaicThreadView(props) {
16111
+ const { root, replies, rootAriaLabel, repliesAriaLabel, emptyRepliesLabel, className, ref } = props;
16112
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { ref, "data-slot": "thread-view", className: cn106(threadViewRootVariants(), className), children: [
16113
+ /* @__PURE__ */ jsxRuntime.jsxs(
16114
+ "div",
16115
+ {
16116
+ "aria-label": rootAriaLabel,
16117
+ className: threadViewRootMessageVariants(),
16118
+ "data-slot": "thread-view-root",
16119
+ children: [
16120
+ root.author,
16121
+ root.content
16122
+ ]
16123
+ }
16124
+ ),
16125
+ /* @__PURE__ */ jsxRuntime.jsx(
16126
+ "div",
16127
+ {
16128
+ "aria-label": repliesAriaLabel,
16129
+ className: threadViewRepliesVariants(),
16130
+ "data-slot": "thread-view-replies",
16131
+ children: replies.length === 0 ? /* @__PURE__ */ jsxRuntime.jsx("p", { className: threadViewEmptyVariants(), "data-slot": "thread-view-empty", children: emptyRepliesLabel }) : replies.map((reply) => /* @__PURE__ */ jsxRuntime.jsxs("div", { className: threadViewReplyVariants(), "data-slot": "thread-view-reply", children: [
16132
+ reply.author,
16133
+ reply.content
16134
+ ] }, reply.id))
16135
+ }
16136
+ )
16137
+ ] });
16138
+ }
16139
+ MosaicThreadView.displayName = "MosaicThreadView";
16140
+ var threadIndicatorRootVariants = classVarianceAuthority.cva([
16141
+ "inline-flex items-center gap-1.5 rounded-md px-2 py-1 text-xs transition-colors",
16142
+ "hover:bg-accent hover:text-accent-foreground",
16143
+ "focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring",
16144
+ "disabled:cursor-not-allowed disabled:opacity-60"
16145
+ ]);
16146
+ var threadIndicatorCountVariants = classVarianceAuthority.cva([
16147
+ "inline-flex min-w-4 items-center justify-center rounded-full px-1.5 py-0.5",
16148
+ "bg-primary text-primary-foreground text-[10px] font-semibold leading-none"
16149
+ ]);
16150
+ function cn107(...classes) {
16151
+ return classes.filter(Boolean).join(" ");
16152
+ }
16153
+ function MosaicThreadIndicator(props) {
16154
+ const { replies, label, ariaLabel, onActivate, disabled = false, className, ref } = props;
16155
+ const unreadCount = replies.filter((reply) => reply.unread).length;
16156
+ return /* @__PURE__ */ jsxRuntime.jsxs(
16157
+ "button",
16158
+ {
16159
+ ref,
16160
+ "data-slot": "thread-indicator",
16161
+ type: "button",
16162
+ "aria-label": ariaLabel(unreadCount),
16163
+ className: cn107(threadIndicatorRootVariants(), className),
16164
+ disabled,
16165
+ onClick: onActivate,
16166
+ children: [
16167
+ /* @__PURE__ */ jsxRuntime.jsx("span", { "data-slot": "thread-indicator-label", children: label }),
16168
+ unreadCount > 0 && /* @__PURE__ */ jsxRuntime.jsx(
16169
+ "span",
16170
+ {
16171
+ "data-slot": "thread-indicator-count",
16172
+ "data-testid": "thread-indicator-count",
16173
+ className: threadIndicatorCountVariants(),
16174
+ children: unreadCount
16175
+ }
16176
+ )
16177
+ ]
16178
+ }
16179
+ );
16180
+ }
16181
+ MosaicThreadIndicator.displayName = "MosaicThreadIndicator";
16182
+ var mentionInputFieldVariants = classVarianceAuthority.cva([
16183
+ "flex w-full rounded-md border border-input bg-transparent px-3 py-2 text-sm shadow-sm",
16184
+ "outline-none transition-colors placeholder:text-muted-foreground",
16185
+ "focus-visible:ring-1 focus-visible:ring-ring",
16186
+ "disabled:cursor-not-allowed disabled:opacity-50"
16187
+ ]);
16188
+ var mentionListVariants = classVarianceAuthority.cva(["m-0 max-h-64 list-none overflow-y-auto p-1"]);
16189
+ var mentionListItemVariants = classVarianceAuthority.cva(
16190
+ ["cursor-pointer rounded-sm px-2 py-1.5 text-sm outline-none"],
16191
+ {
16192
+ variants: {
16193
+ active: {
16194
+ true: "bg-accent text-accent-foreground",
16195
+ false: ""
16196
+ }
16197
+ },
16198
+ defaultVariants: {
16199
+ active: false
16200
+ }
16201
+ }
16202
+ );
16203
+ function cn108(...classes) {
16204
+ return classes.filter(Boolean).join(" ");
16205
+ }
16206
+ function findMentionStart(text, cursor, trigger) {
16207
+ for (let i = cursor - 1; i >= 0; i--) {
16208
+ const char = text[i];
16209
+ if (char === trigger) {
16210
+ return i;
16211
+ }
16212
+ if (/\s/.test(char)) {
16213
+ return null;
16214
+ }
16215
+ }
16216
+ return null;
16217
+ }
16218
+ function MosaicMentionInput({
16219
+ value,
16220
+ onValueChange,
16221
+ triggerCharacter,
16222
+ entries,
16223
+ renderEntry,
16224
+ getEntryText,
16225
+ onQueryChange,
16226
+ onSelectEntry,
16227
+ inputAriaLabel,
16228
+ listAriaLabel,
16229
+ emptyMessage,
16230
+ className,
16231
+ inputClassName
16232
+ }) {
16233
+ const inputRef = React30.useRef(null);
16234
+ const [mentionStart, setMentionStart] = React30.useState(null);
16235
+ const [activeIndex, setActiveIndex] = React30.useState(0);
16236
+ const open = mentionStart !== null;
16237
+ function closeMention() {
16238
+ setMentionStart(null);
16239
+ setActiveIndex(0);
16240
+ onQueryChange(null);
16241
+ }
16242
+ function handleChange(event) {
16243
+ const nextValue = event.target.value;
16244
+ const cursor = event.target.selectionStart ?? nextValue.length;
16245
+ onValueChange(nextValue);
16246
+ const start = findMentionStart(nextValue, cursor, triggerCharacter);
16247
+ if (start === null) {
16248
+ if (open) {
16249
+ closeMention();
16250
+ }
16251
+ return;
16252
+ }
16253
+ setMentionStart(start);
16254
+ setActiveIndex(0);
16255
+ onQueryChange(nextValue.slice(start + triggerCharacter.length, cursor));
16256
+ }
16257
+ function selectEntry(entry) {
16258
+ if (mentionStart === null || !inputRef.current) {
16259
+ return;
16260
+ }
16261
+ const cursor = inputRef.current.selectionStart ?? value.length;
16262
+ const insertText = getEntryText(entry);
16263
+ const nextValue = `${value.slice(0, mentionStart)}${insertText} ${value.slice(cursor)}`;
16264
+ onValueChange(nextValue);
16265
+ onSelectEntry?.(entry);
16266
+ closeMention();
16267
+ }
16268
+ function handleKeyDown(event) {
16269
+ if (!open) {
16270
+ return;
16271
+ }
16272
+ if (event.key === "Escape") {
16273
+ event.preventDefault();
16274
+ closeMention();
16275
+ return;
16276
+ }
16277
+ if (event.key === "ArrowDown") {
16278
+ event.preventDefault();
16279
+ setActiveIndex((index) => Math.min(entries.length - 1, index + 1));
16280
+ return;
16281
+ }
16282
+ if (event.key === "ArrowUp") {
16283
+ event.preventDefault();
16284
+ setActiveIndex((index) => Math.max(0, index - 1));
16285
+ return;
16286
+ }
16287
+ if (event.key === "Enter") {
16288
+ const entry = entries[activeIndex];
16289
+ if (entry) {
16290
+ event.preventDefault();
16291
+ selectEntry(entry);
16292
+ }
16293
+ }
16294
+ }
16295
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { "data-slot": "mention-input", className, children: [
16296
+ /* @__PURE__ */ jsxRuntime.jsx(
16297
+ "input",
16298
+ {
16299
+ ref: inputRef,
16300
+ type: "text",
16301
+ "aria-label": inputAriaLabel,
16302
+ value,
16303
+ onChange: handleChange,
16304
+ onKeyDown: handleKeyDown,
16305
+ className: cn108(mentionInputFieldVariants(), inputClassName)
16306
+ }
16307
+ ),
16308
+ /* @__PURE__ */ jsxRuntime.jsx(
16309
+ MosaicPopover,
16310
+ {
16311
+ open,
16312
+ onOpenChange: (nextOpen) => {
16313
+ if (!nextOpen) {
16314
+ closeMention();
16315
+ }
16316
+ },
16317
+ anchor: inputRef,
16318
+ initialFocus: false,
16319
+ "aria-label": listAriaLabel,
16320
+ children: entries.length === 0 ? /* @__PURE__ */ jsxRuntime.jsx("p", { "data-slot": "mention-input-empty", className: "px-2 py-1.5 text-sm text-muted-foreground", children: emptyMessage }) : /* @__PURE__ */ jsxRuntime.jsx("ul", { "data-slot": "mention-input-list", className: mentionListVariants(), children: entries.map((entry, index) => /* @__PURE__ */ jsxRuntime.jsx(
16321
+ "li",
16322
+ {
16323
+ "data-slot": "mention-input-item",
16324
+ "aria-selected": index === activeIndex,
16325
+ className: mentionListItemVariants({ active: index === activeIndex }),
16326
+ onMouseEnter: () => setActiveIndex(index),
16327
+ onClick: () => selectEntry(entry),
16328
+ onKeyDown: (event) => {
16329
+ if (event.key === "Enter" || event.key === " ") {
16330
+ event.preventDefault();
16331
+ selectEntry(entry);
16332
+ }
16333
+ },
16334
+ children: renderEntry(entry, index, index === activeIndex)
16335
+ },
16336
+ entry.id
16337
+ )) })
16338
+ }
16339
+ )
16340
+ ] });
16341
+ }
16342
+ MosaicMentionInput.displayName = "MosaicMentionInput";
16343
+ function cn109(...classes) {
16344
+ return classes.filter(Boolean).join(" ");
16345
+ }
16346
+ function SearchIcon9() {
16347
+ return /* @__PURE__ */ jsxRuntime.jsxs(
16348
+ "svg",
16349
+ {
16350
+ xmlns: "http://www.w3.org/2000/svg",
16351
+ width: "16",
16352
+ height: "16",
16353
+ viewBox: "0 0 24 24",
16354
+ fill: "none",
16355
+ stroke: "currentColor",
16356
+ strokeWidth: "2",
16357
+ strokeLinecap: "round",
16358
+ strokeLinejoin: "round",
16359
+ "aria-hidden": "true",
16360
+ children: [
16361
+ /* @__PURE__ */ jsxRuntime.jsx("circle", { cx: "11", cy: "11", r: "8" }),
16362
+ /* @__PURE__ */ jsxRuntime.jsx("line", { x1: "21", y1: "21", x2: "16.65", y2: "16.65" })
16363
+ ]
16364
+ }
16365
+ );
16366
+ }
16367
+ function ClearIcon2() {
16368
+ return /* @__PURE__ */ jsxRuntime.jsxs(
16369
+ "svg",
16370
+ {
16371
+ xmlns: "http://www.w3.org/2000/svg",
16372
+ width: "14",
16373
+ height: "14",
16374
+ viewBox: "0 0 24 24",
16375
+ fill: "none",
16376
+ stroke: "currentColor",
16377
+ strokeWidth: "2",
16378
+ strokeLinecap: "round",
16379
+ strokeLinejoin: "round",
16380
+ "aria-hidden": "true",
16381
+ children: [
16382
+ /* @__PURE__ */ jsxRuntime.jsx("line", { x1: "18", y1: "6", x2: "6", y2: "18" }),
16383
+ /* @__PURE__ */ jsxRuntime.jsx("line", { x1: "6", y1: "6", x2: "18", y2: "18" })
16384
+ ]
16385
+ }
16386
+ );
16387
+ }
16388
+ function MosaicMessageSearch({
16389
+ query,
16390
+ onQueryChange,
16391
+ searchLabel,
16392
+ searchPlaceholder,
16393
+ clearButtonLabel,
16394
+ resultsSlot,
16395
+ emptyResultsLabel,
16396
+ className,
16397
+ ref
16398
+ }) {
16399
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { ref, "data-slot": "message-search", className: cn109("flex flex-col gap-2", className), children: [
16400
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "relative", children: [
16401
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "absolute left-3 top-1/2 -translate-y-1/2 text-muted-foreground", children: /* @__PURE__ */ jsxRuntime.jsx(SearchIcon9, {}) }),
16402
+ /* @__PURE__ */ jsxRuntime.jsx(
16403
+ MosaicInput,
16404
+ {
16405
+ type: "search",
16406
+ "aria-label": searchLabel,
16407
+ placeholder: searchPlaceholder,
16408
+ value: query,
16409
+ onChange: (event) => onQueryChange(event.target.value),
16410
+ className: "pl-9 pr-9"
16411
+ }
16412
+ ),
16413
+ query.length > 0 && /* @__PURE__ */ jsxRuntime.jsx(
16414
+ "button",
16415
+ {
16416
+ type: "button",
16417
+ "aria-label": clearButtonLabel,
16418
+ onClick: () => onQueryChange(""),
16419
+ className: cn109(
16420
+ "absolute right-2 top-1/2 -translate-y-1/2",
16421
+ "flex size-5 items-center justify-center rounded-full",
16422
+ "text-muted-foreground hover:bg-muted hover:text-foreground",
16423
+ "focus-visible:outline-none focus-visible:ring-ring focus-visible:ring-[3px]"
16424
+ ),
16425
+ children: /* @__PURE__ */ jsxRuntime.jsx(ClearIcon2, {})
16426
+ }
16427
+ )
16428
+ ] }),
16429
+ resultsSlot ? /* @__PURE__ */ jsxRuntime.jsx("div", { "data-slot": "message-search-results", children: resultsSlot }) : emptyResultsLabel && /* @__PURE__ */ jsxRuntime.jsx("p", { "data-slot": "message-search-results", className: "text-sm text-muted-foreground", children: emptyResultsLabel })
16430
+ ] });
16431
+ }
16432
+ MosaicMessageSearch.displayName = "MosaicMessageSearch";
16433
+ var sessionCardVariants = classVarianceAuthority.cva(
16434
+ [
16435
+ "rounded-lg border border-border bg-card text-card-foreground shadow-sm transition-all",
16436
+ "focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring"
16437
+ ],
16438
+ {
16439
+ variants: {
16440
+ variant: {
16441
+ default: "p-5",
16442
+ compact: "flex items-center justify-between gap-3 p-3"
16443
+ },
16444
+ selectable: {
16445
+ true: "cursor-pointer hover:shadow-md",
16446
+ false: ""
16447
+ }
16448
+ },
16449
+ defaultVariants: {
16450
+ variant: "default",
16451
+ selectable: false
16452
+ }
16453
+ }
16454
+ );
16455
+ function cn110(...classes) {
16456
+ return classes.filter(Boolean).join(" ");
16457
+ }
16458
+ var ACTIVATION_KEYS = /* @__PURE__ */ new Set(["Enter", " "]);
16459
+ function MosaicSessionCard(props) {
16460
+ const { session, formatStatus, className, ref, onSelect, selectLabel } = props;
16461
+ const selectable = Boolean(onSelect);
16462
+ function activate() {
16463
+ onSelect?.(session.id);
16464
+ }
16465
+ const interactionProps = selectable ? {
16466
+ role: "button",
16467
+ tabIndex: 0,
16468
+ "aria-label": selectLabel,
16469
+ onClick: activate,
16470
+ onKeyDown: (event) => {
16471
+ if (ACTIVATION_KEYS.has(event.key)) {
16472
+ event.preventDefault();
16473
+ activate();
16474
+ }
16475
+ }
16476
+ } : {};
16477
+ const statusBadge = /* @__PURE__ */ jsxRuntime.jsx(MosaicBadge, { "data-slot": "session-card-status", children: formatStatus(session.status) });
16478
+ if (props.variant === "compact") {
16479
+ return /* @__PURE__ */ jsxRuntime.jsxs(
16480
+ MosaicCard,
16481
+ {
16482
+ ref,
16483
+ "data-slot": "session-card",
16484
+ "data-variant": "compact",
16485
+ className: cn110(sessionCardVariants({ variant: "compact", selectable }), className),
16486
+ ...interactionProps,
16487
+ children: [
16488
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "min-w-0 flex-1 truncate text-sm font-medium", children: session.title }),
16489
+ statusBadge
16490
+ ]
16491
+ }
16492
+ );
16493
+ }
16494
+ return /* @__PURE__ */ jsxRuntime.jsxs(
16495
+ MosaicCard,
16496
+ {
16497
+ ref,
16498
+ "data-slot": "session-card",
16499
+ "data-variant": "default",
16500
+ className: cn110(sessionCardVariants({ variant: "default", selectable }), className),
16501
+ ...interactionProps,
16502
+ children: [
16503
+ /* @__PURE__ */ jsxRuntime.jsxs(MosaicCardHeader, { className: "flex-row items-center justify-between gap-3 p-0", children: [
16504
+ /* @__PURE__ */ jsxRuntime.jsx("h3", { className: "line-clamp-1 text-base font-semibold", children: session.title }),
16505
+ statusBadge
16506
+ ] }),
16507
+ /* @__PURE__ */ jsxRuntime.jsx(MosaicCardContent, { className: "p-0 pt-3", children: /* @__PURE__ */ jsxRuntime.jsx(
16508
+ MosaicCardFooter,
16509
+ {
16510
+ "data-slot": "session-card-updated-at",
16511
+ className: "p-0 pt-2 text-xs text-muted-foreground",
16512
+ children: props.formatUpdatedAt(session.updatedAt)
16513
+ }
16514
+ ) })
16515
+ ]
16516
+ }
16517
+ );
16518
+ }
16519
+ MosaicSessionCard.displayName = "MosaicSessionCard";
16520
+ var sessionListVariants = classVarianceAuthority.cva([], {
16521
+ variants: {
16522
+ layout: {
16523
+ /** Single-column vertical stack, divided rows. */
16524
+ stack: "flex flex-col divide-y divide-border",
16525
+ /** Responsive tile grid. */
16526
+ grid: "grid grid-cols-1 gap-3 sm:grid-cols-2 lg:grid-cols-3",
16527
+ /** Dense single-column stack — tighter row padding, no divider. */
16528
+ compact: "flex flex-col gap-1",
16529
+ /** Horizontal-scroll row of tiles. */
16530
+ inline: "flex flex-row gap-3 overflow-x-auto"
16531
+ }
16532
+ },
16533
+ defaultVariants: {
16534
+ layout: "stack"
16535
+ }
16536
+ });
16537
+ var sessionListItemVariants = classVarianceAuthority.cva([], {
16538
+ variants: {
16539
+ layout: {
16540
+ stack: "py-3",
16541
+ grid: "",
16542
+ compact: "py-1",
16543
+ inline: "shrink-0"
16544
+ }
16545
+ },
16546
+ defaultVariants: {
16547
+ layout: "stack"
16548
+ }
16549
+ });
16550
+ function cn111(...classes) {
16551
+ return classes.filter(Boolean).join(" ");
16552
+ }
16553
+ var NEXT_KEYS5 = /* @__PURE__ */ new Set(["ArrowRight", "ArrowDown"]);
16554
+ var PREV_KEYS5 = /* @__PURE__ */ new Set(["ArrowLeft", "ArrowUp"]);
16555
+ function MosaicSessionList({
16556
+ items,
16557
+ renderItem,
16558
+ layout = "stack",
16559
+ emptyMessage,
16560
+ className,
16561
+ itemClassName,
16562
+ ref
16563
+ }) {
16564
+ const itemRefs = React30.useRef([]);
16565
+ const [focusedIndex, setFocusedIndex] = React30.useState(0);
16566
+ function focusItem(index) {
16567
+ if (items.length === 0) {
16568
+ return;
16569
+ }
16570
+ const clamped = Math.max(0, Math.min(items.length - 1, index));
16571
+ setFocusedIndex(clamped);
16572
+ itemRefs.current[clamped]?.focus();
16573
+ }
16574
+ function handleKeyDown(event, index) {
16575
+ if (NEXT_KEYS5.has(event.key)) {
16576
+ event.preventDefault();
16577
+ focusItem(index + 1);
16578
+ } else if (PREV_KEYS5.has(event.key)) {
16579
+ event.preventDefault();
16580
+ focusItem(index - 1);
16581
+ } else if (event.key === "Home") {
16582
+ event.preventDefault();
16583
+ focusItem(0);
16584
+ } else if (event.key === "End") {
16585
+ event.preventDefault();
16586
+ focusItem(items.length - 1);
16587
+ }
16588
+ }
16589
+ if (items.length === 0) {
16590
+ return /* @__PURE__ */ jsxRuntime.jsx(
16591
+ "div",
16592
+ {
16593
+ ref,
16594
+ "data-slot": "session-list",
16595
+ "data-layout": layout,
16596
+ className: cn111(sessionListVariants({ layout }), className),
16597
+ children: /* @__PURE__ */ jsxRuntime.jsx(
16598
+ "p",
16599
+ {
16600
+ "data-slot": "session-list-empty",
16601
+ className: "py-12 text-center text-sm text-muted-foreground",
16602
+ children: emptyMessage
16603
+ }
16604
+ )
16605
+ }
16606
+ );
16607
+ }
16608
+ return /* @__PURE__ */ jsxRuntime.jsx(
16609
+ "ul",
16610
+ {
16611
+ ref,
16612
+ "data-slot": "session-list",
16613
+ "data-layout": layout,
16614
+ className: cn111("list-none", sessionListVariants({ layout }), className),
16615
+ children: items.map((item, index) => /* @__PURE__ */ jsxRuntime.jsx(
16616
+ "li",
16617
+ {
16618
+ ref: (node) => {
16619
+ itemRefs.current[index] = node;
16620
+ },
16621
+ "data-slot": "session-list-item",
16622
+ tabIndex: index === focusedIndex ? 0 : -1,
16623
+ onKeyDown: (event) => handleKeyDown(event, index),
16624
+ onFocus: () => setFocusedIndex(index),
16625
+ className: cn111(sessionListItemVariants({ layout }), itemClassName),
16626
+ children: renderItem(item, index)
16627
+ },
16628
+ item.id
16629
+ ))
16630
+ }
16631
+ );
16632
+ }
16633
+ MosaicSessionList.displayName = "MosaicSessionList";
16634
+ var editSessionDialogBodyVariants = classVarianceAuthority.cva(["flex flex-col gap-4"]);
16635
+ var editSessionDialogFieldVariants = classVarianceAuthority.cva(["flex flex-col gap-1.5"]);
16636
+ var editSessionDialogErrorVariants = classVarianceAuthority.cva(["text-xs font-medium text-destructive"]);
16637
+ var editSessionDialogFooterVariants = classVarianceAuthority.cva([
16638
+ "flex items-center justify-end gap-3 border-t border-border pt-4"
16639
+ ]);
16640
+ var editSessionDialogButtonVariants = classVarianceAuthority.cva(
16641
+ [
16642
+ "inline-flex min-h-9 items-center justify-center gap-2 rounded-md px-4 text-sm font-medium",
16643
+ "transition-colors disabled:cursor-not-allowed disabled:opacity-50"
16644
+ ],
16645
+ {
16646
+ variants: {
16647
+ intent: {
16648
+ cancel: "border border-border bg-background hover:bg-muted",
16649
+ save: "border border-transparent bg-primary text-primary-foreground hover:bg-primary/90"
16650
+ }
16651
+ },
16652
+ defaultVariants: {
16653
+ intent: "cancel"
16654
+ }
16655
+ }
16656
+ );
16657
+ function cn112(...classes) {
16658
+ return classes.filter(Boolean).join(" ");
16659
+ }
16660
+ function MosaicEditSessionDialog({
16661
+ open,
16662
+ onOpenChange,
16663
+ title,
16664
+ description,
16665
+ closeAriaLabel,
16666
+ name,
16667
+ onNameChange,
16668
+ nameLabel,
16669
+ namePlaceholder,
16670
+ nameError,
16671
+ classifications,
16672
+ classification,
16673
+ onClassificationChange,
16674
+ classificationLabel,
16675
+ isSaving,
16676
+ canSave,
16677
+ onSave,
16678
+ onCancel,
16679
+ saveButtonLabel,
16680
+ savingLabel,
16681
+ cancelButtonLabel,
16682
+ className
16683
+ }) {
16684
+ const nameErrorId = React30.useId();
16685
+ if (!open) return null;
16686
+ return /* @__PURE__ */ jsxRuntime.jsx(
16687
+ MosaicAdaptiveModal,
16688
+ {
16689
+ isOpen: open,
16690
+ onClose: () => onOpenChange(false),
16691
+ title,
16692
+ description,
16693
+ closeAriaLabel,
16694
+ children: /* @__PURE__ */ jsxRuntime.jsxs(
16695
+ "div",
16696
+ {
16697
+ "data-slot": "edit-session-dialog",
16698
+ className: cn112(editSessionDialogBodyVariants(), className),
16699
+ children: [
16700
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: editSessionDialogFieldVariants(), children: [
16701
+ /* @__PURE__ */ jsxRuntime.jsx("label", { htmlFor: "mosaic-edit-session-name", className: "text-sm font-medium text-foreground", children: nameLabel }),
16702
+ /* @__PURE__ */ jsxRuntime.jsx(
16703
+ MosaicInput,
16704
+ {
16705
+ id: "mosaic-edit-session-name",
16706
+ value: name,
16707
+ placeholder: namePlaceholder,
16708
+ onChange: (e) => onNameChange(e.target.value),
16709
+ "aria-invalid": nameError ? "true" : "false",
16710
+ "aria-describedby": nameError ? nameErrorId : void 0
16711
+ }
16712
+ ),
16713
+ nameError && /* @__PURE__ */ jsxRuntime.jsx("p", { id: nameErrorId, className: editSessionDialogErrorVariants(), children: nameError })
16714
+ ] }),
16715
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: editSessionDialogFieldVariants(), children: [
16716
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-sm font-medium text-foreground", children: classificationLabel }),
16717
+ /* @__PURE__ */ jsxRuntime.jsx(
16718
+ MosaicSelect,
16719
+ {
16720
+ items: classifications,
16721
+ value: classification,
16722
+ onValueChange: (value) => {
16723
+ if (value) onClassificationChange(value);
16724
+ }
16725
+ }
16726
+ )
16727
+ ] }),
16728
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: editSessionDialogFooterVariants(), children: [
16729
+ /* @__PURE__ */ jsxRuntime.jsx(
16730
+ "button",
16731
+ {
16732
+ type: "button",
16733
+ "data-slot": "edit-session-dialog-cancel-button",
16734
+ onClick: onCancel,
16735
+ disabled: isSaving,
16736
+ className: editSessionDialogButtonVariants({ intent: "cancel" }),
16737
+ children: cancelButtonLabel
16738
+ }
16739
+ ),
16740
+ /* @__PURE__ */ jsxRuntime.jsx(
16741
+ "button",
16742
+ {
16743
+ type: "button",
16744
+ "data-slot": "edit-session-dialog-save-button",
16745
+ onClick: onSave,
16746
+ disabled: !canSave || isSaving,
16747
+ "aria-busy": isSaving ? "true" : "false",
16748
+ className: editSessionDialogButtonVariants({ intent: "save" }),
16749
+ children: isSaving ? savingLabel : saveButtonLabel
16750
+ }
16751
+ )
16752
+ ] })
16753
+ ]
16754
+ }
16755
+ )
16756
+ }
16757
+ );
16758
+ }
16759
+ MosaicEditSessionDialog.displayName = "MosaicEditSessionDialog";
16760
+ var saveChatAsMemoryFormRootVariants = classVarianceAuthority.cva(["flex flex-col gap-4"]);
16761
+ var saveChatAsMemoryFormFieldVariants = classVarianceAuthority.cva(["flex flex-col gap-1.5"]);
16762
+ var saveChatAsMemoryFormErrorVariants = classVarianceAuthority.cva(["text-xs font-medium text-destructive"]);
16763
+ var saveChatAsMemoryFormFooterVariants = classVarianceAuthority.cva([
16764
+ "flex items-center justify-end gap-3 border-t border-border pt-4"
16765
+ ]);
16766
+ var saveChatAsMemoryFormButtonVariants = classVarianceAuthority.cva(
16767
+ [
16768
+ "inline-flex min-h-9 items-center justify-center gap-2 rounded-md px-4 text-sm font-medium",
16769
+ "transition-colors disabled:cursor-not-allowed disabled:opacity-50"
16770
+ ],
16771
+ {
16772
+ variants: {
16773
+ intent: {
16774
+ cancel: "border border-border bg-background hover:bg-muted",
16775
+ save: "border border-transparent bg-primary text-primary-foreground hover:bg-primary/90"
16776
+ }
16777
+ },
16778
+ defaultVariants: {
16779
+ intent: "cancel"
16780
+ }
16781
+ }
16782
+ );
16783
+ function cn113(...classes) {
16784
+ return classes.filter(Boolean).join(" ");
16785
+ }
16786
+ function MosaicSaveChatAsMemoryForm({
16787
+ title,
16788
+ onTitleChange,
16789
+ titleLabel,
16790
+ titlePlaceholder,
16791
+ titleError,
16792
+ content,
16793
+ onContentChange,
16794
+ contentLabel,
16795
+ contentPlaceholder,
16796
+ contentError,
16797
+ tags,
16798
+ onAddTag,
16799
+ onRemoveTag,
16800
+ tagsLabel,
16801
+ tagInputPlaceholder,
16802
+ removeTagAriaLabel,
16803
+ suggestedTags,
16804
+ maxTags,
16805
+ isSaving,
16806
+ canSave,
16807
+ onSave,
16808
+ onCancel,
16809
+ saveLabel,
16810
+ savingLabel,
16811
+ cancelLabel,
16812
+ className
16813
+ }) {
16814
+ const titleErrorId = React30.useId();
16815
+ const contentErrorId = React30.useId();
16816
+ return /* @__PURE__ */ jsxRuntime.jsxs(
16817
+ "div",
16818
+ {
16819
+ "data-slot": "save-chat-as-memory-form",
16820
+ className: cn113(saveChatAsMemoryFormRootVariants(), className),
16821
+ children: [
16822
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: saveChatAsMemoryFormFieldVariants(), children: [
16823
+ /* @__PURE__ */ jsxRuntime.jsx(
16824
+ "label",
16825
+ {
16826
+ htmlFor: "mosaic-save-chat-as-memory-title",
16827
+ className: "text-sm font-medium text-foreground",
16828
+ children: titleLabel
16829
+ }
16830
+ ),
16831
+ /* @__PURE__ */ jsxRuntime.jsx(
16832
+ MosaicInput,
16833
+ {
16834
+ id: "mosaic-save-chat-as-memory-title",
16835
+ value: title,
16836
+ placeholder: titlePlaceholder,
16837
+ onChange: (e) => onTitleChange(e.target.value),
16838
+ "aria-invalid": titleError ? "true" : "false",
16839
+ "aria-describedby": titleError ? titleErrorId : void 0
16840
+ }
16841
+ ),
16842
+ titleError && /* @__PURE__ */ jsxRuntime.jsx("p", { id: titleErrorId, className: saveChatAsMemoryFormErrorVariants(), children: titleError })
16843
+ ] }),
16844
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: saveChatAsMemoryFormFieldVariants(), children: [
16845
+ /* @__PURE__ */ jsxRuntime.jsx(
16846
+ "label",
16847
+ {
16848
+ htmlFor: "mosaic-save-chat-as-memory-content",
16849
+ className: "text-sm font-medium text-foreground",
16850
+ children: contentLabel
16851
+ }
16852
+ ),
16853
+ /* @__PURE__ */ jsxRuntime.jsx(
16854
+ MosaicTextarea,
16855
+ {
16856
+ id: "mosaic-save-chat-as-memory-content",
16857
+ value: content,
16858
+ placeholder: contentPlaceholder,
16859
+ onChange: (e) => onContentChange(e.target.value),
16860
+ rows: 4,
16861
+ "aria-invalid": contentError ? "true" : "false",
16862
+ "aria-describedby": contentError ? contentErrorId : void 0
16863
+ }
16864
+ ),
16865
+ contentError && /* @__PURE__ */ jsxRuntime.jsx("p", { id: contentErrorId, className: saveChatAsMemoryFormErrorVariants(), children: contentError })
16866
+ ] }),
16867
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: saveChatAsMemoryFormFieldVariants(), children: [
16868
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-sm font-medium text-foreground", children: tagsLabel }),
16869
+ /* @__PURE__ */ jsxRuntime.jsx(
16870
+ MosaicTagInput,
16871
+ {
16872
+ tags,
16873
+ onAddTag,
16874
+ onRemoveTag,
16875
+ placeholder: tagInputPlaceholder,
16876
+ removeTagAriaLabel,
16877
+ suggestions: suggestedTags,
16878
+ maxTags
16879
+ }
16880
+ )
16881
+ ] }),
16882
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: saveChatAsMemoryFormFooterVariants(), children: [
16883
+ /* @__PURE__ */ jsxRuntime.jsx(
16884
+ "button",
16885
+ {
16886
+ type: "button",
16887
+ "data-slot": "save-chat-as-memory-form-cancel-button",
16888
+ onClick: onCancel,
16889
+ disabled: isSaving,
16890
+ className: saveChatAsMemoryFormButtonVariants({ intent: "cancel" }),
16891
+ children: cancelLabel
16892
+ }
16893
+ ),
16894
+ /* @__PURE__ */ jsxRuntime.jsx(
16895
+ "button",
16896
+ {
16897
+ type: "button",
16898
+ "data-slot": "save-chat-as-memory-form-save-button",
16899
+ onClick: onSave,
16900
+ disabled: !canSave || isSaving,
16901
+ "aria-busy": isSaving ? "true" : "false",
16902
+ className: saveChatAsMemoryFormButtonVariants({ intent: "save" }),
16903
+ children: isSaving ? savingLabel : saveLabel
16904
+ }
16905
+ )
16906
+ ] })
16907
+ ]
16908
+ }
16909
+ );
16910
+ }
16911
+ MosaicSaveChatAsMemoryForm.displayName = "MosaicSaveChatAsMemoryForm";
15826
16912
 
15827
16913
  Object.defineProperty(exports, "Accordion", {
15828
16914
  enumerable: true,
@@ -15902,6 +16988,7 @@ exports.MosaicDocumentUpload = MosaicDocumentUpload;
15902
16988
  exports.MosaicDrawer = MosaicDrawer;
15903
16989
  exports.MosaicDropdownMenu = MosaicDropdownMenu;
15904
16990
  exports.MosaicEditMemoryDialog = MosaicEditMemoryDialog;
16991
+ exports.MosaicEditSessionDialog = MosaicEditSessionDialog;
15905
16992
  exports.MosaicEmptyState = MosaicEmptyState;
15906
16993
  exports.MosaicFallingPattern = MosaicFallingPattern;
15907
16994
  exports.MosaicFeature3Col = MosaicFeature3Col;
@@ -15934,10 +17021,12 @@ exports.MosaicMemoryDashboard = MosaicMemoryDashboard;
15934
17021
  exports.MosaicMemoryGrid = MosaicMemoryGrid;
15935
17022
  exports.MosaicMemoryList = MosaicMemoryList;
15936
17023
  exports.MosaicMemorySearch = MosaicMemorySearch;
17024
+ exports.MosaicMentionInput = MosaicMentionInput;
15937
17025
  exports.MosaicMessageCard = MosaicMessageCard;
15938
17026
  exports.MosaicMessageList = MosaicMessageList;
15939
17027
  exports.MosaicMessageListDesktop = MessageListDesktop;
15940
17028
  exports.MosaicMessageListMobile = MessageListMobile;
17029
+ exports.MosaicMessageSearch = MosaicMessageSearch;
15941
17030
  exports.MosaicModelSelector = MosaicModelSelector;
15942
17031
  exports.MosaicModuleCard = MosaicModuleCard;
15943
17032
  exports.MosaicModuleForm = MosaicModuleForm;
@@ -15961,12 +17050,16 @@ exports.MosaicQuickAgentSelector = MosaicQuickAgentSelector;
15961
17050
  exports.MosaicQuickStartPanel = MosaicQuickStartPanel;
15962
17051
  exports.MosaicRadioGroup = MosaicRadioGroup;
15963
17052
  exports.MosaicRadioGroupItem = MosaicRadioGroupItem;
17053
+ exports.MosaicReplyInput = MosaicReplyInput;
15964
17054
  exports.MosaicResizableSplitPane = MosaicResizableSplitPane;
17055
+ exports.MosaicSaveChatAsMemoryForm = MosaicSaveChatAsMemoryForm;
15965
17056
  exports.MosaicSaveTemplateModal = MosaicSaveTemplateModal;
15966
17057
  exports.MosaicScrollArea = MosaicScrollArea;
15967
17058
  exports.MosaicSelect = MosaicSelect;
15968
17059
  exports.MosaicSelectorModal = MosaicSelectorModal;
15969
17060
  exports.MosaicSeparator = MosaicSeparator;
17061
+ exports.MosaicSessionCard = MosaicSessionCard;
17062
+ exports.MosaicSessionList = MosaicSessionList;
15970
17063
  exports.MosaicSignInLayout = MosaicSignInLayout;
15971
17064
  exports.MosaicSignUpLayout = MosaicSignUpLayout;
15972
17065
  exports.MosaicSkeleton = MosaicSkeleton;
@@ -15990,6 +17083,8 @@ exports.MosaicTestimonialsGrid = MosaicTestimonialsGrid;
15990
17083
  exports.MosaicTextarea = MosaicTextarea;
15991
17084
  exports.MosaicThemeProvider = MosaicThemeProvider;
15992
17085
  exports.MosaicThemeToggle = MosaicThemeToggle;
17086
+ exports.MosaicThreadIndicator = MosaicThreadIndicator;
17087
+ exports.MosaicThreadView = MosaicThreadView;
15993
17088
  exports.MosaicToast = MosaicToast;
15994
17089
  exports.MosaicToastProvider = MosaicToastProvider;
15995
17090
  exports.MosaicToolToggleList = MosaicToolToggleList;
@@ -16025,21 +17120,41 @@ exports.editMemoryDialogBackdropVariants = editMemoryDialogBackdropVariants;
16025
17120
  exports.editMemoryDialogErrorVariants = editMemoryDialogErrorVariants;
16026
17121
  exports.editMemoryDialogFieldVariants = editMemoryDialogFieldVariants;
16027
17122
  exports.editMemoryDialogPopupVariants = editMemoryDialogPopupVariants;
17123
+ exports.editSessionDialogBodyVariants = editSessionDialogBodyVariants;
17124
+ exports.editSessionDialogButtonVariants = editSessionDialogButtonVariants;
17125
+ exports.editSessionDialogErrorVariants = editSessionDialogErrorVariants;
17126
+ exports.editSessionDialogFieldVariants = editSessionDialogFieldVariants;
17127
+ exports.editSessionDialogFooterVariants = editSessionDialogFooterVariants;
16028
17128
  exports.marketplaceCardVariants = marketplaceCardVariants;
16029
17129
  exports.memoryDashboardViewToggleButtonVariants = memoryDashboardViewToggleButtonVariants;
16030
17130
  exports.memoryGridVariants = memoryGridVariants;
16031
17131
  exports.memoryListItemVariants = memoryListItemVariants;
16032
17132
  exports.memoryListVariants = memoryListVariants;
16033
17133
  exports.memorySearchFilterChipVariants = memorySearchFilterChipVariants;
17134
+ exports.mentionInputFieldVariants = mentionInputFieldVariants;
17135
+ exports.mentionListItemVariants = mentionListItemVariants;
17136
+ exports.mentionListVariants = mentionListVariants;
16034
17137
  exports.pdfViewerFrameVariants = pdfViewerFrameVariants;
16035
17138
  exports.pdfViewerStatusVariants = pdfViewerStatusVariants;
16036
17139
  exports.pdfViewerToolbarButtonVariants = pdfViewerToolbarButtonVariants;
16037
17140
  exports.popoverPopupVariants = popoverPopupVariants;
17141
+ exports.replyInputActionButtonVariants = replyInputActionButtonVariants;
17142
+ exports.replyInputContextVariants = replyInputContextVariants;
17143
+ exports.replyInputRootVariants = replyInputRootVariants;
17144
+ exports.replyInputTextareaVariants = replyInputTextareaVariants;
17145
+ exports.saveChatAsMemoryFormButtonVariants = saveChatAsMemoryFormButtonVariants;
17146
+ exports.saveChatAsMemoryFormErrorVariants = saveChatAsMemoryFormErrorVariants;
17147
+ exports.saveChatAsMemoryFormFieldVariants = saveChatAsMemoryFormFieldVariants;
17148
+ exports.saveChatAsMemoryFormFooterVariants = saveChatAsMemoryFormFooterVariants;
17149
+ exports.saveChatAsMemoryFormRootVariants = saveChatAsMemoryFormRootVariants;
16038
17150
  exports.saveTemplateModalBodyVariants = saveTemplateModalBodyVariants;
16039
17151
  exports.saveTemplateModalButtonVariants = saveTemplateModalButtonVariants;
16040
17152
  exports.saveTemplateModalErrorVariants = saveTemplateModalErrorVariants;
16041
17153
  exports.saveTemplateModalFieldVariants = saveTemplateModalFieldVariants;
16042
17154
  exports.saveTemplateModalFooterVariants = saveTemplateModalFooterVariants;
17155
+ exports.sessionCardVariants = sessionCardVariants;
17156
+ exports.sessionListItemVariants = sessionListItemVariants;
17157
+ exports.sessionListVariants = sessionListVariants;
16043
17158
  exports.skeletonVariants = skeletonVariants;
16044
17159
  exports.splitPaneCollapseButtonVariants = splitPaneCollapseButtonVariants;
16045
17160
  exports.splitPaneHandleVariants = splitPaneHandleVariants;
@@ -16054,6 +17169,13 @@ exports.templateAgentCardVariants = templateAgentCardVariants;
16054
17169
  exports.templateCategoryChipVariants = templateCategoryChipVariants;
16055
17170
  exports.templateListVariants = templateListVariants;
16056
17171
  exports.templateManagementRowVariants = templateManagementRowVariants;
17172
+ exports.threadIndicatorCountVariants = threadIndicatorCountVariants;
17173
+ exports.threadIndicatorRootVariants = threadIndicatorRootVariants;
17174
+ exports.threadViewEmptyVariants = threadViewEmptyVariants;
17175
+ exports.threadViewRepliesVariants = threadViewRepliesVariants;
17176
+ exports.threadViewReplyVariants = threadViewReplyVariants;
17177
+ exports.threadViewRootMessageVariants = threadViewRootMessageVariants;
17178
+ exports.threadViewRootVariants = threadViewRootVariants;
16057
17179
  exports.toastCardVariants = toastCardVariants;
16058
17180
  exports.toastDismissButtonVariants = toastDismissButtonVariants;
16059
17181
  exports.toastProviderPositionVariants = toastProviderPositionVariants;