@assistant-ui/react 0.5.73 → 0.5.74

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.js CHANGED
@@ -672,12 +672,7 @@ var useBranchPickerCount = () => {
672
672
 
673
673
  var useBranchPickerNext = () => {
674
674
  const messageRuntime = useMessageRuntime();
675
- const messageStore = useMessageStore();
676
- const editComposerStore = useEditComposerStore();
677
- const disabled = useCombinedStore(
678
- [messageStore, editComposerStore],
679
- (m, c) => c.isEditing || m.branchNumber >= m.branchCount
680
- );
675
+ const disabled = useMessage((m) => m.branchNumber >= m.branchCount);
681
676
  const callback = _react.useCallback.call(void 0, () => {
682
677
  messageRuntime.switchToBranch({ position: "next" });
683
678
  }, [messageRuntime]);
@@ -695,12 +690,7 @@ var useBranchPickerNumber = () => {
695
690
 
696
691
  var useBranchPickerPrevious = () => {
697
692
  const messageRuntime = useMessageRuntime();
698
- const messageStore = useMessageStore();
699
- const editComposerStore = useEditComposerStore();
700
- const disabled = useCombinedStore(
701
- [messageStore, editComposerStore],
702
- (m, c) => c.isEditing || m.branchNumber <= 1
703
- );
693
+ const disabled = useMessage((m) => m.branchNumber <= 1);
704
694
  const callback = _react.useCallback.call(void 0, () => {
705
695
  messageRuntime.switchToBranch({ position: "previous" });
706
696
  }, [messageRuntime]);
@@ -1238,6 +1228,119 @@ var AssistantModalPrimitiveAnchor = _react.forwardRef.call(void 0,
1238
1228
  );
1239
1229
  AssistantModalPrimitiveAnchor.displayName = "AssistantModalPrimitive.Anchor";
1240
1230
 
1231
+ // src/primitives/attachment/index.ts
1232
+ var attachment_exports = {};
1233
+ _chunkPZ5AY32Cjs.__export.call(void 0, attachment_exports, {
1234
+ Name: () => AttachmentPrimitiveName,
1235
+ Remove: () => AttachmentPrimitiveRemove,
1236
+ Root: () => AttachmentPrimitiveRoot,
1237
+ unstable_Thumb: () => AttachmentPrimitiveThumb
1238
+ });
1239
+
1240
+ // src/primitives/attachment/AttachmentRoot.tsx
1241
+
1242
+
1243
+
1244
+ var AttachmentPrimitiveRoot = _react.forwardRef.call(void 0, (props, ref) => {
1245
+ return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _reactprimitive.Primitive.div, { ...props, ref });
1246
+ });
1247
+ AttachmentPrimitiveRoot.displayName = "AttachmentPrimitive.Root";
1248
+
1249
+ // src/primitives/attachment/AttachmentThumb.tsx
1250
+
1251
+
1252
+ // src/context/react/AttachmentContext.ts
1253
+
1254
+ var AttachmentContext = _react.createContext.call(void 0,
1255
+ null
1256
+ );
1257
+ function useAttachmentContext(options) {
1258
+ const context = _react.useContext.call(void 0, AttachmentContext);
1259
+ if (!_optionalChain([options, 'optionalAccess', _15 => _15.optional]) && !context)
1260
+ throw new Error(
1261
+ "This component must be used within a ComposerPrimitive.Attachments or MessagePrimitive.Attachments component."
1262
+ );
1263
+ return context;
1264
+ }
1265
+ function useThreadComposerAttachmentContext(options) {
1266
+ const context = useAttachmentContext(options);
1267
+ if (!context) return null;
1268
+ if (context.source !== "thread-composer")
1269
+ throw new Error(
1270
+ "This component must be used within a thread's ComposerPrimitive.Attachments component."
1271
+ );
1272
+ return context;
1273
+ }
1274
+ function useEditComposerAttachmentContext(options) {
1275
+ const context = useAttachmentContext(options);
1276
+ if (!context) return null;
1277
+ if (context.source !== "edit-composer")
1278
+ throw new Error(
1279
+ "This component must be used within a messages's ComposerPrimitive.Attachments component."
1280
+ );
1281
+ return context;
1282
+ }
1283
+ function useMessageAttachmentContext(options) {
1284
+ const context = useAttachmentContext(options);
1285
+ if (!context) return null;
1286
+ if (context.source !== "message")
1287
+ throw new Error(
1288
+ "This component must be used within a MessagePrimitive.Attachments component."
1289
+ );
1290
+ return context;
1291
+ }
1292
+ function useAttachmentRuntime(options) {
1293
+ const attachmentRuntime = useAttachmentContext(options);
1294
+ if (!attachmentRuntime) return null;
1295
+ return attachmentRuntime.useAttachmentRuntime();
1296
+ }
1297
+ var { useAttachment } = createContextStoreHook(
1298
+ useAttachmentContext,
1299
+ "useAttachment"
1300
+ );
1301
+ var { useAttachment: useThreadComposerAttachment } = createContextStoreHook(useThreadComposerAttachmentContext, "useAttachment");
1302
+ var { useAttachment: useEditComposerAttachment } = createContextStoreHook(useEditComposerAttachmentContext, "useAttachment");
1303
+ var { useAttachment: useMessageAttachment } = createContextStoreHook(
1304
+ useMessageAttachmentContext,
1305
+ "useAttachment"
1306
+ );
1307
+
1308
+ // src/primitives/attachment/AttachmentThumb.tsx
1309
+
1310
+
1311
+ var AttachmentPrimitiveThumb = _react.forwardRef.call(void 0, () => {
1312
+ const ext = useAttachment((a) => a.name.split(".").pop());
1313
+ return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _reactprimitive.Primitive.div, { children: [
1314
+ ".",
1315
+ ext
1316
+ ] });
1317
+ });
1318
+ AttachmentPrimitiveThumb.displayName = "AttachmentPrimitive.Thumb";
1319
+
1320
+ // src/primitives/attachment/AttachmentName.tsx
1321
+
1322
+ var AttachmentPrimitiveName = () => {
1323
+ const name = useAttachment((a) => a.name);
1324
+ return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _jsxruntime.Fragment, { children: name });
1325
+ };
1326
+ AttachmentPrimitiveName.displayName = "AttachmentPrimitive.Name";
1327
+
1328
+ // src/primitive-hooks/attachment/useAttachmentRemove.ts
1329
+
1330
+ var useAttachmentRemove = () => {
1331
+ const attachmentRuntime = useAttachmentRuntime();
1332
+ const handleRemoveAttachment = _react.useCallback.call(void 0, () => {
1333
+ attachmentRuntime.remove();
1334
+ }, [attachmentRuntime]);
1335
+ return handleRemoveAttachment;
1336
+ };
1337
+
1338
+ // src/primitives/attachment/AttachmentRemove.tsx
1339
+ var AttachmentPrimitiveRemove = createActionButton(
1340
+ "AttachmentPrimitive.Remove",
1341
+ useAttachmentRemove
1342
+ );
1343
+
1241
1344
  // src/primitives/branchPicker/index.ts
1242
1345
  var branchPicker_exports = {};
1243
1346
  _chunkPZ5AY32Cjs.__export.call(void 0, branchPicker_exports, {
@@ -1341,9 +1444,9 @@ var useIsHoveringRef = () => {
1341
1444
  );
1342
1445
  return useManagedRef(callbackRef);
1343
1446
  };
1344
- var MessagePrimitiveRoot = _react.forwardRef.call(void 0, (props, forwardRef33) => {
1447
+ var MessagePrimitiveRoot = _react.forwardRef.call(void 0, (props, forwardRef35) => {
1345
1448
  const isHoveringRef = useIsHoveringRef();
1346
- const ref = _reactcomposerefs.useComposedRefs.call(void 0, forwardRef33, isHoveringRef);
1449
+ const ref = _reactcomposerefs.useComposedRefs.call(void 0, forwardRef35, isHoveringRef);
1347
1450
  return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _reactprimitive.Primitive.div, { ...props, ref });
1348
1451
  });
1349
1452
  MessagePrimitiveRoot.displayName = "MessagePrimitive.Root";
@@ -1434,7 +1537,7 @@ var withSmoothContextProvider = (Component) => {
1434
1537
  };
1435
1538
  function useSmoothContext(options) {
1436
1539
  const context = _react.useContext.call(void 0, SmoothContext);
1437
- if (!_optionalChain([options, 'optionalAccess', _15 => _15.optional]) && !context)
1540
+ if (!_optionalChain([options, 'optionalAccess', _16 => _16.optional]) && !context)
1438
1541
  throw new Error(
1439
1542
  "This component must be used within a SmoothContextProvider."
1440
1543
  );
@@ -1644,7 +1747,7 @@ var BaseSubject = (_class2 = class {constructor() { _class2.prototype.__init5.ca
1644
1747
  if (this._connection) return;
1645
1748
  this._connection = this._connect();
1646
1749
  } else {
1647
- _optionalChain([this, 'access', _16 => _16._connection, 'optionalCall', _17 => _17()]);
1750
+ _optionalChain([this, 'access', _17 => _17._connection, 'optionalCall', _18 => _18()]);
1648
1751
  this._connection = void 0;
1649
1752
  }
1650
1753
  }
@@ -1743,40 +1846,40 @@ var EMPTY_ARRAY = Object.freeze([]);
1743
1846
  var getThreadComposerState = (runtime, focus, onFocus) => {
1744
1847
  return Object.freeze({
1745
1848
  type: "thread",
1746
- isEditing: _nullishCoalesce(_optionalChain([runtime, 'optionalAccess', _18 => _18.isEditing]), () => ( false)),
1747
- canCancel: _nullishCoalesce(_optionalChain([runtime, 'optionalAccess', _19 => _19.canCancel]), () => ( false)),
1748
- isEmpty: _nullishCoalesce(_optionalChain([runtime, 'optionalAccess', _20 => _20.isEmpty]), () => ( true)),
1749
- text: _nullishCoalesce(_optionalChain([runtime, 'optionalAccess', _21 => _21.text]), () => ( "")),
1750
- attachments: _nullishCoalesce(_optionalChain([runtime, 'optionalAccess', _22 => _22.attachments]), () => ( EMPTY_ARRAY)),
1751
- attachmentAccept: _nullishCoalesce(_optionalChain([runtime, 'optionalAccess', _23 => _23.attachmentAccept]), () => ( "*")),
1752
- value: _nullishCoalesce(_optionalChain([runtime, 'optionalAccess', _24 => _24.text]), () => ( "")),
1753
- setValue: _nullishCoalesce(_optionalChain([runtime, 'optionalAccess', _25 => _25.setText, 'access', _26 => _26.bind, 'call', _27 => _27(runtime)]), () => ( METHOD_NOT_SUPPORTED)),
1754
- setText: _nullishCoalesce(_optionalChain([runtime, 'optionalAccess', _28 => _28.setText, 'access', _29 => _29.bind, 'call', _30 => _30(runtime)]), () => ( METHOD_NOT_SUPPORTED)),
1849
+ isEditing: _nullishCoalesce(_optionalChain([runtime, 'optionalAccess', _19 => _19.isEditing]), () => ( false)),
1850
+ canCancel: _nullishCoalesce(_optionalChain([runtime, 'optionalAccess', _20 => _20.canCancel]), () => ( false)),
1851
+ isEmpty: _nullishCoalesce(_optionalChain([runtime, 'optionalAccess', _21 => _21.isEmpty]), () => ( true)),
1852
+ text: _nullishCoalesce(_optionalChain([runtime, 'optionalAccess', _22 => _22.text]), () => ( "")),
1853
+ attachments: _nullishCoalesce(_optionalChain([runtime, 'optionalAccess', _23 => _23.attachments]), () => ( EMPTY_ARRAY)),
1854
+ attachmentAccept: _nullishCoalesce(_optionalChain([runtime, 'optionalAccess', _24 => _24.attachmentAccept]), () => ( "*")),
1855
+ value: _nullishCoalesce(_optionalChain([runtime, 'optionalAccess', _25 => _25.text]), () => ( "")),
1856
+ setValue: _nullishCoalesce(_optionalChain([runtime, 'optionalAccess', _26 => _26.setText, 'access', _27 => _27.bind, 'call', _28 => _28(runtime)]), () => ( METHOD_NOT_SUPPORTED)),
1857
+ setText: _nullishCoalesce(_optionalChain([runtime, 'optionalAccess', _29 => _29.setText, 'access', _30 => _30.bind, 'call', _31 => _31(runtime)]), () => ( METHOD_NOT_SUPPORTED)),
1755
1858
  // edit: beginEdit,
1756
- send: _nullishCoalesce(_optionalChain([runtime, 'optionalAccess', _31 => _31.send, 'access', _32 => _32.bind, 'call', _33 => _33(runtime)]), () => ( METHOD_NOT_SUPPORTED)),
1757
- cancel: _nullishCoalesce(_optionalChain([runtime, 'optionalAccess', _34 => _34.cancel, 'access', _35 => _35.bind, 'call', _36 => _36(runtime)]), () => ( METHOD_NOT_SUPPORTED)),
1859
+ send: _nullishCoalesce(_optionalChain([runtime, 'optionalAccess', _32 => _32.send, 'access', _33 => _33.bind, 'call', _34 => _34(runtime)]), () => ( METHOD_NOT_SUPPORTED)),
1860
+ cancel: _nullishCoalesce(_optionalChain([runtime, 'optionalAccess', _35 => _35.cancel, 'access', _36 => _36.bind, 'call', _37 => _37(runtime)]), () => ( METHOD_NOT_SUPPORTED)),
1758
1861
  focus,
1759
1862
  onFocus,
1760
- reset: _nullishCoalesce(_optionalChain([runtime, 'optionalAccess', _37 => _37.reset, 'access', _38 => _38.bind, 'call', _39 => _39(runtime)]), () => ( METHOD_NOT_SUPPORTED)),
1761
- addAttachment: _nullishCoalesce(_optionalChain([runtime, 'optionalAccess', _40 => _40.addAttachment, 'access', _41 => _41.bind, 'call', _42 => _42(runtime)]), () => ( METHOD_NOT_SUPPORTED)),
1762
- removeAttachment: _nullishCoalesce(_optionalChain([runtime, 'optionalAccess', _43 => _43.removeAttachment, 'access', _44 => _44.bind, 'call', _45 => _45(runtime)]), () => ( METHOD_NOT_SUPPORTED))
1863
+ reset: _nullishCoalesce(_optionalChain([runtime, 'optionalAccess', _38 => _38.reset, 'access', _39 => _39.bind, 'call', _40 => _40(runtime)]), () => ( METHOD_NOT_SUPPORTED)),
1864
+ addAttachment: _nullishCoalesce(_optionalChain([runtime, 'optionalAccess', _41 => _41.addAttachment, 'access', _42 => _42.bind, 'call', _43 => _43(runtime)]), () => ( METHOD_NOT_SUPPORTED)),
1865
+ removeAttachment: _nullishCoalesce(_optionalChain([runtime, 'optionalAccess', _44 => _44.removeAttachment, 'access', _45 => _45.bind, 'call', _46 => _46(runtime)]), () => ( METHOD_NOT_SUPPORTED))
1763
1866
  });
1764
1867
  };
1765
1868
  var getEditComposerState = (runtime, beginEdit) => {
1766
1869
  return Object.freeze({
1767
1870
  type: "edit",
1768
- isEditing: _nullishCoalesce(_optionalChain([runtime, 'optionalAccess', _46 => _46.isEditing]), () => ( false)),
1769
- canCancel: _nullishCoalesce(_optionalChain([runtime, 'optionalAccess', _47 => _47.canCancel]), () => ( false)),
1770
- isEmpty: _nullishCoalesce(_optionalChain([runtime, 'optionalAccess', _48 => _48.isEmpty]), () => ( true)),
1771
- text: _nullishCoalesce(_optionalChain([runtime, 'optionalAccess', _49 => _49.text]), () => ( "")),
1772
- attachments: _nullishCoalesce(_optionalChain([runtime, 'optionalAccess', _50 => _50.attachments]), () => ( EMPTY_ARRAY)),
1773
- attachmentAccept: _nullishCoalesce(_optionalChain([runtime, 'optionalAccess', _51 => _51.attachmentAccept]), () => ( "*")),
1774
- value: _nullishCoalesce(_optionalChain([runtime, 'optionalAccess', _52 => _52.text]), () => ( "")),
1775
- setValue: _nullishCoalesce(_optionalChain([runtime, 'optionalAccess', _53 => _53.setText, 'access', _54 => _54.bind, 'call', _55 => _55(runtime)]), () => ( METHOD_NOT_SUPPORTED)),
1776
- setText: _nullishCoalesce(_optionalChain([runtime, 'optionalAccess', _56 => _56.setText, 'access', _57 => _57.bind, 'call', _58 => _58(runtime)]), () => ( METHOD_NOT_SUPPORTED)),
1871
+ isEditing: _nullishCoalesce(_optionalChain([runtime, 'optionalAccess', _47 => _47.isEditing]), () => ( false)),
1872
+ canCancel: _nullishCoalesce(_optionalChain([runtime, 'optionalAccess', _48 => _48.canCancel]), () => ( false)),
1873
+ isEmpty: _nullishCoalesce(_optionalChain([runtime, 'optionalAccess', _49 => _49.isEmpty]), () => ( true)),
1874
+ text: _nullishCoalesce(_optionalChain([runtime, 'optionalAccess', _50 => _50.text]), () => ( "")),
1875
+ attachments: _nullishCoalesce(_optionalChain([runtime, 'optionalAccess', _51 => _51.attachments]), () => ( EMPTY_ARRAY)),
1876
+ attachmentAccept: _nullishCoalesce(_optionalChain([runtime, 'optionalAccess', _52 => _52.attachmentAccept]), () => ( "*")),
1877
+ value: _nullishCoalesce(_optionalChain([runtime, 'optionalAccess', _53 => _53.text]), () => ( "")),
1878
+ setValue: _nullishCoalesce(_optionalChain([runtime, 'optionalAccess', _54 => _54.setText, 'access', _55 => _55.bind, 'call', _56 => _56(runtime)]), () => ( METHOD_NOT_SUPPORTED)),
1879
+ setText: _nullishCoalesce(_optionalChain([runtime, 'optionalAccess', _57 => _57.setText, 'access', _58 => _58.bind, 'call', _59 => _59(runtime)]), () => ( METHOD_NOT_SUPPORTED)),
1777
1880
  edit: beginEdit,
1778
- send: _nullishCoalesce(_optionalChain([runtime, 'optionalAccess', _59 => _59.send, 'access', _60 => _60.bind, 'call', _61 => _61(runtime)]), () => ( METHOD_NOT_SUPPORTED)),
1779
- cancel: _nullishCoalesce(_optionalChain([runtime, 'optionalAccess', _62 => _62.cancel, 'access', _63 => _63.bind, 'call', _64 => _64(runtime)]), () => ( METHOD_NOT_SUPPORTED))
1881
+ send: _nullishCoalesce(_optionalChain([runtime, 'optionalAccess', _60 => _60.send, 'access', _61 => _61.bind, 'call', _62 => _62(runtime)]), () => ( METHOD_NOT_SUPPORTED)),
1882
+ cancel: _nullishCoalesce(_optionalChain([runtime, 'optionalAccess', _63 => _63.cancel, 'access', _64 => _64.bind, 'call', _65 => _65(runtime)]), () => ( METHOD_NOT_SUPPORTED))
1780
1883
  });
1781
1884
  };
1782
1885
  var ComposerRuntimeImpl = class {
@@ -1889,7 +1992,7 @@ var ThreadComposerRuntimeImpl = (_class5 = class extends ComposerRuntimeImpl {
1889
1992
  this._getState = stateBinding.getState.bind(stateBinding);
1890
1993
  }
1891
1994
  get attachments() {
1892
- return _nullishCoalesce(_optionalChain([this, 'access', _65 => _65.getState, 'call', _66 => _66(), 'optionalAccess', _67 => _67.attachments]), () => ( EMPTY_ARRAY));
1995
+ return _nullishCoalesce(_optionalChain([this, 'access', _66 => _66.getState, 'call', _67 => _67(), 'optionalAccess', _68 => _68.attachments]), () => ( EMPTY_ARRAY));
1893
1996
  }
1894
1997
  getState() {
1895
1998
  return this._getState();
@@ -1991,19 +2094,19 @@ var NestedSubscriptionSubject = class extends BaseSubject {
1991
2094
  this.notifySubscribers();
1992
2095
  };
1993
2096
  let lastState = this.binding.getState();
1994
- let innerUnsubscribe = _optionalChain([lastState, 'optionalAccess', _68 => _68.subscribe, 'call', _69 => _69(callback)]);
2097
+ let innerUnsubscribe = _optionalChain([lastState, 'optionalAccess', _69 => _69.subscribe, 'call', _70 => _70(callback)]);
1995
2098
  const onRuntimeUpdate = () => {
1996
2099
  const newState = this.binding.getState();
1997
2100
  if (newState === lastState) return;
1998
2101
  lastState = newState;
1999
- _optionalChain([innerUnsubscribe, 'optionalCall', _70 => _70()]);
2000
- innerUnsubscribe = _optionalChain([this, 'access', _71 => _71.binding, 'access', _72 => _72.getState, 'call', _73 => _73(), 'optionalAccess', _74 => _74.subscribe, 'call', _75 => _75(callback)]);
2102
+ _optionalChain([innerUnsubscribe, 'optionalCall', _71 => _71()]);
2103
+ innerUnsubscribe = _optionalChain([this, 'access', _72 => _72.binding, 'access', _73 => _73.getState, 'call', _74 => _74(), 'optionalAccess', _75 => _75.subscribe, 'call', _76 => _76(callback)]);
2001
2104
  callback();
2002
2105
  };
2003
2106
  const outerUnsubscribe = this.binding.subscribe(onRuntimeUpdate);
2004
2107
  return () => {
2005
- _optionalChain([outerUnsubscribe, 'optionalCall', _76 => _76()]);
2006
- _optionalChain([innerUnsubscribe, 'optionalCall', _77 => _77()]);
2108
+ _optionalChain([outerUnsubscribe, 'optionalCall', _77 => _77()]);
2109
+ _optionalChain([innerUnsubscribe, 'optionalCall', _78 => _78()]);
2007
2110
  };
2008
2111
  }
2009
2112
  };
@@ -2120,7 +2223,7 @@ var MessageRuntimeImpl = (_class6 = class {
2120
2223
  new ShallowMemoizeSubject({
2121
2224
  getState: () => {
2122
2225
  const attachments = this.getState().attachments;
2123
- const attachment = _optionalChain([attachments, 'optionalAccess', _78 => _78[idx]]);
2226
+ const attachment = _optionalChain([attachments, 'optionalAccess', _79 => _79[idx]]);
2124
2227
  if (!attachment) return SKIP_UPDATE;
2125
2228
  return {
2126
2229
  ...attachment,
@@ -2209,7 +2312,7 @@ var MessageContentPartImpl = ({
2209
2312
  };
2210
2313
  var MessageContentPart = _react.memo.call(void 0,
2211
2314
  MessageContentPartImpl,
2212
- (prev, next) => prev.partIndex === next.partIndex && _optionalChain([prev, 'access', _79 => _79.components, 'optionalAccess', _80 => _80.Text]) === _optionalChain([next, 'access', _81 => _81.components, 'optionalAccess', _82 => _82.Text]) && _optionalChain([prev, 'access', _83 => _83.components, 'optionalAccess', _84 => _84.Image]) === _optionalChain([next, 'access', _85 => _85.components, 'optionalAccess', _86 => _86.Image]) && _optionalChain([prev, 'access', _87 => _87.components, 'optionalAccess', _88 => _88.UI]) === _optionalChain([next, 'access', _89 => _89.components, 'optionalAccess', _90 => _90.UI]) && _optionalChain([prev, 'access', _91 => _91.components, 'optionalAccess', _92 => _92.tools]) === _optionalChain([next, 'access', _93 => _93.components, 'optionalAccess', _94 => _94.tools])
2315
+ (prev, next) => prev.partIndex === next.partIndex && _optionalChain([prev, 'access', _80 => _80.components, 'optionalAccess', _81 => _81.Text]) === _optionalChain([next, 'access', _82 => _82.components, 'optionalAccess', _83 => _83.Text]) && _optionalChain([prev, 'access', _84 => _84.components, 'optionalAccess', _85 => _85.Image]) === _optionalChain([next, 'access', _86 => _86.components, 'optionalAccess', _87 => _87.Image]) && _optionalChain([prev, 'access', _88 => _88.components, 'optionalAccess', _89 => _89.UI]) === _optionalChain([next, 'access', _90 => _90.components, 'optionalAccess', _91 => _91.UI]) && _optionalChain([prev, 'access', _92 => _92.components, 'optionalAccess', _93 => _93.tools]) === _optionalChain([next, 'access', _94 => _94.components, 'optionalAccess', _95 => _95.tools])
2213
2316
  );
2214
2317
  var MessagePrimitiveContent = ({
2215
2318
  components
@@ -2228,62 +2331,6 @@ MessagePrimitiveInProgress.displayName = "MessagePrimitive.InProgress";
2228
2331
  // src/primitives/message/MessageAttachments.tsx
2229
2332
 
2230
2333
 
2231
- // src/context/react/AttachmentContext.ts
2232
-
2233
- var AttachmentContext = _react.createContext.call(void 0,
2234
- null
2235
- );
2236
- function useAttachmentContext(options) {
2237
- const context = _react.useContext.call(void 0, AttachmentContext);
2238
- if (!_optionalChain([options, 'optionalAccess', _95 => _95.optional]) && !context)
2239
- throw new Error(
2240
- "This component must be used within a ComposerPrimitive.Attachments or MessagePrimitive.Attachments component."
2241
- );
2242
- return context;
2243
- }
2244
- function useThreadComposerAttachmentContext(options) {
2245
- const context = useAttachmentContext(options);
2246
- if (!context) return null;
2247
- if (context.source !== "thread-composer")
2248
- throw new Error(
2249
- "This component must be used within a thread's ComposerPrimitive.Attachments component."
2250
- );
2251
- return context;
2252
- }
2253
- function useEditComposerAttachmentContext(options) {
2254
- const context = useAttachmentContext(options);
2255
- if (!context) return null;
2256
- if (context.source !== "edit-composer")
2257
- throw new Error(
2258
- "This component must be used within a messages's ComposerPrimitive.Attachments component."
2259
- );
2260
- return context;
2261
- }
2262
- function useMessageAttachmentContext(options) {
2263
- const context = useAttachmentContext(options);
2264
- if (!context) return null;
2265
- if (context.source !== "message")
2266
- throw new Error(
2267
- "This component must be used within a MessagePrimitive.Attachments component."
2268
- );
2269
- return context;
2270
- }
2271
- function useAttachmentRuntime(options) {
2272
- const attachmentRuntime = useAttachmentContext(options);
2273
- if (!attachmentRuntime) return null;
2274
- return attachmentRuntime.useAttachmentRuntime();
2275
- }
2276
- var { useAttachment } = createContextStoreHook(
2277
- useAttachmentContext,
2278
- "useAttachment"
2279
- );
2280
- var { useAttachment: useThreadComposerAttachment } = createContextStoreHook(useThreadComposerAttachmentContext, "useAttachment");
2281
- var { useAttachment: useEditComposerAttachment } = createContextStoreHook(useEditComposerAttachmentContext, "useAttachment");
2282
- var { useAttachment: useMessageAttachment } = createContextStoreHook(
2283
- useMessageAttachmentContext,
2284
- "useAttachment"
2285
- );
2286
-
2287
2334
  // src/context/providers/AttachmentRuntimeProvider.tsx
2288
2335
 
2289
2336
 
@@ -5542,15 +5589,13 @@ CircleStopIcon.displayName = "CircleStopIcon";
5542
5589
 
5543
5590
 
5544
5591
 
5545
- var ComposerAttachmentRoot = withDefaults("div", {
5592
+ var ComposerAttachmentRoot = withDefaults(attachment_exports.Root, {
5546
5593
  className: "aui-composer-attachment-root"
5547
5594
  });
5548
5595
  ComposerAttachmentRoot.displayName = "ComposerAttachmentRoot";
5549
5596
  var ComposerAttachment2 = () => {
5550
- const attachment = useThreadComposerAttachment((a) => a.attachment);
5551
5597
  return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, ComposerAttachmentRoot, { children: [
5552
- ".",
5553
- attachment.name.split(".").pop(),
5598
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, attachment_exports.unstable_Thumb, {}),
5554
5599
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, ComposerAttachmentRemove, {})
5555
5600
  ] });
5556
5601
  };
@@ -5561,22 +5606,17 @@ var ComposerAttachmentRemove = _react.forwardRef.call(void 0, (props, ref) => {
5561
5606
  composer: { removeAttachment: { tooltip = "Remove file" } = {} } = {}
5562
5607
  } = {}
5563
5608
  } = useThreadConfig();
5564
- const attachmentRuntime = useAttachmentRuntime();
5565
- const handleRemoveAttachment = () => {
5566
- attachmentRuntime.remove();
5567
- };
5568
- return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
5609
+ return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, attachment_exports.Remove, { asChild: true, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
5569
5610
  TooltipIconButton,
5570
5611
  {
5571
5612
  tooltip,
5572
5613
  className: "aui-composer-attachment-remove",
5573
5614
  side: "top",
5574
5615
  ...props,
5575
- onClick: handleRemoveAttachment,
5576
5616
  ref,
5577
5617
  children: _nullishCoalesce(props.children, () => ( /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.CircleXIcon, {})))
5578
5618
  }
5579
- );
5619
+ ) });
5580
5620
  });
5581
5621
  ComposerAttachmentRemove.displayName = "ComposerAttachmentRemove";
5582
5622
  var exports5 = {
@@ -5814,16 +5854,12 @@ var user_action_bar_default = Object.assign(UserActionBar, exports8);
5814
5854
 
5815
5855
  // src/ui/user-message-attachment.tsx
5816
5856
 
5817
- var UserMessageAttachmentRoot = withDefaults("div", {
5857
+ var UserMessageAttachmentRoot = withDefaults(attachment_exports.Root, {
5818
5858
  className: "aui-user-message-attachment-root"
5819
5859
  });
5820
5860
  UserMessageAttachmentRoot.displayName = "UserMessageAttachmentRoot";
5821
5861
  var UserMessageAttachment = () => {
5822
- const attachment = useAttachment((a) => a.attachment);
5823
- return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, UserMessageAttachmentRoot, { children: [
5824
- ".",
5825
- attachment.name.split(".").pop()
5826
- ] });
5862
+ return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, UserMessageAttachmentRoot, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, attachment_exports.unstable_Thumb, {}) });
5827
5863
  };
5828
5864
  UserMessageAttachment.displayName = "UserMessageAttachment";
5829
5865
  var exports9 = {
@@ -6228,5 +6264,6 @@ var assistant_modal_default = Object.assign(AssistantModal, exports13);
6228
6264
 
6229
6265
 
6230
6266
 
6231
- exports.ActionBarPrimitive = actionBar_exports; exports.AssistantActionBar = assistant_action_bar_default; exports.AssistantMessage = assistant_message_default; exports.AssistantModal = assistant_modal_default; exports.AssistantModalPrimitive = assistantModal_exports; exports.AssistantRuntimeProvider = AssistantRuntimeProvider; exports.BranchPicker = branch_picker_default; exports.BranchPickerPrimitive = branchPicker_exports; exports.Composer = composer_default; exports.ComposerAttachment = composer_attachment_default; exports.ComposerPrimitive = composer_exports; exports.CompositeAttachmentAdapter = CompositeAttachmentAdapter; exports.ContentPart = content_part_default; exports.ContentPartPrimitive = contentPart_exports; exports.EdgeChatAdapter = EdgeChatAdapter; exports.EditComposer = edit_composer_default; exports.INTERNAL = internal_exports; exports.MessagePrimitive = message_exports; exports.SimpleImageAttachmentAdapter = SimpleImageAttachmentAdapter; exports.SimpleTextAttachmentAdapter = SimpleTextAttachmentAdapter; exports.TextContentPartProvider = TextContentPartProvider; exports.Thread = thread_default; exports.ThreadConfigProvider = ThreadConfigProvider; exports.ThreadPrimitive = thread_exports; exports.ThreadWelcome = thread_welcome_default; exports.UserActionBar = user_action_bar_default; exports.UserMessage = user_message_default; exports.UserMessageAttachment = user_message_attachment_default; exports.WebSpeechSynthesisAdapter = WebSpeechSynthesisAdapter; exports.fromCoreMessage = fromCoreMessage; exports.fromCoreMessages = fromCoreMessages; exports.fromLanguageModelMessages = fromLanguageModelMessages; exports.fromLanguageModelTools = fromLanguageModelTools; exports.getExternalStoreMessage = getExternalStoreMessage; exports.makeAssistantTool = makeAssistantTool; exports.makeAssistantToolUI = makeAssistantToolUI; exports.streamUtils = streamUtils; exports.subscribeToMainThread = subscribeToMainThread; exports.toCoreMessage = _chunkKVXP3Q6Kjs.toCoreMessage; exports.toCoreMessages = _chunkKVXP3Q6Kjs.toCoreMessages; exports.toLanguageModelMessages = _chunkKVXP3Q6Kjs.toLanguageModelMessages; exports.toLanguageModelTools = _chunkKVXP3Q6Kjs.toLanguageModelTools; exports.useActionBarCopy = useActionBarCopy; exports.useActionBarEdit = useActionBarEdit; exports.useActionBarFeedbackNegative = useActionBarFeedbackNegative; exports.useActionBarFeedbackPositive = useActionBarFeedbackPositive; exports.useActionBarReload = useActionBarReload; exports.useActionBarSpeak = useActionBarSpeak; exports.useActionBarStopSpeaking = useActionBarStopSpeaking; exports.useAppendMessage = useAppendMessage; exports.useAssistantActions = useAssistantActions; exports.useAssistantActionsStore = useAssistantActionsStore; exports.useAssistantContext = useAssistantContext; exports.useAssistantInstructions = useAssistantInstructions; exports.useAssistantRuntime = useAssistantRuntime; exports.useAssistantRuntimeStore = useAssistantRuntimeStore; exports.useAssistantTool = useAssistantTool; exports.useAssistantToolUI = useAssistantToolUI; exports.useBranchPickerCount = useBranchPickerCount; exports.useBranchPickerNext = useBranchPickerNext; exports.useBranchPickerNumber = useBranchPickerNumber; exports.useBranchPickerPrevious = useBranchPickerPrevious; exports.useComposer = useComposer; exports.useComposerAddAttachment = useComposerAddAttachment; exports.useComposerCancel = useComposerCancel; exports.useComposerContext = useComposerContext; exports.useComposerIf = useComposerIf; exports.useComposerRuntime = useComposerRuntime; exports.useComposerSend = useComposerSend; exports.useComposerStore = useComposerStore; exports.useContentPart = useContentPart; exports.useContentPartContext = useContentPartContext; exports.useContentPartDisplay = useContentPartDisplay; exports.useContentPartImage = useContentPartImage; exports.useContentPartRuntime = useContentPartRuntime; exports.useContentPartStore = useContentPartStore; exports.useContentPartText = useContentPartText; exports.useDangerousInBrowserRuntime = useDangerousInBrowserRuntime; exports.useEdgeRuntime = useEdgeRuntime; exports.useEditComposer = useEditComposer; exports.useEditComposerStore = useEditComposerStore; exports.useExternalMessageConverter = useExternalMessageConverter; exports.useExternalStoreRuntime = useExternalStoreRuntime; exports.useLocalRuntime = useLocalRuntime; exports.useMessage = useMessage; exports.useMessageContext = useMessageContext; exports.useMessageIf = useMessageIf; exports.useMessageRuntime = useMessageRuntime; exports.useMessageStore = useMessageStore; exports.useMessageUtils = useMessageUtils; exports.useMessageUtilsStore = useMessageUtilsStore; exports.useSwitchToNewThread = useSwitchToNewThread; exports.useThread = useThread; exports.useThreadActions = useThreadActions; exports.useThreadActionsStore = useThreadActionsStore; exports.useThreadComposer = useThreadComposer; exports.useThreadComposerStore = useThreadComposerStore; exports.useThreadConfig = useThreadConfig; exports.useThreadContext = useThreadContext; exports.useThreadEmpty = useThreadEmpty; exports.useThreadIf = useThreadIf; exports.useThreadMessages = useThreadMessages; exports.useThreadMessagesStore = useThreadMessagesStore; exports.useThreadRuntime = useThreadRuntime; exports.useThreadRuntimeStore = useThreadRuntimeStore; exports.useThreadScrollToBottom = useThreadScrollToBottom; exports.useThreadStore = useThreadStore; exports.useThreadSuggestion = useThreadSuggestion; exports.useThreadViewport = useThreadViewport; exports.useThreadViewportStore = useThreadViewportStore; exports.useToolUIs = useToolUIs; exports.useToolUIsStore = useToolUIsStore;
6267
+
6268
+ exports.ActionBarPrimitive = actionBar_exports; exports.AssistantActionBar = assistant_action_bar_default; exports.AssistantMessage = assistant_message_default; exports.AssistantModal = assistant_modal_default; exports.AssistantModalPrimitive = assistantModal_exports; exports.AssistantRuntimeProvider = AssistantRuntimeProvider; exports.AttachmentPrimitive = attachment_exports; exports.BranchPicker = branch_picker_default; exports.BranchPickerPrimitive = branchPicker_exports; exports.Composer = composer_default; exports.ComposerAttachment = composer_attachment_default; exports.ComposerPrimitive = composer_exports; exports.CompositeAttachmentAdapter = CompositeAttachmentAdapter; exports.ContentPart = content_part_default; exports.ContentPartPrimitive = contentPart_exports; exports.EdgeChatAdapter = EdgeChatAdapter; exports.EditComposer = edit_composer_default; exports.INTERNAL = internal_exports; exports.MessagePrimitive = message_exports; exports.SimpleImageAttachmentAdapter = SimpleImageAttachmentAdapter; exports.SimpleTextAttachmentAdapter = SimpleTextAttachmentAdapter; exports.TextContentPartProvider = TextContentPartProvider; exports.Thread = thread_default; exports.ThreadConfigProvider = ThreadConfigProvider; exports.ThreadPrimitive = thread_exports; exports.ThreadWelcome = thread_welcome_default; exports.UserActionBar = user_action_bar_default; exports.UserMessage = user_message_default; exports.UserMessageAttachment = user_message_attachment_default; exports.WebSpeechSynthesisAdapter = WebSpeechSynthesisAdapter; exports.fromCoreMessage = fromCoreMessage; exports.fromCoreMessages = fromCoreMessages; exports.fromLanguageModelMessages = fromLanguageModelMessages; exports.fromLanguageModelTools = fromLanguageModelTools; exports.getExternalStoreMessage = getExternalStoreMessage; exports.makeAssistantTool = makeAssistantTool; exports.makeAssistantToolUI = makeAssistantToolUI; exports.streamUtils = streamUtils; exports.subscribeToMainThread = subscribeToMainThread; exports.toCoreMessage = _chunkKVXP3Q6Kjs.toCoreMessage; exports.toCoreMessages = _chunkKVXP3Q6Kjs.toCoreMessages; exports.toLanguageModelMessages = _chunkKVXP3Q6Kjs.toLanguageModelMessages; exports.toLanguageModelTools = _chunkKVXP3Q6Kjs.toLanguageModelTools; exports.useActionBarCopy = useActionBarCopy; exports.useActionBarEdit = useActionBarEdit; exports.useActionBarFeedbackNegative = useActionBarFeedbackNegative; exports.useActionBarFeedbackPositive = useActionBarFeedbackPositive; exports.useActionBarReload = useActionBarReload; exports.useActionBarSpeak = useActionBarSpeak; exports.useActionBarStopSpeaking = useActionBarStopSpeaking; exports.useAppendMessage = useAppendMessage; exports.useAssistantActions = useAssistantActions; exports.useAssistantActionsStore = useAssistantActionsStore; exports.useAssistantContext = useAssistantContext; exports.useAssistantInstructions = useAssistantInstructions; exports.useAssistantRuntime = useAssistantRuntime; exports.useAssistantRuntimeStore = useAssistantRuntimeStore; exports.useAssistantTool = useAssistantTool; exports.useAssistantToolUI = useAssistantToolUI; exports.useBranchPickerCount = useBranchPickerCount; exports.useBranchPickerNext = useBranchPickerNext; exports.useBranchPickerNumber = useBranchPickerNumber; exports.useBranchPickerPrevious = useBranchPickerPrevious; exports.useComposer = useComposer; exports.useComposerAddAttachment = useComposerAddAttachment; exports.useComposerCancel = useComposerCancel; exports.useComposerContext = useComposerContext; exports.useComposerIf = useComposerIf; exports.useComposerRuntime = useComposerRuntime; exports.useComposerSend = useComposerSend; exports.useComposerStore = useComposerStore; exports.useContentPart = useContentPart; exports.useContentPartContext = useContentPartContext; exports.useContentPartDisplay = useContentPartDisplay; exports.useContentPartImage = useContentPartImage; exports.useContentPartRuntime = useContentPartRuntime; exports.useContentPartStore = useContentPartStore; exports.useContentPartText = useContentPartText; exports.useDangerousInBrowserRuntime = useDangerousInBrowserRuntime; exports.useEdgeRuntime = useEdgeRuntime; exports.useEditComposer = useEditComposer; exports.useEditComposerStore = useEditComposerStore; exports.useExternalMessageConverter = useExternalMessageConverter; exports.useExternalStoreRuntime = useExternalStoreRuntime; exports.useLocalRuntime = useLocalRuntime; exports.useMessage = useMessage; exports.useMessageContext = useMessageContext; exports.useMessageIf = useMessageIf; exports.useMessageRuntime = useMessageRuntime; exports.useMessageStore = useMessageStore; exports.useMessageUtils = useMessageUtils; exports.useMessageUtilsStore = useMessageUtilsStore; exports.useSwitchToNewThread = useSwitchToNewThread; exports.useThread = useThread; exports.useThreadActions = useThreadActions; exports.useThreadActionsStore = useThreadActionsStore; exports.useThreadComposer = useThreadComposer; exports.useThreadComposerStore = useThreadComposerStore; exports.useThreadConfig = useThreadConfig; exports.useThreadContext = useThreadContext; exports.useThreadEmpty = useThreadEmpty; exports.useThreadIf = useThreadIf; exports.useThreadMessages = useThreadMessages; exports.useThreadMessagesStore = useThreadMessagesStore; exports.useThreadRuntime = useThreadRuntime; exports.useThreadRuntimeStore = useThreadRuntimeStore; exports.useThreadScrollToBottom = useThreadScrollToBottom; exports.useThreadStore = useThreadStore; exports.useThreadSuggestion = useThreadSuggestion; exports.useThreadViewport = useThreadViewport; exports.useThreadViewportStore = useThreadViewportStore; exports.useToolUIs = useToolUIs; exports.useToolUIsStore = useToolUIsStore;
6232
6269
  //# sourceMappingURL=index.js.map