@x-otto/tui 0.1.0-alpha.30 → 0.1.0-alpha.32

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import{$ as e,$t as t,A as n,An as r,At as i,B as a,Bt as o,C as s,Cn as c,Ct as l,D as u,Dn as d,Dt as f,E as p,En as m,Et as h,F as g,G as _,Gt as v,H as y,Ht as b,J as x,K as S,Kt as C,L as w,Lt as ee,M as T,Mn as te,N as ne,Nn as re,Nt as ie,O as E,On as ae,Ot as oe,P as D,Q as se,Qt as O,R as k,Rt as A,S as ce,Sn as j,St as le,T as ue,Tn as de,Tt as fe,U as pe,Ut as me,V as he,Vt as ge,W as _e,Wt as ve,X as ye,Xt as be,Y as xe,Yt as M,Z as Se,Zt as Ce,_ as we,_n as Te,_t as Ee,a as De,an as Oe,at as ke,b as Ae,bn as je,bt as Me,c as Ne,cn as N,ct as Pe,d as P,dn as Fe,dt as Ie,en as Le,et as F,f as Re,fn as ze,ft as Be,g as Ve,gn as He,gt as Ue,h as We,hn as Ge,ht as Ke,i as qe,in as Je,it as Ye,j as I,jn as L,jt as Xe,k as Ze,kn as Qe,kt as $e,l as et,ln as tt,lt as nt,m as rt,mn as R,mt as it,n as at,nn as ot,nt as st,o as ct,on as lt,ot as ut,p as dt,pn as ft,pt,q as mt,qt as ht,r as gt,rn as _t,rt as vt,s as yt,sn as bt,st as xt,t as St,tn as Ct,tt as wt,u as z,un as Tt,ut as Et,v as Dt,vn as B,vt as Ot,w as kt,wn as At,wt as jt,x as Mt,xn as Nt,xt as Pt,y as Ft,yn as It,yt as Lt,zt as Rt}from"./WizardDialog-BWdcJsJw.js";import{i as zt,n as V,r as Bt,t as Vt}from"./i18n-Kl6Bh9P5.js";import{CommandRegistry as Ht,createBuiltinCommands as Ut,showCommandPalette as Wt}from"./compat.js";import{createRequire as Gt}from"node:module";import Kt from"wrap-ansi";import H,{createContext as qt,createElement as U,useCallback as Jt,useContext as Yt,useEffect as W,useMemo as Xt,useRef as G,useState as K}from"react";import{Fragment as Zt,jsx as q,jsxs as J}from"react/jsx-runtime";import*as Qt from"ink";import{Box as Y,Static as $t,Text as X,render as en,useBoxMetrics as tn,useInput as nn,usePaste as rn,useStdin as an,useStdout as on}from"ink";import{I18nextProvider as sn}from"react-i18next";import{createStore as cn}from"zustand/vanilla";import{useStore as ln}from"zustand";import{LARGE_FILE_BYTE_THRESHOLD as un,matchSubsequence as dn,matchesGlobPattern as fn,positionsToHighlightRanges as pn,rankCandidates as mn,rankLabeledItems as hn,rankNamedItems as gn,readFileCapped as _n,scoreSubsequence as vn}from"@x-otto/shared";import{readdirSync as yn,statSync as bn}from"node:fs";import{SYSTEM_PROMPT_SECTIONS as xn,adjustDismissedSigil as Sn,applySigilCompletion as Cn,applySigilReplacement as wn,evaluateSigilTrigger as Tn,extractSigilPrefix as En}from"@x-otto/interchange";import{basename as Dn,dirname as On,join as kn,resolve as An}from"node:path";import{execSync as jn,spawn as Mn}from"node:child_process";import Nn from"chalk";import{DEFAULT_DELEGATION_TOOLS as Pn,SESSION_MAX_PER_SESSION_BYTES as Fn,SESSION_RESUME_WINDOW_MESSAGES as In}from"@x-otto/session-contract";import{marked as Ln}from"marked";import{PassThrough as Rn}from"node:stream";const zn=[`trust`,`readonly`,`exit`];function Bn({root:e,onChoice:n}){let r=[{key:`trust`,label:V.t(`trust.optTrust`),color:L.success},{key:`readonly`,label:V.t(`trust.optReadonly`),color:L.accent},{key:`exit`,label:V.t(`trust.optExit`),color:L.inactive}];return J(O,{header:q(Ce,{color:L.warning,children:V.t(`trust.title`)}),footer:q(M,{items:[[`${t.up}${t.down}`,V.t(`hint.select`)],[`1/2/3`,V.t(`hint.quick`)],[t.enter,V.t(`hint.confirm`)],[t.esc,V.t(`hint.exit`)]]}),children:[q(Y,{marginTop:R.tight,children:q(X,{wrap:`truncate-end`,children:V.t(`trust.body`,{path:e})})}),q(Y,{marginTop:R.tight,children:q(Xe.Root,{id:`trust-prompt-dialog`,onPick:e=>n(zn[e]??`exit`),escapeIndex:zn.indexOf(`exit`),children:r.map(e=>q(Xe.Item,{label:e.label,color:e.color},e.key))})})]})}function Vn(e){return Bt(e.language===`zh`?`zh`:e.language===`en`?`en`:Vt()),new Promise(t=>{let n=!1,r=en(H.createElement(Bn,{root:e.root,onChoice:e=>{n||(n=!0,r.clear(),r.unmount(),Oe(),t(e))}}),{exitOnCtrlC:!1})})}const Hn=[`use_parent`,`create_new`,`exit`];function Un({parentRoot:e,currentRoot:n,onChoice:r}){let i=[{key:`use_parent`,label:V.t(`parent.optUseParent`),color:L.success},{key:`create_new`,label:V.t(`parent.optCreateNew`),color:L.accent},{key:`exit`,label:V.t(`parent.optExit`),color:L.inactive}];return J(O,{header:q(Ce,{color:L.warning,children:V.t(`parent.title`)}),footer:q(M,{items:[[`${t.up}${t.down}`,V.t(`hint.select`)],[`1/2/3`,V.t(`hint.quick`)],[t.enter,V.t(`hint.confirm`)],[t.esc,V.t(`hint.exit`)]]}),children:[q(Y,{marginTop:R.tight,children:q(X,{wrap:`truncate-end`,children:V.t(`parent.body`,{parentRoot:e,currentRoot:n})})}),q(Y,{marginTop:R.tight,children:q(Xe.Root,{id:`parent-workspace-dialog`,onPick:e=>r(Hn[e]??`exit`),escapeIndex:Hn.indexOf(`exit`),children:i.map(e=>q(Xe.Item,{label:e.label,color:e.color},e.key))})})]})}function Wn(e){return Bt(e.language===`zh`?`zh`:e.language===`en`?`en`:Vt()),new Promise(t=>{let n=!1,r=en(H.createElement(Un,{parentRoot:e.parentRoot,currentRoot:e.currentRoot,onChoice:e=>{n||(n=!0,r.clear(),r.unmount(),Oe(),t(e))}}),{exitOnCtrlC:!1})})}const Gn={five_hour:`5h`,seven_day:`7d`,seven_day_opus:`7d-opus`,seven_day_sonnet:`7d-sonnet`,seven_day_overage_included:`7d`},Kn={five_hour:`5-hour`,seven_day:`7-day`,seven_day_opus:`7-day (Opus)`,seven_day_sonnet:`7-day (Sonnet)`,seven_day_overage_included:`7-day`};function qn(e){return Kn[e]??e}function Jn(e,t){let n=Math.max(0,Math.round(e-t/1e3)),r=Math.floor(n/3600),i=Math.floor(n%3600/60);return r>0?`${r}h${i>0?`${i}m`:``}`:i>0?`${i}m`:`<1m`}function Yn(e,t){return e===`rejected`&&(t===`allowed`||t===`allowed_warning`)}function Xn(e,t){let n=e.limitType?Gn[e.limitType]??e.limitType:``,r=e.usedPercent===void 0?``:` ${Math.round(e.usedPercent)}%`,i=!!(n||r);if(Yn(e.status,e.overageStatus)&&e.overageResetsAt!==void 0)return`${n}${r} +${Jn(e.overageResetsAt,t)}`.trim();let a=i?` → `:``;return`${n}${r}${e.resetsAt===void 0?``:`${a}${Jn(e.resetsAt,t)}`}`.trim()}const Zn={five_hour:300*60,seven_day:10080*60,seven_day_opus:10080*60,seven_day_sonnet:10080*60,seven_day_overage_included:10080*60};function Qn(e,t,n,r){if(!e||t===void 0||n===void 0)return null;let i=Zn[e];if(!i)return null;let a=r/1e3,o=n-i,s=Math.max(0,Math.min(100,Math.round((a-o)/i*100)));return(e===`five_hour`?[[90,72]]:[[75,60],[50,35],[25,15]]).some(([e,n])=>t>=e&&s<=n)?{usedPct:t,timePct:s}:null}function $n(e,t,n,r,i,a){return Yn(e,a)||e===`allowed_warning`||e===`allowed`&&i!==void 0&&Qn(t,n,r,i)?`warning`:`inactive`}function Z(e,t){return ln(e.zustand,t)}function er(e){let t=cn()(()=>e);return{getState:()=>t.getState(),setState:e=>{let n=t.getState(),r=typeof e==`function`?e(n):e,i=!1;for(let e of Object.keys(r))if(!Object.is(n[e],r[e])){i=!0;break}i&&t.setState(r)},subscribe:e=>t.subscribe(()=>e()),zustand:t}}var tr=class{buffer=``;active=!1;timer=null;timeoutMs;onEmptyPaste;constructor(e={}){this.timeoutMs=e.timeoutMs??100,this.onEmptyPaste=e.onEmptyPaste}get isPasting(){return this.active}get currentBuffer(){return this.active?this.buffer:``}feed(e){let t=[],n=0;for(;n<e.length;){let r=e.indexOf(`\x1B[200~`,n),i=e.indexOf(`\x1B[201~`,n),a=r>=0&&i>=0&&i<r;if(this.active){if(r>=0&&!a){this.buffer+=e.slice(n,r),this.clearTimer(),t.push(this.flushPasteEnd()),n=r+6,this.active=!0,this.resetTimer(),t.push({type:`paste_start`});continue}if(i>=0){this.buffer+=e.slice(n,i),this.clearTimer(),t.push(this.flushPasteEnd()),n=i+6;continue}this.buffer+=e.slice(n),this.resetTimer();break}if(r>=0){this.active=!0,this.resetTimer(),t.push({type:`paste_start`}),n=r+6;continue}if(i>=0){n=i+6;continue}break}return t}forceEnd(){if(!this.active)return null;this.clearTimer();let e=this.buffer;return this.buffer=``,this.active=!1,{type:`paste_timeout`,partialText:e}}reset(){this.clearTimer(),this.buffer=``,this.active=!1}destroy(){this.reset()}resetTimer(){this.timer&&clearTimeout(this.timer),this.timer=setTimeout(()=>this.forceEnd(),this.timeoutMs)}clearTimer(){this.timer&&=(clearTimeout(this.timer),null)}flushPasteEnd(){let e=this.buffer,t=e.length===0;return this.buffer=``,this.active=!1,t&&this.onEmptyPaste?.(),{type:`paste_end`,text:e,isEmpty:t}}};const nr=/^\x1b\[(\d+)(?:;(\d+))?u$/,rr=/^\x1b\[27;(\d+);(\d+)~$/,ir=/^\x1b\[(\d+)~$/;function ar(e){if(!e.startsWith(`\x1B[`)&&!e.startsWith(`\x1BO`))return null;let t=e.match(nr);if(t){let n=parseInt(t[1],10),r=t[2]?parseInt(t[2],10):1,i=r>0?r-1:0;return{name:or(n),ctrl:!!(i&4),alt:!!(i&2),shift:!!(i&1),meta:!!(i&8),sequence:e}}let n=e.match(rr);if(n){let t=parseInt(n[1],10),r=parseInt(n[2],10),i=!!(t&8);return{name:or(r),ctrl:!!(t&4),alt:i,shift:!!(t&2),meta:i,sequence:e}}if(e.startsWith(`\x1BO`)){let t=e[2],n={A:`up`,B:`down`,C:`right`,D:`left`,H:`home`,F:`end`,P:`f1`,Q:`f2`,R:`f3`,S:`f4`};return t&&t in n?{name:n[t],shift:!1,alt:!1,ctrl:!1,meta:!1,sequence:e}:null}let r=e.match(/^\x1b\[(?:\d+;)?(\d+)?([ABCD])$/);if(r){let t={A:`up`,B:`down`,C:`right`,D:`left`},n=r[1]?parseInt(r[1],10):1;return{name:t[r[2]],ctrl:!!(n&4),alt:!!(n&8),shift:!!(n&2),meta:!!(n&8),sequence:e}}let i=e.match(ir);return i?{name:sr(parseInt(i[1],10)),shift:!1,alt:!1,ctrl:!1,meta:!1,sequence:e}:null}function or(e){return e>=97&&e<=122?String.fromCharCode(e):e>=65&&e<=90?String.fromCharCode(e+32):e===13?`return`:e===9?`tab`:e===27?`escape`:e===32?`space`:e===127||e===8?`backspace`:String.fromCharCode(e)}function sr(e){switch(e){case 1:case 7:return`home`;case 2:return`insert`;case 3:return`delete`;case 4:case 8:return`end`;case 5:return`pageup`;case 6:return`pagedown`;case 11:return`f1`;case 12:return`f2`;case 13:return`f3`;case 14:return`f4`;case 15:return`f5`;case 17:return`f6`;case 18:return`f7`;case 19:return`f8`;case 20:return`f9`;case 21:return`f10`;case 23:return`f11`;case 24:return`f12`;default:return`f${e}`}}function cr(e){if(!process.stdout.isTTY)return;let t=lr(e);t&&process.stdout.write(`\x1b]0;${t}\x07`)}function lr(e){let t=e.replace(/[\x00-\x1f\x7f-\x9f]/g,``).replace(/[\u200b\u200c\u200e\u200f\u202a-\u202e\u2060-\u206f\ufeff]/g,``).replace(/\s+/g,` `).trim();return t.length>240?t.slice(0,240):t}function ur(e,t,n){return t?`\x1b]8;${n?`id=${encodeURIComponent(n)}`:``};${encodeURIComponent(t)}\x1b\\${e}\x1b]8;;\x1b\\`:e}function dr(e,t,n,r){let i=t.startsWith(`file://`)?t:`file://${t}`;return n!==void 0&&(i+=`#L${n}`),r!==void 0&&(i+=`:${r}`),ur(e,i)}function fr(e,t=`c`){let n=Buffer.from(e,`utf-8`).toString(`base64`);process.stdout.write(`\x1b]52;${t};${n}\x07`)}function pr(e=`c`){return`\x1b]52;${e};?\x07`}function mr(e=process.env){if(e.TMUX)return!1;let t=e.TERM_PROGRAM??``;if(t===`Apple_Terminal`)return!0;if(t===`vscode`)return!1;if(e.VTE_VERSION||e.GNOME_TERMINAL_SERVICE)return!0;let n=e.TERM??``;return!!(n.startsWith(`vt100`)||n.startsWith(`vt102`)||n.startsWith(`vt220`))}function hr(){process.stdout.write(`\x1BP=1s\x1B\\`)}function gr(){process.stdout.write(`\x1BP=2s\x1B\\`)}function _r(e){hr();try{return e()}finally{gr()}}const vr=RegExp(`\x1B\\[\\?2026[hl]`,`g`);function yr(e){return e.includes(`\x1B[?2026`)?e.replace(vr,``):e}function br(e){return new Proxy(e,{get(e,t){if(t===`write`)return(t,...n)=>e.write(typeof t==`string`?yr(t):t,...n);let n=Reflect.get(e,t);return typeof n==`function`?n.bind(e):n}})}function xr(e=process.env){return!!e.TMUX&&e.OTTO_TUI_SYNC!==`1`}const Sr=RegExp(`\x1B\\[3J`,`g`);function Cr(e){return e.includes(`\x1B[3J`)?e.replace(Sr,``):e}function wr(e){return new Proxy(e,{get(e,t){if(t===`write`)return(t,...n)=>e.write(typeof t==`string`?Cr(t):t,...n);let n=Reflect.get(e,t);return typeof n==`function`?n.bind(e):n}})}function Tr(e=50){let t=[],n=0;return{snapshot(r){let i=Date.now();if(i-n<1e3)return;n=i;let a=t[t.length-1];a&&a.text===r.text&&a.offset===r.offset||(t.push({text:r.text,offset:r.offset,timestamp:i}),t.length>e&&t.splice(0,t.length-e))},undo(){return t.length===0?null:(n=0,t.pop())},get depth(){return t.length},reset(){t.length=0,n=0}}}function Er(e,t){if(!e)return[];let n=[];for(let r=t.length-1;r>=0;r--){let i=t[r],a=dn(e,i);a&&n.push({entry:i,index:r,score:a.score,highlightRanges:pn(a.positions)})}return n.sort((e,t)=>t.score-e.score||t.index-e.index),n.map(({entry:e,highlightRanges:t})=>{let n=t[0],r=t.at(-1);return{entry:e,matchStart:n?.start??0,matchEnd:r?.end??0,highlightRanges:t}})}function Dr(e={}){let t=e.maxSize??100,n=e.initialEntries?[...e.initialEntries]:[];n.length>t&&n.splice(0,n.length-t);let r=-1,i=``,a=!1,o=[],s=``;return{push(e){e.length!==0&&(n.length>0&&n[n.length-1]===e||(n.push(e),n.length>t&&n.shift()))},navigateUp(e){return n.length===0?null:r===-1?(i=e,r=n.length-1,n[r]):r<=0?null:(r--,n[r])},navigateDown(){return r===-1?null:(r++,r>=n.length?(r=-1,i):n[r])},resetNavigation(){r=-1,i=``},beginSearch(e){s=e,a=!0,o=[],r===-1&&(i=e)},search(e){return!a||!e?[]:(o=Er(e,n),o)},acceptSearch(e){if(e<0||e>=o.length)return null;let t=o[e].entry;return a=!1,r=n.indexOf(t),t},cancelSearch(){return a=!1,o=[],s},get size(){return n.length},get navState(){return r===-1?null:{position:n.length-r,total:n.length}},getAll(){return n},clear(){n.length=0,r=-1,i=``,a=!1,o=[]}}}function Or(e,t){let n=process.env[e];if(!n)return t;let r=Number.parseInt(n,10);return Number.isFinite(r)&&r>0?r:t}const kr=Or(`OTTO_PASTE_STORE_MAX_ENTRIES`,64),Ar=Or(`OTTO_PASTE_STORE_MAX_BYTES`,33554432),jr=Or(`OTTO_PASTE_STORE_PERSIST_MAX_BYTES`,8388608),Mr={healthy:1,warning:2,critical:4},Nr=/\[@paste:#(\d+)(?:\s+\+(\d+)\s+lines)?\]/g;function Pr(e){let t=[];Nr.lastIndex=0;let n;for(;(n=Nr.exec(e))!==null;)t.push({start:n.index,end:n.index+n[0].length,id:Number.parseInt(n[1],10)});return t}function Fr(e){return Buffer.byteLength(e,`utf-8`)}function Ir(e){if(!(typeof e!=`number`||!Number.isFinite(e)))return Math.floor(e)}function Lr(e={}){let{residencyGovernor:t}=e,n=new Map,r=1,i=0,a=0;function o(){return t?.currentLevel??`healthy`}function s(){return Math.max(1,Math.floor(kr/Mr[o()]))}function c(){return Math.max(1,Math.floor(Ar/Mr[o()]))}function l(e){let t=s(),r=c();for(;n.size>0&&(n.size>=t||i+e>r);){let e=n.keys().next().value;if(e===void 0)break;let t=n.get(e);t&&(i-=t.byteLength),n.delete(e),a++}}return{foldIfLarge(e){let t=e.split(`
1
+ import{$ as e,$t as t,A as n,An as r,At as i,B as a,Bt as o,C as s,Cn as c,Ct as l,D as u,Dn as d,Dt as f,E as p,En as m,Et as h,F as g,G as _,Gt as v,H as y,Ht as b,J as x,K as S,Kt as C,L as w,Lt as ee,M as T,Mn as te,N as ne,Nn as re,Nt as ie,O as E,On as ae,Ot as oe,P as D,Q as se,Qt as O,R as k,Rt as A,S as ce,Sn as j,St as le,T as ue,Tn as de,Tt as fe,U as pe,Ut as me,V as he,Vt as ge,W as _e,Wt as ve,X as ye,Xt as be,Y as xe,Yt as M,Z as Se,Zt as Ce,_ as we,_n as Te,_t as Ee,a as De,an as Oe,at as ke,b as Ae,bn as je,bt as Me,c as Ne,cn as N,ct as Pe,d as P,dn as Fe,dt as Ie,en as Le,et as F,f as Re,fn as ze,ft as Be,g as Ve,gn as He,gt as Ue,h as We,hn as Ge,ht as Ke,i as qe,in as Je,it as Ye,j as I,jn as L,jt as Xe,k as Ze,kn as Qe,kt as $e,l as et,ln as tt,lt as nt,m as rt,mn as R,mt as it,n as at,nn as ot,nt as st,o as ct,on as lt,ot as ut,p as dt,pn as ft,pt,q as mt,qt as ht,r as gt,rn as _t,rt as vt,s as yt,sn as bt,st as xt,t as St,tn as Ct,tt as wt,u as z,un as Tt,ut as Et,v as Dt,vn as B,vt as Ot,w as kt,wn as At,wt as jt,x as Mt,xn as Nt,xt as Pt,y as Ft,yn as It,yt as Lt,zt as Rt}from"./WizardDialog-BWGcsBR1.js";import{i as zt,n as V,r as Bt,t as Vt}from"./i18n-sGAClHYZ.js";import{CommandRegistry as Ht,createBuiltinCommands as Ut,showCommandPalette as Wt}from"./compat.js";import{createRequire as Gt}from"node:module";import Kt from"wrap-ansi";import H,{createContext as qt,createElement as U,useCallback as Jt,useContext as Yt,useEffect as W,useMemo as Xt,useRef as G,useState as K}from"react";import{Fragment as Zt,jsx as q,jsxs as J}from"react/jsx-runtime";import*as Qt from"ink";import{Box as Y,Static as $t,Text as X,render as en,useBoxMetrics as tn,useInput as nn,usePaste as rn,useStdin as an,useStdout as on}from"ink";import{I18nextProvider as sn}from"react-i18next";import{createStore as cn}from"zustand/vanilla";import{useStore as ln}from"zustand";import{LARGE_FILE_BYTE_THRESHOLD as un,matchSubsequence as dn,matchesGlobPattern as fn,positionsToHighlightRanges as pn,rankCandidates as mn,rankLabeledItems as hn,rankNamedItems as gn,readFileCapped as _n,scoreSubsequence as vn}from"@x-otto/shared";import{readdirSync as yn,statSync as bn}from"node:fs";import{SYSTEM_PROMPT_SECTIONS as xn,adjustDismissedSigil as Sn,applySigilCompletion as Cn,applySigilReplacement as wn,evaluateSigilTrigger as Tn,extractSigilPrefix as En}from"@x-otto/interchange";import{basename as Dn,dirname as On,join as kn,resolve as An}from"node:path";import{execSync as jn,spawn as Mn}from"node:child_process";import Nn from"chalk";import{DEFAULT_DELEGATION_TOOLS as Pn,SESSION_MAX_PER_SESSION_BYTES as Fn,SESSION_RESUME_WINDOW_MESSAGES as In}from"@x-otto/session-contract";import{marked as Ln}from"marked";import{PassThrough as Rn}from"node:stream";const zn=[`trust`,`readonly`,`exit`];function Bn({root:e,onChoice:n}){let r=[{key:`trust`,label:V.t(`trust.optTrust`),color:L.success},{key:`readonly`,label:V.t(`trust.optReadonly`),color:L.accent},{key:`exit`,label:V.t(`trust.optExit`),color:L.inactive}];return J(O,{header:q(Ce,{color:L.warning,children:V.t(`trust.title`)}),footer:q(M,{items:[[`${t.up}${t.down}`,V.t(`hint.select`)],[`1/2/3`,V.t(`hint.quick`)],[t.enter,V.t(`hint.confirm`)],[t.esc,V.t(`hint.exit`)]]}),children:[q(Y,{marginTop:R.tight,children:q(X,{wrap:`truncate-end`,children:V.t(`trust.body`,{path:e})})}),q(Y,{marginTop:R.tight,children:q(Xe.Root,{id:`trust-prompt-dialog`,onPick:e=>n(zn[e]??`exit`),escapeIndex:zn.indexOf(`exit`),children:r.map(e=>q(Xe.Item,{label:e.label,color:e.color},e.key))})})]})}function Vn(e){return Bt(e.language===`zh`?`zh`:e.language===`en`?`en`:Vt()),new Promise(t=>{let n=!1,r=en(H.createElement(Bn,{root:e.root,onChoice:e=>{n||(n=!0,r.clear(),r.unmount(),Oe(),t(e))}}),{exitOnCtrlC:!1})})}const Hn=[`use_parent`,`create_new`,`exit`];function Un({parentRoot:e,currentRoot:n,onChoice:r}){let i=[{key:`use_parent`,label:V.t(`parent.optUseParent`),color:L.success},{key:`create_new`,label:V.t(`parent.optCreateNew`),color:L.accent},{key:`exit`,label:V.t(`parent.optExit`),color:L.inactive}];return J(O,{header:q(Ce,{color:L.warning,children:V.t(`parent.title`)}),footer:q(M,{items:[[`${t.up}${t.down}`,V.t(`hint.select`)],[`1/2/3`,V.t(`hint.quick`)],[t.enter,V.t(`hint.confirm`)],[t.esc,V.t(`hint.exit`)]]}),children:[q(Y,{marginTop:R.tight,children:q(X,{wrap:`truncate-end`,children:V.t(`parent.body`,{parentRoot:e,currentRoot:n})})}),q(Y,{marginTop:R.tight,children:q(Xe.Root,{id:`parent-workspace-dialog`,onPick:e=>r(Hn[e]??`exit`),escapeIndex:Hn.indexOf(`exit`),children:i.map(e=>q(Xe.Item,{label:e.label,color:e.color},e.key))})})]})}function Wn(e){return Bt(e.language===`zh`?`zh`:e.language===`en`?`en`:Vt()),new Promise(t=>{let n=!1,r=en(H.createElement(Un,{parentRoot:e.parentRoot,currentRoot:e.currentRoot,onChoice:e=>{n||(n=!0,r.clear(),r.unmount(),Oe(),t(e))}}),{exitOnCtrlC:!1})})}const Gn={five_hour:`5h`,seven_day:`7d`,seven_day_opus:`7d-opus`,seven_day_sonnet:`7d-sonnet`,seven_day_overage_included:`7d`},Kn={five_hour:`5-hour`,seven_day:`7-day`,seven_day_opus:`7-day (Opus)`,seven_day_sonnet:`7-day (Sonnet)`,seven_day_overage_included:`7-day`};function qn(e){return Kn[e]??e}function Jn(e,t){let n=Math.max(0,Math.round(e-t/1e3)),r=Math.floor(n/3600),i=Math.floor(n%3600/60);return r>0?`${r}h${i>0?`${i}m`:``}`:i>0?`${i}m`:`<1m`}function Yn(e,t){return e===`rejected`&&(t===`allowed`||t===`allowed_warning`)}function Xn(e,t){let n=e.limitType?Gn[e.limitType]??e.limitType:``,r=e.usedPercent===void 0?``:` ${Math.round(e.usedPercent)}%`,i=!!(n||r);if(Yn(e.status,e.overageStatus)&&e.overageResetsAt!==void 0)return`${n}${r} +${Jn(e.overageResetsAt,t)}`.trim();let a=i?` → `:``;return`${n}${r}${e.resetsAt===void 0?``:`${a}${Jn(e.resetsAt,t)}`}`.trim()}const Zn={five_hour:300*60,seven_day:10080*60,seven_day_opus:10080*60,seven_day_sonnet:10080*60,seven_day_overage_included:10080*60};function Qn(e,t,n,r){if(!e||t===void 0||n===void 0)return null;let i=Zn[e];if(!i)return null;let a=r/1e3,o=n-i,s=Math.max(0,Math.min(100,Math.round((a-o)/i*100)));return(e===`five_hour`?[[90,72]]:[[75,60],[50,35],[25,15]]).some(([e,n])=>t>=e&&s<=n)?{usedPct:t,timePct:s}:null}function $n(e,t,n,r,i,a){return Yn(e,a)||e===`allowed_warning`||e===`allowed`&&i!==void 0&&Qn(t,n,r,i)?`warning`:`inactive`}function Z(e,t){return ln(e.zustand,t)}function er(e){let t=cn()(()=>e);return{getState:()=>t.getState(),setState:e=>{let n=t.getState(),r=typeof e==`function`?e(n):e,i=!1;for(let e of Object.keys(r))if(!Object.is(n[e],r[e])){i=!0;break}i&&t.setState(r)},subscribe:e=>t.subscribe(()=>e()),zustand:t}}var tr=class{buffer=``;active=!1;timer=null;timeoutMs;onEmptyPaste;constructor(e={}){this.timeoutMs=e.timeoutMs??100,this.onEmptyPaste=e.onEmptyPaste}get isPasting(){return this.active}get currentBuffer(){return this.active?this.buffer:``}feed(e){let t=[],n=0;for(;n<e.length;){let r=e.indexOf(`\x1B[200~`,n),i=e.indexOf(`\x1B[201~`,n),a=r>=0&&i>=0&&i<r;if(this.active){if(r>=0&&!a){this.buffer+=e.slice(n,r),this.clearTimer(),t.push(this.flushPasteEnd()),n=r+6,this.active=!0,this.resetTimer(),t.push({type:`paste_start`});continue}if(i>=0){this.buffer+=e.slice(n,i),this.clearTimer(),t.push(this.flushPasteEnd()),n=i+6;continue}this.buffer+=e.slice(n),this.resetTimer();break}if(r>=0){this.active=!0,this.resetTimer(),t.push({type:`paste_start`}),n=r+6;continue}if(i>=0){n=i+6;continue}break}return t}forceEnd(){if(!this.active)return null;this.clearTimer();let e=this.buffer;return this.buffer=``,this.active=!1,{type:`paste_timeout`,partialText:e}}reset(){this.clearTimer(),this.buffer=``,this.active=!1}destroy(){this.reset()}resetTimer(){this.timer&&clearTimeout(this.timer),this.timer=setTimeout(()=>this.forceEnd(),this.timeoutMs)}clearTimer(){this.timer&&=(clearTimeout(this.timer),null)}flushPasteEnd(){let e=this.buffer,t=e.length===0;return this.buffer=``,this.active=!1,t&&this.onEmptyPaste?.(),{type:`paste_end`,text:e,isEmpty:t}}};const nr=/^\x1b\[(\d+)(?:;(\d+))?u$/,rr=/^\x1b\[27;(\d+);(\d+)~$/,ir=/^\x1b\[(\d+)~$/;function ar(e){if(!e.startsWith(`\x1B[`)&&!e.startsWith(`\x1BO`))return null;let t=e.match(nr);if(t){let n=parseInt(t[1],10),r=t[2]?parseInt(t[2],10):1,i=r>0?r-1:0;return{name:or(n),ctrl:!!(i&4),alt:!!(i&2),shift:!!(i&1),meta:!!(i&8),sequence:e}}let n=e.match(rr);if(n){let t=parseInt(n[1],10),r=parseInt(n[2],10),i=!!(t&8);return{name:or(r),ctrl:!!(t&4),alt:i,shift:!!(t&2),meta:i,sequence:e}}if(e.startsWith(`\x1BO`)){let t=e[2],n={A:`up`,B:`down`,C:`right`,D:`left`,H:`home`,F:`end`,P:`f1`,Q:`f2`,R:`f3`,S:`f4`};return t&&t in n?{name:n[t],shift:!1,alt:!1,ctrl:!1,meta:!1,sequence:e}:null}let r=e.match(/^\x1b\[(?:\d+;)?(\d+)?([ABCD])$/);if(r){let t={A:`up`,B:`down`,C:`right`,D:`left`},n=r[1]?parseInt(r[1],10):1;return{name:t[r[2]],ctrl:!!(n&4),alt:!!(n&8),shift:!!(n&2),meta:!!(n&8),sequence:e}}let i=e.match(ir);return i?{name:sr(parseInt(i[1],10)),shift:!1,alt:!1,ctrl:!1,meta:!1,sequence:e}:null}function or(e){return e>=97&&e<=122?String.fromCharCode(e):e>=65&&e<=90?String.fromCharCode(e+32):e===13?`return`:e===9?`tab`:e===27?`escape`:e===32?`space`:e===127||e===8?`backspace`:String.fromCharCode(e)}function sr(e){switch(e){case 1:case 7:return`home`;case 2:return`insert`;case 3:return`delete`;case 4:case 8:return`end`;case 5:return`pageup`;case 6:return`pagedown`;case 11:return`f1`;case 12:return`f2`;case 13:return`f3`;case 14:return`f4`;case 15:return`f5`;case 17:return`f6`;case 18:return`f7`;case 19:return`f8`;case 20:return`f9`;case 21:return`f10`;case 23:return`f11`;case 24:return`f12`;default:return`f${e}`}}function cr(e){if(!process.stdout.isTTY)return;let t=lr(e);t&&process.stdout.write(`\x1b]0;${t}\x07`)}function lr(e){let t=e.replace(/[\x00-\x1f\x7f-\x9f]/g,``).replace(/[\u200b\u200c\u200e\u200f\u202a-\u202e\u2060-\u206f\ufeff]/g,``).replace(/\s+/g,` `).trim();return t.length>240?t.slice(0,240):t}function ur(e,t,n){return t?`\x1b]8;${n?`id=${encodeURIComponent(n)}`:``};${encodeURIComponent(t)}\x1b\\${e}\x1b]8;;\x1b\\`:e}function dr(e,t,n,r){let i=t.startsWith(`file://`)?t:`file://${t}`;return n!==void 0&&(i+=`#L${n}`),r!==void 0&&(i+=`:${r}`),ur(e,i)}function fr(e,t=`c`){let n=Buffer.from(e,`utf-8`).toString(`base64`);process.stdout.write(`\x1b]52;${t};${n}\x07`)}function pr(e=`c`){return`\x1b]52;${e};?\x07`}function mr(e=process.env){if(e.TMUX)return!1;let t=e.TERM_PROGRAM??``;if(t===`Apple_Terminal`)return!0;if(t===`vscode`)return!1;if(e.VTE_VERSION||e.GNOME_TERMINAL_SERVICE)return!0;let n=e.TERM??``;return!!(n.startsWith(`vt100`)||n.startsWith(`vt102`)||n.startsWith(`vt220`))}function hr(){process.stdout.write(`\x1BP=1s\x1B\\`)}function gr(){process.stdout.write(`\x1BP=2s\x1B\\`)}function _r(e){hr();try{return e()}finally{gr()}}const vr=RegExp(`\x1B\\[\\?2026[hl]`,`g`);function yr(e){return e.includes(`\x1B[?2026`)?e.replace(vr,``):e}function br(e){return new Proxy(e,{get(e,t){if(t===`write`)return(t,...n)=>e.write(typeof t==`string`?yr(t):t,...n);let n=Reflect.get(e,t);return typeof n==`function`?n.bind(e):n}})}function xr(e=process.env){return!!e.TMUX&&e.OTTO_TUI_SYNC!==`1`}const Sr=RegExp(`\x1B\\[3J`,`g`);function Cr(e){return e.includes(`\x1B[3J`)?e.replace(Sr,``):e}function wr(e){return new Proxy(e,{get(e,t){if(t===`write`)return(t,...n)=>e.write(typeof t==`string`?Cr(t):t,...n);let n=Reflect.get(e,t);return typeof n==`function`?n.bind(e):n}})}function Tr(e=50){let t=[],n=0;return{snapshot(r){let i=Date.now();if(i-n<1e3)return;n=i;let a=t[t.length-1];a&&a.text===r.text&&a.offset===r.offset||(t.push({text:r.text,offset:r.offset,timestamp:i}),t.length>e&&t.splice(0,t.length-e))},undo(){return t.length===0?null:(n=0,t.pop())},get depth(){return t.length},reset(){t.length=0,n=0}}}function Er(e,t){if(!e)return[];let n=[];for(let r=t.length-1;r>=0;r--){let i=t[r],a=dn(e,i);a&&n.push({entry:i,index:r,score:a.score,highlightRanges:pn(a.positions)})}return n.sort((e,t)=>t.score-e.score||t.index-e.index),n.map(({entry:e,highlightRanges:t})=>{let n=t[0],r=t.at(-1);return{entry:e,matchStart:n?.start??0,matchEnd:r?.end??0,highlightRanges:t}})}function Dr(e={}){let t=e.maxSize??100,n=e.initialEntries?[...e.initialEntries]:[];n.length>t&&n.splice(0,n.length-t);let r=-1,i=``,a=!1,o=[],s=``;return{push(e){e.length!==0&&(n.length>0&&n[n.length-1]===e||(n.push(e),n.length>t&&n.shift()))},navigateUp(e){return n.length===0?null:r===-1?(i=e,r=n.length-1,n[r]):r<=0?null:(r--,n[r])},navigateDown(){return r===-1?null:(r++,r>=n.length?(r=-1,i):n[r])},resetNavigation(){r=-1,i=``},beginSearch(e){s=e,a=!0,o=[],r===-1&&(i=e)},search(e){return!a||!e?[]:(o=Er(e,n),o)},acceptSearch(e){if(e<0||e>=o.length)return null;let t=o[e].entry;return a=!1,r=n.indexOf(t),t},cancelSearch(){return a=!1,o=[],s},get size(){return n.length},get navState(){return r===-1?null:{position:n.length-r,total:n.length}},getAll(){return n},clear(){n.length=0,r=-1,i=``,a=!1,o=[]}}}function Or(e,t){let n=process.env[e];if(!n)return t;let r=Number.parseInt(n,10);return Number.isFinite(r)&&r>0?r:t}const kr=Or(`OTTO_PASTE_STORE_MAX_ENTRIES`,64),Ar=Or(`OTTO_PASTE_STORE_MAX_BYTES`,33554432),jr=Or(`OTTO_PASTE_STORE_PERSIST_MAX_BYTES`,8388608),Mr={healthy:1,warning:2,critical:4},Nr=/\[@paste:#(\d+)(?:\s+\+(\d+)\s+lines)?\]/g;function Pr(e){let t=[];Nr.lastIndex=0;let n;for(;(n=Nr.exec(e))!==null;)t.push({start:n.index,end:n.index+n[0].length,id:Number.parseInt(n[1],10)});return t}function Fr(e){return Buffer.byteLength(e,`utf-8`)}function Ir(e){if(!(typeof e!=`number`||!Number.isFinite(e)))return Math.floor(e)}function Lr(e={}){let{residencyGovernor:t}=e,n=new Map,r=1,i=0,a=0;function o(){return t?.currentLevel??`healthy`}function s(){return Math.max(1,Math.floor(kr/Mr[o()]))}function c(){return Math.max(1,Math.floor(Ar/Mr[o()]))}function l(e){let t=s(),r=c();for(;n.size>0&&(n.size>=t||i+e>r);){let e=n.keys().next().value;if(e===void 0)break;let t=n.get(e);t&&(i-=t.byteLength),n.delete(e),a++}}return{foldIfLarge(e){let t=e.split(`
2
2
  `);if(e.length<=800&&t.length<=20)return e;let a=Fr(e);l(a);let o=r++;return n.set(o,{text:e,byteLength:a}),i+=a,t.length>1?`[@paste:#${o} +${t.length} lines]`:`[@paste:#${o}]`},expandAll(e){let t=Pr(e);if(t.length===0)return{text:e,missingIds:[]};let r=[],s=o(),c=[...t].sort((e,t)=>t.start-e.start),l=e;for(let e of c){let t=n.get(e.id);if(t===void 0){r.push(e.id);continue}l=l.slice(0,e.start)+t.text+l.slice(e.end),s===`healthy`?(n.delete(e.id),n.set(e.id,t)):(n.delete(e.id),i-=t.byteLength,a++)}return{text:l,missingIds:r.sort((e,t)=>e-t)}},findMissingIds(e){let t=Pr(e),r=[];for(let e of t)n.has(e.id)||r.push(e.id);return[...new Set(r)].sort((e,t)=>e-t)},peek(e){return n.get(e)?.text},truncateIfNeeded(e){return e.length<=1e4?e:e.slice(0,500)+`\n[...Truncated ${e.length-500-500} chars...]\n`+e.slice(e.length-500)},addImageRef(){return`[@paste:image #${r++}]`},afterSubmit(e){if(o()!==`healthy`)for(let t of Pr(e)){let e=n.get(t.id);e!==void 0&&(n.delete(t.id),i-=e.byteLength,a++)}},toSnapshot(){let e=[...n.entries()].map(([e,t])=>({id:e,text:t.text,byteLength:t.byteLength})),t=e.reduce((e,t)=>e+t.byteLength,0),i=0;for(;i<e.length&&t>jr;)t-=e[i].byteLength,i++;return{entries:i>0?e.slice(i):e,nextId:r}},hydrate(e){n.clear(),i=0;let t=Math.max(1,Math.floor(Ir(e?.nextId)??0));for(let n of e?.entries??[]){let e=Ir(n?.id);e!==void 0&&(t=Math.max(t,e+1))}r=Math.max(r,t);for(let t of e?.entries??[]){let e=Ir(t?.id);if(e===void 0||typeof t?.text!=`string`||n.has(e))continue;let r=Fr(t.text);n.set(e,{text:t.text,byteLength:r}),i+=r}},get size(){return n.size},get bytesUsed(){return i},get evictionCount(){return a},clear(){n.clear(),i=0}}}function Rr(e){let t=e?[...e]:[],n=new Map;return{register(e){for(let n of e)t.some(e=>e.name===n.name)||t.push(n);t.sort((e,t)=>(e.sortKey??e.name).localeCompare(t.sortKey??t.name))},search(e,n=50){return mn(t.map(e=>({text:e.name,aliases:[...e.aliases??[],...e.description?[e.description]:[]],payload:e,sortKey:e.sortKey})),e,{maxResults:n}).map(e=>e.item.payload)},getAll:()=>t,find:e=>t.find(t=>t.name===e),registerArgumentSuggester(e,t){n.set(e,t)},getArgumentSuggester(e){return n.get(e)}}}function zr(e,t){let n=e.slice(0,t).trimStart();if(!n.startsWith(`/`))return null;let r=n.match(/^\/(.*)$/);return r?r[1]??``:null}function Br(e,t,n){let r=zr(e,t);if(r===null)return null;let i=r.indexOf(` `);if(i>0){let e=r.slice(0,i),t=r.slice(i+1),a=n.getArgumentSuggester(e);if(a){let n=gn(a(t),t);if(n.length>0)return{suggestions:n,selectedIndex:0,prefix:`/${r}`,panelOpen:!0,argCommand:e}}return null}let a=n.search(r);return a.length===0?null:{suggestions:a,selectedIndex:0,prefix:`/${r}`,panelOpen:!0}}function Vr(e,t){switch(t){case`prev`:return{...e,selectedIndex:(e.selectedIndex-1+e.suggestions.length)%e.suggestions.length};case`next`:return{...e,selectedIndex:(e.selectedIndex+1)%e.suggestions.length};case`accept`:return`accept`;case`dismiss`:return`dismiss`}}function Hr(e,t,n){let r=e.slice(0,t),i=r.lastIndexOf(`/`);if(i<0)return{text:e,offset:t};let a=r.slice(i+1),o=a.indexOf(` `),s=o>=0?a.slice(o):` `,c=`/${n.name}${s}`;return{text:e.slice(0,i)+c+e.slice(t),offset:i+c.length}}function Ur(e){return{text:e,offset:e.length}}function Wr(e,t,n,r){if(!e)return null;let i=t.slice(0,n),a=i.lastIndexOf(`
3
3
  `)+1;return $e(i.slice(a)+(t.slice(n).split(`
4
4
  `)[0]??``))+$e(e)>r?null:e}function Gr(e){return e.startsWith(`!!`)?{prefix:`!!`,body:e.slice(2)}:e.startsWith(`!`)?{prefix:`!`,body:e.slice(1)}:{prefix:``,body:e}}function Kr(e){return e.startsWith(`!!`)?e.slice(2):e.startsWith(`!`)?e.slice(1):e}function qr(e,t,n){let{prefix:r,body:i}=Gr(e);if(r.length>0){if(i.length===0)return null;let e=i.toLowerCase();for(let a=n.length-1;a>=0;a--){let o=Kr(n[a]);if(o.length<=i.length||!o.toLowerCase().startsWith(e))continue;let s=r+o;return{fullText:s,suffix:s.slice(t),kind:`history`}}return null}let a=e.toLowerCase();for(let r=n.length-1;r>=0;r--){let i=n[r];if(!(i.length<=e.length)&&i.toLowerCase().startsWith(a))return{fullText:i,suffix:i.slice(t),kind:`history`}}return null}function Jr(e,t,n){let r=zr(e,t);if(r===null||r.length===0)return null;let i=r.indexOf(` `);if(i>0){let a=r.slice(0,i),o=r.slice(i+1),s=n.getArgumentSuggester(a);if(!s)return null;let c=gn(s(o),o,{maxResults:1});if(c.length===0)return null;let l=Xr(e,t,a,c[0].name);return{fullText:l.text,suffix:l.text.slice(t),kind:`slash-arg`}}let a=n.search(r,1);if(a.length===0)return null;let o=Hr(e,t,a[0]);return{fullText:o.text,suffix:o.text.slice(t),kind:`slash-command`}}function Yr(e){let{text:t,offset:n,dismissedPrefix:r,history:i,registry:a}=e;if(n!==t.length||t.length===0||r!==void 0&&r===t)return null;if(a&&t.trimStart().startsWith(`/`)){let e=zr(t,n);if(e!==null&&e.length===0)return null;let r=Jr(t,n,a);if(r)return r}return qr(t,n,i)}function Xr(e,t,n,r){let i=e.slice(0,t),a=i.lastIndexOf(`/`);if(a<0)return{text:e,offset:t};let o=i.slice(a+1).indexOf(` `);if(o<0)return{text:e,offset:t};let s=a+1+o+1;return{text:e.slice(0,s)+r+e.slice(t),offset:s+r.length}}function Zr(e){return(e.VISUAL||e.EDITOR||``).trim()||(process.platform===`win32`?`notepad`:`vi`)}function Qr(e,t){let n=Zr(t.env),r=null;try{r=t.mkdtempSync(t.join(t.tmpdir(),`otto-edit-`));let i=t.join(r,`prompt.md`);t.writeFileSync(i,e);let a=n.split(/\s+/).filter(Boolean),o=a[0],s=[...a.slice(1),i],c=t.spawnSync(o,s,{stdio:`inherit`});return c.error?{ok:!1,error:`cannot launch editor "${n}": ${c.error.message}`}:c.status!=null&&c.status!==0?{ok:!1,error:`editor exited with code ${c.status}`}:{ok:!0,text:t.readFileSync(i).replace(/\n$/,``)}}catch(e){return{ok:!1,error:e instanceof Error?e.message:String(e)}}finally{if(r)try{t.rmSync(r,{recursive:!0,force:!0})}catch{}}}function $r(){let e=re(`fs`),t=re(`os`),n=re(`path`),r=re(`child_process`);return{env:process.env,tmpdir:()=>t.tmpdir(),join:(...e)=>n.join(...e),mkdtempSync:t=>e.mkdtempSync(t),writeFileSync:(t,n)=>e.writeFileSync(t,n),readFileSync:t=>e.readFileSync(t,`utf8`),rmSync:(t,n)=>e.rmSync(t,n),spawnSync:(e,t,n)=>{let i=r.spawnSync(e,t,n);return{status:i.status,error:i.error}}}}let ei=null,ti=null;function ni(e){ei=e}function ri(){return ei}function ii(){ei=null,ti?.()}function ai(e){ti=e}const oi=[/\bpassword\s*=/i,/\btoken\s*=/i,/export\s+\w*key\w*\s*=/i,/\bsecret\s*=/i];function si(e,t=oi){return t.some(t=>t.test(e))}const ci=`zsh-histfile`,li=/^: (\d+):(\d+);(.*)$/s;function ui(e){let t=[],n;for(let r of e){let e=n===void 0?r:`${n}\n${r}`;if(di(r)){n=e.slice(0,-1);continue}t.push(e),n=void 0}return n!==void 0&&t.push(n),t}function di(e){let t=0;for(let n=e.length-1;n>=0&&e[n]===`\\`;n--)t++;return t%2==1}function fi(e,t={}){let{source:n=ci,sensitivePatterns:r,filterSensitive:i=!0}=t,a=[],o=0;for(let t of ui(e.split(`
@@ -1,2 +1,2 @@
1
- import{F as e,Ft as t,Gt as n,I as r,It as i,Jt as a,Kt as o,Mt as s,Nt as c,P as l,Pt as u,Rt as d,Ut as f,V as p,Wt as m,a as h,an as g,c as _,et as v,l as y,n as b,qt as x,r as S,s as C,t as w,z as T,zt as E}from"./WizardDialog-BWdcJsJw.js";import{r as D,t as O}from"./i18n-Kl6Bh9P5.js";import k,{useEffect as A}from"react";import{render as j,useInput as M}from"ink";const N=(()=>{}),P=()=>{};function F(e){return{get navigate(){return v()?.navigate??N},get goBack(){return v()?.goBack??P},resolve:e}}function I(e){return e===`zh`||e===`en`?e:O()}function L(t,n){return D(I(t.language)),new Promise(r=>{let i=!1,a=null,o=F(e=>{i||(i=!0,a?.clear(),a?.unmount(),g(),r(e))}),s={current:n};function l(){let e=E();return M((t,n)=>{e.dispatch(t,n)},{isActive:process.stdin.isTTY===!0}),A(()=>{let e=setTimeout(()=>s.current(o),0);return()=>clearTimeout(e)},[]),null}a=j(k.createElement(c,null,k.createElement(e,{initialPath:t.initialPath??`/`,children:k.createElement(k.Fragment,null,k.createElement(l,null),t.routes)})),{exitOnCtrlC:!1})})}export{y as ConfirmDialog,s as FocusBus,c as FocusBusProvider,h as InfoDialog,C as List,_ as ListItem,u as PRIORITY_FALLBACK,t as PRIORITY_FOCUSED,i as PRIORITY_ROUTER,S as ProgressDialog,b as QuestionsDialog,l as Route,m as RouteContext,e as Router,n as Tabable,o as TabableRegistry,w as WizardDialog,r as matchPath,L as runStandaloneTui,d as useFallbackInput,E as useFocusBus,T as useRoute,p as useRouter,x as useTabable,a as useTabableContext,f as useTabableInput};
1
+ import{F as e,Ft as t,Gt as n,I as r,It as i,Jt as a,Kt as o,Mt as s,Nt as c,P as l,Pt as u,Rt as d,Ut as f,V as p,Wt as m,a as h,an as g,c as _,et as v,l as y,n as b,qt as x,r as S,s as C,t as w,z as T,zt as E}from"./WizardDialog-BWGcsBR1.js";import{r as D,t as O}from"./i18n-sGAClHYZ.js";import k,{useEffect as A}from"react";import{render as j,useInput as M}from"ink";const N=(()=>{}),P=()=>{};function F(e){return{get navigate(){return v()?.navigate??N},get goBack(){return v()?.goBack??P},resolve:e}}function I(e){return e===`zh`||e===`en`?e:O()}function L(t,n){return D(I(t.language)),new Promise(r=>{let i=!1,a=null,o=F(e=>{i||(i=!0,a?.clear(),a?.unmount(),g(),r(e))}),s={current:n};function l(){let e=E();return M((t,n)=>{e.dispatch(t,n)},{isActive:process.stdin.isTTY===!0}),A(()=>{let e=setTimeout(()=>s.current(o),0);return()=>clearTimeout(e)},[]),null}a=j(k.createElement(c,null,k.createElement(e,{initialPath:t.initialPath??`/`,children:k.createElement(k.Fragment,null,k.createElement(l,null),t.routes)})),{exitOnCtrlC:!1})})}export{y as ConfirmDialog,s as FocusBus,c as FocusBusProvider,h as InfoDialog,C as List,_ as ListItem,u as PRIORITY_FALLBACK,t as PRIORITY_FOCUSED,i as PRIORITY_ROUTER,S as ProgressDialog,b as QuestionsDialog,l as Route,m as RouteContext,e as Router,n as Tabable,o as TabableRegistry,w as WizardDialog,r as matchPath,L as runStandaloneTui,d as useFallbackInput,E as useFocusBus,T as useRoute,p as useRouter,x as useTabable,a as useTabableContext,f as useTabableInput};
2
2
  //# sourceMappingURL=standalone.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@x-otto/tui",
3
- "version": "0.1.0-alpha.30",
3
+ "version": "0.1.0-alpha.32",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -33,15 +33,15 @@
33
33
  "string-width": "^8.2.0",
34
34
  "wrap-ansi": "^10.0.0",
35
35
  "zustand": "^5.0.8",
36
- "@x-otto/env": "0.1.0-alpha.30",
37
- "@x-otto/interchange": "0.1.0-alpha.30",
38
- "@x-otto/session-contract": "0.1.0-alpha.30",
39
- "@x-otto/shared": "0.1.0-alpha.30"
36
+ "@x-otto/env": "0.1.0-alpha.32",
37
+ "@x-otto/shared": "0.1.0-alpha.32",
38
+ "@x-otto/interchange": "0.1.0-alpha.32",
39
+ "@x-otto/session-contract": "0.1.0-alpha.32"
40
40
  },
41
41
  "devDependencies": {
42
42
  "@types/react": "^19.2.2",
43
43
  "ink-testing-library": "4",
44
- "@x-otto/runtime": "0.1.0-alpha.30"
44
+ "@x-otto/runtime": "0.1.0-alpha.32"
45
45
  },
46
46
  "publishConfig": {
47
47
  "access": "public",