@oxvo/ai-live-assist 7.4.50 → 7.5.0
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/cjs/AiLiveAssist.d.ts +76 -11
- package/cjs/AiLiveAssist.js +1771 -298
- package/cjs/client.d.ts +19 -0
- package/cjs/client.js +51 -0
- package/cjs/context.d.ts +23 -1
- package/cjs/context.js +713 -126
- package/cjs/control.d.ts +2 -0
- package/cjs/control.js +42 -3
- package/cjs/ctaOffer.d.ts +11 -0
- package/cjs/ctaOffer.js +185 -0
- package/cjs/dialogFocusScope.js +1 -1
- package/cjs/guideAdmission.d.ts +46 -0
- package/cjs/guideAdmission.js +397 -0
- package/cjs/guideHost.d.ts +47 -0
- package/cjs/guideHost.js +48 -0
- package/cjs/guideInstallation.d.ts +12 -0
- package/cjs/guideInstallation.js +60 -0
- package/cjs/guideInstaller.d.ts +4 -0
- package/cjs/guideInstaller.js +116 -0
- package/cjs/guideMount.d.ts +22 -0
- package/cjs/guideMount.js +84 -0
- package/cjs/guideRecording.d.ts +64 -0
- package/cjs/guideRecording.js +176 -0
- package/cjs/guideRecordingSession.d.ts +35 -0
- package/cjs/guideRecordingSession.js +167 -0
- package/cjs/guideSubjectStore.d.ts +32 -0
- package/cjs/guideSubjectStore.js +105 -0
- package/cjs/guideTypes.d.ts +117 -0
- package/cjs/guideTypes.js +15 -0
- package/cjs/index.d.ts +6 -0
- package/cjs/index.js +25 -11
- package/cjs/liveAudioProcessor.d.ts +92 -0
- package/cjs/liveAudioProcessor.js +269 -0
- package/cjs/liveAudioQueue.d.ts +40 -0
- package/cjs/liveAudioQueue.js +130 -0
- package/cjs/liveAudioWorklet.d.ts +1 -0
- package/cjs/liveAudioWorklet.js +63 -0
- package/cjs/liveBrowserDetector.d.ts +16 -0
- package/cjs/liveBrowserDetector.js +75 -0
- package/cjs/liveBrowserDetectorWorker.d.ts +1 -0
- package/cjs/liveBrowserDetectorWorker.js +72 -0
- package/cjs/liveControlChannel.d.ts +176 -0
- package/cjs/liveControlChannel.js +829 -0
- package/cjs/liveDuplexMedia.d.ts +204 -0
- package/cjs/liveDuplexMedia.js +740 -0
- package/cjs/liveGuideAdmission.d.ts +21 -0
- package/cjs/liveGuideAdmission.js +94 -0
- package/cjs/liveGuideWidget.d.ts +68 -0
- package/cjs/liveGuideWidget.js +451 -0
- package/cjs/liveSpeechAssets.d.ts +36 -0
- package/cjs/liveSpeechAssets.js +39 -0
- package/cjs/liveSpeechCaptureBridge.d.ts +32 -0
- package/cjs/liveSpeechCaptureBridge.js +140 -0
- package/cjs/liveSpeechDetector.d.ts +62 -0
- package/cjs/liveSpeechDetector.js +206 -0
- package/cjs/liveSpeechModel.d.ts +46 -0
- package/cjs/liveSpeechModel.js +105 -0
- package/cjs/liveSpeechResampler.d.ts +22 -0
- package/cjs/liveSpeechResampler.js +93 -0
- package/cjs/liveSpeechWorker.d.ts +56 -0
- package/cjs/liveSpeechWorker.js +143 -0
- package/cjs/locales/resources.js +568 -8
- package/cjs/media.d.ts +11 -0
- package/cjs/media.js +78 -9
- package/cjs/messages.js +22 -8
- package/cjs/pageAssistancePreference.d.ts +15 -3
- package/cjs/pageAssistancePreference.js +46 -7
- package/cjs/preview.d.ts +4 -1
- package/cjs/preview.js +42 -1
- package/cjs/recording.d.ts +12 -0
- package/cjs/recording.js +150 -0
- package/cjs/standalone.d.ts +6 -0
- package/cjs/standalone.js +12 -0
- package/cjs/types.d.ts +31 -5
- package/cjs/types.js +14 -0
- package/cjs/ui.d.ts +128 -4
- package/cjs/ui.js +1918 -276
- package/cjs/version.d.ts +1 -1
- package/cjs/version.js +1 -1
- package/cjs/voicePresenceUi.d.ts +52 -4
- package/cjs/voicePresenceUi.js +659 -57
- package/lib/AiLiveAssist.d.ts +76 -11
- package/lib/AiLiveAssist.js +1772 -299
- package/lib/client.d.ts +19 -0
- package/lib/client.js +51 -0
- package/lib/context.d.ts +23 -1
- package/lib/context.js +713 -126
- package/lib/control.d.ts +2 -0
- package/lib/control.js +42 -3
- package/lib/ctaOffer.d.ts +11 -0
- package/lib/ctaOffer.js +179 -0
- package/lib/dialogFocusScope.js +1 -1
- package/lib/guideAdmission.d.ts +46 -0
- package/lib/guideAdmission.js +392 -0
- package/lib/guideHost.d.ts +47 -0
- package/lib/guideHost.js +42 -0
- package/lib/guideInstallation.d.ts +12 -0
- package/lib/guideInstallation.js +56 -0
- package/lib/guideInstaller.d.ts +4 -0
- package/lib/guideInstaller.js +113 -0
- package/lib/guideMount.d.ts +22 -0
- package/lib/guideMount.js +77 -0
- package/lib/guideRecording.d.ts +64 -0
- package/lib/guideRecording.js +172 -0
- package/lib/guideRecordingSession.d.ts +35 -0
- package/lib/guideRecordingSession.js +163 -0
- package/lib/guideSubjectStore.d.ts +32 -0
- package/lib/guideSubjectStore.js +101 -0
- package/lib/guideTypes.d.ts +117 -0
- package/lib/guideTypes.js +11 -0
- package/lib/index.d.ts +6 -0
- package/lib/index.js +21 -10
- package/lib/liveAudioProcessor.d.ts +92 -0
- package/lib/liveAudioProcessor.js +265 -0
- package/lib/liveAudioQueue.d.ts +40 -0
- package/lib/liveAudioQueue.js +126 -0
- package/lib/liveAudioWorklet.d.ts +1 -0
- package/lib/liveAudioWorklet.js +61 -0
- package/lib/liveBrowserDetector.d.ts +16 -0
- package/lib/liveBrowserDetector.js +71 -0
- package/lib/liveBrowserDetectorWorker.d.ts +1 -0
- package/lib/liveBrowserDetectorWorker.js +70 -0
- package/lib/liveControlChannel.d.ts +176 -0
- package/lib/liveControlChannel.js +825 -0
- package/lib/liveDuplexMedia.d.ts +204 -0
- package/lib/liveDuplexMedia.js +736 -0
- package/lib/liveGuideAdmission.d.ts +21 -0
- package/lib/liveGuideAdmission.js +90 -0
- package/lib/liveGuideWidget.d.ts +68 -0
- package/lib/liveGuideWidget.js +447 -0
- package/lib/liveSpeechAssets.d.ts +36 -0
- package/lib/liveSpeechAssets.js +35 -0
- package/lib/liveSpeechCaptureBridge.d.ts +32 -0
- package/lib/liveSpeechCaptureBridge.js +136 -0
- package/lib/liveSpeechDetector.d.ts +62 -0
- package/lib/liveSpeechDetector.js +202 -0
- package/lib/liveSpeechModel.d.ts +46 -0
- package/lib/liveSpeechModel.js +101 -0
- package/lib/liveSpeechResampler.d.ts +22 -0
- package/lib/liveSpeechResampler.js +89 -0
- package/lib/liveSpeechWorker.d.ts +56 -0
- package/lib/liveSpeechWorker.js +137 -0
- package/lib/locales/resources.js +568 -8
- package/lib/media.d.ts +11 -0
- package/lib/media.js +77 -8
- package/lib/messages.js +22 -8
- package/lib/pageAssistancePreference.d.ts +15 -3
- package/lib/pageAssistancePreference.js +46 -7
- package/lib/preview.d.ts +4 -1
- package/lib/preview.js +42 -1
- package/lib/recording.d.ts +12 -0
- package/lib/recording.js +146 -0
- package/lib/standalone.d.ts +6 -0
- package/lib/standalone.js +6 -0
- package/lib/types.d.ts +31 -5
- package/lib/types.js +14 -0
- package/lib/ui.d.ts +128 -4
- package/lib/ui.js +1919 -277
- package/lib/version.d.ts +1 -1
- package/lib/version.js +1 -1
- package/lib/voicePresenceUi.d.ts +52 -4
- package/lib/voicePresenceUi.js +659 -57
- package/package.json +16 -1
package/cjs/ui.js
CHANGED
|
@@ -4,6 +4,7 @@ exports.WidgetView = void 0;
|
|
|
4
4
|
const lucide_1 = require("lucide");
|
|
5
5
|
const avatarUrl_js_1 = require("./avatarUrl.js");
|
|
6
6
|
const dialogFocusScope_js_1 = require("./dialogFocusScope.js");
|
|
7
|
+
const ctaOffer_js_1 = require("./ctaOffer.js");
|
|
7
8
|
const index_js_1 = require("./locales/index.js");
|
|
8
9
|
const PANEL_POSITION_KEY = "__oxvo_ai_live_assist_compact_voice_position_v2";
|
|
9
10
|
const LEGACY_PANEL_POSITION_KEY = "__oxvo_ai_live_assist_panel_position_v1";
|
|
@@ -13,7 +14,21 @@ const SESSION_START_KEY = "__oxvo_ai_live_assist_session_start_v1";
|
|
|
13
14
|
const COMPACT_CAPTION_LIFETIME_MS = 8000;
|
|
14
15
|
const COMPACT_CAPTION_EXIT_MS = 350;
|
|
15
16
|
const CAPTION_HEIGHT_GLIDE_MS = 250;
|
|
17
|
+
const CAPTION_BOTTOM_PIN_THRESHOLD_PX = 16;
|
|
16
18
|
const ASSISTANT_READY_VISUAL_GRACE_MS = 1200;
|
|
19
|
+
const REMOTE_PLAYBACK_START_TIMEOUT_MS = 2000;
|
|
20
|
+
const REMOTE_AUDIO_EVIDENCE_SAMPLE_MS = 50;
|
|
21
|
+
const REMOTE_AUDIO_EVIDENCE_RECHECK_MS = 250;
|
|
22
|
+
const REMOTE_AUDIO_EVIDENCE_IDLE_RECHECK_MS = 1000;
|
|
23
|
+
const REMOTE_AUDIO_EVIDENCE_ATTACK_WINDOW = 3;
|
|
24
|
+
const REMOTE_AUDIO_EVIDENCE_ATTACK_HITS = 2;
|
|
25
|
+
const REMOTE_AUDIO_EVIDENCE_ATTACK_RMS = 0.006;
|
|
26
|
+
const REMOTE_AUDIO_EVIDENCE_ATTACK_PEAK = 0.025;
|
|
27
|
+
const REMOTE_AUDIO_EVIDENCE_SUSTAIN_RMS = 0.0025;
|
|
28
|
+
const REMOTE_AUDIO_EVIDENCE_SUSTAIN_PEAK = 0.012;
|
|
29
|
+
const REMOTE_AUDIO_EVIDENCE_RELEASE_MS = 650;
|
|
30
|
+
const REMOTE_AUDIO_EVIDENCE_READY_TAIL_MS = 5000;
|
|
31
|
+
const REMOTE_AUDIO_EVIDENCE_EXPECTATION_MS = 15000;
|
|
17
32
|
const FEEDBACK_EXIT_FADE_MS = 180;
|
|
18
33
|
const AMBIENT_IDLE_GRACE_MS = 700;
|
|
19
34
|
const VOICE_CARD_EFFECT_SETTLE_MS = 720;
|
|
@@ -108,6 +123,7 @@ const style = `
|
|
|
108
123
|
--brand-mark-border: rgba(255, 255, 255, .8);
|
|
109
124
|
--surface-material-plane: 0;
|
|
110
125
|
--surface-content-plane: 10;
|
|
126
|
+
--intro-action-width: 76px;
|
|
111
127
|
--skel: rgba(255, 255, 255, .55);
|
|
112
128
|
--shimmer: rgba(255, 255, 255, .75);
|
|
113
129
|
}
|
|
@@ -967,6 +983,11 @@ const style = `
|
|
|
967
983
|
.identity strong { color: var(--assist-text); font-size: 14px; font-weight: 600; line-height: 19px; }
|
|
968
984
|
.identity span { margin-top: 2px; color: var(--assist-muted); font-size: 11px; line-height: 15px; }
|
|
969
985
|
.header-actions { display: flex; align-items: center; gap: 6px; }
|
|
986
|
+
.header-push[aria-pressed="true"] {
|
|
987
|
+
color: #d9a1f5;
|
|
988
|
+
background: color-mix(in srgb, var(--accent) 16%, var(--glass-control-background));
|
|
989
|
+
border-color: color-mix(in srgb, var(--accent) 34%, var(--glass-control-border));
|
|
990
|
+
}
|
|
970
991
|
.panel.open:not(.compact) .header {
|
|
971
992
|
min-height: 58px;
|
|
972
993
|
padding: 0 2px 12px;
|
|
@@ -1061,6 +1082,12 @@ const style = `
|
|
|
1061
1082
|
box-shadow: none;
|
|
1062
1083
|
animation: none;
|
|
1063
1084
|
}
|
|
1085
|
+
.panel.active-session.compact:is(.voice-session, .starting-voice) .header {
|
|
1086
|
+
box-shadow:
|
|
1087
|
+
-2px 1px 6px rgba(207, 48, 170, .18),
|
|
1088
|
+
2px 1px 6px rgba(64, 47, 181, .2),
|
|
1089
|
+
0 3px 5px rgba(15, 8, 31, .14);
|
|
1090
|
+
}
|
|
1064
1091
|
.panel.active-session.compact:is(.voice-session, .starting-voice) .header::before,
|
|
1065
1092
|
.panel.active-session.compact:is(.voice-session, .starting-voice) .header::after {
|
|
1066
1093
|
content: none;
|
|
@@ -1120,9 +1147,11 @@ const style = `
|
|
|
1120
1147
|
line-height: 1.25;
|
|
1121
1148
|
}
|
|
1122
1149
|
.panel.active-session.compact:is(.voice-session, .starting-voice) .identity span {
|
|
1123
|
-
|
|
1124
|
-
|
|
1125
|
-
|
|
1150
|
+
position: relative;
|
|
1151
|
+
display: block;
|
|
1152
|
+
box-sizing: border-box;
|
|
1153
|
+
min-width: 0;
|
|
1154
|
+
padding-inline-start: 10px;
|
|
1126
1155
|
margin: 0;
|
|
1127
1156
|
color: #cdb8e6;
|
|
1128
1157
|
font-family: Poppins, system-ui, "Segoe UI", sans-serif;
|
|
@@ -1131,6 +1160,9 @@ const style = `
|
|
|
1131
1160
|
}
|
|
1132
1161
|
.panel.active-session.compact:is(.voice-session, .starting-voice) .identity span::before {
|
|
1133
1162
|
content: "";
|
|
1163
|
+
position: absolute;
|
|
1164
|
+
inset-inline-start: 0;
|
|
1165
|
+
top: calc(50% - 2.5px);
|
|
1134
1166
|
width: 5px;
|
|
1135
1167
|
height: 5px;
|
|
1136
1168
|
flex: none;
|
|
@@ -1147,7 +1179,7 @@ const style = `
|
|
|
1147
1179
|
.panel.active-session.compact:is(.voice-session, .starting-voice) .header-actions { gap: 5px; }
|
|
1148
1180
|
.panel.active-session.compact:is(.voice-session, .starting-voice):focus-within { outline: 1px solid rgba(160, 153, 216, .55); outline-offset: 3px; }
|
|
1149
1181
|
:host([data-input-glow="false"]) .panel.active-session.compact:is(.voice-session, .starting-voice) > .voice-card-fx { display: none !important; }
|
|
1150
|
-
:host([data-input-glow="false"]) .panel.active-session.compact:is(.voice-session, .starting-voice) .header { background: #010201; border: 1px solid #302a3c; }
|
|
1182
|
+
:host([data-input-glow="false"]) .panel.active-session.compact:is(.voice-session, .starting-voice) .header { background: #010201; border: 1px solid #302a3c; box-shadow: none; }
|
|
1151
1183
|
.panel.active-session.compact:is(.voice-session, .starting-voice) .compact-captions {
|
|
1152
1184
|
inset-inline-start: 0;
|
|
1153
1185
|
inset-inline-end: auto;
|
|
@@ -1276,7 +1308,7 @@ const style = `
|
|
|
1276
1308
|
border: 0;
|
|
1277
1309
|
border-radius: 999px;
|
|
1278
1310
|
box-shadow: none;
|
|
1279
|
-
pointer-events:
|
|
1311
|
+
pointer-events: auto;
|
|
1280
1312
|
}
|
|
1281
1313
|
.panel.open.compact.ending-state > :not(.compact-error-notice) {
|
|
1282
1314
|
display: none !important;
|
|
@@ -1308,6 +1340,26 @@ const style = `
|
|
|
1308
1340
|
overflow-wrap: anywhere;
|
|
1309
1341
|
animation: terminal-progress-in .2s ease-out both;
|
|
1310
1342
|
}
|
|
1343
|
+
.compact-ending-dismiss {
|
|
1344
|
+
display: none;
|
|
1345
|
+
}
|
|
1346
|
+
.panel.open.compact.ending-state .compact-ending-dismiss {
|
|
1347
|
+
display: inline-grid;
|
|
1348
|
+
width: 28px;
|
|
1349
|
+
min-width: 28px;
|
|
1350
|
+
min-height: 28px;
|
|
1351
|
+
flex: 0 0 28px;
|
|
1352
|
+
place-items: center;
|
|
1353
|
+
padding: 0;
|
|
1354
|
+
color: var(--assist-text);
|
|
1355
|
+
background: color-mix(in srgb, var(--assist-surface) 82%, transparent);
|
|
1356
|
+
border: 1px solid color-mix(in srgb, var(--assist-text) 16%, transparent);
|
|
1357
|
+
border-radius: 50%;
|
|
1358
|
+
pointer-events: auto;
|
|
1359
|
+
}
|
|
1360
|
+
.panel.open.compact.ending-state .compact-ending-dismiss:hover {
|
|
1361
|
+
background: var(--assist-surface-muted);
|
|
1362
|
+
}
|
|
1311
1363
|
.panel.open.compact.ending-state .compact-error-notice-icon {
|
|
1312
1364
|
width: 18px;
|
|
1313
1365
|
height: 18px;
|
|
@@ -1343,7 +1395,7 @@ const style = `
|
|
|
1343
1395
|
line-height: 1;
|
|
1344
1396
|
font-variant-numeric: tabular-nums;
|
|
1345
1397
|
}
|
|
1346
|
-
.end, .restart, .view-toggle, .compact-mute, .close {
|
|
1398
|
+
.end, .restart, .view-toggle, .header-push, .compact-mute, .close {
|
|
1347
1399
|
display: inline-grid;
|
|
1348
1400
|
width: 34px;
|
|
1349
1401
|
min-width: 34px;
|
|
@@ -1405,12 +1457,12 @@ const style = `
|
|
|
1405
1457
|
opacity: 1;
|
|
1406
1458
|
visibility: visible;
|
|
1407
1459
|
}
|
|
1408
|
-
.restart, .view-toggle, .compact-mute, .close {
|
|
1460
|
+
.restart, .view-toggle, .header-push, .compact-mute, .close {
|
|
1409
1461
|
color: var(--assist-text);
|
|
1410
1462
|
background: var(--assist-surface);
|
|
1411
1463
|
border: 1px solid var(--assist-border);
|
|
1412
1464
|
}
|
|
1413
|
-
.restart:hover, .view-toggle:hover, .compact-mute:hover, .close:hover { background: var(--assist-surface-muted); }
|
|
1465
|
+
.restart:hover, .view-toggle:hover, .header-push:hover, .compact-mute:hover, .close:hover { background: var(--assist-surface-muted); }
|
|
1414
1466
|
.button-icon, .menu-icon, .turn-icon {
|
|
1415
1467
|
display: inline-grid;
|
|
1416
1468
|
flex: 0 0 auto;
|
|
@@ -1734,6 +1786,10 @@ const style = `
|
|
|
1734
1786
|
opacity: .4;
|
|
1735
1787
|
}
|
|
1736
1788
|
.intro-effect-glow {
|
|
1789
|
+
-webkit-mask-image: radial-gradient(ellipse at center, #000 0%, rgba(0, 0, 0, .92) 42%, transparent 78%);
|
|
1790
|
+
mask-image: radial-gradient(ellipse at center, #000 0%, rgba(0, 0, 0, .92) 42%, transparent 78%);
|
|
1791
|
+
-webkit-mask-repeat: no-repeat;
|
|
1792
|
+
mask-repeat: no-repeat;
|
|
1737
1793
|
opacity: .1;
|
|
1738
1794
|
}
|
|
1739
1795
|
.intro-effect-glow::before,
|
|
@@ -1741,6 +1797,21 @@ const style = `
|
|
|
1741
1797
|
--effect-rest-angle: 60deg;
|
|
1742
1798
|
width: 999px;
|
|
1743
1799
|
height: 999px;
|
|
1800
|
+
filter: none;
|
|
1801
|
+
transform: translate(-50%, -50%) rotate(60deg);
|
|
1802
|
+
animation: none;
|
|
1803
|
+
}
|
|
1804
|
+
.intro-effect-glow::before {
|
|
1805
|
+
background-image: conic-gradient(
|
|
1806
|
+
transparent,
|
|
1807
|
+
#402fb5 5%,
|
|
1808
|
+
transparent 38%,
|
|
1809
|
+
transparent 50%,
|
|
1810
|
+
#cf30aa 60%,
|
|
1811
|
+
transparent 87%
|
|
1812
|
+
);
|
|
1813
|
+
}
|
|
1814
|
+
.composer-effect-glow::before {
|
|
1744
1815
|
background-image: conic-gradient(
|
|
1745
1816
|
#000,
|
|
1746
1817
|
#402fb5 5%,
|
|
@@ -1749,12 +1820,21 @@ const style = `
|
|
|
1749
1820
|
#cf30aa 60%,
|
|
1750
1821
|
#000 87%
|
|
1751
1822
|
);
|
|
1752
|
-
filter: none;
|
|
1753
|
-
transform: translate(-50%, -50%) rotate(60deg);
|
|
1754
|
-
animation: none;
|
|
1755
1823
|
}
|
|
1756
1824
|
.intro-effect-glow::after,
|
|
1757
1825
|
.composer-effect-glow::after { content: none; }
|
|
1826
|
+
.intro:not([data-primary-motion]) .intro-composer-frame:not(.omago-transition-source) > .intro-effect-glow,
|
|
1827
|
+
.panel:not(.mode-surface-transition-clone):not(.panel-transition-compact-clone):not(.primary-surface-transition-clone) > .compact-chat-card:not(.mode-surface-transition-clone) > .intro-effect-glow,
|
|
1828
|
+
.panel.active-session.compact:not(.panel-transition-compact-clone):is(.voice-session, .starting-voice) > .voice-card-fx.intro-effect-glow {
|
|
1829
|
+
display: none !important;
|
|
1830
|
+
}
|
|
1831
|
+
.intro:not([data-primary-motion]) .intro-composer-frame:not(.omago-transition-source),
|
|
1832
|
+
.panel:not(.mode-surface-transition-clone):not(.panel-transition-compact-clone):not(.primary-surface-transition-clone) > .compact-chat-card:not(.mode-surface-transition-clone) {
|
|
1833
|
+
box-shadow:
|
|
1834
|
+
-2px 1px 6px rgba(207, 48, 170, .18),
|
|
1835
|
+
2px 1px 6px rgba(64, 47, 181, .2),
|
|
1836
|
+
0 3px 5px rgba(15, 8, 31, .14);
|
|
1837
|
+
}
|
|
1758
1838
|
.intro-effect-dark,
|
|
1759
1839
|
.composer-effect-dark {
|
|
1760
1840
|
width: calc(100% + 11px);
|
|
@@ -2177,6 +2257,10 @@ const style = `
|
|
|
2177
2257
|
outline-offset: -1px;
|
|
2178
2258
|
box-shadow: none;
|
|
2179
2259
|
}
|
|
2260
|
+
:host([data-input-glow="false"]) .intro:not([data-primary-motion]) .intro-composer-frame:not(.omago-transition-source),
|
|
2261
|
+
:host([data-input-glow="false"]) .panel:not(.mode-surface-transition-clone):not(.panel-transition-compact-clone):not(.primary-surface-transition-clone) > .compact-chat-card:not(.mode-surface-transition-clone) {
|
|
2262
|
+
box-shadow: none;
|
|
2263
|
+
}
|
|
2180
2264
|
:host([data-input-glow="false"]) .intro-composer-frame[data-minimized="true"] {
|
|
2181
2265
|
border: 0;
|
|
2182
2266
|
outline: 1px solid #302a3c;
|
|
@@ -2187,7 +2271,7 @@ const style = `
|
|
|
2187
2271
|
z-index: var(--surface-content-plane);
|
|
2188
2272
|
grid-area: 1 / 1;
|
|
2189
2273
|
display: grid;
|
|
2190
|
-
grid-template-columns: minmax(0, 1fr)
|
|
2274
|
+
grid-template-columns: minmax(0, 1fr) var(--intro-action-width) 0px;
|
|
2191
2275
|
width: calc(100% - 3px);
|
|
2192
2276
|
min-width: 0;
|
|
2193
2277
|
height: 44px;
|
|
@@ -2203,12 +2287,15 @@ const style = `
|
|
|
2203
2287
|
border-radius: 10px;
|
|
2204
2288
|
box-shadow: none;
|
|
2205
2289
|
overflow: visible;
|
|
2290
|
+
}
|
|
2291
|
+
.intro-composer-frame > .intro-composer {
|
|
2206
2292
|
transition:
|
|
2207
2293
|
grid-template-columns .28s cubic-bezier(.2, .8, .2, 1),
|
|
2208
2294
|
opacity .18s ease;
|
|
2209
2295
|
}
|
|
2210
2296
|
.intro-entry[data-has-draft="true"] .intro-composer {
|
|
2211
|
-
grid-template-columns:
|
|
2297
|
+
grid-template-columns:
|
|
2298
|
+
minmax(0, 1fr) var(--intro-action-width) var(--intro-action-width);
|
|
2212
2299
|
}
|
|
2213
2300
|
.intro-entry[data-text-enabled="false"] .intro-composer {
|
|
2214
2301
|
grid-template-columns: auto;
|
|
@@ -2280,7 +2367,7 @@ const style = `
|
|
|
2280
2367
|
outline: 0;
|
|
2281
2368
|
caret-color: #fff;
|
|
2282
2369
|
text-overflow: ellipsis;
|
|
2283
|
-
font-size:
|
|
2370
|
+
font-size: 12px;
|
|
2284
2371
|
font-weight: 400;
|
|
2285
2372
|
line-height: 22px;
|
|
2286
2373
|
}
|
|
@@ -2319,7 +2406,8 @@ const style = `
|
|
|
2319
2406
|
.intro-voice {
|
|
2320
2407
|
grid-column: 2;
|
|
2321
2408
|
gap: 6px;
|
|
2322
|
-
|
|
2409
|
+
width: var(--intro-action-width);
|
|
2410
|
+
min-width: var(--intro-action-width);
|
|
2323
2411
|
padding: 0 10px;
|
|
2324
2412
|
border-radius: 8px;
|
|
2325
2413
|
font-size: 12px;
|
|
@@ -2337,7 +2425,8 @@ const style = `
|
|
|
2337
2425
|
}
|
|
2338
2426
|
.intro-send {
|
|
2339
2427
|
grid-column: 3;
|
|
2340
|
-
width
|
|
2428
|
+
/* The animated grid track owns the width, including interrupted exits. */
|
|
2429
|
+
width: 100%;
|
|
2341
2430
|
min-width: 0;
|
|
2342
2431
|
padding: 0;
|
|
2343
2432
|
background: linear-gradient(135deg, var(--oxvo-iris-violet), var(--oxvo-iris-magenta));
|
|
@@ -2346,21 +2435,16 @@ const style = `
|
|
|
2346
2435
|
opacity: 0;
|
|
2347
2436
|
overflow: hidden;
|
|
2348
2437
|
pointer-events: none;
|
|
2349
|
-
|
|
2438
|
+
transition: opacity .22s ease, border-color .22s ease, background-color .22s ease;
|
|
2350
2439
|
}
|
|
2351
|
-
:host([dir="rtl"]) .intro-send { transform: translateX(-5px) scale(.82); }
|
|
2352
2440
|
.intro-send.is-visible {
|
|
2353
|
-
width: 44px;
|
|
2354
|
-
min-width: 44px;
|
|
2355
2441
|
opacity: 1;
|
|
2356
2442
|
overflow: visible;
|
|
2357
2443
|
pointer-events: auto;
|
|
2358
|
-
transform: translateX(0) scale(1);
|
|
2359
2444
|
}
|
|
2360
2445
|
.intro-send.is-visible:hover,
|
|
2361
2446
|
.intro-send.is-visible:focus-visible {
|
|
2362
2447
|
filter: brightness(1.12);
|
|
2363
|
-
transform: translateX(0) scale(1.04);
|
|
2364
2448
|
}
|
|
2365
2449
|
.intro-entry[aria-busy="true"] { opacity: .58; }
|
|
2366
2450
|
.intro-entry input:disabled, .intro-entry button:disabled { cursor: not-allowed; }
|
|
@@ -2388,7 +2472,7 @@ const style = `
|
|
|
2388
2472
|
.legal-overlay {
|
|
2389
2473
|
position: absolute;
|
|
2390
2474
|
inset: 0;
|
|
2391
|
-
z-index:
|
|
2475
|
+
z-index: calc(var(--surface-content-plane) + 2);
|
|
2392
2476
|
display: grid;
|
|
2393
2477
|
place-items: center;
|
|
2394
2478
|
padding: 14px;
|
|
@@ -2410,119 +2494,178 @@ const style = `
|
|
|
2410
2494
|
.legal-close { display: inline-grid; width: 44px; min-width: 44px; min-height: 44px; place-items: center; padding: 0; color: #4b5563; background: white; border: 1px solid var(--assist-border); }
|
|
2411
2495
|
.legal-dialog p { margin: 10px 0; color: #4b5563; font-size: 11px; line-height: 17px; }
|
|
2412
2496
|
.legal-dialog ul { display: grid; gap: 6px; margin: 10px 0; padding-inline-start: 18px; color: #374151; font-size: 11px; line-height: 16px; }
|
|
2497
|
+
.recording-consent { display: flex; align-items: flex-start; gap: 8px; margin: 10px 0; font-size: 11px; line-height: 16px; text-align: start; }
|
|
2498
|
+
.recording-consent[hidden] { display: none; }
|
|
2499
|
+
.recording-consent input { flex: 0 0 auto; margin-top: 3px; accent-color: var(--accent); }
|
|
2500
|
+
.recording-consent strong, .recording-consent small { display: block; font-size: inherit; }
|
|
2413
2501
|
.legal-links { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 12px; }
|
|
2414
2502
|
.legal-links a { color: #185ea8; font-size: 11px; font-weight: 600; }
|
|
2503
|
+
.legal-revoke {
|
|
2504
|
+
display: inline-flex;
|
|
2505
|
+
align-items: center;
|
|
2506
|
+
gap: 8px;
|
|
2507
|
+
width: 100%;
|
|
2508
|
+
min-height: 38px;
|
|
2509
|
+
margin-top: 14px;
|
|
2510
|
+
justify-content: center;
|
|
2511
|
+
}
|
|
2415
2512
|
.page-assistance-overlay {
|
|
2416
|
-
position:
|
|
2417
|
-
|
|
2418
|
-
z-index:
|
|
2513
|
+
position: absolute;
|
|
2514
|
+
inset: 8px;
|
|
2515
|
+
z-index: 12;
|
|
2419
2516
|
display: grid;
|
|
2420
|
-
width:
|
|
2421
|
-
height:
|
|
2517
|
+
width: auto;
|
|
2518
|
+
height: auto;
|
|
2422
2519
|
min-width: 0;
|
|
2423
2520
|
min-height: 0;
|
|
2424
|
-
place-items:
|
|
2425
|
-
padding:
|
|
2426
|
-
background:
|
|
2427
|
-
radial-gradient(80% 52% at 50% 100%, color-mix(in srgb, var(--accent) 9%, transparent), transparent 72%),
|
|
2428
|
-
color-mix(in srgb, var(--assist-surface) 48%, transparent);
|
|
2521
|
+
place-items: center;
|
|
2522
|
+
padding: 8px;
|
|
2523
|
+
background: color-mix(in srgb, var(--assist-surface) 48%, transparent);
|
|
2429
2524
|
border-radius: 18px;
|
|
2430
2525
|
overflow: hidden;
|
|
2431
2526
|
overscroll-behavior: contain;
|
|
2432
|
-
-webkit-backdrop-filter: blur(
|
|
2433
|
-
backdrop-filter: blur(
|
|
2434
|
-
animation: page-assistance-backdrop-in .
|
|
2527
|
+
-webkit-backdrop-filter: blur(6px);
|
|
2528
|
+
backdrop-filter: blur(6px);
|
|
2529
|
+
animation: page-assistance-backdrop-in .18s ease-out both;
|
|
2435
2530
|
}
|
|
2436
2531
|
.page-assistance-dialog {
|
|
2437
|
-
|
|
2438
|
-
|
|
2532
|
+
display: flex;
|
|
2533
|
+
flex-direction: column;
|
|
2534
|
+
width: min(100%, 400px);
|
|
2535
|
+
max-height: 100%;
|
|
2439
2536
|
min-width: 0;
|
|
2440
|
-
|
|
2537
|
+
min-height: 0;
|
|
2538
|
+
overflow: hidden;
|
|
2441
2539
|
overscroll-behavior: contain;
|
|
2442
|
-
padding:
|
|
2540
|
+
padding: 0;
|
|
2443
2541
|
color: var(--assist-text);
|
|
2444
|
-
background:
|
|
2445
|
-
|
|
2446
|
-
|
|
2447
|
-
|
|
2448
|
-
|
|
2449
|
-
|
|
2450
|
-
border: 1px solid var(--dialog-surface-border);
|
|
2451
|
-
border-radius: 20px;
|
|
2452
|
-
box-shadow:
|
|
2453
|
-
0 20px 48px color-mix(in srgb, var(--accent) 16%, transparent),
|
|
2454
|
-
0 4px 16px rgba(15, 23, 42, .14),
|
|
2455
|
-
inset 0 1px 0 var(--glass-highlight-strong);
|
|
2456
|
-
-webkit-backdrop-filter: blur(18px) saturate(1.1);
|
|
2457
|
-
backdrop-filter: blur(18px) saturate(1.1);
|
|
2458
|
-
animation: page-assistance-dialog-in .32s cubic-bezier(.2, .8, .3, 1) both;
|
|
2542
|
+
background-color: var(--assist-surface);
|
|
2543
|
+
background-image: var(--dialog-surface-background);
|
|
2544
|
+
border: 1px solid color-mix(in srgb, var(--accent) 12%, var(--assist-border));
|
|
2545
|
+
border-radius: 18px;
|
|
2546
|
+
box-shadow: 0 8px 24px color-mix(in srgb, var(--accent) 12%, transparent);
|
|
2547
|
+
animation: page-assistance-dialog-in .18s ease-out both;
|
|
2459
2548
|
}
|
|
2460
2549
|
.page-assistance-header {
|
|
2461
2550
|
display: grid;
|
|
2462
|
-
grid-template-columns: minmax(0, 1fr)
|
|
2463
|
-
|
|
2464
|
-
|
|
2551
|
+
grid-template-columns: minmax(0, 1fr) 44px;
|
|
2552
|
+
flex: 0 0 auto;
|
|
2553
|
+
gap: 8px;
|
|
2554
|
+
align-items: center;
|
|
2555
|
+
padding-block: 8px 4px;
|
|
2556
|
+
padding-inline: 16px 8px;
|
|
2465
2557
|
}
|
|
2466
2558
|
.page-assistance-header-copy { min-width: 0; }
|
|
2467
2559
|
.page-assistance-header h3 {
|
|
2468
2560
|
margin: 0;
|
|
2469
|
-
|
|
2470
|
-
|
|
2471
|
-
|
|
2561
|
+
color: var(--assist-text);
|
|
2562
|
+
font-size: 15px;
|
|
2563
|
+
line-height: 1.4;
|
|
2564
|
+
font-weight: 600;
|
|
2565
|
+
overflow-wrap: anywhere;
|
|
2566
|
+
}
|
|
2567
|
+
.page-assistance-close {
|
|
2568
|
+
display: inline-grid;
|
|
2569
|
+
width: 44px;
|
|
2570
|
+
min-width: 44px;
|
|
2571
|
+
height: 44px;
|
|
2572
|
+
min-height: 44px;
|
|
2573
|
+
place-items: center;
|
|
2574
|
+
padding: 0;
|
|
2575
|
+
color: var(--assist-muted);
|
|
2576
|
+
background: transparent;
|
|
2577
|
+
border: 0;
|
|
2578
|
+
border-radius: 10px;
|
|
2579
|
+
box-shadow: none;
|
|
2580
|
+
}
|
|
2581
|
+
.page-assistance-close .button-icon {
|
|
2582
|
+
display: inline-grid;
|
|
2583
|
+
width: 28px;
|
|
2584
|
+
height: 28px;
|
|
2585
|
+
place-items: center;
|
|
2586
|
+
border-radius: 8px;
|
|
2587
|
+
transition: background-color .18s ease, color .18s ease;
|
|
2588
|
+
}
|
|
2589
|
+
.page-assistance-close:hover .button-icon,
|
|
2590
|
+
.page-assistance-close:focus-visible .button-icon {
|
|
2591
|
+
color: var(--assist-text);
|
|
2592
|
+
background: color-mix(in srgb, var(--accent) 8%, var(--assist-surface));
|
|
2593
|
+
}
|
|
2594
|
+
.page-assistance-content {
|
|
2595
|
+
min-width: 0;
|
|
2596
|
+
min-height: 0;
|
|
2597
|
+
overflow: auto;
|
|
2598
|
+
overscroll-behavior: contain;
|
|
2599
|
+
padding: 0 16px 12px;
|
|
2600
|
+
scroll-padding-block: 8px;
|
|
2601
|
+
overflow-wrap: anywhere;
|
|
2472
2602
|
}
|
|
2473
2603
|
.page-assistance-action-copy {
|
|
2474
|
-
margin:
|
|
2604
|
+
margin: 0;
|
|
2475
2605
|
min-width: 0;
|
|
2476
|
-
color:
|
|
2606
|
+
color: var(--assist-text);
|
|
2477
2607
|
overflow-wrap: anywhere;
|
|
2478
2608
|
font-size: 13px;
|
|
2479
|
-
line-height:
|
|
2609
|
+
line-height: 1.5;
|
|
2480
2610
|
}
|
|
2481
|
-
.page-assistance-action-copy > span { min-width: 0; }
|
|
2611
|
+
.page-assistance-action-copy > span { display: block; min-width: 0; }
|
|
2482
2612
|
.page-assistance-target {
|
|
2483
|
-
margin-
|
|
2613
|
+
margin-top: 6px;
|
|
2484
2614
|
color: var(--assist-muted);
|
|
2615
|
+
font-size: 12px;
|
|
2485
2616
|
}
|
|
2486
2617
|
.page-assistance-footer {
|
|
2487
2618
|
display: grid;
|
|
2488
|
-
gap:
|
|
2489
|
-
margin-top:
|
|
2490
|
-
padding:
|
|
2619
|
+
gap: 4px;
|
|
2620
|
+
margin-top: 12px;
|
|
2621
|
+
padding-top: 8px;
|
|
2491
2622
|
background: transparent;
|
|
2492
|
-
border:
|
|
2493
|
-
border-top: 1px solid var(--soft-surface-border);
|
|
2494
|
-
border-radius: 0;
|
|
2623
|
+
border-top: 1px solid var(--assist-border);
|
|
2495
2624
|
}
|
|
2496
2625
|
.page-assistance-always {
|
|
2497
2626
|
display: grid;
|
|
2498
2627
|
grid-template-columns: 18px minmax(0, 1fr);
|
|
2499
|
-
gap:
|
|
2500
|
-
align-items:
|
|
2628
|
+
gap: 10px;
|
|
2629
|
+
align-items: start;
|
|
2501
2630
|
margin: 0;
|
|
2502
|
-
|
|
2631
|
+
padding-block: 12px;
|
|
2632
|
+
color: var(--assist-text);
|
|
2503
2633
|
font-size: 12px;
|
|
2504
2634
|
line-height: 18px;
|
|
2505
2635
|
cursor: pointer;
|
|
2506
|
-
min-height:
|
|
2636
|
+
min-height: 44px;
|
|
2507
2637
|
}
|
|
2508
2638
|
.page-assistance-always input {
|
|
2509
|
-
width:
|
|
2510
|
-
height:
|
|
2639
|
+
width: 18px;
|
|
2640
|
+
height: 18px;
|
|
2511
2641
|
margin: 0;
|
|
2512
2642
|
accent-color: var(--accent);
|
|
2513
2643
|
}
|
|
2514
2644
|
.page-assistance-agreement {
|
|
2515
2645
|
margin: 0;
|
|
2516
|
-
color:
|
|
2517
|
-
font-size:
|
|
2518
|
-
line-height:
|
|
2646
|
+
color: var(--assist-muted);
|
|
2647
|
+
font-size: 12px;
|
|
2648
|
+
line-height: 1.6;
|
|
2649
|
+
}
|
|
2650
|
+
.page-assistance-agreement > [data-role="page-assistance-agreement-prefix"] {
|
|
2651
|
+
display: block;
|
|
2519
2652
|
}
|
|
2520
2653
|
.page-assistance-agreement a {
|
|
2521
|
-
|
|
2522
|
-
|
|
2523
|
-
|
|
2654
|
+
display: inline-flex;
|
|
2655
|
+
min-height: 44px;
|
|
2656
|
+
align-items: center;
|
|
2657
|
+
color: var(--accent);
|
|
2658
|
+
font-weight: 500;
|
|
2659
|
+
text-decoration: underline;
|
|
2660
|
+
text-decoration-thickness: 1px;
|
|
2661
|
+
text-underline-offset: 3px;
|
|
2662
|
+
border-radius: 2px;
|
|
2663
|
+
}
|
|
2664
|
+
.page-assistance-agreement a:hover {
|
|
2665
|
+
text-decoration-thickness: 2px;
|
|
2524
2666
|
}
|
|
2525
2667
|
.panel.active-session.compact:is(.voice-session, .starting-voice) .end,
|
|
2668
|
+
.panel.active-session.compact:is(.voice-session, .starting-voice) .header-push,
|
|
2526
2669
|
.panel.active-session.compact:is(.voice-session, .starting-voice) .compact-mute,
|
|
2527
2670
|
.panel.active-session.compact:is(.voice-session, .starting-voice) .view-toggle {
|
|
2528
2671
|
width: 30px;
|
|
@@ -2547,6 +2690,7 @@ const style = `
|
|
|
2547
2690
|
border-color: rgba(215, 151, 169, .22);
|
|
2548
2691
|
}
|
|
2549
2692
|
.panel.active-session.compact:is(.voice-session, .starting-voice) .end:not(:disabled):hover,
|
|
2693
|
+
.panel.active-session.compact:is(.voice-session, .starting-voice) .header-push:not(:disabled):hover,
|
|
2550
2694
|
.panel.active-session.compact:is(.voice-session, .starting-voice) .compact-mute:not(:disabled):hover,
|
|
2551
2695
|
.panel.active-session.compact:is(.voice-session, .starting-voice) .view-toggle:not(:disabled):hover {
|
|
2552
2696
|
color: #fff;
|
|
@@ -2612,10 +2756,20 @@ const style = `
|
|
|
2612
2756
|
box-shadow: none;
|
|
2613
2757
|
}
|
|
2614
2758
|
.page-assistance-actions {
|
|
2615
|
-
display:
|
|
2616
|
-
|
|
2759
|
+
display: grid;
|
|
2760
|
+
grid-template-columns: repeat(2, minmax(0, 1fr));
|
|
2761
|
+
flex: 0 0 auto;
|
|
2617
2762
|
gap: 8px;
|
|
2618
|
-
|
|
2763
|
+
padding: 12px 16px 14px;
|
|
2764
|
+
border-top: 1px solid var(--assist-border);
|
|
2765
|
+
}
|
|
2766
|
+
.page-assistance-actions button {
|
|
2767
|
+
min-width: 0;
|
|
2768
|
+
min-height: 44px;
|
|
2769
|
+
padding: 10px 12px;
|
|
2770
|
+
line-height: 1.4;
|
|
2771
|
+
overflow-wrap: anywhere;
|
|
2772
|
+
border-radius: 10px;
|
|
2619
2773
|
}
|
|
2620
2774
|
.primary, .secondary {
|
|
2621
2775
|
padding: 0 12px;
|
|
@@ -2741,6 +2895,7 @@ const style = `
|
|
|
2741
2895
|
overscroll-behavior: contain;
|
|
2742
2896
|
scrollbar-width: none;
|
|
2743
2897
|
scroll-behavior: auto;
|
|
2898
|
+
touch-action: pan-y;
|
|
2744
2899
|
}
|
|
2745
2900
|
.panel.active-session:not(.compact) .captions {
|
|
2746
2901
|
height: 100%;
|
|
@@ -3349,6 +3504,7 @@ const style = `
|
|
|
3349
3504
|
display: grid;
|
|
3350
3505
|
grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
|
|
3351
3506
|
gap: 7px;
|
|
3507
|
+
margin-block-start: 10px;
|
|
3352
3508
|
}
|
|
3353
3509
|
.turn-action {
|
|
3354
3510
|
display: inline-flex;
|
|
@@ -3431,7 +3587,7 @@ const style = `
|
|
|
3431
3587
|
}
|
|
3432
3588
|
@keyframes page-assistance-backdrop-in { from { opacity: 0; } }
|
|
3433
3589
|
@keyframes page-assistance-dialog-in {
|
|
3434
|
-
from { opacity: 0; transform: translateY(
|
|
3590
|
+
from { opacity: 0; transform: translateY(4px); }
|
|
3435
3591
|
}
|
|
3436
3592
|
@keyframes pop { from { opacity: 0; transform: translateY(8px); } }
|
|
3437
3593
|
@keyframes attribution-in { from { opacity: 0; transform: translateY(3px); } }
|
|
@@ -3569,11 +3725,6 @@ const style = `
|
|
|
3569
3725
|
font-size: 16px;
|
|
3570
3726
|
line-height: 22px;
|
|
3571
3727
|
}
|
|
3572
|
-
.panel.open:not(.compact) .page-assistance-header h3 {
|
|
3573
|
-
color: color-mix(in srgb, var(--assist-text) 88%, var(--accent));
|
|
3574
|
-
font-size: 16px;
|
|
3575
|
-
line-height: 22px;
|
|
3576
|
-
}
|
|
3577
3728
|
.panel.open:not(.compact) .legal-close {
|
|
3578
3729
|
color: var(--assist-text);
|
|
3579
3730
|
background: var(--soft-surface-strong-background);
|
|
@@ -3581,9 +3732,7 @@ const style = `
|
|
|
3581
3732
|
border-radius: 50%;
|
|
3582
3733
|
}
|
|
3583
3734
|
.panel.open:not(.compact) .legal-dialog p,
|
|
3584
|
-
.panel.open:not(.compact) .legal-dialog ul
|
|
3585
|
-
.panel.open:not(.compact) .page-assistance-target,
|
|
3586
|
-
.panel.open:not(.compact) .page-assistance-always {
|
|
3735
|
+
.panel.open:not(.compact) .legal-dialog ul {
|
|
3587
3736
|
color: color-mix(in srgb, var(--assist-text) 66%, var(--accent));
|
|
3588
3737
|
}
|
|
3589
3738
|
.panel.open:not(.compact) .boundary {
|
|
@@ -3609,6 +3758,20 @@ const style = `
|
|
|
3609
3758
|
background: var(--soft-surface-strong-background);
|
|
3610
3759
|
border-color: var(--soft-surface-border);
|
|
3611
3760
|
}
|
|
3761
|
+
.panel.open .page-assistance-actions .secondary {
|
|
3762
|
+
color: var(--assist-text);
|
|
3763
|
+
background: var(--assist-surface);
|
|
3764
|
+
border-color: var(--assist-border);
|
|
3765
|
+
}
|
|
3766
|
+
.panel.open .page-assistance-actions .primary {
|
|
3767
|
+
box-shadow: 0 2px 6px color-mix(in srgb, var(--accent) 14%, transparent);
|
|
3768
|
+
}
|
|
3769
|
+
.panel.open .page-assistance-actions .secondary:hover {
|
|
3770
|
+
background: color-mix(in srgb, var(--accent) 5%, var(--assist-surface));
|
|
3771
|
+
}
|
|
3772
|
+
.panel.open .page-assistance-actions .primary:hover {
|
|
3773
|
+
filter: brightness(.96);
|
|
3774
|
+
}
|
|
3612
3775
|
.panel.open:not(.compact) .confirmation,
|
|
3613
3776
|
.panel.open:not(.compact) .visual-request,
|
|
3614
3777
|
.panel.open:not(.compact) .feedback.visible {
|
|
@@ -3763,7 +3926,7 @@ const style = `
|
|
|
3763
3926
|
border-radius: 5px;
|
|
3764
3927
|
box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 18%, transparent);
|
|
3765
3928
|
transition: inset .12s ease, width .12s ease, height .12s ease;
|
|
3766
|
-
z-index:
|
|
3929
|
+
z-index: 1;
|
|
3767
3930
|
}
|
|
3768
3931
|
.highlight.visible { display: block; }
|
|
3769
3932
|
.highlight.success { border-color: #0f8a80; }
|
|
@@ -3864,6 +4027,8 @@ const style = `
|
|
|
3864
4027
|
.intro-composer::before { display: none; }
|
|
3865
4028
|
.intro-composer-frame:focus-within,
|
|
3866
4029
|
.compact-chat-card:focus-within { box-shadow: none; }
|
|
4030
|
+
.intro:not([data-primary-motion]) .intro-composer-frame:not(.omago-transition-source),
|
|
4031
|
+
.panel:not(.mode-surface-transition-clone):not(.panel-transition-compact-clone):not(.primary-surface-transition-clone) > .compact-chat-card:not(.mode-surface-transition-clone) { box-shadow: none; }
|
|
3867
4032
|
.panel.open.compact.ending-state .compact-error-notice.visible {
|
|
3868
4033
|
background: var(--assist-surface);
|
|
3869
4034
|
border-color: var(--assist-border);
|
|
@@ -3906,7 +4071,8 @@ const style = `
|
|
|
3906
4071
|
backdrop-filter: none;
|
|
3907
4072
|
forced-color-adjust: auto;
|
|
3908
4073
|
}
|
|
3909
|
-
.panel.active-session.compact:is(.voice-session, .starting-voice) .header
|
|
4074
|
+
.panel.active-session.compact:is(.voice-session, .starting-voice) .header,
|
|
4075
|
+
:host([data-input-glow="false"]) .panel.active-session.compact:is(.voice-session, .starting-voice) .header {
|
|
3910
4076
|
background: Canvas;
|
|
3911
4077
|
border: 2px solid CanvasText;
|
|
3912
4078
|
box-shadow: none;
|
|
@@ -3941,14 +4107,18 @@ const style = `
|
|
|
3941
4107
|
.mode-option[aria-pressed="true"] { outline: 2px solid Highlight; }
|
|
3942
4108
|
.primary, .intro-voice, .intro-send { border: 2px solid ButtonText; }
|
|
3943
4109
|
.intro-minimize, .compact-chat-action { color: ButtonText; background: Canvas; border: 2px solid ButtonText; box-shadow: none; }
|
|
3944
|
-
.intro-composer-frame
|
|
4110
|
+
.intro-composer-frame,
|
|
4111
|
+
:host([data-input-glow="false"]) .intro-composer-frame { padding: 0; overflow: visible; background: Canvas; border: 2px solid ButtonText; outline: 0; box-shadow: none; }
|
|
3945
4112
|
.intro-composer-frame::before,
|
|
3946
4113
|
.compact-chat-card::before,
|
|
3947
4114
|
.composer::before,
|
|
3948
4115
|
.panel.active-session.compact:is(.voice-session, .starting-voice)::before {
|
|
3949
4116
|
background: Canvas;
|
|
3950
4117
|
}
|
|
3951
|
-
.compact-chat-card
|
|
4118
|
+
.compact-chat-card,
|
|
4119
|
+
:host([data-input-glow="false"]) .compact-chat-card { overflow: visible; background: Canvas; border: 0; outline: 2px solid ButtonText; outline-offset: -2px; box-shadow: none; }
|
|
4120
|
+
.intro:not([data-primary-motion]) .intro-composer-frame:not(.omago-transition-source),
|
|
4121
|
+
.panel:not(.mode-surface-transition-clone):not(.panel-transition-compact-clone):not(.primary-surface-transition-clone) > .compact-chat-card:not(.mode-surface-transition-clone) { box-shadow: none; }
|
|
3952
4122
|
.intro-effect,
|
|
3953
4123
|
.composer-effect,
|
|
3954
4124
|
.intro-effect-pink,
|
|
@@ -3970,6 +4140,7 @@ const style = `
|
|
|
3970
4140
|
.highlight { border: 3px solid Highlight; box-shadow: none; }
|
|
3971
4141
|
}
|
|
3972
4142
|
@media (max-width: 520px) {
|
|
4143
|
+
:host { --intro-action-width: 72px; }
|
|
3973
4144
|
.panel {
|
|
3974
4145
|
inset: auto 8px max(8px, env(safe-area-inset-bottom)) 8px !important;
|
|
3975
4146
|
width: auto;
|
|
@@ -3979,11 +4150,10 @@ const style = `
|
|
|
3979
4150
|
.header-actions { gap: 4px; }
|
|
3980
4151
|
.duration { min-width: 48px; padding-inline: 6px; }
|
|
3981
4152
|
.feedback-options { grid-template-columns: repeat(2, minmax(0, 1fr)); }
|
|
3982
|
-
.page-assistance-overlay {
|
|
3983
|
-
.page-assistance-dialog { width: 100%;
|
|
3984
|
-
.page-assistance-actions { display: grid; grid-template-columns: minmax(0, 1fr); }
|
|
4153
|
+
.page-assistance-overlay { padding: 8px 4px; }
|
|
4154
|
+
.page-assistance-dialog { width: 100%; }
|
|
3985
4155
|
.page-assistance-actions button { width: 100%; }
|
|
3986
|
-
.intro-voice {
|
|
4156
|
+
.intro-voice { padding-inline: 8px; }
|
|
3987
4157
|
.intro,
|
|
3988
4158
|
.intro[data-minimized="true"] {
|
|
3989
4159
|
bottom: calc(max(8px, env(safe-area-inset-bottom)) + var(--intro-visual-bottom-offset, 0px)) !important;
|
|
@@ -4058,17 +4228,17 @@ const style = `
|
|
|
4058
4228
|
margin-inline: auto;
|
|
4059
4229
|
}
|
|
4060
4230
|
.panel.active-session.compact:is(.voice-session, .starting-voice) {
|
|
4061
|
-
inset: auto max(
|
|
4062
|
-
width: calc(100vw -
|
|
4231
|
+
inset: auto max(20px, env(safe-area-inset-right)) max(20px, env(safe-area-inset-bottom)) auto !important;
|
|
4232
|
+
width: min(340px, calc(100vw - 40px)) !important;
|
|
4063
4233
|
min-width: 0 !important;
|
|
4064
4234
|
height: 54px !important;
|
|
4065
4235
|
max-height: 54px !important;
|
|
4066
4236
|
}
|
|
4067
4237
|
.panel.active-session.compact:is(.voice-session, .starting-voice)[data-anchor="left"] {
|
|
4068
|
-
inset: auto auto max(
|
|
4238
|
+
inset: auto auto max(20px, env(safe-area-inset-bottom)) max(20px, env(safe-area-inset-left)) !important;
|
|
4069
4239
|
}
|
|
4070
4240
|
.panel.active-session.compact:is(.voice-session, .starting-voice)[data-anchor="center"] {
|
|
4071
|
-
inset: auto auto max(
|
|
4241
|
+
inset: auto auto max(20px, env(safe-area-inset-bottom)) 50% !important;
|
|
4072
4242
|
translate: -50% 0;
|
|
4073
4243
|
}
|
|
4074
4244
|
.panel.active-session.compact:is(.voice-session, .starting-voice) .compact-captions {
|
|
@@ -4148,15 +4318,44 @@ const style = `
|
|
|
4148
4318
|
class WidgetView {
|
|
4149
4319
|
constructor(config, overrides, callbacks, options = {}) {
|
|
4150
4320
|
this.callbacks = callbacks;
|
|
4321
|
+
this.ctaCard = null;
|
|
4322
|
+
this.ctaSlot = null;
|
|
4151
4323
|
this.ambient = null;
|
|
4152
4324
|
this.widgetCornerGlow = null;
|
|
4153
4325
|
this.playbackBlocked = false;
|
|
4154
4326
|
this.playbackResumePending = false;
|
|
4327
|
+
this.playbackResumeTimer = null;
|
|
4328
|
+
this.playbackResumeFinish = null;
|
|
4155
4329
|
this.playbackGeneration = 0;
|
|
4330
|
+
this.playbackAttempt = 0;
|
|
4331
|
+
this.destroyed = false;
|
|
4332
|
+
this.recordingConsent = false;
|
|
4333
|
+
this.mediaPlaybackActive = false;
|
|
4334
|
+
this.remoteAudioContext = null;
|
|
4335
|
+
this.remoteAudioContextStateListener = null;
|
|
4336
|
+
this.remoteAudioAnalyser = null;
|
|
4337
|
+
this.remoteAudioSilentSink = null;
|
|
4338
|
+
this.remoteAudioSources = [];
|
|
4339
|
+
this.remoteAudioAnalysisStreams = [];
|
|
4340
|
+
this.remoteAudioAnalysedTracks = new Set();
|
|
4341
|
+
this.remoteAudioFloatBuffer = null;
|
|
4342
|
+
this.remoteAudioByteBuffer = null;
|
|
4343
|
+
this.remoteAudioEvidenceTimer = null;
|
|
4344
|
+
this.remoteAudioEvidenceGeneration = 0;
|
|
4345
|
+
this.remoteAudioEvidenceAttackWindow = 0;
|
|
4346
|
+
this.remoteAudioEvidenceQuietSince = null;
|
|
4347
|
+
this.remoteAudioEvidenceAudible = false;
|
|
4348
|
+
this.remoteAudioEvidenceCandidateUntil = 0;
|
|
4349
|
+
this.boundRemoteAudioStreams = new WeakSet();
|
|
4350
|
+
this.boundRemoteAudioTracks = new WeakSet();
|
|
4351
|
+
this.playbackStateBindings = [];
|
|
4352
|
+
this.remotePlaybackState = "idle";
|
|
4156
4353
|
this.muted = false;
|
|
4354
|
+
this.playbackInterrupted = false;
|
|
4157
4355
|
this.statusBeforeMute = null;
|
|
4158
4356
|
this.manualTurn = false;
|
|
4159
4357
|
this.pushActive = false;
|
|
4358
|
+
this.pushPending = false;
|
|
4160
4359
|
this.voiceActive = false;
|
|
4161
4360
|
this.modeTransitionPending = null;
|
|
4162
4361
|
this.startingVoicePresentation = false;
|
|
@@ -4168,6 +4367,7 @@ class WidgetView {
|
|
|
4168
4367
|
this.visualPaused = false;
|
|
4169
4368
|
this.active = false;
|
|
4170
4369
|
this.endRequested = false;
|
|
4370
|
+
this.endingPresentationDismissed = false;
|
|
4171
4371
|
this.launcherSuppressed = false;
|
|
4172
4372
|
this.introMinimized = false;
|
|
4173
4373
|
this.introTransitionTarget = null;
|
|
@@ -4187,6 +4387,12 @@ class WidgetView {
|
|
|
4187
4387
|
this.introComposing = false;
|
|
4188
4388
|
this.legalOpenedPanel = false;
|
|
4189
4389
|
this.highlightedElement = null;
|
|
4390
|
+
this.highlightFrame = null;
|
|
4391
|
+
this.highlightIntersectionKnown = false;
|
|
4392
|
+
this.highlightIntersectionObserver = null;
|
|
4393
|
+
this.highlightIntersectionRect = null;
|
|
4394
|
+
this.highlightResizeObserver = null;
|
|
4395
|
+
this.highlightScrollTargets = [];
|
|
4190
4396
|
this.dragState = null;
|
|
4191
4397
|
this.suggestionDragState = null;
|
|
4192
4398
|
this.suppressSuggestionClick = false;
|
|
@@ -4205,6 +4411,7 @@ class WidgetView {
|
|
|
4205
4411
|
this.durationInterval = null;
|
|
4206
4412
|
this.compactCaptionTimers = new Map();
|
|
4207
4413
|
this.compactCaptionContentTimers = new Map();
|
|
4414
|
+
this.captionsPinnedToBottom = true;
|
|
4208
4415
|
this.captionHeightGlides = new Map();
|
|
4209
4416
|
this.captionResizeObserver = null;
|
|
4210
4417
|
this.introTransitionTimers = new Set();
|
|
@@ -4232,18 +4439,32 @@ class WidgetView {
|
|
|
4232
4439
|
this.assistantState = "ready";
|
|
4233
4440
|
this.assistantCaptionPhase = "none";
|
|
4234
4441
|
this.actionStateRunning = false;
|
|
4442
|
+
this.actionPendingAssistantCaption = null;
|
|
4443
|
+
this.actionPendingCompactAssistantCaption = null;
|
|
4235
4444
|
this.supportCompanion = false;
|
|
4236
4445
|
this.onPlaybackActivation = () => {
|
|
4237
|
-
if (!this.active ||
|
|
4238
|
-
!this.voiceActive ||
|
|
4239
|
-
!this.playbackBlocked ||
|
|
4240
|
-
!this.audio.srcObject) {
|
|
4446
|
+
if (!this.active || !this.voiceActive || !this.audio.srcObject) {
|
|
4241
4447
|
return;
|
|
4242
4448
|
}
|
|
4243
|
-
|
|
4449
|
+
this.resumeRemoteAudioContext();
|
|
4450
|
+
if (this.playbackBlocked) {
|
|
4451
|
+
void this.playRemoteAudio();
|
|
4452
|
+
return;
|
|
4453
|
+
}
|
|
4454
|
+
this.startRemoteAudioEvidenceSampling();
|
|
4244
4455
|
};
|
|
4245
4456
|
this.onEffectVisibilityChange = () => {
|
|
4246
4457
|
this.syncEffectMotion();
|
|
4458
|
+
if (document.hidden) {
|
|
4459
|
+
this.resetRemoteAudioEvidence(true);
|
|
4460
|
+
return;
|
|
4461
|
+
}
|
|
4462
|
+
if (this.assistantState === "thinking" ||
|
|
4463
|
+
this.assistantState === "speaking") {
|
|
4464
|
+
this.remoteAudioEvidenceCandidateUntil = Math.max(this.remoteAudioEvidenceCandidateUntil, this.remoteAudioEvidenceNow() + REMOTE_AUDIO_EVIDENCE_EXPECTATION_MS);
|
|
4465
|
+
}
|
|
4466
|
+
this.resumeRemoteAudioContext();
|
|
4467
|
+
this.startRemoteAudioEvidenceSampling();
|
|
4247
4468
|
};
|
|
4248
4469
|
this.onReducedMotionChange = () => {
|
|
4249
4470
|
this.syncEffectMotion();
|
|
@@ -4252,6 +4473,45 @@ class WidgetView {
|
|
|
4252
4473
|
this.settlePanelTransitionForStaticMotion();
|
|
4253
4474
|
}
|
|
4254
4475
|
};
|
|
4476
|
+
this.livePlaybackObservation = null;
|
|
4477
|
+
this.liveDrainObservation = null;
|
|
4478
|
+
this.onCaptionsScroll = () => {
|
|
4479
|
+
// Hidden and morphing layouts can clamp scrollTop without visitor input.
|
|
4480
|
+
// Do not mistake that clamp for a visitor choosing to read older messages.
|
|
4481
|
+
if (this.compact || this.panelViewTransition || this.captions.clientHeight === 0)
|
|
4482
|
+
return;
|
|
4483
|
+
this.updateCaptionsPinnedState();
|
|
4484
|
+
};
|
|
4485
|
+
this.onPanelWheel = (event) => {
|
|
4486
|
+
if (event.ctrlKey ||
|
|
4487
|
+
!this.active ||
|
|
4488
|
+
this.compact ||
|
|
4489
|
+
!this.panel.classList.contains("open") ||
|
|
4490
|
+
!this.require('[data-role="legal-overlay"]').hidden ||
|
|
4491
|
+
!this.require('[data-role="page-assistance-overlay"]')
|
|
4492
|
+
.hidden ||
|
|
4493
|
+
this.currentConfirmation !== null ||
|
|
4494
|
+
this.currentVisualRequest !== null ||
|
|
4495
|
+
this.currentHandoffContextRequest !== null ||
|
|
4496
|
+
this.currentPageAssistanceRequest !== null ||
|
|
4497
|
+
this.panel.classList.contains("feedback-state") ||
|
|
4498
|
+
Math.abs(event.deltaY) < Math.abs(event.deltaX)) {
|
|
4499
|
+
return;
|
|
4500
|
+
}
|
|
4501
|
+
const maximum = Math.max(0, this.captions.scrollHeight - this.captions.clientHeight);
|
|
4502
|
+
if (maximum <= 0 || !Number.isFinite(event.deltaY) || event.deltaY === 0) {
|
|
4503
|
+
return;
|
|
4504
|
+
}
|
|
4505
|
+
const scale = event.deltaMode === 1
|
|
4506
|
+
? 16
|
|
4507
|
+
: event.deltaMode === 2
|
|
4508
|
+
? Math.max(1, this.captions.clientHeight)
|
|
4509
|
+
: 1;
|
|
4510
|
+
event.preventDefault();
|
|
4511
|
+
event.stopPropagation();
|
|
4512
|
+
this.captions.scrollTop = Math.min(maximum, Math.max(0, this.captions.scrollTop + event.deltaY * scale));
|
|
4513
|
+
this.updateCaptionsPinnedState();
|
|
4514
|
+
};
|
|
4255
4515
|
this.onIntroInputPointerDown = (event) => {
|
|
4256
4516
|
this.consumeProactiveEngagement();
|
|
4257
4517
|
if (event.pointerType !== "touch")
|
|
@@ -4435,6 +4695,72 @@ class WidgetView {
|
|
|
4435
4695
|
return;
|
|
4436
4696
|
this.closeControlsMenu();
|
|
4437
4697
|
};
|
|
4698
|
+
this.onHighlightIntersection = (entries) => {
|
|
4699
|
+
const target = this.highlightedElement;
|
|
4700
|
+
const entry = target
|
|
4701
|
+
? entries.find((candidate) => candidate.target === target)
|
|
4702
|
+
: null;
|
|
4703
|
+
if (!entry)
|
|
4704
|
+
return;
|
|
4705
|
+
const currentRect = target.getBoundingClientRect();
|
|
4706
|
+
const observedRect = entry.boundingClientRect;
|
|
4707
|
+
const geometryEpsilon = 0.5;
|
|
4708
|
+
if (Math.abs(currentRect.left - observedRect.left) > geometryEpsilon ||
|
|
4709
|
+
Math.abs(currentRect.top - observedRect.top) > geometryEpsilon ||
|
|
4710
|
+
Math.abs(currentRect.right - observedRect.right) > geometryEpsilon ||
|
|
4711
|
+
Math.abs(currentRect.bottom - observedRect.bottom) > geometryEpsilon) {
|
|
4712
|
+
this.rearmHighlightIntersection();
|
|
4713
|
+
return;
|
|
4714
|
+
}
|
|
4715
|
+
this.highlightIntersectionKnown = true;
|
|
4716
|
+
if (!entry.isIntersecting ||
|
|
4717
|
+
entry.intersectionRect.right <= entry.intersectionRect.left ||
|
|
4718
|
+
entry.intersectionRect.bottom <= entry.intersectionRect.top) {
|
|
4719
|
+
this.highlightIntersectionRect = null;
|
|
4720
|
+
}
|
|
4721
|
+
else {
|
|
4722
|
+
const clippedEdges = {};
|
|
4723
|
+
if (entry.intersectionRect.left > observedRect.left + geometryEpsilon) {
|
|
4724
|
+
clippedEdges.left = entry.intersectionRect.left;
|
|
4725
|
+
}
|
|
4726
|
+
if (entry.intersectionRect.top > observedRect.top + geometryEpsilon) {
|
|
4727
|
+
clippedEdges.top = entry.intersectionRect.top;
|
|
4728
|
+
}
|
|
4729
|
+
if (entry.intersectionRect.right < observedRect.right - geometryEpsilon) {
|
|
4730
|
+
clippedEdges.right = entry.intersectionRect.right;
|
|
4731
|
+
}
|
|
4732
|
+
if (entry.intersectionRect.bottom <
|
|
4733
|
+
observedRect.bottom - geometryEpsilon) {
|
|
4734
|
+
clippedEdges.bottom = entry.intersectionRect.bottom;
|
|
4735
|
+
}
|
|
4736
|
+
this.highlightIntersectionRect = clippedEdges;
|
|
4737
|
+
}
|
|
4738
|
+
this.scheduleHighlightRefresh();
|
|
4739
|
+
};
|
|
4740
|
+
this.scheduleHighlightGeometryRefresh = () => {
|
|
4741
|
+
if (!this.highlightedElement)
|
|
4742
|
+
return;
|
|
4743
|
+
this.rearmHighlightIntersection();
|
|
4744
|
+
this.scheduleHighlightRefresh();
|
|
4745
|
+
};
|
|
4746
|
+
this.onHighlightViewportGeometryChange = () => {
|
|
4747
|
+
if (!this.highlightedElement)
|
|
4748
|
+
return;
|
|
4749
|
+
if (this.highlightIntersectionObserver) {
|
|
4750
|
+
this.scheduleHighlightGeometryRefresh();
|
|
4751
|
+
}
|
|
4752
|
+
else {
|
|
4753
|
+
this.refreshHighlight();
|
|
4754
|
+
}
|
|
4755
|
+
};
|
|
4756
|
+
this.scheduleHighlightRefresh = () => {
|
|
4757
|
+
if (!this.highlightedElement || this.highlightFrame !== null)
|
|
4758
|
+
return;
|
|
4759
|
+
this.highlightFrame = requestAnimationFrame(() => {
|
|
4760
|
+
this.highlightFrame = null;
|
|
4761
|
+
this.refreshHighlight();
|
|
4762
|
+
});
|
|
4763
|
+
};
|
|
4438
4764
|
this.refreshHighlight = () => {
|
|
4439
4765
|
this.hideTooltip();
|
|
4440
4766
|
if (this.highlightedElement) {
|
|
@@ -4450,7 +4776,7 @@ class WidgetView {
|
|
|
4450
4776
|
this.hideTooltip();
|
|
4451
4777
|
this.syncPanelDragState();
|
|
4452
4778
|
this.clampPanelPosition();
|
|
4453
|
-
this.
|
|
4779
|
+
this.onHighlightViewportGeometryChange();
|
|
4454
4780
|
this.scheduleProactiveOverflowSync();
|
|
4455
4781
|
};
|
|
4456
4782
|
this.onDragStart = (event) => {
|
|
@@ -4505,7 +4831,10 @@ class WidgetView {
|
|
|
4505
4831
|
this.messageOverrides = { ...overrides };
|
|
4506
4832
|
this.messages = (0, index_js_1.resolveWidgetMessages)(this.messageOverrides, config.messages);
|
|
4507
4833
|
this.persistentState = options.persistentState !== false;
|
|
4834
|
+
this.storageNamespace = options.storageNamespace ?? null;
|
|
4508
4835
|
this.initialPanelView = options.initialPanelView ?? null;
|
|
4836
|
+
this.preserveRawText = options.preserveRawText === true;
|
|
4837
|
+
this.manualTurnsSupported = options.manualTurnsSupported === true;
|
|
4509
4838
|
this.semanticStatus = this.messages.ready;
|
|
4510
4839
|
this.host = document.createElement("div");
|
|
4511
4840
|
this.host.dataset.oxvoAiLiveAssistRoot = "true";
|
|
@@ -4513,7 +4842,7 @@ class WidgetView {
|
|
|
4513
4842
|
this.host.setAttribute("aria-live", "off");
|
|
4514
4843
|
this.shadow = this.host.attachShadow({ mode: "closed" });
|
|
4515
4844
|
const sheet = document.createElement("style");
|
|
4516
|
-
sheet.textContent = style;
|
|
4845
|
+
sheet.textContent = style + ctaOffer_js_1.CTA_OFFER_STYLES;
|
|
4517
4846
|
this.shadow.append(sheet);
|
|
4518
4847
|
this.shadow.append(this.build());
|
|
4519
4848
|
document.documentElement.append(this.host);
|
|
@@ -4527,10 +4856,11 @@ class WidgetView {
|
|
|
4527
4856
|
this.compactCaptions = this.require(".compact-captions");
|
|
4528
4857
|
if (typeof ResizeObserver === "function") {
|
|
4529
4858
|
this.captionResizeObserver = new ResizeObserver((entries) => {
|
|
4530
|
-
if (entries.some((entry) => entry.target.parentElement === this.captions)) {
|
|
4859
|
+
if (entries.some((entry) => entry.target === this.captions || entry.target.parentElement === this.captions)) {
|
|
4531
4860
|
this.scrollCaptionsToBottom();
|
|
4532
4861
|
}
|
|
4533
4862
|
});
|
|
4863
|
+
this.captionResizeObserver.observe(this.captions);
|
|
4534
4864
|
}
|
|
4535
4865
|
this.controls = this.require(".controls");
|
|
4536
4866
|
this.confirmation = this.require(".confirmation");
|
|
@@ -4540,6 +4870,8 @@ class WidgetView {
|
|
|
4540
4870
|
this.highlight = this.require(".highlight");
|
|
4541
4871
|
this.tooltip = this.require(".tooltip");
|
|
4542
4872
|
this.audio = this.require("audio");
|
|
4873
|
+
this.audio.setAttribute("playsinline", "");
|
|
4874
|
+
this.audio.setAttribute("aria-hidden", "true");
|
|
4543
4875
|
this.dialogFocus = new dialogFocusScope_js_1.DialogFocusScope(this.shadow, this.host);
|
|
4544
4876
|
this.reducedMotionQuery =
|
|
4545
4877
|
window.matchMedia?.("(prefers-reduced-motion: reduce)") ?? null;
|
|
@@ -4553,11 +4885,93 @@ class WidgetView {
|
|
|
4553
4885
|
this.syncSurfaceEffectOwner();
|
|
4554
4886
|
}
|
|
4555
4887
|
setRemoteStream(stream) {
|
|
4556
|
-
|
|
4888
|
+
const streamChanged = this.audio.srcObject !== stream;
|
|
4889
|
+
if (streamChanged)
|
|
4557
4890
|
this.invalidateRemotePlayback();
|
|
4558
4891
|
this.audio.srcObject = stream;
|
|
4892
|
+
if (streamChanged) {
|
|
4893
|
+
this.boundRemoteAudioStreams = new WeakSet();
|
|
4894
|
+
this.boundRemoteAudioTracks = new WeakSet();
|
|
4895
|
+
this.bindPlaybackState();
|
|
4896
|
+
this.bindRemoteAudioTrackState(stream);
|
|
4897
|
+
}
|
|
4559
4898
|
void this.playRemoteAudio();
|
|
4560
4899
|
}
|
|
4900
|
+
bindRemoteAudioTrackState(stream) {
|
|
4901
|
+
if (typeof stream.getAudioTracks !== "function")
|
|
4902
|
+
return;
|
|
4903
|
+
const isCurrent = (track) => this.audio.srcObject === stream &&
|
|
4904
|
+
this.playbackEventIsCurrent() &&
|
|
4905
|
+
(!track ||
|
|
4906
|
+
stream.getAudioTracks().some((candidate) => candidate === track));
|
|
4907
|
+
if (!this.boundRemoteAudioStreams.has(stream) &&
|
|
4908
|
+
typeof stream.addEventListener === "function") {
|
|
4909
|
+
this.boundRemoteAudioStreams.add(stream);
|
|
4910
|
+
const refreshTrackSet = () => {
|
|
4911
|
+
if (!isCurrent())
|
|
4912
|
+
return;
|
|
4913
|
+
this.resetRemoteAudioEvidence(true);
|
|
4914
|
+
this.rebuildRemoteAudioAnalyser(stream);
|
|
4915
|
+
this.bindRemoteAudioTrackState(stream);
|
|
4916
|
+
this.startRemoteAudioEvidenceSampling();
|
|
4917
|
+
};
|
|
4918
|
+
stream.addEventListener("addtrack", refreshTrackSet);
|
|
4919
|
+
stream.addEventListener("removetrack", refreshTrackSet);
|
|
4920
|
+
}
|
|
4921
|
+
for (const track of stream.getAudioTracks()) {
|
|
4922
|
+
if (this.boundRemoteAudioTracks.has(track) ||
|
|
4923
|
+
typeof track.addEventListener !== "function") {
|
|
4924
|
+
continue;
|
|
4925
|
+
}
|
|
4926
|
+
this.boundRemoteAudioTracks.add(track);
|
|
4927
|
+
track.addEventListener("mute", () => {
|
|
4928
|
+
if (!isCurrent(track))
|
|
4929
|
+
return;
|
|
4930
|
+
this.resetRemoteAudioEvidence(true);
|
|
4931
|
+
this.startRemoteAudioEvidenceSampling();
|
|
4932
|
+
});
|
|
4933
|
+
track.addEventListener("unmute", () => {
|
|
4934
|
+
if (!isCurrent(track))
|
|
4935
|
+
return;
|
|
4936
|
+
this.resetRemoteAudioEvidence(false);
|
|
4937
|
+
this.resumeRemoteAudioContext();
|
|
4938
|
+
this.startRemoteAudioEvidenceSampling();
|
|
4939
|
+
});
|
|
4940
|
+
track.addEventListener("ended", () => {
|
|
4941
|
+
if (!isCurrent(track))
|
|
4942
|
+
return;
|
|
4943
|
+
this.resetRemoteAudioEvidence(true);
|
|
4944
|
+
this.rebuildRemoteAudioAnalyser(stream);
|
|
4945
|
+
if (stream
|
|
4946
|
+
.getAudioTracks()
|
|
4947
|
+
.some((candidate) => candidate.readyState === "live")) {
|
|
4948
|
+
this.startRemoteAudioEvidenceSampling();
|
|
4949
|
+
return;
|
|
4950
|
+
}
|
|
4951
|
+
this.mediaPlaybackActive = false;
|
|
4952
|
+
this.applyRemotePlaybackState("ended");
|
|
4953
|
+
});
|
|
4954
|
+
}
|
|
4955
|
+
}
|
|
4956
|
+
remoteAudioIsAudible() {
|
|
4957
|
+
return Boolean(this.remoteAudioEvidenceAudible &&
|
|
4958
|
+
this.mediaPlaybackActive &&
|
|
4959
|
+
this.remoteAudioTrackIsPlayable());
|
|
4960
|
+
}
|
|
4961
|
+
authorizeVoicePlayback(value) {
|
|
4962
|
+
this.audio.autoplay = value && !this.playbackInterrupted;
|
|
4963
|
+
if (!value || this.playbackInterrupted)
|
|
4964
|
+
return;
|
|
4965
|
+
this.audio.setAttribute("playsinline", "");
|
|
4966
|
+
this.audio.setAttribute("aria-hidden", "true");
|
|
4967
|
+
// Create/resume inside the voice-button gesture when possible. Safari can
|
|
4968
|
+
// otherwise leave an AudioContext created after the RTC stream arrives in
|
|
4969
|
+
// the suspended state even though media playback itself was authorized.
|
|
4970
|
+
this.ensureRemoteAudioContext();
|
|
4971
|
+
this.resumeRemoteAudioContext();
|
|
4972
|
+
if (this.audio.srcObject)
|
|
4973
|
+
void this.playRemoteAudio();
|
|
4974
|
+
}
|
|
4561
4975
|
playRemoteAudio() {
|
|
4562
4976
|
// Text sessions keep a receive-only audio section for the realtime
|
|
4563
4977
|
// transport, so an attached stream alone never authorizes playback.
|
|
@@ -4566,78 +4980,546 @@ class WidgetView {
|
|
|
4566
4980
|
remoteStream
|
|
4567
4981
|
.getAudioTracks()
|
|
4568
4982
|
.some((track) => track.readyState === "live");
|
|
4569
|
-
if (!this.active ||
|
|
4983
|
+
if (!this.active ||
|
|
4984
|
+
!this.voiceActive ||
|
|
4985
|
+
!hasLiveAudioTrack ||
|
|
4986
|
+
this.playbackInterrupted) {
|
|
4570
4987
|
return Promise.resolve();
|
|
4571
4988
|
}
|
|
4572
4989
|
if (this.playbackResumePending)
|
|
4573
4990
|
return Promise.resolve();
|
|
4991
|
+
this.bindPlaybackState();
|
|
4992
|
+
this.ensureRemoteAudioContext();
|
|
4993
|
+
this.rebuildRemoteAudioAnalyser(remoteStream);
|
|
4994
|
+
this.resumeRemoteAudioContext();
|
|
4574
4995
|
const generation = this.playbackGeneration;
|
|
4996
|
+
const attempt = ++this.playbackAttempt;
|
|
4575
4997
|
this.playbackResumePending = true;
|
|
4576
|
-
|
|
4577
|
-
|
|
4578
|
-
|
|
4579
|
-
|
|
4580
|
-
|
|
4581
|
-
|
|
4582
|
-
|
|
4583
|
-
.
|
|
4584
|
-
|
|
4585
|
-
|
|
4586
|
-
|
|
4587
|
-
|
|
4588
|
-
|
|
4589
|
-
|
|
4590
|
-
|
|
4591
|
-
|
|
4592
|
-
|
|
4593
|
-
|
|
4998
|
+
this.remotePlaybackState = "waiting";
|
|
4999
|
+
this.refreshAssistantPlaybackPresentation();
|
|
5000
|
+
let playback;
|
|
5001
|
+
try {
|
|
5002
|
+
playback = this.audio.play();
|
|
5003
|
+
}
|
|
5004
|
+
catch (error) {
|
|
5005
|
+
playback = Promise.reject(error);
|
|
5006
|
+
}
|
|
5007
|
+
return new Promise((resolve) => {
|
|
5008
|
+
let settled = false;
|
|
5009
|
+
const finish = () => {
|
|
5010
|
+
if (settled)
|
|
5011
|
+
return;
|
|
5012
|
+
settled = true;
|
|
5013
|
+
if (this.playbackResumeFinish === finish) {
|
|
5014
|
+
this.playbackResumeFinish = null;
|
|
5015
|
+
}
|
|
5016
|
+
resolve();
|
|
5017
|
+
};
|
|
5018
|
+
this.playbackResumeFinish = finish;
|
|
5019
|
+
const timeout = setTimeout(() => {
|
|
5020
|
+
if (generation !== this.playbackGeneration ||
|
|
5021
|
+
attempt !== this.playbackAttempt) {
|
|
5022
|
+
finish();
|
|
5023
|
+
return;
|
|
5024
|
+
}
|
|
5025
|
+
this.playbackAttempt += 1;
|
|
4594
5026
|
this.playbackResumePending = false;
|
|
4595
|
-
|
|
5027
|
+
this.playbackResumeTimer = null;
|
|
5028
|
+
this.markPlaybackBlocked();
|
|
5029
|
+
finish();
|
|
5030
|
+
}, REMOTE_PLAYBACK_START_TIMEOUT_MS);
|
|
5031
|
+
this.playbackResumeTimer = timeout;
|
|
5032
|
+
void playback
|
|
5033
|
+
.then(() => {
|
|
5034
|
+
if (generation !== this.playbackGeneration ||
|
|
5035
|
+
attempt !== this.playbackAttempt) {
|
|
5036
|
+
return;
|
|
5037
|
+
}
|
|
5038
|
+
this.playbackBlocked = false;
|
|
5039
|
+
})
|
|
5040
|
+
.catch(() => {
|
|
5041
|
+
if (generation !== this.playbackGeneration ||
|
|
5042
|
+
attempt !== this.playbackAttempt) {
|
|
5043
|
+
return;
|
|
5044
|
+
}
|
|
5045
|
+
this.markPlaybackBlocked();
|
|
5046
|
+
})
|
|
5047
|
+
.finally(() => {
|
|
5048
|
+
if (this.playbackResumeTimer === timeout &&
|
|
5049
|
+
generation === this.playbackGeneration &&
|
|
5050
|
+
attempt === this.playbackAttempt) {
|
|
5051
|
+
clearTimeout(timeout);
|
|
5052
|
+
this.playbackResumeTimer = null;
|
|
5053
|
+
this.playbackResumePending = false;
|
|
5054
|
+
}
|
|
5055
|
+
finish();
|
|
5056
|
+
});
|
|
4596
5057
|
});
|
|
4597
5058
|
}
|
|
5059
|
+
markPlaybackBlocked() {
|
|
5060
|
+
this.mediaPlaybackActive = false;
|
|
5061
|
+
this.resetRemoteAudioEvidence(false);
|
|
5062
|
+
this.playbackBlocked = true;
|
|
5063
|
+
this.remotePlaybackState = "blocked";
|
|
5064
|
+
this.refreshAssistantPlaybackPresentation();
|
|
5065
|
+
this.emitPlaybackState("blocked");
|
|
5066
|
+
}
|
|
4598
5067
|
invalidateRemotePlayback() {
|
|
5068
|
+
if (this.playbackResumeTimer !== null) {
|
|
5069
|
+
clearTimeout(this.playbackResumeTimer);
|
|
5070
|
+
this.playbackResumeTimer = null;
|
|
5071
|
+
}
|
|
4599
5072
|
this.playbackGeneration += 1;
|
|
5073
|
+
this.playbackAttempt += 1;
|
|
5074
|
+
this.playbackResumeFinish?.();
|
|
4600
5075
|
this.playbackBlocked = false;
|
|
4601
5076
|
this.playbackResumePending = false;
|
|
5077
|
+
this.mediaPlaybackActive = false;
|
|
5078
|
+
this.remoteAudioEvidenceCandidateUntil = 0;
|
|
5079
|
+
this.stopRemoteAudioEvidenceSampling();
|
|
5080
|
+
this.resetRemoteAudioEvidenceState();
|
|
5081
|
+
this.disconnectRemoteAudioAnalyser();
|
|
5082
|
+
this.remotePlaybackState = "idle";
|
|
5083
|
+
this.refreshAssistantPlaybackPresentation();
|
|
5084
|
+
}
|
|
5085
|
+
pauseRemotePlayback(emit = false) {
|
|
5086
|
+
this.invalidateRemotePlayback();
|
|
5087
|
+
this.remotePlaybackState = "paused";
|
|
5088
|
+
this.audio.pause();
|
|
5089
|
+
if (emit)
|
|
5090
|
+
this.emitPlaybackState("paused");
|
|
5091
|
+
}
|
|
5092
|
+
resetRemotePlayback() {
|
|
5093
|
+
this.playbackInterrupted = false;
|
|
5094
|
+
this.pauseRemotePlayback();
|
|
5095
|
+
this.audio.srcObject = null;
|
|
5096
|
+
this.audio.autoplay = false;
|
|
5097
|
+
}
|
|
5098
|
+
playbackEventIsCurrent() {
|
|
5099
|
+
return Boolean(!this.destroyed &&
|
|
5100
|
+
this.active &&
|
|
5101
|
+
this.voiceActive &&
|
|
5102
|
+
this.audio.srcObject &&
|
|
5103
|
+
!this.panel.classList.contains("error-state") &&
|
|
5104
|
+
!this.panel.classList.contains("ending-state"));
|
|
5105
|
+
}
|
|
5106
|
+
bindPlaybackState() {
|
|
5107
|
+
this.unbindPlaybackState();
|
|
5108
|
+
const generation = this.playbackGeneration;
|
|
5109
|
+
const stream = this.audio.srcObject;
|
|
5110
|
+
const current = () => generation === this.playbackGeneration &&
|
|
5111
|
+
this.audio.srcObject === stream &&
|
|
5112
|
+
this.playbackEventIsCurrent();
|
|
5113
|
+
const bind = (type, handler) => {
|
|
5114
|
+
const listener = () => {
|
|
5115
|
+
if (!current())
|
|
5116
|
+
return;
|
|
5117
|
+
handler();
|
|
5118
|
+
};
|
|
5119
|
+
this.playbackStateBindings.push({ type, listener });
|
|
5120
|
+
this.audio.addEventListener(type, listener);
|
|
5121
|
+
};
|
|
5122
|
+
bind("playing", () => {
|
|
5123
|
+
if (this.playbackInterrupted) {
|
|
5124
|
+
this.audio.pause();
|
|
5125
|
+
return;
|
|
5126
|
+
}
|
|
5127
|
+
if (this.playbackResumeTimer !== null) {
|
|
5128
|
+
clearTimeout(this.playbackResumeTimer);
|
|
5129
|
+
this.playbackResumeTimer = null;
|
|
5130
|
+
}
|
|
5131
|
+
this.playbackResumeFinish?.();
|
|
5132
|
+
this.playbackAttempt += 1;
|
|
5133
|
+
this.playbackResumePending = false;
|
|
5134
|
+
this.playbackBlocked = false;
|
|
5135
|
+
this.mediaPlaybackActive = true;
|
|
5136
|
+
this.remoteAudioEvidenceCandidateUntil = Math.max(this.remoteAudioEvidenceCandidateUntil, this.remoteAudioEvidenceNow() + REMOTE_AUDIO_EVIDENCE_READY_TAIL_MS);
|
|
5137
|
+
this.remotePlaybackState = "waiting";
|
|
5138
|
+
this.refreshAssistantPlaybackPresentation();
|
|
5139
|
+
this.emitPlaybackState("waiting");
|
|
5140
|
+
if (stream)
|
|
5141
|
+
this.rebuildRemoteAudioAnalyser(stream);
|
|
5142
|
+
this.resumeRemoteAudioContext();
|
|
5143
|
+
this.startRemoteAudioEvidenceSampling();
|
|
5144
|
+
});
|
|
5145
|
+
bind("waiting", () => {
|
|
5146
|
+
this.mediaPlaybackActive = false;
|
|
5147
|
+
this.resetRemoteAudioEvidence(false);
|
|
5148
|
+
this.applyRemotePlaybackState("waiting", true);
|
|
5149
|
+
});
|
|
5150
|
+
bind("pause", () => {
|
|
5151
|
+
this.mediaPlaybackActive = false;
|
|
5152
|
+
this.resetRemoteAudioEvidence(false);
|
|
5153
|
+
this.applyRemotePlaybackState("paused", true);
|
|
5154
|
+
});
|
|
5155
|
+
bind("ended", () => {
|
|
5156
|
+
this.mediaPlaybackActive = false;
|
|
5157
|
+
this.resetRemoteAudioEvidence(false);
|
|
5158
|
+
this.applyRemotePlaybackState("ended", true);
|
|
5159
|
+
});
|
|
5160
|
+
bind("volumechange", () => {
|
|
5161
|
+
if (this.audio.muted || this.audio.volume <= 0) {
|
|
5162
|
+
this.resetRemoteAudioEvidence(true);
|
|
5163
|
+
return;
|
|
5164
|
+
}
|
|
5165
|
+
this.resetRemoteAudioEvidenceAttack();
|
|
5166
|
+
this.resumeRemoteAudioContext();
|
|
5167
|
+
this.startRemoteAudioEvidenceSampling();
|
|
5168
|
+
});
|
|
5169
|
+
}
|
|
5170
|
+
unbindPlaybackState() {
|
|
5171
|
+
for (const binding of this.playbackStateBindings) {
|
|
5172
|
+
this.audio.removeEventListener(binding.type, binding.listener);
|
|
5173
|
+
}
|
|
5174
|
+
this.playbackStateBindings = [];
|
|
5175
|
+
}
|
|
5176
|
+
ensureRemoteAudioContext() {
|
|
5177
|
+
if (this.remoteAudioContext) {
|
|
5178
|
+
this.resumeRemoteAudioContext();
|
|
5179
|
+
return;
|
|
5180
|
+
}
|
|
5181
|
+
const AudioContextConstructor = window.AudioContext ||
|
|
5182
|
+
window
|
|
5183
|
+
.webkitAudioContext;
|
|
5184
|
+
if (!AudioContextConstructor)
|
|
5185
|
+
return;
|
|
5186
|
+
try {
|
|
5187
|
+
this.remoteAudioContext = new AudioContextConstructor({
|
|
5188
|
+
latencyHint: "interactive",
|
|
5189
|
+
});
|
|
5190
|
+
const context = this.remoteAudioContext;
|
|
5191
|
+
this.remoteAudioContextStateListener = () => {
|
|
5192
|
+
if (this.destroyed || this.remoteAudioContext !== context)
|
|
5193
|
+
return;
|
|
5194
|
+
if (context.state === "running") {
|
|
5195
|
+
this.startRemoteAudioEvidenceSampling();
|
|
5196
|
+
return;
|
|
5197
|
+
}
|
|
5198
|
+
this.resetRemoteAudioEvidence(true);
|
|
5199
|
+
};
|
|
5200
|
+
context.addEventListener?.("statechange", this.remoteAudioContextStateListener);
|
|
5201
|
+
this.resumeRemoteAudioContext();
|
|
5202
|
+
}
|
|
5203
|
+
catch {
|
|
5204
|
+
this.remoteAudioContext = null;
|
|
5205
|
+
this.remoteAudioContextStateListener = null;
|
|
5206
|
+
}
|
|
5207
|
+
}
|
|
5208
|
+
resumeRemoteAudioContext() {
|
|
5209
|
+
const context = this.remoteAudioContext;
|
|
5210
|
+
if (!context || context.state === "closed" || this.destroyed)
|
|
5211
|
+
return;
|
|
5212
|
+
if (context.state === "running") {
|
|
5213
|
+
this.startRemoteAudioEvidenceSampling();
|
|
5214
|
+
return;
|
|
5215
|
+
}
|
|
5216
|
+
const generation = this.playbackGeneration;
|
|
5217
|
+
const stream = this.audio.srcObject;
|
|
5218
|
+
void context
|
|
5219
|
+
.resume()
|
|
5220
|
+
.then(() => {
|
|
5221
|
+
if (this.remoteAudioContext === context &&
|
|
5222
|
+
generation === this.playbackGeneration &&
|
|
5223
|
+
this.audio.srcObject === stream &&
|
|
5224
|
+
this.playbackEventIsCurrent()) {
|
|
5225
|
+
this.startRemoteAudioEvidenceSampling();
|
|
5226
|
+
}
|
|
5227
|
+
})
|
|
5228
|
+
.catch(() => undefined);
|
|
5229
|
+
}
|
|
5230
|
+
rebuildRemoteAudioAnalyser(stream) {
|
|
5231
|
+
this.ensureRemoteAudioContext();
|
|
5232
|
+
const context = this.remoteAudioContext;
|
|
5233
|
+
if (!context || this.audio.srcObject !== stream)
|
|
5234
|
+
return;
|
|
5235
|
+
this.disconnectRemoteAudioAnalyser();
|
|
5236
|
+
try {
|
|
5237
|
+
const analyser = context.createAnalyser();
|
|
5238
|
+
analyser.fftSize = 512;
|
|
5239
|
+
analyser.smoothingTimeConstant = 0.78;
|
|
5240
|
+
const sink = context.createGain();
|
|
5241
|
+
sink.gain.value = 0;
|
|
5242
|
+
analyser.connect(sink);
|
|
5243
|
+
sink.connect(context.destination);
|
|
5244
|
+
this.remoteAudioAnalyser = analyser;
|
|
5245
|
+
this.remoteAudioSilentSink = sink;
|
|
5246
|
+
this.remoteAudioFloatBuffer = new Float32Array(analyser.fftSize);
|
|
5247
|
+
this.remoteAudioByteBuffer = new Uint8Array(analyser.fftSize);
|
|
5248
|
+
const tracks = stream
|
|
5249
|
+
.getAudioTracks()
|
|
5250
|
+
.filter((track) => track.readyState === "live");
|
|
5251
|
+
const contextWithTrackSource = context;
|
|
5252
|
+
for (const track of tracks) {
|
|
5253
|
+
let source;
|
|
5254
|
+
if (typeof contextWithTrackSource.createMediaStreamTrackSource ===
|
|
5255
|
+
"function") {
|
|
5256
|
+
source = contextWithTrackSource.createMediaStreamTrackSource(track);
|
|
5257
|
+
}
|
|
5258
|
+
else if (tracks.length === 1) {
|
|
5259
|
+
source = context.createMediaStreamSource(stream);
|
|
5260
|
+
}
|
|
5261
|
+
else if (typeof MediaStream === "function") {
|
|
5262
|
+
const isolatedStream = new MediaStream([track]);
|
|
5263
|
+
this.remoteAudioAnalysisStreams.push(isolatedStream);
|
|
5264
|
+
source = context.createMediaStreamSource(isolatedStream);
|
|
5265
|
+
}
|
|
5266
|
+
else {
|
|
5267
|
+
throw new Error("Multiple remote audio tracks cannot be analysed.");
|
|
5268
|
+
}
|
|
5269
|
+
source.connect(analyser);
|
|
5270
|
+
this.remoteAudioSources.push(source);
|
|
5271
|
+
this.remoteAudioAnalysedTracks.add(track);
|
|
5272
|
+
}
|
|
5273
|
+
if (this.remoteAudioSources.length === 0) {
|
|
5274
|
+
this.disconnectRemoteAudioAnalyser();
|
|
5275
|
+
}
|
|
5276
|
+
}
|
|
5277
|
+
catch {
|
|
5278
|
+
this.disconnectRemoteAudioAnalyser();
|
|
5279
|
+
}
|
|
5280
|
+
}
|
|
5281
|
+
disconnectRemoteAudioAnalyser() {
|
|
5282
|
+
for (const source of this.remoteAudioSources)
|
|
5283
|
+
source.disconnect();
|
|
5284
|
+
this.remoteAudioSources = [];
|
|
5285
|
+
this.remoteAudioAnalysisStreams = [];
|
|
5286
|
+
this.remoteAudioAnalysedTracks.clear();
|
|
5287
|
+
this.remoteAudioAnalyser?.disconnect();
|
|
5288
|
+
this.remoteAudioAnalyser = null;
|
|
5289
|
+
this.remoteAudioSilentSink?.disconnect();
|
|
5290
|
+
this.remoteAudioSilentSink = null;
|
|
5291
|
+
this.remoteAudioFloatBuffer = null;
|
|
5292
|
+
this.remoteAudioByteBuffer = null;
|
|
5293
|
+
}
|
|
5294
|
+
remoteAudioEvidenceNow() {
|
|
5295
|
+
const value = globalThis.performance?.now?.();
|
|
5296
|
+
return typeof value === "number" && Number.isFinite(value)
|
|
5297
|
+
? value
|
|
5298
|
+
: Date.now();
|
|
5299
|
+
}
|
|
5300
|
+
remoteAudioEvidenceVisualStateIsEligible() {
|
|
5301
|
+
return Boolean(!this.destroyed &&
|
|
5302
|
+
this.active &&
|
|
5303
|
+
this.voiceActive &&
|
|
5304
|
+
this.mediaPlaybackActive &&
|
|
5305
|
+
this.audio.srcObject &&
|
|
5306
|
+
!this.panel.classList.contains("error-state") &&
|
|
5307
|
+
!this.panel.classList.contains("ending-state") &&
|
|
5308
|
+
(this.remotePlaybackState === "waiting" ||
|
|
5309
|
+
this.remotePlaybackState === "playing"));
|
|
5310
|
+
}
|
|
5311
|
+
remoteAudioEvidenceCandidateIsCurrent(now) {
|
|
5312
|
+
return Boolean(this.remoteAudioEvidenceVisualStateIsEligible() &&
|
|
5313
|
+
(this.remoteAudioEvidenceAudible ||
|
|
5314
|
+
this.assistantState === "thinking" ||
|
|
5315
|
+
this.assistantState === "speaking" ||
|
|
5316
|
+
(this.remoteAudioEvidenceCandidateUntil > 0 &&
|
|
5317
|
+
now < this.remoteAudioEvidenceCandidateUntil)));
|
|
5318
|
+
}
|
|
5319
|
+
updateRemoteAudioEvidenceExpectation(previous, next) {
|
|
5320
|
+
const now = this.remoteAudioEvidenceNow();
|
|
5321
|
+
if (next === "thinking" || next === "speaking") {
|
|
5322
|
+
this.remoteAudioEvidenceCandidateUntil = Math.max(this.remoteAudioEvidenceCandidateUntil, now + REMOTE_AUDIO_EVIDENCE_EXPECTATION_MS);
|
|
5323
|
+
this.startRemoteAudioEvidenceSampling();
|
|
5324
|
+
return;
|
|
5325
|
+
}
|
|
5326
|
+
if (next === "ready" &&
|
|
5327
|
+
(previous === "thinking" ||
|
|
5328
|
+
previous === "speaking" ||
|
|
5329
|
+
this.remoteAudioEvidenceAudible)) {
|
|
5330
|
+
this.remoteAudioEvidenceCandidateUntil = Math.max(this.remoteAudioEvidenceCandidateUntil, now + REMOTE_AUDIO_EVIDENCE_READY_TAIL_MS);
|
|
5331
|
+
this.startRemoteAudioEvidenceSampling();
|
|
5332
|
+
return;
|
|
5333
|
+
}
|
|
5334
|
+
this.remoteAudioEvidenceCandidateUntil = 0;
|
|
5335
|
+
this.resetRemoteAudioEvidence(true);
|
|
5336
|
+
}
|
|
5337
|
+
remoteAudioTrackIsPlayable() {
|
|
5338
|
+
const stream = this.audio.srcObject;
|
|
5339
|
+
const currentTracks = typeof stream?.getAudioTracks === "function"
|
|
5340
|
+
? stream.getAudioTracks()
|
|
5341
|
+
: [];
|
|
5342
|
+
return Boolean(stream &&
|
|
5343
|
+
!this.audio.paused &&
|
|
5344
|
+
!this.audio.muted &&
|
|
5345
|
+
this.audio.volume > 0 &&
|
|
5346
|
+
this.remoteAudioAnalysedTracks.size > 0 &&
|
|
5347
|
+
[...this.remoteAudioAnalysedTracks].some((track) => currentTracks.some((candidate) => candidate === track) &&
|
|
5348
|
+
track.readyState === "live" &&
|
|
5349
|
+
track.enabled !== false &&
|
|
5350
|
+
track.muted !== true));
|
|
5351
|
+
}
|
|
5352
|
+
startRemoteAudioEvidenceSampling() {
|
|
5353
|
+
if (this.remoteAudioEvidenceTimer !== null ||
|
|
5354
|
+
!this.remoteAudioAnalyser ||
|
|
5355
|
+
(!this.remoteAudioFloatBuffer && !this.remoteAudioByteBuffer) ||
|
|
5356
|
+
this.remoteAudioContext?.state !== "running" ||
|
|
5357
|
+
!this.remoteAudioEvidenceCandidateIsCurrent(this.remoteAudioEvidenceNow())) {
|
|
5358
|
+
return;
|
|
5359
|
+
}
|
|
5360
|
+
const generation = this.remoteAudioEvidenceGeneration;
|
|
5361
|
+
const now = this.remoteAudioEvidenceNow();
|
|
5362
|
+
const inBurstWindow = this.remoteAudioEvidenceAudible ||
|
|
5363
|
+
(this.remoteAudioEvidenceCandidateUntil > 0 &&
|
|
5364
|
+
now < this.remoteAudioEvidenceCandidateUntil);
|
|
5365
|
+
const delay = inBurstWindow
|
|
5366
|
+
? this.remoteAudioTrackIsPlayable()
|
|
5367
|
+
? REMOTE_AUDIO_EVIDENCE_SAMPLE_MS
|
|
5368
|
+
: REMOTE_AUDIO_EVIDENCE_RECHECK_MS
|
|
5369
|
+
: REMOTE_AUDIO_EVIDENCE_IDLE_RECHECK_MS;
|
|
5370
|
+
this.remoteAudioEvidenceTimer = setTimeout(() => {
|
|
5371
|
+
this.remoteAudioEvidenceTimer = null;
|
|
5372
|
+
if (generation !== this.remoteAudioEvidenceGeneration)
|
|
5373
|
+
return;
|
|
5374
|
+
this.sampleRemoteAudioEvidence(generation);
|
|
5375
|
+
}, delay);
|
|
5376
|
+
}
|
|
5377
|
+
sampleRemoteAudioEvidence(generation) {
|
|
5378
|
+
if (generation !== this.remoteAudioEvidenceGeneration ||
|
|
5379
|
+
!this.remoteAudioEvidenceVisualStateIsEligible()) {
|
|
5380
|
+
return;
|
|
5381
|
+
}
|
|
5382
|
+
const now = this.remoteAudioEvidenceNow();
|
|
5383
|
+
if (!this.remoteAudioEvidenceCandidateIsCurrent(now)) {
|
|
5384
|
+
this.resetRemoteAudioEvidence(true);
|
|
5385
|
+
return;
|
|
5386
|
+
}
|
|
5387
|
+
if (!this.remoteAudioTrackIsPlayable()) {
|
|
5388
|
+
this.resetRemoteAudioEvidence(true);
|
|
5389
|
+
this.startRemoteAudioEvidenceSampling();
|
|
5390
|
+
return;
|
|
5391
|
+
}
|
|
5392
|
+
const sample = this.readRemoteAudioEvidence();
|
|
5393
|
+
if (!sample) {
|
|
5394
|
+
this.resetRemoteAudioEvidence(true);
|
|
5395
|
+
this.startRemoteAudioEvidenceSampling();
|
|
5396
|
+
return;
|
|
5397
|
+
}
|
|
5398
|
+
const attack = sample.rms >= REMOTE_AUDIO_EVIDENCE_ATTACK_RMS ||
|
|
5399
|
+
sample.peak >= REMOTE_AUDIO_EVIDENCE_ATTACK_PEAK;
|
|
5400
|
+
const sustain = sample.rms >= REMOTE_AUDIO_EVIDENCE_SUSTAIN_RMS ||
|
|
5401
|
+
sample.peak >= REMOTE_AUDIO_EVIDENCE_SUSTAIN_PEAK;
|
|
5402
|
+
if (!this.remoteAudioEvidenceAudible) {
|
|
5403
|
+
const mask = (1 << REMOTE_AUDIO_EVIDENCE_ATTACK_WINDOW) - 1;
|
|
5404
|
+
this.remoteAudioEvidenceAttackWindow =
|
|
5405
|
+
((this.remoteAudioEvidenceAttackWindow << 1) | Number(attack)) & mask;
|
|
5406
|
+
let hits = 0;
|
|
5407
|
+
for (let candidates = this.remoteAudioEvidenceAttackWindow; candidates > 0; candidates >>= 1) {
|
|
5408
|
+
hits += candidates & 1;
|
|
5409
|
+
}
|
|
5410
|
+
if (hits >= REMOTE_AUDIO_EVIDENCE_ATTACK_HITS) {
|
|
5411
|
+
this.remoteAudioEvidenceAudible = true;
|
|
5412
|
+
this.remoteAudioEvidenceQuietSince = null;
|
|
5413
|
+
this.remoteAudioEvidenceAttackWindow = 0;
|
|
5414
|
+
this.remoteAudioEvidenceCandidateUntil = Math.max(this.remoteAudioEvidenceCandidateUntil, now + REMOTE_AUDIO_EVIDENCE_READY_TAIL_MS);
|
|
5415
|
+
this.applyRemotePlaybackState("playing");
|
|
5416
|
+
}
|
|
5417
|
+
}
|
|
5418
|
+
else if (sustain) {
|
|
5419
|
+
this.remoteAudioEvidenceQuietSince = null;
|
|
5420
|
+
this.remoteAudioEvidenceCandidateUntil = Math.max(this.remoteAudioEvidenceCandidateUntil, now + REMOTE_AUDIO_EVIDENCE_READY_TAIL_MS);
|
|
5421
|
+
}
|
|
5422
|
+
else if (this.remoteAudioEvidenceQuietSince === null) {
|
|
5423
|
+
this.remoteAudioEvidenceQuietSince = now;
|
|
5424
|
+
}
|
|
5425
|
+
else if (now - this.remoteAudioEvidenceQuietSince >=
|
|
5426
|
+
REMOTE_AUDIO_EVIDENCE_RELEASE_MS) {
|
|
5427
|
+
this.remoteAudioEvidenceAudible = false;
|
|
5428
|
+
this.resetRemoteAudioEvidenceAttack();
|
|
5429
|
+
this.applyRemotePlaybackState("waiting");
|
|
5430
|
+
}
|
|
5431
|
+
this.startRemoteAudioEvidenceSampling();
|
|
5432
|
+
}
|
|
5433
|
+
readRemoteAudioEvidence() {
|
|
5434
|
+
const analyser = this.remoteAudioAnalyser;
|
|
5435
|
+
const context = this.remoteAudioContext;
|
|
5436
|
+
if (!analyser || !context || context.state !== "running")
|
|
5437
|
+
return null;
|
|
5438
|
+
let length = 0;
|
|
5439
|
+
let valueAt = null;
|
|
5440
|
+
let floatRead = false;
|
|
5441
|
+
if (this.remoteAudioFloatBuffer &&
|
|
5442
|
+
typeof analyser.getFloatTimeDomainData === "function") {
|
|
5443
|
+
try {
|
|
5444
|
+
analyser.getFloatTimeDomainData(this.remoteAudioFloatBuffer);
|
|
5445
|
+
length = this.remoteAudioFloatBuffer.length;
|
|
5446
|
+
valueAt = (index) => this.remoteAudioFloatBuffer?.[index] ?? 0;
|
|
5447
|
+
floatRead = true;
|
|
5448
|
+
}
|
|
5449
|
+
catch {
|
|
5450
|
+
floatRead = false;
|
|
5451
|
+
}
|
|
5452
|
+
}
|
|
5453
|
+
if (!floatRead) {
|
|
5454
|
+
if (!this.remoteAudioByteBuffer)
|
|
5455
|
+
return null;
|
|
5456
|
+
try {
|
|
5457
|
+
analyser.getByteTimeDomainData(this.remoteAudioByteBuffer);
|
|
5458
|
+
length = this.remoteAudioByteBuffer.length;
|
|
5459
|
+
valueAt = (index) => ((this.remoteAudioByteBuffer?.[index] ?? 128) - 128) / 128;
|
|
5460
|
+
}
|
|
5461
|
+
catch {
|
|
5462
|
+
return null;
|
|
5463
|
+
}
|
|
5464
|
+
}
|
|
5465
|
+
if (length === 0 || !valueAt)
|
|
5466
|
+
return null;
|
|
5467
|
+
let mean = 0;
|
|
5468
|
+
for (let index = 0; index < length; index += 1) {
|
|
5469
|
+
const value = valueAt(index);
|
|
5470
|
+
if (!Number.isFinite(value))
|
|
5471
|
+
return null;
|
|
5472
|
+
mean += value;
|
|
5473
|
+
}
|
|
5474
|
+
mean /= length;
|
|
5475
|
+
let sum = 0;
|
|
5476
|
+
let peak = 0;
|
|
5477
|
+
for (let index = 0; index < length; index += 1) {
|
|
5478
|
+
const centered = valueAt(index) - mean;
|
|
5479
|
+
if (!Number.isFinite(centered))
|
|
5480
|
+
return null;
|
|
5481
|
+
sum += centered * centered;
|
|
5482
|
+
peak = Math.max(peak, Math.abs(centered));
|
|
5483
|
+
}
|
|
5484
|
+
const volume = Math.min(1, Math.max(0, this.audio.volume));
|
|
5485
|
+
const rms = Math.sqrt(sum / length) * volume;
|
|
5486
|
+
peak *= volume;
|
|
5487
|
+
return Number.isFinite(rms) && Number.isFinite(peak) ? { rms, peak } : null;
|
|
4602
5488
|
}
|
|
4603
|
-
|
|
4604
|
-
this.
|
|
4605
|
-
|
|
5489
|
+
stopRemoteAudioEvidenceSampling() {
|
|
5490
|
+
if (this.remoteAudioEvidenceTimer !== null) {
|
|
5491
|
+
clearTimeout(this.remoteAudioEvidenceTimer);
|
|
5492
|
+
this.remoteAudioEvidenceTimer = null;
|
|
5493
|
+
}
|
|
5494
|
+
this.remoteAudioEvidenceGeneration += 1;
|
|
4606
5495
|
}
|
|
4607
|
-
|
|
4608
|
-
this.
|
|
4609
|
-
this.
|
|
5496
|
+
resetRemoteAudioEvidenceAttack() {
|
|
5497
|
+
this.remoteAudioEvidenceAttackWindow = 0;
|
|
5498
|
+
this.remoteAudioEvidenceQuietSince = null;
|
|
4610
5499
|
}
|
|
4611
|
-
|
|
4612
|
-
|
|
5500
|
+
resetRemoteAudioEvidenceState() {
|
|
5501
|
+
this.remoteAudioEvidenceAudible = false;
|
|
5502
|
+
this.resetRemoteAudioEvidenceAttack();
|
|
4613
5503
|
}
|
|
4614
|
-
|
|
4615
|
-
this.
|
|
4616
|
-
|
|
4617
|
-
|
|
4618
|
-
|
|
4619
|
-
this.
|
|
4620
|
-
}
|
|
4621
|
-
|
|
4622
|
-
|
|
4623
|
-
|
|
4624
|
-
|
|
4625
|
-
|
|
4626
|
-
this.
|
|
4627
|
-
|
|
4628
|
-
return;
|
|
4629
|
-
this.emitPlaybackState("paused");
|
|
4630
|
-
});
|
|
4631
|
-
this.audio.addEventListener("ended", () => {
|
|
4632
|
-
if (!this.playbackEventIsCurrent())
|
|
4633
|
-
return;
|
|
4634
|
-
this.emitPlaybackState("ended");
|
|
4635
|
-
});
|
|
5504
|
+
resetRemoteAudioEvidence(emitWaiting) {
|
|
5505
|
+
const wasAudible = this.remoteAudioEvidenceAudible || this.remotePlaybackState === "playing";
|
|
5506
|
+
this.stopRemoteAudioEvidenceSampling();
|
|
5507
|
+
this.resetRemoteAudioEvidenceState();
|
|
5508
|
+
if (emitWaiting && wasAudible) {
|
|
5509
|
+
this.applyRemotePlaybackState("waiting", true);
|
|
5510
|
+
}
|
|
5511
|
+
}
|
|
5512
|
+
applyRemotePlaybackState(state, force = false) {
|
|
5513
|
+
if (!force && this.remotePlaybackState === state)
|
|
5514
|
+
return;
|
|
5515
|
+
this.remotePlaybackState = state;
|
|
5516
|
+
this.refreshAssistantPlaybackPresentation();
|
|
5517
|
+
this.emitPlaybackState(state);
|
|
4636
5518
|
}
|
|
4637
5519
|
emitPlaybackState(state) {
|
|
4638
5520
|
this.callbacks.onPlaybackState({
|
|
4639
5521
|
state,
|
|
4640
|
-
audible: state === "playing" &&
|
|
5522
|
+
audible: state === "playing" && this.remoteAudioIsAudible(),
|
|
4641
5523
|
utteranceId: null,
|
|
4642
5524
|
sampledAt: new Date().toISOString(),
|
|
4643
5525
|
});
|
|
@@ -4649,6 +5531,7 @@ class WidgetView {
|
|
|
4649
5531
|
applyStatus(value) {
|
|
4650
5532
|
this.status.textContent = value;
|
|
4651
5533
|
this.status.setAttribute("aria-label", value);
|
|
5534
|
+
this.status.title = value;
|
|
4652
5535
|
this.syncSessionModeUi();
|
|
4653
5536
|
if (this.active)
|
|
4654
5537
|
this.syncLauncherState();
|
|
@@ -4880,6 +5763,57 @@ class WidgetView {
|
|
|
4880
5763
|
rootElement() {
|
|
4881
5764
|
return this.host;
|
|
4882
5765
|
}
|
|
5766
|
+
/** Live owns this same playback element; never create a second audible sink. */
|
|
5767
|
+
livePlaybackElement() { return this.audio; }
|
|
5768
|
+
/** Current remote PCM activity, independent of the element's continuous
|
|
5769
|
+
* playing state. Null is unavailable evidence, never proof of silence.
|
|
5770
|
+
* Reuses the existing analyser and never starts or authorizes playback. */
|
|
5771
|
+
livePlaybackActivity() {
|
|
5772
|
+
const stream = this.audio.srcObject;
|
|
5773
|
+
if (!stream || this.audio.paused || this.audio.ended) {
|
|
5774
|
+
this.livePlaybackObservation = null;
|
|
5775
|
+
return false;
|
|
5776
|
+
}
|
|
5777
|
+
const now = performance.now();
|
|
5778
|
+
if (!Number.isFinite(now) || now < 0)
|
|
5779
|
+
return null;
|
|
5780
|
+
if (!this.livePlaybackObservation || this.livePlaybackObservation.source !== stream) {
|
|
5781
|
+
this.livePlaybackObservation = { source: stream, quietSince: null, lastAt: now };
|
|
5782
|
+
this.rebuildRemoteAudioAnalyser(stream);
|
|
5783
|
+
}
|
|
5784
|
+
const observation = this.livePlaybackObservation;
|
|
5785
|
+
if (now < observation.lastAt) {
|
|
5786
|
+
observation.quietSince = null;
|
|
5787
|
+
observation.lastAt = now;
|
|
5788
|
+
return null;
|
|
5789
|
+
}
|
|
5790
|
+
observation.lastAt = now;
|
|
5791
|
+
const sample = this.readRemoteAudioEvidence();
|
|
5792
|
+
if (!sample) {
|
|
5793
|
+
observation.quietSince = null;
|
|
5794
|
+
return null;
|
|
5795
|
+
}
|
|
5796
|
+
if (sample.rms >= REMOTE_AUDIO_EVIDENCE_SUSTAIN_RMS || sample.peak >= REMOTE_AUDIO_EVIDENCE_SUSTAIN_PEAK) {
|
|
5797
|
+
observation.quietSince = null;
|
|
5798
|
+
return true;
|
|
5799
|
+
}
|
|
5800
|
+
observation.quietSince ?? (observation.quietSince = now);
|
|
5801
|
+
return now - observation.quietSince < REMOTE_AUDIO_EVIDENCE_RELEASE_MS;
|
|
5802
|
+
}
|
|
5803
|
+
/** Observe a stopped render sink across several audio quanta. This proves
|
|
5804
|
+
* local playback drain only, never provider closure or acoustic echo quality. */
|
|
5805
|
+
livePlaybackDrained() {
|
|
5806
|
+
if (!this.audio.paused && !this.audio.ended) {
|
|
5807
|
+
this.liveDrainObservation = null;
|
|
5808
|
+
return false;
|
|
5809
|
+
}
|
|
5810
|
+
const now = performance.now();
|
|
5811
|
+
if (!this.liveDrainObservation || this.liveDrainObservation.source !== this.audio.srcObject || now < this.liveDrainObservation.since) {
|
|
5812
|
+
this.liveDrainObservation = { source: this.audio.srcObject, since: now };
|
|
5813
|
+
return false;
|
|
5814
|
+
}
|
|
5815
|
+
return now - this.liveDrainObservation.since >= 80;
|
|
5816
|
+
}
|
|
4883
5817
|
get hasFocus() {
|
|
4884
5818
|
return document.activeElement === this.host;
|
|
4885
5819
|
}
|
|
@@ -4918,17 +5852,66 @@ class WidgetView {
|
|
|
4918
5852
|
this.clearAssistantReadyVisualTimer();
|
|
4919
5853
|
this.applyAssistantState(state);
|
|
4920
5854
|
}
|
|
5855
|
+
assistantPresentationState() {
|
|
5856
|
+
if (this.voiceActive &&
|
|
5857
|
+
this.manualTurn &&
|
|
5858
|
+
!this.pushActive &&
|
|
5859
|
+
this.assistantState === "listening") {
|
|
5860
|
+
return "ready";
|
|
5861
|
+
}
|
|
5862
|
+
if (this.voiceActive &&
|
|
5863
|
+
this.assistantState === "speaking" &&
|
|
5864
|
+
this.remotePlaybackState !== "playing") {
|
|
5865
|
+
return "thinking";
|
|
5866
|
+
}
|
|
5867
|
+
if (this.assistantState === "listening" ||
|
|
5868
|
+
this.assistantState === "thinking" ||
|
|
5869
|
+
this.assistantState === "speaking") {
|
|
5870
|
+
return this.assistantState;
|
|
5871
|
+
}
|
|
5872
|
+
return "ready";
|
|
5873
|
+
}
|
|
5874
|
+
assistantPresentationMessage() {
|
|
5875
|
+
if (this.voiceActive && this.remotePlaybackState === "blocked") {
|
|
5876
|
+
return this.messages.audioPaused;
|
|
5877
|
+
}
|
|
5878
|
+
const state = this.assistantPresentationState();
|
|
5879
|
+
if (this.voiceActive &&
|
|
5880
|
+
this.manualTurn &&
|
|
5881
|
+
!this.pushActive &&
|
|
5882
|
+
state === "ready") {
|
|
5883
|
+
return this.messages.usePushToTalk;
|
|
5884
|
+
}
|
|
5885
|
+
return this.messages[state];
|
|
5886
|
+
}
|
|
5887
|
+
refreshAssistantPlaybackPresentation() {
|
|
5888
|
+
if (this.assistantState !== "speaking" &&
|
|
5889
|
+
!(this.voiceActive && this.remotePlaybackState === "blocked"))
|
|
5890
|
+
return;
|
|
5891
|
+
this.setActivity(this.assistantPresentationState());
|
|
5892
|
+
const message = this.assistantPresentationMessage();
|
|
5893
|
+
if (this.muted && this.voiceActive) {
|
|
5894
|
+
this.statusBeforeMute = message;
|
|
5895
|
+
this.setStatus(this.messages.muted);
|
|
5896
|
+
return;
|
|
5897
|
+
}
|
|
5898
|
+
this.setStatus(message);
|
|
5899
|
+
}
|
|
4921
5900
|
applyAssistantState(state) {
|
|
5901
|
+
const previousState = this.assistantState;
|
|
4922
5902
|
this.assistantState = state;
|
|
4923
|
-
this.
|
|
5903
|
+
this.updateRemoteAudioEvidenceExpectation(previousState, state);
|
|
5904
|
+
const presentationState = this.assistantPresentationState();
|
|
5905
|
+
const presentationMessage = this.assistantPresentationMessage();
|
|
5906
|
+
this.setActivity(presentationState);
|
|
4924
5907
|
if (this.muted && this.voiceActive) {
|
|
4925
|
-
this.statusBeforeMute =
|
|
5908
|
+
this.statusBeforeMute = presentationMessage;
|
|
4926
5909
|
this.setStatus(this.messages.muted);
|
|
4927
5910
|
}
|
|
4928
5911
|
else {
|
|
4929
|
-
this.setStatus(
|
|
5912
|
+
this.setStatus(presentationMessage);
|
|
4930
5913
|
}
|
|
4931
|
-
if (state === "listening") {
|
|
5914
|
+
if (state === "listening" && presentationState === "listening") {
|
|
4932
5915
|
this.assistantCaptionPhase = "none";
|
|
4933
5916
|
this.clearPendingCaptions("assistant");
|
|
4934
5917
|
this.ensurePendingCaption("user", this.messages.listening);
|
|
@@ -4939,13 +5922,15 @@ class WidgetView {
|
|
|
4939
5922
|
this.assistantCaptionPhase = "none";
|
|
4940
5923
|
}
|
|
4941
5924
|
if (this.assistantCaptionPhase === "none") {
|
|
4942
|
-
this.ensurePendingCaption("assistant", this.messages[
|
|
5925
|
+
this.ensurePendingCaption("assistant", this.messages[presentationState]);
|
|
4943
5926
|
}
|
|
4944
5927
|
}
|
|
4945
5928
|
else {
|
|
4946
5929
|
this.clearPendingCaptions(undefined, this.assistantCaptionPhase === "final");
|
|
4947
5930
|
}
|
|
4948
|
-
if (state === "speaking" &&
|
|
5931
|
+
if (state === "speaking" &&
|
|
5932
|
+
this.audio.paused &&
|
|
5933
|
+
this.remotePlaybackState !== "playing") {
|
|
4949
5934
|
void this.playRemoteAudio();
|
|
4950
5935
|
}
|
|
4951
5936
|
this.setAmbientActive(state !== "ready");
|
|
@@ -5002,6 +5987,7 @@ class WidgetView {
|
|
|
5002
5987
|
this.assistantState = "connecting";
|
|
5003
5988
|
this.setActivity("connecting");
|
|
5004
5989
|
this.voiceActive = mode === "voice";
|
|
5990
|
+
this.authorizeVoicePlayback(this.voiceActive);
|
|
5005
5991
|
this.modeTransitionPending = null;
|
|
5006
5992
|
this.panel.classList.toggle("voice-session", this.voiceActive);
|
|
5007
5993
|
this.panel.classList.remove("feedback-state");
|
|
@@ -5065,7 +6051,7 @@ class WidgetView {
|
|
|
5065
6051
|
this.conversation.classList.add("visible");
|
|
5066
6052
|
this.controls.classList.add("visible");
|
|
5067
6053
|
this.setComposerEnabled(true);
|
|
5068
|
-
this.setStatus(this.
|
|
6054
|
+
this.setStatus(this.assistantPresentationMessage());
|
|
5069
6055
|
this.clearPendingCaptions();
|
|
5070
6056
|
this.setAmbientActive(false);
|
|
5071
6057
|
if (this.sessionStartedAt === null)
|
|
@@ -5118,6 +6104,7 @@ class WidgetView {
|
|
|
5118
6104
|
actions.hidden = actions.childElementCount === 0;
|
|
5119
6105
|
group.hidden = false;
|
|
5120
6106
|
this.captions.scrollTop = 0;
|
|
6107
|
+
this.captionsPinnedToBottom = true;
|
|
5121
6108
|
}
|
|
5122
6109
|
defaultWelcomeMessage() {
|
|
5123
6110
|
return this.messages.messagePlaceholder;
|
|
@@ -5138,6 +6125,7 @@ class WidgetView {
|
|
|
5138
6125
|
group.hidden = false;
|
|
5139
6126
|
this.pendingWelcomeBubble = bubble;
|
|
5140
6127
|
this.captions.scrollTop = 0;
|
|
6128
|
+
this.captionsPinnedToBottom = true;
|
|
5141
6129
|
}
|
|
5142
6130
|
clearPendingWelcomeSkeleton() {
|
|
5143
6131
|
const bubble = this.pendingWelcomeBubble;
|
|
@@ -5158,14 +6146,32 @@ class WidgetView {
|
|
|
5158
6146
|
this.captions.prepend(empty);
|
|
5159
6147
|
}
|
|
5160
6148
|
}
|
|
5161
|
-
scrollCaptionsToBottom() {
|
|
6149
|
+
scrollCaptionsToBottom(force = false) {
|
|
6150
|
+
if (!force && !this.captionsPinnedToBottom)
|
|
6151
|
+
return;
|
|
5162
6152
|
this.captions.scrollTop = this.captions.scrollHeight;
|
|
6153
|
+
this.captionsPinnedToBottom = true;
|
|
6154
|
+
}
|
|
6155
|
+
updateCaptionsPinnedState() {
|
|
6156
|
+
const remaining = this.captions.scrollHeight -
|
|
6157
|
+
this.captions.clientHeight -
|
|
6158
|
+
this.captions.scrollTop;
|
|
6159
|
+
this.captionsPinnedToBottom = remaining <= CAPTION_BOTTOM_PIN_THRESHOLD_PX;
|
|
5163
6160
|
}
|
|
5164
6161
|
addCaption(role, text, final, options = {}) {
|
|
5165
6162
|
if (!this.captionsEnabled)
|
|
5166
6163
|
return;
|
|
5167
6164
|
const restored = options.restored === true;
|
|
5168
|
-
|
|
6165
|
+
const partialKey = options.liveFragmentGroup
|
|
6166
|
+
? `${role}-live-fragment`
|
|
6167
|
+
: `${role}-partial`;
|
|
6168
|
+
if (final &&
|
|
6169
|
+
role === "assistant" &&
|
|
6170
|
+
options.sourceTurnId &&
|
|
6171
|
+
Array.from(this.captions.querySelectorAll("p[data-source-turn-id]")).some((line) => line.dataset.sourceTurnId === options.sourceTurnId))
|
|
6172
|
+
return;
|
|
6173
|
+
if (!final && role === "user" && this.assistantState !== "listening" &&
|
|
6174
|
+
!options.liveFragmentGroup) {
|
|
5169
6175
|
return;
|
|
5170
6176
|
}
|
|
5171
6177
|
this.captions.querySelector('[data-role="empty"]')?.remove();
|
|
@@ -5178,10 +6184,15 @@ class WidgetView {
|
|
|
5178
6184
|
this.ensurePendingCaption(role, role === "user" ? this.messages.listening : this.messages.thinking);
|
|
5179
6185
|
return;
|
|
5180
6186
|
}
|
|
5181
|
-
let partial = this.captions.querySelector(`[data-caption="${
|
|
6187
|
+
let partial = this.captions.querySelector(`[data-caption="${partialKey}"]`);
|
|
5182
6188
|
if (!partial) {
|
|
6189
|
+
if (options.liveFragmentGroup) {
|
|
6190
|
+
this.captions
|
|
6191
|
+
.querySelector(`[data-caption="${role}-partial"].pending`)
|
|
6192
|
+
?.remove();
|
|
6193
|
+
}
|
|
5183
6194
|
partial = document.createElement("p");
|
|
5184
|
-
partial.dataset.caption =
|
|
6195
|
+
partial.dataset.caption = partialKey;
|
|
5185
6196
|
this.captions.append(partial);
|
|
5186
6197
|
}
|
|
5187
6198
|
partial.classList.remove(role === "assistant" ? "user" : "assistant", "pending", "typing", "settled");
|
|
@@ -5191,7 +6202,7 @@ class WidgetView {
|
|
|
5191
6202
|
partial.removeAttribute("aria-label");
|
|
5192
6203
|
this.renderLiveCaption(partial, safe);
|
|
5193
6204
|
this.scrollCaptionsToBottom();
|
|
5194
|
-
this.addCompactCaption(role, safe, false, role === "user" ? this.messages.listening : this.messages.thinking, true);
|
|
6205
|
+
this.addCompactCaption(role, safe, false, role === "user" ? this.messages.listening : this.messages.thinking, true, options.liveFragmentGroup);
|
|
5195
6206
|
return;
|
|
5196
6207
|
}
|
|
5197
6208
|
if (!safe) {
|
|
@@ -5200,7 +6211,7 @@ class WidgetView {
|
|
|
5200
6211
|
this.clearPendingCaptions(role);
|
|
5201
6212
|
return;
|
|
5202
6213
|
}
|
|
5203
|
-
let line = this.captions.querySelector(`[data-caption="${
|
|
6214
|
+
let line = this.captions.querySelector(`[data-caption="${partialKey}"]`);
|
|
5204
6215
|
if (!line) {
|
|
5205
6216
|
line = document.createElement("p");
|
|
5206
6217
|
this.captions.append(line);
|
|
@@ -5212,13 +6223,64 @@ class WidgetView {
|
|
|
5212
6223
|
line.removeAttribute("aria-label");
|
|
5213
6224
|
this.renderLiveCaption(line, safe, this.captionRenderedHeight(line), !restored);
|
|
5214
6225
|
line.dataset.caption = `${role}-${crypto.randomUUID()}`;
|
|
6226
|
+
if (role === "assistant" && options.sourceTurnId) {
|
|
6227
|
+
line.dataset.sourceTurnId = options.sourceTurnId;
|
|
6228
|
+
}
|
|
6229
|
+
if (role === "user" && options.localQuestionId) {
|
|
6230
|
+
line.dataset.localQuestionId = options.localQuestionId;
|
|
6231
|
+
}
|
|
6232
|
+
else {
|
|
6233
|
+
delete line.dataset.localQuestionId;
|
|
6234
|
+
}
|
|
5215
6235
|
const messages = this.captions.querySelectorAll(":scope > p[data-caption]");
|
|
5216
6236
|
for (let index = 0; index < messages.length - 20; index += 1) {
|
|
5217
6237
|
messages[index]?.remove();
|
|
5218
6238
|
}
|
|
5219
|
-
this.scrollCaptionsToBottom();
|
|
5220
|
-
if (!restored)
|
|
5221
|
-
this.addCompactCaption(role, safe, true);
|
|
6239
|
+
this.scrollCaptionsToBottom(role === "user" && !restored);
|
|
6240
|
+
if (!restored) {
|
|
6241
|
+
this.addCompactCaption(role, safe, true, undefined, false, options.liveFragmentGroup);
|
|
6242
|
+
}
|
|
6243
|
+
this.placeCtaOffer();
|
|
6244
|
+
}
|
|
6245
|
+
showCtaOffer(value, options = {}) {
|
|
6246
|
+
const offer = (0, ctaOffer_js_1.parseCtaOffer)(value);
|
|
6247
|
+
if (!offer || this.ctaCard?.offer.offerId === offer.offerId)
|
|
6248
|
+
return;
|
|
6249
|
+
this.clearCtaOffer();
|
|
6250
|
+
this.ctaCard = new ctaOffer_js_1.CtaOfferCard(offer, this.messages, (result) => this.callbacks.onCtaResult?.(result) ?? false, () => this.require(".end").focus({ preventScroll: true }), options.announce !== false);
|
|
6251
|
+
this.placeCtaOffer();
|
|
6252
|
+
}
|
|
6253
|
+
clearCtaOffer() {
|
|
6254
|
+
this.ctaCard?.destroy();
|
|
6255
|
+
this.ctaCard = null;
|
|
6256
|
+
this.ctaSlot?.remove();
|
|
6257
|
+
this.ctaSlot = null;
|
|
6258
|
+
}
|
|
6259
|
+
placeCtaOffer() {
|
|
6260
|
+
const card = this.ctaCard;
|
|
6261
|
+
if (!card)
|
|
6262
|
+
return;
|
|
6263
|
+
const source = Array.from(this.captions.querySelectorAll("p[data-source-turn-id]")).find((line) => line.dataset.sourceTurnId === card.offer.sourceTurnId);
|
|
6264
|
+
if (!this.compact && this.captionsEnabled && source) {
|
|
6265
|
+
const pinned = this.captions.scrollHeight -
|
|
6266
|
+
this.captions.scrollTop -
|
|
6267
|
+
this.captions.clientHeight <=
|
|
6268
|
+
CAPTION_BOTTOM_PIN_THRESHOLD_PX;
|
|
6269
|
+
if (source.nextElementSibling !== card.element)
|
|
6270
|
+
source.after(card.element);
|
|
6271
|
+
if (pinned)
|
|
6272
|
+
this.scrollCaptionsToBottom();
|
|
6273
|
+
return;
|
|
6274
|
+
}
|
|
6275
|
+
if (!this.ctaSlot) {
|
|
6276
|
+
this.ctaSlot = document.createElement("div");
|
|
6277
|
+
this.ctaSlot.className = "cta-action-slot";
|
|
6278
|
+
}
|
|
6279
|
+
const slotParent = this.compact ? this.panel : this.conversation;
|
|
6280
|
+
if (this.ctaSlot.parentElement !== slotParent)
|
|
6281
|
+
slotParent.prepend(this.ctaSlot);
|
|
6282
|
+
if (card.element.parentElement !== this.ctaSlot)
|
|
6283
|
+
this.ctaSlot.append(card.element);
|
|
5222
6284
|
}
|
|
5223
6285
|
ensurePendingCaption(role, label) {
|
|
5224
6286
|
if (!this.captionsEnabled)
|
|
@@ -5458,8 +6520,13 @@ class WidgetView {
|
|
|
5458
6520
|
}
|
|
5459
6521
|
addCompactCaption(role, text, final, pendingLabel = role === "user"
|
|
5460
6522
|
? this.messages.listening
|
|
5461
|
-
: this.messages.thinking, live = false) {
|
|
5462
|
-
const partialKey = `${role}-partial`;
|
|
6523
|
+
: this.messages.thinking, live = false, fragmentGroup = false) {
|
|
6524
|
+
const partialKey = fragmentGroup ? `${role}-live-fragment` : `${role}-partial`;
|
|
6525
|
+
if (fragmentGroup) {
|
|
6526
|
+
const placeholder = this.compactCaptions.querySelector(`[data-compact-caption="${role}-partial"].pending`);
|
|
6527
|
+
if (placeholder)
|
|
6528
|
+
this.removeCompactCaption(placeholder);
|
|
6529
|
+
}
|
|
5463
6530
|
const partialLines = [
|
|
5464
6531
|
...this.compactCaptions.querySelectorAll(`[data-compact-caption="${partialKey}"]`),
|
|
5465
6532
|
];
|
|
@@ -5478,7 +6545,7 @@ class WidgetView {
|
|
|
5478
6545
|
line.classList.remove("leaving");
|
|
5479
6546
|
line.removeAttribute("aria-hidden");
|
|
5480
6547
|
}
|
|
5481
|
-
if (!line && final) {
|
|
6548
|
+
if (!line && final && !fragmentGroup) {
|
|
5482
6549
|
line =
|
|
5483
6550
|
[...this.compactCaptions.children]
|
|
5484
6551
|
.reverse()
|
|
@@ -5501,7 +6568,7 @@ class WidgetView {
|
|
|
5501
6568
|
if (!line) {
|
|
5502
6569
|
line = document.createElement("div");
|
|
5503
6570
|
line.dataset.compactCaption = partialKey;
|
|
5504
|
-
const activeAssistant = final && role === "user"
|
|
6571
|
+
const activeAssistant = final && role === "user" && !fragmentGroup
|
|
5505
6572
|
? this.compactCaptions.querySelector('[data-compact-caption="assistant-partial"]')
|
|
5506
6573
|
: null;
|
|
5507
6574
|
if (activeAssistant) {
|
|
@@ -5694,6 +6761,7 @@ class WidgetView {
|
|
|
5694
6761
|
this.resolveVisualContext(false);
|
|
5695
6762
|
if (this.currentConfirmation)
|
|
5696
6763
|
this.resolveConfirmation(false);
|
|
6764
|
+
this.releaseActivePushToTalk();
|
|
5697
6765
|
this.currentConfirmation = value;
|
|
5698
6766
|
this.setCompact(false, false);
|
|
5699
6767
|
this.openPanel();
|
|
@@ -5721,11 +6789,24 @@ class WidgetView {
|
|
|
5721
6789
|
});
|
|
5722
6790
|
}
|
|
5723
6791
|
showActionState(status) {
|
|
6792
|
+
const actionWasRunning = this.actionStateRunning;
|
|
5724
6793
|
this.setActionStateRunning(status === "running");
|
|
5725
6794
|
if (this.actionStateRunning) {
|
|
5726
6795
|
this.clearAssistantReadyVisualTimer();
|
|
5727
6796
|
this.assistantState = "thinking";
|
|
5728
|
-
this.
|
|
6797
|
+
const assistantCaption = this.captions.querySelector('[data-caption="assistant-partial"]');
|
|
6798
|
+
if (!assistantCaption || assistantCaption.classList.contains("pending")) {
|
|
6799
|
+
this.ensurePendingCaption("assistant", this.messages.thinking);
|
|
6800
|
+
}
|
|
6801
|
+
this.actionPendingAssistantCaption =
|
|
6802
|
+
this.captions.querySelector('[data-caption="assistant-partial"].pending');
|
|
6803
|
+
this.actionPendingCompactAssistantCaption =
|
|
6804
|
+
this.compactCaptions.querySelector('[data-compact-caption="assistant-partial"].pending');
|
|
6805
|
+
}
|
|
6806
|
+
else if (actionWasRunning ||
|
|
6807
|
+
this.actionPendingAssistantCaption ||
|
|
6808
|
+
this.actionPendingCompactAssistantCaption) {
|
|
6809
|
+
this.retireActionPendingCaption();
|
|
5729
6810
|
}
|
|
5730
6811
|
this.confirmation.classList.remove("visible");
|
|
5731
6812
|
this.currentConfirmation = null;
|
|
@@ -5752,12 +6833,41 @@ class WidgetView {
|
|
|
5752
6833
|
this.restoreVoicePresenceAfterPrompt();
|
|
5753
6834
|
this.syncHeaderActions();
|
|
5754
6835
|
}
|
|
6836
|
+
retireActionPendingCaption() {
|
|
6837
|
+
const caption = this.actionPendingAssistantCaption;
|
|
6838
|
+
const compactCaption = this.actionPendingCompactAssistantCaption;
|
|
6839
|
+
this.actionPendingAssistantCaption = null;
|
|
6840
|
+
this.actionPendingCompactAssistantCaption = null;
|
|
6841
|
+
if (caption?.isConnected &&
|
|
6842
|
+
caption.classList.contains("pending") &&
|
|
6843
|
+
caption.querySelector(".typing-dots")) {
|
|
6844
|
+
this.cancelCaptionHeightGlide(caption);
|
|
6845
|
+
caption.remove();
|
|
6846
|
+
}
|
|
6847
|
+
if (compactCaption?.isConnected &&
|
|
6848
|
+
compactCaption.classList.contains("pending") &&
|
|
6849
|
+
compactCaption.querySelector(".typing-dots")) {
|
|
6850
|
+
this.removeCompactCaption(compactCaption);
|
|
6851
|
+
}
|
|
6852
|
+
const providerCaption = this.captions.querySelector('[data-caption="assistant-partial"]:not(.pending)');
|
|
6853
|
+
if (this.assistantState === "thinking" && !providerCaption) {
|
|
6854
|
+
const previousState = this.assistantState;
|
|
6855
|
+
this.assistantState = "ready";
|
|
6856
|
+
this.updateRemoteAudioEvidenceExpectation(previousState, "ready");
|
|
6857
|
+
}
|
|
6858
|
+
}
|
|
5755
6859
|
dismissActionState() {
|
|
6860
|
+
const actionWasRunning = this.actionStateRunning;
|
|
5756
6861
|
this.setActionStateRunning(false);
|
|
6862
|
+
if (actionWasRunning ||
|
|
6863
|
+
this.actionPendingAssistantCaption ||
|
|
6864
|
+
this.actionPendingCompactAssistantCaption) {
|
|
6865
|
+
this.retireActionPendingCaption();
|
|
6866
|
+
}
|
|
5757
6867
|
this.confirmation.classList.remove("visible");
|
|
5758
6868
|
this.currentConfirmation = null;
|
|
5759
6869
|
this.dialogFocus.dismiss(this.confirmation);
|
|
5760
|
-
this.setStatus(this.
|
|
6870
|
+
this.setStatus(this.assistantPresentationMessage());
|
|
5761
6871
|
this.setActivity("ready");
|
|
5762
6872
|
this.setAmbientActive(false);
|
|
5763
6873
|
this.restoreVoicePresenceAfterPrompt();
|
|
@@ -5775,6 +6885,7 @@ class WidgetView {
|
|
|
5775
6885
|
this.resolveVisualContext(false);
|
|
5776
6886
|
if (this.currentConfirmation)
|
|
5777
6887
|
this.resolveConfirmation(false);
|
|
6888
|
+
this.releaseActivePushToTalk();
|
|
5778
6889
|
this.currentVisualRequest = value;
|
|
5779
6890
|
this.setCompact(false, false);
|
|
5780
6891
|
this.openPanel();
|
|
@@ -5804,6 +6915,7 @@ class WidgetView {
|
|
|
5804
6915
|
if (this.currentHandoffContextRequest || this.handoffRequestPreparing) {
|
|
5805
6916
|
return;
|
|
5806
6917
|
}
|
|
6918
|
+
this.releaseActivePushToTalk();
|
|
5807
6919
|
this.handoffRequestPreparing = true;
|
|
5808
6920
|
this.setCompact(false, false);
|
|
5809
6921
|
this.openPanel();
|
|
@@ -5854,6 +6966,7 @@ class WidgetView {
|
|
|
5854
6966
|
}
|
|
5855
6967
|
if (this.currentConfirmation)
|
|
5856
6968
|
this.resolveConfirmation(false);
|
|
6969
|
+
this.releaseActivePushToTalk();
|
|
5857
6970
|
this.currentHandoffContextRequest = value;
|
|
5858
6971
|
}
|
|
5859
6972
|
this.setCompact(false, false);
|
|
@@ -5907,6 +7020,7 @@ class WidgetView {
|
|
|
5907
7020
|
if (this.currentPageAssistanceRequest) {
|
|
5908
7021
|
this.resolvePageAssistance("decline", false);
|
|
5909
7022
|
}
|
|
7023
|
+
this.releaseActivePushToTalk();
|
|
5910
7024
|
this.currentPageAssistanceRequest = value;
|
|
5911
7025
|
this.setCompact(false, false);
|
|
5912
7026
|
this.openPanel();
|
|
@@ -5997,6 +7111,19 @@ class WidgetView {
|
|
|
5997
7111
|
}
|
|
5998
7112
|
setPageAssistancePersistentAllowed(value) {
|
|
5999
7113
|
this.require('[data-role="page-assistance-revoke"]').hidden = !value;
|
|
7114
|
+
this.syncLegalDetailsAvailability();
|
|
7115
|
+
this.syncStartAvailability();
|
|
7116
|
+
}
|
|
7117
|
+
syncLegalDetailsAvailability() {
|
|
7118
|
+
const available = Boolean(this.config.consent?.disclosure ||
|
|
7119
|
+
this.require('[data-role="legal-scopes"]').childElementCount > 0 ||
|
|
7120
|
+
!this.require('[data-role="legal-links"]').hidden ||
|
|
7121
|
+
!this.require('[data-role="page-assistance-revoke"]')
|
|
7122
|
+
.hidden);
|
|
7123
|
+
this.require('[data-role="legal-open"]').hidden =
|
|
7124
|
+
!available;
|
|
7125
|
+
this.require('[data-role="session-legal-open"]').hidden =
|
|
7126
|
+
!available;
|
|
6000
7127
|
}
|
|
6001
7128
|
setSupportCompanion(linked) {
|
|
6002
7129
|
this.supportCompanion = linked;
|
|
@@ -6033,19 +7160,24 @@ class WidgetView {
|
|
|
6033
7160
|
}
|
|
6034
7161
|
}
|
|
6035
7162
|
setPaused(value) {
|
|
7163
|
+
if (value && this.pushActive)
|
|
7164
|
+
this.setPushActive(false);
|
|
6036
7165
|
this.paused = value;
|
|
6037
7166
|
this.assistantState = value ? "paused" : "ready";
|
|
6038
7167
|
this.setControlLabel("pause", value ? this.messages.resumeActions : this.messages.pauseActions);
|
|
6039
7168
|
this.setControlIcon("pause", value ? lucide_1.Play : lucide_1.Pause);
|
|
6040
7169
|
this.require('[data-role="pause"]').setAttribute("aria-pressed", String(value));
|
|
6041
|
-
this.setStatus(value ? this.messages.paused : this.
|
|
7170
|
+
this.setStatus(value ? this.messages.paused : this.assistantPresentationMessage());
|
|
6042
7171
|
this.setActivity("ready");
|
|
6043
7172
|
if (value)
|
|
6044
7173
|
this.setAmbientActive(false, true);
|
|
7174
|
+
this.syncHeaderActions();
|
|
6045
7175
|
}
|
|
6046
7176
|
setMuted(value) {
|
|
6047
7177
|
if (value === this.muted)
|
|
6048
7178
|
return;
|
|
7179
|
+
if (value && this.pushActive)
|
|
7180
|
+
this.setPushActive(false);
|
|
6049
7181
|
if (value) {
|
|
6050
7182
|
this.statusBeforeMute = this.status.textContent ?? this.messages.ready;
|
|
6051
7183
|
}
|
|
@@ -6062,6 +7194,8 @@ class WidgetView {
|
|
|
6062
7194
|
this.setTooltip(compactMute, label);
|
|
6063
7195
|
this.setControlIcon("compact-mute", icon);
|
|
6064
7196
|
this.require('[data-role="push"]').disabled = value;
|
|
7197
|
+
this.require('[data-role="header-push"]').disabled =
|
|
7198
|
+
value;
|
|
6065
7199
|
if (this.voiceActive) {
|
|
6066
7200
|
this.setStatus(value
|
|
6067
7201
|
? this.messages.muted
|
|
@@ -6072,6 +7206,7 @@ class WidgetView {
|
|
|
6072
7206
|
}
|
|
6073
7207
|
if (!value)
|
|
6074
7208
|
this.statusBeforeMute = null;
|
|
7209
|
+
this.syncHeaderActions();
|
|
6075
7210
|
}
|
|
6076
7211
|
configureVoiceControls(voiceActive, manualTurn, automaticTurnsAvailable) {
|
|
6077
7212
|
if (!voiceActive && this.startingVoicePresentation) {
|
|
@@ -6101,8 +7236,10 @@ class WidgetView {
|
|
|
6101
7236
|
this.voiceActive = voiceActive;
|
|
6102
7237
|
if (wasVoiceActive && !voiceActive) {
|
|
6103
7238
|
this.resetRemotePlayback();
|
|
7239
|
+
this.authorizeVoicePlayback(false);
|
|
6104
7240
|
}
|
|
6105
7241
|
else if (!wasVoiceActive && voiceActive) {
|
|
7242
|
+
this.authorizeVoicePlayback(true);
|
|
6106
7243
|
void this.playRemoteAudio();
|
|
6107
7244
|
}
|
|
6108
7245
|
this.modeTransitionPending = null;
|
|
@@ -6177,6 +7314,8 @@ class WidgetView {
|
|
|
6177
7314
|
this.syncHeaderActions();
|
|
6178
7315
|
}
|
|
6179
7316
|
setModeTransitionPending(mode) {
|
|
7317
|
+
if (mode !== null)
|
|
7318
|
+
this.releaseActivePushToTalk();
|
|
6180
7319
|
const previousMode = this.modeTransitionPending;
|
|
6181
7320
|
this.modeTransitionPending = mode;
|
|
6182
7321
|
if (mode === "voice" && this.active && !this.voiceActive) {
|
|
@@ -6292,6 +7431,7 @@ class WidgetView {
|
|
|
6292
7431
|
!this.callbacks.onModeChange) {
|
|
6293
7432
|
return;
|
|
6294
7433
|
}
|
|
7434
|
+
this.authorizeVoicePlayback(true);
|
|
6295
7435
|
this.setModeTransitionPending("voice");
|
|
6296
7436
|
this.callbacks.onModeChange("voice");
|
|
6297
7437
|
return;
|
|
@@ -6334,22 +7474,29 @@ class WidgetView {
|
|
|
6334
7474
|
!this.callbacks.onModeChange;
|
|
6335
7475
|
compactVoice.setAttribute("aria-busy", String(compactErrorEndPending || this.modeTransitionPending === "voice"));
|
|
6336
7476
|
hud.hidden = !this.active || !this.voiceActive || this.compact;
|
|
7477
|
+
const presentationState = this.assistantPresentationState();
|
|
6337
7478
|
const stateLabel = this.muted
|
|
6338
7479
|
? this.messages.muted
|
|
6339
|
-
: this.
|
|
6340
|
-
? this.messages.
|
|
6341
|
-
: this.
|
|
6342
|
-
? this.messages.
|
|
6343
|
-
:
|
|
7480
|
+
: this.remotePlaybackState === "blocked"
|
|
7481
|
+
? this.messages.audioPaused
|
|
7482
|
+
: this.manualTurn && !this.pushActive && presentationState === "ready"
|
|
7483
|
+
? this.messages.usePushToTalk
|
|
7484
|
+
: presentationState === "speaking"
|
|
7485
|
+
? this.messages.speaking
|
|
7486
|
+
: presentationState === "thinking"
|
|
7487
|
+
? this.messages.thinking
|
|
7488
|
+
: this.messages.listening;
|
|
6344
7489
|
state.textContent = stateLabel;
|
|
6345
7490
|
this.panel.dataset.assistantState = this.muted
|
|
6346
7491
|
? "muted"
|
|
6347
|
-
:
|
|
7492
|
+
: presentationState;
|
|
7493
|
+
this.syncPushToTalkControls();
|
|
6348
7494
|
}
|
|
6349
7495
|
setManualTurn(value) {
|
|
7496
|
+
value = value && this.manualTurnsSupported;
|
|
6350
7497
|
this.manualTurn = value;
|
|
6351
7498
|
const mode = this.require('[data-role="turn-mode"]');
|
|
6352
|
-
mode.hidden = !this.voiceActive || value;
|
|
7499
|
+
mode.hidden = !this.voiceActive || value || !this.manualTurnsSupported;
|
|
6353
7500
|
this.setControlLabel("turn-mode", value ? this.messages.useAutomaticTurns : this.messages.usePushToTalk);
|
|
6354
7501
|
this.setControlIcon("turn-mode", value ? lucide_1.AudioLines : lucide_1.Hand);
|
|
6355
7502
|
mode.setAttribute("aria-pressed", String(value));
|
|
@@ -6365,28 +7512,119 @@ class WidgetView {
|
|
|
6365
7512
|
this.setControlIcon("automatic-turns", lucide_1.AudioLines);
|
|
6366
7513
|
if (!value)
|
|
6367
7514
|
this.setPushActive(false);
|
|
7515
|
+
this.syncPushToTalkControls();
|
|
7516
|
+
if (value &&
|
|
7517
|
+
this.active &&
|
|
7518
|
+
this.voiceActive &&
|
|
7519
|
+
this.assistantPresentationState() === "ready" &&
|
|
7520
|
+
!this.muted) {
|
|
7521
|
+
this.setActivity("ready");
|
|
7522
|
+
this.setStatus(this.messages.usePushToTalk);
|
|
7523
|
+
}
|
|
7524
|
+
this.syncHeaderActions();
|
|
6368
7525
|
}
|
|
6369
7526
|
setPushActive(value) {
|
|
7527
|
+
const wasPending = this.pushPending;
|
|
7528
|
+
this.pushPending = false;
|
|
7529
|
+
if (value && !this.pushToTalkAvailable()) {
|
|
7530
|
+
this.pushActive = false;
|
|
7531
|
+
this.syncSessionModeUi();
|
|
7532
|
+
return false;
|
|
7533
|
+
}
|
|
6370
7534
|
this.pushActive = value;
|
|
6371
|
-
|
|
6372
|
-
|
|
6373
|
-
this.setControlIcon("push", value ? lucide_1.Send : lucide_1.Mic);
|
|
6374
|
-
button.setAttribute("aria-pressed", String(value));
|
|
6375
|
-
if (value) {
|
|
7535
|
+
this.syncPushToTalkControls();
|
|
7536
|
+
if (value && !this.muted) {
|
|
6376
7537
|
this.assistantState = "listening";
|
|
6377
7538
|
this.setActivity("listening");
|
|
6378
7539
|
this.setStatus(this.messages.listening);
|
|
6379
7540
|
}
|
|
7541
|
+
else if (this.manualTurn &&
|
|
7542
|
+
this.voiceActive &&
|
|
7543
|
+
(this.assistantState === "listening" || wasPending) &&
|
|
7544
|
+
!this.muted) {
|
|
7545
|
+
this.clearPendingCaptions("user");
|
|
7546
|
+
this.setActivity("ready");
|
|
7547
|
+
this.setStatus(this.messages.usePushToTalk);
|
|
7548
|
+
}
|
|
7549
|
+
this.syncSessionModeUi();
|
|
7550
|
+
return true;
|
|
6380
7551
|
}
|
|
6381
|
-
|
|
6382
|
-
this.
|
|
6383
|
-
|
|
6384
|
-
this.
|
|
6385
|
-
this.
|
|
7552
|
+
setPushPending(value) {
|
|
7553
|
+
if (value && !this.pushToTalkAvailable())
|
|
7554
|
+
return false;
|
|
7555
|
+
this.pushPending = value;
|
|
7556
|
+
this.syncPushToTalkControls();
|
|
7557
|
+
if (value)
|
|
7558
|
+
this.setStatus(this.messages.preparingMicrophone);
|
|
7559
|
+
return true;
|
|
7560
|
+
}
|
|
7561
|
+
pushToTalkAvailable() {
|
|
7562
|
+
return Boolean(this.active &&
|
|
7563
|
+
this.voiceActive &&
|
|
7564
|
+
this.manualTurn &&
|
|
7565
|
+
!this.muted &&
|
|
7566
|
+
!this.paused &&
|
|
7567
|
+
!this.endRequested &&
|
|
7568
|
+
this.stagedLaunchMode === null &&
|
|
7569
|
+
this.modeTransitionPending === null &&
|
|
7570
|
+
this.panelViewTransition === null &&
|
|
7571
|
+
this.currentConfirmation === null &&
|
|
7572
|
+
this.currentVisualRequest === null &&
|
|
7573
|
+
this.currentHandoffContextRequest === null &&
|
|
7574
|
+
this.currentPageAssistanceRequest === null &&
|
|
7575
|
+
!this.handoffRequestPreparing &&
|
|
7576
|
+
this.require('[data-role="legal-overlay"]').hidden &&
|
|
7577
|
+
!this.panel.classList.contains("error-state") &&
|
|
7578
|
+
!this.panel.classList.contains("ending-state"));
|
|
7579
|
+
}
|
|
7580
|
+
releaseActivePushToTalk() {
|
|
7581
|
+
if (!this.pushActive && !this.pushPending)
|
|
7582
|
+
return;
|
|
7583
|
+
this.callbacks.onPushToTalk(false);
|
|
7584
|
+
if (this.pushActive || this.pushPending)
|
|
7585
|
+
this.setPushActive(false);
|
|
7586
|
+
}
|
|
7587
|
+
syncPushToTalkControls() {
|
|
7588
|
+
const label = this.pushPending ? this.messages.cancelVoiceStart : this.pushActive
|
|
7589
|
+
? this.messages.sendVoiceTurn
|
|
7590
|
+
: this.messages.startSpeaking;
|
|
7591
|
+
const icon = this.pushActive ? lucide_1.Send : lucide_1.Mic;
|
|
7592
|
+
for (const role of ["push", "header-push"]) {
|
|
7593
|
+
const button = this.require(`[data-role="${role}"]`);
|
|
7594
|
+
this.setControlLabel(role, label);
|
|
7595
|
+
this.setControlIcon(role, icon);
|
|
7596
|
+
button.setAttribute("aria-pressed", String(this.pushActive));
|
|
7597
|
+
button.setAttribute("aria-busy", String(this.pushPending));
|
|
7598
|
+
button.disabled = !this.pushToTalkAvailable();
|
|
7599
|
+
}
|
|
7600
|
+
}
|
|
7601
|
+
interruptPlayback(preserveManualInput = false) {
|
|
7602
|
+
if (!this.playbackInterrupted) {
|
|
7603
|
+
this.playbackInterrupted = true;
|
|
7604
|
+
this.audio.autoplay = false;
|
|
7605
|
+
this.pauseRemotePlayback(true);
|
|
7606
|
+
}
|
|
7607
|
+
if (!preserveManualInput)
|
|
7608
|
+
this.setPushActive(false);
|
|
7609
|
+
const listening = preserveManualInput && this.pushActive;
|
|
7610
|
+
this.assistantState = listening ? "listening" : "ready";
|
|
7611
|
+
this.setActivity(listening ? "listening" : "ready");
|
|
6386
7612
|
this.clearPendingCaptions("assistant");
|
|
6387
|
-
this.setStatus(this.
|
|
7613
|
+
this.setStatus(preserveManualInput && this.pushPending
|
|
7614
|
+
? this.messages.preparingMicrophone
|
|
7615
|
+
: listening ? this.messages.listening : this.assistantPresentationMessage());
|
|
6388
7616
|
this.setAmbientActive(false);
|
|
6389
7617
|
}
|
|
7618
|
+
// The controller calls this only for a new admitted visitor turn followed by
|
|
7619
|
+
// fresh response readiness. A generic thinking/speaking update after Stop is
|
|
7620
|
+
// not permission to replay the interrupted answer.
|
|
7621
|
+
resumeInterruptedPlayback() {
|
|
7622
|
+
if (!this.playbackInterrupted || !this.playbackEventIsCurrent())
|
|
7623
|
+
return;
|
|
7624
|
+
this.playbackInterrupted = false;
|
|
7625
|
+
this.audio.autoplay = true;
|
|
7626
|
+
void this.playRemoteAudio();
|
|
7627
|
+
}
|
|
6390
7628
|
clearErrorPresentation(restoreView) {
|
|
6391
7629
|
if (!this.panel.classList.contains("error-state"))
|
|
6392
7630
|
return;
|
|
@@ -6405,6 +7643,7 @@ class WidgetView {
|
|
|
6405
7643
|
if (!this.panel.classList.contains("ending-state"))
|
|
6406
7644
|
return;
|
|
6407
7645
|
this.panel.classList.remove("ending-state");
|
|
7646
|
+
this.endingPresentationDismissed = false;
|
|
6408
7647
|
this.panel.removeAttribute("aria-busy");
|
|
6409
7648
|
const notice = this.require('[data-role="notice"]');
|
|
6410
7649
|
notice.classList.remove("visible");
|
|
@@ -6412,9 +7651,17 @@ class WidgetView {
|
|
|
6412
7651
|
notice.setAttribute("role", "alert");
|
|
6413
7652
|
notice.setAttribute("aria-live", "assertive");
|
|
6414
7653
|
this.require('[data-role="notice-icon"]').textContent = "!";
|
|
7654
|
+
this.require('[data-role="ending-dismiss"]').hidden =
|
|
7655
|
+
true;
|
|
6415
7656
|
}
|
|
6416
7657
|
showError(message, retryable = false, sessionActive = this.active) {
|
|
6417
7658
|
this.setActionStateRunning(false);
|
|
7659
|
+
if (this.voiceActive || this.audio.srcObject) {
|
|
7660
|
+
this.pauseRemotePlayback(true);
|
|
7661
|
+
}
|
|
7662
|
+
else {
|
|
7663
|
+
this.resetRemoteAudioEvidence(false);
|
|
7664
|
+
}
|
|
6418
7665
|
this.clearPendingWelcomeSkeleton();
|
|
6419
7666
|
this.clearEndingPresentation();
|
|
6420
7667
|
this.stagedLaunchMode = null;
|
|
@@ -6464,6 +7711,10 @@ class WidgetView {
|
|
|
6464
7711
|
]);
|
|
6465
7712
|
}
|
|
6466
7713
|
showEndingDetached(message) {
|
|
7714
|
+
const continuingEndingPresentation = this.panel.classList.contains("ending-state");
|
|
7715
|
+
if (!continuingEndingPresentation) {
|
|
7716
|
+
this.endingPresentationDismissed = false;
|
|
7717
|
+
}
|
|
6467
7718
|
this.setActionStateRunning(false);
|
|
6468
7719
|
this.clearPendingWelcomeSkeleton();
|
|
6469
7720
|
this.resetRemotePlayback();
|
|
@@ -6486,7 +7737,9 @@ class WidgetView {
|
|
|
6486
7737
|
this.panel.classList.add("ending-state");
|
|
6487
7738
|
this.panel.setAttribute("aria-busy", "true");
|
|
6488
7739
|
this.commitCompact(true, false);
|
|
6489
|
-
this.
|
|
7740
|
+
if (!this.endingPresentationDismissed) {
|
|
7741
|
+
this.openPanel(false);
|
|
7742
|
+
}
|
|
6490
7743
|
this.conversation.classList.remove("visible");
|
|
6491
7744
|
this.controls.classList.remove("visible", "error");
|
|
6492
7745
|
this.confirmation.classList.remove("visible");
|
|
@@ -6500,6 +7753,8 @@ class WidgetView {
|
|
|
6500
7753
|
notice.setAttribute("aria-busy", "true");
|
|
6501
7754
|
this.require('[data-role="notice-icon"]').textContent = "";
|
|
6502
7755
|
this.require('[data-role="notice-message"]').textContent = progressMessage;
|
|
7756
|
+
this.require('[data-role="ending-dismiss"]').hidden =
|
|
7757
|
+
false;
|
|
6503
7758
|
this.setComposerEnabled(false);
|
|
6504
7759
|
this.stopDuration(false);
|
|
6505
7760
|
this.hideAttribution();
|
|
@@ -6511,12 +7766,13 @@ class WidgetView {
|
|
|
6511
7766
|
this.setAmbientActive(false, true);
|
|
6512
7767
|
}
|
|
6513
7768
|
showEndRetry(message) {
|
|
7769
|
+
this.endingPresentationDismissed = false;
|
|
6514
7770
|
this.active = true;
|
|
6515
7771
|
this.endRequested = false;
|
|
6516
7772
|
this.showError(message || this.messages.endRetry, false, true);
|
|
6517
7773
|
this.syncEndControls();
|
|
6518
7774
|
}
|
|
6519
|
-
showResumeStopped() {
|
|
7775
|
+
showResumeStopped(notifyOpenChange = true) {
|
|
6520
7776
|
this.setActionStateRunning(false);
|
|
6521
7777
|
this.clearPendingWelcomeSkeleton();
|
|
6522
7778
|
this.resetRemotePlayback();
|
|
@@ -6551,14 +7807,58 @@ class WidgetView {
|
|
|
6551
7807
|
this.stopDuration(true);
|
|
6552
7808
|
this.hideAttribution();
|
|
6553
7809
|
this.setActivity("idle");
|
|
6554
|
-
this.setStatus(this.
|
|
7810
|
+
this.setStatus(this.assistantPresentationMessage());
|
|
6555
7811
|
this.intro.hidden = false;
|
|
6556
7812
|
this.syncLauncherState();
|
|
6557
7813
|
this.syncHeaderActions();
|
|
6558
|
-
if (wasOpen)
|
|
7814
|
+
if (wasOpen && notifyOpenChange)
|
|
6559
7815
|
this.callbacks.onOpenChange?.(false);
|
|
6560
7816
|
}
|
|
7817
|
+
showStartRetry(question, message, localQuestionId) {
|
|
7818
|
+
this.initialQuestionStaged = false;
|
|
7819
|
+
this.removeLocalQuestionEcho(localQuestionId);
|
|
7820
|
+
// The controller already rolls back the exact admitted question before
|
|
7821
|
+
// requesting this presentation. Avoid routing this internal close through
|
|
7822
|
+
// the generic user-close callback, which would clear unrelated controller
|
|
7823
|
+
// intent a second time.
|
|
7824
|
+
this.showResumeStopped(false);
|
|
7825
|
+
this.clearIntroTransition();
|
|
7826
|
+
this.introMinimized = false;
|
|
7827
|
+
this.syncIntroMinimizedState();
|
|
7828
|
+
const input = this.require('[data-role="intro-text-input"]');
|
|
7829
|
+
input.value = question.slice(0, INITIAL_QUESTION_MAX_LENGTH);
|
|
7830
|
+
input.setAttribute("aria-invalid", "false");
|
|
7831
|
+
this.syncIntroSendState();
|
|
7832
|
+
this.setStatus(message);
|
|
7833
|
+
if (!input.disabled && !input.hidden)
|
|
7834
|
+
input.focus({ preventScroll: true });
|
|
7835
|
+
}
|
|
7836
|
+
removeLocalQuestionEcho(localQuestionId) {
|
|
7837
|
+
this.captions
|
|
7838
|
+
.querySelectorAll("[data-local-question-id]")
|
|
7839
|
+
.forEach((line) => {
|
|
7840
|
+
if (line.dataset.localQuestionId !== localQuestionId)
|
|
7841
|
+
return;
|
|
7842
|
+
this.cancelCaptionHeightGlide(line);
|
|
7843
|
+
line.remove();
|
|
7844
|
+
});
|
|
7845
|
+
const welcomeGroup = this.require('[data-role="welcome-group"]');
|
|
7846
|
+
if (!this.captions.querySelector('[data-role="empty"]') &&
|
|
7847
|
+
[...this.captions.children].every((child) => child === welcomeGroup)) {
|
|
7848
|
+
const empty = document.createElement("div");
|
|
7849
|
+
empty.className = "empty";
|
|
7850
|
+
empty.dataset.role = "empty";
|
|
7851
|
+
empty.textContent = this.messages.emptyConversation;
|
|
7852
|
+
this.captions.prepend(empty);
|
|
7853
|
+
}
|
|
7854
|
+
}
|
|
6561
7855
|
showEnded(message) {
|
|
7856
|
+
this.clearCtaOffer();
|
|
7857
|
+
if (this.endingPresentationDismissed) {
|
|
7858
|
+
this.endingPresentationDismissed = false;
|
|
7859
|
+
this.showResumeStopped(false);
|
|
7860
|
+
return;
|
|
7861
|
+
}
|
|
6562
7862
|
this.setActionStateRunning(false);
|
|
6563
7863
|
this.clearPendingWelcomeSkeleton();
|
|
6564
7864
|
this.resetRemotePlayback();
|
|
@@ -6631,6 +7931,7 @@ class WidgetView {
|
|
|
6631
7931
|
showLaunchUnavailable(message) {
|
|
6632
7932
|
this.setActionStateRunning(false);
|
|
6633
7933
|
this.clearPendingWelcomeSkeleton();
|
|
7934
|
+
const wasOpen = this.panel.classList.contains("open");
|
|
6634
7935
|
const previousFocus = this.shadow.activeElement;
|
|
6635
7936
|
const wasStartingVoice = this.startingVoicePresentation;
|
|
6636
7937
|
this.discardStartingVoicePresentation();
|
|
@@ -6642,7 +7943,7 @@ class WidgetView {
|
|
|
6642
7943
|
this.assistantState = "unavailable";
|
|
6643
7944
|
this.setActivity("error");
|
|
6644
7945
|
this.modeTransitionPending = null;
|
|
6645
|
-
this.panel.classList.remove("feedback-state");
|
|
7946
|
+
this.panel.classList.remove("feedback-state", "open");
|
|
6646
7947
|
this.clearEndingPresentation();
|
|
6647
7948
|
this.clearErrorPresentation(false);
|
|
6648
7949
|
this.setCompact(false, false);
|
|
@@ -6666,19 +7967,216 @@ class WidgetView {
|
|
|
6666
7967
|
this.focusFallbackIfUnavailable(previousFocus, [
|
|
6667
7968
|
'[data-role="availability"]',
|
|
6668
7969
|
]);
|
|
7970
|
+
if (wasOpen)
|
|
7971
|
+
this.callbacks.onOpenChange?.(false);
|
|
6669
7972
|
}
|
|
6670
7973
|
updateHighlight(element, status) {
|
|
7974
|
+
const targetChanged = element !== this.highlightedElement;
|
|
7975
|
+
if (targetChanged && this.highlightFrame !== null) {
|
|
7976
|
+
cancelAnimationFrame(this.highlightFrame);
|
|
7977
|
+
this.highlightFrame = null;
|
|
7978
|
+
}
|
|
6671
7979
|
this.highlightedElement = element;
|
|
6672
7980
|
this.highlight.className = `highlight ${status}`;
|
|
6673
|
-
if (!element || !element.isConnected)
|
|
7981
|
+
if (!element || !element.isConnected) {
|
|
7982
|
+
this.clearHighlightTracking();
|
|
6674
7983
|
return;
|
|
7984
|
+
}
|
|
7985
|
+
this.syncHighlightScrollTargets(element, targetChanged);
|
|
6675
7986
|
const rect = element.getBoundingClientRect();
|
|
6676
|
-
|
|
6677
|
-
|
|
6678
|
-
|
|
6679
|
-
|
|
7987
|
+
const visual = window.visualViewport;
|
|
7988
|
+
let viewportLeft = visual?.offsetLeft ?? 0;
|
|
7989
|
+
let viewportTop = visual?.offsetTop ?? 0;
|
|
7990
|
+
let viewportRight = viewportLeft + (visual?.width ?? window.innerWidth);
|
|
7991
|
+
let viewportBottom = viewportTop + (visual?.height ?? window.innerHeight);
|
|
7992
|
+
if (this.highlightIntersectionObserver) {
|
|
7993
|
+
if (!this.highlightIntersectionKnown || !this.highlightIntersectionRect)
|
|
7994
|
+
return;
|
|
7995
|
+
if (this.highlightIntersectionRect.left !== undefined) {
|
|
7996
|
+
viewportLeft = Math.max(viewportLeft, this.highlightIntersectionRect.left);
|
|
7997
|
+
}
|
|
7998
|
+
if (this.highlightIntersectionRect.top !== undefined) {
|
|
7999
|
+
viewportTop = Math.max(viewportTop, this.highlightIntersectionRect.top);
|
|
8000
|
+
}
|
|
8001
|
+
if (this.highlightIntersectionRect.right !== undefined) {
|
|
8002
|
+
viewportRight = Math.min(viewportRight, this.highlightIntersectionRect.right);
|
|
8003
|
+
}
|
|
8004
|
+
if (this.highlightIntersectionRect.bottom !== undefined) {
|
|
8005
|
+
viewportBottom = Math.min(viewportBottom, this.highlightIntersectionRect.bottom);
|
|
8006
|
+
}
|
|
8007
|
+
}
|
|
8008
|
+
else {
|
|
8009
|
+
for (const ancestor of this.highlightScrollTargets) {
|
|
8010
|
+
const style = getComputedStyle(ancestor);
|
|
8011
|
+
const overflowX = style.overflowX || style.overflow;
|
|
8012
|
+
const overflowY = style.overflowY || style.overflow;
|
|
8013
|
+
if (!this.clipsHighlightOverflow(overflowX) &&
|
|
8014
|
+
!this.clipsHighlightOverflow(overflowY)) {
|
|
8015
|
+
continue;
|
|
8016
|
+
}
|
|
8017
|
+
const ancestorRect = this.highlightScrollportRect(ancestor);
|
|
8018
|
+
if (this.clipsHighlightOverflow(overflowX)) {
|
|
8019
|
+
viewportLeft = Math.max(viewportLeft, ancestorRect.left);
|
|
8020
|
+
viewportRight = Math.min(viewportRight, ancestorRect.right);
|
|
8021
|
+
}
|
|
8022
|
+
if (this.clipsHighlightOverflow(overflowY)) {
|
|
8023
|
+
viewportTop = Math.max(viewportTop, ancestorRect.top);
|
|
8024
|
+
viewportBottom = Math.min(viewportBottom, ancestorRect.bottom);
|
|
8025
|
+
}
|
|
8026
|
+
}
|
|
8027
|
+
}
|
|
8028
|
+
if (viewportRight <= viewportLeft || viewportBottom <= viewportTop)
|
|
8029
|
+
return;
|
|
8030
|
+
if (rect.right <= viewportLeft ||
|
|
8031
|
+
rect.bottom <= viewportTop ||
|
|
8032
|
+
rect.left >= viewportRight ||
|
|
8033
|
+
rect.top >= viewportBottom) {
|
|
8034
|
+
return;
|
|
8035
|
+
}
|
|
8036
|
+
const left = Math.max(viewportLeft, rect.left - 4);
|
|
8037
|
+
const top = Math.max(viewportTop, rect.top - 4);
|
|
8038
|
+
const right = Math.min(viewportRight, rect.right + 4);
|
|
8039
|
+
const bottom = Math.min(viewportBottom, rect.bottom + 4);
|
|
8040
|
+
if (right <= left || bottom <= top)
|
|
8041
|
+
return;
|
|
8042
|
+
this.highlight.style.left = `${left}px`;
|
|
8043
|
+
this.highlight.style.top = `${top}px`;
|
|
8044
|
+
this.highlight.style.width = `${right - left}px`;
|
|
8045
|
+
this.highlight.style.height = `${bottom - top}px`;
|
|
6680
8046
|
this.highlight.classList.add("visible");
|
|
6681
8047
|
}
|
|
8048
|
+
clipsHighlightOverflow(value) {
|
|
8049
|
+
return /^(?:auto|clip|hidden|overlay|scroll)$/.test(value);
|
|
8050
|
+
}
|
|
8051
|
+
highlightScrollportRect(element) {
|
|
8052
|
+
const rect = element.getBoundingClientRect();
|
|
8053
|
+
if (!(element instanceof HTMLElement))
|
|
8054
|
+
return rect;
|
|
8055
|
+
const scaleX = element.offsetWidth > 0 ? rect.width / element.offsetWidth : 1;
|
|
8056
|
+
const scaleY = element.offsetHeight > 0 ? rect.height / element.offsetHeight : 1;
|
|
8057
|
+
const left = rect.left + element.clientLeft * scaleX;
|
|
8058
|
+
const top = rect.top + element.clientTop * scaleY;
|
|
8059
|
+
return {
|
|
8060
|
+
left,
|
|
8061
|
+
top,
|
|
8062
|
+
right: left + element.clientWidth * scaleX,
|
|
8063
|
+
bottom: top + element.clientHeight * scaleY,
|
|
8064
|
+
};
|
|
8065
|
+
}
|
|
8066
|
+
composedHighlightParent(element) {
|
|
8067
|
+
const assignedSlot = element.assignedSlot;
|
|
8068
|
+
if (assignedSlot)
|
|
8069
|
+
return assignedSlot;
|
|
8070
|
+
if (element.parentElement)
|
|
8071
|
+
return element.parentElement;
|
|
8072
|
+
const root = element.getRootNode();
|
|
8073
|
+
return root instanceof ShadowRoot ? root.host : null;
|
|
8074
|
+
}
|
|
8075
|
+
establishesFixedContainingBlock(element) {
|
|
8076
|
+
const style = getComputedStyle(element);
|
|
8077
|
+
const individualTransform = (property) => {
|
|
8078
|
+
if (!(element instanceof HTMLElement))
|
|
8079
|
+
return style.getPropertyValue(property);
|
|
8080
|
+
const inlineStyle = element.style;
|
|
8081
|
+
return (style.getPropertyValue(property) ||
|
|
8082
|
+
inlineStyle.getPropertyValue(property) ||
|
|
8083
|
+
inlineStyle[property] ||
|
|
8084
|
+
"");
|
|
8085
|
+
};
|
|
8086
|
+
const activeProperty = (value) => Boolean(value) && value !== "none";
|
|
8087
|
+
if (activeProperty(style.transform) ||
|
|
8088
|
+
activeProperty(style.perspective) ||
|
|
8089
|
+
activeProperty(style.filter) ||
|
|
8090
|
+
activeProperty(style.getPropertyValue("backdrop-filter")) ||
|
|
8091
|
+
activeProperty(individualTransform("rotate")) ||
|
|
8092
|
+
activeProperty(individualTransform("scale")) ||
|
|
8093
|
+
activeProperty(individualTransform("translate"))) {
|
|
8094
|
+
return true;
|
|
8095
|
+
}
|
|
8096
|
+
if (/(?:^|\s)(?:content|layout|paint|strict)(?:\s|$)/.test(style.contain) ||
|
|
8097
|
+
style.getPropertyValue("content-visibility") === "auto") {
|
|
8098
|
+
return true;
|
|
8099
|
+
}
|
|
8100
|
+
return style.willChange
|
|
8101
|
+
.split(",")
|
|
8102
|
+
.some((property) => /^(?:backdrop-filter|filter|perspective|transform)$/.test(property.trim()));
|
|
8103
|
+
}
|
|
8104
|
+
highlightPositionEscape(element) {
|
|
8105
|
+
const position = getComputedStyle(element).position || "static";
|
|
8106
|
+
if (position === "fixed")
|
|
8107
|
+
return "fixed";
|
|
8108
|
+
if (position === "absolute")
|
|
8109
|
+
return "absolute";
|
|
8110
|
+
return null;
|
|
8111
|
+
}
|
|
8112
|
+
establishesHighlightContainingBlock(element, escape) {
|
|
8113
|
+
return (this.establishesFixedContainingBlock(element) ||
|
|
8114
|
+
(escape === "absolute" &&
|
|
8115
|
+
(getComputedStyle(element).position || "static") !== "static"));
|
|
8116
|
+
}
|
|
8117
|
+
collectHighlightScrollTargets(target) {
|
|
8118
|
+
const targets = [];
|
|
8119
|
+
let ancestor = target;
|
|
8120
|
+
let escape = this.highlightPositionEscape(target);
|
|
8121
|
+
while (true) {
|
|
8122
|
+
ancestor = this.composedHighlightParent(ancestor);
|
|
8123
|
+
if (!ancestor)
|
|
8124
|
+
break;
|
|
8125
|
+
if (!escape ||
|
|
8126
|
+
this.establishesHighlightContainingBlock(ancestor, escape)) {
|
|
8127
|
+
targets.push(ancestor);
|
|
8128
|
+
escape = null;
|
|
8129
|
+
}
|
|
8130
|
+
escape = this.highlightPositionEscape(ancestor) ?? escape;
|
|
8131
|
+
}
|
|
8132
|
+
return targets;
|
|
8133
|
+
}
|
|
8134
|
+
syncHighlightScrollTargets(target, targetChanged) {
|
|
8135
|
+
const targets = this.collectHighlightScrollTargets(target);
|
|
8136
|
+
if (!targetChanged &&
|
|
8137
|
+
targets.length === this.highlightScrollTargets.length &&
|
|
8138
|
+
targets.every((candidate, index) => candidate === this.highlightScrollTargets[index])) {
|
|
8139
|
+
return;
|
|
8140
|
+
}
|
|
8141
|
+
this.unbindHighlightScrollTargets();
|
|
8142
|
+
for (const ancestor of targets) {
|
|
8143
|
+
ancestor.addEventListener("scroll", this.scheduleHighlightGeometryRefresh, {
|
|
8144
|
+
passive: true,
|
|
8145
|
+
});
|
|
8146
|
+
}
|
|
8147
|
+
this.highlightScrollTargets = targets;
|
|
8148
|
+
if (targetChanged && typeof IntersectionObserver === "function") {
|
|
8149
|
+
this.highlightIntersectionObserver ?? (this.highlightIntersectionObserver = new IntersectionObserver(this.onHighlightIntersection, { threshold: [0, 0.01, 0.25, 0.5, 0.75, 0.99, 1] }));
|
|
8150
|
+
this.highlightIntersectionObserver.disconnect();
|
|
8151
|
+
this.highlightIntersectionKnown = false;
|
|
8152
|
+
this.highlightIntersectionRect = null;
|
|
8153
|
+
this.highlightIntersectionObserver.observe(target);
|
|
8154
|
+
}
|
|
8155
|
+
if (typeof ResizeObserver === "function") {
|
|
8156
|
+
this.highlightResizeObserver ?? (this.highlightResizeObserver = new ResizeObserver(this.scheduleHighlightGeometryRefresh));
|
|
8157
|
+
this.highlightResizeObserver.observe(target);
|
|
8158
|
+
for (const ancestor of targets) {
|
|
8159
|
+
this.highlightResizeObserver.observe(ancestor);
|
|
8160
|
+
}
|
|
8161
|
+
}
|
|
8162
|
+
}
|
|
8163
|
+
unbindHighlightScrollTargets() {
|
|
8164
|
+
for (const target of this.highlightScrollTargets) {
|
|
8165
|
+
target.removeEventListener("scroll", this.scheduleHighlightGeometryRefresh);
|
|
8166
|
+
}
|
|
8167
|
+
this.highlightScrollTargets = [];
|
|
8168
|
+
this.highlightResizeObserver?.disconnect();
|
|
8169
|
+
}
|
|
8170
|
+
clearHighlightTracking() {
|
|
8171
|
+
if (this.highlightFrame !== null)
|
|
8172
|
+
cancelAnimationFrame(this.highlightFrame);
|
|
8173
|
+
this.highlightFrame = null;
|
|
8174
|
+
this.highlightedElement = null;
|
|
8175
|
+
this.unbindHighlightScrollTargets();
|
|
8176
|
+
this.highlightIntersectionObserver?.disconnect();
|
|
8177
|
+
this.highlightIntersectionKnown = false;
|
|
8178
|
+
this.highlightIntersectionRect = null;
|
|
8179
|
+
}
|
|
6682
8180
|
safetySurfaceVisible() {
|
|
6683
8181
|
if (!this.panel.classList.contains("open") ||
|
|
6684
8182
|
document.visibilityState === "hidden") {
|
|
@@ -6725,12 +8223,18 @@ class WidgetView {
|
|
|
6725
8223
|
});
|
|
6726
8224
|
}
|
|
6727
8225
|
destroy() {
|
|
8226
|
+
this.clearCtaOffer();
|
|
8227
|
+
if (this.destroyed)
|
|
8228
|
+
return;
|
|
8229
|
+
this.destroyed = true;
|
|
6728
8230
|
window.removeEventListener("resize", this.onResize);
|
|
6729
|
-
window.removeEventListener("scroll", this.
|
|
8231
|
+
window.removeEventListener("scroll", this.onHighlightViewportGeometryChange);
|
|
6730
8232
|
window.removeEventListener("scroll", this.onIntroFocusHostScroll);
|
|
6731
8233
|
window.removeEventListener("touchmove", this.onIntroFocusTouchMove);
|
|
6732
8234
|
window.visualViewport?.removeEventListener("resize", this.onIntroVisualViewportChange);
|
|
8235
|
+
window.visualViewport?.removeEventListener("resize", this.onHighlightViewportGeometryChange);
|
|
6733
8236
|
window.visualViewport?.removeEventListener("scroll", this.onIntroVisualViewportChange);
|
|
8237
|
+
window.visualViewport?.removeEventListener("scroll", this.onHighlightViewportGeometryChange);
|
|
6734
8238
|
document.removeEventListener("pointerdown", this.onDocumentPointerDown, true);
|
|
6735
8239
|
document.removeEventListener("visibilitychange", this.onEffectVisibilityChange);
|
|
6736
8240
|
this.reducedMotionQuery?.removeEventListener?.("change", this.onReducedMotionChange);
|
|
@@ -6740,6 +8244,15 @@ class WidgetView {
|
|
|
6740
8244
|
this.clearFeedbackExitFade();
|
|
6741
8245
|
this.cancelPanelDrag();
|
|
6742
8246
|
this.resetRemotePlayback();
|
|
8247
|
+
this.unbindPlaybackState();
|
|
8248
|
+
if (this.remoteAudioContext && this.remoteAudioContextStateListener) {
|
|
8249
|
+
this.remoteAudioContext.removeEventListener?.("statechange", this.remoteAudioContextStateListener);
|
|
8250
|
+
}
|
|
8251
|
+
this.remoteAudioContextStateListener = null;
|
|
8252
|
+
if (this.remoteAudioContext) {
|
|
8253
|
+
void this.remoteAudioContext.close().catch(() => undefined);
|
|
8254
|
+
}
|
|
8255
|
+
this.remoteAudioContext = null;
|
|
6743
8256
|
this.stopDuration(false);
|
|
6744
8257
|
this.clearCompactCaptions();
|
|
6745
8258
|
this.clearIntroTransition();
|
|
@@ -6764,12 +8277,14 @@ class WidgetView {
|
|
|
6764
8277
|
this.panel.removeEventListener("pointerdown", this.onPlaybackActivation, true);
|
|
6765
8278
|
this.currentPageAssistanceRequest = null;
|
|
6766
8279
|
this.pageAssistancePresentationSnapshot = null;
|
|
8280
|
+
this.clearHighlightTracking();
|
|
8281
|
+
this.highlightIntersectionObserver = null;
|
|
8282
|
+
this.highlightResizeObserver = null;
|
|
6767
8283
|
this.dialogFocus.destroy();
|
|
6768
8284
|
this.host.remove();
|
|
6769
8285
|
this.currentConfirmation = null;
|
|
6770
8286
|
this.currentVisualRequest = null;
|
|
6771
8287
|
this.currentHandoffContextRequest = null;
|
|
6772
|
-
this.highlightedElement = null;
|
|
6773
8288
|
}
|
|
6774
8289
|
build() {
|
|
6775
8290
|
const fragment = document.createDocumentFragment();
|
|
@@ -6783,6 +8298,7 @@ class WidgetView {
|
|
|
6783
8298
|
<div class="status-card" data-role="availability" role="status" tabindex="-1"></div>
|
|
6784
8299
|
<div class="status-card" data-role="elsewhere" role="status" tabindex="-1"></div>
|
|
6785
8300
|
<div class="intro-entry" data-role="intro-entry" data-has-draft="false" aria-busy="false" hidden>
|
|
8301
|
+
<label class="recording-consent" data-role="recording-consent" hidden><input type="checkbox" data-role="recording-consent-input"><span><strong data-role="recording-consent-label"></strong><small data-role="recording-consent-description"></small></span></label>
|
|
6786
8302
|
<div class="proactive-engagement" data-role="proactive-engagement" hidden>
|
|
6787
8303
|
<div class="proactive-rail" data-role="proactive-prompts" role="group"></div>
|
|
6788
8304
|
</div>
|
|
@@ -6839,6 +8355,7 @@ class WidgetView {
|
|
|
6839
8355
|
<div class="status-card compact-error-notice" data-role="notice" role="alert" aria-live="assertive">
|
|
6840
8356
|
<span class="compact-error-notice-icon" data-role="notice-icon" aria-hidden="true">!</span>
|
|
6841
8357
|
<span class="compact-error-notice-message" data-role="notice-message"></span>
|
|
8358
|
+
<button type="button" class="compact-ending-dismiss" data-role="ending-dismiss" hidden><span class="button-icon" data-icon aria-hidden="true"></span></button>
|
|
6842
8359
|
</div>
|
|
6843
8360
|
<span class="voice-card-fx intro-effect intro-effect-glow" aria-hidden="true"></span>
|
|
6844
8361
|
<span class="voice-card-fx intro-effect intro-effect-dark intro-effect-dark-a" aria-hidden="true"></span>
|
|
@@ -6855,6 +8372,7 @@ class WidgetView {
|
|
|
6855
8372
|
<div class="header-actions">
|
|
6856
8373
|
<span class="duration" data-role="duration" hidden>00:00</span>
|
|
6857
8374
|
<button type="button" class="end icon-button" data-role="end" data-tooltip hidden><span class="button-icon" data-icon aria-hidden="true"></span></button>
|
|
8375
|
+
<button type="button" class="header-push icon-button" data-role="header-push" data-tooltip aria-pressed="false" hidden><span class="button-icon" data-icon aria-hidden="true"></span></button>
|
|
6858
8376
|
<button type="button" class="compact-mute icon-button" data-role="compact-mute" data-tooltip hidden><span class="button-icon" data-icon aria-hidden="true"></span></button>
|
|
6859
8377
|
<button type="button" class="view-toggle icon-button" data-role="view-toggle" data-tooltip aria-controls="oxvo-ai-live-assist-content" hidden><span class="button-icon" data-icon aria-hidden="true"></span></button>
|
|
6860
8378
|
<button type="button" class="restart icon-button" data-role="restart" data-tooltip hidden><span class="button-icon" data-icon aria-hidden="true"></span></button>
|
|
@@ -6867,7 +8385,9 @@ class WidgetView {
|
|
|
6867
8385
|
<p data-role="legal-disclosure"></p>
|
|
6868
8386
|
<div class="boundary" data-role="boundary"></div>
|
|
6869
8387
|
<ul data-role="legal-scopes"></ul>
|
|
8388
|
+
<label class="recording-consent" data-role="recording-consent" hidden><input type="checkbox" data-role="recording-consent-input"><span><strong data-role="recording-consent-label"></strong><small data-role="recording-consent-description"></small></span></label>
|
|
6870
8389
|
<div class="legal-links" data-role="legal-links"><a data-role="legal-privacy" target="_blank" rel="noopener noreferrer"></a><a data-role="legal-terms" target="_blank" rel="noopener noreferrer"></a></div>
|
|
8390
|
+
<button type="button" class="secondary legal-revoke" data-role="page-assistance-revoke" hidden><span class="menu-icon" data-icon aria-hidden="true"></span><span class="control-label"></span></button>
|
|
6871
8391
|
</section>
|
|
6872
8392
|
</div>
|
|
6873
8393
|
<div class="body" id="oxvo-ai-live-assist-content">
|
|
@@ -6909,16 +8429,19 @@ class WidgetView {
|
|
|
6909
8429
|
<div class="page-assistance-header">
|
|
6910
8430
|
<div class="page-assistance-header-copy">
|
|
6911
8431
|
<h3 id="oxvo-ai-page-assistance-title" data-role="page-assistance-title"></h3>
|
|
6912
|
-
<p id="oxvo-ai-page-assistance-action" class="page-assistance-action-copy"><span data-role="page-assistance-action"></span><span class="page-assistance-target" data-role="page-assistance-target"></span></p>
|
|
6913
8432
|
</div>
|
|
6914
|
-
<button type="button" class="
|
|
8433
|
+
<button type="button" class="page-assistance-close icon-button" data-role="page-assistance-close"><span class="button-icon" data-icon aria-hidden="true"></span></button>
|
|
6915
8434
|
</div>
|
|
6916
|
-
<div class="page-assistance-
|
|
6917
|
-
<
|
|
6918
|
-
<
|
|
6919
|
-
|
|
6920
|
-
|
|
6921
|
-
|
|
8435
|
+
<div class="page-assistance-content">
|
|
8436
|
+
<p id="oxvo-ai-page-assistance-action" class="page-assistance-action-copy"><span data-role="page-assistance-action"></span>
|
|
8437
|
+
<span class="page-assistance-target" data-role="page-assistance-target"></span></p>
|
|
8438
|
+
<div class="page-assistance-footer" hidden>
|
|
8439
|
+
<label class="page-assistance-always" data-role="page-assistance-always-control" hidden>
|
|
8440
|
+
<input type="checkbox" data-role="page-assistance-always">
|
|
8441
|
+
<span data-role="page-assistance-always-label"></span>
|
|
8442
|
+
</label>
|
|
8443
|
+
<p id="oxvo-ai-page-assistance-agreement" class="page-assistance-agreement" data-role="page-assistance-agreement"><span data-role="page-assistance-agreement-prefix"></span><a data-role="privacy" target="_blank" rel="noopener noreferrer"></a><span data-role="page-assistance-agreement-connector"></span><a data-role="terms" target="_blank" rel="noopener noreferrer"></a><span data-role="page-assistance-agreement-terminator"></span></p>
|
|
8444
|
+
</div>
|
|
6922
8445
|
</div>
|
|
6923
8446
|
<div class="page-assistance-actions">
|
|
6924
8447
|
<button type="button" class="secondary" data-role="page-assistance-decline"></button>
|
|
@@ -6954,7 +8477,7 @@ class WidgetView {
|
|
|
6954
8477
|
<button type="button" class="menu-control" data-role="captions" data-tooltip><span class="menu-icon" data-icon aria-hidden="true"></span><span class="control-label"></span></button>
|
|
6955
8478
|
<button type="button" class="menu-control" data-role="text-only" data-tooltip><span class="menu-icon" data-icon aria-hidden="true"></span><span class="control-label"></span></button>
|
|
6956
8479
|
<button type="button" class="menu-control" data-role="visual-pause" data-tooltip hidden><span class="menu-icon" data-icon aria-hidden="true"></span><span class="control-label"></span></button>
|
|
6957
|
-
<button type="button" class="menu-control" data-role="
|
|
8480
|
+
<button type="button" class="menu-control" data-role="session-legal-open" data-tooltip hidden><span class="menu-icon" data-icon aria-hidden="true"></span><span class="control-label"></span></button>
|
|
6958
8481
|
<button type="button" class="menu-control" data-role="human" data-tooltip><span class="menu-icon" data-icon aria-hidden="true"></span><span class="control-label"></span></button>
|
|
6959
8482
|
</div></details>
|
|
6960
8483
|
<button type="submit" class="send btn-submit off" data-role="send" data-tooltip disabled><i aria-hidden="true"><svg viewBox="0 0 512 512" aria-hidden="true" focusable="false"><path fill="currentColor" d="M473 39.05a24 24 0 0 0-25.5-5.46L47.47 185h-.08a24 24 0 0 0 1 45.16l.41.13l137.3 58.63a16 16 0 0 0 15.54-3.59L422 80a7.07 7.07 0 0 1 10 10L226.66 310.26a16 16 0 0 0-3.59 15.54l58.65 137.38c.06.2.12.38.19.57c3.2 9.27 11.3 15.81 21.09 16.25h1a24.63 24.63 0 0 0 23-15.46L478.39 64.62A24 24 0 0 0 473 39.05"/></svg></i></button>
|
|
@@ -6967,13 +8490,17 @@ class WidgetView {
|
|
|
6967
8490
|
</div>
|
|
6968
8491
|
</div>
|
|
6969
8492
|
</footer>
|
|
6970
|
-
<audio></audio>
|
|
8493
|
+
<audio playsinline aria-hidden="true"></audio>
|
|
6971
8494
|
`;
|
|
6972
8495
|
fragment.append(intro, highlight, panel, tooltip);
|
|
6973
8496
|
return fragment;
|
|
6974
8497
|
}
|
|
6975
8498
|
bind() {
|
|
6976
8499
|
this.panel.addEventListener("pointerdown", this.onPlaybackActivation, true);
|
|
8500
|
+
this.panel.addEventListener("wheel", this.onPanelWheel, { passive: false });
|
|
8501
|
+
this.captions.addEventListener("scroll", this.onCaptionsScroll, {
|
|
8502
|
+
passive: true,
|
|
8503
|
+
});
|
|
6977
8504
|
this.require('[data-role="end"]').addEventListener("click", () => {
|
|
6978
8505
|
this.requestEnd();
|
|
6979
8506
|
});
|
|
@@ -6993,6 +8520,7 @@ class WidgetView {
|
|
|
6993
8520
|
}
|
|
6994
8521
|
this.closePanel();
|
|
6995
8522
|
});
|
|
8523
|
+
this.require('[data-role="ending-dismiss"]').addEventListener("click", () => this.closePanel());
|
|
6996
8524
|
this.require('[data-role="view-toggle"]').addEventListener("click", () => {
|
|
6997
8525
|
if (!this.active ||
|
|
6998
8526
|
this.currentConfirmation ||
|
|
@@ -7037,6 +8565,7 @@ class WidgetView {
|
|
|
7037
8565
|
this.require('[data-role="mode-chat"]').addEventListener("click", () => this.requestSessionMode("text"));
|
|
7038
8566
|
this.require('[data-role="mode-voice"]').addEventListener("click", () => this.requestSessionMode("voice"));
|
|
7039
8567
|
this.require('[data-role="legal-open"]').addEventListener("click", () => this.openLegalDetails());
|
|
8568
|
+
this.require('[data-role="session-legal-open"]').addEventListener("click", () => this.openLegalDetails());
|
|
7040
8569
|
this.require('[data-role="legal-close"]').addEventListener("click", () => this.closeLegalDetails());
|
|
7041
8570
|
this.require('[data-role="legal-overlay"]').addEventListener("click", (event) => {
|
|
7042
8571
|
if (event.target === event.currentTarget)
|
|
@@ -7060,8 +8589,14 @@ class WidgetView {
|
|
|
7060
8589
|
dragHandle.addEventListener("pointermove", this.onDragMove);
|
|
7061
8590
|
dragHandle.addEventListener("pointerup", this.onDragEnd);
|
|
7062
8591
|
dragHandle.addEventListener("pointercancel", this.onDragEnd);
|
|
7063
|
-
this.require('[data-role="intro-voice"]').addEventListener("click", () =>
|
|
7064
|
-
|
|
8592
|
+
this.require('[data-role="intro-voice"]').addEventListener("click", () => {
|
|
8593
|
+
this.authorizeVoicePlayback(true);
|
|
8594
|
+
this.start("voice");
|
|
8595
|
+
});
|
|
8596
|
+
this.require('[data-role="intro-compact-voice"]').addEventListener("click", () => {
|
|
8597
|
+
this.authorizeVoicePlayback(true);
|
|
8598
|
+
this.start("voice");
|
|
8599
|
+
});
|
|
7065
8600
|
this.require('[data-role="intro-minimize"]').addEventListener("click", () => this.setIntroMinimized(true, true));
|
|
7066
8601
|
this.require('[data-role="intro-expand"]').addEventListener("click", () => this.start("text"));
|
|
7067
8602
|
const introInput = this.require('[data-role="intro-text-input"]');
|
|
@@ -7103,18 +8638,26 @@ class WidgetView {
|
|
|
7103
8638
|
this.submitIntroQuestion();
|
|
7104
8639
|
});
|
|
7105
8640
|
this.require('[data-role="mute"]').addEventListener("click", () => {
|
|
7106
|
-
|
|
7107
|
-
|
|
8641
|
+
const muted = !this.muted;
|
|
8642
|
+
if (muted)
|
|
8643
|
+
this.releaseActivePushToTalk();
|
|
8644
|
+
this.setMuted(muted);
|
|
8645
|
+
this.callbacks.onMute(muted);
|
|
7108
8646
|
});
|
|
7109
8647
|
this.require('[data-role="compact-mute"]').addEventListener("click", () => {
|
|
7110
|
-
|
|
7111
|
-
|
|
8648
|
+
const muted = !this.muted;
|
|
8649
|
+
if (muted)
|
|
8650
|
+
this.releaseActivePushToTalk();
|
|
8651
|
+
this.setMuted(muted);
|
|
8652
|
+
this.callbacks.onMute(muted);
|
|
7112
8653
|
});
|
|
7113
8654
|
this.require('[data-role="interrupt"]').addEventListener("click", () => {
|
|
7114
8655
|
this.interruptPlayback();
|
|
7115
8656
|
this.callbacks.onInterrupt();
|
|
7116
8657
|
});
|
|
7117
8658
|
this.require('[data-role="turn-mode"]').addEventListener("click", () => {
|
|
8659
|
+
if (!this.manualTurnsSupported)
|
|
8660
|
+
return;
|
|
7118
8661
|
const manual = !this.manualTurn;
|
|
7119
8662
|
if (!manual && !this.automaticTurnsAvailable)
|
|
7120
8663
|
return;
|
|
@@ -7128,11 +8671,25 @@ class WidgetView {
|
|
|
7128
8671
|
this.require('[data-role="push"]').addEventListener("click", () => {
|
|
7129
8672
|
if (!this.manualTurn)
|
|
7130
8673
|
return;
|
|
7131
|
-
this.
|
|
8674
|
+
const active = !this.pushActive && !this.pushPending;
|
|
8675
|
+
if (active && !this.pushToTalkAvailable())
|
|
8676
|
+
return;
|
|
8677
|
+
this.callbacks.onPushToTalk(active);
|
|
8678
|
+
});
|
|
8679
|
+
this.require('[data-role="header-push"]').addEventListener("click", () => {
|
|
8680
|
+
if (!this.manualTurn)
|
|
8681
|
+
return;
|
|
8682
|
+
const active = !this.pushActive && !this.pushPending;
|
|
8683
|
+
if (active && !this.pushToTalkAvailable())
|
|
8684
|
+
return;
|
|
8685
|
+
this.callbacks.onPushToTalk(active);
|
|
7132
8686
|
});
|
|
7133
8687
|
this.require('[data-role="pause"]').addEventListener("click", () => {
|
|
7134
|
-
|
|
7135
|
-
|
|
8688
|
+
const paused = !this.paused;
|
|
8689
|
+
if (paused)
|
|
8690
|
+
this.releaseActivePushToTalk();
|
|
8691
|
+
this.setPaused(paused);
|
|
8692
|
+
this.callbacks.onPause(paused);
|
|
7136
8693
|
});
|
|
7137
8694
|
this.require('[data-role="captions"]').addEventListener("click", () => {
|
|
7138
8695
|
this.captionsEnabled = !this.captionsEnabled;
|
|
@@ -7143,6 +8700,7 @@ class WidgetView {
|
|
|
7143
8700
|
this.require('[data-role="captions"]').setAttribute("aria-pressed", String(!this.captionsEnabled));
|
|
7144
8701
|
this.captions.hidden = !this.captionsEnabled;
|
|
7145
8702
|
this.compactCaptions.hidden = !this.captionsEnabled;
|
|
8703
|
+
this.placeCtaOffer();
|
|
7146
8704
|
if (!this.captionsEnabled) {
|
|
7147
8705
|
this.clearPendingCaptions();
|
|
7148
8706
|
this.clearCompactCaptions();
|
|
@@ -7188,8 +8746,8 @@ class WidgetView {
|
|
|
7188
8746
|
this.panel.getAttribute("aria-hidden") === "true") {
|
|
7189
8747
|
return;
|
|
7190
8748
|
}
|
|
7191
|
-
const value = textInput.value.trim();
|
|
7192
|
-
if (!value)
|
|
8749
|
+
const value = this.preserveRawText ? textInput.value : textInput.value.trim();
|
|
8750
|
+
if (!value.trim() || (this.preserveRawText && value.length > 4000))
|
|
7193
8751
|
return;
|
|
7194
8752
|
if (!this.callbacks.onText(value)) {
|
|
7195
8753
|
textInput.focus({ preventScroll: true });
|
|
@@ -7291,7 +8849,9 @@ class WidgetView {
|
|
|
7291
8849
|
document.addEventListener("pointerdown", this.onDocumentPointerDown, true);
|
|
7292
8850
|
document.addEventListener("visibilitychange", this.onEffectVisibilityChange);
|
|
7293
8851
|
window.addEventListener("resize", this.onResize, { passive: true });
|
|
7294
|
-
window.addEventListener("scroll", this.
|
|
8852
|
+
window.addEventListener("scroll", this.onHighlightViewportGeometryChange, {
|
|
8853
|
+
passive: true,
|
|
8854
|
+
});
|
|
7295
8855
|
window.addEventListener("scroll", this.onIntroFocusHostScroll, {
|
|
7296
8856
|
passive: true,
|
|
7297
8857
|
});
|
|
@@ -7299,7 +8859,9 @@ class WidgetView {
|
|
|
7299
8859
|
passive: true,
|
|
7300
8860
|
});
|
|
7301
8861
|
window.visualViewport?.addEventListener("resize", this.onIntroVisualViewportChange, { passive: true });
|
|
8862
|
+
window.visualViewport?.addEventListener("resize", this.onHighlightViewportGeometryChange, { passive: true });
|
|
7302
8863
|
window.visualViewport?.addEventListener("scroll", this.onIntroVisualViewportChange, { passive: true });
|
|
8864
|
+
window.visualViewport?.addEventListener("scroll", this.onHighlightViewportGeometryChange, { passive: true });
|
|
7303
8865
|
}
|
|
7304
8866
|
applyConfig() {
|
|
7305
8867
|
const appearance = this.config.appearance;
|
|
@@ -7334,6 +8896,8 @@ class WidgetView {
|
|
|
7334
8896
|
this.setControlIcon("brand-mark", lucide_1.AudioLines);
|
|
7335
8897
|
this.applyBrandAvatar();
|
|
7336
8898
|
this.status.textContent = this.messages.ready;
|
|
8899
|
+
this.status.setAttribute("aria-label", this.messages.ready);
|
|
8900
|
+
this.status.title = this.messages.ready;
|
|
7337
8901
|
this.duration.setAttribute("aria-label", this.messages.sessionDuration);
|
|
7338
8902
|
this.require(".more-menu").setAttribute("aria-label", this.messages.sessionControls);
|
|
7339
8903
|
this.panel.setAttribute("aria-label", entryTitle);
|
|
@@ -7389,6 +8953,10 @@ class WidgetView {
|
|
|
7389
8953
|
close.setAttribute("aria-label", this.messages.close);
|
|
7390
8954
|
this.setTooltip(close, this.messages.close);
|
|
7391
8955
|
this.setControlIcon("close", lucide_1.X);
|
|
8956
|
+
const endingDismiss = this.require('[data-role="ending-dismiss"]');
|
|
8957
|
+
endingDismiss.setAttribute("aria-label", this.messages.close);
|
|
8958
|
+
this.setTooltip(endingDismiss, this.messages.close);
|
|
8959
|
+
this.setControlIcon("ending-dismiss", lucide_1.X);
|
|
7392
8960
|
const viewToggle = this.require('[data-role="view-toggle"]');
|
|
7393
8961
|
viewToggle.setAttribute("aria-label", this.messages.minimize);
|
|
7394
8962
|
this.setTooltip(viewToggle, this.messages.minimize);
|
|
@@ -7479,6 +9047,8 @@ class WidgetView {
|
|
|
7479
9047
|
this.setControlIcon("turn-mode", lucide_1.Hand);
|
|
7480
9048
|
this.setControlLabel("push", this.messages.startSpeaking);
|
|
7481
9049
|
this.setControlIcon("push", lucide_1.Mic);
|
|
9050
|
+
this.setControlLabel("header-push", this.messages.startSpeaking);
|
|
9051
|
+
this.setControlIcon("header-push", lucide_1.Mic);
|
|
7482
9052
|
this.configureVoiceControls(false, false, false);
|
|
7483
9053
|
this.setControlLabel("pause", this.messages.pauseActions);
|
|
7484
9054
|
this.setControlIcon("pause", lucide_1.Pause);
|
|
@@ -7490,6 +9060,8 @@ class WidgetView {
|
|
|
7490
9060
|
this.setControlIcon("visual-pause", lucide_1.EyeOff);
|
|
7491
9061
|
this.setControlLabel("page-assistance-revoke", this.messages.pageAssistanceRevoke);
|
|
7492
9062
|
this.setControlIcon("page-assistance-revoke", lucide_1.ShieldOff);
|
|
9063
|
+
this.setControlLabel("session-legal-open", this.messages.legalDetails);
|
|
9064
|
+
this.setControlIcon("session-legal-open", lucide_1.ShieldCheck);
|
|
7493
9065
|
this.setControlLabel("human", this.messages.requestHuman);
|
|
7494
9066
|
this.setControlIcon("human", lucide_1.UserRound);
|
|
7495
9067
|
this.require('[data-role="support-reply-message"]').textContent =
|
|
@@ -7525,6 +9097,7 @@ class WidgetView {
|
|
|
7525
9097
|
this.require('[data-outcome="not_resolved"]').textContent =
|
|
7526
9098
|
this.messages.notResolved;
|
|
7527
9099
|
this.renderLegalScopes();
|
|
9100
|
+
this.renderRecordingConsent();
|
|
7528
9101
|
const privacy = this.require('[data-role="privacy"]');
|
|
7529
9102
|
if (this.config.consent?.policyUrl)
|
|
7530
9103
|
privacy.href = this.config.consent.policyUrl;
|
|
@@ -7550,10 +9123,7 @@ class WidgetView {
|
|
|
7550
9123
|
this.require('[data-role="page-assistance-agreement"]').hidden = privacy.hidden && terms.hidden;
|
|
7551
9124
|
this.require('[data-role="page-assistance-agreement-connector"]').hidden = privacy.hidden || terms.hidden;
|
|
7552
9125
|
this.syncPageAssistanceFooter();
|
|
7553
|
-
this.
|
|
7554
|
-
!this.config.consent?.disclosure &&
|
|
7555
|
-
this.require('[data-role="legal-scopes"]').childElementCount === 0 &&
|
|
7556
|
-
legalLinks.hidden;
|
|
9126
|
+
this.syncLegalDetailsAvailability();
|
|
7557
9127
|
if (this.hasActiveSessionMarker())
|
|
7558
9128
|
this.clearPanelInlinePosition();
|
|
7559
9129
|
else
|
|
@@ -7591,6 +9161,29 @@ class WidgetView {
|
|
|
7591
9161
|
mark.classList.add("has-avatar");
|
|
7592
9162
|
mark.append(avatar);
|
|
7593
9163
|
}
|
|
9164
|
+
recordingConsentOffered() {
|
|
9165
|
+
return this.config.schemaVersion === 3 && this.config.replayRecordingEnabled === true &&
|
|
9166
|
+
this.config.consent?.optionalScopes.includes("session_recording") === true;
|
|
9167
|
+
}
|
|
9168
|
+
setRecordingConsent(allowed) {
|
|
9169
|
+
this.recordingConsent = allowed && this.recordingConsentOffered();
|
|
9170
|
+
for (const input of this.shadow.querySelectorAll('[data-role="recording-consent-input"]')) {
|
|
9171
|
+
input.checked = this.recordingConsent;
|
|
9172
|
+
}
|
|
9173
|
+
}
|
|
9174
|
+
renderRecordingConsent() {
|
|
9175
|
+
for (const row of this.shadow.querySelectorAll('[data-role="recording-consent"]')) {
|
|
9176
|
+
row.hidden = !this.recordingConsentOffered();
|
|
9177
|
+
row.querySelector('[data-role="recording-consent-label"]').textContent = this.messages.recordingConsent;
|
|
9178
|
+
row.querySelector('[data-role="recording-consent-description"]').textContent = this.messages.recordingConsentDescription;
|
|
9179
|
+
const input = row.querySelector('[data-role="recording-consent-input"]');
|
|
9180
|
+
input.checked = this.recordingConsent;
|
|
9181
|
+
input.onchange = () => {
|
|
9182
|
+
this.setRecordingConsent(input.checked);
|
|
9183
|
+
this.callbacks.onRecordingConsent?.(this.recordingConsent);
|
|
9184
|
+
};
|
|
9185
|
+
}
|
|
9186
|
+
}
|
|
7594
9187
|
renderLegalScopes() {
|
|
7595
9188
|
const container = this.require('[data-role="legal-scopes"]');
|
|
7596
9189
|
container.replaceChildren();
|
|
@@ -7636,6 +9229,8 @@ class WidgetView {
|
|
|
7636
9229
|
...(this.config.consent?.optionalScopes ?? []),
|
|
7637
9230
|
]);
|
|
7638
9231
|
const scopes = ["ai_disclosure", "text"];
|
|
9232
|
+
if (this.recordingConsentOffered() && this.recordingConsent)
|
|
9233
|
+
scopes.push("session_recording");
|
|
7639
9234
|
if (required.has("page_context") &&
|
|
7640
9235
|
this.config.capabilities?.pageContext === true) {
|
|
7641
9236
|
scopes.push("page_context");
|
|
@@ -7646,6 +9241,7 @@ class WidgetView {
|
|
|
7646
9241
|
return false;
|
|
7647
9242
|
}
|
|
7648
9243
|
scopes.push("microphone");
|
|
9244
|
+
this.authorizeVoicePlayback(true);
|
|
7649
9245
|
}
|
|
7650
9246
|
this.stagedLaunchMode = mode;
|
|
7651
9247
|
this.initialQuestionStaged = mode === "text" && Boolean(initialQuestion);
|
|
@@ -7656,6 +9252,8 @@ class WidgetView {
|
|
|
7656
9252
|
? this.callbacks.onStart(mode, scopes, initialQuestion)
|
|
7657
9253
|
: this.callbacks.onStart(mode, scopes);
|
|
7658
9254
|
if (!admitted) {
|
|
9255
|
+
if (mode === "voice")
|
|
9256
|
+
this.authorizeVoicePlayback(false);
|
|
7659
9257
|
this.stagedLaunchMode = null;
|
|
7660
9258
|
this.initialQuestionStaged = false;
|
|
7661
9259
|
this.clearPendingWelcomeSkeleton();
|
|
@@ -7672,8 +9270,8 @@ class WidgetView {
|
|
|
7672
9270
|
const input = this.require('[data-role="intro-text-input"]');
|
|
7673
9271
|
if (input.disabled || input.hidden || this.introComposing)
|
|
7674
9272
|
return false;
|
|
7675
|
-
const value = input.value.trim();
|
|
7676
|
-
if (!value) {
|
|
9273
|
+
const value = this.preserveRawText ? input.value : input.value.trim();
|
|
9274
|
+
if (!value.trim()) {
|
|
7677
9275
|
input.setAttribute("aria-invalid", "false");
|
|
7678
9276
|
this.syncIntroSendState();
|
|
7679
9277
|
return false;
|
|
@@ -7816,7 +9414,7 @@ class WidgetView {
|
|
|
7816
9414
|
!input.disabled &&
|
|
7817
9415
|
!send.hidden &&
|
|
7818
9416
|
input.value.trim().length > 0 &&
|
|
7819
|
-
input.value.trim().length <= INITIAL_QUESTION_MAX_LENGTH;
|
|
9417
|
+
(this.preserveRawText ? input.value.length : input.value.trim().length) <= INITIAL_QUESTION_MAX_LENGTH;
|
|
7820
9418
|
entry.dataset.hasDraft = String(canSubmit);
|
|
7821
9419
|
send.disabled = !canSubmit;
|
|
7822
9420
|
send.tabIndex = canSubmit ? 0 : -1;
|
|
@@ -7955,6 +9553,7 @@ class WidgetView {
|
|
|
7955
9553
|
requestEnd() {
|
|
7956
9554
|
if (!this.active || this.endRequested)
|
|
7957
9555
|
return;
|
|
9556
|
+
this.releaseActivePushToTalk();
|
|
7958
9557
|
this.endRequested = true;
|
|
7959
9558
|
this.setStatus(this.messages.ending);
|
|
7960
9559
|
this.setActivity("ending");
|
|
@@ -7964,11 +9563,8 @@ class WidgetView {
|
|
|
7964
9563
|
this.require('[data-role="notice-message"]').textContent =
|
|
7965
9564
|
this.messages.ending;
|
|
7966
9565
|
notice.setAttribute("aria-busy", "true");
|
|
7967
|
-
this.syncHeaderActions();
|
|
7968
|
-
}
|
|
7969
|
-
else {
|
|
7970
|
-
this.syncEndControls();
|
|
7971
9566
|
}
|
|
9567
|
+
this.syncHeaderActions();
|
|
7972
9568
|
this.syncPanelDragState();
|
|
7973
9569
|
this.callbacks.onEnd();
|
|
7974
9570
|
}
|
|
@@ -8549,8 +10145,15 @@ class WidgetView {
|
|
|
8549
10145
|
closePanel() {
|
|
8550
10146
|
if (!this.panel.classList.contains("open"))
|
|
8551
10147
|
return;
|
|
8552
|
-
if (this.panel.classList.contains("ending-state"))
|
|
10148
|
+
if (this.panel.classList.contains("ending-state")) {
|
|
10149
|
+
this.endingPresentationDismissed = true;
|
|
10150
|
+
this.panel.classList.remove("open");
|
|
10151
|
+
this.removeStoredPanelVisibility();
|
|
10152
|
+
this.syncLauncherState();
|
|
10153
|
+
this.syncHeaderActions();
|
|
10154
|
+
this.callbacks.onOpenChange?.(false);
|
|
8553
10155
|
return;
|
|
10156
|
+
}
|
|
8554
10157
|
if (this.active) {
|
|
8555
10158
|
if (!this.currentConfirmation &&
|
|
8556
10159
|
!this.currentVisualRequest &&
|
|
@@ -8680,26 +10283,33 @@ class WidgetView {
|
|
|
8680
10283
|
this.settleCompactCaptionMotion();
|
|
8681
10284
|
this.settleExpandedBubbleMotion();
|
|
8682
10285
|
}
|
|
8683
|
-
if (!value && this.compact)
|
|
10286
|
+
if (!value && this.compact) {
|
|
8684
10287
|
this.settleExpandedBubbleMotion();
|
|
10288
|
+
this.captionsPinnedToBottom = true;
|
|
10289
|
+
}
|
|
8685
10290
|
this.compact = value;
|
|
8686
10291
|
if (!value)
|
|
8687
10292
|
this.panel.classList.remove("compact-text-arrived");
|
|
8688
10293
|
this.panel.classList.toggle("compact", this.compact);
|
|
8689
|
-
|
|
8690
|
-
this.scrollCaptionsToBottom();
|
|
10294
|
+
this.placeCtaOffer();
|
|
8691
10295
|
this.syncSurfaceEffectOwner();
|
|
8692
10296
|
if (persist && this.active && this.persistentState) {
|
|
8693
10297
|
this.panelViewInitialized = true;
|
|
8694
10298
|
try {
|
|
8695
|
-
sessionStorage.setItem(PANEL_VIEW_KEY, this.compact ? "compact" : "expanded");
|
|
10299
|
+
sessionStorage.setItem(this.storageKey(PANEL_VIEW_KEY), this.compact ? "compact" : "expanded");
|
|
8696
10300
|
}
|
|
8697
10301
|
catch {
|
|
8698
10302
|
// The current view still works when session storage is unavailable.
|
|
8699
10303
|
}
|
|
8700
10304
|
}
|
|
8701
10305
|
this.syncHeaderActions();
|
|
8702
|
-
|
|
10306
|
+
if (!value)
|
|
10307
|
+
this.scrollCaptionsToBottom();
|
|
10308
|
+
requestAnimationFrame(() => {
|
|
10309
|
+
if (!this.compact)
|
|
10310
|
+
this.scrollCaptionsToBottom();
|
|
10311
|
+
this.clampPanelPosition();
|
|
10312
|
+
});
|
|
8703
10313
|
}
|
|
8704
10314
|
settleExpandedBubbleMotion() {
|
|
8705
10315
|
this.captions
|
|
@@ -8734,6 +10344,7 @@ class WidgetView {
|
|
|
8734
10344
|
}
|
|
8735
10345
|
const sourceRect = transitionSnapshot?.rect ?? this.panel.getBoundingClientRect();
|
|
8736
10346
|
const voicePresentation = this.voiceActive || this.startingVoicePresentation;
|
|
10347
|
+
this.syncPushToTalkControls();
|
|
8737
10348
|
let targetRect;
|
|
8738
10349
|
let innerTarget = null;
|
|
8739
10350
|
let outerClone;
|
|
@@ -8967,6 +10578,9 @@ class WidgetView {
|
|
|
8967
10578
|
return clone;
|
|
8968
10579
|
}
|
|
8969
10580
|
prepareSessionTransitionClone(clone) {
|
|
10581
|
+
clone
|
|
10582
|
+
.querySelectorAll(".cta-offer, .cta-action-slot")
|
|
10583
|
+
.forEach((node) => node.remove());
|
|
8970
10584
|
clone.classList.remove("primary-surface-content-fade");
|
|
8971
10585
|
clone
|
|
8972
10586
|
.querySelectorAll("details.more-controls")
|
|
@@ -9138,11 +10752,14 @@ class WidgetView {
|
|
|
9138
10752
|
}
|
|
9139
10753
|
});
|
|
9140
10754
|
}
|
|
10755
|
+
storageKey(key) {
|
|
10756
|
+
return this.storageNamespace ? `${key}_${this.storageNamespace}` : key;
|
|
10757
|
+
}
|
|
9141
10758
|
readPanelView() {
|
|
9142
10759
|
if (!this.persistentState)
|
|
9143
10760
|
return this.initialPanelView;
|
|
9144
10761
|
try {
|
|
9145
|
-
const stored = sessionStorage.getItem(PANEL_VIEW_KEY);
|
|
10762
|
+
const stored = sessionStorage.getItem(this.storageKey(PANEL_VIEW_KEY));
|
|
9146
10763
|
return stored === "compact" || stored === "expanded" ? stored : null;
|
|
9147
10764
|
}
|
|
9148
10765
|
catch {
|
|
@@ -9153,7 +10770,7 @@ class WidgetView {
|
|
|
9153
10770
|
if (!this.persistentState)
|
|
9154
10771
|
return null;
|
|
9155
10772
|
try {
|
|
9156
|
-
const stored = sessionStorage.getItem(PANEL_VISIBILITY_KEY);
|
|
10773
|
+
const stored = sessionStorage.getItem(this.storageKey(PANEL_VISIBILITY_KEY));
|
|
9157
10774
|
return stored === "open" || stored === "hidden" ? stored : null;
|
|
9158
10775
|
}
|
|
9159
10776
|
catch {
|
|
@@ -9164,7 +10781,7 @@ class WidgetView {
|
|
|
9164
10781
|
if (!this.persistentState)
|
|
9165
10782
|
return;
|
|
9166
10783
|
try {
|
|
9167
|
-
sessionStorage.setItem(PANEL_VISIBILITY_KEY, value);
|
|
10784
|
+
sessionStorage.setItem(this.storageKey(PANEL_VISIBILITY_KEY), value);
|
|
9168
10785
|
}
|
|
9169
10786
|
catch {
|
|
9170
10787
|
// Panel visibility remains usable when session storage is unavailable.
|
|
@@ -9174,7 +10791,7 @@ class WidgetView {
|
|
|
9174
10791
|
if (!this.persistentState)
|
|
9175
10792
|
return;
|
|
9176
10793
|
try {
|
|
9177
|
-
sessionStorage.removeItem(PANEL_VISIBILITY_KEY);
|
|
10794
|
+
sessionStorage.removeItem(this.storageKey(PANEL_VISIBILITY_KEY));
|
|
9178
10795
|
}
|
|
9179
10796
|
catch {
|
|
9180
10797
|
// Ignore unavailable session storage.
|
|
@@ -9185,8 +10802,8 @@ class WidgetView {
|
|
|
9185
10802
|
if (!this.persistentState)
|
|
9186
10803
|
return;
|
|
9187
10804
|
try {
|
|
9188
|
-
sessionStorage.removeItem(PANEL_VIEW_KEY);
|
|
9189
|
-
sessionStorage.removeItem(PANEL_VISIBILITY_KEY);
|
|
10805
|
+
sessionStorage.removeItem(this.storageKey(PANEL_VIEW_KEY));
|
|
10806
|
+
sessionStorage.removeItem(this.storageKey(PANEL_VISIBILITY_KEY));
|
|
9190
10807
|
}
|
|
9191
10808
|
catch {
|
|
9192
10809
|
// Ignore unavailable session storage.
|
|
@@ -9196,6 +10813,7 @@ class WidgetView {
|
|
|
9196
10813
|
this.intro.hidden =
|
|
9197
10814
|
this.active ||
|
|
9198
10815
|
this.launcherSuppressed ||
|
|
10816
|
+
this.panel.classList.contains("ending-state") ||
|
|
9199
10817
|
this.panel.classList.contains("open");
|
|
9200
10818
|
this.syncProactiveEngagementVisibility();
|
|
9201
10819
|
this.syncSurfaceEffectOwner();
|
|
@@ -9277,7 +10895,7 @@ class WidgetView {
|
|
|
9277
10895
|
let startedAt = Date.now();
|
|
9278
10896
|
if (resume && this.persistentState) {
|
|
9279
10897
|
try {
|
|
9280
|
-
const stored = Number(sessionStorage.getItem(SESSION_START_KEY));
|
|
10898
|
+
const stored = Number(sessionStorage.getItem(this.storageKey(SESSION_START_KEY)));
|
|
9281
10899
|
if (Number.isFinite(stored) && stored > 0 && stored <= startedAt) {
|
|
9282
10900
|
startedAt = stored;
|
|
9283
10901
|
}
|
|
@@ -9293,7 +10911,7 @@ class WidgetView {
|
|
|
9293
10911
|
this.stagedLaunchMode === null);
|
|
9294
10912
|
if (this.persistentState) {
|
|
9295
10913
|
try {
|
|
9296
|
-
sessionStorage.setItem(SESSION_START_KEY, String(startedAt));
|
|
10914
|
+
sessionStorage.setItem(this.storageKey(SESSION_START_KEY), String(startedAt));
|
|
9297
10915
|
}
|
|
9298
10916
|
catch {
|
|
9299
10917
|
// A timer still works when session storage is unavailable.
|
|
@@ -9320,7 +10938,7 @@ class WidgetView {
|
|
|
9320
10938
|
if (!clearStoredStart || !this.persistentState)
|
|
9321
10939
|
return;
|
|
9322
10940
|
try {
|
|
9323
|
-
sessionStorage.removeItem(SESSION_START_KEY);
|
|
10941
|
+
sessionStorage.removeItem(this.storageKey(SESSION_START_KEY));
|
|
9324
10942
|
}
|
|
9325
10943
|
catch {
|
|
9326
10944
|
// Ignore unavailable session storage.
|
|
@@ -9428,6 +11046,7 @@ class WidgetView {
|
|
|
9428
11046
|
this.welcomePresented = false;
|
|
9429
11047
|
this.pendingWelcomeBubble = null;
|
|
9430
11048
|
this.captions.replaceChildren();
|
|
11049
|
+
this.captionsPinnedToBottom = true;
|
|
9431
11050
|
const empty = document.createElement("div");
|
|
9432
11051
|
empty.className = "empty";
|
|
9433
11052
|
empty.dataset.role = "empty";
|
|
@@ -9457,6 +11076,7 @@ class WidgetView {
|
|
|
9457
11076
|
this.attribution.hidden = true;
|
|
9458
11077
|
}
|
|
9459
11078
|
openLegalDetails() {
|
|
11079
|
+
this.releaseActivePushToTalk();
|
|
9460
11080
|
if (!this.panel.classList.contains("open")) {
|
|
9461
11081
|
this.legalOpenedPanel = true;
|
|
9462
11082
|
this.openPanel();
|
|
@@ -9469,6 +11089,7 @@ class WidgetView {
|
|
|
9469
11089
|
fallbackFocus: () => this.dialogFallbackFocus(),
|
|
9470
11090
|
onEscape: () => this.closeLegalDetails(),
|
|
9471
11091
|
});
|
|
11092
|
+
this.syncHeaderActions();
|
|
9472
11093
|
}
|
|
9473
11094
|
closeLegalDetails() {
|
|
9474
11095
|
const overlay = this.require('[data-role="legal-overlay"]');
|
|
@@ -9481,6 +11102,7 @@ class WidgetView {
|
|
|
9481
11102
|
this.closePanel();
|
|
9482
11103
|
return;
|
|
9483
11104
|
}
|
|
11105
|
+
this.syncHeaderActions();
|
|
9484
11106
|
}
|
|
9485
11107
|
syncAdvancedSessionControlsVisibility() {
|
|
9486
11108
|
const controls = [
|
|
@@ -9530,7 +11152,7 @@ class WidgetView {
|
|
|
9530
11152
|
const text = button.querySelector(".control-label");
|
|
9531
11153
|
if (text)
|
|
9532
11154
|
text.textContent = label;
|
|
9533
|
-
else
|
|
11155
|
+
else if (!button.querySelector("[data-icon]"))
|
|
9534
11156
|
button.textContent = label;
|
|
9535
11157
|
button.setAttribute("aria-label", label);
|
|
9536
11158
|
button.removeAttribute("title");
|
|
@@ -9619,6 +11241,18 @@ class WidgetView {
|
|
|
9619
11241
|
trigger.focus();
|
|
9620
11242
|
return false;
|
|
9621
11243
|
}
|
|
11244
|
+
rearmHighlightIntersection() {
|
|
11245
|
+
const observer = this.highlightIntersectionObserver;
|
|
11246
|
+
const target = this.highlightedElement;
|
|
11247
|
+
if (!observer || !target)
|
|
11248
|
+
return;
|
|
11249
|
+
observer.takeRecords();
|
|
11250
|
+
observer.unobserve(target);
|
|
11251
|
+
this.highlightIntersectionKnown = false;
|
|
11252
|
+
this.highlightIntersectionRect = null;
|
|
11253
|
+
this.highlight.classList.remove("visible");
|
|
11254
|
+
observer.observe(target);
|
|
11255
|
+
}
|
|
9622
11256
|
setPanelPosition(left, top) {
|
|
9623
11257
|
this.panel.style.insetInlineStart = "auto";
|
|
9624
11258
|
this.panel.style.insetInlineEnd = "auto";
|
|
@@ -9632,7 +11266,7 @@ class WidgetView {
|
|
|
9632
11266
|
if (!this.canDragPanel() || !this.persistentState)
|
|
9633
11267
|
return;
|
|
9634
11268
|
try {
|
|
9635
|
-
sessionStorage.setItem(PANEL_POSITION_KEY, JSON.stringify({ left: Math.round(left), top: Math.round(top) }));
|
|
11269
|
+
sessionStorage.setItem(this.storageKey(PANEL_POSITION_KEY), JSON.stringify({ left: Math.round(left), top: Math.round(top) }));
|
|
9636
11270
|
}
|
|
9637
11271
|
catch {
|
|
9638
11272
|
// The panel remains draggable when storage is unavailable.
|
|
@@ -9642,7 +11276,7 @@ class WidgetView {
|
|
|
9642
11276
|
if (!this.persistentState)
|
|
9643
11277
|
return false;
|
|
9644
11278
|
try {
|
|
9645
|
-
const startedAt = Number(sessionStorage.getItem(SESSION_START_KEY));
|
|
11279
|
+
const startedAt = Number(sessionStorage.getItem(this.storageKey(SESSION_START_KEY)));
|
|
9646
11280
|
return (Number.isFinite(startedAt) && startedAt > 0 && startedAt <= Date.now());
|
|
9647
11281
|
}
|
|
9648
11282
|
catch {
|
|
@@ -9655,8 +11289,8 @@ class WidgetView {
|
|
|
9655
11289
|
if (!this.persistentState)
|
|
9656
11290
|
return;
|
|
9657
11291
|
try {
|
|
9658
|
-
sessionStorage.removeItem(PANEL_POSITION_KEY);
|
|
9659
|
-
sessionStorage.removeItem(LEGACY_PANEL_POSITION_KEY);
|
|
11292
|
+
sessionStorage.removeItem(this.storageKey(PANEL_POSITION_KEY));
|
|
11293
|
+
sessionStorage.removeItem(this.storageKey(LEGACY_PANEL_POSITION_KEY));
|
|
9660
11294
|
}
|
|
9661
11295
|
catch {
|
|
9662
11296
|
// The default anchored position still applies without session storage.
|
|
@@ -9679,7 +11313,7 @@ class WidgetView {
|
|
|
9679
11313
|
if (!this.canDragPanel() || !this.persistentState)
|
|
9680
11314
|
return;
|
|
9681
11315
|
try {
|
|
9682
|
-
const parsed = JSON.parse(sessionStorage.getItem(PANEL_POSITION_KEY) || "null");
|
|
11316
|
+
const parsed = JSON.parse(sessionStorage.getItem(this.storageKey(PANEL_POSITION_KEY)) || "null");
|
|
9683
11317
|
if (parsed &&
|
|
9684
11318
|
typeof parsed.left === "number" &&
|
|
9685
11319
|
Number.isFinite(parsed.left) &&
|
|
@@ -9767,6 +11401,14 @@ class WidgetView {
|
|
|
9767
11401
|
!sessionReady ||
|
|
9768
11402
|
!this.voiceActive ||
|
|
9769
11403
|
!this.compact;
|
|
11404
|
+
const headerPush = this.require('[data-role="header-push"]');
|
|
11405
|
+
headerPush.hidden =
|
|
11406
|
+
endingState ||
|
|
11407
|
+
errorState ||
|
|
11408
|
+
!sessionReady ||
|
|
11409
|
+
!this.voiceActive ||
|
|
11410
|
+
!this.manualTurn;
|
|
11411
|
+
headerPush.disabled = !this.pushToTalkAvailable();
|
|
9770
11412
|
const viewToggle = this.require('[data-role="view-toggle"]');
|
|
9771
11413
|
viewToggle.hidden =
|
|
9772
11414
|
endingState ||
|
|
@@ -9867,7 +11509,7 @@ class WidgetView {
|
|
|
9867
11509
|
this.require('[data-role="restart"]').hidden =
|
|
9868
11510
|
this.active || this.assistantState !== "ended";
|
|
9869
11511
|
const close = this.require('[data-role="close"]');
|
|
9870
|
-
close.hidden = this.active || errorState
|
|
11512
|
+
close.hidden = this.active || errorState;
|
|
9871
11513
|
close.setAttribute("aria-label", this.messages.close);
|
|
9872
11514
|
this.setTooltip(close, this.messages.close);
|
|
9873
11515
|
this.syncPanelDragState();
|