@burdenoff/fe-libs 2026.1024.1 → 2026.1024.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (132) hide show
  1. package/dist/chrome/FooterBar.d.ts +1 -1
  2. package/dist/chrome/NativePageTransition.d.ts +1 -1
  3. package/dist/chrome/ProductPickerSheet.js +42 -42
  4. package/dist/chrome/ProductSwitcher.d.ts +8 -0
  5. package/dist/chrome/ProductSwitcher.js +83 -72
  6. package/dist/chrome/index.d.ts +9 -9
  7. package/dist/chrome/swipe/swipeMath.d.ts +1 -1
  8. package/dist/shared/assistant/api.d.ts +3 -3
  9. package/dist/shared/assistant/appControls/grammar.d.ts +21 -21
  10. package/dist/shared/assistant/appControls/languageReply.d.ts +1 -1
  11. package/dist/shared/assistant/appControls/names.d.ts +3 -3
  12. package/dist/shared/assistant/appControls/pageAdapters.d.ts +5 -5
  13. package/dist/shared/assistant/appControls/plan.d.ts +38 -38
  14. package/dist/shared/assistant/appControls/types.d.ts +15 -15
  15. package/dist/shared/assistant/appControls/useAssistantControl.d.ts +1 -1
  16. package/dist/shared/assistant/attachmentSources.d.ts +2 -2
  17. package/dist/shared/assistant/attachments.d.ts +5 -5
  18. package/dist/shared/assistant/autoRouting.d.ts +6 -6
  19. package/dist/shared/assistant/avatar/live/LiveAvatarStage.js +5 -1
  20. package/dist/shared/assistant/avatar/live/LiveAvatarTabView.js +28 -25
  21. package/dist/shared/assistant/avatar/live/createLiveAvatarSeam.d.ts +1 -1
  22. package/dist/shared/assistant/avatar/live/createLiveAvatarSeam.js +61 -50
  23. package/dist/shared/assistant/avatar/live/liveAvatarController.d.ts +19 -4
  24. package/dist/shared/assistant/avatar/live/liveAvatarController.js +163 -155
  25. package/dist/shared/assistant/avatar/live/liveAvatarStatus.d.ts +5 -3
  26. package/dist/shared/assistant/avatar/live/liveAvatarStatus.js +2 -2
  27. package/dist/shared/assistant/conversation.d.ts +20 -20
  28. package/dist/shared/assistant/displayContent.d.ts +4 -4
  29. package/dist/shared/assistant/documentText.d.ts +3 -3
  30. package/dist/shared/assistant/exportConversation.d.ts +1 -1
  31. package/dist/shared/assistant/history/historyControls.d.ts +4 -4
  32. package/dist/shared/assistant/history/historyErrors.d.ts +3 -3
  33. package/dist/shared/assistant/history/historyList.d.ts +5 -5
  34. package/dist/shared/assistant/history/historyMerge.d.ts +4 -4
  35. package/dist/shared/assistant/history/historyOperations.d.ts +1 -1
  36. package/dist/shared/assistant/history/historySearch.d.ts +5 -5
  37. package/dist/shared/assistant/history/historyStatus.d.ts +1 -1
  38. package/dist/shared/assistant/history/historyTypes.d.ts +12 -12
  39. package/dist/shared/assistant/history/profileBoundStorage.d.ts +2 -2
  40. package/dist/shared/assistant/i18n.d.ts +1 -1
  41. package/dist/shared/assistant/i18nManifest.d.ts +534 -534
  42. package/dist/shared/assistant/liveDeltas.d.ts +1 -1
  43. package/dist/shared/assistant/liveOverlay.d.ts +1 -1
  44. package/dist/shared/assistant/localUiCommandCopy.d.ts +1 -1
  45. package/dist/shared/assistant/localUiCommands.d.ts +22 -22
  46. package/dist/shared/assistant/localeCommands/engine.d.ts +5 -5
  47. package/dist/shared/assistant/localeCommands/evaluate.d.ts +8 -8
  48. package/dist/shared/assistant/localeCommands/fold.d.ts +2 -2
  49. package/dist/shared/assistant/localeCommands/frames.d.ts +3 -3
  50. package/dist/shared/assistant/localeCommands/gate.d.ts +3 -3
  51. package/dist/shared/assistant/localeCommands/languageNames.d.ts +1 -1
  52. package/dist/shared/assistant/localeCommands/normalise.d.ts +1 -1
  53. package/dist/shared/assistant/localeCommands/types.d.ts +4 -4
  54. package/dist/shared/assistant/modeCapabilities.d.ts +1 -1
  55. package/dist/shared/assistant/modeCopy.d.ts +2 -2
  56. package/dist/shared/assistant/permissionError.d.ts +2 -2
  57. package/dist/shared/assistant/preview/surfaceState.d.ts +1 -1
  58. package/dist/shared/assistant/preview/types.d.ts +5 -5
  59. package/dist/shared/assistant/preview/writeActionResults.d.ts +1 -1
  60. package/dist/shared/assistant/prewarm.d.ts +5 -5
  61. package/dist/shared/assistant/quota.d.ts +2 -2
  62. package/dist/shared/assistant/sandboxReadiness.d.ts +2 -2
  63. package/dist/shared/assistant/speech/speechFeed.d.ts +3 -3
  64. package/dist/shared/assistant/turnOutcome.d.ts +2 -2
  65. package/dist/shared/assistant/turnProgress.d.ts +1 -1
  66. package/dist/shared/assistant/turnState.d.ts +1 -1
  67. package/dist/shared/assistant/turnStream.d.ts +3 -3
  68. package/dist/shared/assistant/turnTimeline.d.ts +13 -13
  69. package/dist/shared/assistant/turnTimingReport.d.ts +1 -1
  70. package/dist/shared/assistant/turnTimingReporter.d.ts +3 -3
  71. package/dist/shared/assistant/ui/AssistantAvatarTabs.d.ts +1 -1
  72. package/dist/shared/assistant/ui/AssistantHistoryNotices.d.ts +1 -1
  73. package/dist/shared/assistant/ui/AssistantToolActivity.d.ts +1 -1
  74. package/dist/shared/assistant/ui/AssistantUiOfferLink.d.ts +2 -2
  75. package/dist/shared/assistant/ui/AssistantWriteConfirmDialog.d.ts +3 -3
  76. package/dist/shared/assistant/ui/composer/AssistantAttachmentButton.d.ts +1 -1
  77. package/dist/shared/assistant/ui/composer/AssistantConnectSourceItem.d.ts +1 -1
  78. package/dist/shared/assistant/ui/leaveConfirmFocus.d.ts +1 -1
  79. package/dist/shared/assistant/ui/leaveConfirmNavigate.d.ts +3 -3
  80. package/dist/shared/assistant/ui/panelOverlays.d.ts +5 -5
  81. package/dist/shared/assistant/ui/useVoiceSession.d.ts +5 -5
  82. package/dist/shared/assistant/ui/useWriteProposalConfirm.d.ts +4 -4
  83. package/dist/shared/assistant/ui/useWriteProposals.d.ts +2 -2
  84. package/dist/shared/assistant/ui/voice/AssistantVoiceSession.d.ts +1 -1
  85. package/dist/shared/assistant/ui/voice/VoiceCaption.d.ts +1 -1
  86. package/dist/shared/assistant/ui/voice/VoiceWaveform.d.ts +1 -1
  87. package/dist/shared/assistant/ui/voice/voiceSessionEscape.d.ts +2 -2
  88. package/dist/shared/assistant/ui/voice/voiceStartGate.d.ts +6 -6
  89. package/dist/shared/assistant/ui/writeProposalPresentation.d.ts +1 -1
  90. package/dist/shared/assistant/uiActions/actOnResolve.d.ts +5 -5
  91. package/dist/shared/assistant/uiActions/assistantHref.d.ts +2 -2
  92. package/dist/shared/assistant/uiActions/backStack.d.ts +1 -1
  93. package/dist/shared/assistant/uiActions/deixis.d.ts +3 -3
  94. package/dist/shared/assistant/uiActions/entityRoutes.d.ts +1 -1
  95. package/dist/shared/assistant/uiActions/navigationOutcome.d.ts +8 -8
  96. package/dist/shared/assistant/uiActions/offerYesOnSurface.d.ts +1 -1
  97. package/dist/shared/assistant/uiActions/resolveTarget.d.ts +2 -2
  98. package/dist/shared/assistant/uiActions/uiOffers.d.ts +5 -5
  99. package/dist/shared/assistant/usageReporting.d.ts +2 -2
  100. package/dist/shared/assistant/useWorkspaceWriteAccess.d.ts +1 -1
  101. package/dist/shared/assistant/voice/affirmations.d.ts +1 -1
  102. package/dist/shared/assistant/voice/handsFree.d.ts +3 -3
  103. package/dist/shared/assistant/voice/handsfree/bargeIn.d.ts +5 -5
  104. package/dist/shared/assistant/voice/handsfree/echoGate.d.ts +6 -6
  105. package/dist/shared/assistant/voice/handsfree/handsFreeController.d.ts +7 -7
  106. package/dist/shared/assistant/voice/handsfree/handsFreeSetting.d.ts +2 -2
  107. package/dist/shared/assistant/voice/handsfree/micCapture.d.ts +1 -1
  108. package/dist/shared/assistant/voice/handsfree/playbackReference.d.ts +1 -1
  109. package/dist/shared/assistant/voice/handsfree/sttTransport.d.ts +3 -3
  110. package/dist/shared/assistant/voice/handsfree/useHandsFreeInterrupt.d.ts +4 -4
  111. package/dist/shared/assistant/voice/handsfree/vad.d.ts +1 -1
  112. package/dist/shared/assistant/voice/speechPlayback.d.ts +7 -7
  113. package/dist/shared/assistant/voice/useVoiceInput.d.ts +1 -1
  114. package/dist/shared/assistant/voice/voiceReopen.d.ts +8 -8
  115. package/dist/shared/assistant/writeConfirmSeam.d.ts +1 -1
  116. package/dist/shared/assistant/writeModeConsent.d.ts +7 -7
  117. package/dist/shared/assistant/writeProposalDiscovery.d.ts +3 -3
  118. package/dist/shared/assistant/writeProposalErrorCopy.d.ts +1 -1
  119. package/dist/shared/assistant/writeProposals.d.ts +23 -23
  120. package/dist/shared/assistant/writeReplyBinder.d.ts +11 -11
  121. package/dist/shared/assistant/writeReplySend.d.ts +7 -7
  122. package/dist/shared/components/LandingOrDashboardRedirect.d.ts +18 -3
  123. package/dist/shared/components/LandingOrDashboardRedirect.js +58 -28
  124. package/dist/shared/components/index.d.ts +2 -1
  125. package/dist/shared/hooks/shell/globalSearchError.d.ts +2 -2
  126. package/dist/shared/navigation/productSwitchHandoff.d.ts +45 -0
  127. package/dist/shared/navigation/productSwitchHandoff.js +27 -0
  128. package/dist/shared/navigation/unsavedChanges.d.ts +1 -1
  129. package/dist/shared/utils/index.d.ts +3 -3
  130. package/dist/shared-components.js +7 -6
  131. package/dist/shared.js +71 -70
  132. package/package.json +3 -2
@@ -3,7 +3,7 @@ import { createAvatarTransportPort as n } from "./avatarTransportPort.js";
3
3
  import { createAvatarReplyOutputs as r } from "./avatarReplyOutputs.js";
4
4
  import { AvatarApiError as i, avatarAvailabilityRefusal as a, avatarRefusalFor as o } from "./avatarSessionClient.js";
5
5
  //#region src/shared/assistant/avatar/live/liveAvatarController.ts
6
- var s = 12e4, c = 1e4, l = 8e3, ee = 5e3, u = 2e4, d = 1e3, f = {
6
+ var s = 12e4, c = 1e4, l = 8e3, ee = 5e3, u = 2e4, te = 1e3, d = {
7
7
  voiceLive: !1,
8
8
  offered: !1,
9
9
  tabOpen: !1,
@@ -21,7 +21,7 @@ var s = 12e4, c = 1e4, l = 8e3, ee = 5e3, u = 2e4, d = 1e3, f = {
21
21
  audioBlocked: !1,
22
22
  videoReady: !1
23
23
  };
24
- function p(e) {
24
+ function f(e) {
25
25
  switch (e) {
26
26
  case "permission_revoked": return {
27
27
  problem: "unavailable",
@@ -57,53 +57,53 @@ function p(e) {
57
57
  };
58
58
  }
59
59
  }
60
- var m = new Set(["playback-blocked", "needs-hosted-voice"]), h = {
60
+ var p = new Set(["playback-blocked", "needs-hosted-voice"]), m = {
61
61
  problem: "unavailable",
62
62
  hide: !0
63
63
  };
64
- function g(s) {
65
- let { scheduler: c, preferences: l } = s, u = s.idleMs ?? 12e4, d = s.endBeforeDeadlineMs ?? 1e4, g = s.connectTimeoutMs ?? 2e4, _ = s.requestTimeoutMs ?? 8e3, v = {
66
- ...f,
64
+ function h(s) {
65
+ let { scheduler: c, preferences: l } = s, u = s.idleMs ?? 12e4, te = s.endBeforeDeadlineMs ?? 1e4, h = s.connectTimeoutMs ?? 2e4, g = s.requestTimeoutMs ?? 8e3, _ = {
66
+ ...d,
67
67
  tabOffered: s.browserSupported()
68
- }, y = /* @__PURE__ */ new Set(), b = !1, x = null, S = 0, C = !1, w = !1, T = 0, E = null, D = null, O = [], k = 0, A = !1, te = "user", j = !1, M = !1, N = null, P = null, F = null, I = null, L = !1;
68
+ }, v = /* @__PURE__ */ new Set(), y = !1, b = null, x = 0, S = !1, C = !1, w = 0, T = null, E = null, D = [], O = 0, k = !1, A = "user", j = !1, M = !1, N = null, P = null, F = null, I = null, L = !1;
69
69
  function R(e) {
70
70
  try {
71
71
  s.onLog?.(e);
72
72
  } catch {}
73
73
  }
74
74
  function z() {
75
- return !b && s.browserSupported();
75
+ return !y && s.browserSupported();
76
76
  }
77
77
  function ne(e, t) {
78
78
  return (e || t) && z();
79
79
  }
80
80
  function B() {
81
- return v.retryAt !== null && s.now() < v.retryAt;
81
+ return _.retryAt !== null && s.now() < _.retryAt;
82
82
  }
83
83
  function V(e) {
84
84
  let t = {
85
- ...v,
85
+ ..._,
86
86
  ...e
87
87
  };
88
- e.problem !== void 0 && e.problem !== v.problem && (e.retryAt === void 0 && (t.retryAt = null), e.budgetScope === void 0 && (t.budgetScope = null));
88
+ e.problem !== void 0 && e.problem !== _.problem && (e.retryAt === void 0 && (t.retryAt = null), e.budgetScope === void 0 && (t.budgetScope = null));
89
89
  let n = {
90
90
  ...t,
91
91
  offered: ne(t.voiceLive, t.tabOpen),
92
92
  tabOffered: z(),
93
93
  heldByVoice: M && t.voiceLive
94
94
  };
95
- if (!Object.keys(n).every((e) => n[e] === v[e])) {
96
- n.retryAt !== v.retryAt && (I?.(), I = null), v = n;
97
- for (let e of [...y]) try {
95
+ if (!Object.keys(n).every((e) => n[e] === _[e])) {
96
+ n.retryAt !== _.retryAt && (I?.(), I = null), _ = n;
97
+ for (let e of [...v]) try {
98
98
  e();
99
99
  } catch {}
100
100
  }
101
101
  }
102
102
  function H() {
103
- return A && !j ? "voice_end" : "user";
103
+ return k && !j ? "voice_end" : "user";
104
104
  }
105
105
  function U() {
106
- l.getState().avatarEnabled !== C && l.setAvatarEnabled(C);
106
+ l.getState().avatarEnabled !== S && l.setAvatarEnabled(S);
107
107
  }
108
108
  let re = {
109
109
  positionSec: null,
@@ -111,15 +111,15 @@ function g(s) {
111
111
  rpc: "none"
112
112
  }, W = r({
113
113
  port: {
114
- isActive: () => D !== null && D.port.isActive(),
115
- isAudioBlocked: () => D?.port.isAudioBlocked() ?? !1,
116
- connectionId: () => D?.port.connectionId() ?? 0,
117
- isMeterHealthy: () => D?.port.isMeterHealthy() ?? !1,
118
- isMeterAudible: () => D?.port.isMeterAudible() ?? !1,
119
- openSegment: () => D ? D.port.openSegment() : Promise.reject(new e("connection")),
120
- clearBuffer: (e) => D ? D.port.clearBuffer(e) : Promise.resolve(re),
121
- setOutputMuted: (e) => D?.port.setOutputMuted(e),
122
- subscribe: (e) => D ? D.port.subscribe(e) : () => void 0
114
+ isActive: () => E !== null && E.port.isActive(),
115
+ isAudioBlocked: () => E?.port.isAudioBlocked() ?? !1,
116
+ connectionId: () => E?.port.connectionId() ?? 0,
117
+ isMeterHealthy: () => E?.port.isMeterHealthy() ?? !1,
118
+ isMeterAudible: () => E?.port.isMeterAudible() ?? !1,
119
+ openSegment: () => E ? E.port.openSegment() : Promise.reject(new e("connection")),
120
+ clearBuffer: (e) => E ? E.port.clearBuffer(e) : Promise.resolve(re),
121
+ setOutputMuted: (e) => E?.port.setOutputMuted(e),
122
+ subscribe: (e) => E ? E.port.subscribe(e) : () => void 0
123
123
  },
124
124
  scheduler: c,
125
125
  decode: s.decode,
@@ -135,7 +135,7 @@ function g(s) {
135
135
  V({ notice: "interrupted" });
136
136
  return;
137
137
  case "voice-fallback":
138
- C && V({ notice: "voice-only" });
138
+ S && V({ notice: "voice-only" });
139
139
  return;
140
140
  case "audio-blocked":
141
141
  V({
@@ -151,7 +151,7 @@ function g(s) {
151
151
  P?.(), P = null;
152
152
  return;
153
153
  }
154
- if (w) {
154
+ if (C) {
155
155
  K("user", { notice: "time-limit" });
156
156
  return;
157
157
  }
@@ -159,8 +159,8 @@ function g(s) {
159
159
  }
160
160
  });
161
161
  function G() {
162
- P?.(), P = null, v.phase === "ready" && (P = c.setTimeout(() => {
163
- P = null, v.phase === "ready" && !W.isBusy() && K("idle", {});
162
+ P?.(), P = null, _.phase === "ready" && (P = c.setTimeout(() => {
163
+ P = null, _.phase === "ready" && !W.isBusy() && K("idle", {});
164
164
  }, u));
165
165
  }
166
166
  function ie() {
@@ -168,8 +168,8 @@ function g(s) {
168
168
  }
169
169
  function ae() {
170
170
  W.leave();
171
- let e = D;
172
- if (D = null, e !== null) {
171
+ let e = E;
172
+ if (E = null, e !== null) {
173
173
  if (e.unsubscribe?.(), e.meter !== null) {
174
174
  if (e.meterAudible) {
175
175
  e.meterAudible = !1;
@@ -181,9 +181,9 @@ function g(s) {
181
181
  }
182
182
  }
183
183
  function K(e, t) {
184
- T += 1, te = e, C = !1, w = !1, M = !1, N = null, ae(), ie();
185
- let n = E;
186
- E = null, U(), n !== null && (R({
184
+ w += 1, A = e, S = !1, C = !1, M = !1, N = null, ae(), ie();
185
+ let n = T;
186
+ T = null, U(), n !== null && (R({
187
187
  event: "session-ended",
188
188
  reason: e
189
189
  }), s.client()?.end(n, {
@@ -194,32 +194,39 @@ function g(s) {
194
194
  closing: !1,
195
195
  audioBlocked: !1,
196
196
  videoReady: !1,
197
- ...t.problem === void 0 ? v.problem !== null && m.has(v.problem) ? { problem: null } : {} : { problem: t.problem },
197
+ ...t.problem === void 0 ? _.problem !== null && p.has(_.problem) ? { problem: null } : {} : { problem: t.problem },
198
198
  ...t.notice === void 0 ? {} : { notice: t.notice }
199
199
  });
200
200
  }
201
201
  function q(e) {
202
202
  let t = o(e);
203
- t.hide && (b = !0), e instanceof i && R({
203
+ t.hide && (y = !0), e instanceof i && R({
204
204
  event: "refused",
205
205
  status: e.status,
206
206
  code: e.code
207
- }), C = !1, M = !1, N = null, U();
207
+ }), S = !1, M = !1, N = null, U();
208
208
  let n = t.retryAfterSeconds !== void 0 && t.retryAfterSeconds > 0 ? t.retryAfterSeconds * 1e3 : 0, r = n > 0 ? s.now() + n : null;
209
209
  return V({
210
210
  phase: "off",
211
211
  problem: t.problem,
212
212
  retryAt: r,
213
213
  budgetScope: t.scope ?? null
214
- }), r !== null && v.retryAt === r && (I = c.setTimeout(() => {
215
- I = null, v.retryAt === r && V({
216
- problem: null,
217
- retryAt: null
218
- });
214
+ }), r !== null && _.retryAt === r && (I = c.setTimeout(() => {
215
+ I = null, J(r);
219
216
  }, n)), t;
220
217
  }
221
- function J(e = h) {
222
- e.hide && (b = !0), C = !1, M = !1, N = null, U(), V({
218
+ function J(e) {
219
+ _.retryAt === e && V({
220
+ problem: null,
221
+ retryAt: null
222
+ });
223
+ }
224
+ function Y() {
225
+ let e = _.retryAt;
226
+ L || e === null || B() || J(e);
227
+ }
228
+ function X(e = m) {
229
+ e.hide && (y = !0), S = !1, M = !1, N = null, U(), V({
223
230
  phase: "off",
224
231
  problem: e.problem,
225
232
  retryAt: null,
@@ -229,7 +236,7 @@ function g(s) {
229
236
  function oe(e) {
230
237
  switch (e.type) {
231
238
  case "audioPlayback":
232
- e.canPlay ? v.problem === "playback-blocked" ? V({
239
+ e.canPlay ? _.problem === "playback-blocked" ? V({
233
240
  audioBlocked: !1,
234
241
  problem: null
235
242
  }) : V({ audioBlocked: !1 }) : V({
@@ -245,22 +252,22 @@ function g(s) {
245
252
  }
246
253
  }
247
254
  async function se() {
248
- let e = E;
249
- if (e === null || v.phase === "ending" || v.phase === "off") return;
250
- let t = T;
255
+ let e = T;
256
+ if (e === null || _.phase === "ending" || _.phase === "off") return;
257
+ let t = w;
251
258
  V({ phase: "ending" });
252
259
  let n = null, r = !1;
253
260
  try {
254
- let t = s.client(), i = t === null ? void 0 : await Y((n) => t.status(e, n));
261
+ let t = s.client(), i = t === null ? void 0 : await le((n) => t.status(e, n));
255
262
  n = i?.endedReason ?? null, r = i !== void 0 && [
256
263
  "ended",
257
264
  "failed",
258
265
  "canceled"
259
266
  ].includes(i.state);
260
267
  } catch {}
261
- if (T !== t) return;
262
- let i = p(n);
263
- i.hide && (b = !0), r && (E = null, R({
268
+ if (w !== t) return;
269
+ let i = f(n);
270
+ i.hide && (y = !0), r && (T = null, R({
264
271
  event: "session-ended",
265
272
  reason: "server"
266
273
  })), K("client_error", i);
@@ -268,10 +275,10 @@ function g(s) {
268
275
  async function ce(e, r) {
269
276
  let i = s.client();
270
277
  if (i === null) {
271
- J();
278
+ X();
272
279
  return;
273
280
  }
274
- let a = ++T;
281
+ let a = ++w;
275
282
  V({
276
283
  phase: "starting",
277
284
  problem: null,
@@ -281,103 +288,103 @@ function g(s) {
281
288
  try {
282
289
  o = await s.openRoom();
283
290
  } catch {
284
- T === a && J();
291
+ w === a && X();
285
292
  return;
286
293
  }
287
294
  let l = () => {
288
295
  o.disconnect().catch(() => void 0);
289
296
  };
290
- if (T !== a) {
297
+ if (w !== a) {
291
298
  l();
292
299
  return;
293
300
  }
294
- let u = c.now(), f;
301
+ let u = c.now(), d;
295
302
  try {
296
- f = await i.create({
303
+ d = await i.create({
297
304
  avatarId: e,
298
305
  consentVersion: r,
299
306
  idempotencyKey: s.newIdempotencyKey()
300
307
  });
301
308
  } catch (e) {
302
- if (l(), T !== a) return;
303
- q(e).showDisclosure && (x = null, $.requestOn({ start: !1 }));
309
+ if (l(), w !== a) return;
310
+ q(e).showDisclosure && (b = null, $.requestOn({ start: !1 }));
304
311
  return;
305
312
  }
306
- if (T !== a) {
307
- l(), i.end(f.sessionId, { reason: te === "voice_end" ? "voice_end" : "user" }).catch(() => void 0);
313
+ if (w !== a) {
314
+ l(), i.end(d.sessionId, { reason: A === "voice_end" ? "voice_end" : "user" }).catch(() => void 0);
308
315
  return;
309
316
  }
310
- E = f.sessionId, V({ phase: "connecting" });
311
- let p = new t({
317
+ T = d.sessionId, V({ phase: "connecting" });
318
+ let f = new t({
312
319
  room: o,
313
- avatarIdentity: f.avatarIdentity,
320
+ avatarIdentity: d.avatarIdentity,
314
321
  scheduler: c,
315
322
  ...s.readinessProbe === void 0 ? {} : { readinessProbe: s.readinessProbe }
316
- }), m = /* @__PURE__ */ new Set(), h = {
317
- session: f,
318
- transport: p,
323
+ }), p = /* @__PURE__ */ new Set(), m = {
324
+ session: d,
325
+ transport: f,
319
326
  audioElement: s.createAudioElement(),
320
327
  meter: null,
321
328
  meterAudible: !1,
322
- meterListeners: m,
329
+ meterListeners: p,
323
330
  videoTrack: null,
324
331
  unsubscribe: null,
325
332
  port: n({
326
- transport: p,
327
- isEnabled: () => C && !w,
328
- subscribeMeter: (e) => (m.add(e), () => {
329
- m.delete(e);
333
+ transport: f,
334
+ isEnabled: () => S && !C,
335
+ subscribeMeter: (e) => (p.add(e), () => {
336
+ p.delete(e);
330
337
  }),
331
- isMeterHealthy: () => h.meter?.isRunning() ?? !1
338
+ isMeterHealthy: () => m.meter?.isRunning() ?? !1
332
339
  })
333
340
  };
334
- D = h, h.unsubscribe = p.subscribe(oe);
341
+ E = m, m.unsubscribe = f.subscribe(oe);
335
342
  try {
336
- await le(p.connect({
337
- url: f.livekitUrl,
338
- token: f.participantToken,
339
- audioElement: h.audioElement,
343
+ await ue(f.connect({
344
+ url: d.livekitUrl,
345
+ token: d.participantToken,
346
+ audioElement: m.audioElement,
340
347
  onAvatarAudio: (e) => {
341
- if (!(e.mediaStreamTrack === null || h.meter !== null)) try {
342
- h.meter = s.startMeter(e.mediaStreamTrack, (e) => {
343
- h.meterAudible = e;
344
- for (let t of [...m]) t(e);
348
+ if (!(e.mediaStreamTrack === null || m.meter !== null)) try {
349
+ m.meter = s.startMeter(e.mediaStreamTrack, (e) => {
350
+ m.meterAudible = e;
351
+ for (let t of [...p]) t(e);
345
352
  });
346
353
  } catch {
347
- h.meter = null;
354
+ m.meter = null;
348
355
  }
349
356
  },
350
357
  onAvatarVideo: (e) => {
351
- h.videoTrack = e;
352
- let t = X();
353
- t !== null && e.attach(t), D === h && V({ videoReady: !0 });
358
+ m.videoTrack = e;
359
+ let t = Z();
360
+ t !== null && e.attach(t), E === m && V({ videoReady: !0 });
354
361
  }
355
- }), g);
362
+ }), h);
356
363
  } catch (e) {
357
- if (T !== a) return;
364
+ if (w !== a) return;
358
365
  R({
359
366
  event: "connect-failed",
360
367
  error: e instanceof Error ? e.name : "error"
361
368
  }), K("client_error", { problem: "connection" });
362
369
  return;
363
370
  }
364
- if (T !== a || D !== h) return;
371
+ if (w !== a || E !== m) return;
365
372
  V({
366
373
  phase: "ready",
367
- audioBlocked: p.audioBlocked,
368
- ...p.audioBlocked ? { problem: "playback-blocked" } : {}
374
+ audioBlocked: f.audioBlocked,
375
+ ...f.audioBlocked ? { problem: "playback-blocked" } : {}
369
376
  }), G();
370
- let _ = S > 0 ? u + S - ee - c.now() : f.endsAt - s.now(), v = Math.max(0, _ - d);
377
+ let g = x > 0 ? u + x - ee - c.now() : d.endsAt - s.now(), _ = Math.max(0, g - te);
371
378
  F = c.setTimeout(() => {
372
- F = null, T === a && (w = !0, V({ closing: !0 }), W.isBusy() || K("user", { notice: "time-limit" }));
373
- }, v);
379
+ F = null, w === a && (C = !0, V({ closing: !0 }), W.isBusy() || K("user", { notice: "time-limit" }));
380
+ }, _);
374
381
  }
375
- function Y(t) {
382
+ function le(t) {
376
383
  let n = new AbortController();
377
384
  return new Promise((r, i) => {
378
385
  let a = c.setTimeout(() => {
379
386
  n.abort(), i(new e("connection"));
380
- }, _);
387
+ }, g);
381
388
  t(n.signal).then((e) => {
382
389
  a(), r(e);
383
390
  }, (e) => {
@@ -385,7 +392,7 @@ function g(s) {
385
392
  });
386
393
  });
387
394
  }
388
- function le(t, n) {
395
+ function ue(t, n) {
389
396
  return new Promise((r, i) => {
390
397
  let a = c.setTimeout(() => i(new e("connection")), n);
391
398
  t.then((e) => {
@@ -395,32 +402,32 @@ function g(s) {
395
402
  });
396
403
  });
397
404
  }
398
- function X() {
399
- return O[O.length - 1] ?? null;
405
+ function Z() {
406
+ return D[D.length - 1] ?? null;
400
407
  }
401
- function Z(e) {
402
- let t = O.indexOf(e);
408
+ function de(e) {
409
+ let t = D.indexOf(e);
403
410
  if (t === -1) return;
404
- let n = t === O.length - 1;
405
- O.splice(t, 1);
406
- let r = D?.videoTrack ?? null;
411
+ let n = t === D.length - 1;
412
+ D.splice(t, 1);
413
+ let r = E?.videoTrack ?? null;
407
414
  if (!n || r === null) return;
408
415
  r.detach();
409
- let i = X();
416
+ let i = Z();
410
417
  i !== null && r.attach(i);
411
418
  }
412
419
  let Q = [];
413
420
  Q.push(l.subscribe(() => {
414
421
  let e = l.getState().avatarEnabled;
415
- if (e !== C) {
422
+ if (e !== S) {
416
423
  if (e) {
417
424
  l.setAvatarEnabled(!1);
418
425
  return;
419
426
  }
420
- v.phase !== "off" && v.phase !== "checking" && v.phase !== "choosing" ? K(H(), {}) : C = !1;
427
+ _.phase !== "off" && _.phase !== "checking" && _.phase !== "choosing" ? K(H(), {}) : S = !1;
421
428
  }
422
429
  })), s.subscribeWorkspaceChange && Q.push(s.subscribeWorkspaceChange(() => {
423
- if (b = !1, v.phase === "off" ? V({
430
+ if (y = !1, _.phase === "off" ? V({
424
431
  problem: null,
425
432
  avatars: [],
426
433
  consentVersion: null
@@ -428,26 +435,26 @@ function g(s) {
428
435
  avatars: [],
429
436
  consentVersion: null
430
437
  })), j) {
431
- let e = T;
438
+ let e = w;
432
439
  c.setTimeout(() => {
433
- j && T === e && $.requestOn({ start: !1 });
440
+ j && w === e && $.requestOn({ start: !1 });
434
441
  }, 0);
435
442
  }
436
443
  })), s.subscribePageHide && Q.push(s.subscribePageHide(() => {
437
- (E !== null || v.phase !== "off") && K("page_hide", { keepalive: !0 });
438
- }));
444
+ (T !== null || _.phase !== "off") && K("page_hide", { keepalive: !0 });
445
+ })), s.subscribePageShow && Q.push(s.subscribePageShow(Y));
439
446
  let $ = {
440
447
  subscribe(e) {
441
- return y.add(e), () => {
442
- y.delete(e);
448
+ return v.add(e), () => {
449
+ v.delete(e);
443
450
  };
444
451
  },
445
- getSnapshot: () => v,
452
+ getSnapshot: () => _,
446
453
  setVoiceLive(e) {
447
- if (A = !e, e) {
454
+ if (k = !e, e) {
448
455
  V({
449
456
  voiceLive: !0,
450
- problem: b || j && B() ? v.problem : null,
457
+ problem: y || j && B() ? _.problem : null,
451
458
  notice: null
452
459
  });
453
460
  return;
@@ -456,33 +463,33 @@ function g(s) {
456
463
  V({ voiceLive: !1 });
457
464
  return;
458
465
  }
459
- (E !== null || v.phase !== "off") && (v.phase === "checking" || v.phase === "choosing" ? (T += 1, V({ phase: "off" })) : K("voice_end", {})), V({
466
+ (T !== null || _.phase !== "off") && (_.phase === "checking" || _.phase === "choosing" ? (w += 1, V({ phase: "off" })) : K("voice_end", {})), V({
460
467
  voiceLive: !1,
461
468
  notice: null
462
469
  });
463
470
  },
464
471
  requestOn(e = {}) {
465
- if (L || !v.offered || v.phase !== "off") return;
472
+ if (L || !_.offered || _.phase !== "off") return;
466
473
  let t = e.start === void 0 ? "auto" : e.start ? "start" : "choose";
467
474
  if (t === "start" && B()) return;
468
- let n = e.avatarId ?? v.selectedAvatarId, r = v.consentVersion, i = s.client();
475
+ let n = e.avatarId ?? _.selectedAvatarId, r = _.consentVersion, i = s.client();
469
476
  if (i === null) {
470
- J();
477
+ X();
471
478
  return;
472
479
  }
473
480
  t === "start" && (N = c.now());
474
- let o = ++T;
481
+ let o = ++w;
475
482
  V({
476
483
  phase: "checking",
477
- problem: B() ? v.problem : null,
484
+ problem: B() ? _.problem : null,
478
485
  notice: null
479
- }), Y((e) => i.availability(e)).then((e) => {
480
- if (T !== o) return;
486
+ }), le((e) => i.availability(e)).then((e) => {
487
+ if (w !== o) return;
481
488
  if (!e.available) {
482
- J(a(e.reason));
489
+ X(a(e.reason));
483
490
  return;
484
491
  }
485
- S = e.maxSessionSeconds * 1e3;
492
+ x = e.maxSessionSeconds * 1e3;
486
493
  let i = t === "start" && n !== null && e.avatars.includes(n), s = l.getState().avatarId, c = i ? n : s !== null && e.avatars.includes(s) ? s : e.avatars[0] ?? null;
487
494
  switch (V({
488
495
  phase: "choosing",
@@ -491,7 +498,7 @@ function g(s) {
491
498
  consentVersion: e.consentVersion
492
499
  }), t) {
493
500
  case "auto":
494
- x === e.consentVersion && e.avatars.length === 1 && $.confirm();
501
+ b === e.consentVersion && e.avatars.length === 1 && $.confirm();
495
502
  return;
496
503
  case "start":
497
504
  i && r === e.consentVersion ? $.confirm() : N = null;
@@ -499,45 +506,46 @@ function g(s) {
499
506
  case "choose": return;
500
507
  }
501
508
  }, (e) => {
502
- T === o && q(e);
509
+ w === o && q(e);
503
510
  });
504
511
  },
505
512
  confirm() {
506
- if (v.phase !== "choosing" || !(v.voiceLive || j) || B()) return;
507
- let e = v.selectedAvatarId, t = v.consentVersion;
508
- e === null || t === null || (x = t, l.setAvatarId(e), C = !0, M = !j, j && (N ??= c.now()), U(), ce(e, t));
513
+ if (_.phase !== "choosing" || !(_.voiceLive || j) || B()) return;
514
+ let e = _.selectedAvatarId, t = _.consentVersion;
515
+ e === null || t === null || (b = t, l.setAvatarId(e), S = !0, M = !j, j && (N ??= c.now()), U(), ce(e, t));
509
516
  },
517
+ recheckRetry: Y,
510
518
  cancelChoice() {
511
- v.phase === "choosing" && (T += 1, N = null, V({ phase: "off" }));
519
+ _.phase === "choosing" && (w += 1, N = null, V({ phase: "off" }));
512
520
  },
513
521
  setTabOpen(e) {
514
522
  if (L || e === j) return;
515
523
  if (j = e, e) {
516
- V({ tabOpen: !0 }), v.phase === "checking" && (T += 1, V({ phase: "off" }), $.requestOn({ start: !1 }));
524
+ V({ tabOpen: !0 }), _.phase === "checking" && (w += 1, V({ phase: "off" }), $.requestOn({ start: !1 }));
517
525
  return;
518
526
  }
519
527
  N = null;
520
- let t = v.phase;
528
+ let t = _.phase;
521
529
  if (t === "checking" || t === "choosing") {
522
- T += 1, V({
530
+ w += 1, V({
523
531
  tabOpen: !1,
524
532
  phase: "off"
525
533
  });
526
534
  return;
527
535
  }
528
- (E !== null || t !== "off") && !v.heldByVoice && K("user", {}), V({ tabOpen: !1 });
536
+ (T !== null || t !== "off") && !_.heldByVoice && K("user", {}), V({ tabOpen: !1 });
529
537
  },
530
538
  selectAvatar(e) {
531
- v.avatars.includes(e) && V({ selectedAvatarId: e });
539
+ _.avatars.includes(e) && V({ selectedAvatarId: e });
532
540
  },
533
541
  switchOff() {
534
- let { phase: e } = v;
542
+ let { phase: e } = _;
535
543
  if (!(j && N !== null && (e === "checking" || e === "starting" || e === "connecting") && c.now() - N < 1e3)) {
536
544
  if (e === "checking" || e === "choosing") {
537
- T += 1, N = null, V({ phase: "off" });
545
+ w += 1, N = null, V({ phase: "off" });
538
546
  return;
539
547
  }
540
- if (e === "off" && !C) {
548
+ if (e === "off" && !S) {
541
549
  U();
542
550
  return;
543
551
  }
@@ -545,41 +553,41 @@ function g(s) {
545
553
  }
546
554
  },
547
555
  resumeAudio() {
548
- let e = D;
556
+ let e = E;
549
557
  e !== null && (e.transport.resumeAudio().catch(() => void 0), e.meter?.resume().catch(() => void 0));
550
558
  },
551
559
  setStageMounted(e) {
552
- k = Math.max(0, k + (e ? 1 : -1));
560
+ O = Math.max(0, O + (e ? 1 : -1));
553
561
  },
554
562
  attachVideo(e) {
555
563
  if (e === null) {
556
- let e = X();
557
- e !== null && Z(e);
564
+ let e = Z();
565
+ e !== null && de(e);
558
566
  return;
559
567
  }
560
- let t = O.indexOf(e);
561
- t !== -1 && O.splice(t, 1), O.push(e);
562
- let n = D?.videoTrack ?? null;
563
- return n !== null && (n.detach(), n.attach(e)), () => Z(e);
568
+ let t = D.indexOf(e);
569
+ t !== -1 && D.splice(t, 1), D.push(e);
570
+ let n = E?.videoTrack ?? null;
571
+ return n !== null && (n.detach(), n.attach(e)), () => de(e);
564
572
  },
565
573
  route(e, t) {
566
- if (v.phase !== "ready" || w || !C || k === 0 || D === null || D.port.isAudioBlocked() || e.fallback === !1) return "speakers";
574
+ if (_.phase !== "ready" || C || !S || O === 0 || E === null || E.port.isAudioBlocked() || e.fallback === !1) return "speakers";
567
575
  let n = e.voice;
568
576
  return n !== null && n.source !== "hosted" || !t.listVoices().some((e) => e.source === "hosted") ? (R({
569
577
  event: "notice",
570
578
  notice: { kind: "needs-hosted-voice" }
571
- }), V({ problem: "needs-hosted-voice" }), "speakers") : (v.problem === "needs-hosted-voice" && V({ problem: null }), "avatar");
579
+ }), V({ problem: "needs-hosted-voice" }), "speakers") : (_.problem === "needs-hosted-voice" && V({ problem: null }), "avatar");
572
580
  },
573
581
  createOutput: () => W.createOutput(),
574
582
  dispose() {
575
583
  if (!L) {
576
- L = !0, (E !== null || v.phase !== "off") && K("user", {}), I?.(), I = null;
584
+ L = !0, (T !== null || _.phase !== "off") && K("user", {}), I?.(), I = null;
577
585
  for (let e of Q.splice(0)) e();
578
- y.clear();
586
+ v.clear();
579
587
  }
580
588
  }
581
589
  };
582
590
  return $;
583
591
  }
584
592
  //#endregion
585
- export { u as LIVE_AVATAR_CONNECT_TIMEOUT_MS, c as LIVE_AVATAR_END_BEFORE_DEADLINE_MS, s as LIVE_AVATAR_IDLE_MS, l as LIVE_AVATAR_REQUEST_TIMEOUT_MS, d as LIVE_AVATAR_TAB_OFF_GUARD_MS, g as createLiveAvatarController };
593
+ export { u as LIVE_AVATAR_CONNECT_TIMEOUT_MS, c as LIVE_AVATAR_END_BEFORE_DEADLINE_MS, s as LIVE_AVATAR_IDLE_MS, l as LIVE_AVATAR_REQUEST_TIMEOUT_MS, te as LIVE_AVATAR_TAB_OFF_GUARD_MS, h as createLiveAvatarController };