@visulima/tui 4.0.0 → 4.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (215) hide show
  1. package/CHANGELOG.md +2 -0
  2. package/LICENSE.md +130 -1
  3. package/dist/components/box.d.ts +735 -3
  4. package/dist/components/box.js +1 -1
  5. package/dist/components/canvas.js +1 -1
  6. package/dist/components/cursor.d.ts +2 -3
  7. package/dist/components/cursor.js +1 -1
  8. package/dist/components/error-overview.js +1 -1
  9. package/dist/components/spacer.js +1 -1
  10. package/dist/components/static-render.d.ts +2 -3
  11. package/dist/components/static-render.js +1 -1
  12. package/dist/components/static.d.ts +1 -3
  13. package/dist/components/static.js +1 -1
  14. package/dist/components/text.d.ts +1 -3
  15. package/dist/components/text.js +1 -1
  16. package/dist/components/transform.js +1 -1
  17. package/dist/core/index.js +1 -1
  18. package/dist/ink/canvas/index.d.ts +14 -1
  19. package/dist/ink/canvas/index.js +1 -1
  20. package/dist/ink/hooks/use-animation.js +1 -1
  21. package/dist/ink/hooks/use-app.d.ts +1 -2
  22. package/dist/ink/hooks/use-app.js +1 -1
  23. package/dist/ink/hooks/use-box-metrics.d.ts +2 -3
  24. package/dist/ink/hooks/use-box-metrics.js +1 -1
  25. package/dist/ink/hooks/use-clipboard.js +1 -1
  26. package/dist/ink/hooks/use-color-blindness.js +1 -1
  27. package/dist/ink/hooks/use-console-capture.js +1 -1
  28. package/dist/ink/hooks/use-cursor.d.ts +0 -1
  29. package/dist/ink/hooks/use-cursor.js +1 -1
  30. package/dist/ink/hooks/use-focus-manager.d.ts +0 -1
  31. package/dist/ink/hooks/use-focus-manager.js +1 -1
  32. package/dist/ink/hooks/use-focus.js +1 -1
  33. package/dist/ink/hooks/use-form.js +1 -1
  34. package/dist/ink/hooks/use-hotkey.js +1 -1
  35. package/dist/ink/hooks/use-input.js +2 -2
  36. package/dist/ink/hooks/use-interval.js +1 -1
  37. package/dist/ink/hooks/use-key-bindings.js +1 -1
  38. package/dist/ink/hooks/use-key-chord.js +1 -1
  39. package/dist/ink/hooks/use-paste.js +1 -1
  40. package/dist/ink/hooks/use-persistent-state.js +2 -2
  41. package/dist/ink/hooks/use-scroll-acceleration.js +1 -1
  42. package/dist/ink/hooks/use-scroll-input.js +1 -1
  43. package/dist/ink/hooks/use-stderr.d.ts +0 -1
  44. package/dist/ink/hooks/use-stderr.js +1 -1
  45. package/dist/ink/hooks/use-stdin.d.ts +0 -1
  46. package/dist/ink/hooks/use-stdin.js +1 -1
  47. package/dist/ink/hooks/use-stdout.d.ts +0 -1
  48. package/dist/ink/hooks/use-stdout.js +1 -1
  49. package/dist/ink/hooks/use-stopwatch.js +1 -1
  50. package/dist/ink/hooks/use-terminal-palette.js +1 -1
  51. package/dist/ink/hooks/use-text-buffer.js +4 -4
  52. package/dist/ink/hooks/use-text-selection.d.ts +3 -4
  53. package/dist/ink/hooks/use-text-selection.js +1 -1
  54. package/dist/ink/hooks/use-timeout.js +1 -1
  55. package/dist/ink/hooks/use-timer.js +1 -1
  56. package/dist/ink/hooks/use-window-size.js +1 -1
  57. package/dist/ink/index.d.ts +23 -15
  58. package/dist/ink/index.js +1 -1
  59. package/dist/ink/mouse/use-element-position.d.ts +2 -3
  60. package/dist/ink/mouse/use-element-position.js +1 -1
  61. package/dist/ink/mouse/use-mouse-action.d.ts +1 -2
  62. package/dist/ink/mouse/use-mouse-action.js +1 -1
  63. package/dist/ink/mouse/use-mouse-position.d.ts +1 -2
  64. package/dist/ink/mouse/use-mouse-position.js +1 -1
  65. package/dist/ink/mouse/use-mouse.d.ts +1 -2
  66. package/dist/ink/mouse/use-mouse.js +1 -1
  67. package/dist/ink/mouse/use-on-mouse-click.d.ts +3 -4
  68. package/dist/ink/mouse/use-on-mouse-click.js +1 -1
  69. package/dist/ink/mouse/use-on-mouse-hover.d.ts +2 -3
  70. package/dist/ink/mouse/use-on-mouse-hover.js +1 -1
  71. package/dist/ink/mouse/use-on-mouse-state.d.ts +2 -3
  72. package/dist/ink/mouse/use-on-mouse-state.js +1 -1
  73. package/dist/ink/public/cursor.d.ts +22 -1
  74. package/dist/ink/public/cursor.js +1 -1
  75. package/dist/ink/public/dom.d.ts +2 -3
  76. package/dist/ink/public/highlighter.d.ts +49 -3
  77. package/dist/ink/public/highlighter.js +1 -1
  78. package/dist/ink/public/input.d.ts +19 -1
  79. package/dist/ink/public/styles.d.ts +1 -3
  80. package/dist/ink/public/utils.d.ts +8 -1
  81. package/dist/ink/public/utils.js +1 -1
  82. package/dist/packem_shared/COLOR_BLINDNESS_COMPENSATION-CaI93Rjj.js +1 -0
  83. package/dist/packem_shared/Cell-CbDQUAjW.js +1 -0
  84. package/dist/packem_shared/DevTools-DKYxA_wO.js +1 -0
  85. package/dist/packem_shared/FocusContext-mWFBWdli.js +1 -0
  86. package/dist/packem_shared/Fullscreen-DKKMVbkg.js +1 -0
  87. package/dist/packem_shared/{IMECompositionBuffer-VhC9HRCv.js → IMECompositionBuffer-uYiAz3jI.js} +1 -1
  88. package/dist/packem_shared/{InputParser-CUAGWKQQ.js → InputParser-O4nyWUuQ.js} +2 -2
  89. package/dist/packem_shared/{KEY-C--kOw41.js → KEY-DGV_trPu.js} +1 -1
  90. package/dist/packem_shared/LayoutNode-D4i45GQM.js +1 -0
  91. package/dist/packem_shared/MouseProvider-BSTuFqG9.js +1 -0
  92. package/dist/packem_shared/NAMED_COLORS-DvfPALxN.js +1 -0
  93. package/dist/packem_shared/Range-CMqYzhij.js +1 -0
  94. package/dist/packem_shared/Renderer-Dg5_-6TF.js +1 -0
  95. package/dist/packem_shared/ResizeObserver-ClWoCtGV.js +1 -0
  96. package/dist/packem_shared/Static-sqw4n2Fv.js +1 -0
  97. package/dist/packem_shared/{TuiApp-CCVaiKbf.js → TuiApp-D1How6sn.js} +1 -1
  98. package/dist/packem_shared/TuiContext-Bbq9JRCu.js +3 -0
  99. package/dist/packem_shared/animation-context-Icwf5tBE.js +1 -0
  100. package/dist/packem_shared/ansi-parser-CysVDsNz.js +1 -0
  101. package/dist/packem_shared/ansi-tokenizer-D5k5LzXg.js +1 -0
  102. package/dist/packem_shared/{app-context-DTm1_XBA.js → app-context-CfgsW0CV.js} +1 -1
  103. package/dist/packem_shared/{app-context.d-DMLw5Nxy.d.ts → app-context.d-DAF6oxKX.d.ts} +0 -1
  104. package/dist/packem_shared/{boxes-DyY_LXCi.js → boxes-CidWUOVk.js} +1 -1
  105. package/dist/packem_shared/buildCursorOnlySequence-D24o0D7-.js +1 -0
  106. package/dist/packem_shared/calculateScroll-jdxVlcmq.js +1 -0
  107. package/dist/packem_shared/calculateScrollbarLayout-DCVwJ0Cl.js +1 -0
  108. package/dist/packem_shared/clearOsc52-olbKg5Nw.js +1 -0
  109. package/dist/packem_shared/clearStringWidthCache-EWeHQcEb.js +1 -0
  110. package/dist/packem_shared/colorize-Dsbi0Wr0.js +1 -0
  111. package/dist/packem_shared/createBrailleGrid-B5uefhi4.js +1 -0
  112. package/dist/packem_shared/createCanvasBuffer-C7w6bGe4.js +1 -0
  113. package/dist/packem_shared/createInlineLoop-BPlBAXqd.js +2 -0
  114. package/dist/packem_shared/createScreen-BBvF-ZyU.js +3 -0
  115. package/dist/packem_shared/cursor-context-wLwblh2o.js +1 -0
  116. package/dist/packem_shared/{disposeHighlighter-D9OkrhwX.js → disposeHighlighter-BS4lDPP8.js} +1 -1
  117. package/dist/packem_shared/dom-xpeZzKuf.js +1 -0
  118. package/dist/packem_shared/{dom.d-CLGlidfI.d.ts → dom.d-BV2bnRcH.d.ts} +2 -3
  119. package/dist/packem_shared/{focus-context-CsT69klR.js → focus-context-8h3hmNxy.js} +1 -1
  120. package/dist/packem_shared/formatDuration-DcLMLZro.js +1 -0
  121. package/dist/packem_shared/getPathToRoot-DBqZKIzf.js +1 -0
  122. package/dist/packem_shared/index-7Qq5uu0d.js +75 -0
  123. package/dist/packem_shared/isIntersecting-C8tJIsvH.js +1 -0
  124. package/dist/packem_shared/isTerminalPaletteQuerySupported-DwJPJ8_h.js +1 -0
  125. package/dist/packem_shared/kittyFlags-jpd_IAFL.js +1 -0
  126. package/dist/packem_shared/load-native-root-binding-B1WunHs4.js +1 -0
  127. package/dist/packem_shared/measure-element-pHwUPovG.js +1 -0
  128. package/dist/packem_shared/measure-text-DtlK6gar.js +3 -0
  129. package/dist/packem_shared/mouse-context-BEnaR3tG.js +1 -0
  130. package/dist/packem_shared/{mouse-context.d-W-nszUps.d.ts → mouse-context.d-5TGeZyIF.d.ts} +1 -2
  131. package/dist/packem_shared/parseSgrMouse-CHYo9gs6.js +1 -0
  132. package/dist/packem_shared/processLayout-DYdx6C3A.js +2 -0
  133. package/dist/packem_shared/reconciler-BPm7fZa6.js +1 -0
  134. package/dist/packem_shared/reconciler-DXp9qy6k.js +1 -0
  135. package/dist/packem_shared/render-B_NqU7AH.js +1 -0
  136. package/dist/packem_shared/render-DrIzCc0i.js +24 -0
  137. package/dist/packem_shared/{render.d-DjQhFsiN.d.ts → render.d-dEKhpngX.d.ts} +2 -3
  138. package/dist/packem_shared/renderToString-BLr8QvYq.js +2 -0
  139. package/dist/packem_shared/renderToString-D66vRHLQ.js +4 -0
  140. package/dist/packem_shared/renderToken-DFWLdYz_.js +1 -0
  141. package/dist/packem_shared/renderTreeToBuffer-MEHvKJc-.js +2 -0
  142. package/dist/packem_shared/renderer-D97BmOBO.js +17 -0
  143. package/dist/packem_shared/{selection.d-BSAWa4ey.d.ts → selection.d-DCMpXtpU.d.ts} +1 -1
  144. package/dist/packem_shared/squashTextNodesWithMap-CUJZZeW3.js +1 -0
  145. package/dist/packem_shared/stderr-context-Xeacf3Ir.js +1 -0
  146. package/dist/packem_shared/stdin-context-Ceh-YuU1.js +1 -0
  147. package/dist/packem_shared/stdout-context-BhxOwdNK.js +1 -0
  148. package/dist/packem_shared/{styles.d-CKGQFfm4.d.ts → styles.d-BCZOPl_g.d.ts} +37 -3
  149. package/dist/packem_shared/text-width-BXmBaLDv.js +2 -0
  150. package/dist/packem_shared/utils-BlDbvbdr.js +1 -0
  151. package/dist/packem_shared/waitFor-BjdYqkin.js +4 -0
  152. package/dist/packem_shared/wrapOrTruncateStyledLine-Gm21gYDr.js +3 -0
  153. package/dist/react/index.d.ts +1 -1
  154. package/dist/react/index.js +1 -1
  155. package/dist/testing/index.d.ts +4 -6
  156. package/dist/testing/index.js +1 -1
  157. package/index.js +26 -26
  158. package/package.json +12 -12
  159. package/dist/packem_shared/COLOR_BLINDNESS_COMPENSATION-Ilnoyeqc.js +0 -1
  160. package/dist/packem_shared/Cell-BrXn3jxY.js +0 -1
  161. package/dist/packem_shared/DevTools-CZ-O0Ckm.js +0 -1
  162. package/dist/packem_shared/FocusContext-BWFqf9kb.js +0 -1
  163. package/dist/packem_shared/Fullscreen-BRhuBLBh.js +0 -1
  164. package/dist/packem_shared/LayoutNode-LPYsuzBg.js +0 -1
  165. package/dist/packem_shared/MouseProvider-DOcWCRVq.js +0 -1
  166. package/dist/packem_shared/NAMED_COLORS-82DpREQV.js +0 -1
  167. package/dist/packem_shared/Range-BsVYNWtg.js +0 -1
  168. package/dist/packem_shared/Renderer-BeS49FNq.js +0 -1
  169. package/dist/packem_shared/ResizeObserver-BI9bDy-j.js +0 -1
  170. package/dist/packem_shared/Static-DSzsElz4.js +0 -1
  171. package/dist/packem_shared/TuiContext-BNmP0lMY.js +0 -3
  172. package/dist/packem_shared/animation-context-DW3p-vpk.js +0 -1
  173. package/dist/packem_shared/ansi-parser-DlgLtOYO.js +0 -1
  174. package/dist/packem_shared/ansi-tokenizer-BU67A126.js +0 -1
  175. package/dist/packem_shared/buildCursorOnlySequence-CerkmjWt.js +0 -1
  176. package/dist/packem_shared/calculateScroll-D4Y_JR4H.js +0 -1
  177. package/dist/packem_shared/calculateScrollbarLayout-Lf6i24c9.js +0 -1
  178. package/dist/packem_shared/clearOsc52-BUpnQOav.js +0 -1
  179. package/dist/packem_shared/clearStringWidthCache-DKFjfJuB.js +0 -1
  180. package/dist/packem_shared/colorize-DU4YZkp3.js +0 -1
  181. package/dist/packem_shared/createBrailleGrid-BTOQrujS.js +0 -1
  182. package/dist/packem_shared/createCanvasBuffer-CL6sAM-A.js +0 -1
  183. package/dist/packem_shared/createInlineLoop-BMDYJkRp.js +0 -2
  184. package/dist/packem_shared/createScreen-DoYpyL0V.js +0 -3
  185. package/dist/packem_shared/cursor-context-CFviBqPX.js +0 -1
  186. package/dist/packem_shared/dom-rphpG0kf.js +0 -1
  187. package/dist/packem_shared/formatDuration-Bdx4ZgRh.js +0 -1
  188. package/dist/packem_shared/getPathToRoot-PDJeqiEH.js +0 -1
  189. package/dist/packem_shared/index-Dl9I2_QH.js +0 -75
  190. package/dist/packem_shared/isIntersecting-Bo2npvMR.js +0 -1
  191. package/dist/packem_shared/isTerminalPaletteQuerySupported-BYzmqq9-.js +0 -1
  192. package/dist/packem_shared/kittyFlags-g8ALyoCU.js +0 -1
  193. package/dist/packem_shared/load-native-root-binding-CxJnHcac.js +0 -1
  194. package/dist/packem_shared/measure-element-D4M9iSYp.js +0 -1
  195. package/dist/packem_shared/measure-text-B7juNq4Y.js +0 -3
  196. package/dist/packem_shared/mouse-context-DaARgUu1.js +0 -1
  197. package/dist/packem_shared/parseSgrMouse-bUrqPrh-.js +0 -1
  198. package/dist/packem_shared/processLayout-I83k6vXE.js +0 -2
  199. package/dist/packem_shared/reconciler-D4fi5NfR.js +0 -1
  200. package/dist/packem_shared/reconciler-DkwOtC5B.js +0 -1
  201. package/dist/packem_shared/render-CPVY5vpQ.js +0 -1
  202. package/dist/packem_shared/render-CvhjGwOg.js +0 -24
  203. package/dist/packem_shared/renderToString-B1LgWcJe.js +0 -4
  204. package/dist/packem_shared/renderToString-Df6HST7u.js +0 -2
  205. package/dist/packem_shared/renderToken-DjiQ6dfv.js +0 -1
  206. package/dist/packem_shared/renderTreeToBuffer-BpSD0sBJ.js +0 -2
  207. package/dist/packem_shared/renderer-Cs0KEr1o.js +0 -17
  208. package/dist/packem_shared/squashTextNodesWithMap-BmUSBPfc.js +0 -1
  209. package/dist/packem_shared/stderr-context-CR2LLec6.js +0 -1
  210. package/dist/packem_shared/stdin-context-BjMA9Sbi.js +0 -1
  211. package/dist/packem_shared/stdout-context-DAAlQct2.js +0 -1
  212. package/dist/packem_shared/text-width-e49vlbQH.js +0 -2
  213. package/dist/packem_shared/utils-CVgM8kTn.js +0 -1
  214. package/dist/packem_shared/waitFor-CTAki32d.js +0 -4
  215. package/dist/packem_shared/wrapOrTruncateStyledLine-46W8bTtv.js +0 -3
@@ -1 +1 @@
1
- import{createDecMode as h,setMode as n,resetMode as u}from"@visulima/ansi";import{l as f}from"./index-Dl9I2_QH.js";import{Renderer as s,TerminalGuard as o}from"./Renderer-BeS49FNq.js";const i=h(2026),d=n(i),a=u(i);class p extends f.EventEmitter{renderer;terminal=null;backBuffer;width;height;isRunning=!1;stdoutBuffer=[];stderrBuffer=[];constructor(){super(),this.width=process.stdout.columns||80,this.height=process.stdout.rows||24,this.renderer=new s(this.width,this.height),this.backBuffer=new Uint32Array(this.width*this.height*2)}start(){this.isRunning||(this.terminal=new o(!0),this.isRunning=!0)}quit(){this.emit("quit")}stop(){this.isRunning=!1,this.terminal?.leave(),this.terminal=null,this.stdoutBuffer.length>0&&(process.stdout.write(this.stdoutBuffer.join("")),this.stdoutBuffer=[]),this.stderrBuffer.length>0&&(process.stderr.write(this.stderrBuffer.join("")),this.stderrBuffer=[])}writeStdout(t){this.isRunning?this.stdoutBuffer.push(t):process.stdout.write(t)}writeStderr(t){this.isRunning?this.stderrBuffer.push(t):process.stderr.write(t)}getBuffer(){return this.backBuffer}getSize(){return{height:this.height,width:this.width}}resize(t,e){this.width=t,this.height=e,this.renderer=new s(t,e),this.backBuffer=new Uint32Array(t*e*2)}beforeFlushListeners=[];onBeforeFlush(t){return this.beforeFlushListeners.push(t),()=>{this.beforeFlushListeners=this.beforeFlushListeners.filter(e=>e!==t)}}paintNow(t,e){if(this.isRunning){t(this.width,this.height),e(this.backBuffer,this.width,this.height);for(const r of this.beforeFlushListeners)r(this.backBuffer,this.width,this.height);this.renderer.writeRaw(d);try{this.renderer.render(this.backBuffer)}finally{this.renderer.writeRaw(a)}}}}export{p as TuiApp};
1
+ import{createDecMode as h,setMode as n,resetMode as u}from"@visulima/ansi";import{l as f}from"./index-7Qq5uu0d.js";import{Renderer as s,TerminalGuard as o}from"./Renderer-Dg5_-6TF.js";const r=h(2026),d=n(r),l=u(r);class g extends f.EventEmitter{renderer;terminal=null;backBuffer;width;height;isRunning=!1;stdoutBuffer=[];stderrBuffer=[];constructor(){super(),this.width=process.stdout.columns||80,this.height=process.stdout.rows||24,this.renderer=new s(this.width,this.height),this.backBuffer=new Uint32Array(this.width*this.height*2)}start(){this.isRunning||(this.terminal=new o(!0),this.isRunning=!0)}quit(){this.emit("quit")}stop(){this.isRunning=!1,this.terminal?.leave(),this.terminal=null,this.stdoutBuffer.length>0&&(process.stdout.write(this.stdoutBuffer.join("")),this.stdoutBuffer=[]),this.stderrBuffer.length>0&&(process.stderr.write(this.stderrBuffer.join("")),this.stderrBuffer=[])}writeStdout(t){this.isRunning?this.stdoutBuffer.push(t):process.stdout.write(t)}writeStderr(t){this.isRunning?this.stderrBuffer.push(t):process.stderr.write(t)}getBuffer(){return this.backBuffer}getSize(){return{height:this.height,width:this.width}}resize(t,e){this.width=t,this.height=e,this.renderer=new s(t,e),this.backBuffer=new Uint32Array(t*e*2)}beforeFlushListeners=[];onBeforeFlush(t){return this.beforeFlushListeners.push(t),()=>{this.beforeFlushListeners=this.beforeFlushListeners.filter(e=>e!==t)}}paintNow(t,e){if(this.isRunning){t(this.width,this.height),e(this.backBuffer,this.width,this.height);for(const i of this.beforeFlushListeners)i(this.backBuffer,this.width,this.height);this.renderer.writeRaw(d);try{this.renderer.render(this.backBuffer)}finally{this.renderer.writeRaw(l)}}}}export{g as TuiApp};
@@ -0,0 +1,3 @@
1
+ import{createContext as v,useContext as m,useState as A,useCallback as S,useEffect as d,useMemo as E,useRef as b}from"react";const g=v(null),D=Object.freeze({backspace:!1,ctrl:!1,delete:!1,downArrow:!1,end:!1,escape:!1,home:!1,leftArrow:!1,meta:!1,pageDown:!1,pageUp:!1,return:!1,rightArrow:!1,shift:!1,tab:!1,upArrow:!1}),p=e=>({...D,...e}),N=e=>{const t=m(g);if(!t)throw new Error("useInput must be used within a TUI App environment");const r=b(e);d(()=>{r.current=e}),d(()=>{const o=n=>{switch(n){case"backspace":return r.current("",p({backspace:!0}));case"delete":return r.current("",p({delete:!0}));case"down":return r.current("",p({downArrow:!0}));case"end":return r.current("",p({end:!0}));case"enter":return r.current("",p({return:!0}));case"escape":return r.current("",p({escape:!0}));case"home":return r.current("",p({home:!0}));case"left":return r.current("",p({leftArrow:!0}));case"pageDown":return r.current("",p({pageDown:!0}));case"pageUp":return r.current("",p({pageUp:!0}));case"right":return r.current("",p({rightArrow:!0}));case"shift-tab":return r.current("",p({shift:!0,tab:!0}));case"tab":return r.current("",p({tab:!0}));case"up":return r.current("",p({upArrow:!0}))}},c=n=>{r.current(n,p({ctrl:!0}))},s=n=>{r.current(n,p({meta:!0}))},u=(n,w)=>{n.startsWith("\x1B")||n==="\r"||n===`
2
+ `||r.current(n,p({ctrl:w?.ctrl??!1,meta:w?.meta??!1}))};return t.input.on("keydown",o),t.input.on("ctrl",c),t.input.on("meta",s),t.input.on("data",u),()=>{t.input.off("keydown",o),t.input.off("ctrl",c),t.input.off("meta",s),t.input.off("data",u)}},[t])},_=(e,t={})=>{const r=m(g);if(!r)throw new Error("usePaste must be used within a TUI App environment");const{isActive:o=!0}=t,c=b(e);d(()=>{c.current=e}),d(()=>{if(!o)return;const s=u=>{c.current(u)};return r.input.on("paste",s),()=>{r.input.off("paste",s)}},[r,o])},q=()=>{const e=m(g);if(!e)throw new Error("useTuiContext must be used within a TUI App environment");return e},K=()=>{const e=m(g);if(!e)throw new Error("useApp must be used within a TUI App environment");return{exit:()=>e.app.quit(),quit:()=>e.app.quit()}},F=()=>{const e=m(g);if(!e)throw new Error("useWindowSize must be used within a TUI App environment");const[t,r]=A(()=>e.app.getSize());return d(()=>{const o=()=>r(e.app.getSize());return e.app.on("resize",o),()=>{e.app.off("resize",o)}},[e]),{columns:t.width,rows:t.height}},I=e=>e.replaceAll(/\r?\n/g,`\r
3
+ `),H=()=>{const e=m(g);return{stdout:process.stdout,write:t=>{e?e.writeStdout(t):process.stdout.write(I(t))}}},O=()=>{const e=m(g);return{stderr:process.stderr,write:t=>{e?e.writeStderr(t):process.stderr.write(I(t))}}},j=()=>{const e=!!process.stdin.setRawMode;return{isRawModeSupported:e,setRawMode:t=>{e&&process.stdin.setRawMode(t)},stdin:process.stdin}},L=e=>!e||!e.yogaNode?{height:0,width:0}:{height:e.yogaNode.getComputedHeight()??0,width:e.yogaNode.getComputedWidth()??0},P={height:0,left:0,top:0,width:0},Y=e=>{const t=m(g),[r,o]=A(P),[c,s]=A(!1),u=S(()=>{if(!e.current?.yogaNode){s(!1);return}const n=e.current.getLayout();o(w=>w.width===n.width&&w.height===n.height&&w.left===n.left&&w.top===n.top?w:{height:n.height,left:n.left,top:n.top,width:n.width}),s(!0)},[e]);return d(u),d(()=>{if(t?.app)return t.app.on("resize",u),()=>{t.app.off("resize",u)}},[t,u]),E(()=>({...r,hasMeasured:c}),[r,c])},$=()=>!1,G=()=>({setCursorPosition:e=>{}}),J=({contentHeight:e,viewportHeight:t})=>{const[r,o]=A(0),c=Math.max(0,e-t),s=S(u=>Math.max(0,Math.min(u,c)),[c]);return d(()=>{o(u=>s(u))},[c,s]),E(()=>({atBottom:s(r)>=c,atTop:s(r)<=0,offset:s(r),scrollBy:u=>o(n=>s(n+u)),scrollDown:()=>o(u=>s(u+1)),scrollToBottom:()=>o(c),scrollToTop:()=>o(0),scrollUp:()=>o(u=>s(u-1))}),[r,c,s])},Q=e=>{const t=m(g);if(!t)throw new Error("useMouse must be used within a TUI App environment");const r=b(e);d(()=>{r.current=e}),d(()=>{const o=c=>r.current(c);return t.input.on("mouse",o),()=>{t.input.off("mouse",o)}},[t])},V=({initialValue:e="",isActive:t=!0,onChange:r,onSubmit:o}={})=>{const[c,s]=A(e),[u,n]=A(e.length),w=b(c),T=b(u);d(()=>{w.current=c}),d(()=>{T.current=u});const x=b(r);d(()=>{x.current=r});const z=b(o);d(()=>{z.current=o});const U=S(h=>{s(h),n(h.length)},[]),B=S(()=>{s(""),n(0),x.current?.("")},[]);N((h,f)=>{if(!t)return;const{current:a}=T,i=w.current;if(f.return){z.current?.(i);return}if(!f.escape){if(f.leftArrow){n(Math.max(0,a-1));return}if(f.rightArrow){n(Math.min(i.length,a+1));return}if(f.home||f.ctrl&&h==="a"){n(0);return}if(f.end||f.ctrl&&h==="e"){n(i.length);return}if(f.backspace){if(a===0)return;const l=i.slice(0,a-1)+i.slice(a);s(l),n(a-1),x.current?.(l);return}if(f.delete){if(a>=i.length)return;const l=i.slice(0,a)+i.slice(a+1);s(l),x.current?.(l);return}if(f.ctrl&&h==="u"){const l=i.slice(a);s(l),n(0),x.current?.(l);return}if(f.ctrl&&h==="k"){const l=i.slice(0,a);s(l),x.current?.(l);return}if(f.ctrl&&h==="w"){const M=i.slice(0,a).replace(/\S+\s*$/,""),C=M+i.slice(a);s(C),n(M.length),x.current?.(C);return}if(!(f.ctrl||f.meta)&&h&&h.length>0){const l=i.slice(0,a)+h+i.slice(a);s(l),n(a+h.length),x.current?.(l)}}});const R=m(g);return d(()=>{if(!R||!t)return;const h=f=>{const a=f.replaceAll(/[\u0000-\u0008\u000B-\u001F\u007F]/g,"").replaceAll(/\r\n?/g," "),{current:i}=T,l=w.current,M=l.slice(0,i)+a+l.slice(i);s(M),n(i+a.length),x.current?.(M)};return R.input.on("paste",h),()=>{R.input.off("paste",h)}},[R,t]),{clear:B,cursor:u,setValue:U,value:c}};export{g as TuiContext,L as measureElement,K as useApp,Y as useBoxMetrics,G as useCursor,N as useInput,$ as useIsScreenReaderEnabled,Q as useMouse,_ as usePaste,J as useScrollable,O as useStderr,j as useStdin,H as useStdout,V as useTextInput,q as useTuiContext,F as useWindowSize};
@@ -0,0 +1 @@
1
+ import{createContext as t}from"react";const e=t({renderThrottleMs:0,subscribe(){return{startTime:0,unsubscribe(){}}}});e.displayName="InternalAnimationContext";export{e as a};
@@ -0,0 +1 @@
1
+ import{enableNormalMouse as l,enableAnyEventMouse as a,enableSgrMouse as d,disableSgrMouse as f,disableAnyEventMouse as m,disableNormalMouse as b}from"@visulima/ansi";const B={mouseButton:{off:b,on:l},mouseMotion:{off:m,on:a},mouseMotionOthers:{off:"\x1B[?1015l",on:"\x1B[?1015h"},mouseSGR:{off:f,on:d}},p=/\[<(\d+);(\d+);(\d+)(M)$/i,M={0:"left",1:"middle",2:"right"},S={32:"left",33:"middle",34:"right"},g=c=>{const o=p.exec(c);if(!o)return;const i=Number(o[1]),t=Number(o[2]),s=Number(o[3]),n=o[4]==="m",e=i&-29;if(e===64||e===65)return{direction:e===64?"scrollup":"scrolldown",type:"scroll",x:t,y:s};if(e===35)return{type:"move",x:t,y:s};const r=S[e];if(r)return{action:n?"release":"press",button:r,type:"drag",x:t,y:s};const u=M[e];if(u)return{action:n?"release":"press",button:u,type:"click",x:t,y:s}};export{B as A,g as p};
@@ -0,0 +1 @@
1
+ const C=e=>{const t=e.codePointAt(0);return t!==void 0&&t>=48&&t<=63},v=e=>{const t=e.codePointAt(0);return t!==void 0&&t>=32&&t<=47},m=e=>{const t=e.codePointAt(0);return t!==void 0&&t>=64&&t<=126},p=e=>{const t=e.codePointAt(0);return t!==void 0&&t>=32&&t<=47},g=e=>{const t=e.codePointAt(0);return t!==void 0&&t>=48&&t<=126},f=e=>{const t=e.codePointAt(0);return t!==void 0&&t>=128&&t<=159},d=(e,t)=>{let n=t;for(;n<e.length;){const s=e[n];if(!C(s))break;n++}const r=e.slice(t,n),i=n;for(;n<e.length;){const s=e[n];if(!v(s))break;n++}const c=e.slice(i,n),a=e[n];if(!(a===void 0||!m(a)))return{endIndex:n+1,finalCharacter:a,intermediateString:c,parameterString:r}},h=(e,t,n)=>{for(let r=t;r<e.length;r++){const i=e[r];if(n&&i==="\x07"||i==="œ")return r+1;if(i==="\x1B"){const c=e[r+1];if(c==="\x1B"){r++;continue}if(c==="\\")return r+2}}},y=(e,t)=>{let n=t;for(;n<e.length;){const c=e[n];if(!p(c))break;n++}const r=e.slice(t,n),i=e[n];if(!(i===void 0||!g(i)))return{endIndex:n+1,finalCharacter:i,intermediateString:r}},S=e=>{switch(e){case"]":return{allowBellTerminator:!0,type:"osc"};case"^":return{allowBellTerminator:!1,type:"pm"};case"_":return{allowBellTerminator:!1,type:"apc"};case"P":return{allowBellTerminator:!1,type:"dcs"};case"X":return{allowBellTerminator:!1,type:"sos"};default:return}},w=e=>{switch(e){case"Ÿ":return{allowBellTerminator:!1,type:"apc"};case"":return{allowBellTerminator:!1,type:"dcs"};case"":return{allowBellTerminator:!0,type:"osc"};case"ž":return{allowBellTerminator:!1,type:"pm"};case"˜":return{allowBellTerminator:!1,type:"sos"};default:return}},T=e=>{if(e.includes("\x1B"))return!0;for(const t of e)if(f(t))return!0;return!1},l=(e,t,n,r)=>(r>n&&e.push({type:"text",value:t.slice(n,r)}),e.push({type:"invalid",value:t.slice(r)}),e),P=e=>{if(!T(e))return[{type:"text",value:e}];const t=[];let n=0;for(let r=0;r<e.length;){const i=e[r];if(i===void 0)break;if(i==="\x1B"){const a=e[r+1];if(a===void 0)return l(t,e,n,r);if(a==="["){const o=d(e,r+2);if(o===void 0)return l(t,e,n,r);r>n&&t.push({type:"text",value:e.slice(n,r)}),t.push({finalCharacter:o.finalCharacter,intermediateString:o.intermediateString,parameterString:o.parameterString,type:"csi",value:e.slice(r,o.endIndex)}),r=o.endIndex,n=r;continue}const s=S(a);if(s!==void 0){const o=h(e,r+2,s.allowBellTerminator);if(o===void 0)return l(t,e,n,r);r>n&&t.push({type:"text",value:e.slice(n,r)}),t.push({type:s.type,value:e.slice(r,o)}),r=o,n=r;continue}const u=y(e,r+1);if(u===void 0){if(p(a))return l(t,e,n,r);r>n&&t.push({type:"text",value:e.slice(n,r)}),r++,n=r;continue}r>n&&t.push({type:"text",value:e.slice(n,r)}),t.push({finalCharacter:u.finalCharacter,intermediateString:u.intermediateString,type:"esc",value:e.slice(r,u.endIndex)}),r=u.endIndex,n=r;continue}if(i==="›"){const a=d(e,r+1);if(a===void 0)return l(t,e,n,r);r>n&&t.push({type:"text",value:e.slice(n,r)}),t.push({finalCharacter:a.finalCharacter,intermediateString:a.intermediateString,parameterString:a.parameterString,type:"csi",value:e.slice(r,a.endIndex)}),r=a.endIndex,n=r;continue}const c=w(i);if(c!==void 0){const a=h(e,r+1,c.allowBellTerminator);if(a===void 0)return l(t,e,n,r);r>n&&t.push({type:"text",value:e.slice(n,r)}),t.push({type:c.type,value:e.slice(r,a)}),r=a,n=r;continue}if(i==="œ"){r>n&&t.push({type:"text",value:e.slice(n,r)}),t.push({type:"st",value:i}),r++,n=r;continue}if(f(i)){r>n&&t.push({type:"text",value:e.slice(n,r)}),t.push({type:"c1",value:i}),r++,n=r;continue}r++}return n<e.length&&t.push({type:"text",value:e.slice(n)}),t};export{T as h,P as t};
@@ -1 +1 @@
1
- import{createContext as e}from"react";const t=e({exit(){},suspendTerminal:(()=>Promise.resolve(void 0)),async waitUntilRenderFlush(){}});t.displayName="InternalAppContext";export{t as e};
1
+ import{createContext as e}from"react";const t=e({exit(){},suspendTerminal:(()=>Promise.resolve(void 0)),async waitUntilRenderFlush(){}});t.displayName="InternalAppContext";export{t as A};
@@ -1,4 +1,3 @@
1
- import 'react';
2
1
  /**
3
2
  * A handle returned by `suspendTerminal()` when called without a callback.
4
3
  * Call `resume()` (or use `await using`, which disposes it) to restore Ink's
@@ -1 +1 @@
1
- var t={topLeft:"┌",top:"─",topRight:"┐",right:"│",bottomRight:"┘",bottom:"─",bottomLeft:"└",left:"│"},o={topLeft:"╔",top:"═",topRight:"╗",right:"║",bottomRight:"╝",bottom:"═",bottomLeft:"╚",left:"║"},e={topLeft:"╭",top:"─",topRight:"╮",right:"│",bottomRight:"╯",bottom:"─",bottomLeft:"╰",left:"│"},b={topLeft:"┏",top:"━",topRight:"┓",right:"┃",bottomRight:"┛",bottom:"━",bottomLeft:"┗",left:"┃"},i={topLeft:"╓",top:"─",topRight:"╖",right:"║",bottomRight:"╜",bottom:"─",bottomLeft:"╙",left:"║"},g={topLeft:"╒",top:"═",topRight:"╕",right:"│",bottomRight:"╛",bottom:"═",bottomLeft:"╘",left:"│"},p={topLeft:"+",top:"-",topRight:"+",right:"|",bottomRight:"+",bottom:"-",bottomLeft:"+",left:"|"},f={topLeft:"↘",top:"↓",topRight:"↙",right:"←",bottomRight:"↖",bottom:"↑",bottomLeft:"↗",left:"→"};const h={single:t,double:o,round:e,bold:b,singleDouble:i,doubleSingle:g,classic:p,arrow:f};export{h as o};
1
+ var t={topLeft:"┌",top:"─",topRight:"┐",right:"│",bottomRight:"┘",bottom:"─",bottomLeft:"└",left:"│"},o={topLeft:"╔",top:"═",topRight:"╗",right:"║",bottomRight:"╝",bottom:"═",bottomLeft:"╚",left:"║"},e={topLeft:"╭",top:"─",topRight:"╮",right:"│",bottomRight:"╯",bottom:"─",bottomLeft:"╰",left:"│"},i={topLeft:"┏",top:"━",topRight:"┓",right:"┃",bottomRight:"┛",bottom:"━",bottomLeft:"┗",left:"┃"},b={topLeft:"╓",top:"─",topRight:"╖",right:"║",bottomRight:"╜",bottom:"─",bottomLeft:"╙",left:"║"},g={topLeft:"╒",top:"═",topRight:"╕",right:"│",bottomRight:"╛",bottom:"═",bottomLeft:"╘",left:"│"},l={topLeft:"+",top:"-",topRight:"+",right:"|",bottomRight:"+",bottom:"-",bottomLeft:"+",left:"|"},p={topLeft:"↘",top:"↓",topRight:"↙",right:"←",bottomRight:"↖",bottom:"↑",bottomLeft:"↗",left:"→"};const f={single:t,double:o,round:e,bold:i,singleDouble:b,doubleSingle:g,classic:l,arrow:p};export{f as c};
@@ -0,0 +1 @@
1
+ import{cursorHide as e,setCursorStyle as i,cursorUp as c,cursorTo as u,cursorShow as l,cursorDown as b}from"@visulima/ansi";const d={bar:6,"blinking-bar":5,"blinking-block":1,"blinking-underline":3,block:2,default:0,underline:4},x=r=>i(d[r]),C=(r,o)=>r?.x!==o?.x||r?.y!==o?.y,f=(r,o)=>{if(!o)return"";const n=r-o.y;return(n>0?c(n):"")+u(o.x)+l},t=(r,o)=>{if(!o)return"";const n=r-1-o.y;return(n>0?b(n):"")+u(0)},m=r=>{const o=r.cursorWasShown?e:"",n=t(r.previousLineCount,r.previousCursorPosition),s=f(r.visibleLineCount,r.cursorPosition);return o+n+s},y=(r,o,n)=>r?e+t(o,n):"";export{m as buildCursorOnlySequence,x as buildCursorShapeSequence,f as buildCursorSuffix,t as buildReturnToBottom,y as buildReturnToBottomPrefix,C as cursorPositionChanged};
@@ -0,0 +1 @@
1
+ import o from"yoga-layout";const m=t=>{const{yogaNode:l}=t;if(!l)return{scrollHeight:0,scrollWidth:0};const c=l.getComputedBorder(o.EDGE_TOP),g=l.getComputedBorder(o.EDGE_LEFT);let a=c,r=l.getComputedPadding(o.EDGE_LEFT);for(let i=0;i<l.getChildCount();i++){const e=l.getChild(i),n=e.getComputedTop()+e.getComputedHeight()+e.getComputedMargin(o.EDGE_BOTTOM);n>a&&(a=n);const s=e.getComputedLeft()+e.getComputedWidth()+e.getComputedMargin(o.EDGE_RIGHT);s>r&&(r=s)}const d=a-c+l.getComputedPadding(o.EDGE_BOTTOM),h=r-g+l.getComputedPadding(o.EDGE_RIGHT);return{scrollHeight:Math.round(d),scrollWidth:Math.round(h)}},p=t=>Math.round(t.internal_scrollState?.scrollHeight??0),E=t=>Math.round(t.internal_scrollState?.scrollWidth??0),T=t=>{const{yogaNode:l}=t;if(!l)return;const{scrollHeight:c,scrollWidth:g}=m(t);let a=c;const r=Math.max(0,l.getComputedHeight()-l.getComputedBorder(o.EDGE_TOP)-l.getComputedBorder(o.EDGE_BOTTOM));if(t.style.stableScrollback&&t.style.overflowToBackbuffer){const e=Math.max(0,c-r);if(t.internal_isScrollbackDirty)t.internal_maxScrollTop=e,t.internal_isScrollbackDirty=!1;else{const n=Math.max(t.internal_maxScrollTop??0,e),{maxScrollbackLength:s}=t.style;t.internal_maxScrollTop=s===void 0?n:Math.min(n,e+Math.max(0,s))}a=Math.max(c,(t.internal_maxScrollTop??0)+r)}const d=Math.max(0,Math.min(t.style.scrollTop??0,a-r)),h=Math.max(0,l.getComputedWidth()-l.getComputedBorder(o.EDGE_LEFT)-l.getComputedBorder(o.EDGE_RIGHT)),i=Math.max(0,Math.min(t.style.scrollLeft??0,g-h));t.internal_scrollState={actualScrollHeight:c,clientHeight:r,clientWidth:h,scrollHeight:a,scrollLeft:i,scrollTop:d,scrollWidth:g}},M=t=>Math.round(t.internal_scrollState?.scrollTop??0),_=t=>Math.round(t.internal_scrollState?.scrollLeft??0);export{T as calculateScroll,p as getScrollHeight,_ as getScrollLeft,M as getScrollTop,E as getScrollWidth};
@@ -0,0 +1 @@
1
+ import{c as o,a as r,b as g,m as s,g as c,d as i,e as n,f as d,h as u,i as b,j as m,k as B,l as S}from"./measure-element-pHwUPovG.js";import"./calculateScroll-jdxVlcmq.js";import"./squashTextNodesWithMap-CUJZZeW3.js";export{o as calculateScrollbarLayout,r as calculateScrollbarThumb,g as collectSortedFragments,s as default,c as getAddedScrollHeight,i as getBoundingBox,n as getHorizontalScrollbarBoundingBox,d as getInnerHeight,u as getInnerWidth,b as getRelativeLeft,m as getRelativeTop,B as getText,S as getVerticalScrollbarBoundingBox};
@@ -0,0 +1 @@
1
+ const o=new Set(["Alacritty","contour","foot","Ghostty","iTerm2","iTerm.app","kitty","rio","WezTerm"]),c=()=>{const t=process.env.TERM_PROGRAM??"";if(o.has(t))return!0;const r=process.env.TERM??"";return!!(r.startsWith("xterm")||process.env.WT_SESSION||process.env.TMUX||r.startsWith("screen"))},n=new Set(["c","p","s"]),i=(t,r,e="c")=>{if(!n.has(e))throw new Error(`Invalid clipboard target: ${e}`);const s=Buffer.from(r,"utf8").toString("base64");t.write(`\x1B]52;${e};${s}\x07`)},u=(t,r="c")=>{t.write(`\x1B]52;${r};\x07`)};export{u as clearOsc52,c as isOsc52Supported,i as writeOsc52};
@@ -0,0 +1 @@
1
+ import{c as t,a as i,m as s,i as l,k as n,s as d,b as r,l as c,d as h,t as y}from"./measure-text-DtlK6gar.js";export{t as clearStringWidthCache,i as clearStyledLineCache,s as default,l as inkCharacterWidth,n as measureStyledLine,d as setEnableStyledLineCache,r as setStringWidthFunction,c as splitStyledLineByNewline,h as styledLineWidth,y as toStyledLine};
@@ -0,0 +1 @@
1
+ import t from"@visulima/colorize";const i=/^rgb\(\s?(\d+),\s?(\d+),\s?(\d+)\s?\)$/,d=/^ansi256\(\s?(\d+)\s?\)$/,f=e=>e in t,c=(e,r,u)=>{if(!r)return e;if(f(r)){if(u==="foreground")return t[r](e);const s=`bg${r[0].toUpperCase()+r.slice(1)}`;return t[s](e)}if(r.startsWith("#"))return u==="foreground"?t.hex(r)(e):t.bgHex(r)(e);if(r.startsWith("ansi256")){const s=d.exec(r);if(!s)return e;const n=Number(s[1]);return u==="foreground"?t.ansi256(n)(e):t.bgAnsi256(n)(e)}if(r.startsWith("rgb")){const s=i.exec(r);if(!s)return e;const n=Number(s[1]),a=Number(s[2]),o=Number(s[3]);return u==="foreground"?t.rgb(n,a,o)(e):t.bgRgb(n,a,o)(e)}return e},m=e=>{const r=c("x",e,"background");if(r!=="x")return r.split("x")[0]};export{c,m as g};
@@ -0,0 +1 @@
1
+ const E=[1,8,2,16,4,32,64,128],X=(c,l)=>{const L=Math.max(0,c*2),p=Math.max(0,l*4),i=new Uint8Array(c*l),u=new Uint8Array(c*l),x=(r,e)=>{if(r<0||e<0||r>=L||e>=p)return;const a=Math.floor(r/2),f=Math.floor(e/4),t=r%2,o=e%4,n=E[o*2+t],s=f*c+a;(i[s]&n)===0&&(i[s]=(i[s]??0)|n,u[s]=1)};return{cellHeight:l,cellWidth:c,clear:()=>{i.fill(0),u.fill(0)},flush:(r,e)=>{for(const[a,f]of i.entries()){if(u[a]===0)continue;const t=a%c,o=Math.floor(a/c),n=10240+f;r.setCell(t,o,n,e)}},pixelHeight:p,pixelWidth:L,plotLine:(r,e,a,f)=>{let t=Math.round(r),o=Math.round(e);const n=Math.round(a),s=Math.round(f),M=Math.abs(n-t),B=t<n?1:-1,b=-Math.abs(s-o),h=o<s?1:-1;let d=M+b;for(;x(t,o),!(t===n&&o===s);){const A=2*d;if(A>=b){if(t===n)break;d+=b,t+=B}if(A<=M){if(o===s)break;d+=M,o+=h}}},plotPoint:x}};export{X as createBrailleGrid};
@@ -0,0 +1 @@
1
+ import{c as D}from"./colorize-Dsbi0Wr0.js";const E=Math.trunc(1),F=2,_=32,T=0,Y=()=>{const r=new Map,c=[void 0];return{decode:i=>c[i],encode:i=>{if(i===void 0)return T;const m=typeof i=="number"?`n:${i}`:`s:${i}`,g=r.get(m);if(g!==void 0)return g;const p=c.length;return c.push(i),r.set(m,p),p}}},v=[9601,9602,9603,9604,9605,9606,9607,9608],w=[9615,9614,9613,9612,9611,9610,9609,9608],O=9608,k=r=>{if(!r)return 0;let c=0;return r.bold&&(c|=E),r.dim&&(c|=F),c},R=r=>typeof r=="number"?r:r.codePointAt(0)??_,U=(r,c)=>{const i=Math.max(0,r*c),m=new Uint32Array(i),g=new Uint32Array(i),p=new Int32Array(i),M=new Int32Array(i),C=new Uint8Array(c),{decode:B,encode:A}=Y();m.fill(_);const b=e=>{e>=0&&e<c&&(C[e]=1)},d=(e,o,n,s)=>{if(e<0||e>=r||o<0||o>=c)return;const t=o*r+e,l=R(n),f=A(s?.color),a=A(s?.background),u=k(s);m[t]===l&&g[t]===u&&p[t]===f&&M[t]===a||(m[t]=l,g[t]=u,p[t]=f,M[t]=a,C[o]=1)};return{bg:M,chars:m,colorDecoder:B,context:{clear:()=>{m.fill(_),g.fill(0),p.fill(0),M.fill(0),C.fill(1)},drawHBar:(e,o,n,s,t)=>{if(n<=0||o<0||o>=c)return;const l=Math.max(0,Math.min(1,s)),f=n*w.length,a=Math.round(l*f),u=Math.floor(a/w.length),L=a%w.length;for(let x=0;x<n;x+=1){const S=e+x;x<u?d(S,o,O,t):x===u&&L>0?d(S,o,w[L-1],t):d(S,o,_,t)}b(o)},drawRect:(e,o,n,s,t,l)=>{if(n<=0||s<=0)return;const f=R(t);for(let a=0;a<s;a+=1){for(let u=0;u<n;u+=1)d(e+u,o+a,f,l);b(o+a)}},drawText:(e,o,n,s)=>{if(o<0||o>=c||n.length===0)return;let t=0;for(const l of n)d(e+t,o,l,s),t+=1;b(o)},drawVBar:(e,o,n,s,t)=>{if(n<=0||e<0||e>=r)return;const l=Math.max(0,Math.min(1,s)),f=n*v.length,a=Math.round(l*f),u=Math.floor(a/v.length),L=a%v.length;for(let x=0;x<n;x+=1){const S=n-x-1,P=o+x;S<u?d(e,P,O,t):S===u&&L>0?d(e,P,v[L-1],t):d(e,P,_,t),b(P)}},height:c,setCell:d,width:r},dirty:C,fg:p,height:c,styles:g,width:r}},$=(r,c)=>{const{bg:i,chars:m,colorDecoder:g,fg:p,styles:M,width:C}=r,B=c*C;let A="",b=0,d=M[B],I=p[B],e=i[B];const o=n=>{let s="";for(let a=b;a<n;a+=1)s+=String.fromCodePoint(m[B+a]);const t=g(I),l=g(e);let f=s;t!==void 0&&(f=D(f,typeof t=="number"?String(t):t,"foreground")),l!==void 0&&(f=D(f,typeof l=="number"?String(l):l,"background")),(d&E)!==0&&(f=`\x1B[1m${f}\x1B[22m`),(d&F)!==0&&(f=`\x1B[2m${f}\x1B[22m`),A+=f};for(let n=1;n<C;n+=1){const s=M[B+n],t=p[B+n],l=i[B+n];(s!==d||t!==I||l!==e)&&(o(n),b=n,d=s,I=t,e=l)}return o(C),A};export{U as createCanvasBuffer,$ as serializeRow};
@@ -0,0 +1,2 @@
1
+ import{createDecMode as b,setMode as m,resetMode as I,BracketedPasteMode as T,cursorHide as k,REQUEST_CURSOR_POSITION as C,cursorPosition as f,eraseLine as U,cursorShow as g,cursorUp as x,cursorToColumn1 as z}from"@visulima/ansi";import{terminalSize as D,Renderer as L}from"./Renderer-Dg5_-6TF.js";const M=b(2026),F=m(M),G=I(M),Y=m(T),A=I(T);function j(S,i={}){const E=i.rows??10,O=i.fps??60,_=i.onExit??"preserve",{onStop:h}=i;let c=null,n=null,l=null,a=80,s=10,v=0,o=1,u=!1,r=null;function e(t){n.writeRaw(t)}function p(){l.fill(0),S(l,a,s,v++),e(F);try{n.render(l)}finally{e(G)}}function y(t){o=t-s,e(x(s)+z),n.setRowOffset(o),p(),c=setInterval(()=>{p()},Math.round(1e3/O))}function B(){const t=D();a=t.cols;const N=t.rows;s=Math.min(E,N),process.stdin.isTTY&&process.stdin.setRawMode(!0),process.stdin.resume(),process.stdin.setEncoding("utf8"),n=new L(a,s),l=new Uint32Array(a*s*2),e(k),e(Y),e(`
2
+ `.repeat(s)),e(C),process.on("SIGINT",d);let w="";r=P=>{w+=P;const R=w.match(/\u001B\[(\d+);(\d+)R/);R&&(r&&(process.stdin.off("data",r),r=null),y(Number.parseInt(R[1],10)))},process.stdin.on("data",r)}function d(){if(!u){if(u=!0,c&&(clearInterval(c),c=null),process.off("SIGINT",d),r&&(process.stdin.off("data",r),r=null),n){if(_==="destroy"){for(let t=0;t<s;t++)e(f(o+1+t,1)+U);e(f(o+1,1))}else e(f(o+s+1,1));e(A),e(g)}process.stdin.isTTY&&process.stdin.setRawMode(!1),process.stdin.pause(),h?.()}}return{start:B,stop:d}}export{j as createInlineLoop};
@@ -0,0 +1,3 @@
1
+ import{strip as n}from"@visulima/ansi";const u=(r,e)=>{const i=t=>t===void 0?"":n(t);return{contains(t){return this.text().includes(t)},frames(){return e.map(t=>n(t))},line(t){return this.text().split(`
2
+ `)[t]??""},lines(){return this.text().split(`
3
+ `).filter(t=>t.trim()!=="")},matches(t){return t.test(this.text())},rawFrames(){return[...e]},rawText(){return r()??""},text(){return i(r())}}};export{u as createScreen};
@@ -0,0 +1 @@
1
+ import{createContext as t}from"react";const o=t({setCursorPosition(){}});o.displayName="InternalCursorContext";export{o as C};
@@ -1 +1 @@
1
- const l={bash:()=>import("@shikijs/langs/bash"),c:()=>import("@shikijs/langs/c"),clojure:()=>import("@shikijs/langs/clojure"),cpp:()=>import("@shikijs/langs/cpp"),csharp:()=>import("@shikijs/langs/csharp"),css:()=>import("@shikijs/langs/css"),dart:()=>import("@shikijs/langs/dart"),diff:()=>import("@shikijs/langs/diff"),dockerfile:()=>import("@shikijs/langs/dockerfile"),elixir:()=>import("@shikijs/langs/elixir"),erlang:()=>import("@shikijs/langs/erlang"),go:()=>import("@shikijs/langs/go"),graphql:()=>import("@shikijs/langs/graphql"),groovy:()=>import("@shikijs/langs/groovy"),haskell:()=>import("@shikijs/langs/haskell"),html:()=>import("@shikijs/langs/html"),java:()=>import("@shikijs/langs/java"),javascript:()=>import("@shikijs/langs/javascript"),json:()=>import("@shikijs/langs/json"),jsonc:()=>import("@shikijs/langs/jsonc"),jsx:()=>import("@shikijs/langs/jsx"),kotlin:()=>import("@shikijs/langs/kotlin"),less:()=>import("@shikijs/langs/less"),lua:()=>import("@shikijs/langs/lua"),makefile:()=>import("@shikijs/langs/makefile"),markdown:()=>import("@shikijs/langs/markdown"),mdx:()=>import("@shikijs/langs/mdx"),nginx:()=>import("@shikijs/langs/nginx"),objc:()=>import("@shikijs/langs/objc"),perl:()=>import("@shikijs/langs/perl"),php:()=>import("@shikijs/langs/php"),powershell:()=>import("@shikijs/langs/powershell"),prisma:()=>import("@shikijs/langs/prisma"),python:()=>import("@shikijs/langs/python"),r:()=>import("@shikijs/langs/r"),ruby:()=>import("@shikijs/langs/ruby"),rust:()=>import("@shikijs/langs/rust"),scala:()=>import("@shikijs/langs/scala"),scss:()=>import("@shikijs/langs/scss"),shell:()=>import("@shikijs/langs/shell"),sql:()=>import("@shikijs/langs/sql"),svelte:()=>import("@shikijs/langs/svelte"),swift:()=>import("@shikijs/langs/swift"),text:()=>Promise.resolve({name:"text",patterns:[],repository:{},scopeName:"source.text"}),toml:()=>import("@shikijs/langs/toml"),tsx:()=>import("@shikijs/langs/tsx"),typescript:()=>import("@shikijs/langs/typescript"),vue:()=>import("@shikijs/langs/vue"),xml:()=>import("@shikijs/langs/xml"),yaml:()=>import("@shikijs/langs/yaml"),zig:()=>import("@shikijs/langs/zig")},d={"c#":"csharp","c++":"cpp",docker:"dockerfile",gql:"graphql",hs:"haskell",js:"javascript",kt:"kotlin",md:"markdown","objective-c":"objc",ps1:"powershell",py:"python",rb:"ruby",rs:"rust",sh:"bash",ts:"typescript",yml:"yaml",zsh:"bash"},g={"catppuccin-frappe":()=>import("@shikijs/themes/catppuccin-frappe"),"catppuccin-latte":()=>import("@shikijs/themes/catppuccin-latte"),"catppuccin-macchiato":()=>import("@shikijs/themes/catppuccin-macchiato"),"catppuccin-mocha":()=>import("@shikijs/themes/catppuccin-mocha"),"dark-plus":()=>import("@shikijs/themes/dark-plus"),dracula:()=>import("@shikijs/themes/dracula"),"github-dark":()=>import("@shikijs/themes/github-dark"),"github-dark-default":()=>import("@shikijs/themes/github-dark-default"),"github-dark-dimmed":()=>import("@shikijs/themes/github-dark-dimmed"),"github-light":()=>import("@shikijs/themes/github-light"),"github-light-default":()=>import("@shikijs/themes/github-light-default"),"light-plus":()=>import("@shikijs/themes/light-plus"),"min-dark":()=>import("@shikijs/themes/min-dark"),"min-light":()=>import("@shikijs/themes/min-light"),monokai:()=>import("@shikijs/themes/monokai"),nord:()=>import("@shikijs/themes/nord"),"one-dark-pro":()=>import("@shikijs/themes/one-dark-pro"),"one-light":()=>import("@shikijs/themes/one-light"),poimandres:()=>import("@shikijs/themes/poimandres"),"rose-pine":()=>import("@shikijs/themes/rose-pine"),"rose-pine-dawn":()=>import("@shikijs/themes/rose-pine-dawn"),"rose-pine-moon":()=>import("@shikijs/themes/rose-pine-moon"),"slack-dark":()=>import("@shikijs/themes/slack-dark"),"slack-ochin":()=>import("@shikijs/themes/slack-ochin"),"solarized-dark":()=>import("@shikijs/themes/solarized-dark"),"solarized-light":()=>import("@shikijs/themes/solarized-light"),"tokyo-night":()=>import("@shikijs/themes/tokyo-night"),"vitesse-dark":()=>import("@shikijs/themes/vitesse-dark"),"vitesse-light":()=>import("@shikijs/themes/vitesse-light")};let a;const m=new Map,c=new Map,u=50,p=new Map,k=(i,t,o)=>`${i.length}:${i}\0${t}\0${o}`,b=(i,t,o,e)=>{const r=k(t,o,e);if(p.has(r)){const s=p.get(r);return p.delete(r),p.set(r,s),s}const n=i.codeToTokens(t,{lang:o,theme:e});if(p.set(r,n),p.size>u){const s=p.keys().next().value;s!==void 0&&p.delete(s)}return n},y=async()=>{const[i,t]=await Promise.all([import("shiki/core"),import("shiki/engine/javascript")]),{createHighlighterCore:o}=i,{createJavaScriptRegexEngine:e}=t;return await o({engine:e(),langs:[],themes:[import("@shikijs/themes/github-dark-default")]})},h=i=>{const t=i.toLowerCase();return d[t]??t},v=i=>h(i)in l,w=async(i,t)=>{const o=h(t);if(!(o==="text"||(i.getLoadedLanguages?.()??[]).includes(o))){if(!m.has(o)){const e=(async()=>{try{const r=l[o];r&&await i.loadLanguage(await r())}catch(r){throw m.delete(o),r}})();m.set(o,e)}await m.get(o)}},f=async(i,t)=>{if((i.getLoadedThemes?.()??[]).includes(t))return;const o=g[t];if(o){if(!c.has(t)){const e=(async()=>{try{await i.loadTheme(await o())}catch(r){throw c.delete(t),r}})();c.set(t,e)}await c.get(t)}},x=async(i=[],t)=>{a||(a=y());const o=await a,e=i.map(r=>w(o,r));return t&&t!=="github-dark-default"&&e.push(f(o,t)),await Promise.all(e),o},j=()=>{m.clear(),c.clear(),p.clear(),a&&(a.then(i=>{try{i.dispose?.()}catch{}}).catch(()=>{}),a=void 0)};export{x as default,j as disposeHighlighter,b as getCachedTokens,v as isLanguageSupported,h as resolveLanguage};
1
+ const l={bash:()=>import("@shikijs/langs/bash"),c:()=>import("@shikijs/langs/c"),clojure:()=>import("@shikijs/langs/clojure"),cpp:()=>import("@shikijs/langs/cpp"),csharp:()=>import("@shikijs/langs/csharp"),css:()=>import("@shikijs/langs/css"),dart:()=>import("@shikijs/langs/dart"),diff:()=>import("@shikijs/langs/diff"),dockerfile:()=>import("@shikijs/langs/dockerfile"),elixir:()=>import("@shikijs/langs/elixir"),erlang:()=>import("@shikijs/langs/erlang"),go:()=>import("@shikijs/langs/go"),graphql:()=>import("@shikijs/langs/graphql"),groovy:()=>import("@shikijs/langs/groovy"),haskell:()=>import("@shikijs/langs/haskell"),html:()=>import("@shikijs/langs/html"),java:()=>import("@shikijs/langs/java"),javascript:()=>import("@shikijs/langs/javascript"),json:()=>import("@shikijs/langs/json"),jsonc:()=>import("@shikijs/langs/jsonc"),jsx:()=>import("@shikijs/langs/jsx"),kotlin:()=>import("@shikijs/langs/kotlin"),less:()=>import("@shikijs/langs/less"),lua:()=>import("@shikijs/langs/lua"),makefile:()=>import("@shikijs/langs/makefile"),markdown:()=>import("@shikijs/langs/markdown"),mdx:()=>import("@shikijs/langs/mdx"),nginx:()=>import("@shikijs/langs/nginx"),objc:()=>import("@shikijs/langs/objc"),perl:()=>import("@shikijs/langs/perl"),php:()=>import("@shikijs/langs/php"),powershell:()=>import("@shikijs/langs/powershell"),prisma:()=>import("@shikijs/langs/prisma"),python:()=>import("@shikijs/langs/python"),r:()=>import("@shikijs/langs/r"),ruby:()=>import("@shikijs/langs/ruby"),rust:()=>import("@shikijs/langs/rust"),scala:()=>import("@shikijs/langs/scala"),scss:()=>import("@shikijs/langs/scss"),shell:()=>import("@shikijs/langs/shell"),sql:()=>import("@shikijs/langs/sql"),svelte:()=>import("@shikijs/langs/svelte"),swift:()=>import("@shikijs/langs/swift"),text:()=>Promise.resolve({name:"text",patterns:[],repository:{},scopeName:"source.text"}),toml:()=>import("@shikijs/langs/toml"),tsx:()=>import("@shikijs/langs/tsx"),typescript:()=>import("@shikijs/langs/typescript"),vue:()=>import("@shikijs/langs/vue"),xml:()=>import("@shikijs/langs/xml"),yaml:()=>import("@shikijs/langs/yaml"),zig:()=>import("@shikijs/langs/zig")},h={"c#":"csharp","c++":"cpp",docker:"dockerfile",gql:"graphql",hs:"haskell",js:"javascript",kt:"kotlin",md:"markdown","objective-c":"objc",ps1:"powershell",py:"python",rb:"ruby",rs:"rust",sh:"bash",ts:"typescript",yml:"yaml",zsh:"bash"},g={"catppuccin-frappe":()=>import("@shikijs/themes/catppuccin-frappe"),"catppuccin-latte":()=>import("@shikijs/themes/catppuccin-latte"),"catppuccin-macchiato":()=>import("@shikijs/themes/catppuccin-macchiato"),"catppuccin-mocha":()=>import("@shikijs/themes/catppuccin-mocha"),"dark-plus":()=>import("@shikijs/themes/dark-plus"),dracula:()=>import("@shikijs/themes/dracula"),"github-dark":()=>import("@shikijs/themes/github-dark"),"github-dark-default":()=>import("@shikijs/themes/github-dark-default"),"github-dark-dimmed":()=>import("@shikijs/themes/github-dark-dimmed"),"github-light":()=>import("@shikijs/themes/github-light"),"github-light-default":()=>import("@shikijs/themes/github-light-default"),"light-plus":()=>import("@shikijs/themes/light-plus"),"min-dark":()=>import("@shikijs/themes/min-dark"),"min-light":()=>import("@shikijs/themes/min-light"),monokai:()=>import("@shikijs/themes/monokai"),nord:()=>import("@shikijs/themes/nord"),"one-dark-pro":()=>import("@shikijs/themes/one-dark-pro"),"one-light":()=>import("@shikijs/themes/one-light"),poimandres:()=>import("@shikijs/themes/poimandres"),"rose-pine":()=>import("@shikijs/themes/rose-pine"),"rose-pine-dawn":()=>import("@shikijs/themes/rose-pine-dawn"),"rose-pine-moon":()=>import("@shikijs/themes/rose-pine-moon"),"slack-dark":()=>import("@shikijs/themes/slack-dark"),"slack-ochin":()=>import("@shikijs/themes/slack-ochin"),"solarized-dark":()=>import("@shikijs/themes/solarized-dark"),"solarized-light":()=>import("@shikijs/themes/solarized-light"),"tokyo-night":()=>import("@shikijs/themes/tokyo-night"),"vitesse-dark":()=>import("@shikijs/themes/vitesse-dark"),"vitesse-light":()=>import("@shikijs/themes/vitesse-light")};let a;const m=new Map,c=new Map,u=50,p=new Map,k=(o,t,r)=>`${o.length}:${o}\0${t}\0${r}`,v=(o,t,r,e)=>{const i=k(t,r,e);if(p.has(i)){const n=p.get(i);return p.delete(i),p.set(i,n),n}const s=o.codeToTokens(t,{lang:r,theme:e});if(p.set(i,s),p.size>u){const n=p.keys().next().value;n!==void 0&&p.delete(n)}return s},y=async()=>{const[o,t]=await Promise.all([import("shiki/core"),import("shiki/engine/javascript")]),{createHighlighterCore:r}=o,{createJavaScriptRegexEngine:e}=t;return await r({engine:e(),langs:[],themes:[import("@shikijs/themes/github-dark-default")]})},d=o=>{const t=o.toLowerCase();return h[t]??t},L=o=>d(o)in l,f=async(o,t)=>{const r=d(t);if(!(r==="text"||(o.getLoadedLanguages?.()??[]).includes(r))){if(!m.has(r)){const i=(async()=>{try{const s=l[r];s&&await o.loadLanguage(await s())}catch(s){throw m.delete(r),s}})();m.set(r,i)}await m.get(r)}},w=async(o,t)=>{if((o.getLoadedThemes?.()??[]).includes(t))return;const e=g[t];if(e){if(!c.has(t)){const i=(async()=>{try{await o.loadTheme(await e())}catch(s){throw c.delete(t),s}})();c.set(t,i)}await c.get(t)}},b=async(o=[],t)=>{a||(a=y());const r=await a,e=o.map(i=>f(r,i));return t&&t!=="github-dark-default"&&e.push(w(r,t)),await Promise.all(e),r},x=()=>{m.clear(),c.clear(),p.clear(),a&&(a.then(o=>{try{o.dispose?.()}catch{}}).catch(()=>{}),a=void 0)};export{b as default,x as disposeHighlighter,v as getCachedTokens,L as isLanguageSupported,d as resolveLanguage};
@@ -0,0 +1 @@
1
+ import g from"yoga-layout";import{m as d}from"./measure-text-DtlK6gar.js";import y from"./squashTextNodesWithMap-CUJZZeW3.js";import{wordWrap as p,truncate as h}from"@visulima/string";const l={},m={hard:"STRICT_WIDTH",wrap:"BREAK_WORDS","wrap-anywhere":"BREAK_AT_CHARACTERS","wrap-preserve-words":"PRESERVE_WORDS","wrap-strict":"STRICT_WIDTH"},x=(e,t,a)=>{const r=e+String(t)+String(a),i=l[r];if(i)return i;let s=e;const c=m[a];if(c)s=p(e,{trim:!1,width:t,wrapMode:c}).replace(/\n$/,"");else if(a.startsWith("truncate")){let o="end";a==="truncate-middle"&&(o="middle"),a==="truncate-start"&&(o="start"),s=h(e,t,{position:o})}return l[r]=s,s};let S=0;const b=e=>{const t={attributes:{},childNodes:[],internal_accessibility:{},internal_id:S++,nodeName:e,parentNode:void 0,style:{},yogaNode:e==="ink-virtual-text"||e==="ink-cursor"?void 0:g.Node.create()};return e==="ink-text"&&t.yogaNode?.setMeasureFunc(_.bind(null,t)),t},n=e=>{f(e.nodeName==="ink-static-render"&&e.cachedRender?e.parentNode:e)},A=(e,t)=>{t.parentNode&&u(t.parentNode,t),t.parentNode=e,e.childNodes.push(t),t.yogaNode&&e.yogaNode?.insertChild(t.yogaNode,e.yogaNode.getChildCount()),n(e)},L=(e,t,a)=>{t.parentNode&&u(t.parentNode,t),t.parentNode=e;const r=e.childNodes.indexOf(a);if(r===-1)e.childNodes.push(t),t.yogaNode&&e.yogaNode?.insertChild(t.yogaNode,e.yogaNode.getChildCount());else if(e.childNodes.splice(r,0,t),t.yogaNode){const i=e.childNodes.slice(0,r).filter(s=>!!s.yogaNode).length;e.yogaNode?.insertChild(t.yogaNode,i)}n(e)},u=(e,t)=>{if(t.yogaNode){const r=t.yogaNode.getParent();r&&r.removeChild(t.yogaNode)}t.parentNode=void 0;const a=e.childNodes.indexOf(t);a!==-1&&e.childNodes.splice(a,1),n(e)},w=(e,t,a)=>{if(t==="internal_accessibility"){e.internal_accessibility=a;return}e.attributes[t]=a},D=(e,t)=>{e.style=t??{}},W=e=>{const t={nodeName:"#text",nodeValue:e,parentNode:void 0,style:{},yogaNode:void 0};return k(t,e),t},_=function(e,t){const a=e.nodeName==="#text"?e.nodeValue:y(e),r=d(a);if(r.width<=t||r.width>=1&&t>0&&t<1)return r;const i=e.style?.textWrap??"wrap",s=x(a,Math.floor(t),i);return d(s)},N=e=>{if(e?.parentNode)return e.yogaNode??N(e.parentNode)},f=e=>{(e?.nodeName==="#text"||e?.nodeName==="ink-text"||e?.nodeName==="ink-virtual-text")&&N(e)?.markDirty();let t=e;for(;t;){if((t.nodeName==="ink-text"||t.nodeName==="ink-virtual-text")&&(t.internal_textCache=void 0),"childNodes"in t){if(t!==e&&t.nodeName==="ink-static-render"&&!!t.cachedRender)break;t.cachedRender=void 0}t=t.parentNode}},k=(e,t)=>{typeof t!="string"&&(t=String(t)),e.nodeValue=t,f(e)},E=(e,t)=>e.nodeName!=="ink-root"?()=>{}:(e.internal_layoutListeners??=new Set,e.internal_layoutListeners.add(t),()=>{e.internal_layoutListeners?.delete(t)}),I=e=>{if(!(e.nodeName!=="ink-root"||!e.internal_layoutListeners))for(const t of e.internal_layoutListeners)t()},P=(e,t)=>{if(e.cachedRender=t,e.yogaNode){for(e.yogaNode.setWidth(t.width),e.yogaNode.setHeight(t.height);e.yogaNode.getChildCount()>0;)e.yogaNode.removeChild(e.yogaNode.getChild(0));e.isYogaTreeDetached=!0}},B=e=>{const t=[];let a=e;for(;a;)t.unshift(a),a=a.parentNode;return t},M=e=>{let t=e;for(;t;){const{userSelect:a}=t.style;if(a==="none")return!1;if(a==="text"||a==="all")return!0;t=t.parentNode}return!0};export{E as a,L as b,b as c,A as d,I as e,W as f,B as g,D as h,M as i,w as j,P as k,f as m,u as r,k as s,x as w};
@@ -1,7 +1,6 @@
1
1
  import { Node } from 'yoga-layout';
2
2
  import { CursorShape } from "../ink/public/cursor.js";
3
- import '@visulima/colorize';
4
- import { S as Styles } from "./styles.d-CKGQFfm4.js";
3
+ import { S as Styles } from "./styles.d-BCZOPl_g.js";
5
4
  /**
6
5
  * Columnar data structure for a single line of styled terminal text.
7
6
  *
@@ -432,4 +431,4 @@ declare const getPathToRoot: (node: DOMNode) => DOMNode[];
432
431
  * Ported from jacob314/ink fork (Google LLC, Apache-2.0).
433
432
  */
434
433
  declare const isNodeSelectable: (node: DOMElement) => boolean;
435
- export { CursorAnchorRef as C, DOMElement as D, ElementNames as E, NodeNames as N, ResizeObserver as R, StickyHeader as S, TextName as T, CursorMarker as a, DOMNode as b, DOMNodeAttribute as c, TextNode as d, StyledLine as e, ResizeObserverCallback as f, ResizeObserverEntry as g, ScrollState as h, calculateScroll as i, getPathToRoot as j, getScrollHeight as k, getScrollLeft as l, getScrollTop as m, getScrollWidth as n, isNodeSelectable as o };
434
+ export { CursorAnchorRef as C, DOMElement as D, ElementNames as E, NodeNames as N, ResizeObserver as R, StyledLine as S, TextName as T, DOMNode as a, ResizeObserverCallback as b, ResizeObserverEntry as c, ScrollState as d, StickyHeader as e, calculateScroll as f, getPathToRoot as g, getScrollHeight as h, getScrollLeft as i, getScrollTop as j, getScrollWidth as k, isNodeSelectable as l, CursorMarker as m, DOMNodeAttribute as n, TextNode as o };
@@ -1 +1 @@
1
- import{createContext as e}from"react";const o=e({activate(){},activeId:void 0,add(){},deactivate(){},disableFocus(){},enableFocus(){},focus(){},focusNext(){},focusPrevious(){},remove(){}});o.displayName="InternalFocusContext";export{o};
1
+ import{createContext as e}from"react";const o=e({activate(){},activeId:void 0,add(){},deactivate(){},disableFocus(){},enableFocus(){},focus(){},focusNext(){},focusPrevious(){},remove(){}});o.displayName="InternalFocusContext";export{o as F};
@@ -0,0 +1 @@
1
+ function S(n){const t=Math.max(0,Math.floor(n/1e3)),r=Math.floor(t/3600),a=Math.floor(t%3600/60),o=t%60;return r>0?`${String(r).padStart(2,"0")}:${String(a).padStart(2,"0")}:${String(o).padStart(2,"0")}`:`${String(a).padStart(2,"0")}:${String(o).padStart(2,"0")}`}export{S as formatDuration};
@@ -0,0 +1 @@
1
+ import"./measure-text-DtlK6gar.js";import"./squashTextNodesWithMap-CUJZZeW3.js";import{a as o,d,c as r,f as i,e as N,g as m,b as l,i as c,m as h,r as n,j as p,k as u,h as y,s as L}from"./dom-xpeZzKuf.js";export{o as addLayoutListener,d as appendChildNode,r as createNode,i as createTextNode,N as emitLayoutListeners,m as getPathToRoot,l as insertBeforeNode,c as isNodeSelectable,h as markNodeAsDirty,n as removeChildNode,p as setAttribute,u as setCachedRender,y as setStyle,L as setTextNodeValue};
@@ -0,0 +1,75 @@
1
+ var lib={},types={},hasRequiredTypes;function requireTypes(){return hasRequiredTypes||(hasRequiredTypes=1,Object.defineProperty(types,"__esModule",{value:!0})),types}var ee={},taskCollection$1={},taskCollection={},utils$1={},hasRequiredUtils$1;function requireUtils$1(){if(hasRequiredUtils$1)return utils$1;hasRequiredUtils$1=1,Object.defineProperty(utils$1,"__esModule",{value:!0}),utils$1._fast_remove_single=void 0;function c(a,l){l!==-1&&(l===0?a.shift():l===a.length-1?a.length=a.length-1:a.splice(l,1))}return utils$1._fast_remove_single=c,utils$1}var bakeCollection={},hasRequiredBakeCollection;function requireBakeCollection(){return hasRequiredBakeCollection||(hasRequiredBakeCollection=1,(function(exports){Object.defineProperty(exports,"__esModule",{value:!0}),exports.bakeCollectionVariadic=exports.bakeCollectionAwait=exports.bakeCollection=exports.BAKED_EMPTY_FUNC=void 0,exports.BAKED_EMPTY_FUNC=(function(){});var FORLOOP_FALLBACK=1500;function generateArgsDefCode(c){var a="";if(c===0)return a;for(var l=0;l<c-1;++l)a+="arg"+String(l)+", ";return a+="arg"+String(c-1),a}function generateBodyPartsCode(c,a){for(var l="",u="",r=0;r<a;++r)l+="var f".concat(r," = collection[").concat(r,`];
2
+ `),u+="f".concat(r,"(").concat(c,`)
3
+ `);return{funcDefCode:l,funcCallCode:u}}function generateBodyPartsVariadicCode(c){for(var a="",l="",u=0;u<c;++u)a+="var f".concat(u," = collection[").concat(u,`];
4
+ `),l+="f".concat(u,`.apply(undefined, arguments)
5
+ `);return{funcDefCode:a,funcCallCode:l}}function bakeCollection(collection,fixedArgsNum){if(collection.length===0)return exports.BAKED_EMPTY_FUNC;if(collection.length===1)return collection[0];var funcFactoryCode;if(collection.length<FORLOOP_FALLBACK){var argsDefCode=generateArgsDefCode(fixedArgsNum),_a=generateBodyPartsCode(argsDefCode,collection.length),funcDefCode=_a.funcDefCode,funcCallCode=_a.funcCallCode;funcFactoryCode=`(function(collection) {
6
+ `.concat(funcDefCode,`
7
+ collection = undefined;
8
+ return (function(`).concat(argsDefCode,`) {
9
+ `).concat(funcCallCode,`
10
+ });
11
+ })`)}else{var argsDefCode=generateArgsDefCode(fixedArgsNum);collection.length%10===0?funcFactoryCode=`(function(collection) {
12
+ return (function(`.concat(argsDefCode,`) {
13
+ for (var i = 0; i < collection.length; i += 10) {
14
+ collection[i](`).concat(argsDefCode,`);
15
+ collection[i+1](`).concat(argsDefCode,`);
16
+ collection[i+2](`).concat(argsDefCode,`);
17
+ collection[i+3](`).concat(argsDefCode,`);
18
+ collection[i+4](`).concat(argsDefCode,`);
19
+ collection[i+5](`).concat(argsDefCode,`);
20
+ collection[i+6](`).concat(argsDefCode,`);
21
+ collection[i+7](`).concat(argsDefCode,`);
22
+ collection[i+8](`).concat(argsDefCode,`);
23
+ collection[i+9](`).concat(argsDefCode,`);
24
+ }
25
+ });
26
+ })`):collection.length%4===0?funcFactoryCode=`(function(collection) {
27
+ return (function(`.concat(argsDefCode,`) {
28
+ for (var i = 0; i < collection.length; i += 4) {
29
+ collection[i](`).concat(argsDefCode,`);
30
+ collection[i+1](`).concat(argsDefCode,`);
31
+ collection[i+2](`).concat(argsDefCode,`);
32
+ collection[i+3](`).concat(argsDefCode,`);
33
+ }
34
+ });
35
+ })`):collection.length%3===0?funcFactoryCode=`(function(collection) {
36
+ return (function(`.concat(argsDefCode,`) {
37
+ for (var i = 0; i < collection.length; i += 3) {
38
+ collection[i](`).concat(argsDefCode,`);
39
+ collection[i+1](`).concat(argsDefCode,`);
40
+ collection[i+2](`).concat(argsDefCode,`);
41
+ }
42
+ });
43
+ })`):funcFactoryCode=`(function(collection) {
44
+ return (function(`.concat(argsDefCode,`) {
45
+ for (var i = 0; i < collection.length; ++i) {
46
+ collection[i](`).concat(argsDefCode,`);
47
+ }
48
+ });
49
+ })`)}{var funcFactory=eval(funcFactoryCode);return funcFactory(collection)}}exports.bakeCollection=bakeCollection;function bakeCollectionAwait(collection,fixedArgsNum){if(collection.length===0)return exports.BAKED_EMPTY_FUNC;if(collection.length===1)return collection[0];var funcFactoryCode;if(collection.length<FORLOOP_FALLBACK){var argsDefCode=generateArgsDefCode(fixedArgsNum),_a=generateBodyPartsCode(argsDefCode,collection.length),funcDefCode=_a.funcDefCode,funcCallCode=_a.funcCallCode;funcFactoryCode=`(function(collection) {
50
+ `.concat(funcDefCode,`
51
+ collection = undefined;
52
+ return (function(`).concat(argsDefCode,`) {
53
+ return Promise.all([ `).concat(funcCallCode,` ]);
54
+ });
55
+ })`)}else{var argsDefCode=generateArgsDefCode(fixedArgsNum);funcFactoryCode=`(function(collection) {
56
+ return (function(`.concat(argsDefCode,`) {
57
+ var promises = Array(collection.length);
58
+ for (var i = 0; i < collection.length; ++i) {
59
+ promises[i] = collection[i](`).concat(argsDefCode,`);
60
+ }
61
+ return Promise.all(promises);
62
+ });
63
+ })`)}{var funcFactory=eval(funcFactoryCode);return funcFactory(collection)}}exports.bakeCollectionAwait=bakeCollectionAwait;function bakeCollectionVariadic(collection){if(collection.length===0)return exports.BAKED_EMPTY_FUNC;if(collection.length===1)return collection[0];var funcFactoryCode;if(collection.length<FORLOOP_FALLBACK){var _a=generateBodyPartsVariadicCode(collection.length),funcDefCode=_a.funcDefCode,funcCallCode=_a.funcCallCode;funcFactoryCode=`(function(collection) {
64
+ `.concat(funcDefCode,`
65
+ collection = undefined;
66
+ return (function() {
67
+ `).concat(funcCallCode,`
68
+ });
69
+ })`)}else funcFactoryCode=`(function(collection) {
70
+ return (function() {
71
+ for (var i = 0; i < collection.length; ++i) {
72
+ collection[i].apply(undefined, arguments);
73
+ }
74
+ });
75
+ })`;{var funcFactory=eval(funcFactoryCode);return funcFactory(collection)}}exports.bakeCollectionVariadic=bakeCollectionVariadic})(bakeCollection)),bakeCollection}var hasRequiredTaskCollection$1;function requireTaskCollection$1(){if(hasRequiredTaskCollection$1)return taskCollection;hasRequiredTaskCollection$1=1;var c=taskCollection&&taskCollection.__spreadArray||function(o,g,e){if(e||arguments.length===2)for(var t=0,n=g.length,i;t<n;t++)(i||!(t in g))&&(i||(i=Array.prototype.slice.call(g,0,t)),i[t]=g[t]);return o.concat(i||Array.prototype.slice.call(g))};Object.defineProperty(taskCollection,"__esModule",{value:!0}),taskCollection.TaskCollection=void 0;var a=requireUtils$1(),l=requireBakeCollection();function u(o,g){var e=this.length;if(e>1)if(g){var t;(t=this._tasks).push.apply(t,arguments),this.length+=arguments.length}else this._tasks.push(o),this.length++;else if(g){if(e===1){var n=Array(1+arguments.length);n.push(n),n.push.apply(n,arguments),this._tasks=n}else{var n=Array(arguments.length);n.push.apply(n,arguments),this._tasks=n}this.length+=arguments.length}else e===1?this._tasks=[this._tasks,o]:this._tasks=o,this.length++}function r(o,g){var e=this.length;if(e>1)if(g){var t;(t=this._tasks).push.apply(t,arguments),this.length+=arguments.length}else this._tasks.push(o),this.length++;else if(g){if(e===1){var n=Array(1+arguments.length);n.push(n),n.push.apply(n,arguments),this._tasks=n}else{var n=Array(arguments.length);n.push.apply(n,arguments),this._tasks=n}this.length+=arguments.length}else e===1?this._tasks=[this._tasks,o]:this._tasks=o,this.length++;this.firstEmitBuildStrategy?this.call=b:this.rebuild()}function f(o){this.length!==0&&(this.length===1?this._tasks===o&&(this.length=0):((0,a._fast_remove_single)(this._tasks,this._tasks.lastIndexOf(o)),this._tasks.length===1?(this._tasks=this._tasks[0],this.length=1):this.length=this._tasks.length))}function s(o){if(this.length!==0){if(this.length===1)if(this._tasks===o&&(this.length=0),this.firstEmitBuildStrategy){this.call=l.BAKED_EMPTY_FUNC;return}else{this.rebuild();return}else(0,a._fast_remove_single)(this._tasks,this._tasks.lastIndexOf(o)),this._tasks.length===1?(this._tasks=this._tasks[0],this.length=1):this.length=this._tasks.length;this.firstEmitBuildStrategy?this.call=b:this.rebuild()}}function _(o){for(var g,e=[],t=1;t<arguments.length;t++)e[t-1]=arguments[t];this.length===0?(this._tasks=e,this.length=1):this.length===1?(e.unshift(this._tasks),this._tasks=e,this.length=this._tasks.length):((g=this._tasks).splice.apply(g,c([o,0],e,!1)),this.length=this._tasks.length)}function E(o){for(var g,e=[],t=1;t<arguments.length;t++)e[t-1]=arguments[t];this.length===0?(this._tasks=e,this.length=1):this.length===1?(e.unshift(this._tasks),this._tasks=e,this.length=this._tasks.length):((g=this._tasks).splice.apply(g,c([o,0],e,!1)),this.length=this._tasks.length),this.firstEmitBuildStrategy?this.call=b:this.rebuild()}function A(){this.length===0?this.call=l.BAKED_EMPTY_FUNC:this.length===1?this.call=this._tasks:this.call=(0,l.bakeCollection)(this._tasks,this.argsNum)}function O(){this.length===0?this.call=l.BAKED_EMPTY_FUNC:this.length===1?this.call=this._tasks:this.call=(0,l.bakeCollectionAwait)(this._tasks,this.argsNum)}function b(){this.rebuild(),this.call.apply(void 0,arguments)}var C=(function(){function o(g,e,t,n){e===void 0&&(e=!0),t===void 0&&(t=null),n===void 0&&(n=!1),this.awaitTasks=n,this.call=l.BAKED_EMPTY_FUNC,this.argsNum=g,this.firstEmitBuildStrategy=!0,n?this.rebuild=O.bind(this):this.rebuild=A.bind(this),this.setAutoRebuild(e),t?typeof t=="function"?(this._tasks=t,this.length=1):(this._tasks=t,this.length=t.length):(this._tasks=null,this.length=0),e&&this.rebuild()}return o})();taskCollection.TaskCollection=C;function F(){this._tasks=null,this.length=0,this.call=l.BAKED_EMPTY_FUNC}function q(){this._tasks=null,this.length=0,this.call=l.BAKED_EMPTY_FUNC}function B(o){this.argsNum<o&&(this.argsNum=o,this.firstEmitBuildStrategy?this.call=b:this.rebuild())}function D(o){o?(this.push=r.bind(this),this.insert=E.bind(this),this.removeLast=s.bind(this)):(this.push=u.bind(this),this.insert=_.bind(this),this.removeLast=f.bind(this))}function P(){return this.length===0?[]:this.length===1?[this._tasks]:this._tasks}function j(o){o.length===0?(this.length=0,this.call=l.BAKED_EMPTY_FUNC):o.length===1?(this.length=1,this.call=o[0],this._tasks=o[0]):(this.length=o.length,this._tasks=o,this.firstEmitBuildStrategy?this.call=b:this.rebuild())}return C.prototype.fastClear=F,C.prototype.clear=q,C.prototype.growArgsNum=B,C.prototype.setAutoRebuild=D,C.prototype.tasksAsArray=P,C.prototype.setTasks=j,taskCollection}var hasRequiredTaskCollection;function requireTaskCollection(){return hasRequiredTaskCollection||(hasRequiredTaskCollection=1,(function(c){var a=taskCollection$1&&taskCollection$1.__createBinding||(Object.create?(function(u,r,f,s){s===void 0&&(s=f);var _=Object.getOwnPropertyDescriptor(r,f);(!_||("get"in _?!r.__esModule:_.writable||_.configurable))&&(_={enumerable:!0,get:function(){return r[f]}}),Object.defineProperty(u,s,_)}):(function(u,r,f,s){s===void 0&&(s=f),u[s]=r[f]})),l=taskCollection$1&&taskCollection$1.__exportStar||function(u,r){for(var f in u)f!=="default"&&!Object.prototype.hasOwnProperty.call(r,f)&&a(r,u,f)};Object.defineProperty(c,"__esModule",{value:!0}),l(requireTaskCollection$1(),c)})(taskCollection$1)),taskCollection$1}var utils={},hasRequiredUtils;function requireUtils(){if(hasRequiredUtils)return utils;hasRequiredUtils=1,Object.defineProperty(utils,"__esModule",{value:!0}),utils.nullObj=void 0;function c(){var a={};return a.__proto__=null,a}return utils.nullObj=c,utils}var hasRequiredEe;function requireEe(){if(hasRequiredEe)return ee;hasRequiredEe=1;var c=ee&&ee.__spreadArray||function(e,t,n){if(n||arguments.length===2)for(var i=0,d=t.length,y;i<d;i++)(y||!(i in t))&&(y||(y=Array.prototype.slice.call(t,0,i)),y[i]=t[i]);return e.concat(y||Array.prototype.slice.call(t))};Object.defineProperty(ee,"__esModule",{value:!0}),ee.EventEmitter=void 0;var a=requireTaskCollection(),l=requireUtils$1(),u=requireUtils();function r(e,t,n,i,d,y){var p=this.events[e];if(p){if(p.length===0)return!1;if(p.argsNum<6)p.call(t,n,i,d,y);else{for(var v=new Array(p.argsNum),h=0,m=v.length;h<m;++h)v[h]=arguments[h+1];p.call.apply(void 0,v)}return!0}return!1}function f(e,t,n,i,d,y){var p=this.events[e],v;if(p!==void 0){if(p.length===0)return!1;if(p.argsNum<6)p.call(t,n,i,d,y);else{v=new Array(p.argsNum);for(var h=0,m=v.length;h<m;++h)v[h]=arguments[h+1];p.call.apply(void 0,v)}}var k=this.onceEvents[e];if(k){if(typeof k=="function")if(this.onceEvents[e]=void 0,arguments.length<6)k(t,n,i,d,y);else{if(v===void 0){v=new Array(arguments.length-1);for(var h=0,m=v.length;h<m;++h)v[h]=arguments[h+1]}k.apply(void 0,v)}else{var L=k;if(this.onceEvents[e]=void 0,arguments.length<6)for(var h=0;h<L.length;++h)L[h](t,n,i,d,y);else{if(v===void 0){v=new Array(arguments.length-1);for(var h=0,m=v.length;h<m;++h)v[h]=arguments[h+1]}for(var h=0;h<L.length;++h)L[h].apply(void 0,v)}}return!0}return p!==void 0}var s=(function(){function e(){this.events=(0,u.nullObj)(),this.onceEvents=(0,u.nullObj)(),this._symbolKeys=new Set,this.maxListeners=1/0}return Object.defineProperty(e.prototype,"_eventsCount",{get:function(){return this.eventNames().length},enumerable:!1,configurable:!0}),e})();ee.EventEmitter=s;function _(e,t){switch(this.emit===r&&(this.emit=f),typeof this.onceEvents[e]){case"undefined":this.onceEvents[e]=t,typeof e=="symbol"&&this._symbolKeys.add(e);break;case"function":this.onceEvents[e]=[this.onceEvents[e],t];break;case"object":this.onceEvents[e].push(t)}return this}function E(e,t,n){if(n===void 0&&(n=t.length),typeof t!="function")throw new TypeError("The listener must be a function");var i=this.events[e];return i?(i.push(t),i.growArgsNum(n),this.maxListeners!==1/0&&this.maxListeners<=i.length&&console.warn('Maximum event listeners for "'.concat(String(e),'" event!'))):(this.events[e]=new a.TaskCollection(n,!0,t,!1),typeof e=="symbol"&&this._symbolKeys.add(e)),this}function A(e,t){var n=this.events[e];n&&n.removeLast(t);var i=this.onceEvents[e];return i&&(typeof i=="function"?this.onceEvents[e]=void 0:typeof i=="object"&&(i.length===1&&i[0]===t?this.onceEvents[e]=void 0:(0,l._fast_remove_single)(i,i.lastIndexOf(t)))),this}function O(e,t,n,i){n===void 0&&(n=this),i===void 0&&(i=t.length),this.boundFuncs||(this.boundFuncs=new Map);var d=t.bind(n);return this.boundFuncs.set(t,d),this.addListener(e,d,i)}function b(e,t){var n,i,d=(n=this.boundFuncs)===null||n===void 0?void 0:n.get(t);return(i=this.boundFuncs)===null||i===void 0||i.delete(t),this.removeListener(e,d)}function C(e){return this.events[e]&&!!this.events[e].length}function F(e,t,n){if(n===void 0&&(n=t.length),typeof t!="function")throw new TypeError("The listener must be a function");var i=this.events[e];return!i||!(i instanceof a.TaskCollection)?(i=this.events[e]=new a.TaskCollection(n,!0,t,!1),typeof e=="symbol"&&this._symbolKeys.add(e)):(i.insert(0,t),i.growArgsNum(n),this.maxListeners!==1/0&&this.maxListeners<=i.length&&console.warn('Maximum event listeners for "'.concat(String(e),'" event!'))),this}function q(e,t){this.emit===r&&(this.emit=f);var n=this.onceEvents[e];return n?typeof n!="object"?(this.onceEvents[e]=[t,n],typeof e=="symbol"&&this._symbolKeys.add(e)):(n.unshift(t),this.maxListeners!==1/0&&this.maxListeners<=n.length&&console.warn('Maximum event listeners for "'.concat(String(e),'" once event!'))):(this.onceEvents[e]=[t],typeof e=="symbol"&&this._symbolKeys.add(e)),this}function B(e){return e===void 0?(this.events=(0,u.nullObj)(),this.onceEvents=(0,u.nullObj)(),this._symbolKeys=new Set):(this.events[e]=void 0,this.onceEvents[e]=void 0,typeof e=="symbol"&&this._symbolKeys.delete(e)),this}function D(e){return this.maxListeners=e,this}function P(){return this.maxListeners}function j(e){return this.emit===r?this.events[e]?this.events[e].tasksAsArray().slice():[]:this.events[e]&&this.onceEvents[e]?c(c([],this.events[e].tasksAsArray(),!0),typeof this.onceEvents[e]=="function"?[this.onceEvents[e]]:this.onceEvents[e],!0):this.events[e]?this.events[e].tasksAsArray():this.onceEvents[e]?typeof this.onceEvents[e]=="function"?[this.onceEvents[e]]:this.onceEvents[e]:[]}function o(){var e=this;if(this.emit===r){var t=Object.keys(this.events);return c(c([],t,!0),Array.from(this._symbolKeys),!0).filter(function(i){return i in e.events&&e.events[i]&&e.events[i].length})}else{var t=Object.keys(this.events).filter(function(d){return e.events[d]&&e.events[d].length}),n=Object.keys(this.onceEvents).filter(function(d){return e.onceEvents[d]&&e.onceEvents[d].length});return c(c(c([],t,!0),n,!0),Array.from(this._symbolKeys).filter(function(d){return d in e.events&&e.events[d]&&e.events[d].length||d in e.onceEvents&&e.onceEvents[d]&&e.onceEvents[d].length}),!0)}}function g(e){return this.emit===r?this.events[e]&&this.events[e].length||0:(this.events[e]&&this.events[e].length||0)+(this.onceEvents[e]&&this.onceEvents[e].length||0)}return s.prototype.emit=r,s.prototype.on=E,s.prototype.once=_,s.prototype.addListener=E,s.prototype.removeListener=A,s.prototype.addListenerBound=O,s.prototype.removeListenerBound=b,s.prototype.hasListeners=C,s.prototype.prependListener=F,s.prototype.prependOnceListener=q,s.prototype.off=A,s.prototype.removeAllListeners=B,s.prototype.setMaxListeners=D,s.prototype.getMaxListeners=P,s.prototype.listeners=j,s.prototype.eventNames=o,s.prototype.listenerCount=g,ee}var hasRequiredLib;function requireLib(){return hasRequiredLib||(hasRequiredLib=1,(function(c){var a=lib&&lib.__createBinding||(Object.create?(function(u,r,f,s){s===void 0&&(s=f);var _=Object.getOwnPropertyDescriptor(r,f);(!_||("get"in _?!r.__esModule:_.writable||_.configurable))&&(_={enumerable:!0,get:function(){return r[f]}}),Object.defineProperty(u,s,_)}):(function(u,r,f,s){s===void 0&&(s=f),u[s]=r[f]})),l=lib&&lib.__exportStar||function(u,r){for(var f in u)f!=="default"&&!Object.prototype.hasOwnProperty.call(r,f)&&a(r,u,f)};Object.defineProperty(c,"__esModule",{value:!0}),l(requireTypes(),c),l(requireEe(),c)})(lib)),lib}var libExports=requireLib();export{libExports as l};
@@ -0,0 +1 @@
1
+ const c=({element:t,mouse:{x:s,y:i}})=>{const o=s<t.left||s>=t.left+t.width,r=i<t.top||i>=t.top+t.height;return!o&&!r};export{c as default};
@@ -0,0 +1 @@
1
+ const u=t=>{const r=/rgb:([\da-f]{2,4})\/([\da-f]{2,4})\/([\da-f]{2,4})/i.exec(t);if(!r)return null;const o=n=>n.length<=2?n.padStart(2,"0"):n.slice(0,2);return`#${o(r[1])}${o(r[2])}${o(r[3])}`},S=()=>{const t=process.env.TERM_PROGRAM??"";return new Set(["Alacritty","contour","foot","Ghostty","iTerm2","iTerm.app","kitty","rio","WezTerm"]).has(t)?!0:(process.env.TERM??"").startsWith("xterm")||!!process.env.WT_SESSION};const f=(t,r,o,n=500)=>new Promise(a=>{let s="",i;const c=()=>{i&&clearTimeout(i),t.removeListener("data",e)},e=l=>{if(s+=l.toString(),s.length>256){c(),a(null);return}(s.includes("\x07")||s.includes("\x1B\\"))&&(c(),a(s))};i=setTimeout(()=>{c(),a(null)},n),t.on("data",e),r.write(o)}),E=async(t,r,o=500)=>{const n={},a=await f(t,r,"\x1B]10;?\x07",o);if(a){const e=u(a);e&&(n.foreground=e)}const s=await f(t,r,"\x1B]11;?\x07",o);if(s){const e=u(s);e&&(n.background=e)}const i=await f(t,r,"\x1B]12;?\x07",o);if(i){const e=u(i);e&&(n.cursor=e)}const c=[];for(let e=0;e<16;e++){const l=await f(t,r,`\x1B]4;${e};?\x07`,o);if(l){const p=u(l);c.push(p??"")}else c.push("")}return c.some(e=>e.length>0)&&(n.colors=c),n};export{S as isTerminalPaletteQuerySupported,E as queryTerminalPalette};
@@ -0,0 +1 @@
1
+ const r={disambiguateEscapeCodes:1,reportAllKeysAsEscapeCodes:8,reportAlternateKeys:4,reportAssociatedText:16,reportEventTypes:2};function o(t){let e=0;for(const s of t)e|=r[s];return e}const a={alt:2,capsLock:64,ctrl:4,hyper:16,meta:32,numLock:128,shift:1,super:8};export{r as kittyFlags,a as kittyModifiers,o as resolveFlags};
@@ -0,0 +1 @@
1
+ import{createRequire as l}from"node:module";let _;const f=e=>(_??=l(import.meta.url))(e),t=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,i=e=>{if(typeof t<"u"&&t.versions&&t.versions.node){const[o,s]=t.versions.node.split(".").map(Number);if(o>22||o===22&&s>=3||o===20&&s>=16)return t.getBuiltinModule(e)}return f(e)},{existsSync:a}=i("node:fs"),{createRequire:p}=i("node:module"),{dirname:u,join:r}=i("node:path"),{fileURLToPath:j}=i("node:url"),g=12,h=e=>{const o=p(e),s=u(j(e));let n=s;for(let c=0;c<g;c+=1){if(a(r(n,"package.json"))&&a(r(n,"index.js")))return o(r(n,"index.js"));const d=u(n);if(d===n)break;n=d}return o(r(s,"..","index.js"))};export{h as l};
@@ -0,0 +1 @@
1
+ import l from"yoga-layout";import{getScrollTop as I,getScrollLeft as R}from"./calculateScroll-jdxVlcmq.js";import Y from"./squashTextNodesWithMap-CUJZZeW3.js";const w=t=>{let o=t,e=0,i=0;for(;o?.parentNode;){if(!o.yogaNode)return;e+=o.yogaNode.getComputedLeft(),i+=o.yogaNode.getComputedTop(),o=o.parentNode}return{x:e,y:i}},X=t=>w(t),A=t=>{const o=w(t);if(!(!o||!t.yogaNode))return{x:o.x+t.yogaNode.getComputedBorder(l.EDGE_LEFT)+t.yogaNode.getComputedPadding(l.EDGE_LEFT),y:o.y+t.yogaNode.getComputedBorder(l.EDGE_TOP)+t.yogaNode.getComputedPadding(l.EDGE_TOP)}},z=t=>{const o=X(t);return{height:Math.round(t.yogaNode?.getComputedHeight()??0),width:Math.round(t.yogaNode?.getComputedWidth()??0),x:Math.round(o?.x??0),y:Math.round(o?.y??0)}},U=t=>{const{yogaNode:o}=t;if(!o)return 0;const e=o.getComputedWidth()??0,i=o.getComputedBorder(l.EDGE_LEFT),s=o.getComputedBorder(l.EDGE_RIGHT);return Math.round(e-i-s)},j=t=>{const{yogaNode:o}=t;if(!o)return 0;const e=o.getComputedHeight()??0,i=o.getComputedBorder(l.EDGE_TOP),s=o.getComputedBorder(l.EDGE_BOTTOM);return Math.round(e-i-s)},M=t=>{const{yogaNode:o}=t;if(!o)return{height:0,width:0,x:0,y:0};const e=o.getComputedWidth()??0,i=o.getComputedHeight()??0;let s=o.getComputedLeft(),r=o.getComputedTop(),n=t.parentNode;for(;n?.yogaNode;){if(s+=n.yogaNode.getComputedLeft(),r+=n.yogaNode.getComputedTop(),n.nodeName==="ink-box"){const a=n.style.overflow??"visible",d=n.style.overflowX??a;(n.style.overflowY??a)==="scroll"&&(r-=I(n)),d==="scroll"&&(s-=R(n))}n=n.parentNode}return{height:Math.round(i),width:Math.round(e),x:Math.round(s),y:Math.round(r)}},q=t=>{const o=t.internal_scrollState?.scrollHeight??0,e=t.internal_scrollState?.actualScrollHeight??0;return Math.max(0,o-e)},B=t=>{const{axis:o,clientDimension:e,scrollbarDimension:i,scrollDimension:s,scrollPosition:r}=t,n=i*2,a=Math.max(o==="vertical"?2:1,Math.round(e/s*n)),d=s-e,g=n-a,c=d>0?Math.round(r/d*g):0,h=c,u=c+a,f=Math.floor(h/2);return{endIndex:Math.min(i,Math.ceil(u/2)),startIndex:f,thumbEndHalf:u,thumbStartHalf:h}},S=t=>{const{axis:o,clientDimension:e,hasOppositeScrollbar:i,height:s,marginBottom:r,marginRight:n,scrollDimension:a,scrollPosition:d,width:g,x:c,y:h}=t;if(a<=e)return;if(o==="vertical"){const{endIndex:v,startIndex:x,thumbEndHalf:N,thumbStartHalf:T}=B({axis:o,clientDimension:e,scrollbarDimension:s,scrollDimension:a,scrollPosition:d}),y=c+g-1-n;return{height:s,thumb:{end:v,endHalf:N,height:v-x,start:x,startHalf:T,width:1,x:y,y:h+x},width:1,x:y,y:h}}const u=g-(i?1:0),{endIndex:f,startIndex:m,thumbEndHalf:C,thumbStartHalf:p}=B({axis:o,clientDimension:e,scrollbarDimension:u,scrollDimension:a,scrollPosition:d}),b=h+s-1-r;return{height:1,thumb:{end:f,endHalf:C,height:1,start:m,startHalf:p,width:f-m,x:c+m,y:b},width:u,x:c,y:b}},J=(t,o)=>{const{yogaNode:e}=t;if(!e)return;const i=t.style.overflow??"visible";if((t.style.overflowY??i)!=="scroll")return;const r=t.internal_scrollState?.clientHeight??0,n=t.internal_scrollState?.scrollHeight??0;if(n<=r)return;const{x:a,y:d}=o??M(t),g=e.getComputedHeight()-e.getComputedBorder(l.EDGE_TOP)-e.getComputedBorder(l.EDGE_BOTTOM);return S({axis:"vertical",clientDimension:r,hasOppositeScrollbar:!1,height:g,marginBottom:e.getComputedBorder(l.EDGE_BOTTOM),marginRight:e.getComputedBorder(l.EDGE_RIGHT),scrollDimension:n,scrollPosition:t.internal_scrollState?.scrollTop??0,width:e.getComputedWidth()-e.getComputedBorder(l.EDGE_LEFT),x:a+e.getComputedBorder(l.EDGE_LEFT),y:d+e.getComputedBorder(l.EDGE_TOP)})},K=(t,o)=>{const{yogaNode:e}=t;if(!e)return;const i=t.style.overflow??"visible";if((t.style.overflowX??i)!=="scroll")return;const r=t.internal_scrollState?.clientWidth??0,n=t.internal_scrollState?.scrollWidth??0;if(n<=r)return;const{x:a,y:d}=o??M(t),g=t.style.overflowY??i,c=t.internal_scrollState?.clientHeight??0,h=t.internal_scrollState?.scrollHeight??0,u=g==="scroll"&&h>c;return S({axis:"horizontal",clientDimension:r,hasOppositeScrollbar:u,height:e.getComputedHeight()-e.getComputedBorder(l.EDGE_TOP),marginBottom:e.getComputedBorder(l.EDGE_BOTTOM),marginRight:e.getComputedBorder(l.EDGE_RIGHT),scrollDimension:n,scrollPosition:t.internal_scrollState?.scrollLeft??0,width:e.getComputedWidth()-e.getComputedBorder(l.EDGE_LEFT)-e.getComputedBorder(l.EDGE_RIGHT),x:a+e.getComputedBorder(l.EDGE_LEFT),y:d+e.getComputedBorder(l.EDGE_TOP)})},Q=(t,o)=>{if(!t.yogaNode||t===o)return 0;let e=t.yogaNode.getComputedTop(),i=t.parentNode;for(;i&&i!==o;)i.yogaNode&&(e+=i.yogaNode.getComputedTop()),i=i.parentNode;if(!(o!==void 0&&i!==o))return Math.round(e)},Z=(t,o)=>{if(!t.yogaNode||t===o)return 0;let e=t.yogaNode.getComputedLeft(),i=t.parentNode;for(;i&&i!==o;)i.yogaNode&&(e+=i.yogaNode.getComputedLeft()),i=i.parentNode;if(!(o!==void 0&&i!==o))return Math.round(e)},W=t=>t.nodeName==="#text"?t.nodeValue:t.nodeName==="ink-text"||t.nodeName==="ink-virtual-text"?Y(t):"",$=t=>{const o=[],e=(r,n,a)=>{const{visualX:d,visualY:g,x:c,y:h}=n;let u=0,f=0,m=a;const{userSelect:C}=r.style;if(C==="none"?m=!1:(C==="text"||C==="all")&&(m=!0),r.nodeName==="ink-text"||r.nodeName==="ink-virtual-text"){if(m){const p=W(r);return o.push({height:Math.round(r.yogaNode?.getComputedHeight()??0),node:r,text:p,visualX:Math.round(d),visualY:Math.round(g),width:Math.round(r.yogaNode?.getComputedWidth()??0),x:Math.round(c),y:Math.round(h)}),{h:0,hasContent:!0,v:0}}return{h:r.yogaNode?.getComputedWidth()??0,hasContent:!1,v:r.yogaNode?.getComputedHeight()??0}}if(r.nodeName==="ink-box"||r.nodeName==="ink-root"){if(!r.yogaNode||r.yogaNode.getDisplay()===l.DISPLAY_NONE)return{h:0,hasContent:!1,v:0};const p=r.yogaNode.getComputedBorder(l.EDGE_TOP),b=r.yogaNode.getComputedBorder(l.EDGE_BOTTOM),v=r.yogaNode.getComputedBorder(l.EDGE_LEFT),x=r.yogaNode.getComputedBorder(l.EDGE_RIGHT);u+=p+b,f+=v+x;const N=r.yogaNode.getFlexDirection(),T=N===l.FLEX_DIRECTION_COLUMN||N===l.FLEX_DIRECTION_COLUMN_REVERSE;let y=0,D=0,_=!1;for(const E of r.childNodes)if(E.yogaNode){const G=c+E.yogaNode.getComputedLeft()-v-y,L=h+E.yogaNode.getComputedTop()-p-D,O=d+E.yogaNode.getComputedLeft(),P=g+E.yogaNode.getComputedTop(),H=e(E,{visualX:O,visualY:P,x:G,y:L},m);H.hasContent&&(_=!0),T?D+=H.v:y+=H.h}return T?u+=D:f+=y,{h:f,hasContent:_,v:u}}return{h:0,hasContent:!1,v:0}},{h:i,v:s}=e(t,{visualX:0,visualY:0,x:0,y:0},!0);return o.sort((r,n)=>r.y!==n.y?r.y-n.y:r.x-n.x),{fragments:o,removedHorizontal:Math.round(i),removedVertical:Math.round(s)}};export{B as a,$ as b,S as c,M as d,K as e,j as f,q as g,U as h,Z as i,Q as j,W as k,J as l,z as m,A as n};
@@ -0,0 +1,3 @@
1
+ import{isFullwidthCodePoint as j,getStringWidth as J}from"@visulima/string";import{t as Z}from"./ansi-tokenizer-D5k5LzXg.js";class N{map;maxDataSize;maxKeys;currentDataSize=0;constructor(t,e){this.map=new Map,this.maxKeys=t,this.maxDataSize=e}get size(){return this.map.size}clear(){this.map.clear(),this.currentDataSize=0}get(t){if(!this.map.has(t))return;const e=this.map.get(t);return this.map.delete(t),this.map.set(t,e),e}set(t,e){const s=t.length;if(s>this.maxDataSize)return;for(this.map.has(t)&&(this.map.delete(t),this.currentDataSize-=s);this.currentDataSize+s>this.maxDataSize&&this.map.size>0;){const n=this.map.keys().next().value;if(n===void 0)break;this.map.delete(n),this.currentDataSize-=n.length}for(;this.map.size>=this.maxKeys;){const n=this.map.keys().next().value;if(n===void 0)break;this.map.delete(n),this.currentDataSize-=n.length}this.map.set(t,e),this.currentDataSize+=s}}const q=1,Q=2,K=4,R=8,B=16,L=32,P=64,D=128,d=1073741823,C=1073741824;class m{length=0;static emptyCache=new Map;text;charData;spans;_cachedTrimmedLength;static empty(t){if(t<=0)return new m;const e=m.emptyCache.get(t);if(e)return e.clone();const s=new m;s.length=t,s.text=" ".repeat(t),s.charData=Array.from({length:t});for(let a=0;a<t;a++)s.charData[a]=a;return s.spans=[{formatFlags:0,length:t}],s._cachedTrimmedLength=0,Object.freeze(s.spans[0]),Object.freeze(s.spans),Object.freeze(s),m.emptyCache.set(t,s),s.clone()}getValue(t){if(this.text===void 0||t<0||t>=this.length)return"";const e=this.charData[t]&d,s=t+1<this.length?this.charData[t+1]&d:this.text.length;return this.text.slice(e,s)}getTextRange(t,e){if(this.text===void 0||t<0||e>this.length||t>=e)return"";const s=this.charData[t]&d,a=e<this.length?this.charData[e]&d:this.text.length;return this.text.slice(s,a)}getSpan(t){if(this.spans===void 0||t<0||t>=this.length)return;let e=0;for(const s of this.spans){if(t<e+s.length)return s;e+=s.length}}getFullWidth(t){return this.charData===void 0||t<0||t>=this.length?!1:(this.charData[t]&C)!==0}hasStyles(t){const e=this.getSpan(t);return e?(e.formatFlags&~D)!==0||e.fgColor!==void 0||e.bgColor!==void 0||e.link!==void 0:!1}getFormatFlags(t){let e=this.getSpan(t)?.formatFlags??0;return this.getFullWidth(t)&&(e|=D),e}getFgColor(t){return this.getSpan(t)?.fgColor}getBgColor(t){return this.getSpan(t)?.bgColor}getLink(t){return this.getSpan(t)?.link}setInverted(t,e){this._cachedTrimmedLength=void 0,this.updateSpanAt(t,s=>{e?s.formatFlags|=L:s.formatFlags&=~L})}setBackgroundColor(t,e){this._cachedTrimmedLength=void 0,this.updateSpanAt(t,s=>{s.bgColor=e})}setForegroundColor(t,e){this._cachedTrimmedLength=void 0,this.updateSpanAt(t,s=>{s.fgColor=e})}setChar(t,e,s,a,n,i){if(t<0||t>=this.length)return;this._cachedTrimmedLength=void 0,this.ensureInitialized();const c=(s&D)!==0,h=s&~D,l=this.charData[t]&d,o=t+1<this.length?this.charData[t+1]&d:this.text.length,g=o-l,S=e.length;if(this.text=this.text.slice(0,l)+e+this.text.slice(o),g!==S){const u=S-g;for(let b=t+1;b<this.length;b++){const k=this.charData[b],w=k&d,A=k&C;this.charData[b]=w+u|A}}if(this.charData[t]=l|(c?C:0),this.trySetStyleAtIndex(t,h,a,n,i))return;this.splitSpansAt(t),this.splitSpansAt(t+1);let p=0;for(let u=0;u<this.spans.length;u++){const b=this.spans[u];if(p===t&&b.length===1){this.spans[u]={bgColor:n,fgColor:a,formatFlags:h,length:1,link:i};break}p+=b.length}this.mergeSpans()}setCharFast(t,e,s,a,n,i){if(t<0||t>=this.length)return;this._cachedTrimmedLength=void 0,this.ensureInitialized();const c=(s&D)!==0,h=s&~D,l=this.charData[t]&d,o=t+1<this.length?this.charData[t+1]&d:this.text.length,g=o-l;if(e.length===g)e!==this.text.slice(l,o)&&(this.text=this.text.slice(0,l)+e+this.text.slice(o)),this.charData[t]=l|(c?C:0);else{if(this.text=this.text.slice(0,l)+e+this.text.slice(o),g!==e.length){const p=e.length-g;for(let u=t+1;u<this.length;u++){const b=this.charData[u];this.charData[u]=(b&d)+p|b&C}}this.charData[t]=l|(c?C:0)}if(this.trySetStyleAtIndex(t,h,a,n,i))return;this.splitSpansAt(t),this.splitSpansAt(t+1);let S=0;for(let p=0;p<this.spans.length;p++){const u=this.spans[p];if(S===t&&u.length===1){this.spans[p]={bgColor:n,fgColor:a,formatFlags:h,length:1,link:i};break}S+=u.length}this.mergeSpans()}writeFrom(t,e,s=0,a){const n=a??e.length-s;if(n<=0||t>=this.length)return;this._cachedTrimmedLength=void 0,this.ensureInitialized();const i=Math.min(n,this.length-t,e.length-s),c=this.charData[t]&d,h=t+i<this.length?this.charData[t+i]&d:this.text.length;let l="";for(let f=0;f<i;f++)l+=e.getValue(s+f);const o=h-c,g=l.length-o;this.text=this.text.slice(0,c)+l+this.text.slice(h);let S=c;for(let f=0;f<i;f++){const v=e.getFullWidth(s+f);this.charData[t+f]=S|(v?C:0),S+=e.getValue(s+f).length}if(g!==0)for(let f=t+i;f<this.length;f++){const v=this.charData[f];this.charData[f]=(v&d)+g|v&C}this.splitSpansAt(t),this.splitSpansAt(t+i);const p=[];let u=0;for(const f of e.getSpans()){const v=u+f.length,O=Math.max(s,u),W=Math.min(s+i,v);if(O<W&&p.push({...f,length:W-O}),u=v,u>=s+i)break}let b=0,k=0;for(let f=0;f<this.spans.length;f++){if(k===t){b=f;break}k+=this.spans[f].length}let w=0,A=0;for(let f=b;f<this.spans.length&&A<i;f++)A+=this.spans[f].length,w++;this.spans.splice(b,w,...p),this.mergeSpans()}pushChar(t,e,s,a,n){this._cachedTrimmedLength=void 0,this.ensureInitialized();const i=(e&D)!==0,c=e&~D,h=this.text.length;this.text=(this.text??"")+t,this.charData.push(h|(i?C:0));const l=this.spans.at(-1);l?.formatFlags===c&&l.fgColor===s&&l.bgColor===a&&l.link===n?l.length++:this.spans.push({bgColor:a,fgColor:s,formatFlags:c,length:1,link:n}),this.length++}clone(){if(this.charData===void 0)return new m;const t=new m;return t.length=this.length,t.text=this.text,t.charData=[...this.charData],t.spans=this.spans.map(e=>({...e})),t._cachedTrimmedLength=this._cachedTrimmedLength,t}slice(t,e){if(this.charData===void 0)return new m;const s=Math.max(0,t),a=e===void 0?this.length:Math.min(this.length,e);if(s>=a)return new m;if(s===0&&a===this.length)return this.clone();const n=new m;n.length=a-s,n.charData=Array.from({length:n.length});const i=this.charData[s]&d,c=a<this.length?this.charData[a]&d:this.text.length;n.text=this.text.slice(i,c);for(let o=0;o<n.length;o++){const g=this.charData[s+o],S=g&d,p=g&C;n.charData[o]=S-i|p}const h=[];let l=0;for(const o of this.spans){const g=l,S=l+o.length,p=Math.max(s,g),u=Math.min(a,S);if(p<u&&h.push({...o,length:u-p}),l+=o.length,l>=a)break}return n.spans=h,n.mergeSpans(),n}combine(...t){if(t.length===0)return this.clone();const e=[this,...t].filter(c=>c.length>0);if(e.length===0)return new m;if(e.length===1)return e[0].clone();let s=0;for(const c of e)s+=c.length;const a=new m;a.length=s,a.text=e.map(c=>c.getText()).join(""),a.charData=Array.from({length:s});let n=0,i=0;for(const c of e){const h=c.charData,l=c.getText();if(h)for(let o=0;o<c.length;o++){const g=h[o],S=g&d,p=g&C;a.charData[n+o]=i+S|p}else for(let o=0;o<c.length;o++)a.charData[n+o]=i+o;n+=c.length,i+=l.length}return a.spans=e.flatMap(c=>c.getSpans().map(h=>({...h}))),a.mergeSpans(),a}getTrimmedLength(){if(this._cachedTrimmedLength!==void 0)return this._cachedTrimmedLength;if(this.length===0)return this._cachedTrimmedLength=0,0;if(this.text===void 0||this.charData===void 0)return this._cachedTrimmedLength=0,0;let t=this.length-1;if(this.spans)for(let e=this.spans.length-1;e>=0;e--){const s=this.spans[e];if((s.formatFlags&~D)!==0||s.fgColor!==void 0||s.bgColor!==void 0||s.link!==void 0)return this._cachedTrimmedLength=t+1,this._cachedTrimmedLength;for(let n=0;n<s.length;n++){const i=this.charData[t]&d;if((t+1<this.length?this.charData[t+1]&d:this.text.length)-i!==1||this.text[i]!==" ")return this._cachedTrimmedLength=t+1,this._cachedTrimmedLength;t--}}return this._cachedTrimmedLength=0,0}trimEnd(){const t=this.getTrimmedLength();return t===this.length?this:t===0?new m:this.slice(0,t)}equals(t){if(this.length!==t.length)return!1;if(this.length===0)return!0;if(this.getText()!==t.getText())return!1;const e=this.getSpans(),s=t.getSpans();if(e.length!==s.length)return!1;for(const[i,c]of e.entries()){const h=c,l=s[i];if(h.length!==l.length||h.formatFlags!==l.formatFlags||h.fgColor!==l.fgColor||h.bgColor!==l.bgColor||h.link!==l.link)return!1}const a=this.charData,n=t.charData;if(a&&n){for(let i=0;i<this.length;i++)if(a[i]!==n[i])return!1}return!0}getText(){return this.text??""}getSpans(){return this.spans??[]}getValues(){return Array.from({length:this.length},(t,e)=>this.getValue(e))}*[Symbol.iterator](){if(this.length===0)return;let t=0,e=0;const s=this.getSpans();for(let a=0;a<this.length;a++){const n=s[t],i=n?n.formatFlags:0,c=this.getFullWidth(a);yield{bgColor:n?.bgColor,fgColor:n?.fgColor,formatFlags:i|(c?D:0),fullWidth:c,hasStyles:(i&~D)!==0||n?.fgColor!==void 0||n?.bgColor!==void 0||n?.link!==void 0,link:n?.link,value:this.getValue(a)},n&&(e++,e>=n.length&&(t++,e=0))}}updateSpanAt(t,e){if(t<0||t>=this.length)return;this.ensureInitialized(),this.splitSpansAt(t),this.splitSpansAt(t+1);let s=0;for(const a of this.spans){if(s===t&&a.length===1){e(a);break}s+=a.length}this.mergeSpans()}ensureWidth(t){if(t<=this.length)return;this.ensureInitialized();const e=this.length,s=t-e,a=this.text.length;for(let i=0;i<s;i++)this.charData.push(a);this.length=t;const n=this.spans.at(-1);n?.formatFlags===0&&n.fgColor===void 0&&n.bgColor===void 0&&n.link===void 0?n.length+=s:this.spans.push({formatFlags:0,length:s})}ensureInitialized(){if(this.charData===void 0&&(this.text="",this.charData=Array.from({length:this.length}),this.spans=this.length>0?[{formatFlags:0,length:this.length}]:[],this.length>0&&this.text.length===0)){this.text=" ".repeat(this.length);for(let t=0;t<this.length;t++)this.charData[t]=t}}splitSpansAt(t){if(this.spans===void 0||t<=0||t>=this.length)return;let e=0;for(let s=0;s<this.spans.length;s++){const a=this.spans[s];if(t>e&&t<e+a.length){const n=t-e,i=a.length-n;this.spans.splice(s,1,{...a,length:n},{...a,length:i});return}e+=a.length}}trySetStyleAtIndex(t,e,s,a,n){if(!this.spans)return!1;let i=0,c=-1,h;for(let l=0;l<this.spans.length;l++){const o=this.spans[l];if(i<=t&&i+o.length>t){c=l,h=o;break}i+=o.length}if(!h)return!1;if(h.formatFlags===e&&h.fgColor===s&&h.bgColor===a&&h.link===n)return!0;if(t===i&&c>0){const l=this.spans[c-1];if(l.formatFlags===e&&l.fgColor===s&&l.bgColor===a&&l.link===n)return l.length+=1,h.length===1?this.spans.splice(c,1):h.length-=1,!0}if(t===i+h.length-1&&c<this.spans.length-1){const l=this.spans[c+1];if(l.formatFlags===e&&l.fgColor===s&&l.bgColor===a&&l.link===n)return l.length+=1,h.length===1?this.spans.splice(c,1):h.length-=1,!0}return!1}mergeSpans(){if(this.spans===void 0)return;const t=[];for(const e of this.spans){if(e.length===0)continue;const s=t.at(-1);s?.formatFlags===e.formatFlags&&s.fgColor===e.fgColor&&s.bgColor===e.bgColor&&s.link===e.link?s.length+=e.length:t.push({...e})}this.spans=t}}const $={black:0,blue:4,cyan:6,gray:8,green:2,grey:8,magenta:5,red:1,white:7,yellow:3},G={blackBright:8,blueBright:12,cyanBright:14,greenBright:10,magentaBright:13,redBright:9,whiteBright:15,yellowBright:11},H=/^ansi256\(\s?(\d+)\s?\)$/,V=/^rgb\(\s?(\d+),\s?(\d+),\s?(\d+)\s?\)$/,bt=r=>{const t=$[r];if(t!==void 0)return t;const e=G[r];if(e!==void 0)return e;const s=H.exec(r);if(s)return Number(s[1])&255;if(r.startsWith("#")&&r.length===7){const n=Number.parseInt(r.slice(1,3),16),i=Number.parseInt(r.slice(3,5),16),c=Number.parseInt(r.slice(5,7),16);return 16+36*Math.round(n/51)+6*Math.round(i/51)+Math.round(c/51)}const a=V.exec(r);return a?16+36*Math.round(Number(a[1])/51)+6*Math.round(Number(a[2])/51)+Math.round(Number(a[3])/51):255},Dt=(r,t)=>{const e=t?30:40,s=$[r];if(s!==void 0)return[e+s];const a=G[r];if(a!==void 0)return[e+60+(a-8)];if(r.startsWith("#")&&r.length===7){const c=Number.parseInt(r.slice(1,3),16),h=Number.parseInt(r.slice(3,5),16),l=Number.parseInt(r.slice(5,7),16);return[t?38:48,2,c,h,l]}const n=H.exec(r);if(n)return[t?38:48,5,Number(n[1])];const i=V.exec(r);return i?[t?38:48,2,Number(i[1]),Number(i[2]),Number(i[3])]:[]},F=r=>{const t=["black","red","green","yellow","blue","magenta","cyan","white"];return r>=0&&r<=7?t[r]:`ansi256(${r})`},E=()=>({bgColor:void 0,fgColor:void 0,formatFlags:0,link:void 0}),X=(r,t)=>{if(t.length===0)return E();const s=(t.includes(":")?t.replaceAll(":",";"):t).split(";").filter(l=>l.length>0).map(Number);let{bgColor:a,fgColor:n,formatFlags:i,link:c}=r,h=0;for(;h<s.length;){const l=s[h];switch(l){case 0:{i=0,n=void 0,a=void 0,c=void 0;break}case 1:{i|=q;break}case 2:{i|=Q;break}case 3:{i|=K;break}case 4:{i|=R;break}case 7:{i|=L;break}case 8:{i|=P;break}case 9:{i|=B;break}case 22:{i&=-4;break}case 23:{i&=~K;break}case 24:{i&=~R;break}case 27:{i&=~L;break}case 28:{i&=~P;break}case 29:{i&=~B;break}case 30:case 31:case 32:case 33:case 34:case 35:case 36:case 37:{n=F(l-30);break}case 38:{s[h+1]===5&&s[h+2]!==void 0?(n=F(s[h+2]),h+=2):s[h+1]===2&&h+4<s.length&&(n=`rgb(${s[h+2]}, ${s[h+3]}, ${s[h+4]})`,h+=4);break}case 39:{n=void 0;break}case 40:case 41:case 42:case 43:case 44:case 45:case 46:case 47:{a=F(l-40);break}case 48:{s[h+1]===5&&s[h+2]!==void 0?(a=F(s[h+2]),h+=2):s[h+1]===2&&h+4<s.length&&(a=`rgb(${s[h+2]}, ${s[h+3]}, ${s[h+4]})`,h+=4);break}case 49:{a=void 0;break}case 90:case 91:case 92:case 93:case 94:case 95:case 96:case 97:{n=`ansi256(${l-90+8})`;break}case 100:case 101:case 102:case 103:case 104:case 105:case 106:case 107:{a=`ansi256(${l-100+8})`;break}}h++}return{bgColor:a,fgColor:n,formatFlags:i,link:c}},x=127462,I=127487,Y=127995,tt=127999,et=8205,st=917504,nt=917631,at=new RegExp("\\p{Mark}","u"),it=new Intl.Segmenter(void 0,{granularity:"grapheme"}),rt=(r,t)=>!!(j(t)||r.includes("️")||t>=x&&t<=I),ht=/(?:\u001B\]|\u009D)8;([^;]*);(.*?)(?:\u001B\\|\u0007|\u009C)/,lt=r=>{const t=ht.exec(r);return!t?.[2]||t[2].length===0?void 0:r.endsWith("\x1B\\")?`ST:${t[2]}`:t[2]},U=(r,t,e)=>{const s=it.segment(r),a=[];for(const{segment:n}of s)a.push(n);for(let n=0;n<a.length;n++){let i=a[n];if(i===" "){for(let o=0;o<4;o++)t.pushChar(" ",e.formatFlags,e.fgColor,e.bgColor,e.link);continue}if(i==="\b")continue;const c=i.codePointAt(0);if(!c)continue;if(c>=x&&c<=I&&n+1<a.length){const o=a[n+1],g=o.codePointAt(0);g&&g>=x&&g<=I&&(i+=o,n++)}else for(;n+1<a.length;){const o=a[n+1],g=o.codePointAt(0);if(!g)break;const S=at.test(String.fromCodePoint(g)),p=g>=Y&&g<=tt,u=g===et,b=g>=st&&g<=nt;if(!S&&!p&&!u&&!b)break;i+=o,n++,u&&n+1<a.length&&(i+=a[n+1],n++)}const l=rt(i,c)?e.formatFlags|D:e.formatFlags;t.pushChar(i,l,e.fgColor,e.bgColor,e.link)}},ct=r=>{if(r.length===0)return new m;const t=Z(r),e=new m;let s=E();for(const a of t)switch(a.type){case"csi":{a.finalCharacter==="m"&&(s=X(s,a.parameterString));break}case"osc":{const n=lt(a.value);n!==void 0?s={...s,link:n}:a.value.includes("8;")&&(s={...s,link:void 0});break}case"text":{U(a.value,e,s);break}}return e},ot=/^[\u0020-\u007E]*$/,Ct=r=>{if(r.length===0)return new m;const t=new m;if(ot.test(r)){for(const e of r)t.pushChar(e,0);return t}return U(r,t,E()),t},y=new N(1e4,1e6),M=new N(1e4,1e6),T=new N(1e4,1e6);let _=!0,z=J;const vt=r=>{_=r,r||T.clear()},kt=()=>{T.clear()},Tt=r=>{z=r,gt()},gt=()=>{y.clear(),M.clear(),T.clear()},ft=r=>{if(r.length===1){const s=r.codePointAt(0);if(s!==void 0&&s>=32&&s<127)return 1}const t=M.get(r);if(t!==void 0)return t;let e;try{e=z(r)}catch{e=1}return M.set(r,e),e},ut=r=>{try{return z(r)}catch{return 1}},wt=r=>{if(r.length===0)return{height:0,width:0};const t=y.get(r);if(t)return t;const e=r.split(`
2
+ `);let s=0;for(const i of e){const c=ut(i);c>s&&(s=c)}const n={height:e.length,width:s};return y.set(r,n),n},At=r=>{if(_){const e=T.get(r);if(e!==void 0)return e}const t=ct(r);return _&&T.set(r,t),t},pt=r=>{let t=0;for(let e=0;e<r.length;e++)t+=ft(r.getValue(e));return t},mt=r=>{if(r.length===0)return[new m];const t=[];let e=0;for(let s=0;s<r.length;s++)r.getValue(s)===`
3
+ `&&(t.push(s>e?r.slice(e,s):new m),e=s+1);return t.push(e<r.length?r.slice(e):new m),t},Ft=r=>{if(r.length===0)return{height:0,width:0};const t=mt(r);let e=0;for(const s of t)e=Math.max(e,pt(s));return{height:t.length,width:e}};export{q as B,Q as D,D as F,P as H,K as I,m as S,R as U,kt as a,Tt as b,gt as c,pt as d,L as e,B as f,Dt as g,bt as h,ft as i,ct as j,Ft as k,mt as l,wt as m,Ct as p,vt as s,At as t};
@@ -0,0 +1 @@
1
+ import{createContext as t}from"react";const e=t(null);e.displayName="MouseContext";export{e as M};
@@ -1,5 +1,4 @@
1
1
  import { EventEmitter } from 'node:events';
2
- import 'react';
3
2
  type MousePosition = {
4
3
  x: number;
5
4
  y: number;
@@ -27,4 +26,4 @@ type MouseContextShape = {
27
26
  readonly position: MousePosition;
28
27
  readonly scroll: MouseScrollAction;
29
28
  };
30
- export { MouseContextShape as M, MouseClickAction as a, MouseDragAction as b, MouseScrollAction as c, MousePosition as d, MouseButton as e, MouseAction as f, MouseEvents as g };
29
+ export { MouseButton as M, MouseClickAction as a, MouseDragAction as b, MouseScrollAction as c, MouseContextShape as d, MousePosition as e, MouseAction as f, MouseEvents as g };
@@ -0,0 +1 @@
1
+ import{p as o}from"./ansi-parser-CysVDsNz.js";export{o as parseSgrMouse};
@@ -0,0 +1,2 @@
1
+ import{b as x}from"./measure-element-pHwUPovG.js";const g=(n,l)=>{const{initialState:i,onNewline:s,onSpace:a,onText:c}=l;if(n.nodeName!=="ink-box"&&n.nodeName!=="ink-root"&&n.nodeName!=="ink-text"&&n.nodeName!=="ink-virtual-text"||!n.yogaNode)return{lineBottom:0,state:i()};const{fragments:m}=x(n),t=i();t.currentX=0,t.lineBottom=0,t.yieldedContent=!1;for(const e of m){if(e.y>=t.lineBottom){const o=e.y-t.lineBottom,r=t.yieldedContent?1+o:o;r>0&&(s(r,t),t.currentX=0),t.lineBottom=e.y}if(e.x>t.currentX){const o=e.x-t.currentX;a(o,t),t.currentX=e.x}if(e.text.length>0&&(t.yieldedContent=!0,c(e,t)),(e.text.match(/\n/g)??[]).length>0){const o=e.text.lastIndexOf(`
2
+ `);t.currentX=e.text.length-o-1}else t.currentX+=e.text.length;t.lineBottom=Math.max(t.lineBottom,e.y+e.height)}return{lineBottom:t.lineBottom,state:t}};export{g as processLayout};
@@ -0,0 +1 @@
1
+ import{createRequire as Z}from"node:module";import{version as R,createContext as L}from"react";import D from"react-reconciler";import{NoEventPriority as S,DefaultEventPriority as P}from"react-reconciler/constants.js";import{unstable_shouldYield as b,unstable_scheduleCallback as O,unstable_now as G,unstable_cancelCallback as v}from"scheduler";import t from"yoga-layout";import{b as h,d as p,s as g,m,e as F,r as T,f as k,c as w,h as I,j as C}from"./dom-xpeZzKuf.js";const N=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:d,d=N,B=[["top",t.EDGE_TOP],["right",t.EDGE_RIGHT],["bottom",t.EDGE_BOTTOM],["left",t.EDGE_LEFT]],W=(i,e)=>{if("position"in e){let n=t.POSITION_TYPE_RELATIVE;e.position==="absolute"?n=t.POSITION_TYPE_ABSOLUTE:e.position==="static"&&(n=t.POSITION_TYPE_STATIC),i.setPositionType(n)}for(const[n,f]of B){if(!(n in e))continue;const s=e[n];if(typeof s=="string"){i.setPositionPercent(f,Number.parseFloat(s));continue}i.setPosition(f,s)}},M=(i,e)=>{"margin"in e&&i.setMargin(t.EDGE_ALL,e.margin??0),"marginX"in e&&i.setMargin(t.EDGE_HORIZONTAL,e.marginX??0),"marginY"in e&&i.setMargin(t.EDGE_VERTICAL,e.marginY??0),"marginLeft"in e&&i.setMargin(t.EDGE_START,e.marginLeft||0),"marginRight"in e&&i.setMargin(t.EDGE_END,e.marginRight||0),"marginTop"in e&&i.setMargin(t.EDGE_TOP,e.marginTop||0),"marginBottom"in e&&i.setMargin(t.EDGE_BOTTOM,e.marginBottom||0)},H=(i,e)=>{"padding"in e&&i.setPadding(t.EDGE_ALL,e.padding??0),"paddingX"in e&&i.setPadding(t.EDGE_HORIZONTAL,e.paddingX??0),"paddingY"in e&&i.setPadding(t.EDGE_VERTICAL,e.paddingY??0),"paddingLeft"in e&&i.setPadding(t.EDGE_LEFT,e.paddingLeft||0),"paddingRight"in e&&i.setPadding(t.EDGE_RIGHT,e.paddingRight||0),"paddingTop"in e&&i.setPadding(t.EDGE_TOP,e.paddingTop||0),"paddingBottom"in e&&i.setPadding(t.EDGE_BOTTOM,e.paddingBottom||0)},U=(i,e)=>{"flexGrow"in e&&i.setFlexGrow(e.flexGrow??0),"flexShrink"in e&&i.setFlexShrink(typeof e.flexShrink=="number"?e.flexShrink:1),"flexWrap"in e&&(e.flexWrap==="nowrap"&&i.setFlexWrap(t.WRAP_NO_WRAP),e.flexWrap==="wrap"&&i.setFlexWrap(t.WRAP_WRAP),e.flexWrap==="wrap-reverse"&&i.setFlexWrap(t.WRAP_WRAP_REVERSE)),"flexDirection"in e&&(e.flexDirection==="row"&&i.setFlexDirection(t.FLEX_DIRECTION_ROW),e.flexDirection==="row-reverse"&&i.setFlexDirection(t.FLEX_DIRECTION_ROW_REVERSE),e.flexDirection==="column"&&i.setFlexDirection(t.FLEX_DIRECTION_COLUMN),e.flexDirection==="column-reverse"&&i.setFlexDirection(t.FLEX_DIRECTION_COLUMN_REVERSE)),"flexBasis"in e&&(typeof e.flexBasis=="number"?i.setFlexBasis(e.flexBasis):typeof e.flexBasis=="string"?i.setFlexBasisPercent(Number.parseInt(e.flexBasis,10)):i.setFlexBasis(Number.NaN)),"alignItems"in e&&((e.alignItems==="stretch"||!e.alignItems)&&i.setAlignItems(t.ALIGN_STRETCH),e.alignItems==="flex-start"&&i.setAlignItems(t.ALIGN_FLEX_START),e.alignItems==="center"&&i.setAlignItems(t.ALIGN_CENTER),e.alignItems==="flex-end"&&i.setAlignItems(t.ALIGN_FLEX_END),e.alignItems==="baseline"&&i.setAlignItems(t.ALIGN_BASELINE)),"alignSelf"in e&&((e.alignSelf==="auto"||!e.alignSelf)&&i.setAlignSelf(t.ALIGN_AUTO),e.alignSelf==="flex-start"&&i.setAlignSelf(t.ALIGN_FLEX_START),e.alignSelf==="center"&&i.setAlignSelf(t.ALIGN_CENTER),e.alignSelf==="flex-end"&&i.setAlignSelf(t.ALIGN_FLEX_END),e.alignSelf==="stretch"&&i.setAlignSelf(t.ALIGN_STRETCH),e.alignSelf==="baseline"&&i.setAlignSelf(t.ALIGN_BASELINE)),"alignContent"in e&&((e.alignContent==="flex-start"||!e.alignContent)&&i.setAlignContent(t.ALIGN_FLEX_START),e.alignContent==="center"&&i.setAlignContent(t.ALIGN_CENTER),e.alignContent==="flex-end"&&i.setAlignContent(t.ALIGN_FLEX_END),e.alignContent==="space-between"&&i.setAlignContent(t.ALIGN_SPACE_BETWEEN),e.alignContent==="space-around"&&i.setAlignContent(t.ALIGN_SPACE_AROUND),e.alignContent==="space-evenly"&&i.setAlignContent(t.ALIGN_SPACE_EVENLY),e.alignContent==="stretch"&&i.setAlignContent(t.ALIGN_STRETCH)),"justifyContent"in e&&((e.justifyContent==="flex-start"||!e.justifyContent)&&i.setJustifyContent(t.JUSTIFY_FLEX_START),e.justifyContent==="center"&&i.setJustifyContent(t.JUSTIFY_CENTER),e.justifyContent==="flex-end"&&i.setJustifyContent(t.JUSTIFY_FLEX_END),e.justifyContent==="space-between"&&i.setJustifyContent(t.JUSTIFY_SPACE_BETWEEN),e.justifyContent==="space-around"&&i.setJustifyContent(t.JUSTIFY_SPACE_AROUND),e.justifyContent==="space-evenly"&&i.setJustifyContent(t.JUSTIFY_SPACE_EVENLY))},Y=(i,e)=>{"width"in e&&(typeof e.width=="number"?i.setWidth(e.width):typeof e.width=="string"?i.setWidthPercent(Number.parseInt(e.width,10)):i.setWidthAuto()),"height"in e&&(typeof e.height=="number"?i.setHeight(e.height):typeof e.height=="string"?i.setHeightPercent(Number.parseInt(e.height,10)):i.setHeightAuto()),"minWidth"in e&&(typeof e.minWidth=="string"?i.setMinWidthPercent(Number.parseInt(e.minWidth,10)):i.setMinWidth(e.minWidth??0)),"minHeight"in e&&(typeof e.minHeight=="string"?i.setMinHeightPercent(Number.parseInt(e.minHeight,10)):i.setMinHeight(e.minHeight??0)),"maxWidth"in e&&(typeof e.maxWidth=="string"?i.setMaxWidthPercent(Number.parseInt(e.maxWidth,10)):i.setMaxWidth(e.maxWidth)),"maxHeight"in e&&(typeof e.maxHeight=="string"?i.setMaxHeightPercent(Number.parseInt(e.maxHeight,10)):i.setMaxHeight(e.maxHeight)),"aspectRatio"in e&&i.setAspectRatio(e.aspectRatio)},j=(i,e)=>{"display"in e&&i.setDisplay(e.display==="flex"?t.DISPLAY_FLEX:t.DISPLAY_NONE)},X=(i,e,n)=>{if(!("borderStyle"in e||"borderTop"in e||"borderBottom"in e||"borderLeft"in e||"borderRight"in e))return;const s=n.borderStyle?1:0;i.setBorder(t.EDGE_TOP,n.borderTop===!1?0:s),i.setBorder(t.EDGE_BOTTOM,n.borderBottom===!1?0:s),i.setBorder(t.EDGE_LEFT,n.borderLeft===!1?0:s),i.setBorder(t.EDGE_RIGHT,n.borderRight===!1?0:s)},V=(i,e)=>{"gap"in e&&i.setGap(t.GUTTER_ALL,e.gap??0),"columnGap"in e&&i.setGap(t.GUTTER_COLUMN,e.columnGap??0),"rowGap"in e&&i.setGap(t.GUTTER_ROW,e.rowGap??0)},J=(i,e)=>{const n=e.overflow??"visible",f=e.overflowX??n,s=e.overflowY??n;f==="scroll"||s==="scroll"?i.setOverflow(t.OVERFLOW_SCROLL):f==="hidden"||s==="hidden"?i.setOverflow(t.OVERFLOW_HIDDEN):i.setOverflow(t.OVERFLOW_VISIBLE)},A=(i,e={},n=e)=>{W(i,e),M(i,e),H(i,e),U(i,e),Y(i,e),j(i,e),X(i,e,n),V(i,e),J(i,n)};if(d.env.DEV==="true"){let i=!1;try{import.meta.resolve("react-devtools-core"),i=!0}catch{}i&&await import("../packem_chunks/devtools.js")}const x=(i,e)=>{if(i===e)return;if(!i)return e;const n={};let f=!1;for(const s of Object.keys(i))(!e||!Object.hasOwn(e,s))&&(n[s]=void 0,f=!0);if(e)for(const s of Object.keys(e))e[s]!==i[s]&&(n[s]=e[s],f=!0);return f?n:void 0},E=i=>{if(i){if(i.yogaNode?.unsetMeasureFunc(),"resizeObservers"in i&&i.resizeObservers?.clear(),"childNodes"in i&&i.childNodes)for(const e of i.childNodes)E(e);i.yogaNode?.free(),"cachedRender"in i&&(i.cachedRender=void 0),"childNodes"in i&&(i.childNodes=[]),i.parentNode=void 0}};let u=S,_;async function q(){const e=(await import("node:fs")).readFileSync(new URL("../package.json",import.meta.url),"utf8"),n=JSON.parse(e);return{name:n?.name,version:n?.version}}let l={name:"ink",version:R};if(d.env.DEV==="true")try{const i=await q();l={name:i.name||l.name,version:i.version||l.version}}catch(i){console.warn("Failed to load package.json in development mode. Falling back to default renderer metadata.",i)}const ti=D({afterActiveInstanceBlur(){},appendChild:p,appendChildToContainer:p,appendInitialChild:p,beforeActiveInstanceBlur(){},cancelCallback:v,cancelTimeout:clearTimeout,clearContainer:()=>!1,commitTextUpdate(i,e,n){g(i,n)},commitUpdate(i,e,n,f){_&&i.internal_static&&(_.isStaticDirty=!0);const s=x(n,f),o=x(n.style,f.style);if(!s&&!o)return;let r=!!o;if(s){for(const[a,c]of Object.entries(s))if(a!=="children"){if(a==="style"){I(i,c);continue}if(a==="internal_transform"){i.internal_transform=c,r=!0;continue}if(a==="internal_cursor"){i.internal_cursor=c,r=!0;continue}if(a==="internal_static"){i.internal_static=!0,r=!0;continue}if(a==="sticky"){i.internal_sticky=c,r=!0;continue}if(a==="internalStickyAlternate"){i.internal_stickyAlternate=c,r=!0;continue}if(a==="opaque"){i.internal_opaque=c,r=!0;continue}if(a==="scrollbar"){i.internal_scrollbar=c,r=!0;continue}if(a==="internal_terminalCursorFocus"){i.internal_terminalCursorFocus=c,r=!0;continue}if(a==="internal_terminalCursorPosition"){i.internal_terminalCursorPosition=c,r=!0;continue}if(a==="cachedRender"){i.cachedRender=c,r=!0;continue}C(i,a,c),r=!0}}o&&i.yogaNode&&A(i.yogaNode,o,f.style??{}),r&&m(i)},createInstance(i,e,n,f){if(f.isInsideText&&i==="ink-box")throw new Error("<Box> can’t be nested inside <Text> component");if(f.isInsideText&&i==="ink-cursor")throw new Error("<Cursor> can’t be nested inside <Text> component");const s=i==="ink-text"&&f.isInsideText?"ink-virtual-text":i,o=w(s);for(const[r,a]of Object.entries(e))if(r!=="children"){if(r==="style"){I(o,a),o.yogaNode&&A(o.yogaNode,a);continue}if(r==="internal_transform"){o.internal_transform=a;continue}if(r==="internal_cursor"){o.internal_cursor=a;continue}if(r==="internal_static"){_=n,o.internal_static=!0,n.isStaticDirty=!0,n.staticNode=o;continue}if(r==="sticky"){o.internal_sticky=a;continue}if(r==="internalStickyAlternate"){o.internal_stickyAlternate=a;continue}if(r==="opaque"){o.internal_opaque=a;continue}if(r==="scrollbar"){o.internal_scrollbar=a;continue}if(r==="internal_terminalCursorFocus"){o.internal_terminalCursorFocus=a;continue}if(r==="internal_terminalCursorPosition"){o.internal_terminalCursorPosition=a;continue}if(r==="internal_static"){o.internal_static=!0;continue}if(r==="cachedRender"){o.cachedRender=a;continue}C(o,r,a)}return o},createTextInstance(i,e,n){if(!n.isInsideText)throw new Error(`Text string "${i}" must be rendered inside <Text> component`);return k(i)},detachDeletedInstance(){},finalizeInitialChildren(){return!1},getChildHostContext(i,e){const n=i.isInsideText,f=e==="ink-text"||e==="ink-virtual-text";return n===f?i:{isInsideText:f}},getCurrentUpdatePriority:()=>u,getInstanceFromNode:()=>null,getInstanceFromScope:()=>null,getPublicInstance:i=>i,getRootHostContext:()=>({isInsideText:!1}),hideInstance(i){i.internal_hidden=!0,i.yogaNode?.setDisplay(t.DISPLAY_NONE),m(i)},hideTextInstance(i){g(i,"")},HostTransitionContext:L(null),insertBefore:h,insertInContainerBefore:h,isPrimaryRenderer:!0,maySuspendCommit(){return!0},noTimeout:-1,NotPendingTransition:void 0,now:G,preloadInstance(){return!0},prepareForCommit:()=>null,preparePortalMount:()=>null,prepareScopeUpdate(){},removeChild(i,e){T(i,e),E(e)},removeChildFromContainer(i,e){T(i,e),E(e)},rendererPackageName:l.name,rendererVersion:l.version,requestPostPaintCallback(){},resetAfterCommit(i){if(typeof i.onComputeLayout=="function"&&i.onComputeLayout(),F(i),i.staticNode!==i.previousStaticNode&&(i.previousStaticNode=i.staticNode,typeof i.onStaticChange=="function"&&i.onStaticChange()),i.isStaticDirty){i.isStaticDirty=!1,typeof i.onImmediateRender=="function"&&i.onImmediateRender();return}typeof i.onRender=="function"&&i.onRender()},resetFormInstance(){},resetTextContent(){},resolveEventTimeStamp(){return-1.1},resolveEventType(){return null},resolveUpdatePriority(){return u!==S?u:P},scheduleCallback:O,scheduleMicrotask:queueMicrotask,scheduleTimeout:setTimeout,setCurrentUpdatePriority(i){u=i},shouldAttemptEagerTransition(){return!1},shouldSetTextContent:()=>!1,shouldYield:b,startSuspendingCommit(){},supportsHydration:!1,supportsMicrotasks:!0,supportsMutation:!0,supportsPersistence:!1,suspendInstance(){},trackSchedulerEvent(){},unhideInstance(i){i.internal_hidden=!1,i.yogaNode?.setDisplay(t.DISPLAY_FLEX),m(i)},unhideTextInstance(i,e){g(i,e)},waitForCommitToBeReady(){return null}});export{ti as r,A as s};
@@ -0,0 +1 @@
1
+ import{createContext as g}from"react";import v from"react-reconciler";import{NoEventPriority as h,DiscreteEventPriority as b,DefaultEventPriority as k}from"react-reconciler/constants.js";import{unstable_shouldYield as T,unstable_scheduleCallback as x,unstable_now as I,unstable_cancelCallback as p}from"scheduler";import{LayoutNode as c}from"./LayoutNode-D4i45GQM.js";import{applyStyles as f,resolveColor as m}from"./NAMED_COLORS-DvfPALxN.js";import{g as _}from"./text-width-BXmBaLDv.js";const u=new WeakMap;function D(e,t){u.set(e,t)}function M(e){u.delete(e)}let d=h;function C(e){const t=m(e.fg===void 0?e.color===void 0?void 0:e.color:e.fg),o=m(e.bg===void 0?e.backgroundColor===void 0?void 0:e.backgroundColor:e.bg);let n;return e.styles===void 0?(n=0,e.bold&&(n|=1),(e.dim||e.dimColor)&&(n|=2),e.italic&&(n|=4),e.underline&&(n|=8),e.blink&&(n|=16),e.inverse&&(n|=32),e.hidden&&(n|=64),e.strikethrough&&(n|=128)):n=e.styles,{bg:o,fg:t,styles:n}}const N={afterActiveInstanceBlur:()=>{},appendChild(e,t){e.insertChild(t,e.children.length)},appendChildToContainer(e,t){e.insertChild(t,e.children.length)},appendInitialChild(e,t){e.insertChild(t,e.children.length)},beforeActiveInstanceBlur:()=>{},cancelCallback:p,cancelTimeout:clearTimeout,clearContainer(e){},commitTextUpdate(e,t,o){e.text=o,e.yogaNode.markDirty()},commitUpdate(e,t,o,n,l){f(e.yogaNode,n);const{bg:r,fg:i,styles:s}=C(n);e.fg=i,e.bg=r,e.styles=s,e._style=n,e.transform=typeof n.transform=="function"?n.transform:void 0},createInstance(e,t,o,n,l){const r=new c,i={...t};i.flexDirection===void 0&&(i.flexDirection="row"),i.flexShrink===void 0&&(i.flexShrink=1),f(r.yogaNode,i);const{bg:s,fg:a,styles:y}=C(t);return r.fg=a,r.bg=s,r.styles=y,r._style=t,typeof t.transform=="function"&&(r.transform=t.transform),r},createTextInstance(e,t,o,n){const l=new c;return l.text=e,l.yogaNode.setWidth(_(e)),l.yogaNode.setHeight(1),l},detachDeletedInstance:e=>{e.destroy()},finalizeInitialChildren(e,t,o,n,l){return!1},getChildHostContext(e,t,o){return{isInsideText:t==="text"}},getCurrentEventPriority:()=>b,getCurrentUpdatePriority:()=>d,getInstanceFromNode:()=>null,getPublicInstance(e){return e},getRootHostContext(e){return{isInsideText:!1}},hideInstance(e){e._hidden=!0},hideTextInstance(e){e._hidden=!0},HostTransitionContext:g(null),insertBefore(e,t,o){t.parent&&t.remove();const n=e.children.indexOf(o);e.insertChild(t,n)},isPrimaryRenderer:!0,maySuspendCommit:()=>!0,noTimeout:-1,NotPendingTransition:void 0,now:I,preloadInstance:()=>!0,prepareForCommit(e){return null},preparePortalMount:()=>{},prepareScopeUpdate:()=>{},prepareUpdate(e,t,o,n,l,r){if(o===n)return null;let i=0;for(const a of Object.keys(o))a!=="children"&&(i+=1);let s=0;for(const a of Object.keys(n))if(a!=="children"&&(s+=1,o[a]!==n[a]))return!0;return i===s?null:!0},removeChild(e,t){t.remove()},removeChildFromContainer(e,t){t.remove()},requestPostPaintCallback:()=>{},resetAfterCommit(e){const t=u.get(e);if(typeof t=="function"){t();return}},resolveEventTimeStamp:()=>-1.1,resolveEventType:()=>null,resolveUpdatePriority(){return d!==h?d:k},scheduleCallback:x,scheduleMicrotask:queueMicrotask,scheduleTimeout:setTimeout,setCurrentUpdatePriority(e){d=e},shouldAttemptEagerTransition:()=>!1,shouldSetTextContent(e,t){return!1},shouldYield:T,startSuspendingCommit:()=>{},supportsHydration:!1,supportsMicrotasks:!0,supportsMutation:!0,supportsPersistence:!1,suspendInstance:()=>{},trackSchedulerEvent:()=>{},unhideInstance(e,t){e._hidden=!1},unhideTextInstance(e,t){e._hidden=!1},waitForCommitToBeReady:()=>null,warnsIfNotActing:!0},R=v(N);export{R as T,D as r,M as u};
@@ -0,0 +1 @@
1
+ import c from"react";import{FocusProvider as v,useFocusManager as z}from"./FocusContext-mWFBWdli.js";import{TuiContext as I,useInput as W}from"./TuiContext-Bbq9JRCu.js";import{LayoutNode as L}from"./LayoutNode-D4i45GQM.js";import{T as d,r as P,u as y}from"./reconciler-DXp9qy6k.js";import{renderTreeToBuffer as T}from"./renderTreeToBuffer-MEHvKJc-.js";import{TuiApp as M}from"./TuiApp-D1How6sn.js";import{InputParser as F}from"./InputParser-O4nyWUuQ.js";import{terminalSize as _}from"./Renderer-Dg5_-6TF.js";import{createInlineLoop as A}from"./createInlineLoop-BPlBAXqd.js";const B=a=>c.createElement("box",a,a.children),V=a=>c.createElement("text",a,a.children),X=()=>c.createElement(B,{flexGrow:1}),b=({children:a})=>{const{disableFocus:u,enableFocus:t,focusNext:l,focusPrevious:o}=z();return W((w,s)=>{s.tab&&!s.shift&&l(),s.tab&&s.shift&&o(),s.escape&&(u(),t())}),c.createElement(c.Fragment,null,a)};function Y(a,u){const t=new M,l=new F(process.stdin),o=new L,{height:w,width:s}=t.getSize();o.yogaNode.setWidth(s),o.yogaNode.setHeight(w);const i=d.createContainer(o,0,null,!1,null,"",e=>console.error(e),null),m=e=>c.createElement(I.Provider,{value:{app:t,input:l,writeStderr:n=>t.writeStderr(n),writeStdout:n=>t.writeStdout(n)}},c.createElement(v,null,c.createElement(b,null,e)));d.updateContainer(m(a),i,null,()=>{});const h=(e,n)=>o.calculateLayout(e,n),g=(e,n,H)=>T(o,e,n,H),f=()=>t.paintNow(h,g);let x=!1;P(o,()=>{x=!0});const E=Math.round(1e3/(u?.maxFps??60)),N=setInterval(()=>{x&&(x=!1,f())},E);let S;const C=new Promise(e=>{S=e}),p=()=>{clearInterval(N),y(o),d.updateContainer(null,i,null,()=>{}),o.destroy(),t.stop(),l.stop(),process.off("SIGWINCH",r),S()};l.on("exit",()=>{p(),process.exit(0)}),t.on("quit",()=>{p(),process.exit(0)}),l.start(),t.start();const r=()=>{const e=process.stdout.columns||80,n=process.stdout.rows||24;t.resize(e,n),o.yogaNode.setWidth(e),o.yogaNode.setHeight(n),t.emit("resize"),f()};return process.on("SIGWINCH",r),f(),{app:t,input:l,rerender(e){d.updateContainer(m(e),i,null,()=>{})},unmount(){p()},waitUntilExit(){return C}}}function Z(a,u){const t=_(),l=u?.rows??10,{cols:o}=t,w=Math.min(l,t.rows),s=new F(process.stdin),i=new L;i.yogaNode.setWidth(o),i.yogaNode.setHeight(w);const m=[],h=[],g={quit:()=>p.stop(),writeStderr:r=>h.push(r),writeStdout:r=>m.push(r)},f=d.createContainer(i,0,null,!1,null,"",r=>console.error(r),null),x=r=>c.createElement(I.Provider,{value:{app:g,input:s,writeStderr:g.writeStderr,writeStdout:g.writeStdout}},c.createElement(v,null,c.createElement(b,null,r)));d.updateContainer(x(a),f,null,()=>{}),P(i,()=>{});let E;const N=new Promise(r=>{E=r});let S=!1;const C=()=>{S||(S=!0,y(i),d.updateContainer(null,f,null,()=>{}),i.destroy(),s.stop(),m.length>0&&process.stdout.write(m.join("")),h.length>0&&process.stderr.write(h.join("")),E())},p=A((r,e,n)=>{i.calculateLayout(e,n),T(i,r,e,n)},{...u,fps:u?.maxFps??u?.fps??60,onStop:C,rows:w});return s.on("exit",()=>p.stop()),p.start(),s.start(),{unmount(){p.stop()},waitUntilExit(){return N}}}export{B as _Box,X as _Spacer,V as _Text,Y as render,Z as renderInline};