@visulima/tui 1.0.0-alpha.15 → 1.0.0-alpha.17

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 (73) hide show
  1. package/CHANGELOG.md +26 -0
  2. package/LICENSE.md +136 -6
  3. package/dist/components/box.d.ts +2 -2
  4. package/dist/components/controlled-scroll-view.d.ts +2 -2
  5. package/dist/components/controlled-scroll-view.js +1 -1
  6. package/dist/components/cursor.d.ts +3 -3
  7. package/dist/components/dialog.d.ts +3 -3
  8. package/dist/components/dialog.js +1 -1
  9. package/dist/components/progress-bar.d.ts +1 -1
  10. package/dist/components/scroll-bar-box.d.ts +2 -2
  11. package/dist/components/scroll-bar.d.ts +2 -2
  12. package/dist/components/scroll-list.d.ts +2 -2
  13. package/dist/components/scroll-list.js +1 -1
  14. package/dist/components/scroll-view.d.ts +2 -2
  15. package/dist/components/scroll-view.js +1 -1
  16. package/dist/components/static-render.d.ts +7 -3
  17. package/dist/components/static-render.js +1 -1
  18. package/dist/components/static.d.ts +1 -1
  19. package/dist/components/text.d.ts +1 -1
  20. package/dist/components/tree-view-entry.d.ts +2 -2
  21. package/dist/ink/hooks/use-app.d.ts +1 -1
  22. package/dist/ink/hooks/use-box-metrics.d.ts +6 -4
  23. package/dist/ink/hooks/use-box-metrics.js +1 -1
  24. package/dist/ink/hooks/use-focus-manager.d.ts +2 -1
  25. package/dist/ink/hooks/use-input.d.ts +1 -1
  26. package/dist/ink/hooks/use-input.js +1 -1
  27. package/dist/ink/hooks/use-linked-scroll.d.ts +2 -2
  28. package/dist/ink/hooks/use-paste.d.ts +2 -1
  29. package/dist/ink/hooks/use-paste.js +1 -1
  30. package/dist/ink/hooks/use-text-selection.d.ts +4 -4
  31. package/dist/ink/hooks/use-text-selection.js +1 -1
  32. package/dist/ink/index.d.ts +9 -7
  33. package/dist/ink/index.js +1 -1
  34. package/dist/packem_shared/ControlledScrollView-C8VKEcM3.js +1 -0
  35. package/dist/packem_shared/{DevTools-ClnTSU76.js → DevTools-DdB596Gm.js} +1 -1
  36. package/dist/packem_shared/{LayoutNode-Q7nU3hmO.js → LayoutNode-B0qeT8sl.js} +1 -1
  37. package/dist/packem_shared/{ScrollList-Dxgv-mhZ.js → ScrollList-TUuafnA1.js} +1 -1
  38. package/dist/packem_shared/{ScrollView-Dq2v5zJS.js → ScrollView-D9nrXw4U.js} +1 -1
  39. package/dist/packem_shared/{comparePoints-l0iqUoL_.js → comparePoints-Dhgn8lGv.js} +1 -1
  40. package/dist/packem_shared/{controlled-scroll-view-CikQ90_V.js → controlled-scroll-view-CFM7ZV9N.js} +1 -1
  41. package/dist/packem_shared/{dom-CMbdnYbk.js → dom-UWZI4lDM.js} +1 -1
  42. package/dist/packem_shared/{dom.d-BZZeZlyP.d.ts → dom.d-C-sqbtxD.d.ts} +10 -2
  43. package/dist/packem_shared/get-string-width-CbMPWEJO.js +1 -0
  44. package/dist/packem_shared/{getPathToRoot-Nb2eTx2o.js → getPathToRoot-CL45WosJ.js} +1 -1
  45. package/dist/packem_shared/getScrollHeight-ClEOyLHH.js +1 -0
  46. package/dist/packem_shared/{layout-P24eyWyL.js → layout-D5zRYQRE.js} +1 -1
  47. package/dist/packem_shared/{measure-text-CIs55Wao.js → measure-text-D-jVetsl.js} +2 -2
  48. package/dist/packem_shared/{measureElement-CRKlFSvD.js → measureElement-BP4fUMFg.js} +1 -1
  49. package/dist/packem_shared/processLayout-D2unRIYk.js +1 -0
  50. package/dist/packem_shared/{reconciler-BQvF1kRj.js → reconciler-C0e93MVj.js} +1 -1
  51. package/dist/packem_shared/{reconciler-tOH9yL_j.js → reconciler-ChRlmCI_.js} +1 -1
  52. package/dist/packem_shared/render-Cn56QShB.js +27 -0
  53. package/dist/packem_shared/{render-yGJFE4of.js → render-CqZntGO6.js} +1 -1
  54. package/dist/packem_shared/{render.d-BJmVQ_cd.d.ts → render.d-CZ__oorj.d.ts} +19 -1
  55. package/dist/packem_shared/{renderToString-GyN-Rw9F.js → renderToString-D3xqB85B.js} +1 -1
  56. package/dist/packem_shared/{renderToString-D4JqS-Zv.js → renderToString-DE1YWhbo.js} +1 -1
  57. package/dist/packem_shared/{renderTreeToBuffer-DWl5_yTW.js → renderTreeToBuffer-LnGZkEUX.js} +1 -1
  58. package/dist/packem_shared/{renderer-Cidd3s9K.js → renderer-DaPOmgCC.js} +6 -6
  59. package/dist/packem_shared/{selection.d-vfuEzv1p.d.ts → selection.d-t_tKgYYA.d.ts} +1 -1
  60. package/dist/packem_shared/{setEnableStyledLineCache-Aja0FbWo.js → setEnableStyledLineCache-Cke6_ZQt.js} +1 -1
  61. package/dist/packem_shared/{styles.d-i6Mejqz2.d.ts → styles.d-CLJdt-kg.d.ts} +35 -7
  62. package/dist/packem_shared/{text-width-DSx26OmB.js → text-width-CI9G0a-z.js} +1 -1
  63. package/dist/packem_shared/{wrapOrTruncateStyledLine-D29Fq7pW.js → wrapOrTruncateStyledLine-kyi6yijx.js} +1 -1
  64. package/dist/react/index.js +1 -1
  65. package/dist/testing/index.d.ts +4 -4
  66. package/dist/testing/index.js +1 -1
  67. package/index.js +539 -691
  68. package/package.json +17 -16
  69. package/dist/packem_shared/ControlledScrollView-X_OTc-Cw.js +0 -1
  70. package/dist/packem_shared/get-string-width-4oMZhv2Q.js +0 -1
  71. package/dist/packem_shared/getScrollHeight-BTEY8ewu.js +0 -1
  72. package/dist/packem_shared/processLayout-Dmgf0LO6.js +0 -1
  73. package/dist/packem_shared/render-D9bHMHrx.js +0 -26
@@ -1,18 +1,18 @@
1
1
  export { type C as ClipboardTarget, c as clearOsc52, i as isOsc52Supported, w as writeOsc52 } from "../packem_shared/clipboard.d-D6lZTQ21.js";
2
2
  export { b as COLOR_BLINDNESS_COMPENSATION, c as COLOR_BLINDNESS_SIMULATION, type C as ColorBlindnessType, type a as ColorMatrix, I as IDENTITY_MATRIX, d as applyColorMatrix, h as hexToRgb, r as rgbToHex, t as transformHexColor } from "../packem_shared/color-matrix.d-DSXLsB64.js";
3
- import { a as DOMElement, D as DOMNode, S as StyledLine } from "../packem_shared/dom.d-BZZeZlyP.js";
4
- export { R as ResizeObserver, type b as ResizeObserverCallback, c as ResizeObserverEntry, type d as ScrollState, type e as StickyHeader, f as calculateScroll, g as getPathToRoot, h as getScrollHeight, i as getScrollLeft, j as getScrollTop, k as getScrollWidth, l as isNodeSelectable } from "../packem_shared/dom.d-BZZeZlyP.js";
5
- export { type I as Instance, type K as KittyFlagName, type a as KittyKeyboardOptions, type R as RenderOptions, k as kittyFlags, b as kittyModifiers, r as render } from "../packem_shared/render.d-BJmVQ_cd.js";
3
+ import { D as DOMElement, a as DOMNode, S as StyledLine } from "../packem_shared/dom.d-C-sqbtxD.js";
4
+ export { R as ResizeObserver, type b as ResizeObserverCallback, c as ResizeObserverEntry, type d as ScrollState, type e as StickyHeader, f as calculateScroll, g as getPathToRoot, h as getScrollHeight, i as getScrollLeft, j as getScrollTop, k as getScrollWidth, l as isNodeSelectable } from "../packem_shared/dom.d-C-sqbtxD.js";
5
+ export { type I as Instance, type K as KittyFlagName, type a as KittyKeyboardOptions, type R as RenderOptions, k as kittyFlags, b as kittyModifiers, r as render } from "../packem_shared/render.d-CZ__oorj.js";
6
6
  import 'node:stream';
7
7
  export { type C as CursorPosition } from "../packem_shared/cursor-helpers.d-BIvqz0TZ.js";
8
8
  import { EventEmitter } from 'node:events';
9
9
  import React, { PropsWithChildren, RefObject, ReactNode } from 'react';
10
- export { R as Range, S as Selection, a as applySelectionToStyledLine, c as comparePoints } from "../packem_shared/selection.d-vfuEzv1p.js";
10
+ export { R as Range, S as Selection, a as applySelectionToStyledLine, c as comparePoints } from "../packem_shared/selection.d-t_tKgYYA.js";
11
11
  export { type T as TerminalPalette, i as isTerminalPaletteQuerySupported, q as queryTerminalPalette } from "../packem_shared/terminal-palette.d-D2SQjfn-.js";
12
12
  import 'yoga-layout';
13
- import "../packem_shared/styles.d-i6Mejqz2.js";
14
- import "../packem_shared/index.server.d-eZWyC2Ku.js";
15
13
  import 'type-fest';
14
+ import "../packem_shared/styles.d-CLJdt-kg.js";
15
+ import "../packem_shared/index.server.d-eZWyC2Ku.js";
16
16
  /**
17
17
  * Detect whether a string contains non-ASCII characters that are likely
18
18
  * IME (Input Method Editor) composition input — CJK ideographs, Hangul,
@@ -363,7 +363,9 @@ type RenderToStringOptions = {
363
363
 
364
364
  @example
365
365
  ```
366
- import {renderToString, Text, Box} from 'ink';
366
+ import {renderToString} from '@visulima/tui';
367
+ import {Box} from '@visulima/tui/components/box';
368
+ import {Text} from '@visulima/tui/components/text';
367
369
 
368
370
  const output = renderToString(
369
371
  <Box padding={1}>
package/dist/ink/index.js CHANGED
@@ -1 +1 @@
1
- import{clearOsc52 as o,isOsc52Supported as r,writeOsc52 as a}from"../packem_shared/isOsc52Supported-DKK7Uee6.js";import{COLOR_BLINDNESS_COMPENSATION as l,COLOR_BLINDNESS_SIMULATION as i,IDENTITY_MATRIX as n,applyColorMatrix as u,hexToRgb as f,rgbToHex as p,transformHexColor as c}from"../packem_shared/COLOR_BLINDNESS_SIMULATION-DqErf7XX.js";import{g as d,i as x}from"../packem_shared/dom-CMbdnYbk.js";import{IMECompositionBuffer as S,isIMEInput as h}from"../packem_shared/IMECompositionBuffer-C89PhiOu.js";import{kittyFlags as M,kittyModifiers as O}from"../packem_shared/kittyFlags-C3rZLbcK.js";import{c as I,a as L,b,g as C,d as E,e as N,f as R,h as B,i as P,j as H,k as v,l as W,P as k,p as A}from"../packem_shared/layout-P24eyWyL.js";import{c as D,a as F,i as z,s as q,b as w,t as j}from"../packem_shared/measure-text-CIs55Wao.js";import{default as U}from"../packem_shared/render-D9bHMHrx.js";import{default as X}from"../packem_shared/renderToString-GyN-Rw9F.js";import{default as G,ResizeObserverEntry as J}from"../packem_shared/ResizeObserverEntry-Dq0dk8Kq.js";import{calculateScroll as Z,getScrollHeight as $,getScrollLeft as ee,getScrollTop as te,getScrollWidth as oe}from"../packem_shared/getScrollHeight-BTEY8ewu.js";import{Range as ae,Selection as se,applySelectionToStyledLine as le,comparePoints as ie}from"../packem_shared/comparePoints-l0iqUoL_.js";import{squashTextNodesWithMap as ue}from"../packem_shared/squashTextNodesWithMap-Cpqmc45i.js";import{isTerminalPaletteQuerySupported as pe,queryTerminalPalette as ce}from"../packem_shared/isTerminalPaletteQuerySupported-Dn2hFAZ_.js";import{wrapOrTruncateStyledLine as de}from"../packem_shared/wrapOrTruncateStyledLine-D29Fq7pW.js";import{default as ge}from"../packem_shared/Fullscreen-CxLd1-Zu.js";import{default as he}from"../packem_shared/MouseProvider-CHU5DuwC.js";import{default as Me}from"../packem_shared/isIntersecting-B3KbKTmu.js";import{default as ye}from"../packem_shared/useMouseAction-2dRfU1vE.js";import{default as Le}from"../packem_shared/useMouseContext-C746G7kY.js";import{default as Ce}from"../packem_shared/useMousePosition-BTWfV4JK.js";import{default as Ne}from"../packem_shared/useOnMouseHover-D3DczIol.js";import{default as Be}from"../packem_shared/useOnMouseState-cRK8QvzD.js";import{a as He}from"../packem_shared/ansi-parser-C5JuL732.js";import{useElementDimensions as We,useElementPosition as ke}from"../packem_shared/useElementDimensions-qJ_WXFZ9.js";import{useOnMouseClick as _e}from"../packem_shared/useOnMouseClick-nY8xLZmt.js";export{l as COLOR_BLINDNESS_COMPENSATION,i as COLOR_BLINDNESS_SIMULATION,ge as Fullscreen,n as IDENTITY_MATRIX,S as IMECompositionBuffer,he as MouseProvider,ae as Range,G as ResizeObserver,J as ResizeObserverEntry,se as Selection,u as applyColorMatrix,le as applySelectionToStyledLine,Z as calculateScroll,I as calculateScrollbarLayout,L as calculateScrollbarThumb,o as clearOsc52,D as clearStringWidthCache,F as clearStyledLineCache,b as collectSortedFragments,ie as comparePoints,C as getAddedScrollHeight,E as getBoundingBox,N as getHorizontalScrollbarBoundingBox,R as getInnerHeight,B as getInnerWidth,d as getPathToRoot,P as getRelativeLeft,H as getRelativeTop,$ as getScrollHeight,ee as getScrollLeft,te as getScrollTop,oe as getScrollWidth,v as getText,W as getVerticalScrollbarBoundingBox,f as hexToRgb,z as inkCharacterWidth,h as isIMEInput,Me as isIntersecting,x as isNodeSelectable,r as isOsc52Supported,pe as isTerminalPaletteQuerySupported,M as kittyFlags,O as kittyModifiers,k as measureElement,He as parseSgrMouse,A as processLayout,ce as queryTerminalPalette,U as render,X as renderToString,p as rgbToHex,q as setEnableStyledLineCache,w as setStringWidthFunction,ue as squashTextNodesWithMap,j as toStyledLine,c as transformHexColor,We as useElementDimensions,ke as useElementPosition,ye as useMouseAction,Le as useMouseContext,Ce as useMousePosition,_e as useOnMouseClick,Ne as useOnMouseHover,Be as useOnMouseState,de as wrapOrTruncateStyledLine,a as writeOsc52};
1
+ import{clearOsc52 as o,isOsc52Supported as r,writeOsc52 as a}from"../packem_shared/isOsc52Supported-DKK7Uee6.js";import{COLOR_BLINDNESS_COMPENSATION as l,COLOR_BLINDNESS_SIMULATION as i,IDENTITY_MATRIX as n,applyColorMatrix as u,hexToRgb as f,rgbToHex as p,transformHexColor as c}from"../packem_shared/COLOR_BLINDNESS_SIMULATION-DqErf7XX.js";import{g as d,i as x}from"../packem_shared/dom-UWZI4lDM.js";import{IMECompositionBuffer as S,isIMEInput as h}from"../packem_shared/IMECompositionBuffer-C89PhiOu.js";import{kittyFlags as M,kittyModifiers as O}from"../packem_shared/kittyFlags-C3rZLbcK.js";import{c as I,a as L,b,g as C,d as E,e as N,f as R,h as B,i as P,j as H,k as v,l as W,P as k,p as A}from"../packem_shared/layout-D5zRYQRE.js";import{c as D,a as F,i as z,s as q,b as w,t as j}from"../packem_shared/measure-text-D-jVetsl.js";import{default as U}from"../packem_shared/render-Cn56QShB.js";import{default as X}from"../packem_shared/renderToString-D3xqB85B.js";import{default as G,ResizeObserverEntry as J}from"../packem_shared/ResizeObserverEntry-Dq0dk8Kq.js";import{calculateScroll as Z,getScrollHeight as $,getScrollLeft as ee,getScrollTop as te,getScrollWidth as oe}from"../packem_shared/getScrollHeight-ClEOyLHH.js";import{Range as ae,Selection as se,applySelectionToStyledLine as le,comparePoints as ie}from"../packem_shared/comparePoints-Dhgn8lGv.js";import{squashTextNodesWithMap as ue}from"../packem_shared/squashTextNodesWithMap-Cpqmc45i.js";import{isTerminalPaletteQuerySupported as pe,queryTerminalPalette as ce}from"../packem_shared/isTerminalPaletteQuerySupported-Dn2hFAZ_.js";import{wrapOrTruncateStyledLine as de}from"../packem_shared/wrapOrTruncateStyledLine-kyi6yijx.js";import{default as ge}from"../packem_shared/Fullscreen-CxLd1-Zu.js";import{default as he}from"../packem_shared/MouseProvider-CHU5DuwC.js";import{default as Me}from"../packem_shared/isIntersecting-B3KbKTmu.js";import{default as ye}from"../packem_shared/useMouseAction-2dRfU1vE.js";import{default as Le}from"../packem_shared/useMouseContext-C746G7kY.js";import{default as Ce}from"../packem_shared/useMousePosition-BTWfV4JK.js";import{default as Ne}from"../packem_shared/useOnMouseHover-D3DczIol.js";import{default as Be}from"../packem_shared/useOnMouseState-cRK8QvzD.js";import{a as He}from"../packem_shared/ansi-parser-C5JuL732.js";import{useElementDimensions as We,useElementPosition as ke}from"../packem_shared/useElementDimensions-qJ_WXFZ9.js";import{useOnMouseClick as _e}from"../packem_shared/useOnMouseClick-nY8xLZmt.js";export{l as COLOR_BLINDNESS_COMPENSATION,i as COLOR_BLINDNESS_SIMULATION,ge as Fullscreen,n as IDENTITY_MATRIX,S as IMECompositionBuffer,he as MouseProvider,ae as Range,G as ResizeObserver,J as ResizeObserverEntry,se as Selection,u as applyColorMatrix,le as applySelectionToStyledLine,Z as calculateScroll,I as calculateScrollbarLayout,L as calculateScrollbarThumb,o as clearOsc52,D as clearStringWidthCache,F as clearStyledLineCache,b as collectSortedFragments,ie as comparePoints,C as getAddedScrollHeight,E as getBoundingBox,N as getHorizontalScrollbarBoundingBox,R as getInnerHeight,B as getInnerWidth,d as getPathToRoot,P as getRelativeLeft,H as getRelativeTop,$ as getScrollHeight,ee as getScrollLeft,te as getScrollTop,oe as getScrollWidth,v as getText,W as getVerticalScrollbarBoundingBox,f as hexToRgb,z as inkCharacterWidth,h as isIMEInput,Me as isIntersecting,x as isNodeSelectable,r as isOsc52Supported,pe as isTerminalPaletteQuerySupported,M as kittyFlags,O as kittyModifiers,k as measureElement,He as parseSgrMouse,A as processLayout,ce as queryTerminalPalette,U as render,X as renderToString,p as rgbToHex,q as setEnableStyledLineCache,w as setStringWidthFunction,ue as squashTextNodesWithMap,j as toStyledLine,c as transformHexColor,We as useElementDimensions,ke as useElementPosition,ye as useMouseAction,Le as useMouseContext,Ce as useMousePosition,_e as useOnMouseClick,Ne as useOnMouseHover,Be as useOnMouseState,de as wrapOrTruncateStyledLine,a as writeOsc52};
@@ -0,0 +1 @@
1
+ import"react/jsx-runtime";import"react";import"./layout-D5zRYQRE.js";import"../components/box.js";import{C as l}from"./controlled-scroll-view-CFM7ZV9N.js";export{l as ControlledScrollView};
@@ -1 +1 @@
1
- var w=Object.defineProperty;var l=(e,r)=>w(e,"name",{value:r,configurable:!0});import{jsxs as a,jsx as c}from"react/jsx-runtime";import{useState as D,useRef as d,useEffect as T}from"react";import{useWindowSize as S,useTuiContext as b}from"./TuiContext-BoJvG3NN.js";import{_Box as i,_Spacer as g,_Text as v}from"./render-yGJFE4of.js";var j=Object.defineProperty,s=l((e,r)=>j(e,"name",{value:r,configurable:!0}),"s");function p(){const{app:e}=b(),[r,u]=D(0),t=d(0),n=d(Date.now()),o=d(null);return T(()=>{const h=s(()=>{o.current&&clearTimeout(o.current),o.current=setTimeout(()=>{u(0),t.current=0,n.current=Date.now()},2e3),t.current++;const f=Date.now(),m=f-n.current;m>=500&&(u(Math.round(t.current/m*1e3)),t.current=0,n.current=f)},"onRender"),x=e.onBeforeFlush(()=>{h()});return()=>{x(),o.current&&clearTimeout(o.current)}},[e]),r}l(p,"h");s(p,"useFpsCounter");const y=s(({fps:e})=>{const r=e===0?"--":String(e);return c(i,{borderColor:"gray",borderStyle:"round",paddingX:1,children:a(v,{dim:!0,children:[r," ","updates/sec"]})})},"FpsHud"),k=s(({children:e,enabled:r=!0})=>{const u=p(),{columns:t,rows:n}=S();return a(i,{flexDirection:"column",height:n,width:t,children:[c(i,{flexGrow:1,children:e}),r&&a(i,{flexDirection:"row",flexShrink:0,children:[c(g,{}),c(y,{fps:u})]})]})},"DevTools");export{k as DevTools};
1
+ var w=Object.defineProperty;var l=(e,r)=>w(e,"name",{value:r,configurable:!0});import{jsxs as a,jsx as c}from"react/jsx-runtime";import{useState as D,useRef as d,useEffect as T}from"react";import{useWindowSize as S,useTuiContext as b}from"./TuiContext-BoJvG3NN.js";import{_Box as i,_Spacer as g,_Text as v}from"./render-CqZntGO6.js";var j=Object.defineProperty,s=l((e,r)=>j(e,"name",{value:r,configurable:!0}),"s");function p(){const{app:e}=b(),[r,u]=D(0),t=d(0),n=d(Date.now()),o=d(null);return T(()=>{const h=s(()=>{o.current&&clearTimeout(o.current),o.current=setTimeout(()=>{u(0),t.current=0,n.current=Date.now()},2e3),t.current++;const f=Date.now(),m=f-n.current;m>=500&&(u(Math.round(t.current/m*1e3)),t.current=0,n.current=f)},"onRender"),x=e.onBeforeFlush(()=>{h()});return()=>{x(),o.current&&clearTimeout(o.current)}},[e]),r}l(p,"h");s(p,"useFpsCounter");const y=s(({fps:e})=>{const r=e===0?"--":String(e);return c(i,{borderColor:"gray",borderStyle:"round",paddingX:1,children:a(v,{dim:!0,children:[r," ","updates/sec"]})})},"FpsHud"),k=s(({children:e,enabled:r=!0})=>{const u=p(),{columns:t,rows:n}=S();return a(i,{flexDirection:"column",height:n,width:t,children:[c(i,{flexGrow:1,children:e}),r&&a(i,{flexDirection:"row",flexShrink:0,children:[c(g,{}),c(y,{fps:u})]})]})},"DevTools");export{k as DevTools};
@@ -1 +1 @@
1
- var c=Object.defineProperty;var g=(d,t)=>c(d,"name",{value:t,configurable:!0});import a from"yoga-layout";import{m as y}from"./text-width-DSx26OmB.js";var u=Object.defineProperty,N=g((d,t)=>u(d,"name",{value:t,configurable:!0}),"h");const l=new Map;class E{static{g(this,"LayoutNode")}static{N(this,"LayoutNode")}yogaNode;children=[];parent=null;_destroyed=!1;_hidden=!1;transform;_text;fg=255;bg=255;styles=0;_style;set text(t){this._text=t,t===void 0?this.yogaNode.unsetMeasureFunc():this.yogaNode.setMeasureFunc((e,o,r,n)=>{if(t.length===0)return{height:0,width:0};const i=y(t,Number.MAX_SAFE_INTEGER);let s=i.maxLineWidth;o===a.MEASURE_MODE_EXACTLY?s=Math.max(0,Math.floor(e)):o===a.MEASURE_MODE_AT_MOST&&(s=Math.min(i.maxLineWidth,Math.max(0,Math.floor(e))));let h=i.wrappedRows;return s>0&&(h=y(t,s).wrappedRows),n===a.MEASURE_MODE_EXACTLY?h=Math.max(0,Math.floor(r)):n===a.MEASURE_MODE_AT_MOST&&(h=Math.min(h,Math.max(0,Math.floor(r)))),{height:h,width:s}})}get text(){return this._text}constructor(){this.yogaNode=a.Node.create(),this.yogaNode.setFlexDirection(a.FLEX_DIRECTION_COLUMN)}insertChild(t,e){const o=l.get(t.yogaNode);o&&o.removeChild(t);const r=t.yogaNode.getParent();r&&r.removeChild(t.yogaNode);const n=this.yogaNode.getChildCount(),i=Math.min(e,n);try{this.yogaNode.insertChild(t.yogaNode,i)}catch{return}t.parent=this,this.children.splice(i,0,t),l.set(t.yogaNode,this)}remove(){this.parent&&this.parent.removeChild(this)}removeChild(t){const e=this.children.indexOf(t);if(e!==-1){this.children.splice(e,1),t.parent=null,l.delete(t.yogaNode);const o=t.yogaNode.getParent();o&&o.removeChild(t.yogaNode)}}destroy(){if(this._destroyed)return;this._destroyed=!0;for(const e of this.children)e.parent===this&&(e.parent=null);this.children=[],l.delete(this.yogaNode);const t=this.yogaNode.getParent();t&&t.removeChild(this.yogaNode),this.yogaNode.free()}calculateLayout(t,e){this.yogaNode.setWidth(t),this.yogaNode.setHeight(e),this.yogaNode.calculateLayout(t,e,a.DIRECTION_LTR)}getLayout(){return this.yogaNode.getComputedLayout()}}export{E as LayoutNode};
1
+ var c=Object.defineProperty;var g=(d,t)=>c(d,"name",{value:t,configurable:!0});import a from"yoga-layout";import{m as y}from"./text-width-CI9G0a-z.js";var u=Object.defineProperty,N=g((d,t)=>u(d,"name",{value:t,configurable:!0}),"h");const l=new Map;class E{static{g(this,"LayoutNode")}static{N(this,"LayoutNode")}yogaNode;children=[];parent=null;_destroyed=!1;_hidden=!1;transform;_text;fg=255;bg=255;styles=0;_style;set text(t){this._text=t,t===void 0?this.yogaNode.unsetMeasureFunc():this.yogaNode.setMeasureFunc((e,o,r,n)=>{if(t.length===0)return{height:0,width:0};const i=y(t,Number.MAX_SAFE_INTEGER);let s=i.maxLineWidth;o===a.MEASURE_MODE_EXACTLY?s=Math.max(0,Math.floor(e)):o===a.MEASURE_MODE_AT_MOST&&(s=Math.min(i.maxLineWidth,Math.max(0,Math.floor(e))));let h=i.wrappedRows;return s>0&&(h=y(t,s).wrappedRows),n===a.MEASURE_MODE_EXACTLY?h=Math.max(0,Math.floor(r)):n===a.MEASURE_MODE_AT_MOST&&(h=Math.min(h,Math.max(0,Math.floor(r)))),{height:h,width:s}})}get text(){return this._text}constructor(){this.yogaNode=a.Node.create(),this.yogaNode.setFlexDirection(a.FLEX_DIRECTION_COLUMN)}insertChild(t,e){const o=l.get(t.yogaNode);o&&o.removeChild(t);const r=t.yogaNode.getParent();r&&r.removeChild(t.yogaNode);const n=this.yogaNode.getChildCount(),i=Math.min(e,n);try{this.yogaNode.insertChild(t.yogaNode,i)}catch{return}t.parent=this,this.children.splice(i,0,t),l.set(t.yogaNode,this)}remove(){this.parent&&this.parent.removeChild(this)}removeChild(t){const e=this.children.indexOf(t);if(e!==-1){this.children.splice(e,1),t.parent=null,l.delete(t.yogaNode);const o=t.yogaNode.getParent();o&&o.removeChild(t.yogaNode)}}destroy(){if(this._destroyed)return;this._destroyed=!0;for(const e of this.children)e.parent===this&&(e.parent=null);this.children=[],l.delete(this.yogaNode);const t=this.yogaNode.getParent();t&&t.removeChild(this.yogaNode),this.yogaNode.free()}calculateLayout(t,e){this.yogaNode.setWidth(t),this.yogaNode.setHeight(e),this.yogaNode.calculateLayout(t,e,a.DIRECTION_LTR)}getLayout(){return this.yogaNode.getComputedLayout()}}export{E as LayoutNode};
@@ -1 +1 @@
1
- var Y=Object.defineProperty;var L=(H,C)=>Y(H,"name",{value:C,configurable:!0});import{jsx as $}from"react/jsx-runtime";import{useRef as x,useState as Q,useEffect as j,useCallback as l,useImperativeHandle as U}from"react";import Z from"../ink/hooks/use-scroll-input.js";import{C as _}from"./controlled-scroll-view-CikQ90_V.js";var tt=Object.defineProperty,a=L((H,C)=>tt(H,"name",{value:C,configurable:!0}),"u");const ct=a(H=>{const{children:C,keyboard:A=!1,onContentHeightChange:b,onItemHeightChange:T,onScroll:O,onViewportSizeChange:P,overscan:E,ref:R,scrollAlignment:m="auto",selectedIndex:v,vimBindings:q=!1,virtualize:D,...F}=H,n=x(null),[s,G]=Q(0),I=x(0);j(()=>{I.current=s},[s]);const o=l(t=>{t!==I.current&&(G(t),O?.(t))},[O]),h=x(v);h.current=v;const k=l(()=>{const t=h.current;if(t===void 0||t<0)return null;const e=n.current?.getItemPosition(t);if(!e)return null;const i=n.current?.getViewportHeight()??0,g=n.current?.getContentHeight()??0;let r=e.top+e.height-i,c=e.top;r>c&&([r,c]=[c,r]);const B=Math.max(0,g-i);return{max:Math.min(B,c),min:Math.max(0,r)}},[]),u=l(t=>{const e=n.current?.getContentHeight()??0,i=n.current?.getViewportHeight()??0,g=Math.max(0,e-i);let r=Math.max(0,Math.min(t,g));const c=k();return c&&(r=Math.max(c.min,Math.min(r,c.max))),r},[k]),f=l((t,e,i,g)=>{const r=n.current?.getItemPosition(t);if(!r)return e;const c=g??n.current?.getViewportHeight()??0,B=n.current?.getContentHeight()??0;let p=e;switch(i){case"bottom":{p=r.top+r.height-c;break}case"center":{p=r.top+r.height/2-c/2;break}case"top":{p=r.top;break}default:{const S=r.top+r.height;r.top<=e&&S>=e+c?p=e:r.top<e?p=r.top:S>e+c&&(p=S-c)}}const X=Math.max(0,B-c);return Math.max(0,Math.min(p,X))},[]);let d=s;v!==void 0&&v>=0&&(d=f(v,s,m)),j(()=>{d!==s&&o(d)},[d,s,o]);const y=l((t,e)=>{if(h.current!==void 0&&h.current>=0){const i=f(h.current,s,m,t.height);o(i)}P?.(t,e)},[P,f,s,m,o]),J=l((t,e,i)=>{const g=h.current;if(g!==void 0&&g>=0){if(t<g){const r=u(s+(e-i));o(r)}else if(t===g){const r=f(t,s,m);o(r)}}T?.(t,e,i)},[T,f,m,s,u,o]),K=l((t,e)=>{if(h.current!==void 0&&h.current>=0){const i=f(h.current,s,m);o(i)}b?.(t,e)},[b,f,s,m,o]),z=x(0),M=l(t=>{const e=I.current,i=u(e+t);o(i)},[u,o]),w=l(()=>{const t=n.current?.getContentHeight()??0,e=n.current?.getViewportHeight()??0,i=Math.max(0,t-e),g=u(i);o(g)},[u,o]),V=l(()=>{const t=u(0);o(t)},[u,o]),N=l(()=>z.current,[]);Z({getViewportHeight:N,isActive:A,scrollBy:M,scrollToBottom:w,scrollToTop:V,vimBindings:q}),U(R,()=>({getBottomOffset:a(()=>n.current?.getBottomOffset()??0,"getBottomOffset"),getContentHeight:a(()=>n.current?.getContentHeight()??0,"getContentHeight"),getItemHeight:a(t=>n.current?.getItemHeight(t)??0,"getItemHeight"),getItemPosition:a(t=>n.current?.getItemPosition(t)??null,"getItemPosition"),getScrollOffset:a(()=>I.current,"getScrollOffset"),getViewportHeight:a(()=>n.current?.getViewportHeight()??0,"getViewportHeight"),remeasure:a(()=>n.current?.remeasure(),"remeasure"),remeasureItem:a(t=>n.current?.remeasureItem(t),"remeasureItem"),scrollBy:M,scrollTo:a(t=>{const e=u(t);o(e)},"scrollTo"),scrollToBottom:w,scrollToTop:V}),[u,o,M,w,V]);const W=l((t,e)=>{z.current=t.height,y(t,e)},[y]);return $(_,{onContentHeightChange:K,onItemHeightChange:J,onViewportSizeChange:W,overscan:E,ref:n,scrollOffset:d,virtualize:D,...F,children:C})},"ScrollList");export{ct as ScrollList};
1
+ var Y=Object.defineProperty;var L=(H,C)=>Y(H,"name",{value:C,configurable:!0});import{jsx as $}from"react/jsx-runtime";import{useRef as x,useState as Q,useEffect as j,useCallback as l,useImperativeHandle as U}from"react";import Z from"../ink/hooks/use-scroll-input.js";import{C as _}from"./controlled-scroll-view-CFM7ZV9N.js";var tt=Object.defineProperty,a=L((H,C)=>tt(H,"name",{value:C,configurable:!0}),"u");const ct=a(H=>{const{children:C,keyboard:A=!1,onContentHeightChange:b,onItemHeightChange:T,onScroll:O,onViewportSizeChange:P,overscan:E,ref:R,scrollAlignment:m="auto",selectedIndex:v,vimBindings:q=!1,virtualize:D,...F}=H,n=x(null),[s,G]=Q(0),I=x(0);j(()=>{I.current=s},[s]);const o=l(t=>{t!==I.current&&(G(t),O?.(t))},[O]),h=x(v);h.current=v;const k=l(()=>{const t=h.current;if(t===void 0||t<0)return null;const e=n.current?.getItemPosition(t);if(!e)return null;const i=n.current?.getViewportHeight()??0,g=n.current?.getContentHeight()??0;let r=e.top+e.height-i,c=e.top;r>c&&([r,c]=[c,r]);const B=Math.max(0,g-i);return{max:Math.min(B,c),min:Math.max(0,r)}},[]),u=l(t=>{const e=n.current?.getContentHeight()??0,i=n.current?.getViewportHeight()??0,g=Math.max(0,e-i);let r=Math.max(0,Math.min(t,g));const c=k();return c&&(r=Math.max(c.min,Math.min(r,c.max))),r},[k]),f=l((t,e,i,g)=>{const r=n.current?.getItemPosition(t);if(!r)return e;const c=g??n.current?.getViewportHeight()??0,B=n.current?.getContentHeight()??0;let p=e;switch(i){case"bottom":{p=r.top+r.height-c;break}case"center":{p=r.top+r.height/2-c/2;break}case"top":{p=r.top;break}default:{const S=r.top+r.height;r.top<=e&&S>=e+c?p=e:r.top<e?p=r.top:S>e+c&&(p=S-c)}}const X=Math.max(0,B-c);return Math.max(0,Math.min(p,X))},[]);let d=s;v!==void 0&&v>=0&&(d=f(v,s,m)),j(()=>{d!==s&&o(d)},[d,s,o]);const y=l((t,e)=>{if(h.current!==void 0&&h.current>=0){const i=f(h.current,s,m,t.height);o(i)}P?.(t,e)},[P,f,s,m,o]),J=l((t,e,i)=>{const g=h.current;if(g!==void 0&&g>=0){if(t<g){const r=u(s+(e-i));o(r)}else if(t===g){const r=f(t,s,m);o(r)}}T?.(t,e,i)},[T,f,m,s,u,o]),K=l((t,e)=>{if(h.current!==void 0&&h.current>=0){const i=f(h.current,s,m);o(i)}b?.(t,e)},[b,f,s,m,o]),z=x(0),M=l(t=>{const e=I.current,i=u(e+t);o(i)},[u,o]),w=l(()=>{const t=n.current?.getContentHeight()??0,e=n.current?.getViewportHeight()??0,i=Math.max(0,t-e),g=u(i);o(g)},[u,o]),V=l(()=>{const t=u(0);o(t)},[u,o]),N=l(()=>z.current,[]);Z({getViewportHeight:N,isActive:A,scrollBy:M,scrollToBottom:w,scrollToTop:V,vimBindings:q}),U(R,()=>({getBottomOffset:a(()=>n.current?.getBottomOffset()??0,"getBottomOffset"),getContentHeight:a(()=>n.current?.getContentHeight()??0,"getContentHeight"),getItemHeight:a(t=>n.current?.getItemHeight(t)??0,"getItemHeight"),getItemPosition:a(t=>n.current?.getItemPosition(t)??null,"getItemPosition"),getScrollOffset:a(()=>I.current,"getScrollOffset"),getViewportHeight:a(()=>n.current?.getViewportHeight()??0,"getViewportHeight"),remeasure:a(()=>n.current?.remeasure(),"remeasure"),remeasureItem:a(t=>n.current?.remeasureItem(t),"remeasureItem"),scrollBy:M,scrollTo:a(t=>{const e=u(t);o(e)},"scrollTo"),scrollToBottom:w,scrollToTop:V}),[u,o,M,w,V]);const W=l((t,e)=>{z.current=t.height,y(t,e)},[y]);return $(_,{onContentHeightChange:K,onItemHeightChange:J,onViewportSizeChange:W,overscan:E,ref:n,scrollOffset:d,virtualize:D,...F,children:C})},"ScrollList");export{ct as ScrollList};
@@ -1 +1 @@
1
- var X=Object.defineProperty;var D=(c,s)=>X(c,"name",{value:s,configurable:!0});import{jsxs as ee,jsx as M}from"react/jsx-runtime";import{useRef as g,useState as F,useCallback as o,useImperativeHandle as te}from"react";import re from"../ink/hooks/use-scroll-input.js";import{Box as oe}from"../components/box.js";import{R as ne,C as Y}from"./controlled-scroll-view-CikQ90_V.js";import{ScrollBar as le}from"./ScrollBar-U_37hlIT.js";var ie=Object.defineProperty,a=D((c,s)=>ie(c,"name",{value:s,configurable:!0}),"c");const ge=a(({children:c,debug:s=!1,followOutput:T=!1,followThreshold:V=3,keyboard:Z=!1,onContentHeightChange:y,onItemHeightChange:O,onReachEnd:x,onReachStart:H,onScroll:z,onViewportSizeChange:N,overscan:P,reachThreshold:h=5,ref:_,scrollbar:q=!1,scrollbarColor:J,scrollbarStyle:K="line",vimBindings:L=!1,virtualize:G,...p})=>{const[d,R,n]=ne(0),u=g(null),m=g(0),l=g(0),[j,Q]=F(0),[v,U]=F(0),w=g(!1),S=g(!1),i=o(()=>Math.max(0,m.current-l.current),[]),k=o(e=>{const r=i();x&&e>=r-h&&!w.current?(w.current=!0,x()):e<r-h&&(w.current=!1),H&&e<=h&&!S.current?(S.current=!0,H()):e>h&&(S.current=!1)},[x,H,h,i]),t=o(e=>{e!==n()&&(R(e),z?.(e),k(e))},[n,R,z,k]),E=o((e,r)=>{const f=n()>=i()-V;if(m.current=e,Q(e),y?.(e,r),T&&f&&e>r){const C=Math.max(0,e-l.current);t(C)}else{const C=Math.max(0,e-l.current);n()>C&&t(C)}},[y,T,V,n,i,t]),$=o((e,r)=>{l.current=e.height,U(e.height),N?.(e,r)},[N]),I=o(e=>{if(typeof e!="number"||Number.isNaN(e))return;const r=Math.max(0,m.current-l.current),f=Math.max(0,Math.min(n()+e,r));t(f)},[n,t]),A=o(e=>{if(typeof e!="number"||Number.isNaN(e))return;const r=Math.max(0,m.current-l.current),f=Math.max(0,Math.min(e,r));t(f)},[t]),b=o(()=>{const e=i();t(e)},[i,t]),B=o(()=>{t(0)},[t]),W=o(()=>l.current,[]);return re({getViewportHeight:W,isActive:Z,scrollBy:I,scrollToBottom:b,scrollToTop:B,vimBindings:L}),te(_,()=>({getBottomOffset:i,getContentHeight:a(()=>m.current,"getContentHeight"),getItemHeight:a(e=>u.current?.getItemHeight(e)??0,"getItemHeight"),getItemPosition:a(e=>u.current?.getItemPosition(e)??null,"getItemPosition"),getScrollOffset:n,getViewportHeight:a(()=>l.current,"getViewportHeight"),remeasure:a(()=>u.current?.remeasure(),"remeasure"),remeasureItem:a(e=>u.current?.remeasureItem(e),"remeasureItem"),scrollBy:I,scrollTo:A,scrollToBottom:b,scrollToTop:B}),[i,n,I,A,b,B]),q&&j>v&&v>0?ee(oe,{flexDirection:"row",flexGrow:p.flexGrow,flexShrink:p.flexShrink,overflow:"hidden",children:[M(Y,{children:c,debug:s,onContentHeightChange:E,onItemHeightChange:O,onViewportSizeChange:$,overscan:P,ref:u,scrollOffset:d,virtualize:G,...p,flexGrow:1}),M(le,{color:J,contentHeight:j,placement:"inset",scrollOffset:d,style:K,viewportHeight:v})]}):M(Y,{children:c,debug:s,onContentHeightChange:E,onItemHeightChange:O,onViewportSizeChange:$,overscan:P,ref:u,scrollOffset:d,virtualize:G,...p})},"ScrollView");export{ge as ScrollView};
1
+ var X=Object.defineProperty;var D=(c,s)=>X(c,"name",{value:s,configurable:!0});import{jsxs as ee,jsx as M}from"react/jsx-runtime";import{useRef as g,useState as F,useCallback as o,useImperativeHandle as te}from"react";import re from"../ink/hooks/use-scroll-input.js";import{Box as oe}from"../components/box.js";import{R as ne,C as Y}from"./controlled-scroll-view-CFM7ZV9N.js";import{ScrollBar as le}from"./ScrollBar-U_37hlIT.js";var ie=Object.defineProperty,a=D((c,s)=>ie(c,"name",{value:s,configurable:!0}),"c");const ge=a(({children:c,debug:s=!1,followOutput:T=!1,followThreshold:V=3,keyboard:Z=!1,onContentHeightChange:y,onItemHeightChange:O,onReachEnd:x,onReachStart:H,onScroll:z,onViewportSizeChange:N,overscan:P,reachThreshold:h=5,ref:_,scrollbar:q=!1,scrollbarColor:J,scrollbarStyle:K="line",vimBindings:L=!1,virtualize:G,...p})=>{const[d,R,n]=ne(0),u=g(null),m=g(0),l=g(0),[j,Q]=F(0),[v,U]=F(0),w=g(!1),S=g(!1),i=o(()=>Math.max(0,m.current-l.current),[]),k=o(e=>{const r=i();x&&e>=r-h&&!w.current?(w.current=!0,x()):e<r-h&&(w.current=!1),H&&e<=h&&!S.current?(S.current=!0,H()):e>h&&(S.current=!1)},[x,H,h,i]),t=o(e=>{e!==n()&&(R(e),z?.(e),k(e))},[n,R,z,k]),E=o((e,r)=>{const f=n()>=i()-V;if(m.current=e,Q(e),y?.(e,r),T&&f&&e>r){const C=Math.max(0,e-l.current);t(C)}else{const C=Math.max(0,e-l.current);n()>C&&t(C)}},[y,T,V,n,i,t]),$=o((e,r)=>{l.current=e.height,U(e.height),N?.(e,r)},[N]),I=o(e=>{if(typeof e!="number"||Number.isNaN(e))return;const r=Math.max(0,m.current-l.current),f=Math.max(0,Math.min(n()+e,r));t(f)},[n,t]),A=o(e=>{if(typeof e!="number"||Number.isNaN(e))return;const r=Math.max(0,m.current-l.current),f=Math.max(0,Math.min(e,r));t(f)},[t]),b=o(()=>{const e=i();t(e)},[i,t]),B=o(()=>{t(0)},[t]),W=o(()=>l.current,[]);return re({getViewportHeight:W,isActive:Z,scrollBy:I,scrollToBottom:b,scrollToTop:B,vimBindings:L}),te(_,()=>({getBottomOffset:i,getContentHeight:a(()=>m.current,"getContentHeight"),getItemHeight:a(e=>u.current?.getItemHeight(e)??0,"getItemHeight"),getItemPosition:a(e=>u.current?.getItemPosition(e)??null,"getItemPosition"),getScrollOffset:n,getViewportHeight:a(()=>l.current,"getViewportHeight"),remeasure:a(()=>u.current?.remeasure(),"remeasure"),remeasureItem:a(e=>u.current?.remeasureItem(e),"remeasureItem"),scrollBy:I,scrollTo:A,scrollToBottom:b,scrollToTop:B}),[i,n,I,A,b,B]),q&&j>v&&v>0?ee(oe,{flexDirection:"row",flexGrow:p.flexGrow,flexShrink:p.flexShrink,overflow:"hidden",children:[M(Y,{children:c,debug:s,onContentHeightChange:E,onItemHeightChange:O,onViewportSizeChange:$,overscan:P,ref:u,scrollOffset:d,virtualize:G,...p,flexGrow:1}),M(le,{color:J,contentHeight:j,placement:"inset",scrollOffset:d,style:K,viewportHeight:v})]}):M(Y,{children:c,debug:s,onContentHeightChange:E,onItemHeightChange:O,onViewportSizeChange:$,overscan:P,ref:u,scrollOffset:d,virtualize:G,...p})},"ScrollView");export{ge as ScrollView};
@@ -1 +1 @@
1
- var N=Object.defineProperty;var g=(n,t)=>N(n,"name",{value:t,configurable:!0});import{g as m}from"./dom-CMbdnYbk.js";import{t as O}from"./measure-text-CIs55Wao.js";import{squashTextNodesWithMap as S}from"./squashTextNodesWithMap-Cpqmc45i.js";var v=Object.defineProperty,l=g((n,t)=>v(n,"name",{value:t,configurable:!0}),"f");const x=l(n=>{if(n.nodeName==="#text"){const r=O(n.nodeValue);return{charOffsetMap:new Map([[n,{end:r.length,start:0}]]),styledLine:r}}const t=new Map,e=S(n,t,{current:0}),s=O(e);return t.set(n,{end:s.length,start:0}),{charOffsetMap:t,styledLine:s}},"getPlainTextFromDomNode"),y=l((n,t)=>{if(!n.startContainer||!n.endContainer)return;const e=l((i,h)=>{const o=t.get(i);if(!o)return;if(i.nodeName==="#text")return o.start+h;const d=i;if(h>=d.childNodes.length)return o.end;const a=d.childNodes[h],u=t.get(a);if(u)return u.start;for(let f=h-1;f>=0;f--){const c=d.childNodes[f],C=t.get(c);if(C)return C.end}return o.start},"getOffset"),s=e(n.startContainer,n.startOffset),r=e(n.endContainer,n.endOffset);if(!(s===void 0||r===void 0))return{end:r,start:s}},"getRangeCharacterOffsets"),p=l((n,t,e,s)=>{if(n===e)return t===s?0:t<s?-1:1;const r=m(n),i=m(e);let h,o=0;for(;o<r.length&&o<i.length&&r[o]===i[o];)h=r[o],o++;if(!h)return 0;if(o===r.length){const c=i[o],C=n.childNodes.indexOf(c);return t<=C?-1:1}if(o===i.length){const c=r[o];return e.childNodes.indexOf(c)<s?-1:1}const d=r[o],a=i[o],u=h.childNodes.indexOf(d),f=h.childNodes.indexOf(a);return u<f?-1:1},"comparePoints");class A{static{g(this,"Range")}static{l(this,"Range")}startContainer=void 0;startOffset=0;endContainer=void 0;endOffset=0;collapsed=!0;commonAncestorContainer=void 0;setStart(t,e){this.startContainer=t,this.startOffset=e,this.updateCollapsed(),this.updateCommonAncestor()}setEnd(t,e){this.endContainer=t,this.endOffset=e,this.updateCollapsed(),this.updateCommonAncestor()}collapse(t){t?(this.endContainer=this.startContainer,this.endOffset=this.startOffset):(this.startContainer=this.endContainer,this.startOffset=this.endOffset),this.collapsed=!0,this.updateCommonAncestor()}selectNode(t){if(!t.parentNode)throw new Error("Node has no parent");const e=t.parentNode.childNodes.indexOf(t);this.setStart(t.parentNode,e),this.setEnd(t.parentNode,e+1)}selectNodeContents(t){this.setStart(t,0),t.nodeName==="#text"?this.setEnd(t,t.nodeValue.length):this.setEnd(t,t.childNodes.length)}toString(){if(this.collapsed||!this.startContainer||!this.endContainer||!this.commonAncestorContainer)return"";const{charOffsetMap:t,styledLine:e}=x(this.commonAncestorContainer),s=y(this,t);if(!s)return"";const r=e.slice(s.start,s.end);return r.getTextRange(0,r.length)}updateCollapsed(){this.collapsed=this.startContainer===this.endContainer&&this.startOffset===this.endOffset}updateCommonAncestor(){if(!this.startContainer||!this.endContainer){this.commonAncestorContainer=void 0;return}if(this.startContainer===this.endContainer){this.commonAncestorContainer=this.startContainer;return}const t=m(this.startContainer),e=m(this.endContainer);let s;for(let r=0;r<Math.min(t.length,e.length)&&t[r]===e[r];r++)s=t[r];this.commonAncestorContainer=s}}class L{static{g(this,"Selection")}static{l(this,"Selection")}anchorNode=void 0;anchorOffset=0;focusNode=void 0;focusOffset=0;isCollapsed=!0;rangeCount=0;ranges=[];listeners=new Set;onChange(t){return this.listeners.add(t),()=>{this.listeners.delete(t)}}toString(){return this.ranges.map(t=>t.toString()).join("")}getRangeAt(t){return this.ranges[t]}addRange(t){this.ranges.includes(t)||(this.ranges.push(t),this.rangeCount=this.ranges.length,this.rangeCount===1&&(this.anchorNode=t.startContainer,this.anchorOffset=t.startOffset,this.focusNode=t.endContainer,this.focusOffset=t.endOffset,this.isCollapsed=t.collapsed),this.notifyChange())}removeRange(t){const e=this.ranges.indexOf(t);e!==-1&&(this.ranges.splice(e,1),this.rangeCount=this.ranges.length,this.rangeCount===0&&this.clearState(),this.notifyChange())}removeAllRanges(){this.ranges=[],this.rangeCount=0,this.clearState(),this.notifyChange()}collapse(t,e){this.removeAllRanges();const s=new A;s.setStart(t,e),s.setEnd(t,e),this.addRange(s)}containsNode(t,e=!1){if(!t.parentNode)return!1;const s=t.parentNode,r=s.childNodes.indexOf(t),i=s,h=r,o=s,d=r+1;return this.ranges.some(a=>{if(!a.startContainer||!a.endContainer)return!1;const u=p(a.startContainer,a.startOffset,i,h),f=p(a.endContainer,a.endOffset,o,d);if(e){const c=p(a.startContainer,a.startOffset,o,d),C=p(a.endContainer,a.endOffset,i,h);return c<0&&C>0}return u<=0&&f>=0})}clearState(){this.anchorNode=void 0,this.anchorOffset=0,this.focusNode=void 0,this.focusOffset=0,this.isCollapsed=!0}notifyChange(){for(const t of this.listeners)t()}}const T=l((n,t)=>{if(n.length===0||t.start>=t.end)return n;const e=n.clone(),s=Math.max(0,t.start),r=Math.min(n.length,t.end);for(let i=s;i<r;i++)e.setInverted(i,!0);return e},"applySelectionToStyledLine");export{A as Range,L as Selection,T as applySelectionToStyledLine,p as comparePoints};
1
+ var N=Object.defineProperty;var g=(n,t)=>N(n,"name",{value:t,configurable:!0});import{g as m}from"./dom-UWZI4lDM.js";import{t as O}from"./measure-text-D-jVetsl.js";import{squashTextNodesWithMap as S}from"./squashTextNodesWithMap-Cpqmc45i.js";var v=Object.defineProperty,l=g((n,t)=>v(n,"name",{value:t,configurable:!0}),"f");const x=l(n=>{if(n.nodeName==="#text"){const r=O(n.nodeValue);return{charOffsetMap:new Map([[n,{end:r.length,start:0}]]),styledLine:r}}const t=new Map,e=S(n,t,{current:0}),s=O(e);return t.set(n,{end:s.length,start:0}),{charOffsetMap:t,styledLine:s}},"getPlainTextFromDomNode"),y=l((n,t)=>{if(!n.startContainer||!n.endContainer)return;const e=l((i,h)=>{const o=t.get(i);if(!o)return;if(i.nodeName==="#text")return o.start+h;const d=i;if(h>=d.childNodes.length)return o.end;const a=d.childNodes[h],u=t.get(a);if(u)return u.start;for(let f=h-1;f>=0;f--){const c=d.childNodes[f],C=t.get(c);if(C)return C.end}return o.start},"getOffset"),s=e(n.startContainer,n.startOffset),r=e(n.endContainer,n.endOffset);if(!(s===void 0||r===void 0))return{end:r,start:s}},"getRangeCharacterOffsets"),p=l((n,t,e,s)=>{if(n===e)return t===s?0:t<s?-1:1;const r=m(n),i=m(e);let h,o=0;for(;o<r.length&&o<i.length&&r[o]===i[o];)h=r[o],o++;if(!h)return 0;if(o===r.length){const c=i[o],C=n.childNodes.indexOf(c);return t<=C?-1:1}if(o===i.length){const c=r[o];return e.childNodes.indexOf(c)<s?-1:1}const d=r[o],a=i[o],u=h.childNodes.indexOf(d),f=h.childNodes.indexOf(a);return u<f?-1:1},"comparePoints");class A{static{g(this,"Range")}static{l(this,"Range")}startContainer=void 0;startOffset=0;endContainer=void 0;endOffset=0;collapsed=!0;commonAncestorContainer=void 0;setStart(t,e){this.startContainer=t,this.startOffset=e,this.updateCollapsed(),this.updateCommonAncestor()}setEnd(t,e){this.endContainer=t,this.endOffset=e,this.updateCollapsed(),this.updateCommonAncestor()}collapse(t){t?(this.endContainer=this.startContainer,this.endOffset=this.startOffset):(this.startContainer=this.endContainer,this.startOffset=this.endOffset),this.collapsed=!0,this.updateCommonAncestor()}selectNode(t){if(!t.parentNode)throw new Error("Node has no parent");const e=t.parentNode.childNodes.indexOf(t);this.setStart(t.parentNode,e),this.setEnd(t.parentNode,e+1)}selectNodeContents(t){this.setStart(t,0),t.nodeName==="#text"?this.setEnd(t,t.nodeValue.length):this.setEnd(t,t.childNodes.length)}toString(){if(this.collapsed||!this.startContainer||!this.endContainer||!this.commonAncestorContainer)return"";const{charOffsetMap:t,styledLine:e}=x(this.commonAncestorContainer),s=y(this,t);if(!s)return"";const r=e.slice(s.start,s.end);return r.getTextRange(0,r.length)}updateCollapsed(){this.collapsed=this.startContainer===this.endContainer&&this.startOffset===this.endOffset}updateCommonAncestor(){if(!this.startContainer||!this.endContainer){this.commonAncestorContainer=void 0;return}if(this.startContainer===this.endContainer){this.commonAncestorContainer=this.startContainer;return}const t=m(this.startContainer),e=m(this.endContainer);let s;for(let r=0;r<Math.min(t.length,e.length)&&t[r]===e[r];r++)s=t[r];this.commonAncestorContainer=s}}class L{static{g(this,"Selection")}static{l(this,"Selection")}anchorNode=void 0;anchorOffset=0;focusNode=void 0;focusOffset=0;isCollapsed=!0;rangeCount=0;ranges=[];listeners=new Set;onChange(t){return this.listeners.add(t),()=>{this.listeners.delete(t)}}toString(){return this.ranges.map(t=>t.toString()).join("")}getRangeAt(t){return this.ranges[t]}addRange(t){this.ranges.includes(t)||(this.ranges.push(t),this.rangeCount=this.ranges.length,this.rangeCount===1&&(this.anchorNode=t.startContainer,this.anchorOffset=t.startOffset,this.focusNode=t.endContainer,this.focusOffset=t.endOffset,this.isCollapsed=t.collapsed),this.notifyChange())}removeRange(t){const e=this.ranges.indexOf(t);e!==-1&&(this.ranges.splice(e,1),this.rangeCount=this.ranges.length,this.rangeCount===0&&this.clearState(),this.notifyChange())}removeAllRanges(){this.ranges=[],this.rangeCount=0,this.clearState(),this.notifyChange()}collapse(t,e){this.removeAllRanges();const s=new A;s.setStart(t,e),s.setEnd(t,e),this.addRange(s)}containsNode(t,e=!1){if(!t.parentNode)return!1;const s=t.parentNode,r=s.childNodes.indexOf(t),i=s,h=r,o=s,d=r+1;return this.ranges.some(a=>{if(!a.startContainer||!a.endContainer)return!1;const u=p(a.startContainer,a.startOffset,i,h),f=p(a.endContainer,a.endOffset,o,d);if(e){const c=p(a.startContainer,a.startOffset,o,d),C=p(a.endContainer,a.endOffset,i,h);return c<0&&C>0}return u<=0&&f>=0})}clearState(){this.anchorNode=void 0,this.anchorOffset=0,this.focusNode=void 0,this.focusOffset=0,this.isCollapsed=!0}notifyChange(){for(const t of this.listeners)t()}}const T=l((n,t)=>{if(n.length===0||t.start>=t.end)return n;const e=n.clone(),s=Math.max(0,t.start),r=Math.min(n.length,t.end);for(let i=s;i<r;i++)e.setInverted(i,!0);return e},"applySelectionToStyledLine");export{A as Range,L as Selection,T as applySelectionToStyledLine,p as comparePoints};
@@ -1 +1 @@
1
- var tr=Object.defineProperty;var L=(n,o)=>tr(n,"name",{value:o,configurable:!0});import{jsx as M,jsxs as nr}from"react/jsx-runtime";import{useState as U,useRef as d,useCallback as A,useLayoutEffect as q,isValidElement as E,useImperativeHandle as cr,Fragment as G}from"react";import{P as W}from"./layout-P24eyWyL.js";import{Box as b}from"../components/box.js";var ur=Object.defineProperty,or=L((n,o)=>ur(n,"name",{value:o,configurable:!0}),"r");const Q=or(n=>{const[o,m]=U(n),s=d(n),H=A(C=>{const S=typeof C=="function"?C(s.current):C;s.current=S,m(S)},[]),v=A(()=>s.current,[]);return[o,H,v]},"useStateRef");var ir=Object.defineProperty,x=L((n,o)=>ir(n,"name",{value:o,configurable:!0}),"b");const lr=x(({children:n,index:o,measureKey:m,onMeasure:s,width:H})=>{const v=d(null);return q(()=>{if(v.current){const{height:C}=W(v.current);s(o,C)}},[o,s,H,m,n]),M(b,{flexDirection:"column",flexShrink:0,ref:v,width:"100%",children:n})},"MeasurableItem"),R=x(n=>{if(n==null)return[];if(Array.isArray(n)){const o=[];for(let m=0;m<n.length;m+=1){const s=n[m];E(s)&&s.type===G?o.push(...R(s.props.children)):o.push(s)}return o}return E(n)&&n.type===G?R(n.props.children):[n]},"toChildArray"),mr=x(({children:n,debug:o=!1,onContentHeightChange:m,onItemHeightChange:s,onViewportSizeChange:H,overscan:v=3,ref:C,scrollOffset:S,virtualize:X=!1,...Y})=>{const D=d(!1),[J,N,V]=Q({height:0,width:0}),[O,K,P]=Q(0),[Z,_]=U({}),j=d(null),T=d(0);q(()=>{O!==T.current&&(m?.(O,T.current),T.current=O)},[O,m]);const i=d({}),h=d([]),p=d([]),f=d(0),rr=A((r,e)=>{const t=h.current[r]??r;if(i.current[t]!==e){const l=i.current[t]??0;i.current={...i.current,[t]:e};let c=0;for(let a=0;a<h.current.length;a+=1){const y=h.current[a];y!=null&&(c+=i.current[y]??0)}const u=P();c!==u&&K(c),s?.(r,e,l),f.current=Math.min(f.current,r+1)}},[s,P,K]),$=A(()=>{if(j.current){const{height:r,width:e}=W(j.current),t=V();(e!==t.width||r!==t.height)&&(H?.({height:r,width:e},t),N({height:r,width:e}))}},[j,H,V,N]);q(()=>{$()});const z=d(null);if(z.current!==n){z.current=n;const r=[],e={};R(n).forEach((c,u)=>{if(!c)return;const a=(E(c)?c.key:null)??u;r[u]=a;const y=i.current[a]??0;e[a]=y}),i.current=e,h.current=r,p.current=Array.from({length:r.length}).fill(0),f.current=0;let t=0;r.forEach(c=>{t+=e[c]??0});const l=P();t!==l&&K(t)}cr(C,()=>({getBottomOffset:x(()=>Math.max(0,P()-V().height),"getBottomOffset"),getContentHeight:P,getItemHeight:x(r=>{const e=h.current[r]??r;return i.current[e]??0},"getItemHeight"),getItemPosition:x(r=>{if(r<0||r>=h.current.length)return null;if(r>=f.current){let l=0,c=0;if(f.current>0){c=f.current;const u=c-1,a=h.current[u]??u,y=i.current[a]??0;l=(p.current[u]??0)+y}for(let u=c;u<=r;u+=1){p.current[u]=l;const a=h.current[u]??u,y=i.current[a]??0;l+=y}f.current=r+1}const e=p.current[r]??0,t=h.current[r]??r;return{height:i.current[t]??0,top:e}},"getItemPosition"),getViewportHeight:x(()=>V().height,"getViewportHeight"),remeasure:$,remeasureItem:x(r=>{_(e=>({...e,[r]:(e[r]??0)+1}))},"remeasureItem")}),[$,P,V,_]);const I=R(n);!D.current&&O>0&&(D.current=!0);let w=0,g=I.length-1,B=0,F=0;const er=I.length>0&&I.every((r,e)=>{const t=h.current[e]??e;return(i.current[t]??0)>0}),k=X&&D.current&&er;if(k){const r=h.current.length;if(f.current<r){let t=0,l=0;if(f.current>0){l=f.current;const c=l-1,u=h.current[c]??c,a=i.current[u]??0;t=(p.current[c]??0)+a}for(let c=l;c<r;c+=1){p.current[c]=t;const u=h.current[c]??c;t+=i.current[u]??0}f.current=r}const e=S+J.height;w=I.length,g=-1;for(let t=0;t<r;t+=1){const l=p.current[t]??0,c=h.current[t]??t,u=i.current[c]??0;l+u>S&&l<e&&(t<w&&(w=t),g=t)}if(w>g&&(w=0,g=-1),w=Math.max(0,w-v),g=Math.min(I.length-1,Math.max(-1,g)+v),B=p.current[w]??0,g<I.length-1){const t=h.current[g]??g,l=(p.current[g]??0)+(i.current[t]??0);F=O-l}}return M(b,{...Y,children:M(b,{ref:j,width:"100%",children:M(b,{overflow:o?void 0:"hidden",width:"100%",children:nr(b,{flexDirection:"column",marginTop:-S,width:"100%",children:[k&&B>0&&M(b,{height:B}),I.map((r,e)=>!r||k&&(e<w||e>g)?null:M(lr,{index:e,measureKey:Z[e],onMeasure:rr,width:J.width,children:r},E(r)?r.key??e:e)),k&&F>0&&M(b,{height:F})]})})})})},"ControlledScrollView");export{mr as C,Q as R};
1
+ var tr=Object.defineProperty;var L=(n,o)=>tr(n,"name",{value:o,configurable:!0});import{jsx as M,jsxs as nr}from"react/jsx-runtime";import{useState as U,useRef as d,useCallback as A,useLayoutEffect as q,isValidElement as E,useImperativeHandle as cr,Fragment as G}from"react";import{P as W}from"./layout-D5zRYQRE.js";import{Box as b}from"../components/box.js";var ur=Object.defineProperty,or=L((n,o)=>ur(n,"name",{value:o,configurable:!0}),"r");const Q=or(n=>{const[o,m]=U(n),s=d(n),H=A(C=>{const S=typeof C=="function"?C(s.current):C;s.current=S,m(S)},[]),v=A(()=>s.current,[]);return[o,H,v]},"useStateRef");var ir=Object.defineProperty,x=L((n,o)=>ir(n,"name",{value:o,configurable:!0}),"b");const lr=x(({children:n,index:o,measureKey:m,onMeasure:s,width:H})=>{const v=d(null);return q(()=>{if(v.current){const{height:C}=W(v.current);s(o,C)}},[o,s,H,m,n]),M(b,{flexDirection:"column",flexShrink:0,ref:v,width:"100%",children:n})},"MeasurableItem"),R=x(n=>{if(n==null)return[];if(Array.isArray(n)){const o=[];for(let m=0;m<n.length;m+=1){const s=n[m];E(s)&&s.type===G?o.push(...R(s.props.children)):o.push(s)}return o}return E(n)&&n.type===G?R(n.props.children):[n]},"toChildArray"),mr=x(({children:n,debug:o=!1,onContentHeightChange:m,onItemHeightChange:s,onViewportSizeChange:H,overscan:v=3,ref:C,scrollOffset:S,virtualize:X=!1,...Y})=>{const D=d(!1),[J,N,V]=Q({height:0,width:0}),[O,K,P]=Q(0),[Z,_]=U({}),j=d(null),T=d(0);q(()=>{O!==T.current&&(m?.(O,T.current),T.current=O)},[O,m]);const i=d({}),h=d([]),p=d([]),f=d(0),rr=A((r,e)=>{const t=h.current[r]??r;if(i.current[t]!==e){const l=i.current[t]??0;i.current={...i.current,[t]:e};let c=0;for(let a=0;a<h.current.length;a+=1){const y=h.current[a];y!=null&&(c+=i.current[y]??0)}const u=P();c!==u&&K(c),s?.(r,e,l),f.current=Math.min(f.current,r+1)}},[s,P,K]),$=A(()=>{if(j.current){const{height:r,width:e}=W(j.current),t=V();(e!==t.width||r!==t.height)&&(H?.({height:r,width:e},t),N({height:r,width:e}))}},[j,H,V,N]);q(()=>{$()});const z=d(null);if(z.current!==n){z.current=n;const r=[],e={};R(n).forEach((c,u)=>{if(!c)return;const a=(E(c)?c.key:null)??u;r[u]=a;const y=i.current[a]??0;e[a]=y}),i.current=e,h.current=r,p.current=Array.from({length:r.length}).fill(0),f.current=0;let t=0;r.forEach(c=>{t+=e[c]??0});const l=P();t!==l&&K(t)}cr(C,()=>({getBottomOffset:x(()=>Math.max(0,P()-V().height),"getBottomOffset"),getContentHeight:P,getItemHeight:x(r=>{const e=h.current[r]??r;return i.current[e]??0},"getItemHeight"),getItemPosition:x(r=>{if(r<0||r>=h.current.length)return null;if(r>=f.current){let l=0,c=0;if(f.current>0){c=f.current;const u=c-1,a=h.current[u]??u,y=i.current[a]??0;l=(p.current[u]??0)+y}for(let u=c;u<=r;u+=1){p.current[u]=l;const a=h.current[u]??u,y=i.current[a]??0;l+=y}f.current=r+1}const e=p.current[r]??0,t=h.current[r]??r;return{height:i.current[t]??0,top:e}},"getItemPosition"),getViewportHeight:x(()=>V().height,"getViewportHeight"),remeasure:$,remeasureItem:x(r=>{_(e=>({...e,[r]:(e[r]??0)+1}))},"remeasureItem")}),[$,P,V,_]);const I=R(n);!D.current&&O>0&&(D.current=!0);let w=0,g=I.length-1,B=0,F=0;const er=I.length>0&&I.every((r,e)=>{const t=h.current[e]??e;return(i.current[t]??0)>0}),k=X&&D.current&&er;if(k){const r=h.current.length;if(f.current<r){let t=0,l=0;if(f.current>0){l=f.current;const c=l-1,u=h.current[c]??c,a=i.current[u]??0;t=(p.current[c]??0)+a}for(let c=l;c<r;c+=1){p.current[c]=t;const u=h.current[c]??c;t+=i.current[u]??0}f.current=r}const e=S+J.height;w=I.length,g=-1;for(let t=0;t<r;t+=1){const l=p.current[t]??0,c=h.current[t]??t,u=i.current[c]??0;l+u>S&&l<e&&(t<w&&(w=t),g=t)}if(w>g&&(w=0,g=-1),w=Math.max(0,w-v),g=Math.min(I.length-1,Math.max(-1,g)+v),B=p.current[w]??0,g<I.length-1){const t=h.current[g]??g,l=(p.current[g]??0)+(i.current[t]??0);F=O-l}}return M(b,{...Y,children:M(b,{ref:j,width:"100%",children:M(b,{overflow:o?void 0:"hidden",width:"100%",children:nr(b,{flexDirection:"column",marginTop:-S,width:"100%",children:[k&&B>0&&M(b,{height:B}),I.map((r,e)=>!r||k&&(e<w||e>g)?null:M(lr,{index:e,measureKey:Z[e],onMeasure:rr,width:J.width,children:r},E(r)?r.key??e:e)),k&&F>0&&M(b,{height:F})]})})})})},"ControlledScrollView");export{mr as C,Q as R};
@@ -1,4 +1,4 @@
1
- var he=Object.defineProperty;var b=(e,t)=>he(e,"name",{value:t,configurable:!0});import fe from"yoga-layout";import{e as V}from"./measure-text-CIs55Wao.js";import pe from"./squashTextNodesWithMap-Cpqmc45i.js";import{o as B,k as G,G as q,h as K,N as P,m as me,l as E,i as D,d as H,F as ge,b as xe,s as L,t as ve,a as ye}from"./get-string-width-4oMZhv2Q.js";var Be=Object.defineProperty,ee=b((e,t)=>Be(e,"name",{value:t,configurable:!0}),"i"),Ne=Object.defineProperty,te=ee((e,t)=>Ne(e,"name",{value:t,configurable:!0}),"r"),be=Object.defineProperty,we=te((e,t)=>be(e,"name",{value:t,configurable:!0}),"c");class ke{static{b(this,"l")}static{ee(this,"y")}static{te(this,"s")}static{we(this,"LRUCache")}capacity;cache;keyOrder;constructor(t){this.capacity=t,this.cache=new Map,this.keyOrder=[]}get(t){if(this.cache.has(t))return this.keyOrder=this.keyOrder.filter(i=>i!==t),this.keyOrder.push(t),this.cache.get(t)}has(t){return this.cache.has(t)}set(t,i){if(this.cache.has(t))this.keyOrder=this.keyOrder.filter(s=>s!==t);else if(this.cache.size>=this.capacity){const s=this.keyOrder.shift();s!==void 0&&this.cache.delete(s)}this.cache.set(t,i),this.keyOrder.push(t)}delete(t){this.cache.delete(t),this.keyOrder=this.keyOrder.filter(i=>i!==t)}clear(){this.cache.clear(),this.keyOrder=[]}size(){return this.cache.size}}var Se=Object.defineProperty,Ae=b((e,t)=>Se(e,"name",{value:t,configurable:!0}),"S$1"),Ee=Object.defineProperty,$e=Ae((e,t)=>Ee(e,"name",{value:t,configurable:!0}),"w"),We=Object.defineProperty,$=$e((e,t)=>We(e,"name",{value:t,configurable:!0}),"y");const z=new ke(100),Oe=new Intl.Segmenter("en",{granularity:"grapheme"}),Re=/^[\u0000-\u007F]*$/,Te=new Set(["0","22","23","24","27","28","29","39","49"]),Ce=new Set(["1","3","4","7","8","9"]),U=new Map([["22","1"],["23","3"],["24","4"],["27","7"],["28","8"],["29","9"]]),W=$(e=>e>="30"&&e<="37"||e>="90"&&e<="97"||e.startsWith("38;"),"isForegroundColor"),O=$(e=>e>="40"&&e<="47"||e>="100"&&e<="107"||e.startsWith("48;"),"isBackgroundColor"),Fe=[{close:"\x1B[22m",open:"\x1B[1m"},{close:"\x1B[23m",open:"\x1B[3m"},{close:"\x1B[24m",open:"\x1B[4m"},{close:"\x1B[27m",open:"\x1B[7m"},{close:"\x1B[28m",open:"\x1B[8m"},{close:"\x1B[29m",open:"\x1B[9m"}],Y=$((e,t)=>{let i=-1;for(const s of t){const o=e.indexOf(s);o!==-1&&(i===-1||o<i)&&(i=o)}return i},"findFirstPositionOfAny"),_e=$((e,t)=>{if(!e.includes("\x1B"))return[{after:"",before:"",content:e,visibleLength:B(e,t.width)}];const i=z.get(e);if(i)return i;const s=[],o=[];let n=0,a;for(K.lastIndex=0;(a=K.exec(e))!==null;){const c=a[0];s.push(e.slice(n,a.index)),o.push(c),n=a.index+c.length}n<e.length&&s.push(e.slice(n));const l=[];for(const c of o){if(c==="\x1B[0m"||c==="\x1B]8;;\x07"){l.push(c);continue}if(c.startsWith("\x1B[")&&c.endsWith("m")){const u=c.slice(2,-1);if(Te.has(u)){l.push(c);continue}}}const r=new Set,d=[];for(const[c,u]of s.entries()){if(c>0&&o[c-1]){const p=o[c-1];if(p==="\x1B[0m")r.clear();else if(p==="\x1B]8;;\x07"){for(const f of r)if(f.startsWith("\x1B]8;;")&&!f.endsWith("\x1B]8;;\x07")){r.delete(f);break}}else if(p.startsWith("\x1B[")&&p.endsWith("m")){const f=p.slice(2,-1);if(f==="39"){for(const h of r)if(h.startsWith("\x1B[")&&h.endsWith("m")){const g=h.slice(2,-1);if(W(g)){r.delete(h);break}}}else if(f==="49"){for(const h of r)if(h.startsWith("\x1B[")&&h.endsWith("m")){const g=h.slice(2,-1);if(O(g)){r.delete(h);break}}}else if(U.has(f)){const h=U.get(f);for(const g of r)if(g===`\x1B[${h}m`){r.delete(g);break}}else{if(W(f)){for(const h of r)if(h.startsWith("\x1B[")&&h.endsWith("m")){const g=h.slice(2,-1);if(W(g)){r.delete(h);break}}}else if(O(f)){for(const h of r)if(h.startsWith("\x1B[")&&h.endsWith("m")){const g=h.slice(2,-1);if(O(g)){r.delete(h);break}}}else if(Ce.has(f)){const h=`\x1B[${f}m`;r.has(h)&&r.delete(h)}r.add(p)}}else if(p.startsWith("\x1B]8;;")&&!p.endsWith("\x1B]8;;\x07")){for(const f of r)if(f.startsWith("\x1B]8;;")&&!f.endsWith("\x1B]8;;\x07")){r.delete(f);break}r.add(p)}}if(u==="")continue;let m="";if(r.size>0)if(l.includes("\x1B[0m"))m="\x1B[0m";else{const p=[];let f=!1;for(const v of r)if(v.startsWith("\x1B]8;;")&&!v.endsWith("\x1B]8;;\x07")){f=!0;break}f&&l.includes("\x1B]8;;\x07")&&p.push("\x1B]8;;\x07");let h=!1,g=!1;for(const v of r)if(v.startsWith("\x1B[")&&v.endsWith("m")){const N=v.slice(2,-1);W(N)?h=!0:O(N)&&(g=!0)}if(h&&g){const v=Y(e,["\x1B[3","\x1B[9","\x1B[38;"]),N=Y(e,["\x1B[4","\x1B[10","\x1B[48;"]);v>=0&&N>=0?v>N?p.push("\x1B[39m","\x1B[49m"):p.push("\x1B[49m","\x1B[39m"):p.push("\x1B[39m","\x1B[49m")}else h&&p.push("\x1B[39m"),g&&p.push("\x1B[49m");h&&g&&e.includes("\x1B[39m")&&e.includes("\x1B[49m")&&(e.indexOf("\x1B[39m")<e.indexOf("\x1B[49m")?(p.length-=2,p.push("\x1B[39m","\x1B[49m")):e.indexOf("\x1B[49m")<e.indexOf("\x1B[39m")&&(p.length-=2,p.push("\x1B[49m","\x1B[39m")));const j=Fe.filter(v=>r.has(v.open)).map(v=>({position:e.indexOf(v.open),style:v})).filter(v=>v.position>=0).toSorted((v,N)=>N.position-v.position);for(const v of j){const N=v;l.includes(N.style.close)&&p.push(N.style.close)}m=p.join("")}const x=[...r].join("");d.push({after:m,before:x,content:u,visibleLength:B(u,{fullWidth:1,wideWidth:1})})}return z.set(e,d),d},"processIntoStyledSegments"),je=$((e,t,i,s)=>{const o=[...s.segmenter.segment(e)],n=[];let a=0,l=!1;for(const r of o){const d=B(r.segment,s.width),c=a,u=a+d;if(!l)if(c<t){a=u;continue}else l=!0;if(c>=i||u>i)break;n.push(r.segment),a=u}return n.join("")},"fastSlice"),w=$((e,t=0,i=Number.MAX_SAFE_INTEGER,s={})=>{const o={segmenter:Oe,...s};if(t>=i||e==="")return"";const n=B(e,o.width);if(t===0&&i>=n)return e;if(t<0||i<0)throw new RangeError("Negative indices aren't supported");if(!e.includes("\x1B"))return Re.test(e)?e.slice(t,i):je(e,t,i,o);if(G.lastIndex=0,q.lastIndex=0,!G.test(e)&&!q.test(e))return e;const a=_e(e,o);if(a.length===0)return"";let l=0;const r=[];for(const[u,m]of a.entries()){const x=l,p=l+m.visibleLength;if(p>t&&x<i){const f=Math.max(0,t-x),h=Math.min(m.visibleLength,i-x);r.push({end:h,index:u,segment:m,start:f})}l=p}if(r.length===0)return"";const d=[],c=r[0].segment;d.push(c.before);for(let u=0;u<r.length;u++){const{end:m,segment:x,start:p}=r[u];if(p===0&&m===x.visibleLength)d.push(x.content);else{const f=[...o.segmenter.segment(x.content)];d.push(f.slice(p,m).map(h=>h.segment).join(""))}if(u<r.length-1){const f=r[u+1].segment,h=x.after,g=f.before;h!==g&&(h||g)&&d.push(h,g)}}return d.push(r.at(-1).segment.after),d.join("")},"slice");var Ie=Object.defineProperty,Pe=b((e,t)=>Ie(e,"name",{value:t,configurable:!0}),"x"),Le=Object.defineProperty,De=Pe((e,t)=>Le(e,"name",{value:t,configurable:!0}),"T"),He=Object.defineProperty,_=De((e,t)=>He(e,"name",{value:t,configurable:!0}),"f");const X="…",Me=3,R=_((e,t,i=!1)=>{if(e.charAt(t)===" ")return t;const s=i?1:-1,o=Math.min(Me,i?e.length-t:t);for(let n=1;n<=o;n++){const a=t+n*s;if(e.charAt(a)===" ")return a}return t},"findNearestSpace"),T=_((e,t,i)=>P(e,{...i,ellipsis:"",ellipsisWidth:0,limit:t}).index,"widthToIndex"),C=_((e,t,i)=>B(e.slice(0,t),i),"indexToWidth"),Ve=_((e,t,i={})=>{if(typeof e!="string")throw new TypeError(`Expected \`input\` to be a string, got ${typeof e}`);if(typeof t!="number")throw new TypeError(`Expected \`limit\` to be a number, got ${typeof t}`);if(e===""||t<=0)return"";const s=e.normalize("NFC"),{ellipsis:o=X,position:n="end",preferTruncationOnSpace:a=!1}=i;let l=i.ellipsisWidth??o===X?1:void 0;l??=P(o,{...i.width,ellipsis:"",ellipsisWidth:0,limit:Number.POSITIVE_INFINITY}).width;const{width:r}=P(s,{...i.width,ellipsis:o,ellipsisWidth:l});if(r<=t)return s;switch(n){case"end":{if(a){const d=t-l,c=T(s,d,i.width),u=R(s,c),m=C(s,u,i.width);return w(s,0,m,{width:i.width})+o}return w(s,0,t-l,{width:i.width})+o}case"middle":{const d=Math.floor(t/2),c=Math.max(0,t-l),u=Math.min(d,c),m=Math.max(0,c-u);if(a){const x=T(s,u,i.width),p=R(s,x),f=C(s,p,i.width),h=r-m,g=T(s,h,i.width),j=R(s,g,!0),v=C(s,j,i.width);return w(s,0,f,{width:i.width})+o+w(s,v,r,{width:i.width}).trim()}return w(s,0,u,{width:i.width})+o+w(s,r-m,r,{width:i.width})}case"start":{if(a){const d=r-t+l,c=T(s,d,i.width),u=R(s,c,!0),m=C(s,u,i.width);return o+w(s,m,r,{width:i.width}).trim()}return o+w(s,r-t+l,r,{width:i.width})}default:throw new Error(`Invalid position: expected 'start', 'middle' or 'end', got '${n}'`)}},"truncate");var Ge=Object.defineProperty,ie=b((e,t)=>Ge(e,"name",{value:t,configurable:!0}),"b"),qe=Object.defineProperty,A=ie((e,t)=>qe(e,"name",{value:t,configurable:!0}),"d"),Ke=Object.defineProperty,ze=A((e,t)=>Ke(e,"name",{value:t,configurable:!0}),"a");const Ue=/\x1B\[(\d+)m/;let se=class{static{b(this,"T")}static{ie(this,"T")}static{A(this,"d")}static{ze(this,"AnsiStateTracker")}activeForeground=void 0;activeBackground=void 0;activeFormatting=[];processEscape(t){const i=Ue.exec(t);if(!i)return;const s=Number.parseInt(i[1],10);switch(s){case 0:{this.activeForeground=void 0,this.activeBackground=void 0,this.activeFormatting=[];break}case 39:{this.activeForeground=void 0;break}case 49:{this.activeBackground=void 0;break}default:if(s>=30&&s<=37||s>=90&&s<=97)this.activeForeground=t;else if(s>=40&&s<=47||s>=100&&s<=107)this.activeBackground=t;else if([1,2,3,4,7,8,9].includes(s))this.activeFormatting.push(t);else if([22,23,24,27,28,29].includes(s)){const o={22:"[1m",23:"[3m",24:"[4m",27:"[7m",28:"[8m",29:"[9m"}[s];o&&(this.activeFormatting=this.activeFormatting.filter(n=>!n.includes(o)))}}}getStartEscapesForAllActiveAttributes(){return[this.activeBackground,this.activeForeground,...this.activeFormatting].filter(Boolean).join("")}getEndEscapesForAllActiveAttributes(){const t=[];if(this.activeFormatting.length>0){const i={"\x1B[1m":"\x1B[22m","\x1B[2m":"\x1B[22m","\x1B[3m":"\x1B[23m","\x1B[4m":"\x1B[24m","\x1B[7m":"\x1B[27m","\x1B[8m":"\x1B[28m","\x1B[9m":"\x1B[29m"};[...this.activeFormatting].toReversed().forEach(s=>{const o=i[s];o&&t.push(o)})}return this.activeForeground&&t.push("\x1B[39m"),this.activeBackground&&t.push("\x1B[49m"),t.join("")}};var Ye=Object.defineProperty,re=A((e,t)=>Ye(e,"name",{value:t,configurable:!0}),"o");const ne=re((e,t)=>{if(!E.has(e[t]))return{isInsideEscape:!1,isInsideLinkEscape:!1};const i=!0,s=e.slice(t+1,t+1+L.length).join("")===L;return{isInsideEscape:i,isInsideLinkEscape:s}},"checkEscapeSequence"),Xe=re((e,t={})=>{const i=new se;let s="",o=!1,n="",a="",l=!1;const r=[...e];for(let d=0;d<r.length;d++){const c=r[d];if(c&&E.has(c)){if(s){const f=t.getWidth?.(s)??0,h={isEscapeSequence:!1,isGrapheme:!0,text:s,width:f};if(l&&(h.isHyperlink=!0,h.hyperlinkUrl=a),t.onSegment?.(h,i)===!1)return;s=""}o=!0,n=c;const x=ne(r,d),{isInsideLinkEscape:p}=x;if(p){let f=d+1;for(a="";f<r.length;){const g=r[f];if(g===D)break;a+=g,f+=1}a=a.slice(4);const h={hyperlinkUrl:a,isEscapeSequence:!0,isGrapheme:!1,isHyperlink:!0,isHyperlinkStart:!0,width:0};if(t.onSegment?.(h,i)===!1)return;d=f,l=!0,o=!1,n="";continue}if(d+1<r.length&&r[d+1]==="\\"&&l){const f={isEscapeSequence:!0,isGrapheme:!1,isHyperlink:!0,isHyperlinkEnd:!0,width:0};if(t.onSegment?.(f,i)===!1)return;l=!1,a="",d+=1,o=!1,n="";continue}}if(o){if(n!==c&&(n+=c),c===H){o=!1,i.processEscape(n);const x={isEscapeSequence:!0,isGrapheme:!1,text:n,width:0};if(t.onSegment?.(x,i)===!1)return;n=""}continue}s+=c;const u=t.getWidth?.(s)??0,m={isEscapeSequence:!1,isGrapheme:!0,text:s,width:u};if(l&&(m.isHyperlink=!0,m.hyperlinkUrl=a),t.onSegment?.(m,i)===!1)return;s=""}if(s){const d=t.getWidth?.(s)??0,c={isEscapeSequence:!1,isGrapheme:!0,text:s,width:d};l&&(c.isHyperlink=!0,c.hyperlinkUrl=a),t.onSegment?.(c,i)}if(n){const d={isEscapeSequence:!0,isGrapheme:!1,text:n,width:0};t.onSegment?.(d,i)}},"processAnsiString");var Ze=Object.defineProperty,Je=A((e,t)=>Ze(e,"name",{value:t,configurable:!0}),"t$1");const Z=Je(e=>`${E.values().next().value}${ve}${String(e)}${H}`,"wrapAnsiCode");var Qe=Object.defineProperty,et=A((e,t)=>Qe(e,"name",{value:t,configurable:!0}),"s");const J=et(e=>`${E.values().next().value}${L}${e}${D}`,"wrapAnsiHyperlink");var tt=Object.defineProperty,it=A((e,t)=>tt(e,"name",{value:t,configurable:!0}),"l");const st=it(e=>{if(e.length===0)return"";if(e.length===1)return e[0];let t="",i,s;const o=e.join(`
1
+ var he=Object.defineProperty;var b=(e,t)=>he(e,"name",{value:t,configurable:!0});import fe from"yoga-layout";import{e as V}from"./measure-text-D-jVetsl.js";import pe from"./squashTextNodesWithMap-Cpqmc45i.js";import{o as B,k as G,G as q,h as K,N as P,m as me,l as E,i as D,d as H,F as ge,b as xe,s as L,t as ve,a as ye}from"./get-string-width-CbMPWEJO.js";var Be=Object.defineProperty,ee=b((e,t)=>Be(e,"name",{value:t,configurable:!0}),"i"),Ne=Object.defineProperty,te=ee((e,t)=>Ne(e,"name",{value:t,configurable:!0}),"r"),be=Object.defineProperty,we=te((e,t)=>be(e,"name",{value:t,configurable:!0}),"c");class ke{static{b(this,"l")}static{ee(this,"y")}static{te(this,"s")}static{we(this,"LRUCache")}capacity;cache;keyOrder;constructor(t){this.capacity=t,this.cache=new Map,this.keyOrder=[]}get(t){if(this.cache.has(t))return this.keyOrder=this.keyOrder.filter(i=>i!==t),this.keyOrder.push(t),this.cache.get(t)}has(t){return this.cache.has(t)}set(t,i){if(this.cache.has(t))this.keyOrder=this.keyOrder.filter(s=>s!==t);else if(this.cache.size>=this.capacity){const s=this.keyOrder.shift();s!==void 0&&this.cache.delete(s)}this.cache.set(t,i),this.keyOrder.push(t)}delete(t){this.cache.delete(t),this.keyOrder=this.keyOrder.filter(i=>i!==t)}clear(){this.cache.clear(),this.keyOrder=[]}size(){return this.cache.size}}var Se=Object.defineProperty,Ae=b((e,t)=>Se(e,"name",{value:t,configurable:!0}),"S$1"),Ee=Object.defineProperty,$e=Ae((e,t)=>Ee(e,"name",{value:t,configurable:!0}),"w"),We=Object.defineProperty,$=$e((e,t)=>We(e,"name",{value:t,configurable:!0}),"y");const z=new ke(100),Oe=new Intl.Segmenter("en",{granularity:"grapheme"}),Re=/^[\u0000-\u007F]*$/,Te=new Set(["0","22","23","24","27","28","29","39","49"]),Ce=new Set(["1","3","4","7","8","9"]),U=new Map([["22","1"],["23","3"],["24","4"],["27","7"],["28","8"],["29","9"]]),W=$(e=>e>="30"&&e<="37"||e>="90"&&e<="97"||e.startsWith("38;"),"isForegroundColor"),O=$(e=>e>="40"&&e<="47"||e>="100"&&e<="107"||e.startsWith("48;"),"isBackgroundColor"),Fe=[{close:"\x1B[22m",open:"\x1B[1m"},{close:"\x1B[23m",open:"\x1B[3m"},{close:"\x1B[24m",open:"\x1B[4m"},{close:"\x1B[27m",open:"\x1B[7m"},{close:"\x1B[28m",open:"\x1B[8m"},{close:"\x1B[29m",open:"\x1B[9m"}],Y=$((e,t)=>{let i=-1;for(const s of t){const o=e.indexOf(s);o!==-1&&(i===-1||o<i)&&(i=o)}return i},"findFirstPositionOfAny"),_e=$((e,t)=>{if(!e.includes("\x1B"))return[{after:"",before:"",content:e,visibleLength:B(e,t.width)}];const i=z.get(e);if(i)return i;const s=[],o=[];let n=0,a;for(K.lastIndex=0;(a=K.exec(e))!==null;){const c=a[0];s.push(e.slice(n,a.index)),o.push(c),n=a.index+c.length}n<e.length&&s.push(e.slice(n));const l=[];for(const c of o){if(c==="\x1B[0m"||c==="\x1B]8;;\x07"){l.push(c);continue}if(c.startsWith("\x1B[")&&c.endsWith("m")){const u=c.slice(2,-1);if(Te.has(u)){l.push(c);continue}}}const r=new Set,d=[];for(const[c,u]of s.entries()){if(c>0&&o[c-1]){const p=o[c-1];if(p==="\x1B[0m")r.clear();else if(p==="\x1B]8;;\x07"){for(const f of r)if(f.startsWith("\x1B]8;;")&&!f.endsWith("\x1B]8;;\x07")){r.delete(f);break}}else if(p.startsWith("\x1B[")&&p.endsWith("m")){const f=p.slice(2,-1);if(f==="39"){for(const h of r)if(h.startsWith("\x1B[")&&h.endsWith("m")){const g=h.slice(2,-1);if(W(g)){r.delete(h);break}}}else if(f==="49"){for(const h of r)if(h.startsWith("\x1B[")&&h.endsWith("m")){const g=h.slice(2,-1);if(O(g)){r.delete(h);break}}}else if(U.has(f)){const h=U.get(f);for(const g of r)if(g===`\x1B[${h}m`){r.delete(g);break}}else{if(W(f)){for(const h of r)if(h.startsWith("\x1B[")&&h.endsWith("m")){const g=h.slice(2,-1);if(W(g)){r.delete(h);break}}}else if(O(f)){for(const h of r)if(h.startsWith("\x1B[")&&h.endsWith("m")){const g=h.slice(2,-1);if(O(g)){r.delete(h);break}}}else if(Ce.has(f)){const h=`\x1B[${f}m`;r.has(h)&&r.delete(h)}r.add(p)}}else if(p.startsWith("\x1B]8;;")&&!p.endsWith("\x1B]8;;\x07")){for(const f of r)if(f.startsWith("\x1B]8;;")&&!f.endsWith("\x1B]8;;\x07")){r.delete(f);break}r.add(p)}}if(u==="")continue;let m="";if(r.size>0)if(l.includes("\x1B[0m"))m="\x1B[0m";else{const p=[];let f=!1;for(const v of r)if(v.startsWith("\x1B]8;;")&&!v.endsWith("\x1B]8;;\x07")){f=!0;break}f&&l.includes("\x1B]8;;\x07")&&p.push("\x1B]8;;\x07");let h=!1,g=!1;for(const v of r)if(v.startsWith("\x1B[")&&v.endsWith("m")){const N=v.slice(2,-1);W(N)?h=!0:O(N)&&(g=!0)}if(h&&g){const v=Y(e,["\x1B[3","\x1B[9","\x1B[38;"]),N=Y(e,["\x1B[4","\x1B[10","\x1B[48;"]);v>=0&&N>=0?v>N?p.push("\x1B[39m","\x1B[49m"):p.push("\x1B[49m","\x1B[39m"):p.push("\x1B[39m","\x1B[49m")}else h&&p.push("\x1B[39m"),g&&p.push("\x1B[49m");h&&g&&e.includes("\x1B[39m")&&e.includes("\x1B[49m")&&(e.indexOf("\x1B[39m")<e.indexOf("\x1B[49m")?(p.length-=2,p.push("\x1B[39m","\x1B[49m")):e.indexOf("\x1B[49m")<e.indexOf("\x1B[39m")&&(p.length-=2,p.push("\x1B[49m","\x1B[39m")));const j=Fe.filter(v=>r.has(v.open)).map(v=>({position:e.indexOf(v.open),style:v})).filter(v=>v.position>=0).toSorted((v,N)=>N.position-v.position);for(const v of j){const N=v;l.includes(N.style.close)&&p.push(N.style.close)}m=p.join("")}const x=[...r].join("");d.push({after:m,before:x,content:u,visibleLength:B(u,{fullWidth:1,wideWidth:1})})}return z.set(e,d),d},"processIntoStyledSegments"),je=$((e,t,i,s)=>{const o=[...s.segmenter.segment(e)],n=[];let a=0,l=!1;for(const r of o){const d=B(r.segment,s.width),c=a,u=a+d;if(!l)if(c<t){a=u;continue}else l=!0;if(c>=i||u>i)break;n.push(r.segment),a=u}return n.join("")},"fastSlice"),w=$((e,t=0,i=Number.MAX_SAFE_INTEGER,s={})=>{const o={segmenter:Oe,...s};if(t>=i||e==="")return"";const n=B(e,o.width);if(t===0&&i>=n)return e;if(t<0||i<0)throw new RangeError("Negative indices aren't supported");if(!e.includes("\x1B"))return Re.test(e)?e.slice(t,i):je(e,t,i,o);if(G.lastIndex=0,q.lastIndex=0,!G.test(e)&&!q.test(e))return e;const a=_e(e,o);if(a.length===0)return"";let l=0;const r=[];for(const[u,m]of a.entries()){const x=l,p=l+m.visibleLength;if(p>t&&x<i){const f=Math.max(0,t-x),h=Math.min(m.visibleLength,i-x);r.push({end:h,index:u,segment:m,start:f})}l=p}if(r.length===0)return"";const d=[],c=r[0].segment;d.push(c.before);for(let u=0;u<r.length;u++){const{end:m,segment:x,start:p}=r[u];if(p===0&&m===x.visibleLength)d.push(x.content);else{const f=[...o.segmenter.segment(x.content)];d.push(f.slice(p,m).map(h=>h.segment).join(""))}if(u<r.length-1){const f=r[u+1].segment,h=x.after,g=f.before;h!==g&&(h||g)&&d.push(h,g)}}return d.push(r.at(-1).segment.after),d.join("")},"slice");var Ie=Object.defineProperty,Pe=b((e,t)=>Ie(e,"name",{value:t,configurable:!0}),"x"),Le=Object.defineProperty,De=Pe((e,t)=>Le(e,"name",{value:t,configurable:!0}),"T"),He=Object.defineProperty,_=De((e,t)=>He(e,"name",{value:t,configurable:!0}),"f");const X="…",Me=3,R=_((e,t,i=!1)=>{if(e.charAt(t)===" ")return t;const s=i?1:-1,o=Math.min(Me,i?e.length-t:t);for(let n=1;n<=o;n++){const a=t+n*s;if(e.charAt(a)===" ")return a}return t},"findNearestSpace"),T=_((e,t,i)=>P(e,{...i,ellipsis:"",ellipsisWidth:0,limit:t}).index,"widthToIndex"),C=_((e,t,i)=>B(e.slice(0,t),i),"indexToWidth"),Ve=_((e,t,i={})=>{if(typeof e!="string")throw new TypeError(`Expected \`input\` to be a string, got ${typeof e}`);if(typeof t!="number")throw new TypeError(`Expected \`limit\` to be a number, got ${typeof t}`);if(e===""||t<=0)return"";const s=e.normalize("NFC"),{ellipsis:o=X,position:n="end",preferTruncationOnSpace:a=!1}=i;let l=i.ellipsisWidth??o===X?1:void 0;l??=P(o,{...i.width,ellipsis:"",ellipsisWidth:0,limit:Number.POSITIVE_INFINITY}).width;const{width:r}=P(s,{...i.width,ellipsis:o,ellipsisWidth:l});if(r<=t)return s;switch(n){case"end":{if(a){const d=t-l,c=T(s,d,i.width),u=R(s,c),m=C(s,u,i.width);return w(s,0,m,{width:i.width})+o}return w(s,0,t-l,{width:i.width})+o}case"middle":{const d=Math.floor(t/2),c=Math.max(0,t-l),u=Math.min(d,c),m=Math.max(0,c-u);if(a){const x=T(s,u,i.width),p=R(s,x),f=C(s,p,i.width),h=r-m,g=T(s,h,i.width),j=R(s,g,!0),v=C(s,j,i.width);return w(s,0,f,{width:i.width})+o+w(s,v,r,{width:i.width}).trim()}return w(s,0,u,{width:i.width})+o+w(s,r-m,r,{width:i.width})}case"start":{if(a){const d=r-t+l,c=T(s,d,i.width),u=R(s,c,!0),m=C(s,u,i.width);return o+w(s,m,r,{width:i.width}).trim()}return o+w(s,r-t+l,r,{width:i.width})}default:throw new Error(`Invalid position: expected 'start', 'middle' or 'end', got '${n}'`)}},"truncate");var Ge=Object.defineProperty,ie=b((e,t)=>Ge(e,"name",{value:t,configurable:!0}),"b"),qe=Object.defineProperty,A=ie((e,t)=>qe(e,"name",{value:t,configurable:!0}),"d"),Ke=Object.defineProperty,ze=A((e,t)=>Ke(e,"name",{value:t,configurable:!0}),"a");const Ue=/\x1B\[(\d+)m/;let se=class{static{b(this,"T")}static{ie(this,"T")}static{A(this,"d")}static{ze(this,"AnsiStateTracker")}activeForeground=void 0;activeBackground=void 0;activeFormatting=[];processEscape(t){const i=Ue.exec(t);if(!i)return;const s=Number.parseInt(i[1],10);switch(s){case 0:{this.activeForeground=void 0,this.activeBackground=void 0,this.activeFormatting=[];break}case 39:{this.activeForeground=void 0;break}case 49:{this.activeBackground=void 0;break}default:if(s>=30&&s<=37||s>=90&&s<=97)this.activeForeground=t;else if(s>=40&&s<=47||s>=100&&s<=107)this.activeBackground=t;else if([1,2,3,4,7,8,9].includes(s))this.activeFormatting.push(t);else if([22,23,24,27,28,29].includes(s)){const o={22:"[1m",23:"[3m",24:"[4m",27:"[7m",28:"[8m",29:"[9m"}[s];o&&(this.activeFormatting=this.activeFormatting.filter(n=>!n.includes(o)))}}}getStartEscapesForAllActiveAttributes(){return[this.activeBackground,this.activeForeground,...this.activeFormatting].filter(Boolean).join("")}getEndEscapesForAllActiveAttributes(){const t=[];if(this.activeFormatting.length>0){const i={"\x1B[1m":"\x1B[22m","\x1B[2m":"\x1B[22m","\x1B[3m":"\x1B[23m","\x1B[4m":"\x1B[24m","\x1B[7m":"\x1B[27m","\x1B[8m":"\x1B[28m","\x1B[9m":"\x1B[29m"};[...this.activeFormatting].toReversed().forEach(s=>{const o=i[s];o&&t.push(o)})}return this.activeForeground&&t.push("\x1B[39m"),this.activeBackground&&t.push("\x1B[49m"),t.join("")}};var Ye=Object.defineProperty,re=A((e,t)=>Ye(e,"name",{value:t,configurable:!0}),"o");const ne=re((e,t)=>{if(!E.has(e[t]))return{isInsideEscape:!1,isInsideLinkEscape:!1};const i=!0,s=e.slice(t+1,t+1+L.length).join("")===L;return{isInsideEscape:i,isInsideLinkEscape:s}},"checkEscapeSequence"),Xe=re((e,t={})=>{const i=new se;let s="",o=!1,n="",a="",l=!1;const r=[...e];for(let d=0;d<r.length;d++){const c=r[d];if(c&&E.has(c)){if(s){const f=t.getWidth?.(s)??0,h={isEscapeSequence:!1,isGrapheme:!0,text:s,width:f};if(l&&(h.isHyperlink=!0,h.hyperlinkUrl=a),t.onSegment?.(h,i)===!1)return;s=""}o=!0,n=c;const x=ne(r,d),{isInsideLinkEscape:p}=x;if(p){let f=d+1;for(a="";f<r.length;){const g=r[f];if(g===D)break;a+=g,f+=1}a=a.slice(4);const h={hyperlinkUrl:a,isEscapeSequence:!0,isGrapheme:!1,isHyperlink:!0,isHyperlinkStart:!0,width:0};if(t.onSegment?.(h,i)===!1)return;d=f,l=!0,o=!1,n="";continue}if(d+1<r.length&&r[d+1]==="\\"&&l){const f={isEscapeSequence:!0,isGrapheme:!1,isHyperlink:!0,isHyperlinkEnd:!0,width:0};if(t.onSegment?.(f,i)===!1)return;l=!1,a="",d+=1,o=!1,n="";continue}}if(o){if(n!==c&&(n+=c),c===H){o=!1,i.processEscape(n);const x={isEscapeSequence:!0,isGrapheme:!1,text:n,width:0};if(t.onSegment?.(x,i)===!1)return;n=""}continue}s+=c;const u=t.getWidth?.(s)??0,m={isEscapeSequence:!1,isGrapheme:!0,text:s,width:u};if(l&&(m.isHyperlink=!0,m.hyperlinkUrl=a),t.onSegment?.(m,i)===!1)return;s=""}if(s){const d=t.getWidth?.(s)??0,c={isEscapeSequence:!1,isGrapheme:!0,text:s,width:d};l&&(c.isHyperlink=!0,c.hyperlinkUrl=a),t.onSegment?.(c,i)}if(n){const d={isEscapeSequence:!0,isGrapheme:!1,text:n,width:0};t.onSegment?.(d,i)}},"processAnsiString");var Ze=Object.defineProperty,Je=A((e,t)=>Ze(e,"name",{value:t,configurable:!0}),"t$1");const Z=Je(e=>`${E.values().next().value}${ve}${String(e)}${H}`,"wrapAnsiCode");var Qe=Object.defineProperty,et=A((e,t)=>Qe(e,"name",{value:t,configurable:!0}),"s");const J=et(e=>`${E.values().next().value}${L}${e}${D}`,"wrapAnsiHyperlink");var tt=Object.defineProperty,it=A((e,t)=>tt(e,"name",{value:t,configurable:!0}),"l");const st=it(e=>{if(e.length===0)return"";if(e.length===1)return e[0];let t="",i,s;const o=e.join(`
2
2
  `),n=[...o];let a=0;for(const[l,r]of n.entries()){if(t+=r,E.has(r)){const c=ge.exec(o.slice(a))?.groups??{};if(c.code!==void 0){const u=Number.parseFloat(c.code);i=u===ye?void 0:u}else c.uri!==void 0&&(s=c.uri.length===0?void 0:c.uri)}const d=xe.get(Number(i));n[l+1]===`
3
3
  `?(s&&(t+=J("")),i&&d&&(t+=Z(d))):r===`
4
4
  `&&(i&&d&&(t+=Z(i)),s&&(t+=J(s))),a+=r.length}return t},"preserveAnsi");var rt=Object.defineProperty,k=A((e,t)=>rt(e,"name",{value:t,configurable:!0}),"f");const oe=/(?=\s)|(?<=\s)/,ae=/^\s+$/,I=k(e=>{if(!e.includes("\x1B"))return e;let t=e;return e.includes("\x1B[30m")&&(t+="\x1B[39m"),e.includes("\x1B[42m")&&(t+="\x1B[49m"),t},"resetAnsiAtLineBreak"),S=k(e=>{const t=e.split(" ");let i=t.length;for(;i>0&&B(t[i-1])===0;)i--;return i===t.length?e:t.slice(0,i).join(" ")+t.slice(i).join("")},"stringVisibleTrimSpacesRight"),ce=k((e,t,i)=>{if(e.length===0)return[""];if(t<=0)return[e];const s=[],o=new se;let n="",a=0,l=!1,r=!1,d="",c=0;for(;c<e.length;){const u=e[c];if(E.has(u)){l=!0,d=u,n+=u,r=ne([...e],c).isInsideLinkEscape,c+=1;continue}if(l){d+=u,n+=u,r?u===D&&(l=r=!1):u===H&&(l=!1,o.processEscape(d)),c+=1;continue}const m=B(u),x=u===" ";if(m===0){n+=u,c+=1;continue}if(a+m>t&&(n&&s.push(n+o.getEndEscapesForAllActiveAttributes()),n=o.getStartEscapesForAllActiveAttributes(),a=B(n),x&&i)){for(;c<e.length&&e[c]===" ";)c+=1;continue}if(n+=u,a+=m,a===t&&c<e.length-1&&(s.push(n+o.getEndEscapesForAllActiveAttributes()),n=o.getStartEscapesForAllActiveAttributes(),a=B(n),c+1<e.length&&e[c+1]===" "&&i)){for(c+=1;c<e.length&&e[c]===" ";)c+=1;continue}c+=1}return n&&s.push(n+o.getEndEscapesForAllActiveAttributes()),i?s.map(u=>S(u)):s},"wrapWithBreakAtWidth"),nt=k((e,t,i)=>{if(e.length===0)return[];const s=i?e.trim():e;if(s.length===0)return[];const o=[];let n="",a=0;return Xe(s,{getWidth:B,onSegment:k((l,r)=>{const d=l.text??"";if(l.isEscapeSequence)n+=d;else{const c=d===" ";if(l.width===0)return n+=d,!0;if(a+l.width>t&&(n&&o.push(n),n=r.getStartEscapesForAllActiveAttributes(),a=0,c))return i||o.push(r.getStartEscapesForAllActiveAttributes()+d),!0;n+=d,a+=l.width}return!0},"onSegment")}),n&&o.push(n),i?o.map(l=>S(l)):o},"wrapCharByChar"),ot=k((e,t,i)=>{if(e.length===0)return[];const s=i?e.trim():e;if(s.length===0)return[];const o=s.split(oe),n=[];let a="",l=0,r=0;for(;r<o.length;){const d=o[r],c=ae.test(d),u=B(d);if(d.length===0){r+=1;continue}if(i&&c&&l===0){r+=1;continue}if(l+u>t&&l>0){i?n.push(S(a)):n.push(a),a="",l=0;continue}a+=d,l+=u,r+=1}return a&&(i?n.push(S(a)):n.push(a)),n},"wrapWithWordBoundaries"),at=k((e,t,i)=>{if(e.length===0)return[];const s=i?e.trim():e;if(s.length===0)return[];const o=s.split(oe),n=[];let a="",l=0,r=0;for(;r<o.length;){const d=o[r],c=ae.test(d),u=B(d);if(d.length===0){r+=1;continue}if(i&&c&&l===0){r+=1;continue}if(u>t){a&&n.push(I(i?S(a):a));const m=ce(d,t,i);if(m.length>0){for(let x=0;x<m.length-1;x+=1)n.push(m[x]);a=m.at(-1),l=B(a)}else a="",l=0;r+=1;continue}if(l+u>t&&l>0&&(n.push(I(i?S(a):a)),a="",l=0,i&&c)){r+=1;continue}a+=d,l+=u,r+=1}return a&&n.push(I(i?S(a):a)),n},"wrapAndBreakWords"),F={BREAK_AT_CHARACTERS:"BREAK_AT_CHARACTERS",BREAK_WORDS:"BREAK_WORDS",PRESERVE_WORDS:"PRESERVE_WORDS",STRICT_WIDTH:"STRICT_WIDTH"},ct=k((e,t={})=>{const{removeZeroWidthCharacters:i=!0,trim:s=!0,width:o=80,wrapMode:n=F.PRESERVE_WORDS}=t;if(s&&e.trim()==="")return"";let a=e.normalize("NFC").replaceAll(`\r
@@ -1,5 +1,6 @@
1
1
  import { Node } from 'yoga-layout';
2
- import { S as Styles } from "./styles.d-i6Mejqz2.js";
2
+ import 'type-fest';
3
+ import { S as Styles } from "./styles.d-CLJdt-kg.js";
3
4
  type StyleSpan = {
4
5
  bgColor?: string;
5
6
  fgColor?: string;
@@ -304,6 +305,13 @@ type DOMElement = InkNode & {
304
305
  */
305
306
  internal_maxScrollTop?: number;
306
307
  /**
308
+ * Highest scrollTop whose scrolled-off lines have already been flushed
309
+ * into the terminal's real scrollback history. Monotonic; used by the
310
+ * `overflowToBackbuffer` emission path so a given line is pushed exactly
311
+ * once and scrolling back up never re-emits.
312
+ */
313
+ internal_maxPushedScrollTop?: number;
314
+ /**
307
315
  * Callback invoked after prepareYogaTree() caches the render output for
308
316
  * an ink-static-render node. StaticRender uses this to set `isRendered`
309
317
  * state, which prevents React from re-reconciling children once cached.
@@ -400,4 +408,4 @@ declare const getPathToRoot: (node: DOMNode) => DOMNode[];
400
408
  * Ported from jacob314/ink fork (Google LLC, Apache-2.0).
401
409
  */
402
410
  declare const isNodeSelectable: (node: DOMElement) => boolean;
403
- export { DOMNode as D, ResizeObserver as R, StyledLine as S, DOMElement 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 };
411
+ export { DOMElement as D, ResizeObserver as R, StyledLine as S, 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 };
@@ -0,0 +1 @@
1
+ var X=Object.defineProperty;var h=(e,i)=>X(e,"name",{value:i,configurable:!0});var e1=Object.defineProperty,C=h((e,i)=>e1(e,"name",{value:i,configurable:!0}),"u$1"),i1=Object.defineProperty,y=C((e,i)=>i1(e,"name",{value:i,configurable:!0}),"l");const r1=[161,161,164,164,167,168,170,170,173,174,176,180,182,186,188,191,198,198,208,208,215,216,222,225,230,230,232,234,236,237,240,240,242,243,247,250,252,252,254,254,257,257,273,273,275,275,283,283,294,295,299,299,305,307,312,312,319,322,324,324,328,331,333,333,338,339,358,359,363,363,462,462,464,464,466,466,468,468,470,470,472,472,474,474,476,476,593,593,609,609,708,708,711,711,713,715,717,717,720,720,728,731,733,733,735,735,768,879,913,929,931,937,945,961,963,969,1025,1025,1040,1103,1105,1105,8208,8208,8211,8214,8216,8217,8220,8221,8224,8226,8228,8231,8240,8240,8242,8243,8245,8245,8251,8251,8254,8254,8308,8308,8319,8319,8321,8324,8364,8364,8451,8451,8453,8453,8457,8457,8467,8467,8470,8470,8481,8482,8486,8486,8491,8491,8531,8532,8539,8542,8544,8555,8560,8569,8585,8585,8592,8601,8632,8633,8658,8658,8660,8660,8679,8679,8704,8704,8706,8707,8711,8712,8715,8715,8719,8719,8721,8721,8725,8725,8730,8730,8733,8736,8739,8739,8741,8741,8743,8748,8750,8750,8756,8759,8764,8765,8776,8776,8780,8780,8786,8786,8800,8801,8804,8807,8810,8811,8814,8815,8834,8835,8838,8839,8853,8853,8857,8857,8869,8869,8895,8895,8978,8978,9312,9449,9451,9547,9552,9587,9600,9615,9618,9621,9632,9633,9635,9641,9650,9651,9654,9655,9660,9661,9664,9665,9670,9672,9675,9675,9678,9681,9698,9701,9711,9711,9733,9734,9737,9737,9742,9743,9756,9756,9758,9758,9792,9792,9794,9794,9824,9825,9827,9829,9831,9834,9836,9837,9839,9839,9886,9887,9919,9919,9926,9933,9935,9939,9941,9953,9955,9955,9960,9961,9963,9969,9972,9972,9974,9977,9979,9980,9982,9983,10045,10045,10102,10111,11094,11097,12872,12879,57344,63743,65024,65039,65533,65533,127232,127242,127248,127277,127280,127337,127344,127373,127375,127376,127387,127404,917760,917999,983040,1048573,1048576,1114109],t1=12288,n1=65510,a1=[12288,12288,65281,65376,65504,65510],u1=8361,l1=65518,o1=[8361,8361,65377,65470,65474,65479,65482,65487,65490,65495,65498,65500,65512,65518],d1=32,s1=10630,c1=[32,126,162,163,165,166,172,172,175,175,10214,10221,10629,10630],h1=4352,f1=262141,q=[4352,4447,8986,8987,9001,9002,9193,9196,9200,9200,9203,9203,9725,9726,9748,9749,9776,9783,9800,9811,9855,9855,9866,9871,9875,9875,9889,9889,9898,9899,9917,9918,9924,9925,9934,9934,9940,9940,9962,9962,9970,9971,9973,9973,9978,9978,9981,9981,9989,9989,9994,9995,10024,10024,10060,10060,10062,10062,10067,10069,10071,10071,10133,10135,10160,10160,10175,10175,11035,11036,11088,11088,11093,11093,11904,11929,11931,12019,12032,12245,12272,12287,12289,12350,12353,12438,12441,12543,12549,12591,12593,12686,12688,12773,12783,12830,12832,12871,12880,42124,42128,42182,43360,43388,44032,55203,63744,64255,65040,65049,65072,65106,65108,65126,65128,65131,94176,94180,94192,94198,94208,101589,101631,101662,101760,101874,110576,110579,110581,110587,110589,110590,110592,110882,110898,110898,110928,110930,110933,110933,110948,110951,110960,111355,119552,119638,119648,119670,126980,126980,127183,127183,127374,127374,127377,127386,127488,127490,127504,127547,127552,127560,127568,127569,127584,127589,127744,127776,127789,127797,127799,127868,127870,127891,127904,127946,127951,127955,127968,127984,127988,127988,127992,128062,128064,128064,128066,128252,128255,128317,128331,128334,128336,128359,128378,128378,128405,128406,128420,128420,128507,128591,128640,128709,128716,128716,128720,128722,128725,128728,128732,128735,128747,128748,128756,128764,128992,129003,129008,129008,129292,129338,129340,129349,129351,129535,129648,129660,129664,129674,129678,129734,129736,129736,129741,129756,129759,129770,129775,129784,131072,196605,196608,262141];var w1=Object.defineProperty,b1=y((e,i)=>w1(e,"name",{value:i,configurable:!0}),"r$1");const p=b1((e,i)=>{let r=0,a=Math.floor(e.length/2)-1;for(;r<=a;){const u=Math.floor((r+a)/2),l=u*2;if(i<e[l])a=u-1;else if(i>e[l+1])r=u+1;else return!0}return!1},"isInRange");var g1=Object.defineProperty,b=y((e,i)=>g1(e,"name",{value:i,configurable:!0}),"r");const _=19968,[m1,p1]=E(q);function E(e){let i=e[0],r=e[1];for(let a=0;a<e.length;a+=2){const u=e[a],l=e[a+1];if(_>=u&&_<=l)return[u,l];l-u>r-i&&(i=u,r=l)}return[i,r]}h(E,"c$1");C(E,"f");y(E,"k");b(E,"findWideFastPathRange");const D=b(e=>e<161||e>1114109?!1:p(r1,e),"isAmbiguous"),G=b(e=>e<t1||e>n1?!1:p(a1,e),"isFullWidth"),$1=b(e=>e<u1||e>l1?!1:p(o1,e),"isHalfWidth"),W1=b(e=>e<d1||e>s1?!1:p(c1,e),"isNarrow"),Z=b(e=>e>=m1&&e<=p1?!0:e<h1||e>f1?!1:p(q,e),"isWide");function O(e){return D(e)?"ambiguous":G(e)?"fullwidth":$1(e)?"halfwidth":W1(e)?"narrow":Z(e)?"wide":"neutral"}h(O,"g$3");C(O,"S");y(O,"getCategory");b(O,"getCategory");var v1=Object.defineProperty,P=h((e,i)=>v1(e,"name",{value:i,configurable:!0}),"i$2"),I1=Object.defineProperty,k=P((e,i)=>I1(e,"name",{value:i,configurable:!0}),"a"),x1=Object.defineProperty,S=k((e,i)=>x1(e,"name",{value:i,configurable:!0}),"e");function $(e){if(!Number.isSafeInteger(e))throw new TypeError(`Expected a code point, got \`${typeof e}\`.`)}h($,"s$1");P($,"s");k($,"r");S($,"validate");function W(e){return $(e),O(e)}h(W,"r$2");P(W,"p");k(W,"eastAsianWidthType");S(W,"eastAsianWidthType");function T(e,{ambiguousAsWide:i=!1}={}){return $(e),G(e)||Z(e)||i&&D(e)?2:1}h(T,"o$2");P(T,"W");k(T,"eastAsianWidth");S(T,"eastAsianWidth");var j1=Object.defineProperty,y1=h((e,i)=>j1(e,"name",{value:i,configurable:!0}),"p$1"),E1=Object.defineProperty,J=y1((e,i)=>E1(e,"name",{value:i,configurable:!0}),"e"),O1=Object.defineProperty,P1=J((e,i)=>O1(e,"name",{value:i,configurable:!0}),"E");const K=String.raw,H=K`\p{Emoji}(?:\p{EMod}|[\u{E0020}-\u{E007E}]+\u{E007F}|\uFE0F?\u20E3?)`,k1=P1(()=>new RegExp(K`\p{RI}{2}|(?![#*\d](?!\uFE0F?\u20E3))${H}(?:\u200D${H})*`,"gu"),"default");var F1=Object.defineProperty,B1=J((e,i)=>F1(e,"name",{value:i,configurable:!0}),"p");const K1=new Set(["\x1B","›"]),M1="\x07",N1="[",L1="m",A1="]8;;",Q1=39,U1=/[\u200B\uFEFF\u2060-\u2064]/g,X1=new RegExp(`(?:\\${N1}(?<code>\\d+)m|\\${A1}(?<uri>.*)${M1})`),e2=Object.freeze(new Map([[0,0],[1,22],[2,22],[3,23],[4,24],[7,27],[8,28],[9,29],[30,39],[31,39],[32,39],[33,39],[34,39],[35,39],[36,39],[37,39],[40,49],[41,49],[42,49],[43,49],[44,49],[45,49],[46,49],[47,49],[90,39]])),m=/[\u001B\u009B](?:[[()#;?]{0,10}(?:\d{1,4}(?:;\d{0,4})*)?[0-9A-ORZcf-nqry=><]|\]8;;[^\u0007\u001B]{0,100}(?:\u0007|\u001B\\))/g,i2=/\u001B\[(\d+(?:;\d+)*)?m[^\u001B]*(?:\u001B\[(?:\d+(?:;\d+)*)?m|$)/g,r2=/\u001B\]8;[^\u0007\u001B]*(?:\u0007|\u001B\\)(.*?)\u001B\]8;;(?:\u0007|\u001B\\)/g,v=/[\u0000-\u0008\n-\u001F\u007F-\u009F]{1,1000}/y,x=k1();B1(e=>e.replace(x,""),"stripEmoji");var C1=Object.defineProperty,S1=h((e,i)=>C1(e,"name",{value:i,configurable:!0}),"E"),T1=Object.defineProperty,R1=S1((e,i)=>T1(e,"name",{value:i,configurable:!0}),"A"),z1=Object.defineProperty,F=R1((e,i)=>z1(e,"name",{value:i,configurable:!0}),"d");const Y=new Map,I=/(?:[\u0020-\u007E\u00A0-\u00FF](?!\uFE0F)){1,1000}/y,j=F(e=>e>=32&&e<=126?"latin":e===8203||e===8204||e===8205||e===8288?"zero":e<=31||e>=127&&e<=159?"control":e>=160&&e<=255||e>=9472&&e<=9599?"latin":e>=4352&&e<=4607||e>=11904&&e<=40959||e>=44032&&e<=55215||e>=63744&&e<=64255||e>=65280&&e<=65519&&!(e>=65377&&e<=65439)||e>=12352&&e<=12543?"wide":e===8230?"latin":"other","getCharType"),V1=F((e,i)=>{const r=Math.floor(e/65536),a=e%65536;let u=Y.get(r);if(u||(u=new Map,Y.set(r,u)),u.has(a))return u.get(a);let l;if(j(e)==="latin")l=i.width.regular;else if(j(e)==="control")l=i.width.control;else if(j(e)==="wide")l=i.width.wide;else switch(W(e)){case"ambiguous":{l=i.width.ambiguousIsNarrow?i.width.regular:i.width.wide;break}case"fullwidth":{l=i.width.fullWidth;break}case"wide":{l=i.width.wide;break}default:l=i.width.regular}return u.set(a,l),l},"getCachedCharWidth"),_1=F(e=>e>=768&&e<=879||e>=6832&&e<=6911||e>=7616&&e<=7679||e>=8400&&e<=8447||e>=65056&&e<=65071||e>=917760&&e<=917999||e>=65024&&e<=65039||e>=3633&&e<=3642||e>=3655&&e<=3662||e>=3761&&e<=3769||e>=3771&&e<=3772||e>=3784&&e<=3789||e>=2304&&e<=2307||e>=2362&&e<=2383||e>=2385&&e<=2391||e>=2402&&e<=2403||e>=2433&&e<=2435||e>=2492&&e<=2500||e>=2509&&e<=2509||e>=2561&&e<=2563||e>=2620&&e<=2637||e>=1611&&e<=1631||e>=1648&&e<=1648||e>=1750&&e<=1773||e>=2276&&e<=2302||e>=1425&&e<=1469||e>=1471&&e<=1471||e>=1473&&e<=1474||e>=1476&&e<=1477||e>=1479&&e<=1479||e>=3893&&e<=3893||e>=3895&&e<=3895||e>=3897&&e<=3897||e>=3953&&e<=3966||e>=3968&&e<=3972||e>=3974&&e<=3975?!0:e>=768&&e<=777||e>=803&&e<=803,"isCombiningCharacter"),A=F((e,i={})=>{if(!e||e.length===0)return{ellipsed:!1,index:0,truncated:!1,width:0};const r={truncation:{countAnsiEscapeCodes:i.countAnsiEscapeCodes??!1,ellipsis:i.ellipsis??"",ellipsisWidth:i.ellipsisWidth??(i.ellipsis?A(i.ellipsis,{...i,ellipsis:"",ellipsisWidth:0,limit:Number.POSITIVE_INFINITY}).width:0),limit:i.limit??Number.POSITIVE_INFINITY},width:{ambiguousIsNarrow:i.ambiguousIsNarrow??!1,ansi:i.ansiWidth??0,control:i.controlWidth??0,emoji:i.emojiWidth??2,fullWidth:i.fullWidth??2,halfWidth:i.halfWidth??1,regular:i.regularWidth??1,tab:i.tabWidth??8,wide:i.wideWidth??2}},a=Math.max(0,r.truncation.limit-r.truncation.ellipsisWidth),{length:u}=e,l=u>1e4;let t=0,n=0,o=u,d=!1;const L=e.includes("\x1B")||e.includes("›");for(;t<u;){if(L&&(e[t]==="\x1B"||e[t]==="›")){if(e.startsWith("\x1B]8;;",t)){const c="\x1B]8;;\x07",w=c.length,B=e.indexOf("\x07",t+5);if(B!==-1){const M=e.indexOf(c,B+1);if(M!==-1){const Q=M+w,U=e.slice(B+1,M).replace(m,""),V=A(U,{ambiguousIsNarrow:r.width.ambiguousIsNarrow,ansiWidth:r.width.ansi,controlWidth:r.width.control,countAnsiEscapeCodes:!1,ellipsis:r.truncation.ellipsis,ellipsisWidth:r.truncation.ellipsisWidth,emojiWidth:r.width.emoji,fullWidth:r.width.fullWidth,halfWidth:r.width.halfWidth,limit:Math.max(0,a-n),regularWidth:r.width.regular,tabWidth:r.width.tab,wideWidth:r.width.wide}),N=V.width;if(V.truncated)d=!0,o=Math.min(o,t);else if(n+N>a&&(o=Math.min(o,t),d=!0,n+N>r.truncation.limit))break;if(n+=N,t=Q,d&&n>=r.truncation.limit)break;continue}}}if(m.lastIndex=t,m.test(e)){const c=m.lastIndex-t,w=r.truncation.countAnsiEscapeCodes?c:r.width.ansi;if(n+w>a&&(o=Math.min(o,t),n+w>r.truncation.limit)){d=!0;break}n+=w,t=m.lastIndex;continue}}const f=e.codePointAt(t);if(f===8203||f===65279||f>=8288&&f<=8292){t+=1;continue}if(f===9){if(n+r.width.tab>a&&(o=Math.min(o,t),n+r.width.tab>r.truncation.limit)){d=!0;break}n+=r.width.tab,t+=1;continue}if(I.lastIndex=t,I.test(e)){const c=(I.lastIndex-t)*r.width.regular;if(n+c>a){const w=Math.floor((a-n)/r.width.regular);if(o=Math.min(o,t+w),n+c>r.truncation.limit){d=!0;break}}n+=c,t=I.lastIndex;continue}if((f<=31||f>=127&&f<=159)&&(v.lastIndex=t,v.test(e))){const c=(v.lastIndex-t)*r.width.control;if(n+c>a&&(o=Math.min(o,t+Math.floor((a-n)/r.width.control)),n+c>r.truncation.limit)){d=!0;break}n+=c,t=v.lastIndex;continue}if(x.lastIndex=t,x.test(e)){if(n+r.width.emoji>a&&(o=Math.min(o,t),n+r.width.emoji>r.truncation.limit)){d=!0;break}n+=r.width.emoji,t=x.lastIndex;continue}const g=e.codePointAt(t)??0;if(_1(g)){t+=g>65535?2:1;continue}let s;if(l)s=V1(g,r);else switch(j(g)){case"control":{s=r.width.control;break}case"latin":{s=r.width.regular;break}case"wide":{s=r.width.wide;break}case"zero":{s=0;break}default:switch(W(g)){case"ambiguous":{s=r.width.ambiguousIsNarrow?r.width.regular:r.width.wide;break}case"fullwidth":{s=r.width.fullWidth;break}case"wide":{s=r.width.wide;break}default:s=r.width.regular}}if(n+s>a&&(o=Math.min(o,t),n+s>r.truncation.limit)){d=!0;break}n+=s,t+=g>65535?2:1}let R=n,z=!1;return d&&r.truncation.limit>=r.truncation.ellipsisWidth&&(R=r.truncation.limit,z=!0),{ellipsed:z,index:d?o:u,truncated:d,width:R}},"getStringTruncatedWidth");var H1=Object.defineProperty,Y1=h((e,i)=>H1(e,"name",{value:i,configurable:!0}),"i"),q1=Object.defineProperty,D1=Y1((e,i)=>q1(e,"name",{value:i,configurable:!0}),"e"),G1=Object.defineProperty,Z1=D1((e,i)=>G1(e,"name",{value:i,configurable:!0}),"r");const t2=Z1((e,i={})=>A(e,{...i,ellipsis:"",ellipsisWidth:0,limit:Number.POSITIVE_INFINITY}).width,"getStringWidth");export{X1 as F,r2 as G,A as N,Q1 as a,e2 as b,Z as c,L1 as d,m as h,M1 as i,i2 as k,K1 as l,U1 as m,t2 as o,A1 as s,N1 as t,G as v};
@@ -1 +1 @@
1
- import"yoga-layout";import"./measure-text-CIs55Wao.js";import"./squashTextNodesWithMap-Cpqmc45i.js";import{a as r,d,c as i,f as m,e as N,g as l,b as p,i as c,m as h,r as n,j as u,l as y,h as L,s as b}from"./dom-CMbdnYbk.js";export{r as addLayoutListener,d as appendChildNode,i as createNode,m as createTextNode,N as emitLayoutListeners,l as getPathToRoot,p as insertBeforeNode,c as isNodeSelectable,h as markNodeAsDirty,n as removeChildNode,u as setAttribute,y as setCachedRender,L as setStyle,b as setTextNodeValue};
1
+ import"yoga-layout";import"./measure-text-D-jVetsl.js";import"./squashTextNodesWithMap-Cpqmc45i.js";import{a as r,d,c as i,f as m,e as N,g as l,b as p,i as c,m as h,r as n,j as u,l as y,h as L,s as b}from"./dom-UWZI4lDM.js";export{r as addLayoutListener,d as appendChildNode,i as createNode,m as createTextNode,N as emitLayoutListeners,l as getPathToRoot,p as insertBeforeNode,c as isNodeSelectable,h as markNodeAsDirty,n as removeChildNode,u as setAttribute,y as setCachedRender,L as setStyle,b as setTextNodeValue};
@@ -0,0 +1 @@
1
+ var p=Object.defineProperty;var u=(t,e)=>p(t,"name",{value:e,configurable:!0});import l from"yoga-layout";var E=Object.defineProperty,n=u((t,e)=>E(t,"name",{value:e,configurable:!0}),"a");const S=n(t=>{const{yogaNode:e}=t;if(!e)return{scrollHeight:0,scrollWidth:0};const a=e.getComputedBorder(l.EDGE_TOP),s=e.getComputedBorder(l.EDGE_LEFT);let c=a,r=e.getComputedPadding(l.EDGE_LEFT);for(let i=0;i<e.getChildCount();i++){const o=e.getChild(i),d=o.getComputedTop()+o.getComputedHeight()+o.getComputedMargin(l.EDGE_BOTTOM);d>c&&(c=d);const g=o.getComputedLeft()+o.getComputedWidth()+o.getComputedMargin(l.EDGE_RIGHT);g>r&&(r=g)}const m=c-a+e.getComputedPadding(l.EDGE_BOTTOM),h=r-s+e.getComputedPadding(l.EDGE_RIGHT);return{scrollHeight:Math.round(m),scrollWidth:Math.round(h)}},"calculateScrollDimensions"),_=n(t=>Math.round(t.internal_scrollState?.scrollHeight??0),"getScrollHeight"),C=n(t=>Math.round(t.internal_scrollState?.scrollWidth??0),"getScrollWidth"),f=n(t=>{const{yogaNode:e}=t;if(!e)return;const{scrollHeight:a,scrollWidth:s}=S(t);let c=a;const r=Math.max(0,e.getComputedHeight()-e.getComputedBorder(l.EDGE_TOP)-e.getComputedBorder(l.EDGE_BOTTOM));if(t.style.stableScrollback&&t.style.overflowToBackbuffer){const o=Math.max(0,a-r);if(t.internal_isScrollbackDirty)t.internal_maxScrollTop=o,t.internal_isScrollbackDirty=!1;else{const d=Math.max(t.internal_maxScrollTop??0,o),{maxScrollbackLength:g}=t.style;t.internal_maxScrollTop=g===void 0?d:Math.min(d,o+Math.max(0,g))}c=Math.max(a,(t.internal_maxScrollTop??0)+r)}const m=Math.max(0,Math.min(t.style.scrollTop??0,c-r)),h=Math.max(0,e.getComputedWidth()-e.getComputedBorder(l.EDGE_LEFT)-e.getComputedBorder(l.EDGE_RIGHT)),i=Math.max(0,Math.min(t.style.scrollLeft??0,s-h));t.internal_scrollState={actualScrollHeight:a,clientHeight:r,clientWidth:h,scrollHeight:c,scrollLeft:i,scrollTop:m,scrollWidth:s}},"calculateScroll"),x=n(t=>Math.round(t.internal_scrollState?.scrollTop??0),"getScrollTop"),D=n(t=>Math.round(t.internal_scrollState?.scrollLeft??0),"getScrollLeft");export{f as calculateScroll,_ as getScrollHeight,D as getScrollLeft,x as getScrollTop,C as getScrollWidth};
@@ -1,2 +1,2 @@
1
- var F=Object.defineProperty;var M=(t,e)=>F(t,"name",{value:e,configurable:!0});import l from"yoga-layout";import{getScrollTop as k,getScrollLeft as W}from"./getScrollHeight-BTEY8ewu.js";import Y from"./squashTextNodesWithMap-Cpqmc45i.js";var A=Object.defineProperty,c=M((t,e)=>A(t,"name",{value:e,configurable:!0}),"u");const Q=c(t=>{const e=j(t);return{height:Math.round(t.yogaNode?.getComputedHeight()??0),width:Math.round(t.yogaNode?.getComputedWidth()??0),x:Math.round(e?.x??0),y:Math.round(e?.y??0)}},"measureElement"),Z=c(t=>{const{yogaNode:e}=t;if(!e)return 0;const o=e.getComputedWidth()??0,r=e.getComputedBorder(l.EDGE_LEFT),s=e.getComputedBorder(l.EDGE_RIGHT);return Math.round(o-r-s)},"getInnerWidth"),tt=c(t=>{const{yogaNode:e}=t;if(!e)return 0;const o=e.getComputedHeight()??0,r=e.getComputedBorder(l.EDGE_TOP),s=e.getComputedBorder(l.EDGE_BOTTOM);return Math.round(o-r-s)},"getInnerHeight"),O=c(t=>{const{yogaNode:e}=t;if(!e)return{height:0,width:0,x:0,y:0};const o=e.getComputedWidth()??0,r=e.getComputedHeight()??0;let s=e.getComputedLeft(),n=e.getComputedTop(),d=t.parentNode;for(;d?.yogaNode;){if(s+=d.yogaNode.getComputedLeft(),n+=d.yogaNode.getComputedTop(),d.nodeName==="ink-box"){const a=d.style.overflow??"visible",i=d.style.overflowX??a;(d.style.overflowY??a)==="scroll"&&(n-=k(d)),i==="scroll"&&(s-=W(d))}d=d.parentNode}return{height:Math.round(r),width:Math.round(o),x:Math.round(s),y:Math.round(n)}},"getBoundingBox"),et=c(t=>{const e=t.internal_scrollState?.scrollHeight??0,o=t.internal_scrollState?.actualScrollHeight??0;return Math.max(0,e-o)},"getAddedScrollHeight"),G=c(t=>{const{axis:e,clientDimension:o,scrollbarDimension:r,scrollDimension:s,scrollPosition:n}=t,d=r*2,a=Math.max(e==="vertical"?2:1,Math.round(o/s*d)),i=s-o,g=d-a,u=i>0?Math.round(n/i*g):0,m=u,h=u+a,p=Math.floor(m/2);return{endIndex:Math.min(r,Math.ceil(h/2)),startIndex:p,thumbEndHalf:h,thumbStartHalf:m}},"calculateScrollbarThumb"),L=c(t=>{const{axis:e,clientDimension:o,hasOppositeScrollbar:r,height:s,marginBottom:n,marginRight:d,scrollDimension:a,scrollPosition:i,width:g,x:u,y:m}=t;if(a<=o)return;if(e==="vertical"){const{endIndex:x,startIndex:B,thumbEndHalf:v,thumbStartHalf:D}=G({axis:e,clientDimension:o,scrollbarDimension:s,scrollDimension:a,scrollPosition:i}),E=u+g-1-d;return{height:s,thumb:{end:x,endHalf:v,height:x-B,start:B,startHalf:D,width:1,x:E,y:m+B},width:1,x:E,y:m}}const h=g-(r?1:0),{endIndex:p,startIndex:y,thumbEndHalf:C,thumbStartHalf:f}=G({axis:e,clientDimension:o,scrollbarDimension:h,scrollDimension:a,scrollPosition:i}),T=m+s-1-n;return{height:1,thumb:{end:p,endHalf:C,height:1,start:y,startHalf:f,width:p-y,x:u+y,y:T},width:h,x:u,y:T}},"calculateScrollbarLayout"),ot=c((t,e)=>{const{yogaNode:o}=t;if(!o)return;const r=t.style.overflow??"visible";if((t.style.overflowY??r)!=="scroll")return;const s=t.internal_scrollState?.clientHeight??0,n=t.internal_scrollState?.scrollHeight??0;if(n<=s)return;const{x:d,y:a}=e??O(t),i=o.getComputedHeight()-o.getComputedBorder(l.EDGE_TOP)-o.getComputedBorder(l.EDGE_BOTTOM);return L({axis:"vertical",clientDimension:s,hasOppositeScrollbar:!1,height:i,marginBottom:o.getComputedBorder(l.EDGE_BOTTOM),marginRight:o.getComputedBorder(l.EDGE_RIGHT),scrollDimension:n,scrollPosition:t.internal_scrollState?.scrollTop??0,width:o.getComputedWidth()-o.getComputedBorder(l.EDGE_LEFT),x:d+o.getComputedBorder(l.EDGE_LEFT),y:a+o.getComputedBorder(l.EDGE_TOP)})},"getVerticalScrollbarBoundingBox"),nt=c((t,e)=>{const{yogaNode:o}=t;if(!o)return;const r=t.style.overflow??"visible";if((t.style.overflowX??r)!=="scroll")return;const s=t.internal_scrollState?.clientWidth??0,n=t.internal_scrollState?.scrollWidth??0;if(n<=s)return;const{x:d,y:a}=e??O(t),i=t.style.overflowY??r,g=t.internal_scrollState?.clientHeight??0,u=t.internal_scrollState?.scrollHeight??0,m=i==="scroll"&&u>g;return L({axis:"horizontal",clientDimension:s,hasOppositeScrollbar:m,height:o.getComputedHeight()-o.getComputedBorder(l.EDGE_TOP),marginBottom:o.getComputedBorder(l.EDGE_BOTTOM),marginRight:o.getComputedBorder(l.EDGE_RIGHT),scrollDimension:n,scrollPosition:t.internal_scrollState?.scrollLeft??0,width:o.getComputedWidth()-o.getComputedBorder(l.EDGE_LEFT)-o.getComputedBorder(l.EDGE_RIGHT),x:d+o.getComputedBorder(l.EDGE_LEFT),y:a+o.getComputedBorder(l.EDGE_TOP)})},"getHorizontalScrollbarBoundingBox"),rt=c((t,e)=>{if(!t.yogaNode||t===e)return 0;let o=t.yogaNode.getComputedTop(),r=t.parentNode;for(;r&&r!==e;)r.yogaNode&&(o+=r.yogaNode.getComputedTop()),r=r.parentNode;if(!(e!==void 0&&r!==e))return Math.round(o)},"getRelativeTop"),at=c((t,e)=>{if(!t.yogaNode||t===e)return 0;let o=t.yogaNode.getComputedLeft(),r=t.parentNode;for(;r&&r!==e;)r.yogaNode&&(o+=r.yogaNode.getComputedLeft()),r=r.parentNode;if(!(e!==void 0&&r!==e))return Math.round(o)},"getRelativeLeft"),$=c(t=>t.nodeName==="#text"?t.nodeValue:t.nodeName==="ink-text"||t.nodeName==="ink-virtual-text"?Y(t):"","getText"),V=c(t=>{const e=[],o=c((n,d,a)=>{const{visualX:i,visualY:g,x:u,y:m}=d;let h=0,p=0,y=a;const{userSelect:C}=n.style;if(C==="none"?y=!1:(C==="text"||C==="all")&&(y=!0),n.nodeName==="ink-text"||n.nodeName==="ink-virtual-text"){if(y){const f=$(n);return e.push({height:Math.round(n.yogaNode?.getComputedHeight()??0),node:n,text:f,visualX:Math.round(i),visualY:Math.round(g),width:Math.round(n.yogaNode?.getComputedWidth()??0),x:Math.round(u),y:Math.round(m)}),{h:0,hasContent:!0,v:0}}return{h:n.yogaNode?.getComputedWidth()??0,hasContent:!1,v:n.yogaNode?.getComputedHeight()??0}}if(n.nodeName==="ink-box"||n.nodeName==="ink-root"){if(!n.yogaNode||n.yogaNode.getDisplay()===l.DISPLAY_NONE)return{h:0,hasContent:!1,v:0};const f=n.yogaNode.getComputedBorder(l.EDGE_TOP),T=n.yogaNode.getComputedBorder(l.EDGE_BOTTOM),x=n.yogaNode.getComputedBorder(l.EDGE_LEFT),B=n.yogaNode.getComputedBorder(l.EDGE_RIGHT);h+=f+T,p+=x+B;const v=n.yogaNode.getFlexDirection(),D=v===l.FLEX_DIRECTION_COLUMN||v===l.FLEX_DIRECTION_COLUMN_REVERSE;let E=0,b=0,S=!1;for(const N of n.childNodes)if(N.yogaNode){const w=u+N.yogaNode.getComputedLeft()-x-E,I=m+N.yogaNode.getComputedTop()-f-b,R=i+N.yogaNode.getComputedLeft(),X=g+N.yogaNode.getComputedTop(),H=o(N,{visualX:R,visualY:X,x:w,y:I},y);H.hasContent&&(S=!0),D?b+=H.v:E+=H.h}return D?h+=b:p+=E,{h:p,hasContent:S,v:h}}return{h:0,hasContent:!1,v:0}},"collect"),{h:r,v:s}=o(t,{visualX:0,visualY:0,x:0,y:0},!0);return e.sort((n,d)=>n.y!==d.y?n.y-d.y:n.x-d.x),{fragments:e,removedHorizontal:Math.round(r),removedVertical:Math.round(s)}},"collectSortedFragments");var z=Object.defineProperty,_=M((t,e)=>z(t,"name",{value:e,configurable:!0}),"a");const P=_(t=>{let e=t,o=0,r=0;for(;e?.parentNode;){if(!e.yogaNode)return;o+=e.yogaNode.getComputedLeft(),r+=e.yogaNode.getComputedTop(),e=e.parentNode}return{x:o,y:r}},"getAbsoluteBorderPosition"),j=_(t=>P(t),"getAbsolutePosition"),it=_(t=>{const e=P(t);if(!(!e||!t.yogaNode))return{x:e.x+t.yogaNode.getComputedBorder(l.EDGE_LEFT)+t.yogaNode.getComputedPadding(l.EDGE_LEFT),y:e.y+t.yogaNode.getComputedBorder(l.EDGE_TOP)+t.yogaNode.getComputedPadding(l.EDGE_TOP)}},"getAbsoluteContentPosition"),lt=_((t,e)=>{const{initialState:o,onNewline:r,onSpace:s,onText:n}=e;if(t.nodeName!=="ink-box"&&t.nodeName!=="ink-root"&&t.nodeName!=="ink-text"&&t.nodeName!=="ink-virtual-text"||!t.yogaNode)return{lineBottom:0,state:o()};const{fragments:d}=V(t),a=o();a.currentX=0,a.lineBottom=0,a.yieldedContent=!1;for(const i of d){if(i.y>=a.lineBottom){const g=i.y-a.lineBottom,u=a.yieldedContent?1+g:g;u>0&&(r(u,a),a.currentX=0),a.lineBottom=i.y}if(i.x>a.currentX){const g=i.x-a.currentX;s(g,a),a.currentX=i.x}if(i.text.length>0&&(a.yieldedContent=!0,n(i,a)),(i.text.match(/\n/g)??[]).length>0){const g=i.text.lastIndexOf(`
1
+ var F=Object.defineProperty;var M=(t,e)=>F(t,"name",{value:e,configurable:!0});import l from"yoga-layout";import{getScrollTop as k,getScrollLeft as W}from"./getScrollHeight-ClEOyLHH.js";import Y from"./squashTextNodesWithMap-Cpqmc45i.js";var A=Object.defineProperty,c=M((t,e)=>A(t,"name",{value:e,configurable:!0}),"u");const Q=c(t=>{const e=j(t);return{height:Math.round(t.yogaNode?.getComputedHeight()??0),width:Math.round(t.yogaNode?.getComputedWidth()??0),x:Math.round(e?.x??0),y:Math.round(e?.y??0)}},"measureElement"),Z=c(t=>{const{yogaNode:e}=t;if(!e)return 0;const o=e.getComputedWidth()??0,r=e.getComputedBorder(l.EDGE_LEFT),s=e.getComputedBorder(l.EDGE_RIGHT);return Math.round(o-r-s)},"getInnerWidth"),tt=c(t=>{const{yogaNode:e}=t;if(!e)return 0;const o=e.getComputedHeight()??0,r=e.getComputedBorder(l.EDGE_TOP),s=e.getComputedBorder(l.EDGE_BOTTOM);return Math.round(o-r-s)},"getInnerHeight"),O=c(t=>{const{yogaNode:e}=t;if(!e)return{height:0,width:0,x:0,y:0};const o=e.getComputedWidth()??0,r=e.getComputedHeight()??0;let s=e.getComputedLeft(),n=e.getComputedTop(),d=t.parentNode;for(;d?.yogaNode;){if(s+=d.yogaNode.getComputedLeft(),n+=d.yogaNode.getComputedTop(),d.nodeName==="ink-box"){const a=d.style.overflow??"visible",i=d.style.overflowX??a;(d.style.overflowY??a)==="scroll"&&(n-=k(d)),i==="scroll"&&(s-=W(d))}d=d.parentNode}return{height:Math.round(r),width:Math.round(o),x:Math.round(s),y:Math.round(n)}},"getBoundingBox"),et=c(t=>{const e=t.internal_scrollState?.scrollHeight??0,o=t.internal_scrollState?.actualScrollHeight??0;return Math.max(0,e-o)},"getAddedScrollHeight"),G=c(t=>{const{axis:e,clientDimension:o,scrollbarDimension:r,scrollDimension:s,scrollPosition:n}=t,d=r*2,a=Math.max(e==="vertical"?2:1,Math.round(o/s*d)),i=s-o,g=d-a,u=i>0?Math.round(n/i*g):0,m=u,h=u+a,p=Math.floor(m/2);return{endIndex:Math.min(r,Math.ceil(h/2)),startIndex:p,thumbEndHalf:h,thumbStartHalf:m}},"calculateScrollbarThumb"),L=c(t=>{const{axis:e,clientDimension:o,hasOppositeScrollbar:r,height:s,marginBottom:n,marginRight:d,scrollDimension:a,scrollPosition:i,width:g,x:u,y:m}=t;if(a<=o)return;if(e==="vertical"){const{endIndex:x,startIndex:B,thumbEndHalf:v,thumbStartHalf:D}=G({axis:e,clientDimension:o,scrollbarDimension:s,scrollDimension:a,scrollPosition:i}),E=u+g-1-d;return{height:s,thumb:{end:x,endHalf:v,height:x-B,start:B,startHalf:D,width:1,x:E,y:m+B},width:1,x:E,y:m}}const h=g-(r?1:0),{endIndex:p,startIndex:y,thumbEndHalf:C,thumbStartHalf:f}=G({axis:e,clientDimension:o,scrollbarDimension:h,scrollDimension:a,scrollPosition:i}),T=m+s-1-n;return{height:1,thumb:{end:p,endHalf:C,height:1,start:y,startHalf:f,width:p-y,x:u+y,y:T},width:h,x:u,y:T}},"calculateScrollbarLayout"),ot=c((t,e)=>{const{yogaNode:o}=t;if(!o)return;const r=t.style.overflow??"visible";if((t.style.overflowY??r)!=="scroll")return;const s=t.internal_scrollState?.clientHeight??0,n=t.internal_scrollState?.scrollHeight??0;if(n<=s)return;const{x:d,y:a}=e??O(t),i=o.getComputedHeight()-o.getComputedBorder(l.EDGE_TOP)-o.getComputedBorder(l.EDGE_BOTTOM);return L({axis:"vertical",clientDimension:s,hasOppositeScrollbar:!1,height:i,marginBottom:o.getComputedBorder(l.EDGE_BOTTOM),marginRight:o.getComputedBorder(l.EDGE_RIGHT),scrollDimension:n,scrollPosition:t.internal_scrollState?.scrollTop??0,width:o.getComputedWidth()-o.getComputedBorder(l.EDGE_LEFT),x:d+o.getComputedBorder(l.EDGE_LEFT),y:a+o.getComputedBorder(l.EDGE_TOP)})},"getVerticalScrollbarBoundingBox"),nt=c((t,e)=>{const{yogaNode:o}=t;if(!o)return;const r=t.style.overflow??"visible";if((t.style.overflowX??r)!=="scroll")return;const s=t.internal_scrollState?.clientWidth??0,n=t.internal_scrollState?.scrollWidth??0;if(n<=s)return;const{x:d,y:a}=e??O(t),i=t.style.overflowY??r,g=t.internal_scrollState?.clientHeight??0,u=t.internal_scrollState?.scrollHeight??0,m=i==="scroll"&&u>g;return L({axis:"horizontal",clientDimension:s,hasOppositeScrollbar:m,height:o.getComputedHeight()-o.getComputedBorder(l.EDGE_TOP),marginBottom:o.getComputedBorder(l.EDGE_BOTTOM),marginRight:o.getComputedBorder(l.EDGE_RIGHT),scrollDimension:n,scrollPosition:t.internal_scrollState?.scrollLeft??0,width:o.getComputedWidth()-o.getComputedBorder(l.EDGE_LEFT)-o.getComputedBorder(l.EDGE_RIGHT),x:d+o.getComputedBorder(l.EDGE_LEFT),y:a+o.getComputedBorder(l.EDGE_TOP)})},"getHorizontalScrollbarBoundingBox"),rt=c((t,e)=>{if(!t.yogaNode||t===e)return 0;let o=t.yogaNode.getComputedTop(),r=t.parentNode;for(;r&&r!==e;)r.yogaNode&&(o+=r.yogaNode.getComputedTop()),r=r.parentNode;if(!(e!==void 0&&r!==e))return Math.round(o)},"getRelativeTop"),at=c((t,e)=>{if(!t.yogaNode||t===e)return 0;let o=t.yogaNode.getComputedLeft(),r=t.parentNode;for(;r&&r!==e;)r.yogaNode&&(o+=r.yogaNode.getComputedLeft()),r=r.parentNode;if(!(e!==void 0&&r!==e))return Math.round(o)},"getRelativeLeft"),$=c(t=>t.nodeName==="#text"?t.nodeValue:t.nodeName==="ink-text"||t.nodeName==="ink-virtual-text"?Y(t):"","getText"),V=c(t=>{const e=[],o=c((n,d,a)=>{const{visualX:i,visualY:g,x:u,y:m}=d;let h=0,p=0,y=a;const{userSelect:C}=n.style;if(C==="none"?y=!1:(C==="text"||C==="all")&&(y=!0),n.nodeName==="ink-text"||n.nodeName==="ink-virtual-text"){if(y){const f=$(n);return e.push({height:Math.round(n.yogaNode?.getComputedHeight()??0),node:n,text:f,visualX:Math.round(i),visualY:Math.round(g),width:Math.round(n.yogaNode?.getComputedWidth()??0),x:Math.round(u),y:Math.round(m)}),{h:0,hasContent:!0,v:0}}return{h:n.yogaNode?.getComputedWidth()??0,hasContent:!1,v:n.yogaNode?.getComputedHeight()??0}}if(n.nodeName==="ink-box"||n.nodeName==="ink-root"){if(!n.yogaNode||n.yogaNode.getDisplay()===l.DISPLAY_NONE)return{h:0,hasContent:!1,v:0};const f=n.yogaNode.getComputedBorder(l.EDGE_TOP),T=n.yogaNode.getComputedBorder(l.EDGE_BOTTOM),x=n.yogaNode.getComputedBorder(l.EDGE_LEFT),B=n.yogaNode.getComputedBorder(l.EDGE_RIGHT);h+=f+T,p+=x+B;const v=n.yogaNode.getFlexDirection(),D=v===l.FLEX_DIRECTION_COLUMN||v===l.FLEX_DIRECTION_COLUMN_REVERSE;let E=0,b=0,S=!1;for(const N of n.childNodes)if(N.yogaNode){const w=u+N.yogaNode.getComputedLeft()-x-E,I=m+N.yogaNode.getComputedTop()-f-b,R=i+N.yogaNode.getComputedLeft(),X=g+N.yogaNode.getComputedTop(),H=o(N,{visualX:R,visualY:X,x:w,y:I},y);H.hasContent&&(S=!0),D?b+=H.v:E+=H.h}return D?h+=b:p+=E,{h:p,hasContent:S,v:h}}return{h:0,hasContent:!1,v:0}},"collect"),{h:r,v:s}=o(t,{visualX:0,visualY:0,x:0,y:0},!0);return e.sort((n,d)=>n.y!==d.y?n.y-d.y:n.x-d.x),{fragments:e,removedHorizontal:Math.round(r),removedVertical:Math.round(s)}},"collectSortedFragments");var z=Object.defineProperty,_=M((t,e)=>z(t,"name",{value:e,configurable:!0}),"a");const P=_(t=>{let e=t,o=0,r=0;for(;e?.parentNode;){if(!e.yogaNode)return;o+=e.yogaNode.getComputedLeft(),r+=e.yogaNode.getComputedTop(),e=e.parentNode}return{x:o,y:r}},"getAbsoluteBorderPosition"),j=_(t=>P(t),"getAbsolutePosition"),it=_(t=>{const e=P(t);if(!(!e||!t.yogaNode))return{x:e.x+t.yogaNode.getComputedBorder(l.EDGE_LEFT)+t.yogaNode.getComputedPadding(l.EDGE_LEFT),y:e.y+t.yogaNode.getComputedBorder(l.EDGE_TOP)+t.yogaNode.getComputedPadding(l.EDGE_TOP)}},"getAbsoluteContentPosition"),lt=_((t,e)=>{const{initialState:o,onNewline:r,onSpace:s,onText:n}=e;if(t.nodeName!=="ink-box"&&t.nodeName!=="ink-root"&&t.nodeName!=="ink-text"&&t.nodeName!=="ink-virtual-text"||!t.yogaNode)return{lineBottom:0,state:o()};const{fragments:d}=V(t),a=o();a.currentX=0,a.lineBottom=0,a.yieldedContent=!1;for(const i of d){if(i.y>=a.lineBottom){const g=i.y-a.lineBottom,u=a.yieldedContent?1+g:g;u>0&&(r(u,a),a.currentX=0),a.lineBottom=i.y}if(i.x>a.currentX){const g=i.x-a.currentX;s(g,a),a.currentX=i.x}if(i.text.length>0&&(a.yieldedContent=!0,n(i,a)),(i.text.match(/\n/g)??[]).length>0){const g=i.text.lastIndexOf(`
2
2
  `);a.currentX=i.text.length-g-1}else a.currentX+=i.text.length;a.lineBottom=Math.max(a.lineBottom,i.y+i.height)}return{lineBottom:a.lineBottom,state:a}},"processLayout");export{Q as P,G as a,V as b,L as c,O as d,nt as e,tt as f,et as g,Z as h,at as i,rt as j,$ as k,ot as l,it as m,j as n,lt as p};
@@ -1,3 +1,3 @@
1
- var X=Object.defineProperty;var k=(n,t)=>X(n,"name",{value:t,configurable:!0});import{y as Y,p as Z,o as tt}from"./get-string-width-4oMZhv2Q.js";import{t as et}from"./ansi-tokenizer-DqX9nJuk.js";var st=Object.defineProperty,at=k((n,t)=>st(n,"name",{value:t,configurable:!0}),"r$2"),nt=Object.defineProperty,rt=at((n,t)=>nt(n,"name",{value:t,configurable:!0}),"a"),it=Object.defineProperty,ht=rt((n,t)=>it(n,"name",{value:t,configurable:!0}),"i");const lt=ht(n=>Number.isInteger(n)?Y(n)||Z(n):!1,"isFullwidthCodePoint");var ot=Object.defineProperty,ct=k((n,t)=>ot(n,"name",{value:t,configurable:!0}),"r$1");let H=class{static{k(this,"h")}static{ct(this,"DataLimitedLruMap")}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)){for(this.map.has(t)&&(this.map.delete(t),this.currentDataSize-=s);this.currentDataSize+s>this.maxDataSize&&this.map.size>0;){const a=this.map.keys().next().value;if(a===void 0)break;this.map.delete(a),this.currentDataSize-=a.length}for(;this.map.size>=this.maxKeys;){const a=this.map.keys().next().value;if(a===void 0)break;this.map.delete(a),this.currentDataSize-=a.length}this.map.set(t,e),this.currentDataSize+=s}}};const gt=1,ft=2,E=4,K=8,R=16,M=32,V=64,S=128;var ut=Object.defineProperty,dt=k((n,t)=>ut(n,"name",{value:t,configurable:!0}),"x");const p=1073741823,x=1073741824;class d{static{k(this,"StyledLine")}static{dt(this,"StyledLine")}length=0;static emptyCache=new Map;text;charData;spans;_cachedTrimmedLength;static empty(t){if(t<=0)return new d;const e=d.emptyCache.get(t);if(e)return e.clone();const s=new d;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),d.emptyCache.set(t,s),s.clone()}getValue(t){if(this.text===void 0||t<0||t>=this.length)return"";const e=this.charData[t]&p,s=t+1<this.length?this.charData[t+1]&p: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]&p,a=e<this.length?this.charData[e]&p: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]&x)!==0}hasStyles(t){const e=this.getSpan(t);return e?(e.formatFlags&~S)!==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|=S),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|=M:s.formatFlags&=~M})}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,r,h){if(t<0||t>=this.length)return;this._cachedTrimmedLength=void 0,this.ensureInitialized();const i=(s&S)!==0,o=s&~S,l=this.charData[t]&p,c=t+1<this.length?this.charData[t+1]&p:this.text.length,m=c-l,b=e.length;if(this.text=this.text.slice(0,l)+e+this.text.slice(c),m!==b){const f=b-m;for(let v=t+1;v<this.length;v++){const T=this.charData[v],w=T&p,L=T&x;this.charData[v]=w+f|L}}if(this.charData[t]=l|(i?x:0),this.trySetStyleAtIndex(t,o,a,r,h))return;this.splitSpansAt(t),this.splitSpansAt(t+1);let u=0;for(let f=0;f<this.spans.length;f++){const v=this.spans[f];if(u===t&&v.length===1){this.spans[f]={bgColor:r,fgColor:a,formatFlags:o,length:1,link:h};break}u+=v.length}this.mergeSpans()}setCharFast(t,e,s,a,r,h){if(t<0||t>=this.length)return;this._cachedTrimmedLength=void 0,this.ensureInitialized();const i=(s&S)!==0,o=s&~S,l=this.charData[t]&p,c=t+1<this.length?this.charData[t+1]&p:this.text.length,m=c-l;if(e.length===m)e!==this.text.slice(l,c)&&(this.text=this.text.slice(0,l)+e+this.text.slice(c)),this.charData[t]=l|(i?x:0);else{if(this.text=this.text.slice(0,l)+e+this.text.slice(c),m!==e.length){const u=e.length-m;for(let f=t+1;f<this.length;f++){const v=this.charData[f];this.charData[f]=(v&p)+u|v&x}}this.charData[t]=l|(i?x:0)}if(this.trySetStyleAtIndex(t,o,a,r,h))return;this.splitSpansAt(t),this.splitSpansAt(t+1);let b=0;for(let u=0;u<this.spans.length;u++){const f=this.spans[u];if(b===t&&f.length===1){this.spans[u]={bgColor:r,fgColor:a,formatFlags:o,length:1,link:h};break}b+=f.length}this.mergeSpans()}writeFrom(t,e,s=0,a){const r=a??e.length-s;if(r<=0||t>=this.length)return;this._cachedTrimmedLength=void 0,this.ensureInitialized();const h=Math.min(r,this.length-t,e.length-s),i=this.charData[t]&p,o=t+h<this.length?this.charData[t+h]&p:this.text.length;let l="";for(let g=0;g<h;g++)l+=e.getValue(s+g);const c=o-i,m=l.length-c;this.text=this.text.slice(0,i)+l+this.text.slice(o);let b=i;for(let g=0;g<h;g++){const D=e.getFullWidth(s+g);this.charData[t+g]=b|(D?x:0),b+=e.getValue(s+g).length}if(m!==0)for(let g=t+h;g<this.length;g++){const D=this.charData[g];this.charData[g]=(D&p)+m|D&x}this.splitSpansAt(t),this.splitSpansAt(t+h);const u=[];let f=0;for(const g of e.getSpans()){const D=f+g.length,P=Math.max(s,f),j=Math.min(s+h,D);if(P<j&&u.push({...g,length:j-P}),f=D,f>=s+h)break}let v=0,T=0;for(let g=0;g<this.spans.length;g++){if(T===t){v=g;break}T+=this.spans[g].length}let w=0,L=0;for(let g=v;g<this.spans.length&&L<h;g++)L+=this.spans[g].length,w++;this.spans.splice(v,w,...u),this.mergeSpans()}pushChar(t,e,s,a,r){this._cachedTrimmedLength=void 0,this.ensureInitialized();const h=(e&S)!==0,i=e&~S,o=this.text.length;this.text=(this.text??"")+t,this.charData.push(o|(h?x:0));const l=this.spans.at(-1);l?.formatFlags===i&&l.fgColor===s&&l.bgColor===a&&l.link===r?l.length++:this.spans.push({bgColor:a,fgColor:s,formatFlags:i,length:1,link:r}),this.length++}clone(){if(this.charData===void 0)return new d;const t=new d;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 d;const s=Math.max(0,t),a=e===void 0?this.length:Math.min(this.length,e);if(s>=a)return new d;if(s===0&&a===this.length)return this.clone();const r=new d;r.length=a-s,r.charData=Array.from({length:r.length});const h=this.charData[s]&p,i=a<this.length?this.charData[a]&p:this.text.length;r.text=this.text.slice(h,i);for(let c=0;c<r.length;c++){const m=this.charData[s+c],b=m&p,u=m&x;r.charData[c]=b-h|u}const o=[];let l=0;for(const c of this.spans){const m=l,b=l+c.length,u=Math.max(s,m),f=Math.min(a,b);if(u<f&&o.push({...c,length:f-u}),l+=c.length,l>=a)break}return r.spans=o,r.mergeSpans(),r}combine(...t){if(t.length===0)return this.clone();const e=[this,...t].filter(i=>i.length>0);if(e.length===0)return new d;if(e.length===1)return e[0].clone();let s=0;for(const i of e)s+=i.length;const a=new d;a.length=s,a.text=e.map(i=>i.getText()).join(""),a.charData=Array.from({length:s});let r=0,h=0;for(const i of e){const o=i.charData,l=i.getText();if(o)for(let c=0;c<i.length;c++){const m=o[c],b=m&p,u=m&x;a.charData[r+c]=h+b|u}else for(let c=0;c<i.length;c++)a.charData[r+c]=h+c;r+=i.length,h+=l.length}return a.spans=e.flatMap(i=>i.getSpans().map(o=>({...o}))),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&~S)!==0||s.fgColor!==void 0||s.bgColor!==void 0||s.link!==void 0)return this._cachedTrimmedLength=t+1,this._cachedTrimmedLength;for(let a=0;a<s.length;a++){const r=this.charData[t]&p;if((t+1<this.length?this.charData[t+1]&p:this.text.length)-r!==1||this.text[r]!==" ")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 d: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[h,i]of e.entries()){const o=i,l=s[h];if(o.length!==l.length||o.formatFlags!==l.formatFlags||o.fgColor!==l.fgColor||o.bgColor!==l.bgColor||o.link!==l.link)return!1}const a=this.charData,r=t.charData;if(a&&r){for(let h=0;h<this.length;h++)if(a[h]!==r[h])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 r=s[t],h=r?r.formatFlags:0,i=this.getFullWidth(a);yield{bgColor:r?.bgColor,fgColor:r?.fgColor,formatFlags:h|(i?S:0),fullWidth:i,hasStyles:(h&~S)!==0||r?.fgColor!==void 0||r?.bgColor!==void 0||r?.link!==void 0,link:r?.link,value:this.getValue(a)},r&&(e++,e>=r.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 h=0;h<s;h++)this.charData.push(a);this.length=t;const r=this.spans.at(-1);r?.formatFlags===0&&r.fgColor===void 0&&r.bgColor===void 0&&r.link===void 0?r.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 r=t-e,h=a.length-r;this.spans.splice(s,1,{...a,length:r},{...a,length:h});return}e+=a.length}}trySetStyleAtIndex(t,e,s,a,r){if(!this.spans)return!1;let h=0,i=-1,o;for(let l=0;l<this.spans.length;l++){const c=this.spans[l];if(h<=t&&h+c.length>t){i=l,o=c;break}h+=c.length}if(!o)return!1;if(o.formatFlags===e&&o.fgColor===s&&o.bgColor===a&&o.link===r)return!0;if(t===h&&i>0){const l=this.spans[i-1];if(l.formatFlags===e&&l.fgColor===s&&l.bgColor===a&&l.link===r)return l.length+=1,o.length===1?this.spans.splice(i,1):o.length-=1,!0}if(t===h+o.length-1&&i<this.spans.length-1){const l=this.spans[i+1];if(l.formatFlags===e&&l.fgColor===s&&l.bgColor===a&&l.link===r)return l.length+=1,o.length===1?this.spans.splice(i,1):o.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}}var mt=Object.defineProperty,I=k((n,t)=>mt(n,"name",{value:t,configurable:!0}),"u$1");const G={black:0,blue:4,cyan:6,gray:8,green:2,grey:8,magenta:5,red:1,white:7,yellow:3},U={blackBright:8,blueBright:12,cyanBright:14,greenBright:10,magentaBright:13,redBright:9,whiteBright:15,yellowBright:11},q=/^ansi256\(\s?(\d+)\s?\)$/,J=/^rgb\(\s?(\d+),\s?(\d+),\s?(\d+)\s?\)$/,Et=I(n=>{const t=G[n];if(t!==void 0)return t;const e=U[n];if(e!==void 0)return e;const s=q.exec(n);if(s)return Number(s[1])&255;if(n.startsWith("#")&&n.length===7){const r=Number.parseInt(n.slice(1,3),16),h=Number.parseInt(n.slice(3,5),16),i=Number.parseInt(n.slice(5,7),16);return 16+36*Math.round(r/51)+6*Math.round(h/51)+Math.round(i/51)}const a=J.exec(n);return a?16+36*Math.round(Number(a[1])/51)+6*Math.round(Number(a[2])/51)+Math.round(Number(a[3])/51):255},"colorToAnsi256"),pt=I((n,t)=>{const e=t?30:40,s=G[n];if(s!==void 0)return[e+s];const a=U[n];if(a!==void 0)return[e+60+(a-8)];if(n.startsWith("#")&&n.length===7){const i=Number.parseInt(n.slice(1,3),16),o=Number.parseInt(n.slice(3,5),16),l=Number.parseInt(n.slice(5,7),16);return[t?38:48,2,i,o,l]}const r=q.exec(n);if(r)return[t?38:48,5,Number(r[1])];const h=J.exec(n);return h?[t?38:48,2,Number(h[1]),Number(h[2]),Number(h[3])]:[]},"colorToSgrParams");I((n,t)=>{const e=pt(n,t);if(e.length!==0)return`\x1B[${e.join(";")}m`},"colorToAnsiCode");const A=I(n=>{const t=["black","red","green","yellow","blue","magenta","cyan","white"];return n>=0&&n<=7?t[n]:`ansi256(${n})`},"ansi256ToColorName");var bt=Object.defineProperty,y=k((n,t)=>bt(n,"name",{value:t,configurable:!0}),"u");const O=y(()=>({bgColor:void 0,fgColor:void 0,formatFlags:0,link:void 0}),"createSgrState"),vt=y((n,t)=>{if(t.length===0)return O();const e=(t.includes(":")?t.replaceAll(":",";"):t).split(";").filter(o=>o.length>0).map(Number);let{bgColor:s,fgColor:a,formatFlags:r,link:h}=n,i=0;for(;i<e.length;){const o=e[i];switch(o){case 0:{r=0,a=void 0,s=void 0,h=void 0;break}case 1:{r|=gt;break}case 2:{r|=ft;break}case 3:{r|=E;break}case 4:{r|=K;break}case 7:{r|=M;break}case 8:{r|=V;break}case 9:{r|=R;break}case 22:{r&=-4;break}case 23:{r&=~E;break}case 24:{r&=~K;break}case 27:{r&=~M;break}case 28:{r&=~V;break}case 29:{r&=~R;break}case 30:case 31:case 32:case 33:case 34:case 35:case 36:case 37:{a=A(o-30);break}case 38:{e[i+1]===5&&e[i+2]!==void 0?(a=A(e[i+2]),i+=2):e[i+1]===2&&i+4<e.length&&(a=`rgb(${e[i+2]}, ${e[i+3]}, ${e[i+4]})`,i+=4);break}case 39:{a=void 0;break}case 40:case 41:case 42:case 43:case 44:case 45:case 46:case 47:{s=A(o-40);break}case 48:{e[i+1]===5&&e[i+2]!==void 0?(s=A(e[i+2]),i+=2):e[i+1]===2&&i+4<e.length&&(s=`rgb(${e[i+2]}, ${e[i+3]}, ${e[i+4]})`,i+=4);break}case 49:{s=void 0;break}case 90:case 91:case 92:case 93:case 94:case 95:case 96:case 97:{a=`ansi256(${o-90+8})`;break}case 100:case 101:case 102:case 103:case 104:case 105:case 106:case 107:{s=`ansi256(${o-100+8})`;break}}i++}return{bgColor:s,fgColor:a,formatFlags:r,link:h}},"applySgrParams"),$=127462,z=127487,St=127995,xt=127999,Ct=8205,kt=917504,Dt=917631,yt=new RegExp("\\p{Mark}","u"),Tt=new Intl.Segmenter(void 0,{granularity:"grapheme"}),Ft=y((n,t)=>!!(lt(t)||n.includes("️")||t>=$&&t<=z),"isFullwidthGrapheme"),wt=/(?:\u001B\]|\u009D)8;([^;]*);(.*?)(?:\u001B\\|\u0007|\u009C)/,Lt=y(n=>{const t=wt.exec(n);return!t?.[2]||t[2].length===0?void 0:n.endsWith("\x1B\\")?`ST:${t[2]}`:t[2]},"parseOscHyperlink"),Q=y((n,t,e)=>{const s=Tt.segment(n),a=[];for(const{segment:r}of s)a.push(r);for(let r=0;r<a.length;r++){let h=a[r];if(h===" "){for(let l=0;l<4;l++)t.pushChar(" ",e.formatFlags,e.fgColor,e.bgColor,e.link);continue}if(h==="\b")continue;const i=h.codePointAt(0);if(!i)continue;if(i>=$&&i<=z&&r+1<a.length){const l=a[r+1],c=l.codePointAt(0);c&&c>=$&&c<=z&&(h+=l,r++)}else for(;r+1<a.length;){const l=a[r+1],c=l.codePointAt(0);if(!c)break;const m=yt.test(String.fromCodePoint(c)),b=c>=St&&c<=xt,u=c===Ct,f=c>=kt&&c<=Dt;if(!m&&!b&&!u&&!f)break;h+=l,r++,u&&r+1<a.length&&(h+=a[r+1],r++)}const o=Ft(h,i)?e.formatFlags|S:e.formatFlags;t.pushChar(h,o,e.fgColor,e.bgColor,e.link)}},"processTextToken"),At=y(n=>{if(n.length===0)return new d;const t=et(n),e=new d;let s=O();for(const a of t)switch(a.type){case"csi":{a.finalCharacter==="m"&&(s=vt(s,a.parameterString));break}case"osc":{const r=Lt(a.value);r!==void 0?s={...s,link:r}:a.value.includes("8;")&&(s={...s,link:void 0});break}case"text":{Q(a.value,e,s);break}}return e},"textToStyledLine"),Mt=/^[\u0020-\u007E]*$/,Kt=y(n=>{if(n.length===0)return new d;const t=new d;if(Mt.test(n)){for(const e of n)t.pushChar(e,0);return t}return Q(n,t,O()),t},"plainTextToStyledLine");var It=Object.defineProperty,C=k((n,t)=>It(n,"name",{value:t,configurable:!0}),"r");const N=new H(1e4,1e6),B=new Map,F=new H(1e4,1e6);let W=!0,_=tt;const Rt=C(n=>{W=n,n||F.clear()},"setEnableStyledLineCache"),Vt=C(()=>{F.clear()},"clearStyledLineCache"),Ht=C(n=>{_=n,$t()},"setStringWidthFunction"),$t=C(()=>{N.clear(),B.clear(),F.clear()},"clearStringWidthCache"),zt=C(n=>{if(n.length===1){const s=n.codePointAt(0);if(s!==void 0&&s>=32&&s<127)return 1}const t=B.get(n);if(t!==void 0)return t;let e;try{e=_(n)}catch{e=1}return B.set(n,e),e},"inkCharacterWidth"),Nt=C(n=>{try{return _(n)}catch{return 1}},"safeGetStringWidth"),Gt=C(n=>{if(n.length===0)return{height:0,width:0};const t=N.get(n);if(t)return t;const e=n.split(`
1
+ var X=Object.defineProperty;var k=(n,t)=>X(n,"name",{value:t,configurable:!0});import{v as Y,c as Z,o as tt}from"./get-string-width-CbMPWEJO.js";import{t as et}from"./ansi-tokenizer-DqX9nJuk.js";var st=Object.defineProperty,at=k((n,t)=>st(n,"name",{value:t,configurable:!0}),"r$2"),nt=Object.defineProperty,rt=at((n,t)=>nt(n,"name",{value:t,configurable:!0}),"a"),it=Object.defineProperty,ht=rt((n,t)=>it(n,"name",{value:t,configurable:!0}),"i");const lt=ht(n=>Number.isInteger(n)?Y(n)||Z(n):!1,"isFullwidthCodePoint");var ot=Object.defineProperty,ct=k((n,t)=>ot(n,"name",{value:t,configurable:!0}),"r$1");let H=class{static{k(this,"h")}static{ct(this,"DataLimitedLruMap")}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)){for(this.map.has(t)&&(this.map.delete(t),this.currentDataSize-=s);this.currentDataSize+s>this.maxDataSize&&this.map.size>0;){const a=this.map.keys().next().value;if(a===void 0)break;this.map.delete(a),this.currentDataSize-=a.length}for(;this.map.size>=this.maxKeys;){const a=this.map.keys().next().value;if(a===void 0)break;this.map.delete(a),this.currentDataSize-=a.length}this.map.set(t,e),this.currentDataSize+=s}}};const gt=1,ft=2,E=4,K=8,R=16,M=32,V=64,S=128;var ut=Object.defineProperty,dt=k((n,t)=>ut(n,"name",{value:t,configurable:!0}),"x");const p=1073741823,x=1073741824;class d{static{k(this,"StyledLine")}static{dt(this,"StyledLine")}length=0;static emptyCache=new Map;text;charData;spans;_cachedTrimmedLength;static empty(t){if(t<=0)return new d;const e=d.emptyCache.get(t);if(e)return e.clone();const s=new d;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),d.emptyCache.set(t,s),s.clone()}getValue(t){if(this.text===void 0||t<0||t>=this.length)return"";const e=this.charData[t]&p,s=t+1<this.length?this.charData[t+1]&p: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]&p,a=e<this.length?this.charData[e]&p: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]&x)!==0}hasStyles(t){const e=this.getSpan(t);return e?(e.formatFlags&~S)!==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|=S),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|=M:s.formatFlags&=~M})}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,r,h){if(t<0||t>=this.length)return;this._cachedTrimmedLength=void 0,this.ensureInitialized();const i=(s&S)!==0,o=s&~S,l=this.charData[t]&p,c=t+1<this.length?this.charData[t+1]&p:this.text.length,m=c-l,b=e.length;if(this.text=this.text.slice(0,l)+e+this.text.slice(c),m!==b){const f=b-m;for(let v=t+1;v<this.length;v++){const T=this.charData[v],w=T&p,L=T&x;this.charData[v]=w+f|L}}if(this.charData[t]=l|(i?x:0),this.trySetStyleAtIndex(t,o,a,r,h))return;this.splitSpansAt(t),this.splitSpansAt(t+1);let u=0;for(let f=0;f<this.spans.length;f++){const v=this.spans[f];if(u===t&&v.length===1){this.spans[f]={bgColor:r,fgColor:a,formatFlags:o,length:1,link:h};break}u+=v.length}this.mergeSpans()}setCharFast(t,e,s,a,r,h){if(t<0||t>=this.length)return;this._cachedTrimmedLength=void 0,this.ensureInitialized();const i=(s&S)!==0,o=s&~S,l=this.charData[t]&p,c=t+1<this.length?this.charData[t+1]&p:this.text.length,m=c-l;if(e.length===m)e!==this.text.slice(l,c)&&(this.text=this.text.slice(0,l)+e+this.text.slice(c)),this.charData[t]=l|(i?x:0);else{if(this.text=this.text.slice(0,l)+e+this.text.slice(c),m!==e.length){const u=e.length-m;for(let f=t+1;f<this.length;f++){const v=this.charData[f];this.charData[f]=(v&p)+u|v&x}}this.charData[t]=l|(i?x:0)}if(this.trySetStyleAtIndex(t,o,a,r,h))return;this.splitSpansAt(t),this.splitSpansAt(t+1);let b=0;for(let u=0;u<this.spans.length;u++){const f=this.spans[u];if(b===t&&f.length===1){this.spans[u]={bgColor:r,fgColor:a,formatFlags:o,length:1,link:h};break}b+=f.length}this.mergeSpans()}writeFrom(t,e,s=0,a){const r=a??e.length-s;if(r<=0||t>=this.length)return;this._cachedTrimmedLength=void 0,this.ensureInitialized();const h=Math.min(r,this.length-t,e.length-s),i=this.charData[t]&p,o=t+h<this.length?this.charData[t+h]&p:this.text.length;let l="";for(let g=0;g<h;g++)l+=e.getValue(s+g);const c=o-i,m=l.length-c;this.text=this.text.slice(0,i)+l+this.text.slice(o);let b=i;for(let g=0;g<h;g++){const D=e.getFullWidth(s+g);this.charData[t+g]=b|(D?x:0),b+=e.getValue(s+g).length}if(m!==0)for(let g=t+h;g<this.length;g++){const D=this.charData[g];this.charData[g]=(D&p)+m|D&x}this.splitSpansAt(t),this.splitSpansAt(t+h);const u=[];let f=0;for(const g of e.getSpans()){const D=f+g.length,P=Math.max(s,f),j=Math.min(s+h,D);if(P<j&&u.push({...g,length:j-P}),f=D,f>=s+h)break}let v=0,T=0;for(let g=0;g<this.spans.length;g++){if(T===t){v=g;break}T+=this.spans[g].length}let w=0,L=0;for(let g=v;g<this.spans.length&&L<h;g++)L+=this.spans[g].length,w++;this.spans.splice(v,w,...u),this.mergeSpans()}pushChar(t,e,s,a,r){this._cachedTrimmedLength=void 0,this.ensureInitialized();const h=(e&S)!==0,i=e&~S,o=this.text.length;this.text=(this.text??"")+t,this.charData.push(o|(h?x:0));const l=this.spans.at(-1);l?.formatFlags===i&&l.fgColor===s&&l.bgColor===a&&l.link===r?l.length++:this.spans.push({bgColor:a,fgColor:s,formatFlags:i,length:1,link:r}),this.length++}clone(){if(this.charData===void 0)return new d;const t=new d;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 d;const s=Math.max(0,t),a=e===void 0?this.length:Math.min(this.length,e);if(s>=a)return new d;if(s===0&&a===this.length)return this.clone();const r=new d;r.length=a-s,r.charData=Array.from({length:r.length});const h=this.charData[s]&p,i=a<this.length?this.charData[a]&p:this.text.length;r.text=this.text.slice(h,i);for(let c=0;c<r.length;c++){const m=this.charData[s+c],b=m&p,u=m&x;r.charData[c]=b-h|u}const o=[];let l=0;for(const c of this.spans){const m=l,b=l+c.length,u=Math.max(s,m),f=Math.min(a,b);if(u<f&&o.push({...c,length:f-u}),l+=c.length,l>=a)break}return r.spans=o,r.mergeSpans(),r}combine(...t){if(t.length===0)return this.clone();const e=[this,...t].filter(i=>i.length>0);if(e.length===0)return new d;if(e.length===1)return e[0].clone();let s=0;for(const i of e)s+=i.length;const a=new d;a.length=s,a.text=e.map(i=>i.getText()).join(""),a.charData=Array.from({length:s});let r=0,h=0;for(const i of e){const o=i.charData,l=i.getText();if(o)for(let c=0;c<i.length;c++){const m=o[c],b=m&p,u=m&x;a.charData[r+c]=h+b|u}else for(let c=0;c<i.length;c++)a.charData[r+c]=h+c;r+=i.length,h+=l.length}return a.spans=e.flatMap(i=>i.getSpans().map(o=>({...o}))),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&~S)!==0||s.fgColor!==void 0||s.bgColor!==void 0||s.link!==void 0)return this._cachedTrimmedLength=t+1,this._cachedTrimmedLength;for(let a=0;a<s.length;a++){const r=this.charData[t]&p;if((t+1<this.length?this.charData[t+1]&p:this.text.length)-r!==1||this.text[r]!==" ")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 d: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[h,i]of e.entries()){const o=i,l=s[h];if(o.length!==l.length||o.formatFlags!==l.formatFlags||o.fgColor!==l.fgColor||o.bgColor!==l.bgColor||o.link!==l.link)return!1}const a=this.charData,r=t.charData;if(a&&r){for(let h=0;h<this.length;h++)if(a[h]!==r[h])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 r=s[t],h=r?r.formatFlags:0,i=this.getFullWidth(a);yield{bgColor:r?.bgColor,fgColor:r?.fgColor,formatFlags:h|(i?S:0),fullWidth:i,hasStyles:(h&~S)!==0||r?.fgColor!==void 0||r?.bgColor!==void 0||r?.link!==void 0,link:r?.link,value:this.getValue(a)},r&&(e++,e>=r.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 h=0;h<s;h++)this.charData.push(a);this.length=t;const r=this.spans.at(-1);r?.formatFlags===0&&r.fgColor===void 0&&r.bgColor===void 0&&r.link===void 0?r.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 r=t-e,h=a.length-r;this.spans.splice(s,1,{...a,length:r},{...a,length:h});return}e+=a.length}}trySetStyleAtIndex(t,e,s,a,r){if(!this.spans)return!1;let h=0,i=-1,o;for(let l=0;l<this.spans.length;l++){const c=this.spans[l];if(h<=t&&h+c.length>t){i=l,o=c;break}h+=c.length}if(!o)return!1;if(o.formatFlags===e&&o.fgColor===s&&o.bgColor===a&&o.link===r)return!0;if(t===h&&i>0){const l=this.spans[i-1];if(l.formatFlags===e&&l.fgColor===s&&l.bgColor===a&&l.link===r)return l.length+=1,o.length===1?this.spans.splice(i,1):o.length-=1,!0}if(t===h+o.length-1&&i<this.spans.length-1){const l=this.spans[i+1];if(l.formatFlags===e&&l.fgColor===s&&l.bgColor===a&&l.link===r)return l.length+=1,o.length===1?this.spans.splice(i,1):o.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}}var mt=Object.defineProperty,$=k((n,t)=>mt(n,"name",{value:t,configurable:!0}),"u$1");const G={black:0,blue:4,cyan:6,gray:8,green:2,grey:8,magenta:5,red:1,white:7,yellow:3},U={blackBright:8,blueBright:12,cyanBright:14,greenBright:10,magentaBright:13,redBright:9,whiteBright:15,yellowBright:11},q=/^ansi256\(\s?(\d+)\s?\)$/,J=/^rgb\(\s?(\d+),\s?(\d+),\s?(\d+)\s?\)$/,Et=$(n=>{const t=G[n];if(t!==void 0)return t;const e=U[n];if(e!==void 0)return e;const s=q.exec(n);if(s)return Number(s[1])&255;if(n.startsWith("#")&&n.length===7){const r=Number.parseInt(n.slice(1,3),16),h=Number.parseInt(n.slice(3,5),16),i=Number.parseInt(n.slice(5,7),16);return 16+36*Math.round(r/51)+6*Math.round(h/51)+Math.round(i/51)}const a=J.exec(n);return a?16+36*Math.round(Number(a[1])/51)+6*Math.round(Number(a[2])/51)+Math.round(Number(a[3])/51):255},"colorToAnsi256"),pt=$((n,t)=>{const e=t?30:40,s=G[n];if(s!==void 0)return[e+s];const a=U[n];if(a!==void 0)return[e+60+(a-8)];if(n.startsWith("#")&&n.length===7){const i=Number.parseInt(n.slice(1,3),16),o=Number.parseInt(n.slice(3,5),16),l=Number.parseInt(n.slice(5,7),16);return[t?38:48,2,i,o,l]}const r=q.exec(n);if(r)return[t?38:48,5,Number(r[1])];const h=J.exec(n);return h?[t?38:48,2,Number(h[1]),Number(h[2]),Number(h[3])]:[]},"colorToSgrParams");$((n,t)=>{const e=pt(n,t);if(e.length!==0)return`\x1B[${e.join(";")}m`},"colorToAnsiCode");const A=$(n=>{const t=["black","red","green","yellow","blue","magenta","cyan","white"];return n>=0&&n<=7?t[n]:`ansi256(${n})`},"ansi256ToColorName");var bt=Object.defineProperty,y=k((n,t)=>bt(n,"name",{value:t,configurable:!0}),"u");const O=y(()=>({bgColor:void 0,fgColor:void 0,formatFlags:0,link:void 0}),"createSgrState"),vt=y((n,t)=>{if(t.length===0)return O();const e=(t.includes(":")?t.replaceAll(":",";"):t).split(";").filter(o=>o.length>0).map(Number);let{bgColor:s,fgColor:a,formatFlags:r,link:h}=n,i=0;for(;i<e.length;){const o=e[i];switch(o){case 0:{r=0,a=void 0,s=void 0,h=void 0;break}case 1:{r|=gt;break}case 2:{r|=ft;break}case 3:{r|=E;break}case 4:{r|=K;break}case 7:{r|=M;break}case 8:{r|=V;break}case 9:{r|=R;break}case 22:{r&=-4;break}case 23:{r&=~E;break}case 24:{r&=~K;break}case 27:{r&=~M;break}case 28:{r&=~V;break}case 29:{r&=~R;break}case 30:case 31:case 32:case 33:case 34:case 35:case 36:case 37:{a=A(o-30);break}case 38:{e[i+1]===5&&e[i+2]!==void 0?(a=A(e[i+2]),i+=2):e[i+1]===2&&i+4<e.length&&(a=`rgb(${e[i+2]}, ${e[i+3]}, ${e[i+4]})`,i+=4);break}case 39:{a=void 0;break}case 40:case 41:case 42:case 43:case 44:case 45:case 46:case 47:{s=A(o-40);break}case 48:{e[i+1]===5&&e[i+2]!==void 0?(s=A(e[i+2]),i+=2):e[i+1]===2&&i+4<e.length&&(s=`rgb(${e[i+2]}, ${e[i+3]}, ${e[i+4]})`,i+=4);break}case 49:{s=void 0;break}case 90:case 91:case 92:case 93:case 94:case 95:case 96:case 97:{a=`ansi256(${o-90+8})`;break}case 100:case 101:case 102:case 103:case 104:case 105:case 106:case 107:{s=`ansi256(${o-100+8})`;break}}i++}return{bgColor:s,fgColor:a,formatFlags:r,link:h}},"applySgrParams"),I=127462,z=127487,St=127995,xt=127999,Ct=8205,kt=917504,Dt=917631,yt=new RegExp("\\p{Mark}","u"),Tt=new Intl.Segmenter(void 0,{granularity:"grapheme"}),Ft=y((n,t)=>!!(lt(t)||n.includes("️")||t>=I&&t<=z),"isFullwidthGrapheme"),wt=/(?:\u001B\]|\u009D)8;([^;]*);(.*?)(?:\u001B\\|\u0007|\u009C)/,Lt=y(n=>{const t=wt.exec(n);return!t?.[2]||t[2].length===0?void 0:n.endsWith("\x1B\\")?`ST:${t[2]}`:t[2]},"parseOscHyperlink"),Q=y((n,t,e)=>{const s=Tt.segment(n),a=[];for(const{segment:r}of s)a.push(r);for(let r=0;r<a.length;r++){let h=a[r];if(h===" "){for(let l=0;l<4;l++)t.pushChar(" ",e.formatFlags,e.fgColor,e.bgColor,e.link);continue}if(h==="\b")continue;const i=h.codePointAt(0);if(!i)continue;if(i>=I&&i<=z&&r+1<a.length){const l=a[r+1],c=l.codePointAt(0);c&&c>=I&&c<=z&&(h+=l,r++)}else for(;r+1<a.length;){const l=a[r+1],c=l.codePointAt(0);if(!c)break;const m=yt.test(String.fromCodePoint(c)),b=c>=St&&c<=xt,u=c===Ct,f=c>=kt&&c<=Dt;if(!m&&!b&&!u&&!f)break;h+=l,r++,u&&r+1<a.length&&(h+=a[r+1],r++)}const o=Ft(h,i)?e.formatFlags|S:e.formatFlags;t.pushChar(h,o,e.fgColor,e.bgColor,e.link)}},"processTextToken"),At=y(n=>{if(n.length===0)return new d;const t=et(n),e=new d;let s=O();for(const a of t)switch(a.type){case"csi":{a.finalCharacter==="m"&&(s=vt(s,a.parameterString));break}case"osc":{const r=Lt(a.value);r!==void 0?s={...s,link:r}:a.value.includes("8;")&&(s={...s,link:void 0});break}case"text":{Q(a.value,e,s);break}}return e},"textToStyledLine"),Mt=/^[\u0020-\u007E]*$/,Kt=y(n=>{if(n.length===0)return new d;const t=new d;if(Mt.test(n)){for(const e of n)t.pushChar(e,0);return t}return Q(n,t,O()),t},"plainTextToStyledLine");var $t=Object.defineProperty,C=k((n,t)=>$t(n,"name",{value:t,configurable:!0}),"r");const N=new H(1e4,1e6),B=new Map,F=new H(1e4,1e6);let W=!0,_=tt;const Rt=C(n=>{W=n,n||F.clear()},"setEnableStyledLineCache"),Vt=C(()=>{F.clear()},"clearStyledLineCache"),Ht=C(n=>{_=n,It()},"setStringWidthFunction"),It=C(()=>{N.clear(),B.clear(),F.clear()},"clearStringWidthCache"),zt=C(n=>{if(n.length===1){const s=n.codePointAt(0);if(s!==void 0&&s>=32&&s<127)return 1}const t=B.get(n);if(t!==void 0)return t;let e;try{e=_(n)}catch{e=1}return B.set(n,e),e},"inkCharacterWidth"),Nt=C(n=>{try{return _(n)}catch{return 1}},"safeGetStringWidth"),Gt=C(n=>{if(n.length===0)return{height:0,width:0};const t=N.get(n);if(t)return t;const e=n.split(`
2
2
  `),s=Math.max(...e.map(r=>Nt(r))),a={height:e.length,width:s};return N.set(n,a),a},"measureText"),Ut=C(n=>{if(W){const e=F.get(n);if(e!==void 0)return e}const t=At(n);return W&&F.set(n,t),t},"toStyledLine"),Bt=C(n=>{let t=0;for(let e=0;e<n.length;e++)t+=zt(n.getValue(e));return t},"styledLineWidth"),Wt=C(n=>{if(n.length===0)return[new d];const t=[];let e=0;for(let s=0;s<n.length;s++)n.getValue(s)===`
3
- `&&(t.push(s>e?n.slice(e,s):new d),e=s+1);return t.push(e<n.length?n.slice(e):new d),t},"splitStyledLineByNewline"),qt=C(n=>{if(n.length===0)return{height:0,width:0};const t=Wt(n);let e=0;for(const s of t)e=Math.max(e,Bt(s));return{height:t.length,width:e}},"measureStyledLine");export{gt as B,ft as D,S as F,V as H,E as I,d as S,K as U,Vt as a,Ht as b,$t as c,Bt as d,Gt as e,M as f,R as g,pt as h,zt as i,Et as j,At as k,lt as l,qt as m,Wt as n,Kt as p,Rt as s,Ut as t};
3
+ `&&(t.push(s>e?n.slice(e,s):new d),e=s+1);return t.push(e<n.length?n.slice(e):new d),t},"splitStyledLineByNewline"),qt=C(n=>{if(n.length===0)return{height:0,width:0};const t=Wt(n);let e=0;for(const s of t)e=Math.max(e,Bt(s));return{height:t.length,width:e}},"measureStyledLine");export{gt as B,ft as D,S as F,V as H,E as I,d as S,K as U,Vt as a,Ht as b,It as c,Bt as d,Gt as e,M as f,R as g,pt as h,zt as i,Et as j,At as k,lt as l,qt as m,Wt as n,Kt as p,Rt as s,Ut as t};
@@ -1 +1 @@
1
- import"yoga-layout";import{c as r,a as g,b as i,P as s,g as c,d as n,e as d,f as u,h as b,i as m,j as B,k as S,l as h}from"./layout-P24eyWyL.js";import"./getScrollHeight-BTEY8ewu.js";import"./squashTextNodesWithMap-Cpqmc45i.js";export{r as calculateScrollbarLayout,g as calculateScrollbarThumb,i as collectSortedFragments,s as default,c as getAddedScrollHeight,n as getBoundingBox,d as getHorizontalScrollbarBoundingBox,u as getInnerHeight,b as getInnerWidth,m as getRelativeLeft,B as getRelativeTop,S as getText,h as getVerticalScrollbarBoundingBox};
1
+ import"yoga-layout";import{c as r,a as g,b as i,P as s,g as c,d as n,e as d,f as u,h as b,i as m,j as B,k as S,l as h}from"./layout-D5zRYQRE.js";import"./getScrollHeight-ClEOyLHH.js";import"./squashTextNodesWithMap-Cpqmc45i.js";export{r as calculateScrollbarLayout,g as calculateScrollbarThumb,i as collectSortedFragments,s as default,c as getAddedScrollHeight,n as getBoundingBox,d as getHorizontalScrollbarBoundingBox,u as getInnerHeight,b as getInnerWidth,m as getRelativeLeft,B as getRelativeTop,S as getText,h as getVerticalScrollbarBoundingBox};
@@ -0,0 +1 @@
1
+ import"yoga-layout";import{m as e,n as i,p as n}from"./layout-D5zRYQRE.js";export{e as getAbsoluteContentPosition,i as getAbsolutePosition,n as processLayout};
@@ -1 +1 @@
1
- var y=Object.defineProperty;var c=(e,t)=>y(e,"name",{value:t,configurable:!0});import{createContext as b}from"react";import T from"react-reconciler";import{NoEventPriority as C,DefaultEventPriority as I,DiscreteEventPriority as P}from"react-reconciler/constants.js";import{unstable_shouldYield as k,unstable_scheduleCallback as x,unstable_now as S,unstable_cancelCallback as E}from"scheduler";import{LayoutNode as f}from"./LayoutNode-Q7nU3hmO.js";import{applyStyles as h,resolveColor as g}from"./NAMED_COLORS-B9fJsYdg.js";import{a as N}from"./text-width-DSx26OmB.js";var A=Object.defineProperty,n=c((e,t)=>A(e,"name",{value:t,configurable:!0}),"o");let m=null;function _(e){m=e}c(_,"setOnAfterCommit");n(_,"setOnAfterCommit");let u=C;function p(e){const t=g(e.fg===void 0?e.color===void 0?void 0:e.color:e.fg),o=g(e.bg===void 0?e.backgroundColor===void 0?void 0:e.backgroundColor:e.bg);let r;return e.styles===void 0?(r=0,e.bold&&(r|=1),(e.dim||e.dimColor)&&(r|=2),e.italic&&(r|=4),e.underline&&(r|=8),e.blink&&(r|=16),e.inverse&&(r|=32),e.hidden&&(r|=64),e.strikethrough&&(r|=128)):r=e.styles,{bg:o,fg:t,styles:r}}c(p,"m");n(p,"resolveNodeColors");const U={afterActiveInstanceBlur: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:n(()=>{},"beforeActiveInstanceBlur"),cancelCallback:E,cancelTimeout:clearTimeout,clearContainer(e){},commitTextUpdate(e,t,o){e.text=o,e.yogaNode.markDirty()},commitUpdate(e,t,o,r,a){h(e.yogaNode,r);const{bg:i,fg:s,styles:d}=p(r);e.fg=s,e.bg=i,e.styles=d,e._style=r,e.transform=typeof r.transform=="function"?r.transform:void 0},createInstance(e,t,o,r,a){const i=new f,s={...t};s.flexDirection===void 0&&(s.flexDirection="row"),s.flexShrink===void 0&&(s.flexShrink=1),h(i.yogaNode,s);const{bg:d,fg:l,styles:v}=p(t);return i.fg=l,i.bg=d,i.styles=v,i._style=t,typeof t.transform=="function"&&(i.transform=t.transform),i},createTextInstance(e,t,o,r){const a=new f;return a.text=e,a.yogaNode.setWidth(N(e)),a.yogaNode.setHeight(1),a},detachDeletedInstance:n(e=>{e.destroy()},"detachDeletedInstance"),finalizeInitialChildren(e,t,o,r,a){return!1},getChildHostContext(e,t,o){return{isInsideText:t==="text"}},getCurrentEventPriority:n(()=>P,"getCurrentEventPriority"),getCurrentUpdatePriority:n(()=>u,"getCurrentUpdatePriority"),getInstanceFromNode:n(()=>null,"getInstanceFromNode"),getPublicInstance(e){return e},getRootHostContext(e){return{isInsideText:!1}},hideInstance(e){e._hidden=!0},hideTextInstance(e){e._hidden=!0},HostTransitionContext:b(null),insertBefore(e,t,o){t.parent&&t.remove();const r=e.children.indexOf(o);e.insertChild(t,r)},isPrimaryRenderer:!0,maySuspendCommit:n(()=>!0,"maySuspendCommit"),noTimeout:-1,NotPendingTransition:void 0,now:S,preloadInstance:n(()=>!0,"preloadInstance"),prepareForCommit(e){return null},preparePortalMount:n(()=>{},"preparePortalMount"),prepareScopeUpdate:n(()=>{},"prepareScopeUpdate"),prepareUpdate(e,t,o,r,a,i){const s=Object.keys(o).filter(l=>l!=="children"),d=Object.keys(r).filter(l=>l!=="children");if(s.length!==d.length)return!0;for(const l of d)if(o[l]!==r[l])return!0;return null},removeChild(e,t){t.remove()},removeChildFromContainer(e,t){t.remove()},requestPostPaintCallback:n(()=>{},"requestPostPaintCallback"),resetAfterCommit(e){typeof m=="function"&&m()},resolveEventTimeStamp:n(()=>-1.1,"resolveEventTimeStamp"),resolveEventType:n(()=>null,"resolveEventType"),resolveUpdatePriority(){return u!==C?u:I},scheduleCallback:x,scheduleMicrotask:queueMicrotask,scheduleTimeout:setTimeout,setCurrentUpdatePriority(e){u=e},shouldAttemptEagerTransition:n(()=>!1,"shouldAttemptEagerTransition"),shouldSetTextContent(e,t){return!1},shouldYield:k,startSuspendingCommit:n(()=>{},"startSuspendingCommit"),supportsHydration:!1,supportsMicrotasks:!0,supportsMutation:!0,supportsPersistence:!1,suspendInstance:n(()=>{},"suspendInstance"),trackSchedulerEvent:n(()=>{},"trackSchedulerEvent"),unhideInstance(e,t){e._hidden=!1},unhideTextInstance(e,t){e._hidden=!1},waitForCommitToBeReady:n(()=>null,"waitForCommitToBeReady"),warnsIfNotActing:!0},j=T(U);export{j as T,_ as s};
1
+ var y=Object.defineProperty;var c=(e,t)=>y(e,"name",{value:t,configurable:!0});import{createContext as b}from"react";import T from"react-reconciler";import{NoEventPriority as C,DefaultEventPriority as I,DiscreteEventPriority as P}from"react-reconciler/constants.js";import{unstable_shouldYield as k,unstable_scheduleCallback as x,unstable_now as S,unstable_cancelCallback as E}from"scheduler";import{LayoutNode as f}from"./LayoutNode-B0qeT8sl.js";import{applyStyles as h,resolveColor as g}from"./NAMED_COLORS-B9fJsYdg.js";import{a as N}from"./text-width-CI9G0a-z.js";var A=Object.defineProperty,n=c((e,t)=>A(e,"name",{value:t,configurable:!0}),"o");let m=null;function _(e){m=e}c(_,"setOnAfterCommit");n(_,"setOnAfterCommit");let u=C;function p(e){const t=g(e.fg===void 0?e.color===void 0?void 0:e.color:e.fg),o=g(e.bg===void 0?e.backgroundColor===void 0?void 0:e.backgroundColor:e.bg);let r;return e.styles===void 0?(r=0,e.bold&&(r|=1),(e.dim||e.dimColor)&&(r|=2),e.italic&&(r|=4),e.underline&&(r|=8),e.blink&&(r|=16),e.inverse&&(r|=32),e.hidden&&(r|=64),e.strikethrough&&(r|=128)):r=e.styles,{bg:o,fg:t,styles:r}}c(p,"m");n(p,"resolveNodeColors");const U={afterActiveInstanceBlur: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:n(()=>{},"beforeActiveInstanceBlur"),cancelCallback:E,cancelTimeout:clearTimeout,clearContainer(e){},commitTextUpdate(e,t,o){e.text=o,e.yogaNode.markDirty()},commitUpdate(e,t,o,r,a){h(e.yogaNode,r);const{bg:i,fg:s,styles:d}=p(r);e.fg=s,e.bg=i,e.styles=d,e._style=r,e.transform=typeof r.transform=="function"?r.transform:void 0},createInstance(e,t,o,r,a){const i=new f,s={...t};s.flexDirection===void 0&&(s.flexDirection="row"),s.flexShrink===void 0&&(s.flexShrink=1),h(i.yogaNode,s);const{bg:d,fg:l,styles:v}=p(t);return i.fg=l,i.bg=d,i.styles=v,i._style=t,typeof t.transform=="function"&&(i.transform=t.transform),i},createTextInstance(e,t,o,r){const a=new f;return a.text=e,a.yogaNode.setWidth(N(e)),a.yogaNode.setHeight(1),a},detachDeletedInstance:n(e=>{e.destroy()},"detachDeletedInstance"),finalizeInitialChildren(e,t,o,r,a){return!1},getChildHostContext(e,t,o){return{isInsideText:t==="text"}},getCurrentEventPriority:n(()=>P,"getCurrentEventPriority"),getCurrentUpdatePriority:n(()=>u,"getCurrentUpdatePriority"),getInstanceFromNode:n(()=>null,"getInstanceFromNode"),getPublicInstance(e){return e},getRootHostContext(e){return{isInsideText:!1}},hideInstance(e){e._hidden=!0},hideTextInstance(e){e._hidden=!0},HostTransitionContext:b(null),insertBefore(e,t,o){t.parent&&t.remove();const r=e.children.indexOf(o);e.insertChild(t,r)},isPrimaryRenderer:!0,maySuspendCommit:n(()=>!0,"maySuspendCommit"),noTimeout:-1,NotPendingTransition:void 0,now:S,preloadInstance:n(()=>!0,"preloadInstance"),prepareForCommit(e){return null},preparePortalMount:n(()=>{},"preparePortalMount"),prepareScopeUpdate:n(()=>{},"prepareScopeUpdate"),prepareUpdate(e,t,o,r,a,i){const s=Object.keys(o).filter(l=>l!=="children"),d=Object.keys(r).filter(l=>l!=="children");if(s.length!==d.length)return!0;for(const l of d)if(o[l]!==r[l])return!0;return null},removeChild(e,t){t.remove()},removeChildFromContainer(e,t){t.remove()},requestPostPaintCallback:n(()=>{},"requestPostPaintCallback"),resetAfterCommit(e){typeof m=="function"&&m()},resolveEventTimeStamp:n(()=>-1.1,"resolveEventTimeStamp"),resolveEventType:n(()=>null,"resolveEventType"),resolveUpdatePriority(){return u!==C?u:I},scheduleCallback:x,scheduleMicrotask:queueMicrotask,scheduleTimeout:setTimeout,setCurrentUpdatePriority(e){u=e},shouldAttemptEagerTransition:n(()=>!1,"shouldAttemptEagerTransition"),shouldSetTextContent(e,t){return!1},shouldYield:k,startSuspendingCommit:n(()=>{},"startSuspendingCommit"),supportsHydration:!1,supportsMicrotasks:!0,supportsMutation:!0,supportsPersistence:!1,suspendInstance:n(()=>{},"suspendInstance"),trackSchedulerEvent:n(()=>{},"trackSchedulerEvent"),unhideInstance(e,t){e._hidden=!1},unhideTextInstance(e,t){e._hidden=!1},waitForCommitToBeReady:n(()=>null,"waitForCommitToBeReady"),warnsIfNotActing:!0},j=T(U);export{j as T,_ as s};