import{n as e,o as t}from"./chunk-DR8-3Aex.js";import{In as n,Ln as r,Q as i,Rn as a,b as o,f as s,nt as c,t as l,v as u,x as d}from"./src-Di342QoJ.js";import{t as f}from"./jsx-runtime-D-D469L8.js";import{Di as p,Ps as m,Si as h,ci as g,dc as _,di as v,fi as y,li as b,lo as x,mi as S,oi as C,oo as w,si as T,ui as E,vi as D,xi as O,yc as k}from"./paths-Ci1iwL5Y.js";import{n as A,r as j}from"./analytics-DqMQntaB.js";import{d as M,x as N}from"./startupProfiler-CAntGAbs.js";import{fC as P,lC as F,uC as I}from"./loadAgentsDir-C_wFhytF.js";import{t as L}from"./useKeybinding-DPOUuymz.js";import{n as R,t as z}from"./systemTheme-eRWGHYSL.js";function B({cooldown:e}){return e?(0,H.jsx)(o,{color:`promptBorder`,dimColor:!0,children:`↯`}):(0,H.jsx)(o,{color:`fastMode`,children:`↯`})}function V(e=!0,t=!1){if(!e)return`↯`;let r=R(_().theme);return t?n.dim(u(`promptBorder`,r)(`↯`)):u(`fastMode`,r)(`↯`)}var H,U=e((()=>{r(),a(),m(),l(),k(),z(),H=f()}));function W(e,t){E(),x(`userSettings`,{fastMode:e?!0:void 0}),t(e?e=>{let t=!h(e.mainLoopModel);return{...e,...t?{mainLoopModel:v(),mainLoopModelForSession:null}:{},fastMode:!0}}:e=>({...e,fastMode:!1}))}function G({onDone:e,unavailableReason:t}){let n=I(e=>e.mainLoopModel),r=I(e=>e.fastMode),a=P(),[l,u]=(0,J.useState)(r??!1),f=y(),p=f.status===`cooldown`,m=t!==null,g=C(T(!0));function _(){m||(W(l,a),j(`tengu_fast_mode_toggled`,{enabled:l,source:`picker`}),l?e(`${V(l)} Fast mode ON${h(n)?``:` · model set to ${b}`} · ${g}`):(a(e=>({...e,fastMode:!1})),e(`Fast mode OFF`)))}function v(){if(m){r&&W(!1,a),e(`Fast mode OFF`,{display:`system`});return}e(r?`${V()} Kept Fast mode ON`:`Kept Fast mode OFF`,{display:`system`})}function x(){m||u(e=>!e)}return c({"confirm:yes":_,"confirm:nextField":x,"confirm:next":x,"confirm:previous":x,"confirm:cycleMode":x,"confirm:toggle":x},{context:`Confirmation`}),(0,Y.jsxs)(s,{title:(0,Y.jsxs)(o,{children:[(0,Y.jsx)(B,{cooldown:p}),` Fast mode (research preview)`]}),subtitle:`High-speed mode for ${b}. Billed as extra usage at a premium rate. Separate rate limits apply.`,onCancel:v,color:`fastMode`,inputGuide:e=>e.pending?(0,Y.jsxs)(o,{children:[`Press `,e.keyName,` again to exit`]}):m?(0,Y.jsx)(o,{children:`Esc to cancel`}):(0,Y.jsx)(o,{children:`Tab to toggle · Enter to confirm · Esc to cancel`}),children:[t?(0,Y.jsx)(d,{marginLeft:2,children:(0,Y.jsx)(o,{color:`error`,children:t})}):(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(d,{flexDirection:`column`,gap:0,marginLeft:2,children:(0,Y.jsxs)(d,{flexDirection:`row`,gap:2,children:[(0,Y.jsx)(o,{bold:!0,children:`Fast mode`}),(0,Y.jsx)(o,{color:l?`fastMode`:void 0,bold:l,children:l?`ON `:`OFF`}),(0,Y.jsx)(o,{dimColor:!0,children:g})]})}),p&&f.status===`cooldown`&&(0,Y.jsx)(d,{marginLeft:2,children:(0,Y.jsxs)(o,{color:`warning`,children:[f.reason===`overloaded`?`Fast mode overloaded and is temporarily unavailable`:`You've hit your fast limit`,` · resets in `,M(f.resetAt-Date.now(),{hideTrailingZeros:!0})]})})]}),(0,Y.jsxs)(o,{dimColor:!0,children:[`Learn more:`,` `,(0,Y.jsx)(i,{url:`https://code.claude.com/docs/en/fast-mode`,children:`https://code.claude.com/docs/en/fast-mode`})]})]})}async function K(e,t,n){let r=S();if(r)return`Fast mode unavailable: ${r}`;let{mainLoopModel:i}=t();return W(e,n),j(`tengu_fast_mode_toggled`,{enabled:e,source:`shortcut`}),e?`${V(!0)} Fast mode ON${h(i)?``:` · model set to ${b}`} · ${C(T(!0))}`:`Fast mode OFF`}async function q(e,t,n){if(!O())return null;await p();let r=n?.trim().toLowerCase();if(r===`on`||r===`off`)return e(await K(r===`on`,t.getAppState,t.setAppState)),null;let i=S();return j(`tengu_fast_mode_picker_shown`,{unavailable_reason:i??``}),(0,Y.jsx)(G,{onDone:e,unavailableReason:i})}var J,Y,X=e((()=>{a(),J=t(a(),1),l(),U(),L(),A(),F(),D(),N(),g(),w(),Y=f()}));export{U as a,V as i,q as n,X as r,G as t};