@superinterface/react 5.3.0-beta.1 → 5.3.0-beta.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs CHANGED
@@ -47017,11 +47017,11 @@ ThreadDialog.Root = Root13;
47017
47017
  ThreadDialog.Trigger = Trigger;
47018
47018
  ThreadDialog.Content = Content8;
47019
47019
  // src/components/threads/AudioThreadDialog/index.tsx
47020
- var import_react_compiler_runtime99 = require("react-compiler-runtime");
47020
+ var import_react_compiler_runtime100 = require("react-compiler-runtime");
47021
47021
  // src/components/threads/AudioThread/index.tsx
47022
- var import_react_compiler_runtime98 = require("react-compiler-runtime");
47022
+ var import_react_compiler_runtime99 = require("react-compiler-runtime");
47023
47023
  // src/components/threads/AudioThread/Root/index.tsx
47024
- var import_react_compiler_runtime90 = require("react-compiler-runtime");
47024
+ var import_react_compiler_runtime91 = require("react-compiler-runtime");
47025
47025
  var import_themes58 = require("@radix-ui/themes");
47026
47026
  // src/contexts/threads/AudioThreadContext/index.ts
47027
47027
  var import_react62 = require("react");
@@ -47034,9 +47034,9 @@ var useAudioThreadContext = function() {
47034
47034
  return (0, import_react63.useContext)(AudioThreadContext);
47035
47035
  };
47036
47036
  // src/components/audioRuntimes/TtsAudioRuntimeProvider.tsx
47037
- var import_react_compiler_runtime89 = require("react-compiler-runtime");
47037
+ var import_react_compiler_runtime90 = require("react-compiler-runtime");
47038
47038
  // src/hooks/audioRuntimes/useTtsAudioRuntime/index.ts
47039
- var import_react_compiler_runtime88 = require("react-compiler-runtime");
47039
+ var import_react_compiler_runtime89 = require("react-compiler-runtime");
47040
47040
  var import_react68 = require("react");
47041
47041
  // src/hooks/misc/usePermission/index.ts
47042
47042
  var import_react_compiler_runtime86 = require("react-compiler-runtime");
@@ -47368,6 +47368,7 @@ var useRecorder = function(_ref) {
47368
47368
  });
47369
47369
  };
47370
47370
  // src/hooks/audioThreads/useMessageAudio/index.ts
47371
+ var import_react_compiler_runtime88 = require("react-compiler-runtime");
47371
47372
  var import_react67 = require("react");
47372
47373
  var import_compromise = __toESM(require("compromise"), 1);
47373
47374
  var import_howler = require("howler");
@@ -47437,232 +47438,427 @@ function _toPrimitive47(t, r) {
47437
47438
  }
47438
47439
  return ("string" === r ? String : Number)(t);
47439
47440
  }
47440
- var getMessageSentences = function(_ref) {
47441
- var messageId = _ref.messageId, input2 = _ref.input;
47442
- var sentences = (0, import_compromise.default)(input2).sentences().json();
47443
- return sentences.map(function(sentence) {
47444
- return {
47445
- messageId: messageId,
47446
- sentence: sentence.text
47447
- };
47441
+ var segment = function(input2) {
47442
+ return (0, import_compromise.default)(input2).sentences().json().map(function(s) {
47443
+ return s.text;
47448
47444
  });
47449
47445
  };
47450
- var useMessageAudio = function(_ref2) {
47451
- var _latestMessageProps$l2;
47452
- var _onEnd = _ref2.onEnd, passedPlay = _ref2.play, _ref2_fullSentenceRegex = _ref2.fullSentenceRegex, fullSentenceRegex = _ref2_fullSentenceRegex === void 0 ? /[\.?!]$/ : _ref2_fullSentenceRegex;
47446
+ var useMessageAudio = function(t0) {
47447
+ var $ = (0, import_react_compiler_runtime88.c)(41);
47448
+ var _onEnd = t0.onEnd, passedPlay = t0.play, t1 = t0.fullSentenceRegex;
47449
+ var t2;
47450
+ if ($[0] !== t1) {
47451
+ t2 = t1 === void 0 ? /[\.?!]$/ : t1;
47452
+ $[0] = t1;
47453
+ $[1] = t2;
47454
+ } else {
47455
+ t2 = $[1];
47456
+ }
47457
+ var fullSentenceRegex = t2;
47453
47458
  var _ref = _sliced_to_array((0, import_react67.useState)(false), 2), isAudioPlayed = _ref[0], setIsAudioPlayed = _ref[1];
47454
- var _ref1 = _sliced_to_array((0, import_react67.useState)([]), 2), stoppedMessageIds = _ref1[0], setStoppedMessageIds = _ref1[1];
47455
- var _ref3 = _sliced_to_array((0, import_react67.useState)([]), 2), playedMessageSentences = _ref3[0], setPlayedMessageSentences = _ref3[1];
47456
47459
  var audioPlayer = (0, import_react_use_audio_player2.useAudioPlayer)();
47457
47460
  var nextAudioPlayer = (0, import_react_use_audio_player2.useAudioPlayer)();
47458
47461
  var superinterfaceContext = useSuperinterfaceContext();
47459
- var _ref4 = _sliced_to_array((0, import_react67.useState)(false), 2), isPlaying = _ref4[0], setIsPlaying = _ref4[1];
47460
- var isLastSentencePlayedRef = (0, import_react67.useRef)(false);
47461
- var latestMessageProps = useLatestMessage();
47462
+ var _ref1 = _sliced_to_array((0, import_react67.useState)(false), 2), isPlaying = _ref1[0], setIsPlaying = _ref1[1];
47463
+ var t3;
47464
+ if ($[2] === Symbol.for("react.memo_cache_sentinel")) {
47465
+ t3 = [];
47466
+ $[2] = t3;
47467
+ } else {
47468
+ t3 = $[2];
47469
+ }
47470
+ var _ref2 = _sliced_to_array((0, import_react67.useState)(t3), 2), audioQueue = _ref2[0], setAudioQueue = _ref2[1];
47471
+ var t4;
47472
+ if ($[3] === Symbol.for("react.memo_cache_sentinel")) {
47473
+ t4 = [];
47474
+ $[3] = t4;
47475
+ } else {
47476
+ t4 = $[3];
47477
+ }
47478
+ var audioQueueRef = (0, import_react67.useRef)(t4);
47479
+ var t5;
47480
+ var t6;
47481
+ if ($[4] !== audioQueue) {
47482
+ t5 = function() {
47483
+ audioQueueRef.current = audioQueue;
47484
+ };
47485
+ t6 = [
47486
+ audioQueue
47487
+ ];
47488
+ $[4] = audioQueue;
47489
+ $[5] = t5;
47490
+ $[6] = t6;
47491
+ } else {
47492
+ t5 = $[5];
47493
+ t6 = $[6];
47494
+ }
47495
+ (0, import_react67.useEffect)(t5, t6);
47496
+ var pickLockRef = (0, import_react67.useRef)(false);
47497
+ var currentSentenceRef = (0, import_react67.useRef)(null);
47462
47498
  var messagesProps = useMessages();
47463
- (0, import_react67.useEffect)(function() {
47464
- if (!isPlaying) return;
47465
- isLastSentencePlayedRef.current = false;
47466
- }, [
47467
- isPlaying
47468
- ]);
47469
- var unplayedMessageSentences = (0, import_react67.useMemo)(function() {
47470
- var playableMessages = _to_consumable_array(messagesProps.messages).reverse().filter(function(message) {
47471
- if (message.role !== "assistant") return false;
47472
- if (stoppedMessageIds.includes(message.id)) return false;
47473
- return true;
47474
- });
47475
- var messageInputs = playableMessages.map(function(message_0) {
47476
- return {
47477
- message: message_0,
47478
- input: input({
47479
- message: message_0
47480
- })
47481
- };
47482
- }).filter(function(_ref3) {
47483
- var input2 = _ref3.input;
47484
- return input2 !== null;
47485
- });
47486
- var messageSentences = messageInputs.flatMap(function(_ref4) {
47487
- var message_1 = _ref4.message, input_0 = _ref4.input;
47488
- return getMessageSentences({
47489
- messageId: message_1.id,
47490
- input: input_0
47499
+ var t7;
47500
+ var t8;
47501
+ if ($[7] !== messagesProps.messages) {
47502
+ t7 = function() {
47503
+ var assistantsDesc = messagesProps.messages.filter(_temp9);
47504
+ var assistantsAsc = _to_consumable_array(assistantsDesc).reverse();
47505
+ setAudioQueue(function(prev) {
47506
+ var prevById = new Map(prev.map(_temp24));
47507
+ var next = [];
47508
+ var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
47509
+ try {
47510
+ for(var _iterator = assistantsAsc[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
47511
+ var m_0 = _step.value;
47512
+ var _existing$nextIndex, _existing$stopped;
47513
+ var inp = input({
47514
+ message: m_0
47515
+ });
47516
+ if (inp == null) {
47517
+ continue;
47518
+ }
47519
+ var sentences = segment(inp);
47520
+ var existing = prevById.get(m_0.id);
47521
+ next.push({
47522
+ id: m_0.id,
47523
+ status: m_0.status,
47524
+ sentences: sentences,
47525
+ nextIndex: Math.min((_existing$nextIndex = existing === null || existing === void 0 ? void 0 : existing.nextIndex) !== null && _existing$nextIndex !== void 0 ? _existing$nextIndex : 0, sentences.length),
47526
+ stopped: (_existing$stopped = existing === null || existing === void 0 ? void 0 : existing.stopped) !== null && _existing$stopped !== void 0 ? _existing$stopped : false
47527
+ });
47528
+ }
47529
+ } catch (err) {
47530
+ _didIteratorError = true;
47531
+ _iteratorError = err;
47532
+ } finally{
47533
+ try {
47534
+ if (!_iteratorNormalCompletion && _iterator.return != null) {
47535
+ _iterator.return();
47536
+ }
47537
+ } finally{
47538
+ if (_didIteratorError) {
47539
+ throw _iteratorError;
47540
+ }
47541
+ }
47542
+ }
47543
+ return next;
47491
47544
  });
47492
- });
47493
- return messageSentences.filter(function(ms) {
47494
- return !playedMessageSentences.find(function(pms) {
47495
- return pms.messageId === ms.messageId && pms.sentence === ms.sentence;
47545
+ };
47546
+ t8 = [
47547
+ messagesProps.messages
47548
+ ];
47549
+ $[7] = messagesProps.messages;
47550
+ $[8] = t7;
47551
+ $[9] = t8;
47552
+ } else {
47553
+ t7 = $[8];
47554
+ t8 = $[9];
47555
+ }
47556
+ (0, import_react67.useEffect)(t7, t8);
47557
+ var t9;
47558
+ if ($[10] !== audioPlayer || $[11] !== fullSentenceRegex || $[12] !== isAudioPlayed || $[13] !== nextAudioPlayer || $[14] !== superinterfaceContext) {
47559
+ t9 = function(t102) {
47560
+ var input2 = t102.input, onPlay = t102.onPlay, onStop = t102.onStop, onEnd_0 = t102.onEnd;
47561
+ var searchParams = new URLSearchParams(_objectSpread47({
47562
+ input: input2
47563
+ }, superinterfaceContext.variables));
47564
+ audioPlayer.load("".concat(superinterfaceContext.baseUrl, "/audio-runtimes/tts?").concat(searchParams), {
47565
+ format: "mp3",
47566
+ autoplay: isAudioPlayed,
47567
+ html5: isHtmlAudioSupported,
47568
+ onplay: onPlay,
47569
+ onstop: onStop,
47570
+ onload: function() {
47571
+ var current = currentSentenceRef.current;
47572
+ if (!current) {
47573
+ return;
47574
+ }
47575
+ var msg = audioQueueRef.current.find(function(m_1) {
47576
+ return m_1.id === current.messageId;
47577
+ });
47578
+ if (!msg) {
47579
+ return;
47580
+ }
47581
+ var nextSentence = msg.sentences[msg.nextIndex];
47582
+ if (!nextSentence) {
47583
+ return;
47584
+ }
47585
+ if (!fullSentenceRegex.test(nextSentence)) {
47586
+ return;
47587
+ }
47588
+ var nextSearchParams = new URLSearchParams(_objectSpread47({
47589
+ input: nextSentence
47590
+ }, superinterfaceContext.variables));
47591
+ nextAudioPlayer.load("".concat(superinterfaceContext.baseUrl, "/audio-runtimes/tts?").concat(nextSearchParams), {
47592
+ format: "mp3",
47593
+ autoplay: false,
47594
+ html5: isHtmlAudioSupported
47595
+ });
47596
+ },
47597
+ onend: onEnd_0
47496
47598
  });
47497
- });
47498
- }, [
47499
- messagesProps,
47500
- playedMessageSentences
47501
- ]);
47502
- var defaultPlay = (0, import_react67.useCallback)(function(_ref5) {
47503
- var input_1 = _ref5.input, onPlay = _ref5.onPlay, onStop = _ref5.onStop, onEnd_0 = _ref5.onEnd;
47504
- var searchParams = new URLSearchParams(_objectSpread47({
47505
- input: input_1
47506
- }, superinterfaceContext.variables));
47507
- audioPlayer.load("".concat(superinterfaceContext.baseUrl, "/audio-runtimes/tts?").concat(searchParams), {
47508
- format: "mp3",
47509
- autoplay: isAudioPlayed,
47510
- html5: isHtmlAudioSupported,
47511
- onplay: onPlay,
47512
- onstop: onStop,
47513
- onload: function() {
47514
- var nextUnplayedMessageSentence = unplayedMessageSentences[1];
47515
- if (!nextUnplayedMessageSentence) return;
47516
- var isNextFullSentence = fullSentenceRegex.test(nextUnplayedMessageSentence.sentence);
47517
- if (!isNextFullSentence) return;
47518
- var nextSearchParams = new URLSearchParams(_objectSpread47({
47519
- input: nextUnplayedMessageSentence.sentence
47520
- }, superinterfaceContext.variables));
47521
- nextAudioPlayer.load("".concat(superinterfaceContext.baseUrl, "/audio-runtimes/tts?").concat(nextSearchParams), {
47522
- format: "mp3",
47523
- autoplay: false,
47524
- html5: isHtmlAudioSupported
47525
- });
47526
- },
47527
- onend: onEnd_0
47528
- });
47529
- }, [
47530
- superinterfaceContext,
47531
- unplayedMessageSentences,
47532
- audioPlayer,
47533
- nextAudioPlayer,
47534
- isAudioPlayed,
47535
- fullSentenceRegex
47536
- ]);
47537
- var play = (0, import_react67.useMemo)(function() {
47538
- return passedPlay || defaultPlay;
47539
- }, [
47540
- passedPlay,
47541
- defaultPlay
47542
- ]);
47543
- (0, import_react67.useEffect)(function() {
47544
- if (isPlaying) return;
47545
- if (audioPlayer.playing) return;
47546
- if (!latestMessageProps.latestMessage) return;
47547
- if (latestMessageProps.latestMessage.role !== "assistant") return;
47548
- var firstUnplayedMessageSentence = unplayedMessageSentences[0];
47549
- if (!firstUnplayedMessageSentence) {
47550
- return;
47551
- }
47552
- var isFullSentence = isOptimistic({
47553
- id: latestMessageProps.latestMessage.id
47554
- }) || latestMessageProps.latestMessage.status !== "in_progress" || fullSentenceRegex.test(firstUnplayedMessageSentence.sentence);
47555
- if (!isFullSentence) return;
47556
- setIsPlaying(true);
47557
- setPlayedMessageSentences(function(prev) {
47558
- return _to_consumable_array(prev).concat([
47559
- firstUnplayedMessageSentence
47560
- ]);
47561
- });
47562
- var input_2 = firstUnplayedMessageSentence.sentence;
47563
- play({
47564
- input: input_2,
47565
- onPlay: function() {
47566
- setIsAudioPlayed(true);
47567
- },
47568
- onStop: function() {
47569
- setStoppedMessageIds(function(prev_0) {
47570
- return _to_consumable_array(prev_0).concat([
47571
- firstUnplayedMessageSentence.messageId
47572
- ]);
47573
- });
47574
- setIsPlaying(false);
47575
- },
47576
- onEnd: function() {
47577
- setIsPlaying(false);
47578
- isLastSentencePlayedRef.current = unplayedMessageSentences.length === 1;
47579
- if (isLastSentencePlayedRef.current && latestMessageProps.latestMessage.status !== "in_progress") {
47580
- _onEnd();
47581
- isLastSentencePlayedRef.current = false;
47599
+ };
47600
+ $[10] = audioPlayer;
47601
+ $[11] = fullSentenceRegex;
47602
+ $[12] = isAudioPlayed;
47603
+ $[13] = nextAudioPlayer;
47604
+ $[14] = superinterfaceContext;
47605
+ $[15] = t9;
47606
+ } else {
47607
+ t9 = $[15];
47608
+ }
47609
+ var defaultPlay = t9;
47610
+ var t10;
47611
+ t10 = passedPlay || defaultPlay;
47612
+ var play = t10;
47613
+ var t11;
47614
+ var t12;
47615
+ if ($[16] !== audioPlayer.playing || $[17] !== audioQueue || $[18] !== fullSentenceRegex || $[19] !== isPlaying || $[20] !== _onEnd || $[21] !== play) {
47616
+ t11 = function() {
47617
+ if (isPlaying) {
47618
+ return;
47619
+ }
47620
+ if (audioPlayer.playing) {
47621
+ return;
47622
+ }
47623
+ if (pickLockRef.current) {
47624
+ return;
47625
+ }
47626
+ var candidate;
47627
+ candidate = null;
47628
+ var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
47629
+ try {
47630
+ for(var _iterator = audioQueue[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
47631
+ var msg_0 = _step.value;
47632
+ if (msg_0.stopped) {
47633
+ continue;
47634
+ }
47635
+ var sentence = msg_0.sentences[msg_0.nextIndex];
47636
+ if (!sentence) {
47637
+ continue;
47638
+ }
47639
+ var isFull = isOptimistic({
47640
+ id: msg_0.id
47641
+ }) || msg_0.status !== "in_progress" || fullSentenceRegex.test(sentence);
47642
+ if (isFull) {
47643
+ candidate = {
47644
+ messageId: msg_0.id,
47645
+ sentence: sentence,
47646
+ index: msg_0.nextIndex,
47647
+ ownerStatus: msg_0.status
47648
+ };
47649
+ break;
47650
+ }
47651
+ }
47652
+ } catch (err) {
47653
+ _didIteratorError = true;
47654
+ _iteratorError = err;
47655
+ } finally{
47656
+ try {
47657
+ if (!_iteratorNormalCompletion && _iterator.return != null) {
47658
+ _iterator.return();
47659
+ }
47660
+ } finally{
47661
+ if (_didIteratorError) {
47662
+ throw _iteratorError;
47663
+ }
47582
47664
  }
47583
47665
  }
47584
- });
47585
- }, [
47586
- unplayedMessageSentences,
47587
- isPlaying,
47588
- superinterfaceContext,
47589
- latestMessageProps,
47590
- audioPlayer,
47591
- nextAudioPlayer,
47592
- playedMessageSentences,
47593
- _onEnd,
47594
- play,
47595
- fullSentenceRegex
47596
- ]);
47597
- (0, import_react67.useEffect)(function() {
47598
- var _latestMessageProps$l;
47599
- if (isLastSentencePlayedRef.current && !isPlaying && unplayedMessageSentences.length === 0 && ((_latestMessageProps$l = latestMessageProps.latestMessage) === null || _latestMessageProps$l === void 0 ? void 0 : _latestMessageProps$l.status) !== "in_progress") {
47600
- _onEnd();
47601
- isLastSentencePlayedRef.current = false;
47602
- }
47603
- }, [
47604
- isPlaying,
47605
- unplayedMessageSentences.length,
47606
- (_latestMessageProps$l2 = latestMessageProps.latestMessage) === null || _latestMessageProps$l2 === void 0 ? void 0 : _latestMessageProps$l2.status,
47607
- _onEnd
47608
- ]);
47609
- (0, import_react67.useEffect)(function() {
47610
- if (isHtmlAudioSupported) {
47611
- var _Howler$_howls$;
47612
- if (!(import_howler.Howler !== null && import_howler.Howler !== void 0 && (_Howler$_howls$ = import_howler.Howler._howls[0]) !== null && _Howler$_howls$ !== void 0 && (_Howler$_howls$ = _Howler$_howls$._sounds[0]) !== null && _Howler$_howls$ !== void 0 && _Howler$_howls$._node)) return;
47613
- import_howler.Howler._howls[0]._sounds[0]._node.crossOrigin = "anonymous";
47614
- }
47615
- }, [
47616
- audioPlayer
47617
- ]);
47618
- var _ref5 = _sliced_to_array((0, import_react67.useState)(null), 2), audioEngine = _ref5[0], setAudioEngine = _ref5[1];
47619
- var isAudioEngineInited = (0, import_react67.useRef)(false);
47620
- (0, import_react67.useEffect)(function() {
47621
- if (!audioPlayer.playing) return;
47622
- if (isAudioEngineInited.current) return;
47623
- isAudioEngineInited.current = true;
47624
- if (isHtmlAudioSupported) {
47625
- var audioContext = new AudioContext();
47626
- setAudioEngine({
47627
- // @ts-ignore-next-line
47628
- source: audioContext.createMediaElementSource(// @ts-ignore-next-line
47629
- import_howler.Howler._howls[0]._sounds[0]._node),
47630
- audioContext: audioContext
47666
+ if (!candidate) {
47667
+ return;
47668
+ }
47669
+ pickLockRef.current = true;
47670
+ setIsPlaying(true);
47671
+ currentSentenceRef.current = {
47672
+ messageId: candidate.messageId,
47673
+ index: candidate.index
47674
+ };
47675
+ setAudioQueue(function(prev_0) {
47676
+ return prev_0.map(function(m_2) {
47677
+ return m_2.id === candidate.messageId ? _objectSpread47(_objectSpread47({}, m_2), {}, {
47678
+ nextIndex: m_2.nextIndex + 1
47679
+ }) : m_2;
47680
+ });
47631
47681
  });
47632
- } else {
47633
- setAudioEngine({
47634
- source: import_howler.Howler.masterGain,
47635
- audioContext: import_howler.Howler.ctx
47682
+ play({
47683
+ input: candidate.sentence,
47684
+ onPlay: function() {
47685
+ setIsAudioPlayed(true);
47686
+ },
47687
+ onStop: function() {
47688
+ setAudioQueue(function(prev_1) {
47689
+ return prev_1.map(function(m_3) {
47690
+ return m_3.id === candidate.messageId ? _objectSpread47(_objectSpread47({}, m_3), {}, {
47691
+ stopped: true
47692
+ }) : m_3;
47693
+ });
47694
+ });
47695
+ setIsPlaying(false);
47696
+ currentSentenceRef.current = null;
47697
+ pickLockRef.current = false;
47698
+ },
47699
+ onEnd: function() {
47700
+ setIsPlaying(false);
47701
+ currentSentenceRef.current = null;
47702
+ pickLockRef.current = false;
47703
+ var hasPending = audioQueueRef.current.some(_temp32);
47704
+ if (!hasPending) {
47705
+ _onEnd();
47706
+ }
47707
+ }
47636
47708
  });
47709
+ };
47710
+ t12 = [
47711
+ isPlaying,
47712
+ audioPlayer.playing,
47713
+ audioQueue,
47714
+ play,
47715
+ fullSentenceRegex,
47716
+ _onEnd
47717
+ ];
47718
+ $[16] = audioPlayer.playing;
47719
+ $[17] = audioQueue;
47720
+ $[18] = fullSentenceRegex;
47721
+ $[19] = isPlaying;
47722
+ $[20] = _onEnd;
47723
+ $[21] = play;
47724
+ $[22] = t11;
47725
+ $[23] = t12;
47726
+ } else {
47727
+ t11 = $[22];
47728
+ t12 = $[23];
47729
+ }
47730
+ (0, import_react67.useEffect)(t11, t12);
47731
+ var t13;
47732
+ if ($[24] !== audioPlayer) {
47733
+ t13 = [
47734
+ audioPlayer
47735
+ ];
47736
+ $[24] = audioPlayer;
47737
+ $[25] = t13;
47738
+ } else {
47739
+ t13 = $[25];
47740
+ }
47741
+ (0, import_react67.useEffect)(_temp42, t13);
47742
+ var _ref3 = _sliced_to_array((0, import_react67.useState)(null), 2), audioEngine = _ref3[0], setAudioEngine = _ref3[1];
47743
+ var isAudioEngineInited = (0, import_react67.useRef)(false);
47744
+ var t14;
47745
+ if ($[26] !== audioPlayer.playing) {
47746
+ t14 = function() {
47747
+ if (!audioPlayer.playing) {
47748
+ return;
47749
+ }
47750
+ if (isAudioEngineInited.current) {
47751
+ return;
47752
+ }
47753
+ isAudioEngineInited.current = true;
47754
+ if (isHtmlAudioSupported) {
47755
+ var audioContext = new AudioContext();
47756
+ setAudioEngine({
47757
+ source: audioContext.createMediaElementSource(import_howler.Howler._howls[0]._sounds[0]._node),
47758
+ audioContext: audioContext
47759
+ });
47760
+ } else {
47761
+ setAudioEngine({
47762
+ source: import_howler.Howler.masterGain,
47763
+ audioContext: import_howler.Howler.ctx
47764
+ });
47765
+ }
47766
+ };
47767
+ $[26] = audioPlayer.playing;
47768
+ $[27] = t14;
47769
+ } else {
47770
+ t14 = $[27];
47771
+ }
47772
+ var t15;
47773
+ if ($[28] !== audioPlayer) {
47774
+ t15 = [
47775
+ audioPlayer
47776
+ ];
47777
+ $[28] = audioPlayer;
47778
+ $[29] = t15;
47779
+ } else {
47780
+ t15 = $[29];
47781
+ }
47782
+ (0, import_react67.useEffect)(t14, t15);
47783
+ var t16;
47784
+ bb0: {
47785
+ if (!audioEngine) {
47786
+ t16 = null;
47787
+ break bb0;
47637
47788
  }
47638
- }, [
47639
- audioPlayer,
47640
- isAudioEngineInited
47641
- ]);
47642
- var visualizationAnalyser = (0, import_react67.useMemo)(function() {
47643
- if (!audioEngine) return null;
47644
- var result = audioEngine.audioContext.createAnalyser();
47645
- audioEngine.source.connect(audioEngine.audioContext.destination);
47646
- audioEngine.source.connect(result);
47647
- return result;
47648
- }, [
47649
- audioEngine
47650
- ]);
47651
- var isPending = (0, import_react67.useMemo)(function() {
47652
- var _latestMessageProps$l3;
47653
- return isPlaying || unplayedMessageSentences.length > 0 || ((_latestMessageProps$l3 = latestMessageProps.latestMessage) === null || _latestMessageProps$l3 === void 0 ? void 0 : _latestMessageProps$l3.status) === "in_progress";
47654
- }, [
47655
- isPlaying,
47656
- unplayedMessageSentences,
47657
- latestMessageProps
47658
- ]);
47659
- return _objectSpread47(_objectSpread47({
47660
- isPending: isPending,
47661
- isAudioPlayed: isAudioPlayed
47662
- }, audioPlayer), {}, {
47663
- visualizationAnalyser: visualizationAnalyser
47664
- });
47789
+ var analyser;
47790
+ if ($[30] !== audioEngine.audioContext || $[31] !== audioEngine.source) {
47791
+ analyser = audioEngine.audioContext.createAnalyser();
47792
+ audioEngine.source.connect(audioEngine.audioContext.destination);
47793
+ audioEngine.source.connect(analyser);
47794
+ $[30] = audioEngine.audioContext;
47795
+ $[31] = audioEngine.source;
47796
+ $[32] = analyser;
47797
+ } else {
47798
+ analyser = $[32];
47799
+ }
47800
+ t16 = analyser;
47801
+ }
47802
+ var visualizationAnalyser = t16;
47803
+ var t17;
47804
+ var t18;
47805
+ if ($[33] !== audioQueue || $[34] !== isPlaying) {
47806
+ t18 = isPlaying || audioQueue.some(_temp52);
47807
+ $[33] = audioQueue;
47808
+ $[34] = isPlaying;
47809
+ $[35] = t18;
47810
+ } else {
47811
+ t18 = $[35];
47812
+ }
47813
+ t17 = t18;
47814
+ var isPending = t17;
47815
+ var t19;
47816
+ if ($[36] !== audioPlayer || $[37] !== isAudioPlayed || $[38] !== isPending || $[39] !== visualizationAnalyser) {
47817
+ t19 = _objectSpread47(_objectSpread47({
47818
+ isPending: isPending,
47819
+ isAudioPlayed: isAudioPlayed
47820
+ }, audioPlayer), {}, {
47821
+ visualizationAnalyser: visualizationAnalyser
47822
+ });
47823
+ $[36] = audioPlayer;
47824
+ $[37] = isAudioPlayed;
47825
+ $[38] = isPending;
47826
+ $[39] = visualizationAnalyser;
47827
+ $[40] = t19;
47828
+ } else {
47829
+ t19 = $[40];
47830
+ }
47831
+ return t19;
47665
47832
  };
47833
+ function _temp9(m) {
47834
+ return m.role === "assistant";
47835
+ }
47836
+ function _temp24(p) {
47837
+ return [
47838
+ p.id,
47839
+ p
47840
+ ];
47841
+ }
47842
+ function _temp32(m_4) {
47843
+ if (m_4.stopped) {
47844
+ return false;
47845
+ }
47846
+ var hasMore = m_4.nextIndex < m_4.sentences.length;
47847
+ var streaming = m_4.status === "in_progress";
47848
+ return hasMore || streaming;
47849
+ }
47850
+ function _temp42() {
47851
+ if (isHtmlAudioSupported) {
47852
+ var _Howler$_howls$;
47853
+ if (!(import_howler.Howler !== null && import_howler.Howler !== void 0 && (_Howler$_howls$ = import_howler.Howler._howls[0]) !== null && _Howler$_howls$ !== void 0 && (_Howler$_howls$ = _Howler$_howls$._sounds[0]) !== null && _Howler$_howls$ !== void 0 && _Howler$_howls$._node)) {
47854
+ return;
47855
+ }
47856
+ import_howler.Howler._howls[0]._sounds[0]._node.crossOrigin = "anonymous";
47857
+ }
47858
+ }
47859
+ function _temp52(m_5) {
47860
+ return !m_5.stopped && (m_5.nextIndex < m_5.sentences.length || m_5.status === "in_progress");
47861
+ }
47666
47862
  // src/hooks/audioRuntimes/useTtsAudioRuntime/index.ts
47667
47863
  var import_react_query10 = require("@tanstack/react-query");
47668
47864
  // src/hooks/audioRuntimes/useTtsAudioRuntime/blobToData.ts
@@ -47700,7 +47896,7 @@ function _asyncToGenerator11(n) {
47700
47896
  };
47701
47897
  }
47702
47898
  var useTtsAudioRuntime = function(t0) {
47703
- var $ = (0, import_react_compiler_runtime88.c)(30);
47899
+ var $ = (0, import_react_compiler_runtime89.c)(30);
47704
47900
  var play = t0.play, passedOnEnd = t0.onEnd;
47705
47901
  var addToast = useToasts().addToast;
47706
47902
  var queryClient = (0, import_react_query10.useQueryClient)();
@@ -47729,7 +47925,7 @@ var useTtsAudioRuntime = function(t0) {
47729
47925
  if ($[1] !== createMessageProps) {
47730
47926
  t2 = {
47731
47927
  isStopOnSilence: true,
47732
- onStart: _temp9,
47928
+ onStart: _temp10,
47733
47929
  onStop: function() {
47734
47930
  var _onStop = _asyncToGenerator11(function(_event, chunks) {
47735
47931
  var blob, audioContent;
@@ -47870,23 +48066,23 @@ var useTtsAudioRuntime = function(t0) {
47870
48066
  t5 = t8;
47871
48067
  return t5;
47872
48068
  };
47873
- function _temp9() {
47874
- return _temp24.apply(this, arguments);
48069
+ function _temp10() {
48070
+ return _temp25.apply(this, arguments);
47875
48071
  }
47876
- function _temp24() {
47877
- _temp24 = _asyncToGenerator11(function() {
48072
+ function _temp25() {
48073
+ _temp25 = _asyncToGenerator11(function() {
47878
48074
  return _ts_generator(this, function(_state) {
47879
48075
  return [
47880
48076
  2
47881
48077
  ];
47882
48078
  });
47883
48079
  });
47884
- return _temp24.apply(this, arguments);
48080
+ return _temp25.apply(this, arguments);
47885
48081
  }
47886
48082
  // src/components/audioRuntimes/TtsAudioRuntimeProvider.tsx
47887
48083
  var import_jsx_runtime87 = require("react/jsx-runtime");
47888
48084
  var TtsAudioRuntimeProvider = function(t0) {
47889
- var $ = (0, import_react_compiler_runtime89.c)(8);
48085
+ var $ = (0, import_react_compiler_runtime90.c)(8);
47890
48086
  var children = t0.children, play = t0.play, onEnd = t0.onEnd;
47891
48087
  var t1;
47892
48088
  if ($[0] !== onEnd || $[1] !== play) {
@@ -47999,7 +48195,7 @@ function _objectWithoutPropertiesLoose5(r, e) {
47999
48195
  return t;
48000
48196
  }
48001
48197
  var Content9 = function(t0) {
48002
- var $ = (0, import_react_compiler_runtime90.c)(4);
48198
+ var $ = (0, import_react_compiler_runtime91.c)(4);
48003
48199
  var children = t0.children, className = t0.className, style = t0.style;
48004
48200
  var t1;
48005
48201
  if ($[0] !== children || $[1] !== className || $[2] !== style) {
@@ -48021,7 +48217,7 @@ var Content9 = function(t0) {
48021
48217
  return t1;
48022
48218
  };
48023
48219
  var AudioRuntimeProvider = function(t0) {
48024
- var $ = (0, import_react_compiler_runtime90.c)(4);
48220
+ var $ = (0, import_react_compiler_runtime91.c)(4);
48025
48221
  var children = t0.children, play = t0.play, onEnd = t0.onEnd;
48026
48222
  var audioThreadContext = useAudioThreadContext();
48027
48223
  if (audioThreadContext.audioRuntime) {
@@ -48044,7 +48240,7 @@ var AudioRuntimeProvider = function(t0) {
48044
48240
  return t1;
48045
48241
  };
48046
48242
  var Provider5 = function(t0) {
48047
- var $ = (0, import_react_compiler_runtime90.c)(9);
48243
+ var $ = (0, import_react_compiler_runtime91.c)(9);
48048
48244
  var children;
48049
48245
  var rest;
48050
48246
  if ($[0] !== t0) {
@@ -48084,7 +48280,7 @@ var Provider5 = function(t0) {
48084
48280
  return t2;
48085
48281
  };
48086
48282
  var Root16 = function(t0) {
48087
- var $ = (0, import_react_compiler_runtime90.c)(18);
48283
+ var $ = (0, import_react_compiler_runtime91.c)(18);
48088
48284
  var children;
48089
48285
  var className;
48090
48286
  var onEnd;
@@ -48156,7 +48352,7 @@ var Root16 = function(t0) {
48156
48352
  return t3;
48157
48353
  };
48158
48354
  // src/components/threads/AudioThread/Visualization/index.tsx
48159
- var import_react_compiler_runtime92 = require("react-compiler-runtime");
48355
+ var import_react_compiler_runtime93 = require("react-compiler-runtime");
48160
48356
  var import_react71 = require("react");
48161
48357
  var import_lodash9 = __toESM(require("lodash"), 1);
48162
48358
  var import_themes60 = require("@radix-ui/themes");
@@ -48225,10 +48421,10 @@ var BarsVisualizer = function(_ref) {
48225
48421
  });
48226
48422
  };
48227
48423
  // src/hooks/audioThreads/useStatus/index.ts
48228
- var import_react_compiler_runtime91 = require("react-compiler-runtime");
48424
+ var import_react_compiler_runtime92 = require("react-compiler-runtime");
48229
48425
  var import_react70 = require("react");
48230
48426
  var useStatus = function() {
48231
- var $ = (0, import_react_compiler_runtime91.c)(2);
48427
+ var $ = (0, import_react_compiler_runtime92.c)(2);
48232
48428
  var audioRuntime = useAudioThreadContext().audioRuntime;
48233
48429
  var t0;
48234
48430
  bb0: {
@@ -48388,7 +48584,7 @@ var Provider6 = function(_ref) {
48388
48584
  });
48389
48585
  };
48390
48586
  var Root17 = function(t0) {
48391
- var $ = (0, import_react_compiler_runtime92.c)(6);
48587
+ var $ = (0, import_react_compiler_runtime93.c)(6);
48392
48588
  var children;
48393
48589
  var rest;
48394
48590
  if ($[0] !== t0) {
@@ -48425,7 +48621,7 @@ var Root17 = function(t0) {
48425
48621
  return t1;
48426
48622
  };
48427
48623
  var BarsVisualizer2 = function(t0) {
48428
- var $ = (0, import_react_compiler_runtime92.c)(10);
48624
+ var $ = (0, import_react_compiler_runtime93.c)(10);
48429
48625
  var rest;
48430
48626
  var t1;
48431
48627
  var t2;
@@ -48469,7 +48665,7 @@ var BarsVisualizer2 = function(t0) {
48469
48665
  return t4;
48470
48666
  };
48471
48667
  var AssistantVisualizationRoot = function(t0) {
48472
- var $ = (0, import_react_compiler_runtime92.c)(17);
48668
+ var $ = (0, import_react_compiler_runtime93.c)(17);
48473
48669
  var children;
48474
48670
  var rest;
48475
48671
  var t1;
@@ -48542,7 +48738,7 @@ var AssistantVisualizationRoot = function(t0) {
48542
48738
  return t6;
48543
48739
  };
48544
48740
  var AssistantVisualization = function(props) {
48545
- var $ = (0, import_react_compiler_runtime92.c)(3);
48741
+ var $ = (0, import_react_compiler_runtime93.c)(3);
48546
48742
  var t0;
48547
48743
  if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
48548
48744
  t0 = /* @__PURE__ */ (0, import_jsx_runtime90.jsx)(BarsVisualizer2, {});
@@ -48565,7 +48761,7 @@ var AssistantVisualization = function(props) {
48565
48761
  AssistantVisualization.Root = AssistantVisualizationRoot;
48566
48762
  AssistantVisualization.BarsVisualizer = BarsVisualizer2;
48567
48763
  var AssistantInfo = function(props) {
48568
- var $ = (0, import_react_compiler_runtime92.c)(6);
48764
+ var $ = (0, import_react_compiler_runtime93.c)(6);
48569
48765
  var assistantNameContext = (0, import_react71.useContext)(AssistantNameContext);
48570
48766
  var t0;
48571
48767
  if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
@@ -48605,7 +48801,7 @@ var AssistantInfo = function(props) {
48605
48801
  return t2;
48606
48802
  };
48607
48803
  var Visualization = function(props) {
48608
- var $ = (0, import_react_compiler_runtime92.c)(4);
48804
+ var $ = (0, import_react_compiler_runtime93.c)(4);
48609
48805
  var t0;
48610
48806
  var t1;
48611
48807
  if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
@@ -48637,9 +48833,9 @@ Visualization.Provider = Provider6;
48637
48833
  Visualization.AssistantVisualization = AssistantVisualization;
48638
48834
  Visualization.AssistantInfo = AssistantInfo;
48639
48835
  // src/components/threads/AudioThread/Status/index.tsx
48640
- var import_react_compiler_runtime94 = require("react-compiler-runtime");
48836
+ var import_react_compiler_runtime95 = require("react-compiler-runtime");
48641
48837
  // src/components/threads/AudioThread/Status/StatusMessages.tsx
48642
- var import_react_compiler_runtime93 = require("react-compiler-runtime");
48838
+ var import_react_compiler_runtime94 = require("react-compiler-runtime");
48643
48839
  var import_themes61 = require("@radix-ui/themes");
48644
48840
  var import_jsx_runtime91 = require("react/jsx-runtime");
48645
48841
  var html = function(_ref) {
@@ -48649,7 +48845,7 @@ var html = function(_ref) {
48649
48845
  }).join(""), "\n }");
48650
48846
  };
48651
48847
  var StatusMessages = function(t0) {
48652
- var $ = (0, import_react_compiler_runtime93.c)(9);
48848
+ var $ = (0, import_react_compiler_runtime94.c)(9);
48653
48849
  var texts = t0.texts, className = t0.className, style = t0.style;
48654
48850
  var t1;
48655
48851
  if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
@@ -48753,7 +48949,7 @@ function _toPrimitive50(t, r) {
48753
48949
  return ("string" === r ? String : Number)(t);
48754
48950
  }
48755
48951
  var Status = function(props) {
48756
- var $ = (0, import_react_compiler_runtime94.c)(12);
48952
+ var $ = (0, import_react_compiler_runtime95.c)(12);
48757
48953
  var status = useStatus().status;
48758
48954
  if (status === "recording") {
48759
48955
  var _t;
@@ -48850,10 +49046,10 @@ var Status = function(props) {
48850
49046
  return t1;
48851
49047
  };
48852
49048
  // src/components/threads/AudioThread/Form/index.tsx
48853
- var import_react_compiler_runtime97 = require("react-compiler-runtime");
49049
+ var import_react_compiler_runtime98 = require("react-compiler-runtime");
48854
49050
  var import_themes63 = require("@radix-ui/themes");
48855
49051
  // src/components/threads/AudioThread/Form/MicIcon.tsx
48856
- var import_react_compiler_runtime95 = require("react-compiler-runtime");
49052
+ var import_react_compiler_runtime96 = require("react-compiler-runtime");
48857
49053
  var import_jsx_runtime93 = require("react/jsx-runtime");
48858
49054
  function ownKeys51(e, r) {
48859
49055
  var t = Object.keys(e);
@@ -48899,7 +49095,7 @@ function _toPrimitive51(t, r) {
48899
49095
  return ("string" === r ? String : Number)(t);
48900
49096
  }
48901
49097
  var MicIcon = function(props) {
48902
- var $ = (0, import_react_compiler_runtime95.c)(3);
49098
+ var $ = (0, import_react_compiler_runtime96.c)(3);
48903
49099
  var t0;
48904
49100
  if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
48905
49101
  t0 = /* @__PURE__ */ (0, import_jsx_runtime93.jsx)("path", {
@@ -48931,12 +49127,12 @@ var MicIcon = function(props) {
48931
49127
  return t1;
48932
49128
  };
48933
49129
  // src/components/threads/AudioThread/Form/ActionButton/index.tsx
48934
- var import_react_compiler_runtime96 = require("react-compiler-runtime");
49130
+ var import_react_compiler_runtime97 = require("react-compiler-runtime");
48935
49131
  var import_themes62 = require("@radix-ui/themes");
48936
49132
  var import_react_icons17 = require("@radix-ui/react-icons");
48937
49133
  var import_jsx_runtime94 = require("react/jsx-runtime");
48938
49134
  var ActionButton = function() {
48939
- var $ = (0, import_react_compiler_runtime96.c)(27);
49135
+ var $ = (0, import_react_compiler_runtime97.c)(27);
48940
49136
  var status = useStatus().status;
48941
49137
  var audioThreadContext = useAudioThreadContext();
48942
49138
  var superinterfaceContext = useSuperinterfaceContext();
@@ -49174,7 +49370,7 @@ function _toPrimitive52(t, r) {
49174
49370
  return ("string" === r ? String : Number)(t);
49175
49371
  }
49176
49372
  var Form = function(props) {
49177
- var $ = (0, import_react_compiler_runtime97.c)(17);
49373
+ var $ = (0, import_react_compiler_runtime98.c)(17);
49178
49374
  var status = useStatus().status;
49179
49375
  var audioThreadContext = useAudioThreadContext();
49180
49376
  var t0 = status === "recording" ? "var(--accent-11)" : "var(--gray-11)";
@@ -49324,7 +49520,7 @@ function _toPrimitive53(t, r) {
49324
49520
  return ("string" === r ? String : Number)(t);
49325
49521
  }
49326
49522
  var AudioThread = function(props) {
49327
- var $ = (0, import_react_compiler_runtime98.c)(5);
49523
+ var $ = (0, import_react_compiler_runtime99.c)(5);
49328
49524
  var t0;
49329
49525
  var t1;
49330
49526
  var t2;
@@ -49406,7 +49602,7 @@ function _toPrimitive54(t, r) {
49406
49602
  return ("string" === r ? String : Number)(t);
49407
49603
  }
49408
49604
  var AudioThreadDialog = function(props) {
49409
- var $ = (0, import_react_compiler_runtime99.c)(4);
49605
+ var $ = (0, import_react_compiler_runtime100.c)(4);
49410
49606
  var t0;
49411
49607
  var t1;
49412
49608
  if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
@@ -49928,10 +50124,10 @@ var useWebrtcAudioRuntime = function() {
49928
50124
  ]);
49929
50125
  };
49930
50126
  // src/components/audioRuntimes/WebrtcAudioRuntimeProvider.tsx
49931
- var import_react_compiler_runtime100 = require("react-compiler-runtime");
50127
+ var import_react_compiler_runtime101 = require("react-compiler-runtime");
49932
50128
  var import_jsx_runtime98 = require("react/jsx-runtime");
49933
50129
  var WebrtcAudioRuntimeProvider = function(t0) {
49934
- var $ = (0, import_react_compiler_runtime100.c)(5);
50130
+ var $ = (0, import_react_compiler_runtime101.c)(5);
49935
50131
  var children = t0.children;
49936
50132
  var webrtcAudioRuntime = useWebrtcAudioRuntime().webrtcAudioRuntime;
49937
50133
  var t1;
@@ -49959,20 +50155,20 @@ var WebrtcAudioRuntimeProvider = function(t0) {
49959
50155
  return t2;
49960
50156
  };
49961
50157
  // src/components/gui/Gui/index.tsx
49962
- var import_react_compiler_runtime103 = require("react-compiler-runtime");
50158
+ var import_react_compiler_runtime104 = require("react-compiler-runtime");
49963
50159
  var import_react75 = require("react");
49964
50160
  var import_themes64 = require("@radix-ui/themes");
49965
50161
  // src/hooks/messages/useLatestAssistantMessage/index.ts
49966
- var import_react_compiler_runtime101 = require("react-compiler-runtime");
50162
+ var import_react_compiler_runtime102 = require("react-compiler-runtime");
49967
50163
  var import_react73 = require("react");
49968
50164
  var useLatestAssistantMessage = function() {
49969
- var $ = (0, import_react_compiler_runtime101.c)(4);
50165
+ var $ = (0, import_react_compiler_runtime102.c)(4);
49970
50166
  var _useMessages = useMessages(), messages2 = _useMessages.messages;
49971
50167
  var t0;
49972
50168
  var t1;
49973
50169
  if ($[0] !== messages2) {
49974
50170
  var _messages$find;
49975
- t1 = (_messages$find = messages2.find(_temp10)) !== null && _messages$find !== void 0 ? _messages$find : null;
50171
+ t1 = (_messages$find = messages2.find(_temp11)) !== null && _messages$find !== void 0 ? _messages$find : null;
49976
50172
  $[0] = messages2;
49977
50173
  $[1] = t1;
49978
50174
  } else {
@@ -49991,21 +50187,21 @@ var useLatestAssistantMessage = function() {
49991
50187
  t0 = t2;
49992
50188
  return t0;
49993
50189
  };
49994
- function _temp10(message) {
50190
+ function _temp11(message) {
49995
50191
  return message.role === "assistant";
49996
50192
  }
49997
50193
  // src/hooks/messages/useLatestAssistantMessageWithContent/index.ts
49998
- var import_react_compiler_runtime102 = require("react-compiler-runtime");
50194
+ var import_react_compiler_runtime103 = require("react-compiler-runtime");
49999
50195
  var import_radash18 = require("radash");
50000
50196
  var import_react74 = require("react");
50001
50197
  var useLatestAssistantMessageWithContent = function() {
50002
- var $ = (0, import_react_compiler_runtime102.c)(4);
50198
+ var $ = (0, import_react_compiler_runtime103.c)(4);
50003
50199
  var _useMessages = useMessages(), messages2 = _useMessages.messages;
50004
50200
  var t0;
50005
50201
  var t1;
50006
50202
  if ($[0] !== messages2) {
50007
50203
  var _messages$find;
50008
- t1 = (_messages$find = messages2.find(_temp25)) !== null && _messages$find !== void 0 ? _messages$find : null;
50204
+ t1 = (_messages$find = messages2.find(_temp26)) !== null && _messages$find !== void 0 ? _messages$find : null;
50009
50205
  $[0] = messages2;
50010
50206
  $[1] = t1;
50011
50207
  } else {
@@ -50024,16 +50220,16 @@ var useLatestAssistantMessageWithContent = function() {
50024
50220
  t0 = t2;
50025
50221
  return t0;
50026
50222
  };
50027
- function _temp11(content2) {
50223
+ function _temp12(content2) {
50028
50224
  return content2.type === "text" && !(0, import_radash18.isEmpty)(content2.text.value);
50029
50225
  }
50030
- function _temp25(message) {
50031
- return message.role === "assistant" && message.content.some(_temp11);
50226
+ function _temp26(message) {
50227
+ return message.role === "assistant" && message.content.some(_temp12);
50032
50228
  }
50033
50229
  // src/components/gui/Gui/index.tsx
50034
50230
  var import_jsx_runtime99 = require("react/jsx-runtime");
50035
50231
  var StartingToolCalls3 = function() {
50036
- var $ = (0, import_react_compiler_runtime103.c)(2);
50232
+ var $ = (0, import_react_compiler_runtime104.c)(2);
50037
50233
  var _useComponents = useComponents(), t0 = _useComponents.components;
50038
50234
  var StartingToolCalls4 = t0.StartingToolCalls;
50039
50235
  var t1;
@@ -50047,7 +50243,7 @@ var StartingToolCalls3 = function() {
50047
50243
  return t1;
50048
50244
  };
50049
50245
  var Content10 = function(t0) {
50050
- var $ = (0, import_react_compiler_runtime103.c)(5);
50246
+ var $ = (0, import_react_compiler_runtime104.c)(5);
50051
50247
  var latestRunStep = t0.latestRunStep;
50052
50248
  var t1;
50053
50249
  bb0: {
@@ -50101,14 +50297,14 @@ var Content10 = function(t0) {
50101
50297
  return t2;
50102
50298
  };
50103
50299
  var Progress2 = function(t0) {
50104
- var $ = (0, import_react_compiler_runtime103.c)(5);
50300
+ var $ = (0, import_react_compiler_runtime104.c)(5);
50105
50301
  var latestAssistantMessage = t0.latestAssistantMessage;
50106
50302
  var isMutatingMessage = useIsMutatingMessage();
50107
50303
  var t1;
50108
50304
  var t2;
50109
50305
  if ($[0] !== latestAssistantMessage.runSteps) {
50110
50306
  var _latestAssistantMessa;
50111
- t2 = (_latestAssistantMessa = latestAssistantMessage.runSteps.find(_temp12)) !== null && _latestAssistantMessa !== void 0 ? _latestAssistantMessa : null;
50307
+ t2 = (_latestAssistantMessa = latestAssistantMessage.runSteps.find(_temp13)) !== null && _latestAssistantMessa !== void 0 ? _latestAssistantMessa : null;
50112
50308
  $[0] = latestAssistantMessage.runSteps;
50113
50309
  $[1] = t2;
50114
50310
  } else {
@@ -50151,7 +50347,7 @@ var Progress2 = function(t0) {
50151
50347
  return t4;
50152
50348
  };
50153
50349
  var Gui = function() {
50154
- var $ = (0, import_react_compiler_runtime103.c)(8);
50350
+ var $ = (0, import_react_compiler_runtime104.c)(8);
50155
50351
  var latestAssistantMessage = useLatestAssistantMessage().latestAssistantMessage;
50156
50352
  var latestAssistantMessageWithContent = useLatestAssistantMessageWithContent().latestAssistantMessageWithContent;
50157
50353
  if (!latestAssistantMessage || !latestAssistantMessageWithContent) {
@@ -50213,11 +50409,11 @@ var Gui = function() {
50213
50409
  }
50214
50410
  return t2;
50215
50411
  };
50216
- function _temp12(rs) {
50412
+ function _temp13(rs) {
50217
50413
  return rs.status === "in_progress";
50218
50414
  }
50219
50415
  // src/components/markdown/MarkdownProvider/index.tsx
50220
- var import_react_compiler_runtime104 = require("react-compiler-runtime");
50416
+ var import_react_compiler_runtime105 = require("react-compiler-runtime");
50221
50417
  var import_react76 = require("react");
50222
50418
  var import_jsx_runtime100 = require("react/jsx-runtime");
50223
50419
  var _excluded7 = [
@@ -50242,7 +50438,7 @@ function _objectWithoutPropertiesLoose7(r, e) {
50242
50438
  return t;
50243
50439
  }
50244
50440
  var MarkdownProvider = function(t0) {
50245
- var $ = (0, import_react_compiler_runtime104.c)(9);
50441
+ var $ = (0, import_react_compiler_runtime105.c)(9);
50246
50442
  var children;
50247
50443
  var rest;
50248
50444
  if ($[0] !== t0) {
@@ -50285,18 +50481,18 @@ var MarkdownProvider = function(t0) {
50285
50481
  return t3;
50286
50482
  };
50287
50483
  // src/components/annotations/SourceAnnotation/index.tsx
50288
- var import_react_compiler_runtime107 = require("react-compiler-runtime");
50484
+ var import_react_compiler_runtime108 = require("react-compiler-runtime");
50289
50485
  // src/components/annotations/SourceAnnotation/FileCitation/index.tsx
50290
- var import_react_compiler_runtime106 = require("react-compiler-runtime");
50486
+ var import_react_compiler_runtime107 = require("react-compiler-runtime");
50291
50487
  var import_react77 = require("react");
50292
50488
  var import_react_icons18 = require("@radix-ui/react-icons");
50293
50489
  var import_themes66 = require("@radix-ui/themes");
50294
50490
  // src/components/annotations/SourceAnnotation/FileCitation/Content.tsx
50295
- var import_react_compiler_runtime105 = require("react-compiler-runtime");
50491
+ var import_react_compiler_runtime106 = require("react-compiler-runtime");
50296
50492
  var import_themes65 = require("@radix-ui/themes");
50297
50493
  var import_jsx_runtime101 = require("react/jsx-runtime");
50298
50494
  var Content11 = function(t0) {
50299
- var $ = (0, import_react_compiler_runtime105.c)(5);
50495
+ var $ = (0, import_react_compiler_runtime106.c)(5);
50300
50496
  var fileId = t0.fileId;
50301
50497
  var superinterfaceContext = useSuperinterfaceContext();
50302
50498
  var nextSearchParams = new URLSearchParams(superinterfaceContext.variables);
@@ -50362,7 +50558,7 @@ var Content11 = function(t0) {
50362
50558
  // src/components/annotations/SourceAnnotation/FileCitation/index.tsx
50363
50559
  var import_jsx_runtime102 = require("react/jsx-runtime");
50364
50560
  var FileCitation = function(t0) {
50365
- var $ = (0, import_react_compiler_runtime106.c)(18);
50561
+ var $ = (0, import_react_compiler_runtime107.c)(18);
50366
50562
  var annotation = t0.annotation;
50367
50563
  var _ref = _sliced_to_array((0, import_react77.useState)(null), 2), activeFileId = _ref[0], setActiveFileId = _ref[1];
50368
50564
  var t1;
@@ -50511,7 +50707,7 @@ function _objectWithoutPropertiesLoose8(r, e) {
50511
50707
  return t;
50512
50708
  }
50513
50709
  var SourceAnnotation = function(t0) {
50514
- var $ = (0, import_react_compiler_runtime107.c)(10);
50710
+ var $ = (0, import_react_compiler_runtime108.c)(10);
50515
50711
  var children;
50516
50712
  var rest;
50517
50713
  if ($[0] !== t0) {
@@ -50568,7 +50764,7 @@ var SourceAnnotation = function(t0) {
50568
50764
  return null;
50569
50765
  };
50570
50766
  // src/components/avatars/Avatar.tsx
50571
- var import_react_compiler_runtime110 = require("react-compiler-runtime");
50767
+ var import_react_compiler_runtime111 = require("react-compiler-runtime");
50572
50768
  // src/enums/index.ts
50573
50769
  var IconAvatarName = /* @__PURE__ */ function(IconAvatarName2) {
50574
50770
  IconAvatarName2["BACKPACK"] = "BACKPACK";
@@ -50593,7 +50789,7 @@ var AvatarType = /* @__PURE__ */ function(AvatarType2) {
50593
50789
  // src/components/avatars/Avatar.tsx
50594
50790
  var import_themes69 = require("@radix-ui/themes");
50595
50791
  // src/components/imageAvatars/ImageAvatar/index.tsx
50596
- var import_react_compiler_runtime108 = require("react-compiler-runtime");
50792
+ var import_react_compiler_runtime109 = require("react-compiler-runtime");
50597
50793
  var import_themes67 = require("@radix-ui/themes");
50598
50794
  // src/components/imageAvatars/ImageAvatar/lib/optimizedSrc/path.ts
50599
50795
  var width = function(_ref) {
@@ -50647,7 +50843,7 @@ var optimizedSrc = function(_ref) {
50647
50843
  // src/components/imageAvatars/ImageAvatar/index.tsx
50648
50844
  var import_jsx_runtime104 = require("react/jsx-runtime");
50649
50845
  var ImageAvatar = function(t0) {
50650
- var $ = (0, import_react_compiler_runtime108.c)(9);
50846
+ var $ = (0, import_react_compiler_runtime109.c)(9);
50651
50847
  var imageAvatar = t0.imageAvatar, size = t0.size, className = t0.className, style = t0.style;
50652
50848
  var superinterfaceContext = useSuperinterfaceContext();
50653
50849
  var t1;
@@ -50684,7 +50880,7 @@ var ImageAvatar = function(t0) {
50684
50880
  return t2;
50685
50881
  };
50686
50882
  // src/components/iconAvatars/IconAvatar.tsx
50687
- var import_react_compiler_runtime109 = require("react-compiler-runtime");
50883
+ var import_react_compiler_runtime110 = require("react-compiler-runtime");
50688
50884
  var import_react78 = require("react");
50689
50885
  var import_themes68 = require("@radix-ui/themes");
50690
50886
  // src/lib/iconAvatars/iconAvatarComponents.ts
@@ -50694,7 +50890,7 @@ var iconAvatarComponents = (_obj = {}, _define_property(_obj, IconAvatarName.BAC
50694
50890
  // src/components/iconAvatars/IconAvatar.tsx
50695
50891
  var import_jsx_runtime105 = require("react/jsx-runtime");
50696
50892
  var IconAvatar = function(t0) {
50697
- var $ = (0, import_react_compiler_runtime109.c)(7);
50893
+ var $ = (0, import_react_compiler_runtime110.c)(7);
50698
50894
  var iconAvatar = t0.iconAvatar, size = t0.size, className = t0.className, style = t0.style;
50699
50895
  var t1;
50700
50896
  t1 = iconAvatarComponents[iconAvatar.name];
@@ -50728,7 +50924,7 @@ var IconAvatar = function(t0) {
50728
50924
  // src/components/avatars/Avatar.tsx
50729
50925
  var import_jsx_runtime106 = require("react/jsx-runtime");
50730
50926
  var Avatar6 = function(t0) {
50731
- var $ = (0, import_react_compiler_runtime110.c)(14);
50927
+ var $ = (0, import_react_compiler_runtime111.c)(14);
50732
50928
  var avatar = t0.avatar, t1 = t0.size, className = t0.className, style = t0.style;
50733
50929
  var size = t1 === void 0 ? "1" : t1;
50734
50930
  if (avatar) {
@@ -50789,7 +50985,7 @@ var Avatar6 = function(t0) {
50789
50985
  return t2;
50790
50986
  };
50791
50987
  // src/components/components/ComponentsProvider.tsx
50792
- var import_react_compiler_runtime111 = require("react-compiler-runtime");
50988
+ var import_react_compiler_runtime112 = require("react-compiler-runtime");
50793
50989
  var import_react79 = require("react");
50794
50990
  var import_jsx_runtime107 = require("react/jsx-runtime");
50795
50991
  var _excluded9 = [
@@ -50814,7 +51010,7 @@ function _objectWithoutPropertiesLoose9(r, e) {
50814
51010
  return t;
50815
51011
  }
50816
51012
  var ComponentsProvider = function(t0) {
50817
- var $ = (0, import_react_compiler_runtime111.c)(9);
51013
+ var $ = (0, import_react_compiler_runtime112.c)(9);
50818
51014
  var children;
50819
51015
  var rest;
50820
51016
  if ($[0] !== t0) {
@@ -50857,11 +51053,11 @@ var ComponentsProvider = function(t0) {
50857
51053
  return t3;
50858
51054
  };
50859
51055
  // src/components/assistants/AssistantProvider/index.tsx
50860
- var import_react_compiler_runtime112 = require("react-compiler-runtime");
51056
+ var import_react_compiler_runtime113 = require("react-compiler-runtime");
50861
51057
  var import_jsx_runtime108 = require("react/jsx-runtime");
50862
51058
  var AssistantProvider = function(t0) {
50863
51059
  var _assistant$name;
50864
- var $ = (0, import_react_compiler_runtime112.c)(10);
51060
+ var $ = (0, import_react_compiler_runtime113.c)(10);
50865
51061
  var children = t0.children;
50866
51062
  var superinterfaceContext = useSuperinterfaceContext();
50867
51063
  var t1;