@superinterface/react 2.17.5 → 2.19.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs CHANGED
@@ -397,6 +397,9 @@ __export(src_exports, {
397
397
  AudioThreadDialog: function() {
398
398
  return AudioThreadDialog;
399
399
  },
400
+ Avatar: function() {
401
+ return Avatar6;
402
+ },
400
403
  ComponentsProvider: function() {
401
404
  return ComponentsProvider;
402
405
  },
@@ -433,6 +436,9 @@ __export(src_exports, {
433
436
  UserAvatarContext: function() {
434
437
  return UserAvatarContext;
435
438
  },
439
+ useAssistant: function() {
440
+ return useAssistant;
441
+ },
436
442
  useComponents: function() {
437
443
  return useComponents;
438
444
  },
@@ -1917,7 +1923,6 @@ var useInfiniteScroll = function(param) {
1917
1923
  if (isFetchingNextPage) return;
1918
1924
  if (!inView) return;
1919
1925
  if (!hasNextPage) return;
1920
- console.log("Fetching next page");
1921
1926
  fetchNextPage();
1922
1927
  }, 500, [
1923
1928
  inView,
@@ -3394,25 +3399,123 @@ var import_react39 = require("react");
3394
3399
  var useMessageContext = function() {
3395
3400
  return (0, import_react39.useContext)(MessageContext);
3396
3401
  };
3402
+ // src/hooks/assistants/useAssistant/index.ts
3403
+ var import_react40 = require("react");
3404
+ var import_react_query8 = require("@tanstack/react-query");
3405
+ // src/hooks/assistants/useAssistant/lib/queryOptions/index.ts
3406
+ var import_react_query7 = require("@tanstack/react-query");
3407
+ // src/hooks/assistants/useAssistant/lib/queryOptions/queryFn.ts
3408
+ var queryFn = function(param) {
3409
+ var superinterfaceContext = param.superinterfaceContext;
3410
+ return function() {
3411
+ var _ref = _async_to_generator(function(param) {
3412
+ var queryKey, _queryKey, _key, assistantId, params;
3413
+ return _ts_generator(this, function(_state) {
3414
+ queryKey = param.queryKey;
3415
+ _queryKey = _sliced_to_array(queryKey, 2), _key = _queryKey[0], assistantId = _queryKey[1].assistantId;
3416
+ params = new URLSearchParams({
3417
+ publicApiKey: superinterfaceContext.variables.publicApiKey
3418
+ });
3419
+ return [
3420
+ 2,
3421
+ fetch("".concat(superinterfaceContext.baseUrl, "/assistants/").concat(assistantId, "?").concat(params)).then(function() {
3422
+ var _ref = _async_to_generator(function(response) {
3423
+ var errorResponse, error;
3424
+ return _ts_generator(this, function(_state) {
3425
+ switch(_state.label){
3426
+ case 0:
3427
+ if (!(response.status !== 200)) return [
3428
+ 3,
3429
+ 4
3430
+ ];
3431
+ _state.label = 1;
3432
+ case 1:
3433
+ _state.trys.push([
3434
+ 1,
3435
+ 3,
3436
+ ,
3437
+ 4
3438
+ ]);
3439
+ return [
3440
+ 4,
3441
+ response.json()
3442
+ ];
3443
+ case 2:
3444
+ errorResponse = _state.sent();
3445
+ throw new Error(errorResponse.error);
3446
+ case 3:
3447
+ error = _state.sent();
3448
+ throw new Error("Failed to fetch");
3449
+ case 4:
3450
+ return [
3451
+ 2,
3452
+ response.json()
3453
+ ];
3454
+ }
3455
+ });
3456
+ });
3457
+ return function(response) {
3458
+ return _ref.apply(this, arguments);
3459
+ };
3460
+ }())
3461
+ ];
3462
+ });
3463
+ });
3464
+ return function(_) {
3465
+ return _ref.apply(this, arguments);
3466
+ };
3467
+ }();
3468
+ };
3469
+ // src/hooks/assistants/useAssistant/lib/queryOptions/index.ts
3470
+ var queryOptions2 = function(param) {
3471
+ var assistantId = param.assistantId, superinterfaceContext = param.superinterfaceContext;
3472
+ return (0, import_react_query7.queryOptions)({
3473
+ queryKey: [
3474
+ "assistants",
3475
+ {
3476
+ assistantId: assistantId
3477
+ }
3478
+ ],
3479
+ queryFn: queryFn({
3480
+ superinterfaceContext: superinterfaceContext
3481
+ })
3482
+ });
3483
+ };
3484
+ // src/hooks/assistants/useAssistant/index.ts
3485
+ var useAssistant = function(param) {
3486
+ var assistantId = param.assistantId;
3487
+ var superinterfaceContext = useSuperinterfaceContext();
3488
+ var props = (0, import_react_query8.useQuery)(queryOptions2({
3489
+ assistantId: assistantId,
3490
+ superinterfaceContext: superinterfaceContext
3491
+ }));
3492
+ return (0, import_react40.useMemo)(function() {
3493
+ return _object_spread_props(_object_spread({}, props), {
3494
+ assistant: props.data ? props.data.assistant : null
3495
+ });
3496
+ }, [
3497
+ props
3498
+ ]);
3499
+ };
3397
3500
  // src/components/threads/ThreadDialog/Provider/index.tsx
3398
- var import_react42 = require("react");
3501
+ var import_react43 = require("react");
3399
3502
  // src/contexts/threads/ThreadDialogContext/index.ts
3400
- var import_react40 = require("react");
3401
- var ThreadDialogContext = (0, import_react40.createContext)({
3503
+ var import_react41 = require("react");
3504
+ var ThreadDialogContext = (0, import_react41.createContext)({
3402
3505
  isOpen: false,
3403
3506
  setIsOpen: function() {}
3404
3507
  });
3405
3508
  // src/hooks/threads/useThreadDialogContext/index.ts
3406
- var import_react41 = require("react");
3509
+ var import_react42 = require("react");
3407
3510
  var useThreadDialogContext = function() {
3408
- return (0, import_react41.useContext)(ThreadDialogContext);
3511
+ return (0, import_react42.useContext)(ThreadDialogContext);
3409
3512
  };
3410
3513
  // src/components/threads/ThreadDialog/Provider/index.tsx
3411
3514
  var import_jsx_runtime57 = require("react/jsx-runtime");
3412
3515
  var Provider3 = function(param) {
3413
3516
  var children = param.children;
3414
3517
  var threadDialogContext = useThreadDialogContext();
3415
- var _ref = _sliced_to_array((0, import_react42.useState)(threadDialogContext.isOpen), 2), isOpen = _ref[0], setIsOpen = _ref[1];
3518
+ var _ref = _sliced_to_array((0, import_react43.useState)(threadDialogContext.isOpen), 2), isOpen = _ref[0], setIsOpen = _ref[1];
3416
3519
  return /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(ThreadDialogContext.Provider, {
3417
3520
  value: {
3418
3521
  isOpen: isOpen,
@@ -3422,7 +3525,7 @@ var Provider3 = function(param) {
3422
3525
  });
3423
3526
  };
3424
3527
  // src/components/toasts/ToastsProvider/index.tsx
3425
- var import_react43 = require("react");
3528
+ var import_react44 = require("react");
3426
3529
  var Toast2 = __toESM(require("@radix-ui/react-toast"), 1);
3427
3530
  // src/components/toasts/ToastsProvider/CustomToast.tsx
3428
3531
  var Toast = __toESM(require("@radix-ui/react-toast"), 1);
@@ -3461,8 +3564,8 @@ var CustomToast = function(param) {
3461
3564
  var import_jsx_runtime59 = require("react/jsx-runtime");
3462
3565
  var ToastsProvider = function(param) {
3463
3566
  var children = param.children;
3464
- var _ref = _sliced_to_array((0, import_react43.useState)([]), 2), toasts = _ref[0], setToasts = _ref[1];
3465
- var addToast = (0, import_react43.useCallback)(function(toast) {
3567
+ var _ref = _sliced_to_array((0, import_react44.useState)([]), 2), toasts = _ref[0], setToasts = _ref[1];
3568
+ var addToast = (0, import_react44.useCallback)(function(toast) {
3466
3569
  return setToasts(function(prevToasts) {
3467
3570
  return _to_consumable_array(prevToasts).concat([
3468
3571
  toast
@@ -3709,8 +3812,8 @@ ThreadDialog.Content = Content4;
3709
3812
  // src/components/threads/AudioThread/Root/index.tsx
3710
3813
  var import_themes45 = require("@radix-ui/themes");
3711
3814
  // src/contexts/threads/AudioThreadContext/index.ts
3712
- var import_react44 = require("react");
3713
- var AudioThreadContext = (0, import_react44.createContext)({
3815
+ var import_react45 = require("react");
3816
+ var AudioThreadContext = (0, import_react45.createContext)({
3714
3817
  status: "idle",
3715
3818
  recorderProps: {
3716
3819
  status: "idle",
@@ -3766,7 +3869,7 @@ var AudioThreadContext = (0, import_react44.createContext)({
3766
3869
  }
3767
3870
  });
3768
3871
  // src/hooks/misc/usePermission/index.ts
3769
- var import_react45 = require("react");
3872
+ var import_react46 = require("react");
3770
3873
  // src/hooks/misc/usePermission/util.ts
3771
3874
  var noop = function() {};
3772
3875
  function on(obj) {
@@ -3789,8 +3892,8 @@ function off(obj) {
3789
3892
  }
3790
3893
  // src/hooks/misc/usePermission/index.ts
3791
3894
  var usePermission = function(permissionDesc) {
3792
- var _ref = _sliced_to_array((0, import_react45.useState)(""), 2), state = _ref[0], setState = _ref[1];
3793
- (0, import_react45.useEffect)(function() {
3895
+ var _ref = _sliced_to_array((0, import_react46.useState)(""), 2), state = _ref[0], setState = _ref[1];
3896
+ (0, import_react46.useEffect)(function() {
3794
3897
  var mounted = true;
3795
3898
  var permissionStatus = null;
3796
3899
  var onChange = function() {
@@ -3828,11 +3931,11 @@ var blobToData = function(blob) {
3828
3931
  });
3829
3932
  };
3830
3933
  // src/hooks/audioThreads/useStatus/index.ts
3831
- var import_react46 = require("react");
3934
+ var import_react47 = require("react");
3832
3935
  var useStatus = function(param) {
3833
3936
  var messageAudioProps = param.messageAudioProps, recorderProps = param.recorderProps, createMessageProps = param.createMessageProps;
3834
3937
  var latestMessageProps = useLatestMessage();
3835
- var status = (0, import_react46.useMemo)(function() {
3938
+ var status = (0, import_react47.useMemo)(function() {
3836
3939
  var _latestMessageProps_latestMessage;
3837
3940
  if (recorderProps.status === "recording") return "recording";
3838
3941
  if (createMessageProps.isPending) return "creatingMessage";
@@ -3856,16 +3959,16 @@ var useStatus = function(param) {
3856
3959
  // src/hooks/audioThreads/useRecorder/index.ts
3857
3960
  var import_dayjs3 = __toESM(require("dayjs"), 1);
3858
3961
  var import_use_audio_capture = require("use-audio-capture");
3859
- var import_react48 = require("react");
3962
+ var import_react49 = require("react");
3860
3963
  var import_react_use_audio_player = require("react-use-audio-player");
3861
3964
  // src/hooks/misc/useInterval.ts
3862
- var import_react47 = require("react");
3965
+ var import_react48 = require("react");
3863
3966
  var useInterval = function(callback, delay) {
3864
- var savedCallback = (0, import_react47.useRef)(function() {});
3865
- (0, import_react47.useEffect)(function() {
3967
+ var savedCallback = (0, import_react48.useRef)(function() {});
3968
+ (0, import_react48.useEffect)(function() {
3866
3969
  savedCallback.current = callback;
3867
3970
  });
3868
- (0, import_react47.useEffect)(function() {
3971
+ (0, import_react48.useEffect)(function() {
3869
3972
  if (delay !== null) {
3870
3973
  var interval = setInterval(function() {
3871
3974
  return savedCallback.current();
@@ -3882,14 +3985,14 @@ var useInterval = function(callback, delay) {
3882
3985
  // src/hooks/audioThreads/useRecorder/index.ts
3883
3986
  var useRecorder = function(param) {
3884
3987
  var isStopOnSilence = param.isStopOnSilence, onStart = param.onStart, onStop = param.onStop;
3885
- var _ref = _sliced_to_array((0, import_react48.useState)(null), 2), silenceStart = _ref[0], setSilenceStart = _ref[1];
3886
- var _ref1 = _sliced_to_array((0, import_react48.useState)(null), 2), noiseStart = _ref1[0], setNoiseStart = _ref1[1];
3887
- var _ref2 = _sliced_to_array((0, import_react48.useState)(null), 2), mediaStream = _ref2[0], setMediaStream = _ref2[1];
3888
- var _ref3 = _sliced_to_array((0, import_react48.useState)("idle"), 2), status = _ref3[0], setStatus = _ref3[1];
3988
+ var _ref = _sliced_to_array((0, import_react49.useState)(null), 2), silenceStart = _ref[0], setSilenceStart = _ref[1];
3989
+ var _ref1 = _sliced_to_array((0, import_react49.useState)(null), 2), noiseStart = _ref1[0], setNoiseStart = _ref1[1];
3990
+ var _ref2 = _sliced_to_array((0, import_react49.useState)(null), 2), mediaStream = _ref2[0], setMediaStream = _ref2[1];
3991
+ var _ref3 = _sliced_to_array((0, import_react49.useState)("idle"), 2), status = _ref3[0], setStatus = _ref3[1];
3889
3992
  var startAudioPlayer = (0, import_react_use_audio_player.useAudioPlayer)();
3890
3993
  var endAudioPlayer = (0, import_react_use_audio_player.useAudioPlayer)();
3891
- var _ref4 = _sliced_to_array((0, import_react48.useState)(false), 2), isLoaded = _ref4[0], setIsLoaded = _ref4[1];
3892
- (0, import_react48.useEffect)(function() {
3994
+ var _ref4 = _sliced_to_array((0, import_react49.useState)(false), 2), isLoaded = _ref4[0], setIsLoaded = _ref4[1];
3995
+ (0, import_react49.useEffect)(function() {
3893
3996
  if (isLoaded) return;
3894
3997
  setIsLoaded(true);
3895
3998
  }, [
@@ -3947,9 +4050,9 @@ var useRecorder = function(param) {
3947
4050
  setNoiseStart(null);
3948
4051
  }
3949
4052
  });
3950
- var _ref5 = _sliced_to_array((0, import_react48.useState)(null), 2), audioEngine = _ref5[0], setAudioEngine = _ref5[1];
3951
- var isInited = (0, import_react48.useRef)(false);
3952
- (0, import_react48.useEffect)(function() {
4053
+ var _ref5 = _sliced_to_array((0, import_react49.useState)(null), 2), audioEngine = _ref5[0], setAudioEngine = _ref5[1];
4054
+ var isInited = (0, import_react49.useRef)(false);
4055
+ (0, import_react49.useEffect)(function() {
3953
4056
  if (!mediaStream) return;
3954
4057
  if (isInited.current) return;
3955
4058
  isInited.current = true;
@@ -3962,7 +4065,7 @@ var useRecorder = function(param) {
3962
4065
  isInited,
3963
4066
  mediaStream
3964
4067
  ]);
3965
- var visualizationAnalyser = (0, import_react48.useMemo)(function() {
4068
+ var visualizationAnalyser = (0, import_react49.useMemo)(function() {
3966
4069
  if (!audioEngine) return null;
3967
4070
  var result = audioEngine.audioContext.createAnalyser();
3968
4071
  audioEngine.source.connect(result);
@@ -3970,7 +4073,7 @@ var useRecorder = function(param) {
3970
4073
  }, [
3971
4074
  audioEngine
3972
4075
  ]);
3973
- var silenceAnalyser = (0, import_react48.useMemo)(function() {
4076
+ var silenceAnalyser = (0, import_react49.useMemo)(function() {
3974
4077
  if (!audioEngine) return null;
3975
4078
  var result = audioEngine.audioContext.createAnalyser();
3976
4079
  result.minDecibels = -60;
@@ -3979,7 +4082,7 @@ var useRecorder = function(param) {
3979
4082
  }, [
3980
4083
  audioEngine
3981
4084
  ]);
3982
- var handleSilence = (0, import_react48.useCallback)(function() {
4085
+ var handleSilence = (0, import_react49.useCallback)(function() {
3983
4086
  if (!silenceAnalyser) return;
3984
4087
  var frequencyData = new Uint8Array(silenceAnalyser.frequencyBinCount);
3985
4088
  silenceAnalyser.getByteFrequencyData(frequencyData);
@@ -4002,7 +4105,7 @@ var useRecorder = function(param) {
4002
4105
  setNoiseStart,
4003
4106
  setSilenceStart
4004
4107
  ]);
4005
- (0, import_react48.useEffect)(function() {
4108
+ (0, import_react49.useEffect)(function() {
4006
4109
  if (!isStopOnSilence) return;
4007
4110
  requestAnimationFrame(function() {
4008
4111
  return handleSilence();
@@ -4025,7 +4128,7 @@ var useRecorder = function(param) {
4025
4128
  });
4026
4129
  };
4027
4130
  // src/hooks/audioThreads/useMessageAudio/index.ts
4028
- var import_react49 = require("react");
4131
+ var import_react50 = require("react");
4029
4132
  var import_compromise = __toESM(require("compromise"), 1);
4030
4133
  var import_howler = require("howler");
4031
4134
  var import_react_use_audio_player2 = require("react-use-audio-player");
@@ -4063,15 +4166,15 @@ var getMessageSentences = function(param) {
4063
4166
  };
4064
4167
  var useMessageAudio = function(param) {
4065
4168
  var onEnd = param.onEnd;
4066
- var _ref = _sliced_to_array((0, import_react49.useState)(false), 2), isAudioPlayed = _ref[0], setIsAudioPlayed = _ref[1];
4067
- var _ref1 = _sliced_to_array((0, import_react49.useState)([]), 2), stoppedMessageIds = _ref1[0], setStoppedMessageIds = _ref1[1];
4068
- var _ref2 = _sliced_to_array((0, import_react49.useState)([]), 2), playedMessageSentences = _ref2[0], setPlayedMessageSentences = _ref2[1];
4169
+ var _ref = _sliced_to_array((0, import_react50.useState)(false), 2), isAudioPlayed = _ref[0], setIsAudioPlayed = _ref[1];
4170
+ var _ref1 = _sliced_to_array((0, import_react50.useState)([]), 2), stoppedMessageIds = _ref1[0], setStoppedMessageIds = _ref1[1];
4171
+ var _ref2 = _sliced_to_array((0, import_react50.useState)([]), 2), playedMessageSentences = _ref2[0], setPlayedMessageSentences = _ref2[1];
4069
4172
  var audioPlayer = (0, import_react_use_audio_player2.useAudioPlayer)();
4070
4173
  var nextAudioPlayer = (0, import_react_use_audio_player2.useAudioPlayer)();
4071
4174
  var superinterfaceContext = useSuperinterfaceContext();
4072
- var _ref3 = _sliced_to_array((0, import_react49.useState)(false), 2), isPlaying = _ref3[0], setIsPlaying = _ref3[1];
4175
+ var _ref3 = _sliced_to_array((0, import_react50.useState)(false), 2), isPlaying = _ref3[0], setIsPlaying = _ref3[1];
4073
4176
  var latestMessageProps = useLatestMessage();
4074
- var unplayedMessageSentences = (0, import_react49.useMemo)(function() {
4177
+ var unplayedMessageSentences = (0, import_react50.useMemo)(function() {
4075
4178
  if (!latestMessageProps.latestMessage) return [];
4076
4179
  if (latestMessageProps.latestMessage.role !== "assistant") return [];
4077
4180
  if (stoppedMessageIds.includes(latestMessageProps.latestMessage.id)) return [];
@@ -4092,7 +4195,7 @@ var useMessageAudio = function(param) {
4092
4195
  latestMessageProps,
4093
4196
  playedMessageSentences
4094
4197
  ]);
4095
- (0, import_react49.useEffect)(function() {
4198
+ (0, import_react50.useEffect)(function() {
4096
4199
  if (isPlaying) return;
4097
4200
  if (audioPlayer.playing) return;
4098
4201
  if (!latestMessageProps.latestMessage) return;
@@ -4160,7 +4263,7 @@ var useMessageAudio = function(param) {
4160
4263
  playedMessageSentences,
4161
4264
  onEnd
4162
4265
  ]);
4163
- (0, import_react49.useEffect)(function() {
4266
+ (0, import_react50.useEffect)(function() {
4164
4267
  if (isHtmlAudioSupported) {
4165
4268
  var _import_howler_Howler__howls___sounds_, _import_howler_Howler__howls_, _import_howler_Howler;
4166
4269
  if (!((_import_howler_Howler = import_howler.Howler) === null || _import_howler_Howler === void 0 ? void 0 : (_import_howler_Howler__howls_ = _import_howler_Howler._howls[0]) === null || _import_howler_Howler__howls_ === void 0 ? void 0 : (_import_howler_Howler__howls___sounds_ = _import_howler_Howler__howls_._sounds[0]) === null || _import_howler_Howler__howls___sounds_ === void 0 ? void 0 : _import_howler_Howler__howls___sounds_._node)) return;
@@ -4169,9 +4272,9 @@ var useMessageAudio = function(param) {
4169
4272
  }, [
4170
4273
  audioPlayer
4171
4274
  ]);
4172
- var _ref4 = _sliced_to_array((0, import_react49.useState)(null), 2), audioEngine = _ref4[0], setAudioEngine = _ref4[1];
4173
- var isAudioEngineInited = (0, import_react49.useRef)(false);
4174
- (0, import_react49.useEffect)(function() {
4275
+ var _ref4 = _sliced_to_array((0, import_react50.useState)(null), 2), audioEngine = _ref4[0], setAudioEngine = _ref4[1];
4276
+ var isAudioEngineInited = (0, import_react50.useRef)(false);
4277
+ (0, import_react50.useEffect)(function() {
4175
4278
  if (!audioPlayer.playing) return;
4176
4279
  if (isAudioEngineInited.current) return;
4177
4280
  isAudioEngineInited.current = true;
@@ -4192,7 +4295,7 @@ var useMessageAudio = function(param) {
4192
4295
  audioPlayer,
4193
4296
  isAudioEngineInited
4194
4297
  ]);
4195
- var visualizationAnalyser = (0, import_react49.useMemo)(function() {
4298
+ var visualizationAnalyser = (0, import_react50.useMemo)(function() {
4196
4299
  if (!audioEngine) return null;
4197
4300
  var result = audioEngine.audioContext.createAnalyser();
4198
4301
  audioEngine.source.connect(audioEngine.audioContext.destination);
@@ -4201,7 +4304,7 @@ var useMessageAudio = function(param) {
4201
4304
  }, [
4202
4305
  audioEngine
4203
4306
  ]);
4204
- var isPending = (0, import_react49.useMemo)(function() {
4307
+ var isPending = (0, import_react50.useMemo)(function() {
4205
4308
  return isPlaying || unplayedMessageSentences.length > 0;
4206
4309
  }, [
4207
4310
  isPlaying,
@@ -4288,25 +4391,25 @@ var Root12 = function(param) {
4288
4391
  });
4289
4392
  };
4290
4393
  // src/components/threads/AudioThread/Visualization/index.tsx
4291
- var import_react52 = require("react");
4394
+ var import_react53 = require("react");
4292
4395
  var import_lodash9 = __toESM(require("lodash"), 1);
4293
4396
  var import_themes47 = require("@radix-ui/themes");
4294
4397
  // src/hooks/threads/useAudioThreadContext/index.ts
4295
- var import_react50 = require("react");
4398
+ var import_react51 = require("react");
4296
4399
  var useAudioThreadContext = function() {
4297
- return (0, import_react50.useContext)(AudioThreadContext);
4400
+ return (0, import_react51.useContext)(AudioThreadContext);
4298
4401
  };
4299
4402
  // src/components/threads/AudioThread/BarsVisualizer/index.tsx
4300
4403
  var import_lodash8 = __toESM(require("lodash"), 1);
4301
4404
  var import_themes46 = require("@radix-ui/themes");
4302
- var import_react51 = require("react");
4405
+ var import_react52 = require("react");
4303
4406
  var import_radash16 = require("radash");
4304
4407
  var import_jsx_runtime67 = require("react/jsx-runtime");
4305
4408
  var barCount = 4;
4306
4409
  var BarsVisualizer = function(param) {
4307
4410
  var visualizationAnalyser = param.visualizationAnalyser, backgroundColor = param.backgroundColor, height = param.height, barWidth = param.barWidth;
4308
- var _ref = _sliced_to_array((0, import_react51.useState)([]), 2), barHeights = _ref[0], setBarHeights = _ref[1];
4309
- var draw = (0, import_react51.useCallback)(function(param) {
4411
+ var _ref = _sliced_to_array((0, import_react52.useState)([]), 2), barHeights = _ref[0], setBarHeights = _ref[1];
4412
+ var draw = (0, import_react52.useCallback)(function(param) {
4310
4413
  var visualizationAnalyser2 = param.visualizationAnalyser;
4311
4414
  if (!visualizationAnalyser2) {
4312
4415
  setBarHeights(Array(barCount).fill(0));
@@ -4324,7 +4427,7 @@ var BarsVisualizer = function(param) {
4324
4427
  });
4325
4428
  });
4326
4429
  }, []);
4327
- (0, import_react51.useEffect)(function() {
4430
+ (0, import_react52.useEffect)(function() {
4328
4431
  draw({
4329
4432
  visualizationAnalyser: visualizationAnalyser
4330
4433
  });
@@ -4364,9 +4467,9 @@ var BarsVisualizer = function(param) {
4364
4467
  var import_jsx_runtime68 = require("react/jsx-runtime");
4365
4468
  var Visualization = function() {
4366
4469
  var audioThreadContext = useAudioThreadContext();
4367
- var assistantNameContext = (0, import_react52.useContext)(AssistantNameContext);
4368
- var _ref = _sliced_to_array((0, import_react52.useState)(0), 2), scale = _ref[0], setScale = _ref[1];
4369
- var draw = (0, import_react52.useCallback)(function(param) {
4470
+ var assistantNameContext = (0, import_react53.useContext)(AssistantNameContext);
4471
+ var _ref = _sliced_to_array((0, import_react53.useState)(0), 2), scale = _ref[0], setScale = _ref[1];
4472
+ var draw = (0, import_react53.useCallback)(function(param) {
4370
4473
  var visualizationAnalyser = param.visualizationAnalyser;
4371
4474
  if (!visualizationAnalyser) {
4372
4475
  setScale(1);
@@ -4381,7 +4484,7 @@ var Visualization = function() {
4381
4484
  });
4382
4485
  });
4383
4486
  }, []);
4384
- (0, import_react52.useEffect)(function() {
4487
+ (0, import_react53.useEffect)(function() {
4385
4488
  draw({
4386
4489
  visualizationAnalyser: audioThreadContext.recorderProps.visualizationAnalyser
4387
4490
  });
@@ -4666,9 +4769,9 @@ AudioThreadDialog.Root = Root9;
4666
4769
  AudioThreadDialog.Trigger = Trigger;
4667
4770
  AudioThreadDialog.Content = Content4;
4668
4771
  // src/components/suggestions/Suggestions/index.tsx
4669
- var import_react54 = require("react");
4772
+ var import_react55 = require("react");
4670
4773
  // src/components/suggestions/Suggestions/Content.tsx
4671
- var import_react53 = require("react");
4774
+ var import_react54 = require("react");
4672
4775
  var import_radash17 = require("radash");
4673
4776
  var import_react_children_utilities = require("react-children-utilities");
4674
4777
  var import_themes52 = require("@radix-ui/themes");
@@ -4725,7 +4828,7 @@ var import_jsx_runtime77 = require("react/jsx-runtime");
4725
4828
  var Content6 = function(param) {
4726
4829
  var children = param.children;
4727
4830
  var isMutatingMessage = useIsMutatingMessage();
4728
- var suggestions = (0, import_react53.useMemo)(function() {
4831
+ var suggestions = (0, import_react54.useMemo)(function() {
4729
4832
  return (0, import_react_children_utilities.onlyText)(children).split(/\r?\n/).filter(function(c) {
4730
4833
  return !(0, import_radash17.isEmpty)(c);
4731
4834
  }).map(function(c) {
@@ -4752,7 +4855,7 @@ var import_jsx_runtime78 = require("react/jsx-runtime");
4752
4855
  var Suggestions = function(param) {
4753
4856
  var children = param.children;
4754
4857
  var latestMessageProps = useLatestMessage();
4755
- var isDisabled = (0, import_react54.useMemo)(function() {
4858
+ var isDisabled = (0, import_react55.useMemo)(function() {
4756
4859
  var // @ts-ignore-next-line
4757
4860
  _latestMessageProps_latestMessage_metadata, _latestMessageProps_latestMessage;
4758
4861
  return (_latestMessageProps_latestMessage = latestMessageProps.latestMessage) === null || _latestMessageProps_latestMessage === void 0 ? void 0 : (_latestMessageProps_latestMessage_metadata = _latestMessageProps_latestMessage.metadata) === null || _latestMessageProps_latestMessage_metadata === void 0 ? void 0 : _latestMessageProps_latestMessage_metadata.isBlocking;
@@ -4767,14 +4870,14 @@ var Suggestions = function(param) {
4767
4870
  };
4768
4871
  Suggestions.Item = Item;
4769
4872
  // src/components/markdown/MarkdownProvider/index.tsx
4770
- var import_react55 = require("react");
4873
+ var import_react56 = require("react");
4771
4874
  var import_jsx_runtime79 = require("react/jsx-runtime");
4772
4875
  var MarkdownProvider = function(_param) {
4773
4876
  var children = _param.children, rest = _object_without_properties(_param, [
4774
4877
  "children"
4775
4878
  ]);
4776
4879
  var prevMarkdownContext = useMarkdownContext();
4777
- var value = (0, import_react55.useMemo)(function() {
4880
+ var value = (0, import_react56.useMemo)(function() {
4778
4881
  return merge(prevMarkdownContext, rest);
4779
4882
  }, [
4780
4883
  rest,
@@ -4785,27 +4888,108 @@ var MarkdownProvider = function(_param) {
4785
4888
  children: children
4786
4889
  });
4787
4890
  };
4788
- // src/components/components/ComponentsProvider.tsx
4891
+ // src/components/avatars/Avatar.tsx
4892
+ var import_themes55 = require("@radix-ui/themes");
4893
+ // src/components/imageAvatars/ImageAvatar.tsx
4894
+ var import_themes53 = require("@radix-ui/themes");
4895
+ var import_jsx_runtime80 = require("react/jsx-runtime");
4896
+ var width = function(param) {
4897
+ var size = param.size;
4898
+ if (size === "1") {
4899
+ return 48;
4900
+ } else if (size === "3") {
4901
+ return 96;
4902
+ }
4903
+ return 96;
4904
+ };
4905
+ var optimizedSrc = function(param) {
4906
+ var imageAvatar = param.imageAvatar, size = param.size, superinterfaceContext = param.superinterfaceContext;
4907
+ if (!imageAvatar.url) return "";
4908
+ if (imageAvatar.url.endsWith(".svg")) return imageAvatar.url;
4909
+ if (!superinterfaceContext.baseUrl) return imageAvatar.url;
4910
+ var baseUrl2 = new URL(superinterfaceContext.baseUrl);
4911
+ return new URL("/_next/image?url=".concat(encodeURIComponent(imageAvatar.url), "&w=").concat(width({
4912
+ size: size
4913
+ }), "&q=95"), "".concat(baseUrl2.origin)).toString();
4914
+ };
4915
+ var ImageAvatar = function(param) {
4916
+ var imageAvatar = param.imageAvatar, size = param.size;
4917
+ var superinterfaceContext = useSuperinterfaceContext();
4918
+ return /* @__PURE__ */ (0, import_jsx_runtime80.jsx)(import_themes53.Avatar, {
4919
+ fallback: "",
4920
+ src: optimizedSrc({
4921
+ imageAvatar: imageAvatar,
4922
+ size: size,
4923
+ superinterfaceContext: superinterfaceContext
4924
+ }),
4925
+ size: size
4926
+ });
4927
+ };
4928
+ // src/components/iconAvatars/IconAvatar.tsx
4789
4929
  var import_react57 = require("react");
4930
+ var import_themes54 = require("@radix-ui/themes");
4931
+ // src/lib/iconAvatars/iconAvatarComponents.ts
4932
+ var import_react_icons15 = require("@radix-ui/react-icons");
4933
+ var _obj;
4934
+ var iconAvatarComponents = (_obj = {}, _define_property(_obj, "BACKPACK" /* BACKPACK */ , import_react_icons15.BackpackIcon), _define_property(_obj, "ROCKET" /* ROCKET */ , import_react_icons15.RocketIcon), _define_property(_obj, "MAGIC_WAND" /* MAGIC_WAND */ , import_react_icons15.MagicWandIcon), _define_property(_obj, "CUBE" /* CUBE */ , import_react_icons15.CubeIcon), _define_property(_obj, "TARGET" /* TARGET */ , import_react_icons15.TargetIcon), _define_property(_obj, "DISC" /* DISC */ , import_react_icons15.DiscIcon), _define_property(_obj, "GLOBE" /* GLOBE */ , import_react_icons15.GlobeIcon), _define_property(_obj, "STAR" /* STAR */ , import_react_icons15.StarIcon), _define_property(_obj, "LIGHTNING_BOLT" /* LIGHTNING_BOLT */ , import_react_icons15.LightningBoltIcon), _define_property(_obj, "FACE" /* FACE */ , import_react_icons15.FaceIcon), _define_property(_obj, "PERSON" /* PERSON */ , import_react_icons15.PersonIcon), _define_property(_obj, "HEART" /* HEART */ , import_react_icons15.HeartIcon), _obj);
4935
+ // src/components/iconAvatars/IconAvatar.tsx
4936
+ var import_jsx_runtime81 = require("react/jsx-runtime");
4937
+ var IconAvatar = function(param) {
4938
+ var iconAvatar = param.iconAvatar, size = param.size;
4939
+ var Component = (0, import_react57.useMemo)(function() {
4940
+ return iconAvatarComponents[iconAvatar.name];
4941
+ }, [
4942
+ iconAvatar
4943
+ ]);
4944
+ return /* @__PURE__ */ (0, import_jsx_runtime81.jsx)(import_themes54.Avatar, {
4945
+ size: size,
4946
+ fallback: Component ? /* @__PURE__ */ (0, import_jsx_runtime81.jsx)(Component, {}) : ""
4947
+ });
4948
+ };
4949
+ // src/components/avatars/Avatar.tsx
4950
+ var import_jsx_runtime82 = require("react/jsx-runtime");
4951
+ var Avatar6 = function(param) {
4952
+ var avatar = param.avatar, _param_size = param.size, size = _param_size === void 0 ? "1" : _param_size;
4953
+ if (avatar) {
4954
+ if (avatar.type === "IMAGE" /* IMAGE */ && avatar.imageAvatar) {
4955
+ return /* @__PURE__ */ (0, import_jsx_runtime82.jsx)(ImageAvatar, {
4956
+ imageAvatar: avatar.imageAvatar,
4957
+ size: size
4958
+ });
4959
+ }
4960
+ if (avatar.type === "ICON" /* ICON */ && avatar.iconAvatar) {
4961
+ return /* @__PURE__ */ (0, import_jsx_runtime82.jsx)(IconAvatar, {
4962
+ iconAvatar: avatar.iconAvatar,
4963
+ size: size
4964
+ });
4965
+ }
4966
+ }
4967
+ return /* @__PURE__ */ (0, import_jsx_runtime82.jsx)(import_themes55.Avatar, {
4968
+ fallback: "",
4969
+ size: size
4970
+ });
4971
+ };
4972
+ // src/components/components/ComponentsProvider.tsx
4973
+ var import_react59 = require("react");
4790
4974
  // src/hooks/components/useComponents.ts
4791
- var import_react56 = require("react");
4975
+ var import_react58 = require("react");
4792
4976
  var useComponents = function() {
4793
- return (0, import_react56.useContext)(ComponentsContext);
4977
+ return (0, import_react58.useContext)(ComponentsContext);
4794
4978
  };
4795
4979
  // src/components/components/ComponentsProvider.tsx
4796
- var import_jsx_runtime80 = require("react/jsx-runtime");
4980
+ var import_jsx_runtime83 = require("react/jsx-runtime");
4797
4981
  var ComponentsProvider = function(_param) {
4798
4982
  var children = _param.children, rest = _object_without_properties(_param, [
4799
4983
  "children"
4800
4984
  ]);
4801
4985
  var prevComponents = useComponents();
4802
- var value = (0, import_react57.useMemo)(function() {
4986
+ var value = (0, import_react59.useMemo)(function() {
4803
4987
  return merge(prevComponents, rest);
4804
4988
  }, [
4805
4989
  rest,
4806
4990
  prevComponents
4807
4991
  ]);
4808
- return /* @__PURE__ */ (0, import_jsx_runtime80.jsx)(ComponentsContext.Provider, {
4992
+ return /* @__PURE__ */ (0, import_jsx_runtime83.jsx)(ComponentsContext.Provider, {
4809
4993
  value: value,
4810
4994
  children: children
4811
4995
  });
@@ -4816,6 +5000,7 @@ var ComponentsProvider = function(_param) {
4816
5000
  AssistantNameContext: AssistantNameContext,
4817
5001
  AudioThread: AudioThread,
4818
5002
  AudioThreadDialog: AudioThreadDialog,
5003
+ Avatar: Avatar,
4819
5004
  ComponentsProvider: ComponentsProvider,
4820
5005
  FunctionBase: FunctionBase,
4821
5006
  FunctionComponentsContext: FunctionComponentsContext,
@@ -4828,6 +5013,7 @@ var ComponentsProvider = function(_param) {
4828
5013
  ThreadDialog: ThreadDialog,
4829
5014
  ThreadDialogContext: ThreadDialogContext,
4830
5015
  UserAvatarContext: UserAvatarContext,
5016
+ useAssistant: useAssistant,
4831
5017
  useComponents: useComponents,
4832
5018
  useCreateMessage: useCreateMessage,
4833
5019
  useLatestMessage: useLatestMessage,