@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.js
CHANGED
|
@@ -44116,7 +44116,7 @@ Submit.Root = Root7;
|
|
|
44116
44116
|
Submit.Button = Button3;
|
|
44117
44117
|
// src/components/threads/Thread/MessageForm/Root/index.tsx
|
|
44118
44118
|
import { useQueryClient as useQueryClient4 } from "@tanstack/react-query";
|
|
44119
|
-
import { useMemo as useMemo13, useState as useState4 } from "react";
|
|
44119
|
+
import { useMemo as useMemo13, useState as useState4, useCallback as useCallback3 } from "react";
|
|
44120
44120
|
import { useForm, FormProvider } from "react-hook-form";
|
|
44121
44121
|
import { Box as Box14 } from "@radix-ui/themes";
|
|
44122
44122
|
// src/components/threads/Thread/MessageForm/Root/lib/formOptions.ts
|
|
@@ -44202,7 +44202,7 @@ var Root8 = function(_ref) {
|
|
|
44202
44202
|
var children = _ref.children, onSubmitArg = _ref.onSubmit, isDisabledArg = _ref.isDisabled, style = _ref.style, className = _ref.className;
|
|
44203
44203
|
var _useState4 = _sliced_to_array(useState4([]), 2), files = _useState4[0], setFiles = _useState4[1];
|
|
44204
44204
|
var formProps = useForm(formOptions);
|
|
44205
|
-
var handleSubmit = formProps.handleSubmit, isSubmitting = formProps.formState.isSubmitting,
|
|
44205
|
+
var handleSubmit = formProps.handleSubmit, isSubmitting = formProps.formState.isSubmitting, formReset = formProps.reset, watch = formProps.watch;
|
|
44206
44206
|
var addToast = useToasts().addToast;
|
|
44207
44207
|
var queryClient = useQueryClient4();
|
|
44208
44208
|
var threadContext = useSuperinterfaceContext();
|
|
@@ -44237,9 +44237,16 @@ var Root8 = function(_ref) {
|
|
|
44237
44237
|
latestMessage,
|
|
44238
44238
|
isDisabledArg
|
|
44239
44239
|
]);
|
|
44240
|
+
var reset = useCallback3(function() {
|
|
44241
|
+
formReset();
|
|
44242
|
+
setFiles([]);
|
|
44243
|
+
}, [
|
|
44244
|
+
formReset
|
|
44245
|
+
]);
|
|
44240
44246
|
var onSubmit = onSubmitArg ? partob(onSubmitArg, {
|
|
44241
44247
|
reset: reset,
|
|
44242
|
-
createMessage: createMessage
|
|
44248
|
+
createMessage: createMessage,
|
|
44249
|
+
files: files
|
|
44243
44250
|
}) : /* @__PURE__ */ function() {
|
|
44244
44251
|
var _ref2 = _asyncToGenerator6(function(data2) {
|
|
44245
44252
|
var attachments, imageFileContentParts, content2;
|
|
@@ -44256,7 +44263,6 @@ var Root8 = function(_ref) {
|
|
|
44256
44263
|
2
|
|
44257
44264
|
];
|
|
44258
44265
|
reset();
|
|
44259
|
-
setFiles([]);
|
|
44260
44266
|
attachments = files.filter(function(file_0) {
|
|
44261
44267
|
return file_0.purpose === "assistants";
|
|
44262
44268
|
}).map(function(file_1) {
|
|
@@ -44771,7 +44777,7 @@ import { c as _c72 } from "react-compiler-runtime";
|
|
|
44771
44777
|
import { FilePlusIcon } from "@radix-ui/react-icons";
|
|
44772
44778
|
import { IconButton as IconButton7, Flex as Flex22 } from "@radix-ui/themes";
|
|
44773
44779
|
// src/hooks/files/useChangeFilesField/index.ts
|
|
44774
|
-
import { useCallback as
|
|
44780
|
+
import { useCallback as useCallback4 } from "react";
|
|
44775
44781
|
import { omit as omit4 } from "radash";
|
|
44776
44782
|
import dayjs2 from "dayjs";
|
|
44777
44783
|
// src/hooks/files/useCreateFile/index.ts
|
|
@@ -45162,7 +45168,7 @@ var useChangeFilesField = function() {
|
|
|
45162
45168
|
var setFiles = useMessageFormContext().setFiles;
|
|
45163
45169
|
var createFile = useCreateFile().createFile;
|
|
45164
45170
|
var addToast = useToasts().addToast;
|
|
45165
|
-
var changeFilesField =
|
|
45171
|
+
var changeFilesField = useCallback4(/* @__PURE__ */ function() {
|
|
45166
45172
|
var _ref2 = _asyncToGenerator8(function(event) {
|
|
45167
45173
|
var fileObjects, newFiles, _iteratorAbruptCompletion, _didIteratorError, _iteratorError, _loop, _iterator, _step, err;
|
|
45168
45174
|
return _ts_generator(this, function(_state) {
|
|
@@ -45637,7 +45643,7 @@ import { Flex as Flex25 } from "@radix-ui/themes";
|
|
|
45637
45643
|
var Provider2 = SuperinterfaceProvider;
|
|
45638
45644
|
// src/components/toasts/ToastsProvider/index.tsx
|
|
45639
45645
|
import { c as _c75 } from "react-compiler-runtime";
|
|
45640
|
-
import { useState as useState5, useCallback as
|
|
45646
|
+
import { useState as useState5, useCallback as useCallback5 } from "react";
|
|
45641
45647
|
import * as Toast2 from "@radix-ui/react-toast";
|
|
45642
45648
|
// src/components/toasts/ToastsProvider/CustomToast.tsx
|
|
45643
45649
|
import { c as _c74 } from "react-compiler-runtime";
|
|
@@ -46952,7 +46958,7 @@ var usePermission = function(permissionDesc) {
|
|
|
46952
46958
|
// src/hooks/audioThreads/useRecorder/index.ts
|
|
46953
46959
|
import dayjs3 from "dayjs";
|
|
46954
46960
|
import { useAudioCapture } from "use-audio-capture";
|
|
46955
|
-
import { useMemo as useMemo16, useRef as useRef7, useState as useState8, useCallback as
|
|
46961
|
+
import { useMemo as useMemo16, useRef as useRef7, useState as useState8, useCallback as useCallback6, useEffect as useEffect9 } from "react";
|
|
46956
46962
|
import { useAudioPlayer } from "react-use-audio-player";
|
|
46957
46963
|
// src/hooks/misc/useInterval.ts
|
|
46958
46964
|
import { c as _c87 } from "react-compiler-runtime";
|
|
@@ -47165,7 +47171,7 @@ var useRecorder = function(_ref) {
|
|
|
47165
47171
|
}, [
|
|
47166
47172
|
audioEngine
|
|
47167
47173
|
]);
|
|
47168
|
-
var handleSilence =
|
|
47174
|
+
var handleSilence = useCallback6(function() {
|
|
47169
47175
|
if (!silenceAnalyser) return;
|
|
47170
47176
|
var frequencyData = new Uint8Array(silenceAnalyser.frequencyBinCount);
|
|
47171
47177
|
silenceAnalyser.getByteFrequencyData(frequencyData);
|
|
@@ -47212,7 +47218,7 @@ var useRecorder = function(_ref) {
|
|
|
47212
47218
|
};
|
|
47213
47219
|
// src/hooks/audioThreads/useMessageAudio/index.ts
|
|
47214
47220
|
import { c as _c88 } from "react-compiler-runtime";
|
|
47215
|
-
import { useMemo as useMemo17, useRef as useRef8, useState as useState9, useEffect as useEffect10, useCallback as
|
|
47221
|
+
import { useMemo as useMemo17, useRef as useRef8, useState as useState9, useEffect as useEffect10, useCallback as useCallback7 } from "react";
|
|
47216
47222
|
import nlp from "compromise";
|
|
47217
47223
|
import { Howler } from "howler";
|
|
47218
47224
|
import { useAudioPlayer as useAudioPlayer2 } from "react-use-audio-player";
|
|
@@ -47281,7 +47287,6 @@ function _toPrimitive47(t, r) {
|
|
|
47281
47287
|
}
|
|
47282
47288
|
return ("string" === r ? String : Number)(t);
|
|
47283
47289
|
}
|
|
47284
|
-
var FULL_SENTENCE_REGEX = /[\.?!]$/;
|
|
47285
47290
|
var getMessageSentences = function(_ref) {
|
|
47286
47291
|
var messageId = _ref.messageId, input2 = _ref.input;
|
|
47287
47292
|
var sentences = nlp(input2).sentences().json();
|
|
@@ -47293,80 +47298,110 @@ var getMessageSentences = function(_ref) {
|
|
|
47293
47298
|
});
|
|
47294
47299
|
};
|
|
47295
47300
|
var useMessageAudio = function(t0) {
|
|
47296
|
-
var _latestMessageProps$l;
|
|
47297
|
-
var $ = _c88(
|
|
47298
|
-
var _onEnd = t0.onEnd, passedPlay = t0.play;
|
|
47299
|
-
var _useState9 = _sliced_to_array(useState9(false), 2), isAudioPlayed = _useState9[0], setIsAudioPlayed = _useState9[1];
|
|
47300
|
-
var t1;
|
|
47301
|
-
if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
|
|
47302
|
-
t1 = [];
|
|
47303
|
-
$[0] = t1;
|
|
47304
|
-
} else {
|
|
47305
|
-
t1 = $[0];
|
|
47306
|
-
}
|
|
47307
|
-
var _useState91 = _sliced_to_array(useState9(t1), 2), stoppedMessageIds = _useState91[0], setStoppedMessageIds = _useState91[1];
|
|
47301
|
+
var _latestMessageProps$l, _latestMessageProps$l4, _latestMessageProps$l5;
|
|
47302
|
+
var $ = _c88(68);
|
|
47303
|
+
var _onEnd = t0.onEnd, passedPlay = t0.play, t1 = t0.fullSentenceRegex;
|
|
47308
47304
|
var t2;
|
|
47309
|
-
if ($[
|
|
47310
|
-
t2 = [];
|
|
47305
|
+
if ($[0] !== t1) {
|
|
47306
|
+
t2 = t1 === void 0 ? /[\.?!]$/ : t1;
|
|
47307
|
+
$[0] = t1;
|
|
47311
47308
|
$[1] = t2;
|
|
47312
47309
|
} else {
|
|
47313
47310
|
t2 = $[1];
|
|
47314
47311
|
}
|
|
47315
|
-
var
|
|
47312
|
+
var fullSentenceRegex = t2;
|
|
47313
|
+
var _useState9 = _sliced_to_array(useState9(false), 2), isAudioPlayed = _useState9[0], setIsAudioPlayed = _useState9[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 _useState91 = _sliced_to_array(useState9(t3), 2), stoppedMessageIds = _useState91[0], setStoppedMessageIds = _useState91[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 _useState92 = _sliced_to_array(useState9(t4), 2), playedMessageSentences = _useState92[0], setPlayedMessageSentences = _useState92[1];
|
|
47316
47330
|
var audioPlayer = useAudioPlayer2();
|
|
47317
47331
|
var nextAudioPlayer = useAudioPlayer2();
|
|
47318
47332
|
var superinterfaceContext = useSuperinterfaceContext();
|
|
47319
47333
|
var _useState93 = _sliced_to_array(useState9(false), 2), isPlaying = _useState93[0], setIsPlaying = _useState93[1];
|
|
47334
|
+
var isLastSentencePlayedRef = useRef8(false);
|
|
47320
47335
|
var latestMessageProps = useLatestMessage();
|
|
47321
|
-
var
|
|
47336
|
+
var t5;
|
|
47337
|
+
var t6;
|
|
47338
|
+
if ($[4] !== isPlaying) {
|
|
47339
|
+
t5 = function() {
|
|
47340
|
+
if (!isPlaying) {
|
|
47341
|
+
return;
|
|
47342
|
+
}
|
|
47343
|
+
isLastSentencePlayedRef.current = false;
|
|
47344
|
+
};
|
|
47345
|
+
t6 = [
|
|
47346
|
+
isPlaying
|
|
47347
|
+
];
|
|
47348
|
+
$[4] = isPlaying;
|
|
47349
|
+
$[5] = t5;
|
|
47350
|
+
$[6] = t6;
|
|
47351
|
+
} else {
|
|
47352
|
+
t5 = $[5];
|
|
47353
|
+
t6 = $[6];
|
|
47354
|
+
}
|
|
47355
|
+
useEffect10(t5, t6);
|
|
47356
|
+
var t7;
|
|
47322
47357
|
bb0: {
|
|
47323
47358
|
if (!latestMessageProps.latestMessage) {
|
|
47324
47359
|
var _t;
|
|
47325
|
-
if ($[
|
|
47360
|
+
if ($[7] === Symbol.for("react.memo_cache_sentinel")) {
|
|
47326
47361
|
_t = [];
|
|
47327
|
-
$[
|
|
47362
|
+
$[7] = _t;
|
|
47328
47363
|
} else {
|
|
47329
|
-
_t = $[
|
|
47364
|
+
_t = $[7];
|
|
47330
47365
|
}
|
|
47331
|
-
|
|
47366
|
+
t7 = _t;
|
|
47332
47367
|
break bb0;
|
|
47333
47368
|
}
|
|
47334
47369
|
if (latestMessageProps.latestMessage.role !== "assistant") {
|
|
47335
47370
|
var _t2;
|
|
47336
|
-
if ($[
|
|
47371
|
+
if ($[8] === Symbol.for("react.memo_cache_sentinel")) {
|
|
47337
47372
|
_t2 = [];
|
|
47338
|
-
$[
|
|
47373
|
+
$[8] = _t2;
|
|
47339
47374
|
} else {
|
|
47340
|
-
_t2 = $[
|
|
47375
|
+
_t2 = $[8];
|
|
47341
47376
|
}
|
|
47342
|
-
|
|
47377
|
+
t7 = _t2;
|
|
47343
47378
|
break bb0;
|
|
47344
47379
|
}
|
|
47345
47380
|
if (stoppedMessageIds.includes(latestMessageProps.latestMessage.id)) {
|
|
47346
47381
|
var _t3;
|
|
47347
|
-
if ($[
|
|
47382
|
+
if ($[9] === Symbol.for("react.memo_cache_sentinel")) {
|
|
47348
47383
|
_t3 = [];
|
|
47349
|
-
$[
|
|
47384
|
+
$[9] = _t3;
|
|
47350
47385
|
} else {
|
|
47351
|
-
_t3 = $[
|
|
47386
|
+
_t3 = $[9];
|
|
47352
47387
|
}
|
|
47353
|
-
|
|
47388
|
+
t7 = _t3;
|
|
47354
47389
|
break bb0;
|
|
47355
47390
|
}
|
|
47356
47391
|
var _t4;
|
|
47357
|
-
if ($[
|
|
47392
|
+
if ($[10] !== latestMessageProps.latestMessage || $[11] !== playedMessageSentences) {
|
|
47358
47393
|
var input2 = input({
|
|
47359
47394
|
message: latestMessageProps.latestMessage
|
|
47360
47395
|
});
|
|
47361
47396
|
if (!input2) {
|
|
47362
47397
|
var _t5;
|
|
47363
|
-
if ($[
|
|
47398
|
+
if ($[14] === Symbol.for("react.memo_cache_sentinel")) {
|
|
47364
47399
|
_t5 = [];
|
|
47365
|
-
$[
|
|
47400
|
+
$[14] = _t5;
|
|
47366
47401
|
} else {
|
|
47367
|
-
_t5 = $[
|
|
47402
|
+
_t5 = $[14];
|
|
47368
47403
|
}
|
|
47369
|
-
|
|
47404
|
+
t7 = _t5;
|
|
47370
47405
|
break bb0;
|
|
47371
47406
|
}
|
|
47372
47407
|
var messageSentences = getMessageSentences({
|
|
@@ -47374,33 +47409,33 @@ var useMessageAudio = function(t0) {
|
|
|
47374
47409
|
input: input2
|
|
47375
47410
|
});
|
|
47376
47411
|
var _t6;
|
|
47377
|
-
if ($[
|
|
47412
|
+
if ($[15] !== playedMessageSentences) {
|
|
47378
47413
|
_t6 = function(ms) {
|
|
47379
47414
|
return !playedMessageSentences.find(function(pms) {
|
|
47380
47415
|
return pms.messageId === ms.messageId && pms.sentence === ms.sentence;
|
|
47381
47416
|
});
|
|
47382
47417
|
};
|
|
47383
|
-
$[
|
|
47384
|
-
$[
|
|
47418
|
+
$[15] = playedMessageSentences;
|
|
47419
|
+
$[16] = _t6;
|
|
47385
47420
|
} else {
|
|
47386
|
-
_t6 = $[
|
|
47421
|
+
_t6 = $[16];
|
|
47387
47422
|
}
|
|
47388
47423
|
_t4 = messageSentences.filter(_t6);
|
|
47389
|
-
$[
|
|
47390
|
-
$[
|
|
47391
|
-
$[
|
|
47392
|
-
$[
|
|
47424
|
+
$[10] = latestMessageProps.latestMessage;
|
|
47425
|
+
$[11] = playedMessageSentences;
|
|
47426
|
+
$[12] = _t4;
|
|
47427
|
+
$[13] = t7;
|
|
47393
47428
|
} else {
|
|
47394
|
-
_t4 = $[
|
|
47395
|
-
|
|
47429
|
+
_t4 = $[12];
|
|
47430
|
+
t7 = $[13];
|
|
47396
47431
|
}
|
|
47397
|
-
|
|
47432
|
+
t7 = _t4;
|
|
47398
47433
|
}
|
|
47399
|
-
var unplayedMessageSentences =
|
|
47400
|
-
var
|
|
47401
|
-
if ($[
|
|
47402
|
-
|
|
47403
|
-
var input_0 =
|
|
47434
|
+
var unplayedMessageSentences = t7;
|
|
47435
|
+
var t8;
|
|
47436
|
+
if ($[17] !== audioPlayer || $[18] !== fullSentenceRegex || $[19] !== isAudioPlayed || $[20] !== nextAudioPlayer || $[21] !== superinterfaceContext || $[22] !== unplayedMessageSentences[1]) {
|
|
47437
|
+
t8 = function(t92) {
|
|
47438
|
+
var input_0 = t92.input, onPlay = t92.onPlay, onStop = t92.onStop, onEnd_0 = t92.onEnd;
|
|
47404
47439
|
var searchParams = new URLSearchParams(_objectSpread47({
|
|
47405
47440
|
input: input_0
|
|
47406
47441
|
}, superinterfaceContext.variables));
|
|
@@ -47415,7 +47450,7 @@ var useMessageAudio = function(t0) {
|
|
|
47415
47450
|
if (!nextUnplayedMessageSentence) {
|
|
47416
47451
|
return;
|
|
47417
47452
|
}
|
|
47418
|
-
var isNextFullSentence =
|
|
47453
|
+
var isNextFullSentence = fullSentenceRegex.test(nextUnplayedMessageSentence.sentence);
|
|
47419
47454
|
if (!isNextFullSentence) {
|
|
47420
47455
|
return;
|
|
47421
47456
|
}
|
|
@@ -47431,22 +47466,23 @@ var useMessageAudio = function(t0) {
|
|
|
47431
47466
|
onend: onEnd_0
|
|
47432
47467
|
});
|
|
47433
47468
|
};
|
|
47434
|
-
$[
|
|
47435
|
-
$[
|
|
47436
|
-
$[
|
|
47437
|
-
$[
|
|
47438
|
-
$[
|
|
47439
|
-
$[
|
|
47469
|
+
$[17] = audioPlayer;
|
|
47470
|
+
$[18] = fullSentenceRegex;
|
|
47471
|
+
$[19] = isAudioPlayed;
|
|
47472
|
+
$[20] = nextAudioPlayer;
|
|
47473
|
+
$[21] = superinterfaceContext;
|
|
47474
|
+
$[22] = unplayedMessageSentences[1];
|
|
47475
|
+
$[23] = t8;
|
|
47440
47476
|
} else {
|
|
47441
|
-
|
|
47477
|
+
t8 = $[23];
|
|
47442
47478
|
}
|
|
47443
|
-
var defaultPlay =
|
|
47444
|
-
var
|
|
47445
|
-
|
|
47446
|
-
var play =
|
|
47447
|
-
var
|
|
47448
|
-
if ($[
|
|
47449
|
-
|
|
47479
|
+
var defaultPlay = t8;
|
|
47480
|
+
var t9;
|
|
47481
|
+
t9 = passedPlay || defaultPlay;
|
|
47482
|
+
var play = t9;
|
|
47483
|
+
var t10;
|
|
47484
|
+
if ($[24] !== audioPlayer.playing || $[25] !== fullSentenceRegex || $[26] !== isPlaying || $[27] !== latestMessageProps.latestMessage || $[28] !== _onEnd || $[29] !== play || $[30] !== unplayedMessageSentences[0] || $[31] !== unplayedMessageSentences.length) {
|
|
47485
|
+
t10 = function() {
|
|
47450
47486
|
if (isPlaying) {
|
|
47451
47487
|
return;
|
|
47452
47488
|
}
|
|
@@ -47465,7 +47501,7 @@ var useMessageAudio = function(t0) {
|
|
|
47465
47501
|
}
|
|
47466
47502
|
var isFullSentence = isOptimistic({
|
|
47467
47503
|
id: latestMessageProps.latestMessage.id
|
|
47468
|
-
}) || latestMessageProps.latestMessage.status !== "in_progress" ||
|
|
47504
|
+
}) || latestMessageProps.latestMessage.status !== "in_progress" || fullSentenceRegex.test(firstUnplayedMessageSentence.sentence);
|
|
47469
47505
|
if (!isFullSentence) {
|
|
47470
47506
|
return;
|
|
47471
47507
|
}
|
|
@@ -47491,25 +47527,29 @@ var useMessageAudio = function(t0) {
|
|
|
47491
47527
|
},
|
|
47492
47528
|
onEnd: function() {
|
|
47493
47529
|
setIsPlaying(false);
|
|
47494
|
-
|
|
47530
|
+
isLastSentencePlayedRef.current = unplayedMessageSentences.length === 1;
|
|
47531
|
+
if (isLastSentencePlayedRef.current && latestMessageProps.latestMessage.status !== "in_progress") {
|
|
47495
47532
|
_onEnd();
|
|
47533
|
+
isLastSentencePlayedRef.current = false;
|
|
47496
47534
|
}
|
|
47497
47535
|
}
|
|
47498
47536
|
});
|
|
47499
47537
|
};
|
|
47500
|
-
$[
|
|
47501
|
-
$[
|
|
47502
|
-
$[
|
|
47503
|
-
$[
|
|
47504
|
-
$[
|
|
47505
|
-
$[
|
|
47506
|
-
$[
|
|
47538
|
+
$[24] = audioPlayer.playing;
|
|
47539
|
+
$[25] = fullSentenceRegex;
|
|
47540
|
+
$[26] = isPlaying;
|
|
47541
|
+
$[27] = latestMessageProps.latestMessage;
|
|
47542
|
+
$[28] = _onEnd;
|
|
47543
|
+
$[29] = play;
|
|
47544
|
+
$[30] = unplayedMessageSentences[0];
|
|
47545
|
+
$[31] = unplayedMessageSentences.length;
|
|
47546
|
+
$[32] = t10;
|
|
47507
47547
|
} else {
|
|
47508
|
-
|
|
47548
|
+
t10 = $[32];
|
|
47509
47549
|
}
|
|
47510
|
-
var
|
|
47511
|
-
if ($[
|
|
47512
|
-
|
|
47550
|
+
var t11;
|
|
47551
|
+
if ($[33] !== audioPlayer || $[34] !== fullSentenceRegex || $[35] !== isPlaying || $[36] !== latestMessageProps || $[37] !== nextAudioPlayer || $[38] !== _onEnd || $[39] !== play || $[40] !== playedMessageSentences || $[41] !== superinterfaceContext || $[42] !== unplayedMessageSentences) {
|
|
47552
|
+
t11 = [
|
|
47513
47553
|
unplayedMessageSentences,
|
|
47514
47554
|
isPlaying,
|
|
47515
47555
|
superinterfaceContext,
|
|
@@ -47518,38 +47558,76 @@ var useMessageAudio = function(t0) {
|
|
|
47518
47558
|
nextAudioPlayer,
|
|
47519
47559
|
playedMessageSentences,
|
|
47520
47560
|
_onEnd,
|
|
47521
|
-
play
|
|
47561
|
+
play,
|
|
47562
|
+
fullSentenceRegex
|
|
47522
47563
|
];
|
|
47523
|
-
$[
|
|
47524
|
-
$[
|
|
47525
|
-
$[
|
|
47526
|
-
$[
|
|
47527
|
-
$[
|
|
47528
|
-
$[
|
|
47529
|
-
$[
|
|
47530
|
-
$[
|
|
47531
|
-
$[
|
|
47532
|
-
$[
|
|
47533
|
-
|
|
47534
|
-
|
|
47535
|
-
|
|
47536
|
-
|
|
47537
|
-
|
|
47538
|
-
|
|
47539
|
-
|
|
47564
|
+
$[33] = audioPlayer;
|
|
47565
|
+
$[34] = fullSentenceRegex;
|
|
47566
|
+
$[35] = isPlaying;
|
|
47567
|
+
$[36] = latestMessageProps;
|
|
47568
|
+
$[37] = nextAudioPlayer;
|
|
47569
|
+
$[38] = _onEnd;
|
|
47570
|
+
$[39] = play;
|
|
47571
|
+
$[40] = playedMessageSentences;
|
|
47572
|
+
$[41] = superinterfaceContext;
|
|
47573
|
+
$[42] = unplayedMessageSentences;
|
|
47574
|
+
$[43] = t11;
|
|
47575
|
+
} else {
|
|
47576
|
+
t11 = $[43];
|
|
47577
|
+
}
|
|
47578
|
+
useEffect10(t10, t11);
|
|
47579
|
+
var t12;
|
|
47580
|
+
if ($[44] !== isPlaying || $[45] !== ((_latestMessageProps$l = latestMessageProps.latestMessage) === null || _latestMessageProps$l === void 0 ? void 0 : _latestMessageProps$l.status) || $[46] !== _onEnd || $[47] !== unplayedMessageSentences.length) {
|
|
47581
|
+
var _latestMessageProps$l3;
|
|
47582
|
+
t12 = function() {
|
|
47583
|
+
var _latestMessageProps$l2;
|
|
47584
|
+
if (isLastSentencePlayedRef.current && !isPlaying && unplayedMessageSentences.length === 0 && ((_latestMessageProps$l2 = latestMessageProps.latestMessage) === null || _latestMessageProps$l2 === void 0 ? void 0 : _latestMessageProps$l2.status) !== "in_progress") {
|
|
47585
|
+
_onEnd();
|
|
47586
|
+
isLastSentencePlayedRef.current = false;
|
|
47587
|
+
}
|
|
47588
|
+
};
|
|
47589
|
+
$[44] = isPlaying;
|
|
47590
|
+
$[45] = (_latestMessageProps$l3 = latestMessageProps.latestMessage) === null || _latestMessageProps$l3 === void 0 ? void 0 : _latestMessageProps$l3.status;
|
|
47591
|
+
$[46] = _onEnd;
|
|
47592
|
+
$[47] = unplayedMessageSentences.length;
|
|
47593
|
+
$[48] = t12;
|
|
47594
|
+
} else {
|
|
47595
|
+
t12 = $[48];
|
|
47596
|
+
}
|
|
47597
|
+
var t13 = (_latestMessageProps$l4 = latestMessageProps.latestMessage) === null || _latestMessageProps$l4 === void 0 ? void 0 : _latestMessageProps$l4.status;
|
|
47598
|
+
var t14;
|
|
47599
|
+
if ($[49] !== isPlaying || $[50] !== _onEnd || $[51] !== t13 || $[52] !== unplayedMessageSentences.length) {
|
|
47600
|
+
t14 = [
|
|
47601
|
+
isPlaying,
|
|
47602
|
+
unplayedMessageSentences.length,
|
|
47603
|
+
t13,
|
|
47604
|
+
_onEnd
|
|
47605
|
+
];
|
|
47606
|
+
$[49] = isPlaying;
|
|
47607
|
+
$[50] = _onEnd;
|
|
47608
|
+
$[51] = t13;
|
|
47609
|
+
$[52] = unplayedMessageSentences.length;
|
|
47610
|
+
$[53] = t14;
|
|
47611
|
+
} else {
|
|
47612
|
+
t14 = $[53];
|
|
47613
|
+
}
|
|
47614
|
+
useEffect10(t12, t14);
|
|
47615
|
+
var t15;
|
|
47616
|
+
if ($[54] !== audioPlayer) {
|
|
47617
|
+
t15 = [
|
|
47540
47618
|
audioPlayer
|
|
47541
47619
|
];
|
|
47542
|
-
$[
|
|
47543
|
-
$[
|
|
47620
|
+
$[54] = audioPlayer;
|
|
47621
|
+
$[55] = t15;
|
|
47544
47622
|
} else {
|
|
47545
|
-
|
|
47623
|
+
t15 = $[55];
|
|
47546
47624
|
}
|
|
47547
|
-
useEffect10(_temp9,
|
|
47625
|
+
useEffect10(_temp9, t15);
|
|
47548
47626
|
var _useState94 = _sliced_to_array(useState9(null), 2), audioEngine = _useState94[0], setAudioEngine = _useState94[1];
|
|
47549
47627
|
var isAudioEngineInited = useRef8(false);
|
|
47550
|
-
var
|
|
47551
|
-
if ($[
|
|
47552
|
-
|
|
47628
|
+
var t16;
|
|
47629
|
+
if ($[56] !== audioPlayer.playing) {
|
|
47630
|
+
t16 = function() {
|
|
47553
47631
|
if (!audioPlayer.playing) {
|
|
47554
47632
|
return;
|
|
47555
47633
|
}
|
|
@@ -47570,63 +47648,63 @@ var useMessageAudio = function(t0) {
|
|
|
47570
47648
|
});
|
|
47571
47649
|
}
|
|
47572
47650
|
};
|
|
47573
|
-
$[
|
|
47574
|
-
$[
|
|
47651
|
+
$[56] = audioPlayer.playing;
|
|
47652
|
+
$[57] = t16;
|
|
47575
47653
|
} else {
|
|
47576
|
-
|
|
47654
|
+
t16 = $[57];
|
|
47577
47655
|
}
|
|
47578
|
-
var
|
|
47579
|
-
if ($[
|
|
47580
|
-
|
|
47656
|
+
var t17;
|
|
47657
|
+
if ($[58] !== audioPlayer) {
|
|
47658
|
+
t17 = [
|
|
47581
47659
|
audioPlayer,
|
|
47582
47660
|
isAudioEngineInited
|
|
47583
47661
|
];
|
|
47584
|
-
$[
|
|
47585
|
-
$[
|
|
47662
|
+
$[58] = audioPlayer;
|
|
47663
|
+
$[59] = t17;
|
|
47586
47664
|
} else {
|
|
47587
|
-
|
|
47665
|
+
t17 = $[59];
|
|
47588
47666
|
}
|
|
47589
|
-
useEffect10(
|
|
47590
|
-
var
|
|
47667
|
+
useEffect10(t16, t17);
|
|
47668
|
+
var t18;
|
|
47591
47669
|
bb1: {
|
|
47592
47670
|
if (!audioEngine) {
|
|
47593
|
-
|
|
47671
|
+
t18 = null;
|
|
47594
47672
|
break bb1;
|
|
47595
47673
|
}
|
|
47596
47674
|
var result;
|
|
47597
|
-
if ($[
|
|
47675
|
+
if ($[60] !== audioEngine.audioContext || $[61] !== audioEngine.source) {
|
|
47598
47676
|
result = audioEngine.audioContext.createAnalyser();
|
|
47599
47677
|
audioEngine.source.connect(audioEngine.audioContext.destination);
|
|
47600
47678
|
audioEngine.source.connect(result);
|
|
47601
|
-
$[
|
|
47602
|
-
$[
|
|
47603
|
-
$[
|
|
47679
|
+
$[60] = audioEngine.audioContext;
|
|
47680
|
+
$[61] = audioEngine.source;
|
|
47681
|
+
$[62] = result;
|
|
47604
47682
|
} else {
|
|
47605
|
-
result = $[
|
|
47683
|
+
result = $[62];
|
|
47606
47684
|
}
|
|
47607
|
-
|
|
47685
|
+
t18 = result;
|
|
47608
47686
|
}
|
|
47609
|
-
var visualizationAnalyser =
|
|
47610
|
-
var
|
|
47611
|
-
|
|
47612
|
-
var isPending =
|
|
47613
|
-
var
|
|
47614
|
-
if ($[
|
|
47615
|
-
|
|
47687
|
+
var visualizationAnalyser = t18;
|
|
47688
|
+
var t19;
|
|
47689
|
+
t19 = isPlaying || unplayedMessageSentences.length > 0 || ((_latestMessageProps$l5 = latestMessageProps.latestMessage) === null || _latestMessageProps$l5 === void 0 ? void 0 : _latestMessageProps$l5.status) === "in_progress";
|
|
47690
|
+
var isPending = t19;
|
|
47691
|
+
var t20;
|
|
47692
|
+
if ($[63] !== audioPlayer || $[64] !== isAudioPlayed || $[65] !== isPending || $[66] !== visualizationAnalyser) {
|
|
47693
|
+
t20 = _objectSpread47(_objectSpread47({
|
|
47616
47694
|
isPending: isPending,
|
|
47617
47695
|
isAudioPlayed: isAudioPlayed
|
|
47618
47696
|
}, audioPlayer), {}, {
|
|
47619
47697
|
visualizationAnalyser: visualizationAnalyser
|
|
47620
47698
|
});
|
|
47621
|
-
$[
|
|
47622
|
-
$[
|
|
47623
|
-
$[
|
|
47624
|
-
$[
|
|
47625
|
-
$[
|
|
47699
|
+
$[63] = audioPlayer;
|
|
47700
|
+
$[64] = isAudioPlayed;
|
|
47701
|
+
$[65] = isPending;
|
|
47702
|
+
$[66] = visualizationAnalyser;
|
|
47703
|
+
$[67] = t20;
|
|
47626
47704
|
} else {
|
|
47627
|
-
|
|
47705
|
+
t20 = $[67];
|
|
47628
47706
|
}
|
|
47629
|
-
return
|
|
47707
|
+
return t20;
|
|
47630
47708
|
};
|
|
47631
47709
|
function _temp9() {
|
|
47632
47710
|
if (isHtmlAudioSupported) {
|
|
@@ -48131,20 +48209,20 @@ var Root16 = function(t0) {
|
|
|
48131
48209
|
};
|
|
48132
48210
|
// src/components/threads/AudioThread/Visualization/index.tsx
|
|
48133
48211
|
import { c as _c93 } from "react-compiler-runtime";
|
|
48134
|
-
import { useState as useState11, useCallback as
|
|
48212
|
+
import { useState as useState11, useCallback as useCallback9, useEffect as useEffect12, useContext as useContext20, createContext as createContext14 } from "react";
|
|
48135
48213
|
import _9 from "lodash";
|
|
48136
48214
|
import { Flex as Flex31 } from "@radix-ui/themes";
|
|
48137
48215
|
// src/components/threads/AudioThread/BarsVisualizer/index.tsx
|
|
48138
48216
|
import _8 from "lodash";
|
|
48139
48217
|
import { Flex as Flex30, Grid } from "@radix-ui/themes";
|
|
48140
|
-
import { useState as useState10, useEffect as useEffect11, useCallback as
|
|
48218
|
+
import { useState as useState10, useEffect as useEffect11, useCallback as useCallback8 } from "react";
|
|
48141
48219
|
import { cluster } from "radash";
|
|
48142
48220
|
import { jsx as _jsx89 } from "react/jsx-runtime";
|
|
48143
48221
|
var barCount = 4;
|
|
48144
48222
|
var BarsVisualizer = function(_ref) {
|
|
48145
48223
|
var visualizationAnalyser = _ref.visualizationAnalyser, backgroundColor = _ref.backgroundColor, height = _ref.height, barWidth = _ref.barWidth;
|
|
48146
48224
|
var _useState10 = _sliced_to_array(useState10([]), 2), barHeights = _useState10[0], setBarHeights = _useState10[1];
|
|
48147
|
-
var draw =
|
|
48225
|
+
var draw = useCallback8(function(_ref2) {
|
|
48148
48226
|
var visualizationAnalyser_0 = _ref2.visualizationAnalyser;
|
|
48149
48227
|
if (!visualizationAnalyser_0) {
|
|
48150
48228
|
setBarHeights(Array(barCount).fill(0));
|
|
@@ -48331,7 +48409,7 @@ var Provider6 = function(_ref) {
|
|
|
48331
48409
|
var children = _ref.children;
|
|
48332
48410
|
var audioThreadContext = useAudioThreadContext();
|
|
48333
48411
|
var _useState11 = _sliced_to_array(useState11(0), 2), scale = _useState11[0], setScale = _useState11[1];
|
|
48334
|
-
var draw =
|
|
48412
|
+
var draw = useCallback9(function(_ref2) {
|
|
48335
48413
|
var visualizationAnalyser = _ref2.visualizationAnalyser;
|
|
48336
48414
|
if (!visualizationAnalyser) {
|
|
48337
48415
|
setScale(1);
|