From 63ab4dc675aab203e03a3a773c4747fe10d85167 Mon Sep 17 00:00:00 2001 From: boggedbrush <90526147+boggedbrush@users.noreply.github.com> Date: Tue, 9 Jun 2026 18:56:11 -0400 Subject: [PATCH 1/2] feat(titlebar): implemented linux custom titlebar Implemented a Linux custom title bar that matches Codex's existing styling so the desktop app feels like a native Linux application, with in-renderer menus, window controls, and floating sidebar fixes. --- .codex/skills/update-codex/SKILL.md | 5 +- .../.vite/build/main-BJ6Uf5yA.js | 4 +- .../app-asar-extracted/.vite/build/preload.js | 2 +- .../webview/assets/app-shell-D7yvB1FT.js | 2 +- .../webview/assets/login-route-36U3XA9s.js | 2 +- .../remote-connections-settings-mrv9fxOy.js | 2 +- .../use-plugin-install-flow-C0YRtVkW.js | 2 +- .../use-window-controls-safe-area-X2AodDul.js | 2 +- desktop/recovered/refresh-manifest.json | 296 +++++++++++------ desktop/scripts/assemble-codex-runtime.mjs | 302 ++++++++++++++---- .../tests/linux/recovered-bundle.red.test.ts | 94 +++++- 11 files changed, 526 insertions(+), 187 deletions(-) diff --git a/.codex/skills/update-codex/SKILL.md b/.codex/skills/update-codex/SKILL.md index 550e09f2..27f2864b 100644 --- a/.codex/skills/update-codex/SKILL.md +++ b/.codex/skills/update-codex/SKILL.md @@ -17,8 +17,9 @@ Use this skill only from `/home/amwill/Applications/codex-app`. `Contents/Resources/app.asar` using `--app-asar`, or from a DMG using `--dmg` when the feed/source provides one. - Preserve Linux behavior patches in `desktop/scripts/assemble-codex-runtime.mjs`, especially: - - Linux hidden titlebar/titlebar overlay path. - - Linux native menu hide/remove behavior. + - Linux hidden titlebar path with in-app File/Edit/View/Window/Help menus and custom window controls. + - Linux in-renderer Codex application sub-menus (not native GTK popups) via application-menu IPC. + - Linux native menu hide/remove behavior for the custom title bar chrome. - Linux external browser routing for auth and plugin/app flows. - Linux open-in target registry and browser-session launcher. - Linux pet/avatar overlay stability patches, including the X11/XWayland diff --git a/desktop/recovered/app-asar-extracted/.vite/build/main-BJ6Uf5yA.js b/desktop/recovered/app-asar-extracted/.vite/build/main-BJ6Uf5yA.js index c686f4d0..43a4e405 100644 --- a/desktop/recovered/app-asar-extracted/.vite/build/main-BJ6Uf5yA.js +++ b/desktop/recovered/app-asar-extracted/.vite/build/main-BJ6Uf5yA.js @@ -685,7 +685,7 @@ ${r} `}return e===`wsl`?ZY(t,n,` `):XY(t,n)}function XY(e,t){return ZY(e,t,process.platform===`win32`?`\r `:` -`)}function ZY(e,t,n){let r=t.replace(/\r\n|\r|\n/g,n);return`cd ${JSON.stringify(e)} && ${r}${n}`}function QY(e,t){return e===`powershell`?`Set-Location -LiteralPath ${$Y(t)}`:e===`commandPrompt`?`cd /d ${eX(t)}`:`cd ${JSON.stringify(t)}`}function $Y(e){return`'${e.replace(/'/g,`''`)}'`}function eX(e){return`"${e.replace(/"/g,`""`)}"`}function tX(e){let t=(e[0]??``).split(/[/\\]/);return t[t.length-1]?.toLowerCase()??``}var nX=n.Rr(`WindowContext`),rX=`x-apple.systempreferences:com.apple.preference.security?Privacy_ListenEvent`,iX=class{appServerConnectionRegistry;remoteControlDeviceKeyClient;messageHandler;remoteConnectionsHandler;sharedObjectRepository;fetchHandler;appState;errorReporter;options;scopedState;primaryRuntimeService;initialRemoteConnectionsRefresh;codexMicroService=null;codexMicroServicePromise=null;disposables=new n.Ln;registeredWindows=new Map;appServerClients=new Map;ipcClientsByWebContentsId=new Map;constructor(e){this.options=e,this.appState=e.appGlobalState,this.errorReporter=e.errorReporter,this.scopedState=e.globalState,this.sharedObjectRepository=new n.a,this.sharedObjectRepository.set(`host_config`,lu),this.sharedObjectRepository.set(`remote_connections`,[]),this.sharedObjectRepository.set(`remote_control_connections_state`,{available:!1,accessRequired:!1,authRequired:!1,clientAuthorized:!1}),this.sharedObjectRepository.set(`local_remote_control_client_id`,null),this.sharedObjectRepository.set(`local_remote_control_environment_id`,e.appGlobalState.get(Ii)),this.sharedObjectRepository.set(`local_remote_control_installation_id`,e.appGlobalState.get(Li));let r=n.Ct();r!=null&&this.sharedObjectRepository.set(`local_remote_control_enabled`,r);let i=this.createAppServerConnection(I);this.remoteControlDeviceKeyClient=xY({resourcesPath:In({env:process.env,resourcesPath:process.resourcesPath})}),this.appServerClients.set(I,i),this.appServerConnectionRegistry=new n.En,this.appServerConnectionRegistry.addConnection(I,i);let a=new qY(e.windowManager,this.scopedState,()=>e.settingsStore.getEffective(t.w.integratedTerminalShell.key),lu.terminal_command??null,async r=>{let a=await e.gitManager.getWorktreeRepository(t.mn(r),i);return a==null?null:n.rt(a)},e=>this.getHostConfigForHostId(e),e=>this.appServerConnectionRegistry.getMaybeConnection(e));this.remoteConnectionsHandler=new aY(this.appState,this.sharedObjectRepository,I,this.appServerConnectionRegistry,{desktopOriginator:e.desktopOriginator,devApiBaseUrl:e.devApiBaseUrl,prodApiBaseUrl:e.prodApiBaseUrl},i,this.remoteControlDeviceKeyClient,this.getHostConfigForHostId.bind(this),this.getAppServerClient.bind(this),this.createAndRegisterRemoteConnection.bind(this),this.disposeRemoteConnection.bind(this));let o=iJ({appServerConnectionRegistry:this.appServerConnectionRegistry,errorReporter:e.errorReporter,globalState:this.scopedState,hostId:I,sharedObjectRepository:this.sharedObjectRepository,windowManager:e.windowManager});this.primaryRuntimeService=o.rpc,this.fetchHandler=new hj(this.scopedState,e=>this.getRegisteredWindowIpcClient(e),this.appServerConnectionRegistry,e.gitManager,i,this.remoteConnectionsHandler,e.hotkeyWindowLifecycleManager,e.windowManager,a,o.isWorkspaceDependenciesFeatureEnabled,e=>this.getAppServerClient(e),e=>this.messageHandler.getWorktreeService(e),e.requestGitWorker,this.sharedObjectRepository,e.errorReporter,e.repoRoot,e.globalDictationHotkeyController,()=>{this.messageHandler.getBrowserSidebarManager().reloadOpenPages()},e.refreshApplicationMenu,e.requestComputerUseCaptureWorker,e.subscribeComputerUseCaptureWorkerEvent,()=>{this.messageHandler.getBrowserSidebarManager().refreshOwnerCommandAccelerators()},e.settingsStore),this.disposables.add(()=>this.fetchHandler.dispose()),this.disposables.add(o.startUpdatePolling());let s=Jj(this.scopedState);this.disposables.add(i.registerInternalNotificationHandler(e=>{e.method===`account/updated`&&e.params?.authMode==null&&s.clear()}));let c=new rM(this.fetchHandler,{desktopOriginator:e.desktopOriginator,devApiBaseUrl:e.devApiBaseUrl,integrityStateStore:s,messageChannel:e.messageChannel,appServerConnectionRegistry:this.appServerConnectionRegistry,prodApiBaseUrl:e.prodApiBaseUrl}),l=new wq({buildFlavor:e.buildFlavor,gitWorkerInvocationSampler:e.gitWorkerInvocationSampler});this.messageHandler=new gq(I,lu,i,e.windowManager,e.filePreviewManager,e.avatarOverlayManager,this.appServerConnectionRegistry,c,this.scopedState,this.sharedObjectRepository,a,e.gitManager,e.requestGitWorker,e.desktopNotificationManager,e.errorReporter,e.desktopSentry,e.updateWorkerSentryUser,e=>this.getRegisteredWindowIpcClient(e),e.inboxManager,e.datadogLogger,e.maxLogLevel,e.buildFlavor,e.sparkleManager,e.subscribeGitWorkerEvent,l,e=>this.getHostConfigForHostId(e),e.hasActiveComputerUseTurn,e.settingsStore),this.disposables.add(this.sharedObjectRepository.addSubscriber(e=>{if(e===`remote_connections`||e===`remote_control_connections`){this.remoteConnectionsHandler.reconcileRemoteConnections(this.getAllRemoteConnections());return}if(e===`local_remote_control_environment_id`||e===`local_remote_control_installation_id`){let e=this.sharedObjectRepository.get(`local_remote_control_environment_id`),t=this.sharedObjectRepository.get(`local_remote_control_installation_id`);e!=null&&this.appState.set(Ii,e),t!=null&&this.appState.set(Li,t),this.remoteConnectionsHandler.handleLocalRemoteControlIdentityChanged()}})),this.initialRemoteConnectionsRefresh=Promise.all([this.remoteConnectionsHandler.refreshRemoteConnections(),this.remoteConnectionsHandler.refreshLocalRemoteControlClientId()]).then(()=>void 0).catch(e=>{nX.warning(`Failed to refresh remote connections`,{safe:{},sensitive:{error:e}})})}createAppHost(e){return new Rm({debug:new L_({debugWindowManager:this.options.windowManager.debugWindowManager,getBrowserSnapshot:()=>this.messageHandler.getBrowserSidebarManager().getDebugSnapshot(),openBrowserTabOwner:e=>this.messageHandler.getBrowserSidebarManager().openDebugTabOwner(e),origin:e}),hotkeyWindowHotkeys:this.options.hotkeyWindowLifecycleManager.rpcFor(e),appshotHotkeys:this.options.appshotHotkeyController.rpc,customAvatars:this.createCustomAvatarsService(),fileAttachments:{countFolderFiles:({folderPath:e,hostId:t})=>n.Et(e,this.getAppServerClient(t))},owlFeatures:r.x(),primaryRuntime:this.primaryRuntimeService,chromeNativeHost:this.createChromeNativeHostService(),projectWritableRoots:this.messageHandler.createProjectWritableRootsService(e),systemPermissions:LY(e),threadArchive:this.createThreadArchiveService(),codexMicro:this.createCodexMicroHostService(e),notifications:new NY(this.options.windowManager,e,this.options.desktopNotificationManager)})}async applyCodexAppConfigFromDisk(e){let t=await Ac(e);return t.status===`loaded`?{status:`applied`,configPath:t.configPath,result:await this.applyCodexAppConfig(t.config)}:t}getCodexMicroService(){return this.codexMicroService==null?(this.codexMicroServicePromise??=Promise.resolve().then(()=>require(`./codex-micro-service-CYwSISMZ.js`)).then(({CodexMicroService:e})=>{let t=new e({onDeviceStateChanged:e=>{this.options.windowManager.sendMessageToAllWindows({type:`codex-micro-device-state-changed`,state:e})},onHidEvent:e=>{let t=this.options.windowManager.getPrimaryWindow();t!=null&&this.options.windowManager.sendMessageToWindow(t,{type:`codex-micro-hid-event`,event:e})},onJoystickEvent:e=>{let t=this.options.windowManager.getPrimaryWindow();t!=null&&this.options.windowManager.sendMessageToWindow(t,{type:`codex-micro-joystick-event`,event:e})}});return this.codexMicroService=t,this.disposables.add(()=>{t.dispose()}),t}).finally(()=>{this.codexMicroServicePromise=null}),this.codexMicroServicePromise):Promise.resolve(this.codexMicroService)}createCustomAvatarsService(){return{load:()=>n.Rt({appServerClient:this.getAppServerClient(),preferWsl:!!process.env.WSL_DISTRO_NAME})}}createChromeNativeHostService(){return y_({devRuntimeRepoRoot:process.env.NODE_ENV===`development`?this.options.repoRoot:void 0,getCodexHome:e=>this.getAppServerClient(e).codexHome(),getHostConfig:e=>this.getHostConfigForHostId(e)})}createThreadArchiveService(){return{archiveInactiveThread:async({hostId:e,threadId:r})=>{let i=this.getAppServerClient(e);if(t.un(i.hostConfig))throw Error(`Archiving inactive chats is only supported locally`);let a=await n.rr({codexHome:await i.codexHome(),threadId:r});return a&&this.appServerConnectionRegistry.getConnection(e).handleArchivedThreadSideEffects(r),{success:a}}}}createCodexMicroHostService(e){return{getState:async()=>{let e=await this.getCodexMicroService();return e?.start(),e?.getState()??{status:`not-detected`,error:null}},getInputMonitoringPermissionStatus:async()=>jq(),openInputMonitoringSettings:async()=>{try{await a.shell.openExternal(rX)}catch(e){nX.error(`Open input monitoring settings failed`,{safe:{},sensitive:{error:e}})}},updateLighting:async t=>this.options.windowManager.getPrimaryWindow()?.webContents===e?await(await this.getCodexMicroService())?.updateLighting(t)??!1:!1}}async applyCodexAppConfig(e){await this.initialRemoteConnectionsRefresh;let n=c_({config:e,globalState:this.appState}),{remoteConnections:r}=await this.remoteConnectionsHandler.refreshRemoteConnections(),i=l_({config:e,globalState:this.appState,remoteConnections:r});return n&&i.changedGlobalStateKeys.unshift(t._r.CODEX_MANAGED_REMOTE_CONNECTIONS),i.changedGlobalStateKeys.includes(t._r.REMOTE_CONNECTION_AUTO_CONNECT_BY_HOST_ID)&&await this.remoteConnectionsHandler.refreshRemoteConnections(),i.changedGlobalStateKeys.length>0&&this.options.windowManager.sendMessageToAllWindows({type:`global-state-updated`,keys:i.changedGlobalStateKeys}),i.remoteProjectsChanged&&this.options.windowManager.sendMessageToAllWindows({type:`workspace-root-options-updated`}),this.remoteConnectionsHandler.connectRemoteConnectionsAndLogFailures(i.remoteConnectionHostIdsToConnect),i}registerWindow(e){let{webContents:t}=e,n=new eK(t);this.registeredWindows.set(t.id,n),t.once(`destroyed`,()=>{this.registeredWindows.delete(t.id)});for(let e of this.appServerConnectionRegistry.getAllHostIds())this.appServerConnectionRegistry.getConnection(e).registerWebviewWindow(n);this.registerIpcClientForWebContents(e.webContents)}handleMessage(e,t){return this.messageHandler.handleMessage(e,t)}getBrowserSidebarManager(){return this.messageHandler.getBrowserSidebarManager()}getBrowserSessionRegistry(){return this.messageHandler.getBrowserSessionRegistry()}flushTelemetry(){this.messageHandler.flushTelemetry()}dispose(){let e=this.appServerConnectionRegistry.getAllHostIds();this.messageHandler.dispose(),this.disposables.dispose();for(let t of e)this.appServerConnectionRegistry.getMaybeConnection(t)?.dispose(),this.appServerConnectionRegistry.removeConnection(t),this.appServerClients.delete(t);this.registeredWindows.clear();for(let{dispose:e}of this.ipcClientsByWebContentsId.values())e();this.ipcClientsByWebContentsId.clear()}getMessageHandler(){return this.messageHandler}getSharedObject(e){return this.sharedObjectRepository.get(e)}setChronicleConfig(e){this.sharedObjectRepository.set(`codex_chronicle_config`,e)}getSharedObjectSnapshot(){return this.sharedObjectRepository.getSnapshot()}getHostConfigForHostId(e){if(e===`local`)return lu;let t=this.getAllRemoteConnections().find(t=>t.hostId===e);if(!t)throw Error(`Host config for host ID ${e} not found`);return AY(t)}getAllRemoteConnections(){return[...this.sharedObjectRepository.get(`remote_connections`)??[],...this.sharedObjectRepository.get(`remote_control_connections`)??[]]}createAppServerConnection(e,i=lu,o=!1,s,c){let l={desktopOriginator:this.options.desktopOriginator,devApiBaseUrl:this.options.devApiBaseUrl,prodApiBaseUrl:this.options.prodApiBaseUrl},u=In({env:process.env,resourcesPath:process.resourcesPath}),d;if(t.ln(i)){if(s==null)throw Error(`Remote control transport requires a desktop app-server client for authentication.`);if(c==null)throw Error(`Remote control transport requires the remote-control device-key client.`);d=aX({transportKind:`remote-control`,hostConfig:i,repoRoot:this.options.repoRoot,resourcesPath:u,desktopApiOptions:l,desktopAuthAppServerClient:s,remoteControlDeviceKeyClient:c,globalState:this.appState})}else d=aX({transportKind:`standard`,hostConfig:i,repoRoot:this.options.repoRoot,resourcesPath:u,desktopApiOptions:l,globalState:this.appState});let f=this.options.hostProcess.getVersion(),p=new n.Tn(this.options.messageChannel,{buildFlavor:this.options.buildFlavor,clientInfo:{name:Tl,title:`Codex Desktop`,version:f},defaultServiceName:El,repoRoot:this.options.repoRoot,resourcesPath:u,errorReporter:this.options.errorReporter,sharedObjectRepository:this.sharedObjectRepository,hostId:e,hostConfig:i,onArchiveCleanup:async({conversationId:t,cwd:n,replacementOwnerThreadId:r,replacementOwnerCwd:i})=>{await this.messageHandler.getWorktreeService(e).handleArchiveCleanup({conversationId:t,cwd:n,replacementOwnerThreadId:r,replacementOwnerCwd:i})},transport:d,hostProcess:this.options.hostProcess,isOnline:()=>a.net.isOnline(),supportsAttestationRequests:xe,isMcpAppsDilEnabled:()=>Be().dil,beforeConnect:i.id===`local`?()=>dY({hostConfig:i}):void 0,ensureAuth:o,getRemoteConnectionMaxRetryAttempts:()=>this.appState.get(t._r.REMOTE_CONNECTION_MAX_RETRY_ATTEMPTS)??null});return p.registerInternalServerRequestHandler({methods:[`item/commandExecution/requestApproval`,`mcpServer/elicitation/request`],handler:t=>(this.messageHandler.revealWindowsReviewRequest(e,t),null)}),p.registerInternalServerRequestHandler({methods:[`attestation/generate`],handler:Ce({bundleIdentifier:r.D(this.options.buildFlavor),resourcesPath:u})}),p}createAndRegisterRemoteConnection(e){let t=AY(e),n=this.createAppServerConnection(e.hostId,t,!0,this.getLocalAppServerClient(),this.remoteControlDeviceKeyClient);this.appServerClients.set(e.hostId,n);for(let e of this.registeredWindows.values())n.registerWebviewWindow(e);return n}disposeRemoteConnection(e){let t=this.appServerConnectionRegistry.getMaybeConnection(e);t&&(t.dispose(),this.appServerConnectionRegistry.removeConnection(e),this.appServerClients.delete(e))}getLocalAppServerClient(){return this.appServerConnectionRegistry.getConnection(I)}getAppServerClient(e=I){let t=this.appServerClients.get(e);if(!t)throw Error(`App server client for host ID ${e} not found`);return t}registerIpcClientForWebContents(e){if(this.appServerConnectionRegistry.getConnection(`local`).getTransportKind()!==`stdio`||this.ipcClientsByWebContentsId.has(e.id))return;let t=new n.S(`desktop`,this.errorReporter),r=new n.Ln;r.add(t.addAnyBroadcastHandler(async t=>{let n={...t,type:`ipc-broadcast`};this.messageHandler.sendMessageToOrigin(e,n)}));let i=async t=>await this.messageHandler.getThreadRole(e,t.conversationId)===`owner`;r.add(t.addRequestHandler(`thread-follower-start-turn`,i,async t=>this.messageHandler.handleThreadFollowerStartTurnRequest(e,t))),r.add(t.addRequestHandler(`thread-follower-compact-thread`,i,async t=>this.messageHandler.handleThreadFollowerCompactThreadRequest(e,t))),r.add(t.addRequestHandler(`thread-follower-steer-turn`,i,async t=>this.messageHandler.handleThreadFollowerSteerTurnRequest(e,t))),r.add(t.addRequestHandler(`thread-follower-interrupt-turn`,i,async t=>this.messageHandler.handleThreadFollowerInterruptTurnRequest(e,t))),r.add(t.addRequestHandler(`thread-follower-update-thread-settings`,i,async t=>this.messageHandler.handleThreadFollowerUpdateThreadSettingsRequest(e,t))),r.add(t.addRequestHandler(`thread-follower-edit-last-user-turn`,i,async t=>this.messageHandler.handleThreadFollowerEditLastUserTurnRequest(e,t))),r.add(t.addRequestHandler(`thread-follower-command-approval-decision`,i,async t=>this.messageHandler.handleThreadFollowerCommandApprovalDecisionRequest(e,t))),r.add(t.addRequestHandler(`thread-follower-file-approval-decision`,i,async t=>this.messageHandler.handleThreadFollowerFileApprovalDecisionRequest(e,t))),r.add(t.addRequestHandler(`thread-follower-permissions-request-approval-response`,i,async t=>this.messageHandler.handleThreadFollowerPermissionsRequestApprovalResponseRequest(e,t))),r.add(t.addRequestHandler(`thread-follower-submit-user-input`,i,async t=>this.messageHandler.handleThreadFollowerSubmitUserInputRequest(e,t))),r.add(t.addRequestHandler(`thread-follower-submit-mcp-server-elicitation-response`,i,async t=>this.messageHandler.handleThreadFollowerSubmitMcpServerElicitationRequest(e,t))),r.add(t.addRequestHandler(`thread-follower-set-queued-follow-ups-state`,i,async t=>this.messageHandler.handleThreadFollowerSetQueuedFollowUpsStateRequest(e,t))),r.add(()=>t.dispose()),this.ipcClientsByWebContentsId.set(e.id,{client:t,dispose:()=>{r.dispose(),this.messageHandler.rejectPendingThreadFollowerActionRequestsForOrigin(e)}}),e.once(`destroyed`,()=>{this.disposeIpcClientForWebContents(e)})}disposeIpcClientForWebContents(e){let t=this.ipcClientsByWebContentsId.get(e.id);t&&(this.ipcClientsByWebContentsId.delete(e.id),t.dispose())}getRegisteredWindowIpcClient(e){return this.ipcClientsByWebContentsId.get(e.id)?.client??null}};function aX(e){let t=t_(e.hostConfig);if(t)return nX.info(`[ssh-websocket-v0] selected app-server transport`,{safe:{hostId:e.hostConfig.id}}),new e_(t);if(e.transportKind===`remote-control`)return new xh({hostConfig:e.hostConfig,appServerClient:e.desktopAuthAppServerClient,deviceKeyClient:e.remoteControlDeviceKeyClient,desktopApiOptions:e.desktopApiOptions,globalState:e.globalState});let r=n.pn(e.hostConfig);return r?new n.fn({hostConfig:e.hostConfig,websocketUrl:r}):new n.Dn({hostConfig:e.hostConfig,repoRoot:e.repoRoot,resourcesPath:e.resourcesPath,defaultOriginator:e.defaultOriginator})}function oX({app:e,globalState:t,settingsStore:n,windowServices:i,repoRoot:a,errorReporter:o,desktopSentry:s,datadogLogger:c,maxLogLevel:l,buildFlavor:u,sparkleManager:d,filePreviewManager:f,avatarOverlayManager:p,hotkeyWindowLifecycleManager:m,hasActiveComputerUseTurn:h,globalDictationHotkeyController:g,appshotHotkeyController:_,gitManager:v,requestComputerUseCaptureWorker:y,requestGitWorker:b,refreshApplicationMenu:x,subscribeComputerUseCaptureWorkerEvent:S,subscribeGitWorkerEvent:C,gitWorkerInvocationSampler:w,updateWorkerSentryUser:T,appEvent:E,onCompletedThreadsChanged:D}){let O=new kp(e),k=new Op({platform:process.platform,onCompletedThreadsChanged:D}),A=new Ap({inboxItemsChanged:e=>{i.sendMessageToAllWindows({type:e})}}),j=()=>{};r.l(t,lu.default_workspaces);let M=new iX({hostProcess:O,appGlobalState:t,settingsStore:n,windowManager:i.windowManager,globalState:t,repoRoot:a,errorReporter:o,desktopSentry:s,desktopNotificationManager:k,updateWorkerSentryUser:T,gitManager:v,inboxManager:A,datadogLogger:c,maxLogLevel:l,buildFlavor:u,sparkleManager:d,gitWorkerInvocationSampler:w,desktopOriginator:Tl,devApiBaseUrl:wl,prodApiBaseUrl:Cl,messageChannel:F,filePreviewManager:f,avatarOverlayManager:p,hotkeyWindowLifecycleManager:m,hasActiveComputerUseTurn:h,globalDictationHotkeyController:g,refreshApplicationMenu:x,appshotHotkeyController:_,requestComputerUseCaptureWorker:y,requestGitWorker:b,subscribeComputerUseCaptureWorkerEvent:S,subscribeGitWorkerEvent:C});return M.getMessageHandler().setOnBrowserSidebarStateChanged(j),M.appServerConnectionRegistry.getConnection(I).registerInternalNotificationHandler(e=>{if(e.method===`account/login/completed`){i.windowManager.showPrimaryWindow({stealFocus:!0});return}e.method===`turn/completed`&&E.emit(`turnComplete`)}),i.setWindowContext(M),{desktopNotificationManager:k,getWindowContext:()=>M,getElectronMessageHandlerForWindow:e=>{let t=i.getContextForWebContents(e.webContents);return t?t.getMessageHandler():null},getAppServerClientForHost:({hostId:e})=>{try{return M.getAppServerClient(e)}catch{return null}},getWorktreeCleanupInputsForHost:async({hostKey:r,threadIds:i})=>{let a=M.appServerConnectionRegistry.getMaybeConnection(r);return{threadMetadataById:a?await GK(a,i):Object.fromEntries(i.map(e=>[e,{updatedAtMs:Date.now(),isInProgress:!0,cwd:null,readFailed:!0}])),pinnedThreadIds:KK(t),protectPreMigrationOwnerlessWorktrees:ZK(t),autoCleanupEnabled:XK(n,t,e.isPackaged),keepCount:YK(n)}},setOnBrowserSidebarStateChanged:e=>{j=e,M.getMessageHandler().setOnBrowserSidebarStateChanged(j)},flushAndDisposeContext:()=>{M.dispose(),M.flushTelemetry()}}}function sX(e){return a.ipcMain.handle(fl,async(t,n)=>{if(!e(t))return;let r=a.BrowserWindow.fromWebContents(t.sender),i=a.Menu.getApplicationMenu()?.getMenuItemById(n.menuId)?.submenu;if(i)return new Promise(e=>{i.popup({window:r??void 0,x:Math.round(n.x),y:Math.round(n.y),callback:e})})}),()=>a.ipcMain.removeHandler(fl)}var cX=16;function lX(e){let{width:t,height:n}=e.getSize();return!t||!n||t<=cX&&n<=cX?e:e.resize({width:cX,height:cX,quality:`best`})}function uX(e,t){if(e)try{if(e.startsWith(`data:`))return lX(a.nativeImage.createFromDataURL(e));if(e.startsWith(`file://`))return lX(a.nativeImage.createFromPath((0,x.fileURLToPath)(e)));if(e.startsWith(`/`))return lX(a.nativeImage.createFromPath(e));for(let n of t){let t=new URL(e,`file://${n.endsWith(`/`)?n:`${n}/`}`).pathname;if((0,l.existsSync)(t)){let e=a.nativeImage.createFromPath(t);if(!e.isEmpty())return lX(e)}}}catch{}}function dX(e,t){return a.ipcMain.handle(dl,async(n,r)=>{if(!t(n))return{id:null};let i=a.BrowserWindow.fromWebContents(n.sender);return new Promise(t=>{let n=!1,o=e=>{n||(n=!0,t({id:e}))},s=t=>t.map(t=>t.type===`separator`?{type:`separator`}:{id:t.id,label:t.label,role:t.role,enabled:t.enabled??!0,icon:uX(t.icon,e),toolTip:t.toolTip,click:()=>o(t.id),submenu:t.submenu?s(t.submenu):void 0});a.Menu.buildFromTemplate(s(r)).popup({window:i??void 0,callback:()=>o(null)})})}),()=>a.ipcMain.removeHandler(dl)}function fX(e,t,n){return new Im(new pX(e),t,n).getRemoteMain()}var pX=class{constructor(e){this.#e=e,e.start(),e.on(`message`,e=>{this.#i||(e.data==null?this.#a(Error(`Peer closed MessagePort connection.`)):typeof e.data==`string`?this.#t?(this.#t(e.data),this.#t=void 0,this.#n=void 0):this.#r.push(e.data):this.#a(TypeError(`Received non-string message from MessagePort.`)))}),e.on(`close`,()=>{this.#a(Error(`MessagePort message error.`))})}#e;#t;#n;#r=[];#i;async send(e){if(this.#i)throw this.#i;this.#e.postMessage(e)}async receive(){if(this.#r.length>0){let e=this.#r.shift();if(e!=null)return e}if(this.#i)throw this.#i;return new Promise((e,t)=>{this.#t=e,this.#n=t})}abort(e){try{this.#e.postMessage(null)}catch{}this.#e.close(),this.#i||=e}#a(e){this.#i||(this.#i=e,this.#n&&=(this.#n(e),this.#t=void 0,void 0))}},mX=3,hX=35;function gX(e){return e.type===`tray-menu-threads-changed`}var _X=class{nativeTrayClickSuppressionReason=null;clearNativeTrayClickSuppressionTimeout=null;chronicleTrayIconRefreshInterval=null;chronicleTrayIconState=`default`;isNativeTrayMenuOpen=!1;trayMenuThreads={runningThreads:[],unreadThreads:[],pinnedThreads:[],recentThreads:[],usageLimits:[]};constructor(e,t,n,r,i,a,o,s,c,l){if(this.tray=e,this.onTrayButtonClick=t,this.onTrayMenuOpenMainWindow=n,this.onTrayMenuOpenNewThread=r,this.onTrayMenuOpenRecentThread=i,this.getChronicleSidecarControlState=a,this.toggleChronicleSidecar=o,this.trayIcons=s,this.nativeIntl=c,this.appName=l,process.platform===`darwin`){this.tray.on(`mouse-down`,()=>{if(this.clearPendingNativeTrayClickSuppression(),this.isNativeTrayMenuOpen){this.nativeTrayClickSuppressionReason=`close`;return}this.nativeTrayClickSuppressionReason=`open`,this.openNativeTrayMenu()}),this.tray.on(`click`,()=>{this.consumeIgnoredNativeTrayClick()||this.openNativeTrayMenu()}),this.tray.on(`right-click`,()=>{this.consumeIgnoredNativeTrayClick()||this.openNativeTrayMenu()}),this.getChronicleSidecarControlState!=null&&this.trayIcons.chronicleRunningIcon!=null&&(this.updateChronicleTrayIcon(),this.chronicleTrayIconRefreshInterval=setInterval(()=>{this.updateChronicleTrayIcon()},1e3),this.chronicleTrayIconRefreshInterval.unref?.());return}this.tray.on(`click`,()=>{this.onTrayButtonClick()}),this.tray.on(`right-click`,()=>{this.openNativeTrayMenu()})}destroy(){this.chronicleTrayIconRefreshInterval!=null&&(clearInterval(this.chronicleTrayIconRefreshInterval),this.chronicleTrayIconRefreshInterval=null),this.tray.destroy()}async handleMessage(e){switch(e.type){case`tray-menu-threads-changed`:this.trayMenuThreads=e.trayMenuThreads;return}}consumeIgnoredNativeTrayClick(){return this.nativeTrayClickSuppressionReason==null?!1:(this.clearNativeTrayClickSuppression(),!0)}openNativeTrayMenu(){this.updateChronicleTrayIcon();let e=a.Menu.buildFromTemplate(this.getNativeTrayMenuItems());e.once(`menu-will-show`,()=>{this.isNativeTrayMenuOpen=!0}),e.once(`menu-will-close`,()=>{this.isNativeTrayMenuOpen=!1,this.handleNativeTrayMenuClosed()}),this.tray.popUpContextMenu(e)}handleNativeTrayMenuClosed(){if(this.nativeTrayClickSuppressionReason!==`close`){this.clearNativeTrayClickSuppression();return}this.clearPendingNativeTrayClickSuppression(),this.clearNativeTrayClickSuppressionTimeout=setTimeout(()=>{this.nativeTrayClickSuppressionReason===`close`&&this.clearNativeTrayClickSuppression()},0),this.clearNativeTrayClickSuppressionTimeout.unref?.()}clearPendingNativeTrayClickSuppression(){this.clearNativeTrayClickSuppressionTimeout!=null&&(clearTimeout(this.clearNativeTrayClickSuppressionTimeout),this.clearNativeTrayClickSuppressionTimeout=null)}clearNativeTrayClickSuppression(){this.clearPendingNativeTrayClickSuppression(),this.nativeTrayClickSuppressionReason=null}getNativeTrayMenuItems(){let{pinnedThreads:e,recentThreads:t,runningThreads:n,unreadThreads:r,usageLimits:i}=this.trayMenuThreads,o=this.nativeIntl.formatMessage({messageId:tu,defaultMessage:nu}),s=this.nativeIntl.formatMessage({messageId:$l,defaultMessage:eu}),c=bX({label:this.nativeIntl.formatMessage({messageId:Gl,defaultMessage:Kl}),moreLabel:s,threads:n,projectlessLabel:o,onOpenThread:this.onTrayMenuOpenRecentThread}),l=bX({label:this.nativeIntl.formatMessage({messageId:Yl,defaultMessage:Xl}),moreLabel:s,threads:r,projectlessLabel:o,onOpenThread:this.onTrayMenuOpenRecentThread}),u=bX({label:this.nativeIntl.formatMessage({messageId:Ul,defaultMessage:Wl}),moreLabel:s,threads:e,projectlessLabel:o,onOpenThread:this.onTrayMenuOpenRecentThread}),d=bX({label:this.nativeIntl.formatMessage({messageId:ql,defaultMessage:Jl}),moreLabel:s,threads:t,projectlessLabel:o,onOpenThread:this.onTrayMenuOpenRecentThread}),f=process.platform!==`darwin`||i.length===0?[]:[{label:this.nativeIntl.formatMessage({messageId:Zl,defaultMessage:Ql}),enabled:!1},...i.map(({label:e})=>({label:e,enabled:!1}))],p=this.getChronicleSidecarControlState?.(),m=p?.enabled===!0?{label:vX(p),enabled:yX(p),click:async e=>{if(this.toggleChronicleSidecar==null)return;e.enabled=!1;let t=null;try{t=await this.toggleChronicleSidecar(),this.updateChronicleTrayIcon(t),e.label=vX(t)}finally{e.enabled=t==null?!0:yX(t)}}}:null,h=[c,l,u,d,f].filter(e=>e.length>0).flatMap((e,t)=>t===0?e:[{type:`separator`},...e]);return[...h,...h.length>0?[{type:`separator`}]:[],{label:this.nativeIntl.formatMessage({messageId:Vl,defaultMessage:Hl}),click:()=>{this.onTrayMenuOpenNewThread()}},...m==null?[]:[m],{type:`separator`},{label:this.nativeIntl.formatMessage({messageId:zl,defaultMessage:Bl,values:{appName:this.appName}}),click:()=>{this.onTrayMenuOpenMainWindow()}},{type:`separator`},{label:SX(this.appName),click:()=>{a.app.quit()}}]}updateChronicleTrayIcon(e=this.getChronicleSidecarControlState?.()){if(this.trayIcons.chronicleRunningIcon==null)return;let t=e?.running===!0?`chronicle-running`:`default`;t!==this.chronicleTrayIconState&&(this.chronicleTrayIconState=t,this.tray.setImage(t===`chronicle-running`?this.trayIcons.chronicleRunningIcon:this.trayIcons.defaultIcon))}};function vX(e){switch(e.state){case`disabled`:case`stopped`:return`Resume Chronicle`;case`running`:case`restarting`:return`Pause Chronicle`;case`starting`:return`Starting Chronicle...`;case`stopping`:return`Stopping Chronicle...`}}function yX(e){return e.state!==`starting`&&e.state!==`stopping`}function bX({label:e,moreLabel:t,threads:n,projectlessLabel:r,onOpenThread:i}){if(n.length===0)return[];let a=n.slice(0,mX),o=n.slice(mX);return[{label:e,enabled:!1},...a.map(e=>xX({thread:e,projectlessLabel:r,onOpenThread:i})),...o.length>0?[{label:t,submenu:o.map(e=>xX({thread:e,projectlessLabel:r,onOpenThread:i}))}]:[]]}function xX({thread:e,projectlessLabel:t,onOpenThread:n}){let r=Array.from(e.title);return{label:r.length<=hX?e.title:`${r.slice(0,hX-1).join(``).trimEnd()}…`,sublabel:e.isProjectless?t:e.projectLabel,click:()=>{n(e.path)}}}function SX(e){let t=a.Menu.buildFromTemplate([{role:`quit`}]);return(Array.isArray(t)?t:t.items)[0]?.label??`Quit ${e}`}var CX=6e4,wX=new Map,TX=t.Ci(`mode`,[t.Oi({mode:t.Ti(`create`)}),t.Oi({mode:t.Ti(`edit`),commentId:t.ji()}),t.Oi({mode:t.Ti(`design`),groupId:t.ji()})]),EX=t.Oi({x:t.Di(),y:t.Di(),width:t.Di(),height:t.Di()}),DX=t.Oi({x:t.Di(),y:t.Di()}),OX=t.Oi({provider:t.Ti(`google-docs`),kind:t.Ti(`google-docs`),documentId:t.ji(),tabId:t.ji().optional(),documentTitle:t.ji().optional(),selectedText:t.ji().optional(),visibleText:t.ji().optional()}),kX=t.Oi({pageUrl:t.ji(),frameUrl:t.ji().nullable(),title:t.ji(),elementPath:t.ji(),point:t.Oi({xPercent:t.Di(),y:t.Di()}),rect:EX,isFixed:t.xi(),framePath:t.bi(t.ji()),documentContext:OX.optional(),scrollContainers:t.bi(t.Oi({selector:t.ji(),scrollLeft:t.Di(),scrollTop:t.Di()})).optional()}),AX=t.Ci(`kind`,[kX.extend({kind:t.Ti(`element`),role:t.ji().nullable(),name:t.ji().nullable(),selector:t.ji().nullable(),nearbyText:t.ji().nullable()}),kX.extend({kind:t.Ti(`region`),role:t.yi(),name:t.yi(),selector:t.yi(),nearbyText:t.yi()})]),jX=t.Oi({anchor:AX,cardViewportRect:EX.optional(),viewportRect:EX.nullable(),viewportPoint:DX,viewportSize:t.Oi({width:t.Di(),height:t.Di()}).optional()}),MX=t.Oi({property:t.ji(),value:t.ji(),previousValue:t.ji(),placeholderValue:t.ji().optional()}),NX=t.Oi({value:t.ji(),previousValue:t.ji()}),PX=t.Oi({id:t.ji(),anchor:AX,declarations:t.bi(MX),draftAttribute:t.ji(),markerViewportPoint:DX.optional(),provenance:t.bi(t.Oi({property:t.ji(),selectorText:t.ji().optional(),sourceUrl:t.ji().optional(),sourceLine:t.Di().optional(),sourceColumn:t.Di().optional()})),selector:t.ji().nullable(),targetLabel:t.ji(),text:NX.optional(),viewportSize:t.Oi({width:t.Di(),height:t.Di()}).optional()}),FX=PX.extend({createdAt:t.ji(),updatedAt:t.ji(),status:t.Mi([t.Ti(`current`),t.Ti(`queued`)])}),IX=t.Ci(`type`,[t.Oi({type:t.Ti(`browser-sidebar-runtime-close-comment-preview`),commentId:t.ji()}),t.Oi({type:t.Ti(`browser-sidebar-runtime-comment-screenshot-ready`),commentId:t.ji(),annotationViewportRect:EX.nullable().optional(),markerViewportPoint:DX.optional(),skipScreenshotCapture:t.xi().optional()}),t.Oi({type:t.Ti(`browser-sidebar-runtime-exit-comment-mode`)}),t.Oi({type:t.Ti(`browser-sidebar-runtime-design-modifier-state`),pressed:t.xi()}),t.Oi({type:t.Ti(`browser-sidebar-runtime-focus-editor`)}),t.Oi({type:t.Ti(`browser-sidebar-runtime-image-drag-ended`)}),t.Oi({type:t.Ti(`browser-sidebar-runtime-image-drag-started`),sourceUrl:t.ji()}),t.Oi({type:t.Ti(`browser-sidebar-runtime-mouse-navigation`),direction:t.Mi([t.Ti(`back`),t.Ti(`forward`)])}),t.Oi({type:t.Ti(`browser-sidebar-runtime-open-comment-preview`),commentId:t.ji(),anchorState:jX}),t.Oi({type:t.Ti(`browser-sidebar-runtime-open-editor`),target:TX,anchorState:jX,designEditorState:PX.optional(),wantsScreenshot:t.xi().optional()}),t.Oi({type:t.Ti(`browser-sidebar-runtime-open-design-editor`),anchorState:jX,designEditorState:PX,designChange:FX.optional()}),t.Oi({type:t.Ti(`browser-sidebar-runtime-update-anchor`),target:TX,anchorState:jX.nullable()})]);function LX(){let e=!1,t=null,n=!1;return{allowQuitTemporarilyForUpdateInstall:r=>{e=r?.allowWithoutPrompt??!0,n=r?.skipDrainBeforeQuit??!1,t&&clearTimeout(t),t=setTimeout(()=>{e=!1,n=!1,t=null},6e4),t.unref()},canQuitWithoutPrompt:()=>e,markQuitApproved:()=>{e=!0},shouldSkipDrainBeforeQuit:()=>n}}function RX({hotkeyWindowLifecycleManager:e,globalDictationLifecycleManager:t,flushAndDisposeContext:n,disposables:r}){e.dispose(),t.dispose(),n(),r.dispose()}function zX({desktopSentry:e,hotkeyWindowLifecycleManager:r,globalDictationLifecycleManager:i,codexHome:o,nativeContextMenuIconSearchRoots:s,getContextForWebContents:c,getPrimaryWindow:l,showPrimaryWindow:u,ensureWindow:d,createFreshWindow:f,setDesktopFeatureAvailability:p,restoreAvatarOverlayOpenState:m,reloadBundledPlugins:h,setMacMenuBarEnabled:g,navigateToRoute:_,getDockMenuController:v,getTrayController:y,isTrustedIpcEvent:b}){dX(s,b),sX(b);let x=!1;a.ipcMain.handle(sl,async(e,o)=>{if(!b(e))return;if(o.type===`electron-avatar-overlay-restore-ready`){x||(x=!0,await m(e.sender));return}if(o.type===`electron-desktop-features-changed`){c(e.sender)?.setChronicleConfig(o.codexChronicleConfig),p({ambientSuggestions:o.ambientSuggestions,appshotsEnabled:o.appshotsEnabled,inAppBrowserUse:o.inAppBrowserUse,inAppBrowserUseAllowed:o.inAppBrowserUseAllowed,browserPane:o.browserPane,externalBrowserUse:o.externalBrowserUse,externalBrowserUseAllowed:o.externalBrowserUseAllowed,computerUse:o.computerUse,computerUseNodeRepl:o.computerUseNodeRepl,sites:o.sites,control:o.control,dil:o.dil,multiBrowserTabs:o.multiBrowserTabs,multiWindow:o.multiWindow,processManager:o.processManager});return}if(o.type===`mac-menu-bar-enabled-changed`){await g(o.enabled);return}if(o.type===`reload-bundled-plugins`){await h?.();return}if(o.type===`open-current-main-window`||o.type===`open-in-main-window`){let e=o.type===`open-current-main-window`?null:o.path;if(e!=null&&!t.it(e))return;r.hide();let n=l(),i=n!=null||e==null?await d():await f(e);i&&(o.type===`open-current-main-window`&&o.stealFocus===!0?u({stealFocus:!0}):(i.isMinimized()&&i.restore(),i.show(),i.focus()),n!=null&&e!=null&&_(i,e));return}if(o.type===`open-in-new-window`){if(!t.it(o.path))return;r.hide();let e=await f(o.path);e&&(e.isMinimized()&&e.restore(),e.show(),e.focus());return}if(o.type===`show-settings`){r.hide();let e=await d();if(!e)return;e.isMinimized()&&e.restore(),e.show(),e.focus(),_(e,`/settings/${o.section}`);return}if(o.type===`quit-app`){a.app.quit();return}if(gX(o)){await Promise.all([y()?.handleMessage(o),v?.()?.handleMessage(o)]);return}if(await i.handleMessage(e,o))return;let s=c(e.sender);if(!s){n.Lr().warning(`Message received for unknown window context`);return}await s.handleMessage(e.sender,o)}),a.ipcMain.handle(cl,async(e,t)=>{let r=IX.safeParse(t);if(!r.success){n.Lr().warning(`Invalid browser sidebar runtime message received`);return}let i=a.BrowserWindow.fromWebContents(e.sender);if(i==null){n.Lr().warning(`Browser sidebar runtime message received without owner window`);return}let o=c(i.webContents);if(o==null){n.Lr().warning(`Browser sidebar runtime message received for unknown window context`);return}await o.handleMessage(e.sender,r.data)}),a.ipcMain.handle(vl,async(e,t)=>b(e)?n.Dt({codexHome:o,params:t}):null),a.ipcMain.handle(bl,t=>{if(!b(t))return;let n=Error(`Desktop Sentry test error (debug button)`);e.captureException(n,{tags:{trigger:`debug-button`}})}),a.ipcMain.on(xl,e=>{if(!b(e))return;let[t]=e.ports,n=c(e.sender)?.createAppHost(e.sender);fX(t,n)})}function BX({buildFlavor:e,getContextForWebContents:t,isTrustedIpcEvent:n,usesOwlAppShell:i}){a.ipcMain.on(pl,e=>{if(!n(e)){e.returnValue=null;return}e.returnValue=r.A}),a.ipcMain.on(ml,t=>{if(!n(t)){t.returnValue=null;return}t.returnValue=e}),a.ipcMain.on(hl,e=>{if(!n(e)){e.returnValue=!1;return}e.returnValue=i}),a.ipcMain.on(_l,e=>{if(!n(e)){e.returnValue={};return}e.returnValue=t(e.sender)?.getSharedObjectSnapshot()??{}})}function VX({isWindows:e,disableQuitConfirmationPrompt:t,quitState:r,windows:i,applicationMenuManager:o,ensureWindow:s,hotkeyWindowLifecycleManager:c,globalDictationLifecycleManager:l,globalState:u,settingsStore:d,flushAndDisposeContext:f,disposables:p,appEvent:m,errorReporter:h}){let g=!1,_=!1;a.app.on(`window-all-closed`,()=>{(process.platform===`darwin`&&!a.app.isPackaged||process.platform!==`darwin`&&!e)&&a.app.quit()}),a.app.on(`before-quit`,o=>{if(el()){o.preventDefault();return}let s=nK(),c=n.Xn().some(e=>e.status===`ACTIVE`);if(e||r.canQuitWithoutPrompt()||t||!s&&!c){_=!0,i.markAppQuitting();return}let l=a.app.getName();if(a.dialog.showMessageBoxSync({type:`warning`,buttons:[`Quit`,`Cancel`],defaultId:0,cancelId:1,noLink:!0,title:`Quit ${l}?`,message:`Quit ${l}?`,detail:HX({hasInProgressLocalConversation:s,hasEnabledAutomations:c})})!==0){o.preventDefault();return}r.markQuitApproved(),_=!0,i.markAppQuitting()}),a.app.on(`child-process-gone`,(e,t)=>{if(t.reason!==`clean-exit`){if(UX(t)){WX(t);return}h.reportFatal(Error(`Child process gone (${t.type})`),{tags:{errorType:`child-process-gone`,processType:t.type,reason:t.reason},extra:{exitCode:t.exitCode,name:t.name,serviceName:t.serviceName}})}}),a.app.on(`activate`,()=>{_||(i.showLastActivePrimaryWindow()||s(),o.refresh())}),a.app.on(`browser-window-blur`,()=>{a.BrowserWindow.getFocusedWindow()??m.emit(`background`)}),a.app.on(`browser-window-focus`,()=>{m.emit(`foreground`),o.refresh()}),a.app.on(`will-quit`,e=>{if(_=!0,!g){if(r.shouldSkipDrainBeforeQuit()){RX({hotkeyWindowLifecycleManager:c,globalDictationLifecycleManager:l,flushAndDisposeContext:f,disposables:p});return}e.preventDefault(),g=!0,c.dispose(),l.dispose(),Promise.all([u.flush(),d.flush()]).finally(()=>{f(),p.dispose(),a.app.quit()})}})}function HX({hasInProgressLocalConversation:e,hasEnabledAutomations:t}){return e&&t?`Active local threads on this machine will be interrupted and enabled automations won't run while Codex is closed`:e?`Active local threads on this machine will be interrupted`:`Enabled automations won't run while Codex is closed`}function UX(e){return e.type===`GPU`||e.type===`Utility`&&e.serviceName===`audio.mojom.AudioService`}function WX(e){let t=`${e.type}:${e.serviceName??e.name??``}:${e.reason}`,r=Date.now(),i=wX.get(t);i!=null&&r-ie.settingsStore.getEffective(t.w.integratedTerminalShell.key),lu.terminal_command??null,async r=>{let a=await e.gitManager.getWorktreeRepository(t.mn(r),i);return a==null?null:n.rt(a)},e=>this.getHostConfigForHostId(e),e=>this.appServerConnectionRegistry.getMaybeConnection(e));this.remoteConnectionsHandler=new aY(this.appState,this.sharedObjectRepository,I,this.appServerConnectionRegistry,{desktopOriginator:e.desktopOriginator,devApiBaseUrl:e.devApiBaseUrl,prodApiBaseUrl:e.prodApiBaseUrl},i,this.remoteControlDeviceKeyClient,this.getHostConfigForHostId.bind(this),this.getAppServerClient.bind(this),this.createAndRegisterRemoteConnection.bind(this),this.disposeRemoteConnection.bind(this));let o=iJ({appServerConnectionRegistry:this.appServerConnectionRegistry,errorReporter:e.errorReporter,globalState:this.scopedState,hostId:I,sharedObjectRepository:this.sharedObjectRepository,windowManager:e.windowManager});this.primaryRuntimeService=o.rpc,this.fetchHandler=new hj(this.scopedState,e=>this.getRegisteredWindowIpcClient(e),this.appServerConnectionRegistry,e.gitManager,i,this.remoteConnectionsHandler,e.hotkeyWindowLifecycleManager,e.windowManager,a,o.isWorkspaceDependenciesFeatureEnabled,e=>this.getAppServerClient(e),e=>this.messageHandler.getWorktreeService(e),e.requestGitWorker,this.sharedObjectRepository,e.errorReporter,e.repoRoot,e.globalDictationHotkeyController,()=>{this.messageHandler.getBrowserSidebarManager().reloadOpenPages()},e.refreshApplicationMenu,e.requestComputerUseCaptureWorker,e.subscribeComputerUseCaptureWorkerEvent,()=>{this.messageHandler.getBrowserSidebarManager().refreshOwnerCommandAccelerators()},e.settingsStore),this.disposables.add(()=>this.fetchHandler.dispose()),this.disposables.add(o.startUpdatePolling());let s=Jj(this.scopedState);this.disposables.add(i.registerInternalNotificationHandler(e=>{e.method===`account/updated`&&e.params?.authMode==null&&s.clear()}));let c=new rM(this.fetchHandler,{desktopOriginator:e.desktopOriginator,devApiBaseUrl:e.devApiBaseUrl,integrityStateStore:s,messageChannel:e.messageChannel,appServerConnectionRegistry:this.appServerConnectionRegistry,prodApiBaseUrl:e.prodApiBaseUrl}),l=new wq({buildFlavor:e.buildFlavor,gitWorkerInvocationSampler:e.gitWorkerInvocationSampler});this.messageHandler=new gq(I,lu,i,e.windowManager,e.filePreviewManager,e.avatarOverlayManager,this.appServerConnectionRegistry,c,this.scopedState,this.sharedObjectRepository,a,e.gitManager,e.requestGitWorker,e.desktopNotificationManager,e.errorReporter,e.desktopSentry,e.updateWorkerSentryUser,e=>this.getRegisteredWindowIpcClient(e),e.inboxManager,e.datadogLogger,e.maxLogLevel,e.buildFlavor,e.sparkleManager,e.subscribeGitWorkerEvent,l,e=>this.getHostConfigForHostId(e),e.hasActiveComputerUseTurn,e.settingsStore),this.disposables.add(this.sharedObjectRepository.addSubscriber(e=>{if(e===`remote_connections`||e===`remote_control_connections`){this.remoteConnectionsHandler.reconcileRemoteConnections(this.getAllRemoteConnections());return}if(e===`local_remote_control_environment_id`||e===`local_remote_control_installation_id`){let e=this.sharedObjectRepository.get(`local_remote_control_environment_id`),t=this.sharedObjectRepository.get(`local_remote_control_installation_id`);e!=null&&this.appState.set(Ii,e),t!=null&&this.appState.set(Li,t),this.remoteConnectionsHandler.handleLocalRemoteControlIdentityChanged()}})),this.initialRemoteConnectionsRefresh=Promise.all([this.remoteConnectionsHandler.refreshRemoteConnections(),this.remoteConnectionsHandler.refreshLocalRemoteControlClientId()]).then(()=>void 0).catch(e=>{nX.warning(`Failed to refresh remote connections`,{safe:{},sensitive:{error:e}})})}createAppHost(e){return new Rm({debug:new L_({debugWindowManager:this.options.windowManager.debugWindowManager,getBrowserSnapshot:()=>this.messageHandler.getBrowserSidebarManager().getDebugSnapshot(),openBrowserTabOwner:e=>this.messageHandler.getBrowserSidebarManager().openDebugTabOwner(e),origin:e}),hotkeyWindowHotkeys:this.options.hotkeyWindowLifecycleManager.rpcFor(e),appshotHotkeys:this.options.appshotHotkeyController.rpc,customAvatars:this.createCustomAvatarsService(),fileAttachments:{countFolderFiles:({folderPath:e,hostId:t})=>n.Et(e,this.getAppServerClient(t))},owlFeatures:r.x(),primaryRuntime:this.primaryRuntimeService,chromeNativeHost:this.createChromeNativeHostService(),projectWritableRoots:this.messageHandler.createProjectWritableRootsService(e),systemPermissions:LY(e),threadArchive:this.createThreadArchiveService(),codexMicro:this.createCodexMicroHostService(e),notifications:new NY(this.options.windowManager,e,this.options.desktopNotificationManager)})}async applyCodexAppConfigFromDisk(e){let t=await Ac(e);return t.status===`loaded`?{status:`applied`,configPath:t.configPath,result:await this.applyCodexAppConfig(t.config)}:t}getCodexMicroService(){return this.codexMicroService==null?(this.codexMicroServicePromise??=Promise.resolve().then(()=>require(`./codex-micro-service-CYwSISMZ.js`)).then(({CodexMicroService:e})=>{let t=new e({onDeviceStateChanged:e=>{this.options.windowManager.sendMessageToAllWindows({type:`codex-micro-device-state-changed`,state:e})},onHidEvent:e=>{let t=this.options.windowManager.getPrimaryWindow();t!=null&&this.options.windowManager.sendMessageToWindow(t,{type:`codex-micro-hid-event`,event:e})},onJoystickEvent:e=>{let t=this.options.windowManager.getPrimaryWindow();t!=null&&this.options.windowManager.sendMessageToWindow(t,{type:`codex-micro-joystick-event`,event:e})}});return this.codexMicroService=t,this.disposables.add(()=>{t.dispose()}),t}).finally(()=>{this.codexMicroServicePromise=null}),this.codexMicroServicePromise):Promise.resolve(this.codexMicroService)}createCustomAvatarsService(){return{load:()=>n.Rt({appServerClient:this.getAppServerClient(),preferWsl:!!process.env.WSL_DISTRO_NAME})}}createChromeNativeHostService(){return y_({devRuntimeRepoRoot:process.env.NODE_ENV===`development`?this.options.repoRoot:void 0,getCodexHome:e=>this.getAppServerClient(e).codexHome(),getHostConfig:e=>this.getHostConfigForHostId(e)})}createThreadArchiveService(){return{archiveInactiveThread:async({hostId:e,threadId:r})=>{let i=this.getAppServerClient(e);if(t.un(i.hostConfig))throw Error(`Archiving inactive chats is only supported locally`);let a=await n.rr({codexHome:await i.codexHome(),threadId:r});return a&&this.appServerConnectionRegistry.getConnection(e).handleArchivedThreadSideEffects(r),{success:a}}}}createCodexMicroHostService(e){return{getState:async()=>{let e=await this.getCodexMicroService();return e?.start(),e?.getState()??{status:`not-detected`,error:null}},getInputMonitoringPermissionStatus:async()=>jq(),openInputMonitoringSettings:async()=>{try{await a.shell.openExternal(rX)}catch(e){nX.error(`Open input monitoring settings failed`,{safe:{},sensitive:{error:e}})}},updateLighting:async t=>this.options.windowManager.getPrimaryWindow()?.webContents===e?await(await this.getCodexMicroService())?.updateLighting(t)??!1:!1}}async applyCodexAppConfig(e){await this.initialRemoteConnectionsRefresh;let n=c_({config:e,globalState:this.appState}),{remoteConnections:r}=await this.remoteConnectionsHandler.refreshRemoteConnections(),i=l_({config:e,globalState:this.appState,remoteConnections:r});return n&&i.changedGlobalStateKeys.unshift(t._r.CODEX_MANAGED_REMOTE_CONNECTIONS),i.changedGlobalStateKeys.includes(t._r.REMOTE_CONNECTION_AUTO_CONNECT_BY_HOST_ID)&&await this.remoteConnectionsHandler.refreshRemoteConnections(),i.changedGlobalStateKeys.length>0&&this.options.windowManager.sendMessageToAllWindows({type:`global-state-updated`,keys:i.changedGlobalStateKeys}),i.remoteProjectsChanged&&this.options.windowManager.sendMessageToAllWindows({type:`workspace-root-options-updated`}),this.remoteConnectionsHandler.connectRemoteConnectionsAndLogFailures(i.remoteConnectionHostIdsToConnect),i}registerWindow(e){let{webContents:t}=e,n=new eK(t);this.registeredWindows.set(t.id,n),t.once(`destroyed`,()=>{this.registeredWindows.delete(t.id)});for(let e of this.appServerConnectionRegistry.getAllHostIds())this.appServerConnectionRegistry.getConnection(e).registerWebviewWindow(n);this.registerIpcClientForWebContents(e.webContents)}handleMessage(e,t){return this.messageHandler.handleMessage(e,t)}getBrowserSidebarManager(){return this.messageHandler.getBrowserSidebarManager()}getBrowserSessionRegistry(){return this.messageHandler.getBrowserSessionRegistry()}flushTelemetry(){this.messageHandler.flushTelemetry()}dispose(){let e=this.appServerConnectionRegistry.getAllHostIds();this.messageHandler.dispose(),this.disposables.dispose();for(let t of e)this.appServerConnectionRegistry.getMaybeConnection(t)?.dispose(),this.appServerConnectionRegistry.removeConnection(t),this.appServerClients.delete(t);this.registeredWindows.clear();for(let{dispose:e}of this.ipcClientsByWebContentsId.values())e();this.ipcClientsByWebContentsId.clear()}getMessageHandler(){return this.messageHandler}getSharedObject(e){return this.sharedObjectRepository.get(e)}setChronicleConfig(e){this.sharedObjectRepository.set(`codex_chronicle_config`,e)}getSharedObjectSnapshot(){return this.sharedObjectRepository.getSnapshot()}getHostConfigForHostId(e){if(e===`local`)return lu;let t=this.getAllRemoteConnections().find(t=>t.hostId===e);if(!t)throw Error(`Host config for host ID ${e} not found`);return AY(t)}getAllRemoteConnections(){return[...this.sharedObjectRepository.get(`remote_connections`)??[],...this.sharedObjectRepository.get(`remote_control_connections`)??[]]}createAppServerConnection(e,i=lu,o=!1,s,c){let l={desktopOriginator:this.options.desktopOriginator,devApiBaseUrl:this.options.devApiBaseUrl,prodApiBaseUrl:this.options.prodApiBaseUrl},u=In({env:process.env,resourcesPath:process.resourcesPath}),d;if(t.ln(i)){if(s==null)throw Error(`Remote control transport requires a desktop app-server client for authentication.`);if(c==null)throw Error(`Remote control transport requires the remote-control device-key client.`);d=aX({transportKind:`remote-control`,hostConfig:i,repoRoot:this.options.repoRoot,resourcesPath:u,desktopApiOptions:l,desktopAuthAppServerClient:s,remoteControlDeviceKeyClient:c,globalState:this.appState})}else d=aX({transportKind:`standard`,hostConfig:i,repoRoot:this.options.repoRoot,resourcesPath:u,desktopApiOptions:l,globalState:this.appState});let f=this.options.hostProcess.getVersion(),p=new n.Tn(this.options.messageChannel,{buildFlavor:this.options.buildFlavor,clientInfo:{name:Tl,title:`Codex Desktop`,version:f},defaultServiceName:El,repoRoot:this.options.repoRoot,resourcesPath:u,errorReporter:this.options.errorReporter,sharedObjectRepository:this.sharedObjectRepository,hostId:e,hostConfig:i,onArchiveCleanup:async({conversationId:t,cwd:n,replacementOwnerThreadId:r,replacementOwnerCwd:i})=>{await this.messageHandler.getWorktreeService(e).handleArchiveCleanup({conversationId:t,cwd:n,replacementOwnerThreadId:r,replacementOwnerCwd:i})},transport:d,hostProcess:this.options.hostProcess,isOnline:()=>a.net.isOnline(),supportsAttestationRequests:xe,isMcpAppsDilEnabled:()=>Be().dil,beforeConnect:i.id===`local`?()=>dY({hostConfig:i}):void 0,ensureAuth:o,getRemoteConnectionMaxRetryAttempts:()=>this.appState.get(t._r.REMOTE_CONNECTION_MAX_RETRY_ATTEMPTS)??null});return p.registerInternalServerRequestHandler({methods:[`item/commandExecution/requestApproval`,`mcpServer/elicitation/request`],handler:t=>(this.messageHandler.revealWindowsReviewRequest(e,t),null)}),p.registerInternalServerRequestHandler({methods:[`attestation/generate`],handler:Ce({bundleIdentifier:r.D(this.options.buildFlavor),resourcesPath:u})}),p}createAndRegisterRemoteConnection(e){let t=AY(e),n=this.createAppServerConnection(e.hostId,t,!0,this.getLocalAppServerClient(),this.remoteControlDeviceKeyClient);this.appServerClients.set(e.hostId,n);for(let e of this.registeredWindows.values())n.registerWebviewWindow(e);return n}disposeRemoteConnection(e){let t=this.appServerConnectionRegistry.getMaybeConnection(e);t&&(t.dispose(),this.appServerConnectionRegistry.removeConnection(e),this.appServerClients.delete(e))}getLocalAppServerClient(){return this.appServerConnectionRegistry.getConnection(I)}getAppServerClient(e=I){let t=this.appServerClients.get(e);if(!t)throw Error(`App server client for host ID ${e} not found`);return t}registerIpcClientForWebContents(e){if(this.appServerConnectionRegistry.getConnection(`local`).getTransportKind()!==`stdio`||this.ipcClientsByWebContentsId.has(e.id))return;let t=new n.S(`desktop`,this.errorReporter),r=new n.Ln;r.add(t.addAnyBroadcastHandler(async t=>{let n={...t,type:`ipc-broadcast`};this.messageHandler.sendMessageToOrigin(e,n)}));let i=async t=>await this.messageHandler.getThreadRole(e,t.conversationId)===`owner`;r.add(t.addRequestHandler(`thread-follower-start-turn`,i,async t=>this.messageHandler.handleThreadFollowerStartTurnRequest(e,t))),r.add(t.addRequestHandler(`thread-follower-compact-thread`,i,async t=>this.messageHandler.handleThreadFollowerCompactThreadRequest(e,t))),r.add(t.addRequestHandler(`thread-follower-steer-turn`,i,async t=>this.messageHandler.handleThreadFollowerSteerTurnRequest(e,t))),r.add(t.addRequestHandler(`thread-follower-interrupt-turn`,i,async t=>this.messageHandler.handleThreadFollowerInterruptTurnRequest(e,t))),r.add(t.addRequestHandler(`thread-follower-update-thread-settings`,i,async t=>this.messageHandler.handleThreadFollowerUpdateThreadSettingsRequest(e,t))),r.add(t.addRequestHandler(`thread-follower-edit-last-user-turn`,i,async t=>this.messageHandler.handleThreadFollowerEditLastUserTurnRequest(e,t))),r.add(t.addRequestHandler(`thread-follower-command-approval-decision`,i,async t=>this.messageHandler.handleThreadFollowerCommandApprovalDecisionRequest(e,t))),r.add(t.addRequestHandler(`thread-follower-file-approval-decision`,i,async t=>this.messageHandler.handleThreadFollowerFileApprovalDecisionRequest(e,t))),r.add(t.addRequestHandler(`thread-follower-permissions-request-approval-response`,i,async t=>this.messageHandler.handleThreadFollowerPermissionsRequestApprovalResponseRequest(e,t))),r.add(t.addRequestHandler(`thread-follower-submit-user-input`,i,async t=>this.messageHandler.handleThreadFollowerSubmitUserInputRequest(e,t))),r.add(t.addRequestHandler(`thread-follower-submit-mcp-server-elicitation-response`,i,async t=>this.messageHandler.handleThreadFollowerSubmitMcpServerElicitationRequest(e,t))),r.add(t.addRequestHandler(`thread-follower-set-queued-follow-ups-state`,i,async t=>this.messageHandler.handleThreadFollowerSetQueuedFollowUpsStateRequest(e,t))),r.add(()=>t.dispose()),this.ipcClientsByWebContentsId.set(e.id,{client:t,dispose:()=>{r.dispose(),this.messageHandler.rejectPendingThreadFollowerActionRequestsForOrigin(e)}}),e.once(`destroyed`,()=>{this.disposeIpcClientForWebContents(e)})}disposeIpcClientForWebContents(e){let t=this.ipcClientsByWebContentsId.get(e.id);t&&(this.ipcClientsByWebContentsId.delete(e.id),t.dispose())}getRegisteredWindowIpcClient(e){return this.ipcClientsByWebContentsId.get(e.id)?.client??null}};function aX(e){let t=t_(e.hostConfig);if(t)return nX.info(`[ssh-websocket-v0] selected app-server transport`,{safe:{hostId:e.hostConfig.id}}),new e_(t);if(e.transportKind===`remote-control`)return new xh({hostConfig:e.hostConfig,appServerClient:e.desktopAuthAppServerClient,deviceKeyClient:e.remoteControlDeviceKeyClient,desktopApiOptions:e.desktopApiOptions,globalState:e.globalState});let r=n.pn(e.hostConfig);return r?new n.fn({hostConfig:e.hostConfig,websocketUrl:r}):new n.Dn({hostConfig:e.hostConfig,repoRoot:e.repoRoot,resourcesPath:e.resourcesPath,defaultOriginator:e.defaultOriginator})}function oX({app:e,globalState:t,settingsStore:n,windowServices:i,repoRoot:a,errorReporter:o,desktopSentry:s,datadogLogger:c,maxLogLevel:l,buildFlavor:u,sparkleManager:d,filePreviewManager:f,avatarOverlayManager:p,hotkeyWindowLifecycleManager:m,hasActiveComputerUseTurn:h,globalDictationHotkeyController:g,appshotHotkeyController:_,gitManager:v,requestComputerUseCaptureWorker:y,requestGitWorker:b,refreshApplicationMenu:x,subscribeComputerUseCaptureWorkerEvent:S,subscribeGitWorkerEvent:C,gitWorkerInvocationSampler:w,updateWorkerSentryUser:T,appEvent:E,onCompletedThreadsChanged:D}){let O=new kp(e),k=new Op({platform:process.platform,onCompletedThreadsChanged:D}),A=new Ap({inboxItemsChanged:e=>{i.sendMessageToAllWindows({type:e})}}),j=()=>{};r.l(t,lu.default_workspaces);let M=new iX({hostProcess:O,appGlobalState:t,settingsStore:n,windowManager:i.windowManager,globalState:t,repoRoot:a,errorReporter:o,desktopSentry:s,desktopNotificationManager:k,updateWorkerSentryUser:T,gitManager:v,inboxManager:A,datadogLogger:c,maxLogLevel:l,buildFlavor:u,sparkleManager:d,gitWorkerInvocationSampler:w,desktopOriginator:Tl,devApiBaseUrl:wl,prodApiBaseUrl:Cl,messageChannel:F,filePreviewManager:f,avatarOverlayManager:p,hotkeyWindowLifecycleManager:m,hasActiveComputerUseTurn:h,globalDictationHotkeyController:g,refreshApplicationMenu:x,appshotHotkeyController:_,requestComputerUseCaptureWorker:y,requestGitWorker:b,subscribeComputerUseCaptureWorkerEvent:S,subscribeGitWorkerEvent:C});return M.getMessageHandler().setOnBrowserSidebarStateChanged(j),M.appServerConnectionRegistry.getConnection(I).registerInternalNotificationHandler(e=>{if(e.method===`account/login/completed`){i.windowManager.showPrimaryWindow({stealFocus:!0});return}e.method===`turn/completed`&&E.emit(`turnComplete`)}),i.setWindowContext(M),{desktopNotificationManager:k,getWindowContext:()=>M,getElectronMessageHandlerForWindow:e=>{let t=i.getContextForWebContents(e.webContents);return t?t.getMessageHandler():null},getAppServerClientForHost:({hostId:e})=>{try{return M.getAppServerClient(e)}catch{return null}},getWorktreeCleanupInputsForHost:async({hostKey:r,threadIds:i})=>{let a=M.appServerConnectionRegistry.getMaybeConnection(r);return{threadMetadataById:a?await GK(a,i):Object.fromEntries(i.map(e=>[e,{updatedAtMs:Date.now(),isInProgress:!0,cwd:null,readFailed:!0}])),pinnedThreadIds:KK(t),protectPreMigrationOwnerlessWorktrees:ZK(t),autoCleanupEnabled:XK(n,t,e.isPackaged),keepCount:YK(n)}},setOnBrowserSidebarStateChanged:e=>{j=e,M.getMessageHandler().setOnBrowserSidebarStateChanged(j)},flushAndDisposeContext:()=>{M.dispose(),M.flushTelemetry()}}}function sX(e){return a.ipcMain.handle(fl,async(t,n)=>{if(!e(t))return;let r=a.BrowserWindow.fromWebContents(t.sender),i=a.Menu.getApplicationMenu()?.getMenuItemById(n.menuId)?.submenu;if(i)return new Promise(e=>{i.popup({window:r??void 0,x:Math.round(n.x),y:Math.round(n.y),callback:e})})}),()=>a.ipcMain.removeHandler(fl)}var cX=16;function lX(e){let{width:t,height:n}=e.getSize();return!t||!n||t<=cX&&n<=cX?e:e.resize({width:cX,height:cX,quality:`best`})}function uX(e,t){if(e)try{if(e.startsWith(`data:`))return lX(a.nativeImage.createFromDataURL(e));if(e.startsWith(`file://`))return lX(a.nativeImage.createFromPath((0,x.fileURLToPath)(e)));if(e.startsWith(`/`))return lX(a.nativeImage.createFromPath(e));for(let n of t){let t=new URL(e,`file://${n.endsWith(`/`)?n:`${n}/`}`).pathname;if((0,l.existsSync)(t)){let e=a.nativeImage.createFromPath(t);if(!e.isEmpty())return lX(e)}}}catch{}}function dX(e,t){return a.ipcMain.handle(dl,async(n,r)=>{if(!t(n))return{id:null};let i=a.BrowserWindow.fromWebContents(n.sender);return new Promise(t=>{let n=!1,o=e=>{n||(n=!0,t({id:e}))},s=t=>t.map(t=>t.type===`separator`?{type:`separator`}:{id:t.id,label:t.label,role:t.role,enabled:t.enabled??!0,icon:uX(t.icon,e),toolTip:t.toolTip,click:()=>o(t.id),submenu:t.submenu?s(t.submenu):void 0});a.Menu.buildFromTemplate(s(r)).popup({window:i??void 0,callback:()=>o(null)})})}),()=>a.ipcMain.removeHandler(dl)}function fX(e,t,n){return new Im(new pX(e),t,n).getRemoteMain()}var pX=class{constructor(e){this.#e=e,e.start(),e.on(`message`,e=>{this.#i||(e.data==null?this.#a(Error(`Peer closed MessagePort connection.`)):typeof e.data==`string`?this.#t?(this.#t(e.data),this.#t=void 0,this.#n=void 0):this.#r.push(e.data):this.#a(TypeError(`Received non-string message from MessagePort.`)))}),e.on(`close`,()=>{this.#a(Error(`MessagePort message error.`))})}#e;#t;#n;#r=[];#i;async send(e){if(this.#i)throw this.#i;this.#e.postMessage(e)}async receive(){if(this.#r.length>0){let e=this.#r.shift();if(e!=null)return e}if(this.#i)throw this.#i;return new Promise((e,t)=>{this.#t=e,this.#n=t})}abort(e){try{this.#e.postMessage(null)}catch{}this.#e.close(),this.#i||=e}#a(e){this.#i||(this.#i=e,this.#n&&=(this.#n(e),this.#t=void 0,void 0))}},mX=3,hX=35;function gX(e){return e.type===`tray-menu-threads-changed`}var _X=class{nativeTrayClickSuppressionReason=null;clearNativeTrayClickSuppressionTimeout=null;chronicleTrayIconRefreshInterval=null;chronicleTrayIconState=`default`;isNativeTrayMenuOpen=!1;trayMenuThreads={runningThreads:[],unreadThreads:[],pinnedThreads:[],recentThreads:[],usageLimits:[]};constructor(e,t,n,r,i,a,o,s,c,l){if(this.tray=e,this.onTrayButtonClick=t,this.onTrayMenuOpenMainWindow=n,this.onTrayMenuOpenNewThread=r,this.onTrayMenuOpenRecentThread=i,this.getChronicleSidecarControlState=a,this.toggleChronicleSidecar=o,this.trayIcons=s,this.nativeIntl=c,this.appName=l,process.platform===`darwin`){this.tray.on(`mouse-down`,()=>{if(this.clearPendingNativeTrayClickSuppression(),this.isNativeTrayMenuOpen){this.nativeTrayClickSuppressionReason=`close`;return}this.nativeTrayClickSuppressionReason=`open`,this.openNativeTrayMenu()}),this.tray.on(`click`,()=>{this.consumeIgnoredNativeTrayClick()||this.openNativeTrayMenu()}),this.tray.on(`right-click`,()=>{this.consumeIgnoredNativeTrayClick()||this.openNativeTrayMenu()}),this.getChronicleSidecarControlState!=null&&this.trayIcons.chronicleRunningIcon!=null&&(this.updateChronicleTrayIcon(),this.chronicleTrayIconRefreshInterval=setInterval(()=>{this.updateChronicleTrayIcon()},1e3),this.chronicleTrayIconRefreshInterval.unref?.());return}this.tray.on(`click`,()=>{this.onTrayButtonClick()}),this.tray.on(`right-click`,()=>{this.openNativeTrayMenu()})}destroy(){this.chronicleTrayIconRefreshInterval!=null&&(clearInterval(this.chronicleTrayIconRefreshInterval),this.chronicleTrayIconRefreshInterval=null),this.tray.destroy()}async handleMessage(e){switch(e.type){case`tray-menu-threads-changed`:this.trayMenuThreads=e.trayMenuThreads;return}}consumeIgnoredNativeTrayClick(){return this.nativeTrayClickSuppressionReason==null?!1:(this.clearNativeTrayClickSuppression(),!0)}openNativeTrayMenu(){this.updateChronicleTrayIcon();let e=a.Menu.buildFromTemplate(this.getNativeTrayMenuItems());e.once(`menu-will-show`,()=>{this.isNativeTrayMenuOpen=!0}),e.once(`menu-will-close`,()=>{this.isNativeTrayMenuOpen=!1,this.handleNativeTrayMenuClosed()}),this.tray.popUpContextMenu(e)}handleNativeTrayMenuClosed(){if(this.nativeTrayClickSuppressionReason!==`close`){this.clearNativeTrayClickSuppression();return}this.clearPendingNativeTrayClickSuppression(),this.clearNativeTrayClickSuppressionTimeout=setTimeout(()=>{this.nativeTrayClickSuppressionReason===`close`&&this.clearNativeTrayClickSuppression()},0),this.clearNativeTrayClickSuppressionTimeout.unref?.()}clearPendingNativeTrayClickSuppression(){this.clearNativeTrayClickSuppressionTimeout!=null&&(clearTimeout(this.clearNativeTrayClickSuppressionTimeout),this.clearNativeTrayClickSuppressionTimeout=null)}clearNativeTrayClickSuppression(){this.clearPendingNativeTrayClickSuppression(),this.nativeTrayClickSuppressionReason=null}getNativeTrayMenuItems(){let{pinnedThreads:e,recentThreads:t,runningThreads:n,unreadThreads:r,usageLimits:i}=this.trayMenuThreads,o=this.nativeIntl.formatMessage({messageId:tu,defaultMessage:nu}),s=this.nativeIntl.formatMessage({messageId:$l,defaultMessage:eu}),c=bX({label:this.nativeIntl.formatMessage({messageId:Gl,defaultMessage:Kl}),moreLabel:s,threads:n,projectlessLabel:o,onOpenThread:this.onTrayMenuOpenRecentThread}),l=bX({label:this.nativeIntl.formatMessage({messageId:Yl,defaultMessage:Xl}),moreLabel:s,threads:r,projectlessLabel:o,onOpenThread:this.onTrayMenuOpenRecentThread}),u=bX({label:this.nativeIntl.formatMessage({messageId:Ul,defaultMessage:Wl}),moreLabel:s,threads:e,projectlessLabel:o,onOpenThread:this.onTrayMenuOpenRecentThread}),d=bX({label:this.nativeIntl.formatMessage({messageId:ql,defaultMessage:Jl}),moreLabel:s,threads:t,projectlessLabel:o,onOpenThread:this.onTrayMenuOpenRecentThread}),f=process.platform!==`darwin`||i.length===0?[]:[{label:this.nativeIntl.formatMessage({messageId:Zl,defaultMessage:Ql}),enabled:!1},...i.map(({label:e})=>({label:e,enabled:!1}))],p=this.getChronicleSidecarControlState?.(),m=p?.enabled===!0?{label:vX(p),enabled:yX(p),click:async e=>{if(this.toggleChronicleSidecar==null)return;e.enabled=!1;let t=null;try{t=await this.toggleChronicleSidecar(),this.updateChronicleTrayIcon(t),e.label=vX(t)}finally{e.enabled=t==null?!0:yX(t)}}}:null,h=[c,l,u,d,f].filter(e=>e.length>0).flatMap((e,t)=>t===0?e:[{type:`separator`},...e]);return[...h,...h.length>0?[{type:`separator`}]:[],{label:this.nativeIntl.formatMessage({messageId:Vl,defaultMessage:Hl}),click:()=>{this.onTrayMenuOpenNewThread()}},...m==null?[]:[m],{type:`separator`},{label:this.nativeIntl.formatMessage({messageId:zl,defaultMessage:Bl,values:{appName:this.appName}}),click:()=>{this.onTrayMenuOpenMainWindow()}},{type:`separator`},{label:SX(this.appName),click:()=>{a.app.quit()}}]}updateChronicleTrayIcon(e=this.getChronicleSidecarControlState?.()){if(this.trayIcons.chronicleRunningIcon==null)return;let t=e?.running===!0?`chronicle-running`:`default`;t!==this.chronicleTrayIconState&&(this.chronicleTrayIconState=t,this.tray.setImage(t===`chronicle-running`?this.trayIcons.chronicleRunningIcon:this.trayIcons.defaultIcon))}};function vX(e){switch(e.state){case`disabled`:case`stopped`:return`Resume Chronicle`;case`running`:case`restarting`:return`Pause Chronicle`;case`starting`:return`Starting Chronicle...`;case`stopping`:return`Stopping Chronicle...`}}function yX(e){return e.state!==`starting`&&e.state!==`stopping`}function bX({label:e,moreLabel:t,threads:n,projectlessLabel:r,onOpenThread:i}){if(n.length===0)return[];let a=n.slice(0,mX),o=n.slice(mX);return[{label:e,enabled:!1},...a.map(e=>xX({thread:e,projectlessLabel:r,onOpenThread:i})),...o.length>0?[{label:t,submenu:o.map(e=>xX({thread:e,projectlessLabel:r,onOpenThread:i}))}]:[]]}function xX({thread:e,projectlessLabel:t,onOpenThread:n}){let r=Array.from(e.title);return{label:r.length<=hX?e.title:`${r.slice(0,hX-1).join(``).trimEnd()}…`,sublabel:e.isProjectless?t:e.projectLabel,click:()=>{n(e.path)}}}function SX(e){let t=a.Menu.buildFromTemplate([{role:`quit`}]);return(Array.isArray(t)?t:t.items)[0]?.label??`Quit ${e}`}var CX=6e4,wX=new Map,TX=t.Ci(`mode`,[t.Oi({mode:t.Ti(`create`)}),t.Oi({mode:t.Ti(`edit`),commentId:t.ji()}),t.Oi({mode:t.Ti(`design`),groupId:t.ji()})]),EX=t.Oi({x:t.Di(),y:t.Di(),width:t.Di(),height:t.Di()}),DX=t.Oi({x:t.Di(),y:t.Di()}),OX=t.Oi({provider:t.Ti(`google-docs`),kind:t.Ti(`google-docs`),documentId:t.ji(),tabId:t.ji().optional(),documentTitle:t.ji().optional(),selectedText:t.ji().optional(),visibleText:t.ji().optional()}),kX=t.Oi({pageUrl:t.ji(),frameUrl:t.ji().nullable(),title:t.ji(),elementPath:t.ji(),point:t.Oi({xPercent:t.Di(),y:t.Di()}),rect:EX,isFixed:t.xi(),framePath:t.bi(t.ji()),documentContext:OX.optional(),scrollContainers:t.bi(t.Oi({selector:t.ji(),scrollLeft:t.Di(),scrollTop:t.Di()})).optional()}),AX=t.Ci(`kind`,[kX.extend({kind:t.Ti(`element`),role:t.ji().nullable(),name:t.ji().nullable(),selector:t.ji().nullable(),nearbyText:t.ji().nullable()}),kX.extend({kind:t.Ti(`region`),role:t.yi(),name:t.yi(),selector:t.yi(),nearbyText:t.yi()})]),jX=t.Oi({anchor:AX,cardViewportRect:EX.optional(),viewportRect:EX.nullable(),viewportPoint:DX,viewportSize:t.Oi({width:t.Di(),height:t.Di()}).optional()}),MX=t.Oi({property:t.ji(),value:t.ji(),previousValue:t.ji(),placeholderValue:t.ji().optional()}),NX=t.Oi({value:t.ji(),previousValue:t.ji()}),PX=t.Oi({id:t.ji(),anchor:AX,declarations:t.bi(MX),draftAttribute:t.ji(),markerViewportPoint:DX.optional(),provenance:t.bi(t.Oi({property:t.ji(),selectorText:t.ji().optional(),sourceUrl:t.ji().optional(),sourceLine:t.Di().optional(),sourceColumn:t.Di().optional()})),selector:t.ji().nullable(),targetLabel:t.ji(),text:NX.optional(),viewportSize:t.Oi({width:t.Di(),height:t.Di()}).optional()}),FX=PX.extend({createdAt:t.ji(),updatedAt:t.ji(),status:t.Mi([t.Ti(`current`),t.Ti(`queued`)])}),IX=t.Ci(`type`,[t.Oi({type:t.Ti(`browser-sidebar-runtime-close-comment-preview`),commentId:t.ji()}),t.Oi({type:t.Ti(`browser-sidebar-runtime-comment-screenshot-ready`),commentId:t.ji(),annotationViewportRect:EX.nullable().optional(),markerViewportPoint:DX.optional(),skipScreenshotCapture:t.xi().optional()}),t.Oi({type:t.Ti(`browser-sidebar-runtime-exit-comment-mode`)}),t.Oi({type:t.Ti(`browser-sidebar-runtime-design-modifier-state`),pressed:t.xi()}),t.Oi({type:t.Ti(`browser-sidebar-runtime-focus-editor`)}),t.Oi({type:t.Ti(`browser-sidebar-runtime-image-drag-ended`)}),t.Oi({type:t.Ti(`browser-sidebar-runtime-image-drag-started`),sourceUrl:t.ji()}),t.Oi({type:t.Ti(`browser-sidebar-runtime-mouse-navigation`),direction:t.Mi([t.Ti(`back`),t.Ti(`forward`)])}),t.Oi({type:t.Ti(`browser-sidebar-runtime-open-comment-preview`),commentId:t.ji(),anchorState:jX}),t.Oi({type:t.Ti(`browser-sidebar-runtime-open-editor`),target:TX,anchorState:jX,designEditorState:PX.optional(),wantsScreenshot:t.xi().optional()}),t.Oi({type:t.Ti(`browser-sidebar-runtime-open-design-editor`),anchorState:jX,designEditorState:PX,designChange:FX.optional()}),t.Oi({type:t.Ti(`browser-sidebar-runtime-update-anchor`),target:TX,anchorState:jX.nullable()})]);function LX(){let e=!1,t=null,n=!1;return{allowQuitTemporarilyForUpdateInstall:r=>{e=r?.allowWithoutPrompt??!0,n=r?.skipDrainBeforeQuit??!1,t&&clearTimeout(t),t=setTimeout(()=>{e=!1,n=!1,t=null},6e4),t.unref()},canQuitWithoutPrompt:()=>e,markQuitApproved:()=>{e=!0},shouldSkipDrainBeforeQuit:()=>n}}function RX({hotkeyWindowLifecycleManager:e,globalDictationLifecycleManager:t,flushAndDisposeContext:n,disposables:r}){e.dispose(),t.dispose(),n(),r.dispose()}function zX({desktopSentry:e,hotkeyWindowLifecycleManager:r,globalDictationLifecycleManager:i,codexHome:o,nativeContextMenuIconSearchRoots:s,getContextForWebContents:c,getPrimaryWindow:l,showPrimaryWindow:u,ensureWindow:d,createFreshWindow:f,setDesktopFeatureAvailability:p,restoreAvatarOverlayOpenState:m,reloadBundledPlugins:h,setMacMenuBarEnabled:g,navigateToRoute:_,getDockMenuController:v,getTrayController:y,isTrustedIpcEvent:b}){dX(s,b),sX(b),a.ipcMain.handle(`codex_desktop:control-window`,async(e,t)=>{if(!b(e))return;let n=a.BrowserWindow.fromWebContents(e.sender);if(!n||n.isDestroyed())return;switch(t?.action){case`minimize`:n.minimize();return;case`maximize`:n.isMaximized()?n.unmaximize():n.maximize();return;case`close`:n.close();return}});function linuxSerializeMenuItems(e,t){let n=[];if(!e)return n;for(let r=0;r0&&(s.submenu=linuxSerializeMenuItems(i.submenu,o)),n.push(s)}return n}function linuxMenuItemAtPath(e,t){let n=t.split(`.`).map(Number),r=e;for(let e=0;e{if(!b(e))return{items:[]};let n=a.Menu.getApplicationMenu()?.getMenuItemById(t?.menuId)?.submenu;return{items:n?linuxSerializeMenuItems(n,``):[]}}),a.ipcMain.handle(`codex_desktop:click-application-menu-item`,async(e,t)=>{if(!b(e))return;let n=a.Menu.getApplicationMenu()?.getMenuItemById(t?.menuId)?.submenu,r=linuxMenuItemAtPath(n,t?.path);r&&r.enabled!==!1&&typeof r.click==`function`&&r.click()});let x=!1;a.ipcMain.handle(sl,async(e,o)=>{if(!b(e))return;if(o.type===`electron-avatar-overlay-restore-ready`){x||(x=!0,await m(e.sender));return}if(o.type===`electron-desktop-features-changed`){c(e.sender)?.setChronicleConfig(o.codexChronicleConfig),p({ambientSuggestions:o.ambientSuggestions,appshotsEnabled:o.appshotsEnabled,inAppBrowserUse:o.inAppBrowserUse,inAppBrowserUseAllowed:o.inAppBrowserUseAllowed,browserPane:o.browserPane,externalBrowserUse:o.externalBrowserUse,externalBrowserUseAllowed:o.externalBrowserUseAllowed,computerUse:o.computerUse,computerUseNodeRepl:o.computerUseNodeRepl,sites:o.sites,control:o.control,dil:o.dil,multiBrowserTabs:o.multiBrowserTabs,multiWindow:o.multiWindow,processManager:o.processManager});return}if(o.type===`mac-menu-bar-enabled-changed`){await g(o.enabled);return}if(o.type===`reload-bundled-plugins`){await h?.();return}if(o.type===`open-current-main-window`||o.type===`open-in-main-window`){let e=o.type===`open-current-main-window`?null:o.path;if(e!=null&&!t.it(e))return;r.hide();let n=l(),i=n!=null||e==null?await d():await f(e);i&&(o.type===`open-current-main-window`&&o.stealFocus===!0?u({stealFocus:!0}):(i.isMinimized()&&i.restore(),i.show(),i.focus()),n!=null&&e!=null&&_(i,e));return}if(o.type===`open-in-new-window`){if(!t.it(o.path))return;r.hide();let e=await f(o.path);e&&(e.isMinimized()&&e.restore(),e.show(),e.focus());return}if(o.type===`show-settings`){r.hide();let e=await d();if(!e)return;e.isMinimized()&&e.restore(),e.show(),e.focus(),_(e,`/settings/${o.section}`);return}if(o.type===`quit-app`){a.app.quit();return}if(gX(o)){await Promise.all([y()?.handleMessage(o),v?.()?.handleMessage(o)]);return}if(await i.handleMessage(e,o))return;let s=c(e.sender);if(!s){n.Lr().warning(`Message received for unknown window context`);return}await s.handleMessage(e.sender,o)}),a.ipcMain.handle(cl,async(e,t)=>{let r=IX.safeParse(t);if(!r.success){n.Lr().warning(`Invalid browser sidebar runtime message received`);return}let i=a.BrowserWindow.fromWebContents(e.sender);if(i==null){n.Lr().warning(`Browser sidebar runtime message received without owner window`);return}let o=c(i.webContents);if(o==null){n.Lr().warning(`Browser sidebar runtime message received for unknown window context`);return}await o.handleMessage(e.sender,r.data)}),a.ipcMain.handle(vl,async(e,t)=>b(e)?n.Dt({codexHome:o,params:t}):null),a.ipcMain.handle(bl,t=>{if(!b(t))return;let n=Error(`Desktop Sentry test error (debug button)`);e.captureException(n,{tags:{trigger:`debug-button`}})}),a.ipcMain.on(xl,e=>{if(!b(e))return;let[t]=e.ports,n=c(e.sender)?.createAppHost(e.sender);fX(t,n)})}function BX({buildFlavor:e,getContextForWebContents:t,isTrustedIpcEvent:n,usesOwlAppShell:i}){a.ipcMain.on(pl,e=>{if(!n(e)){e.returnValue=null;return}e.returnValue=r.A}),a.ipcMain.on(ml,t=>{if(!n(t)){t.returnValue=null;return}t.returnValue=e}),a.ipcMain.on(hl,e=>{if(!n(e)){e.returnValue=!1;return}e.returnValue=i}),a.ipcMain.on(_l,e=>{if(!n(e)){e.returnValue={};return}e.returnValue=t(e.sender)?.getSharedObjectSnapshot()??{}})}function VX({isWindows:e,disableQuitConfirmationPrompt:t,quitState:r,windows:i,applicationMenuManager:o,ensureWindow:s,hotkeyWindowLifecycleManager:c,globalDictationLifecycleManager:l,globalState:u,settingsStore:d,flushAndDisposeContext:f,disposables:p,appEvent:m,errorReporter:h}){let g=!1,_=!1;a.app.on(`window-all-closed`,()=>{(process.platform===`darwin`&&!a.app.isPackaged||process.platform!==`darwin`&&!e)&&a.app.quit()}),a.app.on(`before-quit`,o=>{if(el()){o.preventDefault();return}let s=nK(),c=n.Xn().some(e=>e.status===`ACTIVE`);if(e||r.canQuitWithoutPrompt()||t||!s&&!c){_=!0,i.markAppQuitting();return}let l=a.app.getName();if(a.dialog.showMessageBoxSync({type:`warning`,buttons:[`Quit`,`Cancel`],defaultId:0,cancelId:1,noLink:!0,title:`Quit ${l}?`,message:`Quit ${l}?`,detail:HX({hasInProgressLocalConversation:s,hasEnabledAutomations:c})})!==0){o.preventDefault();return}r.markQuitApproved(),_=!0,i.markAppQuitting()}),a.app.on(`child-process-gone`,(e,t)=>{if(t.reason!==`clean-exit`){if(UX(t)){WX(t);return}h.reportFatal(Error(`Child process gone (${t.type})`),{tags:{errorType:`child-process-gone`,processType:t.type,reason:t.reason},extra:{exitCode:t.exitCode,name:t.name,serviceName:t.serviceName}})}}),a.app.on(`activate`,()=>{_||(i.showLastActivePrimaryWindow()||s(),o.refresh())}),a.app.on(`browser-window-blur`,()=>{a.BrowserWindow.getFocusedWindow()??m.emit(`background`)}),a.app.on(`browser-window-focus`,()=>{m.emit(`foreground`),o.refresh()}),a.app.on(`will-quit`,e=>{if(_=!0,!g){if(r.shouldSkipDrainBeforeQuit()){RX({hotkeyWindowLifecycleManager:c,globalDictationLifecycleManager:l,flushAndDisposeContext:f,disposables:p});return}e.preventDefault(),g=!0,c.dispose(),l.dispose(),Promise.all([u.flush(),d.flush()]).finally(()=>{f(),p.dispose(),a.app.quit()})}})}function HX({hasInProgressLocalConversation:e,hasEnabledAutomations:t}){return e&&t?`Active local threads on this machine will be interrupted and enabled automations won't run while Codex is closed`:e?`Active local threads on this machine will be interrupted`:`Enabled automations won't run while Codex is closed`}function UX(e){return e.type===`GPU`||e.type===`Utility`&&e.serviceName===`audio.mojom.AudioService`}function WX(e){let t=`${e.type}:${e.serviceName??e.name??``}:${e.reason}`,r=Date.now(),i=wX.get(t);i!=null&&r-iSomething went wrong… -`,Q0=`#00000000`,$0=`#000000`,e2=`#f9f9f9`,t2=3840,n2=2160,r2=320,i2=140,a2=400,o2=400,s2=46,c2=14,l2=16,u2=36,d2=`#1f1f1f`,f2=`#ffffff`;function p2(e){return{x:l2,y:Math.round((s2*e-c2)/2)}}function m2(e=1){return process.platform===`linux`?{color:`#2b2f36`,symbolColor:`#ffffff`,height:Math.round(u2*e)}:{color:Q0,symbolColor:a.nativeTheme.shouldUseDarkColors?f2:d2,height:Math.round(u2*e)}}var h2=class{browserCommentPopupWindowCreatedHandlers=new Set;readyWebContentsIds=new Set;pendingMessages=new Map;primaryWindows=new Set;primaryWindowLastActiveAtMs=new WeakMap;lastActivePrimaryWindow=null;windowAppearances=new Map;registeredWindowIds=new Set;registeredWebContentsIds=new Set;webContentsHostIds=new Map;opaqueWindowSurfaceModes=new Map;windowZooms=new Map;appShellShortcutStates=new Map;debugWindowManager;isAppQuitting=!1;rendererRecoveryAttempts=new Set;constructor(e){this.options=e,P0(),this.debugWindowManager=this.options.allowDebugMenu?new i0({createWindow:e=>this.createWindow(e),sendMessageToWindow:(e,t)=>this.sendMessageToWindow(e,t),showWindow:(e,t)=>this.showWindow(e,t)}):null}setOnMainProcessInspectorStateChanged(e){this.options.onMainProcessInspectorStateChanged=e}setQueueCodexDeepLinkUrl(e){this.options.queueCodexDeepLinkUrl=e}queueCodexDeepLinkUrl(e,t){return this.options.queueCodexDeepLinkUrl?.(e,t)===!0}markWebContentsReady(e){this.readyWebContentsIds.add(e.id),this.flushPendingMessages(e)}forgetWebContents(e){this.readyWebContentsIds.delete(e),this.pendingMessages.delete(e),this.appShellShortcutStates.delete(e),this.debugWindowManager?.forgetWebContents(e)}isWebContentsReady(e){return this.readyWebContentsIds.has(e)}setAppShellShortcutState(e,t){this.appShellShortcutStates.set(e,t)}setWindowZoom(e,t){let n=a.BrowserWindow.fromWebContents(e);n==null||this.windowAppearances.get(n.id)!==`primary`||(process.platform===`darwin`?n.setWindowButtonPosition(p2(t)):process.platform===`win32`&&(this.windowZooms.set(n.id,t),n.setTitleBarOverlay(m2(t))))}getAppShellShortcutState(e){return this.appShellShortcutStates.get(e)??null}markAppQuitting(){this.isAppQuitting=!0;let e=this.getPrimaryWindow();e&&this.persistPrimaryWindowBounds(e)}showPrimaryWindow(e){let t=this.getPrimaryWindow();return this.showWindow(t,e)}showLastActivePrimaryWindow(){let e=this.lastActivePrimaryWindow;return e!=null&&!e.isDestroyed()?this.showWindow(e):(this.lastActivePrimaryWindow=null,this.showWindow(this.getPrimaryWindow()))}isHotkeyWindowThread(e){return this.windowAppearances.get(e.id)===`hotkeyWindowThread`}showWindow(e,t){if(!e)return!1;e.isMinimized()&&e.restore();let n=t?.stealFocus===!0&&process.platform===`win32`;return n&&e.setAlwaysOnTop(!0),e.show(),t?.stealFocus===!0&&process.platform===`darwin`&&a.app.focus({steal:!0}),e.focus(),n&&e.setAlwaysOnTop(!1),!0}sendMessageToWindow(e,t){this.sendMessageToWebContents(e.webContents,t)}sendMessageToAllRegisteredWindows(e){this.sendMessageToAllWindows(e)}sendMessageToAllWindows(e){for(let t of a.BrowserWindow.getAllWindows())t.isDestroyed()||this.registeredWindowIds.has(t.id)&&this.sendMessageToWindow(t,e)}sendMessageToWebContents(e,t){if(e.isDestroyed())return;if(this.isWebContentsReady(e.id)){e.send(F,t);return}let n=this.pendingMessages.get(e.id)??[];n.push(t),this.pendingMessages.set(e.id,n)}sendMessageToWebContentsId(e,t){for(let n of a.BrowserWindow.getAllWindows())if(!(n.isDestroyed()||n.webContents.id!==e)){this.sendMessageToWebContents(n.webContents,t);return}}getPrimaryWindow(){let e=this.lastActivePrimaryWindow;if(e!=null&&!e.isDestroyed()&&this.primaryWindows.has(e))return e;let t=this.getPrimaryWindows().at(-1)??null;return t?(this.lastActivePrimaryWindow=t,t):(this.lastActivePrimaryWindow=null,null)}getPrimaryWindows(){return this.getTrackedPrimaryWindows()}wasPrimaryWindowFocusedWithin(e,t){if(!this.primaryWindows.has(e)||e.isDestroyed())return!1;if(e.isFocused())return!0;let n=this.primaryWindowLastActiveAtMs.get(e);return n!=null&&Date.now()-n<=t}refreshWindowBackdrops(){for(let e of a.BrowserWindow.getAllWindows()){if(e.isDestroyed()||!this.registeredWindowIds.has(e.id))continue;let t=this.windowAppearances.get(e.id);t!=null&&this.applyWindowBackdrop(e,t,!0)}}hasRegisteredWebContents(e){return this.registeredWebContentsIds.has(e.id)}getHostIdForWebContents(e){return this.webContentsHostIds.get(e.id)??null}isTrustedIpcSender(e,t){return e.id!=null&&!this.registeredWebContentsIds.has(e.id)?!1:v2({sender:e,senderFrame:t,moduleDir:this.options.moduleDir})}isMainProcessInspectorEnabled(){return E.url()!=null}async toggleMainProcessInspector(){throw Error(`Feature unavailable.`)}openMcpAppSandboxDevtools(e,t){F0(e,t,this.options.allowMcpAppSandboxDevtools===!0)}async createWindow(e={}){let{title:n,width:i=1280,height:o=820,appearance:c=`primary`,show:u=!0,initialRoute:d,hostId:f=I,parent:p,focusable:m,lockTitle:h=!1}=e,g=Date.now(),_=c===`primary`?I:f,v=c===`primary`,y=v?this.restorePrimaryWindowBounds():null,b=y?.width??i,x=y?.height??o,S=y?.x,C=y?.y,w=y?.isMaximized===!0,T=k2(c,this.getPrimaryMinimumSize()),E=this.isOpaqueWindowsEnabled(),D=N2({appearance:c,opaqueWindowsEnabled:E,platform:process.platform}),O=O2(c),k={preload:this.options.preloadPath,contextIsolation:!0,nodeIntegration:!1,spellcheck:!0,devTools:this.options.allowDevtools,...O?{webviewTag:!0}:{}},{backgroundColor:A,backgroundMaterial:j}=A2({platform:process.platform,appearance:c,opaqueWindowsEnabled:E,prefersDarkColors:a.nativeTheme.shouldUseDarkColors}),M=new a.BrowserWindow({width:b,height:x,...S===void 0||C===void 0?{}:{x:S,y:C},title:n??a.app.getName(),backgroundColor:A,show:u,...p==null?{}:{parent:p},...m==null?{}:{focusable:m},...(process.platform===`win32`||process.platform===`linux`)?{autoHideMenuBar:!0}:{},...j==null?{}:{backgroundMaterial:j},...D,...T==null?{}:{minWidth:T.width,minHeight:T.height},webPreferences:k});this.applyWindowBackdrop(M,c,!0);let N=M.webContents,ee=N.id;O&&R0(N,this.options.allowMcpAppSandboxDevtools===!0,{allowNonMcpAppSandboxWebviews:c===`primary`}),M.webContents.once(`did-finish-load`,()=>{M.webContents.setZoomLevel(0),J0().info(`window main frame finished load`,{safe:{hostId:_,windowId:M.id,webContentsId:M.webContents.id,appearance:c,startupElapsedMs:Date.now()-g}})}),M.once(`ready-to-show`,()=>{J0().info(`window ready-to-show`,{safe:{hostId:_,windowId:M.id,webContentsId:M.webContents.id,appearance:c,startupElapsedMs:Date.now()-g}})});let te=this.installWindowsTitleBarOverlaySync(M,c),ne=()=>{this.applyWindowBackdrop(M,c,!1)};process.platform===`darwin`&&(M.on(`move`,ne),M.on(`resize`,ne)),(process.platform===`win32`||process.platform===`linux`)&&M.removeMenu(),M.on(`closed`,()=>{te?.(),process.platform===`darwin`&&(M.removeListener(`move`,ne),M.removeListener(`resize`,ne))}),(h||c===`primary`||c===`hud`||c===`hotkeyWindowHome`||c===`hotkeyWindowThread`)&&M.on(`page-title-updated`,e=>{e.preventDefault(),M.isDestroyed()||M.setTitle(M.getTitle())}),this.installWebContentsDiagnostics(M),this.registerWindow(M,_,v,c),this.options.onWindowRegistered?.(M),v&&M.on(`close`,e=>{this.persistPrimaryWindowBounds(M);let t=this.getPrimaryWindows().some(e=>e!==M);if(process.platform===`win32`&&!this.isAppQuitting&&this.options.canHideLastWindowToTray?.()===!0&&!t){e.preventDefault(),M.hide();return}if(process.platform===`darwin`&&!this.isAppQuitting&&!t){if(M.isFullScreen()){e.preventDefault(),M.once(`leave-full-screen`,()=>{M.isDestroyed()||M.hide()}),M.setFullScreen(!1);return}e.preventDefault(),M.hide()}});let P=()=>{this.sendMessageToWindow(M,{type:`window-fullscreen-changed`,isFullScreen:M.isFullScreen()})};M.on(`enter-full-screen`,P),M.on(`leave-full-screen`,P),P();let re=()=>{this.applyWindowBackdrop(M,c,!1),this.sendMessageToWindow(M,{type:`electron-window-focus-changed`,isFocused:M.isFocused()})},ie=dW({allowDebugMenu:this.options.allowDebugMenu,getState:()=>this.appShellShortcutStates.get(ee)??null,sendAction:e=>{this.sendMessageToWebContents(N,e)}});M.on(`focus`,re),M.on(`blur`,re),M.on(`show`,re),M.on(`hide`,re),N.on(`before-input-event`,ie),re(),w&&M.once(`ready-to-show`,()=>{M.isDestroyed()||M.maximize()});let ae=y2();if(M.webContents.setWindowOpenHandler(({url:e,frameName:n})=>t.kr(n)?.windowId===t.Or.BROWSER_COMMENT_POPUP&&this.browserCommentPopupWindowCreatedHandlers.size>0&&e===`about:blank`&&c===`primary`&&x2(M.webContents.getURL(),this.options.moduleDir)?{action:`allow`,outlivesOpener:!1,overrideBrowserWindowOptions:this.createBrowserCommentPopupWindowOptions(M)}:ae&&U0(e,ae)?{action:`allow`}:(eG(e)&&a.shell.openExternal(e).catch(e=>{this.options.errorReporter.reportNonFatal(e instanceof Error?e:t.Bt(e),{kind:`open-external-window`})}),{action:`deny`})),M.webContents.on(`did-create-window`,(e,n)=>{let r=t.kr(n.frameName);if(!(r?.windowId!==t.Or.BROWSER_COMMENT_POPUP||n.url!==`about:blank`||c!==`primary`)){e.setMenuBarVisibility(!1),e.setVisibleOnAllWorkspaces(!1),(process.platform===`win32`||process.platform===`linux`)&&e.removeMenu(),e.hide(),this.installNativeContextMenu(e);for(let t of this.browserCommentPopupWindowCreatedHandlers)t({browserTabId:r.browserTabId,conversationId:r.conversationId,hostId:this.getHostIdForWebContents(M.webContents)??_,owner:M.webContents,sessionId:r.sessionId,window:e})}}),M.on(`closed`,()=>{this.appShellShortcutStates.delete(ee),!N.isDestroyed()&&N.removeListener(`before-input-event`,ie)}),M.webContents.on(`will-navigate`,(e,n)=>{W0(n,M.webContents.getURL(),ae)||(e.preventDefault(),eG(n)&&a.shell.openExternal(n).catch(e=>{this.options.errorReporter.reportNonFatal(e instanceof Error?e:t.Bt(e),{kind:`open-external-navigation`})}))}),M.webContents.on(`will-frame-navigate`,e=>{!e.isMainFrame&&C2(e.url)&&e.preventDefault()}),M.webContents.on(`will-redirect`,(e,t)=>{let n=e.url??t;!e.isMainFrame&&C2(n)&&e.preventDefault()}),this.installNativeContextMenu(M),!a.app.isPackaged){let e=new URL(_2());return d&&e.searchParams.set(`initialRoute`,d),O&&this.options.allowMcpAppSandboxDevtools===!0&&e.searchParams.set(`mcpAppSandboxDevtools`,`1`),M.loadURL(e.toString()),M}let oe=(0,s.join)(r.F(this.options.moduleDir),`index.html`);if((0,l.existsSync)(oe))try{return await M.loadURL(r.P(d,{mcpAppSandboxDevtools:O&&this.options.allowMcpAppSandboxDevtools===!0})),M}catch(e){J0().warning(`Failed to load bundle at`,{safe:{},sensitive:{indexPath:oe,error:e}})}let se=`data:text/html;charset=utf-8,${encodeURIComponent(Z0)}`;return await M.loadURL(se),M}async createPrimaryWindow(e={}){return this.createWindow({...e,appearance:`primary`})}addBrowserCommentPopupWindowCreatedHandler(e){return this.browserCommentPopupWindowCreatedHandlers.add(e),()=>{this.browserCommentPopupWindowCreatedHandlers.delete(e)}}createBrowserCommentPopupWindowOptions(e){let n=`browserCommentPopup`,r=this.isOpaqueWindowsEnabled(),{backgroundColor:i,backgroundMaterial:o}=A2({platform:process.platform,appearance:n,opaqueWindowsEnabled:r,prefersDarkColors:a.nativeTheme.shouldUseDarkColors});return{title:``,width:294,height:t.jr,parent:e,show:!1,backgroundColor:i,...o==null?{}:{backgroundMaterial:o},...N2({appearance:n,opaqueWindowsEnabled:r,platform:process.platform}),webPreferences:{contextIsolation:!0,nodeIntegration:!1,spellcheck:!0,devTools:this.options.allowDevtools}}}async createAuxWindow(e,t=I){let n=await this.createWindow({title:e,width:1024,height:720,appearance:`secondary`,show:!1,hostId:t});return n.setMenuBarVisibility(!1),n.setMinimumSize(400,400),n.center(),n}async ensureAuxWindow(e,t,n){let r=t.byOwner.get(e.id);if(r&&!r.window.isDestroyed())return r;r&&(t.byOwner.delete(e.id),t.byWindowId.delete(r.webContentsId));let i=await this.createAuxWindow(n,this.getHostIdForWebContents(e)??`local`),a=i.webContents.id,o={window:i,webContentsId:a,owner:e,ownerId:e.id,ready:this.isWebContentsReady(a)};return t.byOwner.set(e.id,o),t.byWindowId.set(a,o),i.on(`closed`,()=>{t.byWindowId.delete(a),t.byOwner.get(e.id)?.window===i&&t.byOwner.delete(e.id)}),e.once(`destroyed`,()=>{i.isDestroyed()||i.close()}),o}registerWindow(e,t,n,r){let i=e.id,a=e.webContents.id;this.windowAppearances.set(i,r),this.registeredWindowIds.add(i),this.registeredWebContentsIds.add(a),this.webContentsHostIds.set(a,t),n&&this.trackPrimaryWindow(e),e.on(`closed`,()=>{this.forgetWebContents(a),this.windowAppearances.delete(i),this.registeredWindowIds.delete(i),this.registeredWebContentsIds.delete(a),this.webContentsHostIds.delete(a),this.opaqueWindowSurfaceModes.delete(i),this.windowZooms.delete(i),n&&(this.primaryWindows.delete(e),this.lastActivePrimaryWindow===e&&(this.lastActivePrimaryWindow=null))})}trackPrimaryWindow(e){this.primaryWindows.add(e),this.lastActivePrimaryWindow=e,e.isFocused()&&this.primaryWindowLastActiveAtMs.set(e,Date.now()),e.on(`focus`,()=>{this.lastActivePrimaryWindow=e,this.primaryWindowLastActiveAtMs.set(e,Date.now())}),e.on(`blur`,()=>{this.primaryWindowLastActiveAtMs.set(e,Date.now())})}getTrackedPrimaryWindows(){let e=[];for(let t of this.primaryWindows){if(t.isDestroyed()){this.primaryWindows.delete(t);continue}e.push(t)}return this.primaryWindows.size===0?(this.lastActivePrimaryWindow=null,[]):(this.lastActivePrimaryWindow?.isDestroyed()&&(this.lastActivePrimaryWindow=null),e)}restorePrimaryWindowBounds(){let e=this.options.globalState.get(`electron-main-window-bounds`)??null;if(!e)return null;let t=this.clampPrimaryWindowBounds(e);return this.isWithinDisplayWorkArea(t)?t:null}getPrimaryMinimumSize(){return{width:480,height:600}}syncPrimaryMinimumSize(){let e=this.getPrimaryWindows();if(e.length===0)return;let t=this.getPrimaryMinimumSize();for(let n of e){if(n.setMinimumSize(t.width,t.height),n.isMaximized()||n.isFullScreen())continue;let e=n.getNormalBounds(),r=Math.max(e.width,t.width),i=Math.max(e.height,t.height);r===e.width&&i===e.height||n.setBounds({...e,width:r,height:i})}let n=this.getPrimaryWindow();n&&this.persistPrimaryWindowBounds(n)}persistPrimaryWindowBounds(e){if(e.isDestroyed())return;let t=e.getNormalBounds(),n=this.getPrimaryMinimumSize(),r={x:t.x,y:t.y,width:Math.max(t.width,n.width),height:Math.max(t.height,n.height),isMaximized:e.isMaximized()};this.options.globalState.set(`electron-main-window-bounds`,r)}clampPrimaryWindowBounds(e){let t=this.getPrimaryMinimumSize();return{...e,width:Math.max(e.width,t.width),height:Math.max(e.height,t.height)}}flushPendingMessages(e){let t=this.pendingMessages.get(e.id);if(!t||t.length===0){this.pendingMessages.delete(e.id);return}if(this.pendingMessages.delete(e.id),!e.isDestroyed())for(let n of t)e.send(F,n)}isWithinDisplayWorkArea(e){let t=a.screen.getAllDisplays();if(t.length===0)return!0;let n={x:e.x,y:e.y,width:e.width,height:e.height};return t.some(e=>{let t=e.workArea;return t.xn.x&&t.yn.y})}installWindowsTitleBarOverlaySync(e,t){if(process.platform!==`win32`&&process.platform!==`linux`||t!==`primary`)return;let n=()=>{e.isDestroyed()||e.setTitleBarOverlay(m2(this.windowZooms.get(e.id)))};return a.nativeTheme.on(`updated`,n),n(),()=>{a.nativeTheme.off(`updated`,n)}}isOpaqueWindowsEnabled(){return(g2(this.options.settingsStore.getEffective(t.E.theme.key)??`system`)===`light`?this.options.settingsStore.getEffective(t.E.lightChromeTheme.key):this.options.settingsStore.getEffective(t.E.darkChromeTheme.key))?.opaqueWindows===!0}shouldUseOpaqueWindowSurface(e,t,n){let r=a.screen.getDisplayMatching(t);return E2({appearance:e,opaqueWindowsEnabled:this.isOpaqueWindowsEnabled(),platform:process.platform})||D2({appearance:e,isFocused:n,platform:process.platform})||T2({appearance:e,platform:process.platform,scaleFactor:r.scaleFactor,windowBounds:t})}applyWindowBackdrop(e,t,n){let r=e.getBounds(),i=this.shouldUseOpaqueWindowSurface(t,r,e.isFocused());if(!n&&this.opaqueWindowSurfaceModes.get(e.id)===i)return;let{backgroundColor:o,backgroundMaterial:s}=A2({platform:process.platform,appearance:t,opaqueWindowsEnabled:i,prefersDarkColors:a.nativeTheme.shouldUseDarkColors});e.setBackgroundColor(o),s!=null&&e.setBackgroundMaterial(s),process.platform===`darwin`&&e.setVibrancy(j2(t,i)),this.opaqueWindowSurfaceModes.set(e.id,i),this.sendMessageToWindow(e,{type:`electron-window-opaque-surface-changed`,opaqueWindowSurfaceEnabled:i})}installNativeContextMenu(e){let t=r0({window:e,prepend:(e,t)=>{if(t.mediaType!==`image`)return[];let n=r.I(t.srcURL);return n==null?[]:[{label:X0,click:()=>{a.shell.showItemInFolder(n)}}]},showInspectElement:this.options.allowInspectElement});e.on(`closed`,()=>{t()})}installWebContentsDiagnostics(e){let t=e.webContents,n=e.id,r=t.id,i=this.options.errorReporter;t.on(`render-process-gone`,(t,a)=>{a.reason!==`clean-exit`&&(i.reportFatal(Error(`Renderer process gone (${a.reason})`),{tags:{errorType:`renderer-process-gone`,reason:a.reason},extra:{windowId:n,webContentsId:r,exitCode:a.exitCode}}),this.maybeRecoverFromRendererCrash(e,a.reason))}),t.on(`did-finish-load`,()=>{this.rendererRecoveryAttempts.delete(r)}),t.on(`unresponsive`,()=>{i.reportFatal(Error(`Renderer unresponsive`),{tags:{errorType:`renderer-unresponsive`},extra:{windowId:n,webContentsId:r,url:eM(t.getURL())}})}),t.on(`did-fail-load`,(e,t,a,o,s,c,l)=>{s&&t!==-3&&i.reportFatal(Error(`Renderer did-fail-load`),{tags:{errorType:`renderer-did-fail-load`},extra:{windowId:n,webContentsId:r,errorCode:t,errorDescription:a,validatedURL:eM(o),frameProcessId:c,frameRoutingId:l}})})}maybeRecoverFromRendererCrash(e,t){if(this.isAppQuitting||t===`clean-exit`||e.isDestroyed())return;let n=e.webContents;n.isDestroyed()||this.rendererRecoveryAttempts.has(n.id)||(this.rendererRecoveryAttempts.add(n.id),setTimeout(()=>{if(!e.isDestroyed()&&!e.webContents.isDestroyed())try{e.webContents.reload()}catch(e){J0().warning(`Failed to reload crashed window`,{safe:{},sensitive:{error:e}})}},500))}};function g2(e){return e===`system`?a.nativeTheme.shouldUseDarkColors?`dark`:`light`:e}function _2(){return process.env.ELECTRON_RENDERER_URL||Y0}function v2({sender:e,senderFrame:t,moduleDir:n}){return t!=null&&t!==e.mainFrame?!1:x2((t??e.mainFrame).url,n)}function y2(){let e=_2();return eG(e)?new URL(e).origin:null}function b2(e){return(0,s.join)(e,`..`,`..`,`webview`,`index.html`)}function x2(e,t){if(e===`about:blank`||S2(e))return!0;let n=y2();if(n&&U0(e,n))return!0;let r=(0,x.pathToFileURL)(b2(t)).toString();return!!e.startsWith(r)}function S2(e){try{let t=new URL(e);return t.protocol===`app:`?t.host===`-`||t.host===``:!1}catch{return!1}}function C2(e){try{return new URL(e).protocol===`app:`}catch{return!1}}function w2(e){return e===`avatarOverlay`||e===`browserCommentPopup`||e===`globalDictation`||e===`hotkeyWindowHome`||e===`hotkeyWindowThread`}function T2({appearance:e,platform:t,scaleFactor:n,windowBounds:r}){if(t!==`darwin`||w2(e))return!1;let i=r.width*n,a=r.height*n;return Math.max(i,a)>=t2&&Math.min(i,a)>=n2}function E2({appearance:e,opaqueWindowsEnabled:t,platform:n}){return t&&!w2(e)&&(n===`darwin`||n===`win32`)}function D2({appearance:e,isFocused:t,platform:n}){return!t&&!w2(e)&&(n===`darwin`||n===`win32`)}function O2(e){return e===`primary`||e===`hotkeyWindowThread`||e===`hud`}function k2(e,t){switch(e){case`avatarOverlay`:case`browserCommentPopup`:case`globalDictation`:return null;case`primary`:return t;case`hotkeyWindowHome`:return{width:r2,height:i2};case`hotkeyWindowThread`:return{width:a2,height:o2};case`hud`:case`secondary`:return{width:400,height:400}}}function A2({platform:e,appearance:t,opaqueWindowsEnabled:n,prefersDarkColors:r}){if(n&&!w2(t)&&(e===`darwin`||e===`win32`))return{backgroundColor:r?$0:e2,backgroundMaterial:e===`win32`?`none`:null};if(e===`win32`&&!w2(t))return{backgroundColor:Q0,backgroundMaterial:`mica`};if(e===`linux`&&!w2(t))return{backgroundColor:r?$0:e2,backgroundMaterial:null};return{backgroundColor:Q0,backgroundMaterial:null}}function j2(e,t){return t||w2(e)?null:`menu`}function M2({alwaysOnTop:e,hasShadow:t=!0,platform:n,resizable:r,thickFrame:i,transparent:a=!0}){return{frame:!1,transparent:a,hasShadow:t,resizable:r,minimizable:!1,maximizable:!1,fullscreenable:!1,skipTaskbar:!0,...e?{alwaysOnTop:!0}:{},...n===`win32`?{accentColor:!1,roundedCorners:!1,...i==null?{}:{thickFrame:i}}:{},...n===`darwin`?{type:`panel`}:{}}}function N2({appearance:e,opaqueWindowsEnabled:t,platform:n,windowZoom:r=1}){switch(e){case`browserCommentPopup`:return M2({hasShadow:!1,platform:n,resizable:!1,thickFrame:!1,transparent:!0});case`globalDictation`:return M2({alwaysOnTop:!0,hasShadow:!1,platform:n,resizable:!1,thickFrame:!1,transparent:!0});case`avatarOverlay`:return{...M2({alwaysOnTop:!0,platform:n,resizable:!1,thickFrame:!1}),...n===`linux`?{type:`toolbar`}:{},hasShadow:!1};case`hotkeyWindowHome`:return M2({platform:n,resizable:!1,thickFrame:!1});case`hotkeyWindowThread`:return M2({platform:n,resizable:!0});case`primary`:return n===`darwin`?t?{titleBarStyle:`hiddenInset`,trafficLightPosition:p2(r)}:{vibrancy:`menu`,titleBarStyle:`hiddenInset`,trafficLightPosition:p2(r)}:(n===`win32`||n===`linux`)?{titleBarStyle:`hidden`,titleBarOverlay:m2(r)}:{titleBarStyle:`default`};case`secondary`:return n===`darwin`?t?{titleBarStyle:`default`}:{vibrancy:`menu`,titleBarStyle:`default`}:{titleBarStyle:`default`};case`hud`:return n===`darwin`?t?{titleBarStyle:`hiddenInset`,minimizable:!1,maximizable:!1,fullscreenable:!1,alwaysOnTop:!0,trafficLightPosition:{x:10,y:10}}:{vibrancy:`menu`,titleBarStyle:`hiddenInset`,minimizable:!1,maximizable:!1,fullscreenable:!1,alwaysOnTop:!0,trafficLightPosition:{x:10,y:10}}:{titleBarStyle:`default`,minimizable:!1,maximizable:!1,fullscreenable:!1,alwaysOnTop:!0}}}var P2=2e3;function F2({buildFlavor:e,allowDevtools:n,allowInspectElement:i,allowDebugMenu:o,errorReporter:c,globalState:u,settingsStore:d,desktopRoot:f,preloadPath:p,repoRoot:m,isMacOS:h,isWindows:g,isDevMode:_,canHideLastWindowToTray:v,disposables:y}){let b=(0,s.join)(m,`electron`,`src`,`icons`),x=()=>{switch(e){case r.M.Dev:{let e=(0,s.join)(b,a.nativeTheme.shouldUseDarkColors?`icon-dev-dark.png`:`icon-dev-light.png`);return(0,l.existsSync)(e)?e:null}case r.M.Agent:{let e=(0,s.join)(process.resourcesPath,`icon-agent.png`);if(a.app.isPackaged&&(0,l.existsSync)(e))return e;let t=(0,s.join)(b,`icon-agent.png`);return(0,l.existsSync)(t)?t:null}case r.M.Nightly:case r.M.InternalAlpha:case r.M.PublicBeta:case r.M.Prod:return null}},S=()=>{let e=x(),t=e==null?a.nativeImage.createEmpty():a.nativeImage.createFromPath(e);t.isEmpty()||a.app.dock?.setIcon(t)};h&&(S(),a.nativeTheme.on(`updated`,S),y.add(()=>{a.nativeTheme.off(`updated`,S)}));let C=null,w=new h2({desktopRoot:f,iconDirectoryName:Sl,globalState:u,settingsStore:d,moduleDir:__dirname,preloadPath:p,repoRoot:m,allowDevtools:n,allowMcpAppSandboxDevtools:_,allowDebugMenu:o,allowInspectElement:i,errorReporter:c,canHideLastWindowToTray:v,onWindowRegistered:e=>{C?.registerWindow(e)}}),T=new zQ(w,F),E=new wQ(w,u),D=new J$({windowManager:w,globalState:u,isDevMode:_}),O=new w$({canForceGlobalDictationLock:_,forceGlobalDictationLock:_&&u.get(t._r.GLOBAL_DICTATION_FORCE_LOCK_DEBUG_ENABLED)===!0,windowManager:w,globalState:u}),k=GZ({windowManager:w,globalState:u,enabled:!0});y.add(()=>{k.dispose()});let A=e=>{if(!g)return;let t=setTimeout(()=>{e.isDestroyed()||e.isVisible()||(e.show(),e.focus())},P2);t.unref();let n=()=>{clearTimeout(t)};e.once(`show`,n),e.once(`closed`,n)},j=async({show:e,initialRoute:t})=>{if(C==null)return null;let n=await w.createPrimaryWindow({title:a.app.getName(),show:e,initialRoute:t===`/`?void 0:t});return e||A(n),n};return{windowManager:w,filePreviewManager:T,avatarOverlayManager:E,hotkeyWindowLifecycleManager:D,globalDictationLifecycleManager:O,appshotHotkeyController:k,setWindowContext:e=>{C=e;for(let t of a.BrowserWindow.getAllWindows())t.isDestroyed()||!w.hasRegisteredWebContents(t.webContents)||e.registerWindow(t)},ensureWindow:async()=>{let e=w.getPrimaryWindow();return e?C==null?null:(e.isMinimized()&&e.restore(),e.show(),e.focus(),e.isDestroyed()?null:e):j({show:!1})},createFreshWindow:async(e=`/`)=>j({show:!0,initialRoute:e}),showLastActivePrimaryWindow:()=>w.showLastActivePrimaryWindow(),markAppQuitting:()=>{w.markAppQuitting()},isTrustedIpcSender:w.isTrustedIpcSender.bind(w),sendMessageToWindow:w.sendMessageToWindow.bind(w),sendMessageToAllRegisteredWindows:w.sendMessageToAllRegisteredWindows.bind(w),sendMessageToAllWindows:w.sendMessageToAllWindows.bind(w),getPrimaryWindow:w.getPrimaryWindow.bind(w),getContextForWebContents:e=>w.hasRegisteredWebContents(e)?C:null}}var I2=3e4,L2=class{totalInvocations=0;rollingWindowCounter=new t.H({windowMs:I2});recordInvocation(e=Date.now()){this.totalInvocations+=1,this.rollingWindowCounter.record(1,e)}getSnapshot(e=Date.now()){let t=this.rollingWindowCounter.getSnapshot(e);return{totalInvocations:this.totalInvocations,invocationsLast30s:t.count}}};function R2(e){return typeof e==`object`&&!!e}function z2(e){return e===`worktree-cleanup-inputs`||e===`computer-use-service-pid`||e===`codex-home`||e===`platform-family`||e===`platform-os`||e===`process-start`||e===`process-write`||e===`process-resize`||e===`process-terminate`||e===`fs-read-file`||e===`fs-write-file`||e===`fs-create-directory`||e===`fs-get-metadata`||e===`fs-read-directory`||e===`fs-remove`||e===`fs-copy`||e===`fs-watch`||e===`fs-unwatch`||e===`worker-exit`}function B2(e){return R2(e)?e.type===`worker-main-rpc-request`&&typeof e.workerId==`string`&&typeof e.requestId==`string`&&z2(e.method):!1}var V2=class{worker=null;latestAuthUser=null;listeners=new Set;exitListeners=new Set;mainRpcHandler=null;exitedWorkers=new WeakSet;disposedWorkers=new WeakSet;constructor(e){this.id=e}dispose(){let e=this.worker;e&&(this.worker=null,this.disposedWorkers.add(e),this.handleWorkerExit(e),e.terminate())}addListener(e){return this.listeners.add(e),()=>{this.listeners.delete(e)}}addExitListener(e){return this.exitListeners.add(e),()=>{this.exitListeners.delete(e)}}setMainRpcHandler(e){this.mainRpcHandler=e}postMessage(e){this.ensureWorker().postMessage(e)}start(){this.ensureWorker()}setSentryUser(e,t,n,r){this.latestAuthUser={authMethod:e,userId:t,email:n,accountId:r};let i=this.worker;i&&i.postMessage({type:`worker-sentry-user-update`,authMethod:e,userId:t,email:n,accountId:r})}emitAppEvent(e){let t=this.worker;t&&t.postMessage({type:`worker-app-event`,event:e})}ensureWorker(){if(this.worker)return this.worker;let e=n.Rr(`worker-manager`),t=(0,s.join)(__dirname,`worker.js`),i=n.y(r.M.resolve()),o=a.app.isPackaged?a.app.getAppPath():process.cwd(),c={workerId:this.id,sentryInitOptions:r.A,maxLogLevel:i,sentryRewriteFramesRoot:o,spawnInsideWsl:n.Nr()},l=new S.Worker(t,{name:this.id,workerData:c});return l.on(`message`,e=>{if(B2(e)){this.handleMainRpcRequest(l,e);return}this.listeners.forEach(t=>{t(e)})}),l.on(`error`,t=>{e.warning(`Worker error`,{safe:{},sensitive:{error:t}})}),l.on(`exit`,t=>{this.worker===l&&(this.worker=null),this.handleWorkerExit(l),t!==0&&!this.disposedWorkers.has(l)&&e.warning(`Worker exited`,{safe:{code:t},sensitive:{}})}),l.unref(),this.worker=l,this.latestAuthUser&&l.postMessage({type:`worker-sentry-user-update`,authMethod:this.latestAuthUser.authMethod,userId:this.latestAuthUser.userId,email:this.latestAuthUser.email,accountId:this.latestAuthUser.accountId}),l}async handleMainRpcRequest(e,t){let r=n.Rr(`worker-manager`);if(t.workerId!==this.id){r.warning(`Received main RPC request for wrong worker`,{safe:{expectedWorkerId:this.id,workerId:t.workerId,method:t.method}});return}let i=this.mainRpcHandler;if(!i){let n={type:`worker-main-rpc-response`,workerId:this.id,requestId:t.requestId,method:t.method,result:{type:`error`,error:{message:`No main RPC handler configured for worker '${this.id}'`}}};e.postMessage(n);return}try{let n=await i(t,this.createMainRpcHandlerContext(e)),r={type:`worker-main-rpc-response`,workerId:this.id,requestId:t.requestId,method:t.method,result:{type:`ok`,value:n}};e.postMessage(r)}catch(n){let r={type:`worker-main-rpc-response`,workerId:this.id,requestId:t.requestId,method:t.method,result:{type:`error`,error:{message:n instanceof Error?n.message:`Failed to handle main RPC request: ${String(n)}`}}};e.postMessage(r)}}createMainRpcHandlerContext(e){return{emitEvent:t=>{let n={type:`worker-main-rpc-event`,workerId:this.id,method:t.method,params:t.params};e.postMessage(n)}}}handleWorkerExit(e){if(this.exitedWorkers.has(e))return;this.exitedWorkers.add(e),this.exitListeners.forEach(e=>{e()});let t=this.mainRpcHandler;if(!t)return;let r=n.Rr(`worker-manager`);t({type:`worker-main-rpc-request`,workerId:this.id,requestId:`worker-exit`,method:`worker-exit`,params:{}},this.createMainRpcHandlerContext(e)).catch(e=>{r.warning(`Worker exit cleanup failed`,{safe:{},sensitive:{error:e}})})}},H2=class{logger=n.Rr(`worker-bus-message-handler`);pending=new Map;pendingRequestFromHost=new Map;hostListeners=new Set;knownWebContents=new Set;workerManager;onWorkerRequestSent;constructor(e,t={}){this.workerId=e,this.onWorkerRequestSent=t.onWorkerRequestSent??null,this.workerManager=new V2(this.workerId),this.workerManager.addListener(e=>{this.handleWorkerMessage(e)})}async handleMessage(e,t){if(this.trackLifecycle(e),t.workerId!==this.workerId){this.logger.warning(`Received worker message for wrong worker`,{safe:{expectedWorkerId:this.workerId,workerId:t.workerId,type:t.type}});return}switch(t.type){case`worker-request`:{let n=t;this.pending.set(n.request.id,e),this.onWorkerRequestSent?.(),this.workerManager.postMessage(n);return}case`worker-request-cancel`:this.pending.delete(t.id);break}this.workerManager.postMessage(t)}dispose(){let e=Error(`Worker bus disposed for '${this.workerId}'`);for(let t of this.pendingRequestFromHost.values())t.reject(e);this.pendingRequestFromHost.clear(),this.workerManager.dispose()}requestFromHost(e){if(e.signal?.aborted)return Promise.reject(new DOMException(`Aborted`,`AbortError`));let n=t.n(`main-${(0,u.randomUUID)()}`),r={id:n,method:e.method,params:e.params},i={type:`worker-request`,workerId:this.workerId,request:r},a=new Promise((t,r)=>{this.pendingRequestFromHost.set(n,{method:e.method,resolve:e=>{t(e)},reject:r})});try{this.onWorkerRequestSent?.(),this.workerManager.postMessage(i)}catch(e){return this.pendingRequestFromHost.delete(n),Promise.reject(e instanceof Error?e:Error(`Failed to post worker request: ${String(e)}`))}let o=e.signal;if(o){let e=()=>{o.removeEventListener(`abort`,e);let t=this.pendingRequestFromHost.get(n);t&&(this.pendingRequestFromHost.delete(n),this.workerManager.postMessage({type:`worker-request-cancel`,workerId:this.workerId,id:n}),t.reject(new DOMException(`Aborted`,`AbortError`)))};o.addEventListener(`abort`,e);let t=()=>{o.removeEventListener(`abort`,e)};a.then(t,t)}return a}subscribeFromHost(e){return this.hostListeners.add(e),()=>{this.hostListeners.delete(e)}}subscribeWorkerExit(e){return this.workerManager.addExitListener(e)}setSentryUser(e,t,n,r){this.workerManager.setSentryUser(e,t,n,r)}emitAppEvent(e){this.workerManager.emitAppEvent(e)}setMainRpcHandler(e){this.workerManager.setMainRpcHandler(e)}startWorker(){this.workerManager.start()}trackLifecycle(e){this.knownWebContents.has(e)||(this.knownWebContents.add(e),e.once(`destroyed`,()=>{this.knownWebContents.delete(e),this.cleanupOrigin(e)}))}cleanupOrigin(e){for(let[t,n]of this.pending.entries()){if(n!==e)continue;this.pending.delete(t);let r={type:`worker-request-cancel`,workerId:this.workerId,id:t};this.workerManager.postMessage(r)}}handleWorkerMessage(e){if(e.workerId!==this.workerId){this.logger.warning(`Received worker message for wrong worker`,{safe:{expectedWorkerId:this.workerId,workerId:e.workerId,type:e.type}});return}if(e.type===`worker-response`){let t=this.pendingRequestFromHost.get(e.response.id);if(t){if(this.pendingRequestFromHost.delete(e.response.id),t.method!==e.response.method){t.reject(Error(`Mismatched worker response method`));return}if(e.response.result.type===`ok`){t.resolve(e.response.result.value);return}t.reject(Error(e.response.result.error.message));return}let n=this.pending.get(e.response.id);if(!n)return;this.pending.delete(e.response.id),this.send(n,e);return}this.hostListeners.forEach(t=>{t(e)}),this.broadcast(e)}send(e,t){e.isDestroyed()||e.send(Ol(this.workerId),t)}broadcast(e){this.knownWebContents.forEach(t=>{this.send(t,e)})}};function U2({disposables:e,isTrustedIpcEvent:r}){let i=new n.mr,o=new n.Z(i),s=new L2,c=[],l=new H2(`git`,{onWorkerRequestSent:()=>{s.recordInvocation()}}),u=new H2(`computer-use-capture`),d=new Set,f=new Map,p=null,m=null,h=(e,t,n,r)=>{p={authMethod:e,userId:t,email:n,accountId:r},c.forEach(i=>{i(e,t,n,r)}),f.forEach(i=>{i.setSentryUser(e,t,n,r)})},g=e=>l.requestFromHost(e),_=async e=>{let t=await u.requestFromHost(e);return b(e.params.requestId,e.signal),t},v=(t,n)=>{e.add(n),c.push((e,t,r,i)=>{n.setSentryUser(e,t,r,i)}),e.add(i.subscribe(e=>{n.emitAppEvent(e)}))},y=(e,t)=>{v(e,t),a.ipcMain.handle(Dl(e),async(e,n)=>{r(e)&&await t.handleMessage(e.sender,n)})};return{appEvent:i,gitManager:o,gitWorkerInvocationSampler:s,requestComputerUseCaptureWorker:_,requestGitWorker:g,subscribeComputerUseCaptureWorkerEvent:(e,t)=>{let n=n=>{W2(n,e)&&t(n)};return d.add(n),()=>{d.delete(n)}},subscribeGitWorkerEvent:(e,t)=>l.subscribeFromHost(n=>{n.type===`worker-event`&&G2(n.event,e)&&t(n.event)}),updateWorkerSentryUser:h,registerWorkerBusMessageHandlers:()=>{v(`computer-use-capture`,u);for(let e of t.t){if(e===`git`){y(e,l);continue}y(e,new H2(e))}},setGitWorkerMainRpcHandler:e=>{l.setMainRpcHandler(e)},setComputerUseCaptureWorkerMainRpcHandler:e=>{m=e,u.setMainRpcHandler(e),f.forEach(t=>{t.setMainRpcHandler(e)})},startComputerUseCaptureWorker:()=>{u.startWorker()}};function b(e,t){if(f.has(e))return;let n=new H2(`computer-use-capture`);m!=null&&n.setMainRpcHandler(m),f.set(e,n),p!=null&&n.setSentryUser(p.authMethod,p.userId,p.email,p.accountId);let r=i.subscribe(e=>{n.emitAppEvent(e)}),a=n.subscribeFromHost(t=>{t.type===`worker-event`&&(d.forEach(e=>{e(t.event)}),t.event.type===`update`&&t.event.requestId===e&&(t.event.update.type===`completed`||t.event.update.type===`failed`)&&l())}),o=n.subscribeWorkerExit(()=>{c||(u(`update_worker_exited`),l())}),s=()=>{l()};t?.addEventListener(`abort`,s,{once:!0});let c=!1,l=()=>{c||(c=!0,a(),o(),t?.removeEventListener(`abort`,s),r.dispose(),f.delete(e),n.dispose())},u=t=>{d.forEach(n=>{n({type:`update`,requestId:e,update:{type:`failed`,failureReason:t}})})};n.startWorker(),n.requestFromHost({method:`watchUpdates`,params:{requestId:e},signal:t}).catch(()=>{c||(u(`update_watch_failed`),l())})}}function W2(e,t){return e.type===t}function G2(e,t){return e.type===t}function K2(e,t){switch(e){case r.M.Agent:return`icon-agent`;case r.M.Nightly:return`icon-nightly`;case r.M.InternalAlpha:return`icon-alpha`;case r.M.PublicBeta:return`icon-beta`;case r.M.Dev:case r.M.Prod:return`icon`}}var q2=3,J2=5.5,Y2=1,X2=null,Z2=null,Q2=!1,$2=!1;function e4(){return X2}async function t4(e){return process.platform!==`win32`&&process.platform!==`darwin`?null:(Q2=!0,X2??Z2??($2||=(a.app.on(`before-quit`,()=>{n4()}),!0),Z2=(async()=>{let t=await r4(e.buildFlavor,e.repoRoot),n=new a.Tray(t.defaultIcon);return Q2?(n.setToolTip(a.app.getName()),X2=new _X(n,e.onTrayButtonClick,e.onTrayMenuOpenMainWindow,e.onTrayMenuOpenNewThread,e.onTrayMenuOpenRecentThread,e.getChronicleSidecarControlState,e.toggleChronicleSidecar,t,r.B(),a.app.getName()),X2):(n.destroy(),null)})().finally(()=>{Z2=null}),Z2))}function n4(){Q2=!1,X2?.destroy(),X2=null}async function r4(e,t){if(process.platform===`darwin`){let e=[...a.app.isPackaged?[(0,s.join)(process.resourcesPath,`codexTemplate.png`)]:[],(0,s.join)(t,`electron`,`src`,`icons`,`codexTemplate.png`)];for(let t of e){let e=a.nativeImage.createFromPath(t);if(!e.isEmpty())return e.setTemplateImage(!0),{defaultIcon:e,chronicleRunningIcon:i4(e)}}let n=await a.app.getFileIcon(process.execPath,{size:`normal`});return{defaultIcon:n,chronicleRunningIcon:i4(n)}}let n=process.platform===`win32`?`.ico`:`.png`,r=K2(e,process.platform),i=[...a.app.isPackaged?[(0,s.join)(process.resourcesPath,`${r}${n}`)]:[],(0,s.join)(t,`electron`,`src`,`icons`,`${r}${n}`)];for(let e of i){let t=a.nativeImage.createFromPath(e);if(!t.isEmpty())return{defaultIcon:t,chronicleRunningIcon:null}}return{defaultIcon:await a.app.getFileIcon(process.execPath,{size:process.platform===`win32`?`small`:`normal`}),chronicleRunningIcon:null}}function i4(e){let t=e.getSize(),n=t.width,r=t.height;if(n<=0||r<=0)return null;let i=a.nativeImage.createEmpty(),o=!1;for(let t of e.getScaleFactors()){let a=a4(e,n,r,t);a!=null&&(i.addRepresentation(a),o=!0)}return!o||i.isEmpty()?null:(i.setTemplateImage(!0),i)}function a4(e,t,n,r){let i=Buffer.from(e.toBitmap({scaleFactor:r})),a=o4(i,t,n);if(a==null)return null;let{height:o,scaleFactor:s,width:c}=a,l=Math.min(c,o)/Math.min(t,n),u=q2*l,d=J2*l,f=Y2*l,p=c-u-f,m=o-u-f;for(let e=0;e{switch(t.method){case`computer-use-service-pid`:return e.ensureManagedComputerUseService();case`worker-exit`:return{}}}}function b4(e){return JSON.stringify([e.hostId,e.watchId])}function x4(e){let t=new Map,n=new Map,r=t=>{let n=e.getAppServerClientForHost(t);if(!n)throw Error(`App server state for host ID ${t.hostId} not found`);return n},i=async e=>{let n=t.get(e);if(!n)throw Error(`Process session ${e} not found`);return n.session?n.session:n.sessionPromise},a=()=>{let e=Array.from(n.values());n.clear();for(let t of e)t.session&&t.session.dispose().catch(()=>void 0)};return async(o,s)=>{switch(o.method){case`worker-exit`:return a(),{};case`worktree-cleanup-inputs`:return e.getWorktreeCleanupInputsForHost(o.params);case`codex-home`:{let e=o.params;return r(e).codexHome()}case`platform-family`:{let e=o.params;return r(e).platformFamily()}case`platform-os`:{let e=o.params;return r(e).platformOs()}case`process-start`:{let e=o.params,n=r({hostId:e.hostId}),{hostId:i,...a}=e,c=n.startProcess({...a,onStdoutDelta:t=>{s.emitEvent({method:`process-output-delta`,params:{processHandle:e.processHandle,stream:`stdout`,delta:{chunk:new Uint8Array(t.chunk.buffer,t.chunk.byteOffset,t.chunk.byteLength),capReached:t.capReached}}})},onStderrDelta:t=>{s.emitEvent({method:`process-output-delta`,params:{processHandle:e.processHandle,stream:`stderr`,delta:{chunk:new Uint8Array(t.chunk.buffer,t.chunk.byteOffset,t.chunk.byteLength),capReached:t.capReached}}})}}),l={sessionPromise:c,session:null};t.set(e.processHandle,l);try{let e=await c;return l.session=e,await e.response}finally{t.get(e.processHandle)===l&&t.delete(e.processHandle)}}case`fs-read-file`:{let{hostId:e,...t}=o.params;return r({hostId:e}).readFile(t)}case`fs-write-file`:{let{hostId:e,...t}=o.params;return r({hostId:e}).writeFile(t)}case`fs-create-directory`:{let{hostId:e,...t}=o.params;return r({hostId:e}).createDirectory(t)}case`fs-get-metadata`:{let{hostId:e,...t}=o.params;return r({hostId:e}).getMetadata(t)}case`fs-read-directory`:{let{hostId:e,...t}=o.params;return r({hostId:e}).readDirectory(t)}case`fs-remove`:{let{hostId:e,...t}=o.params;return r({hostId:e}).remove(t)}case`fs-copy`:{let{hostId:e,...t}=o.params;return r({hostId:e}).copy(t)}case`fs-watch`:{let{hostId:e,watchId:t,...i}=o.params,a=b4({hostId:e,watchId:t}),c=r({hostId:e}),l={session:null};n.set(a,l);let u;try{u=await c.startFileWatch({...i,watchId:t,onChange:r=>{n.get(a)===l&&s.emitEvent({method:`fs-watch-changed`,params:{hostId:e,watchId:t,changedPaths:r.changedPaths}})}})}catch(e){throw n.get(a)===l&&n.delete(a),e}return l.session=u,n.get(a)===l?(u.closed.then(r=>{n.get(a)===l&&(n.delete(a),s.emitEvent({method:`fs-watch-closed`,params:{hostId:e,watchId:t,reason:r.reason}}))}),{path:u.path}):(u.dispose().catch(()=>void 0),{path:u.path})}case`fs-unwatch`:{let e=o.params,t=b4(e),r=n.get(t);return r?(n.delete(t),r.session&&await r.session.dispose(),{}):{}}case`process-write`:{let e=o.params,t=await i(e.processHandle),n=e.delta==null?Buffer.alloc(0):Buffer.from(e.delta.buffer,e.delta.byteOffset,e.delta.byteLength);return t.write(n,{closeStdin:e.closeStdin})}case`process-resize`:{let e=o.params;return(await i(e.processHandle)).resize(e.size)}case`process-terminate`:{let e=o.params;return(await i(e.processHandle)).terminate()}}}}function S4(e){return e.replace(/\\/g,`/`)}function C4(e){let t=n.pt().replace(/\\/g,`/`),i=r.s(e).map(S4),a=e=>{let n=S4(e);return i.includes(n)?!1:n===t||n.startsWith(`${t}/`)},o=r.i(e),s=o.filter(e=>!a(e));s.length!==o.length&&r.u(e,s);let c=r.s(e),l=c.filter(e=>!a(e));l.length!==c.length&&r.d(e,l)}var w4={enabled:!1,running:!1,state:`disabled`};function T4(e){let t=(e instanceof Error?e.message:String(e)).toLowerCase();return t.includes(`sqlite state db`)||t.includes(`sqlite`)||t.includes(`database`)}async function E4(){let{startedAtMs:e,buildFlavor:o,desktopSentry:c,sparkleManager:l,setSparkleBridgeHandlers:u,setSecondInstanceArgsHandler:d}=r.O(),f=n.y(o),p=r.M.shouldIncludeSparkle(o,process.platform,process.env),m=r.M.shouldIncludeUpdater(o,process.platform,process.env),h=r.M.allowDevtools(o),g=o===r.M.Dev||o===r.M.Agent,_=r.M.allowDebugMenu(o),v=n.jt((e,t,n)=>{c.captureException(e,{level:t===`fatal`?`fatal`:`error`,tags:n.tags,extra:n.extra})}),y=a.app.getVersion(),b=r.N(),x=new n.It({source:`codex-desktop`,env:o,codexAppSessionId:i.t,buildInfo:{version:y,buildNumber:r.j.value},fetchImpl:(e,t)=>a.net.fetch(e instanceof URL?e.toString():e,t),reportFailure:e=>{v.reportNonFatal(`Datadog log sink failure`,{kind:`datadog-log-sink-failure`,tags:{failureType:e.type,reason:e.reason},extra:{failure:e}})}});r.y(v,x,i.t,f);let S=Ll({app:a.app}),C=Rl({app:a.app}),w=n.Br(`startup`),T=(t,n,r={})=>{let i=Date.now();w.trace(t,{safe:{phaseElapsedMs:i-n,startupElapsedMs:i-e,...r}})};T(`bootstrap handoff complete`,e,{appWhenReadyResolved:a.app.isReady()});let E=process.platform===`darwin`,D=process.platform===`win32`,O=!a.app.isPackaged,k=!1,A=new n.Ln;A.add(S),A.add(C),n.Lr().info(`Launching app`,{safe:{buildFlavor:o,nodeEnv:process.env.NODE_ENV,enableUpdater:m,enableSparkle:p,allowDevtools:h,allowInspectElement:g,allowDebugMenu:_,platform:process.platform,packaged:a.app.isPackaged,agentRunId:process.env.CODEX_ELECTRON_AGENT_RUN_ID?.trim()||null}});let j=Date.now();await a.app.whenReady(),T(`main app.whenReady resolved`,j),O&&(j=Date.now(),T(`react devtools extension loaded=${await fu()}`,j)),j=Date.now(),r.L(r.F(__dirname)),T(`registered app protocol`,j),j=Date.now(),await Pg(),T(`shell environment hydrated`,j);let M=HZ({moduleDir:__dirname});await r.z(M.repoRoot);let N=F2({buildFlavor:o,allowDevtools:h,allowDebugMenu:_,allowInspectElement:g,errorReporter:v,globalState:M.globalState,settingsStore:M.settingsStore,desktopRoot:M.desktopRoot,preloadPath:M.preloadPath,repoRoot:M.repoRoot,isMacOS:E,isWindows:D,isDevMode:O,canHideLastWindowToTray:()=>k,disposables:A}),ee=e=>N.isTrustedIpcSender(e.sender,e.senderFrame??null);BX({buildFlavor:o,getContextForWebContents:N.getContextForWebContents,isTrustedIpcEvent:ee,usesOwlAppShell:b}),a.ipcMain.on(gl,e=>{if(!ee(e)){e.returnValue=`light`;return}e.returnValue=a.nativeTheme.shouldUseDarkColors?`dark`:`light`});let te=()=>{let e=a.nativeTheme.shouldUseDarkColors?`dark`:`light`;N.windowManager.refreshWindowBackdrops();for(let t of a.BrowserWindow.getAllWindows())t.isDestroyed()||t.webContents.send(yl,e)};a.nativeTheme.on(`updated`,te),A.add(()=>{a.nativeTheme.off(`updated`,te)});let ne=LX(),P=null,re=e=>{if(e?.quitImmediately===!1){ne.allowQuitTemporarilyForUpdateInstall();return}ne.allowQuitTemporarilyForUpdateInstall(),a.app.quit()};u({onDownloadProgressChanged:e=>{N.sendMessageToAllRegisteredWindows({type:`app-update-download-progress-changed`,downloadProgressPercent:e})},onInstallProgressChanged:e=>{D&&N.sendMessageToAllRegisteredWindows({type:`app-update-install-progress-changed`,installProgressPercent:e})},onUpdateReadyChanged:e=>{N.sendMessageToAllRegisteredWindows({type:`app-update-ready-changed`,isUpdateReady:e})},onUpdateLifecycleStateChanged:e=>{N.sendMessageToAllRegisteredWindows({type:`app-update-lifecycle-state-changed`,lifecycleState:e})},onRelaunchNoticeChanged:e=>{N.sendMessageToAllRegisteredWindows({type:`app-update-relaunch-notice-changed`,relaunchNotice:e})},onInstallUpdatesRequested:e=>{re(e)},isTrustedIpcEvent:ee});let ie=U2({disposables:A,isTrustedIpcEvent:ee}),ae=[],oe=null,se=null,ce=e=>!1,le=oX({app:a.app,globalState:M.globalState,settingsStore:M.settingsStore,windowServices:N,repoRoot:M.repoRoot,errorReporter:v,desktopSentry:c,datadogLogger:x,maxLogLevel:f,buildFlavor:o,sparkleManager:l,filePreviewManager:N.filePreviewManager,avatarOverlayManager:N.avatarOverlayManager,hotkeyWindowLifecycleManager:N.hotkeyWindowLifecycleManager,hasActiveComputerUseTurn:e=>ce(e),globalDictationHotkeyController:N.globalDictationLifecycleManager.getHotkeyController(),appshotHotkeyController:N.appshotHotkeyController,gitManager:ie.gitManager,requestComputerUseCaptureWorker:ie.requestComputerUseCaptureWorker,requestGitWorker:ie.requestGitWorker,refreshApplicationMenu:()=>{se?.()},subscribeComputerUseCaptureWorkerEvent:ie.subscribeComputerUseCaptureWorkerEvent,subscribeGitWorkerEvent:ie.subscribeGitWorkerEvent,gitWorkerInvocationSampler:ie.gitWorkerInvocationSampler,updateWorkerSentryUser:ie.updateWorkerSentryUser,appEvent:ie.appEvent,onCompletedThreadsChanged:e=>{ae=e,oe?.setCompletedThreads(e)}}),ue=le.getWindowContext(),de=()=>ue.appServerConnectionRegistry.getConnection(I),fe=kZ({buildFlavor:o,globalState:M.globalState,errorReporter:v,sparkleManager:l,gitManager:ie.gitManager,getLocalAppServerClient:()=>ue.getAppServerClient(),applyCodexAppConfig:async e=>{try{await jc(e,await ue.applyCodexAppConfigFromDisk(M.codexHome))}catch(t){n.Lr().warning(`Failed to apply Codex app config from deeplink`,{safe:{},sensitive:{error:t}}),await jc(e,{status:`unexpected-error`,configPath:kc(M.codexHome),error:t})}},getLocalAppServerConnection:de,windowServices:N,ensureWindow:N.ensureWindow,getElectronMessageHandlerForWindow:le.getElectronMessageHandlerForWindow,allowDevtools:h,allowDebugMenu:_,enableSparkle:p,isMacOS:E,appVersion:y});se=fe.refreshApplicationMenu;let pe=()=>{fe.refreshApplicationMenu(),N.avatarOverlayManager.raiseWindow?.()};le.setOnBrowserSidebarStateChanged(()=>{fe.refreshApplicationMenu()}),a.app.on(`browser-window-focus`,pe),A.add(()=>{a.app.off(`browser-window-focus`,pe)}),N.windowManager.setOnMainProcessInspectorStateChanged(()=>{fe.refreshApplicationMenu()}),N.windowManager.setQueueCodexDeepLinkUrl(fe.deepLinks.queueCodexDeepLinkUrl),ie.setGitWorkerMainRpcHandler(x4({getAppServerClientForHost:le.getAppServerClientForHost,getWorktreeCleanupInputsForHost:le.getWorktreeCleanupInputsForHost})),ie.setComputerUseCaptureWorkerMainRpcHandler(y4({ensureManagedComputerUseService:()=>{if(P==null)throw Error(`Managed Computer Use service is unavailable`);return P.ensureServicePid()}})),ie.registerWorkerBusMessageHandlers(),E&&r.M.isInternal(o)&&ie.startComputerUseCaptureWorker(),j=Date.now(),fe.deepLinks.registerProtocolClient(),r.t(r.m(process.argv)),T(`registered deep link protocol`,j);let me=e=>{e.isMinimized()&&e.restore(),e.show(),e.focus()},he=async()=>{try{N.hotkeyWindowLifecycleManager.hide();let e=N.getPrimaryWindow()??await N.createFreshWindow(`/`);if(e==null)return;me(e)}catch(e){v.reportNonFatal(e instanceof Error?e:`Failed to open window on second instance`,{kind:`second-instance-open-window-failed`})}};d(e=>{let t=r.t(r.m(e));if(fe.deepLinks.queueProcessArgs(e)){t&&he();return}if(t){he();return}he()});let ge=async(e,t)=>{N.hotkeyWindowLifecycleManager.hide();let n=N.getPrimaryWindow(),r=n??await N.createFreshWindow(e);r!=null&&(le.desktopNotificationManager.dismissByNavigationPath(e),n!=null&&t.navigateExistingWindow&&fe.navigateToRoute(r,e),me(r))};E&&(oe=new au(e=>ge(e,{navigateExistingWindow:!0}),r.B()),oe.setCompletedThreads(ae));let _e=async()=>{k=!0;try{await t4({buildFlavor:o,repoRoot:M.repoRoot,onTrayButtonClick:async()=>{N.hotkeyWindowLifecycleManager.show()||await N.ensureWindow()},onTrayMenuOpenMainWindow:()=>ge(`/`,{navigateExistingWindow:!1}),onTrayMenuOpenNewThread:()=>ge(`/`,{navigateExistingWindow:!0}),onTrayMenuOpenRecentThread:e=>ge(e,{navigateExistingWindow:!0}),getChronicleSidecarControlState:()=>ue.appServerConnectionRegistry.getMaybeConnection(`local`)?.getChronicleSidecarControlState()??w4,toggleChronicleSidecar:async()=>{let e=ue.appServerConnectionRegistry.getMaybeConnection(I);return e==null?w4:e.getChronicleSidecarControlState().running?e.pauseChronicleSidecar():e.resumeChronicleSidecar()}})}catch(e){k=!1,v.reportNonFatal(e instanceof Error?e:`Failed to set up tray`,{kind:`tray-setup-failed`,tags:{errorType:`tray-setup-failed`}}),N.ensureWindow()}},ve=async e=>{if(E){if(k=e,!e){n4();return}await _e()}};D&&_e();let ye=Pn({codexCliPath:Ln({isPackaged:a.app.isPackaged,repoRoot:M.repoRoot}).codexCliPath,codexHome:M.codexHome,listPlugins:e=>de().listPlugins(e),onAnalyticsEvent:e=>{let t=N.getPrimaryWindow();t!=null&&N.windowManager.sendMessageToWebContents(t.webContents,{type:`computer-use-analytics-event`,event:e})}});ce=ye.hasActiveTurn,A.add(al({appServerConnection:de(),closeActiveTurn:ye.closeActiveTurn}));let be=yc({buildFlavor:o,codexHome:M.codexHome,getLocalAppServerConnection:de,globalState:M.globalState,isPackaged:a.app.isPackaged,onBrowserSkillsMayHaveChanged:()=>{N.sendMessageToAllRegisteredWindows({type:`ipc-broadcast`,method:`query-cache-invalidate`,sourceClientId:`desktop`,version:t.Er(`query-cache-invalidate`),params:{queryKey:[`skills`]}})},onReconcileComplete:()=>{N.sendMessageToAllRegisteredWindows({type:`ipc-broadcast`,method:`query-cache-invalidate`,sourceClientId:`desktop`,version:t.Er(`query-cache-invalidate`),params:{queryKey:[`plugins`]}}),ye.refresh()},repoRoot:M.repoRoot,trashItem:e=>a.shell.trashItem(e)}),xe=()=>{be.reconcileExternalPluginState(`focus`)};if(a.app.on(`browser-window-focus`,xe),A.add(()=>{a.app.off(`browser-window-focus`,xe)}),E){try{await Gc({sourceServiceAppPath:Fc(),codexHome:M.codexHome})}catch(e){n.Lr().warning(`Failed to sync canonical Computer Use service app during startup`,{safe:{},sensitive:{error:e}})}P=new rl(Wc(M.codexHome)),A.add(P)}let Se=Ye({setBrowserUseNativePipeEnabled:e=>{ue.getBrowserSessionRegistry().setBrowserUseNativePipeEnabled(e)}});A.add(()=>{Se.dispose(),ye.dispose()});let Ce=e=>{let t=Ue(e);if(fe.setDesktopFeatureAvailability(t),be.setDesktopFeatureAvailability(t),Se.setDesktopFeatureAvailability(t),ye.setDesktopFeatureAvailability(t),P!=null){let e=Be().appshotsEnabled;P.setAppshotsEnabled(e).catch(t=>{n.Lr().warning(`Failed to reconcile managed Computer Use service`,{safe:{appshotsEnabled:e},sensitive:{error:t}})})}};zX({desktopSentry:c,hotkeyWindowLifecycleManager:N.hotkeyWindowLifecycleManager,globalDictationLifecycleManager:N.globalDictationLifecycleManager,codexHome:M.codexHome,nativeContextMenuIconSearchRoots:[(0,s.join)(M.repoRoot,`webview`,`public`),(0,s.join)(M.desktopRoot,`webview`)],getContextForWebContents:N.getContextForWebContents,getPrimaryWindow:N.getPrimaryWindow,showPrimaryWindow:N.windowManager.showPrimaryWindow.bind(N.windowManager),ensureWindow:N.ensureWindow,createFreshWindow:N.createFreshWindow,setDesktopFeatureAvailability:Ce,restoreAvatarOverlayOpenState:e=>N.avatarOverlayManager.restoreOpenState(e),reloadBundledPlugins:()=>be.reloadBundledPlugins(),setMacMenuBarEnabled:ve,navigateToRoute:fe.navigateToRoute,getDockMenuController:()=>oe,getTrayController:e4,isTrustedIpcEvent:ee}),VX({isWindows:D,disableQuitConfirmationPrompt:process.env.CODEX_ELECTRON_DISABLE_QUIT_CONFIRMATION===`1`,quitState:ne,windows:N,applicationMenuManager:fe.applicationMenuManager,ensureWindow:N.ensureWindow,hotkeyWindowLifecycleManager:N.hotkeyWindowLifecycleManager,globalDictationLifecycleManager:N.globalDictationLifecycleManager,globalState:M.globalState,settingsStore:M.settingsStore,flushAndDisposeContext:le.flushAndDisposeContext,disposables:A,appEvent:ie.appEvent,errorReporter:v}),j=Date.now(),C4(M.globalState);try{await ue.applyCodexAppConfigFromDisk(M.codexHome)}catch(e){n.Lr().warning(`Failed to apply Codex app config during startup`,{safe:{},sensitive:{error:e}})}j=Date.now();let we=ue.appServerConnectionRegistry.getConnection(I);if(!await r._({databasePath:r.h,open:async()=>{await we.connect()},shouldHandleError:T4}))return;T(`local app-server sqlite initialized`,j);try{await M.settingsStore.initialize({readConfig:()=>we.getUserSavedConfiguration(),batchWriteConfigValues:e=>we.sendAppServerRequest(`config/batchWrite`,e)})}catch(e){n.Lr().warning(`Failed to initialize desktop settings`,{safe:{},sensitive:{error:e}})}re=e=>{if(e?.quitImmediately===!1){ne.allowQuitTemporarilyForUpdateInstall({allowWithoutPrompt:!0,skipDrainBeforeQuit:!0});return}s4({exitImmediately:D&&a.app.isPackaged,exitImmediatelyForUpdateInstall:()=>{D4({runCleanupBeforeImmediateExit:()=>{n4(),RX({hotkeyWindowLifecycleManager:N.hotkeyWindowLifecycleManager,globalDictationLifecycleManager:N.globalDictationLifecycleManager,flushAndDisposeContext:le.flushAndDisposeContext,disposables:A})},markAppQuitting:N.markAppQuitting})},quitForUpdateInstall:()=>{a.app.quit()},quitState:ne})};let Te=ci({appServerConnectionRegistry:ue.appServerConnectionRegistry,getDesktopFeatureAvailability:Be,gitManager:ie.gitManager,globalState:M.globalState,settingsStore:M.settingsStore,appServerClient:ue.getAppServerClient(),worktreeLifecycle:{requestCleanup:()=>{ue.getMessageHandler().getWorktreeService().requestCleanup()},setOwnerThread:({conversationId:e,worktree:t})=>ue.getMessageHandler().getWorktreeService().setOwnerThread({conversationId:e,worktree:t})},isPackaged:a.app.isPackaged,repoRoot:M.repoRoot}),Ee=Je({appEvent:ie.appEvent,appServerClient:ue.getAppServerClient(),appServerConnectionRegistry:ue.appServerConnectionRegistry,globalState:M.globalState,settingsStore:M.settingsStore});ue.getMessageHandler().setAutomationSchedulerController(Te),A.add(()=>{Te.dispose(),Ee.dispose()}),T(`window context initialized`,j);let De=Be(),Oe=Ue(De);Oe!==De&&Ce(Oe),j=Date.now(),await m4({isWindows:D,isPackaged:a.app.isPackaged,executablePath:process.execPath}),T(`windows folder context menu registered`,j,{isWindows:D}),j=Date.now(),fe.refreshApplicationMenu(),T(`application menu refreshed`,j),j=Date.now(),await be.waitForPendingReconcile(),T(`bundled plugins reconcile checked`,j,{isMacOS:E}),j=Date.now();let ke=await N.ensureWindow();ke&&(A.add(r.r({ensureWindow:N.ensureWindow,errorReporter:v,globalState:M.globalState,isMacOS:E,windowManager:N.windowManager})),me(ke)),T(`window ensured`,j,{windowVisible:ke?.isVisible()??!1}),j=Date.now(),await fe.deepLinks.flushPendingDeepLinks(),T(`pending deep links flushed`,j),T(`startup complete`,e)}function D4({markAppQuitting:e,runCleanupBeforeImmediateExit:t}){let r;try{e();try{g4()}catch(e){r??=e}try{_4()}catch(e){r??=e}t();for(let e of a.BrowserWindow.getAllWindows())e.isDestroyed()||e.destroy();if(r!=null)throw r instanceof Error?r:Error(typeof r==`string`?r:`Windows update cleanup failed.`)}catch(e){n.Lr().warning(`Immediate update exit cleanup failed before process exit`,{safe:{},sensitive:{error:e}})}finally{a.app.exit(0)}}exports.runMainAppStartup=E4; +`,Q0=`#00000000`,$0=`#000000`,e2=`#f9f9f9`,t2=3840,n2=2160,r2=320,i2=140,a2=400,o2=400,s2=46,c2=14,l2=16,u2=36,d2=`#1f1f1f`,f2=`#ffffff`;function p2(e){return{x:l2,y:Math.round((s2*e-c2)/2)}}function m2(e=1){return{color:Q0,symbolColor:a.nativeTheme.shouldUseDarkColors?f2:d2,height:Math.round(u2*e)}}var h2=class{browserCommentPopupWindowCreatedHandlers=new Set;readyWebContentsIds=new Set;pendingMessages=new Map;primaryWindows=new Set;primaryWindowLastActiveAtMs=new WeakMap;lastActivePrimaryWindow=null;windowAppearances=new Map;registeredWindowIds=new Set;registeredWebContentsIds=new Set;webContentsHostIds=new Map;opaqueWindowSurfaceModes=new Map;windowZooms=new Map;appShellShortcutStates=new Map;debugWindowManager;isAppQuitting=!1;rendererRecoveryAttempts=new Set;constructor(e){this.options=e,P0(),this.debugWindowManager=this.options.allowDebugMenu?new i0({createWindow:e=>this.createWindow(e),sendMessageToWindow:(e,t)=>this.sendMessageToWindow(e,t),showWindow:(e,t)=>this.showWindow(e,t)}):null}setOnMainProcessInspectorStateChanged(e){this.options.onMainProcessInspectorStateChanged=e}setQueueCodexDeepLinkUrl(e){this.options.queueCodexDeepLinkUrl=e}queueCodexDeepLinkUrl(e,t){return this.options.queueCodexDeepLinkUrl?.(e,t)===!0}markWebContentsReady(e){this.readyWebContentsIds.add(e.id),this.flushPendingMessages(e)}forgetWebContents(e){this.readyWebContentsIds.delete(e),this.pendingMessages.delete(e),this.appShellShortcutStates.delete(e),this.debugWindowManager?.forgetWebContents(e)}isWebContentsReady(e){return this.readyWebContentsIds.has(e)}setAppShellShortcutState(e,t){this.appShellShortcutStates.set(e,t)}setWindowZoom(e,t){let n=a.BrowserWindow.fromWebContents(e);n==null||this.windowAppearances.get(n.id)!==`primary`||(process.platform===`darwin`?n.setWindowButtonPosition(p2(t)):process.platform===`win32`&&(this.windowZooms.set(n.id,t),n.setTitleBarOverlay(m2(t))))}getAppShellShortcutState(e){return this.appShellShortcutStates.get(e)??null}markAppQuitting(){this.isAppQuitting=!0;let e=this.getPrimaryWindow();e&&this.persistPrimaryWindowBounds(e)}showPrimaryWindow(e){let t=this.getPrimaryWindow();return this.showWindow(t,e)}showLastActivePrimaryWindow(){let e=this.lastActivePrimaryWindow;return e!=null&&!e.isDestroyed()?this.showWindow(e):(this.lastActivePrimaryWindow=null,this.showWindow(this.getPrimaryWindow()))}isHotkeyWindowThread(e){return this.windowAppearances.get(e.id)===`hotkeyWindowThread`}showWindow(e,t){if(!e)return!1;e.isMinimized()&&e.restore();let n=t?.stealFocus===!0&&process.platform===`win32`;return n&&e.setAlwaysOnTop(!0),e.show(),t?.stealFocus===!0&&process.platform===`darwin`&&a.app.focus({steal:!0}),e.focus(),n&&e.setAlwaysOnTop(!1),!0}sendMessageToWindow(e,t){this.sendMessageToWebContents(e.webContents,t)}sendMessageToAllRegisteredWindows(e){this.sendMessageToAllWindows(e)}sendMessageToAllWindows(e){for(let t of a.BrowserWindow.getAllWindows())t.isDestroyed()||this.registeredWindowIds.has(t.id)&&this.sendMessageToWindow(t,e)}sendMessageToWebContents(e,t){if(e.isDestroyed())return;if(this.isWebContentsReady(e.id)){e.send(F,t);return}let n=this.pendingMessages.get(e.id)??[];n.push(t),this.pendingMessages.set(e.id,n)}sendMessageToWebContentsId(e,t){for(let n of a.BrowserWindow.getAllWindows())if(!(n.isDestroyed()||n.webContents.id!==e)){this.sendMessageToWebContents(n.webContents,t);return}}getPrimaryWindow(){let e=this.lastActivePrimaryWindow;if(e!=null&&!e.isDestroyed()&&this.primaryWindows.has(e))return e;let t=this.getPrimaryWindows().at(-1)??null;return t?(this.lastActivePrimaryWindow=t,t):(this.lastActivePrimaryWindow=null,null)}getPrimaryWindows(){return this.getTrackedPrimaryWindows()}wasPrimaryWindowFocusedWithin(e,t){if(!this.primaryWindows.has(e)||e.isDestroyed())return!1;if(e.isFocused())return!0;let n=this.primaryWindowLastActiveAtMs.get(e);return n!=null&&Date.now()-n<=t}refreshWindowBackdrops(){for(let e of a.BrowserWindow.getAllWindows()){if(e.isDestroyed()||!this.registeredWindowIds.has(e.id))continue;let t=this.windowAppearances.get(e.id);t!=null&&this.applyWindowBackdrop(e,t,!0)}}hasRegisteredWebContents(e){return this.registeredWebContentsIds.has(e.id)}getHostIdForWebContents(e){return this.webContentsHostIds.get(e.id)??null}isTrustedIpcSender(e,t){return e.id!=null&&!this.registeredWebContentsIds.has(e.id)?!1:v2({sender:e,senderFrame:t,moduleDir:this.options.moduleDir})}isMainProcessInspectorEnabled(){return E.url()!=null}async toggleMainProcessInspector(){throw Error(`Feature unavailable.`)}openMcpAppSandboxDevtools(e,t){F0(e,t,this.options.allowMcpAppSandboxDevtools===!0)}async createWindow(e={}){let{title:n,width:i=1280,height:o=820,appearance:c=`primary`,show:u=!0,initialRoute:d,hostId:f=I,parent:p,focusable:m,lockTitle:h=!1}=e,g=Date.now(),_=c===`primary`?I:f,v=c===`primary`,y=v?this.restorePrimaryWindowBounds():null,b=y?.width??i,x=y?.height??o,S=y?.x,C=y?.y,w=y?.isMaximized===!0,T=k2(c,this.getPrimaryMinimumSize()),E=this.isOpaqueWindowsEnabled(),D=N2({appearance:c,opaqueWindowsEnabled:E,platform:process.platform}),O=O2(c),k={preload:this.options.preloadPath,contextIsolation:!0,nodeIntegration:!1,spellcheck:!0,devTools:this.options.allowDevtools,...O?{webviewTag:!0}:{}},{backgroundColor:A,backgroundMaterial:j}=A2({platform:process.platform,appearance:c,opaqueWindowsEnabled:E,prefersDarkColors:a.nativeTheme.shouldUseDarkColors}),M=new a.BrowserWindow({width:b,height:x,...S===void 0||C===void 0?{}:{x:S,y:C},title:n??a.app.getName(),backgroundColor:A,show:u,...p==null?{}:{parent:p},...m==null?{}:{focusable:m},...(process.platform===`win32`||process.platform===`linux`)?{autoHideMenuBar:!0}:{},...j==null?{}:{backgroundMaterial:j},...D,...T==null?{}:{minWidth:T.width,minHeight:T.height},webPreferences:k});this.applyWindowBackdrop(M,c,!0);let N=M.webContents,ee=N.id;O&&R0(N,this.options.allowMcpAppSandboxDevtools===!0,{allowNonMcpAppSandboxWebviews:c===`primary`}),M.webContents.once(`did-finish-load`,()=>{M.webContents.setZoomLevel(0),J0().info(`window main frame finished load`,{safe:{hostId:_,windowId:M.id,webContentsId:M.webContents.id,appearance:c,startupElapsedMs:Date.now()-g}})}),M.once(`ready-to-show`,()=>{J0().info(`window ready-to-show`,{safe:{hostId:_,windowId:M.id,webContentsId:M.webContents.id,appearance:c,startupElapsedMs:Date.now()-g}})});let te=this.installWindowsTitleBarOverlaySync(M,c),ne=()=>{this.applyWindowBackdrop(M,c,!1)};process.platform===`darwin`&&(M.on(`move`,ne),M.on(`resize`,ne)),(process.platform===`win32`||process.platform===`linux`)&&M.removeMenu(),M.on(`closed`,()=>{te?.(),process.platform===`darwin`&&(M.removeListener(`move`,ne),M.removeListener(`resize`,ne))}),(h||c===`primary`||c===`hud`||c===`hotkeyWindowHome`||c===`hotkeyWindowThread`)&&M.on(`page-title-updated`,e=>{e.preventDefault(),M.isDestroyed()||M.setTitle(M.getTitle())}),this.installWebContentsDiagnostics(M),this.registerWindow(M,_,v,c),this.options.onWindowRegistered?.(M),v&&M.on(`close`,e=>{this.persistPrimaryWindowBounds(M);let t=this.getPrimaryWindows().some(e=>e!==M);if(process.platform===`win32`&&!this.isAppQuitting&&this.options.canHideLastWindowToTray?.()===!0&&!t){e.preventDefault(),M.hide();return}if(process.platform===`darwin`&&!this.isAppQuitting&&!t){if(M.isFullScreen()){e.preventDefault(),M.once(`leave-full-screen`,()=>{M.isDestroyed()||M.hide()}),M.setFullScreen(!1);return}e.preventDefault(),M.hide()}});let P=()=>{this.sendMessageToWindow(M,{type:`window-fullscreen-changed`,isFullScreen:M.isFullScreen()})};M.on(`enter-full-screen`,P),M.on(`leave-full-screen`,P),P();let re=()=>{this.applyWindowBackdrop(M,c,!1),this.sendMessageToWindow(M,{type:`electron-window-focus-changed`,isFocused:M.isFocused()})},ie=dW({allowDebugMenu:this.options.allowDebugMenu,getState:()=>this.appShellShortcutStates.get(ee)??null,sendAction:e=>{this.sendMessageToWebContents(N,e)}});M.on(`focus`,re),M.on(`blur`,re),M.on(`show`,re),M.on(`hide`,re),N.on(`before-input-event`,ie),re(),w&&M.once(`ready-to-show`,()=>{M.isDestroyed()||M.maximize()});let ae=y2();if(M.webContents.setWindowOpenHandler(({url:e,frameName:n})=>t.kr(n)?.windowId===t.Or.BROWSER_COMMENT_POPUP&&this.browserCommentPopupWindowCreatedHandlers.size>0&&e===`about:blank`&&c===`primary`&&x2(M.webContents.getURL(),this.options.moduleDir)?{action:`allow`,outlivesOpener:!1,overrideBrowserWindowOptions:this.createBrowserCommentPopupWindowOptions(M)}:ae&&U0(e,ae)?{action:`allow`}:(eG(e)&&a.shell.openExternal(e).catch(e=>{this.options.errorReporter.reportNonFatal(e instanceof Error?e:t.Bt(e),{kind:`open-external-window`})}),{action:`deny`})),M.webContents.on(`did-create-window`,(e,n)=>{let r=t.kr(n.frameName);if(!(r?.windowId!==t.Or.BROWSER_COMMENT_POPUP||n.url!==`about:blank`||c!==`primary`)){e.setMenuBarVisibility(!1),e.setVisibleOnAllWorkspaces(!1),(process.platform===`win32`||process.platform===`linux`)&&e.removeMenu(),e.hide(),this.installNativeContextMenu(e);for(let t of this.browserCommentPopupWindowCreatedHandlers)t({browserTabId:r.browserTabId,conversationId:r.conversationId,hostId:this.getHostIdForWebContents(M.webContents)??_,owner:M.webContents,sessionId:r.sessionId,window:e})}}),M.on(`closed`,()=>{this.appShellShortcutStates.delete(ee),!N.isDestroyed()&&N.removeListener(`before-input-event`,ie)}),M.webContents.on(`will-navigate`,(e,n)=>{W0(n,M.webContents.getURL(),ae)||(e.preventDefault(),eG(n)&&a.shell.openExternal(n).catch(e=>{this.options.errorReporter.reportNonFatal(e instanceof Error?e:t.Bt(e),{kind:`open-external-navigation`})}))}),M.webContents.on(`will-frame-navigate`,e=>{!e.isMainFrame&&C2(e.url)&&e.preventDefault()}),M.webContents.on(`will-redirect`,(e,t)=>{let n=e.url??t;!e.isMainFrame&&C2(n)&&e.preventDefault()}),this.installNativeContextMenu(M),!a.app.isPackaged){let e=new URL(_2());return d&&e.searchParams.set(`initialRoute`,d),O&&this.options.allowMcpAppSandboxDevtools===!0&&e.searchParams.set(`mcpAppSandboxDevtools`,`1`),M.loadURL(e.toString()),M}let oe=(0,s.join)(r.F(this.options.moduleDir),`index.html`);if((0,l.existsSync)(oe))try{return await M.loadURL(r.P(d,{mcpAppSandboxDevtools:O&&this.options.allowMcpAppSandboxDevtools===!0})),M}catch(e){J0().warning(`Failed to load bundle at`,{safe:{},sensitive:{indexPath:oe,error:e}})}let se=`data:text/html;charset=utf-8,${encodeURIComponent(Z0)}`;return await M.loadURL(se),M}async createPrimaryWindow(e={}){return this.createWindow({...e,appearance:`primary`})}addBrowserCommentPopupWindowCreatedHandler(e){return this.browserCommentPopupWindowCreatedHandlers.add(e),()=>{this.browserCommentPopupWindowCreatedHandlers.delete(e)}}createBrowserCommentPopupWindowOptions(e){let n=`browserCommentPopup`,r=this.isOpaqueWindowsEnabled(),{backgroundColor:i,backgroundMaterial:o}=A2({platform:process.platform,appearance:n,opaqueWindowsEnabled:r,prefersDarkColors:a.nativeTheme.shouldUseDarkColors});return{title:``,width:294,height:t.jr,parent:e,show:!1,backgroundColor:i,...o==null?{}:{backgroundMaterial:o},...N2({appearance:n,opaqueWindowsEnabled:r,platform:process.platform}),webPreferences:{contextIsolation:!0,nodeIntegration:!1,spellcheck:!0,devTools:this.options.allowDevtools}}}async createAuxWindow(e,t=I){let n=await this.createWindow({title:e,width:1024,height:720,appearance:`secondary`,show:!1,hostId:t});return n.setMenuBarVisibility(!1),n.setMinimumSize(400,400),n.center(),n}async ensureAuxWindow(e,t,n){let r=t.byOwner.get(e.id);if(r&&!r.window.isDestroyed())return r;r&&(t.byOwner.delete(e.id),t.byWindowId.delete(r.webContentsId));let i=await this.createAuxWindow(n,this.getHostIdForWebContents(e)??`local`),a=i.webContents.id,o={window:i,webContentsId:a,owner:e,ownerId:e.id,ready:this.isWebContentsReady(a)};return t.byOwner.set(e.id,o),t.byWindowId.set(a,o),i.on(`closed`,()=>{t.byWindowId.delete(a),t.byOwner.get(e.id)?.window===i&&t.byOwner.delete(e.id)}),e.once(`destroyed`,()=>{i.isDestroyed()||i.close()}),o}registerWindow(e,t,n,r){let i=e.id,a=e.webContents.id;this.windowAppearances.set(i,r),this.registeredWindowIds.add(i),this.registeredWebContentsIds.add(a),this.webContentsHostIds.set(a,t),n&&this.trackPrimaryWindow(e),e.on(`closed`,()=>{this.forgetWebContents(a),this.windowAppearances.delete(i),this.registeredWindowIds.delete(i),this.registeredWebContentsIds.delete(a),this.webContentsHostIds.delete(a),this.opaqueWindowSurfaceModes.delete(i),this.windowZooms.delete(i),n&&(this.primaryWindows.delete(e),this.lastActivePrimaryWindow===e&&(this.lastActivePrimaryWindow=null))})}trackPrimaryWindow(e){this.primaryWindows.add(e),this.lastActivePrimaryWindow=e,e.isFocused()&&this.primaryWindowLastActiveAtMs.set(e,Date.now()),e.on(`focus`,()=>{this.lastActivePrimaryWindow=e,this.primaryWindowLastActiveAtMs.set(e,Date.now())}),e.on(`blur`,()=>{this.primaryWindowLastActiveAtMs.set(e,Date.now())})}getTrackedPrimaryWindows(){let e=[];for(let t of this.primaryWindows){if(t.isDestroyed()){this.primaryWindows.delete(t);continue}e.push(t)}return this.primaryWindows.size===0?(this.lastActivePrimaryWindow=null,[]):(this.lastActivePrimaryWindow?.isDestroyed()&&(this.lastActivePrimaryWindow=null),e)}restorePrimaryWindowBounds(){let e=this.options.globalState.get(`electron-main-window-bounds`)??null;if(!e)return null;let t=this.clampPrimaryWindowBounds(e);return this.isWithinDisplayWorkArea(t)?t:null}getPrimaryMinimumSize(){return{width:480,height:600}}syncPrimaryMinimumSize(){let e=this.getPrimaryWindows();if(e.length===0)return;let t=this.getPrimaryMinimumSize();for(let n of e){if(n.setMinimumSize(t.width,t.height),n.isMaximized()||n.isFullScreen())continue;let e=n.getNormalBounds(),r=Math.max(e.width,t.width),i=Math.max(e.height,t.height);r===e.width&&i===e.height||n.setBounds({...e,width:r,height:i})}let n=this.getPrimaryWindow();n&&this.persistPrimaryWindowBounds(n)}persistPrimaryWindowBounds(e){if(e.isDestroyed())return;let t=e.getNormalBounds(),n=this.getPrimaryMinimumSize(),r={x:t.x,y:t.y,width:Math.max(t.width,n.width),height:Math.max(t.height,n.height),isMaximized:e.isMaximized()};this.options.globalState.set(`electron-main-window-bounds`,r)}clampPrimaryWindowBounds(e){let t=this.getPrimaryMinimumSize();return{...e,width:Math.max(e.width,t.width),height:Math.max(e.height,t.height)}}flushPendingMessages(e){let t=this.pendingMessages.get(e.id);if(!t||t.length===0){this.pendingMessages.delete(e.id);return}if(this.pendingMessages.delete(e.id),!e.isDestroyed())for(let n of t)e.send(F,n)}isWithinDisplayWorkArea(e){let t=a.screen.getAllDisplays();if(t.length===0)return!0;let n={x:e.x,y:e.y,width:e.width,height:e.height};return t.some(e=>{let t=e.workArea;return t.xn.x&&t.yn.y})}installWindowsTitleBarOverlaySync(e,t){if(process.platform!==`win32`||t!==`primary`)return;let n=()=>{e.isDestroyed()||e.setTitleBarOverlay(m2(this.windowZooms.get(e.id)))};return a.nativeTheme.on(`updated`,n),n(),()=>{a.nativeTheme.off(`updated`,n)}}isOpaqueWindowsEnabled(){return(g2(this.options.settingsStore.getEffective(t.E.theme.key)??`system`)===`light`?this.options.settingsStore.getEffective(t.E.lightChromeTheme.key):this.options.settingsStore.getEffective(t.E.darkChromeTheme.key))?.opaqueWindows===!0}shouldUseOpaqueWindowSurface(e,t,n){let r=a.screen.getDisplayMatching(t);return E2({appearance:e,opaqueWindowsEnabled:this.isOpaqueWindowsEnabled(),platform:process.platform})||D2({appearance:e,isFocused:n,platform:process.platform})||T2({appearance:e,platform:process.platform,scaleFactor:r.scaleFactor,windowBounds:t})}applyWindowBackdrop(e,t,n){let r=e.getBounds(),i=this.shouldUseOpaqueWindowSurface(t,r,e.isFocused());if(!n&&this.opaqueWindowSurfaceModes.get(e.id)===i)return;let{backgroundColor:o,backgroundMaterial:s}=A2({platform:process.platform,appearance:t,opaqueWindowsEnabled:i,prefersDarkColors:a.nativeTheme.shouldUseDarkColors});e.setBackgroundColor(o),s!=null&&e.setBackgroundMaterial(s),process.platform===`darwin`&&e.setVibrancy(j2(t,i)),this.opaqueWindowSurfaceModes.set(e.id,i),this.sendMessageToWindow(e,{type:`electron-window-opaque-surface-changed`,opaqueWindowSurfaceEnabled:i})}installNativeContextMenu(e){let t=r0({window:e,prepend:(e,t)=>{if(t.mediaType!==`image`)return[];let n=r.I(t.srcURL);return n==null?[]:[{label:X0,click:()=>{a.shell.showItemInFolder(n)}}]},showInspectElement:this.options.allowInspectElement});e.on(`closed`,()=>{t()})}installWebContentsDiagnostics(e){let t=e.webContents,n=e.id,r=t.id,i=this.options.errorReporter;t.on(`render-process-gone`,(t,a)=>{a.reason!==`clean-exit`&&(i.reportFatal(Error(`Renderer process gone (${a.reason})`),{tags:{errorType:`renderer-process-gone`,reason:a.reason},extra:{windowId:n,webContentsId:r,exitCode:a.exitCode}}),this.maybeRecoverFromRendererCrash(e,a.reason))}),t.on(`did-finish-load`,()=>{this.rendererRecoveryAttempts.delete(r)}),t.on(`unresponsive`,()=>{i.reportFatal(Error(`Renderer unresponsive`),{tags:{errorType:`renderer-unresponsive`},extra:{windowId:n,webContentsId:r,url:eM(t.getURL())}})}),t.on(`did-fail-load`,(e,t,a,o,s,c,l)=>{s&&t!==-3&&i.reportFatal(Error(`Renderer did-fail-load`),{tags:{errorType:`renderer-did-fail-load`},extra:{windowId:n,webContentsId:r,errorCode:t,errorDescription:a,validatedURL:eM(o),frameProcessId:c,frameRoutingId:l}})})}maybeRecoverFromRendererCrash(e,t){if(this.isAppQuitting||t===`clean-exit`||e.isDestroyed())return;let n=e.webContents;n.isDestroyed()||this.rendererRecoveryAttempts.has(n.id)||(this.rendererRecoveryAttempts.add(n.id),setTimeout(()=>{if(!e.isDestroyed()&&!e.webContents.isDestroyed())try{e.webContents.reload()}catch(e){J0().warning(`Failed to reload crashed window`,{safe:{},sensitive:{error:e}})}},500))}};function g2(e){return e===`system`?a.nativeTheme.shouldUseDarkColors?`dark`:`light`:e}function _2(){return process.env.ELECTRON_RENDERER_URL||Y0}function v2({sender:e,senderFrame:t,moduleDir:n}){return t!=null&&t!==e.mainFrame?!1:x2((t??e.mainFrame).url,n)}function y2(){let e=_2();return eG(e)?new URL(e).origin:null}function b2(e){return(0,s.join)(e,`..`,`..`,`webview`,`index.html`)}function x2(e,t){if(e===`about:blank`||S2(e))return!0;let n=y2();if(n&&U0(e,n))return!0;let r=(0,x.pathToFileURL)(b2(t)).toString();return!!e.startsWith(r)}function S2(e){try{let t=new URL(e);return t.protocol===`app:`?t.host===`-`||t.host===``:!1}catch{return!1}}function C2(e){try{return new URL(e).protocol===`app:`}catch{return!1}}function w2(e){return e===`avatarOverlay`||e===`browserCommentPopup`||e===`globalDictation`||e===`hotkeyWindowHome`||e===`hotkeyWindowThread`}function T2({appearance:e,platform:t,scaleFactor:n,windowBounds:r}){if(t!==`darwin`||w2(e))return!1;let i=r.width*n,a=r.height*n;return Math.max(i,a)>=t2&&Math.min(i,a)>=n2}function E2({appearance:e,opaqueWindowsEnabled:t,platform:n}){return t&&!w2(e)&&(n===`darwin`||n===`win32`)}function D2({appearance:e,isFocused:t,platform:n}){return!t&&!w2(e)&&(n===`darwin`||n===`win32`)}function O2(e){return e===`primary`||e===`hotkeyWindowThread`||e===`hud`}function k2(e,t){switch(e){case`avatarOverlay`:case`browserCommentPopup`:case`globalDictation`:return null;case`primary`:return t;case`hotkeyWindowHome`:return{width:r2,height:i2};case`hotkeyWindowThread`:return{width:a2,height:o2};case`hud`:case`secondary`:return{width:400,height:400}}}function A2({platform:e,appearance:t,opaqueWindowsEnabled:n,prefersDarkColors:r}){if(n&&!w2(t)&&(e===`darwin`||e===`win32`))return{backgroundColor:r?$0:e2,backgroundMaterial:e===`win32`?`none`:null};if(e===`win32`&&!w2(t))return{backgroundColor:Q0,backgroundMaterial:`mica`};if(e===`linux`&&!w2(t))return{backgroundColor:r?$0:e2,backgroundMaterial:null};return{backgroundColor:Q0,backgroundMaterial:null}}function j2(e,t){return t||w2(e)?null:`menu`}function M2({alwaysOnTop:e,hasShadow:t=!0,platform:n,resizable:r,thickFrame:i,transparent:a=!0}){return{frame:!1,transparent:a,hasShadow:t,resizable:r,minimizable:!1,maximizable:!1,fullscreenable:!1,skipTaskbar:!0,...e?{alwaysOnTop:!0}:{},...n===`win32`?{accentColor:!1,roundedCorners:!1,...i==null?{}:{thickFrame:i}}:{},...n===`darwin`?{type:`panel`}:{}}}function N2({appearance:e,opaqueWindowsEnabled:t,platform:n,windowZoom:r=1}){switch(e){case`browserCommentPopup`:return M2({hasShadow:!1,platform:n,resizable:!1,thickFrame:!1,transparent:!0});case`globalDictation`:return M2({alwaysOnTop:!0,hasShadow:!1,platform:n,resizable:!1,thickFrame:!1,transparent:!0});case`avatarOverlay`:return{...M2({alwaysOnTop:!0,platform:n,resizable:!1,thickFrame:!1}),...n===`linux`?{type:`toolbar`}:{},hasShadow:!1};case`hotkeyWindowHome`:return M2({platform:n,resizable:!1,thickFrame:!1});case`hotkeyWindowThread`:return M2({platform:n,resizable:!0});case`primary`:return n===`darwin`?t?{titleBarStyle:`hiddenInset`,trafficLightPosition:p2(r)}:{vibrancy:`menu`,titleBarStyle:`hiddenInset`,trafficLightPosition:p2(r)}:n===`win32`?{titleBarStyle:`hidden`,titleBarOverlay:m2(r)}:n===`linux`?{titleBarStyle:`hidden`}:{titleBarStyle:`default`};case`secondary`:return n===`darwin`?t?{titleBarStyle:`default`}:{vibrancy:`menu`,titleBarStyle:`default`}:{titleBarStyle:`default`};case`hud`:return n===`darwin`?t?{titleBarStyle:`hiddenInset`,minimizable:!1,maximizable:!1,fullscreenable:!1,alwaysOnTop:!0,trafficLightPosition:{x:10,y:10}}:{vibrancy:`menu`,titleBarStyle:`hiddenInset`,minimizable:!1,maximizable:!1,fullscreenable:!1,alwaysOnTop:!0,trafficLightPosition:{x:10,y:10}}:{titleBarStyle:`default`,minimizable:!1,maximizable:!1,fullscreenable:!1,alwaysOnTop:!0}}}var P2=2e3;function F2({buildFlavor:e,allowDevtools:n,allowInspectElement:i,allowDebugMenu:o,errorReporter:c,globalState:u,settingsStore:d,desktopRoot:f,preloadPath:p,repoRoot:m,isMacOS:h,isWindows:g,isDevMode:_,canHideLastWindowToTray:v,disposables:y}){let b=(0,s.join)(m,`electron`,`src`,`icons`),x=()=>{switch(e){case r.M.Dev:{let e=(0,s.join)(b,a.nativeTheme.shouldUseDarkColors?`icon-dev-dark.png`:`icon-dev-light.png`);return(0,l.existsSync)(e)?e:null}case r.M.Agent:{let e=(0,s.join)(process.resourcesPath,`icon-agent.png`);if(a.app.isPackaged&&(0,l.existsSync)(e))return e;let t=(0,s.join)(b,`icon-agent.png`);return(0,l.existsSync)(t)?t:null}case r.M.Nightly:case r.M.InternalAlpha:case r.M.PublicBeta:case r.M.Prod:return null}},S=()=>{let e=x(),t=e==null?a.nativeImage.createEmpty():a.nativeImage.createFromPath(e);t.isEmpty()||a.app.dock?.setIcon(t)};h&&(S(),a.nativeTheme.on(`updated`,S),y.add(()=>{a.nativeTheme.off(`updated`,S)}));let C=null,w=new h2({desktopRoot:f,iconDirectoryName:Sl,globalState:u,settingsStore:d,moduleDir:__dirname,preloadPath:p,repoRoot:m,allowDevtools:n,allowMcpAppSandboxDevtools:_,allowDebugMenu:o,allowInspectElement:i,errorReporter:c,canHideLastWindowToTray:v,onWindowRegistered:e=>{C?.registerWindow(e)}}),T=new zQ(w,F),E=new wQ(w,u),D=new J$({windowManager:w,globalState:u,isDevMode:_}),O=new w$({canForceGlobalDictationLock:_,forceGlobalDictationLock:_&&u.get(t._r.GLOBAL_DICTATION_FORCE_LOCK_DEBUG_ENABLED)===!0,windowManager:w,globalState:u}),k=GZ({windowManager:w,globalState:u,enabled:!0});y.add(()=>{k.dispose()});let A=e=>{if(!g)return;let t=setTimeout(()=>{e.isDestroyed()||e.isVisible()||(e.show(),e.focus())},P2);t.unref();let n=()=>{clearTimeout(t)};e.once(`show`,n),e.once(`closed`,n)},j=async({show:e,initialRoute:t})=>{if(C==null)return null;let n=await w.createPrimaryWindow({title:a.app.getName(),show:e,initialRoute:t===`/`?void 0:t});return e||A(n),n};return{windowManager:w,filePreviewManager:T,avatarOverlayManager:E,hotkeyWindowLifecycleManager:D,globalDictationLifecycleManager:O,appshotHotkeyController:k,setWindowContext:e=>{C=e;for(let t of a.BrowserWindow.getAllWindows())t.isDestroyed()||!w.hasRegisteredWebContents(t.webContents)||e.registerWindow(t)},ensureWindow:async()=>{let e=w.getPrimaryWindow();return e?C==null?null:(e.isMinimized()&&e.restore(),e.show(),e.focus(),e.isDestroyed()?null:e):j({show:!1})},createFreshWindow:async(e=`/`)=>j({show:!0,initialRoute:e}),showLastActivePrimaryWindow:()=>w.showLastActivePrimaryWindow(),markAppQuitting:()=>{w.markAppQuitting()},isTrustedIpcSender:w.isTrustedIpcSender.bind(w),sendMessageToWindow:w.sendMessageToWindow.bind(w),sendMessageToAllRegisteredWindows:w.sendMessageToAllRegisteredWindows.bind(w),sendMessageToAllWindows:w.sendMessageToAllWindows.bind(w),getPrimaryWindow:w.getPrimaryWindow.bind(w),getContextForWebContents:e=>w.hasRegisteredWebContents(e)?C:null}}var I2=3e4,L2=class{totalInvocations=0;rollingWindowCounter=new t.H({windowMs:I2});recordInvocation(e=Date.now()){this.totalInvocations+=1,this.rollingWindowCounter.record(1,e)}getSnapshot(e=Date.now()){let t=this.rollingWindowCounter.getSnapshot(e);return{totalInvocations:this.totalInvocations,invocationsLast30s:t.count}}};function R2(e){return typeof e==`object`&&!!e}function z2(e){return e===`worktree-cleanup-inputs`||e===`computer-use-service-pid`||e===`codex-home`||e===`platform-family`||e===`platform-os`||e===`process-start`||e===`process-write`||e===`process-resize`||e===`process-terminate`||e===`fs-read-file`||e===`fs-write-file`||e===`fs-create-directory`||e===`fs-get-metadata`||e===`fs-read-directory`||e===`fs-remove`||e===`fs-copy`||e===`fs-watch`||e===`fs-unwatch`||e===`worker-exit`}function B2(e){return R2(e)?e.type===`worker-main-rpc-request`&&typeof e.workerId==`string`&&typeof e.requestId==`string`&&z2(e.method):!1}var V2=class{worker=null;latestAuthUser=null;listeners=new Set;exitListeners=new Set;mainRpcHandler=null;exitedWorkers=new WeakSet;disposedWorkers=new WeakSet;constructor(e){this.id=e}dispose(){let e=this.worker;e&&(this.worker=null,this.disposedWorkers.add(e),this.handleWorkerExit(e),e.terminate())}addListener(e){return this.listeners.add(e),()=>{this.listeners.delete(e)}}addExitListener(e){return this.exitListeners.add(e),()=>{this.exitListeners.delete(e)}}setMainRpcHandler(e){this.mainRpcHandler=e}postMessage(e){this.ensureWorker().postMessage(e)}start(){this.ensureWorker()}setSentryUser(e,t,n,r){this.latestAuthUser={authMethod:e,userId:t,email:n,accountId:r};let i=this.worker;i&&i.postMessage({type:`worker-sentry-user-update`,authMethod:e,userId:t,email:n,accountId:r})}emitAppEvent(e){let t=this.worker;t&&t.postMessage({type:`worker-app-event`,event:e})}ensureWorker(){if(this.worker)return this.worker;let e=n.Rr(`worker-manager`),t=(0,s.join)(__dirname,`worker.js`),i=n.y(r.M.resolve()),o=a.app.isPackaged?a.app.getAppPath():process.cwd(),c={workerId:this.id,sentryInitOptions:r.A,maxLogLevel:i,sentryRewriteFramesRoot:o,spawnInsideWsl:n.Nr()},l=new S.Worker(t,{name:this.id,workerData:c});return l.on(`message`,e=>{if(B2(e)){this.handleMainRpcRequest(l,e);return}this.listeners.forEach(t=>{t(e)})}),l.on(`error`,t=>{e.warning(`Worker error`,{safe:{},sensitive:{error:t}})}),l.on(`exit`,t=>{this.worker===l&&(this.worker=null),this.handleWorkerExit(l),t!==0&&!this.disposedWorkers.has(l)&&e.warning(`Worker exited`,{safe:{code:t},sensitive:{}})}),l.unref(),this.worker=l,this.latestAuthUser&&l.postMessage({type:`worker-sentry-user-update`,authMethod:this.latestAuthUser.authMethod,userId:this.latestAuthUser.userId,email:this.latestAuthUser.email,accountId:this.latestAuthUser.accountId}),l}async handleMainRpcRequest(e,t){let r=n.Rr(`worker-manager`);if(t.workerId!==this.id){r.warning(`Received main RPC request for wrong worker`,{safe:{expectedWorkerId:this.id,workerId:t.workerId,method:t.method}});return}let i=this.mainRpcHandler;if(!i){let n={type:`worker-main-rpc-response`,workerId:this.id,requestId:t.requestId,method:t.method,result:{type:`error`,error:{message:`No main RPC handler configured for worker '${this.id}'`}}};e.postMessage(n);return}try{let n=await i(t,this.createMainRpcHandlerContext(e)),r={type:`worker-main-rpc-response`,workerId:this.id,requestId:t.requestId,method:t.method,result:{type:`ok`,value:n}};e.postMessage(r)}catch(n){let r={type:`worker-main-rpc-response`,workerId:this.id,requestId:t.requestId,method:t.method,result:{type:`error`,error:{message:n instanceof Error?n.message:`Failed to handle main RPC request: ${String(n)}`}}};e.postMessage(r)}}createMainRpcHandlerContext(e){return{emitEvent:t=>{let n={type:`worker-main-rpc-event`,workerId:this.id,method:t.method,params:t.params};e.postMessage(n)}}}handleWorkerExit(e){if(this.exitedWorkers.has(e))return;this.exitedWorkers.add(e),this.exitListeners.forEach(e=>{e()});let t=this.mainRpcHandler;if(!t)return;let r=n.Rr(`worker-manager`);t({type:`worker-main-rpc-request`,workerId:this.id,requestId:`worker-exit`,method:`worker-exit`,params:{}},this.createMainRpcHandlerContext(e)).catch(e=>{r.warning(`Worker exit cleanup failed`,{safe:{},sensitive:{error:e}})})}},H2=class{logger=n.Rr(`worker-bus-message-handler`);pending=new Map;pendingRequestFromHost=new Map;hostListeners=new Set;knownWebContents=new Set;workerManager;onWorkerRequestSent;constructor(e,t={}){this.workerId=e,this.onWorkerRequestSent=t.onWorkerRequestSent??null,this.workerManager=new V2(this.workerId),this.workerManager.addListener(e=>{this.handleWorkerMessage(e)})}async handleMessage(e,t){if(this.trackLifecycle(e),t.workerId!==this.workerId){this.logger.warning(`Received worker message for wrong worker`,{safe:{expectedWorkerId:this.workerId,workerId:t.workerId,type:t.type}});return}switch(t.type){case`worker-request`:{let n=t;this.pending.set(n.request.id,e),this.onWorkerRequestSent?.(),this.workerManager.postMessage(n);return}case`worker-request-cancel`:this.pending.delete(t.id);break}this.workerManager.postMessage(t)}dispose(){let e=Error(`Worker bus disposed for '${this.workerId}'`);for(let t of this.pendingRequestFromHost.values())t.reject(e);this.pendingRequestFromHost.clear(),this.workerManager.dispose()}requestFromHost(e){if(e.signal?.aborted)return Promise.reject(new DOMException(`Aborted`,`AbortError`));let n=t.n(`main-${(0,u.randomUUID)()}`),r={id:n,method:e.method,params:e.params},i={type:`worker-request`,workerId:this.workerId,request:r},a=new Promise((t,r)=>{this.pendingRequestFromHost.set(n,{method:e.method,resolve:e=>{t(e)},reject:r})});try{this.onWorkerRequestSent?.(),this.workerManager.postMessage(i)}catch(e){return this.pendingRequestFromHost.delete(n),Promise.reject(e instanceof Error?e:Error(`Failed to post worker request: ${String(e)}`))}let o=e.signal;if(o){let e=()=>{o.removeEventListener(`abort`,e);let t=this.pendingRequestFromHost.get(n);t&&(this.pendingRequestFromHost.delete(n),this.workerManager.postMessage({type:`worker-request-cancel`,workerId:this.workerId,id:n}),t.reject(new DOMException(`Aborted`,`AbortError`)))};o.addEventListener(`abort`,e);let t=()=>{o.removeEventListener(`abort`,e)};a.then(t,t)}return a}subscribeFromHost(e){return this.hostListeners.add(e),()=>{this.hostListeners.delete(e)}}subscribeWorkerExit(e){return this.workerManager.addExitListener(e)}setSentryUser(e,t,n,r){this.workerManager.setSentryUser(e,t,n,r)}emitAppEvent(e){this.workerManager.emitAppEvent(e)}setMainRpcHandler(e){this.workerManager.setMainRpcHandler(e)}startWorker(){this.workerManager.start()}trackLifecycle(e){this.knownWebContents.has(e)||(this.knownWebContents.add(e),e.once(`destroyed`,()=>{this.knownWebContents.delete(e),this.cleanupOrigin(e)}))}cleanupOrigin(e){for(let[t,n]of this.pending.entries()){if(n!==e)continue;this.pending.delete(t);let r={type:`worker-request-cancel`,workerId:this.workerId,id:t};this.workerManager.postMessage(r)}}handleWorkerMessage(e){if(e.workerId!==this.workerId){this.logger.warning(`Received worker message for wrong worker`,{safe:{expectedWorkerId:this.workerId,workerId:e.workerId,type:e.type}});return}if(e.type===`worker-response`){let t=this.pendingRequestFromHost.get(e.response.id);if(t){if(this.pendingRequestFromHost.delete(e.response.id),t.method!==e.response.method){t.reject(Error(`Mismatched worker response method`));return}if(e.response.result.type===`ok`){t.resolve(e.response.result.value);return}t.reject(Error(e.response.result.error.message));return}let n=this.pending.get(e.response.id);if(!n)return;this.pending.delete(e.response.id),this.send(n,e);return}this.hostListeners.forEach(t=>{t(e)}),this.broadcast(e)}send(e,t){e.isDestroyed()||e.send(Ol(this.workerId),t)}broadcast(e){this.knownWebContents.forEach(t=>{this.send(t,e)})}};function U2({disposables:e,isTrustedIpcEvent:r}){let i=new n.mr,o=new n.Z(i),s=new L2,c=[],l=new H2(`git`,{onWorkerRequestSent:()=>{s.recordInvocation()}}),u=new H2(`computer-use-capture`),d=new Set,f=new Map,p=null,m=null,h=(e,t,n,r)=>{p={authMethod:e,userId:t,email:n,accountId:r},c.forEach(i=>{i(e,t,n,r)}),f.forEach(i=>{i.setSentryUser(e,t,n,r)})},g=e=>l.requestFromHost(e),_=async e=>{let t=await u.requestFromHost(e);return b(e.params.requestId,e.signal),t},v=(t,n)=>{e.add(n),c.push((e,t,r,i)=>{n.setSentryUser(e,t,r,i)}),e.add(i.subscribe(e=>{n.emitAppEvent(e)}))},y=(e,t)=>{v(e,t),a.ipcMain.handle(Dl(e),async(e,n)=>{r(e)&&await t.handleMessage(e.sender,n)})};return{appEvent:i,gitManager:o,gitWorkerInvocationSampler:s,requestComputerUseCaptureWorker:_,requestGitWorker:g,subscribeComputerUseCaptureWorkerEvent:(e,t)=>{let n=n=>{W2(n,e)&&t(n)};return d.add(n),()=>{d.delete(n)}},subscribeGitWorkerEvent:(e,t)=>l.subscribeFromHost(n=>{n.type===`worker-event`&&G2(n.event,e)&&t(n.event)}),updateWorkerSentryUser:h,registerWorkerBusMessageHandlers:()=>{v(`computer-use-capture`,u);for(let e of t.t){if(e===`git`){y(e,l);continue}y(e,new H2(e))}},setGitWorkerMainRpcHandler:e=>{l.setMainRpcHandler(e)},setComputerUseCaptureWorkerMainRpcHandler:e=>{m=e,u.setMainRpcHandler(e),f.forEach(t=>{t.setMainRpcHandler(e)})},startComputerUseCaptureWorker:()=>{u.startWorker()}};function b(e,t){if(f.has(e))return;let n=new H2(`computer-use-capture`);m!=null&&n.setMainRpcHandler(m),f.set(e,n),p!=null&&n.setSentryUser(p.authMethod,p.userId,p.email,p.accountId);let r=i.subscribe(e=>{n.emitAppEvent(e)}),a=n.subscribeFromHost(t=>{t.type===`worker-event`&&(d.forEach(e=>{e(t.event)}),t.event.type===`update`&&t.event.requestId===e&&(t.event.update.type===`completed`||t.event.update.type===`failed`)&&l())}),o=n.subscribeWorkerExit(()=>{c||(u(`update_worker_exited`),l())}),s=()=>{l()};t?.addEventListener(`abort`,s,{once:!0});let c=!1,l=()=>{c||(c=!0,a(),o(),t?.removeEventListener(`abort`,s),r.dispose(),f.delete(e),n.dispose())},u=t=>{d.forEach(n=>{n({type:`update`,requestId:e,update:{type:`failed`,failureReason:t}})})};n.startWorker(),n.requestFromHost({method:`watchUpdates`,params:{requestId:e},signal:t}).catch(()=>{c||(u(`update_watch_failed`),l())})}}function W2(e,t){return e.type===t}function G2(e,t){return e.type===t}function K2(e,t){switch(e){case r.M.Agent:return`icon-agent`;case r.M.Nightly:return`icon-nightly`;case r.M.InternalAlpha:return`icon-alpha`;case r.M.PublicBeta:return`icon-beta`;case r.M.Dev:case r.M.Prod:return`icon`}}var q2=3,J2=5.5,Y2=1,X2=null,Z2=null,Q2=!1,$2=!1;function e4(){return X2}async function t4(e){return process.platform!==`win32`&&process.platform!==`darwin`?null:(Q2=!0,X2??Z2??($2||=(a.app.on(`before-quit`,()=>{n4()}),!0),Z2=(async()=>{let t=await r4(e.buildFlavor,e.repoRoot),n=new a.Tray(t.defaultIcon);return Q2?(n.setToolTip(a.app.getName()),X2=new _X(n,e.onTrayButtonClick,e.onTrayMenuOpenMainWindow,e.onTrayMenuOpenNewThread,e.onTrayMenuOpenRecentThread,e.getChronicleSidecarControlState,e.toggleChronicleSidecar,t,r.B(),a.app.getName()),X2):(n.destroy(),null)})().finally(()=>{Z2=null}),Z2))}function n4(){Q2=!1,X2?.destroy(),X2=null}async function r4(e,t){if(process.platform===`darwin`){let e=[...a.app.isPackaged?[(0,s.join)(process.resourcesPath,`codexTemplate.png`)]:[],(0,s.join)(t,`electron`,`src`,`icons`,`codexTemplate.png`)];for(let t of e){let e=a.nativeImage.createFromPath(t);if(!e.isEmpty())return e.setTemplateImage(!0),{defaultIcon:e,chronicleRunningIcon:i4(e)}}let n=await a.app.getFileIcon(process.execPath,{size:`normal`});return{defaultIcon:n,chronicleRunningIcon:i4(n)}}let n=process.platform===`win32`?`.ico`:`.png`,r=K2(e,process.platform),i=[...a.app.isPackaged?[(0,s.join)(process.resourcesPath,`${r}${n}`)]:[],(0,s.join)(t,`electron`,`src`,`icons`,`${r}${n}`)];for(let e of i){let t=a.nativeImage.createFromPath(e);if(!t.isEmpty())return{defaultIcon:t,chronicleRunningIcon:null}}return{defaultIcon:await a.app.getFileIcon(process.execPath,{size:process.platform===`win32`?`small`:`normal`}),chronicleRunningIcon:null}}function i4(e){let t=e.getSize(),n=t.width,r=t.height;if(n<=0||r<=0)return null;let i=a.nativeImage.createEmpty(),o=!1;for(let t of e.getScaleFactors()){let a=a4(e,n,r,t);a!=null&&(i.addRepresentation(a),o=!0)}return!o||i.isEmpty()?null:(i.setTemplateImage(!0),i)}function a4(e,t,n,r){let i=Buffer.from(e.toBitmap({scaleFactor:r})),a=o4(i,t,n);if(a==null)return null;let{height:o,scaleFactor:s,width:c}=a,l=Math.min(c,o)/Math.min(t,n),u=q2*l,d=J2*l,f=Y2*l,p=c-u-f,m=o-u-f;for(let e=0;e{switch(t.method){case`computer-use-service-pid`:return e.ensureManagedComputerUseService();case`worker-exit`:return{}}}}function b4(e){return JSON.stringify([e.hostId,e.watchId])}function x4(e){let t=new Map,n=new Map,r=t=>{let n=e.getAppServerClientForHost(t);if(!n)throw Error(`App server state for host ID ${t.hostId} not found`);return n},i=async e=>{let n=t.get(e);if(!n)throw Error(`Process session ${e} not found`);return n.session?n.session:n.sessionPromise},a=()=>{let e=Array.from(n.values());n.clear();for(let t of e)t.session&&t.session.dispose().catch(()=>void 0)};return async(o,s)=>{switch(o.method){case`worker-exit`:return a(),{};case`worktree-cleanup-inputs`:return e.getWorktreeCleanupInputsForHost(o.params);case`codex-home`:{let e=o.params;return r(e).codexHome()}case`platform-family`:{let e=o.params;return r(e).platformFamily()}case`platform-os`:{let e=o.params;return r(e).platformOs()}case`process-start`:{let e=o.params,n=r({hostId:e.hostId}),{hostId:i,...a}=e,c=n.startProcess({...a,onStdoutDelta:t=>{s.emitEvent({method:`process-output-delta`,params:{processHandle:e.processHandle,stream:`stdout`,delta:{chunk:new Uint8Array(t.chunk.buffer,t.chunk.byteOffset,t.chunk.byteLength),capReached:t.capReached}}})},onStderrDelta:t=>{s.emitEvent({method:`process-output-delta`,params:{processHandle:e.processHandle,stream:`stderr`,delta:{chunk:new Uint8Array(t.chunk.buffer,t.chunk.byteOffset,t.chunk.byteLength),capReached:t.capReached}}})}}),l={sessionPromise:c,session:null};t.set(e.processHandle,l);try{let e=await c;return l.session=e,await e.response}finally{t.get(e.processHandle)===l&&t.delete(e.processHandle)}}case`fs-read-file`:{let{hostId:e,...t}=o.params;return r({hostId:e}).readFile(t)}case`fs-write-file`:{let{hostId:e,...t}=o.params;return r({hostId:e}).writeFile(t)}case`fs-create-directory`:{let{hostId:e,...t}=o.params;return r({hostId:e}).createDirectory(t)}case`fs-get-metadata`:{let{hostId:e,...t}=o.params;return r({hostId:e}).getMetadata(t)}case`fs-read-directory`:{let{hostId:e,...t}=o.params;return r({hostId:e}).readDirectory(t)}case`fs-remove`:{let{hostId:e,...t}=o.params;return r({hostId:e}).remove(t)}case`fs-copy`:{let{hostId:e,...t}=o.params;return r({hostId:e}).copy(t)}case`fs-watch`:{let{hostId:e,watchId:t,...i}=o.params,a=b4({hostId:e,watchId:t}),c=r({hostId:e}),l={session:null};n.set(a,l);let u;try{u=await c.startFileWatch({...i,watchId:t,onChange:r=>{n.get(a)===l&&s.emitEvent({method:`fs-watch-changed`,params:{hostId:e,watchId:t,changedPaths:r.changedPaths}})}})}catch(e){throw n.get(a)===l&&n.delete(a),e}return l.session=u,n.get(a)===l?(u.closed.then(r=>{n.get(a)===l&&(n.delete(a),s.emitEvent({method:`fs-watch-closed`,params:{hostId:e,watchId:t,reason:r.reason}}))}),{path:u.path}):(u.dispose().catch(()=>void 0),{path:u.path})}case`fs-unwatch`:{let e=o.params,t=b4(e),r=n.get(t);return r?(n.delete(t),r.session&&await r.session.dispose(),{}):{}}case`process-write`:{let e=o.params,t=await i(e.processHandle),n=e.delta==null?Buffer.alloc(0):Buffer.from(e.delta.buffer,e.delta.byteOffset,e.delta.byteLength);return t.write(n,{closeStdin:e.closeStdin})}case`process-resize`:{let e=o.params;return(await i(e.processHandle)).resize(e.size)}case`process-terminate`:{let e=o.params;return(await i(e.processHandle)).terminate()}}}}function S4(e){return e.replace(/\\/g,`/`)}function C4(e){let t=n.pt().replace(/\\/g,`/`),i=r.s(e).map(S4),a=e=>{let n=S4(e);return i.includes(n)?!1:n===t||n.startsWith(`${t}/`)},o=r.i(e),s=o.filter(e=>!a(e));s.length!==o.length&&r.u(e,s);let c=r.s(e),l=c.filter(e=>!a(e));l.length!==c.length&&r.d(e,l)}var w4={enabled:!1,running:!1,state:`disabled`};function T4(e){let t=(e instanceof Error?e.message:String(e)).toLowerCase();return t.includes(`sqlite state db`)||t.includes(`sqlite`)||t.includes(`database`)}async function E4(){let{startedAtMs:e,buildFlavor:o,desktopSentry:c,sparkleManager:l,setSparkleBridgeHandlers:u,setSecondInstanceArgsHandler:d}=r.O(),f=n.y(o),p=r.M.shouldIncludeSparkle(o,process.platform,process.env),m=r.M.shouldIncludeUpdater(o,process.platform,process.env),h=r.M.allowDevtools(o),g=o===r.M.Dev||o===r.M.Agent,_=r.M.allowDebugMenu(o),v=n.jt((e,t,n)=>{c.captureException(e,{level:t===`fatal`?`fatal`:`error`,tags:n.tags,extra:n.extra})}),y=a.app.getVersion(),b=r.N(),x=new n.It({source:`codex-desktop`,env:o,codexAppSessionId:i.t,buildInfo:{version:y,buildNumber:r.j.value},fetchImpl:(e,t)=>a.net.fetch(e instanceof URL?e.toString():e,t),reportFailure:e=>{v.reportNonFatal(`Datadog log sink failure`,{kind:`datadog-log-sink-failure`,tags:{failureType:e.type,reason:e.reason},extra:{failure:e}})}});r.y(v,x,i.t,f);let S=Ll({app:a.app}),C=Rl({app:a.app}),w=n.Br(`startup`),T=(t,n,r={})=>{let i=Date.now();w.trace(t,{safe:{phaseElapsedMs:i-n,startupElapsedMs:i-e,...r}})};T(`bootstrap handoff complete`,e,{appWhenReadyResolved:a.app.isReady()});let E=process.platform===`darwin`,D=process.platform===`win32`,O=!a.app.isPackaged,k=!1,A=new n.Ln;A.add(S),A.add(C),n.Lr().info(`Launching app`,{safe:{buildFlavor:o,nodeEnv:process.env.NODE_ENV,enableUpdater:m,enableSparkle:p,allowDevtools:h,allowInspectElement:g,allowDebugMenu:_,platform:process.platform,packaged:a.app.isPackaged,agentRunId:process.env.CODEX_ELECTRON_AGENT_RUN_ID?.trim()||null}});let j=Date.now();await a.app.whenReady(),T(`main app.whenReady resolved`,j),O&&(j=Date.now(),T(`react devtools extension loaded=${await fu()}`,j)),j=Date.now(),r.L(r.F(__dirname)),T(`registered app protocol`,j),j=Date.now(),await Pg(),T(`shell environment hydrated`,j);let M=HZ({moduleDir:__dirname});await r.z(M.repoRoot);let N=F2({buildFlavor:o,allowDevtools:h,allowDebugMenu:_,allowInspectElement:g,errorReporter:v,globalState:M.globalState,settingsStore:M.settingsStore,desktopRoot:M.desktopRoot,preloadPath:M.preloadPath,repoRoot:M.repoRoot,isMacOS:E,isWindows:D,isDevMode:O,canHideLastWindowToTray:()=>k,disposables:A}),ee=e=>N.isTrustedIpcSender(e.sender,e.senderFrame??null);BX({buildFlavor:o,getContextForWebContents:N.getContextForWebContents,isTrustedIpcEvent:ee,usesOwlAppShell:b}),a.ipcMain.on(gl,e=>{if(!ee(e)){e.returnValue=`light`;return}e.returnValue=a.nativeTheme.shouldUseDarkColors?`dark`:`light`});let te=()=>{let e=a.nativeTheme.shouldUseDarkColors?`dark`:`light`;N.windowManager.refreshWindowBackdrops();for(let t of a.BrowserWindow.getAllWindows())t.isDestroyed()||t.webContents.send(yl,e)};a.nativeTheme.on(`updated`,te),A.add(()=>{a.nativeTheme.off(`updated`,te)});let ne=LX(),P=null,re=e=>{if(e?.quitImmediately===!1){ne.allowQuitTemporarilyForUpdateInstall();return}ne.allowQuitTemporarilyForUpdateInstall(),a.app.quit()};u({onDownloadProgressChanged:e=>{N.sendMessageToAllRegisteredWindows({type:`app-update-download-progress-changed`,downloadProgressPercent:e})},onInstallProgressChanged:e=>{D&&N.sendMessageToAllRegisteredWindows({type:`app-update-install-progress-changed`,installProgressPercent:e})},onUpdateReadyChanged:e=>{N.sendMessageToAllRegisteredWindows({type:`app-update-ready-changed`,isUpdateReady:e})},onUpdateLifecycleStateChanged:e=>{N.sendMessageToAllRegisteredWindows({type:`app-update-lifecycle-state-changed`,lifecycleState:e})},onRelaunchNoticeChanged:e=>{N.sendMessageToAllRegisteredWindows({type:`app-update-relaunch-notice-changed`,relaunchNotice:e})},onInstallUpdatesRequested:e=>{re(e)},isTrustedIpcEvent:ee});let ie=U2({disposables:A,isTrustedIpcEvent:ee}),ae=[],oe=null,se=null,ce=e=>!1,le=oX({app:a.app,globalState:M.globalState,settingsStore:M.settingsStore,windowServices:N,repoRoot:M.repoRoot,errorReporter:v,desktopSentry:c,datadogLogger:x,maxLogLevel:f,buildFlavor:o,sparkleManager:l,filePreviewManager:N.filePreviewManager,avatarOverlayManager:N.avatarOverlayManager,hotkeyWindowLifecycleManager:N.hotkeyWindowLifecycleManager,hasActiveComputerUseTurn:e=>ce(e),globalDictationHotkeyController:N.globalDictationLifecycleManager.getHotkeyController(),appshotHotkeyController:N.appshotHotkeyController,gitManager:ie.gitManager,requestComputerUseCaptureWorker:ie.requestComputerUseCaptureWorker,requestGitWorker:ie.requestGitWorker,refreshApplicationMenu:()=>{se?.()},subscribeComputerUseCaptureWorkerEvent:ie.subscribeComputerUseCaptureWorkerEvent,subscribeGitWorkerEvent:ie.subscribeGitWorkerEvent,gitWorkerInvocationSampler:ie.gitWorkerInvocationSampler,updateWorkerSentryUser:ie.updateWorkerSentryUser,appEvent:ie.appEvent,onCompletedThreadsChanged:e=>{ae=e,oe?.setCompletedThreads(e)}}),ue=le.getWindowContext(),de=()=>ue.appServerConnectionRegistry.getConnection(I),fe=kZ({buildFlavor:o,globalState:M.globalState,errorReporter:v,sparkleManager:l,gitManager:ie.gitManager,getLocalAppServerClient:()=>ue.getAppServerClient(),applyCodexAppConfig:async e=>{try{await jc(e,await ue.applyCodexAppConfigFromDisk(M.codexHome))}catch(t){n.Lr().warning(`Failed to apply Codex app config from deeplink`,{safe:{},sensitive:{error:t}}),await jc(e,{status:`unexpected-error`,configPath:kc(M.codexHome),error:t})}},getLocalAppServerConnection:de,windowServices:N,ensureWindow:N.ensureWindow,getElectronMessageHandlerForWindow:le.getElectronMessageHandlerForWindow,allowDevtools:h,allowDebugMenu:_,enableSparkle:p,isMacOS:E,appVersion:y});se=fe.refreshApplicationMenu;let pe=()=>{fe.refreshApplicationMenu(),N.avatarOverlayManager.raiseWindow?.()};le.setOnBrowserSidebarStateChanged(()=>{fe.refreshApplicationMenu()}),a.app.on(`browser-window-focus`,pe),A.add(()=>{a.app.off(`browser-window-focus`,pe)}),N.windowManager.setOnMainProcessInspectorStateChanged(()=>{fe.refreshApplicationMenu()}),N.windowManager.setQueueCodexDeepLinkUrl(fe.deepLinks.queueCodexDeepLinkUrl),ie.setGitWorkerMainRpcHandler(x4({getAppServerClientForHost:le.getAppServerClientForHost,getWorktreeCleanupInputsForHost:le.getWorktreeCleanupInputsForHost})),ie.setComputerUseCaptureWorkerMainRpcHandler(y4({ensureManagedComputerUseService:()=>{if(P==null)throw Error(`Managed Computer Use service is unavailable`);return P.ensureServicePid()}})),ie.registerWorkerBusMessageHandlers(),E&&r.M.isInternal(o)&&ie.startComputerUseCaptureWorker(),j=Date.now(),fe.deepLinks.registerProtocolClient(),r.t(r.m(process.argv)),T(`registered deep link protocol`,j);let me=e=>{e.isMinimized()&&e.restore(),e.show(),e.focus()},he=async()=>{try{N.hotkeyWindowLifecycleManager.hide();let e=N.getPrimaryWindow()??await N.createFreshWindow(`/`);if(e==null)return;me(e)}catch(e){v.reportNonFatal(e instanceof Error?e:`Failed to open window on second instance`,{kind:`second-instance-open-window-failed`})}};d(e=>{let t=r.t(r.m(e));if(fe.deepLinks.queueProcessArgs(e)){t&&he();return}if(t){he();return}he()});let ge=async(e,t)=>{N.hotkeyWindowLifecycleManager.hide();let n=N.getPrimaryWindow(),r=n??await N.createFreshWindow(e);r!=null&&(le.desktopNotificationManager.dismissByNavigationPath(e),n!=null&&t.navigateExistingWindow&&fe.navigateToRoute(r,e),me(r))};E&&(oe=new au(e=>ge(e,{navigateExistingWindow:!0}),r.B()),oe.setCompletedThreads(ae));let _e=async()=>{k=!0;try{await t4({buildFlavor:o,repoRoot:M.repoRoot,onTrayButtonClick:async()=>{N.hotkeyWindowLifecycleManager.show()||await N.ensureWindow()},onTrayMenuOpenMainWindow:()=>ge(`/`,{navigateExistingWindow:!1}),onTrayMenuOpenNewThread:()=>ge(`/`,{navigateExistingWindow:!0}),onTrayMenuOpenRecentThread:e=>ge(e,{navigateExistingWindow:!0}),getChronicleSidecarControlState:()=>ue.appServerConnectionRegistry.getMaybeConnection(`local`)?.getChronicleSidecarControlState()??w4,toggleChronicleSidecar:async()=>{let e=ue.appServerConnectionRegistry.getMaybeConnection(I);return e==null?w4:e.getChronicleSidecarControlState().running?e.pauseChronicleSidecar():e.resumeChronicleSidecar()}})}catch(e){k=!1,v.reportNonFatal(e instanceof Error?e:`Failed to set up tray`,{kind:`tray-setup-failed`,tags:{errorType:`tray-setup-failed`}}),N.ensureWindow()}},ve=async e=>{if(E){if(k=e,!e){n4();return}await _e()}};D&&_e();let ye=Pn({codexCliPath:Ln({isPackaged:a.app.isPackaged,repoRoot:M.repoRoot}).codexCliPath,codexHome:M.codexHome,listPlugins:e=>de().listPlugins(e),onAnalyticsEvent:e=>{let t=N.getPrimaryWindow();t!=null&&N.windowManager.sendMessageToWebContents(t.webContents,{type:`computer-use-analytics-event`,event:e})}});ce=ye.hasActiveTurn,A.add(al({appServerConnection:de(),closeActiveTurn:ye.closeActiveTurn}));let be=yc({buildFlavor:o,codexHome:M.codexHome,getLocalAppServerConnection:de,globalState:M.globalState,isPackaged:a.app.isPackaged,onBrowserSkillsMayHaveChanged:()=>{N.sendMessageToAllRegisteredWindows({type:`ipc-broadcast`,method:`query-cache-invalidate`,sourceClientId:`desktop`,version:t.Er(`query-cache-invalidate`),params:{queryKey:[`skills`]}})},onReconcileComplete:()=>{N.sendMessageToAllRegisteredWindows({type:`ipc-broadcast`,method:`query-cache-invalidate`,sourceClientId:`desktop`,version:t.Er(`query-cache-invalidate`),params:{queryKey:[`plugins`]}}),ye.refresh()},repoRoot:M.repoRoot,trashItem:e=>a.shell.trashItem(e)}),xe=()=>{be.reconcileExternalPluginState(`focus`)};if(a.app.on(`browser-window-focus`,xe),A.add(()=>{a.app.off(`browser-window-focus`,xe)}),E){try{await Gc({sourceServiceAppPath:Fc(),codexHome:M.codexHome})}catch(e){n.Lr().warning(`Failed to sync canonical Computer Use service app during startup`,{safe:{},sensitive:{error:e}})}P=new rl(Wc(M.codexHome)),A.add(P)}let Se=Ye({setBrowserUseNativePipeEnabled:e=>{ue.getBrowserSessionRegistry().setBrowserUseNativePipeEnabled(e)}});A.add(()=>{Se.dispose(),ye.dispose()});let Ce=e=>{let t=Ue(e);if(fe.setDesktopFeatureAvailability(t),be.setDesktopFeatureAvailability(t),Se.setDesktopFeatureAvailability(t),ye.setDesktopFeatureAvailability(t),P!=null){let e=Be().appshotsEnabled;P.setAppshotsEnabled(e).catch(t=>{n.Lr().warning(`Failed to reconcile managed Computer Use service`,{safe:{appshotsEnabled:e},sensitive:{error:t}})})}};zX({desktopSentry:c,hotkeyWindowLifecycleManager:N.hotkeyWindowLifecycleManager,globalDictationLifecycleManager:N.globalDictationLifecycleManager,codexHome:M.codexHome,nativeContextMenuIconSearchRoots:[(0,s.join)(M.repoRoot,`webview`,`public`),(0,s.join)(M.desktopRoot,`webview`)],getContextForWebContents:N.getContextForWebContents,getPrimaryWindow:N.getPrimaryWindow,showPrimaryWindow:N.windowManager.showPrimaryWindow.bind(N.windowManager),ensureWindow:N.ensureWindow,createFreshWindow:N.createFreshWindow,setDesktopFeatureAvailability:Ce,restoreAvatarOverlayOpenState:e=>N.avatarOverlayManager.restoreOpenState(e),reloadBundledPlugins:()=>be.reloadBundledPlugins(),setMacMenuBarEnabled:ve,navigateToRoute:fe.navigateToRoute,getDockMenuController:()=>oe,getTrayController:e4,isTrustedIpcEvent:ee}),VX({isWindows:D,disableQuitConfirmationPrompt:process.env.CODEX_ELECTRON_DISABLE_QUIT_CONFIRMATION===`1`,quitState:ne,windows:N,applicationMenuManager:fe.applicationMenuManager,ensureWindow:N.ensureWindow,hotkeyWindowLifecycleManager:N.hotkeyWindowLifecycleManager,globalDictationLifecycleManager:N.globalDictationLifecycleManager,globalState:M.globalState,settingsStore:M.settingsStore,flushAndDisposeContext:le.flushAndDisposeContext,disposables:A,appEvent:ie.appEvent,errorReporter:v}),j=Date.now(),C4(M.globalState);try{await ue.applyCodexAppConfigFromDisk(M.codexHome)}catch(e){n.Lr().warning(`Failed to apply Codex app config during startup`,{safe:{},sensitive:{error:e}})}j=Date.now();let we=ue.appServerConnectionRegistry.getConnection(I);if(!await r._({databasePath:r.h,open:async()=>{await we.connect()},shouldHandleError:T4}))return;T(`local app-server sqlite initialized`,j);try{await M.settingsStore.initialize({readConfig:()=>we.getUserSavedConfiguration(),batchWriteConfigValues:e=>we.sendAppServerRequest(`config/batchWrite`,e)})}catch(e){n.Lr().warning(`Failed to initialize desktop settings`,{safe:{},sensitive:{error:e}})}re=e=>{if(e?.quitImmediately===!1){ne.allowQuitTemporarilyForUpdateInstall({allowWithoutPrompt:!0,skipDrainBeforeQuit:!0});return}s4({exitImmediately:D&&a.app.isPackaged,exitImmediatelyForUpdateInstall:()=>{D4({runCleanupBeforeImmediateExit:()=>{n4(),RX({hotkeyWindowLifecycleManager:N.hotkeyWindowLifecycleManager,globalDictationLifecycleManager:N.globalDictationLifecycleManager,flushAndDisposeContext:le.flushAndDisposeContext,disposables:A})},markAppQuitting:N.markAppQuitting})},quitForUpdateInstall:()=>{a.app.quit()},quitState:ne})};let Te=ci({appServerConnectionRegistry:ue.appServerConnectionRegistry,getDesktopFeatureAvailability:Be,gitManager:ie.gitManager,globalState:M.globalState,settingsStore:M.settingsStore,appServerClient:ue.getAppServerClient(),worktreeLifecycle:{requestCleanup:()=>{ue.getMessageHandler().getWorktreeService().requestCleanup()},setOwnerThread:({conversationId:e,worktree:t})=>ue.getMessageHandler().getWorktreeService().setOwnerThread({conversationId:e,worktree:t})},isPackaged:a.app.isPackaged,repoRoot:M.repoRoot}),Ee=Je({appEvent:ie.appEvent,appServerClient:ue.getAppServerClient(),appServerConnectionRegistry:ue.appServerConnectionRegistry,globalState:M.globalState,settingsStore:M.settingsStore});ue.getMessageHandler().setAutomationSchedulerController(Te),A.add(()=>{Te.dispose(),Ee.dispose()}),T(`window context initialized`,j);let De=Be(),Oe=Ue(De);Oe!==De&&Ce(Oe),j=Date.now(),await m4({isWindows:D,isPackaged:a.app.isPackaged,executablePath:process.execPath}),T(`windows folder context menu registered`,j,{isWindows:D}),j=Date.now(),fe.refreshApplicationMenu(),T(`application menu refreshed`,j),j=Date.now(),await be.waitForPendingReconcile(),T(`bundled plugins reconcile checked`,j,{isMacOS:E}),j=Date.now();let ke=await N.ensureWindow();ke&&(A.add(r.r({ensureWindow:N.ensureWindow,errorReporter:v,globalState:M.globalState,isMacOS:E,windowManager:N.windowManager})),me(ke)),T(`window ensured`,j,{windowVisible:ke?.isVisible()??!1}),j=Date.now(),await fe.deepLinks.flushPendingDeepLinks(),T(`pending deep links flushed`,j),T(`startup complete`,e)}function D4({markAppQuitting:e,runCleanupBeforeImmediateExit:t}){let r;try{e();try{g4()}catch(e){r??=e}try{_4()}catch(e){r??=e}t();for(let e of a.BrowserWindow.getAllWindows())e.isDestroyed()||e.destroy();if(r!=null)throw r instanceof Error?r:Error(typeof r==`string`?r:`Windows update cleanup failed.`)}catch(e){n.Lr().warning(`Immediate update exit cleanup failed before process exit`,{safe:{},sensitive:{error:e}})}finally{a.app.exit(0)}}exports.runMainAppStartup=E4; //# sourceMappingURL=main-BJ6Uf5yA.js.map \ No newline at end of file diff --git a/desktop/recovered/app-asar-extracted/.vite/build/preload.js b/desktop/recovered/app-asar-extracted/.vite/build/preload.js index d8949585..44640d95 100644 --- a/desktop/recovered/app-asar-extracted/.vite/build/preload.js +++ b/desktop/recovered/app-asar-extracted/.vite/build/preload.js @@ -1,2 +1,2 @@ -let e=require(`electron`);var t=`codex_desktop:mcp-app-sandbox-host-message`,n=`codex_desktop:show-context-menu`,r=`codex_desktop:show-application-menu`,i=`codex_desktop:get-sentry-init-options`,a=`codex_desktop:get-build-flavor`,o=`codex_desktop:get-uses-owl-app-shell`,s=`codex_desktop:get-system-theme-variant`,c=`codex_desktop:get-fast-mode-rollout-metrics`,l=`codex_desktop:system-theme-variant-updated`,u=`codex_desktop:trigger-sentry-test`,d=`codex_desktop:connect-app-host`;function f(e){return`codex_desktop:worker:${e}:from-view`}function p(e){return`codex_desktop:worker:${e}:for-view`}var m=`electron`,h=`codex_desktop:message-from-view`,g=`codex_desktop:message-for-view`,_=e.ipcRenderer.sendSync(i),v=e.ipcRenderer.sendSync(a),y=e.ipcRenderer.sendSync(o)===!0,b=e.ipcRenderer.sendSync(`codex_desktop:get-shared-object-snapshot`)??{},x=e.ipcRenderer.sendSync(s),S=()=>x,C=new Set;e.ipcRenderer.on(l,(e,t)=>{x=t,C.forEach(e=>{e()})});function w(e,t){if(t===void 0){delete b[e];return}b[e]=t}var T=new Map,E=new Map,D={windowType:m,sendMessageFromView:async t=>{t.type===`shared-object-set`&&w(t.key,t.value);try{await e.ipcRenderer.invoke(h,t)}catch(n){if(String(n?.message??n).includes(`No handler registered`)){setTimeout(()=>{e.ipcRenderer.invoke(h,t).catch(()=>{})},250);return}throw n}},getPathForFile:t=>e.webUtils.getPathForFile(t)||null,sendWorkerMessageFromView:async(t,n)=>{await e.ipcRenderer.invoke(f(t),n)},subscribeToWorkerMessages:(t,n)=>{let r=T.get(t);r||(r=new Set,T.set(t,r));let i=E.get(t);return i||(i=(e,n)=>{let r=T.get(t);r&&r.forEach(e=>{e(n)})},E.set(t,i),e.ipcRenderer.on(p(t),i)),r.add(n),()=>{let r=T.get(t);if(!r||(r.delete(n),r.size>0))return;T.delete(t);let i=E.get(t);i&&e.ipcRenderer.removeListener(p(t),i),E.delete(t)}},showContextMenu:async t=>e.ipcRenderer.invoke(n,t),showApplicationMenu:async(t,n,i)=>{await e.ipcRenderer.invoke(r,{menuId:t,x:n,y:i})},getFastModeRolloutMetrics:async t=>e.ipcRenderer.invoke(c,t),getSharedObjectSnapshotValue:e=>b[e],getSystemThemeVariant:S,subscribeToSystemThemeVariant:e=>(C.add(e),()=>{C.delete(e)}),triggerSentryTestError:async()=>{await e.ipcRenderer.invoke(u)},getSentryInitOptions:()=>_,getAppSessionId:()=>_.codexAppSessionId,getBuildFlavor:()=>v,isIntelMacBuild:()=>process.platform===`darwin`&&process.arch===`x64`,usesOwlAppShell:()=>y};e.ipcRenderer.on(g,(e,t)=>{let n=t;n.type===`shared-object-updated`&&w(n.key,n.value),window.dispatchEvent(new MessageEvent(`message`,{data:t}))}),e.ipcRenderer.on(t,(e,t)=>{let n=window.location.origin;n!==`null`&&window.postMessage(t,n,e.ports)}),e.contextBridge.exposeInMainWorld(`codexWindowType`,m),e.contextBridge.exposeInMainWorld(`electronBridge`,D),typeof window<`u`&&window.addEventListener(`message`,t=>{if(t.source!==window||t.data?.type!==`connect-app-host`)return;let{port:n}=t.data;e.ipcRenderer.postMessage(d,void 0,[n])}); +let e=require(`electron`);var t=`codex_desktop:mcp-app-sandbox-host-message`,n=`codex_desktop:show-context-menu`,r=`codex_desktop:show-application-menu`,i=`codex_desktop:get-sentry-init-options`,a=`codex_desktop:get-build-flavor`,o=`codex_desktop:get-uses-owl-app-shell`,s=`codex_desktop:get-system-theme-variant`,c=`codex_desktop:get-fast-mode-rollout-metrics`,l=`codex_desktop:system-theme-variant-updated`,u=`codex_desktop:trigger-sentry-test`,d=`codex_desktop:connect-app-host`;function f(e){return`codex_desktop:worker:${e}:from-view`}function p(e){return`codex_desktop:worker:${e}:for-view`}var m=`electron`,h=`codex_desktop:message-from-view`,g=`codex_desktop:message-for-view`,_=e.ipcRenderer.sendSync(i),v=e.ipcRenderer.sendSync(a),y=e.ipcRenderer.sendSync(o)===!0,b=e.ipcRenderer.sendSync(`codex_desktop:get-shared-object-snapshot`)??{},x=e.ipcRenderer.sendSync(s),S=()=>x,C=new Set;e.ipcRenderer.on(l,(e,t)=>{x=t,C.forEach(e=>{e()})});function w(e,t){if(t===void 0){delete b[e];return}b[e]=t}var T=new Map,E=new Map,D={windowType:m,sendMessageFromView:async t=>{t.type===`shared-object-set`&&w(t.key,t.value);try{await e.ipcRenderer.invoke(h,t)}catch(n){if(String(n?.message??n).includes(`No handler registered`)){setTimeout(()=>{e.ipcRenderer.invoke(h,t).catch(()=>{})},250);return}throw n}},getPathForFile:t=>e.webUtils.getPathForFile(t)||null,sendWorkerMessageFromView:async(t,n)=>{await e.ipcRenderer.invoke(f(t),n)},subscribeToWorkerMessages:(t,n)=>{let r=T.get(t);r||(r=new Set,T.set(t,r));let i=E.get(t);return i||(i=(e,n)=>{let r=T.get(t);r&&r.forEach(e=>{e(n)})},E.set(t,i),e.ipcRenderer.on(p(t),i)),r.add(n),()=>{let r=T.get(t);if(!r||(r.delete(n),r.size>0))return;T.delete(t);let i=E.get(t);i&&e.ipcRenderer.removeListener(p(t),i),E.delete(t)}},showContextMenu:async t=>e.ipcRenderer.invoke(n,t),showApplicationMenu:async(t,n,i)=>{await e.ipcRenderer.invoke(r,{menuId:t,x:n,y:i})},controlWindow:async t=>{await e.ipcRenderer.invoke(`codex_desktop:control-window`,{action:t})},getApplicationMenuItems:async t=>await e.ipcRenderer.invoke(`codex_desktop:get-application-menu-items`,{menuId:t}),clickApplicationMenuItem:async(t,n)=>{await e.ipcRenderer.invoke(`codex_desktop:click-application-menu-item`,{menuId:t,path:n})},getFastModeRolloutMetrics:async t=>e.ipcRenderer.invoke(c,t),getSharedObjectSnapshotValue:e=>b[e],getSystemThemeVariant:S,subscribeToSystemThemeVariant:e=>(C.add(e),()=>{C.delete(e)}),triggerSentryTestError:async()=>{await e.ipcRenderer.invoke(u)},getSentryInitOptions:()=>_,getAppSessionId:()=>_.codexAppSessionId,getBuildFlavor:()=>v,isIntelMacBuild:()=>process.platform===`darwin`&&process.arch===`x64`,usesOwlAppShell:()=>y};e.ipcRenderer.on(g,(e,t)=>{let n=t;n.type===`shared-object-updated`&&w(n.key,n.value),window.dispatchEvent(new MessageEvent(`message`,{data:t}))}),e.ipcRenderer.on(t,(e,t)=>{let n=window.location.origin;n!==`null`&&window.postMessage(t,n,e.ports)}),e.contextBridge.exposeInMainWorld(`codexWindowType`,m),e.contextBridge.exposeInMainWorld(`electronBridge`,D),typeof window<`u`&&window.addEventListener(`message`,t=>{if(t.source!==window||t.data?.type!==`connect-app-host`)return;let{port:n}=t.data;e.ipcRenderer.postMessage(d,void 0,[n])}); //# sourceMappingURL=preload.js.map \ No newline at end of file diff --git a/desktop/recovered/app-asar-extracted/webview/assets/app-shell-D7yvB1FT.js b/desktop/recovered/app-asar-extracted/webview/assets/app-shell-D7yvB1FT.js index 24902b05..ba671c71 100644 --- a/desktop/recovered/app-asar-extracted/webview/assets/app-shell-D7yvB1FT.js +++ b/desktop/recovered/app-asar-extracted/webview/assets/app-shell-D7yvB1FT.js @@ -1,2 +1,2 @@ -import{s as e}from"./chunk-Bj-mKKzh.js";import{$n as t,Wr as n}from"./src-CYrn1fYL.js";import{k as r,pi as i,vt as a}from"./app-server-manager-signals-BOGyjFm3.js";import{n as o,t as s}from"./jsx-runtime-CiQ1k8xo.js";import{t as c}from"./clsx-BcPLHiun.js";import{a as l,d as u,f as d,i as f,n as p,p as m,s as h,t as g,u as _}from"./core.esm-D4TU2vSa.js";import{F as v,I as y,L as b,P as x,W as S,f as C,h as w,lt as T,p as E}from"./vscode-api-sUstfl-x.js";import{c as D,n as O,o as k,r as A}from"./lib-MoKmYgcO.js";import{l as j,p as M}from"./persisted-signal-Cx1QgqJn.js";import{E as ee}from"./codex-api-DRlZt5zW.js";import{n as N}from"./window-zoom-context-CSPQZGcc.js";import{t as P}from"./tooltip-BhXPONlb.js";import{i as F,t as I}from"./route-scope-BCJTBhwV.js";import{t as L}from"./button-Xd4Hy1MO.js";import{r as R}from"./reduced-motion-preference-BEImGcUg.js";import{t as z}from"./spinner-Dvc_A3Ae.js";import{c as B,i as V,s as H,t as U}from"./proxy-DktXrBt_.js";import{G as W,X as G,Z as K,ft as q,pt as J,rt as Y}from"./single-value-BbzxY9gT.js";import{$ as X,A as te,B as ne,C as re,D as ie,E as ae,F as oe,G as se,H as ce,I as le,J as ue,K as de,L as fe,M as pe,N as me,O as he,P as ge,Q as _e,R as ve,U as ye,V as be,W as xe,X as Se,Y as Ce,Z as we,a as Te,at as Ee,b as De,c as Oe,ct as ke,d as Ae,dt as je,et as Me,f as Ne,ft as Pe,i as Fe,it as Ie,l as Le,lt as Re,m as ze,nt as Be,o as Ve,ot as He,p as Ue,q as We,r as Ge,rt as Ke,s as qe,st as Je,t as Ye,tt as Xe,u as Ze,ut as Qe,x as $e,z as et}from"./app-shell-state-B5MFb4Nm.js";import{t as tt}from"./AnimatePresence-DwAfNqj_.js";import{t as nt}from"./use-platform-BkwBnkgx.js";import{n as rt,s as it,t as at}from"./app-shell-tab-controller-B0DXekEJ.js";import{t as ot}from"./browser-sidebar-manager-CDP80WMh.js";import{i as st,r as ct,t as lt}from"./error-boundary-CSKrv358.js";import{t as ut}from"./download-TILfllSA.js";import{t as dt}from"./with-window-DPMmD2K-.js";import{t as ft}from"./use-register-command-UoA_Jn9F.js";import{r as pt}from"./run-command-BkY8dgoH.js";import{r as mt}from"./modal-controller-state-CEBUx8JQ.js";import{a as ht,d as gt,i as _t,l as vt,n as yt,r as bt,u as xt}from"./dialog-layout-CCvvb1Vc.js";import{t as St}from"./use-stable-callback-B56R_Ee2.js";import{t as Ct}from"./context-menu-DRia187f.js";import{t as wt}from"./loading-page-Cq0CTe5D.js";import{i as Tt,n as Et,r as Dt,t as Ot}from"./sortable.esm-gKrsSmfW.js";import{t as kt}from"./get-resize-observer-entry-size-CH0PchA7.js";import{n as At,r as jt}from"./use-resize-observer-CbHbkQNx.js";import{a as Mt}from"./command-keybindings-D3tvaSVG.js";import{n as Nt,t as Pt}from"./expand-CUW1I4XL.js";import{a as Ft,t as It}from"./keyboard-modifier-state-ZeRcF5hb.js";import{t as Lt}from"./use-merged-ref-6q7NGZyX.js";import{t as Rt}from"./arrow-left-2njf4k3d.js";import{t as zt}from"./use-window-controls-safe-area-X2AodDul.js";import{t as Bt}from"./app-shell-bottom-panel-scroll-sync-DpO90Rtb.js";import{a as Vt,r as Ht,t as Ut}from"./image-preview-shortcuts-CaXpgMPF.js";function Wt(...e){let t=!Array.isArray(e[0]),n=t?0:-1,r=e[0+n],i=e[1+n],a=e[2+n],o=e[3+n],s=Y(i,a,o);return t?s(r):s}var Z=e(o(),1);function Gt(e,t,n){(0,Z.useInsertionEffect)(()=>e.on(t,n),[e,t,n])}function Kt(e){let t=B(()=>K(e)),{isStatic:n}=(0,Z.useContext)(V);if(n){let[,n]=(0,Z.useState)(e);(0,Z.useEffect)(()=>t.on(`change`,n),[])}return t}function qt(e,t){let n=Kt(t()),r=()=>n.set(t());return r(),H(()=>{let t=()=>J.preRender(r,!1,!0),n=e.map(e=>e.on(`change`,t));return()=>{n.forEach(e=>e()),q(r)}}),n}function Jt(e,...t){let n=e.length;function r(){let r=``;for(let i=0;ii(e))}function Zt(e,t){let n=B(()=>[]);return qt(e,()=>{n.length=0;let r=e.length;for(let t=0;t(0,Q.jsx)(`svg`,{width:21,height:21,viewBox:`0 0 21 21`,fill:`none`,xmlns:`http://www.w3.org/2000/svg`,...e,children:(0,Q.jsx)(`path`,{fillRule:`evenodd`,clipRule:`evenodd`,d:`M10.7997 2.48486C15.4019 2.48486 19.1335 6.21565 19.1337 10.8179C19.1337 15.4202 15.4021 19.1519 10.7997 19.1519C6.19746 19.1517 2.46667 15.4201 2.46667 10.8179C2.46685 6.21576 6.19757 2.48504 10.7997 2.48486ZM9.00811 7.5181C8.62612 7.13627 8.00684 7.13624 7.62534 7.5181C7.24363 7.89971 7.24366 8.51913 7.62534 8.90088L9.54183 10.8179L7.62534 12.7343C7.24375 13.116 7.24365 13.7354 7.62534 14.1171C8.00709 14.4989 8.62647 14.4989 9.00811 14.1171L10.9251 12.2007L12.8416 14.1171C13.2234 14.4989 13.8427 14.4989 14.2244 14.1171C14.6062 13.7354 14.6062 13.1161 14.2244 12.7343L12.3079 10.8179L14.2244 8.90088L14.3123 8.79221C14.5632 8.41306 14.5212 7.89785 14.2244 7.60088C13.9275 7.30404 13.4123 7.26211 13.0331 7.51303L12.9244 7.60088L11.0079 9.51736L9.09138 7.60088L9.00811 7.5181Z`,fill:`currentColor`})}),$=T(),$t=`color-mix(in srgb, var(--color-token-foreground) 5%, var(--color-token-main-surface-primary))`,en=`min(32rem, var(--radix-tooltip-content-available-width), calc(100vw - 16px))`;function tn(e){let t=(0,$.c)(79),n,r,i,a,o,s,l,u,d,f,p,m,h,g,_,v,y,b;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4],o=t[5],s=t[6],l=t[7],u=t[8],d=t[9],f=t[10],p=t[11],m=t[12],h=t[13],g=t[14],_=t[15],v=t[16],y=t[17],b=t[18]):({activatorRef:n,tooltip:y,highlightedIcon:i,id:o,icon:a,trailingContent:b,title:v,isDragging:f,isActive:p,isClosable:m,isHighlighted:h,isLabel:g,isPreview:_,onActivate:s,onClose:l,onPointerDown:u,style:d,...r}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a,t[5]=o,t[6]=s,t[7]=l,t[8]=u,t[9]=d,t[10]=f,t[11]=p,t[12]=m,t[13]=h,t[14]=g,t[15]=_,t[16]=v,t[17]=y,t[18]=b);let x=f===void 0?!1:f,S=p===void 0?!1:p,C=m===void 0?!1:m,w=h===void 0?!1:h,T=g===void 0?!1:g,E=_===void 0?!1:_,O=D(),[k,A]=(0,Z.useState)(!1),j=!T,M=w&&i!=null,ee=j&&S,N;t[19]===Symbol.for(`react.memo_cache_sentinel`)?(N=(e,t)=>{A(t.scrollWidth>t.clientWidth)},t[19]=N):N=t[19];let F=At(N),I=E&&`italic`,L;t[20]===I?L=t[21]:(L=c(`block w-full min-w-0 whitespace-nowrap`,I),t[20]=I,t[21]=L);let R;t[22]!==L||t[23]!==F||t[24]!==v?(R=(0,Q.jsx)(`span`,{ref:F,className:L,children:v}),t[22]=L,t[23]=F,t[24]=v,t[25]=R):R=t[25];let z=R,B;t[26]===d?B=t[27]:(B={...d,"--app-shell-tab-background":$t},t[26]=d,t[27]=B);let V=B,H;t[28]===u?H=t[29]:(H=e=>{if(e.button!==0||e.ctrlKey){e.stopPropagation();return}u?.(e)},t[28]=u,t[29]=H);let U=j&&`group-hover/tab:bg-[var(--app-shell-tab-background)]`,W=j&&(S||x)&&`bg-[var(--app-shell-tab-background)]`,G;t[30]!==U||t[31]!==W?(G=c(`pointer-events-none absolute inset-0 z-0 rounded-md`,U,W),t[30]=U,t[31]=W,t[32]=G):G=t[32];let K;t[33]===G?K=t[34]:(K=(0,Q.jsx)(`div`,{className:G}),t[33]=G,t[34]=K);let q=S&&`text-token-text-primary`,J=!S&&`text-token-text-secondary`,Y;t[35]!==q||t[36]!==J?(Y=c(`no-drag relative flex flex-1 items-center gap-2 z-10 text-sm min-w-0 `,q,J),t[35]=q,t[36]=J,t[37]=Y):Y=t[37];let X;t[38]!==C||t[39]!==s||t[40]!==l?(X=e=>{if(C&&e.button===1){e.preventDefault(),e.stopPropagation(),l?.();return}s?.()},t[38]=C,t[39]=s,t[40]=l,t[41]=X):X=t[41];let te;t[42]!==i||t[43]!==a||t[44]!==M?(te=(a!=null||M)&&(0,Q.jsxs)(`span`,{"aria-hidden":`true`,className:`icon-xs relative flex shrink-0 items-center justify-center overflow-visible`,children:[a!=null&&(0,Q.jsx)(`span`,{className:c(`flex size-full items-center justify-center`,M&&`opacity-30`),children:a}),M&&(0,Q.jsx)(`span`,{className:`pointer-events-none absolute inset-0 z-10 flex size-full items-center justify-center`,children:i})]}),t[42]=i,t[43]=a,t[44]=M,t[45]=te):te=t[45];let ne;t[46]!==O||t[47]!==C||t[48]!==l||t[49]!==v?(ne=C&&(0,Q.jsx)(`div`,{role:`button`,"aria-label":O.formatMessage({id:`codex.tabs.closeNamed`,defaultMessage:`Close {title} tab`,description:`Accessible label for closing a named tab`},{title:v}),className:`no-drag absolute inset-y-0 start-0 z-30 hidden shrink-0 cursor-interaction items-center bg-(--app-shell-tab-background) text-token-text-tertiary group-hover/tab:flex after:absolute after:-inset-1 after:content-[''] hover:text-token-text-primary`,onClick:l,onMouseDown:nn,children:(0,Q.jsx)(Qt,{className:`icon-xs`})}),t[46]=O,t[47]=C,t[48]=l,t[49]=v,t[50]=ne):ne=t[50];let re;t[51]!==x||t[52]!==z||t[53]!==y?(re=y?(0,Q.jsx)(P,{tooltipContent:y,disabled:x,delayOpen:!0,side:`bottom`,tooltipMaxWidth:en,children:z}):z,t[51]=x,t[52]=z,t[53]=y,t[54]=re):re=t[54];let ie;t[55]!==ee||t[56]!==S||t[57]!==k||t[58]!==j?(ie=k&&(0,Q.jsx)(`span`,{className:c(`pointer-events-none absolute inset-y-0 end-0 z-20 w-8 bg-linear-to-r from-transparent to-60%`,ee?`to-[var(--app-shell-tab-background)]`:`to-token-main-surface-primary`,j&&!S&&`group-hover/tab:to-[var(--app-shell-tab-background)]`)}),t[55]=ee,t[56]=S,t[57]=k,t[58]=j,t[59]=ie):ie=t[59];let ae;t[60]!==re||t[61]!==ie?(ae=(0,Q.jsxs)(`span`,{className:`relative min-w-0 flex-1 overflow-hidden`,children:[re,ie]}),t[60]=re,t[61]=ie,t[62]=ae):ae=t[62];let oe;t[63]!==S||t[64]!==Y||t[65]!==X||t[66]!==te||t[67]!==ne||t[68]!==ae||t[69]!==b?(oe=(0,Q.jsxs)(`button`,{type:`button`,role:`tab`,"aria-selected":S,className:Y,onMouseDown:X,children:[te,ne,ae,b]}),t[63]=S,t[64]=Y,t[65]=X,t[66]=te,t[67]=ne,t[68]=ae,t[69]=b,t[70]=oe):oe=t[70];let se;return t[71]!==n||t[72]!==r||t[73]!==o||t[74]!==V||t[75]!==H||t[76]!==K||t[77]!==oe?(se=(0,Q.jsxs)(`div`,{ref:n,"data-tab-id":o,className:`group/tab relative flex h-7 max-w-39 shrink-0 items-center overflow-hidden rounded-lg bg-token-main-surface-primary px-2 py-1`,style:V,...r,onPointerDown:H,children:[K,oe]}),t[71]=n,t[72]=r,t[73]=o,t[74]=V,t[75]=H,t[76]=K,t[77]=oe,t[78]=se):se=t[78],se}function nn(e){e.preventDefault(),e.stopPropagation()}function rn(e){let t=(0,$.c)(69),{controller:n,isActive:r,separatorIndex:a,showTrailingSeparator:o,tab:s}=e,l=v(I),{tabId:u,title:d,icon:f,isClosable:p,isLabel:h,contextMenuItems:g,highlightedIcon:_,isHighlighted:y,trailingContent:b,isPreview:x,tooltip:S}=s,C;t[0]!==n||t[1]!==u?(C={controller:n,kind:`app-shell-tab`,tabId:u},t[0]=n,t[1]=u,t[2]=C):C=t[2];let w;t[3]!==h||t[4]!==C||t[5]!==s.dndId?(w={data:C,disabled:h,id:s.dndId,strategy:Dt},t[3]=h,t[4]=C,t[5]=s.dndId,t[6]=w):w=t[6];let{attributes:T,isDragging:E,listeners:D,setActivatorNodeRef:k,setNodeRef:A,transform:j,transition:M}=Tt(w),ee;t[7]!==n||t[8]!==p||t[9]!==l||t[10]!==u?(ee=e=>{if(p){let t=l.get(i),r=l.get(n.tabs$),a=r.findIndex(e=>e.tabId===u),o=r.some(e=>e.tabId!==u&&e.isClosable),s=a!==-1&&r.slice(a+1).some(an);if(e.length>0&&e.push({id:`close-tab-separator`,type:`separator`}),e.push({id:`close-tab`,message:O({id:`codex.tabs.contextMenu.close`,defaultMessage:`Close`,description:`Context menu action for closing a tab`}),onSelect:()=>n.closeTab(l,u)}),!t)return e;e.push({enabled:o,id:`close-other-tabs`,message:O({id:`codex.tabs.contextMenu.closeOtherTabs`,defaultMessage:`Close other tabs`,description:`Context menu action for closing all other tabs besides the current tab`}),onSelect:()=>n.closeOtherTabs(l,u)}),e.push({enabled:s,id:`close-tabs-to-the-right`,message:O({id:`codex.tabs.contextMenu.closeTabsToTheRight`,defaultMessage:`Close tabs to the right`,description:`Context menu action for closing the tabs to the right of the current tab`}),onSelect:()=>n.closeTabsToRight(l,u)})}return e},t[7]=n,t[8]=p,t[9]=l,t[10]=u,t[11]=ee):ee=t[11];let N=ee,P;t[12]!==N||t[13]!==g||t[14]!==l?(P=()=>{let e=typeof g==`function`?g(l):g??[];return Array.isArray(e)?N([...e]):e.then(e=>N([...e]))},t[12]=N,t[13]=g,t[14]=l,t[15]=P):P=t[15];let F=P,L=n.panelId,R=E&&`z-10 cursor-grab opacity-0`,z;t[16]===R?z=t[17]:(z=c(`my-auto flex shrink-0 relative max-w-40 pe-1 items-center contain-content gap-0.5`,R),t[16]=R,t[17]=z);let B;t[18]===j?B=t[19]:(B=m.Translate.toString(j),t[18]=j,t[19]=B);let V;t[20]!==B||t[21]!==M?(V={transform:B,transition:M},t[20]=B,t[21]=M,t[22]=V):V=t[22];let H,W;t[23]!==n||t[24]!==l||t[25]!==u?(H=()=>n.activateTab(l,u),W=()=>n.closeTab(l,u),t[23]=n,t[24]=l,t[25]=u,t[26]=H,t[27]=W):(H=t[26],W=t[27]);let G;t[28]!==n||t[29]!==x||t[30]!==l||t[31]!==u?(G=()=>{x&&n.pinTab(l,u)},t[28]=n,t[29]=x,t[30]=l,t[31]=u,t[32]=G):G=t[32];let K;t[33]!==T||t[34]!==_||t[35]!==f||t[36]!==r||t[37]!==p||t[38]!==E||t[39]!==y||t[40]!==h||t[41]!==x||t[42]!==D||t[43]!==k||t[44]!==H||t[45]!==W||t[46]!==G||t[47]!==u||t[48]!==d||t[49]!==S||t[50]!==b?(K=(0,Q.jsx)(tn,{activatorRef:k,id:u,highlightedIcon:_,icon:f,isActive:r,isClosable:p,isDragging:E,isHighlighted:y,isLabel:h,isPreview:x,onActivate:H,onClose:W,trailingContent:b,title:d,tooltip:S,...D,...T,onDoubleClick:G}),t[33]=T,t[34]=_,t[35]=f,t[36]=r,t[37]=p,t[38]=E,t[39]=y,t[40]=h,t[41]=x,t[42]=D,t[43]=k,t[44]=H,t[45]=W,t[46]=G,t[47]=u,t[48]=d,t[49]=S,t[50]=b,t[51]=K):K=t[51];let q;t[52]!==F||t[53]!==K?(q=(0,Q.jsx)(Ct,{getItems:F,children:K}),t[52]=F,t[53]=K,t[54]=q):q=t[54];let J=o?`opacity-100`:`opacity-0`,Y;t[55]===J?Y=t[56]:(Y=c(`h-3 w-px shrink-0 end-0 absolute bg-token-border transition-opacity duration-200`,J),t[55]=J,t[56]=Y);let X;t[57]!==a||t[58]!==Y||t[59]!==u?(X=(0,Q.jsx)(`div`,{"aria-hidden":!0,"data-app-shell-tab-separator":u,"data-app-shell-tab-separator-index":a,className:Y}),t[57]=a,t[58]=Y,t[59]=u,t[60]=X):X=t[60];let te;return t[61]!==n.panelId||t[62]!==A||t[63]!==q||t[64]!==X||t[65]!==z||t[66]!==V||t[67]!==u?(te=(0,Q.jsxs)(U.div,{"data-app-shell-tab-controller":L,"data-tab-id":u,ref:A,className:z,style:V,children:[q,X]}),t[61]=n.panelId,t[62]=A,t[63]=q,t[64]=X,t[65]=z,t[66]=V,t[67]=u,t[68]=te):te=t[68],te}function an(e){return e.isClosable}var on=(0,Z.createContext)(null);function sn(e,t){let n=e.get(t.sourceController.tabIds$),r=n.indexOf(t.tabId);r===-1||r===t.sourceIndex||e.set(t.sourceController.tabIds$,Et(n,r,t.sourceIndex))}function cn(e,t,n,r){let i=e.get(t.tabIds$),a=i.indexOf(n),o=i.indexOf(r);a===-1||o===-1||a===o||e.set(t.tabIds$,Et(i,a,o))}function ln(e,t,n){return e.previewController===t&&e.overTabId===n?e:{...e,overTabId:n,previewController:t}}function un(e,t,n){if(n==null||n.previewController===n.sourceController)return e;if(t===n.sourceController)return e.filter(e=>e.tabId!==n.draggedTab.tabId);if(t!==n.previewController)return e;let r=n.overTabId==null?-1:e.findIndex(e=>e.tabId===n.overTabId),i=[...e];return i.splice(r===-1?i.length:r,0,n.draggedTab),i}var dn=`data-tab-preview-pin-exempt`;function fn(e){let t=(0,$.c)(20),{afterList:n,afterListSticky:r,beforeList:i,emptyState:a,headerHeight:o,controller:s}=e,c=y(s.tabs$),l=y(s.activeTab$),u=y(s.activeTabReactKey$),d=(0,Z.useContext)(on)?.dragState??null,f;t[0]!==s||t[1]!==d||t[2]!==c?(f=un(c,s,d),t[0]=s,t[1]=d,t[2]=c,t[3]=f):f=t[3];let p=f,m=l?.tabId??null,h;t[4]!==n||t[5]!==r||t[6]!==i||t[7]!==s||t[8]!==o||t[9]!==p||t[10]!==m?(h=(0,Q.jsx)(pn,{height:o,activeTabId:m,after:n,afterSticky:r,before:i,controller:s,tabs:p}),t[4]=n,t[5]=r,t[6]=i,t[7]=s,t[8]=o,t[9]=p,t[10]=m,t[11]=h):h=t[11];let g;t[12]!==l||t[13]!==u||t[14]!==s||t[15]!==a?(g=l==null?(0,Q.jsx)(`div`,{className:`relative min-h-0 flex-1`,children:a}):(0,Q.jsx)(vn,{controller:s,tab:l},u),t[12]=l,t[13]=u,t[14]=s,t[15]=a,t[16]=g):g=t[16];let _;return t[17]!==h||t[18]!==g?(_=(0,Q.jsxs)(`div`,{className:`isolate flex h-full min-h-0 flex-col bg-token-main-surface-primary [contain:layout_paint]`,children:[h,g]}),t[17]=h,t[18]=g,t[19]=_):_=t[19],_}function pn(e){let t=(0,$.c)(94),{activeTabId:n,after:r,afterSticky:i,before:a,controller:o,height:s,tabs:l}=e,[u,d]=(0,Z.useState)(!1),[f,p]=(0,Z.useState)(!1),[m,h]=jt(),[g,v]=(0,Z.useState)(null),y=`app-shell-tab-strip:${o.panelId}`,b;t[0]===o?b=t[1]:(b={controller:o,kind:`app-shell-tab-strip`},t[0]=o,t[1]=b);let x;t[2]!==y||t[3]!==b?(x={id:y,data:b},t[2]=y,t[3]=b,t[4]=x):x=t[4];let{setNodeRef:S}=_(x),C=(0,Z.useContext)(on)?.dragState??null,w,T,E,D,O,k,A,j,M,ee,N,P,F,I,L,R,z;if(t[5]!==n||t[6]!==h||t[7]!==a||t[8]!==o||t[9]!==C||t[10]!==s||t[11]!==u||t[12]!==g||t[13]!==S||t[14]!==l){let e=l.map(hn),r;t[32]===l?r=t[33]:(r=l.map(mn),t[32]=l,t[33]=r);let i=r;T=h==null||h===0?`0px`:`0px -${h}px 0px 0px`,E=C!=null;let f=n==null?-1:e.indexOf(n),p=s===`toolbar`&&`h-toolbar`,m=s===`pane`&&`h-toolbar-pane`;t[34]!==p||t[35]!==m?(ee=c(p,m,`isolate flex min-w-0 shrink-0 select-none items-center bg-token-main-surface-primary px-2 [contain:layout_paint]`),t[34]=p,t[35]=m,t[36]=ee):ee=t[36],t[37]===a?N=t[38]:(N=a!=null&&(0,Q.jsx)(`div`,{className:`my-auto flex shrink-0 items-center`,role:`presentation`,children:a}),t[37]=a,t[38]=N),t[39]===S?D=t[40]:(D=e=>{v(e),S(e)},t[39]=S,t[40]=D),O=o.panelId,k=`hide-scrollbar relative isolate flex h-full min-w-0 flex-1 scroll-px-1 items-center overflow-x-auto overflow-y-hidden [contain:layout_paint]`;let _=`${h??0}px`;t[41]===_?A=t[42]:(A={scrollPaddingInlineEnd:_},t[41]=_,t[42]=A);let y=u?`opacity-0`:`opacity-100`,b;t[43]===y?b=t[44]:(b=c(`sticky start-0 z-10 h-full w-0 after:absolute transition-opacity after:pointer-events-none duration-100 after:start-0 after:top-0 after:bottom-0 after:w-10 after:bg-linear-to-l after:from-transparent after:to-token-main-surface-primary after:content-['']`,y),t[43]=y,t[44]=b),t[45]===b?j=t[46]:(j=(0,Q.jsx)(`div`,{"aria-hidden":!0,className:b}),t[45]=b,t[46]=j),t[47]===g?M=t[48]:(M=(0,Q.jsx)(gn,{onVisibleChange:d,root:g}),t[47]=g,t[48]=M),w=Ot,R=i,z=Dt,P=`tablist`;let x=E?`z-20`:`z-0`;t[49]===x?F=t[50]:(F=c(`relative flex`,x),t[49]=x,t[50]=F),t[51]===Symbol.for(`react.memo_cache_sentinel`)?(I={gap:3},t[51]=I):I=t[51],L=l.map(t=>{let r=n===t.tabId,i=e.indexOf(t.tabId);return(0,Q.jsx)(rn,{controller:o,isActive:r,separatorIndex:i,showTrailingSeparator:i{n(e)},t[0]=n,t[1]=a);let o=St(a),s;t[2]!==o||t[3]!==r||t[4]!==i?(s=e=>{if(!e)return;let t=new IntersectionObserver(e=>{for(let t of e)o(t.isIntersecting)},{root:r,rootMargin:i});return t.observe(e),()=>{t.disconnect()}},t[2]=o,t[3]=r,t[4]=i,t[5]=s):s=t[5];let c;return t[6]!==i||t[7]!==s?(c=(0,Q.jsx)(`span`,{"aria-hidden":!0,ref:s},i),t[6]=i,t[7]=s,t[8]=c):c=t[8],c}function _n(e,t){return t!==-1&&(e===t||e===t-1)}var vn=(0,Z.memo)(function(e){let t=(0,$.c)(22),{controller:n,tab:r}=e,i=v(I),a;t[0]!==n||t[1]!==i||t[2]!==r.isPreview||t[3]!==r.tabId?(a=e=>{bn(e.nativeEvent)||r.isPreview&&n.pinTab(i,r.tabId)},t[0]=n,t[1]=i,t[2]=r.isPreview,t[3]=r.tabId,t[4]=a):a=t[4];let o=a,s=r.title,c=n.panelId,l=r.tabId,u=r.tabId,d;if(t[5]!==n||t[6]!==i||t[7]!==r){let e;t[9]!==n||t[10]!==i||t[11]!==r.tabId?(e=()=>{n.closeTab(i,r.tabId)},t[9]=n,t[10]=i,t[11]=r.tabId,t[12]=e):e=t[12],d=r.renderPanel(e),t[5]=n,t[6]=i,t[7]=r,t[8]=d}else d=t[8];let f;t[13]!==d||t[14]!==r.tabId?(f=(0,Q.jsx)(lt,{name:`AppShellTabPanel`,resetKey:u,fallback:xn,children:d}),t[13]=d,t[14]=r.tabId,t[15]=f):f=t[15];let p;return t[16]!==n.panelId||t[17]!==o||t[18]!==f||t[19]!==r.tabId||t[20]!==r.title?(p=(0,Q.jsx)(`div`,{role:`tabpanel`,"aria-label":s,"data-app-shell-tab-panel-controller":c,"data-tab-id":l,tabIndex:-1,onKeyDownCapture:o,onPointerDownCapture:o,className:`relative min-h-0 flex-1 outline-none`,children:f}),t[16]=n.panelId,t[17]=o,t[18]=f,t[19]=r.tabId,t[20]=r.title,t[21]=p):p=t[21],p});function yn(e){let t=(0,$.c)(4),{onRetry:n}=e,r;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,Q.jsx)(`div`,{className:`font-medium text-token-text-primary`,children:(0,Q.jsx)(k,{id:`appShell.tabPanelRenderError.title`,defaultMessage:`Tab content couldn't render`,description:`Error message shown when an app shell tab panel fails to render`})}),t[0]=r):r=t[0];let i;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,Q.jsx)(k,{id:`appShell.tabPanelRenderError.retry`,defaultMessage:`Try again`,description:`Button label to retry rendering an app shell tab panel`}),t[1]=i):i=t[1];let a;return t[2]===n?a=t[3]:(a=(0,Q.jsxs)(`div`,{className:`flex h-full min-h-0 flex-col items-center justify-center gap-3 p-4 text-center text-sm text-token-text-secondary`,children:[r,(0,Q.jsx)(L,{color:`secondary`,size:`default`,onClick:n,children:i})]}),t[2]=n,t[3]=a),a}function bn(e){return e.composedPath().some(e=>e instanceof Element&&e.hasAttribute(dn))}function xn(e){return(0,Q.jsx)(yn,{onRetry:()=>{e.resetError()}})}function Sn(){let e=(0,$.c)(4),t=y(ge),n=y(oe),r=y(le),i;return e[0]!==t||e[1]!==n||e[2]!==r?(i=(0,Q.jsx)(fn,{headerHeight:`pane`,afterList:t,afterListSticky:n,emptyState:r,controller:at}),e[0]=t,e[1]=n,e[2]=r,e[3]=i):i=e[3],i}function Cn(){let e=(0,$.c)(17),t=v(I),n=D(),r=y(xe),i=x(Mt,`toggleMaximizeSidePanel`),a;e[0]!==n||e[1]!==r?(a=r?n.formatMessage({id:`codex.rightPanel.restoreWidth`,defaultMessage:`Restore panel width`,description:`Accessible label for restoring the right panel from full width`}):n.formatMessage({id:`codex.rightPanel.expandFullWidth`,defaultMessage:`Expand panel`,description:`Accessible label for expanding the right panel to full width`}),e[0]=n,e[1]=r,e[2]=a):a=e[2];let o=a,s;e[3]!==r||e[4]!==t?(s=()=>{t.set(xe,!r)},e[3]=r,e[4]=t,e[5]=s):s=e[5],ft(`toggleMaximizeSidePanel`,s);let c=r?`secondary`:`ghost`,l;e[6]===r?l=e[7]:(l=r?(0,Q.jsx)(Nt,{className:`icon-xs`}):(0,Q.jsx)(Pt,{className:`icon-xs`}),e[6]=r,e[7]=l);let u;e[8]!==r||e[9]!==o||e[10]!==c||e[11]!==l?(u=(0,Q.jsx)(L,{"aria-label":o,"aria-pressed":r,color:c,size:`toolbar`,uniform:!0,onClick:wn,children:l}),e[8]=r,e[9]=o,e[10]=c,e[11]=l,e[12]=u):u=e[12];let d;return e[13]!==o||e[14]!==i||e[15]!==u?(d=(0,Q.jsx)(P,{tooltipContent:o,shortcut:i,delayOpen:!0,children:u}),e[13]=o,e[14]=i,e[15]=u,e[16]=d):d=e[16],d}function wn(){return pt(`toggleMaximizeSidePanel`,`side_panel_full_width_button`)}function Tn(){let e=y(ue),t=y(Ce),n=y(Se),r=y(we),i=y(xe),a=y(Ze),{headerLeftWidth:o,headerRightWidth:s}=Je(),c=Jt`max(0px, calc(${s}px)`;return(0,Q.jsx)(fn,{headerHeight:`toolbar`,beforeList:(0,Q.jsxs)(Q.Fragment,{children:[i&&!a&&(0,Q.jsx)(U.div,{"aria-hidden":!0,className:`pointer-events-none h-full shrink-0`,style:{width:o}}),n]}),afterListSticky:t,emptyState:r,afterList:(0,Q.jsxs)(Q.Fragment,{children:[e,(0,Q.jsx)(Cn,{}),(0,Q.jsx)(U.div,{"aria-hidden":!0,"data-testid":`right-panel-tab-bar-header-spacer`,className:`pointer-events-none flex h-full shrink-0 items-center`,style:{width:c}})]}),controller:rt})}function En(e){let t=(0,$.c)(4),{keyboardEventTarget:n}=e,r=v(w),i,a;return t[0]!==n||t[1]!==r?(i=()=>{let e=n??(typeof window>`u`?null:window);if(e==null)return;let t=e=>{Ft(r,e)},i=()=>{It(r)};return e.addEventListener(`keydown`,t,!0),e.addEventListener(`keyup`,t,!0),e.addEventListener(`blur`,i),()=>{e.removeEventListener(`keydown`,t,!0),e.removeEventListener(`keyup`,t,!0),e.removeEventListener(`blur`,i),It(r)}},a=[n,r],t[0]=n,t[1]=r,t[2]=i,t[3]=a):(i=t[2],a=t[3]),(0,Z.useEffect)(i,a),null}var Dn=S(w,!1),On=S(w,null),kn=S(w,null),An=S(w,null);function jn(e){let t=(0,$.c)(21),{onClose:n}=e,r;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,Q.jsx)(k,{id:`appHeader.installUpdate.confirmTitle`,defaultMessage:`Update Codex now?`,description:`Title for the confirmation dialog shown before installing an app update while a local session is active`}),t[0]=r):r=t[0];let i=r,a;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,Q.jsx)(k,{id:`appHeader.installUpdate.confirmSubtitle`,defaultMessage:`Codex will quit to install the update, which will interrupt active local sessions on this machine`,description:`Subtitle for the confirmation dialog shown before installing an app update while a local session is active`}),t[1]=a):a=t[1];let o=a,s;t[2]===n?s=t[3]:(s=e=>{e||n()},t[2]=n,t[3]=s);let c;t[4]===n?c=t[5]:(c=e=>{e.preventDefault(),n(),C.dispatchMessage(`install-app-update`,{})},t[4]=n,t[5]=c);let l,u;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,Q.jsx)(gt,{className:`sr-only`,children:i}),u=(0,Q.jsx)(xt,{className:`sr-only`,children:o}),t[6]=l,t[7]=u):(l=t[6],u=t[7]);let d;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,Q.jsx)(ht,{children:(0,Q.jsx)(_t,{title:i,subtitle:o})}),t[8]=d):d=t[8];let f;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(f=(0,Q.jsx)(k,{id:`appHeader.installUpdate.confirmCancel`,defaultMessage:`Cancel`,description:`Cancel button for the update confirmation dialog`}),t[9]=f):f=t[9];let p;t[10]===n?p=t[11]:(p=(0,Q.jsx)(L,{color:`secondary`,onClick:n,children:f}),t[10]=n,t[11]=p);let m;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(m=(0,Q.jsx)(L,{type:`submit`,children:(0,Q.jsx)(k,{id:`appHeader.installUpdate.confirmInstall`,defaultMessage:`Update`,description:`Confirm button for the update confirmation dialog`})}),t[12]=m):m=t[12];let h;t[13]===p?h=t[14]:(h=(0,Q.jsx)(ht,{children:(0,Q.jsxs)(bt,{children:[p,m]})}),t[13]=p,t[14]=h);let g;t[15]!==h||t[16]!==c?(g=(0,Q.jsxs)(yt,{as:`form`,onSubmit:c,children:[l,u,d,h]}),t[15]=h,t[16]=c,t[17]=g):g=t[17];let _;return t[18]!==g||t[19]!==s?(_=(0,Q.jsx)(vt,{open:!0,onOpenChange:s,showDialogClose:!1,size:`compact`,children:g}),t[18]=g,t[19]=s,t[20]=_):_=t[20],_}function Mn(e,t){return e===`windows`&&t}function Nn(){let e=(0,$.c)(4),t=v(w),{platform:n}=nt(),i=y(r),a;return e[0]!==i||e[1]!==n||e[2]!==t?(a=()=>{if(Mn(n,i)){mt(t,jn);return}C.dispatchMessage(`install-app-update`,{})},e[0]=i,e[1]=n,e[2]=t,e[3]=a):a=e[3],St(a)}function Pn(e){let t=(0,$.c)(26),n;t[0]===e?n=t[1]:(n=e===void 0?{}:e,t[0]=e,t[1]=n);let{appUpdateLifecycleState:r}=n,i=D(),a=y(ct),o=Nn(),s=y(On),c=r??a;if(!st(c))return null;let l=c!==`ready`,u;t[2]===s?u=t[3]:(u=s==null?null:Math.min(100,Math.max(0,Math.round(s))),t[2]=s,t[3]=u);let d=u,f;bb0:switch(c){case`ready`:{let e;t[4]===i?e=t[5]:(e=i.formatMessage({id:`appHeader.installUpdate`,defaultMessage:`Update`,description:`Button label in the desktop app header that installs a downloaded app update`}),t[4]=i,t[5]=e),f=e;break bb0}case`installing`:{let e;t[6]===i?e=t[7]:(e=i.formatMessage({id:`appHeader.installingUpdate`,defaultMessage:`Installing`,description:`Button label in the desktop app header while an app update is installing`}),t[6]=i,t[7]=e),f=e;break bb0}case`downloading`:{let e;t[8]!==d||t[9]!==i?(e=d==null?i.formatMessage({id:`appHeader.downloadingUpdate`,defaultMessage:`Downloading`,description:`Button label in the desktop app header while an app update is downloading`}):i.formatMessage({id:`appHeader.downloadingUpdatePercent`,defaultMessage:`Downloading {downloadProgressPercent}%`,description:`Button label in the desktop app header while an app update is downloading with progress`},{downloadProgressPercent:d}),t[8]=d,t[9]=i,t[10]=e):e=t[10],f=e}}let p;t[11]!==f||t[12]!==c||t[13]!==d||t[14]!==i?(p=c===`downloading`&&d!=null?i.formatNumber(d/100,{style:`percent`}):f,t[11]=f,t[12]=c,t[13]=d,t[14]=i,t[15]=p):p=t[15];let m=p,h;t[16]===l?h=t[17]:(h=l?(0,Q.jsx)(z,{className:`ease-basic absolute left-1/2 h-3 w-3 shrink-0 -translate-x-1/2 transition-opacity duration-relaxed [will-change:opacity] motion-reduce:transition-none @[180px]:opacity-0`}):(0,Q.jsx)(ut,{className:`ease-basic absolute left-1/2 h-3 w-3 shrink-0 -translate-x-1/2 transition-opacity duration-relaxed [will-change:opacity] motion-reduce:transition-none @[180px]:opacity-0`}),t[16]=l,t[17]=h);let g;t[18]===m?g=t[19]:(g=(0,Q.jsx)(`span`,{className:`ease-basic min-w-0 truncate tabular-nums opacity-0 transition-opacity duration-relaxed [will-change:opacity] motion-reduce:transition-none @[180px]:opacity-100`,children:m}),t[18]=m,t[19]=g);let _;return t[20]!==f||t[21]!==o||t[22]!==l||t[23]!==h||t[24]!==g?(_=(0,Q.jsxs)(`button`,{"aria-label":f,className:`no-drag ease-basic relative flex h-5 max-w-5 min-w-5 shrink-0 cursor-interaction items-center justify-center overflow-hidden rounded-full bg-token-charts-blue px-2.5 text-xs leading-none font-semibold text-white shadow-sm transition-[max-width,background-color] duration-relaxed [will-change:max-width] contain-layout contain-paint contain-style hover:bg-token-charts-blue/90 active:bg-token-charts-blue/80 motion-reduce:transition-none @[180px]:max-w-36 @[180px]:min-w-10`,disabled:l,onClick:o,title:f,children:[h,g]}),t[20]=f,t[21]=o,t[22]=l,t[23]=h,t[24]=g,t[25]=_):_=t[25],_}var Fn={x:null,y:null,hasKnownVelocity:!1,updatedAt:null,velocityX:0,velocityY:0,speed:0};function In(e,t,n,r){if(e.x==null||e.y==null||e.updatedAt==null)return{x:t,y:n,hasKnownVelocity:!1,updatedAt:r,velocityX:0,velocityY:0,speed:0};let i=(r-e.updatedAt)/1e3;if(i<=0)return{x:t,y:n,hasKnownVelocity:!1,updatedAt:r,velocityX:0,velocityY:0,speed:0};let a=(t-e.x)/i,o=(n-e.y)/i;return{x:t,y:n,hasKnownVelocity:!0,updatedAt:r,velocityX:a,velocityY:o,speed:Math.hypot(a,o)}}var Ln=S(w,Fn),Rn=S(w,{width:window.innerWidth,height:window.innerHeight}),zn={px$:b(w,({get:e})=>e(Ln).x),py$:b(w,({get:e})=>e(Ln).y),hasKnownVelocity$:b(w,({get:e})=>e(Ln).hasKnownVelocity),vx$:b(w,({get:e})=>e(Ln).velocityX),vy$:b(w,({get:e})=>e(Ln).velocityY),speed$:b(w,({get:e})=>e(Ln).speed),bottomInset$:b(w,({get:e})=>{let{height:t}=e(Rn),n=e(Ln).y;return n==null?null:t-n}),rightInset$:b(w,({get:e})=>{let{width:t}=e(Rn),n=e(Ln).x;return n==null?null:t-n})};function Bn(e){let t=(0,$.c)(45),{disabled:n,edge:r,defaultSize:i,getCurrentSize:a,onResizeEnd:o,onResizingChange:s,setSize:c}=e,l=n===void 0?!1:n,u=r===void 0?`right`:r,d=N(),[f,p]=(0,Z.useState)(!1),m=(0,Z.useRef)(null),h=u===`left`||u===`right`,g;t[0]===s?g=t[1]:(g=()=>{m.current=null,p(!1),s?.(!1)},t[0]=s,t[1]=g);let _=(0,Z.useEffectEvent)(g),v;t[2]!==l||t[3]!==_?(v=()=>{!l||m.current==null||_()},t[2]=l,t[3]=_,t[4]=v):v=t[4];let y=(0,Z.useEffectEvent)(v),b;t[5]===d?b=t[6]:(b=e=>({x:e.clientX/d,y:e.clientY/d}),t[5]=d,t[6]=b);let x=b,S;t[7]===h?S=t[8]:(S=e=>h?e.x:e.y,t[7]=h,t[8]=S);let C=S,w;t[9]!==l||t[10]!==u||t[11]!==h||t[12]!==f||t[13]!==o||t[14]!==c||t[15]!==_||t[16]!==y||t[17]!==d?(w=()=>{if(!f||l)return;let e=e=>({x:e.clientX/d,y:e.clientY/d}),t=t=>{t.preventDefault();let n=m.current;if(n==null)return;let r=e(t);(h?r.x:r.y)!==n.startPosition&&(n.didMove=!0),c(Vn(u,r,n))},n=t=>{t.preventDefault();let n=m.current;if(n?.didMove===!0){let r=Vn(u,e(t),n);c(r),o?.(r)}_()};return window.addEventListener(`pointermove`,t),window.addEventListener(`pointerup`,n),window.addEventListener(`pointercancel`,n),()=>{window.removeEventListener(`pointermove`,t),window.removeEventListener(`pointerup`,n),window.removeEventListener(`pointercancel`,n),y()}},t[9]=l,t[10]=u,t[11]=h,t[12]=f,t[13]=o,t[14]=c,t[15]=_,t[16]=y,t[17]=d,t[18]=w):w=t[18];let T;t[19]!==l||t[20]!==u||t[21]!==h||t[22]!==f||t[23]!==o||t[24]!==c||t[25]!==d?(T=[l,u,h,f,o,c,d],t[19]=l,t[20]=u,t[21]=h,t[22]=f,t[23]=o,t[24]=c,t[25]=d,t[26]=T):T=t[26],(0,Z.useEffect)(w,T);let E;t[27]!==l||t[28]!==a||t[29]!==C||t[30]!==x||t[31]!==s?(E=e=>{l||e.button===0&&(e.preventDefault(),e.currentTarget.setPointerCapture?.(e.pointerId),m.current={didMove:!1,startPosition:C(x(e)),startSize:a()},p(!0),s?.(!0))},t[27]=l,t[28]=a,t[29]=C,t[30]=x,t[31]=s,t[32]=E):E=t[32];let D=E,O;t[33]!==i||t[34]!==l||t[35]!==o||t[36]!==s||t[37]!==c?(O=e=>{l||e.detail===2&&(e.preventDefault(),m.current=null,p(!1),s?.(!1),c(i),o?.(i))},t[33]=i,t[34]=l,t[35]=o,t[36]=s,t[37]=c,t[38]=O):O=t[38];let k=O,A;return t[39]!==l||t[40]!==u||t[41]!==k||t[42]!==D||t[43]!==f?(A=(0,Q.jsx)(Hn,{disabled:l,edge:u,isResizing:f,onClick:k,onPointerDown:D}),t[39]=l,t[40]=u,t[41]=k,t[42]=D,t[43]=f,t[44]=A):A=t[44],A}function Vn(e,t,n){let r=(e===`left`||e===`right`?t.x:t.y)-n.startPosition;switch(e){case`bottom`:case`right`:return n.startSize+r;case`left`:case`top`:return n.startSize-r}}function Hn(e){let t=(0,$.c)(20),{disabled:n,edge:r,isResizing:i,onClick:a,onPointerDown:o}=e,s=n||void 0,l=r===`left`||r===`right`?`vertical`:`horizontal`,u=n&&`pointer-events-none`,d=r===`left`?`z-40`:`z-20`,f=r===`right`&&`-top-toolbar right-0 bottom-0 w-4 translate-x-2`,p=r===`left`&&`top-0 bottom-0 left-0 w-4 -translate-x-2`,m=r===`top`&&`top-0 right-0 left-0 h-4 -translate-y-2`,h=r===`bottom`&&`right-0 bottom-0 left-0 h-4 translate-y-2`,g=!n&&(r===`left`||r===`right`?`cursor-col-resize active:cursor-col-resize`:`cursor-row-resize active:cursor-row-resize`),_;t[0]!==u||t[1]!==d||t[2]!==f||t[3]!==p||t[4]!==m||t[5]!==h||t[6]!==g?(_=c(`group absolute flex touch-none select-none`,u,d,f,p,m,h,g),t[0]=u,t[1]=d,t[2]=f,t[3]=p,t[4]=m,t[5]=h,t[6]=g,t[7]=_):_=t[7];let v=r===`left`||r===`right`?`h-full w-px bg-gradient-to-b from-transparent via-token-foreground/25 to-transparent`:`h-px w-full bg-gradient-to-r from-transparent via-token-foreground/25 to-transparent`,y=i?`opacity-100`:`group-hover:opacity-100 group-active:opacity-100`,b;t[8]!==v||t[9]!==y?(b=c(`sidebar-resize-handle-line pointer-events-none m-auto opacity-0`,v,y),t[8]=v,t[9]=y,t[10]=b):b=t[10];let x;t[11]===b?x=t[12]:(x=(0,Q.jsx)(`div`,{className:b}),t[11]=b,t[12]=x);let S;return t[13]!==a||t[14]!==o||t[15]!==s||t[16]!==_||t[17]!==x||t[18]!==l?(S=(0,Q.jsx)(`div`,{role:`separator`,"aria-disabled":s,"aria-orientation":l,className:_,onClick:a,onPointerDown:o,children:x}),t[13]=a,t[14]=o,t[15]=s,t[16]=_,t[17]=x,t[18]=l,t[19]=S):S=t[19],S}var Un=e=>(0,Q.jsx)(`svg`,{width:20,height:20,viewBox:`0 0 20 20`,fill:`none`,xmlns:`http://www.w3.org/2000/svg`,...e,children:(0,Q.jsx)(`path`,{d:`M16.835 8.66301C16.835 7.71885 16.8347 7.05065 16.792 6.52824C16.7605 6.14232 16.7073 5.86904 16.6299 5.65227L16.5439 5.45207C16.32 5.01264 15.9796 4.64498 15.5615 4.3886L15.3779 4.28606C15.1308 4.16013 14.8165 4.08006 14.3018 4.03801C13.7794 3.99533 13.1112 3.99504 12.167 3.99504H7.83301C6.88885 3.99504 6.22065 3.99533 5.69824 4.03801C5.31232 4.06954 5.03904 4.12266 4.82227 4.20012L4.62207 4.28606C4.18264 4.50996 3.81498 4.85035 3.55859 5.26848L3.45605 5.45207C3.33013 5.69922 3.25006 6.01354 3.20801 6.52824C3.16533 7.05065 3.16504 7.71885 3.16504 8.66301V11.3271C3.16504 12.2712 3.16533 12.9394 3.20801 13.4618C3.25006 13.9766 3.33013 14.2909 3.45605 14.538L3.55859 14.7216C3.81498 15.1397 4.18266 15.4801 4.62207 15.704L4.82227 15.79C5.03904 15.8674 5.31234 15.9205 5.69824 15.9521C6.22065 15.9947 6.88885 15.995 7.83301 15.995H12.167C13.1112 15.995 13.7794 15.9947 14.3018 15.9521C14.8164 15.91 15.1308 15.8299 15.3779 15.704L15.5615 15.6015C15.9797 15.3451 16.32 14.9774 16.5439 14.538L16.6299 14.3378C16.7074 14.121 16.7605 13.8478 16.792 13.4618C16.8347 12.9394 16.835 12.2712 16.835 11.3271V8.66301ZM5.00195 13.3329V6.66692C5.00195 6.29965 5.29972 6.00188 5.66699 6.00188C6.03412 6.00204 6.33203 6.29975 6.33203 6.66692V13.3329C6.33203 13.7001 6.03412 13.9978 5.66699 13.998C5.29972 13.998 5.00195 13.7002 5.00195 13.3329ZM18.165 11.3271C18.165 12.2493 18.1653 12.9811 18.1172 13.5702C18.0745 14.0924 17.9916 14.5472 17.8125 14.9648L17.7295 15.1415C17.394 15.8 16.8834 16.3511 16.2568 16.7353L15.9814 16.8896C15.5157 17.1268 15.0069 17.2285 14.4102 17.2773C13.821 17.3254 13.0893 17.3251 12.167 17.3251H7.83301C6.91071 17.3251 6.17898 17.3254 5.58984 17.2773C5.06757 17.2346 4.61294 17.1508 4.19531 16.9716L4.01855 16.8896C3.36014 16.5541 2.80898 16.0434 2.4248 15.4169L2.27051 15.1415C2.03328 14.6758 1.93158 14.167 1.88281 13.5702C1.83468 12.9811 1.83496 12.2493 1.83496 11.3271V8.66301C1.83496 7.74072 1.83468 7.00898 1.88281 6.41985C1.93157 5.82309 2.03329 5.31432 2.27051 4.84856L2.4248 4.57317C2.80898 3.94666 3.36012 3.436 4.01855 3.10051L4.19531 3.0175C4.61285 2.83843 5.06771 2.75548 5.58984 2.71281C6.17898 2.66468 6.91071 2.66496 7.83301 2.66496H12.167C13.0893 2.66496 13.821 2.66468 14.4102 2.71281C15.0069 2.76157 15.5157 2.86329 15.9814 3.10051L16.2568 3.25481C16.8833 3.63898 17.394 4.19012 17.7295 4.84856L17.8125 5.02531C17.9916 5.44285 18.0745 5.89771 18.1172 6.41985C18.1653 7.00898 18.165 7.74072 18.165 8.66301V11.3271Z`,fill:`currentColor`})}),Wn=e=>(0,Q.jsx)(`svg`,{width:20,height:20,viewBox:`0 0 20 20`,fill:`none`,xmlns:`http://www.w3.org/2000/svg`,...e,children:(0,Q.jsx)(`path`,{d:`M6.83496 3.99992C6.38353 4.00411 6.01421 4.0122 5.69824 4.03801C5.31232 4.06954 5.03904 4.12266 4.82227 4.20012L4.62207 4.28606C4.18264 4.50996 3.81498 4.85035 3.55859 5.26848L3.45605 5.45207C3.33013 5.69922 3.25006 6.01354 3.20801 6.52824C3.16533 7.05065 3.16504 7.71885 3.16504 8.66301V11.3271C3.16504 12.2712 3.16533 12.9394 3.20801 13.4618C3.25006 13.9766 3.33013 14.2909 3.45605 14.538L3.55859 14.7216C3.81498 15.1397 4.18266 15.4801 4.62207 15.704L4.82227 15.79C5.03904 15.8674 5.31234 15.9205 5.69824 15.9521C6.01398 15.9779 6.383 15.986 6.83398 15.9902L6.83496 3.99992ZM18.165 11.3271C18.165 12.2493 18.1653 12.9811 18.1172 13.5702C18.0745 14.0924 17.9916 14.5472 17.8125 14.9648L17.7295 15.1415C17.394 15.8 16.8834 16.3511 16.2568 16.7353L15.9814 16.8896C15.5157 17.1268 15.0069 17.2285 14.4102 17.2773C13.821 17.3254 13.0893 17.3251 12.167 17.3251H7.83301C6.91071 17.3251 6.17898 17.3254 5.58984 17.2773C5.06757 17.2346 4.61294 17.1508 4.19531 16.9716L4.01855 16.8896C3.36014 16.5541 2.80898 16.0434 2.4248 15.4169L2.27051 15.1415C2.03328 14.6758 1.93158 14.167 1.88281 13.5702C1.83468 12.9811 1.83496 12.2493 1.83496 11.3271V8.66301C1.83496 7.74072 1.83468 7.00898 1.88281 6.41985C1.93157 5.82309 2.03329 5.31432 2.27051 4.84856L2.4248 4.57317C2.80898 3.94666 3.36012 3.436 4.01855 3.10051L4.19531 3.0175C4.61285 2.83843 5.06771 2.75548 5.58984 2.71281C6.17898 2.66468 6.91071 2.66496 7.83301 2.66496H12.167C13.0893 2.66496 13.821 2.66468 14.4102 2.71281C15.0069 2.76157 15.5157 2.86329 15.9814 3.10051L16.2568 3.25481C16.8833 3.63898 17.394 4.19012 17.7295 4.84856L17.8125 5.02531C17.9916 5.44285 18.0745 5.89771 18.1172 6.41985C18.1653 7.00898 18.165 7.74072 18.165 8.66301V11.3271ZM8.16406 15.995H12.167C13.1112 15.995 13.7794 15.9947 14.3018 15.9521C14.8164 15.91 15.1308 15.8299 15.3779 15.704L15.5615 15.6015C15.9797 15.3451 16.32 14.9774 16.5439 14.538L16.6299 14.3378C16.7074 14.121 16.7605 13.8478 16.792 13.4618C16.8347 12.9394 16.835 12.2712 16.835 11.3271V8.66301C16.835 7.71885 16.8347 7.05065 16.792 6.52824C16.7605 6.14232 16.7073 5.86904 16.6299 5.65227L16.5439 5.45207C16.32 5.01264 15.9796 4.64498 15.5615 4.3886L15.3779 4.28606C15.1308 4.16013 14.8165 4.08006 14.3018 4.03801C13.7794 3.99533 13.1112 3.99504 12.167 3.99504H8.16406C8.16407 3.99667 8.16504 3.99829 8.16504 3.99992L8.16406 15.995Z`,fill:`currentColor`})}),Gn=S(w,!1),Kn=S(w,!1);function qn(e){let t=(0,$.c)(58),n;t[0]===e?n=t[1]:(n=e===void 0?{}:e,t[0]=e,t[1]=n);let{hideUnreadBadge:r,onToggleSidebar:i}=n,o=r===void 0?!1:r,s=v(w),c=D(),l=y(Ze),u=y(qe),d=y(Ae),f=y(a),p=!l&&!o,m;t[2]===p?m=t[3]:(m={taskFilter:`current`,limit:20,enabled:p},t[2]=p,t[3]=m);let h=ee(m),g=y(Gn),_=y(Kn),b=x(Mt,`toggleSidebar`),S=x(Mt,`navigateBack`),C=x(Mt,`navigateForward`),T;t[4]!==c||t[5]!==l?(T=l?c.formatMessage({id:`app.sidebar.hide`,defaultMessage:`Hide sidebar`,description:`Accessible label to collapse the sidebar chrome`}):c.formatMessage({id:`app.sidebar.show`,defaultMessage:`Show sidebar`,description:`Accessible label to expand the sidebar chrome`}),t[4]=c,t[5]=l,t[6]=T):T=t[6];let E=T,O=l?Un:Wn,A;t[7]===h.data?A=t[8]:(A=h.data??[],t[7]=h.data,t[8]=A);let j;t[9]===A?j=t[10]:(j=A.some(Xn),t[9]=A,t[10]=j);let M=!o&&!l&&(f>0||j),N,P;t[11]===s?(N=t[12],P=t[13]):(N=()=>()=>{s.set(Ne,!1),s.set(Le,!1),s.set(Ae,!1)},P=[s],t[11]=s,t[12]=N,t[13]=P),(0,Z.useEffect)(N,P);let F;t[14]===Symbol.for(`react.memo_cache_sentinel`)?(F=(0,Q.jsx)(k,{id:`app.sidebar.tooltip`,defaultMessage:`Toggle sidebar`,description:`Tooltip for the sidebar trigger button`}),t[14]=F):F=t[14];let I=u||d,L;t[15]!==i||t[16]!==s?(L=()=>{if(s.set(Ae,!0),i!=null){i();return}pt(`toggleSidebar`,`sidebar_trigger`)},t[15]=i,t[16]=s,t[17]=L):L=t[17];let R,z;t[18]===s?(R=t[19],z=t[20]):(R=()=>{s.set(Ne,!0)},z=()=>{s.set(Ne,!1),s.set(Le,!1),s.set(Ae,!1)},t[18]=s,t[19]=R,t[20]=z);let B;t[21]===O?B=t[22]:(B=(0,Q.jsx)(O,{className:`icon-xs`}),t[21]=O,t[22]=B);let V;t[23]===M?V=t[24]:(V=M?(0,Q.jsx)(`span`,{"aria-hidden":`true`,className:`absolute -top-0.5 -right-0.5 size-2 rounded-full bg-token-charts-blue ring-2 ring-token-main-surface-primary`,"data-testid":`sidebar-unread-badge`}):null,t[23]=M,t[24]=V);let H;t[25]!==B||t[26]!==V?(H=(0,Q.jsxs)(`span`,{className:`relative inline-flex`,children:[B,V]}),t[25]=B,t[26]=V,t[27]=H):H=t[27];let U;t[28]!==E||t[29]!==I||t[30]!==L||t[31]!==R||t[32]!==z||t[33]!==H||t[34]!==b?(U=(0,Q.jsx)(Zn,{ariaLabel:E,shortcut:b,tooltipContent:F,tooltipDisabled:I,viewTransitionName:`sidebar-trigger`,onClick:L,onPointerEnter:R,onPointerLeave:z,children:H}),t[28]=E,t[29]=I,t[30]=L,t[31]=R,t[32]=z,t[33]=H,t[34]=b,t[35]=U):U=t[35];let W;t[36]===c?W=t[37]:(W=c.formatMessage(Qn.navigateBack),t[36]=c,t[37]=W);let G=!g,K;t[38]===Symbol.for(`react.memo_cache_sentinel`)?(K=(0,Q.jsx)(k,{...Qn.navigateBack}),t[38]=K):K=t[38];let q;t[39]===Symbol.for(`react.memo_cache_sentinel`)?(q=(0,Q.jsx)(Rt,{className:`icon-xs`}),t[39]=q):q=t[39];let J;t[40]!==S||t[41]!==W||t[42]!==G?(J=(0,Q.jsx)(Zn,{ariaLabel:W,disabled:G,shortcut:S,tooltipContent:K,onClick:Yn,children:q}),t[40]=S,t[41]=W,t[42]=G,t[43]=J):J=t[43];let Y;t[44]===c?Y=t[45]:(Y=c.formatMessage(Qn.navigateForward),t[44]=c,t[45]=Y);let X=!_,te;t[46]===Symbol.for(`react.memo_cache_sentinel`)?(te=(0,Q.jsx)(k,{...Qn.navigateForward}),t[46]=te):te=t[46];let ne;t[47]===Symbol.for(`react.memo_cache_sentinel`)?(ne=(0,Q.jsx)(Rt,{className:`icon-xs -scale-x-100`}),t[47]=ne):ne=t[47];let re;t[48]!==C||t[49]!==Y||t[50]!==X?(re=(0,Q.jsx)(Zn,{ariaLabel:Y,disabled:X,shortcut:C,tooltipContent:te,onClick:Jn,children:ne}),t[48]=C,t[49]=Y,t[50]=X,t[51]=re):re=t[51];let ie;t[52]!==J||t[53]!==re?(ie=(0,Q.jsx)(dt,{electron:!0,extension:!0,children:(0,Q.jsxs)(Q.Fragment,{children:[J,re]})}),t[52]=J,t[53]=re,t[54]=ie):ie=t[54];let ae;return t[55]!==U||t[56]!==ie?(ae=(0,Q.jsxs)(`div`,{className:`flex items-center gap-1`,children:[U,ie]}),t[55]=U,t[56]=ie,t[57]=ae):ae=t[57],ae}function Jn(){return pt(`navigateForward`,`sidebar_forward`)}function Yn(){return pt(`navigateBack`,`sidebar_back`)}function Xn(e){return e.has_unread_turn}function Zn(e){let t=(0,$.c)(17),{ariaLabel:n,children:r,disabled:i,onClick:a,onPointerEnter:o,onPointerLeave:s,shortcut:c,tooltipContent:l,tooltipDisabled:u,viewTransitionName:d}=e,f=i===void 0?!1:i,p=u===void 0?!1:u,m;t[0]===d?m=t[1]:(m=d==null?void 0:{viewTransitionName:d},t[0]=d,t[1]=m);let h;t[2]!==n||t[3]!==r||t[4]!==f||t[5]!==a||t[6]!==o||t[7]!==s||t[8]!==m?(h=(0,Q.jsx)(L,{"aria-label":n,color:`ghost`,disabled:f,style:m,size:`toolbar`,uniform:!0,onClick:a,onPointerEnter:o,onPointerLeave:s,children:r}),t[2]=n,t[3]=r,t[4]=f,t[5]=a,t[6]=o,t[7]=s,t[8]=m,t[9]=h):h=t[9];let g;return t[10]!==o||t[11]!==s||t[12]!==c||t[13]!==h||t[14]!==l||t[15]!==p?(g=(0,Q.jsx)(P,{disabled:p,tooltipContent:l,onPointerEnter:o,onPointerLeave:s,shortcut:c,children:h}),t[10]=o,t[11]=s,t[12]=c,t[13]=h,t[14]=l,t[15]=p,t[16]=g):g=t[16],g}var Qn=A({navigateBack:{id:`codex.command.navigateBack`,defaultMessage:`Back`,description:`Command menu item to navigate back`},navigateForward:{id:`codex.command.navigateForward`,defaultMessage:`Forward`,description:`Command menu item to navigate forward`}});function $n(){let{platform:e}=nt();return e===`windows`&&window.electronBridge?.showApplicationMenu!=null}var er=A({file:{id:`windowsMenuBar.file`,defaultMessage:`File`,description:`Label for the File menu in the Windows custom title bar`},edit:{id:`windowsMenuBar.edit`,defaultMessage:`Edit`,description:`Label for the Edit menu in the Windows custom title bar`},view:{id:`windowsMenuBar.view`,defaultMessage:`View`,description:`Label for the View menu in the Windows custom title bar`},window:{id:`windowsMenuBar.window`,defaultMessage:`Window`,description:`Label for the Window menu in the Windows custom title bar`},help:{id:`windowsMenuBar.help`,defaultMessage:`Help`,description:`Label for the Help menu in the Windows custom title bar`}}),tr=[{id:t.file,message:er.file},{id:t.edit,message:er.edit},{id:t.view,message:er.view},{id:t.window,message:er.window},{id:t.help,message:er.help}];function nr(){let e=D(),t=$n(),[n,r]=(0,Z.useState)(null),i=(0,Z.useRef)(0);if(!t)return null;let a=async(e,t)=>{let n=window.electronBridge?.showApplicationMenu;if(!n)return;let a=i.current+1;i.current=a,r(e);let o=t.currentTarget.getBoundingClientRect();try{await n(e,Math.round(o.left),Math.round(o.bottom))}finally{i.current===a&&r(null)}};return(0,Q.jsx)(`div`,{className:`flex items-center gap-0.5 pr-2 pl-1`,children:tr.map(({id:t,message:r})=>(0,Q.jsx)(`button`,{type:`button`,"aria-expanded":n===t,"aria-haspopup":`menu`,"aria-label":e.formatMessage(r),className:c(`no-drag rounded-md border border-transparent px-2.5 py-1 text-base font-normal leading-none outline-none transition-colors`,n===t?`bg-[var(--color-token-menubar-selection-background)] text-[var(--color-token-menubar-selection-foreground)]`:`text-token-text-tertiary hover:bg-token-foreground/5 hover:text-token-description-foreground focus-visible:bg-token-foreground/5 focus-visible:text-token-description-foreground`),onClick:e=>{a(t,e)},children:(0,Q.jsx)(k,{...r})},t))})}var rr=280,ir=`app-shell:bottom-panel-height`;function ar(e,t){return Number.isFinite(e)?Math.max(160,Math.min(e,t*.5)):rr}function or(e){return ar(j(ir,280),e)}function sr(e,t){M(ir,ar(e,t))}function cr(e){let t=(0,$.c)(10),{size:n,animation:r,isVisible:i}=e,[,a]=(0,Z.useState)(0),o;t[0]!==r||t[1]!==a?(o=()=>{r.get()>0||a(ur)},t[0]=r,t[1]=a,t[2]=o):o=t[2],Gt(r,`animationComplete`,o);let s;t[3]!==r||t[4]!==n?(s=[r,n],t[3]=r,t[4]=n,t[5]=s):s=t[5];let c=Xt(s,lr),l=i||r.get()>0,u;return t[6]!==c||t[7]!==r||t[8]!==l?(u={isMounted:l,animatedSize:c,opacity:r,progress:r},t[6]=c,t[7]=r,t[8]=l,t[9]=u):u=t[9],u}function lr(e){let[t,n]=e;return Math.max(0,Math.min(1,t))*n}function ur(e){return e+1}function dr({bottomPanelHeight:e,children:t,clampedBottomPanelHeight:n,mainContentHeight:r,isVisible:i=!1}){let a=v(I),{isMounted:o,opacity:s,animatedSize:c}=cr({animation:y(Ye),size:n,isVisible:i}),l=Jt`${n}px`;return!o&&!i?null:(0,Q.jsxs)(U.div,{"data-app-shell-focus-area":`bottom-panel`,className:`relative z-30 min-h-0 w-full shrink-0 overflow-visible`,style:{opacity:s,height:c},transition:Ke,children:[(0,Q.jsx)(Bn,{defaultSize:280,edge:`top`,getCurrentSize:()=>n.get(),setSize:t=>{if(t{em==null?null:ot.getSnapshot(m.conversationId,m.browserTabId),e[7]=m,e[8]=_);let b=_,x=(0,Z.useSyncExternalStore)(gr,b,b)?.tabType===n.WEB?m:null,S=x?.conversationId??null,w=x?.browserTabId??null,T,D;e[9]!==g||e[10]!==a||e[11]!==c||e[12]!==h||e[13]!==o||e[14]!==S||e[15]!==w?(T=()=>{C.dispatchMessage(`app-shell-shortcut-state-changed`,{bottomPanelCanCloseActiveTab:g,focusArea:a,imagePreviewOpen:c,terminalFocused:o,rightPanelBrowserConversationId:S,rightPanelBrowserTabId:w,rightPanelCanCloseActiveTab:h})},D=[g,a,c,o,h,S,w],e[9]=g,e[10]=a,e[11]=c,e[12]=h,e[13]=o,e[14]=S,e[15]=w,e[16]=T,e[17]=D):(T=e[16],D=e[17]),(0,Z.useEffect)(T,D);let O;e[18]===Symbol.for(`react.memo_cache_sentinel`)?(O=[],e[18]=O):O=e[18],(0,Z.useEffect)(mr,O);let k;e[19]===Symbol.for(`react.memo_cache_sentinel`)?(k=[],e[19]=k):k=e[19],E(`image-preview-zoom-command`,pr,k);let A,j;return e[20]!==s||e[21]!==f||e[22]!==t?(A=e=>{let{panelId:n}=e;bb80:switch(n){case`bottom`:at.closeActiveTab(t);break bb80;case`right`:if(rt.closeActiveTab(t))break bb80;f!=null&&s!=null&&rt.closeTab(t,s.tabId)}},j=[s,f,t],e[20]=s,e[21]=f,e[22]=t,e[23]=A,e[24]=j):(A=e[23],j=e[24]),E(`close-active-app-shell-tab`,A,j),null}function pr(e){let{command:t}=e;Ht(t)}function mr(){return hr}function hr(){C.dispatchMessage(`app-shell-shortcut-state-changed`,{bottomPanelCanCloseActiveTab:!1,focusArea:`main`,imagePreviewOpen:!1,terminalFocused:!1,rightPanelBrowserConversationId:null,rightPanelBrowserTabId:null,rightPanelCanCloseActiveTab:!1})}function gr(e){return ot.subscribe(e)}var _r=`[&_a]:pointer-events-auto [&_button]:pointer-events-auto [&_input]:pointer-events-auto [&_select]:pointer-events-auto [&_textarea]:pointer-events-auto`;function vr({isHeaderEdgeScroll:e,isWindowsMenuBarEnabled:t}){let{headerLeftWidth:n,headerRightWidth:r,leftPanelAnimatedWidth:i,rightPanelAnimatedWidth:a}=Je(),o=Kt(0),s=Jt`${i}px`,l=Jt`${a}px`,u=y(fe),d=y(et),f=y(be),p=y(ce),m=y(ye),h=y(xe),g=d.filter(({align:e})=>e===`start`),_=d.filter(({align:e})=>e===`end`),v=d.length>0,b=g.length>0,x=_.length>0,S=m.length>0,C=u!=null||v;return(0,Q.jsx)(Ct,{items:f,children:(0,Q.jsxs)(U.header,{"data-app-shell-header-edge-scroll":e,className:c(`app-header-tint draggable pointer-events-none fixed z-30 flex h-toolbar min-w-0 items-center`,t?`right-0`:`inset-x-0`,t?`top-toolbar-sm`:`top-0`),style:t?{left:s}:{},children:[(0,Q.jsx)(yr,{entries:p,fitWidth:n,slotWidth:t?o:i,side:`start`}),C&&(0,Q.jsxs)(`div`,{"aria-hidden":h,"data-testid":`app-shell-header-context-menu-surface`,className:c(`pointer-events-none ms-4 flex h-full min-w-0 flex-1 isolate items-center gap-1.5 overflow-hidden [contain:layout_paint]`,h&&`invisible`,S?`pe-1.5`:`pe-2`),children:[u!=null&&(0,Q.jsx)(`div`,{className:c(`pointer-events-none w-full min-w-0 flex-1`,_r),children:u}),b&&(0,Q.jsx)(`div`,{className:`flex shrink-0 items-center gap-1.5`,children:g.map(({actionId:e,node:t})=>(0,Q.jsx)(`div`,{className:`no-drag pointer-events-auto flex shrink-0 items-center`,children:t},e))}),x&&(0,Q.jsx)(`div`,{className:`ms-auto flex shrink-0 items-center gap-1.5`,children:_.map(({actionId:e,node:t})=>(0,Q.jsx)(`div`,{className:`no-drag pointer-events-auto flex shrink-0 items-center`,children:t},e))})]}),(0,Q.jsx)(yr,{entries:m,fitWidth:r,slotWidth:l,side:`end`})]})})}function yr({entries:e,fitWidth:t,side:n,slotWidth:r}){let i=e.some(({align:e})=>e===`end`),a=c({"ps-[max(var(--spacing-token-safe-header-left),0.5rem)]":n===`start`,"pe-2":n===`start`&&i||n===`end`}),o=At(e=>{let{width:n}=kt(e);t.set(n)});return(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`div`,{"aria-hidden":!0,className:c(`invisible pointer-events-none fixed top-0 left-0 min-w-max [&_*]:![view-transition-name:none]`,!!e.length&&a),ref:o,children:(0,Q.jsx)(br,{entries:e})}),(0,Q.jsx)(U.div,{"data-test-id":`header-shell-slot`,className:c(`pointer-events-none relative h-full shrink-0 [container-type:inline-size]`,!!e.length&&a),style:{width:r,minWidth:Jt`${t}px`},children:(0,Q.jsx)(br,{entries:e,fillSlot:!0})})]})}function br(e){let t=(0,$.c)(11),{entries:n,fillSlot:r}=e,i=r===void 0?!1:r,a,o,s;if(t[0]!==n||t[1]!==i){let e=n.filter(wr),r=n.filter(Cr),l=i?`pointer-events-none w-full`:`no-drag pointer-events-auto w-auto`;t[5]===l?a=t[6]:(a=c(`inline-flex h-full items-center gap-1.5`,l),t[5]=l,t[6]=a),o=e.map(Sr),s=r.map(xr),t[0]=n,t[1]=i,t[2]=a,t[3]=o,t[4]=s}else a=t[2],o=t[3],s=t[4];let l;return t[7]!==a||t[8]!==o||t[9]!==s?(l=(0,Q.jsxs)(`div`,{className:a,children:[o,s]}),t[7]=a,t[8]=o,t[9]=s,t[10]=l):l=t[10],l}function xr(e,t){let{actionId:n,node:r}=e;return(0,Q.jsx)(`div`,{className:c(`no-drag pointer-events-auto flex shrink-0 items-center`,t===0&&`ms-auto`),children:r},n)}function Sr(e){let{actionId:t,node:n}=e;return(0,Q.jsx)(`div`,{className:`no-drag pointer-events-auto flex shrink-0 items-center`,children:n},t)}function Cr(e){let{align:t}=e;return t===`end`}function wr(e){let{align:t}=e;return t===`start`}function Tr({children:e,paddingTop:t}){let n=v(w),{leftPanelAnimatedWidth:r,leftPanelWidth:i}=Je(),[a,o]=(0,Z.useState)(!1),s=y(qe),l=Jt`${i}px`;return(0,Q.jsxs)(U.aside,{className:c(`app-shell-left-panel pointer-events-auto relative flex overflow-visible browser:bg-token-main-surface-primary`,a&&`cursor-col-resize`),style:{width:r,paddingTop:t},children:[(0,Q.jsx)(U.div,{className:`max-w-full overflow-hidden`,style:{minWidth:l,width:l,opacity:y(Oe)},children:e}),(0,Q.jsx)(Bn,{disabled:s,defaultSize:300,getCurrentSize:()=>i.get(),onResizingChange:o,setSize:e=>{if(e{e{f.set(f.get()+1)}),!h&&!t?null:(0,Q.jsxs)(U.aside,{"data-app-shell-focus-area":`right-panel`,className:`relative z-[41] ml-auto h-full min-h-0 min-w-0 shrink-0 overflow-visible`,style:{opacity:g,width:_},transition:Ke,children:[!p&&(0,Q.jsx)(`div`,{"aria-hidden":!0,className:`pointer-events-none absolute inset-y-0 left-0 z-30 w-px shadow-[-8px_0_16px_-8px_rgb(0_0_0/0.18)]`}),!p&&(0,Q.jsx)(Bn,{defaultSize:l??u.defaultWidth,edge:`left`,getCurrentSize:()=>r.get(),setSize:e=>{if(e{e{let[t,r]=e;return n?t:Qe(r,t,o)},t[3]=n,t[4]=o,t[5]=c):c=t[5];let l=Xt(s,c),u;t[6]!==i||t[7]!==l?(u=[i,l],t[6]=i,t[7]=l,t[8]=u):u=t[8];let d;t[9]===n?d=t[10]:(d=e=>{let[t,r]=e;return n?0:Math.max(0,Math.min(1,t))*r},t[9]=n,t[10]=d);let f=Xt(u,d),p;return t[11]!==f||t[12]!==l||t[13]!==a||t[14]!==o?(p={rightPanelAnimatedWidth:f,rightPanelWidth:l,rightPanelWidthRatio:a,widthMode:o},t[11]=f,t[12]=l,t[13]=a,t[14]=o,t[15]=p):p=t[15],p}function Ar(e,t){let n=(0,Z.useRef)(null);if(n.current!=null&&n.current.defaultWidth===e.defaultWidth&&n.current.storageKey===e.storageKey)return n.current.widthRatio;let r=K(Re({...e,mainContentWidth:t.get()}));return n.current={...e,widthRatio:r},r}function jr(e){let t=(0,$.c)(30),{children:n}=e,r=v(I),i;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(i={activationConstraint:{distance:6}},t[0]=i):i=t[0];let a=d(u(f,i)),[o,s]=(0,Z.useState)(null),c=(0,Z.useRef)(null),l;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(l=(e,t)=>{s(n=>n==null?n:ln(n,e,t))},t[1]=l):l=t[1];let m=l,h;t[2]===r?h=t[3]:(h=e=>{let t=Nr(e.active.data.current);if(t?.kind!==`app-shell-tab`)return;let n=r.get(t.controller.tabs$),i=n.findIndex(e=>e.tabId===t.tabId),a=n[i]??null;a!=null&&(c.current={sourceController:t.controller,sourceIndex:i,tabId:t.tabId},s({draggedTab:a,isDraggedTabActive:r.get(t.controller.activeTab$)?.tabId===t.tabId,overTabId:null,previewController:t.controller,sourceController:t.controller}))},t[2]=r,t[3]=h);let _=h,y;t[4]!==o||t[5]!==r?(y=e=>{let t=c.current;if(o==null||t==null)return;let n=Nr(e.over?.data.current);if(n!=null)if(n.kind===`app-shell-tab`){if(n.tabId===t.tabId)return;if(n.controller===t.sourceController){cn(r,t.sourceController,t.tabId,n.tabId),m(t.sourceController,null);return}m(n.controller,n.tabId)}else m(n.controller,null)},t[4]=o,t[5]=r,t[6]=y):y=t[6];let b=y,x;t[7]!==o||t[8]!==r?(x=e=>{let t=c.current;o!=null&&t!=null&&(sn(r,t),o.isDraggedTabActive&&t.sourceController.activateTab(r,t.tabId)),s(null),c.current=null},t[7]=o,t[8]=r,t[9]=x):x=t[9];let S=x,C;t[10]!==o||t[11]!==r?(C=e=>{let t=c.current;o!=null&&t!=null&&e.over==null?(sn(r,t),o.isDraggedTabActive&&t.sourceController.activateTab(r,t.tabId)):o!=null&&t!=null&&o.previewController!==t.sourceController&&(t.sourceController.moveTabTo(r,t.tabId,o.previewController,o.overTabId,{activate:!1}),o.isDraggedTabActive&&o.previewController.activateTab(r,t.tabId)),s(null),c.current=null},t[10]=o,t[11]=r,t[12]=C):C=t[12];let w=C,T;t[13]===o?T=t[14]:(T={dragState:o},t[13]=o,t[14]=T);let E;t[15]===o?E=t[16]:(E=o==null?null:(0,Q.jsx)(Mr,{dragState:o}),t[15]=o,t[16]=E);let D;t[17]===E?D=t[18]:(D=(0,Q.jsx)(p,{adjustScale:!1,children:E}),t[17]=E,t[18]=D);let O;t[19]!==n||t[20]!==S||t[21]!==w||t[22]!==b||t[23]!==_||t[24]!==a||t[25]!==D?(O=(0,Q.jsxs)(g,{sensors:a,collisionDetection:Pr,onDragStart:_,onDragOver:b,onDragCancel:S,onDragEnd:w,children:[n,D]}),t[19]=n,t[20]=S,t[21]=w,t[22]=b,t[23]=_,t[24]=a,t[25]=D,t[26]=O):O=t[26];let k;return t[27]!==O||t[28]!==T?(k=(0,Q.jsx)(on.Provider,{value:T,children:O}),t[27]=O,t[28]=T,t[29]=k):k=t[29],k}function Mr(e){let t=(0,$.c)(12),{dragState:n}=e,{highlightedIcon:r,icon:i,isClosable:a,isHighlighted:o,isLabel:s,isPreview:c,tabId:l,title:u,tooltip:d,trailingContent:f}=n.draggedTab,p;return t[0]!==n.isDraggedTabActive||t[1]!==r||t[2]!==i||t[3]!==a||t[4]!==o||t[5]!==s||t[6]!==c||t[7]!==l||t[8]!==u||t[9]!==d||t[10]!==f?(p=(0,Q.jsx)(`div`,{className:`relative my-auto flex max-w-40 shrink-0 items-center gap-0.5 pe-1`,children:(0,Q.jsx)(tn,{id:l,highlightedIcon:r,icon:i,isActive:n.isDraggedTabActive,isClosable:a,isDragging:!0,isHighlighted:o,isLabel:s,isPreview:c,trailingContent:f,title:u,tooltip:d})}),t[0]=n.isDraggedTabActive,t[1]=r,t[2]=i,t[3]=a,t[4]=o,t[5]=s,t[6]=c,t[7]=l,t[8]=u,t[9]=d,t[10]=f,t[11]=p):p=t[11],p}function Nr(e){if(typeof e!=`object`||!e)return null;switch(Reflect.get(e,`kind`)){case`app-shell-tab`:case`app-shell-tab-strip`:return e;default:return null}}function Pr(e){let t=h(e),n=t.filter(e=>Nr(e.data?.droppableContainer.data.current)?.kind===`app-shell-tab`);if(n.length>0)return n;let r=t.find(e=>Nr(e.data?.droppableContainer.data.current)?.kind===`app-shell-tab-strip`)??null,i=r==null?null:Nr(r.data?.droppableContainer.data.current);if(r!=null&&i?.kind===`app-shell-tab-strip`){let t=e.droppableContainers.filter(e=>{let t=Nr(e.data.current);return t?.kind===`app-shell-tab`&&t.controller===i.controller});return t.length>0?l({...e,droppableContainers:t}):[r]}return l(e)}var Fr=`data-app-shell-focus-area`,Ir=96,Lr=16,Rr=960,zr=720,Br=12,Vr=0,Hr=b(w,({get:e})=>{let t=e(zn.px$);return t!=null&&t>=0&&t<=Br}),Ur=b(w,({get:e})=>{let t=e(zn.px$),n=e(Ue)-Vr;return t!=null&&t>=0&&t<=n}),Wr=S(I,!1,{onMount:(e,t)=>{let n=!1,r,i;e(!1);let a=t.watch(({get:a})=>{if(a(Ze)){n=!1,r=void 0,i=void 0,e(!1);return}if(a(qe)){e(!1);return}let o=a(zn.px$),s=a(zn.py$),c=a(Hr),l=a(Ur),u=a(Le),d=a(Ne);if(u){d&&(n=!0);let a=r!==void 0&&i!==void 0&&(o!==r||s!==i);r===void 0&&(r=o,i=s),(a||n&&!d)&&!c&&!d&&(n=!1,r=void 0,i=void 0,t.set(Le,!1)),e(!1);return}n=!1,r=void 0,i=void 0;let f=a(ze);e(e=>{let t=e?l||f:c||f;return e===t?e:t})});return()=>{e(!1),a()}}});function Gr({bottomPanelSlot:e,children:t,leftPanelSlot:n,rightPanelSlot:r}){let i=v(I),a=(0,Z.useRef)(null),[o,s]=(0,Z.useState)(null),l=n?.children,u=l!=null,d=e!=null,f=r!=null,p=(0,Z.useRef)(!1),m=(0,Z.useRef)(!1),h=y(xe),g=y(se),_=N(),b=zt(),x=$n(),[S,C]=(0,Z.useState)(!1),w=y(Ze),T=y(R),E=y(Wr),D=g===`thread-edge-scroll`,O=u&&w,k=D&&S&&!h,A=g===`full-bleed`,j=`visible`;A?j=`hidden`:D?j=`full-bleed`:f&&(j=`hidden`);let M=Kt(ae()),ee=Xt(M,e=>`${Math.max(0,e-Vr*2)}px`),{isMounted:P,animatedSize:F}=cr({animation:y(Oe),size:M,isVisible:O}),L=Kt(window.innerWidth),z=Kt(window.innerHeight-46),B=Kt(or(z.get())),V=y(Ye),H=Xt([B,z],([e,t])=>ar(e,t)),W=Xt([V,H],([e,t])=>e*t),G=Jt`${W}px`,K=Kt(0),q=Kt(0),J=Kt(0),Y=Xt([L,F],([e,t])=>Math.max(0,e-t)),{rightPanelAnimatedWidth:X,rightPanelWidth:ne,rightPanelWidthRatio:ie,widthMode:oe}=kr({isFullWidth:h,mainContentWidth:Y}),ce=Xt([L,ie],([e,t])=>Ee({isRightPanelOpen:f,mainContentWidth:e,rightPanelWidthMode:oe,rightPanelWidthRatio:t})),le=Xt([L,M,ie],([e,t,n])=>Ee({isRightPanelOpen:f,mainContentWidth:Math.max(0,e-t),rightPanelWidthMode:oe,rightPanelWidthRatio:n})),ue=O?le:ce,de=(0,Z.useRef)(W.get()),fe=(0,Z.useRef)(new Set),pe={"--spacing-token-safe-header-left":`${b.left/_}px`,"--spacing-token-safe-header-right":`${b.right/_}px`,width:`calc(100vw / var(--codex-window-zoom))`,height:`calc(100vh / var(--codex-window-zoom))`,zoom:`var(--codex-window-zoom)`,"--app-shell-bottom-panel-height":G},me=(0,Z.useMemo)(()=>({headerLeftWidth:q,headerRightWidth:J,leftPanelWidth:M,leftPanelAnimatedWidth:F,mainContentTargetWidth:ue,mainContentWidth:Y,shellWidth:L,rightPanelAnimatedWidth:X,rightPanelLayoutTick:K}),[q,J,F,M,ue,Y,X,K,L]),he=u,ge=(0,Z.useCallback)(e=>(fe.current.add(e),()=>{fe.current.delete(e)}),[]),_e=St(({width:e})=>{L.set(e);let t=e<=Rr,n=e<=zr,r=t!==p.current,a=n!==m.current;!r&&!a||(p.current=t,m.current=n,(r&&O&&f&&t||a&&n)&&(i.get(te)===`right-panel`&&Me(i,`main`),i.get(xe)&&i.set(xe,!1),i.get(Te)&&$e(i,!1)),a&&n&&i.get(Ze)&&re(i,!1))}),ve=At(e=>{let{width:t}=kt(e);_e({width:t})}),ye=At(e=>{let{width:t}=kt(e);C(t>=Zr())}),be=At(e=>{let{height:t}=kt(e);z.set(t)}),Se=(0,Z.useCallback)(e=>{s(e)},[]),Ce=(0,Z.useMemo)(()=>Lt(Se,be),[be,Se]);return Gt(W,`change`,e=>{let t=e-de.current;if(de.current=e,t!==0)for(let e of fe.current)e(t)}),(0,Q.jsx)(Er.Provider,{value:a,children:(0,Q.jsx)(Dr.Provider,{value:o,children:(0,Q.jsx)(Bt.Provider,{value:ge,children:(0,Q.jsxs)(Ie.Provider,{value:me,children:[(0,Q.jsx)(En,{}),(0,Q.jsx)(fr,{}),(0,Q.jsxs)(U.div,{ref:a,style:pe,className:`relative flex flex-col`,onBlurCapture:e=>{e.relatedTarget instanceof Node&&e.currentTarget.contains(e.relatedTarget)||(Me(i,`main`),Be(i,!1))},onFocusCapture:e=>{Me(i,Yr(e.target)),Be(i,Xr(e.target))},onPointerOverCapture:e=>{Xe(i,Yr(e.target))},children:[x&&(0,Q.jsx)(Qr,{}),(0,Q.jsxs)(`div`,{ref:ve,className:`relative isolate flex max-h-full min-h-0 w-full flex-1`,children:[(0,Q.jsx)(tt,{initial:!1,children:u&&(O||P)&&(0,Q.jsx)(Tr,{paddingTop:x?`0px`:`var(--height-toolbar)`,children:l},`app-shell-left-panel`)}),he&&!w&&!P&&(0,Q.jsx)(Kr,{floatingLeftPanelWidth:ee,isWindowsMenuBarEnabled:x,isVisible:E&&!w&&!P,leftPanelWidth:M,leftPanel:l,shouldUseReducedMotion:T,onOpenSidebar:()=>{re(i,!0,{animate:!1})}}),(0,Q.jsx)(`main`,{ref:Ce,className:c(`relative isolate flex min-h-0 flex-1 flex-col`,`main-surface`,P&&`rounded-s-2xl`,!P&&`!rounded-l-none`),children:(0,Q.jsxs)(jr,{children:[(0,Q.jsx)(vr,{isHeaderEdgeScroll:k,isWindowsMenuBarEnabled:x}),(0,Q.jsxs)(`div`,{className:`relative isolate flex min-h-0 flex-1 overflow-hidden`,children:[(0,Q.jsx)(`div`,{"data-app-shell-main-content-layout":g,ref:ye,className:c(`app-shell-main-content-viewport relative flex min-h-0 min-w-0 flex-col`,h?`w-0 flex-none overflow-hidden`:`flex-1`),children:(0,Q.jsx)(`div`,{className:c(`app-shell-main-content-frame relative mt-(--app-shell-main-content-frame-top-offset) flex min-h-0 flex-1 flex-col border-t`,f||D&&!k?`border-token-border-default`:`border-transparent`),children:(0,Q.jsxs)(`div`,{className:`relative flex min-h-0 flex-1`,children:[(0,Q.jsx)(`div`,{"aria-hidden":!0,"data-app-shell-main-content-top-fade":j,className:`app-shell-main-content-top-fade pointer-events-none absolute inset-x-0 top-0 z-20 h-4 bg-gradient-to-b from-token-main-surface-primary opacity-0 transition-opacity duration-200 browser:hidden`}),(0,Q.jsx)(`div`,{className:`h-full min-h-0 min-w-0 flex-1`,children:t})]})})}),(0,Q.jsx)(Or,{isRightPanelOpen:f,mainContentWidth:Y,rightPanelWidth:ne,rightPanelWidthRatio:ie,widthMode:oe,children:r?.children},`right-panel:${i.value.pathname}`)]}),(0,Q.jsx)(dr,{bottomPanelHeight:B,clampedBottomPanelHeight:H,mainContentHeight:z,isVisible:d,children:(0,Q.jsx)(Jr,{})})]})})]})]})]})})})})}function Kr(e){let t=(0,$.c)(15),{floatingLeftPanelWidth:n,isWindowsMenuBarEnabled:r,isVisible:i,leftPanel:a,leftPanelWidth:o,shouldUseReducedMotion:s,onOpenSidebar:l}=e,u=v(w),[d,f]=(0,Z.useState)(!1),p=i||d,m;t[0]===s?m=t[1]:(m=s?{duration:0}:Ke,t[0]=s,t[1]=m);let h=m,g;t[2]!==n||t[3]!==p||t[4]!==d||t[5]!==r||t[6]!==a||t[7]!==o||t[8]!==l||t[9]!==u||t[10]!==s||t[11]!==h?(g=p?(0,Q.jsxs)(U.div,{className:c(`pointer-events-auto fixed bottom-0 left-0 z-30 min-h-0`,d&&`cursor-col-resize`,r?`top-(--height-toolbar-sm)`:`top-0`),initial:s?!1:{opacity:0,x:-8},animate:{opacity:1,x:0},exit:{opacity:0,x:s?0:-8},style:{width:n},transition:h,children:[(0,Q.jsxs)(`aside`,{"data-testid":`app-shell-floating-left-panel`,className:`flex h-full min-h-0 flex-col overflow-hidden rounded-lg bg-token-main-surface-primary shadow-[1px_0_0_0_var(--color-token-border-default),0_20px_25px_-5px_rgb(0_0_0/0.1),0_8px_10px_-6px_rgb(0_0_0/0.1)]`,children:[(0,Q.jsx)(U.div,{initial:s?!1:{x:8},animate:{x:0},exit:{x:s?0:8},transition:h,className:`app-header-tint flex h-toolbar shrink-0 items-center ps-(--spacing-token-safe-header-left) pe-2`,children:(0,Q.jsx)(qn,{hideUnreadBadge:!0,onToggleSidebar:l})}),(0,Q.jsx)(`div`,{className:`min-h-0 flex-1 overflow-hidden`,children:a})]}),(0,Q.jsx)(Bn,{defaultSize:300,getCurrentSize:()=>o.get(),onResizingChange:f,setSize:e=>{let t=ie(e);u.set(Ue,t),o.set(t)},onResizeEnd:qr})]}):null,t[2]=n,t[3]=p,t[4]=d,t[5]=r,t[6]=a,t[7]=o,t[8]=l,t[9]=u,t[10]=s,t[11]=h,t[12]=g):g=t[12];let _;return t[13]===g?_=t[14]:(_=(0,Q.jsx)(tt,{initial:!1,children:g}),t[13]=g,t[14]=_),_}function qr(e){he(ie(e))}function Jr(){let e=(0,$.c)(5),t=y(at.activeTab$),n=y(me),r=y(ge),i=y(oe);if(t!=null){let t;return e[0]!==r||e[1]!==i?(t=(0,Q.jsx)(fn,{headerHeight:`pane`,afterList:r,afterListSticky:i,controller:at}),e[0]=r,e[1]=i,e[2]=t):t=e[2],t}let a;return e[3]===n?a=e[4]:(a=n==null?null:(0,Q.jsx)(Q.Fragment,{children:n}),e[3]=n,e[4]=a),a}function Yr(e){if(!(e instanceof HTMLElement))return`main`;let t=e.closest(`[${Fr}]`)?.getAttribute(Fr);return t===`right-panel`||t===`bottom-panel`?t:`main`}function Xr(e){return e instanceof HTMLElement&&e.closest(`[data-codex-terminal]`)!=null}function Zr(){let e=Number.parseFloat(getComputedStyle(document.documentElement).fontSize);return Number.isFinite(e)?Ir*e:Ir*Lr}function Qr(){let e=(0,$.c)(6),t=y(ct),n;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,Q.jsx)(qn,{}),e[0]=n):n=e[0];let r;e[1]===t?r=e[2]:(r=st(t)?(0,Q.jsx)(Pn,{}):null,e[1]=t,e[2]=r);let i;e[3]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,Q.jsx)(nr,{}),e[3]=i):i=e[3];let a;return e[4]===r?a=e[5]:(a=(0,Q.jsxs)(`div`,{className:`app-header-tint draggable group/windows-top-bar z-40 flex h-toolbar-sm items-center ps-(--spacing-token-safe-header-left) pe-(--spacing-token-safe-header-right)`,children:[n,r,i]}),e[4]=r,e[5]=a),a}function $r(e){return null}function ei(e){let{children:t}=e;return gi(v(I),fe,t),null}function ti(e){let t=(0,$.c)(23),{actionId:n,align:r,children:i,order:a,slotPosition:o}=e,s=r===void 0?`start`:r,c=a===void 0?0:a,l=o===void 0?`center`:o,u=v(I),d=ve[l],f;t[0]!==n||t[1]!==s||t[2]!==i||t[3]!==c||t[4]!==d.byId||t[5]!==u?(f=()=>{u.set(d.byId,n,{align:s,node:i,order:c})},t[0]=n,t[1]=s,t[2]=i,t[3]=c,t[4]=d.byId,t[5]=u,t[6]=f):f=t[6];let p;t[7]!==n||t[8]!==s||t[9]!==i||t[10]!==c||t[11]!==d||t[12]!==u?(p=[n,s,i,c,d,u],t[7]=n,t[8]=s,t[9]=i,t[10]=c,t[11]=d,t[12]=u,t[13]=p):p=t[13],(0,Z.useLayoutEffect)(f,p);let m;t[14]!==n||t[15]!==d.byId||t[16]!==d.ids$||t[17]!==u?(m=()=>(u.set(d.ids$,e=>e.includes(n)?e:[...e,n]),()=>{u.set(d.ids$,e=>e.filter(e=>e!==n)),u.set(d.byId,n,null)}),t[14]=n,t[15]=d.byId,t[16]=d.ids$,t[17]=u,t[18]=m):m=t[18];let h;return t[19]!==n||t[20]!==d||t[21]!==u?(h=[n,d,u],t[19]=n,t[20]=d,t[21]=u,t[22]=h):h=t[22],(0,Z.useLayoutEffect)(m,h),null}function ni(e){let t=(0,$.c)(8),n=v(I),r,i;t[0]!==e||t[1]!==n?(r=()=>{n.set(ne.byId,e.id,e)},i=[e,n],t[0]=e,t[1]=n,t[2]=r,t[3]=i):(r=t[2],i=t[3]),(0,Z.useLayoutEffect)(r,i);let a,o;return t[4]!==e.id||t[5]!==n?(a=()=>(n.set(ne.ids$,t=>t.includes(e.id)?t:[...t,e.id]),()=>{n.set(ne.ids$,t=>t.filter(t=>t!==e.id)),n.set(ne.byId,e.id,null)}),o=[e.id,n],t[4]=e.id,t[5]=n,t[6]=a,t[7]=o):(a=t[6],o=t[7]),(0,Z.useLayoutEffect)(a,o),null}function ri(e){return null}function ii(){let e=(0,$.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,Q.jsx)(Tn,{}),e[0]=t):t=e[0],t}function ai(e){let{children:t}=e;return gi(v(I),we,t),null}function oi(e){let t=(0,$.c)(9),{children:n,defaultWidth:r,widthStorageKey:i}=e,a=r===void 0?600:r,o=v(I),s;t[0]!==o||t[1]!==i?(s=i??ke(o.value.routeTemplate),t[0]=o,t[1]=i,t[2]=s):s=t[2];let c=s;gi(o,de,n);let l,u;return t[3]!==a||t[4]!==c||t[5]!==o||t[6]!==i?(l=()=>{if(!(a===600&&i==null))return o.set(X,{defaultWidth:a,storageKey:c}),()=>{o.set(X,null)}},u=[a,c,o,i],t[3]=a,t[4]=c,t[5]=o,t[6]=i,t[7]=l,t[8]=u):(l=t[7],u=t[8]),(0,Z.useLayoutEffect)(l,u),null}function si(e){let{children:t}=e;return gi(v(I),ue,t),null}function ci(e){let{children:t}=e;return gi(v(I),Se,t),null}function li(e){let{children:t}=e;return gi(v(I),Ce,t),null}function ui(){return null}function di(){let e=(0,$.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,Q.jsx)(Sn,{}),e[0]=t):t=e[0],t}function fi(e){let{children:t}=e;return gi(v(I),le,t),null}function pi(e){let{children:t}=e;return gi(v(I),ge,t),null}function mi(e){let{children:t}=e;return gi(v(I),oe,t),null}function hi(e){let{children:t}=e;return gi(v(I),me,t),null}function gi(e,t,n){let r=(0,$.c)(9),i,a;r[0]!==n||r[1]!==e||r[2]!==t?(i=()=>{e.set(t,n)},a=[n,e,t],r[0]=n,r[1]=e,r[2]=t,r[3]=i,r[4]=a):(i=r[3],a=r[4]),(0,Z.useLayoutEffect)(i,a);let o,s;r[5]!==e||r[6]!==t?(o=()=>()=>{e.set(t,null)},s=[e,t],r[5]=e,r[6]=t,r[7]=o,r[8]=s):(o=r[7],s=r[8]),(0,Z.useLayoutEffect)(o,s)}function _i(e){let t=(0,$.c)(3),{children:n}=e,r;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,Q.jsx)(wt,{debugName:`AppShellContent`,fillParent:!0}),t[0]=r):r=t[0];let i;return t[1]===n?i=t[2]:(i=(0,Q.jsx)(Z.Suspense,{fallback:r,children:n}),t[1]=n,t[2]=i),i}function vi(e){let t=(0,$.c)(4),{layout:n}=e,r=v(I),i,a;return t[0]!==n||t[1]!==r?(i=()=>(r.set(se,n),()=>{r.set(se,`default`)}),a=[n,r],t[0]=n,t[1]=r,t[2]=i,t[3]=a):(i=t[2],a=t[3]),(0,Z.useLayoutEffect)(i,a),null}function yi(e){let t=(0,$.c)(7),{children:n}=e,r;t[0]===n?r=t[1]:(r=bi(n),t[0]=n,t[1]=r);let{bottomPanelSlot:i,contentChildren:a,leftPanelSlot:o,rightPanelSlot:s}=r,c;return t[2]!==i||t[3]!==a||t[4]!==o||t[5]!==s?(c=(0,Q.jsx)(Gr,{bottomPanelSlot:i,leftPanelSlot:o,rightPanelSlot:s,children:a}),t[2]=i,t[3]=a,t[4]=o,t[5]=s,t[6]=c):c=t[6],c}function bi(e){let t=[],n,r,i;return Z.Children.forEach(e,(e,a)=>{if(xi(e)){r=e.props;return}if(Si(e)){i=e.props;return}if(Ci(e)){n=e.props;return}(0,Z.isValidElement)(e)?t.push({...e,key:e.key??`${a}`}):t.push(e)}),{bottomPanelSlot:n,contentChildren:t,leftPanelSlot:r,rightPanelSlot:i}}function xi(e){return(0,Z.isValidElement)(e)&&e.type===$r}function Si(e){return(0,Z.isValidElement)(e)&&e.type===ri}function Ci(e){return(0,Z.isValidElement)(e)&&e.type===ui}var wi={Root:(0,Z.memo)(yi),LeftPanel:$r,Content:(0,Z.memo)(_i),Header:(0,Z.memo)(ei),HeaderAction:(0,Z.memo)(ti),HeaderContextMenuItem:(0,Z.memo)(ni),MainContentLayout:(0,Z.memo)(vi),BottomPanel:ui,BottomPanelTabs:(0,Z.memo)(di),BottomPanelTabsEmptyState:(0,Z.memo)(fi),BottomPanelTabListAfter:(0,Z.memo)(pi),BottomPanelTabListAfterSticky:(0,Z.memo)(mi),BottomPanelOutlet:(0,Z.memo)(hi),RightPanel:ri,RightPanelTabs:(0,Z.memo)(ii),RightPanelTabsEmptyState:(0,Z.memo)(ai),RightPanelTabListAfter:(0,Z.memo)(si),RightPanelTabListAfterSticky:(0,Z.memo)(li),RightPanelTabListBefore:(0,Z.memo)(ci),RightPanelOutlet:(0,Z.memo)(oi)};export{Gt as C,Kt as S,On as _,qn as a,An as b,Wn as c,Ln as d,Rn as f,Nn as g,Pn as h,$n as i,Un as l,Fn as m,Dr as n,Gn as o,In as p,cr as r,Kn as s,wi as t,Bn as u,kn as v,En as x,Dn as y}; +import{s as e}from"./chunk-Bj-mKKzh.js";import{$n as t,Wr as n}from"./src-CYrn1fYL.js";import{k as r,pi as i,vt as a}from"./app-server-manager-signals-BOGyjFm3.js";import{n as o,t as s}from"./jsx-runtime-CiQ1k8xo.js";import{t as c}from"./clsx-BcPLHiun.js";import{a as l,d as u,f as d,i as f,n as p,p as m,s as h,t as g,u as _}from"./core.esm-D4TU2vSa.js";import{F as v,I as y,L as b,P as x,W as S,f as C,h as w,lt as T,p as E}from"./vscode-api-sUstfl-x.js";import{c as D,n as O,o as k,r as A}from"./lib-MoKmYgcO.js";import{l as j,p as M}from"./persisted-signal-Cx1QgqJn.js";import{E as ee}from"./codex-api-DRlZt5zW.js";import{n as N}from"./window-zoom-context-CSPQZGcc.js";import{t as P}from"./tooltip-BhXPONlb.js";import{i as F,t as I}from"./route-scope-BCJTBhwV.js";import{t as L}from"./button-Xd4Hy1MO.js";import{r as R}from"./reduced-motion-preference-BEImGcUg.js";import{t as z}from"./spinner-Dvc_A3Ae.js";import{c as B,i as V,s as H,t as U}from"./proxy-DktXrBt_.js";import{G as W,X as G,Z as K,ft as q,pt as J,rt as Y}from"./single-value-BbzxY9gT.js";import{$ as X,A as te,B as ne,C as re,D as ie,E as ae,F as oe,G as se,H as ce,I as le,J as ue,K as de,L as fe,M as pe,N as me,O as he,P as ge,Q as _e,R as ve,U as ye,V as be,W as xe,X as Se,Y as Ce,Z as we,a as Te,at as Ee,b as De,c as Oe,ct as ke,d as Ae,dt as je,et as Me,f as Ne,ft as Pe,i as Fe,it as Ie,l as Le,lt as Re,m as ze,nt as Be,o as Ve,ot as He,p as Ue,q as We,r as Ge,rt as Ke,s as qe,st as Je,t as Ye,tt as Xe,u as Ze,ut as Qe,x as $e,z as et}from"./app-shell-state-B5MFb4Nm.js";import{t as tt}from"./AnimatePresence-DwAfNqj_.js";import{t as nt}from"./use-platform-BkwBnkgx.js";import{n as rt,s as it,t as at}from"./app-shell-tab-controller-B0DXekEJ.js";import{t as ot}from"./browser-sidebar-manager-CDP80WMh.js";import{i as st,r as ct,t as lt}from"./error-boundary-CSKrv358.js";import{t as ut}from"./download-TILfllSA.js";import{t as dt}from"./with-window-DPMmD2K-.js";import{t as ft}from"./use-register-command-UoA_Jn9F.js";import{r as pt}from"./run-command-BkY8dgoH.js";import{r as mt}from"./modal-controller-state-CEBUx8JQ.js";import{a as ht,d as gt,i as _t,l as vt,n as yt,r as bt,u as xt}from"./dialog-layout-CCvvb1Vc.js";import{t as St}from"./use-stable-callback-B56R_Ee2.js";import{t as Ct}from"./context-menu-DRia187f.js";import{t as wt}from"./loading-page-Cq0CTe5D.js";import{i as Tt,n as Et,r as Dt,t as Ot}from"./sortable.esm-gKrsSmfW.js";import{t as kt}from"./get-resize-observer-entry-size-CH0PchA7.js";import{n as At,r as jt}from"./use-resize-observer-CbHbkQNx.js";import{a as Mt}from"./command-keybindings-D3tvaSVG.js";import{n as Nt,t as Pt}from"./expand-CUW1I4XL.js";import{a as Ft,t as It}from"./keyboard-modifier-state-ZeRcF5hb.js";import{t as Lt}from"./use-merged-ref-6q7NGZyX.js";import{t as Rt}from"./arrow-left-2njf4k3d.js";import{t as zt}from"./use-window-controls-safe-area-X2AodDul.js";import{t as Bt}from"./app-shell-bottom-panel-scroll-sync-DpO90Rtb.js";import{a as Vt,r as Ht,t as Ut}from"./image-preview-shortcuts-CaXpgMPF.js";function Wt(...e){let t=!Array.isArray(e[0]),n=t?0:-1,r=e[0+n],i=e[1+n],a=e[2+n],o=e[3+n],s=Y(i,a,o);return t?s(r):s}var Z=e(o(),1);function Gt(e,t,n){(0,Z.useInsertionEffect)(()=>e.on(t,n),[e,t,n])}function Kt(e){let t=B(()=>K(e)),{isStatic:n}=(0,Z.useContext)(V);if(n){let[,n]=(0,Z.useState)(e);(0,Z.useEffect)(()=>t.on(`change`,n),[])}return t}function qt(e,t){let n=Kt(t()),r=()=>n.set(t());return r(),H(()=>{let t=()=>J.preRender(r,!1,!0),n=e.map(e=>e.on(`change`,t));return()=>{n.forEach(e=>e()),q(r)}}),n}function Jt(e,...t){let n=e.length;function r(){let r=``;for(let i=0;ii(e))}function Zt(e,t){let n=B(()=>[]);return qt(e,()=>{n.length=0;let r=e.length;for(let t=0;t(0,Q.jsx)(`svg`,{width:21,height:21,viewBox:`0 0 21 21`,fill:`none`,xmlns:`http://www.w3.org/2000/svg`,...e,children:(0,Q.jsx)(`path`,{fillRule:`evenodd`,clipRule:`evenodd`,d:`M10.7997 2.48486C15.4019 2.48486 19.1335 6.21565 19.1337 10.8179C19.1337 15.4202 15.4021 19.1519 10.7997 19.1519C6.19746 19.1517 2.46667 15.4201 2.46667 10.8179C2.46685 6.21576 6.19757 2.48504 10.7997 2.48486ZM9.00811 7.5181C8.62612 7.13627 8.00684 7.13624 7.62534 7.5181C7.24363 7.89971 7.24366 8.51913 7.62534 8.90088L9.54183 10.8179L7.62534 12.7343C7.24375 13.116 7.24365 13.7354 7.62534 14.1171C8.00709 14.4989 8.62647 14.4989 9.00811 14.1171L10.9251 12.2007L12.8416 14.1171C13.2234 14.4989 13.8427 14.4989 14.2244 14.1171C14.6062 13.7354 14.6062 13.1161 14.2244 12.7343L12.3079 10.8179L14.2244 8.90088L14.3123 8.79221C14.5632 8.41306 14.5212 7.89785 14.2244 7.60088C13.9275 7.30404 13.4123 7.26211 13.0331 7.51303L12.9244 7.60088L11.0079 9.51736L9.09138 7.60088L9.00811 7.5181Z`,fill:`currentColor`})}),$=T(),$t=`color-mix(in srgb, var(--color-token-foreground) 5%, var(--color-token-main-surface-primary))`,en=`min(32rem, var(--radix-tooltip-content-available-width), calc(100vw - 16px))`;function tn(e){let t=(0,$.c)(79),n,r,i,a,o,s,l,u,d,f,p,m,h,g,_,v,y,b;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4],o=t[5],s=t[6],l=t[7],u=t[8],d=t[9],f=t[10],p=t[11],m=t[12],h=t[13],g=t[14],_=t[15],v=t[16],y=t[17],b=t[18]):({activatorRef:n,tooltip:y,highlightedIcon:i,id:o,icon:a,trailingContent:b,title:v,isDragging:f,isActive:p,isClosable:m,isHighlighted:h,isLabel:g,isPreview:_,onActivate:s,onClose:l,onPointerDown:u,style:d,...r}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a,t[5]=o,t[6]=s,t[7]=l,t[8]=u,t[9]=d,t[10]=f,t[11]=p,t[12]=m,t[13]=h,t[14]=g,t[15]=_,t[16]=v,t[17]=y,t[18]=b);let x=f===void 0?!1:f,S=p===void 0?!1:p,C=m===void 0?!1:m,w=h===void 0?!1:h,T=g===void 0?!1:g,E=_===void 0?!1:_,O=D(),[k,A]=(0,Z.useState)(!1),j=!T,M=w&&i!=null,ee=j&&S,N;t[19]===Symbol.for(`react.memo_cache_sentinel`)?(N=(e,t)=>{A(t.scrollWidth>t.clientWidth)},t[19]=N):N=t[19];let F=At(N),I=E&&`italic`,L;t[20]===I?L=t[21]:(L=c(`block w-full min-w-0 whitespace-nowrap`,I),t[20]=I,t[21]=L);let R;t[22]!==L||t[23]!==F||t[24]!==v?(R=(0,Q.jsx)(`span`,{ref:F,className:L,children:v}),t[22]=L,t[23]=F,t[24]=v,t[25]=R):R=t[25];let z=R,B;t[26]===d?B=t[27]:(B={...d,"--app-shell-tab-background":$t},t[26]=d,t[27]=B);let V=B,H;t[28]===u?H=t[29]:(H=e=>{if(e.button!==0||e.ctrlKey){e.stopPropagation();return}u?.(e)},t[28]=u,t[29]=H);let U=j&&`group-hover/tab:bg-[var(--app-shell-tab-background)]`,W=j&&(S||x)&&`bg-[var(--app-shell-tab-background)]`,G;t[30]!==U||t[31]!==W?(G=c(`pointer-events-none absolute inset-0 z-0 rounded-md`,U,W),t[30]=U,t[31]=W,t[32]=G):G=t[32];let K;t[33]===G?K=t[34]:(K=(0,Q.jsx)(`div`,{className:G}),t[33]=G,t[34]=K);let q=S&&`text-token-text-primary`,J=!S&&`text-token-text-secondary`,Y;t[35]!==q||t[36]!==J?(Y=c(`no-drag relative flex flex-1 items-center gap-2 z-10 text-sm min-w-0 `,q,J),t[35]=q,t[36]=J,t[37]=Y):Y=t[37];let X;t[38]!==C||t[39]!==s||t[40]!==l?(X=e=>{if(C&&e.button===1){e.preventDefault(),e.stopPropagation(),l?.();return}s?.()},t[38]=C,t[39]=s,t[40]=l,t[41]=X):X=t[41];let te;t[42]!==i||t[43]!==a||t[44]!==M?(te=(a!=null||M)&&(0,Q.jsxs)(`span`,{"aria-hidden":`true`,className:`icon-xs relative flex shrink-0 items-center justify-center overflow-visible`,children:[a!=null&&(0,Q.jsx)(`span`,{className:c(`flex size-full items-center justify-center`,M&&`opacity-30`),children:a}),M&&(0,Q.jsx)(`span`,{className:`pointer-events-none absolute inset-0 z-10 flex size-full items-center justify-center`,children:i})]}),t[42]=i,t[43]=a,t[44]=M,t[45]=te):te=t[45];let ne;t[46]!==O||t[47]!==C||t[48]!==l||t[49]!==v?(ne=C&&(0,Q.jsx)(`div`,{role:`button`,"aria-label":O.formatMessage({id:`codex.tabs.closeNamed`,defaultMessage:`Close {title} tab`,description:`Accessible label for closing a named tab`},{title:v}),className:`no-drag absolute inset-y-0 start-0 z-30 hidden shrink-0 cursor-interaction items-center bg-(--app-shell-tab-background) text-token-text-tertiary group-hover/tab:flex after:absolute after:-inset-1 after:content-[''] hover:text-token-text-primary`,onClick:l,onMouseDown:nn,children:(0,Q.jsx)(Qt,{className:`icon-xs`})}),t[46]=O,t[47]=C,t[48]=l,t[49]=v,t[50]=ne):ne=t[50];let re;t[51]!==x||t[52]!==z||t[53]!==y?(re=y?(0,Q.jsx)(P,{tooltipContent:y,disabled:x,delayOpen:!0,side:`bottom`,tooltipMaxWidth:en,children:z}):z,t[51]=x,t[52]=z,t[53]=y,t[54]=re):re=t[54];let ie;t[55]!==ee||t[56]!==S||t[57]!==k||t[58]!==j?(ie=k&&(0,Q.jsx)(`span`,{className:c(`pointer-events-none absolute inset-y-0 end-0 z-20 w-8 bg-linear-to-r from-transparent to-60%`,ee?`to-[var(--app-shell-tab-background)]`:`to-token-main-surface-primary`,j&&!S&&`group-hover/tab:to-[var(--app-shell-tab-background)]`)}),t[55]=ee,t[56]=S,t[57]=k,t[58]=j,t[59]=ie):ie=t[59];let ae;t[60]!==re||t[61]!==ie?(ae=(0,Q.jsxs)(`span`,{className:`relative min-w-0 flex-1 overflow-hidden`,children:[re,ie]}),t[60]=re,t[61]=ie,t[62]=ae):ae=t[62];let oe;t[63]!==S||t[64]!==Y||t[65]!==X||t[66]!==te||t[67]!==ne||t[68]!==ae||t[69]!==b?(oe=(0,Q.jsxs)(`button`,{type:`button`,role:`tab`,"aria-selected":S,className:Y,onMouseDown:X,children:[te,ne,ae,b]}),t[63]=S,t[64]=Y,t[65]=X,t[66]=te,t[67]=ne,t[68]=ae,t[69]=b,t[70]=oe):oe=t[70];let se;return t[71]!==n||t[72]!==r||t[73]!==o||t[74]!==V||t[75]!==H||t[76]!==K||t[77]!==oe?(se=(0,Q.jsxs)(`div`,{ref:n,"data-tab-id":o,className:`group/tab relative flex h-7 max-w-39 shrink-0 items-center overflow-hidden rounded-lg bg-token-main-surface-primary px-2 py-1`,style:V,...r,onPointerDown:H,children:[K,oe]}),t[71]=n,t[72]=r,t[73]=o,t[74]=V,t[75]=H,t[76]=K,t[77]=oe,t[78]=se):se=t[78],se}function nn(e){e.preventDefault(),e.stopPropagation()}function rn(e){let t=(0,$.c)(69),{controller:n,isActive:r,separatorIndex:a,showTrailingSeparator:o,tab:s}=e,l=v(I),{tabId:u,title:d,icon:f,isClosable:p,isLabel:h,contextMenuItems:g,highlightedIcon:_,isHighlighted:y,trailingContent:b,isPreview:x,tooltip:S}=s,C;t[0]!==n||t[1]!==u?(C={controller:n,kind:`app-shell-tab`,tabId:u},t[0]=n,t[1]=u,t[2]=C):C=t[2];let w;t[3]!==h||t[4]!==C||t[5]!==s.dndId?(w={data:C,disabled:h,id:s.dndId,strategy:Dt},t[3]=h,t[4]=C,t[5]=s.dndId,t[6]=w):w=t[6];let{attributes:T,isDragging:E,listeners:D,setActivatorNodeRef:k,setNodeRef:A,transform:j,transition:M}=Tt(w),ee;t[7]!==n||t[8]!==p||t[9]!==l||t[10]!==u?(ee=e=>{if(p){let t=l.get(i),r=l.get(n.tabs$),a=r.findIndex(e=>e.tabId===u),o=r.some(e=>e.tabId!==u&&e.isClosable),s=a!==-1&&r.slice(a+1).some(an);if(e.length>0&&e.push({id:`close-tab-separator`,type:`separator`}),e.push({id:`close-tab`,message:O({id:`codex.tabs.contextMenu.close`,defaultMessage:`Close`,description:`Context menu action for closing a tab`}),onSelect:()=>n.closeTab(l,u)}),!t)return e;e.push({enabled:o,id:`close-other-tabs`,message:O({id:`codex.tabs.contextMenu.closeOtherTabs`,defaultMessage:`Close other tabs`,description:`Context menu action for closing all other tabs besides the current tab`}),onSelect:()=>n.closeOtherTabs(l,u)}),e.push({enabled:s,id:`close-tabs-to-the-right`,message:O({id:`codex.tabs.contextMenu.closeTabsToTheRight`,defaultMessage:`Close tabs to the right`,description:`Context menu action for closing the tabs to the right of the current tab`}),onSelect:()=>n.closeTabsToRight(l,u)})}return e},t[7]=n,t[8]=p,t[9]=l,t[10]=u,t[11]=ee):ee=t[11];let N=ee,P;t[12]!==N||t[13]!==g||t[14]!==l?(P=()=>{let e=typeof g==`function`?g(l):g??[];return Array.isArray(e)?N([...e]):e.then(e=>N([...e]))},t[12]=N,t[13]=g,t[14]=l,t[15]=P):P=t[15];let F=P,L=n.panelId,R=E&&`z-10 cursor-grab opacity-0`,z;t[16]===R?z=t[17]:(z=c(`my-auto flex shrink-0 relative max-w-40 pe-1 items-center contain-content gap-0.5`,R),t[16]=R,t[17]=z);let B;t[18]===j?B=t[19]:(B=m.Translate.toString(j),t[18]=j,t[19]=B);let V;t[20]!==B||t[21]!==M?(V={transform:B,transition:M},t[20]=B,t[21]=M,t[22]=V):V=t[22];let H,W;t[23]!==n||t[24]!==l||t[25]!==u?(H=()=>n.activateTab(l,u),W=()=>n.closeTab(l,u),t[23]=n,t[24]=l,t[25]=u,t[26]=H,t[27]=W):(H=t[26],W=t[27]);let G;t[28]!==n||t[29]!==x||t[30]!==l||t[31]!==u?(G=()=>{x&&n.pinTab(l,u)},t[28]=n,t[29]=x,t[30]=l,t[31]=u,t[32]=G):G=t[32];let K;t[33]!==T||t[34]!==_||t[35]!==f||t[36]!==r||t[37]!==p||t[38]!==E||t[39]!==y||t[40]!==h||t[41]!==x||t[42]!==D||t[43]!==k||t[44]!==H||t[45]!==W||t[46]!==G||t[47]!==u||t[48]!==d||t[49]!==S||t[50]!==b?(K=(0,Q.jsx)(tn,{activatorRef:k,id:u,highlightedIcon:_,icon:f,isActive:r,isClosable:p,isDragging:E,isHighlighted:y,isLabel:h,isPreview:x,onActivate:H,onClose:W,trailingContent:b,title:d,tooltip:S,...D,...T,onDoubleClick:G}),t[33]=T,t[34]=_,t[35]=f,t[36]=r,t[37]=p,t[38]=E,t[39]=y,t[40]=h,t[41]=x,t[42]=D,t[43]=k,t[44]=H,t[45]=W,t[46]=G,t[47]=u,t[48]=d,t[49]=S,t[50]=b,t[51]=K):K=t[51];let q;t[52]!==F||t[53]!==K?(q=(0,Q.jsx)(Ct,{getItems:F,children:K}),t[52]=F,t[53]=K,t[54]=q):q=t[54];let J=o?`opacity-100`:`opacity-0`,Y;t[55]===J?Y=t[56]:(Y=c(`h-3 w-px shrink-0 end-0 absolute bg-token-border transition-opacity duration-200`,J),t[55]=J,t[56]=Y);let X;t[57]!==a||t[58]!==Y||t[59]!==u?(X=(0,Q.jsx)(`div`,{"aria-hidden":!0,"data-app-shell-tab-separator":u,"data-app-shell-tab-separator-index":a,className:Y}),t[57]=a,t[58]=Y,t[59]=u,t[60]=X):X=t[60];let te;return t[61]!==n.panelId||t[62]!==A||t[63]!==q||t[64]!==X||t[65]!==z||t[66]!==V||t[67]!==u?(te=(0,Q.jsxs)(U.div,{"data-app-shell-tab-controller":L,"data-tab-id":u,ref:A,className:z,style:V,children:[q,X]}),t[61]=n.panelId,t[62]=A,t[63]=q,t[64]=X,t[65]=z,t[66]=V,t[67]=u,t[68]=te):te=t[68],te}function an(e){return e.isClosable}var on=(0,Z.createContext)(null);function sn(e,t){let n=e.get(t.sourceController.tabIds$),r=n.indexOf(t.tabId);r===-1||r===t.sourceIndex||e.set(t.sourceController.tabIds$,Et(n,r,t.sourceIndex))}function cn(e,t,n,r){let i=e.get(t.tabIds$),a=i.indexOf(n),o=i.indexOf(r);a===-1||o===-1||a===o||e.set(t.tabIds$,Et(i,a,o))}function ln(e,t,n){return e.previewController===t&&e.overTabId===n?e:{...e,overTabId:n,previewController:t}}function un(e,t,n){if(n==null||n.previewController===n.sourceController)return e;if(t===n.sourceController)return e.filter(e=>e.tabId!==n.draggedTab.tabId);if(t!==n.previewController)return e;let r=n.overTabId==null?-1:e.findIndex(e=>e.tabId===n.overTabId),i=[...e];return i.splice(r===-1?i.length:r,0,n.draggedTab),i}var dn=`data-tab-preview-pin-exempt`;function fn(e){let t=(0,$.c)(20),{afterList:n,afterListSticky:r,beforeList:i,emptyState:a,headerHeight:o,controller:s}=e,c=y(s.tabs$),l=y(s.activeTab$),u=y(s.activeTabReactKey$),d=(0,Z.useContext)(on)?.dragState??null,f;t[0]!==s||t[1]!==d||t[2]!==c?(f=un(c,s,d),t[0]=s,t[1]=d,t[2]=c,t[3]=f):f=t[3];let p=f,m=l?.tabId??null,h;t[4]!==n||t[5]!==r||t[6]!==i||t[7]!==s||t[8]!==o||t[9]!==p||t[10]!==m?(h=(0,Q.jsx)(pn,{height:o,activeTabId:m,after:n,afterSticky:r,before:i,controller:s,tabs:p}),t[4]=n,t[5]=r,t[6]=i,t[7]=s,t[8]=o,t[9]=p,t[10]=m,t[11]=h):h=t[11];let g;t[12]!==l||t[13]!==u||t[14]!==s||t[15]!==a?(g=l==null?(0,Q.jsx)(`div`,{className:`relative min-h-0 flex-1`,children:a}):(0,Q.jsx)(vn,{controller:s,tab:l},u),t[12]=l,t[13]=u,t[14]=s,t[15]=a,t[16]=g):g=t[16];let _;return t[17]!==h||t[18]!==g?(_=(0,Q.jsxs)(`div`,{className:`isolate flex h-full min-h-0 flex-col bg-token-main-surface-primary [contain:layout_paint]`,children:[h,g]}),t[17]=h,t[18]=g,t[19]=_):_=t[19],_}function pn(e){let t=(0,$.c)(94),{activeTabId:n,after:r,afterSticky:i,before:a,controller:o,height:s,tabs:l}=e,[u,d]=(0,Z.useState)(!1),[f,p]=(0,Z.useState)(!1),[m,h]=jt(),[g,v]=(0,Z.useState)(null),y=`app-shell-tab-strip:${o.panelId}`,b;t[0]===o?b=t[1]:(b={controller:o,kind:`app-shell-tab-strip`},t[0]=o,t[1]=b);let x;t[2]!==y||t[3]!==b?(x={id:y,data:b},t[2]=y,t[3]=b,t[4]=x):x=t[4];let{setNodeRef:S}=_(x),C=(0,Z.useContext)(on)?.dragState??null,w,T,E,D,O,k,A,j,M,ee,N,P,F,I,L,R,z;if(t[5]!==n||t[6]!==h||t[7]!==a||t[8]!==o||t[9]!==C||t[10]!==s||t[11]!==u||t[12]!==g||t[13]!==S||t[14]!==l){let e=l.map(hn),r;t[32]===l?r=t[33]:(r=l.map(mn),t[32]=l,t[33]=r);let i=r;T=h==null||h===0?`0px`:`0px -${h}px 0px 0px`,E=C!=null;let f=n==null?-1:e.indexOf(n),p=s===`toolbar`&&`h-toolbar`,m=s===`pane`&&`h-toolbar-pane`;t[34]!==p||t[35]!==m?(ee=c(p,m,`isolate flex min-w-0 shrink-0 select-none items-center bg-token-main-surface-primary px-2 [contain:layout_paint]`),t[34]=p,t[35]=m,t[36]=ee):ee=t[36],t[37]===a?N=t[38]:(N=a!=null&&(0,Q.jsx)(`div`,{className:`my-auto flex shrink-0 items-center`,role:`presentation`,children:a}),t[37]=a,t[38]=N),t[39]===S?D=t[40]:(D=e=>{v(e),S(e)},t[39]=S,t[40]=D),O=o.panelId,k=`hide-scrollbar relative isolate flex h-full min-w-0 flex-1 scroll-px-1 items-center overflow-x-auto overflow-y-hidden [contain:layout_paint]`;let _=`${h??0}px`;t[41]===_?A=t[42]:(A={scrollPaddingInlineEnd:_},t[41]=_,t[42]=A);let y=u?`opacity-0`:`opacity-100`,b;t[43]===y?b=t[44]:(b=c(`sticky start-0 z-10 h-full w-0 after:absolute transition-opacity after:pointer-events-none duration-100 after:start-0 after:top-0 after:bottom-0 after:w-10 after:bg-linear-to-l after:from-transparent after:to-token-main-surface-primary after:content-['']`,y),t[43]=y,t[44]=b),t[45]===b?j=t[46]:(j=(0,Q.jsx)(`div`,{"aria-hidden":!0,className:b}),t[45]=b,t[46]=j),t[47]===g?M=t[48]:(M=(0,Q.jsx)(gn,{onVisibleChange:d,root:g}),t[47]=g,t[48]=M),w=Ot,R=i,z=Dt,P=`tablist`;let x=E?`z-20`:`z-0`;t[49]===x?F=t[50]:(F=c(`relative flex`,x),t[49]=x,t[50]=F),t[51]===Symbol.for(`react.memo_cache_sentinel`)?(I={gap:3},t[51]=I):I=t[51],L=l.map(t=>{let r=n===t.tabId,i=e.indexOf(t.tabId);return(0,Q.jsx)(rn,{controller:o,isActive:r,separatorIndex:i,showTrailingSeparator:i{n(e)},t[0]=n,t[1]=a);let o=St(a),s;t[2]!==o||t[3]!==r||t[4]!==i?(s=e=>{if(!e)return;let t=new IntersectionObserver(e=>{for(let t of e)o(t.isIntersecting)},{root:r,rootMargin:i});return t.observe(e),()=>{t.disconnect()}},t[2]=o,t[3]=r,t[4]=i,t[5]=s):s=t[5];let c;return t[6]!==i||t[7]!==s?(c=(0,Q.jsx)(`span`,{"aria-hidden":!0,ref:s},i),t[6]=i,t[7]=s,t[8]=c):c=t[8],c}function _n(e,t){return t!==-1&&(e===t||e===t-1)}var vn=(0,Z.memo)(function(e){let t=(0,$.c)(22),{controller:n,tab:r}=e,i=v(I),a;t[0]!==n||t[1]!==i||t[2]!==r.isPreview||t[3]!==r.tabId?(a=e=>{bn(e.nativeEvent)||r.isPreview&&n.pinTab(i,r.tabId)},t[0]=n,t[1]=i,t[2]=r.isPreview,t[3]=r.tabId,t[4]=a):a=t[4];let o=a,s=r.title,c=n.panelId,l=r.tabId,u=r.tabId,d;if(t[5]!==n||t[6]!==i||t[7]!==r){let e;t[9]!==n||t[10]!==i||t[11]!==r.tabId?(e=()=>{n.closeTab(i,r.tabId)},t[9]=n,t[10]=i,t[11]=r.tabId,t[12]=e):e=t[12],d=r.renderPanel(e),t[5]=n,t[6]=i,t[7]=r,t[8]=d}else d=t[8];let f;t[13]!==d||t[14]!==r.tabId?(f=(0,Q.jsx)(lt,{name:`AppShellTabPanel`,resetKey:u,fallback:xn,children:d}),t[13]=d,t[14]=r.tabId,t[15]=f):f=t[15];let p;return t[16]!==n.panelId||t[17]!==o||t[18]!==f||t[19]!==r.tabId||t[20]!==r.title?(p=(0,Q.jsx)(`div`,{role:`tabpanel`,"aria-label":s,"data-app-shell-tab-panel-controller":c,"data-tab-id":l,tabIndex:-1,onKeyDownCapture:o,onPointerDownCapture:o,className:`relative min-h-0 flex-1 outline-none`,children:f}),t[16]=n.panelId,t[17]=o,t[18]=f,t[19]=r.tabId,t[20]=r.title,t[21]=p):p=t[21],p});function yn(e){let t=(0,$.c)(4),{onRetry:n}=e,r;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,Q.jsx)(`div`,{className:`font-medium text-token-text-primary`,children:(0,Q.jsx)(k,{id:`appShell.tabPanelRenderError.title`,defaultMessage:`Tab content couldn't render`,description:`Error message shown when an app shell tab panel fails to render`})}),t[0]=r):r=t[0];let i;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,Q.jsx)(k,{id:`appShell.tabPanelRenderError.retry`,defaultMessage:`Try again`,description:`Button label to retry rendering an app shell tab panel`}),t[1]=i):i=t[1];let a;return t[2]===n?a=t[3]:(a=(0,Q.jsxs)(`div`,{className:`flex h-full min-h-0 flex-col items-center justify-center gap-3 p-4 text-center text-sm text-token-text-secondary`,children:[r,(0,Q.jsx)(L,{color:`secondary`,size:`default`,onClick:n,children:i})]}),t[2]=n,t[3]=a),a}function bn(e){return e.composedPath().some(e=>e instanceof Element&&e.hasAttribute(dn))}function xn(e){return(0,Q.jsx)(yn,{onRetry:()=>{e.resetError()}})}function Sn(){let e=(0,$.c)(4),t=y(ge),n=y(oe),r=y(le),i;return e[0]!==t||e[1]!==n||e[2]!==r?(i=(0,Q.jsx)(fn,{headerHeight:`pane`,afterList:t,afterListSticky:n,emptyState:r,controller:at}),e[0]=t,e[1]=n,e[2]=r,e[3]=i):i=e[3],i}function Cn(){let e=(0,$.c)(17),t=v(I),n=D(),r=y(xe),i=x(Mt,`toggleMaximizeSidePanel`),a;e[0]!==n||e[1]!==r?(a=r?n.formatMessage({id:`codex.rightPanel.restoreWidth`,defaultMessage:`Restore panel width`,description:`Accessible label for restoring the right panel from full width`}):n.formatMessage({id:`codex.rightPanel.expandFullWidth`,defaultMessage:`Expand panel`,description:`Accessible label for expanding the right panel to full width`}),e[0]=n,e[1]=r,e[2]=a):a=e[2];let o=a,s;e[3]!==r||e[4]!==t?(s=()=>{t.set(xe,!r)},e[3]=r,e[4]=t,e[5]=s):s=e[5],ft(`toggleMaximizeSidePanel`,s);let c=r?`secondary`:`ghost`,l;e[6]===r?l=e[7]:(l=r?(0,Q.jsx)(Nt,{className:`icon-xs`}):(0,Q.jsx)(Pt,{className:`icon-xs`}),e[6]=r,e[7]=l);let u;e[8]!==r||e[9]!==o||e[10]!==c||e[11]!==l?(u=(0,Q.jsx)(L,{"aria-label":o,"aria-pressed":r,color:c,size:`toolbar`,uniform:!0,onClick:wn,children:l}),e[8]=r,e[9]=o,e[10]=c,e[11]=l,e[12]=u):u=e[12];let d;return e[13]!==o||e[14]!==i||e[15]!==u?(d=(0,Q.jsx)(P,{tooltipContent:o,shortcut:i,delayOpen:!0,children:u}),e[13]=o,e[14]=i,e[15]=u,e[16]=d):d=e[16],d}function wn(){return pt(`toggleMaximizeSidePanel`,`side_panel_full_width_button`)}function Tn(){let e=y(ue),t=y(Ce),n=y(Se),r=y(we),i=y(xe),a=y(Ze),{headerLeftWidth:o,headerRightWidth:s}=Je(),c=Jt`max(0px, calc(${s}px)`;return(0,Q.jsx)(fn,{headerHeight:`toolbar`,beforeList:(0,Q.jsxs)(Q.Fragment,{children:[i&&!a&&(0,Q.jsx)(U.div,{"aria-hidden":!0,className:`pointer-events-none h-full shrink-0`,style:{width:o}}),n]}),afterListSticky:t,emptyState:r,afterList:(0,Q.jsxs)(Q.Fragment,{children:[e,(0,Q.jsx)(Cn,{}),(0,Q.jsx)(U.div,{"aria-hidden":!0,"data-testid":`right-panel-tab-bar-header-spacer`,className:`pointer-events-none flex h-full shrink-0 items-center`,style:{width:c}})]}),controller:rt})}function En(e){let t=(0,$.c)(4),{keyboardEventTarget:n}=e,r=v(w),i,a;return t[0]!==n||t[1]!==r?(i=()=>{let e=n??(typeof window>`u`?null:window);if(e==null)return;let t=e=>{Ft(r,e)},i=()=>{It(r)};return e.addEventListener(`keydown`,t,!0),e.addEventListener(`keyup`,t,!0),e.addEventListener(`blur`,i),()=>{e.removeEventListener(`keydown`,t,!0),e.removeEventListener(`keyup`,t,!0),e.removeEventListener(`blur`,i),It(r)}},a=[n,r],t[0]=n,t[1]=r,t[2]=i,t[3]=a):(i=t[2],a=t[3]),(0,Z.useEffect)(i,a),null}var Dn=S(w,!1),On=S(w,null),kn=S(w,null),An=S(w,null);function jn(e){let t=(0,$.c)(21),{onClose:n}=e,r;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,Q.jsx)(k,{id:`appHeader.installUpdate.confirmTitle`,defaultMessage:`Update Codex now?`,description:`Title for the confirmation dialog shown before installing an app update while a local session is active`}),t[0]=r):r=t[0];let i=r,a;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,Q.jsx)(k,{id:`appHeader.installUpdate.confirmSubtitle`,defaultMessage:`Codex will quit to install the update, which will interrupt active local sessions on this machine`,description:`Subtitle for the confirmation dialog shown before installing an app update while a local session is active`}),t[1]=a):a=t[1];let o=a,s;t[2]===n?s=t[3]:(s=e=>{e||n()},t[2]=n,t[3]=s);let c;t[4]===n?c=t[5]:(c=e=>{e.preventDefault(),n(),C.dispatchMessage(`install-app-update`,{})},t[4]=n,t[5]=c);let l,u;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,Q.jsx)(gt,{className:`sr-only`,children:i}),u=(0,Q.jsx)(xt,{className:`sr-only`,children:o}),t[6]=l,t[7]=u):(l=t[6],u=t[7]);let d;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,Q.jsx)(ht,{children:(0,Q.jsx)(_t,{title:i,subtitle:o})}),t[8]=d):d=t[8];let f;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(f=(0,Q.jsx)(k,{id:`appHeader.installUpdate.confirmCancel`,defaultMessage:`Cancel`,description:`Cancel button for the update confirmation dialog`}),t[9]=f):f=t[9];let p;t[10]===n?p=t[11]:(p=(0,Q.jsx)(L,{color:`secondary`,onClick:n,children:f}),t[10]=n,t[11]=p);let m;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(m=(0,Q.jsx)(L,{type:`submit`,children:(0,Q.jsx)(k,{id:`appHeader.installUpdate.confirmInstall`,defaultMessage:`Update`,description:`Confirm button for the update confirmation dialog`})}),t[12]=m):m=t[12];let h;t[13]===p?h=t[14]:(h=(0,Q.jsx)(ht,{children:(0,Q.jsxs)(bt,{children:[p,m]})}),t[13]=p,t[14]=h);let g;t[15]!==h||t[16]!==c?(g=(0,Q.jsxs)(yt,{as:`form`,onSubmit:c,children:[l,u,d,h]}),t[15]=h,t[16]=c,t[17]=g):g=t[17];let _;return t[18]!==g||t[19]!==s?(_=(0,Q.jsx)(vt,{open:!0,onOpenChange:s,showDialogClose:!1,size:`compact`,children:g}),t[18]=g,t[19]=s,t[20]=_):_=t[20],_}function Mn(e,t){return e===`windows`&&t}function Nn(){let e=(0,$.c)(4),t=v(w),{platform:n}=nt(),i=y(r),a;return e[0]!==i||e[1]!==n||e[2]!==t?(a=()=>{if(Mn(n,i)){mt(t,jn);return}C.dispatchMessage(`install-app-update`,{})},e[0]=i,e[1]=n,e[2]=t,e[3]=a):a=e[3],St(a)}function Pn(e){let t=(0,$.c)(26),n;t[0]===e?n=t[1]:(n=e===void 0?{}:e,t[0]=e,t[1]=n);let{appUpdateLifecycleState:r}=n,i=D(),a=y(ct),o=Nn(),s=y(On),c=r??a;if(!st(c))return null;let l=c!==`ready`,u;t[2]===s?u=t[3]:(u=s==null?null:Math.min(100,Math.max(0,Math.round(s))),t[2]=s,t[3]=u);let d=u,f;bb0:switch(c){case`ready`:{let e;t[4]===i?e=t[5]:(e=i.formatMessage({id:`appHeader.installUpdate`,defaultMessage:`Update`,description:`Button label in the desktop app header that installs a downloaded app update`}),t[4]=i,t[5]=e),f=e;break bb0}case`installing`:{let e;t[6]===i?e=t[7]:(e=i.formatMessage({id:`appHeader.installingUpdate`,defaultMessage:`Installing`,description:`Button label in the desktop app header while an app update is installing`}),t[6]=i,t[7]=e),f=e;break bb0}case`downloading`:{let e;t[8]!==d||t[9]!==i?(e=d==null?i.formatMessage({id:`appHeader.downloadingUpdate`,defaultMessage:`Downloading`,description:`Button label in the desktop app header while an app update is downloading`}):i.formatMessage({id:`appHeader.downloadingUpdatePercent`,defaultMessage:`Downloading {downloadProgressPercent}%`,description:`Button label in the desktop app header while an app update is downloading with progress`},{downloadProgressPercent:d}),t[8]=d,t[9]=i,t[10]=e):e=t[10],f=e}}let p;t[11]!==f||t[12]!==c||t[13]!==d||t[14]!==i?(p=c===`downloading`&&d!=null?i.formatNumber(d/100,{style:`percent`}):f,t[11]=f,t[12]=c,t[13]=d,t[14]=i,t[15]=p):p=t[15];let m=p,h;t[16]===l?h=t[17]:(h=l?(0,Q.jsx)(z,{className:`ease-basic absolute left-1/2 h-3 w-3 shrink-0 -translate-x-1/2 transition-opacity duration-relaxed [will-change:opacity] motion-reduce:transition-none @[180px]:opacity-0`}):(0,Q.jsx)(ut,{className:`ease-basic absolute left-1/2 h-3 w-3 shrink-0 -translate-x-1/2 transition-opacity duration-relaxed [will-change:opacity] motion-reduce:transition-none @[180px]:opacity-0`}),t[16]=l,t[17]=h);let g;t[18]===m?g=t[19]:(g=(0,Q.jsx)(`span`,{className:`ease-basic min-w-0 truncate tabular-nums opacity-0 transition-opacity duration-relaxed [will-change:opacity] motion-reduce:transition-none @[180px]:opacity-100`,children:m}),t[18]=m,t[19]=g);let _;return t[20]!==f||t[21]!==o||t[22]!==l||t[23]!==h||t[24]!==g?(_=(0,Q.jsxs)(`button`,{"aria-label":f,className:`no-drag ease-basic relative flex h-5 max-w-5 min-w-5 shrink-0 cursor-interaction items-center justify-center overflow-hidden rounded-full bg-token-charts-blue px-2.5 text-xs leading-none font-semibold text-white shadow-sm transition-[max-width,background-color] duration-relaxed [will-change:max-width] contain-layout contain-paint contain-style hover:bg-token-charts-blue/90 active:bg-token-charts-blue/80 motion-reduce:transition-none @[180px]:max-w-36 @[180px]:min-w-10`,disabled:l,onClick:o,title:f,children:[h,g]}),t[20]=f,t[21]=o,t[22]=l,t[23]=h,t[24]=g,t[25]=_):_=t[25],_}var Fn={x:null,y:null,hasKnownVelocity:!1,updatedAt:null,velocityX:0,velocityY:0,speed:0};function In(e,t,n,r){if(e.x==null||e.y==null||e.updatedAt==null)return{x:t,y:n,hasKnownVelocity:!1,updatedAt:r,velocityX:0,velocityY:0,speed:0};let i=(r-e.updatedAt)/1e3;if(i<=0)return{x:t,y:n,hasKnownVelocity:!1,updatedAt:r,velocityX:0,velocityY:0,speed:0};let a=(t-e.x)/i,o=(n-e.y)/i;return{x:t,y:n,hasKnownVelocity:!0,updatedAt:r,velocityX:a,velocityY:o,speed:Math.hypot(a,o)}}var Ln=S(w,Fn),Rn=S(w,{width:window.innerWidth,height:window.innerHeight}),zn={px$:b(w,({get:e})=>e(Ln).x),py$:b(w,({get:e})=>e(Ln).y),hasKnownVelocity$:b(w,({get:e})=>e(Ln).hasKnownVelocity),vx$:b(w,({get:e})=>e(Ln).velocityX),vy$:b(w,({get:e})=>e(Ln).velocityY),speed$:b(w,({get:e})=>e(Ln).speed),bottomInset$:b(w,({get:e})=>{let{height:t}=e(Rn),n=e(Ln).y;return n==null?null:t-n}),rightInset$:b(w,({get:e})=>{let{width:t}=e(Rn),n=e(Ln).x;return n==null?null:t-n})};function Bn(e){let t=(0,$.c)(45),{disabled:n,edge:r,defaultSize:i,getCurrentSize:a,onResizeEnd:o,onResizingChange:s,setSize:c}=e,l=n===void 0?!1:n,u=r===void 0?`right`:r,d=N(),[f,p]=(0,Z.useState)(!1),m=(0,Z.useRef)(null),h=u===`left`||u===`right`,g;t[0]===s?g=t[1]:(g=()=>{m.current=null,p(!1),s?.(!1)},t[0]=s,t[1]=g);let _=(0,Z.useEffectEvent)(g),v;t[2]!==l||t[3]!==_?(v=()=>{!l||m.current==null||_()},t[2]=l,t[3]=_,t[4]=v):v=t[4];let y=(0,Z.useEffectEvent)(v),b;t[5]===d?b=t[6]:(b=e=>({x:e.clientX/d,y:e.clientY/d}),t[5]=d,t[6]=b);let x=b,S;t[7]===h?S=t[8]:(S=e=>h?e.x:e.y,t[7]=h,t[8]=S);let C=S,w;t[9]!==l||t[10]!==u||t[11]!==h||t[12]!==f||t[13]!==o||t[14]!==c||t[15]!==_||t[16]!==y||t[17]!==d?(w=()=>{if(!f||l)return;let e=e=>({x:e.clientX/d,y:e.clientY/d}),t=t=>{t.preventDefault();let n=m.current;if(n==null)return;let r=e(t);(h?r.x:r.y)!==n.startPosition&&(n.didMove=!0),c(Vn(u,r,n))},n=t=>{t.preventDefault();let n=m.current;if(n?.didMove===!0){let r=Vn(u,e(t),n);c(r),o?.(r)}_()};return window.addEventListener(`pointermove`,t),window.addEventListener(`pointerup`,n),window.addEventListener(`pointercancel`,n),()=>{window.removeEventListener(`pointermove`,t),window.removeEventListener(`pointerup`,n),window.removeEventListener(`pointercancel`,n),y()}},t[9]=l,t[10]=u,t[11]=h,t[12]=f,t[13]=o,t[14]=c,t[15]=_,t[16]=y,t[17]=d,t[18]=w):w=t[18];let T;t[19]!==l||t[20]!==u||t[21]!==h||t[22]!==f||t[23]!==o||t[24]!==c||t[25]!==d?(T=[l,u,h,f,o,c,d],t[19]=l,t[20]=u,t[21]=h,t[22]=f,t[23]=o,t[24]=c,t[25]=d,t[26]=T):T=t[26],(0,Z.useEffect)(w,T);let E;t[27]!==l||t[28]!==a||t[29]!==C||t[30]!==x||t[31]!==s?(E=e=>{l||e.button===0&&(e.preventDefault(),e.currentTarget.setPointerCapture?.(e.pointerId),m.current={didMove:!1,startPosition:C(x(e)),startSize:a()},p(!0),s?.(!0))},t[27]=l,t[28]=a,t[29]=C,t[30]=x,t[31]=s,t[32]=E):E=t[32];let D=E,O;t[33]!==i||t[34]!==l||t[35]!==o||t[36]!==s||t[37]!==c?(O=e=>{l||e.detail===2&&(e.preventDefault(),m.current=null,p(!1),s?.(!1),c(i),o?.(i))},t[33]=i,t[34]=l,t[35]=o,t[36]=s,t[37]=c,t[38]=O):O=t[38];let k=O,A;return t[39]!==l||t[40]!==u||t[41]!==k||t[42]!==D||t[43]!==f?(A=(0,Q.jsx)(Hn,{disabled:l,edge:u,isResizing:f,onClick:k,onPointerDown:D}),t[39]=l,t[40]=u,t[41]=k,t[42]=D,t[43]=f,t[44]=A):A=t[44],A}function Vn(e,t,n){let r=(e===`left`||e===`right`?t.x:t.y)-n.startPosition;switch(e){case`bottom`:case`right`:return n.startSize+r;case`left`:case`top`:return n.startSize-r}}function Hn(e){let t=(0,$.c)(20),{disabled:n,edge:r,isResizing:i,onClick:a,onPointerDown:o}=e,s=n||void 0,l=r===`left`||r===`right`?`vertical`:`horizontal`,u=n&&`pointer-events-none`,d=r===`left`?`z-40`:`z-20`,f=r===`right`&&`-top-toolbar right-0 bottom-0 w-4 translate-x-2`,p=r===`left`&&`top-0 bottom-0 left-0 w-4 -translate-x-2`,m=r===`top`&&`top-0 right-0 left-0 h-4 -translate-y-2`,h=r===`bottom`&&`right-0 bottom-0 left-0 h-4 translate-y-2`,g=!n&&(r===`left`||r===`right`?`cursor-col-resize active:cursor-col-resize`:`cursor-row-resize active:cursor-row-resize`),_;t[0]!==u||t[1]!==d||t[2]!==f||t[3]!==p||t[4]!==m||t[5]!==h||t[6]!==g?(_=c(`group absolute flex touch-none select-none`,u,d,f,p,m,h,g),t[0]=u,t[1]=d,t[2]=f,t[3]=p,t[4]=m,t[5]=h,t[6]=g,t[7]=_):_=t[7];let v=r===`left`||r===`right`?`h-full w-px bg-gradient-to-b from-transparent via-token-foreground/25 to-transparent`:`h-px w-full bg-gradient-to-r from-transparent via-token-foreground/25 to-transparent`,y=i?`opacity-100`:`group-hover:opacity-100 group-active:opacity-100`,b;t[8]!==v||t[9]!==y?(b=c(`sidebar-resize-handle-line pointer-events-none m-auto opacity-0`,v,y),t[8]=v,t[9]=y,t[10]=b):b=t[10];let x;t[11]===b?x=t[12]:(x=(0,Q.jsx)(`div`,{className:b}),t[11]=b,t[12]=x);let S;return t[13]!==a||t[14]!==o||t[15]!==s||t[16]!==_||t[17]!==x||t[18]!==l?(S=(0,Q.jsx)(`div`,{role:`separator`,"aria-disabled":s,"aria-orientation":l,className:_,onClick:a,onPointerDown:o,children:x}),t[13]=a,t[14]=o,t[15]=s,t[16]=_,t[17]=x,t[18]=l,t[19]=S):S=t[19],S}var Un=e=>(0,Q.jsx)(`svg`,{width:20,height:20,viewBox:`0 0 20 20`,fill:`none`,xmlns:`http://www.w3.org/2000/svg`,...e,children:(0,Q.jsx)(`path`,{d:`M16.835 8.66301C16.835 7.71885 16.8347 7.05065 16.792 6.52824C16.7605 6.14232 16.7073 5.86904 16.6299 5.65227L16.5439 5.45207C16.32 5.01264 15.9796 4.64498 15.5615 4.3886L15.3779 4.28606C15.1308 4.16013 14.8165 4.08006 14.3018 4.03801C13.7794 3.99533 13.1112 3.99504 12.167 3.99504H7.83301C6.88885 3.99504 6.22065 3.99533 5.69824 4.03801C5.31232 4.06954 5.03904 4.12266 4.82227 4.20012L4.62207 4.28606C4.18264 4.50996 3.81498 4.85035 3.55859 5.26848L3.45605 5.45207C3.33013 5.69922 3.25006 6.01354 3.20801 6.52824C3.16533 7.05065 3.16504 7.71885 3.16504 8.66301V11.3271C3.16504 12.2712 3.16533 12.9394 3.20801 13.4618C3.25006 13.9766 3.33013 14.2909 3.45605 14.538L3.55859 14.7216C3.81498 15.1397 4.18266 15.4801 4.62207 15.704L4.82227 15.79C5.03904 15.8674 5.31234 15.9205 5.69824 15.9521C6.22065 15.9947 6.88885 15.995 7.83301 15.995H12.167C13.1112 15.995 13.7794 15.9947 14.3018 15.9521C14.8164 15.91 15.1308 15.8299 15.3779 15.704L15.5615 15.6015C15.9797 15.3451 16.32 14.9774 16.5439 14.538L16.6299 14.3378C16.7074 14.121 16.7605 13.8478 16.792 13.4618C16.8347 12.9394 16.835 12.2712 16.835 11.3271V8.66301ZM5.00195 13.3329V6.66692C5.00195 6.29965 5.29972 6.00188 5.66699 6.00188C6.03412 6.00204 6.33203 6.29975 6.33203 6.66692V13.3329C6.33203 13.7001 6.03412 13.9978 5.66699 13.998C5.29972 13.998 5.00195 13.7002 5.00195 13.3329ZM18.165 11.3271C18.165 12.2493 18.1653 12.9811 18.1172 13.5702C18.0745 14.0924 17.9916 14.5472 17.8125 14.9648L17.7295 15.1415C17.394 15.8 16.8834 16.3511 16.2568 16.7353L15.9814 16.8896C15.5157 17.1268 15.0069 17.2285 14.4102 17.2773C13.821 17.3254 13.0893 17.3251 12.167 17.3251H7.83301C6.91071 17.3251 6.17898 17.3254 5.58984 17.2773C5.06757 17.2346 4.61294 17.1508 4.19531 16.9716L4.01855 16.8896C3.36014 16.5541 2.80898 16.0434 2.4248 15.4169L2.27051 15.1415C2.03328 14.6758 1.93158 14.167 1.88281 13.5702C1.83468 12.9811 1.83496 12.2493 1.83496 11.3271V8.66301C1.83496 7.74072 1.83468 7.00898 1.88281 6.41985C1.93157 5.82309 2.03329 5.31432 2.27051 4.84856L2.4248 4.57317C2.80898 3.94666 3.36012 3.436 4.01855 3.10051L4.19531 3.0175C4.61285 2.83843 5.06771 2.75548 5.58984 2.71281C6.17898 2.66468 6.91071 2.66496 7.83301 2.66496H12.167C13.0893 2.66496 13.821 2.66468 14.4102 2.71281C15.0069 2.76157 15.5157 2.86329 15.9814 3.10051L16.2568 3.25481C16.8833 3.63898 17.394 4.19012 17.7295 4.84856L17.8125 5.02531C17.9916 5.44285 18.0745 5.89771 18.1172 6.41985C18.1653 7.00898 18.165 7.74072 18.165 8.66301V11.3271Z`,fill:`currentColor`})}),Wn=e=>(0,Q.jsx)(`svg`,{width:20,height:20,viewBox:`0 0 20 20`,fill:`none`,xmlns:`http://www.w3.org/2000/svg`,...e,children:(0,Q.jsx)(`path`,{d:`M6.83496 3.99992C6.38353 4.00411 6.01421 4.0122 5.69824 4.03801C5.31232 4.06954 5.03904 4.12266 4.82227 4.20012L4.62207 4.28606C4.18264 4.50996 3.81498 4.85035 3.55859 5.26848L3.45605 5.45207C3.33013 5.69922 3.25006 6.01354 3.20801 6.52824C3.16533 7.05065 3.16504 7.71885 3.16504 8.66301V11.3271C3.16504 12.2712 3.16533 12.9394 3.20801 13.4618C3.25006 13.9766 3.33013 14.2909 3.45605 14.538L3.55859 14.7216C3.81498 15.1397 4.18266 15.4801 4.62207 15.704L4.82227 15.79C5.03904 15.8674 5.31234 15.9205 5.69824 15.9521C6.01398 15.9779 6.383 15.986 6.83398 15.9902L6.83496 3.99992ZM18.165 11.3271C18.165 12.2493 18.1653 12.9811 18.1172 13.5702C18.0745 14.0924 17.9916 14.5472 17.8125 14.9648L17.7295 15.1415C17.394 15.8 16.8834 16.3511 16.2568 16.7353L15.9814 16.8896C15.5157 17.1268 15.0069 17.2285 14.4102 17.2773C13.821 17.3254 13.0893 17.3251 12.167 17.3251H7.83301C6.91071 17.3251 6.17898 17.3254 5.58984 17.2773C5.06757 17.2346 4.61294 17.1508 4.19531 16.9716L4.01855 16.8896C3.36014 16.5541 2.80898 16.0434 2.4248 15.4169L2.27051 15.1415C2.03328 14.6758 1.93158 14.167 1.88281 13.5702C1.83468 12.9811 1.83496 12.2493 1.83496 11.3271V8.66301C1.83496 7.74072 1.83468 7.00898 1.88281 6.41985C1.93157 5.82309 2.03329 5.31432 2.27051 4.84856L2.4248 4.57317C2.80898 3.94666 3.36012 3.436 4.01855 3.10051L4.19531 3.0175C4.61285 2.83843 5.06771 2.75548 5.58984 2.71281C6.17898 2.66468 6.91071 2.66496 7.83301 2.66496H12.167C13.0893 2.66496 13.821 2.66468 14.4102 2.71281C15.0069 2.76157 15.5157 2.86329 15.9814 3.10051L16.2568 3.25481C16.8833 3.63898 17.394 4.19012 17.7295 4.84856L17.8125 5.02531C17.9916 5.44285 18.0745 5.89771 18.1172 6.41985C18.1653 7.00898 18.165 7.74072 18.165 8.66301V11.3271ZM8.16406 15.995H12.167C13.1112 15.995 13.7794 15.9947 14.3018 15.9521C14.8164 15.91 15.1308 15.8299 15.3779 15.704L15.5615 15.6015C15.9797 15.3451 16.32 14.9774 16.5439 14.538L16.6299 14.3378C16.7074 14.121 16.7605 13.8478 16.792 13.4618C16.8347 12.9394 16.835 12.2712 16.835 11.3271V8.66301C16.835 7.71885 16.8347 7.05065 16.792 6.52824C16.7605 6.14232 16.7073 5.86904 16.6299 5.65227L16.5439 5.45207C16.32 5.01264 15.9796 4.64498 15.5615 4.3886L15.3779 4.28606C15.1308 4.16013 14.8165 4.08006 14.3018 4.03801C13.7794 3.99533 13.1112 3.99504 12.167 3.99504H8.16406C8.16407 3.99667 8.16504 3.99829 8.16504 3.99992L8.16406 15.995Z`,fill:`currentColor`})}),Gn=S(w,!1),Kn=S(w,!1);function qn(e){let t=(0,$.c)(58),n;t[0]===e?n=t[1]:(n=e===void 0?{}:e,t[0]=e,t[1]=n);let{hideUnreadBadge:r,onToggleSidebar:i}=n,o=r===void 0?!1:r,s=v(w),c=D(),l=y(Ze),u=y(qe),d=y(Ae),f=y(a),p=!l&&!o,m;t[2]===p?m=t[3]:(m={taskFilter:`current`,limit:20,enabled:p},t[2]=p,t[3]=m);let h=ee(m),g=y(Gn),_=y(Kn),b=x(Mt,`toggleSidebar`),S=x(Mt,`navigateBack`),C=x(Mt,`navigateForward`),T;t[4]!==c||t[5]!==l?(T=l?c.formatMessage({id:`app.sidebar.hide`,defaultMessage:`Hide sidebar`,description:`Accessible label to collapse the sidebar chrome`}):c.formatMessage({id:`app.sidebar.show`,defaultMessage:`Show sidebar`,description:`Accessible label to expand the sidebar chrome`}),t[4]=c,t[5]=l,t[6]=T):T=t[6];let E=T,O=l?Un:Wn,A;t[7]===h.data?A=t[8]:(A=h.data??[],t[7]=h.data,t[8]=A);let j;t[9]===A?j=t[10]:(j=A.some(Xn),t[9]=A,t[10]=j);let M=!o&&!l&&(f>0||j),N,P;t[11]===s?(N=t[12],P=t[13]):(N=()=>()=>{s.set(Ne,!1),s.set(Le,!1),s.set(Ae,!1)},P=[s],t[11]=s,t[12]=N,t[13]=P),(0,Z.useEffect)(N,P);let F;t[14]===Symbol.for(`react.memo_cache_sentinel`)?(F=(0,Q.jsx)(k,{id:`app.sidebar.tooltip`,defaultMessage:`Toggle sidebar`,description:`Tooltip for the sidebar trigger button`}),t[14]=F):F=t[14];let I=u||d,L;t[15]!==i||t[16]!==s?(L=()=>{if(s.set(Ae,!0),i!=null){i();return}pt(`toggleSidebar`,`sidebar_trigger`)},t[15]=i,t[16]=s,t[17]=L):L=t[17];let R,z;t[18]===s?(R=t[19],z=t[20]):(R=()=>{s.set(Ne,!0)},z=()=>{s.set(Ne,!1),s.set(Le,!1),s.set(Ae,!1)},t[18]=s,t[19]=R,t[20]=z);let B;t[21]===O?B=t[22]:(B=(0,Q.jsx)(O,{className:`icon-xs`}),t[21]=O,t[22]=B);let V;t[23]===M?V=t[24]:(V=M?(0,Q.jsx)(`span`,{"aria-hidden":`true`,className:`absolute -top-0.5 -right-0.5 size-2 rounded-full bg-token-charts-blue ring-2 ring-token-main-surface-primary`,"data-testid":`sidebar-unread-badge`}):null,t[23]=M,t[24]=V);let H;t[25]!==B||t[26]!==V?(H=(0,Q.jsxs)(`span`,{className:`relative inline-flex`,children:[B,V]}),t[25]=B,t[26]=V,t[27]=H):H=t[27];let U;t[28]!==E||t[29]!==I||t[30]!==L||t[31]!==R||t[32]!==z||t[33]!==H||t[34]!==b?(U=(0,Q.jsx)(Zn,{ariaLabel:E,shortcut:b,tooltipContent:F,tooltipDisabled:I,viewTransitionName:`sidebar-trigger`,onClick:L,onPointerEnter:R,onPointerLeave:z,children:H}),t[28]=E,t[29]=I,t[30]=L,t[31]=R,t[32]=z,t[33]=H,t[34]=b,t[35]=U):U=t[35];let W;t[36]===c?W=t[37]:(W=c.formatMessage(Qn.navigateBack),t[36]=c,t[37]=W);let G=!g,K;t[38]===Symbol.for(`react.memo_cache_sentinel`)?(K=(0,Q.jsx)(k,{...Qn.navigateBack}),t[38]=K):K=t[38];let q;t[39]===Symbol.for(`react.memo_cache_sentinel`)?(q=(0,Q.jsx)(Rt,{className:`icon-xs`}),t[39]=q):q=t[39];let J;t[40]!==S||t[41]!==W||t[42]!==G?(J=(0,Q.jsx)(Zn,{ariaLabel:W,disabled:G,shortcut:S,tooltipContent:K,onClick:Yn,children:q}),t[40]=S,t[41]=W,t[42]=G,t[43]=J):J=t[43];let Y;t[44]===c?Y=t[45]:(Y=c.formatMessage(Qn.navigateForward),t[44]=c,t[45]=Y);let X=!_,te;t[46]===Symbol.for(`react.memo_cache_sentinel`)?(te=(0,Q.jsx)(k,{...Qn.navigateForward}),t[46]=te):te=t[46];let ne;t[47]===Symbol.for(`react.memo_cache_sentinel`)?(ne=(0,Q.jsx)(Rt,{className:`icon-xs -scale-x-100`}),t[47]=ne):ne=t[47];let re;t[48]!==C||t[49]!==Y||t[50]!==X?(re=(0,Q.jsx)(Zn,{ariaLabel:Y,disabled:X,shortcut:C,tooltipContent:te,onClick:Jn,children:ne}),t[48]=C,t[49]=Y,t[50]=X,t[51]=re):re=t[51];let ie;t[52]!==J||t[53]!==re?(ie=(0,Q.jsx)(dt,{electron:!0,extension:!0,children:(0,Q.jsxs)(Q.Fragment,{children:[J,re]})}),t[52]=J,t[53]=re,t[54]=ie):ie=t[54];let ae;return t[55]!==U||t[56]!==ie?(ae=(0,Q.jsxs)(`div`,{className:`flex items-center gap-1`,children:[U,ie]}),t[55]=U,t[56]=ie,t[57]=ae):ae=t[57],ae}function Jn(){return pt(`navigateForward`,`sidebar_forward`)}function Yn(){return pt(`navigateBack`,`sidebar_back`)}function Xn(e){return e.has_unread_turn}function Zn(e){let t=(0,$.c)(17),{ariaLabel:n,children:r,disabled:i,onClick:a,onPointerEnter:o,onPointerLeave:s,shortcut:c,tooltipContent:l,tooltipDisabled:u,viewTransitionName:d}=e,f=i===void 0?!1:i,p=u===void 0?!1:u,m;t[0]===d?m=t[1]:(m=d==null?void 0:{viewTransitionName:d},t[0]=d,t[1]=m);let h;t[2]!==n||t[3]!==r||t[4]!==f||t[5]!==a||t[6]!==o||t[7]!==s||t[8]!==m?(h=(0,Q.jsx)(L,{"aria-label":n,color:`ghost`,disabled:f,style:m,size:`toolbar`,uniform:!0,onClick:a,onPointerEnter:o,onPointerLeave:s,children:r}),t[2]=n,t[3]=r,t[4]=f,t[5]=a,t[6]=o,t[7]=s,t[8]=m,t[9]=h):h=t[9];let g;return t[10]!==o||t[11]!==s||t[12]!==c||t[13]!==h||t[14]!==l||t[15]!==p?(g=(0,Q.jsx)(P,{disabled:p,tooltipContent:l,onPointerEnter:o,onPointerLeave:s,shortcut:c,children:h}),t[10]=o,t[11]=s,t[12]=c,t[13]=h,t[14]=l,t[15]=p,t[16]=g):g=t[16],g}var Qn=A({navigateBack:{id:`codex.command.navigateBack`,defaultMessage:`Back`,description:`Command menu item to navigate back`},navigateForward:{id:`codex.command.navigateForward`,defaultMessage:`Forward`,description:`Command menu item to navigate forward`}});function $n(){let{platform:e}=nt();return(e===`windows`||e===`linux`)&&window.electronBridge?.showApplicationMenu!=null}var er=A({file:{id:`windowsMenuBar.file`,defaultMessage:`File`,description:`Label for the File menu in the Windows custom title bar`},edit:{id:`windowsMenuBar.edit`,defaultMessage:`Edit`,description:`Label for the Edit menu in the Windows custom title bar`},view:{id:`windowsMenuBar.view`,defaultMessage:`View`,description:`Label for the View menu in the Windows custom title bar`},window:{id:`windowsMenuBar.window`,defaultMessage:`Window`,description:`Label for the Window menu in the Windows custom title bar`},help:{id:`windowsMenuBar.help`,defaultMessage:`Help`,description:`Label for the Help menu in the Windows custom title bar`}}),tr=[{id:t.file,message:er.file},{id:t.edit,message:er.edit},{id:t.view,message:er.view},{id:t.window,message:er.window},{id:t.help,message:er.help}];function nr(){let e=D(),t=$n(),{platform:p}=nt(),h=p===`linux`&&typeof window.electronBridge?.getApplicationMenuItems==`function`,[n,r]=(0,Z.useState)(null),[m,g]=(0,Z.useState)([]),[_,v]=(0,Z.useState)(null),y=(0,Z.useRef)(0);if((0,Z.useEffect)(()=>{if(!h||!n)return;let e=e=>{e.key===`Escape`&&r(null)},t=e=>{let t=document.getElementById(`linux-application-menu-panel`);t&&!t.contains(e.target)&&!e.target.closest(`[data-linux-menu-trigger=true]`)&&r(null)};return document.addEventListener(`keydown`,e),document.addEventListener(`mousedown`,t),()=>{document.removeEventListener(`keydown`,e),document.removeEventListener(`mousedown`,t)}},[h,n]),!t)return null;let b=e=>e?e.replace(/CommandOrControl|CmdOrCtrl/g,`Ctrl`).replace(/Command/g,`Ctrl`).replace(/Control/g,`Ctrl`):``,x=async(e,t)=>{if(h){if(n===e){r(null);return}let i=t.currentTarget.getBoundingClientRect(),a=y.current+1;y.current=a,r(e),g([]);let o=await window.electronBridge.getApplicationMenuItems(e);y.current===a&&(v({left:Math.round(i.left),top:Math.round(i.bottom)}),g(o?.items??[]))}else{let n=window.electronBridge?.showApplicationMenu;if(!n)return;let i=y.current+1;y.current=i,r(e);let a=t.currentTarget.getBoundingClientRect();try{await n(e,Math.round(a.left),Math.round(a.bottom))}finally{y.current===i&&r(null)}}},S=async e=>{e.enabled!==!1&&n&&(await window.electronBridge?.clickApplicationMenuItem?.(n,e.path),r(null))},C=`no-drag rounded-md border border-transparent px-2.5 py-1 text-base font-normal leading-none outline-none transition-colors`,w=t=>c(C,n===t?`bg-[var(--color-token-menubar-selection-background)] text-[var(--color-token-menubar-selection-foreground)]`:`text-token-text-tertiary hover:bg-token-foreground/5 hover:text-token-description-foreground focus-visible:bg-token-foreground/5 focus-visible:text-token-description-foreground`);return(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`div`,{className:`flex items-center gap-0.5 pr-2 pl-1`,children:tr.map(({id:t,message:i})=>(0,Q.jsx)(`button`,{type:`button`,"data-linux-menu-trigger":h?`true`:void 0,"aria-expanded":n===t,"aria-haspopup":`menu`,"aria-label":e.formatMessage(i),className:w(t),onClick:e=>{x(t,e)},children:(0,Q.jsx)(k,{...i})},t))}),h&&n&&_&&(0,Q.jsx)(`div`,{id:`linux-application-menu-panel`,className:`no-drag fixed z-50 m-px flex min-w-[220px] flex-col rounded-xl bg-token-dropdown-background/90 p-1 text-token-foreground shadow-lg ring-[0.5px] ring-token-border backdrop-blur-sm select-none`,style:{left:_.left,top:_.top},children:m.map(t=>t.type===`separator`?(0,Q.jsx)(`div`,{className:`mx-1 my-1 border-t border-token-border/60`,role:`separator`},t.path):(0,Q.jsx)(`button`,{type:`button`,className:c(`flex w-full items-center gap-3 rounded-lg p-1.5 text-left text-sm outline-none transition-colors`,t.enabled===!1?`cursor-default opacity-50`:`cursor-interaction hover:bg-token-list-hover-background focus:bg-token-list-hover-background`),disabled:t.enabled===!1,onClick:()=>{S(t)},children:(0,Q.jsxs)(`span`,{className:`flex w-full items-center gap-3`,children:[(0,Q.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:t.label}),t.accelerator?(0,Q.jsx)(`span`,{className:`shrink-0 pl-4 text-xs text-token-text-tertiary tabular-nums`,children:b(t.accelerator)}):null]})},t.path))})]})}var rr=280,ir=`app-shell:bottom-panel-height`;function ar(e,t){return Number.isFinite(e)?Math.max(160,Math.min(e,t*.5)):rr}function or(e){return ar(j(ir,280),e)}function sr(e,t){M(ir,ar(e,t))}function cr(e){let t=(0,$.c)(10),{size:n,animation:r,isVisible:i}=e,[,a]=(0,Z.useState)(0),o;t[0]!==r||t[1]!==a?(o=()=>{r.get()>0||a(ur)},t[0]=r,t[1]=a,t[2]=o):o=t[2],Gt(r,`animationComplete`,o);let s;t[3]!==r||t[4]!==n?(s=[r,n],t[3]=r,t[4]=n,t[5]=s):s=t[5];let c=Xt(s,lr),l=i||r.get()>0,u;return t[6]!==c||t[7]!==r||t[8]!==l?(u={isMounted:l,animatedSize:c,opacity:r,progress:r},t[6]=c,t[7]=r,t[8]=l,t[9]=u):u=t[9],u}function lr(e){let[t,n]=e;return Math.max(0,Math.min(1,t))*n}function ur(e){return e+1}function dr({bottomPanelHeight:e,children:t,clampedBottomPanelHeight:n,mainContentHeight:r,isVisible:i=!1}){let a=v(I),{isMounted:o,opacity:s,animatedSize:c}=cr({animation:y(Ye),size:n,isVisible:i}),l=Jt`${n}px`;return!o&&!i?null:(0,Q.jsxs)(U.div,{"data-app-shell-focus-area":`bottom-panel`,className:`relative z-30 min-h-0 w-full shrink-0 overflow-visible`,style:{opacity:s,height:c},transition:Ke,children:[(0,Q.jsx)(Bn,{defaultSize:280,edge:`top`,getCurrentSize:()=>n.get(),setSize:t=>{if(t{em==null?null:ot.getSnapshot(m.conversationId,m.browserTabId),e[7]=m,e[8]=_);let b=_,x=(0,Z.useSyncExternalStore)(gr,b,b)?.tabType===n.WEB?m:null,S=x?.conversationId??null,w=x?.browserTabId??null,T,D;e[9]!==g||e[10]!==a||e[11]!==c||e[12]!==h||e[13]!==o||e[14]!==S||e[15]!==w?(T=()=>{C.dispatchMessage(`app-shell-shortcut-state-changed`,{bottomPanelCanCloseActiveTab:g,focusArea:a,imagePreviewOpen:c,terminalFocused:o,rightPanelBrowserConversationId:S,rightPanelBrowserTabId:w,rightPanelCanCloseActiveTab:h})},D=[g,a,c,o,h,S,w],e[9]=g,e[10]=a,e[11]=c,e[12]=h,e[13]=o,e[14]=S,e[15]=w,e[16]=T,e[17]=D):(T=e[16],D=e[17]),(0,Z.useEffect)(T,D);let O;e[18]===Symbol.for(`react.memo_cache_sentinel`)?(O=[],e[18]=O):O=e[18],(0,Z.useEffect)(mr,O);let k;e[19]===Symbol.for(`react.memo_cache_sentinel`)?(k=[],e[19]=k):k=e[19],E(`image-preview-zoom-command`,pr,k);let A,j;return e[20]!==s||e[21]!==f||e[22]!==t?(A=e=>{let{panelId:n}=e;bb80:switch(n){case`bottom`:at.closeActiveTab(t);break bb80;case`right`:if(rt.closeActiveTab(t))break bb80;f!=null&&s!=null&&rt.closeTab(t,s.tabId)}},j=[s,f,t],e[20]=s,e[21]=f,e[22]=t,e[23]=A,e[24]=j):(A=e[23],j=e[24]),E(`close-active-app-shell-tab`,A,j),null}function pr(e){let{command:t}=e;Ht(t)}function mr(){return hr}function hr(){C.dispatchMessage(`app-shell-shortcut-state-changed`,{bottomPanelCanCloseActiveTab:!1,focusArea:`main`,imagePreviewOpen:!1,terminalFocused:!1,rightPanelBrowserConversationId:null,rightPanelBrowserTabId:null,rightPanelCanCloseActiveTab:!1})}function gr(e){return ot.subscribe(e)}var _r=`[&_a]:pointer-events-auto [&_button]:pointer-events-auto [&_input]:pointer-events-auto [&_select]:pointer-events-auto [&_textarea]:pointer-events-auto`;function vr({isHeaderEdgeScroll:e,isWindowsMenuBarEnabled:t}){let{headerLeftWidth:n,headerRightWidth:r,leftPanelAnimatedWidth:i,rightPanelAnimatedWidth:a,leftPanelWidth:lp}=Je(),flw=y(Wr),fls=y(Ze),o=Kt(0),s=Jt`${i}px`,l=Jt`${a}px`,u=y(fe),d=y(et),f=y(be),p=y(ce),m=y(ye),h=y(xe),g=d.filter(({align:e})=>e===`start`),_=d.filter(({align:e})=>e===`end`),v=d.length>0,b=g.length>0,x=_.length>0,S=m.length>0,C=u!=null||v;return(0,Q.jsx)(Ct,{items:f,children:(0,Q.jsxs)(U.header,{"data-app-shell-header-edge-scroll":e,className:c(`app-header-tint draggable pointer-events-none fixed z-30 flex h-toolbar min-w-0 items-center`,t?`right-0`:`inset-x-0`,t?`top-toolbar-sm`:`top-0`),style:t?{left:flw&&!fls?`${Math.max(lp.get(),i.get())}px`:s}:{},children:[(0,Q.jsx)(yr,{entries:p,fitWidth:n,slotWidth:t?o:i,side:`start`}),C&&(0,Q.jsxs)(`div`,{"aria-hidden":h,"data-testid":`app-shell-header-context-menu-surface`,className:c(`pointer-events-none ms-4 flex h-full min-w-0 flex-1 isolate items-center gap-1.5 overflow-hidden [contain:layout_paint]`,h&&`invisible`,S?`pe-1.5`:`pe-2`),children:[u!=null&&(0,Q.jsx)(`div`,{className:c(`pointer-events-none w-full min-w-0 flex-1`,_r),children:u}),b&&(0,Q.jsx)(`div`,{className:`flex shrink-0 items-center gap-1.5`,children:g.map(({actionId:e,node:t})=>(0,Q.jsx)(`div`,{className:`no-drag pointer-events-auto flex shrink-0 items-center`,children:t},e))}),x&&(0,Q.jsx)(`div`,{className:`ms-auto flex shrink-0 items-center gap-1.5`,children:_.map(({actionId:e,node:t})=>(0,Q.jsx)(`div`,{className:`no-drag pointer-events-auto flex shrink-0 items-center`,children:t},e))})]}),(0,Q.jsx)(yr,{entries:m,fitWidth:r,slotWidth:l,side:`end`})]})})}function yr({entries:e,fitWidth:t,side:n,slotWidth:r}){let i=e.some(({align:e})=>e===`end`),a=c({"ps-[max(var(--spacing-token-safe-header-left),0.5rem)]":n===`start`,"pe-2":n===`start`&&i||n===`end`}),o=At(e=>{let{width:n}=kt(e);t.set(n)});return(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`div`,{"aria-hidden":!0,className:c(`invisible pointer-events-none fixed top-0 left-0 min-w-max [&_*]:![view-transition-name:none]`,!!e.length&&a),ref:o,children:(0,Q.jsx)(br,{entries:e})}),(0,Q.jsx)(U.div,{"data-test-id":`header-shell-slot`,className:c(`pointer-events-none relative h-full shrink-0 [container-type:inline-size]`,!!e.length&&a),style:{width:r,minWidth:Jt`${t}px`},children:(0,Q.jsx)(br,{entries:e,fillSlot:!0})})]})}function br(e){let t=(0,$.c)(11),{entries:n,fillSlot:r}=e,i=r===void 0?!1:r,a,o,s;if(t[0]!==n||t[1]!==i){let e=n.filter(wr),r=n.filter(Cr),l=i?`pointer-events-none w-full`:`no-drag pointer-events-auto w-auto`;t[5]===l?a=t[6]:(a=c(`inline-flex h-full items-center gap-1.5`,l),t[5]=l,t[6]=a),o=e.map(Sr),s=r.map(xr),t[0]=n,t[1]=i,t[2]=a,t[3]=o,t[4]=s}else a=t[2],o=t[3],s=t[4];let l;return t[7]!==a||t[8]!==o||t[9]!==s?(l=(0,Q.jsxs)(`div`,{className:a,children:[o,s]}),t[7]=a,t[8]=o,t[9]=s,t[10]=l):l=t[10],l}function xr(e,t){let{actionId:n,node:r}=e;return(0,Q.jsx)(`div`,{className:c(`no-drag pointer-events-auto flex shrink-0 items-center`,t===0&&`ms-auto`),children:r},n)}function Sr(e){let{actionId:t,node:n}=e;return(0,Q.jsx)(`div`,{className:`no-drag pointer-events-auto flex shrink-0 items-center`,children:n},t)}function Cr(e){let{align:t}=e;return t===`end`}function wr(e){let{align:t}=e;return t===`start`}function Tr({children:e,paddingTop:t}){let n=v(w),{leftPanelAnimatedWidth:r,leftPanelWidth:i}=Je(),[a,o]=(0,Z.useState)(!1),s=y(qe),l=Jt`${i}px`;return(0,Q.jsxs)(U.aside,{className:c(`app-shell-left-panel pointer-events-auto relative flex overflow-visible browser:bg-token-main-surface-primary`,a&&`cursor-col-resize`),style:{width:r,paddingTop:t},children:[(0,Q.jsx)(U.div,{className:`max-w-full overflow-hidden`,style:{minWidth:l,width:l,opacity:y(Oe)},children:e}),(0,Q.jsx)(Bn,{disabled:s,defaultSize:300,getCurrentSize:()=>i.get(),onResizingChange:o,setSize:e=>{if(e{e{f.set(f.get()+1)}),!h&&!t?null:(0,Q.jsxs)(U.aside,{"data-app-shell-focus-area":`right-panel`,className:`relative z-[41] ml-auto h-full min-h-0 min-w-0 shrink-0 overflow-visible`,style:{opacity:g,width:_},transition:Ke,children:[!p&&(0,Q.jsx)(`div`,{"aria-hidden":!0,className:`pointer-events-none absolute inset-y-0 left-0 z-30 w-px shadow-[-8px_0_16px_-8px_rgb(0_0_0/0.18)]`}),!p&&(0,Q.jsx)(Bn,{defaultSize:l??u.defaultWidth,edge:`left`,getCurrentSize:()=>r.get(),setSize:e=>{if(e{e{let[t,r]=e;return n?t:Qe(r,t,o)},t[3]=n,t[4]=o,t[5]=c):c=t[5];let l=Xt(s,c),u;t[6]!==i||t[7]!==l?(u=[i,l],t[6]=i,t[7]=l,t[8]=u):u=t[8];let d;t[9]===n?d=t[10]:(d=e=>{let[t,r]=e;return n?0:Math.max(0,Math.min(1,t))*r},t[9]=n,t[10]=d);let f=Xt(u,d),p;return t[11]!==f||t[12]!==l||t[13]!==a||t[14]!==o?(p={rightPanelAnimatedWidth:f,rightPanelWidth:l,rightPanelWidthRatio:a,widthMode:o},t[11]=f,t[12]=l,t[13]=a,t[14]=o,t[15]=p):p=t[15],p}function Ar(e,t){let n=(0,Z.useRef)(null);if(n.current!=null&&n.current.defaultWidth===e.defaultWidth&&n.current.storageKey===e.storageKey)return n.current.widthRatio;let r=K(Re({...e,mainContentWidth:t.get()}));return n.current={...e,widthRatio:r},r}function jr(e){let t=(0,$.c)(30),{children:n}=e,r=v(I),i;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(i={activationConstraint:{distance:6}},t[0]=i):i=t[0];let a=d(u(f,i)),[o,s]=(0,Z.useState)(null),c=(0,Z.useRef)(null),l;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(l=(e,t)=>{s(n=>n==null?n:ln(n,e,t))},t[1]=l):l=t[1];let m=l,h;t[2]===r?h=t[3]:(h=e=>{let t=Nr(e.active.data.current);if(t?.kind!==`app-shell-tab`)return;let n=r.get(t.controller.tabs$),i=n.findIndex(e=>e.tabId===t.tabId),a=n[i]??null;a!=null&&(c.current={sourceController:t.controller,sourceIndex:i,tabId:t.tabId},s({draggedTab:a,isDraggedTabActive:r.get(t.controller.activeTab$)?.tabId===t.tabId,overTabId:null,previewController:t.controller,sourceController:t.controller}))},t[2]=r,t[3]=h);let _=h,y;t[4]!==o||t[5]!==r?(y=e=>{let t=c.current;if(o==null||t==null)return;let n=Nr(e.over?.data.current);if(n!=null)if(n.kind===`app-shell-tab`){if(n.tabId===t.tabId)return;if(n.controller===t.sourceController){cn(r,t.sourceController,t.tabId,n.tabId),m(t.sourceController,null);return}m(n.controller,n.tabId)}else m(n.controller,null)},t[4]=o,t[5]=r,t[6]=y):y=t[6];let b=y,x;t[7]!==o||t[8]!==r?(x=e=>{let t=c.current;o!=null&&t!=null&&(sn(r,t),o.isDraggedTabActive&&t.sourceController.activateTab(r,t.tabId)),s(null),c.current=null},t[7]=o,t[8]=r,t[9]=x):x=t[9];let S=x,C;t[10]!==o||t[11]!==r?(C=e=>{let t=c.current;o!=null&&t!=null&&e.over==null?(sn(r,t),o.isDraggedTabActive&&t.sourceController.activateTab(r,t.tabId)):o!=null&&t!=null&&o.previewController!==t.sourceController&&(t.sourceController.moveTabTo(r,t.tabId,o.previewController,o.overTabId,{activate:!1}),o.isDraggedTabActive&&o.previewController.activateTab(r,t.tabId)),s(null),c.current=null},t[10]=o,t[11]=r,t[12]=C):C=t[12];let w=C,T;t[13]===o?T=t[14]:(T={dragState:o},t[13]=o,t[14]=T);let E;t[15]===o?E=t[16]:(E=o==null?null:(0,Q.jsx)(Mr,{dragState:o}),t[15]=o,t[16]=E);let D;t[17]===E?D=t[18]:(D=(0,Q.jsx)(p,{adjustScale:!1,children:E}),t[17]=E,t[18]=D);let O;t[19]!==n||t[20]!==S||t[21]!==w||t[22]!==b||t[23]!==_||t[24]!==a||t[25]!==D?(O=(0,Q.jsxs)(g,{sensors:a,collisionDetection:Pr,onDragStart:_,onDragOver:b,onDragCancel:S,onDragEnd:w,children:[n,D]}),t[19]=n,t[20]=S,t[21]=w,t[22]=b,t[23]=_,t[24]=a,t[25]=D,t[26]=O):O=t[26];let k;return t[27]!==O||t[28]!==T?(k=(0,Q.jsx)(on.Provider,{value:T,children:O}),t[27]=O,t[28]=T,t[29]=k):k=t[29],k}function Mr(e){let t=(0,$.c)(12),{dragState:n}=e,{highlightedIcon:r,icon:i,isClosable:a,isHighlighted:o,isLabel:s,isPreview:c,tabId:l,title:u,tooltip:d,trailingContent:f}=n.draggedTab,p;return t[0]!==n.isDraggedTabActive||t[1]!==r||t[2]!==i||t[3]!==a||t[4]!==o||t[5]!==s||t[6]!==c||t[7]!==l||t[8]!==u||t[9]!==d||t[10]!==f?(p=(0,Q.jsx)(`div`,{className:`relative my-auto flex max-w-40 shrink-0 items-center gap-0.5 pe-1`,children:(0,Q.jsx)(tn,{id:l,highlightedIcon:r,icon:i,isActive:n.isDraggedTabActive,isClosable:a,isDragging:!0,isHighlighted:o,isLabel:s,isPreview:c,trailingContent:f,title:u,tooltip:d})}),t[0]=n.isDraggedTabActive,t[1]=r,t[2]=i,t[3]=a,t[4]=o,t[5]=s,t[6]=c,t[7]=l,t[8]=u,t[9]=d,t[10]=f,t[11]=p):p=t[11],p}function Nr(e){if(typeof e!=`object`||!e)return null;switch(Reflect.get(e,`kind`)){case`app-shell-tab`:case`app-shell-tab-strip`:return e;default:return null}}function Pr(e){let t=h(e),n=t.filter(e=>Nr(e.data?.droppableContainer.data.current)?.kind===`app-shell-tab`);if(n.length>0)return n;let r=t.find(e=>Nr(e.data?.droppableContainer.data.current)?.kind===`app-shell-tab-strip`)??null,i=r==null?null:Nr(r.data?.droppableContainer.data.current);if(r!=null&&i?.kind===`app-shell-tab-strip`){let t=e.droppableContainers.filter(e=>{let t=Nr(e.data.current);return t?.kind===`app-shell-tab`&&t.controller===i.controller});return t.length>0?l({...e,droppableContainers:t}):[r]}return l(e)}var Fr=`data-app-shell-focus-area`,Ir=96,Lr=16,Rr=960,zr=720,Br=12,Vr=0,Hr=b(w,({get:e})=>{let t=e(zn.px$);return t!=null&&t>=0&&t<=Br}),Ur=b(w,({get:e})=>{let t=e(zn.px$),n=e(Ue)-Vr;return t!=null&&t>=0&&t<=n}),Wr=S(I,!1,{onMount:(e,t)=>{let n=!1,r,i;e(!1);let a=t.watch(({get:a})=>{if(a(Ze)){n=!1,r=void 0,i=void 0,e(!1);return}if(a(qe)){e(!1);return}let o=a(zn.px$),s=a(zn.py$),c=a(Hr),l=a(Ur),u=a(Le),d=a(Ne);if(u){d&&(n=!0);let a=r!==void 0&&i!==void 0&&(o!==r||s!==i);r===void 0&&(r=o,i=s),(a||n&&!d)&&!c&&!d&&(n=!1,r=void 0,i=void 0,t.set(Le,!1)),e(!1);return}n=!1,r=void 0,i=void 0;let f=a(ze);e(e=>{let t=e?l||f:c||f;return e===t?e:t})});return()=>{e(!1),a()}}});function Gr({bottomPanelSlot:e,children:t,leftPanelSlot:n,rightPanelSlot:r}){let i=v(I),a=(0,Z.useRef)(null),[o,s]=(0,Z.useState)(null),l=n?.children,u=l!=null,d=e!=null,f=r!=null,p=(0,Z.useRef)(!1),m=(0,Z.useRef)(!1),h=y(xe),g=y(se),_=N(),b=zt(),x=$n(),[S,C]=(0,Z.useState)(!1),w=y(Ze),T=y(R),E=y(Wr),D=g===`thread-edge-scroll`,O=u&&w,k=D&&S&&!h,A=g===`full-bleed`,j=`visible`;A?j=`hidden`:D?j=`full-bleed`:f&&(j=`hidden`);let M=Kt(ae()),ee=Xt(M,e=>`${Math.max(0,e-Vr*2)}px`),{isMounted:P,animatedSize:F}=cr({animation:y(Oe),size:M,isVisible:O}),L=Kt(window.innerWidth),z=Kt(window.innerHeight-46),B=Kt(or(z.get())),V=y(Ye),H=Xt([B,z],([e,t])=>ar(e,t)),W=Xt([V,H],([e,t])=>e*t),G=Jt`${W}px`,K=Kt(0),q=Kt(0),J=Kt(0),Y=Xt([L,F],([e,t])=>Math.max(0,e-t)),{rightPanelAnimatedWidth:X,rightPanelWidth:ne,rightPanelWidthRatio:ie,widthMode:oe}=kr({isFullWidth:h,mainContentWidth:Y}),ce=Xt([L,ie],([e,t])=>Ee({isRightPanelOpen:f,mainContentWidth:e,rightPanelWidthMode:oe,rightPanelWidthRatio:t})),le=Xt([L,M,ie],([e,t,n])=>Ee({isRightPanelOpen:f,mainContentWidth:Math.max(0,e-t),rightPanelWidthMode:oe,rightPanelWidthRatio:n})),ue=O?le:ce,de=(0,Z.useRef)(W.get()),fe=(0,Z.useRef)(new Set),pe={"--spacing-token-safe-header-left":`${b.left/_}px`,"--spacing-token-safe-header-right":`${b.right/_}px`,width:`calc(100vw / var(--codex-window-zoom))`,height:`calc(100vh / var(--codex-window-zoom))`,zoom:`var(--codex-window-zoom)`,"--app-shell-bottom-panel-height":G},me=(0,Z.useMemo)(()=>({headerLeftWidth:q,headerRightWidth:J,leftPanelWidth:M,leftPanelAnimatedWidth:F,mainContentTargetWidth:ue,mainContentWidth:Y,shellWidth:L,rightPanelAnimatedWidth:X,rightPanelLayoutTick:K}),[q,J,F,M,ue,Y,X,K,L]),he=u,ge=(0,Z.useCallback)(e=>(fe.current.add(e),()=>{fe.current.delete(e)}),[]),_e=St(({width:e})=>{L.set(e);let t=e<=Rr,n=e<=zr,r=t!==p.current,a=n!==m.current;!r&&!a||(p.current=t,m.current=n,(r&&O&&f&&t||a&&n)&&(i.get(te)===`right-panel`&&Me(i,`main`),i.get(xe)&&i.set(xe,!1),i.get(Te)&&$e(i,!1)),a&&n&&i.get(Ze)&&re(i,!1))}),ve=At(e=>{let{width:t}=kt(e);_e({width:t})}),ye=At(e=>{let{width:t}=kt(e);C(t>=Zr())}),be=At(e=>{let{height:t}=kt(e);z.set(t)}),Se=(0,Z.useCallback)(e=>{s(e)},[]),Ce=(0,Z.useMemo)(()=>Lt(Se,be),[be,Se]);return Gt(W,`change`,e=>{let t=e-de.current;if(de.current=e,t!==0)for(let e of fe.current)e(t)}),(0,Q.jsx)(Er.Provider,{value:a,children:(0,Q.jsx)(Dr.Provider,{value:o,children:(0,Q.jsx)(Bt.Provider,{value:ge,children:(0,Q.jsxs)(Ie.Provider,{value:me,children:[(0,Q.jsx)(En,{}),(0,Q.jsx)(fr,{}),(0,Q.jsxs)(U.div,{ref:a,style:pe,className:`relative flex flex-col`,onBlurCapture:e=>{e.relatedTarget instanceof Node&&e.currentTarget.contains(e.relatedTarget)||(Me(i,`main`),Be(i,!1))},onFocusCapture:e=>{Me(i,Yr(e.target)),Be(i,Xr(e.target))},onPointerOverCapture:e=>{Xe(i,Yr(e.target))},children:[x&&(0,Q.jsx)(Qr,{}),(0,Q.jsxs)(`div`,{ref:ve,className:`relative isolate flex max-h-full min-h-0 w-full flex-1`,children:[(0,Q.jsx)(tt,{initial:!1,children:u&&(O||P)&&(0,Q.jsx)(Tr,{paddingTop:x?`0px`:`var(--height-toolbar)`,children:l},`app-shell-left-panel`)}),he&&!w&&!P&&(0,Q.jsx)(Kr,{floatingLeftPanelWidth:ee,isWindowsMenuBarEnabled:x,isVisible:E&&!w&&!P,leftPanelWidth:M,leftPanel:l,shouldUseReducedMotion:T,onOpenSidebar:()=>{re(i,!0,{animate:!1})}}),(0,Q.jsx)(`main`,{ref:Ce,className:c(`relative isolate flex min-h-0 flex-1 flex-col`,`main-surface`,P&&`rounded-s-2xl`,!P&&`!rounded-l-none`),children:(0,Q.jsxs)(jr,{children:[(0,Q.jsx)(vr,{isHeaderEdgeScroll:k,isWindowsMenuBarEnabled:x}),(0,Q.jsxs)(`div`,{className:`relative isolate flex min-h-0 flex-1 overflow-hidden`,children:[(0,Q.jsx)(`div`,{"data-app-shell-main-content-layout":g,ref:ye,className:c(`app-shell-main-content-viewport relative flex min-h-0 min-w-0 flex-col`,h?`w-0 flex-none overflow-hidden`:`flex-1`),children:(0,Q.jsx)(`div`,{className:c(`app-shell-main-content-frame relative mt-(--app-shell-main-content-frame-top-offset) flex min-h-0 flex-1 flex-col border-t`,f||D&&!k?`border-token-border-default`:`border-transparent`),children:(0,Q.jsxs)(`div`,{className:`relative flex min-h-0 flex-1`,children:[(0,Q.jsx)(`div`,{"aria-hidden":!0,"data-app-shell-main-content-top-fade":j,className:`app-shell-main-content-top-fade pointer-events-none absolute inset-x-0 top-0 z-20 h-4 bg-gradient-to-b from-token-main-surface-primary opacity-0 transition-opacity duration-200 browser:hidden`}),(0,Q.jsx)(`div`,{className:`h-full min-h-0 min-w-0 flex-1`,children:t})]})})}),(0,Q.jsx)(Or,{isRightPanelOpen:f,mainContentWidth:Y,rightPanelWidth:ne,rightPanelWidthRatio:ie,widthMode:oe,children:r?.children},`right-panel:${i.value.pathname}`)]}),(0,Q.jsx)(dr,{bottomPanelHeight:B,clampedBottomPanelHeight:H,mainContentHeight:z,isVisible:d,children:(0,Q.jsx)(Jr,{})})]})})]})]})]})})})})}function Kr(e){let t=(0,$.c)(15),{floatingLeftPanelWidth:n,isWindowsMenuBarEnabled:r,isVisible:i,leftPanel:a,leftPanelWidth:o,shouldUseReducedMotion:s,onOpenSidebar:l}=e,u=v(w),[d,f]=(0,Z.useState)(!1),p=i||d,m;t[0]===s?m=t[1]:(m=s?{duration:0}:Ke,t[0]=s,t[1]=m);let h=m,g;t[2]!==n||t[3]!==p||t[4]!==d||t[5]!==r||t[6]!==a||t[7]!==o||t[8]!==l||t[9]!==u||t[10]!==s||t[11]!==h?(g=p?(0,Q.jsxs)(U.div,{className:c(`pointer-events-auto fixed bottom-0 left-0 z-40 min-h-0`,d&&`cursor-col-resize`,r?`top-toolbar-sm`:`top-0`),initial:s?!1:{opacity:0,x:-8},animate:{opacity:1,x:0},exit:{opacity:0,x:s?0:-8},style:{width:n,zIndex:40},transition:h,children:[(0,Q.jsxs)(`aside`,{"data-testid":`app-shell-floating-left-panel`,className:`flex h-full min-h-0 flex-col overflow-hidden rounded-lg bg-token-main-surface-primary shadow-[1px_0_0_0_var(--color-token-border-default),0_20px_25px_-5px_rgb(0_0_0/0.1),0_8px_10px_-6px_rgb(0_0_0/0.1)]`,children:[r?null:(0,Q.jsx)(U.div,{initial:s?!1:{x:8},animate:{x:0},exit:{x:s?0:8},transition:h,className:`app-header-tint flex h-toolbar shrink-0 items-center ps-(--spacing-token-safe-header-left) pe-2`,children:(0,Q.jsx)(qn,{hideUnreadBadge:!0,onToggleSidebar:l})}),(0,Q.jsx)(`div`,{className:`min-h-0 flex-1 overflow-hidden`,children:a})]}),(0,Q.jsx)(Bn,{defaultSize:300,getCurrentSize:()=>o.get(),onResizingChange:f,setSize:e=>{let t=ie(e);u.set(Ue,t),o.set(t)},onResizeEnd:qr})]}):null,t[2]=n,t[3]=p,t[4]=d,t[5]=r,t[6]=a,t[7]=o,t[8]=l,t[9]=u,t[10]=s,t[11]=h,t[12]=g):g=t[12];let _;return t[13]===g?_=t[14]:(_=(0,Q.jsx)(tt,{initial:!1,children:g}),t[13]=g,t[14]=_),_}function qr(e){he(ie(e))}function Jr(){let e=(0,$.c)(5),t=y(at.activeTab$),n=y(me),r=y(ge),i=y(oe);if(t!=null){let t;return e[0]!==r||e[1]!==i?(t=(0,Q.jsx)(fn,{headerHeight:`pane`,afterList:r,afterListSticky:i,controller:at}),e[0]=r,e[1]=i,e[2]=t):t=e[2],t}let a;return e[3]===n?a=e[4]:(a=n==null?null:(0,Q.jsx)(Q.Fragment,{children:n}),e[3]=n,e[4]=a),a}function Yr(e){if(!(e instanceof HTMLElement))return`main`;let t=e.closest(`[${Fr}]`)?.getAttribute(Fr);return t===`right-panel`||t===`bottom-panel`?t:`main`}function Xr(e){return e instanceof HTMLElement&&e.closest(`[data-codex-terminal]`)!=null}function Zr(){let e=Number.parseFloat(getComputedStyle(document.documentElement).fontSize);return Number.isFinite(e)?Ir*e:Ir*Lr}function Qr(){let e=(0,$.c)(6),t=y(ct),n;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,Q.jsx)(qn,{}),e[0]=n):n=e[0];let r;e[1]===t?r=e[2]:(r=st(t)?(0,Q.jsx)(Pn,{}):null,e[1]=t,e[2]=r);let i;e[3]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,Q.jsx)(nr,{}),e[3]=i):i=e[3];let a;return e[4]===r?a=e[5]:(a=(0,Q.jsxs)(`div`,{className:`app-header-tint draggable group/windows-top-bar z-50 flex h-toolbar-sm items-center ps-(--spacing-token-safe-header-left) pe-0`,children:[n,r,i,(0,Q.jsx)(LinuxWindowControls,{})]}),e[4]=r,e[5]=a),a}function LinuxWindowControls(){let{platform:e}=nt(),t=window.electronBridge?.controlWindow;if(e!==`linux`||typeof t!=`function`)return null;let n=e=>()=>{void t(e)},[a,u]=(0,Z.useState)(!1),o=`no-drag cursor-interaction inline-flex h-7 w-7 shrink-0 items-center justify-center rounded-md border border-transparent bg-transparent p-0 outline-none transition-colors hover:bg-token-foreground/5 focus-visible:bg-token-foreground/5`,r=c(o,`text-token-text-tertiary hover:text-token-description-foreground focus-visible:text-token-description-foreground`),i=c(o,a?`text-token-charts-red`:`text-token-text-tertiary`);return(0,Q.jsxs)(`div`,{"data-linux-codex-window-controls":`true`,className:`no-drag ml-auto flex shrink-0 items-center gap-0.5 pe-2`,children:[(0,Q.jsx)(`button`,{type:`button`,className:r,onClick:n(`minimize`),"aria-label":`Minimize`,children:(0,Q.jsx)(`svg`,{className:`h-2.5 w-2.5`,viewBox:`0 0 10 10`,fill:`none`,"aria-hidden":`true`,children:(0,Q.jsx)(`path`,{d:`M0 5h10`,stroke:`currentColor`,strokeWidth:1})})}),(0,Q.jsx)(`button`,{type:`button`,className:r,onClick:n(`maximize`),"aria-label":`Maximize`,children:(0,Q.jsx)(`svg`,{className:`h-2.5 w-2.5`,viewBox:`0 0 10 10`,fill:`none`,"aria-hidden":`true`,children:(0,Q.jsx)(`rect`,{x:.5,y:.5,width:9,height:9,stroke:`currentColor`,strokeWidth:1})})}),(0,Q.jsx)(`button`,{type:`button`,className:i,onMouseEnter:()=>u(!0),onMouseLeave:()=>u(!1),onFocus:()=>u(!0),onBlur:()=>u(!1),onClick:n(`close`),"aria-label":`Close`,children:(0,Q.jsx)(`svg`,{className:`h-2.5 w-2.5`,viewBox:`0 0 10 10`,fill:`none`,"aria-hidden":`true`,children:(0,Q.jsx)(`path`,{d:`M1 1l8 8M9 1L1 9`,stroke:`currentColor`,strokeWidth:1})})})]})}function $r(e){return null}function ei(e){let{children:t}=e;return gi(v(I),fe,t),null}function ti(e){let t=(0,$.c)(23),{actionId:n,align:r,children:i,order:a,slotPosition:o}=e,s=r===void 0?`start`:r,c=a===void 0?0:a,l=o===void 0?`center`:o,u=v(I),d=ve[l],f;t[0]!==n||t[1]!==s||t[2]!==i||t[3]!==c||t[4]!==d.byId||t[5]!==u?(f=()=>{u.set(d.byId,n,{align:s,node:i,order:c})},t[0]=n,t[1]=s,t[2]=i,t[3]=c,t[4]=d.byId,t[5]=u,t[6]=f):f=t[6];let p;t[7]!==n||t[8]!==s||t[9]!==i||t[10]!==c||t[11]!==d||t[12]!==u?(p=[n,s,i,c,d,u],t[7]=n,t[8]=s,t[9]=i,t[10]=c,t[11]=d,t[12]=u,t[13]=p):p=t[13],(0,Z.useLayoutEffect)(f,p);let m;t[14]!==n||t[15]!==d.byId||t[16]!==d.ids$||t[17]!==u?(m=()=>(u.set(d.ids$,e=>e.includes(n)?e:[...e,n]),()=>{u.set(d.ids$,e=>e.filter(e=>e!==n)),u.set(d.byId,n,null)}),t[14]=n,t[15]=d.byId,t[16]=d.ids$,t[17]=u,t[18]=m):m=t[18];let h;return t[19]!==n||t[20]!==d||t[21]!==u?(h=[n,d,u],t[19]=n,t[20]=d,t[21]=u,t[22]=h):h=t[22],(0,Z.useLayoutEffect)(m,h),null}function ni(e){let t=(0,$.c)(8),n=v(I),r,i;t[0]!==e||t[1]!==n?(r=()=>{n.set(ne.byId,e.id,e)},i=[e,n],t[0]=e,t[1]=n,t[2]=r,t[3]=i):(r=t[2],i=t[3]),(0,Z.useLayoutEffect)(r,i);let a,o;return t[4]!==e.id||t[5]!==n?(a=()=>(n.set(ne.ids$,t=>t.includes(e.id)?t:[...t,e.id]),()=>{n.set(ne.ids$,t=>t.filter(t=>t!==e.id)),n.set(ne.byId,e.id,null)}),o=[e.id,n],t[4]=e.id,t[5]=n,t[6]=a,t[7]=o):(a=t[6],o=t[7]),(0,Z.useLayoutEffect)(a,o),null}function ri(e){return null}function ii(){let e=(0,$.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,Q.jsx)(Tn,{}),e[0]=t):t=e[0],t}function ai(e){let{children:t}=e;return gi(v(I),we,t),null}function oi(e){let t=(0,$.c)(9),{children:n,defaultWidth:r,widthStorageKey:i}=e,a=r===void 0?600:r,o=v(I),s;t[0]!==o||t[1]!==i?(s=i??ke(o.value.routeTemplate),t[0]=o,t[1]=i,t[2]=s):s=t[2];let c=s;gi(o,de,n);let l,u;return t[3]!==a||t[4]!==c||t[5]!==o||t[6]!==i?(l=()=>{if(!(a===600&&i==null))return o.set(X,{defaultWidth:a,storageKey:c}),()=>{o.set(X,null)}},u=[a,c,o,i],t[3]=a,t[4]=c,t[5]=o,t[6]=i,t[7]=l,t[8]=u):(l=t[7],u=t[8]),(0,Z.useLayoutEffect)(l,u),null}function si(e){let{children:t}=e;return gi(v(I),ue,t),null}function ci(e){let{children:t}=e;return gi(v(I),Se,t),null}function li(e){let{children:t}=e;return gi(v(I),Ce,t),null}function ui(){return null}function di(){let e=(0,$.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,Q.jsx)(Sn,{}),e[0]=t):t=e[0],t}function fi(e){let{children:t}=e;return gi(v(I),le,t),null}function pi(e){let{children:t}=e;return gi(v(I),ge,t),null}function mi(e){let{children:t}=e;return gi(v(I),oe,t),null}function hi(e){let{children:t}=e;return gi(v(I),me,t),null}function gi(e,t,n){let r=(0,$.c)(9),i,a;r[0]!==n||r[1]!==e||r[2]!==t?(i=()=>{e.set(t,n)},a=[n,e,t],r[0]=n,r[1]=e,r[2]=t,r[3]=i,r[4]=a):(i=r[3],a=r[4]),(0,Z.useLayoutEffect)(i,a);let o,s;r[5]!==e||r[6]!==t?(o=()=>()=>{e.set(t,null)},s=[e,t],r[5]=e,r[6]=t,r[7]=o,r[8]=s):(o=r[7],s=r[8]),(0,Z.useLayoutEffect)(o,s)}function _i(e){let t=(0,$.c)(3),{children:n}=e,r;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,Q.jsx)(wt,{debugName:`AppShellContent`,fillParent:!0}),t[0]=r):r=t[0];let i;return t[1]===n?i=t[2]:(i=(0,Q.jsx)(Z.Suspense,{fallback:r,children:n}),t[1]=n,t[2]=i),i}function vi(e){let t=(0,$.c)(4),{layout:n}=e,r=v(I),i,a;return t[0]!==n||t[1]!==r?(i=()=>(r.set(se,n),()=>{r.set(se,`default`)}),a=[n,r],t[0]=n,t[1]=r,t[2]=i,t[3]=a):(i=t[2],a=t[3]),(0,Z.useLayoutEffect)(i,a),null}function yi(e){let t=(0,$.c)(7),{children:n}=e,r;t[0]===n?r=t[1]:(r=bi(n),t[0]=n,t[1]=r);let{bottomPanelSlot:i,contentChildren:a,leftPanelSlot:o,rightPanelSlot:s}=r,c;return t[2]!==i||t[3]!==a||t[4]!==o||t[5]!==s?(c=(0,Q.jsx)(Gr,{bottomPanelSlot:i,leftPanelSlot:o,rightPanelSlot:s,children:a}),t[2]=i,t[3]=a,t[4]=o,t[5]=s,t[6]=c):c=t[6],c}function bi(e){let t=[],n,r,i;return Z.Children.forEach(e,(e,a)=>{if(xi(e)){r=e.props;return}if(Si(e)){i=e.props;return}if(Ci(e)){n=e.props;return}(0,Z.isValidElement)(e)?t.push({...e,key:e.key??`${a}`}):t.push(e)}),{bottomPanelSlot:n,contentChildren:t,leftPanelSlot:r,rightPanelSlot:i}}function xi(e){return(0,Z.isValidElement)(e)&&e.type===$r}function Si(e){return(0,Z.isValidElement)(e)&&e.type===ri}function Ci(e){return(0,Z.isValidElement)(e)&&e.type===ui}var wi={Root:(0,Z.memo)(yi),LeftPanel:$r,Content:(0,Z.memo)(_i),Header:(0,Z.memo)(ei),HeaderAction:(0,Z.memo)(ti),HeaderContextMenuItem:(0,Z.memo)(ni),MainContentLayout:(0,Z.memo)(vi),BottomPanel:ui,BottomPanelTabs:(0,Z.memo)(di),BottomPanelTabsEmptyState:(0,Z.memo)(fi),BottomPanelTabListAfter:(0,Z.memo)(pi),BottomPanelTabListAfterSticky:(0,Z.memo)(mi),BottomPanelOutlet:(0,Z.memo)(hi),RightPanel:ri,RightPanelTabs:(0,Z.memo)(ii),RightPanelTabsEmptyState:(0,Z.memo)(ai),RightPanelTabListAfter:(0,Z.memo)(si),RightPanelTabListAfterSticky:(0,Z.memo)(li),RightPanelTabListBefore:(0,Z.memo)(ci),RightPanelOutlet:(0,Z.memo)(oi)};export{Gt as C,Kt as S,On as _,qn as a,An as b,Wn as c,Ln as d,Rn as f,Nn as g,Pn as h,$n as i,Un as l,Fn as m,Dr as n,Gn as o,In as p,cr as r,Kn as s,wi as t,Bn as u,kn as v,En as x,Dn as y}; //# sourceMappingURL=app-shell-D7yvB1FT.js.map \ No newline at end of file diff --git a/desktop/recovered/app-asar-extracted/webview/assets/login-route-36U3XA9s.js b/desktop/recovered/app-asar-extracted/webview/assets/login-route-36U3XA9s.js index 10f51749..05e7c94a 100644 --- a/desktop/recovered/app-asar-extracted/webview/assets/login-route-36U3XA9s.js +++ b/desktop/recovered/app-asar-extracted/webview/assets/login-route-36U3XA9s.js @@ -1,2 +1,2 @@ -import{s as e}from"./chunk-Bj-mKKzh.js";import{vn as t}from"./src-CYrn1fYL.js";import{Cs as n,Es as r,Ho as i,bc as a,ia as o,ws as s}from"./app-server-manager-signals-BOGyjFm3.js";import{n as c,t as l}from"./jsx-runtime-CiQ1k8xo.js";import"./react-dom-CvzHKZGB.js";import"./marked.esm-BR-H6018.js";import{A as u,F as d,I as f,f as p,h as m,lt as h,n as g,r as _}from"./vscode-api-sUstfl-x.js";import{i as v}from"./react-v2Nz4MGb.js";import{c as y,o as b}from"./lib-MoKmYgcO.js";import{m as x}from"./chunk-LFPYN7LY-DwFbyqR1.js";import{h as S}from"./persisted-signal-Cx1QgqJn.js";import"./rpc-y95ESgjb.js";import{c as C,i as w,n as T,o as E,u as D,v as O}from"./statsig-Cajk3UKk.js";import"./request-BXHjsnqU.js";import"./app-server-manager-hooks-BJ2CaNwA.js";import{t as k}from"./use-global-state-DeR7WgiQ.js";import"./invalidate-queries-and-broadcast-dPfhRWCd.js";import"./thread-context-inputs-BUuWvrJW.js";import"./config-queries-BDIsZFnB.js";import"./remote-connection-visibility-CDSfTp_2.js";import"./sidebar-signals-B0JkGccK.js";import{n as A}from"./use-is-copilot-api-available-4vxhZax2.js";import{t as j}from"./use-auth-DXLjX3T4.js";import{r as M}from"./toast-signal-By11REe1.js";import"./route-scope-BCJTBhwV.js";import{t as N}from"./button-Xd4Hy1MO.js";import"./setting-storage-Cel8Tr7E.js";import"./reduced-motion-preference-BEImGcUg.js";import{t as P}from"./spinner-Dvc_A3Ae.js";import"./os-info-_sbi_vi2.js";import"./use-os-info-COk5WlgW.js";import{t as F}from"./link-external-oqLWmWWX.js";import"./app-shell-state-B5MFb4Nm.js";import{c as I,l as ee,m as te,s as ne}from"./onboarding-state-C29ET4Cr.js";import"./use-platform-BkwBnkgx.js";import"./terminal-CsU-mb2r.js";import"./with-window-DPMmD2K-.js";import"./image-square-DpHX97RA.js";import"./codex-C1u5S_iM.js";import{t as L}from"./openai-blossom-DWhxKWUa.js";import{t as re}from"./copy-to-clipboard-q_KxH8lM.js";import{t as R}from"./check-md-CZTnvSiA.js";import"./homepage-logo-C4Z1mn1w.js";import"./checkbox-Bz6PC7ig.js";import"./minus-COQFKeWQ.js";import"./clock-CDmkoq1h.js";import"./search-mcwajolX.js";import"./globe-DyuVFbAy.js";import{t as z}from"./copy-Bnv7rlOa.js";import{t as B}from"./codex-app-ga-logo-Ce-JNlBO.js";import{a as V}from"./onboarding-shell-B5Vl8B3_.js";import"./animated-icon-BEOZWoU_.js";import"./tasks-DKnnCbd7.js";import"./chatgpt-token-auth.browser-BZtEK2Ww.js";import{n as ie,r as ae,t as H}from"./onboarding-login-content-DhtcviP9.js";import{n as U,t as W}from"./use-ascii-engine-BUObtFzM.js";var G=h(),K=e(c(),1),q=l();function oe(){let e=d(m),n=j(),r=x(),s=y(),[c,l]=(0,K.useState)(null),u=c!=null,f=A(),[h,_]=(0,K.useState)(!1),[v,S]=(0,K.useState)(!1),[C,w]=(0,K.useState)(null),[T,D]=(0,K.useState)(``),[O,N]=(0,K.useState)(!1),P=(0,K.useRef)(null),F=E(`900122030`),I=t=>{let n=s.formatMessage({id:`codex.signInFailed.message`,defaultMessage:`Sign-in failed: {rawMessage}`,description:`Sign-in failure toast message with error details`},{rawMessage:t});e.get(M).warning(n)};(0,K.useEffect)(()=>{h&&(P.current?.focus(),P.current?.select())},[h]),(0,K.useEffect)(()=>{let e=!1;return(async()=>{try{let t=await g(`openai-api-key`);if(e)return;let n=t?.value??null;w(n),D(e=>e.length>0?e:n??``)}catch{e||w(null)}})(),()=>{e=!0}},[]);let ee=async()=>{if(u){c?.abortController.abort(),l(null);return}let e=new AbortController;l({abortController:e,kind:`browserRedirect`});try{let{authUrl:i,completion:a}=await ae({signal:e.signal});i&&p.dispatchMessage(`open-in-browser`,{url:i,useExternalBrowser:!0});let o=await a;o.success?(n.setAuthMethod(`chatgpt`),r(`/first-run`)):I(t(o.error??`Unknown error`))}catch(e){if(e instanceof Error&&e.name===`AbortError`)return;I(t(e))}finally{l(null)}},te=async()=>{if(!F)return;if(u){c?.abortController.abort(),l(null);return}let e=new AbortController;S(!0),l({abortController:e,kind:`deviceCode`});try{let{verificationUrl:i,userCode:a,completion:o}=await ie({signal:e.signal});if(e.signal.aborted)return;l(t=>t?.abortController===e?{...t,verificationUrl:i,userCode:a}:t),p.dispatchMessage(`open-in-browser`,{url:i,useExternalBrowser:!0});let s=await o;s.success?(n.setAuthMethod(`chatgpt`),r(`/first-run`)):I(t(s.error??`Unknown error`))}catch(e){if(e instanceof Error&&e.name===`AbortError`)return;I(t(e))}finally{l(null)}},ne=async t=>{if(t.length!==0)try{await re(t),e.get(M).success(s.formatMessage({id:`codex.loggedOut.deviceCode.copySuccess`,defaultMessage:`Copied device code`,description:`Toast shown after copying the device code`}))}catch{e.get(M).warning(s.formatMessage({id:`codex.loggedOut.deviceCode.copyFailed`,defaultMessage:`Could not copy device code`,description:`Toast shown when copying the device code fails`}))}},{data:L}=k(`show-copilot-login-first`),R=async()=>{await o(e,`use-copilot-auth-if-available`,!0),n.setAuthMethod(`copilot`),r(`/first-run`)},z=async()=>{let e=T.trim();if(!(!e||O)){N(!0);try{await a(`login-with-api-key`,{hostId:i,apiKey:e}),n.setAuthMethod(`apikey`),r(`/first-run`)}catch(e){I(t(e))}finally{N(!1)}}},B=!f||!L?(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(Y,{isPrimary:!0,handleChatGptSignIn:ee,isChatGptSignInPending:u}),!u&&f&&(0,q.jsx)(`div`,{className:`pt-2`,children:(0,q.jsx)(X,{isPrimary:!1,handleCopilotSignIn:R})})]}):(0,q.jsxs)(q.Fragment,{children:[!u&&(0,q.jsx)(X,{isPrimary:!0,handleCopilotSignIn:R}),(0,q.jsx)(`div`,{className:`pt-2`,children:(0,q.jsx)(Y,{isPrimary:!1,handleChatGptSignIn:ee,isChatGptSignInPending:u})})]}),V=c?.kind===`deviceCode`?c:null;return(0,q.jsxs)(`div`,{className:`fixed inset-0 overflow-hidden bg-token-side-bar-background`,children:[(0,q.jsx)(`div`,{className:`pointer-events-none absolute inset-0`,children:(0,q.jsx)(`div`,{className:`-ml-6 h-full w-full`,style:{WebkitMaskImage:`radial-gradient(ellipse at center, rgba(0,0,0,1) 25%, rgba(0,0,0,0.6) 30%, rgba(0,0,0,0) 50%)`,maskImage:`radial-gradient(ellipse at center, rgba(0,0,0,1) 35%, rgba(0,0,0,0.6) 60%, rgba(0,0,0,0) 78%)`,WebkitMaskRepeat:`no-repeat`,maskRepeat:`no-repeat`,WebkitMaskSize:`100% 100%`,maskSize:`100% 100%`},children:(0,q.jsx)(J,{})})}),(0,q.jsx)(`div`,{className:`relative z-10 flex h-full justify-center px-4 py-6 sm:py-8`,children:(0,q.jsxs)(`div`,{className:`flex h-full w-full max-w-[360px] flex-col`,children:[(0,q.jsx)(`div`,{className:`flex min-h-0 flex-1 items-center justify-center`,children:(0,q.jsx)(`h1`,{className:`text-center text-3xl leading-tight font-medium text-token-foreground`,children:(0,q.jsx)(b,{id:`codex.loggedOut.title`,defaultMessage:`Codex`,description:`Title on logged out screen`})})}),(0,q.jsxs)(`div`,{className:`flex min-h-[192px] flex-col justify-end gap-4 pb-2 sm:pb-0`,children:[!h&&V==null&&(0,q.jsx)(`div`,{className:`flex w-full justify-center`,children:(0,q.jsxs)(`div`,{className:`mx-auto inline-flex w-max flex-col items-stretch`,children:[B,!u&&(0,q.jsx)(de,{setApiKeyValue:D,defaultApiKeyFromEnv:C,setIsApiKeySignInVisible:_}),!u&&F&&(0,q.jsx)(ce,{isVisible:v,onToggle:()=>{S(e=>!e)},children:(0,q.jsx)(se,{handleChatGptDeviceCodeSignIn:te})})]})}),V!=null&&(0,q.jsx)(he,{verificationUrl:V.verificationUrl??``,userCode:V.userCode??``,onOpenBrowser:()=>{let e=V.verificationUrl;e&&p.dispatchMessage(`open-in-browser`,{url:e,useExternalBrowser:!0})},onCopyCode:ne,onCancel:()=>{V.abortController.abort(),l(null)}}),!u&&h&&(0,q.jsx)(fe,{apiKeyValue:T,setApiKeyValue:D,apiKeyInputRef:P,isApiKeyLoginPending:O,setIsApiKeyLoginPending:N,setIsApiKeySignInVisible:_,handleApiKeySubmit:z})]})]})})]})}var J=K.memo(function(){let e=(0,G.c)(5),t;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t={initialColumns:130,initialRows:100,initialMode:`composite`,preferredVideoKeyword:`blossom`},e[0]=t):t=e[0];let{columns:n,rows:r,lines:i}=W(t),a;return e[1]!==n||e[2]!==i||e[3]!==r?(a=(0,q.jsx)(U,{lines:i,columns:n,rows:r,autoCover:!0}),e[1]=n,e[2]=i,e[3]=r,e[4]=a):a=e[4],a});function Y(e){let t=(0,G.c)(6),{isPrimary:n,handleChatGptSignIn:r,isChatGptSignInPending:i}=e,a;t[0]===i?a=t[1]:(a=i?(0,q.jsx)(b,{id:`codex.loggedOut.signIn.cancel`,defaultMessage:`Cancel Sign-in`,description:`Cancel button for sign in`}):(0,q.jsx)(b,{id:`codex.loggedOut.signIn`,defaultMessage:`Sign in with ChatGPT`,description:`Sign in button text on logged out screen`}),t[0]=i,t[1]=a);let o;return t[2]!==r||t[3]!==n||t[4]!==a?(o=(0,q.jsx)(Z,{isPrimary:n,onClick:r,children:a}),t[2]=r,t[3]=n,t[4]=a,t[5]=o):o=t[5],o}function X(e){let t=(0,G.c)(4),{isPrimary:n,handleCopilotSignIn:r}=e,i;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,q.jsx)(b,{id:`codex.loggedOut.signInWithCopilot`,defaultMessage:`Sign in with GitHub Copilot`,description:`Button label for GitHub Copilot sign-in on logged out screen`}),t[0]=i):i=t[0];let a;return t[1]!==r||t[2]!==n?(a=(0,q.jsx)(Z,{isPrimary:n,onClick:r,children:i}),t[1]=r,t[2]=n,t[3]=a):a=t[3],a}function se(e){let t=(0,G.c)(3),{handleChatGptDeviceCodeSignIn:n}=e,r;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,q.jsx)(b,{id:`codex.loggedOut.signInWithDeviceCode`,defaultMessage:`Use device code`,description:`Secondary button to sign in with a device code`}),t[0]=r):r=t[0];let i;return t[1]===n?i=t[2]:(i=(0,q.jsx)(Z,{isPrimary:!1,onClick:n,children:r}),t[1]=n,t[2]=i),i}function ce(e){let t=(0,G.c)(17),{isVisible:n,onToggle:r,children:i}=e,a=!n,o=n?`1fr`:`0fr`,s=n?1:0,c;t[0]!==o||t[1]!==s?(c={gridTemplateRows:o,opacity:s},t[0]=o,t[1]=s,t[2]=c):c=t[2];let l;t[3]===i?l=t[4]:(l=(0,q.jsx)(`div`,{className:`overflow-hidden`,children:(0,q.jsx)(`div`,{className:`pb-2`,children:i})}),t[3]=i,t[4]=l);let u;t[5]!==a||t[6]!==c||t[7]!==l?(u=(0,q.jsx)(`div`,{className:`grid transition-[grid-template-rows,opacity] duration-200 ease-out`,"aria-hidden":a,style:c,children:l}),t[5]=a,t[6]=c,t[7]=l,t[8]=u):u=t[8];let d;t[9]===n?d=t[10]:(d=n?(0,q.jsx)(b,{id:`codex.loggedOut.lessOptions`,defaultMessage:`Less options`,description:`Button label to hide additional sign-in methods`}):(0,q.jsx)(b,{id:`codex.loggedOut.moreOptions`,defaultMessage:`More options`,description:`Button label to reveal additional sign-in methods`}),t[9]=n,t[10]=d);let f;t[11]!==r||t[12]!==d?(f=(0,q.jsx)(`div`,{className:`flex justify-center`,children:(0,q.jsx)(`button`,{type:`button`,className:`cursor-interaction text-center text-sm text-token-description-foreground hover:underline`,onClick:r,children:d})}),t[11]=r,t[12]=d,t[13]=f):f=t[13];let p;return t[14]!==u||t[15]!==f?(p=(0,q.jsxs)(`div`,{className:`pt-2`,children:[u,f]}),t[14]=u,t[15]=f,t[16]=p):p=t[16],p}var le=`w-full cursor-interaction justify-center !rounded-full border px-4 py-2 font-medium`,ue=`bg-token-foreground/10 w-full justify-center !rounded-full px-4 py-2 font-medium backdrop-blur-md`;function Z(e){let t=(0,G.c)(5),{isPrimary:n,onClick:r,children:i}=e,a=n?`primary`:`outline`,o=n?le:ue,s;return t[0]!==i||t[1]!==r||t[2]!==a||t[3]!==o?(s=(0,q.jsx)(N,{color:a,className:o,onClick:r,children:i}),t[0]=i,t[1]=r,t[2]=a,t[3]=o,t[4]=s):s=t[4],s}function de(e){let t=(0,G.c)(7),{setApiKeyValue:n,defaultApiKeyFromEnv:r,setIsApiKeySignInVisible:i}=e,a;t[0]!==r||t[1]!==n||t[2]!==i?(a=()=>{i(!0),n(e=>e.length>0?e:r??``)},t[0]=r,t[1]=n,t[2]=i,t[3]=a):a=t[3];let o;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,q.jsx)(b,{id:`codex.loggedOut.useApiKey`,defaultMessage:`Use API Key`,description:`Secondary button to use API Key auth method`}),t[4]=o):o=t[4];let s;return t[5]===a?s=t[6]:(s=(0,q.jsx)(`div`,{className:`pt-2`,children:(0,q.jsx)(N,{color:`outline`,className:`w-full justify-center !rounded-full bg-token-foreground/10 px-4 py-2 font-medium backdrop-blur-md`,onClick:a,children:o})}),t[5]=a,t[6]=s),s}function fe(e){let t=(0,G.c)(32),{apiKeyValue:n,setApiKeyValue:r,apiKeyInputRef:i,isApiKeyLoginPending:a,setIsApiKeyLoginPending:o,setIsApiKeySignInVisible:s,handleApiKeySubmit:c}=e,l=y(),u;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(u=(0,q.jsx)(b,{id:`codex.loggedOut.apiKeyPrompt.inputLabel`,defaultMessage:`Enter your OpenAI API key`,description:`Label for API key input`}),t[0]=u):u=t[0];let d;t[1]===l?d=t[2]:(d=l.formatMessage({id:`codex.loggedOut.apiKeyPrompt.placeholder`,defaultMessage:`sk-...`,description:`Placeholder text hint for API key input field`}),t[1]=l,t[2]=d);let f;t[3]===r?f=t[4]:(f=e=>{r(e.target.value)},t[3]=r,t[4]=f);let p;t[5]!==i||t[6]!==n||t[7]!==d||t[8]!==f?(p=(0,q.jsxs)(`label`,{className:`block text-sm text-token-foreground`,children:[u,(0,q.jsx)(`input`,{ref:i,className:`mt-4 w-full rounded-lg border border-token-border bg-token-input-background px-3 py-2 text-sm text-token-foreground focus:border-token-focus-border focus:outline-none`,placeholder:d,value:n,onChange:f,onFocus:me})]}),t[5]=i,t[6]=n,t[7]=d,t[8]=f,t[9]=p):p=t[9];let m;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(m=(0,q.jsx)(`p`,{className:`mt-3 text-[10px] text-token-description-foreground`,children:(0,q.jsx)(b,{id:`codex.loggedOut.cloudTasksDisabledWithApiKey`,defaultMessage:`Cloud tasks disabled with API key`,description:`Disclaimer explaining that remote features need ChatGPT sign-in`})}),t[10]=m):m=t[10];let h;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(h=(0,q.jsxs)(`button`,{type:`button`,className:`inline-flex cursor-interaction items-center gap-1 text-sm text-token-text-link-foreground hover:underline max-[280px]:hidden`,onClick:pe,children:[(0,q.jsx)(b,{id:`codex.loggedOut.apiKeyPrompt.getKey`,defaultMessage:`Get API Key`,description:`Button to open OpenAI API key management page`}),(0,q.jsx)(F,{"aria-hidden":`true`,className:`icon-2xs`})]}),t[11]=h):h=t[11];let g;t[12]!==o||t[13]!==s?(g=()=>{o(!1),s(!1)},t[12]=o,t[13]=s,t[14]=g):g=t[14];let _;t[15]===Symbol.for(`react.memo_cache_sentinel`)?(_=(0,q.jsx)(b,{id:`codex.loggedOut.apiKeyPrompt.cancel`,defaultMessage:`Cancel`,description:`Cancel button for API key login`}),t[15]=_):_=t[15];let v;t[16]===g?v=t[17]:(v=(0,q.jsx)(N,{color:`ghost`,onClick:g,children:_}),t[16]=g,t[17]=v);let x;t[18]!==n||t[19]!==a?(x=n.trim().length===0||a,t[18]=n,t[19]=a,t[20]=x):x=t[20];let S;t[21]===Symbol.for(`react.memo_cache_sentinel`)?(S=(0,q.jsx)(b,{id:`codex.loggedOut.apiKeyPrompt.confirm`,defaultMessage:`OK`,description:`Confirm button for API key login`}),t[21]=S):S=t[21];let C;t[22]!==c||t[23]!==a||t[24]!==x?(C=(0,q.jsx)(N,{className:`px-4`,onClick:c,disabled:x,loading:a,children:S}),t[22]=c,t[23]=a,t[24]=x,t[25]=C):C=t[25];let w;t[26]!==C||t[27]!==v?(w=(0,q.jsxs)(`div`,{className:`mt-4 flex items-center justify-end gap-2 min-[280px]:justify-between`,children:[h,(0,q.jsxs)(`div`,{className:`flex justify-end gap-2`,children:[v,C]})]}),t[26]=C,t[27]=v,t[28]=w):w=t[28];let T;return t[29]!==w||t[30]!==p?(T=(0,q.jsxs)(`div`,{className:`w-full rounded-2xl border border-token-border bg-token-dropdown-background/80 px-4 py-4 backdrop-blur-lg`,children:[p,m,w]}),t[29]=w,t[30]=p,t[31]=T):T=t[31],T}function pe(){p.dispatchMessage(`open-in-browser`,{url:`https://platform.openai.com/api-keys`,useExternalBrowser:!0})}function me(e){e.currentTarget.select()}function he(e){let t=(0,G.c)(38),{verificationUrl:n,userCode:r,onOpenBrowser:i,onCopyCode:a,onCancel:o}=e,s=y(),c=r.length>0?r:`......`,[l,u]=(0,K.useState)(!1),d;t[0]!==s||t[1]!==l?(d=l?s.formatMessage({id:`codex.loggedOut.deviceCode.copyAriaLabel.copied`,defaultMessage:`Copied`,description:`Aria label for the copied state of the device code copy affordance on the logged out screen`}):s.formatMessage({id:`codex.loggedOut.deviceCode.copyAriaLabel.copy`,defaultMessage:`Copy`,description:`Aria label for the device code copy affordance on the logged out screen`}),t[0]=s,t[1]=l,t[2]=d):d=t[2];let f=d,p;t[3]!==a||t[4]!==r?(p=()=>{r.length!==0&&(a(r),u(!0),window.setTimeout(()=>{u(!1)},2e3))},t[3]=a,t[4]=r,t[5]=p):p=t[5];let m=p,h;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(h=(0,q.jsx)(`p`,{className:`text-sm text-token-foreground`,children:(0,q.jsx)(b,{id:`codex.loggedOut.deviceCode.instructions`,defaultMessage:`To use a device code to log in, click the open browser button and paste the code below.`,description:`Instructions shown while a device code login is in progress`})}),t[6]=h):h=t[6];let g;t[7]===m?g=t[8]:(g=e=>{(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),m())},t[7]=m,t[8]=g);let _;t[9]===m?_=t[10]:(_=e=>{e.stopPropagation(),m()},t[9]=m,t[10]=_);let v;t[11]===l?v=t[12]:(v=l?(0,q.jsx)(R,{className:`icon-sm text-token-foreground`}):(0,q.jsx)(z,{className:`icon-sm`}),t[11]=l,t[12]=v);let x;t[13]!==f||t[14]!==_||t[15]!==v?(x=(0,q.jsx)(`div`,{className:`absolute top-2 right-2 opacity-100 transition-opacity sm:opacity-0 sm:group-focus-within:opacity-100 sm:group-hover:opacity-100`,children:(0,q.jsx)(N,{color:`ghost`,size:`icon`,className:`rounded-md`,"aria-label":f,onClick:_,children:v})}),t[13]=f,t[14]=_,t[15]=v,t[16]=x):x=t[16];let S;t[17]===Symbol.for(`react.memo_cache_sentinel`)?(S=(0,q.jsx)(`p`,{className:`text-xs font-medium tracking-[0.2em] text-token-description-foreground uppercase`,children:(0,q.jsx)(b,{id:`codex.loggedOut.deviceCode.codeLabel`,defaultMessage:`Device code`,description:`Label above the user code shown during device code sign in`})}),t[17]=S):S=t[17];let C;t[18]===c?C=t[19]:(C=(0,q.jsx)(`p`,{className:`mt-2 overflow-x-auto text-center font-mono text-[28px] font-semibold tracking-[0.12em] whitespace-nowrap text-token-foreground`,children:c}),t[18]=c,t[19]=C);let w;t[20]!==m||t[21]!==g||t[22]!==x||t[23]!==C?(w=(0,q.jsxs)(`div`,{className:`group relative rounded-xl border border-token-border bg-token-input-background px-3 py-3`,role:`button`,tabIndex:0,onClick:m,onKeyDown:g,children:[x,S,C]}),t[20]=m,t[21]=g,t[22]=x,t[23]=C,t[24]=w):w=t[24];let T;t[25]===Symbol.for(`react.memo_cache_sentinel`)?(T=(0,q.jsx)(b,{id:`codex.loggedOut.deviceCode.cancel`,defaultMessage:`Cancel`,description:`Button to cancel a device code login`}),t[25]=T):T=t[25];let E;t[26]===o?E=t[27]:(E=(0,q.jsx)(N,{color:`ghost`,onClick:o,children:T}),t[26]=o,t[27]=E);let D=n.length===0,O;t[28]===Symbol.for(`react.memo_cache_sentinel`)?(O=(0,q.jsx)(b,{id:`codex.loggedOut.deviceCode.openBrowser`,defaultMessage:`Open browser`,description:`Button to open the device code verification page`}),t[28]=O):O=t[28];let k;t[29]!==i||t[30]!==D?(k=(0,q.jsx)(N,{onClick:i,disabled:D,children:O}),t[29]=i,t[30]=D,t[31]=k):k=t[31];let A;t[32]!==E||t[33]!==k?(A=(0,q.jsxs)(`div`,{className:`flex w-full flex-wrap items-center justify-between gap-2`,children:[E,k]}),t[32]=E,t[33]=k,t[34]=A):A=t[34];let j;return t[35]!==w||t[36]!==A?(j=(0,q.jsx)(`div`,{className:`w-full rounded-2xl border border-token-border bg-token-dropdown-background/80 px-4 py-4 backdrop-blur-lg`,children:(0,q.jsxs)(`div`,{className:`space-y-3`,children:[h,w,A]})}),t[35]=w,t[36]=A,t[37]=j):j=t[37],j}var Q=12,$=18,ge=120,_e={up:{x:0,y:-1},down:{x:0,y:1},left:{x:-1,y:0},right:{x:1,y:0}},ve={up:`down`,down:`up`,left:`right`,right:`left`};function ye(e){let t=(0,G.c)(21),{onExit:n,audioContextRef:r}=e,i=(0,K.useRef)(null),a=(0,K.useRef)(null),o=(0,K.useRef)(null),s;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(s=[],t[0]=s):s=t[0];let c=(0,K.useRef)(s),l;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(l={x:0,y:0},t[1]=l):l=t[1];let u=(0,K.useRef)(l),d=(0,K.useRef)(`right`),f=(0,K.useRef)(`right`),p;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(p={columns:Q,rows:Q,cellSize:$,width:Q*$,height:Q*$},t[2]=p):p=t[2];let m=(0,K.useRef)(p),h=(0,K.useRef)(null),g=(0,K.useEffectEvent)(n),_;t[3]===r?_=t[4]:(_=(e,t,n)=>{if(r.current==null)return;let i=r.current;i.state===`suspended`&&i.resume();let a=t/1e3,o=i.createOscillator(),s=i.createGain();o.type=n,o.frequency.value=e,s.gain.setValueAtTime(1e-4,i.currentTime),s.gain.exponentialRampToValueAtTime(.18,i.currentTime+.01),s.gain.exponentialRampToValueAtTime(1e-4,i.currentTime+a),o.connect(s),s.connect(i.destination),o.start(),o.stop(i.currentTime+a),o.onended=()=>{o.disconnect(),s.disconnect()}},t[3]=r,t[4]=_);let v=(0,K.useEffectEvent)(_),y;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(y=()=>{o.current!=null&&(window.clearInterval(o.current),o.current=null)},t[5]=y):y=t[5];let b=y,x;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(x=()=>{if(h.current)return h.current;let e=i.current;if(e==null)return{snake:`#ffffff`,food:`#f97316`};let t=getComputedStyle(e).color||`#ffffff`,n=getComputedStyle(document.documentElement),r={snake:t,food:n.getPropertyValue(`--vscode-charts-red`).trim()||n.getPropertyValue(`--vscode-charts-orange`).trim()||`#f97316`};return h.current=r,r},t[6]=x):x=t[6];let S=x,C;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(C=()=>{if(i.current==null)return null;let e=Math.max(1,Math.floor(window.devicePixelRatio||1));i.current.width=Math.max(1,Math.floor(m.current.width*e)),i.current.height=Math.max(1,Math.floor(m.current.height*e)),i.current.style.width=`${m.current.width}px`,i.current.style.height=`${m.current.height}px`;let t=i.current.getContext(`2d`);return t==null?null:(t.setTransform(e,0,0,e,0,0),t.imageSmoothingEnabled=!1,t)},t[7]=C):C=t[7];let w=C,T;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(T=e=>{let t={x:Math.floor(Math.random()*m.current.columns),y:Math.floor(Math.random()*m.current.rows)};for(;e.some(e=>e.x===t.x&&e.y===t.y);)t={x:Math.floor(Math.random()*m.current.columns),y:Math.floor(Math.random()*m.current.rows)};return t},t[8]=T):T=t[8];let E=T,D;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(D=()=>{let e=w();if(e==null)return;let t=S();e.clearRect(0,0,m.current.width,m.current.height),e.fillStyle=t.snake;for(let t of c.current)e.fillRect(t.x*m.current.cellSize,t.y*m.current.cellSize,m.current.cellSize,m.current.cellSize);e.fillStyle=t.food,e.fillRect(u.current.x*m.current.cellSize,u.current.y*m.current.cellSize,m.current.cellSize,m.current.cellSize)},t[9]=D):D=t[9];let O=(0,K.useEffectEvent)(D),k;t[10]===O?k=t[11]:(k=()=>{let e=Math.floor(m.current.columns/2),t=Math.floor(m.current.rows/2);c.current=[{x:e,y:t},{x:e-1,y:t},{x:e-2,y:t}],d.current=`right`,f.current=`right`,u.current=E(c.current),O()},t[10]=O,t[11]=k);let A=(0,K.useEffectEvent)(k),j;t[12]===A?j=t[13]:(j=()=>{if(a.current==null)return;let e=a.current.getBoundingClientRect(),t=Math.max(1,Math.floor(e.width)),n=Math.max(1,Math.floor(e.height)),r=Math.max(Q,Math.floor(t/$)),i=t/r;m.current={columns:r,rows:Math.max(Q,Math.floor(n/i)),cellSize:i,width:t,height:n},A()},t[12]=A,t[13]=j);let M=(0,K.useEffectEvent)(j),N;t[14]!==O||t[15]!==g||t[16]!==v||t[17]!==M?(N=()=>{M();let e=e=>{let t=null;e.key===`ArrowUp`||e.key===`w`||e.key===`W`?t=`up`:e.key===`ArrowDown`||e.key===`s`||e.key===`S`?t=`down`:e.key===`ArrowLeft`||e.key===`a`||e.key===`A`?t=`left`:(e.key===`ArrowRight`||e.key===`d`||e.key===`D`)&&(t=`right`),t!=null&&(e.preventDefault(),ve[d.current]!==t&&(f.current=t))};return window.addEventListener(`keydown`,e),o.current=window.setInterval(()=>{let e=c.current,t=e[0],n=f.current,r=_e[n],i={x:t.x+r.x,y:t.y+r.y};if(i.x<0||i.y<0||i.x>=m.current.columns||i.y>=m.current.rows){b(),v(140,220,`sawtooth`),g();return}let a=i.x===u.current.x&&i.y===u.current.y;if((a?e:e.slice(0,-1)).some(e=>e.x===i.x&&e.y===i.y)){b(),v(160,220,`sawtooth`),g();return}let o=a?[i,...e]:[i,...e.slice(0,-1)];c.current=o,d.current=n,a&&(u.current=E(o),v(660,120,`square`)),O()},ge),()=>{b(),window.removeEventListener(`keydown`,e)}},t[14]=O,t[15]=g,t[16]=v,t[17]=M,t[18]=N):N=t[18];let P;t[19]===Symbol.for(`react.memo_cache_sentinel`)?(P=[],t[19]=P):P=t[19],(0,K.useEffect)(N,P);let F;return t[20]===Symbol.for(`react.memo_cache_sentinel`)?(F=(0,q.jsx)(`div`,{className:`h-full w-full`,ref:a,children:(0,q.jsx)(`canvas`,{className:`h-full w-full text-token-foreground`,ref:i})}),t[20]=F):F=t[20],F}var be=O(),xe=`https://chatgpt.com/codex/desktop-auth`,Se=`codex_streamlined_login`,Ce=`client-sYWqzCYMRkUg4DqqiZcR5DGTNl2iD7zNJY0HoeDLzxR`,we=`codex_origin_stable_id`;function Te({authUrl:e,codexOriginStableId:t=be.StableID.get(Ce),includeCodexOriginStableId:n=!1,useDesktopAuth:r,useStreamlinedLoginUx:i}){if(!n&&!r&&!i)return e;try{let a=new URL(e);if(n&&t&&a.searchParams.set(we,t),a.pathname===`/codex/desktop-auth`)return i&&a.searchParams.set(Se,`true`),a.toString();if(i&&a.searchParams.set(Se,`true`),!r)return a.toString();let o=new URL(xe);return o.searchParams.set(`authorize_url`,a.toString()),i&&o.searchParams.set(Se,`true`),o.toString()}catch{return e}}var Ee=`3446609779`,De=`1561420571`;function Oe(e){let t=e.get(`enabled`,!1);return{useDesktopAuth:e.get(`use_desktop_auth`,t),useStreamlinedLoginUx:e.get(`use_streamlined_login_ux`,t)}}function ke(e){return e}function Ae(e,t){if(t===`signin`)return e;try{let n=new URL(e);switch(t){case`signup`:n.searchParams.set(`screen_hint`,`signup`);break;case`google`:n.searchParams.set(`screen_hint`,`login_or_signup`),n.searchParams.set(`connection`,`google-oauth2`);break;case`microsoft`:n.searchParams.set(`screen_hint`,`login_or_signup`),n.searchParams.set(`connection`,`windowslive`);break}return n.toString()}catch{return e}}var je=e=>(0,q.jsxs)(`svg`,{height:24,viewBox:`0 0 24 24`,width:24,xmlns:`http://www.w3.org/2000/svg`,...e,children:[(0,q.jsx)(`path`,{d:`M22.56 12.25c0-.78-.07-1.53-.2-2.25H12v4.26h5.92c-.26 1.37-1.04 2.53-2.21 3.31v2.77h3.57c2.08-1.92 3.28-4.74 3.28-8.09z`,fill:`#4285F4`}),(0,q.jsx)(`path`,{d:`M12 23c2.97 0 5.46-.98 7.28-2.66l-3.57-2.77c-.98.66-2.23 1.06-3.71 1.06-2.86 0-5.29-1.93-6.16-4.53H2.18v2.84C3.99 20.53 7.7 23 12 23z`,fill:`#34A853`}),(0,q.jsx)(`path`,{d:`M5.84 14.09c-.22-.66-.35-1.36-.35-2.09s.13-1.43.35-2.09V7.07H2.18C1.43 8.55 1 10.22 1 12s.43 3.45 1.18 4.93l2.85-2.22.81-.62z`,fill:`#FBBC05`}),(0,q.jsx)(`path`,{d:`M12 5.38c1.62 0 3.06.56 4.21 1.64l3.15-3.15C17.45 2.09 14.97 1 12 1 7.7 1 3.99 3.47 2.18 7.07l3.66 2.84c.87-2.6 3.3-4.53 6.16-4.53z`,fill:`#EA4335`}),(0,q.jsx)(`path`,{d:`M1 1h22v22H1z`,fill:`none`})]}),Me=e=>(0,q.jsxs)(`svg`,{width:24,height:24,viewBox:`0 0 24 24`,fill:`none`,xmlns:`http://www.w3.org/2000/svg`,...e,children:[(0,q.jsx)(`path`,{d:`M3.25 3.25H11.25V11.25H3.25V3.25Z`,fill:`#F35325`}),(0,q.jsx)(`path`,{d:`M12.75 3.25H20.75V11.25H12.75V3.25Z`,fill:`#81BC06`}),(0,q.jsx)(`path`,{d:`M3.25 12.75H11.25V20.75H3.25V12.75Z`,fill:`#05A6F0`}),(0,q.jsx)(`path`,{d:`M12.75 12.75H20.75V20.75H12.75V12.75Z`,fill:`#FFBA08`})]});function Ne(e){let t=(0,G.c)(40),{apiKeyValue:n,isApiKeyEntryVisible:r,isApiKeySignInPending:i,isChatGptSignInPending:a,showChatGptProviderSignIn:o,onApiKeySubmit:s,onApiKeyValueChange:c,onChatGptSignIn:l,onChatGptSignUp:u,onPlaySnake:d,onResetApiKeyEntry:f,onShowApiKeyEntry:p}=e,m=y(),h=D(`2523619087`),g;t[0]===h?g=t[1]:(g=h.get(`enabled`,!1),t[0]=h,t[1]=g);let _=g;if(a&&!r){let e;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,q.jsx)(`img`,{src:B,className:`size-[52px] shrink-0`,draggable:!1,alt:``,"aria-hidden":`true`}),t[2]=e):e=t[2];let n;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,q.jsx)(`p`,{className:`text-center text-[14px] leading-5 font-normal tracking-[-0.18px] text-token-description-foreground`,children:(0,q.jsx)(b,{id:`electron.onboarding.login.browserPending.welcomeV2`,defaultMessage:`Continue signing in with your browser`,description:`Message shown while ChatGPT sign-in continues in the browser`})}),t[3]=n):n=t[3];let r;t[4]===l?r=t[5]:(r=()=>l(),t[4]=l,t[5]=r);let i;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,q.jsx)(b,{id:`electron.onboarding.login.chatgpt.cancel.welcomeV2`,defaultMessage:`Cancel sign-in`,description:`Cancel button label while ChatGPT sign-in is in progress on desktop onboarding`}),t[6]=i):i=t[6];let a;return t[7]===r?a=t[8]:(a=(0,q.jsx)(`div`,{className:`flex h-full w-full items-center justify-center overflow-hidden bg-token-main-surface-primary pb-12 text-token-foreground`,children:(0,q.jsxs)(`div`,{className:`flex w-[340px] flex-col items-center gap-8`,children:[e,n,(0,q.jsx)(`button`,{className:`flex h-[42px] w-full cursor-interaction items-center justify-center rounded-full border border-token-border bg-token-main-surface-primary text-[14px] leading-5 font-medium text-token-description-foreground hover:bg-token-list-hover-background`,type:`button`,onClick:r,children:i})]})}),t[7]=r,t[8]=a),a}let v;t[9]===m?v=t[10]:(v=m.formatMessage({id:`electron.onboarding.login.snake.start`,defaultMessage:`Play Snake`,description:`Aria label for the Codex logo button to start Snake`}),t[9]=m,t[10]=v);let x;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(x=(0,q.jsx)(`img`,{src:B,className:`size-[52px] shrink-0`,draggable:!1,alt:``,"aria-hidden":`true`}),t[11]=x):x=t[11];let S;t[12]!==d||t[13]!==v?(S=(0,q.jsx)(`button`,{className:`group flex cursor-interaction items-center justify-center rounded-full`,type:`button`,"aria-label":v,onClick:d,children:x}),t[12]=d,t[13]=v,t[14]=S):S=t[14];let C,w;t[15]===_?(C=t[16],w=t[17]):(C=(0,q.jsx)(`h1`,{className:`w-[316px] text-[28px] leading-9 font-normal text-token-foreground`,children:_?(0,q.jsx)(b,{id:`electron.onboarding.login.welcomeV2.title.streamlined`,defaultMessage:`Welcome to Codex`,description:`Title on the v2 desktop onboarding login page for streamlined ChatGPT sign-in`}):(0,q.jsx)(b,{id:`electron.onboarding.login.welcomeV2.title`,defaultMessage:`Get started with Codex`,description:`Title on the v2 desktop onboarding login page`})}),w=_?(0,q.jsxs)(`div`,{className:`mt-4 flex items-center justify-center gap-1.5 rounded-full bg-[#4452ff]/[0.08] py-1 pr-3 pl-2.5 text-[13px] leading-5 font-normal tracking-[-0.078px] text-[#4452ff] dark:bg-[#4452ff]/25 dark:text-[#7882ff]`,children:[(0,q.jsx)(R,{className:`size-3.5 shrink-0`,"aria-hidden":`true`}),(0,q.jsx)(b,{id:`electron.onboarding.login.includedPlans.welcomeV2`,defaultMessage:`Included with all ChatGPT plans`,description:`Badge text on the v2 desktop onboarding login page indicating Codex is included with ChatGPT plans`})]}):null,t[15]=_,t[16]=C,t[17]=w);let T;t[18]!==C||t[19]!==w?(T=(0,q.jsxs)(`div`,{className:`flex w-full flex-col items-center text-center`,children:[C,w]}),t[18]=C,t[19]=w,t[20]=T):T=t[20];let E;t[21]!==S||t[22]!==T?(E=(0,q.jsxs)(`div`,{className:`flex w-full flex-col items-center gap-8`,children:[S,T]}),t[21]=S,t[22]=T,t[23]=E):E=t[23];let O;t[24]!==n||t[25]!==r||t[26]!==i||t[27]!==a||t[28]!==s||t[29]!==c||t[30]!==l||t[31]!==u||t[32]!==f||t[33]!==p||t[34]!==o||t[35]!==_?(O=r?(0,q.jsx)(`div`,{className:`w-full`,children:(0,q.jsx)(H,{apiKeyValue:n,isApiKeyEntryVisible:r,isApiKeySignInPending:i,isChatGptSignInPending:a,onApiKeySecondaryAction:f,onApiKeySubmit:s,onApiKeyValueChange:c,onChatGptSignIn:l,onShowApiKeyEntry:p,apiKeySecondaryActionLabel:(0,q.jsx)(b,{id:`electron.onboarding.login.apikey.cancel`,defaultMessage:`Cancel`,description:`Cancel button label for API key entry on desktop onboarding`})})}):(0,q.jsxs)(`div`,{className:`flex w-full flex-col items-center gap-3`,children:[(0,q.jsxs)(`button`,{className:`flex h-[48px] w-full cursor-interaction items-center justify-center gap-2 rounded-full border border-transparent bg-token-foreground text-[14px] leading-5 font-medium text-token-dropdown-background hover:bg-token-foreground/80`,type:`button`,onClick:()=>l(),children:[(0,q.jsx)(L,{className:`size-6 shrink-0 text-token-dropdown-background`}),_?(0,q.jsx)(b,{id:`electron.onboarding.login.chatgpt.signIn.streamlined`,defaultMessage:`Continue with ChatGPT`,description:`Button label for streamlined ChatGPT sign-in on desktop onboarding`}):(0,q.jsx)(b,{id:`electron.onboarding.login.chatgpt.signIn`,defaultMessage:`Sign in with ChatGPT`,description:`Button label to sign in with ChatGPT on desktop onboarding`})]}),o?(0,q.jsxs)(q.Fragment,{children:[(0,q.jsxs)(`button`,{className:`flex h-[46px] w-full cursor-interaction items-center justify-center gap-2 rounded-full border border-token-border bg-token-main-surface-primary text-[14px] leading-5 font-medium text-token-foreground hover:bg-token-list-hover-background`,type:`button`,onClick:()=>l(`google`),children:[(0,q.jsx)(je,{className:`size-5 shrink-0`,"aria-hidden":`true`}),(0,q.jsx)(b,{id:`electron.onboarding.login.google.signIn`,defaultMessage:`Continue with Google`,description:`Button label for Google sign-in on desktop onboarding`})]}),(0,q.jsxs)(`button`,{className:`flex h-[46px] w-full cursor-interaction items-center justify-center gap-2 rounded-full border border-token-border bg-token-main-surface-primary text-[14px] leading-5 font-medium text-token-foreground hover:bg-token-list-hover-background`,type:`button`,onClick:()=>l(`microsoft`),children:[(0,q.jsx)(Me,{className:`size-5 shrink-0`,"aria-hidden":`true`}),(0,q.jsx)(b,{id:`electron.onboarding.login.microsoft.signIn`,defaultMessage:`Continue with Microsoft`,description:`Button label for Microsoft sign-in on desktop onboarding`})]})]}):null,(0,q.jsx)(`button`,{className:`flex h-[46px] w-full cursor-interaction items-center justify-center rounded-full border border-token-border bg-token-main-surface-primary text-[14px] leading-5 font-medium text-token-foreground hover:bg-token-list-hover-background`,type:`button`,onClick:p,children:(0,q.jsx)(b,{id:`electron.onboarding.login.apikey.open.welcomeV2`,defaultMessage:`Sign in another way`,description:`Button label to open another sign-in method on v2 desktop onboarding`})}),(0,q.jsx)(`button`,{className:`flex h-9 cursor-interaction items-center justify-center px-2 text-[14px] leading-5 font-medium text-token-description-foreground underline hover:text-token-foreground`,type:`button`,onClick:u,children:(0,q.jsx)(b,{id:`electron.onboarding.login.signup.welcomeV2`,defaultMessage:`Sign up`,description:`Sign-up link on v2 desktop onboarding`})})]}),t[24]=n,t[25]=r,t[26]=i,t[27]=a,t[28]=s,t[29]=c,t[30]=l,t[31]=u,t[32]=f,t[33]=p,t[34]=o,t[35]=_,t[36]=O):O=t[36];let k;return t[37]!==E||t[38]!==O?(k=(0,q.jsx)(`div`,{className:`flex h-full w-full items-center justify-center overflow-hidden bg-token-main-surface-primary pb-6 text-token-foreground`,children:(0,q.jsxs)(`div`,{className:`flex w-[340px] flex-col items-center gap-8`,children:[E,O]})}),t[37]=E,t[38]=O,t[39]=k):k=t[39],k}function Pe(){let e=d(m),o=j(),c=x(),l=y(),h=u(),g=f(te),E=v(ne),O=v(I),k=v(ee),A=g==null?null:{hasPreviouslyCompletedOnboarding:g},N=C(),F=ke(D(De).get(`enabled`,!1)),L=t=>{e.get(M).warning(l.formatMessage({id:`electron.onboarding.login.error`,defaultMessage:`Sign-in failed: {rawMessage}`,description:`Toast shown when sign-in fails on the desktop onboarding page`},{rawMessage:t}))},[re,R]=(0,K.useState)(null),z=re!=null,[B,ie]=(0,K.useState)(!1),[H,U]=(0,K.useState)(!1),[W,G]=(0,K.useState)(``),[oe,J]=(0,K.useState)(!1),Y=(0,K.useRef)(null),X=()=>{O(!1),k(!0)},se=()=>{ie(!1),J(!1),G(``)},ce=()=>{A!=null&&(S(e,s,{method:`apikey`,...A}),ie(!0))},le=()=>{U(!1)},ue=()=>{Y.current??(typeof window>`u`||`AudioContext`in window&&(Y.current=new window.AudioContext,Y.current.state===`suspended`&&Y.current.resume()))},Z=()=>{ue(),U(!0)},de=async(i=`signin`)=>{if(z){re?.abort(),R(null);return}if(A==null)return;let a=i===`google`||i===`microsoft`?i:`chatgpt`;S(e,s,{method:a,...A});let l=new AbortController;R(l);try{let{useDesktopAuth:s,useStreamlinedLoginUx:u}=Oe(w(N,Ee)),d=T(N,`3963726525`),{authUrl:f,completion:m}=await ae({signal:l.signal,useStreamlinedLogin:u});if(f){let e=Te({authUrl:Ae(f,i),includeCodexOriginStableId:d,useDesktopAuth:s,useStreamlinedLoginUx:u});p.dispatchMessage(`open-in-browser`,{url:e,...s?{useExternalBrowser:!0}:{}})}let g=await m;g.success?(S(e,r,{method:a,...A}),h.removeQueries({queryKey:_(`account-info`),exact:!0}),X(),E(!0),o.setAuthMethod(`chatgpt`),c(`/welcome`,{replace:!0})):(S(e,n,{method:a,errorKind:Fe(g.error),...A}),L(t(g.error??`Unknown error`)))}catch(r){if(r instanceof Error&&r.name===`AbortError`){S(e,n,{method:a,errorKind:`abort`,...A});return}S(e,n,{method:a,errorKind:Fe(r),...A}),L(t(r))}finally{R(null)}};return A==null?(0,q.jsx)(V,{children:(0,q.jsxs)(`div`,{className:`flex h-full w-full flex-col items-center justify-center gap-3 text-token-description-foreground`,children:[(0,q.jsx)(P,{className:`h-4 w-4 text-token-foreground`}),(0,q.jsx)(b,{id:`electron.onboarding.login.loading`,defaultMessage:`Loading…`,description:`Loading state while the login page prepares onboarding telemetry`})]})}):(0,q.jsx)(V,{fullBleed:!0,hideHeader:H,children:H?(0,q.jsx)(`div`,{className:`flex h-full w-full`,children:(0,q.jsx)(ye,{onExit:le,audioContextRef:Y})}):(0,q.jsx)(Ne,{apiKeyValue:W,isApiKeyEntryVisible:B,isApiKeySignInPending:oe,isChatGptSignInPending:z,showChatGptProviderSignIn:F,onApiKeySubmit:async()=>{let s=W.trim();if(!(!s||oe||A==null)){J(!0);try{await a(`login-with-api-key`,{hostId:i,apiKey:s}),S(e,r,{method:`apikey`,...A}),X(),E(!0),o.setAuthMethod(`apikey`),c(`/welcome`,{replace:!0})}catch(r){S(e,n,{method:`apikey`,errorKind:Fe(r),...A}),L(t(r))}finally{J(!1)}}},onApiKeyValueChange:G,onChatGptSignIn:de,onChatGptSignUp:()=>de(`signup`),onPlaySnake:Z,onResetApiKeyEntry:se,onShowApiKeyEntry:ce})})}function Fe(e){let t=typeof e==`string`?e:e instanceof Error?e.message:``;if(!t)return`unknown`;let n=t.toLowerCase();return n.includes(`network`)||n.includes(`fetch`)||n.includes(`timeout`)?`network`:n.includes(`auth`)||n.includes(`unauthorized`)||n.includes(`forbidden`)||n.includes(`invalid api key`)||n.includes(`401`)||n.includes(`403`)?`auth`:`unknown`}function Ie(){let e=(0,G.c)(3);{let t;return e[1]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,q.jsx)(Pe,{}),e[1]=t):t=e[1],t}let t;return e[2]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,q.jsx)(oe,{}),e[2]=t):t=e[2],t}export{Ie as LoginRoute}; +import{s as e}from"./chunk-Bj-mKKzh.js";import{vn as t}from"./src-CYrn1fYL.js";import{Cs as n,Es as r,Ho as i,bc as a,ia as o,ws as s}from"./app-server-manager-signals-BOGyjFm3.js";import{n as c,t as l}from"./jsx-runtime-CiQ1k8xo.js";import"./react-dom-CvzHKZGB.js";import"./marked.esm-BR-H6018.js";import{A as u,F as d,I as f,f as p,h as m,lt as h,n as g,r as _}from"./vscode-api-sUstfl-x.js";import{i as v}from"./react-v2Nz4MGb.js";import{c as y,o as b}from"./lib-MoKmYgcO.js";import{m as x}from"./chunk-LFPYN7LY-DwFbyqR1.js";import{h as S}from"./persisted-signal-Cx1QgqJn.js";import"./rpc-y95ESgjb.js";import{c as C,i as w,n as T,o as E,u as D,v as O}from"./statsig-Cajk3UKk.js";import"./request-BXHjsnqU.js";import"./app-server-manager-hooks-BJ2CaNwA.js";import{t as k}from"./use-global-state-DeR7WgiQ.js";import"./invalidate-queries-and-broadcast-dPfhRWCd.js";import"./thread-context-inputs-BUuWvrJW.js";import"./config-queries-BDIsZFnB.js";import"./remote-connection-visibility-CDSfTp_2.js";import"./sidebar-signals-B0JkGccK.js";import{n as A}from"./use-is-copilot-api-available-4vxhZax2.js";import{t as j}from"./use-auth-DXLjX3T4.js";import{r as M}from"./toast-signal-By11REe1.js";import"./route-scope-BCJTBhwV.js";import{t as N}from"./button-Xd4Hy1MO.js";import"./setting-storage-Cel8Tr7E.js";import"./reduced-motion-preference-BEImGcUg.js";import{t as P}from"./spinner-Dvc_A3Ae.js";import"./os-info-_sbi_vi2.js";import"./use-os-info-COk5WlgW.js";import{t as F}from"./link-external-oqLWmWWX.js";import"./app-shell-state-B5MFb4Nm.js";import{c as I,l as ee,m as te,s as ne}from"./onboarding-state-C29ET4Cr.js";import"./use-platform-BkwBnkgx.js";import"./terminal-CsU-mb2r.js";import"./with-window-DPMmD2K-.js";import"./image-square-DpHX97RA.js";import"./codex-C1u5S_iM.js";import{t as L}from"./openai-blossom-DWhxKWUa.js";import{t as re}from"./copy-to-clipboard-q_KxH8lM.js";import{t as R}from"./check-md-CZTnvSiA.js";import"./homepage-logo-C4Z1mn1w.js";import"./checkbox-Bz6PC7ig.js";import"./minus-COQFKeWQ.js";import"./clock-CDmkoq1h.js";import"./search-mcwajolX.js";import"./globe-DyuVFbAy.js";import{t as z}from"./copy-Bnv7rlOa.js";import{t as B}from"./codex-app-ga-logo-Ce-JNlBO.js";import{a as V}from"./onboarding-shell-B5Vl8B3_.js";import"./animated-icon-BEOZWoU_.js";import"./tasks-DKnnCbd7.js";import"./chatgpt-token-auth.browser-BZtEK2Ww.js";import{n as ie,r as ae,t as H}from"./onboarding-login-content-DhtcviP9.js";import{n as U,t as W}from"./use-ascii-engine-BUObtFzM.js";var G=h(),K=e(c(),1),q=l();function oe(){let e=d(m),n=j(),r=x(),s=y(),[c,l]=(0,K.useState)(null),u=c!=null,f=A(),[h,_]=(0,K.useState)(!1),[v,S]=(0,K.useState)(!1),[C,w]=(0,K.useState)(null),[T,D]=(0,K.useState)(``),[O,N]=(0,K.useState)(!1),P=(0,K.useRef)(null),F=E(`900122030`),I=t=>{let n=s.formatMessage({id:`codex.signInFailed.message`,defaultMessage:`Sign-in failed: {rawMessage}`,description:`Sign-in failure toast message with error details`},{rawMessage:t});e.get(M).warning(n)};(0,K.useEffect)(()=>{h&&(P.current?.focus(),P.current?.select())},[h]),(0,K.useEffect)(()=>{let e=!1;return(async()=>{try{let t=await g(`openai-api-key`);if(e)return;let n=t?.value??null;w(n),D(e=>e.length>0?e:n??``)}catch{e||w(null)}})(),()=>{e=!0}},[]);let ee=async()=>{if(u){c?.abortController.abort(),l(null);return}let e=new AbortController;l({abortController:e,kind:`browserRedirect`});try{let{authUrl:i,completion:a}=await ae({signal:e.signal});i&&p.dispatchMessage(`open-in-browser`,{url:i,useExternalBrowser:!0,useExternalBrowser:!0,useExternalBrowser:!0,useExternalBrowser:!0,useExternalBrowser:!0,useExternalBrowser:!0});let o=await a;o.success?(n.setAuthMethod(`chatgpt`),r(`/first-run`)):I(t(o.error??`Unknown error`))}catch(e){if(e instanceof Error&&e.name===`AbortError`)return;I(t(e))}finally{l(null)}},te=async()=>{if(!F)return;if(u){c?.abortController.abort(),l(null);return}let e=new AbortController;S(!0),l({abortController:e,kind:`deviceCode`});try{let{verificationUrl:i,userCode:a,completion:o}=await ie({signal:e.signal});if(e.signal.aborted)return;l(t=>t?.abortController===e?{...t,verificationUrl:i,userCode:a}:t),p.dispatchMessage(`open-in-browser`,{url:i,useExternalBrowser:!0,useExternalBrowser:!0,useExternalBrowser:!0,useExternalBrowser:!0,useExternalBrowser:!0,useExternalBrowser:!0});let s=await o;s.success?(n.setAuthMethod(`chatgpt`),r(`/first-run`)):I(t(s.error??`Unknown error`))}catch(e){if(e instanceof Error&&e.name===`AbortError`)return;I(t(e))}finally{l(null)}},ne=async t=>{if(t.length!==0)try{await re(t),e.get(M).success(s.formatMessage({id:`codex.loggedOut.deviceCode.copySuccess`,defaultMessage:`Copied device code`,description:`Toast shown after copying the device code`}))}catch{e.get(M).warning(s.formatMessage({id:`codex.loggedOut.deviceCode.copyFailed`,defaultMessage:`Could not copy device code`,description:`Toast shown when copying the device code fails`}))}},{data:L}=k(`show-copilot-login-first`),R=async()=>{await o(e,`use-copilot-auth-if-available`,!0),n.setAuthMethod(`copilot`),r(`/first-run`)},z=async()=>{let e=T.trim();if(!(!e||O)){N(!0);try{await a(`login-with-api-key`,{hostId:i,apiKey:e}),n.setAuthMethod(`apikey`),r(`/first-run`)}catch(e){I(t(e))}finally{N(!1)}}},B=!f||!L?(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(Y,{isPrimary:!0,handleChatGptSignIn:ee,isChatGptSignInPending:u}),!u&&f&&(0,q.jsx)(`div`,{className:`pt-2`,children:(0,q.jsx)(X,{isPrimary:!1,handleCopilotSignIn:R})})]}):(0,q.jsxs)(q.Fragment,{children:[!u&&(0,q.jsx)(X,{isPrimary:!0,handleCopilotSignIn:R}),(0,q.jsx)(`div`,{className:`pt-2`,children:(0,q.jsx)(Y,{isPrimary:!1,handleChatGptSignIn:ee,isChatGptSignInPending:u})})]}),V=c?.kind===`deviceCode`?c:null;return(0,q.jsxs)(`div`,{className:`fixed inset-0 overflow-hidden bg-token-side-bar-background`,children:[(0,q.jsx)(`div`,{className:`pointer-events-none absolute inset-0`,children:(0,q.jsx)(`div`,{className:`-ml-6 h-full w-full`,style:{WebkitMaskImage:`radial-gradient(ellipse at center, rgba(0,0,0,1) 25%, rgba(0,0,0,0.6) 30%, rgba(0,0,0,0) 50%)`,maskImage:`radial-gradient(ellipse at center, rgba(0,0,0,1) 35%, rgba(0,0,0,0.6) 60%, rgba(0,0,0,0) 78%)`,WebkitMaskRepeat:`no-repeat`,maskRepeat:`no-repeat`,WebkitMaskSize:`100% 100%`,maskSize:`100% 100%`},children:(0,q.jsx)(J,{})})}),(0,q.jsx)(`div`,{className:`relative z-10 flex h-full justify-center px-4 py-6 sm:py-8`,children:(0,q.jsxs)(`div`,{className:`flex h-full w-full max-w-[360px] flex-col`,children:[(0,q.jsx)(`div`,{className:`flex min-h-0 flex-1 items-center justify-center`,children:(0,q.jsx)(`h1`,{className:`text-center text-3xl leading-tight font-medium text-token-foreground`,children:(0,q.jsx)(b,{id:`codex.loggedOut.title`,defaultMessage:`Codex`,description:`Title on logged out screen`})})}),(0,q.jsxs)(`div`,{className:`flex min-h-[192px] flex-col justify-end gap-4 pb-2 sm:pb-0`,children:[!h&&V==null&&(0,q.jsx)(`div`,{className:`flex w-full justify-center`,children:(0,q.jsxs)(`div`,{className:`mx-auto inline-flex w-max flex-col items-stretch`,children:[B,!u&&(0,q.jsx)(de,{setApiKeyValue:D,defaultApiKeyFromEnv:C,setIsApiKeySignInVisible:_}),!u&&F&&(0,q.jsx)(ce,{isVisible:v,onToggle:()=>{S(e=>!e)},children:(0,q.jsx)(se,{handleChatGptDeviceCodeSignIn:te})})]})}),V!=null&&(0,q.jsx)(he,{verificationUrl:V.verificationUrl??``,userCode:V.userCode??``,onOpenBrowser:()=>{let e=V.verificationUrl;e&&p.dispatchMessage(`open-in-browser`,{url:e,useExternalBrowser:!0,useExternalBrowser:!0,useExternalBrowser:!0,useExternalBrowser:!0,useExternalBrowser:!0,useExternalBrowser:!0})},onCopyCode:ne,onCancel:()=>{V.abortController.abort(),l(null)}}),!u&&h&&(0,q.jsx)(fe,{apiKeyValue:T,setApiKeyValue:D,apiKeyInputRef:P,isApiKeyLoginPending:O,setIsApiKeyLoginPending:N,setIsApiKeySignInVisible:_,handleApiKeySubmit:z})]})]})})]})}var J=K.memo(function(){let e=(0,G.c)(5),t;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t={initialColumns:130,initialRows:100,initialMode:`composite`,preferredVideoKeyword:`blossom`},e[0]=t):t=e[0];let{columns:n,rows:r,lines:i}=W(t),a;return e[1]!==n||e[2]!==i||e[3]!==r?(a=(0,q.jsx)(U,{lines:i,columns:n,rows:r,autoCover:!0}),e[1]=n,e[2]=i,e[3]=r,e[4]=a):a=e[4],a});function Y(e){let t=(0,G.c)(6),{isPrimary:n,handleChatGptSignIn:r,isChatGptSignInPending:i}=e,a;t[0]===i?a=t[1]:(a=i?(0,q.jsx)(b,{id:`codex.loggedOut.signIn.cancel`,defaultMessage:`Cancel Sign-in`,description:`Cancel button for sign in`}):(0,q.jsx)(b,{id:`codex.loggedOut.signIn`,defaultMessage:`Sign in with ChatGPT`,description:`Sign in button text on logged out screen`}),t[0]=i,t[1]=a);let o;return t[2]!==r||t[3]!==n||t[4]!==a?(o=(0,q.jsx)(Z,{isPrimary:n,onClick:r,children:a}),t[2]=r,t[3]=n,t[4]=a,t[5]=o):o=t[5],o}function X(e){let t=(0,G.c)(4),{isPrimary:n,handleCopilotSignIn:r}=e,i;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,q.jsx)(b,{id:`codex.loggedOut.signInWithCopilot`,defaultMessage:`Sign in with GitHub Copilot`,description:`Button label for GitHub Copilot sign-in on logged out screen`}),t[0]=i):i=t[0];let a;return t[1]!==r||t[2]!==n?(a=(0,q.jsx)(Z,{isPrimary:n,onClick:r,children:i}),t[1]=r,t[2]=n,t[3]=a):a=t[3],a}function se(e){let t=(0,G.c)(3),{handleChatGptDeviceCodeSignIn:n}=e,r;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,q.jsx)(b,{id:`codex.loggedOut.signInWithDeviceCode`,defaultMessage:`Use device code`,description:`Secondary button to sign in with a device code`}),t[0]=r):r=t[0];let i;return t[1]===n?i=t[2]:(i=(0,q.jsx)(Z,{isPrimary:!1,onClick:n,children:r}),t[1]=n,t[2]=i),i}function ce(e){let t=(0,G.c)(17),{isVisible:n,onToggle:r,children:i}=e,a=!n,o=n?`1fr`:`0fr`,s=n?1:0,c;t[0]!==o||t[1]!==s?(c={gridTemplateRows:o,opacity:s},t[0]=o,t[1]=s,t[2]=c):c=t[2];let l;t[3]===i?l=t[4]:(l=(0,q.jsx)(`div`,{className:`overflow-hidden`,children:(0,q.jsx)(`div`,{className:`pb-2`,children:i})}),t[3]=i,t[4]=l);let u;t[5]!==a||t[6]!==c||t[7]!==l?(u=(0,q.jsx)(`div`,{className:`grid transition-[grid-template-rows,opacity] duration-200 ease-out`,"aria-hidden":a,style:c,children:l}),t[5]=a,t[6]=c,t[7]=l,t[8]=u):u=t[8];let d;t[9]===n?d=t[10]:(d=n?(0,q.jsx)(b,{id:`codex.loggedOut.lessOptions`,defaultMessage:`Less options`,description:`Button label to hide additional sign-in methods`}):(0,q.jsx)(b,{id:`codex.loggedOut.moreOptions`,defaultMessage:`More options`,description:`Button label to reveal additional sign-in methods`}),t[9]=n,t[10]=d);let f;t[11]!==r||t[12]!==d?(f=(0,q.jsx)(`div`,{className:`flex justify-center`,children:(0,q.jsx)(`button`,{type:`button`,className:`cursor-interaction text-center text-sm text-token-description-foreground hover:underline`,onClick:r,children:d})}),t[11]=r,t[12]=d,t[13]=f):f=t[13];let p;return t[14]!==u||t[15]!==f?(p=(0,q.jsxs)(`div`,{className:`pt-2`,children:[u,f]}),t[14]=u,t[15]=f,t[16]=p):p=t[16],p}var le=`w-full cursor-interaction justify-center !rounded-full border px-4 py-2 font-medium`,ue=`bg-token-foreground/10 w-full justify-center !rounded-full px-4 py-2 font-medium backdrop-blur-md`;function Z(e){let t=(0,G.c)(5),{isPrimary:n,onClick:r,children:i}=e,a=n?`primary`:`outline`,o=n?le:ue,s;return t[0]!==i||t[1]!==r||t[2]!==a||t[3]!==o?(s=(0,q.jsx)(N,{color:a,className:o,onClick:r,children:i}),t[0]=i,t[1]=r,t[2]=a,t[3]=o,t[4]=s):s=t[4],s}function de(e){let t=(0,G.c)(7),{setApiKeyValue:n,defaultApiKeyFromEnv:r,setIsApiKeySignInVisible:i}=e,a;t[0]!==r||t[1]!==n||t[2]!==i?(a=()=>{i(!0),n(e=>e.length>0?e:r??``)},t[0]=r,t[1]=n,t[2]=i,t[3]=a):a=t[3];let o;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,q.jsx)(b,{id:`codex.loggedOut.useApiKey`,defaultMessage:`Use API Key`,description:`Secondary button to use API Key auth method`}),t[4]=o):o=t[4];let s;return t[5]===a?s=t[6]:(s=(0,q.jsx)(`div`,{className:`pt-2`,children:(0,q.jsx)(N,{color:`outline`,className:`w-full justify-center !rounded-full bg-token-foreground/10 px-4 py-2 font-medium backdrop-blur-md`,onClick:a,children:o})}),t[5]=a,t[6]=s),s}function fe(e){let t=(0,G.c)(32),{apiKeyValue:n,setApiKeyValue:r,apiKeyInputRef:i,isApiKeyLoginPending:a,setIsApiKeyLoginPending:o,setIsApiKeySignInVisible:s,handleApiKeySubmit:c}=e,l=y(),u;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(u=(0,q.jsx)(b,{id:`codex.loggedOut.apiKeyPrompt.inputLabel`,defaultMessage:`Enter your OpenAI API key`,description:`Label for API key input`}),t[0]=u):u=t[0];let d;t[1]===l?d=t[2]:(d=l.formatMessage({id:`codex.loggedOut.apiKeyPrompt.placeholder`,defaultMessage:`sk-...`,description:`Placeholder text hint for API key input field`}),t[1]=l,t[2]=d);let f;t[3]===r?f=t[4]:(f=e=>{r(e.target.value)},t[3]=r,t[4]=f);let p;t[5]!==i||t[6]!==n||t[7]!==d||t[8]!==f?(p=(0,q.jsxs)(`label`,{className:`block text-sm text-token-foreground`,children:[u,(0,q.jsx)(`input`,{ref:i,className:`mt-4 w-full rounded-lg border border-token-border bg-token-input-background px-3 py-2 text-sm text-token-foreground focus:border-token-focus-border focus:outline-none`,placeholder:d,value:n,onChange:f,onFocus:me})]}),t[5]=i,t[6]=n,t[7]=d,t[8]=f,t[9]=p):p=t[9];let m;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(m=(0,q.jsx)(`p`,{className:`mt-3 text-[10px] text-token-description-foreground`,children:(0,q.jsx)(b,{id:`codex.loggedOut.cloudTasksDisabledWithApiKey`,defaultMessage:`Cloud tasks disabled with API key`,description:`Disclaimer explaining that remote features need ChatGPT sign-in`})}),t[10]=m):m=t[10];let h;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(h=(0,q.jsxs)(`button`,{type:`button`,className:`inline-flex cursor-interaction items-center gap-1 text-sm text-token-text-link-foreground hover:underline max-[280px]:hidden`,onClick:pe,children:[(0,q.jsx)(b,{id:`codex.loggedOut.apiKeyPrompt.getKey`,defaultMessage:`Get API Key`,description:`Button to open OpenAI API key management page`}),(0,q.jsx)(F,{"aria-hidden":`true`,className:`icon-2xs`})]}),t[11]=h):h=t[11];let g;t[12]!==o||t[13]!==s?(g=()=>{o(!1),s(!1)},t[12]=o,t[13]=s,t[14]=g):g=t[14];let _;t[15]===Symbol.for(`react.memo_cache_sentinel`)?(_=(0,q.jsx)(b,{id:`codex.loggedOut.apiKeyPrompt.cancel`,defaultMessage:`Cancel`,description:`Cancel button for API key login`}),t[15]=_):_=t[15];let v;t[16]===g?v=t[17]:(v=(0,q.jsx)(N,{color:`ghost`,onClick:g,children:_}),t[16]=g,t[17]=v);let x;t[18]!==n||t[19]!==a?(x=n.trim().length===0||a,t[18]=n,t[19]=a,t[20]=x):x=t[20];let S;t[21]===Symbol.for(`react.memo_cache_sentinel`)?(S=(0,q.jsx)(b,{id:`codex.loggedOut.apiKeyPrompt.confirm`,defaultMessage:`OK`,description:`Confirm button for API key login`}),t[21]=S):S=t[21];let C;t[22]!==c||t[23]!==a||t[24]!==x?(C=(0,q.jsx)(N,{className:`px-4`,onClick:c,disabled:x,loading:a,children:S}),t[22]=c,t[23]=a,t[24]=x,t[25]=C):C=t[25];let w;t[26]!==C||t[27]!==v?(w=(0,q.jsxs)(`div`,{className:`mt-4 flex items-center justify-end gap-2 min-[280px]:justify-between`,children:[h,(0,q.jsxs)(`div`,{className:`flex justify-end gap-2`,children:[v,C]})]}),t[26]=C,t[27]=v,t[28]=w):w=t[28];let T;return t[29]!==w||t[30]!==p?(T=(0,q.jsxs)(`div`,{className:`w-full rounded-2xl border border-token-border bg-token-dropdown-background/80 px-4 py-4 backdrop-blur-lg`,children:[p,m,w]}),t[29]=w,t[30]=p,t[31]=T):T=t[31],T}function pe(){p.dispatchMessage(`open-in-browser`,{url:`https://platform.openai.com/api-keys`,useExternalBrowser:!0,useExternalBrowser:!0,useExternalBrowser:!0,useExternalBrowser:!0,useExternalBrowser:!0,useExternalBrowser:!0})}function me(e){e.currentTarget.select()}function he(e){let t=(0,G.c)(38),{verificationUrl:n,userCode:r,onOpenBrowser:i,onCopyCode:a,onCancel:o}=e,s=y(),c=r.length>0?r:`......`,[l,u]=(0,K.useState)(!1),d;t[0]!==s||t[1]!==l?(d=l?s.formatMessage({id:`codex.loggedOut.deviceCode.copyAriaLabel.copied`,defaultMessage:`Copied`,description:`Aria label for the copied state of the device code copy affordance on the logged out screen`}):s.formatMessage({id:`codex.loggedOut.deviceCode.copyAriaLabel.copy`,defaultMessage:`Copy`,description:`Aria label for the device code copy affordance on the logged out screen`}),t[0]=s,t[1]=l,t[2]=d):d=t[2];let f=d,p;t[3]!==a||t[4]!==r?(p=()=>{r.length!==0&&(a(r),u(!0),window.setTimeout(()=>{u(!1)},2e3))},t[3]=a,t[4]=r,t[5]=p):p=t[5];let m=p,h;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(h=(0,q.jsx)(`p`,{className:`text-sm text-token-foreground`,children:(0,q.jsx)(b,{id:`codex.loggedOut.deviceCode.instructions`,defaultMessage:`To use a device code to log in, click the open browser button and paste the code below.`,description:`Instructions shown while a device code login is in progress`})}),t[6]=h):h=t[6];let g;t[7]===m?g=t[8]:(g=e=>{(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),m())},t[7]=m,t[8]=g);let _;t[9]===m?_=t[10]:(_=e=>{e.stopPropagation(),m()},t[9]=m,t[10]=_);let v;t[11]===l?v=t[12]:(v=l?(0,q.jsx)(R,{className:`icon-sm text-token-foreground`}):(0,q.jsx)(z,{className:`icon-sm`}),t[11]=l,t[12]=v);let x;t[13]!==f||t[14]!==_||t[15]!==v?(x=(0,q.jsx)(`div`,{className:`absolute top-2 right-2 opacity-100 transition-opacity sm:opacity-0 sm:group-focus-within:opacity-100 sm:group-hover:opacity-100`,children:(0,q.jsx)(N,{color:`ghost`,size:`icon`,className:`rounded-md`,"aria-label":f,onClick:_,children:v})}),t[13]=f,t[14]=_,t[15]=v,t[16]=x):x=t[16];let S;t[17]===Symbol.for(`react.memo_cache_sentinel`)?(S=(0,q.jsx)(`p`,{className:`text-xs font-medium tracking-[0.2em] text-token-description-foreground uppercase`,children:(0,q.jsx)(b,{id:`codex.loggedOut.deviceCode.codeLabel`,defaultMessage:`Device code`,description:`Label above the user code shown during device code sign in`})}),t[17]=S):S=t[17];let C;t[18]===c?C=t[19]:(C=(0,q.jsx)(`p`,{className:`mt-2 overflow-x-auto text-center font-mono text-[28px] font-semibold tracking-[0.12em] whitespace-nowrap text-token-foreground`,children:c}),t[18]=c,t[19]=C);let w;t[20]!==m||t[21]!==g||t[22]!==x||t[23]!==C?(w=(0,q.jsxs)(`div`,{className:`group relative rounded-xl border border-token-border bg-token-input-background px-3 py-3`,role:`button`,tabIndex:0,onClick:m,onKeyDown:g,children:[x,S,C]}),t[20]=m,t[21]=g,t[22]=x,t[23]=C,t[24]=w):w=t[24];let T;t[25]===Symbol.for(`react.memo_cache_sentinel`)?(T=(0,q.jsx)(b,{id:`codex.loggedOut.deviceCode.cancel`,defaultMessage:`Cancel`,description:`Button to cancel a device code login`}),t[25]=T):T=t[25];let E;t[26]===o?E=t[27]:(E=(0,q.jsx)(N,{color:`ghost`,onClick:o,children:T}),t[26]=o,t[27]=E);let D=n.length===0,O;t[28]===Symbol.for(`react.memo_cache_sentinel`)?(O=(0,q.jsx)(b,{id:`codex.loggedOut.deviceCode.openBrowser`,defaultMessage:`Open browser`,description:`Button to open the device code verification page`}),t[28]=O):O=t[28];let k;t[29]!==i||t[30]!==D?(k=(0,q.jsx)(N,{onClick:i,disabled:D,children:O}),t[29]=i,t[30]=D,t[31]=k):k=t[31];let A;t[32]!==E||t[33]!==k?(A=(0,q.jsxs)(`div`,{className:`flex w-full flex-wrap items-center justify-between gap-2`,children:[E,k]}),t[32]=E,t[33]=k,t[34]=A):A=t[34];let j;return t[35]!==w||t[36]!==A?(j=(0,q.jsx)(`div`,{className:`w-full rounded-2xl border border-token-border bg-token-dropdown-background/80 px-4 py-4 backdrop-blur-lg`,children:(0,q.jsxs)(`div`,{className:`space-y-3`,children:[h,w,A]})}),t[35]=w,t[36]=A,t[37]=j):j=t[37],j}var Q=12,$=18,ge=120,_e={up:{x:0,y:-1},down:{x:0,y:1},left:{x:-1,y:0},right:{x:1,y:0}},ve={up:`down`,down:`up`,left:`right`,right:`left`};function ye(e){let t=(0,G.c)(21),{onExit:n,audioContextRef:r}=e,i=(0,K.useRef)(null),a=(0,K.useRef)(null),o=(0,K.useRef)(null),s;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(s=[],t[0]=s):s=t[0];let c=(0,K.useRef)(s),l;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(l={x:0,y:0},t[1]=l):l=t[1];let u=(0,K.useRef)(l),d=(0,K.useRef)(`right`),f=(0,K.useRef)(`right`),p;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(p={columns:Q,rows:Q,cellSize:$,width:Q*$,height:Q*$},t[2]=p):p=t[2];let m=(0,K.useRef)(p),h=(0,K.useRef)(null),g=(0,K.useEffectEvent)(n),_;t[3]===r?_=t[4]:(_=(e,t,n)=>{if(r.current==null)return;let i=r.current;i.state===`suspended`&&i.resume();let a=t/1e3,o=i.createOscillator(),s=i.createGain();o.type=n,o.frequency.value=e,s.gain.setValueAtTime(1e-4,i.currentTime),s.gain.exponentialRampToValueAtTime(.18,i.currentTime+.01),s.gain.exponentialRampToValueAtTime(1e-4,i.currentTime+a),o.connect(s),s.connect(i.destination),o.start(),o.stop(i.currentTime+a),o.onended=()=>{o.disconnect(),s.disconnect()}},t[3]=r,t[4]=_);let v=(0,K.useEffectEvent)(_),y;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(y=()=>{o.current!=null&&(window.clearInterval(o.current),o.current=null)},t[5]=y):y=t[5];let b=y,x;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(x=()=>{if(h.current)return h.current;let e=i.current;if(e==null)return{snake:`#ffffff`,food:`#f97316`};let t=getComputedStyle(e).color||`#ffffff`,n=getComputedStyle(document.documentElement),r={snake:t,food:n.getPropertyValue(`--vscode-charts-red`).trim()||n.getPropertyValue(`--vscode-charts-orange`).trim()||`#f97316`};return h.current=r,r},t[6]=x):x=t[6];let S=x,C;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(C=()=>{if(i.current==null)return null;let e=Math.max(1,Math.floor(window.devicePixelRatio||1));i.current.width=Math.max(1,Math.floor(m.current.width*e)),i.current.height=Math.max(1,Math.floor(m.current.height*e)),i.current.style.width=`${m.current.width}px`,i.current.style.height=`${m.current.height}px`;let t=i.current.getContext(`2d`);return t==null?null:(t.setTransform(e,0,0,e,0,0),t.imageSmoothingEnabled=!1,t)},t[7]=C):C=t[7];let w=C,T;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(T=e=>{let t={x:Math.floor(Math.random()*m.current.columns),y:Math.floor(Math.random()*m.current.rows)};for(;e.some(e=>e.x===t.x&&e.y===t.y);)t={x:Math.floor(Math.random()*m.current.columns),y:Math.floor(Math.random()*m.current.rows)};return t},t[8]=T):T=t[8];let E=T,D;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(D=()=>{let e=w();if(e==null)return;let t=S();e.clearRect(0,0,m.current.width,m.current.height),e.fillStyle=t.snake;for(let t of c.current)e.fillRect(t.x*m.current.cellSize,t.y*m.current.cellSize,m.current.cellSize,m.current.cellSize);e.fillStyle=t.food,e.fillRect(u.current.x*m.current.cellSize,u.current.y*m.current.cellSize,m.current.cellSize,m.current.cellSize)},t[9]=D):D=t[9];let O=(0,K.useEffectEvent)(D),k;t[10]===O?k=t[11]:(k=()=>{let e=Math.floor(m.current.columns/2),t=Math.floor(m.current.rows/2);c.current=[{x:e,y:t},{x:e-1,y:t},{x:e-2,y:t}],d.current=`right`,f.current=`right`,u.current=E(c.current),O()},t[10]=O,t[11]=k);let A=(0,K.useEffectEvent)(k),j;t[12]===A?j=t[13]:(j=()=>{if(a.current==null)return;let e=a.current.getBoundingClientRect(),t=Math.max(1,Math.floor(e.width)),n=Math.max(1,Math.floor(e.height)),r=Math.max(Q,Math.floor(t/$)),i=t/r;m.current={columns:r,rows:Math.max(Q,Math.floor(n/i)),cellSize:i,width:t,height:n},A()},t[12]=A,t[13]=j);let M=(0,K.useEffectEvent)(j),N;t[14]!==O||t[15]!==g||t[16]!==v||t[17]!==M?(N=()=>{M();let e=e=>{let t=null;e.key===`ArrowUp`||e.key===`w`||e.key===`W`?t=`up`:e.key===`ArrowDown`||e.key===`s`||e.key===`S`?t=`down`:e.key===`ArrowLeft`||e.key===`a`||e.key===`A`?t=`left`:(e.key===`ArrowRight`||e.key===`d`||e.key===`D`)&&(t=`right`),t!=null&&(e.preventDefault(),ve[d.current]!==t&&(f.current=t))};return window.addEventListener(`keydown`,e),o.current=window.setInterval(()=>{let e=c.current,t=e[0],n=f.current,r=_e[n],i={x:t.x+r.x,y:t.y+r.y};if(i.x<0||i.y<0||i.x>=m.current.columns||i.y>=m.current.rows){b(),v(140,220,`sawtooth`),g();return}let a=i.x===u.current.x&&i.y===u.current.y;if((a?e:e.slice(0,-1)).some(e=>e.x===i.x&&e.y===i.y)){b(),v(160,220,`sawtooth`),g();return}let o=a?[i,...e]:[i,...e.slice(0,-1)];c.current=o,d.current=n,a&&(u.current=E(o),v(660,120,`square`)),O()},ge),()=>{b(),window.removeEventListener(`keydown`,e)}},t[14]=O,t[15]=g,t[16]=v,t[17]=M,t[18]=N):N=t[18];let P;t[19]===Symbol.for(`react.memo_cache_sentinel`)?(P=[],t[19]=P):P=t[19],(0,K.useEffect)(N,P);let F;return t[20]===Symbol.for(`react.memo_cache_sentinel`)?(F=(0,q.jsx)(`div`,{className:`h-full w-full`,ref:a,children:(0,q.jsx)(`canvas`,{className:`h-full w-full text-token-foreground`,ref:i})}),t[20]=F):F=t[20],F}var be=O(),xe=`https://chatgpt.com/codex/desktop-auth`,Se=`codex_streamlined_login`,Ce=`client-sYWqzCYMRkUg4DqqiZcR5DGTNl2iD7zNJY0HoeDLzxR`,we=`codex_origin_stable_id`;function Te({authUrl:e,codexOriginStableId:t=be.StableID.get(Ce),includeCodexOriginStableId:n=!1,useDesktopAuth:r,useStreamlinedLoginUx:i}){if(!n&&!r&&!i)return e;try{let a=new URL(e);if(n&&t&&a.searchParams.set(we,t),a.pathname===`/codex/desktop-auth`)return i&&a.searchParams.set(Se,`true`),a.toString();if(i&&a.searchParams.set(Se,`true`),!r)return a.toString();let o=new URL(xe);return o.searchParams.set(`authorize_url`,a.toString()),i&&o.searchParams.set(Se,`true`),o.toString()}catch{return e}}var Ee=`3446609779`,De=`1561420571`;function Oe(e){let t=e.get(`enabled`,!1);return{useDesktopAuth:e.get(`use_desktop_auth`,t),useStreamlinedLoginUx:e.get(`use_streamlined_login_ux`,t)}}function ke(e){return e}function Ae(e,t){if(t===`signin`)return e;try{let n=new URL(e);switch(t){case`signup`:n.searchParams.set(`screen_hint`,`signup`);break;case`google`:n.searchParams.set(`screen_hint`,`login_or_signup`),n.searchParams.set(`connection`,`google-oauth2`);break;case`microsoft`:n.searchParams.set(`screen_hint`,`login_or_signup`),n.searchParams.set(`connection`,`windowslive`);break}return n.toString()}catch{return e}}var je=e=>(0,q.jsxs)(`svg`,{height:24,viewBox:`0 0 24 24`,width:24,xmlns:`http://www.w3.org/2000/svg`,...e,children:[(0,q.jsx)(`path`,{d:`M22.56 12.25c0-.78-.07-1.53-.2-2.25H12v4.26h5.92c-.26 1.37-1.04 2.53-2.21 3.31v2.77h3.57c2.08-1.92 3.28-4.74 3.28-8.09z`,fill:`#4285F4`}),(0,q.jsx)(`path`,{d:`M12 23c2.97 0 5.46-.98 7.28-2.66l-3.57-2.77c-.98.66-2.23 1.06-3.71 1.06-2.86 0-5.29-1.93-6.16-4.53H2.18v2.84C3.99 20.53 7.7 23 12 23z`,fill:`#34A853`}),(0,q.jsx)(`path`,{d:`M5.84 14.09c-.22-.66-.35-1.36-.35-2.09s.13-1.43.35-2.09V7.07H2.18C1.43 8.55 1 10.22 1 12s.43 3.45 1.18 4.93l2.85-2.22.81-.62z`,fill:`#FBBC05`}),(0,q.jsx)(`path`,{d:`M12 5.38c1.62 0 3.06.56 4.21 1.64l3.15-3.15C17.45 2.09 14.97 1 12 1 7.7 1 3.99 3.47 2.18 7.07l3.66 2.84c.87-2.6 3.3-4.53 6.16-4.53z`,fill:`#EA4335`}),(0,q.jsx)(`path`,{d:`M1 1h22v22H1z`,fill:`none`})]}),Me=e=>(0,q.jsxs)(`svg`,{width:24,height:24,viewBox:`0 0 24 24`,fill:`none`,xmlns:`http://www.w3.org/2000/svg`,...e,children:[(0,q.jsx)(`path`,{d:`M3.25 3.25H11.25V11.25H3.25V3.25Z`,fill:`#F35325`}),(0,q.jsx)(`path`,{d:`M12.75 3.25H20.75V11.25H12.75V3.25Z`,fill:`#81BC06`}),(0,q.jsx)(`path`,{d:`M3.25 12.75H11.25V20.75H3.25V12.75Z`,fill:`#05A6F0`}),(0,q.jsx)(`path`,{d:`M12.75 12.75H20.75V20.75H12.75V12.75Z`,fill:`#FFBA08`})]});function Ne(e){let t=(0,G.c)(40),{apiKeyValue:n,isApiKeyEntryVisible:r,isApiKeySignInPending:i,isChatGptSignInPending:a,showChatGptProviderSignIn:o,onApiKeySubmit:s,onApiKeyValueChange:c,onChatGptSignIn:l,onChatGptSignUp:u,onPlaySnake:d,onResetApiKeyEntry:f,onShowApiKeyEntry:p}=e,m=y(),h=D(`2523619087`),g;t[0]===h?g=t[1]:(g=h.get(`enabled`,!1),t[0]=h,t[1]=g);let _=g;if(a&&!r){let e;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,q.jsx)(`img`,{src:B,className:`size-[52px] shrink-0`,draggable:!1,alt:``,"aria-hidden":`true`}),t[2]=e):e=t[2];let n;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,q.jsx)(`p`,{className:`text-center text-[14px] leading-5 font-normal tracking-[-0.18px] text-token-description-foreground`,children:(0,q.jsx)(b,{id:`electron.onboarding.login.browserPending.welcomeV2`,defaultMessage:`Continue signing in with your browser`,description:`Message shown while ChatGPT sign-in continues in the browser`})}),t[3]=n):n=t[3];let r;t[4]===l?r=t[5]:(r=()=>l(),t[4]=l,t[5]=r);let i;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,q.jsx)(b,{id:`electron.onboarding.login.chatgpt.cancel.welcomeV2`,defaultMessage:`Cancel sign-in`,description:`Cancel button label while ChatGPT sign-in is in progress on desktop onboarding`}),t[6]=i):i=t[6];let a;return t[7]===r?a=t[8]:(a=(0,q.jsx)(`div`,{className:`flex h-full w-full items-center justify-center overflow-hidden bg-token-main-surface-primary pb-12 text-token-foreground`,children:(0,q.jsxs)(`div`,{className:`flex w-[340px] flex-col items-center gap-8`,children:[e,n,(0,q.jsx)(`button`,{className:`flex h-[42px] w-full cursor-interaction items-center justify-center rounded-full border border-token-border bg-token-main-surface-primary text-[14px] leading-5 font-medium text-token-description-foreground hover:bg-token-list-hover-background`,type:`button`,onClick:r,children:i})]})}),t[7]=r,t[8]=a),a}let v;t[9]===m?v=t[10]:(v=m.formatMessage({id:`electron.onboarding.login.snake.start`,defaultMessage:`Play Snake`,description:`Aria label for the Codex logo button to start Snake`}),t[9]=m,t[10]=v);let x;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(x=(0,q.jsx)(`img`,{src:B,className:`size-[52px] shrink-0`,draggable:!1,alt:``,"aria-hidden":`true`}),t[11]=x):x=t[11];let S;t[12]!==d||t[13]!==v?(S=(0,q.jsx)(`button`,{className:`group flex cursor-interaction items-center justify-center rounded-full`,type:`button`,"aria-label":v,onClick:d,children:x}),t[12]=d,t[13]=v,t[14]=S):S=t[14];let C,w;t[15]===_?(C=t[16],w=t[17]):(C=(0,q.jsx)(`h1`,{className:`w-[316px] text-[28px] leading-9 font-normal text-token-foreground`,children:_?(0,q.jsx)(b,{id:`electron.onboarding.login.welcomeV2.title.streamlined`,defaultMessage:`Welcome to Codex`,description:`Title on the v2 desktop onboarding login page for streamlined ChatGPT sign-in`}):(0,q.jsx)(b,{id:`electron.onboarding.login.welcomeV2.title`,defaultMessage:`Get started with Codex`,description:`Title on the v2 desktop onboarding login page`})}),w=_?(0,q.jsxs)(`div`,{className:`mt-4 flex items-center justify-center gap-1.5 rounded-full bg-[#4452ff]/[0.08] py-1 pr-3 pl-2.5 text-[13px] leading-5 font-normal tracking-[-0.078px] text-[#4452ff] dark:bg-[#4452ff]/25 dark:text-[#7882ff]`,children:[(0,q.jsx)(R,{className:`size-3.5 shrink-0`,"aria-hidden":`true`}),(0,q.jsx)(b,{id:`electron.onboarding.login.includedPlans.welcomeV2`,defaultMessage:`Included with all ChatGPT plans`,description:`Badge text on the v2 desktop onboarding login page indicating Codex is included with ChatGPT plans`})]}):null,t[15]=_,t[16]=C,t[17]=w);let T;t[18]!==C||t[19]!==w?(T=(0,q.jsxs)(`div`,{className:`flex w-full flex-col items-center text-center`,children:[C,w]}),t[18]=C,t[19]=w,t[20]=T):T=t[20];let E;t[21]!==S||t[22]!==T?(E=(0,q.jsxs)(`div`,{className:`flex w-full flex-col items-center gap-8`,children:[S,T]}),t[21]=S,t[22]=T,t[23]=E):E=t[23];let O;t[24]!==n||t[25]!==r||t[26]!==i||t[27]!==a||t[28]!==s||t[29]!==c||t[30]!==l||t[31]!==u||t[32]!==f||t[33]!==p||t[34]!==o||t[35]!==_?(O=r?(0,q.jsx)(`div`,{className:`w-full`,children:(0,q.jsx)(H,{apiKeyValue:n,isApiKeyEntryVisible:r,isApiKeySignInPending:i,isChatGptSignInPending:a,onApiKeySecondaryAction:f,onApiKeySubmit:s,onApiKeyValueChange:c,onChatGptSignIn:l,onShowApiKeyEntry:p,apiKeySecondaryActionLabel:(0,q.jsx)(b,{id:`electron.onboarding.login.apikey.cancel`,defaultMessage:`Cancel`,description:`Cancel button label for API key entry on desktop onboarding`})})}):(0,q.jsxs)(`div`,{className:`flex w-full flex-col items-center gap-3`,children:[(0,q.jsxs)(`button`,{className:`flex h-[48px] w-full cursor-interaction items-center justify-center gap-2 rounded-full border border-transparent bg-token-foreground text-[14px] leading-5 font-medium text-token-dropdown-background hover:bg-token-foreground/80`,type:`button`,onClick:()=>l(),children:[(0,q.jsx)(L,{className:`size-6 shrink-0 text-token-dropdown-background`}),_?(0,q.jsx)(b,{id:`electron.onboarding.login.chatgpt.signIn.streamlined`,defaultMessage:`Continue with ChatGPT`,description:`Button label for streamlined ChatGPT sign-in on desktop onboarding`}):(0,q.jsx)(b,{id:`electron.onboarding.login.chatgpt.signIn`,defaultMessage:`Sign in with ChatGPT`,description:`Button label to sign in with ChatGPT on desktop onboarding`})]}),o?(0,q.jsxs)(q.Fragment,{children:[(0,q.jsxs)(`button`,{className:`flex h-[46px] w-full cursor-interaction items-center justify-center gap-2 rounded-full border border-token-border bg-token-main-surface-primary text-[14px] leading-5 font-medium text-token-foreground hover:bg-token-list-hover-background`,type:`button`,onClick:()=>l(`google`),children:[(0,q.jsx)(je,{className:`size-5 shrink-0`,"aria-hidden":`true`}),(0,q.jsx)(b,{id:`electron.onboarding.login.google.signIn`,defaultMessage:`Continue with Google`,description:`Button label for Google sign-in on desktop onboarding`})]}),(0,q.jsxs)(`button`,{className:`flex h-[46px] w-full cursor-interaction items-center justify-center gap-2 rounded-full border border-token-border bg-token-main-surface-primary text-[14px] leading-5 font-medium text-token-foreground hover:bg-token-list-hover-background`,type:`button`,onClick:()=>l(`microsoft`),children:[(0,q.jsx)(Me,{className:`size-5 shrink-0`,"aria-hidden":`true`}),(0,q.jsx)(b,{id:`electron.onboarding.login.microsoft.signIn`,defaultMessage:`Continue with Microsoft`,description:`Button label for Microsoft sign-in on desktop onboarding`})]})]}):null,(0,q.jsx)(`button`,{className:`flex h-[46px] w-full cursor-interaction items-center justify-center rounded-full border border-token-border bg-token-main-surface-primary text-[14px] leading-5 font-medium text-token-foreground hover:bg-token-list-hover-background`,type:`button`,onClick:p,children:(0,q.jsx)(b,{id:`electron.onboarding.login.apikey.open.welcomeV2`,defaultMessage:`Sign in another way`,description:`Button label to open another sign-in method on v2 desktop onboarding`})}),(0,q.jsx)(`button`,{className:`flex h-9 cursor-interaction items-center justify-center px-2 text-[14px] leading-5 font-medium text-token-description-foreground underline hover:text-token-foreground`,type:`button`,onClick:u,children:(0,q.jsx)(b,{id:`electron.onboarding.login.signup.welcomeV2`,defaultMessage:`Sign up`,description:`Sign-up link on v2 desktop onboarding`})})]}),t[24]=n,t[25]=r,t[26]=i,t[27]=a,t[28]=s,t[29]=c,t[30]=l,t[31]=u,t[32]=f,t[33]=p,t[34]=o,t[35]=_,t[36]=O):O=t[36];let k;return t[37]!==E||t[38]!==O?(k=(0,q.jsx)(`div`,{className:`flex h-full w-full items-center justify-center overflow-hidden bg-token-main-surface-primary pb-6 text-token-foreground`,children:(0,q.jsxs)(`div`,{className:`flex w-[340px] flex-col items-center gap-8`,children:[E,O]})}),t[37]=E,t[38]=O,t[39]=k):k=t[39],k}function Pe(){let e=d(m),o=j(),c=x(),l=y(),h=u(),g=f(te),E=v(ne),O=v(I),k=v(ee),A=g==null?null:{hasPreviouslyCompletedOnboarding:g},N=C(),F=ke(D(De).get(`enabled`,!1)),L=t=>{e.get(M).warning(l.formatMessage({id:`electron.onboarding.login.error`,defaultMessage:`Sign-in failed: {rawMessage}`,description:`Toast shown when sign-in fails on the desktop onboarding page`},{rawMessage:t}))},[re,R]=(0,K.useState)(null),z=re!=null,[B,ie]=(0,K.useState)(!1),[H,U]=(0,K.useState)(!1),[W,G]=(0,K.useState)(``),[oe,J]=(0,K.useState)(!1),Y=(0,K.useRef)(null),X=()=>{O(!1),k(!0)},se=()=>{ie(!1),J(!1),G(``)},ce=()=>{A!=null&&(S(e,s,{method:`apikey`,...A}),ie(!0))},le=()=>{U(!1)},ue=()=>{Y.current??(typeof window>`u`||`AudioContext`in window&&(Y.current=new window.AudioContext,Y.current.state===`suspended`&&Y.current.resume()))},Z=()=>{ue(),U(!0)},de=async(i=`signin`)=>{if(z){re?.abort(),R(null);return}if(A==null)return;let a=i===`google`||i===`microsoft`?i:`chatgpt`;S(e,s,{method:a,...A});let l=new AbortController;R(l);try{let{useDesktopAuth:s,useStreamlinedLoginUx:u}=Oe(w(N,Ee)),d=T(N,`3963726525`),{authUrl:f,completion:m}=await ae({signal:l.signal,useStreamlinedLogin:u});if(f){let e=Te({authUrl:Ae(f,i),includeCodexOriginStableId:d,useDesktopAuth:s,useStreamlinedLoginUx:u});p.dispatchMessage(`open-in-browser`,{url:e,...s?{useExternalBrowser:!0}:{}})}let g=await m;g.success?(S(e,r,{method:a,...A}),h.removeQueries({queryKey:_(`account-info`),exact:!0}),X(),E(!0),o.setAuthMethod(`chatgpt`),c(`/welcome`,{replace:!0})):(S(e,n,{method:a,errorKind:Fe(g.error),...A}),L(t(g.error??`Unknown error`)))}catch(r){if(r instanceof Error&&r.name===`AbortError`){S(e,n,{method:a,errorKind:`abort`,...A});return}S(e,n,{method:a,errorKind:Fe(r),...A}),L(t(r))}finally{R(null)}};return A==null?(0,q.jsx)(V,{children:(0,q.jsxs)(`div`,{className:`flex h-full w-full flex-col items-center justify-center gap-3 text-token-description-foreground`,children:[(0,q.jsx)(P,{className:`h-4 w-4 text-token-foreground`}),(0,q.jsx)(b,{id:`electron.onboarding.login.loading`,defaultMessage:`Loading…`,description:`Loading state while the login page prepares onboarding telemetry`})]})}):(0,q.jsx)(V,{fullBleed:!0,hideHeader:H,children:H?(0,q.jsx)(`div`,{className:`flex h-full w-full`,children:(0,q.jsx)(ye,{onExit:le,audioContextRef:Y})}):(0,q.jsx)(Ne,{apiKeyValue:W,isApiKeyEntryVisible:B,isApiKeySignInPending:oe,isChatGptSignInPending:z,showChatGptProviderSignIn:F,onApiKeySubmit:async()=>{let s=W.trim();if(!(!s||oe||A==null)){J(!0);try{await a(`login-with-api-key`,{hostId:i,apiKey:s}),S(e,r,{method:`apikey`,...A}),X(),E(!0),o.setAuthMethod(`apikey`),c(`/welcome`,{replace:!0})}catch(r){S(e,n,{method:`apikey`,errorKind:Fe(r),...A}),L(t(r))}finally{J(!1)}}},onApiKeyValueChange:G,onChatGptSignIn:de,onChatGptSignUp:()=>de(`signup`),onPlaySnake:Z,onResetApiKeyEntry:se,onShowApiKeyEntry:ce})})}function Fe(e){let t=typeof e==`string`?e:e instanceof Error?e.message:``;if(!t)return`unknown`;let n=t.toLowerCase();return n.includes(`network`)||n.includes(`fetch`)||n.includes(`timeout`)?`network`:n.includes(`auth`)||n.includes(`unauthorized`)||n.includes(`forbidden`)||n.includes(`invalid api key`)||n.includes(`401`)||n.includes(`403`)?`auth`:`unknown`}function Ie(){let e=(0,G.c)(3);{let t;return e[1]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,q.jsx)(Pe,{}),e[1]=t):t=e[1],t}let t;return e[2]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,q.jsx)(oe,{}),e[2]=t):t=e[2],t}export{Ie as LoginRoute}; //# sourceMappingURL=login-route-36U3XA9s.js.map \ No newline at end of file diff --git a/desktop/recovered/app-asar-extracted/webview/assets/remote-connections-settings-mrv9fxOy.js b/desktop/recovered/app-asar-extracted/webview/assets/remote-connections-settings-mrv9fxOy.js index a985e90e..4d4928f5 100644 --- a/desktop/recovered/app-asar-extracted/webview/assets/remote-connections-settings-mrv9fxOy.js +++ b/desktop/recovered/app-asar-extracted/webview/assets/remote-connections-settings-mrv9fxOy.js @@ -1,2 +1,2 @@ -import{s as e}from"./chunk-Bj-mKKzh.js";import{Bn as t,C as n,In as r,Ln as i,_i as a,hi as o,vi as s,vn as c,yi as l,zr as u}from"./src-CYrn1fYL.js";import{$o as d,Ft as f,Gs as p,Ho as m,Js as h,Ks as g,Ut as _,Vo as v,Ws as y,Xs as b,Yo as x,Ys as S,bc as C,ia as w,l as T,qs as E,st as D}from"./app-server-manager-signals-BOGyjFm3.js";import{n as O,t as k}from"./jsx-runtime-CiQ1k8xo.js";import{t as A}from"./clsx-BcPLHiun.js";import"./react-dom-CvzHKZGB.js";import"./Combination-9DfZp13g.js";import"./core.esm-D4TU2vSa.js";import"./marked.esm-BR-H6018.js";import{F as j,I as ee,P as M,_ as N,c as P,f as F,g as I,h as te,lt as L,n as ne,s as R}from"./vscode-api-sUstfl-x.js";import{c as z,o as B,r as V}from"./lib-MoKmYgcO.js";import"./known-app-icon-BEI7OXDu.js";import"./branch-CGmrzqEi.js";import"./github-mark-Dzuhu9C1.js";import"./google-drive-CC-Egn92.js";import"./notion-CpBap5Le.js";import{g as H,v as U}from"./persisted-signal-Cx1QgqJn.js";import"./rpc-y95ESgjb.js";import{o as re}from"./statsig-Cajk3UKk.js";import"./request-BXHjsnqU.js";import{o as ie}from"./app-server-manager-hooks-BJ2CaNwA.js";import{t as W}from"./use-global-state-DeR7WgiQ.js";import"./invalidate-queries-and-broadcast-dPfhRWCd.js";import"./thread-context-inputs-BUuWvrJW.js";import"./config-queries-BDIsZFnB.js";import{n as ae,t as G}from"./device-connections-CLAiuDco.js";import{r as K}from"./remote-connection-visibility-CDSfTp_2.js";import"./sidebar-signals-B0JkGccK.js";import"./use-is-copilot-api-available-4vxhZax2.js";import"./use-auth-DXLjX3T4.js";import"./_baseEach-BGrGeeUo.js";import"./_baseOrderBy-MeGLt7Sq.js";import"./codex-api-DRlZt5zW.js";import"./use-debounced-value-DkRRYvDv.js";import"./apps-queries-CBUjthvi.js";import"./startCase-JPkD4wck.js";import"./experimental-features-queries-D47v_uon.js";import"./use-is-dark-DM2fOM7F.js";import"./connector-logo-uEk_Q1Qc.js";import{r as q}from"./toast-signal-By11REe1.js";import"./window-zoom-context-CSPQZGcc.js";import{t as J}from"./tooltip-BhXPONlb.js";import"./route-scope-BCJTBhwV.js";import"./mention-item-DOPWFNx_.js";import{t as Y}from"./button-Xd4Hy1MO.js";import{a as oe,i as se}from"./setting-storage-Cel8Tr7E.js";import"./reduced-motion-preference-BEImGcUg.js";import{t as ce}from"./spinner-Dvc_A3Ae.js";import"./use-codex-home-zmo5hiIG.js";import"./os-info-_sbi_vi2.js";import"./use-os-info-COk5WlgW.js";import"./remote-projects-nghNpfPT.js";import"./proxy-DktXrBt_.js";import"./app-shell-state-B5MFb4Nm.js";import"./app-shell-D7yvB1FT.js";import"./apps-DBd5dYzG.js";import"./chats-K-296NKY.js";import{t as le}from"./x-DypUcSQe.js";import"./projectless-thread-SfYhUYuZ.js";import"./plugin-install-store-BWRSuKkC.js";import{t as ue}from"./use-platform-BkwBnkgx.js";import"./use-is-plugins-enabled-DudZfU21.js";import"./browser-sidebar-availability-BQYQqnR4.js";import"./use-plugins-BKOuT9XR.js";import"./check-circle-filled-CC_XQe30.js";import"./app-shell-tab-controller-B0DXekEJ.js";import"./browser-sidebar-manager-CDP80WMh.js";import{t as de}from"./terminal-CsU-mb2r.js";import{t as fe}from"./info-BV-snsxq.js";import"./error-boundary-CSKrv358.js";import"./download-TILfllSA.js";import{t as pe}from"./with-window-DPMmD2K-.js";import"./window-app-action-helpers-u9SI1RSH.js";import{g as me,h as he}from"./use-plugin-install-flow-C0YRtVkW.js";import{t as ge}from"./code-D-L4oeor.js";import"./folder-DTP6uOAM.js";import"./settings.cog-CJF3NOGk.js";import"./chrome-cKtIFTD3.js";import"./openai-blossom-DWhxKWUa.js";import{t as _e}from"./pencil-V3ApGyCb.js";import"./filesystem-media-src-DlToOKVI.js";import{t as ve}from"./copy-to-clipboard-q_KxH8lM.js";import"./use-register-command-UoA_Jn9F.js";import"./run-command-BkY8dgoH.js";import{r as ye}from"./modal-controller-state-CEBUx8JQ.js";import{a as X,d as be,i as xe,l as Se,n as Ce,r as we}from"./dialog-layout-CCvvb1Vc.js";import"./open-project-setup-dialog-DowmE55I.js";import"./local-projects-CzDObGPq.js";import"./use-skills-DK2PGa-B.js";import{t as Te}from"./check-md-CZTnvSiA.js";import"./chevron-right-BZtXyaBk.js";import"./use-stable-callback-B56R_Ee2.js";import"./context-menu-DRia187f.js";import"./plugin-config-edits-DJ9rwaYl.js";import"./plugin-prefill-prompt-Cs8725Fp.js";import"./plugins-availability-C9cwO-r4.js";import"./electron-menu-shortcuts-CGQ9azZA.js";import"./homepage-logo-C4Z1mn1w.js";import"./loading-page-Cq0CTe5D.js";import"./sortable.esm-gKrsSmfW.js";import"./use-resize-observer-CbHbkQNx.js";import"./command-keybindings-D3tvaSVG.js";import"./expand-CUW1I4XL.js";import"./keyboard-modifier-state-ZeRcF5hb.js";import"./arrow-left-2njf4k3d.js";import"./use-window-controls-safe-area-X2AodDul.js";import"./app-shell-bottom-panel-scroll-sync-DpO90Rtb.js";import"./codex-api-error-B3GqHcV_.js";import{t as Ee}from"./checkbox-Bz6PC7ig.js";import"./minus-COQFKeWQ.js";import"./plan-management-state-CAozl_mZ.js";import"./links-DlYWpuc5.js";import"./upgrade-plan-dialog-launcher-lIFGy25G.js";import"./check-circle-DfFD7ExP.js";import"./phone-nbCYRsC2.js";import"./badge-mYHx4F5K.js";import"./search-mcwajolX.js";import{r as De,t as Oe}from"./dropdown-CHaZfyxI.js";import"./globe-DyuVFbAy.js";import"./segmented-toggle-DWC6PQcj.js";import"./three-dots-CGeU8S03.js";import{t as ke}from"./trash-BX2WKfvO.js";import"./chevron-D6hquBJC.js";import{t as Ae}from"./use-app-server-connection-state-CF840jph.js";import{t as je}from"./format-relative-date-time-C5HIX1IA.js";import"./remote-host-globe-icon-BlkSn_h5.js";import"./cloud-DcUmucTG.js";import{t as Me}from"./macbook-CQYmUEtL.js";import"./worktree-BtgJtB2d.js";import"./thread-env-icon-vcKSxad2.js";import"./check-plugin-availability-C1II8bXB.js";import"./plugin-detail-queries-nEDuNCez.js";import{n as Ne,t as Pe}from"./app-server-connection-state-4EIwSVVr.js";import"./alert-DaPZJtct.js";import{t as Fe}from"./laptop-CSgm11ej.js";import"./use-codex-pricing-url-BucpTKgk.js";import{t as Ie}from"./log-out-DJTSj1t6.js";import{t as Le}from"./toggle-CHrq20xd.js";import"./lock-DV6CP31m.js";import"./arrow-top-right-D16Z5Bms.js";import"./connected-apps-Dck9Rcbz.js";import{t as Re}from"./regenerate-Co1G5oL3.js";import"./app-connect-oauth-Bb1UV73Z.js";import"./computer-use-app-approvals-query-CZtrSy1-.js";import"./hooks-settings-queries-BpMbCsRw.js";import{i as ze}from"./settings-shared-BibDzP9i.js";import{t as Be}from"./more-menu-trigger-C0YZNDUR.js";import{t as Ve}from"./large-empty-state-DkWdWX9Z.js";import"./thread-page-header-C6IOSyDb.js";import{t as He}from"./settings-content-layout-sdUwAG0A.js";import{t as Ue}from"./sun-B3vc3gaW.js";import{n as We}from"./settings-row-DOKTjAF6.js";import{n as Ge,t as Ke}from"./settings-group-BO3RZzLk.js";import"./local-remote-control-enabled-sync-5WdGwpTj.js";import{t as qe}from"./settings-empty-state-AHLxAQVX.js";import{a as Je,i as Ye,t as Xe}from"./codex-mobile-setup-dialog-DzxoAWgH.js";import"./chatgpt-token-auth.browser-BZtEK2Ww.js";import{a as Ze,c as Qe,i as $e,n as et,o as tt,r as nt,s as rt,t as it}from"./codex-mobile-setup-flow-BJuQbjBl.js";import"./use-home-directory-fhl-Q5x2.js";import"./cursor-6A42vq9G.js";import{r as at,t as ot}from"./onboarding-login-content-DhtcviP9.js";import{t as st}from"./tabs-ji6s-l3m.js";import{t as ct}from"./useForm-BCVfGGKu.js";var Z=e(O()),Q=k(),lt=e=>(0,Q.jsxs)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:77,height:23,fill:`currentColor`,viewBox:`0 0 77 23`,...e,children:[(0,Q.jsx)(`path`,{d:`M30.286 10.672a1.25 1.25 0 1 1 0 2.5 1.25 1.25 0 0 1 0-2.5Zm3.966 0a1.25 1.25 0 1 1 0 2.5 1.25 1.25 0 0 1 0-2.5Zm3.965 0a1.25 1.25 0 1 1-.001 2.5 1.25 1.25 0 0 1 0-2.5Z`,opacity:.4}),(0,Q.jsx)(`path`,{d:`M24.54 16.716H5.972v.804c0 .45.364.815.814.815h16.938c.45 0 .814-.365.814-.815v-.804Zm2 .804a2.815 2.815 0 0 1-2.815 2.815H6.787a2.815 2.815 0 0 1-2.814-2.815v-1.2c0-.886.718-1.604 1.604-1.604h19.357c.886 0 1.605.718 1.605 1.604v1.2Z`}),(0,Q.jsx)(`path`,{d:`M23.256 15.716v-9.5a1 1 0 0 0-1-1h-14a1 1 0 0 0-1 1v9.5a1 1 0 1 1-2 0v-9.5a3 3 0 0 1 3-3h14a3 3 0 0 1 3 3v9.5a1 1 0 0 1-2 0ZM71.027 14.5V6a1 1 0 0 0-1-1h-16a1 1 0 1 1 0-2h16a3 3 0 0 1 3 3v8.5a3 3 0 0 1-3 3h-5.98a1 1 0 0 1 0-2h5.98a1 1 0 0 0 1-1Z`}),(0,Q.jsx)(`path`,{d:`M67.527 19.5a1.5 1.5 0 0 1-1.5 1.5h-1.98a1 1 0 1 1 0-2h1.48v-2.5a1 1 0 0 1 2 0v3Zm-8.563-1.01h-15v.491a.5.5 0 0 0 .5.5h14a.5.5 0 0 0 .5-.5v-.491Zm2 .491a2.5 2.5 0 0 1-2.5 2.5h-14a2.5 2.5 0 0 1-2.5-2.5v-.991a1.5 1.5 0 0 1 1.5-1.5h16a1.5 1.5 0 0 1 1.5 1.5v.991Z`}),(0,Q.jsx)(`path`,{d:`M57.903 17.49V9.984a1 1 0 0 0-1-1H46.024a1 1 0 0 0-1 1v7.506a1 1 0 0 1-2 0V9.984a3 3 0 0 1 3-3h10.88a3 3 0 0 1 3 3v7.506a1 1 0 0 1-2 0Z`})]}),ut=e=>(0,Q.jsxs)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:66,height:24,fill:`currentColor`,viewBox:`0 0 66 24`,...e,children:[(0,Q.jsx)(`path`,{d:`M29.323 10.672a1.25 1.25 0 1 1 0 2.5 1.25 1.25 0 0 1 0-2.5Zm3.965 0a1.25 1.25 0 1 1 0 2.5 1.25 1.25 0 0 1 0-2.5Zm3.965 0a1.25 1.25 0 1 1 0 2.5 1.25 1.25 0 0 1 0-2.5Z`,opacity:.4}),(0,Q.jsx)(`path`,{d:`M23.576 16.715H5.009v.805c0 .45.365.814.815.814H22.76c.45 0 .814-.365.815-.814v-.805Zm2 .805a2.815 2.815 0 0 1-2.815 2.814H5.824a2.815 2.815 0 0 1-2.815-2.814v-1.2c0-.887.719-1.605 1.605-1.605H23.97c.886 0 1.606.718 1.606 1.604v1.2Z`}),(0,Q.jsx)(`path`,{d:`M22.293 15.715v-9.5a1 1 0 0 0-1-1h-14a1 1 0 0 0-1 1v9.5a1 1 0 1 1-2 0v-9.5a3 3 0 0 1 3-3h14a3 3 0 0 1 3 3v9.5a1 1 0 1 1-2 0Zm26.148-7.341a1.22 1.22 0 1 1-2.44 0 1.22 1.22 0 0 1 2.44 0Zm0 7.25a1.22 1.22 0 1 1-2.44 0 1.22 1.22 0 0 1 2.44 0Z`}),(0,Q.jsx)(`path`,{d:`M61.036 6.75c0-.524-.446-1-1.063-1H45.02c-.616 0-1.062.476-1.062 1V11h17.078V6.75Zm2 6.25H41.958V6.75c0-1.686 1.4-3 3.062-3h14.953c1.663 0 3.063 1.314 3.063 3V13Z`}),(0,Q.jsx)(`path`,{d:`M61.036 13H43.958v4.25c0 .523.446 1 1.062 1h14.953c.617 0 1.063-.477 1.063-1V13Zm2 4.25c0 1.685-1.4 3-3.063 3H45.02c-1.662 0-3.062-1.315-3.062-3V11h21.078v6.25Z`})]}),$=L(),dt=e=>(0,Q.jsxs)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:61,height:23,fill:`currentColor`,viewBox:`0 0 61 23`,...e,children:[(0,Q.jsx)(`path`,{d:`M15.01 5.012a1 1 0 0 0-1-1h-8a1 1 0 0 0-1 1v13.5a1 1 0 0 0 1 1h8a1 1 0 0 0 1-1v-13.5Zm40.8 11.706H37.245v.803c0 .45.364.815.814.815h16.937c.45 0 .815-.365.815-.814v-.804Zm-43.802-.456a1 1 0 1 1 0 2h-4a1 1 0 1 1 0-2h4Zm42.52-10.044a1 1 0 0 0-1-1h-14a1 1 0 0 0-1 1v8.5h16v-8.5Zm2 8.531c.732.15 1.283.797 1.283 1.573v1.2a2.815 2.815 0 0 1-2.815 2.814H38.059a2.814 2.814 0 0 1-2.814-2.814v-1.2c0-.776.55-1.424 1.283-1.573V6.218a3 3 0 0 1 3-3h14a3 3 0 0 1 3 3v8.531Zm-39.519 3.763a3 3 0 0 1-3 3h-8a3 3 0 0 1-3-3v-13.5a3 3 0 0 1 3-3h8a3 3 0 0 1 3 3v13.5Z`}),(0,Q.jsx)(`path`,{d:`M22.26 10.672a1.25 1.25 0 1 1-.001 2.5 1.25 1.25 0 0 1 0-2.5Zm3.965 0a1.25 1.25 0 1 1 0 2.5 1.25 1.25 0 0 1 0-2.5Zm3.965 0a1.25 1.25 0 1 1 0 2.5 1.25 1.25 0 0 1 0-2.5Z`,opacity:.4})]});function ft(e){let t=(0,$.c)(2),{onClose:n}=e,r;return t[0]===n?r=t[1]:(r=(0,Q.jsx)(it,{onClose:n,variant:`dialog`}),t[0]=n,t[1]=r),r}var pt=e=>(0,Q.jsx)(`svg`,{width:20,height:20,viewBox:`0 0 19.3131 15.4971`,fill:`none`,xmlns:`http://www.w3.org/2000/svg`,...e,children:(0,Q.jsx)(`path`,{d:`M13.5748 3.99805C13.5748 3.40409 13.5741 2.9985 13.5485 2.68457C13.5297 2.45518 13.4999 2.30738 13.4616 2.2002L13.4205 2.10449C13.3015 1.87093 13.1203 1.67534 12.8981 1.53906L12.8004 1.48438C12.687 1.42659 12.5265 1.38146 12.2204 1.35645C11.9064 1.33082 11.5008 1.33008 10.9069 1.33008H8.40687C7.81256 1.33008 7.40645 1.3308 7.09242 1.35645C6.86284 1.37521 6.71525 1.40501 6.60805 1.44336L6.51234 1.48438C6.27892 1.60334 6.08414 1.78476 5.94789 2.00684L5.8932 2.10449C5.83539 2.21795 5.78932 2.3783 5.7643 2.68457C5.73867 2.9985 5.73793 3.4041 5.73793 3.99805V11.498C5.73793 12.0924 5.73864 12.4985 5.7643 12.8125C5.78932 13.1188 5.83539 13.2791 5.8932 13.3926L5.94789 13.4902C6.08408 13.7121 6.27912 13.8928 6.51234 14.0117L6.60805 14.0527C6.71527 14.0911 6.86269 14.1219 7.09242 14.1406C7.40645 14.1663 7.81258 14.167 8.40687 14.167H10.9069C11.5008 14.167 11.9064 14.1663 12.2204 14.1406C12.5266 14.1156 12.687 14.0695 12.8004 14.0117L12.8981 13.957C13.1202 13.8208 13.3016 13.626 13.4205 13.3926L13.4616 13.2969C13.4999 13.1897 13.5297 13.0421 13.5485 12.8125C13.5741 12.4985 13.5748 12.0924 13.5748 11.498V3.99805ZM1.29945 3.5C1.53086 3.29514 1.88139 3.27416 2.13832 3.4668C2.43209 3.68713 2.49236 4.10365 2.27211 4.39746L1.44594 5.49805C1.35163 5.6241 1.34344 5.79468 1.42445 5.92969L1.985 6.86426L2.04262 6.96778C2.29256 7.45758 2.29238 8.03845 2.04262 8.52832L1.985 8.63184L1.38539 9.63184C1.31174 9.75459 1.31174 9.9085 1.38539 10.0313L2.31019 11.5732L2.36781 11.6943C2.47071 11.9861 2.35733 12.32 2.08168 12.4854C1.80607 12.6506 1.45866 12.5933 1.24965 12.3652L1.16957 12.2568L0.244764 10.7158C-0.0815946 10.1719 -0.0815817 9.49218 0.244764 8.94824L0.844374 7.94824L0.886366 7.85059C0.90467 7.78355 0.904788 7.71253 0.886366 7.64551L0.844374 7.54883L0.283827 6.61426C-0.0754302 6.0155 -0.0364043 5.25886 0.38246 4.7002L1.20766 3.59961L1.29945 3.5ZM17.2311 3.42774C17.5066 3.2626 17.8541 3.32006 18.0631 3.54785L18.1432 3.65625L19.0289 5.13281L19.0924 5.24707C19.3631 5.78714 19.3297 6.43123 19.0045 6.94043L18.9303 7.04688L18.5299 7.58106C18.4355 7.70702 18.4266 7.87761 18.5075 8.0127L19.068 8.94824L19.1256 9.05176C19.3755 9.54172 19.3757 10.1224 19.1256 10.6123L19.068 10.7158L18.1432 12.2568C17.9543 12.5717 17.546 12.6743 17.2311 12.4854C16.9163 12.2965 16.8139 11.8881 17.0026 11.5732L17.9284 10.0313L17.9694 9.93457C17.9878 9.86749 17.9877 9.7966 17.9694 9.72949L17.9284 9.63184L17.3668 8.69727C17.0077 8.09854 17.0467 7.3418 17.4655 6.78321L17.8668 6.24903L17.8981 6.2002C17.953 6.0981 17.9588 5.97637 17.9147 5.86914L17.8883 5.81739L17.0026 4.34082L16.9459 4.21875C16.8431 3.92696 16.9555 3.59311 17.2311 3.42774ZM10.4899 2.69434C10.8571 2.69436 11.1549 2.99212 11.1549 3.35938C11.1547 3.72643 10.857 4.02439 10.4899 4.02442H8.82289C8.45589 4.02427 8.15809 3.72635 8.15785 3.35938C8.15785 2.9922 8.45575 2.69449 8.82289 2.69434H10.4899ZM14.9049 11.498C14.9049 12.0705 14.9058 12.5401 14.8746 12.9209C14.8469 13.2608 14.7905 13.5744 14.6637 13.8701L14.6051 13.9961C14.3746 14.4485 14.0239 14.8268 13.5934 15.0908L13.4039 15.1973C13.0718 15.3664 12.7172 15.4341 12.3287 15.4658C11.9481 15.4969 11.479 15.4971 10.9069 15.4971H8.40687C7.83446 15.4971 7.36478 15.4969 6.98402 15.4658C6.64417 15.4381 6.33043 15.3826 6.0348 15.2559L5.90883 15.1973C5.45643 14.9668 5.07816 14.6159 4.8141 14.1855L4.70765 13.9961C4.53841 13.6639 4.47085 13.3094 4.4391 12.9209C4.40799 12.5401 4.40785 12.0705 4.40785 11.498V3.99805C4.40785 3.42591 4.40802 2.95682 4.4391 2.57617C4.47084 2.18776 4.5385 1.83309 4.70765 1.50098L4.8141 1.31153C5.07815 0.881047 5.45638 0.530355 5.90883 0.299807L6.0348 0.241213C6.33047 0.114425 6.64412 0.0580467 6.98402 0.0302756C7.36478 -0.000831299 7.83447 2.15602e-06 8.40687 2.15602e-06H10.9069C11.479 1.93302e-06 11.9481 -0.000805488 12.3287 0.0302756C12.7172 0.0620151 13.0718 0.130593 13.4039 0.299807L13.5934 0.405276C14.024 0.669346 14.3745 1.04841 14.6051 1.50098L14.6637 1.62598C14.7907 1.92182 14.8469 2.23605 14.8746 2.57617C14.9057 2.95681 14.9049 3.42594 14.9049 3.99805V11.498Z`,fill:`currentColor`})});function mt(e){switch(e.device_type){case`phone`:return(0,Q.jsx)(pt,{className:`icon-sm`});case`laptop`:return(0,Q.jsx)(Me,{className:`icon-sm`});case`desktop`:return(0,Q.jsx)(Fe,{className:`icon-sm`});case null:case void 0:default:return(0,Q.jsx)(Fe,{className:`icon-sm`})}}function ht(e){switch(e.clientType){case`CODEX_CLI`:return(0,Q.jsx)(de,{className:`icon-sm`});case`CODEX_DESKTOP_APP`:return(0,Q.jsx)(Fe,{className:`icon-sm`});case`CODEX_IDE_VSCODE`:case`CODEX_IDE_XCODE`:case`CODEX_IDE_JETBRAINS`:return(0,Q.jsx)(ge,{className:`icon-sm`});case`CODEX_UNKNOWN`:return(0,Q.jsx)(Fe,{className:`icon-sm`})}}var gt=`remote-control-client-revoke-success`,_t=`remote-control-client-revoke-error`,vt=`[remote-connections/settings]`;function yt(){let e=(0,$.c)(2),{data:t,isLoading:n}=W(u.CODEX_MOBILE_SETUP_COMPLETED);if(n)return null;if(!t){let t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,Q.jsx)(xt,{mode:`setup`}),e[0]=t):t=e[0],t}let r;return e[1]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(xt,{mode:`manage`}),(0,Q.jsx)(bt,{})]}),e[1]=r):r=e[1],r}function bt(){let e=(0,$.c)(35),t=j(te),r=z(),{platform:i}=ue(),a=oe(n.keepRemoteControlAwakeWhilePluggedIn),o=M(_,m),s;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(s={hostId:m},e[0]=s):s=e[0];let c=et(s),l;e[1]!==r||e[2]!==t||e[3]!==c?(l=e=>{H(t,{eventName:`codex_remote_control_host_toggle_clicked`,metadata:{enabled:e}}),c.mutate(e,{onError:()=>{t.get(q).danger(r.formatMessage({id:`settings.remoteConnections.localHost.remoteControlUpdateError`,defaultMessage:`Couldn’t update remote control availability`,description:`Toast shown when enabling or disabling local remote control fails`}))}})},e[1]=r,e[2]=t,e[3]=c,e[4]=l):l=e[4];let u=l,d;e[5]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,Q.jsx)(Ke.Header,{title:(0,Q.jsx)(B,{id:`settings.remoteConnections.localHost.otherSettings.title`,defaultMessage:`Other settings`,description:`Header title for additional local remote control settings`})}),e[5]=d):d=e[5];let f,p,h;e[6]===Symbol.for(`react.memo_cache_sentinel`)?(f=(0,Q.jsx)(Je,{className:`icon-sm`}),p=(0,Q.jsx)(B,{id:`settings.remoteConnections.localHost.remoteControl.label`,defaultMessage:`Allow this device to be discovered and controlled`,description:`Label for allowing remote control on this device`}),h=(0,Q.jsx)(B,{id:`settings.remoteConnections.localHost.remoteControl.description`,defaultMessage:`Authorized devices on your ChatGPT account can discover and control this device`,description:`Description for allowing remote control on this device`}),e[6]=f,e[7]=p,e[8]=h):(f=e[6],p=e[7],h=e[8]);let g=c.isPending,v;e[9]===r?v=e[10]:(v=r.formatMessage({id:`settings.remoteConnections.localHost.remoteControl.label`,defaultMessage:`Allow this device to be discovered and controlled`,description:`Label for allowing remote control on this device`}),e[9]=r,e[10]=v);let y;e[11]!==u||e[12]!==o||e[13]!==c.isPending||e[14]!==v?(y=(0,Q.jsx)(We,{icon:f,label:p,description:h,control:(0,Q.jsx)(Le,{checked:o,disabled:g,onChange:u,ariaLabel:v})}),e[11]=u,e[12]=o,e[13]=c.isPending,e[14]=v,e[15]=y):y=e[15];let b;e[16]===Symbol.for(`react.memo_cache_sentinel`)?(b=(0,Q.jsx)(Ue,{className:`icon-sm`}),e[16]=b):b=e[16];let x;e[17]===i?x=e[18]:(x=i===`windows`?(0,Q.jsx)(B,{...Dt.keepLiveWindowsLabel}):(0,Q.jsx)(B,{...Dt.keepLiveMacLabel}),e[17]=i,e[18]=x);let S;e[19]===Symbol.for(`react.memo_cache_sentinel`)?(S=(0,Q.jsx)(B,{id:`settings.remoteConnections.localHost.keepLive.description`,defaultMessage:`Prevent sleep when computer is plugged in and remote access is enabled`,description:`Description for keeping the local computer awake`}),e[19]=S):S=e[19];let C=a??!1,w;e[20]===t?w=e[21]:(w=e=>{se(t,n.keepRemoteControlAwakeWhilePluggedIn,e)},e[20]=t,e[21]=w);let T;e[22]!==r||e[23]!==i?(T=i===`windows`?r.formatMessage(Dt.keepLiveWindowsLabel):r.formatMessage(Dt.keepLiveMacLabel),e[22]=r,e[23]=i,e[24]=T):T=e[24];let E;e[25]!==C||e[26]!==w||e[27]!==T?(E=(0,Q.jsx)(Le,{checked:C,onChange:w,ariaLabel:T}),e[25]=C,e[26]=w,e[27]=T,e[28]=E):E=e[28];let D;e[29]!==x||e[30]!==E?(D=(0,Q.jsx)(We,{icon:b,label:x,description:S,control:E}),e[29]=x,e[30]=E,e[31]=D):D=e[31];let O;return e[32]!==D||e[33]!==y?(O=(0,Q.jsxs)(Ke,{children:[d,(0,Q.jsx)(Ke.Content,{children:(0,Q.jsxs)(Ge,{children:[y,D]})})]}),e[32]=D,e[33]=y,e[34]=O):O=e[34],O}function xt(e){let t=(0,$.c)(81),{mode:n}=e,r=j(te),i=z(),{platform:a}=ue(),[o,s]=(0,Z.useState)(null),[c,l]=(0,Z.useState)(null),[u]=v(`local_remote_control_client_id`),d=ee(nt),f=o===`waiting`,p;t[0]!==c||t[1]!==u||t[2]!==f?(p={existingClientIds:c,localRemoteControlClientId:u,waiting:f},t[0]=c,t[1]=u,t[2]=f,t[3]=p):p=t[3];let m=tt(M($e,p).data,u),h=o===`waiting`&&c!=null?Ze(m,c):null,g=h===`connected`?`connected`:h===`dismiss`?null:o,_;t[4]===r.query?_=t[5]:(_=r.query.snapshot(nt),t[4]=r.query,t[5]=_);let y=_,b;t[6]!==i||t[7]!==y||t[8]!==r?(b=(e,t)=>{let{clientId:n}=t;H(r,{eventName:`codex_remote_control_client_revoke_result`,metadata:{result:`succeeded`}}),y.setData(e=>e?.filter(e=>e.client_id!==n)),y.invalidate(),r.get(q).success(i.formatMessage({id:`settings.remoteConnections.remoteControlClients.revoke.success`,defaultMessage:`Revoked device access`,description:`Toast shown when access for a remote control client is revoked`}),{id:gt})},t[6]=i,t[7]=y,t[8]=r,t[9]=b):b=t[9];let x;t[10]!==i||t[11]!==r?(x=(e,t)=>{let{clientId:n}=t;H(r,{eventName:`codex_remote_control_client_revoke_result`,metadata:{result:`failed`}}),I.warning(`${vt} remote_control_client_revoke_failed`,{safe:{},sensitive:{clientId:n,error:e}}),r.get(q).danger(i.formatMessage({id:`settings.remoteConnections.remoteControlClients.revoke.error`,defaultMessage:`Failed to revoke device access`,description:`Toast shown when access for a remote control client cannot be revoked`}),{id:_t})},t[10]=i,t[11]=r,t[12]=x):x=t[12];let S;t[13]!==b||t[14]!==x?(S={mutationFn:Qe,onSuccess:b,onError:x},t[13]=b,t[14]=x,t[15]=S):S=t[15];let C=N(S),w;t[16]!==u||t[17]!==d.data?(w=tt(d.data,u),t[16]=u,t[17]=d.data,t[18]=w):w=t[18];let T=w,E=T?.length,D=d.error instanceof rt,O,k;t[19]!==n||t[20]!==E||t[21]!==d.isLoading||t[22]!==r?(O=()=>{n!==`manage`||d.isLoading||E==null||H(r,{eventName:`codex_remote_control_client_inventory_loaded`,metadata:{client_count:E}})},k=[n,E,d.isLoading,r],t[19]=n,t[20]=E,t[21]=d.isLoading,t[22]=r,t[23]=O,t[24]=k):(O=t[23],k=t[24]),(0,Z.useEffect)(O,k);let A=C.isPending?C.variables?.clientId:null,P;t[25]!==n||t[26]!==E||t[27]!==T||t[28]!==r?(P=()=>{if(H(r,{eventName:`codex_remote_control_add_device_started`,metadata:{existing_client_count:E??0,source:n}}),n===`setup`){ye(r,ft);return}l(new Set(T?.map(wt))),s(`waiting`)},t[25]=n,t[26]=E,t[27]=T,t[28]=r,t[29]=P):P=t[29];let F=P,L;t[30]===y?L=t[31]:(L=()=>{s(null),l(null),y.invalidate()},t[30]=y,t[31]=L);let ne=L,R=(T?.length??0)>0,V;t[32]===a?V=t[33]:(V=a===`windows`?(0,Q.jsx)(B,{id:`settings.remoteConnections.remoteControlClients.devices.title.windows`,defaultMessage:`Devices that can control this PC`,description:`Header title for devices that can control this Windows device`}):(0,Q.jsx)(B,{id:`settings.remoteConnections.remoteControlClients.devices.title`,defaultMessage:`Devices that can control this Mac`,description:`Header title for devices that can control this Mac`}),t[32]=a,t[33]=V);let U;t[34]!==F||t[35]!==R||t[36]!==n||t[37]!==d.isLoading?(U=n===`manage`&&R?(0,Q.jsx)(Y,{color:`secondary`,disabled:d.isLoading,onClick:F,children:(0,Q.jsx)(B,{id:`settings.remoteConnections.add.short`,defaultMessage:`Add`,description:`Button label for adding a connection from a connections settings tab`})}):null,t[34]=F,t[35]=R,t[36]=n,t[37]=d.isLoading,t[38]=U):U=t[38];let re;t[39]!==V||t[40]!==U?(re=(0,Q.jsx)(Ke.Header,{title:V,actions:U}),t[39]=V,t[40]=U,t[41]=re):re=t[41];let ie;t[42]!==F||t[43]!==n||t[44]!==a?(ie=n===`setup`?(0,Q.jsx)(Ve,{spacing:`compact`,title:null,description:a===`windows`?(0,Q.jsx)(B,{id:`settings.remoteConnections.remoteControlClients.setup.description.windows`,defaultMessage:`Control this PC from your phone or other device`,description:`Description shown before local remote control setup has started on Windows`}):(0,Q.jsx)(B,{id:`settings.remoteConnections.remoteControlClients.setup.description`,defaultMessage:`Control this Mac from your phone or other device`,description:`Description shown before local remote control setup has started`}),illustration:(0,Q.jsx)(dt,{className:`h-6 w-auto text-token-text-primary`}),actions:(0,Q.jsx)(Y,{color:`secondary`,onClick:F,children:(0,Q.jsx)(B,{id:`settings.remoteConnections.remoteControlClients.setup.action`,defaultMessage:`Set up`,description:`Button label to start local remote control setup`})})}):null,t[42]=F,t[43]=n,t[44]=a,t[45]=ie):ie=t[45];let W;t[46]!==n||t[47]!==d.isLoading?(W=n===`manage`&&d.isLoading&&(0,Q.jsxs)(`div`,{className:`flex min-h-[62px] items-center justify-center gap-2 px-4 text-sm text-token-text-secondary`,children:[(0,Q.jsx)(ce,{className:`icon-xs`}),(0,Q.jsx)(B,{id:`settings.remoteConnections.remoteControlClients.loading`,defaultMessage:`Loading device list`,description:`Loading message for devices that can control the local computer`})]}),t[46]=n,t[47]=d.isLoading,t[48]=W):W=t[48];let ae;t[49]!==n||t[50]!==D||t[51]!==d.isError||t[52]!==d.isFetching||t[53]!==r?(ae=n===`manage`&&d.isError?(0,Q.jsx)(Ve,{spacing:`compact`,title:(0,Q.jsx)(B,{id:`settings.remoteConnections.remoteControlClients.loadError.title`,defaultMessage:`Couldn’t load device list`,description:`Error title shown when devices that can control the local computer fail to load`}),description:D?(0,Q.jsx)(B,{id:`settings.remoteConnections.remoteControlClients.loadError.authRequired`,defaultMessage:`Sign in to ChatGPT again, then retry`,description:`Error message shown when loading remote control clients requires renewed ChatGPT authentication`}):(0,Q.jsx)(B,{id:`settings.remoteConnections.remoteControlClients.loadError.generic`,defaultMessage:`Retry to load devices that can control this computer`,description:`Error message shown when devices that can control the local computer fail to load`}),actions:(0,Q.jsx)(Y,{color:`secondary`,disabled:d.isFetching,onClick:()=>{r.get(nt).refetch()},children:(0,Q.jsx)(B,{id:`settings.remoteConnections.remoteControlClients.loadError.retry`,defaultMessage:`Retry`,description:`Button label to retry loading remote control clients`})})}):null,t[49]=n,t[50]=D,t[51]=d.isError,t[52]=d.isFetching,t[53]=r,t[54]=ae):ae=t[54];let G;t[55]!==F||t[56]!==n||t[57]!==a||t[58]!==T?.length||t[59]!==d.isError||t[60]!==d.isLoading?(G=n===`manage`&&!d.isLoading&&!d.isError&&T?.length===0&&(0,Q.jsx)(Ve,{spacing:`compact`,title:null,description:a===`windows`?(0,Q.jsx)(B,{id:`settings.remoteConnections.remoteControlClients.empty.windows`,defaultMessage:`Add device to control this PC remotely`,description:`Empty state for devices that can control the local Windows device`}):(0,Q.jsx)(B,{id:`settings.remoteConnections.remoteControlClients.empty`,defaultMessage:`Add device to control this Mac remotely`,description:`Empty state for devices that can control the local computer`}),illustration:(0,Q.jsx)(dt,{className:`h-6 w-auto text-token-text-primary`}),actions:(0,Q.jsx)(Y,{color:`secondary`,onClick:F,children:(0,Q.jsx)(B,{id:`settings.remoteConnections.add.short`,defaultMessage:`Add`,description:`Button label for adding a connection from a connections settings tab`})})}),t[55]=F,t[56]=n,t[57]=a,t[58]=T?.length,t[59]=d.isError,t[60]=d.isLoading,t[61]=G):G=t[61];let K;t[62]!==n||t[63]!==T||t[64]!==d.isError||t[65]!==C||t[66]!==A?(K=n===`manage`&&!d.isError?T?.map(e=>(0,Q.jsx)(We,{icon:mt(e),label:Tt(e),description:Et(e),control:(0,Q.jsx)(Y,{color:`secondary`,disabled:C.isPending,loading:A===e.client_id,onClick:()=>{C.mutate({clientId:e.client_id})},children:(0,Q.jsx)(B,{id:`settings.remoteConnections.remoteControlClients.revoke`,defaultMessage:`Revoke access`,description:`Button label that revokes access for a remote control client`})})},e.client_id)):null,t[62]=n,t[63]=T,t[64]=d.isError,t[65]=C,t[66]=A,t[67]=K):K=t[67];let J;t[68]!==ie||t[69]!==W||t[70]!==ae||t[71]!==G||t[72]!==K?(J=(0,Q.jsx)(Ke.Content,{children:(0,Q.jsxs)(Ge,{children:[ie,W,ae,G,K]})}),t[68]=ie,t[69]=W,t[70]=ae,t[71]=G,t[72]=K,t[73]=J):J=t[73];let oe;t[74]!==ne||t[75]!==g?(oe=g==null?null:(0,Q.jsx)(Xe,{open:!0,showStartSetupError:!1,setupInProgress:!1,step:g,onAllowHost:Ct,onOpenChange:e=>{e||ne()},onSkip:ne,onStartSetup:St}),t[74]=ne,t[75]=g,t[76]=oe):oe=t[76];let se;return t[77]!==re||t[78]!==J||t[79]!==oe?(se=(0,Q.jsxs)(Ke,{children:[re,J,oe]}),t[77]=re,t[78]=J,t[79]=oe,t[80]=se):se=t[80],se}function St(){}function Ct(){}function wt(e){return e.client_id}function Tt(e){return e.display_name??e.device_model??e.platform??e.client_id}function Et(e){return e.last_seen_at==null?(0,Q.jsx)(B,{id:`settings.remoteConnections.remoteControlClients.authorized`,defaultMessage:`Authorized device`,description:`Description for an authorized device that can control this computer`}):(0,Q.jsx)(B,{id:`settings.remoteConnections.remoteControlClients.lastSeen`,defaultMessage:`Last connected {date}`,description:`Description for when a device that can control this computer was last seen`,values:{date:(0,Q.jsx)(je,{dateString:e.last_seen_at},`last-seen-at`)}})}var Dt=V({keepLiveMacLabel:{id:`settings.remoteConnections.localHost.keepLive.label`,defaultMessage:`Keep this Mac awake`,description:`Label for keeping the local Mac awake`},keepLiveWindowsLabel:{id:`settings.remoteConnections.localHost.keepLive.label.windows`,defaultMessage:`Keep this PC awake`,description:`Label for keeping the local Windows device awake`}}),Ot=`[remote-connections/auth]`;function kt({hostId:e,open:t,onOpenChange:n}){let r=j(te),i=z(),[a,o]=(0,Z.useState)(null),[s,l]=(0,Z.useState)(``),[u,d]=(0,Z.useState)(!1),[f,p]=(0,Z.useState)(!1),m=a!=null,h=()=>{o(null),l(``),d(!1),p(!1)},g=({abortPendingLogin:e})=>{e&&a?.abort(),h(),n(!1)},_=e=>{r.get(q).warning(i.formatMessage({id:`settings.remoteConnections.auth.error`,defaultMessage:`Sign-in failed: {message}`,description:`Toast shown when remote connection authentication fails`},{message:c(e)}))},v=async()=>{if(e==null){_(`Remote connection manager is unavailable.`);return}if(m){a?.abort(),o(null);return}let t=new AbortController;o(t);try{let{authUrl:n,completion:r}=await at({hostId:e,signal:t.signal});F.dispatchMessage(`open-in-browser`,{url:n,useExternalBrowser:!0});let i=await r;if(!i.success){I.warning(`${Ot} chatgpt_sign_in_failed`,{safe:{},sensitive:{hostId:e,error:i.error??`Unknown error`}}),_(i.error??`Unknown error`);return}g({abortPendingLogin:!1})}catch(t){if(t?.name===`AbortError`)return;I.warning(`${Ot} chatgpt_sign_in_failed`,{safe:{},sensitive:{error:t,hostId:e}}),_(t)}finally{o(null)}},y=async()=>{if(e==null){_(`Remote connection manager is unavailable.`);return}let t=s.trim();if(!(!t||f)){p(!0);try{await C(`login-with-api-key-for-host`,{hostId:e,apiKey:t}),g({abortPendingLogin:!1})}catch(t){I.warning(`${Ot} api_key_sign_in_failed`,{safe:{},sensitive:{error:t,hostId:e}}),_(t)}finally{p(!1)}}};return(0,Q.jsx)(Se,{open:t,onOpenChange:e=>{if(!e){g({abortPendingLogin:!0});return}n(!0)},contentProps:{"aria-describedby":void 0},showDialogClose:!1,size:`compact`,children:(0,Q.jsxs)(Ce,{children:[(0,Q.jsx)(be,{className:`sr-only`,children:i.formatMessage({id:`settings.remoteConnections.auth.title`,defaultMessage:`Login required`,description:`Title for the remote connection login dialog`})}),(0,Q.jsx)(X,{children:(0,Q.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[(0,Q.jsx)(xe,{className:`min-w-0 flex-1`,title:(0,Q.jsx)(B,{id:`settings.remoteConnections.auth.title`,defaultMessage:`Login required`,description:`Title for the remote connection login dialog`}),subtitle:(0,Q.jsx)(B,{id:`settings.remoteConnections.auth.description`,defaultMessage:`Authenticate this remote Codex connection to continue.`,description:`Description for the remote connection login dialog`})}),(0,Q.jsx)(Y,{"aria-label":i.formatMessage({id:`settings.remoteConnections.auth.closeIcon`,defaultMessage:`Close`,description:`Accessible label for the remote connection login dialog close button`}),className:`-mt-1 -mr-1 shrink-0`,color:`ghost`,size:`icon`,onClick:()=>g({abortPendingLogin:!0}),children:(0,Q.jsx)(le,{className:`icon-xs`})})]})}),(0,Q.jsx)(X,{children:(0,Q.jsx)(`div`,{className:`flex justify-center pt-2`,children:(0,Q.jsx)(ot,{apiKeyValue:s,isApiKeyEntryVisible:u,isApiKeySignInPending:f,isChatGptSignInPending:m,onApiKeySecondaryAction:()=>{l(``),d(!1)},onApiKeySubmit:y,onApiKeyValueChange:l,onChatGptSignIn:v,onShowApiKeyEntry:()=>d(!0),apiKeySecondaryActionLabel:(0,Q.jsx)(B,{id:`settings.remoteConnections.auth.back`,defaultMessage:`Back`,description:`Back button in the remote connection login dialog`})})})}),(0,Q.jsx)(X,{children:(0,Q.jsx)(we,{children:(0,Q.jsx)(Y,{color:`ghost`,type:`button`,onClick:()=>g({abortPendingLogin:!0}),children:(0,Q.jsx)(B,{id:`settings.remoteConnections.auth.close`,defaultMessage:`Close`,description:`Close button for the remote connection login dialog`})})})})]})})}function At(e){let t=(0,$.c)(19),{emptyState:n,footer:r,list:i,open:a,title:o,onOpenChange:s,onSubmit:c}=e,l;t[0]===o?l=t[1]:(l=(0,Q.jsx)(X,{children:(0,Q.jsx)(xe,{title:o})}),t[0]=o,t[1]=l);let u=i==null?`h-full`:`max-h-full overflow-y-auto`,d;t[2]!==n||t[3]!==i?(d=i??(0,Q.jsx)(`div`,{className:`flex h-full items-center justify-center px-4 text-sm text-token-text-tertiary`,children:n}),t[2]=n,t[3]=i,t[4]=d):d=t[4];let f;t[5]!==u||t[6]!==d?(f=(0,Q.jsx)(X,{className:`pt-6`,children:(0,Q.jsx)(`div`,{className:`h-[300px]`,children:(0,Q.jsx)(Ge,{className:u,children:d})})}),t[5]=u,t[6]=d,t[7]=f):f=t[7];let p;t[8]===r?p=t[9]:(p=(0,Q.jsx)(X,{className:`pt-6`,children:r}),t[8]=r,t[9]=p);let m;t[10]!==c||t[11]!==l||t[12]!==f||t[13]!==p?(m=(0,Q.jsxs)(Ce,{as:`form`,onSubmit:c,children:[l,f,p]}),t[10]=c,t[11]=l,t[12]=f,t[13]=p,t[14]=m):m=t[14];let h;return t[15]!==s||t[16]!==a||t[17]!==m?(h=(0,Q.jsx)(Se,{open:a,onOpenChange:s,children:m}),t[15]=s,t[16]=a,t[17]=m,t[18]=h):h=t[18],h}function jt(e){let t=(0,$.c)(34),{connections:n,isSaving:r,open:i,refreshing:a,onAddManually:o,onOpenChange:s,onRefresh:c,onSave:l,onToggleConnection:u,selectedHostIds:d}=e,f=z(),p;t[0]===l?p=t[1]:(p=e=>{e.preventDefault(),l()},t[0]=l,t[1]=p);let m=p,h;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(h=(0,Q.jsx)(B,{id:`settings.remoteConnections.discoveryDialog.empty`,defaultMessage:`No SSH connections found`,description:`Empty state shown when no discovered SSH connections are available`}),t[2]=h):h=t[2];let g;t[3]===f?g=t[4]:(g=f.formatMessage({id:`settings.remoteConnections.discoveryDialog.refresh`,defaultMessage:`Refresh`,description:`Accessible label for refreshing discovered SSH connections in the add SSH connection dialog`}),t[3]=f,t[4]=g);let _=a||r,v;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(v=(0,Q.jsx)(Re,{className:`icon-sm`}),t[5]=v):v=t[5];let y;t[6]!==c||t[7]!==a||t[8]!==g||t[9]!==_?(y=(0,Q.jsx)(Y,{"aria-label":g,color:`ghost`,size:`icon`,disabled:_,loading:a,onClick:c,children:v}),t[6]=c,t[7]=a,t[8]=g,t[9]=_,t[10]=y):y=t[10];let b;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(b=(0,Q.jsx)(B,{id:`settings.remoteConnections.discoveryDialog.addManually`,defaultMessage:`Add manually`,description:`Button label for switching from discovered SSH connections to manual entry`}),t[11]=b):b=t[11];let x;t[12]===o?x=t[13]:(x=(0,Q.jsx)(`button`,{type:`button`,className:`min-w-0 flex-1 cursor-interaction text-left text-sm text-token-text-primary`,onClick:o,children:b}),t[12]=o,t[13]=x);let S=n.length===0||r,C;t[14]===Symbol.for(`react.memo_cache_sentinel`)?(C=(0,Q.jsx)(B,{id:`settings.remoteConnections.discoveryDialog.save`,defaultMessage:`Add`,description:`Primary action that adds selected discovered SSH connections`}),t[14]=C):C=t[14];let w;t[15]===S?w=t[16]:(w=(0,Q.jsx)(Y,{type:`submit`,size:`large`,disabled:S,children:C}),t[15]=S,t[16]=w);let T;t[17]!==w||t[18]!==y||t[19]!==x?(T=(0,Q.jsxs)(`div`,{className:`flex items-center gap-3`,children:[y,x,w]}),t[17]=w,t[18]=y,t[19]=x,t[20]=T):T=t[20];let E;t[21]!==n||t[22]!==f||t[23]!==r||t[24]!==u||t[25]!==d?(E=n.length===0?null:n.map(e=>{let t=e.sshAlias?.trim()||e.displayName,n=d.includes(e.hostId);return(0,Q.jsx)(`div`,{"aria-disabled":r,className:r?`cursor-not-allowed`:`cursor-interaction`,onClick:r?void 0:()=>{u(e.hostId)},onKeyDown:r?void 0:t=>{t.key!==`Enter`&&t.key!==` `||(t.preventDefault(),u(e.hostId))},role:`button`,tabIndex:r?-1:0,children:(0,Q.jsx)(We,{icon:(0,Q.jsx)(Fe,{className:`icon-sm`}),label:t,description:e.sshHost,control:(0,Q.jsx)(`div`,{className:`relative flex items-center`,onClick:Nt,onKeyDown:Mt,children:(0,Q.jsx)(Ee,{"aria-label":f.formatMessage({id:`settings.remoteConnections.discoveryDialog.toggleSelection`,defaultMessage:`Select {connectionName}`,description:`Accessible label for staging a discovered SSH connection with a checkbox`},{connectionName:t}),checked:n,disabled:r,onCheckedChange:()=>{u(e.hostId)}})})})},e.hostId)}),t[21]=n,t[22]=f,t[23]=r,t[24]=u,t[25]=d,t[26]=E):E=t[26];let D;t[27]===Symbol.for(`react.memo_cache_sentinel`)?(D=(0,Q.jsx)(B,{id:`settings.remoteConnections.discoveryDialog.title`,defaultMessage:`Add SSH Connection`,description:`Title for the dialog that lets users add a discovered SSH connection`}),t[27]=D):D=t[27];let O;return t[28]!==m||t[29]!==s||t[30]!==i||t[31]!==T||t[32]!==E?(O=(0,Q.jsx)(At,{emptyState:h,footer:T,list:E,open:i,title:D,onOpenChange:s,onSubmit:m}),t[28]=m,t[29]=s,t[30]=i,t[31]=T,t[32]=E,t[33]=O):O=t[33],O}function Mt(e){e.stopPropagation()}function Nt(e){e.stopPropagation()}function Pt(){return{displayName:``,targetKind:`hostname`,sshHost:``,sshPort:``,authMode:`none`,identity:``}}function Ft(e){return{displayName:e.displayName,targetKind:e.sshAlias?.trim()?`alias`:`hostname`,sshHost:e.sshAlias?.trim()||e.sshHost,sshPort:e.sshPort==null?``:String(e.sshPort),authMode:e.identity==null?`none`:`identity`,identity:e.identity??``}}function It(e,{connectionAnalyticsId:t}={}){let n=e.displayName.trim(),a=e.sshHost.trim(),o=e.targetKind===`alias`?a:null;return o==null?{hostId:r(n),...t==null?{}:{connectionAnalyticsId:t},displayName:n,source:`codex-managed`,alias:null,hostname:a,sshPort:Rt(e.sshPort),identity:e.authMode===`identity`?e.identity.trim():null}:{hostId:i(o),...t==null?{}:{connectionAnalyticsId:t},displayName:n,source:`discovered`,alias:o,hostname:null,sshPort:null,identity:null}}function Lt({draft:e,editingHostId:t,existingConnections:n}){let r=[],i=e.displayName.trim();i.length===0&&r.push(`displayNameRequired`),e.sshHost.trim().length===0&&r.push(`sshHostRequired`);let a=e.sshPort.trim();if(a.length>0)if(!/^\d+$/.test(a))r.push(`sshPortInteger`);else{let e=Number(a);(!Number.isSafeInteger(e)||e<1||e>65535)&&r.push(`sshPortRange`)}return e.authMode===`identity`&&e.identity.trim().length===0&&r.push(`identityRequired`),n.some(e=>t!=null&&e.hostId===t?!1:e.displayName.trim()===i)&&r.push(`duplicateDisplayName`),r}function Rt(e){let t=e.trim();if(t.length===0||!/^\d+$/.test(t))return null;let n=Number(t);return Number.isSafeInteger(n)?n:null}var zt=[`none`,`identity`];function Bt(e){let t=(0,$.c)(65),{open:n,mode:r,draft:i,existingConnections:a,editingHostId:o,onOpenChange:s,onSubmit:c,isSaving:l}=e,u=z(),d=r===`edit`&&i.targetKind===`alias`,f;t[0]!==o||t[1]!==a?(f=e=>{let t=Lt({draft:e,existingConnections:a,editingHostId:o});if(t.length!==0)return t},t[0]=o,t[1]=a,t[2]=f):f=t[2];let p=f,m;t[3]===p?m=t[4]:(m={onChange:e=>{let{value:t}=e;return p(t)},onSubmit:e=>{let{value:t}=e;return p(t)}},t[3]=p,t[4]=m);let h;t[5]!==l||t[6]!==c?(h=e=>{let{value:t}=e;l||c(t)},t[5]=l,t[6]=c,t[7]=h):h=t[7];let g;t[8]!==i||t[9]!==m||t[10]!==h?(g={defaultValues:i,validators:m,onSubmit:h},t[8]=i,t[9]=m,t[10]=h,t[11]=g):g=t[11];let _=ct(g),v=r===`add`?`default`:`compact`,y;t[12]===_?y=t[13]:(y=e=>{e.preventDefault(),_.handleSubmit()},t[12]=_,t[13]=y);let b;t[14]===r?b=t[15]:(b=(0,Q.jsx)(X,{children:(0,Q.jsx)(xe,{title:r===`add`?(0,Q.jsx)(B,{id:`settings.remoteConnections.dialog.addTitle`,defaultMessage:`Add SSH connection`,description:`Title for add remote connection dialog`}):(0,Q.jsx)(B,{id:`settings.remoteConnections.dialog.editTitle`,defaultMessage:`Edit SSH connection`,description:`Title for edit remote connection dialog`})})}),t[14]=r,t[15]=b);let x;t[16]===l?x=t[17]:(x=e=>l||e.submissionAttempts===0?[]:e.errorMap.onChange??e.errorMap.onSubmit??[],t[16]=l,t[17]=x);let S;t[18]!==_.Subscribe||t[19]!==x?(S=(0,Q.jsx)(_.Subscribe,{selector:x,children:Ht}),t[18]=_.Subscribe,t[19]=x,t[20]=S):S=t[20];let C;t[21]===l?C=t[22]:(C=e=>(0,Q.jsx)(Wt,{label:(0,Q.jsx)(B,{id:`settings.remoteConnections.dialog.field.displayName`,defaultMessage:`Display name`,description:`Label for display name field in remote connection editor dialog`}),value:e.state.value,onChange:e.handleChange,onBlur:e.handleBlur,disabled:l}),t[21]=l,t[22]=C);let w;t[23]!==_.Field||t[24]!==C?(w=(0,Q.jsx)(_.Field,{name:`displayName`,children:C}),t[23]=_.Field,t[24]=C,t[25]=w):w=t[25];let T;t[26]!==u||t[27]!==d||t[28]!==l?(T=e=>(0,Q.jsx)(Wt,{label:d?(0,Q.jsx)(B,{id:`settings.remoteConnections.dialog.field.alias`,defaultMessage:`Alias`,description:`Label for SSH alias field in remote connection editor dialog`}):(0,Q.jsx)(B,{id:`settings.remoteConnections.dialog.field.sshHost`,defaultMessage:`Hostname`,description:`Label for SSH target field in remote connection editor dialog`}),placeholder:d?void 0:u.formatMessage({id:`settings.remoteConnections.dialog.field.sshHost.placeholder`,defaultMessage:`host.com or user@host.com`,description:`Placeholder for SSH target field in remote connection editor dialog`}),value:e.state.value,onChange:e.handleChange,onBlur:e.handleBlur,disabled:l||d}),t[26]=u,t[27]=d,t[28]=l,t[29]=T):T=t[29];let E;t[30]!==_.Field||t[31]!==T?(E=(0,Q.jsx)(_.Field,{name:`sshHost`,children:T}),t[30]=_.Field,t[31]=T,t[32]=E):E=t[32];let D;t[33]!==_.Field||t[34]!==_.Subscribe||t[35]!==d||t[36]!==l?(D=d?null:(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(_.Field,{name:`sshPort`,children:e=>(0,Q.jsx)(Wt,{label:(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(B,{id:`settings.remoteConnections.dialog.field.sshPort`,defaultMessage:`SSH port`,description:`Label for SSH port field in remote connection editor dialog`}),` `,(0,Q.jsx)(`span`,{className:`font-normal text-token-text-secondary`,children:(0,Q.jsx)(B,{id:`settings.remoteConnections.dialog.field.optional`,defaultMessage:`(optional)`,description:`Marker shown next to optional fields in the remote connection editor dialog`})})]}),value:e.state.value,onChange:e.handleChange,onBlur:e.handleBlur,disabled:l})}),(0,Q.jsx)(_.Field,{name:`authMode`,children:e=>(0,Q.jsx)(Gt,{authMode:e.state.value,disabled:l,onChange:e.handleChange})}),(0,Q.jsx)(_.Subscribe,{selector:Vt,children:e=>e===`identity`?(0,Q.jsx)(_.Field,{name:`identity`,children:e=>(0,Q.jsx)(Wt,{label:(0,Q.jsx)(B,{id:`settings.remoteConnections.dialog.field.identity`,defaultMessage:`Identity file path`,description:`Label for required identity file path field in remote connection editor dialog`}),value:e.state.value,onChange:e.handleChange,onBlur:e.handleBlur,disabled:l})}):null})]}),t[33]=_.Field,t[34]=_.Subscribe,t[35]=d,t[36]=l,t[37]=D):D=t[37];let O;t[38]!==w||t[39]!==E||t[40]!==D?(O=(0,Q.jsx)(X,{children:(0,Q.jsxs)(`div`,{className:`grid grid-cols-1 gap-4`,children:[w,E,D]})}),t[38]=w,t[39]=E,t[40]=D,t[41]=O):O=t[41];let k;t[42]===s?k=t[43]:(k=()=>s(!1),t[42]=s,t[43]=k);let A;t[44]===Symbol.for(`react.memo_cache_sentinel`)?(A=(0,Q.jsx)(B,{id:`settings.remoteConnections.dialog.cancel`,defaultMessage:`Cancel`,description:`Cancel button for remote connection editor dialog`}),t[44]=A):A=t[44];let j;t[45]!==l||t[46]!==k?(j=(0,Q.jsx)(Y,{color:`ghost`,type:`button`,disabled:l,onClick:k,children:A}),t[45]=l,t[46]=k,t[47]=j):j=t[47];let ee;t[48]===Symbol.for(`react.memo_cache_sentinel`)?(ee=(0,Q.jsx)(B,{id:`settings.remoteConnections.dialog.apply`,defaultMessage:`Save`,description:`Save button for remote connection editor dialog`}),t[48]=ee):ee=t[48];let M;t[49]===l?M=t[50]:(M=(0,Q.jsx)(Y,{color:`primary`,type:`submit`,loading:l,children:ee}),t[49]=l,t[50]=M);let N;t[51]!==j||t[52]!==M?(N=(0,Q.jsx)(X,{className:`pt-4`,children:(0,Q.jsxs)(we,{children:[j,M]})}),t[51]=j,t[52]=M,t[53]=N):N=t[53];let P;t[54]!==O||t[55]!==N||t[56]!==y||t[57]!==b||t[58]!==S?(P=(0,Q.jsxs)(Ce,{as:`form`,onSubmit:y,children:[b,S,O,N]}),t[54]=O,t[55]=N,t[56]=y,t[57]=b,t[58]=S,t[59]=P):P=t[59];let F;return t[60]!==s||t[61]!==n||t[62]!==P||t[63]!==v?(F=(0,Q.jsx)(Se,{open:n,onOpenChange:s,size:v,children:P}),t[60]=s,t[61]=n,t[62]=P,t[63]=v,t[64]=F):F=t[64],F}function Vt(e){return e.values.authMode}function Ht(e){return e.length>0?(0,Q.jsx)(X,{children:(0,Q.jsx)(`div`,{className:`border-token-border-error rounded-md border p-2 text-sm text-token-error-foreground`,children:e.map(Ut)})}):null}function Ut(e){return(0,Q.jsx)(`div`,{children:Kt(e)},e)}function Wt(e){let t=(0,$.c)(16),{label:n,description:r,value:i,placeholder:a,onChange:o,onBlur:s,disabled:c}=e,l=c===void 0?!1:c,u;t[0]===n?u=t[1]:(u=(0,Q.jsx)(`span`,{className:`text-xs font-medium text-token-text-primary`,children:n}),t[0]=n,t[1]=u);let d;t[2]===o?d=t[3]:(d=e=>o(e.target.value),t[2]=o,t[3]=d);let f;t[4]!==l||t[5]!==s||t[6]!==a||t[7]!==d||t[8]!==i?(f=(0,Q.jsx)(`input`,{className:`w-full rounded-md border border-token-input-border bg-token-input-background px-2.5 py-1.5 text-sm text-token-input-foreground outline-none placeholder:text-token-input-placeholder-foreground focus:border-token-focus-border disabled:bg-token-foreground/5 disabled:text-token-text-secondary disabled:opacity-100`,value:i,disabled:l,onChange:d,onBlur:s,placeholder:a}),t[4]=l,t[5]=s,t[6]=a,t[7]=d,t[8]=i,t[9]=f):f=t[9];let p;t[10]===r?p=t[11]:(p=r?(0,Q.jsx)(`span`,{className:`text-xs text-token-text-secondary`,children:r}):null,t[10]=r,t[11]=p);let m;return t[12]!==u||t[13]!==f||t[14]!==p?(m=(0,Q.jsxs)(`label`,{className:`flex flex-col gap-1`,children:[u,f,p]}),t[12]=u,t[13]=f,t[14]=p,t[15]=m):m=t[15],m}function Gt(e){let t=(0,$.c)(9),{authMode:n,disabled:r,onChange:i}=e,a=z(),o;t[0]===a?o=t[1]:(o=a.formatMessage({id:`settings.remoteConnections.dialog.authMode.ariaLabel`,defaultMessage:`SSH authentication method`,description:`Accessible label for choosing the SSH authentication method in the remote connection editor dialog`}),t[0]=a,t[1]=o);let s;t[2]!==n||t[3]!==r||t[4]!==i?(s=zt.map(e=>{let t=e===n;return(0,Q.jsx)(`button`,{type:`button`,"aria-pressed":t,className:A(`cursor-interaction flex h-7 flex-1 items-center justify-center rounded-full px-2 text-sm font-medium outline-none focus-visible:ring-1 focus-visible:ring-token-focus-border disabled:cursor-not-allowed disabled:opacity-50`,t?`bg-token-dropdown-background text-token-foreground shadow-sm ring-1 ring-token-border/60`:`text-token-foreground hover:bg-token-foreground/5`),disabled:r,onClick:()=>{i(e)},children:e===`none`?(0,Q.jsx)(B,{id:`settings.remoteConnections.dialog.authMode.none`,defaultMessage:`No Auth`,description:`Option label for using no explicit SSH identity file`}):(0,Q.jsx)(B,{id:`settings.remoteConnections.dialog.authMode.identity`,defaultMessage:`Identity`,description:`Option label for using an SSH identity file`})},e)}),t[2]=n,t[3]=r,t[4]=i,t[5]=s):s=t[5];let c;return t[6]!==o||t[7]!==s?(c=(0,Q.jsx)(`div`,{className:`flex rounded-full bg-token-foreground/10 p-0.5`,role:`group`,"aria-label":o,children:s}),t[6]=o,t[7]=s,t[8]=c):c=t[8],c}function Kt(e){switch(e){case`displayNameRequired`:return(0,Q.jsx)(B,{id:`settings.remoteConnections.dialog.field.displayName.error`,defaultMessage:`Display name is required`,description:`Error message for display name field in remote connection editor dialog`});case`sshHostRequired`:return(0,Q.jsx)(B,{id:`settings.remoteConnections.dialog.field.sshHost.error`,defaultMessage:`Hostname is required`,description:`Error message for SSH target field in remote connection editor dialog`});case`sshPortInteger`:return(0,Q.jsx)(B,{id:`settings.remoteConnections.dialog.field.sshPort.intError`,defaultMessage:`SSH port must be an integer`,description:`Error message for SSH port field when the input is not an integer`});case`sshPortRange`:return(0,Q.jsx)(B,{id:`settings.remoteConnections.dialog.field.sshPort.rangeError`,defaultMessage:`SSH port must be between 1 and 65535`,description:`Error message for SSH port field when the input is not between 1 and 65535`});case`identityRequired`:return(0,Q.jsx)(B,{id:`settings.remoteConnections.dialog.field.identity.error`,defaultMessage:`Identity file path is required`,description:`Error message for identity file path field in remote connection editor dialog`});case`duplicateDisplayName`:return(0,Q.jsx)(B,{id:`settings.remoteConnections.dialog.field.displayName.duplicateError`,defaultMessage:`A connection with this display name already exists`,description:`Error message for duplicate display name in the remote connection editor dialog`})}}function qt(e){return{refreshSource:p.CODEX_REMOTE_CONTROL_REFRESH_SOURCE_SETTINGS,connectionCount:e.length,onlineConnectionCount:e.filter(e=>e.online).length,busyConnectionCount:e.filter(e=>e.busy).length,autoConnectConnectionCount:e.filter(e=>e.autoConnect).length,unsupportedAppServerVersionConnectionCount:e.filter(e=>!l(e.appServerVersion)).length}}var Jt=`—`;function Yt(e){let t=(0,$.c)(9),{value:n,placeholder:r}=e,i;t[0]===n?i=t[1]:(i=n?.trim()??``,t[0]=n,t[1]=i);let a=i;if(a===``){let e=r??Jt,n;return t[2]===e?n=t[3]:(n=(0,Q.jsx)(`div`,{className:`truncate`,children:e}),t[2]=e,t[3]=n),n}let o;t[4]===a?o=t[5]:(o=(0,Q.jsx)(`div`,{className:`truncate`,children:a}),t[4]=a,t[5]=o);let s;return t[6]!==o||t[7]!==a?(s=(0,Q.jsx)(J,{tooltipContent:a,openWhen:`trigger-overflows`,children:o}),t[6]=o,t[7]=a,t[8]=s):s=t[8],s}var Xt=`text-sm electron:!text-sm`,Zt=`!size-5 !rounded-full !p-0 electron:!rounded-full electron:!p-0`;function Qt(e){let t=(0,$.c)(29),{actionsLabel:n,deleteDisabled:r,deleteLabel:i,deleteTooltip:a,detailsLabel:o,editDisabled:s,editLabel:c,editTooltip:l,onDelete:u,onDetails:d,onEdit:f,onLogout:p,onRestart:m,restartLabel:h}=e,g;t[0]===n?g=t[1]:(g=(0,Q.jsx)(Be,{label:n,size:`icon`,iconClassName:`icon-sm`,className:Zt}),t[0]=n,t[1]=g);let _;t[2]!==o||t[3]!==d?(_=(0,Q.jsx)(De.Item,{LeftIcon:fe,className:Xt,onSelect:d,children:o}),t[2]=o,t[3]=d,t[4]=_):_=t[4];let v=s?l:null,y;t[5]!==s||t[6]!==c||t[7]!==f||t[8]!==v?(y=(0,Q.jsx)(De.Item,{LeftIcon:_e,className:Xt,disabled:s,onSelect:f,tooltipText:v,children:c}),t[5]=s,t[6]=c,t[7]=f,t[8]=v,t[9]=y):y=t[9];let b;t[10]!==m||t[11]!==h?(b=h!=null&&m!=null?(0,Q.jsx)(De.Item,{LeftIcon:Re,className:Xt,onSelect:m,children:h}):null,t[10]=m,t[11]=h,t[12]=b):b=t[12];let x;t[13]===p?x=t[14]:(x=p==null?null:(0,Q.jsx)(De.Item,{LeftIcon:Ie,className:Xt,onSelect:p,children:(0,Q.jsx)(B,{id:`settings.remoteConnections.logout`,defaultMessage:`Logout`,description:`Menu item label to log out of a connected remote connection`})}),t[13]=p,t[14]=x);let S;t[15]===Symbol.for(`react.memo_cache_sentinel`)?(S=(0,Q.jsx)(De.Separator,{}),t[15]=S):S=t[15];let C;t[16]===Symbol.for(`react.memo_cache_sentinel`)?(C=A(Xt,`text-token-charts-red`),t[16]=C):C=t[16];let w=r?a:null,T;t[17]!==r||t[18]!==i||t[19]!==u||t[20]!==w?(T=(0,Q.jsx)(De.Item,{LeftIcon:ke,className:C,leftIconClassName:`icon-xs text-token-charts-red`,disabled:r,onSelect:u,tooltipText:w,children:i}),t[17]=r,t[18]=i,t[19]=u,t[20]=w,t[21]=T):T=t[21];let E;return t[22]!==g||t[23]!==T||t[24]!==_||t[25]!==y||t[26]!==b||t[27]!==x?(E=(0,Q.jsxs)(Oe,{align:`end`,contentWidth:`menu`,triggerButton:g,children:[_,y,b,x,S,T]}),t[22]=g,t[23]=T,t[24]=_,t[25]=y,t[26]=b,t[27]=x,t[28]=E):E=t[28],E}function $t(e){let t=(0,$.c)(22),{className:n,control:r,description:i,displayName:a,icon:o,label:s,status:c}=e,l;t[0]!==a||t[1]!==s?(l=s??(0,Q.jsx)(Yt,{value:a}),t[0]=a,t[1]=s,t[2]=l):l=t[2];let u=l,d=o??c,f;t[3]===u?f=t[4]:(f=(0,Q.jsx)(`div`,{className:`min-w-0`,children:u}),t[3]=u,t[4]=f);let p;t[5]!==o||t[6]!==c?(p=o!=null&&c!=null?(0,Q.jsx)(`span`,{className:`inline-flex shrink-0 -translate-y-[0.5px] items-center`,children:c}):null,t[5]=o,t[6]=c,t[7]=p):p=t[7];let m;t[8]!==i||t[9]!==p?(m=(0,Q.jsxs)(`div`,{className:`flex min-w-0 items-center gap-1.5 text-token-text-secondary`,children:[p,i]}),t[8]=i,t[9]=p,t[10]=m):m=t[10];let h;t[11]!==f||t[12]!==m?(h=(0,Q.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-1`,children:[f,m]}),t[11]=f,t[12]=m,t[13]=h):h=t[13];let g;t[14]!==n||t[15]!==r||t[16]!==d||t[17]!==h?(g=(0,Q.jsx)(We,{className:n,icon:d,label:h,control:r}),t[14]=n,t[15]=r,t[16]=d,t[17]=h,t[18]=g):g=t[18];let _;return t[19]!==a||t[20]!==g?(_=(0,Q.jsx)(`div`,{"aria-label":a,role:`group`,children:g}),t[19]=a,t[20]=g,t[21]=_):_=t[21],_}function en(e,t){return!e.online||!l(e.appServerVersion)?`block size-2 rounded-full bg-gray-400`:t===`error`?`block size-2 rounded-full bg-token-charts-red`:t===`connected`?e.busy?`block size-2 rounded-full bg-token-charts-yellow`:`block size-2 rounded-full bg-token-charts-green`:`block size-2 rounded-full bg-gray-400`}function tn(e,t,n){return t.online?l(t.appServerVersion)?n===`connecting`||n===`restarting`?e.formatMessage({id:`settings.remoteControlConnections.availability.connecting`,defaultMessage:`Connecting`,description:`Availability label for a remote control environment that is connecting`}):n===`error`?e.formatMessage({id:`settings.remoteControlConnections.availability.connectionFailed`,defaultMessage:`Connection failed`,description:`Availability label for a remote control environment whose app-server transport failed`}):n===`connected`?t.busy?e.formatMessage({id:`settings.remoteControlConnections.availability.busy`,defaultMessage:`busy`,description:`Availability label for a remote control environment that is busy`}):e.formatMessage({id:`settings.remoteControlConnections.availability.online`,defaultMessage:`online`,description:`Availability label for a remote control environment that is online`}):e.formatMessage({id:`threadPage.remoteConnectionStatusBadge.disconnected`,defaultMessage:`Disconnected`,description:`Label shown when remote connection is unavailable`}):e.formatMessage({id:`settings.remoteControlConnections.availability.updateRequired`,defaultMessage:`Please update app-server version (current: {currentVersion}) to {requiredVersion} or newer`,description:`Availability label for an online remote control environment with an incompatible app-server version`},{currentVersion:t.appServerVersion,requiredVersion:o}):e.formatMessage({id:`settings.remoteControlConnections.availability.offline`,defaultMessage:`offline`,description:`Availability label for a remote control environment that is offline`})}function nn(e){let t=(0,$.c)(80),{connection:n,clientAuthorized:r,disabled:i,isEditing:a,isRenamePending:s,isSaving:c,onCancelEditing:u,onLogoutConnection:d,onRequestDelete:f,onSave:p,onShowDetails:m,onStartEditing:h,onToggleConnection:g}=e,_=z(),[v,y]=(0,Z.useState)(n.displayName),{state:b}=Ae(n.hostId),x,S;if(t[0]!==r||t[1]!==n.appServerVersion||t[2]!==n.online||t[3]!==b){let e=l(n.appServerVersion);x=r&&n.online&&e,S=an(r,n.online,e,b),t[0]=r,t[1]=n.appServerVersion,t[2]=n.online,t[3]=b,t[4]=x,t[5]=S}else x=t[4],S=t[5];let C=S,w;t[6]===v?w=t[7]:(w=v.trim(),t[6]=v,t[7]=w);let T=w,E;t[8]===_?E=t[9]:(E=_.formatMessage({id:`settings.remoteControlConnections.rename.inputLabel`,defaultMessage:`Display name`,description:`Screen reader label for remote control display name rename input`}),t[8]=_,t[9]=E);let D=E,O;t[10]===_?O=t[11]:(O=_.formatMessage({id:`settings.remoteControlConnections.rename.save`,defaultMessage:`Save`,description:`Button label to save a remote control environment rename`}),t[10]=_,t[11]=O);let k=O,A;t[12]===_?A=t[13]:(A=_.formatMessage({id:`settings.remoteControlConnections.rename.cancel`,defaultMessage:`Cancel`,description:`Button label to cancel a remote control environment rename`}),t[12]=_,t[13]=A);let j=A,ee;t[14]===_?ee=t[15]:(ee=_.formatMessage({id:`settings.remoteControlConnections.rename`,defaultMessage:`Rename`,description:`Menu item label to rename a signed-in device`}),t[14]=_,t[15]=ee);let M=ee,N;t[16]===_?N=t[17]:(N=_.formatMessage({id:`settings.remoteConnections.deleteConnection`,defaultMessage:`Delete`,description:`Menu item label to delete a remote connection`}),t[16]=_,t[17]=N);let P=N,F;t[18]===_?F=t[19]:(F=_.formatMessage({id:`settings.remoteControlConnections.delete.offlineOnly`,defaultMessage:`Only offline environments can be deleted`,description:`Tooltip shown when an online remote control environment cannot be deleted`}),t[18]=_,t[19]=F);let I=F,te;t[20]===_?te=t[21]:(te=_.formatMessage({id:`settings.remoteConnections.detailsMenu`,defaultMessage:`Details`,description:`Menu item label to show remote connection details`}),t[20]=_,t[21]=te);let L=te,ne=i||s||a||n.online,R=n.online?I:P,V;t[22]!==n.displayName||t[23]!==u?(V=()=>{y(n.displayName),u()},t[22]=n.displayName,t[23]=u,t[24]=V):V=t[24];let H=V,U;t[25]!==H||t[26]!==n||t[27]!==s||t[28]!==p||t[29]!==T?(U=async()=>{if(!(T.length===0||s)){if(T===n.displayName){H();return}await p(n,T)}},t[25]=H,t[26]=n,t[27]=s,t[28]=p,t[29]=T,t[30]=U):U=t[30];let re=U,ie=n.displayName,W;t[31]===n?W=t[32]:(W=ht(n),t[31]=n,t[32]=W);let ae;t[33]===n.appServerVersion?ae=t[34]:(ae={currentVersion:n.appServerVersion,requiredVersion:o},t[33]=n.appServerVersion,t[34]=ae);let G;t[35]!==C||t[36]!==ae?(G=(0,Q.jsx)(B,{...C,values:ae}),t[35]=C,t[36]=ae,t[37]=G):G=t[37];let K;t[38]!==H||t[39]!==i||t[40]!==v||t[41]!==a||t[42]!==c||t[43]!==D||t[44]!==re?(K=a?(0,Q.jsx)(`input`,{"aria-label":D,className:`min-w-0 rounded-md border border-token-input-border bg-token-input-background px-2 py-1 text-sm text-token-input-foreground outline-none placeholder:text-token-input-placeholder-foreground focus:border-token-focus-border disabled:bg-token-foreground/5 disabled:text-token-text-secondary disabled:opacity-100`,value:v,disabled:i||c,onChange:e=>{y(e.target.value)},onKeyDown:e=>{e.key===`Enter`?(e.preventDefault(),re()):e.key===`Escape`&&(e.preventDefault(),H())},autoFocus:!0}):void 0,t[38]=H,t[39]=i,t[40]=v,t[41]=a,t[42]=c,t[43]=D,t[44]=re,t[45]=K):K=t[45];let q;t[46]!==n||t[47]!==b?(q=(0,Q.jsx)(rn,{connection:n,state:b}),t[46]=n,t[47]=b,t[48]=q):q=t[48];let oe;t[49]!==x||t[50]!==H||t[51]!==j||t[52]!==n||t[53]!==ne||t[54]!==P||t[55]!==R||t[56]!==L||t[57]!==i||t[58]!==M||t[59]!==_||t[60]!==a||t[61]!==s||t[62]!==c||t[63]!==d||t[64]!==f||t[65]!==m||t[66]!==h||t[67]!==g||t[68]!==re||t[69]!==k||t[70]!==b||t[71]!==T.length?(oe=a?(0,Q.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,Q.jsx)(J,{tooltipContent:k,children:(0,Q.jsx)(Y,{"aria-label":k,color:`ghost`,size:`icon`,loading:c,disabled:i||T.length===0||s,onClick:()=>{re()},children:(0,Q.jsx)(Te,{className:`icon-xs`})})}),(0,Q.jsx)(J,{tooltipContent:j,children:(0,Q.jsx)(Y,{"aria-label":j,color:`ghost`,size:`icon`,disabled:i||c,onClick:H,children:(0,Q.jsx)(le,{className:`icon-xs`})})})]}):(0,Q.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Q.jsx)(Qt,{actionsLabel:_.formatMessage({id:`settings.remoteConnections.table.actions.ariaLabel`,defaultMessage:`{connectionName} actions`,description:`Screen reader label for the remote connection actions menu`},{connectionName:n.displayName}),editLabel:M,editTooltip:M,editDisabled:i||s||a,onEdit:()=>{y(n.displayName),h()},detailsLabel:L,onDetails:()=>m(n),onLogout:b===`connected`?()=>d(n.hostId):void 0,deleteLabel:P,deleteTooltip:R,deleteDisabled:ne,onDelete:()=>f(n)}),n.online?(0,Q.jsx)(Le,{checked:n.autoConnect,disabled:!x,onChange:e=>g(n.hostId,e),ariaLabel:_.formatMessage({id:`settings.remoteControlConnections.table.connect.ariaLabel`,defaultMessage:`Connect {connectionName}`,description:`Screen reader label for the remote control connection toggle`},{connectionName:n.displayName})}):(0,Q.jsx)(J,{tooltipContent:_.formatMessage({id:`settings.remoteControlConnections.connect.offlineTooltip`,defaultMessage:`This device is offline. Refresh to check again`,description:`Tooltip shown when a remote control auto-connect toggle is disabled because the device is offline`}),children:(0,Q.jsx)(`span`,{className:`inline-flex`,children:(0,Q.jsx)(Le,{checked:n.autoConnect,disabled:!0,onChange:e=>g(n.hostId,e),ariaLabel:_.formatMessage({id:`settings.remoteControlConnections.table.connect.ariaLabel`,defaultMessage:`Connect {connectionName}`,description:`Screen reader label for the remote control connection toggle`},{connectionName:n.displayName})})})})]}),t[49]=x,t[50]=H,t[51]=j,t[52]=n,t[53]=ne,t[54]=P,t[55]=R,t[56]=L,t[57]=i,t[58]=M,t[59]=_,t[60]=a,t[61]=s,t[62]=c,t[63]=d,t[64]=f,t[65]=m,t[66]=h,t[67]=g,t[68]=re,t[69]=k,t[70]=b,t[71]=T.length,t[72]=oe):oe=t[72];let se;return t[73]!==n.displayName||t[74]!==W||t[75]!==G||t[76]!==K||t[77]!==q||t[78]!==oe?(se=(0,Q.jsx)($t,{displayName:ie,icon:W,description:G,label:K,status:q,control:oe}),t[73]=n.displayName,t[74]=W,t[75]=G,t[76]=K,t[77]=q,t[78]=oe,t[79]=se):se=t[79],se}function rn(e){let t=(0,$.c)(13),{connection:n,state:r}=e,i=z(),a;t[0]!==n||t[1]!==i||t[2]!==r?(a=tn(i,n,r),t[0]=n,t[1]=i,t[2]=r,t[3]=a):a=t[3];let o=a,s;t[4]!==n||t[5]!==r?(s=en(n,r),t[4]=n,t[5]=r,t[6]=s):s=t[6];let c;t[7]!==o||t[8]!==s?(c=(0,Q.jsx)(`span`,{"aria-label":o,className:s,role:`img`}),t[7]=o,t[8]=s,t[9]=c):c=t[9];let l;return t[10]!==o||t[11]!==c?(l=(0,Q.jsx)(J,{tooltipContent:o,children:c}),t[10]=o,t[11]=c,t[12]=l):l=t[12],l}function an(e,t,n,r){return!e&&!t?on.signedInDeviceAuthorizationRequiredOfflineSubtitle:e?t?n?r===`connecting`||r===`restarting`?on.signedInDeviceConnectingSubtitle:r===`error`?on.signedInDeviceConnectionFailedSubtitle:r===`connected`?on.signedInDeviceOnlineSubtitle:on.signedInDeviceDisconnectedSubtitle:on.signedInDeviceUpdateRequiredSubtitle:on.signedInDeviceOfflineSubtitle:on.signedInDeviceAuthorizationRequiredSubtitle}var on=V({signedInDeviceAuthorizationRequiredOfflineSubtitle:{id:`settings.remoteConnections.deviceConnections.signedInDeviceAuthorizationRequiredOfflineSubtitle`,defaultMessage:`Requires authorization · Offline`,description:`Subtitle for unauthorized offline signed-in-device rows in the device connections table`},signedInDeviceAuthorizationRequiredSubtitle:{id:`settings.remoteConnections.deviceConnections.signedInDeviceAuthorizationRequiredSubtitle`,defaultMessage:`Requires authorization`,description:`Subtitle for unauthorized signed-in-device rows in the device connections table`},signedInDeviceOfflineSubtitle:{id:`settings.remoteConnections.deviceConnections.signedInDeviceOfflineSubtitle`,defaultMessage:`Offline`,description:`Subtitle for offline signed-in-device rows in the device connections table`},signedInDeviceUpdateRequiredSubtitle:{id:`settings.remoteConnections.deviceConnections.signedInDeviceUpdateRequiredSubtitle`,defaultMessage:`Please update app-server version (current: {currentVersion}) to {requiredVersion} or newer`,description:`Subtitle for online signed-in-device rows that require an app-server update`},signedInDeviceConnectingSubtitle:{id:`settings.remoteConnections.deviceConnections.signedInDeviceConnectingSubtitle`,defaultMessage:`Connecting`,description:`Subtitle for signed-in-device rows whose app-server transport is connecting`},signedInDeviceConnectionFailedSubtitle:{id:`settings.remoteConnections.deviceConnections.signedInDeviceConnectionFailedSubtitle`,defaultMessage:`Connection failed`,description:`Subtitle for signed-in-device rows whose app-server transport failed`},signedInDeviceDisconnectedSubtitle:{id:`settings.remoteConnections.deviceConnections.signedInDeviceDisconnectedSubtitle`,defaultMessage:`Disconnected`,description:`Subtitle for signed-in-device rows whose app-server transport is disconnected`},signedInDeviceOnlineSubtitle:{id:`settings.remoteConnections.deviceConnections.signedInDeviceOnlineSubtitle`,defaultMessage:`Connected`,description:`Subtitle for online signed-in-device rows in the device connections table`}});function sn(e){let t=(0,$.c)(23),{action:n,error:r,isRestartAvailableNotice:i,restartAvailableNotice:a,statusMessage:o}=e,s=z();if(n!=null&&(i||r?.code===`restart-required`)){let e;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Q.jsx)(cn,{}),t[0]=e):e=t[0];let r;t[1]===n?r=t[2]:(r=(0,Q.jsx)(B,{id:`settings.remoteConnections.restartNotice.message`,defaultMessage:`Restart to update your CLI version`,description:`Inline update message shown when a connected SSH remote has an installed Codex update ready`,values:{restart:e=>(0,Q.jsx)(`button`,{className:`cursor-interaction border-0 bg-transparent p-0 text-token-text-link-foreground hover:underline`,type:`button`,onClick:n.onClick,children:e},`restart`)}}),t[1]=n,t[2]=r);let i;t[3]!==s||t[4]!==a?(i=a==null?null:(0,Q.jsx)(J,{side:`bottom`,tooltipContent:s.formatMessage({id:`settings.remoteConnections.restartNotice.tooltip`,defaultMessage:`Update available: {installedVersion}. Currently running {currentVersion}`,description:`Tooltip shown from the inline update notice with the installed and current CLI versions`},{currentVersion:a.currentVersion,installedVersion:a.installedVersion}),children:(0,Q.jsx)(`span`,{"aria-label":s.formatMessage({id:`settings.remoteConnections.restartNotice.details`,defaultMessage:`Update details`,description:`Accessible label for the inline update details tooltip trigger`}),className:`text-token-text-secondary`,children:(0,Q.jsx)(fe,{"aria-hidden":!0,className:`icon-xs shrink-0`})})}),t[3]=s,t[4]=a,t[5]=i):i=t[5];let o;return t[6]!==r||t[7]!==i?(o=(0,Q.jsxs)(Q.Fragment,{children:[e,(0,Q.jsxs)(`span`,{className:`inline-flex min-w-0 items-center gap-1`,children:[r,i]})]}),t[6]=r,t[7]=i,t[8]=o):o=t[8],o}if(r==null||o==null)return null;let c;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,Q.jsx)(cn,{}),t[9]=c):c=t[9];let l;t[10]!==r.code||t[11]!==r.currentVersion||t[12]!==r.minRequiredVersion||t[13]!==s||t[14]!==o?(l=r.code===`connection-failed`?(0,Q.jsxs)(`span`,{className:`inline-flex min-w-0 items-center gap-1`,children:[(0,Q.jsx)(B,{id:`settings.remoteConnections.genericSshError`,defaultMessage:`SSH connection failed`,description:`Concise inline message shown for generic SSH connection failures`}),(0,Q.jsx)(J,{side:`bottom`,tooltipContent:o,children:(0,Q.jsx)(`span`,{"aria-label":s.formatMessage({id:`settings.remoteConnections.genericSshError.details`,defaultMessage:`Error details`,description:`Accessible label for the generic SSH error details tooltip trigger`}),className:`text-token-text-secondary`,children:(0,Q.jsx)(fe,{"aria-hidden":!0,className:`icon-xs shrink-0`})})})]}):r.code===`update-required`?(0,Q.jsxs)(`span`,{className:`inline-flex min-w-0 items-center gap-1`,children:[(0,Q.jsx)(B,{id:`settings.remoteConnections.updateRequiredInline`,defaultMessage:`Update your CLI version`,description:`Concise inline message shown when an SSH remote requires a newer Codex version`}),(0,Q.jsx)(J,{side:`bottom`,tooltipContent:s.formatMessage({id:`settings.remoteConnections.updateRequiredInline.tooltip`,defaultMessage:`Minimum required: {minRequiredVersion}. Currently installed: {currentVersion}`,description:`Tooltip shown from the inline update-required notice with the installed and minimum required CLI versions`},{currentVersion:r.currentVersion,minRequiredVersion:r.minRequiredVersion}),children:(0,Q.jsx)(`span`,{"aria-label":s.formatMessage({id:`settings.remoteConnections.updateRequiredInline.details`,defaultMessage:`Update details`,description:`Accessible label for the inline update-required details tooltip trigger`}),className:`text-token-text-secondary`,children:(0,Q.jsx)(fe,{"aria-hidden":!0,className:`icon-xs shrink-0`})})})]}):o,t[10]=r.code,t[11]=r.currentVersion,t[12]=r.minRequiredVersion,t[13]=s,t[14]=o,t[15]=l):l=t[15];let u;t[16]===l?u=t[17]:(u=(0,Q.jsx)(`span`,{className:`min-w-0 break-words`,children:l}),t[16]=l,t[17]=u);let d;t[18]===n?d=t[19]:(d=(0,Q.jsx)(ln,{action:n}),t[18]=n,t[19]=d);let f;return t[20]!==u||t[21]!==d?(f=(0,Q.jsxs)(Q.Fragment,{children:[c,(0,Q.jsxs)(`span`,{className:`inline-flex min-w-0 items-center gap-1`,children:[u,d]})]}),t[20]=u,t[21]=d,t[22]=f):f=t[22],f}function cn(){let e=(0,$.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,Q.jsx)(`span`,{"aria-hidden":!0,children:`·`}),e[0]=t):t=e[0],t}function ln(e){let t=(0,$.c)(10),{action:n}=e;if(n==null)return null;let r=n.disabled===!0||n.loading===!0,i=n.loading===!0&&n.loadingLabel!=null?n.loadingLabel:n.label,a;t[0]!==n.onClick||t[1]!==r||t[2]!==i?(a=(0,Q.jsx)(`button`,{type:`button`,className:`cursor-interaction border-0 bg-transparent p-0 text-token-text-link-foreground hover:underline disabled:cursor-default disabled:text-token-text-secondary disabled:no-underline`,disabled:r,onClick:n.onClick,children:i}),t[0]=n.onClick,t[1]=r,t[2]=i,t[3]=a):a=t[3];let o=a,s;t[4]!==n.renderInElectronOnly||t[5]!==o?(s=n.renderInElectronOnly===!0?(0,Q.jsx)(pe,{electron:!0,children:o}):o,t[4]=n.renderInElectronOnly,t[5]=o,t[6]=s):s=t[6];let c=s,l;return t[7]!==n.tooltipText||t[8]!==c?(l=n.tooltipText==null?c:(0,Q.jsx)(J,{tooltipContent:n.tooltipText,children:c}),t[7]=n.tooltipText,t[8]=c,t[9]=l):l=t[9],l}function un(e){let t=(0,$.c)(86),{connection:n,disabled:r,installCodexPending:i,onAuthenticate:a,onEdit:o,onInstallCodex:s,onLogoutConnection:c,onRemove:l,onShowDetails:u,onToggleConnection:d}=e,f=z(),{appServerVersion:p,error:m,installedCodexVersion:h,state:g}=Ae(n.hostId),_=n.displayName,v;t[0]===f?v=t[1]:(v=f.formatMessage({id:`settings.remoteConnections.editConnection`,defaultMessage:`Edit connection`,description:`Menu item label to edit a remote connection`}),t[0]=f,t[1]=v);let y=v,b;t[2]===f?b=t[3]:(b=f.formatMessage({id:`settings.remoteConnections.deleteConnection`,defaultMessage:`Delete`,description:`Menu item label to delete a remote connection`}),t[2]=f,t[3]=b);let x=b,S;t[4]===f?S=t[5]:(S=f.formatMessage({id:`settings.remoteConnections.detailsMenu`,defaultMessage:`Details`,description:`Menu item label to show remote connection details`}),t[4]=f,t[5]=S);let C=S,w;t[6]===f?w=t[7]:(w=f.formatMessage({id:`settings.remoteConnections.restartConnection`,defaultMessage:`Restart connection`,description:`Menu item label to restart an SSH remote connection`}),t[6]=f,t[7]=w);let T=w,E=re(`2153867414`),D,O,k,A,j,ee;if(t[8]!==p||t[9]!==n.hostId||t[10]!==r||t[11]!==m||t[12]!==i||t[13]!==h||t[14]!==f||t[15]!==a||t[16]!==s||t[17]!==E||t[18]!==g){k=fn({appServerVersion:p,installedCodexVersion:h,state:g}),D=g===`connected`||m?.code===`login-required`||m?.code===`update-required`||m?.code===`restart-required`;let{statusError:e,isRestartAvailableNotice:o,statusState:c}=dn({error:m,restartAvailableNotice:k,state:g});A=e,O=o,j=c==null?null:Ne(f,{canLogin:!0,error:A,state:c,surface:`connections-row`});let l=!E&&(A?.code===`remote-codex-not-found`||A?.code===`update-required`);ee=j==null||l?null:pn({action:j.action,disabled:r,hostId:n.hostId,installCodexPending:i,onAuthenticate:a,onInstallCodex:s}),t[8]=p,t[9]=n.hostId,t[10]=r,t[11]=m,t[12]=i,t[13]=h,t[14]=f,t[15]=a,t[16]=s,t[17]=E,t[18]=g,t[19]=D,t[20]=O,t[21]=k,t[22]=A,t[23]=j,t[24]=ee}else D=t[19],O=t[20],k=t[21],A=t[22],j=t[23],ee=t[24];let M=ee,N,P;t[25]===Symbol.for(`react.memo_cache_sentinel`)?(N=(0,Q.jsx)(de,{className:`icon-sm`}),P=(0,Q.jsx)(B,{id:`settings.remoteConnections.deviceConnections.sshSubtitle`,defaultMessage:`SSH`,description:`Subtitle for SSH-backed rows in the device connections table`}),t[25]=N,t[26]=P):(N=t[25],P=t[26]);let F=j?.message??null,I;t[27]!==O||t[28]!==k||t[29]!==M||t[30]!==A||t[31]!==F?(I=(0,Q.jsxs)(Q.Fragment,{children:[P,(0,Q.jsx)(sn,{action:M,error:A,isRestartAvailableNotice:O,restartAvailableNotice:k,statusMessage:F})]}),t[27]=O,t[28]=k,t[29]=M,t[30]=A,t[31]=F,t[32]=I):I=t[32];let te;t[33]!==n||t[34]!==m||t[35]!==g?(te=(0,Q.jsx)(hn,{connection:n,error:m,state:g}),t[33]=n,t[34]=m,t[35]=g,t[36]=te):te=t[36];let L;t[37]!==_||t[38]!==f?(L=f.formatMessage({id:`settings.remoteConnections.table.actions.ariaLabel`,defaultMessage:`{connectionName} actions`,description:`Screen reader label for the remote connection actions menu`},{connectionName:_}),t[37]=_,t[38]=f,t[39]=L):L=t[39];let ne;t[40]!==n.hostId||t[41]!==o?(ne=()=>o(n.hostId),t[40]=n.hostId,t[41]=o,t[42]=ne):ne=t[42];let R;t[43]!==n||t[44]!==u?(R=()=>u(n),t[43]=n,t[44]=u,t[45]=R):R=t[45];let V=D?T:void 0,H;t[46]!==D||t[47]!==n.hostId?(H=D?()=>{mn(n.hostId)}:void 0,t[46]=D,t[47]=n.hostId,t[48]=H):H=t[48];let U;t[49]!==n.hostId||t[50]!==c||t[51]!==g?(U=g===`connected`?()=>c(n.hostId):void 0,t[49]=n.hostId,t[50]=c,t[51]=g,t[52]=U):U=t[52];let ie;t[53]!==n.hostId||t[54]!==l?(ie=()=>l(n.hostId),t[53]=n.hostId,t[54]=l,t[55]=ie):ie=t[55];let W;t[56]!==x||t[57]!==C||t[58]!==r||t[59]!==y||t[60]!==L||t[61]!==ne||t[62]!==R||t[63]!==V||t[64]!==H||t[65]!==U||t[66]!==ie?(W=(0,Q.jsx)(Qt,{actionsLabel:L,editLabel:y,editTooltip:y,editDisabled:r,onEdit:ne,detailsLabel:C,onDetails:R,restartLabel:V,onRestart:H,onLogout:U,deleteLabel:x,deleteTooltip:x,deleteDisabled:r,onDelete:ie}),t[56]=x,t[57]=C,t[58]=r,t[59]=y,t[60]=L,t[61]=ne,t[62]=R,t[63]=V,t[64]=H,t[65]=U,t[66]=ie,t[67]=W):W=t[67];let ae=n.autoConnect,G;t[68]!==n.hostId||t[69]!==d?(G=e=>d(n.hostId,e),t[68]=n.hostId,t[69]=d,t[70]=G):G=t[70];let K;t[71]!==n.displayName||t[72]!==f?(K=f.formatMessage({id:`settings.remoteConnections.table.autoConnect.ariaLabel`,defaultMessage:`Connect {connectionName}`,description:`Screen reader label for the remote connection toggle`},{connectionName:n.displayName}),t[71]=n.displayName,t[72]=f,t[73]=K):K=t[73];let q;t[74]!==n.autoConnect||t[75]!==G||t[76]!==K?(q=(0,Q.jsx)(Le,{checked:ae,onChange:G,ariaLabel:K}),t[74]=n.autoConnect,t[75]=G,t[76]=K,t[77]=q):q=t[77];let J;t[78]!==W||t[79]!==q?(J=(0,Q.jsxs)(`div`,{className:`flex items-center gap-2`,children:[W,q]}),t[78]=W,t[79]=q,t[80]=J):J=t[80];let Y;return t[81]!==_||t[82]!==te||t[83]!==J||t[84]!==I?(Y=(0,Q.jsx)($t,{displayName:_,icon:N,description:I,status:te,control:J}),t[81]=_,t[82]=te,t[83]=J,t[84]=I,t[85]=Y):Y=t[85],Y}function dn({error:e,restartAvailableNotice:t,state:n}){return n===`error`?{statusError:e??(t==null?null:a(t)),isRestartAvailableNotice:!1,statusState:`error`}:t==null?{statusError:null,isRestartAvailableNotice:!1,statusState:n}:{statusError:a(t),isRestartAvailableNotice:e==null,statusState:`error`}}function fn({appServerVersion:e,installedCodexVersion:t,state:n}){return n==null||e==null||t==null||!s({appServerVersion:e,installedCodexVersion:t})?null:{currentVersion:e,installedVersion:t}}function pn({action:e,disabled:t,hostId:n,installCodexPending:r,onAuthenticate:i,onInstallCodex:a}){if(e==null)return null;switch(e.kind){case`install-codex`:return{disabled:t,label:e.label,loading:r,loadingLabel:e.loadingLabel,renderInElectronOnly:!0,tooltipText:e.tooltipText,onClick:()=>a(n)};case`login`:return{label:e.label,onClick:()=>i(n)};case`restart`:return e.tooltipText==null?{label:e.label,onClick:()=>mn(n)}:{label:e.label,tooltipText:e.tooltipText,onClick:()=>mn(n)};case`settings`:return null}}function mn(e){F.dispatchMessage(`codex-app-server-restart`,{hostId:e,killCodexProcess:!0})}function hn(e){let t=(0,$.c)(18),{connection:n,error:r,state:i}=e,a=z();if(i===`error`){let e;t[0]!==r||t[1]!==a||t[2]!==i?(e=Ne(a,{canLogin:!1,error:r,state:i,surface:`connections-row`}),t[0]=r,t[1]=a,t[2]=i,t[3]=e):e=t[3];let{label:n,message:o}=e,s;t[4]===n?s=t[5]:(s=(0,Q.jsx)(`span`,{"aria-label":n,className:`block size-2 rounded-full bg-token-charts-red`,role:`img`}),t[4]=n,t[5]=s);let c;return t[6]!==o||t[7]!==s?(c=(0,Q.jsx)(J,{tooltipContent:o,children:s}),t[6]=o,t[7]=s,t[8]=c):c=t[8],c}if(i!=null){let e;return t[9]===n.hostId?e=t[10]:(e=(0,Q.jsx)(Pe,{hostId:n.hostId}),t[9]=n.hostId,t[10]=e),e}let o;t[11]===a?o=t[12]:(o=a.formatMessage({id:`threadPage.remoteConnectionStatusBadge.disconnected`,defaultMessage:`Disconnected`,description:`Label shown when remote connection is unavailable`}),t[11]=a,t[12]=o);let s=o,c;t[13]===s?c=t[14]:(c=(0,Q.jsx)(`span`,{"aria-label":s,className:`block size-2 rounded-full bg-gray-400`,role:`img`}),t[13]=s,t[14]=c);let l;return t[15]!==s||t[16]!==c?(l=(0,Q.jsx)(J,{tooltipContent:s,children:c}),t[15]=s,t[16]=c,t[17]=l):l=t[17],l}var gn=`—`;function _n({connections:e,clientAuthorized:t,disabled:n,installingCodexHostId:r,showEmptyState:i,emptyState:a,onEditSshConnection:o,onInstallCodex:s,onLogoutConnection:c,onRemoveSshConnection:l,onRenameRemoteControlConnection:u,onRequestDeleteRemoteControlConnection:d,onToggleConnection:f,onAuthenticate:p}){let[m,h]=(0,Z.useState)(null),[g,_]=(0,Z.useState)(null),[v,y]=(0,Z.useState)(null),b=async(e,t)=>{if(g==null){_(e.envId);try{await u(e.envId,t),h(null)}catch{return}finally{_(null)}}};return(0,Q.jsxs)(Q.Fragment,{children:[e.length===0&&i?(0,Q.jsx)(qe,{children:a??(0,Q.jsx)(B,{id:`settings.remoteConnections.deviceConnections.empty`,defaultMessage:`No device connections found. Add a new connection to get started`,description:`Empty state for the device connections settings table`})}):null,e.map(e=>e.source===`remote-control`?(0,Q.jsx)(nn,{connection:e,clientAuthorized:t,disabled:n,isEditing:m===e.envId,isRenamePending:g!=null,isSaving:g===e.envId,onCancelEditing:()=>{h(null)},onLogoutConnection:c,onRequestDelete:d,onSave:b,onShowDetails:y,onStartEditing:()=>{h(e.envId)},onToggleConnection:f},e.hostId):(0,Q.jsx)(un,{connection:e,disabled:n,installCodexPending:r===e.hostId,onAuthenticate:p,onEdit:o,onInstallCodex:s,onLogoutConnection:c,onRemove:l,onShowDetails:y,onToggleConnection:f},e.hostId)),(0,Q.jsx)(vn,{connection:v,onOpenChange:e=>{e||y(null)}})]})}function vn(e){let t=(0,$.c)(6),{connection:n,onOpenChange:r}=e,i=n!=null,a;t[0]===n?a=t[1]:(a=n==null?null:(0,Q.jsx)(yn,{connection:n}),t[0]=n,t[1]=a);let o;return t[2]!==r||t[3]!==i||t[4]!==a?(o=(0,Q.jsx)(Se,{open:i,onOpenChange:r,contentClassName:`bg-token-bg-primary`,dialogCloseClassName:`[&>svg]:icon-sm`,children:a}),t[2]=r,t[3]=i,t[4]=a,t[5]=o):o=t[5],o}function yn(e){let t=(0,$.c)(21),{connection:n}=e,{appServerVersion:r,error:i,state:a}=Ae(n.hostId),o=K(),s=n.source===`remote-control`,c;t[0]!==n||t[1]!==i||t[2]!==s||t[3]!==a?(c=s?(0,Q.jsxs)(bn,{children:[(0,Q.jsx)(rn,{connection:n,state:a}),(0,Q.jsx)(B,{id:`settings.remoteConnections.deviceConnections.signedInDeviceSubtitle`,defaultMessage:`Signed in device`,description:`Subtitle for signed-in-device rows in the device connections table`})]}):(0,Q.jsx)(xn,{connection:n,error:i,state:a}),t[0]=n,t[1]=i,t[2]=s,t[3]=a,t[4]=c):c=t[4];let l;t[5]!==n.displayName||t[6]!==c?(l=(0,Q.jsx)(X,{children:(0,Q.jsx)(xe,{title:n.displayName,titleClassName:`break-words pr-8 text-lg leading-snug`,className:`gap-2`,subtitle:c})}),t[5]=n.displayName,t[6]=c,t[7]=l):l=t[7];let u;t[8]!==r||t[9]!==n||t[10]!==a?(u=(0,Q.jsx)(X,{className:`pt-0`,children:(0,Q.jsx)(wn,{connection:n,state:a,appServerVersion:r})}),t[8]=r,t[9]=n,t[10]=a,t[11]=u):u=t[11];let d;t[12]!==n||t[13]!==s||t[14]!==o||t[15]!==a?(d=!s&&o&&a===`connected`?(0,Q.jsx)(Cn,{connection:n}):null,t[12]=n,t[13]=s,t[14]=o,t[15]=a,t[16]=d):d=t[16];let f;return t[17]!==l||t[18]!==u||t[19]!==d?(f=(0,Q.jsxs)(Ce,{className:`gap-2 px-6 py-5`,children:[l,u,d]}),t[17]=l,t[18]=u,t[19]=d,t[20]=f):f=t[20],f}function bn(e){let t=(0,$.c)(2),{children:n}=e,r;return t[0]===n?r=t[1]:(r=(0,Q.jsx)(`span`,{className:`inline-flex items-center gap-0.5 rounded-full bg-token-foreground/10 py-0.5 pr-2 pl-1 text-xs font-medium text-token-text-primary`,children:n}),t[0]=n,t[1]=r),r}function xn(e){let t=(0,$.c)(4),{connection:n,error:r,state:i}=e,a;return t[0]!==n||t[1]!==r||t[2]!==i?(a=(0,Q.jsx)(Sn,{connection:n,error:r,state:i}),t[0]=n,t[1]=r,t[2]=i,t[3]=a):a=t[3],a}function Sn(e){let t=(0,$.c)(7),{connection:n,error:r,state:i}=e,a;t[0]!==n||t[1]!==r||t[2]!==i?(a=(0,Q.jsx)(hn,{connection:n,error:r,state:i}),t[0]=n,t[1]=r,t[2]=i,t[3]=a):a=t[3];let o;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,Q.jsx)(B,{id:`settings.remoteConnections.deviceConnections.sshSubtitle`,defaultMessage:`SSH`,description:`Subtitle for SSH-backed rows in the device connections table`}),t[4]=o):o=t[4];let s;return t[5]===a?s=t[6]:(s=(0,Q.jsxs)(bn,{children:[a,o]}),t[5]=a,t[6]=s),s}function Cn(e){let t=(0,$.c)(15),{connection:n}=e,r=j(te),i=z(),a=M(_,n.hostId),o;t[0]===n.hostId?o=t[1]:(o={hostId:n.hostId},t[0]=n.hostId,t[1]=o);let s=et(o),c,l;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,Q.jsx)(B,{id:`settings.remoteConnections.details.availableFromSignedInDevices`,defaultMessage:`Available from signed-in devices`,description:`Label for making an SSH connection available to signed-in Codex clients`}),l=(0,Q.jsx)(B,{id:`settings.remoteConnections.details.availableFromSignedInDevicesDescription`,defaultMessage:`Allow Codex apps signed into your account to use this device`,description:`Description for making an SSH connection available to signed-in Codex clients`}),t[2]=c,t[3]=l):(c=t[2],l=t[3]);let u=s.isPending,d;t[4]!==i||t[5]!==r||t[6]!==s?(d=e=>{s.mutate(e,{onError:()=>{r.get(q).danger(i.formatMessage({id:`settings.remoteConnections.details.availableFromSignedInDevicesUpdateError`,defaultMessage:`Couldn’t update signed-in device availability`,description:`Toast shown when updating signed-in-device availability for an SSH connection fails`}))}})},t[4]=i,t[5]=r,t[6]=s,t[7]=d):d=t[7];let f;t[8]===i?f=t[9]:(f=i.formatMessage({id:`settings.remoteConnections.details.availableFromSignedInDevices`,defaultMessage:`Available from signed-in devices`,description:`Label for making an SSH connection available to signed-in Codex clients`}),t[8]=i,t[9]=f);let p;return t[10]!==a||t[11]!==s.isPending||t[12]!==d||t[13]!==f?(p=(0,Q.jsx)(X,{className:`pt-0`,children:(0,Q.jsx)(Ge,{children:(0,Q.jsx)(We,{label:c,description:l,control:(0,Q.jsx)(Le,{checked:a,disabled:u,onChange:d,ariaLabel:f})})})}),t[10]=a,t[11]=s.isPending,t[12]=d,t[13]=f,t[14]=p):p=t[14],p}function wn(e){let t=(0,$.c)(15),{appServerVersion:n,connection:r,state:i}=e,a=j(te),o=z(),s,c;if(t[0]!==n||t[1]!==r||t[2]!==o||t[3]!==a||t[4]!==i){let e=Tn(r,i,n),l;t[7]!==o||t[8]!==a?(l=(e,t)=>{ve(e,t).then(()=>{a.get(q).info(o.formatMessage({id:`settings.remoteConnections.details.copySuccess`,defaultMessage:`Copied to clipboard`,description:`Toast shown after copying a remote connection detail value`}))},()=>{a.get(q).danger(o.formatMessage({id:`settings.remoteConnections.details.copyError`,defaultMessage:`Failed to copy value`,description:`Toast shown when copying a remote connection detail value fails`}))})},t[7]=o,t[8]=a,t[9]=l):l=t[9];let u=l;s=`overflow-hidden rounded-xl border border-token-border`;let d;t[10]===u?d=t[11]:(d=e=>{let t=e.copyValue,n=typeof e.value==`string`?(0,Q.jsx)(Yt,{value:e.value}):e.value;return(0,Q.jsxs)(`div`,{className:`flex min-h-9 items-center justify-between gap-3 border-t border-token-border px-3 py-2 first:border-t-0`,children:[(0,Q.jsx)(`div`,{className:`shrink-0 text-sm text-token-text-secondary`,children:e.label}),(0,Q.jsx)(`div`,{className:`max-w-[80%] min-w-0 text-right text-sm text-token-text-primary`,children:t==null?n:(0,Q.jsx)(`button`,{type:`button`,className:`block max-w-full min-w-0 cursor-interaction text-right`,onClick:e=>{u(t,e)},children:n})})]},e.id)},t[10]=u,t[11]=d),c=e.map(d),t[0]=n,t[1]=r,t[2]=o,t[3]=a,t[4]=i,t[5]=s,t[6]=c}else s=t[5],c=t[6];let l;return t[12]!==s||t[13]!==c?(l=(0,Q.jsx)(`div`,{className:s,children:c}),t[12]=s,t[13]=c,t[14]=l):l=t[14],l}function Tn(e,t,n){if(e.source===`remote-control`){let t=e.hostName||gn,n=En(e),r=e.appServerVersion||gn;return[{copyValue:e.hostName||null,id:`host`,label:(0,Q.jsx)(B,{id:`settings.remoteControlConnections.details.host`,defaultMessage:`Host`,description:`Modal label for a signed-in device host name`}),value:t},{copyValue:n===gn?null:n,id:`platform`,label:(0,Q.jsx)(B,{id:`settings.remoteControlConnections.details.platform`,defaultMessage:`OS / arch`,description:`Modal label for remote control OS and architecture`}),value:n},{copyValue:e.appServerVersion||null,id:`version`,label:(0,Q.jsx)(B,{id:`settings.remoteControlConnections.details.version`,defaultMessage:`Version`,description:`Modal label for remote control app-server version`}),value:r},{copyValue:e.lastSeenAt,id:`lastSeen`,label:(0,Q.jsx)(B,{id:`settings.remoteControlConnections.details.lastSeen`,defaultMessage:`Last seen`,description:`Modal label for when a signed-in device was last seen`}),value:e.lastSeenAt==null?gn:(0,Q.jsx)(je,{dateString:e.lastSeenAt})}]}let r=[],i=e.sshAlias?.trim();e.source===`discovered`&&i&&r.push({copyValue:i,id:`alias`,label:(0,Q.jsx)(B,{id:`settings.remoteConnections.details.alias`,defaultMessage:`Alias`,description:`Modal label for a discovered SSH connection alias`}),value:i}),r.push({copyValue:e.sshHost,id:`host`,label:(0,Q.jsx)(B,{id:`settings.remoteConnections.details.host`,defaultMessage:`Host`,description:`Modal label for an SSH connection host name`}),value:e.sshHost},{copyValue:e.sshPort==null?null:String(e.sshPort),id:`port`,label:(0,Q.jsx)(B,{id:`settings.remoteConnections.details.port`,defaultMessage:`Port`,description:`Modal label for SSH connection port`}),value:e.sshPort==null?gn:String(e.sshPort)},{copyValue:e.identity,id:`identity`,label:(0,Q.jsx)(B,{id:`settings.remoteConnections.details.identity`,defaultMessage:`Identity`,description:`Modal label for SSH connection identity file`}),value:e.identity??gn});let a=n?.trim();return t===`connected`&&a!=null&&a.length>0&&r.push({copyValue:a,id:`version`,label:(0,Q.jsx)(B,{id:`settings.remoteConnections.details.version`,defaultMessage:`Version`,description:`Modal label for SSH connection app-server version`}),value:a}),r}function En(e){let t=[e.os,e.arch].filter(e=>e.trim().length>0);return t.length>0?t.join(` / `):gn}var Dn=``+new URL(`remote-control-authorization-dialog-artwork-BDkdoGfj.png`,import.meta.url).href;function On(e){let t=(0,$.c)(29),{authorizing:n,open:r,onAuthorize:i,onOpenChange:a}=e,o=z(),{platform:s}=ue(),c;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(c={"aria-describedby":void 0},t[0]=c):c=t[0];let l;t[1]!==o||t[2]!==s?(l=s===`windows`?o.formatMessage({id:`settings.remoteConnections.authorizationDialog.title.windows`,defaultMessage:`Control other devices from this PC`,description:`Accessible title for the modal that authorizes this Windows device to control other devices`}):o.formatMessage({id:`settings.remoteConnections.authorizationDialog.title`,defaultMessage:`Control other devices from this Mac`,description:`Accessible title for the modal that authorizes this Mac to control other devices`}),t[1]=o,t[2]=s,t[3]=l):l=t[3];let u;t[4]===l?u=t[5]:(u=(0,Q.jsx)(be,{className:`sr-only`,children:l}),t[4]=l,t[5]=u);let d;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,Q.jsx)(kn,{}),t[6]=d):d=t[6];let f;t[7]===s?f=t[8]:(f=(0,Q.jsx)(`div`,{className:`heading-dialog font-semibold`,children:s===`windows`?(0,Q.jsx)(B,{id:`settings.remoteConnections.authorizationDialog.heading.windows`,defaultMessage:`Control other devices from this PC`,description:`Heading for the modal that authorizes this Windows device to control other devices`}):(0,Q.jsx)(B,{id:`settings.remoteConnections.authorizationDialog.heading`,defaultMessage:`Control other devices from this Mac`,description:`Heading for the modal that authorizes this Mac to control other devices`})}),t[7]=s,t[8]=f);let p;t[9]===s?p=t[10]:(p=(0,Q.jsx)(`div`,{className:`text-base leading-normal tracking-normal text-token-description-foreground`,children:s===`windows`?(0,Q.jsx)(B,{id:`settings.remoteConnections.authorizationDialog.description.windows`,defaultMessage:`Authorize this PC to control other devices signed in to your ChatGPT account`,description:`Description for the modal that authorizes this Windows device to control other devices`}):(0,Q.jsx)(B,{id:`settings.remoteConnections.authorizationDialog.description`,defaultMessage:`Authorize this Mac to control other devices signed in to your ChatGPT account`,description:`Description for the modal that authorizes this Mac to control other devices`})}),t[9]=s,t[10]=p);let m;t[11]!==f||t[12]!==p?(m=(0,Q.jsxs)(`div`,{className:`flex flex-col gap-2 text-center`,children:[f,p]}),t[11]=f,t[12]=p,t[13]=m):m=t[13];let h;t[14]===Symbol.for(`react.memo_cache_sentinel`)?(h=(0,Q.jsx)(Ye,{variant:`dialog`}),t[14]=h):h=t[14];let g;t[15]===Symbol.for(`react.memo_cache_sentinel`)?(g=(0,Q.jsx)(B,{id:`settings.remoteConnections.authorizationDialog.authorize`,defaultMessage:`Authorize on chatgpt.com`,description:`Primary action for authorizing this Mac to control other devices`}),t[15]=g):g=t[15];let _;t[16]!==n||t[17]!==i?(_=(0,Q.jsx)(Y,{size:`large`,loading:n,onClick:i,children:g}),t[16]=n,t[17]=i,t[18]=_):_=t[18];let v;t[19]!==_||t[20]!==m?(v=(0,Q.jsxs)(`div`,{className:`flex flex-col items-center gap-6 px-8 py-6`,children:[m,h,_]}),t[19]=_,t[20]=m,t[21]=v):v=t[21];let y;t[22]!==v||t[23]!==u?(y=(0,Q.jsxs)(`div`,{className:`pointer-events-auto flex flex-col overflow-hidden`,children:[u,d,v]}),t[22]=v,t[23]=u,t[24]=y):y=t[24];let b;return t[25]!==a||t[26]!==r||t[27]!==y?(b=(0,Q.jsx)(Se,{open:r,onOpenChange:a,contentProps:c,contentClassName:`w-[460px]`,size:`feature`,children:y}),t[25]=a,t[26]=r,t[27]=y,t[28]=b):b=t[28],b}function kn(){let e=(0,$.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,Q.jsx)(`div`,{className:`relative h-[214px] overflow-hidden`,children:(0,Q.jsx)(`img`,{alt:``,"aria-hidden":!0,className:`h-full w-full object-cover`,src:Dn})}),e[0]=t):t=e[0],t}function An(e){let t=(0,$.c)(32),{connections:n,refreshing:r,isSaving:i,open:a,onOpenChange:o,onRefresh:s,onSave:c,onToggleConnection:l,selectedEnvIds:u}=e,d=z(),f;t[0]===c?f=t[1]:(f=e=>{e.preventDefault(),c()},t[0]=c,t[1]=f);let p=f,m;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(m=(0,Q.jsx)(B,{id:`settings.remoteConnections.remoteControlDiscoveryDialog.empty`,defaultMessage:`No signed-in devices available`,description:`Empty state shown when there are no signed-in devices to add`}),t[2]=m):m=t[2];let h;t[3]===d?h=t[4]:(h=d.formatMessage({id:`settings.remoteConnections.remoteControlDiscoveryDialog.refresh`,defaultMessage:`Refresh`,description:`Accessible label for refreshing available signed-in devices in the add-device dialog`}),t[3]=d,t[4]=h);let g=r||i,_;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(_=(0,Q.jsx)(Re,{className:`icon-sm`}),t[5]=_):_=t[5];let v;t[6]!==s||t[7]!==r||t[8]!==h||t[9]!==g?(v=(0,Q.jsx)(Y,{"aria-label":h,color:`ghost`,size:`icon`,disabled:g,loading:r,onClick:s,children:_}),t[6]=s,t[7]=r,t[8]=h,t[9]=g,t[10]=v):v=t[10];let y;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(y=(0,Q.jsx)(Pn,{}),t[11]=y):y=t[11];let b;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(b=(0,Q.jsx)(J,{interactive:!0,side:`top`,tooltipBodyClassName:`max-w-[320px]`,tooltipContent:y,children:(0,Q.jsx)(`button`,{type:`button`,className:`min-w-0 flex-1 cursor-interaction text-left text-sm text-token-text-primary`,children:(0,Q.jsx)(B,{id:`settings.remoteConnections.remoteControlDiscoveryDialog.missingDevice`,defaultMessage:`Don’t see your device here?`,description:`Tooltip trigger that explains how to make another device discoverable`})})}),t[12]=b):b=t[12];let x=n.length===0||i,S;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(S=(0,Q.jsx)(B,{id:`settings.remoteConnections.remoteControlDiscoveryDialog.save`,defaultMessage:`Add`,description:`Primary action that adds selected signed-in devices`}),t[13]=S):S=t[13];let C;t[14]===x?C=t[15]:(C=(0,Q.jsx)(Y,{type:`submit`,size:`large`,disabled:x,children:S}),t[14]=x,t[15]=C);let w;t[16]!==C||t[17]!==v?(w=(0,Q.jsxs)(`div`,{className:`flex items-center gap-3`,children:[v,b,C]}),t[16]=C,t[17]=v,t[18]=w):w=t[18];let T;t[19]!==n||t[20]!==d||t[21]!==i||t[22]!==l||t[23]!==u?(T=n.length===0?null:n.map(e=>{let t=u.includes(e.envId);return(0,Q.jsx)(`div`,{"aria-disabled":i,className:i?`cursor-not-allowed`:`cursor-interaction`,onClick:i?void 0:()=>{l(e.envId)},onKeyDown:i?void 0:t=>{t.key!==`Enter`&&t.key!==` `||(t.preventDefault(),l(e.envId))},role:`button`,tabIndex:i?-1:0,children:(0,Q.jsx)(We,{icon:ht(e),label:e.displayName,description:(0,Q.jsx)(Nn,{connection:e}),control:(0,Q.jsx)(`div`,{className:`relative flex items-center`,onClick:Mn,onKeyDown:jn,children:(0,Q.jsx)(Ee,{"aria-label":d.formatMessage({id:`settings.remoteConnections.remoteControlDiscoveryDialog.toggleSelection`,defaultMessage:`Select {connectionName}`,description:`Accessible label for staging a signed-in device with a checkbox`},{connectionName:e.displayName}),checked:t,disabled:i,onCheckedChange:()=>{l(e.envId)}})})})},e.envId)}),t[19]=n,t[20]=d,t[21]=i,t[22]=l,t[23]=u,t[24]=T):T=t[24];let E;t[25]===Symbol.for(`react.memo_cache_sentinel`)?(E=(0,Q.jsx)(B,{id:`settings.remoteConnections.remoteControlDiscoveryDialog.title`,defaultMessage:`Add device`,description:`Title for the dialog that lets users add a signed-in device`}),t[25]=E):E=t[25];let D;return t[26]!==p||t[27]!==o||t[28]!==a||t[29]!==w||t[30]!==T?(D=(0,Q.jsx)(At,{emptyState:m,footer:w,list:T,open:a,title:E,onOpenChange:o,onSubmit:p}),t[26]=p,t[27]=o,t[28]=a,t[29]=w,t[30]=T,t[31]=D):D=t[31],D}function jn(e){e.stopPropagation()}function Mn(e){e.stopPropagation()}function Nn(e){let t=(0,$.c)(8),{connection:n}=e,r=n.online?`block size-2 rounded-full bg-token-charts-green`:`block size-2 rounded-full bg-gray-400`,i;t[0]===r?i=t[1]:(i=(0,Q.jsx)(`span`,{className:r}),t[0]=r,t[1]=i);let a;t[2]!==n.lastSeenAt||t[3]!==n.online?(a=n.online?(0,Q.jsx)(B,{id:`settings.remoteConnections.remoteControlDiscoveryDialog.online`,defaultMessage:`Online`,description:`Status label for an available signed-in device in the add-device dialog`}):n.lastSeenAt==null?(0,Q.jsx)(B,{id:`settings.remoteConnections.remoteControlDiscoveryDialog.offline`,defaultMessage:`Offline`,description:`Status label for an unavailable signed-in device in the add-device dialog`}):(0,Q.jsx)(B,{id:`settings.remoteConnections.remoteControlDiscoveryDialog.lastUsed`,defaultMessage:`Last used {date}`,description:`Status label for a signed-in device that was seen previously in the add-device dialog`,values:{date:(0,Q.jsx)(je,{dateString:n.lastSeenAt},`last-used-at`)}}),t[2]=n.lastSeenAt,t[3]=n.online,t[4]=a):a=t[4];let o;return t[5]!==i||t[6]!==a?(o=(0,Q.jsxs)(`div`,{className:`flex items-center gap-2`,children:[i,a]}),t[5]=i,t[6]=a,t[7]=o):o=t[7],o}function Pn(){let e=(0,$.c)(5),{platform:t}=ue(),n,r;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,Q.jsx)(`li`,{children:(0,Q.jsx)(B,{id:`settings.remoteConnections.remoteControlDiscoveryDialog.tooltip.openApp`,defaultMessage:`Go to the Codex app on your device`,description:`First tooltip step for making another device discoverable`})}),r=(0,Q.jsx)(`li`,{children:(0,Q.jsx)(B,{id:`settings.remoteConnections.remoteControlDiscoveryDialog.tooltip.openConnections`,defaultMessage:`Open Connections tab`,description:`Second tooltip step for making another device discoverable`})}),e[0]=n,e[1]=r):(n=e[0],r=e[1]);let i;e[2]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,Q.jsxs)(`ol`,{className:`list-decimal space-y-0 pl-4`,children:[n,r,(0,Q.jsx)(`li`,{children:(0,Q.jsx)(B,{id:`settings.remoteConnections.remoteControlDiscoveryDialog.tooltip.clickSetup`,defaultMessage:`Click “{setupLabel}” to make your device discoverable`,description:`Third tooltip step for making another device discoverable`,values:{setupLabel:(0,Q.jsx)(`strong`,{children:(0,Q.jsx)(B,{id:`settings.remoteConnections.remoteControlDiscoveryDialog.tooltip.setupLabel`,defaultMessage:`Set up`,description:`Inline button label quoted inside the missing-device tooltip`})})}})})]}),e[2]=i):i=e[2];let a;return e[3]===t?a=e[4]:(a=(0,Q.jsxs)(`div`,{className:`space-y-4 text-left`,children:[i,(0,Q.jsx)(`div`,{children:(0,Q.jsx)(B,{id:`settings.remoteConnections.remoteControlDiscoveryDialog.tooltip.enableHost`,defaultMessage:`Or turn on {settingLabel} if the device is already set up`,description:`Fallback tooltip guidance for making another device discoverable`,values:{settingLabel:(0,Q.jsx)(`strong`,{children:t===`windows`?(0,Q.jsx)(B,{id:`settings.remoteConnections.remoteControlDiscoveryDialog.tooltip.settingLabel.windows`,defaultMessage:`Allow this PC to be discovered and controlled`,description:`Inline settings label quoted inside the missing-device tooltip on Windows`}):(0,Q.jsx)(B,{id:`settings.remoteConnections.remoteControlDiscoveryDialog.tooltip.settingLabel`,defaultMessage:`Allow this Mac to be discovered and controlled`,description:`Inline settings label quoted inside the missing-device tooltip`})})}})})]}),e[3]=t,e[4]=a),a}function Fn(e){let t=(0,$.c)(27),{connection:n,open:r,isDeleting:i,onOpenChange:a,onConfirm:o}=e,s;t[0]===o?s=t[1]:(s=e=>{e.preventDefault(),o()},t[0]=o,t[1]=s);let c=s,l=n?.displayName??``,u;t[2]===l?u=t[3]:(u=(0,Q.jsx)(B,{id:`settings.remoteControlConnections.deleteDialog.title`,defaultMessage:`Delete {connectionName}?`,description:`Title for dialog confirming deletion of a remote control environment`,values:{connectionName:l}}),t[2]=l,t[3]=u);let d;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,Q.jsx)(B,{id:`settings.remoteControlConnections.deleteDialog.subtitle`,defaultMessage:`This removes the environment and its remote control threads from Codex. This cannot be undone.`,description:`Subtitle for dialog confirming deletion of a remote control environment`}),t[4]=d):d=t[4];let f;t[5]===u?f=t[6]:(f=(0,Q.jsx)(X,{children:(0,Q.jsx)(xe,{title:u,subtitle:d})}),t[5]=u,t[6]=f);let p;t[7]===a?p=t[8]:(p=()=>a(!1),t[7]=a,t[8]=p);let m;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(m=(0,Q.jsx)(B,{id:`settings.remoteControlConnections.deleteDialog.cancel`,defaultMessage:`Cancel`,description:`Cancel button label for remote control environment delete dialog`}),t[9]=m):m=t[9];let h;t[10]!==i||t[11]!==p?(h=(0,Q.jsx)(Y,{color:`ghost`,disabled:i,type:`button`,onClick:p,children:m}),t[10]=i,t[11]=p,t[12]=h):h=t[12];let g;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(g=(0,Q.jsx)(B,{id:`settings.remoteControlConnections.deleteDialog.confirm`,defaultMessage:`Delete`,description:`Confirm button label for remote control environment delete dialog`}),t[13]=g):g=t[13];let _;t[14]===i?_=t[15]:(_=(0,Q.jsx)(Y,{color:`danger`,loading:i,type:`submit`,children:g}),t[14]=i,t[15]=_);let v;t[16]!==_||t[17]!==h?(v=(0,Q.jsx)(X,{children:(0,Q.jsxs)(we,{children:[h,_]})}),t[16]=_,t[17]=h,t[18]=v):v=t[18];let y;t[19]!==c||t[20]!==v||t[21]!==f?(y=(0,Q.jsxs)(Ce,{as:`form`,onSubmit:c,children:[f,v]}),t[19]=c,t[20]=v,t[21]=f,t[22]=y):y=t[22];let b;return t[23]!==a||t[24]!==r||t[25]!==y?(b=(0,Q.jsx)(Se,{open:r,onOpenChange:a,size:`compact`,children:y}),t[23]=a,t[24]=r,t[25]=y,t[26]=b):b=t[26],b}function In({remoteControlConnectionsAuthorized:e,remoteControlConnectionsAuthRequired:t,showRemoteControlConnectionsSection:n}){return n&&!t&&!e}var Ln=`remote-connections-refresh-success`,Rn=`remote-connections-refresh-error`,zn=`remote-connections-save-success`,Bn=`remote-connections-save-error`,Vn=`remote-connections-connect-toggle-error`,Hn=`remote-connections-install-codex-error`,Un=`remote-connections-logout-error`,Wn=`remote-control-environment-rename-success`,Gn=`remote-control-environment-rename-error`,Kn=`remote-control-environment-delete-success`,qn=`remote-control-environment-delete-error`,Jn=`remote-control-authorize-success`,Yn=`remote-control-authorize-error`,Xn=`[remote-connections/settings]`,Zn=15e3,Qn=[],$n=[];function er(){let e=j(te),n=ee(U),r=ie(),i=z(),{platform:a}=ue(),o=re(`782640499`),s=i.formatMessage({id:`settings.remoteConnections.refresh`,defaultMessage:`Refresh`,description:`Button label to refresh remote connections`}),[c]=v(`remote_connections`),[l]=v(`remote_control_connections`),[p]=v(`remote_control_connections_state`),[m,_]=(0,Z.useState)(null),[O,k]=(0,Z.useState)(Qn),[A,M]=(0,Z.useState)([]),[F,L]=(0,Z.useState)([]),[V,K]=(0,Z.useState)(!1),[oe,se]=(0,Z.useState)(!1),[ce,le]=(0,Z.useState)(!1),[de,fe]=(0,Z.useState)(`control-this-mac`),[ge,_e]=(0,Z.useState)(null),[ve,ye]=(0,Z.useState)(null),X=me(),be=!o,xe=c==null,Se=X&&l==null,Ce=[...c??Qn].sort(tr),we=nr(l??$n),{data:Te}=W(u.ADDED_REMOTE_CONTROL_ENV_IDS),Ee=ae({addedRemoteControlEnvIds:Te,remoteControlConnections:we}),De=G({addedRemoteControlEnvIds:Te,remoteControlConnections:we}),Oe=Ee.length>0,ke=p?.authRequired===!0,Ae=p?.clientAuthorized===!0,je=In({remoteControlConnectionsAuthorized:Ae,remoteControlConnectionsAuthRequired:ke,showRemoteControlConnectionsSection:X}),Me=!Oe&&Ae&&!ke,Ne=Ce.map(e=>It(Ft(e),{connectionAnalyticsId:e.connectionAnalyticsId})),Pe=new Set(Ne.map(e=>e.hostId)),Fe=O.filter(e=>!Pe.has(e.hostId)),Ie=X&&!0,Le=be&&(X||!1),Be=he({selectedConnectionsTab:de,showControlOtherDevices:be,showControlThisMacTab:Ie,showRemoteControlConnectionsSection:X,showRemoteSshConnections:!0,showTabbedSshPage:X&&!0}),Ue=()=>{e.get(q).success(i.formatMessage({id:`settings.remoteConnections.refresh.success`,defaultMessage:`Refreshed remote connections`,description:`Toast shown when remote connections refresh successfully`}),{id:Ln})},We=t=>{I.warning(`${Xn} refresh_failed`,{safe:{},sensitive:{error:t}}),e.get(q).danger(t instanceof Error?t.message:i.formatMessage({id:`settings.remoteConnections.refresh.error`,defaultMessage:`Failed to refresh remote connections`,description:`Toast shown when remote connections fail to refresh`}),{id:Rn})},qe=R(`refresh-remote-connections`),Je=R(`discover-remote-ssh-connections`),Ye=R(`refresh-remote-control-connections`),Xe=R(`authorize-remote-control-connections`,{onSuccess:()=>{H(e,{eventName:`codex_remote_control_authorization_result`,metadata:{result:`succeeded`}}),e.get(q).success(i.formatMessage({id:`settings.remoteControlConnections.authorize.success`,defaultMessage:`Remote control authorized`,description:`Toast shown when remote control authorization succeeds`}),{id:Jn}),le(!1),L([]),se(!0)},onError:t=>{H(e,{eventName:`codex_remote_control_authorization_result`,metadata:{result:`failed`}}),I.warning(`${Xn} remote_control_authorize_failed`,{safe:{},sensitive:{error:t}}),e.get(q).danger(t instanceof P&&t.errorCode===`remote_control_enrollment_account_mismatch`?i.formatMessage({id:`settings.remoteControlConnections.authorize.accountMismatch`,defaultMessage:`Remote control authorization used a different account`,description:`Toast shown when remote control authorization completes for a different account`}):i.formatMessage({id:`settings.remoteControlConnections.authorize.error`,defaultMessage:`Failed to authorize remote control`,description:`Toast shown when remote control authorization fails`}),{id:Yn})}}),Ze=R(`save-codex-managed-remote-ssh-connections`,{onSuccess:()=>{e.get(q).success(i.formatMessage({id:`settings.remoteConnections.save.success`,defaultMessage:`Saved remote connections`,description:`Toast shown when remote connections are saved`}),{id:zn})},onError:t=>{I.warning(`${Xn} save_failed`,{safe:{},sensitive:{error:t}}),e.get(q).danger(i.formatMessage({id:`settings.remoteConnections.save.error`,defaultMessage:`Failed to save remote connections`,description:`Toast shown when remote connections fail to save`}),{id:Bn})}}),Qe=N({mutationFn:t=>w(e,u.ADDED_REMOTE_CONTROL_ENV_IDS,[...Te,...t])}),$e=R(`set-remote-connection-auto-connect`,{onError:(t,{autoConnect:r,hostId:a})=>{let o=Ce.find(e=>e.hostId===a);r&&o!=null&&x(n,{action:g.CODEX_REMOTE_SSH_CONNECTION_ACTION_CONNECT,result:b.CODEX_REMOTE_SSH_CONNECTION_RESULT_FAILED,source:S.CODEX_REMOTE_SSH_CONNECTION_EVENT_SOURCE_SETTINGS,connection:o,errorCategory:E.CODEX_REMOTE_SSH_CONNECTION_ERROR_CATEGORY_CONNECTION_FAILED}),I.warning(`${Xn} connect_toggle_failed`,{safe:{autoConnect:r},sensitive:{error:t,hostId:a}}),e.get(q).danger(i.formatMessage({id:`settings.remoteConnections.connectToggle.error`,defaultMessage:`Failed to update connection`,description:`Toast shown when remote connection toggle fails`}),{id:Vn})}}),et=R(`install-remote-codex`,{onError:(t,{hostId:n})=>{I.warning(`${Xn} install_remote_codex_failed`,{safe:{},sensitive:{error:t,hostId:n}}),e.get(q).danger(t instanceof Error?t.message:i.formatMessage({id:`settings.remoteConnections.installCodex.error`,defaultMessage:`Failed to install Codex`,description:`Toast shown when installing Codex on a remote connection fails`}),{id:Hn})}}),tt=R(`rename-remote-control-environment`,{onSuccess:()=>{e.get(q).success(i.formatMessage({id:`settings.remoteControlConnections.rename.success`,defaultMessage:`Renamed remote control environment`,description:`Toast shown when a remote control environment is renamed`}),{id:Wn})},onError:(t,{envId:n})=>{I.warning(`${Xn} remote_control_rename_failed`,{safe:{},sensitive:{envId:n,error:t}}),e.get(q).danger(i.formatMessage({id:`settings.remoteControlConnections.rename.error`,defaultMessage:`Failed to rename remote control environment`,description:`Toast shown when a remote control environment rename fails`}),{id:Gn})}}),nt=R(`delete-remote-control-environment`,{onSuccess:()=>{e.get(q).success(i.formatMessage({id:`settings.remoteControlConnections.delete.success`,defaultMessage:`Deleted remote control environment`,description:`Toast shown when a remote control environment is deleted`}),{id:Kn})},onError:(t,{envId:n})=>{I.warning(`${Xn} remote_control_delete_failed`,{safe:{},sensitive:{envId:n,error:t}}),e.get(q).danger(i.formatMessage({id:`settings.remoteControlConnections.delete.error`,defaultMessage:`Failed to delete remote control environment`,description:`Toast shown when a remote control environment delete fails`}),{id:qn})}}),rt=Ze.isPending,it=qe.isPending||Je.isPending||Ye.isPending||Xe.isPending||Ze.isPending||Qe.isPending||$e.isPending||et.isPending||tt.isPending||nt.isPending,at=t=>{r.getForHostId(t)??r.addManager(f(e,t,e.get(T,t)))},ot=async()=>{try{let e=[];x(n,{action:g.CODEX_REMOTE_SSH_CONNECTION_ACTION_REFRESH,result:b.CODEX_REMOTE_SSH_CONNECTION_RESULT_STARTED,source:S.CODEX_REMOTE_SSH_CONNECTION_EVENT_SOURCE_SETTINGS}),e.push(qe.mutateAsync(void 0).then(({remoteConnections:e})=>{n.logProductEvent(h,d(e))}).catch(e=>{throw x(n,{action:g.CODEX_REMOTE_SSH_CONNECTION_ACTION_REFRESH,result:b.CODEX_REMOTE_SSH_CONNECTION_RESULT_FAILED,source:S.CODEX_REMOTE_SSH_CONNECTION_EVENT_SOURCE_SETTINGS,errorCategory:E.CODEX_REMOTE_SSH_CONNECTION_ERROR_CATEGORY_UNKNOWN}),e})),X&&e.push(ht()),await Promise.all(e),Ue()}catch(e){We(e)}},ct=async()=>{let{discoveredRemoteConnections:e}=await Je.mutateAsync(void 0);k([...e].sort(tr))},$=async()=>{try{await ct(),M([]),K(!0)}catch(e){We(e)}},dt=e=>{L(t=>t.includes(e)?t.filter(t=>t!==e):[...t,e])},ft=()=>{if(Qe.isPending)return;let t=De.filter(e=>F.includes(e.envId)).map(e=>e.envId);if(t.length===0){se(!1);return}H(e,{eventName:`codex_remote_control_environment_add_clicked`,metadata:{addable_connection_count:De.length,existing_connection_count:Ee.length}}),Qe.mutate(t,{onSuccess:()=>{L([]),se(!1)}})},pt=()=>{L([]),se(!0)},mt=()=>{H(e,{eventName:`codex_remote_control_authorization_result`,metadata:{result:`started`}}),Xe.mutate(void 0)},ht=async()=>{let{remoteControlConnections:e}=await Ye.mutateAsync(void 0);n.logProductEvent(y,qt(e))},gt=(0,Z.useEffectEvent)(async e=>{if(!it)try{let t=[];t.push(ne(`refresh-remote-connections`,{signal:e})),X&&t.push(ne(`refresh-remote-control-connections`,{signal:e})),await Promise.all(t)}catch(e){if(e instanceof DOMException&&e.name===`AbortError`)return;I.debug(`${Xn} auto_refresh_failed`,{safe:{},sensitive:{error:e}})}});(0,Z.useEffect)(()=>{let e=null,t=!1,n=async()=>{if(!t){t=!0,e=new AbortController;try{await gt(e.signal)}finally{e=null,t=!1}}},r=window.setInterval(()=>{n()},Zn);return()=>{e?.abort(),window.clearInterval(r)}},[]);let _t=async()=>{if(ve!=null)try{await nt.mutateAsync({envId:ve.envId}),ye(null)}catch{}},vt=(t,n,i)=>{at(t),D(e,{error:i,hostId:t,source:`settings_sync_remote_connection_state`,state:n??`disconnected`}),r.notifyRegistryChanged()},bt=e=>{et.mutate({hostId:e},{onSuccess:({state:t,error:n})=>{vt(e,t,n)}})},xt=e=>{if(m==null||rt)return;let t=m.mode===`edit`?Ce.find(e=>e.hostId===m.hostId)??null:null,r=m.mode===`add`?!0:t?.autoConnect??!1,i=It(e,{connectionAnalyticsId:t?.connectionAnalyticsId}),a=m.mode===`add`?[...Ne,i]:Ne.filter(e=>e.hostId!==m.hostId).concat(i).sort(tr);Ze.mutate({remoteConnections:a},{onSuccess:({remoteConnections:e})=>{let t=e.find(e=>e.hostId===i.hostId)??i;x(n,{action:g.CODEX_REMOTE_SSH_CONNECTION_ACTION_SAVE_CONNECTION,result:b.CODEX_REMOTE_SSH_CONNECTION_RESULT_SUCCEEDED,source:S.CODEX_REMOTE_SSH_CONNECTION_EVENT_SOURCE_SETTINGS,connection:t});let a=m.mode===`add`&&m.returnToDiscoveryDialog;_(null),a&&K(!0),r&&Tt(i.hostId,!0)},onError:()=>{x(n,{action:g.CODEX_REMOTE_SSH_CONNECTION_ACTION_SAVE_CONNECTION,result:b.CODEX_REMOTE_SSH_CONNECTION_RESULT_FAILED,source:S.CODEX_REMOTE_SSH_CONNECTION_EVENT_SOURCE_SETTINGS,connection:i,errorCategory:E.CODEX_REMOTE_SSH_CONNECTION_ERROR_CATEGORY_UNKNOWN})}})},St=e=>{rt||Ze.mutate({remoteConnections:Ne.filter(t=>t.hostId!==e)})},Ct=e=>{M(t=>t.includes(e)?t.filter(t=>t!==e):[...t,e])},wt=()=>{if(rt)return;let e=Fe.filter(e=>A.includes(e.hostId));if(e.length===0){K(!1);return}let t=e.map(e=>It({...Ft(e),displayName:e.sshAlias?.trim()||e.displayName}));Ze.mutate({remoteConnections:[...Ne,...t].sort(tr)},{onSuccess:()=>{t.forEach(e=>{Tt(e.hostId,!0)}),M([]),K(!1)}})},Tt=(e,r)=>{rt||$e.mutate({hostId:e,autoConnect:r},{onSuccess:({remoteConnections:i,state:a,error:o})=>{vt(e,a,o);let s=i.find(n=>n.hostId===e&&t(n));if(r&&s!=null){let e=a===`connected`&&o==null;x(n,{action:g.CODEX_REMOTE_SSH_CONNECTION_ACTION_CONNECT,result:e?b.CODEX_REMOTE_SSH_CONNECTION_RESULT_SUCCEEDED:b.CODEX_REMOTE_SSH_CONNECTION_RESULT_FAILED,source:S.CODEX_REMOTE_SSH_CONNECTION_EVENT_SOURCE_SETTINGS,connection:s,connectionState:a,...e?{}:o==null?{errorCategory:E.CODEX_REMOTE_SSH_CONNECTION_ERROR_CATEGORY_UNKNOWN}:{connectionError:o}})}}})},Et=()=>{$()},Dt=async t=>{try{await C(`logout`,{hostId:t}),vt(t,`error`,{code:`login-required`})}catch(n){I.warning(`${Xn} logout_failed`,{safe:{},sensitive:{error:n,hostId:t}}),e.get(q).danger(i.formatMessage({id:`settings.remoteConnections.logout.error`,defaultMessage:`Failed to log out of connection`,description:`Toast shown when logging out of a remote connection fails`}),{id:Un})}},Ot=[{key:`access-other-devices`,name:(0,Q.jsx)(B,{id:`settings.remoteConnections.tabs.accessOtherDevices`,defaultMessage:`Control other devices`,description:`Tab label for settings that let this computer control other devices`})}],At=[{key:`control-this-mac`,name:a===`windows`?(0,Q.jsx)(B,{id:`settings.remoteConnections.tabs.controlThisMac.windows`,defaultMessage:`Control this PC`,description:`Tab label for settings that let other devices control this Windows device`}):(0,Q.jsx)(B,{id:`settings.remoteConnections.tabs.controlThisMac`,defaultMessage:`Control this Mac`,description:`Tab label for settings that let other devices control this computer`})}],Mt=[{key:`ssh`,name:(0,Q.jsx)(B,{id:`settings.remoteConnections.tabs.ssh`,defaultMessage:`SSH`,description:`Tab label for SSH remote connections`})}],Nt=[...Ie?At:[],...Le?Ot:[],...Mt];return(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(He,{title:(0,Q.jsx)(ze,{slug:`connections`}),subtitle:null,children:[Nt.length>=2?(0,Q.jsx)(st,{ariaLabel:i.formatMessage({id:`settings.remoteConnections.tabs.ariaLabel`,defaultMessage:`Connections view`,description:`Accessible label for the remote connections view selector`}),className:`w-full`,tabs:Nt,selectedKey:Be,variant:`underline`,onSelect:fe}):null,Be===`control-this-mac`?(0,Q.jsx)(pe,{electron:!0,children:(0,Q.jsx)(yt,{})}):null,be&&Be===`access-other-devices`&&je?(0,Q.jsxs)(Ke,{children:[(0,Q.jsx)(Ke.Header,{title:a===`windows`?(0,Q.jsx)(B,{id:`settings.remoteConnections.accessOtherDevices.devices.title.windows`,defaultMessage:`Devices you can control from this PC`,description:`Header title for the access other devices setup section on Windows`}):(0,Q.jsx)(B,{id:`settings.remoteConnections.accessOtherDevices.devices.title`,defaultMessage:`Devices you can control from this Mac`,description:`Header title for the access other devices setup section`})}),(0,Q.jsx)(Ke.Content,{children:(0,Q.jsx)(Ge,{children:(0,Q.jsx)(Ve,{spacing:`compact`,title:null,description:(0,Q.jsx)(B,{id:`settings.remoteConnections.accessOtherDevices.setup.description`,defaultMessage:`Access and control other devices from this computer`,description:`Description shown before this computer has been set up to access other devices`}),illustration:(0,Q.jsx)(lt,{className:`h-6 w-auto text-token-text-primary`}),actions:(0,Q.jsx)(Y,{color:`secondary`,disabled:it,onClick:()=>{le(!0)},children:(0,Q.jsx)(B,{id:`settings.remoteConnections.accessOtherDevices.setup.action`,defaultMessage:`Set up`,description:`Button label to authorize remote control from the access-other-devices setup state`})})})})})]}):null,be&&Be===`access-other-devices`&&!je?(0,Q.jsxs)(Ke,{children:[(0,Q.jsx)(Ke.Header,{title:a===`windows`?(0,Q.jsx)(B,{id:`settings.remoteConnections.accessOtherDevices.header.title.windows`,defaultMessage:`Devices you can control from this PC`,description:`Header title for the devices this Windows device can access`}):(0,Q.jsx)(B,{id:`settings.remoteConnections.accessOtherDevices.header.title`,defaultMessage:`Devices you can control from this Mac`,description:`Header title for the devices this computer can access`}),actions:(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(J,{tooltipContent:s,children:(0,Q.jsx)(Y,{"aria-label":s,color:`ghost`,size:`icon`,disabled:it,onClick:()=>{ot()},children:(0,Q.jsx)(Re,{className:`icon-xs`})})}),Oe?(0,Q.jsx)(Y,{color:`secondary`,disabled:it||ke,onClick:pt,children:(0,Q.jsx)(B,{id:`settings.remoteConnections.add.short`,defaultMessage:`Add`,description:`Button label for adding a connection from a connections settings tab`})}):null]})}),(0,Q.jsx)(Ke.Content,{children:Se?(0,Q.jsx)(Ge,{children:(0,Q.jsx)(`div`,{className:`p-3 text-sm text-token-text-secondary`,children:(0,Q.jsx)(B,{id:`settings.remoteConnections.accessOtherDevices.loading`,defaultMessage:`Loading devices…`,description:`Loading message for devices this computer can access`})})}):(0,Q.jsx)(Ge,{children:(0,Q.jsxs)(Q.Fragment,{children:[Me?(0,Q.jsx)(Ve,{spacing:`compact`,title:null,description:(0,Q.jsx)(B,{id:`settings.remoteConnections.accessOtherDevices.empty`,defaultMessage:`No devices added yet`,description:`Empty state for devices this computer can access`}),illustration:(0,Q.jsx)(lt,{className:`h-6 w-auto text-token-text-primary`}),actions:(0,Q.jsx)(Y,{color:`secondary`,disabled:it,onClick:pt,children:(0,Q.jsx)(B,{id:`settings.remoteConnections.add.short`,defaultMessage:`Add`,description:`Button label for adding a connection from a connections settings tab`})})}):(0,Q.jsx)(_n,{connections:Ee,disabled:it,clientAuthorized:Ae,installingCodexHostId:null,showEmptyState:!1,onEditSshConnection:()=>{},onInstallCodex:()=>{},onRemoveSshConnection:()=>{},onRenameRemoteControlConnection:async(e,t)=>{await tt.mutateAsync({envId:e,name:t})},onRequestDeleteRemoteControlConnection:ye,onToggleConnection:Tt,onLogoutConnection:e=>{Dt(e)},onAuthenticate:()=>{}}),ke?(0,Q.jsx)(`div`,{className:`p-3 text-sm text-token-text-secondary`,children:(0,Q.jsx)(B,{id:`settings.remoteControlConnections.authRequired`,defaultMessage:`Sign in to ChatGPT in Codex Desktop, then refresh to load remote control environments`,description:`Message shown when remote control environments require desktop ChatGPT auth`})}):null]})})})]}):null,Be===`ssh`?(0,Q.jsxs)(Ke,{children:[(0,Q.jsx)(Ke.Header,{title:a===`windows`?(0,Q.jsx)(B,{id:`settings.remoteConnections.ssh.header.title.windows`,defaultMessage:`SSH connections from this PC`,description:`Header title for SSH connections from this Windows device`}):(0,Q.jsx)(B,{id:`settings.remoteConnections.ssh.header.title`,defaultMessage:`SSH connections from this Mac`,description:`Header title for SSH connections from this Mac`}),actions:Ce.length>0?(0,Q.jsx)(Y,{color:`secondary`,disabled:rt,onClick:Et,children:(0,Q.jsx)(B,{id:`settings.remoteConnections.add.short`,defaultMessage:`Add`,description:`Button label for adding a connection from a connections settings tab`})}):null}),(0,Q.jsx)(Ke.Content,{children:(0,Q.jsx)(Ge,{children:xe?(0,Q.jsx)(`div`,{className:`p-3 text-sm text-token-text-secondary`,children:(0,Q.jsx)(B,{id:`settings.remoteConnections.ssh.loading`,defaultMessage:`Loading SSH connections…`,description:`Loading message for SSH connections`})}):Ce.length===0?(0,Q.jsx)(Ve,{spacing:`compact`,title:null,description:(0,Q.jsx)(B,{id:`settings.remoteConnections.ssh.empty`,defaultMessage:`Connect to a remote device through SSH connection`,description:`Empty state for SSH connections`}),illustration:(0,Q.jsx)(ut,{className:`h-6 w-auto text-token-text-primary`}),actions:(0,Q.jsx)(Y,{color:`secondary`,disabled:rt,onClick:Et,children:(0,Q.jsx)(B,{id:`settings.remoteConnections.add.short`,defaultMessage:`Add`,description:`Button label for adding a connection from a connections settings tab`})})}):(0,Q.jsx)(Q.Fragment,{children:(0,Q.jsx)(_n,{connections:Ce,disabled:it,clientAuthorized:Ae,installingCodexHostId:et.isPending?et.variables?.hostId??null:null,showEmptyState:!1,onEditSshConnection:e=>{let t=Ce.find(t=>t.hostId===e);t!=null&&_({mode:`edit`,hostId:e,draft:Ft(t)})},onInstallCodex:bt,onRemoveSshConnection:St,onRenameRemoteControlConnection:async()=>{},onRequestDeleteRemoteControlConnection:()=>{},onToggleConnection:Tt,onLogoutConnection:e=>{Dt(e)},onAuthenticate:e=>{at(e),_e(e)}})})})})]}):null]}),m==null?null:(0,Q.jsx)(Bt,{open:!0,mode:m.mode,draft:m.draft,existingConnections:Ce,editingHostId:m.mode===`edit`?m.hostId:null,onOpenChange:e=>{if(!e){let e=m.mode===`add`&&m.returnToDiscoveryDialog;_(null),e&&K(!0)}},onSubmit:xt,isSaving:Ze.isPending}),V?(0,Q.jsx)(jt,{connections:Fe,isSaving:Ze.isPending,open:!0,refreshing:Je.isPending,onAddManually:()=>{K(!1),_({mode:`add`,draft:Pt(),returnToDiscoveryDialog:!0})},onOpenChange:K,onRefresh:()=>{ct().catch(We)},onSave:wt,onToggleConnection:Ct,selectedHostIds:A}):null,be&&oe?(0,Q.jsx)(An,{connections:De,refreshing:Ye.isPending,isSaving:Qe.isPending,open:!0,onOpenChange:e=>{se(e),e||L([])},onRefresh:()=>{ht().catch(We)},onSave:ft,onToggleConnection:dt,selectedEnvIds:F}):null,be&&ce?(0,Q.jsx)(On,{authorizing:Xe.isPending,open:!0,onAuthorize:mt,onOpenChange:le}):null,(0,Q.jsx)(kt,{hostId:ge,open:ge!=null,onOpenChange:e=>{e||_e(null)}}),be?(0,Q.jsx)(Fn,{connection:ve,open:ve!=null,isDeleting:nt.isPending,onOpenChange:e=>{e||ye(null)},onConfirm:()=>{_t()}}):null]})}function tr(e,t){return e.displayName.localeCompare(t.displayName)}function nr(e){return[...e].sort((e,t)=>e.online&&t.online?tr(e,t):e.online===t.online?e.lastSeenAt!=null&&t.lastSeenAt==null?-1:e.lastSeenAt==null&&t.lastSeenAt!=null?1:e.lastSeenAt!=null&&t.lastSeenAt!=null&&e.lastSeenAt!==t.lastSeenAt?t.lastSeenAt.localeCompare(e.lastSeenAt):tr(e,t):e.online?-1:1)}export{er as RemoteConnectionsSettings}; +import{s as e}from"./chunk-Bj-mKKzh.js";import{Bn as t,C as n,In as r,Ln as i,_i as a,hi as o,vi as s,vn as c,yi as l,zr as u}from"./src-CYrn1fYL.js";import{$o as d,Ft as f,Gs as p,Ho as m,Js as h,Ks as g,Ut as _,Vo as v,Ws as y,Xs as b,Yo as x,Ys as S,bc as C,ia as w,l as T,qs as E,st as D}from"./app-server-manager-signals-BOGyjFm3.js";import{n as O,t as k}from"./jsx-runtime-CiQ1k8xo.js";import{t as A}from"./clsx-BcPLHiun.js";import"./react-dom-CvzHKZGB.js";import"./Combination-9DfZp13g.js";import"./core.esm-D4TU2vSa.js";import"./marked.esm-BR-H6018.js";import{F as j,I as ee,P as M,_ as N,c as P,f as F,g as I,h as te,lt as L,n as ne,s as R}from"./vscode-api-sUstfl-x.js";import{c as z,o as B,r as V}from"./lib-MoKmYgcO.js";import"./known-app-icon-BEI7OXDu.js";import"./branch-CGmrzqEi.js";import"./github-mark-Dzuhu9C1.js";import"./google-drive-CC-Egn92.js";import"./notion-CpBap5Le.js";import{g as H,v as U}from"./persisted-signal-Cx1QgqJn.js";import"./rpc-y95ESgjb.js";import{o as re}from"./statsig-Cajk3UKk.js";import"./request-BXHjsnqU.js";import{o as ie}from"./app-server-manager-hooks-BJ2CaNwA.js";import{t as W}from"./use-global-state-DeR7WgiQ.js";import"./invalidate-queries-and-broadcast-dPfhRWCd.js";import"./thread-context-inputs-BUuWvrJW.js";import"./config-queries-BDIsZFnB.js";import{n as ae,t as G}from"./device-connections-CLAiuDco.js";import{r as K}from"./remote-connection-visibility-CDSfTp_2.js";import"./sidebar-signals-B0JkGccK.js";import"./use-is-copilot-api-available-4vxhZax2.js";import"./use-auth-DXLjX3T4.js";import"./_baseEach-BGrGeeUo.js";import"./_baseOrderBy-MeGLt7Sq.js";import"./codex-api-DRlZt5zW.js";import"./use-debounced-value-DkRRYvDv.js";import"./apps-queries-CBUjthvi.js";import"./startCase-JPkD4wck.js";import"./experimental-features-queries-D47v_uon.js";import"./use-is-dark-DM2fOM7F.js";import"./connector-logo-uEk_Q1Qc.js";import{r as q}from"./toast-signal-By11REe1.js";import"./window-zoom-context-CSPQZGcc.js";import{t as J}from"./tooltip-BhXPONlb.js";import"./route-scope-BCJTBhwV.js";import"./mention-item-DOPWFNx_.js";import{t as Y}from"./button-Xd4Hy1MO.js";import{a as oe,i as se}from"./setting-storage-Cel8Tr7E.js";import"./reduced-motion-preference-BEImGcUg.js";import{t as ce}from"./spinner-Dvc_A3Ae.js";import"./use-codex-home-zmo5hiIG.js";import"./os-info-_sbi_vi2.js";import"./use-os-info-COk5WlgW.js";import"./remote-projects-nghNpfPT.js";import"./proxy-DktXrBt_.js";import"./app-shell-state-B5MFb4Nm.js";import"./app-shell-D7yvB1FT.js";import"./apps-DBd5dYzG.js";import"./chats-K-296NKY.js";import{t as le}from"./x-DypUcSQe.js";import"./projectless-thread-SfYhUYuZ.js";import"./plugin-install-store-BWRSuKkC.js";import{t as ue}from"./use-platform-BkwBnkgx.js";import"./use-is-plugins-enabled-DudZfU21.js";import"./browser-sidebar-availability-BQYQqnR4.js";import"./use-plugins-BKOuT9XR.js";import"./check-circle-filled-CC_XQe30.js";import"./app-shell-tab-controller-B0DXekEJ.js";import"./browser-sidebar-manager-CDP80WMh.js";import{t as de}from"./terminal-CsU-mb2r.js";import{t as fe}from"./info-BV-snsxq.js";import"./error-boundary-CSKrv358.js";import"./download-TILfllSA.js";import{t as pe}from"./with-window-DPMmD2K-.js";import"./window-app-action-helpers-u9SI1RSH.js";import{g as me,h as he}from"./use-plugin-install-flow-C0YRtVkW.js";import{t as ge}from"./code-D-L4oeor.js";import"./folder-DTP6uOAM.js";import"./settings.cog-CJF3NOGk.js";import"./chrome-cKtIFTD3.js";import"./openai-blossom-DWhxKWUa.js";import{t as _e}from"./pencil-V3ApGyCb.js";import"./filesystem-media-src-DlToOKVI.js";import{t as ve}from"./copy-to-clipboard-q_KxH8lM.js";import"./use-register-command-UoA_Jn9F.js";import"./run-command-BkY8dgoH.js";import{r as ye}from"./modal-controller-state-CEBUx8JQ.js";import{a as X,d as be,i as xe,l as Se,n as Ce,r as we}from"./dialog-layout-CCvvb1Vc.js";import"./open-project-setup-dialog-DowmE55I.js";import"./local-projects-CzDObGPq.js";import"./use-skills-DK2PGa-B.js";import{t as Te}from"./check-md-CZTnvSiA.js";import"./chevron-right-BZtXyaBk.js";import"./use-stable-callback-B56R_Ee2.js";import"./context-menu-DRia187f.js";import"./plugin-config-edits-DJ9rwaYl.js";import"./plugin-prefill-prompt-Cs8725Fp.js";import"./plugins-availability-C9cwO-r4.js";import"./electron-menu-shortcuts-CGQ9azZA.js";import"./homepage-logo-C4Z1mn1w.js";import"./loading-page-Cq0CTe5D.js";import"./sortable.esm-gKrsSmfW.js";import"./use-resize-observer-CbHbkQNx.js";import"./command-keybindings-D3tvaSVG.js";import"./expand-CUW1I4XL.js";import"./keyboard-modifier-state-ZeRcF5hb.js";import"./arrow-left-2njf4k3d.js";import"./use-window-controls-safe-area-X2AodDul.js";import"./app-shell-bottom-panel-scroll-sync-DpO90Rtb.js";import"./codex-api-error-B3GqHcV_.js";import{t as Ee}from"./checkbox-Bz6PC7ig.js";import"./minus-COQFKeWQ.js";import"./plan-management-state-CAozl_mZ.js";import"./links-DlYWpuc5.js";import"./upgrade-plan-dialog-launcher-lIFGy25G.js";import"./check-circle-DfFD7ExP.js";import"./phone-nbCYRsC2.js";import"./badge-mYHx4F5K.js";import"./search-mcwajolX.js";import{r as De,t as Oe}from"./dropdown-CHaZfyxI.js";import"./globe-DyuVFbAy.js";import"./segmented-toggle-DWC6PQcj.js";import"./three-dots-CGeU8S03.js";import{t as ke}from"./trash-BX2WKfvO.js";import"./chevron-D6hquBJC.js";import{t as Ae}from"./use-app-server-connection-state-CF840jph.js";import{t as je}from"./format-relative-date-time-C5HIX1IA.js";import"./remote-host-globe-icon-BlkSn_h5.js";import"./cloud-DcUmucTG.js";import{t as Me}from"./macbook-CQYmUEtL.js";import"./worktree-BtgJtB2d.js";import"./thread-env-icon-vcKSxad2.js";import"./check-plugin-availability-C1II8bXB.js";import"./plugin-detail-queries-nEDuNCez.js";import{n as Ne,t as Pe}from"./app-server-connection-state-4EIwSVVr.js";import"./alert-DaPZJtct.js";import{t as Fe}from"./laptop-CSgm11ej.js";import"./use-codex-pricing-url-BucpTKgk.js";import{t as Ie}from"./log-out-DJTSj1t6.js";import{t as Le}from"./toggle-CHrq20xd.js";import"./lock-DV6CP31m.js";import"./arrow-top-right-D16Z5Bms.js";import"./connected-apps-Dck9Rcbz.js";import{t as Re}from"./regenerate-Co1G5oL3.js";import"./app-connect-oauth-Bb1UV73Z.js";import"./computer-use-app-approvals-query-CZtrSy1-.js";import"./hooks-settings-queries-BpMbCsRw.js";import{i as ze}from"./settings-shared-BibDzP9i.js";import{t as Be}from"./more-menu-trigger-C0YZNDUR.js";import{t as Ve}from"./large-empty-state-DkWdWX9Z.js";import"./thread-page-header-C6IOSyDb.js";import{t as He}from"./settings-content-layout-sdUwAG0A.js";import{t as Ue}from"./sun-B3vc3gaW.js";import{n as We}from"./settings-row-DOKTjAF6.js";import{n as Ge,t as Ke}from"./settings-group-BO3RZzLk.js";import"./local-remote-control-enabled-sync-5WdGwpTj.js";import{t as qe}from"./settings-empty-state-AHLxAQVX.js";import{a as Je,i as Ye,t as Xe}from"./codex-mobile-setup-dialog-DzxoAWgH.js";import"./chatgpt-token-auth.browser-BZtEK2Ww.js";import{a as Ze,c as Qe,i as $e,n as et,o as tt,r as nt,s as rt,t as it}from"./codex-mobile-setup-flow-BJuQbjBl.js";import"./use-home-directory-fhl-Q5x2.js";import"./cursor-6A42vq9G.js";import{r as at,t as ot}from"./onboarding-login-content-DhtcviP9.js";import{t as st}from"./tabs-ji6s-l3m.js";import{t as ct}from"./useForm-BCVfGGKu.js";var Z=e(O()),Q=k(),lt=e=>(0,Q.jsxs)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:77,height:23,fill:`currentColor`,viewBox:`0 0 77 23`,...e,children:[(0,Q.jsx)(`path`,{d:`M30.286 10.672a1.25 1.25 0 1 1 0 2.5 1.25 1.25 0 0 1 0-2.5Zm3.966 0a1.25 1.25 0 1 1 0 2.5 1.25 1.25 0 0 1 0-2.5Zm3.965 0a1.25 1.25 0 1 1-.001 2.5 1.25 1.25 0 0 1 0-2.5Z`,opacity:.4}),(0,Q.jsx)(`path`,{d:`M24.54 16.716H5.972v.804c0 .45.364.815.814.815h16.938c.45 0 .814-.365.814-.815v-.804Zm2 .804a2.815 2.815 0 0 1-2.815 2.815H6.787a2.815 2.815 0 0 1-2.814-2.815v-1.2c0-.886.718-1.604 1.604-1.604h19.357c.886 0 1.605.718 1.605 1.604v1.2Z`}),(0,Q.jsx)(`path`,{d:`M23.256 15.716v-9.5a1 1 0 0 0-1-1h-14a1 1 0 0 0-1 1v9.5a1 1 0 1 1-2 0v-9.5a3 3 0 0 1 3-3h14a3 3 0 0 1 3 3v9.5a1 1 0 0 1-2 0ZM71.027 14.5V6a1 1 0 0 0-1-1h-16a1 1 0 1 1 0-2h16a3 3 0 0 1 3 3v8.5a3 3 0 0 1-3 3h-5.98a1 1 0 0 1 0-2h5.98a1 1 0 0 0 1-1Z`}),(0,Q.jsx)(`path`,{d:`M67.527 19.5a1.5 1.5 0 0 1-1.5 1.5h-1.98a1 1 0 1 1 0-2h1.48v-2.5a1 1 0 0 1 2 0v3Zm-8.563-1.01h-15v.491a.5.5 0 0 0 .5.5h14a.5.5 0 0 0 .5-.5v-.491Zm2 .491a2.5 2.5 0 0 1-2.5 2.5h-14a2.5 2.5 0 0 1-2.5-2.5v-.991a1.5 1.5 0 0 1 1.5-1.5h16a1.5 1.5 0 0 1 1.5 1.5v.991Z`}),(0,Q.jsx)(`path`,{d:`M57.903 17.49V9.984a1 1 0 0 0-1-1H46.024a1 1 0 0 0-1 1v7.506a1 1 0 0 1-2 0V9.984a3 3 0 0 1 3-3h10.88a3 3 0 0 1 3 3v7.506a1 1 0 0 1-2 0Z`})]}),ut=e=>(0,Q.jsxs)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:66,height:24,fill:`currentColor`,viewBox:`0 0 66 24`,...e,children:[(0,Q.jsx)(`path`,{d:`M29.323 10.672a1.25 1.25 0 1 1 0 2.5 1.25 1.25 0 0 1 0-2.5Zm3.965 0a1.25 1.25 0 1 1 0 2.5 1.25 1.25 0 0 1 0-2.5Zm3.965 0a1.25 1.25 0 1 1 0 2.5 1.25 1.25 0 0 1 0-2.5Z`,opacity:.4}),(0,Q.jsx)(`path`,{d:`M23.576 16.715H5.009v.805c0 .45.365.814.815.814H22.76c.45 0 .814-.365.815-.814v-.805Zm2 .805a2.815 2.815 0 0 1-2.815 2.814H5.824a2.815 2.815 0 0 1-2.815-2.814v-1.2c0-.887.719-1.605 1.605-1.605H23.97c.886 0 1.606.718 1.606 1.604v1.2Z`}),(0,Q.jsx)(`path`,{d:`M22.293 15.715v-9.5a1 1 0 0 0-1-1h-14a1 1 0 0 0-1 1v9.5a1 1 0 1 1-2 0v-9.5a3 3 0 0 1 3-3h14a3 3 0 0 1 3 3v9.5a1 1 0 1 1-2 0Zm26.148-7.341a1.22 1.22 0 1 1-2.44 0 1.22 1.22 0 0 1 2.44 0Zm0 7.25a1.22 1.22 0 1 1-2.44 0 1.22 1.22 0 0 1 2.44 0Z`}),(0,Q.jsx)(`path`,{d:`M61.036 6.75c0-.524-.446-1-1.063-1H45.02c-.616 0-1.062.476-1.062 1V11h17.078V6.75Zm2 6.25H41.958V6.75c0-1.686 1.4-3 3.062-3h14.953c1.663 0 3.063 1.314 3.063 3V13Z`}),(0,Q.jsx)(`path`,{d:`M61.036 13H43.958v4.25c0 .523.446 1 1.062 1h14.953c.617 0 1.063-.477 1.063-1V13Zm2 4.25c0 1.685-1.4 3-3.063 3H45.02c-1.662 0-3.062-1.315-3.062-3V11h21.078v6.25Z`})]}),$=L(),dt=e=>(0,Q.jsxs)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:61,height:23,fill:`currentColor`,viewBox:`0 0 61 23`,...e,children:[(0,Q.jsx)(`path`,{d:`M15.01 5.012a1 1 0 0 0-1-1h-8a1 1 0 0 0-1 1v13.5a1 1 0 0 0 1 1h8a1 1 0 0 0 1-1v-13.5Zm40.8 11.706H37.245v.803c0 .45.364.815.814.815h16.937c.45 0 .815-.365.815-.814v-.804Zm-43.802-.456a1 1 0 1 1 0 2h-4a1 1 0 1 1 0-2h4Zm42.52-10.044a1 1 0 0 0-1-1h-14a1 1 0 0 0-1 1v8.5h16v-8.5Zm2 8.531c.732.15 1.283.797 1.283 1.573v1.2a2.815 2.815 0 0 1-2.815 2.814H38.059a2.814 2.814 0 0 1-2.814-2.814v-1.2c0-.776.55-1.424 1.283-1.573V6.218a3 3 0 0 1 3-3h14a3 3 0 0 1 3 3v8.531Zm-39.519 3.763a3 3 0 0 1-3 3h-8a3 3 0 0 1-3-3v-13.5a3 3 0 0 1 3-3h8a3 3 0 0 1 3 3v13.5Z`}),(0,Q.jsx)(`path`,{d:`M22.26 10.672a1.25 1.25 0 1 1-.001 2.5 1.25 1.25 0 0 1 0-2.5Zm3.965 0a1.25 1.25 0 1 1 0 2.5 1.25 1.25 0 0 1 0-2.5Zm3.965 0a1.25 1.25 0 1 1 0 2.5 1.25 1.25 0 0 1 0-2.5Z`,opacity:.4})]});function ft(e){let t=(0,$.c)(2),{onClose:n}=e,r;return t[0]===n?r=t[1]:(r=(0,Q.jsx)(it,{onClose:n,variant:`dialog`}),t[0]=n,t[1]=r),r}var pt=e=>(0,Q.jsx)(`svg`,{width:20,height:20,viewBox:`0 0 19.3131 15.4971`,fill:`none`,xmlns:`http://www.w3.org/2000/svg`,...e,children:(0,Q.jsx)(`path`,{d:`M13.5748 3.99805C13.5748 3.40409 13.5741 2.9985 13.5485 2.68457C13.5297 2.45518 13.4999 2.30738 13.4616 2.2002L13.4205 2.10449C13.3015 1.87093 13.1203 1.67534 12.8981 1.53906L12.8004 1.48438C12.687 1.42659 12.5265 1.38146 12.2204 1.35645C11.9064 1.33082 11.5008 1.33008 10.9069 1.33008H8.40687C7.81256 1.33008 7.40645 1.3308 7.09242 1.35645C6.86284 1.37521 6.71525 1.40501 6.60805 1.44336L6.51234 1.48438C6.27892 1.60334 6.08414 1.78476 5.94789 2.00684L5.8932 2.10449C5.83539 2.21795 5.78932 2.3783 5.7643 2.68457C5.73867 2.9985 5.73793 3.4041 5.73793 3.99805V11.498C5.73793 12.0924 5.73864 12.4985 5.7643 12.8125C5.78932 13.1188 5.83539 13.2791 5.8932 13.3926L5.94789 13.4902C6.08408 13.7121 6.27912 13.8928 6.51234 14.0117L6.60805 14.0527C6.71527 14.0911 6.86269 14.1219 7.09242 14.1406C7.40645 14.1663 7.81258 14.167 8.40687 14.167H10.9069C11.5008 14.167 11.9064 14.1663 12.2204 14.1406C12.5266 14.1156 12.687 14.0695 12.8004 14.0117L12.8981 13.957C13.1202 13.8208 13.3016 13.626 13.4205 13.3926L13.4616 13.2969C13.4999 13.1897 13.5297 13.0421 13.5485 12.8125C13.5741 12.4985 13.5748 12.0924 13.5748 11.498V3.99805ZM1.29945 3.5C1.53086 3.29514 1.88139 3.27416 2.13832 3.4668C2.43209 3.68713 2.49236 4.10365 2.27211 4.39746L1.44594 5.49805C1.35163 5.6241 1.34344 5.79468 1.42445 5.92969L1.985 6.86426L2.04262 6.96778C2.29256 7.45758 2.29238 8.03845 2.04262 8.52832L1.985 8.63184L1.38539 9.63184C1.31174 9.75459 1.31174 9.9085 1.38539 10.0313L2.31019 11.5732L2.36781 11.6943C2.47071 11.9861 2.35733 12.32 2.08168 12.4854C1.80607 12.6506 1.45866 12.5933 1.24965 12.3652L1.16957 12.2568L0.244764 10.7158C-0.0815946 10.1719 -0.0815817 9.49218 0.244764 8.94824L0.844374 7.94824L0.886366 7.85059C0.90467 7.78355 0.904788 7.71253 0.886366 7.64551L0.844374 7.54883L0.283827 6.61426C-0.0754302 6.0155 -0.0364043 5.25886 0.38246 4.7002L1.20766 3.59961L1.29945 3.5ZM17.2311 3.42774C17.5066 3.2626 17.8541 3.32006 18.0631 3.54785L18.1432 3.65625L19.0289 5.13281L19.0924 5.24707C19.3631 5.78714 19.3297 6.43123 19.0045 6.94043L18.9303 7.04688L18.5299 7.58106C18.4355 7.70702 18.4266 7.87761 18.5075 8.0127L19.068 8.94824L19.1256 9.05176C19.3755 9.54172 19.3757 10.1224 19.1256 10.6123L19.068 10.7158L18.1432 12.2568C17.9543 12.5717 17.546 12.6743 17.2311 12.4854C16.9163 12.2965 16.8139 11.8881 17.0026 11.5732L17.9284 10.0313L17.9694 9.93457C17.9878 9.86749 17.9877 9.7966 17.9694 9.72949L17.9284 9.63184L17.3668 8.69727C17.0077 8.09854 17.0467 7.3418 17.4655 6.78321L17.8668 6.24903L17.8981 6.2002C17.953 6.0981 17.9588 5.97637 17.9147 5.86914L17.8883 5.81739L17.0026 4.34082L16.9459 4.21875C16.8431 3.92696 16.9555 3.59311 17.2311 3.42774ZM10.4899 2.69434C10.8571 2.69436 11.1549 2.99212 11.1549 3.35938C11.1547 3.72643 10.857 4.02439 10.4899 4.02442H8.82289C8.45589 4.02427 8.15809 3.72635 8.15785 3.35938C8.15785 2.9922 8.45575 2.69449 8.82289 2.69434H10.4899ZM14.9049 11.498C14.9049 12.0705 14.9058 12.5401 14.8746 12.9209C14.8469 13.2608 14.7905 13.5744 14.6637 13.8701L14.6051 13.9961C14.3746 14.4485 14.0239 14.8268 13.5934 15.0908L13.4039 15.1973C13.0718 15.3664 12.7172 15.4341 12.3287 15.4658C11.9481 15.4969 11.479 15.4971 10.9069 15.4971H8.40687C7.83446 15.4971 7.36478 15.4969 6.98402 15.4658C6.64417 15.4381 6.33043 15.3826 6.0348 15.2559L5.90883 15.1973C5.45643 14.9668 5.07816 14.6159 4.8141 14.1855L4.70765 13.9961C4.53841 13.6639 4.47085 13.3094 4.4391 12.9209C4.40799 12.5401 4.40785 12.0705 4.40785 11.498V3.99805C4.40785 3.42591 4.40802 2.95682 4.4391 2.57617C4.47084 2.18776 4.5385 1.83309 4.70765 1.50098L4.8141 1.31153C5.07815 0.881047 5.45638 0.530355 5.90883 0.299807L6.0348 0.241213C6.33047 0.114425 6.64412 0.0580467 6.98402 0.0302756C7.36478 -0.000831299 7.83447 2.15602e-06 8.40687 2.15602e-06H10.9069C11.479 1.93302e-06 11.9481 -0.000805488 12.3287 0.0302756C12.7172 0.0620151 13.0718 0.130593 13.4039 0.299807L13.5934 0.405276C14.024 0.669346 14.3745 1.04841 14.6051 1.50098L14.6637 1.62598C14.7907 1.92182 14.8469 2.23605 14.8746 2.57617C14.9057 2.95681 14.9049 3.42594 14.9049 3.99805V11.498Z`,fill:`currentColor`})});function mt(e){switch(e.device_type){case`phone`:return(0,Q.jsx)(pt,{className:`icon-sm`});case`laptop`:return(0,Q.jsx)(Me,{className:`icon-sm`});case`desktop`:return(0,Q.jsx)(Fe,{className:`icon-sm`});case null:case void 0:default:return(0,Q.jsx)(Fe,{className:`icon-sm`})}}function ht(e){switch(e.clientType){case`CODEX_CLI`:return(0,Q.jsx)(de,{className:`icon-sm`});case`CODEX_DESKTOP_APP`:return(0,Q.jsx)(Fe,{className:`icon-sm`});case`CODEX_IDE_VSCODE`:case`CODEX_IDE_XCODE`:case`CODEX_IDE_JETBRAINS`:return(0,Q.jsx)(ge,{className:`icon-sm`});case`CODEX_UNKNOWN`:return(0,Q.jsx)(Fe,{className:`icon-sm`})}}var gt=`remote-control-client-revoke-success`,_t=`remote-control-client-revoke-error`,vt=`[remote-connections/settings]`;function yt(){let e=(0,$.c)(2),{data:t,isLoading:n}=W(u.CODEX_MOBILE_SETUP_COMPLETED);if(n)return null;if(!t){let t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,Q.jsx)(xt,{mode:`setup`}),e[0]=t):t=e[0],t}let r;return e[1]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(xt,{mode:`manage`}),(0,Q.jsx)(bt,{})]}),e[1]=r):r=e[1],r}function bt(){let e=(0,$.c)(35),t=j(te),r=z(),{platform:i}=ue(),a=oe(n.keepRemoteControlAwakeWhilePluggedIn),o=M(_,m),s;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(s={hostId:m},e[0]=s):s=e[0];let c=et(s),l;e[1]!==r||e[2]!==t||e[3]!==c?(l=e=>{H(t,{eventName:`codex_remote_control_host_toggle_clicked`,metadata:{enabled:e}}),c.mutate(e,{onError:()=>{t.get(q).danger(r.formatMessage({id:`settings.remoteConnections.localHost.remoteControlUpdateError`,defaultMessage:`Couldn’t update remote control availability`,description:`Toast shown when enabling or disabling local remote control fails`}))}})},e[1]=r,e[2]=t,e[3]=c,e[4]=l):l=e[4];let u=l,d;e[5]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,Q.jsx)(Ke.Header,{title:(0,Q.jsx)(B,{id:`settings.remoteConnections.localHost.otherSettings.title`,defaultMessage:`Other settings`,description:`Header title for additional local remote control settings`})}),e[5]=d):d=e[5];let f,p,h;e[6]===Symbol.for(`react.memo_cache_sentinel`)?(f=(0,Q.jsx)(Je,{className:`icon-sm`}),p=(0,Q.jsx)(B,{id:`settings.remoteConnections.localHost.remoteControl.label`,defaultMessage:`Allow this device to be discovered and controlled`,description:`Label for allowing remote control on this device`}),h=(0,Q.jsx)(B,{id:`settings.remoteConnections.localHost.remoteControl.description`,defaultMessage:`Authorized devices on your ChatGPT account can discover and control this device`,description:`Description for allowing remote control on this device`}),e[6]=f,e[7]=p,e[8]=h):(f=e[6],p=e[7],h=e[8]);let g=c.isPending,v;e[9]===r?v=e[10]:(v=r.formatMessage({id:`settings.remoteConnections.localHost.remoteControl.label`,defaultMessage:`Allow this device to be discovered and controlled`,description:`Label for allowing remote control on this device`}),e[9]=r,e[10]=v);let y;e[11]!==u||e[12]!==o||e[13]!==c.isPending||e[14]!==v?(y=(0,Q.jsx)(We,{icon:f,label:p,description:h,control:(0,Q.jsx)(Le,{checked:o,disabled:g,onChange:u,ariaLabel:v})}),e[11]=u,e[12]=o,e[13]=c.isPending,e[14]=v,e[15]=y):y=e[15];let b;e[16]===Symbol.for(`react.memo_cache_sentinel`)?(b=(0,Q.jsx)(Ue,{className:`icon-sm`}),e[16]=b):b=e[16];let x;e[17]===i?x=e[18]:(x=i===`windows`?(0,Q.jsx)(B,{...Dt.keepLiveWindowsLabel}):(0,Q.jsx)(B,{...Dt.keepLiveMacLabel}),e[17]=i,e[18]=x);let S;e[19]===Symbol.for(`react.memo_cache_sentinel`)?(S=(0,Q.jsx)(B,{id:`settings.remoteConnections.localHost.keepLive.description`,defaultMessage:`Prevent sleep when computer is plugged in and remote access is enabled`,description:`Description for keeping the local computer awake`}),e[19]=S):S=e[19];let C=a??!1,w;e[20]===t?w=e[21]:(w=e=>{se(t,n.keepRemoteControlAwakeWhilePluggedIn,e)},e[20]=t,e[21]=w);let T;e[22]!==r||e[23]!==i?(T=i===`windows`?r.formatMessage(Dt.keepLiveWindowsLabel):r.formatMessage(Dt.keepLiveMacLabel),e[22]=r,e[23]=i,e[24]=T):T=e[24];let E;e[25]!==C||e[26]!==w||e[27]!==T?(E=(0,Q.jsx)(Le,{checked:C,onChange:w,ariaLabel:T}),e[25]=C,e[26]=w,e[27]=T,e[28]=E):E=e[28];let D;e[29]!==x||e[30]!==E?(D=(0,Q.jsx)(We,{icon:b,label:x,description:S,control:E}),e[29]=x,e[30]=E,e[31]=D):D=e[31];let O;return e[32]!==D||e[33]!==y?(O=(0,Q.jsxs)(Ke,{children:[d,(0,Q.jsx)(Ke.Content,{children:(0,Q.jsxs)(Ge,{children:[y,D]})})]}),e[32]=D,e[33]=y,e[34]=O):O=e[34],O}function xt(e){let t=(0,$.c)(81),{mode:n}=e,r=j(te),i=z(),{platform:a}=ue(),[o,s]=(0,Z.useState)(null),[c,l]=(0,Z.useState)(null),[u]=v(`local_remote_control_client_id`),d=ee(nt),f=o===`waiting`,p;t[0]!==c||t[1]!==u||t[2]!==f?(p={existingClientIds:c,localRemoteControlClientId:u,waiting:f},t[0]=c,t[1]=u,t[2]=f,t[3]=p):p=t[3];let m=tt(M($e,p).data,u),h=o===`waiting`&&c!=null?Ze(m,c):null,g=h===`connected`?`connected`:h===`dismiss`?null:o,_;t[4]===r.query?_=t[5]:(_=r.query.snapshot(nt),t[4]=r.query,t[5]=_);let y=_,b;t[6]!==i||t[7]!==y||t[8]!==r?(b=(e,t)=>{let{clientId:n}=t;H(r,{eventName:`codex_remote_control_client_revoke_result`,metadata:{result:`succeeded`}}),y.setData(e=>e?.filter(e=>e.client_id!==n)),y.invalidate(),r.get(q).success(i.formatMessage({id:`settings.remoteConnections.remoteControlClients.revoke.success`,defaultMessage:`Revoked device access`,description:`Toast shown when access for a remote control client is revoked`}),{id:gt})},t[6]=i,t[7]=y,t[8]=r,t[9]=b):b=t[9];let x;t[10]!==i||t[11]!==r?(x=(e,t)=>{let{clientId:n}=t;H(r,{eventName:`codex_remote_control_client_revoke_result`,metadata:{result:`failed`}}),I.warning(`${vt} remote_control_client_revoke_failed`,{safe:{},sensitive:{clientId:n,error:e}}),r.get(q).danger(i.formatMessage({id:`settings.remoteConnections.remoteControlClients.revoke.error`,defaultMessage:`Failed to revoke device access`,description:`Toast shown when access for a remote control client cannot be revoked`}),{id:_t})},t[10]=i,t[11]=r,t[12]=x):x=t[12];let S;t[13]!==b||t[14]!==x?(S={mutationFn:Qe,onSuccess:b,onError:x},t[13]=b,t[14]=x,t[15]=S):S=t[15];let C=N(S),w;t[16]!==u||t[17]!==d.data?(w=tt(d.data,u),t[16]=u,t[17]=d.data,t[18]=w):w=t[18];let T=w,E=T?.length,D=d.error instanceof rt,O,k;t[19]!==n||t[20]!==E||t[21]!==d.isLoading||t[22]!==r?(O=()=>{n!==`manage`||d.isLoading||E==null||H(r,{eventName:`codex_remote_control_client_inventory_loaded`,metadata:{client_count:E}})},k=[n,E,d.isLoading,r],t[19]=n,t[20]=E,t[21]=d.isLoading,t[22]=r,t[23]=O,t[24]=k):(O=t[23],k=t[24]),(0,Z.useEffect)(O,k);let A=C.isPending?C.variables?.clientId:null,P;t[25]!==n||t[26]!==E||t[27]!==T||t[28]!==r?(P=()=>{if(H(r,{eventName:`codex_remote_control_add_device_started`,metadata:{existing_client_count:E??0,source:n}}),n===`setup`){ye(r,ft);return}l(new Set(T?.map(wt))),s(`waiting`)},t[25]=n,t[26]=E,t[27]=T,t[28]=r,t[29]=P):P=t[29];let F=P,L;t[30]===y?L=t[31]:(L=()=>{s(null),l(null),y.invalidate()},t[30]=y,t[31]=L);let ne=L,R=(T?.length??0)>0,V;t[32]===a?V=t[33]:(V=a===`windows`?(0,Q.jsx)(B,{id:`settings.remoteConnections.remoteControlClients.devices.title.windows`,defaultMessage:`Devices that can control this PC`,description:`Header title for devices that can control this Windows device`}):(0,Q.jsx)(B,{id:`settings.remoteConnections.remoteControlClients.devices.title`,defaultMessage:`Devices that can control this Mac`,description:`Header title for devices that can control this Mac`}),t[32]=a,t[33]=V);let U;t[34]!==F||t[35]!==R||t[36]!==n||t[37]!==d.isLoading?(U=n===`manage`&&R?(0,Q.jsx)(Y,{color:`secondary`,disabled:d.isLoading,onClick:F,children:(0,Q.jsx)(B,{id:`settings.remoteConnections.add.short`,defaultMessage:`Add`,description:`Button label for adding a connection from a connections settings tab`})}):null,t[34]=F,t[35]=R,t[36]=n,t[37]=d.isLoading,t[38]=U):U=t[38];let re;t[39]!==V||t[40]!==U?(re=(0,Q.jsx)(Ke.Header,{title:V,actions:U}),t[39]=V,t[40]=U,t[41]=re):re=t[41];let ie;t[42]!==F||t[43]!==n||t[44]!==a?(ie=n===`setup`?(0,Q.jsx)(Ve,{spacing:`compact`,title:null,description:a===`windows`?(0,Q.jsx)(B,{id:`settings.remoteConnections.remoteControlClients.setup.description.windows`,defaultMessage:`Control this PC from your phone or other device`,description:`Description shown before local remote control setup has started on Windows`}):(0,Q.jsx)(B,{id:`settings.remoteConnections.remoteControlClients.setup.description`,defaultMessage:`Control this Mac from your phone or other device`,description:`Description shown before local remote control setup has started`}),illustration:(0,Q.jsx)(dt,{className:`h-6 w-auto text-token-text-primary`}),actions:(0,Q.jsx)(Y,{color:`secondary`,onClick:F,children:(0,Q.jsx)(B,{id:`settings.remoteConnections.remoteControlClients.setup.action`,defaultMessage:`Set up`,description:`Button label to start local remote control setup`})})}):null,t[42]=F,t[43]=n,t[44]=a,t[45]=ie):ie=t[45];let W;t[46]!==n||t[47]!==d.isLoading?(W=n===`manage`&&d.isLoading&&(0,Q.jsxs)(`div`,{className:`flex min-h-[62px] items-center justify-center gap-2 px-4 text-sm text-token-text-secondary`,children:[(0,Q.jsx)(ce,{className:`icon-xs`}),(0,Q.jsx)(B,{id:`settings.remoteConnections.remoteControlClients.loading`,defaultMessage:`Loading device list`,description:`Loading message for devices that can control the local computer`})]}),t[46]=n,t[47]=d.isLoading,t[48]=W):W=t[48];let ae;t[49]!==n||t[50]!==D||t[51]!==d.isError||t[52]!==d.isFetching||t[53]!==r?(ae=n===`manage`&&d.isError?(0,Q.jsx)(Ve,{spacing:`compact`,title:(0,Q.jsx)(B,{id:`settings.remoteConnections.remoteControlClients.loadError.title`,defaultMessage:`Couldn’t load device list`,description:`Error title shown when devices that can control the local computer fail to load`}),description:D?(0,Q.jsx)(B,{id:`settings.remoteConnections.remoteControlClients.loadError.authRequired`,defaultMessage:`Sign in to ChatGPT again, then retry`,description:`Error message shown when loading remote control clients requires renewed ChatGPT authentication`}):(0,Q.jsx)(B,{id:`settings.remoteConnections.remoteControlClients.loadError.generic`,defaultMessage:`Retry to load devices that can control this computer`,description:`Error message shown when devices that can control the local computer fail to load`}),actions:(0,Q.jsx)(Y,{color:`secondary`,disabled:d.isFetching,onClick:()=>{r.get(nt).refetch()},children:(0,Q.jsx)(B,{id:`settings.remoteConnections.remoteControlClients.loadError.retry`,defaultMessage:`Retry`,description:`Button label to retry loading remote control clients`})})}):null,t[49]=n,t[50]=D,t[51]=d.isError,t[52]=d.isFetching,t[53]=r,t[54]=ae):ae=t[54];let G;t[55]!==F||t[56]!==n||t[57]!==a||t[58]!==T?.length||t[59]!==d.isError||t[60]!==d.isLoading?(G=n===`manage`&&!d.isLoading&&!d.isError&&T?.length===0&&(0,Q.jsx)(Ve,{spacing:`compact`,title:null,description:a===`windows`?(0,Q.jsx)(B,{id:`settings.remoteConnections.remoteControlClients.empty.windows`,defaultMessage:`Add device to control this PC remotely`,description:`Empty state for devices that can control the local Windows device`}):(0,Q.jsx)(B,{id:`settings.remoteConnections.remoteControlClients.empty`,defaultMessage:`Add device to control this Mac remotely`,description:`Empty state for devices that can control the local computer`}),illustration:(0,Q.jsx)(dt,{className:`h-6 w-auto text-token-text-primary`}),actions:(0,Q.jsx)(Y,{color:`secondary`,onClick:F,children:(0,Q.jsx)(B,{id:`settings.remoteConnections.add.short`,defaultMessage:`Add`,description:`Button label for adding a connection from a connections settings tab`})})}),t[55]=F,t[56]=n,t[57]=a,t[58]=T?.length,t[59]=d.isError,t[60]=d.isLoading,t[61]=G):G=t[61];let K;t[62]!==n||t[63]!==T||t[64]!==d.isError||t[65]!==C||t[66]!==A?(K=n===`manage`&&!d.isError?T?.map(e=>(0,Q.jsx)(We,{icon:mt(e),label:Tt(e),description:Et(e),control:(0,Q.jsx)(Y,{color:`secondary`,disabled:C.isPending,loading:A===e.client_id,onClick:()=>{C.mutate({clientId:e.client_id})},children:(0,Q.jsx)(B,{id:`settings.remoteConnections.remoteControlClients.revoke`,defaultMessage:`Revoke access`,description:`Button label that revokes access for a remote control client`})})},e.client_id)):null,t[62]=n,t[63]=T,t[64]=d.isError,t[65]=C,t[66]=A,t[67]=K):K=t[67];let J;t[68]!==ie||t[69]!==W||t[70]!==ae||t[71]!==G||t[72]!==K?(J=(0,Q.jsx)(Ke.Content,{children:(0,Q.jsxs)(Ge,{children:[ie,W,ae,G,K]})}),t[68]=ie,t[69]=W,t[70]=ae,t[71]=G,t[72]=K,t[73]=J):J=t[73];let oe;t[74]!==ne||t[75]!==g?(oe=g==null?null:(0,Q.jsx)(Xe,{open:!0,showStartSetupError:!1,setupInProgress:!1,step:g,onAllowHost:Ct,onOpenChange:e=>{e||ne()},onSkip:ne,onStartSetup:St}),t[74]=ne,t[75]=g,t[76]=oe):oe=t[76];let se;return t[77]!==re||t[78]!==J||t[79]!==oe?(se=(0,Q.jsxs)(Ke,{children:[re,J,oe]}),t[77]=re,t[78]=J,t[79]=oe,t[80]=se):se=t[80],se}function St(){}function Ct(){}function wt(e){return e.client_id}function Tt(e){return e.display_name??e.device_model??e.platform??e.client_id}function Et(e){return e.last_seen_at==null?(0,Q.jsx)(B,{id:`settings.remoteConnections.remoteControlClients.authorized`,defaultMessage:`Authorized device`,description:`Description for an authorized device that can control this computer`}):(0,Q.jsx)(B,{id:`settings.remoteConnections.remoteControlClients.lastSeen`,defaultMessage:`Last connected {date}`,description:`Description for when a device that can control this computer was last seen`,values:{date:(0,Q.jsx)(je,{dateString:e.last_seen_at},`last-seen-at`)}})}var Dt=V({keepLiveMacLabel:{id:`settings.remoteConnections.localHost.keepLive.label`,defaultMessage:`Keep this Mac awake`,description:`Label for keeping the local Mac awake`},keepLiveWindowsLabel:{id:`settings.remoteConnections.localHost.keepLive.label.windows`,defaultMessage:`Keep this PC awake`,description:`Label for keeping the local Windows device awake`}}),Ot=`[remote-connections/auth]`;function kt({hostId:e,open:t,onOpenChange:n}){let r=j(te),i=z(),[a,o]=(0,Z.useState)(null),[s,l]=(0,Z.useState)(``),[u,d]=(0,Z.useState)(!1),[f,p]=(0,Z.useState)(!1),m=a!=null,h=()=>{o(null),l(``),d(!1),p(!1)},g=({abortPendingLogin:e})=>{e&&a?.abort(),h(),n(!1)},_=e=>{r.get(q).warning(i.formatMessage({id:`settings.remoteConnections.auth.error`,defaultMessage:`Sign-in failed: {message}`,description:`Toast shown when remote connection authentication fails`},{message:c(e)}))},v=async()=>{if(e==null){_(`Remote connection manager is unavailable.`);return}if(m){a?.abort(),o(null);return}let t=new AbortController;o(t);try{let{authUrl:n,completion:r}=await at({hostId:e,signal:t.signal});F.dispatchMessage(`open-in-browser`,{url:n,useExternalBrowser:!0,useExternalBrowser:!0,useExternalBrowser:!0,useExternalBrowser:!0,useExternalBrowser:!0,useExternalBrowser:!0});let i=await r;if(!i.success){I.warning(`${Ot} chatgpt_sign_in_failed`,{safe:{},sensitive:{hostId:e,error:i.error??`Unknown error`}}),_(i.error??`Unknown error`);return}g({abortPendingLogin:!1})}catch(t){if(t?.name===`AbortError`)return;I.warning(`${Ot} chatgpt_sign_in_failed`,{safe:{},sensitive:{error:t,hostId:e}}),_(t)}finally{o(null)}},y=async()=>{if(e==null){_(`Remote connection manager is unavailable.`);return}let t=s.trim();if(!(!t||f)){p(!0);try{await C(`login-with-api-key-for-host`,{hostId:e,apiKey:t}),g({abortPendingLogin:!1})}catch(t){I.warning(`${Ot} api_key_sign_in_failed`,{safe:{},sensitive:{error:t,hostId:e}}),_(t)}finally{p(!1)}}};return(0,Q.jsx)(Se,{open:t,onOpenChange:e=>{if(!e){g({abortPendingLogin:!0});return}n(!0)},contentProps:{"aria-describedby":void 0},showDialogClose:!1,size:`compact`,children:(0,Q.jsxs)(Ce,{children:[(0,Q.jsx)(be,{className:`sr-only`,children:i.formatMessage({id:`settings.remoteConnections.auth.title`,defaultMessage:`Login required`,description:`Title for the remote connection login dialog`})}),(0,Q.jsx)(X,{children:(0,Q.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[(0,Q.jsx)(xe,{className:`min-w-0 flex-1`,title:(0,Q.jsx)(B,{id:`settings.remoteConnections.auth.title`,defaultMessage:`Login required`,description:`Title for the remote connection login dialog`}),subtitle:(0,Q.jsx)(B,{id:`settings.remoteConnections.auth.description`,defaultMessage:`Authenticate this remote Codex connection to continue.`,description:`Description for the remote connection login dialog`})}),(0,Q.jsx)(Y,{"aria-label":i.formatMessage({id:`settings.remoteConnections.auth.closeIcon`,defaultMessage:`Close`,description:`Accessible label for the remote connection login dialog close button`}),className:`-mt-1 -mr-1 shrink-0`,color:`ghost`,size:`icon`,onClick:()=>g({abortPendingLogin:!0}),children:(0,Q.jsx)(le,{className:`icon-xs`})})]})}),(0,Q.jsx)(X,{children:(0,Q.jsx)(`div`,{className:`flex justify-center pt-2`,children:(0,Q.jsx)(ot,{apiKeyValue:s,isApiKeyEntryVisible:u,isApiKeySignInPending:f,isChatGptSignInPending:m,onApiKeySecondaryAction:()=>{l(``),d(!1)},onApiKeySubmit:y,onApiKeyValueChange:l,onChatGptSignIn:v,onShowApiKeyEntry:()=>d(!0),apiKeySecondaryActionLabel:(0,Q.jsx)(B,{id:`settings.remoteConnections.auth.back`,defaultMessage:`Back`,description:`Back button in the remote connection login dialog`})})})}),(0,Q.jsx)(X,{children:(0,Q.jsx)(we,{children:(0,Q.jsx)(Y,{color:`ghost`,type:`button`,onClick:()=>g({abortPendingLogin:!0}),children:(0,Q.jsx)(B,{id:`settings.remoteConnections.auth.close`,defaultMessage:`Close`,description:`Close button for the remote connection login dialog`})})})})]})})}function At(e){let t=(0,$.c)(19),{emptyState:n,footer:r,list:i,open:a,title:o,onOpenChange:s,onSubmit:c}=e,l;t[0]===o?l=t[1]:(l=(0,Q.jsx)(X,{children:(0,Q.jsx)(xe,{title:o})}),t[0]=o,t[1]=l);let u=i==null?`h-full`:`max-h-full overflow-y-auto`,d;t[2]!==n||t[3]!==i?(d=i??(0,Q.jsx)(`div`,{className:`flex h-full items-center justify-center px-4 text-sm text-token-text-tertiary`,children:n}),t[2]=n,t[3]=i,t[4]=d):d=t[4];let f;t[5]!==u||t[6]!==d?(f=(0,Q.jsx)(X,{className:`pt-6`,children:(0,Q.jsx)(`div`,{className:`h-[300px]`,children:(0,Q.jsx)(Ge,{className:u,children:d})})}),t[5]=u,t[6]=d,t[7]=f):f=t[7];let p;t[8]===r?p=t[9]:(p=(0,Q.jsx)(X,{className:`pt-6`,children:r}),t[8]=r,t[9]=p);let m;t[10]!==c||t[11]!==l||t[12]!==f||t[13]!==p?(m=(0,Q.jsxs)(Ce,{as:`form`,onSubmit:c,children:[l,f,p]}),t[10]=c,t[11]=l,t[12]=f,t[13]=p,t[14]=m):m=t[14];let h;return t[15]!==s||t[16]!==a||t[17]!==m?(h=(0,Q.jsx)(Se,{open:a,onOpenChange:s,children:m}),t[15]=s,t[16]=a,t[17]=m,t[18]=h):h=t[18],h}function jt(e){let t=(0,$.c)(34),{connections:n,isSaving:r,open:i,refreshing:a,onAddManually:o,onOpenChange:s,onRefresh:c,onSave:l,onToggleConnection:u,selectedHostIds:d}=e,f=z(),p;t[0]===l?p=t[1]:(p=e=>{e.preventDefault(),l()},t[0]=l,t[1]=p);let m=p,h;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(h=(0,Q.jsx)(B,{id:`settings.remoteConnections.discoveryDialog.empty`,defaultMessage:`No SSH connections found`,description:`Empty state shown when no discovered SSH connections are available`}),t[2]=h):h=t[2];let g;t[3]===f?g=t[4]:(g=f.formatMessage({id:`settings.remoteConnections.discoveryDialog.refresh`,defaultMessage:`Refresh`,description:`Accessible label for refreshing discovered SSH connections in the add SSH connection dialog`}),t[3]=f,t[4]=g);let _=a||r,v;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(v=(0,Q.jsx)(Re,{className:`icon-sm`}),t[5]=v):v=t[5];let y;t[6]!==c||t[7]!==a||t[8]!==g||t[9]!==_?(y=(0,Q.jsx)(Y,{"aria-label":g,color:`ghost`,size:`icon`,disabled:_,loading:a,onClick:c,children:v}),t[6]=c,t[7]=a,t[8]=g,t[9]=_,t[10]=y):y=t[10];let b;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(b=(0,Q.jsx)(B,{id:`settings.remoteConnections.discoveryDialog.addManually`,defaultMessage:`Add manually`,description:`Button label for switching from discovered SSH connections to manual entry`}),t[11]=b):b=t[11];let x;t[12]===o?x=t[13]:(x=(0,Q.jsx)(`button`,{type:`button`,className:`min-w-0 flex-1 cursor-interaction text-left text-sm text-token-text-primary`,onClick:o,children:b}),t[12]=o,t[13]=x);let S=n.length===0||r,C;t[14]===Symbol.for(`react.memo_cache_sentinel`)?(C=(0,Q.jsx)(B,{id:`settings.remoteConnections.discoveryDialog.save`,defaultMessage:`Add`,description:`Primary action that adds selected discovered SSH connections`}),t[14]=C):C=t[14];let w;t[15]===S?w=t[16]:(w=(0,Q.jsx)(Y,{type:`submit`,size:`large`,disabled:S,children:C}),t[15]=S,t[16]=w);let T;t[17]!==w||t[18]!==y||t[19]!==x?(T=(0,Q.jsxs)(`div`,{className:`flex items-center gap-3`,children:[y,x,w]}),t[17]=w,t[18]=y,t[19]=x,t[20]=T):T=t[20];let E;t[21]!==n||t[22]!==f||t[23]!==r||t[24]!==u||t[25]!==d?(E=n.length===0?null:n.map(e=>{let t=e.sshAlias?.trim()||e.displayName,n=d.includes(e.hostId);return(0,Q.jsx)(`div`,{"aria-disabled":r,className:r?`cursor-not-allowed`:`cursor-interaction`,onClick:r?void 0:()=>{u(e.hostId)},onKeyDown:r?void 0:t=>{t.key!==`Enter`&&t.key!==` `||(t.preventDefault(),u(e.hostId))},role:`button`,tabIndex:r?-1:0,children:(0,Q.jsx)(We,{icon:(0,Q.jsx)(Fe,{className:`icon-sm`}),label:t,description:e.sshHost,control:(0,Q.jsx)(`div`,{className:`relative flex items-center`,onClick:Nt,onKeyDown:Mt,children:(0,Q.jsx)(Ee,{"aria-label":f.formatMessage({id:`settings.remoteConnections.discoveryDialog.toggleSelection`,defaultMessage:`Select {connectionName}`,description:`Accessible label for staging a discovered SSH connection with a checkbox`},{connectionName:t}),checked:n,disabled:r,onCheckedChange:()=>{u(e.hostId)}})})})},e.hostId)}),t[21]=n,t[22]=f,t[23]=r,t[24]=u,t[25]=d,t[26]=E):E=t[26];let D;t[27]===Symbol.for(`react.memo_cache_sentinel`)?(D=(0,Q.jsx)(B,{id:`settings.remoteConnections.discoveryDialog.title`,defaultMessage:`Add SSH Connection`,description:`Title for the dialog that lets users add a discovered SSH connection`}),t[27]=D):D=t[27];let O;return t[28]!==m||t[29]!==s||t[30]!==i||t[31]!==T||t[32]!==E?(O=(0,Q.jsx)(At,{emptyState:h,footer:T,list:E,open:i,title:D,onOpenChange:s,onSubmit:m}),t[28]=m,t[29]=s,t[30]=i,t[31]=T,t[32]=E,t[33]=O):O=t[33],O}function Mt(e){e.stopPropagation()}function Nt(e){e.stopPropagation()}function Pt(){return{displayName:``,targetKind:`hostname`,sshHost:``,sshPort:``,authMode:`none`,identity:``}}function Ft(e){return{displayName:e.displayName,targetKind:e.sshAlias?.trim()?`alias`:`hostname`,sshHost:e.sshAlias?.trim()||e.sshHost,sshPort:e.sshPort==null?``:String(e.sshPort),authMode:e.identity==null?`none`:`identity`,identity:e.identity??``}}function It(e,{connectionAnalyticsId:t}={}){let n=e.displayName.trim(),a=e.sshHost.trim(),o=e.targetKind===`alias`?a:null;return o==null?{hostId:r(n),...t==null?{}:{connectionAnalyticsId:t},displayName:n,source:`codex-managed`,alias:null,hostname:a,sshPort:Rt(e.sshPort),identity:e.authMode===`identity`?e.identity.trim():null}:{hostId:i(o),...t==null?{}:{connectionAnalyticsId:t},displayName:n,source:`discovered`,alias:o,hostname:null,sshPort:null,identity:null}}function Lt({draft:e,editingHostId:t,existingConnections:n}){let r=[],i=e.displayName.trim();i.length===0&&r.push(`displayNameRequired`),e.sshHost.trim().length===0&&r.push(`sshHostRequired`);let a=e.sshPort.trim();if(a.length>0)if(!/^\d+$/.test(a))r.push(`sshPortInteger`);else{let e=Number(a);(!Number.isSafeInteger(e)||e<1||e>65535)&&r.push(`sshPortRange`)}return e.authMode===`identity`&&e.identity.trim().length===0&&r.push(`identityRequired`),n.some(e=>t!=null&&e.hostId===t?!1:e.displayName.trim()===i)&&r.push(`duplicateDisplayName`),r}function Rt(e){let t=e.trim();if(t.length===0||!/^\d+$/.test(t))return null;let n=Number(t);return Number.isSafeInteger(n)?n:null}var zt=[`none`,`identity`];function Bt(e){let t=(0,$.c)(65),{open:n,mode:r,draft:i,existingConnections:a,editingHostId:o,onOpenChange:s,onSubmit:c,isSaving:l}=e,u=z(),d=r===`edit`&&i.targetKind===`alias`,f;t[0]!==o||t[1]!==a?(f=e=>{let t=Lt({draft:e,existingConnections:a,editingHostId:o});if(t.length!==0)return t},t[0]=o,t[1]=a,t[2]=f):f=t[2];let p=f,m;t[3]===p?m=t[4]:(m={onChange:e=>{let{value:t}=e;return p(t)},onSubmit:e=>{let{value:t}=e;return p(t)}},t[3]=p,t[4]=m);let h;t[5]!==l||t[6]!==c?(h=e=>{let{value:t}=e;l||c(t)},t[5]=l,t[6]=c,t[7]=h):h=t[7];let g;t[8]!==i||t[9]!==m||t[10]!==h?(g={defaultValues:i,validators:m,onSubmit:h},t[8]=i,t[9]=m,t[10]=h,t[11]=g):g=t[11];let _=ct(g),v=r===`add`?`default`:`compact`,y;t[12]===_?y=t[13]:(y=e=>{e.preventDefault(),_.handleSubmit()},t[12]=_,t[13]=y);let b;t[14]===r?b=t[15]:(b=(0,Q.jsx)(X,{children:(0,Q.jsx)(xe,{title:r===`add`?(0,Q.jsx)(B,{id:`settings.remoteConnections.dialog.addTitle`,defaultMessage:`Add SSH connection`,description:`Title for add remote connection dialog`}):(0,Q.jsx)(B,{id:`settings.remoteConnections.dialog.editTitle`,defaultMessage:`Edit SSH connection`,description:`Title for edit remote connection dialog`})})}),t[14]=r,t[15]=b);let x;t[16]===l?x=t[17]:(x=e=>l||e.submissionAttempts===0?[]:e.errorMap.onChange??e.errorMap.onSubmit??[],t[16]=l,t[17]=x);let S;t[18]!==_.Subscribe||t[19]!==x?(S=(0,Q.jsx)(_.Subscribe,{selector:x,children:Ht}),t[18]=_.Subscribe,t[19]=x,t[20]=S):S=t[20];let C;t[21]===l?C=t[22]:(C=e=>(0,Q.jsx)(Wt,{label:(0,Q.jsx)(B,{id:`settings.remoteConnections.dialog.field.displayName`,defaultMessage:`Display name`,description:`Label for display name field in remote connection editor dialog`}),value:e.state.value,onChange:e.handleChange,onBlur:e.handleBlur,disabled:l}),t[21]=l,t[22]=C);let w;t[23]!==_.Field||t[24]!==C?(w=(0,Q.jsx)(_.Field,{name:`displayName`,children:C}),t[23]=_.Field,t[24]=C,t[25]=w):w=t[25];let T;t[26]!==u||t[27]!==d||t[28]!==l?(T=e=>(0,Q.jsx)(Wt,{label:d?(0,Q.jsx)(B,{id:`settings.remoteConnections.dialog.field.alias`,defaultMessage:`Alias`,description:`Label for SSH alias field in remote connection editor dialog`}):(0,Q.jsx)(B,{id:`settings.remoteConnections.dialog.field.sshHost`,defaultMessage:`Hostname`,description:`Label for SSH target field in remote connection editor dialog`}),placeholder:d?void 0:u.formatMessage({id:`settings.remoteConnections.dialog.field.sshHost.placeholder`,defaultMessage:`host.com or user@host.com`,description:`Placeholder for SSH target field in remote connection editor dialog`}),value:e.state.value,onChange:e.handleChange,onBlur:e.handleBlur,disabled:l||d}),t[26]=u,t[27]=d,t[28]=l,t[29]=T):T=t[29];let E;t[30]!==_.Field||t[31]!==T?(E=(0,Q.jsx)(_.Field,{name:`sshHost`,children:T}),t[30]=_.Field,t[31]=T,t[32]=E):E=t[32];let D;t[33]!==_.Field||t[34]!==_.Subscribe||t[35]!==d||t[36]!==l?(D=d?null:(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(_.Field,{name:`sshPort`,children:e=>(0,Q.jsx)(Wt,{label:(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(B,{id:`settings.remoteConnections.dialog.field.sshPort`,defaultMessage:`SSH port`,description:`Label for SSH port field in remote connection editor dialog`}),` `,(0,Q.jsx)(`span`,{className:`font-normal text-token-text-secondary`,children:(0,Q.jsx)(B,{id:`settings.remoteConnections.dialog.field.optional`,defaultMessage:`(optional)`,description:`Marker shown next to optional fields in the remote connection editor dialog`})})]}),value:e.state.value,onChange:e.handleChange,onBlur:e.handleBlur,disabled:l})}),(0,Q.jsx)(_.Field,{name:`authMode`,children:e=>(0,Q.jsx)(Gt,{authMode:e.state.value,disabled:l,onChange:e.handleChange})}),(0,Q.jsx)(_.Subscribe,{selector:Vt,children:e=>e===`identity`?(0,Q.jsx)(_.Field,{name:`identity`,children:e=>(0,Q.jsx)(Wt,{label:(0,Q.jsx)(B,{id:`settings.remoteConnections.dialog.field.identity`,defaultMessage:`Identity file path`,description:`Label for required identity file path field in remote connection editor dialog`}),value:e.state.value,onChange:e.handleChange,onBlur:e.handleBlur,disabled:l})}):null})]}),t[33]=_.Field,t[34]=_.Subscribe,t[35]=d,t[36]=l,t[37]=D):D=t[37];let O;t[38]!==w||t[39]!==E||t[40]!==D?(O=(0,Q.jsx)(X,{children:(0,Q.jsxs)(`div`,{className:`grid grid-cols-1 gap-4`,children:[w,E,D]})}),t[38]=w,t[39]=E,t[40]=D,t[41]=O):O=t[41];let k;t[42]===s?k=t[43]:(k=()=>s(!1),t[42]=s,t[43]=k);let A;t[44]===Symbol.for(`react.memo_cache_sentinel`)?(A=(0,Q.jsx)(B,{id:`settings.remoteConnections.dialog.cancel`,defaultMessage:`Cancel`,description:`Cancel button for remote connection editor dialog`}),t[44]=A):A=t[44];let j;t[45]!==l||t[46]!==k?(j=(0,Q.jsx)(Y,{color:`ghost`,type:`button`,disabled:l,onClick:k,children:A}),t[45]=l,t[46]=k,t[47]=j):j=t[47];let ee;t[48]===Symbol.for(`react.memo_cache_sentinel`)?(ee=(0,Q.jsx)(B,{id:`settings.remoteConnections.dialog.apply`,defaultMessage:`Save`,description:`Save button for remote connection editor dialog`}),t[48]=ee):ee=t[48];let M;t[49]===l?M=t[50]:(M=(0,Q.jsx)(Y,{color:`primary`,type:`submit`,loading:l,children:ee}),t[49]=l,t[50]=M);let N;t[51]!==j||t[52]!==M?(N=(0,Q.jsx)(X,{className:`pt-4`,children:(0,Q.jsxs)(we,{children:[j,M]})}),t[51]=j,t[52]=M,t[53]=N):N=t[53];let P;t[54]!==O||t[55]!==N||t[56]!==y||t[57]!==b||t[58]!==S?(P=(0,Q.jsxs)(Ce,{as:`form`,onSubmit:y,children:[b,S,O,N]}),t[54]=O,t[55]=N,t[56]=y,t[57]=b,t[58]=S,t[59]=P):P=t[59];let F;return t[60]!==s||t[61]!==n||t[62]!==P||t[63]!==v?(F=(0,Q.jsx)(Se,{open:n,onOpenChange:s,size:v,children:P}),t[60]=s,t[61]=n,t[62]=P,t[63]=v,t[64]=F):F=t[64],F}function Vt(e){return e.values.authMode}function Ht(e){return e.length>0?(0,Q.jsx)(X,{children:(0,Q.jsx)(`div`,{className:`border-token-border-error rounded-md border p-2 text-sm text-token-error-foreground`,children:e.map(Ut)})}):null}function Ut(e){return(0,Q.jsx)(`div`,{children:Kt(e)},e)}function Wt(e){let t=(0,$.c)(16),{label:n,description:r,value:i,placeholder:a,onChange:o,onBlur:s,disabled:c}=e,l=c===void 0?!1:c,u;t[0]===n?u=t[1]:(u=(0,Q.jsx)(`span`,{className:`text-xs font-medium text-token-text-primary`,children:n}),t[0]=n,t[1]=u);let d;t[2]===o?d=t[3]:(d=e=>o(e.target.value),t[2]=o,t[3]=d);let f;t[4]!==l||t[5]!==s||t[6]!==a||t[7]!==d||t[8]!==i?(f=(0,Q.jsx)(`input`,{className:`w-full rounded-md border border-token-input-border bg-token-input-background px-2.5 py-1.5 text-sm text-token-input-foreground outline-none placeholder:text-token-input-placeholder-foreground focus:border-token-focus-border disabled:bg-token-foreground/5 disabled:text-token-text-secondary disabled:opacity-100`,value:i,disabled:l,onChange:d,onBlur:s,placeholder:a}),t[4]=l,t[5]=s,t[6]=a,t[7]=d,t[8]=i,t[9]=f):f=t[9];let p;t[10]===r?p=t[11]:(p=r?(0,Q.jsx)(`span`,{className:`text-xs text-token-text-secondary`,children:r}):null,t[10]=r,t[11]=p);let m;return t[12]!==u||t[13]!==f||t[14]!==p?(m=(0,Q.jsxs)(`label`,{className:`flex flex-col gap-1`,children:[u,f,p]}),t[12]=u,t[13]=f,t[14]=p,t[15]=m):m=t[15],m}function Gt(e){let t=(0,$.c)(9),{authMode:n,disabled:r,onChange:i}=e,a=z(),o;t[0]===a?o=t[1]:(o=a.formatMessage({id:`settings.remoteConnections.dialog.authMode.ariaLabel`,defaultMessage:`SSH authentication method`,description:`Accessible label for choosing the SSH authentication method in the remote connection editor dialog`}),t[0]=a,t[1]=o);let s;t[2]!==n||t[3]!==r||t[4]!==i?(s=zt.map(e=>{let t=e===n;return(0,Q.jsx)(`button`,{type:`button`,"aria-pressed":t,className:A(`cursor-interaction flex h-7 flex-1 items-center justify-center rounded-full px-2 text-sm font-medium outline-none focus-visible:ring-1 focus-visible:ring-token-focus-border disabled:cursor-not-allowed disabled:opacity-50`,t?`bg-token-dropdown-background text-token-foreground shadow-sm ring-1 ring-token-border/60`:`text-token-foreground hover:bg-token-foreground/5`),disabled:r,onClick:()=>{i(e)},children:e===`none`?(0,Q.jsx)(B,{id:`settings.remoteConnections.dialog.authMode.none`,defaultMessage:`No Auth`,description:`Option label for using no explicit SSH identity file`}):(0,Q.jsx)(B,{id:`settings.remoteConnections.dialog.authMode.identity`,defaultMessage:`Identity`,description:`Option label for using an SSH identity file`})},e)}),t[2]=n,t[3]=r,t[4]=i,t[5]=s):s=t[5];let c;return t[6]!==o||t[7]!==s?(c=(0,Q.jsx)(`div`,{className:`flex rounded-full bg-token-foreground/10 p-0.5`,role:`group`,"aria-label":o,children:s}),t[6]=o,t[7]=s,t[8]=c):c=t[8],c}function Kt(e){switch(e){case`displayNameRequired`:return(0,Q.jsx)(B,{id:`settings.remoteConnections.dialog.field.displayName.error`,defaultMessage:`Display name is required`,description:`Error message for display name field in remote connection editor dialog`});case`sshHostRequired`:return(0,Q.jsx)(B,{id:`settings.remoteConnections.dialog.field.sshHost.error`,defaultMessage:`Hostname is required`,description:`Error message for SSH target field in remote connection editor dialog`});case`sshPortInteger`:return(0,Q.jsx)(B,{id:`settings.remoteConnections.dialog.field.sshPort.intError`,defaultMessage:`SSH port must be an integer`,description:`Error message for SSH port field when the input is not an integer`});case`sshPortRange`:return(0,Q.jsx)(B,{id:`settings.remoteConnections.dialog.field.sshPort.rangeError`,defaultMessage:`SSH port must be between 1 and 65535`,description:`Error message for SSH port field when the input is not between 1 and 65535`});case`identityRequired`:return(0,Q.jsx)(B,{id:`settings.remoteConnections.dialog.field.identity.error`,defaultMessage:`Identity file path is required`,description:`Error message for identity file path field in remote connection editor dialog`});case`duplicateDisplayName`:return(0,Q.jsx)(B,{id:`settings.remoteConnections.dialog.field.displayName.duplicateError`,defaultMessage:`A connection with this display name already exists`,description:`Error message for duplicate display name in the remote connection editor dialog`})}}function qt(e){return{refreshSource:p.CODEX_REMOTE_CONTROL_REFRESH_SOURCE_SETTINGS,connectionCount:e.length,onlineConnectionCount:e.filter(e=>e.online).length,busyConnectionCount:e.filter(e=>e.busy).length,autoConnectConnectionCount:e.filter(e=>e.autoConnect).length,unsupportedAppServerVersionConnectionCount:e.filter(e=>!l(e.appServerVersion)).length}}var Jt=`—`;function Yt(e){let t=(0,$.c)(9),{value:n,placeholder:r}=e,i;t[0]===n?i=t[1]:(i=n?.trim()??``,t[0]=n,t[1]=i);let a=i;if(a===``){let e=r??Jt,n;return t[2]===e?n=t[3]:(n=(0,Q.jsx)(`div`,{className:`truncate`,children:e}),t[2]=e,t[3]=n),n}let o;t[4]===a?o=t[5]:(o=(0,Q.jsx)(`div`,{className:`truncate`,children:a}),t[4]=a,t[5]=o);let s;return t[6]!==o||t[7]!==a?(s=(0,Q.jsx)(J,{tooltipContent:a,openWhen:`trigger-overflows`,children:o}),t[6]=o,t[7]=a,t[8]=s):s=t[8],s}var Xt=`text-sm electron:!text-sm`,Zt=`!size-5 !rounded-full !p-0 electron:!rounded-full electron:!p-0`;function Qt(e){let t=(0,$.c)(29),{actionsLabel:n,deleteDisabled:r,deleteLabel:i,deleteTooltip:a,detailsLabel:o,editDisabled:s,editLabel:c,editTooltip:l,onDelete:u,onDetails:d,onEdit:f,onLogout:p,onRestart:m,restartLabel:h}=e,g;t[0]===n?g=t[1]:(g=(0,Q.jsx)(Be,{label:n,size:`icon`,iconClassName:`icon-sm`,className:Zt}),t[0]=n,t[1]=g);let _;t[2]!==o||t[3]!==d?(_=(0,Q.jsx)(De.Item,{LeftIcon:fe,className:Xt,onSelect:d,children:o}),t[2]=o,t[3]=d,t[4]=_):_=t[4];let v=s?l:null,y;t[5]!==s||t[6]!==c||t[7]!==f||t[8]!==v?(y=(0,Q.jsx)(De.Item,{LeftIcon:_e,className:Xt,disabled:s,onSelect:f,tooltipText:v,children:c}),t[5]=s,t[6]=c,t[7]=f,t[8]=v,t[9]=y):y=t[9];let b;t[10]!==m||t[11]!==h?(b=h!=null&&m!=null?(0,Q.jsx)(De.Item,{LeftIcon:Re,className:Xt,onSelect:m,children:h}):null,t[10]=m,t[11]=h,t[12]=b):b=t[12];let x;t[13]===p?x=t[14]:(x=p==null?null:(0,Q.jsx)(De.Item,{LeftIcon:Ie,className:Xt,onSelect:p,children:(0,Q.jsx)(B,{id:`settings.remoteConnections.logout`,defaultMessage:`Logout`,description:`Menu item label to log out of a connected remote connection`})}),t[13]=p,t[14]=x);let S;t[15]===Symbol.for(`react.memo_cache_sentinel`)?(S=(0,Q.jsx)(De.Separator,{}),t[15]=S):S=t[15];let C;t[16]===Symbol.for(`react.memo_cache_sentinel`)?(C=A(Xt,`text-token-charts-red`),t[16]=C):C=t[16];let w=r?a:null,T;t[17]!==r||t[18]!==i||t[19]!==u||t[20]!==w?(T=(0,Q.jsx)(De.Item,{LeftIcon:ke,className:C,leftIconClassName:`icon-xs text-token-charts-red`,disabled:r,onSelect:u,tooltipText:w,children:i}),t[17]=r,t[18]=i,t[19]=u,t[20]=w,t[21]=T):T=t[21];let E;return t[22]!==g||t[23]!==T||t[24]!==_||t[25]!==y||t[26]!==b||t[27]!==x?(E=(0,Q.jsxs)(Oe,{align:`end`,contentWidth:`menu`,triggerButton:g,children:[_,y,b,x,S,T]}),t[22]=g,t[23]=T,t[24]=_,t[25]=y,t[26]=b,t[27]=x,t[28]=E):E=t[28],E}function $t(e){let t=(0,$.c)(22),{className:n,control:r,description:i,displayName:a,icon:o,label:s,status:c}=e,l;t[0]!==a||t[1]!==s?(l=s??(0,Q.jsx)(Yt,{value:a}),t[0]=a,t[1]=s,t[2]=l):l=t[2];let u=l,d=o??c,f;t[3]===u?f=t[4]:(f=(0,Q.jsx)(`div`,{className:`min-w-0`,children:u}),t[3]=u,t[4]=f);let p;t[5]!==o||t[6]!==c?(p=o!=null&&c!=null?(0,Q.jsx)(`span`,{className:`inline-flex shrink-0 -translate-y-[0.5px] items-center`,children:c}):null,t[5]=o,t[6]=c,t[7]=p):p=t[7];let m;t[8]!==i||t[9]!==p?(m=(0,Q.jsxs)(`div`,{className:`flex min-w-0 items-center gap-1.5 text-token-text-secondary`,children:[p,i]}),t[8]=i,t[9]=p,t[10]=m):m=t[10];let h;t[11]!==f||t[12]!==m?(h=(0,Q.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-1`,children:[f,m]}),t[11]=f,t[12]=m,t[13]=h):h=t[13];let g;t[14]!==n||t[15]!==r||t[16]!==d||t[17]!==h?(g=(0,Q.jsx)(We,{className:n,icon:d,label:h,control:r}),t[14]=n,t[15]=r,t[16]=d,t[17]=h,t[18]=g):g=t[18];let _;return t[19]!==a||t[20]!==g?(_=(0,Q.jsx)(`div`,{"aria-label":a,role:`group`,children:g}),t[19]=a,t[20]=g,t[21]=_):_=t[21],_}function en(e,t){return!e.online||!l(e.appServerVersion)?`block size-2 rounded-full bg-gray-400`:t===`error`?`block size-2 rounded-full bg-token-charts-red`:t===`connected`?e.busy?`block size-2 rounded-full bg-token-charts-yellow`:`block size-2 rounded-full bg-token-charts-green`:`block size-2 rounded-full bg-gray-400`}function tn(e,t,n){return t.online?l(t.appServerVersion)?n===`connecting`||n===`restarting`?e.formatMessage({id:`settings.remoteControlConnections.availability.connecting`,defaultMessage:`Connecting`,description:`Availability label for a remote control environment that is connecting`}):n===`error`?e.formatMessage({id:`settings.remoteControlConnections.availability.connectionFailed`,defaultMessage:`Connection failed`,description:`Availability label for a remote control environment whose app-server transport failed`}):n===`connected`?t.busy?e.formatMessage({id:`settings.remoteControlConnections.availability.busy`,defaultMessage:`busy`,description:`Availability label for a remote control environment that is busy`}):e.formatMessage({id:`settings.remoteControlConnections.availability.online`,defaultMessage:`online`,description:`Availability label for a remote control environment that is online`}):e.formatMessage({id:`threadPage.remoteConnectionStatusBadge.disconnected`,defaultMessage:`Disconnected`,description:`Label shown when remote connection is unavailable`}):e.formatMessage({id:`settings.remoteControlConnections.availability.updateRequired`,defaultMessage:`Please update app-server version (current: {currentVersion}) to {requiredVersion} or newer`,description:`Availability label for an online remote control environment with an incompatible app-server version`},{currentVersion:t.appServerVersion,requiredVersion:o}):e.formatMessage({id:`settings.remoteControlConnections.availability.offline`,defaultMessage:`offline`,description:`Availability label for a remote control environment that is offline`})}function nn(e){let t=(0,$.c)(80),{connection:n,clientAuthorized:r,disabled:i,isEditing:a,isRenamePending:s,isSaving:c,onCancelEditing:u,onLogoutConnection:d,onRequestDelete:f,onSave:p,onShowDetails:m,onStartEditing:h,onToggleConnection:g}=e,_=z(),[v,y]=(0,Z.useState)(n.displayName),{state:b}=Ae(n.hostId),x,S;if(t[0]!==r||t[1]!==n.appServerVersion||t[2]!==n.online||t[3]!==b){let e=l(n.appServerVersion);x=r&&n.online&&e,S=an(r,n.online,e,b),t[0]=r,t[1]=n.appServerVersion,t[2]=n.online,t[3]=b,t[4]=x,t[5]=S}else x=t[4],S=t[5];let C=S,w;t[6]===v?w=t[7]:(w=v.trim(),t[6]=v,t[7]=w);let T=w,E;t[8]===_?E=t[9]:(E=_.formatMessage({id:`settings.remoteControlConnections.rename.inputLabel`,defaultMessage:`Display name`,description:`Screen reader label for remote control display name rename input`}),t[8]=_,t[9]=E);let D=E,O;t[10]===_?O=t[11]:(O=_.formatMessage({id:`settings.remoteControlConnections.rename.save`,defaultMessage:`Save`,description:`Button label to save a remote control environment rename`}),t[10]=_,t[11]=O);let k=O,A;t[12]===_?A=t[13]:(A=_.formatMessage({id:`settings.remoteControlConnections.rename.cancel`,defaultMessage:`Cancel`,description:`Button label to cancel a remote control environment rename`}),t[12]=_,t[13]=A);let j=A,ee;t[14]===_?ee=t[15]:(ee=_.formatMessage({id:`settings.remoteControlConnections.rename`,defaultMessage:`Rename`,description:`Menu item label to rename a signed-in device`}),t[14]=_,t[15]=ee);let M=ee,N;t[16]===_?N=t[17]:(N=_.formatMessage({id:`settings.remoteConnections.deleteConnection`,defaultMessage:`Delete`,description:`Menu item label to delete a remote connection`}),t[16]=_,t[17]=N);let P=N,F;t[18]===_?F=t[19]:(F=_.formatMessage({id:`settings.remoteControlConnections.delete.offlineOnly`,defaultMessage:`Only offline environments can be deleted`,description:`Tooltip shown when an online remote control environment cannot be deleted`}),t[18]=_,t[19]=F);let I=F,te;t[20]===_?te=t[21]:(te=_.formatMessage({id:`settings.remoteConnections.detailsMenu`,defaultMessage:`Details`,description:`Menu item label to show remote connection details`}),t[20]=_,t[21]=te);let L=te,ne=i||s||a||n.online,R=n.online?I:P,V;t[22]!==n.displayName||t[23]!==u?(V=()=>{y(n.displayName),u()},t[22]=n.displayName,t[23]=u,t[24]=V):V=t[24];let H=V,U;t[25]!==H||t[26]!==n||t[27]!==s||t[28]!==p||t[29]!==T?(U=async()=>{if(!(T.length===0||s)){if(T===n.displayName){H();return}await p(n,T)}},t[25]=H,t[26]=n,t[27]=s,t[28]=p,t[29]=T,t[30]=U):U=t[30];let re=U,ie=n.displayName,W;t[31]===n?W=t[32]:(W=ht(n),t[31]=n,t[32]=W);let ae;t[33]===n.appServerVersion?ae=t[34]:(ae={currentVersion:n.appServerVersion,requiredVersion:o},t[33]=n.appServerVersion,t[34]=ae);let G;t[35]!==C||t[36]!==ae?(G=(0,Q.jsx)(B,{...C,values:ae}),t[35]=C,t[36]=ae,t[37]=G):G=t[37];let K;t[38]!==H||t[39]!==i||t[40]!==v||t[41]!==a||t[42]!==c||t[43]!==D||t[44]!==re?(K=a?(0,Q.jsx)(`input`,{"aria-label":D,className:`min-w-0 rounded-md border border-token-input-border bg-token-input-background px-2 py-1 text-sm text-token-input-foreground outline-none placeholder:text-token-input-placeholder-foreground focus:border-token-focus-border disabled:bg-token-foreground/5 disabled:text-token-text-secondary disabled:opacity-100`,value:v,disabled:i||c,onChange:e=>{y(e.target.value)},onKeyDown:e=>{e.key===`Enter`?(e.preventDefault(),re()):e.key===`Escape`&&(e.preventDefault(),H())},autoFocus:!0}):void 0,t[38]=H,t[39]=i,t[40]=v,t[41]=a,t[42]=c,t[43]=D,t[44]=re,t[45]=K):K=t[45];let q;t[46]!==n||t[47]!==b?(q=(0,Q.jsx)(rn,{connection:n,state:b}),t[46]=n,t[47]=b,t[48]=q):q=t[48];let oe;t[49]!==x||t[50]!==H||t[51]!==j||t[52]!==n||t[53]!==ne||t[54]!==P||t[55]!==R||t[56]!==L||t[57]!==i||t[58]!==M||t[59]!==_||t[60]!==a||t[61]!==s||t[62]!==c||t[63]!==d||t[64]!==f||t[65]!==m||t[66]!==h||t[67]!==g||t[68]!==re||t[69]!==k||t[70]!==b||t[71]!==T.length?(oe=a?(0,Q.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,Q.jsx)(J,{tooltipContent:k,children:(0,Q.jsx)(Y,{"aria-label":k,color:`ghost`,size:`icon`,loading:c,disabled:i||T.length===0||s,onClick:()=>{re()},children:(0,Q.jsx)(Te,{className:`icon-xs`})})}),(0,Q.jsx)(J,{tooltipContent:j,children:(0,Q.jsx)(Y,{"aria-label":j,color:`ghost`,size:`icon`,disabled:i||c,onClick:H,children:(0,Q.jsx)(le,{className:`icon-xs`})})})]}):(0,Q.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Q.jsx)(Qt,{actionsLabel:_.formatMessage({id:`settings.remoteConnections.table.actions.ariaLabel`,defaultMessage:`{connectionName} actions`,description:`Screen reader label for the remote connection actions menu`},{connectionName:n.displayName}),editLabel:M,editTooltip:M,editDisabled:i||s||a,onEdit:()=>{y(n.displayName),h()},detailsLabel:L,onDetails:()=>m(n),onLogout:b===`connected`?()=>d(n.hostId):void 0,deleteLabel:P,deleteTooltip:R,deleteDisabled:ne,onDelete:()=>f(n)}),n.online?(0,Q.jsx)(Le,{checked:n.autoConnect,disabled:!x,onChange:e=>g(n.hostId,e),ariaLabel:_.formatMessage({id:`settings.remoteControlConnections.table.connect.ariaLabel`,defaultMessage:`Connect {connectionName}`,description:`Screen reader label for the remote control connection toggle`},{connectionName:n.displayName})}):(0,Q.jsx)(J,{tooltipContent:_.formatMessage({id:`settings.remoteControlConnections.connect.offlineTooltip`,defaultMessage:`This device is offline. Refresh to check again`,description:`Tooltip shown when a remote control auto-connect toggle is disabled because the device is offline`}),children:(0,Q.jsx)(`span`,{className:`inline-flex`,children:(0,Q.jsx)(Le,{checked:n.autoConnect,disabled:!0,onChange:e=>g(n.hostId,e),ariaLabel:_.formatMessage({id:`settings.remoteControlConnections.table.connect.ariaLabel`,defaultMessage:`Connect {connectionName}`,description:`Screen reader label for the remote control connection toggle`},{connectionName:n.displayName})})})})]}),t[49]=x,t[50]=H,t[51]=j,t[52]=n,t[53]=ne,t[54]=P,t[55]=R,t[56]=L,t[57]=i,t[58]=M,t[59]=_,t[60]=a,t[61]=s,t[62]=c,t[63]=d,t[64]=f,t[65]=m,t[66]=h,t[67]=g,t[68]=re,t[69]=k,t[70]=b,t[71]=T.length,t[72]=oe):oe=t[72];let se;return t[73]!==n.displayName||t[74]!==W||t[75]!==G||t[76]!==K||t[77]!==q||t[78]!==oe?(se=(0,Q.jsx)($t,{displayName:ie,icon:W,description:G,label:K,status:q,control:oe}),t[73]=n.displayName,t[74]=W,t[75]=G,t[76]=K,t[77]=q,t[78]=oe,t[79]=se):se=t[79],se}function rn(e){let t=(0,$.c)(13),{connection:n,state:r}=e,i=z(),a;t[0]!==n||t[1]!==i||t[2]!==r?(a=tn(i,n,r),t[0]=n,t[1]=i,t[2]=r,t[3]=a):a=t[3];let o=a,s;t[4]!==n||t[5]!==r?(s=en(n,r),t[4]=n,t[5]=r,t[6]=s):s=t[6];let c;t[7]!==o||t[8]!==s?(c=(0,Q.jsx)(`span`,{"aria-label":o,className:s,role:`img`}),t[7]=o,t[8]=s,t[9]=c):c=t[9];let l;return t[10]!==o||t[11]!==c?(l=(0,Q.jsx)(J,{tooltipContent:o,children:c}),t[10]=o,t[11]=c,t[12]=l):l=t[12],l}function an(e,t,n,r){return!e&&!t?on.signedInDeviceAuthorizationRequiredOfflineSubtitle:e?t?n?r===`connecting`||r===`restarting`?on.signedInDeviceConnectingSubtitle:r===`error`?on.signedInDeviceConnectionFailedSubtitle:r===`connected`?on.signedInDeviceOnlineSubtitle:on.signedInDeviceDisconnectedSubtitle:on.signedInDeviceUpdateRequiredSubtitle:on.signedInDeviceOfflineSubtitle:on.signedInDeviceAuthorizationRequiredSubtitle}var on=V({signedInDeviceAuthorizationRequiredOfflineSubtitle:{id:`settings.remoteConnections.deviceConnections.signedInDeviceAuthorizationRequiredOfflineSubtitle`,defaultMessage:`Requires authorization · Offline`,description:`Subtitle for unauthorized offline signed-in-device rows in the device connections table`},signedInDeviceAuthorizationRequiredSubtitle:{id:`settings.remoteConnections.deviceConnections.signedInDeviceAuthorizationRequiredSubtitle`,defaultMessage:`Requires authorization`,description:`Subtitle for unauthorized signed-in-device rows in the device connections table`},signedInDeviceOfflineSubtitle:{id:`settings.remoteConnections.deviceConnections.signedInDeviceOfflineSubtitle`,defaultMessage:`Offline`,description:`Subtitle for offline signed-in-device rows in the device connections table`},signedInDeviceUpdateRequiredSubtitle:{id:`settings.remoteConnections.deviceConnections.signedInDeviceUpdateRequiredSubtitle`,defaultMessage:`Please update app-server version (current: {currentVersion}) to {requiredVersion} or newer`,description:`Subtitle for online signed-in-device rows that require an app-server update`},signedInDeviceConnectingSubtitle:{id:`settings.remoteConnections.deviceConnections.signedInDeviceConnectingSubtitle`,defaultMessage:`Connecting`,description:`Subtitle for signed-in-device rows whose app-server transport is connecting`},signedInDeviceConnectionFailedSubtitle:{id:`settings.remoteConnections.deviceConnections.signedInDeviceConnectionFailedSubtitle`,defaultMessage:`Connection failed`,description:`Subtitle for signed-in-device rows whose app-server transport failed`},signedInDeviceDisconnectedSubtitle:{id:`settings.remoteConnections.deviceConnections.signedInDeviceDisconnectedSubtitle`,defaultMessage:`Disconnected`,description:`Subtitle for signed-in-device rows whose app-server transport is disconnected`},signedInDeviceOnlineSubtitle:{id:`settings.remoteConnections.deviceConnections.signedInDeviceOnlineSubtitle`,defaultMessage:`Connected`,description:`Subtitle for online signed-in-device rows in the device connections table`}});function sn(e){let t=(0,$.c)(23),{action:n,error:r,isRestartAvailableNotice:i,restartAvailableNotice:a,statusMessage:o}=e,s=z();if(n!=null&&(i||r?.code===`restart-required`)){let e;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Q.jsx)(cn,{}),t[0]=e):e=t[0];let r;t[1]===n?r=t[2]:(r=(0,Q.jsx)(B,{id:`settings.remoteConnections.restartNotice.message`,defaultMessage:`Restart to update your CLI version`,description:`Inline update message shown when a connected SSH remote has an installed Codex update ready`,values:{restart:e=>(0,Q.jsx)(`button`,{className:`cursor-interaction border-0 bg-transparent p-0 text-token-text-link-foreground hover:underline`,type:`button`,onClick:n.onClick,children:e},`restart`)}}),t[1]=n,t[2]=r);let i;t[3]!==s||t[4]!==a?(i=a==null?null:(0,Q.jsx)(J,{side:`bottom`,tooltipContent:s.formatMessage({id:`settings.remoteConnections.restartNotice.tooltip`,defaultMessage:`Update available: {installedVersion}. Currently running {currentVersion}`,description:`Tooltip shown from the inline update notice with the installed and current CLI versions`},{currentVersion:a.currentVersion,installedVersion:a.installedVersion}),children:(0,Q.jsx)(`span`,{"aria-label":s.formatMessage({id:`settings.remoteConnections.restartNotice.details`,defaultMessage:`Update details`,description:`Accessible label for the inline update details tooltip trigger`}),className:`text-token-text-secondary`,children:(0,Q.jsx)(fe,{"aria-hidden":!0,className:`icon-xs shrink-0`})})}),t[3]=s,t[4]=a,t[5]=i):i=t[5];let o;return t[6]!==r||t[7]!==i?(o=(0,Q.jsxs)(Q.Fragment,{children:[e,(0,Q.jsxs)(`span`,{className:`inline-flex min-w-0 items-center gap-1`,children:[r,i]})]}),t[6]=r,t[7]=i,t[8]=o):o=t[8],o}if(r==null||o==null)return null;let c;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,Q.jsx)(cn,{}),t[9]=c):c=t[9];let l;t[10]!==r.code||t[11]!==r.currentVersion||t[12]!==r.minRequiredVersion||t[13]!==s||t[14]!==o?(l=r.code===`connection-failed`?(0,Q.jsxs)(`span`,{className:`inline-flex min-w-0 items-center gap-1`,children:[(0,Q.jsx)(B,{id:`settings.remoteConnections.genericSshError`,defaultMessage:`SSH connection failed`,description:`Concise inline message shown for generic SSH connection failures`}),(0,Q.jsx)(J,{side:`bottom`,tooltipContent:o,children:(0,Q.jsx)(`span`,{"aria-label":s.formatMessage({id:`settings.remoteConnections.genericSshError.details`,defaultMessage:`Error details`,description:`Accessible label for the generic SSH error details tooltip trigger`}),className:`text-token-text-secondary`,children:(0,Q.jsx)(fe,{"aria-hidden":!0,className:`icon-xs shrink-0`})})})]}):r.code===`update-required`?(0,Q.jsxs)(`span`,{className:`inline-flex min-w-0 items-center gap-1`,children:[(0,Q.jsx)(B,{id:`settings.remoteConnections.updateRequiredInline`,defaultMessage:`Update your CLI version`,description:`Concise inline message shown when an SSH remote requires a newer Codex version`}),(0,Q.jsx)(J,{side:`bottom`,tooltipContent:s.formatMessage({id:`settings.remoteConnections.updateRequiredInline.tooltip`,defaultMessage:`Minimum required: {minRequiredVersion}. Currently installed: {currentVersion}`,description:`Tooltip shown from the inline update-required notice with the installed and minimum required CLI versions`},{currentVersion:r.currentVersion,minRequiredVersion:r.minRequiredVersion}),children:(0,Q.jsx)(`span`,{"aria-label":s.formatMessage({id:`settings.remoteConnections.updateRequiredInline.details`,defaultMessage:`Update details`,description:`Accessible label for the inline update-required details tooltip trigger`}),className:`text-token-text-secondary`,children:(0,Q.jsx)(fe,{"aria-hidden":!0,className:`icon-xs shrink-0`})})})]}):o,t[10]=r.code,t[11]=r.currentVersion,t[12]=r.minRequiredVersion,t[13]=s,t[14]=o,t[15]=l):l=t[15];let u;t[16]===l?u=t[17]:(u=(0,Q.jsx)(`span`,{className:`min-w-0 break-words`,children:l}),t[16]=l,t[17]=u);let d;t[18]===n?d=t[19]:(d=(0,Q.jsx)(ln,{action:n}),t[18]=n,t[19]=d);let f;return t[20]!==u||t[21]!==d?(f=(0,Q.jsxs)(Q.Fragment,{children:[c,(0,Q.jsxs)(`span`,{className:`inline-flex min-w-0 items-center gap-1`,children:[u,d]})]}),t[20]=u,t[21]=d,t[22]=f):f=t[22],f}function cn(){let e=(0,$.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,Q.jsx)(`span`,{"aria-hidden":!0,children:`·`}),e[0]=t):t=e[0],t}function ln(e){let t=(0,$.c)(10),{action:n}=e;if(n==null)return null;let r=n.disabled===!0||n.loading===!0,i=n.loading===!0&&n.loadingLabel!=null?n.loadingLabel:n.label,a;t[0]!==n.onClick||t[1]!==r||t[2]!==i?(a=(0,Q.jsx)(`button`,{type:`button`,className:`cursor-interaction border-0 bg-transparent p-0 text-token-text-link-foreground hover:underline disabled:cursor-default disabled:text-token-text-secondary disabled:no-underline`,disabled:r,onClick:n.onClick,children:i}),t[0]=n.onClick,t[1]=r,t[2]=i,t[3]=a):a=t[3];let o=a,s;t[4]!==n.renderInElectronOnly||t[5]!==o?(s=n.renderInElectronOnly===!0?(0,Q.jsx)(pe,{electron:!0,children:o}):o,t[4]=n.renderInElectronOnly,t[5]=o,t[6]=s):s=t[6];let c=s,l;return t[7]!==n.tooltipText||t[8]!==c?(l=n.tooltipText==null?c:(0,Q.jsx)(J,{tooltipContent:n.tooltipText,children:c}),t[7]=n.tooltipText,t[8]=c,t[9]=l):l=t[9],l}function un(e){let t=(0,$.c)(86),{connection:n,disabled:r,installCodexPending:i,onAuthenticate:a,onEdit:o,onInstallCodex:s,onLogoutConnection:c,onRemove:l,onShowDetails:u,onToggleConnection:d}=e,f=z(),{appServerVersion:p,error:m,installedCodexVersion:h,state:g}=Ae(n.hostId),_=n.displayName,v;t[0]===f?v=t[1]:(v=f.formatMessage({id:`settings.remoteConnections.editConnection`,defaultMessage:`Edit connection`,description:`Menu item label to edit a remote connection`}),t[0]=f,t[1]=v);let y=v,b;t[2]===f?b=t[3]:(b=f.formatMessage({id:`settings.remoteConnections.deleteConnection`,defaultMessage:`Delete`,description:`Menu item label to delete a remote connection`}),t[2]=f,t[3]=b);let x=b,S;t[4]===f?S=t[5]:(S=f.formatMessage({id:`settings.remoteConnections.detailsMenu`,defaultMessage:`Details`,description:`Menu item label to show remote connection details`}),t[4]=f,t[5]=S);let C=S,w;t[6]===f?w=t[7]:(w=f.formatMessage({id:`settings.remoteConnections.restartConnection`,defaultMessage:`Restart connection`,description:`Menu item label to restart an SSH remote connection`}),t[6]=f,t[7]=w);let T=w,E=re(`2153867414`),D,O,k,A,j,ee;if(t[8]!==p||t[9]!==n.hostId||t[10]!==r||t[11]!==m||t[12]!==i||t[13]!==h||t[14]!==f||t[15]!==a||t[16]!==s||t[17]!==E||t[18]!==g){k=fn({appServerVersion:p,installedCodexVersion:h,state:g}),D=g===`connected`||m?.code===`login-required`||m?.code===`update-required`||m?.code===`restart-required`;let{statusError:e,isRestartAvailableNotice:o,statusState:c}=dn({error:m,restartAvailableNotice:k,state:g});A=e,O=o,j=c==null?null:Ne(f,{canLogin:!0,error:A,state:c,surface:`connections-row`});let l=!E&&(A?.code===`remote-codex-not-found`||A?.code===`update-required`);ee=j==null||l?null:pn({action:j.action,disabled:r,hostId:n.hostId,installCodexPending:i,onAuthenticate:a,onInstallCodex:s}),t[8]=p,t[9]=n.hostId,t[10]=r,t[11]=m,t[12]=i,t[13]=h,t[14]=f,t[15]=a,t[16]=s,t[17]=E,t[18]=g,t[19]=D,t[20]=O,t[21]=k,t[22]=A,t[23]=j,t[24]=ee}else D=t[19],O=t[20],k=t[21],A=t[22],j=t[23],ee=t[24];let M=ee,N,P;t[25]===Symbol.for(`react.memo_cache_sentinel`)?(N=(0,Q.jsx)(de,{className:`icon-sm`}),P=(0,Q.jsx)(B,{id:`settings.remoteConnections.deviceConnections.sshSubtitle`,defaultMessage:`SSH`,description:`Subtitle for SSH-backed rows in the device connections table`}),t[25]=N,t[26]=P):(N=t[25],P=t[26]);let F=j?.message??null,I;t[27]!==O||t[28]!==k||t[29]!==M||t[30]!==A||t[31]!==F?(I=(0,Q.jsxs)(Q.Fragment,{children:[P,(0,Q.jsx)(sn,{action:M,error:A,isRestartAvailableNotice:O,restartAvailableNotice:k,statusMessage:F})]}),t[27]=O,t[28]=k,t[29]=M,t[30]=A,t[31]=F,t[32]=I):I=t[32];let te;t[33]!==n||t[34]!==m||t[35]!==g?(te=(0,Q.jsx)(hn,{connection:n,error:m,state:g}),t[33]=n,t[34]=m,t[35]=g,t[36]=te):te=t[36];let L;t[37]!==_||t[38]!==f?(L=f.formatMessage({id:`settings.remoteConnections.table.actions.ariaLabel`,defaultMessage:`{connectionName} actions`,description:`Screen reader label for the remote connection actions menu`},{connectionName:_}),t[37]=_,t[38]=f,t[39]=L):L=t[39];let ne;t[40]!==n.hostId||t[41]!==o?(ne=()=>o(n.hostId),t[40]=n.hostId,t[41]=o,t[42]=ne):ne=t[42];let R;t[43]!==n||t[44]!==u?(R=()=>u(n),t[43]=n,t[44]=u,t[45]=R):R=t[45];let V=D?T:void 0,H;t[46]!==D||t[47]!==n.hostId?(H=D?()=>{mn(n.hostId)}:void 0,t[46]=D,t[47]=n.hostId,t[48]=H):H=t[48];let U;t[49]!==n.hostId||t[50]!==c||t[51]!==g?(U=g===`connected`?()=>c(n.hostId):void 0,t[49]=n.hostId,t[50]=c,t[51]=g,t[52]=U):U=t[52];let ie;t[53]!==n.hostId||t[54]!==l?(ie=()=>l(n.hostId),t[53]=n.hostId,t[54]=l,t[55]=ie):ie=t[55];let W;t[56]!==x||t[57]!==C||t[58]!==r||t[59]!==y||t[60]!==L||t[61]!==ne||t[62]!==R||t[63]!==V||t[64]!==H||t[65]!==U||t[66]!==ie?(W=(0,Q.jsx)(Qt,{actionsLabel:L,editLabel:y,editTooltip:y,editDisabled:r,onEdit:ne,detailsLabel:C,onDetails:R,restartLabel:V,onRestart:H,onLogout:U,deleteLabel:x,deleteTooltip:x,deleteDisabled:r,onDelete:ie}),t[56]=x,t[57]=C,t[58]=r,t[59]=y,t[60]=L,t[61]=ne,t[62]=R,t[63]=V,t[64]=H,t[65]=U,t[66]=ie,t[67]=W):W=t[67];let ae=n.autoConnect,G;t[68]!==n.hostId||t[69]!==d?(G=e=>d(n.hostId,e),t[68]=n.hostId,t[69]=d,t[70]=G):G=t[70];let K;t[71]!==n.displayName||t[72]!==f?(K=f.formatMessage({id:`settings.remoteConnections.table.autoConnect.ariaLabel`,defaultMessage:`Connect {connectionName}`,description:`Screen reader label for the remote connection toggle`},{connectionName:n.displayName}),t[71]=n.displayName,t[72]=f,t[73]=K):K=t[73];let q;t[74]!==n.autoConnect||t[75]!==G||t[76]!==K?(q=(0,Q.jsx)(Le,{checked:ae,onChange:G,ariaLabel:K}),t[74]=n.autoConnect,t[75]=G,t[76]=K,t[77]=q):q=t[77];let J;t[78]!==W||t[79]!==q?(J=(0,Q.jsxs)(`div`,{className:`flex items-center gap-2`,children:[W,q]}),t[78]=W,t[79]=q,t[80]=J):J=t[80];let Y;return t[81]!==_||t[82]!==te||t[83]!==J||t[84]!==I?(Y=(0,Q.jsx)($t,{displayName:_,icon:N,description:I,status:te,control:J}),t[81]=_,t[82]=te,t[83]=J,t[84]=I,t[85]=Y):Y=t[85],Y}function dn({error:e,restartAvailableNotice:t,state:n}){return n===`error`?{statusError:e??(t==null?null:a(t)),isRestartAvailableNotice:!1,statusState:`error`}:t==null?{statusError:null,isRestartAvailableNotice:!1,statusState:n}:{statusError:a(t),isRestartAvailableNotice:e==null,statusState:`error`}}function fn({appServerVersion:e,installedCodexVersion:t,state:n}){return n==null||e==null||t==null||!s({appServerVersion:e,installedCodexVersion:t})?null:{currentVersion:e,installedVersion:t}}function pn({action:e,disabled:t,hostId:n,installCodexPending:r,onAuthenticate:i,onInstallCodex:a}){if(e==null)return null;switch(e.kind){case`install-codex`:return{disabled:t,label:e.label,loading:r,loadingLabel:e.loadingLabel,renderInElectronOnly:!0,tooltipText:e.tooltipText,onClick:()=>a(n)};case`login`:return{label:e.label,onClick:()=>i(n)};case`restart`:return e.tooltipText==null?{label:e.label,onClick:()=>mn(n)}:{label:e.label,tooltipText:e.tooltipText,onClick:()=>mn(n)};case`settings`:return null}}function mn(e){F.dispatchMessage(`codex-app-server-restart`,{hostId:e,killCodexProcess:!0})}function hn(e){let t=(0,$.c)(18),{connection:n,error:r,state:i}=e,a=z();if(i===`error`){let e;t[0]!==r||t[1]!==a||t[2]!==i?(e=Ne(a,{canLogin:!1,error:r,state:i,surface:`connections-row`}),t[0]=r,t[1]=a,t[2]=i,t[3]=e):e=t[3];let{label:n,message:o}=e,s;t[4]===n?s=t[5]:(s=(0,Q.jsx)(`span`,{"aria-label":n,className:`block size-2 rounded-full bg-token-charts-red`,role:`img`}),t[4]=n,t[5]=s);let c;return t[6]!==o||t[7]!==s?(c=(0,Q.jsx)(J,{tooltipContent:o,children:s}),t[6]=o,t[7]=s,t[8]=c):c=t[8],c}if(i!=null){let e;return t[9]===n.hostId?e=t[10]:(e=(0,Q.jsx)(Pe,{hostId:n.hostId}),t[9]=n.hostId,t[10]=e),e}let o;t[11]===a?o=t[12]:(o=a.formatMessage({id:`threadPage.remoteConnectionStatusBadge.disconnected`,defaultMessage:`Disconnected`,description:`Label shown when remote connection is unavailable`}),t[11]=a,t[12]=o);let s=o,c;t[13]===s?c=t[14]:(c=(0,Q.jsx)(`span`,{"aria-label":s,className:`block size-2 rounded-full bg-gray-400`,role:`img`}),t[13]=s,t[14]=c);let l;return t[15]!==s||t[16]!==c?(l=(0,Q.jsx)(J,{tooltipContent:s,children:c}),t[15]=s,t[16]=c,t[17]=l):l=t[17],l}var gn=`—`;function _n({connections:e,clientAuthorized:t,disabled:n,installingCodexHostId:r,showEmptyState:i,emptyState:a,onEditSshConnection:o,onInstallCodex:s,onLogoutConnection:c,onRemoveSshConnection:l,onRenameRemoteControlConnection:u,onRequestDeleteRemoteControlConnection:d,onToggleConnection:f,onAuthenticate:p}){let[m,h]=(0,Z.useState)(null),[g,_]=(0,Z.useState)(null),[v,y]=(0,Z.useState)(null),b=async(e,t)=>{if(g==null){_(e.envId);try{await u(e.envId,t),h(null)}catch{return}finally{_(null)}}};return(0,Q.jsxs)(Q.Fragment,{children:[e.length===0&&i?(0,Q.jsx)(qe,{children:a??(0,Q.jsx)(B,{id:`settings.remoteConnections.deviceConnections.empty`,defaultMessage:`No device connections found. Add a new connection to get started`,description:`Empty state for the device connections settings table`})}):null,e.map(e=>e.source===`remote-control`?(0,Q.jsx)(nn,{connection:e,clientAuthorized:t,disabled:n,isEditing:m===e.envId,isRenamePending:g!=null,isSaving:g===e.envId,onCancelEditing:()=>{h(null)},onLogoutConnection:c,onRequestDelete:d,onSave:b,onShowDetails:y,onStartEditing:()=>{h(e.envId)},onToggleConnection:f},e.hostId):(0,Q.jsx)(un,{connection:e,disabled:n,installCodexPending:r===e.hostId,onAuthenticate:p,onEdit:o,onInstallCodex:s,onLogoutConnection:c,onRemove:l,onShowDetails:y,onToggleConnection:f},e.hostId)),(0,Q.jsx)(vn,{connection:v,onOpenChange:e=>{e||y(null)}})]})}function vn(e){let t=(0,$.c)(6),{connection:n,onOpenChange:r}=e,i=n!=null,a;t[0]===n?a=t[1]:(a=n==null?null:(0,Q.jsx)(yn,{connection:n}),t[0]=n,t[1]=a);let o;return t[2]!==r||t[3]!==i||t[4]!==a?(o=(0,Q.jsx)(Se,{open:i,onOpenChange:r,contentClassName:`bg-token-bg-primary`,dialogCloseClassName:`[&>svg]:icon-sm`,children:a}),t[2]=r,t[3]=i,t[4]=a,t[5]=o):o=t[5],o}function yn(e){let t=(0,$.c)(21),{connection:n}=e,{appServerVersion:r,error:i,state:a}=Ae(n.hostId),o=K(),s=n.source===`remote-control`,c;t[0]!==n||t[1]!==i||t[2]!==s||t[3]!==a?(c=s?(0,Q.jsxs)(bn,{children:[(0,Q.jsx)(rn,{connection:n,state:a}),(0,Q.jsx)(B,{id:`settings.remoteConnections.deviceConnections.signedInDeviceSubtitle`,defaultMessage:`Signed in device`,description:`Subtitle for signed-in-device rows in the device connections table`})]}):(0,Q.jsx)(xn,{connection:n,error:i,state:a}),t[0]=n,t[1]=i,t[2]=s,t[3]=a,t[4]=c):c=t[4];let l;t[5]!==n.displayName||t[6]!==c?(l=(0,Q.jsx)(X,{children:(0,Q.jsx)(xe,{title:n.displayName,titleClassName:`break-words pr-8 text-lg leading-snug`,className:`gap-2`,subtitle:c})}),t[5]=n.displayName,t[6]=c,t[7]=l):l=t[7];let u;t[8]!==r||t[9]!==n||t[10]!==a?(u=(0,Q.jsx)(X,{className:`pt-0`,children:(0,Q.jsx)(wn,{connection:n,state:a,appServerVersion:r})}),t[8]=r,t[9]=n,t[10]=a,t[11]=u):u=t[11];let d;t[12]!==n||t[13]!==s||t[14]!==o||t[15]!==a?(d=!s&&o&&a===`connected`?(0,Q.jsx)(Cn,{connection:n}):null,t[12]=n,t[13]=s,t[14]=o,t[15]=a,t[16]=d):d=t[16];let f;return t[17]!==l||t[18]!==u||t[19]!==d?(f=(0,Q.jsxs)(Ce,{className:`gap-2 px-6 py-5`,children:[l,u,d]}),t[17]=l,t[18]=u,t[19]=d,t[20]=f):f=t[20],f}function bn(e){let t=(0,$.c)(2),{children:n}=e,r;return t[0]===n?r=t[1]:(r=(0,Q.jsx)(`span`,{className:`inline-flex items-center gap-0.5 rounded-full bg-token-foreground/10 py-0.5 pr-2 pl-1 text-xs font-medium text-token-text-primary`,children:n}),t[0]=n,t[1]=r),r}function xn(e){let t=(0,$.c)(4),{connection:n,error:r,state:i}=e,a;return t[0]!==n||t[1]!==r||t[2]!==i?(a=(0,Q.jsx)(Sn,{connection:n,error:r,state:i}),t[0]=n,t[1]=r,t[2]=i,t[3]=a):a=t[3],a}function Sn(e){let t=(0,$.c)(7),{connection:n,error:r,state:i}=e,a;t[0]!==n||t[1]!==r||t[2]!==i?(a=(0,Q.jsx)(hn,{connection:n,error:r,state:i}),t[0]=n,t[1]=r,t[2]=i,t[3]=a):a=t[3];let o;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,Q.jsx)(B,{id:`settings.remoteConnections.deviceConnections.sshSubtitle`,defaultMessage:`SSH`,description:`Subtitle for SSH-backed rows in the device connections table`}),t[4]=o):o=t[4];let s;return t[5]===a?s=t[6]:(s=(0,Q.jsxs)(bn,{children:[a,o]}),t[5]=a,t[6]=s),s}function Cn(e){let t=(0,$.c)(15),{connection:n}=e,r=j(te),i=z(),a=M(_,n.hostId),o;t[0]===n.hostId?o=t[1]:(o={hostId:n.hostId},t[0]=n.hostId,t[1]=o);let s=et(o),c,l;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,Q.jsx)(B,{id:`settings.remoteConnections.details.availableFromSignedInDevices`,defaultMessage:`Available from signed-in devices`,description:`Label for making an SSH connection available to signed-in Codex clients`}),l=(0,Q.jsx)(B,{id:`settings.remoteConnections.details.availableFromSignedInDevicesDescription`,defaultMessage:`Allow Codex apps signed into your account to use this device`,description:`Description for making an SSH connection available to signed-in Codex clients`}),t[2]=c,t[3]=l):(c=t[2],l=t[3]);let u=s.isPending,d;t[4]!==i||t[5]!==r||t[6]!==s?(d=e=>{s.mutate(e,{onError:()=>{r.get(q).danger(i.formatMessage({id:`settings.remoteConnections.details.availableFromSignedInDevicesUpdateError`,defaultMessage:`Couldn’t update signed-in device availability`,description:`Toast shown when updating signed-in-device availability for an SSH connection fails`}))}})},t[4]=i,t[5]=r,t[6]=s,t[7]=d):d=t[7];let f;t[8]===i?f=t[9]:(f=i.formatMessage({id:`settings.remoteConnections.details.availableFromSignedInDevices`,defaultMessage:`Available from signed-in devices`,description:`Label for making an SSH connection available to signed-in Codex clients`}),t[8]=i,t[9]=f);let p;return t[10]!==a||t[11]!==s.isPending||t[12]!==d||t[13]!==f?(p=(0,Q.jsx)(X,{className:`pt-0`,children:(0,Q.jsx)(Ge,{children:(0,Q.jsx)(We,{label:c,description:l,control:(0,Q.jsx)(Le,{checked:a,disabled:u,onChange:d,ariaLabel:f})})})}),t[10]=a,t[11]=s.isPending,t[12]=d,t[13]=f,t[14]=p):p=t[14],p}function wn(e){let t=(0,$.c)(15),{appServerVersion:n,connection:r,state:i}=e,a=j(te),o=z(),s,c;if(t[0]!==n||t[1]!==r||t[2]!==o||t[3]!==a||t[4]!==i){let e=Tn(r,i,n),l;t[7]!==o||t[8]!==a?(l=(e,t)=>{ve(e,t).then(()=>{a.get(q).info(o.formatMessage({id:`settings.remoteConnections.details.copySuccess`,defaultMessage:`Copied to clipboard`,description:`Toast shown after copying a remote connection detail value`}))},()=>{a.get(q).danger(o.formatMessage({id:`settings.remoteConnections.details.copyError`,defaultMessage:`Failed to copy value`,description:`Toast shown when copying a remote connection detail value fails`}))})},t[7]=o,t[8]=a,t[9]=l):l=t[9];let u=l;s=`overflow-hidden rounded-xl border border-token-border`;let d;t[10]===u?d=t[11]:(d=e=>{let t=e.copyValue,n=typeof e.value==`string`?(0,Q.jsx)(Yt,{value:e.value}):e.value;return(0,Q.jsxs)(`div`,{className:`flex min-h-9 items-center justify-between gap-3 border-t border-token-border px-3 py-2 first:border-t-0`,children:[(0,Q.jsx)(`div`,{className:`shrink-0 text-sm text-token-text-secondary`,children:e.label}),(0,Q.jsx)(`div`,{className:`max-w-[80%] min-w-0 text-right text-sm text-token-text-primary`,children:t==null?n:(0,Q.jsx)(`button`,{type:`button`,className:`block max-w-full min-w-0 cursor-interaction text-right`,onClick:e=>{u(t,e)},children:n})})]},e.id)},t[10]=u,t[11]=d),c=e.map(d),t[0]=n,t[1]=r,t[2]=o,t[3]=a,t[4]=i,t[5]=s,t[6]=c}else s=t[5],c=t[6];let l;return t[12]!==s||t[13]!==c?(l=(0,Q.jsx)(`div`,{className:s,children:c}),t[12]=s,t[13]=c,t[14]=l):l=t[14],l}function Tn(e,t,n){if(e.source===`remote-control`){let t=e.hostName||gn,n=En(e),r=e.appServerVersion||gn;return[{copyValue:e.hostName||null,id:`host`,label:(0,Q.jsx)(B,{id:`settings.remoteControlConnections.details.host`,defaultMessage:`Host`,description:`Modal label for a signed-in device host name`}),value:t},{copyValue:n===gn?null:n,id:`platform`,label:(0,Q.jsx)(B,{id:`settings.remoteControlConnections.details.platform`,defaultMessage:`OS / arch`,description:`Modal label for remote control OS and architecture`}),value:n},{copyValue:e.appServerVersion||null,id:`version`,label:(0,Q.jsx)(B,{id:`settings.remoteControlConnections.details.version`,defaultMessage:`Version`,description:`Modal label for remote control app-server version`}),value:r},{copyValue:e.lastSeenAt,id:`lastSeen`,label:(0,Q.jsx)(B,{id:`settings.remoteControlConnections.details.lastSeen`,defaultMessage:`Last seen`,description:`Modal label for when a signed-in device was last seen`}),value:e.lastSeenAt==null?gn:(0,Q.jsx)(je,{dateString:e.lastSeenAt})}]}let r=[],i=e.sshAlias?.trim();e.source===`discovered`&&i&&r.push({copyValue:i,id:`alias`,label:(0,Q.jsx)(B,{id:`settings.remoteConnections.details.alias`,defaultMessage:`Alias`,description:`Modal label for a discovered SSH connection alias`}),value:i}),r.push({copyValue:e.sshHost,id:`host`,label:(0,Q.jsx)(B,{id:`settings.remoteConnections.details.host`,defaultMessage:`Host`,description:`Modal label for an SSH connection host name`}),value:e.sshHost},{copyValue:e.sshPort==null?null:String(e.sshPort),id:`port`,label:(0,Q.jsx)(B,{id:`settings.remoteConnections.details.port`,defaultMessage:`Port`,description:`Modal label for SSH connection port`}),value:e.sshPort==null?gn:String(e.sshPort)},{copyValue:e.identity,id:`identity`,label:(0,Q.jsx)(B,{id:`settings.remoteConnections.details.identity`,defaultMessage:`Identity`,description:`Modal label for SSH connection identity file`}),value:e.identity??gn});let a=n?.trim();return t===`connected`&&a!=null&&a.length>0&&r.push({copyValue:a,id:`version`,label:(0,Q.jsx)(B,{id:`settings.remoteConnections.details.version`,defaultMessage:`Version`,description:`Modal label for SSH connection app-server version`}),value:a}),r}function En(e){let t=[e.os,e.arch].filter(e=>e.trim().length>0);return t.length>0?t.join(` / `):gn}var Dn=``+new URL(`remote-control-authorization-dialog-artwork-BDkdoGfj.png`,import.meta.url).href;function On(e){let t=(0,$.c)(29),{authorizing:n,open:r,onAuthorize:i,onOpenChange:a}=e,o=z(),{platform:s}=ue(),c;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(c={"aria-describedby":void 0},t[0]=c):c=t[0];let l;t[1]!==o||t[2]!==s?(l=s===`windows`?o.formatMessage({id:`settings.remoteConnections.authorizationDialog.title.windows`,defaultMessage:`Control other devices from this PC`,description:`Accessible title for the modal that authorizes this Windows device to control other devices`}):o.formatMessage({id:`settings.remoteConnections.authorizationDialog.title`,defaultMessage:`Control other devices from this Mac`,description:`Accessible title for the modal that authorizes this Mac to control other devices`}),t[1]=o,t[2]=s,t[3]=l):l=t[3];let u;t[4]===l?u=t[5]:(u=(0,Q.jsx)(be,{className:`sr-only`,children:l}),t[4]=l,t[5]=u);let d;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,Q.jsx)(kn,{}),t[6]=d):d=t[6];let f;t[7]===s?f=t[8]:(f=(0,Q.jsx)(`div`,{className:`heading-dialog font-semibold`,children:s===`windows`?(0,Q.jsx)(B,{id:`settings.remoteConnections.authorizationDialog.heading.windows`,defaultMessage:`Control other devices from this PC`,description:`Heading for the modal that authorizes this Windows device to control other devices`}):(0,Q.jsx)(B,{id:`settings.remoteConnections.authorizationDialog.heading`,defaultMessage:`Control other devices from this Mac`,description:`Heading for the modal that authorizes this Mac to control other devices`})}),t[7]=s,t[8]=f);let p;t[9]===s?p=t[10]:(p=(0,Q.jsx)(`div`,{className:`text-base leading-normal tracking-normal text-token-description-foreground`,children:s===`windows`?(0,Q.jsx)(B,{id:`settings.remoteConnections.authorizationDialog.description.windows`,defaultMessage:`Authorize this PC to control other devices signed in to your ChatGPT account`,description:`Description for the modal that authorizes this Windows device to control other devices`}):(0,Q.jsx)(B,{id:`settings.remoteConnections.authorizationDialog.description`,defaultMessage:`Authorize this Mac to control other devices signed in to your ChatGPT account`,description:`Description for the modal that authorizes this Mac to control other devices`})}),t[9]=s,t[10]=p);let m;t[11]!==f||t[12]!==p?(m=(0,Q.jsxs)(`div`,{className:`flex flex-col gap-2 text-center`,children:[f,p]}),t[11]=f,t[12]=p,t[13]=m):m=t[13];let h;t[14]===Symbol.for(`react.memo_cache_sentinel`)?(h=(0,Q.jsx)(Ye,{variant:`dialog`}),t[14]=h):h=t[14];let g;t[15]===Symbol.for(`react.memo_cache_sentinel`)?(g=(0,Q.jsx)(B,{id:`settings.remoteConnections.authorizationDialog.authorize`,defaultMessage:`Authorize on chatgpt.com`,description:`Primary action for authorizing this Mac to control other devices`}),t[15]=g):g=t[15];let _;t[16]!==n||t[17]!==i?(_=(0,Q.jsx)(Y,{size:`large`,loading:n,onClick:i,children:g}),t[16]=n,t[17]=i,t[18]=_):_=t[18];let v;t[19]!==_||t[20]!==m?(v=(0,Q.jsxs)(`div`,{className:`flex flex-col items-center gap-6 px-8 py-6`,children:[m,h,_]}),t[19]=_,t[20]=m,t[21]=v):v=t[21];let y;t[22]!==v||t[23]!==u?(y=(0,Q.jsxs)(`div`,{className:`pointer-events-auto flex flex-col overflow-hidden`,children:[u,d,v]}),t[22]=v,t[23]=u,t[24]=y):y=t[24];let b;return t[25]!==a||t[26]!==r||t[27]!==y?(b=(0,Q.jsx)(Se,{open:r,onOpenChange:a,contentProps:c,contentClassName:`w-[460px]`,size:`feature`,children:y}),t[25]=a,t[26]=r,t[27]=y,t[28]=b):b=t[28],b}function kn(){let e=(0,$.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,Q.jsx)(`div`,{className:`relative h-[214px] overflow-hidden`,children:(0,Q.jsx)(`img`,{alt:``,"aria-hidden":!0,className:`h-full w-full object-cover`,src:Dn})}),e[0]=t):t=e[0],t}function An(e){let t=(0,$.c)(32),{connections:n,refreshing:r,isSaving:i,open:a,onOpenChange:o,onRefresh:s,onSave:c,onToggleConnection:l,selectedEnvIds:u}=e,d=z(),f;t[0]===c?f=t[1]:(f=e=>{e.preventDefault(),c()},t[0]=c,t[1]=f);let p=f,m;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(m=(0,Q.jsx)(B,{id:`settings.remoteConnections.remoteControlDiscoveryDialog.empty`,defaultMessage:`No signed-in devices available`,description:`Empty state shown when there are no signed-in devices to add`}),t[2]=m):m=t[2];let h;t[3]===d?h=t[4]:(h=d.formatMessage({id:`settings.remoteConnections.remoteControlDiscoveryDialog.refresh`,defaultMessage:`Refresh`,description:`Accessible label for refreshing available signed-in devices in the add-device dialog`}),t[3]=d,t[4]=h);let g=r||i,_;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(_=(0,Q.jsx)(Re,{className:`icon-sm`}),t[5]=_):_=t[5];let v;t[6]!==s||t[7]!==r||t[8]!==h||t[9]!==g?(v=(0,Q.jsx)(Y,{"aria-label":h,color:`ghost`,size:`icon`,disabled:g,loading:r,onClick:s,children:_}),t[6]=s,t[7]=r,t[8]=h,t[9]=g,t[10]=v):v=t[10];let y;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(y=(0,Q.jsx)(Pn,{}),t[11]=y):y=t[11];let b;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(b=(0,Q.jsx)(J,{interactive:!0,side:`top`,tooltipBodyClassName:`max-w-[320px]`,tooltipContent:y,children:(0,Q.jsx)(`button`,{type:`button`,className:`min-w-0 flex-1 cursor-interaction text-left text-sm text-token-text-primary`,children:(0,Q.jsx)(B,{id:`settings.remoteConnections.remoteControlDiscoveryDialog.missingDevice`,defaultMessage:`Don’t see your device here?`,description:`Tooltip trigger that explains how to make another device discoverable`})})}),t[12]=b):b=t[12];let x=n.length===0||i,S;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(S=(0,Q.jsx)(B,{id:`settings.remoteConnections.remoteControlDiscoveryDialog.save`,defaultMessage:`Add`,description:`Primary action that adds selected signed-in devices`}),t[13]=S):S=t[13];let C;t[14]===x?C=t[15]:(C=(0,Q.jsx)(Y,{type:`submit`,size:`large`,disabled:x,children:S}),t[14]=x,t[15]=C);let w;t[16]!==C||t[17]!==v?(w=(0,Q.jsxs)(`div`,{className:`flex items-center gap-3`,children:[v,b,C]}),t[16]=C,t[17]=v,t[18]=w):w=t[18];let T;t[19]!==n||t[20]!==d||t[21]!==i||t[22]!==l||t[23]!==u?(T=n.length===0?null:n.map(e=>{let t=u.includes(e.envId);return(0,Q.jsx)(`div`,{"aria-disabled":i,className:i?`cursor-not-allowed`:`cursor-interaction`,onClick:i?void 0:()=>{l(e.envId)},onKeyDown:i?void 0:t=>{t.key!==`Enter`&&t.key!==` `||(t.preventDefault(),l(e.envId))},role:`button`,tabIndex:i?-1:0,children:(0,Q.jsx)(We,{icon:ht(e),label:e.displayName,description:(0,Q.jsx)(Nn,{connection:e}),control:(0,Q.jsx)(`div`,{className:`relative flex items-center`,onClick:Mn,onKeyDown:jn,children:(0,Q.jsx)(Ee,{"aria-label":d.formatMessage({id:`settings.remoteConnections.remoteControlDiscoveryDialog.toggleSelection`,defaultMessage:`Select {connectionName}`,description:`Accessible label for staging a signed-in device with a checkbox`},{connectionName:e.displayName}),checked:t,disabled:i,onCheckedChange:()=>{l(e.envId)}})})})},e.envId)}),t[19]=n,t[20]=d,t[21]=i,t[22]=l,t[23]=u,t[24]=T):T=t[24];let E;t[25]===Symbol.for(`react.memo_cache_sentinel`)?(E=(0,Q.jsx)(B,{id:`settings.remoteConnections.remoteControlDiscoveryDialog.title`,defaultMessage:`Add device`,description:`Title for the dialog that lets users add a signed-in device`}),t[25]=E):E=t[25];let D;return t[26]!==p||t[27]!==o||t[28]!==a||t[29]!==w||t[30]!==T?(D=(0,Q.jsx)(At,{emptyState:m,footer:w,list:T,open:a,title:E,onOpenChange:o,onSubmit:p}),t[26]=p,t[27]=o,t[28]=a,t[29]=w,t[30]=T,t[31]=D):D=t[31],D}function jn(e){e.stopPropagation()}function Mn(e){e.stopPropagation()}function Nn(e){let t=(0,$.c)(8),{connection:n}=e,r=n.online?`block size-2 rounded-full bg-token-charts-green`:`block size-2 rounded-full bg-gray-400`,i;t[0]===r?i=t[1]:(i=(0,Q.jsx)(`span`,{className:r}),t[0]=r,t[1]=i);let a;t[2]!==n.lastSeenAt||t[3]!==n.online?(a=n.online?(0,Q.jsx)(B,{id:`settings.remoteConnections.remoteControlDiscoveryDialog.online`,defaultMessage:`Online`,description:`Status label for an available signed-in device in the add-device dialog`}):n.lastSeenAt==null?(0,Q.jsx)(B,{id:`settings.remoteConnections.remoteControlDiscoveryDialog.offline`,defaultMessage:`Offline`,description:`Status label for an unavailable signed-in device in the add-device dialog`}):(0,Q.jsx)(B,{id:`settings.remoteConnections.remoteControlDiscoveryDialog.lastUsed`,defaultMessage:`Last used {date}`,description:`Status label for a signed-in device that was seen previously in the add-device dialog`,values:{date:(0,Q.jsx)(je,{dateString:n.lastSeenAt},`last-used-at`)}}),t[2]=n.lastSeenAt,t[3]=n.online,t[4]=a):a=t[4];let o;return t[5]!==i||t[6]!==a?(o=(0,Q.jsxs)(`div`,{className:`flex items-center gap-2`,children:[i,a]}),t[5]=i,t[6]=a,t[7]=o):o=t[7],o}function Pn(){let e=(0,$.c)(5),{platform:t}=ue(),n,r;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,Q.jsx)(`li`,{children:(0,Q.jsx)(B,{id:`settings.remoteConnections.remoteControlDiscoveryDialog.tooltip.openApp`,defaultMessage:`Go to the Codex app on your device`,description:`First tooltip step for making another device discoverable`})}),r=(0,Q.jsx)(`li`,{children:(0,Q.jsx)(B,{id:`settings.remoteConnections.remoteControlDiscoveryDialog.tooltip.openConnections`,defaultMessage:`Open Connections tab`,description:`Second tooltip step for making another device discoverable`})}),e[0]=n,e[1]=r):(n=e[0],r=e[1]);let i;e[2]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,Q.jsxs)(`ol`,{className:`list-decimal space-y-0 pl-4`,children:[n,r,(0,Q.jsx)(`li`,{children:(0,Q.jsx)(B,{id:`settings.remoteConnections.remoteControlDiscoveryDialog.tooltip.clickSetup`,defaultMessage:`Click “{setupLabel}” to make your device discoverable`,description:`Third tooltip step for making another device discoverable`,values:{setupLabel:(0,Q.jsx)(`strong`,{children:(0,Q.jsx)(B,{id:`settings.remoteConnections.remoteControlDiscoveryDialog.tooltip.setupLabel`,defaultMessage:`Set up`,description:`Inline button label quoted inside the missing-device tooltip`})})}})})]}),e[2]=i):i=e[2];let a;return e[3]===t?a=e[4]:(a=(0,Q.jsxs)(`div`,{className:`space-y-4 text-left`,children:[i,(0,Q.jsx)(`div`,{children:(0,Q.jsx)(B,{id:`settings.remoteConnections.remoteControlDiscoveryDialog.tooltip.enableHost`,defaultMessage:`Or turn on {settingLabel} if the device is already set up`,description:`Fallback tooltip guidance for making another device discoverable`,values:{settingLabel:(0,Q.jsx)(`strong`,{children:t===`windows`?(0,Q.jsx)(B,{id:`settings.remoteConnections.remoteControlDiscoveryDialog.tooltip.settingLabel.windows`,defaultMessage:`Allow this PC to be discovered and controlled`,description:`Inline settings label quoted inside the missing-device tooltip on Windows`}):(0,Q.jsx)(B,{id:`settings.remoteConnections.remoteControlDiscoveryDialog.tooltip.settingLabel`,defaultMessage:`Allow this Mac to be discovered and controlled`,description:`Inline settings label quoted inside the missing-device tooltip`})})}})})]}),e[3]=t,e[4]=a),a}function Fn(e){let t=(0,$.c)(27),{connection:n,open:r,isDeleting:i,onOpenChange:a,onConfirm:o}=e,s;t[0]===o?s=t[1]:(s=e=>{e.preventDefault(),o()},t[0]=o,t[1]=s);let c=s,l=n?.displayName??``,u;t[2]===l?u=t[3]:(u=(0,Q.jsx)(B,{id:`settings.remoteControlConnections.deleteDialog.title`,defaultMessage:`Delete {connectionName}?`,description:`Title for dialog confirming deletion of a remote control environment`,values:{connectionName:l}}),t[2]=l,t[3]=u);let d;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,Q.jsx)(B,{id:`settings.remoteControlConnections.deleteDialog.subtitle`,defaultMessage:`This removes the environment and its remote control threads from Codex. This cannot be undone.`,description:`Subtitle for dialog confirming deletion of a remote control environment`}),t[4]=d):d=t[4];let f;t[5]===u?f=t[6]:(f=(0,Q.jsx)(X,{children:(0,Q.jsx)(xe,{title:u,subtitle:d})}),t[5]=u,t[6]=f);let p;t[7]===a?p=t[8]:(p=()=>a(!1),t[7]=a,t[8]=p);let m;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(m=(0,Q.jsx)(B,{id:`settings.remoteControlConnections.deleteDialog.cancel`,defaultMessage:`Cancel`,description:`Cancel button label for remote control environment delete dialog`}),t[9]=m):m=t[9];let h;t[10]!==i||t[11]!==p?(h=(0,Q.jsx)(Y,{color:`ghost`,disabled:i,type:`button`,onClick:p,children:m}),t[10]=i,t[11]=p,t[12]=h):h=t[12];let g;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(g=(0,Q.jsx)(B,{id:`settings.remoteControlConnections.deleteDialog.confirm`,defaultMessage:`Delete`,description:`Confirm button label for remote control environment delete dialog`}),t[13]=g):g=t[13];let _;t[14]===i?_=t[15]:(_=(0,Q.jsx)(Y,{color:`danger`,loading:i,type:`submit`,children:g}),t[14]=i,t[15]=_);let v;t[16]!==_||t[17]!==h?(v=(0,Q.jsx)(X,{children:(0,Q.jsxs)(we,{children:[h,_]})}),t[16]=_,t[17]=h,t[18]=v):v=t[18];let y;t[19]!==c||t[20]!==v||t[21]!==f?(y=(0,Q.jsxs)(Ce,{as:`form`,onSubmit:c,children:[f,v]}),t[19]=c,t[20]=v,t[21]=f,t[22]=y):y=t[22];let b;return t[23]!==a||t[24]!==r||t[25]!==y?(b=(0,Q.jsx)(Se,{open:r,onOpenChange:a,size:`compact`,children:y}),t[23]=a,t[24]=r,t[25]=y,t[26]=b):b=t[26],b}function In({remoteControlConnectionsAuthorized:e,remoteControlConnectionsAuthRequired:t,showRemoteControlConnectionsSection:n}){return n&&!t&&!e}var Ln=`remote-connections-refresh-success`,Rn=`remote-connections-refresh-error`,zn=`remote-connections-save-success`,Bn=`remote-connections-save-error`,Vn=`remote-connections-connect-toggle-error`,Hn=`remote-connections-install-codex-error`,Un=`remote-connections-logout-error`,Wn=`remote-control-environment-rename-success`,Gn=`remote-control-environment-rename-error`,Kn=`remote-control-environment-delete-success`,qn=`remote-control-environment-delete-error`,Jn=`remote-control-authorize-success`,Yn=`remote-control-authorize-error`,Xn=`[remote-connections/settings]`,Zn=15e3,Qn=[],$n=[];function er(){let e=j(te),n=ee(U),r=ie(),i=z(),{platform:a}=ue(),o=re(`782640499`),s=i.formatMessage({id:`settings.remoteConnections.refresh`,defaultMessage:`Refresh`,description:`Button label to refresh remote connections`}),[c]=v(`remote_connections`),[l]=v(`remote_control_connections`),[p]=v(`remote_control_connections_state`),[m,_]=(0,Z.useState)(null),[O,k]=(0,Z.useState)(Qn),[A,M]=(0,Z.useState)([]),[F,L]=(0,Z.useState)([]),[V,K]=(0,Z.useState)(!1),[oe,se]=(0,Z.useState)(!1),[ce,le]=(0,Z.useState)(!1),[de,fe]=(0,Z.useState)(`control-this-mac`),[ge,_e]=(0,Z.useState)(null),[ve,ye]=(0,Z.useState)(null),X=me(),be=!o,xe=c==null,Se=X&&l==null,Ce=[...c??Qn].sort(tr),we=nr(l??$n),{data:Te}=W(u.ADDED_REMOTE_CONTROL_ENV_IDS),Ee=ae({addedRemoteControlEnvIds:Te,remoteControlConnections:we}),De=G({addedRemoteControlEnvIds:Te,remoteControlConnections:we}),Oe=Ee.length>0,ke=p?.authRequired===!0,Ae=p?.clientAuthorized===!0,je=In({remoteControlConnectionsAuthorized:Ae,remoteControlConnectionsAuthRequired:ke,showRemoteControlConnectionsSection:X}),Me=!Oe&&Ae&&!ke,Ne=Ce.map(e=>It(Ft(e),{connectionAnalyticsId:e.connectionAnalyticsId})),Pe=new Set(Ne.map(e=>e.hostId)),Fe=O.filter(e=>!Pe.has(e.hostId)),Ie=X&&!0,Le=be&&(X||!1),Be=he({selectedConnectionsTab:de,showControlOtherDevices:be,showControlThisMacTab:Ie,showRemoteControlConnectionsSection:X,showRemoteSshConnections:!0,showTabbedSshPage:X&&!0}),Ue=()=>{e.get(q).success(i.formatMessage({id:`settings.remoteConnections.refresh.success`,defaultMessage:`Refreshed remote connections`,description:`Toast shown when remote connections refresh successfully`}),{id:Ln})},We=t=>{I.warning(`${Xn} refresh_failed`,{safe:{},sensitive:{error:t}}),e.get(q).danger(t instanceof Error?t.message:i.formatMessage({id:`settings.remoteConnections.refresh.error`,defaultMessage:`Failed to refresh remote connections`,description:`Toast shown when remote connections fail to refresh`}),{id:Rn})},qe=R(`refresh-remote-connections`),Je=R(`discover-remote-ssh-connections`),Ye=R(`refresh-remote-control-connections`),Xe=R(`authorize-remote-control-connections`,{onSuccess:()=>{H(e,{eventName:`codex_remote_control_authorization_result`,metadata:{result:`succeeded`}}),e.get(q).success(i.formatMessage({id:`settings.remoteControlConnections.authorize.success`,defaultMessage:`Remote control authorized`,description:`Toast shown when remote control authorization succeeds`}),{id:Jn}),le(!1),L([]),se(!0)},onError:t=>{H(e,{eventName:`codex_remote_control_authorization_result`,metadata:{result:`failed`}}),I.warning(`${Xn} remote_control_authorize_failed`,{safe:{},sensitive:{error:t}}),e.get(q).danger(t instanceof P&&t.errorCode===`remote_control_enrollment_account_mismatch`?i.formatMessage({id:`settings.remoteControlConnections.authorize.accountMismatch`,defaultMessage:`Remote control authorization used a different account`,description:`Toast shown when remote control authorization completes for a different account`}):i.formatMessage({id:`settings.remoteControlConnections.authorize.error`,defaultMessage:`Failed to authorize remote control`,description:`Toast shown when remote control authorization fails`}),{id:Yn})}}),Ze=R(`save-codex-managed-remote-ssh-connections`,{onSuccess:()=>{e.get(q).success(i.formatMessage({id:`settings.remoteConnections.save.success`,defaultMessage:`Saved remote connections`,description:`Toast shown when remote connections are saved`}),{id:zn})},onError:t=>{I.warning(`${Xn} save_failed`,{safe:{},sensitive:{error:t}}),e.get(q).danger(i.formatMessage({id:`settings.remoteConnections.save.error`,defaultMessage:`Failed to save remote connections`,description:`Toast shown when remote connections fail to save`}),{id:Bn})}}),Qe=N({mutationFn:t=>w(e,u.ADDED_REMOTE_CONTROL_ENV_IDS,[...Te,...t])}),$e=R(`set-remote-connection-auto-connect`,{onError:(t,{autoConnect:r,hostId:a})=>{let o=Ce.find(e=>e.hostId===a);r&&o!=null&&x(n,{action:g.CODEX_REMOTE_SSH_CONNECTION_ACTION_CONNECT,result:b.CODEX_REMOTE_SSH_CONNECTION_RESULT_FAILED,source:S.CODEX_REMOTE_SSH_CONNECTION_EVENT_SOURCE_SETTINGS,connection:o,errorCategory:E.CODEX_REMOTE_SSH_CONNECTION_ERROR_CATEGORY_CONNECTION_FAILED}),I.warning(`${Xn} connect_toggle_failed`,{safe:{autoConnect:r},sensitive:{error:t,hostId:a}}),e.get(q).danger(i.formatMessage({id:`settings.remoteConnections.connectToggle.error`,defaultMessage:`Failed to update connection`,description:`Toast shown when remote connection toggle fails`}),{id:Vn})}}),et=R(`install-remote-codex`,{onError:(t,{hostId:n})=>{I.warning(`${Xn} install_remote_codex_failed`,{safe:{},sensitive:{error:t,hostId:n}}),e.get(q).danger(t instanceof Error?t.message:i.formatMessage({id:`settings.remoteConnections.installCodex.error`,defaultMessage:`Failed to install Codex`,description:`Toast shown when installing Codex on a remote connection fails`}),{id:Hn})}}),tt=R(`rename-remote-control-environment`,{onSuccess:()=>{e.get(q).success(i.formatMessage({id:`settings.remoteControlConnections.rename.success`,defaultMessage:`Renamed remote control environment`,description:`Toast shown when a remote control environment is renamed`}),{id:Wn})},onError:(t,{envId:n})=>{I.warning(`${Xn} remote_control_rename_failed`,{safe:{},sensitive:{envId:n,error:t}}),e.get(q).danger(i.formatMessage({id:`settings.remoteControlConnections.rename.error`,defaultMessage:`Failed to rename remote control environment`,description:`Toast shown when a remote control environment rename fails`}),{id:Gn})}}),nt=R(`delete-remote-control-environment`,{onSuccess:()=>{e.get(q).success(i.formatMessage({id:`settings.remoteControlConnections.delete.success`,defaultMessage:`Deleted remote control environment`,description:`Toast shown when a remote control environment is deleted`}),{id:Kn})},onError:(t,{envId:n})=>{I.warning(`${Xn} remote_control_delete_failed`,{safe:{},sensitive:{envId:n,error:t}}),e.get(q).danger(i.formatMessage({id:`settings.remoteControlConnections.delete.error`,defaultMessage:`Failed to delete remote control environment`,description:`Toast shown when a remote control environment delete fails`}),{id:qn})}}),rt=Ze.isPending,it=qe.isPending||Je.isPending||Ye.isPending||Xe.isPending||Ze.isPending||Qe.isPending||$e.isPending||et.isPending||tt.isPending||nt.isPending,at=t=>{r.getForHostId(t)??r.addManager(f(e,t,e.get(T,t)))},ot=async()=>{try{let e=[];x(n,{action:g.CODEX_REMOTE_SSH_CONNECTION_ACTION_REFRESH,result:b.CODEX_REMOTE_SSH_CONNECTION_RESULT_STARTED,source:S.CODEX_REMOTE_SSH_CONNECTION_EVENT_SOURCE_SETTINGS}),e.push(qe.mutateAsync(void 0).then(({remoteConnections:e})=>{n.logProductEvent(h,d(e))}).catch(e=>{throw x(n,{action:g.CODEX_REMOTE_SSH_CONNECTION_ACTION_REFRESH,result:b.CODEX_REMOTE_SSH_CONNECTION_RESULT_FAILED,source:S.CODEX_REMOTE_SSH_CONNECTION_EVENT_SOURCE_SETTINGS,errorCategory:E.CODEX_REMOTE_SSH_CONNECTION_ERROR_CATEGORY_UNKNOWN}),e})),X&&e.push(ht()),await Promise.all(e),Ue()}catch(e){We(e)}},ct=async()=>{let{discoveredRemoteConnections:e}=await Je.mutateAsync(void 0);k([...e].sort(tr))},$=async()=>{try{await ct(),M([]),K(!0)}catch(e){We(e)}},dt=e=>{L(t=>t.includes(e)?t.filter(t=>t!==e):[...t,e])},ft=()=>{if(Qe.isPending)return;let t=De.filter(e=>F.includes(e.envId)).map(e=>e.envId);if(t.length===0){se(!1);return}H(e,{eventName:`codex_remote_control_environment_add_clicked`,metadata:{addable_connection_count:De.length,existing_connection_count:Ee.length}}),Qe.mutate(t,{onSuccess:()=>{L([]),se(!1)}})},pt=()=>{L([]),se(!0)},mt=()=>{H(e,{eventName:`codex_remote_control_authorization_result`,metadata:{result:`started`}}),Xe.mutate(void 0)},ht=async()=>{let{remoteControlConnections:e}=await Ye.mutateAsync(void 0);n.logProductEvent(y,qt(e))},gt=(0,Z.useEffectEvent)(async e=>{if(!it)try{let t=[];t.push(ne(`refresh-remote-connections`,{signal:e})),X&&t.push(ne(`refresh-remote-control-connections`,{signal:e})),await Promise.all(t)}catch(e){if(e instanceof DOMException&&e.name===`AbortError`)return;I.debug(`${Xn} auto_refresh_failed`,{safe:{},sensitive:{error:e}})}});(0,Z.useEffect)(()=>{let e=null,t=!1,n=async()=>{if(!t){t=!0,e=new AbortController;try{await gt(e.signal)}finally{e=null,t=!1}}},r=window.setInterval(()=>{n()},Zn);return()=>{e?.abort(),window.clearInterval(r)}},[]);let _t=async()=>{if(ve!=null)try{await nt.mutateAsync({envId:ve.envId}),ye(null)}catch{}},vt=(t,n,i)=>{at(t),D(e,{error:i,hostId:t,source:`settings_sync_remote_connection_state`,state:n??`disconnected`}),r.notifyRegistryChanged()},bt=e=>{et.mutate({hostId:e},{onSuccess:({state:t,error:n})=>{vt(e,t,n)}})},xt=e=>{if(m==null||rt)return;let t=m.mode===`edit`?Ce.find(e=>e.hostId===m.hostId)??null:null,r=m.mode===`add`?!0:t?.autoConnect??!1,i=It(e,{connectionAnalyticsId:t?.connectionAnalyticsId}),a=m.mode===`add`?[...Ne,i]:Ne.filter(e=>e.hostId!==m.hostId).concat(i).sort(tr);Ze.mutate({remoteConnections:a},{onSuccess:({remoteConnections:e})=>{let t=e.find(e=>e.hostId===i.hostId)??i;x(n,{action:g.CODEX_REMOTE_SSH_CONNECTION_ACTION_SAVE_CONNECTION,result:b.CODEX_REMOTE_SSH_CONNECTION_RESULT_SUCCEEDED,source:S.CODEX_REMOTE_SSH_CONNECTION_EVENT_SOURCE_SETTINGS,connection:t});let a=m.mode===`add`&&m.returnToDiscoveryDialog;_(null),a&&K(!0),r&&Tt(i.hostId,!0)},onError:()=>{x(n,{action:g.CODEX_REMOTE_SSH_CONNECTION_ACTION_SAVE_CONNECTION,result:b.CODEX_REMOTE_SSH_CONNECTION_RESULT_FAILED,source:S.CODEX_REMOTE_SSH_CONNECTION_EVENT_SOURCE_SETTINGS,connection:i,errorCategory:E.CODEX_REMOTE_SSH_CONNECTION_ERROR_CATEGORY_UNKNOWN})}})},St=e=>{rt||Ze.mutate({remoteConnections:Ne.filter(t=>t.hostId!==e)})},Ct=e=>{M(t=>t.includes(e)?t.filter(t=>t!==e):[...t,e])},wt=()=>{if(rt)return;let e=Fe.filter(e=>A.includes(e.hostId));if(e.length===0){K(!1);return}let t=e.map(e=>It({...Ft(e),displayName:e.sshAlias?.trim()||e.displayName}));Ze.mutate({remoteConnections:[...Ne,...t].sort(tr)},{onSuccess:()=>{t.forEach(e=>{Tt(e.hostId,!0)}),M([]),K(!1)}})},Tt=(e,r)=>{rt||$e.mutate({hostId:e,autoConnect:r},{onSuccess:({remoteConnections:i,state:a,error:o})=>{vt(e,a,o);let s=i.find(n=>n.hostId===e&&t(n));if(r&&s!=null){let e=a===`connected`&&o==null;x(n,{action:g.CODEX_REMOTE_SSH_CONNECTION_ACTION_CONNECT,result:e?b.CODEX_REMOTE_SSH_CONNECTION_RESULT_SUCCEEDED:b.CODEX_REMOTE_SSH_CONNECTION_RESULT_FAILED,source:S.CODEX_REMOTE_SSH_CONNECTION_EVENT_SOURCE_SETTINGS,connection:s,connectionState:a,...e?{}:o==null?{errorCategory:E.CODEX_REMOTE_SSH_CONNECTION_ERROR_CATEGORY_UNKNOWN}:{connectionError:o}})}}})},Et=()=>{$()},Dt=async t=>{try{await C(`logout`,{hostId:t}),vt(t,`error`,{code:`login-required`})}catch(n){I.warning(`${Xn} logout_failed`,{safe:{},sensitive:{error:n,hostId:t}}),e.get(q).danger(i.formatMessage({id:`settings.remoteConnections.logout.error`,defaultMessage:`Failed to log out of connection`,description:`Toast shown when logging out of a remote connection fails`}),{id:Un})}},Ot=[{key:`access-other-devices`,name:(0,Q.jsx)(B,{id:`settings.remoteConnections.tabs.accessOtherDevices`,defaultMessage:`Control other devices`,description:`Tab label for settings that let this computer control other devices`})}],At=[{key:`control-this-mac`,name:a===`windows`?(0,Q.jsx)(B,{id:`settings.remoteConnections.tabs.controlThisMac.windows`,defaultMessage:`Control this PC`,description:`Tab label for settings that let other devices control this Windows device`}):(0,Q.jsx)(B,{id:`settings.remoteConnections.tabs.controlThisMac`,defaultMessage:`Control this Mac`,description:`Tab label for settings that let other devices control this computer`})}],Mt=[{key:`ssh`,name:(0,Q.jsx)(B,{id:`settings.remoteConnections.tabs.ssh`,defaultMessage:`SSH`,description:`Tab label for SSH remote connections`})}],Nt=[...Ie?At:[],...Le?Ot:[],...Mt];return(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(He,{title:(0,Q.jsx)(ze,{slug:`connections`}),subtitle:null,children:[Nt.length>=2?(0,Q.jsx)(st,{ariaLabel:i.formatMessage({id:`settings.remoteConnections.tabs.ariaLabel`,defaultMessage:`Connections view`,description:`Accessible label for the remote connections view selector`}),className:`w-full`,tabs:Nt,selectedKey:Be,variant:`underline`,onSelect:fe}):null,Be===`control-this-mac`?(0,Q.jsx)(pe,{electron:!0,children:(0,Q.jsx)(yt,{})}):null,be&&Be===`access-other-devices`&&je?(0,Q.jsxs)(Ke,{children:[(0,Q.jsx)(Ke.Header,{title:a===`windows`?(0,Q.jsx)(B,{id:`settings.remoteConnections.accessOtherDevices.devices.title.windows`,defaultMessage:`Devices you can control from this PC`,description:`Header title for the access other devices setup section on Windows`}):(0,Q.jsx)(B,{id:`settings.remoteConnections.accessOtherDevices.devices.title`,defaultMessage:`Devices you can control from this Mac`,description:`Header title for the access other devices setup section`})}),(0,Q.jsx)(Ke.Content,{children:(0,Q.jsx)(Ge,{children:(0,Q.jsx)(Ve,{spacing:`compact`,title:null,description:(0,Q.jsx)(B,{id:`settings.remoteConnections.accessOtherDevices.setup.description`,defaultMessage:`Access and control other devices from this computer`,description:`Description shown before this computer has been set up to access other devices`}),illustration:(0,Q.jsx)(lt,{className:`h-6 w-auto text-token-text-primary`}),actions:(0,Q.jsx)(Y,{color:`secondary`,disabled:it,onClick:()=>{le(!0)},children:(0,Q.jsx)(B,{id:`settings.remoteConnections.accessOtherDevices.setup.action`,defaultMessage:`Set up`,description:`Button label to authorize remote control from the access-other-devices setup state`})})})})})]}):null,be&&Be===`access-other-devices`&&!je?(0,Q.jsxs)(Ke,{children:[(0,Q.jsx)(Ke.Header,{title:a===`windows`?(0,Q.jsx)(B,{id:`settings.remoteConnections.accessOtherDevices.header.title.windows`,defaultMessage:`Devices you can control from this PC`,description:`Header title for the devices this Windows device can access`}):(0,Q.jsx)(B,{id:`settings.remoteConnections.accessOtherDevices.header.title`,defaultMessage:`Devices you can control from this Mac`,description:`Header title for the devices this computer can access`}),actions:(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(J,{tooltipContent:s,children:(0,Q.jsx)(Y,{"aria-label":s,color:`ghost`,size:`icon`,disabled:it,onClick:()=>{ot()},children:(0,Q.jsx)(Re,{className:`icon-xs`})})}),Oe?(0,Q.jsx)(Y,{color:`secondary`,disabled:it||ke,onClick:pt,children:(0,Q.jsx)(B,{id:`settings.remoteConnections.add.short`,defaultMessage:`Add`,description:`Button label for adding a connection from a connections settings tab`})}):null]})}),(0,Q.jsx)(Ke.Content,{children:Se?(0,Q.jsx)(Ge,{children:(0,Q.jsx)(`div`,{className:`p-3 text-sm text-token-text-secondary`,children:(0,Q.jsx)(B,{id:`settings.remoteConnections.accessOtherDevices.loading`,defaultMessage:`Loading devices…`,description:`Loading message for devices this computer can access`})})}):(0,Q.jsx)(Ge,{children:(0,Q.jsxs)(Q.Fragment,{children:[Me?(0,Q.jsx)(Ve,{spacing:`compact`,title:null,description:(0,Q.jsx)(B,{id:`settings.remoteConnections.accessOtherDevices.empty`,defaultMessage:`No devices added yet`,description:`Empty state for devices this computer can access`}),illustration:(0,Q.jsx)(lt,{className:`h-6 w-auto text-token-text-primary`}),actions:(0,Q.jsx)(Y,{color:`secondary`,disabled:it,onClick:pt,children:(0,Q.jsx)(B,{id:`settings.remoteConnections.add.short`,defaultMessage:`Add`,description:`Button label for adding a connection from a connections settings tab`})})}):(0,Q.jsx)(_n,{connections:Ee,disabled:it,clientAuthorized:Ae,installingCodexHostId:null,showEmptyState:!1,onEditSshConnection:()=>{},onInstallCodex:()=>{},onRemoveSshConnection:()=>{},onRenameRemoteControlConnection:async(e,t)=>{await tt.mutateAsync({envId:e,name:t})},onRequestDeleteRemoteControlConnection:ye,onToggleConnection:Tt,onLogoutConnection:e=>{Dt(e)},onAuthenticate:()=>{}}),ke?(0,Q.jsx)(`div`,{className:`p-3 text-sm text-token-text-secondary`,children:(0,Q.jsx)(B,{id:`settings.remoteControlConnections.authRequired`,defaultMessage:`Sign in to ChatGPT in Codex Desktop, then refresh to load remote control environments`,description:`Message shown when remote control environments require desktop ChatGPT auth`})}):null]})})})]}):null,Be===`ssh`?(0,Q.jsxs)(Ke,{children:[(0,Q.jsx)(Ke.Header,{title:a===`windows`?(0,Q.jsx)(B,{id:`settings.remoteConnections.ssh.header.title.windows`,defaultMessage:`SSH connections from this PC`,description:`Header title for SSH connections from this Windows device`}):(0,Q.jsx)(B,{id:`settings.remoteConnections.ssh.header.title`,defaultMessage:`SSH connections from this Mac`,description:`Header title for SSH connections from this Mac`}),actions:Ce.length>0?(0,Q.jsx)(Y,{color:`secondary`,disabled:rt,onClick:Et,children:(0,Q.jsx)(B,{id:`settings.remoteConnections.add.short`,defaultMessage:`Add`,description:`Button label for adding a connection from a connections settings tab`})}):null}),(0,Q.jsx)(Ke.Content,{children:(0,Q.jsx)(Ge,{children:xe?(0,Q.jsx)(`div`,{className:`p-3 text-sm text-token-text-secondary`,children:(0,Q.jsx)(B,{id:`settings.remoteConnections.ssh.loading`,defaultMessage:`Loading SSH connections…`,description:`Loading message for SSH connections`})}):Ce.length===0?(0,Q.jsx)(Ve,{spacing:`compact`,title:null,description:(0,Q.jsx)(B,{id:`settings.remoteConnections.ssh.empty`,defaultMessage:`Connect to a remote device through SSH connection`,description:`Empty state for SSH connections`}),illustration:(0,Q.jsx)(ut,{className:`h-6 w-auto text-token-text-primary`}),actions:(0,Q.jsx)(Y,{color:`secondary`,disabled:rt,onClick:Et,children:(0,Q.jsx)(B,{id:`settings.remoteConnections.add.short`,defaultMessage:`Add`,description:`Button label for adding a connection from a connections settings tab`})})}):(0,Q.jsx)(Q.Fragment,{children:(0,Q.jsx)(_n,{connections:Ce,disabled:it,clientAuthorized:Ae,installingCodexHostId:et.isPending?et.variables?.hostId??null:null,showEmptyState:!1,onEditSshConnection:e=>{let t=Ce.find(t=>t.hostId===e);t!=null&&_({mode:`edit`,hostId:e,draft:Ft(t)})},onInstallCodex:bt,onRemoveSshConnection:St,onRenameRemoteControlConnection:async()=>{},onRequestDeleteRemoteControlConnection:()=>{},onToggleConnection:Tt,onLogoutConnection:e=>{Dt(e)},onAuthenticate:e=>{at(e),_e(e)}})})})})]}):null]}),m==null?null:(0,Q.jsx)(Bt,{open:!0,mode:m.mode,draft:m.draft,existingConnections:Ce,editingHostId:m.mode===`edit`?m.hostId:null,onOpenChange:e=>{if(!e){let e=m.mode===`add`&&m.returnToDiscoveryDialog;_(null),e&&K(!0)}},onSubmit:xt,isSaving:Ze.isPending}),V?(0,Q.jsx)(jt,{connections:Fe,isSaving:Ze.isPending,open:!0,refreshing:Je.isPending,onAddManually:()=>{K(!1),_({mode:`add`,draft:Pt(),returnToDiscoveryDialog:!0})},onOpenChange:K,onRefresh:()=>{ct().catch(We)},onSave:wt,onToggleConnection:Ct,selectedHostIds:A}):null,be&&oe?(0,Q.jsx)(An,{connections:De,refreshing:Ye.isPending,isSaving:Qe.isPending,open:!0,onOpenChange:e=>{se(e),e||L([])},onRefresh:()=>{ht().catch(We)},onSave:ft,onToggleConnection:dt,selectedEnvIds:F}):null,be&&ce?(0,Q.jsx)(On,{authorizing:Xe.isPending,open:!0,onAuthorize:mt,onOpenChange:le}):null,(0,Q.jsx)(kt,{hostId:ge,open:ge!=null,onOpenChange:e=>{e||_e(null)}}),be?(0,Q.jsx)(Fn,{connection:ve,open:ve!=null,isDeleting:nt.isPending,onOpenChange:e=>{e||ye(null)},onConfirm:()=>{_t()}}):null]})}function tr(e,t){return e.displayName.localeCompare(t.displayName)}function nr(e){return[...e].sort((e,t)=>e.online&&t.online?tr(e,t):e.online===t.online?e.lastSeenAt!=null&&t.lastSeenAt==null?-1:e.lastSeenAt==null&&t.lastSeenAt!=null?1:e.lastSeenAt!=null&&t.lastSeenAt!=null&&e.lastSeenAt!==t.lastSeenAt?t.lastSeenAt.localeCompare(e.lastSeenAt):tr(e,t):e.online?-1:1)}export{er as RemoteConnectionsSettings}; //# sourceMappingURL=remote-connections-settings-mrv9fxOy.js.map \ No newline at end of file diff --git a/desktop/recovered/app-asar-extracted/webview/assets/use-plugin-install-flow-C0YRtVkW.js b/desktop/recovered/app-asar-extracted/webview/assets/use-plugin-install-flow-C0YRtVkW.js index 7faaffe2..7ea00165 100644 --- a/desktop/recovered/app-asar-extracted/webview/assets/use-plugin-install-flow-C0YRtVkW.js +++ b/desktop/recovered/app-asar-extracted/webview/assets/use-plugin-install-flow-C0YRtVkW.js @@ -1,2 +1,2 @@ -import{s as e}from"./chunk-Bj-mKKzh.js";import{$i as t,Li as n,Or as r,ia as i,jr as a}from"./src-CYrn1fYL.js";import{Os as o,Vo as s,bc as c,es as l,ji as u,ks as d,uo as f,yr as p}from"./app-server-manager-signals-BOGyjFm3.js";import{n as m,t as h}from"./jsx-runtime-CiQ1k8xo.js";import{t as g}from"./clsx-BcPLHiun.js";import{A as _,F as v,P as y,R as b,_ as x,f as S,g as C,h as w,lt as ee,n as T,o as te,r as E,u as D,v as O}from"./vscode-api-sUstfl-x.js";import{c as ne,o as k,r as A}from"./lib-MoKmYgcO.js";import{f as j}from"./chunk-LFPYN7LY-DwFbyqR1.js";import{t as M}from"./queryOptions-CAm1uWNO.js";import{o as N,p as P}from"./statsig-Cajk3UKk.js";import{t as F}from"./request-BXHjsnqU.js";import{t as I}from"./invalidate-queries-and-broadcast-dPfhRWCd.js";import{C as L,c as R}from"./config-queries-BDIsZFnB.js";import{r as z}from"./remote-connection-visibility-CDSfTp_2.js";import{t as B}from"./use-auth-DXLjX3T4.js";import{p as re}from"./codex-api-DRlZt5zW.js";import{c as V,s as ie,v as ae}from"./apps-queries-CBUjthvi.js";import{t as oe}from"./connector-logo-uEk_Q1Qc.js";import{r as se}from"./toast-signal-By11REe1.js";import{t as ce}from"./tooltip-BhXPONlb.js";import{t as le}from"./button-Xd4Hy1MO.js";import{r as ue,t as H}from"./spinner-Dvc_A3Ae.js";import{t as de}from"./use-codex-home-zmo5hiIG.js";import{t as fe}from"./apps-DBd5dYzG.js";import{t as pe}from"./chats-K-296NKY.js";import{t as me}from"./plugin-install-store-BWRSuKkC.js";import{t as he}from"./use-platform-BkwBnkgx.js";import{i as ge,n as _e,r as ve}from"./use-is-plugins-enabled-DudZfU21.js";import{d as ye,f as be,n as xe,o as Se,p as Ce,s as we}from"./use-plugins-BKOuT9XR.js";import{t as Te}from"./info-BV-snsxq.js";import{t as U}from"./settings.cog-CJF3NOGk.js";import{t as Ee}from"./openai-blossom-DWhxKWUa.js";import{n as De,t as W}from"./filesystem-media-src-DlToOKVI.js";import{d as Oe,l as ke,n as Ae}from"./dialog-layout-CCvvb1Vc.js";import{t as je}from"./use-skills-DK2PGa-B.js";import{t as Me}from"./check-md-CZTnvSiA.js";import{n as Ne,r as Pe}from"./plugin-config-edits-DJ9rwaYl.js";import{n as Fe}from"./plugin-prefill-prompt-Cs8725Fp.js";import{a as Ie,c as Le,l as G,o as Re,s as ze}from"./plugins-availability-C9cwO-r4.js";import{c as Be}from"./plan-management-state-CAozl_mZ.js";import{m as Ve}from"./links-DlYWpuc5.js";import{t as He}from"./upgrade-plan-dialog-launcher-lIFGy25G.js";import{t as K}from"./badge-mYHx4F5K.js";import{r as q,t as J}from"./dropdown-CHaZfyxI.js";import{t as Ue}from"./chevron-D6hquBJC.js";import{n as We,t as Ge}from"./check-plugin-availability-C1II8bXB.js";import{r as Ke}from"./plugin-detail-queries-nEDuNCez.js";import{t as qe}from"./use-codex-pricing-url-BucpTKgk.js";import{t as Je}from"./log-out-DJTSj1t6.js";import{t as Y}from"./toggle-CHrq20xd.js";import{t as Ye}from"./lock-DV6CP31m.js";import{t as Xe}from"./connected-apps-Dck9Rcbz.js";import{t as Ze}from"./regenerate-Co1G5oL3.js";import{i as Qe,n as $e}from"./app-connect-oauth-Bb1UV73Z.js";import{o as X,r as et}from"./computer-use-app-approvals-query-CZtrSy1-.js";import{t as tt}from"./hooks-settings-queries-BpMbCsRw.js";var Z=ee();function nt(){let e=(0,Z.c)(3),[t]=s(`remote_control_connections_state`),n=z(),r;return e[0]!==t||e[1]!==n?(r=rt({remoteControlConnectionsState:t,slingshotEnabled:n}),e[0]=t,e[1]=n,e[2]=r):r=e[2],r}function rt({remoteControlConnectionsState:e,slingshotEnabled:t}){return t&&(e?.available??!0)&&e?.accessRequired!==!0}function it({selectedConnectionsTab:e,showControlOtherDevices:t,showControlThisMacTab:n,showRemoteControlConnectionsSection:r,showRemoteSshConnections:i,showTabbedSshPage:a}){return r?e===`control-this-mac`&&!n?t?`access-other-devices`:`ssh`:e===`access-other-devices`&&!t?n?`control-this-mac`:`ssh`:e===`ssh`&&!a?t?`access-other-devices`:`control-this-mac`:e:i?`ssh`:`access-other-devices`}var at=e(m(),1);function ot(e,t){let n=(0,Z.c)(5),r=(0,at.useEffectEvent)(e),i;n[0]!==t||n[1]!==r?(i=()=>{if(t==null)return;let e=window.setInterval(()=>{r()},t);return()=>{window.clearInterval(e)}},n[0]=t,n[1]=r,n[2]=i):i=n[2];let a;n[3]===t?a=n[4]:(a=[t],n[3]=t,n[4]=a),(0,at.useEffect)(i,a)}var st=b(w,(e,{get:t})=>t(P,`2296472986`)&&rt({remoteControlConnectionsState:l(t,`remote_control_connections_state`),slingshotEnabled:t(P,`1042620455`)})&&t(R,{hostId:e}).data?.requirements?.computerUse?.allowLockedComputerUse!==!1),Q=h(),ct=e=>(0,Q.jsxs)(`svg`,{width:18,height:18,viewBox:`0 0 18 18`,fill:`none`,xmlns:`http://www.w3.org/2000/svg`,...e,children:[(0,Q.jsx)(`path`,{fillRule:`evenodd`,clipRule:`evenodd`,d:`M12.6673 9.45374C13.7358 9.45407 14.5577 10.3579 14.5579 11.4156V11.8239C15.1086 11.929 15.5247 12.4134 15.5247 12.9948V15.0504C15.5245 15.7084 14.9913 16.2418 14.3333 16.2418H11.0003C10.3423 16.2418 9.8081 15.7084 9.80789 15.0504V12.9948C9.80789 12.4134 10.2248 11.9291 10.7757 11.8239V11.4156C10.7759 10.3577 11.5984 9.45374 12.6673 9.45374ZM11.0003 12.8531C10.9221 12.8532 10.8587 12.9165 10.8587 12.9948V15.0504C10.8589 15.1285 10.9222 15.192 11.0003 15.192H14.3333C14.4114 15.192 14.4747 15.1285 14.4749 15.0504V12.9948C14.4749 12.9165 14.4115 12.8531 14.3333 12.8531H11.0003ZM12.6673 10.5045C12.2277 10.5045 11.8267 10.887 11.8264 11.4156V11.8024H13.5081V11.4156C13.5079 10.8873 13.1066 10.5049 12.6673 10.5045Z`,fill:`currentColor`}),(0,Q.jsx)(`path`,{d:`M8.2659 9.84534C8.55342 9.80818 8.81657 10.011 8.85379 10.2985C8.89088 10.5859 8.68813 10.8491 8.40067 10.8864C6.26147 11.1628 4.57997 12.9025 4.39188 15.068C4.36673 15.3568 4.11136 15.5706 3.82254 15.5455C3.53398 15.5202 3.32001 15.2658 3.345 14.9772C3.57594 12.3179 5.63935 10.1848 8.2659 9.84534Z`,fill:`currentColor`}),(0,Q.jsx)(`path`,{fillRule:`evenodd`,clipRule:`evenodd`,d:`M9.00028 2.31116C10.757 2.3113 12.1809 3.73602 12.1809 5.4928C12.1809 7.2495 10.757 8.67332 9.00028 8.67346C7.24346 8.67346 5.81872 7.24959 5.81863 5.4928C5.81863 3.73593 7.24341 2.31116 9.00028 2.31116ZM9.00028 3.36194C7.82331 3.36194 6.86942 4.31583 6.86942 5.4928C6.8695 6.66969 7.82336 7.62366 9.00028 7.62366C10.1771 7.62351 11.131 6.6696 11.1311 5.4928C11.1311 4.31592 10.1771 3.36208 9.00028 3.36194Z`,fill:`currentColor`})]});function lt(e){let t=(0,Z.c)(3),{ariaLabel:n,icon:r}=e,i;return t[0]!==n||t[1]!==r?(i=(0,Q.jsx)(`span`,{role:`img`,"aria-label":n,className:`flex h-7 w-7 items-center justify-center rounded-md text-token-description-foreground`,children:r}),t[0]=n,t[1]=r,t[2]=i):i=t[2],i}function ut(e){let t=(0,Z.c)(49),{icon:n,title:r,description:i,contentClassName:a,descriptionClassName:o,badges:s,actions:c,actionsPlacement:l,onClick:u,iconContainer:d,iconContainerVariant:f,className:p}=e,m=l===void 0?`top`:l,h=d===void 0?!0:d,_=f===void 0?`filled`:f,v;t[0]===u?v=t[1]:(v=e=>{u&&e.target===e.currentTarget&&(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),u())},t[0]=u,t[1]=v);let y=v,b=m===`center`&&!!c,x;t[2]===c?x=t[3]:(x=c?(0,Q.jsx)(`div`,{className:`flex shrink-0 items-center`,children:c}):null,t[2]=c,t[3]=x);let S=x,C=u?`cursor-interaction`:null,w;t[4]!==p||t[5]!==C?(w=g(`border-token-border/40 flex flex-col gap-2.5 rounded-2xl border p-2.5 transition-colors hover:bg-token-foreground/5`,C,p),t[4]=p,t[5]=C,t[6]=w):w=t[6];let ee=u?`button`:void 0,T=u?0:-1,te;t[7]!==n||t[8]!==h||t[9]!==_?(te=n?h?(0,Q.jsx)(`span`,{className:g(`flex h-10 w-10 shrink-0 items-center justify-center rounded-lg`,_===`outline`?`border border-token-border-default bg-transparent`:`bg-token-bg-primary`),children:n}):(0,Q.jsx)(`span`,{className:`shrink-0`,children:n}):null,t[7]=n,t[8]=h,t[9]=_,t[10]=te):te=t[10];let E=b?`items-center gap-3`:null,D;t[11]===E?D=t[12]:(D=g(`flex min-w-0 flex-1`,E),t[11]=E,t[12]=D);let O;t[13]===a?O=t[14]:(O=g(`flex min-w-0 flex-1 flex-col justify-center gap-0.5`,a),t[13]=a,t[14]=O);let ne=b?null:`justify-between`,k;t[15]===ne?k=t[16]:(k=g(`flex min-w-0 items-center gap-2`,ne),t[15]=ne,t[16]=k);let A;t[17]===r?A=t[18]:(A=(0,Q.jsx)(`div`,{className:`truncate font-medium text-token-foreground`,children:r}),t[17]=r,t[18]=A);let j;t[19]===s?j=t[20]:(j=s?.length?(0,Q.jsx)(`div`,{className:`flex shrink-0 items-center gap-1`,children:s.map(dt)}):null,t[19]=s,t[20]=j);let M;t[21]!==A||t[22]!==j?(M=(0,Q.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[A,j]}),t[21]=A,t[22]=j,t[23]=M):M=t[23];let N=b?null:S,P;t[24]!==k||t[25]!==M||t[26]!==N?(P=(0,Q.jsxs)(`div`,{className:k,children:[M,N]}),t[24]=k,t[25]=M,t[26]=N,t[27]=P):P=t[27];let F;t[28]!==i||t[29]!==o?(F=i?(0,Q.jsx)(`div`,{className:g(`text-token-text-secondary text-sm leading-relaxed`,o??`line-clamp-3`),children:i}):null,t[28]=i,t[29]=o,t[30]=F):F=t[30];let I;t[31]!==O||t[32]!==P||t[33]!==F?(I=(0,Q.jsxs)(`div`,{className:O,children:[P,F]}),t[31]=O,t[32]=P,t[33]=F,t[34]=I):I=t[34];let L=b?S:null,R;t[35]!==D||t[36]!==I||t[37]!==L?(R=(0,Q.jsxs)(`div`,{className:D,children:[I,L]}),t[35]=D,t[36]=I,t[37]=L,t[38]=R):R=t[38];let z;t[39]!==te||t[40]!==R?(z=(0,Q.jsxs)(`div`,{className:`flex items-center gap-3`,children:[te,R]}),t[39]=te,t[40]=R,t[41]=z):z=t[41];let B;return t[42]!==y||t[43]!==u||t[44]!==z||t[45]!==w||t[46]!==ee||t[47]!==T?(B=(0,Q.jsx)(`div`,{className:w,role:ee,tabIndex:T,onClick:u,onKeyDown:y,children:z}),t[42]=y,t[43]=u,t[44]=z,t[45]=w,t[46]=ee,t[47]=T,t[48]=B):B=t[48],B}function dt(e,t){return typeof e==`string`?(0,Q.jsx)(K,{className:`border border-token-border-default bg-transparent px-1.5 py-0.5 text-xs font-medium text-token-text-secondary`,children:e},e):(0,Q.jsx)(`span`,{className:`flex items-center`,children:e},t)}var ft=e=>(0,Q.jsx)(`svg`,{width:20,height:20,viewBox:`0 0 20 20`,fill:`none`,xmlns:`http://www.w3.org/2000/svg`,...e,children:(0,Q.jsx)(`path`,{d:`M13.3333 4.16663L6.66663 15.8333`,stroke:`currentColor`,strokeWidth:1.33,strokeLinecap:`round`})}),$=A({noDescription:{id:`skills.appsPage.apps.noDescription`,defaultMessage:`No description`,description:`Fallback description for apps without description text on the Skills & Apps page`},manageOnChatGpt:{id:`skills.appsPage.apps.manageOnChatGpt`,defaultMessage:`Manage on ChatGPT`,description:`Button label to manage an installed app on ChatGPT from the Skills & Apps page`},disableToggleTooltip:{id:`skills.appsPage.apps.disableToggle`,defaultMessage:`Disable app`,description:`Tooltip label for disabling an app from the Skills & Apps page`},enableToggleTooltip:{id:`skills.appsPage.apps.enableToggleTooltip`,defaultMessage:`Enable app`,description:`Tooltip label for enabling an app from the Skills & Apps page`},enableToggleAria:{id:`skills.appsPage.apps.enableToggle`,defaultMessage:`Enable app`,description:`Accessible label for toggling whether an installed app is enabled from the Skills & Apps page`},connectingApp:{id:`skills.appsPage.apps.connecting`,defaultMessage:`Continue connecting app`,description:`Accessible label for the button shown while an app OAuth flow is still finishing on the Skills & Apps page`},connectApp:{id:`skills.appsPage.apps.connect`,defaultMessage:`Connect`,description:`Button label to connect an app from the Skills & Apps page`},enabledStatus:{id:`skills.appsPage.apps.enabledStatus`,defaultMessage:`App enabled`,description:`Status label for an installed app that is enabled`},disabledStatus:{id:`skills.appsPage.apps.disabledStatus`,defaultMessage:`App disabled`,description:`Status label for an installed app that is disabled`},connectedTo:{id:`skills.appsPage.apps.connectedTo`,defaultMessage:`Connected to {email}`,description:`Tooltip shown for an app with the connected account email`}});function pt(e){let t=(0,Z.c)(45),{app:n,cardIcon:r,cardIconContainer:i,cardIconContainerVariant:a,badges:o,blockedStatusLabel:s,className:c,connectedAccountEmail:l,installBlockedReason:u,installedStateAction:d,installActionDisabled:f,installActionLabel:p,manageAction:m,isConnectingApp:h,showInstallAction:_,updatingAppId:v,onInstallApp:y,onOpenAppTools:b,onOpenAppUrl:x,onSetAppEnabled:S}=e,C=i===void 0?!0:i,w=l===void 0?null:l,ee=u===void 0?null:u,T=d===void 0?`check`:d,te=f===void 0?!1:f,E=m===void 0?`button`:m,D=_===void 0?!0:_,O=ne(),A;t[0]!==p||t[1]!==O?(A=p??O.formatMessage($.connectApp),t[0]=p,t[1]=O,t[2]=A):A=t[2];let j=A,M=n.isEnabled,N=ee===`disabled-by-admin`&&!n.isAccessible,P=v===n.id,F;t[3]!==w||t[4]!==O?(F=w==null?null:O.formatMessage($.connectedTo,{email:w}),t[3]=w,t[4]=O,t[5]=F):F=t[5];let I=F,L;t[6]!==o||t[7]!==I?(L=I==null?o:[(0,Q.jsxs)(`span`,{className:`inline-flex items-center gap-1`,children:[o,(0,Q.jsx)(ce,{tooltipContent:I,children:(0,Q.jsx)(`button`,{type:`button`,className:`inline-flex shrink-0 cursor-interaction items-center justify-center text-token-description-foreground hover:text-token-foreground`,"aria-label":I,onClick:vt,children:(0,Q.jsx)(Te,{className:`icon-2xs`})})})]},`connected-account-badge`)],t[6]=o,t[7]=I,t[8]=L):L=t[8];let R=L,z;t[9]===c?z=t[10]:(z=g(`group justify-center border-none`,c),t[9]=c,t[10]=z);let B;t[11]!==n||t[12]!==r?(B=r??(0,Q.jsx)(oe,{alt:n.name,appInfo:n,className:`icon-md`,fallback:(0,Q.jsx)(Xe,{className:`icon-sm text-token-text-secondary`})}),t[11]=n,t[12]=r,t[13]=B):B=t[13];let re;t[14]===n.description?re=t[15]:(re=n.description??(0,Q.jsx)(k,{...$.noDescription}),t[14]=n.description,t[15]=re);let V;t[16]!==n||t[17]!==b?(V=b==null?void 0:()=>{b(n)},t[16]=n,t[17]=b,t[18]=V):V=t[18];let ie;t[19]!==n||t[20]!==s||t[21]!==j||t[22]!==te||t[23]!==T||t[24]!==O||t[25]!==h||t[26]!==M||t[27]!==N||t[28]!==P||t[29]!==E||t[30]!==y||t[31]!==x||t[32]!==S||t[33]!==D?(ie=N&&s!=null?(0,Q.jsx)(`span`,{className:`inline-flex items-center gap-1 text-right text-sm text-token-text-secondary`,children:s}):n.isAccessible&&T===`toggle`?(0,Q.jsxs)(`div`,{className:`flex items-center gap-2`,children:[E===`menu`?(0,Q.jsx)(`div`,{onClick:_t,onKeyDown:gt,children:M?(0,Q.jsxs)(J,{align:`end`,contentWidth:`xs`,triggerButton:(0,Q.jsxs)(le,{className:`gap-1.5`,color:`outline`,size:`medium`,disabled:h||P,children:[(0,Q.jsx)(`span`,{className:`size-1.5 shrink-0 rounded-full bg-token-charts-green`}),(0,Q.jsx)(k,{id:`skills.appsPage.apps.connected`,defaultMessage:`Connected`,description:`Button label shown for an app that is connected`}),(0,Q.jsx)(Ue,{className:`icon-2xs shrink-0 text-token-description-foreground`})]}),children:[(0,Q.jsx)(q.Item,{LeftIcon:Ze,onSelect:()=>{y(n)},children:(0,Q.jsx)(k,{id:`skills.appsPage.apps.reconnect`,defaultMessage:`Reconnect`,description:`Menu item label for reconnecting an app`})}),(0,Q.jsx)(q.Item,{LeftIcon:Je,className:`text-token-charts-red`,leftIconClassName:`icon-xs text-token-charts-red`,onSelect:()=>{x?.(ae(n))},children:(0,Q.jsx)(k,{id:`skills.appsPage.apps.disconnect`,defaultMessage:`Disconnect`,description:`Menu item label for disconnecting an app`})})]}):(0,Q.jsx)(le,{className:`min-w-24 shrink-0 justify-center`,color:`outline`,size:`medium`,loading:P,onClick:()=>{S?.({appId:n.id,enabled:!0})},children:j})}):(0,Q.jsx)(`div`,{className:`invisible opacity-0 group-focus-within:visible group-focus-within:opacity-100 group-hover:visible group-hover:opacity-100`,children:(0,Q.jsx)(ce,{tooltipContent:(0,Q.jsx)(k,{...$.manageOnChatGpt}),children:(0,Q.jsx)(le,{color:`ghost`,size:`icon`,"aria-label":O.formatMessage($.manageOnChatGpt),onClick:e=>{e.stopPropagation(),x?.(ae(n))},children:(0,Q.jsx)(U,{className:`icon-sm`})})})}),E===`menu`?null:(0,Q.jsx)(ce,{tooltipContent:M?(0,Q.jsx)(k,{...$.disableToggleTooltip}):(0,Q.jsx)(k,{...$.enableToggleTooltip}),children:(0,Q.jsx)(`div`,{onClick:ht,onKeyDown:mt,children:(0,Q.jsx)(Y,{checked:M,disabled:P,onChange:e=>{S?.({appId:n.id,enabled:e})},ariaLabel:O.formatMessage($.enableToggleAria)})})})]}):n.isAccessible?(0,Q.jsx)(lt,{ariaLabel:O.formatMessage(M?$.enabledStatus:$.disabledStatus),icon:M?(0,Q.jsx)(Me,{className:`icon-sm`}):(0,Q.jsx)(ft,{className:`icon-sm`})}):D?(0,Q.jsx)(ce,{tooltipContent:N?(0,Q.jsx)(k,{id:`plugins.install.disabledByAdmin`,defaultMessage:`Disabled by admin`,description:`Tooltip shown when plugin install is unavailable because all included connectors are disabled by admin`}):h?(0,Q.jsx)(k,{...$.connectingApp}):j,children:(0,Q.jsx)(`div`,{children:(0,Q.jsx)(le,{className:`min-w-24 shrink-0 justify-center`,color:`outline`,size:`medium`,disabled:N||te,"aria-label":h?O.formatMessage($.connectingApp):j,onClick:e=>{e.stopPropagation(),!N&&y(n)},children:h?(0,Q.jsx)(H,{className:`icon-xxs`}):j})})}):null,t[19]=n,t[20]=s,t[21]=j,t[22]=te,t[23]=T,t[24]=O,t[25]=h,t[26]=M,t[27]=N,t[28]=P,t[29]=E,t[30]=y,t[31]=x,t[32]=S,t[33]=D,t[34]=ie):ie=t[34];let se;return t[35]!==n.name||t[36]!==R||t[37]!==C||t[38]!==a||t[39]!==z||t[40]!==B||t[41]!==re||t[42]!==V||t[43]!==ie?(se=(0,Q.jsx)(ut,{className:z,actionsPlacement:`center`,iconContainer:C,iconContainerVariant:a,icon:B,title:n.name,badges:R,description:re,descriptionClassName:`line-clamp-1`,onClick:V,actions:ie}),t[35]=n.name,t[36]=R,t[37]=C,t[38]=a,t[39]=z,t[40]=B,t[41]=re,t[42]=V,t[43]=ie,t[44]=se):se=t[44],se}function mt(e){e.stopPropagation()}function ht(e){e.stopPropagation()}function gt(e){e.stopPropagation()}function _t(e){e.stopPropagation()}function vt(e){e.stopPropagation()}function yt({browserExtensionId:e}){return M({queryKey:e==null?[`chrome-extension-installed-read`,`missing`]:E(`chrome-extension-installed-read`,{extensionId:e}),queryFn:async()=>e==null?{installed:!1}:T(`chrome-extension-installed-read`,{params:{extensionId:e}}),staleTime:D.FIVE_SECONDS})}function bt(e){return e?.installed===!0}function xt(e){let t=(0,Z.c)(10),{browserExtensionId:n}=e,r=n!=null,i;t[0]===n?i=t[1]:(i=yt({browserExtensionId:n}),t[0]=n,t[1]=i);let a;t[2]!==r||t[3]!==i?(a={enabled:r,refetchOnWindowFocus:!0,staleTime:D.FIVE_SECONDS,...i},t[2]=r,t[3]=i,t[4]=a):a=t[4];let{data:o,isLoading:s}=O(a),c;t[5]===o?c=t[6]:(c=bt(o),t[5]=o,t[6]=c);let l=n!=null&&s,u;return t[7]!==c||t[8]!==l?(u={isConnected:c,isLoading:l},t[7]=c,t[8]=l,t[9]=u):u=t[9],u}var St=`assets/google-chrome.png`,Ct=`scripts/extension-id.json`,wt=`https://chromewebstore.google.com/detail/codex/`,Tt=n([`chrome`,`chrome-dev`,`chrome-internal`]),Et=t({extensionId:i().trim().min(1)});async function Dt({codexHome:e,hostId:t,plugin:n,queryClient:r}){try{let i=jt(e,n);if(i==null)return[];let a={hostId:t,path:i};return await r.fetchQuery({queryFn:async()=>{let t=await T(`read-file`,{params:a});return[Nt({codexHome:e,extensionId:Et.parse(JSON.parse(t.contents)).extensionId,plugin:n})]},queryKey:Ft(a),retry:!1,staleTime:D.INFINITE})}catch(e){return C.warning(`Failed to read plugin browser extension setup`,{safe:{},sensitive:{error:e,pluginId:n.plugin.id}}),[]}}function Ot(e){let t=(0,Z.c)(17),{enabled:n,hostId:r,plugin:i}=e,a=de(r),o,s,c,l;t[0]!==a||t[1]!==n||t[2]!==r||t[3]!==i?(o=jt(a,i),l=O,s=n&&o!=null,c=o==null?[`plugins`,`browser-extension-setup`,`missing`]:Ft({hostId:r,path:o}),t[0]=a,t[1]=n,t[2]=r,t[3]=i,t[4]=o,t[5]=s,t[6]=c,t[7]=l):(o=t[4],s=t[5],c=t[6],l=t[7]);let u;t[8]!==a||t[9]!==o||t[10]!==r||t[11]!==i?(u=async()=>{if(o==null||i==null)return[];let e=await T(`read-file`,{params:{hostId:r,path:o}});return[Nt({codexHome:a,extensionId:Et.parse(JSON.parse(e.contents)).extensionId,plugin:i})]},t[8]=a,t[9]=o,t[10]=r,t[11]=i,t[12]=u):u=t[12];let d;t[13]!==s||t[14]!==c||t[15]!==u?(d={enabled:s,queryKey:c,queryFn:u,retry:!1,staleTime:D.INFINITE},t[13]=s,t[14]=c,t[15]=u,t[16]=d):d=t[16];let{data:f}=l(d);return f}async function kt({authPolicy:e,codexHome:t,hostId:n,plugin:r,queryClient:i,windowType:a}){if(e!==`ON_INSTALL`||a!==`electron`||Mt(r)==null)return[];let o=await Dt({codexHome:t??(await T(`codex-home`,{params:{hostId:n}})).codexHome,hostId:n,plugin:await At({hostId:n,plugin:r}),queryClient:i});return(await Promise.all(o.map(async e=>({browserExtension:e,needsSetup:!bt(await i.fetchQuery({...yt({browserExtensionId:e.id}),staleTime:0}))})))).filter(({needsSetup:e})=>e).map(({browserExtension:e})=>e)}async function At({hostId:e,plugin:t}){try{return xe((await c(`read-plugin`,{hostId:e,...Se(t)})).plugin)}catch(e){return C.warning(`Failed to read installed plugin browser extension setup`,{safe:{},sensitive:{error:e,pluginId:t.plugin.id}}),t}}function jt(e,t){return e==null||t?.plugin.source.type!==`local`||Mt(t)==null?null:f(r({codexHome:e,localVersion:t.plugin.localVersion,marketplaceName:t.marketplaceName,pluginName:t.plugin.name}),Ct)}function Mt(e){let t=Tt.safeParse(e.plugin.name);return!t.success||!e.plugin.id.startsWith(`${t.data}@`)?null:t.data}function Nt({codexHome:e,extensionId:t,plugin:n}){return{iconUrl:Pt(e==null||n.plugin.source.type!==`local`?null:f(r({codexHome:e,localVersion:n.plugin.localVersion,marketplaceName:n.marketplaceName,pluginName:n.plugin.name}),St))??Pt(n.logoPath),id:t,name:`Codex Chrome Extension`,url:`${wt}${t}`}}function Pt(e){let t=e?.trim();if(t==null||t.length===0)return null;let n=t.toLowerCase();return n.startsWith(`app:`)||n.startsWith(`data:`)||n.startsWith(`http:`)||n.startsWith(`https:`)||n.startsWith(`/@fs`)?t:a(t)?window.location.protocol===`http:`||window.location.protocol===`https:`?De(t):W(t):null}function Ft({hostId:e,path:t}){return[`plugins`,`browser-extension-setup`,e,t]}var It=A({codexChromeDescription:{id:`plugins.installModal.browserExtension.description`,defaultMessage:`Install this extension in Chrome to let Codex connect to your browser`,description:`Description for the required Chrome browser extension in the plugin finish setup modal`}}),Lt=new Map([[`gmail`,`gmail`],[`google-calendar`,`google-calendar`],[`google-drive`,`google-drive`],[`connector_gmail`,`gmail`],[`connector_google_calendar`,`google-calendar`],[`connector_google_drive`,`google-drive`]]);function Rt(e){return Lt.get(e)??null}function zt(e,t){return t===`connector-unavailable`&&Rt(e)!=null}function Bt(e){let t=(0,Z.c)(9),{upsellId:n}=e;switch(n){case`gmail`:{let e;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Q.jsx)(Ut,{description:(0,Q.jsx)(k,{id:`plugins.installModal.googleUpgrade.gmail.draftReplies.description`,defaultMessage:`Codex can read the thread, understand the ask, and draft a useful response`,description:`Description for the Gmail drafting benefit in the Google plugin upgrade install modal`}),title:(0,Q.jsx)(k,{id:`plugins.installModal.googleUpgrade.gmail.draftReplies.title`,defaultMessage:`Draft replies with the right context`,description:`Title for the Gmail drafting benefit in the Google plugin upgrade install modal`})}),t[0]=e):e=t[0];let n;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,Q.jsx)(Ut,{description:(0,Q.jsx)(k,{id:`plugins.installModal.googleUpgrade.gmail.emailTasks.description`,defaultMessage:`Pull out action items, deadlines, owners, and next steps from messy threads`,description:`Description for the Gmail task extraction benefit in the Google plugin upgrade install modal`}),title:(0,Q.jsx)(k,{id:`plugins.installModal.googleUpgrade.gmail.emailTasks.title`,defaultMessage:`Turn emails into tasks`,description:`Title for the Gmail task extraction benefit in the Google plugin upgrade install modal`})}),t[1]=n):n=t[1];let r;return t[2]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,Q.jsxs)(Ht,{children:[e,n,(0,Q.jsx)(Ut,{description:(0,Q.jsx)(k,{id:`plugins.installModal.googleUpgrade.gmail.findEmail.description`,defaultMessage:`Search Gmail conversationally: "Find the vendor email with the updated contract from last month"`,description:`Description for the Gmail search benefit in the Google plugin upgrade install modal`}),title:(0,Q.jsx)(k,{id:`plugins.installModal.googleUpgrade.gmail.findEmail.title`,defaultMessage:`Find the email you're thinking of`,description:`Title for the Gmail search benefit in the Google plugin upgrade install modal`})})]}),t[2]=r):r=t[2],r}case`google-calendar`:{let e;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Q.jsx)(Ut,{description:(0,Q.jsx)(k,{id:`plugins.installModal.googleUpgrade.googleCalendar.schedule.description`,defaultMessage:`Pull together agenda, context, and questions before a call`,description:`Description for the Google Calendar scheduling benefit in the Google plugin upgrade install modal`}),title:(0,Q.jsx)(k,{id:`plugins.installModal.googleUpgrade.googleCalendar.schedule.title`,defaultMessage:`Prepare for meetings`,description:`Title for the Google Calendar scheduling benefit in the Google plugin upgrade install modal`})}),t[3]=e):e=t[3];let n;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,Q.jsx)(Ut,{description:(0,Q.jsx)(k,{id:`plugins.installModal.googleUpgrade.googleCalendar.upcoming.description`,defaultMessage:`See meetings, conflicts, and focus time at a glance`,description:`Description for the Google Calendar planning benefit in the Google plugin upgrade install modal`}),title:(0,Q.jsx)(k,{id:`plugins.installModal.googleUpgrade.googleCalendar.upcoming.title`,defaultMessage:`Summarize your day`,description:`Title for the Google Calendar planning benefit in the Google plugin upgrade install modal`})}),t[4]=n):n=t[4];let r;return t[5]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,Q.jsxs)(Ht,{children:[e,n,(0,Q.jsx)(Ut,{description:(0,Q.jsx)(k,{id:`plugins.installModal.googleUpgrade.googleCalendar.changes.description`,defaultMessage:`Turn events into reminders, notes, and next steps`,description:`Description for the Google Calendar editing benefit in the Google plugin upgrade install modal`}),title:(0,Q.jsx)(k,{id:`plugins.installModal.googleUpgrade.googleCalendar.changes.title`,defaultMessage:`Organize follow-ups`,description:`Title for the Google Calendar editing benefit in the Google plugin upgrade install modal`})})]}),t[5]=r):r=t[5],r}case`google-drive`:{let e;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Q.jsx)(Ut,{description:(0,Q.jsx)(k,{id:`plugins.installModal.googleUpgrade.googleDrive.find.description`,defaultMessage:`Search by project, topic, people, or recent context`,description:`Description for the Google Drive search benefit in the Google plugin upgrade install modal`}),title:(0,Q.jsx)(k,{id:`plugins.installModal.googleUpgrade.googleDrive.find.title`,defaultMessage:`Find files faster`,description:`Title for the Google Drive search benefit in the Google plugin upgrade install modal`})}),t[6]=e):e=t[6];let n;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,Q.jsx)(Ut,{description:(0,Q.jsx)(k,{id:`plugins.installModal.googleUpgrade.googleDrive.context.description`,defaultMessage:`Understand what matters without opening every file`,description:`Description for the Google Drive context benefit in the Google plugin upgrade install modal`}),title:(0,Q.jsx)(k,{id:`plugins.installModal.googleUpgrade.googleDrive.context.title`,defaultMessage:`Summarize docs and folders`,description:`Title for the Google Drive context benefit in the Google plugin upgrade install modal`})}),t[7]=n):n=t[7];let r;return t[8]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,Q.jsxs)(Ht,{children:[e,n,(0,Q.jsx)(Ut,{description:(0,Q.jsx)(k,{id:`plugins.installModal.googleUpgrade.googleDrive.update.description`,defaultMessage:`Use existing files to create briefs, replies, and plans`,description:`Description for the Google Drive file editing benefit in the Google plugin upgrade install modal`}),title:(0,Q.jsx)(k,{id:`plugins.installModal.googleUpgrade.googleDrive.update.title`,defaultMessage:`Draft from Drive context`,description:`Title for the Google Drive file editing benefit in the Google plugin upgrade install modal`})})]}),t[8]=r):r=t[8],r}}}function Vt(){let e=(0,Z.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,Q.jsxs)(K,{className:`gap-1 !bg-token-charts-purple/10 px-1.5 py-1 text-xs font-medium !text-token-charts-purple`,children:[(0,Q.jsx)(Ye,{className:`icon-xs`}),(0,Q.jsx)(k,{id:`plugins.googleUpgrade.badge`,defaultMessage:`Upgrade to unlock`,description:`Badge label shown on Google plugins that need a paid plan`})]}),e[0]=t):t=e[0],t}function Ht(e){let t=(0,Z.c)(2),{children:n}=e,r;return t[0]===n?r=t[1]:(r=(0,Q.jsx)(`div`,{className:`flex flex-col gap-3 py-1`,children:n}),t[0]=n,t[1]=r),r}function Ut(e){let t=(0,Z.c)(8),{description:n,title:r}=e,i;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,Q.jsx)(Me,{className:`icon-sm mt-0.5 shrink-0 text-token-text-secondary`}),t[0]=i):i=t[0];let a;t[1]===r?a=t[2]:(a=(0,Q.jsx)(`div`,{className:`font-semibold text-token-text-primary`,children:r}),t[1]=r,t[2]=a);let o;t[3]===n?o=t[4]:(o=(0,Q.jsx)(`div`,{className:`text-token-text-secondary`,children:n}),t[3]=n,t[4]=o);let s;return t[5]!==a||t[6]!==o?(s=(0,Q.jsxs)(`div`,{className:`flex gap-2 text-sm`,children:[i,(0,Q.jsxs)(`div`,{className:`flex min-w-0 flex-col`,children:[a,o]})]}),t[5]=a,t[6]=o,t[7]=s):s=t[7],s}var Wt=`OAI-Product-Sku`,Gt=`CODEX`,Kt=/\[([^\]]+)\]\(([^)]+)\)/g,qt=480,Jt=`min(720px, calc(100vh - 2rem))`,Yt=[0,1,2],Xt=400;function Zt(e){let t=(0,Z.c)(142),{hostId:n,isInstalling:r,onConnectRequiredApp:i,onInstall:a,onOpenChange:o,onRequiredAppConnected:s,onRequiredAppOAuthStarted:c,onTryInChat:l,onViewDetails:u,session:d}=e,f=r===void 0?!1:r,p=v(w),[m,h]=(0,at.useState)(null),[g,_]=(0,at.useState)(null),{platform:b}=he(),{authMethod:x,planAtLogin:C}=B(),{data:ee}=re(),T=x===`chatgpt`,E;t[0]===T?E=t[1]:(E={queryConfig:{enabled:T}},t[0]=T,t[1]=E);let{data:ne}=te(`account-info`,E),A=ee?.plan_type??ne?.plan??C,j;t[2]===A?j=t[3]:(j=Be(A)?.pricePlan??null,t[2]=A,t[3]=j);let M=j,N;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(N={logExposure:!0},t[4]=N):N=t[4];let P=qe(N),F=y(st,n),I=d.kind===`closed`?null:d.plugin,L;t[5]!==d.kind||t[6]!==d.requiredApps?(L=d.kind===`needsApps`?d.requiredApps.map(rn):void 0,t[5]=d.kind,t[6]=d.requiredApps,t[7]=L):L=t[7];let R=L,z;t[8]!==n||t[9]!==R||t[10]!==d.kind||t[11]!==d.plugin?(z=d.kind===`details`?{hostId:n,...Se(d.plugin)}:{hostId:n,pluginApps:R},t[8]=n,t[9]=R,t[10]=d.kind,t[11]=d.plugin,t[12]=z):z=t[12];let{blockedReasonsByConnectorId:V,blockedReason:ie,isLoading:ae}=We(z),oe=I!=null&&Ge(I.plugin),se=d.kind===`details`?ie:null,ue=d.kind===`details`&&ae,H=oe?`disabled-by-admin`:se,de=H!=null,fe=H===`disabled-by-admin`,pe=I?.marketplacePath??null,me;t[13]===I?me=t[14]:(me=I==null?null:we(I),t[13]=I,t[14]=me);let ge=I?.remoteMarketplaceName??null,_e=I!=null,ve;t[15]!==n||t[16]!==ge||t[17]!==_e||t[18]!==pe||t[19]!==me?(ve={hostId:n,marketplacePath:pe,pluginName:me,remoteMarketplaceName:ge,enabled:_e},t[15]=n,t[16]=ge,t[17]=_e,t[18]=pe,t[19]=me,t[20]=ve):ve=t[20];let{plugin:be}=Ke(ve),xe=be?.apps,Ce,Te,U,Ee,De,W,Oe,je;t[21]!==V||t[22]!==xe||t[23]!==d.kind||t[24]!==d.plugin?(Ce=xe?.filter(e=>V[e.id]!==`disabled-by-admin`),U=d.kind===`details`&&d.plugin.plugin.authPolicy===`ON_INSTALL`,Te=Ce!=null&&Ce.length>0,je=O,Ee=`plugins`,De=`install-modal`,W=`disclosure`,Oe=Ce?.map(nn),t[21]=V,t[22]=xe,t[23]=d.kind,t[24]=d.plugin,t[25]=Ce,t[26]=Te,t[27]=U,t[28]=Ee,t[29]=De,t[30]=W,t[31]=Oe,t[32]=je):(Ce=t[25],Te=t[26],U=t[27],Ee=t[28],De=t[29],W=t[30],Oe=t[31],je=t[32]);let Me;t[33]!==Ee||t[34]!==De||t[35]!==W||t[36]!==Oe?(Me=[Ee,De,W,Oe],t[33]=Ee,t[34]=De,t[35]=W,t[36]=Oe,t[37]=Me):Me=t[37];let Ne=U&&Te&&!ae,Pe;t[38]===Ce?Pe=t[39]:(Pe=async()=>{if(Ce==null)throw Error(`plugin detail apps are required`);let e=await Promise.all(Ce.map(tn));return{blurbs:Ln(e.flatMap(en)),personalizationToggles:e.flatMap($t)}},t[38]=Ce,t[39]=Pe);let Fe;t[40]!==Me||t[41]!==Ne||t[42]!==Pe?(Fe={queryKey:Me,enabled:Ne,staleTime:D.FIVE_MINUTES,queryFn:Pe},t[40]=Me,t[41]=Ne,t[42]=Pe,t[43]=Fe):Fe=t[43];let{data:Ie,isLoading:Le}=je(Fe),Ve;t[44]!==f||t[45]!==o?(Ve=e=>{!e&&f||(e||(h(null),_(null)),o(e))},t[44]=f,t[45]=o,t[46]=Ve):Ve=t[46];let K=Ve;if(d.kind===`closed`)return null;if(d.kind===`connectApp`){let e;t[47]===d.app?e=t[48]:(e=Mn(d.app),t[47]=d.app,t[48]=e);let n;t[49]!==s||t[50]!==d.app.appId?(n=async()=>{await s(d.app.appId)},t[49]=s,t[50]=d.app.appId,t[51]=n):n=t[51];let r;return t[52]!==o||t[53]!==c||t[54]!==e||t[55]!==n?(r=(0,Q.jsx)(Re,{app:e,onOpenChange:o,onConnected:n,onOAuthStarted:c}),t[52]=o,t[53]=c,t[54]=e,t[55]=n,t[56]=r):r=t[56],r}if(d.kind===`installing`){let e;return t[57]!==K||t[58]!==d.plugin?(e=(0,Q.jsx)(an,{onOpenChange:K,plugin:d.plugin}),t[57]=K,t[58]=d.plugin,t[59]=e):e=t[59],e}let q=d.kind===`needsApps`?`needsApps`:`details`,J=d.plugin,Ue,Je,Y,Xe;if(t[60]!==F||t[61]!==Ie?.personalizationToggles||t[62]!==g||t[63]!==m||t[64]!==q||t[65]!==b||t[66]!==J.plugin.id||t[67]!==U){Ue=m?.pluginId===J.plugin.id?m.modes:{};let e;t[72]!==F||t[73]!==q||t[74]!==b||t[75]!==J.plugin.id?(e=q===`details`&&b===`macOS`&&F&&ye(J.plugin.id),t[72]=F,t[73]=q,t[74]=b,t[75]=J.plugin.id,t[76]=e):e=t[76],Y=e,Je=g?.pluginId===J.plugin.id?g.enabled:!0,Xe=Rn({draftModes:Ue,personalizationToggles:U?Ie?.personalizationToggles:void 0}),t[60]=F,t[61]=Ie?.personalizationToggles,t[62]=g,t[63]=m,t[64]=q,t[65]=b,t[66]=J.plugin.id,t[67]=U,t[68]=Ue,t[69]=Je,t[70]=Y,t[71]=Xe}else Ue=t[68],Je=t[69],Y=t[70],Xe=t[71];let Ze=Xe,Qe=U&&Te&&(ae||Le),$e;t[77]!==H||t[78]!==J.plugin.name?($e=zt(J.plugin.name,H),t[77]=H,t[78]=J.plugin.name,t[79]=$e):$e=t[79];let X=$e,et;t[80]!==J.plugin.name||t[81]!==X?(et=X?Rt(J.plugin.name):null,t[80]=J.plugin.name,t[81]=X,t[82]=et):et=t[82];let tt=et,nt=!f,rt;t[83]===Symbol.for(`react.memo_cache_sentinel`)?(rt={"aria-describedby":void 0,style:{maxHeight:Jt,width:qt}},t[83]=rt):rt=t[83];let it=q===`needsApps`?`top-5 right-5 text-token-text-secondary`:void 0,ot=q===`needsApps`?`gap-0 overflow-hidden p-0`:`gap-6 overflow-hidden px-6 pt-8 pb-6`,lt;t[84]===q?lt=t[85]:(lt=q===`needsApps`?{maxHeight:Jt,padding:0}:{maxHeight:Jt},t[84]=q,t[85]=lt);let ut;t[86]!==q||t[87]!==J||t[88]!==X?(ut=q===`details`?(0,Q.jsx)(sn,{plugin:J,showUpgradeBadge:X}):null,t[86]=q,t[87]=J,t[88]=X,t[89]=ut):ut=t[89];let dt;t[90]!==V||t[91]!==Ue||t[92]!==Ze||t[93]!==Ie||t[94]!==K||t[95]!==n||t[96]!==Je||t[97]!==ae||t[98]!==Qe||t[99]!==i||t[100]!==l||t[101]!==u||t[102]!==q||t[103]!==J||t[104]!==be||t[105]!==xe||t[106]!==tt||t[107]!==d.kind||t[108]!==d.requiredApps||t[109]!==d.requiredBrowserExtensions||t[110]!==U||t[111]!==Y?(dt=q===`needsApps`?(0,Q.jsx)(ln,{appInstallBlockedReasonsById:V,appOrder:xe?.map(Qt),isAppBlockedReasonLoading:ae,onConnectRequiredApp:i,onOpenChange:K,onTryInChat:l,onViewDetails:u,plugin:J,requiredApps:d.kind===`needsApps`?d.requiredApps:[],requiredBrowserExtensions:d.kind===`needsApps`?d.requiredBrowserExtensions:[]}):q===`details`?(0,Q.jsx)(ze,{className:`relative grid min-h-0 flex-1 overflow-hidden`,fadeClassName:`inset-x-0`,scrollClassName:`min-h-0 overflow-y-auto group-data-[can-scroll-down=true]:pb-7`,children:tt==null?(0,Q.jsx)(fn,{appPersonalizationModes:Ze,disclosureData:U?Ie:void 0,hostId:n,installLockedComputerUse:Je,isLoadingDisclosureData:Qe,onAppPersonalizationModeChange:e=>{let{appId:t,mode:n}=e;h({modes:{...Ue,[t]:n},pluginId:J.plugin.id})},onInstallLockedComputerUseChange:e=>{_({enabled:e,pluginId:J.plugin.id})},plugin:J,pluginDetail:be,shouldShowInstallDisclosure:U,showLockedComputerUseInstall:Y}):(0,Q.jsx)(Bt,{upsellId:tt})}):null,t[90]=V,t[91]=Ue,t[92]=Ze,t[93]=Ie,t[94]=K,t[95]=n,t[96]=Je,t[97]=ae,t[98]=Qe,t[99]=i,t[100]=l,t[101]=u,t[102]=q,t[103]=J,t[104]=be,t[105]=xe,t[106]=tt,t[107]=d.kind,t[108]=d.requiredApps,t[109]=d.requiredBrowserExtensions,t[110]=U,t[111]=Y,t[112]=dt):dt=t[112];let ft;t[113]!==Ze||t[114]!==M||t[115]!==H||t[116]!==P||t[117]!==Je||t[118]!==ue||t[119]!==fe||t[120]!==f||t[121]!==Qe||t[122]!==de||t[123]!==a||t[124]!==q||t[125]!==J||t[126]!==p||t[127]!==X||t[128]!==Y?(ft=q===`details`?(0,Q.jsx)(ce,{tooltipContent:H===`connector-unavailable`&&!X?(0,Q.jsx)(k,{id:`plugins.install.connectorUnavailable`,defaultMessage:`App unavailable`,description:`Tooltip shown when plugin install is unavailable because the plugin's apps are not available in the current app directory`}):null,disabled:H!==`connector-unavailable`||X,children:(0,Q.jsx)(`div`,{className:`flex w-full`,children:(0,Q.jsx)(le,{color:`primary`,size:`large`,className:`w-full justify-center`,disabled:!X&&de||ue||!X&&Qe,loading:f,onClick:()=>{if(X){M==null?S.dispatchMessage(`open-in-browser`,{url:P(),useExternalBrowser:!0}):He(p,M,`plugin_install_modal_upgrade_cta`);return}a(Ze,Y?Je:void 0)},children:f?(0,Q.jsx)(k,{id:`plugins.installModal.installing`,defaultMessage:`Installing {pluginName}`,description:`Button label in the plugin install modal while installation is in progress`,values:{pluginName:G(J)}}):fe?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(ct,{className:`icon-sm`}),(0,Q.jsx)(k,{id:`plugins.detail.disabledByAdminButton`,defaultMessage:`Disabled by admin`,description:`Install button label shown when plugin install is unavailable because all included connectors are disabled by admin`})]}):X?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(Ye,{className:`icon-sm`}),(0,Q.jsx)(k,{id:`plugins.installModal.upgradeToUnlock`,defaultMessage:`Upgrade to unlock`,description:`Button label for upgrading when a Google plugin needs a paid plan`})]}):(0,Q.jsx)(k,{id:`plugins.installModal.install`,defaultMessage:`Install {pluginName}`,description:`Install button label in the plugin install modal`,values:{pluginName:G(J)}})})})}):null,t[113]=Ze,t[114]=M,t[115]=H,t[116]=P,t[117]=Je,t[118]=ue,t[119]=fe,t[120]=f,t[121]=Qe,t[122]=de,t[123]=a,t[124]=q,t[125]=J,t[126]=p,t[127]=X,t[128]=Y,t[129]=ft):ft=t[129];let $;t[130]!==ot||t[131]!==lt||t[132]!==ut||t[133]!==dt||t[134]!==ft?($=(0,Q.jsxs)(Ae,{className:ot,style:lt,children:[ut,dt,ft]}),t[130]=ot,t[131]=lt,t[132]=ut,t[133]=dt,t[134]=ft,t[135]=$):$=t[135];let pt;return t[136]!==K||t[137]!==f||t[138]!==nt||t[139]!==it||t[140]!==$?(pt=(0,Q.jsx)(ke,{open:!0,onOpenChange:K,shouldIgnoreClickOutside:f,showDialogClose:nt,size:`default`,contentClassName:`h-fit max-w-[calc(100vw-2rem)] overflow-hidden`,contentProps:rt,dialogCloseClassName:it,children:$}),t[136]=K,t[137]=f,t[138]=nt,t[139]=it,t[140]=$,t[141]=pt):pt=t[141],pt}function Qt(e){return e.id}function $t(e){let{app:t,connectorTos:n}=e;return n.personalization_toggle_blurb==null?[]:[{appId:t.id,appName:t.name,blurb:n.personalization_toggle_blurb,defaultMode:n.personalization_default??`NO_PERSONALIZATION`}]}function en(e){let{connectorTos:t}=e;return t.blurbs}async function tn(e){return{app:e,connectorTos:await F.safeGet(`/aip/connectors/{connector_id}/tos`,{parameters:{path:{connector_id:e.id}},additionalHeaders:{[Wt]:Gt}})}}function nn(e){return e.id}function rn(e){return{description:e.description,id:e.appId,installUrl:e.installUrl,name:e.name,needsAuth:!0}}function an(e){let t=(0,Z.c)(22),{onOpenChange:n,plugin:r}=e,i;t[0]===r.plugin.interface?.developerName?i=t[1]:(i=r.plugin.interface?.developerName?.trim(),t[0]=r.plugin.interface?.developerName,t[1]=i);let a=i,o=ue(),[s,c]=(0,at.useState)(0),l;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(l=()=>{c(on)},t[2]=l):l=t[2],ot(l,o?null:Xt);let u;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(u={"aria-describedby":void 0,style:{maxHeight:Jt,width:qt}},t[3]=u):u=t[3];let d=o?0:s,f;t[4]!==r||t[5]!==d?(f=(0,Q.jsx)(cn,{activeDotIndex:d,plugin:r}),t[4]=r,t[5]=d,t[6]=f):f=t[6];let p;t[7]===r?p=t[8]:(p=G(r),t[7]=r,t[8]=p);let m;t[9]===p?m=t[10]:(m=(0,Q.jsx)(Oe,{className:`text-xl leading-7 font-semibold text-token-text-primary`,children:(0,Q.jsx)(k,{id:`plugins.installModal.adding.title`,defaultMessage:`Adding {pluginName}…`,description:`Title shown in the plugin install loading modal`,values:{pluginName:p}})}),t[9]=p,t[10]=m);let h;t[11]===a?h=t[12]:(h=a?(0,Q.jsx)(`div`,{className:`text-sm leading-5 text-token-text-secondary`,children:(0,Q.jsx)(k,{id:`plugins.installModal.developedBy`,defaultMessage:`Developed by {developerName}`,description:`Developer subtitle shown in the plugin install modal`,values:{developerName:a}})}):null,t[11]=a,t[12]=h);let g;t[13]!==m||t[14]!==h?(g=(0,Q.jsxs)(`div`,{className:`flex flex-col items-center gap-1 text-center`,children:[m,h]}),t[13]=m,t[14]=h,t[15]=g):g=t[15];let _;t[16]!==f||t[17]!==g?(_=(0,Q.jsx)(Ae,{className:`h-[200px] gap-0 p-6`,children:(0,Q.jsxs)(`div`,{className:`flex h-full flex-col items-center justify-center gap-4`,children:[f,g]})}),t[16]=f,t[17]=g,t[18]=_):_=t[18];let v;return t[19]!==n||t[20]!==_?(v=(0,Q.jsx)(ke,{open:!0,onOpenChange:n,shouldIgnoreClickOutside:!0,showDialogClose:!1,size:`default`,contentClassName:`h-fit max-w-[calc(100vw-2rem)] overflow-hidden`,contentProps:u,children:_}),t[19]=n,t[20]=_,t[21]=v):v=t[21],v}function on(e){return(e+1)%Yt.length}function sn(e){let t=(0,Z.c)(19),{plugin:n,showUpgradeBadge:r}=e,i;t[0]===n.plugin.interface?.developerName?i=t[1]:(i=n.plugin.interface?.developerName?.trim(),t[0]=n.plugin.interface?.developerName,t[1]=i);let a=i,o;t[2]===n?o=t[3]:(o=(0,Q.jsx)(cn,{plugin:n}),t[2]=n,t[3]=o);let s;t[4]===n?s=t[5]:(s=G(n),t[4]=n,t[5]=s);let c;t[6]===s?c=t[7]:(c=(0,Q.jsx)(Oe,{asChild:!0,children:(0,Q.jsx)(`div`,{className:`heading-dialog font-semibold`,children:(0,Q.jsx)(k,{id:`plugins.installModal.title`,defaultMessage:`Install {pluginName}`,description:`Title shown in the plugin install modal before installation starts`,values:{pluginName:s}})})}),t[6]=s,t[7]=c);let l;t[8]===a?l=t[9]:(l=a?(0,Q.jsx)(`div`,{className:`text-sm text-token-text-secondary`,children:(0,Q.jsx)(k,{id:`plugins.installModal.developedBy`,defaultMessage:`Developed by {developerName}`,description:`Developer subtitle shown in the plugin install modal`,values:{developerName:a}})}):null,t[8]=a,t[9]=l);let u;t[10]===r?u=t[11]:(u=r?(0,Q.jsx)(Vt,{}):null,t[10]=r,t[11]=u);let d;t[12]!==c||t[13]!==l||t[14]!==u?(d=(0,Q.jsxs)(`div`,{className:`flex flex-col items-center gap-1 text-center`,children:[c,l,u]}),t[12]=c,t[13]=l,t[14]=u,t[15]=d):d=t[15];let f;return t[16]!==o||t[17]!==d?(f=(0,Q.jsxs)(`div`,{className:`flex flex-col items-center gap-4`,children:[o,d]}),t[16]=o,t[17]=d,t[18]=f):f=t[18],f}function cn(e){let t=(0,Z.c)(14),{activeDotIndex:n,plugin:r}=e,i;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,Q.jsx)(`span`,{className:`flex size-14 shrink-0 items-center justify-center rounded-xl bg-black text-white shadow-sm`,children:(0,Q.jsx)(Ee,{className:`size-12`})}),t[0]=i):i=t[0];let a;t[1]===n?a=t[2]:(a=Yt.map(e=>(0,Q.jsx)(`span`,{className:g(`size-1.5 rounded-full`,n===e?`bg-token-text-primary`:`bg-token-border-default`)},e)),t[1]=n,t[2]=a);let o;t[3]===a?o=t[4]:(o=(0,Q.jsx)(`span`,{className:`flex items-center gap-1`,children:a}),t[3]=a,t[4]=o);let s;t[5]===r?s=t[6]:(s=G(r),t[5]=r,t[6]=s);let c;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,Q.jsx)(fe,{className:`icon-md text-token-text-secondary`}),t[7]=c):c=t[7];let l;t[8]!==r.logoPath||t[9]!==s?(l=(0,Q.jsx)(`span`,{className:`bg-token-surface-tertiary flex size-14 shrink-0 items-center justify-center overflow-hidden rounded-xl border border-token-border-default shadow-sm`,children:(0,Q.jsx)(oe,{alt:s,className:`size-full object-contain`,logoUrl:r.logoPath,fallback:c})}),t[8]=r.logoPath,t[9]=s,t[10]=l):l=t[10];let u;return t[11]!==o||t[12]!==l?(u=(0,Q.jsxs)(`div`,{className:`flex items-center gap-3`,children:[i,o,l]}),t[11]=o,t[12]=l,t[13]=u):u=t[13],u}function ln(e){let t=(0,Z.c)(22),{appInstallBlockedReasonsById:n,appOrder:r,isAppBlockedReasonLoading:i,onConnectRequiredApp:a,onOpenChange:o,onTryInChat:s,onViewDetails:c,plugin:l,requiredApps:u,requiredBrowserExtensions:d}=e,f;t[0]===l?f=t[1]:(f=(0,Q.jsx)(un,{plugin:l}),t[0]=l,t[1]=f);let p;t[2]!==n||t[3]!==r||t[4]!==i||t[5]!==a||t[6]!==u?(p=(0,Q.jsx)(Cn,{appInstallBlockedReasonsById:n,appOrder:r,isAppBlockedReasonLoading:i,onConnectRequiredApp:a,requiredApps:u}),t[2]=n,t[3]=r,t[4]=i,t[5]=a,t[6]=u,t[7]=p):p=t[7];let m;t[8]===d?m=t[9]:(m=(0,Q.jsx)(Tn,{requiredBrowserExtensions:d}),t[8]=d,t[9]=m);let h;t[10]!==p||t[11]!==m?(h=(0,Q.jsxs)(ze,{className:`relative grid min-h-0 flex-1 px-6`,fadeClassName:`inset-x-6`,scrollClassName:`min-h-0 overflow-y-auto group-data-[can-scroll-down=true]:pb-6`,children:[p,m]}),t[10]=p,t[11]=m,t[12]=h):h=t[12];let g;t[13]!==o||t[14]!==s||t[15]!==c||t[16]!==l?(g=(0,Q.jsx)(dn,{onOpenChange:o,onTryInChat:s,onViewDetails:c,plugin:l}),t[13]=o,t[14]=s,t[15]=c,t[16]=l,t[17]=g):g=t[17];let _;return t[18]!==f||t[19]!==h||t[20]!==g?(_=(0,Q.jsxs)(`div`,{className:`flex max-h-full flex-col overflow-hidden`,children:[f,h,g]}),t[18]=f,t[19]=h,t[20]=g,t[21]=_):_=t[21],_}function un(e){let t=(0,Z.c)(18),{plugin:n}=e,r;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,Q.jsx)(`span`,{className:`flex size-[60px] shrink-0 items-center justify-center rounded-2xl bg-black text-white shadow-sm`,children:(0,Q.jsx)(Ee,{className:`size-12`})}),t[0]=r):r=t[0];let i;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,Q.jsxs)(`span`,{className:`flex items-center gap-2`,children:[(0,Q.jsx)(`span`,{className:`size-1.5 rounded-full bg-token-border-default`}),(0,Q.jsx)(`span`,{className:`size-1.5 rounded-full bg-token-border-default`}),(0,Q.jsx)(`span`,{className:`size-1.5 rounded-full bg-token-border-default`})]}),t[1]=i):i=t[1];let a;t[2]===n?a=t[3]:(a=G(n),t[2]=n,t[3]=a);let o;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,Q.jsx)(fe,{className:`icon-md text-token-text-secondary`}),t[4]=o):o=t[4];let s;t[5]!==n.logoPath||t[6]!==a?(s=(0,Q.jsxs)(`div`,{className:`flex items-center gap-4`,children:[r,i,(0,Q.jsx)(`span`,{className:`flex size-[60px] shrink-0 items-center justify-center overflow-hidden rounded-2xl bg-token-bg-primary shadow-sm`,children:(0,Q.jsx)(oe,{alt:a,className:`size-full object-contain`,logoUrl:n.logoPath,fallback:o})})]}),t[5]=n.logoPath,t[6]=a,t[7]=s):s=t[7];let c;t[8]===n?c=t[9]:(c=G(n),t[8]=n,t[9]=c);let l;t[10]===c?l=t[11]:(l=(0,Q.jsx)(Oe,{asChild:!0,children:(0,Q.jsx)(`div`,{className:`text-lg leading-6 font-semibold text-token-text-primary`,children:(0,Q.jsx)(k,{id:`plugins.installModal.needsApps.title`,defaultMessage:`Connect your apps to {pluginName}`,description:`Title shown after plugin install when app connections are available`,values:{pluginName:c}})})}),t[10]=c,t[11]=l);let u;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(u=(0,Q.jsx)(`div`,{className:`max-w-[432px] text-sm leading-5 text-token-text-secondary`,children:(0,Q.jsx)(k,{id:`plugins.installModal.needsApps.subtitle`,defaultMessage:`Get more relevant help from the apps you already use. You can always do this later.`,description:`Subtitle shown after plugin install when app connections are available`})}),t[12]=u):u=t[12];let d;t[13]===l?d=t[14]:(d=(0,Q.jsxs)(`div`,{className:`flex flex-col items-center gap-1 text-center`,children:[l,u]}),t[13]=l,t[14]=d);let f;return t[15]!==s||t[16]!==d?(f=(0,Q.jsxs)(`div`,{className:`flex shrink-0 flex-col items-center gap-4 px-6 pt-9 pb-4`,children:[s,d]}),t[15]=s,t[16]=d,t[17]=f):f=t[17],f}function dn(e){let t=(0,Z.c)(14),{onOpenChange:n,onTryInChat:r,onViewDetails:i,plugin:a}=e,o=a.plugin.interface?.defaultPrompt,s;t[0]===o?s=t[1]:(s=Fe(o),t[0]=o,t[1]=s);let c=s;if(r==null&&i==null)return null;let l;t[2]!==n||t[3]!==i||t[4]!==a?(l=i==null?null:(0,Q.jsx)(le,{color:`outline`,size:`default`,className:`h-9 rounded-xl px-3 py-2 text-sm leading-5`,style:{borderRadius:12},onClick:()=>{n(!1),i(a)},children:(0,Q.jsx)(k,{id:`plugins.installModal.needsApps.viewDetails`,defaultMessage:`View details`,description:`Button label to close the plugin onboarding modal and view plugin details`})}),t[2]=n,t[3]=i,t[4]=a,t[5]=l):l=t[5];let u;t[6]!==c||t[7]!==n||t[8]!==r||t[9]!==a?(u=r==null?null:(0,Q.jsxs)(le,{color:`primary`,size:`default`,className:`h-9 rounded-xl px-3 py-2 text-sm leading-5`,style:{borderRadius:12},onClick:()=>{n(!1),r(a,c)},children:[(0,Q.jsx)(pe,{className:`icon-sm`}),(0,Q.jsx)(k,{id:`plugins.installModal.needsApps.tryInChat`,defaultMessage:`Try {pluginName} in chat`,description:`Button label to close the plugin onboarding modal and try the plugin in chat`,values:{pluginName:G(a)}})]}),t[6]=c,t[7]=n,t[8]=r,t[9]=a,t[10]=u):u=t[10];let d;return t[11]!==l||t[12]!==u?(d=(0,Q.jsxs)(`div`,{className:`flex h-[84px] shrink-0 items-center justify-end gap-2 bg-token-dropdown-background px-6 py-6`,children:[l,u]}),t[11]=l,t[12]=u,t[13]=d):d=t[13],d}function fn(e){let t=(0,Z.c)(37),{appPersonalizationModes:n,disclosureData:r,hostId:i,installLockedComputerUse:a,isLoadingDisclosureData:o,onAppPersonalizationModeChange:s,onInstallLockedComputerUseChange:c,plugin:l,pluginDetail:u,shouldShowInstallDisclosure:d,showLockedComputerUseInstall:f}=e,p;t[0]===l?p=t[1]:(p=zn(l),t[0]=l,t[1]=p);let m=p,h;t[2]===l.plugin.interface?.capabilities?h=t[3]:(h=l.plugin.interface?.capabilities??[],t[2]=l.plugin.interface?.capabilities,t[3]=h);let g=h,_=r!=null&&(r.blurbs.length>0||r.personalizationToggles.length>0),v=!d||!_,y;t[4]!==l||t[5]!==v?(y=v?(0,Q.jsx)(Nn,{plugin:l}):null,t[4]=l,t[5]=v,t[6]=y):y=t[6];let b;t[7]!==m||t[8]!==v?(b=v&&m?(0,Q.jsxs)(Fn,{children:[(0,Q.jsx)(`div`,{className:`text-sm font-medium text-token-text-primary`,children:(0,Q.jsx)(k,{id:`plugins.installModal.about`,defaultMessage:`About`,description:`Section title for the plugin description in the plugin install modal`})}),(0,Q.jsx)(`div`,{className:`text-sm text-token-text-secondary`,children:m})]}):null,t[7]=m,t[8]=v,t[9]=b):b=t[9];let x;t[10]!==i||t[11]!==l||t[12]!==u||t[13]!==v?(x=v&&u!=null?(0,Q.jsx)(mn,{hostId:i,plugin:l,pluginDetail:u}):null,t[10]=i,t[11]=l,t[12]=u,t[13]=v,t[14]=x):x=t[14];let S;t[15]!==a||t[16]!==c||t[17]!==u||t[18]!==v||t[19]!==f?(S=v&&u!=null&&f?(0,Q.jsx)(bn,{enabled:a,onChange:c}):null,t[15]=a,t[16]=c,t[17]=u,t[18]=v,t[19]=f,t[20]=S):S=t[20];let C;t[21]!==g||t[22]!==v?(C=v&&g.length>0?(0,Q.jsxs)(Fn,{children:[(0,Q.jsx)(`div`,{className:`text-sm font-medium text-token-text-primary`,children:(0,Q.jsx)(k,{id:`plugins.installModal.capabilities`,defaultMessage:`Capabilities`,description:`Section title for the capability list in the plugin install modal`})}),(0,Q.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:g.map(pn)})]}):null,t[21]=g,t[22]=v,t[23]=C):C=t[23];let w;t[24]!==n||t[25]!==r||t[26]!==o||t[27]!==s||t[28]!==d?(w=d?(0,Q.jsx)(Sn,{appPersonalizationModes:n,disclosureData:r,isLoadingDisclosureData:o,onAppPersonalizationModeChange:s}):null,t[24]=n,t[25]=r,t[26]=o,t[27]=s,t[28]=d,t[29]=w):w=t[29];let ee;return t[30]!==y||t[31]!==b||t[32]!==x||t[33]!==S||t[34]!==C||t[35]!==w?(ee=(0,Q.jsxs)(`div`,{className:`rounded-2xl border border-token-border-default px-4 py-2`,children:[y,b,x,S,C,w]}),t[30]=y,t[31]=b,t[32]=x,t[33]=S,t[34]=C,t[35]=w,t[36]=ee):ee=t[36],ee}function pn(e){return(0,Q.jsx)(K,{className:`border border-token-border-default bg-transparent px-1.5 py-0.5 text-xs font-medium text-token-text-secondary`,children:e},e)}function mn(e){let t=(0,Z.c)(20),{hostId:n,plugin:r,pluginDetail:i}=e,a;t[0]!==n||t[1]!==r?(a={enabled:!0,hostId:n,plugin:r},t[0]=n,t[1]=r,t[2]=a):a=t[2];let o=Ot(a),s=i.apps,c,l,u,d,f;if(t[3]!==o||t[4]!==i.apps||t[5]!==i.mcpServers||t[6]!==i.skills){f=Symbol.for(`react.early_return_sentinel`);bb0:{let e=[{id:`apps`,items:s.map(yn),title:(0,Q.jsx)(k,{id:`plugins.installModal.includes.apps`,defaultMessage:`Apps`,description:`Label for bundled apps in the plugin install modal`})},{id:`browserExtensions`,items:(o??[]).map(vn),title:(0,Q.jsx)(k,{id:`plugins.installModal.includes.browserExtensions`,defaultMessage:`Browser extensions`,description:`Label for bundled browser extensions in the plugin install modal`})},{id:`skills`,items:i.skills.map(_n),title:(0,Q.jsx)(k,{id:`plugins.installModal.includes.skills`,defaultMessage:`Skills`,description:`Label for bundled skills in the plugin install modal`})},{id:`mcpServers`,items:i.mcpServers,title:(0,Q.jsx)(k,{id:`plugins.installModal.includes.mcpServers`,defaultMessage:`MCP servers`,description:`Label for bundled MCP servers in the plugin install modal`})}].filter(gn);if(e.length===0){f=null;break bb0}c=Fn,t[12]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,Q.jsx)(`div`,{className:`text-sm font-medium text-token-text-primary`,children:(0,Q.jsx)(k,{id:`plugins.installModal.includes`,defaultMessage:`Includes`,description:`Section title for bundled apps, skills, and MCP servers in the plugin install modal`})}),t[12]=d):d=t[12],l=`flex flex-col gap-3`,u=e.map(hn)}t[3]=o,t[4]=i.apps,t[5]=i.mcpServers,t[6]=i.skills,t[7]=c,t[8]=l,t[9]=u,t[10]=d,t[11]=f}else c=t[7],l=t[8],u=t[9],d=t[10],f=t[11];if(f!==Symbol.for(`react.early_return_sentinel`))return f;let p;t[13]!==l||t[14]!==u?(p=(0,Q.jsx)(`div`,{className:l,children:u}),t[13]=l,t[14]=u,t[15]=p):p=t[15];let m;return t[16]!==c||t[17]!==d||t[18]!==p?(m=(0,Q.jsxs)(c,{children:[d,p]}),t[16]=c,t[17]=d,t[18]=p,t[19]=m):m=t[19],m}function hn(e){return(0,Q.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,Q.jsx)(`div`,{className:`text-xs font-medium tracking-wide text-token-text-secondary uppercase`,children:e.title}),(0,Q.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:e.items.map(t=>(0,Q.jsx)(K,{className:`border border-token-border-default bg-transparent px-1.5 py-0.5 text-xs font-medium text-token-text-secondary`,children:t},`${e.id}-${t}`))})]},e.id)}function gn(e){return e.items.length>0}function _n(e){return Bn(e)}function vn(e){return e.name}function yn(e){return e.name}function bn(e){let t=(0,Z.c)(8),{enabled:n,onChange:r}=e,i=ne(),a;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,Q.jsx)(`div`,{className:`text-sm font-medium text-token-text-primary`,children:(0,Q.jsx)(k,{id:`plugins.installModal.lockedComputerUse.title`,defaultMessage:`Locked Computer Use`,description:`Title for the Locked Computer Use install option in the plugin install modal`})}),t[0]=a):a=t[0];let o;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,Q.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[a,(0,Q.jsx)(`div`,{className:`text-sm text-token-text-secondary`,children:(0,Q.jsx)(k,{id:`plugins.installModal.lockedComputerUse.description`,defaultMessage:`Let Codex use your Mac when it's locked. Learn more`,description:`Description for the Locked Computer Use install option in the plugin install modal`,values:{a:xn}})})]}),t[1]=o):o=t[1];let s;t[2]===i?s=t[3]:(s=i.formatMessage({id:`plugins.installModal.lockedComputerUse.toggle`,defaultMessage:`Install Locked Computer Use`,description:`Accessible label for the Locked Computer Use install option in the plugin install modal`}),t[2]=i,t[3]=s);let c;return t[4]!==n||t[5]!==r||t[6]!==s?(c=(0,Q.jsx)(Fn,{children:(0,Q.jsxs)(`div`,{className:`flex items-center justify-between gap-4`,children:[o,(0,Q.jsx)(Y,{checked:n,ariaLabel:s,onChange:r})]})}),t[4]=n,t[5]=r,t[6]=s,t[7]=c):c=t[7],c}function xn(e){return(0,Q.jsx)(`a`,{className:`inline-flex text-token-text-link-foreground`,href:Ve,target:`_blank`,rel:`noreferrer`,children:e})}function Sn(e){let t=(0,Z.c)(6),{appPersonalizationModes:n,disclosureData:r,isLoadingDisclosureData:i,onAppPersonalizationModeChange:a}=e;if(i){let e;return t[0]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Q.jsx)(Fn,{children:(0,Q.jsx)(On,{})}),t[0]=e):e=t[0],e}if(r==null||r.blurbs.length===0&&r.personalizationToggles.length===0)return null;let o;return t[1]!==n||t[2]!==r.blurbs||t[3]!==r.personalizationToggles||t[4]!==a?(o=(0,Q.jsx)(Fn,{children:(0,Q.jsx)(An,{appPersonalizationModes:n,blurbs:r.blurbs,onAppPersonalizationModeChange:a,personalizationToggles:r.personalizationToggles})}),t[1]=n,t[2]=r.blurbs,t[3]=r.personalizationToggles,t[4]=a,t[5]=o):o=t[5],o}function Cn(e){let t=(0,Z.c)(23),{appInstallBlockedReasonsById:n,appOrder:r,isAppBlockedReasonLoading:i,onConnectRequiredApp:a,requiredApps:o}=e,s=ne(),c;t[0]===r?c=t[1]:(c=new Map(r?.map(wn)),t[0]=r,t[1]=c);let l=c,u,d,f;if(t[2]!==n||t[3]!==l||t[4]!==s||t[5]!==i||t[6]!==a||t[7]!==o){f=Symbol.for(`react.early_return_sentinel`);bb0:{let e;t[11]===n?e=t[12]:(e=e=>n[e.appId]!==`disabled-by-admin`,t[11]=n,t[12]=e);let r=o.filter(e),c;if(t[13]===l?c=t[14]:(c=(e,t)=>(l.get(e.appId)??2**53-1)-(l.get(t.appId)??2**53-1),t[13]=l,t[14]=c),r.sort(c),r.length===0){f=null;break bb0}u=`flex flex-col`;let p;t[15]!==n||t[16]!==s||t[17]!==i||t[18]!==a?(p=e=>{let t=n[e.appId];return(0,Q.jsx)(pt,{app:Mn(e),cardIconContainerVariant:`outline`,className:`min-h-[72px] px-0 py-3 hover:!bg-transparent`,installActionDisabled:i||t!=null||e.status!==`pending`,installActionLabel:jn(e.status,s),isConnectingApp:e.status===`launching`||e.status===`waitingForCallback`,updatingAppId:null,onInstallApp:()=>a(e.appId)},e.appId)},t[15]=n,t[16]=s,t[17]=i,t[18]=a,t[19]=p):p=t[19],d=r.map(p)}t[2]=n,t[3]=l,t[4]=s,t[5]=i,t[6]=a,t[7]=o,t[8]=u,t[9]=d,t[10]=f}else u=t[8],d=t[9],f=t[10];if(f!==Symbol.for(`react.early_return_sentinel`))return f;let p;return t[20]!==u||t[21]!==d?(p=(0,Q.jsx)(`div`,{className:u,children:d}),t[20]=u,t[21]=d,t[22]=p):p=t[22],p}function wn(e,t){return[e,t]}function Tn(e){let t=(0,Z.c)(4),{requiredBrowserExtensions:n}=e;if(n.length===0)return null;let r;t[0]===n?r=t[1]:(r=n.map(En),t[0]=n,t[1]=r);let i;return t[2]===r?i=t[3]:(i=(0,Q.jsx)(`div`,{className:`flex flex-col`,children:r}),t[2]=r,t[3]=i),i}function En(e){return(0,Q.jsxs)(`div`,{className:`flex min-h-[72px] items-center justify-between gap-4 py-3`,children:[(0,Q.jsxs)(`div`,{className:`flex min-w-0 flex-1 items-center gap-4`,children:[(0,Q.jsx)(`span`,{className:`flex size-12 shrink-0 items-center justify-center overflow-hidden rounded-xl border border-token-border-default bg-token-bg-primary`,children:(0,Q.jsx)(oe,{alt:e.name,className:`size-8 object-contain`,fallback:(0,Q.jsx)(fe,{className:`icon-md text-token-text-secondary`}),logoUrl:e.iconUrl})}),(0,Q.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,Q.jsx)(`div`,{className:`truncate text-sm leading-6 font-medium text-token-text-primary`,children:e.name}),(0,Q.jsx)(`div`,{className:`truncate text-sm leading-5 text-token-text-tertiary`,children:(0,Q.jsx)(k,{...It.codexChromeDescription})})]})]}),(0,Q.jsx)(le,{color:`outline`,size:`toolbar`,className:`h-9 min-w-20 shrink-0 justify-center rounded-xl px-3 text-sm`,onClick:()=>{S.dispatchMessage(`open-in-browser`,{url:e.url,useExternalBrowser:!0})},children:(0,Q.jsx)(k,{id:`plugins.installModal.openBrowserExtension`,defaultMessage:`Open`,description:`Button label to open a browser extension setup URL`})})]},e.id)}function Dn(e){let t=(0,Z.c)(10),{children:n,url:r}=e,i;t[0]===r?i=t[1]:(i=r?.trim(),t[0]=r,t[1]=i);let a=i;if(!a){let e;return t[2]===n?e=t[3]:(e=(0,Q.jsx)(Q.Fragment,{children:n}),t[2]=n,t[3]=e),e}let o;t[4]===a?o=t[5]:(o=e=>{e.preventDefault(),S.dispatchMessage(`open-in-browser`,{url:a,useExternalBrowser:!0})},t[4]=a,t[5]=o);let s;return t[6]!==n||t[7]!==a||t[8]!==o?(s=(0,Q.jsx)(`a`,{href:a,className:`underline underline-offset-2 hover:no-underline`,onClick:o,children:n}),t[6]=n,t[7]=a,t[8]=o,t[9]=s):s=t[9],s}function On(){let e=(0,Z.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,Q.jsx)(`div`,{children:Array.from({length:3}).map(kn)}),e[0]=t):t=e[0],t}function kn(e,t){return(0,Q.jsxs)(`div`,{className:`flex flex-col gap-1 border-t border-token-border-default py-2.5 first:border-none first:pt-0 last:pb-0`,children:[(0,Q.jsx)(`div`,{className:`h-3 w-36 rounded bg-token-border-default`}),(0,Q.jsx)(`div`,{className:`h-2.5 w-full rounded bg-token-border-default`}),(0,Q.jsx)(`div`,{className:`h-2.5 w-4/5 rounded bg-token-border-default`})]},t)}function An(e){let t=(0,Z.c)(17),{appPersonalizationModes:n,blurbs:r,onAppPersonalizationModeChange:i,personalizationToggles:a}=e,o=ne(),s;if(t[0]!==n||t[1]!==o||t[2]!==i||t[3]!==a){let e;t[5]!==n||t[6]!==o||t[7]!==i?(e=e=>(0,Q.jsxs)(`div`,{className:`flex items-start justify-between gap-4 border-t border-token-border-default py-2.5 first:border-none first:pt-0 last:pb-0`,children:[(0,Q.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,Q.jsx)(`div`,{className:`font-medium text-token-text-primary`,children:e.blurb.title}),(0,Q.jsx)(`div`,{children:In(e.blurb.description)})]}),(0,Q.jsx)(Y,{checked:n[e.appId]===`PERSONALIZE_ALWAYS`,ariaLabel:o.formatMessage({id:`plugins.installModal.personalizationToggle`,defaultMessage:`Allow ChatGPT to use reference memories and chats for {appName}`,description:`Accessible label for the personalization toggle in the plugin install modal`},{appName:e.appName}),onChange:t=>{i({appId:e.appId,mode:t?`PERSONALIZE_ALWAYS`:`NO_PERSONALIZATION`})}})]},e.appId),t[5]=n,t[6]=o,t[7]=i,t[8]=e):e=t[8],s=a.map(e),t[0]=n,t[1]=o,t[2]=i,t[3]=a,t[4]=s}else s=t[4];let c;if(t[9]!==r||t[10]!==a.length){let e;t[12]===a.length?e=t[13]:(e=(e,t)=>(0,Q.jsxs)(`div`,{className:a.length>0||t>0?`flex flex-col gap-1 border-t border-token-border-default py-2.5 last:pb-0`:`flex flex-col gap-1 py-2.5 first:pt-0 last:pb-0`,children:[(0,Q.jsx)(`div`,{className:`font-medium text-token-text-primary`,children:e.title}),(0,Q.jsx)(`div`,{children:In(e.description)})]},`${e.title}-${t}`),t[12]=a.length,t[13]=e),c=r.map(e),t[9]=r,t[10]=a.length,t[11]=c}else c=t[11];let l;return t[14]!==s||t[15]!==c?(l=(0,Q.jsxs)(`div`,{className:`text-sm text-token-text-secondary`,children:[s,c]}),t[14]=s,t[15]=c,t[16]=l):l=t[16],l}function jn(e,t){switch(e){case`connected`:return t.formatMessage({id:`plugins.installModal.requiredApps.connected`,defaultMessage:`Connected`,description:`Button label shown for a required app that is already connected`});case`launching`:case`waitingForCallback`:return t.formatMessage({id:`plugins.installModal.requiredApps.connecting`,defaultMessage:`Opened link`,description:`Button label shown after the required app connection flow has been opened`});case`pending`:return t.formatMessage({id:`plugins.installModal.requiredApps.connect`,defaultMessage:`Connect`,description:`Button label shown for a required app that still needs to be connected`})}}function Mn(e){return{appMetadata:null,branding:null,description:e.description,distributionChannel:null,id:e.appId,installUrl:e.installUrl,isAccessible:!1,isEnabled:!1,labels:null,logoUrl:e.logoUrl,logoUrlDark:null,name:e.name,pluginDisplayNames:[]}}function Nn(e){let t=(0,Z.c)(14),{plugin:n}=e,r;t[0]===n?r=t[1]:(r=G(n),t[0]=n,t[1]=r);let i;t[2]===r?i=t[3]:(i=(0,Q.jsx)(`div`,{className:`text-sm font-medium text-token-text-primary`,children:r}),t[2]=r,t[3]=i);let a;t[4]===n.marketplaceName?a=t[5]:(a=n.marketplaceName.length>0?(0,Q.jsx)(K,{className:`border border-token-border-default bg-transparent px-1.5 py-0.5 text-xs font-medium text-token-text-secondary`,children:n.marketplaceName}):null,t[4]=n.marketplaceName,t[5]=a);let o;t[6]!==i||t[7]!==a?(o=(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[i,a]}),t[6]=i,t[7]=a,t[8]=o):o=t[8];let s;t[9]===n?s=t[10]:(s=(0,Q.jsx)(Pn,{plugin:n}),t[9]=n,t[10]=s);let c;return t[11]!==o||t[12]!==s?(c=(0,Q.jsxs)(Fn,{children:[o,s]}),t[11]=o,t[12]=s,t[13]=c):c=t[13],c}function Pn(e){let t=(0,Z.c)(11),{plugin:n}=e,r;t[0]===n.plugin.interface?.developerName?r=t[1]:(r=n.plugin.interface?.developerName?.trim(),t[0]=n.plugin.interface?.developerName,t[1]=r);let i=r,a;t[2]===n.plugin.interface?.category?a=t[3]:(a=n.plugin.interface?.category?.trim(),t[2]=n.plugin.interface?.category,t[3]=a);let o=a;if(i==null&&o==null)return null;let s;t[4]===i?s=t[5]:(s=i?(0,Q.jsx)(`div`,{children:(0,Q.jsx)(k,{id:`plugins.installModal.metadata.developer`,defaultMessage:`By {developerName}`,description:`Developer metadata shown in the plugin install modal`,values:{developerName:i}})}):null,t[4]=i,t[5]=s);let c;t[6]===o?c=t[7]:(c=o?(0,Q.jsx)(`div`,{children:(0,Q.jsx)(k,{id:`plugins.installModal.metadata.category`,defaultMessage:`Category: {category}`,description:`Category metadata shown in the plugin install modal`,values:{category:o}})}):null,t[6]=o,t[7]=c);let l;return t[8]!==s||t[9]!==c?(l=(0,Q.jsxs)(`div`,{className:`flex flex-col gap-1 text-sm text-token-text-secondary`,children:[s,c]}),t[8]=s,t[9]=c,t[10]=l):l=t[10],l}function Fn(e){let t=(0,Z.c)(2),{children:n}=e,r;return t[0]===n?r=t[1]:(r=(0,Q.jsx)(`div`,{className:`flex flex-col gap-2 border-b border-token-border-default py-3 last:border-none`,children:n}),t[0]=n,t[1]=r),r}function In(e){let t=[],n=0,r;for(;(r=Kt.exec(e))!=null;){r.index>n&&t.push(e.slice(n,r.index));let[i,a,o]=r,s=o.trim();if(s.length===0){t.push(a),n=r.index+i.length;continue}t.push((0,Q.jsx)(Dn,{url:s,children:a},`${s}-${r.index}`)),n=r.index+i.length}return n{let n=`${e.title}\u0000${e.description}`;return t.has(n)?[]:(t.add(n),[{description:e.description,title:e.title}])})}function Rn({draftModes:e,personalizationToggles:t}){let n={...e};if(t==null)return n;for(let e of t)n[e.appId]??=e.defaultMode;return n}function zn(e){return e.plugin.interface?.longDescription?.trim()||e.plugin.interface?.shortDescription?.trim()||e.description?.trim()||null}function Bn(e){return e.interface?.displayName?.trim()||p(e.name.split(`:`).pop()||e.name)}function Vn({forceReloadPlugins:e,hostId:t}){let n=v(w),r=ne(),i=j(),a=_(),l=de(t),f=n.query.snapshot(et),p=I(),[,m]=s(`composer_prefill`),h=N(`2761268526`),{data:g}=y(L,t),{clearPendingAppConnect:b,isAppConnectPending:ee,markAppConnectOAuthPending:T}=$e(),{closePluginInstallAppConnect:te,closePluginInstall:E,markPluginInstallStarted:D,markRequiredAppStatus:O,openPluginInstallDetails:k,openPluginInstall:A,openRequiredAppConnect:M,session:P,setPluginInstallNeedsApps:F}=me(),{data:R=[],hardRefetchAppsList:z}=ie({enabled:P.kind===`needsApps`||P.kind===`connectApp`,hostId:t}),B=V({apps:R,enabled:P.kind===`needsApps`||P.kind===`connectApp`})??R,re=P.kind===`needsApps`||P.kind===`connectApp`?P.requiredApps.map(e=>e.app):void 0,ae=P.kind===`details`||P.kind===`installing`?P.plugin:null,{blockedReasonsByConnectorId:oe}=We({hostId:t,pluginApps:re}),{blockedReason:ce,isLoading:le}=We(ae==null?{hostId:t}:{hostId:t,...Se(ae)}),ue=ge({hostId:t}),H=_e({hostId:t}),fe=ve({hostId:t}),pe=ue.available,he=H.available,xe=fe.available,[we,Te]=(0,at.useState)(!1),U=x({mutationFn:async e=>{let n=await c(`install-plugin`,{hostId:t,...Se(e)});return await Le({hostId:t,marketplacePath:e.marketplacePath,pluginName:e.plugin.name}),n}}),Ee=we||U.isPending,De=Ee||P.kind===`installing`,W=Hn({apps:B,appInstallBlockedReasonsById:oe,isAppConnectPending:ee,session:P}),Oe=W.kind===`needsApps`&&W.requiredBrowserExtensions.length===0&&W.requiredApps.length>0&&W.requiredApps.every(e=>e.status===`connected`),ke=(0,at.useEffectEvent)(t=>{E();let i=t.postInstallComposerPrefill?.trim();i&&m({text:i}),n.get(se).success(r.formatMessage({id:`plugins.install.ready`,defaultMessage:`{pluginName} is ready.`,description:`Toast shown when all required apps are connected for a plugin install flow`},{pluginName:G(t.plugin)})),e().catch(e=>{C.error(`Failed to refresh plugins after plugin app setup`,{safe:{},sensitive:{error:e}})})});(0,at.useEffect)(()=>{!Oe||W.kind!==`needsApps`||ke(W)},[Oe,W]);let Ae=e=>!(!pe&&ye(e.plugin.id)||!he&&Ce(e.plugin.id)||!xe&&be(e.plugin.id)),Me=e=>{n.get(se).success(r.formatMessage({id:`plugins.install.success`,defaultMessage:`{pluginName} plugin installed`,description:`Toast shown after a plugin is installed`},{pluginName:G(e)}))},Fe=async({installLockedComputerUse:i=!1,options:s,plugin:h})=>{if(Ee||le||!Ae(h)){E();return}Te(!0);try{if(Ge(h.plugin)||ce===`disabled-by-admin`){k(h,s);return}let _;try{_=await U.mutateAsync(h),s.origin===`setup_codex`&&u(n,d.CODEX_ONBOARDING_WIZARD_PHASE_PLUGIN_INSTALL,o.CODEX_ONBOARDING_WIZARD_ACTION_COMPLETED)}catch(e){C.error(`Failed to install plugin`,{safe:{},sensitive:{error:e}}),n.get(se).danger(r.formatMessage({id:`plugins.install.error`,defaultMessage:`Failed to install plugin`,description:`Toast shown when installing a plugin fails`})),E();return}let v=Pe(h.plugin.id);if(v!=null&&(await Ie(n,v,!1),await c(`batch-write-config-value`,{hostId:t,edits:Ne({pluginId:h.plugin.id,enabled:!0}),filePath:g?.configWriteTarget?.filePath??null,expectedVersion:null,reloadUserConfig:!0})),i&&ye(h.plugin.id)){let e=!1;try{let t=await X(!0);f.setData(e=>({computerIconDataURL:e?.computerIconDataURL??null,enabled:t,lockIconDataURL:e?.lockIconDataURL??null})),e=t!==!0}catch(t){C.error(`Failed to enable Locked Computer Use after install`,{safe:{},sensitive:{error:t}}),e=!0}e&&n.get(se).danger(r.formatMessage({id:`plugins.install.lockedComputerUseError`,defaultMessage:`Installed Computer Use, but failed to enable Locked Computer Use`,description:`Toast shown when Computer Use installs but Locked Computer Use cannot be enabled`}))}try{await e()}catch(e){C.error(`Failed to refresh plugins after install`,{safe:{},sensitive:{error:e}}),n.get(se).danger(r.formatMessage({id:`plugins.install.refreshError`,defaultMessage:`Installed {pluginName}, but failed to refresh the plugin list`,description:`Toast shown when a plugin installs successfully but the plugin list refresh fails`},{pluginName:G(h)}))}await Promise.all([p(je),p(tt)]);let y=await kt({authPolicy:_.authPolicy,codexHome:l,hostId:t,plugin:h,queryClient:a,windowType:`electron`});if(Me(h),_.authPolicy===`ON_USE`||_.appsNeedingAuth.length===0&&y.length===0){let e=s.postInstallComposerPrefill?.trim();e&&m({text:e}),E();return}F({apps:_.appsNeedingAuth,browserExtensions:y,connectingAppId:_.authPolicy===`ON_INSTALL`&&_.appsNeedingAuth.length===1&&y.length===0?_.appsNeedingAuth[0].id:void 0,options:s,plugin:h})}finally{Te(!1)}},Re=(0,at.useEffectEvent)(e=>{D(e.plugin.plugin.id),Fe({options:{origin:e.origin,postInstallComposerPrefill:e.postInstallComposerPrefill},plugin:e.plugin})});return(0,at.useEffect)(()=>{P.kind!==`installing`||P.installStarted||le||Re(P)},[le,P]),{closePluginInstall:()=>{if(!De){if(U.reset(),P.kind===`connectApp`){te();return}E()}},connectRequiredApp:async e=>{if(W.kind!==`needsApps`)return;let t=W.requiredApps.find(t=>t.appId===e);if(t==null||oe[e]!=null||t.status===`connected`||t.status===`launching`||t.status===`waitingForCallback`)return;let n=t.installUrl?.trim();if(!h&&n){S.dispatchMessage(`open-in-browser`,{url:n,useExternalBrowser:!0});return}b({appId:e}),M(e)},handleRequiredAppConnected:async e=>{O({appId:e,status:`connected`});try{await Qe({hostId:t,queryClient:a,refreshAppsList:z})}catch(e){C.error(`Failed to refresh apps after plugin app connect`,{safe:{},sensitive:{error:e}})}},handleRequiredAppOAuthStarted:({app:e,redirectUrl:n})=>{O({appId:e.id,status:`waitingForCallback`}),T({app:e,hostId:t,redirectUrl:n,returnTo:`${i.pathname}${i.search}${i.hash}`,resumeTarget:{kind:`plugin-install`}})},installPlugin:async(e={},t=!1)=>{P.kind===`details`&&await Fe({installLockedComputerUse:t,options:{origin:P.origin,postInstallComposerPrefill:P.postInstallComposerPrefill},plugin:P.plugin})},isInstalling:De,openPluginInstall:(e,t={})=>{De||!Ae(e)||(U.reset(),A(e,t))},session:W}}function Hn({apps:e,isAppConnectPending:t,appInstallBlockedReasonsById:n,session:r}){if(r.kind===`closed`)return r;if(r.kind===`details`)return{kind:`details`,postInstallComposerPrefill:r.postInstallComposerPrefill,plugin:r.plugin};if(r.kind===`installing`)return{kind:`installing`,plugin:r.plugin};let i=new Map;e.forEach(e=>{i.set(e.id,e)});let a=r.requiredApps.map(e=>Un({appInstallBlockedReasonsById:n,appsById:i,isAppConnectPending:t,requiredApp:e}));if(r.kind===`connectApp`){let e=a.find(e=>e.appId===r.app.id)??Un({appInstallBlockedReasonsById:n,appsById:i,isAppConnectPending:t,requiredApp:{app:r.app,status:`pending`}});return{kind:`connectApp`,plugin:r.plugin,app:e}}return{kind:`needsApps`,postInstallComposerPrefill:r.postInstallComposerPrefill,plugin:r.plugin,requiredBrowserExtensions:r.requiredBrowserExtensions,requiredApps:a}}function Un({appInstallBlockedReasonsById:e,appsById:t,isAppConnectPending:n,requiredApp:r}){let i=t.get(r.app.id),a=r.status;return i?.isAccessible===!0||e[r.app.id]===`disabled-by-admin`?a=`connected`:r.status===`waitingForCallback`&&!n(r.app.id)&&(a=`pending`),{appId:r.app.id,description:i?.description??r.app.description,installUrl:i?.installUrl??r.app.installUrl,logoUrl:i?.logoUrl??null,name:i?.name??r.app.name,status:a}}export{zt as a,xt as c,lt as d,ct as f,nt as g,it as h,Rt as i,pt as l,ot as m,Zt as n,It as o,st as p,Vt as r,Ot as s,Vn as t,ut as u}; +import{s as e}from"./chunk-Bj-mKKzh.js";import{$i as t,Li as n,Or as r,ia as i,jr as a}from"./src-CYrn1fYL.js";import{Os as o,Vo as s,bc as c,es as l,ji as u,ks as d,uo as f,yr as p}from"./app-server-manager-signals-BOGyjFm3.js";import{n as m,t as h}from"./jsx-runtime-CiQ1k8xo.js";import{t as g}from"./clsx-BcPLHiun.js";import{A as _,F as v,P as y,R as b,_ as x,f as S,g as C,h as w,lt as ee,n as T,o as te,r as E,u as D,v as O}from"./vscode-api-sUstfl-x.js";import{c as ne,o as k,r as A}from"./lib-MoKmYgcO.js";import{f as j}from"./chunk-LFPYN7LY-DwFbyqR1.js";import{t as M}from"./queryOptions-CAm1uWNO.js";import{o as N,p as P}from"./statsig-Cajk3UKk.js";import{t as F}from"./request-BXHjsnqU.js";import{t as I}from"./invalidate-queries-and-broadcast-dPfhRWCd.js";import{C as L,c as R}from"./config-queries-BDIsZFnB.js";import{r as z}from"./remote-connection-visibility-CDSfTp_2.js";import{t as B}from"./use-auth-DXLjX3T4.js";import{p as re}from"./codex-api-DRlZt5zW.js";import{c as V,s as ie,v as ae}from"./apps-queries-CBUjthvi.js";import{t as oe}from"./connector-logo-uEk_Q1Qc.js";import{r as se}from"./toast-signal-By11REe1.js";import{t as ce}from"./tooltip-BhXPONlb.js";import{t as le}from"./button-Xd4Hy1MO.js";import{r as ue,t as H}from"./spinner-Dvc_A3Ae.js";import{t as de}from"./use-codex-home-zmo5hiIG.js";import{t as fe}from"./apps-DBd5dYzG.js";import{t as pe}from"./chats-K-296NKY.js";import{t as me}from"./plugin-install-store-BWRSuKkC.js";import{t as he}from"./use-platform-BkwBnkgx.js";import{i as ge,n as _e,r as ve}from"./use-is-plugins-enabled-DudZfU21.js";import{d as ye,f as be,n as xe,o as Se,p as Ce,s as we}from"./use-plugins-BKOuT9XR.js";import{t as Te}from"./info-BV-snsxq.js";import{t as U}from"./settings.cog-CJF3NOGk.js";import{t as Ee}from"./openai-blossom-DWhxKWUa.js";import{n as De,t as W}from"./filesystem-media-src-DlToOKVI.js";import{d as Oe,l as ke,n as Ae}from"./dialog-layout-CCvvb1Vc.js";import{t as je}from"./use-skills-DK2PGa-B.js";import{t as Me}from"./check-md-CZTnvSiA.js";import{n as Ne,r as Pe}from"./plugin-config-edits-DJ9rwaYl.js";import{n as Fe}from"./plugin-prefill-prompt-Cs8725Fp.js";import{a as Ie,c as Le,l as G,o as Re,s as ze}from"./plugins-availability-C9cwO-r4.js";import{c as Be}from"./plan-management-state-CAozl_mZ.js";import{m as Ve}from"./links-DlYWpuc5.js";import{t as He}from"./upgrade-plan-dialog-launcher-lIFGy25G.js";import{t as K}from"./badge-mYHx4F5K.js";import{r as q,t as J}from"./dropdown-CHaZfyxI.js";import{t as Ue}from"./chevron-D6hquBJC.js";import{n as We,t as Ge}from"./check-plugin-availability-C1II8bXB.js";import{r as Ke}from"./plugin-detail-queries-nEDuNCez.js";import{t as qe}from"./use-codex-pricing-url-BucpTKgk.js";import{t as Je}from"./log-out-DJTSj1t6.js";import{t as Y}from"./toggle-CHrq20xd.js";import{t as Ye}from"./lock-DV6CP31m.js";import{t as Xe}from"./connected-apps-Dck9Rcbz.js";import{t as Ze}from"./regenerate-Co1G5oL3.js";import{i as Qe,n as $e}from"./app-connect-oauth-Bb1UV73Z.js";import{o as X,r as et}from"./computer-use-app-approvals-query-CZtrSy1-.js";import{t as tt}from"./hooks-settings-queries-BpMbCsRw.js";var Z=ee();function nt(){let e=(0,Z.c)(3),[t]=s(`remote_control_connections_state`),n=z(),r;return e[0]!==t||e[1]!==n?(r=rt({remoteControlConnectionsState:t,slingshotEnabled:n}),e[0]=t,e[1]=n,e[2]=r):r=e[2],r}function rt({remoteControlConnectionsState:e,slingshotEnabled:t}){return t&&(e?.available??!0)&&e?.accessRequired!==!0}function it({selectedConnectionsTab:e,showControlOtherDevices:t,showControlThisMacTab:n,showRemoteControlConnectionsSection:r,showRemoteSshConnections:i,showTabbedSshPage:a}){return r?e===`control-this-mac`&&!n?t?`access-other-devices`:`ssh`:e===`access-other-devices`&&!t?n?`control-this-mac`:`ssh`:e===`ssh`&&!a?t?`access-other-devices`:`control-this-mac`:e:i?`ssh`:`access-other-devices`}var at=e(m(),1);function ot(e,t){let n=(0,Z.c)(5),r=(0,at.useEffectEvent)(e),i;n[0]!==t||n[1]!==r?(i=()=>{if(t==null)return;let e=window.setInterval(()=>{r()},t);return()=>{window.clearInterval(e)}},n[0]=t,n[1]=r,n[2]=i):i=n[2];let a;n[3]===t?a=n[4]:(a=[t],n[3]=t,n[4]=a),(0,at.useEffect)(i,a)}var st=b(w,(e,{get:t})=>t(P,`2296472986`)&&rt({remoteControlConnectionsState:l(t,`remote_control_connections_state`),slingshotEnabled:t(P,`1042620455`)})&&t(R,{hostId:e}).data?.requirements?.computerUse?.allowLockedComputerUse!==!1),Q=h(),ct=e=>(0,Q.jsxs)(`svg`,{width:18,height:18,viewBox:`0 0 18 18`,fill:`none`,xmlns:`http://www.w3.org/2000/svg`,...e,children:[(0,Q.jsx)(`path`,{fillRule:`evenodd`,clipRule:`evenodd`,d:`M12.6673 9.45374C13.7358 9.45407 14.5577 10.3579 14.5579 11.4156V11.8239C15.1086 11.929 15.5247 12.4134 15.5247 12.9948V15.0504C15.5245 15.7084 14.9913 16.2418 14.3333 16.2418H11.0003C10.3423 16.2418 9.8081 15.7084 9.80789 15.0504V12.9948C9.80789 12.4134 10.2248 11.9291 10.7757 11.8239V11.4156C10.7759 10.3577 11.5984 9.45374 12.6673 9.45374ZM11.0003 12.8531C10.9221 12.8532 10.8587 12.9165 10.8587 12.9948V15.0504C10.8589 15.1285 10.9222 15.192 11.0003 15.192H14.3333C14.4114 15.192 14.4747 15.1285 14.4749 15.0504V12.9948C14.4749 12.9165 14.4115 12.8531 14.3333 12.8531H11.0003ZM12.6673 10.5045C12.2277 10.5045 11.8267 10.887 11.8264 11.4156V11.8024H13.5081V11.4156C13.5079 10.8873 13.1066 10.5049 12.6673 10.5045Z`,fill:`currentColor`}),(0,Q.jsx)(`path`,{d:`M8.2659 9.84534C8.55342 9.80818 8.81657 10.011 8.85379 10.2985C8.89088 10.5859 8.68813 10.8491 8.40067 10.8864C6.26147 11.1628 4.57997 12.9025 4.39188 15.068C4.36673 15.3568 4.11136 15.5706 3.82254 15.5455C3.53398 15.5202 3.32001 15.2658 3.345 14.9772C3.57594 12.3179 5.63935 10.1848 8.2659 9.84534Z`,fill:`currentColor`}),(0,Q.jsx)(`path`,{fillRule:`evenodd`,clipRule:`evenodd`,d:`M9.00028 2.31116C10.757 2.3113 12.1809 3.73602 12.1809 5.4928C12.1809 7.2495 10.757 8.67332 9.00028 8.67346C7.24346 8.67346 5.81872 7.24959 5.81863 5.4928C5.81863 3.73593 7.24341 2.31116 9.00028 2.31116ZM9.00028 3.36194C7.82331 3.36194 6.86942 4.31583 6.86942 5.4928C6.8695 6.66969 7.82336 7.62366 9.00028 7.62366C10.1771 7.62351 11.131 6.6696 11.1311 5.4928C11.1311 4.31592 10.1771 3.36208 9.00028 3.36194Z`,fill:`currentColor`})]});function lt(e){let t=(0,Z.c)(3),{ariaLabel:n,icon:r}=e,i;return t[0]!==n||t[1]!==r?(i=(0,Q.jsx)(`span`,{role:`img`,"aria-label":n,className:`flex h-7 w-7 items-center justify-center rounded-md text-token-description-foreground`,children:r}),t[0]=n,t[1]=r,t[2]=i):i=t[2],i}function ut(e){let t=(0,Z.c)(49),{icon:n,title:r,description:i,contentClassName:a,descriptionClassName:o,badges:s,actions:c,actionsPlacement:l,onClick:u,iconContainer:d,iconContainerVariant:f,className:p}=e,m=l===void 0?`top`:l,h=d===void 0?!0:d,_=f===void 0?`filled`:f,v;t[0]===u?v=t[1]:(v=e=>{u&&e.target===e.currentTarget&&(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),u())},t[0]=u,t[1]=v);let y=v,b=m===`center`&&!!c,x;t[2]===c?x=t[3]:(x=c?(0,Q.jsx)(`div`,{className:`flex shrink-0 items-center`,children:c}):null,t[2]=c,t[3]=x);let S=x,C=u?`cursor-interaction`:null,w;t[4]!==p||t[5]!==C?(w=g(`border-token-border/40 flex flex-col gap-2.5 rounded-2xl border p-2.5 transition-colors hover:bg-token-foreground/5`,C,p),t[4]=p,t[5]=C,t[6]=w):w=t[6];let ee=u?`button`:void 0,T=u?0:-1,te;t[7]!==n||t[8]!==h||t[9]!==_?(te=n?h?(0,Q.jsx)(`span`,{className:g(`flex h-10 w-10 shrink-0 items-center justify-center rounded-lg`,_===`outline`?`border border-token-border-default bg-transparent`:`bg-token-bg-primary`),children:n}):(0,Q.jsx)(`span`,{className:`shrink-0`,children:n}):null,t[7]=n,t[8]=h,t[9]=_,t[10]=te):te=t[10];let E=b?`items-center gap-3`:null,D;t[11]===E?D=t[12]:(D=g(`flex min-w-0 flex-1`,E),t[11]=E,t[12]=D);let O;t[13]===a?O=t[14]:(O=g(`flex min-w-0 flex-1 flex-col justify-center gap-0.5`,a),t[13]=a,t[14]=O);let ne=b?null:`justify-between`,k;t[15]===ne?k=t[16]:(k=g(`flex min-w-0 items-center gap-2`,ne),t[15]=ne,t[16]=k);let A;t[17]===r?A=t[18]:(A=(0,Q.jsx)(`div`,{className:`truncate font-medium text-token-foreground`,children:r}),t[17]=r,t[18]=A);let j;t[19]===s?j=t[20]:(j=s?.length?(0,Q.jsx)(`div`,{className:`flex shrink-0 items-center gap-1`,children:s.map(dt)}):null,t[19]=s,t[20]=j);let M;t[21]!==A||t[22]!==j?(M=(0,Q.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[A,j]}),t[21]=A,t[22]=j,t[23]=M):M=t[23];let N=b?null:S,P;t[24]!==k||t[25]!==M||t[26]!==N?(P=(0,Q.jsxs)(`div`,{className:k,children:[M,N]}),t[24]=k,t[25]=M,t[26]=N,t[27]=P):P=t[27];let F;t[28]!==i||t[29]!==o?(F=i?(0,Q.jsx)(`div`,{className:g(`text-token-text-secondary text-sm leading-relaxed`,o??`line-clamp-3`),children:i}):null,t[28]=i,t[29]=o,t[30]=F):F=t[30];let I;t[31]!==O||t[32]!==P||t[33]!==F?(I=(0,Q.jsxs)(`div`,{className:O,children:[P,F]}),t[31]=O,t[32]=P,t[33]=F,t[34]=I):I=t[34];let L=b?S:null,R;t[35]!==D||t[36]!==I||t[37]!==L?(R=(0,Q.jsxs)(`div`,{className:D,children:[I,L]}),t[35]=D,t[36]=I,t[37]=L,t[38]=R):R=t[38];let z;t[39]!==te||t[40]!==R?(z=(0,Q.jsxs)(`div`,{className:`flex items-center gap-3`,children:[te,R]}),t[39]=te,t[40]=R,t[41]=z):z=t[41];let B;return t[42]!==y||t[43]!==u||t[44]!==z||t[45]!==w||t[46]!==ee||t[47]!==T?(B=(0,Q.jsx)(`div`,{className:w,role:ee,tabIndex:T,onClick:u,onKeyDown:y,children:z}),t[42]=y,t[43]=u,t[44]=z,t[45]=w,t[46]=ee,t[47]=T,t[48]=B):B=t[48],B}function dt(e,t){return typeof e==`string`?(0,Q.jsx)(K,{className:`border border-token-border-default bg-transparent px-1.5 py-0.5 text-xs font-medium text-token-text-secondary`,children:e},e):(0,Q.jsx)(`span`,{className:`flex items-center`,children:e},t)}var ft=e=>(0,Q.jsx)(`svg`,{width:20,height:20,viewBox:`0 0 20 20`,fill:`none`,xmlns:`http://www.w3.org/2000/svg`,...e,children:(0,Q.jsx)(`path`,{d:`M13.3333 4.16663L6.66663 15.8333`,stroke:`currentColor`,strokeWidth:1.33,strokeLinecap:`round`})}),$=A({noDescription:{id:`skills.appsPage.apps.noDescription`,defaultMessage:`No description`,description:`Fallback description for apps without description text on the Skills & Apps page`},manageOnChatGpt:{id:`skills.appsPage.apps.manageOnChatGpt`,defaultMessage:`Manage on ChatGPT`,description:`Button label to manage an installed app on ChatGPT from the Skills & Apps page`},disableToggleTooltip:{id:`skills.appsPage.apps.disableToggle`,defaultMessage:`Disable app`,description:`Tooltip label for disabling an app from the Skills & Apps page`},enableToggleTooltip:{id:`skills.appsPage.apps.enableToggleTooltip`,defaultMessage:`Enable app`,description:`Tooltip label for enabling an app from the Skills & Apps page`},enableToggleAria:{id:`skills.appsPage.apps.enableToggle`,defaultMessage:`Enable app`,description:`Accessible label for toggling whether an installed app is enabled from the Skills & Apps page`},connectingApp:{id:`skills.appsPage.apps.connecting`,defaultMessage:`Continue connecting app`,description:`Accessible label for the button shown while an app OAuth flow is still finishing on the Skills & Apps page`},connectApp:{id:`skills.appsPage.apps.connect`,defaultMessage:`Connect`,description:`Button label to connect an app from the Skills & Apps page`},enabledStatus:{id:`skills.appsPage.apps.enabledStatus`,defaultMessage:`App enabled`,description:`Status label for an installed app that is enabled`},disabledStatus:{id:`skills.appsPage.apps.disabledStatus`,defaultMessage:`App disabled`,description:`Status label for an installed app that is disabled`},connectedTo:{id:`skills.appsPage.apps.connectedTo`,defaultMessage:`Connected to {email}`,description:`Tooltip shown for an app with the connected account email`}});function pt(e){let t=(0,Z.c)(45),{app:n,cardIcon:r,cardIconContainer:i,cardIconContainerVariant:a,badges:o,blockedStatusLabel:s,className:c,connectedAccountEmail:l,installBlockedReason:u,installedStateAction:d,installActionDisabled:f,installActionLabel:p,manageAction:m,isConnectingApp:h,showInstallAction:_,updatingAppId:v,onInstallApp:y,onOpenAppTools:b,onOpenAppUrl:x,onSetAppEnabled:S}=e,C=i===void 0?!0:i,w=l===void 0?null:l,ee=u===void 0?null:u,T=d===void 0?`check`:d,te=f===void 0?!1:f,E=m===void 0?`button`:m,D=_===void 0?!0:_,O=ne(),A;t[0]!==p||t[1]!==O?(A=p??O.formatMessage($.connectApp),t[0]=p,t[1]=O,t[2]=A):A=t[2];let j=A,M=n.isEnabled,N=ee===`disabled-by-admin`&&!n.isAccessible,P=v===n.id,F;t[3]!==w||t[4]!==O?(F=w==null?null:O.formatMessage($.connectedTo,{email:w}),t[3]=w,t[4]=O,t[5]=F):F=t[5];let I=F,L;t[6]!==o||t[7]!==I?(L=I==null?o:[(0,Q.jsxs)(`span`,{className:`inline-flex items-center gap-1`,children:[o,(0,Q.jsx)(ce,{tooltipContent:I,children:(0,Q.jsx)(`button`,{type:`button`,className:`inline-flex shrink-0 cursor-interaction items-center justify-center text-token-description-foreground hover:text-token-foreground`,"aria-label":I,onClick:vt,children:(0,Q.jsx)(Te,{className:`icon-2xs`})})})]},`connected-account-badge`)],t[6]=o,t[7]=I,t[8]=L):L=t[8];let R=L,z;t[9]===c?z=t[10]:(z=g(`group justify-center border-none`,c),t[9]=c,t[10]=z);let B;t[11]!==n||t[12]!==r?(B=r??(0,Q.jsx)(oe,{alt:n.name,appInfo:n,className:`icon-md`,fallback:(0,Q.jsx)(Xe,{className:`icon-sm text-token-text-secondary`})}),t[11]=n,t[12]=r,t[13]=B):B=t[13];let re;t[14]===n.description?re=t[15]:(re=n.description??(0,Q.jsx)(k,{...$.noDescription}),t[14]=n.description,t[15]=re);let V;t[16]!==n||t[17]!==b?(V=b==null?void 0:()=>{b(n)},t[16]=n,t[17]=b,t[18]=V):V=t[18];let ie;t[19]!==n||t[20]!==s||t[21]!==j||t[22]!==te||t[23]!==T||t[24]!==O||t[25]!==h||t[26]!==M||t[27]!==N||t[28]!==P||t[29]!==E||t[30]!==y||t[31]!==x||t[32]!==S||t[33]!==D?(ie=N&&s!=null?(0,Q.jsx)(`span`,{className:`inline-flex items-center gap-1 text-right text-sm text-token-text-secondary`,children:s}):n.isAccessible&&T===`toggle`?(0,Q.jsxs)(`div`,{className:`flex items-center gap-2`,children:[E===`menu`?(0,Q.jsx)(`div`,{onClick:_t,onKeyDown:gt,children:M?(0,Q.jsxs)(J,{align:`end`,contentWidth:`xs`,triggerButton:(0,Q.jsxs)(le,{className:`gap-1.5`,color:`outline`,size:`medium`,disabled:h||P,children:[(0,Q.jsx)(`span`,{className:`size-1.5 shrink-0 rounded-full bg-token-charts-green`}),(0,Q.jsx)(k,{id:`skills.appsPage.apps.connected`,defaultMessage:`Connected`,description:`Button label shown for an app that is connected`}),(0,Q.jsx)(Ue,{className:`icon-2xs shrink-0 text-token-description-foreground`})]}),children:[(0,Q.jsx)(q.Item,{LeftIcon:Ze,onSelect:()=>{y(n)},children:(0,Q.jsx)(k,{id:`skills.appsPage.apps.reconnect`,defaultMessage:`Reconnect`,description:`Menu item label for reconnecting an app`})}),(0,Q.jsx)(q.Item,{LeftIcon:Je,className:`text-token-charts-red`,leftIconClassName:`icon-xs text-token-charts-red`,onSelect:()=>{x?.(ae(n))},children:(0,Q.jsx)(k,{id:`skills.appsPage.apps.disconnect`,defaultMessage:`Disconnect`,description:`Menu item label for disconnecting an app`})})]}):(0,Q.jsx)(le,{className:`min-w-24 shrink-0 justify-center`,color:`outline`,size:`medium`,loading:P,onClick:()=>{S?.({appId:n.id,enabled:!0})},children:j})}):(0,Q.jsx)(`div`,{className:`invisible opacity-0 group-focus-within:visible group-focus-within:opacity-100 group-hover:visible group-hover:opacity-100`,children:(0,Q.jsx)(ce,{tooltipContent:(0,Q.jsx)(k,{...$.manageOnChatGpt}),children:(0,Q.jsx)(le,{color:`ghost`,size:`icon`,"aria-label":O.formatMessage($.manageOnChatGpt),onClick:e=>{e.stopPropagation(),x?.(ae(n))},children:(0,Q.jsx)(U,{className:`icon-sm`})})})}),E===`menu`?null:(0,Q.jsx)(ce,{tooltipContent:M?(0,Q.jsx)(k,{...$.disableToggleTooltip}):(0,Q.jsx)(k,{...$.enableToggleTooltip}),children:(0,Q.jsx)(`div`,{onClick:ht,onKeyDown:mt,children:(0,Q.jsx)(Y,{checked:M,disabled:P,onChange:e=>{S?.({appId:n.id,enabled:e})},ariaLabel:O.formatMessage($.enableToggleAria)})})})]}):n.isAccessible?(0,Q.jsx)(lt,{ariaLabel:O.formatMessage(M?$.enabledStatus:$.disabledStatus),icon:M?(0,Q.jsx)(Me,{className:`icon-sm`}):(0,Q.jsx)(ft,{className:`icon-sm`})}):D?(0,Q.jsx)(ce,{tooltipContent:N?(0,Q.jsx)(k,{id:`plugins.install.disabledByAdmin`,defaultMessage:`Disabled by admin`,description:`Tooltip shown when plugin install is unavailable because all included connectors are disabled by admin`}):h?(0,Q.jsx)(k,{...$.connectingApp}):j,children:(0,Q.jsx)(`div`,{children:(0,Q.jsx)(le,{className:`min-w-24 shrink-0 justify-center`,color:`outline`,size:`medium`,disabled:N||te,"aria-label":h?O.formatMessage($.connectingApp):j,onClick:e=>{e.stopPropagation(),!N&&y(n)},children:h?(0,Q.jsx)(H,{className:`icon-xxs`}):j})})}):null,t[19]=n,t[20]=s,t[21]=j,t[22]=te,t[23]=T,t[24]=O,t[25]=h,t[26]=M,t[27]=N,t[28]=P,t[29]=E,t[30]=y,t[31]=x,t[32]=S,t[33]=D,t[34]=ie):ie=t[34];let se;return t[35]!==n.name||t[36]!==R||t[37]!==C||t[38]!==a||t[39]!==z||t[40]!==B||t[41]!==re||t[42]!==V||t[43]!==ie?(se=(0,Q.jsx)(ut,{className:z,actionsPlacement:`center`,iconContainer:C,iconContainerVariant:a,icon:B,title:n.name,badges:R,description:re,descriptionClassName:`line-clamp-1`,onClick:V,actions:ie}),t[35]=n.name,t[36]=R,t[37]=C,t[38]=a,t[39]=z,t[40]=B,t[41]=re,t[42]=V,t[43]=ie,t[44]=se):se=t[44],se}function mt(e){e.stopPropagation()}function ht(e){e.stopPropagation()}function gt(e){e.stopPropagation()}function _t(e){e.stopPropagation()}function vt(e){e.stopPropagation()}function yt({browserExtensionId:e}){return M({queryKey:e==null?[`chrome-extension-installed-read`,`missing`]:E(`chrome-extension-installed-read`,{extensionId:e}),queryFn:async()=>e==null?{installed:!1}:T(`chrome-extension-installed-read`,{params:{extensionId:e}}),staleTime:D.FIVE_SECONDS})}function bt(e){return e?.installed===!0}function xt(e){let t=(0,Z.c)(10),{browserExtensionId:n}=e,r=n!=null,i;t[0]===n?i=t[1]:(i=yt({browserExtensionId:n}),t[0]=n,t[1]=i);let a;t[2]!==r||t[3]!==i?(a={enabled:r,refetchOnWindowFocus:!0,staleTime:D.FIVE_SECONDS,...i},t[2]=r,t[3]=i,t[4]=a):a=t[4];let{data:o,isLoading:s}=O(a),c;t[5]===o?c=t[6]:(c=bt(o),t[5]=o,t[6]=c);let l=n!=null&&s,u;return t[7]!==c||t[8]!==l?(u={isConnected:c,isLoading:l},t[7]=c,t[8]=l,t[9]=u):u=t[9],u}var St=`assets/google-chrome.png`,Ct=`scripts/extension-id.json`,wt=`https://chromewebstore.google.com/detail/codex/`,Tt=n([`chrome`,`chrome-dev`,`chrome-internal`]),Et=t({extensionId:i().trim().min(1)});async function Dt({codexHome:e,hostId:t,plugin:n,queryClient:r}){try{let i=jt(e,n);if(i==null)return[];let a={hostId:t,path:i};return await r.fetchQuery({queryFn:async()=>{let t=await T(`read-file`,{params:a});return[Nt({codexHome:e,extensionId:Et.parse(JSON.parse(t.contents)).extensionId,plugin:n})]},queryKey:Ft(a),retry:!1,staleTime:D.INFINITE})}catch(e){return C.warning(`Failed to read plugin browser extension setup`,{safe:{},sensitive:{error:e,pluginId:n.plugin.id}}),[]}}function Ot(e){let t=(0,Z.c)(17),{enabled:n,hostId:r,plugin:i}=e,a=de(r),o,s,c,l;t[0]!==a||t[1]!==n||t[2]!==r||t[3]!==i?(o=jt(a,i),l=O,s=n&&o!=null,c=o==null?[`plugins`,`browser-extension-setup`,`missing`]:Ft({hostId:r,path:o}),t[0]=a,t[1]=n,t[2]=r,t[3]=i,t[4]=o,t[5]=s,t[6]=c,t[7]=l):(o=t[4],s=t[5],c=t[6],l=t[7]);let u;t[8]!==a||t[9]!==o||t[10]!==r||t[11]!==i?(u=async()=>{if(o==null||i==null)return[];let e=await T(`read-file`,{params:{hostId:r,path:o}});return[Nt({codexHome:a,extensionId:Et.parse(JSON.parse(e.contents)).extensionId,plugin:i})]},t[8]=a,t[9]=o,t[10]=r,t[11]=i,t[12]=u):u=t[12];let d;t[13]!==s||t[14]!==c||t[15]!==u?(d={enabled:s,queryKey:c,queryFn:u,retry:!1,staleTime:D.INFINITE},t[13]=s,t[14]=c,t[15]=u,t[16]=d):d=t[16];let{data:f}=l(d);return f}async function kt({authPolicy:e,codexHome:t,hostId:n,plugin:r,queryClient:i,windowType:a}){if(e!==`ON_INSTALL`||a!==`electron`||Mt(r)==null)return[];let o=await Dt({codexHome:t??(await T(`codex-home`,{params:{hostId:n}})).codexHome,hostId:n,plugin:await At({hostId:n,plugin:r}),queryClient:i});return(await Promise.all(o.map(async e=>({browserExtension:e,needsSetup:!bt(await i.fetchQuery({...yt({browserExtensionId:e.id}),staleTime:0}))})))).filter(({needsSetup:e})=>e).map(({browserExtension:e})=>e)}async function At({hostId:e,plugin:t}){try{return xe((await c(`read-plugin`,{hostId:e,...Se(t)})).plugin)}catch(e){return C.warning(`Failed to read installed plugin browser extension setup`,{safe:{},sensitive:{error:e,pluginId:t.plugin.id}}),t}}function jt(e,t){return e==null||t?.plugin.source.type!==`local`||Mt(t)==null?null:f(r({codexHome:e,localVersion:t.plugin.localVersion,marketplaceName:t.marketplaceName,pluginName:t.plugin.name}),Ct)}function Mt(e){let t=Tt.safeParse(e.plugin.name);return!t.success||!e.plugin.id.startsWith(`${t.data}@`)?null:t.data}function Nt({codexHome:e,extensionId:t,plugin:n}){return{iconUrl:Pt(e==null||n.plugin.source.type!==`local`?null:f(r({codexHome:e,localVersion:n.plugin.localVersion,marketplaceName:n.marketplaceName,pluginName:n.plugin.name}),St))??Pt(n.logoPath),id:t,name:`Codex Chrome Extension`,url:`${wt}${t}`}}function Pt(e){let t=e?.trim();if(t==null||t.length===0)return null;let n=t.toLowerCase();return n.startsWith(`app:`)||n.startsWith(`data:`)||n.startsWith(`http:`)||n.startsWith(`https:`)||n.startsWith(`/@fs`)?t:a(t)?window.location.protocol===`http:`||window.location.protocol===`https:`?De(t):W(t):null}function Ft({hostId:e,path:t}){return[`plugins`,`browser-extension-setup`,e,t]}var It=A({codexChromeDescription:{id:`plugins.installModal.browserExtension.description`,defaultMessage:`Install this extension in Chrome to let Codex connect to your browser`,description:`Description for the required Chrome browser extension in the plugin finish setup modal`}}),Lt=new Map([[`gmail`,`gmail`],[`google-calendar`,`google-calendar`],[`google-drive`,`google-drive`],[`connector_gmail`,`gmail`],[`connector_google_calendar`,`google-calendar`],[`connector_google_drive`,`google-drive`]]);function Rt(e){return Lt.get(e)??null}function zt(e,t){return t===`connector-unavailable`&&Rt(e)!=null}function Bt(e){let t=(0,Z.c)(9),{upsellId:n}=e;switch(n){case`gmail`:{let e;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Q.jsx)(Ut,{description:(0,Q.jsx)(k,{id:`plugins.installModal.googleUpgrade.gmail.draftReplies.description`,defaultMessage:`Codex can read the thread, understand the ask, and draft a useful response`,description:`Description for the Gmail drafting benefit in the Google plugin upgrade install modal`}),title:(0,Q.jsx)(k,{id:`plugins.installModal.googleUpgrade.gmail.draftReplies.title`,defaultMessage:`Draft replies with the right context`,description:`Title for the Gmail drafting benefit in the Google plugin upgrade install modal`})}),t[0]=e):e=t[0];let n;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,Q.jsx)(Ut,{description:(0,Q.jsx)(k,{id:`plugins.installModal.googleUpgrade.gmail.emailTasks.description`,defaultMessage:`Pull out action items, deadlines, owners, and next steps from messy threads`,description:`Description for the Gmail task extraction benefit in the Google plugin upgrade install modal`}),title:(0,Q.jsx)(k,{id:`plugins.installModal.googleUpgrade.gmail.emailTasks.title`,defaultMessage:`Turn emails into tasks`,description:`Title for the Gmail task extraction benefit in the Google plugin upgrade install modal`})}),t[1]=n):n=t[1];let r;return t[2]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,Q.jsxs)(Ht,{children:[e,n,(0,Q.jsx)(Ut,{description:(0,Q.jsx)(k,{id:`plugins.installModal.googleUpgrade.gmail.findEmail.description`,defaultMessage:`Search Gmail conversationally: "Find the vendor email with the updated contract from last month"`,description:`Description for the Gmail search benefit in the Google plugin upgrade install modal`}),title:(0,Q.jsx)(k,{id:`plugins.installModal.googleUpgrade.gmail.findEmail.title`,defaultMessage:`Find the email you're thinking of`,description:`Title for the Gmail search benefit in the Google plugin upgrade install modal`})})]}),t[2]=r):r=t[2],r}case`google-calendar`:{let e;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Q.jsx)(Ut,{description:(0,Q.jsx)(k,{id:`plugins.installModal.googleUpgrade.googleCalendar.schedule.description`,defaultMessage:`Pull together agenda, context, and questions before a call`,description:`Description for the Google Calendar scheduling benefit in the Google plugin upgrade install modal`}),title:(0,Q.jsx)(k,{id:`plugins.installModal.googleUpgrade.googleCalendar.schedule.title`,defaultMessage:`Prepare for meetings`,description:`Title for the Google Calendar scheduling benefit in the Google plugin upgrade install modal`})}),t[3]=e):e=t[3];let n;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,Q.jsx)(Ut,{description:(0,Q.jsx)(k,{id:`plugins.installModal.googleUpgrade.googleCalendar.upcoming.description`,defaultMessage:`See meetings, conflicts, and focus time at a glance`,description:`Description for the Google Calendar planning benefit in the Google plugin upgrade install modal`}),title:(0,Q.jsx)(k,{id:`plugins.installModal.googleUpgrade.googleCalendar.upcoming.title`,defaultMessage:`Summarize your day`,description:`Title for the Google Calendar planning benefit in the Google plugin upgrade install modal`})}),t[4]=n):n=t[4];let r;return t[5]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,Q.jsxs)(Ht,{children:[e,n,(0,Q.jsx)(Ut,{description:(0,Q.jsx)(k,{id:`plugins.installModal.googleUpgrade.googleCalendar.changes.description`,defaultMessage:`Turn events into reminders, notes, and next steps`,description:`Description for the Google Calendar editing benefit in the Google plugin upgrade install modal`}),title:(0,Q.jsx)(k,{id:`plugins.installModal.googleUpgrade.googleCalendar.changes.title`,defaultMessage:`Organize follow-ups`,description:`Title for the Google Calendar editing benefit in the Google plugin upgrade install modal`})})]}),t[5]=r):r=t[5],r}case`google-drive`:{let e;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Q.jsx)(Ut,{description:(0,Q.jsx)(k,{id:`plugins.installModal.googleUpgrade.googleDrive.find.description`,defaultMessage:`Search by project, topic, people, or recent context`,description:`Description for the Google Drive search benefit in the Google plugin upgrade install modal`}),title:(0,Q.jsx)(k,{id:`plugins.installModal.googleUpgrade.googleDrive.find.title`,defaultMessage:`Find files faster`,description:`Title for the Google Drive search benefit in the Google plugin upgrade install modal`})}),t[6]=e):e=t[6];let n;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,Q.jsx)(Ut,{description:(0,Q.jsx)(k,{id:`plugins.installModal.googleUpgrade.googleDrive.context.description`,defaultMessage:`Understand what matters without opening every file`,description:`Description for the Google Drive context benefit in the Google plugin upgrade install modal`}),title:(0,Q.jsx)(k,{id:`plugins.installModal.googleUpgrade.googleDrive.context.title`,defaultMessage:`Summarize docs and folders`,description:`Title for the Google Drive context benefit in the Google plugin upgrade install modal`})}),t[7]=n):n=t[7];let r;return t[8]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,Q.jsxs)(Ht,{children:[e,n,(0,Q.jsx)(Ut,{description:(0,Q.jsx)(k,{id:`plugins.installModal.googleUpgrade.googleDrive.update.description`,defaultMessage:`Use existing files to create briefs, replies, and plans`,description:`Description for the Google Drive file editing benefit in the Google plugin upgrade install modal`}),title:(0,Q.jsx)(k,{id:`plugins.installModal.googleUpgrade.googleDrive.update.title`,defaultMessage:`Draft from Drive context`,description:`Title for the Google Drive file editing benefit in the Google plugin upgrade install modal`})})]}),t[8]=r):r=t[8],r}}}function Vt(){let e=(0,Z.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,Q.jsxs)(K,{className:`gap-1 !bg-token-charts-purple/10 px-1.5 py-1 text-xs font-medium !text-token-charts-purple`,children:[(0,Q.jsx)(Ye,{className:`icon-xs`}),(0,Q.jsx)(k,{id:`plugins.googleUpgrade.badge`,defaultMessage:`Upgrade to unlock`,description:`Badge label shown on Google plugins that need a paid plan`})]}),e[0]=t):t=e[0],t}function Ht(e){let t=(0,Z.c)(2),{children:n}=e,r;return t[0]===n?r=t[1]:(r=(0,Q.jsx)(`div`,{className:`flex flex-col gap-3 py-1`,children:n}),t[0]=n,t[1]=r),r}function Ut(e){let t=(0,Z.c)(8),{description:n,title:r}=e,i;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,Q.jsx)(Me,{className:`icon-sm mt-0.5 shrink-0 text-token-text-secondary`}),t[0]=i):i=t[0];let a;t[1]===r?a=t[2]:(a=(0,Q.jsx)(`div`,{className:`font-semibold text-token-text-primary`,children:r}),t[1]=r,t[2]=a);let o;t[3]===n?o=t[4]:(o=(0,Q.jsx)(`div`,{className:`text-token-text-secondary`,children:n}),t[3]=n,t[4]=o);let s;return t[5]!==a||t[6]!==o?(s=(0,Q.jsxs)(`div`,{className:`flex gap-2 text-sm`,children:[i,(0,Q.jsxs)(`div`,{className:`flex min-w-0 flex-col`,children:[a,o]})]}),t[5]=a,t[6]=o,t[7]=s):s=t[7],s}var Wt=`OAI-Product-Sku`,Gt=`CODEX`,Kt=/\[([^\]]+)\]\(([^)]+)\)/g,qt=480,Jt=`min(720px, calc(100vh - 2rem))`,Yt=[0,1,2],Xt=400;function Zt(e){let t=(0,Z.c)(142),{hostId:n,isInstalling:r,onConnectRequiredApp:i,onInstall:a,onOpenChange:o,onRequiredAppConnected:s,onRequiredAppOAuthStarted:c,onTryInChat:l,onViewDetails:u,session:d}=e,f=r===void 0?!1:r,p=v(w),[m,h]=(0,at.useState)(null),[g,_]=(0,at.useState)(null),{platform:b}=he(),{authMethod:x,planAtLogin:C}=B(),{data:ee}=re(),T=x===`chatgpt`,E;t[0]===T?E=t[1]:(E={queryConfig:{enabled:T}},t[0]=T,t[1]=E);let{data:ne}=te(`account-info`,E),A=ee?.plan_type??ne?.plan??C,j;t[2]===A?j=t[3]:(j=Be(A)?.pricePlan??null,t[2]=A,t[3]=j);let M=j,N;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(N={logExposure:!0},t[4]=N):N=t[4];let P=qe(N),F=y(st,n),I=d.kind===`closed`?null:d.plugin,L;t[5]!==d.kind||t[6]!==d.requiredApps?(L=d.kind===`needsApps`?d.requiredApps.map(rn):void 0,t[5]=d.kind,t[6]=d.requiredApps,t[7]=L):L=t[7];let R=L,z;t[8]!==n||t[9]!==R||t[10]!==d.kind||t[11]!==d.plugin?(z=d.kind===`details`?{hostId:n,...Se(d.plugin)}:{hostId:n,pluginApps:R},t[8]=n,t[9]=R,t[10]=d.kind,t[11]=d.plugin,t[12]=z):z=t[12];let{blockedReasonsByConnectorId:V,blockedReason:ie,isLoading:ae}=We(z),oe=I!=null&&Ge(I.plugin),se=d.kind===`details`?ie:null,ue=d.kind===`details`&&ae,H=oe?`disabled-by-admin`:se,de=H!=null,fe=H===`disabled-by-admin`,pe=I?.marketplacePath??null,me;t[13]===I?me=t[14]:(me=I==null?null:we(I),t[13]=I,t[14]=me);let ge=I?.remoteMarketplaceName??null,_e=I!=null,ve;t[15]!==n||t[16]!==ge||t[17]!==_e||t[18]!==pe||t[19]!==me?(ve={hostId:n,marketplacePath:pe,pluginName:me,remoteMarketplaceName:ge,enabled:_e},t[15]=n,t[16]=ge,t[17]=_e,t[18]=pe,t[19]=me,t[20]=ve):ve=t[20];let{plugin:be}=Ke(ve),xe=be?.apps,Ce,Te,U,Ee,De,W,Oe,je;t[21]!==V||t[22]!==xe||t[23]!==d.kind||t[24]!==d.plugin?(Ce=xe?.filter(e=>V[e.id]!==`disabled-by-admin`),U=d.kind===`details`&&d.plugin.plugin.authPolicy===`ON_INSTALL`,Te=Ce!=null&&Ce.length>0,je=O,Ee=`plugins`,De=`install-modal`,W=`disclosure`,Oe=Ce?.map(nn),t[21]=V,t[22]=xe,t[23]=d.kind,t[24]=d.plugin,t[25]=Ce,t[26]=Te,t[27]=U,t[28]=Ee,t[29]=De,t[30]=W,t[31]=Oe,t[32]=je):(Ce=t[25],Te=t[26],U=t[27],Ee=t[28],De=t[29],W=t[30],Oe=t[31],je=t[32]);let Me;t[33]!==Ee||t[34]!==De||t[35]!==W||t[36]!==Oe?(Me=[Ee,De,W,Oe],t[33]=Ee,t[34]=De,t[35]=W,t[36]=Oe,t[37]=Me):Me=t[37];let Ne=U&&Te&&!ae,Pe;t[38]===Ce?Pe=t[39]:(Pe=async()=>{if(Ce==null)throw Error(`plugin detail apps are required`);let e=await Promise.all(Ce.map(tn));return{blurbs:Ln(e.flatMap(en)),personalizationToggles:e.flatMap($t)}},t[38]=Ce,t[39]=Pe);let Fe;t[40]!==Me||t[41]!==Ne||t[42]!==Pe?(Fe={queryKey:Me,enabled:Ne,staleTime:D.FIVE_MINUTES,queryFn:Pe},t[40]=Me,t[41]=Ne,t[42]=Pe,t[43]=Fe):Fe=t[43];let{data:Ie,isLoading:Le}=je(Fe),Ve;t[44]!==f||t[45]!==o?(Ve=e=>{!e&&f||(e||(h(null),_(null)),o(e))},t[44]=f,t[45]=o,t[46]=Ve):Ve=t[46];let K=Ve;if(d.kind===`closed`)return null;if(d.kind===`connectApp`){let e;t[47]===d.app?e=t[48]:(e=Mn(d.app),t[47]=d.app,t[48]=e);let n;t[49]!==s||t[50]!==d.app.appId?(n=async()=>{await s(d.app.appId)},t[49]=s,t[50]=d.app.appId,t[51]=n):n=t[51];let r;return t[52]!==o||t[53]!==c||t[54]!==e||t[55]!==n?(r=(0,Q.jsx)(Re,{app:e,onOpenChange:o,onConnected:n,onOAuthStarted:c}),t[52]=o,t[53]=c,t[54]=e,t[55]=n,t[56]=r):r=t[56],r}if(d.kind===`installing`){let e;return t[57]!==K||t[58]!==d.plugin?(e=(0,Q.jsx)(an,{onOpenChange:K,plugin:d.plugin}),t[57]=K,t[58]=d.plugin,t[59]=e):e=t[59],e}let q=d.kind===`needsApps`?`needsApps`:`details`,J=d.plugin,Ue,Je,Y,Xe;if(t[60]!==F||t[61]!==Ie?.personalizationToggles||t[62]!==g||t[63]!==m||t[64]!==q||t[65]!==b||t[66]!==J.plugin.id||t[67]!==U){Ue=m?.pluginId===J.plugin.id?m.modes:{};let e;t[72]!==F||t[73]!==q||t[74]!==b||t[75]!==J.plugin.id?(e=q===`details`&&b===`macOS`&&F&&ye(J.plugin.id),t[72]=F,t[73]=q,t[74]=b,t[75]=J.plugin.id,t[76]=e):e=t[76],Y=e,Je=g?.pluginId===J.plugin.id?g.enabled:!0,Xe=Rn({draftModes:Ue,personalizationToggles:U?Ie?.personalizationToggles:void 0}),t[60]=F,t[61]=Ie?.personalizationToggles,t[62]=g,t[63]=m,t[64]=q,t[65]=b,t[66]=J.plugin.id,t[67]=U,t[68]=Ue,t[69]=Je,t[70]=Y,t[71]=Xe}else Ue=t[68],Je=t[69],Y=t[70],Xe=t[71];let Ze=Xe,Qe=U&&Te&&(ae||Le),$e;t[77]!==H||t[78]!==J.plugin.name?($e=zt(J.plugin.name,H),t[77]=H,t[78]=J.plugin.name,t[79]=$e):$e=t[79];let X=$e,et;t[80]!==J.plugin.name||t[81]!==X?(et=X?Rt(J.plugin.name):null,t[80]=J.plugin.name,t[81]=X,t[82]=et):et=t[82];let tt=et,nt=!f,rt;t[83]===Symbol.for(`react.memo_cache_sentinel`)?(rt={"aria-describedby":void 0,style:{maxHeight:Jt,width:qt}},t[83]=rt):rt=t[83];let it=q===`needsApps`?`top-5 right-5 text-token-text-secondary`:void 0,ot=q===`needsApps`?`gap-0 overflow-hidden p-0`:`gap-6 overflow-hidden px-6 pt-8 pb-6`,lt;t[84]===q?lt=t[85]:(lt=q===`needsApps`?{maxHeight:Jt,padding:0}:{maxHeight:Jt},t[84]=q,t[85]=lt);let ut;t[86]!==q||t[87]!==J||t[88]!==X?(ut=q===`details`?(0,Q.jsx)(sn,{plugin:J,showUpgradeBadge:X}):null,t[86]=q,t[87]=J,t[88]=X,t[89]=ut):ut=t[89];let dt;t[90]!==V||t[91]!==Ue||t[92]!==Ze||t[93]!==Ie||t[94]!==K||t[95]!==n||t[96]!==Je||t[97]!==ae||t[98]!==Qe||t[99]!==i||t[100]!==l||t[101]!==u||t[102]!==q||t[103]!==J||t[104]!==be||t[105]!==xe||t[106]!==tt||t[107]!==d.kind||t[108]!==d.requiredApps||t[109]!==d.requiredBrowserExtensions||t[110]!==U||t[111]!==Y?(dt=q===`needsApps`?(0,Q.jsx)(ln,{appInstallBlockedReasonsById:V,appOrder:xe?.map(Qt),isAppBlockedReasonLoading:ae,onConnectRequiredApp:i,onOpenChange:K,onTryInChat:l,onViewDetails:u,plugin:J,requiredApps:d.kind===`needsApps`?d.requiredApps:[],requiredBrowserExtensions:d.kind===`needsApps`?d.requiredBrowserExtensions:[]}):q===`details`?(0,Q.jsx)(ze,{className:`relative grid min-h-0 flex-1 overflow-hidden`,fadeClassName:`inset-x-0`,scrollClassName:`min-h-0 overflow-y-auto group-data-[can-scroll-down=true]:pb-7`,children:tt==null?(0,Q.jsx)(fn,{appPersonalizationModes:Ze,disclosureData:U?Ie:void 0,hostId:n,installLockedComputerUse:Je,isLoadingDisclosureData:Qe,onAppPersonalizationModeChange:e=>{let{appId:t,mode:n}=e;h({modes:{...Ue,[t]:n},pluginId:J.plugin.id})},onInstallLockedComputerUseChange:e=>{_({enabled:e,pluginId:J.plugin.id})},plugin:J,pluginDetail:be,shouldShowInstallDisclosure:U,showLockedComputerUseInstall:Y}):(0,Q.jsx)(Bt,{upsellId:tt})}):null,t[90]=V,t[91]=Ue,t[92]=Ze,t[93]=Ie,t[94]=K,t[95]=n,t[96]=Je,t[97]=ae,t[98]=Qe,t[99]=i,t[100]=l,t[101]=u,t[102]=q,t[103]=J,t[104]=be,t[105]=xe,t[106]=tt,t[107]=d.kind,t[108]=d.requiredApps,t[109]=d.requiredBrowserExtensions,t[110]=U,t[111]=Y,t[112]=dt):dt=t[112];let ft;t[113]!==Ze||t[114]!==M||t[115]!==H||t[116]!==P||t[117]!==Je||t[118]!==ue||t[119]!==fe||t[120]!==f||t[121]!==Qe||t[122]!==de||t[123]!==a||t[124]!==q||t[125]!==J||t[126]!==p||t[127]!==X||t[128]!==Y?(ft=q===`details`?(0,Q.jsx)(ce,{tooltipContent:H===`connector-unavailable`&&!X?(0,Q.jsx)(k,{id:`plugins.install.connectorUnavailable`,defaultMessage:`App unavailable`,description:`Tooltip shown when plugin install is unavailable because the plugin's apps are not available in the current app directory`}):null,disabled:H!==`connector-unavailable`||X,children:(0,Q.jsx)(`div`,{className:`flex w-full`,children:(0,Q.jsx)(le,{color:`primary`,size:`large`,className:`w-full justify-center`,disabled:!X&&de||ue||!X&&Qe,loading:f,onClick:()=>{if(X){M==null?S.dispatchMessage(`open-in-browser`,{url:P(),useExternalBrowser:!0,useExternalBrowser:!0,useExternalBrowser:!0,useExternalBrowser:!0,useExternalBrowser:!0,useExternalBrowser:!0}):He(p,M,`plugin_install_modal_upgrade_cta`);return}a(Ze,Y?Je:void 0)},children:f?(0,Q.jsx)(k,{id:`plugins.installModal.installing`,defaultMessage:`Installing {pluginName}`,description:`Button label in the plugin install modal while installation is in progress`,values:{pluginName:G(J)}}):fe?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(ct,{className:`icon-sm`}),(0,Q.jsx)(k,{id:`plugins.detail.disabledByAdminButton`,defaultMessage:`Disabled by admin`,description:`Install button label shown when plugin install is unavailable because all included connectors are disabled by admin`})]}):X?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(Ye,{className:`icon-sm`}),(0,Q.jsx)(k,{id:`plugins.installModal.upgradeToUnlock`,defaultMessage:`Upgrade to unlock`,description:`Button label for upgrading when a Google plugin needs a paid plan`})]}):(0,Q.jsx)(k,{id:`plugins.installModal.install`,defaultMessage:`Install {pluginName}`,description:`Install button label in the plugin install modal`,values:{pluginName:G(J)}})})})}):null,t[113]=Ze,t[114]=M,t[115]=H,t[116]=P,t[117]=Je,t[118]=ue,t[119]=fe,t[120]=f,t[121]=Qe,t[122]=de,t[123]=a,t[124]=q,t[125]=J,t[126]=p,t[127]=X,t[128]=Y,t[129]=ft):ft=t[129];let $;t[130]!==ot||t[131]!==lt||t[132]!==ut||t[133]!==dt||t[134]!==ft?($=(0,Q.jsxs)(Ae,{className:ot,style:lt,children:[ut,dt,ft]}),t[130]=ot,t[131]=lt,t[132]=ut,t[133]=dt,t[134]=ft,t[135]=$):$=t[135];let pt;return t[136]!==K||t[137]!==f||t[138]!==nt||t[139]!==it||t[140]!==$?(pt=(0,Q.jsx)(ke,{open:!0,onOpenChange:K,shouldIgnoreClickOutside:f,showDialogClose:nt,size:`default`,contentClassName:`h-fit max-w-[calc(100vw-2rem)] overflow-hidden`,contentProps:rt,dialogCloseClassName:it,children:$}),t[136]=K,t[137]=f,t[138]=nt,t[139]=it,t[140]=$,t[141]=pt):pt=t[141],pt}function Qt(e){return e.id}function $t(e){let{app:t,connectorTos:n}=e;return n.personalization_toggle_blurb==null?[]:[{appId:t.id,appName:t.name,blurb:n.personalization_toggle_blurb,defaultMode:n.personalization_default??`NO_PERSONALIZATION`}]}function en(e){let{connectorTos:t}=e;return t.blurbs}async function tn(e){return{app:e,connectorTos:await F.safeGet(`/aip/connectors/{connector_id}/tos`,{parameters:{path:{connector_id:e.id}},additionalHeaders:{[Wt]:Gt}})}}function nn(e){return e.id}function rn(e){return{description:e.description,id:e.appId,installUrl:e.installUrl,name:e.name,needsAuth:!0}}function an(e){let t=(0,Z.c)(22),{onOpenChange:n,plugin:r}=e,i;t[0]===r.plugin.interface?.developerName?i=t[1]:(i=r.plugin.interface?.developerName?.trim(),t[0]=r.plugin.interface?.developerName,t[1]=i);let a=i,o=ue(),[s,c]=(0,at.useState)(0),l;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(l=()=>{c(on)},t[2]=l):l=t[2],ot(l,o?null:Xt);let u;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(u={"aria-describedby":void 0,style:{maxHeight:Jt,width:qt}},t[3]=u):u=t[3];let d=o?0:s,f;t[4]!==r||t[5]!==d?(f=(0,Q.jsx)(cn,{activeDotIndex:d,plugin:r}),t[4]=r,t[5]=d,t[6]=f):f=t[6];let p;t[7]===r?p=t[8]:(p=G(r),t[7]=r,t[8]=p);let m;t[9]===p?m=t[10]:(m=(0,Q.jsx)(Oe,{className:`text-xl leading-7 font-semibold text-token-text-primary`,children:(0,Q.jsx)(k,{id:`plugins.installModal.adding.title`,defaultMessage:`Adding {pluginName}…`,description:`Title shown in the plugin install loading modal`,values:{pluginName:p}})}),t[9]=p,t[10]=m);let h;t[11]===a?h=t[12]:(h=a?(0,Q.jsx)(`div`,{className:`text-sm leading-5 text-token-text-secondary`,children:(0,Q.jsx)(k,{id:`plugins.installModal.developedBy`,defaultMessage:`Developed by {developerName}`,description:`Developer subtitle shown in the plugin install modal`,values:{developerName:a}})}):null,t[11]=a,t[12]=h);let g;t[13]!==m||t[14]!==h?(g=(0,Q.jsxs)(`div`,{className:`flex flex-col items-center gap-1 text-center`,children:[m,h]}),t[13]=m,t[14]=h,t[15]=g):g=t[15];let _;t[16]!==f||t[17]!==g?(_=(0,Q.jsx)(Ae,{className:`h-[200px] gap-0 p-6`,children:(0,Q.jsxs)(`div`,{className:`flex h-full flex-col items-center justify-center gap-4`,children:[f,g]})}),t[16]=f,t[17]=g,t[18]=_):_=t[18];let v;return t[19]!==n||t[20]!==_?(v=(0,Q.jsx)(ke,{open:!0,onOpenChange:n,shouldIgnoreClickOutside:!0,showDialogClose:!1,size:`default`,contentClassName:`h-fit max-w-[calc(100vw-2rem)] overflow-hidden`,contentProps:u,children:_}),t[19]=n,t[20]=_,t[21]=v):v=t[21],v}function on(e){return(e+1)%Yt.length}function sn(e){let t=(0,Z.c)(19),{plugin:n,showUpgradeBadge:r}=e,i;t[0]===n.plugin.interface?.developerName?i=t[1]:(i=n.plugin.interface?.developerName?.trim(),t[0]=n.plugin.interface?.developerName,t[1]=i);let a=i,o;t[2]===n?o=t[3]:(o=(0,Q.jsx)(cn,{plugin:n}),t[2]=n,t[3]=o);let s;t[4]===n?s=t[5]:(s=G(n),t[4]=n,t[5]=s);let c;t[6]===s?c=t[7]:(c=(0,Q.jsx)(Oe,{asChild:!0,children:(0,Q.jsx)(`div`,{className:`heading-dialog font-semibold`,children:(0,Q.jsx)(k,{id:`plugins.installModal.title`,defaultMessage:`Install {pluginName}`,description:`Title shown in the plugin install modal before installation starts`,values:{pluginName:s}})})}),t[6]=s,t[7]=c);let l;t[8]===a?l=t[9]:(l=a?(0,Q.jsx)(`div`,{className:`text-sm text-token-text-secondary`,children:(0,Q.jsx)(k,{id:`plugins.installModal.developedBy`,defaultMessage:`Developed by {developerName}`,description:`Developer subtitle shown in the plugin install modal`,values:{developerName:a}})}):null,t[8]=a,t[9]=l);let u;t[10]===r?u=t[11]:(u=r?(0,Q.jsx)(Vt,{}):null,t[10]=r,t[11]=u);let d;t[12]!==c||t[13]!==l||t[14]!==u?(d=(0,Q.jsxs)(`div`,{className:`flex flex-col items-center gap-1 text-center`,children:[c,l,u]}),t[12]=c,t[13]=l,t[14]=u,t[15]=d):d=t[15];let f;return t[16]!==o||t[17]!==d?(f=(0,Q.jsxs)(`div`,{className:`flex flex-col items-center gap-4`,children:[o,d]}),t[16]=o,t[17]=d,t[18]=f):f=t[18],f}function cn(e){let t=(0,Z.c)(14),{activeDotIndex:n,plugin:r}=e,i;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,Q.jsx)(`span`,{className:`flex size-14 shrink-0 items-center justify-center rounded-xl bg-black text-white shadow-sm`,children:(0,Q.jsx)(Ee,{className:`size-12`})}),t[0]=i):i=t[0];let a;t[1]===n?a=t[2]:(a=Yt.map(e=>(0,Q.jsx)(`span`,{className:g(`size-1.5 rounded-full`,n===e?`bg-token-text-primary`:`bg-token-border-default`)},e)),t[1]=n,t[2]=a);let o;t[3]===a?o=t[4]:(o=(0,Q.jsx)(`span`,{className:`flex items-center gap-1`,children:a}),t[3]=a,t[4]=o);let s;t[5]===r?s=t[6]:(s=G(r),t[5]=r,t[6]=s);let c;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,Q.jsx)(fe,{className:`icon-md text-token-text-secondary`}),t[7]=c):c=t[7];let l;t[8]!==r.logoPath||t[9]!==s?(l=(0,Q.jsx)(`span`,{className:`bg-token-surface-tertiary flex size-14 shrink-0 items-center justify-center overflow-hidden rounded-xl border border-token-border-default shadow-sm`,children:(0,Q.jsx)(oe,{alt:s,className:`size-full object-contain`,logoUrl:r.logoPath,fallback:c})}),t[8]=r.logoPath,t[9]=s,t[10]=l):l=t[10];let u;return t[11]!==o||t[12]!==l?(u=(0,Q.jsxs)(`div`,{className:`flex items-center gap-3`,children:[i,o,l]}),t[11]=o,t[12]=l,t[13]=u):u=t[13],u}function ln(e){let t=(0,Z.c)(22),{appInstallBlockedReasonsById:n,appOrder:r,isAppBlockedReasonLoading:i,onConnectRequiredApp:a,onOpenChange:o,onTryInChat:s,onViewDetails:c,plugin:l,requiredApps:u,requiredBrowserExtensions:d}=e,f;t[0]===l?f=t[1]:(f=(0,Q.jsx)(un,{plugin:l}),t[0]=l,t[1]=f);let p;t[2]!==n||t[3]!==r||t[4]!==i||t[5]!==a||t[6]!==u?(p=(0,Q.jsx)(Cn,{appInstallBlockedReasonsById:n,appOrder:r,isAppBlockedReasonLoading:i,onConnectRequiredApp:a,requiredApps:u}),t[2]=n,t[3]=r,t[4]=i,t[5]=a,t[6]=u,t[7]=p):p=t[7];let m;t[8]===d?m=t[9]:(m=(0,Q.jsx)(Tn,{requiredBrowserExtensions:d}),t[8]=d,t[9]=m);let h;t[10]!==p||t[11]!==m?(h=(0,Q.jsxs)(ze,{className:`relative grid min-h-0 flex-1 px-6`,fadeClassName:`inset-x-6`,scrollClassName:`min-h-0 overflow-y-auto group-data-[can-scroll-down=true]:pb-6`,children:[p,m]}),t[10]=p,t[11]=m,t[12]=h):h=t[12];let g;t[13]!==o||t[14]!==s||t[15]!==c||t[16]!==l?(g=(0,Q.jsx)(dn,{onOpenChange:o,onTryInChat:s,onViewDetails:c,plugin:l}),t[13]=o,t[14]=s,t[15]=c,t[16]=l,t[17]=g):g=t[17];let _;return t[18]!==f||t[19]!==h||t[20]!==g?(_=(0,Q.jsxs)(`div`,{className:`flex max-h-full flex-col overflow-hidden`,children:[f,h,g]}),t[18]=f,t[19]=h,t[20]=g,t[21]=_):_=t[21],_}function un(e){let t=(0,Z.c)(18),{plugin:n}=e,r;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,Q.jsx)(`span`,{className:`flex size-[60px] shrink-0 items-center justify-center rounded-2xl bg-black text-white shadow-sm`,children:(0,Q.jsx)(Ee,{className:`size-12`})}),t[0]=r):r=t[0];let i;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,Q.jsxs)(`span`,{className:`flex items-center gap-2`,children:[(0,Q.jsx)(`span`,{className:`size-1.5 rounded-full bg-token-border-default`}),(0,Q.jsx)(`span`,{className:`size-1.5 rounded-full bg-token-border-default`}),(0,Q.jsx)(`span`,{className:`size-1.5 rounded-full bg-token-border-default`})]}),t[1]=i):i=t[1];let a;t[2]===n?a=t[3]:(a=G(n),t[2]=n,t[3]=a);let o;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,Q.jsx)(fe,{className:`icon-md text-token-text-secondary`}),t[4]=o):o=t[4];let s;t[5]!==n.logoPath||t[6]!==a?(s=(0,Q.jsxs)(`div`,{className:`flex items-center gap-4`,children:[r,i,(0,Q.jsx)(`span`,{className:`flex size-[60px] shrink-0 items-center justify-center overflow-hidden rounded-2xl bg-token-bg-primary shadow-sm`,children:(0,Q.jsx)(oe,{alt:a,className:`size-full object-contain`,logoUrl:n.logoPath,fallback:o})})]}),t[5]=n.logoPath,t[6]=a,t[7]=s):s=t[7];let c;t[8]===n?c=t[9]:(c=G(n),t[8]=n,t[9]=c);let l;t[10]===c?l=t[11]:(l=(0,Q.jsx)(Oe,{asChild:!0,children:(0,Q.jsx)(`div`,{className:`text-lg leading-6 font-semibold text-token-text-primary`,children:(0,Q.jsx)(k,{id:`plugins.installModal.needsApps.title`,defaultMessage:`Connect your apps to {pluginName}`,description:`Title shown after plugin install when app connections are available`,values:{pluginName:c}})})}),t[10]=c,t[11]=l);let u;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(u=(0,Q.jsx)(`div`,{className:`max-w-[432px] text-sm leading-5 text-token-text-secondary`,children:(0,Q.jsx)(k,{id:`plugins.installModal.needsApps.subtitle`,defaultMessage:`Get more relevant help from the apps you already use. You can always do this later.`,description:`Subtitle shown after plugin install when app connections are available`})}),t[12]=u):u=t[12];let d;t[13]===l?d=t[14]:(d=(0,Q.jsxs)(`div`,{className:`flex flex-col items-center gap-1 text-center`,children:[l,u]}),t[13]=l,t[14]=d);let f;return t[15]!==s||t[16]!==d?(f=(0,Q.jsxs)(`div`,{className:`flex shrink-0 flex-col items-center gap-4 px-6 pt-9 pb-4`,children:[s,d]}),t[15]=s,t[16]=d,t[17]=f):f=t[17],f}function dn(e){let t=(0,Z.c)(14),{onOpenChange:n,onTryInChat:r,onViewDetails:i,plugin:a}=e,o=a.plugin.interface?.defaultPrompt,s;t[0]===o?s=t[1]:(s=Fe(o),t[0]=o,t[1]=s);let c=s;if(r==null&&i==null)return null;let l;t[2]!==n||t[3]!==i||t[4]!==a?(l=i==null?null:(0,Q.jsx)(le,{color:`outline`,size:`default`,className:`h-9 rounded-xl px-3 py-2 text-sm leading-5`,style:{borderRadius:12},onClick:()=>{n(!1),i(a)},children:(0,Q.jsx)(k,{id:`plugins.installModal.needsApps.viewDetails`,defaultMessage:`View details`,description:`Button label to close the plugin onboarding modal and view plugin details`})}),t[2]=n,t[3]=i,t[4]=a,t[5]=l):l=t[5];let u;t[6]!==c||t[7]!==n||t[8]!==r||t[9]!==a?(u=r==null?null:(0,Q.jsxs)(le,{color:`primary`,size:`default`,className:`h-9 rounded-xl px-3 py-2 text-sm leading-5`,style:{borderRadius:12},onClick:()=>{n(!1),r(a,c)},children:[(0,Q.jsx)(pe,{className:`icon-sm`}),(0,Q.jsx)(k,{id:`plugins.installModal.needsApps.tryInChat`,defaultMessage:`Try {pluginName} in chat`,description:`Button label to close the plugin onboarding modal and try the plugin in chat`,values:{pluginName:G(a)}})]}),t[6]=c,t[7]=n,t[8]=r,t[9]=a,t[10]=u):u=t[10];let d;return t[11]!==l||t[12]!==u?(d=(0,Q.jsxs)(`div`,{className:`flex h-[84px] shrink-0 items-center justify-end gap-2 bg-token-dropdown-background px-6 py-6`,children:[l,u]}),t[11]=l,t[12]=u,t[13]=d):d=t[13],d}function fn(e){let t=(0,Z.c)(37),{appPersonalizationModes:n,disclosureData:r,hostId:i,installLockedComputerUse:a,isLoadingDisclosureData:o,onAppPersonalizationModeChange:s,onInstallLockedComputerUseChange:c,plugin:l,pluginDetail:u,shouldShowInstallDisclosure:d,showLockedComputerUseInstall:f}=e,p;t[0]===l?p=t[1]:(p=zn(l),t[0]=l,t[1]=p);let m=p,h;t[2]===l.plugin.interface?.capabilities?h=t[3]:(h=l.plugin.interface?.capabilities??[],t[2]=l.plugin.interface?.capabilities,t[3]=h);let g=h,_=r!=null&&(r.blurbs.length>0||r.personalizationToggles.length>0),v=!d||!_,y;t[4]!==l||t[5]!==v?(y=v?(0,Q.jsx)(Nn,{plugin:l}):null,t[4]=l,t[5]=v,t[6]=y):y=t[6];let b;t[7]!==m||t[8]!==v?(b=v&&m?(0,Q.jsxs)(Fn,{children:[(0,Q.jsx)(`div`,{className:`text-sm font-medium text-token-text-primary`,children:(0,Q.jsx)(k,{id:`plugins.installModal.about`,defaultMessage:`About`,description:`Section title for the plugin description in the plugin install modal`})}),(0,Q.jsx)(`div`,{className:`text-sm text-token-text-secondary`,children:m})]}):null,t[7]=m,t[8]=v,t[9]=b):b=t[9];let x;t[10]!==i||t[11]!==l||t[12]!==u||t[13]!==v?(x=v&&u!=null?(0,Q.jsx)(mn,{hostId:i,plugin:l,pluginDetail:u}):null,t[10]=i,t[11]=l,t[12]=u,t[13]=v,t[14]=x):x=t[14];let S;t[15]!==a||t[16]!==c||t[17]!==u||t[18]!==v||t[19]!==f?(S=v&&u!=null&&f?(0,Q.jsx)(bn,{enabled:a,onChange:c}):null,t[15]=a,t[16]=c,t[17]=u,t[18]=v,t[19]=f,t[20]=S):S=t[20];let C;t[21]!==g||t[22]!==v?(C=v&&g.length>0?(0,Q.jsxs)(Fn,{children:[(0,Q.jsx)(`div`,{className:`text-sm font-medium text-token-text-primary`,children:(0,Q.jsx)(k,{id:`plugins.installModal.capabilities`,defaultMessage:`Capabilities`,description:`Section title for the capability list in the plugin install modal`})}),(0,Q.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:g.map(pn)})]}):null,t[21]=g,t[22]=v,t[23]=C):C=t[23];let w;t[24]!==n||t[25]!==r||t[26]!==o||t[27]!==s||t[28]!==d?(w=d?(0,Q.jsx)(Sn,{appPersonalizationModes:n,disclosureData:r,isLoadingDisclosureData:o,onAppPersonalizationModeChange:s}):null,t[24]=n,t[25]=r,t[26]=o,t[27]=s,t[28]=d,t[29]=w):w=t[29];let ee;return t[30]!==y||t[31]!==b||t[32]!==x||t[33]!==S||t[34]!==C||t[35]!==w?(ee=(0,Q.jsxs)(`div`,{className:`rounded-2xl border border-token-border-default px-4 py-2`,children:[y,b,x,S,C,w]}),t[30]=y,t[31]=b,t[32]=x,t[33]=S,t[34]=C,t[35]=w,t[36]=ee):ee=t[36],ee}function pn(e){return(0,Q.jsx)(K,{className:`border border-token-border-default bg-transparent px-1.5 py-0.5 text-xs font-medium text-token-text-secondary`,children:e},e)}function mn(e){let t=(0,Z.c)(20),{hostId:n,plugin:r,pluginDetail:i}=e,a;t[0]!==n||t[1]!==r?(a={enabled:!0,hostId:n,plugin:r},t[0]=n,t[1]=r,t[2]=a):a=t[2];let o=Ot(a),s=i.apps,c,l,u,d,f;if(t[3]!==o||t[4]!==i.apps||t[5]!==i.mcpServers||t[6]!==i.skills){f=Symbol.for(`react.early_return_sentinel`);bb0:{let e=[{id:`apps`,items:s.map(yn),title:(0,Q.jsx)(k,{id:`plugins.installModal.includes.apps`,defaultMessage:`Apps`,description:`Label for bundled apps in the plugin install modal`})},{id:`browserExtensions`,items:(o??[]).map(vn),title:(0,Q.jsx)(k,{id:`plugins.installModal.includes.browserExtensions`,defaultMessage:`Browser extensions`,description:`Label for bundled browser extensions in the plugin install modal`})},{id:`skills`,items:i.skills.map(_n),title:(0,Q.jsx)(k,{id:`plugins.installModal.includes.skills`,defaultMessage:`Skills`,description:`Label for bundled skills in the plugin install modal`})},{id:`mcpServers`,items:i.mcpServers,title:(0,Q.jsx)(k,{id:`plugins.installModal.includes.mcpServers`,defaultMessage:`MCP servers`,description:`Label for bundled MCP servers in the plugin install modal`})}].filter(gn);if(e.length===0){f=null;break bb0}c=Fn,t[12]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,Q.jsx)(`div`,{className:`text-sm font-medium text-token-text-primary`,children:(0,Q.jsx)(k,{id:`plugins.installModal.includes`,defaultMessage:`Includes`,description:`Section title for bundled apps, skills, and MCP servers in the plugin install modal`})}),t[12]=d):d=t[12],l=`flex flex-col gap-3`,u=e.map(hn)}t[3]=o,t[4]=i.apps,t[5]=i.mcpServers,t[6]=i.skills,t[7]=c,t[8]=l,t[9]=u,t[10]=d,t[11]=f}else c=t[7],l=t[8],u=t[9],d=t[10],f=t[11];if(f!==Symbol.for(`react.early_return_sentinel`))return f;let p;t[13]!==l||t[14]!==u?(p=(0,Q.jsx)(`div`,{className:l,children:u}),t[13]=l,t[14]=u,t[15]=p):p=t[15];let m;return t[16]!==c||t[17]!==d||t[18]!==p?(m=(0,Q.jsxs)(c,{children:[d,p]}),t[16]=c,t[17]=d,t[18]=p,t[19]=m):m=t[19],m}function hn(e){return(0,Q.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,Q.jsx)(`div`,{className:`text-xs font-medium tracking-wide text-token-text-secondary uppercase`,children:e.title}),(0,Q.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:e.items.map(t=>(0,Q.jsx)(K,{className:`border border-token-border-default bg-transparent px-1.5 py-0.5 text-xs font-medium text-token-text-secondary`,children:t},`${e.id}-${t}`))})]},e.id)}function gn(e){return e.items.length>0}function _n(e){return Bn(e)}function vn(e){return e.name}function yn(e){return e.name}function bn(e){let t=(0,Z.c)(8),{enabled:n,onChange:r}=e,i=ne(),a;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,Q.jsx)(`div`,{className:`text-sm font-medium text-token-text-primary`,children:(0,Q.jsx)(k,{id:`plugins.installModal.lockedComputerUse.title`,defaultMessage:`Locked Computer Use`,description:`Title for the Locked Computer Use install option in the plugin install modal`})}),t[0]=a):a=t[0];let o;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,Q.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[a,(0,Q.jsx)(`div`,{className:`text-sm text-token-text-secondary`,children:(0,Q.jsx)(k,{id:`plugins.installModal.lockedComputerUse.description`,defaultMessage:`Let Codex use your Mac when it's locked. Learn more`,description:`Description for the Locked Computer Use install option in the plugin install modal`,values:{a:xn}})})]}),t[1]=o):o=t[1];let s;t[2]===i?s=t[3]:(s=i.formatMessage({id:`plugins.installModal.lockedComputerUse.toggle`,defaultMessage:`Install Locked Computer Use`,description:`Accessible label for the Locked Computer Use install option in the plugin install modal`}),t[2]=i,t[3]=s);let c;return t[4]!==n||t[5]!==r||t[6]!==s?(c=(0,Q.jsx)(Fn,{children:(0,Q.jsxs)(`div`,{className:`flex items-center justify-between gap-4`,children:[o,(0,Q.jsx)(Y,{checked:n,ariaLabel:s,onChange:r})]})}),t[4]=n,t[5]=r,t[6]=s,t[7]=c):c=t[7],c}function xn(e){return(0,Q.jsx)(`a`,{className:`inline-flex text-token-text-link-foreground`,href:Ve,target:`_blank`,rel:`noreferrer`,children:e})}function Sn(e){let t=(0,Z.c)(6),{appPersonalizationModes:n,disclosureData:r,isLoadingDisclosureData:i,onAppPersonalizationModeChange:a}=e;if(i){let e;return t[0]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Q.jsx)(Fn,{children:(0,Q.jsx)(On,{})}),t[0]=e):e=t[0],e}if(r==null||r.blurbs.length===0&&r.personalizationToggles.length===0)return null;let o;return t[1]!==n||t[2]!==r.blurbs||t[3]!==r.personalizationToggles||t[4]!==a?(o=(0,Q.jsx)(Fn,{children:(0,Q.jsx)(An,{appPersonalizationModes:n,blurbs:r.blurbs,onAppPersonalizationModeChange:a,personalizationToggles:r.personalizationToggles})}),t[1]=n,t[2]=r.blurbs,t[3]=r.personalizationToggles,t[4]=a,t[5]=o):o=t[5],o}function Cn(e){let t=(0,Z.c)(23),{appInstallBlockedReasonsById:n,appOrder:r,isAppBlockedReasonLoading:i,onConnectRequiredApp:a,requiredApps:o}=e,s=ne(),c;t[0]===r?c=t[1]:(c=new Map(r?.map(wn)),t[0]=r,t[1]=c);let l=c,u,d,f;if(t[2]!==n||t[3]!==l||t[4]!==s||t[5]!==i||t[6]!==a||t[7]!==o){f=Symbol.for(`react.early_return_sentinel`);bb0:{let e;t[11]===n?e=t[12]:(e=e=>n[e.appId]!==`disabled-by-admin`,t[11]=n,t[12]=e);let r=o.filter(e),c;if(t[13]===l?c=t[14]:(c=(e,t)=>(l.get(e.appId)??2**53-1)-(l.get(t.appId)??2**53-1),t[13]=l,t[14]=c),r.sort(c),r.length===0){f=null;break bb0}u=`flex flex-col`;let p;t[15]!==n||t[16]!==s||t[17]!==i||t[18]!==a?(p=e=>{let t=n[e.appId];return(0,Q.jsx)(pt,{app:Mn(e),cardIconContainerVariant:`outline`,className:`min-h-[72px] px-0 py-3 hover:!bg-transparent`,installActionDisabled:i||t!=null||e.status!==`pending`,installActionLabel:jn(e.status,s),isConnectingApp:e.status===`launching`||e.status===`waitingForCallback`,updatingAppId:null,onInstallApp:()=>a(e.appId)},e.appId)},t[15]=n,t[16]=s,t[17]=i,t[18]=a,t[19]=p):p=t[19],d=r.map(p)}t[2]=n,t[3]=l,t[4]=s,t[5]=i,t[6]=a,t[7]=o,t[8]=u,t[9]=d,t[10]=f}else u=t[8],d=t[9],f=t[10];if(f!==Symbol.for(`react.early_return_sentinel`))return f;let p;return t[20]!==u||t[21]!==d?(p=(0,Q.jsx)(`div`,{className:u,children:d}),t[20]=u,t[21]=d,t[22]=p):p=t[22],p}function wn(e,t){return[e,t]}function Tn(e){let t=(0,Z.c)(4),{requiredBrowserExtensions:n}=e;if(n.length===0)return null;let r;t[0]===n?r=t[1]:(r=n.map(En),t[0]=n,t[1]=r);let i;return t[2]===r?i=t[3]:(i=(0,Q.jsx)(`div`,{className:`flex flex-col`,children:r}),t[2]=r,t[3]=i),i}function En(e){return(0,Q.jsxs)(`div`,{className:`flex min-h-[72px] items-center justify-between gap-4 py-3`,children:[(0,Q.jsxs)(`div`,{className:`flex min-w-0 flex-1 items-center gap-4`,children:[(0,Q.jsx)(`span`,{className:`flex size-12 shrink-0 items-center justify-center overflow-hidden rounded-xl border border-token-border-default bg-token-bg-primary`,children:(0,Q.jsx)(oe,{alt:e.name,className:`size-8 object-contain`,fallback:(0,Q.jsx)(fe,{className:`icon-md text-token-text-secondary`}),logoUrl:e.iconUrl})}),(0,Q.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,Q.jsx)(`div`,{className:`truncate text-sm leading-6 font-medium text-token-text-primary`,children:e.name}),(0,Q.jsx)(`div`,{className:`truncate text-sm leading-5 text-token-text-tertiary`,children:(0,Q.jsx)(k,{...It.codexChromeDescription})})]})]}),(0,Q.jsx)(le,{color:`outline`,size:`toolbar`,className:`h-9 min-w-20 shrink-0 justify-center rounded-xl px-3 text-sm`,onClick:()=>{S.dispatchMessage(`open-in-browser`,{url:e.url,useExternalBrowser:!0,useExternalBrowser:!0,useExternalBrowser:!0,useExternalBrowser:!0,useExternalBrowser:!0,useExternalBrowser:!0})},children:(0,Q.jsx)(k,{id:`plugins.installModal.openBrowserExtension`,defaultMessage:`Open`,description:`Button label to open a browser extension setup URL`})})]},e.id)}function Dn(e){let t=(0,Z.c)(10),{children:n,url:r}=e,i;t[0]===r?i=t[1]:(i=r?.trim(),t[0]=r,t[1]=i);let a=i;if(!a){let e;return t[2]===n?e=t[3]:(e=(0,Q.jsx)(Q.Fragment,{children:n}),t[2]=n,t[3]=e),e}let o;t[4]===a?o=t[5]:(o=e=>{e.preventDefault(),S.dispatchMessage(`open-in-browser`,{url:a,useExternalBrowser:!0,useExternalBrowser:!0,useExternalBrowser:!0,useExternalBrowser:!0,useExternalBrowser:!0,useExternalBrowser:!0})},t[4]=a,t[5]=o);let s;return t[6]!==n||t[7]!==a||t[8]!==o?(s=(0,Q.jsx)(`a`,{href:a,className:`underline underline-offset-2 hover:no-underline`,onClick:o,children:n}),t[6]=n,t[7]=a,t[8]=o,t[9]=s):s=t[9],s}function On(){let e=(0,Z.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,Q.jsx)(`div`,{children:Array.from({length:3}).map(kn)}),e[0]=t):t=e[0],t}function kn(e,t){return(0,Q.jsxs)(`div`,{className:`flex flex-col gap-1 border-t border-token-border-default py-2.5 first:border-none first:pt-0 last:pb-0`,children:[(0,Q.jsx)(`div`,{className:`h-3 w-36 rounded bg-token-border-default`}),(0,Q.jsx)(`div`,{className:`h-2.5 w-full rounded bg-token-border-default`}),(0,Q.jsx)(`div`,{className:`h-2.5 w-4/5 rounded bg-token-border-default`})]},t)}function An(e){let t=(0,Z.c)(17),{appPersonalizationModes:n,blurbs:r,onAppPersonalizationModeChange:i,personalizationToggles:a}=e,o=ne(),s;if(t[0]!==n||t[1]!==o||t[2]!==i||t[3]!==a){let e;t[5]!==n||t[6]!==o||t[7]!==i?(e=e=>(0,Q.jsxs)(`div`,{className:`flex items-start justify-between gap-4 border-t border-token-border-default py-2.5 first:border-none first:pt-0 last:pb-0`,children:[(0,Q.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,Q.jsx)(`div`,{className:`font-medium text-token-text-primary`,children:e.blurb.title}),(0,Q.jsx)(`div`,{children:In(e.blurb.description)})]}),(0,Q.jsx)(Y,{checked:n[e.appId]===`PERSONALIZE_ALWAYS`,ariaLabel:o.formatMessage({id:`plugins.installModal.personalizationToggle`,defaultMessage:`Allow ChatGPT to use reference memories and chats for {appName}`,description:`Accessible label for the personalization toggle in the plugin install modal`},{appName:e.appName}),onChange:t=>{i({appId:e.appId,mode:t?`PERSONALIZE_ALWAYS`:`NO_PERSONALIZATION`})}})]},e.appId),t[5]=n,t[6]=o,t[7]=i,t[8]=e):e=t[8],s=a.map(e),t[0]=n,t[1]=o,t[2]=i,t[3]=a,t[4]=s}else s=t[4];let c;if(t[9]!==r||t[10]!==a.length){let e;t[12]===a.length?e=t[13]:(e=(e,t)=>(0,Q.jsxs)(`div`,{className:a.length>0||t>0?`flex flex-col gap-1 border-t border-token-border-default py-2.5 last:pb-0`:`flex flex-col gap-1 py-2.5 first:pt-0 last:pb-0`,children:[(0,Q.jsx)(`div`,{className:`font-medium text-token-text-primary`,children:e.title}),(0,Q.jsx)(`div`,{children:In(e.description)})]},`${e.title}-${t}`),t[12]=a.length,t[13]=e),c=r.map(e),t[9]=r,t[10]=a.length,t[11]=c}else c=t[11];let l;return t[14]!==s||t[15]!==c?(l=(0,Q.jsxs)(`div`,{className:`text-sm text-token-text-secondary`,children:[s,c]}),t[14]=s,t[15]=c,t[16]=l):l=t[16],l}function jn(e,t){switch(e){case`connected`:return t.formatMessage({id:`plugins.installModal.requiredApps.connected`,defaultMessage:`Connected`,description:`Button label shown for a required app that is already connected`});case`launching`:case`waitingForCallback`:return t.formatMessage({id:`plugins.installModal.requiredApps.connecting`,defaultMessage:`Opened link`,description:`Button label shown after the required app connection flow has been opened`});case`pending`:return t.formatMessage({id:`plugins.installModal.requiredApps.connect`,defaultMessage:`Connect`,description:`Button label shown for a required app that still needs to be connected`})}}function Mn(e){return{appMetadata:null,branding:null,description:e.description,distributionChannel:null,id:e.appId,installUrl:e.installUrl,isAccessible:!1,isEnabled:!1,labels:null,logoUrl:e.logoUrl,logoUrlDark:null,name:e.name,pluginDisplayNames:[]}}function Nn(e){let t=(0,Z.c)(14),{plugin:n}=e,r;t[0]===n?r=t[1]:(r=G(n),t[0]=n,t[1]=r);let i;t[2]===r?i=t[3]:(i=(0,Q.jsx)(`div`,{className:`text-sm font-medium text-token-text-primary`,children:r}),t[2]=r,t[3]=i);let a;t[4]===n.marketplaceName?a=t[5]:(a=n.marketplaceName.length>0?(0,Q.jsx)(K,{className:`border border-token-border-default bg-transparent px-1.5 py-0.5 text-xs font-medium text-token-text-secondary`,children:n.marketplaceName}):null,t[4]=n.marketplaceName,t[5]=a);let o;t[6]!==i||t[7]!==a?(o=(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[i,a]}),t[6]=i,t[7]=a,t[8]=o):o=t[8];let s;t[9]===n?s=t[10]:(s=(0,Q.jsx)(Pn,{plugin:n}),t[9]=n,t[10]=s);let c;return t[11]!==o||t[12]!==s?(c=(0,Q.jsxs)(Fn,{children:[o,s]}),t[11]=o,t[12]=s,t[13]=c):c=t[13],c}function Pn(e){let t=(0,Z.c)(11),{plugin:n}=e,r;t[0]===n.plugin.interface?.developerName?r=t[1]:(r=n.plugin.interface?.developerName?.trim(),t[0]=n.plugin.interface?.developerName,t[1]=r);let i=r,a;t[2]===n.plugin.interface?.category?a=t[3]:(a=n.plugin.interface?.category?.trim(),t[2]=n.plugin.interface?.category,t[3]=a);let o=a;if(i==null&&o==null)return null;let s;t[4]===i?s=t[5]:(s=i?(0,Q.jsx)(`div`,{children:(0,Q.jsx)(k,{id:`plugins.installModal.metadata.developer`,defaultMessage:`By {developerName}`,description:`Developer metadata shown in the plugin install modal`,values:{developerName:i}})}):null,t[4]=i,t[5]=s);let c;t[6]===o?c=t[7]:(c=o?(0,Q.jsx)(`div`,{children:(0,Q.jsx)(k,{id:`plugins.installModal.metadata.category`,defaultMessage:`Category: {category}`,description:`Category metadata shown in the plugin install modal`,values:{category:o}})}):null,t[6]=o,t[7]=c);let l;return t[8]!==s||t[9]!==c?(l=(0,Q.jsxs)(`div`,{className:`flex flex-col gap-1 text-sm text-token-text-secondary`,children:[s,c]}),t[8]=s,t[9]=c,t[10]=l):l=t[10],l}function Fn(e){let t=(0,Z.c)(2),{children:n}=e,r;return t[0]===n?r=t[1]:(r=(0,Q.jsx)(`div`,{className:`flex flex-col gap-2 border-b border-token-border-default py-3 last:border-none`,children:n}),t[0]=n,t[1]=r),r}function In(e){let t=[],n=0,r;for(;(r=Kt.exec(e))!=null;){r.index>n&&t.push(e.slice(n,r.index));let[i,a,o]=r,s=o.trim();if(s.length===0){t.push(a),n=r.index+i.length;continue}t.push((0,Q.jsx)(Dn,{url:s,children:a},`${s}-${r.index}`)),n=r.index+i.length}return n{let n=`${e.title}\u0000${e.description}`;return t.has(n)?[]:(t.add(n),[{description:e.description,title:e.title}])})}function Rn({draftModes:e,personalizationToggles:t}){let n={...e};if(t==null)return n;for(let e of t)n[e.appId]??=e.defaultMode;return n}function zn(e){return e.plugin.interface?.longDescription?.trim()||e.plugin.interface?.shortDescription?.trim()||e.description?.trim()||null}function Bn(e){return e.interface?.displayName?.trim()||p(e.name.split(`:`).pop()||e.name)}function Vn({forceReloadPlugins:e,hostId:t}){let n=v(w),r=ne(),i=j(),a=_(),l=de(t),f=n.query.snapshot(et),p=I(),[,m]=s(`composer_prefill`),h=N(`2761268526`),{data:g}=y(L,t),{clearPendingAppConnect:b,isAppConnectPending:ee,markAppConnectOAuthPending:T}=$e(),{closePluginInstallAppConnect:te,closePluginInstall:E,markPluginInstallStarted:D,markRequiredAppStatus:O,openPluginInstallDetails:k,openPluginInstall:A,openRequiredAppConnect:M,session:P,setPluginInstallNeedsApps:F}=me(),{data:R=[],hardRefetchAppsList:z}=ie({enabled:P.kind===`needsApps`||P.kind===`connectApp`,hostId:t}),B=V({apps:R,enabled:P.kind===`needsApps`||P.kind===`connectApp`})??R,re=P.kind===`needsApps`||P.kind===`connectApp`?P.requiredApps.map(e=>e.app):void 0,ae=P.kind===`details`||P.kind===`installing`?P.plugin:null,{blockedReasonsByConnectorId:oe}=We({hostId:t,pluginApps:re}),{blockedReason:ce,isLoading:le}=We(ae==null?{hostId:t}:{hostId:t,...Se(ae)}),ue=ge({hostId:t}),H=_e({hostId:t}),fe=ve({hostId:t}),pe=ue.available,he=H.available,xe=fe.available,[we,Te]=(0,at.useState)(!1),U=x({mutationFn:async e=>{let n=await c(`install-plugin`,{hostId:t,...Se(e)});return await Le({hostId:t,marketplacePath:e.marketplacePath,pluginName:e.plugin.name}),n}}),Ee=we||U.isPending,De=Ee||P.kind===`installing`,W=Hn({apps:B,appInstallBlockedReasonsById:oe,isAppConnectPending:ee,session:P}),Oe=W.kind===`needsApps`&&W.requiredBrowserExtensions.length===0&&W.requiredApps.length>0&&W.requiredApps.every(e=>e.status===`connected`),ke=(0,at.useEffectEvent)(t=>{E();let i=t.postInstallComposerPrefill?.trim();i&&m({text:i}),n.get(se).success(r.formatMessage({id:`plugins.install.ready`,defaultMessage:`{pluginName} is ready.`,description:`Toast shown when all required apps are connected for a plugin install flow`},{pluginName:G(t.plugin)})),e().catch(e=>{C.error(`Failed to refresh plugins after plugin app setup`,{safe:{},sensitive:{error:e}})})});(0,at.useEffect)(()=>{!Oe||W.kind!==`needsApps`||ke(W)},[Oe,W]);let Ae=e=>!(!pe&&ye(e.plugin.id)||!he&&Ce(e.plugin.id)||!xe&&be(e.plugin.id)),Me=e=>{n.get(se).success(r.formatMessage({id:`plugins.install.success`,defaultMessage:`{pluginName} plugin installed`,description:`Toast shown after a plugin is installed`},{pluginName:G(e)}))},Fe=async({installLockedComputerUse:i=!1,options:s,plugin:h})=>{if(Ee||le||!Ae(h)){E();return}Te(!0);try{if(Ge(h.plugin)||ce===`disabled-by-admin`){k(h,s);return}let _;try{_=await U.mutateAsync(h),s.origin===`setup_codex`&&u(n,d.CODEX_ONBOARDING_WIZARD_PHASE_PLUGIN_INSTALL,o.CODEX_ONBOARDING_WIZARD_ACTION_COMPLETED)}catch(e){C.error(`Failed to install plugin`,{safe:{},sensitive:{error:e}}),n.get(se).danger(r.formatMessage({id:`plugins.install.error`,defaultMessage:`Failed to install plugin`,description:`Toast shown when installing a plugin fails`})),E();return}let v=Pe(h.plugin.id);if(v!=null&&(await Ie(n,v,!1),await c(`batch-write-config-value`,{hostId:t,edits:Ne({pluginId:h.plugin.id,enabled:!0}),filePath:g?.configWriteTarget?.filePath??null,expectedVersion:null,reloadUserConfig:!0})),i&&ye(h.plugin.id)){let e=!1;try{let t=await X(!0);f.setData(e=>({computerIconDataURL:e?.computerIconDataURL??null,enabled:t,lockIconDataURL:e?.lockIconDataURL??null})),e=t!==!0}catch(t){C.error(`Failed to enable Locked Computer Use after install`,{safe:{},sensitive:{error:t}}),e=!0}e&&n.get(se).danger(r.formatMessage({id:`plugins.install.lockedComputerUseError`,defaultMessage:`Installed Computer Use, but failed to enable Locked Computer Use`,description:`Toast shown when Computer Use installs but Locked Computer Use cannot be enabled`}))}try{await e()}catch(e){C.error(`Failed to refresh plugins after install`,{safe:{},sensitive:{error:e}}),n.get(se).danger(r.formatMessage({id:`plugins.install.refreshError`,defaultMessage:`Installed {pluginName}, but failed to refresh the plugin list`,description:`Toast shown when a plugin installs successfully but the plugin list refresh fails`},{pluginName:G(h)}))}await Promise.all([p(je),p(tt)]);let y=await kt({authPolicy:_.authPolicy,codexHome:l,hostId:t,plugin:h,queryClient:a,windowType:`electron`});if(Me(h),_.authPolicy===`ON_USE`||_.appsNeedingAuth.length===0&&y.length===0){let e=s.postInstallComposerPrefill?.trim();e&&m({text:e}),E();return}F({apps:_.appsNeedingAuth,browserExtensions:y,connectingAppId:_.authPolicy===`ON_INSTALL`&&_.appsNeedingAuth.length===1&&y.length===0?_.appsNeedingAuth[0].id:void 0,options:s,plugin:h})}finally{Te(!1)}},Re=(0,at.useEffectEvent)(e=>{D(e.plugin.plugin.id),Fe({options:{origin:e.origin,postInstallComposerPrefill:e.postInstallComposerPrefill},plugin:e.plugin})});return(0,at.useEffect)(()=>{P.kind!==`installing`||P.installStarted||le||Re(P)},[le,P]),{closePluginInstall:()=>{if(!De){if(U.reset(),P.kind===`connectApp`){te();return}E()}},connectRequiredApp:async e=>{if(W.kind!==`needsApps`)return;let t=W.requiredApps.find(t=>t.appId===e);if(t==null||oe[e]!=null||t.status===`connected`||t.status===`launching`||t.status===`waitingForCallback`)return;let n=t.installUrl?.trim();if(!h&&n){S.dispatchMessage(`open-in-browser`,{url:n,useExternalBrowser:!0,useExternalBrowser:!0,useExternalBrowser:!0,useExternalBrowser:!0,useExternalBrowser:!0,useExternalBrowser:!0});return}b({appId:e}),M(e)},handleRequiredAppConnected:async e=>{O({appId:e,status:`connected`});try{await Qe({hostId:t,queryClient:a,refreshAppsList:z})}catch(e){C.error(`Failed to refresh apps after plugin app connect`,{safe:{},sensitive:{error:e}})}},handleRequiredAppOAuthStarted:({app:e,redirectUrl:n})=>{O({appId:e.id,status:`waitingForCallback`}),T({app:e,hostId:t,redirectUrl:n,returnTo:`${i.pathname}${i.search}${i.hash}`,resumeTarget:{kind:`plugin-install`}})},installPlugin:async(e={},t=!1)=>{P.kind===`details`&&await Fe({installLockedComputerUse:t,options:{origin:P.origin,postInstallComposerPrefill:P.postInstallComposerPrefill},plugin:P.plugin})},isInstalling:De,openPluginInstall:(e,t={})=>{De||!Ae(e)||(U.reset(),A(e,t))},session:W}}function Hn({apps:e,isAppConnectPending:t,appInstallBlockedReasonsById:n,session:r}){if(r.kind===`closed`)return r;if(r.kind===`details`)return{kind:`details`,postInstallComposerPrefill:r.postInstallComposerPrefill,plugin:r.plugin};if(r.kind===`installing`)return{kind:`installing`,plugin:r.plugin};let i=new Map;e.forEach(e=>{i.set(e.id,e)});let a=r.requiredApps.map(e=>Un({appInstallBlockedReasonsById:n,appsById:i,isAppConnectPending:t,requiredApp:e}));if(r.kind===`connectApp`){let e=a.find(e=>e.appId===r.app.id)??Un({appInstallBlockedReasonsById:n,appsById:i,isAppConnectPending:t,requiredApp:{app:r.app,status:`pending`}});return{kind:`connectApp`,plugin:r.plugin,app:e}}return{kind:`needsApps`,postInstallComposerPrefill:r.postInstallComposerPrefill,plugin:r.plugin,requiredBrowserExtensions:r.requiredBrowserExtensions,requiredApps:a}}function Un({appInstallBlockedReasonsById:e,appsById:t,isAppConnectPending:n,requiredApp:r}){let i=t.get(r.app.id),a=r.status;return i?.isAccessible===!0||e[r.app.id]===`disabled-by-admin`?a=`connected`:r.status===`waitingForCallback`&&!n(r.app.id)&&(a=`pending`),{appId:r.app.id,description:i?.description??r.app.description,installUrl:i?.installUrl??r.app.installUrl,logoUrl:i?.logoUrl??null,name:i?.name??r.app.name,status:a}}export{zt as a,xt as c,lt as d,ct as f,nt as g,it as h,Rt as i,pt as l,ot as m,Zt as n,It as o,st as p,Vt as r,Ot as s,Vn as t,ut as u}; //# sourceMappingURL=use-plugin-install-flow-C0YRtVkW.js.map \ No newline at end of file diff --git a/desktop/recovered/app-asar-extracted/webview/assets/use-window-controls-safe-area-X2AodDul.js b/desktop/recovered/app-asar-extracted/webview/assets/use-window-controls-safe-area-X2AodDul.js index c1af469f..ff037617 100644 --- a/desktop/recovered/app-asar-extracted/webview/assets/use-window-controls-safe-area-X2AodDul.js +++ b/desktop/recovered/app-asar-extracted/webview/assets/use-window-controls-safe-area-X2AodDul.js @@ -1,2 +1,2 @@ -import{s as e}from"./chunk-Bj-mKKzh.js";import{n as t}from"./jsx-runtime-CiQ1k8xo.js";import{lt as n,p as r}from"./vscode-api-sUstfl-x.js";var i=n(),a=e(t(),1),o=16,s=Object.freeze({default:Object.freeze({left:0,right:0}),mac:Object.freeze({legacy:Object.freeze({left:66+o,right:0}),modern:Object.freeze({left:76+o,right:0})}),windows:Object.freeze({left:0,right:0}),linux:Object.freeze({left:0,right:120})}),c=/mac os x (\d+)[_.](\d+)/i;function l(e){let t=c.exec(e);if(!t)return s.mac.modern;let n=Number.parseInt(t[1]??``,10),r=Number.parseInt(t[2]??``,10);return Number.isNaN(n)||Number.isNaN(r)?s.mac.modern:n===10&&r<=15?s.mac.legacy:s.mac.modern}function u(){if(typeof window>`u`||typeof navigator>`u`)return null;let e=navigator.windowControlsOverlay;if(!e?.visible)return null;let t=e.getTitlebarAreaRect();return{left:Math.max(0,Math.round(t.x)),right:Math.max(0,Math.round(window.innerWidth-(t.x+t.width)))}}function d(e,t){if(e||typeof navigator>`u`)return s.default;let n=navigator,r=(n.userAgent??``).toLowerCase(),i=n.userAgentData?.platform?.toLowerCase()??n.platform?.toLowerCase()??r;return i.includes(`darwin`)||i.includes(`mac`)||r.includes(`mac os x`)||r.includes(`macintosh`)?l(r):i.includes(`win`)||r.includes(`windows`)?t??s.windows:i.includes(`linux`)?s.linux:s.default}function f(){let e=(0,i.c)(9),[t,n]=(0,a.useState)(!1),[o,s]=(0,a.useState)(p),c,l;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(c=e=>{n(e.isFullScreen)},l=[],e[0]=c,e[1]=l):(c=e[0],l=e[1]),r(`window-fullscreen-changed`,c,l);let f,m;e[2]===Symbol.for(`react.memo_cache_sentinel`)?(f=()=>{if(typeof window>`u`){s(null);return}let e=navigator.windowControlsOverlay;if(!e){s(null);return}let t=()=>{s(u())};return t(),e.addEventListener(`geometrychange`,t),window.addEventListener(`resize`,t),()=>{e.removeEventListener(`geometrychange`,t),window.removeEventListener(`resize`,t)}},m=[],e[2]=f,e[3]=m):(f=e[2],m=e[3]),(0,a.useEffect)(f,m);let h,g;e[4]===Symbol.for(`react.memo_cache_sentinel`)?(h=()=>{let e=window.matchMedia(`(display-mode: fullscreen)`);n(e.matches);let t=e=>{n(e.matches)};return e.addEventListener(`change`,t),()=>{e.removeEventListener(`change`,t)}},g=[],e[4]=h,e[5]=g):(h=e[4],g=e[5]),(0,a.useEffect)(h,g);let _;return e[6]!==t||e[7]!==o?(_=d(t,o),e[6]=t,e[7]=o,e[8]=_):_=e[8],_}function p(){return u()}export{f as t}; +import{s as e}from"./chunk-Bj-mKKzh.js";import{n as t}from"./jsx-runtime-CiQ1k8xo.js";import{lt as n,p as r}from"./vscode-api-sUstfl-x.js";var i=n(),a=e(t(),1),o=16,s=Object.freeze({default:Object.freeze({left:0,right:0}),mac:Object.freeze({legacy:Object.freeze({left:66+o,right:0}),modern:Object.freeze({left:76+o,right:0})}),windows:Object.freeze({left:0,right:0}),linux:Object.freeze({left:0,right:0})}),c=/mac os x (\d+)[_.](\d+)/i;function l(e){let t=c.exec(e);if(!t)return s.mac.modern;let n=Number.parseInt(t[1]??``,10),r=Number.parseInt(t[2]??``,10);return Number.isNaN(n)||Number.isNaN(r)?s.mac.modern:n===10&&r<=15?s.mac.legacy:s.mac.modern}function u(){if(typeof window>`u`||typeof navigator>`u`)return null;let e=navigator.windowControlsOverlay;if(!e?.visible)return null;let t=e.getTitlebarAreaRect();return{left:Math.max(0,Math.round(t.x)),right:Math.max(0,Math.round(window.innerWidth-(t.x+t.width)))}}function d(e,t){if(e||typeof navigator>`u`)return s.default;let n=navigator,r=(n.userAgent??``).toLowerCase(),i=n.userAgentData?.platform?.toLowerCase()??n.platform?.toLowerCase()??r;return i.includes(`darwin`)||i.includes(`mac`)||r.includes(`mac os x`)||r.includes(`macintosh`)?l(r):i.includes(`win`)||r.includes(`windows`)?t??s.windows:i.includes(`linux`)?s.linux:s.default}function f(){let e=(0,i.c)(9),[t,n]=(0,a.useState)(!1),[o,s]=(0,a.useState)(p),c,l;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(c=e=>{n(e.isFullScreen)},l=[],e[0]=c,e[1]=l):(c=e[0],l=e[1]),r(`window-fullscreen-changed`,c,l);let f,m;e[2]===Symbol.for(`react.memo_cache_sentinel`)?(f=()=>{if(typeof window>`u`){s(null);return}let e=navigator.windowControlsOverlay;if(!e){s(null);return}let t=()=>{s(u())};return t(),e.addEventListener(`geometrychange`,t),window.addEventListener(`resize`,t),()=>{e.removeEventListener(`geometrychange`,t),window.removeEventListener(`resize`,t)}},m=[],e[2]=f,e[3]=m):(f=e[2],m=e[3]),(0,a.useEffect)(f,m);let h,g;e[4]===Symbol.for(`react.memo_cache_sentinel`)?(h=()=>{let e=window.matchMedia(`(display-mode: fullscreen)`);n(e.matches);let t=e=>{n(e.matches)};return e.addEventListener(`change`,t),()=>{e.removeEventListener(`change`,t)}},g=[],e[4]=h,e[5]=g):(h=e[4],g=e[5]),(0,a.useEffect)(h,g);let _;return e[6]!==t||e[7]!==o?(_=d(t,o),e[6]=t,e[7]=o,e[8]=_):_=e[8],_}function p(){return u()}export{f as t}; //# sourceMappingURL=use-window-controls-safe-area-X2AodDul.js.map \ No newline at end of file diff --git a/desktop/recovered/refresh-manifest.json b/desktop/recovered/refresh-manifest.json index a4906da3..4dd1505f 100644 --- a/desktop/recovered/refresh-manifest.json +++ b/desktop/recovered/refresh-manifest.json @@ -22,178 +22,272 @@ ] }, "preload": { - "patched": true, + "patched": false, "results": [ { "label": "preload ipc retry guard", - "patched": true, - "skipped": false, - "reason": null + "patched": false, + "skipped": true, + "reason": "preload ipc retry guard replacement already present" + }, + { + "label": "preload exposes linux title bar bridge", + "patched": false, + "skipped": true, + "reason": "preload exposes linux title bar bridge replacement already present" } ] }, "bootstrap": { - "patched": true, + "patched": false, "results": [ { "label": "bootstrap linux git wrapper path", - "patched": true, - "skipped": false, - "reason": null + "patched": false, + "skipped": true, + "reason": "bootstrap linux git wrapper path replacement already present" }, { "label": "bootstrap startup stack logging", - "patched": true, - "skipped": false, - "reason": null + "patched": false, + "skipped": true, + "reason": "bootstrap startup stack logging replacement already present" } ] }, "mainProcess": { - "patched": true, + "patched": false, "results": [ { "label": "git origins existing-path filter", - "patched": true, - "skipped": false, - "reason": null + "patched": false, + "skipped": true, + "reason": "git origins existing-path filter replacement already present" }, { "label": "linux auth browser session handoff", - "patched": true, - "skipped": false, - "reason": null + "patched": false, + "skipped": true, + "reason": "linux auth browser session handoff replacement already present" }, { "label": "linux opaque primary window background", - "patched": true, - "skipped": false, - "reason": null + "patched": false, + "skipped": true, + "reason": "linux opaque primary window background replacement already present" }, { - "label": "linux title bar overlay uses high contrast controls", - "patched": true, - "skipped": false, - "reason": null + "label": "linux primary window uses custom title bar", + "patched": false, + "skipped": true, + "reason": "linux primary window uses custom title bar replacement already present" }, { - "label": "linux title bar overlay refreshes on theme changes", - "patched": true, - "skipped": false, - "reason": null + "label": "linux window controls ipc handler", + "patched": false, + "skipped": true, + "reason": "linux window controls ipc handler replacement already present" }, { - "label": "linux primary window uses custom title bar", - "patched": true, - "skipped": false, - "reason": null + "label": "linux application menu serialization ipc handler", + "patched": false, + "skipped": true, + "reason": "linux application menu serialization ipc handler replacement already present" + }, + { + "label": "linux skips title bar overlay sync without overlay controls", + "patched": false, + "skipped": true, + "reason": "linux skips title bar overlay sync without overlay controls replacement already present" }, { "label": "linux hides native menu for custom title bar auto-hide", - "patched": true, - "skipped": false, - "reason": null + "patched": false, + "skipped": true, + "reason": "linux hides native menu for custom title bar auto-hide replacement already present" }, { "label": "linux hides native menu for custom title bar remove-menu", - "patched": true, - "skipped": false, - "reason": null + "patched": false, + "skipped": true, + "reason": "linux hides native menu for custom title bar remove-menu replacement already present" }, { "label": "linux avatar overlay uses toolbar window type", - "patched": true, - "skipped": false, - "reason": null + "patched": false, + "skipped": true, + "reason": "linux avatar overlay uses toolbar window type replacement already present" }, { "label": "linux avatar overlay uses stronger always-on-top level", - "patched": true, - "skipped": false, - "reason": null + "patched": false, + "skipped": true, + "reason": "linux avatar overlay uses stronger always-on-top level replacement already present" }, { "label": "linux avatar overlay refreshes always-on-top before show", - "patched": true, - "skipped": false, - "reason": null + "patched": false, + "skipped": true, + "reason": "linux avatar overlay refreshes always-on-top before show replacement already present" }, { "label": "linux avatar overlay tracks top enforcement timer", - "patched": true, - "skipped": false, - "reason": null + "patched": false, + "skipped": true, + "reason": "linux avatar overlay tracks top enforcement timer replacement already present" }, { "label": "linux avatar overlay keeps pointer events interactive", - "patched": true, - "skipped": false, - "reason": null + "patched": false, + "skipped": true, + "reason": "linux avatar overlay keeps pointer events interactive replacement already present" }, { "label": "linux avatar overlay exposes raise helper", - "patched": true, - "skipped": false, - "reason": null + "patched": false, + "skipped": true, + "reason": "linux avatar overlay exposes raise helper replacement already present" }, { "label": "linux avatar overlay stops top enforcement on close", - "patched": true, - "skipped": false, - "reason": null + "patched": false, + "skipped": true, + "reason": "linux avatar overlay stops top enforcement on close replacement already present" }, { "label": "linux avatar overlay re-raises after app window focus", - "patched": true, - "skipped": false, - "reason": null + "patched": false, + "skipped": true, + "reason": "linux avatar overlay re-raises after app window focus replacement already present" }, { "label": "linux avatar overlay remains focusable for reply input", - "patched": true, - "skipped": false, - "reason": null + "patched": false, + "skipped": true, + "reason": "linux avatar overlay remains focusable for reply input replacement already present" }, { "label": "linux avatar overlay steals focus for reply input", - "patched": true, - "skipped": false, - "reason": null + "patched": false, + "skipped": true, + "reason": "linux avatar overlay steals focus for reply input replacement already present" }, { "label": "linux avatar overlay is available in main process", - "patched": true, - "skipped": false, - "reason": null + "patched": false, + "skipped": true, + "reason": "linux avatar overlay is available in main process replacement already present" }, { "label": "linux open-in target registry", - "patched": true, - "skipped": false, - "reason": null + "patched": false, + "skipped": true, + "reason": "linux open-in target registry replacement already present" + } + ] + }, + "appShellRenderer": { + "patched": false, + "results": [ + { + "label": "app shell custom title menu is enabled on linux", + "patched": false, + "skipped": true, + "reason": "app shell custom title menu is enabled on linux replacement already present" + }, + { + "label": "app shell renders linux window controls in title bar", + "patched": false, + "skipped": true, + "reason": "app shell renders linux window controls in title bar replacement already present" + }, + { + "label": "app shell upgrades linux window controls in title bar", + "patched": false, + "skipped": true, + "reason": "app shell upgrades linux window controls in title bar replacement already present" + }, + { + "label": "app shell title bar reserves space for inline window controls", + "patched": false, + "skipped": true, + "reason": "app shell title bar reserves space for inline window controls replacement already present" + }, + { + "label": "app shell renders linux codex application sub-menus", + "patched": false, + "skipped": true, + "reason": "app shell renders linux codex application sub-menus replacement already present" + }, + { + "label": "app shell hides floating sidebar nav when title bar owns chrome", + "patched": false, + "skipped": true, + "reason": "app shell hides floating sidebar nav when title bar owns chrome replacement already present" + }, + { + "label": "app shell raises floating sidebar above main header chrome", + "patched": false, + "skipped": true, + "reason": "app shell raises floating sidebar above main header chrome replacement already present" + }, + { + "label": "app shell sets floating sidebar inline z-index above main content", + "patched": false, + "skipped": true, + "reason": "app shell sets floating sidebar inline z-index above main content replacement already present" + }, + { + "label": "app shell uses compiled top offset for floating sidebar", + "patched": false, + "skipped": true, + "reason": "app shell uses compiled top offset for floating sidebar replacement already present" + }, + { + "label": "app shell shifts main header left when floating sidebar is open", + "patched": false, + "skipped": true, + "reason": "app shell shifts main header left when floating sidebar is open replacement already present" + }, + { + "label": "app shell applies floating sidebar main header left style offset", + "patched": false, + "skipped": true, + "reason": "app shell applies floating sidebar main header left style offset replacement already present" + } + ] + }, + "windowControlsSafeArea": { + "patched": false, + "results": [ + { + "label": "linux window controls safe area uses inline title bar controls", + "patched": false, + "skipped": true, + "reason": "linux window controls safe area uses inline title bar controls replacement already present" } ] }, "startupShell": { - "patched": true, + "patched": false, "results": [ { "label": "startup shell opaque background", - "patched": true, - "skipped": false, - "reason": null + "patched": false, + "skipped": true, + "reason": "startup shell opaque background replacement already present" }, { "label": "startup shell light theme colors", - "patched": true, - "skipped": false, - "reason": null + "patched": false, + "skipped": true, + "reason": "startup shell light theme colors replacement already present" }, { "label": "startup shell no logo fade", - "patched": true, - "skipped": false, - "reason": null + "patched": false, + "skipped": true, + "reason": "startup shell no logo fade replacement already present" }, { "label": "startup shell no shimmer animation", @@ -210,37 +304,37 @@ ] }, "avatarOverlayRenderer": { - "patched": true, + "patched": false, "results": [ { "label": "avatar overlay drag starts only on mascot", - "patched": true, - "skipped": false, - "reason": null + "patched": false, + "skipped": true, + "reason": "avatar overlay drag starts only on mascot replacement already present" }, { "label": "avatar overlay activity tray uses larger default layout", - "patched": true, - "skipped": false, - "reason": null + "patched": false, + "skipped": true, + "reason": "avatar overlay activity tray uses larger default layout replacement already present" }, { "label": "avatar overlay activity tray uses larger padding", - "patched": true, - "skipped": false, - "reason": null + "patched": false, + "skipped": true, + "reason": "avatar overlay activity tray uses larger padding replacement already present" }, { "label": "avatar overlay activity tray wraps compact messages", - "patched": true, - "skipped": false, - "reason": null + "patched": false, + "skipped": true, + "reason": "avatar overlay activity tray wraps compact messages replacement already present" }, { "label": "avatar overlay compact activity body can show more lines", - "patched": true, - "skipped": false, - "reason": null + "patched": false, + "skipped": true, + "reason": "avatar overlay compact activity body can show more lines replacement already present" }, { "label": "avatar overlay activity body measurement matches larger padding", diff --git a/desktop/scripts/assemble-codex-runtime.mjs b/desktop/scripts/assemble-codex-runtime.mjs index a09c6856..cbb23483 100644 --- a/desktop/scripts/assemble-codex-runtime.mjs +++ b/desktop/scripts/assemble-codex-runtime.mjs @@ -279,90 +279,69 @@ const mainLinuxOpaqueWindowPatchAlternatives = [ }, ]; const mainLinuxOpaqueWindowPatchMarker = 'backgroundMaterial:`mica`};if(e===`linux`&&'; -const mainLinuxTitleBarOverlayColorPatchAlternatives = [ - { - target: - 'function ow(){return{color:XC,symbolColor:n.nativeTheme.shouldUseDarkColors?aw:iw,height:rw}}', - replacement: - 'function ow(){return process.platform===`linux`?{color:`#2b2f36`,symbolColor:`#ffffff`,height:rw}:{color:XC,symbolColor:n.nativeTheme.shouldUseDarkColors?aw:iw,height:rw}}', - }, - { - target: - 'function vM(){return{color:cM,symbolColor:n.nativeTheme.shouldUseDarkColors?_M:gM,height:hM}}', - replacement: - 'function vM(){return process.platform===`linux`?{color:`#2b2f36`,symbolColor:`#ffffff`,height:hM}:{color:cM,symbolColor:n.nativeTheme.shouldUseDarkColors?_M:gM,height:hM}}', - }, - { - target: - 'function xM(){return{color:dM,symbolColor:n.nativeTheme.shouldUseDarkColors?bM:yM,height:vM}}', - replacement: - 'function xM(){return process.platform===`linux`?{color:`#2b2f36`,symbolColor:`#ffffff`,height:vM}:{color:dM,symbolColor:n.nativeTheme.shouldUseDarkColors?bM:yM,height:vM}}', - }, - { - target: - 'function fq(){return{color:nq,symbolColor:n.nativeTheme.shouldUseDarkColors?dq:uq,height:lq}}', - replacement: - 'function fq(){return process.platform===`linux`?{color:`#2b2f36`,symbolColor:`#ffffff`,height:lq}:{color:nq,symbolColor:n.nativeTheme.shouldUseDarkColors?dq:uq,height:lq}}', - }, - { - target: - 'function TY(){return{color:pY,symbolColor:n.nativeTheme.shouldUseDarkColors?wY:CY,height:SY}}', - replacement: - 'function TY(){return process.platform===`linux`?{color:`#2b2f36`,symbolColor:`#ffffff`,height:SY}:{color:pY,symbolColor:n.nativeTheme.shouldUseDarkColors?wY:CY,height:SY}}', - }, - { - target: - 'function m2(e=1){return{color:Q0,symbolColor:a.nativeTheme.shouldUseDarkColors?f2:d2,height:Math.round(u2*e)}}', - replacement: - 'function m2(e=1){return process.platform===`linux`?{color:`#2b2f36`,symbolColor:`#ffffff`,height:Math.round(u2*e)}:{color:Q0,symbolColor:a.nativeTheme.shouldUseDarkColors?f2:d2,height:Math.round(u2*e)}}', - }, -]; -const mainLinuxTitleBarOverlayColorPatchMarker = - 'process.platform===`linux`?{color:`#2b2f36`,symbolColor:`#ffffff`,height:'; -const mainLinuxTitleBarOverlayUpdatePatchAlternatives = [ - { - target: - 'installWindowsTitleBarOverlaySync(e,t){if(process.platform!==`win32`||t!==`primary`)return;', - replacement: - 'installWindowsTitleBarOverlaySync(e,t){if(process.platform!==`win32`&&process.platform!==`linux`||t!==`primary`)return;', - }, -]; -const mainLinuxTitleBarOverlayUpdatePatchMarker = - 'if(process.platform!==`win32`&&process.platform!==`linux`||t!==`primary`)return;'; const mainLinuxPrimaryTitleBarPatchAlternatives = [ { target: 'n===`win32`?{titleBarStyle:`hidden`,titleBarOverlay:ow()}:{titleBarStyle:`default`}', replacement: - '(n===`win32`||n===`linux`)?{titleBarStyle:`hidden`,titleBarOverlay:ow()}:{titleBarStyle:`default`}', + 'n===`win32`?{titleBarStyle:`hidden`,titleBarOverlay:ow()}:n===`linux`?{titleBarStyle:`hidden`}:{titleBarStyle:`default`}', }, { target: 'n===`win32`?{titleBarStyle:`hidden`,titleBarOverlay:vM()}:{titleBarStyle:`default`}', replacement: - '(n===`win32`||n===`linux`)?{titleBarStyle:`hidden`,titleBarOverlay:vM()}:{titleBarStyle:`default`}', + 'n===`win32`?{titleBarStyle:`hidden`,titleBarOverlay:vM()}:n===`linux`?{titleBarStyle:`hidden`}:{titleBarStyle:`default`}', }, { target: 'n===`win32`?{titleBarStyle:`hidden`,titleBarOverlay:xM()}:{titleBarStyle:`default`}', replacement: - '(n===`win32`||n===`linux`)?{titleBarStyle:`hidden`,titleBarOverlay:xM()}:{titleBarStyle:`default`}', + 'n===`win32`?{titleBarStyle:`hidden`,titleBarOverlay:xM()}:n===`linux`?{titleBarStyle:`hidden`}:{titleBarStyle:`default`}', }, { target: 'n===`win32`?{titleBarStyle:`hidden`,titleBarOverlay:fq()}:{titleBarStyle:`default`}', replacement: - '(n===`win32`||n===`linux`)?{titleBarStyle:`hidden`,titleBarOverlay:fq()}:{titleBarStyle:`default`}', + 'n===`win32`?{titleBarStyle:`hidden`,titleBarOverlay:fq()}:n===`linux`?{titleBarStyle:`hidden`}:{titleBarStyle:`default`}', }, { target: 'n===`win32`?{titleBarStyle:`hidden`,titleBarOverlay:TY()}:{titleBarStyle:`default`}', replacement: - '(n===`win32`||n===`linux`)?{titleBarStyle:`hidden`,titleBarOverlay:TY()}:{titleBarStyle:`default`}', + 'n===`win32`?{titleBarStyle:`hidden`,titleBarOverlay:TY()}:n===`linux`?{titleBarStyle:`hidden`}:{titleBarStyle:`default`}', }, { target: 'n===`win32`?{titleBarStyle:`hidden`,titleBarOverlay:m2(r)}:{titleBarStyle:`default`}', replacement: - '(n===`win32`||n===`linux`)?{titleBarStyle:`hidden`,titleBarOverlay:m2(r)}:{titleBarStyle:`default`}', + 'n===`win32`?{titleBarStyle:`hidden`,titleBarOverlay:m2(r)}:n===`linux`?{titleBarStyle:`hidden`}:{titleBarStyle:`default`}', + }, +]; +const mainLinuxPrimaryTitleBarPatchMarker = 'n===`linux`?{titleBarStyle:`hidden`}'; +const mainLinuxTitleBarOverlaySyncSkipPatchAlternatives = [ + { + target: + 'installWindowsTitleBarOverlaySync(e,t){if(process.platform!==`win32`&&process.platform!==`linux`||t!==`primary`)return;', + replacement: + 'installWindowsTitleBarOverlaySync(e,t){if(process.platform!==`win32`||t!==`primary`)return;', }, ]; -const mainLinuxPrimaryTitleBarPatchMarker = - '(n===`win32`||n===`linux`)?{titleBarStyle:`hidden`,titleBarOverlay:'; +const mainLinuxTitleBarOverlaySyncSkipPatchMarker = + 'installWindowsTitleBarOverlaySync(e,t){if(process.platform!==`win32`||t!==`primary`)return;'; +const mainLinuxWindowControlPatchTarget = 'sX(b);let x=!1;a.ipcMain.handle(sl,'; +const mainLinuxWindowControlPatchReplacement = + 'sX(b),a.ipcMain.handle(`codex_desktop:control-window`,async(e,t)=>{if(!b(e))return;let n=a.BrowserWindow.fromWebContents(e.sender);if(!n||n.isDestroyed())return;switch(t?.action){case`minimize`:n.minimize();return;case`maximize`:n.isMaximized()?n.unmaximize():n.maximize();return;case`close`:n.close();return}});let x=!1;a.ipcMain.handle(sl,'; +const mainLinuxWindowControlPatchMarker = 'codex_desktop:control-window'; +const mainLinuxApplicationMenuPatchTarget = + 'codex_desktop:control-window`,async(e,t)=>{if(!b(e))return;let n=a.BrowserWindow.fromWebContents(e.sender);if(!n||n.isDestroyed())return;switch(t?.action){case`minimize`:n.minimize();return;case`maximize`:n.isMaximized()?n.unmaximize():n.maximize();return;case`close`:n.close();return}});let x=!1;a.ipcMain.handle(sl,'; +const mainLinuxApplicationMenuPatchReplacement = + 'codex_desktop:control-window`,async(e,t)=>{if(!b(e))return;let n=a.BrowserWindow.fromWebContents(e.sender);if(!n||n.isDestroyed())return;switch(t?.action){case`minimize`:n.minimize();return;case`maximize`:n.isMaximized()?n.unmaximize():n.maximize();return;case`close`:n.close();return}});function linuxSerializeMenuItems(e,t){let n=[];if(!e)return n;for(let r=0;r0&&(s.submenu=linuxSerializeMenuItems(i.submenu,o)),n.push(s)}return n}function linuxMenuItemAtPath(e,t){let n=t.split(`.`).map(Number),r=e;for(let e=0;e{if(!b(e))return{items:[]};let n=a.Menu.getApplicationMenu()?.getMenuItemById(t?.menuId)?.submenu;return{items:n?linuxSerializeMenuItems(n,``):[]}}),a.ipcMain.handle(`codex_desktop:click-application-menu-item`,async(e,t)=>{if(!b(e))return;let n=a.Menu.getApplicationMenu()?.getMenuItemById(t?.menuId)?.submenu,r=linuxMenuItemAtPath(n,t?.path);r&&r.enabled!==!1&&typeof r.click==`function`&&r.click()});let x=!1;a.ipcMain.handle(sl,'; +const mainLinuxApplicationMenuPatchMarker = 'codex_desktop:get-application-menu-items'; +const preloadLinuxBridgePatchTarget = + 'showApplicationMenu:async(t,n,i)=>{await e.ipcRenderer.invoke(r,{menuId:t,x:n,y:i})}'; +const preloadLinuxBridgePatchReplacement = + 'showApplicationMenu:async(t,n,i)=>{await e.ipcRenderer.invoke(r,{menuId:t,x:n,y:i})},controlWindow:async t=>{await e.ipcRenderer.invoke(`codex_desktop:control-window`,{action:t})},getApplicationMenuItems:async t=>await e.ipcRenderer.invoke(`codex_desktop:get-application-menu-items`,{menuId:t}),clickApplicationMenuItem:async(t,n)=>{await e.ipcRenderer.invoke(`codex_desktop:click-application-menu-item`,{menuId:t,path:n})}'; +const preloadLinuxBridgePatchMarker = 'getApplicationMenuItems:async t=>'; +const rendererLinuxWindowControlsSafeAreaPatchTarget = + 'linux:Object.freeze({left:0,right:120})'; +const rendererLinuxWindowControlsSafeAreaPatchReplacement = + 'linux:Object.freeze({left:0,right:0})'; +const rendererLinuxWindowControlsSafeAreaPatchMarker = + 'linux:Object.freeze({left:0,right:0})'; const mainLinuxNativeMenuAutoHidePatchAlternatives = [ { target: 'process.platform===`win32`?{autoHideMenuBar:!0}:{}', @@ -396,6 +375,69 @@ const mainLinuxNativeMenuRemovePatchPattern = /process\.platform===`win32`&&([A-Za-z_$][\w$]*)\.removeMenu\(\)/g; const mainLinuxNativeMenuRemovePatchReplacement = '(process.platform===`win32`||process.platform===`linux`)&&$1.removeMenu()'; +const appShellLinuxWindowsMenuPatchAlternatives = [ + { + target: + 'function $n(){let{platform:e}=nt();return e===`windows`&&window.electronBridge?.showApplicationMenu!=null}', + replacement: + 'function $n(){let{platform:e}=nt();return(e===`windows`||e===`linux`)&&window.electronBridge?.showApplicationMenu!=null}', + }, +]; +const appShellLinuxWindowsMenuPatchMarker = + 'return(e===`windows`||e===`linux`)&&window.electronBridge?.showApplicationMenu!=null'; +const appShellLinuxApplicationMenuFunction = + 'function nr(){let e=D(),t=$n(),{platform:p}=nt(),h=p===`linux`&&typeof window.electronBridge?.getApplicationMenuItems==`function`,[n,r]=(0,Z.useState)(null),[m,g]=(0,Z.useState)([]),[_,v]=(0,Z.useState)(null),y=(0,Z.useRef)(0);if((0,Z.useEffect)(()=>{if(!h||!n)return;let e=e=>{e.key===`Escape`&&r(null)},t=e=>{let t=document.getElementById(`linux-application-menu-panel`);t&&!t.contains(e.target)&&!e.target.closest(`[data-linux-menu-trigger=true]`)&&r(null)};return document.addEventListener(`keydown`,e),document.addEventListener(`mousedown`,t),()=>{document.removeEventListener(`keydown`,e),document.removeEventListener(`mousedown`,t)}},[h,n]),!t)return null;let b=e=>e?e.replace(/CommandOrControl|CmdOrCtrl/g,`Ctrl`).replace(/Command/g,`Ctrl`).replace(/Control/g,`Ctrl`):``,x=async(e,t)=>{if(h){if(n===e){r(null);return}let i=t.currentTarget.getBoundingClientRect(),a=y.current+1;y.current=a,r(e),g([]);let o=await window.electronBridge.getApplicationMenuItems(e);y.current===a&&(v({left:Math.round(i.left),top:Math.round(i.bottom)}),g(o?.items??[]))}else{let n=window.electronBridge?.showApplicationMenu;if(!n)return;let i=y.current+1;y.current=i,r(e);let a=t.currentTarget.getBoundingClientRect();try{await n(e,Math.round(a.left),Math.round(a.bottom))}finally{y.current===i&&r(null)}}},S=async e=>{e.enabled!==!1&&n&&(await window.electronBridge?.clickApplicationMenuItem?.(n,e.path),r(null))},C=`no-drag rounded-md border border-transparent px-2.5 py-1 text-base font-normal leading-none outline-none transition-colors`,w=t=>c(C,n===t?`bg-[var(--color-token-menubar-selection-background)] text-[var(--color-token-menubar-selection-foreground)]`:`text-token-text-tertiary hover:bg-token-foreground/5 hover:text-token-description-foreground focus-visible:bg-token-foreground/5 focus-visible:text-token-description-foreground`);return(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`div`,{className:`flex items-center gap-0.5 pr-2 pl-1`,children:tr.map(({id:t,message:i})=>(0,Q.jsx)(`button`,{type:`button`,"data-linux-menu-trigger":h?`true`:void 0,"aria-expanded":n===t,"aria-haspopup":`menu`,"aria-label":e.formatMessage(i),className:w(t),onClick:e=>{x(t,e)},children:(0,Q.jsx)(k,{...i})},t))}),h&&n&&_&&(0,Q.jsx)(`div`,{id:`linux-application-menu-panel`,className:`no-drag fixed z-50 m-px flex min-w-[220px] flex-col rounded-xl bg-token-dropdown-background/90 p-1 text-token-foreground shadow-lg ring-[0.5px] ring-token-border backdrop-blur-sm select-none`,style:{left:_.left,top:_.top},children:m.map(t=>t.type===`separator`?(0,Q.jsx)(`div`,{className:`mx-1 my-1 border-t border-token-border/60`,role:`separator`},t.path):(0,Q.jsx)(`button`,{type:`button`,className:c(`flex w-full items-center gap-3 rounded-lg p-1.5 text-left text-sm outline-none transition-colors`,t.enabled===!1?`cursor-default opacity-50`:`cursor-interaction hover:bg-token-list-hover-background focus:bg-token-list-hover-background`),disabled:t.enabled===!1,onClick:()=>{S(t)},children:(0,Q.jsxs)(`span`,{className:`flex w-full items-center gap-3`,children:[(0,Q.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:t.label}),t.accelerator?(0,Q.jsx)(`span`,{className:`shrink-0 pl-4 text-xs text-token-text-tertiary tabular-nums`,children:b(t.accelerator)}):null]})},t.path))})]})}'; +const appShellLinuxApplicationMenuPatchTarget = + 'function nr(){let e=D(),t=$n(),[n,r]=(0,Z.useState)(null),i=(0,Z.useRef)(0);if(!t)return null;let a=async(e,t)=>{let n=window.electronBridge?.showApplicationMenu;if(!n)return;let a=i.current+1;i.current=a,r(e);let o=t.currentTarget.getBoundingClientRect();try{await n(e,Math.round(o.left),Math.round(o.bottom))}finally{i.current===a&&r(null)}};return(0,Q.jsx)(`div`,{className:`flex items-center gap-0.5 pr-2 pl-1`,children:tr.map(({id:t,message:r})=>(0,Q.jsx)(`button`,{type:`button`,"aria-expanded":n===t,"aria-haspopup":`menu`,"aria-label":e.formatMessage(r),className:c(`no-drag rounded-md border border-transparent px-2.5 py-1 text-base font-normal leading-none outline-none transition-colors`,n===t?`bg-[var(--color-token-menubar-selection-background)] text-[var(--color-token-menubar-selection-foreground)]`:`text-token-text-tertiary hover:bg-token-foreground/5 hover:text-token-description-foreground focus-visible:bg-token-foreground/5 focus-visible:text-token-description-foreground`),onClick:e=>{a(t,e)},children:(0,Q.jsx)(k,{...r})},t))})}'; +const appShellLinuxApplicationMenuPatchReplacement = appShellLinuxApplicationMenuFunction; +const appShellLinuxApplicationMenuPatchMarker = 'linux-application-menu-panel'; +// Close icon uses useState for red hover: plain hover:text-token-charts-red is not in app-main CSS. +const appShellLinuxWindowControlsFunction = + 'function LinuxWindowControls(){let{platform:e}=nt(),t=window.electronBridge?.controlWindow;if(e!==`linux`||typeof t!=`function`)return null;let n=e=>()=>{void t(e)},[a,u]=(0,Z.useState)(!1),o=`no-drag cursor-interaction inline-flex h-7 w-7 shrink-0 items-center justify-center rounded-md border border-transparent bg-transparent p-0 outline-none transition-colors hover:bg-token-foreground/5 focus-visible:bg-token-foreground/5`,r=c(o,`text-token-text-tertiary hover:text-token-description-foreground focus-visible:text-token-description-foreground`),i=c(o,a?`text-token-charts-red`:`text-token-text-tertiary`);return(0,Q.jsxs)(`div`,{"data-linux-codex-window-controls":`true`,className:`no-drag ml-auto flex shrink-0 items-center gap-0.5 pe-2`,children:[(0,Q.jsx)(`button`,{type:`button`,className:r,onClick:n(`minimize`),"aria-label":`Minimize`,children:(0,Q.jsx)(`svg`,{className:`h-2.5 w-2.5`,viewBox:`0 0 10 10`,fill:`none`,"aria-hidden":`true`,children:(0,Q.jsx)(`path`,{d:`M0 5h10`,stroke:`currentColor`,strokeWidth:1})})}),(0,Q.jsx)(`button`,{type:`button`,className:r,onClick:n(`maximize`),"aria-label":`Maximize`,children:(0,Q.jsx)(`svg`,{className:`h-2.5 w-2.5`,viewBox:`0 0 10 10`,fill:`none`,"aria-hidden":`true`,children:(0,Q.jsx)(`rect`,{x:.5,y:.5,width:9,height:9,stroke:`currentColor`,strokeWidth:1})})}),(0,Q.jsx)(`button`,{type:`button`,className:i,onMouseEnter:()=>u(!0),onMouseLeave:()=>u(!1),onFocus:()=>u(!0),onBlur:()=>u(!1),onClick:n(`close`),"aria-label":`Close`,children:(0,Q.jsx)(`svg`,{className:`h-2.5 w-2.5`,viewBox:`0 0 10 10`,fill:`none`,"aria-hidden":`true`,children:(0,Q.jsx)(`path`,{d:`M1 1l8 8M9 1L1 9`,stroke:`currentColor`,strokeWidth:1})})})]})}'; +const appShellLinuxWindowControlsPatchAlternatives = [ + { + target: 'children:[n,r,i]}),e[4]=r,e[5]=a),a}function $r(e){return null}', + replacement: `children:[n,r,i,(0,Q.jsx)(LinuxWindowControls,{})]}),e[4]=r,e[5]=a),a}${appShellLinuxWindowControlsFunction}function $r(e){return null}`, + }, +]; +const appShellLinuxWindowControlsUpgradePatchPattern = + /function LinuxWindowControls\(\)\{[\s\S]*?\}(?=function \$r\(e\)\{return null\})/; +const appShellLinuxWindowControlsPatchMarker = 'onFocus:()=>u(!0),onBlur:()=>u(!1),onClick:n(`close`)'; +const appShellLinuxWindowControlsTopBarPatchTarget = + 'group/windows-top-bar z-40 flex h-toolbar-sm items-center ps-(--spacing-token-safe-header-left) pe-(--spacing-token-safe-header-right)'; +const appShellLinuxWindowControlsTopBarPatchReplacement = + 'group/windows-top-bar z-50 flex h-toolbar-sm items-center ps-(--spacing-token-safe-header-left) pe-0'; +const appShellLinuxWindowControlsTopBarPatchMarker = + 'group/windows-top-bar z-50 flex h-toolbar-sm items-center ps-(--spacing-token-safe-header-left) pe-0'; +const appShellLinuxFloatingSidebarHideNavHeaderPatchTarget = + 'children:[(0,Q.jsx)(U.div,{initial:s?!1:{x:8},animate:{x:0},exit:{x:s?0:8},transition:h,className:`app-header-tint flex h-toolbar shrink-0 items-center ps-(--spacing-token-safe-header-left) pe-2`,children:(0,Q.jsx)(qn,{hideUnreadBadge:!0,onToggleSidebar:l})}),(0,Q.jsx)(`div`,{className:`min-h-0 flex-1 overflow-hidden`,children:a})]'; +const appShellLinuxFloatingSidebarHideNavHeaderPatchReplacement = + 'children:[r?null:(0,Q.jsx)(U.div,{initial:s?!1:{x:8},animate:{x:0},exit:{x:s?0:8},transition:h,className:`app-header-tint flex h-toolbar shrink-0 items-center ps-(--spacing-token-safe-header-left) pe-2`,children:(0,Q.jsx)(qn,{hideUnreadBadge:!0,onToggleSidebar:l})}),(0,Q.jsx)(`div`,{className:`min-h-0 flex-1 overflow-hidden`,children:a})]'; +const appShellLinuxFloatingSidebarHideNavHeaderPatchMarker = + 'children:[r?null:(0,Q.jsx)(U.div,{initial:s?!1:{x:8}'; +const appShellLinuxFloatingSidebarZIndexPatchTarget = + 'pointer-events-auto fixed bottom-0 left-0 z-30 min-h-0'; +const appShellLinuxFloatingSidebarZIndexPatchReplacement = + 'pointer-events-auto fixed bottom-0 left-0 z-40 min-h-0'; +const appShellLinuxFloatingSidebarZIndexPatchMarker = 'left-0 z-40 min-h-0'; +const appShellLinuxFloatingSidebarInlineZIndexPatchTarget = + 'exit:{opacity:0,x:s?0:-8},style:{width:n},transition:h,children:[(0,Q.jsxs)(`aside`'; +const appShellLinuxFloatingSidebarInlineZIndexPatchReplacement = + 'exit:{opacity:0,x:s?0:-8},style:{width:n,zIndex:40},transition:h,children:[(0,Q.jsxs)(`aside`'; +const appShellLinuxFloatingSidebarInlineZIndexPatchMarker = 'style:{width:n,zIndex:40}'; +const appShellLinuxFloatingSidebarTopPatchTarget = 'r?`top-(--height-toolbar-sm)`:`top-0`'; +const appShellLinuxFloatingSidebarTopPatchReplacement = 'r?`top-toolbar-sm`:`top-0`'; +const appShellLinuxFloatingSidebarTopPatchMarker = 'r?`top-toolbar-sm`:`top-0`'; +const appShellLinuxFloatingSidebarMainHeaderLeftPatchTarget = + 'function vr({isHeaderEdgeScroll:e,isWindowsMenuBarEnabled:t}){let{headerLeftWidth:n,headerRightWidth:r,leftPanelAnimatedWidth:i,rightPanelAnimatedWidth:a}=Je(),o=Kt(0),s=Jt`${i}px`,l=Jt`${a}px`,u=y(fe)'; +const appShellLinuxFloatingSidebarMainHeaderLeftPatchReplacement = + 'function vr({isHeaderEdgeScroll:e,isWindowsMenuBarEnabled:t}){let{headerLeftWidth:n,headerRightWidth:r,leftPanelAnimatedWidth:i,rightPanelAnimatedWidth:a,leftPanelWidth:lp}=Je(),flw=y(Wr),fls=y(Ze),o=Kt(0),s=Jt`${i}px`,l=Jt`${a}px`,u=y(fe)'; +const appShellLinuxFloatingSidebarMainHeaderLeftStylePatchTarget = + 'style:t?{left:s}:{},children:[(0,Q.jsx)(yr,{entries:p,fitWidth:n,slotWidth:t?o:i,side:`start`})'; +const appShellLinuxFloatingSidebarMainHeaderLeftStylePatchReplacement = + 'style:t?{left:flw&&!fls?`${Math.max(lp.get(),i.get())}px`:s}:{},children:[(0,Q.jsx)(yr,{entries:p,fitWidth:n,slotWidth:t?o:i,side:`start`})'; +const appShellLinuxFloatingSidebarMainHeaderLeftPatchMarker = + 'flw=y(Wr),fls=y(Ze)'; const mainLinuxAvatarOverlayOnTopPatchAlternatives = [ { target: @@ -1168,7 +1210,15 @@ function buildMissingPatchTargetError(label, sourcePath) { return new Error(`${label} patch target not found in ${sourcePath}`); } -export function applyStringPatch(source, target, replacement, label, sourcePath) { +export function applyStringPatch(source, target, replacement, label, sourcePath, marker) { + if (marker && source.includes(marker)) { + return { + patched: false, + skipped: true, + reason: `${label} replacement already present`, + }; + } + if (source.includes(replacement)) { return { patched: false, @@ -1451,7 +1501,14 @@ export function applyPatchesToFile(filePath, patches) { filePath, patch.marker, ) - : applyStringPatch(source, patch.target, patch.replacement, patch.label, filePath); + : applyStringPatch( + source, + patch.target, + patch.replacement, + patch.label, + filePath, + patch.marker, + ); results.push({ label: patch.label, patched: patchResult.patched, @@ -1552,6 +1609,12 @@ function patchCodexPreload(extractedAppRoot) { marker: preloadPatchMarker, label: 'preload ipc retry guard', }, + { + label: 'preload exposes linux title bar bridge', + target: preloadLinuxBridgePatchTarget, + replacement: preloadLinuxBridgePatchReplacement, + marker: preloadLinuxBridgePatchMarker, + }, ]), ); } @@ -1660,19 +1723,26 @@ function patchCodexMainProcessBundle(extractedAppRoot) { marker: mainLinuxOpaqueWindowPatchMarker, }, { - label: 'linux title bar overlay uses high contrast controls', - alternatives: mainLinuxTitleBarOverlayColorPatchAlternatives, - marker: mainLinuxTitleBarOverlayColorPatchMarker, + label: 'linux primary window uses custom title bar', + alternatives: mainLinuxPrimaryTitleBarPatchAlternatives, + marker: mainLinuxPrimaryTitleBarPatchMarker, }, { - label: 'linux title bar overlay refreshes on theme changes', - alternatives: mainLinuxTitleBarOverlayUpdatePatchAlternatives, - marker: mainLinuxTitleBarOverlayUpdatePatchMarker, + label: 'linux window controls ipc handler', + target: mainLinuxWindowControlPatchTarget, + replacement: mainLinuxWindowControlPatchReplacement, + marker: mainLinuxWindowControlPatchMarker, }, { - label: 'linux primary window uses custom title bar', - alternatives: mainLinuxPrimaryTitleBarPatchAlternatives, - marker: mainLinuxPrimaryTitleBarPatchMarker, + label: 'linux application menu serialization ipc handler', + target: mainLinuxApplicationMenuPatchTarget, + replacement: mainLinuxApplicationMenuPatchReplacement, + marker: mainLinuxApplicationMenuPatchMarker, + }, + { + label: 'linux skips title bar overlay sync without overlay controls', + alternatives: mainLinuxTitleBarOverlaySyncSkipPatchAlternatives, + marker: mainLinuxTitleBarOverlaySyncSkipPatchMarker, }, { label: 'linux hides native menu for custom title bar auto-hide', @@ -1750,6 +1820,98 @@ function patchCodexMainProcessBundle(extractedAppRoot) { ); } +function patchCodexAppShellRenderer(extractedAppRoot) { + const appShellPath = findExtractedWebviewAsset(extractedAppRoot, 'app-shell-'); + + return summarizePatchResults( + applyPatchesToFile(appShellPath, [ + { + label: 'app shell custom title menu is enabled on linux', + alternatives: appShellLinuxWindowsMenuPatchAlternatives, + marker: appShellLinuxWindowsMenuPatchMarker, + }, + { + label: 'app shell renders linux window controls in title bar', + alternatives: appShellLinuxWindowControlsPatchAlternatives, + marker: appShellLinuxWindowControlsPatchMarker, + }, + { + type: 'regex', + label: 'app shell upgrades linux window controls in title bar', + pattern: appShellLinuxWindowControlsUpgradePatchPattern, + replacement: appShellLinuxWindowControlsFunction, + marker: appShellLinuxWindowControlsPatchMarker, + }, + { + label: 'app shell title bar reserves space for inline window controls', + target: appShellLinuxWindowControlsTopBarPatchTarget, + replacement: appShellLinuxWindowControlsTopBarPatchReplacement, + marker: appShellLinuxWindowControlsTopBarPatchMarker, + }, + { + label: 'app shell renders linux codex application sub-menus', + target: appShellLinuxApplicationMenuPatchTarget, + replacement: appShellLinuxApplicationMenuPatchReplacement, + marker: appShellLinuxApplicationMenuPatchMarker, + }, + { + label: 'app shell hides floating sidebar nav when title bar owns chrome', + target: appShellLinuxFloatingSidebarHideNavHeaderPatchTarget, + replacement: appShellLinuxFloatingSidebarHideNavHeaderPatchReplacement, + marker: appShellLinuxFloatingSidebarHideNavHeaderPatchMarker, + }, + { + label: 'app shell raises floating sidebar above main header chrome', + target: appShellLinuxFloatingSidebarZIndexPatchTarget, + replacement: appShellLinuxFloatingSidebarZIndexPatchReplacement, + marker: appShellLinuxFloatingSidebarZIndexPatchMarker, + }, + { + label: 'app shell sets floating sidebar inline z-index above main content', + target: appShellLinuxFloatingSidebarInlineZIndexPatchTarget, + replacement: appShellLinuxFloatingSidebarInlineZIndexPatchReplacement, + marker: appShellLinuxFloatingSidebarInlineZIndexPatchMarker, + }, + { + label: 'app shell uses compiled top offset for floating sidebar', + target: appShellLinuxFloatingSidebarTopPatchTarget, + replacement: appShellLinuxFloatingSidebarTopPatchReplacement, + marker: appShellLinuxFloatingSidebarTopPatchMarker, + }, + { + label: 'app shell shifts main header left when floating sidebar is open', + target: appShellLinuxFloatingSidebarMainHeaderLeftPatchTarget, + replacement: appShellLinuxFloatingSidebarMainHeaderLeftPatchReplacement, + marker: appShellLinuxFloatingSidebarMainHeaderLeftPatchMarker, + }, + { + label: 'app shell applies floating sidebar main header left style offset', + target: appShellLinuxFloatingSidebarMainHeaderLeftStylePatchTarget, + replacement: appShellLinuxFloatingSidebarMainHeaderLeftStylePatchReplacement, + marker: appShellLinuxFloatingSidebarMainHeaderLeftPatchMarker, + }, + ]), + ); +} + +function patchCodexWindowControlsSafeArea(extractedAppRoot) { + const safeAreaPath = findExtractedWebviewAsset( + extractedAppRoot, + 'use-window-controls-safe-area-', + ); + + return summarizePatchResults( + applyPatchesToFile(safeAreaPath, [ + { + label: 'linux window controls safe area uses inline title bar controls', + target: rendererLinuxWindowControlsSafeAreaPatchTarget, + replacement: rendererLinuxWindowControlsSafeAreaPatchReplacement, + marker: rendererLinuxWindowControlsSafeAreaPatchMarker, + }, + ]), + ); +} + function patchCodexStartupShell(extractedAppRoot) { const startupShellPath = path.join(extractedAppRoot, 'webview', 'index.html'); @@ -2160,6 +2322,8 @@ export function patchExtractedCodexApp(extractedAppRoot) { preload: patchCodexPreload(extractedAppRoot), bootstrap: patchCodexBootstrap(extractedAppRoot), mainProcess: patchCodexMainProcessBundle(extractedAppRoot), + appShellRenderer: patchCodexAppShellRenderer(extractedAppRoot), + windowControlsSafeArea: patchCodexWindowControlsSafeArea(extractedAppRoot), startupShell: patchCodexStartupShell(extractedAppRoot), avatarOverlayRenderer: patchCodexAvatarOverlayRenderer(extractedAppRoot), authWebview: patchCodexAuthWebviewBundles(extractedAppRoot), diff --git a/desktop/tests/linux/recovered-bundle.red.test.ts b/desktop/tests/linux/recovered-bundle.red.test.ts index 22bdd283..86c91454 100644 --- a/desktop/tests/linux/recovered-bundle.red.test.ts +++ b/desktop/tests/linux/recovered-bundle.red.test.ts @@ -27,6 +27,31 @@ import { readOptionalRecoveredAsset, } from './recovered-bundle.helpers'; +function expectLinuxAppShellFloatingSidebarMarkers(bundle: string) { + expect(bundle).toContain('children:[r?null:(0,Q.jsx)(U.div,{initial:s?!1:{x:8}'); + expect(bundle).toContain('left-0 z-40 min-h-0'); + expect(bundle).toContain( + 'group/windows-top-bar z-50 flex h-toolbar-sm items-center ps-(--spacing-token-safe-header-left) pe-0', + ); + expect(bundle).toContain('r?`top-toolbar-sm`:`top-0`'); + expect(bundle).toContain('style:{width:n,zIndex:40}'); + expect(bundle).toContain('flw=y(Wr),fls=y(Ze)'); + expect(bundle).toContain('left:flw&&!fls?`${Math.max(lp.get(),i.get())}px`:s'); + expect(bundle).not.toContain('{,"data-testid"'); +} + +function expectLinuxAppShellTitleBarMarkers(bundle: string) { + expect(bundle).toContain( + 'return(e===`windows`||e===`linux`)&&window.electronBridge?.showApplicationMenu!=null', + ); + expect(bundle).toContain('function LinuxWindowControls(){'); + expect(bundle).toContain('data-linux-codex-window-controls'); + expect(bundle).toContain('onFocus:()=>u(!0),onBlur:()=>u(!1),onClick:n(`close`)'); + expect(bundle).toContain('linux-application-menu-panel'); + expect(bundle).toContain('getApplicationMenuItems'); + expect(bundle).toContain('showApplicationMenu'); +} + describe('Recovered Codex bundle RED contract', () => { const localAppAsarPath = path.resolve( desktopRoot, @@ -163,6 +188,7 @@ describe('Recovered Codex bundle RED contract', () => { pluginsCardsAsset == null ? null : fs.readFileSync(path.join(outputAssetsRoot, pluginsCardsAsset), 'utf8'); + const windowControlsSafeAreaBundle = readOutputAsset('use-window-controls-safe-area-'); expect(summary.outputRoot).toBe(outputRoot); expect(summary.version).toBe('26.601.21317'); @@ -177,13 +203,17 @@ describe('Recovered Codex bundle RED contract', () => { expect(mainBundle).toContain('openUrlWithLinuxBrowserSession'); expect(mainBundle).toContain('require(`../../scripts/linux-browser-launch.js`)'); expect(mainBundle).not.toContain('require(`../../../../scripts/linux-browser-launch.js`)'); - expect(mainBundle).toMatch( + expect(mainBundle).toContain('n===`linux`?{titleBarStyle:`hidden`}'); + expect(mainBundle).not.toMatch( /\(n===`win32`\|\|n===`linux`\)\?\{titleBarStyle:`hidden`,titleBarOverlay:[A-Za-z_$][\w$]*\([^)]*\)\}/, ); + expect(mainBundle).toContain('codex_desktop:control-window'); + expect(mainBundle).toContain('codex_desktop:get-application-menu-items'); + expect(mainBundle).toContain('codex_desktop:click-application-menu-item'); expect(mainBundle).toContain( - 'process.platform===`linux`?{color:`#2b2f36`,symbolColor:`#ffffff`', + 'installWindowsTitleBarOverlaySync(e,t){if(process.platform!==`win32`||t!==`primary`)return;', ); - expect(mainBundle).toContain( + expect(mainBundle).not.toContain( 'if(process.platform!==`win32`&&process.platform!==`linux`||t!==`primary`)return;', ); expect(mainBundle).toContain( @@ -201,6 +231,10 @@ describe('Recovered Codex bundle RED contract', () => { expect(pluginInstallFlowBundle).toContain('open-in-browser'); } expect(appShellBundle).toContain('app-shell-shortcut-state-changed'); + expectLinuxAppShellTitleBarMarkers(appShellBundle); + expectLinuxAppShellFloatingSidebarMarkers(appShellBundle); + expect(windowControlsSafeAreaBundle).toContain('linux:Object.freeze({left:0,right:0})'); + expect(windowControlsSafeAreaBundle).not.toContain('linux:Object.freeze({left:0,right:120})'); expect(pluginsCardsBundle ?? pluginsPageBundle).toContain('plugins'); expect(summary.patchSummary.authWebview.pluginsPage.results).toEqual([ expect.objectContaining({ @@ -214,16 +248,59 @@ describe('Recovered Codex bundle RED contract', () => { expect.objectContaining({ label: 'git origins existing-path filter' }), expect.objectContaining({ label: 'linux auth browser session handoff' }), expect.objectContaining({ label: 'linux opaque primary window background' }), + expect.objectContaining({ label: 'linux primary window uses custom title bar' }), expect.objectContaining({ - label: 'linux title bar overlay uses high contrast controls', + label: 'linux skips title bar overlay sync without overlay controls', }), + expect.objectContaining({ label: 'linux window controls ipc handler' }), expect.objectContaining({ - label: 'linux title bar overlay refreshes on theme changes', + label: 'linux application menu serialization ipc handler', }), - expect.objectContaining({ label: 'linux primary window uses custom title bar' }), expect.objectContaining({ label: 'linux open-in target registry' }), ]), ); + expect(summary.patchSummary.appShellRenderer.results).toEqual( + expect.arrayContaining([ + expect.objectContaining({ + label: 'app shell custom title menu is enabled on linux', + patched: true, + }), + expect.objectContaining({ + label: 'app shell renders linux window controls in title bar', + patched: true, + }), + expect.objectContaining({ + label: 'app shell renders linux codex application sub-menus', + patched: true, + }), + expect.objectContaining({ + label: 'app shell hides floating sidebar nav when title bar owns chrome', + patched: true, + }), + expect.objectContaining({ + label: 'app shell raises floating sidebar above main header chrome', + patched: true, + }), + expect.objectContaining({ + label: 'app shell uses compiled top offset for floating sidebar', + patched: true, + }), + expect.objectContaining({ + label: 'app shell shifts main header left when floating sidebar is open', + patched: true, + }), + expect.objectContaining({ + label: 'app shell applies floating sidebar main header left style offset', + patched: true, + }), + ]), + ); + expect(summary.patchSummary.windowControlsSafeArea.results).toEqual([ + expect.objectContaining({ + label: 'linux window controls safe area uses inline title bar controls', + patched: true, + }), + ]); }, 180_000, ); @@ -308,6 +385,8 @@ describe('Recovered Codex bundle RED contract', () => { ); expect(preloadSource).toContain(';try{await e.ipcRenderer.invoke('); expect(preloadSource).not.toContain(',try{await e.ipcRenderer.invoke('); + expect(preloadSource).toContain('getApplicationMenuItems:async'); + expect(preloadSource).toContain('clickApplicationMenuItem:async'); }); test('tracked refresh manifest records the source metadata for the current recovered bundle', () => { @@ -402,7 +481,7 @@ describe('Recovered Codex bundle RED contract', () => { ); }); - test('plugin page menu patch is skipped when the upstream shell no longer needs it', () => { + test('linux app shell floating sidebar markers are present', () => { const appShell = readRecoveredAsset('app-shell-'); const manifest = JSON.parse(readDesktopFile('recovered/refresh-manifest.json')) as { patchSummary?: { @@ -414,6 +493,7 @@ describe('Recovered Codex bundle RED contract', () => { }; expect(appShell).toContain('app-shell-shortcut-state-changed'); + expectLinuxAppShellFloatingSidebarMarkers(appShell); expect(manifest.patchSummary?.authWebview?.pluginsPage?.results).toEqual([ expect.objectContaining({ label: 'apps page requests native external browser', From e3375b159dbd5b6c596f2c77dbd4a9c72af27912 Mon Sep 17 00:00:00 2001 From: boggedbrush <90526147+boggedbrush@users.noreply.github.com> Date: Tue, 9 Jun 2026 19:29:45 -0400 Subject: [PATCH 2/2] fix(titlebar): handle application menu submenus and click context --- .../.vite/build/main-BJ6Uf5yA.js | 2 +- .../webview/assets/app-shell-D7yvB1FT.js | 2 +- desktop/recovered/refresh-manifest.json | 12 +++++ desktop/scripts/assemble-codex-runtime.mjs | 46 ++++++++++++++++--- .../tests/linux/recovered-bundle.red.test.ts | 8 +++- 5 files changed, 60 insertions(+), 10 deletions(-) diff --git a/desktop/recovered/app-asar-extracted/.vite/build/main-BJ6Uf5yA.js b/desktop/recovered/app-asar-extracted/.vite/build/main-BJ6Uf5yA.js index 43a4e405..48853def 100644 --- a/desktop/recovered/app-asar-extracted/.vite/build/main-BJ6Uf5yA.js +++ b/desktop/recovered/app-asar-extracted/.vite/build/main-BJ6Uf5yA.js @@ -685,7 +685,7 @@ ${r} `}return e===`wsl`?ZY(t,n,` `):XY(t,n)}function XY(e,t){return ZY(e,t,process.platform===`win32`?`\r `:` -`)}function ZY(e,t,n){let r=t.replace(/\r\n|\r|\n/g,n);return`cd ${JSON.stringify(e)} && ${r}${n}`}function QY(e,t){return e===`powershell`?`Set-Location -LiteralPath ${$Y(t)}`:e===`commandPrompt`?`cd /d ${eX(t)}`:`cd ${JSON.stringify(t)}`}function $Y(e){return`'${e.replace(/'/g,`''`)}'`}function eX(e){return`"${e.replace(/"/g,`""`)}"`}function tX(e){let t=(e[0]??``).split(/[/\\]/);return t[t.length-1]?.toLowerCase()??``}var nX=n.Rr(`WindowContext`),rX=`x-apple.systempreferences:com.apple.preference.security?Privacy_ListenEvent`,iX=class{appServerConnectionRegistry;remoteControlDeviceKeyClient;messageHandler;remoteConnectionsHandler;sharedObjectRepository;fetchHandler;appState;errorReporter;options;scopedState;primaryRuntimeService;initialRemoteConnectionsRefresh;codexMicroService=null;codexMicroServicePromise=null;disposables=new n.Ln;registeredWindows=new Map;appServerClients=new Map;ipcClientsByWebContentsId=new Map;constructor(e){this.options=e,this.appState=e.appGlobalState,this.errorReporter=e.errorReporter,this.scopedState=e.globalState,this.sharedObjectRepository=new n.a,this.sharedObjectRepository.set(`host_config`,lu),this.sharedObjectRepository.set(`remote_connections`,[]),this.sharedObjectRepository.set(`remote_control_connections_state`,{available:!1,accessRequired:!1,authRequired:!1,clientAuthorized:!1}),this.sharedObjectRepository.set(`local_remote_control_client_id`,null),this.sharedObjectRepository.set(`local_remote_control_environment_id`,e.appGlobalState.get(Ii)),this.sharedObjectRepository.set(`local_remote_control_installation_id`,e.appGlobalState.get(Li));let r=n.Ct();r!=null&&this.sharedObjectRepository.set(`local_remote_control_enabled`,r);let i=this.createAppServerConnection(I);this.remoteControlDeviceKeyClient=xY({resourcesPath:In({env:process.env,resourcesPath:process.resourcesPath})}),this.appServerClients.set(I,i),this.appServerConnectionRegistry=new n.En,this.appServerConnectionRegistry.addConnection(I,i);let a=new qY(e.windowManager,this.scopedState,()=>e.settingsStore.getEffective(t.w.integratedTerminalShell.key),lu.terminal_command??null,async r=>{let a=await e.gitManager.getWorktreeRepository(t.mn(r),i);return a==null?null:n.rt(a)},e=>this.getHostConfigForHostId(e),e=>this.appServerConnectionRegistry.getMaybeConnection(e));this.remoteConnectionsHandler=new aY(this.appState,this.sharedObjectRepository,I,this.appServerConnectionRegistry,{desktopOriginator:e.desktopOriginator,devApiBaseUrl:e.devApiBaseUrl,prodApiBaseUrl:e.prodApiBaseUrl},i,this.remoteControlDeviceKeyClient,this.getHostConfigForHostId.bind(this),this.getAppServerClient.bind(this),this.createAndRegisterRemoteConnection.bind(this),this.disposeRemoteConnection.bind(this));let o=iJ({appServerConnectionRegistry:this.appServerConnectionRegistry,errorReporter:e.errorReporter,globalState:this.scopedState,hostId:I,sharedObjectRepository:this.sharedObjectRepository,windowManager:e.windowManager});this.primaryRuntimeService=o.rpc,this.fetchHandler=new hj(this.scopedState,e=>this.getRegisteredWindowIpcClient(e),this.appServerConnectionRegistry,e.gitManager,i,this.remoteConnectionsHandler,e.hotkeyWindowLifecycleManager,e.windowManager,a,o.isWorkspaceDependenciesFeatureEnabled,e=>this.getAppServerClient(e),e=>this.messageHandler.getWorktreeService(e),e.requestGitWorker,this.sharedObjectRepository,e.errorReporter,e.repoRoot,e.globalDictationHotkeyController,()=>{this.messageHandler.getBrowserSidebarManager().reloadOpenPages()},e.refreshApplicationMenu,e.requestComputerUseCaptureWorker,e.subscribeComputerUseCaptureWorkerEvent,()=>{this.messageHandler.getBrowserSidebarManager().refreshOwnerCommandAccelerators()},e.settingsStore),this.disposables.add(()=>this.fetchHandler.dispose()),this.disposables.add(o.startUpdatePolling());let s=Jj(this.scopedState);this.disposables.add(i.registerInternalNotificationHandler(e=>{e.method===`account/updated`&&e.params?.authMode==null&&s.clear()}));let c=new rM(this.fetchHandler,{desktopOriginator:e.desktopOriginator,devApiBaseUrl:e.devApiBaseUrl,integrityStateStore:s,messageChannel:e.messageChannel,appServerConnectionRegistry:this.appServerConnectionRegistry,prodApiBaseUrl:e.prodApiBaseUrl}),l=new wq({buildFlavor:e.buildFlavor,gitWorkerInvocationSampler:e.gitWorkerInvocationSampler});this.messageHandler=new gq(I,lu,i,e.windowManager,e.filePreviewManager,e.avatarOverlayManager,this.appServerConnectionRegistry,c,this.scopedState,this.sharedObjectRepository,a,e.gitManager,e.requestGitWorker,e.desktopNotificationManager,e.errorReporter,e.desktopSentry,e.updateWorkerSentryUser,e=>this.getRegisteredWindowIpcClient(e),e.inboxManager,e.datadogLogger,e.maxLogLevel,e.buildFlavor,e.sparkleManager,e.subscribeGitWorkerEvent,l,e=>this.getHostConfigForHostId(e),e.hasActiveComputerUseTurn,e.settingsStore),this.disposables.add(this.sharedObjectRepository.addSubscriber(e=>{if(e===`remote_connections`||e===`remote_control_connections`){this.remoteConnectionsHandler.reconcileRemoteConnections(this.getAllRemoteConnections());return}if(e===`local_remote_control_environment_id`||e===`local_remote_control_installation_id`){let e=this.sharedObjectRepository.get(`local_remote_control_environment_id`),t=this.sharedObjectRepository.get(`local_remote_control_installation_id`);e!=null&&this.appState.set(Ii,e),t!=null&&this.appState.set(Li,t),this.remoteConnectionsHandler.handleLocalRemoteControlIdentityChanged()}})),this.initialRemoteConnectionsRefresh=Promise.all([this.remoteConnectionsHandler.refreshRemoteConnections(),this.remoteConnectionsHandler.refreshLocalRemoteControlClientId()]).then(()=>void 0).catch(e=>{nX.warning(`Failed to refresh remote connections`,{safe:{},sensitive:{error:e}})})}createAppHost(e){return new Rm({debug:new L_({debugWindowManager:this.options.windowManager.debugWindowManager,getBrowserSnapshot:()=>this.messageHandler.getBrowserSidebarManager().getDebugSnapshot(),openBrowserTabOwner:e=>this.messageHandler.getBrowserSidebarManager().openDebugTabOwner(e),origin:e}),hotkeyWindowHotkeys:this.options.hotkeyWindowLifecycleManager.rpcFor(e),appshotHotkeys:this.options.appshotHotkeyController.rpc,customAvatars:this.createCustomAvatarsService(),fileAttachments:{countFolderFiles:({folderPath:e,hostId:t})=>n.Et(e,this.getAppServerClient(t))},owlFeatures:r.x(),primaryRuntime:this.primaryRuntimeService,chromeNativeHost:this.createChromeNativeHostService(),projectWritableRoots:this.messageHandler.createProjectWritableRootsService(e),systemPermissions:LY(e),threadArchive:this.createThreadArchiveService(),codexMicro:this.createCodexMicroHostService(e),notifications:new NY(this.options.windowManager,e,this.options.desktopNotificationManager)})}async applyCodexAppConfigFromDisk(e){let t=await Ac(e);return t.status===`loaded`?{status:`applied`,configPath:t.configPath,result:await this.applyCodexAppConfig(t.config)}:t}getCodexMicroService(){return this.codexMicroService==null?(this.codexMicroServicePromise??=Promise.resolve().then(()=>require(`./codex-micro-service-CYwSISMZ.js`)).then(({CodexMicroService:e})=>{let t=new e({onDeviceStateChanged:e=>{this.options.windowManager.sendMessageToAllWindows({type:`codex-micro-device-state-changed`,state:e})},onHidEvent:e=>{let t=this.options.windowManager.getPrimaryWindow();t!=null&&this.options.windowManager.sendMessageToWindow(t,{type:`codex-micro-hid-event`,event:e})},onJoystickEvent:e=>{let t=this.options.windowManager.getPrimaryWindow();t!=null&&this.options.windowManager.sendMessageToWindow(t,{type:`codex-micro-joystick-event`,event:e})}});return this.codexMicroService=t,this.disposables.add(()=>{t.dispose()}),t}).finally(()=>{this.codexMicroServicePromise=null}),this.codexMicroServicePromise):Promise.resolve(this.codexMicroService)}createCustomAvatarsService(){return{load:()=>n.Rt({appServerClient:this.getAppServerClient(),preferWsl:!!process.env.WSL_DISTRO_NAME})}}createChromeNativeHostService(){return y_({devRuntimeRepoRoot:process.env.NODE_ENV===`development`?this.options.repoRoot:void 0,getCodexHome:e=>this.getAppServerClient(e).codexHome(),getHostConfig:e=>this.getHostConfigForHostId(e)})}createThreadArchiveService(){return{archiveInactiveThread:async({hostId:e,threadId:r})=>{let i=this.getAppServerClient(e);if(t.un(i.hostConfig))throw Error(`Archiving inactive chats is only supported locally`);let a=await n.rr({codexHome:await i.codexHome(),threadId:r});return a&&this.appServerConnectionRegistry.getConnection(e).handleArchivedThreadSideEffects(r),{success:a}}}}createCodexMicroHostService(e){return{getState:async()=>{let e=await this.getCodexMicroService();return e?.start(),e?.getState()??{status:`not-detected`,error:null}},getInputMonitoringPermissionStatus:async()=>jq(),openInputMonitoringSettings:async()=>{try{await a.shell.openExternal(rX)}catch(e){nX.error(`Open input monitoring settings failed`,{safe:{},sensitive:{error:e}})}},updateLighting:async t=>this.options.windowManager.getPrimaryWindow()?.webContents===e?await(await this.getCodexMicroService())?.updateLighting(t)??!1:!1}}async applyCodexAppConfig(e){await this.initialRemoteConnectionsRefresh;let n=c_({config:e,globalState:this.appState}),{remoteConnections:r}=await this.remoteConnectionsHandler.refreshRemoteConnections(),i=l_({config:e,globalState:this.appState,remoteConnections:r});return n&&i.changedGlobalStateKeys.unshift(t._r.CODEX_MANAGED_REMOTE_CONNECTIONS),i.changedGlobalStateKeys.includes(t._r.REMOTE_CONNECTION_AUTO_CONNECT_BY_HOST_ID)&&await this.remoteConnectionsHandler.refreshRemoteConnections(),i.changedGlobalStateKeys.length>0&&this.options.windowManager.sendMessageToAllWindows({type:`global-state-updated`,keys:i.changedGlobalStateKeys}),i.remoteProjectsChanged&&this.options.windowManager.sendMessageToAllWindows({type:`workspace-root-options-updated`}),this.remoteConnectionsHandler.connectRemoteConnectionsAndLogFailures(i.remoteConnectionHostIdsToConnect),i}registerWindow(e){let{webContents:t}=e,n=new eK(t);this.registeredWindows.set(t.id,n),t.once(`destroyed`,()=>{this.registeredWindows.delete(t.id)});for(let e of this.appServerConnectionRegistry.getAllHostIds())this.appServerConnectionRegistry.getConnection(e).registerWebviewWindow(n);this.registerIpcClientForWebContents(e.webContents)}handleMessage(e,t){return this.messageHandler.handleMessage(e,t)}getBrowserSidebarManager(){return this.messageHandler.getBrowserSidebarManager()}getBrowserSessionRegistry(){return this.messageHandler.getBrowserSessionRegistry()}flushTelemetry(){this.messageHandler.flushTelemetry()}dispose(){let e=this.appServerConnectionRegistry.getAllHostIds();this.messageHandler.dispose(),this.disposables.dispose();for(let t of e)this.appServerConnectionRegistry.getMaybeConnection(t)?.dispose(),this.appServerConnectionRegistry.removeConnection(t),this.appServerClients.delete(t);this.registeredWindows.clear();for(let{dispose:e}of this.ipcClientsByWebContentsId.values())e();this.ipcClientsByWebContentsId.clear()}getMessageHandler(){return this.messageHandler}getSharedObject(e){return this.sharedObjectRepository.get(e)}setChronicleConfig(e){this.sharedObjectRepository.set(`codex_chronicle_config`,e)}getSharedObjectSnapshot(){return this.sharedObjectRepository.getSnapshot()}getHostConfigForHostId(e){if(e===`local`)return lu;let t=this.getAllRemoteConnections().find(t=>t.hostId===e);if(!t)throw Error(`Host config for host ID ${e} not found`);return AY(t)}getAllRemoteConnections(){return[...this.sharedObjectRepository.get(`remote_connections`)??[],...this.sharedObjectRepository.get(`remote_control_connections`)??[]]}createAppServerConnection(e,i=lu,o=!1,s,c){let l={desktopOriginator:this.options.desktopOriginator,devApiBaseUrl:this.options.devApiBaseUrl,prodApiBaseUrl:this.options.prodApiBaseUrl},u=In({env:process.env,resourcesPath:process.resourcesPath}),d;if(t.ln(i)){if(s==null)throw Error(`Remote control transport requires a desktop app-server client for authentication.`);if(c==null)throw Error(`Remote control transport requires the remote-control device-key client.`);d=aX({transportKind:`remote-control`,hostConfig:i,repoRoot:this.options.repoRoot,resourcesPath:u,desktopApiOptions:l,desktopAuthAppServerClient:s,remoteControlDeviceKeyClient:c,globalState:this.appState})}else d=aX({transportKind:`standard`,hostConfig:i,repoRoot:this.options.repoRoot,resourcesPath:u,desktopApiOptions:l,globalState:this.appState});let f=this.options.hostProcess.getVersion(),p=new n.Tn(this.options.messageChannel,{buildFlavor:this.options.buildFlavor,clientInfo:{name:Tl,title:`Codex Desktop`,version:f},defaultServiceName:El,repoRoot:this.options.repoRoot,resourcesPath:u,errorReporter:this.options.errorReporter,sharedObjectRepository:this.sharedObjectRepository,hostId:e,hostConfig:i,onArchiveCleanup:async({conversationId:t,cwd:n,replacementOwnerThreadId:r,replacementOwnerCwd:i})=>{await this.messageHandler.getWorktreeService(e).handleArchiveCleanup({conversationId:t,cwd:n,replacementOwnerThreadId:r,replacementOwnerCwd:i})},transport:d,hostProcess:this.options.hostProcess,isOnline:()=>a.net.isOnline(),supportsAttestationRequests:xe,isMcpAppsDilEnabled:()=>Be().dil,beforeConnect:i.id===`local`?()=>dY({hostConfig:i}):void 0,ensureAuth:o,getRemoteConnectionMaxRetryAttempts:()=>this.appState.get(t._r.REMOTE_CONNECTION_MAX_RETRY_ATTEMPTS)??null});return p.registerInternalServerRequestHandler({methods:[`item/commandExecution/requestApproval`,`mcpServer/elicitation/request`],handler:t=>(this.messageHandler.revealWindowsReviewRequest(e,t),null)}),p.registerInternalServerRequestHandler({methods:[`attestation/generate`],handler:Ce({bundleIdentifier:r.D(this.options.buildFlavor),resourcesPath:u})}),p}createAndRegisterRemoteConnection(e){let t=AY(e),n=this.createAppServerConnection(e.hostId,t,!0,this.getLocalAppServerClient(),this.remoteControlDeviceKeyClient);this.appServerClients.set(e.hostId,n);for(let e of this.registeredWindows.values())n.registerWebviewWindow(e);return n}disposeRemoteConnection(e){let t=this.appServerConnectionRegistry.getMaybeConnection(e);t&&(t.dispose(),this.appServerConnectionRegistry.removeConnection(e),this.appServerClients.delete(e))}getLocalAppServerClient(){return this.appServerConnectionRegistry.getConnection(I)}getAppServerClient(e=I){let t=this.appServerClients.get(e);if(!t)throw Error(`App server client for host ID ${e} not found`);return t}registerIpcClientForWebContents(e){if(this.appServerConnectionRegistry.getConnection(`local`).getTransportKind()!==`stdio`||this.ipcClientsByWebContentsId.has(e.id))return;let t=new n.S(`desktop`,this.errorReporter),r=new n.Ln;r.add(t.addAnyBroadcastHandler(async t=>{let n={...t,type:`ipc-broadcast`};this.messageHandler.sendMessageToOrigin(e,n)}));let i=async t=>await this.messageHandler.getThreadRole(e,t.conversationId)===`owner`;r.add(t.addRequestHandler(`thread-follower-start-turn`,i,async t=>this.messageHandler.handleThreadFollowerStartTurnRequest(e,t))),r.add(t.addRequestHandler(`thread-follower-compact-thread`,i,async t=>this.messageHandler.handleThreadFollowerCompactThreadRequest(e,t))),r.add(t.addRequestHandler(`thread-follower-steer-turn`,i,async t=>this.messageHandler.handleThreadFollowerSteerTurnRequest(e,t))),r.add(t.addRequestHandler(`thread-follower-interrupt-turn`,i,async t=>this.messageHandler.handleThreadFollowerInterruptTurnRequest(e,t))),r.add(t.addRequestHandler(`thread-follower-update-thread-settings`,i,async t=>this.messageHandler.handleThreadFollowerUpdateThreadSettingsRequest(e,t))),r.add(t.addRequestHandler(`thread-follower-edit-last-user-turn`,i,async t=>this.messageHandler.handleThreadFollowerEditLastUserTurnRequest(e,t))),r.add(t.addRequestHandler(`thread-follower-command-approval-decision`,i,async t=>this.messageHandler.handleThreadFollowerCommandApprovalDecisionRequest(e,t))),r.add(t.addRequestHandler(`thread-follower-file-approval-decision`,i,async t=>this.messageHandler.handleThreadFollowerFileApprovalDecisionRequest(e,t))),r.add(t.addRequestHandler(`thread-follower-permissions-request-approval-response`,i,async t=>this.messageHandler.handleThreadFollowerPermissionsRequestApprovalResponseRequest(e,t))),r.add(t.addRequestHandler(`thread-follower-submit-user-input`,i,async t=>this.messageHandler.handleThreadFollowerSubmitUserInputRequest(e,t))),r.add(t.addRequestHandler(`thread-follower-submit-mcp-server-elicitation-response`,i,async t=>this.messageHandler.handleThreadFollowerSubmitMcpServerElicitationRequest(e,t))),r.add(t.addRequestHandler(`thread-follower-set-queued-follow-ups-state`,i,async t=>this.messageHandler.handleThreadFollowerSetQueuedFollowUpsStateRequest(e,t))),r.add(()=>t.dispose()),this.ipcClientsByWebContentsId.set(e.id,{client:t,dispose:()=>{r.dispose(),this.messageHandler.rejectPendingThreadFollowerActionRequestsForOrigin(e)}}),e.once(`destroyed`,()=>{this.disposeIpcClientForWebContents(e)})}disposeIpcClientForWebContents(e){let t=this.ipcClientsByWebContentsId.get(e.id);t&&(this.ipcClientsByWebContentsId.delete(e.id),t.dispose())}getRegisteredWindowIpcClient(e){return this.ipcClientsByWebContentsId.get(e.id)?.client??null}};function aX(e){let t=t_(e.hostConfig);if(t)return nX.info(`[ssh-websocket-v0] selected app-server transport`,{safe:{hostId:e.hostConfig.id}}),new e_(t);if(e.transportKind===`remote-control`)return new xh({hostConfig:e.hostConfig,appServerClient:e.desktopAuthAppServerClient,deviceKeyClient:e.remoteControlDeviceKeyClient,desktopApiOptions:e.desktopApiOptions,globalState:e.globalState});let r=n.pn(e.hostConfig);return r?new n.fn({hostConfig:e.hostConfig,websocketUrl:r}):new n.Dn({hostConfig:e.hostConfig,repoRoot:e.repoRoot,resourcesPath:e.resourcesPath,defaultOriginator:e.defaultOriginator})}function oX({app:e,globalState:t,settingsStore:n,windowServices:i,repoRoot:a,errorReporter:o,desktopSentry:s,datadogLogger:c,maxLogLevel:l,buildFlavor:u,sparkleManager:d,filePreviewManager:f,avatarOverlayManager:p,hotkeyWindowLifecycleManager:m,hasActiveComputerUseTurn:h,globalDictationHotkeyController:g,appshotHotkeyController:_,gitManager:v,requestComputerUseCaptureWorker:y,requestGitWorker:b,refreshApplicationMenu:x,subscribeComputerUseCaptureWorkerEvent:S,subscribeGitWorkerEvent:C,gitWorkerInvocationSampler:w,updateWorkerSentryUser:T,appEvent:E,onCompletedThreadsChanged:D}){let O=new kp(e),k=new Op({platform:process.platform,onCompletedThreadsChanged:D}),A=new Ap({inboxItemsChanged:e=>{i.sendMessageToAllWindows({type:e})}}),j=()=>{};r.l(t,lu.default_workspaces);let M=new iX({hostProcess:O,appGlobalState:t,settingsStore:n,windowManager:i.windowManager,globalState:t,repoRoot:a,errorReporter:o,desktopSentry:s,desktopNotificationManager:k,updateWorkerSentryUser:T,gitManager:v,inboxManager:A,datadogLogger:c,maxLogLevel:l,buildFlavor:u,sparkleManager:d,gitWorkerInvocationSampler:w,desktopOriginator:Tl,devApiBaseUrl:wl,prodApiBaseUrl:Cl,messageChannel:F,filePreviewManager:f,avatarOverlayManager:p,hotkeyWindowLifecycleManager:m,hasActiveComputerUseTurn:h,globalDictationHotkeyController:g,refreshApplicationMenu:x,appshotHotkeyController:_,requestComputerUseCaptureWorker:y,requestGitWorker:b,subscribeComputerUseCaptureWorkerEvent:S,subscribeGitWorkerEvent:C});return M.getMessageHandler().setOnBrowserSidebarStateChanged(j),M.appServerConnectionRegistry.getConnection(I).registerInternalNotificationHandler(e=>{if(e.method===`account/login/completed`){i.windowManager.showPrimaryWindow({stealFocus:!0});return}e.method===`turn/completed`&&E.emit(`turnComplete`)}),i.setWindowContext(M),{desktopNotificationManager:k,getWindowContext:()=>M,getElectronMessageHandlerForWindow:e=>{let t=i.getContextForWebContents(e.webContents);return t?t.getMessageHandler():null},getAppServerClientForHost:({hostId:e})=>{try{return M.getAppServerClient(e)}catch{return null}},getWorktreeCleanupInputsForHost:async({hostKey:r,threadIds:i})=>{let a=M.appServerConnectionRegistry.getMaybeConnection(r);return{threadMetadataById:a?await GK(a,i):Object.fromEntries(i.map(e=>[e,{updatedAtMs:Date.now(),isInProgress:!0,cwd:null,readFailed:!0}])),pinnedThreadIds:KK(t),protectPreMigrationOwnerlessWorktrees:ZK(t),autoCleanupEnabled:XK(n,t,e.isPackaged),keepCount:YK(n)}},setOnBrowserSidebarStateChanged:e=>{j=e,M.getMessageHandler().setOnBrowserSidebarStateChanged(j)},flushAndDisposeContext:()=>{M.dispose(),M.flushTelemetry()}}}function sX(e){return a.ipcMain.handle(fl,async(t,n)=>{if(!e(t))return;let r=a.BrowserWindow.fromWebContents(t.sender),i=a.Menu.getApplicationMenu()?.getMenuItemById(n.menuId)?.submenu;if(i)return new Promise(e=>{i.popup({window:r??void 0,x:Math.round(n.x),y:Math.round(n.y),callback:e})})}),()=>a.ipcMain.removeHandler(fl)}var cX=16;function lX(e){let{width:t,height:n}=e.getSize();return!t||!n||t<=cX&&n<=cX?e:e.resize({width:cX,height:cX,quality:`best`})}function uX(e,t){if(e)try{if(e.startsWith(`data:`))return lX(a.nativeImage.createFromDataURL(e));if(e.startsWith(`file://`))return lX(a.nativeImage.createFromPath((0,x.fileURLToPath)(e)));if(e.startsWith(`/`))return lX(a.nativeImage.createFromPath(e));for(let n of t){let t=new URL(e,`file://${n.endsWith(`/`)?n:`${n}/`}`).pathname;if((0,l.existsSync)(t)){let e=a.nativeImage.createFromPath(t);if(!e.isEmpty())return lX(e)}}}catch{}}function dX(e,t){return a.ipcMain.handle(dl,async(n,r)=>{if(!t(n))return{id:null};let i=a.BrowserWindow.fromWebContents(n.sender);return new Promise(t=>{let n=!1,o=e=>{n||(n=!0,t({id:e}))},s=t=>t.map(t=>t.type===`separator`?{type:`separator`}:{id:t.id,label:t.label,role:t.role,enabled:t.enabled??!0,icon:uX(t.icon,e),toolTip:t.toolTip,click:()=>o(t.id),submenu:t.submenu?s(t.submenu):void 0});a.Menu.buildFromTemplate(s(r)).popup({window:i??void 0,callback:()=>o(null)})})}),()=>a.ipcMain.removeHandler(dl)}function fX(e,t,n){return new Im(new pX(e),t,n).getRemoteMain()}var pX=class{constructor(e){this.#e=e,e.start(),e.on(`message`,e=>{this.#i||(e.data==null?this.#a(Error(`Peer closed MessagePort connection.`)):typeof e.data==`string`?this.#t?(this.#t(e.data),this.#t=void 0,this.#n=void 0):this.#r.push(e.data):this.#a(TypeError(`Received non-string message from MessagePort.`)))}),e.on(`close`,()=>{this.#a(Error(`MessagePort message error.`))})}#e;#t;#n;#r=[];#i;async send(e){if(this.#i)throw this.#i;this.#e.postMessage(e)}async receive(){if(this.#r.length>0){let e=this.#r.shift();if(e!=null)return e}if(this.#i)throw this.#i;return new Promise((e,t)=>{this.#t=e,this.#n=t})}abort(e){try{this.#e.postMessage(null)}catch{}this.#e.close(),this.#i||=e}#a(e){this.#i||(this.#i=e,this.#n&&=(this.#n(e),this.#t=void 0,void 0))}},mX=3,hX=35;function gX(e){return e.type===`tray-menu-threads-changed`}var _X=class{nativeTrayClickSuppressionReason=null;clearNativeTrayClickSuppressionTimeout=null;chronicleTrayIconRefreshInterval=null;chronicleTrayIconState=`default`;isNativeTrayMenuOpen=!1;trayMenuThreads={runningThreads:[],unreadThreads:[],pinnedThreads:[],recentThreads:[],usageLimits:[]};constructor(e,t,n,r,i,a,o,s,c,l){if(this.tray=e,this.onTrayButtonClick=t,this.onTrayMenuOpenMainWindow=n,this.onTrayMenuOpenNewThread=r,this.onTrayMenuOpenRecentThread=i,this.getChronicleSidecarControlState=a,this.toggleChronicleSidecar=o,this.trayIcons=s,this.nativeIntl=c,this.appName=l,process.platform===`darwin`){this.tray.on(`mouse-down`,()=>{if(this.clearPendingNativeTrayClickSuppression(),this.isNativeTrayMenuOpen){this.nativeTrayClickSuppressionReason=`close`;return}this.nativeTrayClickSuppressionReason=`open`,this.openNativeTrayMenu()}),this.tray.on(`click`,()=>{this.consumeIgnoredNativeTrayClick()||this.openNativeTrayMenu()}),this.tray.on(`right-click`,()=>{this.consumeIgnoredNativeTrayClick()||this.openNativeTrayMenu()}),this.getChronicleSidecarControlState!=null&&this.trayIcons.chronicleRunningIcon!=null&&(this.updateChronicleTrayIcon(),this.chronicleTrayIconRefreshInterval=setInterval(()=>{this.updateChronicleTrayIcon()},1e3),this.chronicleTrayIconRefreshInterval.unref?.());return}this.tray.on(`click`,()=>{this.onTrayButtonClick()}),this.tray.on(`right-click`,()=>{this.openNativeTrayMenu()})}destroy(){this.chronicleTrayIconRefreshInterval!=null&&(clearInterval(this.chronicleTrayIconRefreshInterval),this.chronicleTrayIconRefreshInterval=null),this.tray.destroy()}async handleMessage(e){switch(e.type){case`tray-menu-threads-changed`:this.trayMenuThreads=e.trayMenuThreads;return}}consumeIgnoredNativeTrayClick(){return this.nativeTrayClickSuppressionReason==null?!1:(this.clearNativeTrayClickSuppression(),!0)}openNativeTrayMenu(){this.updateChronicleTrayIcon();let e=a.Menu.buildFromTemplate(this.getNativeTrayMenuItems());e.once(`menu-will-show`,()=>{this.isNativeTrayMenuOpen=!0}),e.once(`menu-will-close`,()=>{this.isNativeTrayMenuOpen=!1,this.handleNativeTrayMenuClosed()}),this.tray.popUpContextMenu(e)}handleNativeTrayMenuClosed(){if(this.nativeTrayClickSuppressionReason!==`close`){this.clearNativeTrayClickSuppression();return}this.clearPendingNativeTrayClickSuppression(),this.clearNativeTrayClickSuppressionTimeout=setTimeout(()=>{this.nativeTrayClickSuppressionReason===`close`&&this.clearNativeTrayClickSuppression()},0),this.clearNativeTrayClickSuppressionTimeout.unref?.()}clearPendingNativeTrayClickSuppression(){this.clearNativeTrayClickSuppressionTimeout!=null&&(clearTimeout(this.clearNativeTrayClickSuppressionTimeout),this.clearNativeTrayClickSuppressionTimeout=null)}clearNativeTrayClickSuppression(){this.clearPendingNativeTrayClickSuppression(),this.nativeTrayClickSuppressionReason=null}getNativeTrayMenuItems(){let{pinnedThreads:e,recentThreads:t,runningThreads:n,unreadThreads:r,usageLimits:i}=this.trayMenuThreads,o=this.nativeIntl.formatMessage({messageId:tu,defaultMessage:nu}),s=this.nativeIntl.formatMessage({messageId:$l,defaultMessage:eu}),c=bX({label:this.nativeIntl.formatMessage({messageId:Gl,defaultMessage:Kl}),moreLabel:s,threads:n,projectlessLabel:o,onOpenThread:this.onTrayMenuOpenRecentThread}),l=bX({label:this.nativeIntl.formatMessage({messageId:Yl,defaultMessage:Xl}),moreLabel:s,threads:r,projectlessLabel:o,onOpenThread:this.onTrayMenuOpenRecentThread}),u=bX({label:this.nativeIntl.formatMessage({messageId:Ul,defaultMessage:Wl}),moreLabel:s,threads:e,projectlessLabel:o,onOpenThread:this.onTrayMenuOpenRecentThread}),d=bX({label:this.nativeIntl.formatMessage({messageId:ql,defaultMessage:Jl}),moreLabel:s,threads:t,projectlessLabel:o,onOpenThread:this.onTrayMenuOpenRecentThread}),f=process.platform!==`darwin`||i.length===0?[]:[{label:this.nativeIntl.formatMessage({messageId:Zl,defaultMessage:Ql}),enabled:!1},...i.map(({label:e})=>({label:e,enabled:!1}))],p=this.getChronicleSidecarControlState?.(),m=p?.enabled===!0?{label:vX(p),enabled:yX(p),click:async e=>{if(this.toggleChronicleSidecar==null)return;e.enabled=!1;let t=null;try{t=await this.toggleChronicleSidecar(),this.updateChronicleTrayIcon(t),e.label=vX(t)}finally{e.enabled=t==null?!0:yX(t)}}}:null,h=[c,l,u,d,f].filter(e=>e.length>0).flatMap((e,t)=>t===0?e:[{type:`separator`},...e]);return[...h,...h.length>0?[{type:`separator`}]:[],{label:this.nativeIntl.formatMessage({messageId:Vl,defaultMessage:Hl}),click:()=>{this.onTrayMenuOpenNewThread()}},...m==null?[]:[m],{type:`separator`},{label:this.nativeIntl.formatMessage({messageId:zl,defaultMessage:Bl,values:{appName:this.appName}}),click:()=>{this.onTrayMenuOpenMainWindow()}},{type:`separator`},{label:SX(this.appName),click:()=>{a.app.quit()}}]}updateChronicleTrayIcon(e=this.getChronicleSidecarControlState?.()){if(this.trayIcons.chronicleRunningIcon==null)return;let t=e?.running===!0?`chronicle-running`:`default`;t!==this.chronicleTrayIconState&&(this.chronicleTrayIconState=t,this.tray.setImage(t===`chronicle-running`?this.trayIcons.chronicleRunningIcon:this.trayIcons.defaultIcon))}};function vX(e){switch(e.state){case`disabled`:case`stopped`:return`Resume Chronicle`;case`running`:case`restarting`:return`Pause Chronicle`;case`starting`:return`Starting Chronicle...`;case`stopping`:return`Stopping Chronicle...`}}function yX(e){return e.state!==`starting`&&e.state!==`stopping`}function bX({label:e,moreLabel:t,threads:n,projectlessLabel:r,onOpenThread:i}){if(n.length===0)return[];let a=n.slice(0,mX),o=n.slice(mX);return[{label:e,enabled:!1},...a.map(e=>xX({thread:e,projectlessLabel:r,onOpenThread:i})),...o.length>0?[{label:t,submenu:o.map(e=>xX({thread:e,projectlessLabel:r,onOpenThread:i}))}]:[]]}function xX({thread:e,projectlessLabel:t,onOpenThread:n}){let r=Array.from(e.title);return{label:r.length<=hX?e.title:`${r.slice(0,hX-1).join(``).trimEnd()}…`,sublabel:e.isProjectless?t:e.projectLabel,click:()=>{n(e.path)}}}function SX(e){let t=a.Menu.buildFromTemplate([{role:`quit`}]);return(Array.isArray(t)?t:t.items)[0]?.label??`Quit ${e}`}var CX=6e4,wX=new Map,TX=t.Ci(`mode`,[t.Oi({mode:t.Ti(`create`)}),t.Oi({mode:t.Ti(`edit`),commentId:t.ji()}),t.Oi({mode:t.Ti(`design`),groupId:t.ji()})]),EX=t.Oi({x:t.Di(),y:t.Di(),width:t.Di(),height:t.Di()}),DX=t.Oi({x:t.Di(),y:t.Di()}),OX=t.Oi({provider:t.Ti(`google-docs`),kind:t.Ti(`google-docs`),documentId:t.ji(),tabId:t.ji().optional(),documentTitle:t.ji().optional(),selectedText:t.ji().optional(),visibleText:t.ji().optional()}),kX=t.Oi({pageUrl:t.ji(),frameUrl:t.ji().nullable(),title:t.ji(),elementPath:t.ji(),point:t.Oi({xPercent:t.Di(),y:t.Di()}),rect:EX,isFixed:t.xi(),framePath:t.bi(t.ji()),documentContext:OX.optional(),scrollContainers:t.bi(t.Oi({selector:t.ji(),scrollLeft:t.Di(),scrollTop:t.Di()})).optional()}),AX=t.Ci(`kind`,[kX.extend({kind:t.Ti(`element`),role:t.ji().nullable(),name:t.ji().nullable(),selector:t.ji().nullable(),nearbyText:t.ji().nullable()}),kX.extend({kind:t.Ti(`region`),role:t.yi(),name:t.yi(),selector:t.yi(),nearbyText:t.yi()})]),jX=t.Oi({anchor:AX,cardViewportRect:EX.optional(),viewportRect:EX.nullable(),viewportPoint:DX,viewportSize:t.Oi({width:t.Di(),height:t.Di()}).optional()}),MX=t.Oi({property:t.ji(),value:t.ji(),previousValue:t.ji(),placeholderValue:t.ji().optional()}),NX=t.Oi({value:t.ji(),previousValue:t.ji()}),PX=t.Oi({id:t.ji(),anchor:AX,declarations:t.bi(MX),draftAttribute:t.ji(),markerViewportPoint:DX.optional(),provenance:t.bi(t.Oi({property:t.ji(),selectorText:t.ji().optional(),sourceUrl:t.ji().optional(),sourceLine:t.Di().optional(),sourceColumn:t.Di().optional()})),selector:t.ji().nullable(),targetLabel:t.ji(),text:NX.optional(),viewportSize:t.Oi({width:t.Di(),height:t.Di()}).optional()}),FX=PX.extend({createdAt:t.ji(),updatedAt:t.ji(),status:t.Mi([t.Ti(`current`),t.Ti(`queued`)])}),IX=t.Ci(`type`,[t.Oi({type:t.Ti(`browser-sidebar-runtime-close-comment-preview`),commentId:t.ji()}),t.Oi({type:t.Ti(`browser-sidebar-runtime-comment-screenshot-ready`),commentId:t.ji(),annotationViewportRect:EX.nullable().optional(),markerViewportPoint:DX.optional(),skipScreenshotCapture:t.xi().optional()}),t.Oi({type:t.Ti(`browser-sidebar-runtime-exit-comment-mode`)}),t.Oi({type:t.Ti(`browser-sidebar-runtime-design-modifier-state`),pressed:t.xi()}),t.Oi({type:t.Ti(`browser-sidebar-runtime-focus-editor`)}),t.Oi({type:t.Ti(`browser-sidebar-runtime-image-drag-ended`)}),t.Oi({type:t.Ti(`browser-sidebar-runtime-image-drag-started`),sourceUrl:t.ji()}),t.Oi({type:t.Ti(`browser-sidebar-runtime-mouse-navigation`),direction:t.Mi([t.Ti(`back`),t.Ti(`forward`)])}),t.Oi({type:t.Ti(`browser-sidebar-runtime-open-comment-preview`),commentId:t.ji(),anchorState:jX}),t.Oi({type:t.Ti(`browser-sidebar-runtime-open-editor`),target:TX,anchorState:jX,designEditorState:PX.optional(),wantsScreenshot:t.xi().optional()}),t.Oi({type:t.Ti(`browser-sidebar-runtime-open-design-editor`),anchorState:jX,designEditorState:PX,designChange:FX.optional()}),t.Oi({type:t.Ti(`browser-sidebar-runtime-update-anchor`),target:TX,anchorState:jX.nullable()})]);function LX(){let e=!1,t=null,n=!1;return{allowQuitTemporarilyForUpdateInstall:r=>{e=r?.allowWithoutPrompt??!0,n=r?.skipDrainBeforeQuit??!1,t&&clearTimeout(t),t=setTimeout(()=>{e=!1,n=!1,t=null},6e4),t.unref()},canQuitWithoutPrompt:()=>e,markQuitApproved:()=>{e=!0},shouldSkipDrainBeforeQuit:()=>n}}function RX({hotkeyWindowLifecycleManager:e,globalDictationLifecycleManager:t,flushAndDisposeContext:n,disposables:r}){e.dispose(),t.dispose(),n(),r.dispose()}function zX({desktopSentry:e,hotkeyWindowLifecycleManager:r,globalDictationLifecycleManager:i,codexHome:o,nativeContextMenuIconSearchRoots:s,getContextForWebContents:c,getPrimaryWindow:l,showPrimaryWindow:u,ensureWindow:d,createFreshWindow:f,setDesktopFeatureAvailability:p,restoreAvatarOverlayOpenState:m,reloadBundledPlugins:h,setMacMenuBarEnabled:g,navigateToRoute:_,getDockMenuController:v,getTrayController:y,isTrustedIpcEvent:b}){dX(s,b),sX(b),a.ipcMain.handle(`codex_desktop:control-window`,async(e,t)=>{if(!b(e))return;let n=a.BrowserWindow.fromWebContents(e.sender);if(!n||n.isDestroyed())return;switch(t?.action){case`minimize`:n.minimize();return;case`maximize`:n.isMaximized()?n.unmaximize():n.maximize();return;case`close`:n.close();return}});function linuxSerializeMenuItems(e,t){let n=[];if(!e)return n;for(let r=0;r0&&(s.submenu=linuxSerializeMenuItems(i.submenu,o)),n.push(s)}return n}function linuxMenuItemAtPath(e,t){let n=t.split(`.`).map(Number),r=e;for(let e=0;e{if(!b(e))return{items:[]};let n=a.Menu.getApplicationMenu()?.getMenuItemById(t?.menuId)?.submenu;return{items:n?linuxSerializeMenuItems(n,``):[]}}),a.ipcMain.handle(`codex_desktop:click-application-menu-item`,async(e,t)=>{if(!b(e))return;let n=a.Menu.getApplicationMenu()?.getMenuItemById(t?.menuId)?.submenu,r=linuxMenuItemAtPath(n,t?.path);r&&r.enabled!==!1&&typeof r.click==`function`&&r.click()});let x=!1;a.ipcMain.handle(sl,async(e,o)=>{if(!b(e))return;if(o.type===`electron-avatar-overlay-restore-ready`){x||(x=!0,await m(e.sender));return}if(o.type===`electron-desktop-features-changed`){c(e.sender)?.setChronicleConfig(o.codexChronicleConfig),p({ambientSuggestions:o.ambientSuggestions,appshotsEnabled:o.appshotsEnabled,inAppBrowserUse:o.inAppBrowserUse,inAppBrowserUseAllowed:o.inAppBrowserUseAllowed,browserPane:o.browserPane,externalBrowserUse:o.externalBrowserUse,externalBrowserUseAllowed:o.externalBrowserUseAllowed,computerUse:o.computerUse,computerUseNodeRepl:o.computerUseNodeRepl,sites:o.sites,control:o.control,dil:o.dil,multiBrowserTabs:o.multiBrowserTabs,multiWindow:o.multiWindow,processManager:o.processManager});return}if(o.type===`mac-menu-bar-enabled-changed`){await g(o.enabled);return}if(o.type===`reload-bundled-plugins`){await h?.();return}if(o.type===`open-current-main-window`||o.type===`open-in-main-window`){let e=o.type===`open-current-main-window`?null:o.path;if(e!=null&&!t.it(e))return;r.hide();let n=l(),i=n!=null||e==null?await d():await f(e);i&&(o.type===`open-current-main-window`&&o.stealFocus===!0?u({stealFocus:!0}):(i.isMinimized()&&i.restore(),i.show(),i.focus()),n!=null&&e!=null&&_(i,e));return}if(o.type===`open-in-new-window`){if(!t.it(o.path))return;r.hide();let e=await f(o.path);e&&(e.isMinimized()&&e.restore(),e.show(),e.focus());return}if(o.type===`show-settings`){r.hide();let e=await d();if(!e)return;e.isMinimized()&&e.restore(),e.show(),e.focus(),_(e,`/settings/${o.section}`);return}if(o.type===`quit-app`){a.app.quit();return}if(gX(o)){await Promise.all([y()?.handleMessage(o),v?.()?.handleMessage(o)]);return}if(await i.handleMessage(e,o))return;let s=c(e.sender);if(!s){n.Lr().warning(`Message received for unknown window context`);return}await s.handleMessage(e.sender,o)}),a.ipcMain.handle(cl,async(e,t)=>{let r=IX.safeParse(t);if(!r.success){n.Lr().warning(`Invalid browser sidebar runtime message received`);return}let i=a.BrowserWindow.fromWebContents(e.sender);if(i==null){n.Lr().warning(`Browser sidebar runtime message received without owner window`);return}let o=c(i.webContents);if(o==null){n.Lr().warning(`Browser sidebar runtime message received for unknown window context`);return}await o.handleMessage(e.sender,r.data)}),a.ipcMain.handle(vl,async(e,t)=>b(e)?n.Dt({codexHome:o,params:t}):null),a.ipcMain.handle(bl,t=>{if(!b(t))return;let n=Error(`Desktop Sentry test error (debug button)`);e.captureException(n,{tags:{trigger:`debug-button`}})}),a.ipcMain.on(xl,e=>{if(!b(e))return;let[t]=e.ports,n=c(e.sender)?.createAppHost(e.sender);fX(t,n)})}function BX({buildFlavor:e,getContextForWebContents:t,isTrustedIpcEvent:n,usesOwlAppShell:i}){a.ipcMain.on(pl,e=>{if(!n(e)){e.returnValue=null;return}e.returnValue=r.A}),a.ipcMain.on(ml,t=>{if(!n(t)){t.returnValue=null;return}t.returnValue=e}),a.ipcMain.on(hl,e=>{if(!n(e)){e.returnValue=!1;return}e.returnValue=i}),a.ipcMain.on(_l,e=>{if(!n(e)){e.returnValue={};return}e.returnValue=t(e.sender)?.getSharedObjectSnapshot()??{}})}function VX({isWindows:e,disableQuitConfirmationPrompt:t,quitState:r,windows:i,applicationMenuManager:o,ensureWindow:s,hotkeyWindowLifecycleManager:c,globalDictationLifecycleManager:l,globalState:u,settingsStore:d,flushAndDisposeContext:f,disposables:p,appEvent:m,errorReporter:h}){let g=!1,_=!1;a.app.on(`window-all-closed`,()=>{(process.platform===`darwin`&&!a.app.isPackaged||process.platform!==`darwin`&&!e)&&a.app.quit()}),a.app.on(`before-quit`,o=>{if(el()){o.preventDefault();return}let s=nK(),c=n.Xn().some(e=>e.status===`ACTIVE`);if(e||r.canQuitWithoutPrompt()||t||!s&&!c){_=!0,i.markAppQuitting();return}let l=a.app.getName();if(a.dialog.showMessageBoxSync({type:`warning`,buttons:[`Quit`,`Cancel`],defaultId:0,cancelId:1,noLink:!0,title:`Quit ${l}?`,message:`Quit ${l}?`,detail:HX({hasInProgressLocalConversation:s,hasEnabledAutomations:c})})!==0){o.preventDefault();return}r.markQuitApproved(),_=!0,i.markAppQuitting()}),a.app.on(`child-process-gone`,(e,t)=>{if(t.reason!==`clean-exit`){if(UX(t)){WX(t);return}h.reportFatal(Error(`Child process gone (${t.type})`),{tags:{errorType:`child-process-gone`,processType:t.type,reason:t.reason},extra:{exitCode:t.exitCode,name:t.name,serviceName:t.serviceName}})}}),a.app.on(`activate`,()=>{_||(i.showLastActivePrimaryWindow()||s(),o.refresh())}),a.app.on(`browser-window-blur`,()=>{a.BrowserWindow.getFocusedWindow()??m.emit(`background`)}),a.app.on(`browser-window-focus`,()=>{m.emit(`foreground`),o.refresh()}),a.app.on(`will-quit`,e=>{if(_=!0,!g){if(r.shouldSkipDrainBeforeQuit()){RX({hotkeyWindowLifecycleManager:c,globalDictationLifecycleManager:l,flushAndDisposeContext:f,disposables:p});return}e.preventDefault(),g=!0,c.dispose(),l.dispose(),Promise.all([u.flush(),d.flush()]).finally(()=>{f(),p.dispose(),a.app.quit()})}})}function HX({hasInProgressLocalConversation:e,hasEnabledAutomations:t}){return e&&t?`Active local threads on this machine will be interrupted and enabled automations won't run while Codex is closed`:e?`Active local threads on this machine will be interrupted`:`Enabled automations won't run while Codex is closed`}function UX(e){return e.type===`GPU`||e.type===`Utility`&&e.serviceName===`audio.mojom.AudioService`}function WX(e){let t=`${e.type}:${e.serviceName??e.name??``}:${e.reason}`,r=Date.now(),i=wX.get(t);i!=null&&r-ie.settingsStore.getEffective(t.w.integratedTerminalShell.key),lu.terminal_command??null,async r=>{let a=await e.gitManager.getWorktreeRepository(t.mn(r),i);return a==null?null:n.rt(a)},e=>this.getHostConfigForHostId(e),e=>this.appServerConnectionRegistry.getMaybeConnection(e));this.remoteConnectionsHandler=new aY(this.appState,this.sharedObjectRepository,I,this.appServerConnectionRegistry,{desktopOriginator:e.desktopOriginator,devApiBaseUrl:e.devApiBaseUrl,prodApiBaseUrl:e.prodApiBaseUrl},i,this.remoteControlDeviceKeyClient,this.getHostConfigForHostId.bind(this),this.getAppServerClient.bind(this),this.createAndRegisterRemoteConnection.bind(this),this.disposeRemoteConnection.bind(this));let o=iJ({appServerConnectionRegistry:this.appServerConnectionRegistry,errorReporter:e.errorReporter,globalState:this.scopedState,hostId:I,sharedObjectRepository:this.sharedObjectRepository,windowManager:e.windowManager});this.primaryRuntimeService=o.rpc,this.fetchHandler=new hj(this.scopedState,e=>this.getRegisteredWindowIpcClient(e),this.appServerConnectionRegistry,e.gitManager,i,this.remoteConnectionsHandler,e.hotkeyWindowLifecycleManager,e.windowManager,a,o.isWorkspaceDependenciesFeatureEnabled,e=>this.getAppServerClient(e),e=>this.messageHandler.getWorktreeService(e),e.requestGitWorker,this.sharedObjectRepository,e.errorReporter,e.repoRoot,e.globalDictationHotkeyController,()=>{this.messageHandler.getBrowserSidebarManager().reloadOpenPages()},e.refreshApplicationMenu,e.requestComputerUseCaptureWorker,e.subscribeComputerUseCaptureWorkerEvent,()=>{this.messageHandler.getBrowserSidebarManager().refreshOwnerCommandAccelerators()},e.settingsStore),this.disposables.add(()=>this.fetchHandler.dispose()),this.disposables.add(o.startUpdatePolling());let s=Jj(this.scopedState);this.disposables.add(i.registerInternalNotificationHandler(e=>{e.method===`account/updated`&&e.params?.authMode==null&&s.clear()}));let c=new rM(this.fetchHandler,{desktopOriginator:e.desktopOriginator,devApiBaseUrl:e.devApiBaseUrl,integrityStateStore:s,messageChannel:e.messageChannel,appServerConnectionRegistry:this.appServerConnectionRegistry,prodApiBaseUrl:e.prodApiBaseUrl}),l=new wq({buildFlavor:e.buildFlavor,gitWorkerInvocationSampler:e.gitWorkerInvocationSampler});this.messageHandler=new gq(I,lu,i,e.windowManager,e.filePreviewManager,e.avatarOverlayManager,this.appServerConnectionRegistry,c,this.scopedState,this.sharedObjectRepository,a,e.gitManager,e.requestGitWorker,e.desktopNotificationManager,e.errorReporter,e.desktopSentry,e.updateWorkerSentryUser,e=>this.getRegisteredWindowIpcClient(e),e.inboxManager,e.datadogLogger,e.maxLogLevel,e.buildFlavor,e.sparkleManager,e.subscribeGitWorkerEvent,l,e=>this.getHostConfigForHostId(e),e.hasActiveComputerUseTurn,e.settingsStore),this.disposables.add(this.sharedObjectRepository.addSubscriber(e=>{if(e===`remote_connections`||e===`remote_control_connections`){this.remoteConnectionsHandler.reconcileRemoteConnections(this.getAllRemoteConnections());return}if(e===`local_remote_control_environment_id`||e===`local_remote_control_installation_id`){let e=this.sharedObjectRepository.get(`local_remote_control_environment_id`),t=this.sharedObjectRepository.get(`local_remote_control_installation_id`);e!=null&&this.appState.set(Ii,e),t!=null&&this.appState.set(Li,t),this.remoteConnectionsHandler.handleLocalRemoteControlIdentityChanged()}})),this.initialRemoteConnectionsRefresh=Promise.all([this.remoteConnectionsHandler.refreshRemoteConnections(),this.remoteConnectionsHandler.refreshLocalRemoteControlClientId()]).then(()=>void 0).catch(e=>{nX.warning(`Failed to refresh remote connections`,{safe:{},sensitive:{error:e}})})}createAppHost(e){return new Rm({debug:new L_({debugWindowManager:this.options.windowManager.debugWindowManager,getBrowserSnapshot:()=>this.messageHandler.getBrowserSidebarManager().getDebugSnapshot(),openBrowserTabOwner:e=>this.messageHandler.getBrowserSidebarManager().openDebugTabOwner(e),origin:e}),hotkeyWindowHotkeys:this.options.hotkeyWindowLifecycleManager.rpcFor(e),appshotHotkeys:this.options.appshotHotkeyController.rpc,customAvatars:this.createCustomAvatarsService(),fileAttachments:{countFolderFiles:({folderPath:e,hostId:t})=>n.Et(e,this.getAppServerClient(t))},owlFeatures:r.x(),primaryRuntime:this.primaryRuntimeService,chromeNativeHost:this.createChromeNativeHostService(),projectWritableRoots:this.messageHandler.createProjectWritableRootsService(e),systemPermissions:LY(e),threadArchive:this.createThreadArchiveService(),codexMicro:this.createCodexMicroHostService(e),notifications:new NY(this.options.windowManager,e,this.options.desktopNotificationManager)})}async applyCodexAppConfigFromDisk(e){let t=await Ac(e);return t.status===`loaded`?{status:`applied`,configPath:t.configPath,result:await this.applyCodexAppConfig(t.config)}:t}getCodexMicroService(){return this.codexMicroService==null?(this.codexMicroServicePromise??=Promise.resolve().then(()=>require(`./codex-micro-service-CYwSISMZ.js`)).then(({CodexMicroService:e})=>{let t=new e({onDeviceStateChanged:e=>{this.options.windowManager.sendMessageToAllWindows({type:`codex-micro-device-state-changed`,state:e})},onHidEvent:e=>{let t=this.options.windowManager.getPrimaryWindow();t!=null&&this.options.windowManager.sendMessageToWindow(t,{type:`codex-micro-hid-event`,event:e})},onJoystickEvent:e=>{let t=this.options.windowManager.getPrimaryWindow();t!=null&&this.options.windowManager.sendMessageToWindow(t,{type:`codex-micro-joystick-event`,event:e})}});return this.codexMicroService=t,this.disposables.add(()=>{t.dispose()}),t}).finally(()=>{this.codexMicroServicePromise=null}),this.codexMicroServicePromise):Promise.resolve(this.codexMicroService)}createCustomAvatarsService(){return{load:()=>n.Rt({appServerClient:this.getAppServerClient(),preferWsl:!!process.env.WSL_DISTRO_NAME})}}createChromeNativeHostService(){return y_({devRuntimeRepoRoot:process.env.NODE_ENV===`development`?this.options.repoRoot:void 0,getCodexHome:e=>this.getAppServerClient(e).codexHome(),getHostConfig:e=>this.getHostConfigForHostId(e)})}createThreadArchiveService(){return{archiveInactiveThread:async({hostId:e,threadId:r})=>{let i=this.getAppServerClient(e);if(t.un(i.hostConfig))throw Error(`Archiving inactive chats is only supported locally`);let a=await n.rr({codexHome:await i.codexHome(),threadId:r});return a&&this.appServerConnectionRegistry.getConnection(e).handleArchivedThreadSideEffects(r),{success:a}}}}createCodexMicroHostService(e){return{getState:async()=>{let e=await this.getCodexMicroService();return e?.start(),e?.getState()??{status:`not-detected`,error:null}},getInputMonitoringPermissionStatus:async()=>jq(),openInputMonitoringSettings:async()=>{try{await a.shell.openExternal(rX)}catch(e){nX.error(`Open input monitoring settings failed`,{safe:{},sensitive:{error:e}})}},updateLighting:async t=>this.options.windowManager.getPrimaryWindow()?.webContents===e?await(await this.getCodexMicroService())?.updateLighting(t)??!1:!1}}async applyCodexAppConfig(e){await this.initialRemoteConnectionsRefresh;let n=c_({config:e,globalState:this.appState}),{remoteConnections:r}=await this.remoteConnectionsHandler.refreshRemoteConnections(),i=l_({config:e,globalState:this.appState,remoteConnections:r});return n&&i.changedGlobalStateKeys.unshift(t._r.CODEX_MANAGED_REMOTE_CONNECTIONS),i.changedGlobalStateKeys.includes(t._r.REMOTE_CONNECTION_AUTO_CONNECT_BY_HOST_ID)&&await this.remoteConnectionsHandler.refreshRemoteConnections(),i.changedGlobalStateKeys.length>0&&this.options.windowManager.sendMessageToAllWindows({type:`global-state-updated`,keys:i.changedGlobalStateKeys}),i.remoteProjectsChanged&&this.options.windowManager.sendMessageToAllWindows({type:`workspace-root-options-updated`}),this.remoteConnectionsHandler.connectRemoteConnectionsAndLogFailures(i.remoteConnectionHostIdsToConnect),i}registerWindow(e){let{webContents:t}=e,n=new eK(t);this.registeredWindows.set(t.id,n),t.once(`destroyed`,()=>{this.registeredWindows.delete(t.id)});for(let e of this.appServerConnectionRegistry.getAllHostIds())this.appServerConnectionRegistry.getConnection(e).registerWebviewWindow(n);this.registerIpcClientForWebContents(e.webContents)}handleMessage(e,t){return this.messageHandler.handleMessage(e,t)}getBrowserSidebarManager(){return this.messageHandler.getBrowserSidebarManager()}getBrowserSessionRegistry(){return this.messageHandler.getBrowserSessionRegistry()}flushTelemetry(){this.messageHandler.flushTelemetry()}dispose(){let e=this.appServerConnectionRegistry.getAllHostIds();this.messageHandler.dispose(),this.disposables.dispose();for(let t of e)this.appServerConnectionRegistry.getMaybeConnection(t)?.dispose(),this.appServerConnectionRegistry.removeConnection(t),this.appServerClients.delete(t);this.registeredWindows.clear();for(let{dispose:e}of this.ipcClientsByWebContentsId.values())e();this.ipcClientsByWebContentsId.clear()}getMessageHandler(){return this.messageHandler}getSharedObject(e){return this.sharedObjectRepository.get(e)}setChronicleConfig(e){this.sharedObjectRepository.set(`codex_chronicle_config`,e)}getSharedObjectSnapshot(){return this.sharedObjectRepository.getSnapshot()}getHostConfigForHostId(e){if(e===`local`)return lu;let t=this.getAllRemoteConnections().find(t=>t.hostId===e);if(!t)throw Error(`Host config for host ID ${e} not found`);return AY(t)}getAllRemoteConnections(){return[...this.sharedObjectRepository.get(`remote_connections`)??[],...this.sharedObjectRepository.get(`remote_control_connections`)??[]]}createAppServerConnection(e,i=lu,o=!1,s,c){let l={desktopOriginator:this.options.desktopOriginator,devApiBaseUrl:this.options.devApiBaseUrl,prodApiBaseUrl:this.options.prodApiBaseUrl},u=In({env:process.env,resourcesPath:process.resourcesPath}),d;if(t.ln(i)){if(s==null)throw Error(`Remote control transport requires a desktop app-server client for authentication.`);if(c==null)throw Error(`Remote control transport requires the remote-control device-key client.`);d=aX({transportKind:`remote-control`,hostConfig:i,repoRoot:this.options.repoRoot,resourcesPath:u,desktopApiOptions:l,desktopAuthAppServerClient:s,remoteControlDeviceKeyClient:c,globalState:this.appState})}else d=aX({transportKind:`standard`,hostConfig:i,repoRoot:this.options.repoRoot,resourcesPath:u,desktopApiOptions:l,globalState:this.appState});let f=this.options.hostProcess.getVersion(),p=new n.Tn(this.options.messageChannel,{buildFlavor:this.options.buildFlavor,clientInfo:{name:Tl,title:`Codex Desktop`,version:f},defaultServiceName:El,repoRoot:this.options.repoRoot,resourcesPath:u,errorReporter:this.options.errorReporter,sharedObjectRepository:this.sharedObjectRepository,hostId:e,hostConfig:i,onArchiveCleanup:async({conversationId:t,cwd:n,replacementOwnerThreadId:r,replacementOwnerCwd:i})=>{await this.messageHandler.getWorktreeService(e).handleArchiveCleanup({conversationId:t,cwd:n,replacementOwnerThreadId:r,replacementOwnerCwd:i})},transport:d,hostProcess:this.options.hostProcess,isOnline:()=>a.net.isOnline(),supportsAttestationRequests:xe,isMcpAppsDilEnabled:()=>Be().dil,beforeConnect:i.id===`local`?()=>dY({hostConfig:i}):void 0,ensureAuth:o,getRemoteConnectionMaxRetryAttempts:()=>this.appState.get(t._r.REMOTE_CONNECTION_MAX_RETRY_ATTEMPTS)??null});return p.registerInternalServerRequestHandler({methods:[`item/commandExecution/requestApproval`,`mcpServer/elicitation/request`],handler:t=>(this.messageHandler.revealWindowsReviewRequest(e,t),null)}),p.registerInternalServerRequestHandler({methods:[`attestation/generate`],handler:Ce({bundleIdentifier:r.D(this.options.buildFlavor),resourcesPath:u})}),p}createAndRegisterRemoteConnection(e){let t=AY(e),n=this.createAppServerConnection(e.hostId,t,!0,this.getLocalAppServerClient(),this.remoteControlDeviceKeyClient);this.appServerClients.set(e.hostId,n);for(let e of this.registeredWindows.values())n.registerWebviewWindow(e);return n}disposeRemoteConnection(e){let t=this.appServerConnectionRegistry.getMaybeConnection(e);t&&(t.dispose(),this.appServerConnectionRegistry.removeConnection(e),this.appServerClients.delete(e))}getLocalAppServerClient(){return this.appServerConnectionRegistry.getConnection(I)}getAppServerClient(e=I){let t=this.appServerClients.get(e);if(!t)throw Error(`App server client for host ID ${e} not found`);return t}registerIpcClientForWebContents(e){if(this.appServerConnectionRegistry.getConnection(`local`).getTransportKind()!==`stdio`||this.ipcClientsByWebContentsId.has(e.id))return;let t=new n.S(`desktop`,this.errorReporter),r=new n.Ln;r.add(t.addAnyBroadcastHandler(async t=>{let n={...t,type:`ipc-broadcast`};this.messageHandler.sendMessageToOrigin(e,n)}));let i=async t=>await this.messageHandler.getThreadRole(e,t.conversationId)===`owner`;r.add(t.addRequestHandler(`thread-follower-start-turn`,i,async t=>this.messageHandler.handleThreadFollowerStartTurnRequest(e,t))),r.add(t.addRequestHandler(`thread-follower-compact-thread`,i,async t=>this.messageHandler.handleThreadFollowerCompactThreadRequest(e,t))),r.add(t.addRequestHandler(`thread-follower-steer-turn`,i,async t=>this.messageHandler.handleThreadFollowerSteerTurnRequest(e,t))),r.add(t.addRequestHandler(`thread-follower-interrupt-turn`,i,async t=>this.messageHandler.handleThreadFollowerInterruptTurnRequest(e,t))),r.add(t.addRequestHandler(`thread-follower-update-thread-settings`,i,async t=>this.messageHandler.handleThreadFollowerUpdateThreadSettingsRequest(e,t))),r.add(t.addRequestHandler(`thread-follower-edit-last-user-turn`,i,async t=>this.messageHandler.handleThreadFollowerEditLastUserTurnRequest(e,t))),r.add(t.addRequestHandler(`thread-follower-command-approval-decision`,i,async t=>this.messageHandler.handleThreadFollowerCommandApprovalDecisionRequest(e,t))),r.add(t.addRequestHandler(`thread-follower-file-approval-decision`,i,async t=>this.messageHandler.handleThreadFollowerFileApprovalDecisionRequest(e,t))),r.add(t.addRequestHandler(`thread-follower-permissions-request-approval-response`,i,async t=>this.messageHandler.handleThreadFollowerPermissionsRequestApprovalResponseRequest(e,t))),r.add(t.addRequestHandler(`thread-follower-submit-user-input`,i,async t=>this.messageHandler.handleThreadFollowerSubmitUserInputRequest(e,t))),r.add(t.addRequestHandler(`thread-follower-submit-mcp-server-elicitation-response`,i,async t=>this.messageHandler.handleThreadFollowerSubmitMcpServerElicitationRequest(e,t))),r.add(t.addRequestHandler(`thread-follower-set-queued-follow-ups-state`,i,async t=>this.messageHandler.handleThreadFollowerSetQueuedFollowUpsStateRequest(e,t))),r.add(()=>t.dispose()),this.ipcClientsByWebContentsId.set(e.id,{client:t,dispose:()=>{r.dispose(),this.messageHandler.rejectPendingThreadFollowerActionRequestsForOrigin(e)}}),e.once(`destroyed`,()=>{this.disposeIpcClientForWebContents(e)})}disposeIpcClientForWebContents(e){let t=this.ipcClientsByWebContentsId.get(e.id);t&&(this.ipcClientsByWebContentsId.delete(e.id),t.dispose())}getRegisteredWindowIpcClient(e){return this.ipcClientsByWebContentsId.get(e.id)?.client??null}};function aX(e){let t=t_(e.hostConfig);if(t)return nX.info(`[ssh-websocket-v0] selected app-server transport`,{safe:{hostId:e.hostConfig.id}}),new e_(t);if(e.transportKind===`remote-control`)return new xh({hostConfig:e.hostConfig,appServerClient:e.desktopAuthAppServerClient,deviceKeyClient:e.remoteControlDeviceKeyClient,desktopApiOptions:e.desktopApiOptions,globalState:e.globalState});let r=n.pn(e.hostConfig);return r?new n.fn({hostConfig:e.hostConfig,websocketUrl:r}):new n.Dn({hostConfig:e.hostConfig,repoRoot:e.repoRoot,resourcesPath:e.resourcesPath,defaultOriginator:e.defaultOriginator})}function oX({app:e,globalState:t,settingsStore:n,windowServices:i,repoRoot:a,errorReporter:o,desktopSentry:s,datadogLogger:c,maxLogLevel:l,buildFlavor:u,sparkleManager:d,filePreviewManager:f,avatarOverlayManager:p,hotkeyWindowLifecycleManager:m,hasActiveComputerUseTurn:h,globalDictationHotkeyController:g,appshotHotkeyController:_,gitManager:v,requestComputerUseCaptureWorker:y,requestGitWorker:b,refreshApplicationMenu:x,subscribeComputerUseCaptureWorkerEvent:S,subscribeGitWorkerEvent:C,gitWorkerInvocationSampler:w,updateWorkerSentryUser:T,appEvent:E,onCompletedThreadsChanged:D}){let O=new kp(e),k=new Op({platform:process.platform,onCompletedThreadsChanged:D}),A=new Ap({inboxItemsChanged:e=>{i.sendMessageToAllWindows({type:e})}}),j=()=>{};r.l(t,lu.default_workspaces);let M=new iX({hostProcess:O,appGlobalState:t,settingsStore:n,windowManager:i.windowManager,globalState:t,repoRoot:a,errorReporter:o,desktopSentry:s,desktopNotificationManager:k,updateWorkerSentryUser:T,gitManager:v,inboxManager:A,datadogLogger:c,maxLogLevel:l,buildFlavor:u,sparkleManager:d,gitWorkerInvocationSampler:w,desktopOriginator:Tl,devApiBaseUrl:wl,prodApiBaseUrl:Cl,messageChannel:F,filePreviewManager:f,avatarOverlayManager:p,hotkeyWindowLifecycleManager:m,hasActiveComputerUseTurn:h,globalDictationHotkeyController:g,refreshApplicationMenu:x,appshotHotkeyController:_,requestComputerUseCaptureWorker:y,requestGitWorker:b,subscribeComputerUseCaptureWorkerEvent:S,subscribeGitWorkerEvent:C});return M.getMessageHandler().setOnBrowserSidebarStateChanged(j),M.appServerConnectionRegistry.getConnection(I).registerInternalNotificationHandler(e=>{if(e.method===`account/login/completed`){i.windowManager.showPrimaryWindow({stealFocus:!0});return}e.method===`turn/completed`&&E.emit(`turnComplete`)}),i.setWindowContext(M),{desktopNotificationManager:k,getWindowContext:()=>M,getElectronMessageHandlerForWindow:e=>{let t=i.getContextForWebContents(e.webContents);return t?t.getMessageHandler():null},getAppServerClientForHost:({hostId:e})=>{try{return M.getAppServerClient(e)}catch{return null}},getWorktreeCleanupInputsForHost:async({hostKey:r,threadIds:i})=>{let a=M.appServerConnectionRegistry.getMaybeConnection(r);return{threadMetadataById:a?await GK(a,i):Object.fromEntries(i.map(e=>[e,{updatedAtMs:Date.now(),isInProgress:!0,cwd:null,readFailed:!0}])),pinnedThreadIds:KK(t),protectPreMigrationOwnerlessWorktrees:ZK(t),autoCleanupEnabled:XK(n,t,e.isPackaged),keepCount:YK(n)}},setOnBrowserSidebarStateChanged:e=>{j=e,M.getMessageHandler().setOnBrowserSidebarStateChanged(j)},flushAndDisposeContext:()=>{M.dispose(),M.flushTelemetry()}}}function sX(e){return a.ipcMain.handle(fl,async(t,n)=>{if(!e(t))return;let r=a.BrowserWindow.fromWebContents(t.sender),i=a.Menu.getApplicationMenu()?.getMenuItemById(n.menuId)?.submenu;if(i)return new Promise(e=>{i.popup({window:r??void 0,x:Math.round(n.x),y:Math.round(n.y),callback:e})})}),()=>a.ipcMain.removeHandler(fl)}var cX=16;function lX(e){let{width:t,height:n}=e.getSize();return!t||!n||t<=cX&&n<=cX?e:e.resize({width:cX,height:cX,quality:`best`})}function uX(e,t){if(e)try{if(e.startsWith(`data:`))return lX(a.nativeImage.createFromDataURL(e));if(e.startsWith(`file://`))return lX(a.nativeImage.createFromPath((0,x.fileURLToPath)(e)));if(e.startsWith(`/`))return lX(a.nativeImage.createFromPath(e));for(let n of t){let t=new URL(e,`file://${n.endsWith(`/`)?n:`${n}/`}`).pathname;if((0,l.existsSync)(t)){let e=a.nativeImage.createFromPath(t);if(!e.isEmpty())return lX(e)}}}catch{}}function dX(e,t){return a.ipcMain.handle(dl,async(n,r)=>{if(!t(n))return{id:null};let i=a.BrowserWindow.fromWebContents(n.sender);return new Promise(t=>{let n=!1,o=e=>{n||(n=!0,t({id:e}))},s=t=>t.map(t=>t.type===`separator`?{type:`separator`}:{id:t.id,label:t.label,role:t.role,enabled:t.enabled??!0,icon:uX(t.icon,e),toolTip:t.toolTip,click:()=>o(t.id),submenu:t.submenu?s(t.submenu):void 0});a.Menu.buildFromTemplate(s(r)).popup({window:i??void 0,callback:()=>o(null)})})}),()=>a.ipcMain.removeHandler(dl)}function fX(e,t,n){return new Im(new pX(e),t,n).getRemoteMain()}var pX=class{constructor(e){this.#e=e,e.start(),e.on(`message`,e=>{this.#i||(e.data==null?this.#a(Error(`Peer closed MessagePort connection.`)):typeof e.data==`string`?this.#t?(this.#t(e.data),this.#t=void 0,this.#n=void 0):this.#r.push(e.data):this.#a(TypeError(`Received non-string message from MessagePort.`)))}),e.on(`close`,()=>{this.#a(Error(`MessagePort message error.`))})}#e;#t;#n;#r=[];#i;async send(e){if(this.#i)throw this.#i;this.#e.postMessage(e)}async receive(){if(this.#r.length>0){let e=this.#r.shift();if(e!=null)return e}if(this.#i)throw this.#i;return new Promise((e,t)=>{this.#t=e,this.#n=t})}abort(e){try{this.#e.postMessage(null)}catch{}this.#e.close(),this.#i||=e}#a(e){this.#i||(this.#i=e,this.#n&&=(this.#n(e),this.#t=void 0,void 0))}},mX=3,hX=35;function gX(e){return e.type===`tray-menu-threads-changed`}var _X=class{nativeTrayClickSuppressionReason=null;clearNativeTrayClickSuppressionTimeout=null;chronicleTrayIconRefreshInterval=null;chronicleTrayIconState=`default`;isNativeTrayMenuOpen=!1;trayMenuThreads={runningThreads:[],unreadThreads:[],pinnedThreads:[],recentThreads:[],usageLimits:[]};constructor(e,t,n,r,i,a,o,s,c,l){if(this.tray=e,this.onTrayButtonClick=t,this.onTrayMenuOpenMainWindow=n,this.onTrayMenuOpenNewThread=r,this.onTrayMenuOpenRecentThread=i,this.getChronicleSidecarControlState=a,this.toggleChronicleSidecar=o,this.trayIcons=s,this.nativeIntl=c,this.appName=l,process.platform===`darwin`){this.tray.on(`mouse-down`,()=>{if(this.clearPendingNativeTrayClickSuppression(),this.isNativeTrayMenuOpen){this.nativeTrayClickSuppressionReason=`close`;return}this.nativeTrayClickSuppressionReason=`open`,this.openNativeTrayMenu()}),this.tray.on(`click`,()=>{this.consumeIgnoredNativeTrayClick()||this.openNativeTrayMenu()}),this.tray.on(`right-click`,()=>{this.consumeIgnoredNativeTrayClick()||this.openNativeTrayMenu()}),this.getChronicleSidecarControlState!=null&&this.trayIcons.chronicleRunningIcon!=null&&(this.updateChronicleTrayIcon(),this.chronicleTrayIconRefreshInterval=setInterval(()=>{this.updateChronicleTrayIcon()},1e3),this.chronicleTrayIconRefreshInterval.unref?.());return}this.tray.on(`click`,()=>{this.onTrayButtonClick()}),this.tray.on(`right-click`,()=>{this.openNativeTrayMenu()})}destroy(){this.chronicleTrayIconRefreshInterval!=null&&(clearInterval(this.chronicleTrayIconRefreshInterval),this.chronicleTrayIconRefreshInterval=null),this.tray.destroy()}async handleMessage(e){switch(e.type){case`tray-menu-threads-changed`:this.trayMenuThreads=e.trayMenuThreads;return}}consumeIgnoredNativeTrayClick(){return this.nativeTrayClickSuppressionReason==null?!1:(this.clearNativeTrayClickSuppression(),!0)}openNativeTrayMenu(){this.updateChronicleTrayIcon();let e=a.Menu.buildFromTemplate(this.getNativeTrayMenuItems());e.once(`menu-will-show`,()=>{this.isNativeTrayMenuOpen=!0}),e.once(`menu-will-close`,()=>{this.isNativeTrayMenuOpen=!1,this.handleNativeTrayMenuClosed()}),this.tray.popUpContextMenu(e)}handleNativeTrayMenuClosed(){if(this.nativeTrayClickSuppressionReason!==`close`){this.clearNativeTrayClickSuppression();return}this.clearPendingNativeTrayClickSuppression(),this.clearNativeTrayClickSuppressionTimeout=setTimeout(()=>{this.nativeTrayClickSuppressionReason===`close`&&this.clearNativeTrayClickSuppression()},0),this.clearNativeTrayClickSuppressionTimeout.unref?.()}clearPendingNativeTrayClickSuppression(){this.clearNativeTrayClickSuppressionTimeout!=null&&(clearTimeout(this.clearNativeTrayClickSuppressionTimeout),this.clearNativeTrayClickSuppressionTimeout=null)}clearNativeTrayClickSuppression(){this.clearPendingNativeTrayClickSuppression(),this.nativeTrayClickSuppressionReason=null}getNativeTrayMenuItems(){let{pinnedThreads:e,recentThreads:t,runningThreads:n,unreadThreads:r,usageLimits:i}=this.trayMenuThreads,o=this.nativeIntl.formatMessage({messageId:tu,defaultMessage:nu}),s=this.nativeIntl.formatMessage({messageId:$l,defaultMessage:eu}),c=bX({label:this.nativeIntl.formatMessage({messageId:Gl,defaultMessage:Kl}),moreLabel:s,threads:n,projectlessLabel:o,onOpenThread:this.onTrayMenuOpenRecentThread}),l=bX({label:this.nativeIntl.formatMessage({messageId:Yl,defaultMessage:Xl}),moreLabel:s,threads:r,projectlessLabel:o,onOpenThread:this.onTrayMenuOpenRecentThread}),u=bX({label:this.nativeIntl.formatMessage({messageId:Ul,defaultMessage:Wl}),moreLabel:s,threads:e,projectlessLabel:o,onOpenThread:this.onTrayMenuOpenRecentThread}),d=bX({label:this.nativeIntl.formatMessage({messageId:ql,defaultMessage:Jl}),moreLabel:s,threads:t,projectlessLabel:o,onOpenThread:this.onTrayMenuOpenRecentThread}),f=process.platform!==`darwin`||i.length===0?[]:[{label:this.nativeIntl.formatMessage({messageId:Zl,defaultMessage:Ql}),enabled:!1},...i.map(({label:e})=>({label:e,enabled:!1}))],p=this.getChronicleSidecarControlState?.(),m=p?.enabled===!0?{label:vX(p),enabled:yX(p),click:async e=>{if(this.toggleChronicleSidecar==null)return;e.enabled=!1;let t=null;try{t=await this.toggleChronicleSidecar(),this.updateChronicleTrayIcon(t),e.label=vX(t)}finally{e.enabled=t==null?!0:yX(t)}}}:null,h=[c,l,u,d,f].filter(e=>e.length>0).flatMap((e,t)=>t===0?e:[{type:`separator`},...e]);return[...h,...h.length>0?[{type:`separator`}]:[],{label:this.nativeIntl.formatMessage({messageId:Vl,defaultMessage:Hl}),click:()=>{this.onTrayMenuOpenNewThread()}},...m==null?[]:[m],{type:`separator`},{label:this.nativeIntl.formatMessage({messageId:zl,defaultMessage:Bl,values:{appName:this.appName}}),click:()=>{this.onTrayMenuOpenMainWindow()}},{type:`separator`},{label:SX(this.appName),click:()=>{a.app.quit()}}]}updateChronicleTrayIcon(e=this.getChronicleSidecarControlState?.()){if(this.trayIcons.chronicleRunningIcon==null)return;let t=e?.running===!0?`chronicle-running`:`default`;t!==this.chronicleTrayIconState&&(this.chronicleTrayIconState=t,this.tray.setImage(t===`chronicle-running`?this.trayIcons.chronicleRunningIcon:this.trayIcons.defaultIcon))}};function vX(e){switch(e.state){case`disabled`:case`stopped`:return`Resume Chronicle`;case`running`:case`restarting`:return`Pause Chronicle`;case`starting`:return`Starting Chronicle...`;case`stopping`:return`Stopping Chronicle...`}}function yX(e){return e.state!==`starting`&&e.state!==`stopping`}function bX({label:e,moreLabel:t,threads:n,projectlessLabel:r,onOpenThread:i}){if(n.length===0)return[];let a=n.slice(0,mX),o=n.slice(mX);return[{label:e,enabled:!1},...a.map(e=>xX({thread:e,projectlessLabel:r,onOpenThread:i})),...o.length>0?[{label:t,submenu:o.map(e=>xX({thread:e,projectlessLabel:r,onOpenThread:i}))}]:[]]}function xX({thread:e,projectlessLabel:t,onOpenThread:n}){let r=Array.from(e.title);return{label:r.length<=hX?e.title:`${r.slice(0,hX-1).join(``).trimEnd()}…`,sublabel:e.isProjectless?t:e.projectLabel,click:()=>{n(e.path)}}}function SX(e){let t=a.Menu.buildFromTemplate([{role:`quit`}]);return(Array.isArray(t)?t:t.items)[0]?.label??`Quit ${e}`}var CX=6e4,wX=new Map,TX=t.Ci(`mode`,[t.Oi({mode:t.Ti(`create`)}),t.Oi({mode:t.Ti(`edit`),commentId:t.ji()}),t.Oi({mode:t.Ti(`design`),groupId:t.ji()})]),EX=t.Oi({x:t.Di(),y:t.Di(),width:t.Di(),height:t.Di()}),DX=t.Oi({x:t.Di(),y:t.Di()}),OX=t.Oi({provider:t.Ti(`google-docs`),kind:t.Ti(`google-docs`),documentId:t.ji(),tabId:t.ji().optional(),documentTitle:t.ji().optional(),selectedText:t.ji().optional(),visibleText:t.ji().optional()}),kX=t.Oi({pageUrl:t.ji(),frameUrl:t.ji().nullable(),title:t.ji(),elementPath:t.ji(),point:t.Oi({xPercent:t.Di(),y:t.Di()}),rect:EX,isFixed:t.xi(),framePath:t.bi(t.ji()),documentContext:OX.optional(),scrollContainers:t.bi(t.Oi({selector:t.ji(),scrollLeft:t.Di(),scrollTop:t.Di()})).optional()}),AX=t.Ci(`kind`,[kX.extend({kind:t.Ti(`element`),role:t.ji().nullable(),name:t.ji().nullable(),selector:t.ji().nullable(),nearbyText:t.ji().nullable()}),kX.extend({kind:t.Ti(`region`),role:t.yi(),name:t.yi(),selector:t.yi(),nearbyText:t.yi()})]),jX=t.Oi({anchor:AX,cardViewportRect:EX.optional(),viewportRect:EX.nullable(),viewportPoint:DX,viewportSize:t.Oi({width:t.Di(),height:t.Di()}).optional()}),MX=t.Oi({property:t.ji(),value:t.ji(),previousValue:t.ji(),placeholderValue:t.ji().optional()}),NX=t.Oi({value:t.ji(),previousValue:t.ji()}),PX=t.Oi({id:t.ji(),anchor:AX,declarations:t.bi(MX),draftAttribute:t.ji(),markerViewportPoint:DX.optional(),provenance:t.bi(t.Oi({property:t.ji(),selectorText:t.ji().optional(),sourceUrl:t.ji().optional(),sourceLine:t.Di().optional(),sourceColumn:t.Di().optional()})),selector:t.ji().nullable(),targetLabel:t.ji(),text:NX.optional(),viewportSize:t.Oi({width:t.Di(),height:t.Di()}).optional()}),FX=PX.extend({createdAt:t.ji(),updatedAt:t.ji(),status:t.Mi([t.Ti(`current`),t.Ti(`queued`)])}),IX=t.Ci(`type`,[t.Oi({type:t.Ti(`browser-sidebar-runtime-close-comment-preview`),commentId:t.ji()}),t.Oi({type:t.Ti(`browser-sidebar-runtime-comment-screenshot-ready`),commentId:t.ji(),annotationViewportRect:EX.nullable().optional(),markerViewportPoint:DX.optional(),skipScreenshotCapture:t.xi().optional()}),t.Oi({type:t.Ti(`browser-sidebar-runtime-exit-comment-mode`)}),t.Oi({type:t.Ti(`browser-sidebar-runtime-design-modifier-state`),pressed:t.xi()}),t.Oi({type:t.Ti(`browser-sidebar-runtime-focus-editor`)}),t.Oi({type:t.Ti(`browser-sidebar-runtime-image-drag-ended`)}),t.Oi({type:t.Ti(`browser-sidebar-runtime-image-drag-started`),sourceUrl:t.ji()}),t.Oi({type:t.Ti(`browser-sidebar-runtime-mouse-navigation`),direction:t.Mi([t.Ti(`back`),t.Ti(`forward`)])}),t.Oi({type:t.Ti(`browser-sidebar-runtime-open-comment-preview`),commentId:t.ji(),anchorState:jX}),t.Oi({type:t.Ti(`browser-sidebar-runtime-open-editor`),target:TX,anchorState:jX,designEditorState:PX.optional(),wantsScreenshot:t.xi().optional()}),t.Oi({type:t.Ti(`browser-sidebar-runtime-open-design-editor`),anchorState:jX,designEditorState:PX,designChange:FX.optional()}),t.Oi({type:t.Ti(`browser-sidebar-runtime-update-anchor`),target:TX,anchorState:jX.nullable()})]);function LX(){let e=!1,t=null,n=!1;return{allowQuitTemporarilyForUpdateInstall:r=>{e=r?.allowWithoutPrompt??!0,n=r?.skipDrainBeforeQuit??!1,t&&clearTimeout(t),t=setTimeout(()=>{e=!1,n=!1,t=null},6e4),t.unref()},canQuitWithoutPrompt:()=>e,markQuitApproved:()=>{e=!0},shouldSkipDrainBeforeQuit:()=>n}}function RX({hotkeyWindowLifecycleManager:e,globalDictationLifecycleManager:t,flushAndDisposeContext:n,disposables:r}){e.dispose(),t.dispose(),n(),r.dispose()}function zX({desktopSentry:e,hotkeyWindowLifecycleManager:r,globalDictationLifecycleManager:i,codexHome:o,nativeContextMenuIconSearchRoots:s,getContextForWebContents:c,getPrimaryWindow:l,showPrimaryWindow:u,ensureWindow:d,createFreshWindow:f,setDesktopFeatureAvailability:p,restoreAvatarOverlayOpenState:m,reloadBundledPlugins:h,setMacMenuBarEnabled:g,navigateToRoute:_,getDockMenuController:v,getTrayController:y,isTrustedIpcEvent:b}){dX(s,b),sX(b),a.ipcMain.handle(`codex_desktop:control-window`,async(e,t)=>{if(!b(e))return;let n=a.BrowserWindow.fromWebContents(e.sender);if(!n||n.isDestroyed())return;switch(t?.action){case`minimize`:n.minimize();return;case`maximize`:n.isMaximized()?n.unmaximize():n.maximize();return;case`close`:n.close();return}});function linuxSerializeMenuItems(e,t){let n=[];if(!e)return n;for(let r=0;r0&&(s.submenu=linuxSerializeMenuItems(i.submenu,o)),n.push(s)}return n}function linuxMenuItemAtPath(e,t){let n=t.split(`.`).map(Number),r=e;for(let e=0;e{if(!b(e))return{items:[]};let n=a.Menu.getApplicationMenu()?.getMenuItemById(t?.menuId)?.submenu;return{items:n?linuxSerializeMenuItems(n,``):[]}}),a.ipcMain.handle(`codex_desktop:click-application-menu-item`,async(e,t)=>{if(!b(e))return;let n=a.BrowserWindow.fromWebContents(e.sender),r=a.Menu.getApplicationMenu()?.getMenuItemById(t?.menuId)?.submenu,i=linuxMenuItemAtPath(r,t?.path);i&&i.enabled!==!1&&typeof i.click==`function`&&i.click(void 0,n??void 0,n?.webContents)});let x=!1;a.ipcMain.handle(sl,async(e,o)=>{if(!b(e))return;if(o.type===`electron-avatar-overlay-restore-ready`){x||(x=!0,await m(e.sender));return}if(o.type===`electron-desktop-features-changed`){c(e.sender)?.setChronicleConfig(o.codexChronicleConfig),p({ambientSuggestions:o.ambientSuggestions,appshotsEnabled:o.appshotsEnabled,inAppBrowserUse:o.inAppBrowserUse,inAppBrowserUseAllowed:o.inAppBrowserUseAllowed,browserPane:o.browserPane,externalBrowserUse:o.externalBrowserUse,externalBrowserUseAllowed:o.externalBrowserUseAllowed,computerUse:o.computerUse,computerUseNodeRepl:o.computerUseNodeRepl,sites:o.sites,control:o.control,dil:o.dil,multiBrowserTabs:o.multiBrowserTabs,multiWindow:o.multiWindow,processManager:o.processManager});return}if(o.type===`mac-menu-bar-enabled-changed`){await g(o.enabled);return}if(o.type===`reload-bundled-plugins`){await h?.();return}if(o.type===`open-current-main-window`||o.type===`open-in-main-window`){let e=o.type===`open-current-main-window`?null:o.path;if(e!=null&&!t.it(e))return;r.hide();let n=l(),i=n!=null||e==null?await d():await f(e);i&&(o.type===`open-current-main-window`&&o.stealFocus===!0?u({stealFocus:!0}):(i.isMinimized()&&i.restore(),i.show(),i.focus()),n!=null&&e!=null&&_(i,e));return}if(o.type===`open-in-new-window`){if(!t.it(o.path))return;r.hide();let e=await f(o.path);e&&(e.isMinimized()&&e.restore(),e.show(),e.focus());return}if(o.type===`show-settings`){r.hide();let e=await d();if(!e)return;e.isMinimized()&&e.restore(),e.show(),e.focus(),_(e,`/settings/${o.section}`);return}if(o.type===`quit-app`){a.app.quit();return}if(gX(o)){await Promise.all([y()?.handleMessage(o),v?.()?.handleMessage(o)]);return}if(await i.handleMessage(e,o))return;let s=c(e.sender);if(!s){n.Lr().warning(`Message received for unknown window context`);return}await s.handleMessage(e.sender,o)}),a.ipcMain.handle(cl,async(e,t)=>{let r=IX.safeParse(t);if(!r.success){n.Lr().warning(`Invalid browser sidebar runtime message received`);return}let i=a.BrowserWindow.fromWebContents(e.sender);if(i==null){n.Lr().warning(`Browser sidebar runtime message received without owner window`);return}let o=c(i.webContents);if(o==null){n.Lr().warning(`Browser sidebar runtime message received for unknown window context`);return}await o.handleMessage(e.sender,r.data)}),a.ipcMain.handle(vl,async(e,t)=>b(e)?n.Dt({codexHome:o,params:t}):null),a.ipcMain.handle(bl,t=>{if(!b(t))return;let n=Error(`Desktop Sentry test error (debug button)`);e.captureException(n,{tags:{trigger:`debug-button`}})}),a.ipcMain.on(xl,e=>{if(!b(e))return;let[t]=e.ports,n=c(e.sender)?.createAppHost(e.sender);fX(t,n)})}function BX({buildFlavor:e,getContextForWebContents:t,isTrustedIpcEvent:n,usesOwlAppShell:i}){a.ipcMain.on(pl,e=>{if(!n(e)){e.returnValue=null;return}e.returnValue=r.A}),a.ipcMain.on(ml,t=>{if(!n(t)){t.returnValue=null;return}t.returnValue=e}),a.ipcMain.on(hl,e=>{if(!n(e)){e.returnValue=!1;return}e.returnValue=i}),a.ipcMain.on(_l,e=>{if(!n(e)){e.returnValue={};return}e.returnValue=t(e.sender)?.getSharedObjectSnapshot()??{}})}function VX({isWindows:e,disableQuitConfirmationPrompt:t,quitState:r,windows:i,applicationMenuManager:o,ensureWindow:s,hotkeyWindowLifecycleManager:c,globalDictationLifecycleManager:l,globalState:u,settingsStore:d,flushAndDisposeContext:f,disposables:p,appEvent:m,errorReporter:h}){let g=!1,_=!1;a.app.on(`window-all-closed`,()=>{(process.platform===`darwin`&&!a.app.isPackaged||process.platform!==`darwin`&&!e)&&a.app.quit()}),a.app.on(`before-quit`,o=>{if(el()){o.preventDefault();return}let s=nK(),c=n.Xn().some(e=>e.status===`ACTIVE`);if(e||r.canQuitWithoutPrompt()||t||!s&&!c){_=!0,i.markAppQuitting();return}let l=a.app.getName();if(a.dialog.showMessageBoxSync({type:`warning`,buttons:[`Quit`,`Cancel`],defaultId:0,cancelId:1,noLink:!0,title:`Quit ${l}?`,message:`Quit ${l}?`,detail:HX({hasInProgressLocalConversation:s,hasEnabledAutomations:c})})!==0){o.preventDefault();return}r.markQuitApproved(),_=!0,i.markAppQuitting()}),a.app.on(`child-process-gone`,(e,t)=>{if(t.reason!==`clean-exit`){if(UX(t)){WX(t);return}h.reportFatal(Error(`Child process gone (${t.type})`),{tags:{errorType:`child-process-gone`,processType:t.type,reason:t.reason},extra:{exitCode:t.exitCode,name:t.name,serviceName:t.serviceName}})}}),a.app.on(`activate`,()=>{_||(i.showLastActivePrimaryWindow()||s(),o.refresh())}),a.app.on(`browser-window-blur`,()=>{a.BrowserWindow.getFocusedWindow()??m.emit(`background`)}),a.app.on(`browser-window-focus`,()=>{m.emit(`foreground`),o.refresh()}),a.app.on(`will-quit`,e=>{if(_=!0,!g){if(r.shouldSkipDrainBeforeQuit()){RX({hotkeyWindowLifecycleManager:c,globalDictationLifecycleManager:l,flushAndDisposeContext:f,disposables:p});return}e.preventDefault(),g=!0,c.dispose(),l.dispose(),Promise.all([u.flush(),d.flush()]).finally(()=>{f(),p.dispose(),a.app.quit()})}})}function HX({hasInProgressLocalConversation:e,hasEnabledAutomations:t}){return e&&t?`Active local threads on this machine will be interrupted and enabled automations won't run while Codex is closed`:e?`Active local threads on this machine will be interrupted`:`Enabled automations won't run while Codex is closed`}function UX(e){return e.type===`GPU`||e.type===`Utility`&&e.serviceName===`audio.mojom.AudioService`}function WX(e){let t=`${e.type}:${e.serviceName??e.name??``}:${e.reason}`,r=Date.now(),i=wX.get(t);i!=null&&r-ie.on(t,n),[e,t,n])}function Kt(e){let t=B(()=>K(e)),{isStatic:n}=(0,Z.useContext)(V);if(n){let[,n]=(0,Z.useState)(e);(0,Z.useEffect)(()=>t.on(`change`,n),[])}return t}function qt(e,t){let n=Kt(t()),r=()=>n.set(t());return r(),H(()=>{let t=()=>J.preRender(r,!1,!0),n=e.map(e=>e.on(`change`,t));return()=>{n.forEach(e=>e()),q(r)}}),n}function Jt(e,...t){let n=e.length;function r(){let r=``;for(let i=0;ii(e))}function Zt(e,t){let n=B(()=>[]);return qt(e,()=>{n.length=0;let r=e.length;for(let t=0;t(0,Q.jsx)(`svg`,{width:21,height:21,viewBox:`0 0 21 21`,fill:`none`,xmlns:`http://www.w3.org/2000/svg`,...e,children:(0,Q.jsx)(`path`,{fillRule:`evenodd`,clipRule:`evenodd`,d:`M10.7997 2.48486C15.4019 2.48486 19.1335 6.21565 19.1337 10.8179C19.1337 15.4202 15.4021 19.1519 10.7997 19.1519C6.19746 19.1517 2.46667 15.4201 2.46667 10.8179C2.46685 6.21576 6.19757 2.48504 10.7997 2.48486ZM9.00811 7.5181C8.62612 7.13627 8.00684 7.13624 7.62534 7.5181C7.24363 7.89971 7.24366 8.51913 7.62534 8.90088L9.54183 10.8179L7.62534 12.7343C7.24375 13.116 7.24365 13.7354 7.62534 14.1171C8.00709 14.4989 8.62647 14.4989 9.00811 14.1171L10.9251 12.2007L12.8416 14.1171C13.2234 14.4989 13.8427 14.4989 14.2244 14.1171C14.6062 13.7354 14.6062 13.1161 14.2244 12.7343L12.3079 10.8179L14.2244 8.90088L14.3123 8.79221C14.5632 8.41306 14.5212 7.89785 14.2244 7.60088C13.9275 7.30404 13.4123 7.26211 13.0331 7.51303L12.9244 7.60088L11.0079 9.51736L9.09138 7.60088L9.00811 7.5181Z`,fill:`currentColor`})}),$=T(),$t=`color-mix(in srgb, var(--color-token-foreground) 5%, var(--color-token-main-surface-primary))`,en=`min(32rem, var(--radix-tooltip-content-available-width), calc(100vw - 16px))`;function tn(e){let t=(0,$.c)(79),n,r,i,a,o,s,l,u,d,f,p,m,h,g,_,v,y,b;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4],o=t[5],s=t[6],l=t[7],u=t[8],d=t[9],f=t[10],p=t[11],m=t[12],h=t[13],g=t[14],_=t[15],v=t[16],y=t[17],b=t[18]):({activatorRef:n,tooltip:y,highlightedIcon:i,id:o,icon:a,trailingContent:b,title:v,isDragging:f,isActive:p,isClosable:m,isHighlighted:h,isLabel:g,isPreview:_,onActivate:s,onClose:l,onPointerDown:u,style:d,...r}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a,t[5]=o,t[6]=s,t[7]=l,t[8]=u,t[9]=d,t[10]=f,t[11]=p,t[12]=m,t[13]=h,t[14]=g,t[15]=_,t[16]=v,t[17]=y,t[18]=b);let x=f===void 0?!1:f,S=p===void 0?!1:p,C=m===void 0?!1:m,w=h===void 0?!1:h,T=g===void 0?!1:g,E=_===void 0?!1:_,O=D(),[k,A]=(0,Z.useState)(!1),j=!T,M=w&&i!=null,ee=j&&S,N;t[19]===Symbol.for(`react.memo_cache_sentinel`)?(N=(e,t)=>{A(t.scrollWidth>t.clientWidth)},t[19]=N):N=t[19];let F=At(N),I=E&&`italic`,L;t[20]===I?L=t[21]:(L=c(`block w-full min-w-0 whitespace-nowrap`,I),t[20]=I,t[21]=L);let R;t[22]!==L||t[23]!==F||t[24]!==v?(R=(0,Q.jsx)(`span`,{ref:F,className:L,children:v}),t[22]=L,t[23]=F,t[24]=v,t[25]=R):R=t[25];let z=R,B;t[26]===d?B=t[27]:(B={...d,"--app-shell-tab-background":$t},t[26]=d,t[27]=B);let V=B,H;t[28]===u?H=t[29]:(H=e=>{if(e.button!==0||e.ctrlKey){e.stopPropagation();return}u?.(e)},t[28]=u,t[29]=H);let U=j&&`group-hover/tab:bg-[var(--app-shell-tab-background)]`,W=j&&(S||x)&&`bg-[var(--app-shell-tab-background)]`,G;t[30]!==U||t[31]!==W?(G=c(`pointer-events-none absolute inset-0 z-0 rounded-md`,U,W),t[30]=U,t[31]=W,t[32]=G):G=t[32];let K;t[33]===G?K=t[34]:(K=(0,Q.jsx)(`div`,{className:G}),t[33]=G,t[34]=K);let q=S&&`text-token-text-primary`,J=!S&&`text-token-text-secondary`,Y;t[35]!==q||t[36]!==J?(Y=c(`no-drag relative flex flex-1 items-center gap-2 z-10 text-sm min-w-0 `,q,J),t[35]=q,t[36]=J,t[37]=Y):Y=t[37];let X;t[38]!==C||t[39]!==s||t[40]!==l?(X=e=>{if(C&&e.button===1){e.preventDefault(),e.stopPropagation(),l?.();return}s?.()},t[38]=C,t[39]=s,t[40]=l,t[41]=X):X=t[41];let te;t[42]!==i||t[43]!==a||t[44]!==M?(te=(a!=null||M)&&(0,Q.jsxs)(`span`,{"aria-hidden":`true`,className:`icon-xs relative flex shrink-0 items-center justify-center overflow-visible`,children:[a!=null&&(0,Q.jsx)(`span`,{className:c(`flex size-full items-center justify-center`,M&&`opacity-30`),children:a}),M&&(0,Q.jsx)(`span`,{className:`pointer-events-none absolute inset-0 z-10 flex size-full items-center justify-center`,children:i})]}),t[42]=i,t[43]=a,t[44]=M,t[45]=te):te=t[45];let ne;t[46]!==O||t[47]!==C||t[48]!==l||t[49]!==v?(ne=C&&(0,Q.jsx)(`div`,{role:`button`,"aria-label":O.formatMessage({id:`codex.tabs.closeNamed`,defaultMessage:`Close {title} tab`,description:`Accessible label for closing a named tab`},{title:v}),className:`no-drag absolute inset-y-0 start-0 z-30 hidden shrink-0 cursor-interaction items-center bg-(--app-shell-tab-background) text-token-text-tertiary group-hover/tab:flex after:absolute after:-inset-1 after:content-[''] hover:text-token-text-primary`,onClick:l,onMouseDown:nn,children:(0,Q.jsx)(Qt,{className:`icon-xs`})}),t[46]=O,t[47]=C,t[48]=l,t[49]=v,t[50]=ne):ne=t[50];let re;t[51]!==x||t[52]!==z||t[53]!==y?(re=y?(0,Q.jsx)(P,{tooltipContent:y,disabled:x,delayOpen:!0,side:`bottom`,tooltipMaxWidth:en,children:z}):z,t[51]=x,t[52]=z,t[53]=y,t[54]=re):re=t[54];let ie;t[55]!==ee||t[56]!==S||t[57]!==k||t[58]!==j?(ie=k&&(0,Q.jsx)(`span`,{className:c(`pointer-events-none absolute inset-y-0 end-0 z-20 w-8 bg-linear-to-r from-transparent to-60%`,ee?`to-[var(--app-shell-tab-background)]`:`to-token-main-surface-primary`,j&&!S&&`group-hover/tab:to-[var(--app-shell-tab-background)]`)}),t[55]=ee,t[56]=S,t[57]=k,t[58]=j,t[59]=ie):ie=t[59];let ae;t[60]!==re||t[61]!==ie?(ae=(0,Q.jsxs)(`span`,{className:`relative min-w-0 flex-1 overflow-hidden`,children:[re,ie]}),t[60]=re,t[61]=ie,t[62]=ae):ae=t[62];let oe;t[63]!==S||t[64]!==Y||t[65]!==X||t[66]!==te||t[67]!==ne||t[68]!==ae||t[69]!==b?(oe=(0,Q.jsxs)(`button`,{type:`button`,role:`tab`,"aria-selected":S,className:Y,onMouseDown:X,children:[te,ne,ae,b]}),t[63]=S,t[64]=Y,t[65]=X,t[66]=te,t[67]=ne,t[68]=ae,t[69]=b,t[70]=oe):oe=t[70];let se;return t[71]!==n||t[72]!==r||t[73]!==o||t[74]!==V||t[75]!==H||t[76]!==K||t[77]!==oe?(se=(0,Q.jsxs)(`div`,{ref:n,"data-tab-id":o,className:`group/tab relative flex h-7 max-w-39 shrink-0 items-center overflow-hidden rounded-lg bg-token-main-surface-primary px-2 py-1`,style:V,...r,onPointerDown:H,children:[K,oe]}),t[71]=n,t[72]=r,t[73]=o,t[74]=V,t[75]=H,t[76]=K,t[77]=oe,t[78]=se):se=t[78],se}function nn(e){e.preventDefault(),e.stopPropagation()}function rn(e){let t=(0,$.c)(69),{controller:n,isActive:r,separatorIndex:a,showTrailingSeparator:o,tab:s}=e,l=v(I),{tabId:u,title:d,icon:f,isClosable:p,isLabel:h,contextMenuItems:g,highlightedIcon:_,isHighlighted:y,trailingContent:b,isPreview:x,tooltip:S}=s,C;t[0]!==n||t[1]!==u?(C={controller:n,kind:`app-shell-tab`,tabId:u},t[0]=n,t[1]=u,t[2]=C):C=t[2];let w;t[3]!==h||t[4]!==C||t[5]!==s.dndId?(w={data:C,disabled:h,id:s.dndId,strategy:Dt},t[3]=h,t[4]=C,t[5]=s.dndId,t[6]=w):w=t[6];let{attributes:T,isDragging:E,listeners:D,setActivatorNodeRef:k,setNodeRef:A,transform:j,transition:M}=Tt(w),ee;t[7]!==n||t[8]!==p||t[9]!==l||t[10]!==u?(ee=e=>{if(p){let t=l.get(i),r=l.get(n.tabs$),a=r.findIndex(e=>e.tabId===u),o=r.some(e=>e.tabId!==u&&e.isClosable),s=a!==-1&&r.slice(a+1).some(an);if(e.length>0&&e.push({id:`close-tab-separator`,type:`separator`}),e.push({id:`close-tab`,message:O({id:`codex.tabs.contextMenu.close`,defaultMessage:`Close`,description:`Context menu action for closing a tab`}),onSelect:()=>n.closeTab(l,u)}),!t)return e;e.push({enabled:o,id:`close-other-tabs`,message:O({id:`codex.tabs.contextMenu.closeOtherTabs`,defaultMessage:`Close other tabs`,description:`Context menu action for closing all other tabs besides the current tab`}),onSelect:()=>n.closeOtherTabs(l,u)}),e.push({enabled:s,id:`close-tabs-to-the-right`,message:O({id:`codex.tabs.contextMenu.closeTabsToTheRight`,defaultMessage:`Close tabs to the right`,description:`Context menu action for closing the tabs to the right of the current tab`}),onSelect:()=>n.closeTabsToRight(l,u)})}return e},t[7]=n,t[8]=p,t[9]=l,t[10]=u,t[11]=ee):ee=t[11];let N=ee,P;t[12]!==N||t[13]!==g||t[14]!==l?(P=()=>{let e=typeof g==`function`?g(l):g??[];return Array.isArray(e)?N([...e]):e.then(e=>N([...e]))},t[12]=N,t[13]=g,t[14]=l,t[15]=P):P=t[15];let F=P,L=n.panelId,R=E&&`z-10 cursor-grab opacity-0`,z;t[16]===R?z=t[17]:(z=c(`my-auto flex shrink-0 relative max-w-40 pe-1 items-center contain-content gap-0.5`,R),t[16]=R,t[17]=z);let B;t[18]===j?B=t[19]:(B=m.Translate.toString(j),t[18]=j,t[19]=B);let V;t[20]!==B||t[21]!==M?(V={transform:B,transition:M},t[20]=B,t[21]=M,t[22]=V):V=t[22];let H,W;t[23]!==n||t[24]!==l||t[25]!==u?(H=()=>n.activateTab(l,u),W=()=>n.closeTab(l,u),t[23]=n,t[24]=l,t[25]=u,t[26]=H,t[27]=W):(H=t[26],W=t[27]);let G;t[28]!==n||t[29]!==x||t[30]!==l||t[31]!==u?(G=()=>{x&&n.pinTab(l,u)},t[28]=n,t[29]=x,t[30]=l,t[31]=u,t[32]=G):G=t[32];let K;t[33]!==T||t[34]!==_||t[35]!==f||t[36]!==r||t[37]!==p||t[38]!==E||t[39]!==y||t[40]!==h||t[41]!==x||t[42]!==D||t[43]!==k||t[44]!==H||t[45]!==W||t[46]!==G||t[47]!==u||t[48]!==d||t[49]!==S||t[50]!==b?(K=(0,Q.jsx)(tn,{activatorRef:k,id:u,highlightedIcon:_,icon:f,isActive:r,isClosable:p,isDragging:E,isHighlighted:y,isLabel:h,isPreview:x,onActivate:H,onClose:W,trailingContent:b,title:d,tooltip:S,...D,...T,onDoubleClick:G}),t[33]=T,t[34]=_,t[35]=f,t[36]=r,t[37]=p,t[38]=E,t[39]=y,t[40]=h,t[41]=x,t[42]=D,t[43]=k,t[44]=H,t[45]=W,t[46]=G,t[47]=u,t[48]=d,t[49]=S,t[50]=b,t[51]=K):K=t[51];let q;t[52]!==F||t[53]!==K?(q=(0,Q.jsx)(Ct,{getItems:F,children:K}),t[52]=F,t[53]=K,t[54]=q):q=t[54];let J=o?`opacity-100`:`opacity-0`,Y;t[55]===J?Y=t[56]:(Y=c(`h-3 w-px shrink-0 end-0 absolute bg-token-border transition-opacity duration-200`,J),t[55]=J,t[56]=Y);let X;t[57]!==a||t[58]!==Y||t[59]!==u?(X=(0,Q.jsx)(`div`,{"aria-hidden":!0,"data-app-shell-tab-separator":u,"data-app-shell-tab-separator-index":a,className:Y}),t[57]=a,t[58]=Y,t[59]=u,t[60]=X):X=t[60];let te;return t[61]!==n.panelId||t[62]!==A||t[63]!==q||t[64]!==X||t[65]!==z||t[66]!==V||t[67]!==u?(te=(0,Q.jsxs)(U.div,{"data-app-shell-tab-controller":L,"data-tab-id":u,ref:A,className:z,style:V,children:[q,X]}),t[61]=n.panelId,t[62]=A,t[63]=q,t[64]=X,t[65]=z,t[66]=V,t[67]=u,t[68]=te):te=t[68],te}function an(e){return e.isClosable}var on=(0,Z.createContext)(null);function sn(e,t){let n=e.get(t.sourceController.tabIds$),r=n.indexOf(t.tabId);r===-1||r===t.sourceIndex||e.set(t.sourceController.tabIds$,Et(n,r,t.sourceIndex))}function cn(e,t,n,r){let i=e.get(t.tabIds$),a=i.indexOf(n),o=i.indexOf(r);a===-1||o===-1||a===o||e.set(t.tabIds$,Et(i,a,o))}function ln(e,t,n){return e.previewController===t&&e.overTabId===n?e:{...e,overTabId:n,previewController:t}}function un(e,t,n){if(n==null||n.previewController===n.sourceController)return e;if(t===n.sourceController)return e.filter(e=>e.tabId!==n.draggedTab.tabId);if(t!==n.previewController)return e;let r=n.overTabId==null?-1:e.findIndex(e=>e.tabId===n.overTabId),i=[...e];return i.splice(r===-1?i.length:r,0,n.draggedTab),i}var dn=`data-tab-preview-pin-exempt`;function fn(e){let t=(0,$.c)(20),{afterList:n,afterListSticky:r,beforeList:i,emptyState:a,headerHeight:o,controller:s}=e,c=y(s.tabs$),l=y(s.activeTab$),u=y(s.activeTabReactKey$),d=(0,Z.useContext)(on)?.dragState??null,f;t[0]!==s||t[1]!==d||t[2]!==c?(f=un(c,s,d),t[0]=s,t[1]=d,t[2]=c,t[3]=f):f=t[3];let p=f,m=l?.tabId??null,h;t[4]!==n||t[5]!==r||t[6]!==i||t[7]!==s||t[8]!==o||t[9]!==p||t[10]!==m?(h=(0,Q.jsx)(pn,{height:o,activeTabId:m,after:n,afterSticky:r,before:i,controller:s,tabs:p}),t[4]=n,t[5]=r,t[6]=i,t[7]=s,t[8]=o,t[9]=p,t[10]=m,t[11]=h):h=t[11];let g;t[12]!==l||t[13]!==u||t[14]!==s||t[15]!==a?(g=l==null?(0,Q.jsx)(`div`,{className:`relative min-h-0 flex-1`,children:a}):(0,Q.jsx)(vn,{controller:s,tab:l},u),t[12]=l,t[13]=u,t[14]=s,t[15]=a,t[16]=g):g=t[16];let _;return t[17]!==h||t[18]!==g?(_=(0,Q.jsxs)(`div`,{className:`isolate flex h-full min-h-0 flex-col bg-token-main-surface-primary [contain:layout_paint]`,children:[h,g]}),t[17]=h,t[18]=g,t[19]=_):_=t[19],_}function pn(e){let t=(0,$.c)(94),{activeTabId:n,after:r,afterSticky:i,before:a,controller:o,height:s,tabs:l}=e,[u,d]=(0,Z.useState)(!1),[f,p]=(0,Z.useState)(!1),[m,h]=jt(),[g,v]=(0,Z.useState)(null),y=`app-shell-tab-strip:${o.panelId}`,b;t[0]===o?b=t[1]:(b={controller:o,kind:`app-shell-tab-strip`},t[0]=o,t[1]=b);let x;t[2]!==y||t[3]!==b?(x={id:y,data:b},t[2]=y,t[3]=b,t[4]=x):x=t[4];let{setNodeRef:S}=_(x),C=(0,Z.useContext)(on)?.dragState??null,w,T,E,D,O,k,A,j,M,ee,N,P,F,I,L,R,z;if(t[5]!==n||t[6]!==h||t[7]!==a||t[8]!==o||t[9]!==C||t[10]!==s||t[11]!==u||t[12]!==g||t[13]!==S||t[14]!==l){let e=l.map(hn),r;t[32]===l?r=t[33]:(r=l.map(mn),t[32]=l,t[33]=r);let i=r;T=h==null||h===0?`0px`:`0px -${h}px 0px 0px`,E=C!=null;let f=n==null?-1:e.indexOf(n),p=s===`toolbar`&&`h-toolbar`,m=s===`pane`&&`h-toolbar-pane`;t[34]!==p||t[35]!==m?(ee=c(p,m,`isolate flex min-w-0 shrink-0 select-none items-center bg-token-main-surface-primary px-2 [contain:layout_paint]`),t[34]=p,t[35]=m,t[36]=ee):ee=t[36],t[37]===a?N=t[38]:(N=a!=null&&(0,Q.jsx)(`div`,{className:`my-auto flex shrink-0 items-center`,role:`presentation`,children:a}),t[37]=a,t[38]=N),t[39]===S?D=t[40]:(D=e=>{v(e),S(e)},t[39]=S,t[40]=D),O=o.panelId,k=`hide-scrollbar relative isolate flex h-full min-w-0 flex-1 scroll-px-1 items-center overflow-x-auto overflow-y-hidden [contain:layout_paint]`;let _=`${h??0}px`;t[41]===_?A=t[42]:(A={scrollPaddingInlineEnd:_},t[41]=_,t[42]=A);let y=u?`opacity-0`:`opacity-100`,b;t[43]===y?b=t[44]:(b=c(`sticky start-0 z-10 h-full w-0 after:absolute transition-opacity after:pointer-events-none duration-100 after:start-0 after:top-0 after:bottom-0 after:w-10 after:bg-linear-to-l after:from-transparent after:to-token-main-surface-primary after:content-['']`,y),t[43]=y,t[44]=b),t[45]===b?j=t[46]:(j=(0,Q.jsx)(`div`,{"aria-hidden":!0,className:b}),t[45]=b,t[46]=j),t[47]===g?M=t[48]:(M=(0,Q.jsx)(gn,{onVisibleChange:d,root:g}),t[47]=g,t[48]=M),w=Ot,R=i,z=Dt,P=`tablist`;let x=E?`z-20`:`z-0`;t[49]===x?F=t[50]:(F=c(`relative flex`,x),t[49]=x,t[50]=F),t[51]===Symbol.for(`react.memo_cache_sentinel`)?(I={gap:3},t[51]=I):I=t[51],L=l.map(t=>{let r=n===t.tabId,i=e.indexOf(t.tabId);return(0,Q.jsx)(rn,{controller:o,isActive:r,separatorIndex:i,showTrailingSeparator:i{n(e)},t[0]=n,t[1]=a);let o=St(a),s;t[2]!==o||t[3]!==r||t[4]!==i?(s=e=>{if(!e)return;let t=new IntersectionObserver(e=>{for(let t of e)o(t.isIntersecting)},{root:r,rootMargin:i});return t.observe(e),()=>{t.disconnect()}},t[2]=o,t[3]=r,t[4]=i,t[5]=s):s=t[5];let c;return t[6]!==i||t[7]!==s?(c=(0,Q.jsx)(`span`,{"aria-hidden":!0,ref:s},i),t[6]=i,t[7]=s,t[8]=c):c=t[8],c}function _n(e,t){return t!==-1&&(e===t||e===t-1)}var vn=(0,Z.memo)(function(e){let t=(0,$.c)(22),{controller:n,tab:r}=e,i=v(I),a;t[0]!==n||t[1]!==i||t[2]!==r.isPreview||t[3]!==r.tabId?(a=e=>{bn(e.nativeEvent)||r.isPreview&&n.pinTab(i,r.tabId)},t[0]=n,t[1]=i,t[2]=r.isPreview,t[3]=r.tabId,t[4]=a):a=t[4];let o=a,s=r.title,c=n.panelId,l=r.tabId,u=r.tabId,d;if(t[5]!==n||t[6]!==i||t[7]!==r){let e;t[9]!==n||t[10]!==i||t[11]!==r.tabId?(e=()=>{n.closeTab(i,r.tabId)},t[9]=n,t[10]=i,t[11]=r.tabId,t[12]=e):e=t[12],d=r.renderPanel(e),t[5]=n,t[6]=i,t[7]=r,t[8]=d}else d=t[8];let f;t[13]!==d||t[14]!==r.tabId?(f=(0,Q.jsx)(lt,{name:`AppShellTabPanel`,resetKey:u,fallback:xn,children:d}),t[13]=d,t[14]=r.tabId,t[15]=f):f=t[15];let p;return t[16]!==n.panelId||t[17]!==o||t[18]!==f||t[19]!==r.tabId||t[20]!==r.title?(p=(0,Q.jsx)(`div`,{role:`tabpanel`,"aria-label":s,"data-app-shell-tab-panel-controller":c,"data-tab-id":l,tabIndex:-1,onKeyDownCapture:o,onPointerDownCapture:o,className:`relative min-h-0 flex-1 outline-none`,children:f}),t[16]=n.panelId,t[17]=o,t[18]=f,t[19]=r.tabId,t[20]=r.title,t[21]=p):p=t[21],p});function yn(e){let t=(0,$.c)(4),{onRetry:n}=e,r;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,Q.jsx)(`div`,{className:`font-medium text-token-text-primary`,children:(0,Q.jsx)(k,{id:`appShell.tabPanelRenderError.title`,defaultMessage:`Tab content couldn't render`,description:`Error message shown when an app shell tab panel fails to render`})}),t[0]=r):r=t[0];let i;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,Q.jsx)(k,{id:`appShell.tabPanelRenderError.retry`,defaultMessage:`Try again`,description:`Button label to retry rendering an app shell tab panel`}),t[1]=i):i=t[1];let a;return t[2]===n?a=t[3]:(a=(0,Q.jsxs)(`div`,{className:`flex h-full min-h-0 flex-col items-center justify-center gap-3 p-4 text-center text-sm text-token-text-secondary`,children:[r,(0,Q.jsx)(L,{color:`secondary`,size:`default`,onClick:n,children:i})]}),t[2]=n,t[3]=a),a}function bn(e){return e.composedPath().some(e=>e instanceof Element&&e.hasAttribute(dn))}function xn(e){return(0,Q.jsx)(yn,{onRetry:()=>{e.resetError()}})}function Sn(){let e=(0,$.c)(4),t=y(ge),n=y(oe),r=y(le),i;return e[0]!==t||e[1]!==n||e[2]!==r?(i=(0,Q.jsx)(fn,{headerHeight:`pane`,afterList:t,afterListSticky:n,emptyState:r,controller:at}),e[0]=t,e[1]=n,e[2]=r,e[3]=i):i=e[3],i}function Cn(){let e=(0,$.c)(17),t=v(I),n=D(),r=y(xe),i=x(Mt,`toggleMaximizeSidePanel`),a;e[0]!==n||e[1]!==r?(a=r?n.formatMessage({id:`codex.rightPanel.restoreWidth`,defaultMessage:`Restore panel width`,description:`Accessible label for restoring the right panel from full width`}):n.formatMessage({id:`codex.rightPanel.expandFullWidth`,defaultMessage:`Expand panel`,description:`Accessible label for expanding the right panel to full width`}),e[0]=n,e[1]=r,e[2]=a):a=e[2];let o=a,s;e[3]!==r||e[4]!==t?(s=()=>{t.set(xe,!r)},e[3]=r,e[4]=t,e[5]=s):s=e[5],ft(`toggleMaximizeSidePanel`,s);let c=r?`secondary`:`ghost`,l;e[6]===r?l=e[7]:(l=r?(0,Q.jsx)(Nt,{className:`icon-xs`}):(0,Q.jsx)(Pt,{className:`icon-xs`}),e[6]=r,e[7]=l);let u;e[8]!==r||e[9]!==o||e[10]!==c||e[11]!==l?(u=(0,Q.jsx)(L,{"aria-label":o,"aria-pressed":r,color:c,size:`toolbar`,uniform:!0,onClick:wn,children:l}),e[8]=r,e[9]=o,e[10]=c,e[11]=l,e[12]=u):u=e[12];let d;return e[13]!==o||e[14]!==i||e[15]!==u?(d=(0,Q.jsx)(P,{tooltipContent:o,shortcut:i,delayOpen:!0,children:u}),e[13]=o,e[14]=i,e[15]=u,e[16]=d):d=e[16],d}function wn(){return pt(`toggleMaximizeSidePanel`,`side_panel_full_width_button`)}function Tn(){let e=y(ue),t=y(Ce),n=y(Se),r=y(we),i=y(xe),a=y(Ze),{headerLeftWidth:o,headerRightWidth:s}=Je(),c=Jt`max(0px, calc(${s}px)`;return(0,Q.jsx)(fn,{headerHeight:`toolbar`,beforeList:(0,Q.jsxs)(Q.Fragment,{children:[i&&!a&&(0,Q.jsx)(U.div,{"aria-hidden":!0,className:`pointer-events-none h-full shrink-0`,style:{width:o}}),n]}),afterListSticky:t,emptyState:r,afterList:(0,Q.jsxs)(Q.Fragment,{children:[e,(0,Q.jsx)(Cn,{}),(0,Q.jsx)(U.div,{"aria-hidden":!0,"data-testid":`right-panel-tab-bar-header-spacer`,className:`pointer-events-none flex h-full shrink-0 items-center`,style:{width:c}})]}),controller:rt})}function En(e){let t=(0,$.c)(4),{keyboardEventTarget:n}=e,r=v(w),i,a;return t[0]!==n||t[1]!==r?(i=()=>{let e=n??(typeof window>`u`?null:window);if(e==null)return;let t=e=>{Ft(r,e)},i=()=>{It(r)};return e.addEventListener(`keydown`,t,!0),e.addEventListener(`keyup`,t,!0),e.addEventListener(`blur`,i),()=>{e.removeEventListener(`keydown`,t,!0),e.removeEventListener(`keyup`,t,!0),e.removeEventListener(`blur`,i),It(r)}},a=[n,r],t[0]=n,t[1]=r,t[2]=i,t[3]=a):(i=t[2],a=t[3]),(0,Z.useEffect)(i,a),null}var Dn=S(w,!1),On=S(w,null),kn=S(w,null),An=S(w,null);function jn(e){let t=(0,$.c)(21),{onClose:n}=e,r;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,Q.jsx)(k,{id:`appHeader.installUpdate.confirmTitle`,defaultMessage:`Update Codex now?`,description:`Title for the confirmation dialog shown before installing an app update while a local session is active`}),t[0]=r):r=t[0];let i=r,a;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,Q.jsx)(k,{id:`appHeader.installUpdate.confirmSubtitle`,defaultMessage:`Codex will quit to install the update, which will interrupt active local sessions on this machine`,description:`Subtitle for the confirmation dialog shown before installing an app update while a local session is active`}),t[1]=a):a=t[1];let o=a,s;t[2]===n?s=t[3]:(s=e=>{e||n()},t[2]=n,t[3]=s);let c;t[4]===n?c=t[5]:(c=e=>{e.preventDefault(),n(),C.dispatchMessage(`install-app-update`,{})},t[4]=n,t[5]=c);let l,u;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,Q.jsx)(gt,{className:`sr-only`,children:i}),u=(0,Q.jsx)(xt,{className:`sr-only`,children:o}),t[6]=l,t[7]=u):(l=t[6],u=t[7]);let d;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,Q.jsx)(ht,{children:(0,Q.jsx)(_t,{title:i,subtitle:o})}),t[8]=d):d=t[8];let f;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(f=(0,Q.jsx)(k,{id:`appHeader.installUpdate.confirmCancel`,defaultMessage:`Cancel`,description:`Cancel button for the update confirmation dialog`}),t[9]=f):f=t[9];let p;t[10]===n?p=t[11]:(p=(0,Q.jsx)(L,{color:`secondary`,onClick:n,children:f}),t[10]=n,t[11]=p);let m;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(m=(0,Q.jsx)(L,{type:`submit`,children:(0,Q.jsx)(k,{id:`appHeader.installUpdate.confirmInstall`,defaultMessage:`Update`,description:`Confirm button for the update confirmation dialog`})}),t[12]=m):m=t[12];let h;t[13]===p?h=t[14]:(h=(0,Q.jsx)(ht,{children:(0,Q.jsxs)(bt,{children:[p,m]})}),t[13]=p,t[14]=h);let g;t[15]!==h||t[16]!==c?(g=(0,Q.jsxs)(yt,{as:`form`,onSubmit:c,children:[l,u,d,h]}),t[15]=h,t[16]=c,t[17]=g):g=t[17];let _;return t[18]!==g||t[19]!==s?(_=(0,Q.jsx)(vt,{open:!0,onOpenChange:s,showDialogClose:!1,size:`compact`,children:g}),t[18]=g,t[19]=s,t[20]=_):_=t[20],_}function Mn(e,t){return e===`windows`&&t}function Nn(){let e=(0,$.c)(4),t=v(w),{platform:n}=nt(),i=y(r),a;return e[0]!==i||e[1]!==n||e[2]!==t?(a=()=>{if(Mn(n,i)){mt(t,jn);return}C.dispatchMessage(`install-app-update`,{})},e[0]=i,e[1]=n,e[2]=t,e[3]=a):a=e[3],St(a)}function Pn(e){let t=(0,$.c)(26),n;t[0]===e?n=t[1]:(n=e===void 0?{}:e,t[0]=e,t[1]=n);let{appUpdateLifecycleState:r}=n,i=D(),a=y(ct),o=Nn(),s=y(On),c=r??a;if(!st(c))return null;let l=c!==`ready`,u;t[2]===s?u=t[3]:(u=s==null?null:Math.min(100,Math.max(0,Math.round(s))),t[2]=s,t[3]=u);let d=u,f;bb0:switch(c){case`ready`:{let e;t[4]===i?e=t[5]:(e=i.formatMessage({id:`appHeader.installUpdate`,defaultMessage:`Update`,description:`Button label in the desktop app header that installs a downloaded app update`}),t[4]=i,t[5]=e),f=e;break bb0}case`installing`:{let e;t[6]===i?e=t[7]:(e=i.formatMessage({id:`appHeader.installingUpdate`,defaultMessage:`Installing`,description:`Button label in the desktop app header while an app update is installing`}),t[6]=i,t[7]=e),f=e;break bb0}case`downloading`:{let e;t[8]!==d||t[9]!==i?(e=d==null?i.formatMessage({id:`appHeader.downloadingUpdate`,defaultMessage:`Downloading`,description:`Button label in the desktop app header while an app update is downloading`}):i.formatMessage({id:`appHeader.downloadingUpdatePercent`,defaultMessage:`Downloading {downloadProgressPercent}%`,description:`Button label in the desktop app header while an app update is downloading with progress`},{downloadProgressPercent:d}),t[8]=d,t[9]=i,t[10]=e):e=t[10],f=e}}let p;t[11]!==f||t[12]!==c||t[13]!==d||t[14]!==i?(p=c===`downloading`&&d!=null?i.formatNumber(d/100,{style:`percent`}):f,t[11]=f,t[12]=c,t[13]=d,t[14]=i,t[15]=p):p=t[15];let m=p,h;t[16]===l?h=t[17]:(h=l?(0,Q.jsx)(z,{className:`ease-basic absolute left-1/2 h-3 w-3 shrink-0 -translate-x-1/2 transition-opacity duration-relaxed [will-change:opacity] motion-reduce:transition-none @[180px]:opacity-0`}):(0,Q.jsx)(ut,{className:`ease-basic absolute left-1/2 h-3 w-3 shrink-0 -translate-x-1/2 transition-opacity duration-relaxed [will-change:opacity] motion-reduce:transition-none @[180px]:opacity-0`}),t[16]=l,t[17]=h);let g;t[18]===m?g=t[19]:(g=(0,Q.jsx)(`span`,{className:`ease-basic min-w-0 truncate tabular-nums opacity-0 transition-opacity duration-relaxed [will-change:opacity] motion-reduce:transition-none @[180px]:opacity-100`,children:m}),t[18]=m,t[19]=g);let _;return t[20]!==f||t[21]!==o||t[22]!==l||t[23]!==h||t[24]!==g?(_=(0,Q.jsxs)(`button`,{"aria-label":f,className:`no-drag ease-basic relative flex h-5 max-w-5 min-w-5 shrink-0 cursor-interaction items-center justify-center overflow-hidden rounded-full bg-token-charts-blue px-2.5 text-xs leading-none font-semibold text-white shadow-sm transition-[max-width,background-color] duration-relaxed [will-change:max-width] contain-layout contain-paint contain-style hover:bg-token-charts-blue/90 active:bg-token-charts-blue/80 motion-reduce:transition-none @[180px]:max-w-36 @[180px]:min-w-10`,disabled:l,onClick:o,title:f,children:[h,g]}),t[20]=f,t[21]=o,t[22]=l,t[23]=h,t[24]=g,t[25]=_):_=t[25],_}var Fn={x:null,y:null,hasKnownVelocity:!1,updatedAt:null,velocityX:0,velocityY:0,speed:0};function In(e,t,n,r){if(e.x==null||e.y==null||e.updatedAt==null)return{x:t,y:n,hasKnownVelocity:!1,updatedAt:r,velocityX:0,velocityY:0,speed:0};let i=(r-e.updatedAt)/1e3;if(i<=0)return{x:t,y:n,hasKnownVelocity:!1,updatedAt:r,velocityX:0,velocityY:0,speed:0};let a=(t-e.x)/i,o=(n-e.y)/i;return{x:t,y:n,hasKnownVelocity:!0,updatedAt:r,velocityX:a,velocityY:o,speed:Math.hypot(a,o)}}var Ln=S(w,Fn),Rn=S(w,{width:window.innerWidth,height:window.innerHeight}),zn={px$:b(w,({get:e})=>e(Ln).x),py$:b(w,({get:e})=>e(Ln).y),hasKnownVelocity$:b(w,({get:e})=>e(Ln).hasKnownVelocity),vx$:b(w,({get:e})=>e(Ln).velocityX),vy$:b(w,({get:e})=>e(Ln).velocityY),speed$:b(w,({get:e})=>e(Ln).speed),bottomInset$:b(w,({get:e})=>{let{height:t}=e(Rn),n=e(Ln).y;return n==null?null:t-n}),rightInset$:b(w,({get:e})=>{let{width:t}=e(Rn),n=e(Ln).x;return n==null?null:t-n})};function Bn(e){let t=(0,$.c)(45),{disabled:n,edge:r,defaultSize:i,getCurrentSize:a,onResizeEnd:o,onResizingChange:s,setSize:c}=e,l=n===void 0?!1:n,u=r===void 0?`right`:r,d=N(),[f,p]=(0,Z.useState)(!1),m=(0,Z.useRef)(null),h=u===`left`||u===`right`,g;t[0]===s?g=t[1]:(g=()=>{m.current=null,p(!1),s?.(!1)},t[0]=s,t[1]=g);let _=(0,Z.useEffectEvent)(g),v;t[2]!==l||t[3]!==_?(v=()=>{!l||m.current==null||_()},t[2]=l,t[3]=_,t[4]=v):v=t[4];let y=(0,Z.useEffectEvent)(v),b;t[5]===d?b=t[6]:(b=e=>({x:e.clientX/d,y:e.clientY/d}),t[5]=d,t[6]=b);let x=b,S;t[7]===h?S=t[8]:(S=e=>h?e.x:e.y,t[7]=h,t[8]=S);let C=S,w;t[9]!==l||t[10]!==u||t[11]!==h||t[12]!==f||t[13]!==o||t[14]!==c||t[15]!==_||t[16]!==y||t[17]!==d?(w=()=>{if(!f||l)return;let e=e=>({x:e.clientX/d,y:e.clientY/d}),t=t=>{t.preventDefault();let n=m.current;if(n==null)return;let r=e(t);(h?r.x:r.y)!==n.startPosition&&(n.didMove=!0),c(Vn(u,r,n))},n=t=>{t.preventDefault();let n=m.current;if(n?.didMove===!0){let r=Vn(u,e(t),n);c(r),o?.(r)}_()};return window.addEventListener(`pointermove`,t),window.addEventListener(`pointerup`,n),window.addEventListener(`pointercancel`,n),()=>{window.removeEventListener(`pointermove`,t),window.removeEventListener(`pointerup`,n),window.removeEventListener(`pointercancel`,n),y()}},t[9]=l,t[10]=u,t[11]=h,t[12]=f,t[13]=o,t[14]=c,t[15]=_,t[16]=y,t[17]=d,t[18]=w):w=t[18];let T;t[19]!==l||t[20]!==u||t[21]!==h||t[22]!==f||t[23]!==o||t[24]!==c||t[25]!==d?(T=[l,u,h,f,o,c,d],t[19]=l,t[20]=u,t[21]=h,t[22]=f,t[23]=o,t[24]=c,t[25]=d,t[26]=T):T=t[26],(0,Z.useEffect)(w,T);let E;t[27]!==l||t[28]!==a||t[29]!==C||t[30]!==x||t[31]!==s?(E=e=>{l||e.button===0&&(e.preventDefault(),e.currentTarget.setPointerCapture?.(e.pointerId),m.current={didMove:!1,startPosition:C(x(e)),startSize:a()},p(!0),s?.(!0))},t[27]=l,t[28]=a,t[29]=C,t[30]=x,t[31]=s,t[32]=E):E=t[32];let D=E,O;t[33]!==i||t[34]!==l||t[35]!==o||t[36]!==s||t[37]!==c?(O=e=>{l||e.detail===2&&(e.preventDefault(),m.current=null,p(!1),s?.(!1),c(i),o?.(i))},t[33]=i,t[34]=l,t[35]=o,t[36]=s,t[37]=c,t[38]=O):O=t[38];let k=O,A;return t[39]!==l||t[40]!==u||t[41]!==k||t[42]!==D||t[43]!==f?(A=(0,Q.jsx)(Hn,{disabled:l,edge:u,isResizing:f,onClick:k,onPointerDown:D}),t[39]=l,t[40]=u,t[41]=k,t[42]=D,t[43]=f,t[44]=A):A=t[44],A}function Vn(e,t,n){let r=(e===`left`||e===`right`?t.x:t.y)-n.startPosition;switch(e){case`bottom`:case`right`:return n.startSize+r;case`left`:case`top`:return n.startSize-r}}function Hn(e){let t=(0,$.c)(20),{disabled:n,edge:r,isResizing:i,onClick:a,onPointerDown:o}=e,s=n||void 0,l=r===`left`||r===`right`?`vertical`:`horizontal`,u=n&&`pointer-events-none`,d=r===`left`?`z-40`:`z-20`,f=r===`right`&&`-top-toolbar right-0 bottom-0 w-4 translate-x-2`,p=r===`left`&&`top-0 bottom-0 left-0 w-4 -translate-x-2`,m=r===`top`&&`top-0 right-0 left-0 h-4 -translate-y-2`,h=r===`bottom`&&`right-0 bottom-0 left-0 h-4 translate-y-2`,g=!n&&(r===`left`||r===`right`?`cursor-col-resize active:cursor-col-resize`:`cursor-row-resize active:cursor-row-resize`),_;t[0]!==u||t[1]!==d||t[2]!==f||t[3]!==p||t[4]!==m||t[5]!==h||t[6]!==g?(_=c(`group absolute flex touch-none select-none`,u,d,f,p,m,h,g),t[0]=u,t[1]=d,t[2]=f,t[3]=p,t[4]=m,t[5]=h,t[6]=g,t[7]=_):_=t[7];let v=r===`left`||r===`right`?`h-full w-px bg-gradient-to-b from-transparent via-token-foreground/25 to-transparent`:`h-px w-full bg-gradient-to-r from-transparent via-token-foreground/25 to-transparent`,y=i?`opacity-100`:`group-hover:opacity-100 group-active:opacity-100`,b;t[8]!==v||t[9]!==y?(b=c(`sidebar-resize-handle-line pointer-events-none m-auto opacity-0`,v,y),t[8]=v,t[9]=y,t[10]=b):b=t[10];let x;t[11]===b?x=t[12]:(x=(0,Q.jsx)(`div`,{className:b}),t[11]=b,t[12]=x);let S;return t[13]!==a||t[14]!==o||t[15]!==s||t[16]!==_||t[17]!==x||t[18]!==l?(S=(0,Q.jsx)(`div`,{role:`separator`,"aria-disabled":s,"aria-orientation":l,className:_,onClick:a,onPointerDown:o,children:x}),t[13]=a,t[14]=o,t[15]=s,t[16]=_,t[17]=x,t[18]=l,t[19]=S):S=t[19],S}var Un=e=>(0,Q.jsx)(`svg`,{width:20,height:20,viewBox:`0 0 20 20`,fill:`none`,xmlns:`http://www.w3.org/2000/svg`,...e,children:(0,Q.jsx)(`path`,{d:`M16.835 8.66301C16.835 7.71885 16.8347 7.05065 16.792 6.52824C16.7605 6.14232 16.7073 5.86904 16.6299 5.65227L16.5439 5.45207C16.32 5.01264 15.9796 4.64498 15.5615 4.3886L15.3779 4.28606C15.1308 4.16013 14.8165 4.08006 14.3018 4.03801C13.7794 3.99533 13.1112 3.99504 12.167 3.99504H7.83301C6.88885 3.99504 6.22065 3.99533 5.69824 4.03801C5.31232 4.06954 5.03904 4.12266 4.82227 4.20012L4.62207 4.28606C4.18264 4.50996 3.81498 4.85035 3.55859 5.26848L3.45605 5.45207C3.33013 5.69922 3.25006 6.01354 3.20801 6.52824C3.16533 7.05065 3.16504 7.71885 3.16504 8.66301V11.3271C3.16504 12.2712 3.16533 12.9394 3.20801 13.4618C3.25006 13.9766 3.33013 14.2909 3.45605 14.538L3.55859 14.7216C3.81498 15.1397 4.18266 15.4801 4.62207 15.704L4.82227 15.79C5.03904 15.8674 5.31234 15.9205 5.69824 15.9521C6.22065 15.9947 6.88885 15.995 7.83301 15.995H12.167C13.1112 15.995 13.7794 15.9947 14.3018 15.9521C14.8164 15.91 15.1308 15.8299 15.3779 15.704L15.5615 15.6015C15.9797 15.3451 16.32 14.9774 16.5439 14.538L16.6299 14.3378C16.7074 14.121 16.7605 13.8478 16.792 13.4618C16.8347 12.9394 16.835 12.2712 16.835 11.3271V8.66301ZM5.00195 13.3329V6.66692C5.00195 6.29965 5.29972 6.00188 5.66699 6.00188C6.03412 6.00204 6.33203 6.29975 6.33203 6.66692V13.3329C6.33203 13.7001 6.03412 13.9978 5.66699 13.998C5.29972 13.998 5.00195 13.7002 5.00195 13.3329ZM18.165 11.3271C18.165 12.2493 18.1653 12.9811 18.1172 13.5702C18.0745 14.0924 17.9916 14.5472 17.8125 14.9648L17.7295 15.1415C17.394 15.8 16.8834 16.3511 16.2568 16.7353L15.9814 16.8896C15.5157 17.1268 15.0069 17.2285 14.4102 17.2773C13.821 17.3254 13.0893 17.3251 12.167 17.3251H7.83301C6.91071 17.3251 6.17898 17.3254 5.58984 17.2773C5.06757 17.2346 4.61294 17.1508 4.19531 16.9716L4.01855 16.8896C3.36014 16.5541 2.80898 16.0434 2.4248 15.4169L2.27051 15.1415C2.03328 14.6758 1.93158 14.167 1.88281 13.5702C1.83468 12.9811 1.83496 12.2493 1.83496 11.3271V8.66301C1.83496 7.74072 1.83468 7.00898 1.88281 6.41985C1.93157 5.82309 2.03329 5.31432 2.27051 4.84856L2.4248 4.57317C2.80898 3.94666 3.36012 3.436 4.01855 3.10051L4.19531 3.0175C4.61285 2.83843 5.06771 2.75548 5.58984 2.71281C6.17898 2.66468 6.91071 2.66496 7.83301 2.66496H12.167C13.0893 2.66496 13.821 2.66468 14.4102 2.71281C15.0069 2.76157 15.5157 2.86329 15.9814 3.10051L16.2568 3.25481C16.8833 3.63898 17.394 4.19012 17.7295 4.84856L17.8125 5.02531C17.9916 5.44285 18.0745 5.89771 18.1172 6.41985C18.1653 7.00898 18.165 7.74072 18.165 8.66301V11.3271Z`,fill:`currentColor`})}),Wn=e=>(0,Q.jsx)(`svg`,{width:20,height:20,viewBox:`0 0 20 20`,fill:`none`,xmlns:`http://www.w3.org/2000/svg`,...e,children:(0,Q.jsx)(`path`,{d:`M6.83496 3.99992C6.38353 4.00411 6.01421 4.0122 5.69824 4.03801C5.31232 4.06954 5.03904 4.12266 4.82227 4.20012L4.62207 4.28606C4.18264 4.50996 3.81498 4.85035 3.55859 5.26848L3.45605 5.45207C3.33013 5.69922 3.25006 6.01354 3.20801 6.52824C3.16533 7.05065 3.16504 7.71885 3.16504 8.66301V11.3271C3.16504 12.2712 3.16533 12.9394 3.20801 13.4618C3.25006 13.9766 3.33013 14.2909 3.45605 14.538L3.55859 14.7216C3.81498 15.1397 4.18266 15.4801 4.62207 15.704L4.82227 15.79C5.03904 15.8674 5.31234 15.9205 5.69824 15.9521C6.01398 15.9779 6.383 15.986 6.83398 15.9902L6.83496 3.99992ZM18.165 11.3271C18.165 12.2493 18.1653 12.9811 18.1172 13.5702C18.0745 14.0924 17.9916 14.5472 17.8125 14.9648L17.7295 15.1415C17.394 15.8 16.8834 16.3511 16.2568 16.7353L15.9814 16.8896C15.5157 17.1268 15.0069 17.2285 14.4102 17.2773C13.821 17.3254 13.0893 17.3251 12.167 17.3251H7.83301C6.91071 17.3251 6.17898 17.3254 5.58984 17.2773C5.06757 17.2346 4.61294 17.1508 4.19531 16.9716L4.01855 16.8896C3.36014 16.5541 2.80898 16.0434 2.4248 15.4169L2.27051 15.1415C2.03328 14.6758 1.93158 14.167 1.88281 13.5702C1.83468 12.9811 1.83496 12.2493 1.83496 11.3271V8.66301C1.83496 7.74072 1.83468 7.00898 1.88281 6.41985C1.93157 5.82309 2.03329 5.31432 2.27051 4.84856L2.4248 4.57317C2.80898 3.94666 3.36012 3.436 4.01855 3.10051L4.19531 3.0175C4.61285 2.83843 5.06771 2.75548 5.58984 2.71281C6.17898 2.66468 6.91071 2.66496 7.83301 2.66496H12.167C13.0893 2.66496 13.821 2.66468 14.4102 2.71281C15.0069 2.76157 15.5157 2.86329 15.9814 3.10051L16.2568 3.25481C16.8833 3.63898 17.394 4.19012 17.7295 4.84856L17.8125 5.02531C17.9916 5.44285 18.0745 5.89771 18.1172 6.41985C18.1653 7.00898 18.165 7.74072 18.165 8.66301V11.3271ZM8.16406 15.995H12.167C13.1112 15.995 13.7794 15.9947 14.3018 15.9521C14.8164 15.91 15.1308 15.8299 15.3779 15.704L15.5615 15.6015C15.9797 15.3451 16.32 14.9774 16.5439 14.538L16.6299 14.3378C16.7074 14.121 16.7605 13.8478 16.792 13.4618C16.8347 12.9394 16.835 12.2712 16.835 11.3271V8.66301C16.835 7.71885 16.8347 7.05065 16.792 6.52824C16.7605 6.14232 16.7073 5.86904 16.6299 5.65227L16.5439 5.45207C16.32 5.01264 15.9796 4.64498 15.5615 4.3886L15.3779 4.28606C15.1308 4.16013 14.8165 4.08006 14.3018 4.03801C13.7794 3.99533 13.1112 3.99504 12.167 3.99504H8.16406C8.16407 3.99667 8.16504 3.99829 8.16504 3.99992L8.16406 15.995Z`,fill:`currentColor`})}),Gn=S(w,!1),Kn=S(w,!1);function qn(e){let t=(0,$.c)(58),n;t[0]===e?n=t[1]:(n=e===void 0?{}:e,t[0]=e,t[1]=n);let{hideUnreadBadge:r,onToggleSidebar:i}=n,o=r===void 0?!1:r,s=v(w),c=D(),l=y(Ze),u=y(qe),d=y(Ae),f=y(a),p=!l&&!o,m;t[2]===p?m=t[3]:(m={taskFilter:`current`,limit:20,enabled:p},t[2]=p,t[3]=m);let h=ee(m),g=y(Gn),_=y(Kn),b=x(Mt,`toggleSidebar`),S=x(Mt,`navigateBack`),C=x(Mt,`navigateForward`),T;t[4]!==c||t[5]!==l?(T=l?c.formatMessage({id:`app.sidebar.hide`,defaultMessage:`Hide sidebar`,description:`Accessible label to collapse the sidebar chrome`}):c.formatMessage({id:`app.sidebar.show`,defaultMessage:`Show sidebar`,description:`Accessible label to expand the sidebar chrome`}),t[4]=c,t[5]=l,t[6]=T):T=t[6];let E=T,O=l?Un:Wn,A;t[7]===h.data?A=t[8]:(A=h.data??[],t[7]=h.data,t[8]=A);let j;t[9]===A?j=t[10]:(j=A.some(Xn),t[9]=A,t[10]=j);let M=!o&&!l&&(f>0||j),N,P;t[11]===s?(N=t[12],P=t[13]):(N=()=>()=>{s.set(Ne,!1),s.set(Le,!1),s.set(Ae,!1)},P=[s],t[11]=s,t[12]=N,t[13]=P),(0,Z.useEffect)(N,P);let F;t[14]===Symbol.for(`react.memo_cache_sentinel`)?(F=(0,Q.jsx)(k,{id:`app.sidebar.tooltip`,defaultMessage:`Toggle sidebar`,description:`Tooltip for the sidebar trigger button`}),t[14]=F):F=t[14];let I=u||d,L;t[15]!==i||t[16]!==s?(L=()=>{if(s.set(Ae,!0),i!=null){i();return}pt(`toggleSidebar`,`sidebar_trigger`)},t[15]=i,t[16]=s,t[17]=L):L=t[17];let R,z;t[18]===s?(R=t[19],z=t[20]):(R=()=>{s.set(Ne,!0)},z=()=>{s.set(Ne,!1),s.set(Le,!1),s.set(Ae,!1)},t[18]=s,t[19]=R,t[20]=z);let B;t[21]===O?B=t[22]:(B=(0,Q.jsx)(O,{className:`icon-xs`}),t[21]=O,t[22]=B);let V;t[23]===M?V=t[24]:(V=M?(0,Q.jsx)(`span`,{"aria-hidden":`true`,className:`absolute -top-0.5 -right-0.5 size-2 rounded-full bg-token-charts-blue ring-2 ring-token-main-surface-primary`,"data-testid":`sidebar-unread-badge`}):null,t[23]=M,t[24]=V);let H;t[25]!==B||t[26]!==V?(H=(0,Q.jsxs)(`span`,{className:`relative inline-flex`,children:[B,V]}),t[25]=B,t[26]=V,t[27]=H):H=t[27];let U;t[28]!==E||t[29]!==I||t[30]!==L||t[31]!==R||t[32]!==z||t[33]!==H||t[34]!==b?(U=(0,Q.jsx)(Zn,{ariaLabel:E,shortcut:b,tooltipContent:F,tooltipDisabled:I,viewTransitionName:`sidebar-trigger`,onClick:L,onPointerEnter:R,onPointerLeave:z,children:H}),t[28]=E,t[29]=I,t[30]=L,t[31]=R,t[32]=z,t[33]=H,t[34]=b,t[35]=U):U=t[35];let W;t[36]===c?W=t[37]:(W=c.formatMessage(Qn.navigateBack),t[36]=c,t[37]=W);let G=!g,K;t[38]===Symbol.for(`react.memo_cache_sentinel`)?(K=(0,Q.jsx)(k,{...Qn.navigateBack}),t[38]=K):K=t[38];let q;t[39]===Symbol.for(`react.memo_cache_sentinel`)?(q=(0,Q.jsx)(Rt,{className:`icon-xs`}),t[39]=q):q=t[39];let J;t[40]!==S||t[41]!==W||t[42]!==G?(J=(0,Q.jsx)(Zn,{ariaLabel:W,disabled:G,shortcut:S,tooltipContent:K,onClick:Yn,children:q}),t[40]=S,t[41]=W,t[42]=G,t[43]=J):J=t[43];let Y;t[44]===c?Y=t[45]:(Y=c.formatMessage(Qn.navigateForward),t[44]=c,t[45]=Y);let X=!_,te;t[46]===Symbol.for(`react.memo_cache_sentinel`)?(te=(0,Q.jsx)(k,{...Qn.navigateForward}),t[46]=te):te=t[46];let ne;t[47]===Symbol.for(`react.memo_cache_sentinel`)?(ne=(0,Q.jsx)(Rt,{className:`icon-xs -scale-x-100`}),t[47]=ne):ne=t[47];let re;t[48]!==C||t[49]!==Y||t[50]!==X?(re=(0,Q.jsx)(Zn,{ariaLabel:Y,disabled:X,shortcut:C,tooltipContent:te,onClick:Jn,children:ne}),t[48]=C,t[49]=Y,t[50]=X,t[51]=re):re=t[51];let ie;t[52]!==J||t[53]!==re?(ie=(0,Q.jsx)(dt,{electron:!0,extension:!0,children:(0,Q.jsxs)(Q.Fragment,{children:[J,re]})}),t[52]=J,t[53]=re,t[54]=ie):ie=t[54];let ae;return t[55]!==U||t[56]!==ie?(ae=(0,Q.jsxs)(`div`,{className:`flex items-center gap-1`,children:[U,ie]}),t[55]=U,t[56]=ie,t[57]=ae):ae=t[57],ae}function Jn(){return pt(`navigateForward`,`sidebar_forward`)}function Yn(){return pt(`navigateBack`,`sidebar_back`)}function Xn(e){return e.has_unread_turn}function Zn(e){let t=(0,$.c)(17),{ariaLabel:n,children:r,disabled:i,onClick:a,onPointerEnter:o,onPointerLeave:s,shortcut:c,tooltipContent:l,tooltipDisabled:u,viewTransitionName:d}=e,f=i===void 0?!1:i,p=u===void 0?!1:u,m;t[0]===d?m=t[1]:(m=d==null?void 0:{viewTransitionName:d},t[0]=d,t[1]=m);let h;t[2]!==n||t[3]!==r||t[4]!==f||t[5]!==a||t[6]!==o||t[7]!==s||t[8]!==m?(h=(0,Q.jsx)(L,{"aria-label":n,color:`ghost`,disabled:f,style:m,size:`toolbar`,uniform:!0,onClick:a,onPointerEnter:o,onPointerLeave:s,children:r}),t[2]=n,t[3]=r,t[4]=f,t[5]=a,t[6]=o,t[7]=s,t[8]=m,t[9]=h):h=t[9];let g;return t[10]!==o||t[11]!==s||t[12]!==c||t[13]!==h||t[14]!==l||t[15]!==p?(g=(0,Q.jsx)(P,{disabled:p,tooltipContent:l,onPointerEnter:o,onPointerLeave:s,shortcut:c,children:h}),t[10]=o,t[11]=s,t[12]=c,t[13]=h,t[14]=l,t[15]=p,t[16]=g):g=t[16],g}var Qn=A({navigateBack:{id:`codex.command.navigateBack`,defaultMessage:`Back`,description:`Command menu item to navigate back`},navigateForward:{id:`codex.command.navigateForward`,defaultMessage:`Forward`,description:`Command menu item to navigate forward`}});function $n(){let{platform:e}=nt();return(e===`windows`||e===`linux`)&&window.electronBridge?.showApplicationMenu!=null}var er=A({file:{id:`windowsMenuBar.file`,defaultMessage:`File`,description:`Label for the File menu in the Windows custom title bar`},edit:{id:`windowsMenuBar.edit`,defaultMessage:`Edit`,description:`Label for the Edit menu in the Windows custom title bar`},view:{id:`windowsMenuBar.view`,defaultMessage:`View`,description:`Label for the View menu in the Windows custom title bar`},window:{id:`windowsMenuBar.window`,defaultMessage:`Window`,description:`Label for the Window menu in the Windows custom title bar`},help:{id:`windowsMenuBar.help`,defaultMessage:`Help`,description:`Label for the Help menu in the Windows custom title bar`}}),tr=[{id:t.file,message:er.file},{id:t.edit,message:er.edit},{id:t.view,message:er.view},{id:t.window,message:er.window},{id:t.help,message:er.help}];function nr(){let e=D(),t=$n(),{platform:p}=nt(),h=p===`linux`&&typeof window.electronBridge?.getApplicationMenuItems==`function`,[n,r]=(0,Z.useState)(null),[m,g]=(0,Z.useState)([]),[_,v]=(0,Z.useState)(null),y=(0,Z.useRef)(0);if((0,Z.useEffect)(()=>{if(!h||!n)return;let e=e=>{e.key===`Escape`&&r(null)},t=e=>{let t=document.getElementById(`linux-application-menu-panel`);t&&!t.contains(e.target)&&!e.target.closest(`[data-linux-menu-trigger=true]`)&&r(null)};return document.addEventListener(`keydown`,e),document.addEventListener(`mousedown`,t),()=>{document.removeEventListener(`keydown`,e),document.removeEventListener(`mousedown`,t)}},[h,n]),!t)return null;let b=e=>e?e.replace(/CommandOrControl|CmdOrCtrl/g,`Ctrl`).replace(/Command/g,`Ctrl`).replace(/Control/g,`Ctrl`):``,x=async(e,t)=>{if(h){if(n===e){r(null);return}let i=t.currentTarget.getBoundingClientRect(),a=y.current+1;y.current=a,r(e),g([]);let o=await window.electronBridge.getApplicationMenuItems(e);y.current===a&&(v({left:Math.round(i.left),top:Math.round(i.bottom)}),g(o?.items??[]))}else{let n=window.electronBridge?.showApplicationMenu;if(!n)return;let i=y.current+1;y.current=i,r(e);let a=t.currentTarget.getBoundingClientRect();try{await n(e,Math.round(a.left),Math.round(a.bottom))}finally{y.current===i&&r(null)}}},S=async e=>{e.enabled!==!1&&n&&(await window.electronBridge?.clickApplicationMenuItem?.(n,e.path),r(null))},C=`no-drag rounded-md border border-transparent px-2.5 py-1 text-base font-normal leading-none outline-none transition-colors`,w=t=>c(C,n===t?`bg-[var(--color-token-menubar-selection-background)] text-[var(--color-token-menubar-selection-foreground)]`:`text-token-text-tertiary hover:bg-token-foreground/5 hover:text-token-description-foreground focus-visible:bg-token-foreground/5 focus-visible:text-token-description-foreground`);return(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`div`,{className:`flex items-center gap-0.5 pr-2 pl-1`,children:tr.map(({id:t,message:i})=>(0,Q.jsx)(`button`,{type:`button`,"data-linux-menu-trigger":h?`true`:void 0,"aria-expanded":n===t,"aria-haspopup":`menu`,"aria-label":e.formatMessage(i),className:w(t),onClick:e=>{x(t,e)},children:(0,Q.jsx)(k,{...i})},t))}),h&&n&&_&&(0,Q.jsx)(`div`,{id:`linux-application-menu-panel`,className:`no-drag fixed z-50 m-px flex min-w-[220px] flex-col rounded-xl bg-token-dropdown-background/90 p-1 text-token-foreground shadow-lg ring-[0.5px] ring-token-border backdrop-blur-sm select-none`,style:{left:_.left,top:_.top},children:m.map(t=>t.type===`separator`?(0,Q.jsx)(`div`,{className:`mx-1 my-1 border-t border-token-border/60`,role:`separator`},t.path):(0,Q.jsx)(`button`,{type:`button`,className:c(`flex w-full items-center gap-3 rounded-lg p-1.5 text-left text-sm outline-none transition-colors`,t.enabled===!1?`cursor-default opacity-50`:`cursor-interaction hover:bg-token-list-hover-background focus:bg-token-list-hover-background`),disabled:t.enabled===!1,onClick:()=>{S(t)},children:(0,Q.jsxs)(`span`,{className:`flex w-full items-center gap-3`,children:[(0,Q.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:t.label}),t.accelerator?(0,Q.jsx)(`span`,{className:`shrink-0 pl-4 text-xs text-token-text-tertiary tabular-nums`,children:b(t.accelerator)}):null]})},t.path))})]})}var rr=280,ir=`app-shell:bottom-panel-height`;function ar(e,t){return Number.isFinite(e)?Math.max(160,Math.min(e,t*.5)):rr}function or(e){return ar(j(ir,280),e)}function sr(e,t){M(ir,ar(e,t))}function cr(e){let t=(0,$.c)(10),{size:n,animation:r,isVisible:i}=e,[,a]=(0,Z.useState)(0),o;t[0]!==r||t[1]!==a?(o=()=>{r.get()>0||a(ur)},t[0]=r,t[1]=a,t[2]=o):o=t[2],Gt(r,`animationComplete`,o);let s;t[3]!==r||t[4]!==n?(s=[r,n],t[3]=r,t[4]=n,t[5]=s):s=t[5];let c=Xt(s,lr),l=i||r.get()>0,u;return t[6]!==c||t[7]!==r||t[8]!==l?(u={isMounted:l,animatedSize:c,opacity:r,progress:r},t[6]=c,t[7]=r,t[8]=l,t[9]=u):u=t[9],u}function lr(e){let[t,n]=e;return Math.max(0,Math.min(1,t))*n}function ur(e){return e+1}function dr({bottomPanelHeight:e,children:t,clampedBottomPanelHeight:n,mainContentHeight:r,isVisible:i=!1}){let a=v(I),{isMounted:o,opacity:s,animatedSize:c}=cr({animation:y(Ye),size:n,isVisible:i}),l=Jt`${n}px`;return!o&&!i?null:(0,Q.jsxs)(U.div,{"data-app-shell-focus-area":`bottom-panel`,className:`relative z-30 min-h-0 w-full shrink-0 overflow-visible`,style:{opacity:s,height:c},transition:Ke,children:[(0,Q.jsx)(Bn,{defaultSize:280,edge:`top`,getCurrentSize:()=>n.get(),setSize:t=>{if(t{em==null?null:ot.getSnapshot(m.conversationId,m.browserTabId),e[7]=m,e[8]=_);let b=_,x=(0,Z.useSyncExternalStore)(gr,b,b)?.tabType===n.WEB?m:null,S=x?.conversationId??null,w=x?.browserTabId??null,T,D;e[9]!==g||e[10]!==a||e[11]!==c||e[12]!==h||e[13]!==o||e[14]!==S||e[15]!==w?(T=()=>{C.dispatchMessage(`app-shell-shortcut-state-changed`,{bottomPanelCanCloseActiveTab:g,focusArea:a,imagePreviewOpen:c,terminalFocused:o,rightPanelBrowserConversationId:S,rightPanelBrowserTabId:w,rightPanelCanCloseActiveTab:h})},D=[g,a,c,o,h,S,w],e[9]=g,e[10]=a,e[11]=c,e[12]=h,e[13]=o,e[14]=S,e[15]=w,e[16]=T,e[17]=D):(T=e[16],D=e[17]),(0,Z.useEffect)(T,D);let O;e[18]===Symbol.for(`react.memo_cache_sentinel`)?(O=[],e[18]=O):O=e[18],(0,Z.useEffect)(mr,O);let k;e[19]===Symbol.for(`react.memo_cache_sentinel`)?(k=[],e[19]=k):k=e[19],E(`image-preview-zoom-command`,pr,k);let A,j;return e[20]!==s||e[21]!==f||e[22]!==t?(A=e=>{let{panelId:n}=e;bb80:switch(n){case`bottom`:at.closeActiveTab(t);break bb80;case`right`:if(rt.closeActiveTab(t))break bb80;f!=null&&s!=null&&rt.closeTab(t,s.tabId)}},j=[s,f,t],e[20]=s,e[21]=f,e[22]=t,e[23]=A,e[24]=j):(A=e[23],j=e[24]),E(`close-active-app-shell-tab`,A,j),null}function pr(e){let{command:t}=e;Ht(t)}function mr(){return hr}function hr(){C.dispatchMessage(`app-shell-shortcut-state-changed`,{bottomPanelCanCloseActiveTab:!1,focusArea:`main`,imagePreviewOpen:!1,terminalFocused:!1,rightPanelBrowserConversationId:null,rightPanelBrowserTabId:null,rightPanelCanCloseActiveTab:!1})}function gr(e){return ot.subscribe(e)}var _r=`[&_a]:pointer-events-auto [&_button]:pointer-events-auto [&_input]:pointer-events-auto [&_select]:pointer-events-auto [&_textarea]:pointer-events-auto`;function vr({isHeaderEdgeScroll:e,isWindowsMenuBarEnabled:t}){let{headerLeftWidth:n,headerRightWidth:r,leftPanelAnimatedWidth:i,rightPanelAnimatedWidth:a,leftPanelWidth:lp}=Je(),flw=y(Wr),fls=y(Ze),o=Kt(0),s=Jt`${i}px`,l=Jt`${a}px`,u=y(fe),d=y(et),f=y(be),p=y(ce),m=y(ye),h=y(xe),g=d.filter(({align:e})=>e===`start`),_=d.filter(({align:e})=>e===`end`),v=d.length>0,b=g.length>0,x=_.length>0,S=m.length>0,C=u!=null||v;return(0,Q.jsx)(Ct,{items:f,children:(0,Q.jsxs)(U.header,{"data-app-shell-header-edge-scroll":e,className:c(`app-header-tint draggable pointer-events-none fixed z-30 flex h-toolbar min-w-0 items-center`,t?`right-0`:`inset-x-0`,t?`top-toolbar-sm`:`top-0`),style:t?{left:flw&&!fls?`${Math.max(lp.get(),i.get())}px`:s}:{},children:[(0,Q.jsx)(yr,{entries:p,fitWidth:n,slotWidth:t?o:i,side:`start`}),C&&(0,Q.jsxs)(`div`,{"aria-hidden":h,"data-testid":`app-shell-header-context-menu-surface`,className:c(`pointer-events-none ms-4 flex h-full min-w-0 flex-1 isolate items-center gap-1.5 overflow-hidden [contain:layout_paint]`,h&&`invisible`,S?`pe-1.5`:`pe-2`),children:[u!=null&&(0,Q.jsx)(`div`,{className:c(`pointer-events-none w-full min-w-0 flex-1`,_r),children:u}),b&&(0,Q.jsx)(`div`,{className:`flex shrink-0 items-center gap-1.5`,children:g.map(({actionId:e,node:t})=>(0,Q.jsx)(`div`,{className:`no-drag pointer-events-auto flex shrink-0 items-center`,children:t},e))}),x&&(0,Q.jsx)(`div`,{className:`ms-auto flex shrink-0 items-center gap-1.5`,children:_.map(({actionId:e,node:t})=>(0,Q.jsx)(`div`,{className:`no-drag pointer-events-auto flex shrink-0 items-center`,children:t},e))})]}),(0,Q.jsx)(yr,{entries:m,fitWidth:r,slotWidth:l,side:`end`})]})})}function yr({entries:e,fitWidth:t,side:n,slotWidth:r}){let i=e.some(({align:e})=>e===`end`),a=c({"ps-[max(var(--spacing-token-safe-header-left),0.5rem)]":n===`start`,"pe-2":n===`start`&&i||n===`end`}),o=At(e=>{let{width:n}=kt(e);t.set(n)});return(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`div`,{"aria-hidden":!0,className:c(`invisible pointer-events-none fixed top-0 left-0 min-w-max [&_*]:![view-transition-name:none]`,!!e.length&&a),ref:o,children:(0,Q.jsx)(br,{entries:e})}),(0,Q.jsx)(U.div,{"data-test-id":`header-shell-slot`,className:c(`pointer-events-none relative h-full shrink-0 [container-type:inline-size]`,!!e.length&&a),style:{width:r,minWidth:Jt`${t}px`},children:(0,Q.jsx)(br,{entries:e,fillSlot:!0})})]})}function br(e){let t=(0,$.c)(11),{entries:n,fillSlot:r}=e,i=r===void 0?!1:r,a,o,s;if(t[0]!==n||t[1]!==i){let e=n.filter(wr),r=n.filter(Cr),l=i?`pointer-events-none w-full`:`no-drag pointer-events-auto w-auto`;t[5]===l?a=t[6]:(a=c(`inline-flex h-full items-center gap-1.5`,l),t[5]=l,t[6]=a),o=e.map(Sr),s=r.map(xr),t[0]=n,t[1]=i,t[2]=a,t[3]=o,t[4]=s}else a=t[2],o=t[3],s=t[4];let l;return t[7]!==a||t[8]!==o||t[9]!==s?(l=(0,Q.jsxs)(`div`,{className:a,children:[o,s]}),t[7]=a,t[8]=o,t[9]=s,t[10]=l):l=t[10],l}function xr(e,t){let{actionId:n,node:r}=e;return(0,Q.jsx)(`div`,{className:c(`no-drag pointer-events-auto flex shrink-0 items-center`,t===0&&`ms-auto`),children:r},n)}function Sr(e){let{actionId:t,node:n}=e;return(0,Q.jsx)(`div`,{className:`no-drag pointer-events-auto flex shrink-0 items-center`,children:n},t)}function Cr(e){let{align:t}=e;return t===`end`}function wr(e){let{align:t}=e;return t===`start`}function Tr({children:e,paddingTop:t}){let n=v(w),{leftPanelAnimatedWidth:r,leftPanelWidth:i}=Je(),[a,o]=(0,Z.useState)(!1),s=y(qe),l=Jt`${i}px`;return(0,Q.jsxs)(U.aside,{className:c(`app-shell-left-panel pointer-events-auto relative flex overflow-visible browser:bg-token-main-surface-primary`,a&&`cursor-col-resize`),style:{width:r,paddingTop:t},children:[(0,Q.jsx)(U.div,{className:`max-w-full overflow-hidden`,style:{minWidth:l,width:l,opacity:y(Oe)},children:e}),(0,Q.jsx)(Bn,{disabled:s,defaultSize:300,getCurrentSize:()=>i.get(),onResizingChange:o,setSize:e=>{if(e{e{f.set(f.get()+1)}),!h&&!t?null:(0,Q.jsxs)(U.aside,{"data-app-shell-focus-area":`right-panel`,className:`relative z-[41] ml-auto h-full min-h-0 min-w-0 shrink-0 overflow-visible`,style:{opacity:g,width:_},transition:Ke,children:[!p&&(0,Q.jsx)(`div`,{"aria-hidden":!0,className:`pointer-events-none absolute inset-y-0 left-0 z-30 w-px shadow-[-8px_0_16px_-8px_rgb(0_0_0/0.18)]`}),!p&&(0,Q.jsx)(Bn,{defaultSize:l??u.defaultWidth,edge:`left`,getCurrentSize:()=>r.get(),setSize:e=>{if(e{e{let[t,r]=e;return n?t:Qe(r,t,o)},t[3]=n,t[4]=o,t[5]=c):c=t[5];let l=Xt(s,c),u;t[6]!==i||t[7]!==l?(u=[i,l],t[6]=i,t[7]=l,t[8]=u):u=t[8];let d;t[9]===n?d=t[10]:(d=e=>{let[t,r]=e;return n?0:Math.max(0,Math.min(1,t))*r},t[9]=n,t[10]=d);let f=Xt(u,d),p;return t[11]!==f||t[12]!==l||t[13]!==a||t[14]!==o?(p={rightPanelAnimatedWidth:f,rightPanelWidth:l,rightPanelWidthRatio:a,widthMode:o},t[11]=f,t[12]=l,t[13]=a,t[14]=o,t[15]=p):p=t[15],p}function Ar(e,t){let n=(0,Z.useRef)(null);if(n.current!=null&&n.current.defaultWidth===e.defaultWidth&&n.current.storageKey===e.storageKey)return n.current.widthRatio;let r=K(Re({...e,mainContentWidth:t.get()}));return n.current={...e,widthRatio:r},r}function jr(e){let t=(0,$.c)(30),{children:n}=e,r=v(I),i;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(i={activationConstraint:{distance:6}},t[0]=i):i=t[0];let a=d(u(f,i)),[o,s]=(0,Z.useState)(null),c=(0,Z.useRef)(null),l;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(l=(e,t)=>{s(n=>n==null?n:ln(n,e,t))},t[1]=l):l=t[1];let m=l,h;t[2]===r?h=t[3]:(h=e=>{let t=Nr(e.active.data.current);if(t?.kind!==`app-shell-tab`)return;let n=r.get(t.controller.tabs$),i=n.findIndex(e=>e.tabId===t.tabId),a=n[i]??null;a!=null&&(c.current={sourceController:t.controller,sourceIndex:i,tabId:t.tabId},s({draggedTab:a,isDraggedTabActive:r.get(t.controller.activeTab$)?.tabId===t.tabId,overTabId:null,previewController:t.controller,sourceController:t.controller}))},t[2]=r,t[3]=h);let _=h,y;t[4]!==o||t[5]!==r?(y=e=>{let t=c.current;if(o==null||t==null)return;let n=Nr(e.over?.data.current);if(n!=null)if(n.kind===`app-shell-tab`){if(n.tabId===t.tabId)return;if(n.controller===t.sourceController){cn(r,t.sourceController,t.tabId,n.tabId),m(t.sourceController,null);return}m(n.controller,n.tabId)}else m(n.controller,null)},t[4]=o,t[5]=r,t[6]=y):y=t[6];let b=y,x;t[7]!==o||t[8]!==r?(x=e=>{let t=c.current;o!=null&&t!=null&&(sn(r,t),o.isDraggedTabActive&&t.sourceController.activateTab(r,t.tabId)),s(null),c.current=null},t[7]=o,t[8]=r,t[9]=x):x=t[9];let S=x,C;t[10]!==o||t[11]!==r?(C=e=>{let t=c.current;o!=null&&t!=null&&e.over==null?(sn(r,t),o.isDraggedTabActive&&t.sourceController.activateTab(r,t.tabId)):o!=null&&t!=null&&o.previewController!==t.sourceController&&(t.sourceController.moveTabTo(r,t.tabId,o.previewController,o.overTabId,{activate:!1}),o.isDraggedTabActive&&o.previewController.activateTab(r,t.tabId)),s(null),c.current=null},t[10]=o,t[11]=r,t[12]=C):C=t[12];let w=C,T;t[13]===o?T=t[14]:(T={dragState:o},t[13]=o,t[14]=T);let E;t[15]===o?E=t[16]:(E=o==null?null:(0,Q.jsx)(Mr,{dragState:o}),t[15]=o,t[16]=E);let D;t[17]===E?D=t[18]:(D=(0,Q.jsx)(p,{adjustScale:!1,children:E}),t[17]=E,t[18]=D);let O;t[19]!==n||t[20]!==S||t[21]!==w||t[22]!==b||t[23]!==_||t[24]!==a||t[25]!==D?(O=(0,Q.jsxs)(g,{sensors:a,collisionDetection:Pr,onDragStart:_,onDragOver:b,onDragCancel:S,onDragEnd:w,children:[n,D]}),t[19]=n,t[20]=S,t[21]=w,t[22]=b,t[23]=_,t[24]=a,t[25]=D,t[26]=O):O=t[26];let k;return t[27]!==O||t[28]!==T?(k=(0,Q.jsx)(on.Provider,{value:T,children:O}),t[27]=O,t[28]=T,t[29]=k):k=t[29],k}function Mr(e){let t=(0,$.c)(12),{dragState:n}=e,{highlightedIcon:r,icon:i,isClosable:a,isHighlighted:o,isLabel:s,isPreview:c,tabId:l,title:u,tooltip:d,trailingContent:f}=n.draggedTab,p;return t[0]!==n.isDraggedTabActive||t[1]!==r||t[2]!==i||t[3]!==a||t[4]!==o||t[5]!==s||t[6]!==c||t[7]!==l||t[8]!==u||t[9]!==d||t[10]!==f?(p=(0,Q.jsx)(`div`,{className:`relative my-auto flex max-w-40 shrink-0 items-center gap-0.5 pe-1`,children:(0,Q.jsx)(tn,{id:l,highlightedIcon:r,icon:i,isActive:n.isDraggedTabActive,isClosable:a,isDragging:!0,isHighlighted:o,isLabel:s,isPreview:c,trailingContent:f,title:u,tooltip:d})}),t[0]=n.isDraggedTabActive,t[1]=r,t[2]=i,t[3]=a,t[4]=o,t[5]=s,t[6]=c,t[7]=l,t[8]=u,t[9]=d,t[10]=f,t[11]=p):p=t[11],p}function Nr(e){if(typeof e!=`object`||!e)return null;switch(Reflect.get(e,`kind`)){case`app-shell-tab`:case`app-shell-tab-strip`:return e;default:return null}}function Pr(e){let t=h(e),n=t.filter(e=>Nr(e.data?.droppableContainer.data.current)?.kind===`app-shell-tab`);if(n.length>0)return n;let r=t.find(e=>Nr(e.data?.droppableContainer.data.current)?.kind===`app-shell-tab-strip`)??null,i=r==null?null:Nr(r.data?.droppableContainer.data.current);if(r!=null&&i?.kind===`app-shell-tab-strip`){let t=e.droppableContainers.filter(e=>{let t=Nr(e.data.current);return t?.kind===`app-shell-tab`&&t.controller===i.controller});return t.length>0?l({...e,droppableContainers:t}):[r]}return l(e)}var Fr=`data-app-shell-focus-area`,Ir=96,Lr=16,Rr=960,zr=720,Br=12,Vr=0,Hr=b(w,({get:e})=>{let t=e(zn.px$);return t!=null&&t>=0&&t<=Br}),Ur=b(w,({get:e})=>{let t=e(zn.px$),n=e(Ue)-Vr;return t!=null&&t>=0&&t<=n}),Wr=S(I,!1,{onMount:(e,t)=>{let n=!1,r,i;e(!1);let a=t.watch(({get:a})=>{if(a(Ze)){n=!1,r=void 0,i=void 0,e(!1);return}if(a(qe)){e(!1);return}let o=a(zn.px$),s=a(zn.py$),c=a(Hr),l=a(Ur),u=a(Le),d=a(Ne);if(u){d&&(n=!0);let a=r!==void 0&&i!==void 0&&(o!==r||s!==i);r===void 0&&(r=o,i=s),(a||n&&!d)&&!c&&!d&&(n=!1,r=void 0,i=void 0,t.set(Le,!1)),e(!1);return}n=!1,r=void 0,i=void 0;let f=a(ze);e(e=>{let t=e?l||f:c||f;return e===t?e:t})});return()=>{e(!1),a()}}});function Gr({bottomPanelSlot:e,children:t,leftPanelSlot:n,rightPanelSlot:r}){let i=v(I),a=(0,Z.useRef)(null),[o,s]=(0,Z.useState)(null),l=n?.children,u=l!=null,d=e!=null,f=r!=null,p=(0,Z.useRef)(!1),m=(0,Z.useRef)(!1),h=y(xe),g=y(se),_=N(),b=zt(),x=$n(),[S,C]=(0,Z.useState)(!1),w=y(Ze),T=y(R),E=y(Wr),D=g===`thread-edge-scroll`,O=u&&w,k=D&&S&&!h,A=g===`full-bleed`,j=`visible`;A?j=`hidden`:D?j=`full-bleed`:f&&(j=`hidden`);let M=Kt(ae()),ee=Xt(M,e=>`${Math.max(0,e-Vr*2)}px`),{isMounted:P,animatedSize:F}=cr({animation:y(Oe),size:M,isVisible:O}),L=Kt(window.innerWidth),z=Kt(window.innerHeight-46),B=Kt(or(z.get())),V=y(Ye),H=Xt([B,z],([e,t])=>ar(e,t)),W=Xt([V,H],([e,t])=>e*t),G=Jt`${W}px`,K=Kt(0),q=Kt(0),J=Kt(0),Y=Xt([L,F],([e,t])=>Math.max(0,e-t)),{rightPanelAnimatedWidth:X,rightPanelWidth:ne,rightPanelWidthRatio:ie,widthMode:oe}=kr({isFullWidth:h,mainContentWidth:Y}),ce=Xt([L,ie],([e,t])=>Ee({isRightPanelOpen:f,mainContentWidth:e,rightPanelWidthMode:oe,rightPanelWidthRatio:t})),le=Xt([L,M,ie],([e,t,n])=>Ee({isRightPanelOpen:f,mainContentWidth:Math.max(0,e-t),rightPanelWidthMode:oe,rightPanelWidthRatio:n})),ue=O?le:ce,de=(0,Z.useRef)(W.get()),fe=(0,Z.useRef)(new Set),pe={"--spacing-token-safe-header-left":`${b.left/_}px`,"--spacing-token-safe-header-right":`${b.right/_}px`,width:`calc(100vw / var(--codex-window-zoom))`,height:`calc(100vh / var(--codex-window-zoom))`,zoom:`var(--codex-window-zoom)`,"--app-shell-bottom-panel-height":G},me=(0,Z.useMemo)(()=>({headerLeftWidth:q,headerRightWidth:J,leftPanelWidth:M,leftPanelAnimatedWidth:F,mainContentTargetWidth:ue,mainContentWidth:Y,shellWidth:L,rightPanelAnimatedWidth:X,rightPanelLayoutTick:K}),[q,J,F,M,ue,Y,X,K,L]),he=u,ge=(0,Z.useCallback)(e=>(fe.current.add(e),()=>{fe.current.delete(e)}),[]),_e=St(({width:e})=>{L.set(e);let t=e<=Rr,n=e<=zr,r=t!==p.current,a=n!==m.current;!r&&!a||(p.current=t,m.current=n,(r&&O&&f&&t||a&&n)&&(i.get(te)===`right-panel`&&Me(i,`main`),i.get(xe)&&i.set(xe,!1),i.get(Te)&&$e(i,!1)),a&&n&&i.get(Ze)&&re(i,!1))}),ve=At(e=>{let{width:t}=kt(e);_e({width:t})}),ye=At(e=>{let{width:t}=kt(e);C(t>=Zr())}),be=At(e=>{let{height:t}=kt(e);z.set(t)}),Se=(0,Z.useCallback)(e=>{s(e)},[]),Ce=(0,Z.useMemo)(()=>Lt(Se,be),[be,Se]);return Gt(W,`change`,e=>{let t=e-de.current;if(de.current=e,t!==0)for(let e of fe.current)e(t)}),(0,Q.jsx)(Er.Provider,{value:a,children:(0,Q.jsx)(Dr.Provider,{value:o,children:(0,Q.jsx)(Bt.Provider,{value:ge,children:(0,Q.jsxs)(Ie.Provider,{value:me,children:[(0,Q.jsx)(En,{}),(0,Q.jsx)(fr,{}),(0,Q.jsxs)(U.div,{ref:a,style:pe,className:`relative flex flex-col`,onBlurCapture:e=>{e.relatedTarget instanceof Node&&e.currentTarget.contains(e.relatedTarget)||(Me(i,`main`),Be(i,!1))},onFocusCapture:e=>{Me(i,Yr(e.target)),Be(i,Xr(e.target))},onPointerOverCapture:e=>{Xe(i,Yr(e.target))},children:[x&&(0,Q.jsx)(Qr,{}),(0,Q.jsxs)(`div`,{ref:ve,className:`relative isolate flex max-h-full min-h-0 w-full flex-1`,children:[(0,Q.jsx)(tt,{initial:!1,children:u&&(O||P)&&(0,Q.jsx)(Tr,{paddingTop:x?`0px`:`var(--height-toolbar)`,children:l},`app-shell-left-panel`)}),he&&!w&&!P&&(0,Q.jsx)(Kr,{floatingLeftPanelWidth:ee,isWindowsMenuBarEnabled:x,isVisible:E&&!w&&!P,leftPanelWidth:M,leftPanel:l,shouldUseReducedMotion:T,onOpenSidebar:()=>{re(i,!0,{animate:!1})}}),(0,Q.jsx)(`main`,{ref:Ce,className:c(`relative isolate flex min-h-0 flex-1 flex-col`,`main-surface`,P&&`rounded-s-2xl`,!P&&`!rounded-l-none`),children:(0,Q.jsxs)(jr,{children:[(0,Q.jsx)(vr,{isHeaderEdgeScroll:k,isWindowsMenuBarEnabled:x}),(0,Q.jsxs)(`div`,{className:`relative isolate flex min-h-0 flex-1 overflow-hidden`,children:[(0,Q.jsx)(`div`,{"data-app-shell-main-content-layout":g,ref:ye,className:c(`app-shell-main-content-viewport relative flex min-h-0 min-w-0 flex-col`,h?`w-0 flex-none overflow-hidden`:`flex-1`),children:(0,Q.jsx)(`div`,{className:c(`app-shell-main-content-frame relative mt-(--app-shell-main-content-frame-top-offset) flex min-h-0 flex-1 flex-col border-t`,f||D&&!k?`border-token-border-default`:`border-transparent`),children:(0,Q.jsxs)(`div`,{className:`relative flex min-h-0 flex-1`,children:[(0,Q.jsx)(`div`,{"aria-hidden":!0,"data-app-shell-main-content-top-fade":j,className:`app-shell-main-content-top-fade pointer-events-none absolute inset-x-0 top-0 z-20 h-4 bg-gradient-to-b from-token-main-surface-primary opacity-0 transition-opacity duration-200 browser:hidden`}),(0,Q.jsx)(`div`,{className:`h-full min-h-0 min-w-0 flex-1`,children:t})]})})}),(0,Q.jsx)(Or,{isRightPanelOpen:f,mainContentWidth:Y,rightPanelWidth:ne,rightPanelWidthRatio:ie,widthMode:oe,children:r?.children},`right-panel:${i.value.pathname}`)]}),(0,Q.jsx)(dr,{bottomPanelHeight:B,clampedBottomPanelHeight:H,mainContentHeight:z,isVisible:d,children:(0,Q.jsx)(Jr,{})})]})})]})]})]})})})})}function Kr(e){let t=(0,$.c)(15),{floatingLeftPanelWidth:n,isWindowsMenuBarEnabled:r,isVisible:i,leftPanel:a,leftPanelWidth:o,shouldUseReducedMotion:s,onOpenSidebar:l}=e,u=v(w),[d,f]=(0,Z.useState)(!1),p=i||d,m;t[0]===s?m=t[1]:(m=s?{duration:0}:Ke,t[0]=s,t[1]=m);let h=m,g;t[2]!==n||t[3]!==p||t[4]!==d||t[5]!==r||t[6]!==a||t[7]!==o||t[8]!==l||t[9]!==u||t[10]!==s||t[11]!==h?(g=p?(0,Q.jsxs)(U.div,{className:c(`pointer-events-auto fixed bottom-0 left-0 z-40 min-h-0`,d&&`cursor-col-resize`,r?`top-toolbar-sm`:`top-0`),initial:s?!1:{opacity:0,x:-8},animate:{opacity:1,x:0},exit:{opacity:0,x:s?0:-8},style:{width:n,zIndex:40},transition:h,children:[(0,Q.jsxs)(`aside`,{"data-testid":`app-shell-floating-left-panel`,className:`flex h-full min-h-0 flex-col overflow-hidden rounded-lg bg-token-main-surface-primary shadow-[1px_0_0_0_var(--color-token-border-default),0_20px_25px_-5px_rgb(0_0_0/0.1),0_8px_10px_-6px_rgb(0_0_0/0.1)]`,children:[r?null:(0,Q.jsx)(U.div,{initial:s?!1:{x:8},animate:{x:0},exit:{x:s?0:8},transition:h,className:`app-header-tint flex h-toolbar shrink-0 items-center ps-(--spacing-token-safe-header-left) pe-2`,children:(0,Q.jsx)(qn,{hideUnreadBadge:!0,onToggleSidebar:l})}),(0,Q.jsx)(`div`,{className:`min-h-0 flex-1 overflow-hidden`,children:a})]}),(0,Q.jsx)(Bn,{defaultSize:300,getCurrentSize:()=>o.get(),onResizingChange:f,setSize:e=>{let t=ie(e);u.set(Ue,t),o.set(t)},onResizeEnd:qr})]}):null,t[2]=n,t[3]=p,t[4]=d,t[5]=r,t[6]=a,t[7]=o,t[8]=l,t[9]=u,t[10]=s,t[11]=h,t[12]=g):g=t[12];let _;return t[13]===g?_=t[14]:(_=(0,Q.jsx)(tt,{initial:!1,children:g}),t[13]=g,t[14]=_),_}function qr(e){he(ie(e))}function Jr(){let e=(0,$.c)(5),t=y(at.activeTab$),n=y(me),r=y(ge),i=y(oe);if(t!=null){let t;return e[0]!==r||e[1]!==i?(t=(0,Q.jsx)(fn,{headerHeight:`pane`,afterList:r,afterListSticky:i,controller:at}),e[0]=r,e[1]=i,e[2]=t):t=e[2],t}let a;return e[3]===n?a=e[4]:(a=n==null?null:(0,Q.jsx)(Q.Fragment,{children:n}),e[3]=n,e[4]=a),a}function Yr(e){if(!(e instanceof HTMLElement))return`main`;let t=e.closest(`[${Fr}]`)?.getAttribute(Fr);return t===`right-panel`||t===`bottom-panel`?t:`main`}function Xr(e){return e instanceof HTMLElement&&e.closest(`[data-codex-terminal]`)!=null}function Zr(){let e=Number.parseFloat(getComputedStyle(document.documentElement).fontSize);return Number.isFinite(e)?Ir*e:Ir*Lr}function Qr(){let e=(0,$.c)(6),t=y(ct),n;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,Q.jsx)(qn,{}),e[0]=n):n=e[0];let r;e[1]===t?r=e[2]:(r=st(t)?(0,Q.jsx)(Pn,{}):null,e[1]=t,e[2]=r);let i;e[3]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,Q.jsx)(nr,{}),e[3]=i):i=e[3];let a;return e[4]===r?a=e[5]:(a=(0,Q.jsxs)(`div`,{className:`app-header-tint draggable group/windows-top-bar z-50 flex h-toolbar-sm items-center ps-(--spacing-token-safe-header-left) pe-0`,children:[n,r,i,(0,Q.jsx)(LinuxWindowControls,{})]}),e[4]=r,e[5]=a),a}function LinuxWindowControls(){let{platform:e}=nt(),t=window.electronBridge?.controlWindow;if(e!==`linux`||typeof t!=`function`)return null;let n=e=>()=>{void t(e)},[a,u]=(0,Z.useState)(!1),o=`no-drag cursor-interaction inline-flex h-7 w-7 shrink-0 items-center justify-center rounded-md border border-transparent bg-transparent p-0 outline-none transition-colors hover:bg-token-foreground/5 focus-visible:bg-token-foreground/5`,r=c(o,`text-token-text-tertiary hover:text-token-description-foreground focus-visible:text-token-description-foreground`),i=c(o,a?`text-token-charts-red`:`text-token-text-tertiary`);return(0,Q.jsxs)(`div`,{"data-linux-codex-window-controls":`true`,className:`no-drag ml-auto flex shrink-0 items-center gap-0.5 pe-2`,children:[(0,Q.jsx)(`button`,{type:`button`,className:r,onClick:n(`minimize`),"aria-label":`Minimize`,children:(0,Q.jsx)(`svg`,{className:`h-2.5 w-2.5`,viewBox:`0 0 10 10`,fill:`none`,"aria-hidden":`true`,children:(0,Q.jsx)(`path`,{d:`M0 5h10`,stroke:`currentColor`,strokeWidth:1})})}),(0,Q.jsx)(`button`,{type:`button`,className:r,onClick:n(`maximize`),"aria-label":`Maximize`,children:(0,Q.jsx)(`svg`,{className:`h-2.5 w-2.5`,viewBox:`0 0 10 10`,fill:`none`,"aria-hidden":`true`,children:(0,Q.jsx)(`rect`,{x:.5,y:.5,width:9,height:9,stroke:`currentColor`,strokeWidth:1})})}),(0,Q.jsx)(`button`,{type:`button`,className:i,onMouseEnter:()=>u(!0),onMouseLeave:()=>u(!1),onFocus:()=>u(!0),onBlur:()=>u(!1),onClick:n(`close`),"aria-label":`Close`,children:(0,Q.jsx)(`svg`,{className:`h-2.5 w-2.5`,viewBox:`0 0 10 10`,fill:`none`,"aria-hidden":`true`,children:(0,Q.jsx)(`path`,{d:`M1 1l8 8M9 1L1 9`,stroke:`currentColor`,strokeWidth:1})})})]})}function $r(e){return null}function ei(e){let{children:t}=e;return gi(v(I),fe,t),null}function ti(e){let t=(0,$.c)(23),{actionId:n,align:r,children:i,order:a,slotPosition:o}=e,s=r===void 0?`start`:r,c=a===void 0?0:a,l=o===void 0?`center`:o,u=v(I),d=ve[l],f;t[0]!==n||t[1]!==s||t[2]!==i||t[3]!==c||t[4]!==d.byId||t[5]!==u?(f=()=>{u.set(d.byId,n,{align:s,node:i,order:c})},t[0]=n,t[1]=s,t[2]=i,t[3]=c,t[4]=d.byId,t[5]=u,t[6]=f):f=t[6];let p;t[7]!==n||t[8]!==s||t[9]!==i||t[10]!==c||t[11]!==d||t[12]!==u?(p=[n,s,i,c,d,u],t[7]=n,t[8]=s,t[9]=i,t[10]=c,t[11]=d,t[12]=u,t[13]=p):p=t[13],(0,Z.useLayoutEffect)(f,p);let m;t[14]!==n||t[15]!==d.byId||t[16]!==d.ids$||t[17]!==u?(m=()=>(u.set(d.ids$,e=>e.includes(n)?e:[...e,n]),()=>{u.set(d.ids$,e=>e.filter(e=>e!==n)),u.set(d.byId,n,null)}),t[14]=n,t[15]=d.byId,t[16]=d.ids$,t[17]=u,t[18]=m):m=t[18];let h;return t[19]!==n||t[20]!==d||t[21]!==u?(h=[n,d,u],t[19]=n,t[20]=d,t[21]=u,t[22]=h):h=t[22],(0,Z.useLayoutEffect)(m,h),null}function ni(e){let t=(0,$.c)(8),n=v(I),r,i;t[0]!==e||t[1]!==n?(r=()=>{n.set(ne.byId,e.id,e)},i=[e,n],t[0]=e,t[1]=n,t[2]=r,t[3]=i):(r=t[2],i=t[3]),(0,Z.useLayoutEffect)(r,i);let a,o;return t[4]!==e.id||t[5]!==n?(a=()=>(n.set(ne.ids$,t=>t.includes(e.id)?t:[...t,e.id]),()=>{n.set(ne.ids$,t=>t.filter(t=>t!==e.id)),n.set(ne.byId,e.id,null)}),o=[e.id,n],t[4]=e.id,t[5]=n,t[6]=a,t[7]=o):(a=t[6],o=t[7]),(0,Z.useLayoutEffect)(a,o),null}function ri(e){return null}function ii(){let e=(0,$.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,Q.jsx)(Tn,{}),e[0]=t):t=e[0],t}function ai(e){let{children:t}=e;return gi(v(I),we,t),null}function oi(e){let t=(0,$.c)(9),{children:n,defaultWidth:r,widthStorageKey:i}=e,a=r===void 0?600:r,o=v(I),s;t[0]!==o||t[1]!==i?(s=i??ke(o.value.routeTemplate),t[0]=o,t[1]=i,t[2]=s):s=t[2];let c=s;gi(o,de,n);let l,u;return t[3]!==a||t[4]!==c||t[5]!==o||t[6]!==i?(l=()=>{if(!(a===600&&i==null))return o.set(X,{defaultWidth:a,storageKey:c}),()=>{o.set(X,null)}},u=[a,c,o,i],t[3]=a,t[4]=c,t[5]=o,t[6]=i,t[7]=l,t[8]=u):(l=t[7],u=t[8]),(0,Z.useLayoutEffect)(l,u),null}function si(e){let{children:t}=e;return gi(v(I),ue,t),null}function ci(e){let{children:t}=e;return gi(v(I),Se,t),null}function li(e){let{children:t}=e;return gi(v(I),Ce,t),null}function ui(){return null}function di(){let e=(0,$.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,Q.jsx)(Sn,{}),e[0]=t):t=e[0],t}function fi(e){let{children:t}=e;return gi(v(I),le,t),null}function pi(e){let{children:t}=e;return gi(v(I),ge,t),null}function mi(e){let{children:t}=e;return gi(v(I),oe,t),null}function hi(e){let{children:t}=e;return gi(v(I),me,t),null}function gi(e,t,n){let r=(0,$.c)(9),i,a;r[0]!==n||r[1]!==e||r[2]!==t?(i=()=>{e.set(t,n)},a=[n,e,t],r[0]=n,r[1]=e,r[2]=t,r[3]=i,r[4]=a):(i=r[3],a=r[4]),(0,Z.useLayoutEffect)(i,a);let o,s;r[5]!==e||r[6]!==t?(o=()=>()=>{e.set(t,null)},s=[e,t],r[5]=e,r[6]=t,r[7]=o,r[8]=s):(o=r[7],s=r[8]),(0,Z.useLayoutEffect)(o,s)}function _i(e){let t=(0,$.c)(3),{children:n}=e,r;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,Q.jsx)(wt,{debugName:`AppShellContent`,fillParent:!0}),t[0]=r):r=t[0];let i;return t[1]===n?i=t[2]:(i=(0,Q.jsx)(Z.Suspense,{fallback:r,children:n}),t[1]=n,t[2]=i),i}function vi(e){let t=(0,$.c)(4),{layout:n}=e,r=v(I),i,a;return t[0]!==n||t[1]!==r?(i=()=>(r.set(se,n),()=>{r.set(se,`default`)}),a=[n,r],t[0]=n,t[1]=r,t[2]=i,t[3]=a):(i=t[2],a=t[3]),(0,Z.useLayoutEffect)(i,a),null}function yi(e){let t=(0,$.c)(7),{children:n}=e,r;t[0]===n?r=t[1]:(r=bi(n),t[0]=n,t[1]=r);let{bottomPanelSlot:i,contentChildren:a,leftPanelSlot:o,rightPanelSlot:s}=r,c;return t[2]!==i||t[3]!==a||t[4]!==o||t[5]!==s?(c=(0,Q.jsx)(Gr,{bottomPanelSlot:i,leftPanelSlot:o,rightPanelSlot:s,children:a}),t[2]=i,t[3]=a,t[4]=o,t[5]=s,t[6]=c):c=t[6],c}function bi(e){let t=[],n,r,i;return Z.Children.forEach(e,(e,a)=>{if(xi(e)){r=e.props;return}if(Si(e)){i=e.props;return}if(Ci(e)){n=e.props;return}(0,Z.isValidElement)(e)?t.push({...e,key:e.key??`${a}`}):t.push(e)}),{bottomPanelSlot:n,contentChildren:t,leftPanelSlot:r,rightPanelSlot:i}}function xi(e){return(0,Z.isValidElement)(e)&&e.type===$r}function Si(e){return(0,Z.isValidElement)(e)&&e.type===ri}function Ci(e){return(0,Z.isValidElement)(e)&&e.type===ui}var wi={Root:(0,Z.memo)(yi),LeftPanel:$r,Content:(0,Z.memo)(_i),Header:(0,Z.memo)(ei),HeaderAction:(0,Z.memo)(ti),HeaderContextMenuItem:(0,Z.memo)(ni),MainContentLayout:(0,Z.memo)(vi),BottomPanel:ui,BottomPanelTabs:(0,Z.memo)(di),BottomPanelTabsEmptyState:(0,Z.memo)(fi),BottomPanelTabListAfter:(0,Z.memo)(pi),BottomPanelTabListAfterSticky:(0,Z.memo)(mi),BottomPanelOutlet:(0,Z.memo)(hi),RightPanel:ri,RightPanelTabs:(0,Z.memo)(ii),RightPanelTabsEmptyState:(0,Z.memo)(ai),RightPanelTabListAfter:(0,Z.memo)(si),RightPanelTabListAfterSticky:(0,Z.memo)(li),RightPanelTabListBefore:(0,Z.memo)(ci),RightPanelOutlet:(0,Z.memo)(oi)};export{Gt as C,Kt as S,On as _,qn as a,An as b,Wn as c,Ln as d,Rn as f,Nn as g,Pn as h,$n as i,Un as l,Fn as m,Dr as n,Gn as o,In as p,cr as r,Kn as s,wi as t,Bn as u,kn as v,En as x,Dn as y}; +import{s as e}from"./chunk-Bj-mKKzh.js";import{$n as t,Wr as n}from"./src-CYrn1fYL.js";import{k as r,pi as i,vt as a}from"./app-server-manager-signals-BOGyjFm3.js";import{n as o,t as s}from"./jsx-runtime-CiQ1k8xo.js";import{t as c}from"./clsx-BcPLHiun.js";import{a as l,d as u,f as d,i as f,n as p,p as m,s as h,t as g,u as _}from"./core.esm-D4TU2vSa.js";import{F as v,I as y,L as b,P as x,W as S,f as C,h as w,lt as T,p as E}from"./vscode-api-sUstfl-x.js";import{c as D,n as O,o as k,r as A}from"./lib-MoKmYgcO.js";import{l as j,p as M}from"./persisted-signal-Cx1QgqJn.js";import{E as ee}from"./codex-api-DRlZt5zW.js";import{n as N}from"./window-zoom-context-CSPQZGcc.js";import{t as P}from"./tooltip-BhXPONlb.js";import{i as F,t as I}from"./route-scope-BCJTBhwV.js";import{t as L}from"./button-Xd4Hy1MO.js";import{r as R}from"./reduced-motion-preference-BEImGcUg.js";import{t as z}from"./spinner-Dvc_A3Ae.js";import{c as B,i as V,s as H,t as U}from"./proxy-DktXrBt_.js";import{G as W,X as G,Z as K,ft as q,pt as J,rt as Y}from"./single-value-BbzxY9gT.js";import{$ as X,A as te,B as ne,C as re,D as ie,E as ae,F as oe,G as se,H as ce,I as le,J as ue,K as de,L as fe,M as pe,N as me,O as he,P as ge,Q as _e,R as ve,U as ye,V as be,W as xe,X as Se,Y as Ce,Z as we,a as Te,at as Ee,b as De,c as Oe,ct as ke,d as Ae,dt as je,et as Me,f as Ne,ft as Pe,i as Fe,it as Ie,l as Le,lt as Re,m as ze,nt as Be,o as Ve,ot as He,p as Ue,q as We,r as Ge,rt as Ke,s as qe,st as Je,t as Ye,tt as Xe,u as Ze,ut as Qe,x as $e,z as et}from"./app-shell-state-B5MFb4Nm.js";import{t as tt}from"./AnimatePresence-DwAfNqj_.js";import{t as nt}from"./use-platform-BkwBnkgx.js";import{n as rt,s as it,t as at}from"./app-shell-tab-controller-B0DXekEJ.js";import{t as ot}from"./browser-sidebar-manager-CDP80WMh.js";import{i as st,r as ct,t as lt}from"./error-boundary-CSKrv358.js";import{t as ut}from"./download-TILfllSA.js";import{t as dt}from"./with-window-DPMmD2K-.js";import{t as ft}from"./use-register-command-UoA_Jn9F.js";import{r as pt}from"./run-command-BkY8dgoH.js";import{r as mt}from"./modal-controller-state-CEBUx8JQ.js";import{a as ht,d as gt,i as _t,l as vt,n as yt,r as bt,u as xt}from"./dialog-layout-CCvvb1Vc.js";import{t as St}from"./use-stable-callback-B56R_Ee2.js";import{t as Ct}from"./context-menu-DRia187f.js";import{t as wt}from"./loading-page-Cq0CTe5D.js";import{i as Tt,n as Et,r as Dt,t as Ot}from"./sortable.esm-gKrsSmfW.js";import{t as kt}from"./get-resize-observer-entry-size-CH0PchA7.js";import{n as At,r as jt}from"./use-resize-observer-CbHbkQNx.js";import{a as Mt}from"./command-keybindings-D3tvaSVG.js";import{n as Nt,t as Pt}from"./expand-CUW1I4XL.js";import{a as Ft,t as It}from"./keyboard-modifier-state-ZeRcF5hb.js";import{t as Lt}from"./use-merged-ref-6q7NGZyX.js";import{t as Rt}from"./arrow-left-2njf4k3d.js";import{t as zt}from"./use-window-controls-safe-area-X2AodDul.js";import{t as Bt}from"./app-shell-bottom-panel-scroll-sync-DpO90Rtb.js";import{a as Vt,r as Ht,t as Ut}from"./image-preview-shortcuts-CaXpgMPF.js";function Wt(...e){let t=!Array.isArray(e[0]),n=t?0:-1,r=e[0+n],i=e[1+n],a=e[2+n],o=e[3+n],s=Y(i,a,o);return t?s(r):s}var Z=e(o(),1);function Gt(e,t,n){(0,Z.useInsertionEffect)(()=>e.on(t,n),[e,t,n])}function Kt(e){let t=B(()=>K(e)),{isStatic:n}=(0,Z.useContext)(V);if(n){let[,n]=(0,Z.useState)(e);(0,Z.useEffect)(()=>t.on(`change`,n),[])}return t}function qt(e,t){let n=Kt(t()),r=()=>n.set(t());return r(),H(()=>{let t=()=>J.preRender(r,!1,!0),n=e.map(e=>e.on(`change`,t));return()=>{n.forEach(e=>e()),q(r)}}),n}function Jt(e,...t){let n=e.length;function r(){let r=``;for(let i=0;ii(e))}function Zt(e,t){let n=B(()=>[]);return qt(e,()=>{n.length=0;let r=e.length;for(let t=0;t(0,Q.jsx)(`svg`,{width:21,height:21,viewBox:`0 0 21 21`,fill:`none`,xmlns:`http://www.w3.org/2000/svg`,...e,children:(0,Q.jsx)(`path`,{fillRule:`evenodd`,clipRule:`evenodd`,d:`M10.7997 2.48486C15.4019 2.48486 19.1335 6.21565 19.1337 10.8179C19.1337 15.4202 15.4021 19.1519 10.7997 19.1519C6.19746 19.1517 2.46667 15.4201 2.46667 10.8179C2.46685 6.21576 6.19757 2.48504 10.7997 2.48486ZM9.00811 7.5181C8.62612 7.13627 8.00684 7.13624 7.62534 7.5181C7.24363 7.89971 7.24366 8.51913 7.62534 8.90088L9.54183 10.8179L7.62534 12.7343C7.24375 13.116 7.24365 13.7354 7.62534 14.1171C8.00709 14.4989 8.62647 14.4989 9.00811 14.1171L10.9251 12.2007L12.8416 14.1171C13.2234 14.4989 13.8427 14.4989 14.2244 14.1171C14.6062 13.7354 14.6062 13.1161 14.2244 12.7343L12.3079 10.8179L14.2244 8.90088L14.3123 8.79221C14.5632 8.41306 14.5212 7.89785 14.2244 7.60088C13.9275 7.30404 13.4123 7.26211 13.0331 7.51303L12.9244 7.60088L11.0079 9.51736L9.09138 7.60088L9.00811 7.5181Z`,fill:`currentColor`})}),$=T(),$t=`color-mix(in srgb, var(--color-token-foreground) 5%, var(--color-token-main-surface-primary))`,en=`min(32rem, var(--radix-tooltip-content-available-width), calc(100vw - 16px))`;function tn(e){let t=(0,$.c)(79),n,r,i,a,o,s,l,u,d,f,p,m,h,g,_,v,y,b;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4],o=t[5],s=t[6],l=t[7],u=t[8],d=t[9],f=t[10],p=t[11],m=t[12],h=t[13],g=t[14],_=t[15],v=t[16],y=t[17],b=t[18]):({activatorRef:n,tooltip:y,highlightedIcon:i,id:o,icon:a,trailingContent:b,title:v,isDragging:f,isActive:p,isClosable:m,isHighlighted:h,isLabel:g,isPreview:_,onActivate:s,onClose:l,onPointerDown:u,style:d,...r}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a,t[5]=o,t[6]=s,t[7]=l,t[8]=u,t[9]=d,t[10]=f,t[11]=p,t[12]=m,t[13]=h,t[14]=g,t[15]=_,t[16]=v,t[17]=y,t[18]=b);let x=f===void 0?!1:f,S=p===void 0?!1:p,C=m===void 0?!1:m,w=h===void 0?!1:h,T=g===void 0?!1:g,E=_===void 0?!1:_,O=D(),[k,A]=(0,Z.useState)(!1),j=!T,M=w&&i!=null,ee=j&&S,N;t[19]===Symbol.for(`react.memo_cache_sentinel`)?(N=(e,t)=>{A(t.scrollWidth>t.clientWidth)},t[19]=N):N=t[19];let F=At(N),I=E&&`italic`,L;t[20]===I?L=t[21]:(L=c(`block w-full min-w-0 whitespace-nowrap`,I),t[20]=I,t[21]=L);let R;t[22]!==L||t[23]!==F||t[24]!==v?(R=(0,Q.jsx)(`span`,{ref:F,className:L,children:v}),t[22]=L,t[23]=F,t[24]=v,t[25]=R):R=t[25];let z=R,B;t[26]===d?B=t[27]:(B={...d,"--app-shell-tab-background":$t},t[26]=d,t[27]=B);let V=B,H;t[28]===u?H=t[29]:(H=e=>{if(e.button!==0||e.ctrlKey){e.stopPropagation();return}u?.(e)},t[28]=u,t[29]=H);let U=j&&`group-hover/tab:bg-[var(--app-shell-tab-background)]`,W=j&&(S||x)&&`bg-[var(--app-shell-tab-background)]`,G;t[30]!==U||t[31]!==W?(G=c(`pointer-events-none absolute inset-0 z-0 rounded-md`,U,W),t[30]=U,t[31]=W,t[32]=G):G=t[32];let K;t[33]===G?K=t[34]:(K=(0,Q.jsx)(`div`,{className:G}),t[33]=G,t[34]=K);let q=S&&`text-token-text-primary`,J=!S&&`text-token-text-secondary`,Y;t[35]!==q||t[36]!==J?(Y=c(`no-drag relative flex flex-1 items-center gap-2 z-10 text-sm min-w-0 `,q,J),t[35]=q,t[36]=J,t[37]=Y):Y=t[37];let X;t[38]!==C||t[39]!==s||t[40]!==l?(X=e=>{if(C&&e.button===1){e.preventDefault(),e.stopPropagation(),l?.();return}s?.()},t[38]=C,t[39]=s,t[40]=l,t[41]=X):X=t[41];let te;t[42]!==i||t[43]!==a||t[44]!==M?(te=(a!=null||M)&&(0,Q.jsxs)(`span`,{"aria-hidden":`true`,className:`icon-xs relative flex shrink-0 items-center justify-center overflow-visible`,children:[a!=null&&(0,Q.jsx)(`span`,{className:c(`flex size-full items-center justify-center`,M&&`opacity-30`),children:a}),M&&(0,Q.jsx)(`span`,{className:`pointer-events-none absolute inset-0 z-10 flex size-full items-center justify-center`,children:i})]}),t[42]=i,t[43]=a,t[44]=M,t[45]=te):te=t[45];let ne;t[46]!==O||t[47]!==C||t[48]!==l||t[49]!==v?(ne=C&&(0,Q.jsx)(`div`,{role:`button`,"aria-label":O.formatMessage({id:`codex.tabs.closeNamed`,defaultMessage:`Close {title} tab`,description:`Accessible label for closing a named tab`},{title:v}),className:`no-drag absolute inset-y-0 start-0 z-30 hidden shrink-0 cursor-interaction items-center bg-(--app-shell-tab-background) text-token-text-tertiary group-hover/tab:flex after:absolute after:-inset-1 after:content-[''] hover:text-token-text-primary`,onClick:l,onMouseDown:nn,children:(0,Q.jsx)(Qt,{className:`icon-xs`})}),t[46]=O,t[47]=C,t[48]=l,t[49]=v,t[50]=ne):ne=t[50];let re;t[51]!==x||t[52]!==z||t[53]!==y?(re=y?(0,Q.jsx)(P,{tooltipContent:y,disabled:x,delayOpen:!0,side:`bottom`,tooltipMaxWidth:en,children:z}):z,t[51]=x,t[52]=z,t[53]=y,t[54]=re):re=t[54];let ie;t[55]!==ee||t[56]!==S||t[57]!==k||t[58]!==j?(ie=k&&(0,Q.jsx)(`span`,{className:c(`pointer-events-none absolute inset-y-0 end-0 z-20 w-8 bg-linear-to-r from-transparent to-60%`,ee?`to-[var(--app-shell-tab-background)]`:`to-token-main-surface-primary`,j&&!S&&`group-hover/tab:to-[var(--app-shell-tab-background)]`)}),t[55]=ee,t[56]=S,t[57]=k,t[58]=j,t[59]=ie):ie=t[59];let ae;t[60]!==re||t[61]!==ie?(ae=(0,Q.jsxs)(`span`,{className:`relative min-w-0 flex-1 overflow-hidden`,children:[re,ie]}),t[60]=re,t[61]=ie,t[62]=ae):ae=t[62];let oe;t[63]!==S||t[64]!==Y||t[65]!==X||t[66]!==te||t[67]!==ne||t[68]!==ae||t[69]!==b?(oe=(0,Q.jsxs)(`button`,{type:`button`,role:`tab`,"aria-selected":S,className:Y,onMouseDown:X,children:[te,ne,ae,b]}),t[63]=S,t[64]=Y,t[65]=X,t[66]=te,t[67]=ne,t[68]=ae,t[69]=b,t[70]=oe):oe=t[70];let se;return t[71]!==n||t[72]!==r||t[73]!==o||t[74]!==V||t[75]!==H||t[76]!==K||t[77]!==oe?(se=(0,Q.jsxs)(`div`,{ref:n,"data-tab-id":o,className:`group/tab relative flex h-7 max-w-39 shrink-0 items-center overflow-hidden rounded-lg bg-token-main-surface-primary px-2 py-1`,style:V,...r,onPointerDown:H,children:[K,oe]}),t[71]=n,t[72]=r,t[73]=o,t[74]=V,t[75]=H,t[76]=K,t[77]=oe,t[78]=se):se=t[78],se}function nn(e){e.preventDefault(),e.stopPropagation()}function rn(e){let t=(0,$.c)(69),{controller:n,isActive:r,separatorIndex:a,showTrailingSeparator:o,tab:s}=e,l=v(I),{tabId:u,title:d,icon:f,isClosable:p,isLabel:h,contextMenuItems:g,highlightedIcon:_,isHighlighted:y,trailingContent:b,isPreview:x,tooltip:S}=s,C;t[0]!==n||t[1]!==u?(C={controller:n,kind:`app-shell-tab`,tabId:u},t[0]=n,t[1]=u,t[2]=C):C=t[2];let w;t[3]!==h||t[4]!==C||t[5]!==s.dndId?(w={data:C,disabled:h,id:s.dndId,strategy:Dt},t[3]=h,t[4]=C,t[5]=s.dndId,t[6]=w):w=t[6];let{attributes:T,isDragging:E,listeners:D,setActivatorNodeRef:k,setNodeRef:A,transform:j,transition:M}=Tt(w),ee;t[7]!==n||t[8]!==p||t[9]!==l||t[10]!==u?(ee=e=>{if(p){let t=l.get(i),r=l.get(n.tabs$),a=r.findIndex(e=>e.tabId===u),o=r.some(e=>e.tabId!==u&&e.isClosable),s=a!==-1&&r.slice(a+1).some(an);if(e.length>0&&e.push({id:`close-tab-separator`,type:`separator`}),e.push({id:`close-tab`,message:O({id:`codex.tabs.contextMenu.close`,defaultMessage:`Close`,description:`Context menu action for closing a tab`}),onSelect:()=>n.closeTab(l,u)}),!t)return e;e.push({enabled:o,id:`close-other-tabs`,message:O({id:`codex.tabs.contextMenu.closeOtherTabs`,defaultMessage:`Close other tabs`,description:`Context menu action for closing all other tabs besides the current tab`}),onSelect:()=>n.closeOtherTabs(l,u)}),e.push({enabled:s,id:`close-tabs-to-the-right`,message:O({id:`codex.tabs.contextMenu.closeTabsToTheRight`,defaultMessage:`Close tabs to the right`,description:`Context menu action for closing the tabs to the right of the current tab`}),onSelect:()=>n.closeTabsToRight(l,u)})}return e},t[7]=n,t[8]=p,t[9]=l,t[10]=u,t[11]=ee):ee=t[11];let N=ee,P;t[12]!==N||t[13]!==g||t[14]!==l?(P=()=>{let e=typeof g==`function`?g(l):g??[];return Array.isArray(e)?N([...e]):e.then(e=>N([...e]))},t[12]=N,t[13]=g,t[14]=l,t[15]=P):P=t[15];let F=P,L=n.panelId,R=E&&`z-10 cursor-grab opacity-0`,z;t[16]===R?z=t[17]:(z=c(`my-auto flex shrink-0 relative max-w-40 pe-1 items-center contain-content gap-0.5`,R),t[16]=R,t[17]=z);let B;t[18]===j?B=t[19]:(B=m.Translate.toString(j),t[18]=j,t[19]=B);let V;t[20]!==B||t[21]!==M?(V={transform:B,transition:M},t[20]=B,t[21]=M,t[22]=V):V=t[22];let H,W;t[23]!==n||t[24]!==l||t[25]!==u?(H=()=>n.activateTab(l,u),W=()=>n.closeTab(l,u),t[23]=n,t[24]=l,t[25]=u,t[26]=H,t[27]=W):(H=t[26],W=t[27]);let G;t[28]!==n||t[29]!==x||t[30]!==l||t[31]!==u?(G=()=>{x&&n.pinTab(l,u)},t[28]=n,t[29]=x,t[30]=l,t[31]=u,t[32]=G):G=t[32];let K;t[33]!==T||t[34]!==_||t[35]!==f||t[36]!==r||t[37]!==p||t[38]!==E||t[39]!==y||t[40]!==h||t[41]!==x||t[42]!==D||t[43]!==k||t[44]!==H||t[45]!==W||t[46]!==G||t[47]!==u||t[48]!==d||t[49]!==S||t[50]!==b?(K=(0,Q.jsx)(tn,{activatorRef:k,id:u,highlightedIcon:_,icon:f,isActive:r,isClosable:p,isDragging:E,isHighlighted:y,isLabel:h,isPreview:x,onActivate:H,onClose:W,trailingContent:b,title:d,tooltip:S,...D,...T,onDoubleClick:G}),t[33]=T,t[34]=_,t[35]=f,t[36]=r,t[37]=p,t[38]=E,t[39]=y,t[40]=h,t[41]=x,t[42]=D,t[43]=k,t[44]=H,t[45]=W,t[46]=G,t[47]=u,t[48]=d,t[49]=S,t[50]=b,t[51]=K):K=t[51];let q;t[52]!==F||t[53]!==K?(q=(0,Q.jsx)(Ct,{getItems:F,children:K}),t[52]=F,t[53]=K,t[54]=q):q=t[54];let J=o?`opacity-100`:`opacity-0`,Y;t[55]===J?Y=t[56]:(Y=c(`h-3 w-px shrink-0 end-0 absolute bg-token-border transition-opacity duration-200`,J),t[55]=J,t[56]=Y);let X;t[57]!==a||t[58]!==Y||t[59]!==u?(X=(0,Q.jsx)(`div`,{"aria-hidden":!0,"data-app-shell-tab-separator":u,"data-app-shell-tab-separator-index":a,className:Y}),t[57]=a,t[58]=Y,t[59]=u,t[60]=X):X=t[60];let te;return t[61]!==n.panelId||t[62]!==A||t[63]!==q||t[64]!==X||t[65]!==z||t[66]!==V||t[67]!==u?(te=(0,Q.jsxs)(U.div,{"data-app-shell-tab-controller":L,"data-tab-id":u,ref:A,className:z,style:V,children:[q,X]}),t[61]=n.panelId,t[62]=A,t[63]=q,t[64]=X,t[65]=z,t[66]=V,t[67]=u,t[68]=te):te=t[68],te}function an(e){return e.isClosable}var on=(0,Z.createContext)(null);function sn(e,t){let n=e.get(t.sourceController.tabIds$),r=n.indexOf(t.tabId);r===-1||r===t.sourceIndex||e.set(t.sourceController.tabIds$,Et(n,r,t.sourceIndex))}function cn(e,t,n,r){let i=e.get(t.tabIds$),a=i.indexOf(n),o=i.indexOf(r);a===-1||o===-1||a===o||e.set(t.tabIds$,Et(i,a,o))}function ln(e,t,n){return e.previewController===t&&e.overTabId===n?e:{...e,overTabId:n,previewController:t}}function un(e,t,n){if(n==null||n.previewController===n.sourceController)return e;if(t===n.sourceController)return e.filter(e=>e.tabId!==n.draggedTab.tabId);if(t!==n.previewController)return e;let r=n.overTabId==null?-1:e.findIndex(e=>e.tabId===n.overTabId),i=[...e];return i.splice(r===-1?i.length:r,0,n.draggedTab),i}var dn=`data-tab-preview-pin-exempt`;function fn(e){let t=(0,$.c)(20),{afterList:n,afterListSticky:r,beforeList:i,emptyState:a,headerHeight:o,controller:s}=e,c=y(s.tabs$),l=y(s.activeTab$),u=y(s.activeTabReactKey$),d=(0,Z.useContext)(on)?.dragState??null,f;t[0]!==s||t[1]!==d||t[2]!==c?(f=un(c,s,d),t[0]=s,t[1]=d,t[2]=c,t[3]=f):f=t[3];let p=f,m=l?.tabId??null,h;t[4]!==n||t[5]!==r||t[6]!==i||t[7]!==s||t[8]!==o||t[9]!==p||t[10]!==m?(h=(0,Q.jsx)(pn,{height:o,activeTabId:m,after:n,afterSticky:r,before:i,controller:s,tabs:p}),t[4]=n,t[5]=r,t[6]=i,t[7]=s,t[8]=o,t[9]=p,t[10]=m,t[11]=h):h=t[11];let g;t[12]!==l||t[13]!==u||t[14]!==s||t[15]!==a?(g=l==null?(0,Q.jsx)(`div`,{className:`relative min-h-0 flex-1`,children:a}):(0,Q.jsx)(vn,{controller:s,tab:l},u),t[12]=l,t[13]=u,t[14]=s,t[15]=a,t[16]=g):g=t[16];let _;return t[17]!==h||t[18]!==g?(_=(0,Q.jsxs)(`div`,{className:`isolate flex h-full min-h-0 flex-col bg-token-main-surface-primary [contain:layout_paint]`,children:[h,g]}),t[17]=h,t[18]=g,t[19]=_):_=t[19],_}function pn(e){let t=(0,$.c)(94),{activeTabId:n,after:r,afterSticky:i,before:a,controller:o,height:s,tabs:l}=e,[u,d]=(0,Z.useState)(!1),[f,p]=(0,Z.useState)(!1),[m,h]=jt(),[g,v]=(0,Z.useState)(null),y=`app-shell-tab-strip:${o.panelId}`,b;t[0]===o?b=t[1]:(b={controller:o,kind:`app-shell-tab-strip`},t[0]=o,t[1]=b);let x;t[2]!==y||t[3]!==b?(x={id:y,data:b},t[2]=y,t[3]=b,t[4]=x):x=t[4];let{setNodeRef:S}=_(x),C=(0,Z.useContext)(on)?.dragState??null,w,T,E,D,O,k,A,j,M,ee,N,P,F,I,L,R,z;if(t[5]!==n||t[6]!==h||t[7]!==a||t[8]!==o||t[9]!==C||t[10]!==s||t[11]!==u||t[12]!==g||t[13]!==S||t[14]!==l){let e=l.map(hn),r;t[32]===l?r=t[33]:(r=l.map(mn),t[32]=l,t[33]=r);let i=r;T=h==null||h===0?`0px`:`0px -${h}px 0px 0px`,E=C!=null;let f=n==null?-1:e.indexOf(n),p=s===`toolbar`&&`h-toolbar`,m=s===`pane`&&`h-toolbar-pane`;t[34]!==p||t[35]!==m?(ee=c(p,m,`isolate flex min-w-0 shrink-0 select-none items-center bg-token-main-surface-primary px-2 [contain:layout_paint]`),t[34]=p,t[35]=m,t[36]=ee):ee=t[36],t[37]===a?N=t[38]:(N=a!=null&&(0,Q.jsx)(`div`,{className:`my-auto flex shrink-0 items-center`,role:`presentation`,children:a}),t[37]=a,t[38]=N),t[39]===S?D=t[40]:(D=e=>{v(e),S(e)},t[39]=S,t[40]=D),O=o.panelId,k=`hide-scrollbar relative isolate flex h-full min-w-0 flex-1 scroll-px-1 items-center overflow-x-auto overflow-y-hidden [contain:layout_paint]`;let _=`${h??0}px`;t[41]===_?A=t[42]:(A={scrollPaddingInlineEnd:_},t[41]=_,t[42]=A);let y=u?`opacity-0`:`opacity-100`,b;t[43]===y?b=t[44]:(b=c(`sticky start-0 z-10 h-full w-0 after:absolute transition-opacity after:pointer-events-none duration-100 after:start-0 after:top-0 after:bottom-0 after:w-10 after:bg-linear-to-l after:from-transparent after:to-token-main-surface-primary after:content-['']`,y),t[43]=y,t[44]=b),t[45]===b?j=t[46]:(j=(0,Q.jsx)(`div`,{"aria-hidden":!0,className:b}),t[45]=b,t[46]=j),t[47]===g?M=t[48]:(M=(0,Q.jsx)(gn,{onVisibleChange:d,root:g}),t[47]=g,t[48]=M),w=Ot,R=i,z=Dt,P=`tablist`;let x=E?`z-20`:`z-0`;t[49]===x?F=t[50]:(F=c(`relative flex`,x),t[49]=x,t[50]=F),t[51]===Symbol.for(`react.memo_cache_sentinel`)?(I={gap:3},t[51]=I):I=t[51],L=l.map(t=>{let r=n===t.tabId,i=e.indexOf(t.tabId);return(0,Q.jsx)(rn,{controller:o,isActive:r,separatorIndex:i,showTrailingSeparator:i{n(e)},t[0]=n,t[1]=a);let o=St(a),s;t[2]!==o||t[3]!==r||t[4]!==i?(s=e=>{if(!e)return;let t=new IntersectionObserver(e=>{for(let t of e)o(t.isIntersecting)},{root:r,rootMargin:i});return t.observe(e),()=>{t.disconnect()}},t[2]=o,t[3]=r,t[4]=i,t[5]=s):s=t[5];let c;return t[6]!==i||t[7]!==s?(c=(0,Q.jsx)(`span`,{"aria-hidden":!0,ref:s},i),t[6]=i,t[7]=s,t[8]=c):c=t[8],c}function _n(e,t){return t!==-1&&(e===t||e===t-1)}var vn=(0,Z.memo)(function(e){let t=(0,$.c)(22),{controller:n,tab:r}=e,i=v(I),a;t[0]!==n||t[1]!==i||t[2]!==r.isPreview||t[3]!==r.tabId?(a=e=>{bn(e.nativeEvent)||r.isPreview&&n.pinTab(i,r.tabId)},t[0]=n,t[1]=i,t[2]=r.isPreview,t[3]=r.tabId,t[4]=a):a=t[4];let o=a,s=r.title,c=n.panelId,l=r.tabId,u=r.tabId,d;if(t[5]!==n||t[6]!==i||t[7]!==r){let e;t[9]!==n||t[10]!==i||t[11]!==r.tabId?(e=()=>{n.closeTab(i,r.tabId)},t[9]=n,t[10]=i,t[11]=r.tabId,t[12]=e):e=t[12],d=r.renderPanel(e),t[5]=n,t[6]=i,t[7]=r,t[8]=d}else d=t[8];let f;t[13]!==d||t[14]!==r.tabId?(f=(0,Q.jsx)(lt,{name:`AppShellTabPanel`,resetKey:u,fallback:xn,children:d}),t[13]=d,t[14]=r.tabId,t[15]=f):f=t[15];let p;return t[16]!==n.panelId||t[17]!==o||t[18]!==f||t[19]!==r.tabId||t[20]!==r.title?(p=(0,Q.jsx)(`div`,{role:`tabpanel`,"aria-label":s,"data-app-shell-tab-panel-controller":c,"data-tab-id":l,tabIndex:-1,onKeyDownCapture:o,onPointerDownCapture:o,className:`relative min-h-0 flex-1 outline-none`,children:f}),t[16]=n.panelId,t[17]=o,t[18]=f,t[19]=r.tabId,t[20]=r.title,t[21]=p):p=t[21],p});function yn(e){let t=(0,$.c)(4),{onRetry:n}=e,r;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,Q.jsx)(`div`,{className:`font-medium text-token-text-primary`,children:(0,Q.jsx)(k,{id:`appShell.tabPanelRenderError.title`,defaultMessage:`Tab content couldn't render`,description:`Error message shown when an app shell tab panel fails to render`})}),t[0]=r):r=t[0];let i;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,Q.jsx)(k,{id:`appShell.tabPanelRenderError.retry`,defaultMessage:`Try again`,description:`Button label to retry rendering an app shell tab panel`}),t[1]=i):i=t[1];let a;return t[2]===n?a=t[3]:(a=(0,Q.jsxs)(`div`,{className:`flex h-full min-h-0 flex-col items-center justify-center gap-3 p-4 text-center text-sm text-token-text-secondary`,children:[r,(0,Q.jsx)(L,{color:`secondary`,size:`default`,onClick:n,children:i})]}),t[2]=n,t[3]=a),a}function bn(e){return e.composedPath().some(e=>e instanceof Element&&e.hasAttribute(dn))}function xn(e){return(0,Q.jsx)(yn,{onRetry:()=>{e.resetError()}})}function Sn(){let e=(0,$.c)(4),t=y(ge),n=y(oe),r=y(le),i;return e[0]!==t||e[1]!==n||e[2]!==r?(i=(0,Q.jsx)(fn,{headerHeight:`pane`,afterList:t,afterListSticky:n,emptyState:r,controller:at}),e[0]=t,e[1]=n,e[2]=r,e[3]=i):i=e[3],i}function Cn(){let e=(0,$.c)(17),t=v(I),n=D(),r=y(xe),i=x(Mt,`toggleMaximizeSidePanel`),a;e[0]!==n||e[1]!==r?(a=r?n.formatMessage({id:`codex.rightPanel.restoreWidth`,defaultMessage:`Restore panel width`,description:`Accessible label for restoring the right panel from full width`}):n.formatMessage({id:`codex.rightPanel.expandFullWidth`,defaultMessage:`Expand panel`,description:`Accessible label for expanding the right panel to full width`}),e[0]=n,e[1]=r,e[2]=a):a=e[2];let o=a,s;e[3]!==r||e[4]!==t?(s=()=>{t.set(xe,!r)},e[3]=r,e[4]=t,e[5]=s):s=e[5],ft(`toggleMaximizeSidePanel`,s);let c=r?`secondary`:`ghost`,l;e[6]===r?l=e[7]:(l=r?(0,Q.jsx)(Nt,{className:`icon-xs`}):(0,Q.jsx)(Pt,{className:`icon-xs`}),e[6]=r,e[7]=l);let u;e[8]!==r||e[9]!==o||e[10]!==c||e[11]!==l?(u=(0,Q.jsx)(L,{"aria-label":o,"aria-pressed":r,color:c,size:`toolbar`,uniform:!0,onClick:wn,children:l}),e[8]=r,e[9]=o,e[10]=c,e[11]=l,e[12]=u):u=e[12];let d;return e[13]!==o||e[14]!==i||e[15]!==u?(d=(0,Q.jsx)(P,{tooltipContent:o,shortcut:i,delayOpen:!0,children:u}),e[13]=o,e[14]=i,e[15]=u,e[16]=d):d=e[16],d}function wn(){return pt(`toggleMaximizeSidePanel`,`side_panel_full_width_button`)}function Tn(){let e=y(ue),t=y(Ce),n=y(Se),r=y(we),i=y(xe),a=y(Ze),{headerLeftWidth:o,headerRightWidth:s}=Je(),c=Jt`max(0px, calc(${s}px)`;return(0,Q.jsx)(fn,{headerHeight:`toolbar`,beforeList:(0,Q.jsxs)(Q.Fragment,{children:[i&&!a&&(0,Q.jsx)(U.div,{"aria-hidden":!0,className:`pointer-events-none h-full shrink-0`,style:{width:o}}),n]}),afterListSticky:t,emptyState:r,afterList:(0,Q.jsxs)(Q.Fragment,{children:[e,(0,Q.jsx)(Cn,{}),(0,Q.jsx)(U.div,{"aria-hidden":!0,"data-testid":`right-panel-tab-bar-header-spacer`,className:`pointer-events-none flex h-full shrink-0 items-center`,style:{width:c}})]}),controller:rt})}function En(e){let t=(0,$.c)(4),{keyboardEventTarget:n}=e,r=v(w),i,a;return t[0]!==n||t[1]!==r?(i=()=>{let e=n??(typeof window>`u`?null:window);if(e==null)return;let t=e=>{Ft(r,e)},i=()=>{It(r)};return e.addEventListener(`keydown`,t,!0),e.addEventListener(`keyup`,t,!0),e.addEventListener(`blur`,i),()=>{e.removeEventListener(`keydown`,t,!0),e.removeEventListener(`keyup`,t,!0),e.removeEventListener(`blur`,i),It(r)}},a=[n,r],t[0]=n,t[1]=r,t[2]=i,t[3]=a):(i=t[2],a=t[3]),(0,Z.useEffect)(i,a),null}var Dn=S(w,!1),On=S(w,null),kn=S(w,null),An=S(w,null);function jn(e){let t=(0,$.c)(21),{onClose:n}=e,r;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,Q.jsx)(k,{id:`appHeader.installUpdate.confirmTitle`,defaultMessage:`Update Codex now?`,description:`Title for the confirmation dialog shown before installing an app update while a local session is active`}),t[0]=r):r=t[0];let i=r,a;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,Q.jsx)(k,{id:`appHeader.installUpdate.confirmSubtitle`,defaultMessage:`Codex will quit to install the update, which will interrupt active local sessions on this machine`,description:`Subtitle for the confirmation dialog shown before installing an app update while a local session is active`}),t[1]=a):a=t[1];let o=a,s;t[2]===n?s=t[3]:(s=e=>{e||n()},t[2]=n,t[3]=s);let c;t[4]===n?c=t[5]:(c=e=>{e.preventDefault(),n(),C.dispatchMessage(`install-app-update`,{})},t[4]=n,t[5]=c);let l,u;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,Q.jsx)(gt,{className:`sr-only`,children:i}),u=(0,Q.jsx)(xt,{className:`sr-only`,children:o}),t[6]=l,t[7]=u):(l=t[6],u=t[7]);let d;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,Q.jsx)(ht,{children:(0,Q.jsx)(_t,{title:i,subtitle:o})}),t[8]=d):d=t[8];let f;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(f=(0,Q.jsx)(k,{id:`appHeader.installUpdate.confirmCancel`,defaultMessage:`Cancel`,description:`Cancel button for the update confirmation dialog`}),t[9]=f):f=t[9];let p;t[10]===n?p=t[11]:(p=(0,Q.jsx)(L,{color:`secondary`,onClick:n,children:f}),t[10]=n,t[11]=p);let m;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(m=(0,Q.jsx)(L,{type:`submit`,children:(0,Q.jsx)(k,{id:`appHeader.installUpdate.confirmInstall`,defaultMessage:`Update`,description:`Confirm button for the update confirmation dialog`})}),t[12]=m):m=t[12];let h;t[13]===p?h=t[14]:(h=(0,Q.jsx)(ht,{children:(0,Q.jsxs)(bt,{children:[p,m]})}),t[13]=p,t[14]=h);let g;t[15]!==h||t[16]!==c?(g=(0,Q.jsxs)(yt,{as:`form`,onSubmit:c,children:[l,u,d,h]}),t[15]=h,t[16]=c,t[17]=g):g=t[17];let _;return t[18]!==g||t[19]!==s?(_=(0,Q.jsx)(vt,{open:!0,onOpenChange:s,showDialogClose:!1,size:`compact`,children:g}),t[18]=g,t[19]=s,t[20]=_):_=t[20],_}function Mn(e,t){return e===`windows`&&t}function Nn(){let e=(0,$.c)(4),t=v(w),{platform:n}=nt(),i=y(r),a;return e[0]!==i||e[1]!==n||e[2]!==t?(a=()=>{if(Mn(n,i)){mt(t,jn);return}C.dispatchMessage(`install-app-update`,{})},e[0]=i,e[1]=n,e[2]=t,e[3]=a):a=e[3],St(a)}function Pn(e){let t=(0,$.c)(26),n;t[0]===e?n=t[1]:(n=e===void 0?{}:e,t[0]=e,t[1]=n);let{appUpdateLifecycleState:r}=n,i=D(),a=y(ct),o=Nn(),s=y(On),c=r??a;if(!st(c))return null;let l=c!==`ready`,u;t[2]===s?u=t[3]:(u=s==null?null:Math.min(100,Math.max(0,Math.round(s))),t[2]=s,t[3]=u);let d=u,f;bb0:switch(c){case`ready`:{let e;t[4]===i?e=t[5]:(e=i.formatMessage({id:`appHeader.installUpdate`,defaultMessage:`Update`,description:`Button label in the desktop app header that installs a downloaded app update`}),t[4]=i,t[5]=e),f=e;break bb0}case`installing`:{let e;t[6]===i?e=t[7]:(e=i.formatMessage({id:`appHeader.installingUpdate`,defaultMessage:`Installing`,description:`Button label in the desktop app header while an app update is installing`}),t[6]=i,t[7]=e),f=e;break bb0}case`downloading`:{let e;t[8]!==d||t[9]!==i?(e=d==null?i.formatMessage({id:`appHeader.downloadingUpdate`,defaultMessage:`Downloading`,description:`Button label in the desktop app header while an app update is downloading`}):i.formatMessage({id:`appHeader.downloadingUpdatePercent`,defaultMessage:`Downloading {downloadProgressPercent}%`,description:`Button label in the desktop app header while an app update is downloading with progress`},{downloadProgressPercent:d}),t[8]=d,t[9]=i,t[10]=e):e=t[10],f=e}}let p;t[11]!==f||t[12]!==c||t[13]!==d||t[14]!==i?(p=c===`downloading`&&d!=null?i.formatNumber(d/100,{style:`percent`}):f,t[11]=f,t[12]=c,t[13]=d,t[14]=i,t[15]=p):p=t[15];let m=p,h;t[16]===l?h=t[17]:(h=l?(0,Q.jsx)(z,{className:`ease-basic absolute left-1/2 h-3 w-3 shrink-0 -translate-x-1/2 transition-opacity duration-relaxed [will-change:opacity] motion-reduce:transition-none @[180px]:opacity-0`}):(0,Q.jsx)(ut,{className:`ease-basic absolute left-1/2 h-3 w-3 shrink-0 -translate-x-1/2 transition-opacity duration-relaxed [will-change:opacity] motion-reduce:transition-none @[180px]:opacity-0`}),t[16]=l,t[17]=h);let g;t[18]===m?g=t[19]:(g=(0,Q.jsx)(`span`,{className:`ease-basic min-w-0 truncate tabular-nums opacity-0 transition-opacity duration-relaxed [will-change:opacity] motion-reduce:transition-none @[180px]:opacity-100`,children:m}),t[18]=m,t[19]=g);let _;return t[20]!==f||t[21]!==o||t[22]!==l||t[23]!==h||t[24]!==g?(_=(0,Q.jsxs)(`button`,{"aria-label":f,className:`no-drag ease-basic relative flex h-5 max-w-5 min-w-5 shrink-0 cursor-interaction items-center justify-center overflow-hidden rounded-full bg-token-charts-blue px-2.5 text-xs leading-none font-semibold text-white shadow-sm transition-[max-width,background-color] duration-relaxed [will-change:max-width] contain-layout contain-paint contain-style hover:bg-token-charts-blue/90 active:bg-token-charts-blue/80 motion-reduce:transition-none @[180px]:max-w-36 @[180px]:min-w-10`,disabled:l,onClick:o,title:f,children:[h,g]}),t[20]=f,t[21]=o,t[22]=l,t[23]=h,t[24]=g,t[25]=_):_=t[25],_}var Fn={x:null,y:null,hasKnownVelocity:!1,updatedAt:null,velocityX:0,velocityY:0,speed:0};function In(e,t,n,r){if(e.x==null||e.y==null||e.updatedAt==null)return{x:t,y:n,hasKnownVelocity:!1,updatedAt:r,velocityX:0,velocityY:0,speed:0};let i=(r-e.updatedAt)/1e3;if(i<=0)return{x:t,y:n,hasKnownVelocity:!1,updatedAt:r,velocityX:0,velocityY:0,speed:0};let a=(t-e.x)/i,o=(n-e.y)/i;return{x:t,y:n,hasKnownVelocity:!0,updatedAt:r,velocityX:a,velocityY:o,speed:Math.hypot(a,o)}}var Ln=S(w,Fn),Rn=S(w,{width:window.innerWidth,height:window.innerHeight}),zn={px$:b(w,({get:e})=>e(Ln).x),py$:b(w,({get:e})=>e(Ln).y),hasKnownVelocity$:b(w,({get:e})=>e(Ln).hasKnownVelocity),vx$:b(w,({get:e})=>e(Ln).velocityX),vy$:b(w,({get:e})=>e(Ln).velocityY),speed$:b(w,({get:e})=>e(Ln).speed),bottomInset$:b(w,({get:e})=>{let{height:t}=e(Rn),n=e(Ln).y;return n==null?null:t-n}),rightInset$:b(w,({get:e})=>{let{width:t}=e(Rn),n=e(Ln).x;return n==null?null:t-n})};function Bn(e){let t=(0,$.c)(45),{disabled:n,edge:r,defaultSize:i,getCurrentSize:a,onResizeEnd:o,onResizingChange:s,setSize:c}=e,l=n===void 0?!1:n,u=r===void 0?`right`:r,d=N(),[f,p]=(0,Z.useState)(!1),m=(0,Z.useRef)(null),h=u===`left`||u===`right`,g;t[0]===s?g=t[1]:(g=()=>{m.current=null,p(!1),s?.(!1)},t[0]=s,t[1]=g);let _=(0,Z.useEffectEvent)(g),v;t[2]!==l||t[3]!==_?(v=()=>{!l||m.current==null||_()},t[2]=l,t[3]=_,t[4]=v):v=t[4];let y=(0,Z.useEffectEvent)(v),b;t[5]===d?b=t[6]:(b=e=>({x:e.clientX/d,y:e.clientY/d}),t[5]=d,t[6]=b);let x=b,S;t[7]===h?S=t[8]:(S=e=>h?e.x:e.y,t[7]=h,t[8]=S);let C=S,w;t[9]!==l||t[10]!==u||t[11]!==h||t[12]!==f||t[13]!==o||t[14]!==c||t[15]!==_||t[16]!==y||t[17]!==d?(w=()=>{if(!f||l)return;let e=e=>({x:e.clientX/d,y:e.clientY/d}),t=t=>{t.preventDefault();let n=m.current;if(n==null)return;let r=e(t);(h?r.x:r.y)!==n.startPosition&&(n.didMove=!0),c(Vn(u,r,n))},n=t=>{t.preventDefault();let n=m.current;if(n?.didMove===!0){let r=Vn(u,e(t),n);c(r),o?.(r)}_()};return window.addEventListener(`pointermove`,t),window.addEventListener(`pointerup`,n),window.addEventListener(`pointercancel`,n),()=>{window.removeEventListener(`pointermove`,t),window.removeEventListener(`pointerup`,n),window.removeEventListener(`pointercancel`,n),y()}},t[9]=l,t[10]=u,t[11]=h,t[12]=f,t[13]=o,t[14]=c,t[15]=_,t[16]=y,t[17]=d,t[18]=w):w=t[18];let T;t[19]!==l||t[20]!==u||t[21]!==h||t[22]!==f||t[23]!==o||t[24]!==c||t[25]!==d?(T=[l,u,h,f,o,c,d],t[19]=l,t[20]=u,t[21]=h,t[22]=f,t[23]=o,t[24]=c,t[25]=d,t[26]=T):T=t[26],(0,Z.useEffect)(w,T);let E;t[27]!==l||t[28]!==a||t[29]!==C||t[30]!==x||t[31]!==s?(E=e=>{l||e.button===0&&(e.preventDefault(),e.currentTarget.setPointerCapture?.(e.pointerId),m.current={didMove:!1,startPosition:C(x(e)),startSize:a()},p(!0),s?.(!0))},t[27]=l,t[28]=a,t[29]=C,t[30]=x,t[31]=s,t[32]=E):E=t[32];let D=E,O;t[33]!==i||t[34]!==l||t[35]!==o||t[36]!==s||t[37]!==c?(O=e=>{l||e.detail===2&&(e.preventDefault(),m.current=null,p(!1),s?.(!1),c(i),o?.(i))},t[33]=i,t[34]=l,t[35]=o,t[36]=s,t[37]=c,t[38]=O):O=t[38];let k=O,A;return t[39]!==l||t[40]!==u||t[41]!==k||t[42]!==D||t[43]!==f?(A=(0,Q.jsx)(Hn,{disabled:l,edge:u,isResizing:f,onClick:k,onPointerDown:D}),t[39]=l,t[40]=u,t[41]=k,t[42]=D,t[43]=f,t[44]=A):A=t[44],A}function Vn(e,t,n){let r=(e===`left`||e===`right`?t.x:t.y)-n.startPosition;switch(e){case`bottom`:case`right`:return n.startSize+r;case`left`:case`top`:return n.startSize-r}}function Hn(e){let t=(0,$.c)(20),{disabled:n,edge:r,isResizing:i,onClick:a,onPointerDown:o}=e,s=n||void 0,l=r===`left`||r===`right`?`vertical`:`horizontal`,u=n&&`pointer-events-none`,d=r===`left`?`z-40`:`z-20`,f=r===`right`&&`-top-toolbar right-0 bottom-0 w-4 translate-x-2`,p=r===`left`&&`top-0 bottom-0 left-0 w-4 -translate-x-2`,m=r===`top`&&`top-0 right-0 left-0 h-4 -translate-y-2`,h=r===`bottom`&&`right-0 bottom-0 left-0 h-4 translate-y-2`,g=!n&&(r===`left`||r===`right`?`cursor-col-resize active:cursor-col-resize`:`cursor-row-resize active:cursor-row-resize`),_;t[0]!==u||t[1]!==d||t[2]!==f||t[3]!==p||t[4]!==m||t[5]!==h||t[6]!==g?(_=c(`group absolute flex touch-none select-none`,u,d,f,p,m,h,g),t[0]=u,t[1]=d,t[2]=f,t[3]=p,t[4]=m,t[5]=h,t[6]=g,t[7]=_):_=t[7];let v=r===`left`||r===`right`?`h-full w-px bg-gradient-to-b from-transparent via-token-foreground/25 to-transparent`:`h-px w-full bg-gradient-to-r from-transparent via-token-foreground/25 to-transparent`,y=i?`opacity-100`:`group-hover:opacity-100 group-active:opacity-100`,b;t[8]!==v||t[9]!==y?(b=c(`sidebar-resize-handle-line pointer-events-none m-auto opacity-0`,v,y),t[8]=v,t[9]=y,t[10]=b):b=t[10];let x;t[11]===b?x=t[12]:(x=(0,Q.jsx)(`div`,{className:b}),t[11]=b,t[12]=x);let S;return t[13]!==a||t[14]!==o||t[15]!==s||t[16]!==_||t[17]!==x||t[18]!==l?(S=(0,Q.jsx)(`div`,{role:`separator`,"aria-disabled":s,"aria-orientation":l,className:_,onClick:a,onPointerDown:o,children:x}),t[13]=a,t[14]=o,t[15]=s,t[16]=_,t[17]=x,t[18]=l,t[19]=S):S=t[19],S}var Un=e=>(0,Q.jsx)(`svg`,{width:20,height:20,viewBox:`0 0 20 20`,fill:`none`,xmlns:`http://www.w3.org/2000/svg`,...e,children:(0,Q.jsx)(`path`,{d:`M16.835 8.66301C16.835 7.71885 16.8347 7.05065 16.792 6.52824C16.7605 6.14232 16.7073 5.86904 16.6299 5.65227L16.5439 5.45207C16.32 5.01264 15.9796 4.64498 15.5615 4.3886L15.3779 4.28606C15.1308 4.16013 14.8165 4.08006 14.3018 4.03801C13.7794 3.99533 13.1112 3.99504 12.167 3.99504H7.83301C6.88885 3.99504 6.22065 3.99533 5.69824 4.03801C5.31232 4.06954 5.03904 4.12266 4.82227 4.20012L4.62207 4.28606C4.18264 4.50996 3.81498 4.85035 3.55859 5.26848L3.45605 5.45207C3.33013 5.69922 3.25006 6.01354 3.20801 6.52824C3.16533 7.05065 3.16504 7.71885 3.16504 8.66301V11.3271C3.16504 12.2712 3.16533 12.9394 3.20801 13.4618C3.25006 13.9766 3.33013 14.2909 3.45605 14.538L3.55859 14.7216C3.81498 15.1397 4.18266 15.4801 4.62207 15.704L4.82227 15.79C5.03904 15.8674 5.31234 15.9205 5.69824 15.9521C6.22065 15.9947 6.88885 15.995 7.83301 15.995H12.167C13.1112 15.995 13.7794 15.9947 14.3018 15.9521C14.8164 15.91 15.1308 15.8299 15.3779 15.704L15.5615 15.6015C15.9797 15.3451 16.32 14.9774 16.5439 14.538L16.6299 14.3378C16.7074 14.121 16.7605 13.8478 16.792 13.4618C16.8347 12.9394 16.835 12.2712 16.835 11.3271V8.66301ZM5.00195 13.3329V6.66692C5.00195 6.29965 5.29972 6.00188 5.66699 6.00188C6.03412 6.00204 6.33203 6.29975 6.33203 6.66692V13.3329C6.33203 13.7001 6.03412 13.9978 5.66699 13.998C5.29972 13.998 5.00195 13.7002 5.00195 13.3329ZM18.165 11.3271C18.165 12.2493 18.1653 12.9811 18.1172 13.5702C18.0745 14.0924 17.9916 14.5472 17.8125 14.9648L17.7295 15.1415C17.394 15.8 16.8834 16.3511 16.2568 16.7353L15.9814 16.8896C15.5157 17.1268 15.0069 17.2285 14.4102 17.2773C13.821 17.3254 13.0893 17.3251 12.167 17.3251H7.83301C6.91071 17.3251 6.17898 17.3254 5.58984 17.2773C5.06757 17.2346 4.61294 17.1508 4.19531 16.9716L4.01855 16.8896C3.36014 16.5541 2.80898 16.0434 2.4248 15.4169L2.27051 15.1415C2.03328 14.6758 1.93158 14.167 1.88281 13.5702C1.83468 12.9811 1.83496 12.2493 1.83496 11.3271V8.66301C1.83496 7.74072 1.83468 7.00898 1.88281 6.41985C1.93157 5.82309 2.03329 5.31432 2.27051 4.84856L2.4248 4.57317C2.80898 3.94666 3.36012 3.436 4.01855 3.10051L4.19531 3.0175C4.61285 2.83843 5.06771 2.75548 5.58984 2.71281C6.17898 2.66468 6.91071 2.66496 7.83301 2.66496H12.167C13.0893 2.66496 13.821 2.66468 14.4102 2.71281C15.0069 2.76157 15.5157 2.86329 15.9814 3.10051L16.2568 3.25481C16.8833 3.63898 17.394 4.19012 17.7295 4.84856L17.8125 5.02531C17.9916 5.44285 18.0745 5.89771 18.1172 6.41985C18.1653 7.00898 18.165 7.74072 18.165 8.66301V11.3271Z`,fill:`currentColor`})}),Wn=e=>(0,Q.jsx)(`svg`,{width:20,height:20,viewBox:`0 0 20 20`,fill:`none`,xmlns:`http://www.w3.org/2000/svg`,...e,children:(0,Q.jsx)(`path`,{d:`M6.83496 3.99992C6.38353 4.00411 6.01421 4.0122 5.69824 4.03801C5.31232 4.06954 5.03904 4.12266 4.82227 4.20012L4.62207 4.28606C4.18264 4.50996 3.81498 4.85035 3.55859 5.26848L3.45605 5.45207C3.33013 5.69922 3.25006 6.01354 3.20801 6.52824C3.16533 7.05065 3.16504 7.71885 3.16504 8.66301V11.3271C3.16504 12.2712 3.16533 12.9394 3.20801 13.4618C3.25006 13.9766 3.33013 14.2909 3.45605 14.538L3.55859 14.7216C3.81498 15.1397 4.18266 15.4801 4.62207 15.704L4.82227 15.79C5.03904 15.8674 5.31234 15.9205 5.69824 15.9521C6.01398 15.9779 6.383 15.986 6.83398 15.9902L6.83496 3.99992ZM18.165 11.3271C18.165 12.2493 18.1653 12.9811 18.1172 13.5702C18.0745 14.0924 17.9916 14.5472 17.8125 14.9648L17.7295 15.1415C17.394 15.8 16.8834 16.3511 16.2568 16.7353L15.9814 16.8896C15.5157 17.1268 15.0069 17.2285 14.4102 17.2773C13.821 17.3254 13.0893 17.3251 12.167 17.3251H7.83301C6.91071 17.3251 6.17898 17.3254 5.58984 17.2773C5.06757 17.2346 4.61294 17.1508 4.19531 16.9716L4.01855 16.8896C3.36014 16.5541 2.80898 16.0434 2.4248 15.4169L2.27051 15.1415C2.03328 14.6758 1.93158 14.167 1.88281 13.5702C1.83468 12.9811 1.83496 12.2493 1.83496 11.3271V8.66301C1.83496 7.74072 1.83468 7.00898 1.88281 6.41985C1.93157 5.82309 2.03329 5.31432 2.27051 4.84856L2.4248 4.57317C2.80898 3.94666 3.36012 3.436 4.01855 3.10051L4.19531 3.0175C4.61285 2.83843 5.06771 2.75548 5.58984 2.71281C6.17898 2.66468 6.91071 2.66496 7.83301 2.66496H12.167C13.0893 2.66496 13.821 2.66468 14.4102 2.71281C15.0069 2.76157 15.5157 2.86329 15.9814 3.10051L16.2568 3.25481C16.8833 3.63898 17.394 4.19012 17.7295 4.84856L17.8125 5.02531C17.9916 5.44285 18.0745 5.89771 18.1172 6.41985C18.1653 7.00898 18.165 7.74072 18.165 8.66301V11.3271ZM8.16406 15.995H12.167C13.1112 15.995 13.7794 15.9947 14.3018 15.9521C14.8164 15.91 15.1308 15.8299 15.3779 15.704L15.5615 15.6015C15.9797 15.3451 16.32 14.9774 16.5439 14.538L16.6299 14.3378C16.7074 14.121 16.7605 13.8478 16.792 13.4618C16.8347 12.9394 16.835 12.2712 16.835 11.3271V8.66301C16.835 7.71885 16.8347 7.05065 16.792 6.52824C16.7605 6.14232 16.7073 5.86904 16.6299 5.65227L16.5439 5.45207C16.32 5.01264 15.9796 4.64498 15.5615 4.3886L15.3779 4.28606C15.1308 4.16013 14.8165 4.08006 14.3018 4.03801C13.7794 3.99533 13.1112 3.99504 12.167 3.99504H8.16406C8.16407 3.99667 8.16504 3.99829 8.16504 3.99992L8.16406 15.995Z`,fill:`currentColor`})}),Gn=S(w,!1),Kn=S(w,!1);function qn(e){let t=(0,$.c)(58),n;t[0]===e?n=t[1]:(n=e===void 0?{}:e,t[0]=e,t[1]=n);let{hideUnreadBadge:r,onToggleSidebar:i}=n,o=r===void 0?!1:r,s=v(w),c=D(),l=y(Ze),u=y(qe),d=y(Ae),f=y(a),p=!l&&!o,m;t[2]===p?m=t[3]:(m={taskFilter:`current`,limit:20,enabled:p},t[2]=p,t[3]=m);let h=ee(m),g=y(Gn),_=y(Kn),b=x(Mt,`toggleSidebar`),S=x(Mt,`navigateBack`),C=x(Mt,`navigateForward`),T;t[4]!==c||t[5]!==l?(T=l?c.formatMessage({id:`app.sidebar.hide`,defaultMessage:`Hide sidebar`,description:`Accessible label to collapse the sidebar chrome`}):c.formatMessage({id:`app.sidebar.show`,defaultMessage:`Show sidebar`,description:`Accessible label to expand the sidebar chrome`}),t[4]=c,t[5]=l,t[6]=T):T=t[6];let E=T,O=l?Un:Wn,A;t[7]===h.data?A=t[8]:(A=h.data??[],t[7]=h.data,t[8]=A);let j;t[9]===A?j=t[10]:(j=A.some(Xn),t[9]=A,t[10]=j);let M=!o&&!l&&(f>0||j),N,P;t[11]===s?(N=t[12],P=t[13]):(N=()=>()=>{s.set(Ne,!1),s.set(Le,!1),s.set(Ae,!1)},P=[s],t[11]=s,t[12]=N,t[13]=P),(0,Z.useEffect)(N,P);let F;t[14]===Symbol.for(`react.memo_cache_sentinel`)?(F=(0,Q.jsx)(k,{id:`app.sidebar.tooltip`,defaultMessage:`Toggle sidebar`,description:`Tooltip for the sidebar trigger button`}),t[14]=F):F=t[14];let I=u||d,L;t[15]!==i||t[16]!==s?(L=()=>{if(s.set(Ae,!0),i!=null){i();return}pt(`toggleSidebar`,`sidebar_trigger`)},t[15]=i,t[16]=s,t[17]=L):L=t[17];let R,z;t[18]===s?(R=t[19],z=t[20]):(R=()=>{s.set(Ne,!0)},z=()=>{s.set(Ne,!1),s.set(Le,!1),s.set(Ae,!1)},t[18]=s,t[19]=R,t[20]=z);let B;t[21]===O?B=t[22]:(B=(0,Q.jsx)(O,{className:`icon-xs`}),t[21]=O,t[22]=B);let V;t[23]===M?V=t[24]:(V=M?(0,Q.jsx)(`span`,{"aria-hidden":`true`,className:`absolute -top-0.5 -right-0.5 size-2 rounded-full bg-token-charts-blue ring-2 ring-token-main-surface-primary`,"data-testid":`sidebar-unread-badge`}):null,t[23]=M,t[24]=V);let H;t[25]!==B||t[26]!==V?(H=(0,Q.jsxs)(`span`,{className:`relative inline-flex`,children:[B,V]}),t[25]=B,t[26]=V,t[27]=H):H=t[27];let U;t[28]!==E||t[29]!==I||t[30]!==L||t[31]!==R||t[32]!==z||t[33]!==H||t[34]!==b?(U=(0,Q.jsx)(Zn,{ariaLabel:E,shortcut:b,tooltipContent:F,tooltipDisabled:I,viewTransitionName:`sidebar-trigger`,onClick:L,onPointerEnter:R,onPointerLeave:z,children:H}),t[28]=E,t[29]=I,t[30]=L,t[31]=R,t[32]=z,t[33]=H,t[34]=b,t[35]=U):U=t[35];let W;t[36]===c?W=t[37]:(W=c.formatMessage(Qn.navigateBack),t[36]=c,t[37]=W);let G=!g,K;t[38]===Symbol.for(`react.memo_cache_sentinel`)?(K=(0,Q.jsx)(k,{...Qn.navigateBack}),t[38]=K):K=t[38];let q;t[39]===Symbol.for(`react.memo_cache_sentinel`)?(q=(0,Q.jsx)(Rt,{className:`icon-xs`}),t[39]=q):q=t[39];let J;t[40]!==S||t[41]!==W||t[42]!==G?(J=(0,Q.jsx)(Zn,{ariaLabel:W,disabled:G,shortcut:S,tooltipContent:K,onClick:Yn,children:q}),t[40]=S,t[41]=W,t[42]=G,t[43]=J):J=t[43];let Y;t[44]===c?Y=t[45]:(Y=c.formatMessage(Qn.navigateForward),t[44]=c,t[45]=Y);let X=!_,te;t[46]===Symbol.for(`react.memo_cache_sentinel`)?(te=(0,Q.jsx)(k,{...Qn.navigateForward}),t[46]=te):te=t[46];let ne;t[47]===Symbol.for(`react.memo_cache_sentinel`)?(ne=(0,Q.jsx)(Rt,{className:`icon-xs -scale-x-100`}),t[47]=ne):ne=t[47];let re;t[48]!==C||t[49]!==Y||t[50]!==X?(re=(0,Q.jsx)(Zn,{ariaLabel:Y,disabled:X,shortcut:C,tooltipContent:te,onClick:Jn,children:ne}),t[48]=C,t[49]=Y,t[50]=X,t[51]=re):re=t[51];let ie;t[52]!==J||t[53]!==re?(ie=(0,Q.jsx)(dt,{electron:!0,extension:!0,children:(0,Q.jsxs)(Q.Fragment,{children:[J,re]})}),t[52]=J,t[53]=re,t[54]=ie):ie=t[54];let ae;return t[55]!==U||t[56]!==ie?(ae=(0,Q.jsxs)(`div`,{className:`flex items-center gap-1`,children:[U,ie]}),t[55]=U,t[56]=ie,t[57]=ae):ae=t[57],ae}function Jn(){return pt(`navigateForward`,`sidebar_forward`)}function Yn(){return pt(`navigateBack`,`sidebar_back`)}function Xn(e){return e.has_unread_turn}function Zn(e){let t=(0,$.c)(17),{ariaLabel:n,children:r,disabled:i,onClick:a,onPointerEnter:o,onPointerLeave:s,shortcut:c,tooltipContent:l,tooltipDisabled:u,viewTransitionName:d}=e,f=i===void 0?!1:i,p=u===void 0?!1:u,m;t[0]===d?m=t[1]:(m=d==null?void 0:{viewTransitionName:d},t[0]=d,t[1]=m);let h;t[2]!==n||t[3]!==r||t[4]!==f||t[5]!==a||t[6]!==o||t[7]!==s||t[8]!==m?(h=(0,Q.jsx)(L,{"aria-label":n,color:`ghost`,disabled:f,style:m,size:`toolbar`,uniform:!0,onClick:a,onPointerEnter:o,onPointerLeave:s,children:r}),t[2]=n,t[3]=r,t[4]=f,t[5]=a,t[6]=o,t[7]=s,t[8]=m,t[9]=h):h=t[9];let g;return t[10]!==o||t[11]!==s||t[12]!==c||t[13]!==h||t[14]!==l||t[15]!==p?(g=(0,Q.jsx)(P,{disabled:p,tooltipContent:l,onPointerEnter:o,onPointerLeave:s,shortcut:c,children:h}),t[10]=o,t[11]=s,t[12]=c,t[13]=h,t[14]=l,t[15]=p,t[16]=g):g=t[16],g}var Qn=A({navigateBack:{id:`codex.command.navigateBack`,defaultMessage:`Back`,description:`Command menu item to navigate back`},navigateForward:{id:`codex.command.navigateForward`,defaultMessage:`Forward`,description:`Command menu item to navigate forward`}});function $n(){let{platform:e}=nt();return(e===`windows`||e===`linux`)&&window.electronBridge?.showApplicationMenu!=null}var er=A({file:{id:`windowsMenuBar.file`,defaultMessage:`File`,description:`Label for the File menu in the Windows custom title bar`},edit:{id:`windowsMenuBar.edit`,defaultMessage:`Edit`,description:`Label for the Edit menu in the Windows custom title bar`},view:{id:`windowsMenuBar.view`,defaultMessage:`View`,description:`Label for the View menu in the Windows custom title bar`},window:{id:`windowsMenuBar.window`,defaultMessage:`Window`,description:`Label for the Window menu in the Windows custom title bar`},help:{id:`windowsMenuBar.help`,defaultMessage:`Help`,description:`Label for the Help menu in the Windows custom title bar`}}),tr=[{id:t.file,message:er.file},{id:t.edit,message:er.edit},{id:t.view,message:er.view},{id:t.window,message:er.window},{id:t.help,message:er.help}];function nr(){let e=D(),t=$n(),{platform:p}=nt(),h=p===`linux`&&typeof window.electronBridge?.getApplicationMenuItems==`function`,[n,r]=(0,Z.useState)(null),[m,g]=(0,Z.useState)([]),[_,v]=(0,Z.useState)(null),y=(0,Z.useRef)(0);if((0,Z.useEffect)(()=>{if(!h||!n)return;let e=e=>{e.key===`Escape`&&r(null)},t=e=>{let t=document.getElementById(`linux-application-menu-panel`);t&&!t.contains(e.target)&&!e.target.closest(`[data-linux-menu-trigger=true]`)&&r(null)};return document.addEventListener(`keydown`,e),document.addEventListener(`mousedown`,t),()=>{document.removeEventListener(`keydown`,e),document.removeEventListener(`mousedown`,t)}},[h,n]),!t)return null;let b=e=>e?e.replace(/CommandOrControl|CmdOrCtrl/g,`Ctrl`).replace(/Command/g,`Ctrl`).replace(/Control/g,`Ctrl`):``,x=async(e,t)=>{if(h){if(n===e){r(null);return}let i=t.currentTarget.getBoundingClientRect(),a=y.current+1;y.current=a,r(e),g([]);let o=await window.electronBridge.getApplicationMenuItems(e);y.current===a&&(v({left:Math.round(i.left),top:Math.round(i.bottom)}),g(o?.items??[]))}else{let n=window.electronBridge?.showApplicationMenu;if(!n)return;let i=y.current+1;y.current=i,r(e);let a=t.currentTarget.getBoundingClientRect();try{await n(e,Math.round(a.left),Math.round(a.bottom))}finally{y.current===i&&r(null)}}},S=async e=>{e.enabled!==!1&&!e.submenu&&n&&(await window.electronBridge?.clickApplicationMenuItem?.(n,e.path),r(null))},C=`no-drag rounded-md border border-transparent px-2.5 py-1 text-base font-normal leading-none outline-none transition-colors`,w=t=>c(C,n===t?`bg-[var(--color-token-menubar-selection-background)] text-[var(--color-token-menubar-selection-foreground)]`:`text-token-text-tertiary hover:bg-token-foreground/5 hover:text-token-description-foreground focus-visible:bg-token-foreground/5 focus-visible:text-token-description-foreground`),M=(e,t=0)=>e.flatMap(e=>e.type===`separator`?[(0,Q.jsx)(`div`,{className:`mx-1 my-1 border-t border-token-border/60`,role:`separator`},e.path)]:[(0,Q.jsx)(`button`,{type:`button`,"aria-haspopup":e.submenu?`menu`:void 0,className:c(`flex w-full items-center gap-3 rounded-lg p-1.5 text-left text-sm outline-none transition-colors`,e.enabled===!1?`cursor-default opacity-50`:e.submenu?`cursor-default text-token-text-tertiary`:`cursor-interaction hover:bg-token-list-hover-background focus:bg-token-list-hover-background`),disabled:e.enabled===!1,onClick:()=>{e.submenu?null:S(e)},children:(0,Q.jsxs)(`span`,{className:`flex w-full items-center gap-3`,style:{paddingLeft:t*14},children:[(0,Q.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:e.label}),e.submenu?(0,Q.jsx)(`span`,{className:`shrink-0 text-xs text-token-text-tertiary`,children:`>`}):e.accelerator?(0,Q.jsx)(`span`,{className:`shrink-0 pl-4 text-xs text-token-text-tertiary tabular-nums`,children:b(e.accelerator)}):null]})},e.path),...(e.submenu?M(e.submenu,t+1):[])]);return(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`div`,{className:`flex items-center gap-0.5 pr-2 pl-1`,children:tr.map(({id:t,message:i})=>(0,Q.jsx)(`button`,{type:`button`,"data-linux-menu-trigger":h?`true`:void 0,"aria-expanded":n===t,"aria-haspopup":`menu`,"aria-label":e.formatMessage(i),className:w(t),onClick:e=>{x(t,e)},children:(0,Q.jsx)(k,{...i})},t))}),h&&n&&_&&(0,Q.jsx)(`div`,{id:`linux-application-menu-panel`,className:`no-drag fixed z-50 m-px flex min-w-[220px] flex-col rounded-xl bg-token-dropdown-background/90 p-1 text-token-foreground shadow-lg ring-[0.5px] ring-token-border backdrop-blur-sm select-none`,style:{left:_.left,top:_.top},children:M(m)})]})}var rr=280,ir=`app-shell:bottom-panel-height`;function ar(e,t){return Number.isFinite(e)?Math.max(160,Math.min(e,t*.5)):rr}function or(e){return ar(j(ir,280),e)}function sr(e,t){M(ir,ar(e,t))}function cr(e){let t=(0,$.c)(10),{size:n,animation:r,isVisible:i}=e,[,a]=(0,Z.useState)(0),o;t[0]!==r||t[1]!==a?(o=()=>{r.get()>0||a(ur)},t[0]=r,t[1]=a,t[2]=o):o=t[2],Gt(r,`animationComplete`,o);let s;t[3]!==r||t[4]!==n?(s=[r,n],t[3]=r,t[4]=n,t[5]=s):s=t[5];let c=Xt(s,lr),l=i||r.get()>0,u;return t[6]!==c||t[7]!==r||t[8]!==l?(u={isMounted:l,animatedSize:c,opacity:r,progress:r},t[6]=c,t[7]=r,t[8]=l,t[9]=u):u=t[9],u}function lr(e){let[t,n]=e;return Math.max(0,Math.min(1,t))*n}function ur(e){return e+1}function dr({bottomPanelHeight:e,children:t,clampedBottomPanelHeight:n,mainContentHeight:r,isVisible:i=!1}){let a=v(I),{isMounted:o,opacity:s,animatedSize:c}=cr({animation:y(Ye),size:n,isVisible:i}),l=Jt`${n}px`;return!o&&!i?null:(0,Q.jsxs)(U.div,{"data-app-shell-focus-area":`bottom-panel`,className:`relative z-30 min-h-0 w-full shrink-0 overflow-visible`,style:{opacity:s,height:c},transition:Ke,children:[(0,Q.jsx)(Bn,{defaultSize:280,edge:`top`,getCurrentSize:()=>n.get(),setSize:t=>{if(t{em==null?null:ot.getSnapshot(m.conversationId,m.browserTabId),e[7]=m,e[8]=_);let b=_,x=(0,Z.useSyncExternalStore)(gr,b,b)?.tabType===n.WEB?m:null,S=x?.conversationId??null,w=x?.browserTabId??null,T,D;e[9]!==g||e[10]!==a||e[11]!==c||e[12]!==h||e[13]!==o||e[14]!==S||e[15]!==w?(T=()=>{C.dispatchMessage(`app-shell-shortcut-state-changed`,{bottomPanelCanCloseActiveTab:g,focusArea:a,imagePreviewOpen:c,terminalFocused:o,rightPanelBrowserConversationId:S,rightPanelBrowserTabId:w,rightPanelCanCloseActiveTab:h})},D=[g,a,c,o,h,S,w],e[9]=g,e[10]=a,e[11]=c,e[12]=h,e[13]=o,e[14]=S,e[15]=w,e[16]=T,e[17]=D):(T=e[16],D=e[17]),(0,Z.useEffect)(T,D);let O;e[18]===Symbol.for(`react.memo_cache_sentinel`)?(O=[],e[18]=O):O=e[18],(0,Z.useEffect)(mr,O);let k;e[19]===Symbol.for(`react.memo_cache_sentinel`)?(k=[],e[19]=k):k=e[19],E(`image-preview-zoom-command`,pr,k);let A,j;return e[20]!==s||e[21]!==f||e[22]!==t?(A=e=>{let{panelId:n}=e;bb80:switch(n){case`bottom`:at.closeActiveTab(t);break bb80;case`right`:if(rt.closeActiveTab(t))break bb80;f!=null&&s!=null&&rt.closeTab(t,s.tabId)}},j=[s,f,t],e[20]=s,e[21]=f,e[22]=t,e[23]=A,e[24]=j):(A=e[23],j=e[24]),E(`close-active-app-shell-tab`,A,j),null}function pr(e){let{command:t}=e;Ht(t)}function mr(){return hr}function hr(){C.dispatchMessage(`app-shell-shortcut-state-changed`,{bottomPanelCanCloseActiveTab:!1,focusArea:`main`,imagePreviewOpen:!1,terminalFocused:!1,rightPanelBrowserConversationId:null,rightPanelBrowserTabId:null,rightPanelCanCloseActiveTab:!1})}function gr(e){return ot.subscribe(e)}var _r=`[&_a]:pointer-events-auto [&_button]:pointer-events-auto [&_input]:pointer-events-auto [&_select]:pointer-events-auto [&_textarea]:pointer-events-auto`;function vr({isHeaderEdgeScroll:e,isWindowsMenuBarEnabled:t}){let{headerLeftWidth:n,headerRightWidth:r,leftPanelAnimatedWidth:i,rightPanelAnimatedWidth:a,leftPanelWidth:lp}=Je(),flw=y(Wr),fls=y(Ze),o=Kt(0),s=Jt`${i}px`,l=Jt`${a}px`,u=y(fe),d=y(et),f=y(be),p=y(ce),m=y(ye),h=y(xe),g=d.filter(({align:e})=>e===`start`),_=d.filter(({align:e})=>e===`end`),v=d.length>0,b=g.length>0,x=_.length>0,S=m.length>0,C=u!=null||v;return(0,Q.jsx)(Ct,{items:f,children:(0,Q.jsxs)(U.header,{"data-app-shell-header-edge-scroll":e,className:c(`app-header-tint draggable pointer-events-none fixed z-30 flex h-toolbar min-w-0 items-center`,t?`right-0`:`inset-x-0`,t?`top-toolbar-sm`:`top-0`),style:t?{left:flw&&!fls?`${Math.max(lp.get(),i.get())}px`:s}:{},children:[(0,Q.jsx)(yr,{entries:p,fitWidth:n,slotWidth:t?o:i,side:`start`}),C&&(0,Q.jsxs)(`div`,{"aria-hidden":h,"data-testid":`app-shell-header-context-menu-surface`,className:c(`pointer-events-none ms-4 flex h-full min-w-0 flex-1 isolate items-center gap-1.5 overflow-hidden [contain:layout_paint]`,h&&`invisible`,S?`pe-1.5`:`pe-2`),children:[u!=null&&(0,Q.jsx)(`div`,{className:c(`pointer-events-none w-full min-w-0 flex-1`,_r),children:u}),b&&(0,Q.jsx)(`div`,{className:`flex shrink-0 items-center gap-1.5`,children:g.map(({actionId:e,node:t})=>(0,Q.jsx)(`div`,{className:`no-drag pointer-events-auto flex shrink-0 items-center`,children:t},e))}),x&&(0,Q.jsx)(`div`,{className:`ms-auto flex shrink-0 items-center gap-1.5`,children:_.map(({actionId:e,node:t})=>(0,Q.jsx)(`div`,{className:`no-drag pointer-events-auto flex shrink-0 items-center`,children:t},e))})]}),(0,Q.jsx)(yr,{entries:m,fitWidth:r,slotWidth:l,side:`end`})]})})}function yr({entries:e,fitWidth:t,side:n,slotWidth:r}){let i=e.some(({align:e})=>e===`end`),a=c({"ps-[max(var(--spacing-token-safe-header-left),0.5rem)]":n===`start`,"pe-2":n===`start`&&i||n===`end`}),o=At(e=>{let{width:n}=kt(e);t.set(n)});return(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`div`,{"aria-hidden":!0,className:c(`invisible pointer-events-none fixed top-0 left-0 min-w-max [&_*]:![view-transition-name:none]`,!!e.length&&a),ref:o,children:(0,Q.jsx)(br,{entries:e})}),(0,Q.jsx)(U.div,{"data-test-id":`header-shell-slot`,className:c(`pointer-events-none relative h-full shrink-0 [container-type:inline-size]`,!!e.length&&a),style:{width:r,minWidth:Jt`${t}px`},children:(0,Q.jsx)(br,{entries:e,fillSlot:!0})})]})}function br(e){let t=(0,$.c)(11),{entries:n,fillSlot:r}=e,i=r===void 0?!1:r,a,o,s;if(t[0]!==n||t[1]!==i){let e=n.filter(wr),r=n.filter(Cr),l=i?`pointer-events-none w-full`:`no-drag pointer-events-auto w-auto`;t[5]===l?a=t[6]:(a=c(`inline-flex h-full items-center gap-1.5`,l),t[5]=l,t[6]=a),o=e.map(Sr),s=r.map(xr),t[0]=n,t[1]=i,t[2]=a,t[3]=o,t[4]=s}else a=t[2],o=t[3],s=t[4];let l;return t[7]!==a||t[8]!==o||t[9]!==s?(l=(0,Q.jsxs)(`div`,{className:a,children:[o,s]}),t[7]=a,t[8]=o,t[9]=s,t[10]=l):l=t[10],l}function xr(e,t){let{actionId:n,node:r}=e;return(0,Q.jsx)(`div`,{className:c(`no-drag pointer-events-auto flex shrink-0 items-center`,t===0&&`ms-auto`),children:r},n)}function Sr(e){let{actionId:t,node:n}=e;return(0,Q.jsx)(`div`,{className:`no-drag pointer-events-auto flex shrink-0 items-center`,children:n},t)}function Cr(e){let{align:t}=e;return t===`end`}function wr(e){let{align:t}=e;return t===`start`}function Tr({children:e,paddingTop:t}){let n=v(w),{leftPanelAnimatedWidth:r,leftPanelWidth:i}=Je(),[a,o]=(0,Z.useState)(!1),s=y(qe),l=Jt`${i}px`;return(0,Q.jsxs)(U.aside,{className:c(`app-shell-left-panel pointer-events-auto relative flex overflow-visible browser:bg-token-main-surface-primary`,a&&`cursor-col-resize`),style:{width:r,paddingTop:t},children:[(0,Q.jsx)(U.div,{className:`max-w-full overflow-hidden`,style:{minWidth:l,width:l,opacity:y(Oe)},children:e}),(0,Q.jsx)(Bn,{disabled:s,defaultSize:300,getCurrentSize:()=>i.get(),onResizingChange:o,setSize:e=>{if(e{e{f.set(f.get()+1)}),!h&&!t?null:(0,Q.jsxs)(U.aside,{"data-app-shell-focus-area":`right-panel`,className:`relative z-[41] ml-auto h-full min-h-0 min-w-0 shrink-0 overflow-visible`,style:{opacity:g,width:_},transition:Ke,children:[!p&&(0,Q.jsx)(`div`,{"aria-hidden":!0,className:`pointer-events-none absolute inset-y-0 left-0 z-30 w-px shadow-[-8px_0_16px_-8px_rgb(0_0_0/0.18)]`}),!p&&(0,Q.jsx)(Bn,{defaultSize:l??u.defaultWidth,edge:`left`,getCurrentSize:()=>r.get(),setSize:e=>{if(e{e{let[t,r]=e;return n?t:Qe(r,t,o)},t[3]=n,t[4]=o,t[5]=c):c=t[5];let l=Xt(s,c),u;t[6]!==i||t[7]!==l?(u=[i,l],t[6]=i,t[7]=l,t[8]=u):u=t[8];let d;t[9]===n?d=t[10]:(d=e=>{let[t,r]=e;return n?0:Math.max(0,Math.min(1,t))*r},t[9]=n,t[10]=d);let f=Xt(u,d),p;return t[11]!==f||t[12]!==l||t[13]!==a||t[14]!==o?(p={rightPanelAnimatedWidth:f,rightPanelWidth:l,rightPanelWidthRatio:a,widthMode:o},t[11]=f,t[12]=l,t[13]=a,t[14]=o,t[15]=p):p=t[15],p}function Ar(e,t){let n=(0,Z.useRef)(null);if(n.current!=null&&n.current.defaultWidth===e.defaultWidth&&n.current.storageKey===e.storageKey)return n.current.widthRatio;let r=K(Re({...e,mainContentWidth:t.get()}));return n.current={...e,widthRatio:r},r}function jr(e){let t=(0,$.c)(30),{children:n}=e,r=v(I),i;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(i={activationConstraint:{distance:6}},t[0]=i):i=t[0];let a=d(u(f,i)),[o,s]=(0,Z.useState)(null),c=(0,Z.useRef)(null),l;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(l=(e,t)=>{s(n=>n==null?n:ln(n,e,t))},t[1]=l):l=t[1];let m=l,h;t[2]===r?h=t[3]:(h=e=>{let t=Nr(e.active.data.current);if(t?.kind!==`app-shell-tab`)return;let n=r.get(t.controller.tabs$),i=n.findIndex(e=>e.tabId===t.tabId),a=n[i]??null;a!=null&&(c.current={sourceController:t.controller,sourceIndex:i,tabId:t.tabId},s({draggedTab:a,isDraggedTabActive:r.get(t.controller.activeTab$)?.tabId===t.tabId,overTabId:null,previewController:t.controller,sourceController:t.controller}))},t[2]=r,t[3]=h);let _=h,y;t[4]!==o||t[5]!==r?(y=e=>{let t=c.current;if(o==null||t==null)return;let n=Nr(e.over?.data.current);if(n!=null)if(n.kind===`app-shell-tab`){if(n.tabId===t.tabId)return;if(n.controller===t.sourceController){cn(r,t.sourceController,t.tabId,n.tabId),m(t.sourceController,null);return}m(n.controller,n.tabId)}else m(n.controller,null)},t[4]=o,t[5]=r,t[6]=y):y=t[6];let b=y,x;t[7]!==o||t[8]!==r?(x=e=>{let t=c.current;o!=null&&t!=null&&(sn(r,t),o.isDraggedTabActive&&t.sourceController.activateTab(r,t.tabId)),s(null),c.current=null},t[7]=o,t[8]=r,t[9]=x):x=t[9];let S=x,C;t[10]!==o||t[11]!==r?(C=e=>{let t=c.current;o!=null&&t!=null&&e.over==null?(sn(r,t),o.isDraggedTabActive&&t.sourceController.activateTab(r,t.tabId)):o!=null&&t!=null&&o.previewController!==t.sourceController&&(t.sourceController.moveTabTo(r,t.tabId,o.previewController,o.overTabId,{activate:!1}),o.isDraggedTabActive&&o.previewController.activateTab(r,t.tabId)),s(null),c.current=null},t[10]=o,t[11]=r,t[12]=C):C=t[12];let w=C,T;t[13]===o?T=t[14]:(T={dragState:o},t[13]=o,t[14]=T);let E;t[15]===o?E=t[16]:(E=o==null?null:(0,Q.jsx)(Mr,{dragState:o}),t[15]=o,t[16]=E);let D;t[17]===E?D=t[18]:(D=(0,Q.jsx)(p,{adjustScale:!1,children:E}),t[17]=E,t[18]=D);let O;t[19]!==n||t[20]!==S||t[21]!==w||t[22]!==b||t[23]!==_||t[24]!==a||t[25]!==D?(O=(0,Q.jsxs)(g,{sensors:a,collisionDetection:Pr,onDragStart:_,onDragOver:b,onDragCancel:S,onDragEnd:w,children:[n,D]}),t[19]=n,t[20]=S,t[21]=w,t[22]=b,t[23]=_,t[24]=a,t[25]=D,t[26]=O):O=t[26];let k;return t[27]!==O||t[28]!==T?(k=(0,Q.jsx)(on.Provider,{value:T,children:O}),t[27]=O,t[28]=T,t[29]=k):k=t[29],k}function Mr(e){let t=(0,$.c)(12),{dragState:n}=e,{highlightedIcon:r,icon:i,isClosable:a,isHighlighted:o,isLabel:s,isPreview:c,tabId:l,title:u,tooltip:d,trailingContent:f}=n.draggedTab,p;return t[0]!==n.isDraggedTabActive||t[1]!==r||t[2]!==i||t[3]!==a||t[4]!==o||t[5]!==s||t[6]!==c||t[7]!==l||t[8]!==u||t[9]!==d||t[10]!==f?(p=(0,Q.jsx)(`div`,{className:`relative my-auto flex max-w-40 shrink-0 items-center gap-0.5 pe-1`,children:(0,Q.jsx)(tn,{id:l,highlightedIcon:r,icon:i,isActive:n.isDraggedTabActive,isClosable:a,isDragging:!0,isHighlighted:o,isLabel:s,isPreview:c,trailingContent:f,title:u,tooltip:d})}),t[0]=n.isDraggedTabActive,t[1]=r,t[2]=i,t[3]=a,t[4]=o,t[5]=s,t[6]=c,t[7]=l,t[8]=u,t[9]=d,t[10]=f,t[11]=p):p=t[11],p}function Nr(e){if(typeof e!=`object`||!e)return null;switch(Reflect.get(e,`kind`)){case`app-shell-tab`:case`app-shell-tab-strip`:return e;default:return null}}function Pr(e){let t=h(e),n=t.filter(e=>Nr(e.data?.droppableContainer.data.current)?.kind===`app-shell-tab`);if(n.length>0)return n;let r=t.find(e=>Nr(e.data?.droppableContainer.data.current)?.kind===`app-shell-tab-strip`)??null,i=r==null?null:Nr(r.data?.droppableContainer.data.current);if(r!=null&&i?.kind===`app-shell-tab-strip`){let t=e.droppableContainers.filter(e=>{let t=Nr(e.data.current);return t?.kind===`app-shell-tab`&&t.controller===i.controller});return t.length>0?l({...e,droppableContainers:t}):[r]}return l(e)}var Fr=`data-app-shell-focus-area`,Ir=96,Lr=16,Rr=960,zr=720,Br=12,Vr=0,Hr=b(w,({get:e})=>{let t=e(zn.px$);return t!=null&&t>=0&&t<=Br}),Ur=b(w,({get:e})=>{let t=e(zn.px$),n=e(Ue)-Vr;return t!=null&&t>=0&&t<=n}),Wr=S(I,!1,{onMount:(e,t)=>{let n=!1,r,i;e(!1);let a=t.watch(({get:a})=>{if(a(Ze)){n=!1,r=void 0,i=void 0,e(!1);return}if(a(qe)){e(!1);return}let o=a(zn.px$),s=a(zn.py$),c=a(Hr),l=a(Ur),u=a(Le),d=a(Ne);if(u){d&&(n=!0);let a=r!==void 0&&i!==void 0&&(o!==r||s!==i);r===void 0&&(r=o,i=s),(a||n&&!d)&&!c&&!d&&(n=!1,r=void 0,i=void 0,t.set(Le,!1)),e(!1);return}n=!1,r=void 0,i=void 0;let f=a(ze);e(e=>{let t=e?l||f:c||f;return e===t?e:t})});return()=>{e(!1),a()}}});function Gr({bottomPanelSlot:e,children:t,leftPanelSlot:n,rightPanelSlot:r}){let i=v(I),a=(0,Z.useRef)(null),[o,s]=(0,Z.useState)(null),l=n?.children,u=l!=null,d=e!=null,f=r!=null,p=(0,Z.useRef)(!1),m=(0,Z.useRef)(!1),h=y(xe),g=y(se),_=N(),b=zt(),x=$n(),[S,C]=(0,Z.useState)(!1),w=y(Ze),T=y(R),E=y(Wr),D=g===`thread-edge-scroll`,O=u&&w,k=D&&S&&!h,A=g===`full-bleed`,j=`visible`;A?j=`hidden`:D?j=`full-bleed`:f&&(j=`hidden`);let M=Kt(ae()),ee=Xt(M,e=>`${Math.max(0,e-Vr*2)}px`),{isMounted:P,animatedSize:F}=cr({animation:y(Oe),size:M,isVisible:O}),L=Kt(window.innerWidth),z=Kt(window.innerHeight-46),B=Kt(or(z.get())),V=y(Ye),H=Xt([B,z],([e,t])=>ar(e,t)),W=Xt([V,H],([e,t])=>e*t),G=Jt`${W}px`,K=Kt(0),q=Kt(0),J=Kt(0),Y=Xt([L,F],([e,t])=>Math.max(0,e-t)),{rightPanelAnimatedWidth:X,rightPanelWidth:ne,rightPanelWidthRatio:ie,widthMode:oe}=kr({isFullWidth:h,mainContentWidth:Y}),ce=Xt([L,ie],([e,t])=>Ee({isRightPanelOpen:f,mainContentWidth:e,rightPanelWidthMode:oe,rightPanelWidthRatio:t})),le=Xt([L,M,ie],([e,t,n])=>Ee({isRightPanelOpen:f,mainContentWidth:Math.max(0,e-t),rightPanelWidthMode:oe,rightPanelWidthRatio:n})),ue=O?le:ce,de=(0,Z.useRef)(W.get()),fe=(0,Z.useRef)(new Set),pe={"--spacing-token-safe-header-left":`${b.left/_}px`,"--spacing-token-safe-header-right":`${b.right/_}px`,width:`calc(100vw / var(--codex-window-zoom))`,height:`calc(100vh / var(--codex-window-zoom))`,zoom:`var(--codex-window-zoom)`,"--app-shell-bottom-panel-height":G},me=(0,Z.useMemo)(()=>({headerLeftWidth:q,headerRightWidth:J,leftPanelWidth:M,leftPanelAnimatedWidth:F,mainContentTargetWidth:ue,mainContentWidth:Y,shellWidth:L,rightPanelAnimatedWidth:X,rightPanelLayoutTick:K}),[q,J,F,M,ue,Y,X,K,L]),he=u,ge=(0,Z.useCallback)(e=>(fe.current.add(e),()=>{fe.current.delete(e)}),[]),_e=St(({width:e})=>{L.set(e);let t=e<=Rr,n=e<=zr,r=t!==p.current,a=n!==m.current;!r&&!a||(p.current=t,m.current=n,(r&&O&&f&&t||a&&n)&&(i.get(te)===`right-panel`&&Me(i,`main`),i.get(xe)&&i.set(xe,!1),i.get(Te)&&$e(i,!1)),a&&n&&i.get(Ze)&&re(i,!1))}),ve=At(e=>{let{width:t}=kt(e);_e({width:t})}),ye=At(e=>{let{width:t}=kt(e);C(t>=Zr())}),be=At(e=>{let{height:t}=kt(e);z.set(t)}),Se=(0,Z.useCallback)(e=>{s(e)},[]),Ce=(0,Z.useMemo)(()=>Lt(Se,be),[be,Se]);return Gt(W,`change`,e=>{let t=e-de.current;if(de.current=e,t!==0)for(let e of fe.current)e(t)}),(0,Q.jsx)(Er.Provider,{value:a,children:(0,Q.jsx)(Dr.Provider,{value:o,children:(0,Q.jsx)(Bt.Provider,{value:ge,children:(0,Q.jsxs)(Ie.Provider,{value:me,children:[(0,Q.jsx)(En,{}),(0,Q.jsx)(fr,{}),(0,Q.jsxs)(U.div,{ref:a,style:pe,className:`relative flex flex-col`,onBlurCapture:e=>{e.relatedTarget instanceof Node&&e.currentTarget.contains(e.relatedTarget)||(Me(i,`main`),Be(i,!1))},onFocusCapture:e=>{Me(i,Yr(e.target)),Be(i,Xr(e.target))},onPointerOverCapture:e=>{Xe(i,Yr(e.target))},children:[x&&(0,Q.jsx)(Qr,{}),(0,Q.jsxs)(`div`,{ref:ve,className:`relative isolate flex max-h-full min-h-0 w-full flex-1`,children:[(0,Q.jsx)(tt,{initial:!1,children:u&&(O||P)&&(0,Q.jsx)(Tr,{paddingTop:x?`0px`:`var(--height-toolbar)`,children:l},`app-shell-left-panel`)}),he&&!w&&!P&&(0,Q.jsx)(Kr,{floatingLeftPanelWidth:ee,isWindowsMenuBarEnabled:x,isVisible:E&&!w&&!P,leftPanelWidth:M,leftPanel:l,shouldUseReducedMotion:T,onOpenSidebar:()=>{re(i,!0,{animate:!1})}}),(0,Q.jsx)(`main`,{ref:Ce,className:c(`relative isolate flex min-h-0 flex-1 flex-col`,`main-surface`,P&&`rounded-s-2xl`,!P&&`!rounded-l-none`),children:(0,Q.jsxs)(jr,{children:[(0,Q.jsx)(vr,{isHeaderEdgeScroll:k,isWindowsMenuBarEnabled:x}),(0,Q.jsxs)(`div`,{className:`relative isolate flex min-h-0 flex-1 overflow-hidden`,children:[(0,Q.jsx)(`div`,{"data-app-shell-main-content-layout":g,ref:ye,className:c(`app-shell-main-content-viewport relative flex min-h-0 min-w-0 flex-col`,h?`w-0 flex-none overflow-hidden`:`flex-1`),children:(0,Q.jsx)(`div`,{className:c(`app-shell-main-content-frame relative mt-(--app-shell-main-content-frame-top-offset) flex min-h-0 flex-1 flex-col border-t`,f||D&&!k?`border-token-border-default`:`border-transparent`),children:(0,Q.jsxs)(`div`,{className:`relative flex min-h-0 flex-1`,children:[(0,Q.jsx)(`div`,{"aria-hidden":!0,"data-app-shell-main-content-top-fade":j,className:`app-shell-main-content-top-fade pointer-events-none absolute inset-x-0 top-0 z-20 h-4 bg-gradient-to-b from-token-main-surface-primary opacity-0 transition-opacity duration-200 browser:hidden`}),(0,Q.jsx)(`div`,{className:`h-full min-h-0 min-w-0 flex-1`,children:t})]})})}),(0,Q.jsx)(Or,{isRightPanelOpen:f,mainContentWidth:Y,rightPanelWidth:ne,rightPanelWidthRatio:ie,widthMode:oe,children:r?.children},`right-panel:${i.value.pathname}`)]}),(0,Q.jsx)(dr,{bottomPanelHeight:B,clampedBottomPanelHeight:H,mainContentHeight:z,isVisible:d,children:(0,Q.jsx)(Jr,{})})]})})]})]})]})})})})}function Kr(e){let t=(0,$.c)(15),{floatingLeftPanelWidth:n,isWindowsMenuBarEnabled:r,isVisible:i,leftPanel:a,leftPanelWidth:o,shouldUseReducedMotion:s,onOpenSidebar:l}=e,u=v(w),[d,f]=(0,Z.useState)(!1),p=i||d,m;t[0]===s?m=t[1]:(m=s?{duration:0}:Ke,t[0]=s,t[1]=m);let h=m,g;t[2]!==n||t[3]!==p||t[4]!==d||t[5]!==r||t[6]!==a||t[7]!==o||t[8]!==l||t[9]!==u||t[10]!==s||t[11]!==h?(g=p?(0,Q.jsxs)(U.div,{className:c(`pointer-events-auto fixed bottom-0 left-0 z-40 min-h-0`,d&&`cursor-col-resize`,r?`top-toolbar-sm`:`top-0`),initial:s?!1:{opacity:0,x:-8},animate:{opacity:1,x:0},exit:{opacity:0,x:s?0:-8},style:{width:n,zIndex:40},transition:h,children:[(0,Q.jsxs)(`aside`,{"data-testid":`app-shell-floating-left-panel`,className:`flex h-full min-h-0 flex-col overflow-hidden rounded-lg bg-token-main-surface-primary shadow-[1px_0_0_0_var(--color-token-border-default),0_20px_25px_-5px_rgb(0_0_0/0.1),0_8px_10px_-6px_rgb(0_0_0/0.1)]`,children:[r?null:(0,Q.jsx)(U.div,{initial:s?!1:{x:8},animate:{x:0},exit:{x:s?0:8},transition:h,className:`app-header-tint flex h-toolbar shrink-0 items-center ps-(--spacing-token-safe-header-left) pe-2`,children:(0,Q.jsx)(qn,{hideUnreadBadge:!0,onToggleSidebar:l})}),(0,Q.jsx)(`div`,{className:`min-h-0 flex-1 overflow-hidden`,children:a})]}),(0,Q.jsx)(Bn,{defaultSize:300,getCurrentSize:()=>o.get(),onResizingChange:f,setSize:e=>{let t=ie(e);u.set(Ue,t),o.set(t)},onResizeEnd:qr})]}):null,t[2]=n,t[3]=p,t[4]=d,t[5]=r,t[6]=a,t[7]=o,t[8]=l,t[9]=u,t[10]=s,t[11]=h,t[12]=g):g=t[12];let _;return t[13]===g?_=t[14]:(_=(0,Q.jsx)(tt,{initial:!1,children:g}),t[13]=g,t[14]=_),_}function qr(e){he(ie(e))}function Jr(){let e=(0,$.c)(5),t=y(at.activeTab$),n=y(me),r=y(ge),i=y(oe);if(t!=null){let t;return e[0]!==r||e[1]!==i?(t=(0,Q.jsx)(fn,{headerHeight:`pane`,afterList:r,afterListSticky:i,controller:at}),e[0]=r,e[1]=i,e[2]=t):t=e[2],t}let a;return e[3]===n?a=e[4]:(a=n==null?null:(0,Q.jsx)(Q.Fragment,{children:n}),e[3]=n,e[4]=a),a}function Yr(e){if(!(e instanceof HTMLElement))return`main`;let t=e.closest(`[${Fr}]`)?.getAttribute(Fr);return t===`right-panel`||t===`bottom-panel`?t:`main`}function Xr(e){return e instanceof HTMLElement&&e.closest(`[data-codex-terminal]`)!=null}function Zr(){let e=Number.parseFloat(getComputedStyle(document.documentElement).fontSize);return Number.isFinite(e)?Ir*e:Ir*Lr}function Qr(){let e=(0,$.c)(6),t=y(ct),n;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,Q.jsx)(qn,{}),e[0]=n):n=e[0];let r;e[1]===t?r=e[2]:(r=st(t)?(0,Q.jsx)(Pn,{}):null,e[1]=t,e[2]=r);let i;e[3]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,Q.jsx)(nr,{}),e[3]=i):i=e[3];let a;return e[4]===r?a=e[5]:(a=(0,Q.jsxs)(`div`,{className:`app-header-tint draggable group/windows-top-bar z-50 flex h-toolbar-sm items-center ps-(--spacing-token-safe-header-left) pe-0`,children:[n,r,i,(0,Q.jsx)(LinuxWindowControls,{})]}),e[4]=r,e[5]=a),a}function LinuxWindowControls(){let{platform:e}=nt(),t=window.electronBridge?.controlWindow;if(e!==`linux`||typeof t!=`function`)return null;let n=e=>()=>{void t(e)},[a,u]=(0,Z.useState)(!1),o=`no-drag cursor-interaction inline-flex h-7 w-7 shrink-0 items-center justify-center rounded-md border border-transparent bg-transparent p-0 outline-none transition-colors hover:bg-token-foreground/5 focus-visible:bg-token-foreground/5`,r=c(o,`text-token-text-tertiary hover:text-token-description-foreground focus-visible:text-token-description-foreground`),i=c(o,a?`text-token-charts-red`:`text-token-text-tertiary`);return(0,Q.jsxs)(`div`,{"data-linux-codex-window-controls":`true`,className:`no-drag ml-auto flex shrink-0 items-center gap-0.5 pe-2`,children:[(0,Q.jsx)(`button`,{type:`button`,className:r,onClick:n(`minimize`),"aria-label":`Minimize`,children:(0,Q.jsx)(`svg`,{className:`h-2.5 w-2.5`,viewBox:`0 0 10 10`,fill:`none`,"aria-hidden":`true`,children:(0,Q.jsx)(`path`,{d:`M0 5h10`,stroke:`currentColor`,strokeWidth:1})})}),(0,Q.jsx)(`button`,{type:`button`,className:r,onClick:n(`maximize`),"aria-label":`Maximize`,children:(0,Q.jsx)(`svg`,{className:`h-2.5 w-2.5`,viewBox:`0 0 10 10`,fill:`none`,"aria-hidden":`true`,children:(0,Q.jsx)(`rect`,{x:.5,y:.5,width:9,height:9,stroke:`currentColor`,strokeWidth:1})})}),(0,Q.jsx)(`button`,{type:`button`,className:i,onMouseEnter:()=>u(!0),onMouseLeave:()=>u(!1),onFocus:()=>u(!0),onBlur:()=>u(!1),onClick:n(`close`),"aria-label":`Close`,children:(0,Q.jsx)(`svg`,{className:`h-2.5 w-2.5`,viewBox:`0 0 10 10`,fill:`none`,"aria-hidden":`true`,children:(0,Q.jsx)(`path`,{d:`M1 1l8 8M9 1L1 9`,stroke:`currentColor`,strokeWidth:1})})})]})}function $r(e){return null}function ei(e){let{children:t}=e;return gi(v(I),fe,t),null}function ti(e){let t=(0,$.c)(23),{actionId:n,align:r,children:i,order:a,slotPosition:o}=e,s=r===void 0?`start`:r,c=a===void 0?0:a,l=o===void 0?`center`:o,u=v(I),d=ve[l],f;t[0]!==n||t[1]!==s||t[2]!==i||t[3]!==c||t[4]!==d.byId||t[5]!==u?(f=()=>{u.set(d.byId,n,{align:s,node:i,order:c})},t[0]=n,t[1]=s,t[2]=i,t[3]=c,t[4]=d.byId,t[5]=u,t[6]=f):f=t[6];let p;t[7]!==n||t[8]!==s||t[9]!==i||t[10]!==c||t[11]!==d||t[12]!==u?(p=[n,s,i,c,d,u],t[7]=n,t[8]=s,t[9]=i,t[10]=c,t[11]=d,t[12]=u,t[13]=p):p=t[13],(0,Z.useLayoutEffect)(f,p);let m;t[14]!==n||t[15]!==d.byId||t[16]!==d.ids$||t[17]!==u?(m=()=>(u.set(d.ids$,e=>e.includes(n)?e:[...e,n]),()=>{u.set(d.ids$,e=>e.filter(e=>e!==n)),u.set(d.byId,n,null)}),t[14]=n,t[15]=d.byId,t[16]=d.ids$,t[17]=u,t[18]=m):m=t[18];let h;return t[19]!==n||t[20]!==d||t[21]!==u?(h=[n,d,u],t[19]=n,t[20]=d,t[21]=u,t[22]=h):h=t[22],(0,Z.useLayoutEffect)(m,h),null}function ni(e){let t=(0,$.c)(8),n=v(I),r,i;t[0]!==e||t[1]!==n?(r=()=>{n.set(ne.byId,e.id,e)},i=[e,n],t[0]=e,t[1]=n,t[2]=r,t[3]=i):(r=t[2],i=t[3]),(0,Z.useLayoutEffect)(r,i);let a,o;return t[4]!==e.id||t[5]!==n?(a=()=>(n.set(ne.ids$,t=>t.includes(e.id)?t:[...t,e.id]),()=>{n.set(ne.ids$,t=>t.filter(t=>t!==e.id)),n.set(ne.byId,e.id,null)}),o=[e.id,n],t[4]=e.id,t[5]=n,t[6]=a,t[7]=o):(a=t[6],o=t[7]),(0,Z.useLayoutEffect)(a,o),null}function ri(e){return null}function ii(){let e=(0,$.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,Q.jsx)(Tn,{}),e[0]=t):t=e[0],t}function ai(e){let{children:t}=e;return gi(v(I),we,t),null}function oi(e){let t=(0,$.c)(9),{children:n,defaultWidth:r,widthStorageKey:i}=e,a=r===void 0?600:r,o=v(I),s;t[0]!==o||t[1]!==i?(s=i??ke(o.value.routeTemplate),t[0]=o,t[1]=i,t[2]=s):s=t[2];let c=s;gi(o,de,n);let l,u;return t[3]!==a||t[4]!==c||t[5]!==o||t[6]!==i?(l=()=>{if(!(a===600&&i==null))return o.set(X,{defaultWidth:a,storageKey:c}),()=>{o.set(X,null)}},u=[a,c,o,i],t[3]=a,t[4]=c,t[5]=o,t[6]=i,t[7]=l,t[8]=u):(l=t[7],u=t[8]),(0,Z.useLayoutEffect)(l,u),null}function si(e){let{children:t}=e;return gi(v(I),ue,t),null}function ci(e){let{children:t}=e;return gi(v(I),Se,t),null}function li(e){let{children:t}=e;return gi(v(I),Ce,t),null}function ui(){return null}function di(){let e=(0,$.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,Q.jsx)(Sn,{}),e[0]=t):t=e[0],t}function fi(e){let{children:t}=e;return gi(v(I),le,t),null}function pi(e){let{children:t}=e;return gi(v(I),ge,t),null}function mi(e){let{children:t}=e;return gi(v(I),oe,t),null}function hi(e){let{children:t}=e;return gi(v(I),me,t),null}function gi(e,t,n){let r=(0,$.c)(9),i,a;r[0]!==n||r[1]!==e||r[2]!==t?(i=()=>{e.set(t,n)},a=[n,e,t],r[0]=n,r[1]=e,r[2]=t,r[3]=i,r[4]=a):(i=r[3],a=r[4]),(0,Z.useLayoutEffect)(i,a);let o,s;r[5]!==e||r[6]!==t?(o=()=>()=>{e.set(t,null)},s=[e,t],r[5]=e,r[6]=t,r[7]=o,r[8]=s):(o=r[7],s=r[8]),(0,Z.useLayoutEffect)(o,s)}function _i(e){let t=(0,$.c)(3),{children:n}=e,r;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,Q.jsx)(wt,{debugName:`AppShellContent`,fillParent:!0}),t[0]=r):r=t[0];let i;return t[1]===n?i=t[2]:(i=(0,Q.jsx)(Z.Suspense,{fallback:r,children:n}),t[1]=n,t[2]=i),i}function vi(e){let t=(0,$.c)(4),{layout:n}=e,r=v(I),i,a;return t[0]!==n||t[1]!==r?(i=()=>(r.set(se,n),()=>{r.set(se,`default`)}),a=[n,r],t[0]=n,t[1]=r,t[2]=i,t[3]=a):(i=t[2],a=t[3]),(0,Z.useLayoutEffect)(i,a),null}function yi(e){let t=(0,$.c)(7),{children:n}=e,r;t[0]===n?r=t[1]:(r=bi(n),t[0]=n,t[1]=r);let{bottomPanelSlot:i,contentChildren:a,leftPanelSlot:o,rightPanelSlot:s}=r,c;return t[2]!==i||t[3]!==a||t[4]!==o||t[5]!==s?(c=(0,Q.jsx)(Gr,{bottomPanelSlot:i,leftPanelSlot:o,rightPanelSlot:s,children:a}),t[2]=i,t[3]=a,t[4]=o,t[5]=s,t[6]=c):c=t[6],c}function bi(e){let t=[],n,r,i;return Z.Children.forEach(e,(e,a)=>{if(xi(e)){r=e.props;return}if(Si(e)){i=e.props;return}if(Ci(e)){n=e.props;return}(0,Z.isValidElement)(e)?t.push({...e,key:e.key??`${a}`}):t.push(e)}),{bottomPanelSlot:n,contentChildren:t,leftPanelSlot:r,rightPanelSlot:i}}function xi(e){return(0,Z.isValidElement)(e)&&e.type===$r}function Si(e){return(0,Z.isValidElement)(e)&&e.type===ri}function Ci(e){return(0,Z.isValidElement)(e)&&e.type===ui}var wi={Root:(0,Z.memo)(yi),LeftPanel:$r,Content:(0,Z.memo)(_i),Header:(0,Z.memo)(ei),HeaderAction:(0,Z.memo)(ti),HeaderContextMenuItem:(0,Z.memo)(ni),MainContentLayout:(0,Z.memo)(vi),BottomPanel:ui,BottomPanelTabs:(0,Z.memo)(di),BottomPanelTabsEmptyState:(0,Z.memo)(fi),BottomPanelTabListAfter:(0,Z.memo)(pi),BottomPanelTabListAfterSticky:(0,Z.memo)(mi),BottomPanelOutlet:(0,Z.memo)(hi),RightPanel:ri,RightPanelTabs:(0,Z.memo)(ii),RightPanelTabsEmptyState:(0,Z.memo)(ai),RightPanelTabListAfter:(0,Z.memo)(si),RightPanelTabListAfterSticky:(0,Z.memo)(li),RightPanelTabListBefore:(0,Z.memo)(ci),RightPanelOutlet:(0,Z.memo)(oi)};export{Gt as C,Kt as S,On as _,qn as a,An as b,Wn as c,Ln as d,Rn as f,Nn as g,Pn as h,$n as i,Un as l,Fn as m,Dr as n,Gn as o,In as p,cr as r,Kn as s,wi as t,Bn as u,kn as v,En as x,Dn as y}; //# sourceMappingURL=app-shell-D7yvB1FT.js.map \ No newline at end of file diff --git a/desktop/recovered/refresh-manifest.json b/desktop/recovered/refresh-manifest.json index 4dd1505f..57fa7b3d 100644 --- a/desktop/recovered/refresh-manifest.json +++ b/desktop/recovered/refresh-manifest.json @@ -94,6 +94,12 @@ "skipped": true, "reason": "linux application menu serialization ipc handler replacement already present" }, + { + "label": "linux application menu click passes window context", + "patched": false, + "skipped": true, + "reason": "linux application menu click passes window context replacement already present" + }, { "label": "linux skips title bar overlay sync without overlay controls", "patched": false, @@ -219,6 +225,12 @@ "skipped": true, "reason": "app shell renders linux codex application sub-menus replacement already present" }, + { + "label": "app shell upgrades linux codex application sub-menus", + "patched": false, + "skipped": true, + "reason": "app shell upgrades linux codex application sub-menus replacement already present" + }, { "label": "app shell hides floating sidebar nav when title bar owns chrome", "patched": false, diff --git a/desktop/scripts/assemble-codex-runtime.mjs b/desktop/scripts/assemble-codex-runtime.mjs index cbb23483..4b7c01a2 100644 --- a/desktop/scripts/assemble-codex-runtime.mjs +++ b/desktop/scripts/assemble-codex-runtime.mjs @@ -329,8 +329,14 @@ const mainLinuxWindowControlPatchMarker = 'codex_desktop:control-window'; const mainLinuxApplicationMenuPatchTarget = 'codex_desktop:control-window`,async(e,t)=>{if(!b(e))return;let n=a.BrowserWindow.fromWebContents(e.sender);if(!n||n.isDestroyed())return;switch(t?.action){case`minimize`:n.minimize();return;case`maximize`:n.isMaximized()?n.unmaximize():n.maximize();return;case`close`:n.close();return}});let x=!1;a.ipcMain.handle(sl,'; const mainLinuxApplicationMenuPatchReplacement = - 'codex_desktop:control-window`,async(e,t)=>{if(!b(e))return;let n=a.BrowserWindow.fromWebContents(e.sender);if(!n||n.isDestroyed())return;switch(t?.action){case`minimize`:n.minimize();return;case`maximize`:n.isMaximized()?n.unmaximize():n.maximize();return;case`close`:n.close();return}});function linuxSerializeMenuItems(e,t){let n=[];if(!e)return n;for(let r=0;r0&&(s.submenu=linuxSerializeMenuItems(i.submenu,o)),n.push(s)}return n}function linuxMenuItemAtPath(e,t){let n=t.split(`.`).map(Number),r=e;for(let e=0;e{if(!b(e))return{items:[]};let n=a.Menu.getApplicationMenu()?.getMenuItemById(t?.menuId)?.submenu;return{items:n?linuxSerializeMenuItems(n,``):[]}}),a.ipcMain.handle(`codex_desktop:click-application-menu-item`,async(e,t)=>{if(!b(e))return;let n=a.Menu.getApplicationMenu()?.getMenuItemById(t?.menuId)?.submenu,r=linuxMenuItemAtPath(n,t?.path);r&&r.enabled!==!1&&typeof r.click==`function`&&r.click()});let x=!1;a.ipcMain.handle(sl,'; + 'codex_desktop:control-window`,async(e,t)=>{if(!b(e))return;let n=a.BrowserWindow.fromWebContents(e.sender);if(!n||n.isDestroyed())return;switch(t?.action){case`minimize`:n.minimize();return;case`maximize`:n.isMaximized()?n.unmaximize():n.maximize();return;case`close`:n.close();return}});function linuxSerializeMenuItems(e,t){let n=[];if(!e)return n;for(let r=0;r0&&(s.submenu=linuxSerializeMenuItems(i.submenu,o)),n.push(s)}return n}function linuxMenuItemAtPath(e,t){let n=t.split(`.`).map(Number),r=e;for(let e=0;e{if(!b(e))return{items:[]};let n=a.Menu.getApplicationMenu()?.getMenuItemById(t?.menuId)?.submenu;return{items:n?linuxSerializeMenuItems(n,``):[]}}),a.ipcMain.handle(`codex_desktop:click-application-menu-item`,async(e,t)=>{if(!b(e))return;let n=a.BrowserWindow.fromWebContents(e.sender),r=a.Menu.getApplicationMenu()?.getMenuItemById(t?.menuId)?.submenu,i=linuxMenuItemAtPath(r,t?.path);i&&i.enabled!==!1&&typeof i.click==`function`&&i.click(void 0,n??void 0,n?.webContents)});let x=!1;a.ipcMain.handle(sl,'; const mainLinuxApplicationMenuPatchMarker = 'codex_desktop:get-application-menu-items'; +const mainLinuxApplicationMenuClickContextUpgradePatchPattern = + /a\.ipcMain\.handle\(`codex_desktop:click-application-menu-item`,async\(e,t\)=>\{if\(!b\(e\)\)return;let n=a\.Menu\.getApplicationMenu\(\)\?\.getMenuItemById\(t\?\.menuId\)\?\.submenu,r=linuxMenuItemAtPath\(n,t\?\.path\);r&&r\.enabled!==!1&&typeof r\.click==`function`&&r\.click\(\)\}\)/; +const mainLinuxApplicationMenuClickContextUpgradePatchReplacement = + 'a.ipcMain.handle(`codex_desktop:click-application-menu-item`,async(e,t)=>{if(!b(e))return;let n=a.BrowserWindow.fromWebContents(e.sender),r=a.Menu.getApplicationMenu()?.getMenuItemById(t?.menuId)?.submenu,i=linuxMenuItemAtPath(r,t?.path);i&&i.enabled!==!1&&typeof i.click==`function`&&i.click(void 0,n??void 0,n?.webContents)})'; +const mainLinuxApplicationMenuClickContextUpgradePatchMarker = + 'click(void 0,n??void 0,n?.webContents)'; const preloadLinuxBridgePatchTarget = 'showApplicationMenu:async(t,n,i)=>{await e.ipcRenderer.invoke(r,{menuId:t,x:n,y:i})}'; const preloadLinuxBridgePatchReplacement = @@ -387,10 +393,17 @@ const appShellLinuxWindowsMenuPatchMarker = 'return(e===`windows`||e===`linux`)&&window.electronBridge?.showApplicationMenu!=null'; const appShellLinuxApplicationMenuFunction = 'function nr(){let e=D(),t=$n(),{platform:p}=nt(),h=p===`linux`&&typeof window.electronBridge?.getApplicationMenuItems==`function`,[n,r]=(0,Z.useState)(null),[m,g]=(0,Z.useState)([]),[_,v]=(0,Z.useState)(null),y=(0,Z.useRef)(0);if((0,Z.useEffect)(()=>{if(!h||!n)return;let e=e=>{e.key===`Escape`&&r(null)},t=e=>{let t=document.getElementById(`linux-application-menu-panel`);t&&!t.contains(e.target)&&!e.target.closest(`[data-linux-menu-trigger=true]`)&&r(null)};return document.addEventListener(`keydown`,e),document.addEventListener(`mousedown`,t),()=>{document.removeEventListener(`keydown`,e),document.removeEventListener(`mousedown`,t)}},[h,n]),!t)return null;let b=e=>e?e.replace(/CommandOrControl|CmdOrCtrl/g,`Ctrl`).replace(/Command/g,`Ctrl`).replace(/Control/g,`Ctrl`):``,x=async(e,t)=>{if(h){if(n===e){r(null);return}let i=t.currentTarget.getBoundingClientRect(),a=y.current+1;y.current=a,r(e),g([]);let o=await window.electronBridge.getApplicationMenuItems(e);y.current===a&&(v({left:Math.round(i.left),top:Math.round(i.bottom)}),g(o?.items??[]))}else{let n=window.electronBridge?.showApplicationMenu;if(!n)return;let i=y.current+1;y.current=i,r(e);let a=t.currentTarget.getBoundingClientRect();try{await n(e,Math.round(a.left),Math.round(a.bottom))}finally{y.current===i&&r(null)}}},S=async e=>{e.enabled!==!1&&n&&(await window.electronBridge?.clickApplicationMenuItem?.(n,e.path),r(null))},C=`no-drag rounded-md border border-transparent px-2.5 py-1 text-base font-normal leading-none outline-none transition-colors`,w=t=>c(C,n===t?`bg-[var(--color-token-menubar-selection-background)] text-[var(--color-token-menubar-selection-foreground)]`:`text-token-text-tertiary hover:bg-token-foreground/5 hover:text-token-description-foreground focus-visible:bg-token-foreground/5 focus-visible:text-token-description-foreground`);return(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`div`,{className:`flex items-center gap-0.5 pr-2 pl-1`,children:tr.map(({id:t,message:i})=>(0,Q.jsx)(`button`,{type:`button`,"data-linux-menu-trigger":h?`true`:void 0,"aria-expanded":n===t,"aria-haspopup":`menu`,"aria-label":e.formatMessage(i),className:w(t),onClick:e=>{x(t,e)},children:(0,Q.jsx)(k,{...i})},t))}),h&&n&&_&&(0,Q.jsx)(`div`,{id:`linux-application-menu-panel`,className:`no-drag fixed z-50 m-px flex min-w-[220px] flex-col rounded-xl bg-token-dropdown-background/90 p-1 text-token-foreground shadow-lg ring-[0.5px] ring-token-border backdrop-blur-sm select-none`,style:{left:_.left,top:_.top},children:m.map(t=>t.type===`separator`?(0,Q.jsx)(`div`,{className:`mx-1 my-1 border-t border-token-border/60`,role:`separator`},t.path):(0,Q.jsx)(`button`,{type:`button`,className:c(`flex w-full items-center gap-3 rounded-lg p-1.5 text-left text-sm outline-none transition-colors`,t.enabled===!1?`cursor-default opacity-50`:`cursor-interaction hover:bg-token-list-hover-background focus:bg-token-list-hover-background`),disabled:t.enabled===!1,onClick:()=>{S(t)},children:(0,Q.jsxs)(`span`,{className:`flex w-full items-center gap-3`,children:[(0,Q.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:t.label}),t.accelerator?(0,Q.jsx)(`span`,{className:`shrink-0 pl-4 text-xs text-token-text-tertiary tabular-nums`,children:b(t.accelerator)}):null]})},t.path))})]})}'; +const appShellLinuxApplicationMenuFunctionWithSubmenus = + 'function nr(){let e=D(),t=$n(),{platform:p}=nt(),h=p===`linux`&&typeof window.electronBridge?.getApplicationMenuItems==`function`,[n,r]=(0,Z.useState)(null),[m,g]=(0,Z.useState)([]),[_,v]=(0,Z.useState)(null),y=(0,Z.useRef)(0);if((0,Z.useEffect)(()=>{if(!h||!n)return;let e=e=>{e.key===`Escape`&&r(null)},t=e=>{let t=document.getElementById(`linux-application-menu-panel`);t&&!t.contains(e.target)&&!e.target.closest(`[data-linux-menu-trigger=true]`)&&r(null)};return document.addEventListener(`keydown`,e),document.addEventListener(`mousedown`,t),()=>{document.removeEventListener(`keydown`,e),document.removeEventListener(`mousedown`,t)}},[h,n]),!t)return null;let b=e=>e?e.replace(/CommandOrControl|CmdOrCtrl/g,`Ctrl`).replace(/Command/g,`Ctrl`).replace(/Control/g,`Ctrl`):``,x=async(e,t)=>{if(h){if(n===e){r(null);return}let i=t.currentTarget.getBoundingClientRect(),a=y.current+1;y.current=a,r(e),g([]);let o=await window.electronBridge.getApplicationMenuItems(e);y.current===a&&(v({left:Math.round(i.left),top:Math.round(i.bottom)}),g(o?.items??[]))}else{let n=window.electronBridge?.showApplicationMenu;if(!n)return;let i=y.current+1;y.current=i,r(e);let a=t.currentTarget.getBoundingClientRect();try{await n(e,Math.round(a.left),Math.round(a.bottom))}finally{y.current===i&&r(null)}}},S=async e=>{e.enabled!==!1&&!e.submenu&&n&&(await window.electronBridge?.clickApplicationMenuItem?.(n,e.path),r(null))},C=`no-drag rounded-md border border-transparent px-2.5 py-1 text-base font-normal leading-none outline-none transition-colors`,w=t=>c(C,n===t?`bg-[var(--color-token-menubar-selection-background)] text-[var(--color-token-menubar-selection-foreground)]`:`text-token-text-tertiary hover:bg-token-foreground/5 hover:text-token-description-foreground focus-visible:bg-token-foreground/5 focus-visible:text-token-description-foreground`),M=(e,t=0)=>e.flatMap(e=>e.type===`separator`?[(0,Q.jsx)(`div`,{className:`mx-1 my-1 border-t border-token-border/60`,role:`separator`},e.path)]:[(0,Q.jsx)(`button`,{type:`button`,"aria-haspopup":e.submenu?`menu`:void 0,className:c(`flex w-full items-center gap-3 rounded-lg p-1.5 text-left text-sm outline-none transition-colors`,e.enabled===!1?`cursor-default opacity-50`:e.submenu?`cursor-default text-token-text-tertiary`:`cursor-interaction hover:bg-token-list-hover-background focus:bg-token-list-hover-background`),disabled:e.enabled===!1,onClick:()=>{e.submenu?null:S(e)},children:(0,Q.jsxs)(`span`,{className:`flex w-full items-center gap-3`,style:{paddingLeft:t*14},children:[(0,Q.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:e.label}),e.submenu?(0,Q.jsx)(`span`,{className:`shrink-0 text-xs text-token-text-tertiary`,children:`>`}):e.accelerator?(0,Q.jsx)(`span`,{className:`shrink-0 pl-4 text-xs text-token-text-tertiary tabular-nums`,children:b(e.accelerator)}):null]})},e.path),...(e.submenu?M(e.submenu,t+1):[])]);return(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`div`,{className:`flex items-center gap-0.5 pr-2 pl-1`,children:tr.map(({id:t,message:i})=>(0,Q.jsx)(`button`,{type:`button`,"data-linux-menu-trigger":h?`true`:void 0,"aria-expanded":n===t,"aria-haspopup":`menu`,"aria-label":e.formatMessage(i),className:w(t),onClick:e=>{x(t,e)},children:(0,Q.jsx)(k,{...i})},t))}),h&&n&&_&&(0,Q.jsx)(`div`,{id:`linux-application-menu-panel`,className:`no-drag fixed z-50 m-px flex min-w-[220px] flex-col rounded-xl bg-token-dropdown-background/90 p-1 text-token-foreground shadow-lg ring-[0.5px] ring-token-border backdrop-blur-sm select-none`,style:{left:_.left,top:_.top},children:M(m)})]})}'; const appShellLinuxApplicationMenuPatchTarget = 'function nr(){let e=D(),t=$n(),[n,r]=(0,Z.useState)(null),i=(0,Z.useRef)(0);if(!t)return null;let a=async(e,t)=>{let n=window.electronBridge?.showApplicationMenu;if(!n)return;let a=i.current+1;i.current=a,r(e);let o=t.currentTarget.getBoundingClientRect();try{await n(e,Math.round(o.left),Math.round(o.bottom))}finally{i.current===a&&r(null)}};return(0,Q.jsx)(`div`,{className:`flex items-center gap-0.5 pr-2 pl-1`,children:tr.map(({id:t,message:r})=>(0,Q.jsx)(`button`,{type:`button`,"aria-expanded":n===t,"aria-haspopup":`menu`,"aria-label":e.formatMessage(r),className:c(`no-drag rounded-md border border-transparent px-2.5 py-1 text-base font-normal leading-none outline-none transition-colors`,n===t?`bg-[var(--color-token-menubar-selection-background)] text-[var(--color-token-menubar-selection-foreground)]`:`text-token-text-tertiary hover:bg-token-foreground/5 hover:text-token-description-foreground focus-visible:bg-token-foreground/5 focus-visible:text-token-description-foreground`),onClick:e=>{a(t,e)},children:(0,Q.jsx)(k,{...r})},t))})}'; -const appShellLinuxApplicationMenuPatchReplacement = appShellLinuxApplicationMenuFunction; +const appShellLinuxApplicationMenuPatchReplacement = + appShellLinuxApplicationMenuFunctionWithSubmenus; const appShellLinuxApplicationMenuPatchMarker = 'linux-application-menu-panel'; +const appShellLinuxApplicationMenuUpgradePatchPattern = + /function nr\(\)\{let e=D\(\),t=\$n\(\),[\s\S]*?\}(?=var rr=|;?function ar\(|;?function LinuxWindowControls\(\)|;?function \$r\(e\)\{return null\})/; +const appShellLinuxApplicationMenuUpgradePatchMarker = + 'style:{paddingLeft:t*14}'; // Close icon uses useState for red hover: plain hover:text-token-charts-red is not in app-main CSS. const appShellLinuxWindowControlsFunction = 'function LinuxWindowControls(){let{platform:e}=nt(),t=window.electronBridge?.controlWindow;if(e!==`linux`||typeof t!=`function`)return null;let n=e=>()=>{void t(e)},[a,u]=(0,Z.useState)(!1),o=`no-drag cursor-interaction inline-flex h-7 w-7 shrink-0 items-center justify-center rounded-md border border-transparent bg-transparent p-0 outline-none transition-colors hover:bg-token-foreground/5 focus-visible:bg-token-foreground/5`,r=c(o,`text-token-text-tertiary hover:text-token-description-foreground focus-visible:text-token-description-foreground`),i=c(o,a?`text-token-charts-red`:`text-token-text-tertiary`);return(0,Q.jsxs)(`div`,{"data-linux-codex-window-controls":`true`,className:`no-drag ml-auto flex shrink-0 items-center gap-0.5 pe-2`,children:[(0,Q.jsx)(`button`,{type:`button`,className:r,onClick:n(`minimize`),"aria-label":`Minimize`,children:(0,Q.jsx)(`svg`,{className:`h-2.5 w-2.5`,viewBox:`0 0 10 10`,fill:`none`,"aria-hidden":`true`,children:(0,Q.jsx)(`path`,{d:`M0 5h10`,stroke:`currentColor`,strokeWidth:1})})}),(0,Q.jsx)(`button`,{type:`button`,className:r,onClick:n(`maximize`),"aria-label":`Maximize`,children:(0,Q.jsx)(`svg`,{className:`h-2.5 w-2.5`,viewBox:`0 0 10 10`,fill:`none`,"aria-hidden":`true`,children:(0,Q.jsx)(`rect`,{x:.5,y:.5,width:9,height:9,stroke:`currentColor`,strokeWidth:1})})}),(0,Q.jsx)(`button`,{type:`button`,className:i,onMouseEnter:()=>u(!0),onMouseLeave:()=>u(!1),onFocus:()=>u(!0),onBlur:()=>u(!1),onClick:n(`close`),"aria-label":`Close`,children:(0,Q.jsx)(`svg`,{className:`h-2.5 w-2.5`,viewBox:`0 0 10 10`,fill:`none`,"aria-hidden":`true`,children:(0,Q.jsx)(`path`,{d:`M1 1l8 8M9 1L1 9`,stroke:`currentColor`,strokeWidth:1})})})]})}'; @@ -415,10 +428,18 @@ const appShellLinuxFloatingSidebarHideNavHeaderPatchReplacement = 'children:[r?null:(0,Q.jsx)(U.div,{initial:s?!1:{x:8},animate:{x:0},exit:{x:s?0:8},transition:h,className:`app-header-tint flex h-toolbar shrink-0 items-center ps-(--spacing-token-safe-header-left) pe-2`,children:(0,Q.jsx)(qn,{hideUnreadBadge:!0,onToggleSidebar:l})}),(0,Q.jsx)(`div`,{className:`min-h-0 flex-1 overflow-hidden`,children:a})]'; const appShellLinuxFloatingSidebarHideNavHeaderPatchMarker = 'children:[r?null:(0,Q.jsx)(U.div,{initial:s?!1:{x:8}'; -const appShellLinuxFloatingSidebarZIndexPatchTarget = - 'pointer-events-auto fixed bottom-0 left-0 z-30 min-h-0'; const appShellLinuxFloatingSidebarZIndexPatchReplacement = 'pointer-events-auto fixed bottom-0 left-0 z-40 min-h-0'; +const appShellLinuxFloatingSidebarZIndexPatchAlternatives = [ + { + target: 'pointer-events-auto fixed bottom-0 left-0 z-30 min-h-0', + replacement: appShellLinuxFloatingSidebarZIndexPatchReplacement, + }, + { + target: 'pointer-events-auto min-h-0', + replacement: appShellLinuxFloatingSidebarZIndexPatchReplacement, + }, +]; const appShellLinuxFloatingSidebarZIndexPatchMarker = 'left-0 z-40 min-h-0'; const appShellLinuxFloatingSidebarInlineZIndexPatchTarget = 'exit:{opacity:0,x:s?0:-8},style:{width:n},transition:h,children:[(0,Q.jsxs)(`aside`'; @@ -1739,6 +1760,13 @@ function patchCodexMainProcessBundle(extractedAppRoot) { replacement: mainLinuxApplicationMenuPatchReplacement, marker: mainLinuxApplicationMenuPatchMarker, }, + { + type: 'regex', + label: 'linux application menu click passes window context', + pattern: mainLinuxApplicationMenuClickContextUpgradePatchPattern, + replacement: mainLinuxApplicationMenuClickContextUpgradePatchReplacement, + marker: mainLinuxApplicationMenuClickContextUpgradePatchMarker, + }, { label: 'linux skips title bar overlay sync without overlay controls', alternatives: mainLinuxTitleBarOverlaySyncSkipPatchAlternatives, @@ -1854,6 +1882,13 @@ function patchCodexAppShellRenderer(extractedAppRoot) { replacement: appShellLinuxApplicationMenuPatchReplacement, marker: appShellLinuxApplicationMenuPatchMarker, }, + { + type: 'regex', + label: 'app shell upgrades linux codex application sub-menus', + pattern: appShellLinuxApplicationMenuUpgradePatchPattern, + replacement: appShellLinuxApplicationMenuFunctionWithSubmenus, + marker: appShellLinuxApplicationMenuUpgradePatchMarker, + }, { label: 'app shell hides floating sidebar nav when title bar owns chrome', target: appShellLinuxFloatingSidebarHideNavHeaderPatchTarget, @@ -1862,8 +1897,7 @@ function patchCodexAppShellRenderer(extractedAppRoot) { }, { label: 'app shell raises floating sidebar above main header chrome', - target: appShellLinuxFloatingSidebarZIndexPatchTarget, - replacement: appShellLinuxFloatingSidebarZIndexPatchReplacement, + alternatives: appShellLinuxFloatingSidebarZIndexPatchAlternatives, marker: appShellLinuxFloatingSidebarZIndexPatchMarker, }, { diff --git a/desktop/tests/linux/recovered-bundle.red.test.ts b/desktop/tests/linux/recovered-bundle.red.test.ts index 86c91454..f1bf5bb7 100644 --- a/desktop/tests/linux/recovered-bundle.red.test.ts +++ b/desktop/tests/linux/recovered-bundle.red.test.ts @@ -50,6 +50,9 @@ function expectLinuxAppShellTitleBarMarkers(bundle: string) { expect(bundle).toContain('linux-application-menu-panel'); expect(bundle).toContain('getApplicationMenuItems'); expect(bundle).toContain('showApplicationMenu'); + expect(bundle).toContain('"aria-haspopup":e.submenu?`menu`:void 0'); + expect(bundle).toContain('style:{paddingLeft:t*14}'); + expect(bundle).toContain('e.submenu?null:S(e)'); } describe('Recovered Codex bundle RED contract', () => { @@ -66,7 +69,7 @@ describe('Recovered Codex bundle RED contract', () => { desktopRoot, 'tmp', 'codex-upstream', - '26.601.21317', + '26.601.21319', 'extracted', 'Codex.app', 'Contents', @@ -191,7 +194,7 @@ describe('Recovered Codex bundle RED contract', () => { const windowControlsSafeAreaBundle = readOutputAsset('use-window-controls-safe-area-'); expect(summary.outputRoot).toBe(outputRoot); - expect(summary.version).toBe('26.601.21317'); + expect(summary.version).toBe('26.601.21319'); expect(summary.buildNumber).toBe('3511'); expect(summary.electronVersion).toBe('42.1.0'); expect(summary.appAsarSha256).toMatch(/^[a-f0-9]{64}$/); @@ -210,6 +213,7 @@ describe('Recovered Codex bundle RED contract', () => { expect(mainBundle).toContain('codex_desktop:control-window'); expect(mainBundle).toContain('codex_desktop:get-application-menu-items'); expect(mainBundle).toContain('codex_desktop:click-application-menu-item'); + expect(mainBundle).toContain('i.click(void 0,n??void 0,n?.webContents)'); expect(mainBundle).toContain( 'installWindowsTitleBarOverlaySync(e,t){if(process.platform!==`win32`||t!==`primary`)return;', );