@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.js CHANGED
@@ -46868,11 +46868,11 @@ ThreadDialog.Root = Root13;
46868
46868
  ThreadDialog.Trigger = Trigger;
46869
46869
  ThreadDialog.Content = Content8;
46870
46870
  // src/components/threads/AudioThreadDialog/index.tsx
46871
- import { c as _c99 } from "react-compiler-runtime";
46871
+ import { c as _c100 } from "react-compiler-runtime";
46872
46872
  // src/components/threads/AudioThread/index.tsx
46873
- import { c as _c98 } from "react-compiler-runtime";
46873
+ import { c as _c99 } from "react-compiler-runtime";
46874
46874
  // src/components/threads/AudioThread/Root/index.tsx
46875
- import { c as _c90 } from "react-compiler-runtime";
46875
+ import { c as _c91 } from "react-compiler-runtime";
46876
46876
  import { Flex as Flex29 } from "@radix-ui/themes";
46877
46877
  // src/contexts/threads/AudioThreadContext/index.ts
46878
46878
  import { createContext as createContext13 } from "react";
@@ -46885,9 +46885,9 @@ var useAudioThreadContext = function() {
46885
46885
  return useContext19(AudioThreadContext);
46886
46886
  };
46887
46887
  // src/components/audioRuntimes/TtsAudioRuntimeProvider.tsx
46888
- import { c as _c89 } from "react-compiler-runtime";
46888
+ import { c as _c90 } from "react-compiler-runtime";
46889
46889
  // src/hooks/audioRuntimes/useTtsAudioRuntime/index.ts
46890
- import { c as _c88 } from "react-compiler-runtime";
46890
+ import { c as _c89 } from "react-compiler-runtime";
46891
46891
  import { useMemo as useMemo18 } from "react";
46892
46892
  // src/hooks/misc/usePermission/index.ts
46893
46893
  import { c as _c86 } from "react-compiler-runtime";
@@ -47219,6 +47219,7 @@ var useRecorder = function(_ref) {
47219
47219
  });
47220
47220
  };
47221
47221
  // src/hooks/audioThreads/useMessageAudio/index.ts
47222
+ import { c as _c88 } from "react-compiler-runtime";
47222
47223
  import { useMemo as useMemo17, useRef as useRef8, useState as useState9, useEffect as useEffect10, useCallback as useCallback7 } from "react";
47223
47224
  import nlp from "compromise";
47224
47225
  import { Howler } from "howler";
@@ -47288,232 +47289,427 @@ function _toPrimitive47(t, r) {
47288
47289
  }
47289
47290
  return ("string" === r ? String : Number)(t);
47290
47291
  }
47291
- var getMessageSentences = function(_ref) {
47292
- var messageId = _ref.messageId, input2 = _ref.input;
47293
- var sentences = nlp(input2).sentences().json();
47294
- return sentences.map(function(sentence) {
47295
- return {
47296
- messageId: messageId,
47297
- sentence: sentence.text
47298
- };
47292
+ var segment = function(input2) {
47293
+ return nlp(input2).sentences().json().map(function(s) {
47294
+ return s.text;
47299
47295
  });
47300
47296
  };
47301
- var useMessageAudio = function(_ref2) {
47302
- var _latestMessageProps$l2;
47303
- var _onEnd = _ref2.onEnd, passedPlay = _ref2.play, _ref2_fullSentenceRegex = _ref2.fullSentenceRegex, fullSentenceRegex = _ref2_fullSentenceRegex === void 0 ? /[\.?!]$/ : _ref2_fullSentenceRegex;
47297
+ var useMessageAudio = function(t0) {
47298
+ var $ = _c88(41);
47299
+ var _onEnd = t0.onEnd, passedPlay = t0.play, t1 = t0.fullSentenceRegex;
47300
+ var t2;
47301
+ if ($[0] !== t1) {
47302
+ t2 = t1 === void 0 ? /[\.?!]$/ : t1;
47303
+ $[0] = t1;
47304
+ $[1] = t2;
47305
+ } else {
47306
+ t2 = $[1];
47307
+ }
47308
+ var fullSentenceRegex = t2;
47304
47309
  var _useState9 = _sliced_to_array(useState9(false), 2), isAudioPlayed = _useState9[0], setIsAudioPlayed = _useState9[1];
47305
- var _useState91 = _sliced_to_array(useState9([]), 2), stoppedMessageIds = _useState91[0], setStoppedMessageIds = _useState91[1];
47306
- var _useState92 = _sliced_to_array(useState9([]), 2), playedMessageSentences = _useState92[0], setPlayedMessageSentences = _useState92[1];
47307
47310
  var audioPlayer = useAudioPlayer2();
47308
47311
  var nextAudioPlayer = useAudioPlayer2();
47309
47312
  var superinterfaceContext = useSuperinterfaceContext();
47310
- var _useState93 = _sliced_to_array(useState9(false), 2), isPlaying = _useState93[0], setIsPlaying = _useState93[1];
47311
- var isLastSentencePlayedRef = useRef8(false);
47312
- var latestMessageProps = useLatestMessage();
47313
+ var _useState91 = _sliced_to_array(useState9(false), 2), isPlaying = _useState91[0], setIsPlaying = _useState91[1];
47314
+ var t3;
47315
+ if ($[2] === Symbol.for("react.memo_cache_sentinel")) {
47316
+ t3 = [];
47317
+ $[2] = t3;
47318
+ } else {
47319
+ t3 = $[2];
47320
+ }
47321
+ var _useState92 = _sliced_to_array(useState9(t3), 2), audioQueue = _useState92[0], setAudioQueue = _useState92[1];
47322
+ var t4;
47323
+ if ($[3] === Symbol.for("react.memo_cache_sentinel")) {
47324
+ t4 = [];
47325
+ $[3] = t4;
47326
+ } else {
47327
+ t4 = $[3];
47328
+ }
47329
+ var audioQueueRef = useRef8(t4);
47330
+ var t5;
47331
+ var t6;
47332
+ if ($[4] !== audioQueue) {
47333
+ t5 = function() {
47334
+ audioQueueRef.current = audioQueue;
47335
+ };
47336
+ t6 = [
47337
+ audioQueue
47338
+ ];
47339
+ $[4] = audioQueue;
47340
+ $[5] = t5;
47341
+ $[6] = t6;
47342
+ } else {
47343
+ t5 = $[5];
47344
+ t6 = $[6];
47345
+ }
47346
+ useEffect10(t5, t6);
47347
+ var pickLockRef = useRef8(false);
47348
+ var currentSentenceRef = useRef8(null);
47313
47349
  var messagesProps = useMessages();
47314
- useEffect10(function() {
47315
- if (!isPlaying) return;
47316
- isLastSentencePlayedRef.current = false;
47317
- }, [
47318
- isPlaying
47319
- ]);
47320
- var unplayedMessageSentences = useMemo17(function() {
47321
- var playableMessages = _to_consumable_array(messagesProps.messages).reverse().filter(function(message) {
47322
- if (message.role !== "assistant") return false;
47323
- if (stoppedMessageIds.includes(message.id)) return false;
47324
- return true;
47325
- });
47326
- var messageInputs = playableMessages.map(function(message_0) {
47327
- return {
47328
- message: message_0,
47329
- input: input({
47330
- message: message_0
47331
- })
47332
- };
47333
- }).filter(function(_ref3) {
47334
- var input2 = _ref3.input;
47335
- return input2 !== null;
47336
- });
47337
- var messageSentences = messageInputs.flatMap(function(_ref4) {
47338
- var message_1 = _ref4.message, input_0 = _ref4.input;
47339
- return getMessageSentences({
47340
- messageId: message_1.id,
47341
- input: input_0
47350
+ var t7;
47351
+ var t8;
47352
+ if ($[7] !== messagesProps.messages) {
47353
+ t7 = function() {
47354
+ var assistantsDesc = messagesProps.messages.filter(_temp9);
47355
+ var assistantsAsc = _to_consumable_array(assistantsDesc).reverse();
47356
+ setAudioQueue(function(prev) {
47357
+ var prevById = new Map(prev.map(_temp24));
47358
+ var next = [];
47359
+ var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
47360
+ try {
47361
+ for(var _iterator = assistantsAsc[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
47362
+ var m_0 = _step.value;
47363
+ var _existing$nextIndex, _existing$stopped;
47364
+ var inp = input({
47365
+ message: m_0
47366
+ });
47367
+ if (inp == null) {
47368
+ continue;
47369
+ }
47370
+ var sentences = segment(inp);
47371
+ var existing = prevById.get(m_0.id);
47372
+ next.push({
47373
+ id: m_0.id,
47374
+ status: m_0.status,
47375
+ sentences: sentences,
47376
+ nextIndex: Math.min((_existing$nextIndex = existing === null || existing === void 0 ? void 0 : existing.nextIndex) !== null && _existing$nextIndex !== void 0 ? _existing$nextIndex : 0, sentences.length),
47377
+ stopped: (_existing$stopped = existing === null || existing === void 0 ? void 0 : existing.stopped) !== null && _existing$stopped !== void 0 ? _existing$stopped : false
47378
+ });
47379
+ }
47380
+ } catch (err) {
47381
+ _didIteratorError = true;
47382
+ _iteratorError = err;
47383
+ } finally{
47384
+ try {
47385
+ if (!_iteratorNormalCompletion && _iterator.return != null) {
47386
+ _iterator.return();
47387
+ }
47388
+ } finally{
47389
+ if (_didIteratorError) {
47390
+ throw _iteratorError;
47391
+ }
47392
+ }
47393
+ }
47394
+ return next;
47342
47395
  });
47343
- });
47344
- return messageSentences.filter(function(ms) {
47345
- return !playedMessageSentences.find(function(pms) {
47346
- return pms.messageId === ms.messageId && pms.sentence === ms.sentence;
47396
+ };
47397
+ t8 = [
47398
+ messagesProps.messages
47399
+ ];
47400
+ $[7] = messagesProps.messages;
47401
+ $[8] = t7;
47402
+ $[9] = t8;
47403
+ } else {
47404
+ t7 = $[8];
47405
+ t8 = $[9];
47406
+ }
47407
+ useEffect10(t7, t8);
47408
+ var t9;
47409
+ if ($[10] !== audioPlayer || $[11] !== fullSentenceRegex || $[12] !== isAudioPlayed || $[13] !== nextAudioPlayer || $[14] !== superinterfaceContext) {
47410
+ t9 = function(t102) {
47411
+ var input2 = t102.input, onPlay = t102.onPlay, onStop = t102.onStop, onEnd_0 = t102.onEnd;
47412
+ var searchParams = new URLSearchParams(_objectSpread47({
47413
+ input: input2
47414
+ }, superinterfaceContext.variables));
47415
+ audioPlayer.load("".concat(superinterfaceContext.baseUrl, "/audio-runtimes/tts?").concat(searchParams), {
47416
+ format: "mp3",
47417
+ autoplay: isAudioPlayed,
47418
+ html5: isHtmlAudioSupported,
47419
+ onplay: onPlay,
47420
+ onstop: onStop,
47421
+ onload: function() {
47422
+ var current = currentSentenceRef.current;
47423
+ if (!current) {
47424
+ return;
47425
+ }
47426
+ var msg = audioQueueRef.current.find(function(m_1) {
47427
+ return m_1.id === current.messageId;
47428
+ });
47429
+ if (!msg) {
47430
+ return;
47431
+ }
47432
+ var nextSentence = msg.sentences[msg.nextIndex];
47433
+ if (!nextSentence) {
47434
+ return;
47435
+ }
47436
+ if (!fullSentenceRegex.test(nextSentence)) {
47437
+ return;
47438
+ }
47439
+ var nextSearchParams = new URLSearchParams(_objectSpread47({
47440
+ input: nextSentence
47441
+ }, superinterfaceContext.variables));
47442
+ nextAudioPlayer.load("".concat(superinterfaceContext.baseUrl, "/audio-runtimes/tts?").concat(nextSearchParams), {
47443
+ format: "mp3",
47444
+ autoplay: false,
47445
+ html5: isHtmlAudioSupported
47446
+ });
47447
+ },
47448
+ onend: onEnd_0
47347
47449
  });
47348
- });
47349
- }, [
47350
- messagesProps,
47351
- playedMessageSentences
47352
- ]);
47353
- var defaultPlay = useCallback7(function(_ref5) {
47354
- var input_1 = _ref5.input, onPlay = _ref5.onPlay, onStop = _ref5.onStop, onEnd_0 = _ref5.onEnd;
47355
- var searchParams = new URLSearchParams(_objectSpread47({
47356
- input: input_1
47357
- }, superinterfaceContext.variables));
47358
- audioPlayer.load("".concat(superinterfaceContext.baseUrl, "/audio-runtimes/tts?").concat(searchParams), {
47359
- format: "mp3",
47360
- autoplay: isAudioPlayed,
47361
- html5: isHtmlAudioSupported,
47362
- onplay: onPlay,
47363
- onstop: onStop,
47364
- onload: function() {
47365
- var nextUnplayedMessageSentence = unplayedMessageSentences[1];
47366
- if (!nextUnplayedMessageSentence) return;
47367
- var isNextFullSentence = fullSentenceRegex.test(nextUnplayedMessageSentence.sentence);
47368
- if (!isNextFullSentence) return;
47369
- var nextSearchParams = new URLSearchParams(_objectSpread47({
47370
- input: nextUnplayedMessageSentence.sentence
47371
- }, superinterfaceContext.variables));
47372
- nextAudioPlayer.load("".concat(superinterfaceContext.baseUrl, "/audio-runtimes/tts?").concat(nextSearchParams), {
47373
- format: "mp3",
47374
- autoplay: false,
47375
- html5: isHtmlAudioSupported
47376
- });
47377
- },
47378
- onend: onEnd_0
47379
- });
47380
- }, [
47381
- superinterfaceContext,
47382
- unplayedMessageSentences,
47383
- audioPlayer,
47384
- nextAudioPlayer,
47385
- isAudioPlayed,
47386
- fullSentenceRegex
47387
- ]);
47388
- var play = useMemo17(function() {
47389
- return passedPlay || defaultPlay;
47390
- }, [
47391
- passedPlay,
47392
- defaultPlay
47393
- ]);
47394
- useEffect10(function() {
47395
- if (isPlaying) return;
47396
- if (audioPlayer.playing) return;
47397
- if (!latestMessageProps.latestMessage) return;
47398
- if (latestMessageProps.latestMessage.role !== "assistant") return;
47399
- var firstUnplayedMessageSentence = unplayedMessageSentences[0];
47400
- if (!firstUnplayedMessageSentence) {
47401
- return;
47402
- }
47403
- var isFullSentence = isOptimistic({
47404
- id: latestMessageProps.latestMessage.id
47405
- }) || latestMessageProps.latestMessage.status !== "in_progress" || fullSentenceRegex.test(firstUnplayedMessageSentence.sentence);
47406
- if (!isFullSentence) return;
47407
- setIsPlaying(true);
47408
- setPlayedMessageSentences(function(prev) {
47409
- return _to_consumable_array(prev).concat([
47410
- firstUnplayedMessageSentence
47411
- ]);
47412
- });
47413
- var input_2 = firstUnplayedMessageSentence.sentence;
47414
- play({
47415
- input: input_2,
47416
- onPlay: function() {
47417
- setIsAudioPlayed(true);
47418
- },
47419
- onStop: function() {
47420
- setStoppedMessageIds(function(prev_0) {
47421
- return _to_consumable_array(prev_0).concat([
47422
- firstUnplayedMessageSentence.messageId
47423
- ]);
47424
- });
47425
- setIsPlaying(false);
47426
- },
47427
- onEnd: function() {
47428
- setIsPlaying(false);
47429
- isLastSentencePlayedRef.current = unplayedMessageSentences.length === 1;
47430
- if (isLastSentencePlayedRef.current && latestMessageProps.latestMessage.status !== "in_progress") {
47431
- _onEnd();
47432
- isLastSentencePlayedRef.current = false;
47450
+ };
47451
+ $[10] = audioPlayer;
47452
+ $[11] = fullSentenceRegex;
47453
+ $[12] = isAudioPlayed;
47454
+ $[13] = nextAudioPlayer;
47455
+ $[14] = superinterfaceContext;
47456
+ $[15] = t9;
47457
+ } else {
47458
+ t9 = $[15];
47459
+ }
47460
+ var defaultPlay = t9;
47461
+ var t10;
47462
+ t10 = passedPlay || defaultPlay;
47463
+ var play = t10;
47464
+ var t11;
47465
+ var t12;
47466
+ if ($[16] !== audioPlayer.playing || $[17] !== audioQueue || $[18] !== fullSentenceRegex || $[19] !== isPlaying || $[20] !== _onEnd || $[21] !== play) {
47467
+ t11 = function() {
47468
+ if (isPlaying) {
47469
+ return;
47470
+ }
47471
+ if (audioPlayer.playing) {
47472
+ return;
47473
+ }
47474
+ if (pickLockRef.current) {
47475
+ return;
47476
+ }
47477
+ var candidate;
47478
+ candidate = null;
47479
+ var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
47480
+ try {
47481
+ for(var _iterator = audioQueue[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
47482
+ var msg_0 = _step.value;
47483
+ if (msg_0.stopped) {
47484
+ continue;
47485
+ }
47486
+ var sentence = msg_0.sentences[msg_0.nextIndex];
47487
+ if (!sentence) {
47488
+ continue;
47489
+ }
47490
+ var isFull = isOptimistic({
47491
+ id: msg_0.id
47492
+ }) || msg_0.status !== "in_progress" || fullSentenceRegex.test(sentence);
47493
+ if (isFull) {
47494
+ candidate = {
47495
+ messageId: msg_0.id,
47496
+ sentence: sentence,
47497
+ index: msg_0.nextIndex,
47498
+ ownerStatus: msg_0.status
47499
+ };
47500
+ break;
47501
+ }
47502
+ }
47503
+ } catch (err) {
47504
+ _didIteratorError = true;
47505
+ _iteratorError = err;
47506
+ } finally{
47507
+ try {
47508
+ if (!_iteratorNormalCompletion && _iterator.return != null) {
47509
+ _iterator.return();
47510
+ }
47511
+ } finally{
47512
+ if (_didIteratorError) {
47513
+ throw _iteratorError;
47514
+ }
47433
47515
  }
47434
47516
  }
47435
- });
47436
- }, [
47437
- unplayedMessageSentences,
47438
- isPlaying,
47439
- superinterfaceContext,
47440
- latestMessageProps,
47441
- audioPlayer,
47442
- nextAudioPlayer,
47443
- playedMessageSentences,
47444
- _onEnd,
47445
- play,
47446
- fullSentenceRegex
47447
- ]);
47448
- useEffect10(function() {
47449
- var _latestMessageProps$l;
47450
- if (isLastSentencePlayedRef.current && !isPlaying && unplayedMessageSentences.length === 0 && ((_latestMessageProps$l = latestMessageProps.latestMessage) === null || _latestMessageProps$l === void 0 ? void 0 : _latestMessageProps$l.status) !== "in_progress") {
47451
- _onEnd();
47452
- isLastSentencePlayedRef.current = false;
47453
- }
47454
- }, [
47455
- isPlaying,
47456
- unplayedMessageSentences.length,
47457
- (_latestMessageProps$l2 = latestMessageProps.latestMessage) === null || _latestMessageProps$l2 === void 0 ? void 0 : _latestMessageProps$l2.status,
47458
- _onEnd
47459
- ]);
47460
- useEffect10(function() {
47461
- if (isHtmlAudioSupported) {
47462
- var _Howler$_howls$;
47463
- if (!(Howler !== null && Howler !== void 0 && (_Howler$_howls$ = Howler._howls[0]) !== null && _Howler$_howls$ !== void 0 && (_Howler$_howls$ = _Howler$_howls$._sounds[0]) !== null && _Howler$_howls$ !== void 0 && _Howler$_howls$._node)) return;
47464
- Howler._howls[0]._sounds[0]._node.crossOrigin = "anonymous";
47465
- }
47466
- }, [
47467
- audioPlayer
47468
- ]);
47469
- var _useState94 = _sliced_to_array(useState9(null), 2), audioEngine = _useState94[0], setAudioEngine = _useState94[1];
47470
- var isAudioEngineInited = useRef8(false);
47471
- useEffect10(function() {
47472
- if (!audioPlayer.playing) return;
47473
- if (isAudioEngineInited.current) return;
47474
- isAudioEngineInited.current = true;
47475
- if (isHtmlAudioSupported) {
47476
- var audioContext = new AudioContext();
47477
- setAudioEngine({
47478
- // @ts-ignore-next-line
47479
- source: audioContext.createMediaElementSource(// @ts-ignore-next-line
47480
- Howler._howls[0]._sounds[0]._node),
47481
- audioContext: audioContext
47517
+ if (!candidate) {
47518
+ return;
47519
+ }
47520
+ pickLockRef.current = true;
47521
+ setIsPlaying(true);
47522
+ currentSentenceRef.current = {
47523
+ messageId: candidate.messageId,
47524
+ index: candidate.index
47525
+ };
47526
+ setAudioQueue(function(prev_0) {
47527
+ return prev_0.map(function(m_2) {
47528
+ return m_2.id === candidate.messageId ? _objectSpread47(_objectSpread47({}, m_2), {}, {
47529
+ nextIndex: m_2.nextIndex + 1
47530
+ }) : m_2;
47531
+ });
47482
47532
  });
47483
- } else {
47484
- setAudioEngine({
47485
- source: Howler.masterGain,
47486
- audioContext: Howler.ctx
47533
+ play({
47534
+ input: candidate.sentence,
47535
+ onPlay: function() {
47536
+ setIsAudioPlayed(true);
47537
+ },
47538
+ onStop: function() {
47539
+ setAudioQueue(function(prev_1) {
47540
+ return prev_1.map(function(m_3) {
47541
+ return m_3.id === candidate.messageId ? _objectSpread47(_objectSpread47({}, m_3), {}, {
47542
+ stopped: true
47543
+ }) : m_3;
47544
+ });
47545
+ });
47546
+ setIsPlaying(false);
47547
+ currentSentenceRef.current = null;
47548
+ pickLockRef.current = false;
47549
+ },
47550
+ onEnd: function() {
47551
+ setIsPlaying(false);
47552
+ currentSentenceRef.current = null;
47553
+ pickLockRef.current = false;
47554
+ var hasPending = audioQueueRef.current.some(_temp32);
47555
+ if (!hasPending) {
47556
+ _onEnd();
47557
+ }
47558
+ }
47487
47559
  });
47560
+ };
47561
+ t12 = [
47562
+ isPlaying,
47563
+ audioPlayer.playing,
47564
+ audioQueue,
47565
+ play,
47566
+ fullSentenceRegex,
47567
+ _onEnd
47568
+ ];
47569
+ $[16] = audioPlayer.playing;
47570
+ $[17] = audioQueue;
47571
+ $[18] = fullSentenceRegex;
47572
+ $[19] = isPlaying;
47573
+ $[20] = _onEnd;
47574
+ $[21] = play;
47575
+ $[22] = t11;
47576
+ $[23] = t12;
47577
+ } else {
47578
+ t11 = $[22];
47579
+ t12 = $[23];
47580
+ }
47581
+ useEffect10(t11, t12);
47582
+ var t13;
47583
+ if ($[24] !== audioPlayer) {
47584
+ t13 = [
47585
+ audioPlayer
47586
+ ];
47587
+ $[24] = audioPlayer;
47588
+ $[25] = t13;
47589
+ } else {
47590
+ t13 = $[25];
47591
+ }
47592
+ useEffect10(_temp42, t13);
47593
+ var _useState93 = _sliced_to_array(useState9(null), 2), audioEngine = _useState93[0], setAudioEngine = _useState93[1];
47594
+ var isAudioEngineInited = useRef8(false);
47595
+ var t14;
47596
+ if ($[26] !== audioPlayer.playing) {
47597
+ t14 = function() {
47598
+ if (!audioPlayer.playing) {
47599
+ return;
47600
+ }
47601
+ if (isAudioEngineInited.current) {
47602
+ return;
47603
+ }
47604
+ isAudioEngineInited.current = true;
47605
+ if (isHtmlAudioSupported) {
47606
+ var audioContext = new AudioContext();
47607
+ setAudioEngine({
47608
+ source: audioContext.createMediaElementSource(Howler._howls[0]._sounds[0]._node),
47609
+ audioContext: audioContext
47610
+ });
47611
+ } else {
47612
+ setAudioEngine({
47613
+ source: Howler.masterGain,
47614
+ audioContext: Howler.ctx
47615
+ });
47616
+ }
47617
+ };
47618
+ $[26] = audioPlayer.playing;
47619
+ $[27] = t14;
47620
+ } else {
47621
+ t14 = $[27];
47622
+ }
47623
+ var t15;
47624
+ if ($[28] !== audioPlayer) {
47625
+ t15 = [
47626
+ audioPlayer
47627
+ ];
47628
+ $[28] = audioPlayer;
47629
+ $[29] = t15;
47630
+ } else {
47631
+ t15 = $[29];
47632
+ }
47633
+ useEffect10(t14, t15);
47634
+ var t16;
47635
+ bb0: {
47636
+ if (!audioEngine) {
47637
+ t16 = null;
47638
+ break bb0;
47488
47639
  }
47489
- }, [
47490
- audioPlayer,
47491
- isAudioEngineInited
47492
- ]);
47493
- var visualizationAnalyser = useMemo17(function() {
47494
- if (!audioEngine) return null;
47495
- var result = audioEngine.audioContext.createAnalyser();
47496
- audioEngine.source.connect(audioEngine.audioContext.destination);
47497
- audioEngine.source.connect(result);
47498
- return result;
47499
- }, [
47500
- audioEngine
47501
- ]);
47502
- var isPending = useMemo17(function() {
47503
- var _latestMessageProps$l3;
47504
- return isPlaying || unplayedMessageSentences.length > 0 || ((_latestMessageProps$l3 = latestMessageProps.latestMessage) === null || _latestMessageProps$l3 === void 0 ? void 0 : _latestMessageProps$l3.status) === "in_progress";
47505
- }, [
47506
- isPlaying,
47507
- unplayedMessageSentences,
47508
- latestMessageProps
47509
- ]);
47510
- return _objectSpread47(_objectSpread47({
47511
- isPending: isPending,
47512
- isAudioPlayed: isAudioPlayed
47513
- }, audioPlayer), {}, {
47514
- visualizationAnalyser: visualizationAnalyser
47515
- });
47640
+ var analyser;
47641
+ if ($[30] !== audioEngine.audioContext || $[31] !== audioEngine.source) {
47642
+ analyser = audioEngine.audioContext.createAnalyser();
47643
+ audioEngine.source.connect(audioEngine.audioContext.destination);
47644
+ audioEngine.source.connect(analyser);
47645
+ $[30] = audioEngine.audioContext;
47646
+ $[31] = audioEngine.source;
47647
+ $[32] = analyser;
47648
+ } else {
47649
+ analyser = $[32];
47650
+ }
47651
+ t16 = analyser;
47652
+ }
47653
+ var visualizationAnalyser = t16;
47654
+ var t17;
47655
+ var t18;
47656
+ if ($[33] !== audioQueue || $[34] !== isPlaying) {
47657
+ t18 = isPlaying || audioQueue.some(_temp52);
47658
+ $[33] = audioQueue;
47659
+ $[34] = isPlaying;
47660
+ $[35] = t18;
47661
+ } else {
47662
+ t18 = $[35];
47663
+ }
47664
+ t17 = t18;
47665
+ var isPending = t17;
47666
+ var t19;
47667
+ if ($[36] !== audioPlayer || $[37] !== isAudioPlayed || $[38] !== isPending || $[39] !== visualizationAnalyser) {
47668
+ t19 = _objectSpread47(_objectSpread47({
47669
+ isPending: isPending,
47670
+ isAudioPlayed: isAudioPlayed
47671
+ }, audioPlayer), {}, {
47672
+ visualizationAnalyser: visualizationAnalyser
47673
+ });
47674
+ $[36] = audioPlayer;
47675
+ $[37] = isAudioPlayed;
47676
+ $[38] = isPending;
47677
+ $[39] = visualizationAnalyser;
47678
+ $[40] = t19;
47679
+ } else {
47680
+ t19 = $[40];
47681
+ }
47682
+ return t19;
47516
47683
  };
47684
+ function _temp9(m) {
47685
+ return m.role === "assistant";
47686
+ }
47687
+ function _temp24(p) {
47688
+ return [
47689
+ p.id,
47690
+ p
47691
+ ];
47692
+ }
47693
+ function _temp32(m_4) {
47694
+ if (m_4.stopped) {
47695
+ return false;
47696
+ }
47697
+ var hasMore = m_4.nextIndex < m_4.sentences.length;
47698
+ var streaming = m_4.status === "in_progress";
47699
+ return hasMore || streaming;
47700
+ }
47701
+ function _temp42() {
47702
+ if (isHtmlAudioSupported) {
47703
+ var _Howler$_howls$;
47704
+ if (!(Howler !== null && Howler !== void 0 && (_Howler$_howls$ = Howler._howls[0]) !== null && _Howler$_howls$ !== void 0 && (_Howler$_howls$ = _Howler$_howls$._sounds[0]) !== null && _Howler$_howls$ !== void 0 && _Howler$_howls$._node)) {
47705
+ return;
47706
+ }
47707
+ Howler._howls[0]._sounds[0]._node.crossOrigin = "anonymous";
47708
+ }
47709
+ }
47710
+ function _temp52(m_5) {
47711
+ return !m_5.stopped && (m_5.nextIndex < m_5.sentences.length || m_5.status === "in_progress");
47712
+ }
47517
47713
  // src/hooks/audioRuntimes/useTtsAudioRuntime/index.ts
47518
47714
  import { useQueryClient as useQueryClient6 } from "@tanstack/react-query";
47519
47715
  // src/hooks/audioRuntimes/useTtsAudioRuntime/blobToData.ts
@@ -47551,7 +47747,7 @@ function _asyncToGenerator11(n) {
47551
47747
  };
47552
47748
  }
47553
47749
  var useTtsAudioRuntime = function(t0) {
47554
- var $ = _c88(30);
47750
+ var $ = _c89(30);
47555
47751
  var play = t0.play, passedOnEnd = t0.onEnd;
47556
47752
  var addToast = useToasts().addToast;
47557
47753
  var queryClient = useQueryClient6();
@@ -47580,7 +47776,7 @@ var useTtsAudioRuntime = function(t0) {
47580
47776
  if ($[1] !== createMessageProps) {
47581
47777
  t2 = {
47582
47778
  isStopOnSilence: true,
47583
- onStart: _temp9,
47779
+ onStart: _temp10,
47584
47780
  onStop: function() {
47585
47781
  var _onStop = _asyncToGenerator11(function(_event, chunks) {
47586
47782
  var blob, audioContent;
@@ -47721,23 +47917,23 @@ var useTtsAudioRuntime = function(t0) {
47721
47917
  t5 = t8;
47722
47918
  return t5;
47723
47919
  };
47724
- function _temp9() {
47725
- return _temp24.apply(this, arguments);
47920
+ function _temp10() {
47921
+ return _temp25.apply(this, arguments);
47726
47922
  }
47727
- function _temp24() {
47728
- _temp24 = _asyncToGenerator11(function() {
47923
+ function _temp25() {
47924
+ _temp25 = _asyncToGenerator11(function() {
47729
47925
  return _ts_generator(this, function(_state) {
47730
47926
  return [
47731
47927
  2
47732
47928
  ];
47733
47929
  });
47734
47930
  });
47735
- return _temp24.apply(this, arguments);
47931
+ return _temp25.apply(this, arguments);
47736
47932
  }
47737
47933
  // src/components/audioRuntimes/TtsAudioRuntimeProvider.tsx
47738
47934
  import { jsx as _jsx87 } from "react/jsx-runtime";
47739
47935
  var TtsAudioRuntimeProvider = function(t0) {
47740
- var $ = _c89(8);
47936
+ var $ = _c90(8);
47741
47937
  var children = t0.children, play = t0.play, onEnd = t0.onEnd;
47742
47938
  var t1;
47743
47939
  if ($[0] !== onEnd || $[1] !== play) {
@@ -47850,7 +48046,7 @@ function _objectWithoutPropertiesLoose5(r, e) {
47850
48046
  return t;
47851
48047
  }
47852
48048
  var Content9 = function(t0) {
47853
- var $ = _c90(4);
48049
+ var $ = _c91(4);
47854
48050
  var children = t0.children, className = t0.className, style = t0.style;
47855
48051
  var t1;
47856
48052
  if ($[0] !== children || $[1] !== className || $[2] !== style) {
@@ -47872,7 +48068,7 @@ var Content9 = function(t0) {
47872
48068
  return t1;
47873
48069
  };
47874
48070
  var AudioRuntimeProvider = function(t0) {
47875
- var $ = _c90(4);
48071
+ var $ = _c91(4);
47876
48072
  var children = t0.children, play = t0.play, onEnd = t0.onEnd;
47877
48073
  var audioThreadContext = useAudioThreadContext();
47878
48074
  if (audioThreadContext.audioRuntime) {
@@ -47895,7 +48091,7 @@ var AudioRuntimeProvider = function(t0) {
47895
48091
  return t1;
47896
48092
  };
47897
48093
  var Provider5 = function(t0) {
47898
- var $ = _c90(9);
48094
+ var $ = _c91(9);
47899
48095
  var children;
47900
48096
  var rest;
47901
48097
  if ($[0] !== t0) {
@@ -47935,7 +48131,7 @@ var Provider5 = function(t0) {
47935
48131
  return t2;
47936
48132
  };
47937
48133
  var Root16 = function(t0) {
47938
- var $ = _c90(18);
48134
+ var $ = _c91(18);
47939
48135
  var children;
47940
48136
  var className;
47941
48137
  var onEnd;
@@ -48007,7 +48203,7 @@ var Root16 = function(t0) {
48007
48203
  return t3;
48008
48204
  };
48009
48205
  // src/components/threads/AudioThread/Visualization/index.tsx
48010
- import { c as _c92 } from "react-compiler-runtime";
48206
+ import { c as _c93 } from "react-compiler-runtime";
48011
48207
  import { useState as useState11, useCallback as useCallback9, useEffect as useEffect12, useContext as useContext20, createContext as createContext14 } from "react";
48012
48208
  import _9 from "lodash";
48013
48209
  import { Flex as Flex31 } from "@radix-ui/themes";
@@ -48076,10 +48272,10 @@ var BarsVisualizer = function(_ref) {
48076
48272
  });
48077
48273
  };
48078
48274
  // src/hooks/audioThreads/useStatus/index.ts
48079
- import { c as _c91 } from "react-compiler-runtime";
48275
+ import { c as _c92 } from "react-compiler-runtime";
48080
48276
  import { useMemo as useMemo19 } from "react";
48081
48277
  var useStatus = function() {
48082
- var $ = _c91(2);
48278
+ var $ = _c92(2);
48083
48279
  var audioRuntime = useAudioThreadContext().audioRuntime;
48084
48280
  var t0;
48085
48281
  bb0: {
@@ -48239,7 +48435,7 @@ var Provider6 = function(_ref) {
48239
48435
  });
48240
48436
  };
48241
48437
  var Root17 = function(t0) {
48242
- var $ = _c92(6);
48438
+ var $ = _c93(6);
48243
48439
  var children;
48244
48440
  var rest;
48245
48441
  if ($[0] !== t0) {
@@ -48276,7 +48472,7 @@ var Root17 = function(t0) {
48276
48472
  return t1;
48277
48473
  };
48278
48474
  var BarsVisualizer2 = function(t0) {
48279
- var $ = _c92(10);
48475
+ var $ = _c93(10);
48280
48476
  var rest;
48281
48477
  var t1;
48282
48478
  var t2;
@@ -48320,7 +48516,7 @@ var BarsVisualizer2 = function(t0) {
48320
48516
  return t4;
48321
48517
  };
48322
48518
  var AssistantVisualizationRoot = function(t0) {
48323
- var $ = _c92(17);
48519
+ var $ = _c93(17);
48324
48520
  var children;
48325
48521
  var rest;
48326
48522
  var t1;
@@ -48393,7 +48589,7 @@ var AssistantVisualizationRoot = function(t0) {
48393
48589
  return t6;
48394
48590
  };
48395
48591
  var AssistantVisualization = function(props) {
48396
- var $ = _c92(3);
48592
+ var $ = _c93(3);
48397
48593
  var t0;
48398
48594
  if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
48399
48595
  t0 = /* @__PURE__ */ _jsx90(BarsVisualizer2, {});
@@ -48416,7 +48612,7 @@ var AssistantVisualization = function(props) {
48416
48612
  AssistantVisualization.Root = AssistantVisualizationRoot;
48417
48613
  AssistantVisualization.BarsVisualizer = BarsVisualizer2;
48418
48614
  var AssistantInfo = function(props) {
48419
- var $ = _c92(6);
48615
+ var $ = _c93(6);
48420
48616
  var assistantNameContext = useContext20(AssistantNameContext);
48421
48617
  var t0;
48422
48618
  if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
@@ -48456,7 +48652,7 @@ var AssistantInfo = function(props) {
48456
48652
  return t2;
48457
48653
  };
48458
48654
  var Visualization = function(props) {
48459
- var $ = _c92(4);
48655
+ var $ = _c93(4);
48460
48656
  var t0;
48461
48657
  var t1;
48462
48658
  if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
@@ -48488,9 +48684,9 @@ Visualization.Provider = Provider6;
48488
48684
  Visualization.AssistantVisualization = AssistantVisualization;
48489
48685
  Visualization.AssistantInfo = AssistantInfo;
48490
48686
  // src/components/threads/AudioThread/Status/index.tsx
48491
- import { c as _c94 } from "react-compiler-runtime";
48687
+ import { c as _c95 } from "react-compiler-runtime";
48492
48688
  // src/components/threads/AudioThread/Status/StatusMessages.tsx
48493
- import { c as _c93 } from "react-compiler-runtime";
48689
+ import { c as _c94 } from "react-compiler-runtime";
48494
48690
  import { Flex as Flex32, Text as Text9 } from "@radix-ui/themes";
48495
48691
  import { jsx as _jsx91, jsxs as _jsxs32 } from "react/jsx-runtime";
48496
48692
  var html = function(_ref) {
@@ -48500,7 +48696,7 @@ var html = function(_ref) {
48500
48696
  }).join(""), "\n }");
48501
48697
  };
48502
48698
  var StatusMessages = function(t0) {
48503
- var $ = _c93(9);
48699
+ var $ = _c94(9);
48504
48700
  var texts = t0.texts, className = t0.className, style = t0.style;
48505
48701
  var t1;
48506
48702
  if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
@@ -48604,7 +48800,7 @@ function _toPrimitive50(t, r) {
48604
48800
  return ("string" === r ? String : Number)(t);
48605
48801
  }
48606
48802
  var Status = function(props) {
48607
- var $ = _c94(12);
48803
+ var $ = _c95(12);
48608
48804
  var status = useStatus().status;
48609
48805
  if (status === "recording") {
48610
48806
  var _t;
@@ -48701,10 +48897,10 @@ var Status = function(props) {
48701
48897
  return t1;
48702
48898
  };
48703
48899
  // src/components/threads/AudioThread/Form/index.tsx
48704
- import { c as _c97 } from "react-compiler-runtime";
48900
+ import { c as _c98 } from "react-compiler-runtime";
48705
48901
  import { Flex as Flex34 } from "@radix-ui/themes";
48706
48902
  // src/components/threads/AudioThread/Form/MicIcon.tsx
48707
- import { c as _c95 } from "react-compiler-runtime";
48903
+ import { c as _c96 } from "react-compiler-runtime";
48708
48904
  import { jsx as _jsx93 } from "react/jsx-runtime";
48709
48905
  function ownKeys51(e, r) {
48710
48906
  var t = Object.keys(e);
@@ -48750,7 +48946,7 @@ function _toPrimitive51(t, r) {
48750
48946
  return ("string" === r ? String : Number)(t);
48751
48947
  }
48752
48948
  var MicIcon = function(props) {
48753
- var $ = _c95(3);
48949
+ var $ = _c96(3);
48754
48950
  var t0;
48755
48951
  if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
48756
48952
  t0 = /* @__PURE__ */ _jsx93("path", {
@@ -48782,12 +48978,12 @@ var MicIcon = function(props) {
48782
48978
  return t1;
48783
48979
  };
48784
48980
  // src/components/threads/AudioThread/Form/ActionButton/index.tsx
48785
- import { c as _c96 } from "react-compiler-runtime";
48981
+ import { c as _c97 } from "react-compiler-runtime";
48786
48982
  import { Flex as Flex33, IconButton as IconButton10 } from "@radix-ui/themes";
48787
48983
  import { StopIcon as StopIcon2, PauseIcon as PauseIcon2, ArrowUpIcon as ArrowUpIcon3, ResumeIcon } from "@radix-ui/react-icons";
48788
48984
  import { jsx as _jsx94, jsxs as _jsxs33 } from "react/jsx-runtime";
48789
48985
  var ActionButton = function() {
48790
- var $ = _c96(27);
48986
+ var $ = _c97(27);
48791
48987
  var status = useStatus().status;
48792
48988
  var audioThreadContext = useAudioThreadContext();
48793
48989
  var superinterfaceContext = useSuperinterfaceContext();
@@ -49025,7 +49221,7 @@ function _toPrimitive52(t, r) {
49025
49221
  return ("string" === r ? String : Number)(t);
49026
49222
  }
49027
49223
  var Form = function(props) {
49028
- var $ = _c97(17);
49224
+ var $ = _c98(17);
49029
49225
  var status = useStatus().status;
49030
49226
  var audioThreadContext = useAudioThreadContext();
49031
49227
  var t0 = status === "recording" ? "var(--accent-11)" : "var(--gray-11)";
@@ -49175,7 +49371,7 @@ function _toPrimitive53(t, r) {
49175
49371
  return ("string" === r ? String : Number)(t);
49176
49372
  }
49177
49373
  var AudioThread = function(props) {
49178
- var $ = _c98(5);
49374
+ var $ = _c99(5);
49179
49375
  var t0;
49180
49376
  var t1;
49181
49377
  var t2;
@@ -49257,7 +49453,7 @@ function _toPrimitive54(t, r) {
49257
49453
  return ("string" === r ? String : Number)(t);
49258
49454
  }
49259
49455
  var AudioThreadDialog = function(props) {
49260
- var $ = _c99(4);
49456
+ var $ = _c100(4);
49261
49457
  var t0;
49262
49458
  var t1;
49263
49459
  if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
@@ -49779,10 +49975,10 @@ var useWebrtcAudioRuntime = function() {
49779
49975
  ]);
49780
49976
  };
49781
49977
  // src/components/audioRuntimes/WebrtcAudioRuntimeProvider.tsx
49782
- import { c as _c100 } from "react-compiler-runtime";
49978
+ import { c as _c101 } from "react-compiler-runtime";
49783
49979
  import { jsx as _jsx98 } from "react/jsx-runtime";
49784
49980
  var WebrtcAudioRuntimeProvider = function(t0) {
49785
- var $ = _c100(5);
49981
+ var $ = _c101(5);
49786
49982
  var children = t0.children;
49787
49983
  var webrtcAudioRuntime = useWebrtcAudioRuntime().webrtcAudioRuntime;
49788
49984
  var t1;
@@ -49810,20 +50006,20 @@ var WebrtcAudioRuntimeProvider = function(t0) {
49810
50006
  return t2;
49811
50007
  };
49812
50008
  // src/components/gui/Gui/index.tsx
49813
- import { c as _c103 } from "react-compiler-runtime";
50009
+ import { c as _c104 } from "react-compiler-runtime";
49814
50010
  import { useMemo as useMemo23 } from "react";
49815
50011
  import { Flex as Flex35, Card as Card5, Spinner as Spinner3 } from "@radix-ui/themes";
49816
50012
  // src/hooks/messages/useLatestAssistantMessage/index.ts
49817
- import { c as _c101 } from "react-compiler-runtime";
50013
+ import { c as _c102 } from "react-compiler-runtime";
49818
50014
  import { useMemo as useMemo21 } from "react";
49819
50015
  var useLatestAssistantMessage = function() {
49820
- var $ = _c101(4);
50016
+ var $ = _c102(4);
49821
50017
  var _useMessages = useMessages(), messages2 = _useMessages.messages;
49822
50018
  var t0;
49823
50019
  var t1;
49824
50020
  if ($[0] !== messages2) {
49825
50021
  var _messages$find;
49826
- t1 = (_messages$find = messages2.find(_temp10)) !== null && _messages$find !== void 0 ? _messages$find : null;
50022
+ t1 = (_messages$find = messages2.find(_temp11)) !== null && _messages$find !== void 0 ? _messages$find : null;
49827
50023
  $[0] = messages2;
49828
50024
  $[1] = t1;
49829
50025
  } else {
@@ -49842,21 +50038,21 @@ var useLatestAssistantMessage = function() {
49842
50038
  t0 = t2;
49843
50039
  return t0;
49844
50040
  };
49845
- function _temp10(message) {
50041
+ function _temp11(message) {
49846
50042
  return message.role === "assistant";
49847
50043
  }
49848
50044
  // src/hooks/messages/useLatestAssistantMessageWithContent/index.ts
49849
- import { c as _c102 } from "react-compiler-runtime";
50045
+ import { c as _c103 } from "react-compiler-runtime";
49850
50046
  import { isEmpty as isEmpty3 } from "radash";
49851
50047
  import { useMemo as useMemo22 } from "react";
49852
50048
  var useLatestAssistantMessageWithContent = function() {
49853
- var $ = _c102(4);
50049
+ var $ = _c103(4);
49854
50050
  var _useMessages = useMessages(), messages2 = _useMessages.messages;
49855
50051
  var t0;
49856
50052
  var t1;
49857
50053
  if ($[0] !== messages2) {
49858
50054
  var _messages$find;
49859
- t1 = (_messages$find = messages2.find(_temp25)) !== null && _messages$find !== void 0 ? _messages$find : null;
50055
+ t1 = (_messages$find = messages2.find(_temp26)) !== null && _messages$find !== void 0 ? _messages$find : null;
49860
50056
  $[0] = messages2;
49861
50057
  $[1] = t1;
49862
50058
  } else {
@@ -49875,16 +50071,16 @@ var useLatestAssistantMessageWithContent = function() {
49875
50071
  t0 = t2;
49876
50072
  return t0;
49877
50073
  };
49878
- function _temp11(content2) {
50074
+ function _temp12(content2) {
49879
50075
  return content2.type === "text" && !isEmpty3(content2.text.value);
49880
50076
  }
49881
- function _temp25(message) {
49882
- return message.role === "assistant" && message.content.some(_temp11);
50077
+ function _temp26(message) {
50078
+ return message.role === "assistant" && message.content.some(_temp12);
49883
50079
  }
49884
50080
  // src/components/gui/Gui/index.tsx
49885
50081
  import { jsx as _jsx99, jsxs as _jsxs37 } from "react/jsx-runtime";
49886
50082
  var StartingToolCalls3 = function() {
49887
- var $ = _c103(2);
50083
+ var $ = _c104(2);
49888
50084
  var _useComponents = useComponents(), t0 = _useComponents.components;
49889
50085
  var StartingToolCalls4 = t0.StartingToolCalls;
49890
50086
  var t1;
@@ -49898,7 +50094,7 @@ var StartingToolCalls3 = function() {
49898
50094
  return t1;
49899
50095
  };
49900
50096
  var Content10 = function(t0) {
49901
- var $ = _c103(5);
50097
+ var $ = _c104(5);
49902
50098
  var latestRunStep = t0.latestRunStep;
49903
50099
  var t1;
49904
50100
  bb0: {
@@ -49952,14 +50148,14 @@ var Content10 = function(t0) {
49952
50148
  return t2;
49953
50149
  };
49954
50150
  var Progress2 = function(t0) {
49955
- var $ = _c103(5);
50151
+ var $ = _c104(5);
49956
50152
  var latestAssistantMessage = t0.latestAssistantMessage;
49957
50153
  var isMutatingMessage = useIsMutatingMessage();
49958
50154
  var t1;
49959
50155
  var t2;
49960
50156
  if ($[0] !== latestAssistantMessage.runSteps) {
49961
50157
  var _latestAssistantMessa;
49962
- t2 = (_latestAssistantMessa = latestAssistantMessage.runSteps.find(_temp12)) !== null && _latestAssistantMessa !== void 0 ? _latestAssistantMessa : null;
50158
+ t2 = (_latestAssistantMessa = latestAssistantMessage.runSteps.find(_temp13)) !== null && _latestAssistantMessa !== void 0 ? _latestAssistantMessa : null;
49963
50159
  $[0] = latestAssistantMessage.runSteps;
49964
50160
  $[1] = t2;
49965
50161
  } else {
@@ -50002,7 +50198,7 @@ var Progress2 = function(t0) {
50002
50198
  return t4;
50003
50199
  };
50004
50200
  var Gui = function() {
50005
- var $ = _c103(8);
50201
+ var $ = _c104(8);
50006
50202
  var latestAssistantMessage = useLatestAssistantMessage().latestAssistantMessage;
50007
50203
  var latestAssistantMessageWithContent = useLatestAssistantMessageWithContent().latestAssistantMessageWithContent;
50008
50204
  if (!latestAssistantMessage || !latestAssistantMessageWithContent) {
@@ -50064,11 +50260,11 @@ var Gui = function() {
50064
50260
  }
50065
50261
  return t2;
50066
50262
  };
50067
- function _temp12(rs) {
50263
+ function _temp13(rs) {
50068
50264
  return rs.status === "in_progress";
50069
50265
  }
50070
50266
  // src/components/markdown/MarkdownProvider/index.tsx
50071
- import { c as _c104 } from "react-compiler-runtime";
50267
+ import { c as _c105 } from "react-compiler-runtime";
50072
50268
  import { useMemo as useMemo24 } from "react";
50073
50269
  import { jsx as _jsx100 } from "react/jsx-runtime";
50074
50270
  var _excluded7 = [
@@ -50093,7 +50289,7 @@ function _objectWithoutPropertiesLoose7(r, e) {
50093
50289
  return t;
50094
50290
  }
50095
50291
  var MarkdownProvider = function(t0) {
50096
- var $ = _c104(9);
50292
+ var $ = _c105(9);
50097
50293
  var children;
50098
50294
  var rest;
50099
50295
  if ($[0] !== t0) {
@@ -50136,18 +50332,18 @@ var MarkdownProvider = function(t0) {
50136
50332
  return t3;
50137
50333
  };
50138
50334
  // src/components/annotations/SourceAnnotation/index.tsx
50139
- import { c as _c107 } from "react-compiler-runtime";
50335
+ import { c as _c108 } from "react-compiler-runtime";
50140
50336
  // src/components/annotations/SourceAnnotation/FileCitation/index.tsx
50141
- import { c as _c106 } from "react-compiler-runtime";
50337
+ import { c as _c107 } from "react-compiler-runtime";
50142
50338
  import { useState as useState13 } from "react";
50143
50339
  import { QuoteIcon as QuoteIcon2 } from "@radix-ui/react-icons";
50144
50340
  import { Dialog, VisuallyHidden, IconButton as IconButton11 } from "@radix-ui/themes";
50145
50341
  // src/components/annotations/SourceAnnotation/FileCitation/Content.tsx
50146
- import { c as _c105 } from "react-compiler-runtime";
50342
+ import { c as _c106 } from "react-compiler-runtime";
50147
50343
  import { Flex as Flex36, Card as Card6, Inset as Inset3 } from "@radix-ui/themes";
50148
50344
  import { jsx as _jsx101 } from "react/jsx-runtime";
50149
50345
  var Content11 = function(t0) {
50150
- var $ = _c105(5);
50346
+ var $ = _c106(5);
50151
50347
  var fileId = t0.fileId;
50152
50348
  var superinterfaceContext = useSuperinterfaceContext();
50153
50349
  var nextSearchParams = new URLSearchParams(superinterfaceContext.variables);
@@ -50213,7 +50409,7 @@ var Content11 = function(t0) {
50213
50409
  // src/components/annotations/SourceAnnotation/FileCitation/index.tsx
50214
50410
  import { jsx as _jsx102, jsxs as _jsxs38, Fragment as _Fragment6 } from "react/jsx-runtime";
50215
50411
  var FileCitation = function(t0) {
50216
- var $ = _c106(18);
50412
+ var $ = _c107(18);
50217
50413
  var annotation = t0.annotation;
50218
50414
  var _useState13 = _sliced_to_array(useState13(null), 2), activeFileId = _useState13[0], setActiveFileId = _useState13[1];
50219
50415
  var t1;
@@ -50362,7 +50558,7 @@ function _objectWithoutPropertiesLoose8(r, e) {
50362
50558
  return t;
50363
50559
  }
50364
50560
  var SourceAnnotation = function(t0) {
50365
- var $ = _c107(10);
50561
+ var $ = _c108(10);
50366
50562
  var children;
50367
50563
  var rest;
50368
50564
  if ($[0] !== t0) {
@@ -50419,7 +50615,7 @@ var SourceAnnotation = function(t0) {
50419
50615
  return null;
50420
50616
  };
50421
50617
  // src/components/avatars/Avatar.tsx
50422
- import { c as _c110 } from "react-compiler-runtime";
50618
+ import { c as _c111 } from "react-compiler-runtime";
50423
50619
  // src/enums/index.ts
50424
50620
  var IconAvatarName = /* @__PURE__ */ function(IconAvatarName2) {
50425
50621
  IconAvatarName2["BACKPACK"] = "BACKPACK";
@@ -50444,7 +50640,7 @@ var AvatarType = /* @__PURE__ */ function(AvatarType2) {
50444
50640
  // src/components/avatars/Avatar.tsx
50445
50641
  import { Avatar as RadixAvatar } from "@radix-ui/themes";
50446
50642
  // src/components/imageAvatars/ImageAvatar/index.tsx
50447
- import { c as _c108 } from "react-compiler-runtime";
50643
+ import { c as _c109 } from "react-compiler-runtime";
50448
50644
  import { Avatar as Avatar4 } from "@radix-ui/themes";
50449
50645
  // src/components/imageAvatars/ImageAvatar/lib/optimizedSrc/path.ts
50450
50646
  var width = function(_ref) {
@@ -50498,7 +50694,7 @@ var optimizedSrc = function(_ref) {
50498
50694
  // src/components/imageAvatars/ImageAvatar/index.tsx
50499
50695
  import { jsx as _jsx104 } from "react/jsx-runtime";
50500
50696
  var ImageAvatar = function(t0) {
50501
- var $ = _c108(9);
50697
+ var $ = _c109(9);
50502
50698
  var imageAvatar = t0.imageAvatar, size = t0.size, className = t0.className, style = t0.style;
50503
50699
  var superinterfaceContext = useSuperinterfaceContext();
50504
50700
  var t1;
@@ -50535,7 +50731,7 @@ var ImageAvatar = function(t0) {
50535
50731
  return t2;
50536
50732
  };
50537
50733
  // src/components/iconAvatars/IconAvatar.tsx
50538
- import { c as _c109 } from "react-compiler-runtime";
50734
+ import { c as _c110 } from "react-compiler-runtime";
50539
50735
  import { useMemo as useMemo25 } from "react";
50540
50736
  import { Avatar as Avatar5 } from "@radix-ui/themes";
50541
50737
  // src/lib/iconAvatars/iconAvatarComponents.ts
@@ -50545,7 +50741,7 @@ var iconAvatarComponents = (_obj = {}, _define_property(_obj, IconAvatarName.BAC
50545
50741
  // src/components/iconAvatars/IconAvatar.tsx
50546
50742
  import { jsx as _jsx105 } from "react/jsx-runtime";
50547
50743
  var IconAvatar = function(t0) {
50548
- var $ = _c109(7);
50744
+ var $ = _c110(7);
50549
50745
  var iconAvatar = t0.iconAvatar, size = t0.size, className = t0.className, style = t0.style;
50550
50746
  var t1;
50551
50747
  t1 = iconAvatarComponents[iconAvatar.name];
@@ -50579,7 +50775,7 @@ var IconAvatar = function(t0) {
50579
50775
  // src/components/avatars/Avatar.tsx
50580
50776
  import { jsx as _jsx106 } from "react/jsx-runtime";
50581
50777
  var Avatar6 = function(t0) {
50582
- var $ = _c110(14);
50778
+ var $ = _c111(14);
50583
50779
  var avatar = t0.avatar, t1 = t0.size, className = t0.className, style = t0.style;
50584
50780
  var size = t1 === void 0 ? "1" : t1;
50585
50781
  if (avatar) {
@@ -50640,7 +50836,7 @@ var Avatar6 = function(t0) {
50640
50836
  return t2;
50641
50837
  };
50642
50838
  // src/components/components/ComponentsProvider.tsx
50643
- import { c as _c111 } from "react-compiler-runtime";
50839
+ import { c as _c112 } from "react-compiler-runtime";
50644
50840
  import { useMemo as useMemo26 } from "react";
50645
50841
  import { jsx as _jsx107 } from "react/jsx-runtime";
50646
50842
  var _excluded9 = [
@@ -50665,7 +50861,7 @@ function _objectWithoutPropertiesLoose9(r, e) {
50665
50861
  return t;
50666
50862
  }
50667
50863
  var ComponentsProvider = function(t0) {
50668
- var $ = _c111(9);
50864
+ var $ = _c112(9);
50669
50865
  var children;
50670
50866
  var rest;
50671
50867
  if ($[0] !== t0) {
@@ -50708,11 +50904,11 @@ var ComponentsProvider = function(t0) {
50708
50904
  return t3;
50709
50905
  };
50710
50906
  // src/components/assistants/AssistantProvider/index.tsx
50711
- import { c as _c112 } from "react-compiler-runtime";
50907
+ import { c as _c113 } from "react-compiler-runtime";
50712
50908
  import { jsx as _jsx108 } from "react/jsx-runtime";
50713
50909
  var AssistantProvider = function(t0) {
50714
50910
  var _assistant$name;
50715
- var $ = _c112(10);
50911
+ var $ = _c113(10);
50716
50912
  var children = t0.children;
50717
50913
  var superinterfaceContext = useSuperinterfaceContext();
50718
50914
  var t1;