blecsd 0.4.0 → 0.6.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +169 -147
- package/dist/blend-BZDmQFAm.d.ts +1215 -0
- package/dist/{border-DGNDfT6T.d.ts → border-Br-Jc027.d.ts} +2 -2
- package/dist/{cell-DwIu2ryP.d.ts → cell-5Ty_3yMs.d.ts} +1 -1
- package/dist/cellRenderer-D0-DJXWl.d.ts +374 -0
- package/dist/chunk-3PGACJB6.js +1 -0
- package/dist/{chunk-DNRXW56C.js → chunk-4EV3YS7F.js} +1 -1
- package/dist/chunk-4XW4WIPH.js +1 -0
- package/dist/chunk-7CLV3LTZ.js +4 -0
- package/dist/chunk-7ZFQO3OQ.js +1 -0
- package/dist/chunk-AM6IDSXI.js +1 -0
- package/dist/chunk-APPZ3YHO.js +0 -0
- package/dist/chunk-EHYOVHRL.js +2 -0
- package/dist/chunk-EKE2BXPS.js +1 -0
- package/dist/chunk-EOFT3PNU.js +1 -0
- package/dist/chunk-ESMSDY3P.js +1 -0
- package/dist/chunk-FJLSHFCF.js +1 -0
- package/dist/chunk-FUW7OD3H.js +1 -0
- package/dist/chunk-GIMWA5WA.js +1 -0
- package/dist/chunk-GRMSEMU7.js +1 -0
- package/dist/chunk-I7AUKTXE.js +1 -0
- package/dist/chunk-IXUFU6TE.js +3 -0
- package/dist/chunk-JB5KFQPD.js +1 -0
- package/dist/chunk-JCLNGU3K.js +1 -0
- package/dist/chunk-JN2OGNK3.js +1 -0
- package/dist/chunk-JRRJCATR.js +1 -0
- package/dist/chunk-JWIVZCKW.js +1 -0
- package/dist/chunk-K5UMVDQX.js +1 -0
- package/dist/chunk-KYNS3GBJ.js +2 -0
- package/dist/chunk-L4FIDOS6.js +1 -0
- package/dist/chunk-LIVVHEOU.js +1 -0
- package/dist/chunk-LNEISTXM.js +1 -0
- package/dist/chunk-M5FXA5FL.js +1 -0
- package/dist/chunk-MEJJLDEQ.js +1 -0
- package/dist/chunk-NYIMY4UV.js +1 -0
- package/dist/chunk-PQZTNWLA.js +1 -0
- package/dist/chunk-QS5QXZNJ.js +1 -0
- package/dist/chunk-SXOBHRXF.js +2 -0
- package/dist/chunk-T2EQLWMN.js +1 -0
- package/dist/chunk-T62UPG63.js +4 -0
- package/dist/chunk-TPBILYDM.js +10 -0
- package/dist/chunk-UWS6FIU5.js +1 -0
- package/dist/chunk-W64J7C25.js +4 -0
- package/dist/chunk-W6RELN6A.js +1 -0
- package/dist/chunk-XYMPBCYW.js +1 -0
- package/dist/chunk-ZAJI53SZ.js +1 -0
- package/dist/cli/init.js +1 -1
- package/dist/{componentStorage-CJTh-TPO.d.ts → componentStorage-CXJvx4Lt.d.ts} +2 -2
- package/dist/components/index.d.ts +7762 -7682
- package/dist/components/index.js +5 -1
- package/dist/core/index.d.ts +4851 -4261
- package/dist/core/index.js +1 -1
- package/dist/debug/index.d.ts +310 -84
- package/dist/debug/index.js +8 -1
- package/dist/{dirtyTracking-C4v8MmM9.d.ts → dirtyTracking-D0SQrEeo.d.ts} +2 -2
- package/dist/{doubleBuffer-CKQFmlPN.d.ts → doubleBuffer-d9yVNtj1.d.ts} +22 -2
- package/dist/errors/index.js +1 -1
- package/dist/{events-9ForpTfM.d.ts → events-CGqK6LGt.d.ts} +2 -2
- package/dist/{inputActions-Fyw14_Gm.d.ts → factories-vW7bn_He.d.ts} +21 -786
- package/dist/{gameLoop-CSTb7e0L.d.ts → gameLoop-C1AyRWyP.d.ts} +3 -3
- package/dist/index.d.ts +25 -1217
- package/dist/index.js +1 -3
- package/dist/input/index.d.ts +1 -1
- package/dist/input/index.js +1 -1
- package/dist/inputStream-BoFAEJ7g.d.ts +1385 -0
- package/dist/interactiveSystem-Dtv3xERg.d.ts +2292 -0
- package/dist/{keyParser-m7fWto6g.d.ts → keyParser-DReXe2j-.d.ts} +28 -28
- package/dist/{mouseParser-B7p5ow7K.d.ts → mouseParser-CTNGolIA.d.ts} +1 -1
- package/dist/{packedStore-BgvnEdE7.d.ts → packedStore-480t2X74.d.ts} +1 -1
- package/dist/panelMovement-DSLYdNOL.d.ts +1909 -0
- package/dist/{parser-iMHmQuUh.d.ts → parser-Q1YLXYpF.d.ts} +1 -1
- package/dist/positioning-DiUivJXa.d.ts +917 -0
- package/dist/{renderable-CwqGwrEV.d.ts → renderable-IbSJao5y.d.ts} +2 -2
- package/dist/{scheduler-DeeZleia.d.ts → scheduler-NbHT3-D2.d.ts} +1 -1
- package/dist/schemas/index.d.ts +6 -6
- package/dist/schemas/index.js +1 -1
- package/dist/style/index.d.ts +851 -0
- package/dist/style/index.js +1 -0
- package/dist/styleInheritance-CuRb5Dmp.d.ts +251 -0
- package/dist/systems/index.d.ts +786 -1882
- package/dist/systems/index.js +1 -1
- package/dist/terminal/index.d.ts +5542 -2460
- package/dist/terminal/index.js +1 -1
- package/dist/terminalBuffer-BbUz27qM.d.ts +691 -0
- package/dist/{terminus-14-bold-HWSPRLJD.js → terminus-14-bold-ZS4IH465.js} +1 -1
- package/dist/{terminus-14-normal-T3SWMH4D.js → terminus-14-normal-HD5N7F5W.js} +1 -1
- package/dist/testing/index.d.ts +923 -0
- package/dist/testing/index.js +7 -0
- package/dist/text/index.d.ts +263 -0
- package/dist/text/index.js +3 -0
- package/dist/textWrap-sY-PZzE7.d.ts +761 -0
- package/dist/{tilemap-BirMJdbu.d.ts → tilemap-ByvTsepD.d.ts} +5 -5
- package/dist/{types-CPB4CpbH.d.ts → types-B8LmNkzG.d.ts} +1 -1
- package/dist/utils/index.d.ts +829 -782
- package/dist/utils/index.js +32 -1
- package/dist/{virtualScrollback-D9uLFe8l.d.ts → virtualScrollback-CiooIebp.d.ts} +4 -4
- package/dist/virtualViewport-fIlbIGPt.d.ts +657 -0
- package/dist/{virtualizedLineStore-DwPEvPkk.d.ts → virtualizedLineStore-DfyhojPZ.d.ts} +1 -1
- package/dist/widgets/bigText.d.ts +13 -13
- package/dist/widgets/bigText.js +1 -1
- package/dist/widgets/fonts/index.d.ts +1 -1
- package/dist/widgets/fonts/index.js +1 -1
- package/dist/widgets/index.d.ts +1620 -910
- package/dist/widgets/index.js +24 -1
- package/package.json +23 -22
- package/dist/3d/index.d.ts +0 -5
- package/dist/3d/index.js +0 -1
- package/dist/audio/index.d.ts +0 -177
- package/dist/audio/index.js +0 -1
- package/dist/chunk-25OEBENM.js +0 -3
- package/dist/chunk-26STV7ZS.js +0 -1
- package/dist/chunk-2NMGUEFC.js +0 -4
- package/dist/chunk-35LCBY6P.js +0 -1
- package/dist/chunk-4PRDJTCM.js +0 -1
- package/dist/chunk-5PELJRUQ.js +0 -1
- package/dist/chunk-5VEKHA3B.js +0 -5
- package/dist/chunk-6KEM3OS2.js +0 -11
- package/dist/chunk-6XWY6GB7.js +0 -1
- package/dist/chunk-735KKTP3.js +0 -1
- package/dist/chunk-7SWJNDOL.js +0 -26
- package/dist/chunk-APKUNIMB.js +0 -1
- package/dist/chunk-CJCSZRV6.js +0 -1
- package/dist/chunk-DMBMCCLN.js +0 -1
- package/dist/chunk-DQTVJITR.js +0 -1
- package/dist/chunk-DSKQ5J4R.js +0 -1
- package/dist/chunk-E4CJRSND.js +0 -1
- package/dist/chunk-EF4DC6IN.js +0 -1
- package/dist/chunk-EJAKECSN.js +0 -1
- package/dist/chunk-FNQRUMFD.js +0 -1
- package/dist/chunk-GJ3RS2VG.js +0 -1
- package/dist/chunk-KTVEMB2I.js +0 -1
- package/dist/chunk-KYAPE44E.js +0 -8
- package/dist/chunk-LI4Y7TBZ.js +0 -1
- package/dist/chunk-NHOL4BN6.js +0 -1
- package/dist/chunk-NPNUUSIB.js +0 -1
- package/dist/chunk-NZ55KBM6.js +0 -1
- package/dist/chunk-OFRWGW2G.js +0 -1
- package/dist/chunk-OMMJ7B5P.js +0 -1
- package/dist/chunk-OMU5BSAS.js +0 -2
- package/dist/chunk-P3ZLIQJP.js +0 -1
- package/dist/chunk-PWI36BQJ.js +0 -1
- package/dist/chunk-QQMUDJ32.js +0 -2
- package/dist/chunk-R3ICZOE4.js +0 -1
- package/dist/chunk-RZ7FGVI6.js +0 -1
- package/dist/chunk-S6WS46FE.js +0 -1
- package/dist/chunk-TSARUU56.js +0 -1
- package/dist/chunk-WJRVUAZR.js +0 -33
- package/dist/chunk-WY5EZOOL.js +0 -1
- package/dist/chunk-YY6RZCZH.js +0 -4
- package/dist/chunk-ZPGJCHXH.js +0 -1
- package/dist/chunk-ZPL2J25N.js +0 -1
- package/dist/game/index.d.ts +0 -486
- package/dist/game/index.js +0 -1
- package/dist/index-DBS5Uefn.d.ts +0 -3156
- package/dist/viewport3d-xI33-_wq.d.ts +0 -182
- package/dist/virtualViewport-DTSN6jFk.d.ts +0 -1856
package/dist/widgets/index.js
CHANGED
|
@@ -1 +1,24 @@
|
|
|
1
|
-
export{x as Accordion,k as AccordionConfigSchema,y as Autocomplete,z as AutocompleteConfigSchema,D as BRAILLE_BASE,E as BRAILLE_DOTS,U as BarChart,T as BarChartConfigSchema,th as BorderConfigSchema,e as Box,d as BoxConfigSchema,Z as ButtonWidgetComponent,Y as ButtonWidgetConfigSchema,M as CHART_COLORS,he as CLOSE_BUTTON_CHAR,ie as COLLAPSE_CHAR,fa as Calendar,ba as CalendarConfigSchema,na as Canvas,oa as CanvasConfigSchema,Aa as CheckboxWidgetComponent,za as CheckboxWidgetConfigSchema,l as CollapsibleConfigSchema,Ha as CommandPalette,Ia as CommandPaletteConfigSchema,ic as DEFAULT_CURSOR_OFFSET_X,jc as DEFAULT_CURSOR_OFFSET_Y,hc as DEFAULT_HIDE_DELAY,Lc as DEFAULT_HORIZONTAL_CHAR,gc as DEFAULT_HOVER_DELAY,Nc as DEFAULT_LINE_LENGTH,hd as DEFAULT_LOADING_BG,gd as DEFAULT_LOADING_FG,Bd as DEFAULT_MESSAGE_PADDING,Cd as DEFAULT_MESSAGE_STYLES,Ad as DEFAULT_MESSAGE_TIMEOUT,ge as DEFAULT_PANEL_TITLE,Ae as DEFAULT_PROMPT_BG,ze as DEFAULT_PROMPT_FG,Ce as DEFAULT_PROMPT_HEIGHT,Be as DEFAULT_PROMPT_WIDTH,Oe as DEFAULT_QUESTION_BG,Ne as DEFAULT_QUESTION_FG,Qe as DEFAULT_QUESTION_HEIGHT,Pe as DEFAULT_QUESTION_WIDTH,hb as DEFAULT_TAB_POSITION,Ug as DEFAULT_TOAST_PADDING,Wg as DEFAULT_TOAST_STYLES,Tg as DEFAULT_TOAST_TIMEOUT,lc as DEFAULT_TOOLTIP_BG,mc as DEFAULT_TOOLTIP_BORDER,kc as DEFAULT_TOOLTIP_FG,Mc as DEFAULT_VERTICAL_CHAR,tb as DevTools,ub as DevToolsConfigSchema,je as EXPAND_CHAR,zb as FileManager,yb as FileManagerConfigSchema,Gb as FlexContainer,Hb as FlexContainerConfigSchema,Mb as Footer,Nb as FooterConfigSchema,Qb as FormComponent,Pb as FormWidgetConfigSchema,Vb as Gauge,Ub as GaugeConfigSchema,Zb as Grid,_b as GridConfigSchema,R as HORIZONTAL_BLOCKS,dc as Header,ec as HeaderConfigSchema,wc as Image,vc as ImageConfigSchema,Dc as Layout,Cc as LayoutConfigSchema,Pc as Line,Xc as LineChart,Wc as LineChartConfigSchema,Oc as LineConfigSchema,dd as ListTableWidgetConfigSchema,Ea as ListWidgetConfigSchema,$c as ListbarWidgetConfigSchema,jd as LoadingConfigSchema,id as LoadingStyleConfigSchema,sd as Log,rd as LogConfigSchema,gh as MPLAYER_SEARCH_PATHS,fh as MPV_SEARCH_PATHS,Dd as Message,zd as MessageConfigSchema,Qd as Modal,Pd as ModalConfigSchema,ae as MultiSelect,$d as MultiSelectConfigSchema,le as Panel,ke as PanelConfigSchema,ve as ProgressBarComponent,ue as ProgressBarWidgetConfigSchema,Ge as Prompt,De as PromptBorderConfigSchema,Fe as PromptConfigSchema,Ee as PromptPaddingConfigSchema,yg as PtyOptionsSchema,Se as Question,Re as QuestionConfigSchema,bf as RadioButtonWidgetComponent,$e as RadioButtonWidgetConfigSchema,af as RadioGroupWidgetComponent,_e as RadioGroupWidgetConfigSchema,if as ScrollableBox,hf as ScrollableBoxConfigSchema,Nf as SearchOverlay,Mf as SearchOverlayConfigSchema,Gf as SearchableList,Ff as SearchableListConfigSchema,Vf as Sparkline,Uf as SparklineConfigSchema,_f as SplitPane,Zf as SplitPaneConfigSchema,Kg as StopwatchComponent,Ig as StopwatchConfigSchema,hg as StreamingTextConfigSchema,sg as Switch,rg as SwitchConfigSchema,jb as TAB_CLOSE_CHAR,ib as TAB_SEPARATOR,Vg as TOAST_STACK_SPACING,pf as TableWidgetConfigSchema,lb as Tabs,kb as TabsConfigSchema,Ag as Terminal,zg as TerminalConfigSchema,ha as Text,ga as TextConfigSchema,Jg as TimerComponent,Hg as TimerConfigSchema,Xg as Toast,Sg as ToastConfigSchema,sf as TreeWidgetConfigSchema,S as VERTICAL_BLOCKS,eh as Video,dh as VideoConfigSchema,wf as Viewport3DTag,uh as VirtualizedListConfigSchema,sh as VirtualizedListStyleSchema,Jb as addFlexChild,ac as addToGrid,lg as appendToState,Ve as ask,Pf as attachSearchOverlay,F as brailleChar,jh as buildMplayerArgs,ih as buildMpvArgs,kh as buildPlayerArgs,Gc as calculateFlexLayout,Fc as calculateGridLayout,Ec as calculateInlineLayout,H as calculateTickInterval,sc as clearAllHoverText,ua as clearCanvas,pc as clearHoverText,Ya as clearLines,mg as clearState,Ud as closeAllModals,Td as closeModal,r as collapseAllSections,G as combineBrailleDots,We as confirm,n as createAccordion,A as createAutocomplete,V as createBarChart,f as createBox,_ as createButton,da as createCalendar,wa as createCanvas,Ba as createCheckbox,t as createCollapsible,Ka as createCommandPalette,eb as createContextMenu,vb as createDevTools,Bb as createFileManager,Ib as createFlexContainer,Ob as createFooter,Rb as createForm,Wb as createGauge,$b as createGrid,fc as createHeader,nc as createHoverTextManager,xc as createImage,Hc as createLayout,Qc as createLine,Yc as createLineChart,Fa as createList,ed as createListTable,bd as createListbar,kd as createLoading,td as createLog,Ed as createMessage,Rd as createModal,be as createMultiSelect,me as createPanel,we as createProgressBar,Ie as createPrompt,Ue as createQuestion,df as createRadioButton,cf as createRadioGroup,jf as createScrollableBox,of as createScrollableText,Of as createSearchOverlay,Hf as createSearchableList,cg as createSharedTextBuffer,Wf as createSparkline,$f as createSplitPane,Mg as createStopwatch,kg as createStreamingState,qg as createStreamingText,tg as createSwitch,qf as createTable,mb as createTabs,Bg as createTerminal,ia as createText,Lg as createTimer,Yg as createToast,uf as createTree,nh as createVideo,xf as createViewport3D,vh as createVirtualizedList,zf as createWidgetRegistry,Bf as defaultRegistry,Xa as deleteBottom,Va as deleteLine,Wa as deleteTop,hh as detectVideoPlayer,sa as drawCircle,qa as drawLine,ra as drawRect,ta as drawText,q as expandAllSections,p as expandSection,Ab as fileManagerStateMap,K as formatNumber,L as formatPercentage,I as generateTicks,ob as getActiveTabIndex,Qa as getBaseLine,h as getBoxContent,va as getCanvasContent,N as getChartColor,gb as getContextMenuSelectedIndex,fg as getDividerRenderInfo,s as getExpandedSections,qc as getHoverText,tc as getHoverTextCount,zc as getImageBitmap,Ac as getImageCellMap,Jc as getLayoutMode,Oa as getLine,Sc as getLineChar,Na as getLineCount,Uc as getLineOrientation,Ma as getLines,Wd as getModalStack,oe as getPanelTitle,re as getPanelTitleAlign,xd as getScrollback,Sf as getSearchOverlayColors,Rf as getSearchOverlayTarget,If as getSearchableFilteredItems,ce as getSelectedItems,dg as getSharedTextBuffer,bg as getSplitDirection,ng as getStreamVisibleLines,pb as getTabCount,qb as getTabPosition,ka as getTextContent,ph as getVideoPlaybackState,qh as getVideoPlayer,Cf as getWidgetTypes,Ef as getWidgetsByTag,fb as handleContextMenuKey,Cb as handleFileManagerKey,Md as handleMessageClick,Nd as handleMessageKey,Zd as handleModalBackdropClick,_d as handleModalEscape,Me as handlePromptKey,Ye as handleQuestionKey,wg as handleSwitchClick,vg as handleSwitchKey,Cg as handleTerminalKey,wh as handleVirtualizedListKey,xh as handleVirtualizedListWheel,rc as hasHoverText,md as hideLoading,eg as hitTestDivider,Ua as insertBottom,Sa as insertLine,Ta as insertTop,O as interpolateChartColor,v as isAccordion,B as isAutocomplete,W as isBarChart,i as isBox,$ as isButtonWidget,ea as isCalendar,xa as isCanvas,Ca as isCheckboxWidget,w as isCollapsible,La as isCommandPalette,wb as isDevTools,Kd as isDismissOnClick,Ld as isDismissOnKey,Db as isFileManager,Kb as isFlexContainer,Sb as isFormWidget,Xb as isGauge,bc as isGrid,yc as isImage,mf as isKeysScrollEnabled,Ic as isLayout,Rc as isLine,Zc as isLineChart,fd as isListTableWidget,Ga as isListWidget,cd as isListbarWidget,od as isLoadingWidget,ud as isLog,wd as isLogKeysScrollEnabled,vd as isLogMouseScrollEnabled,Jd as isMessage,Xd as isModal,Vd as isModalOpen,lf as isMouseScrollEnabled,ee as isMultiSelect,ne as isPanel,qe as isPanelCollapsed,xe as isProgressBarWidget,Ke as isPrompt,Xe as isQuestion,ff as isRadioButtonWidget,ef as isRadioGroupWidget,kf as isScrollableBox,kf as isScrollableText,Qf as isSearchOverlay,Kf as isSearchableList,Xf as isSparkline,ag as isSplitPane,Pg as isStopwatch,ug as isSwitch,rf as isTableWidget,nb as isTabs,Dg as isTerminal,Fg as isTerminalKeysEnabled,Eg as isTerminalMouseEnabled,la as isText,Og as isTimer,bh as isToast,vf as isTreeWidget,oh as isVideo,yf as isViewport3DWidget,yh as isVirtualizedList,Df as isWidgetType,de as onSelectionChange,Sd as openModal,$a as popLine,Je as prompt,He as promptStateMap,_a as pushLine,Te as questionStateMap,Af as registerBuiltinWidgets,se as renderPanelTitleBar,rb as renderTabBar,P as renderXAxisLabel,Q as renderYAxisLabel,cb as replaceLines,m as resetAccordionStore,C as resetAutocompleteStore,X as resetBarChartStore,j as resetBoxStore,aa as resetButtonWidgetStore,ca as resetCalendarStore,ya as resetCanvasStore,Da as resetCheckboxWidgetStore,Ja as resetCommandPaletteStore,xb as resetDevToolsStore,Eb as resetFileManagerStore,Lb as resetFlexContainerStore,Tb as resetFormWidgetStore,Yb as resetGaugeStore,cc as resetGridStore,uc as resetHoverTextStore,Bc as resetImageStore,Kc as resetLayoutStore,_c as resetLineChartStore,Vc as resetLineStore,ad as resetListbarStore,qd as resetLoadingStore,yd as resetLogStore,Od as resetMessageStore,Yd as resetModalStore,fe as resetMultiSelectStore,te as resetPanelStore,ye as resetProgressBarWidgetStore,Le as resetPromptStore,Ze as resetQuestionStore,gf as resetRadioWidgetStore,nf as resetScrollableBoxStore,Tf as resetSearchOverlayStore,Lf as resetSearchableListStore,Yf as resetSparklineStore,gg as resetSplitPaneStore,Rg as resetStopwatchWidgetStore,xg as resetSwitchStore,sb as resetTabsStore,Gg as resetTerminalStore,ma as resetTextStore,Qg as resetTimerWidgetStore,ch as resetToastStore,tf as resetTreeStore,rh as resetVideoStore,J as scaleValue,pg as scrollByLines,og as scrollToLine,lh as sendPauseCommand,mh as sendSeekCommand,Ra as setBaseLine,g as setBoxContent,oc as setHoverText,Pa as setLine,Tc as setLineChar,Za as setLines,nd as setLoadingMessage,pe as setPanelTitle,pa as setPixel,Fb as setReadDirFn,Jf as setSearchableFilter,ja as setTextContent,ab as shiftLine,Hd as showError,ah as showErrorToast,Fd as showInfo,Zg as showInfoToast,ld as showLoading,Id as showSuccess,_g as showSuccessToast,Gd as showWarning,$g as showWarningToast,db as spliceLines,jg as stripAnsiSequences,u as toggleCollapsible,o as toggleSection,bb as unshiftLine,pd as updateLoadingAnimation,Ng as updateTimeWidgets,ig as wrapLine}from'../chunk-7SWJNDOL.js';import'../chunk-26STV7ZS.js';import'../chunk-4LWWONFK.js';import'../chunk-FNQRUMFD.js';import'../chunk-6PX5R326.js';export{b as BigText,a as BigTextConfigSchema,e as createBigText,g as isBigText,h as resetBigTextStore,f as setText}from'../chunk-25OEBENM.js';export{b as BitmapFontSchema,a as CharBitmapSchema,c as createFontNotFoundError,f as getCharBitmap,d as loadFont,g as renderChar}from'../chunk-DNRXW56C.js';import'../chunk-4PRDJTCM.js';import'../chunk-2NMGUEFC.js';import'../chunk-TSARUU56.js';import'../chunk-AEJIX2MW.js';import'../chunk-C5PCEQ6G.js';import'../chunk-JHCKPCUH.js';import'../chunk-VOCM5T2G.js';import'../chunk-RJULLVTH.js';import'../chunk-5N3O25O7.js';import'../chunk-DSKQ5J4R.js';import'../chunk-LI4Y7TBZ.js';import'../chunk-6XWY6GB7.js';import'../chunk-DQTVJITR.js';import'../chunk-ZPGJCHXH.js';import'../chunk-735KKTP3.js';import'../chunk-APKUNIMB.js';import'../chunk-NPDPBAW6.js';import'../chunk-GJ3RS2VG.js';import'../chunk-Z4EZERNE.js';import'../chunk-P3ZLIQJP.js';import'../chunk-5PELJRUQ.js';
|
|
1
|
+
import {e as e$5,i as i$3,o,h as h$5}from'../chunk-L4FIDOS6.js';import {c as c$2,d as d$8,h as h$4}from'../chunk-6PX5R326.js';import {e,h as h$1,f as f$4,g as g$1}from'../chunk-IXUFU6TE.js';export{b as BigText,a as BigTextConfigSchema,e as createBigText,g as isBigText,h as resetBigTextStore,f as setBigText}from'../chunk-IXUFU6TE.js';import {c as c$1,g as g$2,f as f$5,d as d$6}from'../chunk-4EV3YS7F.js';export{b as BitmapFontSchema,a as CharBitmapSchema,c as createFontNotFoundError,f as getCharBitmap,d as loadFont,g as renderChar}from'../chunk-4EV3YS7F.js';import {l as l$3,a as a$3,b as b$2}from'../chunk-EHYOVHRL.js';import'../chunk-4LWWONFK.js';import'../chunk-5N3O25O7.js';export{A as createFormEntity,B as createProgressBarEntity,D as createRadioButtonEntity,C as createRadioSetEntity,z as createSliderEntity,x as createTextareaEntity,w as createTextboxEntity}from'../chunk-SXOBHRXF.js';import {a as a$2}from'../chunk-FJLSHFCF.js';import {ga as ga$1,xa as xa$1,xb as xb$1,Ab as Ab$1,Ob as Ob$1,Ub as Ub$1,_a as _a$1,eb,ra,ea,Ta as Ta$1,Xa as Xa$1,Va as Va$1,Sa as Sa$1,Ra as Ra$1,Oa as Oa$1,Na as Na$1,S,za as za$1,da,oa,$,C,Y,X,W,V,wa as wa$1,va as va$1,ua,Ca as Ca$1,Ba as Ba$1,Aa as Aa$1,Wa as Wa$1,ca as ca$1,ba as ba$1,aa,ia,Ma as Ma$1,Pa as Pa$1,T,U,w,s as s$1,p,q as q$2,na,zb as zb$1,ac as ac$1,Vb as Vb$1,Zb as Zb$1,_b as _b$1,Xb as Xb$1,Yb as Yb$1,Rb as Rb$1,Qb as Qb$1,Tb as Tb$1,Sb as Sb$1,$b as $b$1,Jb as Jb$1,Pb as Pb$1,Ib as Ib$1,Mb as Mb$1,Lb as Lb$1,Kb as Kb$1,Gb as Gb$1,Fb as Fb$1,Eb as Eb$1,Db as Db$1,Nb as Nb$1,Bb as Bb$1,Cb as Cb$1,hb as hb$1,fb as fb$1,nb,jb as jb$1,kb as kb$1,ha as ha$1,b as b$1,d as d$5,yb as yb$1,gb as gb$1,mb as mb$1,hc as hc$1,wc as wc$2,yc as yc$1,jc as jc$1,kc as kc$1,vc as vc$2,mc as mc$1,qc as qc$2,pc as pc$1,uc as uc$2,tc as tc$2,sc as sc$1,rc as rc$2,oc as oc$1,nc as nc$1}from'../chunk-W64J7C25.js';import'../chunk-JHCKPCUH.js';import {g as g$3,h as h$3,i as i$4,o as o$2,n as n$1,m as m$3,w as w$1}from'../chunk-VOCM5T2G.js';import {e as e$6,d as d$7,p as p$1,y as y$1,u as u$1,q as q$4,n,m as m$2,o as o$1,l as l$2,s as s$2,r}from'../chunk-LNEISTXM.js';import'../chunk-AEJIX2MW.js';import'../chunk-C5PCEQ6G.js';import {Le as Le$1,gf,ff,ef,df,cf,bf,af,$e as $e$1,_e,Ze,Ye as Ye$1,Se as Se$1,Ve as Ve$1,Ue,Ne as Ne$1,Qe as Qe$1,Re,Oe,Pe as Pe$1,ka as ka$1,Ba as Ba$2,Ja as Ja$1,Ka as Ka$1,O,X as X$1,P as P$1,q as q$3,H as H$1,B,J as J$1,Te,Me,qc as qc$1,wc as wc$1,Gc as Gc$1,Lc as Lc$1,Jc as Jc$1,Nc as Nc$1,rc as rc$1,xc as xc$1,ta,va as va$2,$ as $$1,Z,aa as aa$1,R,Y as Y$1,W as W$1,U as U$1,T as T$1,_,F,K,E,G as G$1,x,C as C$1,v as v$2,z as z$1,A,y,Oc as Oc$1,Pc as Pc$1,Cc as Cc$1,Kc as Kc$1,Fc as Fc$1,Bc as Bc$1,Ic as Ic$1,Hc as Hc$1,vc as vc$1,uc as uc$1,tc as tc$1}from'../chunk-JCLNGU3K.js';import'../chunk-M5FXA5FL.js';import {m}from'../chunk-RJULLVTH.js';import {d,e as e$4}from'../chunk-JWIVZCKW.js';import {d as d$3,e as e$7}from'../chunk-W6RELN6A.js';import {a,l,m as m$1,f as f$3,e as e$2,d as d$2,c,b}from'../chunk-EOFT3PNU.js';import {e as e$1,f as f$2,d as d$4,h as h$2}from'../chunk-JN2OGNK3.js';import {q as q$1,H,f,g,s,v as v$1,u,M as M$1,i as i$1,G,I,e as e$3}from'../chunk-JB5KFQPD.js';import'../chunk-NPDPBAW6.js';import'../chunk-FUW7OD3H.js';import {J,P,f as f$1,d as d$1,M,i as i$2,a as a$1}from'../chunk-LIVVHEOU.js';import'../chunk-Z4EZERNE.js';import {v,h,i,l as l$1,k,j as j$1,t}from'../chunk-7ZFQO3OQ.js';import'../chunk-I7AUKTXE.js';import {z}from'zod';import {readdirSync,statSync}from'fs';import {resolve,join,dirname}from'path';import {createRequire}from'module';import {pathToFileURL}from'url';var lb=z.union([z.number(),z.string().regex(/^\d+(\.\d+)?%$/,'Percentage must be in format "50%"'),z.literal("auto")]),ca=z.union([z.number(),z.string().regex(/^\d+(\.\d+)?%$/,'Percentage must be in format "50%"'),z.enum(["center","left","right","top","bottom"])]),Ex=z.object({type:z.enum(["line","bg","none"]).optional(),fg:z.union([z.string(),z.number()]).optional(),bg:z.union([z.string(),z.number()]).optional(),ch:z.union([z.enum(["single","double","rounded","bold","ascii"]),z.custom(e=>typeof e=="object"&&e!==null&&"topLeft"in e&&"topRight"in e&&"bottomLeft"in e&&"bottomRight"in e&&"horizontal"in e&&"vertical"in e)]).optional()}).optional(),Mx=z.union([z.number().int().nonnegative(),z.object({left:z.number().int().nonnegative().optional(),top:z.number().int().nonnegative().optional(),right:z.number().int().nonnegative().optional(),bottom:z.number().int().nonnegative().optional()})]).optional(),cb=z.object({left:ca.optional(),top:ca.optional(),right:ca.optional(),bottom:ca.optional(),width:lb.optional(),height:lb.optional(),fg:z.union([z.string(),z.number()]).optional(),bg:z.union([z.string(),z.number()]).optional(),border:Ex,padding:Mx,content:z.string().optional(),align:z.enum(["left","center","right"]).optional(),valign:z.enum(["top","middle","bottom"]).optional()}),Bx=1e4,Xr={isBox:new Uint8Array(Bx)};function Px(e){switch(e){case "left":return 0;case "center":return 1;case "right":return 2}}function Fx(e){switch(e){case "top":return 0;case "middle":return 1;case "bottom":return 2}}function Dx(e){switch(e){case "single":return b;case "double":return c;case "rounded":return d$2;case "bold":return e$2;case "ascii":return f$3}}function Ax(e){switch(e){case "line":return 1;case "bg":return 2;case "none":return 0}}function ub(e){return e===void 0?0:typeof e=="number"?e:0}function db(e){return e===void 0||typeof e=="string"&&e==="auto"?"auto":e}function Ix(e,r,o){let n=ub(o.left),t=ub(o.top);H(e,r,n,t);let i=db(o.width),a=db(o.height);f(e,r,i,a);}function kx(e,r,o){o.fg===void 0&&o.bg===void 0||J(e,r,{fg:o.fg!==void 0?v(o.fg):void 0,bg:o.bg!==void 0?v(o.bg):void 0});}function Rx(e,r,o){let n=o.type?Ax(o.type):1;if(l(e,r,{type:n,fg:o.fg!==void 0?v(o.fg):void 0,bg:o.bg!==void 0?v(o.bg):void 0}),o.ch){let t=typeof o.ch=="string"?Dx(o.ch):o.ch;m$1(e,r,t);}}function Ox(e,r,o){typeof o=="number"?d(e,r,{left:o,top:o,right:o,bottom:o}):d(e,r,o);}function Vx(e,r,o){if(o.content===void 0)return;let n={};o.align&&(n.align=Px(o.align)),o.valign&&(n.valign=Fx(o.valign)),e$1(e,r,o.content,n);}function ft(e,r,o={}){let n=cb.parse(o),t=r;Xr.isBox[t]=1,Ix(e,t,n),kx(e,t,n),n.border&&Rx(e,t,n.border),n.padding!==void 0&&Ox(e,t,n.padding),Vx(e,t,n),q$1(e,t,{focusable:true});let i$1={eid:t,show(){return P(e,t,true),i$1},hide(){return P(e,t,false),i$1},move(a,s){return M$1(e,t,a,s),M(e,t),i$1},setPosition(a,s){return H(e,t,a,s),M(e,t),i$1},setContent(a){return e$1(e,t,a),M(e,t),i$1},getContent(){return f$2(e,t)},focus(){return u(e,t),i$1},blur(){return v$1(e,t),i$1},isFocused(){return s(e,t)},append(a){return d$1(e,t,a),i$1},getChildren(){return f$1(e,t)},destroy(){Xr.isBox[t]=0,i(e,t);}};return i$1}function dl(e,r,o){return e$1(e,r,o),M(e,r),r}function cl(e,r){return f$2(e,r)}function gl(e,r){return Xr.isBox[r]===1}function ml(){Xr.isBox.fill(0);}var _x=z.object({title:z.string(),content:z.union([z.string(),z.number().int().nonnegative()]).optional(),expanded:z.boolean().optional(),onToggle:z.function().nullable().optional()}),zx=z.object({sections:z.array(_x).optional(),allowMultiple:z.boolean().optional(),defaultExpanded:z.union([z.array(z.number().int().nonnegative()),z.literal("all")]).optional(),icons:z.object({expanded:z.string().optional(),collapsed:z.string().optional()}).optional(),style:z.object({header:z.object({fg:z.union([z.string(),z.number().int().nonnegative()]).optional(),bg:z.union([z.string(),z.number().int().nonnegative()]).optional()}).optional(),content:z.object({fg:z.union([z.string(),z.number().int().nonnegative()]).optional(),bg:z.union([z.string(),z.number().int().nonnegative()]).optional()}).optional()}).optional()}),Nx=z.object({title:z.string(),content:z.union([z.string(),z.number().int().nonnegative()]).optional(),expanded:z.boolean().optional(),onToggle:z.function().nullable().optional(),icons:z.object({expanded:z.string().optional(),collapsed:z.string().optional()}).optional(),style:z.object({header:z.object({fg:z.union([z.string(),z.number().int().nonnegative()]).optional(),bg:z.union([z.string(),z.number().int().nonnegative()]).optional()}).optional(),content:z.object({fg:z.union([z.string(),z.number().int().nonnegative()]).optional(),bg:z.union([z.string(),z.number().int().nonnegative()]).optional()}).optional()}).optional()}),yn=new Map,ga=new Map,ma=new Map;function bl(){yn.clear(),ga.clear(),ma.clear();}var gb="\u25BC",mb="\u25B6";function Ux(e,r){let o=new Set;if(r==="all")for(let n=0;n<e.length;n++)o.add(n);else if(Array.isArray(r))for(let n of r)o.add(n);else for(let n=0;n<e.length;n++)e[n]?.expanded&&o.add(n);return o}function fa(e,r,o){if(!o)return;let n=typeof o.fg=="string"?v(o.fg):o.fg,t=typeof o.bg=="string"?v(o.bg):o.bg;(n!==void 0||t!==void 0)&&J(e,r,{fg:n,bg:t});}function Gx(e,r,o,n,t,i,a){let s=h(e);return ft(e,s),H(e,s,0,n*2),f(e,s,40,1),e$1(e,s,`${t?i.expanded:i.collapsed} ${o.title}`),q$1(e,s,{focusable:true}),d$1(e,r,s),ma.set(s,o.title),e$7(e,s,true),fa(e,s,a),s}function Hx(e,r,o,n,t,i){let a=h(e);return ft(e,a),H(e,a,2,n*2+1),f(e,a,38,3),d(e,a,{left:1,right:1,top:0,bottom:0}),typeof o.content=="string"?e$1(e,a,o.content):o.content!==void 0&&d$1(e,a,o.content),P(e,a,t),d$1(e,r,a),fa(e,a,i),a}function wx(e,r,o,n,t,i,a){let s=Gx(e,r,o,n,t,i,a?.header),l=Hx(e,r,o,n,t,a?.content);return {headerEntity:s,contentEntity:l,expanded:t,onToggle:o.onToggle??void 0}}function pl(e,r,o={}){let n=o.sections??[],t=o.allowMultiple??false,i=o.defaultExpanded,a={expanded:o.icons?.expanded??gb,collapsed:o.icons?.collapsed??mb},s=Ux(n,i),l=n.map((u,d)=>wx(e,r,u,d,s.has(d),a,o.style));return yn.set(r,{allowMultiple:t,expandedSections:s,sections:l,icons:a,world:e}),r}function Jr(e,r){let o=yn.get(e);if(!o)return;let n=o.sections[r];if(!n)return;let t=!n.expanded;!o.allowMultiple&&t&&o.sections.forEach((i,a)=>{a!==r&&i.expanded&&(i.expanded=false,P(o.world,i.contentEntity,false),e$1(o.world,i.headerEntity,`${o.icons.collapsed} ${fl(i.headerEntity)}`),o.expandedSections.delete(a));}),n.expanded=t,P(o.world,n.contentEntity,t),e$1(o.world,n.headerEntity,`${t?o.icons.expanded:o.icons.collapsed} ${fl(n.headerEntity)}`),t?o.expandedSections.add(r):o.expandedSections.delete(r),M(o.world,e),n.onToggle?.(t);}function ba(e,r){let o=yn.get(e);if(!o)return;let n=o.sections[r];!n||n.expanded||Jr(e,r);}function yl(e){let r=yn.get(e);!r||!r.allowMultiple||r.sections.forEach((o,n)=>{ba(e,n);});}function hl(e){let r=yn.get(e);r&&r.sections.forEach((o,n)=>{o.expanded&&Jr(e,n);});}function xl(e){let r=yn.get(e);return r?Array.from(r.expandedSections):[]}function jx(e,r,o,n,t,i){let a=h(e);return ft(e,a),H(e,a,0,0),f(e,a,40,1),e$1(e,a,`${n?t.expanded:t.collapsed} ${o}`),q$1(e,a,{focusable:true}),d$1(e,r,a),ma.set(a,o),e$7(e,a,true),fa(e,a,i),a}function $x(e,r,o,n,t){let i=h(e);return ft(e,i),H(e,i,2,1),f(e,i,38,3),d(e,i,{left:1,right:1,top:0,bottom:0}),typeof o=="string"?e$1(e,i,o):o!==void 0&&d$1(e,i,o),P(e,i,n),d$1(e,r,i),fa(e,i,t),i}function Sl(e,r,o){let n=o.expanded??false,t={expanded:o.icons?.expanded??gb,collapsed:o.icons?.collapsed??mb},i=jx(e,r,o.title,n,t,o.style?.header),a=$x(e,r,o.content,n,o.style?.content);return ga.set(r,{expanded:n,headerEntity:i,contentEntity:a,onToggle:o.onToggle,icons:t,world:e}),r}function Cl(e){let r=ga.get(e);if(!r)return;let o=!r.expanded;r.expanded=o,P(r.world,r.contentEntity,o),e$1(r.world,r.headerEntity,`${o?r.icons.expanded:r.icons.collapsed} ${fl(r.headerEntity)}`),M(r.world,e),r.onToggle?.(o);}function pa(e){return yn.has(e)}function Tl(e){return ga.has(e)}function Yx(e,r){return pa(e)?{entity:e,world:r}:void 0}function fl(e){return ma.get(e)??""}var fb=Object.freeze({create:pl,is:pa,expandSection:ba,toggleSection:Jr,collapseAll:hl,expandAll:yl,getExpandedSections:xl,resetStore:bl}),bb=Object.freeze({create:Sl,is:Tl,toggle:Cl});var Kx=1e4,Wl={isAutocomplete:new Uint8Array(Kx)},pb=z.object({items:z.array(z.string()).optional().default([]),placeholder:z.string().optional().default("Type to search..."),maxSuggestions:z.number().int().positive().optional().default(10),fuzzyMatch:z.boolean().optional().default(true),value:z.string().optional().default(""),width:z.number().int().positive().optional().default(30),left:z.number().optional().default(0),top:z.number().optional().default(0),fg:z.union([z.string(),z.number()]).optional(),bg:z.union([z.string(),z.number()]).optional(),highlightFg:z.union([z.string(),z.number()]).optional(),highlightBg:z.union([z.string(),z.number()]).optional()}),ot=new Map;function ya(e,r,o,n){if(!r)return e.slice(0,n).map(a=>({item:a,text:a,score:1,indices:[]}));if(o)return c$2(r,e).slice(0,n);let t=r.toLowerCase(),i=[];for(let a of e){let l=a.toLowerCase().indexOf(t);if(l===-1)continue;let u=1-l/a.length;i.push({item:a,text:a,score:u,indices:Array.from({length:r.length},(d,b)=>l+b)});}return i.sort((a,s)=>s.score-a.score),i.slice(0,n)}function vl(e,r,o={}){let n=pb.parse(o),t=r;Wl.isAutocomplete[t]=1,H(e,t,n.left,n.top),f(e,t,n.width,1),q$1(e,t,{focusable:true}),ka$1(e,t),Ba$2(e,t,{placeholder:n.placeholder,maxLength:0});let i$1=n.fg?v(n.fg):void 0,a=n.bg?v(n.bg):void 0;(i$1!==void 0||a!==void 0)&&J(e,t,{fg:i$1,bg:a});let s={items:n.items,inputText:n.value,filteredItems:ya(n.items,n.value,n.fuzzyMatch,n.maxSuggestions),selectedIndex:0,isOpen:false,fuzzyMatch:n.fuzzyMatch,maxSuggestions:n.maxSuggestions};ot.set(t,s),Ja$1(e,t,u=>{let d=ot.get(t);d&&(d.inputText=u,d.filteredItems=ya(d.items,u,d.fuzzyMatch,d.maxSuggestions),d.selectedIndex=0,d.isOpen=u.length>0&&d.filteredItems.length>0,M(e,t),d.onChangeCallback&&d.onChangeCallback(u));}),Ka$1(e,t,u=>{let d=ot.get(t);if(d){if(d.isOpen&&d.filteredItems.length>0){let b=d.filteredItems[d.selectedIndex];b&&(d.inputText=b.item,d.isOpen=false,d.selectedIndex=0,d.onSelectCallback&&d.onSelectCallback(b.item));}else d.onSelectCallback&&d.onSelectCallback(u);M(e,t);}});let l={eid:t,show(){return P(e,t,true),M(e,t),l},hide(){return P(e,t,false),M(e,t),l},focus(){return u(e,t),ta(e,t),va$2(e,t),l},blur(){v$1(e,t);let u=ot.get(t);return u&&(u.isOpen=false),M(e,t),l},getValue(){return ot.get(t)?.inputText??""},setValue(u){let d=ot.get(t);return d&&(d.inputText=u,d.filteredItems=ya(d.items,u,d.fuzzyMatch,d.maxSuggestions),d.selectedIndex=0,d.isOpen=u.length>0&&d.filteredItems.length>0,M(e,t)),l},setItems(u){let d=ot.get(t);return d&&(d.items=u,d.filteredItems=ya(u,d.inputText,d.fuzzyMatch,d.maxSuggestions),d.selectedIndex=0,M(e,t)),l},getItems(){return ot.get(t)?.items??[]},getSuggestions(){return ot.get(t)?.filteredItems.map(d=>d.item)??[]},isOpen(){return ot.get(t)?.isOpen??false},openDropdown(){let u=ot.get(t);return u&&u.filteredItems.length>0&&(u.isOpen=true,M(e,t)),l},closeDropdown(){let u=ot.get(t);return u&&(u.isOpen=false,M(e,t)),l},onSelect(u){let d=ot.get(t);return d&&(d.onSelectCallback=u),l},onChange(u){let d=ot.get(t);return d&&(d.onChangeCallback=u),l},destroy(){ot.delete(t),i(e,t);}};return l}function Ll(e,r){return Wl.isAutocomplete[r]===1}function El(){ot.clear();}var yb=Object.freeze({create:vl,is:Ll,resetStore:El});var qt=10240,un=[[1,8],[2,16],[4,32],[64,128]];function Ml(e,r){if(e<0||e>1||r<0||r>3)return " ";let o=un[r];if(!o)return " ";let n=o[e]??0;return String.fromCharCode(10240|n)}function Zr(e){let r=0;for(let[o,n]of e)if(o>=0&&o<=1&&n>=0&&n<=3){let t=un[n];t&&(r|=t[o]??0);}return String.fromCharCode(10240|r)}function ha(e,r=5){if(e===0)return 1;let o=e/r,n=10**Math.floor(Math.log10(o)),t=o/n,i;return t<=1?i=1:t<=2?i=2:t<=5?i=5:i=10,i*n}function An(e,r,o=5){if(e===r)return [e];let n=r-e,t=ha(n,o),i=Math.floor(e/t)*t,a=[];for(let l=i;l<=r;l+=t)l>=e&&a.push(l);let s=a[a.length-1];return (a.length===0||s!==void 0&&s<r)&&a.push(r),a}function it(e,r,o,n,t){if(o===r)return (n+t)/2;let i=o-r,a=t-n,s=(e-r)/i;return n+s*a}function hn(e,r=8){if(!Number.isFinite(e))return "NaN";let o=Math.abs(e);if(o<.01&&o>0)return e.toExponential(2);if(o>=1e9)return `${(e/1e9).toFixed(2)}B`;if(o>=1e6)return `${(e/1e6).toFixed(2)}M`;if(o>=1e3)return `${(e/1e3).toFixed(2)}K`;let n=e.toFixed(2);return n.length<=r?n:e.toFixed(0)}function eo(e){return `${Math.round(e*100)}%`}var br=[4284790262,4286695300,4294948685,4293227379,4290406600,4294956367,4283289825,4288776319];function It(e){let r=br[e%br.length];return r===void 0?br[0]:r}function Bl(e,r,o){let n=e>>16&255,t=e>>8&255,i=e&255,a=e>>24&255,s=r>>16&255,l=r>>8&255,u=r&255,d=r>>24&255,b=Math.round(n+(s-n)*o),m=Math.round(t+(l-t)*o),c=Math.round(i+(u-i)*o);return (Math.round(a+(d-a)*o)<<24|b<<16|m<<8|c)>>>0}function Pl(e,r){return hn(e,r-1).padEnd(r," ")}function In(e,r){return hn(e,r).padStart(r," ")}function Fl(e){let r=Math.max(0,Math.min(1,e));return r===0?0:r===1?255:r<1?71:0}function pr(e,r){if(r<=0)return "";let o=Math.max(0,Math.min(1,e)),n=r*2,t=Math.round(o*n),i=[];for(let a=0;a<r;a++){let s=a*2,l=s+2,u=0;t>=l?u=255:t>s?u=71:u=0,i.push(String.fromCharCode(10240|u));}return i.join("")}function Dl(e,r,o,n){return pr(e,r)}var xa=[" ","\u258F","\u258E","\u258D","\u258C","\u258B","\u258A","\u2589","\u2588"],Sa=[" ","\u2581","\u2582","\u2583","\u2584","\u2585","\u2586","\u2587","\u2588"],Qx=z.object({label:z.string(),data:z.array(z.number()),color:z.union([z.string(),z.number()]).optional()}),xb=z.object({x:z.number().int().default(0),y:z.number().int().default(0),width:z.number().int().positive().default(40),height:z.number().int().positive().default(20),orientation:z.enum(["vertical","horizontal"]).default("vertical"),mode:z.enum(["grouped","stacked"]).default("grouped"),labels:z.array(z.string()).default([]),series:z.array(Qx).default([]),barChar:z.string().length(1).default("\u2588"),barWidth:z.number().int().positive().default(3),barGap:z.number().int().nonnegative().default(1),showValues:z.boolean().default(false),useBlockChars:z.boolean().default(false),yLabel:z.string().optional(),xLabel:z.string().optional(),fg:z.union([z.string(),z.number()]).optional(),bg:z.union([z.string(),z.number()]).optional()}),to=1e4,He={isBarChart:new Uint8Array(to),showValues:new Uint8Array(to),orientation:new Uint8Array(to),mode:new Uint8Array(to),useBlockChars:new Uint8Array(to)},xn=new Map;function Il(e,r){let o=r?Sa:xa,n=Math.round(e*(o.length-1)),t=Math.max(0,Math.min(o.length-1,n));return o[t]??" "}function hb(e,r,o){if(e>=r+1)return "\u2588";if(e<=r)return " ";let n=e-r;return Il(n,o)}function qx(e,r,o,n){let t=[],i=e.mode==="stacked",a=Number.NEGATIVE_INFINITY;if(i)for(let p=0;p<e.labels.length;p++){let h=0;for(let E of e.series)h+=E.data[p]??0;h>a&&(a=h);}else for(let p of e.series)for(let h of p.data)h>a&&(a=h);(a===Number.NEGATIVE_INFINITY||a===0)&&(a=100);let s=8,u=o-2,d=r-s,b=An(0,a,5),m=i?e.barWidth:e.barWidth*e.series.length+e.barGap*(e.series.length-1);for(let p=0;p<u;p++){let h=u-p-1,E=it(h,0,u-1,0,a),C=b.find(I=>Math.abs(I-E)<a/u),P=`${C!==void 0?In(C,s-2):" ".repeat(s-2)}\u2502 `;for(let I=0;I<e.labels.length;I++){if(i){let L=0,_=" ";for(let be of e.series){let ye=be.data[I]??0,ht=L+ye,Fn=it(L,0,a,0,u-1),$t=it(ht,0,a,0,u-1);if(h>=Fn&&h<=$t){e.useBlockChars&&h===Math.floor($t)&&h!==$t?_=hb($t,h,true):_=e.barChar;break}L=ht;}P+=_.repeat(e.barWidth);}else for(let L=0;L<e.series.length;L++){let _=e.series[L];if(!_)continue;let be=_.data[I]??0,ye=it(be,0,a,0,u-1),ht;h>ye?ht=" ":e.useBlockChars&&h===Math.floor(ye)?ht=hb(ye,h,true):ht=e.barChar,P+=ht.repeat(e.barWidth),L<e.series.length-1&&(P+=" ".repeat(e.barGap));}I<e.labels.length-1&&(P+=" ");}t.push(P.padEnd(r," "));}let c=`${" ".repeat(s)}\u2514${"\u2500".repeat(d-1)}`;t.push(c.padEnd(r," "));let g=`${" ".repeat(s)} `;for(let p=0;p<e.labels.length;p++){let h=e.labels[p]??"",E=m+2;g+=h.slice(0,E).padEnd(E," ");}return t.push(g.padEnd(r," ")),t.join(`
|
|
2
|
+
`)}function Xx(e,r,o,n){let t=[],i=e.mode==="stacked",a=Number.NEGATIVE_INFINITY;if(i)for(let u=0;u<e.labels.length;u++){let d=0;for(let b of e.series)d+=b.data[u]??0;d>a&&(a=d);}else for(let u of e.series)for(let d of u.data)d>a&&(a=d);(a===Number.NEGATIVE_INFINITY||a===0)&&(a=100);let s=Math.max(...e.labels.map(u=>u.length),8),l=r-s-2-(n?10:0);for(let u=0;u<e.labels.length;u++){let d=e.labels[u]??"";if(i){let b=`${d.slice(0,s).padStart(s," ")} \u2502`;for(let m of e.series){let c=m.data[u]??0,g=it(c,0,a,0,l),p=Math.floor(g),h=g-p;b+=e.barChar.repeat(p),e.useBlockChars&&h>0&&(b+=Il(h,false));}if(n){let m=e.series.reduce((c,g)=>c+(g.data[u]??0),0);b+=` ${hn(m)}`;}t.push(b.padEnd(r," "));}else {let b=`${d.slice(0,s).padStart(s," ")} \u2502`,m=e.series[0];if(m){let c=m.data[u]??0,g=it(c,0,a,0,l),p=Math.floor(g),h=g-p;b+=e.barChar.repeat(p),e.useBlockChars&&h>0&&(b+=Il(h,false)),n&&(b+=` ${hn(c)}`);}t.push(b.padEnd(r," "));}}return t.join(`
|
|
3
|
+
`)}function Al(e,r){let o=xn.get(r);if(!o)return;let n=g(e,r);if(!n)return;let t=He.showValues[r]===1,a=He.orientation[r]===1?Xx(o,n.width,n.height,t):qx(o,n.width,n.height);e$1(e,r,a),M(e,r);}function kl(e,r={}){let o=xb.parse(r),n=h(e);H(e,n,o.x,o.y),f(e,n,o.width,o.height),He.isBarChart[n]=1,He.showValues[n]=o.showValues?1:0,He.orientation[n]=o.orientation==="horizontal"?1:0,He.mode[n]=o.mode==="stacked"?1:0,He.useBlockChars[n]=o.useBlockChars?1:0,xn.set(n,{labels:[...o.labels],series:o.series.map((i,a)=>({label:i.label,data:[...i.data],color:i.color?v(i.color):It(a)})),barChar:o.barChar,barWidth:o.barWidth,barGap:o.barGap,yLabel:o.yLabel??"",xLabel:o.xLabel??"",mode:o.mode,useBlockChars:o.useBlockChars}),(o.fg!==void 0||o.bg!==void 0)&&J(e,n,{fg:o.fg!==void 0?v(o.fg):void 0,bg:o.bg!==void 0?v(o.bg):void 0}),Al(e,n);let t={eid:n,setSeries(i){let a=xn.get(n);return a&&(a.series=i.map((s,l)=>({label:s.label,data:[...s.data],color:s.color?v(s.color):It(l)})),Al(e,n)),t},getSeries(){return xn.get(n)?.series??[]},setLabels(i){let a=xn.get(n);return a&&(a.labels=[...i],Al(e,n)),t},getLabels(){return xn.get(n)?.labels??[]},setPosition(i,a){return H(e,n,i,a),M(e,n),t},destroy(){He.isBarChart[n]=0,He.showValues[n]=0,He.orientation[n]=0,He.mode[n]=0,He.useBlockChars[n]=0,xn.delete(n),i(e,n);}};return t}function Rl(e,r){return He.isBarChart[r]===1}function Ol(){He.isBarChart.fill(0),He.showValues.fill(0),He.orientation.fill(0),He.mode.fill(0),He.useBlockChars.fill(0),xn.clear();}var Sb=Object.freeze({create:kl,is:Rl,resetStore:Ol,HORIZONTAL_BLOCKS:xa,VERTICAL_BLOCKS:Sa});var Cb=Object.freeze({create:e,is:g$1,set:f$4,resetStore:h$1});var Tb=Object.freeze({create:ft,is:gl,getContent:cl,setContent:dl,resetStore:ml});var vb=z.object({x:z.number().int().default(0),y:z.number().int().default(0),width:z.number().int().positive().optional(),height:z.number().int().positive().default(3),label:z.string().default("Button"),focusable:z.boolean().default(true),disabled:z.boolean().default(false)}),Jx=1e4,Wb=2,ro={isButtonWidget:new Uint8Array(Jx)},no=new Map;function Vl(e,r={}){let o=vb.parse(r),n=h(e);ro.isButtonWidget[n]=1,O(e,n);let t=o.label.length,i$1=o.width??t+Wb*2;f(e,n,i$1,o.height),H(e,n,o.x,o.y),no.set(n,{label:o.label}),e$1(e,n,o.label,{align:1,valign:1}),d$3(e,n,{clickable:true,hoverable:true,keyable:true,focusable:o.focusable}),q$1(e,n,{focusable:o.focusable}),o.disabled&&X$1(e,n);let a={eid:n,click(){return _(e,n),M(e,n),a},isHovered(){return T$1(e,n)},isPressed(){return U$1(e,n)},isFocused(){return s(e,n)},isDisabled(){return W$1(e,n)},setDisabled(s){return s?X$1(e,n):Y$1(e,n),M(e,n),a},setLabel(s){let l=no.get(n);if(l&&(l.label=s),!o.width){let u=s.length+Wb*2;f(e,n,u,o.height);}return e$1(e,n,s,{align:1,valign:1}),M(e,n),a},getLabel(){return no.get(n)?.label??""},setPosition(s,l){return H(e,n,s,l),M(e,n),a},move(s,l){return M$1(e,n,s,l),M(e,n),a},getPosition(){return {x:G.x[n]??0,y:G.y[n]??0}},focus(){return u(e,n),R(e,n,"focus"),M(e,n),a},blur(){return v$1(e,n),R(e,n,"blur"),M(e,n),a},handleKey(s$1){if(!s(e,n))return false;let l=aa$1(e,n,s$1);return l&&M(e,n),l},onClick(s){return Z(n,s),a},destroy(){ro.isButtonWidget[n]=0,no.delete(n),$$1(n),i(e,n);}};return a}function _l(e,r){return ro.isButtonWidget[r]===1&&P$1(e,r)}function zl(){ro.isButtonWidget.fill(0),no.clear();}var Lb=Object.freeze({create:Vl,is:_l,resetStore:zl});var Eb=z.object({left:z.number().default(0),top:z.number().default(0),initialDate:z.date().optional(),minDate:z.date().optional(),maxDate:z.date().optional(),firstDayOfWeek:z.number().int().min(0).max(6).default(0),showWeekNumbers:z.boolean().default(false),markedDates:z.array(z.date()).default([]),theme:z.object({headerFg:z.union([z.string(),z.number()]).optional(),headerBg:z.union([z.string(),z.number()]).optional(),weekdayFg:z.union([z.string(),z.number()]).optional(),dayFg:z.union([z.string(),z.number()]).optional(),selectedFg:z.union([z.string(),z.number()]).optional(),selectedBg:z.union([z.string(),z.number()]).optional(),todayFg:z.union([z.string(),z.number()]).optional(),todayBg:z.union([z.string(),z.number()]).optional(),markedFg:z.union([z.string(),z.number()]).optional(),markedBg:z.union([z.string(),z.number()]).optional(),outsideFg:z.union([z.string(),z.number()]).optional(),cursorFg:z.union([z.string(),z.number()]).optional(),cursorBg:z.union([z.string(),z.number()]).optional()}).optional()}).strict(),io=new Map;function we(e){return io.get(e)}function Zx(e,r){io.set(e,r);}function eS(e){io.delete(e);}function Nl(){io.clear();}function Ca(e){let r=e.getFullYear(),o=String(e.getMonth()+1).padStart(2,"0"),n=String(e.getDate()).padStart(2,"0");return `${r}-${o}-${n}`}function oo(e,r){return new Date(e,r+1,0).getDate()}function tS(e,r){return new Date(e,r,1).getDay()}function nS(e){let r=new Date(e.valueOf()),o=(e.getDay()+6)%7;r.setDate(r.getDate()-o+3);let n=r.valueOf();return r.setMonth(0,1),r.getDay()!==4&&r.setMonth(0,1+(4-r.getDay()+7)%7),1+Math.ceil((n-r.valueOf())/6048e5)}function rS(e,r,o){return !(r&&e<r||o&&e>o)}function oS(e,r,o,n,t){let i="";if(o){let s=new Date(n,t,e>0?e:1),l=nS(s);i+=`${String(l).padStart(2," ")} `;}let a=e;for(let s=0;s<7;s++){if(a<1||a>r)i+=" ";else {let l=String(a).padStart(2," ");i+=`${l} `;}a++;}return {weekLine:i.trimEnd(),nextDate:a}}function bt(e,r){let o=we(r);if(!o)return;let n=[],t=["January","February","March","April","May","June","July","August","September","October","November","December"],i=["Su","Mo","Tu","We","Th","Fr","Sa"],a=[...i.slice(o.firstDayOfWeek),...i.slice(0,o.firstDayOfWeek)],s=`${t[o.month]} ${o.year}`,l=Math.max(0,Math.floor((23-s.length)/2));n.push(" ".repeat(l)+s);let u=o.showWeekNumbers?" ":"";u+=a.join(" "),n.push(u);let d=oo(o.year,o.month),m=(tS(o.year,o.month)-o.firstDayOfWeek+7)%7,c=1,g=1-m;for(let p=0;p<6;p++){let h=oS(g,d,o.showWeekNumbers,o.year,o.month);if(n.push(h.weekLine),g=h.nextDate,c>d&&g>d)break}e$1(e,r,n.join(`
|
|
4
|
+
`)),M(e,r);}function Ul(e,r,o={}){let n=Eb.parse(o),t=r,i$1=n.initialDate??new Date,a=i$1.getFullYear(),s=i$1.getMonth(),l=i$1.getDate();H(e,t,n.left,n.top);let u=n.showWeekNumbers?23:20;f(e,t,u,8);let b=new Set(n.markedDates.map(Ca)),m={year:a,month:s,selectedDay:void 0,cursorDay:l,minDate:n.minDate,maxDate:n.maxDate,firstDayOfWeek:n.firstDayOfWeek,showWeekNumbers:n.showWeekNumbers,markedDates:b,theme:n.theme??{},onSelectCallbacks:[]};Zx(t,m),bt(e,t);let c={eid:t,setDate(g){let p=we(t);return p&&(p.year=g.getFullYear(),p.month=g.getMonth(),p.selectedDay=g.getDate(),p.cursorDay=g.getDate(),bt(e,t)),c},getDate(){let g=we(t);if(!(!g||g.selectedDay===void 0))return new Date(g.year,g.month,g.selectedDay)},getMonth(){let g=we(t);return g?{year:g.year,month:g.month}:{year:new Date().getFullYear(),month:new Date().getMonth()}},prevMonth(){let g=we(t);if(!g)return c;g.month--,g.month<0&&(g.month=11,g.year--);let p=oo(g.year,g.month);return g.cursorDay>p&&(g.cursorDay=p),bt(e,t),c},nextMonth(){let g=we(t);if(!g)return c;g.month++,g.month>11&&(g.month=0,g.year++);let p=oo(g.year,g.month);return g.cursorDay>p&&(g.cursorDay=p),bt(e,t),c},prevYear(){let g=we(t);if(!g)return c;g.year--;let p=oo(g.year,g.month);return g.cursorDay>p&&(g.cursorDay=p),bt(e,t),c},nextYear(){let g=we(t);if(!g)return c;g.year++;let p=oo(g.year,g.month);return g.cursorDay>p&&(g.cursorDay=p),bt(e,t),c},cursorUp(){let g=we(t);if(!g)return c;let p=new Date(g.year,g.month,g.cursorDay);return p.setDate(p.getDate()-7),g.year=p.getFullYear(),g.month=p.getMonth(),g.cursorDay=p.getDate(),bt(e,t),c},cursorDown(){let g=we(t);if(!g)return c;let p=new Date(g.year,g.month,g.cursorDay);return p.setDate(p.getDate()+7),g.year=p.getFullYear(),g.month=p.getMonth(),g.cursorDay=p.getDate(),bt(e,t),c},cursorLeft(){let g=we(t);if(!g)return c;let p=new Date(g.year,g.month,g.cursorDay);return p.setDate(p.getDate()-1),g.year=p.getFullYear(),g.month=p.getMonth(),g.cursorDay=p.getDate(),bt(e,t),c},cursorRight(){let g=we(t);if(!g)return c;let p=new Date(g.year,g.month,g.cursorDay);return p.setDate(p.getDate()+1),g.year=p.getFullYear(),g.month=p.getMonth(),g.cursorDay=p.getDate(),bt(e,t),c},selectCursor(){let g=we(t);if(!g)return c;let p=new Date(g.year,g.month,g.cursorDay);if(!rS(p,g.minDate,g.maxDate))return c;g.selectedDay=g.cursorDay,bt(e,t);for(let h of g.onSelectCallbacks)h(p);return c},setMarkedDates(g){let p=we(t);return p&&(p.markedDates=new Set(g.map(Ca)),bt(e,t)),c},addMarkedDate(g){let p=we(t);return p&&(p.markedDates.add(Ca(g)),bt(e,t)),c},removeMarkedDate(g){let p=we(t);return p&&(p.markedDates.delete(Ca(g)),bt(e,t)),c},getMarkedDates(){let g=we(t);return g?Array.from(g.markedDates).map(p=>new Date(p)):[]},handleKey(g){if(!we(t))return false;switch(g){case "up":return c.cursorUp(),true;case "down":return c.cursorDown(),true;case "left":return c.cursorLeft(),true;case "right":return c.cursorRight(),true;case "enter":case "return":return c.selectCursor(),true;case "pageup":return c.prevMonth(),true;case "pagedown":return c.nextMonth(),true;case "S-pageup":return c.prevYear(),true;case "S-pagedown":return c.nextYear(),true;default:return false}},onSelect(g){let p=we(t);return p?(p.onSelectCallbacks.push(g),()=>{let h=p.onSelectCallbacks.indexOf(g);h>=0&&p.onSelectCallbacks.splice(h,1);}):()=>{}},render(){return bt(e,t),c},destroy(){eS(t),i(e,t);}};return c}function Gl(e){return io.has(e)}var iS="Calendar";var Mb=Object.freeze({create:Ul,is:Gl,resetStore:Nl});var Bb=z.union([z.number(),z.string().regex(/^\d+(\.\d+)?%$/,'Percentage must be in format "50%"'),z.literal("auto")]),Ta=z.union([z.number(),z.string().regex(/^\d+(\.\d+)?%$/,'Percentage must be in format "50%"'),z.enum(["center","left","right","top","bottom"])]),Db=z.object({left:Ta.optional(),top:Ta.optional(),right:Ta.optional(),bottom:Ta.optional(),width:Bb.optional(),height:Bb.optional(),fg:z.union([z.string(),z.number()]).optional(),bg:z.union([z.string(),z.number()]).optional(),content:z.string().optional(),align:z.enum(["left","center","right"]).optional(),valign:z.enum(["top","middle","bottom"]).optional(),shrink:z.boolean().optional()}),aS=1e4,ao={isText:new Uint8Array(aS)};function sS(e){switch(e){case "left":return 0;case "center":return 1;case "right":return 2}}function lS(e){switch(e){case "top":return 0;case "middle":return 1;case "bottom":return 2}}function Pb(e){return e===void 0?0:typeof e=="number"?e:0}function Fb(e){return e===void 0||typeof e=="string"&&e==="auto"?"auto":e}function uS(e,r,o){let n=Pb(o.left),t=Pb(o.top);H(e,r,n,t);let i=Fb(o.width),a=Fb(o.height);f(e,r,i,a);let s=o.shrink!==false;i$1(e,r,s);}function dS(e,r,o){o.fg===void 0&&o.bg===void 0||J(e,r,{fg:o.fg!==void 0?v(o.fg):void 0,bg:o.bg!==void 0?v(o.bg):void 0});}function cS(e,r,o){if(o.content===void 0)return;let n={};o.align&&(n.align=sS(o.align)),o.valign&&(n.valign=lS(o.valign)),e$1(e,r,o.content,n);}function kn(e,r,o={}){let n=Db.parse(o),t=r;ao.isText[t]=1,uS(e,t,n),dS(e,t,n),cS(e,t,n),q$1(e,t,{focusable:true});let i$1={eid:t,show(){return P(e,t,true),i$1},hide(){return P(e,t,false),i$1},move(a,s){return M$1(e,t,a,s),M(e,t),i$1},setPosition(a,s){return H(e,t,a,s),M(e,t),i$1},setContent(a){return e$1(e,t,a),M(e,t),i$1},getContent(){return f$2(e,t)},focus(){return u(e,t),i$1},blur(){return v$1(e,t),i$1},isFocused(){return s(e,t)},append(a){return d$1(e,t,a),i$1},getChildren(){return f$1(e,t)},destroy(){ao.isText[t]=0,i(e,t);}};return i$1}function so(e,r,o){return e$1(e,r,o),M(e,r),r}function Hl(e,r){return f$2(e,r)}function wl(e,r){return ao.isText[r]===1}function jl(){ao.isText.fill(0);}var gS=1e4,Wa={isCanvas:new Uint8Array(gS)},Ab=z.object({width:z.number().int().positive().optional().default(40),height:z.number().int().positive().optional().default(40),fg:z.union([z.string(),z.number()]).optional(),bg:z.union([z.string(),z.number()]).optional(),fillChar:z.string().length(1).optional().default(" ")}),yr=new Map;function mS(e,r){let o=Math.floor(e/2),n=Math.floor(r/4),t=e%2,i=r%4;return {charX:o,charY:n,col:t,row:i}}function Ib(e,r,o){return o*e.widthChars+r}function kb(e){let r=[];for(let o=0;o<e.heightChars;o++){let n="";for(let t=0;t<e.widthChars;t++){let i=Ib(e,t,o),a=e.pixels[i]??0;n+=String.fromCharCode(10240|a);}r.push(n);}return r.join(`
|
|
5
|
+
`)}function va(e){let r=kb(e);so(e.world,e.textEntity,r),M(e.world,e.entity);}function Ye(e,r,o,n=true){let t=yr.get(e.entity);if(!t||r<0||r>=t.widthDots||o<0||o>=t.heightDots)return;let{charX:i,charY:a,col:s,row:l}=mS(r,o),u=Ib(t,i,a),d=un[l];if(!d)return;let b=d[s]??0;n?t.pixels[u]=(t.pixels[u]??0)|b:t.pixels[u]=(t.pixels[u]??0)&~b,va(t);}function $l(e,r,o,n,t){let i=Math.abs(n-r),a=Math.abs(t-o),s=r<n?1:-1,l=o<t?1:-1,u=i-a,d=r,b=o;for(;Ye(e,d,b,true),!(d===n&&b===t);){let m=2*u;m>-a&&(u-=a,d+=s),m<i&&(u+=i,b+=l);}}function Yl(e,r,o,n,t,i=false){if(i)for(let a=0;a<t;a++)for(let s=0;s<n;s++)Ye(e,r+s,o+a,true);else {for(let a=0;a<n;a++)Ye(e,r+a,o,true),Ye(e,r+a,o+t-1,true);for(let a=0;a<t;a++)Ye(e,r,o+a,true),Ye(e,r+n-1,o+a,true);}}function Kl(e,r,o,n,t=false){if(t)for(let i=-n;i<=n;i++){let a=Math.floor(Math.sqrt(n*n-i*i));for(let s=-a;s<=a;s++)Ye(e,r+s,o+i,true);}else {let i=n,a=0,s=0;for(;i>=a;)Ye(e,r+i,o+a,true),Ye(e,r+a,o+i,true),Ye(e,r-a,o+i,true),Ye(e,r-i,o+a,true),Ye(e,r-i,o-a,true),Ye(e,r-a,o-i,true),Ye(e,r+a,o-i,true),Ye(e,r+i,o-a,true),s<=0&&(a+=1,s+=2*a+1),s>0&&(i-=1,s-=2*i+1);}}function Ql(e,r,o,n){let t=yr.get(e.entity);t&&va(t);}function ql(e){let r=yr.get(e.entity);r&&(r.pixels.fill(0),va(r));}function Xl(e){let r=yr.get(e.entity);return r?kb(r):""}function Jl(e,r,o={}){let n=Ab.parse(o),t=Math.ceil(n.width/2),i=Math.ceil(n.height/4);Wa.isCanvas[r]=1,ft(e,r),H(e,r,0,0);let a=n.fg?v(n.fg):void 0,s=n.bg?v(n.bg):void 0;(a!==void 0||s!==void 0)&&J(e,r,{fg:a,bg:s});let l=h(e);kn(e,l),H(e,l,0,0),d$1(e,r,l);let u=new Uint8Array(t*i);u.fill(0);let d={world:e,entity:r,textEntity:l,widthDots:n.width,heightDots:n.height,widthChars:t,heightChars:i,pixels:u};return yr.set(r,d),va(d),{entity:r,world:e,widthDots:n.width,heightDots:n.height}}function Zl(e){return Wa.isCanvas[e]===1}function eu(){yr.clear(),Wa.isCanvas.fill(0);}var Rb=Object.freeze({create:Jl,is:Zl,clear:ql,getContent:Xl,drawLine:$l,drawRect:Yl,drawCircle:Kl,drawText:Ql,setPixel:Ye,resetStore:eu});var Ob=Object.freeze({brailleChar:Ml,brailleFillPattern:Fl,combineBrailleDots:Zr,scaleValue:it,getChartColor:It,interpolateChartColor:Bl,formatNumber:hn,formatPercentage:eo,calculateTickInterval:ha,generateTicks:An,renderBrailleBar:pr,renderBrailleGradientBar:Dl,renderXAxisLabel:Pl,renderYAxisLabel:In,BRAILLE_BASE:10240,BRAILLE_DOTS:un,CHART_COLORS:br});var Vb=z.object({x:z.number().int().default(0),y:z.number().int().default(0),width:z.number().int().positive().optional(),height:z.number().int().positive().default(1),label:z.string().default(""),checked:z.boolean().default(false),checkedChar:z.string().default("\u2611"),uncheckedChar:z.string().default("\u2610"),focusable:z.boolean().default(true),disabled:z.boolean().default(false)}),fS=1e4,uo={isCheckboxWidget:new Uint8Array(fS)},hr=new Map;function tu(e,r={}){let o=Vb.parse(r),n=h(e);uo.isCheckboxWidget[n]=1,q$3(e,n,o.checked),H$1(e,n,{checkedChar:o.checkedChar,uncheckedChar:o.uncheckedChar});let t=Math.max(o.checkedChar.length,o.uncheckedChar.length),i$1=o.label.length,a=o.width??t+(i$1>0?1+i$1:0);f(e,n,a,o.height),H(e,n,o.x,o.y),hr.set(n,{label:o.label}),lo(e,n),d$3(e,n,{clickable:true,hoverable:true,keyable:true,focusable:o.focusable}),q$1(e,n,{focusable:o.focusable}),o.disabled&&B(e,n);let s$1={eid:n,toggle(){return y(e,n),lo(e,n),M(e,n),s$1},setChecked(l){return l?z$1(e,n):A(e,n),lo(e,n),M(e,n),s$1},isChecked(){return v$2(e,n)},getChar(){return J$1(e,n)},setDisabled(l){return l?B(e,n):C$1(e,n),M(e,n),s$1},isDisabled(){return x(e,n)},setLabel(l){let u=hr.get(n);u&&(u.label=l);let b=J$1(e,n).length+(l.length>0?1+l.length:0);return f(e,n,b,o.height),lo(e,n),M(e,n),s$1},getLabel(){return hr.get(n)?.label??""},setPosition(l,u){return H(e,n,l,u),M(e,n),s$1},move(l,u){return M$1(e,n,l,u),M(e,n),s$1},getPosition(){return {x:G.x[n]??0,y:G.y[n]??0}},focus(){return u(e,n),M(e,n),s$1},blur(){return v$1(e,n),M(e,n),s$1},isFocused(){return s(e,n)},handleKey(l){if(!s(e,n))return false;let u=G$1(e,n,l);return u&&(lo(e,n),M(e,n)),u},onChange(l){return E(e,n,l),s$1},destroy(){uo.isCheckboxWidget[n]=0,hr.delete(n),F(e,n),K(e,n),i(e,n);}};return s$1}function lo(e,r){let o=J$1(e,r),t=hr.get(r)?.label??"",i=t.length>0?`${o} ${t}`:o;e$1(e,r,i);}function nu(e,r){return uo.isCheckboxWidget[r]===1}function ru(){uo.isCheckboxWidget.fill(0),hr.clear();}var _b=Object.freeze({create:tu,is:nu,resetStore:ru});z.object({item:z.object({fg:z.number().int().nonnegative().optional(),bg:z.number().int().nonnegative().optional()}).optional(),selected:z.object({fg:z.number().int().nonnegative().optional(),bg:z.number().int().nonnegative().optional(),prefix:z.string().optional()}).optional(),unselectedPrefix:z.string().optional(),disabledFg:z.number().int().nonnegative().optional()});var zb=z.object({x:z.number().int().default(0),y:z.number().int().default(0),width:z.number().int().positive().default(20),height:z.number().int().positive().default(10),items:z.array(z.string()).default([]),selected:z.number().int().min(-1).default(0),style:z.object({item:z.object({fg:z.number().optional(),bg:z.number().optional()}).optional(),selected:z.object({fg:z.number().optional(),bg:z.number().optional(),prefix:z.string().optional()}).optional(),unselectedPrefix:z.string().optional(),disabledFg:z.number().optional()}).optional(),interactive:z.boolean().default(true),mouse:z.boolean().default(true),keys:z.boolean().default(true),search:z.boolean().default(false),multiSelect:z.boolean().default(false)});function bS(e,r,o){let n={};o.selected?.prefix!==void 0&&(n.selectedPrefix=o.selected.prefix),o.unselectedPrefix!==void 0&&(n.unselectedPrefix=o.unselectedPrefix),o.selected?.fg!==void 0&&(n.selectedFg=o.selected.fg),o.selected?.bg!==void 0&&(n.selectedBg=o.selected.bg),o.item?.fg!==void 0&&(n.itemFg=o.item.fg),o.item?.bg!==void 0&&(n.itemBg=o.item.bg),o.disabledFg!==void 0&&(n.disabledFg=o.disabledFg),ra(e,r,n);}function Rn(e,r,o={}){let n=zb.parse(o),t=r;H(e,t,n.x,n.y),f(e,t,n.width,n.height);let i$1=n.items.map(s=>({text:s,value:s}));ga$1(e,t,i$1,{interactive:n.interactive,mouse:n.mouse,keys:n.keys,search:n.search,selectedIndex:n.selected,visibleCount:n.height}),n.multiSelect&&xa$1(e,t,true),n.style&&bS(e,t,n.style);let a={eid:t,show(){return P(e,t,true),a},hide(){return P(e,t,false),a},move(s,l){return G.x[t]=(G.x[t]??0)+s,G.y[t]=(G.y[t]??0)+l,M(e,t),a},setPosition(s,l){return H(e,t,s,l),a},focus(){return na(e,t),a},blur(){return oa(e,t),a},setItems(s){let l=s.map(u=>({text:u,value:u}));return q$2(e,t,l),a},getItems(){return p(e,t)},addItem(s,l){let u=[...p(e,t)];return u.push({text:s,value:l??s}),q$2(e,t,u),a},removeItem(s){return s$1(e,t,s),a},clearItems(){return w(e,t),a},select(s){return U(e,t,s),a},getSelectedIndex(){return S(e,t)},getSelectedItem(){return T(e,t)},selectPrev(){return V(e,t),a},selectNext(){return W(e,t),a},selectFirst(){return X(e,t),a},selectLast(){return Y(e,t),a},activate(){return $(e,t),a},pageUp(){return C(e,t,-1),a},pageDown(){return C(e,t,1),a},startSearch(){return Na$1(e,t),a},endSearch(){return Oa$1(e,t),a},getSearchQuery(){return Pa$1(e,t)},isSearching(){return Ma$1(e,t)},getState(){return ia(e,t)},onSelect(s){return aa(e,t,s)},onActivate(s){return ba$1(e,t,s)},onCancel(s){return ca$1(e,t,s)},onSearchChange(s){return Wa$1(e,t,s)},getSelected(){return Aa$1(e,t)},selectAll(){return Ba$1(e,t),a},deselectAll(){return Ca$1(e,t),a},setFilter(s){return ua(e,t,s),a},clearFilter(){return va$1(e,t),a},getVisibleItems(){return wa$1(e,t)},handleKey(s){let l=Xa$1(e,t,s);if(l)switch(l.type){case "selectPrev":V(e,t);break;case "selectNext":W(e,t);break;case "selectFirst":X(e,t);break;case "selectLast":Y(e,t);break;case "pageUp":C(e,t,-1);break;case "pageDown":C(e,t,1);break;case "confirm":$(e,t);break;case "cancel":da(e,t),oa(e,t);break;case "toggleSelect":{let u=S(e,t);u>=0&&za$1(e,t,u);break}case "startSearch":Na$1(e,t);break;case "endSearch":Oa$1(e,t);break;case "searchChar":Ra$1(e,t,l.char);break;case "searchBackspace":Sa$1(e,t);break;case "searchNextMatch":Va$1(e,t);break}return l},destroy(){ea(e,t),Ta$1(e,t),i(e,t);}};return a}function ou(e,r){return ha$1(e,r)}var pS=1e4,La={isCommandPalette:new Uint8Array(pS)},yS=z.object({id:z.string(),label:z.string(),description:z.string().optional(),shortcut:z.string().optional(),category:z.string().optional(),handler:z.function().nullable().optional()}),hS=z.object({inputFg:z.union([z.string(),z.number().int().nonnegative()]).optional(),inputBg:z.union([z.string(),z.number().int().nonnegative()]).optional(),listFg:z.union([z.string(),z.number().int().nonnegative()]).optional(),listBg:z.union([z.string(),z.number().int().nonnegative()]).optional(),selectedFg:z.union([z.string(),z.number().int().nonnegative()]).optional(),selectedBg:z.union([z.string(),z.number().int().nonnegative()]).optional(),shortcutFg:z.union([z.string(),z.number().int().nonnegative()]).optional(),descriptionFg:z.union([z.string(),z.number().int().nonnegative()]).optional()}),Ub=z.object({commands:z.array(yS).optional(),placeholder:z.string().optional(),maxResults:z.number().int().positive().optional(),theme:hS.optional(),width:z.number().int().positive().optional(),onClose:z.function().nullable().optional()}),xr=new Map;function iu(){xr.clear(),La.isCommandPalette.fill(0);}function xS(e,r,o){return r.trim()?d$8(r,e,{getText:t=>[t.label,t.description,t.category].filter(Boolean).join(" "),limit:o}).map(t=>({...t.item,match:t})):e.slice(0,o)}function Nb(e){let r=xr.get(e);r&&M(r.world,r.listEntity);}function SS(e){let r=xr.get(e);if(!r||r.filteredCommands.length===0)return;let o=r.filteredCommands[r.selectedIndex];if(o){Gb(e);try{let n=o.handler();n instanceof Promise&&n.catch(t=>{console.error(`Command ${o.id} failed:`,t);});}catch(n){console.error(`Command ${o.id} failed:`,n);}}}function CS(e){let r=xr.get(e);r&&(r.visible=true,P(r.world,e,true),P(r.world,r.inputEntity,true),P(r.world,r.listEntity,true),M(r.world,e));}function Gb(e){let r=xr.get(e);r&&(r.visible=false,P(r.world,e,false),P(r.world,r.inputEntity,false),P(r.world,r.listEntity,false),r.onClose?.(),M(r.world,e));}function TS(e,r,o){if(!o?.inputFg&&!o?.inputBg)return;let n=typeof o.inputFg=="string"?v(o.inputFg):o.inputFg,t=typeof o.inputBg=="string"?v(o.inputBg):o.inputBg;J(e,r,{fg:n,bg:t});}function WS(e,r,o){if(!o?.listFg&&!o?.listBg)return;let n=typeof o.listFg=="string"?v(o.listFg):o.listFg,t=typeof o.listBg=="string"?v(o.listBg):o.listBg;(n!==void 0||t!==void 0)&&J(e,r,{fg:n,bg:t});}function vS(e,r,o,n){let t=h(e);return ft(e,t),H(e,t,1,1),d$1(e,r,t),ka$1(e,t),Ba$2(e,t,{placeholder:o}),TS(e,t,n),t}function LS(e,r,o,n,t){let i=h(e);H(e,i,1,3),d$1(e,r,i);let a={items:[],width:o-2,height:Math.min(n+2,12)};return WS(e,i,t),Rn(e,i,a),i}function au(e,r,o={}){let n=Ub.omit({commands:true,onClose:true}).parse(o),t=o.commands??[],i=n.placeholder??"Type a command...",a=n.maxResults??10,s=n.width??60,l=n.theme;ft(e,r),H(e,r,0,0),P(e,r,false);let u=vS(e,r,i,l),d=LS(e,r,s,a,l),b={world:e,inputEntity:u,listEntity:d,commands:t,filteredCommands:t.slice(0,a),selectedIndex:0,maxResults:a,onClose:o.onClose,visible:false};return xr.set(r,b),Ja$1(e,u,m=>{let c=xS(b.commands,m,b.maxResults);b.filteredCommands=c,b.selectedIndex=0,Nb(r);}),Ka$1(e,u,()=>{SS(r);}),La.isCommandPalette[r]=1,{entity:r,world:e,show(){CS(r);},hide(){Gb(r);},executeCommand(m){let c=b.commands.find(g=>g.id===m);if(c)try{let g=c.handler();g instanceof Promise&&g.catch(p=>{console.error(`Command ${m} failed:`,p);});}catch(g){console.error(`Command ${m} failed:`,g);}},setCommands(m){b.commands=m,b.filteredCommands=m.slice(0,b.maxResults),b.selectedIndex=0,Nb(r);}}}function su(e){return La.isCommandPalette[e]===1}var Hb=Object.freeze({create:au,is:su,resetStore:iu});function ES(e){return e===""?[]:e.split(`
|
|
6
|
+
`)}function Cn(e){return e.join(`
|
|
7
|
+
`)}function Tt(e,r){let o=f$2(e,r);return ES(o)}function lu(e,r){let o=f$2(e,r);if(o==="")return 0;let n=1;for(let t of o)t===`
|
|
8
|
+
`&&n++;return n}function Ea(e,r,o){let n=Tt(e,r);return o<0||o>=n.length?"":n[o]??""}function Ma(e,r,o,n){let t=Tt(e,r);return o<0||o>=t.length||(t[o]=n,e$1(e,r,Cn(t)),M(e,r)),r}function uu(e,r,o){return Ea(e,r,o)}function du(e,r,o,n){return Ma(e,r,o,n)}function co(e,r,o,n){let t=Tt(e,r),i=Math.max(0,Math.min(o,t.length));if(t.splice(i,0,n),e$1(e,r,Cn(t)),M(e,r),Te(e,r)){let a=Ne$1(e,r);i<=a.y&&Me(e,r,a.x,a.y+1);}return r}function Ba(e,r,o){return co(e,r,0,o)}function Pa(e,r,o){let n=Tt(e,r);return co(e,r,n.length,o)}function go(e,r,o,n=1){let t=Tt(e,r);if(o<0||o>=t.length||n<=0)return r;let i=Math.min(n,t.length-o);if(t.splice(o,i),e$1(e,r,Cn(t)),M(e,r),Te(e,r)){let a=Ne$1(e,r),s=Math.max(0,t.length-1),l=a.y;if(o<a.y){let u=Math.min(i,a.y-o);l=a.y-u;}l=Math.max(0,Math.min(l,s)),Me(e,r,a.x,l);}return r}function cu(e,r,o=1){return go(e,r,0,o)}function gu(e,r,o=1){let n=Tt(e,r);if(n.length===0)return r;let t=Math.max(0,n.length-o);return go(e,r,t,o)}function mu(e,r){return e$1(e,r,""),M(e,r),Te(e,r)&&Me(e,r,0,0),r}function fu(e,r,o){if(e$1(e,r,Cn(o)),M(e,r),Te(e,r)){let n=Ne$1(e,r),t=Math.max(0,o.length-1);n.y>t&&Me(e,r,n.x,t);}return r}function bu(e,r,o){return Pa(e,r,o)}function pu(e,r){let o=Tt(e,r);if(o.length===0)return "";let n=o.pop()??"";if(e$1(e,r,Cn(o)),M(e,r),Te(e,r)){let t=Ne$1(e,r),i=Math.max(0,o.length-1);t.y>i&&Me(e,r,t.x,i);}return n}function yu(e,r){let o=Tt(e,r);if(o.length===0)return "";let n=o.shift()??"";if(e$1(e,r,Cn(o)),M(e,r),Te(e,r)){let t=Ne$1(e,r);t.y>0&&Me(e,r,t.x,t.y-1);}return n}function hu(e,r,o){return Ba(e,r,o)}function xu(e,r,o,n){let t=Tt(e,r);if(o<0||o>=t.length)return r;for(let i=0;i<n.length;i++){let a=o+i;if(a>=t.length)break;t[a]=n[i]??"";}return e$1(e,r,Cn(t)),M(e,r),r}function Su(e,r,o,n,t){let i=Tt(e,r),a=t?i.splice(o,n,...t):i.splice(o,n);if(e$1(e,r,Cn(i)),M(e,r),Te(e,r)){let s=(t?.length??0)-a.length,l=Ne$1(e,r);if(o<=l.y&&s!==0){let u=Math.max(0,l.y+s),d=Math.max(0,i.length-1);Me(e,r,l.x,Math.min(u,d));}else {let u=Math.max(0,i.length-1);l.y>u&&Me(e,r,l.x,u);}}return a}var wb=Object.freeze({pushLine:bu,popLine:pu,shiftLine:yu,unshiftLine:hu,insertLine:co,deleteLine:go,insertTop:Ba,insertBottom:Pa,deleteTop:cu,deleteBottom:gu,getLine:Ea,getLineCount:lu,setLine:Ma,getLines:Tt,setLines:fu,clearLines:mu,replaceLines:xu,spliceLines:Su,getBaseLine:uu,setBaseLine:du});var mo=new Map;function Cu(e,r){let o=h(e),n=r.termWidth??80,t=r.termHeight??24,i=r.items.map(p=>p.separator?3:p.label?.length??0),a=i.length>0?Math.max(...i):0,s=Math.min(a+4,40),l=r.items.length+2,u=r.x,d=r.y;u+s>n&&(u=Math.max(0,n-s)),d+l>t&&(d=Math.max(0,t-l)),l$1(e,o,G),G.x[o]=u,G.y[o]=d,l$1(e,o,e$3),e$3.width[o]=s,e$3.height[o]=l;let b=[],m=1;for(let p of r.items){let h$1=h(e);l$1(e,h$1,G),G.x[h$1]=u+2,G.y[h$1]=d+m,l$1(e,h$1,d$4);let E=p.separator?"---":p.label;h$2(e,h$1,E),!p.separator&&!p.disabled&&(q$1(e,h$1,{focusable:true}),b$1(e,h$1,"menuitem"),d$5(e,h$1,p.label)),b.push(h$1),m++;}let c=Math.max(0,r.items.findIndex(p=>!p.separator&&!p.disabled)),g={items:r.items,itemEntities:b,selectedIndex:c,containerEntity:o};return mo.set(o,g),b$1(e,o,"menu"),q$1(e,o,{focusable:true}),o}function Tu(e,r,o){let n=mo.get(r);return n?o==="up"||o==="k"?(jb(e,n,-1),true):o==="down"||o==="j"?(jb(e,n,1),true):o==="enter"?(MS(e,n),true):o==="escape"?(BS(e,r),true):false:false}function jb(e,r,o){let n=[];for(let s=0;s<r.items.length;s++){let l=r.items[s];l&&!l.separator&&!l.disabled&&n.push(s);}if(n.length===0)return;let t=n.indexOf(r.selectedIndex),i;t===-1?i=o>=0?0:n.length-1:(i=t+o,i<0&&(i=n.length-1),i>=n.length&&(i=0));let a=n[i];a!==void 0&&(r.selectedIndex=a);}function MS(e,r){let o=r.items[r.selectedIndex];o&&!o.separator&&!o.disabled&&o.action&&o.action();}function BS(e,r){let o=mo.get(r);if(o){for(let n of o.itemEntities)i(e,n);i(e,o.containerEntity),mo.delete(r);}}function Wu(e){return mo.get(e)?.selectedIndex??0}var $b=Object.freeze({create:Cu,getSelectedIndex:Wu,handleKey:Tu});var Lu="top",Da=" \u2502 ",Aa="\u2715",Yb=z.union([z.number(),z.string().regex(/^\d+(\.\d+)?%$/,'Percentage must be in format "50%"'),z.enum(["center","left","right","top","bottom"])]),Kb=z.union([z.number(),z.string().regex(/^\d+(\.\d+)?%$/,'Percentage must be in format "50%"'),z.literal("auto")]),PS=z.object({label:z.string(),content:z.union([z.number(),z.function()]).optional(),closable:z.boolean().optional()}),FS=z.object({activeFg:z.union([z.string(),z.number()]).optional(),activeBg:z.union([z.string(),z.number()]).optional(),inactiveFg:z.union([z.string(),z.number()]).optional(),inactiveBg:z.union([z.string(),z.number()]).optional()}),DS=z.object({fg:z.union([z.string(),z.number()]).optional(),bg:z.union([z.string(),z.number()]).optional()}),AS=z.object({type:z.enum(["line","bg","none"]).optional(),fg:z.union([z.string(),z.number()]).optional(),bg:z.union([z.string(),z.number()]).optional(),ch:z.union([z.enum(["single","double","rounded","bold","ascii"]),z.object({}).passthrough()]).optional()}),IS=z.object({tab:FS.optional(),content:DS.optional(),border:AS.optional()}),Jb=z.object({left:Yb.optional(),top:Yb.optional(),width:Kb.optional(),height:Kb.optional(),tabs:z.array(PS).optional(),activeTab:z.number().nonnegative().optional(),position:z.enum(["top","bottom"]).optional(),fg:z.union([z.string(),z.number()]).optional(),bg:z.union([z.string(),z.number()]).optional(),style:IS.optional()}),Fa=1e4,ce={isTabs:new Uint8Array(Fa),activeTab:new Uint16Array(Fa),position:new Uint8Array(Fa),tabCount:new Uint16Array(Fa)},kt=m({iterable:true});function kS(e){return {label:e.label,contentEntity:typeof e.content=="number"?e.content:null,lazyLoader:typeof e.content=="function"?e.content:null,closable:e.closable??false,loaded:typeof e.content=="number"}}function RS(e,r){let o=r?r.map(kS):[];return kt.set(e,o),o}function Qb(e){return e===void 0?0:typeof e=="number"?e:0}function qb(e){return e===void 0||typeof e=="string"&&e==="auto"?"auto":e}function OS(e,r){if(e==="Tab"||e==="right")return r.nextTab(),{type:"next"};if(e==="S-Tab"||e==="left")return r.prevTab(),{type:"prev"};if(e>="1"&&e<="9"){let o=Number.parseInt(e,10)-1,n=r.getTabCount();if(o<n)return r.setActiveTab(o),{type:"goto",index:o}}return null}function VS(e,r,o){(o.fg!==void 0||o.bg!==void 0)&&J(e,r,{fg:o.fg!==void 0?v(o.fg):void 0,bg:o.bg!==void 0?v(o.bg):void 0});}function _S(e,r,o){let n=o.style?.border;n?.type!=="none"&&l(e,r,{type:n?.type==="bg"?2:1,fg:n?.fg!==void 0?v(n.fg):void 0,bg:n?.bg!==void 0?v(n.bg):void 0});}function Xb(e,r,o){let n=kt.get(r);if(!n||o<0||o>=n.length)return;let t=n[o];t&&!t.loaded&&t.lazyLoader&&(t.contentEntity=t.lazyLoader(),t.loaded=true,t.contentEntity!==null&&d$1(e,r,t.contentEntity));}function vu(e,r){let o=kt.get(r);if(!o)return;let n=ce.activeTab[r];for(let t=0;t<o.length;t++){let i=o[t];i?.contentEntity!==null&&i?.contentEntity!==void 0&&P(e,i.contentEntity,t===n);}}function On(e,r,o={}){let n=Jb.parse(o),t=r;ce.isTabs[t]=1,ce.position[t]=n.position==="bottom"?1:0;let i$1=RS(t,n.tabs);ce.tabCount[t]=i$1.length;let a=Math.min(n.activeTab??0,Math.max(0,i$1.length-1));ce.activeTab[t]=a,H(e,t,Qb(n.left),Qb(n.top)),f(e,t,qb(n.width),qb(n.height)),VS(e,t,n),_S(e,t,n),q$1(e,t,{focusable:true}),P(e,t,true),i$1.length>0&&(Xb(e,t,a),vu(e,t));let s$1={eid:t,show(){return P(e,t,true),s$1},hide(){return P(e,t,false),s$1},move(l,u){return M$1(e,t,l,u),M(e,t),s$1},setPosition(l,u){return H(e,t,l,u),M(e,t),s$1},addTab(l){let u=kt.get(t)??[],d={label:l.label,contentEntity:typeof l.content=="number"?l.content:null,lazyLoader:typeof l.content=="function"?l.content:null,closable:l.closable??false,loaded:typeof l.content=="number"};return u.push(d),kt.set(t,u),ce.tabCount[t]=u.length,M(e,t),s$1},removeTab(l){let u=kt.get(t);return !u||l<0||l>=u.length||(u.splice(l,1),ce.tabCount[t]=u.length,ce.activeTab[t]>=u.length&&u.length>0?ce.activeTab[t]=u.length-1:u.length===0&&(ce.activeTab[t]=0),vu(e,t),M(e,t)),s$1},getActiveTab(){return ce.activeTab[t]},setActiveTab(l){let u=kt.get(t);return !u||l<0||l>=u.length||(ce.activeTab[t]=l,Xb(e,t,l),vu(e,t),M(e,t)),s$1},getTabCount(){return ce.tabCount[t]},getTab(l){let u=kt.get(t);if(!(!u||l<0||l>=u.length))return u[l]},setTabLabel(l,u){let d=kt.get(t);if(!d||l<0||l>=d.length)return s$1;let b=d[l];return b&&(b.label=u),M(e,t),s$1},nextTab(){let l=ce.tabCount[t];if(l===0)return s$1;let d=(ce.activeTab[t]+1)%l;return s$1.setActiveTab(d)},prevTab(){let l=ce.tabCount[t];if(l===0)return s$1;let u=ce.activeTab[t],d=u===0?l-1:u-1;return s$1.setActiveTab(d)},focus(){return u(e,t),s$1},blur(){return v$1(e,t),s$1},isFocused(){return s(e,t)},getChildren(){return f$1(e,t)},handleKey(l){return s$1.isFocused()?OS(l,s$1):null},destroy(){ce.isTabs[t]=0,ce.activeTab[t]=0,ce.position[t]=0,ce.tabCount[t]=0,kt.delete(t),i(e,t);}};return s$1}function Eu(e,r){return ce.isTabs[r]===1}function Mu(e,r){return ce.activeTab[r]}function Bu(e,r){return ce.tabCount[r]}function Pu(e,r){return ce.position[r]===1?"bottom":"top"}function Fu(e,r,o){let n=kt.get(r);if(!n||n.length===0)return " ".repeat(o);let t=ce.activeTab[r],i="";for(let a=0;a<n.length;a++){let s=n[a];if(!s)continue;a>0&&(i+=Da);let l=a===t?`[${s.label}]`:` ${s.label} `,u=s.closable?` ${Aa}`:"";i+=l+u;}return i.length>o?i=`${i.slice(0,o-1)}\u2026`:i.length<o&&(i=i+" ".repeat(o-i.length)),i}function Du(){ce.isTabs.fill(0),ce.activeTab.fill(0),ce.position.fill(0),ce.tabCount.fill(0),kt.clear();}var zS=1e4,Au={isDevTools:new Uint8Array(zS)},ep=z.object({position:z.enum(["bottom","right","floating"]).optional().default("bottom"),initialTab:z.enum(["entities","components","systems","events"]).optional().default("entities"),theme:z.object({fg:z.union([z.string(),z.number()]).optional(),bg:z.union([z.string(),z.number()]).optional(),borderFg:z.union([z.string(),z.number()]).optional(),borderBg:z.union([z.string(),z.number()]).optional(),tabActiveFg:z.union([z.string(),z.number()]).optional(),tabActiveBg:z.union([z.string(),z.number()]).optional(),tabInactiveFg:z.union([z.string(),z.number()]).optional(),tabInactiveBg:z.union([z.string(),z.number()]).optional()}).optional(),left:z.number().optional(),top:z.number().optional(),width:z.number().int().positive().optional(),height:z.number().int().positive().optional(),scheduler:z.any().optional()}),Ne=new Map;function NS(e,r){let t={left:0,top:0,width:80,height:8};switch(e){case "bottom":t={left:0,top:Math.floor(48/3),width:80,height:Math.floor(24/3)};break;case "right":t={left:Math.floor(160/3),top:0,width:Math.floor(80/3),height:24};break;case "floating":t={left:Math.floor(80/4),top:Math.floor(24/4),width:Math.floor(80/2),height:Math.floor(24/2)};break}return {left:r.left??t.left,top:r.top??t.top,width:r.width??t.width,height:r.height??t.height}}function Ia(e,r){let o=k(e),n=[];for(let t of o){if(!j$1(e,t))continue;let i=[],a={eid:t,components:i};r&&!i.some(l=>l.name.toLowerCase().includes(r.toLowerCase()))||n.push(a);}return n}function Zb(e){if(!e)return [];let r=[0,1,2,3,4,5,6,7],o=e.getTelemetry();return r.map(n=>{let t=e.getSystemCount(n),i=o?.phases.find(s=>s.phase===n),a={phase:n,systemCount:t};return i?.duration!==void 0&&(a.frameTime=i.duration),a})}function US(e){let r={};return e.left!==void 0&&(r.left=e.left),e.top!==void 0&&(r.top=e.top),e.width!==void 0&&(r.width=e.width),e.height!==void 0&&(r.height=e.height),r}function GS(e,r,o){if(!o)return;let n=o.fg?v(o.fg):void 0,t=o.bg?v(o.bg):void 0;(n!==void 0||t!==void 0)&&J(e,r,{fg:n,bg:t});}function HS(e){if(!e)return;let r={};return (e.tabActiveFg!==void 0||e.tabActiveBg!==void 0||e.tabInactiveFg!==void 0||e.tabInactiveBg!==void 0)&&(r.tab={...e.tabActiveFg!==void 0&&{activeFg:e.tabActiveFg},...e.tabActiveBg!==void 0&&{activeBg:e.tabActiveBg},...e.tabInactiveFg!==void 0&&{inactiveFg:e.tabInactiveFg},...e.tabInactiveBg!==void 0&&{inactiveBg:e.tabInactiveBg}}),(e.borderFg!==void 0||e.borderBg!==void 0)&&(r.border={...e.borderFg!==void 0&&{fg:e.borderFg},...e.borderBg!==void 0&&{bg:e.borderBg}}),r}function Iu(e,r,o={}){let n=ep.parse(o),t=r;Au.isDevTools[t]=1;let i$1=US(n),a=NS(n.position,i$1);H(e,t,a.left,a.top),f(e,t,a.width,a.height),q$1(e,t,{focusable:true}),GS(e,t,n.theme);let s=h(e);d$1(e,t,s);let l=HS(n.theme),u$1={left:0,top:0,width:a.width,height:a.height,tabs:[{label:"Entities",content:h(e)},{label:"Components",content:h(e)},{label:"Systems",content:h(e)},{label:"Events",content:h(e)}],activeTab:["entities","components","systems","events"].indexOf(n.initialTab)};l&&(u$1.style=l);let d=On(e,s,u$1),b={world:e,tabsWidget:d,currentTab:n.initialTab,visible:false,entities:[],systems:[],eventLog:[],filter:null,scheduler:n.scheduler??null};b.entities=Ia(e,null),b.systems=Zb(b.scheduler),Ne.set(t,b),P(e,t,false);let m={eid:t,show(){let c=Ne.get(t);return c&&(c.visible=true,P(e,t,true),M(e,t)),m},hide(){let c=Ne.get(t);return c&&(c.visible=false,P(e,t,false),M(e,t)),m},toggle(){let c=Ne.get(t);return c&&(c.visible?m.hide():m.show()),m},isVisible(){return Ne.get(t)?.visible??false},focus(){return u(e,t),m},blur(){return v$1(e,t),m},setTab(c){let g=Ne.get(t);if(g){g.currentTab=c;let p=["entities","components","systems","events"].indexOf(c);g.tabsWidget.setActiveTab(p),M(e,t);}return m},getTab(){return Ne.get(t)?.currentTab??"entities"},refreshEntities(){let c=Ne.get(t);return c&&(c.entities=Ia(c.world,c.filter),M(e,t)),m},getEntities(){return Ne.get(t)?.entities??[]},getEntity(c){return Ne.get(t)?.entities.find(p=>p.eid===c)},getSystems(){return Ne.get(t)?.systems??[]},refreshSystems(){let c=Ne.get(t);return c&&(c.systems=Zb(c.scheduler),M(e,t)),m},logEvent(c,g){let p=Ne.get(t);return p&&(p.eventLog.push({timestamp:Date.now(),type:c,data:g}),p.eventLog.length>100&&(p.eventLog=p.eventLog.slice(-100)),M(e,t)),m},getEventLog(){return Ne.get(t)?.eventLog??[]},clearEventLog(){let c=Ne.get(t);return c&&(c.eventLog=[],M(e,t)),m},filterByComponent(c){let g=Ne.get(t);return g&&(g.filter=c,g.entities=Ia(g.world,c),M(e,t)),m},clearFilter(){let c=Ne.get(t);return c&&(c.filter=null,c.entities=Ia(c.world,null),M(e,t)),m},destroy(){let c=Ne.get(t);c&&c.tabsWidget.destroy(),Ne.delete(t),i(e,t);}};return m}function ku(e,r){return Au.isDevTools[r]===1}function Ru(){Ne.clear();}var tp=Object.freeze({create:Iu,is:ku,resetStore:Ru});var np=1e4,KS=40,QS=20,qS="\u{1F4C1}",XS="\u{1F4C4}",JS="\u2B06\uFE0F",ZS="..",eC=z.object({type:z.enum(["line","bg","none"]).optional(),fg:z.union([z.string(),z.number()]).optional(),bg:z.union([z.string(),z.number()]).optional(),ch:z.union([z.enum(["single","double","rounded","bold","ascii"]),z.object({}).passthrough()]).optional()}),tC=z.union([z.number().nonnegative(),z.object({left:z.number().nonnegative().optional(),top:z.number().nonnegative().optional(),right:z.number().nonnegative().optional(),bottom:z.number().nonnegative().optional()})]),op=z.object({cwd:z.string().optional(),showHidden:z.boolean().optional().default(false),filePattern:z.string().optional(),sortBy:z.enum(["name","size","date"]).optional().default("name"),width:z.number().int().positive().optional(),height:z.number().int().positive().optional(),left:z.number().int().optional(),top:z.number().int().optional(),fg:z.union([z.string(),z.number()]).optional(),bg:z.union([z.string(),z.number()]).optional(),border:eC.optional(),padding:tC.optional(),showIcons:z.boolean().optional().default(true)}),Le={isFileManager:new Uint8Array(np),selectedIndex:new Uint32Array(np)},Ve=new Map;function nC(e){return typeof e=="object"?e:e===void 0||e==="single"?b:b}function rC(e,r){let n=r.replace(/[.+^${}()|[\]\\]/g,"\\$&").replace(/\*/g,".*");return new RegExp(`^${n}$`,"i").test(e)}function oC(e){try{let r=readdirSync(e),o=[];for(let n of r){let t=join(e,n);try{let i=statSync(t);o.push({name:n,path:t,isDirectory:i.isDirectory(),size:i.isDirectory()?0:i.size,mtime:i.mtimeMs});}catch{}}return o}catch{return []}}function iC(e,r){return [...e].sort((o,n)=>{if(o.isDirectory!==n.isDirectory)return o.isDirectory?-1:1;switch(r){case "size":return o.size!==n.size?n.size-o.size:o.name.localeCompare(n.name);case "date":return o.mtime!==n.mtime?n.mtime-o.mtime:o.name.localeCompare(n.name);default:return o.name.localeCompare(n.name)}})}function aC(e,r,o){return e.filter(n=>!(!r&&n.name.startsWith(".")||o&&!n.isDirectory&&!rC(n.name,o)))}function Tn(e){let r;try{r=e.readDirFn(e.cwd);}catch{return []}let o=aC(r,e.showHidden,e.filePattern);return iC(o,e.sortBy)}function sC(e){let r=[],o=e.width-4,n=e.cwd;n.length>o&&(n=`...${n.slice(-(o-3))}`),r.push(`[${n}]`);let t=Le.selectedIndex[0]===-1?"> ":" ",i=e.showIcons?`${JS} `:"";r.push(`${t}${i}${ZS}`);for(let a=0;a<e.entries.length;a++){let s=e.entries[a],u=a===Le.selectedIndex[0]?"> ":" ",d=e.showIcons?s.isDirectory?`${qS} `:`${XS} `:"";r.push(`${u}${d}${s.name}`);}return r.join(`
|
|
9
|
+
`)}function lC(e,r,o,n){o===void 0&&n===void 0||J(e,r,{fg:o!==void 0?v(o):void 0,bg:n!==void 0?v(n):void 0});}function uC(e,r,o){if(o?.type==="none")return;let n=o?.type==="bg"?2:1;l(e,r,{type:n,fg:o?.fg!==void 0?v(o.fg):void 0,bg:o?.bg!==void 0?v(o.bg):void 0}),m$1(e,r,nC(o?.ch));}function dC(e,r,o){if(typeof o=="number"){d(e,r,{left:o,top:o,right:o,bottom:o});return}o&&d(e,r,{left:o.left??0,top:o.top??0,right:o.right??0,bottom:o.bottom??0});}function Jt(e,r,o){let n=sC(o);e$1(e,r,n,{align:0,valign:0}),M(e,r);}function Vu(e,r={}){let o=op.parse(r),n=h(e),t=o.width??KS,i=o.height??QS,a=o.cwd?resolve(o.cwd):process.cwd();Le.isFileManager[n]=1,Le.selectedIndex[n]=0;let s={cwd:a,showHidden:o.showHidden,showIcons:o.showIcons,filePattern:o.filePattern,sortBy:o.sortBy,width:t,height:i,entries:[],onSelectCallbacks:[],onNavigateCallbacks:[],onDeleteCallbacks:[],onRenameCallbacks:[],readDirFn:oC};return Ve.set(n,s),s.entries=Tn(s),H(e,n,o.left??0,o.top??0),f(e,n,t,i),lC(e,n,o.fg,o.bg),uC(e,n,o.border),dC(e,n,o.padding),Jt(e,n,s),P(e,n,true),cC(e,n)}function cC(e,r){let o={eid:r,show(){return P(e,r,true),M(e,r),o},hide(){return P(e,r,false),M(e,r),o},move(n,t){return M$1(e,r,n,t),M(e,r),o},setPosition(n,t){return H(e,r,n,t),M(e,r),o},center(n,t){let i=Ve.get(r);if(!i)return o;let a=Math.max(0,Math.floor((n-i.width)/2)),s=Math.max(0,Math.floor((t-i.height)/2));return H(e,r,a,s),M(e,r),o},setCwd(n){let t=Ve.get(r);return t&&(t.cwd=resolve(n),t.entries=Tn(t),Le.selectedIndex[r]=0,Jt(e,r,t)),o},getCwd(){return Ve.get(r)?.cwd??""},getSelected(){let n=Ve.get(r);if(!n)return;let t=Le.selectedIndex[r]??0;return n.entries[t]},refresh(){let n=Ve.get(r);if(!n)return o;n.entries=Tn(n);let t=Math.max(0,n.entries.length-1);return (Le.selectedIndex[r]??0)>t&&(Le.selectedIndex[r]=t),Jt(e,r,n),o},getEntries(){return Ve.get(r)?.entries??[]},setSortBy(n){let t=Ve.get(r);return t&&(t.sortBy=n,t.entries=Tn(t),Jt(e,r,t)),o},getSortBy(){return Ve.get(r)?.sortBy??"name"},toggleHidden(){let n=Ve.get(r);return n&&(n.showHidden=!n.showHidden,n.entries=Tn(n),Le.selectedIndex[r]=0,Jt(e,r,n)),o},onSelect(n){let t=Ve.get(r);return t&&t.onSelectCallbacks.push(n),o},onNavigate(n){let t=Ve.get(r);return t&&t.onNavigateCallbacks.push(n),o},onDelete(n){let t=Ve.get(r);return t&&t.onDeleteCallbacks.push(n),o},onRename(n){let t=Ve.get(r);return t&&t.onRenameCallbacks.push(n),o},destroy(){Le.isFileManager[r]=0,Le.selectedIndex[r]=0,Ve.delete(r),i(e,r);}};return o}function gC(e,r,o){let n=Le.selectedIndex[r]??0,t=o.entries[n];if(t)if(t.isDirectory)ip(e,r,o,t.path);else for(let i of o.onSelectCallbacks)i(t);}function ip(e,r,o,n){o.cwd=n,o.entries=Tn(o),Le.selectedIndex[r]=0,Jt(e,r,o);for(let t of o.onNavigateCallbacks)t(n);}function mC(e,r,o){let n=Le.selectedIndex[r]??0;n>0&&(Le.selectedIndex[r]=n-1,Jt(e,r,o));}function fC(e,r,o){let n=Le.selectedIndex[r]??0;n<o.entries.length-1&&(Le.selectedIndex[r]=n+1,Jt(e,r,o));}function bC(e,r,o){let n=dirname(o.cwd);n!==o.cwd&&ip(e,r,o,n);}function pC(e,r,o){o.showHidden=!o.showHidden,o.entries=Tn(o),Le.selectedIndex[r]=0,Jt(e,r,o);}function yC(e,r){let o=Le.selectedIndex[e]??0,n=r.entries[o];if(n)for(let t of r.onDeleteCallbacks)t(n);}function hC(e,r){let o=Le.selectedIndex[e]??0,n=r.entries[o];if(n)for(let t of r.onRenameCallbacks)t(n,n.name);}function Ou(e,r,o,n){o.sortBy=n,o.entries=Tn(o),Jt(e,r,o);}function _u(e,r,o){if(Le.isFileManager[r]!==1)return false;let n=Ve.get(r);if(!n)return false;switch(o){case "up":return mC(e,r,n),true;case "down":return fC(e,r,n),true;case "enter":return gC(e,r,n),true;case "backspace":return bC(e,r,n),true;case "h":return pC(e,r,n),true;case "d":return yC(r,n),true;case "r":return hC(r,n),true;case "n":return Ou(e,r,n,"name"),true;case "s":return Ou(e,r,n,"size"),true;case "t":return Ou(e,r,n,"date"),true;default:return false}}function zu(e,r){return Le.isFileManager[r]===1}function Nu(){Le.isFileManager.fill(0),Le.selectedIndex.fill(0),Ve.clear();}function Uu(e,r){let o=Ve.get(e);o&&(o.readDirFn=r);}var ap=Object.freeze({create:Vu,is:zu,handleKey:_u,setReadDirFn:Uu,stateMap:Ve,resetStore:Nu});var xC=1e4,Hu={isFlexContainer:new Uint8Array(xC)},sp=z.object({flex:z.number().nonnegative().optional().default(0),flexShrink:z.number().nonnegative().optional().default(1),flexBasis:z.union([z.number().nonnegative(),z.literal("auto")]).optional().default("auto"),alignSelf:z.enum(["start","center","end","stretch"]).optional()}),lp=z.object({direction:z.enum(["row","column"]).optional().default("row"),justifyContent:z.enum(["start","center","end","space-between","space-around","space-evenly"]).optional().default("start"),alignItems:z.enum(["start","center","end","stretch"]).optional().default("stretch"),gap:z.number().nonnegative().optional().default(0),wrap:z.enum(["nowrap","wrap"]).optional().default("nowrap"),left:z.number().optional().default(0),top:z.number().optional().default(0),width:z.union([z.number(),z.string()]).optional().default("auto"),height:z.union([z.number(),z.string()]).optional().default("auto"),fg:z.union([z.string(),z.number()]).optional(),bg:z.union([z.string(),z.number()]).optional()}),Wt=new Map;function SC(e,r,o,n,t,i,a,s){let l=r.entity,u=wu(e,l,s);s?(H(e,l,o.x+n,o.y+i+a),f(e,l,t,u)):(H(e,l,o.x+a,o.y+i+n),f(e,l,u,t)),M(e,l);}function CC(e,r,o){let n=g(e,r),t=I(e,r);if(!n||!t)return;let i=n.width,a=n.height,s=o.children;if(s.length===0)return;let l=o.direction==="row",u=l?i:a,d=TC(e,s,u,o.gap,l,o.wrap),b=0;for(let m of d){let c=m.mainSize,g=m.crossSize,{positions:p,sizes:h}=MC(m.children,u,c,o.gap,o.justifyContent);for(let E=0;E<m.children.length;E++){let C=m.children[E];if(!C)continue;let M=p[E]??0,P=h[E]??0,I=C.alignSelf??o.alignItems,L=wu(e,C.entity,l),_=BC(I,g,L);SC(e,C,t,M,P,b,_,l);}b+=g+o.gap;}}function TC(e,r,o,n,t,i){if(i==="nowrap"){let u=WC(e,r,n,t),d=Gu(e,r,t);return [{children:r,mainSize:u,crossSize:d}]}let a=[],s=[],l=0;for(let u of r){let d=up(e,u.entity,t,u.flexBasis),b=s.length===0?d:n+d;s.length>0&&l+b>o?(a.push({children:s,mainSize:l-n,crossSize:Gu(e,s,t)}),s=[u],l=d):(s.push(u),l+=b);}return s.length>0&&a.push({children:s,mainSize:l-(s.length>0?n:0),crossSize:Gu(e,s,t)}),a}function WC(e,r,o,n){let t=0;for(let i=0;i<r.length;i++){let a=r[i];a&&(i>0&&(t+=o),t+=up(e,a.entity,n,a.flexBasis));}return t}function Gu(e,r,o){let n=0;for(let t of r){let i=wu(e,t.entity,o);n=Math.max(n,i);}return n}function up(e,r,o,n){if(n!=="auto")return n;let t=g(e,r);return t?o?t.width:t.height:0}function wu(e,r,o){let n=g(e,r);return n?o?n.height:n.width:0}function vC(e,r,o){let n=0,t=0;for(let s of e)n+=s.flex,t+=s.flexShrink;let i=r-o,a=[];for(let s of e){let l=0;s.flexBasis==="auto"?l=10:l=s.flexBasis,i>0&&n>0?l+=i*s.flex/n:i<0&&t>0&&(l+=i*s.flexShrink/t),a.push(Math.max(0,l));}return a}function LC(e,r,o){switch(e){case "start":return 0;case "center":return r/2;case "end":return r;case "space-between":return 0;case "space-around":return r/(o*2);case "space-evenly":return r/(o+1)}}function EC(e,r,o,n,t){return e==="space-between"&&t>1?r+o+n/(t-1):e==="space-around"?r+o+n/t:e==="space-evenly"?r+o+n/(t+1):r+o}function MC(e,r,o,n,t){let i=[],a=[];if(e.length===0)return {positions:i,sizes:a};let s=n*(e.length-1),l=r-s,u=vC(e,l,o),d=u.reduce((c,g)=>c+g,0)+s,b=r-d,m=LC(t,b,e.length);for(let c=0;c<e.length;c++){let g=u[c]??0;i.push(m),a.push(g),m+=EC(t,g,n,b,e.length);}return {positions:i,sizes:a}}function BC(e,r,o){switch(e){case "start":return 0;case "center":return (r-o)/2;case "end":return r-o;case "stretch":return 0}}function ju(e,r,o={}){let n=lp.parse(o),t=r;Hu.isFlexContainer[t]=1,H(e,t,n.left,n.top),f(e,t,n.width,n.height),q$1(e,t,{focusable:true});let i$1=n.fg?v(n.fg):void 0,a=n.bg?v(n.bg):void 0;(i$1!==void 0||a!==void 0)&&J(e,t,{fg:i$1,bg:a});let s$1={direction:n.direction,justifyContent:n.justifyContent,alignItems:n.alignItems,gap:n.gap,wrap:n.wrap,children:[]};Wt.set(t,s$1);let l={eid:t,show(){return P(e,t,true),M(e,t),l},hide(){return P(e,t,false),M(e,t),l},move(u,d){return M$1(e,t,u,d),M(e,t),l},setPosition(u,d){return H(e,t,u,d),M(e,t),l},addChild(u,d={}){let b=Wt.get(t);if(!b)return l;let m=sp.parse(d),c=i$2(e,u);return c!==a$1?(console.warn(`Child entity ${u} is already attached to parent ${c}`),l):(d$1(e,t,u),b.children.push({entity:u,flex:m.flex,flexShrink:m.flexShrink,flexBasis:m.flexBasis,alignSelf:m.alignSelf}),M(e,t),l)},removeChild(u){let d=Wt.get(t);if(!d)return l;let b=d.children.findIndex(m=>m.entity===u);return b!==-1&&(d.children.splice(b,1),M(e,t)),l},getChildren(){return Wt.get(t)?.children.map(d=>d.entity)??[]},setDirection(u){let d=Wt.get(t);return d&&(d.direction=u,M(e,t)),l},setJustifyContent(u){let d=Wt.get(t);return d&&(d.justifyContent=u,M(e,t)),l},setAlignItems(u){let d=Wt.get(t);return d&&(d.alignItems=u,M(e,t)),l},setGap(u){let d=Wt.get(t);return d&&(d.gap=u,M(e,t)),l},setWrap(u){let d=Wt.get(t);return d&&(d.wrap=u,M(e,t)),l},layout(){let u=Wt.get(t);return u&&CC(e,t,u),l},focus(){return u(e,t),l},blur(){return v$1(e,t),l},isFocused(){return s(e,t)},destroy(){Wt.delete(t),i(e,t);}};return l}function $u(e,r,o,n={}){let t=Wt.get(r);if(!t){console.warn(`Entity ${r} is not a flex container`);return}let i=sp.parse(n),a=i$2(e,o);if(a!==a$1&&a!==r){console.warn(`Child entity ${o} is already attached to parent ${a}`);return}d$1(e,r,o),t.children.push({entity:o,flex:i.flex,flexShrink:i.flexShrink,flexBasis:i.flexBasis,alignSelf:i.alignSelf}),M(e,r);}function Yu(e,r){return Hu.isFlexContainer[r]===1}function Ku(){Wt.clear();}var dp=Object.freeze({createContainer:ju,addChild:$u,isContainer:Yu,resetStore:Ku});var cp=Object.freeze({load:d$6,getCharBitmap:f$5,renderChar:g$2,createFontNotFoundError:c$1});var PC=1e4,gp={isFooter:new Uint8Array(PC)},mp=z.object({status:z.string().optional().default(""),left:z.string().optional(),center:z.string().optional(),right:z.string().optional(),height:z.number().int().positive().optional().default(1),fg:z.union([z.string(),z.number()]).optional(),bg:z.union([z.string(),z.number()]).optional(),align:z.enum(["left","center","right"]).optional().default("left")}),Sr=new Map;function fo(e,r,o){let{left:n,center:t,right:i,status:a}=e;if(n||t||i){let s=n||"",l=t||"",u=i||"",d=s.length,b=l.length,m=u.length,c=d+b+m;if(r-c>=2){let p=Math.floor((r-b)/2),h=Math.max(0,p-d),E=p+b,C=Math.max(0,r-E-m);return s+" ".repeat(h)+l+" ".repeat(C)+u}return `${s} ${l} ${u}`.slice(0,r)}if(a){if(o==="center"){let s=Math.max(0,Math.floor((r-a.length)/2));return " ".repeat(s)+a}if(o==="right"){let s=Math.max(0,r-a.length);return " ".repeat(s)+a}return a}return ""}function Qu(e,r,o={}){let n=mp.parse(o),t=r;gp.isFooter[t]=1,H(e,t,0,0),f(e,t,"auto",n.height);let i$1=n.fg?v(n.fg):void 0,a=n.bg?v(n.bg):void 0;(i$1!==void 0||a!==void 0)&&J(e,t,{fg:i$1,bg:a});let s={status:n.status,left:n.left||"",center:n.center||"",right:n.right||""};Sr.set(t,s);let l=80,u=fo(s,l,n.align);e$1(e,t,u,{align:0});let d={eid:t,show(){return P(e,t,true),M(e,t),d},hide(){return P(e,t,false),M(e,t),d},setStatus(b){let m=Sr.get(t);if(m){m.status=b;let c=fo(m,l,n.align);e$1(e,t,c),M(e,t);}return d},setLeft(b){let m=Sr.get(t);if(m){m.left=b;let c=fo(m,l,n.align);e$1(e,t,c),M(e,t);}return d},setCenter(b){let m=Sr.get(t);if(m){m.center=b;let c=fo(m,l,n.align);e$1(e,t,c),M(e,t);}return d},setRight(b){let m=Sr.get(t);if(m){m.right=b;let c=fo(m,l,n.align);e$1(e,t,c),M(e,t);}return d},getContent(){return f$2(e,t)},destroy(){Sr.delete(t),i(e,t);}};return d}var fp=Object.freeze({create:Qu});var pp=z.object({x:z.number().int().default(0),y:z.number().int().default(0)}),FC=1e4,bo={isForm:new Uint8Array(FC)},Ie=new Map;function Ju(e){if("getValue"in e)return e.getValue();if("isChecked"in e)return e.isChecked();if("getSelectedValue"in e)return e.getSelectedValue()}function DC(e){"setValue"in e&&typeof e.setValue=="function"?e.setValue(""):"setChecked"in e&&typeof e.setChecked=="function"?e.setChecked(false):"clearSelection"in e&&typeof e.clearSelection=="function"&&e.clearSelection();}function yp(e){let r=Ie.get(e);if(!r)return;let o={};for(let[n,t]of r.fields)o[n]=Ju(t);for(let n of r.onChangeCallbacks)n(o);}function AC(e,r){let o=Ie.get(e);if(o)for(let n of o.onValidationErrorCallbacks)n(r);}function IC(e,r){"onChange"in r&&typeof r.onChange=="function"&&r.onChange(()=>{yp(e);});}function kC(e,r){return e==="tab"?(r.focusNext(),true):e==="S-tab"||e==="shift-tab"?(r.focusPrevious(),true):e==="enter"||e==="return"?(r.submit(),true):false}function RC(e,r){if(e.focusedIndex<0)return false;let o=e.fieldOrder[e.focusedIndex];if(!o)return false;let n=e.fields.get(o);return !n||!("handleKey"in n)||typeof n.handleKey!="function"?false:n.handleKey(r)}function bp(e,r){if(r.focusedIndex<0)return;let o=r.fieldOrder[r.focusedIndex];if(!o)return;let n=r.fields.get(o);n&&"blur"in n&&v$1(e,n.eid);}function Xu(e,r,o){let n=r.fieldOrder[o];if(!n)return;let t=r.fields.get(n);t&&"focus"in t&&u(e,t.eid);}function Zu(e,r={}){let o=pp.parse(r),n=h(e);bo.isForm[n]=1,H(e,n,o.x,o.y),Ie.set(n,{fields:new Map,fieldOrder:[],focusedIndex:-1,onSubmitCallbacks:[],onChangeCallbacks:[],onValidationErrorCallbacks:[]});let t={eid:n,addField(i,a){let s=Ie.get(n);if(!s)return t;if(s.fields.has(i)){let l=s.fieldOrder.indexOf(i);l!==-1&&s.fieldOrder.splice(l,1);}return s.fields.set(i,a),s.fieldOrder.push(i),IC(n,a),t},removeField(i){let a=Ie.get(n);if(!a)return t;a.fields.delete(i);let s=a.fieldOrder.indexOf(i);return s!==-1&&a.fieldOrder.splice(s,1),a.focusedIndex>=s&&a.focusedIndex>0&&a.focusedIndex--,t},getField(i){return Ie.get(n)?.fields.get(i)},getFieldNames(){return Ie.get(n)?.fieldOrder??[]},getValue(i){let a=Ie.get(n);if(!a)return;let s=a.fields.get(i);if(s)return Ju(s)},getValues(){let i=Ie.get(n);if(!i)return {};let a={};for(let[s,l]of i.fields)a[s]=Ju(l);return a},setValidator(i){let a=Ie.get(n);return a&&(a.validator=i),t},validate(i){let a=Ie.get(n);if(!a)return {};let s=i??a.validator;if(!s)return {};let l=t.getValues();return s(l)},reset(){let i=Ie.get(n);if(!i)return t;for(let a of i.fields.values())DC(a);return yp(n),t},submit(){let i=Ie.get(n);if(!i)return;let a=t.validate();if(Object.keys(a).length>0){AC(n,a);return}let s=t.getValues();for(let l of i.onSubmitCallbacks)l(s);},focusFirst(){let i=Ie.get(n);return !i||i.fieldOrder.length===0||(i.focusedIndex=0,Xu(e,i,0)),t},focusNext(){let i=Ie.get(n);return !i||i.fieldOrder.length===0||(bp(e,i),i.focusedIndex=(i.focusedIndex+1)%i.fieldOrder.length,Xu(e,i,i.focusedIndex)),t},focusPrevious(){let i=Ie.get(n);return !i||i.fieldOrder.length===0||(bp(e,i),i.focusedIndex=i.focusedIndex-1,i.focusedIndex<0&&(i.focusedIndex=i.fieldOrder.length-1),Xu(e,i,i.focusedIndex)),t},handleKey(i){let a=Ie.get(n);return a?kC(i,t)?true:RC(a,i):false},setPosition(i,a){return H(e,n,i,a),M(e,n),t},move(i,a){return M$1(e,n,i,a),M(e,n),t},getPosition(){return {x:G.x[n]??0,y:G.y[n]??0}},onSubmit(i){let a=Ie.get(n);return a&&a.onSubmitCallbacks.push(i),t},onChange(i){let a=Ie.get(n);return a&&a.onChangeCallbacks.push(i),t},onValidationError(i){let a=Ie.get(n);return a&&a.onValidationErrorCallbacks.push(i),t},destroy(){bo.isForm[n]=0,Ie.delete(n),i(e,n);}};return t}function ed(e,r){return bo.isForm[r]===1}function td(){bo.isForm.fill(0),Ie.clear();}var hp=Object.freeze({create:Zu,is:ed,resetStore:td});var OC=z.object({value:z.number().min(0).max(1),color:z.union([z.string(),z.number()])}),xp=z.object({x:z.number().int().default(0),y:z.number().int().default(0),width:z.number().int().positive().default(20),height:z.number().int().positive().default(1),value:z.number().min(0).max(1).default(0),label:z.string().optional(),fillChar:z.string().length(1).default("\u2588"),emptyChar:z.string().length(1).default("\u2591"),fillColor:z.union([z.string(),z.number()]).optional(),emptyColor:z.union([z.string(),z.number()]).optional(),showPercentage:z.boolean().default(true),showValue:z.boolean().default(false),thresholds:z.array(OC).optional(),min:z.number().default(0),max:z.number().default(100),renderMode:z.enum(["block","braille"]).default("block"),gradientStart:z.union([z.string(),z.number()]).optional(),gradientEnd:z.union([z.string(),z.number()]).optional()}),nd=1e4,Lt={isGauge:new Uint8Array(nd),showPercentage:new Uint8Array(nd),showValue:new Uint8Array(nd)},Zt=new Map;function VC(e,r){if(!r.thresholds||r.thresholds.length===0)return r.fillColor;let o;for(let n of r.thresholds)e>=n.value&&(!o||n.value>o.value)&&(o=n);return o?v(o.color):r.fillColor}function Sp(e,r){let o="";if(r.label&&(o=r.label),Lt.showPercentage[e]===1){let n=eo(r.value);o=o?`${o} ${n}`:n;}if(Lt.showValue[e]===1){let t=`${(r.min+r.value*(r.max-r.min)).toFixed(1)}/${r.max}`;o=o?`${o} ${t}`:t;}return o}function _C(e,r,o){let n=Math.floor((o-r.length)/2),t=" ".repeat(n)+r,i="";for(let a=0;a<o;a++)a<t.length&&t[a]!==" "?i+=t[a]:i+=e[a]??" ";return i}function Cp(e,r,o){return !r||r.length>=o?[e]:[_C(e,r,o)]}function Tp(e,r,o,n){let t=[e];for(r&&t.push(r.padEnd(o," "));t.length<n;)t.push(" ".repeat(o));return t}function zC(e,r,o,n){let t=pr(r.value,o),i=Sp(e,r);return (n===1?Cp(t,i,o):Tp(t,i,o,n)).join(`
|
|
10
|
+
`)}function NC(e,r,o,n){let t=Math.round(r.value*o),i=o-t,a=r.fillChar.repeat(t)+r.emptyChar.repeat(i),s=Sp(e,r);return (n===1?Cp(a,s,o):Tp(a,s,o,n)).join(`
|
|
11
|
+
`)}function UC(e,r,o,n){return r.renderMode==="braille"?zC(e,r,o,n):NC(e,r,o,n)}function ka(e,r){let o=Zt.get(r);if(!o)return;let n=g(e,r);if(!n)return;let t=UC(r,o,n.width,n.height);e$1(e,r,t);let i=VC(o.value,o);i!==void 0&&J(e,r,{fg:i}),M(e,r);}function rd(e,r={}){let o=xp.parse(r),n=h(e);H(e,n,o.x,o.y),f(e,n,o.width,o.height),Lt.isGauge[n]=1,Lt.showPercentage[n]=o.showPercentage?1:0,Lt.showValue[n]=o.showValue?1:0,Zt.set(n,{value:o.value,label:o.label??"",fillChar:o.fillChar,emptyChar:o.emptyChar,fillColor:o.fillColor?v(o.fillColor):void 0,emptyColor:o.emptyColor?v(o.emptyColor):void 0,thresholds:o.thresholds?[...o.thresholds]:[],min:o.min,max:o.max,renderMode:o.renderMode,gradientStart:o.gradientStart?v(o.gradientStart):void 0,gradientEnd:o.gradientEnd?v(o.gradientEnd):void 0}),ka(e,n);let t={eid:n,setValue(i){let a=Zt.get(n);return a&&(a.value=Math.max(0,Math.min(1,i)),ka(e,n)),t},getValue(){return Zt.get(n)?.value??0},setLabel(i){let a=Zt.get(n);return a&&(a.label=i,ka(e,n)),t},getLabel(){return Zt.get(n)?.label??""},setPosition(i,a){return H(e,n,i,a),M(e,n),t},setRenderMode(i){let a=Zt.get(n);return a&&(a.renderMode=i,ka(e,n)),t},getRenderMode(){return Zt.get(n)?.renderMode??"block"},destroy(){Lt.isGauge[n]=0,Lt.showPercentage[n]=0,Lt.showValue[n]=0,Zt.delete(n),i(e,n);}};return t}function od(e,r){return Lt.isGauge[r]===1}function id(){Lt.isGauge.fill(0),Lt.showPercentage.fill(0),Lt.showValue.fill(0),Zt.clear();}var Wp=Object.freeze({create:rd,is:od,resetStore:id});var GC=1e4,ad={isGrid:new Uint8Array(GC)},Ra=z.union([z.number().int().positive(),z.string().regex(/^\d+%$/)]),Mp=z.object({rows:z.number().int().positive().optional().default(1),cols:z.number().int().positive().optional().default(1),gap:z.number().int().min(0).optional().default(0),cellWidths:z.union([Ra,z.array(Ra)]).optional(),cellHeights:z.union([Ra,z.array(Ra)]).optional(),padding:z.number().int().min(0).optional().default(0),left:z.number().optional().default(0),top:z.number().optional().default(0),width:z.union([z.number(),z.string(),z.literal("auto")]).optional().default("auto"),height:z.union([z.number(),z.string(),z.literal("auto")]).optional().default("auto"),fg:z.union([z.string(),z.number()]).optional(),bg:z.union([z.string(),z.number()]).optional()}),Gt=new Map;function HC(e){return typeof e=="string"&&e.endsWith("%")?{value:Number.parseFloat(e),isPercent:true}:{value:typeof e=="number"?e:Number.parseInt(e,10),isPercent:false}}function vp(e,r,o,n){let t=n*(r-1),i=o-t,a=e.map(HC),s=0,l=0;for(let{value:b,isPercent:m}of a)m?l+=b:s+=b;let u=i-s,d=[];for(let{value:b,isPercent:m}of a)m?d.push(b/100*u):d.push(b);return d}function wC(e,r,o,n,t,i){if(e<0||e>=t)throw new Error(`Row ${e} out of bounds (0-${t-1})`);if(r<0||r>=i)throw new Error(`Column ${r} out of bounds (0-${i-1})`);if(e+o>t)throw new Error(`Row span ${o} exceeds grid bounds (row ${e} + span ${o} > ${t})`);if(r+n>i)throw new Error(`Column span ${n} exceeds grid bounds (col ${r} + span ${n} > ${i})`)}function Lp(e,r,o,n){let t=[n];for(let i=0;i<e;i++)i>0&&(t[i]=(t[i-1]??0)+(r[i-1]??0)+o);return t}function Ep(e,r,o,n,t){let i=0;for(let a=e;a<e+r&&a<o;a++)i+=n[a]??0,a<e+r-1&&(i+=t);return i}function jC(e,r,o,n,t,i,a,s){let l=n[r.col]??0,u=t[r.row]??0,d=Ep(r.col,r.colSpan,s.cols,i,s.gap),b=Ep(r.row,r.rowSpan,s.rows,a,s.gap);H(e,r.entity,o.x+l,o.y+u),f(e,r.entity,d,b),M(e,r.entity);}function Cr(e,r,o){let n=g(e,r);if(!n)return;let t=n.width-o.padding*2,i=n.height-o.padding*2,a=vp(o.cellWidths,o.cols,t,o.gap),s=vp(o.cellHeights,o.rows,i,o.gap),l=Lp(o.cols,a,o.gap,o.padding),u=Lp(o.rows,s,o.gap,o.padding),d=I(e,r);if(d)for(let b of o.cells)jC(e,b,d,l,u,a,s,o);}function sd(e,r,o={}){let n=Mp.parse(o),t=r;ad.isGrid[t]=1,H(e,t,n.left,n.top),f(e,t,n.width,n.height),q$1(e,t,{focusable:true}),n.padding>0&&e$4(e,t,n.padding);let i$1=n.fg?v(n.fg):void 0,a=n.bg?v(n.bg):void 0;(i$1!==void 0||a!==void 0)&&J(e,t,{fg:i$1,bg:a});let s$1;if(n.cellWidths)s$1=Array.isArray(n.cellWidths)?n.cellWidths:Array(n.cols).fill(n.cellWidths);else {let b=`${100/n.cols}%`;s$1=Array(n.cols).fill(b);}let l;if(n.cellHeights)l=Array.isArray(n.cellHeights)?n.cellHeights:Array(n.rows).fill(n.cellHeights);else {let b=`${100/n.rows}%`;l=Array(n.rows).fill(b);}let u$1={rows:n.rows,cols:n.cols,gap:n.gap,cellWidths:s$1,cellHeights:l,padding:n.padding,cells:[]};Gt.set(t,u$1);let d={eid:t,show(){return P(e,t,true),M(e,t),d},hide(){return P(e,t,false),M(e,t),d},focus(){return u(e,t),d},blur(){return v$1(e,t),d},isFocused(){return s(e,t)},addToCell(b,m,c,g=1,p=1){let h=Gt.get(t);if(!h)return d;wC(m,c,g,p,h.rows,h.cols);let E=h.cells.findIndex(C=>C.entity===b);return E>=0&&h.cells.splice(E,1),h.cells.push({entity:b,row:m,col:c,rowSpan:g,colSpan:p}),i$2(e,b)===a$1&&d$1(e,t,b),Cr(e,t,h),M(e,t),d},removeFromGrid(b){let m=Gt.get(t);if(!m)return d;let c=m.cells.findIndex(g=>g.entity===b);return c>=0&&(m.cells.splice(c,1),M(e,t)),d},getCells(){return Gt.get(t)?.cells??[]},layout(){let b=Gt.get(t);return b&&(Cr(e,t,b),M(e,t)),d},setGap(b){let m=Gt.get(t);return m&&(m.gap=b,Cr(e,t,m),M(e,t)),d},setCellWidths(b){let m=Gt.get(t);return m&&(m.cellWidths=Array.isArray(b)?b:Array(m.cols).fill(b),Cr(e,t,m),M(e,t)),d},setCellHeights(b){let m=Gt.get(t);return m&&(m.cellHeights=Array.isArray(b)?b:Array(m.rows).fill(b),Cr(e,t,m),M(e,t)),d},destroy(){Gt.delete(t),i(e,t);}};return d}function ld(e,r,o,n,t,i=1,a=1){let s=Gt.get(r);if(!s)throw new Error(`Entity ${r} is not a grid`);if(n<0||n>=s.rows)throw new Error(`Row ${n} out of bounds (0-${s.rows-1})`);if(t<0||t>=s.cols)throw new Error(`Column ${t} out of bounds (0-${s.cols-1})`);if(n+i>s.rows)throw new Error(`Row span ${i} exceeds grid bounds (row ${n} + span ${i} > ${s.rows})`);if(t+a>s.cols)throw new Error(`Column span ${a} exceeds grid bounds (col ${t} + span ${a} > ${s.cols})`);let l=s.cells.findIndex(u=>u.entity===o);l>=0&&s.cells.splice(l,1),s.cells.push({entity:o,row:n,col:t,rowSpan:i,colSpan:a}),i$2(e,o)===a$1&&d$1(e,r,o),Cr(e,r,s),M(e,r);}function ud(e,r){return ad.isGrid[r]===1}function dd(){Gt.clear();}var Bp=Object.freeze({create:sd,is:ud,addTo:ld,resetStore:dd});var $C=1e4,Pp={isHeader:new Uint8Array($C)},Fp=z.object({title:z.string().optional().default(""),left:z.string().optional(),center:z.string().optional(),right:z.string().optional(),height:z.number().int().positive().optional().default(1),fg:z.union([z.string(),z.number()]).optional(),bg:z.union([z.string(),z.number()]).optional(),align:z.enum(["left","center","right"]).optional().default("left")}),Tr=new Map;function po(e,r,o){let{left:n,center:t,right:i,title:a}=e;if(n||t||i){let s=n||"",l=t||"",u=i||"",d=s.length,b=l.length,m=u.length,c=d+b+m;if(r-c>=2){let p=Math.floor((r-b)/2),h=Math.max(0,p-d),E=p+b,C=Math.max(0,r-E-m);return s+" ".repeat(h)+l+" ".repeat(C)+u}return `${s} ${l} ${u}`.slice(0,r)}if(a){if(o==="center"){let s=Math.max(0,Math.floor((r-a.length)/2));return " ".repeat(s)+a}if(o==="right"){let s=Math.max(0,r-a.length);return " ".repeat(s)+a}return a}return ""}function cd(e,r,o={}){let n=Fp.parse(o),t=r;Pp.isHeader[t]=1,H(e,t,0,0),f(e,t,"auto",n.height);let i$1=n.fg?v(n.fg):void 0,a=n.bg?v(n.bg):void 0;(i$1!==void 0||a!==void 0)&&J(e,t,{fg:i$1,bg:a});let s={title:n.title,left:n.left||"",center:n.center||"",right:n.right||""};Tr.set(t,s);let l=80,u=po(s,l,n.align);e$1(e,t,u,{align:0});let d={eid:t,show(){return P(e,t,true),M(e,t),d},hide(){return P(e,t,false),M(e,t),d},setTitle(b){let m=Tr.get(t);if(m){m.title=b;let c=po(m,l,n.align);e$1(e,t,c),M(e,t);}return d},setLeft(b){let m=Tr.get(t);if(m){m.left=b;let c=po(m,l,n.align);e$1(e,t,c),M(e,t);}return d},setCenter(b){let m=Tr.get(t);if(m){m.center=b;let c=po(m,l,n.align);e$1(e,t,c),M(e,t);}return d},setRight(b){let m=Tr.get(t);if(m){m.right=b;let c=po(m,l,n.align);e$1(e,t,c),M(e,t);}return d},getContent(){return f$2(e,t)},destroy(){Tr.delete(t),i(e,t);}};return d}var Dp=Object.freeze({create:cd});var Oa=500,Va=100,_a=2,za=1,Na=4294967295,Ua=4281545523,Ga=4287137928,kp=z.object({fg:z.number().int().nonnegative().optional(),bg:z.number().int().nonnegative().optional(),border:z.number().int().nonnegative().optional(),padding:z.number().int().nonnegative().optional()}),YC=z.object({text:z.string(),style:kp.optional(),delay:z.number().positive().optional()}),KC=z.object({showDelay:z.number().nonnegative().optional(),hideDelay:z.number().nonnegative().optional(),offsetX:z.number().optional(),offsetY:z.number().optional(),screenWidth:z.number().int().positive().optional(),screenHeight:z.number().int().positive().optional(),style:kp.optional()}),Qe=new Map;function Rp(e){return typeof e=="string"?{text:e}:e}function QC(e){return e.split(`
|
|
12
|
+
`)}function Ap(e,r){let o=0;for(let n of e)n.length>o&&(o=n.length);return o+r*2}function Ip(e,r){return e.length+r*2}function qC(e,r,o,n,t,i){let a=e,s=r;return a+o>t&&(a=t-o),a<0&&(a=0),s+n>i&&(s=i-n),s<0&&(s=0),{x:a,y:s}}function yo(e={}){let r=KC.parse(e),o=r.showDelay??Oa,n=r.hideDelay??Va,t=r.offsetX??_a,i=r.offsetY??za,a=r.screenWidth??80,s=r.screenHeight??24,l={fg:r.style?.fg??Na,bg:r.style?.bg??Ua,border:r.style?.border??Ga,padding:r.style?.padding??1},u=false,d=null,b="",m=[],c={x:0,y:0},g=null,p=null,h=null,E=0,C=0,M=false,P={setHoverText(L,_){let be=Rp(_),ye=YC.parse(be);Qe.set(L,ye);},clearHoverText(L){Qe.delete(L),d===L&&P.hideNow();},getHoverText(L){return Qe.get(L)},hasHoverText(L){return Qe.has(L)},updateMouse(L,_,be){E=L,C=_,be!==h&&(h=be,be!==null&&Qe.has(be)?(g=Date.now(),p=null,M=true):u?(p=Date.now(),g=null,M=false):(g=null,p=null,M=false)),u&&d!==null&&I(L,_);},update(L){let _=Date.now();if(M&&g!==null&&h!==null){let ye=Qe.get(h)?.delay??o;_-g>=ye&&(P.showNow(h,E,C),M=false);}p!==null&&u&&_-p>=n&&P.hideNow();},showNow(L,_,be){let ye=Qe.get(L);ye&&(u=true,d=L,b=ye.text,m=QC(ye.text),g=null,p=null,M=false,I(_,be));},hideNow(){u=false,d=null,b="",m=[],g=null,p=null,M=false;},getState(){return {visible:u,sourceEntity:d,text:b,position:c,hoverStartTime:g}},isVisible(){return u},getRenderData(){if(!u||d===null)return null;let L=Qe.get(d),_={fg:L?.style?.fg??l.fg,bg:L?.style?.bg??l.bg,border:L?.style?.border??l.border,padding:L?.style?.padding??l.padding??1},be=Ap(m,_.padding),ye=Ip(m,_.padding);return {x:c.x,y:c.y,width:be,height:ye,text:b,lines:m,style:_}},setScreenSize(L,_){a=L,s=_;},clearAll(){Qe.clear(),P.hideNow();}};function I(L,_){let be=d!==null?Qe.get(d):void 0,ye={fg:be?.style?.fg??l.fg,bg:be?.style?.bg??l.bg,border:be?.style?.border??l.border,padding:be?.style?.padding??l.padding},ht=Ap(m,ye.padding??1),Fn=Ip(m,ye.padding??1),$t=L+t,Gr=_+i;c=qC($t,Gr,ht,Fn,a,s);}return P}function gd(e,r,o){Qe.set(r,Rp(o));}function md(e,r){Qe.delete(r);}function fd(e,r){return Qe.get(r)}function bd(e,r){return Qe.has(r)}function pd(){Qe.clear();}function yd(){return Qe.size}function hd(){Qe.clear();}var Op=Object.freeze({createManager:yo,set:gd,get:fd,has:bd,clear:md,clearAll:pd,getCount:yd,resetStore:hd,DEFAULT_CURSOR_OFFSET_X:_a,DEFAULT_CURSOR_OFFSET_Y:za,DEFAULT_HIDE_DELAY:Va,DEFAULT_HOVER_DELAY:Oa,DEFAULT_TOOLTIP_BG:Ua,DEFAULT_TOOLTIP_BORDER:Ga,DEFAULT_TOOLTIP_FG:Na});var Vp=z.object({x:z.number().int().default(0),y:z.number().int().default(0),width:z.number().int().positive().optional(),height:z.number().int().positive().optional(),type:z.enum(["ansi","overlay"]).default("ansi"),bitmap:z.object({width:z.number().int().nonnegative(),height:z.number().int().nonnegative(),data:z.instanceof(Uint8Array)}).optional(),renderMode:z.enum(["color","ascii","braille"]).default("color"),dither:z.boolean().default(false),visible:z.boolean().default(true),preserveAspectRatio:z.boolean().default(true)});Vp.extend({frames:z.array(z.object({width:z.number().int().nonnegative(),height:z.number().int().nonnegative(),data:z.instanceof(Uint8Array)})),frameDelays:z.array(z.number().positive()),loopCount:z.number().int().nonnegative().default(1)}).refine(e=>e.frames.length===e.frameDelays.length,{message:"frames and frameDelays arrays must have the same length"});var XC=1e4,Ha={isImage:new Uint8Array(XC)},Ht=new Map,Er=new Map,zn=new Map,xo=new Map,Nn=new Map,Wr=new Map,Sd=new Map,_n=new Map,vr=new Map,ho=new Map,en=new Map,tn=new Map,Lr=new Map,So=new Map,Co=new Map;function JC(e,r,o,n,t){if(e===0||r===0)return {width:0,height:0};let i=t??true;if(o!==void 0&&n!==void 0){if(!i)return {width:o,height:n};let a=e/r,s=o/n;return a>s?{width:o,height:Math.round(o/a)}:{width:Math.round(n*a),height:n}}if(o!==void 0){if(!i)return {width:o,height:r};let a=e/r;return {width:o,height:Math.round(o/a)}}if(n!==void 0){if(!i)return {width:e,height:n};let a=e/r;return {width:Math.round(n*a),height:n}}return {width:e,height:r}}function ZC(e,r,o,n,t){return `${e}:${r}:${o?"1":"0"}:${n}:${t}`}function xd(e){So.delete(e);}function Vn(e,r){let o=Ht.get(r);if(!o){e$1(e,r,""),Nn.delete(r);return}if(o.width===0||o.height===0){e$1(e,r,""),Nn.delete(r);return}if((Er.get(r)??"ansi")!=="ansi"){let b=Co.get(r);if(b){let m=G.x[r]??0,c=G.y[r]??0,g=l$3(b,{width:o.width,height:o.height,data:o.data,format:"rgba"},{x:m,y:c});e$1(e,r,g);}else e$1(e,r,"");return}let t=zn.get(r)??"color",i=xo.get(r)??false,a=o.data.byteOffset,s=ZC(a,t,i,o.width,o.height),l=So.get(r);l||(l=new Map,So.set(r,l));let u=l.get(s);u||(u=a$3(o,{width:void 0,height:void 0,mode:t,dither:i}),l.set(s,u)),Nn.set(r,u);let d=b$2(u);e$1(e,r,d);}function _p(e,r={}){let o=Vp.parse(r),n=h(e);H(e,n,o.x,o.y);let t,i;if(o.bitmap){let a=JC(o.bitmap.width,o.bitmap.height,o.width,o.height,o.preserveAspectRatio);t=a.width,i=a.height;}else t=o.width??0,i=o.height??0;return f(e,n,t,i),Ha.isImage[n]=1,Er.set(n,o.type),zn.set(n,o.renderMode),xo.set(n,o.dither),Wr.set(n,o.visible),Sd.set(n,o.preserveAspectRatio),_n.set(n,[]),vr.set(n,[]),ho.set(n,1),en.set(n,0),Lr.set(n,0),tn.set(n,void 0),r.graphicsManager&&Co.set(n,r.graphicsManager),o.bitmap&&(Ht.set(n,o.bitmap),Vn(e,n)),o.visible||P(e,n,false),eT(e,n)}function eT(e,r){return {get eid(){return r},show(){return Wr.set(r,true),P(e,r,true),M(e,r),this},hide(){return Wr.set(r,false),P(e,r,false),M(e,r),this},isVisible(){return Wr.get(r)??false},move(o,n){let t=G.x[r]??0,i=G.y[r]??0;return H(e,r,t+o,i+n),M(e,r),this},setPosition(o,n){return H(e,r,o,n),M(e,r),this},getPosition(){return {x:G.x[r]??0,y:G.y[r]??0}},setImage(o){return _n.set(r,[]),vr.set(r,[]),this.stopAnimation(),Ht.set(r,o),xd(r),Vn(e,r),M(e,r),this},getImage(){return Ht.get(r)},getType(){return Er.get(r)??"ansi"},getCellMap(){return Nn.get(r)},setRenderMode(o){return zn.set(r,o),xd(r),Vn(e,r),M(e,r),this},getRenderMode(){return zn.get(r)??"color"},setGraphicsManager(o){return Co.set(r,o),(Er.get(r)??"ansi")==="overlay"&&(Vn(e,r),M(e,r)),this},render(){let o=Ht.get(r);if(!o)return "";let n=zn.get(r)??"color",t=xo.get(r)??false,i=a$3(o,{mode:n,dither:t});return b$2(i)},setAnimatedImage(o,n,t=1){if(o.length===0)throw new Error("frames array cannot be empty");if(o.length!==n.length)throw new Error("frames and delays arrays must have the same length");for(let i of n)if(i<=0)throw new Error("all frame delays must be positive numbers");return this.stopAnimation(),_n.set(r,o),vr.set(r,n),ho.set(r,t),en.set(r,0),Lr.set(r,0),Ht.set(r,o[0]),xd(r),Vn(e,r),M(e,r),this},startAnimation(){let o=_n.get(r),n=vr.get(r);if(!o||o.length===0||!n||n.length===0)return this;this.stopAnimation();let t=ho.get(r)??1,i=b=>t>0&&b>=t,a=b=>{let m=o[b];m&&(Ht.set(r,m),Vn(e,r),M(e,r));},s=(b,m)=>{let c=tn.get(r);c!==void 0&&clearTimeout(c);let g=n[b]??100,p=setTimeout(m,g);tn.set(r,p);},l=()=>{let b=en.get(r)??0;if(b=(b+1)%o.length,b===0){let m=(Lr.get(r)??0)+1;if(Lr.set(r,m),i(m)){en.set(r,0),a(0),this.stopAnimation();return}}en.set(r,b),a(b),s(b,l);},u=n[en.get(r)??0]??100,d=setTimeout(l,u);return tn.set(r,d),this},stopAnimation(){let o=tn.get(r);return o!==void 0&&(clearTimeout(o),tn.set(r,void 0)),this},isAnimating(){return tn.get(r)!==void 0},getCurrentFrame(){return en.get(r)??0},setFrame(o){let n=_n.get(r);if(!n||n.length===0)return this;let t=Math.max(0,Math.min(o,n.length-1));en.set(r,t);let i=n[t];return i&&(Ht.set(r,i),Vn(e,r),M(e,r)),this},destroy(){this.stopAnimation(),Ha.isImage[r]=0,Ht.delete(r),Er.delete(r),zn.delete(r),xo.delete(r),Nn.delete(r),Wr.delete(r),Sd.delete(r),_n.delete(r),vr.delete(r),ho.delete(r),en.delete(r),Lr.delete(r),tn.delete(r),So.delete(r),Co.delete(r),i(e,r);}}}function zp(e,r){return Ha.isImage[r]===1}function Np(e){return Ht.get(e)}function Up(e){return Nn.get(e)}function Gp(){for(let e of tn.values())e!==void 0&&clearTimeout(e);Ha.isImage.fill(0),Ht.clear(),Er.clear(),zn.clear(),xo.clear(),Nn.clear(),Wr.clear(),Sd.clear(),_n.clear(),vr.clear(),ho.clear(),en.clear(),Lr.clear(),tn.clear(),So.clear(),Co.clear();}var Hp=Object.freeze({create:_p,is:zp,getBitmap:Np,getCellMap:Up,resetStore:Gp});var wp=z.union([z.number(),z.string().regex(/^\d+(\.\d+)?%$/,'Percentage must be in format "50%"'),z.enum(["center","left","right","top","bottom"])]),jp=z.union([z.number(),z.string().regex(/^\d+(\.\d+)?%$/,'Percentage must be in format "50%"'),z.literal("auto")]),Kp=z.object({left:wp.optional(),top:wp.optional(),width:jp.optional(),height:jp.optional(),layout:z.enum(["inline","grid","flex"]).optional(),gap:z.number().nonnegative().optional(),wrap:z.boolean().optional(),justify:z.enum(["start","center","end","space-between"]).optional(),align:z.enum(["start","center","end"]).optional(),cols:z.number().positive().optional(),direction:z.enum(["row","column"]).optional(),fg:z.union([z.string(),z.number()]).optional(),bg:z.union([z.string(),z.number()]).optional()}),Wn=1e4,q={isLayout:new Uint8Array(Wn),mode:new Uint8Array(Wn),gap:new Float32Array(Wn),wrap:new Uint8Array(Wn),justify:new Uint8Array(Wn),align:new Uint8Array(Wn),cols:new Uint8Array(Wn),direction:new Uint8Array(Wn)};function $p(e){return e===void 0?0:typeof e=="number"?e:0}function Yp(e){return e===void 0||typeof e=="string"&&e==="auto"?"auto":e}function tT(e){switch(e){case "inline":return 0;case "grid":return 1;case "flex":return 2}}function Cd(e){switch(e){case 0:return "inline";case 1:return "grid";case 2:return "flex";default:return "inline"}}function nT(e){switch(e){case "start":return 0;case "center":return 1;case "end":return 2;case "space-between":return 3}}function rT(e){switch(e){case "start":return 0;case "center":return 1;case "end":return 2}}function oT(e,r){return r.map(o=>{let n=g(e,o);return {eid:o,width:n?.width??1,height:n?.height??1}})}function wa(e,r,o,n){let t=new Map,i=0,a=0,s=0;for(let l of e)n&&i>0&&i+l.width>r&&(i=0,a+=s+o,s=0),t.set(l.eid,{x:i,y:a}),i+=l.width+o,s=Math.max(s,l.height);return t}function ja(e,r,o){let n=new Map,t=new Array(r).fill(0),i=[];return e.forEach((a,s)=>{let l=s%r,u=Math.floor(s/r);t[l]=Math.max(t[l],a.width),i[u]||(i[u]=0),i[u]=Math.max(i[u],a.height);}),e.forEach((a,s)=>{let l=s%r,u=Math.floor(s/r),d=0;for(let m=0;m<l;m++)d+=t[m]+o;let b=0;for(let m=0;m<u;m++)b+=i[m]+o;n.set(a.eid,{x:d,y:b});}),n}function $a(e,r,o,n,t,i){let a=new Map;if(e.length===0)return a;let s=n==="row",l=e.reduce((p,h)=>p+(s?h.width:h.height),0),u=o*(e.length-1),d=l+u,b=Math.max(0,r-d),m=Math.max(...e.map(p=>s?p.height:p.width)),c=0,g=0;switch(t){case "start":c=0;break;case "center":c=b/2;break;case "end":c=b;break;case "space-between":c=0,e.length>1&&(g=b/(e.length-1));break}for(let p of e){let h=s?p.width:p.height,E=s?p.height:p.width,C=0;switch(i){case "start":C=0;break;case "center":C=(m-E)/2;break;case "end":C=m-E;break}s?a.set(p.eid,{x:c,y:C}):a.set(p.eid,{x:C,y:c}),c+=h+o+g;}return a}function To(e,r,o={}){let n=Kp.parse(o),t=r,i$1=n.layout??"inline";q.isLayout[t]=1,q.mode[t]=tT(i$1),q.gap[t]=n.gap??0,q.wrap[t]=n.wrap!==false?1:0,q.justify[t]=nT(n.justify??"start"),q.align[t]=rT(n.align??"start"),q.cols[t]=n.cols??3,q.direction[t]=n.direction==="column"?1:0;let a=$p(n.left),s$1=$p(n.top);H(e,t,a,s$1);let l=Yp(n.width),u$1=Yp(n.height);f(e,t,l,u$1),(n.fg!==void 0||n.bg!==void 0)&&J(e,t,{fg:n.fg!==void 0?v(n.fg):void 0,bg:n.bg!==void 0?v(n.bg):void 0}),q$1(e,t,{focusable:true});function d(){let m=f$1(e,t);if(m.length===0)return;let c=oT(e,m),g=iT(e,t),p=aT(e,t,c,g.width,g.height);sT(e,t,p),M(e,t);}let b={eid:t,show(){return P(e,t,true),b},hide(){return P(e,t,false),b},move(m,c){return M$1(e,t,m,c),M(e,t),b},setPosition(m,c){return H(e,t,m,c),M(e,t),b},getLayoutMode(){return Cd(q.mode[t])},setGap(m){return q.gap[t]=m,M(e,t),b},getGap(){return q.gap[t]},recalculate(){return d(),b},focus(){return u(e,t),b},blur(){return v$1(e,t),b},isFocused(){return s(e,t)},append(m){return d$1(e,t,m),b},getChildren(){return f$1(e,t)},destroy(){q.isLayout[t]=0,q.mode[t]=0,q.gap[t]=0,q.wrap[t]=0,q.justify[t]=0,q.align[t]=0,q.cols[t]=0,q.direction[t]=0,i(e,t);}};return b}function iT(e,r){let o=g(e,r);return {width:o?.width??80,height:o?.height??24}}function aT(e,r,o,n,t){let i=q.gap[r];switch(Cd(q.mode[r])){case "inline":{let s=q.wrap[r]===1;return wa(o,n,i,s)}case "grid":{let s=q.cols[r];return ja(o,s,i)}case "flex":{let s=q.direction[r]===0?"row":"column",l=["start","center","end","space-between"][q.justify[r]]??"start",u=["start","center","end"][q.align[r]]??"start";return $a(o,s==="row"?n:t,i,s,l,u)}}}function sT(e,r,o){let n=I(e,r),t=n?.x??0,i=n?.y??0;for(let[a,s]of o)H(e,a,t+s.x,i+s.y),M(e,a);}function Td(e,r){return q.isLayout[r]===1}function Wd(e,r){return Cd(q.mode[r])}function vd(){q.isLayout.fill(0),q.mode.fill(0),q.gap.fill(0),q.wrap.fill(0),q.justify.fill(0),q.align.fill(0),q.cols.fill(0),q.direction.fill(0);}var Qp=Object.freeze({create:To,is:Td,getMode:Wd,calculateFlex:$a,calculateGrid:ja,calculateInline:wa,resetStore:vd});var Mr="\u2500",Ya="\u2502",Ka=10,qp=z.union([z.number(),z.string().regex(/^\d+(\.\d+)?%$/,'Percentage must be in format "50%"'),z.enum(["center","left","right","top","bottom"])]),Zp=z.object({left:qp.optional(),top:qp.optional(),orientation:z.enum(["horizontal","vertical"]).optional(),length:z.number().positive().optional(),char:z.string().optional(),fg:z.union([z.string(),z.number()]).optional(),bg:z.union([z.string(),z.number()]).optional()}),Ld=1e4,at={isLine:new Uint8Array(Ld),orientation:new Uint8Array(Ld),length:new Float32Array(Ld)},Un=new Map;function Xp(e){return e===void 0?0:typeof e=="number"?e:0}function lT(e,r,o){let n=Xp(o.left),t=Xp(o.top);H(e,r,n,t);}function Jp(e,r,o,n){o==="horizontal"?f(e,r,n,1):f(e,r,1,n);}function uT(e,r,o){o.fg===void 0&&o.bg===void 0||J(e,r,{fg:o.fg!==void 0?v(o.fg):void 0,bg:o.bg!==void 0?v(o.bg):void 0});}function Wo(e,r,o={}){let n=Zp.parse(o),t=r,i$1=n.orientation??"horizontal",a=n.length??Ka,s$1=n.char??(i$1==="horizontal"?Mr:Ya);at.isLine[t]=1,at.orientation[t]=i$1==="horizontal"?0:1,at.length[t]=a,Un.set(t,s$1),lT(e,t,n),Jp(e,t,i$1,a),uT(e,t,n),q$1(e,t,{focusable:false});let l={eid:t,show(){return P(e,t,true),l},hide(){return P(e,t,false),l},move(u,d){return M$1(e,t,u,d),M(e,t),l},setPosition(u,d){return H(e,t,u,d),M(e,t),l},setChar(u){return Un.set(t,u),M(e,t),l},getChar(){return Un.get(t)??Mr},getOrientation(){return at.orientation[t]===0?"horizontal":"vertical"},setLength(u){at.length[t]=u;let d=at.orientation[t]===0?"horizontal":"vertical";return Jp(e,t,d,u),M(e,t),l},getLength(){return at.length[t]},focus(){return u(e,t),l},blur(){return v$1(e,t),l},isFocused(){return s(e,t)},append(u){return d$1(e,t,u),l},getChildren(){return f$1(e,t)},destroy(){at.isLine[t]=0,at.orientation[t]=0,at.length[t]=0,Un.delete(t),i(e,t);}};return l}function Ed(e,r){return at.isLine[r]===1}function Md(e,r){return Un.get(r)??Mr}function Bd(e,r,o){return Un.set(r,o),M(e,r),r}function Pd(e,r){return at.orientation[r]===0?"horizontal":"vertical"}function Fd(){at.isLine.fill(0),at.orientation.fill(0),at.length.fill(0),Un.clear();}var ey=Object.freeze({create:Wo,is:Ed,getChar:Md,setChar:Bd,getOrientation:Pd,resetStore:Fd,DEFAULT_HORIZONTAL_CHAR:Mr,DEFAULT_VERTICAL_CHAR:Ya,DEFAULT_LINE_LENGTH:Ka});var dT=z.object({label:z.string(),data:z.array(z.number()),color:z.union([z.string(),z.number()]).optional()}),ty=z.object({x:z.number().int().default(0),y:z.number().int().default(0),width:z.number().int().positive().default(60),height:z.number().int().positive().default(20),series:z.array(dT).default([]),xLabels:z.array(z.string()).optional(),yLabel:z.string().optional(),xLabel:z.string().optional(),showLegend:z.boolean().default(false),showGrid:z.boolean().default(true),fg:z.union([z.string(),z.number()]).optional(),bg:z.union([z.string(),z.number()]).optional(),minY:z.number().optional(),maxY:z.number().optional()}),Dd=1e4,Mt={isLineChart:new Uint8Array(Dd),showLegend:new Uint8Array(Dd),showGrid:new Uint8Array(Dd)},vn=new Map;function cT(e){let r=Number.POSITIVE_INFINITY,o=Number.NEGATIVE_INFINITY;for(let n of e)for(let t of n.data)t<r&&(r=t),t>o&&(o=t);return {minY:r,maxY:o}}function gT(e){let r=e.minY??Number.POSITIVE_INFINITY,o=e.maxY??Number.NEGATIVE_INFINITY;if(e.minY===void 0||e.maxY===void 0){let n=cT(e.series);r=n.minY,o=n.maxY;}return r===Number.POSITIVE_INFINITY&&(r=0),o===Number.NEGATIVE_INFINITY&&(o=100),{minY:r,maxY:o}}function mT(e,r,o,n){let a=o&&n>0?2:0,s=r-2-a,l=e-8,u=s*4;return {yAxisWidth:8,xAxisHeight:2,legendHeight:a,chartHeight:s,chartWidth:l,pixelHeight:u}}function fT(e){let r=0;for(let o of e)o.data.length>r&&(r=o.data.length);return r}function bT(e,r,o,n,t,i,a){let s=Math.floor(e/(a-1||1)*(t*2-1)),l=Math.floor(s/2),u=s%2,d=Math.round(it(r,o,n,i-1,0)),b=Math.floor(d/4),m=d%4;return {charX:l,charY:b,col:u,row:m}}function pT(e,r,o,n,t,i,a){if(r<0||r>=i||o<0||o>=a)return;let s=un[t];if(!s)return;let l=s[n]??0,u=e[o];u&&u[r]!==void 0&&(u[r]|=l);}function yT(e,r,o,n,t,i,a,s){for(let l of r)if(l.data.length!==0)for(let u=0;u<l.data.length;u++){let d=l.data[u]??0,b=bT(u,d,o,n,t,a,s);pT(e,b.charX,b.charY,b.col,b.row,t,i);}}function hT(e,r,o,n,t,i,a,s){let l=[];for(let u=0;u<r;u++){let d=r-u-1,b=it(d,0,r-1,t,i),m=a.find(h=>Math.abs(h-b)<(i-t)/r),g=`${m!==void 0?In(m,n-2):" ".repeat(n-2)}\u2502`,p=e[u];if(p)for(let h=0;h<o;h++){let E=p[h]??10240;g+=String.fromCharCode(E);}l.push(g.padEnd(s," "));}return l}function xT(e,r,o,n,t){let i=[],a=`${" ".repeat(e)}\u2514${"\u2500".repeat(r-1)}`;if(i.push(a.padEnd(o," ")),n.length>0){let s=`${" ".repeat(e)} `,l=Math.max(1,Math.floor(t/5));for(let u=0;u<t;u+=l){let d=n[u]??u.toString();s+=d.slice(0,8).padEnd(8," ");}i.push(s.padEnd(o," "));}else i.push(" ".repeat(o));return i}function ST(e,r,o,n){let t=[];if(e&&r.length>0){let i="Legend: ";for(let a=0;a<r.length;a++){let s=r[a];s&&(i+=`${s.label} `);}t.push(i.padEnd(n," ")),o>1&&t.push(" ".repeat(n));}return t}function CT(e,r,o,n,t){let{minY:i,maxY:a}=gT(e),s=mT(r,o,t,e.series.length),l=fT(e.series),u=An(i,a,5),d=Array.from({length:s.chartHeight},()=>Array(s.chartWidth).fill(10240));yT(d,e.series,i,a,s.chartWidth,s.chartHeight,s.pixelHeight,l);let b=hT(d,s.chartHeight,s.chartWidth,s.yAxisWidth,i,a,u,r),m=xT(s.yAxisWidth,s.chartWidth,r,e.xLabels,l),c=ST(t,e.series,s.legendHeight,r);return [...b,...m,...c].join(`
|
|
13
|
+
`)}function Qa(e,r){let o=vn.get(r);if(!o)return;let n=g(e,r);if(!n)return;let t=Mt.showGrid[r]===1,i=Mt.showLegend[r]===1,a=CT(o,n.width,n.height,t,i);e$1(e,r,a),M(e,r);}function Ad(e,r={}){let o=ty.parse(r),n=h(e);H(e,n,o.x,o.y),f(e,n,o.width,o.height),Mt.isLineChart[n]=1,Mt.showLegend[n]=o.showLegend?1:0,Mt.showGrid[n]=o.showGrid?1:0,vn.set(n,{series:o.series.map((i,a)=>({label:i.label,data:[...i.data],color:i.color?v(i.color):It(a)})),xLabels:o.xLabels?[...o.xLabels]:[],yLabel:o.yLabel??"",xLabel:o.xLabel??"",minY:o.minY,maxY:o.maxY}),(o.fg!==void 0||o.bg!==void 0)&&J(e,n,{fg:o.fg!==void 0?v(o.fg):void 0,bg:o.bg!==void 0?v(o.bg):void 0}),Qa(e,n);let t={eid:n,setSeries(i){let a=vn.get(n);return a&&(a.series=i.map((s,l)=>({label:s.label,data:[...s.data],color:s.color?v(s.color):It(l)})),Qa(e,n)),t},getSeries(){return vn.get(n)?.series??[]},appendToSeries(i,a){let s=vn.get(n);if(s?.series[i]){let l=s.series[i];l&&(l.data.push(a),Qa(e,n));}return t},clear(){let i=vn.get(n);if(i){for(let a of i.series)a.data.length=0;Qa(e,n);}return t},setPosition(i,a){return H(e,n,i,a),M(e,n),t},destroy(){Mt.isLineChart[n]=0,Mt.showLegend[n]=0,Mt.showGrid[n]=0,vn.delete(n),i(e,n);}};return t}function Id(e,r){return Mt.isLineChart[r]===1}function kd(){Mt.isLineChart.fill(0),Mt.showLegend.fill(0),Mt.showGrid.fill(0),vn.clear();}var ny=Object.freeze({create:Ad,is:Id,resetStore:kd});var ry=Object.freeze({create:Rn,is:ou});var Gn=1e4,TT=z.object({text:z.string(),key:z.string().optional(),callback:z.function().optional(),value:z.string().optional()}),dy=z.object({x:z.number().int().default(0),y:z.number().int().default(0),width:z.number().int().positive().optional(),items:z.array(TT).default([]),selected:z.number().int().min(-1).default(0),style:z.object({item:z.object({fg:z.number().optional(),bg:z.number().optional()}).optional(),selected:z.object({fg:z.number().optional(),bg:z.number().optional()}).optional(),prefix:z.object({fg:z.number().optional(),bg:z.number().optional()}).optional(),separator:z.string().optional()}).optional(),autoCommandKeys:z.boolean().default(true),mouse:z.boolean().default(true),keys:z.boolean().default(true)}),N={isListbar:new Uint8Array(Gn),selectedIndex:new Int32Array(Gn).fill(-1),itemCount:new Uint32Array(Gn),state:new Uint8Array(Gn),autoCommandKeys:new Uint8Array(Gn),mouse:new Uint8Array(Gn),keys:new Uint8Array(Gn)},Bt=new Map,dn=new Map,Lo=new Map,Eo=new Map,oy=3435973887,iy=255,ay=255,sy=16777215,ly=4294902015,uy=255,vo=" | ",WT={0:"idle",1:"focused"};function Rd(){N.isListbar.fill(0),N.selectedIndex.fill(-1),N.itemCount.fill(0),N.state.fill(0),N.autoCommandKeys.fill(0),N.mouse.fill(0),N.keys.fill(0),Bt.clear(),dn.clear(),Lo.clear(),Eo.clear();}function Mo(e,r,o={}){let n=dy.parse(o),t=r;N.isListbar[t]=1,H(e,t,n.x,n.y),N.autoCommandKeys[t]=n.autoCommandKeys?1:0,N.mouse[t]=n.mouse?1:0,N.keys[t]=n.keys?1:0;let i$1=[...n.items];Bt.set(t,i$1),N.itemCount[t]=i$1.length,n.selected>=0&&n.selected<i$1.length?N.selectedIndex[t]=n.selected:i$1.length>0&&(N.selectedIndex[t]=0);let a={itemFg:n.style?.item?.fg??oy,itemBg:n.style?.item?.bg??iy,selectedFg:n.style?.selected?.fg??ay,selectedBg:n.style?.selected?.bg??sy,prefixFg:n.style?.prefix?.fg??ly,prefixBg:n.style?.prefix?.bg??uy,separator:n.style?.separator??vo};dn.set(t,a);let s=()=>{let c=Bt.get(t)??[],p=dn.get(t)?.separator??vo,h=0;for(let E=0;E<c.length;E++){let C=c[E];if(C){let M=u(C,E,N.autoCommandKeys[t]===1);h+=M.length+C.text.length;}E<c.length-1&&(h+=p.length);}return h},l=n.width??s();f(e,t,l,1),Lo.set(t,new Set),Eo.set(t,new Set);function u(c,g,p){return c.key?`[${c.key}]`:p&&g<9?`[${g+1}]`:""}let d=()=>{let c=N.selectedIndex[t]??-1,p=(Bt.get(t)??[])[c];if(p&&c>=0){let h=Lo.get(t);if(h)for(let E of h)E(c,p);}},b=()=>{let c=N.selectedIndex[t]??-1,p=(Bt.get(t)??[])[c];if(p&&c>=0){p.callback&&p.callback();let h=Eo.get(t);if(h)for(let E of h)E(c,p);}},m={eid:t,show(){return P(e,t,true),m},hide(){return P(e,t,false),m},move(c,g){return G.x[t]=(G.x[t]??0)+c,G.y[t]=(G.y[t]??0)+g,M(e,t),m},setPosition(c,g){return H(e,t,c,g),m},focus(){return N.state[t]=1,M(e,t),m},blur(){return N.state[t]=0,M(e,t),m},setItems(c){let g=[...c];return Bt.set(t,g),N.itemCount[t]=g.length,(N.selectedIndex[t]??-1)>=g.length&&(N.selectedIndex[t]=Math.max(0,g.length-1)),M(e,t),m},getItems(){return Bt.get(t)??[]},addItem(c){let g=Bt.get(t)??[];return g.push(c),N.itemCount[t]=g.length,M(e,t),m},removeItem(c){let g=Bt.get(t)??[];if(c>=0&&c<g.length){g.splice(c,1),N.itemCount[t]=g.length;let p=N.selectedIndex[t]??-1;p>=g.length?N.selectedIndex[t]=Math.max(0,g.length-1):p>c&&(N.selectedIndex[t]=p-1),M(e,t);}return m},getItemCount(){return N.itemCount[t]??0},select(c){let g=N.itemCount[t]??0;return c>=0&&c<g&&N.selectedIndex[t]!==c&&(N.selectedIndex[t]=c,M(e,t),d()),m},getSelectedIndex(){return N.selectedIndex[t]??-1},getSelectedItem(){let c=N.selectedIndex[t]??-1;return (Bt.get(t)??[])[c]},selectPrev(){let c=N.selectedIndex[t]??0,g=N.itemCount[t]??0;if(g>0){let p=c<=0?g-1:c-1;m.select(p);}return m},selectNext(){let c=N.selectedIndex[t]??0,g=N.itemCount[t]??0;if(g>0){let p=c>=g-1?0:c+1;m.select(p);}return m},selectFirst(){return (N.itemCount[t]??0)>0&&m.select(0),m},selectLast(){let c=N.itemCount[t]??0;return c>0&&m.select(c-1),m},selectByKey(c){let g=Bt.get(t)??[],p=N.autoCommandKeys[t]===1;for(let h=0;h<g.length;h++)if(g[h]?.key?.toLowerCase()===c.toLowerCase())return m.select(h),true;if(p){let h=Number.parseInt(c,10);if(h>=1&&h<=9&&h<=g.length)return m.select(h-1),true}return false},activate(){return b(),m},getState(){let c=N.state[t]??0;return WT[c]??"idle"},setStyle(c){let g=dn.get(t)??{itemFg:oy,itemBg:iy,selectedFg:ay,selectedBg:sy,prefixFg:ly,prefixBg:uy,separator:vo};return c.item?.fg!==void 0&&(g.itemFg=c.item.fg),c.item?.bg!==void 0&&(g.itemBg=c.item.bg),c.selected?.fg!==void 0&&(g.selectedFg=c.selected.fg),c.selected?.bg!==void 0&&(g.selectedBg=c.selected.bg),c.prefix?.fg!==void 0&&(g.prefixFg=c.prefix.fg),c.prefix?.bg!==void 0&&(g.prefixBg=c.prefix.bg),c.separator!==void 0&&(g.separator=c.separator),dn.set(t,g),M(e,t),m},getSeparator(){return dn.get(t)?.separator??vo},setSeparator(c){let g=dn.get(t);return g&&(g.separator=c,M(e,t)),m},renderLine(){let c=Bt.get(t)??[],g=N.selectedIndex[t]??-1,p=N.autoCommandKeys[t]===1,E=dn.get(t)?.separator??vo,C=[];for(let M=0;M<c.length;M++){let P=c[M];if(!P)continue;let I=u(P,M,p),L=M===g,_=I+P.text;L?C.push(`[${_}]`):C.push(` ${_} `);}return C.join(E)},calculateWidth(){return s()},onSelect(c){let g=Lo.get(t);return g&&g.add(c),()=>{g?.delete(c);}},onActivate(c){let g=Eo.get(t);return g&&g.add(c),()=>{g?.delete(c);}},handleKey(c){let g=N.state[t]??0,p=N.keys[t]===1;if(g!==1||!p)return null;switch(c.toLowerCase()){case "left":case "h":return m.selectPrev(),{type:"selectPrev"};case "right":case "l":return m.selectNext(),{type:"selectNext"};case "home":return m.selectFirst(),{type:"selectFirst"};case "end":return m.selectLast(),{type:"selectLast"};case "enter":case " ":return m.activate(),{type:"confirm"};case "escape":return m.blur(),{type:"cancel"}}return m.selectByKey(c)?{type:"selectByKey",key:c}:null},destroy(){N.isListbar[t]=0,N.selectedIndex[t]=-1,N.itemCount[t]=0,N.state[t]=0,Bt.delete(t),dn.delete(t),Lo.delete(t),Eo.delete(t),i(e,t);}};return m}function Od(e,r){return N.isListbar[r]===1}var cy=Object.freeze({create:Mo,is:Od,resetStore:Rd});var fy=z.object({x:z.number().int().default(0),y:z.number().int().default(0),width:z.number().int().positive().optional(),height:z.number().int().positive().default(10),data:z.array(z.array(z.string())).default([]),pad:z.number().int().min(0).max(10).default(1),align:z.enum(["left","center","right"]).default("left"),style:z.object({border:z.object({fg:z.number().optional(),bg:z.number().optional()}).optional(),header:z.object({fg:z.number().optional(),bg:z.number().optional()}).optional(),cell:z.object({fg:z.number().optional(),bg:z.number().optional()}).optional(),selected:z.object({fg:z.number().optional(),bg:z.number().optional()}).optional(),altRowBg:z.number().optional()}).optional(),cellBorders:z.boolean().default(true),headerRows:z.number().int().min(0).max(10).default(1),columns:z.array(z.object({header:z.string(),width:z.number().int().positive().optional(),minWidth:z.number().int().positive().optional(),maxWidth:z.number().int().positive().optional(),align:z.enum(["left","center","right"]).optional()})).optional(),selected:z.number().int().min(-1).default(0),interactive:z.boolean().default(true),mouse:z.boolean().default(true),keys:z.boolean().default(true),search:z.boolean().default(false)});function gy(e,r){let o=[];for(let n=r;n<e.length;n++){let t=e[n];if(t){let i=t[0]??"";o.push({text:i,value:t.join(" ")});}}return o}function my(e){let r=e.border?.fg,o=e.border?.bg,n=e.header?.fg,t=e.header?.bg,i=e.cell?.fg,a=e.cell?.bg,s=e.altRowBg,l=e.selected?.fg,u=e.selected?.bg;return {...r!==void 0?{borderFg:r}:{},...o!==void 0?{borderBg:o}:{},...n!==void 0?{headerFg:n}:{},...t!==void 0?{headerBg:t}:{},...i!==void 0?{cellFg:i}:{},...a!==void 0?{cellBg:a}:{},...s!==void 0?{altRowBg:s}:{},...l!==void 0?{selectedFg:l}:{},...u!==void 0?{selectedBg:u}:{}}}function Bo(e,r,o={}){let n=fy.parse(o),t=r;H(e,t,n.x,n.y),n.width!==void 0&&f(e,t,n.width,n.height),xb$1(e,t,{headerRows:n.headerRows,pad:n.pad,cellBorders:n.cellBorders}),n.data.length>0&&Ab$1(e,t,n.data),n.columns&&Ob$1(e,t,n.columns),n.style&&Ub$1(e,t,my(n.style));let i$1=gy(n.data,n.headerRows);ga$1(e,t,i$1,{interactive:n.interactive,mouse:n.mouse,keys:n.keys,search:n.search,selectedIndex:n.selected,visibleCount:Math.max(1,n.height-n.headerRows)});let a=()=>{let l=Cb$1(e,t),u=Tb$1(e,t),d=gy(l,u);q$2(e,t,d);},s={eid:t,show(){return P(e,t,true),s},hide(){return P(e,t,false),s},move(l,u){return G.x[t]=(G.x[t]??0)+l,G.y[t]=(G.y[t]??0)+u,M(e,t),s},setPosition(l,u){return H(e,t,l,u),s},focus(){return na(e,t),s},blur(){return oa(e,t),s},setData(l){return Ab$1(e,t,l),a(),s},getData(){return Cb$1(e,t)},getFullData(){return Bb$1(e,t)},clearData(){return Nb$1(e,t),a(),s},setCell(l,u,d){return Db$1(e,t,l,u,d),a(),s},getCell(l,u){return Eb$1(e,t,l,u)},getCellValue(l,u){return Fb$1(e,t,l,u)},getRow(l){return Gb$1(e,t,l)},getRowCount(){return Ib$1(e,t)},getDataRowCount(){return Math.max(0,Ib$1(e,t)-Tb$1(e,t))},setColumns(l){return Ob$1(e,t,l),s},getColumns(){return Pb$1(e,t)},getColCount(){return Jb$1(e,t)},setHeaderRowCount(l){return Sb$1(e,t,l),a(),s},getHeaderRowCount(){return Tb$1(e,t)},getHeaderRows(){return Qb$1(e,t)},getDataRows(){return Rb$1(e,t)},setCellPadding(l){return Yb$1(e,t,l),s},getCellPadding(){return Xb$1(e,t)},setCellBorders(l){return _b$1(e,t,l),s},hasCellBorders(){return Zb$1(e,t)},setStyle(l){return Ub$1(e,t,my(l)),M(e,t),s},getDisplay(){return Vb$1(e,t)},select(l){return U(e,t,l),s},getSelectedIndex(){return S(e,t)},getSelectedRow(){let l=S(e,t);if(l<0)return;let u=Tb$1(e,t);return Gb$1(e,t,u+l)},selectPrev(){return V(e,t),s},selectNext(){return W(e,t),s},selectFirst(){return X(e,t),s},selectLast(){return Y(e,t),s},activate(){return $(e,t),s},pageUp(){return C(e,t,-1),s},pageDown(){return C(e,t,1),s},startSearch(){return Na$1(e,t),s},endSearch(){return Oa$1(e,t),s},getSearchQuery(){return Pa$1(e,t)},isSearching(){return Ma$1(e,t)},getState(){return ia(e,t)},onSelect(l){return aa(e,t,l)},onActivate(l){return ba$1(e,t,l)},onSearchChange(l){return Wa$1(e,t,l)},handleKey(l){let u=Xa$1(e,t,l);if(u)switch(u.type){case "selectPrev":V(e,t);break;case "selectNext":W(e,t);break;case "selectFirst":X(e,t);break;case "selectLast":Y(e,t);break;case "pageUp":C(e,t,-1);break;case "pageDown":C(e,t,1);break;case "confirm":$(e,t);break;case "cancel":oa(e,t);break;case "startSearch":Na$1(e,t);break;case "endSearch":Oa$1(e,t);break;case "searchChar":Ra$1(e,t,u.char);break;case "searchBackspace":Sa$1(e,t);break;case "searchNextMatch":Va$1(e,t);break}return u},destroy(){ea(e,t),Ta$1(e,t),zb$1(e,t),i(e,t);}};return s}function Vd(e,r){return yb$1(e,r)}var by=Object.freeze({create:Bo,is:Vd});var _d=4294967295,zd=0,py=z.object({fg:z.number().int().optional(),bg:z.number().int().optional()}),yy=z.object({x:z.number().int().default(0),y:z.number().int().default(0),message:z.string().default("Loading..."),spinnerChars:z.array(z.string()).readonly().optional(),interval:z.number().int().positive().default(100),style:py.optional(),width:z.number().int().positive().optional(),visible:z.boolean().default(true)}),Hn=new Map,Br=new Map;function Pr(e,r={}){let o=yy.parse(r),n=h(e);H(e,n,o.x,o.y);let t=o.message,i=o.spinnerChars??_a$1,a=Math.max(...i.map(l=>l.length)),s=o.width??t.length+a+1;return f(e,n,s,1),eb(e,n,{frames:i,interval:o.interval}),Hn.set(n,t),Br.set(n,o.visible),Po(e,n),o.visible||P(e,n,false),vT(e,n)}function vT(e,r){let o={get eid(){return r},show(){return Br.set(r,true),P(e,r,true),M(e,r),o},hide(){return Br.set(r,false),P(e,r,false),M(e,r),o},isVisible(){return Br.get(r)??false},move(n,t){let i=G.x[r]??0,a=G.y[r]??0;return H(e,r,i+n,a+t),M(e,r),o},setPosition(n,t){return H(e,r,n,t),M(e,r),o},getPosition(){return {x:G.x[r]??0,y:G.y[r]??0}},setMessage(n){return Hn.set(r,n),Po(e,r),M(e,r),o},getMessage(){return Hn.get(r)??""},setSpinnerChars(n){return kb$1(e,r,n),Po(e,r),M(e,r),o},setInterval(n){return jb$1(e,r,n),o},getSpinnerChar(){return hb$1(e,r)},reset(){return nb(e,r),Po(e,r),M(e,r),o},destroy(){fb$1(e,r),Hn.delete(r),Br.delete(r),i(e,r);}};return o}function Po(e,r){let o=Hn.get(r)??"",t=`${hb$1(e,r)} ${o}`;e$1(e,r,t);}function Nd(e,r,o={}){return Pr(e,{...o,message:r,visible:true})}function Ud(e){e.destroy();}function Gd(e,r){e.setMessage(r);}function qa(e,r){return gb$1(e,r)&&Hn.has(r)}function Hd(e,r,o){if(!qa(e,r))return false;let n=mb$1(e,r,o);return n&&(Po(e,r),M(e,r)),n}function wd(){Hn.clear(),Br.clear();}var hy=Object.freeze({create:Pr,is:qa,show:Nd,hide:Ud,setMessage:Gd,updateAnimation:Hd,resetStore:wd,DEFAULT_LOADING_BG:zd,DEFAULT_LOADING_FG:_d});var xy=z.union([z.number(),z.string().regex(/^\d+(\.\d+)?%$/,'Percentage must be in format "50%"'),z.literal("auto")]),Xa=z.union([z.number(),z.string().regex(/^\d+(\.\d+)?%$/,'Percentage must be in format "50%"'),z.enum(["center","left","right","top","bottom"])]),LT=z.object({type:z.enum(["line","bg","none"]).optional(),fg:z.union([z.string(),z.number()]).optional(),bg:z.union([z.string(),z.number()]).optional(),ch:z.union([z.enum(["single","double","rounded","bold","ascii"]),z.custom(e=>typeof e=="object"&&e!==null&&"topLeft"in e&&"topRight"in e&&"bottomLeft"in e&&"bottomRight"in e&&"horizontal"in e&&"vertical"in e)]).optional()}).optional(),ET=z.union([z.number().int().nonnegative(),z.object({left:z.number().int().nonnegative().optional(),top:z.number().int().nonnegative().optional(),right:z.number().int().nonnegative().optional(),bottom:z.number().int().nonnegative().optional()})]).optional(),MT=z.union([z.boolean(),z.object({mode:z.enum(["auto","visible","hidden"]).optional(),fg:z.union([z.string(),z.number()]).optional(),bg:z.union([z.string(),z.number()]).optional(),trackChar:z.string().optional(),thumbChar:z.string().optional()})]).optional(),Wy=z.object({left:Xa.optional(),top:Xa.optional(),right:Xa.optional(),bottom:Xa.optional(),width:xy.optional(),height:xy.optional(),fg:z.union([z.string(),z.number()]).optional(),bg:z.union([z.string(),z.number()]).optional(),border:LT,padding:ET,scrollbar:MT,mouse:z.boolean().optional(),keys:z.boolean().optional(),scrollback:z.number().int().positive().optional(),scrollOnInput:z.boolean().optional(),timestamps:z.boolean().optional(),timestampFormat:z.string().optional()}),wn=1e4,ue={isLog:new Uint8Array(wn),mouseEnabled:new Uint8Array(wn),keysEnabled:new Uint8Array(wn),scrollOnInput:new Uint8Array(wn),timestamps:new Uint8Array(wn),scrollback:new Uint32Array(wn),lineCount:new Uint32Array(wn)},Ln=new Map;function BT(e){switch(e){case "single":return b;case "double":return c;case "rounded":return d$2;case "bold":return e$2;case "ascii":return f$3}}function PT(e){switch(e){case "line":return 1;case "bg":return 2;case "none":return 0}}function Sy(e){return e===void 0?0:typeof e=="number"?e:0}function Cy(e){return e===void 0||typeof e=="string"&&e==="auto"?"auto":e}function FT(e){switch(e){case "auto":return 2;case "visible":return 1;case "hidden":return 0}}function DT(...e){if(e.length===0)return "";if(e.length===1)return String(e[0]);let r=String(e[0]),o=1;return r.replace(/%([sdfjioO%])/g,(n,t)=>{if(t==="%")return "%";if(o>=e.length)return n;let i=e[o++];switch(t){case "s":return String(i);case "d":case "i":return typeof i=="number"?Math.floor(i).toString():"NaN";case "f":return typeof i=="number"?i.toString():"NaN";case "j":case "o":case "O":try{return JSON.stringify(i)}catch{return "[Circular]"}default:return n}})}function AT(e){return h$4(new Date,e)}function Ty(e,r){let o=Ln.get(r);if(!o)return;let n=o.lines.join(`
|
|
14
|
+
`);e$1(e,r,n);let t=o.lines.length;Ue(e,r,0,t),ue.lineCount[r]=t,M(e,r);}function IT(e){let r=Ln.get(e);if(!r)return;let o=ue.scrollback[e]??0;if(o!==0)for(;r.lines.length>o;)r.lines.shift();}function kT(e,r){ue.isLog[e]=1,ue.scrollback[e]=r.scrollback??1e3,ue.scrollOnInput[e]=r.scrollOnInput!==false?1:0,ue.timestamps[e]=r.timestamps?1:0,ue.mouseEnabled[e]=r.mouse!==false?1:0,ue.keysEnabled[e]=r.keys!==false?1:0,ue.lineCount[e]=0,Ln.set(e,{lines:[],timestampFormat:r.timestampFormat??"HH:mm:ss"});}function RT(e,r,o){let n=Sy(o.left),t=Sy(o.top);H(e,r,n,t);let i=Cy(o.width),a=Cy(o.height);f(e,r,i,a);}function OT(e,r,o){o.fg===void 0&&o.bg===void 0||J(e,r,{fg:o.fg!==void 0?v(o.fg):void 0,bg:o.bg!==void 0?v(o.bg):void 0});}function VT(e,r,o){let n=o.type?PT(o.type):1;if(l(e,r,{type:n,fg:o.fg!==void 0?v(o.fg):void 0,bg:o.bg!==void 0?v(o.bg):void 0}),o.ch){let t=typeof o.ch=="string"?BT(o.ch):o.ch;m$1(e,r,t);}}function _T(e,r,o){typeof o=="number"?d(e,r,{left:o,top:o,right:o,bottom:o}):d(e,r,o);}function zT(e,r,o){let n=2;o.scrollbar===false?n=0:typeof o.scrollbar=="object"&&o.scrollbar.mode&&(n=FT(o.scrollbar.mode)),Le$1(e,r,{alwaysScroll:true,scrollbarVisible:n});}function jd(e,r,o={}){let n=Wy.parse(o),t=r;kT(t,n),RT(e,t,n),OT(e,t,n),n.border&&VT(e,t,n.border),n.padding!==void 0&&_T(e,t,n.padding),zT(e,t,n),q$1(e,t,{focusable:true}),e$1(e,t,"");let i$1={eid:t,log(...a){let s=Ln.get(t);if(!s)return i$1;let l=DT(...a);return ue.timestamps[t]===1&&(l=`[${AT(s.timestampFormat)}] ${l}`),s.lines.push(l),IT(t),Ty(e,t),ue.scrollOnInput[t]===1&&Ze(e,t),i$1},clear(){let a=Ln.get(t);return a&&(a.lines=[],ue.lineCount[t]=0,Ty(e,t),Ye$1(e,t)),i$1},getLines(){let a=Ln.get(t);return a?[...a.lines]:[]},getLineCount(){return ue.lineCount[t]??0},show(){return P(e,t,true),i$1},hide(){return P(e,t,false),i$1},move(a,s){return M$1(e,t,a,s),M(e,t),i$1},setPosition(a,s){return H(e,t,a,s),M(e,t),i$1},focus(){return u(e,t),i$1},blur(){return v$1(e,t),i$1},isFocused(){return s(e,t)},append(a){return d$1(e,t,a),i$1},getChildren(){return f$1(e,t)},scrollTo(a,s){return Pe$1(e,t,a,s),M(e,t),i$1},scrollBy(a,s){return Oe(e,t,a,s),M(e,t),i$1},setScrollPerc(a,s){return Re(e,t,a,s),M(e,t),i$1},getScrollPerc(){return Qe$1(e,t)},getScroll(){return Ne$1(e,t)},setViewport(a,s){return Ve$1(e,t,a,s),M(e,t),i$1},getScrollable(){return Se$1(e,t)},scrollToTop(){return Ye$1(e,t),M(e,t),i$1},scrollToBottom(){return Ze(e,t),M(e,t),i$1},scrollToLeft(){return _e(e,t),M(e,t),i$1},scrollToRight(){return $e$1(e,t),M(e,t),i$1},canScroll(){return af(e,t)},canScrollX(){return bf(e,t)},canScrollY(){return cf(e,t)},isAtTop(){return df(e,t)},isAtBottom(){return ef(e,t)},isAtLeft(){return ff(e,t)},isAtRight(){return gf(e,t)},destroy(){ue.isLog[t]=0,ue.mouseEnabled[t]=0,ue.keysEnabled[t]=0,ue.scrollOnInput[t]=0,ue.timestamps[t]=0,ue.scrollback[t]=0,ue.lineCount[t]=0,Ln.delete(t),i(e,t);}};return i$1}function $d(e,r){return ue.isLog[r]===1}function Yd(e,r){return ue.mouseEnabled[r]===1}function Kd(e,r){return ue.keysEnabled[r]===1}function Qd(e,r){return ue.scrollback[r]??0}function qd(){ue.isLog.fill(0),ue.mouseEnabled.fill(0),ue.keysEnabled.fill(0),ue.scrollOnInput.fill(0),ue.timestamps.fill(0),ue.scrollback.fill(0),ue.lineCount.fill(0),Ln.clear();}var vy=Object.freeze({create:jd,is:$d,getScrollback:Qd,isKeysScrollEnabled:Kd,isMouseScrollEnabled:Yd,resetStore:qd});var Ly=z.union([z.number(),z.string().regex(/^\d+(\.\d+)?%$/,'Percentage must be in format "50%"'),z.enum(["center","left","right","top","bottom"])]),NT=z.object({type:z.enum(["line","bg","none"]).optional(),fg:z.union([z.string(),z.number()]).optional(),bg:z.union([z.string(),z.number()]).optional(),ch:z.union([z.enum(["single","double","rounded","bold","ascii"]),z.custom(e=>typeof e=="object"&&e!==null&&"topLeft"in e&&"topRight"in e&&"bottomLeft"in e&&"bottomRight"in e&&"horizontal"in e&&"vertical"in e)]).optional()}).optional(),Ja=z.object({fg:z.union([z.string(),z.number()]).optional(),bg:z.union([z.string(),z.number()]).optional(),borderFg:z.union([z.string(),z.number()]).optional()}).optional(),Ey=z.object({left:Ly.optional(),top:Ly.optional(),width:z.number().int().positive().optional(),height:z.number().int().positive().optional(),content:z.string().optional(),timeout:z.number().int().nonnegative().optional(),dismissOnClick:z.boolean().optional(),dismissOnKey:z.boolean().optional(),type:z.enum(["info","warning","error","success"]).optional(),fg:z.union([z.string(),z.number()]).optional(),bg:z.union([z.string(),z.number()]).optional(),border:NT,padding:z.number().int().nonnegative().optional(),infoStyle:Ja,warningStyle:Ja,errorStyle:Ja,successStyle:Ja}),es=3e3,Fo=1,ts={info:{fg:"#ffffff",bg:"#2196f3",borderFg:"#64b5f6"},warning:{fg:"#000000",bg:"#ff9800",borderFg:"#ffb74d"},error:{fg:"#ffffff",bg:"#f44336",borderFg:"#e57373"},success:{fg:"#ffffff",bg:"#4caf50",borderFg:"#81c784"}},Za=1e4,Fe={isMessage:new Uint8Array(Za),dismissOnClick:new Uint8Array(Za),dismissOnKey:new Uint8Array(Za),dismissed:new Uint8Array(Za)},Ot=new Map;function UT(e){switch(e){case "single":return b;case "double":return c;case "rounded":return d$2;case "bold":return e$2;case "ascii":return f$3}}function GT(e){switch(e){case "line":return 1;case "bg":return 2;case "none":return 0}}function My(e,r){return {info:r.infoStyle,warning:r.warningStyle,error:r.errorStyle,success:r.successStyle}[e]??ts[e]}function HT(e,r){let o=e.split(`
|
|
15
|
+
`),n=Math.max(...o.map(s=>s.length),10),t=o.length,i=n+r*2+2,a=t+r*2+2;return {width:i,height:a}}function wT(e,r){Fe.isMessage[e]=1,Fe.dismissOnClick[e]=r.dismissOnClick!==false?1:0,Fe.dismissOnKey[e]=r.dismissOnKey!==false?1:0,Fe.dismissed[e]=0,Ot.set(e,{content:r.content??""});}function jT(e,r,o){let n=o.content??"",t=o.padding??Fo,{width:i,height:a}=HT(n,t),s=o.width??i,l=o.height??a;f(e,r,s,l);let u=0,d=0;o.left!==void 0&&(typeof o.left=="number"?u=o.left:o.left==="center"&&(u=0)),o.top!==void 0&&(typeof o.top=="number"?d=o.top:o.top==="center"&&(d=0)),H(e,r,u,d);}function $T(e,r,o){let n=o.type??"info",t=My(n,o),i=o.fg??t.fg,a=o.bg??t.bg;(i!==void 0||a!==void 0)&&J(e,r,{fg:i!==void 0?v(i):void 0,bg:a!==void 0?v(a):void 0});}function YT(e,r,o){let n=o.type??"info",t=My(n,o),i=o.border?.type?GT(o.border.type):1,a=o.border?.fg??t.borderFg;l(e,r,{type:i,fg:a!==void 0?v(a):void 0,bg:o.border?.bg!==void 0?v(o.border.bg):void 0});let s=o.border?.ch?typeof o.border.ch=="string"?UT(o.border.ch):o.border.ch:d$2;m$1(e,r,s);}function KT(e,r,o){let n=o.content??"";e$1(e,r,n,{align:1,valign:1});}function QT(e,r,o,n){let t=o.timeout??es;if(t<=0)return;let i=Ot.get(r);i&&(i.timerId=setTimeout(()=>{n();},t));}function jn(e,r={}){let o=Ey.parse(r),n=h(e);wT(n,o),jT(e,n,o),$T(e,n,o),YT(e,n,o),KT(e,n,o);let t=o.padding??Fo;d(e,n,{left:t,top:t,right:t,bottom:t}),q$1(e,n,{focusable:true});let i$1=()=>{if(Fe.dismissed[n]===1)return;Fe.dismissed[n]=1,P(e,n,false);let s=Ot.get(n);s&&(s.timerId&&(clearTimeout(s.timerId),s.timerId=void 0),s.onDismissCallback&&s.onDismissCallback());};QT(e,n,o,i$1);let a={eid:n,setContent(s){let l=Ot.get(n);return l&&(l.content=s),e$1(e,n,s,{align:1,valign:1}),M(e,n),a},getContent(){return Ot.get(n)?.content??""},show(){return P(e,n,true),a},hide(){return P(e,n,false),a},move(s,l){return M$1(e,n,s,l),M(e,n),a},setPosition(s,l){return H(e,n,s,l),M(e,n),a},center(s,l){let u=g(e,n),d=u?.width??20,b=u?.height??5,m=Math.floor((s-d)/2),c=Math.floor((l-b)/2);return H(e,n,m,c),M(e,n),a},dismiss:i$1,isDismissed(){return Fe.dismissed[n]===1},onDismiss(s){let l=Ot.get(n);return l&&(l.onDismissCallback=s),a},destroy(){let s=Ot.get(n);s?.timerId&&clearTimeout(s.timerId),Fe.isMessage[n]=0,Fe.dismissOnClick[n]=0,Fe.dismissOnKey[n]=0,Fe.dismissed[n]=0,Ot.delete(n),i(e,n);}};return a}function Xd(e,r,o={}){return jn(e,{...o,content:r,type:"info"})}function Jd(e,r,o={}){return jn(e,{...o,content:r,type:"warning"})}function Zd(e,r,o={}){return jn(e,{...o,content:r,type:"error"})}function ec(e,r,o={}){return jn(e,{...o,content:r,type:"success"})}function Do(e,r){return Fe.isMessage[r]===1}function ns(e,r){return Fe.dismissOnClick[r]===1}function rs(e,r){return Fe.dismissOnKey[r]===1}function tc(e,r){if(!Do(e,r)||!ns(e,r)||Fe.dismissed[r]===1)return false;let o=Ot.get(r);return o&&(Fe.dismissed[r]=1,P(e,r,false),o.timerId&&(clearTimeout(o.timerId),o.timerId=void 0),o.onDismissCallback&&o.onDismissCallback()),true}function nc(e,r){if(!Do(e,r)||!rs(e,r)||Fe.dismissed[r]===1)return false;let o=Ot.get(r);return o&&(Fe.dismissed[r]=1,P(e,r,false),o.timerId&&(clearTimeout(o.timerId),o.timerId=void 0),o.onDismissCallback&&o.onDismissCallback()),true}function rc(){for(let e of Ot.values())e.timerId&&clearTimeout(e.timerId);Fe.isMessage.fill(0),Fe.dismissOnClick.fill(0),Fe.dismissOnKey.fill(0),Fe.dismissed.fill(0),Ot.clear();}var By=Object.freeze({create:jn,is:Do,showInfo:Xd,showWarning:Jd,showError:Zd,showSuccess:ec,handleKey:nc,handleClick:tc,isDismissOnKey:rs,isDismissOnClick:ns,resetStore:rc,DEFAULT_MESSAGE_PADDING:Fo,DEFAULT_MESSAGE_STYLES:ts,DEFAULT_MESSAGE_TIMEOUT:es});var oc=1e4,qT=40,XT=10,JT=z.object({type:z.enum(["line","bg","none"]).optional(),fg:z.union([z.string(),z.number()]).optional(),bg:z.union([z.string(),z.number()]).optional(),ch:z.union([z.enum(["single","double","rounded","bold","ascii"]),z.object({}).passthrough()]).optional()}),ZT=z.union([z.number().nonnegative(),z.object({left:z.number().nonnegative().optional(),top:z.number().nonnegative().optional(),right:z.number().nonnegative().optional(),bottom:z.number().nonnegative().optional()})]),Py=z.object({backdrop:z.boolean().optional().default(true),backdropColor:z.union([z.string(),z.number()]).optional().default("#000000"),backdropOpacity:z.number().min(0).max(1).optional().default(.5),closeOnBackdropClick:z.boolean().optional().default(true),closeOnEscape:z.boolean().optional().default(true),width:z.number().int().positive().optional(),height:z.number().int().positive().optional(),left:z.number().int().optional(),top:z.number().int().optional(),fg:z.union([z.string(),z.number()]).optional(),bg:z.union([z.string(),z.number()]).optional(),border:JT.optional(),padding:ZT.optional(),content:z.string().optional()}),Be={isModal:new Uint8Array(oc),isOpen:new Uint8Array(oc),backdropEnabled:new Uint8Array(oc)},Pt=new Map,cn=[];function eW(e){if(typeof e=="object")return e;switch(e){case "double":return c;case "rounded":return d$2;case "bold":return e$2;case "ascii":return f$3;default:return b}}function tW(e){return e==="bg"?2:e==="none"?0:1}function nW(e,r,o){if(typeof o=="number"){d(e,r,{left:o,top:o,right:o,bottom:o});return}if(o){d(e,r,{left:o.left??0,top:o.top??0,right:o.right??0,bottom:o.bottom??0});return}}function rW(e){let r=cn.indexOf(e);r!==-1&&cn.splice(r,1),cn.push(e);}function ic(e){let r=cn.indexOf(e);r!==-1&&cn.splice(r,1);}function oW(e,r,o,n){o===void 0&&n===void 0||J(e,r,{fg:o!==void 0?v(o):void 0,bg:n!==void 0?v(n):void 0});}function iW(e,r,o){o?.type!=="none"&&(l(e,r,{type:tW(o?.type),fg:o?.fg!==void 0?v(o.fg):void 0,bg:o?.bg!==void 0?v(o.bg):void 0}),m$1(e,r,eW(o?.ch)));}function os(e,r={}){let o=Py.parse(r),n=h(e),t=o.width??qT,i=o.height??XT;return Be.isModal[n]=1,Be.isOpen[n]=0,Be.backdropEnabled[n]=o.backdrop?1:0,Pt.set(n,{content:o.content??"",backdropColor:v(o.backdropColor),backdropOpacity:o.backdropOpacity,closeOnBackdropClick:o.closeOnBackdropClick,closeOnEscape:o.closeOnEscape,width:t,height:i,onCloseCallbacks:[],onOpenCallbacks:[]}),H(e,n,o.left??0,o.top??0),f(e,n,t,i),oW(e,n,o.fg,o.bg),iW(e,n,o.border),nW(e,n,o.padding),o.content&&e$1(e,n,o.content,{align:0,valign:0}),P(e,n,false),aW(e,n)}function aW(e,r){let o={eid:r,show(){Be.isOpen[r]=1,P(e,r,true),rW(r),M(e,r);let n=Pt.get(r);if(n)for(let t of n.onOpenCallbacks)t();return o},hide(){return Be.isOpen[r]=0,P(e,r,false),ic(r),M(e,r),o},move(n,t){return M$1(e,r,n,t),M(e,r),o},setPosition(n,t){return H(e,r,n,t),M(e,r),o},center(n,t){let i=Pt.get(r);if(!i)return o;let a=Math.max(0,Math.floor((n-i.width)/2)),s=Math.max(0,Math.floor((t-i.height)/2));return H(e,r,a,s),M(e,r),o},setContent(n){let t=Pt.get(r);return t&&(t.content=n),e$1(e,r,n,{align:0,valign:0}),M(e,r),o},getContent(){return Pt.get(r)?.content??""},close(){if(Be.isOpen[r]===0)return;Be.isOpen[r]=0,P(e,r,false),ic(r),M(e,r);let n=Pt.get(r);if(n)for(let t of n.onCloseCallbacks)t();},isOpen(){return Be.isOpen[r]===1},onClose(n){let t=Pt.get(r);return t&&t.onCloseCallbacks.push(n),o},onOpen(n){let t=Pt.get(r);return t&&t.onOpenCallbacks.push(n),o},destroy(){Be.isOpen[r]===1&&o.close(),Be.isModal[r]=0,Be.isOpen[r]=0,Be.backdropEnabled[r]=0,Pt.delete(r),i(e,r);}};return o}function ac(e,r={}){let o=os(e,r);return o.show(),o}function Fr(e,r){if(Be.isModal[r]!==1||Be.isOpen[r]===0)return;Be.isOpen[r]=0,P(e,r,false),ic(r),M(e,r);let o=Pt.get(r);if(o)for(let n of o.onCloseCallbacks)n();}function sc(e){let r=[...cn];for(let o=r.length-1;o>=0;o--){let n=r[o];Fr(e,n);}}function lc(e){return cn.length>0}function uc(e){return [...cn]}function dc(e,r){return Be.isModal[r]===1}function cc(){Be.isModal.fill(0),Be.isOpen.fill(0),Be.backdropEnabled.fill(0),Pt.clear(),cn.length=0;}function gc(e,r){return Be.isModal[r]!==1||Be.isOpen[r]!==1||!Pt.get(r)?.closeOnBackdropClick?false:(Fr(e,r),true)}function mc(e,r){return Be.isModal[r]!==1||Be.isOpen[r]!==1||!Pt.get(r)?.closeOnEscape?false:(Fr(e,r),true)}var Fy=Object.freeze({create:os,is:dc,open:ac,close:Fr,closeAll:sc,isOpen:lc,getStack:uc,handleEscape:mc,handleBackdropClick:gc,resetStore:cc});var sW=30,lW=10,fc=1e4,uW="[x]",dW="[ ]",Iy=z.object({x:z.number().int().default(0),y:z.number().int().default(0),width:z.number().int().positive().default(sW),height:z.number().int().positive().default(lW),items:z.array(z.union([z.string(),z.object({text:z.string(),value:z.string().optional(),disabled:z.boolean().optional()})])).default([]),selected:z.array(z.number().int().nonnegative()).default([]),fg:z.number().int().nonnegative().optional(),bg:z.number().int().nonnegative().optional(),cursorFg:z.number().int().nonnegative().optional(),cursorBg:z.number().int().nonnegative().optional(),selectedFg:z.number().int().nonnegative().optional(),selectedBg:z.number().int().nonnegative().optional(),disabledFg:z.number().int().nonnegative().optional(),filterable:z.boolean().default(true)}),st={isMultiSelect:new Uint8Array(fc),visible:new Uint8Array(fc),focused:new Uint8Array(fc)},Io=new Map;function Dy(e,r,o,n){o==="up"?n?e.rangeSelectTo(Math.max(0,r.cursorIndex-1)):(e.cursorUp(),r.rangeAnchor=r.cursorIndex):n?e.rangeSelectTo(Math.min(r.filteredIndices.length-1,r.cursorIndex+1)):(e.cursorDown(),r.rangeAnchor=r.cursorIndex);}function cW(e,r,o,n){return o==="up"||o==="k"?(Dy(e,r,"up",n),true):o==="down"||o==="j"?(Dy(e,r,"down",n),true):o==="home"||o==="g"?(e.cursorFirst(),true):o==="end"||o==="G"?(e.cursorLast(),true):o==="pageup"?(e.pageUp(),true):o==="pagedown"?(e.pageDown(),true):false}function gW(e,r,o,n){return r.filterable&&o.length===1&&!n?(r.filterQuery+=o,Dr(r),true):r.filterable&&o==="backspace"?(r.filterQuery.length>0&&(r.filterQuery=r.filterQuery.slice(0,-1),Dr(r)),true):o==="escape"?(r.filterQuery.length>0?(r.filterQuery="",Dr(r)):e.blur(),true):false}function mW(e,r,o,n,t){return n&&o==="a"?(r.selected.size===r.items.length?e.deselectAll():e.selectAll(),true):cW(e,r,o,t)?true:o===" "?(e.toggleCurrent(),true):gW(e,r,o,n)}function Ay(e){return e.map(r=>typeof r=="string"?{text:r,value:r}:{...r,value:r.value??r.text})}function Dr(e){if(e.filterQuery.length===0){e.filteredIndices=e.items.map((o,n)=>n);return}let r=e.filterQuery.toLowerCase();e.filteredIndices=[];for(let o=0;o<e.items.length;o++)e.items[o]?.text.toLowerCase().includes(r)&&e.filteredIndices.push(o);e.filteredIndices.length===0?e.cursorIndex=-1:e.cursorIndex>=e.filteredIndices.length?e.cursorIndex=e.filteredIndices.length-1:e.cursorIndex<0&&(e.cursorIndex=0),e.firstVisible=0;}function Ao(e){let r=Array.from(e.selected).sort((n,t)=>n-t),o=r.map(n=>e.items[n]).filter(n=>n!==void 0);for(let n of e.selectionCallbacks)n(r,o);}function bc(e,r){return e.filteredIndices[r]??-1}function $n(e){e.cursorIndex<e.firstVisible?e.firstVisible=e.cursorIndex:e.cursorIndex>=e.firstVisible+e.visibleCount&&(e.firstVisible=e.cursorIndex-e.visibleCount+1);}function fW(e,r){let o=new Set;for(let n of r){if(n<0||n>=e.length)continue;let t=e[n];t&&!t.disabled&&o.add(n);}return o}function bW(e,r){let o=fW(e,r.selected),n=r.filterable?1:0,t=Math.max(1,r.height-n);return {items:e,selected:o,cursorIndex:e.length>0?0:-1,rangeAnchor:0,filterQuery:"",filteredIndices:e.map((i,a)=>a),filterable:r.filterable,firstVisible:0,visibleCount:t,width:r.width,fg:r.fg??4294967295,bg:r.bg??255,cursorFg:r.cursorFg??255,cursorBg:r.cursorBg??8978431,selectedFg:r.selectedFg??16711935,selectedBg:r.selectedBg??255,disabledFg:r.disabledFg??2290649343,selectionCallbacks:[]}}function pW(e,r){let o=bc(e,r);if(o<0)return;let n=e.items[o];if(!n)return;let t=e.selected.has(o)?uW:dW,i=r===e.cursorIndex?">":" ",a=Math.max(0,e.width-6),s=n.text.length>a?`${n.text.slice(0,a-1)}~`:n.text;return `${i} ${t} ${s}`}function pc(e,r={}){let o=Iy.parse(r),n=h(e);st.isMultiSelect[n]=1,st.visible[n]=1,st.focused[n]=0;let t=Ay(o.items),i$1=bW(t,o);Io.set(n,i$1);let a={eid:n,show(){return st.visible[n]=1,a},hide(){return st.visible[n]=0,a},focus(){return st.focused[n]=1,a},blur(){return st.focused[n]=0,a},isFocused(){return st.focused[n]===1},select(s){return s>=0&&s<i$1.filteredIndices.length&&(i$1.cursorIndex=s,i$1.rangeAnchor=s,$n(i$1)),a},getCursorIndex(){return i$1.cursorIndex},cursorUp(){return i$1.cursorIndex>0&&(i$1.cursorIndex--,$n(i$1)),a},cursorDown(){return i$1.cursorIndex<i$1.filteredIndices.length-1&&(i$1.cursorIndex++,$n(i$1)),a},cursorFirst(){return i$1.filteredIndices.length>0&&(i$1.cursorIndex=0,i$1.firstVisible=0),a},cursorLast(){return i$1.filteredIndices.length>0&&(i$1.cursorIndex=i$1.filteredIndices.length-1,$n(i$1)),a},pageUp(){return i$1.cursorIndex=Math.max(0,i$1.cursorIndex-i$1.visibleCount),$n(i$1),a},pageDown(){return i$1.cursorIndex=Math.min(i$1.filteredIndices.length-1,i$1.cursorIndex+i$1.visibleCount),$n(i$1),a},toggleCurrent(){if(i$1.cursorIndex<0||i$1.cursorIndex>=i$1.filteredIndices.length)return a;let s=bc(i$1,i$1.cursorIndex);return s<0||i$1.items[s]?.disabled||(i$1.selected.has(s)?i$1.selected.delete(s):i$1.selected.add(s),i$1.rangeAnchor=i$1.cursorIndex,Ao(i$1)),a},toggleItem(s){return s<0||s>=i$1.items.length||i$1.items[s]?.disabled||(i$1.selected.has(s)?i$1.selected.delete(s):i$1.selected.add(s),Ao(i$1)),a},selectAll(){for(let s=0;s<i$1.items.length;s++){let l=i$1.items[s];l&&!l.disabled&&i$1.selected.add(s);}return Ao(i$1),a},deselectAll(){return i$1.selected.clear(),Ao(i$1),a},rangeSelectTo(s){if(s<0||s>=i$1.filteredIndices.length)return a;let l=Math.min(i$1.rangeAnchor,s),u=Math.max(i$1.rangeAnchor,s);for(let d=l;d<=u;d++){let b=bc(i$1,d);if(b>=0){let m=i$1.items[b];m&&!m.disabled&&i$1.selected.add(b);}}return i$1.cursorIndex=s,$n(i$1),Ao(i$1),a},getSelectedIndices(){return Array.from(i$1.selected).sort((s,l)=>s-l)},getSelectedItems(){return Array.from(i$1.selected).sort((s,l)=>s-l).map(s=>i$1.items[s]).filter(s=>s!==void 0)},getSelectedCount(){return i$1.selected.size},getSelectionStatus(){let s=i$1.selected.size;return s===0?"None selected":`${s} selected`},isSelected(s){return i$1.selected.has(s)},setItems(s){i$1.items=Ay(s);for(let l of i$1.selected)l>=i$1.items.length&&i$1.selected.delete(l);return Dr(i$1),i$1.cursorIndex>=i$1.filteredIndices.length&&(i$1.cursorIndex=Math.max(0,i$1.filteredIndices.length-1)),a},getItems(){return i$1.items},getVisibleItems(){return i$1.filteredIndices.map(s=>i$1.items[s]).filter(s=>s!==void 0)},setFilter(s){return i$1.filterQuery=s,Dr(i$1),a},getFilter(){return i$1.filterQuery},clearFilter(){return i$1.filterQuery="",Dr(i$1),a},getRenderLines(){let s=[],l=i$1.firstVisible,u=Math.min(l+i$1.visibleCount,i$1.filteredIndices.length);for(let d=l;d<u;d++){let b=pW(i$1,d);b!==void 0&&s.push(b);}return s},onSelectionChange(s){return i$1.selectionCallbacks.push(s),()=>{let l=i$1.selectionCallbacks.indexOf(s);l!==-1&&i$1.selectionCallbacks.splice(l,1);}},handleKey(s,l=false,u=false){return mW(a,i$1,s,l,u)},destroy(){st.isMultiSelect[n]=0,st.visible[n]=0,st.focused[n]=0,Io.delete(n),i(e,n);}};return a}function yc(e,r){let o=Io.get(r);return o?Array.from(o.selected).sort((n,t)=>n-t).map(n=>o.items[n]).filter(n=>n!==void 0):[]}function hc(e,r,o){let n=Io.get(r);return n?(n.selectionCallbacks.push(o),()=>{let t=n.selectionCallbacks.indexOf(o);t!==-1&&n.selectionCallbacks.splice(t,1);}):()=>{}}function xc(e,r){return st.isMultiSelect[r]===1}function Sc(){st.isMultiSelect.fill(0),st.visible.fill(0),st.focused.fill(0),Io.clear();}var ky=Object.freeze({create:pc,is:xc,getSelectedItems:yc,onSelectionChange:hc,resetStore:Sc});z.object({title:z.object({fg:z.union([z.string(),z.number().int().nonnegative()]).optional(),bg:z.union([z.string(),z.number().int().nonnegative()]).optional(),align:z.enum(["left","center","right"]).optional()}).optional(),content:z.object({fg:z.union([z.string(),z.number().int().nonnegative()]).optional(),bg:z.union([z.string(),z.number().int().nonnegative()]).optional()}).optional(),border:z.object({type:z.enum(["line","bg","none"]).optional(),fg:z.union([z.string(),z.number().int().nonnegative()]).optional(),bg:z.union([z.string(),z.number().int().nonnegative()]).optional(),ch:z.union([z.enum(["single","double","rounded","bold","ascii"]),z.unknown()]).optional()}).optional()});var Ir="",is="\u2715",as="\u25BC",ss="\u25B6",Ry=z.union([z.number(),z.string().regex(/^\d+(\.\d+)?%$/,'Percentage must be in format "50%"'),z.enum(["center","left","right","top","bottom"])]),Oy=z.union([z.number(),z.string().regex(/^\d+(\.\d+)?%$/,'Percentage must be in format "50%"'),z.literal("auto")]),yW=z.object({type:z.enum(["line","bg","none"]).optional(),fg:z.union([z.string(),z.number()]).optional(),bg:z.union([z.string(),z.number()]).optional(),ch:z.union([z.enum(["single","double","rounded","bold","ascii"]),z.object({}).passthrough()]).optional()}),hW=z.object({fg:z.union([z.string(),z.number()]).optional(),bg:z.union([z.string(),z.number()]).optional(),align:z.enum(["left","center","right"]).optional()}),xW=z.object({fg:z.union([z.string(),z.number()]).optional(),bg:z.union([z.string(),z.number()]).optional()}),SW=z.object({title:hW.optional(),content:xW.optional(),border:yW.optional()}),CW=z.union([z.number().nonnegative(),z.object({left:z.number().nonnegative().optional(),top:z.number().nonnegative().optional(),right:z.number().nonnegative().optional(),bottom:z.number().nonnegative().optional()})]),zy=z.object({left:Ry.optional(),top:Ry.optional(),width:Oy.optional(),height:Oy.optional(),title:z.string().optional(),titleAlign:z.enum(["left","center","right"]).optional(),closable:z.boolean().optional(),collapsible:z.boolean().optional(),collapsed:z.boolean().optional(),fg:z.union([z.string(),z.number()]).optional(),bg:z.union([z.string(),z.number()]).optional(),style:SW.optional(),padding:CW.optional(),content:z.string().optional()}),Ar=1e4,Q={isPanel:new Uint8Array(Ar),collapsed:new Uint8Array(Ar),closable:new Uint8Array(Ar),collapsible:new Uint8Array(Ar),originalHeight:new Float32Array(Ar),titleAlign:new Uint8Array(Ar)},En=new Map,ko=new Map;function Vy(e){return e===void 0?0:typeof e=="number"?e:0}function _y(e){return e===void 0||typeof e=="string"&&e==="auto"?"auto":e}function TW(e){switch(e){case "left":return 0;case "center":return 1;case "right":return 2}}function Ny(e){switch(e){case 0:return "left";case 1:return "center";case 2:return "right";default:return "left"}}function WW(e){return typeof e=="number"?{left:e,top:e+1,right:e,bottom:e}:e?{left:e.left??0,top:(e.top??0)+1,right:e.right??0,bottom:e.bottom??0}:{left:0,top:1,right:0,bottom:0}}function vW(e){return e===void 0||e==="single"?b:typeof e=="object"?e:b}function LW(e,r,o){(o.fg!==void 0||o.bg!==void 0)&&J(e,r,{fg:o.fg!==void 0?v(o.fg):void 0,bg:o.bg!==void 0?v(o.bg):void 0});}function EW(e,r,o){let n=o.style?.border;n?.type!=="none"&&l(e,r,{type:n?.type==="bg"?2:1,fg:n?.fg!==void 0?v(n.fg):void 0,bg:n?.bg!==void 0?v(n.bg):void 0}),m$1(e,r,vW(n?.ch));}function Ro(e,r,o={}){let n=zy.parse(o),t=r;Q.isPanel[t]=1,Q.collapsed[t]=n.collapsed?1:0,Q.closable[t]=n.closable?1:0,Q.collapsible[t]=n.collapsible?1:0,Q.titleAlign[t]=TW(n.titleAlign??n.style?.title?.align??"left"),En.set(t,n.title??Ir),ko.set(t,n.content??"");let i$1=Vy(n.left),a=Vy(n.top);H(e,t,i$1,a);let s$1=_y(n.width),l=_y(n.height);f(e,t,s$1,l);let u$1=g(e,t);Q.originalHeight[t]=u$1?.height??10,LW(e,t,n),EW(e,t,n),d(e,t,WW(n.padding)),n.content&&e$1(e,t,n.content,{align:0,valign:0}),q$1(e,t,{focusable:true}),P(e,t,true),n.collapsed&&f(e,t,s$1,3);let d$2={eid:t,show(){return P(e,t,true),d$2},hide(){return P(e,t,false),d$2},move(b,m){return M$1(e,t,b,m),M(e,t),d$2},setPosition(b,m){return H(e,t,b,m),M(e,t),d$2},setTitle(b){return En.set(t,b),M(e,t),d$2},getTitle(){return En.get(t)??Ir},setContent(b){return ko.set(t,b),e$1(e,t,b,{align:0,valign:0}),M(e,t),d$2},getContent(){return ko.get(t)??""},collapse(){if(Q.collapsible[t]===0||Q.collapsed[t]===1)return d$2;let b=g(e,t);b&&(Q.originalHeight[t]=b.height);let m=g(e,t);return f(e,t,m?.width??"auto",3),Q.collapsed[t]=1,M(e,t),d$2},expand(){if(Q.collapsible[t]===0||Q.collapsed[t]===0)return d$2;let b=Q.originalHeight[t],m=g(e,t);return f(e,t,m?.width??"auto",b),Q.collapsed[t]=0,M(e,t),d$2},toggle(){return Q.collapsed[t]===1?d$2.expand():d$2.collapse()},isCollapsed(){return Q.collapsed[t]===1},isClosable(){return Q.closable[t]===1},close(){Q.closable[t]===1&&P(e,t,false);},focus(){return u(e,t),d$2},blur(){return v$1(e,t),d$2},isFocused(){return s(e,t)},append(b){return d$1(e,t,b),d$2},getChildren(){return f$1(e,t)},destroy(){Q.isPanel[t]=0,Q.collapsed[t]=0,Q.closable[t]=0,Q.collapsible[t]=0,Q.originalHeight[t]=0,Q.titleAlign[t]=0,En.delete(t),ko.delete(t),i(e,t);}};return d$2}function Cc(e,r){return Q.isPanel[r]===1}function Tc(e,r){return En.get(r)??Ir}function Wc(e,r,o){return En.set(r,o),M(e,r),r}function vc(e,r){return Q.collapsed[r]===1}function Lc(e,r){return Ny(Q.titleAlign[r])}function Ec(e,r,o){let n=En.get(r)??"",t=Q.closable[r]===1,i=Q.collapsible[r]===1,a=Q.collapsed[r]===1,s=Ny(Q.titleAlign[r]),l=(t?2:0)+(i?2:0),u=Math.max(0,o-l),d=n;d.length>u&&(d=`${d.slice(0,u-1)}\u2026`);let b="";i&&(b+=a?`${ss} `:`${as} `),t&&(b+=`${is} `),b=b.trimEnd();let m=u-d.length,c=0,g=0;switch(s){case "left":g=m;break;case "center":c=Math.floor(m/2),g=m-c;break;case "right":c=m;break}return `${" ".repeat(c)}${d}${" ".repeat(g)}${b}`}function Mc(){Q.isPanel.fill(0),Q.collapsed.fill(0),Q.closable.fill(0),Q.collapsible.fill(0),Q.originalHeight.fill(0),Q.titleAlign.fill(0),En.clear(),ko.clear();}var Uy=Object.freeze({create:Ro,is:Cc,getTitle:Tc,setTitle:Wc,getTitleAlign:Lc,isCollapsed:vc,renderTitleBar:Ec,resetStore:Mc,CLOSE_BUTTON_CHAR:is,COLLAPSE_CHAR:as,EXPAND_CHAR:ss,DEFAULT_PANEL_TITLE:Ir});function Pc(e){return Math.max(0,Math.min(100,e))}var Hy=z.object({x:z.number().int().default(0),y:z.number().int().default(0),width:z.number().int().positive().default(20),height:z.number().int().positive().default(1),value:z.number().default(0).transform(e=>Pc(e)),fillChar:z.string().default("\u2588"),emptyChar:z.string().default("\u2591"),showPercentage:z.boolean().default(false),label:z.string().default(""),indeterminate:z.boolean().default(false)}),Bc=1e4,qe={isProgressBar:new Uint8Array(Bc),showPercentage:new Uint8Array(Bc),indeterminate:new Uint8Array(Bc)},Ct=new Map;function kr(e,r){let o=Ct.get(r);if(!o)return;let n=qe.indeterminate[r]===1,t=qe.showPercentage[r]===1,i=Math.floor(o.value/100*o.width),a=o.width-i,s=o.fillChar.repeat(i),l=o.emptyChar.repeat(a),u=s+l,d=u;n?d=u:o.label?d=`${u} ${o.label}`:t&&(d=`${u} ${Math.round(o.value)}%`),e$1(e,r,d);}function Gy(e,r){let o=Ct.get(e);if(o)for(let n of o.onChangeCallbacks)n(r);}function Fc(e,r={}){let o=Hy.parse(r),n=h(e);qe.isProgressBar[n]=1,qe.showPercentage[n]=o.showPercentage?1:0,qe.indeterminate[n]=o.indeterminate?1:0,f(e,n,o.width,o.height),H(e,n,o.x,o.y),Ct.set(n,{value:o.value,fillChar:o.fillChar,emptyChar:o.emptyChar,label:o.label,width:o.width,onChangeCallbacks:[]}),kr(e,n);let t={eid:n,setValue(i){let a=Ct.get(n);if(!a)return t;let s=Pc(i);return a.value=s,kr(e,n),M(e,n),Gy(n,s),t},getValue(){return Ct.get(n)?.value??0},increment(i){let a=Ct.get(n);if(!a)return t;let s=Pc(a.value+i);return a.value=s,kr(e,n),M(e,n),Gy(n,s),t},setLabel(i){let a=Ct.get(n);return a&&(a.label=i,kr(e,n),M(e,n)),t},getLabel(){return Ct.get(n)?.label??""},showPercentage(i){return qe.showPercentage[n]=i?1:0,kr(e,n),M(e,n),t},isPercentageShown(){return qe.showPercentage[n]===1},getFillChar(){return Ct.get(n)?.fillChar??"\u2588"},getEmptyChar(){return Ct.get(n)?.emptyChar??"\u2591"},setIndeterminate(i){return qe.indeterminate[n]=i?1:0,kr(e,n),M(e,n),t},isIndeterminate(){return qe.indeterminate[n]===1},setPosition(i,a){return H(e,n,i,a),M(e,n),t},move(i,a){return M$1(e,n,i,a),M(e,n),t},getPosition(){let i=Ct.get(n);return {x:G.x[n]??0,y:G.y[n]??0,width:i?.width??20,height:1}},onChange(i){let a=Ct.get(n);return a&&a.onChangeCallbacks.push(i),t},destroy(){qe.isProgressBar[n]=0,qe.showPercentage[n]=0,qe.indeterminate[n]=0,Ct.delete(n),i(e,n);}};return t}function MW(e,r){return qe.isProgressBar[r]===1}function Dc(){qe.isProgressBar.fill(0),qe.showPercentage.fill(0),qe.indeterminate.fill(0),Ct.clear();}var wy=Object.freeze({create:Fc,resetStore:Dc});var BW=1e4,Ic=4294967295,kc=255,ls=40,us=5,jy=z.object({type:z.enum(["line","bg","none"]).optional(),fg:z.union([z.string(),z.number()]).optional(),bg:z.union([z.string(),z.number()]).optional(),ch:z.union([z.enum(["single","double","rounded","bold","ascii"]),z.custom(e=>typeof e=="object"&&e!==null&&"topLeft"in e&&"topRight"in e&&"bottomLeft"in e&&"bottomRight"in e&&"horizontal"in e&&"vertical"in e)]).optional()}).optional(),$y=z.union([z.number().int().nonnegative(),z.object({left:z.number().int().nonnegative().optional(),top:z.number().int().nonnegative().optional(),right:z.number().int().nonnegative().optional(),bottom:z.number().int().nonnegative().optional()})]).optional(),Rc=z.object({message:z.string().default(""),defaultValue:z.string().default(""),placeholder:z.string().default(""),width:z.number().int().positive().default(ls),height:z.number().int().positive().default(us),left:z.number().int().default(0),top:z.number().int().default(0),fg:z.union([z.string(),z.number()]).optional(),bg:z.union([z.string(),z.number()]).optional(),border:jy,padding:$y}),Oo={isPrompt:new Uint8Array(BW)},lt=new Map;function PW(e){switch(e){case "single":return b;case "double":return c;case "rounded":return d$2;case "bold":return e$2;case "ascii":return f$3}}function FW(e){switch(e){case "line":return 1;case "bg":return 2;case "none":return 0}}function DW(e,r,o,n){o===void 0&&n===void 0||J(e,r,{fg:o!==void 0?v(o):void 0,bg:n!==void 0?v(n):void 0});}function AW(e,r,o){let n=o.type?FW(o.type):1;if(l(e,r,{type:n,fg:o.fg!==void 0?v(o.fg):void 0,bg:o.bg!==void 0?v(o.bg):void 0}),o.ch){let t=typeof o.ch=="string"?PW(o.ch):o.ch;m$1(e,r,t);}}function IW(e,r,o){typeof o=="number"?d(e,r,{left:o,top:o,right:o,bottom:o}):d(e,r,o);}function Ac(e,r){let o=lt.get(r);if(!o)return;let n=o.value||o.placeholder,t=o.message?`${o.message}
|
|
16
|
+
${n}`:n;e$1(e,r,t);}function ds(e,r={}){let o=Rc.parse(r),n=h(e);return Oo.isPrompt[n]=1,H(e,n,o.left,o.top),f(e,n,o.width,o.height),DW(e,n,o.fg,o.bg),o.border&&AW(e,n,o.border),o.padding!==void 0&&IW(e,n,o.padding),lt.set(n,{message:o.message,value:o.defaultValue,placeholder:o.placeholder,visible:true,validator:r.validator,submitCallbacks:[],cancelCallbacks:[]}),Ac(e,n),kW(e,n)}function kW(e,r){let o={get eid(){return r},show(){let n=lt.get(r);return n&&(n.visible=true),P(e,r,true),M(e,r),o},hide(){let n=lt.get(r);return n&&(n.visible=false),P(e,r,false),M(e,r),o},move(n,t){let i=G.x[r]??0,a=G.y[r]??0;return H(e,r,i+n,a+t),M(e,r),o},setPosition(n,t){return H(e,r,n,t),M(e,r),o},center(n,t){if(!lt.get(r))return o;let a=Rc.parse({}),s=a.width,l=a.height,u=Math.floor((n-s)/2),d=Math.floor((t-l)/2);return H(e,r,u,d),M(e,r),o},setMessage(n){let t=lt.get(r);return t&&(t.message=n,Ac(e,r),M(e,r)),o},getMessage(){return lt.get(r)?.message??""},setValue(n){let t=lt.get(r);return t&&(t.value=n,Ac(e,r),M(e,r)),o},getValue(){return lt.get(r)?.value??""},submit(){let n=lt.get(r);if(!n)return o;if(n.validator){let t=n.validator(n.value);if(t!==true&&typeof t=="string"||t===false)return o}for(let t of n.submitCallbacks)t(n.value);return o},cancel(){let n=lt.get(r);if(!n)return o;for(let t of n.cancelCallbacks)t();return o},onSubmit(n){let t=lt.get(r);return t&&t.submitCallbacks.push(n),o},onCancel(n){let t=lt.get(r);return t&&t.cancelCallbacks.push(n),o},destroy(){Oo.isPrompt[r]=0,lt.delete(r),i(e,r);}};return o}function Oc(e,r,o={}){return new Promise(n=>{let t=ds(e,{...o,message:r});t.onSubmit(i=>{t.destroy(),n(i);}),t.onCancel(()=>{t.destroy(),n(null);});})}function Vc(e,r){return Oo.isPrompt[r]===1}function _c(){Oo.isPrompt.fill(0),lt.clear();}function zc(e,r){return r==="return"||r==="enter"?(e.submit(),true):r==="escape"?(e.cancel(),true):false}var Yy=Object.freeze({create:ds,is:Vc,prompt:Oc,handleKey:zc,resetStore:_c,DEFAULT_PROMPT_BG:kc,DEFAULT_PROMPT_FG:Ic,DEFAULT_PROMPT_HEIGHT:us,DEFAULT_PROMPT_WIDTH:ls});var RW=1e4,Nc=4294967295,Uc=0,gs=40,ms=5,OW=z.object({type:z.enum(["line","bg","none"]).optional(),fg:z.union([z.string(),z.number()]).optional(),bg:z.union([z.string(),z.number()]).optional(),ch:z.union([z.enum(["single","double","rounded","bold","ascii"]),z.custom(e=>typeof e=="object"&&e!==null&&"topLeft"in e&&"topRight"in e&&"bottomLeft"in e&&"bottomRight"in e&&"horizontal"in e&&"vertical"in e)]).optional()}).optional(),VW=z.union([z.number().int().nonnegative(),z.object({left:z.number().int().nonnegative().optional(),top:z.number().int().nonnegative().optional(),right:z.number().int().nonnegative().optional(),bottom:z.number().int().nonnegative().optional()})]).optional(),Ky=z.object({message:z.string().default("Are you sure?"),yesText:z.string().default("Yes"),noText:z.string().default("No"),defaultAnswer:z.boolean().default(true),width:z.number().int().positive().default(gs),height:z.number().int().positive().default(ms),left:z.number().int().default(0),top:z.number().int().default(0),fg:z.union([z.string(),z.number()]).optional(),bg:z.union([z.string(),z.number()]).optional(),border:OW,padding:VW}),Vo={isQuestion:new Uint8Array(RW)},ut=new Map;function _W(e){switch(e){case "single":return b;case "double":return c;case "rounded":return d$2;case "bold":return e$2;case "ascii":return f$3}}function zW(e){switch(e){case "line":return 1;case "bg":return 2;case "none":return 0}}function cs(e,r){let o=ut.get(r);if(!o)return;let n=o.selectedAnswer?`[${o.yesText}]`:` ${o.yesText} `,t=o.selectedAnswer?` ${o.noText} `:`[${o.noText}]`,i=`${o.message}
|
|
17
|
+
|
|
18
|
+
${n} ${t}`;e$1(e,r,i);}function NW(e,r,o){o.fg===void 0&&o.bg===void 0||J(e,r,{fg:o.fg!==void 0?v(o.fg):void 0,bg:o.bg!==void 0?v(o.bg):void 0});}function UW(e,r,o){let n=o.type?zW(o.type):1;if(l(e,r,{type:n,fg:o.fg!==void 0?v(o.fg):void 0,bg:o.bg!==void 0?v(o.bg):void 0}),o.ch){let t=typeof o.ch=="string"?_W(o.ch):o.ch;m$1(e,r,t);}}function GW(e,r,o){typeof o=="number"?d(e,r,{left:o,top:o,right:o,bottom:o}):d(e,r,o);}function fs(e,r={}){let o=Ky.parse(r),n=h(e);return Vo.isQuestion[n]=1,H(e,n,o.left,o.top),f(e,n,o.width,o.height),NW(e,n,o),o.border&&UW(e,n,o.border),o.padding!==void 0&&GW(e,n,o.padding),ut.set(n,{message:o.message,yesText:o.yesText,noText:o.noText,selectedAnswer:o.defaultAnswer,visible:true,confirmCallbacks:[],cancelCallbacks:[]}),cs(e,n),HW(e,n)}function HW(e,r){let o={get eid(){return r},show(){let n=ut.get(r);return n&&(n.visible=true),P(e,r,true),M(e,r),o},hide(){let n=ut.get(r);return n&&(n.visible=false),P(e,r,false),M(e,r),o},move(n,t){let i=G.x[r]??0,a=G.y[r]??0;return H(e,r,i+n,a+t),M(e,r),o},setPosition(n,t){return H(e,r,n,t),M(e,r),o},center(n,t){let i=g(e,r);if(!i)return o;let a=Math.floor((n-i.width)/2),s=Math.floor((t-i.height)/2);return H(e,r,a,s),M(e,r),o},setMessage(n){let t=ut.get(r);return t&&(t.message=n,cs(e,r),M(e,r)),o},getMessage(){return ut.get(r)?.message??""},selectYes(){let n=ut.get(r);return n&&(n.selectedAnswer=true,cs(e,r),M(e,r)),o},selectNo(){let n=ut.get(r);return n&&(n.selectedAnswer=false,cs(e,r),M(e,r)),o},getSelectedAnswer(){return ut.get(r)?.selectedAnswer??true},confirm(){let n=ut.get(r);if(n)for(let t of n.confirmCallbacks)t(n.selectedAnswer);return o},cancel(){let n=ut.get(r);if(n)for(let t of n.cancelCallbacks)t();return o},onConfirm(n){let t=ut.get(r);return t&&t.confirmCallbacks.push(n),o},onCancel(n){let t=ut.get(r);return t&&t.cancelCallbacks.push(n),o},destroy(){Vo.isQuestion[r]=0,ut.delete(r),i(e,r);}};return o}function bs(e,r,o={}){return new Promise(n=>{let t=fs(e,{...o,message:r});t.onConfirm(i=>{t.destroy(),n(i);}),t.onCancel(()=>{t.destroy(),n(false);});})}function Gc(e,r){return bs(e,r)}function Hc(e,r){return Vo.isQuestion[r]===1}function wc(e,r){switch(r){case "y":case "Y":return e.selectYes().confirm(),true;case "n":case "N":return e.selectNo().confirm(),true;case "enter":case "return":return e.confirm(),true;case "escape":return e.cancel(),true;default:return false}}function jc(){Vo.isQuestion.fill(0),ut.clear();}var Qy=Object.freeze({create:fs,is:Hc,ask:bs,confirm:Gc,handleKey:wc,resetStore:jc,DEFAULT_QUESTION_BG:Uc,DEFAULT_QUESTION_FG:Nc,DEFAULT_QUESTION_HEIGHT:ms,DEFAULT_QUESTION_WIDTH:gs});var qy=z.object({x:z.number().int().default(0),y:z.number().int().default(0)}),Xy=z.object({x:z.number().int().default(0),y:z.number().int().default(0),width:z.number().int().positive().optional(),height:z.number().int().positive().default(1),label:z.string().default(""),value:z.string().default(""),selectedChar:z.string().default("\u25C9"),unselectedChar:z.string().default("\u25CB"),focusable:z.boolean().default(true),disabled:z.boolean().default(false),groupId:z.number().int().optional()}),Jy=1e4,zo={isRadioGroupWidget:new Uint8Array(Jy)},No={isRadioButtonWidget:new Uint8Array(Jy)},ps=new Map,Rr=new Map;function $c(e,r={}){let o=qy.parse(r),n=h(e);zo.isRadioGroupWidget[n]=1,qc$1(e,n),H(e,n,o.x,o.y),ps.set(n,{nextY:o.y,world:e});let t={eid:n,addOption(i,a){let s=ps.get(n);if(!s)throw new Error("RadioGroup state not found");let l=ys(e,{x:o.x,y:s.nextY,label:a,value:i,groupId:n});return s.nextY+=1,l},getSelectedValue(){return tc$1(e,n)},onChange(i){return uc$1(e,n,a=>{i(a);}),t},destroy(){zo.isRadioGroupWidget[n]=0,ps.delete(n),vc$1(e,n),i(e,n);}};return t}function ys(e,r={}){let o=Xy.parse(r),n=h(e);No.isRadioButtonWidget[n]=1,wc$1(e,n,o.groupId),Gc$1(e,n,o.value),Lc$1(e,n,{selectedChar:o.selectedChar,unselectedChar:o.unselectedChar});let t=Math.max(o.selectedChar.length,o.unselectedChar.length),i$1=o.label.length,a=o.width??t+(i$1>0?1+i$1:0);f(e,n,a,o.height),H(e,n,o.x,o.y),Rr.set(n,{label:o.label}),_o(e,n),d$3(e,n,{clickable:true,hoverable:true,keyable:true,focusable:o.focusable}),q$1(e,n,{focusable:o.focusable}),o.disabled&&Jc$1(e,n);let s$1={eid:n,select(){return Hc$1(e,n),_o(e,n),M(e,n),s$1},deselect(){return Ic$1(e,n),_o(e,n),M(e,n),s$1},isSelected(){return Bc$1(e,n)},getChar(){return Nc$1(e,n)},getValue(){return Fc$1(e,n)??""},setLabel(l){let u=Rr.get(n);u&&(u.label=l);let b=Nc$1(e,n).length+(l.length>0?1+l.length:0);return f(e,n,b,o.height),_o(e,n),M(e,n),s$1},getLabel(){return Rr.get(n)?.label??""},setDisabled(l){return l?Jc$1(e,n):Kc$1(e,n),M(e,n),s$1},isDisabled(){return Cc$1(e,n)},setPosition(l,u){return H(e,n,l,u),M(e,n),s$1},move(l,u){return M$1(e,n,l,u),M(e,n),s$1},getPosition(){return {x:G.x[n]??0,y:G.y[n]??0}},focus(){return u(e,n),M(e,n),s$1},blur(){return v$1(e,n),M(e,n),s$1},isFocused(){return s(e,n)},handleKey(l){if(!s(e,n))return false;let u=Pc$1(e,n,l);return u&&(_o(e,n),M(e,n)),u},destroy(){No.isRadioButtonWidget[n]=0,Rr.delete(n),Oc$1(e,n),i(e,n);}};return s$1}function _o(e,r){let o=Nc$1(e,r),t=Rr.get(r)?.label??"",i=t.length>0?`${o} ${t}`:o;e$1(e,r,i);}function Yc(e,r){return zo.isRadioGroupWidget[r]===1&&rc$1(e,r)}function Kc(e,r){return No.isRadioButtonWidget[r]===1&&xc$1(e,r)}function Qc(){zo.isRadioGroupWidget.fill(0),No.isRadioButtonWidget.fill(0),ps.clear(),Rr.clear();}var Zy=Object.freeze({createButton:ys,createGroup:$c,isButton:Kc,isGroup:Yc,resetStore:Qc});var Xe={isScrollableBox:new Uint8Array(1e4),mouseEnabled:new Uint8Array(1e4),keysEnabled:new Uint8Array(1e4)};function Mn(e,r){return Xe.isScrollableBox[r]===1}function hs(e,r){return Xe.mouseEnabled[r]===1}function xs(e,r){return Xe.keysEnabled[r]===1}function Ss(){Xe.isScrollableBox.fill(0),Xe.mouseEnabled.fill(0),Xe.keysEnabled.fill(0);}var eh=z.union([z.number(),z.string().regex(/^\d+(\.\d+)?%$/,'Percentage must be in format "50%"'),z.literal("auto")]),Cs=z.union([z.number(),z.string().regex(/^\d+(\.\d+)?%$/,'Percentage must be in format "50%"'),z.enum(["center","left","right","top","bottom"])]),wW=z.object({type:z.enum(["line","bg","none"]).optional(),fg:z.union([z.string(),z.number()]).optional(),bg:z.union([z.string(),z.number()]).optional(),ch:z.union([z.enum(["single","double","rounded","bold","ascii"]),z.custom(e=>typeof e=="object"&&e!==null&&"topLeft"in e&&"topRight"in e&&"bottomLeft"in e&&"bottomRight"in e&&"horizontal"in e&&"vertical"in e)]).optional()}).optional(),jW=z.union([z.number().int().nonnegative(),z.object({left:z.number().int().nonnegative().optional(),top:z.number().int().nonnegative().optional(),right:z.number().int().nonnegative().optional(),bottom:z.number().int().nonnegative().optional()})]).optional(),$W=z.union([z.boolean(),z.object({mode:z.enum(["auto","visible","hidden"]).optional(),fg:z.union([z.string(),z.number()]).optional(),bg:z.union([z.string(),z.number()]).optional(),trackChar:z.string().optional(),thumbChar:z.string().optional()})]).optional(),Ts=z.object({left:Cs.optional(),top:Cs.optional(),right:Cs.optional(),bottom:Cs.optional(),width:eh.optional(),height:eh.optional(),fg:z.union([z.string(),z.number()]).optional(),bg:z.union([z.string(),z.number()]).optional(),border:wW,padding:jW,content:z.string().optional(),align:z.enum(["left","center","right"]).optional(),valign:z.enum(["top","middle","bottom"]).optional(),scrollbar:$W,alwaysScroll:z.boolean().optional(),mouse:z.boolean().optional(),keys:z.boolean().optional(),scrollWidth:z.number().nonnegative().optional(),scrollHeight:z.number().nonnegative().optional(),scrollX:z.number().optional(),scrollY:z.number().optional()});function YW(e){switch(e){case "left":return 0;case "center":return 1;case "right":return 2}}function KW(e){switch(e){case "top":return 0;case "middle":return 1;case "bottom":return 2}}function QW(e){switch(e){case "single":return b;case "double":return c;case "rounded":return d$2;case "bold":return e$2;case "ascii":return f$3}}function qW(e){switch(e){case "line":return 1;case "bg":return 2;case "none":return 0}}function th(e){return e===void 0?0:typeof e=="number"?e:0}function nh(e){return e===void 0||typeof e=="string"&&e==="auto"?"auto":e}function XW(e){switch(e){case "auto":return 2;case "visible":return 1;case "hidden":return 0}}function rh(e,r,o){let n=th(o.left),t=th(o.top);H(e,r,n,t);let i=nh(o.width),a=nh(o.height);f(e,r,i,a);}function oh(e,r,o){o.fg===void 0&&o.bg===void 0||J(e,r,{fg:o.fg!==void 0?v(o.fg):void 0,bg:o.bg!==void 0?v(o.bg):void 0});}function ih(e,r,o){let n=o.type?qW(o.type):1;if(l(e,r,{type:n,fg:o.fg!==void 0?v(o.fg):void 0,bg:o.bg!==void 0?v(o.bg):void 0}),o.ch){let t=typeof o.ch=="string"?QW(o.ch):o.ch;m$1(e,r,t);}}function ah(e,r,o){typeof o=="number"?d(e,r,{left:o,top:o,right:o,bottom:o}):d(e,r,o);}function sh(e,r,o){if(o.content===void 0)return;let n={};o.align&&(n.align=YW(o.align)),o.valign&&(n.valign=KW(o.valign)),e$1(e,r,o.content,n);}function lh(e,r,o){let n={};o.scrollWidth!==void 0&&(n.scrollWidth=o.scrollWidth),o.scrollHeight!==void 0&&(n.scrollHeight=o.scrollHeight),o.scrollX!==void 0&&(n.scrollX=o.scrollX),o.scrollY!==void 0&&(n.scrollY=o.scrollY),o.alwaysScroll!==void 0&&(n.alwaysScroll=o.alwaysScroll),o.scrollbar===true?n.scrollbarVisible=2:o.scrollbar===false?n.scrollbarVisible=0:typeof o.scrollbar=="object"&&o.scrollbar.mode&&(n.scrollbarVisible=XW(o.scrollbar.mode)),Le$1(e,r,n),Xe.mouseEnabled[r]=o.mouse!==false?1:0,Xe.keysEnabled[r]=o.keys!==false?1:0;}function Bn(e,r,o={}){let n=Ts.parse(o),t=r;Xe.isScrollableBox[t]=1,rh(e,t,n),oh(e,t,n),n.border&&ih(e,t,n.border),n.padding!==void 0&&ah(e,t,n.padding),sh(e,t,n),lh(e,t,n),q$1(e,t,{focusable:true});let i$1={eid:t,show(){return P(e,t,true),i$1},hide(){return P(e,t,false),i$1},move(a,s){return M$1(e,t,a,s),M(e,t),i$1},setPosition(a,s){return H(e,t,a,s),M(e,t),i$1},setContent(a){return e$1(e,t,a),M(e,t),i$1},getContent(){return f$2(e,t)},focus(){return u(e,t),i$1},blur(){return v$1(e,t),i$1},isFocused(){return s(e,t)},append(a){return d$1(e,t,a),i$1},getChildren(){return f$1(e,t)},scrollTo(a,s){return Pe$1(e,t,a,s),M(e,t),i$1},scrollBy(a,s){return Oe(e,t,a,s),M(e,t),i$1},setScrollPerc(a,s){return Re(e,t,a,s),M(e,t),i$1},getScrollPerc(){return Qe$1(e,t)},getScroll(){return Ne$1(e,t)},setScrollSize(a,s){return Ue(e,t,a,s),M(e,t),i$1},setViewport(a,s){return Ve$1(e,t,a,s),M(e,t),i$1},getScrollable(){return Se$1(e,t)},scrollToTop(){return Ye$1(e,t),M(e,t),i$1},scrollToBottom(){return Ze(e,t),M(e,t),i$1},scrollToLeft(){return _e(e,t),M(e,t),i$1},scrollToRight(){return $e$1(e,t),M(e,t),i$1},canScroll(){return af(e,t)},canScrollX(){return bf(e,t)},canScrollY(){return cf(e,t)},isAtTop(){return df(e,t)},isAtBottom(){return ef(e,t)},isAtLeft(){return ff(e,t)},isAtRight(){return gf(e,t)},destroy(){Xe.isScrollableBox[t]=0,Xe.mouseEnabled[t]=0,Xe.keysEnabled[t]=0,i(e,t);}};return i$1}function Uo(e,r,o={}){return Bn(e,r,{...o,alwaysScroll:true})}function uh(e){let r={};return e.border?.fg!==void 0&&(r.borderFg=e.border.fg),e.border?.bg!==void 0&&(r.borderBg=e.border.bg),e.header?.fg!==void 0&&(r.headerFg=e.header.fg),e.header?.bg!==void 0&&(r.headerBg=e.header.bg),e.cell?.fg!==void 0&&(r.cellFg=e.cell.fg),e.cell?.bg!==void 0&&(r.cellBg=e.cell.bg),e.altRowBg!==void 0&&(r.altRowBg=e.altRowBg),e.selected?.fg!==void 0&&(r.selectedFg=e.selected.fg),e.selected?.bg!==void 0&&(r.selectedBg=e.selected.bg),r}var dh=z.object({x:z.number().int().default(0),y:z.number().int().default(0),width:z.number().int().positive().optional(),height:z.number().int().positive().optional(),data:z.array(z.array(z.string())).default([]),pad:z.number().int().min(0).max(10).default(1),align:z.enum(["left","center","right"]).default("left"),style:z.object({border:z.object({fg:z.number().optional(),bg:z.number().optional()}).optional(),header:z.object({fg:z.number().optional(),bg:z.number().optional()}).optional(),cell:z.object({fg:z.number().optional(),bg:z.number().optional()}).optional(),altRowBg:z.number().optional(),selected:z.object({fg:z.number().optional(),bg:z.number().optional()}).optional()}).optional(),noCellBorders:z.boolean().default(false),headerRows:z.number().int().min(0).max(10).default(1),columns:z.array(z.object({header:z.string(),width:z.number().int().positive().optional(),minWidth:z.number().int().positive().optional(),maxWidth:z.number().int().positive().optional(),align:z.enum(["left","center","right"]).optional()})).optional()});function Go(e,r,o={}){let n=dh.parse(o),t=r;H(e,t,n.x,n.y),n.width!==void 0&&n.height!==void 0&&f(e,t,n.width,n.height),xb$1(e,t,{headerRows:n.headerRows,pad:n.pad,cellBorders:!n.noCellBorders}),n.data.length>0&&Ab$1(e,t,n.data),n.columns&&Ob$1(e,t,n.columns),n.style&&Ub$1(e,t,uh(n.style));let i$1={eid:t,show(){return P(e,t,true),i$1},hide(){return P(e,t,false),i$1},move(a,s){return G.x[t]=(G.x[t]??0)+a,G.y[t]=(G.y[t]??0)+s,M(e,t),i$1},setPosition(a,s){return H(e,t,a,s),i$1},setData(a){return Ab$1(e,t,a),i$1},getData(){return Cb$1(e,t)},getFullData(){return Bb$1(e,t)},clearData(){return Nb$1(e,t),i$1},setCell(a,s,l){return Db$1(e,t,a,s,l),i$1},getCell(a,s){return Eb$1(e,t,a,s)},getCellValue(a,s){return Fb$1(e,t,a,s)},getRow(a){return Gb$1(e,t,a)},appendRow(a){return Kb$1(e,t,a),i$1},insertRow(a,s){return Lb$1(e,t,a,s),i$1},removeRow(a){return Mb$1(e,t,a),i$1},getRowCount(){return Ib$1(e,t)},setColumns(a){return Ob$1(e,t,a),i$1},getColumns(){return Pb$1(e,t)},getColCount(){return Jb$1(e,t)},calculateColumnWidths(a){return $b$1(e,t,a)},setHeaderRowCount(a){return Sb$1(e,t,a),i$1},getHeaderRowCount(){return Tb$1(e,t)},getHeaderRows(){return Qb$1(e,t)},getDataRows(){return Rb$1(e,t)},setCellPadding(a){return Yb$1(e,t,a),i$1},getCellPadding(){return Xb$1(e,t)},setCellBorders(a){return _b$1(e,t,a),i$1},hasCellBorders(){return Zb$1(e,t)},setStyle(a){return Ub$1(e,t,uh(a)),M(e,t),i$1},getDisplay(){return Vb$1(e,t)},renderLines(a){return ac$1(e,t,a)},destroy(){zb$1(e,t),i(e,t);}};return i$1}function qc(e,r){return yb$1(e,r)}var Yn=1e4,gn={VERTICAL:"\u2502",HORIZONTAL:"\u2500",BRANCH:"\u251C",CORNER:"\u2514",EXPANDED:"\u25BC",COLLAPSED:"\u25B6",SPACE:" "},yh=z.lazy(()=>z.object({label:z.string(),value:z.unknown().optional(),children:z.array(yh).optional(),expanded:z.boolean().optional(),icon:z.string().optional(),id:z.string().optional()})),hh=z.object({x:z.number().int().default(0),y:z.number().int().default(0),width:z.number().int().positive().default(40),height:z.number().int().positive().default(10),nodes:z.array(yh).default([]),selected:z.string().optional(),style:z.object({node:z.object({fg:z.number().optional(),bg:z.number().optional()}).optional(),selected:z.object({fg:z.number().optional(),bg:z.number().optional()}).optional(),expanded:z.object({fg:z.number().optional()}).optional(),collapsed:z.object({fg:z.number().optional()}).optional()}).optional(),showLines:z.boolean().default(true),keys:z.boolean().default(true),indent:z.number().int().min(1).max(8).default(2)}),j={isTree:new Uint8Array(Yn),state:new Uint8Array(Yn),showLines:new Uint8Array(Yn),keys:new Uint8Array(Yn),indent:new Uint8Array(Yn),firstVisible:new Uint32Array(Yn),visibleCount:new Uint32Array(Yn)},Ke=m({iterable:true}),Je=new Map,Ho=new Map,wo=new Map,jo=new Map,$o=new Map,ch=3435973887,gh=255,mh=255,fh=16777215,bh=2298448127,ph=2290679807,JW={0:"idle",1:"focused"};function Zc(){j.isTree.fill(0),j.state.fill(0),j.showLines.fill(0),j.keys.fill(0),j.indent.fill(0),j.firstVisible.fill(0),j.visibleCount.fill(0),Ke.clear(),Je.clear(),Ho.clear(),wo.clear(),jo.clear(),$o.clear();}var ZW=0;function e0(){return `node_${++ZW}`}function Jc(e,r,o=0){let n={label:e.label,value:e.value,children:[],expanded:e.expanded??false,icon:e.icon,id:e.id??e0(),parent:r,depth:o};return e.children&&(n.children=e.children.map(t=>Jc(t,n,o+1))),n}function t0(e,r,o){return r?.expanded?(e.collapse(o),{type:"collapse"}):(e.selectParent(),{type:"selectParent"})}function n0(e,r,o){return r&&r.children.length>0&&!r.expanded?(e.expand(o),{type:"expand"}):null}function r0(e,r,o,n){return r&&r.children.length>0?(e.toggle(o),{type:"toggle"}):(n(),{type:"confirm"})}function o0(e,r,o,n,t){if(e===0)return "";if(!o)return gn.SPACE.repeat(e*r);let i="";for(let a=0;a<e-1;a++)t[a]?i+=gn.SPACE.repeat(r):i+=gn.VERTICAL+gn.SPACE.repeat(r-1);return i+=n?gn.CORNER:gn.BRANCH,i+=gn.HORIZONTAL.repeat(r-1),i}function i0(e,r,o,n){let t=r;return e.children.length>0?(t+=e.expanded?gn.EXPANDED:gn.COLLAPSED,t+=" "):t+=" ",e.icon&&(t+=`${e.icon} `),t+=e.label,t.length>n&&(t=`${t.slice(0,n-1)}\u2026`),o?t=`[${t.padEnd(n-2)}]`:t=` ${t.padEnd(n-2)} `,t}function xh(e,r="",o=[]){let n=[];for(let t=0;t<e.length;t++){let i=e[t];if(!i)continue;let a=t===e.length-1,s=r?`${r}.${t}`:`${t}`;n.push({node:i,path:s,depth:i.depth,isLastChild:a,parentIsLast:[...o]}),i.expanded&&i.children.length>0&&n.push(...xh(i.children,s,[...o,a]));}return n}function nn(e,r){if(!r)return e[0];let o=r.split(".").map(Number),n=e[o[0]??0];for(let t=1;t<o.length&&n;t++){let i=o[t];i!==void 0&&(n=n.children[i]);}return n}function Xc(e,r){e.expanded=r;}function Sh(e){for(let r of e)r.expanded=true,r.children.length>0&&Sh(r.children);}function Ch(e){for(let r of e)r.expanded=false,r.children.length>0&&Ch(r.children);}function Yo(e,r,o={}){let n=hh.parse(o),t=r;j.isTree[t]=1,H(e,t,n.x,n.y),f(e,t,n.width,n.height),j.showLines[t]=n.showLines?1:0,j.keys[t]=n.keys?1:0,j.indent[t]=n.indent,j.visibleCount[t]=n.height;let i$1=n.nodes.map(c=>Jc(c));for(let c=0;c<i$1.length;c++){let g=i$1[c];g&&(g.rootIndex=c);}Ke.set(t,i$1),n.selected?Je.set(t,n.selected):i$1.length>0&&Je.set(t,"0");let a={nodeFg:n.style?.node?.fg??ch,nodeBg:n.style?.node?.bg??gh,selectedFg:n.style?.selected?.fg??mh,selectedBg:n.style?.selected?.bg??fh,expandedFg:n.style?.expanded?.fg??bh,collapsedFg:n.style?.collapsed?.fg??ph};Ho.set(t,a),wo.set(t,new Set),jo.set(t,new Set),$o.set(t,new Set);let s=()=>{let c=Je.get(t)??"",g=Ke.get(t)??[],p=nn(g,c);if(p){let h=wo.get(t);if(h)for(let E of h)E(c,p);}},l=()=>{let c=Je.get(t)??"",g=Ke.get(t)??[],p=nn(g,c);if(p){let h=jo.get(t);if(h)for(let E of h)E(c,p);}},u=(c,g)=>{let p=$o.get(t);if(p)for(let h of p)h(c,g);},d=()=>{let c=Ke.get(t)??[];return xh(c)},b=()=>{let c=d(),g=Je.get(t)??"",p=c.findIndex(M=>M.path===g);if(p<0)return;let h=j.firstVisible[t]??0,E=j.visibleCount[t]??0,C=h+E-1;p<h?j.firstVisible[t]=p:p>C&&(j.firstVisible[t]=Math.max(0,p-E+1));},m={eid:t,show(){return P(e,t,true),m},hide(){return P(e,t,false),m},move(c,g){return G.x[t]=(G.x[t]??0)+c,G.y[t]=(G.y[t]??0)+g,M(e,t),m},setPosition(c,g){return H(e,t,c,g),m},focus(){return j.state[t]=1,M(e,t),m},blur(){return j.state[t]=0,M(e,t),m},setNodes(c){let g=c.map(p=>Jc(p));return Ke.set(t,g),g.length>0?Je.set(t,"0"):Je.delete(t),j.firstVisible[t]=0,M(e,t),m},getNodes(){return Ke.get(t)??[]},getNode(c){let g=Ke.get(t)??[];return nn(g,c)},getVisibleNodes(){return d()},select(c){let g=Ke.get(t)??[];return nn(g,c)&&(Je.set(t,c),b(),M(e,t),s()),m},getSelectedPath(){return Je.get(t)??""},getSelectedNode(){let c=Je.get(t)??"",g=Ke.get(t)??[];return nn(g,c)},selectPrev(){let c=d(),g=Je.get(t)??"",p=c.findIndex(h=>h.path===g);if(p>0){let h=c[p-1];h&&m.select(h.path);}return m},selectNext(){let c=d(),g=Je.get(t)??"",p=c.findIndex(h=>h.path===g);if(p<c.length-1){let h=c[p+1];h&&m.select(h.path);}return m},selectFirst(){let c=d();if(c.length>0){let g=c[0];g&&m.select(g.path);}return m},selectLast(){let c=d();if(c.length>0){let g=c[c.length-1];g&&m.select(g.path);}return m},selectParent(){let g=(Je.get(t)??"").split(".");return g.length>1&&(g.pop(),m.select(g.join("."))),m},expand(c){let g=Ke.get(t)??[],p=nn(g,c);return p&&p.children.length>0&&!p.expanded&&(Xc(p,true),M(e,t),u(c,true)),m},collapse(c){let g=Ke.get(t)??[],p=nn(g,c);return p?.expanded&&(Xc(p,false),M(e,t),u(c,false)),m},toggle(c){let g=Ke.get(t)??[],p=nn(g,c);if(p&&p.children.length>0){let h=!p.expanded;Xc(p,h),M(e,t),u(c,h);}return m},expandAll(){let c=Ke.get(t)??[];return Sh(c),M(e,t),m},collapseAll(){let c=Ke.get(t)??[];return Ch(c),M(e,t),m},isExpanded(c){let g=Ke.get(t)??[];return nn(g,c)?.expanded??false},getState(){let c=j.state[t]??0;return JW[c]??"idle"},setStyle(c){let g=Ho.get(t)??{nodeFg:ch,nodeBg:gh,selectedFg:mh,selectedBg:fh,expandedFg:bh,collapsedFg:ph};return c.node?.fg!==void 0&&(g.nodeFg=c.node.fg),c.node?.bg!==void 0&&(g.nodeBg=c.node.bg),c.selected?.fg!==void 0&&(g.selectedFg=c.selected.fg),c.selected?.bg!==void 0&&(g.selectedBg=c.selected.bg),c.expanded?.fg!==void 0&&(g.expandedFg=c.expanded.fg),c.collapsed?.fg!==void 0&&(g.collapsedFg=c.collapsed.fg),Ho.set(t,g),M(e,t),m},setShowLines(c){return j.showLines[t]=c?1:0,M(e,t),m},getShowLines(){return j.showLines[t]===1},getFirstVisible(){return j.firstVisible[t]??0},setFirstVisible(c){return j.firstVisible[t]=Math.max(0,c),M(e,t),m},getVisibleCount(){return j.visibleCount[t]??0},renderLines(c){let g=d(),p=Je.get(t)??"",h=j.showLines[t]===1,E=j.indent[t]??2,C=j.firstVisible[t]??0,M=j.visibleCount[t]??g.length,P=[],I=Math.min(C+M,g.length);for(let L=C;L<I;L++){let _=g[L];if(!_)continue;let{node:be,path:ye,isLastChild:ht,parentIsLast:Fn}=_,$t=ye===p,Gr=o0(be.depth,E,h,ht,Fn),ni=i0(be,Gr,$t,c);P.push(ni);}return P},onSelect(c){let g=wo.get(t);return g&&g.add(c),()=>{g?.delete(c);}},onActivate(c){let g=jo.get(t);return g&&g.add(c),()=>{g?.delete(c);}},onToggle(c){let g=$o.get(t);return g&&g.add(c),()=>{g?.delete(c);}},handleKey(c){let g=j.state[t]??0,p=j.keys[t]===1;if(g!==1||!p)return null;let h=Je.get(t)??"",E=Ke.get(t)??[],C=nn(E,h);if(c==="G")return m.selectLast(),{type:"selectLast"};switch(c.toLowerCase()){case "up":case "k":return m.selectPrev(),{type:"selectPrev"};case "down":case "j":return m.selectNext(),{type:"selectNext"};case "left":case "h":return t0(m,C,h);case "right":case "l":return n0(m,C,h);case "enter":case " ":return r0(m,C,h,l);case "escape":return m.blur(),{type:"cancel"};case "g":return m.selectFirst(),{type:"selectFirst"}}return null},destroy(){j.isTree[t]=0,j.state[t]=0,j.showLines[t]=0,j.keys[t]=0,j.indent[t]=0,j.firstVisible[t]=0,j.visibleCount[t]=0,Ke.delete(t),Je.delete(t),Ho.delete(t),wo.delete(t),jo.delete(t),$o.delete(t),i(e,t);}};return m}function eg(e,r){return j.isTree[r]===1}function Ws(){let e=new Map,r=new Map;function o(i){return i.toLowerCase()}function n(i){let a=o(i);return r.get(a)??a}let t={register(i,a){let s=o(i);return e.set(s,a),t},alias(i,a){let s=o(i),l=o(a);if(!e.has(l)&&!r.has(l))throw new Error(`Cannot create alias '${i}' for non-existent widget type '${a}'`);return r.set(s,l),t},has(i){let a=n(i);return e.has(a)},get(i){let a=n(i);return e.get(a)},create(i,a,s){let l=h(i);return t.createWithEntity(i,l,a,s)},createWithEntity(i,a,s,l){let u=t.get(s);if(!u){let d=t.list().join(", ");throw new Error(`Unknown widget type '${s}'. Available types: ${d||"none"}`)}if(u.configSchema&&l!==void 0){let d=u.configSchema.safeParse(l);if(!d.success){let b=d.error.issues.map(m=>`${m.path.length>0?`${m.path.join(".")}: `:""}${m.message}`).join(", ");throw new Error(`Invalid config for widget type '${s}': ${b}`)}return u.factory(i,a,d.data)}return u.factory(i,a,l)},list(){return Array.from(e.keys()).sort()},listByTag(i){let a=i.toLowerCase();return Array.from(e.entries()).filter(([,s])=>s.tags?.some(l=>l.toLowerCase()===a)).map(([s])=>s).sort()},listByCategory(i){let a=i.toLowerCase();return Array.from(e.entries()).filter(([,s])=>s.category?.toLowerCase()===a).map(([s])=>s).sort()},search(i){let a=i.toLowerCase();return Array.from(e.entries()).filter(([s,l])=>!!(s.includes(a)||l.description?.toLowerCase().includes(a))).map(([s])=>s).sort()},info(i){let a=n(i),s=e.get(a);if(s)return {name:a,description:s.description??"",category:s.category??"",tags:s.tags??[],version:s.version??"",requiredComponents:s.requiredComponents??[],supportedEvents:s.supportedEvents??[],hasConfigSchema:s.configSchema!==void 0}},unregister(i){let a=o(i);for(let[s,l]of r.entries())l===a&&r.delete(s);return e.delete(a)},clear(){e.clear(),r.clear();}};return t}var a0=[{name:"bigText",factory:e,description:"Large ASCII art text display widget",tags:["display","text"],category:"display",version:"0.4.0",requiredComponents:["Position","Dimensions","Content"],supportedEvents:[],aliases:["bigtext"]},{name:"box",factory:ft,description:"Basic container widget with optional border and padding",tags:["container","layout","basic"],category:"basic",version:"0.4.0",requiredComponents:["Position","Dimensions","Border","Padding"],supportedEvents:[]},{name:"text",factory:kn,description:"Simple text display widget",tags:["display","text","basic"],category:"basic",version:"0.4.0",requiredComponents:["Position","Dimensions","Content"],supportedEvents:[]},{name:"line",factory:Wo,description:"Horizontal or vertical line separator",tags:["display","decoration","basic"],category:"basic",version:"0.4.0",requiredComponents:["Position","Dimensions"],supportedEvents:[]},{name:"layout",factory:To,description:"Auto-arranging container with flex/grid/inline modes",tags:["container","layout"],category:"layout",version:"0.4.0",requiredComponents:["Position","Dimensions","Hierarchy"],supportedEvents:[]},{name:"panel",factory:Ro,description:"Container with title bar and optional close/collapse buttons",tags:["container","layout","interactive"],category:"layout",version:"0.4.0",requiredComponents:["Position","Dimensions","Border","Focusable"],supportedEvents:["close","collapse","expand"]},{name:"tabs",factory:On,description:"Tabbed container with navigation",tags:["container","layout","navigation","interactive"],category:"layout",version:"0.4.0",requiredComponents:["Position","Dimensions","Focusable"],supportedEvents:["tabChange","tabClose"]},{name:"scrollableBox",factory:Bn,description:"Scrollable container with scrollbar support",tags:["container","scrolling"],category:"layout",version:"0.4.0",requiredComponents:["Position","Dimensions","Scrollable","Scrollbar"],supportedEvents:["scroll"],aliases:["scrollbox","scroll"]},{name:"scrollableText",factory:Uo,description:"Scrollable text display optimized for logs and documents",tags:["display","text","scrolling"],category:"display",version:"0.4.0",requiredComponents:["Position","Dimensions","Content","Scrollable"],supportedEvents:["scroll"],aliases:["log","textarea"]},{name:"list",factory:Rn,description:"Selectable list of items",tags:["selection","interactive","data"],category:"data",version:"0.4.0",requiredComponents:["Position","Dimensions","List","Focusable"],supportedEvents:["select","submit","cancel"]},{name:"listbar",factory:Mo,description:"Horizontal menu bar with selectable items",tags:["navigation","interactive","menu"],category:"layout",version:"0.4.0",requiredComponents:["Position","Dimensions","List","Focusable"],supportedEvents:["select","submit"],aliases:["menubar","menu"]},{name:"table",factory:Go,description:"Data table with rows and columns",tags:["display","data"],category:"data",version:"0.4.0",requiredComponents:["Position","Dimensions","Table"],supportedEvents:[]},{name:"listTable",factory:Bo,description:"Selectable data table combining list and table features",tags:["selection","interactive","data"],category:"data",version:"0.4.0",requiredComponents:["Position","Dimensions","Table","List","Focusable"],supportedEvents:["select","submit"],aliases:["datatable","grid"]},{name:"tree",factory:Yo,description:"Hierarchical tree view with expandable nodes",tags:["selection","interactive","data","hierarchy"],category:"data",version:"0.4.0",requiredComponents:["Position","Dimensions","List","Hierarchy","Focusable"],supportedEvents:["select","expand","collapse"],aliases:["treeview"]},{name:"loading",factory:Pr,description:"Loading indicator with spinner animation",tags:["display","feedback","animation"],category:"feedback",version:"0.4.0",requiredComponents:["Position","Dimensions","Spinner"],supportedEvents:[],aliases:["spinner","progress"]},{name:"hoverText",factory:yo,description:"Tooltip/hover text manager",tags:["feedback","tooltip"],category:"feedback",version:"0.4.0",requiredComponents:["Position","Dimensions","Content"],supportedEvents:["show","hide"],aliases:["tooltip"]}];function vs(e){for(let r of a0)if(e.register(r.name,{factory:r.factory,description:r.description,tags:r.tags,...r.category!==void 0&&{category:r.category},...r.version!==void 0&&{version:r.version},...r.requiredComponents!==void 0&&{requiredComponents:r.requiredComponents},...r.supportedEvents!==void 0&&{supportedEvents:r.supportedEvents}}),r.aliases)for(let o of r.aliases)e.alias(o,r.name);return e}var Or=vs(Ws());function tg(){return Or.list()}function ng(e){return Or.has(e)}function rg(e){return Or.listByTag(e)}var Th=Object.freeze({create:Ws,registerBuiltins:vs,getWidgetTypes:tg,getWidgetsByTag:rg,isWidgetType:ng,defaultRegistry:Or});var Wh=Object.freeze({create:Bn,is:Mn,isKeysScrollEnabled:xs,isMouseScrollEnabled:hs,resetStore:Ss});var vh=Object.freeze({create:Uo,is:Mn});var s0=30,l0=10,og=1e4,Lh=z.object({x:z.number().int().default(0),y:z.number().int().default(0),width:z.number().int().positive().default(s0),height:z.number().int().positive().default(l0),items:z.array(z.string()).default([]),enableSearch:z.boolean().default(true),placeholder:z.string().default("Filter..."),selected:z.number().int().min(-1).default(0),fg:z.number().int().nonnegative().optional(),bg:z.number().int().nonnegative().optional(),selectedFg:z.number().int().nonnegative().optional(),selectedBg:z.number().int().nonnegative().optional(),disabledFg:z.number().int().nonnegative().optional(),filterFg:z.number().int().nonnegative().optional(),filterBg:z.number().int().nonnegative().optional()}),dt={isSearchableList:new Uint8Array(og),visible:new Uint8Array(og),focused:new Uint8Array(og)},Ko=new Map;function Kn(e){if(e.filterQuery.length===0)e.filteredItems=[...e.items],e.filteredToOriginalMap=e.items.map((r,o)=>o);else {let r=e.filterQuery.toLowerCase();e.filteredItems=[],e.filteredToOriginalMap=[];for(let o=0;o<e.items.length;o++){let n=e.items[o];n?.text.toLowerCase().includes(r)&&(e.filteredItems.push(n),e.filteredToOriginalMap.push(o));}}e.filteredItems.length===0?e.selectedFilteredIndex=-1:(e.selectedFilteredIndex>=e.filteredItems.length||e.selectedFilteredIndex<0&&e.filteredItems.length>0)&&(e.selectedFilteredIndex=0),e.firstVisible=0;}function Vt(e){for(let r of e.callbacks)r(e.filteredItems,e.selectedFilteredIndex);}function Ls(e){e.selectedFilteredIndex<e.firstVisible?e.firstVisible=e.selectedFilteredIndex:e.selectedFilteredIndex>=e.firstVisible+e.visibleCount&&(e.firstVisible=e.selectedFilteredIndex-e.visibleCount+1);}function u0(e,r,o){if(e==="up"||e==="k")return o.selectPrev(),true;if(e==="down"||e==="j")return o.selectNext(),true;if(e==="home")return o.selectFirst(),true;if(e==="end")return o.selectLast(),true;if(e==="pageup"){let n=Math.max(0,r.selectedFilteredIndex-r.visibleCount);return o.select(n),Vt(r),true}if(e==="pagedown"){let n=Math.min(r.filteredItems.length-1,r.selectedFilteredIndex+r.visibleCount);return o.select(n),Vt(r),true}return false}function d0(e,r,o,n){return e==="backspace"?(o.filterQuery.length>0&&(o.filterQuery=o.filterQuery.slice(0,-1),Kn(o),Vt(o)),true):r&&e==="u"?(n.clearFilter(),true):e.length===1&&!r?(o.filterQuery+=e,Kn(o),Vt(o),true):false}function ig(e,r={}){let o=Lh.parse(r),n=h(e);dt.isSearchableList[n]=1,dt.visible[n]=1,dt.focused[n]=0;let t=o.items.map(u=>({text:u,value:u})),i$1=o.enableSearch?1:0,a=Math.max(1,o.height-i$1),s={items:t,filterQuery:"",filteredItems:[...t],filteredToOriginalMap:t.map((u,d)=>d),selectedFilteredIndex:t.length>0?Math.min(o.selected,t.length-1):-1,searchEnabled:o.enableSearch,placeholder:o.placeholder,visibleCount:a,firstVisible:0,width:o.width,fg:o.fg??4294967295,bg:o.bg??255,selectedFg:o.selectedFg??255,selectedBg:o.selectedBg??8978431,disabledFg:o.disabledFg??2290649343,filterFg:o.filterFg??4294967295,filterBg:o.filterBg??572662527,callbacks:[]};Ko.set(n,s);let l={eid:n,show(){return dt.visible[n]=1,l},hide(){return dt.visible[n]=0,l},focus(){return dt.focused[n]=1,l},blur(){return dt.focused[n]=0,l},isFocused(){return dt.focused[n]===1},setItems(u){return s.items=u.map(d=>({text:d,value:d})),Kn(s),Vt(s),l},getItems(){return s.items},setFilter(u){return s.filterQuery=u,Kn(s),Vt(s),l},getFilter(){return s.filterQuery},clearFilter(){return s.filterQuery="",Kn(s),Vt(s),l},getFilteredItems(){return s.filteredItems},getFilteredCount(){return s.filteredItems.length},getFilterStatus(){return s.filterQuery.length===0?`${s.items.length} items`:`${s.filteredItems.length} of ${s.items.length} items`},isSearchEnabled(){return s.searchEnabled},setSearchEnabled(u){s.searchEnabled=u;let d=u?1:0;return s.visibleCount=Math.max(1,o.height-d),u||(s.filterQuery="",Kn(s)),l},select(u){return u>=0&&u<s.filteredItems.length&&(s.selectedFilteredIndex=u,Ls(s)),l},getSelectedIndex(){return s.selectedFilteredIndex},getSelectedItem(){if(!(s.selectedFilteredIndex<0||s.selectedFilteredIndex>=s.filteredItems.length))return s.filteredItems[s.selectedFilteredIndex]},getOriginalSelectedIndex(){return s.selectedFilteredIndex<0?-1:s.filteredToOriginalMap[s.selectedFilteredIndex]??-1},selectPrev(){return s.selectedFilteredIndex>0&&(s.selectedFilteredIndex--,Ls(s),Vt(s)),l},selectNext(){return s.selectedFilteredIndex<s.filteredItems.length-1&&(s.selectedFilteredIndex++,Ls(s),Vt(s)),l},selectFirst(){return s.filteredItems.length>0&&(s.selectedFilteredIndex=0,s.firstVisible=0,Vt(s)),l},selectLast(){return s.filteredItems.length>0&&(s.selectedFilteredIndex=s.filteredItems.length-1,Ls(s),Vt(s)),l},onChange(u){return s.callbacks.push(u),()=>{let d=s.callbacks.indexOf(u);d!==-1&&s.callbacks.splice(d,1);}},handleKey(u,d=false,b=false){return u0(u,s,l)?true:u==="escape"?(s.filterQuery.length>0?l.clearFilter():l.blur(),true):s.searchEnabled?d0(u,d,s,l):false},destroy(){dt.isSearchableList[n]=0,dt.visible[n]=0,dt.focused[n]=0,Ko.delete(n),i(e,n);}};return l}function ag(e,r){return Ko.get(r)?.filteredItems??[]}function sg(e,r,o){let n=Ko.get(r);n&&(n.filterQuery=o,Kn(n),Vt(n));}function lg(e,r){return dt.isSearchableList[r]===1}function ug(){dt.isSearchableList.fill(0),dt.visible.fill(0),dt.focused.fill(0),Ko.clear();}var Eh=Object.freeze({create:ig,is:lg,setFilter:sg,getFilteredItems:ag,resetStore:ug});var c0=40,Mh=1e4,Bh=z.object({width:z.number().int().positive().default(c0),mode:z.enum(["plain","regex"]).default("plain"),caseSensitive:z.boolean().default(false),fg:z.number().int().nonnegative().optional(),bg:z.number().int().nonnegative().optional(),matchFg:z.number().int().nonnegative().optional(),matchBg:z.number().int().nonnegative().optional(),currentMatchFg:z.number().int().nonnegative().optional(),currentMatchBg:z.number().int().nonnegative().optional()}),_t={isSearchOverlay:new Uint8Array(Mh),visible:new Uint8Array(Mh)},Vr=new Map;function g0(e,r,o){return o==="r"?(e.toggleMode(),true):o==="i"?(e.setCaseSensitive(!r.caseSensitive),true):false}function m0(e,r,o,n,t){return e.isVisible()?o==="escape"?(e.hide(),true):o==="enter"||o==="return"?(t?e.prevMatch():e.nextMatch(),true):n?g0(e,r,o):o==="backspace"?(e.backspace(),true):o.length===1?(e.appendChar(o),true):false:n&&o==="f"?(e.show(),true):false}function f0(e){let r=e.caseSensitive?"g":"gi";try{let o=e.mode==="regex"?e.query:y0(e.query);return new RegExp(o,r)}catch{return null}}function b0(e,r,o){let n=[];e.lastIndex=0;let t=e.exec(r);for(;t!==null;)n.push({lineIndex:o,charOffset:t.index,length:t[0].length}),t[0].length===0&&e.lastIndex++,t=e.exec(r);return n}function p0(e){if(!e.content||e.query.length===0)return [];let r=f0(e);if(!r)return [];let o=[],n=e.content.getLineCount();for(let t=0;t<n;t++){let i=e.content.getLine(t);if(!i)continue;let a=b0(r,i,t);for(let s of a)o.push(s);}return o}function y0(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function mn(e){e.matches=p0(e),e.matches.length===0?e.currentMatchIndex=-1:(e.currentMatchIndex>=e.matches.length||e.currentMatchIndex<0)&&(e.currentMatchIndex=0);for(let r of e.matchCallbacks)r(e.matches,e.currentMatchIndex);}function dg(e,r={}){let o=Bh.parse(r),n=h(e);_t.isSearchOverlay[n]=1,_t.visible[n]=0;let t={query:"",mode:o.mode,caseSensitive:o.caseSensitive,matches:[],currentMatchIndex:-1,content:null,targetEid:null,width:o.width,fg:o.fg??4294967295,bg:o.bg??858993663,matchFg:o.matchFg??255,matchBg:o.matchBg??4294902015,currentMatchFg:o.currentMatchFg??255,currentMatchBg:o.currentMatchBg??4287103231,matchCallbacks:[],closeCallbacks:[]};Vr.set(n,t);let i$1={eid:n,show(){return _t.visible[n]=1,mn(t),i$1},hide(){_t.visible[n]=0,t.query="",t.matches=[],t.currentMatchIndex=-1;for(let a of t.closeCallbacks)a();return i$1},isVisible(){return _t.visible[n]===1},setQuery(a){return t.query=a,mn(t),i$1},getQuery(){return t.query},appendChar(a){return t.query+=a,mn(t),i$1},backspace(){return t.query.length>0&&(t.query=t.query.slice(0,-1),mn(t)),i$1},clearQuery(){return t.query="",mn(t),i$1},setMode(a){return t.mode=a,mn(t),i$1},getMode(){return t.mode},toggleMode(){return t.mode=t.mode==="plain"?"regex":"plain",mn(t),i$1},setCaseSensitive(a){return t.caseSensitive=a,mn(t),i$1},isCaseSensitive(){return t.caseSensitive},nextMatch(){if(t.matches.length===0)return i$1;t.currentMatchIndex=(t.currentMatchIndex+1)%t.matches.length;for(let a of t.matchCallbacks)a(t.matches,t.currentMatchIndex);return i$1},prevMatch(){if(t.matches.length===0)return i$1;t.currentMatchIndex=t.currentMatchIndex<=0?t.matches.length-1:t.currentMatchIndex-1;for(let a of t.matchCallbacks)a(t.matches,t.currentMatchIndex);return i$1},getMatches(){return t.matches},getCurrentMatchIndex(){return t.currentMatchIndex},getMatchCount(){return t.matches.length},getMatchStatus(){return t.matches.length===0?t.query.length>0?"No matches":"":`${t.currentMatchIndex+1} of ${t.matches.length}`},attachContent(a){return t.content=a,t.query.length>0&&mn(t),i$1},detachContent(){return t.content=null,t.matches=[],t.currentMatchIndex=-1,i$1},onMatchChange(a){return t.matchCallbacks.push(a),()=>{let s=t.matchCallbacks.indexOf(a);s!==-1&&t.matchCallbacks.splice(s,1);}},onClose(a){return t.closeCallbacks.push(a),()=>{let s=t.closeCallbacks.indexOf(a);s!==-1&&t.closeCallbacks.splice(s,1);}},handleKey(a,s=false,l=false){return m0(i$1,t,a,s,l)},destroy(){_t.visible[n]===1&&i$1.hide(),_t.isSearchOverlay[n]=0,_t.visible[n]=0,Vr.delete(n),i(e,n);}};return i$1}function cg(e,r,o,n){let t=Vr.get(r.eid);return t&&(t.targetEid=o),r.attachContent(n)}function gg(e,r){return _t.isSearchOverlay[r]===1}function mg(e){return Vr.get(e)?.targetEid??null}function fg(e){let r=Vr.get(e);return r?{fg:r.fg,bg:r.bg,matchFg:r.matchFg,matchBg:r.matchBg,currentMatchFg:r.currentMatchFg,currentMatchBg:r.currentMatchBg}:null}function bg(){_t.isSearchOverlay.fill(0),_t.visible.fill(0),Vr.clear();}var Ph=Object.freeze({create:dg,is:gg,attach:cg,getTarget:mg,getColors:fg,resetStore:bg});var Fh=z.object({x:z.number().int().default(0),y:z.number().int().default(0),width:z.number().int().positive().default(20),data:z.array(z.number()).default([]),fg:z.union([z.string(),z.number()]).optional(),bg:z.union([z.string(),z.number()]).optional(),showMin:z.boolean().default(false),showMax:z.boolean().default(false),gradient:z.boolean().default(false),gradientStart:z.union([z.string(),z.number()]).optional(),gradientEnd:z.union([z.string(),z.number()]).optional()}),Es=1e4,ct={isSparkline:new Uint8Array(Es),showMin:new Uint8Array(Es),showMax:new Uint8Array(Es),gradient:new Uint8Array(Es)},Pn=new Map;function h0(e){let r=Number.POSITIVE_INFINITY,o=Number.NEGATIVE_INFINITY;for(let n of e)n<r&&(r=n),n>o&&(o=n);return {min:r,max:o}}function x0(e,r,o,n,t,i,a,s){let l=[];return l.push([0,Math.max(0,Math.min(3,a))]),l.push([1,Math.max(0,Math.min(3,s))]),t&&(e===o||r===o)&&(l.push([0,3]),l.push([1,3])),i&&(e===n||r===n)&&(l.push([0,0]),l.push([1,0])),l}function S0(e,r,o,n,t,i,a){let s=o*2,l=r*2,u=r*2+1,d=Math.floor(l/s*e.length),b=Math.floor(u/s*e.length),m=e[d]??0,c=e[b]??0,g=Math.round(it(m,n,t,3,0)),p=Math.round(it(c,n,t,3,0)),h=x0(m,c,n,t,i,a,g,p);return Zr(h)}function C0(e,r,o,n){if(e.length===0)return " ".repeat(r);let{min:t,max:i}=h0(e);if(t===i)return String.fromCharCode(10308).repeat(r);let a=[];for(let s=0;s<r;s++)a.push(S0(e,s,r,t,i,o,n));return a.join("")}function Ms(e,r){let o=Pn.get(r);if(!o)return;let n=g(e,r);if(!n)return;let t=ct.showMin[r]===1,i=ct.showMax[r]===1,a=C0(o.data,n.width,t,i);e$1(e,r,a),M(e,r);}function pg(e,r={}){let o=Fh.parse(r),n=h(e);H(e,n,o.x,o.y),f(e,n,o.width,1),ct.isSparkline[n]=1,ct.showMin[n]=o.showMin?1:0,ct.showMax[n]=o.showMax?1:0,ct.gradient[n]=o.gradient?1:0;let t=It(1),i$1=It(3);Pn.set(n,{data:[...o.data],gradientStart:o.gradientStart?v(o.gradientStart):t,gradientEnd:o.gradientEnd?v(o.gradientEnd):i$1}),(o.fg!==void 0||o.bg!==void 0)&&J(e,n,{fg:o.fg!==void 0?v(o.fg):void 0,bg:o.bg!==void 0?v(o.bg):void 0}),Ms(e,n);let a={eid:n,setData(s){let l=Pn.get(n);return l&&(l.data=[...s],Ms(e,n)),a},getData(){return Pn.get(n)?.data??[]},append(s){let l=Pn.get(n);return l&&(l.data.push(s),Ms(e,n)),a},clear(){let s=Pn.get(n);return s&&(s.data=[],Ms(e,n)),a},setPosition(s,l){return H(e,n,s,l),M(e,n),a},destroy(){ct.isSparkline[n]=0,ct.showMin[n]=0,ct.showMax[n]=0,ct.gradient[n]=0,Pn.delete(n),i(e,n);}};return a}function yg(e,r){return ct.isSparkline[r]===1}function hg(){ct.isSparkline.fill(0),ct.showMin.fill(0),ct.showMax.fill(0),ct.gradient.fill(0),Pn.clear();}var Dh=Object.freeze({create:pg,is:yg,resetStore:hg});var Ah=z.union([z.number(),z.string().regex(/^\d+(\.\d+)?%$/,'Percentage must be in format "50%"'),z.enum(["center","left","right","top","bottom"])]),Ih=z.union([z.number(),z.string().regex(/^\d+(\.\d+)?%$/,'Percentage must be in format "50%"'),z.literal("auto")]),Vh=z.object({left:Ah.optional(),top:Ah.optional(),width:Ih.optional(),height:Ih.optional(),direction:z.enum(["horizontal","vertical"]).optional(),ratios:z.array(z.number().min(0).max(1)).optional(),minPaneSize:z.number().int().nonnegative().optional(),dividerSize:z.number().int().nonnegative().optional(),resizable:z.boolean().optional(),fg:z.union([z.string(),z.number()]).optional(),bg:z.union([z.string(),z.number()]).optional(),dividerFg:z.union([z.string(),z.number()]).optional(),dividerBg:z.union([z.string(),z.number()]).optional(),dividerChar:z.string().optional()}),_r=1e4,Se={isSplitPane:new Uint8Array(_r),direction:new Uint8Array(_r),paneCount:new Uint8Array(_r),minPaneSize:new Uint8Array(_r),dividerSize:new Uint8Array(_r),resizable:new Uint8Array(_r)},Pe=new Map,on=new Map,Fs=new Map,an=new Map,Ft=new Map;function Bs(e){return typeof e=="string"?t(e):e}function kh(e){if(e===void 0)return 0;if(typeof e=="number")return e;if(e==="left"||e==="top")return 0;if(e==="center")return 50;if(e==="right"||e==="bottom")return 100;if(typeof e=="string"&&e.endsWith("%")){let r=Number.parseFloat(e.slice(0,-1));if(!Number.isNaN(r))return r}return 0}function Rh(e){return e===void 0||typeof e=="string"&&e==="auto"?"auto":e}function Oh(e){let r=e.reduce((o,n)=>o+n,0);return r===0?e.map(()=>1/e.length):e.map(o=>o/r)}function T0(e){return e<=0?[]:new Array(e).fill(1/e)}function W0(e,r,o,n,t,i,a){let s=i.length;if(s===0)return [];let l=a*(s-1),u=t==="horizontal"?o-l:n-l,d=Math.max(0,u),b=[],m=0,c=0;for(let g=0;g<s;g++){let p=g===s-1,h=p?Math.max(1,d-c):Math.max(1,Math.round(d*(i[g]??0)));t==="horizontal"?b.push({x:e+m,y:r,width:h,height:n}):b.push({x:e,y:r+m,width:o,height:h}),m+=h,c+=h,p||(m+=a);}return b}function v0(e,r,o,n,t){let i=[...e],a=t>0?n/t:0,s=(i[r]??0)+o,l=(i[r+1]??0)-o;if(s<a){let u=a-(i[r]??0);i[r]=a,i[r+1]=(i[r+1]??0)-u;}else if(l<a){let u=(i[r+1]??0)-a;i[r]=(i[r]??0)+u,i[r+1]=a;}else i[r]=s,i[r+1]=l;return i}function L0(e,r,o,n,t,i){let a=[];for(let s=0;s<Math.max(e.length,r.length);s++){let l=e[s],u=r[s];if(!l||!u){let d=u??l;d&&a.push(d);continue}if(l.x!==u.x||l.y!==u.y||l.width!==u.width||l.height!==u.height){let d=Math.min(l.x,u.x),b=Math.min(l.y,u.y),m=Math.max(l.x+l.width,u.x+u.width),c=Math.max(l.y+l.height,u.y+u.height);a.push({x:Math.max(o,d),y:Math.max(n,b),width:Math.min(o+t,m)-Math.max(o,d),height:Math.min(n+i,c)-Math.max(n,b)});}}return a}function E0(){return {scrollX:0,scrollY:0,contentWidth:0,contentHeight:0}}function Ps(e,r){let o=Math.max(0,e.contentWidth-r.width),n=Math.max(0,e.contentHeight-r.height);e.scrollX=Math.max(0,Math.min(e.scrollX,o)),e.scrollY=Math.max(0,Math.min(e.scrollY,n));}function M0(e,r,o,n,t,i,a){Se.isSplitPane[r]=1,Se.direction[r]=n==="horizontal"?0:1,Se.paneCount[r]=0,Se.minPaneSize[r]=t,Se.dividerSize[r]=i,Se.resizable[r]=a?1:0,Pe.set(r,[]),on.set(r,[]),Ft.set(r,[]),Fs.set(r,{fg:o.dividerFg!==void 0?Bs(o.dividerFg):void 0,bg:o.dividerBg!==void 0?Bs(o.dividerBg):void 0,char:o.dividerChar??(n==="horizontal"?"\u2502":"\u2500")});let s=kh(o.left),l=kh(o.top);H(e,r,s,l);let u=Rh(o.width),d=Rh(o.height);f(e,r,u,d),(o.fg!==void 0||o.bg!==void 0)&&J(e,r,{fg:o.fg!==void 0?Bs(o.fg):void 0,bg:o.bg!==void 0?Bs(o.bg):void 0}),q$1(e,r,{focusable:true});}function xg(e,r,o={}){let n=Vh.parse(o),t=r,i$1=n.direction??"horizontal",a=n.minPaneSize??3,s$1=n.dividerSize??1,l=n.resizable!==false;M0(e,t,n,i$1,a,s$1,l);let u$1=n.ratios?Oh(n.ratios):[];function d(C){let M=an.get(C);M&&(M.refCount--,M.refCount<=0&&an.delete(C));}function b(){let C=g(e,t);return {x:0,y:0,width:C?.width??80,height:C?.height??24}}function m(C,M){for(let P=0;P<C.length;P++){let I=C[P],L=M[P];!I||!L||(I.viewport=L,Ps(I.scroll,L),I.dirty=true);}}function c(C){let M=on.get(t)??[];for(let P=0;P<M.length;P++){let I=M[P];if(!I)continue;let L=0;for(let _=0;_<=P;_++)L+=C[_]??0;I.ratio=L;}}function g$1(C,M){for(let P=0;P<C.length;P++){let I=C[P],L=M[P];!I||!L||(H(e,I.entity,L.x,L.y),f(e,I.entity,L.width,L.height));}}function p(){let C=Pe.get(t);if(!C||C.length===0)return;let M$1=b(),P=W0(M$1.x,M$1.y,M$1.width,M$1.height,i$1,u$1,s$1);m(C,P),c(u$1),g$1(C,P),Se.paneCount[t]=C.length,M(e,t);}function h(C){let M=Pe.get(t)??[],P={entity:C,viewport:{x:0,y:0,width:0,height:0},scroll:E0(),sharedBufferId:void 0,dirty:true};M.push(P),Pe.set(t,M),u$1.length<M.length&&(u$1=T0(M.length));let I=on.get(t)??[];if(M.length>1&&I.length<M.length-1){let L=0;for(let _=0;_<I.length+1;_++)L+=u$1[_]??0;I.push({ratio:L,dragging:false,dragStartPos:0,dragStartRatio:0,dragStartRatios:[]}),on.set(t,I);}d$1(e,t,C),p();}let E={eid:t,show(){return P(e,t,true),E},hide(){return P(e,t,false),E},move(C,M$2){return M$1(e,t,C,M$2),M(e,t),E},setPosition(C,M){return H(e,t,C,M),p(),E},getDirection(){return i$1},getRatios(){return [...u$1]},setRatios(C){let M=Pe.get(t)??[];return C.length!==M.length||(u$1=Oh(C),p()),E},getPaneCount(){return (Pe.get(t)??[]).length},getPaneViewport(C){return (Pe.get(t)??[])[C]?.viewport},getAllPaneViewports(){return (Pe.get(t)??[]).map(C=>C.viewport)},scrollPane(C,M$1,P){let L=(Pe.get(t)??[])[C];if(!L)return E;L.scroll.scrollX+=M$1,L.scroll.scrollY+=P,Ps(L.scroll,L.viewport),L.dirty=true;let _=Ft.get(t)??[];return _.push(L.viewport),Ft.set(t,_),M(e,t),E},setPaneScroll(C,M$1,P){let L=(Pe.get(t)??[])[C];if(!L)return E;L.scroll.scrollX=M$1,L.scroll.scrollY=P,Ps(L.scroll,L.viewport),L.dirty=true;let _=Ft.get(t)??[];return _.push(L.viewport),Ft.set(t,_),M(e,t),E},getPaneScroll(C){let P=(Pe.get(t)??[])[C];if(P)return {...P.scroll}},setPaneContentSize(C,M,P){let L=(Pe.get(t)??[])[C];return L&&(L.scroll.contentWidth=M,L.scroll.contentHeight=P,Ps(L.scroll,L.viewport)),E},attachBuffer(C,M$1){let I=(Pe.get(t)??[])[C];if(!I)return E;I.sharedBufferId&&d(I.sharedBufferId),I.sharedBufferId=M$1.id,an.has(M$1.id)||an.set(M$1.id,M$1);let L=an.get(M$1.id);return L&&L.refCount++,I.scroll.contentHeight=M$1.lines.length,I.dirty=true,M(e,t),E},detachBuffer(C){let P=(Pe.get(t)??[])[C];return !P||!P.sharedBufferId||(d(P.sharedBufferId),P.sharedBufferId=void 0,P.dirty=true,M(e,t)),E},getBuffer(C){let P=(Pe.get(t)??[])[C];if(!(!P||!P.sharedBufferId))return an.get(P.sharedBufferId)},beginDrag(C,M){if(!l)return E;let I=(on.get(t)??[])[C];return I&&(I.dragging=true,I.dragStartPos=M,I.dragStartRatio=I.ratio,I.dragStartRatios=[...u$1]),E},updateDrag(C,M){if(!l)return;let I=(on.get(t)??[])[C];if(!I||!I.dragging)return;let L=b(),_=i$1==="horizontal"?L.width:L.height,be=s$1*(u$1.length-1),ye=Math.max(1,_-be),Fn=(M-I.dragStartPos)/ye,$t=(Pe.get(t)??[]).map(zs=>zs.viewport);u$1=v0(I.dragStartRatios,C,Fn,a,ye),p();let Gr=(Pe.get(t)??[]).map(zs=>zs.viewport),ni=L0($t,Gr,L.x,L.y,L.width,L.height),am=Ft.get(t)??[];return am.push(...ni),Ft.set(t,am),{dividerIndex:C,ratios:[...u$1],dirtyRects:ni}},endDrag(C){let P=(on.get(t)??[])[C];return P&&(P.dragging=false,P.dragStartPos=0,P.dragStartRatio=0,P.dragStartRatios=[]),E},isDragging(){return (on.get(t)??[]).some(M=>M.dragging)},getDirtyRects(){return [...Ft.get(t)??[]]},markPaneDirty(C){let P=(Pe.get(t)??[])[C];if(!P)return E;P.dirty=true;let I=Ft.get(t)??[];return I.push(P.viewport),Ft.set(t,I),M(e,t),E},flushDirty(){let C=Pe.get(t)??[];for(let M of C)M.dirty=false;return Ft.set(t,[]),E},recalculate(){return p(),E},focus(){return u(e,t),E},blur(){return v$1(e,t),E},isFocused(){return s(e,t)},append(C){return h(C),E},getChildren(){return f$1(e,t)},destroy(){let C=Pe.get(t)??[];for(let M of C)M.sharedBufferId&&d(M.sharedBufferId);Se.isSplitPane[t]=0,Se.direction[t]=0,Se.paneCount[t]=0,Se.minPaneSize[t]=0,Se.dividerSize[t]=0,Se.resizable[t]=0,Pe.delete(t),on.delete(t),Fs.delete(t),Ft.delete(t),i(e,t);}};return E}function Sg(e,r){return Se.isSplitPane[r]===1}function Cg(e,r){return Se.direction[r]===0?"horizontal":"vertical"}function Tg(e,r){let o=an.get(e);if(o)return o;let n={id:e,lines:r,refCount:0};return an.set(e,n),n}function Wg(e){return an.get(e)}function B0(e,r,o,n,t){for(let i=0;i<e.length-1;i++){let a=e[i];if(!a)continue;let s=r?a.viewport.x+a.viewport.width:a.viewport.y+a.viewport.height,l=r?n:t;if(l>=s&&l<s+o)return i}return -1}function vg(e,r,o,n){if(Se.isSplitPane[r]!==1)return -1;let t=Pe.get(r);if(!t||t.length<2)return -1;let i=Se.direction[r]===0,a=Se.dividerSize[r]??1;return B0(t,i,a,o,n)}function Lg(e,r){if(Se.isSplitPane[r]!==1)return [];let o=Pe.get(r);if(!o||o.length<2)return [];let n=Se.direction[r]===0?"horizontal":"vertical",t=Se.dividerSize[r]??1,i=Fs.get(r)??{fg:void 0,bg:void 0,char:"\u2502"},a=[];for(let s=0;s<o.length-1;s++){let l=o[s];l&&(n==="horizontal"?a.push({x:l.viewport.x+l.viewport.width,y:l.viewport.y,width:t,height:l.viewport.height,char:i.char,fg:i.fg,bg:i.bg}):a.push({x:l.viewport.x,y:l.viewport.y+l.viewport.height,width:l.viewport.width,height:t,char:i.char,fg:i.fg,bg:i.bg}));}return a}function Eg(){Se.isSplitPane.fill(0),Se.direction.fill(0),Se.paneCount.fill(0),Se.minPaneSize.fill(0),Se.dividerSize.fill(0),Se.resizable.fill(0),Pe.clear(),on.clear(),Fs.clear(),Ft.clear(),an.clear();}var _h=Object.freeze({create:xg,is:Sg,getDirection:Cg,getDividerRenderInfo:Lg,hitTestDivider:vg,createSharedTextBuffer:Tg,getSharedTextBuffer:Wg,resetStore:Eg});var P0=z.object({maxLines:z.number().int().nonnegative().default(1e4),wrapWidth:z.number().int().positive().default(80),autoScroll:z.boolean().default(true),stripAnsi:z.boolean().default(false)}),F0={maxLines:1e4,wrapWidth:80,autoScroll:true,stripAnsi:false};function Xo(e,r){if(r<=0)return [e];if(e.length<=r)return [e];let o=[],n=e;for(;n.length>r;)o.push(n.slice(0,r)),n=n.slice(r);return n.length>0&&o.push(n),o}function Ds(e){return e.replace(/\x1b(?:\[[0-9;?]*[a-zA-Z~]|\][^\x07\x1b]*(?:\x07|\x1b\\)?|[^[\]])/g,"")}function qo(e,r=24){return {lines:[],scrollTop:0,viewportHeight:r,totalBytes:0,isStreaming:false,config:{...F0,...e},partialLine:"",dirty:null}}function zr(e,r){let o=r;e.config.stripAnsi&&(o=Ds(o));let n=e.totalBytes+o.length,i=(e.partialLine+o).split(`
|
|
19
|
+
`),a=i.pop()??"",s=[];for(let c of i){let g=Xo(c,e.config.wrapWidth);for(let p of g)s.push(p);}let l=[...e.lines,...s],u=0;e.config.maxLines>0&&l.length>e.config.maxLines&&(u=l.length-e.config.maxLines,l=l.slice(u));let b={startLine:Math.max(0,l.length-s.length),lineCount:s.length,fullRedraw:u>0},m=e.scrollTop;return u>0&&(m=Math.max(0,m-u)),e.config.autoScroll&&(m=Math.max(0,l.length-e.viewportHeight)),{...e,lines:l,scrollTop:m,totalBytes:n,partialLine:a,dirty:b}}function As(e){return {...e,lines:[],scrollTop:0,totalBytes:0,partialLine:"",dirty:{startLine:0,lineCount:0,fullRedraw:true}}}function Is(e){let r=e.scrollTop,o=Math.min(r+e.viewportHeight,e.lines.length);return e.lines.slice(r,o)}function Qn(e,r){let o=Math.max(0,e.lines.length-e.viewportHeight),n=Math.max(0,Math.min(r,o));return n===e.scrollTop?e:{...e,scrollTop:n,dirty:{startLine:0,lineCount:e.viewportHeight,fullRedraw:true}}}function ks(e,r){return Qn(e,e.scrollTop+r)}function Mg(e,r,o){let n=r,t=qo(o),i={eid:n,append(a){return t=zr(t,a),M(e,n),i},appendLine(a){return t=zr(t,`${a}
|
|
20
|
+
`),M(e,n),i},clear(){return t=As(t),M(e,n),i},getState(){return t},getVisibleLines(){return Is(t)},getProgress(){return {totalBytes:t.totalBytes,totalLines:t.lines.length,visibleLines:Math.min(t.viewportHeight,t.lines.length),isAutoScrolling:t.config.autoScroll,isStreaming:t.isStreaming}},consumeDirty(){let a=t.dirty;return t={...t,dirty:null},a},scrollTo(a){return t=Qn(t,a),M(e,n),i},scrollBy(a){return t=ks(t,a),M(e,n),i},scrollToBottom(){let a=Math.max(0,t.lines.length-t.viewportHeight);return t=Qn(t,a),M(e,n),i},scrollToTop(){return t=Qn(t,0),M(e,n),i},setViewportHeight(a){return t={...t,viewportHeight:a},i},setWrapWidth(a){let s={...t.config,wrapWidth:a},l=t.lines.join(`
|
|
21
|
+
`)+(t.partialLine?t.partialLine:"");return t=qo(s,t.viewportHeight),l.length>0&&(t=zr(t,l)),M(e,n),i},setAutoScroll(a){return t={...t,config:{...t.config,autoScroll:a}},i},startStream(){return t={...t,isStreaming:true},i},endStream(){if(t.partialLine.length>0){let a=Xo(t.partialLine,t.config.wrapWidth),s=[...t.lines,...a];t={...t,lines:s,partialLine:"",isStreaming:false,dirty:{startLine:Math.max(0,s.length-a.length),lineCount:a.length,fullRedraw:false}},t.config.autoScroll&&(t={...t,scrollTop:Math.max(0,s.length-t.viewportHeight)}),M(e,n);}else t={...t,isStreaming:false};return i}};return i}var zh=Object.freeze({create:Mg,createState:qo,appendToState:zr,clearState:As,getVisibleLines:Is,scrollToLine:Qn,scrollByLines:ks,wrapLine:Xo,stripAnsi:Ds});var Uh=z.object({x:z.number().int().default(0),y:z.number().int().default(0),checked:z.boolean().default(false),onLabel:z.string().default("ON"),offLabel:z.string().default("OFF"),onFg:z.union([z.string(),z.number()]).optional(),onBg:z.union([z.string(),z.number()]).optional(),offFg:z.union([z.string(),z.number()]).optional(),offBg:z.union([z.string(),z.number()]).optional(),focusable:z.boolean().default(true),visible:z.boolean().default(true)}),Nh=1e4,D0="#ffffff",A0="#4caf50",I0="#000000",k0="#757575",et={isSwitch:new Uint8Array(Nh),checked:new Uint8Array(Nh)},zt=new Map;function Nr(e,r){let o=zt.get(r);if(!o)return;let n=et.checked[r]===1,t=n?o.onLabel:o.offLabel,i=n?o.onFg:o.offFg,a=n?o.onBg:o.offBg;e$1(e,r,` ${t} `),J(e,r,{fg:i,bg:a}),M(e,r);}function Bg(e,r={}){let o=Uh.parse(r),n=h(e);et.isSwitch[n]=1,et.checked[n]=o.checked?1:0;let t=o.onFg!==void 0?v(o.onFg):v(D0),i$1=o.onBg!==void 0?v(o.onBg):v(A0),a=o.offFg!==void 0?v(o.offFg):v(I0),s=o.offBg!==void 0?v(o.offBg):v(k0);zt.set(n,{onLabel:o.onLabel,offLabel:o.offLabel,onFg:t,onBg:i$1,offFg:a,offBg:s}),H(e,n,o.x,o.y);let l=Math.max(o.onLabel.length,o.offLabel.length);f(e,n,l+2,1),q$1(e,n,{focusable:o.focusable}),Nr(e,n),o.visible||P(e,n,false);let u={eid:n,isChecked(){return et.checked[n]===1},setChecked(d){let b=et.checked[n]===1;if(et.checked[n]=d?1:0,Nr(e,n),b!==d){let m=zt.get(n);m?.onChangeCallback&&m.onChangeCallback(d);}return u},toggle(){let d=et.checked[n]===0;return u.setChecked(d)},setOnLabel(d){let b=zt.get(n);return b&&(b.onLabel=d,Nr(e,n)),u},setOffLabel(d){let b=zt.get(n);return b&&(b.offLabel=d,Nr(e,n)),u},getOnLabel(){return zt.get(n)?.onLabel??""},getOffLabel(){return zt.get(n)?.offLabel??""},onChange(d){let b=zt.get(n);return b&&(b.onChangeCallback=d),u},show(){return P(e,n,true),u},hide(){return P(e,n,false),u},setPosition(d,b){return H(e,n,d,b),M(e,n),u},destroy(){et.isSwitch[n]=0,et.checked[n]=0,zt.delete(n),i(e,n);}};return u}function Jo(e,r){return et.isSwitch[r]===1}function Pg(e,r,o){if(!Jo(e,r)||o!==" "&&o!=="enter")return false;let t=!(et.checked[r]===1);et.checked[r]=t?1:0,Nr(e,r);let i=zt.get(r);return i?.onChangeCallback&&i.onChangeCallback(t),true}function Fg(e,r){if(!Jo(e,r))return false;let n=!(et.checked[r]===1);et.checked[r]=n?1:0,Nr(e,r);let t=zt.get(r);return t?.onChangeCallback&&t.onChangeCallback(n),true}function Dg(){et.isSwitch.fill(0),et.checked.fill(0),zt.clear();}var Gh=Object.freeze({create:Bg,is:Jo,handleKey:Pg,handleClick:Fg,resetStore:Dg});var Hh=Object.freeze({create:Go,is:qc});var wh=Object.freeze({create:On,is:Eu,getActiveIndex:Mu,getCount:Bu,getPosition:Pu,renderTabBar:Fu,resetStore:Du,DEFAULT_TAB_POSITION:Lu,TAB_CLOSE_CHAR:Aa,TAB_SEPARATOR:Da});var $h=z.union([z.number(),z.string().regex(/^\d+(\.\d+)?%$/,'Percentage must be in format "50%"'),z.enum(["center","left","right","top","bottom"])]),R0=z.object({type:z.enum(["line","bg","none"]).optional(),fg:z.union([z.string(),z.number()]).optional(),bg:z.union([z.string(),z.number()]).optional(),ch:z.union([z.enum(["single","double","rounded","bold","ascii"]),z.custom(e=>typeof e=="object"&&e!==null&&"topLeft"in e&&"topRight"in e&&"bottomLeft"in e&&"bottomRight"in e&&"horizontal"in e&&"vertical"in e)]).optional()}).optional(),Kh=z.object({shell:z.string().min(1).optional(),args:z.array(z.string()).optional(),env:z.record(z.string(),z.string()).optional(),cwd:z.string().min(1).optional(),term:z.string().min(1).default("xterm-256color"),cols:z.number().int().positive().optional(),rows:z.number().int().positive().optional(),autoResize:z.boolean().default(true)}),Qh=z.object({width:z.number().int().positive().default(80),height:z.number().int().positive().default(24),scrollback:z.number().int().nonnegative().default(1e3),cursorBlink:z.boolean().default(true),cursorShape:z.enum(["block","underline","bar"]).default("block"),left:$h.optional(),top:$h.optional(),border:R0,style:z.object({fg:z.union([z.string(),z.number()]).optional(),bg:z.union([z.string(),z.number()]).optional()}).optional(),mouse:z.boolean().default(true),keys:z.boolean().default(true)}),Ig=1e4,Dt={isTerminal:new Uint8Array(Ig),mouseEnabled:new Uint8Array(Ig),keysEnabled:new Uint8Array(Ig)},kg=new Map;function Yh(e){return e===void 0?0:typeof e=="number"?e:0}function O0(e){switch(e){case "line":return 1;case "bg":return 2;case "none":return 0}}function V0(e){switch(e){case "single":return b;case "double":return c;case "rounded":return d$2;case "bold":return e$2;case "ascii":return f$3}}function _0(e){let r=process.env.SHELL??"/bin/sh",o={...process.env};if(typeof e=="string")return {shell:e,args:[],env:o,cwd:void 0,term:"xterm-256color",cols:void 0,rows:void 0,autoResize:true};if(!e)return {shell:r,args:[],env:o,cwd:void 0,term:"xterm-256color",cols:void 0,rows:void 0,autoResize:true};let n=Kh.parse(e);return {shell:n.shell??r,args:n.args??[],env:n.env?{...process.env,...n.env}:o,cwd:n.cwd,term:n.term,cols:n.cols,rows:n.rows,autoResize:n.autoResize}}function z0(){let e=[()=>createRequire(pathToFileURL(`${process.cwd()}/`).href)("node-pty"),()=>createRequire(import.meta.url)("node-pty"),()=>{let r=process.argv[1];if(r)return createRequire(pathToFileURL(r).href)("node-pty");throw new Error("No main module")}];for(let r of e)try{return r()}catch{}return null}function N0(e,r,o){if(!o)return;let n=o.type?O0(o.type):1;if(l(e,r,{type:n,fg:o.fg!==void 0?v(o.fg):void 0,bg:o.bg!==void 0?v(o.bg):void 0}),o.ch){let t=typeof o.ch=="string"?V0(o.ch):o.ch;m$1(e,r,t);}}function U0(e,r,o){o&&J(e,r,{fg:o.fg!==void 0?v(o.fg):void 0,bg:o.bg!==void 0?v(o.bg):void 0});}function G0(e,r,o){let n=o!==void 0&&o.type!=="none";return {displayWidth:e+(n?2:0),displayHeight:r+(n?2:0)}}function Rg(e,r={}){let o=Qh.parse(r),n=h(e);Dt.isTerminal[n]=1,Dt.mouseEnabled[n]=o.mouse?1:0,Dt.keysEnabled[n]=o.keys?1:0;let t=Yh(o.left),i$1=Yh(o.top);H(e,n,t,i$1);let{displayWidth:a,displayHeight:s$1}=G0(o.width,o.height,o.border);f(e,n,a,s$1);let l={width:o.width,height:o.height,scrollbackLines:o.scrollback,cursorBlink:o.cursorBlink,cursorShape:o.cursorShape,cursorVisible:true};hc$1(e,n,l),U0(e,n,o.style),P(e,n,true),N0(e,n,o.border),q$1(e,n,{focusable:true});let u$1={pty:null,onDataCallback:null,onExitCallback:null,autoResize:true};kg.set(n,u$1);let d={eid:n,write(b){return mc$1(e,n,b),d},writeln(b){return mc$1(e,n,`${b}
|
|
22
|
+
`),d},clear(){return nc$1(e,n),d},reset(){return oc$1(e,n),d},scrollUp(b=1){return rc$2(e,n,b),d},scrollDown(b=1){return sc$1(e,n,b),d},scrollToTop(){return tc$2(e,n),d},scrollToBottom(){return uc$2(e,n),d},setCursor(b,m){return pc$1(e,n,b,m),d},showCursor(){return qc$2(e,n,true),d},hideCursor(){return qc$2(e,n,false),d},spawn(b){let m=z0();if(!m)return console.warn("node-pty is not installed. Install it with: pnpm add node-pty"),d;u$1.pty&&d.kill();let{shell:c,args:g,env:p,cwd:h,term:E,cols:C,rows:M,autoResize:P}=_0(b),I=kc$1(n),L=C??I?.width??80,_=M??I?.height??24;u$1.autoResize=P;let be=m.spawn(c,g,{name:E,cols:L,rows:_,...h!==void 0?{cwd:h}:{},env:p});return u$1.pty=be,be.onData(ye=>{mc$1(e,n,ye),u$1.onDataCallback&&u$1.onDataCallback(ye);}),be.onExit(({exitCode:ye,signal:ht})=>{u$1.pty=null,u$1.onExitCallback&&u$1.onExitCallback(ye,ht);}),d},input(b){let m=u$1.pty;return m&&m.write(b),d},resize(b,m){vc$2(e,n,b,m);let c=u$1.pty;c&&u$1.autoResize&&c.resize(b,m);let g=o.border!==void 0&&o.border.type!=="none",p=b+(g?2:0),h=m+(g?2:0);return f(e,n,p,h),M(e,n),d},kill(b="SIGTERM"){let m=u$1.pty;return m&&(m.kill(b),u$1.pty=null),d},isRunning(){return u$1.pty!==null},getPtyHandle(){return u$1.pty},onData(b){return u$1.onDataCallback=b,d},onExit(b){return u$1.onExitCallback=b,d},show(){return P(e,n,true),d},hide(){return P(e,n,false),d},focus(){return u(e,n),d},blur(){return v$1(e,n),d},isFocused(){return s(e,n)},getDimensions(){let b=kc$1(n);return {width:b?.width??0,height:b?.height??0}},getCursor(){let b=kc$1(n);return {x:b?.cursorX??0,y:b?.cursorY??0}},getState(){return jc$1(n)},getCells(){return yc$1(n)},destroy(){d.kill(),Dt.isTerminal[n]=0,Dt.mouseEnabled[n]=0,Dt.keysEnabled[n]=0,wc$2(n),kg.delete(n),i(e,n);},refresh(){return M(e,n),d}};return M(e,n),d}var H0={return:"\r",enter:"\r",backspace:"\x7F",tab:" ",escape:"\x1B",up:"\x1B[A",down:"\x1B[B",right:"\x1B[C",left:"\x1B[D",home:"\x1B[H",end:"\x1B[F",pageup:"\x1B[5~",pagedown:"\x1B[6~",delete:"\x1B[3~",insert:"\x1B[2~"};function w0(e,r){let o=H0[r];return o?(e.input(o),true):false}function j0(e,r){if(!r)return false;let o=r.toUpperCase().charCodeAt(0)-64;return o>=0&&o<=31?(e.input(String.fromCharCode(o)),true):false}function $0(e,r){return r?(e.input(`\x1B${r}`),true):false}function Y0(e,r,o,n,t){return w0(e,r)||n&&j0(e,o)||t&&$0(e,o)?true:o&&!n&&!t?(e.input(o),true):false}function K0(e,r,o){return r==="pageup"?(e.scrollUp(e.getDimensions().height),true):r==="pagedown"?(e.scrollDown(e.getDimensions().height),true):r==="home"&&o?(e.scrollToTop(),true):r==="end"&&o?(e.scrollToBottom(),true):false}function Og(e,r,o,n=false,t=false,i=false){return e.isRunning()?Y0(e,r,o,n,t):K0(e,r,n)}function Vg(e,r){return Dt.isTerminal[r]===1}function _g(e,r){return Dt.mouseEnabled[r]===1}function zg(e,r){return Dt.keysEnabled[r]===1}function Ng(){Dt.isTerminal.fill(0),Dt.mouseEnabled.fill(0),Dt.keysEnabled.fill(0),kg.clear();}var qh=Object.freeze({create:Rg,is:Vg,handleKey:Og,isKeysEnabled:zg,isMouseEnabled:_g,resetStore:Ng});var Xh=Object.freeze({create:kn,is:wl,getContent:Hl,setContent:so,resetStore:jl});var Jh=z.object({x:z.number().int().default(0),y:z.number().int().default(0),duration:z.number().positive(),format:z.enum(["ss","mm:ss","hh:mm:ss"]).default("mm:ss"),autoStart:z.boolean().default(false),onComplete:z.function().optional()}),Zh=z.object({x:z.number().int().default(0),y:z.number().int().default(0),format:z.enum(["ss","mm:ss","hh:mm:ss"]).default("mm:ss"),lapSupport:z.boolean().default(false),autoStart:z.boolean().default(false)}),Zo=1e4,gt={isTimer:new Uint8Array(Zo),running:new Uint8Array(Zo)},$e={isStopwatch:new Uint8Array(Zo),running:new Uint8Array(Zo),lapSupport:new Uint8Array(Zo)},qn=new Map,fn=new Map;function ex(e,r){let o=Math.max(0,Math.floor(e/1e3)),n=Math.floor(o/3600),t=Math.floor(o%3600/60),i=o%60,a=s=>s.toString().padStart(2,"0");switch(r){case "ss":return a(o);case "mm:ss":return `${a(t)}:${a(i)}`;case "hh:mm:ss":return `${a(n)}:${a(t)}:${a(i)}`}}function Ug(e,r){let o=qn.get(r);if(!o)return;let n=ex(o.remaining,o.format);e$1(e,r,n);}function Gg(e,r){let o=fn.get(r);if(!o)return;let n=ex(o.elapsed,o.format);e$1(e,r,n);}function tx(e){switch(e){case "ss":return 2;case "mm:ss":return 5;case "hh:mm:ss":return 8}}function Hg(e,r){let o=Jh.parse(r),n=h(e);gt.isTimer[n]=1,gt.running[n]=o.autoStart?1:0;let t=tx(o.format);f(e,n,t,1),H(e,n,o.x,o.y),qn.set(n,{remaining:o.duration,duration:o.duration,format:o.format,onComplete:o.onComplete}),Ug(e,n);let i$1={eid:n,start(){return gt.running[n]=1,i$1},pause(){return gt.running[n]=0,i$1},reset(){let a=qn.get(n);return a&&(a.remaining=a.duration,gt.running[n]=0,Ug(e,n),M(e,n)),i$1},getState(){let a=qn.get(n);return a?{remaining:a.remaining,duration:a.duration,running:gt.running[n]===1}:{remaining:0,duration:0,running:false}},setPosition(a,s){return H(e,n,a,s),M(e,n),i$1},move(a,s){return M$1(e,n,a,s),M(e,n),i$1},destroy(){gt.isTimer[n]=0,gt.running[n]=0,qn.delete(n),i(e,n);}};return i$1}function wg(e,r={}){let o=Zh.parse(r),n=h(e);$e.isStopwatch[n]=1,$e.running[n]=o.autoStart?1:0,$e.lapSupport[n]=o.lapSupport?1:0;let t=tx(o.format);f(e,n,t,1),H(e,n,o.x,o.y),fn.set(n,{elapsed:0,format:o.format,laps:[]}),Gg(e,n);let i$1={eid:n,start(){return $e.running[n]=1,i$1},pause(){return $e.running[n]=0,i$1},reset(){let a=fn.get(n);return a&&(a.elapsed=0,a.laps=[],$e.running[n]=0,Gg(e,n),M(e,n)),i$1},lap(){if($e.lapSupport[n]!==1)return i$1;let a=fn.get(n);return a&&a.laps.push(a.elapsed),i$1},getState(){let a=fn.get(n);return a?{elapsed:a.elapsed,running:$e.running[n]===1,laps:[...a.laps]}:{elapsed:0,running:false,laps:[]}},getLaps(){return fn.get(n)?.laps??[]},setPosition(a,s){return H(e,n,a,s),M(e,n),i$1},move(a,s){return M$1(e,n,a,s),M(e,n),i$1},destroy(){$e.isStopwatch[n]=0,$e.running[n]=0,$e.lapSupport[n]=0,fn.delete(n),i(e,n);}};return i$1}function Q0(e,r,o){let n=qn.get(r);n&&(n.remaining=Math.max(0,n.remaining-o),n.remaining===0&&(gt.running[r]=0,n.onComplete&&n.onComplete()),Ug(e,r),M(e,r));}function q0(e,r,o){let n=fn.get(r);n&&(n.elapsed+=o,Gg(e,r),M(e,r));}function jg(e,r){for(let o=0;o<gt.isTimer.length;o++)gt.isTimer[o]===1&>.running[o]===1&&Q0(e,o,r);for(let o=0;o<$e.isStopwatch.length;o++)$e.isStopwatch[o]===1&&$e.running[o]===1&&q0(e,o,r);}function $g(e,r){return gt.isTimer[r]===1}function Yg(e,r){return $e.isStopwatch[r]===1}function Kg(){gt.isTimer.fill(0),gt.running.fill(0),qn.clear();}function Qg(){$e.isStopwatch.fill(0),$e.running.fill(0),$e.lapSupport.fill(0),fn.clear();}var nx=Object.freeze({createTimer:Hg,createStopwatch:wg,isTimer:$g,isStopwatch:Yg,updateWidgets:jg,resetTimerStore:Kg,resetStopwatchStore:Qg});var X0=z.object({type:z.enum(["line","bg","none"]).optional(),fg:z.union([z.string(),z.number()]).optional(),bg:z.union([z.string(),z.number()]).optional(),ch:z.union([z.enum(["single","rounded"]),z.custom(e=>typeof e=="object"&&e!==null&&"topLeft"in e&&"topRight"in e&&"bottomLeft"in e&&"bottomRight"in e&&"horizontal"in e&&"vertical"in e)]).optional()}).optional(),Rs=z.object({fg:z.union([z.string(),z.number()]).optional(),bg:z.union([z.string(),z.number()]).optional(),borderFg:z.union([z.string(),z.number()]).optional()}).optional(),ix=z.object({content:z.string().optional(),type:z.enum(["info","success","warning","error"]).optional(),timeout:z.number().int().nonnegative().optional(),position:z.enum(["top-right","top-center","top-left","bottom-right","bottom-center","bottom-left"]).optional(),fg:z.union([z.string(),z.number()]).optional(),bg:z.union([z.string(),z.number()]).optional(),border:X0,padding:z.number().int().nonnegative().optional(),width:z.number().int().positive().optional(),infoStyle:Rs,successStyle:Rs,warningStyle:Rs,errorStyle:Rs}),Os=3e3,ti=1,ei=1,Vs={info:{fg:"#ffffff",bg:"#2196f3",borderFg:"#64b5f6"},success:{fg:"#ffffff",bg:"#4caf50",borderFg:"#81c784"},warning:{fg:"#000000",bg:"#ff9800",borderFg:"#ffb74d"},error:{fg:"#ffffff",bg:"#f44336",borderFg:"#e57373"}},rx=1e4,jt={isToast:new Uint8Array(rx),dismissed:new Uint8Array(rx)},sn=new Map,Ur={"top-right":new Set,"top-center":new Set,"top-left":new Set,"bottom-right":new Set,"bottom-center":new Set,"bottom-left":new Set};function J0(e){switch(e){case "single":return b;case "rounded":return d$2}}function Z0(e){switch(e){case "line":return 1;case "bg":return 2;case "none":return 0}}function ax(e,r){return {info:r.infoStyle,success:r.successStyle,warning:r.warningStyle,error:r.errorStyle}[e]??Vs[e]}function ev(e,r){let o=e.split(`
|
|
23
|
+
`),n=Math.max(...o.map(s=>s.length),10),t=o.length,i=n+r*2+2,a=t+r*2+2;return {width:i,height:a}}function ox(e,r,o,n){let t=Array.from(Ur[r]),i=0;r.startsWith("bottom")&&(i=n);for(let a of t){let s=g(e,a),l=s?.width??0,u=s?.height??0,d=0,b=0;r.endsWith("right")?d=o-l:r.endsWith("center")?d=Math.floor((o-l)/2):d=0,r.startsWith("top")?(b=i,i+=u+ei):(i-=u,b=i,i-=ei),H(e,a,d,b),M(e,a);}}function tv(e,r,o){jt.isToast[e]=1,jt.dismissed[e]=0,sn.set(e,{content:r.content??"",position:o}),Ur[o].add(e);}function nv(e,r,o){let n=o.content??"",t=o.padding??ti,{width:i,height:a}=ev(n,t),s=o.width??i;f(e,r,s,a),H(e,r,0,0);}function rv(e,r,o){let n=o.type??"info",t=ax(n,o),i=o.fg??t.fg,a=o.bg??t.bg;(i!==void 0||a!==void 0)&&J(e,r,{fg:i!==void 0?v(i):void 0,bg:a!==void 0?v(a):void 0});}function ov(e,r,o){let n=o.type??"info",t=ax(n,o),i=o.border?.type?Z0(o.border.type):1,a=o.border?.fg??t.borderFg;l(e,r,{type:i,fg:a!==void 0?v(a):void 0,bg:o.border?.bg!==void 0?v(o.border.bg):void 0});let s=o.border?.ch?typeof o.border.ch=="string"?J0(o.border.ch):o.border.ch:d$2;m$1(e,r,s);}function iv(e,r,o){let n=o.content??"";e$1(e,r,n,{align:1,valign:1});}function av(e,r,o,n){let t=o.timeout??Os;if(t<=0)return;let i=sn.get(r);i&&(i.timerId=setTimeout(()=>{n();},t));}function Xn(e,r={},o=80,n=24){let t=ix.parse(r),i$1=h(e),a=t.position??"top-right";tv(i$1,t,a),nv(e,i$1,t),rv(e,i$1,t),ov(e,i$1,t),iv(e,i$1,t);let s=t.padding??ti;d(e,i$1,{left:s,top:s,right:s,bottom:s}),ox(e,a,o,n);let l=()=>{if(jt.dismissed[i$1]===1)return;jt.dismissed[i$1]=1,P(e,i$1,false);let d=sn.get(i$1);d&&(Ur[d.position].delete(i$1),ox(e,d.position,o,n),d.timerId&&(clearTimeout(d.timerId),d.timerId=void 0),d.onDismissCallback&&d.onDismissCallback());};av(e,i$1,t,l);let u={eid:i$1,setContent(d){let b=sn.get(i$1);return b&&(b.content=d),e$1(e,i$1,d,{align:1,valign:1}),M(e,i$1),u},getContent(){return sn.get(i$1)?.content??""},show(){return P(e,i$1,true),u},hide(){return P(e,i$1,false),u},move(d,b){return M$1(e,i$1,d,b),M(e,i$1),u},dismiss:l,isDismissed(){return jt.dismissed[i$1]===1},onDismiss(d){let b=sn.get(i$1);return b&&(b.onDismissCallback=d),u},destroy(){let d=sn.get(i$1);d&&(d.timerId&&clearTimeout(d.timerId),Ur[d.position].delete(i$1)),jt.isToast[i$1]=0,jt.dismissed[i$1]=0,sn.delete(i$1),i(e,i$1);}};return u}function qg(e,r,o={},n=80,t=24){return Xn(e,{...o,content:r,type:"info"},n,t)}function Xg(e,r,o={},n=80,t=24){return Xn(e,{...o,content:r,type:"success"},n,t)}function Jg(e,r,o={},n=80,t=24){return Xn(e,{...o,content:r,type:"warning"},n,t)}function Zg(e,r,o={},n=80,t=24){return Xn(e,{...o,content:r,type:"error"},n,t)}function em(e,r){return jt.isToast[r]===1}function tm(){for(let e of sn.values())e.timerId&&clearTimeout(e.timerId);jt.isToast.fill(0),jt.dismissed.fill(0),sn.clear();for(let e of Object.keys(Ur))Ur[e].clear();}var sx=Object.freeze({create:Xn,is:em,showInfo:qg,showWarning:Jg,showError:Zg,showSuccess:Xg,resetStore:tm,DEFAULT_TOAST_PADDING:ti,DEFAULT_TOAST_STYLES:Vs,DEFAULT_TOAST_TIMEOUT:Os,TOAST_STACK_SPACING:ei});var lx=Object.freeze({create:Yo,is:eg,resetStore:Zc});var cx=z.object({fg:z.number().int().nonnegative().optional(),bg:z.number().int().nonnegative().optional(),selectedFg:z.number().int().nonnegative().optional(),selectedBg:z.number().int().nonnegative().optional(),cursorFg:z.number().int().nonnegative().optional(),cursorBg:z.number().int().nonnegative().optional(),showLineNumbers:z.boolean().optional(),lineNumberWidth:z.number().int().nonnegative().optional()}),gx=z.object({type:z.nativeEnum(a).optional(),fg:z.union([z.string(),z.number()]).optional(),bg:z.union([z.string(),z.number()]).optional()}),mx=z.object({x:z.number().int().default(0),y:z.number().int().default(0),width:z.number().int().positive(),height:z.number().int().positive(),lines:z.array(z.string()).optional(),mouse:z.boolean().default(true),keys:z.boolean().default(true),style:cx.optional(),border:gx.optional(),overscan:z.number().int().nonnegative().default(5),maxLines:z.number().int().nonnegative().default(0)}),sv=["fg","bg","selectedFg","selectedBg","cursorFg","cursorBg","showLineNumbers","lineNumberWidth"];function lv(e){let r={};for(let o of sv){let n=e[o];n!==void 0&&(r[o]=n);}return r}var ux=new WeakMap;function _s(e,r$1){if(e.store=r$1,h$5(e.world,e.eid,r$1),r(e.world,e.eid,r$1.lineCount),e.maxLines>0&&r$1.lineCount>e.maxLines){let o=w$1(r$1,e.maxLines);e.store=o,h$5(e.world,e.eid,o),r(e.world,e.eid,o.lineCount);}e.followMode&&p$1(e.world,e.eid),M(e.world,e.eid);}function dx(e,r){return Math.max(1,e-(r?2:0))}function nm(e,r){let o$3=mx.parse(r),n$2=h(e);H(e,n$2,o$3.x,o$3.y),f(e,n$2,o$3.width,o$3.height),a$2.x[n$2]=o$3.x,a$2.y[n$2]=o$3.y,a$2.width[n$2]=o$3.width,a$2.height[n$2]=o$3.height,a$2.valid[n$2]=1;let t=o$3.border!==void 0&&o$3.border.type!==0,i$1=dx(o$3.height,t),a;o$3.lines&&o$3.lines.length>0?a=g$3(o$3.lines):a=h$3(),e$5(e,n$2,a),e$6(e,n$2,{totalLineCount:a.lineCount,visibleLineCount:i$1,overscanBefore:o$3.overscan,overscanAfter:o$3.overscan,selectedLine:-1,cursorLine:-1});let s={fg:o$3.style?.fg??4294967295,bg:o$3.style?.bg??255};J(e,n$2,s),P(e,n$2,true);let l$1={};o$3.style?.fg!==void 0&&(l$1.fg=o$3.style.fg),o$3.style?.bg!==void 0&&(l$1.bg=o$3.style.bg),o$3.style?.selectedFg!==void 0&&(l$1.selectedFg=o$3.style.selectedFg),o$3.style?.selectedBg!==void 0&&(l$1.selectedBg=o$3.style.selectedBg),o$3.style?.cursorFg!==void 0&&(l$1.cursorFg=o$3.style.cursorFg),o$3.style?.cursorBg!==void 0&&(l$1.cursorBg=o$3.style.cursorBg),o$3.style?.showLineNumbers!==void 0&&(l$1.showLineNumbers=o$3.style.showLineNumbers),o$3.style?.lineNumberWidth!==void 0&&(l$1.lineNumberWidth=o$3.style.lineNumberWidth),i$3(e,n$2,l$1),o$3.border&&l(e,n$2,o$3.border);let u={world:e,eid:n$2,store:a,followMode:false,maxLines:o$3.maxLines,mouseEnabled:o$3.mouse,keysEnabled:o$3.keys},d={eid:n$2};ux.set(d,u),M(e,n$2);let b={eid:n$2,show(){return P(e,n$2,true),M(e,n$2),b},hide(){return P(e,n$2,false),M(e,n$2),b},setPosition(m,c){return H(e,n$2,m,c),a$2.x[n$2]=m,a$2.y[n$2]=c,M(e,n$2),b},setDimensions(m,c){f(e,n$2,m,c),a$2.width[n$2]=m,a$2.height[n$2]=c;let g=dx(c,t);return s$2(e,n$2,g),M(e,n$2),b},setLines(m){let c=m.length>0?g$3(m):h$3();return _s(u,c),b},appendLine(m){let c=m$3(u.store,u.store.byteSize>0?`
|
|
24
|
+
${m}`:m);return _s(u,c),b},appendLines(m){if(m.length===0)return b;let c=n$1(u.store,m);return _s(u,c),b},getLineCount(){return o$2(u.store)},getLine(m){return i$4(u.store,m)},clear(){return _s(u,h$3()),b},scrollToLine(m){return l$2(e,n$2,m),b},scrollToTop(){return o$1(e,n$2),b},scrollToBottom(){return p$1(e,n$2),b},scrollBy(m){return m$2(e,n$2,m),b},scrollPage(m){return n(e,n$2,m),b},getScrollInfo(){return q$4(e,n$2)},select(m){return u$1(e,n$2,m),b},getSelected(){return d$7.selectedLine[n$2]},clearSelection(){return u$1(e,n$2,-1),b},cursorUp(m=1){return y$1(e,n$2,-m),b},cursorDown(m=1){return y$1(e,n$2,m),b},setCursor(m){return d$7.cursorLine[n$2]=m,M(e,n$2),b},getCursor(){return d$7.cursorLine[n$2]},follow(m){return u.followMode=m,m&&p$1(e,n$2),b},isFollowing(){return u.followMode},setStyle(m){return i$3(e,n$2,lv(m)),M(e,n$2),b},destroy(){o(e,n$2),ux.delete(d),i(e,n$2);},refresh(){return M(e,n$2),b}};return b}function rm(e,r,o=false,n=false){switch(r){case "up":case "k":return e.cursorUp(n?5:1),true;case "down":case "j":return e.cursorDown(n?5:1),true;case "pageup":return e.scrollPage(-1),true;case "pagedown":return e.scrollPage(1),true;case "home":return o?(e.scrollToTop(),e.setCursor(0)):e.scrollToTop(),true;case "end":if(o){e.scrollToBottom();let t=e.getLineCount();e.setCursor(t-1);}else e.scrollToBottom();return true;case "g":return !o&&!n?(e.scrollToTop(),e.setCursor(0),true):false;case "G":return e.scrollToBottom(),e.setCursor(e.getLineCount()-1),true;case "enter":case "return":return e.select(e.getCursor()),true;default:return false}}function om(e,r,o=3){return r==="up"?e.scrollBy(-o):e.scrollBy(o),true}function im(e,r){return d$7.totalLineCount[r]!==void 0&&d$7.visibleLineCount[r]!==void 0}var fx=Object.freeze({create:nm,is:im,handleKey:rm,handleWheel:om});export{Yx as Accordion,zx as AccordionConfigSchema,Wl as Autocomplete,pb as AutocompleteConfigSchema,qt as BRAILLE_BASE,un as BRAILLE_DOTS,He as BarChart,xb as BarChartConfigSchema,gx as BorderConfigSchema,Xr as Box,cb as BoxConfigSchema,ro as ButtonWidgetComponent,vb as ButtonWidgetConfigSchema,br as CHART_COLORS,is as CLOSE_BUTTON_CHAR,as as COLLAPSE_CHAR,iS as Calendar,Eb as CalendarConfigSchema,Wa as Canvas,Ab as CanvasConfigSchema,uo as CheckboxWidgetComponent,Vb as CheckboxWidgetConfigSchema,Nx as CollapsibleConfigSchema,La as CommandPalette,Ub as CommandPaletteConfigSchema,_a as DEFAULT_CURSOR_OFFSET_X,za as DEFAULT_CURSOR_OFFSET_Y,Va as DEFAULT_HIDE_DELAY,Mr as DEFAULT_HORIZONTAL_CHAR,Oa as DEFAULT_HOVER_DELAY,Ka as DEFAULT_LINE_LENGTH,zd as DEFAULT_LOADING_BG,_d as DEFAULT_LOADING_FG,Fo as DEFAULT_MESSAGE_PADDING,ts as DEFAULT_MESSAGE_STYLES,es as DEFAULT_MESSAGE_TIMEOUT,Ir as DEFAULT_PANEL_TITLE,kc as DEFAULT_PROMPT_BG,Ic as DEFAULT_PROMPT_FG,us as DEFAULT_PROMPT_HEIGHT,ls as DEFAULT_PROMPT_WIDTH,Uc as DEFAULT_QUESTION_BG,Nc as DEFAULT_QUESTION_FG,ms as DEFAULT_QUESTION_HEIGHT,gs as DEFAULT_QUESTION_WIDTH,Lu as DEFAULT_TAB_POSITION,ti as DEFAULT_TOAST_PADDING,Vs as DEFAULT_TOAST_STYLES,Os as DEFAULT_TOAST_TIMEOUT,Ua as DEFAULT_TOOLTIP_BG,Ga as DEFAULT_TOOLTIP_BORDER,Na as DEFAULT_TOOLTIP_FG,Ya as DEFAULT_VERTICAL_CHAR,Au as DevTools,ep as DevToolsConfigSchema,ss as EXPAND_CHAR,Le as FileManager,op as FileManagerConfigSchema,Hu as FlexContainer,lp as FlexContainerConfigSchema,gp as Footer,mp as FooterConfigSchema,bo as FormComponent,pp as FormWidgetConfigSchema,Lt as Gauge,xp as GaugeConfigSchema,ad as Grid,Mp as GridConfigSchema,xa as HORIZONTAL_BLOCKS,Pp as Header,Fp as HeaderConfigSchema,q as Layout,Kp as LayoutConfigSchema,at as Line,Mt as LineChart,ty as LineChartConfigSchema,Zp as LineConfigSchema,fy as ListTableWidgetConfigSchema,zb as ListWidgetConfigSchema,dy as ListbarWidgetConfigSchema,yy as LoadingConfigSchema,py as LoadingStyleConfigSchema,ue as Log,Wy as LogConfigSchema,Fe as Message,Ey as MessageConfigSchema,Be as Modal,Py as ModalConfigSchema,st as MultiSelect,Iy as MultiSelectConfigSchema,Q as Panel,zy as PanelConfigSchema,qe as ProgressBarComponent,Hy as ProgressBarWidgetConfigSchema,Oo as Prompt,jy as PromptBorderConfigSchema,Rc as PromptConfigSchema,$y as PromptPaddingConfigSchema,Kh as PtyOptionsSchema,Vo as Question,Ky as QuestionConfigSchema,No as RadioButtonWidgetComponent,Xy as RadioButtonWidgetConfigSchema,zo as RadioGroupWidgetComponent,qy as RadioGroupWidgetConfigSchema,Xe as ScrollableBox,Ts as ScrollableBoxConfigSchema,_t as SearchOverlay,Bh as SearchOverlayConfigSchema,dt as SearchableList,Lh as SearchableListConfigSchema,ct as Sparkline,Fh as SparklineConfigSchema,Se as SplitPane,Vh as SplitPaneConfigSchema,$e as StopwatchComponent,Zh as StopwatchConfigSchema,P0 as StreamingTextConfigSchema,et as Switch,Uh as SwitchConfigSchema,Aa as TAB_CLOSE_CHAR,Da as TAB_SEPARATOR,ei as TOAST_STACK_SPACING,dh as TableWidgetConfigSchema,ce as Tabs,Jb as TabsConfigSchema,Dt as Terminal,Qh as TerminalConfigSchema,ao as Text,Db as TextConfigSchema,gt as TimerComponent,Jh as TimerConfigSchema,jt as Toast,ix as ToastConfigSchema,hh as TreeWidgetConfigSchema,Sa as VERTICAL_BLOCKS,mx as VirtualizedListConfigSchema,cx as VirtualizedListStyleSchema,fb as accordion,$u as addFlexChild,ld as addToGrid,zr as appendToState,bs as ask,cg as attachSearchOverlay,yb as autocomplete,Sb as barChart,Cb as bigText,Tb as box,Ml as brailleChar,Fl as brailleFillPattern,Lb as buttonWidget,$a as calculateFlexLayout,ja as calculateGridLayout,wa as calculateInlineLayout,ha as calculateTickInterval,Mb as calendar,Rb as canvas,Ob as chartUtils,_b as checkboxWidget,pd as clearAllHoverText,ql as clearCanvas,md as clearHoverText,mu as clearLines,As as clearState,sc as closeAllModals,Fr as closeModal,hl as collapseAllSections,bb as collapsible,Zr as combineBrailleDots,Hb as commandPalette,Gc as confirm,Ea as contentGetLine,lu as contentGetLineCount,wb as contentManipulation,$b as contextMenu,pl as createAccordion,vl as createAutocomplete,kl as createBarChart,ft as createBox,Vl as createButton,Ul as createCalendar,Jl as createCanvas,tu as createCheckbox,Sl as createCollapsible,au as createCommandPalette,Cu as createContextMenu,Iu as createDevTools,Vu as createFileManager,ju as createFlexContainer,Qu as createFooter,Zu as createForm,rd as createGauge,sd as createGrid,cd as createHeader,yo as createHoverTextManager,To as createLayout,Wo as createLine,Ad as createLineChart,Rn as createList,Bo as createListTable,Mo as createListbar,Pr as createLoading,jd as createLog,jn as createMessage,os as createModal,pc as createMultiSelect,Ro as createPanel,Fc as createProgressBar,ds as createPrompt,fs as createQuestion,ys as createRadioButton,$c as createRadioGroup,Bn as createScrollableBox,Uo as createScrollableText,dg as createSearchOverlay,ig as createSearchableList,Tg as createSharedTextBuffer,pg as createSparkline,xg as createSplitPane,wg as createStopwatch,qo as createStreamingState,Mg as createStreamingText,Bg as createSwitch,Go as createTable,On as createTabs,Rg as createTerminal,kn as createText,Hg as createTimer,Xn as createToast,Yo as createTree,nm as createVirtualizedList,Ws as createWidgetRegistry,Or as defaultRegistry,gu as deleteBottom,go as deleteLine,cu as deleteTop,tp as devTools,Kl as drawCircle,$l as drawLine,Yl as drawRect,Ql as drawText,yl as expandAllSections,ba as expandSection,ap as fileManager,Ve as fileManagerStateMap,dp as flexbox,cp as fonts,fp as footer,hp as formWidget,hn as formatNumber,eo as formatPercentage,Wp as gauge,An as generateTicks,Mu as getActiveTabIndex,uu as getBaseLine,cl as getBoxContent,Xl as getCanvasContent,It as getChartColor,Wu as getContextMenuSelectedIndex,Lg as getDividerRenderInfo,xl as getExpandedSections,fd as getHoverText,yd as getHoverTextCount,Wd as getLayoutMode,Md as getLineChar,Pd as getLineOrientation,Tt as getLines,uc as getModalStack,Tc as getPanelTitle,Lc as getPanelTitleAlign,Qd as getScrollback,fg as getSearchOverlayColors,mg as getSearchOverlayTarget,ag as getSearchableFilteredItems,yc as getSelectedItems,Wg as getSharedTextBuffer,Cg as getSplitDirection,Is as getStreamVisibleLines,Bu as getTabCount,Pu as getTabPosition,Hl as getTextContent,tg as getWidgetTypes,rg as getWidgetsByTag,Bp as grid,Tu as handleContextMenuKey,_u as handleFileManagerKey,tc as handleMessageClick,nc as handleMessageKey,gc as handleModalBackdropClick,mc as handleModalEscape,zc as handlePromptKey,wc as handleQuestionKey,Fg as handleSwitchClick,Pg as handleSwitchKey,Og as handleTerminalKey,rm as handleVirtualizedListKey,om as handleVirtualizedListWheel,bd as hasHoverText,Dp as header,Ud as hideLoading,vg as hitTestDivider,Op as hoverText,Hp as image,Pa as insertBottom,co as insertLine,Ba as insertTop,Bl as interpolateChartColor,pa as isAccordion,Ll as isAutocomplete,Rl as isBarChart,gl as isBox,_l as isButtonWidget,Gl as isCalendar,Zl as isCanvas,nu as isCheckboxWidget,Tl as isCollapsible,su as isCommandPalette,ku as isDevTools,ns as isDismissOnClick,rs as isDismissOnKey,zu as isFileManager,Yu as isFlexContainer,ed as isFormWidget,od as isGauge,ud as isGrid,xs as isKeysScrollEnabled,Td as isLayout,Ed as isLine,Id as isLineChart,Vd as isListTableWidget,ou as isListWidget,Od as isListbarWidget,qa as isLoadingWidget,$d as isLog,Kd as isLogKeysScrollEnabled,Yd as isLogMouseScrollEnabled,Do as isMessage,dc as isModal,lc as isModalOpen,hs as isMouseScrollEnabled,xc as isMultiSelect,Cc as isPanel,vc as isPanelCollapsed,MW as isProgressBarWidget,Vc as isPrompt,Hc as isQuestion,Kc as isRadioButtonWidget,Yc as isRadioGroupWidget,Mn as isScrollableBox,Mn as isScrollableText,gg as isSearchOverlay,lg as isSearchableList,yg as isSparkline,Sg as isSplitPane,Yg as isStopwatch,Jo as isSwitch,qc as isTableWidget,Eu as isTabs,Vg as isTerminal,zg as isTerminalKeysEnabled,_g as isTerminalMouseEnabled,wl as isText,$g as isTimer,em as isToast,eg as isTreeWidget,im as isVirtualizedList,ng as isWidgetType,Qp as layoutWidget,ey as line,ny as lineChart,by as listTable,ry as listWidget,cy as listbar,hy as loading,vy as log,By as message,Fy as modal,ky as multiSelect,hc as onSelectionChange,ac as openModal,Uy as panel,pu as popLine,wy as progressBarWidget,Oc as prompt,lt as promptStateMap,Yy as promptWidget,bu as pushLine,Qy as question,ut as questionStateMap,Zy as radioWidget,vs as registerBuiltinWidgets,Th as registry,pr as renderBrailleBar,Dl as renderBrailleGradientBar,Ec as renderPanelTitleBar,Fu as renderTabBar,Pl as renderXAxisLabel,In as renderYAxisLabel,xu as replaceLines,bl as resetAccordionStore,El as resetAutocompleteStore,Ol as resetBarChartStore,ml as resetBoxStore,zl as resetButtonWidgetStore,Nl as resetCalendarStore,eu as resetCanvasStore,ru as resetCheckboxWidgetStore,iu as resetCommandPaletteStore,Ru as resetDevToolsStore,Nu as resetFileManagerStore,Ku as resetFlexContainerStore,td as resetFormWidgetStore,id as resetGaugeStore,dd as resetGridStore,hd as resetHoverTextStore,vd as resetLayoutStore,kd as resetLineChartStore,Fd as resetLineStore,Rd as resetListbarStore,wd as resetLoadingStore,qd as resetLogStore,rc as resetMessageStore,cc as resetModalStore,Sc as resetMultiSelectStore,Mc as resetPanelStore,Dc as resetProgressBarWidgetStore,_c as resetPromptStore,jc as resetQuestionStore,Qc as resetRadioWidgetStore,Ss as resetScrollableBoxStore,bg as resetSearchOverlayStore,ug as resetSearchableListStore,hg as resetSparklineStore,Eg as resetSplitPaneStore,Qg as resetStopwatchWidgetStore,Dg as resetSwitchStore,Du as resetTabsStore,Ng as resetTerminalStore,jl as resetTextStore,Kg as resetTimerWidgetStore,tm as resetToastStore,Zc as resetTreeStore,it as scaleValue,Qn as scrollToLine,Wh as scrollableBox,vh as scrollableText,Ph as searchOverlay,Eh as searchableList,du as setBaseLine,dl as setBoxContent,gd as setHoverText,Ma as setLine,Bd as setLineChar,fu as setLines,Gd as setLoadingMessage,Wc as setPanelTitle,Ye as setPixel,Uu as setReadDirFn,sg as setSearchableFilter,so as setTextContent,yu as shiftLine,Zd as showError,Zg as showErrorToast,Xd as showInfo,qg as showInfoToast,Nd as showLoading,ec as showSuccess,Xg as showSuccessToast,Jd as showWarning,Jg as showWarningToast,Dh as sparkline,Su as spliceLines,_h as splitPane,ks as streamingScrollByLines,zh as streamingText,Ds as stripAnsiSequences,Gh as switchWidget,Hh as tableWidget,wh as tabs,qh as terminalWidget,Xh as text,nx as timerWidget,sx as toast,Cl as toggleCollapsible,Jr as toggleSection,lx as tree,hu as unshiftLine,Hd as updateLoadingAnimation,jg as updateTimeWidgets,fx as virtualizedList,Xo as wrapLine};
|