@superinterface/react 5.0.0-beta.3 → 5.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +216 -138
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +4 -3
- package/dist/index.d.ts +4 -3
- package/dist/index.js +227 -149
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -44351,7 +44351,7 @@ var Root8 = function(_ref) {
|
|
|
44351
44351
|
var children = _ref.children, onSubmitArg = _ref.onSubmit, isDisabledArg = _ref.isDisabled, style = _ref.style, className = _ref.className;
|
|
44352
44352
|
var _$_ref = _sliced_to_array((0, import_react51.useState)([]), 2), files = _$_ref[0], setFiles = _$_ref[1];
|
|
44353
44353
|
var formProps = (0, import_react_hook_form.useForm)(formOptions);
|
|
44354
|
-
var handleSubmit = formProps.handleSubmit, isSubmitting = formProps.formState.isSubmitting,
|
|
44354
|
+
var handleSubmit = formProps.handleSubmit, isSubmitting = formProps.formState.isSubmitting, formReset = formProps.reset, watch = formProps.watch;
|
|
44355
44355
|
var addToast = useToasts().addToast;
|
|
44356
44356
|
var queryClient = (0, import_react_query6.useQueryClient)();
|
|
44357
44357
|
var threadContext = useSuperinterfaceContext();
|
|
@@ -44386,9 +44386,16 @@ var Root8 = function(_ref) {
|
|
|
44386
44386
|
latestMessage,
|
|
44387
44387
|
isDisabledArg
|
|
44388
44388
|
]);
|
|
44389
|
+
var reset = (0, import_react51.useCallback)(function() {
|
|
44390
|
+
formReset();
|
|
44391
|
+
setFiles([]);
|
|
44392
|
+
}, [
|
|
44393
|
+
formReset
|
|
44394
|
+
]);
|
|
44389
44395
|
var onSubmit = onSubmitArg ? (0, import_radash14.partob)(onSubmitArg, {
|
|
44390
44396
|
reset: reset,
|
|
44391
|
-
createMessage: createMessage
|
|
44397
|
+
createMessage: createMessage,
|
|
44398
|
+
files: files
|
|
44392
44399
|
}) : /* @__PURE__ */ function() {
|
|
44393
44400
|
var _ref2 = _asyncToGenerator6(function(data2) {
|
|
44394
44401
|
var attachments, imageFileContentParts, content2;
|
|
@@ -44405,7 +44412,6 @@ var Root8 = function(_ref) {
|
|
|
44405
44412
|
2
|
|
44406
44413
|
];
|
|
44407
44414
|
reset();
|
|
44408
|
-
setFiles([]);
|
|
44409
44415
|
attachments = files.filter(function(file_0) {
|
|
44410
44416
|
return file_0.purpose === "assistants";
|
|
44411
44417
|
}).map(function(file_1) {
|
|
@@ -47430,7 +47436,6 @@ function _toPrimitive47(t, r) {
|
|
|
47430
47436
|
}
|
|
47431
47437
|
return ("string" === r ? String : Number)(t);
|
|
47432
47438
|
}
|
|
47433
|
-
var FULL_SENTENCE_REGEX = /[\.?!]$/;
|
|
47434
47439
|
var getMessageSentences = function(_ref) {
|
|
47435
47440
|
var messageId = _ref.messageId, input2 = _ref.input;
|
|
47436
47441
|
var sentences = (0, import_compromise.default)(input2).sentences().json();
|
|
@@ -47442,80 +47447,110 @@ var getMessageSentences = function(_ref) {
|
|
|
47442
47447
|
});
|
|
47443
47448
|
};
|
|
47444
47449
|
var useMessageAudio = function(t0) {
|
|
47445
|
-
var _latestMessageProps$l;
|
|
47446
|
-
var $ = (0, import_react_compiler_runtime88.c)(
|
|
47447
|
-
var _onEnd = t0.onEnd, passedPlay = t0.play;
|
|
47448
|
-
var _ref = _sliced_to_array((0, import_react67.useState)(false), 2), isAudioPlayed = _ref[0], setIsAudioPlayed = _ref[1];
|
|
47449
|
-
var t1;
|
|
47450
|
-
if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
|
|
47451
|
-
t1 = [];
|
|
47452
|
-
$[0] = t1;
|
|
47453
|
-
} else {
|
|
47454
|
-
t1 = $[0];
|
|
47455
|
-
}
|
|
47456
|
-
var _ref1 = _sliced_to_array((0, import_react67.useState)(t1), 2), stoppedMessageIds = _ref1[0], setStoppedMessageIds = _ref1[1];
|
|
47450
|
+
var _latestMessageProps$l, _latestMessageProps$l4, _latestMessageProps$l5;
|
|
47451
|
+
var $ = (0, import_react_compiler_runtime88.c)(68);
|
|
47452
|
+
var _onEnd = t0.onEnd, passedPlay = t0.play, t1 = t0.fullSentenceRegex;
|
|
47457
47453
|
var t2;
|
|
47458
|
-
if ($[
|
|
47459
|
-
t2 = [];
|
|
47454
|
+
if ($[0] !== t1) {
|
|
47455
|
+
t2 = t1 === void 0 ? /[\.?!]$/ : t1;
|
|
47456
|
+
$[0] = t1;
|
|
47460
47457
|
$[1] = t2;
|
|
47461
47458
|
} else {
|
|
47462
47459
|
t2 = $[1];
|
|
47463
47460
|
}
|
|
47464
|
-
var
|
|
47461
|
+
var fullSentenceRegex = t2;
|
|
47462
|
+
var _ref = _sliced_to_array((0, import_react67.useState)(false), 2), isAudioPlayed = _ref[0], setIsAudioPlayed = _ref[1];
|
|
47463
|
+
var t3;
|
|
47464
|
+
if ($[2] === Symbol.for("react.memo_cache_sentinel")) {
|
|
47465
|
+
t3 = [];
|
|
47466
|
+
$[2] = t3;
|
|
47467
|
+
} else {
|
|
47468
|
+
t3 = $[2];
|
|
47469
|
+
}
|
|
47470
|
+
var _ref1 = _sliced_to_array((0, import_react67.useState)(t3), 2), stoppedMessageIds = _ref1[0], setStoppedMessageIds = _ref1[1];
|
|
47471
|
+
var t4;
|
|
47472
|
+
if ($[3] === Symbol.for("react.memo_cache_sentinel")) {
|
|
47473
|
+
t4 = [];
|
|
47474
|
+
$[3] = t4;
|
|
47475
|
+
} else {
|
|
47476
|
+
t4 = $[3];
|
|
47477
|
+
}
|
|
47478
|
+
var _ref2 = _sliced_to_array((0, import_react67.useState)(t4), 2), playedMessageSentences = _ref2[0], setPlayedMessageSentences = _ref2[1];
|
|
47465
47479
|
var audioPlayer = (0, import_react_use_audio_player2.useAudioPlayer)();
|
|
47466
47480
|
var nextAudioPlayer = (0, import_react_use_audio_player2.useAudioPlayer)();
|
|
47467
47481
|
var superinterfaceContext = useSuperinterfaceContext();
|
|
47468
47482
|
var _ref3 = _sliced_to_array((0, import_react67.useState)(false), 2), isPlaying = _ref3[0], setIsPlaying = _ref3[1];
|
|
47483
|
+
var isLastSentencePlayedRef = (0, import_react67.useRef)(false);
|
|
47469
47484
|
var latestMessageProps = useLatestMessage();
|
|
47470
|
-
var
|
|
47485
|
+
var t5;
|
|
47486
|
+
var t6;
|
|
47487
|
+
if ($[4] !== isPlaying) {
|
|
47488
|
+
t5 = function() {
|
|
47489
|
+
if (!isPlaying) {
|
|
47490
|
+
return;
|
|
47491
|
+
}
|
|
47492
|
+
isLastSentencePlayedRef.current = false;
|
|
47493
|
+
};
|
|
47494
|
+
t6 = [
|
|
47495
|
+
isPlaying
|
|
47496
|
+
];
|
|
47497
|
+
$[4] = isPlaying;
|
|
47498
|
+
$[5] = t5;
|
|
47499
|
+
$[6] = t6;
|
|
47500
|
+
} else {
|
|
47501
|
+
t5 = $[5];
|
|
47502
|
+
t6 = $[6];
|
|
47503
|
+
}
|
|
47504
|
+
(0, import_react67.useEffect)(t5, t6);
|
|
47505
|
+
var t7;
|
|
47471
47506
|
bb0: {
|
|
47472
47507
|
if (!latestMessageProps.latestMessage) {
|
|
47473
47508
|
var _t;
|
|
47474
|
-
if ($[
|
|
47509
|
+
if ($[7] === Symbol.for("react.memo_cache_sentinel")) {
|
|
47475
47510
|
_t = [];
|
|
47476
|
-
$[
|
|
47511
|
+
$[7] = _t;
|
|
47477
47512
|
} else {
|
|
47478
|
-
_t = $[
|
|
47513
|
+
_t = $[7];
|
|
47479
47514
|
}
|
|
47480
|
-
|
|
47515
|
+
t7 = _t;
|
|
47481
47516
|
break bb0;
|
|
47482
47517
|
}
|
|
47483
47518
|
if (latestMessageProps.latestMessage.role !== "assistant") {
|
|
47484
47519
|
var _t2;
|
|
47485
|
-
if ($[
|
|
47520
|
+
if ($[8] === Symbol.for("react.memo_cache_sentinel")) {
|
|
47486
47521
|
_t2 = [];
|
|
47487
|
-
$[
|
|
47522
|
+
$[8] = _t2;
|
|
47488
47523
|
} else {
|
|
47489
|
-
_t2 = $[
|
|
47524
|
+
_t2 = $[8];
|
|
47490
47525
|
}
|
|
47491
|
-
|
|
47526
|
+
t7 = _t2;
|
|
47492
47527
|
break bb0;
|
|
47493
47528
|
}
|
|
47494
47529
|
if (stoppedMessageIds.includes(latestMessageProps.latestMessage.id)) {
|
|
47495
47530
|
var _t3;
|
|
47496
|
-
if ($[
|
|
47531
|
+
if ($[9] === Symbol.for("react.memo_cache_sentinel")) {
|
|
47497
47532
|
_t3 = [];
|
|
47498
|
-
$[
|
|
47533
|
+
$[9] = _t3;
|
|
47499
47534
|
} else {
|
|
47500
|
-
_t3 = $[
|
|
47535
|
+
_t3 = $[9];
|
|
47501
47536
|
}
|
|
47502
|
-
|
|
47537
|
+
t7 = _t3;
|
|
47503
47538
|
break bb0;
|
|
47504
47539
|
}
|
|
47505
47540
|
var _t4;
|
|
47506
|
-
if ($[
|
|
47541
|
+
if ($[10] !== latestMessageProps.latestMessage || $[11] !== playedMessageSentences) {
|
|
47507
47542
|
var input2 = input({
|
|
47508
47543
|
message: latestMessageProps.latestMessage
|
|
47509
47544
|
});
|
|
47510
47545
|
if (!input2) {
|
|
47511
47546
|
var _t5;
|
|
47512
|
-
if ($[
|
|
47547
|
+
if ($[14] === Symbol.for("react.memo_cache_sentinel")) {
|
|
47513
47548
|
_t5 = [];
|
|
47514
|
-
$[
|
|
47549
|
+
$[14] = _t5;
|
|
47515
47550
|
} else {
|
|
47516
|
-
_t5 = $[
|
|
47551
|
+
_t5 = $[14];
|
|
47517
47552
|
}
|
|
47518
|
-
|
|
47553
|
+
t7 = _t5;
|
|
47519
47554
|
break bb0;
|
|
47520
47555
|
}
|
|
47521
47556
|
var messageSentences = getMessageSentences({
|
|
@@ -47523,33 +47558,33 @@ var useMessageAudio = function(t0) {
|
|
|
47523
47558
|
input: input2
|
|
47524
47559
|
});
|
|
47525
47560
|
var _t6;
|
|
47526
|
-
if ($[
|
|
47561
|
+
if ($[15] !== playedMessageSentences) {
|
|
47527
47562
|
_t6 = function(ms) {
|
|
47528
47563
|
return !playedMessageSentences.find(function(pms) {
|
|
47529
47564
|
return pms.messageId === ms.messageId && pms.sentence === ms.sentence;
|
|
47530
47565
|
});
|
|
47531
47566
|
};
|
|
47532
|
-
$[
|
|
47533
|
-
$[
|
|
47567
|
+
$[15] = playedMessageSentences;
|
|
47568
|
+
$[16] = _t6;
|
|
47534
47569
|
} else {
|
|
47535
|
-
_t6 = $[
|
|
47570
|
+
_t6 = $[16];
|
|
47536
47571
|
}
|
|
47537
47572
|
_t4 = messageSentences.filter(_t6);
|
|
47538
|
-
$[
|
|
47539
|
-
$[
|
|
47540
|
-
$[
|
|
47541
|
-
$[
|
|
47573
|
+
$[10] = latestMessageProps.latestMessage;
|
|
47574
|
+
$[11] = playedMessageSentences;
|
|
47575
|
+
$[12] = _t4;
|
|
47576
|
+
$[13] = t7;
|
|
47542
47577
|
} else {
|
|
47543
|
-
_t4 = $[
|
|
47544
|
-
|
|
47578
|
+
_t4 = $[12];
|
|
47579
|
+
t7 = $[13];
|
|
47545
47580
|
}
|
|
47546
|
-
|
|
47581
|
+
t7 = _t4;
|
|
47547
47582
|
}
|
|
47548
|
-
var unplayedMessageSentences =
|
|
47549
|
-
var
|
|
47550
|
-
if ($[
|
|
47551
|
-
|
|
47552
|
-
var input_0 =
|
|
47583
|
+
var unplayedMessageSentences = t7;
|
|
47584
|
+
var t8;
|
|
47585
|
+
if ($[17] !== audioPlayer || $[18] !== fullSentenceRegex || $[19] !== isAudioPlayed || $[20] !== nextAudioPlayer || $[21] !== superinterfaceContext || $[22] !== unplayedMessageSentences[1]) {
|
|
47586
|
+
t8 = function(t92) {
|
|
47587
|
+
var input_0 = t92.input, onPlay = t92.onPlay, onStop = t92.onStop, onEnd_0 = t92.onEnd;
|
|
47553
47588
|
var searchParams = new URLSearchParams(_objectSpread47({
|
|
47554
47589
|
input: input_0
|
|
47555
47590
|
}, superinterfaceContext.variables));
|
|
@@ -47564,7 +47599,7 @@ var useMessageAudio = function(t0) {
|
|
|
47564
47599
|
if (!nextUnplayedMessageSentence) {
|
|
47565
47600
|
return;
|
|
47566
47601
|
}
|
|
47567
|
-
var isNextFullSentence =
|
|
47602
|
+
var isNextFullSentence = fullSentenceRegex.test(nextUnplayedMessageSentence.sentence);
|
|
47568
47603
|
if (!isNextFullSentence) {
|
|
47569
47604
|
return;
|
|
47570
47605
|
}
|
|
@@ -47580,22 +47615,23 @@ var useMessageAudio = function(t0) {
|
|
|
47580
47615
|
onend: onEnd_0
|
|
47581
47616
|
});
|
|
47582
47617
|
};
|
|
47583
|
-
$[
|
|
47584
|
-
$[
|
|
47585
|
-
$[
|
|
47586
|
-
$[
|
|
47587
|
-
$[
|
|
47588
|
-
$[
|
|
47618
|
+
$[17] = audioPlayer;
|
|
47619
|
+
$[18] = fullSentenceRegex;
|
|
47620
|
+
$[19] = isAudioPlayed;
|
|
47621
|
+
$[20] = nextAudioPlayer;
|
|
47622
|
+
$[21] = superinterfaceContext;
|
|
47623
|
+
$[22] = unplayedMessageSentences[1];
|
|
47624
|
+
$[23] = t8;
|
|
47589
47625
|
} else {
|
|
47590
|
-
|
|
47626
|
+
t8 = $[23];
|
|
47591
47627
|
}
|
|
47592
|
-
var defaultPlay =
|
|
47593
|
-
var
|
|
47594
|
-
|
|
47595
|
-
var play =
|
|
47596
|
-
var
|
|
47597
|
-
if ($[
|
|
47598
|
-
|
|
47628
|
+
var defaultPlay = t8;
|
|
47629
|
+
var t9;
|
|
47630
|
+
t9 = passedPlay || defaultPlay;
|
|
47631
|
+
var play = t9;
|
|
47632
|
+
var t10;
|
|
47633
|
+
if ($[24] !== audioPlayer.playing || $[25] !== fullSentenceRegex || $[26] !== isPlaying || $[27] !== latestMessageProps.latestMessage || $[28] !== _onEnd || $[29] !== play || $[30] !== unplayedMessageSentences[0] || $[31] !== unplayedMessageSentences.length) {
|
|
47634
|
+
t10 = function() {
|
|
47599
47635
|
if (isPlaying) {
|
|
47600
47636
|
return;
|
|
47601
47637
|
}
|
|
@@ -47614,7 +47650,7 @@ var useMessageAudio = function(t0) {
|
|
|
47614
47650
|
}
|
|
47615
47651
|
var isFullSentence = isOptimistic({
|
|
47616
47652
|
id: latestMessageProps.latestMessage.id
|
|
47617
|
-
}) || latestMessageProps.latestMessage.status !== "in_progress" ||
|
|
47653
|
+
}) || latestMessageProps.latestMessage.status !== "in_progress" || fullSentenceRegex.test(firstUnplayedMessageSentence.sentence);
|
|
47618
47654
|
if (!isFullSentence) {
|
|
47619
47655
|
return;
|
|
47620
47656
|
}
|
|
@@ -47640,25 +47676,29 @@ var useMessageAudio = function(t0) {
|
|
|
47640
47676
|
},
|
|
47641
47677
|
onEnd: function() {
|
|
47642
47678
|
setIsPlaying(false);
|
|
47643
|
-
|
|
47679
|
+
isLastSentencePlayedRef.current = unplayedMessageSentences.length === 1;
|
|
47680
|
+
if (isLastSentencePlayedRef.current && latestMessageProps.latestMessage.status !== "in_progress") {
|
|
47644
47681
|
_onEnd();
|
|
47682
|
+
isLastSentencePlayedRef.current = false;
|
|
47645
47683
|
}
|
|
47646
47684
|
}
|
|
47647
47685
|
});
|
|
47648
47686
|
};
|
|
47649
|
-
$[
|
|
47650
|
-
$[
|
|
47651
|
-
$[
|
|
47652
|
-
$[
|
|
47653
|
-
$[
|
|
47654
|
-
$[
|
|
47655
|
-
$[
|
|
47687
|
+
$[24] = audioPlayer.playing;
|
|
47688
|
+
$[25] = fullSentenceRegex;
|
|
47689
|
+
$[26] = isPlaying;
|
|
47690
|
+
$[27] = latestMessageProps.latestMessage;
|
|
47691
|
+
$[28] = _onEnd;
|
|
47692
|
+
$[29] = play;
|
|
47693
|
+
$[30] = unplayedMessageSentences[0];
|
|
47694
|
+
$[31] = unplayedMessageSentences.length;
|
|
47695
|
+
$[32] = t10;
|
|
47656
47696
|
} else {
|
|
47657
|
-
|
|
47697
|
+
t10 = $[32];
|
|
47658
47698
|
}
|
|
47659
|
-
var
|
|
47660
|
-
if ($[
|
|
47661
|
-
|
|
47699
|
+
var t11;
|
|
47700
|
+
if ($[33] !== audioPlayer || $[34] !== fullSentenceRegex || $[35] !== isPlaying || $[36] !== latestMessageProps || $[37] !== nextAudioPlayer || $[38] !== _onEnd || $[39] !== play || $[40] !== playedMessageSentences || $[41] !== superinterfaceContext || $[42] !== unplayedMessageSentences) {
|
|
47701
|
+
t11 = [
|
|
47662
47702
|
unplayedMessageSentences,
|
|
47663
47703
|
isPlaying,
|
|
47664
47704
|
superinterfaceContext,
|
|
@@ -47667,38 +47707,76 @@ var useMessageAudio = function(t0) {
|
|
|
47667
47707
|
nextAudioPlayer,
|
|
47668
47708
|
playedMessageSentences,
|
|
47669
47709
|
_onEnd,
|
|
47670
|
-
play
|
|
47710
|
+
play,
|
|
47711
|
+
fullSentenceRegex
|
|
47671
47712
|
];
|
|
47672
|
-
$[
|
|
47673
|
-
$[
|
|
47674
|
-
$[
|
|
47675
|
-
$[
|
|
47676
|
-
$[
|
|
47677
|
-
$[
|
|
47678
|
-
$[
|
|
47679
|
-
$[
|
|
47680
|
-
$[
|
|
47681
|
-
$[
|
|
47682
|
-
|
|
47683
|
-
|
|
47684
|
-
|
|
47685
|
-
|
|
47686
|
-
|
|
47687
|
-
|
|
47688
|
-
|
|
47713
|
+
$[33] = audioPlayer;
|
|
47714
|
+
$[34] = fullSentenceRegex;
|
|
47715
|
+
$[35] = isPlaying;
|
|
47716
|
+
$[36] = latestMessageProps;
|
|
47717
|
+
$[37] = nextAudioPlayer;
|
|
47718
|
+
$[38] = _onEnd;
|
|
47719
|
+
$[39] = play;
|
|
47720
|
+
$[40] = playedMessageSentences;
|
|
47721
|
+
$[41] = superinterfaceContext;
|
|
47722
|
+
$[42] = unplayedMessageSentences;
|
|
47723
|
+
$[43] = t11;
|
|
47724
|
+
} else {
|
|
47725
|
+
t11 = $[43];
|
|
47726
|
+
}
|
|
47727
|
+
(0, import_react67.useEffect)(t10, t11);
|
|
47728
|
+
var t12;
|
|
47729
|
+
if ($[44] !== isPlaying || $[45] !== ((_latestMessageProps$l = latestMessageProps.latestMessage) === null || _latestMessageProps$l === void 0 ? void 0 : _latestMessageProps$l.status) || $[46] !== _onEnd || $[47] !== unplayedMessageSentences.length) {
|
|
47730
|
+
var _latestMessageProps$l3;
|
|
47731
|
+
t12 = function() {
|
|
47732
|
+
var _latestMessageProps$l2;
|
|
47733
|
+
if (isLastSentencePlayedRef.current && !isPlaying && unplayedMessageSentences.length === 0 && ((_latestMessageProps$l2 = latestMessageProps.latestMessage) === null || _latestMessageProps$l2 === void 0 ? void 0 : _latestMessageProps$l2.status) !== "in_progress") {
|
|
47734
|
+
_onEnd();
|
|
47735
|
+
isLastSentencePlayedRef.current = false;
|
|
47736
|
+
}
|
|
47737
|
+
};
|
|
47738
|
+
$[44] = isPlaying;
|
|
47739
|
+
$[45] = (_latestMessageProps$l3 = latestMessageProps.latestMessage) === null || _latestMessageProps$l3 === void 0 ? void 0 : _latestMessageProps$l3.status;
|
|
47740
|
+
$[46] = _onEnd;
|
|
47741
|
+
$[47] = unplayedMessageSentences.length;
|
|
47742
|
+
$[48] = t12;
|
|
47743
|
+
} else {
|
|
47744
|
+
t12 = $[48];
|
|
47745
|
+
}
|
|
47746
|
+
var t13 = (_latestMessageProps$l4 = latestMessageProps.latestMessage) === null || _latestMessageProps$l4 === void 0 ? void 0 : _latestMessageProps$l4.status;
|
|
47747
|
+
var t14;
|
|
47748
|
+
if ($[49] !== isPlaying || $[50] !== _onEnd || $[51] !== t13 || $[52] !== unplayedMessageSentences.length) {
|
|
47749
|
+
t14 = [
|
|
47750
|
+
isPlaying,
|
|
47751
|
+
unplayedMessageSentences.length,
|
|
47752
|
+
t13,
|
|
47753
|
+
_onEnd
|
|
47754
|
+
];
|
|
47755
|
+
$[49] = isPlaying;
|
|
47756
|
+
$[50] = _onEnd;
|
|
47757
|
+
$[51] = t13;
|
|
47758
|
+
$[52] = unplayedMessageSentences.length;
|
|
47759
|
+
$[53] = t14;
|
|
47760
|
+
} else {
|
|
47761
|
+
t14 = $[53];
|
|
47762
|
+
}
|
|
47763
|
+
(0, import_react67.useEffect)(t12, t14);
|
|
47764
|
+
var t15;
|
|
47765
|
+
if ($[54] !== audioPlayer) {
|
|
47766
|
+
t15 = [
|
|
47689
47767
|
audioPlayer
|
|
47690
47768
|
];
|
|
47691
|
-
$[
|
|
47692
|
-
$[
|
|
47769
|
+
$[54] = audioPlayer;
|
|
47770
|
+
$[55] = t15;
|
|
47693
47771
|
} else {
|
|
47694
|
-
|
|
47772
|
+
t15 = $[55];
|
|
47695
47773
|
}
|
|
47696
|
-
(0, import_react67.useEffect)(_temp9,
|
|
47774
|
+
(0, import_react67.useEffect)(_temp9, t15);
|
|
47697
47775
|
var _ref4 = _sliced_to_array((0, import_react67.useState)(null), 2), audioEngine = _ref4[0], setAudioEngine = _ref4[1];
|
|
47698
47776
|
var isAudioEngineInited = (0, import_react67.useRef)(false);
|
|
47699
|
-
var
|
|
47700
|
-
if ($[
|
|
47701
|
-
|
|
47777
|
+
var t16;
|
|
47778
|
+
if ($[56] !== audioPlayer.playing) {
|
|
47779
|
+
t16 = function() {
|
|
47702
47780
|
if (!audioPlayer.playing) {
|
|
47703
47781
|
return;
|
|
47704
47782
|
}
|
|
@@ -47719,63 +47797,63 @@ var useMessageAudio = function(t0) {
|
|
|
47719
47797
|
});
|
|
47720
47798
|
}
|
|
47721
47799
|
};
|
|
47722
|
-
$[
|
|
47723
|
-
$[
|
|
47800
|
+
$[56] = audioPlayer.playing;
|
|
47801
|
+
$[57] = t16;
|
|
47724
47802
|
} else {
|
|
47725
|
-
|
|
47803
|
+
t16 = $[57];
|
|
47726
47804
|
}
|
|
47727
|
-
var
|
|
47728
|
-
if ($[
|
|
47729
|
-
|
|
47805
|
+
var t17;
|
|
47806
|
+
if ($[58] !== audioPlayer) {
|
|
47807
|
+
t17 = [
|
|
47730
47808
|
audioPlayer,
|
|
47731
47809
|
isAudioEngineInited
|
|
47732
47810
|
];
|
|
47733
|
-
$[
|
|
47734
|
-
$[
|
|
47811
|
+
$[58] = audioPlayer;
|
|
47812
|
+
$[59] = t17;
|
|
47735
47813
|
} else {
|
|
47736
|
-
|
|
47814
|
+
t17 = $[59];
|
|
47737
47815
|
}
|
|
47738
|
-
(0, import_react67.useEffect)(
|
|
47739
|
-
var
|
|
47816
|
+
(0, import_react67.useEffect)(t16, t17);
|
|
47817
|
+
var t18;
|
|
47740
47818
|
bb1: {
|
|
47741
47819
|
if (!audioEngine) {
|
|
47742
|
-
|
|
47820
|
+
t18 = null;
|
|
47743
47821
|
break bb1;
|
|
47744
47822
|
}
|
|
47745
47823
|
var result;
|
|
47746
|
-
if ($[
|
|
47824
|
+
if ($[60] !== audioEngine.audioContext || $[61] !== audioEngine.source) {
|
|
47747
47825
|
result = audioEngine.audioContext.createAnalyser();
|
|
47748
47826
|
audioEngine.source.connect(audioEngine.audioContext.destination);
|
|
47749
47827
|
audioEngine.source.connect(result);
|
|
47750
|
-
$[
|
|
47751
|
-
$[
|
|
47752
|
-
$[
|
|
47828
|
+
$[60] = audioEngine.audioContext;
|
|
47829
|
+
$[61] = audioEngine.source;
|
|
47830
|
+
$[62] = result;
|
|
47753
47831
|
} else {
|
|
47754
|
-
result = $[
|
|
47832
|
+
result = $[62];
|
|
47755
47833
|
}
|
|
47756
|
-
|
|
47834
|
+
t18 = result;
|
|
47757
47835
|
}
|
|
47758
|
-
var visualizationAnalyser =
|
|
47759
|
-
var
|
|
47760
|
-
|
|
47761
|
-
var isPending =
|
|
47762
|
-
var
|
|
47763
|
-
if ($[
|
|
47764
|
-
|
|
47836
|
+
var visualizationAnalyser = t18;
|
|
47837
|
+
var t19;
|
|
47838
|
+
t19 = isPlaying || unplayedMessageSentences.length > 0 || ((_latestMessageProps$l5 = latestMessageProps.latestMessage) === null || _latestMessageProps$l5 === void 0 ? void 0 : _latestMessageProps$l5.status) === "in_progress";
|
|
47839
|
+
var isPending = t19;
|
|
47840
|
+
var t20;
|
|
47841
|
+
if ($[63] !== audioPlayer || $[64] !== isAudioPlayed || $[65] !== isPending || $[66] !== visualizationAnalyser) {
|
|
47842
|
+
t20 = _objectSpread47(_objectSpread47({
|
|
47765
47843
|
isPending: isPending,
|
|
47766
47844
|
isAudioPlayed: isAudioPlayed
|
|
47767
47845
|
}, audioPlayer), {}, {
|
|
47768
47846
|
visualizationAnalyser: visualizationAnalyser
|
|
47769
47847
|
});
|
|
47770
|
-
$[
|
|
47771
|
-
$[
|
|
47772
|
-
$[
|
|
47773
|
-
$[
|
|
47774
|
-
$[
|
|
47848
|
+
$[63] = audioPlayer;
|
|
47849
|
+
$[64] = isAudioPlayed;
|
|
47850
|
+
$[65] = isPending;
|
|
47851
|
+
$[66] = visualizationAnalyser;
|
|
47852
|
+
$[67] = t20;
|
|
47775
47853
|
} else {
|
|
47776
|
-
|
|
47854
|
+
t20 = $[67];
|
|
47777
47855
|
}
|
|
47778
|
-
return
|
|
47856
|
+
return t20;
|
|
47779
47857
|
};
|
|
47780
47858
|
function _temp9() {
|
|
47781
47859
|
if (isHtmlAudioSupported) {
|