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

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,419 @@ 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 currentSentenceRef = (0, import_react67.useRef)(null);
47462
47497
  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
- })
47498
+ var t7;
47499
+ var t8;
47500
+ if ($[7] !== messagesProps.messages) {
47501
+ t7 = function() {
47502
+ var assistants = messagesProps.messages.filter(_temp9);
47503
+ setAudioQueue(function(prev) {
47504
+ var prevById = new Map(prev.map(_temp24));
47505
+ var next = [];
47506
+ var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
47507
+ try {
47508
+ for(var _iterator = assistants[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
47509
+ var m_0 = _step.value;
47510
+ var _existing$nextIndex, _existing$stopped;
47511
+ var inp = input({
47512
+ message: m_0
47513
+ });
47514
+ if (inp == null) {
47515
+ continue;
47516
+ }
47517
+ var sentences = segment(inp);
47518
+ var existing = prevById.get(m_0.id);
47519
+ next.push({
47520
+ id: m_0.id,
47521
+ status: m_0.status,
47522
+ sentences: sentences,
47523
+ nextIndex: Math.min((_existing$nextIndex = existing === null || existing === void 0 ? void 0 : existing.nextIndex) !== null && _existing$nextIndex !== void 0 ? _existing$nextIndex : 0, sentences.length),
47524
+ stopped: (_existing$stopped = existing === null || existing === void 0 ? void 0 : existing.stopped) !== null && _existing$stopped !== void 0 ? _existing$stopped : false
47525
+ });
47526
+ }
47527
+ } catch (err) {
47528
+ _didIteratorError = true;
47529
+ _iteratorError = err;
47530
+ } finally{
47531
+ try {
47532
+ if (!_iteratorNormalCompletion && _iterator.return != null) {
47533
+ _iterator.return();
47534
+ }
47535
+ } finally{
47536
+ if (_didIteratorError) {
47537
+ throw _iteratorError;
47538
+ }
47539
+ }
47540
+ }
47541
+ return next;
47542
+ });
47543
+ };
47544
+ t8 = [
47545
+ messagesProps.messages
47546
+ ];
47547
+ $[7] = messagesProps.messages;
47548
+ $[8] = t7;
47549
+ $[9] = t8;
47550
+ } else {
47551
+ t7 = $[8];
47552
+ t8 = $[9];
47553
+ }
47554
+ (0, import_react67.useEffect)(t7, t8);
47555
+ var t9;
47556
+ if ($[10] !== audioPlayer || $[11] !== fullSentenceRegex || $[12] !== isAudioPlayed || $[13] !== nextAudioPlayer || $[14] !== superinterfaceContext) {
47557
+ t9 = function(t102) {
47558
+ var input2 = t102.input, onPlay = t102.onPlay, onStop = t102.onStop, onEnd_0 = t102.onEnd;
47559
+ var searchParams = new URLSearchParams(_objectSpread47({
47560
+ input: input2
47561
+ }, superinterfaceContext.variables));
47562
+ audioPlayer.load("".concat(superinterfaceContext.baseUrl, "/audio-runtimes/tts?").concat(searchParams), {
47563
+ format: "mp3",
47564
+ autoplay: isAudioPlayed,
47565
+ html5: isHtmlAudioSupported,
47566
+ onplay: onPlay,
47567
+ onstop: onStop,
47568
+ onload: function() {
47569
+ var current = currentSentenceRef.current;
47570
+ if (!current) {
47571
+ return;
47572
+ }
47573
+ var msg = audioQueueRef.current.find(function(m_1) {
47574
+ return m_1.id === current.messageId;
47575
+ });
47576
+ if (!msg) {
47577
+ return;
47578
+ }
47579
+ var nextSentence = msg.sentences[msg.nextIndex];
47580
+ if (!nextSentence) {
47581
+ return;
47582
+ }
47583
+ if (!fullSentenceRegex.test(nextSentence)) {
47584
+ return;
47585
+ }
47586
+ var nextSearchParams = new URLSearchParams(_objectSpread47({
47587
+ input: nextSentence
47588
+ }, superinterfaceContext.variables));
47589
+ nextAudioPlayer.load("".concat(superinterfaceContext.baseUrl, "/audio-runtimes/tts?").concat(nextSearchParams), {
47590
+ format: "mp3",
47591
+ autoplay: false,
47592
+ html5: isHtmlAudioSupported
47593
+ });
47594
+ },
47595
+ onend: onEnd_0
47596
+ });
47597
+ };
47598
+ $[10] = audioPlayer;
47599
+ $[11] = fullSentenceRegex;
47600
+ $[12] = isAudioPlayed;
47601
+ $[13] = nextAudioPlayer;
47602
+ $[14] = superinterfaceContext;
47603
+ $[15] = t9;
47604
+ } else {
47605
+ t9 = $[15];
47606
+ }
47607
+ var defaultPlay = t9;
47608
+ var t10;
47609
+ t10 = passedPlay || defaultPlay;
47610
+ var play = t10;
47611
+ var t11;
47612
+ var t12;
47613
+ if ($[16] !== audioPlayer.playing || $[17] !== audioQueue || $[18] !== fullSentenceRegex || $[19] !== isPlaying || $[20] !== _onEnd || $[21] !== play) {
47614
+ t11 = function() {
47615
+ if (isPlaying) {
47616
+ return;
47617
+ }
47618
+ if (audioPlayer.playing) {
47619
+ return;
47620
+ }
47621
+ var candidate;
47622
+ candidate = null;
47623
+ var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
47624
+ try {
47625
+ for(var _iterator = audioQueue[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
47626
+ var msg_0 = _step.value;
47627
+ if (msg_0.stopped) {
47628
+ continue;
47629
+ }
47630
+ var sentence = msg_0.sentences[msg_0.nextIndex];
47631
+ if (!sentence) {
47632
+ continue;
47633
+ }
47634
+ var isFull = isOptimistic({
47635
+ id: msg_0.id
47636
+ }) || msg_0.status !== "in_progress" || fullSentenceRegex.test(sentence);
47637
+ if (isFull) {
47638
+ candidate = {
47639
+ messageId: msg_0.id,
47640
+ sentence: sentence,
47641
+ index: msg_0.nextIndex,
47642
+ ownerStatus: msg_0.status
47643
+ };
47644
+ break;
47645
+ }
47646
+ }
47647
+ } catch (err) {
47648
+ _didIteratorError = true;
47649
+ _iteratorError = err;
47650
+ } finally{
47651
+ try {
47652
+ if (!_iteratorNormalCompletion && _iterator.return != null) {
47653
+ _iterator.return();
47654
+ }
47655
+ } finally{
47656
+ if (_didIteratorError) {
47657
+ throw _iteratorError;
47658
+ }
47659
+ }
47660
+ }
47661
+ if (!candidate) {
47662
+ return;
47663
+ }
47664
+ setIsPlaying(true);
47665
+ currentSentenceRef.current = {
47666
+ messageId: candidate.messageId,
47667
+ index: candidate.index
47481
47668
  };
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
47669
+ setAudioQueue(function(prev_0) {
47670
+ return prev_0.map(function(m_2) {
47671
+ return m_2.id === candidate.messageId ? _objectSpread47(_objectSpread47({}, m_2), {}, {
47672
+ nextIndex: m_2.nextIndex + 1
47673
+ }) : m_2;
47674
+ });
47491
47675
  });
47492
- });
47493
- return messageSentences.filter(function(ms) {
47494
- return !playedMessageSentences.find(function(pms) {
47495
- return pms.messageId === ms.messageId && pms.sentence === ms.sentence;
47676
+ play({
47677
+ input: candidate.sentence,
47678
+ onPlay: function() {
47679
+ return setIsAudioPlayed(true);
47680
+ },
47681
+ onStop: function() {
47682
+ setAudioQueue(function(prev_1) {
47683
+ return prev_1.map(function(m_3) {
47684
+ return m_3.id === candidate.messageId ? _objectSpread47(_objectSpread47({}, m_3), {}, {
47685
+ stopped: true
47686
+ }) : m_3;
47687
+ });
47688
+ });
47689
+ setIsPlaying(false);
47690
+ currentSentenceRef.current = null;
47691
+ },
47692
+ onEnd: function() {
47693
+ setIsPlaying(false);
47694
+ currentSentenceRef.current = null;
47695
+ var hasPending = audioQueueRef.current.some(_temp32);
47696
+ if (!hasPending) {
47697
+ _onEnd();
47698
+ }
47699
+ }
47496
47700
  });
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
47701
+ };
47702
+ t12 = [
47703
+ isPlaying,
47704
+ audioPlayer.playing,
47705
+ audioQueue,
47706
+ play,
47707
+ fullSentenceRegex,
47708
+ _onEnd
47709
+ ];
47710
+ $[16] = audioPlayer.playing;
47711
+ $[17] = audioQueue;
47712
+ $[18] = fullSentenceRegex;
47713
+ $[19] = isPlaying;
47714
+ $[20] = _onEnd;
47715
+ $[21] = play;
47716
+ $[22] = t11;
47717
+ $[23] = t12;
47718
+ } else {
47719
+ t11 = $[22];
47720
+ t12 = $[23];
47721
+ }
47722
+ (0, import_react67.useEffect)(t11, t12);
47723
+ var t13;
47724
+ if ($[24] !== audioPlayer) {
47725
+ t13 = [
47726
+ audioPlayer
47727
+ ];
47728
+ $[24] = audioPlayer;
47729
+ $[25] = t13;
47730
+ } else {
47731
+ t13 = $[25];
47732
+ }
47733
+ (0, import_react67.useEffect)(_temp42, t13);
47734
+ var _ref3 = _sliced_to_array((0, import_react67.useState)(null), 2), audioEngine = _ref3[0], setAudioEngine = _ref3[1];
47735
+ var isAudioEngineInited = (0, import_react67.useRef)(false);
47736
+ var t14;
47737
+ if ($[26] !== audioPlayer.playing) {
47738
+ t14 = function() {
47739
+ if (!audioPlayer.playing) {
47740
+ return;
47741
+ }
47742
+ if (isAudioEngineInited.current) {
47743
+ return;
47744
+ }
47745
+ isAudioEngineInited.current = true;
47746
+ if (isHtmlAudioSupported) {
47747
+ var audioContext = new AudioContext();
47748
+ setAudioEngine({
47749
+ source: audioContext.createMediaElementSource(import_howler.Howler._howls[0]._sounds[0]._node),
47750
+ audioContext: audioContext
47525
47751
  });
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
- ]);
47752
+ } else {
47753
+ setAudioEngine({
47754
+ source: import_howler.Howler.masterGain,
47755
+ audioContext: import_howler.Howler.ctx
47573
47756
  });
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;
47582
- }
47583
47757
  }
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";
47758
+ };
47759
+ $[26] = audioPlayer.playing;
47760
+ $[27] = t14;
47761
+ } else {
47762
+ t14 = $[27];
47763
+ }
47764
+ var t15;
47765
+ if ($[28] !== audioPlayer) {
47766
+ t15 = [
47767
+ audioPlayer
47768
+ ];
47769
+ $[28] = audioPlayer;
47770
+ $[29] = t15;
47771
+ } else {
47772
+ t15 = $[29];
47773
+ }
47774
+ (0, import_react67.useEffect)(t14, t15);
47775
+ var t16;
47776
+ bb0: {
47777
+ if (!audioEngine) {
47778
+ t16 = null;
47779
+ break bb0;
47614
47780
  }
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
47631
- });
47781
+ var analyser;
47782
+ if ($[30] !== audioEngine.audioContext || $[31] !== audioEngine.source) {
47783
+ analyser = audioEngine.audioContext.createAnalyser();
47784
+ audioEngine.source.connect(audioEngine.audioContext.destination);
47785
+ audioEngine.source.connect(analyser);
47786
+ $[30] = audioEngine.audioContext;
47787
+ $[31] = audioEngine.source;
47788
+ $[32] = analyser;
47632
47789
  } else {
47633
- setAudioEngine({
47634
- source: import_howler.Howler.masterGain,
47635
- audioContext: import_howler.Howler.ctx
47636
- });
47637
- }
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
- });
47790
+ analyser = $[32];
47791
+ }
47792
+ t16 = analyser;
47793
+ }
47794
+ var visualizationAnalyser = t16;
47795
+ var t17;
47796
+ var t18;
47797
+ if ($[33] !== audioQueue || $[34] !== isPlaying) {
47798
+ t18 = isPlaying || audioQueue.some(_temp52);
47799
+ $[33] = audioQueue;
47800
+ $[34] = isPlaying;
47801
+ $[35] = t18;
47802
+ } else {
47803
+ t18 = $[35];
47804
+ }
47805
+ t17 = t18;
47806
+ var isPending = t17;
47807
+ var t19;
47808
+ if ($[36] !== audioPlayer || $[37] !== isAudioPlayed || $[38] !== isPending || $[39] !== visualizationAnalyser) {
47809
+ t19 = _objectSpread47(_objectSpread47({
47810
+ isPending: isPending,
47811
+ isAudioPlayed: isAudioPlayed
47812
+ }, audioPlayer), {}, {
47813
+ visualizationAnalyser: visualizationAnalyser
47814
+ });
47815
+ $[36] = audioPlayer;
47816
+ $[37] = isAudioPlayed;
47817
+ $[38] = isPending;
47818
+ $[39] = visualizationAnalyser;
47819
+ $[40] = t19;
47820
+ } else {
47821
+ t19 = $[40];
47822
+ }
47823
+ return t19;
47665
47824
  };
47825
+ function _temp9(m) {
47826
+ return m.role === "assistant";
47827
+ }
47828
+ function _temp24(p) {
47829
+ return [
47830
+ p.id,
47831
+ p
47832
+ ];
47833
+ }
47834
+ function _temp32(m_4) {
47835
+ if (m_4.stopped) {
47836
+ return false;
47837
+ }
47838
+ var hasMore = m_4.nextIndex < m_4.sentences.length;
47839
+ var streaming = m_4.status === "in_progress";
47840
+ return hasMore || streaming;
47841
+ }
47842
+ function _temp42() {
47843
+ if (isHtmlAudioSupported) {
47844
+ var _Howler$_howls$;
47845
+ 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)) {
47846
+ return;
47847
+ }
47848
+ import_howler.Howler._howls[0]._sounds[0]._node.crossOrigin = "anonymous";
47849
+ }
47850
+ }
47851
+ function _temp52(m_5) {
47852
+ return !m_5.stopped && (m_5.nextIndex < m_5.sentences.length || m_5.status === "in_progress");
47853
+ }
47666
47854
  // src/hooks/audioRuntimes/useTtsAudioRuntime/index.ts
47667
47855
  var import_react_query10 = require("@tanstack/react-query");
47668
47856
  // src/hooks/audioRuntimes/useTtsAudioRuntime/blobToData.ts
@@ -47700,7 +47888,7 @@ function _asyncToGenerator11(n) {
47700
47888
  };
47701
47889
  }
47702
47890
  var useTtsAudioRuntime = function(t0) {
47703
- var $ = (0, import_react_compiler_runtime88.c)(30);
47891
+ var $ = (0, import_react_compiler_runtime89.c)(30);
47704
47892
  var play = t0.play, passedOnEnd = t0.onEnd;
47705
47893
  var addToast = useToasts().addToast;
47706
47894
  var queryClient = (0, import_react_query10.useQueryClient)();
@@ -47729,7 +47917,7 @@ var useTtsAudioRuntime = function(t0) {
47729
47917
  if ($[1] !== createMessageProps) {
47730
47918
  t2 = {
47731
47919
  isStopOnSilence: true,
47732
- onStart: _temp9,
47920
+ onStart: _temp10,
47733
47921
  onStop: function() {
47734
47922
  var _onStop = _asyncToGenerator11(function(_event, chunks) {
47735
47923
  var blob, audioContent;
@@ -47870,23 +48058,23 @@ var useTtsAudioRuntime = function(t0) {
47870
48058
  t5 = t8;
47871
48059
  return t5;
47872
48060
  };
47873
- function _temp9() {
47874
- return _temp24.apply(this, arguments);
48061
+ function _temp10() {
48062
+ return _temp25.apply(this, arguments);
47875
48063
  }
47876
- function _temp24() {
47877
- _temp24 = _asyncToGenerator11(function() {
48064
+ function _temp25() {
48065
+ _temp25 = _asyncToGenerator11(function() {
47878
48066
  return _ts_generator(this, function(_state) {
47879
48067
  return [
47880
48068
  2
47881
48069
  ];
47882
48070
  });
47883
48071
  });
47884
- return _temp24.apply(this, arguments);
48072
+ return _temp25.apply(this, arguments);
47885
48073
  }
47886
48074
  // src/components/audioRuntimes/TtsAudioRuntimeProvider.tsx
47887
48075
  var import_jsx_runtime87 = require("react/jsx-runtime");
47888
48076
  var TtsAudioRuntimeProvider = function(t0) {
47889
- var $ = (0, import_react_compiler_runtime89.c)(8);
48077
+ var $ = (0, import_react_compiler_runtime90.c)(8);
47890
48078
  var children = t0.children, play = t0.play, onEnd = t0.onEnd;
47891
48079
  var t1;
47892
48080
  if ($[0] !== onEnd || $[1] !== play) {
@@ -47999,7 +48187,7 @@ function _objectWithoutPropertiesLoose5(r, e) {
47999
48187
  return t;
48000
48188
  }
48001
48189
  var Content9 = function(t0) {
48002
- var $ = (0, import_react_compiler_runtime90.c)(4);
48190
+ var $ = (0, import_react_compiler_runtime91.c)(4);
48003
48191
  var children = t0.children, className = t0.className, style = t0.style;
48004
48192
  var t1;
48005
48193
  if ($[0] !== children || $[1] !== className || $[2] !== style) {
@@ -48021,7 +48209,7 @@ var Content9 = function(t0) {
48021
48209
  return t1;
48022
48210
  };
48023
48211
  var AudioRuntimeProvider = function(t0) {
48024
- var $ = (0, import_react_compiler_runtime90.c)(4);
48212
+ var $ = (0, import_react_compiler_runtime91.c)(4);
48025
48213
  var children = t0.children, play = t0.play, onEnd = t0.onEnd;
48026
48214
  var audioThreadContext = useAudioThreadContext();
48027
48215
  if (audioThreadContext.audioRuntime) {
@@ -48044,7 +48232,7 @@ var AudioRuntimeProvider = function(t0) {
48044
48232
  return t1;
48045
48233
  };
48046
48234
  var Provider5 = function(t0) {
48047
- var $ = (0, import_react_compiler_runtime90.c)(9);
48235
+ var $ = (0, import_react_compiler_runtime91.c)(9);
48048
48236
  var children;
48049
48237
  var rest;
48050
48238
  if ($[0] !== t0) {
@@ -48084,7 +48272,7 @@ var Provider5 = function(t0) {
48084
48272
  return t2;
48085
48273
  };
48086
48274
  var Root16 = function(t0) {
48087
- var $ = (0, import_react_compiler_runtime90.c)(18);
48275
+ var $ = (0, import_react_compiler_runtime91.c)(18);
48088
48276
  var children;
48089
48277
  var className;
48090
48278
  var onEnd;
@@ -48156,7 +48344,7 @@ var Root16 = function(t0) {
48156
48344
  return t3;
48157
48345
  };
48158
48346
  // src/components/threads/AudioThread/Visualization/index.tsx
48159
- var import_react_compiler_runtime92 = require("react-compiler-runtime");
48347
+ var import_react_compiler_runtime93 = require("react-compiler-runtime");
48160
48348
  var import_react71 = require("react");
48161
48349
  var import_lodash9 = __toESM(require("lodash"), 1);
48162
48350
  var import_themes60 = require("@radix-ui/themes");
@@ -48225,10 +48413,10 @@ var BarsVisualizer = function(_ref) {
48225
48413
  });
48226
48414
  };
48227
48415
  // src/hooks/audioThreads/useStatus/index.ts
48228
- var import_react_compiler_runtime91 = require("react-compiler-runtime");
48416
+ var import_react_compiler_runtime92 = require("react-compiler-runtime");
48229
48417
  var import_react70 = require("react");
48230
48418
  var useStatus = function() {
48231
- var $ = (0, import_react_compiler_runtime91.c)(2);
48419
+ var $ = (0, import_react_compiler_runtime92.c)(2);
48232
48420
  var audioRuntime = useAudioThreadContext().audioRuntime;
48233
48421
  var t0;
48234
48422
  bb0: {
@@ -48388,7 +48576,7 @@ var Provider6 = function(_ref) {
48388
48576
  });
48389
48577
  };
48390
48578
  var Root17 = function(t0) {
48391
- var $ = (0, import_react_compiler_runtime92.c)(6);
48579
+ var $ = (0, import_react_compiler_runtime93.c)(6);
48392
48580
  var children;
48393
48581
  var rest;
48394
48582
  if ($[0] !== t0) {
@@ -48425,7 +48613,7 @@ var Root17 = function(t0) {
48425
48613
  return t1;
48426
48614
  };
48427
48615
  var BarsVisualizer2 = function(t0) {
48428
- var $ = (0, import_react_compiler_runtime92.c)(10);
48616
+ var $ = (0, import_react_compiler_runtime93.c)(10);
48429
48617
  var rest;
48430
48618
  var t1;
48431
48619
  var t2;
@@ -48469,7 +48657,7 @@ var BarsVisualizer2 = function(t0) {
48469
48657
  return t4;
48470
48658
  };
48471
48659
  var AssistantVisualizationRoot = function(t0) {
48472
- var $ = (0, import_react_compiler_runtime92.c)(17);
48660
+ var $ = (0, import_react_compiler_runtime93.c)(17);
48473
48661
  var children;
48474
48662
  var rest;
48475
48663
  var t1;
@@ -48542,7 +48730,7 @@ var AssistantVisualizationRoot = function(t0) {
48542
48730
  return t6;
48543
48731
  };
48544
48732
  var AssistantVisualization = function(props) {
48545
- var $ = (0, import_react_compiler_runtime92.c)(3);
48733
+ var $ = (0, import_react_compiler_runtime93.c)(3);
48546
48734
  var t0;
48547
48735
  if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
48548
48736
  t0 = /* @__PURE__ */ (0, import_jsx_runtime90.jsx)(BarsVisualizer2, {});
@@ -48565,7 +48753,7 @@ var AssistantVisualization = function(props) {
48565
48753
  AssistantVisualization.Root = AssistantVisualizationRoot;
48566
48754
  AssistantVisualization.BarsVisualizer = BarsVisualizer2;
48567
48755
  var AssistantInfo = function(props) {
48568
- var $ = (0, import_react_compiler_runtime92.c)(6);
48756
+ var $ = (0, import_react_compiler_runtime93.c)(6);
48569
48757
  var assistantNameContext = (0, import_react71.useContext)(AssistantNameContext);
48570
48758
  var t0;
48571
48759
  if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
@@ -48605,7 +48793,7 @@ var AssistantInfo = function(props) {
48605
48793
  return t2;
48606
48794
  };
48607
48795
  var Visualization = function(props) {
48608
- var $ = (0, import_react_compiler_runtime92.c)(4);
48796
+ var $ = (0, import_react_compiler_runtime93.c)(4);
48609
48797
  var t0;
48610
48798
  var t1;
48611
48799
  if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
@@ -48637,9 +48825,9 @@ Visualization.Provider = Provider6;
48637
48825
  Visualization.AssistantVisualization = AssistantVisualization;
48638
48826
  Visualization.AssistantInfo = AssistantInfo;
48639
48827
  // src/components/threads/AudioThread/Status/index.tsx
48640
- var import_react_compiler_runtime94 = require("react-compiler-runtime");
48828
+ var import_react_compiler_runtime95 = require("react-compiler-runtime");
48641
48829
  // src/components/threads/AudioThread/Status/StatusMessages.tsx
48642
- var import_react_compiler_runtime93 = require("react-compiler-runtime");
48830
+ var import_react_compiler_runtime94 = require("react-compiler-runtime");
48643
48831
  var import_themes61 = require("@radix-ui/themes");
48644
48832
  var import_jsx_runtime91 = require("react/jsx-runtime");
48645
48833
  var html = function(_ref) {
@@ -48649,7 +48837,7 @@ var html = function(_ref) {
48649
48837
  }).join(""), "\n }");
48650
48838
  };
48651
48839
  var StatusMessages = function(t0) {
48652
- var $ = (0, import_react_compiler_runtime93.c)(9);
48840
+ var $ = (0, import_react_compiler_runtime94.c)(9);
48653
48841
  var texts = t0.texts, className = t0.className, style = t0.style;
48654
48842
  var t1;
48655
48843
  if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
@@ -48753,7 +48941,7 @@ function _toPrimitive50(t, r) {
48753
48941
  return ("string" === r ? String : Number)(t);
48754
48942
  }
48755
48943
  var Status = function(props) {
48756
- var $ = (0, import_react_compiler_runtime94.c)(12);
48944
+ var $ = (0, import_react_compiler_runtime95.c)(12);
48757
48945
  var status = useStatus().status;
48758
48946
  if (status === "recording") {
48759
48947
  var _t;
@@ -48850,10 +49038,10 @@ var Status = function(props) {
48850
49038
  return t1;
48851
49039
  };
48852
49040
  // src/components/threads/AudioThread/Form/index.tsx
48853
- var import_react_compiler_runtime97 = require("react-compiler-runtime");
49041
+ var import_react_compiler_runtime98 = require("react-compiler-runtime");
48854
49042
  var import_themes63 = require("@radix-ui/themes");
48855
49043
  // src/components/threads/AudioThread/Form/MicIcon.tsx
48856
- var import_react_compiler_runtime95 = require("react-compiler-runtime");
49044
+ var import_react_compiler_runtime96 = require("react-compiler-runtime");
48857
49045
  var import_jsx_runtime93 = require("react/jsx-runtime");
48858
49046
  function ownKeys51(e, r) {
48859
49047
  var t = Object.keys(e);
@@ -48899,7 +49087,7 @@ function _toPrimitive51(t, r) {
48899
49087
  return ("string" === r ? String : Number)(t);
48900
49088
  }
48901
49089
  var MicIcon = function(props) {
48902
- var $ = (0, import_react_compiler_runtime95.c)(3);
49090
+ var $ = (0, import_react_compiler_runtime96.c)(3);
48903
49091
  var t0;
48904
49092
  if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
48905
49093
  t0 = /* @__PURE__ */ (0, import_jsx_runtime93.jsx)("path", {
@@ -48931,12 +49119,12 @@ var MicIcon = function(props) {
48931
49119
  return t1;
48932
49120
  };
48933
49121
  // src/components/threads/AudioThread/Form/ActionButton/index.tsx
48934
- var import_react_compiler_runtime96 = require("react-compiler-runtime");
49122
+ var import_react_compiler_runtime97 = require("react-compiler-runtime");
48935
49123
  var import_themes62 = require("@radix-ui/themes");
48936
49124
  var import_react_icons17 = require("@radix-ui/react-icons");
48937
49125
  var import_jsx_runtime94 = require("react/jsx-runtime");
48938
49126
  var ActionButton = function() {
48939
- var $ = (0, import_react_compiler_runtime96.c)(27);
49127
+ var $ = (0, import_react_compiler_runtime97.c)(27);
48940
49128
  var status = useStatus().status;
48941
49129
  var audioThreadContext = useAudioThreadContext();
48942
49130
  var superinterfaceContext = useSuperinterfaceContext();
@@ -49174,7 +49362,7 @@ function _toPrimitive52(t, r) {
49174
49362
  return ("string" === r ? String : Number)(t);
49175
49363
  }
49176
49364
  var Form = function(props) {
49177
- var $ = (0, import_react_compiler_runtime97.c)(17);
49365
+ var $ = (0, import_react_compiler_runtime98.c)(17);
49178
49366
  var status = useStatus().status;
49179
49367
  var audioThreadContext = useAudioThreadContext();
49180
49368
  var t0 = status === "recording" ? "var(--accent-11)" : "var(--gray-11)";
@@ -49324,7 +49512,7 @@ function _toPrimitive53(t, r) {
49324
49512
  return ("string" === r ? String : Number)(t);
49325
49513
  }
49326
49514
  var AudioThread = function(props) {
49327
- var $ = (0, import_react_compiler_runtime98.c)(5);
49515
+ var $ = (0, import_react_compiler_runtime99.c)(5);
49328
49516
  var t0;
49329
49517
  var t1;
49330
49518
  var t2;
@@ -49406,7 +49594,7 @@ function _toPrimitive54(t, r) {
49406
49594
  return ("string" === r ? String : Number)(t);
49407
49595
  }
49408
49596
  var AudioThreadDialog = function(props) {
49409
- var $ = (0, import_react_compiler_runtime99.c)(4);
49597
+ var $ = (0, import_react_compiler_runtime100.c)(4);
49410
49598
  var t0;
49411
49599
  var t1;
49412
49600
  if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
@@ -49928,10 +50116,10 @@ var useWebrtcAudioRuntime = function() {
49928
50116
  ]);
49929
50117
  };
49930
50118
  // src/components/audioRuntimes/WebrtcAudioRuntimeProvider.tsx
49931
- var import_react_compiler_runtime100 = require("react-compiler-runtime");
50119
+ var import_react_compiler_runtime101 = require("react-compiler-runtime");
49932
50120
  var import_jsx_runtime98 = require("react/jsx-runtime");
49933
50121
  var WebrtcAudioRuntimeProvider = function(t0) {
49934
- var $ = (0, import_react_compiler_runtime100.c)(5);
50122
+ var $ = (0, import_react_compiler_runtime101.c)(5);
49935
50123
  var children = t0.children;
49936
50124
  var webrtcAudioRuntime = useWebrtcAudioRuntime().webrtcAudioRuntime;
49937
50125
  var t1;
@@ -49959,20 +50147,20 @@ var WebrtcAudioRuntimeProvider = function(t0) {
49959
50147
  return t2;
49960
50148
  };
49961
50149
  // src/components/gui/Gui/index.tsx
49962
- var import_react_compiler_runtime103 = require("react-compiler-runtime");
50150
+ var import_react_compiler_runtime104 = require("react-compiler-runtime");
49963
50151
  var import_react75 = require("react");
49964
50152
  var import_themes64 = require("@radix-ui/themes");
49965
50153
  // src/hooks/messages/useLatestAssistantMessage/index.ts
49966
- var import_react_compiler_runtime101 = require("react-compiler-runtime");
50154
+ var import_react_compiler_runtime102 = require("react-compiler-runtime");
49967
50155
  var import_react73 = require("react");
49968
50156
  var useLatestAssistantMessage = function() {
49969
- var $ = (0, import_react_compiler_runtime101.c)(4);
50157
+ var $ = (0, import_react_compiler_runtime102.c)(4);
49970
50158
  var _useMessages = useMessages(), messages2 = _useMessages.messages;
49971
50159
  var t0;
49972
50160
  var t1;
49973
50161
  if ($[0] !== messages2) {
49974
50162
  var _messages$find;
49975
- t1 = (_messages$find = messages2.find(_temp10)) !== null && _messages$find !== void 0 ? _messages$find : null;
50163
+ t1 = (_messages$find = messages2.find(_temp11)) !== null && _messages$find !== void 0 ? _messages$find : null;
49976
50164
  $[0] = messages2;
49977
50165
  $[1] = t1;
49978
50166
  } else {
@@ -49991,21 +50179,21 @@ var useLatestAssistantMessage = function() {
49991
50179
  t0 = t2;
49992
50180
  return t0;
49993
50181
  };
49994
- function _temp10(message) {
50182
+ function _temp11(message) {
49995
50183
  return message.role === "assistant";
49996
50184
  }
49997
50185
  // src/hooks/messages/useLatestAssistantMessageWithContent/index.ts
49998
- var import_react_compiler_runtime102 = require("react-compiler-runtime");
50186
+ var import_react_compiler_runtime103 = require("react-compiler-runtime");
49999
50187
  var import_radash18 = require("radash");
50000
50188
  var import_react74 = require("react");
50001
50189
  var useLatestAssistantMessageWithContent = function() {
50002
- var $ = (0, import_react_compiler_runtime102.c)(4);
50190
+ var $ = (0, import_react_compiler_runtime103.c)(4);
50003
50191
  var _useMessages = useMessages(), messages2 = _useMessages.messages;
50004
50192
  var t0;
50005
50193
  var t1;
50006
50194
  if ($[0] !== messages2) {
50007
50195
  var _messages$find;
50008
- t1 = (_messages$find = messages2.find(_temp25)) !== null && _messages$find !== void 0 ? _messages$find : null;
50196
+ t1 = (_messages$find = messages2.find(_temp26)) !== null && _messages$find !== void 0 ? _messages$find : null;
50009
50197
  $[0] = messages2;
50010
50198
  $[1] = t1;
50011
50199
  } else {
@@ -50024,16 +50212,16 @@ var useLatestAssistantMessageWithContent = function() {
50024
50212
  t0 = t2;
50025
50213
  return t0;
50026
50214
  };
50027
- function _temp11(content2) {
50215
+ function _temp12(content2) {
50028
50216
  return content2.type === "text" && !(0, import_radash18.isEmpty)(content2.text.value);
50029
50217
  }
50030
- function _temp25(message) {
50031
- return message.role === "assistant" && message.content.some(_temp11);
50218
+ function _temp26(message) {
50219
+ return message.role === "assistant" && message.content.some(_temp12);
50032
50220
  }
50033
50221
  // src/components/gui/Gui/index.tsx
50034
50222
  var import_jsx_runtime99 = require("react/jsx-runtime");
50035
50223
  var StartingToolCalls3 = function() {
50036
- var $ = (0, import_react_compiler_runtime103.c)(2);
50224
+ var $ = (0, import_react_compiler_runtime104.c)(2);
50037
50225
  var _useComponents = useComponents(), t0 = _useComponents.components;
50038
50226
  var StartingToolCalls4 = t0.StartingToolCalls;
50039
50227
  var t1;
@@ -50047,7 +50235,7 @@ var StartingToolCalls3 = function() {
50047
50235
  return t1;
50048
50236
  };
50049
50237
  var Content10 = function(t0) {
50050
- var $ = (0, import_react_compiler_runtime103.c)(5);
50238
+ var $ = (0, import_react_compiler_runtime104.c)(5);
50051
50239
  var latestRunStep = t0.latestRunStep;
50052
50240
  var t1;
50053
50241
  bb0: {
@@ -50101,14 +50289,14 @@ var Content10 = function(t0) {
50101
50289
  return t2;
50102
50290
  };
50103
50291
  var Progress2 = function(t0) {
50104
- var $ = (0, import_react_compiler_runtime103.c)(5);
50292
+ var $ = (0, import_react_compiler_runtime104.c)(5);
50105
50293
  var latestAssistantMessage = t0.latestAssistantMessage;
50106
50294
  var isMutatingMessage = useIsMutatingMessage();
50107
50295
  var t1;
50108
50296
  var t2;
50109
50297
  if ($[0] !== latestAssistantMessage.runSteps) {
50110
50298
  var _latestAssistantMessa;
50111
- t2 = (_latestAssistantMessa = latestAssistantMessage.runSteps.find(_temp12)) !== null && _latestAssistantMessa !== void 0 ? _latestAssistantMessa : null;
50299
+ t2 = (_latestAssistantMessa = latestAssistantMessage.runSteps.find(_temp13)) !== null && _latestAssistantMessa !== void 0 ? _latestAssistantMessa : null;
50112
50300
  $[0] = latestAssistantMessage.runSteps;
50113
50301
  $[1] = t2;
50114
50302
  } else {
@@ -50151,7 +50339,7 @@ var Progress2 = function(t0) {
50151
50339
  return t4;
50152
50340
  };
50153
50341
  var Gui = function() {
50154
- var $ = (0, import_react_compiler_runtime103.c)(8);
50342
+ var $ = (0, import_react_compiler_runtime104.c)(8);
50155
50343
  var latestAssistantMessage = useLatestAssistantMessage().latestAssistantMessage;
50156
50344
  var latestAssistantMessageWithContent = useLatestAssistantMessageWithContent().latestAssistantMessageWithContent;
50157
50345
  if (!latestAssistantMessage || !latestAssistantMessageWithContent) {
@@ -50213,11 +50401,11 @@ var Gui = function() {
50213
50401
  }
50214
50402
  return t2;
50215
50403
  };
50216
- function _temp12(rs) {
50404
+ function _temp13(rs) {
50217
50405
  return rs.status === "in_progress";
50218
50406
  }
50219
50407
  // src/components/markdown/MarkdownProvider/index.tsx
50220
- var import_react_compiler_runtime104 = require("react-compiler-runtime");
50408
+ var import_react_compiler_runtime105 = require("react-compiler-runtime");
50221
50409
  var import_react76 = require("react");
50222
50410
  var import_jsx_runtime100 = require("react/jsx-runtime");
50223
50411
  var _excluded7 = [
@@ -50242,7 +50430,7 @@ function _objectWithoutPropertiesLoose7(r, e) {
50242
50430
  return t;
50243
50431
  }
50244
50432
  var MarkdownProvider = function(t0) {
50245
- var $ = (0, import_react_compiler_runtime104.c)(9);
50433
+ var $ = (0, import_react_compiler_runtime105.c)(9);
50246
50434
  var children;
50247
50435
  var rest;
50248
50436
  if ($[0] !== t0) {
@@ -50285,18 +50473,18 @@ var MarkdownProvider = function(t0) {
50285
50473
  return t3;
50286
50474
  };
50287
50475
  // src/components/annotations/SourceAnnotation/index.tsx
50288
- var import_react_compiler_runtime107 = require("react-compiler-runtime");
50476
+ var import_react_compiler_runtime108 = require("react-compiler-runtime");
50289
50477
  // src/components/annotations/SourceAnnotation/FileCitation/index.tsx
50290
- var import_react_compiler_runtime106 = require("react-compiler-runtime");
50478
+ var import_react_compiler_runtime107 = require("react-compiler-runtime");
50291
50479
  var import_react77 = require("react");
50292
50480
  var import_react_icons18 = require("@radix-ui/react-icons");
50293
50481
  var import_themes66 = require("@radix-ui/themes");
50294
50482
  // src/components/annotations/SourceAnnotation/FileCitation/Content.tsx
50295
- var import_react_compiler_runtime105 = require("react-compiler-runtime");
50483
+ var import_react_compiler_runtime106 = require("react-compiler-runtime");
50296
50484
  var import_themes65 = require("@radix-ui/themes");
50297
50485
  var import_jsx_runtime101 = require("react/jsx-runtime");
50298
50486
  var Content11 = function(t0) {
50299
- var $ = (0, import_react_compiler_runtime105.c)(5);
50487
+ var $ = (0, import_react_compiler_runtime106.c)(5);
50300
50488
  var fileId = t0.fileId;
50301
50489
  var superinterfaceContext = useSuperinterfaceContext();
50302
50490
  var nextSearchParams = new URLSearchParams(superinterfaceContext.variables);
@@ -50362,7 +50550,7 @@ var Content11 = function(t0) {
50362
50550
  // src/components/annotations/SourceAnnotation/FileCitation/index.tsx
50363
50551
  var import_jsx_runtime102 = require("react/jsx-runtime");
50364
50552
  var FileCitation = function(t0) {
50365
- var $ = (0, import_react_compiler_runtime106.c)(18);
50553
+ var $ = (0, import_react_compiler_runtime107.c)(18);
50366
50554
  var annotation = t0.annotation;
50367
50555
  var _ref = _sliced_to_array((0, import_react77.useState)(null), 2), activeFileId = _ref[0], setActiveFileId = _ref[1];
50368
50556
  var t1;
@@ -50511,7 +50699,7 @@ function _objectWithoutPropertiesLoose8(r, e) {
50511
50699
  return t;
50512
50700
  }
50513
50701
  var SourceAnnotation = function(t0) {
50514
- var $ = (0, import_react_compiler_runtime107.c)(10);
50702
+ var $ = (0, import_react_compiler_runtime108.c)(10);
50515
50703
  var children;
50516
50704
  var rest;
50517
50705
  if ($[0] !== t0) {
@@ -50568,7 +50756,7 @@ var SourceAnnotation = function(t0) {
50568
50756
  return null;
50569
50757
  };
50570
50758
  // src/components/avatars/Avatar.tsx
50571
- var import_react_compiler_runtime110 = require("react-compiler-runtime");
50759
+ var import_react_compiler_runtime111 = require("react-compiler-runtime");
50572
50760
  // src/enums/index.ts
50573
50761
  var IconAvatarName = /* @__PURE__ */ function(IconAvatarName2) {
50574
50762
  IconAvatarName2["BACKPACK"] = "BACKPACK";
@@ -50593,7 +50781,7 @@ var AvatarType = /* @__PURE__ */ function(AvatarType2) {
50593
50781
  // src/components/avatars/Avatar.tsx
50594
50782
  var import_themes69 = require("@radix-ui/themes");
50595
50783
  // src/components/imageAvatars/ImageAvatar/index.tsx
50596
- var import_react_compiler_runtime108 = require("react-compiler-runtime");
50784
+ var import_react_compiler_runtime109 = require("react-compiler-runtime");
50597
50785
  var import_themes67 = require("@radix-ui/themes");
50598
50786
  // src/components/imageAvatars/ImageAvatar/lib/optimizedSrc/path.ts
50599
50787
  var width = function(_ref) {
@@ -50647,7 +50835,7 @@ var optimizedSrc = function(_ref) {
50647
50835
  // src/components/imageAvatars/ImageAvatar/index.tsx
50648
50836
  var import_jsx_runtime104 = require("react/jsx-runtime");
50649
50837
  var ImageAvatar = function(t0) {
50650
- var $ = (0, import_react_compiler_runtime108.c)(9);
50838
+ var $ = (0, import_react_compiler_runtime109.c)(9);
50651
50839
  var imageAvatar = t0.imageAvatar, size = t0.size, className = t0.className, style = t0.style;
50652
50840
  var superinterfaceContext = useSuperinterfaceContext();
50653
50841
  var t1;
@@ -50684,7 +50872,7 @@ var ImageAvatar = function(t0) {
50684
50872
  return t2;
50685
50873
  };
50686
50874
  // src/components/iconAvatars/IconAvatar.tsx
50687
- var import_react_compiler_runtime109 = require("react-compiler-runtime");
50875
+ var import_react_compiler_runtime110 = require("react-compiler-runtime");
50688
50876
  var import_react78 = require("react");
50689
50877
  var import_themes68 = require("@radix-ui/themes");
50690
50878
  // src/lib/iconAvatars/iconAvatarComponents.ts
@@ -50694,7 +50882,7 @@ var iconAvatarComponents = (_obj = {}, _define_property(_obj, IconAvatarName.BAC
50694
50882
  // src/components/iconAvatars/IconAvatar.tsx
50695
50883
  var import_jsx_runtime105 = require("react/jsx-runtime");
50696
50884
  var IconAvatar = function(t0) {
50697
- var $ = (0, import_react_compiler_runtime109.c)(7);
50885
+ var $ = (0, import_react_compiler_runtime110.c)(7);
50698
50886
  var iconAvatar = t0.iconAvatar, size = t0.size, className = t0.className, style = t0.style;
50699
50887
  var t1;
50700
50888
  t1 = iconAvatarComponents[iconAvatar.name];
@@ -50728,7 +50916,7 @@ var IconAvatar = function(t0) {
50728
50916
  // src/components/avatars/Avatar.tsx
50729
50917
  var import_jsx_runtime106 = require("react/jsx-runtime");
50730
50918
  var Avatar6 = function(t0) {
50731
- var $ = (0, import_react_compiler_runtime110.c)(14);
50919
+ var $ = (0, import_react_compiler_runtime111.c)(14);
50732
50920
  var avatar = t0.avatar, t1 = t0.size, className = t0.className, style = t0.style;
50733
50921
  var size = t1 === void 0 ? "1" : t1;
50734
50922
  if (avatar) {
@@ -50789,7 +50977,7 @@ var Avatar6 = function(t0) {
50789
50977
  return t2;
50790
50978
  };
50791
50979
  // src/components/components/ComponentsProvider.tsx
50792
- var import_react_compiler_runtime111 = require("react-compiler-runtime");
50980
+ var import_react_compiler_runtime112 = require("react-compiler-runtime");
50793
50981
  var import_react79 = require("react");
50794
50982
  var import_jsx_runtime107 = require("react/jsx-runtime");
50795
50983
  var _excluded9 = [
@@ -50814,7 +51002,7 @@ function _objectWithoutPropertiesLoose9(r, e) {
50814
51002
  return t;
50815
51003
  }
50816
51004
  var ComponentsProvider = function(t0) {
50817
- var $ = (0, import_react_compiler_runtime111.c)(9);
51005
+ var $ = (0, import_react_compiler_runtime112.c)(9);
50818
51006
  var children;
50819
51007
  var rest;
50820
51008
  if ($[0] !== t0) {
@@ -50857,11 +51045,11 @@ var ComponentsProvider = function(t0) {
50857
51045
  return t3;
50858
51046
  };
50859
51047
  // src/components/assistants/AssistantProvider/index.tsx
50860
- var import_react_compiler_runtime112 = require("react-compiler-runtime");
51048
+ var import_react_compiler_runtime113 = require("react-compiler-runtime");
50861
51049
  var import_jsx_runtime108 = require("react/jsx-runtime");
50862
51050
  var AssistantProvider = function(t0) {
50863
51051
  var _assistant$name;
50864
- var $ = (0, import_react_compiler_runtime112.c)(10);
51052
+ var $ = (0, import_react_compiler_runtime113.c)(10);
50865
51053
  var children = t0.children;
50866
51054
  var superinterfaceContext = useSuperinterfaceContext();
50867
51055
  var t1;