@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.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,419 @@ 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 currentSentenceRef = useRef8(null);
47313
47348
  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
- })
47349
+ var t7;
47350
+ var t8;
47351
+ if ($[7] !== messagesProps.messages) {
47352
+ t7 = function() {
47353
+ var assistants = messagesProps.messages.filter(_temp9);
47354
+ setAudioQueue(function(prev) {
47355
+ var prevById = new Map(prev.map(_temp24));
47356
+ var next = [];
47357
+ var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
47358
+ try {
47359
+ for(var _iterator = assistants[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
47360
+ var m_0 = _step.value;
47361
+ var _existing$nextIndex, _existing$stopped;
47362
+ var inp = input({
47363
+ message: m_0
47364
+ });
47365
+ if (inp == null) {
47366
+ continue;
47367
+ }
47368
+ var sentences = segment(inp);
47369
+ var existing = prevById.get(m_0.id);
47370
+ next.push({
47371
+ id: m_0.id,
47372
+ status: m_0.status,
47373
+ sentences: sentences,
47374
+ nextIndex: Math.min((_existing$nextIndex = existing === null || existing === void 0 ? void 0 : existing.nextIndex) !== null && _existing$nextIndex !== void 0 ? _existing$nextIndex : 0, sentences.length),
47375
+ stopped: (_existing$stopped = existing === null || existing === void 0 ? void 0 : existing.stopped) !== null && _existing$stopped !== void 0 ? _existing$stopped : false
47376
+ });
47377
+ }
47378
+ } catch (err) {
47379
+ _didIteratorError = true;
47380
+ _iteratorError = err;
47381
+ } finally{
47382
+ try {
47383
+ if (!_iteratorNormalCompletion && _iterator.return != null) {
47384
+ _iterator.return();
47385
+ }
47386
+ } finally{
47387
+ if (_didIteratorError) {
47388
+ throw _iteratorError;
47389
+ }
47390
+ }
47391
+ }
47392
+ return next;
47393
+ });
47394
+ };
47395
+ t8 = [
47396
+ messagesProps.messages
47397
+ ];
47398
+ $[7] = messagesProps.messages;
47399
+ $[8] = t7;
47400
+ $[9] = t8;
47401
+ } else {
47402
+ t7 = $[8];
47403
+ t8 = $[9];
47404
+ }
47405
+ useEffect10(t7, t8);
47406
+ var t9;
47407
+ if ($[10] !== audioPlayer || $[11] !== fullSentenceRegex || $[12] !== isAudioPlayed || $[13] !== nextAudioPlayer || $[14] !== superinterfaceContext) {
47408
+ t9 = function(t102) {
47409
+ var input2 = t102.input, onPlay = t102.onPlay, onStop = t102.onStop, onEnd_0 = t102.onEnd;
47410
+ var searchParams = new URLSearchParams(_objectSpread47({
47411
+ input: input2
47412
+ }, superinterfaceContext.variables));
47413
+ audioPlayer.load("".concat(superinterfaceContext.baseUrl, "/audio-runtimes/tts?").concat(searchParams), {
47414
+ format: "mp3",
47415
+ autoplay: isAudioPlayed,
47416
+ html5: isHtmlAudioSupported,
47417
+ onplay: onPlay,
47418
+ onstop: onStop,
47419
+ onload: function() {
47420
+ var current = currentSentenceRef.current;
47421
+ if (!current) {
47422
+ return;
47423
+ }
47424
+ var msg = audioQueueRef.current.find(function(m_1) {
47425
+ return m_1.id === current.messageId;
47426
+ });
47427
+ if (!msg) {
47428
+ return;
47429
+ }
47430
+ var nextSentence = msg.sentences[msg.nextIndex];
47431
+ if (!nextSentence) {
47432
+ return;
47433
+ }
47434
+ if (!fullSentenceRegex.test(nextSentence)) {
47435
+ return;
47436
+ }
47437
+ var nextSearchParams = new URLSearchParams(_objectSpread47({
47438
+ input: nextSentence
47439
+ }, superinterfaceContext.variables));
47440
+ nextAudioPlayer.load("".concat(superinterfaceContext.baseUrl, "/audio-runtimes/tts?").concat(nextSearchParams), {
47441
+ format: "mp3",
47442
+ autoplay: false,
47443
+ html5: isHtmlAudioSupported
47444
+ });
47445
+ },
47446
+ onend: onEnd_0
47447
+ });
47448
+ };
47449
+ $[10] = audioPlayer;
47450
+ $[11] = fullSentenceRegex;
47451
+ $[12] = isAudioPlayed;
47452
+ $[13] = nextAudioPlayer;
47453
+ $[14] = superinterfaceContext;
47454
+ $[15] = t9;
47455
+ } else {
47456
+ t9 = $[15];
47457
+ }
47458
+ var defaultPlay = t9;
47459
+ var t10;
47460
+ t10 = passedPlay || defaultPlay;
47461
+ var play = t10;
47462
+ var t11;
47463
+ var t12;
47464
+ if ($[16] !== audioPlayer.playing || $[17] !== audioQueue || $[18] !== fullSentenceRegex || $[19] !== isPlaying || $[20] !== _onEnd || $[21] !== play) {
47465
+ t11 = function() {
47466
+ if (isPlaying) {
47467
+ return;
47468
+ }
47469
+ if (audioPlayer.playing) {
47470
+ return;
47471
+ }
47472
+ var candidate;
47473
+ candidate = null;
47474
+ var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
47475
+ try {
47476
+ for(var _iterator = audioQueue[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
47477
+ var msg_0 = _step.value;
47478
+ if (msg_0.stopped) {
47479
+ continue;
47480
+ }
47481
+ var sentence = msg_0.sentences[msg_0.nextIndex];
47482
+ if (!sentence) {
47483
+ continue;
47484
+ }
47485
+ var isFull = isOptimistic({
47486
+ id: msg_0.id
47487
+ }) || msg_0.status !== "in_progress" || fullSentenceRegex.test(sentence);
47488
+ if (isFull) {
47489
+ candidate = {
47490
+ messageId: msg_0.id,
47491
+ sentence: sentence,
47492
+ index: msg_0.nextIndex,
47493
+ ownerStatus: msg_0.status
47494
+ };
47495
+ break;
47496
+ }
47497
+ }
47498
+ } catch (err) {
47499
+ _didIteratorError = true;
47500
+ _iteratorError = err;
47501
+ } finally{
47502
+ try {
47503
+ if (!_iteratorNormalCompletion && _iterator.return != null) {
47504
+ _iterator.return();
47505
+ }
47506
+ } finally{
47507
+ if (_didIteratorError) {
47508
+ throw _iteratorError;
47509
+ }
47510
+ }
47511
+ }
47512
+ if (!candidate) {
47513
+ return;
47514
+ }
47515
+ setIsPlaying(true);
47516
+ currentSentenceRef.current = {
47517
+ messageId: candidate.messageId,
47518
+ index: candidate.index
47332
47519
  };
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
47520
+ setAudioQueue(function(prev_0) {
47521
+ return prev_0.map(function(m_2) {
47522
+ return m_2.id === candidate.messageId ? _objectSpread47(_objectSpread47({}, m_2), {}, {
47523
+ nextIndex: m_2.nextIndex + 1
47524
+ }) : m_2;
47525
+ });
47342
47526
  });
47343
- });
47344
- return messageSentences.filter(function(ms) {
47345
- return !playedMessageSentences.find(function(pms) {
47346
- return pms.messageId === ms.messageId && pms.sentence === ms.sentence;
47527
+ play({
47528
+ input: candidate.sentence,
47529
+ onPlay: function() {
47530
+ return setIsAudioPlayed(true);
47531
+ },
47532
+ onStop: function() {
47533
+ setAudioQueue(function(prev_1) {
47534
+ return prev_1.map(function(m_3) {
47535
+ return m_3.id === candidate.messageId ? _objectSpread47(_objectSpread47({}, m_3), {}, {
47536
+ stopped: true
47537
+ }) : m_3;
47538
+ });
47539
+ });
47540
+ setIsPlaying(false);
47541
+ currentSentenceRef.current = null;
47542
+ },
47543
+ onEnd: function() {
47544
+ setIsPlaying(false);
47545
+ currentSentenceRef.current = null;
47546
+ var hasPending = audioQueueRef.current.some(_temp32);
47547
+ if (!hasPending) {
47548
+ _onEnd();
47549
+ }
47550
+ }
47347
47551
  });
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
47552
+ };
47553
+ t12 = [
47554
+ isPlaying,
47555
+ audioPlayer.playing,
47556
+ audioQueue,
47557
+ play,
47558
+ fullSentenceRegex,
47559
+ _onEnd
47560
+ ];
47561
+ $[16] = audioPlayer.playing;
47562
+ $[17] = audioQueue;
47563
+ $[18] = fullSentenceRegex;
47564
+ $[19] = isPlaying;
47565
+ $[20] = _onEnd;
47566
+ $[21] = play;
47567
+ $[22] = t11;
47568
+ $[23] = t12;
47569
+ } else {
47570
+ t11 = $[22];
47571
+ t12 = $[23];
47572
+ }
47573
+ useEffect10(t11, t12);
47574
+ var t13;
47575
+ if ($[24] !== audioPlayer) {
47576
+ t13 = [
47577
+ audioPlayer
47578
+ ];
47579
+ $[24] = audioPlayer;
47580
+ $[25] = t13;
47581
+ } else {
47582
+ t13 = $[25];
47583
+ }
47584
+ useEffect10(_temp42, t13);
47585
+ var _useState93 = _sliced_to_array(useState9(null), 2), audioEngine = _useState93[0], setAudioEngine = _useState93[1];
47586
+ var isAudioEngineInited = useRef8(false);
47587
+ var t14;
47588
+ if ($[26] !== audioPlayer.playing) {
47589
+ t14 = function() {
47590
+ if (!audioPlayer.playing) {
47591
+ return;
47592
+ }
47593
+ if (isAudioEngineInited.current) {
47594
+ return;
47595
+ }
47596
+ isAudioEngineInited.current = true;
47597
+ if (isHtmlAudioSupported) {
47598
+ var audioContext = new AudioContext();
47599
+ setAudioEngine({
47600
+ source: audioContext.createMediaElementSource(Howler._howls[0]._sounds[0]._node),
47601
+ audioContext: audioContext
47376
47602
  });
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
- ]);
47603
+ } else {
47604
+ setAudioEngine({
47605
+ source: Howler.masterGain,
47606
+ audioContext: Howler.ctx
47424
47607
  });
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;
47433
- }
47434
47608
  }
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";
47609
+ };
47610
+ $[26] = audioPlayer.playing;
47611
+ $[27] = t14;
47612
+ } else {
47613
+ t14 = $[27];
47614
+ }
47615
+ var t15;
47616
+ if ($[28] !== audioPlayer) {
47617
+ t15 = [
47618
+ audioPlayer
47619
+ ];
47620
+ $[28] = audioPlayer;
47621
+ $[29] = t15;
47622
+ } else {
47623
+ t15 = $[29];
47624
+ }
47625
+ useEffect10(t14, t15);
47626
+ var t16;
47627
+ bb0: {
47628
+ if (!audioEngine) {
47629
+ t16 = null;
47630
+ break bb0;
47465
47631
  }
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
47482
- });
47632
+ var analyser;
47633
+ if ($[30] !== audioEngine.audioContext || $[31] !== audioEngine.source) {
47634
+ analyser = audioEngine.audioContext.createAnalyser();
47635
+ audioEngine.source.connect(audioEngine.audioContext.destination);
47636
+ audioEngine.source.connect(analyser);
47637
+ $[30] = audioEngine.audioContext;
47638
+ $[31] = audioEngine.source;
47639
+ $[32] = analyser;
47483
47640
  } else {
47484
- setAudioEngine({
47485
- source: Howler.masterGain,
47486
- audioContext: Howler.ctx
47487
- });
47488
- }
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
- });
47641
+ analyser = $[32];
47642
+ }
47643
+ t16 = analyser;
47644
+ }
47645
+ var visualizationAnalyser = t16;
47646
+ var t17;
47647
+ var t18;
47648
+ if ($[33] !== audioQueue || $[34] !== isPlaying) {
47649
+ t18 = isPlaying || audioQueue.some(_temp52);
47650
+ $[33] = audioQueue;
47651
+ $[34] = isPlaying;
47652
+ $[35] = t18;
47653
+ } else {
47654
+ t18 = $[35];
47655
+ }
47656
+ t17 = t18;
47657
+ var isPending = t17;
47658
+ var t19;
47659
+ if ($[36] !== audioPlayer || $[37] !== isAudioPlayed || $[38] !== isPending || $[39] !== visualizationAnalyser) {
47660
+ t19 = _objectSpread47(_objectSpread47({
47661
+ isPending: isPending,
47662
+ isAudioPlayed: isAudioPlayed
47663
+ }, audioPlayer), {}, {
47664
+ visualizationAnalyser: visualizationAnalyser
47665
+ });
47666
+ $[36] = audioPlayer;
47667
+ $[37] = isAudioPlayed;
47668
+ $[38] = isPending;
47669
+ $[39] = visualizationAnalyser;
47670
+ $[40] = t19;
47671
+ } else {
47672
+ t19 = $[40];
47673
+ }
47674
+ return t19;
47516
47675
  };
47676
+ function _temp9(m) {
47677
+ return m.role === "assistant";
47678
+ }
47679
+ function _temp24(p) {
47680
+ return [
47681
+ p.id,
47682
+ p
47683
+ ];
47684
+ }
47685
+ function _temp32(m_4) {
47686
+ if (m_4.stopped) {
47687
+ return false;
47688
+ }
47689
+ var hasMore = m_4.nextIndex < m_4.sentences.length;
47690
+ var streaming = m_4.status === "in_progress";
47691
+ return hasMore || streaming;
47692
+ }
47693
+ function _temp42() {
47694
+ if (isHtmlAudioSupported) {
47695
+ var _Howler$_howls$;
47696
+ 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)) {
47697
+ return;
47698
+ }
47699
+ Howler._howls[0]._sounds[0]._node.crossOrigin = "anonymous";
47700
+ }
47701
+ }
47702
+ function _temp52(m_5) {
47703
+ return !m_5.stopped && (m_5.nextIndex < m_5.sentences.length || m_5.status === "in_progress");
47704
+ }
47517
47705
  // src/hooks/audioRuntimes/useTtsAudioRuntime/index.ts
47518
47706
  import { useQueryClient as useQueryClient6 } from "@tanstack/react-query";
47519
47707
  // src/hooks/audioRuntimes/useTtsAudioRuntime/blobToData.ts
@@ -47551,7 +47739,7 @@ function _asyncToGenerator11(n) {
47551
47739
  };
47552
47740
  }
47553
47741
  var useTtsAudioRuntime = function(t0) {
47554
- var $ = _c88(30);
47742
+ var $ = _c89(30);
47555
47743
  var play = t0.play, passedOnEnd = t0.onEnd;
47556
47744
  var addToast = useToasts().addToast;
47557
47745
  var queryClient = useQueryClient6();
@@ -47580,7 +47768,7 @@ var useTtsAudioRuntime = function(t0) {
47580
47768
  if ($[1] !== createMessageProps) {
47581
47769
  t2 = {
47582
47770
  isStopOnSilence: true,
47583
- onStart: _temp9,
47771
+ onStart: _temp10,
47584
47772
  onStop: function() {
47585
47773
  var _onStop = _asyncToGenerator11(function(_event, chunks) {
47586
47774
  var blob, audioContent;
@@ -47721,23 +47909,23 @@ var useTtsAudioRuntime = function(t0) {
47721
47909
  t5 = t8;
47722
47910
  return t5;
47723
47911
  };
47724
- function _temp9() {
47725
- return _temp24.apply(this, arguments);
47912
+ function _temp10() {
47913
+ return _temp25.apply(this, arguments);
47726
47914
  }
47727
- function _temp24() {
47728
- _temp24 = _asyncToGenerator11(function() {
47915
+ function _temp25() {
47916
+ _temp25 = _asyncToGenerator11(function() {
47729
47917
  return _ts_generator(this, function(_state) {
47730
47918
  return [
47731
47919
  2
47732
47920
  ];
47733
47921
  });
47734
47922
  });
47735
- return _temp24.apply(this, arguments);
47923
+ return _temp25.apply(this, arguments);
47736
47924
  }
47737
47925
  // src/components/audioRuntimes/TtsAudioRuntimeProvider.tsx
47738
47926
  import { jsx as _jsx87 } from "react/jsx-runtime";
47739
47927
  var TtsAudioRuntimeProvider = function(t0) {
47740
- var $ = _c89(8);
47928
+ var $ = _c90(8);
47741
47929
  var children = t0.children, play = t0.play, onEnd = t0.onEnd;
47742
47930
  var t1;
47743
47931
  if ($[0] !== onEnd || $[1] !== play) {
@@ -47850,7 +48038,7 @@ function _objectWithoutPropertiesLoose5(r, e) {
47850
48038
  return t;
47851
48039
  }
47852
48040
  var Content9 = function(t0) {
47853
- var $ = _c90(4);
48041
+ var $ = _c91(4);
47854
48042
  var children = t0.children, className = t0.className, style = t0.style;
47855
48043
  var t1;
47856
48044
  if ($[0] !== children || $[1] !== className || $[2] !== style) {
@@ -47872,7 +48060,7 @@ var Content9 = function(t0) {
47872
48060
  return t1;
47873
48061
  };
47874
48062
  var AudioRuntimeProvider = function(t0) {
47875
- var $ = _c90(4);
48063
+ var $ = _c91(4);
47876
48064
  var children = t0.children, play = t0.play, onEnd = t0.onEnd;
47877
48065
  var audioThreadContext = useAudioThreadContext();
47878
48066
  if (audioThreadContext.audioRuntime) {
@@ -47895,7 +48083,7 @@ var AudioRuntimeProvider = function(t0) {
47895
48083
  return t1;
47896
48084
  };
47897
48085
  var Provider5 = function(t0) {
47898
- var $ = _c90(9);
48086
+ var $ = _c91(9);
47899
48087
  var children;
47900
48088
  var rest;
47901
48089
  if ($[0] !== t0) {
@@ -47935,7 +48123,7 @@ var Provider5 = function(t0) {
47935
48123
  return t2;
47936
48124
  };
47937
48125
  var Root16 = function(t0) {
47938
- var $ = _c90(18);
48126
+ var $ = _c91(18);
47939
48127
  var children;
47940
48128
  var className;
47941
48129
  var onEnd;
@@ -48007,7 +48195,7 @@ var Root16 = function(t0) {
48007
48195
  return t3;
48008
48196
  };
48009
48197
  // src/components/threads/AudioThread/Visualization/index.tsx
48010
- import { c as _c92 } from "react-compiler-runtime";
48198
+ import { c as _c93 } from "react-compiler-runtime";
48011
48199
  import { useState as useState11, useCallback as useCallback9, useEffect as useEffect12, useContext as useContext20, createContext as createContext14 } from "react";
48012
48200
  import _9 from "lodash";
48013
48201
  import { Flex as Flex31 } from "@radix-ui/themes";
@@ -48076,10 +48264,10 @@ var BarsVisualizer = function(_ref) {
48076
48264
  });
48077
48265
  };
48078
48266
  // src/hooks/audioThreads/useStatus/index.ts
48079
- import { c as _c91 } from "react-compiler-runtime";
48267
+ import { c as _c92 } from "react-compiler-runtime";
48080
48268
  import { useMemo as useMemo19 } from "react";
48081
48269
  var useStatus = function() {
48082
- var $ = _c91(2);
48270
+ var $ = _c92(2);
48083
48271
  var audioRuntime = useAudioThreadContext().audioRuntime;
48084
48272
  var t0;
48085
48273
  bb0: {
@@ -48239,7 +48427,7 @@ var Provider6 = function(_ref) {
48239
48427
  });
48240
48428
  };
48241
48429
  var Root17 = function(t0) {
48242
- var $ = _c92(6);
48430
+ var $ = _c93(6);
48243
48431
  var children;
48244
48432
  var rest;
48245
48433
  if ($[0] !== t0) {
@@ -48276,7 +48464,7 @@ var Root17 = function(t0) {
48276
48464
  return t1;
48277
48465
  };
48278
48466
  var BarsVisualizer2 = function(t0) {
48279
- var $ = _c92(10);
48467
+ var $ = _c93(10);
48280
48468
  var rest;
48281
48469
  var t1;
48282
48470
  var t2;
@@ -48320,7 +48508,7 @@ var BarsVisualizer2 = function(t0) {
48320
48508
  return t4;
48321
48509
  };
48322
48510
  var AssistantVisualizationRoot = function(t0) {
48323
- var $ = _c92(17);
48511
+ var $ = _c93(17);
48324
48512
  var children;
48325
48513
  var rest;
48326
48514
  var t1;
@@ -48393,7 +48581,7 @@ var AssistantVisualizationRoot = function(t0) {
48393
48581
  return t6;
48394
48582
  };
48395
48583
  var AssistantVisualization = function(props) {
48396
- var $ = _c92(3);
48584
+ var $ = _c93(3);
48397
48585
  var t0;
48398
48586
  if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
48399
48587
  t0 = /* @__PURE__ */ _jsx90(BarsVisualizer2, {});
@@ -48416,7 +48604,7 @@ var AssistantVisualization = function(props) {
48416
48604
  AssistantVisualization.Root = AssistantVisualizationRoot;
48417
48605
  AssistantVisualization.BarsVisualizer = BarsVisualizer2;
48418
48606
  var AssistantInfo = function(props) {
48419
- var $ = _c92(6);
48607
+ var $ = _c93(6);
48420
48608
  var assistantNameContext = useContext20(AssistantNameContext);
48421
48609
  var t0;
48422
48610
  if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
@@ -48456,7 +48644,7 @@ var AssistantInfo = function(props) {
48456
48644
  return t2;
48457
48645
  };
48458
48646
  var Visualization = function(props) {
48459
- var $ = _c92(4);
48647
+ var $ = _c93(4);
48460
48648
  var t0;
48461
48649
  var t1;
48462
48650
  if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
@@ -48488,9 +48676,9 @@ Visualization.Provider = Provider6;
48488
48676
  Visualization.AssistantVisualization = AssistantVisualization;
48489
48677
  Visualization.AssistantInfo = AssistantInfo;
48490
48678
  // src/components/threads/AudioThread/Status/index.tsx
48491
- import { c as _c94 } from "react-compiler-runtime";
48679
+ import { c as _c95 } from "react-compiler-runtime";
48492
48680
  // src/components/threads/AudioThread/Status/StatusMessages.tsx
48493
- import { c as _c93 } from "react-compiler-runtime";
48681
+ import { c as _c94 } from "react-compiler-runtime";
48494
48682
  import { Flex as Flex32, Text as Text9 } from "@radix-ui/themes";
48495
48683
  import { jsx as _jsx91, jsxs as _jsxs32 } from "react/jsx-runtime";
48496
48684
  var html = function(_ref) {
@@ -48500,7 +48688,7 @@ var html = function(_ref) {
48500
48688
  }).join(""), "\n }");
48501
48689
  };
48502
48690
  var StatusMessages = function(t0) {
48503
- var $ = _c93(9);
48691
+ var $ = _c94(9);
48504
48692
  var texts = t0.texts, className = t0.className, style = t0.style;
48505
48693
  var t1;
48506
48694
  if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
@@ -48604,7 +48792,7 @@ function _toPrimitive50(t, r) {
48604
48792
  return ("string" === r ? String : Number)(t);
48605
48793
  }
48606
48794
  var Status = function(props) {
48607
- var $ = _c94(12);
48795
+ var $ = _c95(12);
48608
48796
  var status = useStatus().status;
48609
48797
  if (status === "recording") {
48610
48798
  var _t;
@@ -48701,10 +48889,10 @@ var Status = function(props) {
48701
48889
  return t1;
48702
48890
  };
48703
48891
  // src/components/threads/AudioThread/Form/index.tsx
48704
- import { c as _c97 } from "react-compiler-runtime";
48892
+ import { c as _c98 } from "react-compiler-runtime";
48705
48893
  import { Flex as Flex34 } from "@radix-ui/themes";
48706
48894
  // src/components/threads/AudioThread/Form/MicIcon.tsx
48707
- import { c as _c95 } from "react-compiler-runtime";
48895
+ import { c as _c96 } from "react-compiler-runtime";
48708
48896
  import { jsx as _jsx93 } from "react/jsx-runtime";
48709
48897
  function ownKeys51(e, r) {
48710
48898
  var t = Object.keys(e);
@@ -48750,7 +48938,7 @@ function _toPrimitive51(t, r) {
48750
48938
  return ("string" === r ? String : Number)(t);
48751
48939
  }
48752
48940
  var MicIcon = function(props) {
48753
- var $ = _c95(3);
48941
+ var $ = _c96(3);
48754
48942
  var t0;
48755
48943
  if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
48756
48944
  t0 = /* @__PURE__ */ _jsx93("path", {
@@ -48782,12 +48970,12 @@ var MicIcon = function(props) {
48782
48970
  return t1;
48783
48971
  };
48784
48972
  // src/components/threads/AudioThread/Form/ActionButton/index.tsx
48785
- import { c as _c96 } from "react-compiler-runtime";
48973
+ import { c as _c97 } from "react-compiler-runtime";
48786
48974
  import { Flex as Flex33, IconButton as IconButton10 } from "@radix-ui/themes";
48787
48975
  import { StopIcon as StopIcon2, PauseIcon as PauseIcon2, ArrowUpIcon as ArrowUpIcon3, ResumeIcon } from "@radix-ui/react-icons";
48788
48976
  import { jsx as _jsx94, jsxs as _jsxs33 } from "react/jsx-runtime";
48789
48977
  var ActionButton = function() {
48790
- var $ = _c96(27);
48978
+ var $ = _c97(27);
48791
48979
  var status = useStatus().status;
48792
48980
  var audioThreadContext = useAudioThreadContext();
48793
48981
  var superinterfaceContext = useSuperinterfaceContext();
@@ -49025,7 +49213,7 @@ function _toPrimitive52(t, r) {
49025
49213
  return ("string" === r ? String : Number)(t);
49026
49214
  }
49027
49215
  var Form = function(props) {
49028
- var $ = _c97(17);
49216
+ var $ = _c98(17);
49029
49217
  var status = useStatus().status;
49030
49218
  var audioThreadContext = useAudioThreadContext();
49031
49219
  var t0 = status === "recording" ? "var(--accent-11)" : "var(--gray-11)";
@@ -49175,7 +49363,7 @@ function _toPrimitive53(t, r) {
49175
49363
  return ("string" === r ? String : Number)(t);
49176
49364
  }
49177
49365
  var AudioThread = function(props) {
49178
- var $ = _c98(5);
49366
+ var $ = _c99(5);
49179
49367
  var t0;
49180
49368
  var t1;
49181
49369
  var t2;
@@ -49257,7 +49445,7 @@ function _toPrimitive54(t, r) {
49257
49445
  return ("string" === r ? String : Number)(t);
49258
49446
  }
49259
49447
  var AudioThreadDialog = function(props) {
49260
- var $ = _c99(4);
49448
+ var $ = _c100(4);
49261
49449
  var t0;
49262
49450
  var t1;
49263
49451
  if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
@@ -49779,10 +49967,10 @@ var useWebrtcAudioRuntime = function() {
49779
49967
  ]);
49780
49968
  };
49781
49969
  // src/components/audioRuntimes/WebrtcAudioRuntimeProvider.tsx
49782
- import { c as _c100 } from "react-compiler-runtime";
49970
+ import { c as _c101 } from "react-compiler-runtime";
49783
49971
  import { jsx as _jsx98 } from "react/jsx-runtime";
49784
49972
  var WebrtcAudioRuntimeProvider = function(t0) {
49785
- var $ = _c100(5);
49973
+ var $ = _c101(5);
49786
49974
  var children = t0.children;
49787
49975
  var webrtcAudioRuntime = useWebrtcAudioRuntime().webrtcAudioRuntime;
49788
49976
  var t1;
@@ -49810,20 +49998,20 @@ var WebrtcAudioRuntimeProvider = function(t0) {
49810
49998
  return t2;
49811
49999
  };
49812
50000
  // src/components/gui/Gui/index.tsx
49813
- import { c as _c103 } from "react-compiler-runtime";
50001
+ import { c as _c104 } from "react-compiler-runtime";
49814
50002
  import { useMemo as useMemo23 } from "react";
49815
50003
  import { Flex as Flex35, Card as Card5, Spinner as Spinner3 } from "@radix-ui/themes";
49816
50004
  // src/hooks/messages/useLatestAssistantMessage/index.ts
49817
- import { c as _c101 } from "react-compiler-runtime";
50005
+ import { c as _c102 } from "react-compiler-runtime";
49818
50006
  import { useMemo as useMemo21 } from "react";
49819
50007
  var useLatestAssistantMessage = function() {
49820
- var $ = _c101(4);
50008
+ var $ = _c102(4);
49821
50009
  var _useMessages = useMessages(), messages2 = _useMessages.messages;
49822
50010
  var t0;
49823
50011
  var t1;
49824
50012
  if ($[0] !== messages2) {
49825
50013
  var _messages$find;
49826
- t1 = (_messages$find = messages2.find(_temp10)) !== null && _messages$find !== void 0 ? _messages$find : null;
50014
+ t1 = (_messages$find = messages2.find(_temp11)) !== null && _messages$find !== void 0 ? _messages$find : null;
49827
50015
  $[0] = messages2;
49828
50016
  $[1] = t1;
49829
50017
  } else {
@@ -49842,21 +50030,21 @@ var useLatestAssistantMessage = function() {
49842
50030
  t0 = t2;
49843
50031
  return t0;
49844
50032
  };
49845
- function _temp10(message) {
50033
+ function _temp11(message) {
49846
50034
  return message.role === "assistant";
49847
50035
  }
49848
50036
  // src/hooks/messages/useLatestAssistantMessageWithContent/index.ts
49849
- import { c as _c102 } from "react-compiler-runtime";
50037
+ import { c as _c103 } from "react-compiler-runtime";
49850
50038
  import { isEmpty as isEmpty3 } from "radash";
49851
50039
  import { useMemo as useMemo22 } from "react";
49852
50040
  var useLatestAssistantMessageWithContent = function() {
49853
- var $ = _c102(4);
50041
+ var $ = _c103(4);
49854
50042
  var _useMessages = useMessages(), messages2 = _useMessages.messages;
49855
50043
  var t0;
49856
50044
  var t1;
49857
50045
  if ($[0] !== messages2) {
49858
50046
  var _messages$find;
49859
- t1 = (_messages$find = messages2.find(_temp25)) !== null && _messages$find !== void 0 ? _messages$find : null;
50047
+ t1 = (_messages$find = messages2.find(_temp26)) !== null && _messages$find !== void 0 ? _messages$find : null;
49860
50048
  $[0] = messages2;
49861
50049
  $[1] = t1;
49862
50050
  } else {
@@ -49875,16 +50063,16 @@ var useLatestAssistantMessageWithContent = function() {
49875
50063
  t0 = t2;
49876
50064
  return t0;
49877
50065
  };
49878
- function _temp11(content2) {
50066
+ function _temp12(content2) {
49879
50067
  return content2.type === "text" && !isEmpty3(content2.text.value);
49880
50068
  }
49881
- function _temp25(message) {
49882
- return message.role === "assistant" && message.content.some(_temp11);
50069
+ function _temp26(message) {
50070
+ return message.role === "assistant" && message.content.some(_temp12);
49883
50071
  }
49884
50072
  // src/components/gui/Gui/index.tsx
49885
50073
  import { jsx as _jsx99, jsxs as _jsxs37 } from "react/jsx-runtime";
49886
50074
  var StartingToolCalls3 = function() {
49887
- var $ = _c103(2);
50075
+ var $ = _c104(2);
49888
50076
  var _useComponents = useComponents(), t0 = _useComponents.components;
49889
50077
  var StartingToolCalls4 = t0.StartingToolCalls;
49890
50078
  var t1;
@@ -49898,7 +50086,7 @@ var StartingToolCalls3 = function() {
49898
50086
  return t1;
49899
50087
  };
49900
50088
  var Content10 = function(t0) {
49901
- var $ = _c103(5);
50089
+ var $ = _c104(5);
49902
50090
  var latestRunStep = t0.latestRunStep;
49903
50091
  var t1;
49904
50092
  bb0: {
@@ -49952,14 +50140,14 @@ var Content10 = function(t0) {
49952
50140
  return t2;
49953
50141
  };
49954
50142
  var Progress2 = function(t0) {
49955
- var $ = _c103(5);
50143
+ var $ = _c104(5);
49956
50144
  var latestAssistantMessage = t0.latestAssistantMessage;
49957
50145
  var isMutatingMessage = useIsMutatingMessage();
49958
50146
  var t1;
49959
50147
  var t2;
49960
50148
  if ($[0] !== latestAssistantMessage.runSteps) {
49961
50149
  var _latestAssistantMessa;
49962
- t2 = (_latestAssistantMessa = latestAssistantMessage.runSteps.find(_temp12)) !== null && _latestAssistantMessa !== void 0 ? _latestAssistantMessa : null;
50150
+ t2 = (_latestAssistantMessa = latestAssistantMessage.runSteps.find(_temp13)) !== null && _latestAssistantMessa !== void 0 ? _latestAssistantMessa : null;
49963
50151
  $[0] = latestAssistantMessage.runSteps;
49964
50152
  $[1] = t2;
49965
50153
  } else {
@@ -50002,7 +50190,7 @@ var Progress2 = function(t0) {
50002
50190
  return t4;
50003
50191
  };
50004
50192
  var Gui = function() {
50005
- var $ = _c103(8);
50193
+ var $ = _c104(8);
50006
50194
  var latestAssistantMessage = useLatestAssistantMessage().latestAssistantMessage;
50007
50195
  var latestAssistantMessageWithContent = useLatestAssistantMessageWithContent().latestAssistantMessageWithContent;
50008
50196
  if (!latestAssistantMessage || !latestAssistantMessageWithContent) {
@@ -50064,11 +50252,11 @@ var Gui = function() {
50064
50252
  }
50065
50253
  return t2;
50066
50254
  };
50067
- function _temp12(rs) {
50255
+ function _temp13(rs) {
50068
50256
  return rs.status === "in_progress";
50069
50257
  }
50070
50258
  // src/components/markdown/MarkdownProvider/index.tsx
50071
- import { c as _c104 } from "react-compiler-runtime";
50259
+ import { c as _c105 } from "react-compiler-runtime";
50072
50260
  import { useMemo as useMemo24 } from "react";
50073
50261
  import { jsx as _jsx100 } from "react/jsx-runtime";
50074
50262
  var _excluded7 = [
@@ -50093,7 +50281,7 @@ function _objectWithoutPropertiesLoose7(r, e) {
50093
50281
  return t;
50094
50282
  }
50095
50283
  var MarkdownProvider = function(t0) {
50096
- var $ = _c104(9);
50284
+ var $ = _c105(9);
50097
50285
  var children;
50098
50286
  var rest;
50099
50287
  if ($[0] !== t0) {
@@ -50136,18 +50324,18 @@ var MarkdownProvider = function(t0) {
50136
50324
  return t3;
50137
50325
  };
50138
50326
  // src/components/annotations/SourceAnnotation/index.tsx
50139
- import { c as _c107 } from "react-compiler-runtime";
50327
+ import { c as _c108 } from "react-compiler-runtime";
50140
50328
  // src/components/annotations/SourceAnnotation/FileCitation/index.tsx
50141
- import { c as _c106 } from "react-compiler-runtime";
50329
+ import { c as _c107 } from "react-compiler-runtime";
50142
50330
  import { useState as useState13 } from "react";
50143
50331
  import { QuoteIcon as QuoteIcon2 } from "@radix-ui/react-icons";
50144
50332
  import { Dialog, VisuallyHidden, IconButton as IconButton11 } from "@radix-ui/themes";
50145
50333
  // src/components/annotations/SourceAnnotation/FileCitation/Content.tsx
50146
- import { c as _c105 } from "react-compiler-runtime";
50334
+ import { c as _c106 } from "react-compiler-runtime";
50147
50335
  import { Flex as Flex36, Card as Card6, Inset as Inset3 } from "@radix-ui/themes";
50148
50336
  import { jsx as _jsx101 } from "react/jsx-runtime";
50149
50337
  var Content11 = function(t0) {
50150
- var $ = _c105(5);
50338
+ var $ = _c106(5);
50151
50339
  var fileId = t0.fileId;
50152
50340
  var superinterfaceContext = useSuperinterfaceContext();
50153
50341
  var nextSearchParams = new URLSearchParams(superinterfaceContext.variables);
@@ -50213,7 +50401,7 @@ var Content11 = function(t0) {
50213
50401
  // src/components/annotations/SourceAnnotation/FileCitation/index.tsx
50214
50402
  import { jsx as _jsx102, jsxs as _jsxs38, Fragment as _Fragment6 } from "react/jsx-runtime";
50215
50403
  var FileCitation = function(t0) {
50216
- var $ = _c106(18);
50404
+ var $ = _c107(18);
50217
50405
  var annotation = t0.annotation;
50218
50406
  var _useState13 = _sliced_to_array(useState13(null), 2), activeFileId = _useState13[0], setActiveFileId = _useState13[1];
50219
50407
  var t1;
@@ -50362,7 +50550,7 @@ function _objectWithoutPropertiesLoose8(r, e) {
50362
50550
  return t;
50363
50551
  }
50364
50552
  var SourceAnnotation = function(t0) {
50365
- var $ = _c107(10);
50553
+ var $ = _c108(10);
50366
50554
  var children;
50367
50555
  var rest;
50368
50556
  if ($[0] !== t0) {
@@ -50419,7 +50607,7 @@ var SourceAnnotation = function(t0) {
50419
50607
  return null;
50420
50608
  };
50421
50609
  // src/components/avatars/Avatar.tsx
50422
- import { c as _c110 } from "react-compiler-runtime";
50610
+ import { c as _c111 } from "react-compiler-runtime";
50423
50611
  // src/enums/index.ts
50424
50612
  var IconAvatarName = /* @__PURE__ */ function(IconAvatarName2) {
50425
50613
  IconAvatarName2["BACKPACK"] = "BACKPACK";
@@ -50444,7 +50632,7 @@ var AvatarType = /* @__PURE__ */ function(AvatarType2) {
50444
50632
  // src/components/avatars/Avatar.tsx
50445
50633
  import { Avatar as RadixAvatar } from "@radix-ui/themes";
50446
50634
  // src/components/imageAvatars/ImageAvatar/index.tsx
50447
- import { c as _c108 } from "react-compiler-runtime";
50635
+ import { c as _c109 } from "react-compiler-runtime";
50448
50636
  import { Avatar as Avatar4 } from "@radix-ui/themes";
50449
50637
  // src/components/imageAvatars/ImageAvatar/lib/optimizedSrc/path.ts
50450
50638
  var width = function(_ref) {
@@ -50498,7 +50686,7 @@ var optimizedSrc = function(_ref) {
50498
50686
  // src/components/imageAvatars/ImageAvatar/index.tsx
50499
50687
  import { jsx as _jsx104 } from "react/jsx-runtime";
50500
50688
  var ImageAvatar = function(t0) {
50501
- var $ = _c108(9);
50689
+ var $ = _c109(9);
50502
50690
  var imageAvatar = t0.imageAvatar, size = t0.size, className = t0.className, style = t0.style;
50503
50691
  var superinterfaceContext = useSuperinterfaceContext();
50504
50692
  var t1;
@@ -50535,7 +50723,7 @@ var ImageAvatar = function(t0) {
50535
50723
  return t2;
50536
50724
  };
50537
50725
  // src/components/iconAvatars/IconAvatar.tsx
50538
- import { c as _c109 } from "react-compiler-runtime";
50726
+ import { c as _c110 } from "react-compiler-runtime";
50539
50727
  import { useMemo as useMemo25 } from "react";
50540
50728
  import { Avatar as Avatar5 } from "@radix-ui/themes";
50541
50729
  // src/lib/iconAvatars/iconAvatarComponents.ts
@@ -50545,7 +50733,7 @@ var iconAvatarComponents = (_obj = {}, _define_property(_obj, IconAvatarName.BAC
50545
50733
  // src/components/iconAvatars/IconAvatar.tsx
50546
50734
  import { jsx as _jsx105 } from "react/jsx-runtime";
50547
50735
  var IconAvatar = function(t0) {
50548
- var $ = _c109(7);
50736
+ var $ = _c110(7);
50549
50737
  var iconAvatar = t0.iconAvatar, size = t0.size, className = t0.className, style = t0.style;
50550
50738
  var t1;
50551
50739
  t1 = iconAvatarComponents[iconAvatar.name];
@@ -50579,7 +50767,7 @@ var IconAvatar = function(t0) {
50579
50767
  // src/components/avatars/Avatar.tsx
50580
50768
  import { jsx as _jsx106 } from "react/jsx-runtime";
50581
50769
  var Avatar6 = function(t0) {
50582
- var $ = _c110(14);
50770
+ var $ = _c111(14);
50583
50771
  var avatar = t0.avatar, t1 = t0.size, className = t0.className, style = t0.style;
50584
50772
  var size = t1 === void 0 ? "1" : t1;
50585
50773
  if (avatar) {
@@ -50640,7 +50828,7 @@ var Avatar6 = function(t0) {
50640
50828
  return t2;
50641
50829
  };
50642
50830
  // src/components/components/ComponentsProvider.tsx
50643
- import { c as _c111 } from "react-compiler-runtime";
50831
+ import { c as _c112 } from "react-compiler-runtime";
50644
50832
  import { useMemo as useMemo26 } from "react";
50645
50833
  import { jsx as _jsx107 } from "react/jsx-runtime";
50646
50834
  var _excluded9 = [
@@ -50665,7 +50853,7 @@ function _objectWithoutPropertiesLoose9(r, e) {
50665
50853
  return t;
50666
50854
  }
50667
50855
  var ComponentsProvider = function(t0) {
50668
- var $ = _c111(9);
50856
+ var $ = _c112(9);
50669
50857
  var children;
50670
50858
  var rest;
50671
50859
  if ($[0] !== t0) {
@@ -50708,11 +50896,11 @@ var ComponentsProvider = function(t0) {
50708
50896
  return t3;
50709
50897
  };
50710
50898
  // src/components/assistants/AssistantProvider/index.tsx
50711
- import { c as _c112 } from "react-compiler-runtime";
50899
+ import { c as _c113 } from "react-compiler-runtime";
50712
50900
  import { jsx as _jsx108 } from "react/jsx-runtime";
50713
50901
  var AssistantProvider = function(t0) {
50714
50902
  var _assistant$name;
50715
- var $ = _c112(10);
50903
+ var $ = _c113(10);
50716
50904
  var children = t0.children;
50717
50905
  var superinterfaceContext = useSuperinterfaceContext();
50718
50906
  var t1;