@burdenoff/fe-libs 2026.1112.4 → 2026.1112.6

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 (40) hide show
  1. package/dist/shared/assistant/api.d.ts +7 -0
  2. package/dist/shared/assistant/api.js +47 -45
  3. package/dist/shared/assistant/createSandboxAssistantTransport.js +2 -1
  4. package/dist/shared/assistant/gatewayClient.js +1 -0
  5. package/dist/shared/assistant/index.d.ts +4 -0
  6. package/dist/shared/assistant/keepAlive.d.ts +74 -0
  7. package/dist/shared/assistant/keepAlive.js +77 -0
  8. package/dist/shared/assistant/prewarm.d.ts +20 -0
  9. package/dist/shared/assistant/prewarm.js +25 -4
  10. package/dist/shared/assistant/runtime.d.ts +7 -2
  11. package/dist/shared/assistant/runtime.js +23 -22
  12. package/dist/shared/assistant/signInWarm.d.ts +60 -0
  13. package/dist/shared/assistant/signInWarm.js +111 -0
  14. package/dist/shared/assistant/snapshotPoller.d.ts +16 -0
  15. package/dist/shared/assistant/snapshotPoller.js +29 -22
  16. package/dist/shared/assistant/staleSession.d.ts +27 -0
  17. package/dist/shared/assistant/staleSession.js +15 -0
  18. package/dist/shared/assistant/turnProgress.d.ts +16 -0
  19. package/dist/shared/assistant/turnProgress.js +30 -4
  20. package/dist/shared/assistant/ui/AssistantChatArea.js +1286 -1271
  21. package/dist/shared/assistant/ui/AssistantOverlay.d.ts +7 -0
  22. package/dist/shared/assistant/ui/AssistantOverlay.js +256 -248
  23. package/dist/shared/assistant/usageReporting.d.ts +18 -0
  24. package/dist/shared/assistant/usageReporting.js +17 -5
  25. package/dist/shared/assistant/useAssistantHeartbeat.d.ts +24 -4
  26. package/dist/shared/assistant/useAssistantHeartbeat.js +43 -24
  27. package/dist/shared/assistant/useAssistantSignInWarm.d.ts +19 -0
  28. package/dist/shared/assistant/useAssistantSignInWarm.js +55 -0
  29. package/dist/shared/assistant/writeProposals.d.ts +9 -0
  30. package/dist/shared/components/assistantWidget/AssistantWidget.d.ts +7 -0
  31. package/dist/shared/components/assistantWidget/AssistantWidget.js +289 -285
  32. package/dist/shared/graphql/fetch.d.ts +2 -1
  33. package/dist/shared/graphql/fetch.js +14 -11
  34. package/dist/shared/providers/shell/AuthTokenProvider.d.ts +6 -0
  35. package/dist/shared/providers/shell/AuthTokenProvider.js +4 -1
  36. package/dist/shared/providers/shell/index.d.ts +1 -1
  37. package/dist/shared/utils/gatewayFetchRewrite.js +1 -1
  38. package/dist/shared-assistant.js +374 -370
  39. package/dist/shared-providers-shell.js +12 -12
  40. package/package.json +1 -1
@@ -44,8 +44,8 @@ import { AssistantViewSwitchDock as Re } from "./compact/AssistantViewSwitchDock
44
44
  import { useLiveAvatarTab as ze, useLiveAvatarTabSeam as Be } from "./assistantLiveAvatarSeam.js";
45
45
  import { useAvatarCopy as Ve } from "../avatar/useAvatarCopy.js";
46
46
  import { voiceStartBlocker as He, voiceStartBlockerLasts as Ue } from "./voice/voiceStartGate.js";
47
- import { avatarAskBlocker as We, avatarAskWrites as C, avatarTabAskLine as Ge } from "./avatar/avatarAskGate.js";
48
- import { createAvatarTabDraft as Ke } from "./avatar/avatarTabDraft.js";
47
+ import { avatarAskBlocker as We, avatarAskWrites as Ge, avatarTabAskLine as Ke } from "./avatar/avatarAskGate.js";
48
+ import { createAvatarTabDraft as C } from "./avatar/avatarTabDraft.js";
49
49
  import { parseToolActivity as qe } from "./AssistantToolActivity.js";
50
50
  import { useVoiceSession as Je } from "./useVoiceSession.js";
51
51
  import { useAssistantApiAccess as Ye } from "../useAssistantApiAccess.js";
@@ -55,271 +55,275 @@ import { VOICE_COMMIT_BUDGET_MS as Qe, settleAndCommitSpokenTurn as $e } from ".
55
55
  import { attachmentUrlIsStale as et, refreshStaleAttachmentUrls as tt } from "../attachmentCommit.js";
56
56
  import { useConversationTurns as nt } from "../useConversationTurns.js";
57
57
  import { resolveActiveModeSandbox as rt, useAssistantStore as w } from "../store.js";
58
- import { abortAssistantTurn as it, approvePendingWrite as at, createAssistantSandbox as ot, createAssistantSession as st, extendAssistantSandboxTTL as ct, findExistingSandboxWithStatus as lt, getAssistantArtifacts as ut, getAssistantMessages as dt, getAssistantSession as ft, mintAssistantTurnStream as pt, modeRequiresConfirmWrites as mt, postClientToolResult as ht, promptGatewayRequestBytes as gt, releaseSupersededAssistantSandboxes as _t, sendAssistantPromptAsync as vt, waitForAssistantServiceReady as yt, waitForSandboxRunning as bt, writeApprovalModeOf as xt } from "../api.js";
59
- import { createClientToolRunner as St, offerClientTools as Ct } from "../../agent-tools/adapters/assistant.js";
60
- import { sanitize as wt } from "../progress.js";
61
- import { createSandboxBusyGate as Tt, gateDoneOnSandboxBusy as Et } from "../sandboxBusy.js";
62
- import { speechFeed as Dt } from "../speech/speechFeed.js";
63
- import { requestReplyOnAvatar as Ot } from "../speech/replySpeechRequests.js";
64
- import { isTurnSuperseded as kt, markTurnSuperseded as At } from "../voice/supersededTurns.js";
65
- import { NO_FIRST_TEXT as jt, buildAssistantProgress as Mt, readAheadFor as Nt, snapshotReplyFloor as Pt, startSessionReadAhead as Ft, trackFirstText as It } from "../turnProgress.js";
66
- import { getOrganizationId as Lt, getWorkspaceId as T } from "../context.js";
67
- import { dispatchAssistantQuotaExhausted as Rt, notifyAiCreditsUpdated as zt } from "../aiCredits.js";
68
- import { AssistantSendRefusal as Bt, classifyTurnFailure as Vt, turnConfirmsNoAction as Ht, turnOutcomeCopy as Ut } from "../turnOutcome.js";
69
- import { QuarantineSet as Wt, WarmCancelled as Gt, claimPreopenedSession as Kt, consumeWarm as qt, preopenKey as Jt, preopenWanted as Yt, prewarmTarget as Xt, settleWarmBeforeSend as Zt, startPreopen as Qt, startWarm as $t, warmState as en } from "../prewarm.js";
70
- import { beginTurn as tn, describeTurn as nn, detectTurnDevice as rn, markTurn as E, restartAttempt as an, turnClockMs as on } from "../turnTimeline.js";
71
- import { sendAssistantTurnTimings as sn, startTurnTimingReporting as cn } from "../turnTimingReporter.js";
72
- import { countInlineImageCandidates as ln, countInlinedImageParts as un, largestInlineCharsPerFile as dn, resolveAssistantInlineLimits as fn, toMessageAttachment as pn } from "../attachments.js";
73
- import { buildBoundedAttachmentTurn as mn } from "../attachmentTurn.js";
74
- import { assistantUsageLedger as hn, hasPendingUsageReports as gn, reportUsageWithRetry as _n, retryPendingUsageReports as vn, usageSendRefusal as yn } from "../usageReporting.js";
75
- import { isMultimodalBodyRejection as bn, isRecoverableAssistantError as xn } from "../transportErrors.js";
76
- import { isTurnInFlight as Sn, planAbandonedTurn as Cn, planTurnAbort as wn } from "../turnState.js";
77
- import { useAssistantTr as Tn } from "../i18n.js";
78
- import { isProdRuntime as En } from "../env.js";
79
- import { useAssistantProduct as Dn } from "../product.js";
80
- import { pollDelayMs as On } from "../voice/assistantPollSchedule.js";
81
- import { liveCoverage as kn } from "../liveDeltas.js";
82
- import { phraseSpeechEnabled as An } from "../voice/phraseSpeechConfig.js";
83
- import { createLivePhraseSpeech as jn } from "../voice/livePhraseSpeech.js";
84
- import { createLiveRender as Mn } from "../liveOverlay.js";
85
- import { createSnapshotPoller as Nn } from "../snapshotPoller.js";
86
- import { openTurnStream as Pn, turnStreamAvailable as Fn } from "../turnStream.js";
87
- import { withIncompleteTurnNotice as In } from "../streamBudget.js";
88
- import { isWriteModeAcknowledged as Ln, writeModeSendRefusalReason as Rn } from "../writeModeConsent.js";
89
- import { createAdminModeAccessGate as zn, resolveAssistantSendModeAfterAccess as Bn } from "../adminModeSendGate.js";
90
- import { getAssistantDisplayContent as Vn } from "../displayContent.js";
91
- import { countSpokenTurns as Hn, spokenMessagesSinceContinueNote as Un, spokenTurnText as Wn } from "../spokenTurns.js";
92
- import { toCaptionText as Gn } from "../voice/captionText.js";
93
- import { buildContinuedFromVoiceNote as Kn, buildVoiceTranscriptMarkdown as qn, voiceTranscriptFilename as Jn } from "../voice/voiceTranscript.js";
94
- import { downloadFile as Yn } from "../exportConversation.js";
95
- import { chatTurns as Xn, isVoiceTurn as Zn, voiceMarker as Qn, voiceSessionIdOf as $n } from "../voice/turnVisibility.js";
96
- import { INITIAL_TRANSCRIPT_AUTO_OPEN as er, isAwaitingOwnConversation as tr, maySendSpokenTurn as nr, planTranscriptAutoOpen as rr, planVoiceSessionBinding as ir, planVoiceSessionStart as ar, planVoiceSpokenEntry as or, voiceBindingAtStart as sr, voiceBindingConversationId as cr } from "../voice/voiceReopen.js";
97
- import { toVoiceReply as lr } from "../voice/voiceReply.js";
98
- import { beginApprovalInFlight as ur, endApprovalInFlight as dr, getApprovalInFlight as fr, markLiveTurn as pr, newestModelReplyId as mr, resolveApprovablePendingWrite as hr, resolveRetryableMessageId as gr, subscribeApprovalInFlight as _r } from "../liveTurns.js";
99
- import { createReadinessTracker as vr, planAfterTransportFailure as yr, planTrustedSandboxFailure as br } from "../sandboxReadiness.js";
100
- import { couldBeLocalUiCommand as xr, isAlreadyThere as Sr, matchLocalUiCommand as Cr, mayBeNavigationFollowUp as wr, navDestinations as Tr, planThemeChange as Er } from "../localUiCommands.js";
101
- import { backDoneCopy as Dr, chooseDestinationCopy as Or, chooseLinkedCopy as kr, entityNounText as Ar, linkNotOpenableCopy as jr, navigationCommandCopy as Mr, navigationOutcomeCopy as Nr, offerExpiredCopy as Pr, offerKeptForUnsavedCopy as Fr, offerNotAvailableCopy as Ir, pickFromListCopy as Lr, recordChoiceCopy as Rr, recordKindsCopy as zr, themeCommandCopy as Br } from "../localUiCommandCopy.js";
102
- import { offerAssentFor as Vr } from "../localeCommands/assent.js";
103
- import { appControlCopy as Hr } from "../appControls/copy.js";
104
- import { LANGUAGE_REPLY_DEADLINE_MS as Ur, languageConfirmationCopy as Wr, languageReplyStep as Gr } from "../appControls/languageReply.js";
105
- import { planAppControl as Kr } from "../appControls/plan.js";
106
- import { readControlSnapshot as qr } from "../appControls/snapshot.js";
107
- import { subscribeAssistantControls as Jr } from "../appControls/registry.js";
108
- import { useAssistantControl as Yr } from "../appControls/useAssistantControl.js";
109
- import { useControlConfirmDialog as Xr } from "./controlConfirmDialog.js";
110
- import { useLeaveConfirmAsking as Zr } from "./leaveConfirm.js";
111
- import { startFocusReturnAfterKeep as Qr } from "./leaveConfirmFocus.js";
112
- import { buildNavigationContext as $r, latestReplyOnSurface as ei, rememberPresentedList as ti } from "../uiActions/linkContext.js";
113
- import { lookupNamedRecords as ni } from "../uiActions/recordNames.js";
114
- import { navEntryIds as ri } from "../uiActions/resolveTarget.js";
115
- import { buildUiCatalogue as ii, markUiCatalogueSent as ai, uiCatalogueSent as oi, uiCatalogueSessionKey as si } from "../uiActions/uiCatalogue.js";
116
- import { offerYesOnSurface as ci } from "../uiActions/offerYesOnSurface.js";
117
- import { UiOfferSession as li, sandboxServesUiOffers as ui, uiOfferHintKind as di, uiOfferInTime as fi } from "../uiActions/uiOffers.js";
118
- import { parseNavIntent as pi } from "../uiActions/navIntent.js";
119
- import { decideActOnResolve as mi, n4LeaveGuard as hi } from "../uiActions/actOnResolve.js";
120
- import { AssistantUiOfferLinks as gi } from "./AssistantUiOfferLink.js";
121
- import { assistantBackStack as _i, isBackRunnable as vi } from "../uiActions/backStack.js";
122
- import { subscribeDraftPathname as yi } from "../uiActions/draftPathname.js";
123
- import { buildNavigateAction as bi, destinationForPath as xi, labelForPath as Si, newestAssistantOnSurface as Ci } from "../uiActions/navigateAction.js";
124
- import { runNavigation as wi } from "../uiActions/navigationOutcome.js";
125
- import { assistantHistory as Ti } from "../history/historyEngine.js";
126
- import { conversationHasHistory as Ei, isOtherScopeHistoryConversation as Di, isReadOnlyHistoryConversation as Oi, isReusableHistoryDraft as ki } from "../history/historyList.js";
127
- import { resumeContextFor as Ai } from "../history/historyResume.js";
128
- import { useAssistantHistoryStatus as ji } from "../history/historyStatus.js";
129
- import { useHistoryRowControlsFor as Mi } from "../history/useHistoryRowControls.js";
130
- import { getHistoryStamp as Ni, setHistoryBusyProbe as Pi } from "../history/stampRegistry.js";
131
- import { resolveConversationDeleteTarget as Fi } from "../conversationDeleteCommand.js";
132
- import { useAssistantNavigate as Ii } from "./AssistantMarkdownRenderer.js";
133
- import { useAssistantSpeech as Li } from "./AssistantSpeechProvider.js";
134
- import { useAssistantStopTurnLabel as Ri } from "../../providers/shell/useAssistantShellLabels.js";
135
- import { useThemeOrNull as zi } from "../../providers/shell/ThemeProvider.js";
136
- import { useVisibleNavItems as Bi } from "../../../chrome/mobileTabBar/useVisibleNavItems.js";
137
- import { useAskAboutStore as Vi } from "../askAbout/askAboutStore.js";
138
- import { readMessageFocus as Hi, withFocusNote as Ui } from "../askAbout/focus.js";
139
- import { useCallback as D, useEffect as O, useLayoutEffect as Wi, useMemo as k, useRef as A, useState as j, useSyncExternalStore as Gi } from "react";
140
- import { Fragment as Ki, jsx as M, jsxs as qi } from "react/jsx-runtime";
58
+ import { abortAssistantTurn as it, approvePendingWrite as at, createAssistantSandbox as ot, createAssistantSession as st, findExistingSandboxWithStatus as ct, getAssistantArtifacts as lt, getAssistantMessages as ut, getAssistantSession as dt, mintAssistantTurnStream as ft, modeRequiresConfirmWrites as pt, postClientToolResult as mt, promptGatewayRequestBytes as ht, releaseSupersededAssistantSandboxes as gt, sendAssistantPromptAsync as _t, waitForAssistantServiceReady as vt, waitForSandboxRunning as yt, writeApprovalModeOf as bt } from "../api.js";
59
+ import { createClientToolRunner as xt, offerClientTools as St } from "../../agent-tools/adapters/assistant.js";
60
+ import { sanitize as Ct } from "../progress.js";
61
+ import { createSandboxBusyGate as wt, gateDoneOnSandboxBusy as Tt } from "../sandboxBusy.js";
62
+ import { speechFeed as Et } from "../speech/speechFeed.js";
63
+ import { requestReplyOnAvatar as Dt } from "../speech/replySpeechRequests.js";
64
+ import { isTurnSuperseded as Ot, markTurnSuperseded as kt } from "../voice/supersededTurns.js";
65
+ import { NO_FIRST_TEXT as At, buildAssistantProgress as jt, readAheadFor as Mt, rememberSessionFloor as Nt, snapshotReplyFloor as Pt, startSessionReadAhead as Ft, takeRememberedSessionFloor as It, trackFirstText as Lt } from "../turnProgress.js";
66
+ import { getOrganizationId as Rt, getWorkspaceId as T } from "../context.js";
67
+ import { dispatchAssistantQuotaExhausted as zt, notifyAiCreditsUpdated as Bt } from "../aiCredits.js";
68
+ import { AssistantSendRefusal as Vt, classifyTurnFailure as Ht, turnConfirmsNoAction as Ut, turnOutcomeCopy as Wt } from "../turnOutcome.js";
69
+ import { QuarantineSet as Gt, WarmCancelled as Kt, claimPreopenedSession as qt, consumeWarm as Jt, preopenKey as Yt, preopenWanted as Xt, prewarmTarget as Zt, settleWarmBeforeSend as Qt, startPreopen as $t, startWarm as en, warmState as tn, withWarmProofs as nn } from "../prewarm.js";
70
+ import { beginTurn as rn, describeTurn as an, detectTurnDevice as on, markTurn as E, restartAttempt as sn, turnClockMs as cn } from "../turnTimeline.js";
71
+ import { sendAssistantTurnTimings as ln, startTurnTimingReporting as un } from "../turnTimingReporter.js";
72
+ import { countInlineImageCandidates as dn, countInlinedImageParts as fn, largestInlineCharsPerFile as pn, resolveAssistantInlineLimits as mn, toMessageAttachment as hn } from "../attachments.js";
73
+ import { buildBoundedAttachmentTurn as gn } from "../attachmentTurn.js";
74
+ import { assistantUsageLedger as _n, hasPendingUsageReports as vn, reportUsageInBackground as yn, retryPendingUsageReports as bn, settleInFlightUsageReports as xn, usageSendRefusal as Sn } from "../usageReporting.js";
75
+ import { isMultimodalBodyRejection as Cn, isRecoverableAssistantError as wn } from "../transportErrors.js";
76
+ import { isTurnInFlight as Tn, planAbandonedTurn as En, planTurnAbort as Dn } from "../turnState.js";
77
+ import { useAssistantTr as On } from "../i18n.js";
78
+ import { isProdRuntime as kn } from "../env.js";
79
+ import { useAssistantProduct as An } from "../product.js";
80
+ import { pollDelayMs as jn } from "../voice/assistantPollSchedule.js";
81
+ import { holdAssistantActivity as Mn } from "../keepAlive.js";
82
+ import { StaleSessionRestart as Nn, isStaleSessionRefusal as Pn } from "../staleSession.js";
83
+ import { noteAssistantTurnSent as Fn } from "../signInWarm.js";
84
+ import { keepAssistantSandboxAlive as In } from "../useAssistantHeartbeat.js";
85
+ import { liveCoverage as Ln } from "../liveDeltas.js";
86
+ import { phraseSpeechEnabled as Rn } from "../voice/phraseSpeechConfig.js";
87
+ import { createLivePhraseSpeech as zn } from "../voice/livePhraseSpeech.js";
88
+ import { createLiveRender as Bn } from "../liveOverlay.js";
89
+ import { createSnapshotPoller as Vn } from "../snapshotPoller.js";
90
+ import { openTurnStream as Hn, turnStreamAvailable as Un } from "../turnStream.js";
91
+ import { withIncompleteTurnNotice as Wn } from "../streamBudget.js";
92
+ import { isWriteModeAcknowledged as Gn, writeModeSendRefusalReason as Kn } from "../writeModeConsent.js";
93
+ import { createAdminModeAccessGate as qn, resolveAssistantSendModeAfterAccess as Jn } from "../adminModeSendGate.js";
94
+ import { getAssistantDisplayContent as Yn } from "../displayContent.js";
95
+ import { countSpokenTurns as Xn, spokenMessagesSinceContinueNote as Zn, spokenTurnText as Qn } from "../spokenTurns.js";
96
+ import { toCaptionText as $n } from "../voice/captionText.js";
97
+ import { buildContinuedFromVoiceNote as er, buildVoiceTranscriptMarkdown as tr, voiceTranscriptFilename as nr } from "../voice/voiceTranscript.js";
98
+ import { downloadFile as rr } from "../exportConversation.js";
99
+ import { chatTurns as ir, isVoiceTurn as ar, voiceMarker as or, voiceSessionIdOf as sr } from "../voice/turnVisibility.js";
100
+ import { INITIAL_TRANSCRIPT_AUTO_OPEN as cr, isAwaitingOwnConversation as lr, maySendSpokenTurn as ur, planTranscriptAutoOpen as dr, planVoiceSessionBinding as fr, planVoiceSessionStart as pr, planVoiceSpokenEntry as mr, voiceBindingAtStart as hr, voiceBindingConversationId as gr } from "../voice/voiceReopen.js";
101
+ import { toVoiceReply as _r } from "../voice/voiceReply.js";
102
+ import { beginApprovalInFlight as vr, endApprovalInFlight as yr, getApprovalInFlight as br, markLiveTurn as xr, newestModelReplyId as Sr, resolveApprovablePendingWrite as Cr, resolveRetryableMessageId as wr, subscribeApprovalInFlight as Tr } from "../liveTurns.js";
103
+ import { createReadinessTracker as Er, planAfterTransportFailure as Dr, planTrustedSandboxFailure as Or } from "../sandboxReadiness.js";
104
+ import { couldBeLocalUiCommand as kr, isAlreadyThere as Ar, matchLocalUiCommand as jr, mayBeNavigationFollowUp as Mr, navDestinations as Nr, planThemeChange as Pr } from "../localUiCommands.js";
105
+ import { backDoneCopy as Fr, chooseDestinationCopy as Ir, chooseLinkedCopy as Lr, entityNounText as Rr, linkNotOpenableCopy as zr, navigationCommandCopy as Br, navigationOutcomeCopy as Vr, offerExpiredCopy as Hr, offerKeptForUnsavedCopy as Ur, offerNotAvailableCopy as Wr, pickFromListCopy as Gr, recordChoiceCopy as Kr, recordKindsCopy as qr, themeCommandCopy as Jr } from "../localUiCommandCopy.js";
106
+ import { offerAssentFor as Yr } from "../localeCommands/assent.js";
107
+ import { appControlCopy as Xr } from "../appControls/copy.js";
108
+ import { LANGUAGE_REPLY_DEADLINE_MS as Zr, languageConfirmationCopy as Qr, languageReplyStep as $r } from "../appControls/languageReply.js";
109
+ import { planAppControl as ei } from "../appControls/plan.js";
110
+ import { readControlSnapshot as ti } from "../appControls/snapshot.js";
111
+ import { subscribeAssistantControls as ni } from "../appControls/registry.js";
112
+ import { useAssistantControl as ri } from "../appControls/useAssistantControl.js";
113
+ import { useControlConfirmDialog as ii } from "./controlConfirmDialog.js";
114
+ import { useLeaveConfirmAsking as ai } from "./leaveConfirm.js";
115
+ import { startFocusReturnAfterKeep as oi } from "./leaveConfirmFocus.js";
116
+ import { buildNavigationContext as si, latestReplyOnSurface as ci, rememberPresentedList as li } from "../uiActions/linkContext.js";
117
+ import { lookupNamedRecords as ui } from "../uiActions/recordNames.js";
118
+ import { navEntryIds as di } from "../uiActions/resolveTarget.js";
119
+ import { buildUiCatalogue as fi, markUiCatalogueSent as pi, uiCatalogueSent as mi, uiCatalogueSessionKey as hi } from "../uiActions/uiCatalogue.js";
120
+ import { offerYesOnSurface as gi } from "../uiActions/offerYesOnSurface.js";
121
+ import { UiOfferSession as _i, sandboxServesUiOffers as vi, uiOfferHintKind as yi, uiOfferInTime as bi } from "../uiActions/uiOffers.js";
122
+ import { parseNavIntent as xi } from "../uiActions/navIntent.js";
123
+ import { decideActOnResolve as Si, n4LeaveGuard as Ci } from "../uiActions/actOnResolve.js";
124
+ import { AssistantUiOfferLinks as wi } from "./AssistantUiOfferLink.js";
125
+ import { assistantBackStack as Ti, isBackRunnable as Ei } from "../uiActions/backStack.js";
126
+ import { subscribeDraftPathname as Di } from "../uiActions/draftPathname.js";
127
+ import { buildNavigateAction as Oi, destinationForPath as ki, labelForPath as Ai, newestAssistantOnSurface as ji } from "../uiActions/navigateAction.js";
128
+ import { runNavigation as Mi } from "../uiActions/navigationOutcome.js";
129
+ import { assistantHistory as Ni } from "../history/historyEngine.js";
130
+ import { conversationHasHistory as Pi, isOtherScopeHistoryConversation as Fi, isReadOnlyHistoryConversation as Ii, isReusableHistoryDraft as Li } from "../history/historyList.js";
131
+ import { resumeContextFor as Ri } from "../history/historyResume.js";
132
+ import { useAssistantHistoryStatus as zi } from "../history/historyStatus.js";
133
+ import { useHistoryRowControlsFor as Bi } from "../history/useHistoryRowControls.js";
134
+ import { getHistoryStamp as Vi, setHistoryBusyProbe as Hi } from "../history/stampRegistry.js";
135
+ import { resolveConversationDeleteTarget as Ui } from "../conversationDeleteCommand.js";
136
+ import { useAssistantNavigate as Wi } from "./AssistantMarkdownRenderer.js";
137
+ import { useAssistantSpeech as Gi } from "./AssistantSpeechProvider.js";
138
+ import { useAssistantStopTurnLabel as Ki } from "../../providers/shell/useAssistantShellLabels.js";
139
+ import { useThemeOrNull as qi } from "../../providers/shell/ThemeProvider.js";
140
+ import { useVisibleNavItems as Ji } from "../../../chrome/mobileTabBar/useVisibleNavItems.js";
141
+ import { useAskAboutStore as Yi } from "../askAbout/askAboutStore.js";
142
+ import { readMessageFocus as Xi, withFocusNote as Zi } from "../askAbout/focus.js";
143
+ import { useCallback as D, useEffect as O, useLayoutEffect as Qi, useMemo as k, useRef as A, useState as j, useSyncExternalStore as $i } from "react";
144
+ import { Fragment as ea, jsx as M, jsxs as ta } from "react/jsx-runtime";
141
145
  // src/shared/assistant/ui/AssistantChatArea.tsx
142
- var Ji = 2500, Yi = 600, Xi = 2e4, Zi = 1e4, Qi = 1e4, $i = !1, ea = {
146
+ var na = 2500, ra = 300, ia = 2e4, aa = 1e4, oa = 1e4, sa = !1, ca = {
143
147
  committing: !1,
144
148
  dictating: !1
145
- }, ta = 6e3;
149
+ }, la = 6e3;
146
150
  function N() {
147
151
  return `${Date.now()}-${Math.random().toString(36).slice(2, 9)}`;
148
152
  }
149
- var na = () => () => {}, ra = () => "off", ia = ({ visible: ia = !0, writeAccess: aa = "unknown", presentation: oa = "classic", inputRef: sa, onDraftDirtyChange: ca, surface: la, onWindowVoiceChange: ua, onOpenFull: da, onContinuedInChat: fa }) => {
150
- let P = Tn(), pa = Ri(), F = oa === "compact", ma = F && la === "window", { product: I, modes: L, gatherPageContext: ha, buildPrompt: ga, reportTurnTimings: _a, reportTokenUsage: va, localUiCommands: ya } = Dn(), R = xt(Dn().writeApproval), ba = D((e, t) => {
153
+ var ua = () => () => {}, da = () => "off", fa = ({ visible: fa = !0, writeAccess: pa = "unknown", presentation: ma = "classic", inputRef: ha, onDraftDirtyChange: ga, surface: _a, onWindowVoiceChange: va, onOpenFull: ya, onContinuedInChat: ba }) => {
154
+ let P = On(), xa = Ki(), F = ma === "compact", Sa = F && _a === "window", { product: I, modes: L, gatherPageContext: Ca, buildPrompt: wa, reportTurnTimings: Ta, reportTokenUsage: Ea, localUiCommands: Da } = An(), R = bt(An().writeApproval), Oa = D((e, t) => {
151
155
  let n = w.getState(), r = t ?? n.sandboxesByMode[e]?.sandboxId ?? null;
152
156
  return g({
153
157
  mode: e,
154
158
  productWriteApproval: R,
155
159
  capabilities: r ? n.sandboxWriteCapabilities[r] : null
156
160
  });
157
- }, [R]), { getAccessToken: xa, getWorkspaceToken: Sa, userId: z } = r(), { locale: B, isLocaleLoading: Ca } = n(), wa = w((e) => e.voiceGraceMs), Ta = w((e) => e.handsFreeInterrupt), Ea = w((e) => e.handsFreeStreamNoticeAccepted), Da = w((e) => e.acceptHandsFreeStreamNotice), Oa = w((e) => e.assistantLanguage), ka = w((e) => e.replyLanguage), Aa = k(() => s(Oa, ka, B), [
158
- Oa,
159
- ka,
161
+ }, [R]), { getAccessToken: ka, getWorkspaceToken: Aa, userId: z } = r(), { locale: B, isLocaleLoading: ja } = n(), Ma = w((e) => e.voiceGraceMs), Na = w((e) => e.handsFreeInterrupt), Pa = w((e) => e.handsFreeStreamNoticeAccepted), Fa = w((e) => e.acceptHandsFreeStreamNotice), Ia = w((e) => e.assistantLanguage), La = w((e) => e.replyLanguage), Ra = k(() => s(Ia, La, B), [
162
+ Ia,
163
+ La,
160
164
  B
161
- ]), ja = Aa.reply.english, Ma = Aa.replyIsExplicit, Na = Aa.reply.code, { conversations: Pa, activeConversationId: V, mode: H, processingByConversationId: Fa, setMode: Ia, setConversationMode: La, setActiveConversation: Ra, createConversation: za, addMessage: U, updateMessage: Ba, patchMessage: Va, mergeMessageMetadata: Ha, setConversationProcessing: Ua, clearConversationProcessing: Wa, setBackendSessionId: Ga, clearBackendSessionId: Ka, setSandbox: qa, clearSandbox: Ja, acknowledgedWriteModes: Ya, acknowledgeWriteMode: Xa, autoRouting: Za, setAutoRouting: Qa, routeConversation: $a } = w(), W = Pa.find((e) => e.id === V), eo = nt(W), to = eo.all, G = V ? Fa[V] : void 0, no = Sn(G?.status), ro = no ? G?.messageId ?? null : null, io = G?.status === "error" ? G.messageId : null, ao = w((e) => e.sandboxWriteCapabilities), { panel: K, entries: oo, retiredSandboxes: so } = ee({
165
+ ]), za = Ra.reply.english, Ba = Ra.replyIsExplicit, Va = Ra.reply.code, { conversations: Ha, activeConversationId: V, mode: H, processingByConversationId: Ua, setMode: Wa, setConversationMode: Ga, setActiveConversation: Ka, createConversation: qa, addMessage: U, updateMessage: Ja, patchMessage: Ya, mergeMessageMetadata: Xa, setConversationProcessing: Za, clearConversationProcessing: Qa, setBackendSessionId: $a, clearBackendSessionId: eo, setSandbox: to, clearSandbox: no, acknowledgedWriteModes: ro, acknowledgeWriteMode: io, autoRouting: ao, setAutoRouting: oo, routeConversation: so } = w(), W = Ha.find((e) => e.id === V), co = nt(W), lo = co.all, G = V ? Ua[V] : void 0, uo = Tn(G?.status), fo = uo ? G?.messageId ?? null : null, po = G?.status === "error" ? G.messageId : null, mo = w((e) => e.sandboxWriteCapabilities), { panel: K, entries: ho, retiredSandboxes: go } = ee({
162
166
  tr: P,
163
167
  productWriteApproval: R
164
- }), co = p({
168
+ }), _o = p({
165
169
  approve: (e, t) => K.approve(e, t),
166
170
  decline: (e, t, n) => K.decline(e, t, n),
167
171
  presented: (e, t) => K.presented(e, t)
168
- }), lo = co.dismiss, uo = A(null);
172
+ }), vo = _o.dismiss, yo = A(null);
169
173
  O(() => {
170
- lo();
171
- let e = uo.current;
172
- uo.current = V, e && e !== V && K.withdraw(e, "conversation_closed"), V && K.openConversation(V);
174
+ vo();
175
+ let e = yo.current;
176
+ yo.current = V, e && e !== V && K.withdraw(e, "conversation_closed"), V && K.openConversation(V);
173
177
  }, [
174
178
  V,
175
179
  K,
176
- lo
180
+ vo
177
181
  ]);
178
- let fo = Oi(W), po = Mi(W)?.archivedAt != null, mo = ji((e) => V !== null && V in e.loadingIds), ho = ji((e) => V !== null && V in e.loadErrorIds), go = ji((e) => e.remoteDelete), [_o, vo] = j(() => ji.getState().remoteDelete?.at ?? null), yo = go?.wasActive === !0 && go.at !== _o ? go.at : null;
182
+ let bo = Ii(W), xo = Bi(W)?.archivedAt != null, So = zi((e) => V !== null && V in e.loadingIds), Co = zi((e) => V !== null && V in e.loadErrorIds), wo = zi((e) => e.remoteDelete), [To, Eo] = j(() => zi.getState().remoteDelete?.at ?? null), Do = wo?.wasActive === !0 && wo.at !== To ? wo.at : null;
179
183
  O(() => {
180
- if (yo === null) return;
181
- let e = window.setTimeout(() => vo(yo), Qi);
184
+ if (Do === null) return;
185
+ let e = window.setTimeout(() => Eo(Do), oa);
182
186
  return () => window.clearTimeout(e);
183
- }, [yo]);
184
- let bo = T(), { canUseApiCalls: xo, loading: So } = Ye(bo, z), Co = A(zn({
185
- loading: So,
186
- canUseAdminModes: xo
187
- })).current, wo = A(L);
187
+ }, [Do]);
188
+ let Oo = T(), { canUseApiCalls: ko, loading: Ao } = Ye(Oo, z), jo = A(qn({
189
+ loading: Ao,
190
+ canUseAdminModes: ko
191
+ })).current, Mo = A(L);
188
192
  O(() => {
189
- wo.current = L;
193
+ Mo.current = L;
190
194
  }, [L]);
191
- let To = () => {
195
+ let No = () => {
192
196
  let e = w.getState().activeConversationId;
193
- e && Ti.openConversation(e, { modes: wo.current });
194
- }, Eo = () => {
197
+ e && Ni.openConversation(e, { modes: Mo.current });
198
+ }, Po = () => {
195
199
  let e = w.getState().activeConversationId;
196
- e && Ti.loadEarlier(e);
197
- }, Do = A(xa);
200
+ e && Ni.loadEarlier(e);
201
+ }, Fo = A(ka);
198
202
  O(() => {
199
- Do.current = xa;
200
- }, [xa]);
201
- let Oo = !!I && _a !== !1;
203
+ Fo.current = ka;
204
+ }, [ka]);
205
+ let Io = !!I && Ta !== !1;
202
206
  O(() => {
203
- if (Oo) return cn({ send: (e) => sn(e, {
207
+ if (Io) return un({ send: (e) => ln(e, {
204
208
  workspaceId: T(),
205
209
  authContext: {
206
- accessToken: Do.current(),
207
- organizationId: Lt()
210
+ accessToken: Fo.current(),
211
+ organizationId: Rt()
208
212
  }
209
213
  }) });
210
- }, [Oo]), O(() => {
211
- Co.update({
212
- loading: So,
213
- canUseAdminModes: xo
214
+ }, [Io]), O(() => {
215
+ jo.update({
216
+ loading: Ao,
217
+ canUseAdminModes: ko
214
218
  });
215
219
  }, [
216
- Co,
217
- So,
218
- xo
220
+ jo,
221
+ Ao,
222
+ ko
219
223
  ]), O(() => () => {
220
- Co.abandon();
221
- }, [Co]);
222
- let ko = k(() => L.filter((e) => !e.requiresAdmin || xo), [L, xo]), Ao = fe(ko), jo = Za && Ao, Mo = A(Ao);
224
+ jo.abandon();
225
+ }, [jo]);
226
+ let Lo = k(() => L.filter((e) => !e.requiresAdmin || ko), [L, ko]), Ro = fe(Lo), zo = ao && Ro, Bo = A(Ro);
223
227
  O(() => {
224
- Mo.current = Ao;
225
- }, [Ao]);
226
- let No = A(null), Po = A(!1), [Fo, Io] = j(!1), Lo = dn(L), [Ro, zo] = j(null), [Bo, Vo] = j(null), Ho = Bo !== null && Bo === V, q = ze(), Uo = Be(), J = q.open && Uo !== null, Wo = q.close, Go = A(J);
227
- Wi(() => {
228
- Go.current = J;
228
+ Bo.current = Ro;
229
+ }, [Ro]);
230
+ let Vo = A(null), Ho = A(!1), [Uo, Wo] = j(!1), Go = pn(L), [Ko, qo] = j(null), [Jo, Yo] = j(null), Xo = Jo !== null && Jo === V, q = ze(), Zo = Be(), J = q.open && Zo !== null, Qo = q.close, $o = A(J);
231
+ Qi(() => {
232
+ $o.current = J;
229
233
  }, [J]);
230
- let Ko = D((e) => {
231
- e && Go.current || Vo(e ? w.getState().activeConversationId : null);
234
+ let es = D((e) => {
235
+ e && $o.current || Yo(e ? w.getState().activeConversationId : null);
232
236
  }, []);
233
237
  O(() => {
234
- Vo((e) => e !== null && e !== V ? null : e);
238
+ Yo((e) => e !== null && e !== V ? null : e);
235
239
  }, [V]);
236
- let qo = A(void 0), [Jo, Yo] = j(!1), [Xo, Zo] = j(!1), Qo = D((e) => {
237
- qo.current = e, Yo(tr(e));
238
- }, []), $o = A(null), es = A(!1), ts = D(() => {
240
+ let ts = A(void 0), [ns, rs] = j(!1), [is, as] = j(!1), os = D((e) => {
241
+ ts.current = e, rs(lr(e));
242
+ }, []), ss = A(null), cs = A(!1), ls = D(() => {
239
243
  let e = w.getState(), t = e.activeConversationId, n = t ? e.conversations.find((e) => e.id === t) : void 0;
240
244
  return !t || !n ? null : {
241
245
  id: t,
242
- reusableDraft: ki(n, Ni()),
246
+ reusableDraft: Li(n, Vi()),
243
247
  liveProposals: K.liveFor(t).count,
244
- turnInFlight: Sn(e.processingByConversationId[t]?.status)
248
+ turnInFlight: Tn(e.processingByConversationId[t]?.status)
245
249
  };
246
- }, [K]), ns = A({}), rs = A(vr()), is = A(new Wt()), as = A(/* @__PURE__ */ new Set()), os = k(() => L.find((e) => e.id === H), [L, H]), ss = w((e) => {
250
+ }, [K]), us = A({}), ds = A(nn(Er())), fs = A(new Gt()), ps = A(/* @__PURE__ */ new Set()), ms = k(() => L.find((e) => e.id === H), [L, H]), hs = w((e) => {
247
251
  let t = e.sandboxesByMode[H]?.sandboxId;
248
252
  return t ? e.sandboxWriteCapabilities[t] : void 0;
249
- }), cs = os !== void 0 && g({
253
+ }), gs = ms !== void 0 && g({
250
254
  mode: H,
251
255
  productWriteApproval: R,
252
- capabilities: ss
253
- }), ls = H === "assistant" || os !== void 0 && !os.writeCapable && !mt(H) || cs;
256
+ capabilities: hs
257
+ }), _s = H === "assistant" || ms !== void 0 && !ms.writeCapable && !pt(H) || gs;
254
258
  O(() => {
255
- let e = L.find((e) => e.id === "assistant" || !e.requiresAdmin || xo)?.id ?? L[0]?.id ?? "assistant";
256
- H !== "assistant" && os?.writeCapable && !Ln(Ya, H) ? Ia(e) : So || (!os || os.requiresAdmin && !xo) && H !== e && Ia(e);
259
+ let e = L.find((e) => e.id === "assistant" || !e.requiresAdmin || ko)?.id ?? L[0]?.id ?? "assistant";
260
+ H !== "assistant" && ms?.writeCapable && !Gn(ro, H) ? Wa(e) : Ao || (!ms || ms.requiresAdmin && !ko) && H !== e && Wa(e);
257
261
  }, [
258
262
  H,
259
- os,
260
- xo,
261
- So,
262
- Ia,
263
- Ya,
263
+ ms,
264
+ ko,
265
+ Ao,
266
+ Wa,
267
+ ro,
264
268
  L
265
269
  ]);
266
- let us = D((e, t, n, r) => {
267
- Ua(e, n, t, null, r);
268
- }, [Ua]), ds = D(async (e, t, n, r, i, a = null) => {
270
+ let vs = D((e, t, n, r) => {
271
+ Za(e, n, t, null, r);
272
+ }, [Za]), ys = D(async (e, t, n, r, i, a = null) => {
269
273
  let o = (e, t) => {
270
- r && us(r.conversationId, r.assistantMessageId, e, t), a && (a.step = t, a.onStep?.(t));
274
+ r && vs(r.conversationId, r.assistantMessageId, e, t), a && (a.step = t, a.onStep?.(t));
271
275
  }, s = (e) => {
272
276
  r && E(r.assistantMessageId, e);
273
277
  }, c = () => {
274
278
  s("bootAdopted"), a?.beginBoot();
275
279
  }, l = () => a !== null && (a.signal.aborted || T() !== t), u = () => {
276
- if (l()) throw new Gt("cancelled");
280
+ if (l()) throw new Kt("cancelled");
277
281
  }, d = w.getState().sandboxesByMode[e]?.sandboxId ?? null, f = !1, p = !1, ee = !1, m = !1, h = !1, g = async (r) => {
278
- if (i && !is.current.has(r) && rs.current.isFresh(r)) return f = !0, !0;
282
+ if (i && !fs.current.has(r) && ds.current.isFresh(r)) return f = !0, !0;
279
283
  ee = !0;
280
284
  let o = !1;
281
285
  try {
282
- await bt(r, t, n, 3e5), await yt(r, t, e, n, 9e4, () => {
286
+ await yt(r, t, n, 3e5), await vt(r, t, e, n, 9e4, () => {
283
287
  o = !0, c();
284
288
  });
285
289
  } catch {
286
- if (l()) throw new Gt("cancelled");
287
- return rs.current.invalidate(r), is.current.add(r), a?.dead.push(r), h = !0, !1;
290
+ if (l()) throw new Kt("cancelled");
291
+ return ds.current.invalidate(r), fs.current.add(r), a?.dead.push(r), h = !0, !1;
288
292
  }
289
- return u(), rs.current.markVerified(r), o && (m = !0), !0;
293
+ return u(), ds.current.markVerified(r), o && (m = !0), !0;
290
294
  };
291
- if (d && (qa(e, d, "provisioning"), o("provisioning", "reusingEnvironment"), await g(d) || (qa(e, null, "provisioning"), d = null)), !d) {
295
+ if (d && (to(e, d, "provisioning"), o("provisioning", "reusingEnvironment"), await g(d) || (to(e, null, "provisioning"), d = null)), !d) {
292
296
  o("provisioning", "lookingForEnvironment");
293
- let r = await lt(t, I, e, En(), n, is.current, R);
297
+ let r = await ct(t, I, e, kn(), n, fs.current, R);
294
298
  u();
295
299
  let i = r?.id ?? null;
296
300
  if (i) {
297
- qa(e, i, "provisioning"), o("provisioning", "reusingEnvironment");
301
+ to(e, i, "provisioning"), o("provisioning", "reusingEnvironment");
298
302
  let t = r?.status === "PROVISIONING" || r?.status === "PENDING";
299
- t && c(), await g(i) ? (d = i, t && (m = !0)) : qa(e, null, "provisioning");
303
+ t && c(), await g(i) ? (d = i, t && (m = !0)) : to(e, null, "provisioning");
300
304
  }
301
305
  }
302
306
  if (!d) {
303
- if (a && !a.mayCreate) throw new Gt("no-create");
304
- if (s("provisionStarted"), e === "api-calls" && !xa()) throw Error("API Calls mode requires an authenticated session. Please sign in again.");
305
- o("provisioning", "startingEnvironment"), qa(e, null, "provisioning");
306
- let r = a ? [] : await _t(t, I, e, En(), n, is.current, R);
307
+ if (a && !a.mayCreate) throw new Kt("no-create");
308
+ if (s("provisionStarted"), e === "api-calls" && !ka()) throw Error("API Calls mode requires an authenticated session. Please sign in again.");
309
+ o("provisioning", "startingEnvironment"), to(e, null, "provisioning");
310
+ let r = a ? [] : await gt(t, I, e, kn(), n, fs.current, R);
307
311
  if (r.length > 0) {
308
312
  let e = new Set(r);
309
- for (let e of r) rs.current.invalidate(e), is.current.add(e);
313
+ for (let e of r) ds.current.invalidate(e), fs.current.add(e);
310
314
  let t = w.getState().sandboxesByMode;
311
- for (let [n, r] of Object.entries(t)) y(n) && r?.sandboxId && e.has(r.sandboxId) && Ja(n);
315
+ for (let [n, r] of Object.entries(t)) y(n) && r?.sandboxId && e.has(r.sandboxId) && no(n);
312
316
  }
313
317
  s("createRequested");
314
318
  let i = a?.beginCreate();
315
319
  try {
316
- d = await ot(I, e, t, En(), Yi, n, { writeApproval: R });
320
+ d = await ot(I, e, t, kn(), ra, n, { writeApproval: R });
317
321
  } finally {
318
322
  i?.();
319
323
  }
320
- p = !0, u(), qa(e, d, "provisioning"), await bt(d, t, n, 3e5), u(), s("sandboxRunning"), await yt(d, t, e, n, 9e4), u(), s("serviceReady"), rs.current.markVerified(d);
324
+ p = !0, u(), to(e, d, "provisioning"), await yt(d, t, n, 3e5), u(), s("sandboxRunning"), await vt(d, t, e, n, 9e4), u(), s("serviceReady"), ds.current.markVerified(d);
321
325
  }
322
- return qa(e, d, "running"), {
326
+ return to(e, d, "running"), {
323
327
  sandboxId: d,
324
328
  sandboxIsNew: p,
325
329
  sandboxProbed: ee,
@@ -328,64 +332,64 @@ var na = () => () => {}, ra = () => "off", ia = ({ visible: ia = !0, writeAccess
328
332
  trustedFromCache: f
329
333
  };
330
334
  }, [
331
- Ja,
332
- xa,
335
+ no,
336
+ ka,
333
337
  I,
334
338
  R,
335
- qa,
336
- us
337
- ]), fs = D(async function e(t, n, r, i, a, o = {}) {
338
- let s = await Zt(i, r, (e) => us(t, n, "provisioning", e), () => E(n, "prewarmJoined"));
339
- for (let e of s.dead) rs.current.invalidate(e), is.current.add(e);
340
- s.verified && !is.current.has(s.verified) && rs.current.markVerified(s.verified), s.joined && nn(n, { prewarm: s.joined });
341
- let { sandboxId: c, sandboxIsNew: l, sandboxProbed: u, sandboxAdopted: d, deadSandboxProbe: f, trustedFromCache: p } = await ds(r, i, a, {
339
+ to,
340
+ vs
341
+ ]), bs = D(async function e(t, n, r, i, a, o = {}) {
342
+ let s = await Qt(i, r, (e) => vs(t, n, "provisioning", e), () => E(n, "prewarmJoined"));
343
+ for (let e of s.dead) ds.current.invalidate(e), fs.current.add(e);
344
+ s.verified && !fs.current.has(s.verified) && ds.current.markVerified(s.verified), s.joined && an(n, { prewarm: s.joined });
345
+ let { sandboxId: c, sandboxIsNew: l, sandboxProbed: u, sandboxAdopted: d, deadSandboxProbe: f, trustedFromCache: p } = await ys(r, i, a, {
342
346
  conversationId: t,
343
347
  assistantMessageId: n
344
- }, o.trustCache !== !1), ee = qt(i, r, c);
345
- !s.waited && ee && nn(n, { prewarm: "hit" });
346
- let m = w.getState().conversations.find((e) => e.id === t)?.backendSessionId ?? null, h = !1, g = null;
347
- if (m) {
348
- let e = Ft(c, m, (e, t) => dt(e, i, t, r, a, { limit: 50 }));
348
+ }, o.trustCache !== !1), ee = Jt(i, r, c);
349
+ !s.waited && ee && an(n, { prewarm: "hit" });
350
+ let m = w.getState().conversations.find((e) => e.id === t)?.backendSessionId ?? null, h = !1, g = null, _ = null;
351
+ if (m && o.verifySession !== !0 && w.getState().sandboxWriteCapabilities[c]?.promptRejectsUnknownSession === !0 && w.getState().conversations.find((e) => e.id === t)?.mode === r && (_ = It(c, m)), m && _ === null) {
352
+ let e = Ft(c, m, (e, t) => ut(e, i, t, r, a, { limit: 50 }));
349
353
  try {
350
- let t = await ft(c, i, m, r, a);
354
+ let t = await dt(c, i, m, r, a);
351
355
  if (t.mode !== r) throw Error(`Session mode mismatch: expected ${r}, received ${t.mode}`);
352
356
  g = e;
353
357
  } catch {
354
- Ka(t), m = null;
358
+ eo(t), m = null;
355
359
  }
356
360
  }
357
- let _ = !1;
361
+ let te = !1;
358
362
  if (!m) {
359
- let e = Kt(Jt({
363
+ let e = qt(Yt({
360
364
  workspaceId: i,
361
365
  mode: r,
362
366
  sandboxId: c,
363
367
  userId: z
364
368
  }), Date.now());
365
369
  if (e) {
366
- "pending" in e && us(t, n, "connecting", "preparingSession");
370
+ "pending" in e && vs(t, n, "connecting", "preparingSession");
367
371
  let o = "sessionId" in e ? e.sessionId : await e.pending;
368
- if (o && !is.current.has(c)) try {
369
- (await ft(c, i, o, r, a)).mode === r && (m = o, _ = !0, Ga(t, m), h = !0);
372
+ if (o && !fs.current.has(c)) try {
373
+ (await dt(c, i, o, r, a)).mode === r && (m = o, te = !0, $a(t, m), h = !0);
370
374
  } catch {}
371
375
  }
372
376
  }
373
377
  if (!m) {
374
- us(t, n, "connecting", "preparingSession");
378
+ vs(t, n, "connecting", "preparingSession");
375
379
  let s;
376
380
  try {
377
381
  s = await st(c, i, r, a);
378
382
  } catch (s) {
379
383
  if (p) {
380
- rs.current.invalidate(c);
381
- let l = br(s, o.isAbandoned?.() ?? !1), p = l === "check-network";
382
- if (l === "check-network" && (l = await yr(() => lt(i, I, r, En(), a, is.current, R))), l !== "rethrow" && o.isAbandoned?.() && (l = "rethrow"), l !== "rethrow") {
383
- p || nn(n, { cacheProofFailed: !0 }), l === "replace" && (is.current.add(c), Ka(t), Ja(r), K.retireSandbox(c));
384
+ ds.current.invalidate(c);
385
+ let l = Or(s, o.isAbandoned?.() ?? !1), p = l === "check-network";
386
+ if (l === "check-network" && (l = await Dr(() => ct(i, I, r, kn(), a, fs.current, R))), l !== "rethrow" && o.isAbandoned?.() && (l = "rethrow"), l !== "rethrow") {
387
+ p || an(n, { cacheProofFailed: !0 }), l === "replace" && (fs.current.add(c), eo(t), no(r), K.retireSandbox(c));
384
388
  let s = await e(t, n, r, i, a, {
385
389
  ...o,
386
390
  trustCache: !1
387
391
  });
388
- return p && (s.deadSandboxProbe || s.sandboxId !== c) && nn(n, { cacheProofFailed: !0 }), {
392
+ return p && (s.deadSandboxProbe || s.sandboxId !== c) && an(n, { cacheProofFailed: !0 }), {
389
393
  ...s,
390
394
  sandboxProbed: s.sandboxProbed || u,
391
395
  sandboxAdopted: s.sandboxAdopted || d,
@@ -395,7 +399,7 @@ var na = () => () => {}, ra = () => "off", ia = ({ visible: ia = !0, writeAccess
395
399
  }
396
400
  throw s;
397
401
  }
398
- m = s.sessionId, Ga(t, m), h = !0;
402
+ m = s.sessionId, $a(t, m), h = !0;
399
403
  }
400
404
  return {
401
405
  sandboxId: c,
@@ -406,70 +410,71 @@ var na = () => () => {}, ra = () => "off", ia = ({ visible: ia = !0, writeAccess
406
410
  sandboxProbed: u,
407
411
  sandboxAdopted: d,
408
412
  deadSandboxProbe: f,
409
- sessionPreopened: _
413
+ sessionPreopened: te,
414
+ knownFloor: _
410
415
  };
411
416
  }, [
412
- ds,
413
- Ka,
414
- Ja,
417
+ ys,
418
+ eo,
419
+ no,
415
420
  I,
416
421
  R,
417
- Ga,
418
- us,
422
+ $a,
423
+ vs,
419
424
  z,
420
425
  K
421
- ]), ps = D((e, t = !1) => {
426
+ ]), xs = D((e, t = !1) => {
422
427
  let n = T();
423
428
  if (!n) return;
424
- let r = w.getState(), i = Date.now(), a = Xt({
429
+ let r = w.getState(), i = Date.now(), a = Zt({
425
430
  autoRouting: r.autoRouting,
426
- autoOffered: Mo.current,
431
+ autoOffered: Bo.current,
427
432
  active: !t && r.activeConversationId ? r.conversations.find((e) => e.id === r.activeConversationId) : void 0,
428
433
  selectedMode: r.mode,
429
434
  autoReadMode: b,
430
- modes: wo.current,
435
+ modes: Mo.current,
431
436
  acknowledgedWriteModes: r.acknowledgedWriteModes,
432
- adminAccess: Co.read(),
437
+ adminAccess: jo.read(),
433
438
  dictated: e,
434
- voiceProposalBound: (e) => ba(e),
435
- turnInFlight: Object.values(r.processingByConversationId).some((e) => Sn(e?.status)),
436
- ...en(n),
439
+ voiceProposalBound: (e) => Oa(e),
440
+ turnInFlight: Object.values(r.processingByConversationId).some((e) => Tn(e?.status)),
441
+ ...tn(n),
437
442
  now: i
438
443
  });
439
444
  if (!a) return;
440
- let o = $t(n, a, i), s = {
441
- accessToken: xa(),
442
- workspaceToken: Sa(),
445
+ let o = en(n, a, i), s = {
446
+ accessToken: ka(),
447
+ workspaceToken: Aa(),
443
448
  userId: z,
444
- organizationId: Lt()
449
+ organizationId: Rt()
445
450
  };
446
- ds(a.mode, n, s, null, !0, o).then((e) => {
451
+ ys(a.mode, n, s, null, !0, o).then((e) => {
447
452
  if (o.finish({
448
453
  ok: !0,
449
454
  sandboxId: e.sandboxId,
450
455
  didWork: !e.trustedFromCache && (e.sandboxIsNew || e.sandboxProbed || e.sandboxAdopted),
451
456
  booted: e.sandboxIsNew || e.sandboxAdopted,
452
457
  dead: o.dead
453
- }), o.signal.aborted || T() !== n || is.current.has(e.sandboxId)) return;
454
- let r = w.getState(), i = !t && r.activeConversationId ? r.conversations.find((e) => e.id === r.activeConversationId) : void 0, c = Ni();
455
- Yt({
458
+ }), o.signal.aborted || T() !== n || fs.current.has(e.sandboxId)) return;
459
+ let r = w.getState(), i = !t && r.activeConversationId ? r.conversations.find((e) => e.id === r.activeConversationId) : void 0, c = Vi();
460
+ Xt({
456
461
  active: i ? {
457
462
  mode: i.mode,
458
463
  backendSessionId: i.backendSessionId,
459
- continuable: !Oi(i) && !Di(i, c),
460
- hasHistory: Ei(i)
464
+ continuable: !Ii(i) && !Fi(i, c),
465
+ hasHistory: Pi(i)
461
466
  } : void 0,
462
467
  mode: a.mode
463
- }) && Qt(Jt({
468
+ }) && $t(Yt({
464
469
  workspaceId: n,
465
470
  mode: a.mode,
466
471
  sandboxId: e.sandboxId,
467
472
  userId: z
468
473
  }), () => st(e.sandboxId, n, a.mode, s).then((e) => e.sessionId), Date.now());
469
474
  }, (e) => {
470
- if (!(e instanceof Gt) && !o.signal.aborted && T() === n) {
475
+ if (!(e instanceof Kt) && !o.signal.aborted && T() === n) {
471
476
  let e = w.getState().sandboxesByMode[a.mode]?.sandboxId ?? null;
472
- e && (rs.current.invalidate(e), is.current.add(e), o.dead.push(e), Ja(a.mode));
477
+ e && (ds.current.invalidate(e), fs.current.add(e), o.dead.push(e), no(a.mode));
473
478
  }
474
479
  o.finish({
475
480
  ok: !1,
@@ -479,68 +484,68 @@ var na = () => () => {}, ra = () => "off", ia = ({ visible: ia = !0, writeAccess
479
484
  });
480
485
  });
481
486
  }, [
482
- ds,
483
- Co,
484
- Ja,
485
- xa,
486
- Sa,
487
+ ys,
488
+ jo,
489
+ no,
490
+ ka,
491
+ Aa,
487
492
  z,
488
- ba
489
- ]), ms = A(!1), hs = A(null), gs = k(() => a(), []);
490
- O(() => () => gs.cancel(), [gs]);
491
- let _s = Gi(_r, fr, fr)?.reference ?? null, [vs, ys] = j(0), bs = A(/* @__PURE__ */ new Set()), xs = A(null), Ss = D(() => {
493
+ Oa
494
+ ]), Ss = A(!1), Cs = A(null), ws = k(() => a(), []);
495
+ O(() => () => ws.cancel(), [ws]);
496
+ let Ts = $i(Tr, br, br)?.reference ?? null, [Es, Ds] = j(0), Os = A(/* @__PURE__ */ new Set()), ks = A(null), As = D(() => {
492
497
  let e = w.getState(), t = e.activeConversationId;
493
498
  if (!t) return null;
494
- let n = e.processingByConversationId[t], r = Sn(n?.status) ? n?.messageId ?? null : null;
495
- if (!wn({
499
+ let n = e.processingByConversationId[t], r = Tn(n?.status) ? n?.messageId ?? null : null;
500
+ if (!Dn({
496
501
  interruptedTurnId: r,
497
502
  activeTurnId: r,
498
- alreadyRequested: r ? bs.current.has(r) : !1
503
+ alreadyRequested: r ? Os.current.has(r) : !1
499
504
  }).send || !r) return null;
500
- bs.current.add(r);
505
+ Os.current.add(r);
501
506
  let i = rt(e), a = T(), o = e.conversations.find((e) => e.id === t)?.backendSessionId;
502
507
  return i && a && o && it(i.sandboxId, a, o, i.mode, {
503
- accessToken: xa(),
504
- workspaceToken: Sa(),
508
+ accessToken: ka(),
509
+ workspaceToken: Aa(),
505
510
  userId: z,
506
- organizationId: Lt()
511
+ organizationId: Rt()
507
512
  }), r;
508
513
  }, [
509
514
  z,
510
- xa,
511
- Sa
512
- ]), Cs = D(() => {
513
- let e = Ss();
514
- return e && (At(e), Dt.abort(e)), e;
515
- }, [Ss]), ws = D(() => {
515
+ ka,
516
+ Aa
517
+ ]), js = D(() => {
518
+ let e = As();
519
+ return e && (kt(e), Et.abort(e)), e;
520
+ }, [As]), Ms = D(() => {
516
521
  let e = w.getState().activeConversationId;
517
- Cs(), e && K.declineForReply(e, "corrected", "spoken");
518
- }, [Cs, K]), Ts = D(async (e) => {
522
+ js(), e && K.declineForReply(e, "corrected", "spoken");
523
+ }, [js, K]), Ns = D(async (e) => {
519
524
  let t = w.getState(), n = rt(t), r = T(), i = t.activeConversationId;
520
525
  if (!n || !r || !i || oe(t.sandboxWriteCapabilities[n.sandboxId])) return;
521
- let a = t.conversations.find((e) => e.id === i), o = a ? hr(Xn(a.messages), {
526
+ let a = t.conversations.find((e) => e.id === i), o = a ? Cr(ir(a.messages), {
522
527
  sessionId: a.backendSessionId,
523
528
  sandboxId: n.sandboxId,
524
529
  nowMs: Date.now()
525
530
  }) : null;
526
531
  if (o?.reference !== e) {
527
- ys((e) => e + 1);
532
+ Ds((e) => e + 1);
528
533
  return;
529
534
  }
530
535
  let s = {
531
536
  conversationId: i,
532
537
  reference: e
533
538
  };
534
- if (!ur(s)) return;
539
+ if (!vr(s)) return;
535
540
  try {
536
541
  await at(n.sandboxId, r, e, n.mode, {
537
- accessToken: xa(),
538
- workspaceToken: Sa(),
542
+ accessToken: ka(),
543
+ workspaceToken: Aa(),
539
544
  userId: z,
540
- organizationId: Lt()
545
+ organizationId: Rt()
541
546
  });
542
547
  } catch (e) {
543
- dr(s), U(i, {
548
+ yr(s), U(i, {
544
549
  id: N(),
545
550
  role: "system",
546
551
  content: e instanceof Error ? e.message : "The change could not be approved.",
@@ -548,70 +553,70 @@ var na = () => () => {}, ra = () => "off", ia = ({ visible: ia = !0, writeAccess
548
553
  });
549
554
  return;
550
555
  }
551
- dr(s), Ha(i, o.messageId, { pendingWriteApprovedAt: (/* @__PURE__ */ new Date()).toISOString() });
556
+ yr(s), Xa(i, o.messageId, { pendingWriteApprovedAt: (/* @__PURE__ */ new Date()).toISOString() });
552
557
  let c = w.getState(), l = c.conversations.find((e) => e.id === i);
553
- c.activeConversationId === i && l && c.mode === n.mode && l.backendSessionId === a?.backendSessionId && rt(c)?.sandboxId === n.sandboxId && !Sn(c.processingByConversationId[i]?.status) && mr(Xn(l.messages)) === o.messageId && Ac.current(P("pendingWrite.approvedPrompt", "I approved that change — go ahead."), [], {
558
+ c.activeConversationId === i && l && c.mode === n.mode && l.backendSessionId === a?.backendSessionId && rt(c)?.sandboxId === n.sandboxId && !Tn(c.processingByConversationId[i]?.status) && Sr(ir(l.messages)) === o.messageId && Rc.current(P("pendingWrite.approvedPrompt", "I approved that change — go ahead."), [], {
554
559
  approvalFollowUp: { approvedReplyId: o.messageId },
555
560
  targetConversationId: i
556
561
  });
557
562
  }, [
558
563
  z,
559
564
  U,
560
- Ha,
565
+ Xa,
561
566
  P
562
- ]), Es = zi(), { speakFinishedReply: Ds, speakingMessageId: Os, stop: ks } = Li(), As = A(null), js = D((e, t) => {
563
- let n = As.current;
567
+ ]), Ps = qi(), { speakFinishedReply: Fs, speakingMessageId: Is, stop: Ls } = Gi(), Rs = A(null), zs = D((e, t) => {
568
+ let n = Rs.current;
564
569
  n?.token === e && n.exchange === null && (n.exchange = t);
565
- }, []), Ms = D((e) => {
566
- let t = As.current;
570
+ }, []), Bs = D((e) => {
571
+ let t = Rs.current;
567
572
  e !== void 0 && t?.token === e && (t.handled = !0);
568
- }, []), Ns = D((e, t) => {
569
- js(e, t), Go.current && Ot(t);
570
- }, [js]), Ps = Ii(), { items: Fs, permissionsSettled: Is, simulating: Ls } = Bi(), Y = A({
571
- theme: Es,
572
- navigate: Ps,
573
- navItems: Fs,
574
- options: ya ?? {},
575
- navPermissionsSettled: Is,
576
- navSimulating: Ls
573
+ }, []), Vs = D((e, t) => {
574
+ zs(e, t), $o.current && Dt(t);
575
+ }, [zs]), Hs = Wi(), { items: Us, permissionsSettled: Ws, simulating: Gs } = Ji(), Y = A({
576
+ theme: Ps,
577
+ navigate: Hs,
578
+ navItems: Us,
579
+ options: Da ?? {},
580
+ navPermissionsSettled: Ws,
581
+ navSimulating: Gs
577
582
  });
578
583
  O(() => {
579
584
  Y.current = {
580
- theme: Es,
581
- navigate: Ps,
582
- navItems: Fs,
583
- options: ya ?? {},
584
- navPermissionsSettled: Is,
585
- navSimulating: Ls
585
+ theme: Ps,
586
+ navigate: Hs,
587
+ navItems: Us,
588
+ options: Da ?? {},
589
+ navPermissionsSettled: Ws,
590
+ navSimulating: Gs
586
591
  };
587
592
  }, [
588
- Es,
589
593
  Ps,
590
- Fs,
591
- ya,
592
- Is,
593
- Ls
594
+ Hs,
595
+ Us,
596
+ Da,
597
+ Ws,
598
+ Gs
594
599
  ]);
595
600
  let X = A(!0);
596
601
  O(() => (X.current = !0, () => {
597
602
  X.current = !1;
598
603
  }), []);
599
- let Rs = A({
604
+ let Ks = A({
600
605
  tr: P,
601
606
  locale: B
602
- }), zs = A(null), [Bs, Vs] = j(null), Hs = A(null), Us = D((e) => {
603
- Hs.current !== null && (window.clearTimeout(Hs.current), Hs.current = null);
604
- let t = zs.current;
605
- t && (zs.current = null, window.clearTimeout(t.deadline), X.current && Vs(null), e && X.current && (Hs.current = window.setTimeout(() => {
606
- if (Hs.current = null, !X.current) return;
607
+ }), qs = A(null), [Js, Ys] = j(null), Xs = A(null), Zs = D((e) => {
608
+ Xs.current !== null && (window.clearTimeout(Xs.current), Xs.current = null);
609
+ let t = qs.current;
610
+ t && (qs.current = null, window.clearTimeout(t.deadline), X.current && Ys(null), e && X.current && (Xs.current = window.setTimeout(() => {
611
+ if (Xs.current = null, !X.current) return;
607
612
  let e = w.getState();
608
613
  if (e.activeConversationId !== t.conversationId) return;
609
614
  let n = e.conversations.find((e) => e.id === t.conversationId)?.messages.find((e) => e.id === t.messageId);
610
615
  if (!n) return;
611
- let r = Rs.current, i = Vn(n, null, r.tr);
616
+ let r = Ks.current, i = Yn(n, null, r.tr);
612
617
  if (i.kind !== "output") return;
613
- let a = Wr(n, r.tr);
614
- Dt.publish(n.id, {
618
+ let a = Qr(n, r.tr);
619
+ Et.publish(n.id, {
615
620
  conversationId: t.conversationId,
616
621
  channel: n.metadata?.voice === !0 ? "voice" : "chat",
617
622
  voiceSessionId: n.metadata?.voiceSessionId,
@@ -620,44 +625,44 @@ var na = () => () => {}, ra = () => "off", ia = ({ visible: ia = !0, writeAccess
620
625
  final: !0
621
626
  });
622
627
  }, 0)));
623
- }, []), Ws = D(() => Us(!0), [Us]);
628
+ }, []), Qs = D(() => Zs(!0), [Zs]);
624
629
  O(() => {
625
- Rs.current = {
630
+ Ks.current = {
626
631
  tr: P,
627
632
  locale: B
628
633
  };
629
- let e = zs.current;
634
+ let e = qs.current;
630
635
  if (!e) return;
631
- let t = Gr({
636
+ let t = $r({
632
637
  wanted: e.wanted,
633
638
  locale: B,
634
- isLoading: Ca(e.wanted),
635
- translatedNow: Hr(P, e.reply).translated
639
+ isLoading: ja(e.wanted),
640
+ translatedNow: Xr(P, e.reply).translated
636
641
  });
637
- if (t === "write") Ws();
642
+ if (t === "write") Qs();
638
643
  else if (t === "grace") {
639
- let e = window.setTimeout(Ws, 400);
644
+ let e = window.setTimeout(Qs, 400);
640
645
  return () => window.clearTimeout(e);
641
646
  }
642
647
  }, [
643
648
  P,
644
649
  B,
645
- Ca,
646
- Bs,
647
- Ws
648
- ]), O(() => () => Us(!1), [Us]);
649
- let Gs = A(null), [Ks, qs] = j(!1), [Js, Ys] = j(null), [Z] = j(() => new li()), [Xs, Zs] = j(0), Qs = D(() => Zs((e) => e + 1), []), $s = D(() => {
650
+ ja,
651
+ Js,
652
+ Qs
653
+ ]), O(() => () => Zs(!1), [Zs]);
654
+ let $s = A(null), [ec, tc] = j(!1), [nc, rc] = j(null), [Z] = j(() => new _i()), [ic, ac] = j(0), oc = D(() => ac((e) => e + 1), []), sc = D(() => {
650
655
  let e = Y.current;
651
656
  return {
652
- destinations: Tr(e.navItems),
657
+ destinations: Nr(e.navItems),
653
658
  permissionsSettled: e.navPermissionsSettled,
654
659
  simulating: e.navSimulating
655
660
  };
656
- }, []), ec = A(z);
661
+ }, []), cc = A(z);
657
662
  O(() => {
658
- ec.current = z;
663
+ cc.current = z;
659
664
  }, [z]);
660
- let tc = D((e, t) => {
665
+ let lc = D((e, t) => {
661
666
  let n = Z.replyIdOf(e), r = n ? Z.turnFor(n) : void 0, i = Z.offer(e), a = {
662
667
  ok: !1,
663
668
  reason: "gone",
@@ -669,22 +674,22 @@ var na = () => () => {}, ra = () => "off", ia = ({ visible: ia = !0, writeAccess
669
674
  let o = r.conversationId, s = w.getState().conversations.find((e) => e.id === o);
670
675
  if (!s) return a;
671
676
  let c = s.messages.find((e) => e.id === n), l = c?.metadata?.voice === !0 ? c.metadata.voiceSessionId : void 0, u = Z.liveOffersFor(n, {
672
- registry: $s(),
673
- actorId: ec.current,
677
+ registry: sc(),
678
+ actorId: cc.current,
674
679
  conversationId: o,
675
680
  perfNow: performance.now()
676
681
  }).find((t) => t.offer.offerId === e);
677
682
  if (!u) {
678
- let e = fi(i, performance.now());
683
+ let e = bi(i, performance.now());
679
684
  return {
680
685
  ok: !1,
681
686
  reason: e ? "unavailable" : "expired",
682
- copy: e ? Ir(P, t || null) : Pr(P),
687
+ copy: e ? Wr(P, t || null) : Hr(P),
683
688
  conversationId: o,
684
689
  voiceSessionId: l
685
690
  };
686
691
  }
687
- return Z.markUsed(e) ? (Qs(), {
692
+ return Z.markUsed(e) ? (oc(), {
688
693
  ok: !0,
689
694
  target: u.target,
690
695
  conversationId: o,
@@ -692,10 +697,10 @@ var na = () => () => {}, ra = () => "off", ia = ({ visible: ia = !0, writeAccess
692
697
  }) : a;
693
698
  }, [
694
699
  Z,
695
- $s,
700
+ sc,
696
701
  P,
697
- Qs
698
- ]), nc = D((e, t, n, r, i) => {
702
+ oc
703
+ ]), uc = D((e, t, n, r, i) => {
699
704
  let a = N();
700
705
  U(e, {
701
706
  id: a,
@@ -705,20 +710,20 @@ var na = () => () => {}, ra = () => "off", ia = ({ visible: ia = !0, writeAccess
705
710
  metadata: {
706
711
  lang: n.translated ? B : "en",
707
712
  ...i ? { localAction: i } : {},
708
- ...Qn(t)
713
+ ...or(t)
709
714
  }
710
- }), i && Ti.recordCommittedEntries(e, [a], "NOTE", r);
711
- }, [U, B]), rc = D((e, t) => (t.status === "kept" || t.status === "refused" && t.reason === "unsaved-changes") && Z.release(e), [Z]), ic = A(null);
715
+ }), i && Ni.recordCommittedEntries(e, [a], "NOTE", r);
716
+ }, [U, B]), dc = D((e, t) => (t.status === "kept" || t.status === "refused" && t.reason === "unsaved-changes") && Z.release(e), [Z]), fc = A(null);
712
717
  O(() => () => {
713
- ic.current?.(), ic.current = null;
718
+ fc.current?.(), fc.current = null;
714
719
  }, []);
715
- let ac = D((e) => {
716
- ic.current?.(), ic.current = X.current ? Qr(document, e) : null;
717
- }, []), oc = D((e, t, n, r = !1) => {
718
- if (Gs.current !== null) return;
719
- let i = tc(e, n), a = T(), o = (e, t, n, r) => nc(e, t, n, a, r);
720
+ let pc = D((e) => {
721
+ fc.current?.(), fc.current = X.current ? oi(document, e) : null;
722
+ }, []), mc = D((e, t, n, r = !1) => {
723
+ if ($s.current !== null) return;
724
+ let i = lc(e, n), a = T(), o = (e, t, n, r) => uc(e, t, n, a, r);
720
725
  if (!i.ok) {
721
- i.copy && i.conversationId && o(i.conversationId, i.voiceSessionId, i.copy), Qs();
726
+ i.copy && i.conversationId && o(i.conversationId, i.voiceSessionId, i.copy), oc();
722
727
  return;
723
728
  }
724
729
  let { target: s, conversationId: c, voiceSessionId: l } = i, u = {
@@ -726,7 +731,7 @@ var na = () => () => {}, ra = () => "off", ia = ({ visible: ia = !0, writeAccess
726
731
  offerId: e
727
732
  };
728
733
  if (r) {
729
- o(c, l, Mr(P, s.label, !0), bi({
734
+ o(c, l, Br(P, s.label, !0), Oi({
730
735
  destinationId: s.id,
731
736
  path: s.path,
732
737
  alreadyHere: !0,
@@ -736,16 +741,16 @@ var na = () => () => {}, ra = () => "off", ia = ({ visible: ia = !0, writeAccess
736
741
  return;
737
742
  }
738
743
  let d = N();
739
- Gs.current = d, qs(!0);
744
+ $s.current = d, tc(!0);
740
745
  let f = (t) => {
741
746
  try {
742
- if (rc(e, t) && (Qs(), t.status === "kept" && ac(e)), t.status === "kept" || !w.getState().conversations.some((e) => e.id === c)) return;
747
+ if (dc(e, t) && (oc(), t.status === "kept" && pc(e)), t.status === "kept" || !w.getState().conversations.some((e) => e.id === c)) return;
743
748
  let n = t.status === "arrived" || t.status === "redirected" ? t.landedPath : null;
744
- o(c, l, Nr(P, t, {
749
+ o(c, l, Vr(P, t, {
745
750
  page: s.label,
746
- landed: n === null ? null : Si(Tr(Y.current.navItems), n),
751
+ landed: n === null ? null : Ai(Nr(Y.current.navItems), n),
747
752
  path: s.path
748
- }), bi({
753
+ }), Oi({
749
754
  destinationId: s.id,
750
755
  path: s.path,
751
756
  alreadyHere: !1,
@@ -754,10 +759,10 @@ var na = () => () => {}, ra = () => "off", ia = ({ visible: ia = !0, writeAccess
754
759
  offer: u
755
760
  }));
756
761
  } finally {
757
- Gs.current === d && (Gs.current = null, X.current && qs(!1));
762
+ $s.current === d && ($s.current = null, X.current && tc(!1));
758
763
  }
759
764
  };
760
- wi(Y.current.navigate, s.path, {
765
+ Mi(Y.current.navigate, s.path, {
761
766
  readPath: () => window.location.pathname + window.location.search,
762
767
  now: () => Date.now(),
763
768
  schedule: (e, t) => {
@@ -768,20 +773,20 @@ var na = () => () => {}, ra = () => "off", ia = ({ visible: ia = !0, writeAccess
768
773
  surface: "offer"
769
774
  }).then(f, () => f({ status: "unconfirmed" }));
770
775
  }, [
771
- tc,
772
- nc,
776
+ lc,
777
+ uc,
773
778
  P,
774
- Qs,
775
- rc,
776
- ac
777
- ]), sc = D((e, t) => oc(e, "tap", t || null), [oc]), cc = D((e) => {
779
+ oc,
780
+ dc,
781
+ pc
782
+ ]), hc = D((e, t) => mc(e, "tap", t || null), [mc]), gc = D((e) => {
778
783
  let { replyId: t, conversationId: n } = e, r = Z.turnFor(t);
779
784
  if (!r) return;
780
- let i = window.location.pathname + window.location.search, a = Tr(Y.current.navItems), o = mi({
785
+ let i = window.location.pathname + window.location.search, a = Nr(Y.current.navItems), o = Si({
781
786
  intent: e.intent,
782
787
  live: Z.liveOffersFor(t, {
783
- registry: $s(),
784
- actorId: ec.current,
788
+ registry: sc(),
789
+ actorId: cc.current,
785
790
  conversationId: n,
786
791
  perfNow: performance.now()
787
792
  }),
@@ -793,50 +798,50 @@ var na = () => () => {}, ra = () => "off", ia = ({ visible: ia = !0, writeAccess
793
798
  location: i,
794
799
  conversationId: w.getState().activeConversationId,
795
800
  workspaceId: T(),
796
- actorId: ec.current ?? null
801
+ actorId: cc.current ?? null
797
802
  },
798
803
  mounted: X.current,
799
804
  visible: document.visibilityState === "visible",
800
- unsavedChanges: hi(Y.current.options),
805
+ unsavedChanges: Ci(Y.current.options),
801
806
  alreadyThere: ({ target: e }) => {
802
807
  let t = a.find((t) => t.id === e.id);
803
- return t ? Sr(t, i, a) : !1;
808
+ return t ? Ar(t, i, a) : !1;
804
809
  }
805
810
  });
806
811
  if (o.act === "navigate" || o.act === "already-here") {
807
- oc(o.offer.offer.offerId, "resolve", o.offer.target.label, o.act === "already-here");
812
+ mc(o.offer.offer.offerId, "resolve", o.offer.target.label, o.act === "already-here");
808
813
  return;
809
814
  }
810
815
  let [s] = o.unsaved ?? [], [c] = Z.liveOffersFor(t, {
811
- registry: $s(),
812
- actorId: ec.current,
816
+ registry: sc(),
817
+ actorId: cc.current,
813
818
  conversationId: n,
814
819
  perfNow: performance.now()
815
820
  });
816
- o.hold === "R5-unsaved" && s && c && nc(n, e.voiceSessionId, Fr(P, s.label, c.target.label), T());
821
+ o.hold === "R5-unsaved" && s && c && uc(n, e.voiceSessionId, Ur(P, s.label, c.target.label), T());
817
822
  }, [
818
823
  Z,
819
- $s,
824
+ sc,
820
825
  K,
821
- oc,
822
- nc,
826
+ mc,
827
+ uc,
823
828
  P
824
- ]), lc = D((e) => {
829
+ ]), _c = D((e) => {
825
830
  let t = w.getState(), n = t.conversations.find((e) => e.id === t.activeConversationId);
826
- return n ? vi(_i, window.location.pathname, Ci(n.messages, e)) : !1;
827
- }, []), uc = be(), dc = Xr(), fc = uc?.request ?? null, pc = D((e, t, n = !1, r = !1) => {
828
- let { navItems: i, options: a, theme: o, navigate: s } = Y.current, c = Tr(i), l = null, u = {
831
+ return n ? Ei(Ti, window.location.pathname, ji(n.messages, e)) : !1;
832
+ }, []), vc = be(), yc = ii(), bc = vc?.request ?? null, xc = D((e, t, n = !1, r = !1) => {
833
+ let { navItems: i, options: a, theme: o, navigate: s } = Y.current, c = Nr(i), l = null, u = {
829
834
  ...a,
830
- locale: t === void 0 ? B : Aa.input.code,
835
+ locale: t === void 0 ? B : Ra.input.code,
831
836
  uiLocale: B,
832
- inputLocale: Aa.input.code
837
+ inputLocale: Ra.input.code
833
838
  };
834
- if (r || wr(e, u)) {
835
- let e = w.getState(), n = e.conversations.find((t) => t.id === e.activeConversationId), r = n ? ei(n.messages, t, { lookThroughRefusedOffers: { ownsOffer: (e, t) => Z.offersFor(e.id).some((e) => e.offerId === t) } }) : null, o = n ? e.processingByConversationId[n.id] ?? null : null, s = o !== null && o.messageId === r?.id && Sn(o.status);
839
+ if (r || Mr(e, u)) {
840
+ let e = w.getState(), n = e.conversations.find((t) => t.id === e.activeConversationId), r = n ? ci(n.messages, t, { lookThroughRefusedOffers: { ownsOffer: (e, t) => Z.offersFor(e.id).some((e) => e.offerId === t) } }) : null, o = n ? e.processingByConversationId[n.id] ?? null : null, s = o !== null && o.messageId === r?.id && Tn(o.status);
836
841
  if (n && r && !s) {
837
842
  let e = Z.liveOffersFor(r.id, {
838
- registry: $s(),
839
- actorId: ec.current,
843
+ registry: sc(),
844
+ actorId: cc.current,
840
845
  conversationId: n.id,
841
846
  perfNow: performance.now()
842
847
  }).flatMap(({ offer: e, target: t }) => {
@@ -846,14 +851,14 @@ var na = () => () => {}, ra = () => "off", ia = ({ visible: ia = !0, writeAccess
846
851
  target: n
847
852
  }] : [];
848
853
  });
849
- l = $r({
854
+ l = si({
850
855
  reply: r,
851
- text: Wn(r, o, P),
856
+ text: Qn(r, o, P),
852
857
  resolve: {
853
858
  destinations: c,
854
859
  entityRoutes: a.entityRoutes,
855
- visibleNavIds: ri(i),
856
- nounLabel: (e) => Ar(P, e)
860
+ visibleNavIds: di(i),
861
+ nounLabel: (e) => Rr(P, e)
857
862
  },
858
863
  offers: e
859
864
  });
@@ -863,18 +868,18 @@ var na = () => () => {}, ra = () => "off", ia = ({ visible: ia = !0, writeAccess
863
868
  destinations: c,
864
869
  sentenceOptions: u,
865
870
  context: {
866
- backRunnable: lc(t),
871
+ backRunnable: _c(t),
867
872
  navigation: l,
868
873
  skipRecords: n,
869
- controls: qr(),
874
+ controls: ti(),
870
875
  executors: {
871
876
  theme: o !== null,
872
877
  navigation: s !== null,
873
- conversationDelete: fc !== null,
878
+ conversationDelete: bc !== null,
874
879
  appControl: (e) => {
875
880
  try {
876
- let n = Kr(e, { voiceLive: t !== void 0 || yl.current });
877
- return n !== null && (n.kind !== "confirm" || dc !== null);
881
+ let n = ei(e, { voiceLive: t !== void 0 || Dl.current });
882
+ return n !== null && (n.kind !== "confirm" || yc !== null);
878
883
  } catch {
879
884
  return !1;
880
885
  }
@@ -883,34 +888,34 @@ var na = () => () => {}, ra = () => "off", ia = ({ visible: ia = !0, writeAccess
883
888
  }
884
889
  };
885
890
  }, [
886
- lc,
887
- Aa,
891
+ _c,
892
+ Ra,
888
893
  B,
889
894
  P,
890
895
  Z,
891
- $s,
892
- fc,
893
- dc
894
- ]), mc = D((e, t, n = !1) => {
895
- let { destinations: r, sentenceOptions: i, context: a } = pc(e, t, n);
896
- return Cr(e, r, i, a);
897
- }, [pc]), hc = D((e) => {
898
- if (hs.current = e, ca?.(Te(e)), gs.cancel(), !e.text.trim() && !e.hasAttachments) {
899
- ms.current = !1;
896
+ sc,
897
+ bc,
898
+ yc
899
+ ]), Sc = D((e, t, n = !1) => {
900
+ let { destinations: r, sentenceOptions: i, context: a } = xc(e, t, n);
901
+ return jr(e, r, i, a);
902
+ }, [xc]), Cc = D((e) => {
903
+ if (Cs.current = e, ga?.(Te(e)), ws.cancel(), !e.text.trim() && !e.hasAttachments) {
904
+ Ss.current = !1;
900
905
  return;
901
906
  }
902
- if (ms.current) return;
907
+ if (Ss.current) return;
903
908
  let t = () => {
904
- ms.current = !0, ps(!1);
909
+ Ss.current = !0, xs(!1);
905
910
  };
906
- e.hasAttachments || e.dictated ? t() : gs.schedule(() => {
907
- if (!ms.current) {
911
+ e.hasAttachments || e.dictated ? t() : ws.schedule(() => {
912
+ if (!Ss.current) {
908
913
  try {
909
- let { destinations: t, sentenceOptions: n, context: r } = pc(e.text, void 0, !1, !0);
910
- if (xr(e.text, t, n, r)) return;
914
+ let { destinations: t, sentenceOptions: n, context: r } = xc(e.text, void 0, !1, !0);
915
+ if (kr(e.text, t, n, r)) return;
911
916
  } catch {
912
- if (!$i) {
913
- $i = !0;
917
+ if (!sa) {
918
+ sa = !0;
914
919
  try {
915
920
  i.getLogger("assistant").warn("Draft command classification failed; using standard warm-up.");
916
921
  } catch {}
@@ -920,36 +925,36 @@ var na = () => () => {}, ra = () => "off", ia = ({ visible: ia = !0, writeAccess
920
925
  }
921
926
  });
922
927
  }, [
923
- gs,
924
- ca,
925
- ps,
926
- pc
928
+ ws,
929
+ ga,
930
+ xs,
931
+ xc
927
932
  ]);
928
933
  O(() => {
929
934
  let e = () => {
930
- hs.current && hc(hs.current);
931
- }, t = Jr(e), n = yi(window, e), r = _i.subscribe(e);
935
+ Cs.current && Cc(Cs.current);
936
+ }, t = ni(e), n = Di(window, e), r = Ti.subscribe(e);
932
937
  return () => {
933
- t(), n(), r(), gs.cancel();
938
+ t(), n(), r(), ws.cancel();
934
939
  };
935
- }, [gs, hc]), O(() => {
936
- hs.current && hc(hs.current);
940
+ }, [ws, Cc]), O(() => {
941
+ Cs.current && Cc(Cs.current);
937
942
  }, [
938
- hc,
939
- Fs,
940
- ya,
941
- Is,
942
- Ls,
943
- Es,
943
+ Cc,
944
+ Us,
945
+ Da,
946
+ Ws,
947
+ Gs,
944
948
  Ps,
949
+ Hs,
945
950
  H,
946
- Xs,
951
+ ic,
947
952
  V,
948
953
  W?.messages,
949
954
  G
950
955
  ]);
951
- let gc = D((e, t) => {
952
- let n = mc(e, t);
956
+ let wc = D((e, t) => {
957
+ let n = Sc(e, t);
953
958
  if (!n) return !1;
954
959
  let { theme: r, navigate: i } = Y.current;
955
960
  switch (n.kind) {
@@ -961,14 +966,14 @@ var na = () => () => {}, ra = () => "off", ia = ({ visible: ia = !0, writeAccess
961
966
  case "link-not-openable":
962
967
  case "back": return i !== null;
963
968
  case "conversation-delete": return !1;
964
- case "app-control": return Kr(n.request, { voiceLive: t !== void 0 || yl.current }) !== null;
969
+ case "app-control": return ei(n.request, { voiceLive: t !== void 0 || Dl.current }) !== null;
965
970
  case "open-record": return !1;
966
971
  }
967
- }, [mc]), _c = A(gc);
972
+ }, [Sc]), Tc = A(wc);
968
973
  O(() => {
969
- _c.current = gc;
970
- }, [gc]);
971
- let vc = D((e, t) => {
974
+ Tc.current = wc;
975
+ }, [wc]);
976
+ let Ec = D((e, t) => {
972
977
  let n = {
973
978
  state: "none",
974
979
  accept: null
@@ -977,16 +982,16 @@ var na = () => () => {}, ra = () => "off", ia = ({ visible: ia = !0, writeAccess
977
982
  let o = w.getState(), s = o.conversations.find((t) => t.id === e);
978
983
  if (!s) return n;
979
984
  let c = o.processingByConversationId[s.id] ?? null, l = {
980
- registry: $s(),
981
- actorId: ec.current,
985
+ registry: sc(),
986
+ actorId: cc.current,
982
987
  conversationId: s.id,
983
988
  perfNow: performance.now()
984
- }, { state: u, reply: d } = ci(Z, {
989
+ }, { state: u, reply: d } = gi(Z, {
985
990
  ...l,
986
991
  messages: s.messages,
987
992
  voiceSessionId: t,
988
993
  processing: c,
989
- displayedText: (e) => Wn(e, c, P),
994
+ displayedText: (e) => Qn(e, c, P),
990
995
  productWriteApproval: R,
991
996
  capabilitiesOf: (e) => w.getState().sandboxWriteCapabilities[e]
992
997
  });
@@ -994,7 +999,7 @@ var na = () => () => {}, ra = () => "off", ia = ({ visible: ia = !0, writeAccess
994
999
  state: u,
995
1000
  accept: null
996
1001
  };
997
- let [f] = Z.liveOffersFor(d.id, l), p = f ? Tr(a).find((e) => e.id === f.target.id) : void 0;
1002
+ let [f] = Z.liveOffersFor(d.id, l), p = f ? Nr(a).find((e) => e.id === f.target.id) : void 0;
998
1003
  return !f || !p ? n : {
999
1004
  state: u,
1000
1005
  accept: {
@@ -1004,10 +1009,10 @@ var na = () => () => {}, ra = () => "off", ia = ({ visible: ia = !0, writeAccess
1004
1009
  };
1005
1010
  }, [
1006
1011
  Z,
1007
- $s,
1012
+ sc,
1008
1013
  R,
1009
1014
  P
1010
- ]), yc = D((e, t, n, r, i, a) => {
1015
+ ]), Dc = D((e, t, n, r, i, a) => {
1011
1016
  let o = P(n.key, n.fallback, r), s = n.fallback.replace(/\{\{\s*count\s*\}\}/g, String(r.count)), c = {
1012
1017
  kind: "write-reply",
1013
1018
  line: n.key
@@ -1019,7 +1024,7 @@ var na = () => () => {}, ra = () => "off", ia = ({ visible: ia = !0, writeAccess
1019
1024
  timestamp: l,
1020
1025
  metadata: {
1021
1026
  localAction: c,
1022
- ...Qn(i)
1027
+ ...or(i)
1023
1028
  }
1024
1029
  });
1025
1030
  let d = N();
@@ -1031,55 +1036,55 @@ var na = () => () => {}, ra = () => "off", ia = ({ visible: ia = !0, writeAccess
1031
1036
  metadata: {
1032
1037
  lang: o === s ? "en" : B,
1033
1038
  localAction: c,
1034
- ...Qn(i)
1039
+ ...or(i)
1035
1040
  }
1036
- }), Ti.recordCommittedEntries(e, [u, d], "LOCAL_COMMAND", T()), a !== void 0 && Ns(a, {
1041
+ }), Ni.recordCommittedEntries(e, [u, d], "LOCAL_COMMAND", T()), a !== void 0 && Vs(a, {
1037
1042
  conversationId: e,
1038
1043
  questionId: u,
1039
1044
  replyId: d
1040
- }), Ds(e, d);
1045
+ }), Fs(e, d);
1041
1046
  }, [
1042
1047
  U,
1043
1048
  B,
1044
- Ns,
1045
- Ds,
1049
+ Vs,
1050
+ Fs,
1046
1051
  P
1047
- ]), bc = A(() => void 0), [xc, Sc] = j(null);
1052
+ ]), Oc = A(() => void 0), [kc, Ac] = j(null);
1048
1053
  O(() => {
1049
- if (xc === null) return;
1050
- let e = window.setTimeout(() => Sc(null), ta);
1054
+ if (kc === null) return;
1055
+ let e = window.setTimeout(() => Ac(null), la);
1051
1056
  return () => window.clearTimeout(e);
1052
- }, [xc]);
1053
- let Cc = D(() => {
1057
+ }, [kc]);
1058
+ let jc = D(() => {
1054
1059
  let e = w.getState();
1055
- return za(void 0, e.autoRouting && Mo.current ? b : e.mode, e.autoRouting ? { routedBy: "auto" } : void 0);
1056
- }, [za]), wc = D((e) => {
1057
- if (!fc) return !1;
1058
- let t = e !== void 0, n = w.getState(), r = Fi({
1060
+ return qa(void 0, e.autoRouting && Bo.current ? b : e.mode, e.autoRouting ? { routedBy: "auto" } : void 0);
1061
+ }, [qa]), Mc = D((e) => {
1062
+ if (!bc) return !1;
1063
+ let t = e !== void 0, n = w.getState(), r = Ui({
1059
1064
  spoken: t,
1060
- bound: qo.current,
1065
+ bound: ts.current,
1061
1066
  activeConversationId: n.activeConversationId,
1062
1067
  conversations: n.conversations,
1063
1068
  historyOn: xe()
1064
1069
  });
1065
- if (r && fc(r), t) {
1070
+ if (r && bc(r), t) {
1066
1071
  let e = r ? "Opened the delete confirmation. Choose Delete or Cancel on screen." : "There is no conversation to delete.", t = r ? P("deleteConversation.opened", "Opened the delete confirmation. Choose Delete or Cancel on screen.") : P("deleteConversation.nothing", "There is no conversation to delete.");
1067
- bc.current({
1072
+ Oc.current({
1068
1073
  id: `conversation-delete:${N()}`,
1069
1074
  text: t,
1070
1075
  lang: t === e ? "en" : B
1071
1076
  });
1072
- } else r || Sc(Date.now());
1077
+ } else r || Ac(Date.now());
1073
1078
  return !0;
1074
1079
  }, [
1075
- fc,
1080
+ bc,
1076
1081
  B,
1077
1082
  P
1078
- ]), Tc = D((e, t, n, r = !1, i) => {
1079
- if (e.kind === "conversation-delete") return wc(n);
1083
+ ]), Nc = D((e, t, n, r = !1, i) => {
1084
+ if (e.kind === "conversation-delete") return Mc(n);
1080
1085
  let { theme: a, navigate: o } = Y.current, s = null, c = () => {
1081
- let e = (r ? null : s ?? w.getState().activeConversationId) ?? Cc();
1082
- return r && Qo(e), e;
1086
+ let e = (r ? null : s ?? w.getState().activeConversationId) ?? jc();
1087
+ return r && os(e), e;
1083
1088
  }, l = (e, r) => {
1084
1089
  let i = N();
1085
1090
  return U(e, {
@@ -1089,7 +1094,7 @@ var na = () => () => {}, ra = () => "off", ia = ({ visible: ia = !0, writeAccess
1089
1094
  timestamp: (/* @__PURE__ */ new Date()).toISOString(),
1090
1095
  metadata: {
1091
1096
  localAction: r,
1092
- ...Qn(n)
1097
+ ...or(n)
1093
1098
  }
1094
1099
  }), i;
1095
1100
  }, u = (e, t, r, a, o, s, c) => {
@@ -1102,35 +1107,35 @@ var na = () => () => {}, ra = () => "off", ia = ({ visible: ia = !0, writeAccess
1102
1107
  metadata: {
1103
1108
  lang: r.translated ? B : "en",
1104
1109
  localAction: a,
1105
- ...Qn(n)
1110
+ ...or(n)
1106
1111
  }
1107
- }), Ti.recordCommittedEntries(e, [t, l], "LOCAL_COMMAND", o), i !== void 0 && Ns(i, {
1112
+ }), Ni.recordCommittedEntries(e, [t, l], "LOCAL_COMMAND", o), i !== void 0 && Vs(i, {
1108
1113
  conversationId: e,
1109
1114
  questionId: t,
1110
1115
  replyId: l
1111
- }), s && Ds(e, l), l;
1116
+ }), s && Fs(e, l), l;
1112
1117
  }, d = (e, t, n) => {
1113
1118
  let r = c(), i = l(r, t), a = u(r, i, e, t, T(), !0);
1114
1119
  return n?.(a), !0;
1115
1120
  }, f = (e) => {
1116
- let t = c(), n = T(), r = window.location.pathname, a = bi({
1121
+ let t = c(), n = T(), r = window.location.pathname, a = Oi({
1117
1122
  destinationId: e.destinationId,
1118
1123
  path: e.registryPath,
1119
1124
  alreadyHere: !1,
1120
1125
  via: e.via,
1121
1126
  offer: e.offer
1122
1127
  }), s = l(t, a), d = i === void 0 ? void 0 : N();
1123
- i !== void 0 && d !== void 0 && (js(i, {
1128
+ i !== void 0 && d !== void 0 && (zs(i, {
1124
1129
  conversationId: t,
1125
1130
  questionId: s,
1126
1131
  replyId: d
1127
- }), Ys(d));
1132
+ }), rc(d));
1128
1133
  let f = N();
1129
- Gs.current = f, qs(!0);
1134
+ $s.current = f, tc(!0);
1130
1135
  let p = (i) => {
1131
1136
  try {
1132
- if (e.offer && rc(e.offer.offerId, i) && Qs(), i.status === "kept" || !w.getState().conversations.some((e) => e.id === t)) return;
1133
- let a = Tr(Y.current.navItems), o = i.status === "arrived" || i.status === "redirected" ? i.landedPath : null, c = bi({
1137
+ if (e.offer && dc(e.offer.offerId, i) && oc(), i.status === "kept" || !w.getState().conversations.some((e) => e.id === t)) return;
1138
+ let a = Nr(Y.current.navItems), o = i.status === "arrived" || i.status === "redirected" ? i.landedPath : null, c = Oi({
1134
1139
  destinationId: e.destinationId,
1135
1140
  path: e.registryPath,
1136
1141
  alreadyHere: !1,
@@ -1138,10 +1143,10 @@ var na = () => () => {}, ra = () => "off", ia = ({ visible: ia = !0, writeAccess
1138
1143
  outcome: i,
1139
1144
  offer: e.offer
1140
1145
  });
1141
- Ha(t, s, { localAction: c });
1142
- let l = e.via === "back" && i.status === "arrived" ? Dr(P, e.pageLabel()) : Nr(P, i, {
1146
+ Xa(t, s, { localAction: c });
1147
+ let l = e.via === "back" && i.status === "arrived" ? Fr(P, e.pageLabel()) : Vr(P, i, {
1143
1148
  page: e.pageLabel(),
1144
- landed: o === null ? null : Si(a, o),
1149
+ landed: o === null ? null : Ai(a, o),
1145
1150
  path: e.target
1146
1151
  }), f = u(t, s, l, c, n, X.current, d);
1147
1152
  i.status === "arrived" && e.onArrived?.({
@@ -1150,10 +1155,10 @@ var na = () => () => {}, ra = () => "off", ia = ({ visible: ia = !0, writeAccess
1150
1155
  landedPath: i.landedPath
1151
1156
  });
1152
1157
  } finally {
1153
- Gs.current === f && (Gs.current = null, X.current && qs(!1)), d !== void 0 && X.current && Ys((e) => e === d ? null : e);
1158
+ $s.current === f && ($s.current = null, X.current && tc(!1)), d !== void 0 && X.current && rc((e) => e === d ? null : e);
1154
1159
  }
1155
1160
  };
1156
- return wi(o, e.target, {
1161
+ return Mi(o, e.target, {
1157
1162
  readPath: () => window.location.pathname + window.location.search,
1158
1163
  now: () => Date.now(),
1159
1164
  schedule: (e, t) => {
@@ -1161,7 +1166,7 @@ var na = () => () => {}, ra = () => "off", ia = ({ visible: ia = !0, writeAccess
1161
1166
  },
1162
1167
  isShellLess: () => !X.current
1163
1168
  }).then(p, () => p({ status: "unconfirmed" })), !0;
1164
- }, p = ({ replyId: e, fromPath: t, landedPath: n }) => _i.push({
1169
+ }, p = ({ replyId: e, fromPath: t, landedPath: n }) => Ti.push({
1165
1170
  fromPath: t,
1166
1171
  toPath: n,
1167
1172
  replyMessageId: e,
@@ -1169,21 +1174,21 @@ var na = () => () => {}, ra = () => "off", ia = ({ visible: ia = !0, writeAccess
1169
1174
  });
1170
1175
  if (e.kind === "theme") {
1171
1176
  if (!a) return !1;
1172
- let t = Er(e.request, {
1177
+ let t = Pr(e.request, {
1173
1178
  mode: a.mode,
1174
1179
  resolvedTheme: a.resolvedTheme
1175
1180
  });
1176
1181
  if (!t.alreadyApplied) try {
1177
1182
  a.setMode(t.mode);
1178
1183
  } catch {}
1179
- return d(Br(P, t, e.request.kind === "family"), {
1184
+ return d(Jr(P, t, e.request.kind === "family"), {
1180
1185
  kind: "theme",
1181
1186
  mode: t.mode,
1182
1187
  alreadyApplied: t.alreadyApplied
1183
1188
  });
1184
1189
  }
1185
1190
  if (e.kind === "app-control") {
1186
- let t = Kr(e.request, { voiceLive: n !== void 0 || yl.current });
1191
+ let t = ei(e.request, { voiceLive: n !== void 0 || Dl.current });
1187
1192
  if (!t) return !1;
1188
1193
  let r = (e) => ({
1189
1194
  kind: "app-control",
@@ -1191,34 +1196,34 @@ var na = () => () => {}, ra = () => "off", ia = ({ visible: ia = !0, writeAccess
1191
1196
  outcome: e.outcome,
1192
1197
  ...e.reply.code === "language" ? { languageLabel: e.reply.label } : {}
1193
1198
  }), i = (t) => {
1194
- if (e.request.control === "language" && Us(!1), e.request.control === "language" && t.reply.code === "language" && !t.reply.already && t.outcome === "done") {
1195
- let n = c(), i = r(t), a = l(n, i), o = u(n, a, Hr((e, t) => t, t.reply), i, T(), !1);
1196
- return zs.current = {
1199
+ if (e.request.control === "language" && Zs(!1), e.request.control === "language" && t.reply.code === "language" && !t.reply.already && t.outcome === "done") {
1200
+ let n = c(), i = r(t), a = l(n, i), o = u(n, a, Xr((e, t) => t, t.reply), i, T(), !1);
1201
+ return qs.current = {
1197
1202
  wanted: e.request.code,
1198
1203
  reply: t.reply,
1199
1204
  conversationId: n,
1200
1205
  messageId: o,
1201
- deadline: window.setTimeout(Ws, Ur)
1202
- }, Vs(o), !0;
1206
+ deadline: window.setTimeout(Qs, Zr)
1207
+ }, Ys(o), !0;
1203
1208
  }
1204
- return d(Hr(P, t.reply), r(t));
1209
+ return d(Xr(P, t.reply), r(t));
1205
1210
  };
1206
1211
  if (t.kind === "reply") return i(t.run);
1207
1212
  if (t.kind === "run") {
1208
1213
  let e = t.run();
1209
1214
  return t.silent && (e.outcome === "done" || e.outcome === "already") ? !0 : i(e);
1210
1215
  }
1211
- let a = dc;
1216
+ let a = yc;
1212
1217
  if (!a) return !1;
1213
1218
  let o = null;
1214
- return d(Hr(P, t.ask.reply), r(t.ask), (e) => {
1219
+ return d(Xr(P, t.ask.reply), r(t.ask), (e) => {
1215
1220
  o = w.getState().conversations.find((t) => t.messages.some((t) => t.id === e))?.id ?? null;
1216
1221
  }), a.request({
1217
1222
  prompt: t.prompt,
1218
1223
  onConfirm: () => {
1219
1224
  let e = t.confirmed(), i = o, a = i !== null && w.getState().conversations.some((e) => e.id === i);
1220
1225
  if (!i || !a) return;
1221
- let s = Hr(P, e.reply);
1226
+ let s = Xr(P, e.reply);
1222
1227
  U(i, {
1223
1228
  id: N(),
1224
1229
  role: "assistant",
@@ -1227,30 +1232,30 @@ var na = () => () => {}, ra = () => "off", ia = ({ visible: ia = !0, writeAccess
1227
1232
  metadata: {
1228
1233
  lang: s.translated ? B : "en",
1229
1234
  localAction: r(e),
1230
- ...Qn(n)
1235
+ ...or(n)
1231
1236
  }
1232
1237
  });
1233
1238
  }
1234
1239
  }), !0;
1235
1240
  }
1236
1241
  if (!o) return !1;
1237
- if (e.kind === "choose-destination") return d(Or(P, e.candidates[0]?.label ?? e.query, e.candidates), {
1242
+ if (e.kind === "choose-destination") return d(Ir(P, e.candidates[0]?.label ?? e.query, e.candidates), {
1238
1243
  kind: "choose-destination",
1239
1244
  candidateIds: e.candidates.map((e) => e.id)
1240
- }, (t) => ti(t, e.candidates));
1241
- if (e.kind === "choose-linked") return d(kr(P, e.candidates), {
1245
+ }, (t) => li(t, e.candidates));
1246
+ if (e.kind === "choose-linked") return d(Lr(P, e.candidates), {
1242
1247
  kind: "choose-destination",
1243
1248
  candidateIds: e.candidates.map((e) => e.id)
1244
- }, (t) => ti(t, e.candidates));
1249
+ }, (t) => li(t, e.candidates));
1245
1250
  if (e.kind === "pick-from-list") {
1246
1251
  let t = e.candidates !== null && e.candidates.every((e) => e !== null) ? e.candidates : null;
1247
- return d(Lr(P), t ? {
1252
+ return d(Gr(P), t ? {
1248
1253
  kind: "choose-destination",
1249
1254
  candidateIds: t.map((e) => e.id)
1250
1255
  } : e.candidateIds.length > 0 ? {
1251
1256
  kind: "choose-destination",
1252
1257
  candidateIds: [...e.candidateIds]
1253
- } : bi({
1258
+ } : Oi({
1254
1259
  destinationId: "",
1255
1260
  path: "",
1256
1261
  alreadyHere: !1,
@@ -1259,9 +1264,9 @@ var na = () => () => {}, ra = () => "off", ia = ({ visible: ia = !0, writeAccess
1259
1264
  status: "refused",
1260
1265
  reason: "not-routable"
1261
1266
  }
1262
- }), t ? (e) => ti(e, t) : void 0);
1267
+ }), t ? (e) => li(e, t) : void 0);
1263
1268
  }
1264
- if (e.kind === "link-not-openable") return d(jr(P), bi({
1269
+ if (e.kind === "link-not-openable") return d(zr(P), Oi({
1265
1270
  destinationId: "",
1266
1271
  path: "",
1267
1272
  alreadyHere: !1,
@@ -1274,7 +1279,7 @@ var na = () => () => {}, ra = () => "off", ia = ({ visible: ia = !0, writeAccess
1274
1279
  if (e.kind === "open-record") {
1275
1280
  let r;
1276
1281
  try {
1277
- let { options: t, navItems: n } = Y.current, i = t.entityRoutes ?? [], a = ri(n);
1282
+ let { options: t, navItems: n } = Y.current, i = t.entityRoutes ?? [], a = di(n);
1278
1283
  r = (t.records ?? []).flatMap((t) => {
1279
1284
  let n = i.find((e) => e.id === t.entityRouteId), r = e.request.adapterIds.length === 0 || e.request.adapterIds.includes(t.id);
1280
1285
  return n && r && (n.visibleWith === void 0 || a.has(n.visibleWith)) ? [{
@@ -1287,18 +1292,18 @@ var na = () => () => {}, ra = () => "off", ia = ({ visible: ia = !0, writeAccess
1287
1292
  }
1288
1293
  if (r.length === 0) return !1;
1289
1294
  let i = w.getState().activeConversationId, a = N();
1290
- Gs.current = a, qs(!0);
1295
+ $s.current = a, tc(!0);
1291
1296
  let o = () => {
1292
- Gs.current === a && (Gs.current = null, X.current && qs(!1));
1297
+ $s.current === a && ($s.current = null, X.current && tc(!1));
1293
1298
  };
1294
1299
  return (async () => {
1295
1300
  let a = { kind: "none" }, c = !0;
1296
1301
  try {
1297
- a = await ni({
1302
+ a = await ui({
1298
1303
  name: e.request.name,
1299
1304
  usable: r,
1300
- nounOf: (e) => Ar(P, e.noun),
1301
- timeoutMs: Ji
1305
+ nounOf: (e) => Rr(P, e.noun),
1306
+ timeoutMs: na
1302
1307
  }), c = w.getState().conversations.some((e) => e.id === i);
1303
1308
  } catch {
1304
1309
  a = { kind: "none" };
@@ -1307,7 +1312,7 @@ var na = () => () => {}, ra = () => "off", ia = ({ visible: ia = !0, writeAccess
1307
1312
  }
1308
1313
  if (!X.current) return;
1309
1314
  if (a.kind === "none") {
1310
- Ac.current(t, [], {
1315
+ Rc.current(t, [], {
1311
1316
  fromPerson: !0,
1312
1317
  ...n === void 0 ? {} : { voiceSessionId: n },
1313
1318
  localRecordsChecked: !0
@@ -1328,16 +1333,16 @@ var na = () => () => {}, ra = () => "off", ia = ({ visible: ia = !0, writeAccess
1328
1333
  return;
1329
1334
  }
1330
1335
  let l = a.candidates[0];
1331
- d(a.why === "kinds" ? zr(P, a.nouns, a.candidates) : Rr(P, a.nouns[0] ?? "", l?.label ?? e.request.name, a.candidates), {
1336
+ d(a.why === "kinds" ? qr(P, a.nouns, a.candidates) : Kr(P, a.nouns[0] ?? "", l?.label ?? e.request.name, a.candidates), {
1332
1337
  kind: "choose-destination",
1333
1338
  candidateIds: a.candidates.map((e) => e.id)
1334
- }, (e) => ti(e, a.candidates));
1339
+ }, (e) => li(e, a.candidates));
1335
1340
  })().catch(() => void 0), !0;
1336
1341
  }
1337
1342
  if (e.kind === "back") {
1338
- let e = _i.top();
1343
+ let e = Ti.top();
1339
1344
  if (!e) return !1;
1340
- let t = Tr(Y.current.navItems), n = xi(t, e.fromPath);
1345
+ let t = Nr(Y.current.navItems), n = ki(t, e.fromPath);
1341
1346
  return f({
1342
1347
  target: e.fromPath,
1343
1348
  destinationId: n?.id ?? "",
@@ -1345,27 +1350,27 @@ var na = () => () => {}, ra = () => "off", ia = ({ visible: ia = !0, writeAccess
1345
1350
  via: "back",
1346
1351
  pageLabel: () => n?.label ?? null,
1347
1352
  onArrived: () => {
1348
- _i.top() === e && _i.pop();
1353
+ Ti.top() === e && Ti.pop();
1349
1354
  }
1350
1355
  });
1351
1356
  }
1352
1357
  let ee, m = e.destination;
1353
1358
  if (e.via === "offer") {
1354
- let t = tc(e.offerId, e.destination.label);
1355
- if (!t.ok) return d(t.copy ?? Pr(P), {
1359
+ let t = lc(e.offerId, e.destination.label);
1360
+ if (!t.ok) return d(t.copy ?? Hr(P), {
1356
1361
  kind: "write-reply",
1357
1362
  line: t.reason === "unavailable" ? "offer.notAvailable" : "offer.expired"
1358
1363
  });
1359
1364
  ee = {
1360
1365
  trigger: e.trigger,
1361
1366
  offerId: e.offerId
1362
- }, m = Tr(Y.current.navItems).find((e) => e.id === t.target.id) ?? {
1367
+ }, m = Nr(Y.current.navItems).find((e) => e.id === t.target.id) ?? {
1363
1368
  id: t.target.id,
1364
1369
  label: t.target.label,
1365
1370
  path: t.target.path
1366
1371
  };
1367
1372
  }
1368
- return Sr(m, window.location.pathname + window.location.search, Tr(Y.current.navItems)) ? d(Mr(P, m.label, !0), bi({
1373
+ return Ar(m, window.location.pathname + window.location.search, Nr(Y.current.navItems)) ? d(Br(P, m.label, !0), Oi({
1369
1374
  destinationId: m.id,
1370
1375
  path: m.path,
1371
1376
  alreadyHere: !0,
@@ -1382,54 +1387,54 @@ var na = () => () => {}, ra = () => "off", ia = ({ visible: ia = !0, writeAccess
1382
1387
  });
1383
1388
  }, [
1384
1389
  U,
1385
- Qo,
1386
- dc,
1387
- Cc,
1388
- Ws,
1390
+ os,
1391
+ yc,
1392
+ jc,
1393
+ Qs,
1389
1394
  B,
1390
- Ha,
1391
- js,
1392
- wc,
1393
- Ns,
1394
- Us,
1395
- Ds,
1395
+ Xa,
1396
+ zs,
1397
+ Mc,
1398
+ Vs,
1399
+ Zs,
1400
+ Fs,
1396
1401
  P,
1397
- tc,
1398
- rc,
1399
- Qs
1400
- ]), Ec = D(async (e) => {
1401
- Po.current = !0, Io(!0);
1402
+ lc,
1403
+ dc,
1404
+ oc
1405
+ ]), Pc = D(async (e) => {
1406
+ Ho.current = !0, Wo(!0);
1402
1407
  try {
1403
1408
  await K.declineForReply(e.conversationId, e.reason, e.origin);
1404
1409
  } finally {
1405
- Po.current = !1, X.current && Io(!1);
1410
+ Ho.current = !1, X.current && Wo(!1);
1406
1411
  }
1407
1412
  if (e.commandText !== null) {
1408
- let t = mc(e.commandText, e.options.voiceSessionId);
1409
- if (t && Tc(t, e.content, e.options.voiceSessionId)) return;
1413
+ let t = Sc(e.commandText, e.options.voiceSessionId);
1414
+ if (t && Nc(t, e.content, e.options.voiceSessionId)) return;
1410
1415
  }
1411
- await Ac.current(e.content, e.attachments, e.options);
1416
+ await Rc.current(e.content, e.attachments, e.options);
1412
1417
  }, [
1413
- mc,
1414
- Tc,
1418
+ Sc,
1419
+ Nc,
1415
1420
  K
1416
1421
  ]), Q = D(async (n, r = [], i = {}) => {
1417
- let a = i.voiceSessionId !== void 0, o = w.getState(), s = !1, c = qo.current;
1418
- if (a && tr(c)) {
1419
- let e = or(c, o.activeConversationId, ts());
1422
+ let a = i.voiceSessionId !== void 0, o = w.getState(), s = !1, c = ts.current;
1423
+ if (a && lr(c)) {
1424
+ let e = mr(c, o.activeConversationId, ls());
1420
1425
  if (e.kind === "gone") return;
1421
1426
  let t = i.voiceEntry ?? e;
1422
- t.kind === "adopt" && Qo(t.conversationId), s = t.kind === "own", i = {
1427
+ t.kind === "adopt" && os(t.conversationId), s = t.kind === "own", i = {
1423
1428
  ...i,
1424
1429
  voiceEntry: t
1425
1430
  };
1426
1431
  }
1427
1432
  let l = s ? null : o.activeConversationId, u = s ? null : o.activeConversationId ?? V;
1428
1433
  if (u) {
1429
- if (Sn(o.processingByConversationId[u]?.status)) {
1434
+ if (Tn(o.processingByConversationId[u]?.status)) {
1430
1435
  if (i.avatarTabAsk !== void 0) return;
1431
1436
  let e = o.processingByConversationId[u]?.messageId ?? null;
1432
- e && i.correctsInFlightTurn === !0 && !bs.current.has(e) && Cs(), e && bs.current.has(e) && (xs.current = {
1437
+ e && i.correctsInFlightTurn === !0 && !Os.current.has(e) && js(), e && Os.current.has(e) && (ks.current = {
1433
1438
  conversationId: u,
1434
1439
  content: n,
1435
1440
  attachments: r,
@@ -1437,40 +1442,40 @@ var na = () => () => {}, ra = () => "off", ia = ({ visible: ia = !0, writeAccess
1437
1442
  });
1438
1443
  return;
1439
1444
  }
1440
- if (as.current.has(u)) return;
1445
+ if (ps.current.has(u)) return;
1441
1446
  }
1442
- if (No.current || fr() !== null || Po.current || Gs.current !== null) return;
1443
- let d = i.targetConversationId, f = Ni(), p = (e) => Oi(e) || Di(e, f);
1447
+ if (Vo.current || br() !== null || Ho.current || $s.current !== null) return;
1448
+ let d = i.targetConversationId, f = Vi(), p = (e) => Ii(e) || Fi(e, f);
1444
1449
  if (d !== void 0) {
1445
1450
  let e = o.conversations.find((e) => e.id === d);
1446
1451
  if (o.activeConversationId !== d || !e || e.mode !== o.mode || p(e)) return;
1447
1452
  }
1448
1453
  if (i.avatarTabAsk !== void 0) {
1449
1454
  let e = l ? o.conversations.find((e) => e.id === l) : void 0, t = e && !p(e) ? e : void 0;
1450
- if (C({
1451
- auto: o.autoRouting && Mo.current && d === void 0,
1455
+ if (Ge({
1456
+ auto: o.autoRouting && Bo.current && d === void 0,
1452
1457
  selectedMode: o.mode,
1453
1458
  conversation: t ? {
1454
1459
  mode: t.mode,
1455
1460
  routedBy: t.routedBy,
1456
- hasHistory: Ei(t)
1461
+ hasHistory: Pi(t)
1457
1462
  } : null,
1458
- modeWrites: (e) => wo.current.find((t) => t.id === e)?.writeCapable === !0 || mt(e)
1463
+ modeWrites: (e) => Mo.current.find((t) => t.id === e)?.writeCapable === !0 || pt(e)
1459
1464
  }) !== null) return;
1460
1465
  }
1461
1466
  if (i.fromPerson && i.writeReplyBound === void 0) {
1462
- let e = d ?? l ?? null, t = i.voiceSessionId === void 0 ? "typed" : "spoken", a = vc(e, i.voiceSessionId), o = se({
1467
+ let e = d ?? l ?? null, t = i.voiceSessionId === void 0 ? "typed" : "spoken", a = Ec(e, i.voiceSessionId), o = se({
1463
1468
  text: n,
1464
- locale: t === "spoken" ? Aa.input.code : B,
1469
+ locale: t === "spoken" ? Ra.input.code : B,
1465
1470
  origin: t,
1466
1471
  hasAttachments: r.length > 0 || i.focus !== void 0,
1467
1472
  live: K.liveFor(e),
1468
- matchesLocalCommand: (e) => mc(e, i.voiceSessionId) !== null,
1473
+ matchesLocalCommand: (e) => Sc(e, i.voiceSessionId) !== null,
1469
1474
  offer: a.state,
1470
- offerAssent: a.state !== "none" && Vr({
1475
+ offerAssent: a.state !== "none" && Yr({
1471
1476
  text: n,
1472
1477
  uiLocale: B,
1473
- inputLocale: Aa.input.code,
1478
+ inputLocale: Ra.input.code,
1474
1479
  commandLocales: Y.current.options.commandLocales,
1475
1480
  manifest: Y.current.options.commandManifest,
1476
1481
  leaveGuard: Y.current.options.leaveGuard
@@ -1478,14 +1483,14 @@ var na = () => () => {}, ra = () => "off", ia = ({ visible: ia = !0, writeAccess
1478
1483
  });
1479
1484
  if (o.kind === "accept_offer") {
1480
1485
  let e = a.accept;
1481
- if (e && Tc({
1486
+ if (e && Nc({
1482
1487
  kind: "navigate",
1483
1488
  destination: e.destination,
1484
1489
  via: "offer",
1485
1490
  offerId: e.offerId,
1486
1491
  trigger: "yes"
1487
1492
  }, n, i.voiceSessionId, s, i.avatarTabAsk)) {
1488
- Ms(i.avatarTabAsk);
1493
+ Bs(i.avatarTabAsk);
1489
1494
  return;
1490
1495
  }
1491
1496
  o = {
@@ -1502,11 +1507,11 @@ var na = () => () => {}, ra = () => "off", ia = ({ visible: ia = !0, writeAccess
1502
1507
  };
1503
1508
  }
1504
1509
  if (o.kind === "local_reply") {
1505
- e && yc(e, n, o.line, o.values, i.voiceSessionId, i.avatarTabAsk);
1510
+ e && Dc(e, n, o.line, o.values, i.voiceSessionId, i.avatarTabAsk);
1506
1511
  return;
1507
1512
  }
1508
1513
  let c = o.kind === "local" ? o.fallback : o.bound, u = o.declineAll;
1509
- if (u !== null && e) return i.avatarTabAsk === void 0 ? Ec({
1514
+ if (u !== null && e) return i.avatarTabAsk === void 0 ? Pc({
1510
1515
  conversationId: e,
1511
1516
  reason: u,
1512
1517
  origin: t,
@@ -1525,52 +1530,52 @@ var na = () => () => {}, ra = () => "off", ia = ({ visible: ia = !0, writeAccess
1525
1530
  }
1526
1531
  let ee = i.writeReplyBound?.promptText ?? n;
1527
1532
  if (i.fromPerson && r.length === 0 && i.focus === void 0 && i.writeReplyBound?.localCommands !== !1) {
1528
- let e = mc(n, i.voiceSessionId, i.localRecordsChecked === !0);
1529
- if (e && Tc(e, n, i.voiceSessionId, s, i.avatarTabAsk)) {
1530
- Ms(i.avatarTabAsk);
1533
+ let e = Sc(n, i.voiceSessionId, i.localRecordsChecked === !0);
1534
+ if (e && Nc(e, n, i.voiceSessionId, s, i.avatarTabAsk)) {
1535
+ Bs(i.avatarTabAsk);
1531
1536
  return;
1532
1537
  }
1533
1538
  }
1534
- let m = l ? o.conversations.find((e) => e.id === l) : void 0, h = p(m) ? void 0 : m, g = o.autoRouting && Mo.current && d === void 0 ? pe({
1539
+ let m = l ? o.conversations.find((e) => e.id === l) : void 0, h = p(m) ? void 0 : m, g = o.autoRouting && Bo.current && d === void 0 ? pe({
1535
1540
  intent: i.avatarTabAsk === void 0 ? i.autoIntent ?? ue(n) : "read",
1536
1541
  dictated: a,
1537
- voiceProposalBound: a && ba("api-calls") && Ln(o.acknowledgedWriteModes, "api-calls"),
1542
+ voiceProposalBound: a && Oa("api-calls") && Gn(o.acknowledgedWriteModes, "api-calls"),
1538
1543
  conversation: h ? {
1539
1544
  mode: h.mode,
1540
1545
  routedBy: h.routedBy,
1541
- hasHistory: Ei(h)
1546
+ hasHistory: Pi(h)
1542
1547
  } : null
1543
1548
  }) : null;
1544
- if (g && wo.current.find((e) => e.id === g.mode)?.writeCapable && !Ln(o.acknowledgedWriteModes, g.mode)) {
1545
- No.current = {
1549
+ if (g && Mo.current.find((e) => e.id === g.mode)?.writeCapable && !Gn(o.acknowledgedWriteModes, g.mode)) {
1550
+ Vo.current = {
1546
1551
  content: n,
1547
1552
  attachments: r,
1548
1553
  options: i
1549
- }, zo(g.mode);
1554
+ }, qo(g.mode);
1550
1555
  return;
1551
1556
  }
1552
1557
  let _ = g ? g.mode : o.mode, te, ne, v = d ?? (s ? null : V), re = v ? w.getState().conversations.find((e) => e.id === v) : void 0, ie = g?.action === "escalate" && h ? {
1553
1558
  mode: h.mode,
1554
1559
  backendSessionId: h.backendSessionId ?? null
1555
1560
  } : null;
1556
- if (g) g.action === "new" || !h ? v = za(void 0, _, { routedBy: "auto" }) : (v = h.id, $a(v, _));
1561
+ if (g) g.action === "new" || !h ? v = qa(void 0, _, { routedBy: "auto" }) : (v = h.id, so(v, _));
1557
1562
  else {
1558
1563
  let e = o.autoRouting ? { routedBy: "auto" } : void 0;
1559
- !v || p(re) || re && re.mode !== _ && Ei(re) ? v = za(void 0, _, e) : re && re.mode !== _ && (e ? $a(v, _) : La(v, _));
1564
+ !v || p(re) || re && re.mode !== _ && Pi(re) ? v = qa(void 0, _, e) : re && re.mode !== _ && (e ? so(v, _) : Ga(v, _));
1560
1565
  }
1561
1566
  if (!v) return;
1562
- a && qo.current !== void 0 && v !== o.activeConversationId && Qo(v), i.approvalFollowUp || (ns.current[v] = r);
1567
+ a && ts.current !== void 0 && v !== o.activeConversationId && os(v), i.approvalFollowUp || (us.current[v] = r);
1563
1568
  let ae = () => w.getState().conversations.some((e) => e.id === v), y = T(), b = {
1564
- accessToken: xa(),
1565
- workspaceToken: Sa(),
1569
+ accessToken: ka(),
1570
+ workspaceToken: Aa(),
1566
1571
  userId: z,
1567
- organizationId: Lt()
1572
+ organizationId: Rt()
1568
1573
  }, le = (e, t) => {
1569
1574
  !ae() && y && it(e, y, t, _, {
1570
- accessToken: xa(),
1571
- workspaceToken: Sa(),
1575
+ accessToken: ka(),
1576
+ workspaceToken: Aa(),
1572
1577
  userId: z,
1573
- organizationId: Lt()
1578
+ organizationId: Rt()
1574
1579
  });
1575
1580
  }, fe = {
1576
1581
  id: N(),
@@ -1578,17 +1583,17 @@ var na = () => () => {}, ra = () => "off", ia = ({ visible: ia = !0, writeAccess
1578
1583
  content: n,
1579
1584
  timestamp: (/* @__PURE__ */ new Date()).toISOString(),
1580
1585
  metadata: {
1581
- ...r.length ? { attachments: r.map(pn) } : {},
1586
+ ...r.length ? { attachments: r.map(hn) } : {},
1582
1587
  ...i.focus ? { askAbout: i.focus } : {},
1583
1588
  ...i.approvalFollowUp ? {
1584
1589
  approvalFollowUp: !0,
1585
1590
  approvedReplyId: i.approvalFollowUp.approvedReplyId
1586
1591
  } : {},
1587
- ...Qn(i.voiceSessionId)
1592
+ ...or(i.voiceSessionId)
1588
1593
  }
1589
1594
  };
1590
1595
  U(v, fe);
1591
- let me = i.fromPerson === !0 && r.length === 0 && i.focus === void 0 && i.approvalFollowUp === void 0 && ee === n ? pi(n, a ? Aa.input.code : B) : null, he = {
1596
+ let me = i.fromPerson === !0 && r.length === 0 && i.focus === void 0 && i.approvalFollowUp === void 0 && ee === n ? xi(n, a ? Ra.input.code : B) : null, he = {
1592
1597
  location: window.location.pathname + window.location.search,
1593
1598
  conversationId: w.getState().activeConversationId,
1594
1599
  workspaceId: T(),
@@ -1600,38 +1605,38 @@ var na = () => () => {}, ra = () => "off", ia = ({ visible: ia = !0, writeAccess
1600
1605
  content: "",
1601
1606
  timestamp: (/* @__PURE__ */ new Date()).toISOString(),
1602
1607
  metadata: {
1603
- lang: Na,
1604
- ...Qn(i.voiceSessionId)
1608
+ lang: Va,
1609
+ ...or(i.voiceSessionId)
1605
1610
  }
1606
- }), tn(x, {
1611
+ }), rn(x, {
1607
1612
  channel: a ? "voice" : "chat",
1608
1613
  mode: _,
1609
1614
  product: I,
1610
- language: Na,
1611
- device: rn(),
1615
+ language: Va,
1616
+ device: on(),
1612
1617
  routedByAuto: !!g
1613
- }, i.voiceTiming), E(x, "accepted"), Ua(v, "provisioning", x, null), pr(x), i.avatarTabAsk !== void 0 && Ns(i.avatarTabAsk, {
1618
+ }, i.voiceTiming), E(x, "accepted"), Za(v, "provisioning", x, null), xr(x), i.avatarTabAsk !== void 0 && Vs(i.avatarTabAsk, {
1614
1619
  conversationId: v,
1615
1620
  questionId: fe.id,
1616
1621
  replyId: x
1617
1622
  });
1618
1623
  let ge = () => {
1619
- let e = Cn({
1624
+ let e = En({
1620
1625
  turnId: x,
1621
- abortRequested: bs.current.has(x),
1626
+ abortRequested: Os.current.has(x),
1622
1627
  activeTurnId: w.getState().processingByConversationId[v]?.messageId ?? null,
1623
1628
  conversationExists: ae()
1624
1629
  });
1625
1630
  return e.abandon && ye(), e;
1626
- }, _e = (e, t, n, r, a = !1, o = Na) => {
1627
- Va(v, x, { content: wt(e) }), Ha(v, x, {
1631
+ }, _e = (e, t, n, r, a = !1, o = Va) => {
1632
+ Ya(v, x, { content: Ct(e) }), Xa(v, x, {
1628
1633
  lang: o,
1629
1634
  ...t?.length ? { artifacts: t } : {},
1630
1635
  ...t?.length || n || r ? { mode: _ } : {},
1631
1636
  ...n ? { sessionId: n } : {},
1632
1637
  ...r ? { sandboxId: r } : {},
1633
1638
  ...a ? { incomplete: !0 } : {},
1634
- ...Qn(i.voiceSessionId)
1639
+ ...or(i.voiceSessionId)
1635
1640
  });
1636
1641
  }, ve = { session: null }, S = {
1637
1642
  speech: null,
@@ -1642,224 +1647,230 @@ var na = () => () => {}, ra = () => "off", ia = ({ visible: ia = !0, writeAccess
1642
1647
  }, be = () => {
1643
1648
  ye(), S.stream?.close(), S.stream = null, S.render = null;
1644
1649
  }, xe = !1, Se = (e = !1) => {
1645
- xe && (xe = !1, Dt.abort(x, e));
1646
- }, Ce = new e(), we = () => {}, Te = async (e = 1) => {
1650
+ xe && (xe = !1, Et.abort(x, e));
1651
+ }, Ce = new e(), we = () => {}, Te = async (e = 1, o = !1) => {
1647
1652
  E(x, "attemptStarted");
1648
- let o = null, s = null, c = !1;
1653
+ let s = null, c = null, l = !1;
1649
1654
  try {
1650
- let { sandboxId: e, sessionId: l, sessionIsNew: u, readAhead: d, sandboxIsNew: f, sandboxProbed: p, sandboxAdopted: m, deadSandboxProbe: h, sessionPreopened: g } = await fs(v, x, _, y, b, { isAbandoned: () => Cn({
1651
- turnId: x,
1652
- abortRequested: bs.current.has(x),
1653
- activeTurnId: w.getState().processingByConversationId[v]?.messageId ?? null,
1654
- conversationExists: ae()
1655
- }).abandon });
1656
- if (o = e, we(), we = t(e, () => {
1657
- bs.current.add(x), At(x), Dt.abort(x);
1658
- }), E(x, "runtimeReady"), nn(x, {
1659
- runtime: f ? "cold" : m ? "adopted" : p ? "probed" : g ? "preopened" : u ? "new-session" : "warm",
1660
- deadSandboxProbe: h
1661
- }), nn(x, { session: g ? "preopened" : u ? "created" : "reused" }), s = l, ve.session = {
1655
+ let { sandboxId: e, sessionId: u, sessionIsNew: d, readAhead: f, sandboxIsNew: p, sandboxProbed: m, sandboxAdopted: h, deadSandboxProbe: g, sessionPreopened: re, knownFloor: ie } = await bs(v, x, _, y, b, {
1656
+ isAbandoned: () => En({
1657
+ turnId: x,
1658
+ abortRequested: Os.current.has(x),
1659
+ activeTurnId: w.getState().processingByConversationId[v]?.messageId ?? null,
1660
+ conversationExists: ae()
1661
+ }).abandon,
1662
+ ...o ? { verifySession: !0 } : {}
1663
+ });
1664
+ if (s = e, we(), we = t(e, () => {
1665
+ Os.current.add(x), kt(x), Et.abort(x);
1666
+ }), E(x, "runtimeReady"), an(x, {
1667
+ runtime: p ? "cold" : h ? "adopted" : m ? "probed" : re ? "preopened" : d ? "new-session" : "warm",
1668
+ deadSandboxProbe: g
1669
+ }), an(x, { session: re ? "preopened" : d ? "created" : "reused" }), c = u, ve.session = {
1662
1670
  sandboxId: e,
1663
- sessionId: l
1671
+ sessionId: u
1664
1672
  }, F) {
1665
1673
  let e = ge();
1666
1674
  if (e.abandon) {
1667
- e.clearProcessing && Wa(v);
1675
+ e.clearProcessing && Qa(v);
1668
1676
  return;
1669
1677
  }
1670
1678
  }
1671
- if (Rn(_, te, w.getState().acknowledgedWriteModes, {
1679
+ if (Kn(_, te, w.getState().acknowledgedWriteModes, {
1672
1680
  dictated: a,
1673
- confirmsWrites: mt(_),
1674
- proposalBound: ba(_, e)
1675
- }) === "voice-in-write-mode") throw new Bt("voice-in-write-mode", "Voice in a write mode");
1676
- let re = Ai({
1681
+ confirmsWrites: pt(_),
1682
+ proposalBound: Oa(_, e)
1683
+ }) === "voice-in-write-mode") throw new Vt("voice-in-write-mode", "Voice in a write mode");
1684
+ let se = Ri({
1677
1685
  conversation: w.getState().conversations.find((e) => e.id === v),
1678
1686
  content: n,
1679
- sessionIsNew: u,
1687
+ sessionIsNew: d,
1680
1688
  sendingMode: _,
1681
1689
  sendingModeConfig: te,
1682
- modes: wo.current,
1690
+ modes: Mo.current,
1683
1691
  answerText: (e) => qe(e).text
1684
1692
  });
1685
- if (be(), Fn()) {
1686
- let t = Pn({
1687
- mint: () => pt(e, y, l, _, b),
1693
+ if (be(), Un()) {
1694
+ let t = Hn({
1695
+ mint: () => ft(e, y, u, _, b),
1688
1696
  mark: (e) => E(x, e)
1689
1697
  });
1690
- S.stream = t, An() && i.voiceSessionId !== void 0 && !ne.accumulatesNarration && (S.speech = jn({
1698
+ S.stream = t, Rn() && i.voiceSessionId !== void 0 && !ne.accumulatesNarration && (S.speech = zn({
1691
1699
  append: (e, t) => {
1692
- ge().abandon || (E(x, "speechQueued"), xe = !0, Dt.append(x, {
1700
+ ge().abandon || (E(x, "speechQueued"), xe = !0, Et.append(x, {
1693
1701
  conversationId: v,
1694
1702
  channel: "voice",
1695
1703
  voiceSessionId: i.voiceSessionId,
1696
1704
  text: t,
1697
- lang: Na,
1705
+ lang: Va,
1698
1706
  final: !1
1699
1707
  }, e));
1700
1708
  },
1701
- retract: () => Dt.retract(x)
1702
- })), S.render = Mn({
1709
+ retract: () => Et.retract(x)
1710
+ })), S.render = Bn({
1703
1711
  onLiveState: (e, t) => S.speech?.invalidate(e, t),
1704
1712
  onRendered: (e, t, n) => S.speech?.update(e, t, n),
1705
1713
  stream: t,
1706
1714
  conversationId: v,
1707
1715
  messageId: x,
1708
- build: (e, t) => wt(Mt(e, t, { accumulateNarration: ne.accumulatesNarration }).content),
1716
+ build: (e, t) => Ct(jt(e, t, { accumulateNarration: ne.accumulatesNarration }).content),
1709
1717
  onFirstDelta: () => E(x, "firstDelta"),
1710
1718
  onFirstVisible: () => E(x, "firstOutput")
1711
1719
  });
1712
1720
  }
1713
- let ie = await Pt(() => dt(e, y, l, _, b, { limit: 50 }), u, Nt(d, e, l));
1714
- us(v, x, "streaming", "thinking");
1715
- let se = ha?.(), ue = ce(w.getState().sandboxWriteCapabilities[e]), de = Y.current, pe = si(e, l), Se = de.options.uiCatalogue ? ii(Tr(de.navItems), {
1716
- permissionsSettled: de.navPermissionsSettled,
1717
- simulating: de.navSimulating,
1718
- sentBefore: oi(pe)
1719
- }) : null, Te = w.getState().sandboxWriteCapabilities[e]?.clientTools === !0 ? Ct({ writeCapable: te?.writeCapable === !0 || _ === "api-calls" }) : null, Ee = Te?.manifest ?? [], De = {
1721
+ let ue = ie ?? await Pt(() => ut(e, y, u, _, b, { limit: 50 }), d, Mt(f, e, u));
1722
+ vs(v, x, "streaming", "thinking");
1723
+ let de = Ca?.(), pe = ce(w.getState().sandboxWriteCapabilities[e]), Se = Y.current, Te = hi(e, u), Ee = Se.options.uiCatalogue ? fi(Nr(Se.navItems), {
1724
+ permissionsSettled: Se.navPermissionsSettled,
1725
+ simulating: Se.navSimulating,
1726
+ sentBefore: mi(Te)
1727
+ }) : null, De = w.getState().sandboxWriteCapabilities[e]?.clientTools === !0 ? St({ writeCapable: te?.writeCapable === !0 || _ === "api-calls" }) : null, Oe = De?.manifest ?? [], ke = {
1720
1728
  conversationId: v,
1721
- writeReply: ue === "proposal-v1" ? i.writeReplyBound?.writeReply ?? null : null,
1722
- ...Se ? { uiCatalogue: Se } : {},
1723
- ...Ee.length > 0 ? { clientTools: Ee } : {}
1724
- }, { prompt: Oe, parts: ke } = mn({
1725
- content: Ui(re ? `${re}${ee}` : ee, i.focus),
1729
+ writeReply: pe === "proposal-v1" ? i.writeReplyBound?.writeReply ?? null : null,
1730
+ ...Ee ? { uiCatalogue: Ee } : {},
1731
+ ...Oe.length > 0 ? { clientTools: Oe } : {}
1732
+ }, { prompt: Ae, parts: je } = gn({
1733
+ content: Zi(se ? `${se}${ee}` : ee, i.focus),
1726
1734
  attachments: r,
1727
- limits: fn(te),
1728
- wrapPrompt: (e) => ga?.(_, e, ja, Ma, a, { writeApproval: ue }) ?? e,
1729
- requestBytes: (t, n) => gt({
1735
+ limits: mn(te),
1736
+ wrapPrompt: (e) => wa?.(_, e, za, Ba, a, { writeApproval: pe }) ?? e,
1737
+ requestBytes: (t, n) => ht({
1730
1738
  sandboxId: e,
1731
1739
  workspaceId: y,
1732
- sessionId: l,
1740
+ sessionId: u,
1733
1741
  mode: _,
1734
1742
  prompt: t,
1735
1743
  parts: n,
1736
- pageContext: se,
1744
+ pageContext: de,
1737
1745
  authContext: b,
1738
- ...De
1746
+ ...ke
1739
1747
  })
1740
- }), Ae = un(ke), je = Ae > 0;
1741
- c = ln(r) > Ae;
1742
- let Me = ge();
1743
- if (Me.abandon) {
1744
- Me.clearProcessing && Wa(v);
1748
+ }), Me = fn(je), Ne = Me > 0;
1749
+ l = dn(r) > Me;
1750
+ let Pe = ge();
1751
+ if (Pe.abandon) {
1752
+ Pe.clearProcessing && Qa(v);
1745
1753
  return;
1746
1754
  }
1747
- let Ne = (t) => Ce.dispatch({
1748
- prompt: Oe,
1755
+ let Fe = (t) => Ce.dispatch({
1756
+ prompt: Ae,
1749
1757
  isAbandoned: () => ge().abandon,
1750
- readMessages: (t) => dt(e, y, l, _, b, { sinceMs: t }),
1751
- send: () => vt(e, y, l, Oe, _, se, b, t?.length ? {
1758
+ readMessages: (t) => ut(e, y, u, _, b, { sinceMs: t }),
1759
+ send: () => _t(e, y, u, Ae, _, de, b, t?.length ? {
1752
1760
  parts: t,
1753
- ...De
1754
- } : De)
1761
+ ...ke
1762
+ } : ke)
1755
1763
  });
1756
1764
  try {
1757
- await Ne(ke);
1765
+ await Fe(je);
1758
1766
  } catch (e) {
1759
- if (!Ce.canFailover() || !ke || !bn(e)) throw e;
1760
- await Ne(void 0), c ||= je;
1767
+ if (ie !== null && !o && Pn(e)) throw new Nn();
1768
+ if (!Ce.canFailover() || !je || !Cn(e)) throw e;
1769
+ await Fe(void 0), l ||= Ne;
1761
1770
  }
1762
- Se && ai(pe);
1763
- let Pe = w.getState().sandboxWriteCapabilities[e], Fe = de.options.uiOffers === !0 && ui(Pe) ? z : null, Ie = !!Fe;
1764
- Fe && Z.recordTurn({
1771
+ Ee && pi(Te);
1772
+ let Ie = w.getState().sandboxWriteCapabilities[e], Le = Se.options.uiOffers === !0 && vi(Ie) ? z : null, Re = !!Le;
1773
+ Le && Z.recordTurn({
1765
1774
  replyId: x,
1766
1775
  conversationId: v,
1767
1776
  sandboxId: e,
1768
- sessionId: l,
1777
+ sessionId: u,
1769
1778
  mode: _,
1770
1779
  writeCapable: te?.writeCapable === !0,
1771
- actorId: Fe,
1772
- floorMs: ie
1780
+ actorId: Le,
1781
+ floorMs: ue
1773
1782
  });
1774
- let Le = Te && Ee.length > 0 ? St({
1775
- tools: Te.tools,
1776
- post: (t, n) => ht(e, y, l, t, n, _, b)
1777
- }) : null, Re = Le ? (e) => Le.receive(e) : void 0, ze = Ie ? (e, t) => {
1778
- Z.receive(x, e, t, performance.now()) && Qs();
1779
- } : void 0, Be = (e) => Va(v, x, { content: e }), Ve = (e) => c ? `${e}\n\n${P("attachments.imagesNotSent", "_Your photo was too large to include with this message, so the answer above is from the text and the file link only. Try a smaller or more tightly cropped photo._")}` : e;
1783
+ let ze = De && Oe.length > 0 ? xt({
1784
+ tools: De.tools,
1785
+ post: (t, n) => mt(e, y, u, t, n, _, b)
1786
+ }) : null, Be = ze ? (e) => ze.receive(e) : void 0, Ve = Re ? (e, t) => {
1787
+ Z.receive(x, e, t, performance.now()) && oc();
1788
+ } : void 0, He = (e) => Ya(v, x, { content: e }), Ue = (e) => l ? `${e}\n\n${P("attachments.imagesNotSent", "_Your photo was too large to include with this message, so the answer above is from the text and the file link only. Try a smaller or more tightly cropped photo._")}` : e;
1780
1789
  E(x, "promptSent");
1781
- let He = null, Ue = !1, We = jt, C = Mt([], ie);
1782
- S.render?.arm(ie);
1783
- let Ge = Date.now() + ne.streamBudgetMs, Ke = Date.now(), Je = Date.now(), Ye, Xe = Tt(), Ze = (e) => {
1784
- Ye = e;
1785
- }, Qe = Nn(() => dt(e, y, l, _, b, {
1790
+ let We = null, Ge = !1, Ke = At, C = jt([], ue);
1791
+ S.render?.arm(ue);
1792
+ let Je = Date.now() + ne.streamBudgetMs, Ye = Date.now(), Xe = Date.now(), Ze, Qe = wt(), $e = (e) => {
1793
+ Ze = e;
1794
+ }, et = Vn(() => ut(e, y, u, _, b, {
1786
1795
  limit: 50,
1787
- sinceMs: ie,
1796
+ sinceMs: ue,
1788
1797
  surfaceTurnTerminal: !0,
1789
- surfaceUiOffers: ze,
1790
- surfaceClientToolRequests: Re,
1791
- surfaceSessionBusy: Ze
1792
- })), $e = S.stream?.onIdle(() => Qe.startExtra());
1798
+ surfaceUiOffers: Ve,
1799
+ surfaceClientToolRequests: Be,
1800
+ surfaceSessionBusy: $e
1801
+ })), tt = S.stream?.onIdle(() => et.startExtra());
1793
1802
  try {
1794
- for (; Date.now() < Ge;) {
1795
- le(e, l);
1803
+ for (; Date.now() < Je;) {
1804
+ le(e, u);
1796
1805
  let t = ge();
1797
1806
  if (t.abandon) {
1798
- t.clearProcessing && Wa(v);
1807
+ t.clearProcessing && Qa(v);
1799
1808
  return;
1800
1809
  }
1801
- let n = await Qe.next();
1802
- Ie && Z.observeMessages(x, n) && Qs(), C = Mt(n, ie, { accumulateNarration: ne.accumulatesNarration });
1803
- let r = Et(Xe, C.done, Ye, Date.now());
1804
- if (r !== C.done && (C = {
1810
+ let n = Date.now(), r = await et.next();
1811
+ Re && Z.observeMessages(x, r) && oc(), C = jt(r, ue, { accumulateNarration: ne.accumulatesNarration });
1812
+ let i = Tt(Qe, C.done, Ze, Date.now());
1813
+ if (i !== C.done && (C = {
1805
1814
  ...C,
1806
- done: r
1807
- }), Va(v, x, { content: wt(C.content) }), C.hasRenderableOutput ? Ue || (Ue = !0, He !== null && E(x, "lastQuietPoll", He), E(x, "firstOutput")) : He = on(), ne.accumulatesNarration) C.hasText && E(x, "firstText");
1815
+ done: i
1816
+ }), Ya(v, x, { content: Ct(C.content) }), C.hasRenderableOutput ? Ge || (Ge = !0, We !== null && E(x, "lastQuietPoll", We), E(x, "firstOutput")) : We = cn(), ne.accumulatesNarration) C.hasText && E(x, "firstText");
1808
1817
  else {
1809
- let e = It(We, C, on());
1810
- We = e.tracker, e.confirmedAt !== null && E(x, "firstText", e.confirmedAt);
1818
+ let e = Lt(Ke, C, cn());
1819
+ Ke = e.tracker, e.confirmedAt !== null && E(x, "firstText", e.confirmedAt);
1811
1820
  }
1812
- if (C.pendingWrite && !oe(w.getState().sandboxWriteCapabilities[e]) && Ha(v, x, { pendingWrite: C.pendingWrite }), C.done && (S.stream ? nn(x, {
1821
+ if (C.pendingWrite && !oe(w.getState().sandboxWriteCapabilities[e]) && Xa(v, x, { pendingWrite: C.pendingWrite }), C.done && (S.stream ? an(x, {
1813
1822
  transport: S.stream.reachedOpen ? "sse" : "poll",
1814
- live: kn(S.stream.live)
1815
- }) : nn(x, {
1823
+ live: Ln(S.stream.live)
1824
+ }) : an(x, {
1816
1825
  transport: "poll",
1817
1826
  live: "none"
1818
1827
  }), ye()), C.done) {
1819
- E(x, "answerDone"), rs.current.markVerified(e);
1828
+ E(x, "answerDone"), ds.current.markVerified(e), ne.continuesInBackground || Nt(e, u, r);
1820
1829
  break;
1821
1830
  }
1822
- if (S.render?.refresh(n), Date.now() - Ke > 3e4 && (await ct(e, y, 600, b).catch(() => void 0), Ke = Date.now()), !Qe.hasPending()) {
1823
- let e = On(Date.now() - Je);
1831
+ if (S.render?.refresh(r), Date.now() - Ye > 3e4 && (In(e, y, b), Ye = Date.now()), !et.hasPending()) {
1832
+ let e = Math.max(0, jn(Date.now() - Xe) - (Date.now() - n));
1824
1833
  S.stream ? await S.stream.waitWake(e) : await new Promise((t) => setTimeout(t, e));
1825
1834
  }
1826
1835
  }
1827
1836
  } finally {
1828
- Le?.dispose();
1837
+ ze?.dispose();
1829
1838
  }
1830
- if ($e?.(), be(), C.done || (nn(x, { outcome: "timedOut" }), C = {
1839
+ if (tt?.(), be(), C.done || (an(x, { outcome: "timedOut" }), C = {
1831
1840
  ...C,
1832
- content: In(C.content, _, P, te)
1841
+ content: Wn(C.content, _, P, te)
1833
1842
  }), (C.done || xe) && i.voiceSessionId !== void 0 && !ge().abandon) {
1834
- let e = wt(Ve(C.content));
1835
- (e.trim() || xe) && ((c || !C.done) && Be(e), E(x, "speechQueued"), xe = !0, Dt.publish(x, {
1843
+ let e = Ct(Ue(C.content));
1844
+ (e.trim() || xe) && ((l || !C.done) && He(e), E(x, "speechQueued"), xe = !0, Et.publish(x, {
1836
1845
  conversationId: v,
1837
1846
  channel: "voice",
1838
1847
  voiceSessionId: i.voiceSessionId,
1839
1848
  text: e,
1840
- lang: Na,
1849
+ lang: Va,
1841
1850
  final: !0
1842
1851
  }));
1843
1852
  }
1844
- let et = ne.producesArtifacts ? await ut(e, y, l, _, b).then((e) => e).catch(() => []) : void 0;
1845
- C.usedTools !== void 0 && nn(x, { usedTools: C.usedTools }), c && (C = {
1853
+ let nt = ne.producesArtifacts ? await lt(e, y, u, _, b).then((e) => e).catch(() => []) : void 0;
1854
+ C.usedTools !== void 0 && an(x, { usedTools: C.usedTools }), l && (C = {
1846
1855
  ...C,
1847
- content: Ve(C.content)
1856
+ content: Ue(C.content)
1848
1857
  });
1849
- let tt = !C.done;
1850
- _e(C.content, et, l, e, tt), C.tokens && (Va(v, x, { tokens: C.tokens }), (va ? await _n({
1858
+ let rt = !C.done;
1859
+ _e(C.content, nt, u, e, rt), C.tokens && (Ya(v, x, { tokens: C.tokens }), Ea && yn({
1851
1860
  workspaceId: y,
1852
- sessionId: l,
1861
+ sessionId: u,
1853
1862
  messageId: C.messageId,
1854
1863
  model: C.model,
1855
1864
  tokens: C.tokens
1856
- }, va, { ledger: hn("panel", I) }) : { ok: !0 }).ok && zt(I)), C.done || le(e, l);
1857
- let nt = ge();
1858
- if (nt.abandon) {
1859
- nt.clearProcessing && Wa(v);
1865
+ }, Ea, { ledger: _n("panel", I) }).then((e) => {
1866
+ e.ok && Bt(I);
1867
+ })), C.done || le(e, u);
1868
+ let it = ge();
1869
+ if (it.abandon) {
1870
+ it.clearProcessing && Qa(v);
1860
1871
  return;
1861
1872
  }
1862
- E(x, "complete"), nn(x, { outcome: "answered" }), Ua(v, "complete", x, null), Ti.recordCommittedEntries(v, [fe.id, x], "TURN", y), xe = !1, Ie && me && C.done && cc({
1873
+ E(x, "complete"), an(x, { outcome: "answered" }), Za(v, "complete", x, null), Ni.recordCommittedEntries(v, [fe.id, x], "TURN", y), xe = !1, Re && me && C.done && gc({
1863
1874
  replyId: x,
1864
1875
  conversationId: v,
1865
1876
  voiceSessionId: i.voiceSessionId,
@@ -1867,136 +1878,140 @@ var na = () => () => {}, ra = () => "off", ia = ({ visible: ia = !0, writeAccess
1867
1878
  atSend: he
1868
1879
  });
1869
1880
  } catch (t) {
1870
- rs.current.invalidate(o ?? w.getState().sandboxesByMode[_]?.sandboxId ?? null);
1871
- let n = Cn({
1881
+ let n = t instanceof Nn;
1882
+ n || ds.current.invalidate(s ?? w.getState().sandboxesByMode[_]?.sandboxId ?? null);
1883
+ let r = En({
1872
1884
  turnId: x,
1873
- abortRequested: bs.current.has(x),
1885
+ abortRequested: Os.current.has(x),
1874
1886
  activeTurnId: w.getState().processingByConversationId[v]?.messageId ?? null,
1875
1887
  conversationExists: ae()
1876
1888
  });
1877
- if (ye(), o && s && le(o, s), n.abandon) {
1878
- n.clearProcessing && Wa(v);
1889
+ if (ye(), s && c && le(s, c), r.abandon) {
1890
+ r.clearProcessing && Qa(v);
1879
1891
  return;
1880
1892
  }
1881
- if (e === 1 && Ce.canFailover() && xn(t)) {
1893
+ if (n) return we(), eo(v), be(), sn(x), Te(e, !0);
1894
+ if (e === 1 && Ce.canFailover() && wn(t)) {
1882
1895
  we();
1883
- let e = o ?? w.getState().sandboxesByMode[_]?.sandboxId ?? null;
1884
- return e && (is.current.add(e), rs.current.invalidate(e)), Ka(v), Ja(_), Ba(v, x, ""), Ha(v, x, { pendingWrite: void 0 }), e && K.retireSandbox(e), be(), Se(!0), an(x), Te(2);
1896
+ let e = s ?? w.getState().sandboxesByMode[_]?.sandboxId ?? null;
1897
+ return e && (fs.current.add(e), ds.current.invalidate(e)), eo(v), no(_), Ja(v, x, ""), Xa(v, x, { pendingWrite: void 0 }), e && K.retireSandbox(e), be(), Se(!0), sn(x), Te(2);
1885
1898
  }
1886
1899
  throw t;
1887
1900
  }
1888
1901
  }, Ee = v;
1889
- as.current.add(Ee);
1902
+ ps.current.add(Ee);
1903
+ let De = Mn();
1904
+ Fn();
1890
1905
  try {
1891
1906
  if (!y) throw Object.assign(/* @__PURE__ */ Error("Assistant backend is unavailable without an active workspace context."), { extensions: {
1892
1907
  code: "UNAUTHENTICATED",
1893
1908
  authFailure: "WORKSPACE_CONTEXT_MISSING"
1894
1909
  } });
1895
- let e = await Bn(_, () => wo.current.find((e) => e.id === _), Co);
1910
+ let e = await Jn(_, () => Mo.current.find((e) => e.id === _), jo);
1896
1911
  te = e.config, ne = e.capabilities;
1897
1912
  let t = te, n = ge();
1898
1913
  if (n.abandon) {
1899
- n.clearProcessing && Wa(v);
1914
+ n.clearProcessing && Qa(v);
1900
1915
  return;
1901
1916
  }
1902
- let r = Rn(_, t, w.getState().acknowledgedWriteModes, {
1917
+ let r = Kn(_, t, w.getState().acknowledgedWriteModes, {
1903
1918
  dictated: a,
1904
- confirmsWrites: mt(_),
1905
- proposalBound: ba(_)
1919
+ confirmsWrites: pt(_),
1920
+ proposalBound: Oa(_)
1906
1921
  });
1907
- if (r) throw new Bt(r, r === "confirm-write-mode" ? "Write mode not confirmed" : "Voice in a write mode");
1908
- let i = hn("panel", I);
1909
- if (va && gn(i, y)) {
1910
- let e = await vn(i, y, va);
1911
- if (!e.ok) throw yn(e.kind);
1922
+ if (r) throw new Vt(r, r === "confirm-write-mode" ? "Write mode not confirmed" : "Voice in a write mode");
1923
+ let i = _n("panel", I);
1924
+ if (Ea && await xn(i, y), Ea && vn(i, y)) {
1925
+ let e = await bn(i, y, Ea);
1926
+ if (!e.ok) throw Sn(e.kind);
1912
1927
  let t = ge();
1913
1928
  if (t.abandon) {
1914
- t.clearProcessing && Wa(v);
1929
+ t.clearProcessing && Qa(v);
1915
1930
  return;
1916
1931
  }
1917
1932
  }
1918
1933
  E(x, "cleared"), await Te();
1919
1934
  } catch (e) {
1920
- if (rs.current.invalidate(w.getState().sandboxesByMode[_]?.sandboxId ?? null), !ae()) {
1921
- Wa(v);
1935
+ if (ds.current.invalidate(w.getState().sandboxesByMode[_]?.sandboxId ?? null), !ae()) {
1936
+ Qa(v);
1922
1937
  return;
1923
1938
  }
1924
- let t = ve.session?.sandboxId ?? null, n = Vt(e, { confirmsNoAction: Ht({
1939
+ let t = ve.session?.sandboxId ?? null, n = Ht(e, { confirmsNoAction: Ut({
1925
1940
  mode: _,
1926
1941
  capabilities: t ? w.getState().sandboxWriteCapabilities[t] : null
1927
1942
  }) });
1928
- nn(x, { outcome: n.kind === "temporary" ? "failed" : "refused" }), n.offersUpgrade && Rt(I, "sandbox");
1929
- let r = Ut(n, P, { locale: B });
1930
- Ua(v, "error", x, r.headline), Va(v, x, { content: r.text }), Ha(v, x, {
1943
+ an(x, { outcome: n.kind === "temporary" ? "failed" : "refused" }), n.offersUpgrade && zt(I, "sandbox");
1944
+ let r = Wt(n, P, { locale: B });
1945
+ Za(v, "error", x, r.headline), Ya(v, x, { content: r.text }), Xa(v, x, {
1931
1946
  lang: r.translated ? B : "en",
1932
- ...Qn(i.voiceSessionId)
1947
+ ...or(i.voiceSessionId)
1933
1948
  });
1934
1949
  } finally {
1935
- we(), as.current.delete(Ee), nn(x, { outcome: "stopped" }), E(x, "complete"), Se(), be();
1950
+ we(), ps.current.delete(Ee), an(x, { outcome: "stopped" }), E(x, "complete"), Se(), be();
1936
1951
  let e = w.getState(), t = de(ie, _, e.conversations.find((e) => e.id === Ee), (t) => !!e.sandboxesByMode[t]?.sandboxId);
1937
- t && ($a(Ee, t.mode), t.backendSessionId && Ga(Ee, t.backendSessionId)), ve.session && ae() && K.afterTurn({
1952
+ t && (so(Ee, t.mode), t.backendSessionId && $a(Ee, t.backendSessionId)), ve.session && ae() && K.afterTurn({
1938
1953
  ...ve.session,
1939
1954
  conversationId: Ee
1940
1955
  }, x);
1941
- let n = xs.current;
1942
- xs.current = null, n && n.conversationId === Ee && ae() && Ac.current(n.content, n.attachments, n.options);
1956
+ let n = ks.current;
1957
+ ks.current = null, n && n.conversationId === Ee && ae() && Rc.current(n.content, n.attachments, n.options), De();
1943
1958
  }
1944
1959
  }, [
1945
1960
  V,
1946
1961
  U,
1947
- ga,
1948
- Ka,
1949
- Ja,
1950
- Pa,
1951
- za,
1952
- fs,
1962
+ wa,
1963
+ eo,
1964
+ no,
1965
+ Ha,
1966
+ qa,
1967
+ bs,
1953
1968
  K,
1954
- Cs,
1955
- yc,
1956
- Ec,
1969
+ js,
1970
+ Dc,
1971
+ Pc,
1957
1972
  B,
1973
+ Ra,
1974
+ Oa,
1975
+ Ca,
1976
+ ka,
1958
1977
  Aa,
1959
- ba,
1960
- ha,
1961
- xa,
1962
- Sa,
1963
- Va,
1978
+ Ya,
1964
1979
  I,
1965
- Co,
1966
- va,
1967
- Ma,
1980
+ jo,
1981
+ Ea,
1982
+ Ba,
1968
1983
  B,
1969
- Na,
1970
- ja,
1984
+ Va,
1985
+ za,
1986
+ so,
1987
+ Nc,
1988
+ Sc,
1989
+ os,
1990
+ ls,
1971
1991
  $a,
1972
- Tc,
1973
- mc,
1974
- Qo,
1975
- ts,
1976
1992
  Ga,
1977
- La,
1978
- Ua,
1979
- Wa,
1993
+ Za,
1994
+ Qa,
1980
1995
  P,
1981
- us,
1982
- Ba,
1996
+ vs,
1997
+ Ja,
1983
1998
  z,
1984
1999
  Z,
1985
- Qs,
1986
- vc,
1987
- cc,
1988
- Ns,
1989
- Ms,
2000
+ oc,
2001
+ Ec,
2002
+ gc,
2003
+ Vs,
2004
+ Bs,
1990
2005
  F
1991
- ]), Dc = D((e, t) => {
2006
+ ]), Fc = D((e, t) => {
1992
2007
  Q(e, [], t ? { autoIntent: t } : {});
1993
- }, [Q]), Oc = Ze(), kc = D(() => {
1994
- let e = [...eo.chat].reverse().find((e) => e.role === "user" && !e.metadata?.localAction);
2008
+ }, [Q]), Ic = Ze(), Lc = D(() => {
2009
+ let e = [...co.chat].reverse().find((e) => e.role === "user" && !e.metadata?.localAction);
1995
2010
  if (!e || e.metadata?.approvalFollowUp) return;
1996
- let t = V ? ns.current[V] ?? [] : [], n = Hi(e.metadata?.askAbout) ?? void 0, r = n ? { focus: n } : {};
2011
+ let t = V ? us.current[V] ?? [] : [], n = Xi(e.metadata?.askAbout) ?? void 0, r = n ? { focus: n } : {};
1997
2012
  if (t.some((e) => et(e, Date.now()))) {
1998
2013
  let n = V ?? void 0;
1999
- tt(t, Oc).then((t) => {
2014
+ tt(t, Ic).then((t) => {
2000
2015
  Q(e.content, t, {
2001
2016
  ...n === void 0 ? {} : { targetConversationId: n },
2002
2017
  ...r
@@ -2004,138 +2019,138 @@ var na = () => () => {}, ra = () => "off", ia = ({ visible: ia = !0, writeAccess
2004
2019
  });
2005
2020
  } else Q(e.content, t, r);
2006
2021
  }, [
2007
- to,
2022
+ lo,
2008
2023
  Q,
2009
2024
  V,
2010
- Oc
2011
- ]), Ac = A(Q);
2025
+ Ic
2026
+ ]), Rc = A(Q);
2012
2027
  O(() => {
2013
- Ac.current = Q;
2028
+ Rc.current = Q;
2014
2029
  }, [Q]);
2015
- let jc = k(() => {
2016
- if (no) return null;
2017
- for (let e = to.length - 1; e >= 0; --e) {
2018
- let t = to[e];
2030
+ let zc = k(() => {
2031
+ if (uo) return null;
2032
+ for (let e = lo.length - 1; e >= 0; --e) {
2033
+ let t = lo[e];
2019
2034
  if (t?.role !== "assistant") continue;
2020
- if (t.id === Bs) return null;
2021
- if (!Zn(t) || bs.current.has(t.id) || kt(t.id)) continue;
2022
- let n = Vn(t, G, P);
2035
+ if (t.id === Js) return null;
2036
+ if (!ar(t) || Os.current.has(t.id) || Ot(t.id)) continue;
2037
+ let n = Yn(t, G, P);
2023
2038
  if (n.kind !== "output") return null;
2024
2039
  let r = qe(n.text).text.trim();
2025
- return r ? lr(t, r, G) : null;
2040
+ return r ? _r(t, r, G) : null;
2026
2041
  }
2027
2042
  return null;
2028
2043
  }, [
2029
- to,
2030
- no,
2044
+ lo,
2045
+ uo,
2031
2046
  G,
2032
- Bs,
2047
+ Js,
2033
2048
  P
2034
- ]), Mc = k(() => jc ? Gn(jc.text) : null, [jc]), Nc = k(() => eo.chat.filter((e) => e.id !== Bs), [eo.chat, Bs]), Pc = w((e) => rt(e)?.sandboxId ?? null), Fc = hr(Nc, {
2049
+ ]), Bc = k(() => zc ? $n(zc.text) : null, [zc]), Vc = k(() => co.chat.filter((e) => e.id !== Js), [co.chat, Js]), Hc = w((e) => rt(e)?.sandboxId ?? null), Uc = Cr(Vc, {
2035
2050
  sessionId: W?.backendSessionId,
2036
- sandboxId: Pc,
2051
+ sandboxId: Hc,
2037
2052
  nowMs: Date.now()
2038
- }), Ic = gr(Nc), Lc = (e) => {
2053
+ }), Wc = wr(Vc), Gc = (e) => {
2039
2054
  if (ae(e.metadata).length > 0) return !0;
2040
2055
  let t = e.metadata?.sandboxId;
2041
- return oe(t ? ao[t] : null);
2042
- }, Rc = (e) => {
2056
+ return oe(t ? mo[t] : null);
2057
+ }, Kc = (e) => {
2043
2058
  let t = ae(e.metadata);
2044
2059
  return t.length === 0 || !V ? null : /* @__PURE__ */ M(d, {
2045
2060
  refs: t,
2046
2061
  conversationId: V,
2047
2062
  panel: K,
2048
- entries: oo,
2049
- capabilitiesOf: (e) => ao[e],
2050
- turnInFlight: no,
2063
+ entries: ho,
2064
+ capabilitiesOf: (e) => mo[e],
2065
+ turnInFlight: uo,
2051
2066
  tr: P,
2052
- onReview: co.review,
2053
- retiredSandboxes: so,
2067
+ onReview: _o.review,
2068
+ retiredSandboxes: go,
2054
2069
  onReapply: () => void Q(P("writeProposal.reapplyPrompt", "That change wasn't saved because it changed after you read it. Fetch the latest version and reapply only your change on top of it."))
2055
2070
  });
2056
- }, zc = (e) => {
2071
+ }, qc = (e) => {
2057
2072
  if (!V) return null;
2058
2073
  let t = Z.liveOffersFor(e, {
2059
2074
  registry: {
2060
- destinations: Tr(Fs),
2061
- permissionsSettled: Is,
2062
- simulating: Ls
2075
+ destinations: Nr(Us),
2076
+ permissionsSettled: Ws,
2077
+ simulating: Gs
2063
2078
  },
2064
2079
  actorId: z,
2065
2080
  conversationId: V,
2066
2081
  perfNow: performance.now()
2067
2082
  }), n = t[0];
2068
- return n ? /* @__PURE__ */ M(gi, {
2083
+ return n ? /* @__PURE__ */ M(wi, {
2069
2084
  offers: t.map(({ offer: e, target: t }) => ({
2070
2085
  offerId: e.offerId,
2071
2086
  label: t.label,
2072
2087
  path: t.path
2073
2088
  })),
2074
- hint: t.length === 1 && R === "proposal-v1" ? di(n.offer, Z.turnFor(e)) : "link",
2075
- onOpen: sc
2089
+ hint: t.length === 1 && R === "proposal-v1" ? yi(n.offer, Z.turnFor(e)) : "link",
2090
+ onOpen: hc
2076
2091
  }, n.offer.offerId) : null;
2077
- }, Bc = (e) => e.role === "assistant" ? zc(e.id) : null;
2092
+ }, Jc = (e) => e.role === "assistant" ? qc(e.id) : null;
2078
2093
  O(() => {
2079
2094
  let e = Z.nextExpiryInMs(performance.now());
2080
2095
  if (e === null) return;
2081
- let t = window.setTimeout(Qs, e + 1);
2096
+ let t = window.setTimeout(oc, e + 1);
2082
2097
  return () => window.clearTimeout(t);
2083
2098
  }, [
2084
2099
  Z,
2085
- Xs,
2086
- Qs
2100
+ ic,
2101
+ oc
2087
2102
  ]);
2088
- let Vc = co.dialog.view ? oo[co.dialog.view.proposalId] : void 0, Hc = Fc?.expiresAtMs ?? null;
2103
+ let Yc = _o.dialog.view ? ho[_o.dialog.view.proposalId] : void 0, Xc = Uc?.expiresAtMs ?? null;
2089
2104
  O(() => {
2090
- if (Hc === null) return;
2091
- let e = window.setTimeout(() => ys((e) => e + 1), Math.max(0, Hc - Date.now()));
2105
+ if (Xc === null) return;
2106
+ let e = window.setTimeout(() => Ds((e) => e + 1), Math.max(0, Xc - Date.now()));
2092
2107
  return () => window.clearTimeout(e);
2093
- }, [Hc, vs]);
2094
- let Uc = k(() => eo.voice.filter((e) => e.id !== Bs && (e.role === "user" || e.role === "assistant")).map((e) => ({
2108
+ }, [Xc, Es]);
2109
+ let Zc = k(() => co.voice.filter((e) => e.id !== Js && (e.role === "user" || e.role === "assistant")).map((e) => ({
2095
2110
  id: e.id,
2096
2111
  role: e.role,
2097
- text: Wn(e, G, P),
2098
- sessionId: $n(e),
2112
+ text: Qn(e, G, P),
2113
+ sessionId: sr(e),
2099
2114
  timestamp: e.timestamp
2100
2115
  })).filter((e) => e.text.length > 0), [
2101
- eo.voice,
2116
+ co.voice,
2102
2117
  G,
2103
- Bs,
2118
+ Js,
2104
2119
  P
2105
- ]), Wc = D(() => {
2106
- if (Uc.length === 0) return;
2120
+ ]), Qc = D(() => {
2121
+ if (Zc.length === 0) return;
2107
2122
  let e = /* @__PURE__ */ new Date();
2108
- Yn(qn(Uc, {
2123
+ rr(tr(Zc, {
2109
2124
  title: P("voiceSession.transcript", "Voice conversation"),
2110
2125
  savedAt: P("voiceSession.savedAt", "Saved"),
2111
2126
  session: P("voiceSession.sessionLabel", "Session"),
2112
2127
  earlier: P("voiceSession.earlierLabel", "Earlier"),
2113
2128
  you: P("voiceSession.speakerYou", "You"),
2114
2129
  assistant: P("voiceSession.speakerAssistant", "Assistant")
2115
- }, e), Jn(I, e), "text/markdown");
2130
+ }, e), nr(I, e), "text/markdown");
2116
2131
  }, [
2117
2132
  I,
2118
- Uc,
2133
+ Zc,
2119
2134
  P
2120
- ]), Gc = Xe({ perFileChars: Lo }), Kc = A(Gc);
2121
- Kc.current = Gc;
2122
- let [qc, Jc] = j(null), Yc = qc === null ? null : P("attachments.voiceDropped", "{{count}} attachment(s) couldn't be saved and weren't sent.", { count: qc });
2135
+ ]), $c = Xe({ perFileChars: Go }), el = A($c);
2136
+ el.current = $c;
2137
+ let [tl, nl] = j(null), rl = tl === null ? null : P("attachments.voiceDropped", "{{count}} attachment(s) couldn't be saved and weren't sent.", { count: tl });
2123
2138
  O(() => {
2124
- if (qc === null) return;
2125
- let e = window.setTimeout(() => Jc(null), Zi);
2139
+ if (tl === null) return;
2140
+ let e = window.setTimeout(() => nl(null), aa);
2126
2141
  return () => window.clearTimeout(e);
2127
- }, [qc]);
2128
- let Xc = A(/* @__PURE__ */ new Set()), Zc = A(() => !1), Qc = D((e, t, n, r) => {
2129
- let i = qo.current, a = cr(i), o = () => {
2142
+ }, [tl]);
2143
+ let il = A(/* @__PURE__ */ new Set()), al = A(() => !1), ol = D((e, t, n, r) => {
2144
+ let i = ts.current, a = gr(i), o = () => {
2130
2145
  let e = w.getState();
2131
- return nr({
2132
- sessionLive: Zc.current(t),
2146
+ return ur({
2147
+ sessionLive: al.current(t),
2133
2148
  boundAtSubmit: i,
2134
2149
  activeConversationId: e.activeConversationId,
2135
2150
  boundConversationExists: e.conversations.some((e) => e.id === a)
2136
2151
  });
2137
2152
  }, s = () => {
2138
- let i = Kc.current;
2153
+ let i = el.current;
2139
2154
  $e({
2140
2155
  draft: i,
2141
2156
  maySend: o,
@@ -2143,128 +2158,128 @@ var na = () => () => {}, ra = () => "off", ia = ({ visible: ia = !0, writeAccess
2143
2158
  sendTurn: (i) => {
2144
2159
  let a = {
2145
2160
  ...n,
2146
- handedOver: on()
2161
+ handedOver: cn()
2147
2162
  };
2148
- Ac.current(e, i, {
2163
+ Rc.current(e, i, {
2149
2164
  fromPerson: !0,
2150
2165
  voiceSessionId: t,
2151
2166
  voiceTiming: a,
2152
2167
  ...r.correction ? { correctsInFlightTurn: !0 } : {}
2153
2168
  });
2154
2169
  },
2155
- announceDropped: (e) => Jc(e)
2170
+ announceDropped: (e) => nl(e)
2156
2171
  });
2157
2172
  };
2158
- if (o() && _c.current(e, t)) {
2159
- Ac.current(e, [], {
2173
+ if (o() && Tc.current(e, t)) {
2174
+ Rc.current(e, [], {
2160
2175
  fromPerson: !0,
2161
2176
  voiceSessionId: t,
2162
2177
  voiceTiming: {
2163
2178
  ...n,
2164
- handedOver: on()
2179
+ handedOver: cn()
2165
2180
  }
2166
2181
  });
2167
2182
  return;
2168
2183
  }
2169
- if (!Kc.current.isBusy) {
2184
+ if (!el.current.isBusy) {
2170
2185
  s();
2171
2186
  return;
2172
2187
  }
2173
- let c = Date.now(), l = Xc.current, u = window.setInterval(() => {
2174
- let e = Kc.current.isBusy;
2175
- Kc.current.isCommitting || e && Date.now() - c < Xi || (window.clearInterval(u), l.delete(u), s());
2188
+ let c = Date.now(), l = il.current, u = window.setInterval(() => {
2189
+ let e = el.current.isBusy;
2190
+ el.current.isCommitting || e && Date.now() - c < ia || (window.clearInterval(u), l.delete(u), s());
2176
2191
  }, 200);
2177
2192
  l.add(u);
2178
2193
  }, []), $ = Je({
2179
- onSubmit: Qc,
2180
- latestReply: jc,
2181
- language: o(Oa, B).tag,
2182
- graceMs: wa,
2183
- onSupersede: ws,
2184
- handsFreeStreamNoticeAccepted: Ea,
2185
- onAcceptHandsFreeStreamNotice: Da,
2186
- handsFreeInterrupt: Ta,
2187
- onBargeIn: Cs
2194
+ onSubmit: ol,
2195
+ latestReply: zc,
2196
+ language: o(Ia, B).tag,
2197
+ graceMs: Ma,
2198
+ onSupersede: Ms,
2199
+ handsFreeStreamNoticeAccepted: Pa,
2200
+ onAcceptHandsFreeStreamNotice: Fa,
2201
+ handsFreeInterrupt: Na,
2202
+ onBargeIn: js
2188
2203
  });
2189
- Zc.current = $.isCurrentSession;
2190
- let $c = Jo ? Uc.filter((e) => e.sessionId !== void 0 && $.isCurrentSession(e.sessionId)) : Uc, el = $.answerLocally;
2204
+ al.current = $.isCurrentSession;
2205
+ let sl = ns ? Zc.filter((e) => e.sessionId !== void 0 && $.isCurrentSession(e.sessionId)) : Zc, cl = $.answerLocally;
2191
2206
  O(() => {
2192
- bc.current = el;
2193
- }, [el]);
2194
- let tl = $.active, nl = k(() => v(Object.values(oo), V, so), [
2195
- oo,
2207
+ Oc.current = cl;
2208
+ }, [cl]);
2209
+ let ll = $.active, ul = k(() => v(Object.values(ho), V, go), [
2210
+ ho,
2196
2211
  V,
2197
- so
2198
- ]), [rl, il] = j(null);
2212
+ go
2213
+ ]), [dl, fl] = j(null);
2199
2214
  O(() => {
2200
- tl || il(null);
2201
- }, [tl]);
2202
- let al = co.review, ol = D(() => {
2203
- let e = nl[nl.length - 1];
2215
+ ll || fl(null);
2216
+ }, [ll]);
2217
+ let pl = _o.review, ml = D(() => {
2218
+ let e = ul[ul.length - 1];
2204
2219
  if (!e) return;
2205
2220
  let { view: t } = e;
2206
- f(t) && m(t, ao[e.session.sandboxId]).offerConfirm ? al(t) : il(t.proposalId);
2221
+ f(t) && m(t, mo[e.session.sandboxId]).offerConfirm ? pl(t) : fl(t.proposalId);
2207
2222
  }, [
2208
- nl,
2209
- ao,
2210
- al
2211
- ]), sl = tl ? _(nl) : null, cl = rl ? oo[rl] : void 0, ll = tl && cl && cl.session.conversationId === V ? {
2223
+ ul,
2224
+ mo,
2225
+ pl
2226
+ ]), hl = ll ? _(ul) : null, gl = dl ? ho[dl] : void 0, _l = ll && gl && gl.session.conversationId === V ? {
2212
2227
  content: /* @__PURE__ */ M(d, {
2213
2228
  refs: [{
2214
- proposalId: cl.view.proposalId,
2215
- sandboxId: cl.session.sandboxId,
2216
- sessionId: cl.session.sessionId
2229
+ proposalId: gl.view.proposalId,
2230
+ sandboxId: gl.session.sandboxId,
2231
+ sessionId: gl.session.sessionId
2217
2232
  }],
2218
- conversationId: cl.session.conversationId,
2233
+ conversationId: gl.session.conversationId,
2219
2234
  panel: K,
2220
- entries: oo,
2221
- capabilitiesOf: (e) => ao[e],
2222
- turnInFlight: no,
2235
+ entries: ho,
2236
+ capabilitiesOf: (e) => mo[e],
2237
+ turnInFlight: uo,
2223
2238
  tr: P,
2224
- onReview: al,
2225
- retiredSandboxes: so
2239
+ onReview: pl,
2240
+ retiredSandboxes: go
2226
2241
  }),
2227
2242
  closeLabel: re(P, h.trayClose),
2228
- onClose: () => il(null)
2229
- } : null, ul = co.asking, dl = uc?.asking === !0, fl = dc?.asking === !0, pl = Zr(), ml = $.holdListening, hl = k(() => tl || J ? null : { run: () => Ho ? { status: "already" } : (Ko(!0), { status: "done" }) }, [
2230
- tl,
2243
+ onClose: () => fl(null)
2244
+ } : null, vl = _o.asking, yl = vc?.asking === !0, bl = yc?.asking === !0, xl = ai(), Sl = $.holdListening, Cl = k(() => ll || J ? null : { run: () => Xo ? { status: "already" } : (es(!0), { status: "done" }) }, [
2245
+ ll,
2231
2246
  J,
2232
- Ho,
2233
- Ko
2247
+ Xo,
2248
+ es
2234
2249
  ]);
2235
- Yr("assistant.transcript", hl);
2236
- let gl = k(() => tl ? null : { run: () => {
2250
+ ri("assistant.transcript", Cl);
2251
+ let wl = k(() => ll ? null : { run: () => {
2237
2252
  let e = w.getState(), t = e.conversations.find((t) => t.id === e.activeConversationId);
2238
2253
  return t && t.messages.length === 0 ? { status: "already" } : (e.createConversation(), { status: "done" });
2239
- } }, [tl]);
2240
- Yr("assistant.conversation.new", gl), O(() => {
2241
- ml(tl && (ul || dl || fl || pl));
2254
+ } }, [ll]);
2255
+ ri("assistant.conversation.new", wl), O(() => {
2256
+ Sl(ll && (vl || yl || bl || xl));
2242
2257
  }, [
2243
- tl,
2244
- ul,
2245
- dl,
2246
- fl,
2247
- pl,
2248
- ml
2258
+ ll,
2259
+ vl,
2260
+ yl,
2261
+ bl,
2262
+ xl,
2263
+ Sl
2249
2264
  ]);
2250
- let _l = A(null), vl = $.announce;
2265
+ let Tl = A(null), El = $.announce;
2251
2266
  O(() => {
2252
- if (!tl) {
2253
- _l.current = null;
2267
+ if (!ll) {
2268
+ Tl.current = null;
2254
2269
  return;
2255
2270
  }
2256
- let e = _l.current;
2257
- if (e === null) _l.current = new Set(Object.keys(oo));
2258
- else for (let { view: t, session: n } of ne(nl, e)) {
2271
+ let e = Tl.current;
2272
+ if (e === null) Tl.current = new Set(Object.keys(ho));
2273
+ else for (let { view: t, session: n } of ne(ul, e)) {
2259
2274
  e.add(t.proposalId);
2260
- let r = ao[n.sandboxId];
2275
+ let r = mo[n.sandboxId];
2261
2276
  if (!g({
2262
2277
  mode: "api-calls",
2263
2278
  productWriteApproval: R,
2264
2279
  capabilities: r
2265
2280
  })) continue;
2266
2281
  let i = ie(t, m(t, r).offerConfirm, P), a = t.proposalId;
2267
- vl({
2282
+ El({
2268
2283
  id: `write-readback:${a}`,
2269
2284
  text: i.text,
2270
2285
  lang: i.translated ? B : "en",
@@ -2272,375 +2287,375 @@ var na = () => () => {}, ra = () => "off", ia = ({ visible: ia = !0, writeAccess
2272
2287
  });
2273
2288
  }
2274
2289
  }, [
2275
- tl,
2276
- nl,
2277
- oo,
2278
- ao,
2290
+ ll,
2291
+ ul,
2292
+ ho,
2293
+ mo,
2279
2294
  R,
2280
2295
  P,
2281
2296
  B,
2282
- vl,
2297
+ El,
2283
2298
  K
2284
2299
  ]);
2285
- let yl = A(!1);
2300
+ let Dl = A(!1);
2286
2301
  O(() => {
2287
- yl.current = $.active;
2288
- }, [$.active]), O(() => Pi((e) => {
2289
- if (!yl.current) return !1;
2290
- let t = qo.current;
2302
+ Dl.current = $.active;
2303
+ }, [$.active]), O(() => Hi((e) => {
2304
+ if (!Dl.current) return !1;
2305
+ let t = ts.current;
2291
2306
  return typeof t == "string" ? t === e : w.getState().activeConversationId === e;
2292
2307
  }), []);
2293
- let bl = $.start, xl = D(() => {
2294
- let e = w.getState().activeConversationId, t = ar(ts());
2295
- Qo(sr(t, e)), ps(!0, t.kind === "own"), bl();
2308
+ let Ol = $.start, kl = D(() => {
2309
+ let e = w.getState().activeConversationId, t = pr(ls());
2310
+ os(hr(t, e)), xs(!0, t.kind === "own"), Ol();
2296
2311
  }, [
2297
- Qo,
2298
- ps,
2299
- ts,
2300
- bl
2301
- ]), Sl = k(() => Un(W?.messages ?? []), [W?.messages]), Cl = Hn(eo.voice, G, P), wl = Hn(Sl, G, P) > 0, Tl = D(() => {
2312
+ os,
2313
+ xs,
2314
+ ls,
2315
+ Ol
2316
+ ]), Al = k(() => Zn(W?.messages ?? []), [W?.messages]), jl = Xn(co.voice, G, P), Ml = Xn(Al, G, P) > 0, Nl = D(() => {
2302
2317
  let e = w.getState().activeConversationId;
2303
- if (!e || Uc.length === 0) return;
2304
- let t = new Set(Sl.map((e) => e.id)), n = N();
2318
+ if (!e || Zc.length === 0) return;
2319
+ let t = new Set(Al.map((e) => e.id)), n = N();
2305
2320
  U(e, {
2306
2321
  id: n,
2307
2322
  role: "system",
2308
- content: Kn(Uc.filter((e) => t.has(e.id)), {
2323
+ content: er(Zc.filter((e) => t.has(e.id)), {
2309
2324
  intro: P("voiceSession.continuedIntro", "Continued from a voice conversation. You asked about:"),
2310
2325
  nothing: P("voiceSession.continuedNothing", "Continued from a voice conversation."),
2311
2326
  more: (e) => P("voiceSession.continuedMore", "…and {{count}} more", { count: e })
2312
2327
  }),
2313
2328
  timestamp: (/* @__PURE__ */ new Date()).toISOString(),
2314
- metadata: { continuedVoiceTurns: Cl }
2315
- }), Ti.recordCommittedEntries(e, [n], "NOTE", T()), Ko(!1), $.end(), Wo(), fa?.();
2329
+ metadata: { continuedVoiceTurns: jl }
2330
+ }), Ni.recordCommittedEntries(e, [n], "NOTE", T()), es(!1), $.end(), Qo(), ba?.();
2316
2331
  }, [
2317
- Uc,
2318
- Cl,
2319
- Sl,
2332
+ Zc,
2333
+ jl,
2334
+ Al,
2320
2335
  U,
2321
2336
  P,
2322
2337
  $,
2323
- Ko,
2324
- Wo,
2325
- fa
2326
- ]), El = A({
2338
+ es,
2339
+ Qo,
2340
+ ba
2341
+ ]), Pl = A({
2327
2342
  conversationId: null,
2328
2343
  count: 0
2329
2344
  });
2330
2345
  O(() => {
2331
- $.active && (El.current = {
2346
+ $.active && (Pl.current = {
2332
2347
  conversationId: V,
2333
- count: Cl
2348
+ count: jl
2334
2349
  });
2335
2350
  }, [$.active]);
2336
- let Dl = D(() => {
2337
- let e = El.current, t = e.conversationId === V ? e.count : 0, n = Cl > t;
2338
- $.end(), n && Ko(!0);
2351
+ let Fl = D(() => {
2352
+ let e = Pl.current, t = e.conversationId === V ? e.count : 0, n = jl > t;
2353
+ $.end(), n && es(!0);
2339
2354
  }, [
2340
2355
  V,
2341
- Cl,
2356
+ jl,
2342
2357
  $,
2343
- Ko
2358
+ es
2344
2359
  ]);
2345
2360
  O(() => {
2346
- ia && ls || !$.active || $.end();
2361
+ fa && _s || !$.active || $.end();
2347
2362
  }, [
2348
- ia,
2349
- ls,
2363
+ fa,
2364
+ _s,
2350
2365
  $
2351
2366
  ]);
2352
- let [Ol, kl] = j(ea), Al = He({
2367
+ let [Il, Ll] = j(ca), Rl = He({
2353
2368
  available: $.available,
2354
- allowedInMode: ls,
2355
- readOnly: fo,
2356
- busy: no || _s !== null || mo || Ks,
2357
- committing: Ol.committing,
2358
- dictating: Ol.dictating
2359
- }), jl = Ve();
2360
- Wi(() => {
2361
- ua?.({ live: $.active });
2362
- }, [ua, $.active]);
2363
- let Ml = A(!1), Nl = D(() => {
2364
- Ml.current = !0, da?.({ review: !0 });
2365
- }, [da]);
2369
+ allowedInMode: _s,
2370
+ readOnly: bo,
2371
+ busy: uo || Ts !== null || So || ec,
2372
+ committing: Il.committing,
2373
+ dictating: Il.dictating
2374
+ }), zl = Ve();
2375
+ Qi(() => {
2376
+ va?.({ live: $.active });
2377
+ }, [va, $.active]);
2378
+ let Bl = A(!1), Vl = D(() => {
2379
+ Bl.current = !0, ya?.({ review: !0 });
2380
+ }, [ya]);
2366
2381
  O(() => {
2367
- !ma && Ml.current && (Ml.current = !1, ke(Cu.current));
2368
- }, [ma]);
2369
- let Pl = $.active;
2382
+ !Sa && Bl.current && (Bl.current = !1, ke(ju.current));
2383
+ }, [Sa]);
2384
+ let Hl = $.active;
2370
2385
  O(() => {
2371
- if (!Pl) es.current = !1, $o.current = null;
2372
- else if (Jo) {
2373
- let e = qo.current;
2374
- tr(e) && ($o.current = e.openAtStart), es.current = !0;
2375
- } else es.current && (es.current = !1, F && De({
2386
+ if (!Hl) cs.current = !1, ss.current = null;
2387
+ else if (ns) {
2388
+ let e = ts.current;
2389
+ lr(e) && (ss.current = e.openAtStart), cs.current = !0;
2390
+ } else cs.current && (cs.current = !1, F && De({
2376
2391
  pending: "own",
2377
- openAtStart: $o.current
2378
- }, qo.current) && Zo(!0));
2392
+ openAtStart: ss.current
2393
+ }, ts.current) && as(!0));
2379
2394
  }, [
2380
- Jo,
2381
- Pl,
2395
+ ns,
2396
+ Hl,
2382
2397
  F
2383
- ]), Xo && !$.active && Zo(!1);
2384
- let [Fl, Il] = j(null);
2398
+ ]), is && !$.active && as(!1);
2399
+ let [Ul, Wl] = j(null);
2385
2400
  O(() => {
2386
- Fl !== null && (J && Fl.conversationId === V || Il(null));
2401
+ Ul !== null && (J && Ul.conversationId === V || Wl(null));
2387
2402
  }, [
2388
2403
  J,
2389
2404
  V,
2390
- Fl
2405
+ Ul
2391
2406
  ]);
2392
- let Ll = Fl !== null && Os === Fl.replyId, Rl = A(!1), zl = D(() => {
2393
- Rl.current = !0, Ll && ks(), xl();
2407
+ let Gl = Ul !== null && Is === Ul.replyId, Kl = A(!1), ql = D(() => {
2408
+ Kl.current = !0, Gl && Ls(), kl();
2394
2409
  }, [
2395
- xl,
2396
- Ll,
2397
- ks
2398
- ]), Bl = D(() => {
2399
- Ll && ks(), xl();
2410
+ kl,
2411
+ Gl,
2412
+ Ls
2413
+ ]), Jl = D(() => {
2414
+ Gl && Ls(), kl();
2400
2415
  }, [
2401
- xl,
2402
- Ll,
2403
- ks
2416
+ kl,
2417
+ Gl,
2418
+ Ls
2404
2419
  ]);
2405
2420
  O(() => {
2406
- $.active || (Rl.current = !1);
2421
+ $.active || (Kl.current = !1);
2407
2422
  }, [$.active]), O(() => {
2408
- !J && Rl.current && (Rl.current = !1, $.active && Dl());
2423
+ !J && Kl.current && (Kl.current = !1, $.active && Fl());
2409
2424
  }, [
2410
2425
  J,
2411
2426
  $.active,
2412
- Dl
2427
+ Fl
2413
2428
  ]), O(() => {
2414
- J && Ko(!1);
2415
- }, [J, Ko]);
2416
- let Vl = k(() => ({
2429
+ J && es(!1);
2430
+ }, [J, es]);
2431
+ let Yl = k(() => ({
2417
2432
  live: $.active,
2418
- blocked: Al === null ? null : jl.voiceStartBlocked(Al),
2419
- impossible: Ue(Al),
2420
- start: F ? Bl : zl
2433
+ blocked: Rl === null ? null : zl.voiceStartBlocked(Rl),
2434
+ impossible: Ue(Rl),
2435
+ start: F ? Jl : ql
2421
2436
  }), [
2422
2437
  $.active,
2423
- Al,
2424
- jl,
2438
+ Rl,
2439
+ zl,
2425
2440
  F,
2426
- Bl,
2427
- zl
2428
- ]), [Hl, Ul] = j("mini"), [Wl, Gl] = j(!1), Kl = ma && $.active && (Wl || J);
2429
- Kl !== Wl && Gl(Kl);
2430
- let ql = F && $.active && !J && (!ma || Wl), Jl = ia && q.covered !== !0 && !($.active && Hl !== "mini") && !(Ho && !$.active) && !(ul || dl || fl || pl), Yl = Uo?.ask, Xl = Gi(Yl?.subscribe ?? na, Yl?.getSnapshot ?? ra, Yl?.getSnapshot ?? ra), Zl = We({
2441
+ Jl,
2442
+ ql
2443
+ ]), [Xl, Zl] = j("mini"), [Ql, $l] = j(!1), eu = Sa && $.active && (Ql || J);
2444
+ eu !== Ql && $l(eu);
2445
+ let tu = F && $.active && !J && (!Sa || Ql), nu = fa && q.covered !== !0 && !($.active && Xl !== "mini") && !(Xo && !$.active) && !(vl || yl || bl || xl), ru = Zo?.ask, iu = $i(ru?.subscribe ?? ua, ru?.getSnapshot ?? da, ru?.getSnapshot ?? da), au = We({
2431
2446
  voiceLive: $.active,
2432
- readOnly: fo,
2433
- writes: C({
2434
- auto: jo,
2447
+ readOnly: bo,
2448
+ writes: Ge({
2449
+ auto: zo,
2435
2450
  selectedMode: H,
2436
- conversation: W && !fo ? {
2451
+ conversation: W && !bo ? {
2437
2452
  mode: W.mode,
2438
2453
  routedBy: W.routedBy,
2439
- hasHistory: Ei(W)
2454
+ hasHistory: Pi(W)
2440
2455
  } : null,
2441
- modeWrites: (e) => L.find((t) => t.id === e)?.writeCapable === !0 || mt(e)
2456
+ modeWrites: (e) => L.find((t) => t.id === e)?.writeCapable === !0 || pt(e)
2442
2457
  }),
2443
- avatar: Xl,
2444
- busy: no || _s !== null || mo || Ks || Ro !== null || Fo,
2445
- committing: Ol.committing
2446
- }), Ql = A(Zl);
2447
- Wi(() => {
2448
- Ql.current = Zl;
2449
- }, [Zl]);
2450
- let $l = D((e) => {
2458
+ avatar: iu,
2459
+ busy: uo || Ts !== null || So || ec || Ko !== null || Uo,
2460
+ committing: Il.committing
2461
+ }), ou = A(au);
2462
+ Qi(() => {
2463
+ ou.current = au;
2464
+ }, [au]);
2465
+ let su = D((e) => {
2451
2466
  let t = e.trim();
2452
- if (t === "" || Ql.current !== null) return { accepted: !1 };
2453
- Ll && ks();
2467
+ if (t === "" || ou.current !== null) return { accepted: !1 };
2468
+ Gl && Ls();
2454
2469
  let n = {
2455
2470
  token: N(),
2456
2471
  exchange: null,
2457
2472
  handled: !1
2458
2473
  };
2459
- As.current = n;
2474
+ Rs.current = n;
2460
2475
  try {
2461
2476
  Q(t, [], {
2462
2477
  fromPerson: !0,
2463
2478
  avatarTabAsk: n.token,
2464
2479
  localRecordsChecked: !0,
2465
- ...jo ? { autoIntent: "read" } : {}
2480
+ ...zo ? { autoIntent: "read" } : {}
2466
2481
  });
2467
2482
  } finally {
2468
- As.current = null;
2483
+ Rs.current = null;
2469
2484
  }
2470
2485
  let r = n.exchange;
2471
2486
  return r === null ? n.handled ? {
2472
2487
  accepted: !0,
2473
2488
  recorded: !1
2474
- } : { accepted: !1 } : (Il(r), {
2489
+ } : { accepted: !1 } : (Wl(r), {
2475
2490
  accepted: !0,
2476
2491
  recorded: !0,
2477
2492
  ...r
2478
2493
  });
2479
2494
  }, [
2480
- jo,
2495
+ zo,
2481
2496
  Q,
2482
- ks,
2483
- Ll
2484
- ]), [eu] = j(() => Ke()), tu = k(() => ({
2485
- blocker: Zl,
2486
- line: Ge(Zl, Al),
2487
- send: $l,
2488
- last: Fl,
2489
- navigatingReplyId: Js,
2490
- draft: eu
2497
+ Ls,
2498
+ Gl
2499
+ ]), [cu] = j(() => C()), lu = k(() => ({
2500
+ blocker: au,
2501
+ line: Ke(au, Rl),
2502
+ send: su,
2503
+ last: Ul,
2504
+ navigatingReplyId: nc,
2505
+ draft: cu
2491
2506
  }), [
2492
- Zl,
2493
- Al,
2494
- $l,
2495
- Fl,
2496
- Js,
2497
- eu
2498
- ]), nu = q.setReplyEscape, ru = J && Jl && Ll;
2507
+ au,
2508
+ Rl,
2509
+ su,
2510
+ Ul,
2511
+ nc,
2512
+ cu
2513
+ ]), uu = q.setReplyEscape, du = J && nu && Gl;
2499
2514
  O(() => {
2500
- if (nu && ru) return nu(ks), () => nu(null);
2515
+ if (uu && du) return uu(Ls), () => uu(null);
2501
2516
  }, [
2502
- nu,
2503
- ru,
2504
- ks
2517
+ uu,
2518
+ du,
2519
+ Ls
2505
2520
  ]), O(() => {
2506
- let e = qo.current, t = cr(e), n = w.getState(), r = ir({
2521
+ let e = ts.current, t = gr(e), n = w.getState(), r = fr({
2507
2522
  sessionLive: $.active,
2508
2523
  bound: e,
2509
2524
  activeConversationId: n.activeConversationId,
2510
2525
  boundConversationExists: n.conversations.some((e) => e.id === t)
2511
2526
  });
2512
- Qo(r.bound), r.end && $.end();
2527
+ os(r.bound), r.end && $.end();
2513
2528
  }, [
2514
2529
  $,
2515
2530
  V,
2516
- Pa,
2517
- Qo
2531
+ Ha,
2532
+ os
2518
2533
  ]);
2519
- let iu = A(er);
2534
+ let fu = A(cr);
2520
2535
  O(() => {
2521
- let e = rr(iu.current, {
2536
+ let e = dr(fu.current, {
2522
2537
  activeConversationId: V,
2523
- chatTurnCount: Nc.length,
2524
- voiceTurnCount: Uc.length,
2538
+ chatTurnCount: Vc.length,
2539
+ voiceTurnCount: Zc.length,
2525
2540
  sessionLive: $.active,
2526
- sessionBoundTo: qo.current,
2527
- turnInFlight: no
2541
+ sessionBoundTo: ts.current,
2542
+ turnInFlight: uo
2528
2543
  });
2529
- iu.current = e.state, e.open && Ko(!0);
2544
+ fu.current = e.state, e.open && es(!0);
2530
2545
  }, [
2531
2546
  V,
2532
- Nc.length,
2533
- Uc.length,
2547
+ Vc.length,
2548
+ Zc.length,
2534
2549
  $.active,
2535
- no,
2536
- Ko
2550
+ uo,
2551
+ es
2537
2552
  ]), O(() => {
2538
2553
  if (!$.active) {
2539
- Kc.current.clear(), Jc(null), xs.current = null;
2540
- for (let e of Xc.current) window.clearInterval(e);
2541
- Xc.current.clear();
2554
+ el.current.clear(), nl(null), ks.current = null;
2555
+ for (let e of il.current) window.clearInterval(e);
2556
+ il.current.clear();
2542
2557
  }
2543
2558
  }, [$.active]), O(() => {
2544
- let e = Xc.current;
2559
+ let e = il.current;
2545
2560
  return () => {
2546
2561
  for (let t of e) window.clearInterval(t);
2547
2562
  e.clear();
2548
2563
  };
2549
2564
  }, []), O(() => {
2550
2565
  let e = w.getState().consumePendingPrompt();
2551
- return e && Ac.current(e), w.subscribe((e, t) => {
2566
+ return e && Rc.current(e), w.subscribe((e, t) => {
2552
2567
  if (e.pendingPrompt && e.pendingPrompt !== t.pendingPrompt) {
2553
2568
  let e = w.getState().consumePendingPrompt();
2554
- e && Ac.current(e);
2569
+ e && Rc.current(e);
2555
2570
  }
2556
2571
  });
2557
2572
  }, []);
2558
- let au = D((e) => {
2573
+ let pu = D((e) => {
2559
2574
  let t = V ? w.getState().conversations.find((e) => e.id === V) : void 0;
2560
- if (t && t.mode !== e && K.withdraw(t.id, "mode_switched"), t && Ei(t)) {
2575
+ if (t && t.mode !== e && K.withdraw(t.id, "mode_switched"), t && Pi(t)) {
2561
2576
  if (t.mode !== e) {
2562
- let t = Ni(), n = w.getState().conversations.find((n) => n.mode === e && ki(n, t) && !w.getState().processingByConversationId[n.id]);
2563
- n ? Ra(n.id) : za(void 0, e);
2577
+ let t = Vi(), n = w.getState().conversations.find((n) => n.mode === e && Li(n, t) && !w.getState().processingByConversationId[n.id]);
2578
+ n ? Ka(n.id) : qa(void 0, e);
2564
2579
  }
2565
- } else V && La(V, e);
2580
+ } else V && Ga(V, e);
2566
2581
  let n = w.getState().activeConversationId;
2567
- n ? La(n, e) : Qa(!1), Ia(e);
2582
+ n ? Ga(n, e) : oo(!1), Wa(e);
2568
2583
  }, [
2569
2584
  V,
2570
- za,
2571
- Ra,
2572
- Qa,
2573
- La,
2574
- Ia,
2585
+ qa,
2586
+ Ka,
2587
+ oo,
2588
+ Ga,
2589
+ Wa,
2575
2590
  K
2576
- ]), ou = D(() => {
2591
+ ]), mu = D(() => {
2577
2592
  let e = w.getState(), t = e.activeConversationId ? e.conversations.find((t) => t.id === e.activeConversationId) : void 0;
2578
2593
  if (!t) {
2579
- Qa(!0), Ia(b);
2594
+ oo(!0), Wa(b);
2580
2595
  return;
2581
2596
  }
2582
2597
  if (t.routedBy === "auto") {
2583
- Qa(!0);
2598
+ oo(!0);
2584
2599
  return;
2585
2600
  }
2586
- if (!Ei(t)) {
2587
- $a(t.id, b);
2601
+ if (!Pi(t)) {
2602
+ so(t.id, b);
2588
2603
  return;
2589
2604
  }
2590
2605
  K.withdraw(t.id, "mode_switched");
2591
- let n = Ni(), r = e.conversations.find((t) => t.routedBy === "auto" && ki(t, n) && !e.processingByConversationId[t.id]);
2592
- r ? (Ra(r.id), $a(r.id, b)) : za(void 0, b, { routedBy: "auto" });
2606
+ let n = Vi(), r = e.conversations.find((t) => t.routedBy === "auto" && Li(t, n) && !e.processingByConversationId[t.id]);
2607
+ r ? (Ka(r.id), so(r.id, b)) : qa(void 0, b, { routedBy: "auto" });
2593
2608
  }, [
2594
- za,
2595
- $a,
2596
- Ra,
2597
- Qa,
2598
- Ia,
2609
+ qa,
2610
+ so,
2611
+ Ka,
2612
+ oo,
2613
+ Wa,
2599
2614
  K
2600
- ]), su = D((e) => {
2601
- L.find((t) => t.id === e)?.writeCapable && !Ln(w.getState().acknowledgedWriteModes, e) ? zo(e) : au(e);
2602
- }, [au, L]), cu = D(() => {
2603
- let e = Ro;
2604
- if (zo(null), !e) return;
2605
- let t = No.current;
2606
- No.current = null, t ? (Xa(e), Q(t.content, t.attachments, t.options)) : (Xa(e), au(e));
2615
+ ]), hu = D((e) => {
2616
+ L.find((t) => t.id === e)?.writeCapable && !Gn(w.getState().acknowledgedWriteModes, e) ? qo(e) : pu(e);
2617
+ }, [pu, L]), gu = D(() => {
2618
+ let e = Ko;
2619
+ if (qo(null), !e) return;
2620
+ let t = Vo.current;
2621
+ Vo.current = null, t ? (io(e), Q(t.content, t.attachments, t.options)) : (io(e), pu(e));
2607
2622
  }, [
2608
- Ro,
2609
- Xa,
2610
- au,
2623
+ Ko,
2624
+ io,
2625
+ pu,
2611
2626
  Q
2612
- ]), lu = Ro === null ? void 0 : L.find((e) => e.id === Ro) ?? { id: Ro }, uu = D(() => {
2613
- zo(null);
2614
- let e = No.current;
2615
- No.current = null, e && Q(e.content, e.attachments, {
2627
+ ]), _u = Ko === null ? void 0 : L.find((e) => e.id === Ko) ?? { id: Ko }, vu = D(() => {
2628
+ qo(null);
2629
+ let e = Vo.current;
2630
+ Vo.current = null, e && Q(e.content, e.attachments, {
2616
2631
  ...e.options,
2617
2632
  autoIntent: "read"
2618
2633
  });
2619
- }, [Q]), du = D(() => Cs(), [Cs]), [fu, pu] = j(null), mu = D(() => {
2620
- let e = w.getState(), t = e.activeConversationId ? e.conversations.find((t) => t.id === e.activeConversationId) : void 0, n = hs.current;
2634
+ }, [Q]), yu = D(() => js(), [js]), [bu, xu] = j(null), Su = D(() => {
2635
+ let e = w.getState(), t = e.activeConversationId ? e.conversations.find((t) => t.id === e.activeConversationId) : void 0, n = Cs.current;
2621
2636
  return {
2622
2637
  state: e,
2623
2638
  conversation: t ? {
2624
2639
  mode: t.mode,
2625
- hasHistory: Ei(t),
2640
+ hasHistory: Pi(t),
2626
2641
  routedByAuto: t.routedBy === "auto"
2627
2642
  } : null,
2628
2643
  waitingCount: t ? K.liveFor(t.id).count : 0,
2629
2644
  hasDraft: n !== null && (n.text.trim() !== "" || n.hasAttachments)
2630
2645
  };
2631
- }, [K]), hu = jo ? P("modeSelector.auto", "Auto") : void 0, gu = D((e) => {
2632
- if (Ro !== null) return;
2633
- let { state: t, conversation: n, waitingCount: r, hasDraft: i } = mu(), a = L.find((t) => t.id === e), o = Ae({
2646
+ }, [K]), Cu = zo ? P("modeSelector.auto", "Auto") : void 0, wu = D((e) => {
2647
+ if (Ko !== null) return;
2648
+ let { state: t, conversation: n, waitingCount: r, hasDraft: i } = Su(), a = L.find((t) => t.id === e), o = Ae({
2634
2649
  target: {
2635
2650
  kind: "mode",
2636
2651
  mode: e,
2637
- consentRequired: !!a?.writeCapable && !Ln(t.acknowledgedWriteModes, e)
2652
+ consentRequired: !!a?.writeCapable && !Gn(t.acknowledgedWriteModes, e)
2638
2653
  },
2639
2654
  conversation: n,
2640
2655
  waitingCount: r,
2641
2656
  hasDraft: i
2642
2657
  });
2643
- o.needsDialog ? pu({
2658
+ o.needsDialog ? xu({
2644
2659
  open: !0,
2645
2660
  target: {
2646
2661
  kind: "mode",
@@ -2648,110 +2663,110 @@ var na = () => () => {}, ra = () => "off", ia = ({ visible: ia = !0, writeAccess
2648
2663
  },
2649
2664
  plan: o,
2650
2665
  targetName: we(P, a ?? { id: e }),
2651
- currentName: hu
2652
- }) : au(e);
2666
+ currentName: Cu
2667
+ }) : pu(e);
2653
2668
  }, [
2654
- hu,
2655
- mu,
2656
- Ro,
2657
- au,
2669
+ Cu,
2670
+ Su,
2671
+ Ko,
2672
+ pu,
2658
2673
  L,
2659
2674
  P
2660
- ]), _u = D(() => {
2661
- if (Ro !== null) return;
2662
- let { conversation: e, waitingCount: t, hasDraft: n } = mu(), r = Ae({
2675
+ ]), Tu = D(() => {
2676
+ if (Ko !== null) return;
2677
+ let { conversation: e, waitingCount: t, hasDraft: n } = Su(), r = Ae({
2663
2678
  target: { kind: "auto" },
2664
2679
  conversation: e,
2665
2680
  waitingCount: t,
2666
2681
  hasDraft: n
2667
2682
  });
2668
- r.needsDialog ? pu({
2683
+ r.needsDialog ? xu({
2669
2684
  open: !0,
2670
2685
  target: { kind: "auto" },
2671
2686
  plan: r,
2672
2687
  targetName: P("modeSelector.auto", "Auto")
2673
- }) : ou();
2688
+ }) : mu();
2674
2689
  }, [
2675
- ou,
2676
2690
  mu,
2677
- Ro,
2691
+ Su,
2692
+ Ko,
2678
2693
  P
2679
- ]), vu = D(() => {
2680
- let e = fu;
2681
- e?.open && (pu({
2694
+ ]), Eu = D(() => {
2695
+ let e = bu;
2696
+ e?.open && (xu({
2682
2697
  ...e,
2683
2698
  open: !1
2684
- }), e.target.kind === "auto" ? ou() : (e.plan.consent && Xa(e.target.mode), au(e.target.mode)));
2699
+ }), e.target.kind === "auto" ? mu() : (e.plan.consent && io(e.target.mode), pu(e.target.mode)));
2685
2700
  }, [
2686
- Xa,
2687
- ou,
2688
- fu,
2689
- au
2690
- ]), yu = D(() => {
2691
- pu((e) => e && {
2701
+ io,
2702
+ mu,
2703
+ bu,
2704
+ pu
2705
+ ]), Du = D(() => {
2706
+ xu((e) => e && {
2692
2707
  ...e,
2693
2708
  open: !1
2694
2709
  });
2695
- }, []), bu = fu ? {
2696
- consent: fu.plan.consent,
2697
- withdrawnCount: fu.plan.withdrawnCount,
2698
- movesToNewConversation: fu.plan.movesToNewConversation,
2699
- draftKept: fu.plan.draftKept,
2700
- targetName: fu.targetName,
2701
- ...fu.currentName === void 0 ? {} : { currentName: fu.currentName }
2702
- } : void 0, xu = fu?.target.kind === "mode" ? fu.target.mode : null, Su = xu === null ? void 0 : L.find((e) => e.id === xu) ?? { id: xu }, Cu = A(null), wu = k(() => {
2710
+ }, []), Ou = bu ? {
2711
+ consent: bu.plan.consent,
2712
+ withdrawnCount: bu.plan.withdrawnCount,
2713
+ movesToNewConversation: bu.plan.movesToNewConversation,
2714
+ draftKept: bu.plan.draftKept,
2715
+ targetName: bu.targetName,
2716
+ ...bu.currentName === void 0 ? {} : { currentName: bu.currentName }
2717
+ } : void 0, ku = bu?.target.kind === "mode" ? bu.target.mode : null, Au = ku === null ? void 0 : L.find((e) => e.id === ku) ?? { id: ku }, ju = A(null), Mu = k(() => {
2703
2718
  if (!F) return 0;
2704
- let e = new Set(Nc.flatMap((e) => ae(e.metadata).map((e) => e.proposalId)));
2705
- return Oe(oo, V, so, e);
2719
+ let e = new Set(Vc.flatMap((e) => ae(e.metadata).map((e) => e.proposalId)));
2720
+ return Oe(ho, V, go, e);
2706
2721
  }, [
2707
2722
  F,
2708
- Nc,
2723
+ Vc,
2709
2724
  V,
2710
- oo,
2711
- so
2712
- ]), Tu = D(() => {
2713
- ke(Cu.current);
2714
- }, []), Eu = Nc.length === 0 && (mo || ho) ? /* @__PURE__ */ M(_e, {
2715
- state: mo ? "loading" : "failed",
2716
- onRetry: To
2717
- }) : Nc.length === 0 && W?.sync?.hasOlder ? /* @__PURE__ */ M("div", {
2725
+ ho,
2726
+ go
2727
+ ]), Nu = D(() => {
2728
+ ke(ju.current);
2729
+ }, []), Pu = Vc.length === 0 && (So || Co) ? /* @__PURE__ */ M(_e, {
2730
+ state: So ? "loading" : "failed",
2731
+ onRetry: No
2732
+ }) : Vc.length === 0 && W?.sync?.hasOlder ? /* @__PURE__ */ M("div", {
2718
2733
  className: "flex min-h-0 flex-1 flex-col",
2719
2734
  children: /* @__PURE__ */ M(S, {
2720
- onShowEarlier: Eo,
2721
- disabled: mo
2735
+ onShowEarlier: Po,
2736
+ disabled: So
2722
2737
  })
2723
- }) : Nc.length === 0 ? /* @__PURE__ */ M(me, {
2738
+ }) : Vc.length === 0 ? /* @__PURE__ */ M(me, {
2724
2739
  mode: H,
2725
- onSuggestionClick: Dc,
2726
- explainsAuto: jo,
2727
- suggestions: jo && H === "assistant" ? le(L.find((e) => e.id === "assistant")?.suggestions ?? [], L.find((e) => e.id === "api-calls")?.suggestions ?? []) : void 0
2728
- }) : /* @__PURE__ */ qi("div", {
2740
+ onSuggestionClick: Fc,
2741
+ explainsAuto: zo,
2742
+ suggestions: zo && H === "assistant" ? le(L.find((e) => e.id === "assistant")?.suggestions ?? [], L.find((e) => e.id === "api-calls")?.suggestions ?? []) : void 0
2743
+ }) : /* @__PURE__ */ ta("div", {
2729
2744
  className: "flex min-h-0 flex-1 flex-col",
2730
2745
  children: [W?.sync?.hasOlder ? /* @__PURE__ */ M(S, {
2731
- onShowEarlier: Eo,
2732
- disabled: mo
2746
+ onShowEarlier: Po,
2747
+ disabled: So
2733
2748
  }) : null, /* @__PURE__ */ M(c, {
2734
- onApprovePendingWrite: Ts,
2735
- approvingWriteRef: _s,
2736
- approvableMessageId: Fc?.messageId ?? null,
2737
- retryableMessageId: Ic,
2738
- messages: Nc,
2749
+ onApprovePendingWrite: Ns,
2750
+ approvingWriteRef: Ts,
2751
+ approvableMessageId: Uc?.messageId ?? null,
2752
+ retryableMessageId: Wc,
2753
+ messages: Vc,
2739
2754
  processing: G ?? null,
2740
- streamingMessageId: ro,
2741
- failedMessageId: io,
2742
- onRetry: _s === null ? kc : void 0,
2743
- renderWriteProposals: Rc,
2744
- hidesLegacyWriteCard: Lc,
2745
- renderUiOffers: Bc,
2746
- onStopTurn: F ? void 0 : du,
2747
- stopTurnLabel: F ? void 0 : pa
2755
+ streamingMessageId: fo,
2756
+ failedMessageId: po,
2757
+ onRetry: Ts === null ? Lc : void 0,
2758
+ renderWriteProposals: Kc,
2759
+ hidesLegacyWriteCard: Gc,
2760
+ renderUiOffers: Jc,
2761
+ onStopTurn: F ? void 0 : yu,
2762
+ stopTurnLabel: F ? void 0 : xa
2748
2763
  })]
2749
2764
  });
2750
- return /* @__PURE__ */ qi("div", {
2751
- ref: Cu,
2765
+ return /* @__PURE__ */ ta("div", {
2766
+ ref: ju,
2752
2767
  className: "relative flex flex-1 flex-col overflow-hidden",
2753
2768
  children: [
2754
- /* @__PURE__ */ qi("div", {
2769
+ /* @__PURE__ */ ta("div", {
2755
2770
  className: "contents",
2756
2771
  inert: $.active || J || void 0,
2757
2772
  ...q.ids ? F ? { id: q.ids.chatPanel } : {
@@ -2760,113 +2775,113 @@ var na = () => () => {}, ra = () => "off", ia = ({ visible: ia = !0, writeAccess
2760
2775
  "aria-labelledby": q.ids.chatTab
2761
2776
  } : {},
2762
2777
  children: [
2763
- yo === null ? null : /* @__PURE__ */ M(ge, { onDismiss: () => vo(yo) }),
2764
- Uc.length > 0 && !$.active ? /* @__PURE__ */ M(he, {
2765
- count: Uc.length,
2766
- onOpenTranscript: () => Ko(!0)
2778
+ Do === null ? null : /* @__PURE__ */ M(ge, { onDismiss: () => Eo(Do) }),
2779
+ Zc.length > 0 && !$.active ? /* @__PURE__ */ M(he, {
2780
+ count: Zc.length,
2781
+ onOpenTranscript: () => es(!0)
2767
2782
  }) : null,
2768
- Eu,
2769
- fo ? /* @__PURE__ */ M(ve, { onStartNew: () => za() }) : null,
2770
- po && V ? /* @__PURE__ */ M(x, { onUnarchive: () => Ti.updateConversation(V, { archived: !1 }) }) : null,
2771
- xc === null ? null : /* @__PURE__ */ M(ye, {
2783
+ Pu,
2784
+ bo ? /* @__PURE__ */ M(ve, { onStartNew: () => qa() }) : null,
2785
+ xo && V ? /* @__PURE__ */ M(x, { onUnarchive: () => Ni.updateConversation(V, { archived: !1 }) }) : null,
2786
+ kc === null ? null : /* @__PURE__ */ M(ye, {
2772
2787
  tr: P,
2773
- onDismiss: () => Sc(null)
2788
+ onDismiss: () => Ac(null)
2774
2789
  }),
2775
- Nc.length > 0 && (mo || ho) ? /* @__PURE__ */ M(_e, {
2776
- state: mo ? "loading" : "failed",
2777
- onRetry: To,
2790
+ Vc.length > 0 && (So || Co) ? /* @__PURE__ */ M(_e, {
2791
+ state: So ? "loading" : "failed",
2792
+ onRetry: No,
2778
2793
  compact: !0
2779
2794
  }) : null,
2780
2795
  /* @__PURE__ */ M(Ce, {
2781
- onStartVoiceSession: $.available && ls ? xl : void 0,
2796
+ onStartVoiceSession: $.available && _s ? kl : void 0,
2782
2797
  onSend: (e, t) => {
2783
- let n = Vi.getState().actions.take();
2798
+ let n = Yi.getState().actions.take();
2784
2799
  Q(e, t, {
2785
2800
  fromPerson: !0,
2786
2801
  ...n ? { focus: n } : {}
2787
2802
  });
2788
2803
  },
2789
- onDraftChange: hc,
2790
- inputRef: F ? sa : void 0,
2791
- viewSwitch: F && q.ids && q.compact && !ql ? /* @__PURE__ */ M(Le, {
2804
+ onDraftChange: Cc,
2805
+ inputRef: F ? ha : void 0,
2806
+ viewSwitch: F && q.ids && q.compact && !tu ? /* @__PURE__ */ M(Le, {
2792
2807
  selected: q.compact.view,
2793
2808
  onSelect: q.compact.selectView,
2794
2809
  ids: q.ids,
2795
2810
  instance: "chat"
2796
2811
  }) : void 0,
2797
- aboveCard: wu > 0 ? /* @__PURE__ */ M(Ee, {
2798
- count: wu,
2799
- onReview: ma && da ? Nl : Tu,
2800
- opensFull: ma && da !== void 0
2812
+ aboveCard: Mu > 0 ? /* @__PURE__ */ M(Ee, {
2813
+ count: Mu,
2814
+ onReview: Sa && ya ? Vl : Nu,
2815
+ opensFull: Sa && ya !== void 0
2801
2816
  }) : void 0,
2802
- disabled: no || _s !== null || mo || Ks,
2803
- readOnly: fo,
2817
+ disabled: uo || Ts !== null || So || ec,
2818
+ readOnly: bo,
2804
2819
  placeholder: H === "api-calls" ? P("chatArea.placeholderActions", "What would you like me to do?") : P("chatArea.placeholderGeneral", "Ask me anything…"),
2805
2820
  mode: H,
2806
- writeAccessDenied: aa === "denied" && !!os?.writeCapable,
2807
- availableModes: ko,
2808
- attachmentCharsPerFile: Lo,
2809
- onModeChange: F ? gu : su,
2810
- auto: Ao ? {
2811
- active: jo,
2812
- onSelect: F ? _u : ou
2821
+ writeAccessDenied: pa === "denied" && !!ms?.writeCapable,
2822
+ availableModes: Lo,
2823
+ attachmentCharsPerFile: Go,
2824
+ onModeChange: F ? wu : hu,
2825
+ auto: Ro ? {
2826
+ active: zo,
2827
+ onSelect: F ? Tu : mu
2813
2828
  } : void 0,
2814
- suspendDictation: J || F && !ia,
2815
- onVoiceStateChange: q.ids || ma ? kl : void 0,
2816
- modeReadOnly: ma || void 0,
2829
+ suspendDictation: J || F && !fa,
2830
+ onVoiceStateChange: q.ids || Sa ? Ll : void 0,
2831
+ modeReadOnly: Sa || void 0,
2817
2832
  voiceSessionActive: F ? $.active : void 0,
2818
- presentation: oa,
2819
- turnInFlight: no,
2820
- turnId: no ? G?.messageId ?? null : null,
2821
- onStop: F ? du : void 0,
2822
- modeDisabledReason: no ? "replying" : "busy"
2833
+ presentation: ma,
2834
+ turnInFlight: uo,
2835
+ turnId: uo ? G?.messageId ?? null : null,
2836
+ onStop: F ? yu : void 0,
2837
+ modeDisabledReason: uo ? "replying" : "busy"
2823
2838
  }),
2824
2839
  F ? /* @__PURE__ */ M(Me, { children: /* @__PURE__ */ M(Ne, {
2825
2840
  productKey: I,
2826
- enabled: !!va,
2841
+ enabled: !!Ea,
2827
2842
  testId: "assistant-ai-credit-balance"
2828
- }) }) : /* @__PURE__ */ qi(Ki, { children: [/* @__PURE__ */ M(Ne, {
2843
+ }) }) : /* @__PURE__ */ ta(ea, { children: [/* @__PURE__ */ M(Ne, {
2829
2844
  productKey: I,
2830
- enabled: !!va,
2845
+ enabled: !!Ea,
2831
2846
  className: "px-3 pt-1 text-center",
2832
2847
  testId: "assistant-ai-credit-balance"
2833
2848
  }), /* @__PURE__ */ M(je, { className: "px-3 pb-2 pt-1" })] })
2834
2849
  ]
2835
2850
  }),
2836
- Ho && !$.active ? /* @__PURE__ */ M(Se, {
2837
- turns: Uc,
2838
- onClose: () => Ko(!1),
2839
- onSave: Wc,
2840
- onContinueInChat: wl ? Tl : void 0,
2851
+ Xo && !$.active ? /* @__PURE__ */ M(Se, {
2852
+ turns: Zc,
2853
+ onClose: () => es(!1),
2854
+ onSave: Qc,
2855
+ onContinueInChat: Ml ? Nl : void 0,
2841
2856
  closeOnEscape: !0,
2842
- onShowEarlier: W?.sync?.hasOlder ? Eo : void 0,
2843
- showEarlierDisabled: mo,
2844
- renderAfterTurn: zc
2857
+ onShowEarlier: W?.sync?.hasOlder ? Po : void 0,
2858
+ showEarlierDisabled: So,
2859
+ renderAfterTurn: qc
2845
2860
  }) : null,
2846
- ql && q.ids && q.compact ? /* @__PURE__ */ M(Re, {
2861
+ tu && q.ids && q.compact ? /* @__PURE__ */ M(Re, {
2847
2862
  ids: q.ids,
2848
2863
  compact: q.compact
2849
- }) : J && Uo && q.ids ? F && q.compact && Uo.CompactView ? /* @__PURE__ */ M(Ie, {
2850
- tab: Uo,
2851
- CompactView: Uo.CompactView,
2864
+ }) : J && Zo && q.ids ? F && q.compact && Zo.CompactView ? /* @__PURE__ */ M(Ie, {
2865
+ tab: Zo,
2866
+ CompactView: Zo.CompactView,
2852
2867
  ids: q.ids,
2853
2868
  compact: q.compact,
2854
- shown: Jl,
2855
- voice: Vl,
2869
+ shown: nu,
2870
+ voice: Yl,
2856
2871
  ...$.active ? { mute: {
2857
2872
  muted: $.session.muted,
2858
2873
  toggle: $.toggleMute
2859
2874
  } } : {},
2860
- ...Yl ? { ask: tu } : {},
2875
+ ...ru ? { ask: lu } : {},
2861
2876
  footer: /* @__PURE__ */ M(Me, {})
2862
2877
  }) : /* @__PURE__ */ M(Fe, {
2863
- tab: Uo,
2878
+ tab: Zo,
2864
2879
  id: q.ids.avatarPanel,
2865
2880
  labelledBy: q.ids.avatarTab,
2866
2881
  leaveHintId: q.ids.leaveHint,
2867
- shown: Jl,
2868
- voice: Vl,
2869
- ...Yl ? { ask: tu } : {}
2882
+ shown: nu,
2883
+ voice: Yl,
2884
+ ...ru ? { ask: lu } : {}
2870
2885
  }) : null,
2871
2886
  $.active && /* @__PURE__ */ M(Pe, {
2872
2887
  session: $.session,
@@ -2879,63 +2894,63 @@ var na = () => () => {}, ra = () => "off", ia = ({ visible: ia = !0, writeAccess
2879
2894
  correcting: $.correcting,
2880
2895
  onLetMeFinish: $.letMeFinish,
2881
2896
  onImDone: $.imDone,
2882
- turns: $c,
2897
+ turns: sl,
2883
2898
  spokenChunks: $.spokenChunks,
2884
- attachments: Gc.attachments,
2885
- onAttachFiles: Gc.addFiles,
2886
- onRemoveAttachment: Gc.remove,
2887
- onRetryAttachment: Gc.retry,
2888
- canAttachMore: Gc.canAddMore,
2889
- preparingAttachments: Gc.preparingCount,
2890
- attachmentsLocked: Gc.isCommitting,
2891
- attachmentNotice: Yc,
2892
- onSaveTranscript: Wc,
2893
- onContinueInChat: Tl,
2899
+ attachments: $c.attachments,
2900
+ onAttachFiles: $c.addFiles,
2901
+ onRemoveAttachment: $c.remove,
2902
+ onRetryAttachment: $c.retry,
2903
+ canAttachMore: $c.canAddMore,
2904
+ preparingAttachments: $c.preparingCount,
2905
+ attachmentsLocked: $c.isCommitting,
2906
+ attachmentNotice: rl,
2907
+ onSaveTranscript: Qc,
2908
+ onContinueInChat: Nl,
2894
2909
  onInterrupt: () => {
2895
- $.interrupt(), Cs();
2910
+ $.interrupt(), js();
2896
2911
  },
2897
- spoken: Mc,
2912
+ spoken: Bc,
2898
2913
  onToggleMute: $.toggleMute,
2899
- onEnd: Dl,
2900
- proposalChip: sl ? ma && da ? {
2914
+ onEnd: Fl,
2915
+ proposalChip: hl ? Sa && ya ? {
2901
2916
  label: P("waitingChange.reviewInFull", "Review in full assistant"),
2902
- status: te(sl, P),
2903
- onOpen: da
2917
+ status: te(hl, P),
2918
+ onOpen: ya
2904
2919
  } : {
2905
- label: te(sl, P),
2906
- onOpen: ol
2920
+ label: te(hl, P),
2921
+ onOpen: ml
2907
2922
  } : null,
2908
- proposalTray: ma ? null : ll,
2909
- renderAfterTurn: zc,
2910
- onViewChange: q.ids ? Ul : void 0,
2911
- ...ma ? { view: J || Wl ? "mini" : "compact" } : {},
2912
- startedCue: F ? Xo ? P("window.voiceStartedCue", "Started a voice conversation. Your chat is in History.") : null : void 0
2923
+ proposalTray: Sa ? null : _l,
2924
+ renderAfterTurn: qc,
2925
+ onViewChange: q.ids ? Zl : void 0,
2926
+ ...Sa ? { view: J || Ql ? "mini" : "compact" } : {},
2927
+ startedCue: F ? is ? P("window.voiceStartedCue", "Started a voice conversation. Your chat is in History.") : null : void 0
2913
2928
  }),
2914
2929
  /* @__PURE__ */ M(l, {
2915
- open: Ro !== null,
2916
- mode: lu,
2917
- currentMode: os ?? { id: H },
2918
- onConfirm: cu,
2919
- onCancel: uu
2930
+ open: Ko !== null,
2931
+ mode: _u,
2932
+ currentMode: ms ?? { id: H },
2933
+ onConfirm: gu,
2934
+ onCancel: vu
2920
2935
  }),
2921
2936
  F ? /* @__PURE__ */ M(l, {
2922
- open: fu?.open === !0,
2923
- mode: Su,
2924
- currentMode: os ?? { id: H },
2925
- switchPlan: bu,
2926
- onConfirm: vu,
2927
- onCancel: yu
2937
+ open: bu?.open === !0,
2938
+ mode: Au,
2939
+ currentMode: ms ?? { id: H },
2940
+ switchPlan: Ou,
2941
+ onConfirm: Eu,
2942
+ onCancel: Du
2928
2943
  }) : null,
2929
2944
  /* @__PURE__ */ M(u, {
2930
- ...co.dialog,
2931
- view: Vc?.view ?? co.dialog.view,
2932
- serverNow: Vc?.serverNow ?? NaN,
2933
- arrivedAt: Vc?.arrivedAt ?? NaN,
2934
- capabilities: Vc ? ao[Vc.session.sandboxId] : null,
2935
- turnInFlight: no,
2945
+ ..._o.dialog,
2946
+ view: Yc?.view ?? _o.dialog.view,
2947
+ serverNow: Yc?.serverNow ?? NaN,
2948
+ arrivedAt: Yc?.arrivedAt ?? NaN,
2949
+ capabilities: Yc ? mo[Yc.session.sandboxId] : null,
2950
+ turnInFlight: uo,
2936
2951
  tr: P
2937
2952
  })
2938
2953
  ]
2939
2954
  });
2940
2955
  };
2941
- export { ia as AssistantChatArea };
2956
+ export { fa as AssistantChatArea };