blecsd 0.6.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.
Files changed (78) hide show
  1. package/README.md +50 -28
  2. package/dist/blend-BZDmQFAm.d.ts +1215 -0
  3. package/dist/chunk-3PGACJB6.js +1 -0
  4. package/dist/chunk-4XW4WIPH.js +1 -0
  5. package/dist/chunk-7CLV3LTZ.js +4 -0
  6. package/dist/chunk-APPZ3YHO.js +0 -0
  7. package/dist/chunk-EKE2BXPS.js +1 -0
  8. package/dist/chunk-ESMSDY3P.js +1 -0
  9. package/dist/chunk-FJLSHFCF.js +1 -0
  10. package/dist/chunk-GIMWA5WA.js +1 -0
  11. package/dist/chunk-IXUFU6TE.js +3 -0
  12. package/dist/chunk-JB5KFQPD.js +1 -0
  13. package/dist/chunk-JCLNGU3K.js +1 -0
  14. package/dist/chunk-JRRJCATR.js +1 -0
  15. package/dist/{chunk-UKVY43V3.js → chunk-JWIVZCKW.js} +1 -1
  16. package/dist/chunk-K5UMVDQX.js +1 -0
  17. package/dist/chunk-L4FIDOS6.js +1 -0
  18. package/dist/chunk-LIVVHEOU.js +1 -0
  19. package/dist/chunk-M5FXA5FL.js +1 -0
  20. package/dist/{chunk-XH5GTWCV.js → chunk-MEJJLDEQ.js} +1 -1
  21. package/dist/chunk-NYIMY4UV.js +1 -0
  22. package/dist/chunk-PQZTNWLA.js +1 -0
  23. package/dist/chunk-SXOBHRXF.js +2 -0
  24. package/dist/chunk-T2EQLWMN.js +1 -0
  25. package/dist/chunk-T62UPG63.js +4 -0
  26. package/dist/chunk-TPBILYDM.js +10 -0
  27. package/dist/chunk-UWS6FIU5.js +1 -0
  28. package/dist/{chunk-4N7IFBRQ.js → chunk-W64J7C25.js} +1 -1
  29. package/dist/chunk-W6RELN6A.js +1 -0
  30. package/dist/chunk-ZAJI53SZ.js +1 -0
  31. package/dist/components/index.d.ts +3 -318
  32. package/dist/components/index.js +5 -5
  33. package/dist/core/index.d.ts +6 -251
  34. package/dist/core/index.js +1 -1
  35. package/dist/debug/index.js +7 -7
  36. package/dist/{dirtyTracking-kCS9-NVF.d.ts → dirtyTracking-D0SQrEeo.d.ts} +1 -1
  37. package/dist/{doubleBuffer-CWASihKh.d.ts → doubleBuffer-d9yVNtj1.d.ts} +21 -1
  38. package/dist/{mouseParser-CCqSEUVN.d.ts → events-CGqK6LGt.d.ts} +1 -176
  39. package/dist/index.d.ts +10 -9
  40. package/dist/index.js +1 -1
  41. package/dist/{inputStream-COARA4CP.d.ts → inputStream-BoFAEJ7g.d.ts} +205 -2
  42. package/dist/{interactiveSystem-h92W9W4n.d.ts → interactiveSystem-Dtv3xERg.d.ts} +316 -1
  43. package/dist/mouseParser-CTNGolIA.d.ts +177 -0
  44. package/dist/{panelMovement-DGzIQ8Ll.d.ts → panelMovement-DSLYdNOL.d.ts} +5 -4
  45. package/dist/style/index.d.ts +851 -0
  46. package/dist/style/index.js +1 -0
  47. package/dist/styleInheritance-CuRb5Dmp.d.ts +251 -0
  48. package/dist/systems/index.d.ts +6 -5
  49. package/dist/systems/index.js +1 -1
  50. package/dist/terminal/index.d.ts +201 -1295
  51. package/dist/terminal/index.js +1 -1
  52. package/dist/testing/index.d.ts +923 -0
  53. package/dist/testing/index.js +7 -0
  54. package/dist/text/index.js +1 -1
  55. package/dist/{textWrap-Ct2J8gO6.d.ts → textWrap-sY-PZzE7.d.ts} +1 -1
  56. package/dist/utils/index.d.ts +2 -2
  57. package/dist/widgets/bigText.js +1 -1
  58. package/dist/widgets/fonts/index.js +1 -1
  59. package/dist/widgets/index.js +18 -18
  60. package/package.json +16 -2
  61. package/dist/chunk-5YWRP2KG.js +0 -3
  62. package/dist/chunk-73Y45MLV.js +0 -12
  63. package/dist/chunk-A3GSH6MV.js +0 -1
  64. package/dist/chunk-A5B2BGUM.js +0 -1
  65. package/dist/chunk-EMZA6G2M.js +0 -4
  66. package/dist/chunk-ETFDYZVJ.js +0 -1
  67. package/dist/chunk-IANAVH2A.js +0 -1
  68. package/dist/chunk-JVMNMAHX.js +0 -1
  69. package/dist/chunk-K2QWNDXV.js +0 -1
  70. package/dist/chunk-LI3ZYXUT.js +0 -1
  71. package/dist/chunk-QABNK7IA.js +0 -1
  72. package/dist/chunk-QTDRFJG2.js +0 -1
  73. package/dist/chunk-SVHITP3F.js +0 -2
  74. package/dist/chunk-VIT4KE6Q.js +0 -1
  75. package/dist/chunk-XG5PVDOP.js +0 -1
  76. package/dist/chunk-YRSSCEAS.js +0 -1
  77. package/dist/chunk-ZL46COQF.js +0 -1
  78. /package/dist/{chunk-4XCFTNGN.js → chunk-4EV3YS7F.js} +0 -0
@@ -0,0 +1 @@
1
+ import {a,h,o as o$3}from'./chunk-PQZTNWLA.js';import {c as c$3,a as a$2}from'./chunk-FJLSHFCF.js';import {k as k$1,m as m$2,p,s,i,c as c$2,n as n$1,r as r$1}from'./chunk-GRMSEMU7.js';import {a as a$1,e as e$1,r,t,o as o$2}from'./chunk-C5PCEQ6G.js';import {c as c$1,u,o as o$1,m as m$3,p as p$3,k as k$2}from'./chunk-W6RELN6A.js';import {p as p$2,n,k as k$3}from'./chunk-EOFT3PNU.js';import {G,e,p as p$1,y,E,D as D$1,t as t$1,u as u$1}from'./chunk-JB5KFQPD.js';import {K,V,O,I,N}from'./chunk-LIVVHEOU.js';import {m as m$1,o}from'./chunk-7ZFQO3OQ.js';var c={eventQueue:[],capturedEntity:null,lastMouseX:0,lastMouseY:0,lastHoveredEntity:null,eventBus:a()};function Ut(){c.eventQueue=[],c.capturedEntity=null,c.lastMouseX=0,c.lastMouseY=0,c.lastHoveredEntity=null;}function Xt(e){c.eventQueue.push({type:"key",event:e,timestamp:Date.now()});}function qt(e){c.eventQueue.push({type:"mouse",event:e,timestamp:Date.now()});}function At(){return c.eventQueue}function Ft(){c.eventQueue=[];}function Gt(){return c.eventBus}function Zt(e){c.capturedEntity=e;}function at(){c.capturedEntity=null;}function jt(){return c.capturedEntity!==null}function Jt(){return c.capturedEntity}function ft(e$1,t,n,r){return !m$1(e$1,t,G)||!m$1(e$1,t,e)?false:ut(t,n,r)}function ut(e$1,t,n){let r=G.x[e$1]??0,u=G.y[e$1]??0,o=e.width[e$1]??0,i=e.height[e$1]??0;return o<=0||i<=0?false:t>=r&&t<r+o&&n>=u&&n<u+i}function $t(e$1,t,n){let r=[],u=o(e$1,[G,e]);for(let o of u){if(!ft(e$1,o,t,n))continue;let i=G.x[o]??0,s=G.y[o]??0,a=G.z[o]??0;r.push({entity:o,localX:t-i,localY:n-s,zIndex:a});}return r.sort((o,i)=>i.zIndex-o.zIndex),r}function mt(e$1,t,n){let r=null,u=Number.NEGATIVE_INFINITY;for(let o$1 of o(e$1,[G,e,c$1])){if(!ut(o$1,t,n))continue;let i=G.z[o$1]??0;i<u||(u=i,r=o$1);}return r}function yt(e){switch(e){case "left":return c$2.LEFT;case "middle":return c$2.MIDDLE;case "right":return c$2.RIGHT;case "wheelUp":return c$2.WHEEL_UP;case "wheelDown":return c$2.WHEEL_DOWN;default:return c$2.NONE}}function pt(e,t){let n=y();if(t.name==="tab"){let r=Array.from(o(e,[p$1]));t.shift?E(e,r):D$1(e,r);return}if(n!==null){let r=t.raw.length>0?t.raw[0]??0:0;i(e,n,{lastKeyCode:r,lastKeyTime:Date.now(),ctrl:t.ctrl,meta:t.meta,shift:t.shift}),c.eventBus.emit("keypress",{key:t.name,ctrl:t.ctrl,meta:t.meta,shift:t.shift});}}function dt(e,t,n,r,u$1){t!==n&&(t!==null&&u(e,t)&&(o$1(e,t,false),c.eventBus.emit("mouseleave",{x:r,y:u$1})),n!==null&&u(e,n)&&m$3(e,n)&&(o$1(e,n,true),c.eventBus.emit("mouseenter",{x:r,y:u$1})),c.lastHoveredEntity=n);}function ht(e,t,n,r,u$2){p(e,t)&&(n$1(e,t,{x:n,y:r,button:u$2,pressed:true}),r$1(e,t,n,r,u$2)),u(e,t)&&p$3(e,t,true),c.eventBus.emit("mousedown",{x:n,y:r,button:u$2}),t$1(e,t)&&u$1(e,t);}function Et(e,t,n,r,u$1){p(e,t)&&n$1(e,t,{x:n,y:r,button:u$1,pressed:false}),u(e,t)&&p$3(e,t,false),c.eventBus.emit("mouseup",{x:n,y:r,button:u$1}),k$2(e,t)&&c.eventBus.emit("click",{x:n,y:r,button:u$1}),c.capturedEntity!==null&&at();}function bt(e,t){let n=t.x,r=t.y,u=yt(t.button);c.lastMouseX=n,c.lastMouseY=r;let o=c.capturedEntity;if(o===null&&(o=mt(e,n,r)),dt(e,c.lastHoveredEntity,o,n,r),c.eventBus.emit("mousemove",{x:n,y:r}),o!==null)switch(t.action){case "press":ht(e,o,n,r,u);break;case "release":Et(e,o,n,r,u);break;case "move":p(e,o)&&n$1(e,o,{x:n,y:r});break;case "wheel":{let i=u===c$2.WHEEL_UP?"up":"down";c.eventBus.emit("scroll",{direction:i,amount:1});break}}}var it=e=>{let t=c.eventQueue;c.eventQueue=[];for(let n of t)n.type==="key"?pt(e,n.event):n.type==="mouse"&&bt(e,n.event);return e};function te(){return it}function ee(e,t=0){e.registerInputSystem(it,t);}function ne(e,t){k$1(e,t)&&m$2(e,t),p(e,t)&&s(e,t);}var D=[];function re(e){D.length=0;let t=new Set;for(let n of o(e,[c$1]))t.has(n)||(t.add(n),D.push(n));for(let n of o(e,[p$1]))t.has(n)||(t.add(n),D.push(n));return D}var vt=[],gt=[];function Bt(e,t){if(!m$1(e,t,I))return a$1.NONE;let n=a$1.NONE;return I.bold[t]===1&&(n|=a$1.BOLD),I.underline[t]===1&&(n|=a$1.UNDERLINE),I.blink[t]===1&&(n|=a$1.BLINK),I.inverse[t]===1&&(n|=a$1.INVERSE),n}function lt(e,t){if(c$3(e,t))return {x:a$2.x[t],y:a$2.y[t],width:a$2.width[t],height:a$2.height[t]}}function xt(e,t){return p$2(e,t)?{top:k$3.top[t]===1?1:0,right:k$3.right[t]===1?1:0,bottom:k$3.bottom[t]===1?1:0,left:k$3.left[t]===1?1:0}:{top:0,right:0,bottom:0,left:0}}function St(e,t){return {x:e.x+t.left,y:e.y+t.top,width:Math.max(0,e.width-t.left-t.right),height:Math.max(0,e.height-t.top-t.bottom)}}function It(e,t,n){let{world:r$1,buffer:u}=e,o=K(r$1,t);if(!o||o.transparent)return;let i=Bt(r$1,t),s=e$1(" ",o.fg,o.bg,i);r(u,n.x,n.y,n.width,n.height,s);}function W(e,t,n,r,u,o){let i=String.fromCodePoint(r);o$2(e,t,n,e$1(i,u,o));}function st(e,t,n,r,u,o,i){let s=String.fromCodePoint(u),a=e$1(s,o,i);for(let f=0;f<r;f++)o$2(e,t+f,n,a);}function ct(e,t,n,r,u,o,i){let s=String.fromCodePoint(u),a=e$1(s,o,i);for(let f=0;f<r;f++)o$2(e,t,n+f,a);}function Rt(e,t,n,r,u,o){if(!t)return;let{x:i,y:s,width:a,height:f}=n;r.top&&r.left&&W(e,i,s,t.charTopLeft,u,o),r.top&&r.right&&W(e,i+a-1,s,t.charTopRight,u,o),r.bottom&&r.left&&W(e,i,s+f-1,t.charBottomLeft,u,o),r.bottom&&r.right&&W(e,i+a-1,s+f-1,t.charBottomRight,u,o);}function Ct(e,t,n,r,u,o){let i=r.left?1:0,s=n.width-i-(r.right?1:0);s<=0||(r.top&&st(e,n.x+i,n.y,s,t,u,o),r.bottom&&st(e,n.x+i,n.y+n.height-1,s,t,u,o));}function Mt(e,t,n,r,u,o){let i=r.top?1:0,s=n.height-i-(r.bottom?1:0);s<=0||(r.left&&ct(e,n.x,n.y+i,s,t,u,o),r.right&&ct(e,n.x+n.width-1,n.y+i,s,t,u,o));}function Dt(e,t,n$1){let{world:r,buffer:u}=e;if(!p$2(r,t))return;let o=n(r,t);if(!o||o.type===0||n$1.width<1||n$1.height<1)return;let{fg:i,bg:s}=o,a={left:o.left,top:o.top,right:o.right,bottom:o.bottom};Rt(u,o,n$1,a,i,s),Ct(u,o.charHorizontal,n$1,a,i,s),Mt(u,o.charVertical,n$1,a,i,s);}function pe(e,t,n){}function de(e,t,n){}function Wt(e,t){let{world:n}=e,r=lt(n,t);if(!r||r.width<=0||r.height<=0)return;It(e,t,r),Dt(e,t,r);let u=xt(n,t);St(r,u);o$3(e.dirtyTracker,n,t),N(n,t);}var m=null;function he(e){m=e;}function Ee(){return m}function kt(e){return m?e.x+e.width<=m.x||e.x>=m.x+m.width||e.y+e.height<=m.y||e.y>=m.y+m.height:false}function Tt(e,t){return e.x>=t.x&&e.y>=t.y&&e.x+e.width<=t.x+t.width&&e.y+e.height<=t.y+t.height}function Nt(e,t){if(t.length===0)return false;for(let n of t)if(Tt(e,n))return true;return false}function Ot(e,t){e.push({x:t.x,y:t.y,width:t.width,height:t.height});}function Pt(e,t,n){let{world:r}=e,u=lt(r,t);return !u||u.width<=0||u.height<=0?(N(r,t),false):kt(u)?(N(r,t),false):T&&Nt(u,n)?(N(r,t),false):(Wt(e,t),T&&Ot(n,u),true)}var R=null,k=null,T=false;function be(e,t){R=e,k=t;}function ve(){return R}function ge(){R=null,k=null;}function Be(e){T=e;}function xe(){return T}var Qt=e=>{if(!R||!k)return e;let t={world:e,buffer:k,dirtyTracker:R},n=h(e).queryRenderables(e),r=n.length,u=vt;u.length=0;for(let i=0;i<r;i++){let s=n[i];V(e,s)&&O(e,s)&&u.push(s);}u.length>1&&u.sort((i,s)=>G.z[i]-G.z[s]);let o=gt;o.length=0;for(let i of u)Pt(t,i,o);return e};function Se(){return Qt}function Ie(e,t$1,n,r,u,o,i=a$1.NONE){return t(e,t$1,n,r,u,o,i)}function Re(e,t,n,r$1,u,o){r(e,t,n,r$1,u,o);}function Ce(e){let t=h(e).queryRenderables(e),n=t.length;for(let r=0;r<n;r++)I.dirty[t[r]]=1;}export{ve as A,ge as B,Be as C,xe as D,Qt as E,Se as F,Ie as G,Re as H,Ce as I,c as a,Ut as b,Xt as c,qt as d,At as e,Ft as f,Gt as g,Zt as h,at as i,jt as j,Jt as k,ft as l,$t as m,mt as n,it as o,te as p,ee as q,ne as r,re as s,It as t,Dt as u,pe as v,de as w,he as x,Ee as y,be as z};
@@ -0,0 +1 @@
1
+ import {a}from'./chunk-MEJJLDEQ.js';import {O}from'./chunk-ESMSDY3P.js';import {o,m,p as p$1,q}from'./chunk-7ZFQO3OQ.js';var l=1e4;function S(n=l){return {animationId:new Uint32Array(n),playing:new Uint8Array(n),loop:new Uint8Array(n),speed:new Float32Array(n),elapsed:new Float32Array(n),currentFrameIndex:new Uint16Array(n),direction:new Int8Array(n)}}var f=S(),A=new WeakSet,u=null;function d(n){return A.has(n)||(u=p$1(n,q(()=>f)),A.add(n)),u}function c(n){let t=d(n);return o(n,[t])}function x(n,t){let e=d(n);return m(n,t,e)}var p=n=>{let t=a(),e=c(n);for(let r of e)O(n,r,t);return n};function g(){return p}function h(n,t=0){n.registerSystem(2,p,t);}function F(n,t,e){for(let r of t)O(n,r,e);}export{c as a,x as b,p as c,g as d,h as e,F as f};
@@ -0,0 +1,4 @@
1
+ import {i as i$1,b as b$1,c as c$3,d as d$3}from'./chunk-MEJJLDEQ.js';import {g as g$2,d as d$2,e as e$2}from'./chunk-K5UMVDQX.js';import {a as a$3}from'./chunk-PQZTNWLA.js';import {a}from'./chunk-5N3O25O7.js';import {c,a as a$2}from'./chunk-FJLSHFCF.js';import {f,v,d as d$4}from'./chunk-M5FXA5FL.js';import {m as m$1}from'./chunk-RJULLVTH.js';import {g as g$1,b as b$2,c as c$2,h as h$1,i as i$4,j as j$2}from'./chunk-JWIVZCKW.js';import {u,c as c$1,i as i$3}from'./chunk-W6RELN6A.js';import {o,k,p as p$1}from'./chunk-EOFT3PNU.js';import {d as d$1,l as l$1,f as f$3}from'./chunk-JN2OGNK3.js';import {J,I,H,g,L,k as k$1,G,x,p,s,e as e$1,j as j$1}from'./chunk-JB5KFQPD.js';import {b as b$3,f as f$4}from'./chunk-NPDPBAW6.js';import {a as a$1,i,b,d,f as f$1,e,M,I as I$1,R}from'./chunk-LIVVHEOU.js';import {m,i as i$2,o as o$1,k as k$2,f as f$2,l,j,h}from'./chunk-7ZFQO3OQ.js';import {z}from'zod';function Tt(e){if(!d$4(e))return {width:80,height:24};let t=f(e);return !t||!k$1(e,t)?{width:80,height:24}:{width:e$1.width[t],height:e$1.height[t]}}function In(e,t,n){J(e,t,true);let r=I(e,t)?.y??0;return H(e,t,n,r),t}function Bn(e,t,n){let o=Tt(e),i=g(e,t)?.width??0;J(e,t,true);let a=o.width-n-i,l=I(e,t)?.y??0;return H(e,t,a,l),t}function Wn(e,t,n){J(e,t,true);let r=I(e,t)?.x??0;return H(e,t,r,n),t}function Mn(e,t,n){let o=Tt(e),i=g(e,t)?.height??0;J(e,t,true);let a=o.height-n-i,l=I(e,t)?.x??0;return H(e,t,l,a),t}function ir(e,t,n){let{left:o,right:r,top:i,bottom:a}=n;return J(e,t,true),o!==void 0?In(e,t,o):r!==void 0&&Bn(e,t,r),i!==void 0?Wn(e,t,i):a!==void 0&&Mn(e,t,a),t}function ar(e,t){let n=I(e,t);if(!n||!n.absolute)return;let o=g(e,t),r=o?.width??0,i=o?.height??0,a=Tt(e),s=n.x,l=a.width-s-r,c=n.y,p=a.height-c-i;return {left:s,right:l,top:c,bottom:p}}function wn(e){let t=f(e);return t?v(e,t):false}function kt(e,t){let n={left:0,top:0,right:0,bottom:0};return !wn(e)||!o(e,t)||k.type[t]===0?n:{left:k.left[t]===1?1:0,top:k.top[t]===1?1:0,right:k.right[t]===1?1:0,bottom:k.bottom[t]===1?1:0}}function Ln(e,t){let n=g$1(e,t),o=n?.left??0,r=n?.top??0,i=n?.right??0,a=n?.bottom??0,s=kt(e,t),l=o+s.left,c=r+s.top,p=i+s.right,u=a+s.bottom;return {left:l,top:c,right:p,bottom:u,horizontal:l+p,vertical:c+u}}function lr(e,t){let n=Ln(e,t);return n.left+n.top+n.right+n.bottom}function ur(e,t){let n=kt(e,t);return n.left>0||n.top>0||n.right>0||n.bottom>0}var At={teeRight:9500,teeLeft:9508,teeDown:9516,teeUp:9524,cross:9532,horizontal:9472,vertical:9474},Kn={teeRight:9568,teeLeft:9571,teeDown:9574,teeUp:9577,cross:9580,horizontal:9552,vertical:9553},On={teeRight:9507,teeLeft:9515,teeDown:9523,teeUp:9531,cross:9547,horizontal:9473,vertical:9475},Fn={teeRight:43,teeLeft:43,teeDown:43,teeUp:43,cross:43,horizontal:45,vertical:124};function cr(e,t,n={}){return {width:e,height:t,edges:new Map,enabled:n.enabled??true}}function dr(e){e.edges.clear();}function fr(e,t,n){return {...e,width:t,height:n}}function ve(e,t){return `${e},${t}`}function Nn(e){let[t,n]=e.split(",");return {x:Number.parseInt(t??"0",10),y:Number.parseInt(n??"0",10)}}function Rt(e){return e===9472||e===9474||e===9484||e===9488||e===9492||e===9496||e===9500||e===9508||e===9516||e===9524||e===9532?"single":e===9552||e===9553||e===9556||e===9559||e===9562||e===9565||e===9568||e===9571||e===9574||e===9577||e===9580?"double":e===9473||e===9475||e===9487||e===9491||e===9495||e===9499||e===9507||e===9515||e===9523||e===9531||e===9547?"bold":e===45||e===124||e===43?"ascii":"unknown"}function It(e){switch(e){case "single":return At;case "double":return Kn;case "bold":return On;case "ascii":return Fn;default:return At}}function q(e,t,n,o,r,i,a){let s=ve(t,n),l={x:t,y:n,type:o,char:r,fg:i,bg:a,style:Rt(r)},c=e.edges.get(s);c?c.push(l):e.edges.set(s,[l]);}function pr(e,t,n,o,r,i,a,s,l){for(let c=1;c<o-1;c++)q(e,t+c,n,"h",i,s,l);for(let c=1;c<o-1;c++)q(e,t+c,n+r-1,"h",i,s,l);for(let c=1;c<r-1;c++)q(e,t,n+c,"v",a,s,l);for(let c=1;c<r-1;c++)q(e,t+o-1,n+c,"v",a,s,l);q(e,t,n,"c",0,s,l),q(e,t+o-1,n,"c",0,s,l),q(e,t,n+r-1,"c",0,s,l),q(e,t+o-1,n+r-1,"c",0,s,l);}function Bt(e,t,n){let o=e.edges.get(ve(t-1,n)),r=e.edges.get(ve(t+1,n)),i=e.edges.get(ve(t,n-1)),a=e.edges.get(ve(t,n+1));return {left:o?.some(s=>s.type==="h"||s.type==="c")??false,right:r?.some(s=>s.type==="h"||s.type==="c")??false,top:i?.some(s=>s.type==="v"||s.type==="c")??false,bottom:a?.some(s=>s.type==="v"||s.type==="c")??false}}function Wt(e,t){let{left:n,top:o,right:r,bottom:i}=e;return (n?1:0)+(o?1:0)+(r?1:0)+(i?1:0)<3?null:n&&o&&r&&i?t.cross:n&&o&&i?t.teeLeft:r&&o&&i?t.teeRight:n&&r&&i?t.teeDown:n&&r&&o?t.teeUp:null}function mr(e){if(!e.enabled)return [];let t=[],n=new Set;for(let[o,r]of e.edges){if(n.has(o)||(n.add(o),r.length<2))continue;let{x:i,y:a}=Nn(o),s=Bt(e,i,a),l=r[0];if(!l)continue;let c=It(l.style),p=Wt(s,c);p!==null&&t.push({x:i,y:a,char:p,fg:l.fg,bg:l.bg});}return t}function yr(e,t){let n=t.some(r=>r.type==="h"),o=t.some(r=>r.type==="v");return {left:e.left||n,right:e.right||n,top:e.top||o,bottom:e.bottom||o}}function gr(e,t,n,o){if(!e.some(l=>l.type==="c")||e.length<=1)return null;let i=e[0];if(!i)return null;let a=It(i.style),s=Wt(t,a);return s===null?null:{x:n,y:o,char:s,fg:i.fg,bg:i.bg}}function br(e){if(!e.enabled)return [];let t=[],n=new Set;for(let[o,r]of e.edges){if(n.has(o))continue;n.add(o);let{x:i,y:a}=Nn(o),s=Bt(e,i,a),l=yr(s,r),c=gr(r,l,i,a);c&&t.push(c);}return t}function hr(e,t){for(let n of t)n.x>=0&&n.x<e.width&&n.y>=0&&n.y<e.height&&e.setCell(n.x,n.y,{char:String.fromCodePoint(n.char),fg:n.fg,bg:n.bg});}function vr(e){return e.map(t=>({x:t.x,y:t.y,char:String.fromCodePoint(t.char),fg:t.fg,bg:t.bg}))}function Er(e){return Rt(e)!=="unknown"}function xr(e){return e>=9500&&e<=9532||e>=9568&&e<=9580||e>=9507&&e<=9547||e===43}function Sr(e){return e.edges.size}function Cr(e,t,n){return e.edges.get(ve(t,n))??[]}var Qe=1e4,re={HIDDEN:0,VISIBLE:1,SCROLL:2},D={overflow:new Uint8Array(Qe),overflowX:new Uint8Array(Qe),overflowY:new Uint8Array(Qe),hasIndependentOverflow:new Uint8Array(Qe)};function Dr(e,t){m(e,t,D)||(l(e,t,D),D.overflow[t]=re.HIDDEN,D.overflowX[t]=re.HIDDEN,D.overflowY[t]=re.HIDDEN,D.hasIndependentOverflow[t]=0);}function Pr(e,t){return m(e,t,D)}function Tr(e,t,n){return Dr(e,t),typeof n=="number"?(D.overflow[t]=n,D.overflowX[t]=n,D.overflowY[t]=n,D.hasIndependentOverflow[t]=0):(n.overflow!==void 0&&(D.overflow[t]=n.overflow,D.overflowX[t]=n.overflow,D.overflowY[t]=n.overflow),n.overflowX!==void 0&&(D.overflowX[t]=n.overflowX,D.hasIndependentOverflow[t]=1),n.overflowY!==void 0&&(D.overflowY[t]=n.overflowY,D.hasIndependentOverflow[t]=1)),t}function Ze(e,t){return m(e,t,D)?D.overflow[t]:re.HIDDEN}function kr(e,t){if(m(e,t,D))return {overflow:D.overflow[t],overflowX:D.overflowX[t],overflowY:D.overflowY[t]}}function Ar(e,t,n,o){return {x1:e,y1:t,x2:e+n,y2:t+o}}function Ke(){return {x1:-1/0,y1:-1/0,x2:1/0,y2:1/0}}function Rr(e){return e.x1>=e.x2||e.y1>=e.y2}function Ir(e,t,n){return t>=e.x1&&t<e.x2&&n>=e.y1&&n<e.y2}function Br(e,t,n,o,r){return t<e.x2&&t+o>e.x1&&n<e.y2&&n+r>e.y1}function et(e,t){return {x1:Math.max(e.x1,t.x1),y1:Math.max(e.y1,t.y1),x2:Math.min(e.x2,t.x2),y2:Math.min(e.y2,t.y2)}}function Wr(e,t,n){return {x:Math.max(e.x1,Math.min(e.x2-1,t)),y:Math.max(e.y1,Math.min(e.y2-1,n))}}function Mr(e){return e.x2-e.x1}function wr(e){return e.y2-e.y1}function Lr(e,t){return p$1(e,t)?{top:k.top[t]===1?1:0,right:k.right[t]===1?1:0,bottom:k.bottom[t]===1?1:0,left:k.left[t]===1?1:0}:{top:0,right:0,bottom:0,left:0}}function Un(e,t){if(!c(e,t))return null;let n=a$2.x[t],o=a$2.y[t],r=a$2.width[t],i=a$2.height[t],a=Lr(e,t);return {x1:n+a.left,y1:o+a.top,x2:n+r-a.right,y2:o+i-a.bottom}}function Kr(e,t){let n=Ke(),o=t;for(;o!==a$1;){if(Ze(e,o)!==re.VISIBLE){let a=Un(e,o);a&&(n=et(n,a));}o=i(e,o)??a$1;}return n}function Or(e,t,n){let o=Ke(),r=t;for(;r!==a$1&&r!==n;){if(Ze(e,r)!==re.VISIBLE){let s=Un(e,r);s&&(o=et(o,s));}r=i(e,r)??a$1;}return o}function Fr(e,t){return Ze(e,t)!==re.VISIBLE}function Nr(){return {stack:[],current:Ke()}}function Ur(e,t){let n=[...e.stack,e.current],o=et(e.current,t);return {stack:n,current:o}}function _r(e){if(e.stack.length===0)return e;let t=e.stack.slice(0,-1),n=e.stack[e.stack.length-1];return {stack:t,current:n??Ke()}}function zr(e){return e.current}function Mt(e,t){return o(e,t)?k.type[t]===0?0:1:0}function wt(e,t){if(!k$1(e,t))return {width:0,height:0};let n=g(e,t);return {width:n?.width??0,height:n?.height??0}}function Vr(e,t){let n=Mt(e,t),o=n,r=g$1(e,t);return r&&(n+=r.left,o+=r.top),{x:n,y:o}}function _n(e,t){let n=0,o=0;if(!m(e,t,b))return {x:n,y:o};let r=i(e,t);for(;r!==a$1;){if(!L(e,r)){r=i(e,r);continue}let i$1=I(e,r);if(!i$1){r=i(e,r);continue}n+=i$1.x,o+=i$1.y;let a=Vr(e,r);if(n+=a.x,o+=a.y,i$1.absolute)break;r=i(e,r);}return {x:n,y:o}}function tt(e,t){if(!L(e,t))return;let n=I(e,t);if(!n)return;let o=wt(e,t);if(n.absolute)return {left:n.x,top:n.y,right:n.x+o.width-1,bottom:n.y+o.height-1};let r=_n(e,t),i=n.x+r.x,a=n.y+r.y;return {left:i,top:a,right:i+o.width-1,bottom:a+o.height-1}}function zn(e,t){if(!L(e,t))return;let n=I(e,t);if(!n)return;let o=wt(e,t),r=0,i$1=0;if(m(e,t,b)){let a=i(e,t);if(a!==a$1){let s=nt(e,a);s&&(r=s.width,i$1=s.height);}}return {left:n.x,top:n.y,right:Math.max(0,r-n.x-o.width),bottom:Math.max(0,i$1-n.y-o.height)}}function Lt(e,t){let n=tt(e,t);if(!n)return;let o=Mt(e,t),r=g$1(e,t),i=r?.left??0,a=r?.top??0,s=r?.right??0,l=r?.bottom??0;return {left:n.left+o+i,top:n.top+o+a,right:n.right-o-s,bottom:n.bottom-o-l}}function nt(e,t){if(!k$1(e,t))return;let n=g(e,t);if(!n)return;let o=Mt(e,t),r=g$1(e,t),i=(r?.left??0)+(r?.right??0),a=(r?.top??0)+(r?.bottom??0);return {width:Math.max(0,n.width-o*2-i),height:Math.max(0,n.height-o*2-a)}}function Vn(e,t){let n=g$1(e,t),o=n?.left??0,r=n?.right??0,i=n?.top??0,a=n?.bottom??0;return {horizontal:o+r,vertical:i+a,total:o+r+i+a}}function Hr(e,t,n,o){let r=_n(e,t),i=n-r.x,a=o-r.y;return G.x[t]=i,G.y[t]=a,t}function jr(e,t,n){let o=wt(e,t),r=0,i$1=0;if(m(e,t,b)){let l=i(e,t);if(l!==a$1){let c=nt(e,l);c&&(r=c.width,i$1=c.height);}}let a;n.left!==void 0?a=n.left:n.right!==void 0?a=r-o.width-n.right:a=G.x[t];let s;return n.top!==void 0?s=n.top:n.bottom!==void 0?s=i$1-o.height-n.bottom:s=G.y[t],G.x[t]=a,G.y[t]=s,t}function Gr(e,t){let n=tt(e,t);if(!n)return;let o=zn(e,t);if(!o)return;let r=Lt(e,t);if(!r)return;let i=nt(e,t)??{width:0,height:0},a=Vn(e,t);return {absolute:n,relative:o,inner:r,innerDimensions:i,totalPadding:a}}function Kt(e,t,n,o){let r=tt(e,t);return r?n>=r.left&&n<=r.right&&o>=r.top&&o<=r.bottom:false}function Yr(e,t,n,o){let r=Lt(e,t);return r?n>=r.left&&n<=r.right&&o>=r.top&&o<=r.bottom:false}var Ot=new Map,Ft=new Map;function Hn(e,t){return `${e}:${t}`}function Jr(e,t){Ot.set(e,t);}function ot(e,t,n){Ft.set(Hn(e,t),n);}function jn(e){return typeof e=="function"}function $r(e){return jn(e)?e():e}function Nt(e,t={},n=[]){return {type:e,config:t,children:n}}function Xr(e,t,n,o=[]){return {type:e,config:t,children:o,ref:n}}function qr(e={},t=[]){return Nt("box",{...e,layout:"vertical"},t)}function Qr(e={},t=[]){return Nt("box",{...e,layout:"horizontal"},t)}function Zr(e,t,n){let o=[],r=[];Gn(e,t,n,o,r);let i=o[0];if(i===void 0)throw new Error(`Failed to mount widget of type '${t.type}': no entity created`);return {root:i,entities:[...o],dispose:()=>{for(let a of r)a.dispose();r.length=0;}}}function Gn(e,t,n,o,r){let i=Ot.get(t.type);if(!i)throw new Error(`No factory registered for widget type '${t.type}'. Call registerWidgetFactory() first.`);let a={};for(let[l,c]of Object.entries(t.config))a[l]=$r(c);let s=i(e,a);o.push(s),n!==void 0&&d(e,n,s);for(let[l,c]of Object.entries(t.config)){if(!jn(c))continue;let p=Ft.get(Hn(t.type,l));if(!p)continue;let u=c,f=i$1(()=>{let m=u();p(e,s,m);});r.push(f);}t.ref&&t.ref(s);for(let l of t.children)Gn(e,l,s,o,r);return s}function ei(e){e.dispose();}function ti(e,t,n,o){return i$1(()=>{let r=n();o(e,t,r);})}function ni(e){let t=["box","text","gauge","list","progressbar"];for(let n of t)ot(n,"content",e.setContent),ot(n,"width",e.setWidth),ot(n,"height",e.setHeight);}function oi(){Ot.clear(),Ft.clear();}function Jn(e,t){let n=e*t,o=Math.ceil(n/8);return {width:e,height:t,dirtyCells:new Uint8Array(o),dirtyEntities:new Set,entityBounds:m$1({iterable:true}),dirtyRegions:[],regionsStale:true,forceFullRedraw:true,frameCount:0}}function ri(e,t,n){let o=Jn(t,n);return e.entityBounds.forEach((r,i)=>{r.prevX<t&&r.prevY<n&&o.entityBounds.set(i,{...r});}),o.forceFullRedraw=true,o}function ii(e,t,n){if(t<0||t>=e.width||n<0||n>=e.height)return;let o=n*e.width+t,r=o>>3,i=o&7,a=e.dirtyCells[r];a!==void 0&&(e.dirtyCells[r]=a|1<<i),e.regionsStale=true;}function ai(e,t,n){if(t<0||t>=e.width||n<0||n>=e.height)return false;let o=n*e.width+t,r=o>>3,i=o&7,a=e.dirtyCells[r];return a===void 0?false:(a&1<<i)!==0}function rt(e,t,n,o,r){let i=Math.max(0,Math.floor(t)),a=Math.max(0,Math.floor(n)),s=Math.min(e.width,Math.floor(t+o)),l=Math.min(e.height,Math.floor(n+r));if(!(s<=i||l<=a)){for(let c=a;c<l;c++)for(let p=i;p<s;p++){let u=c*e.width+p,f=u>>3,m=u&7,x=e.dirtyCells[f];x!==void 0&&(e.dirtyCells[f]=x|1<<m);}e.regionsStale=true;}}function $n(e,t,n){if(e.dirtyEntities.add(n),!c(t,n))return;let o=a$2.x[n],r=a$2.y[n],i=a$2.width[n],a=a$2.height[n],s=e.entityBounds.get(n);s&&(s.prevX!==o||s.prevY!==r||s.prevWidth!==i||s.prevHeight!==a)&&rt(e,s.prevX,s.prevY,s.prevWidth,s.prevHeight),rt(e,o,r,i,a),e.regionsStale=true;}function si(e,t,n,o){if(!c(t,n)){e.entityBounds.delete(n);return}let r={prevX:a$2.x[n],prevY:a$2.y[n],prevWidth:a$2.width[n],prevHeight:a$2.height[n],wasVisible:o};e.entityBounds.set(n,r);}function li(e,t){let n=e.entityBounds.get(t);n?.wasVisible&&rt(e,n.prevX,n.prevY,n.prevWidth,n.prevHeight),e.dirtyEntities.delete(t),e.entityBounds.delete(t);}function ui(e,t){return e.dirtyEntities.has(t)}function it(e,t,n){let o=t*n+e;return {byteIndex:o>>3,bitIndex:o&7}}function Yn(e,t,n){let o=e[t];if(o!==void 0)return (o&1<<n)!==0}function ci(e,t,n){let o=e[t];o!==void 0&&(e[t]=o|1<<n);}function Ut(e,t,n,o){let r=Yn(e,n,o),i=Yn(t,n,o);return r===void 0||i===void 0?false:r&&!i}function di(e){if(e.forceFullRedraw)return [{x:0,y:0,width:e.width,height:e.height}];let t=[],n=new Uint8Array(e.dirtyCells.length);for(let o=0;o<e.height;o++)for(let r=0;r<e.width;r++){let{byteIndex:i,bitIndex:a}=it(r,o,e.width);if(Ut(e.dirtyCells,n,i,a)){let s=yi(e,n,r,o);s.width>0&&s.height>0&&t.push(s);}}return bi(t)}function fi(e,t,n,o,r,i){let a=n;for(;a<i;){let{byteIndex:s,bitIndex:l}=it(a,o,r);if(!Ut(e,t,s,l))break;a++;}return a}function pi(e,t,n,o,r,i){for(let a=n;a<o;a++){let{byteIndex:s,bitIndex:l}=it(a,r,i);if(!Ut(e,t,s,l))return false}return true}function mi(e,t,n,o,r,i){for(let a=n;a<r;a++)for(let s=t;s<o;s++){let{byteIndex:l,bitIndex:c}=it(s,a,i);ci(e,l,c);}}function yi(e,t,n,o){let r=fi(e.dirtyCells,t,n,o,e.width,e.width),i=r-n;if(i===0)return {x:n,y:o,width:0,height:0};let a=o;for(;a<e.height&&pi(e.dirtyCells,t,n,r,a,e.width);)a++;return mi(t,n,o,r,a,e.width),{x:n,y:o,width:i,height:a-o}}function gi(e,t,n,o){let r=e,i=false;for(let a=o;a<t.length;a++){if(n.has(a))continue;let s=t[a];s&&hi(r,s)&&(r=vi(r,s),n.add(a),i=true);}return {merged:r,didMerge:i}}function bi(e){if(e.length<2)return e;let t=[...e].sort((r,i)=>i.width*i.height-r.width*r.height),n=[],o=new Set;for(let r=0;r<t.length;r++){if(o.has(r))continue;let i=t[r];if(!i)continue;o.add(r);let a=true;for(;a;){let s=gi(i,t,o,r+1);i=s.merged,a=s.didMerge;}n.push(i);}return n}function hi(e,t){let n=e.x+e.width,o=e.y+e.height,r=t.x+t.width,i=t.y+t.height;return !(t.x>n+1||r<e.x-1||t.y>o+1||i<e.y-1)}function vi(e,t){let n=Math.min(e.x,t.x),o=Math.min(e.y,t.y),r=Math.max(e.x+e.width,t.x+t.width),i=Math.max(e.y+e.height,t.y+t.height);return {x:n,y:o,width:r-n,height:i-o}}function at(e){return e.regionsStale&&(e.dirtyRegions.length=0,e.dirtyRegions.push(...di(e)),e.regionsStale=false),e.dirtyRegions}function Ei(e){return e.forceFullRedraw?true:e.dirtyEntities.size>0}function xi(e){return e.forceFullRedraw}function Si(e){return e.dirtyEntities}function Ci(e){let t=at(e),n=e.width*e.height,o=0;for(let r of t)o+=r.width*r.height;return {dirtyEntityCount:e.dirtyEntities.size,dirtyRegionCount:t.length,dirtyArea:o,dirtyPercent:n>0?o/n*100:0,fullRedraw:e.forceFullRedraw,trackedEntityCount:e.entityBounds.size}}function Di(e){e.dirtyCells.fill(0),e.dirtyEntities.clear(),e.dirtyRegions.length=0,e.regionsStale=true,e.forceFullRedraw=false,e.frameCount++;}function Pi(e){e.forceFullRedraw=true,e.regionsStale=true;}function Ti(e,t){e.entityBounds.forEach((n,o)=>{$n(e,t,o);});}function ki(e,t,n,o,r){if(e.forceFullRedraw)return true;let i=at(e);for(let a of i)if(t<a.x+a.width&&t+o>a.x&&n<a.y+a.height&&n+r>a.y)return true;return false}function Ai(e,t,n,o,r){let i=at(e),a=[];for(let s of i){let l=Math.max(s.x,t),c=Math.max(s.y,n),p=Math.min(s.x+s.width,t+o),u=Math.min(s.y+s.height,n+r);p>l&&u>c&&a.push({x:l,y:c,width:p-l,height:u-c});}return a}var st=new Map;function Q(e,t){let n=st.get(e);return n||(n=t(),st.set(e,n)),n}function _t(e){st.delete(e);}function Ri(){st.clear();}function Ii(e,t,n,o){e.emit("reparent",{entity:t,oldParent:n,newParent:o});}function Bi(e,t,n){e.emit("adopt",{parent:t,child:n});}function Wi(e,t,n){e.emit("attach",{entity:t,screen:n});}function Mi(e,t,n){e.emit("detach",{entity:t,screen:n});}function wi(e,t,n){e.emit("remove",{parent:t,child:n});}function zt(e,t){e.emit("destroy",{entity:t});}function Li(e,t,n){return Q(e,n).on("reparent",t)}function Ki(e,t,n){return Q(e,n).on("adopt",t)}function Oi(e,t,n){return Q(e,n).on("attach",t)}function Fi(e,t,n){return Q(e,n).on("detach",t)}function Ni(e,t,n){return Q(e,n).on("remove",t)}function Ui(e,t,n){return Q(e,n).on("destroy",t)}var Z=new Set,Vt=new WeakMap,Ee=[];function lt(e){let t=Vt.get(e);return t||(t=new Set,Vt.set(e,t)),t}function _i(e){return Ee.push(e),()=>{let t=Ee.indexOf(e);t!==-1&&Ee.splice(t,1);}}function Xn(){Ee.length=0;}function qn(e,t,n={}){let{immediate:o=false,destroyChildren:r=true,emitEvent:i=true}=n;if(o)Ht(e,t,r,i);else {let a=lt(e);if(a.add(t),Z.add(t),r&&m(e,t,b)){let s=f$1(e,t);for(let l of s)a.add(l),Z.add(l);}}}function zi(e,t,n={}){if(!m(e,t,b))return;let o=f$1(e,t);for(let r of o)qn(e,r,n);}function Vi(e){return Z.has(e)}function Hi(e){let t=lt(e),n=t.size;if(n===0)return 0;let o=Array.from(t);o.sort((r,i)=>{let a=m(e,r,b)?b.depth[r]??0:0;return (m(e,i,b)?b.depth[i]??0:0)-a});for(let r of o)Z.has(r)&&Ht(e,r,false,true);return t.clear(),n}function Ht(e$1,t,n,o){if(Z.delete(t),o)try{let r=Q(t,()=>a$3());zt(r,t);}catch{}if(n&&m(e$1,t,b)){let r=f$1(e$1,t);for(let i of r)Ht(e$1,i,true,o);}if(m(e$1,t,b)){let r=i(e$1,t);r!==a$1&&e(e$1,r,t);}for(let r of Ee)try{r(e$1,t);}catch{}_t(t);try{i$2(e$1,t);}catch{}}function ji(e){lt(e).clear(),Z.clear(),Xn();}function Gi(e){return e?Vt.get(e)?.size??0:Z.size}function Yi(e){let t=lt(e);for(let n of t)Z.delete(n);t.clear();}function Ji(){Z.clear(),Ee.length=0;}var K=new Map;function xe(e,t,n){return typeof n=="function"?n(e,t):n}function Se(e,t,n){let o={};return n.fg!==void 0&&(o.fg=xe(e,t,n.fg)),n.bg!==void 0&&(o.bg=xe(e,t,n.bg)),n.bold!==void 0&&(o.bold=xe(e,t,n.bold)),n.underline!==void 0&&(o.underline=xe(e,t,n.underline)),n.blink!==void 0&&(o.blink=xe(e,t,n.blink)),n.inverse!==void 0&&(o.inverse=xe(e,t,n.inverse)),o}function $i(e,t){return R(e,t)?{fg:I$1.fg[t],bg:I$1.bg[t],bold:I$1.bold[t]===1,underline:I$1.underline[t]===1,blink:I$1.blink[t]===1,inverse:I$1.inverse[t]===1,transparent:I$1.transparent[t]===1,opacity:I$1.opacity[t]??1}:{fg:I$1.fg[t],bg:I$1.bg[t],bold:false,underline:false,blink:false,inverse:false,transparent:false,opacity:1}}function Oe(e,t){let n=K.get(t);return n||(n={original:$i(e,t),focusApplied:false,hoverApplied:false},K.set(t,n)),n}function Xi(e,t){return K.get(t)}function qi(e,t){return K.has(t)}function Qi(e,t){K.delete(t);}function Zi(){K.clear();}function ue(e,t,n){n.fg!==void 0&&(I$1.fg[t]=n.fg),n.bg!==void 0&&(I$1.bg[t]=n.bg),n.bold!==void 0&&(I$1.bold[t]=n.bold?1:0),n.underline!==void 0&&(I$1.underline[t]=n.underline?1:0),n.blink!==void 0&&(I$1.blink[t]=n.blink?1:0),n.inverse!==void 0&&(I$1.inverse[t]=n.inverse?1:0);}function Fe(e,t,n){I$1.fg[t]=n.fg,I$1.bg[t]=n.bg,I$1.bold[t]=n.bold?1:0,I$1.underline[t]=n.underline?1:0,I$1.blink[t]=n.blink?1:0,I$1.inverse[t]=n.inverse?1:0,I$1.transparent[t]=n.transparent?1:0;}function Qn(e,t){if(!x(e,t))return;let n=Oe(e,t);if(n.focusApplied)return;let o={},r=p.focusEffectFg[t],i=p.focusEffectBg[t];(r&4278190080)!==0&&(o.fg=r),(i&4278190080)!==0&&(o.bg=i),ue(e,t,o),n.focusApplied=true,M(e,t);}function Zn(e,t){let n=K.get(t);!n||!n.focusApplied||(n.focusApplied=false,n.hoverApplied?ea(e,t,n):(Fe(e,t,n.original),K.delete(t)),M(e,t));}function ut(e,t){return K.get(t)?.focusApplied??false}function ea(e,t,n){if(!u(e,t))return;Fe(e,t,n.original);let o={},r=c$1.hoverEffectFg[t],i=c$1.hoverEffectBg[t];(r&4278190080)!==0&&(o.fg=r),(i&4278190080)!==0&&(o.bg=i),ue(e,t,o);}function eo(e,t){if(!u(e,t))return;let n=Oe(e,t);if(n.hoverApplied)return;let o={},r=c$1.hoverEffectFg[t],i=c$1.hoverEffectBg[t];(r&4278190080)!==0&&(o.fg=r),(i&4278190080)!==0&&(o.bg=i),ue(e,t,o),n.hoverApplied=true,M(e,t);}function to(e,t){let n=K.get(t);!n||!n.hoverApplied||(n.hoverApplied=false,n.focusApplied?ta(e,t,n):(Fe(e,t,n.original),K.delete(t)),M(e,t));}function ta(e,t,n){if(!x(e,t))return;Fe(e,t,n.original);let o={},r=p.focusEffectFg[t],i=p.focusEffectBg[t];(r&4278190080)!==0&&(o.fg=r),(i&4278190080)!==0&&(o.bg=i),ue(e,t,o);}function ct(e,t){return K.get(t)?.hoverApplied??false}function na(e,t,n){Oe(e,t);let o=Se(e,t,n);ue(e,t,o),M(e,t);}function no(e,t){let n=K.get(t);n&&(Fe(e,t,n.original),K.delete(t),M(e,t));}function dt(e,t){let n=x(e,t)&&s(e,t),o=u(e,t)&&i$3(e,t),r=ut(e,t),i=ct(e,t);n&&!r?Qn(e,t):!n&&r&&Zn(e,t),o&&!i?eo(e,t):!o&&i&&to(e,t);}function oo(e,t){return {fg:I$1.fg[t],bg:I$1.bg[t],bold:I$1.bold[t]===1,underline:I$1.underline[t]===1,blink:I$1.blink[t]===1,inverse:I$1.inverse[t]===1,transparent:I$1.transparent[t]===1,opacity:I$1.opacity[t]??1}}function oa(e,t){let n=K.get(t);return n?n.original:oo(e,t)}var ce=new Map,ee=new Map;function ra(e,t,n){if(ce.set(t,n),n.focus&&x(e,t)){let o=Se(e,t,n.focus);o.fg!==void 0&&(p.focusEffectFg[t]=o.fg),o.bg!==void 0&&(p.focusEffectBg[t]=o.bg);}if(n.hover&&u(e,t)){let o=Se(e,t,n.hover);o.fg!==void 0&&(c$1.hoverEffectFg[t]=o.fg),o.bg!==void 0&&(c$1.hoverEffectBg[t]=o.bg);}dt(e,t);}function ia(e,t){return ce.get(t)}function aa(e,t){ce.delete(t),ee.delete(t),no(e,t);}function ro(e,t){let n=ee.get(t);return n||(n={pressApplied:false,disabledApplied:false},ee.set(t,n)),n}function sa(e,t){let n=ce.get(t);if(!n?.press)return;let o=ro(e,t);if(o.pressApplied)return;Oe(e,t);let r=Se(e,t,n.press);ue(e,t,r),o.pressApplied=true,M(e,t);}function la(e,t){let n=ee.get(t);n?.pressApplied&&(n.pressApplied=false,dt(e,t));}function ua(e,t){let n=ce.get(t);if(!n?.disabled)return;let o=ro(e,t);if(o.disabledApplied)return;Oe(e,t);let r=Se(e,t,n.disabled);ue(e,t,r),o.disabledApplied=true,M(e,t);}function ca(e,t){let n=ee.get(t);n?.disabledApplied&&(n.disabledApplied=false,dt(e,t));}function jt(e,t){return ee.get(t)?.pressApplied??false}function Gt(e,t){return ee.get(t)?.disabledApplied??false}function da(e,t){return ut(e,t)||ct(e,t)||jt(e,t)||Gt(e,t)}function fa(e,t){return {focus:ut(e,t),hover:ct(e,t),press:jt(e,t),disabled:Gt(e,t)}}function pa(e,t){K.delete(t),ce.delete(t),ee.delete(t);}function ma(){ce.clear(),ee.clear();}function ya(e){let{type:t,target:n,payload:o,bubbles:r=true}=e,i={type:t,target:n,currentTarget:n,bubbles:r,defaultPrevented:false,propagationStopped:false,immediatePropagationStopped:false,payload:o,stopPropagation(){i.propagationStopped=true;},stopImmediatePropagation(){i.propagationStopped=true,i.immediatePropagationStopped=true;},preventDefault(){i.defaultPrevented=true;}};return i}function ga(e,t,n){let o=0,r=t.target;for(;r!==a$1;){t.currentTarget=r;let i$1=n(e,r);if(i$1&&(i$1.emit(t.type,t),o++,t.immediatePropagationStopped)||t.propagationStopped||!t.bubbles||!m(e,r,b))break;r=i(e,r);}return {defaultPrevented:t.defaultPrevented,propagationStopped:t.propagationStopped,dispatchCount:o}}var io=z.object({dispatchCount:z.number().int().nonnegative(),maxDepth:z.number().int().nonnegative(),circularReferenceDetected:z.boolean()}),ao=z.object({maxDepth:z.number().int().positive().optional(),includeRoot:z.boolean().optional()});function ba(e,t,n,o,r,i){let a=i?ao.parse(i):{includeRoot:true,maxDepth:Number.POSITIVE_INFINITY},s=a.maxDepth??Number.POSITIVE_INFINITY,l=a.includeRoot??true,c=new Set,p=0,u=0,f=false;function m$1(P,L){if(L>s)return;if(c.has(P)){f=true;return}if(c.add(P),u=Math.max(u,L),L>0||l){let B=r(e,P);B&&(B.emit(n,o),p++);}if(!m(e,P,b))return;let I=b.firstChild[P];for(;I!==a$1;)m$1(I,L+1),I=b.nextSibling[I];}m$1(t,0);let x={dispatchCount:p,maxDepth:u,circularReferenceDetected:f};return io.parse(x)}var ha=z.object({tickRate:z.number().positive(),maxUpdatesPerFrame:z.number().int().positive(),interpolate:z.boolean()}),va=z.object({targetFPS:z.number().nonnegative().optional(),fixedTimestep:z.boolean().optional(),maxDeltaTime:z.number().positive().optional(),fixedTimestepMode:ha.optional()}),so=(o=>(o[o.STOPPED=0]="STOPPED",o[o.RUNNING=1]="RUNNING",o[o.PAUSED=2]="PAUSED",o))(so||{});function Ne(){let[e,t]=process.hrtime();return e+t/1e9}function Ea(e,t={},n={}){let o=va.parse(t),r=e,i=b$1(),a={...n},s=0,l={targetFPS:o.targetFPS??60,fixedTimestep:o.fixedTimestep??true,maxDeltaTime:o.maxDeltaTime??.1,fixedTimestepMode:o.fixedTimestepMode},c=0,p=l.targetFPS>0?1/l.targetFPS:0,u=0,f=0,m=0,x=0,P=0,L=0,I=0,B=l.fixedTimestepMode?1/l.fixedTimestepMode.tickRate:1/60,H=0,pe=0,me=0,ne=0,d=0,y=null,h=null;function k(){if(l.targetFPS===0)y=setImmediate(()=>ht());else {let A=Ne()-c,J=Math.max(0,p-A);J>.001?h=setTimeout(()=>ht(),J*1e3):y=setImmediate(()=>ht());}}function V(){y!==null&&(clearImmediate(y),y=null),h!==null&&(clearTimeout(h),h=null);}function cn(g){a.onBeforeInput?.(r,g),r=i.run(r,g),a.onAfterInput?.(r,g),a.onBeforeUpdate?.(r,g),a.onAfterUpdate?.(r,g),a.onBeforeRender?.(r,g),a.onAfterRender?.(r,g),u++;}function dn(g){let A=l.fixedTimestepMode;if(!A)return;a.onBeforeInput?.(r,g),r=i.runInputOnly(r,g),a.onAfterInput?.(r,g),I+=g,d=0;let J=0;for(;I>=B;){if(J>=A.maxUpdatesPerFrame){d=Math.floor(I/B),I=I%B;break}a.onBeforeFixedUpdate?.(r,B,H),a.onBeforeUpdate?.(r,B),r=i.runFixedUpdatePhases(r,B),a.onAfterUpdate?.(r,B),a.onAfterFixedUpdate?.(r,B,H),I-=B,H++,pe++,J++;}ne=A.interpolate?I/B:0,A.interpolate&&a.onInterpolate&&a.onInterpolate(r,ne),a.onBeforeRender?.(r,g),r=i.runRenderPhases(r,g),a.onAfterRender?.(r,g),u++;}function rr(g,A){L=A*1e3,x++,g-m>=1&&(P=x,me=pe,x=0,pe=0,m=g);}function ht(){if(s!==1)return;let g=Ne(),A=g-c;c=g,A>l.maxDeltaTime&&(A=l.maxDeltaTime),l.fixedTimestepMode?dn(A):cn(A),rr(g,A),k();}let fn={getState(){return s},isRunning(){return s===1},isPaused(){return s===2},isStopped(){return s===0},getStats(){return {fps:P,frameTime:L,frameCount:u,runningTime:s!==0?Ne()-f:0,tickCount:H,ticksPerSecond:me,interpolationAlpha:ne,skippedUpdates:d}},getInterpolationAlpha(){return ne},getFixedTimestepConfig(){return l.fixedTimestepMode},isFixedTimestepMode(){return l.fixedTimestepMode!==void 0},getScheduler(){return i},getWorld(){return r},setWorld(g){if(s!==0)throw new Error("Cannot change world while loop is running");r=g;},setTargetFPS(g){l.targetFPS=g,p=g>0?1/g:0;},getTargetFPS(){return l.targetFPS},registerSystem(g,A,J=0){i.registerSystem(g,A,J);},unregisterSystem(g){i.unregisterSystem(g);},registerInputSystem(g,A=0){i.registerInputSystem(g,A);},setHooks(g){a={...a,...g};},start(){if(s===1)return;let g=s===0;s=1,c=Ne(),g?(u=0,f=c,m=c,x=0,I=0,H=0,pe=0,me=0,ne=0,d=0,a.onStart?.()):a.onResume?.(),k();},stop(){s!==0&&(V(),s=0,a.onStop?.());},pause(){s===1&&(V(),s=2,a.onPause?.());},resume(){s===2&&fn.start();},step(g){let A=Ne(),J=g??(c>0?A-c:1/60);c=A;let Ve=Math.min(J,l.maxDeltaTime);l.fixedTimestepMode?dn(Ve):cn(Ve),L=Ve*1e3;},stepFixed(){if(!l.fixedTimestepMode)throw new Error("stepFixed() requires fixedTimestepMode to be enabled");a.onBeforeFixedUpdate?.(r,B,H),a.onBeforeUpdate?.(r,B),r=i.runFixedUpdatePhases(r,B),a.onAfterUpdate?.(r,B),a.onAfterFixedUpdate?.(r,B,H),H++;}};return fn}function xa(e){return e?.isRunning()??false}function Sa(e){return e?.isPaused()??false}var E={xi:new Float32Array(1e4),xl:new Float32Array(1e4),yi:new Float32Array(1e4),yl:new Float32Array(1e4),base:new Float32Array(1e4),valid:new Uint8Array(1e4)};function Ca(e,t,n){E.xi[t]=n.xi,E.xl[t]=n.xl,E.yi[t]=n.yi,E.yl[t]=n.yl,E.base[t]=n.base,E.valid[t]=1;}function Da(e,t){if(E.valid[t]===1)return {xi:E.xi[t],xl:E.xl[t],yi:E.yi[t],yl:E.yl[t],base:E.base[t]}}function Pa(e,t){return E.valid[t]===1}function Ta(e,t){E.valid[t]=0;}function ka(e,t,n){E.valid[t]=0;let o=n(e,t);for(let r of o)E.valid[r]=0;}function Aa(e){E.valid.fill(0);}function Ra(e,t){return E.valid[t]!==1?0:E.xl[t]-E.xi[t]}function Ia(e,t){return E.valid[t]!==1?0:E.yl[t]-E.yi[t]}function Ba(e,t,n){E.valid[t]===1&&(E.base[t]=n);}function Yt(e,t,n,o){if(E.valid[t]!==1)return false;let r=E.xi[t],i=E.xl[t],a=E.yi[t],s=E.yl[t];return n>=r&&n<i&&o>=a&&o<s}function Wa(e){return o$1(e,[G,e$1,I$1])}function Ma(e){return o$1(e,[p])}function Ce(e){return o$1(e,[c$1])}function wa(e){return o$1(e,[b$2])}function La(e){return o$1(e,[G,e$1,I$1,d$1])}function Ka(e){return o$1(e,[G,e$1,I$1,k])}function Oa(e){return o$1(e,[G,e$1,I$1,c$2])}function lo(e){return o$1(e,[b])}function Fa(e,t){return t.filter(n=>I$1.visible[n]===1)}function Na(e,t){return t.filter(n=>I$1.dirty[n]===1)}function Ua(e,t){return t.filter(n=>I$1.visible[n]===1&&I$1.dirty[n]===1)}function uo(e,t){let n=[],o=b.firstChild[t];for(;o!==0;)n.push(o),o=b.nextSibling[o];return n}function _a(e,t){let n=[],o=[t];for(;o.length>0;){let r=o.pop(),i=uo(e,r);for(let a of i)n.push(a),o.push(a);}return n}function za(e){return lo(e).filter(n=>b.parent[n]===0)}function Va(e,t){return t.filter(n=>p.focusable[n]===1)}function Ha(e,t){return t.filter(n=>c$1.clickable[n]===1)}function ja(e,t){return [...t].sort((n,o)=>{let r=p.tabIndex[n]??0,i=p.tabIndex[o]??0;return r===0&&i!==0?1:i===0&&r!==0?-1:r-i})}function Ga(e,t){return [...t].sort((n,o)=>(b.depth[n]??0)-(b.depth[o]??0))}function Ya(){return {entities:[],dirty:true,lastCount:0}}function Ja(e){e.dirty=true;}function $a(e){return e.dirty}function Te(e,t){if(!t.dirty)return;let o=Ce(e).filter(r=>c$1.clickable[r]===1||c$1.hoverable[r]===1);o.sort((r,i)=>{let a=g$2(e,r)?d$2.zIndex[r]??0:0;return (g$2(e,i)?d$2.zIndex[i]??0:0)-a}),t.entities=o,t.lastCount=o.length,t.dirty=false;}function Xa(e,t){return Te(e,t),t.entities}function qa(e,t){return Te(e,t),t.entities.length}var Jt={useCachedPositions:true,clickableOnly:true,hoverableOnly:false,interactiveOnly:false};function De(e,t,n){return m(e,t,c$1)?n.interactiveOnly?c$1.clickable[t]===1||c$1.hoverable[t]===1:n.clickableOnly&&n.hoverableOnly?c$1.clickable[t]===1&&c$1.hoverable[t]===1:n.clickableOnly?c$1.clickable[t]===1:n.hoverableOnly?c$1.hoverable[t]===1:true:false}function Pe(e,t,n,o,r){return r?Yt(e,t,n,o):Kt(e,t,n,o)}function Qa(e,t,n,o,r){let i=r.useCachedPositions??true;Te(e,t);for(let a of t.entities)if(De(e,a,r)&&Pe(e,a,n,o,i))return a;return null}function Za(e,t,n,o){let r=o.useCachedPositions??true,i=Ce(e),a=[];for(let s of i)De(e,s,o)&&Pe(e,s,t,n,r)&&a.push({eid:s,z:e$2(e,s)});return a.length===0?null:(a.sort((s,l)=>l.z-s.z),a[0]?.eid??null)}function Ue(e,t,n,o,r=Jt){return o?Qa(e,o,t,n,r):Za(e,t,n,r)}function $t(e,t,n,o,r=Jt){let i=r.useCachedPositions??true,a=[];if(o){Te(e,o);for(let c of o.entities)De(e,c,r)&&Pe(e,c,t,n,i)&&a.push(c);return a}let s=Ce(e),l=[];for(let c of s)De(e,c,r)&&Pe(e,c,t,n,i)&&l.push({eid:c,z:e$2(e,c)});return l.sort((c,p)=>p.z-c.z),l.map(c=>c.eid)}function es(e,t,n,o,r=Jt){let i=r.useCachedPositions??true,a=[];if(o){Te(e,o);for(let l of o.entities)De(e,l,r)&&Pe(e,l,t,n,i)&&a.push({entity:l,zIndex:e$2(e,l)});return a}let s=Ce(e);for(let l of s)De(e,l,r)&&Pe(e,l,t,n,i)&&a.push({entity:l,zIndex:e$2(e,l)});return a.sort((l,c)=>c.zIndex-l.zIndex),a}function ts(e,t,n,o){return Ue(e,t,n,o,{clickableOnly:true,useCachedPositions:true})!==null}function ns(e,t,n,o){return Ue(e,t,n,o,{hoverableOnly:true,clickableOnly:false,useCachedPositions:true})!==null}function os(e,t,n,o){return Ue(e,t,n,o,{clickableOnly:true,useCachedPositions:true})}function rs(e,t,n,o){return Ue(e,t,n,o,{hoverableOnly:true,clickableOnly:false,useCachedPositions:true})}function is(e,t,n,o){return $t(e,t,n,o,{clickableOnly:true,useCachedPositions:true})}function as(e,t,n,o){return $t(e,t,n,o,{hoverableOnly:true,clickableOnly:false,useCachedPositions:true})}var fo=z.object({action:z.string().min(1,"Action name is required"),keys:z.array(z.string()).default([]),mouseButtons:z.array(z.enum(["left","right","middle","wheelUp","wheelDown","unknown"])).optional(),continuous:z.boolean().default(false),deadzone:z.number().min(0).max(1).default(.1)}),po=z.object({version:z.number().int().positive(),bindings:z.array(z.object({action:z.string(),keys:z.array(z.string()),mouseButtons:z.array(z.string()).optional(),continuous:z.boolean().optional()}))}),co={active:false,justActivated:false,justDeactivated:false,activeTime:0,value:0},ss=1;function ls(e,t){for(let n of e.keys)if(t.isKeyDown(n))return true;for(let n of e.mouseButtons)if(t.isMouseButtonDown(n))return true;return false}function us(e){let t=new Map,n=new Map,o=new Map,r=new Set;function i(u,f,m){u.active=true,u.justActivated=true,u.activeTime=0,u.value=1,c(f,u,m);}function a(u,f,m){u.active=false,u.justDeactivated=true,u.value=0,c(f,u,m);}function s(u,f,m,x,P){u.activeTime+=x,u.value=1,f.continuous&&c(m,u,P);}function l(u,f,m,x,P){m.justActivated=false,m.justDeactivated=false;let L=m.active,I=ls(f,P);I&&!L?i(m,u,P):!I&&L?a(m,u,P):I&&s(m,f,u,x,P);}function c(u,f,m){let x=o.get(u);if(x)for(let P of x)P(u,f,m);for(let P of r)P(u,f,m);}let p={register(u){let f=fo.parse(u),m={action:f.action,keys:[...f.keys],mouseButtons:f.mouseButtons?[...f.mouseButtons]:[],continuous:f.continuous??false,deadzone:f.deadzone??.1};return t.set(f.action,m),n.has(f.action)||n.set(f.action,{...co}),p},registerAll(u){for(let f of u)p.register(f);return p},unregister(u){let f=t.delete(u);return n.delete(u),o.delete(u),f},hasAction(u){return t.has(u)},getActions(){return [...t.keys()]},getBinding(u){let f=t.get(u);if(f)return {action:f.action,keys:[...f.keys],mouseButtons:f.mouseButtons.length>0?[...f.mouseButtons]:void 0,continuous:f.continuous,deadzone:f.deadzone}},update(u,f){let m=f*1e3;for(let[x,P]of t){let L=n.get(x);L&&l(x,P,L,m,u);}},isActive(u){return n.get(u)?.active??false},isJustActivated(u){return n.get(u)?.justActivated??false},isJustDeactivated(u){return n.get(u)?.justDeactivated??false},getValue(u){return n.get(u)?.value??0},getActiveTime(u){return n.get(u)?.activeTime??0},getState(u){return n.get(u)??co},getActiveActions(){let u=[];for(let[f,m]of n)m.active&&u.push(f);return u},rebindKeys(u,f){let m=t.get(u);return m?(m.keys=[...f],true):false},rebindMouseButtons(u,f){let m=t.get(u);return m?(m.mouseButtons=[...f],true):false},addKey(u,f){let m=t.get(u);return m?(m.keys.includes(f)||m.keys.push(f),true):false},removeKey(u,f){let m=t.get(u);if(!m)return false;let x=m.keys.indexOf(f);return x!==-1?(m.keys.splice(x,1),true):false},getKeysForAction(u){let f=t.get(u);return f?[...f.keys]:[]},getMouseButtonsForAction(u){let f=t.get(u);return f?[...f.mouseButtons]:[]},getActionsForKey(u){let f=[];for(let[m,x]of t)x.keys.includes(u)&&f.push(m);return f},onAction(u,f){let m=o.get(u);return m||(m=new Set,o.set(u,m)),m.add(f),()=>{m?.delete(f);}},onAnyAction(u){return r.add(u),()=>{r.delete(u);}},saveBindings(){let u=[];for(let[,f]of t)u.push({action:f.action,keys:[...f.keys],mouseButtons:f.mouseButtons.length>0?[...f.mouseButtons]:void 0,continuous:f.continuous||void 0});return {version:ss,bindings:u}},loadBindings(u){let f=po.parse(u);t.clear(),n.clear();for(let m of f.bindings)p.register({action:m.action,keys:m.keys,mouseButtons:m.mouseButtons,continuous:m.continuous});},toJSON(u=false){let f=p.saveBindings();return u?JSON.stringify(f,null,2):JSON.stringify(f)},fromJSON(u){let f=JSON.parse(u);p.loadBindings(f);},resetStates(){for(let u of n.values())u.active=false,u.justActivated=false,u.justDeactivated=false,u.activeTime=0,u.value=0;},clear(){t.clear(),n.clear(),o.clear(),r.clear();}};return e&&p.registerAll(e),p}var cs={platformer:[{action:"move_left",keys:["a","left"],continuous:true},{action:"move_right",keys:["d","right"],continuous:true},{action:"jump",keys:["space","w","up"]},{action:"crouch",keys:["s","down"],continuous:true},{action:"attack",keys:["j","enter"]}],topDown:[{action:"move_up",keys:["w","up"],continuous:true},{action:"move_down",keys:["s","down"],continuous:true},{action:"move_left",keys:["a","left"],continuous:true},{action:"move_right",keys:["d","right"],continuous:true},{action:"action",keys:["space","enter"]}],menu:[{action:"up",keys:["w","up"]},{action:"down",keys:["s","down"]},{action:"left",keys:["a","left"]},{action:"right",keys:["d","right"]},{action:"confirm",keys:["enter","space"]},{action:"cancel",keys:["escape","backspace"]}]};function ft(){return performance.now()}function Xt(e){return e.length===0?0:e.reduce((n,o)=>n+o,0)/e.length}function mo(e,t){if(e.length===0)return 0;if(e.length===1)return e[0]??0;let n=Math.ceil(t*e.length)-1;return e[Math.max(0,Math.min(n,e.length-1))]??0}function ds(e,t){t&&console.warn(`[InputEventBuffer] Dropped ${e} events due to buffer overflow`);}function yo(e={}){let t=e.warnOnOverflow??true;return {keyEvents:[],mouseEvents:[],latencySamples:[],frameProcessingTimes:[],frameStartTime:0,totalKeyEvents:0,totalMouseEvents:0,droppedEvents:0,config:{maxBufferSize:e.maxBufferSize??1e3,maxLatencySamples:e.maxLatencySamples??1e3,maxFrameSamples:e.maxFrameSamples??100,warnOnOverflow:t,onOverflow:e.onOverflow??(n=>ds(n,t))}}}function go(e,t){let n=e.config.maxBufferSize;if(n<=0)return 0;if(t.length>n){let o=t.length-n;return t.splice(0,o),e.droppedEvents+=o,e.config.onOverflow(o),o}return 0}function fs(e,t,n){e.totalKeyEvents++;let o={type:"key",event:t,timestamp:n??ft()};e.keyEvents.push(o),go(e,e.keyEvents);}function ps(e,t,n){e.totalMouseEvents++;let o={type:"mouse",event:t,timestamp:n??ft()};e.mouseEvents.push(o),go(e,e.mouseEvents);}function bo(e){let t=e.keyEvents;return e.keyEvents=[],t}function ho(e){let t=e.mouseEvents;return e.mouseEvents=[],t}function ms(e){let t=bo(e),n=ho(e),o=[...t,...n];return o.sort((r,i)=>r.timestamp-i.timestamp),o}function ys(e){let t=[...e.keyEvents,...e.mouseEvents];return t.sort((n,o)=>n.timestamp-o.timestamp),t}function gs(e){return e.keyEvents}function bs(e){return e.mouseEvents}function hs(e){e.keyEvents=[],e.mouseEvents=[];}function vs(e){return e.keyEvents.length}function Es(e){return e.mouseEvents.length}function xs(e){return e.keyEvents.length+e.mouseEvents.length}function Ss(e){return e.keyEvents.length>0||e.mouseEvents.length>0}function Cs(e){return {totalKeyEvents:e.totalKeyEvents,totalMouseEvents:e.totalMouseEvents,pendingKeyEvents:e.keyEvents.length,pendingMouseEvents:e.mouseEvents.length,droppedEvents:e.droppedEvents,maxBufferSize:e.config.maxBufferSize}}function Ds(e){e.totalKeyEvents=0,e.totalMouseEvents=0,e.droppedEvents=0;}function Ps(e){e.frameStartTime=ft();}function Ts(e){let n=ft()-e.frameStartTime;return e.frameProcessingTimes.push(n),e.frameProcessingTimes.length>e.config.maxFrameSamples&&e.frameProcessingTimes.shift(),n}function ks(e,t){e.latencySamples.push(t),e.latencySamples.length>e.config.maxLatencySamples&&e.latencySamples.shift();}function As(e,t,n){for(let o=0;o<Math.min(n,10);o++)e.latencySamples.push(t);for(;e.latencySamples.length>e.config.maxLatencySamples;)e.latencySamples.shift();}function qt(e){let t=e.latencySamples,n=e.frameProcessingTimes;if(t.length===0)return {min:0,max:0,avg:0,p95:0,p99:0,sampleCount:0,lastFrameProcessingTime:n[n.length-1]??0,avgFrameProcessingTime:Xt(n)};let o=[...t].sort((r,i)=>r-i);return {min:o[0]??0,max:o[o.length-1]??0,avg:Xt(o),p95:mo(o,.95),p99:mo(o,.99),sampleCount:o.length,lastFrameProcessingTime:n[n.length-1]??0,avgFrameProcessingTime:Xt(n)}}function Rs(e){e.latencySamples=[],e.frameProcessingTimes=[];}function Is(e,t=16){return qt(e).p95<=t}function Bs(e,t=1){return qt(e).avgFrameProcessingTime<=t}var Ws=yo();var Ms=z.object({trackRepeats:z.boolean().optional(),debounceTime:z.number().nonnegative().optional(),customRepeatRate:z.number().positive().optional(),customRepeatDelay:z.number().positive().optional()}),vo={pressed:false,justPressed:false,justReleased:false,heldTime:0,repeatCount:0,lastEventTime:0},ke={pressed:false,justPressed:false,justReleased:false,heldTime:0,lastEventTime:0};function Eo(){return {x:0,y:0,deltaX:0,deltaY:0,wheelDelta:0,buttons:{left:{...ke},right:{...ke},middle:{...ke},wheelUp:{...ke},wheelDown:{...ke},unknown:{...ke}}}}function ws(e,t){return e.toLowerCase()}function Ls(e={}){let t=Ms.parse(e),n={trackRepeats:t.trackRepeats??true,debounceTime:t.debounceTime??0,customRepeatRate:t.customRepeatRate??0,customRepeatDelay:t.customRepeatDelay??500},o=new Map,r=Eo(),i=0,a=0,s=0,l=false,c=false,p=false;function u(){for(let d of o.values())d.justPressed=false,d.justReleased=false;for(let d of Object.values(r.buttons))d.justPressed=false,d.justReleased=false;}function f(d){for(let y of o.values())y.pressed&&(y.heldTime+=d);}function m(d,y){return n.debounceTime<=0||d.lastEventTime<=0?false:y-d.lastEventTime<n.debounceTime}function x(d){n.trackRepeats&&d.repeatCount++;}function P(d){d.pressed=true,d.justPressed=true,d.justReleased=false,d.heldTime=0,d.repeatCount=0;}function L(d,y){let h=ws(d.name),k=o.get(h);k||(k={...vo},o.set(h,k)),!m(k,y)&&(k.pressed?x(k):P(k),k.lastEventTime=y,d.ctrl&&!k.pressed&&(l=true),d.meta&&!k.pressed&&(c=true),d.shift&&!k.pressed&&(p=true));}function I(d,y){let h=o.get(d);!h||!h.pressed||(h.pressed=false,h.justPressed=false,h.justReleased=true,h.lastEventTime=y,d==="ctrl"&&(l=false),d==="alt"&&(c=false),d==="shift"&&(p=false));}function B(d){let y=r.x,h=r.y;r.x=d.x,r.y=d.y,r.deltaX+=d.x-y,r.deltaY+=d.y-h;}function H(d,y,h){y==="press"&&!d.pressed?(d.pressed=true,d.justPressed=true,d.justReleased=false,d.heldTime=0):y==="release"&&d.pressed&&(d.pressed=false,d.justPressed=false,d.justReleased=true),d.lastEventTime=h;}function pe(d,y){B(d),d.button==="wheelUp"?r.wheelDelta+=1:d.button==="wheelDown"&&(r.wheelDelta-=1);let h=r.buttons[d.button];h&&H(h,d.action,y);}let me=()=>{let d=performance.now();for(let[y,h]of o)h.pressed&&I(y,d);l=false,c=false,p=false;},ne=()=>{let d=performance.now();for(let y of Object.values(r.buttons))y.pressed&&(y.pressed=false,y.justReleased=true,y.lastEventTime=d);};return {update(d,y,h){i++,a=d.length,s=y.length;let k=h*1e3;u(),f(k);for(let V of d)L(V.event,V.timestamp);r.deltaX=0,r.deltaY=0,r.wheelDelta=0;for(let V of y)pe(V.event,V.timestamp);for(let V of Object.values(r.buttons))V.pressed&&(V.heldTime+=k);},isKeyDown(d){return o.get(d.toLowerCase())?.pressed??false},isKeyPressed(d){return o.get(d.toLowerCase())?.justPressed??false},isKeyReleased(d){return o.get(d.toLowerCase())?.justReleased??false},getKeyHeldTime(d){return o.get(d.toLowerCase())?.heldTime??0},getKeyState(d){return o.get(d.toLowerCase())??vo},getKeyRepeatCount(d){return o.get(d.toLowerCase())?.repeatCount??0},getPressedKeys(){let d=[];for(let[y,h]of o)h.pressed&&d.push(y);return d},getJustPressedKeys(){let d=[];for(let[y,h]of o)h.justPressed&&d.push(y);return d},getJustReleasedKeys(){let d=[];for(let[y,h]of o)h.justReleased&&d.push(y);return d},isCtrlDown(){return l},isAltDown(){return c},isShiftDown(){return p},hasModifier(){return l||c||p},isMouseButtonDown(d){return r.buttons[d]?.pressed??false},isMouseButtonPressed(d){return r.buttons[d]?.justPressed??false},isMouseButtonReleased(d){return r.buttons[d]?.justReleased??false},getMouseX(){return r.x},getMouseY(){return r.y},getMousePosition(){return {x:r.x,y:r.y}},getMouseDelta(){return {deltaX:r.deltaX,deltaY:r.deltaY}},getWheelDelta(){return r.wheelDelta},getMouseState(){return r},releaseKey(d){I(d.toLowerCase(),performance.now());},releaseAllKeys:me,releaseAllMouseButtons:ne,releaseAll(){me(),ne();},getStats(){let d=0,y=0,h=0;for(let k of o.values())k.pressed&&d++,k.justPressed&&y++,k.justReleased&&h++;return {keysDown:d,keysPressed:y,keysReleased:h,keyEventsThisFrame:a,mouseEventsThisFrame:s,frameCount:i}},getFrameCount(){return i},reset(){o.clear(),r=Eo(),i=0,a=0,s=0,l=false,c=false,p=false;}}}function Ks(e,t){for(let n of t)if(e.isKeyDown(n))return true;return false}function Os(e,t){for(let n of t)if(!e.isKeyDown(n))return false;return true}function Fs(e,t){for(let n of t)if(e.isKeyPressed(n))return true;return false}function Ns(e){let t=0,n=0;return (e.isKeyDown("a")||e.isKeyDown("left"))&&(t-=1),(e.isKeyDown("d")||e.isKeyDown("right"))&&(t+=1),(e.isKeyDown("w")||e.isKeyDown("up"))&&(n-=1),(e.isKeyDown("s")||e.isKeyDown("down"))&&(n+=1),{x:t,y:n}}var xo=z.object({keys:z.union([z.string(),z.array(z.string()).readonly()]),action:z.string().min(1),when:z.string().optional(),preventDefault:z.boolean().optional(),description:z.string().optional()}),Us=z.array(xo),_s={esc:"escape",ret:"return",cr:"return",lf:"enter",bs:"backspace",del:"delete",ins:"insert",pgup:"pageup",pgdn:"pagedown",pgdown:"pagedown",arrow_up:"up",arrow_down:"down",arrow_left:"left",arrow_right:"right"},zs={control:"ctrl",cmd:"meta",command:"meta",option:"meta",alt:"meta",win:"meta",super:"meta"};function Vs(e,t){t==="ctrl"?e.ctrl=true:t==="meta"?e.meta=true:t==="shift"&&(e.shift=true);}function Hs(e,t,n){if(t){let o=js(e);if(!o)return false;n.name=o;}else {let o=Gs(e);if(!o)return false;Vs(n,o);}return true}function Zt(e){if(!e)return null;let t=e.toLowerCase().split("+").map(o=>o.trim());if(t.length===0)return null;let n={name:"undefined",ctrl:false,meta:false,shift:false};for(let o=0;o<t.length;o++){let r=t[o];if(r&&!Hs(r,o===t.length-1,n))return null}return n.name==="undefined"?null:n}function js(e){let t=e.toLowerCase(),n=_s[t];return n||(t.length===1||/^f(1[0-2]|[1-9])$/.test(t)||new Set(["up","down","left","right","home","end","pageup","pagedown","insert","delete","clear","return","enter","tab","backspace","escape","space"]).has(t)?t:null)}function Gs(e){let t=e.toLowerCase();return t==="ctrl"||t==="meta"||t==="shift"?t:zs[t]??null}function en(e){let t=[];return e.ctrl&&t.push("ctrl"),e.meta&&t.push("meta"),e.shift&&t.push("shift"),t.push(e.name),t.join("+")}function So(e){let t=[];return e.ctrl&&t.push("ctrl"),e.meta&&t.push("meta"),e.shift&&t.push("shift"),t.push(e.name),t.join("+")}function Ys(){return {bindings:new Map,keyIndex:new Map}}function Co(e,t){let n=new Map(e.bindings),o=new Map;for(let[i,a]of e.keyIndex)o.set(i,[...a]);n.set(t.action,t);let r=Array.isArray(t.keys)?t.keys:[t.keys];for(let i of r){let a=Zt(i);if(!a)continue;let s=en(a),l=o.get(s)??[];o.set(s,[...l,t]);}return {bindings:n,keyIndex:o}}function Js(e,t){return t.reduce((n,o)=>Co(n,o),e)}function $s(e,t){if(!e.bindings.get(t))return e;let o=new Map(e.bindings),r=new Map;for(let[i,a]of e.keyIndex){let s=a.filter(l=>l.action!==t);s.length>0&&r.set(i,s);}return o.delete(t),{bindings:o,keyIndex:r}}function Xs(e,t){return e.bindings.get(t)}function qs(e,t){let n=en(t);return e.keyIndex.get(n)??[]}function Qs(e,t){let n=Array.isArray(e.keys)?e.keys:[e.keys];for(let o of n){let r=Zt(o);if(r&&r.name===t.name&&r.ctrl===t.ctrl&&r.meta===t.meta&&r.shift===t.shift)return true}return false}function Do(e,t){if(!e)return true;let n=e.split("&&").map(o=>o.trim());for(let o of n)if(!Po(o,t))return false;return true}function Po(e,t){let n=e.trim();if(n.startsWith("!"))return !Po(n.slice(1),t);if(n.includes("==")){let r=n.split("==").map(c=>c.trim()),i=r[0],a=r[1];if(!i||!a)return false;let s=Qt(i,t),l=a.replace(/^['"]|['"]$/g,"");return String(s)===l}if(n.includes("!=")){let r=n.split("!=").map(c=>c.trim()),i=r[0],a=r[1];if(!i||!a)return false;let s=Qt(i,t),l=a.replace(/^['"]|['"]$/g,"");return String(s)!==l}return !!Qt(n,t)}function Qt(e,t){let n=e.trim();return t[n]}function Zs(e,t,n={}){let o=So(t),r=e.keyIndex.get(o)??[],i=[];for(let a of r)a.when&&!Do(a.when,n)||i.push({binding:a,action:a.action,preventDefault:a.preventDefault??true});return i}function el(e){return en(e)}function tl(e){return So(e)}function nl(e){return [...e.bindings.values()]}var ol=[{keys:["ctrl+c"],action:"copy",description:"Copy selection"},{keys:["ctrl+v"],action:"paste",description:"Paste clipboard"},{keys:["ctrl+x"],action:"cut",description:"Cut selection"},{keys:["ctrl+z"],action:"undo",description:"Undo"},{keys:["ctrl+shift+z","ctrl+y"],action:"redo",description:"Redo"},{keys:["ctrl+a"],action:"selectAll",description:"Select all"},{keys:["backspace"],action:"deleteBack",description:"Delete backwards"},{keys:["delete"],action:"deleteForward",description:"Delete forwards"},{keys:["home"],action:"moveToLineStart",description:"Move to line start"},{keys:["end"],action:"moveToLineEnd",description:"Move to line end"},{keys:["ctrl+home"],action:"moveToStart",description:"Move to document start"},{keys:["ctrl+end"],action:"moveToEnd",description:"Move to document end"}],rl=[{keys:["tab"],action:"focusNext",description:"Focus next element"},{keys:["shift+tab"],action:"focusPrev",description:"Focus previous element"},{keys:["escape"],action:"cancel",description:"Cancel/close"},{keys:["enter","return"],action:"confirm",description:"Confirm/submit"},{keys:["up"],action:"moveUp",description:"Move up"},{keys:["down"],action:"moveDown",description:"Move down"},{keys:["left"],action:"moveLeft",description:"Move left"},{keys:["right"],action:"moveRight",description:"Move right"},{keys:["pageup"],action:"pageUp",description:"Page up"},{keys:["pagedown"],action:"pageDown",description:"Page down"}];var To={CRITICAL:0,HIGH:1,NORMAL:2,LOW:3};function il(e){let t,n=false;return {get(){return n||(t=e(),n=true),t},isInitialized(){return n},reset(){t=void 0,n=false;}}}var fe=[],Ae=null,pt=null;function al(e,t,n){fe.find(r=>r.name===e)||fe.push({name:e,priority:t,initFn:n,initialized:false,initTimeMs:null});}function ko(e){let t=fe.find(r=>r.name===e);if(!t||t.initialized)return null;Ae===null&&(Ae=performance.now());let n=performance.now();t.initFn();let o=performance.now()-n;return t.initialized=true,t.initTimeMs=o,pt===null&&(pt=performance.now()-Ae),o}function sl(e=To.LOW){Ae===null&&(Ae=performance.now());let t=0,n=[...fe].filter(o=>!o.initialized&&o.priority<=e).sort((o,r)=>o.priority-r.priority);for(let o of n){let r=ko(o.name);r!==null&&(t+=r);}return t}function ll(){return {totalMs:fe.filter(n=>n.initialized).reduce((n,o)=>n+(o.initTimeMs??0),0),subsystems:fe.map(n=>({name:n.name,priority:n.priority,initTimeMs:n.initTimeMs??0,lazy:!n.initialized})),timeToFirstInit:pt??0}}function ul(e){let t=[],n=["CRITICAL","HIGH","NORMAL","LOW"];t.push("Startup Report"),t.push("\u2550".repeat(40)),t.push(`Total init time: ${e.totalMs.toFixed(1)}ms`),t.push(`Time to first init: ${e.timeToFirstInit.toFixed(1)}ms`),t.push("");for(let o of e.subsystems){let r=o.lazy?"(lazy)":`${o.initTimeMs.toFixed(1)}ms`,i=n[o.priority]??"UNKNOWN";t.push(` [${i}] ${o.name}: ${r}`);}return t.join(`
2
+ `)}function cl(){fe.length=0,Ae=null,pt=null;}function dl(e=6e4){let t=tn.value;if(t&&Date.now()-t.cachedAt<e)return t;let n=process.env,o=n.TERM??"",r=n.COLORTERM??"",i=r==="truecolor"||r==="24bit"||o.includes("24bit")||o.includes("truecolor"),a=i||o.includes("256color")||r==="256color",s=(n.LANG??"").includes("UTF-8")||(n.LC_ALL??"").includes("UTF-8"),l={term:o,trueColor:i,color256:a,unicode:s,width:process.stdout.columns??80,height:process.stdout.rows??24,cachedAt:Date.now()};return tn.value=l,l}var tn={value:null};function fl(){tn.value=null;}var Ro={0:"INPUT",1:"EARLY_UPDATE",2:"UPDATE",3:"LATE_UPDATE",4:"PHYSICS",5:"LAYOUT",6:"RENDER",7:"POST_RENDER"};function pl(e){return typeof e=="number"&&e>=0&&e<=7}function Ao(e){for(let t=0;t<=7;t++)e.set(t,{id:t,name:Ro[t]??`PHASE_${t}`,order:t*1e3,isBuiltin:true});}function Io(){let e=new Map,t=0,n=true,o=[];Ao(e);function r(a){let s=Number.MAX_SAFE_INTEGER;for(let l of e.values())l.order>a&&l.order<s&&(s=l.order);return s===Number.MAX_SAFE_INTEGER&&(s=a+1e3),s}function i(){let a=Array.from(e.values());a.sort((s,l)=>s.order-l.order),o=a.map(s=>s.id),n=false;}return {registerPhase(a,s){let l=e.get(s);if(!l)throw new Error(`Cannot register phase after unknown phase: ${String(s)}`);let c=`custom_${a}_${++t}`,p=l.order,u=r(p),f=p+(u-p)/2;return e.set(c,{id:c,name:a,order:f,isBuiltin:false}),n=true,c},unregisterPhase(a){let s=e.get(a);if(!s)return false;if(s.isBuiltin)throw new Error(`Cannot remove built-in phase: ${s.name}`);return e.delete(a),n=true,true},getPhaseOrder(){return n&&i(),o},getPhaseName(a){return e.get(a)?.name},hasPhase(a){return e.has(a)},isBuiltin(a){return e.get(a)?.isBuiltin??false},getPhaseCount(){return e.size},getCustomPhaseCount(){let a=0;for(let s of e.values())s.isBuiltin||a++;return a},getCustomPhases(){let a=[];for(let s of e.values())!s.isBuiltin&&typeof s.id=="string"&&a.push(s.id);return a},clearCustomPhases(){for(let[a,s]of e)s.isBuiltin||e.delete(a);t=0,n=true;},reset(){e.clear(),t=0,Ao(e),n=true;}}}var ml=Io();var Bo=z.object({name:z.string().min(1),store:z.unknown()}),Wo=z.object({system:z.function(),phase:z.nativeEnum(a),priority:z.number().optional()}),Mo=z.object({name:z.string().min(1),description:z.string().optional(),factory:z.function(),tags:z.array(z.string()).readonly().optional()}),wo=z.object({name:z.string().min(1),theme:z.record(z.string(),z.unknown())}),Lo=z.object({name:z.string().min(1),version:z.string().min(1),dependencies:z.array(z.string().min(1)).readonly().optional(),components:z.array(Bo).readonly().optional(),systems:z.array(Wo).readonly().optional(),widgets:z.array(Mo).readonly().optional(),themes:z.array(wo).readonly().optional(),configSchema:z.unknown().optional(),init:z.function().optional(),onActivate:z.function().optional(),onDeactivate:z.function().optional(),cleanup:z.function().optional()});function yl(){return {_plugins:new Map}}function gl(e,t,n,o){let r=Lo.safeParse(o);if(!r.success)return {success:false,error:`Invalid plugin manifest: ${r.error.message}`,systemsRegistered:0,componentsRegistered:0};let i=e._plugins;if(i.has(o.name))return {success:false,error:`Plugin "${o.name}" is already registered`,systemsRegistered:0,componentsRegistered:0};if(o.dependencies){for(let s of o.dependencies)if(!i.has(s))return {success:false,error:`Missing dependency: "${s}" (required by "${o.name}")`,systemsRegistered:0,componentsRegistered:0}}let a=[];if(o.systems)for(let s of o.systems)t.registerSystem(s.phase,s.system,s.priority??0),a.push(s);return i.set(o.name,{plugin:o,registeredSystems:a,active:true}),o.init&&o.init(n),o.onActivate&&o.onActivate(n),{success:true,systemsRegistered:a.length,componentsRegistered:o.components?.length??0}}function bl(e,t,n,o){let r=e._plugins,i=r.get(o);if(!i)return false;for(let[a,s]of r)if(a!==o&&s.plugin.dependencies?.includes(o))return false;i.active&&i.plugin.onDeactivate&&i.plugin.onDeactivate(n);for(let a of i.registeredSystems)t.unregisterSystem(a.system);return i.plugin.cleanup&&i.plugin.cleanup(n),r.delete(o),true}function hl(e){let t=[];for(let n of e._plugins.values())t.push({name:n.plugin.name,version:n.plugin.version,dependencies:n.plugin.dependencies??[],componentCount:n.plugin.components?.length??0,systemCount:n.registeredSystems.length,widgetCount:n.plugin.widgets?.length??0,themeCount:n.plugin.themes?.length??0,active:n.active});return t}function vl(e,t){return e._plugins.has(t)}function El(e){return e._plugins.size}function xl(e,t,n){let o=e._plugins,r=[...o.keys()].reverse();for(let i of r){let a=o.get(i);if(a){a.active&&a.plugin.onDeactivate&&a.plugin.onDeactivate(n);for(let s of a.registeredSystems)t.unregisterSystem(s.system);a.plugin.cleanup&&a.plugin.cleanup(n);}}o.clear();}function Sl(e){return e}function Cl(e,t,n,o){let i=e._plugins.get(o);if(!i)return false;if(i.active)return true;for(let a of i.registeredSystems)t.registerSystem(a.phase,a.system,a.priority??0);return i.active=true,i.plugin.onActivate&&i.plugin.onActivate(n),true}function Dl(e,t,n,o){let i=e._plugins.get(o);if(!i)return false;if(!i.active)return true;i.plugin.onDeactivate&&i.plugin.onDeactivate(n);for(let a of i.registeredSystems)t.unregisterSystem(a.system);return i.active=false,true}function Pl(e,t){return e._plugins.get(t)?.active??false}function Tl(e,t){return e.configSchema?e.configSchema.parse(t):t}var kl=z.union([z.number(),z.string().refine(e=>!!(["center","half","left","right","top","bottom"].includes(e)||/^\d+(\.\d+)?%$/.test(e)||/^(\d+(\.\d+)?%?)([-+]\d+(\.\d+)?)?$/.test(e)),{message:'Position must be a number, percentage (e.g. "50%"), expression (e.g. "50%-5"), or keyword (center, half)'})]),Ko={center:"center",half:"half",left:"start",right:"end",top:"start",bottom:"end"};function Al(e){let t=e.match(/^(\d+(?:\.\d+)?)(%?)(([+-])(\d+(?:\.\d+)?))?$/);if(!t)return null;let n=Number.parseFloat(t[1]),o=t[2]==="%",r=0;if(t[3]){let i=t[4],a=Number.parseFloat(t[5]);r=i==="-"?-a:a;}return {base:n,isPercent:o,offset:r}}function mt(e,t,n=0){if(typeof e=="number")return Math.floor(e)||0;let o=Ko[e];if(o)switch(o){case "center":return Math.floor((t-n)/2);case "half":return Math.floor(t/2);case "start":return 0;case "end":return t-n}let r=Al(e);if(!r)return 0;let i;return r.isPercent?i=r.base/100*t:i=r.base,i+=r.offset,Math.floor(i)}function Rl(e,t,n=0){if(typeof e=="number"&&e<0)return t+e-n;if(typeof e=="string"&&e.startsWith("-")){let o=e.match(/^-(\d+(?:\.\d+)?)$/);if(o){let r=Number.parseFloat(o[1]);return t-r-n}}return mt(e,t,n)}function on(e,t,n=0){let o=t-n;return e<0?0:e>o?Math.max(0,o):e}function Il(e){return typeof e=="number"?false:e.includes("%")}function Bl(e){return typeof e=="number"?false:e in Ko}function Wl(){return "center"}function Ml(e){return `${e}%`}function wl(e,t){return t>=0?`${e}%+${t}`:`${e}%${t}`}function Oo(e,t,n,o,r=0,i=0){return {x:mt(e,n,r),y:mt(t,o,i)}}function Ll(e,t,n,o,r=0,i=0){let a=Oo(e,t,n,o,r,i);return {x:on(a.x,n,r),y:on(a.y,o,i)}}function Kl(e,t){let[n,o]=c$3(e()),r=setInterval(()=>{o(e());},t);return [n,()=>{clearInterval(r);}]}function Ol(e){let t=Date.now(),[n,o]=c$3(0),r=setInterval(()=>{let s=Date.now()-t,l=Math.min(s/e,1);o(l),l>=1&&clearInterval(r);},16);return [n,()=>{clearInterval(r);}]}function Fl(e,t){let[n,o]=c$3(t);return [n,i=>{let a=n(),s=e(a,i);o(s);}]}function Nl(e,t){return d$3(()=>{let n=e.map(o=>o());return t(...n)})}function Ul(e,t){let{transform:n=p=>p.toString("utf8"),initialValue:o,destroyOnDispose:r=false}=t,[i,a]=c$3(o),s=(...p)=>{let u=p[0];a(n(u));},l=(...p)=>{let u=p[0];console.error("Stream error:",u);};return e.on("data",s),e.on("error",l),[i,()=>{e.removeListener("data",s),e.removeListener("error",l),r&&e.destroy&&e.destroy();}]}function _l(e,t){let[n,o]=c$3(t),r=e(i=>{o(i);});return [n,r]}function zl(e,t,n){let[o,r]=c$3(n),i=false,a=async()=>{if(!i)try{let c=await e();i||r(c);}catch(c){console.error("Polling error:",c);}};a();let s=setInterval(()=>{a();},t);return [o,()=>{i=true,clearInterval(s);}]}function Vl(e,t,n){let[o,r]=c$3(n),i=(...s)=>{let l=s[0];r(l);};return e.on(t,i),[o,()=>{e.removeListener(t,i);}]}function rn(e,t,n,o,r){e.transition={transition:r,elapsed:0,fromScene:n,toScene:o},r.onStart?.(t);}function Hl(e,t){e.transition&&(e.transition.transition.onComplete?.(t),e.transition=null);}function an(e,t){e.created||(e.scene.onCreate?.(t),e.created=true);}function yt(e,t){an(e,t),e.scene.onEnter?.(t);}function ae(e,t){e.onExit?.(t);}function jl(e,t,n){for(let o=e.stack.length-1;o>=0;o--){let r=e.stack[o];r&&ae(r,t);}e.stack=[n.scene],yt(n,t);}function Gl(e,t,n){let o=e.stack[e.stack.length-1];o&&ae(o,t),e.stack.push(n.scene),yt(n,t);}function Yl(e,t){if(e.stack.length<=0)return false;let n=e.stack[e.stack.length-1];n&&ae(n,t),e.stack.pop();let o=e.stack[e.stack.length-1];if(o){let r=e.registry.get(o.name);r&&yt(r,t);}return true}function Jl(){let e={registry:new Map,stack:[],transition:null};return {registerScene(t){return e.registry.has(t.name)?false:(e.registry.set(t.name,{scene:t,created:false}),true)},unregisterScene(t,n){let o=e.registry.get(n);if(!o)return false;let r=e.stack.indexOf(o.scene);return r!==-1&&(ae(o.scene,t),e.stack.splice(r,1)),o.created&&o.scene.onDestroy?.(t),e.registry.delete(n),true},switchTo(t,n,o){let r=e.registry.get(n);if(!r)return false;if(o){let i=e.stack[e.stack.length-1]??null;for(let a=e.stack.length-1;a>=0;a--){let s=e.stack[a];s&&ae(s,t);}e.stack=[r.scene],an(r,t),rn(e,t,i,r.scene,o);}else jl(e,t,r);return true},push(t,n,o){let r=e.registry.get(n);if(!r)return false;if(o){let i=e.stack[e.stack.length-1]??null;i&&ae(i,t),e.stack.push(r.scene),an(r,t),rn(e,t,i,r.scene,o);}else Gl(e,t,r);return true},pop(t,n){if(e.stack.length<=0)return false;if(n){let o=e.stack[e.stack.length-1]??null;o&&ae(o,t),e.stack.pop();let r=e.stack[e.stack.length-1]??null;return r?rn(e,t,o,r,n):e.transition=null,true}return Yl(e,t)},getCurrentScene(){return e.stack[e.stack.length-1]??null},getSceneStack(){return [...e.stack]},getRegisteredScenes(){return Array.from(e.registry.keys())},isTransitioning(){return e.transition!==null},getTransitionState(){return e.transition},updateTransition(t,n){if(!e.transition)return;e.transition.elapsed+=n;let o=Math.min(1,e.transition.elapsed/e.transition.transition.duration);if(e.transition.transition.onUpdate?.(t,o),o>=1){let r=e.transition.toScene;Hl(e,t);let i=e.registry.get(r.name);i&&yt(i,t);}},reset(t){e.transition=null;for(let n=e.stack.length-1;n>=0;n--){let o=e.stack[n];o&&ae(o,t);}for(let n of e.registry.values())n.created&&n.scene.onDestroy?.(t);e.registry.clear(),e.stack=[];}}}function $l(e,t){return {duration:e,onUpdate:t}}function Xl(e,t,n){return {duration:e,onUpdate(o,r){n?.(o,r,t);}}}function ql(e,t){return n=>{let o=t();return e.isTransitioning()&&e.updateTransition(n,o),e.isTransitioning()||e.getCurrentScene()?.onUpdate?.(n,o),n}}function Fo(e,t,n,o){let r=[],i={};for(let s of n.fields)i[s]=[];let a=n.component;for(let s of t)if(o(e,s,n.component)){r.push(s);for(let l of n.fields){let c=a[l];c&&typeof c[s]<"u"?i[l]?.push(c[s]??0):i[l]?.push(0);}}return r.length===0?null:{name:n.name,entities:r,values:i}}function No(e){let t=new Set;for(let n of e.components)for(let o of n.entities)t.add(o);return t}function Uo(e,t,n){let o=new Map,r=Array.from(t).sort((i,a)=>i-a);for(let i of r){let a=n(e);o.set(i,a);}return o}function _o(e,t,n,o,r){for(let i of r){let a=n[i];if(!a||typeof a[o]>"u")continue;let s=e[i];s&&(s[t]=a[o]);}}function sn(e){let t=new Set;for(let n of e.components)for(let o of n.entities)t.add(o);return t}function zo(e,t){let n=[],o=[];for(let r of t)e.has(r)||n.push(r);for(let r of e)t.has(r)||o.push(r);return {added:n,removed:o}}function Ql(e,t,n,o){if(!n||!n.entities.includes(o))return true;let r=n.entities.indexOf(o);for(let i of Object.keys(e.values)){let a=e.values[i]?.[t],s=n.values[i]?.[r];if(a!==s)return true}return false}function Vo(e,t,n){let o=[],r={};for(let i of Object.keys(e.values))r[i]=[];for(let i=0;i<e.entities.length;i++){let a=e.entities[i];if(!(a===void 0||n.includes(a))&&Ql(e,i,t,a)){o.push(a);for(let s of Object.keys(e.values)){let l=e.values[s]?.[i];l!==void 0&&r[s]?.push(l);}}}return o.length===0?null:{name:e.name,entities:o,values:r}}function Zl(e,t){let n={};for(let o of Object.keys(t.values))n[o]=[...e.values[o]||[],...t.values[o]||[]];return {name:e.name,entities:[...e.entities,...t.entities],values:n}}function Ho(e,t,n){let o=[],r={};for(let s of Object.keys(e.values))r[s]=[];for(let s=0;s<e.entities.length;s++){let l=e.entities[s];if(!(l===void 0||!t.includes(l))){o.push(l);for(let c of Object.keys(e.values)){let p=e.values[c]?.[s];p!==void 0&&r[c]?.push(p);}}}if(o.length===0)return;let i={name:e.name,entities:o,values:r},a=n.find(s=>s.name===e.name);if(a){let s=Zl(a,i),l=n.indexOf(a);n[l]=s;}else n.push(i);}function jo(e){let t=new Map;for(let n of e)t.set(n,n);return t}function Go(e,t,n,o,r){for(let i of t)if(!r(e,i)){let a=o(e);for(;a!==i&&a<i;)a=o(e);n.set(i,a);}}function Yo(e,t,n,o,r,i,a,s){if(!s(e,t))return;i(e,t,n.component)||a(e,t,n.component);let l=n.component;for(let c of n.fields){let p=o.values[c];if(!p||typeof p[r]>"u")continue;let u=l[c];u&&(u[t]=p[r]);}}var eu=z.record(z.string(),z.array(z.number())),Jo=z.object({name:z.string(),entities:z.array(z.number()),values:eu}),gt=z.object({version:z.number().int().positive(),timestamp:z.number().int().nonnegative(),entityCount:z.number().int().nonnegative(),components:z.array(Jo)}),$o=z.object({baseTimestamp:z.number().int().nonnegative(),timestamp:z.number().int().nonnegative(),addedEntities:z.array(z.number()),removedEntities:z.array(z.number()),changedComponents:z.array(Jo)}),ln=[];function tu(e){ln=e;}function nu(){return ln}var ou=1;function ru(e,t){let n=k$2(e),o=[];for(let i of t){let a=Fo(e,n,i,m);a&&o.push(a);}let r={version:ou,timestamp:Date.now(),entityCount:n.length,components:o};return gt.parse(r)}function iu(e){gt.parse(e);let t=f$2(),n=No(e),o=Uo(t,n,h);for(let r of e.components){let i=ln.find(a=>a.name===r.name);if(!i)throw new Error(`Component ${r.name} not registered`);for(let a=0;a<r.entities.length;a++){let s=r.entities[a];if(s===void 0)continue;let l$1=o.get(s);l$1!==void 0&&(l(t,l$1,i.component),_o(i.component,l$1,r.values,a,i.fields));}}return t}function au(e,t){gt.parse(e),gt.parse(t);let n=sn(e),o=sn(t),{added:r,removed:i}=zo(n,o),a=[];for(let l of t.components){let c=e.components.find(u=>u.name===l.name),p=Vo(l,c,r);p&&a.push(p);}for(let l of t.components)Ho(l,r,a);let s={baseTimestamp:e.timestamp,timestamp:t.timestamp,addedEntities:r,removedEntities:i,changedComponents:a};return $o.parse(s)}function su(e,t,n){$o.parse(t);for(let i of t.removedEntities)j(e,i)&&i$2(e,i);let o=k$2(e),r=jo(o);Go(e,t.addedEntities,r,h,j);for(let i of t.changedComponents){let a=n.find(s=>s.name===i.name);if(!a)throw new Error(`Component ${i.name} not registered`);for(let s=0;s<i.entities.length;s++){let l$1=i.entities[s];if(l$1===void 0)continue;let c=r.get(l$1)||l$1;Yo(e,c,a,i,s,m,l,j);}}return e}function qo(e,t){return o(e,t)?{h:2,v:2}:{h:0,v:0}}function bt(e,t){let n=qo(e,t),o=h$1(e,t)?i$4(e,t):0;return n.h+o}function Xo(e,t){let n=qo(e,t),o=h$1(e,t)?j$2(e,t):0;return n.v+o}function Qo(e,t){if(!l$1(e,t))return bt(e,t);let n=f$3(e,t);if(!n)return bt(e,t);let o=n.split(`
3
+ `),r=0;for(let i of o){let a=b$3(i);a>r&&(r=a);}return r+bt(e,t)}function Zo(e,t,n){if(!l$1(e,t))return Xo(e,t);let o=f$3(e,t),r=bt(e,t),i=n?n-r:void 0,a;return i&&i>0?a=f$4(o,{width:i,wrap:true}).length:a=o.split(`
4
+ `).length,a+Xo(e,t)}function un(e,t){let n=Qo(e,t),o=Zo(e,t,n);return {width:n,height:o}}function lu(e,t){if(!j$1(e,t)||!k$1(e,t))return false;let n=un(e,t),o=e$1.minWidth[t],r=e$1.minHeight[t],i=e$1.maxWidth[t],a=e$1.maxHeight[t],s=Math.min(Math.max(n.width,o),i),l=Math.min(Math.max(n.height,r),a);return e$1.width[t]=s,e$1.height[t]=l,true}function uu(e,t){if(!k$1(e,t))return;let n=un(e,t),o=e$1.minWidth[t],r=e$1.minHeight[t],i=e$1.maxWidth[t],a=e$1.maxHeight[t];return {width:Math.min(Math.max(n.width,o),i),height:Math.min(Math.max(n.height,r),a)}}var te={TERMINAL_TOO_SMALL:"terminal-too-small",UNSUPPORTED_CAPABILITY:"unsupported-capability",DEPRECATED_API:"deprecated-api",PERFORMANCE_ISSUE:"performance-issue"},er=z.object({width:z.number().int().nonnegative(),height:z.number().int().nonnegative(),minWidth:z.number().int().positive(),minHeight:z.number().int().positive()}),tr=z.object({capability:z.string(),fallback:z.string().optional()}),nr=z.object({api:z.string(),replacement:z.string(),since:z.string()}),or=z.object({metric:z.string(),value:z.number(),threshold:z.number(),frameTime:z.number().optional()}),ze=z.object({type:z.enum([te.TERMINAL_TOO_SMALL,te.UNSUPPORTED_CAPABILITY,te.DEPRECATED_API,te.PERFORMANCE_ISSUE]),message:z.string(),metadata:z.union([er,tr,nr,or]),timestamp:z.number()});function cu(){return a$3()}function du(e,t,n,o,r){let i={width:t,height:n,minWidth:o,minHeight:r},a={type:te.TERMINAL_TOO_SMALL,message:`Terminal size (${t}x${n}) is smaller than recommended (${o}x${r})`,metadata:i,timestamp:Date.now()};e.emit("warning",ze.parse(a));}function fu(e,t,n){let o={capability:t,fallback:n},r={type:te.UNSUPPORTED_CAPABILITY,message:`Terminal capability '${t}' is not supported${n?`. ${n}`:""}`,metadata:o,timestamp:Date.now()};e.emit("warning",ze.parse(r));}function pu(e,t,n,o){let r={api:t,replacement:n,since:o},i={type:te.DEPRECATED_API,message:`API '${t}' is deprecated since ${o}. Use '${n}' instead.`,metadata:r,timestamp:Date.now()};e.emit("warning",ze.parse(i));}function mu(e,t,n,o,r){let i={metric:t,value:n,threshold:o,frameTime:r},a={type:te.PERFORMANCE_ISSUE,message:`Performance issue: ${t} (${n.toFixed(2)}) exceeds threshold (${o.toFixed(2)})`,metadata:i,timestamp:Date.now()};e.emit("warning",ze.parse(a));}export{lo as $,Er as $a,ki as $b,vs as $c,wo as $d,cu as $e,zn as A,Bn as Aa,ot as Ab,da as Ac,Xs as Ad,Fl as Ae,Lt as B,Wn as Ba,Nt as Bb,fa as Bc,qs as Bd,Nl as Be,nt as C,Mn as Ca,Xr as Cb,pa as Cc,Qs as Cd,Ul as Ce,Vn as D,ir as Da,qr as Db,ma as Dc,Do as Dd,_l as De,Hr as E,ar as Ea,Qr as Eb,ya as Ec,Zs as Ed,zl as Ee,jr as F,wn as Fa,Zr as Fb,ga as Fc,el as Fd,Vl as Fe,Gr as G,kt as Ga,ei as Gb,io as Gc,tl as Gd,Jl as Ge,Kt as H,Ln as Ha,ti as Hb,ao as Hc,nl as Hd,$l as He,Yr as I,lr as Ia,ni as Ib,ba as Ic,ol as Id,Xl as Ie,E as J,ur as Ja,oi as Jb,so as Jc,rl as Jd,ql as Je,Ca as K,At as Ka,Jn as Kb,Ea as Kc,To as Kd,tu as Ke,Da as L,Kn as La,ri as Lb,xa as Lc,il as Ld,nu as Le,Pa as M,On as Ma,ii as Mb,Sa as Mc,al as Md,ru as Me,Ta as N,Fn as Na,ai as Nb,fo as Nc,ko as Nd,iu as Ne,ka as O,cr as Oa,rt as Ob,po as Oc,sl as Od,au as Oe,Aa as P,dr as Pa,$n as Pb,us as Pc,ll as Pd,su as Pe,Ra as Q,fr as Qa,si as Qb,cs as Qc,ul as Qd,Qo as Qe,Ia as R,Rt as Ra,li as Rb,yo as Rc,cl as Rd,Zo as Re,Ba as S,It as Sa,ui as Sb,fs as Sc,dl as Sd,un as Se,Yt as T,q as Ta,at as Tb,ps as Tc,fl as Td,lu as Te,Wa as U,pr as Ua,Ei as Ub,bo as Uc,Ro as Ud,uu as Ue,Ma as V,Bt as Va,xi as Vb,ho as Vc,pl as Vd,te as Ve,Ce as W,Wt as Wa,Si as Wb,ms as Wc,Io as Wd,er as We,wa as X,mr as Xa,Ci as Xb,ys as Xc,ml as Xd,tr as Xe,La as Y,br as Ya,Di as Yb,gs as Yc,Bo as Yd,nr as Ye,Ka as Z,hr as Za,Pi as Zb,bs as Zc,Wo as Zd,or as Ze,Oa as _,vr as _a,Ti as _b,hs as _c,Mo as _d,ze as _e,Q as a,Fa as aa,xr as ab,Ai as ac,Es as ad,Lo as ae,du as af,_t as b,Na as ba,Sr as bb,Se as bc,xs as bd,yl as be,fu as bf,Ri as c,Ua as ca,Cr as cb,Xi as cc,Ss as cd,gl as ce,pu as cf,Ii as d,uo as da,re as db,qi as dc,Cs as dd,bl as de,mu as df,Bi as e,_a as ea,D as eb,Qi as ec,Ds as ed,hl as ee,Wi as f,za as fa,Pr as fb,Zi as fc,Ps as fd,vl as fe,Mi as g,Va as ga,Tr as gb,Qn as gc,Ts as gd,El as ge,wi as h,Ha as ha,Ze as hb,Zn as hc,ks as hd,xl as he,zt as i,ja as ia,kr as ib,ut as ic,As as id,Sl as ie,Li as j,Ga as ja,Ar as jb,eo as jc,qt as jd,Cl as je,Ki as k,Ya as ka,Ke as kb,to as kc,Rs as kd,Dl as ke,Oi as l,Ja as la,Rr as lb,ct as lc,Is as ld,Pl as le,Fi as m,$a as ma,Ir as mb,na as mc,Bs as md,Tl as me,Ni as n,Te as na,Br as nb,no as nc,Ws as nd,kl as ne,Ui as o,Xa as oa,et as ob,dt as oc,Ls as od,mt as oe,_i as p,qa as pa,Wr as pb,oo as pc,Ks as pd,Rl as pe,Xn as q,Ue as qa,Mr as qb,oa as qc,Os as qd,on as qe,qn as r,$t as ra,wr as rb,ra as rc,Fs as rd,Il as re,zi as s,es as sa,Kr as sb,ia as sc,Ns as sd,Bl as se,Vi as t,ts as ta,Or as tb,aa as tc,xo as td,Wl as te,Hi as u,ns as ua,Fr as ub,sa as uc,Us as ud,Ml as ue,ji as v,os as va,Nr as vb,la as vc,Zt as vd,wl as ve,Gi as w,rs as wa,Ur as wb,ua as wc,Ys as wd,Oo as we,Yi as x,is as xa,_r as xb,ca as xc,Co as xd,Ll as xe,Ji as y,as as ya,zr as yb,jt as yc,Js as yd,Kl as ye,tt as z,In as za,Jr as zb,Gt as zc,$s as zd,Ol as ze};
File without changes
@@ -0,0 +1 @@
1
+ import {f as f$1,c as c$1,e}from'./chunk-4LWWONFK.js';import {a}from'./chunk-C5PCEQ6G.js';import {a as a$1}from'./chunk-7ZFQO3OQ.js';var s="\x1B[",c={RESET:0,BOLD:1,DIM:2,ITALIC:3,UNDERLINE:4,BLINK:5,INVERSE:7,HIDDEN:8,STRIKETHROUGH:9,FG_256:38,BG_256:48};function v(){return {lastX:-1,lastY:-1,lastFg:-1,lastBg:-1,lastAttrs:-1,alternateScreen:false,mouseTracking:false,mouseMode:null,syncOutput:false,bracketedPaste:false,focusReporting:false}}function x(t){return a$1(t,"output:colorCache")}function b(...t){return `${s}${t.join(";")}m`}function E(t,e){return `${s}${e+1};${t+1}H`}function B(t){return `${s}${t+1}G`}function D(t){return t===1?`${s}C`:`${s}${t}C`}function $(t){return {a:t>>>24&255,r:t>>>16&255,g:t>>>8&255,b:t&255}}function I(t,e){let n=e|4294967296,r=x(t).get(n);if(r!==void 0)return r;let{r:o,g:l,b:i,a:p}=$(e),d=p===0?b(39):b(c.FG_256,2,o,l,i);return x(t).set(n,d),d}function T(t,e){let n=x(t).get(e);if(n!==void 0)return n;let{r,g:o,b:l,a:i}=$(e),p=i===0?b(49):b(c.BG_256,2,r,o,l);return x(t).set(e,p),p}function A(t){let e=[];return t===a.NONE||(t&a.BOLD&&e.push(c.BOLD),t&a.DIM&&e.push(c.DIM),t&a.ITALIC&&e.push(c.ITALIC),t&a.UNDERLINE&&e.push(c.UNDERLINE),t&a.BLINK&&e.push(c.BLINK),t&a.INVERSE&&e.push(c.INVERSE),t&a.HIDDEN&&e.push(c.HIDDEN),t&a.STRIKETHROUGH&&e.push(c.STRIKETHROUGH),e.length===0)?"":b(...e)}function R(t,e,n){if(t.lastX===e&&t.lastY===n)return "";if(t.lastY===n){let r=e-t.lastX;return r===1?"":r>0&&r<=4?D(r):B(e)}return E(e,n)}function N(t,e,n){let r="";return e.lastAttrs!==-1&&e.lastAttrs!==a.NONE&&n.attrs===a.NONE&&(r+=b(c.RESET),e.lastFg=-1,e.lastBg=-1,e.lastAttrs=-1),n.attrs!==e.lastAttrs&&n.attrs!==a.NONE?(e.lastAttrs!==-1&&e.lastAttrs!==a.NONE&&(r+=b(c.RESET),e.lastFg=-1,e.lastBg=-1),r+=A(n.attrs),e.lastAttrs=n.attrs):n.attrs===a.NONE&&e.lastAttrs===-1&&(e.lastAttrs=a.NONE),n.fg!==e.lastFg&&(r+=I(t,n.fg),e.lastFg=n.fg),n.bg!==e.lastBg&&(r+=T(t,n.bg),e.lastBg=n.bg),r}function k(t,e,n){let{x:r,y:o,cell:l}=n,i="";return i+=R(e,r,o),i+=N(t,e,l),i+=l.char,e.lastX=r+1,e.lastY=o,i}function W(t,e){if(e)return t;let n=Array.from(t);return n.sort((r,o)=>r.y!==o.y?r.y-o.y:r.x-o.x),n}function M(t,e){let n=e+1;for(;n<t.length;){let r=t[n],o=t[n-1];if(!r||!o||!(r.y===o.y&&r.x===o.x+1&&r.cell.fg===o.cell.fg&&r.cell.bg===o.cell.bg&&r.cell.attrs===o.cell.attrs))break;n++;}return n}function F(t,e,n,r,o,l){let i=n[r];if(i){l.push(R(e,i.x,i.y)),l.push(N(t,e,i.cell));for(let p=r;p<o;p++){let d=n[p];d&&l.push(d.cell.char);}e.lastX=i.x+(o-r),e.lastY=i.y;}}function H(t,e,n,r=false){if(n.length===0)return "";let o=[],l=W(n,r),i=0;for(;i<l.length&&l[i];){let p=M(l,i);if(p-i===1){let d=l[i];d&&o.push(k(t,e,d));}else F(t,e,l,i,p,o);i=p;}return o.join("")}var S=null,m=null,g=null;function J(t){m=t;}function z(){return m}function Q(){m=null;}function Z(t){g=t;}function tt(){return g}function et(){g=null;}function f(){return S||(S=v()),S}function nt(){S=v();}var L=t=>{if(!m||!g)return t;let e$1=f(),n=g.fullRedraw,r=f$1(g);if(r.length===0)return c$1(g),e(g),t;let o=H(t,e$1,r,n);return o.length>0&&m.write(o),c$1(g),e(g),t};function rt(){return L}function u(t){m&&m.write(t);}function ot(){u(`${s}?25l`);}function P(){u(`${s}?25h`);}function ut(){u(`${s}?1049h`);let t=f();t.alternateScreen=true;}function G(){u(`${s}?1049l`);let t=f();t.alternateScreen=false;}function st(){u(`${s}2J`);}function X(){u(`${s}H`);let t=f();t.lastX=0,t.lastY=0;}function Y(){u(b(c.RESET));let t=f();t.lastFg=-1,t.lastBg=-1,t.lastAttrs=-1;}function it(){u("\x07");}function lt(t,e){u(E(t,e));let n=f();n.lastX=t,n.lastY=e;}function at(t="any"){let e=f();u(`${s}?1006h`),u(t==="normal"?`${s}?1000h`:t==="button"?`${s}?1002h`:`${s}?1003h`),e.mouseTracking=true,e.mouseMode=t;}function K(){let t=f();u(`${s}?1000l`),u(`${s}?1002l`),u(`${s}?1003l`),u(`${s}?1006l`),t.mouseTracking=false,t.mouseMode=null;}function ft(t){u(`${s}${t==="block"?2:t==="underline"?4:6} q`);}function ct(t){u(`\x1B]2;${t}\x07`);}function pt(){u(`${s}?2026h`);let t=f();t.syncOutput=true;}function U(){u(`${s}?2026l`);let t=f();t.syncOutput=false;}function gt(){u("\x1B7");}function dt(){u("\x1B8");}function bt(){u(`${s}?2004h`);let t=f();t.bracketedPaste=true;}function q(){u(`${s}?2004l`);let t=f();t.bracketedPaste=false;}function mt(){u(`${s}?1004h`);let t=f();t.focusReporting=true;}function w(){u(`${s}?1004l`);let t=f();t.focusReporting=false;}function St(){let t=f();t.bracketedPaste&&q(),t.focusReporting&&w(),t.mouseTracking&&K(),t.syncOutput&&U(),t.alternateScreen&&G(),Y(),P(),X();}export{pt as A,U as B,gt as C,dt as D,bt as E,q as F,mt as G,w as H,St as I,v as a,H as b,J as c,z as d,Q as e,Z as f,tt as g,et as h,f as i,nt as j,L as k,rt as l,u as m,ot as n,P as o,ut as p,G as q,st as r,X as s,Y as t,it as u,lt as v,at as w,K as x,ft as y,ct as z};
@@ -0,0 +1 @@
1
+ import {G as G$1,L as L$1}from'./chunk-JB5KFQPD.js';import {l as l$1}from'./chunk-Z4EZERNE.js';import {m as m$1,l}from'./chunk-7ZFQO3OQ.js';var g=1e4,w=1,c={sheets:new Map,nameToId:new Map};function Q(){c.sheets.clear(),c.nameToId.clear(),w=1;}function X(t){let n=w++,e=t.frames[0],a=t.height??e?.length??0,u=t.width??e?.[0]?.length??0,y={id:n,name:t.name,frames:t.frames,width:u,height:a};return c.sheets.set(n,y),c.nameToId.set(t.name,n),n}function F(t){return c.sheets.get(t)}function Z(t){let n=c.nameToId.get(t);if(n!==void 0)return c.sheets.get(n)}function R(t){return c.nameToId.get(t)}function $(t){let n=c.sheets.get(t);return n?(c.nameToId.delete(n.name),c.sheets.delete(t),true):false}var m={frameIndex:new Uint16Array(g),frameCount:new Uint16Array(g),frameWidth:new Uint8Array(g),frameHeight:new Uint8Array(g),spriteSheetId:new Uint32Array(g)};function V(t,n,e,a=0){let u=F(e);if(u)return m$1(t,n,m)||l(t,n,m),m.spriteSheetId[n]=e,m.frameCount[n]=u.frames.length,m.frameWidth[n]=u.width,m.frameHeight[n]=u.height,m.frameIndex[n]=Math.min(a,u.frames.length-1),n}function nn(t,n,e,a=0){let u=R(e);if(u!==void 0)return V(t,n,u,a)}function tn(t,n){if(m$1(t,n,m))return {frameIndex:m.frameIndex[n],frameCount:m.frameCount[n],frameWidth:m.frameWidth[n],frameHeight:m.frameHeight[n],spriteSheetId:m.spriteSheetId[n]}}function en(t,n){if(!m$1(t,n,m))return;let e=m.spriteSheetId[n],a=F(e);if(!a)return;let u=m.frameIndex[n];return a.frames[u]}function W(t,n,e){if(!m$1(t,n,m))return n;let a=m.frameCount[n],u=Math.max(0,Math.min(e,a-1));return m.frameIndex[n]=u,n}function rn(t,n){if(!m$1(t,n,m))return n;let e=m.frameCount[n],a=m.frameIndex[n];return m.frameIndex[n]=(a+1)%e,n}function on(t,n){if(!m$1(t,n,m))return n;let e=m.frameCount[n],a=m.frameIndex[n];return m.frameIndex[n]=a===0?e-1:a-1,n}function an(t,n){return m$1(t,n,m)}function mn(t,n){if(!m$1(t,n,m))return;let e=m.spriteSheetId[n];return F(e)}function un(t,n){return m$1(t,n,m)&&(m.spriteSheetId[n]=0,m.frameIndex[n]=0,m.frameCount[n]=0,m.frameWidth[n]=0,m.frameHeight[n]=0),n}var x=1e4,M=1,p={animations:new Map,nameToId:new Map};function yn(){p.animations.clear(),p.nameToId.clear(),M=1;}function ln(t){l$1.parse(t);let n=M++,e=t.frames.reduce((u,y)=>u+y.duration,0),a={id:n,name:t.name,frames:t.frames,totalDuration:e};return p.animations.set(n,a),p.nameToId.set(t.name,n),n}function D(t){return p.animations.get(t)}function xn(t){let n=p.nameToId.get(t);if(n!==void 0)return p.animations.get(n)}function U(t){return p.nameToId.get(t)}function bn(t){let n=p.animations.get(t);return n?(p.nameToId.delete(n.name),p.animations.delete(t),true):false}var P=(e=>(e[e.FORWARD=1]="FORWARD",e[e.REVERSE=-1]="REVERSE",e))(P||{}),r={animationId:new Uint32Array(x),playing:new Uint8Array(x),loop:new Uint8Array(x),speed:new Float32Array(x),elapsed:new Float32Array(x),currentFrameIndex:new Uint16Array(x),direction:new Int8Array(x)};function B(t){r.animationId[t]=0,r.playing[t]=0,r.loop[t]=1,r.speed[t]=1,r.elapsed[t]=0,r.currentFrameIndex[t]=0,r.direction[t]=1;}function H(t,n,e,a={}){let u=D(e);if(!u||u.frames.length===0)return;m$1(t,n,r)||(l(t,n,r),B(n));let{loop:y=true,speed:I=1,direction:A=1,startFrame:h}=a,l$1=h;l$1===void 0&&(l$1=A===1?0:u.frames.length-1),l$1=Math.max(0,Math.min(l$1,u.frames.length-1)),r.animationId[n]=e,r.playing[n]=1,r.loop[n]=y?1:0,r.speed[n]=I,r.elapsed[n]=0,r.currentFrameIndex[n]=l$1,r.direction[n]=A;let b=u.frames[l$1];return b&&m$1(t,n,m)&&W(t,n,b.frameIndex),n}function dn(t,n,e,a={}){let u=U(e);if(u!==void 0)return H(t,n,u,a)}function En(t,n){return m$1(t,n,r)&&(r.playing[n]=0,r.elapsed[n]=0,r.currentFrameIndex[n]=0),n}function An(t,n){return m$1(t,n,r)&&(r.playing[n]=0),n}function hn(t,n){return m$1(t,n,r)&&(r.playing[n]=1),n}function gn(t,n){if(m$1(t,n,r))return {animationId:r.animationId[n],playing:r.playing[n]===1,loop:r.loop[n]===1,speed:r.speed[n],elapsed:r.elapsed[n],currentFrameIndex:r.currentFrameIndex[n],direction:r.direction[n]}}function Sn(t,n){return m$1(t,n,r)?r.playing[n]===1:false}function In(t,n){return m$1(t,n,r)}function Fn(t,n,e){return m$1(t,n,r)&&(r.speed[n]=e),n}function Wn(t,n,e){return m$1(t,n,r)&&(r.loop[n]=e?1:0),n}function Dn(t,n,e){return m$1(t,n,r)&&(r.direction[n]=e),n}function Cn(t,n){if(!m$1(t,n,r))return;let e=r.animationId[n];return D(e)}function vn(t,n){return m$1(t,n,r)&&(r.animationId[n]=0,r.playing[n]=0,r.loop[n]=1,r.speed[n]=1,r.elapsed[n]=0,r.currentFrameIndex[n]=0,r.direction[n]=1),n}function N(t,n,e,a){return n>=e?a?(r.currentFrameIndex[t]=0,false):(r.playing[t]=0,r.currentFrameIndex[t]=e-1,true):(r.currentFrameIndex[t]=n,false)}function L(t,n,e,a){return n<0?a?(r.currentFrameIndex[t]=e-1,false):(r.playing[t]=0,r.currentFrameIndex[t]=0,true):(r.currentFrameIndex[t]=n,false)}function Y(t,n,e){let a=r.currentFrameIndex[n],u=e[a];u&&m$1(t,n,m)&&W(t,n,u.frameIndex);}function On(t,n,e){if(!m$1(t,n,r)||r.playing[n]!==1)return false;let a=r.animationId[n],u=D(a);if(!u||u.frames.length===0)return false;let y=r.speed[n],I=r.direction[n],A=r.loop[n]===1,h=r.elapsed[n]+e*y;r.elapsed[n]=h;let l=r.currentFrameIndex[n],b=u.frames[l];if(!b||h<b.duration)return false;r.elapsed[n]=h-b.duration;let C=l+I,v=I===1?N(n,C,u.frames.length,A):L(n,C,u.frames.length,A);return v||Y(t,n,u.frames),v}var E=1e4,o={x:new Float32Array(E),y:new Float32Array(E),maxSpeed:new Float32Array(E),friction:new Float32Array(E)};function S(t){o.x[t]=0,o.y[t]=0,o.maxSpeed[t]=0,o.friction[t]=0;}function Rn(t,n,e,a){return m$1(t,n,o)||(l(t,n,o),S(n)),o.x[n]=e,o.y[n]=a,n}function Vn(t,n,e){return m$1(t,n,o)||(l(t,n,o),S(n)),e.x!==void 0&&(o.x[n]=e.x),e.y!==void 0&&(o.y[n]=e.y),e.maxSpeed!==void 0&&(o.maxSpeed[n]=e.maxSpeed),e.friction!==void 0&&(o.friction[n]=e.friction),n}function Un(t,n){if(m$1(t,n,o))return {x:o.x[n],y:o.y[n],maxSpeed:o.maxSpeed[n],friction:o.friction[n]}}function _(t,n){return m$1(t,n,o)}function Pn(t,n,e){return m$1(t,n,o)||(l(t,n,o),S(n)),o.maxSpeed[n]=e,n}function Bn(t,n,e){return m$1(t,n,o)||(l(t,n,o),S(n)),o.friction[n]=Math.max(0,Math.min(1,e)),n}function Hn(t,n,e,a){return m$1(t,n,o)||(l(t,n,o),S(n)),o.x[n]=o.x[n]+e,o.y[n]=o.y[n]+a,n}function Nn(t,n){if(!m$1(t,n,o))return 0;let e=o.x[n],a=o.y[n];return Math.sqrt(e*e+a*a)}function Ln(t,n){return m$1(t,n,o)&&(o.x[n]=0,o.y[n]=0),n}function Yn(t,n){return m$1(t,n,o)&&(o.x[n]=0,o.y[n]=0,o.maxSpeed[n]=0,o.friction[n]=0),n}var f={x:new Float32Array(E),y:new Float32Array(E)};function q(t){f.x[t]=0,f.y[t]=0;}function _n(t,n,e,a){return m$1(t,n,f)||(l(t,n,f),q(n)),f.x[n]=e,f.y[n]=a,n}function qn(t,n){if(m$1(t,n,f))return {x:f.x[n],y:f.y[n]}}function j(t,n){return m$1(t,n,f)}function jn(t,n){return m$1(t,n,f)&&(f.x[n]=0,f.y[n]=0),n}function kn(t,n){return m$1(t,n,f)&&(f.x[n]=0,f.y[n]=0),n}function k(t,n){f.x[t]===void 0||o.x[t]===void 0||(o.x[t]=o.x[t]+f.x[t]*n,o.y[t]=o.y[t]+f.y[t]*n);}function z(t,n){let e=o.friction[t];if(e<=0)return;let a=1-e*n;if(a<=0){o.x[t]=0,o.y[t]=0;return}o.x[t]=o.x[t]*a,o.y[t]=o.y[t]*a;}function G(t){let n=o.maxSpeed[t];if(n<=0)return;let e=o.x[t],a=o.y[t],u=Math.sqrt(e*e+a*a);if(u>n){let y=n/u;o.x[t]=e*y,o.y[t]=a*y;}}function J(t,n){G$1.x[t]===void 0||o.x[t]===void 0||(G$1.x[t]=G$1.x[t]+o.x[t]*n,G$1.y[t]=G$1.y[t]+o.y[t]*n);}function zn(t,n,e){_(t,n)&&(j(t,n)&&k(n,e),z(n,e),G(n),L$1(t,n)&&J(n,e));}export{_n as $,r as A,H as B,dn as C,En as D,An as E,hn as F,gn as G,Sn as H,In as I,Fn as J,Wn as K,Dn as L,Cn as M,vn as N,On as O,o as P,Rn as Q,Vn as R,Un as S,_ as T,Pn as U,Bn as V,Hn as W,Nn as X,Ln as Y,Yn as Z,f as _,c as a,qn as aa,Q as b,j as ba,X as c,jn as ca,F as d,kn as da,Z as e,k as ea,R as f,z as fa,$ as g,G as ga,m as h,J as ha,V as i,zn as ia,nn as j,tn as k,en as l,W as m,rn as n,on as o,an as p,mn as q,un as r,p as s,yn as t,ln as u,D as v,xn as w,U as x,bn as y,P as z};
@@ -0,0 +1 @@
1
+ import {d,f}from'./chunk-M5FXA5FL.js';import {G as G$1,L,e,k as k$1,K as K$1,a as a$1,d as d$1,c}from'./chunk-JB5KFQPD.js';import {k,i,a,f as f$1}from'./chunk-LIVVHEOU.js';import {m,o as o$1,l}from'./chunk-7ZFQO3OQ.js';var p=1e4,o={x:new Float32Array(p),y:new Float32Array(p),width:new Float32Array(p),height:new Float32Array(p),valid:new Uint8Array(p)};function A(n,t){if(m(n,t,o)&&o.valid[t]===1)return {x:o.x[t],y:o.y[t],width:o.width[t],height:o.height[t]}}function nt(n,t){return m(n,t,o)&&o.valid[t]===1}function et(n,t){m(n,t,o)&&(o.valid[t]=0);}function z(n,t){m(n,t,o)||(l(n,t,o),o.x[t]=0,o.y[t]=0,o.width[t]=0,o.height[t]=0,o.valid[t]=0);}function x(n){if(!d(n))return {width:80,height:24};let t=f(n);return !t||!k$1(n,t)?{width:80,height:24}:{width:e.width[t],height:e.height[t]}}function I(n,t,e,i,s){let r;if(n===a$1)r=e;else if(d$1(n)){let u=c(n);r=u!==null?u/100*t:0;}else r=n;return r=Math.max(i,r),Number.isFinite(s)&&(r=Math.min(s,r)),Math.floor(r)}function U(n,t,e$1,i,s,r){z(n,t);let u=L(n,t)?G$1.x[t]:0,m=L(n,t)?G$1.y[t]:0,a=K$1(n,t),f,y;a?(f=u,y=m):(f=e$1+u,y=i+m);let l=0,g=0;if(k$1(n,t)){let _=e.width[t],k=e.height[t],O=e.minWidth[t],q=e.minHeight[t],B=e.maxWidth[t],R=e.maxHeight[t],S=e.shrink[t]===1,X=S?0:s,j=S?0:r;l=I(_,s,X,O,B),g=I(k,r,j,q,R);}a||(f+l>e$1+s&&(l=Math.max(0,e$1+s-f)),y+g>i+r&&(g=Math.max(0,i+r-y))),o.x[t]=f,o.y[t]=y,o.width[t]=l,o.height[t]=g,o.valid[t]=1;}function Y(n,t,e,i,s,r){U(n,t,e,i,s,r);let u=A(n,t);if(!u)return;let m=f$1(n,t);for(let a of m)Y(n,a,u.x,u.y,u.width,u.height);}function G(n){let t=o$1(n,[G$1]),e=[];for(let i$1 of t)k(n,i$1)?i(n,i$1)===a&&e.push(i$1):e.push(i$1);return e}var J=n=>{let t=x(n),e=G(n);for(let i of e)Y(n,i,0,0,t.width,t.height);return n};function ot(){return J}function rt(n){let t=o$1(n,[G$1]);for(let e of t)m(n,e,o)&&(o.valid[e]=0);}function K(n,t){if(!L(n,t))return;let e=0,i$1=0,s,r;if(k(n,t)){let u=i(n,t);if(u!==a){let m=K(n,u);if(m)e=m.x,i$1=m.y,s=m.width,r=m.height;else {let a=x(n);s=a.width,r=a.height;}}else {let m=x(n);s=m.width,r=m.height;}}else {let u=x(n);s=u.width,r=u.height;}return U(n,t,e,i$1,s,r),A(n,t)}function it(n,t){let e=A(n,t);if(e)return {left:e.x,top:e.y,right:e.x+e.width-1,bottom:e.y+e.height-1}}export{o as a,A as b,nt as c,et as d,J as e,ot as f,rt as g,K as h,it as i};
@@ -0,0 +1 @@
1
+ import {j}from'./chunk-FUW7OD3H.js';import {z as z$1}from'zod';function y(e,r){let t=e.r-r.r,o=e.g-r.g,n=e.b-r.b;return t*t+o*o+n*n}function b(e,r={}){let{distance:t=y,palette:o=j,indices:n}=r,a=0,l=Number.POSITIVE_INFINITY;for(let g=0;g<o.length;g++){let d=o[g];if(!d)continue;let c=t(e,d);if(c<l&&(l=c,a=n?n[g]??g:g),c===0)break}return a}function f(e=1024){let r=new Map;function t(o){return o.r<<16|o.g<<8|o.b}return {get(o){let n=t(o),a=r.get(n);return a!==void 0&&(r.delete(n),r.set(n,a)),a},set(o,n){let a=t(o);if(r.has(a)&&r.delete(a),r.size>=e){let l=r.keys().next().value;l!==void 0&&r.delete(l);}r.set(a,n);},clear(){r.clear();},get size(){return r.size}}}var h=f(4096);function B(e,r){if(!r||r.distance===void 0&&r.palette===void 0){let t=h.get(e);if(t!==void 0)return t;let o=b(e,r);return h.set(e,o),o}return b(e,r)}j.slice(232,256);Array.from({length:24},(e,r)=>232+r);j.slice(16,232);Array.from({length:216},(e,r)=>16+r);j.slice(0,16);Array.from({length:16},(e,r)=>r);var i={black:0,red:1,green:2,yellow:3,blue:4,magenta:5,cyan:6,white:7,lightblack:8,lightred:9,lightgreen:10,lightyellow:11,lightblue:12,lightmagenta:13,lightcyan:14,lightwhite:15,brightblack:8,brightred:9,brightgreen:10,brightyellow:11,brightblue:12,brightmagenta:13,brightcyan:14,brightwhite:15,darkred:1,darkgreen:2,darkyellow:3,darkblue:4,darkmagenta:5,darkcyan:6,darkgray:8,darkgrey:8,gray:8,grey:8,silver:7,maroon:1,olive:3,navy:4,purple:5,teal:6,aqua:14,lime:10,fuchsia:13,orange:208},m={grey:"gray",lightgrey:"lightblack",lightgray:"lightblack",darkgrey:"darkgray",bright:"light",hi:"light",crimson:"red",scarlet:"red",vermillion:"red",emerald:"green",forest:"green",azure:"blue",cobalt:"blue",indigo:"blue",violet:"magenta",pink:"lightmagenta",gold:"yellow",brown:"maroon",colour:"color"},w=new Map([[0,"black"],[1,"red"],[2,"green"],[3,"yellow"],[4,"blue"],[5,"magenta"],[6,"cyan"],[7,"white"],[8,"gray"],[9,"brightred"],[10,"brightgreen"],[11,"brightyellow"],[12,"brightblue"],[13,"brightmagenta"],[14,"brightcyan"],[15,"brightwhite"],[208,"orange"]]),C=Object.keys(i),D=z$1.string().transform(e=>e.toLowerCase().trim()).refine(e=>C.includes(e)||e==="default"||e==="transparent"||e==="inherit",{message:"Invalid color name"});function R(e){let r=e.toLowerCase().trim();if(r in i)return i[r]??null;let t=m[r];if(t&&t in i)return i[t]??null;if(r==="default"||r==="transparent"||r==="inherit")return null;let o=r.split(/[-_\s]+/);if(o.length===2){let n=o[0],a=o[1];if(n&&a){let l=n+a;if(l in i)return i[l]??null}}return null}function M(e){return w.get(e)??null}function I(e){let r=e.toLowerCase().trim();return r in i||r in m||r==="default"||r==="transparent"||r==="inherit"}function T(e){let r=e.toLowerCase().trim();return r==="default"||r==="transparent"||r==="inherit"}var p={indianred:{r:205,g:92,b:92},lightcoral:{r:240,g:128,b:128},salmon:{r:250,g:128,b:114},darksalmon:{r:233,g:150,b:122},lightsalmon:{r:255,g:160,b:122},crimson:{r:220,g:20,b:60},firebrick:{r:178,g:34,b:34},darkred:{r:139,g:0,b:0},pink:{r:255,g:192,b:203},lightpink:{r:255,g:182,b:193},hotpink:{r:255,g:105,b:180},deeppink:{r:255,g:20,b:147},mediumvioletred:{r:199,g:21,b:133},palevioletred:{r:219,g:112,b:147},coral:{r:255,g:127,b:80},tomato:{r:255,g:99,b:71},orangered:{r:255,g:69,b:0},darkorange:{r:255,g:140,b:0},orange:{r:255,g:165,b:0},gold:{r:255,g:215,b:0},lightyellow:{r:255,g:255,b:224},lemonchiffon:{r:255,g:250,b:205},papayawhip:{r:255,g:239,b:213},moccasin:{r:255,g:228,b:181},peachpuff:{r:255,g:218,b:185},palegoldenrod:{r:238,g:232,b:170},khaki:{r:240,g:230,b:140},darkkhaki:{r:189,g:183,b:107},lavender:{r:230,g:230,b:250},thistle:{r:216,g:191,b:216},plum:{r:221,g:160,b:221},violet:{r:238,g:130,b:238},orchid:{r:218,g:112,b:214},mediumorchid:{r:186,g:85,b:211},mediumpurple:{r:147,g:112,b:219},rebeccapurple:{r:102,g:51,b:153},blueviolet:{r:138,g:43,b:226},darkviolet:{r:148,g:0,b:211},darkorchid:{r:153,g:50,b:204},darkmagenta:{r:139,g:0,b:139},indigo:{r:75,g:0,b:130},slateblue:{r:106,g:90,b:205},darkslateblue:{r:72,g:61,b:139},greenyellow:{r:173,g:255,b:47},chartreuse:{r:127,g:255,b:0},lawngreen:{r:124,g:252,b:0},limegreen:{r:50,g:205,b:50},palegreen:{r:152,g:251,b:152},lightgreen:{r:144,g:238,b:144},mediumspringgreen:{r:0,g:250,b:154},springgreen:{r:0,g:255,b:127},mediumseagreen:{r:60,g:179,b:113},seagreen:{r:46,g:139,b:87},forestgreen:{r:34,g:139,b:34},darkgreen:{r:0,g:100,b:0},yellowgreen:{r:154,g:205,b:50},olivedrab:{r:107,g:142,b:35},darkolivegreen:{r:85,g:107,b:47},mediumaquamarine:{r:102,g:205,b:170},darkseagreen:{r:143,g:188,b:143},lightseagreen:{r:32,g:178,b:170},darkcyan:{r:0,g:139,b:139},lightcyan:{r:224,g:255,b:255},paleturquoise:{r:175,g:238,b:238},aquamarine:{r:127,g:255,b:212},turquoise:{r:64,g:224,b:208},mediumturquoise:{r:72,g:209,b:204},darkturquoise:{r:0,g:206,b:209},cadetblue:{r:95,g:158,b:160},steelblue:{r:70,g:130,b:180},lightsteelblue:{r:176,g:196,b:222},powderblue:{r:176,g:224,b:230},lightblue:{r:173,g:216,b:230},skyblue:{r:135,g:206,b:235},lightskyblue:{r:135,g:206,b:250},deepskyblue:{r:0,g:191,b:255},dodgerblue:{r:30,g:144,b:255},cornflowerblue:{r:100,g:149,b:237},royalblue:{r:65,g:105,b:225},mediumblue:{r:0,g:0,b:205},darkblue:{r:0,g:0,b:139},midnightblue:{r:25,g:25,b:112},cornsilk:{r:255,g:248,b:220},blanchedalmond:{r:255,g:235,b:205},bisque:{r:255,g:228,b:196},navajowhite:{r:255,g:222,b:173},wheat:{r:245,g:222,b:179},burlywood:{r:222,g:184,b:135},tan:{r:210,g:180,b:140},rosybrown:{r:188,g:143,b:143},sandybrown:{r:244,g:164,b:96},goldenrod:{r:218,g:165,b:32},darkgoldenrod:{r:184,g:134,b:11},peru:{r:205,g:133,b:63},chocolate:{r:210,g:105,b:30},saddlebrown:{r:139,g:69,b:19},sienna:{r:160,g:82,b:45},brown:{r:165,g:42,b:42},snow:{r:255,g:250,b:250},honeydew:{r:240,g:255,b:240},mintcream:{r:245,g:255,b:250},azure:{r:240,g:255,b:255},aliceblue:{r:240,g:248,b:255},ghostwhite:{r:248,g:248,b:255},whitesmoke:{r:245,g:245,b:245},seashell:{r:255,g:245,b:238},beige:{r:245,g:245,b:220},oldlace:{r:253,g:245,b:230},floralwhite:{r:255,g:250,b:240},ivory:{r:255,g:255,b:240},antiquewhite:{r:250,g:235,b:215},linen:{r:250,g:240,b:230},lavenderblush:{r:255,g:240,b:245},mistyrose:{r:255,g:228,b:225},gainsboro:{r:220,g:220,b:220},lightgray:{r:211,g:211,b:211},lightgrey:{r:211,g:211,b:211},darkgray:{r:169,g:169,b:169},dimgray:{r:105,g:105,b:105},dimgrey:{r:105,g:105,b:105},lightslategray:{r:119,g:136,b:153},lightslategrey:{r:119,g:136,b:153},slategray:{r:112,g:128,b:144},slategrey:{r:112,g:128,b:144},darkslategray:{r:47,g:79,b:79},darkslategrey:{r:47,g:79,b:79}},u=new Map;function z(e){let r=e.toLowerCase().trim(),t=u.get(r);if(t!==void 0)return t;let o=R(r);if(o!==null)return u.set(r,o),o;let n=p[r];if(n){let a=b(n);return u.set(r,a),a}return null}function q(){return C}function P(){return Object.keys(p)}export{b as a,B as b,i as c,m as d,D as e,R as f,M as g,I as h,T as i,p as j,z as k,q as l,P as m};
@@ -0,0 +1,3 @@
1
+ import {b,e as e$1,d as d$1,f as f$3,g}from'./chunk-4EV3YS7F.js';import {e}from'./chunk-JN2OGNK3.js';import {q as q$1,s,v,u,H as H$1,M as M$2,f as f$2,i as i$1}from'./chunk-JB5KFQPD.js';import {M as M$1,f as f$1,d,P,J as J$1}from'./chunk-LIVVHEOU.js';import {i,v as v$1}from'./chunk-7ZFQO3OQ.js';import {readFileSync}from'fs';import {z}from'zod';var N=z.union([z.number(),z.string().regex(/^\d+(\.\d+)?%$/,'Percentage must be in format "50%"'),z.literal("auto")]),f=z.union([z.number(),z.string().regex(/^\d+(\.\d+)?%$/,'Percentage must be in format "50%"'),z.enum(["center","left","right","top","bottom"])]),G=z.object({left:f.optional(),top:f.optional(),right:f.optional(),bottom:f.optional(),width:N.optional(),height:N.optional(),fg:z.union([z.string(),z.number()]).optional(),bg:z.union([z.string(),z.number()]).optional(),text:z.string(),font:z.union([z.string(),b]).optional(),shrink:z.boolean().optional()}),I=1e4,c={isBigText:new Uint8Array(I)},U="terminus-14-bold",T=new Map,a=new Map;function _(t){if(t===void 0)return 0;if(typeof t=="number")return t;switch(t){case "left":case "top":return 0;case "center":return 0;case "right":case "bottom":return 0}return 0}function M(t){return t===void 0||typeof t=="string"&&t==="auto"?"auto":t}async function j(t){return t?typeof t!="string"?t:t==="terminus-14-bold"||t==="terminus-14-normal"?d$1(t):H(t):d$1(U)}function J(t){return t?typeof t!="string"?t:t==="terminus-14-bold"||t==="terminus-14-normal"?e$1(t):T.get(t):e$1(U)}function Y(t,i){let n=" ".repeat(t);return Array.from({length:i},()=>n)}function q(t,i){let n=t.charHeight,r=Array.from({length:n},()=>"");for(let e of Array.from(i)){let u=f$3(t,e)?g(t,e):Y(t.charWidth,t.charHeight);for(let g=0;g<n;g+=1){let O=u[g]??"";r[g]=`${r[g]}${O}`;}}return r}function B(t,i){let n=i.split(`
2
+ `),r=[];for(let e of n)r.push(...q(t,e));return r.join(`
3
+ `)}function H(t){let i=T.get(t);if(i)return i;let n=readFileSync(t,"utf8"),r=JSON.parse(n),e=b.parse(r);return T.set(t,e),e}var dt=H;function K(t,i,n){let r=_(n.left),e=_(n.top);H$1(t,i,r,e);let s=M(n.width),u=M(n.height);f$2(t,i,s,u);let g=n.shrink!==false;i$1(t,i,g);}function Q(t,i,n){n.fg===void 0&&n.bg===void 0||J$1(t,i,{fg:n.fg!==void 0?v$1(n.fg):void 0,bg:n.bg!==void 0?v$1(n.bg):void 0});}async function R(t,i,n){let r=await j(n.font),e$1=B(r,n.text);a.set(i,n.text),e(t,i,e$1);}async function mt(t,i$1,n){let r=G.parse(n),e=i$1;c.isBigText[e]=1,K(t,e,r),Q(t,e,r),await R(t,e,r),q$1(t,e,{focusable:true});let s$1={eid:e,show(){return P(t,e,true),s$1},hide(){return P(t,e,false),s$1},move(u,g){return M$2(t,e,u,g),M$1(t,e),s$1},setPosition(u,g){return H$1(t,e,u,g),M$1(t,e),s$1},setText(u){return Z(t,e,u,r.font),s$1},getText(){return a.get(e)??""},focus(){return u(t,e),s$1},blur(){return v(t,e),s$1},isFocused(){return s(t,e)},append(u){return d(t,e,u),s$1},getChildren(){return f$1(t,e)},destroy(){c.isBigText[e]=0,a.delete(e),i(t,e);}};return s$1}function X(t,i,n,r){let e$1=J(r);if(e$1){let s=B(e$1,n);a.set(i,n),e(t,i,s),M$1(t,i);return}j(r).then(s=>{let u=B(s,n);a.set(i,n),e(t,i,u),M$1(t,i);});}function Z(t,i,n,r){return X(t,i,n,r),i}function ft(t,i){return c.isBigText[i]===1}function ct(){c.isBigText.fill(0),a.clear();}export{G as a,c as b,H as c,dt as d,mt as e,X as f,ft as g,ct as h};
@@ -0,0 +1 @@
1
+ import {b as b$1,i}from'./chunk-LIVVHEOU.js';import {c,e,a,b}from'./chunk-Z4EZERNE.js';import {m as m$1,l}from'./chunk-7ZFQO3OQ.js';var E=1e4,y=-1;function Z(t){return -(t+2)}function S(t){if(t>=y)return null;let n=-(t+2);return n===0?0:n}function w(t){return t<y}var u={width:new Float32Array(E),height:new Float32Array(E),minWidth:new Float32Array(E),minHeight:new Float32Array(E),maxWidth:new Float32Array(E),maxHeight:new Float32Array(E),shrink:new Uint8Array(E)};function O(t){if(t==="auto")return y;if(typeof t=="string"){let n=Number.parseFloat(t);return Z(n)}return t}function L(t,n,e,r){return c.parse(e),c.parse(r),m$1(t,n,u)||(l(t,n,u),u.minWidth[n]=0,u.minHeight[n]=0,u.maxWidth[n]=Number.POSITIVE_INFINITY,u.maxHeight[n]=Number.POSITIVE_INFINITY,u.shrink[n]=0),u.width[n]=O(e),u.height[n]=O(r),n}function I(t,n){if(m$1(t,n,u))return {width:u.width[n],height:u.height[n],minWidth:u.minWidth[n],minHeight:u.minHeight[n],maxWidth:u.maxWidth[n],maxHeight:u.maxHeight[n],shrink:u.shrink[n]===1}}function K(t,n,e$1){return e.parse(e$1),m$1(t,n,u)||(l(t,n,u),u.width[n]=y,u.height[n]=y,u.minWidth[n]=0,u.minHeight[n]=0,u.maxWidth[n]=Number.POSITIVE_INFINITY,u.maxHeight[n]=Number.POSITIVE_INFINITY,u.shrink[n]=0),e$1.minWidth!==void 0&&(u.minWidth[n]=e$1.minWidth),e$1.minHeight!==void 0&&(u.minHeight[n]=e$1.minHeight),e$1.maxWidth!==void 0&&(u.maxWidth[n]=e$1.maxWidth),e$1.maxHeight!==void 0&&(u.maxHeight[n]=e$1.maxHeight),n}function G(t,n,e){return m$1(t,n,u)||(l(t,n,u),u.width[n]=y,u.height[n]=y,u.minWidth[n]=0,u.minHeight[n]=0,u.maxWidth[n]=Number.POSITIVE_INFINITY,u.maxHeight[n]=Number.POSITIVE_INFINITY),u.shrink[n]=e?1:0,n}function R(t,n){return m$1(t,n,u)?u.shrink[n]===1:false}function $(t,n){return m$1(t,n,u)}function j(t,n,e){if(!m$1(t,n,u))return;let r=u.width[n];if(r===y)return;let i=S(r);return i!==null?i/100*e:r}function q(t,n,e){if(!m$1(t,n,u))return;let r=u.height[n];if(r===y)return;let i=S(r);return i!==null?i/100*e:r}var g=1e4,_=4294967295,M=0,f={focusable:new Uint8Array(g),focused:new Uint8Array(g),tabIndex:new Int16Array(g),focusEffectFg:new Uint32Array(g),focusEffectBg:new Uint32Array(g)},m=null;function V(t){f.focusable[t]=1,f.focused[t]=0,f.tabIndex[t]=0,f.focusEffectFg[t]=_,f.focusEffectBg[t]=M;}function W(t,n){m$1(t,n,f)||(l(t,n,f),V(n));}function X(t,n,e){return W(t,n),e.focusable!==void 0&&(f.focusable[n]=e.focusable?1:0),e.tabIndex!==void 0&&(f.tabIndex[n]=e.tabIndex),e.focusEffectFg!==void 0&&(f.focusEffectFg[n]=e.focusEffectFg),e.focusEffectBg!==void 0&&(f.focusEffectBg[n]=e.focusEffectBg),n}function nn(t,n,e){return W(t,n),f.focusable[n]=e?1:0,n}function tn(t,n){return m$1(t,n,f)?f.focused[n]===1:false}function en(t,n){return m$1(t,n,f)?f.focusable[n]===1:false}function U(t,n){return W(t,n),f.focusable[n]!==1||(m!==null&&m!==n&&m$1(t,m,f)&&(f.focused[m]=0),f.focused[n]=1,m=n),n}function rn(t,n){return m$1(t,n,f)&&(f.focused[n]=0,m===n&&(m=null)),n}function on(t,n){if(m$1(t,n,f))return {focusable:f.focusable[n]===1,focused:f.focused[n]===1,tabIndex:f.tabIndex[n],focusEffectFg:f.focusEffectFg[n],focusEffectBg:f.focusEffectBg[n]}}function un(t,n){return m$1(t,n,f)}function fn(){return m}function an(t,n,e){return W(t,n),f.tabIndex[n]=e,n}function sn(t,n){return m$1(t,n,f)?f.tabIndex[n]:-1}function k(t,n){return m$1(t,n,f)?f.tabIndex[n]>=0&&f.focusable[n]===1:false}function B(t,n){return n.filter(e=>k(t,e)).sort((e,r)=>f.tabIndex[e]-f.tabIndex[r])}function cn(t,n){let e=B(t,n);if(e.length===0)return null;let i=((m!==null?e.indexOf(m):-1)+1)%e.length,s=e[i];return s!==void 0?(U(t,s),s):null}function mn(t,n){let e=B(t,n);if(e.length===0)return null;let i=((m!==null?e.indexOf(m):0)-1+e.length)%e.length,s=e[i];return s!==void 0?(U(t,s),s):null}function ln(){m=null;}var F=1e4,o={x:new Float32Array(F),y:new Float32Array(F),z:new Uint16Array(F),absolute:new Uint8Array(F)};function h(t,n,e,r,i=0){return a.parse({x:e,y:r,z:i}),m$1(t,n,o)||(l(t,n,o),o.absolute[n]=0),o.x[n]=e,o.y[n]=r,o.z[n]=i,n}function pn(t,n){if(m$1(t,n,o))return {x:o.x[n],y:o.y[n],z:o.z[n],absolute:o.absolute[n]===1}}function gn(t,n,e){return m$1(t,n,o)||(l(t,n,o),o.x[n]=0,o.y[n]=0,o.z[n]=0),o.absolute[n]=e?1:0,n}function In(t,n){return m$1(t,n,o)?o.absolute[n]===1:false}function Wn(t,n){return m$1(t,n,o)}function Fn(t,n,e,r){return m$1(t,n,o)||(l(t,n,o),o.x[n]=0,o.y[n]=0,o.z[n]=0,o.absolute[n]=0),o.x[n]=o.x[n]+e,o.y[n]=o.y[n]+r,n}function p(t,n,e){return b.parse(e),m$1(t,n,o)||(l(t,n,o),o.x[n]=0,o.y[n]=0,o.absolute[n]=0),o.z[n]=e,n}function A(t,n){return m$1(t,n,o)?o.z[n]:0}function dn(t,n,e){let r=0;for(let s of e)if(s!==n&&m$1(t,s,o)){let c=o.z[s];c>r&&(r=c);}let i=Math.min(r+1,65535);return p(t,n,i)}function An(t,n,e){let r=65535;for(let s of e)if(s!==n&&m$1(t,s,o)){let c=o.z[s];c<r&&(r=c);}let i=Math.max(r-1,0);return p(t,n,i)}function Dn(t,n,e){let r=A(t,n),i=65535,s=false;for(let c of e)if(c!==n&&m$1(t,c,o)){let l=o.z[c];l>r&&l<i&&(i=l,s=true);}return s?p(t,n,Math.min(i+1,65535)):n}function Pn(t,n,e){let r=A(t,n),i=0,s=false;for(let c of e)if(c!==n&&m$1(t,c,o)){let l=o.z[c];l<r&&l>i&&(i=l,s=true);}return s?p(t,n,Math.max(i-1,0)):n}function Tn(t,n){let e=[];for(let r of n)m$1(t,r,o)&&e.push({entity:r,z:o.z[r]});e.sort((r,i)=>r.z-i.z);for(let r=0;r<e.length;r++){let i=e[r];i&&(o.z[i.entity]=r);}}function zn(t,n,e){let r=A(t,n),i=A(t,e);p(t,n,i),p(t,e,r);}function Nn(t,n,e){if(!m$1(t,n,b$1)){let x=d(e,0,0,0,0);return h(t,n,x.x,x.y),n}let r=i(t,n);if(r===0){let x=d(e,0,0,0,0);return h(t,n,x.x,x.y),n}let i$1=I(t,r);if(!i$1){let x=d(e,0,0,0,0);return h(t,n,x.x,x.y),n}let s=I(t,n),c=s?.width??0,l=s?.height??0,z=d(e,i$1.width,i$1.height,c,l);return h(t,n,z.x,z.y),n}function d(t,n,e,r,i){switch(t){case "center":return {x:Math.floor((n-r)/2),y:Math.floor((e-i)/2)};case "top-left":case "tl":return {x:0,y:0};case "top-right":case "tr":return {x:Math.max(0,n-r),y:0};case "bottom-left":case "bl":return {x:0,y:Math.max(0,e-i)};case "bottom-right":case "br":return {x:Math.max(0,n-r),y:Math.max(0,e-i)};default:return {x:0,y:0}}}function Hn(t,n,e,r){if(!m$1(t,n,b$1))return h(t,n,0,0),n;let i$1=i(t,n);if(i$1===0)return h(t,n,0,0),n;let s=I(t,i$1);if(!s)return h(t,n,0,0),n;let c=Math.floor(s.width*e/100),l=Math.floor(s.height*r/100);return h(t,n,c,l),n}export{sn as A,k as B,B as C,cn as D,mn as E,ln as F,o as G,h as H,pn as I,gn as J,In as K,Wn as L,Fn as M,p as N,A as O,dn as P,An as Q,Dn as R,Pn as S,Tn as T,zn as U,Nn as V,Hn as W,y as a,Z as b,S as c,w as d,u as e,L as f,I as g,K as h,G as i,R as j,$ as k,j as l,q as m,_ as n,M as o,f as p,X as q,nn as r,tn as s,en as t,U as u,rn as v,on as w,un as x,fn as y,an as z};
@@ -0,0 +1 @@
1
+ import {b}from'./chunk-JWIVZCKW.js';import {f as f$1,e}from'./chunk-JN2OGNK3.js';import {t,D as D$1,E,C as C$1}from'./chunk-JB5KFQPD.js';import {M as M$1,h as h$1}from'./chunk-LIVVHEOU.js';import {m as m$2,n as n$1,j as j$1}from'./chunk-Z4EZERNE.js';import {l,m as m$1,n,p as p$1,q as q$1,a}from'./chunk-7ZFQO3OQ.js';import {z as z$1}from'zod';function Fe(e){return typeof e=="string"?{target:e}:e}function Be(e){let t=e.initial,n=e.context,r=new Set;function o(u){if(u)for(let d of u)d(n);}function i(u){if(u!==t)for(let d of r)d(t,u);}let a=e.states[t];if(a?.entry)for(let u of a.entry)u(n);let x={get current(){return t},get context(){return n},send(u){let d=e.states[t];if(!d?.on)return false;let b=d.on[u];if(b===void 0)return false;let{target:k,actions:vn,guard:Se}=Fe(b);if(Se&&!Se(n))return false;let Wn=t;return o(d.exit),o(vn),t=k,o(e.states[t]?.entry),i(Wn),true},can(u){let d=e.states[t];if(!d?.on)return false;let b=d.on[u];if(b===void 0)return false;let{guard:k}=Fe(b);return !(k&&!k(n))},matches(u){return t===u},subscribe(u){return r.add(u),()=>{r.delete(u);}},validEvents(){let u=e.states[t];if(!u?.on)return [];let d=[];for(let b of Object.keys(u.on))x.can(b)&&d.push(b);return d},reset(){let u=t;o(e.states[t]?.exit),t=e.initial,o(e.states[t]?.entry),i(u);}};return x}var In=z$1.union([z$1.string(),z$1.object({target:z$1.string()})]),Tn=z$1.object({entry:z$1.array(z$1.function()).optional(),exit:z$1.array(z$1.function()).optional(),on:z$1.record(z$1.string(),In).optional()});z$1.object({initial:z$1.string(),states:z$1.record(z$1.string(),Tn),context:z$1.unknown().optional()});var An=1e4;function kn(e=An){return {machineId:new Uint32Array(e),currentState:new Uint16Array(e),previousState:new Uint16Array(e),stateAge:new Float32Array(e)}}var m=kn(),De=new WeakSet,Re=null;function R(e){return De.has(e)||(Re=p$1(e,q$1(()=>m)),De.add(e)),Re}var Rt=new Map,Lt=new Map,Ut=new Map,Le=1,D={register(e){let t=Le++,n=Be(e);Rt.set(t,n);let r=Object.keys(e.states),o=new Map;for(let i=0;i<r.length;i++){let a=r[i];a!==void 0&&o.set(a,i);}return Lt.set(t,o),Ut.set(t,r),t},getMachine(e){return Rt.get(e)},getStateIndex(e,t){return Lt.get(e)?.get(t)??0},getStateName(e,t){return Ut.get(e)?.[t]??""},unregister(e){Rt.delete(e),Lt.delete(e),Ut.delete(e);},clear(){Rt.clear(),Lt.clear(),Ut.clear(),Le=1;}};function I(e,t,n){let r=R(e),o=D.register(n),i=D.getStateIndex(o,n.initial);return l(e,t,r),m.machineId[t]=o,m.currentState[t]=i,m.previousState[t]=i,m.stateAge[t]=0,o}function Wo(e,t){let n$1=R(e);if(!m$1(e,t,n$1))return;let r=m.machineId[t]??0;D.unregister(r),n(e,t,n$1);}function h(e,t){let n=R(e);if(!m$1(e,t,n))return "";let r=m.machineId[t]??0,o=m.currentState[t]??0;return D.getStateName(r,o)}function Io(e,t){let n=R(e);if(!m$1(e,t,n))return "";let r=m.machineId[t]??0,o=m.previousState[t]??0;return D.getStateName(r,o)}function W(e,t,n){let r=R(e);if(!m$1(e,t,r))return false;let o=m.machineId[t]??0,i=D.getMachine(o);if(!i)return false;let a=i.current,x=i.send(n);if(x){let u=D.getStateIndex(o,i.current),d=D.getStateIndex(o,a);m.previousState[t]=d,m.currentState[t]=u,m.stateAge[t]=0;}return x}function To(e,t,n){let r=R(e);if(!m$1(e,t,r))return false;let o=m.machineId[t]??0,i=D.getMachine(o);return i?i.can(n):false}function Ao(e,t){let n=R(e);return m$1(e,t,n)?m.stateAge[t]??0:0}function P(e,t,n){return h(e,t)===n}function ko(e,t,n){let r=R(e);for(let o of t)if(m$1(e,o,r)){let i=m.stateAge[o]??0;m.stateAge[o]=i+n;}}function T(e,t){let n=R(e);return m$1(e,t,n)}var _n={initial:"unchecked",states:{unchecked:{on:{toggle:"checked",check:"checked",disable:"disabled"}},checked:{on:{toggle:"unchecked",uncheck:"unchecked",disable:"disabled"}},disabled:{on:{enable:"unchecked"}}}},Mn=1e4;function Fn(e=Mn){return {isCheckbox:new Uint8Array(e),machineId:new Uint32Array(e)}}var bt=Fn(),$=new Map,Ue="\u2611",Oe="\u2610",mt=new Map;function Bo(){bt.isCheckbox.fill(0),bt.machineId.fill(0),$.clear(),mt.clear();}function Do(e,t,n=false){let r=I(e,t,_n);return bt.isCheckbox[t]=1,bt.machineId[t]=r,n&&W(e,t,"check"),r}function L(e,t){return (bt.isCheckbox[t]??0)===1&&T(e,t)}function zt(e,t){if(L(e,t))return h(e,t)}function ht(e,t,n){if(!L(e,t))return false;let r=h(e,t),o=W(e,t,n);if(o){M$1(e,t);let i=h(e,t);(r==="checked"||r==="unchecked")&&(i==="checked"||i==="unchecked")&&r!==i&&Ln(e,t,i==="checked");}return o}function jt(e,t,n){return L(e,t)?P(e,t,n):false}function Pe(e,t){return jt(e,t,"checked")}function Ro(e,t){return jt(e,t,"unchecked")}function Lo(e,t){return jt(e,t,"disabled")}function Bn(e,t){return ht(e,t,"toggle")}function Dn(e,t){return ht(e,t,"check")}function Rn(e,t){return ht(e,t,"uncheck")}function Uo(e,t){return ht(e,t,"disable")}function Oo(e,t){return ht(e,t,"enable")}function He(e,t,n){if(!L(e,t))return false;let r=zt(e,t);return r==="disabled"?false:n&&r==="unchecked"?Dn(e,t):!n&&r==="checked"?Rn(e,t):false}function Po(e,t,n){let r=$.get(t);return r||(r=[],$.set(t,r)),r.push(n),()=>{let o=$.get(t);if(o){let i=o.indexOf(n);i!==-1&&o.splice(i,1);}}}function Ln(e,t,n){let r=$.get(t);if(r)for(let o of r)o(n);}function Ho(e,t){$.delete(t);}function Vo(e,t,n){return !L(e,t)||zt(e,t)==="disabled"?false:n==="return"||n==="enter"||n==="space"?(Bn(e,t),true):false}function wo(e,t,n){let r=mt.get(t)??{checkedChar:Ue,uncheckedChar:Oe};mt.set(t,{checkedChar:n.checkedChar??r.checkedChar,uncheckedChar:n.uncheckedChar??r.uncheckedChar});}function Un(e,t){return mt.get(t)??{checkedChar:Ue,uncheckedChar:Oe}}function No(e,t){let n=Un(e,t);return zt(e,t)==="checked"?n.checkedChar:n.uncheckedChar}function Yo(e,t){mt.delete(t);}var On={initial:"idle",states:{idle:{on:{mouseenter:"hovered",focus:"focused",disable:"disabled"}},hovered:{on:{mousedown:"pressed",mouseleave:"idle",focus:"focused",disable:"disabled"}},pressed:{on:{mouseup:"hovered",mouseleave:"idle"}},focused:{on:{blur:"idle",mouseenter:"hovered",disable:"disabled"}},disabled:{on:{enable:"idle"}}}},Pn=1e4;function Hn(e=Pn){return {isButton:new Uint8Array(e),machineId:new Uint32Array(e)}}var Et=Hn(),q=new Map;function zo(){Et.isButton.fill(0),Et.machineId.fill(0),q.clear();}function jo(e,t){let n=I(e,t,On);return Et.isButton[t]=1,Et.machineId[t]=n,n}function Y(e,t){return (Et.isButton[t]??0)===1&&T(e,t)}function Ot(e,t){if(Y(e,t))return h(e,t)}function Ve(e,t,n){if(!Y(e,t))return false;let r=h(e,t),o=W(e,t,n);return o&&(M$1(e,t),r==="pressed"&&n==="mouseup"&&we(t)),o}function Pt(e,t,n){return Y(e,t)?P(e,t,n):false}function $o(e,t){return Pt(e,t,"hovered")}function qo(e,t){return Pt(e,t,"pressed")}function Jo(e,t){return Pt(e,t,"focused")}function Qo(e,t){return Pt(e,t,"disabled")}function Zo(e,t){return Ve(e,t,"disable")}function ti(e,t){return Ve(e,t,"enable")}function ei(e,t){let n=q.get(e);return n||(n=[],q.set(e,n)),n.push(t),()=>{let r=q.get(e);if(r){let o=r.indexOf(t);o!==-1&&r.splice(o,1);}}}function we(e){let t=q.get(e);if(t)for(let n of t)n();}function Vn(e,t){return !Y(e,t)||Ot(e,t)==="disabled"?false:(we(t),true)}function ni(e){q.delete(e);}function ri(e,t,n){if(!Y(e,t))return false;let r=Ot(e,t);return r==="disabled"||r!=="focused"?false:n==="return"||n==="enter"||n==="space"?(Vn(e,t),true):false}var $t={initial:"idle",states:{idle:{on:{focus:"focused",disable:"disabled"}},focused:{on:{startEdit:"editing",blur:"idle",error:"error",disable:"disabled"}},editing:{on:{endEdit:"focused",blur:"idle",error:"error"}},error:{on:{clearError:"focused",blur:"idle",disable:"disabled"}},disabled:{on:{enable:"idle"}}}},qt=1e4,F={Line:0,Block:1},Jt=530,J="*",Q="",Qt="\u2502",Zt="\u2588",B=new Map,H=new Map,V=new Map,w=new Map,U=new Map,St=new Map;function wn(e=qt){return {isTextInput:new Uint8Array(e),machineId:new Uint32Array(e),cursorPos:new Uint32Array(e),selectionStart:new Int32Array(e).fill(-1),selectionEnd:new Int32Array(e).fill(-1),inputMode:new Uint8Array(e),cursorMode:new Uint8Array(e),cursorBlink:new Uint8Array(e).fill(1),cursorBlinkStart:new Float64Array(e)}}var f=wn();function Nn(){f.isTextInput.fill(0),f.machineId.fill(0),f.cursorPos.fill(0),f.selectionStart.fill(-1),f.selectionEnd.fill(-1),f.inputMode.fill(0),f.cursorMode.fill(0),f.cursorBlink.fill(1),f.cursorBlinkStart.fill(0),B.clear(),H.clear(),V.clear(),w.clear(),St.clear(),U.clear();}function Yn(e,t){let n=I(e,t,$t);return f.isTextInput[t]=1,f.machineId[t]=n,f.cursorPos[t]=0,f.selectionStart[t]=-1,f.selectionEnd[t]=-1,f.inputMode[t]=0,f.cursorMode[t]=F.Line,f.cursorBlink[t]=1,f.cursorBlinkStart[t]=Date.now(),B.set(t,{secret:false,censor:J,placeholder:Q,maxLength:0,multiline:false}),n}function S(e,t){return (f.isTextInput[t]??0)===1&&T(e,t)}function Z(e,t){if(S(e,t))return h(e,t)}function O(e,t,n){if(!S(e,t))return false;let r=W(e,t,n);if(r){M$1(e,t);let o=h(e,t);f.inputMode[t]=o==="editing"?1:0;}return r}function Ht(e,t,n){return S(e,t)?P(e,t,n):false}function Xn(e,t){let n=Z(e,t);return n==="focused"||n==="editing"}function Kn(e,t){return Ht(e,t,"editing")}function Gn(e,t){return Ht(e,t,"error")}function zn(e,t){return Ht(e,t,"disabled")}function te(e,t){return O(e,t,"focus")}function jn(e,t){return O(e,t,"blur")}function $n(e,t){return O(e,t,"startEdit")}function qn(e,t){return O(e,t,"endEdit")}function Jn(e,t){return O(e,t,"disable")}function Qn(e,t){return O(e,t,"enable")}function Zn(e,t){return O(e,t,"error")}function tr(e,t){return O(e,t,"clearError")}function er(e,t,n){let r=B.get(t)??{secret:false,censor:J,placeholder:Q,maxLength:0,multiline:false,validator:void 0,validationTiming:"both"};B.set(t,{secret:n.secret??r.secret,censor:n.censor??r.censor,placeholder:n.placeholder??r.placeholder,maxLength:n.maxLength??r.maxLength,multiline:n.multiline??r.multiline,validator:n.validator??r.validator,validationTiming:n.validationTiming??r.validationTiming});}function C(e,t){return B.get(t)??{secret:false,censor:J,placeholder:Q,maxLength:0,multiline:false,validator:void 0,validationTiming:"both"}}function Ne(e,t){return C(e,t).secret}function Ye(e,t){return C(e,t).censor}function nr(e,t){return C(e,t).placeholder}function rr(e,t){return C(e,t).maxLength}function or(e,t){return C(e,t).multiline}function ir(e,t,n){return Ne(e,t)?Ye(e,t).repeat(n.length):n}function ee(e,t,n){let r=C(e,t);if(!r.validator)return U.set(t,null),true;let o=r.validator(n);return o===true?(U.set(t,null),true):o===false?(U.set(t,"Invalid input"),false):(U.set(t,o),false)}function lr(e,t,n){let r=H.get(t);return r||(r=[],H.set(t,r)),r.push(n),()=>{let o=H.get(t);if(o){let i=o.indexOf(n);i!==-1&&o.splice(i,1);}}}function ar(e,t,n){let r=V.get(t);return r||(r=[],V.set(t,r)),r.push(n),()=>{let o=V.get(t);if(o){let i=o.indexOf(n);i!==-1&&o.splice(i,1);}}}function sr(e,t,n){let r=w.get(t);return r||(r=[],w.set(t,r)),r.push(n),()=>{let o=w.get(t);if(o){let i=o.indexOf(n);i!==-1&&o.splice(i,1);}}}function cr(e,t,n){let r=C(e,t);r.validator&&(r.validationTiming==="onChange"||r.validationTiming==="both")&&ee(e,t,n);let o=H.get(t);if(o)for(let i of o)i(n);}function ur(e,t,n){let r=C(e,t);if(r.validator&&(r.validationTiming==="onSubmit"||r.validationTiming==="both")&&!ee(e,t,n))return false;let o=V.get(t);if(o)for(let i of o)i(n);return true}function fr(e,t){let n=w.get(t);if(n)for(let r of n)r();}function pr(e,t){H.delete(t),V.delete(t),w.delete(t),B.delete(t),U.delete(t);}function tt(e,t){return f.cursorPos[t]??0}function Xe(e,t,n){S(e,t)&&(f.cursorPos[t]=Math.max(0,n),f.cursorBlinkStart[t]=Date.now(),M$1(e,t));}function dr(e,t,n){let r=tt(e,t);Xe(e,t,r+n);}function Vt(e,t){let n=f.selectionStart[t],r=f.selectionEnd[t];return n===void 0||r===void 0||n<0||r<0?null:[n,r]}function gr(e,t,n,r){S(e,t)&&(f.selectionStart[t]=n,f.selectionEnd[t]=r,M$1(e,t));}function xr(e,t){S(e,t)&&(f.selectionStart[t]=-1,f.selectionEnd[t]=-1,M$1(e,t));}function yr(e,t){return Vt(e,t)!==null}function Ct(e,t){return St.get(t)??{blink:true,blinkIntervalMs:Jt,lineChar:Qt,blockChar:Zt}}function br(e,t,n){let r=Ct(e,t);St.set(t,{blink:n.blink??r.blink,blinkIntervalMs:n.blinkIntervalMs??r.blinkIntervalMs,lineChar:n.lineChar??r.lineChar,blockChar:n.blockChar??r.blockChar});}function vt(e,t){return f.cursorMode[t]??0}function Ke(e,t,n){S(e,t)&&(f.cursorMode[t]=n,M$1(e,t));}function mr(e,t){let r=vt(e,t)===F.Line?F.Block:F.Line;return Ke(e,t,r),r}function ne(e,t){return (f.cursorBlink[t]??1)===1}function hr(e,t,n){S(e,t)&&(f.cursorBlink[t]=n?1:0,n&&(f.cursorBlinkStart[t]=Date.now()),M$1(e,t));}function Er(e,t){f.cursorBlinkStart[t]=Date.now();}function re(e,t){let n=Ct(e,t);return vt(e,t)===F.Block?n.blockChar:n.lineChar}function Sr(e,t,n){return e.multiline?e.maxLength>0&&n.length>=e.maxLength?null:{type:"newline",position:t}:{type:"submit",value:n}}function Cr(e,t){return e.multiline?{type:"submit",value:t}:{type:"cancel"}}function vr(e,t,n){return e==="left"&&t>0?{type:"moveCursor",position:t-1}:e==="right"&&t<n?{type:"moveCursor",position:t+1}:e==="home"&&t!==0?{type:"moveCursor",position:0}:e==="end"&&t!==n?{type:"moveCursor",position:n}:null}function Wr(e,t,n){return e==="backspace"&&t>0?{type:"delete",start:t-1,end:t}:e==="delete"&&t<n?{type:"delete",start:t,end:t+1}:null}function Ir(e,t,n){return e==="left"?{type:"moveWordLeft",text:n,position:t}:e==="right"?{type:"moveWordRight",text:n,position:t}:e==="backspace"?{type:"deleteWordBackward",text:n,position:t}:e==="delete"?{type:"deleteWordForward",text:n,position:t}:null}function Tr(e,t,n,r){return e.length!==1||n.maxLength>0&&r>=n.maxLength?null:{type:"insert",char:e,position:t}}function Ar(e,t,n,r,o=false){if(!S(e,t))return null;let i=Z(e,t);if(i==="disabled")return null;if(i==="idle")return te(e,t),null;let a=tt(e,t),x=C(e,t),u=r.length;if(n==="return"||n==="enter")return Sr(x,a,r);if(n==="escape")return Cr(x,r);if(o){let k=Ir(n,a,r);if(k)return k}let d=Wr(n,a,u);if(d)return d;let b=vr(n,a,u);return b||Tr(n,a,x,u)}function Ge(e,t){let n=Z(e,t);if(n!=="focused"&&n!=="editing")return false;if(!ne(e,t))return true;let r=Ct(e,t),o=f.cursorBlinkStart[t]??Date.now(),i=Date.now()-o;return Math.floor(i/r.blinkIntervalMs)%2===0}function kr(e,t,n){let r=C(e,t),o=tt(e,t),i=n;if(r.secret&&(i=r.censor.repeat(n.length)),i.length===0&&r.placeholder)return {displayText:r.placeholder,cursorVisible:false,cursorPosition:0};if(!Ge(e,t))return {displayText:i,cursorVisible:false,cursorPosition:o};let x=re(e,t),u=vt(e,t),d;return u===F.Block&&o<i.length?d=i.substring(0,o)+x+i.substring(o+1):d=i.substring(0,o)+x+i.substring(o),{displayText:d,cursorVisible:true,cursorPosition:o}}function _r(e,t){let n=Vt(e,t);if(!n)return null;let[r,o]=n;return {start:Math.min(r,o),end:Math.max(r,o)}}var Mr=1e4,ze=1,je=2;function Fr(e=Mr){return {isForm:new Uint8Array(e),flags:new Uint8Array(e)}}var X=Fr(),K=new Map,Wt=new Map,et=new Map,nt=new Map;function Zi(){X.isForm.fill(0),X.flags.fill(0),K.clear(),Wt.clear(),et.clear(),nt.clear();}function tl(e,t,n={}){X.isForm[t]=1;let r=0;n.keys!==false&&(r|=ze),n.submitOnEnter!==false&&(r|=je),X.flags[t]=r,K.set(t,new Map),Wt.set(t,new Map),M$1(e,t);}function $e(e,t){return X.isForm[t]===1}function Br(e,t){return (X.flags[t]&ze)!==0}function Dr(e,t){return (X.flags[t]&je)!==0}function Rr(e,t,n,r,o){if(!$e(e,t))return;let i=K.get(t),a=Wt.get(t);i&&a&&(i.set(n,r),o!==void 0?a.set(n,o):a.set(n,Je(e,n)));}function el(e,t,n){let r=K.get(t),o=Wt.get(t);r&&r.delete(n),o&&o.delete(n);}function qe(e,t){let n=K.get(t);return n?Array.from(n.keys()):[]}function nl(e,t){return K.get(e)?.get(t)}function Je(e,t){return S(e,t)?f$1(e,t)??"":L(e,t)?Pe(e,t):Y(e,t)?Ot(e,t)==="pressed":f$1(e,t)??null}function Lr(e$1,t,n){if(S(e$1,t)){e(e$1,t,String(n??""));return}if(L(e$1,t)){He(e$1,t,!!n);return}n!==null&&e(e$1,t,String(n));}function Ur(e,t){let n={},r=K.get(t);if(!r)return n;for(let[o,i]of r)n[i]=Je(e,o);return n}function rl(e,t){let n=Wt.get(t);if(!n)return;for(let[o,i]of n)Lr(e,o,i);let r=nt.get(t);if(r)for(let o of r)o();M$1(e,t);}function Or(e,t){let n=Ur(e,t),r=et.get(t);if(r)for(let o of r)o(n);return n}function ol(e,t,n){let r=et.get(t)??[];return r.push(n),et.set(t,r),()=>{let o=et.get(t);if(o){let i=o.indexOf(n);i!==-1&&o.splice(i,1);}}}function il(e,t,n){let r=nt.get(t)??[];return r.push(n),nt.set(t,r),()=>{let o=nt.get(t);if(o){let i=o.indexOf(n);i!==-1&&o.splice(i,1);}}}function ll(e,t){et.delete(t),nt.delete(t);}function Pr(e,t$1){let r=qe(e,t$1).filter(o=>t(e,o));return D$1(e,r)}function Hr(e,t$1){let r=qe(e,t$1).filter(o=>t(e,o));return E(e,r)}function al(e,t$1){let r=h$1(e,t$1).filter(o=>t(e,o));return C$1(e,r)}function sl(e,t,n,r){return !$e(e,t)||!Br(e,t)?false:n==="tab"?(r?Hr(e,t):Pr(e,t),true):(n==="return"||n==="enter")&&Dr(e,t)?(Or(e,t),true):false}function cl(e,t,n="field_"){let r=h$1(e,t);for(let o of r)if(S(e,o)||L(e,o)){let i=`${n}${o}`;Rr(e,t,o,i);}}var Vr=1e4,It={Horizontal:0,Vertical:1};function wr(e=Vr){return {isProgressBar:new Uint8Array(e),value:new Float32Array(e),min:new Float32Array(e),max:new Float32Array(e),orientation:new Uint8Array(e),showPercentage:new Uint8Array(e)}}var p=wr(),Qe="\u2588",Ze="\u2591",tn="\u2588",en="\u2591",Tt=new Map,rt=new Map,ot=new Map;function pl(){p.isProgressBar.fill(0),p.value.fill(0),p.min.fill(0),p.max.fill(0),p.orientation.fill(0),p.showPercentage.fill(0),Tt.clear(),rt.clear(),ot.clear();}function dl(e,t,n={}){p.isProgressBar[t]=1,p.min[t]=n.min??0,p.max[t]=n.max??100,p.value[t]=n.value??0,p.orientation[t]=n.orientation??It.Horizontal,p.showPercentage[t]=n.showPercentage?1:0,Nr(e,t,{}),M$1(e,t);}function gl(e,t){return p.isProgressBar[t]===1}function xl(e,t){return p.value[t]}function yl(e,t){return p.min[t]}function bl(e,t){return p.max[t]}function nn(e,t){let n=p.min[t],r=p.max[t],o=p.value[t];return r===n?0:(o-n)/(r-n)*100}function ml(e,t){return p.orientation[t]}function hl(e,t){return p.showPercentage[t]===1}function At(e,t,n){let r=p.min[t],o=p.max[t],i=p.value[t],a=Math.max(r,Math.min(o,n));if(p.value[t]=a,M$1(e,t),a!==i){let x=nn(e,t);Xr(e,t,a,x),a===o&&i<o&&Yr(e,t);}}function El(e,t,n=1){let r=p.value[t];At(e,t,r+n);}function Sl(e,t,n=1){let r=p.value[t];At(e,t,r-n);}function Cl(e,t){let n=p.min[t];At(e,t,n);}function vl(e,t){let n=p.max[t];At(e,t,n);}function Wl(e,t){let n=p.max[t];return p.value[t]>=n}function Nr(e,t,n){let r=Tt.get(t),o=p.orientation[t],i=o===It.Vertical?tn:Qe,a=o===It.Vertical?en:Ze;Tt.set(t,{fillChar:n.fillChar??r?.fillChar??i,emptyChar:n.emptyChar??r?.emptyChar??a,fillFg:n.fillFg??r?.fillFg??16711935,fillBg:n.fillBg??r?.fillBg??255,emptyFg:n.emptyFg??r?.emptyFg??1717987071,emptyBg:n.emptyBg??r?.emptyBg??255});}function oe(e,t){let n=Tt.get(t);if(n)return n;let r=p.orientation[t],o=r===It.Vertical?tn:Qe,i=r===It.Vertical?en:Ze;return {fillChar:o,emptyChar:i,fillFg:16711935,fillBg:255,emptyFg:1717987071,emptyBg:255}}function Il(e,t){Tt.delete(t);}function Tl(e,t){return oe(e,t).fillChar}function Al(e,t){return oe(e,t).emptyChar}function kl(e,t,n){let r=nn(e,t)/100,o=oe(e,t),i=Math.round(n*r),a=n-i;return o.fillChar.repeat(i)+o.emptyChar.repeat(a)}function _l(e,t,n){let r=rt.get(t)??[];return r.push(n),rt.set(t,r),()=>{let o=rt.get(t);if(o){let i=o.indexOf(n);i!==-1&&o.splice(i,1);}}}function Ml(e,t,n){let r=ot.get(t)??[];return r.push(n),ot.set(t,r),()=>{let o=ot.get(t);if(o){let i=o.indexOf(n);i!==-1&&o.splice(i,1);}}}function Yr(e,t){let n=rt.get(t);if(n)for(let r of n)r();}function Xr(e,t,n,r){let o=ot.get(t);if(o)for(let i of o)i(n,r);}function Fl(e,t){rt.delete(t),ot.delete(t);}function Bl(e,t,n){p.orientation[t]=n,M$1(e,t);}function Dl(e,t,n){p.showPercentage[t]=n?1:0,M$1(e,t);}function Rl(e,t,n,r){p.min[t]=n,p.max[t]=r;let o=p.value[t];(o<n||o>r)&&At(e,t,Math.max(n,Math.min(r,o))),M$1(e,t);}var Kr={initial:"unselected",states:{unselected:{on:{select:"selected",disable:"disabled"}},selected:{on:{deselect:"unselected",disable:"disabled"}},disabled:{on:{enable:"unselected"}}}},rn=1e4;function Gr(e=rn){return {isRadioButton:new Uint8Array(e),machineId:new Uint32Array(e),radioSetId:new Uint32Array(e)}}var v=Gr();function zr(e=rn){return {isRadioSet:new Uint8Array(e),selectedButton:new Uint32Array(e)}}var M=zr(),on="\u25C9",ln="\u25CB",kt=new Map,lt=new Map,it=new Map;function Pl(){v.isRadioButton.fill(0),v.machineId.fill(0),v.radioSetId.fill(0),M.isRadioSet.fill(0),M.selectedButton.fill(0),kt.clear(),lt.clear(),it.clear();}function Hl(e,t){M.isRadioSet[t]=1,M.selectedButton[t]=0,M$1(e,t);}function Vl(e,t){return M.isRadioSet[t]===1}function jr(e,t){return M.selectedButton[t]}function wl(e,t){let n=M.selectedButton[t];return n===0?null:lt.get(n)??null}function Nl(e,t,n){let r=it.get(t)??[];return r.push(n),it.set(t,r),()=>{let o=it.get(t);if(o){let i=o.indexOf(n);i!==-1&&o.splice(i,1);}}}function an(e,t){let n=it.get(t);if(n){let r=jr(e,t),o=r!==0?lt.get(r)??null:null;for(let i of n)i(o,r!==0?r:null);}}function Yl(e,t){it.delete(t);}function Xl(e,t,n){v.isRadioButton[t]=1,v.radioSetId[t]=n??0;let r=I(e,t,Kr);return v.machineId[t]=r,qr(e,t,{}),M$1(e,t),r}function at(e,t){return v.isRadioButton[t]===1}function Kl(e,t){if(at(e,t)&&T(e,t))return h(e,t)}function _t(e,t,n){return at(e,t)?W(e,t,n):false}function sn(e,t,n){return at(e,t)?P(e,t,n):false}function $r(e,t){return sn(e,t,"selected")}function cn(e,t){return sn(e,t,"disabled")}function Gl(e,t){return v.radioSetId[t]}function zl(e,t,n){v.radioSetId[t]=n;}function jl(e,t){return lt.get(t)}function $l(e,t,n){lt.set(t,n);}function un(e,t){if(!at(e,t)||cn(e,t))return;let n=v.radioSetId[t];if(n!==0){let r=M.selectedButton[n];r!==0&&r!==t&&_t(e,r,"deselect"),M.selectedButton[n]=t;}_t(e,t,"select"),M$1(e,t),n!==0&&an(e,n);}function ql(e,t){if(!at(e,t))return;_t(e,t,"deselect");let n=v.radioSetId[t];n!==0&&M.selectedButton[n]===t&&(M.selectedButton[n]=0,an(e,n)),M$1(e,t);}function Jl(e,t){_t(e,t,"disable"),M$1(e,t);}function Ql(e,t){_t(e,t,"enable"),M$1(e,t);}function qr(e,t,n){let r=kt.get(t);kt.set(t,{selectedChar:n.selectedChar??r?.selectedChar??on,unselectedChar:n.unselectedChar??r?.unselectedChar??ln});}function Jr(e,t){return kt.get(t)??{selectedChar:on,unselectedChar:ln}}function Zl(e,t){let n=Jr(e,t);return $r(e,t)?n.selectedChar:n.unselectedChar}function ta(e,t){kt.delete(t);}function ea(e,t,n){return !at(e,t)||cn(e,t)?false:n==="space"||n==="return"||n==="enter"?(un(e,t),true):false}function Qr(e){let t=[];for(let n=0;n<v.isRadioButton.length;n++)v.isRadioButton[n]===1&&v.radioSetId[n]===e&&t.push(n);return t}function na(e,t,n){let r=Qr(t);for(let o of r)if(lt.get(o)===n)return un(e,o),true;return false}var ie="\u25BC",le="\u25B2",ae="\u25CF",se=" ";var g={isSelect:new Uint8Array(1e4),selectedIndex:new Int32Array(1e4).fill(-1),highlightedIndex:new Int32Array(1e4).fill(0),optionCount:new Uint32Array(1e4)},fn={initial:"closed",states:{closed:{on:{open:"open",toggle:"open",disable:"disabled"}},open:{on:{close:"closed",select:"closed",toggle:"closed",disable:"disabled"}},disabled:{on:{enable:"closed"}}}};function G(e){return a(e,"select:options")}function Mt(e){return a(e,"select:display")}function st(e){return a(e,"select:changeCallbacks")}function ct(e){return a(e,"select:openCallbacks")}function ut(e){return a(e,"select:closeCallbacks")}function pn(e,t){let n=t.get(e);if(n)for(let r of n)r();}function Zr(e,t,n,r){n!=="open"&&r==="open"?pn(t,ct(e)):n==="open"&&r!=="open"&&pn(t,ut(e));}function ca(e,t,n=[],r=-1){g.isSelect[t]=1,g.selectedIndex[t]=r,g.highlightedIndex[t]=r>=0?r:0,g.optionCount[t]=n.length,G(e).set(t,[...n]),I(e,t,fn);}function dn(e,t){return g.isSelect[t]===1&&T(e,t)}function wt(e,t){return h(e,t)??"closed"}function gn(e,t,n){return wt(e,t)===n}function to(e,t){return gn(e,t,"open")}function eo(e,t){return gn(e,t,"disabled")}function ft(e,t,n){if(!dn(e,t))return false;let r=wt(e,t),o=W(e,t,n);if(o){let i=wt(e,t);M$1(e,t),Zr(e,t,r,i);}return o}function ua(e,t){return ft(e,t,"open")}function fa(e,t){return ft(e,t,"close")}function pa(e,t){return ft(e,t,"toggle")}function da(e,t){return ft(e,t,"disable")}function ga(e,t){return ft(e,t,"enable")}function xa(e,t){return G(e).get(t)??[]}function ya(e,t,n){G(e).set(t,[...n]),g.optionCount[t]=n.length,(g.selectedIndex[t]??-1)>=n.length&&(g.selectedIndex[t]=n.length>0?0:-1),g.highlightedIndex[t]=0,M$1(e,t);}function ba(e,t){return g.optionCount[t]??0}function no(e,t,n){return G(e).get(t)?.[n]}function ma(e,t){return g.selectedIndex[t]??-1}function xn(e,t){let n=g.selectedIndex[t]??-1;if(!(n<0))return no(e,t,n)}function ha(e,t){return xn(e,t)?.value}function Ea(e,t){return xn(e,t)?.label}function yn(e,t,n){let r=G(e).get(t);if(!r||n<0||n>=r.length||(g.selectedIndex[t]??-1)===n)return false;g.selectedIndex[t]=n,g.highlightedIndex[t]=n,M$1(e,t);let i=r[n],a=st(e).get(t);if(a&&i)for(let x of a)x(i.value,i.label,n);return ft(e,t,"select"),true}function Sa(e,t,n){let r=G(e).get(t);if(!r)return false;let o=r.findIndex(i=>i.value===n);return o<0?false:yn(e,t,o)}function Ca(e,t){g.selectedIndex[t]=-1,M$1(e,t);}function ro(e,t){return g.highlightedIndex[t]??0}function bn(e,t,n){let r=g.optionCount[t]??0;if(r===0)return;let o=Math.max(0,Math.min(n,r-1));g.highlightedIndex[t]=o,M$1(e,t);}function va(e,t,n=true){let r=g.optionCount[t]??0;if(r===0)return;let o=(g.highlightedIndex[t]??0)+1;o>=r&&(o=n?0:r-1),bn(e,t,o);}function Wa(e,t,n=true){let r=g.optionCount[t]??0;if(r===0)return;let o=(g.highlightedIndex[t]??0)-1;o<0&&(o=n?r-1:0),bn(e,t,o);}function Ia(e,t){let n=g.highlightedIndex[t]??0;return yn(e,t,n)}function Ta(e,t,n){let r=Mt(e).get(t);Mt(e).set(t,{closedIndicator:n.closedIndicator??r?.closedIndicator??"\u25BC",openIndicator:n.openIndicator??r?.openIndicator??"\u25B2",selectedMark:n.selectedMark??r?.selectedMark??"\u25CF",separator:n.separator??r?.separator??" "});}function oo(e,t){return Mt(e).get(t)??{closedIndicator:"\u25BC",openIndicator:"\u25B2",selectedMark:"\u25CF",separator:" "}}function Aa(e,t){Mt(e).delete(t);}function ka(e,t){let n=oo(e,t);return wt(e,t)==="open"?n.openIndicator:n.closedIndicator}function _a(e,t,n){let r=st(e).get(t)??[];return r.push(n),st(e).set(t,r),()=>{let o=st(e).get(t);if(o){let i=o.indexOf(n);i!==-1&&o.splice(i,1);}}}function Ma(e,t,n){let r=ct(e).get(t)??[];return r.push(n),ct(e).set(t,r),()=>{let o=ct(e).get(t);if(o){let i=o.indexOf(n);i!==-1&&o.splice(i,1);}}}function Fa(e,t,n){let r=ut(e).get(t)??[];return r.push(n),ut(e).set(t,r),()=>{let o=ut(e).get(t);if(o){let i=o.indexOf(n);i!==-1&&o.splice(i,1);}}}function Ba(e,t){st(e).delete(t),ct(e).delete(t),ut(e).delete(t);}function Da(e,t,n){if(!dn(e,t)||eo(e,t))return null;let r=to(e,t);switch(n){case "return":case "enter":case "space":return r?{type:"select",index:ro(e,t)}:{type:"open"};case "escape":return r?{type:"close"}:null;case "up":return r?{type:"highlightPrev"}:{type:"open"};case "down":return r?{type:"highlightNext"}:{type:"open"};case "home":return r?{type:"highlightFirst"}:null;case "end":return r?{type:"highlightLast"}:null;default:return null}}function Ra(e){g.isSelect.fill(0),g.selectedIndex.fill(-1),g.highlightedIndex.fill(0),g.optionCount.fill(0),G(e).clear(),Mt(e).clear(),st(e).clear(),ct(e).clear(),ut(e).clear();}var N={Horizontal:0,Vertical:1},ce="\u2500",ue="\u2502",fe="\u25CF",pe="\u2501",de="\u2503",ge=1717987071,xe=255,ye=4294967295,be=6750207,me=16711935,he=255,z=1e4,s={isSlider:new Uint8Array(z),value:new Float32Array(z),min:new Float32Array(z),max:new Float32Array(z).fill(100),step:new Float32Array(z).fill(1),orientation:new Uint8Array(z),showValue:new Uint8Array(z)},mn={initial:"idle",states:{idle:{on:{focus:"focused",disable:"disabled"}},focused:{on:{blur:"idle",dragStart:"dragging",disable:"disabled"}},dragging:{on:{dragEnd:"focused",blur:"idle",disable:"disabled"}},disabled:{on:{enable:"idle"}}}};function Ft(e){return a(e,"slider:display")}function pt(e){return a(e,"slider:changeCallbacks")}function dt(e){return a(e,"slider:dragStartCallbacks")}function gt(e){return a(e,"slider:dragEndCallbacks")}function Ee(e,t,n){return Math.max(t,Math.min(n,e))}function En(e,t,n){return t<=0?e:n+Math.round((e-n)/t)*t}function hn(e,t){let n=t.get(e);if(n)for(let r of n)r();}function lo(e,t,n,r){n!=="dragging"&&r==="dragging"?hn(t,dt(e)):n==="dragging"&&r!=="dragging"&&hn(t,gt(e));}function Ya(e,t,n=0,r=100,o=0,i=1){s.isSlider[t]=1,s.min[t]=n,s.max[t]=r,s.value[t]=Ee(o,n,r),s.step[t]=i,s.orientation[t]=N.Horizontal,s.showValue[t]=0,I(e,t,mn);}function Sn(e,t){return s.isSlider[t]===1&&T(e,t)}function Nt(e,t){return h(e,t)??"idle"}function Cn(e,t,n){return Nt(e,t)===n}function Xa(e,t){let n=Nt(e,t);return n==="focused"||n==="dragging"}function Ka(e,t){return Cn(e,t,"dragging")}function ao(e,t){return Cn(e,t,"disabled")}function xt(e,t,n){if(!Sn(e,t))return false;let r=Nt(e,t),o=W(e,t,n);if(o){let i=Nt(e,t);M$1(e,t),lo(e,t,r,i);}return o}function Ga(e,t){return xt(e,t,"focus")}function za(e,t){return xt(e,t,"blur")}function ja(e,t){return xt(e,t,"dragStart")}function $a(e,t){return xt(e,t,"dragEnd")}function qa(e,t){return xt(e,t,"disable")}function Ja(e,t){return xt(e,t,"enable")}function so(e,t){return s.value[t]??0}function j(e,t,n){let r=s.min[t]??0,o=s.max[t]??100,i=s.step[t]??1,a=Ee(En(n,i,r),r,o),x=s.value[t]??0;if(a!==x){s.value[t]=a,M$1(e,t);let u=pt(e).get(t);if(u)for(let d of u)d(a);}}function Qa(e,t){return s.min[t]??0}function Za(e,t){return s.max[t]??100}function ts(e,t){return s.step[t]??1}function es(e,t,n,r){m$2.parse({min:n,max:r}),s.min[t]=n,s.max[t]=r;let o=s.value[t]??0,i=Ee(o,n,r);i!==o&&j(e,t,i),M$1(e,t);}function ns(e,t,n){n$1.parse(n),s.step[t]=n;let r=s.value[t]??0,o=s.min[t]??0,i=En(r,n,o);i!==r&&j(e,t,i),M$1(e,t);}function co(e,t){let n=s.min[t]??0,r=s.max[t]??100,o=s.value[t]??0;return r===n?0:(o-n)/(r-n)}function rs(e,t,n){z$1.number().finite().parse(n);let r=s.min[t]??0,o=s.max[t]??100,i=Math.max(0,Math.min(1,n)),a=r+i*(o-r);j(e,t,a);}function os(e,t,n=1){let r=s.step[t]??1,o=s.value[t]??0;j(e,t,o+r*n);}function is(e,t,n=1){let r=s.step[t]??1,o=s.value[t]??0;j(e,t,o-r*n);}function ls(e,t){j(e,t,s.min[t]??0);}function as(e,t){j(e,t,s.max[t]??100);}function Yt(e,t){return s.orientation[t]}function ss(e,t,n){s.orientation[t]=n,M$1(e,t);}function uo(e,t){return Yt(e,t)===N.Horizontal}function cs(e,t){return Yt(e,t)===N.Vertical}function fo(e,t){return s.showValue[t]===1}function us(e,t,n){s.showValue[t]=n?1:0,M$1(e,t);}function fs(e,t,n){let r=Ft(e).get(t),o=Yt(e,t),i=o===N.Vertical?ue:ce,a=o===N.Vertical?de:pe;Ft(e).set(t,{trackChar:n.trackChar??r?.trackChar??i,thumbChar:n.thumbChar??r?.thumbChar??fe,fillChar:n.fillChar??r?.fillChar??a,trackFg:n.trackFg??r?.trackFg??ge,trackBg:n.trackBg??r?.trackBg??xe,thumbFg:n.thumbFg??r?.thumbFg??ye,thumbBg:n.thumbBg??r?.thumbBg??be,fillFg:n.fillFg??r?.fillFg??me,fillBg:n.fillBg??r?.fillBg??he});}function po(e,t){let n=Yt(e,t),r=n===N.Vertical?ue:ce,o=n===N.Vertical?de:pe;return Ft(e).get(t)??{trackChar:r,thumbChar:fe,fillChar:o,trackFg:ge,trackBg:xe,thumbFg:ye,thumbBg:be,fillFg:me,fillBg:he}}function ps(e,t){Ft(e).delete(t);}function ds(e,t,n){let r=pt(e).get(t)??[];return r.push(n),pt(e).set(t,r),()=>{let o=pt(e).get(t);if(o){let i=o.indexOf(n);i!==-1&&o.splice(i,1);}}}function gs(e,t,n){let r=dt(e).get(t)??[];return r.push(n),dt(e).set(t,r),()=>{let o=dt(e).get(t);if(o){let i=o.indexOf(n);i!==-1&&o.splice(i,1);}}}function xs(e,t,n){let r=gt(e).get(t)??[];return r.push(n),gt(e).set(t,r),()=>{let o=gt(e).get(t);if(o){let i=o.indexOf(n);i!==-1&&o.splice(i,1);}}}function ys(e,t){pt(e).delete(t),dt(e).delete(t),gt(e).delete(t);}function bs(e,t,n){if(!Sn(e,t)||ao(e,t))return null;let r=uo(e,t);switch(n){case "right":return r?{type:"increment",multiplier:1}:null;case "left":return r?{type:"decrement",multiplier:1}:null;case "up":return r?null:{type:"increment",multiplier:1};case "down":return r?null:{type:"decrement",multiplier:1};case "pageup":return {type:"increment",multiplier:10};case "pagedown":return {type:"decrement",multiplier:10};case "home":return {type:"toMin"};case "end":return {type:"toMax"};default:return null}}function ms(e,t,n){if(n<=0)return "";let r=co(e,t),o=po(e,t),i=fo(e,t),a="",x=n;i&&(a=` ${so(e,t)}`,x=Math.max(1,n-a.length));let u=Math.round(r*(x-1)),d="";for(let b=0;b<x;b++)b===u?d+=o.thumbChar:b<u?d+=o.fillChar:d+=o.trackChar;return d+a}function hs(e){s.isSlider.fill(0),s.value.fill(0),s.min.fill(0),s.max.fill(100),s.step.fill(1),s.orientation.fill(0),s.showValue.fill(0),Ft(e).clear(),pt(e).clear(),dt(e).clear(),gt(e).clear();}function go(e){b.scrollX[e]=0,b.scrollY[e]=0,b.scrollWidth[e]=0,b.scrollHeight[e]=0,b.viewportWidth[e]=0,b.viewportHeight[e]=0,b.scrollbarVisible[e]=2,b.trackVisible[e]=1,b.alwaysScroll[e]=0,b.clampEnabled[e]=1;}function A(e,t){m$1(e,t,b)||(l(e,t,b),go(t));}function yt(e){if(!(b.clampEnabled[e]===1))return;let n=b.viewportWidth[e],r=b.viewportHeight[e],o=b.scrollWidth[e],i=b.scrollHeight[e];if(n>0){let a=Math.max(0,o-n);b.scrollX[e]=Math.max(0,Math.min(a,b.scrollX[e]));}else b.scrollX[e]=Math.max(0,b.scrollX[e]);if(r>0){let a=Math.max(0,i-r);b.scrollY[e]=Math.max(0,Math.min(a,b.scrollY[e]));}else b.scrollY[e]=Math.max(0,b.scrollY[e]);}function xo(e,t){t.scrollWidth!==void 0&&(b.scrollWidth[e]=t.scrollWidth),t.scrollHeight!==void 0&&(b.scrollHeight[e]=t.scrollHeight),t.viewportWidth!==void 0&&(b.viewportWidth[e]=t.viewportWidth),t.viewportHeight!==void 0&&(b.viewportHeight[e]=t.viewportHeight),t.scrollbarVisible!==void 0&&(b.scrollbarVisible[e]=t.scrollbarVisible);}function yo(e,t){t.trackVisible!==void 0&&(b.trackVisible[e]=t.trackVisible?1:0),t.alwaysScroll!==void 0&&(b.alwaysScroll[e]=t.alwaysScroll?1:0),t.clampEnabled!==void 0&&(b.clampEnabled[e]=t.clampEnabled?1:0);}function bo(e,t){xo(e,t),yo(e,t),t.scrollX!==void 0&&(b.scrollX[e]=t.scrollX),t.scrollY!==void 0&&(b.scrollY[e]=t.scrollY),yt(e);}function Is(e,t,n){return j$1.parse(n),A(e,t),bo(t,n),t}function mo(e,t,n,r){return A(e,t),b.scrollX[t]=n,b.scrollY[t]=r,yt(t),t}function Ts(e,t){return m$1(e,t,b)?{x:b.scrollX[t],y:b.scrollY[t]}:{x:0,y:0}}function As(e,t,n,r){return A(e,t),b.scrollX[t]=b.scrollX[t]+n,b.scrollY[t]=b.scrollY[t]+r,yt(t),t}function ks(e,t,n,r){return mo(e,t,n,r)}function _s(e,t){if(!m$1(e,t,b))return {x:0,y:0};let n=b.scrollX[t],r=b.scrollY[t],o=b.scrollWidth[t],i=b.scrollHeight[t],a=b.viewportWidth[t],x=b.viewportHeight[t],u=o-a,d=i-x,b$1=u>0?n/u*100:0,k=d>0?r/d*100:0;return {x:Math.min(100,Math.max(0,b$1)),y:Math.min(100,Math.max(0,k))}}function Ms(e,t,n,r){A(e,t);let o=b.scrollWidth[t],i=b.scrollHeight[t],a=b.viewportWidth[t],x=b.viewportHeight[t],u=Math.min(100,Math.max(0,n)),d=Math.min(100,Math.max(0,r)),b$1=Math.max(0,o-a),k=Math.max(0,i-x);return b.scrollX[t]=u/100*b$1,b.scrollY[t]=d/100*k,t}function Fs(e,t){if(m$1(e,t,b))return {scrollX:b.scrollX[t],scrollY:b.scrollY[t],scrollWidth:b.scrollWidth[t],scrollHeight:b.scrollHeight[t],viewportWidth:b.viewportWidth[t],viewportHeight:b.viewportHeight[t],scrollbarVisible:b.scrollbarVisible[t],trackVisible:b.trackVisible[t]===1,alwaysScroll:b.alwaysScroll[t]===1,clampEnabled:b.clampEnabled[t]===1}}function Bs(e,t){return m$1(e,t,b)}function Ds(e,t,n,r){return A(e,t),b.scrollWidth[t]=n,b.scrollHeight[t]=r,yt(t),t}function Rs(e,t,n,r){return A(e,t),b.viewportWidth[t]=n,b.viewportHeight[t]=r,yt(t),t}function Ls(e,t,n){return A(e,t),b.clampEnabled[t]=n?1:0,n&&yt(t),t}function Us(e,t,n){return A(e,t),b.scrollbarVisible[t]=n,t}function Os(e,t){return A(e,t),b.scrollY[t]=0,t}function Ps(e,t){A(e,t);let n=b.scrollHeight[t],r=b.viewportHeight[t];return b.scrollY[t]=Math.max(0,n-r),t}function Hs(e,t){return A(e,t),b.scrollX[t]=0,t}function Vs(e,t){A(e,t);let n=b.scrollWidth[t],r=b.viewportWidth[t];return b.scrollX[t]=Math.max(0,n-r),t}function ws(e,t){if(!m$1(e,t,b))return false;let n=b.scrollWidth[t],r=b.scrollHeight[t],o=b.viewportWidth[t],i=b.viewportHeight[t];return o>0||i>0?n>o||r>i:n>0||r>0}function Ns(e,t){if(!m$1(e,t,b))return false;let n=b.scrollWidth[t],r=b.viewportWidth[t];return n>r}function Ys(e,t){if(!m$1(e,t,b))return false;let n=b.scrollHeight[t],r=b.viewportHeight[t];return n>r}function Xs(e,t){return m$1(e,t,b)?b.scrollY[t]<=0:true}function Ks(e,t){if(!m$1(e,t,b))return true;let n=b.scrollY[t],r=b.scrollHeight[t],o=b.viewportHeight[t],i=Math.max(0,r-o);return n>=i}function Gs(e,t){return m$1(e,t,b)?b.scrollX[t]<=0:true}function zs(e,t){if(!m$1(e,t,b))return true;let n=b.scrollX[t],r=b.scrollWidth[t],o=b.viewportWidth[t],i=Math.max(0,r-o);return n>=i}export{ni as $,mr as $a,oe as $b,gn as $c,Ka as $d,Vs as $e,Rn as A,tr as Aa,Pr as Ab,sn as Ac,Aa as Ad,us as Ae,Uo as B,er as Ba,Hr as Bb,$r as Bc,ka as Bd,fs as Be,Oo as C,C as Ca,al as Cb,cn as Cc,_a as Cd,po as Ce,He as D,Ne as Da,sl as Db,Gl as Dc,Ma as Dd,ps as De,Po as E,Ye as Ea,cl as Eb,zl as Ec,Fa as Ed,ds as Ee,Ho as F,nr as Fa,It as Fb,jl as Fc,Ba as Fd,gs as Fe,Vo as G,rr as Ga,p as Gb,$l as Gc,Da as Gd,xs as Ge,wo as H,or as Ha,Qe as Hb,un as Hc,Ra as Hd,ys as He,Un as I,ir as Ia,Ze as Ib,ql as Ic,N as Id,bs as Ie,No as J,lr as Ja,tn as Jb,Jl as Jc,ce as Jd,ms as Je,Yo as K,ar as Ka,en as Kb,Ql as Kc,ue as Kd,hs as Ke,On as L,sr as La,pl as Lb,qr as Lc,fe as Ld,Is as Le,Et as M,cr as Ma,dl as Mb,Jr as Mc,pe as Md,mo as Me,zo as N,ur as Na,gl as Nb,Zl as Nc,de as Nd,Ts as Ne,jo as O,fr as Oa,xl as Ob,ta as Oc,ge as Od,As as Oe,Y as P,pr as Pa,yl as Pb,ea as Pc,xe as Pd,ks as Pe,Ot as Q,tt as Qa,bl as Qb,Qr as Qc,ye as Qd,_s as Qe,Ve as R,Xe as Ra,nn as Rb,na as Rc,be as Rd,Ms as Re,Pt as S,dr as Sa,ml as Sb,ie as Sc,me as Sd,Fs as Se,$o as T,Vt as Ta,hl as Tb,le as Tc,he as Td,Bs as Te,qo as U,gr as Ua,At as Ub,ae as Uc,s as Ud,Ds as Ue,Jo as V,xr as Va,El as Vb,se as Vc,mn as Vd,Rs as Ve,Qo as W,yr as Wa,Sl as Wb,g as Wc,Ya as Wd,Ls as We,Zo as X,Ct as Xa,Cl as Xb,fn as Xc,Sn as Xd,Us as Xe,ti as Y,br as Ya,vl as Yb,ca as Yc,Nt as Yd,Os as Ye,ei as Z,vt as Za,Wl as Zb,dn as Zc,Cn as Zd,Ps as Ze,Vn as _,Ke as _a,Nr as _b,wt as _c,Xa as _d,Hs as _e,D as a,ri as aa,ne as ab,Il as ac,to as ad,ao as ae,ws as af,I as b,$t as ba,hr as bb,Tl as bc,eo as bd,xt as be,Ns as bf,Wo as c,F as ca,Er as cb,Al as cc,ft as cd,Ga as ce,Ys as cf,h as d,Jt as da,re as db,kl as dc,ua as dd,za as de,Xs as df,Io as e,J as ea,Ar as eb,_l as ec,fa as ed,ja as ee,Ks as ef,W as f,Q as fa,Ge as fb,Ml as fc,pa as fd,$a as fe,Gs as ff,To as g,Qt as ga,kr as gb,Fl as gc,da as gd,qa as ge,zs as gf,Ao as h,Zt as ha,_r as hb,Bl as hc,ga as hd,Ja as he,P as i,f as ia,X as ib,Dl as ic,xa as id,so as ie,ko as j,Nn as ja,Zi as jb,Rl as jc,ya as jd,j as je,T as k,Yn as ka,tl as kb,Kr as kc,ba as kd,Qa as ke,_n as l,S as la,$e as lb,v as lc,no as ld,Za as le,bt as m,Z as ma,Br as mb,M as mc,ma as md,ts as me,Ue as n,O as na,Dr as nb,on as nc,xn as nd,es as ne,Oe as o,Ht as oa,Rr as ob,ln as oc,ha as od,ns as oe,Bo as p,Xn as pa,el as pb,Pl as pc,Ea as pd,co as pe,Do as q,Kn as qa,qe as qb,Hl as qc,yn as qd,rs as qe,L as r,Gn as ra,nl as rb,Vl as rc,Sa as rd,os as re,zt as s,zn as sa,Je as sb,jr as sc,Ca as sd,is as se,ht as t,te as ta,Lr as tb,wl as tc,ro as td,ls as te,jt as u,jn as ua,Ur as ub,Nl as uc,bn as ud,as as ue,Pe as v,$n as va,rl as vb,Yl as vc,va as vd,Yt as ve,Ro as w,qn as wa,Or as wb,Xl as wc,Wa as wd,ss as we,Lo as x,Jn as xa,ol as xb,at as xc,Ia as xd,uo as xe,Bn as y,Qn as ya,il as yb,Kl as yc,Ta as yd,cs as ye,Dn as z,Zn as za,ll as zb,_t as zc,oo as zd,fo as ze};
@@ -0,0 +1 @@
1
+ import {m,l as l$1}from'./chunk-7ZFQO3OQ.js';var u=1e4,r={hasData:new Uint8Array(u)},a=new Map;function c(e,t,n){return m(e,t,r)||l$1(e,t,r),r.hasData[t]=1,a.set(t,n),t}function D(e,t){if(!(!m(e,t,r)||r.hasData[t]===0))return a.get(t)}function f(e,t){let n=D(e,t);return n||(n={},c(e,t,n)),n}function i(e,t){return m(e,t,r)&&r.hasData[t]===1}function U(e,t){return i(e,t)?(r.hasData[t]=0,a.delete(t)):false}function l(){a.clear();}function y(){return a.size}export{r as a,c as b,D as c,f as d,i as e,U as f,l as g,y as h};
@@ -1 +1 @@
1
- import {m,l}from'./chunk-7ZFQO3OQ.js';import {g as g$1,f as f$1}from'./chunk-Z4EZERNE.js';var d=(o=>(o[o.Hidden=0]="Hidden",o[o.Visible=1]="Visible",o[o.Auto=2]="Auto",o))(d||{}),A={scrollX:new Float32Array(1e4),scrollY:new Float32Array(1e4),scrollWidth:new Float32Array(1e4),scrollHeight:new Float32Array(1e4),viewportWidth:new Float32Array(1e4),viewportHeight:new Float32Array(1e4),scrollbarVisible:new Uint8Array(1e4),trackVisible:new Uint8Array(1e4),alwaysScroll:new Uint8Array(1e4),clampEnabled:new Uint8Array(1e4)};var i=1e4,n={left:new Uint8Array(i),top:new Uint8Array(i),right:new Uint8Array(i),bottom:new Uint8Array(i)};function f(t){n.left[t]=0,n.top[t]=0,n.right[t]=0,n.bottom[t]=0;}function u(t,r){m(t,r,n)||(l(t,r,n),f(r));}function p(t,r,e){return g$1.parse(e),u(t,r),e.left!==void 0&&(n.left[r]=e.left),e.top!==void 0&&(n.top[r]=e.top),e.right!==void 0&&(n.right[r]=e.right),e.bottom!==void 0&&(n.bottom[r]=e.bottom),r}function g(t,r,e){return f$1.parse(e),u(t,r),n.left[r]=e,n.top[r]=e,n.right[r]=e,n.bottom[r]=e,r}function P(t,r,e,o){return f$1.parse(e),f$1.parse(o),u(t,r),n.left[r]=e,n.right[r]=e,n.top[r]=o,n.bottom[r]=o,r}function E(t,r){if(m(t,r,n))return {left:n.left[r],top:n.top[r],right:n.right[r],bottom:n.bottom[r]}}function h(t,r){return m(t,r,n)}function C(t,r){return m(t,r,n)?n.left[r]+n.right[r]:0}function T(t,r){return m(t,r,n)?n.top[r]+n.bottom[r]:0}function w(t,r){return m(t,r,n)?n.left[r]>0||n.top[r]>0||n.right[r]>0||n.bottom[r]>0:false}export{d as a,A as b,n as c,p as d,g as e,P as f,E as g,h,C as i,T as j,w as k};
1
+ import {g as g$1,f as f$1}from'./chunk-Z4EZERNE.js';import {m,l}from'./chunk-7ZFQO3OQ.js';var d=(o=>(o[o.Hidden=0]="Hidden",o[o.Visible=1]="Visible",o[o.Auto=2]="Auto",o))(d||{}),A={scrollX:new Float32Array(1e4),scrollY:new Float32Array(1e4),scrollWidth:new Float32Array(1e4),scrollHeight:new Float32Array(1e4),viewportWidth:new Float32Array(1e4),viewportHeight:new Float32Array(1e4),scrollbarVisible:new Uint8Array(1e4),trackVisible:new Uint8Array(1e4),alwaysScroll:new Uint8Array(1e4),clampEnabled:new Uint8Array(1e4)};var i=1e4,n={left:new Uint8Array(i),top:new Uint8Array(i),right:new Uint8Array(i),bottom:new Uint8Array(i)};function f(t){n.left[t]=0,n.top[t]=0,n.right[t]=0,n.bottom[t]=0;}function u(t,r){m(t,r,n)||(l(t,r,n),f(r));}function p(t,r,e){return g$1.parse(e),u(t,r),e.left!==void 0&&(n.left[r]=e.left),e.top!==void 0&&(n.top[r]=e.top),e.right!==void 0&&(n.right[r]=e.right),e.bottom!==void 0&&(n.bottom[r]=e.bottom),r}function g(t,r,e){return f$1.parse(e),u(t,r),n.left[r]=e,n.top[r]=e,n.right[r]=e,n.bottom[r]=e,r}function P(t,r,e,o){return f$1.parse(e),f$1.parse(o),u(t,r),n.left[r]=e,n.right[r]=e,n.top[r]=o,n.bottom[r]=o,r}function E(t,r){if(m(t,r,n))return {left:n.left[r],top:n.top[r],right:n.right[r],bottom:n.bottom[r]}}function h(t,r){return m(t,r,n)}function C(t,r){return m(t,r,n)?n.left[r]+n.right[r]:0}function T(t,r){return m(t,r,n)?n.top[r]+n.bottom[r]:0}function w(t,r){return m(t,r,n)?n.left[r]>0||n.top[r]>0||n.right[r]>0||n.bottom[r]>0:false}export{d as a,A as b,n as c,p as d,g as e,P as f,E as g,h,C as i,T as j,w as k};
@@ -0,0 +1 @@
1
+ import {f,b as b$1,i,a}from'./chunk-LIVVHEOU.js';import {m,l as l$1}from'./chunk-7ZFQO3OQ.js';var c=0,d=2147483647,u=-2147483648,y=1e4,n={zIndex:new Int32Array(y),localZ:new Int32Array(y)};function I(t){n.zIndex[t]=c,n.localZ[t]=c;}function s(t,e){m(t,e,n)||(l$1(t,e,n),I(e));}function nt(t,e){return m(t,e,n)?n.zIndex[e]??c:c}function ot(t,e){return m(t,e,n)?n.localZ[e]??c:c}function it(t,e){return m(t,e,n)}function rt(t,e,o){s(t,e),n.zIndex[e]=Math.max(u,Math.min(d,Math.floor(o)));}function ct(t,e,o){s(t,e),n.localZ[e]=Math.max(u,Math.min(d,Math.floor(o)));}function ft(t,e){s(t,e);let o=l(t,e);if(o.length===0)return;let i=n.zIndex[e]??c;for(let r of o)if(m(t,r,n)){let f=n.zIndex[r]??c;f>=i&&(i=f+1);}n.zIndex[e]=i;}function at(t,e){s(t,e);let o=l(t,e);if(o.length===0)return;let i=n.zIndex[e]??c;for(let r of o)if(m(t,r,n)){let f=n.zIndex[r]??c;f<=i&&(i=f-1);}n.zIndex[e]=i;}function xt(t,e){s(t,e);let o=l(t,e),i=n.zIndex[e]??c,r=null,f=d;for(let x of o)if(m(t,x,n)){let g=n.zIndex[x]??c;g>i&&g<f&&(r=x,f=g);}return r!==null?(n.zIndex[e]=f,n.zIndex[r]=i,true):false}function gt(t,e){s(t,e);let o=l(t,e),i=n.zIndex[e]??c,r=null,f=u;for(let x of o)if(m(t,x,n)){let g=n.zIndex[x]??c;g<i&&g>f&&(r=x,f=g);}return r!==null?(n.zIndex[e]=f,n.zIndex[r]=i,true):false}function p(t,e){return [...e].sort((o,i)=>{let r=m(t,o,n)?n.zIndex[o]??c:c,f=m(t,i,n)?n.zIndex[i]??c:c;return r-f})}function b(t,e){let o=f(t,e);return p(t,o)}function l(t,e){if(!m(t,e,b$1))return [];let o=i(t,e);return o===a?[]:f(t,o).filter(r=>r!==e)}function st(t,e){let o=b(t,e);for(let i=0;i<o.length;i++){let r=o[i];r!==void 0&&(s(t,r),n.zIndex[r]=i);}}function lt(t){n.zIndex[t]=c,n.localZ[t]=c;}export{c as a,d as b,u as c,n as d,nt as e,ot as f,it as g,rt as h,ct as i,ft as j,at as k,xt as l,gt as m,p as n,b as o,st as p,lt as q};
@@ -0,0 +1 @@
1
+ import {b,d as d$2}from'./chunk-4LWWONFK.js';import {c,a as a$2}from'./chunk-FJLSHFCF.js';import {k as k$1}from'./chunk-VOCM5T2G.js';import {d as d$1,A,i,B as B$1}from'./chunk-LNEISTXM.js';import {a,e,r,o as o$1,t}from'./chunk-C5PCEQ6G.js';import {p as p$1,k}from'./chunk-EOFT3PNU.js';import {G}from'./chunk-JB5KFQPD.js';import {I,V,N,K}from'./chunk-LIVVHEOU.js';import {o,a as a$1,m}from'./chunk-7ZFQO3OQ.js';import {z}from'zod';var d=z.number().int().min(0).max(4294967295),Q=z.number().int().min(0).max(65535),te=z.object({fg:d.optional(),bg:d.optional(),selectedFg:d.optional(),selectedBg:d.optional(),cursorFg:d.optional(),cursorBg:d.optional(),showLineNumbers:z.boolean().optional(),lineNumberWidth:z.number().int().nonnegative().max(20).optional(),attrs:Q.optional()}),Ce=z.object({fg:d.default(4294967295),bg:d.default(255),selectedFg:d.default(255),selectedBg:d.default(4294967295),cursorFg:d.default(255),cursorBg:d.default(16711935),showLineNumbers:z.boolean().default(false),lineNumberWidth:z.number().int().nonnegative().max(20).default(0),attrs:Q.default(a.NONE)}),T={fg:4294967295,bg:255,selectedFg:255,selectedBg:4294967295,cursorFg:255,cursorBg:16711935,showLineNumbers:false,lineNumberWidth:0,attrs:a.NONE},p=null;function L(t){return a$1(t,"virtualRender:lineStore")}function B(t){return a$1(t,"virtualRender:lineConfig")}function Se(t){p=t;}function Ne(){return p}function Ve(){p=null;}function ve(t,e,r){L(t).set(e,r);}function We(t,e){return L(t).get(e)}function ze(t,e){L(t).delete(e);}function De(t,e,r){L(t).set(e,r);}function we(t,e,r){let f=te.parse(r),i={};for(let[o,u]of Object.entries(f))u!==void 0&&(i[o]=u);let n=B(t).get(e)??T;B(t).set(e,{...n,...i});}function ne(t,e){return B(t).get(e)??T}function Fe(t,e){B(t).delete(e);}function re(t,e){if(!m(t,e,I))return a.NONE;let r=a.NONE;return I.bold[e]===1&&(r|=a.BOLD),I.underline[e]===1&&(r|=a.UNDERLINE),I.blink[e]===1&&(r|=a.BLINK),I.inverse[e]===1&&(r|=a.INVERSE),r}function ie(t,e){if(c(t,e))return {x:a$2.x[e],y:a$2.y[e],width:a$2.width[e],height:a$2.height[e]}}function oe(t,e){return p$1(t,e)?{top:k.top[e]===1?1:0,right:k.right[e]===1?1:0,bottom:k.bottom[e]===1?1:0,left:k.left[e]===1?1:0}:{top:0,right:0,bottom:0,left:0}}function fe(t,e){return {x:t.x+e.left,y:t.y+e.top,width:Math.max(0,t.width-e.left-e.right),height:Math.max(0,t.height-e.top-e.bottom)}}function O(t$1,e$1,r,f,i,n,o,u){let m=e(" ",n,o,u);for(let l=0;l<f;l++)o$1(t$1,e$1+l,r,m);let a=i.length>f?i.slice(0,f):i;a.length>0&&t(t$1,e$1,r,a,n,o,u);}function ue(t$1,e,r,f,i,n,o){let u=`${String(i+1).padStart(f-1," ")} `;t(t$1,e,r,u.slice(0,f),n,o,a.DIM);}function le(t,e,r,f,i,n){let{buffer:o}=t,{x:u,y:m,width:a$1,height:l}=r,x=k$1(i,f.start,f.end),N=n.showLineNumbers?u+n.lineNumberWidth:u,V=n.showLineNumbers?Math.max(0,a$1-n.lineNumberWidth):a$1,b=d$1.selectedLine[e],v=d$1.cursorLine[e];for(let c=0;c<x.lines.length;c++){let E=m+c;if(c>=l)break;let z=x.startLine+c,ee=x.lines[c]??"",D=n.fg,w=n.bg;z===v?(D=n.cursorFg,w=n.cursorBg):z===b&&(D=n.selectedFg,w=n.selectedBg),n.showLineNumbers&&ue(o,u,E,n.lineNumberWidth,z,n.fg,n.bg),O(o,N,E,V,ee,D,w,n.attrs);}let Z=Math.min(x.lines.length,l);for(let c=Z;c<l;c++){let E=m+c;n.showLineNumbers&&O(o,u,E,n.lineNumberWidth,"",n.fg,n.bg,a.NONE),O(o,N,E,V,"",n.fg,n.bg,a.NONE);}}function ae(t,e$1,r,f,i){if(r<=i)return;let{buffer:n}=t,o=e$1.height,u=e$1.x+e$1.width-1,m=e$1.y,a=i/r,l=Math.max(1,Math.floor(o*a)),x=Math.floor(f/r*o),N=e("\u2502",1717987071,255);for(let b=0;b<o;b++)o$1(n,u,m+b,N);let V=e("\u2588",2863311615,255);for(let b=0;b<l;b++){let v=m+x+b;v<m+o&&o$1(n,u,v,V);}}function se(t,e$1,r$1){let{world:f,buffer:i}=t,n=K(f,e$1);if(!n||n.transparent)return;let o=re(f,e$1),u=e(" ",n.fg,n.bg,o);r(i,r$1.x,r$1.y,r$1.width,r$1.height,u);}function de(t,e){let{world:r,doubleBuffer:f}=t,i$1=ie(r,e);if(!i$1||i$1.width<=0||i$1.height<=0)return;let n=L(r).get(e);if(!n)return;let o=i(r,e);if(!o)return;let u=ne(r,e);se(t,e,i$1);let m=oe(r,e),a=fe(i$1,m);a.width>0&&a.height>0&&le(t,e,a,o,n,u);let l={firstVisibleLine:d$1.firstVisibleLine[e],visibleLineCount:d$1.visibleLineCount[e],totalLineCount:d$1.totalLineCount[e]};l.totalLineCount>l.visibleLineCount&&ae(t,a,l.totalLineCount,l.firstVisibleLine,l.visibleLineCount),d$2(f,i$1.x,i$1.y,i$1.width,i$1.height),B$1(r,e),N(r,e);}var me=t=>{if(!p)return t;let e=b(p),r={world:t,buffer:e,doubleBuffer:p},f=o(t,[d$1,G,I]);for(let i of f)V(t,i)&&(!A(t,i)&&I.dirty[i]!==1||de(r,i));return t};function Me(){return me}function Oe(t){p=null,L(t).clear(),B(t).clear();}function ke(t,e){L(t).delete(e),B(t).delete(e);}export{Ce as a,Se as b,Ne as c,Ve as d,ve as e,We as f,ze as g,De as h,we as i,ne as j,Fe as k,me as l,Me as m,Oe as n,ke as o};
@@ -0,0 +1 @@
1
+ import {i}from'./chunk-Z4EZERNE.js';import {r as r$1,m as m$1,l,v as v$1}from'./chunk-7ZFQO3OQ.js';var b=1e4,a=0,r={parent:new Uint32Array(b),firstChild:new Uint32Array(b),nextSibling:new Uint32Array(b),prevSibling:new Uint32Array(b),childCount:new Uint16Array(b),depth:new Uint16Array(b)};function R(n){r.parent[n]=a,r.firstChild[n]=a,r.nextSibling[n]=a,r.prevSibling[n]=a,r.childCount[n]=0,r.depth[n]=0;}function p(n,t){m$1(n,t,r)||(l(n,t,r),R(t));}function d(n,t){r.depth[n]=t;let e=r.firstChild[n];for(;e!==a;)d(e,t+1),e=r.nextSibling[e];}function S(n,t,e){p(n,t),e!==a&&p(n,e);let i=r.parent[t];return i===e||(i!==a&&m(t,i),e!==a?H(t,e):(r.parent[t]=a,d(t,0))),t}function m(n,t){let e=r.prevSibling[n],i=r.nextSibling[n];e!==a?r.nextSibling[e]=i:r.firstChild[t]=i,i!==a&&(r.prevSibling[i]=e),r.prevSibling[n]=a,r.nextSibling[n]=a,r.childCount[t]=r.childCount[t]-1;}function H(n,t){r.parent[n]=t;let e=r.firstChild[t];if(e===a)r.firstChild[t]=n;else {let o=e;for(;r.nextSibling[o]!==a;)o=r.nextSibling[o];r.nextSibling[o]=n,r.prevSibling[n]=o;}r.childCount[t]=r.childCount[t]+1;let i=r.depth[t];d(n,i+1);}function O(n,t,e){return S(n,e,t),t}function z(n,t,e){return !m$1(n,e,r)||r.parent[e]!==t||S(n,e,a),t}function J(n,t){if(!m$1(n,t,r))return [];let e=[],i=r.firstChild[t];for(;i!==a;)e.push(i),i=r.nextSibling[i];return e}function v(n,t){if(!m$1(n,t,r))return [];let e=[],i=r.parent[t];for(;i!==a;)e.push(i),i=r.parent[i];return e}function K(n,t){if(!m$1(n,t,r))return [];let e=[],i=[],o=r.firstChild[t];for(;o!==a;)i.push(o),o=r.nextSibling[o];for(;i.length>0;){let u=i.pop();e.push(u);let y=[],f=r.firstChild[u];for(;f!==a;)y.push(f),f=r.nextSibling[f];for(let c=y.length-1;c>=0;c--)i.push(y[c]);}return e}function Q(n,t){return m$1(n,t,r)?r.parent[t]:a}function X(n,t){if(m$1(n,t,r))return {parent:r.parent[t],firstChild:r.firstChild[t],nextSibling:r.nextSibling[t],prevSibling:r.prevSibling[t],childCount:r.childCount[t],depth:r.depth[t]}}function W(n,t){return m$1(n,t,r)}function A(n,t){return m$1(n,t,r)?r.parent[t]===a:true}function Z(n,t){return m$1(n,t,r)?r.childCount[t]===0:true}function $(n,t){return m$1(n,t,r)?r.depth[t]:0}function tt(n,t){return m$1(n,t,r)?r.nextSibling[t]:a}function nt(n,t){return m$1(n,t,r)?r.prevSibling[t]:a}function L(n,t,e){p(n,e),p(n,t);let i=r.parent[e];i!==a&&m(e,i);let o=r.firstChild[t];r.parent[e]=t,r.firstChild[t]=e,r.prevSibling[e]=a,r.nextSibling[e]=o,o!==a&&(r.prevSibling[o]=e),r.childCount[t]=r.childCount[t]+1;let u=r.depth[t];return d(e,u+1),t}function rt(n,t,e,i){p(n,t);let o=r.childCount[t],u=i;if(u<0&&(u=Math.max(0,o+u)),u>=o)return O(n,t,e);if(u===0)return L(n,t,e);let y=r.firstChild[t];for(let f=0;f<u;f++)y=r.nextSibling[y];return F(n,e,y)}function F(n,t,e){if(!m$1(n,e,r))return t;let i=r.parent[e];if(i===a)return t;p(n,t);let o=r.parent[t];o!==a&&m(t,o);let u=r.prevSibling[e];r.parent[t]=i,r.prevSibling[t]=u,r.nextSibling[t]=e,r.prevSibling[e]=t,u!==a?r.nextSibling[u]=t:r.firstChild[i]=t,r.childCount[i]=r.childCount[i]+1;let y=r.depth[i];return d(t,y+1),t}function et(n,t,e){if(!m$1(n,e,r))return t;let i=r.parent[e];if(i===a)return t;p(n,t);let o=r.parent[t];o!==a&&m(t,o);let u=r.nextSibling[e];r.parent[t]=i,r.prevSibling[t]=e,r.nextSibling[t]=u,r.nextSibling[e]=t,u!==a&&(r.prevSibling[u]=t),r.childCount[i]=r.childCount[i]+1;let y=r.depth[i];return d(t,y+1),t}function it(n,t){return S(n,t,a)}function ot(n,t){if(!m$1(n,t,r))return a;let e=r.firstChild[t];if(e===a)return a;for(;r.nextSibling[e]!==a;)e=r.nextSibling[e];return e}function at(n,t){return m$1(n,t,r)?r.firstChild[t]:a}function st(n,t){if(!m$1(n,t,r))return -1;let e=r.parent[t];if(e===a)return -1;let i=0,o=r.firstChild[e];for(;o!==a;){if(o===t)return i;i++,o=r.nextSibling[o];}return -1}function lt(n,t,e){if(!m$1(n,t,r)||e<0)return a;let i=r.firstChild[t];for(let o=0;o<e&&i!==a;o++)i=r.nextSibling[i];return i}function w(n,t){let e=[],i=r.firstChild[n];for(;i!==a;)e.push({entity:i,depth:t}),i=r.nextSibling[i];return e}function P(n,t){for(let e=n.length-1;e>=0;e--){let i=n[e];i&&t.push(i);}}function ut(n,t,e){if(!m$1(n,t,r))return true;let i=[],o=r.depth[t]??0,u=w(t,o+1);for(P(u,i);i.length>0;){let y=i.pop();if(!y)continue;let{entity:f,depth:c}=y;if(e(f,c-o)===false)return false;let I=w(f,c+1);P(I,i);}return true}function yt(n,t,e){if(!m$1(n,t,r))return true;let i=1,o=r.parent[t];for(;o!==a;){if(e(o,i)===false)return false;o=r.parent[o],i++;}return true}function V(n,t,e){if(!m$1(n,t,r)||!m$1(n,e,r)||t===e)return false;let i=r.parent[e];for(;i!==a;){if(i===t)return true;i=r.parent[i];}return false}function ft(n,t,e){return V(n,e,t)}function Et(n,t){if(!m$1(n,t,r))return t;let e=t,i=r.parent[e];for(;i!==a;)e=i,i=r.parent[e];return e}function pt(n,t,e){if(!m$1(n,t,r)||!m$1(n,e,r))return a;let i=new Set;i.add(t);let o=r.parent[t];for(;o!==a;)i.add(o),o=r.parent[o];if(i.has(e))return e;for(o=r.parent[e];o!==a;){if(i.has(o))return o;o=r.parent[o];}return a}function ct(n,t){if(!m$1(n,t,r))return [];let e=r.parent[t];if(e===a)return [];let i=[],o=r.firstChild[e];for(;o!==a;)o!==t&&i.push(o),o=r.nextSibling[o];return i}var E=1e4,_=r$1(255,255,255),M=r$1(0,0,0,0),s={visible:new Uint8Array(E),dirty:new Uint8Array(E),fg:new Uint32Array(E),bg:new Uint32Array(E),bold:new Uint8Array(E),underline:new Uint8Array(E),blink:new Uint8Array(E),inverse:new Uint8Array(E),transparent:new Uint8Array(E),opacity:new Uint8Array(E)};function B(n){s.visible[n]=1,s.dirty[n]=1,s.fg[n]=_,s.bg[n]=M,s.bold[n]=0,s.underline[n]=0,s.blink[n]=0,s.inverse[n]=0,s.transparent[n]=0,s.opacity[n]=255;}function D(n,t){m$1(n,t,s)||(l(n,t,s),B(t));}function vt(n,t,e){return i.parse(e),D(n,t),G(t,e),s.dirty[t]=1,t}function N(n,t){t.fg!==void 0&&(s.fg[n]=v$1(t.fg)),t.bg!==void 0&&(s.bg[n]=v$1(t.bg));}function g(n,t,e){e!==void 0&&(t[n]=e?1:0);}function Y(n,t){if(g(n,s.bold,t.bold),g(n,s.underline,t.underline),g(n,s.blink,t.blink),g(n,s.inverse,t.inverse),g(n,s.transparent,t.transparent),t.opacity!==void 0){let e=Math.max(0,Math.min(1,t.opacity));s.opacity[n]=Math.round(e*255);}}function G(n,t){N(n,t),Y(n,t);}function Wt(n,t){if(m$1(n,t,s))return {fg:s.fg[t],bg:s.bg[t],bold:s.bold[t]===1,underline:s.underline[t]===1,blink:s.blink[t]===1,inverse:s.inverse[t]===1,transparent:s.transparent[t]===1,opacity:s.opacity[t]/255}}function At(n,t){if(m$1(n,t,s))return {visible:s.visible[t]===1,dirty:s.dirty[t]===1,fg:s.fg[t],bg:s.bg[t],bold:s.bold[t]===1,underline:s.underline[t]===1,blink:s.blink[t]===1,inverse:s.inverse[t]===1,transparent:s.transparent[t]===1,opacity:s.opacity[t]/255}}function kt(n,t){return D(n,t),s.dirty[t]=1,t}function Dt(n,t){return m$1(n,t,s)&&(s.dirty[t]=0),t}function Ut(n,t){return m$1(n,t,s)?s.dirty[t]===1:false}function U(n,t,e){D(n,t);let i=s.visible[t]===1;return s.visible[t]=e?1:0,i!==e&&(s.dirty[t]=1),t}function k(n,t){return m$1(n,t,s)?s.visible[t]===1:false}function Tt(n,t){return m$1(n,t,s)}function wt(n,t){return U(n,t,true)}function Pt(n,t){return U(n,t,false)}function It(n,t){let e=k(n,t);return U(n,t,!e)}function Rt(n,t){if(!k(n,t))return false;if(!W(n,t))return true;let e=v(n,t);for(let i of e)if(!k(n,i))return false;return true}function Ht(n,t){if(!W(n,t)||A(n,t))return false;let e=v(n,t);if(e.length===0)return true;let i=e[e.length-1];return i===void 0?true:!A(n,i)}export{yt as A,V as B,ft as C,Et as D,pt as E,ct as F,_ as G,M as H,s as I,vt as J,Wt as K,At as L,kt as M,Dt as N,Ut as O,U as P,k as Q,Tt as R,wt as S,Pt as T,It as U,Rt as V,Ht as W,a,r as b,S as c,O as d,z as e,J as f,v as g,K as h,Q as i,X as j,W as k,A as l,Z as m,$ as n,tt as o,nt as p,L as q,rt as r,F as s,et as t,it as u,ot as v,at as w,st as x,lt as y,ut as z};
@@ -0,0 +1 @@
1
+ import {g as g$1,f}from'./chunk-JB5KFQPD.js';import {a as a$1,I as I$1}from'./chunk-LIVVHEOU.js';import {l as l$1,m}from'./chunk-7ZFQO3OQ.js';var l=1e4,h={BLOCK:0,UNDERLINE:1,BAR:2,BLINKING_BLOCK:3,BLINKING_UNDERLINE:4,BLINKING_BAR:5},o={cursorX:new Uint16Array(l),cursorY:new Uint16Array(l),cursorVisible:new Uint8Array(l),cursorShape:new Uint8Array(l),focused:new Uint32Array(l),hovered:new Uint32Array(l),fullUnicode:new Uint8Array(l),autoPadding:new Uint8Array(l)},a=new WeakMap;function x(r,e,n={}){l$1(r,e,o),o.cursorX[e]=0,o.cursorY[e]=0,o.cursorVisible[e]=n.cursorVisible!==false?1:0,o.cursorShape[e]=n.cursorShape??h.BLOCK,o.focused[e]=a$1,o.hovered[e]=a$1,o.fullUnicode[e]=n.fullUnicode!==false?1:0,o.autoPadding[e]=n.autoPadding===true?1:0;}function g(r){return a.has(r)}function W(r,e){if(a.has(r))throw new Error("A screen already exists in this world. Only one screen is allowed.");a.set(r,e);}function C(r){return a.get(r)??null}function U(r,e){return a.get(r)===e}function t(r,e){return m(r,e,o)}function v(r,e){if(t(r,e))return {x:o.cursorX[e],y:o.cursorY[e],visible:o.cursorVisible[e]===1,shape:o.cursorShape[e]}}function A(r,e,n,i){return t(r,e)?(o.cursorX[e]=Math.max(0,Math.floor(n)),o.cursorY[e]=Math.max(0,Math.floor(i)),true):false}function V(r,e,n){return t(r,e)?(o.cursorVisible[e]=n?1:0,true):false}function w(r,e,n){return t(r,e)?(o.cursorShape[e]=n,true):false}function N(r,e){if(!t(r,e))return null;let n=o.focused[e];return n===a$1?null:n}function P(r,e,n){return t(r,e)?(o.focused[e]=n??a$1,true):false}function L(r,e){if(!t(r,e))return null;let n=o.hovered[e];return n===a$1?null:n}function I(r,e,n){return t(r,e)?(o.hovered[e]=n??a$1,true):false}function B(r,e){if(!t(r,e))return;let n=g$1(r,e),i=o.focused[e],c=o.hovered[e];return {cursor:{x:o.cursorX[e],y:o.cursorY[e],visible:o.cursorVisible[e]===1,shape:o.cursorShape[e]},focused:i===a$1?null:i,hovered:c===a$1?null:c,fullUnicode:o.fullUnicode[e]===1,autoPadding:o.autoPadding[e]===1,width:n?.width??0,height:n?.height??0}}function D(r,e){if(!t(r,e))return;let n=g$1(r,e);if(n)return {width:n.width,height:n.height}}function Y(r,e,n,i){return !t(r,e)||n<=0||i<=0?false:(f(r,e,n,i),I$1.dirty[e]=1,true)}function K(r,e){return t(r,e)?o.fullUnicode[e]===1:false}function M(r,e,n){return t(r,e)?(o.fullUnicode[e]=n?1:0,true):false}function O(r,e){return t(r,e)?o.autoPadding[e]===1:false}function F(r,e,n){return t(r,e)?(o.autoPadding[e]=n?1:0,true):false}function R(r){return a.get(r)===void 0?false:(a.delete(r),true)}function X(r){a.delete(r);}export{h as a,o as b,x as c,g as d,W as e,C as f,U as g,t as h,v as i,A as j,V as k,w as l,N as m,P as n,L as o,I as p,B as q,D as r,Y as s,K as t,M as u,O as v,F as w,R as x,X as y};
@@ -1 +1 @@
1
- import {h,m,i,e,g as g$2,l as l$1}from'./chunk-VIT4KE6Q.js';import {a}from'./chunk-5N3O25O7.js';import {a as a$1,b,j as j$1,f,g as g$1}from'./chunk-RJULLVTH.js';import {M}from'./chunk-ETFDYZVJ.js';import {h as h$1,l,m as m$1,n}from'./chunk-7ZFQO3OQ.js';import {z}from'zod';z.object({enabled:z.boolean(),historySize:z.number().int().nonnegative().optional()});z.object({enabled:z.boolean(),budgetMs:z.number().positive().optional(),skippablePhases:z.array(z.nativeEnum(a)).readonly().optional()});var w=0,Te=process.env.BLECSD_PACKED_ADAPTER==="1",_=new WeakSet;function ze(){return w}function te(t){t.sort((e,n)=>e.priority-n.priority);}function Ue(){let t=new Map,e$1=[],n=false,r=0,d=[],l=null,c=0,p=false,T=16.67,E=new Set([4]),W=null;for(let o=0;o<=7;o++)t.set(o,[]);function F(o){if(Te&&!_.has(o)){if(h(o)!==e){_.add(o);return}g$2(o,l$1()),_.add(o);}}function re(){let o=[];for(let a=0;a<=7;a++)o.push({phase:a,duration:0,systemCount:0});return {phases:o,totalFrameTime:0,frameNumber:c++,adapterSyncMs:0}}function L(o,a,s){if(!n||!l)return;let i=l.phases[o];i&&(i.duration=a,i.systemCount=s);}function ae(){if(!n||!l)return;let o=0;for(let a of l.phases)o+=a.duration;if(l.totalFrameTime=o,r>0)for(d.push(l);d.length>r;)d.shift();}function se(o){let a=h(o),s=m(a)?a:null,i$1=s?.syncMode!=="render_only";return {syncAdapter:S=>{if(!s)return;let f=S??o;if(!n||!l){i(f);return}let y=performance.now();i(f),l.adapterSyncMs+=performance.now()-y;},shouldSyncInput:i$1,shouldSyncPhase:S=>s?s.syncMode==="all"?true:S===6:false}}function ie(o,a,s){let i=o;s&&a(i);for(let u of e$1)i=u.system(i);return i}function le(o,a){return p&&a&&E.has(o)}function de(o,a,s){let i=o;s(i);for(let u of a)i=u.system(i);return i}function ce(o,a){if(n)if(o===0){let s=performance.now();L(o,s-a,e$1.length);}else L(o,0,0);}function ue(o,a){return o===0?a:n||p?performance.now():0}function fe(o,a,s,i){n&&L(o,s-a,i);}function pe(o,a,s){return !p||s?s:a-o>T}function ye(o,a,s){if(!p)return;let u=performance.now()-o;W={exceeded:a,skippedPhases:[...s],remainingMs:T-u};}function me(o,a,s,i,u,m,S,f,y){if(le(a,m))return S.push(a),n&&L(a,0,0),{world:o,budgetExceeded:m};let h=ue(a,u),ge=de(o,s,Pe=>{y(a)&&f(Pe);}),$=n||p?performance.now():0,he=a===0?e$1.length+s.length:s.length;fe(a,h,$,he);let be=pe(i,$,m);return {world:ge,budgetExceeded:be}}function Se(o,a,s,i,u){let m=o,S=[],f=false;for(let y=0;y<=7;y++){let h=t.get(y);if(!h){ce(y,s);continue}let z=me(m,y,h,a,s,f,S,i,u);m=z.world,f=z.budgetExceeded;}return {world:m,skippedPhases:S,budgetExceeded:f}}return {registerSystem(o,a,s=0){if(o===0)throw new Error("Cannot register systems to INPUT phase. INPUT phase is protected and always runs first.");let i=t.get(o);i&&(i.push({system:a,priority:s}),te(i));},registerInputSystem(o,a=0){e$1.push({system:o,priority:a}),te(e$1);},unregisterSystem(o){for(let[a,s]of t){if(a===0)continue;let i=s.findIndex(u=>u.system===o);i!==-1&&s.splice(i,1);}},unregisterInputSystem(o){let a=e$1.findIndex(s=>s.system===o);a!==-1&&e$1.splice(a,1);},run(o,a){w=a,n&&(l=re());let s=p||n?performance.now():0,i=o;F(i);let{syncAdapter:u,shouldSyncInput:m,shouldSyncPhase:S}=se(i),f=n||p?performance.now():0;i=ie(i,u,m);let y=Se(i,s,f,u,S);return i=y.world,n&&ae(),ye(s,y.budgetExceeded,y.skippedPhases),i},runInputOnly(o,a){w=a;let s=o;F(s);let i$1=h(s),m$1=(m(i$1)?i$1:null)?.syncMode!=="render_only";m$1&&i(s);for(let f of e$1)s=f.system(s);let S=t.get(0);if(S){m$1&&i(s);for(let f of S)s=f.system(s);}return s},runFixedUpdatePhases(o,a){w=a;let s=o;F(s);let i$1=h(s),u=m(i$1)?i$1:null,m$1=!!u&&u.syncMode==="all",S=[1,2,3,4];for(let f of S){let y=t.get(f);if(y){m$1&&i(s);for(let h of y)s=h.system(s);}}return s},runRenderPhases(o,a){w=a;let s=o;F(s);let i$1=h(s),u=m(i$1)?i$1:null,m$1=f=>u?u.syncMode==="all"?true:f===6:false,S=[5,6,7];for(let f of S){let y=t.get(f);if(y){m$1(f)&&i(s);for(let h of y)s=h.system(s);}}return s},getSystemsForPhase(o){if(o===0)return e$1.map(s=>s.system);let a=t.get(o);return a?a.map(s=>s.system):[]},getSystemCount(o){if(o===0)return e$1.length;let a=t.get(o);return a?a.length:0},getTotalSystemCount(){let o=e$1.length;for(let a of t.values())o+=a.length;return o},hasSystem(o){if(e$1.some(a=>a.system===o))return true;for(let a of t.values())if(a.some(s=>s.system===o))return true;return false},clearPhase(o){if(o===0)throw new Error("Cannot clear INPUT phase. INPUT phase is protected.");let a=t.get(o);a&&(a.length=0);},clearAllSystems(){for(let[o,a]of t)o!==0&&(a.length=0);},enableTelemetry(o={enabled:true}){n=o.enabled,r=o.historySize??0,n||(d.length=0,l=null);},disableTelemetry(){n=false,d.length=0,l=null;},getTelemetry(){return l},getTelemetryHistory(){return d},isTelemetryEnabled(){return n},enableFrameBudget(o={enabled:true}){p=o.enabled,T=o.budgetMs??16.67,o.skippablePhases?E=new Set(o.skippablePhases):E=new Set([4]),E.delete(0),p||(W=null);},disableFrameBudget(){p=false,W=null;},getAdaptiveFrameBudgetStatus(){return W},isFrameBudgetEnabled(){return p}}}var k=[],R=0,oe=new Set;function G(t){let e=k[k.length-1];e&&(e.dependencies.add(t),t.subscribers.add(e));}function ne(t){t.dirty=true,t.onNotify&&t.onNotify();}function D(t){if(R>0){for(let e of t.subscribers)e.dirty||(ne(e),oe.add(e),D(e));return}for(let e of t.subscribers)e.dirty||(ne(e),D(e));}function V(t){for(let e of t.dependencies)e.subscribers.delete(t);t.dependencies.clear();}function _e(t){let e={value:t,subscribers:new Set,version:0};return [()=>(G(e),e.value),d=>{let l=typeof d=="function"?d(e.value):d;Object.is(l,e.value)||(e.value=l,e.version++,D(e));}]}var O=new WeakMap;function Oe(t){let e={fn:t,value:void 0,dependencies:new Set,subscribers:new Set,dirty:true,version:0,computing:false},n=()=>{if(e.computing)throw new Error("Circular dependency detected in computed signal");if(e.dirty){e.computing=true,V(e),k.push(e);try{e.value=e.fn(),e.dirty=!1,e.version++;}finally{k.pop(),e.computing=false;}}return G(e),e.value};return n(),O.set(n,e),n}function Ge(t){R++;try{t();}finally{R--,R===0&&oe.clear();}}function Ve(t,e,n){let r={value:n,subscribers:new Set,version:0,world:t,eid:e};return [()=>(G(r),r.value),c=>{let p=typeof c=="function"?c(r.value):c;Object.is(p,r.value)||(r.value=p,r.version++,D(r),M(r.world,r.eid));}]}function je(t){let e=O.get(t);e&&(V(e),O.delete(t));}function j(t,e){let n={fn:()=>{},value:void 0,dependencies:new Set,subscribers:new Set,dirty:false,version:0,computing:false,onNotify:()=>{n.dirty=false,e();}};k.push(n);try{t();}finally{k.pop();}return ()=>{V(n);}}var C=[];function Qe(t){let e=null,n=false,r=()=>{if(n)return;e&&(e(),e=null);let l=t();typeof l=="function"&&(e=l);},d=j(r,r);return {dispose:()=>{n||(n=true,d(),e&&(e(),e=null));}}}function qe(t,e=3){let n={fn:t,phase:e,markDirty:()=>{n.disposed||(n.dirty=true);},dirty:true,cleanup:null,stopTracking:null,disposed:false};return C.push(n),{dispose:()=>{if(n.disposed)return;n.disposed=true,n.stopTracking&&(n.stopTracking(),n.stopTracking=null),n.cleanup&&(n.cleanup(),n.cleanup=null);let r=C.indexOf(n);r!==-1&&C.splice(r,1);}}}function Ke(t){t.dispose();}function Je(t){for(let e of C)if(!(e.phase!==t||e.disposed)&&e.dirty)if(e.dirty=false,e.stopTracking){e.cleanup&&(e.cleanup(),e.cleanup=null);let n=e.fn();typeof n=="function"&&(e.cleanup=n);}else {let n=()=>{if(e.disposed)return;e.cleanup&&(e.cleanup(),e.cleanup=null);let r=e.fn();typeof r=="function"&&(e.cleanup=r);};e.stopTracking=j(n,e.markDirty);}}function Xe(t){return C.filter(e=>e.phase===t&&!e.disposed).length}function Ze(){return C.filter(t=>!t.disposed).length}function ve(t=1024){let e=Math.max(1,t),n=new Uint32Array(e),r=new Int32Array(e);for(let d=0;d<e-1;d++)r[d]=d+1;return r[e-1]=-1,{generations:n,freeList:r,freeHead:0,capacity:e,size:0}}function Ee(t){let e=t.capacity,n=e*2,r=new Uint32Array(n);r.set(t.generations);let d=new Int32Array(n);d.set(t.freeList);for(let l=e;l<n-1;l++)d[l]=l+1;d[n-1]=t.freeHead,t.freeHead=e,t.generations=r,t.freeList=d,t.capacity=n;}function Ae(t){t.freeHead===-1&&Ee(t);let e=t.freeHead,n=t.freeList[e];t.freeHead=n!==void 0?n:-1,t.freeList[e]=-2,t.size++;let r=t.generations[e];return {index:e,gen:r!==void 0?r:0}}function Y(t,e){return e.index<0||e.index>=t.capacity?false:t.generations[e.index]===e.gen&&t.freeList[e.index]===-2}function xe(t,e){if(!Y(t,e))return false;let{index:n}=e,r=t.generations[n];return r!==void 0&&(t.generations[n]=r+1),t.freeList[n]=t.freeHead,t.freeHead=n,t.size--,true}function ke(t){let{capacity:e}=t;for(let n=0;n<e;n++){let r=t.generations[n];r!==void 0&&(t.generations[n]=r+1);}for(let n=0;n<e-1;n++)t.freeList[n]=n+1;t.freeList[e-1]=-1,t.freeHead=0,t.size=0;}function Ce(t){return t.size}function Ne(t){return t.capacity}function we(t,e){if(!Y(t,e))throw new Error(`Invalid entity handle: index=${e.index}, gen=${e.gen}, current_gen=${t.generations[e.index]??"out of bounds"}`)}var g=new Map,We={maxSize:0,preallocate:0};function yt(t,e){g.has(t.name)||g.set(t.name,{definition:t,config:{...We,...e},freeStore:a$1(),freeHandles:new Map,activeStore:a$1(),activeHandles:new Map,totalAllocations:0,totalRecycles:0,maxPoolSize:0});}function mt(t,e,n){let r=g.get(e);if(!r)return;let d=n??r.config.preallocate;for(let l$1=0;l$1<d;l$1++){let c=h$1(t);for(let T of r.definition.components)l(t,c,T);let p=b(r.freeStore,c);r.freeHandles.set(c,p);}r.maxPoolSize=Math.max(r.maxPoolSize,r.freeStore.size);}function St(t,e){let n=g.get(e);if(!n)return null;if(n.totalAllocations++,n.freeStore.size>0){let c=j$1(n.freeStore)[n.freeStore.size-1];if(c!==void 0){n.totalRecycles++;let p=n.freeHandles.get(c);if(p&&(f(n.freeStore,p),n.freeHandles.delete(c)),n.definition.resetFns)for(let E of n.definition.resetFns)E(t,c);let T=b(n.activeStore,c);return n.activeHandles.set(c,T),c}}let r=h$1(t);for(let l$1 of n.definition.components)l(t,r,l$1);let d=b(n.activeStore,r);return n.activeHandles.set(r,d),r}function gt(t,e,n$1){let r=g.get(e);if(!r)return false;let d=r.activeHandles.get(n$1);if(!d)return false;if(f(r.activeStore,d),r.activeHandles.delete(n$1),r.config.maxSize>0&&r.freeStore.size>=r.config.maxSize){for(let c of r.definition.components)m$1(t,n$1,c)&&n(t,n$1,c);return false}if(r.definition.resetFns)for(let c of r.definition.resetFns)c(t,n$1);let l=b(r.freeStore,n$1);return r.freeHandles.set(n$1,l),r.maxPoolSize=Math.max(r.maxPoolSize,r.freeStore.size),true}function Fe(t){let e=g.get(t);return e?{name:t,pooled:e.freeStore.size,active:e.activeStore.size,totalAllocations:e.totalAllocations,totalRecycles:e.totalRecycles,hitRate:e.totalAllocations>0?e.totalRecycles/e.totalAllocations:0,maxPoolSize:e.maxPoolSize}:null}function ht(){let t=[],e=0,n=0,r=0,d=0;for(let[l]of g){let c=Fe(l);c&&(t.push(c),e+=c.active,n+=c.pooled,r+=c.totalAllocations,d+=c.totalRecycles);}return {archetypes:t,totalActive:e,totalPooled:n,overallHitRate:r>0?d/r:0}}function bt(t){let e=g.get(t);e&&(g$1(e.freeStore),e.freeHandles.clear(),g$1(e.activeStore),e.activeHandles.clear());}function Pt(t){let e=g.get(t);e&&(g$1(e.freeStore),e.freeHandles.clear(),g$1(e.activeStore),e.activeHandles.clear(),g.delete(t));}function Tt(){for(let t of g.values())g$1(t.freeStore),t.freeHandles.clear(),g$1(t.activeStore),t.activeHandles.clear();g.clear();}export{Fe as A,ht as B,bt as C,Pt as D,Tt as E,ze as a,Ue as b,_e as c,Oe as d,Ge as e,Ve as f,je as g,j as h,Qe as i,qe as j,Ke as k,Je as l,Xe as m,Ze as n,ve as o,Ae as p,Y as q,xe as r,ke as s,Ce as t,Ne as u,we as v,yt as w,mt as x,St as y,gt as z};
1
+ import {h,m,i,e,g as g$2,l as l$1}from'./chunk-PQZTNWLA.js';import {a}from'./chunk-5N3O25O7.js';import {a as a$1,b,j as j$1,f,g as g$1}from'./chunk-RJULLVTH.js';import {M}from'./chunk-LIVVHEOU.js';import {h as h$1,l,m as m$1,n}from'./chunk-7ZFQO3OQ.js';import {z}from'zod';z.object({enabled:z.boolean(),historySize:z.number().int().nonnegative().optional()});z.object({enabled:z.boolean(),budgetMs:z.number().positive().optional(),skippablePhases:z.array(z.nativeEnum(a)).readonly().optional()});var w=0,Te=process.env.BLECSD_PACKED_ADAPTER==="1",_=new WeakSet;function ze(){return w}function te(t){t.sort((e,n)=>e.priority-n.priority);}function Ue(){let t=new Map,e$1=[],n=false,r=0,d=[],l=null,c=0,p=false,T=16.67,E=new Set([4]),W=null;for(let o=0;o<=7;o++)t.set(o,[]);function F(o){if(Te&&!_.has(o)){if(h(o)!==e){_.add(o);return}g$2(o,l$1()),_.add(o);}}function re(){let o=[];for(let a=0;a<=7;a++)o.push({phase:a,duration:0,systemCount:0});return {phases:o,totalFrameTime:0,frameNumber:c++,adapterSyncMs:0}}function L(o,a,s){if(!n||!l)return;let i=l.phases[o];i&&(i.duration=a,i.systemCount=s);}function ae(){if(!n||!l)return;let o=0;for(let a of l.phases)o+=a.duration;if(l.totalFrameTime=o,r>0)for(d.push(l);d.length>r;)d.shift();}function se(o){let a=h(o),s=m(a)?a:null,i$1=s?.syncMode!=="render_only";return {syncAdapter:S=>{if(!s)return;let f=S??o;if(!n||!l){i(f);return}let y=performance.now();i(f),l.adapterSyncMs+=performance.now()-y;},shouldSyncInput:i$1,shouldSyncPhase:S=>s?s.syncMode==="all"?true:S===6:false}}function ie(o,a,s){let i=o;s&&a(i);for(let u of e$1)i=u.system(i);return i}function le(o,a){return p&&a&&E.has(o)}function de(o,a,s){let i=o;s(i);for(let u of a)i=u.system(i);return i}function ce(o,a){if(n)if(o===0){let s=performance.now();L(o,s-a,e$1.length);}else L(o,0,0);}function ue(o,a){return o===0?a:n||p?performance.now():0}function fe(o,a,s,i){n&&L(o,s-a,i);}function pe(o,a,s){return !p||s?s:a-o>T}function ye(o,a,s){if(!p)return;let u=performance.now()-o;W={exceeded:a,skippedPhases:[...s],remainingMs:T-u};}function me(o,a,s,i,u,m,S,f,y){if(le(a,m))return S.push(a),n&&L(a,0,0),{world:o,budgetExceeded:m};let h=ue(a,u),ge=de(o,s,Pe=>{y(a)&&f(Pe);}),$=n||p?performance.now():0,he=a===0?e$1.length+s.length:s.length;fe(a,h,$,he);let be=pe(i,$,m);return {world:ge,budgetExceeded:be}}function Se(o,a,s,i,u){let m=o,S=[],f=false;for(let y=0;y<=7;y++){let h=t.get(y);if(!h){ce(y,s);continue}let z=me(m,y,h,a,s,f,S,i,u);m=z.world,f=z.budgetExceeded;}return {world:m,skippedPhases:S,budgetExceeded:f}}return {registerSystem(o,a,s=0){if(o===0)throw new Error("Cannot register systems to INPUT phase. INPUT phase is protected and always runs first.");let i=t.get(o);i&&(i.push({system:a,priority:s}),te(i));},registerInputSystem(o,a=0){e$1.push({system:o,priority:a}),te(e$1);},unregisterSystem(o){for(let[a,s]of t){if(a===0)continue;let i=s.findIndex(u=>u.system===o);i!==-1&&s.splice(i,1);}},unregisterInputSystem(o){let a=e$1.findIndex(s=>s.system===o);a!==-1&&e$1.splice(a,1);},run(o,a){w=a,n&&(l=re());let s=p||n?performance.now():0,i=o;F(i);let{syncAdapter:u,shouldSyncInput:m,shouldSyncPhase:S}=se(i),f=n||p?performance.now():0;i=ie(i,u,m);let y=Se(i,s,f,u,S);return i=y.world,n&&ae(),ye(s,y.budgetExceeded,y.skippedPhases),i},runInputOnly(o,a){w=a;let s=o;F(s);let i$1=h(s),m$1=(m(i$1)?i$1:null)?.syncMode!=="render_only";m$1&&i(s);for(let f of e$1)s=f.system(s);let S=t.get(0);if(S){m$1&&i(s);for(let f of S)s=f.system(s);}return s},runFixedUpdatePhases(o,a){w=a;let s=o;F(s);let i$1=h(s),u=m(i$1)?i$1:null,m$1=!!u&&u.syncMode==="all",S=[1,2,3,4];for(let f of S){let y=t.get(f);if(y){m$1&&i(s);for(let h of y)s=h.system(s);}}return s},runRenderPhases(o,a){w=a;let s=o;F(s);let i$1=h(s),u=m(i$1)?i$1:null,m$1=f=>u?u.syncMode==="all"?true:f===6:false,S=[5,6,7];for(let f of S){let y=t.get(f);if(y){m$1(f)&&i(s);for(let h of y)s=h.system(s);}}return s},getSystemsForPhase(o){if(o===0)return e$1.map(s=>s.system);let a=t.get(o);return a?a.map(s=>s.system):[]},getSystemCount(o){if(o===0)return e$1.length;let a=t.get(o);return a?a.length:0},getTotalSystemCount(){let o=e$1.length;for(let a of t.values())o+=a.length;return o},hasSystem(o){if(e$1.some(a=>a.system===o))return true;for(let a of t.values())if(a.some(s=>s.system===o))return true;return false},clearPhase(o){if(o===0)throw new Error("Cannot clear INPUT phase. INPUT phase is protected.");let a=t.get(o);a&&(a.length=0);},clearAllSystems(){for(let[o,a]of t)o!==0&&(a.length=0);},enableTelemetry(o={enabled:true}){n=o.enabled,r=o.historySize??0,n||(d.length=0,l=null);},disableTelemetry(){n=false,d.length=0,l=null;},getTelemetry(){return l},getTelemetryHistory(){return d},isTelemetryEnabled(){return n},enableFrameBudget(o={enabled:true}){p=o.enabled,T=o.budgetMs??16.67,o.skippablePhases?E=new Set(o.skippablePhases):E=new Set([4]),E.delete(0),p||(W=null);},disableFrameBudget(){p=false,W=null;},getAdaptiveFrameBudgetStatus(){return W},isFrameBudgetEnabled(){return p}}}var k=[],R=0,oe=new Set;function G(t){let e=k[k.length-1];e&&(e.dependencies.add(t),t.subscribers.add(e));}function ne(t){t.dirty=true,t.onNotify&&t.onNotify();}function D(t){if(R>0){for(let e of t.subscribers)e.dirty||(ne(e),oe.add(e),D(e));return}for(let e of t.subscribers)e.dirty||(ne(e),D(e));}function V(t){for(let e of t.dependencies)e.subscribers.delete(t);t.dependencies.clear();}function _e(t){let e={value:t,subscribers:new Set,version:0};return [()=>(G(e),e.value),d=>{let l=typeof d=="function"?d(e.value):d;Object.is(l,e.value)||(e.value=l,e.version++,D(e));}]}var O=new WeakMap;function Oe(t){let e={fn:t,value:void 0,dependencies:new Set,subscribers:new Set,dirty:true,version:0,computing:false},n=()=>{if(e.computing)throw new Error("Circular dependency detected in computed signal");if(e.dirty){e.computing=true,V(e),k.push(e);try{e.value=e.fn(),e.dirty=!1,e.version++;}finally{k.pop(),e.computing=false;}}return G(e),e.value};return n(),O.set(n,e),n}function Ge(t){R++;try{t();}finally{R--,R===0&&oe.clear();}}function Ve(t,e,n){let r={value:n,subscribers:new Set,version:0,world:t,eid:e};return [()=>(G(r),r.value),c=>{let p=typeof c=="function"?c(r.value):c;Object.is(p,r.value)||(r.value=p,r.version++,D(r),M(r.world,r.eid));}]}function je(t){let e=O.get(t);e&&(V(e),O.delete(t));}function j(t,e){let n={fn:()=>{},value:void 0,dependencies:new Set,subscribers:new Set,dirty:false,version:0,computing:false,onNotify:()=>{n.dirty=false,e();}};k.push(n);try{t();}finally{k.pop();}return ()=>{V(n);}}var C=[];function Qe(t){let e=null,n=false,r=()=>{if(n)return;e&&(e(),e=null);let l=t();typeof l=="function"&&(e=l);},d=j(r,r);return {dispose:()=>{n||(n=true,d(),e&&(e(),e=null));}}}function qe(t,e=3){let n={fn:t,phase:e,markDirty:()=>{n.disposed||(n.dirty=true);},dirty:true,cleanup:null,stopTracking:null,disposed:false};return C.push(n),{dispose:()=>{if(n.disposed)return;n.disposed=true,n.stopTracking&&(n.stopTracking(),n.stopTracking=null),n.cleanup&&(n.cleanup(),n.cleanup=null);let r=C.indexOf(n);r!==-1&&C.splice(r,1);}}}function Ke(t){t.dispose();}function Je(t){for(let e of C)if(!(e.phase!==t||e.disposed)&&e.dirty)if(e.dirty=false,e.stopTracking){e.cleanup&&(e.cleanup(),e.cleanup=null);let n=e.fn();typeof n=="function"&&(e.cleanup=n);}else {let n=()=>{if(e.disposed)return;e.cleanup&&(e.cleanup(),e.cleanup=null);let r=e.fn();typeof r=="function"&&(e.cleanup=r);};e.stopTracking=j(n,e.markDirty);}}function Xe(t){return C.filter(e=>e.phase===t&&!e.disposed).length}function Ze(){return C.filter(t=>!t.disposed).length}function ve(t=1024){let e=Math.max(1,t),n=new Uint32Array(e),r=new Int32Array(e);for(let d=0;d<e-1;d++)r[d]=d+1;return r[e-1]=-1,{generations:n,freeList:r,freeHead:0,capacity:e,size:0}}function Ee(t){let e=t.capacity,n=e*2,r=new Uint32Array(n);r.set(t.generations);let d=new Int32Array(n);d.set(t.freeList);for(let l=e;l<n-1;l++)d[l]=l+1;d[n-1]=t.freeHead,t.freeHead=e,t.generations=r,t.freeList=d,t.capacity=n;}function Ae(t){t.freeHead===-1&&Ee(t);let e=t.freeHead,n=t.freeList[e];t.freeHead=n!==void 0?n:-1,t.freeList[e]=-2,t.size++;let r=t.generations[e];return {index:e,gen:r!==void 0?r:0}}function Y(t,e){return e.index<0||e.index>=t.capacity?false:t.generations[e.index]===e.gen&&t.freeList[e.index]===-2}function xe(t,e){if(!Y(t,e))return false;let{index:n}=e,r=t.generations[n];return r!==void 0&&(t.generations[n]=r+1),t.freeList[n]=t.freeHead,t.freeHead=n,t.size--,true}function ke(t){let{capacity:e}=t;for(let n=0;n<e;n++){let r=t.generations[n];r!==void 0&&(t.generations[n]=r+1);}for(let n=0;n<e-1;n++)t.freeList[n]=n+1;t.freeList[e-1]=-1,t.freeHead=0,t.size=0;}function Ce(t){return t.size}function Ne(t){return t.capacity}function we(t,e){if(!Y(t,e))throw new Error(`Invalid entity handle: index=${e.index}, gen=${e.gen}, current_gen=${t.generations[e.index]??"out of bounds"}`)}var g=new Map,We={maxSize:0,preallocate:0};function yt(t,e){g.has(t.name)||g.set(t.name,{definition:t,config:{...We,...e},freeStore:a$1(),freeHandles:new Map,activeStore:a$1(),activeHandles:new Map,totalAllocations:0,totalRecycles:0,maxPoolSize:0});}function mt(t,e,n){let r=g.get(e);if(!r)return;let d=n??r.config.preallocate;for(let l$1=0;l$1<d;l$1++){let c=h$1(t);for(let T of r.definition.components)l(t,c,T);let p=b(r.freeStore,c);r.freeHandles.set(c,p);}r.maxPoolSize=Math.max(r.maxPoolSize,r.freeStore.size);}function St(t,e){let n=g.get(e);if(!n)return null;if(n.totalAllocations++,n.freeStore.size>0){let c=j$1(n.freeStore)[n.freeStore.size-1];if(c!==void 0){n.totalRecycles++;let p=n.freeHandles.get(c);if(p&&(f(n.freeStore,p),n.freeHandles.delete(c)),n.definition.resetFns)for(let E of n.definition.resetFns)E(t,c);let T=b(n.activeStore,c);return n.activeHandles.set(c,T),c}}let r=h$1(t);for(let l$1 of n.definition.components)l(t,r,l$1);let d=b(n.activeStore,r);return n.activeHandles.set(r,d),r}function gt(t,e,n$1){let r=g.get(e);if(!r)return false;let d=r.activeHandles.get(n$1);if(!d)return false;if(f(r.activeStore,d),r.activeHandles.delete(n$1),r.config.maxSize>0&&r.freeStore.size>=r.config.maxSize){for(let c of r.definition.components)m$1(t,n$1,c)&&n(t,n$1,c);return false}if(r.definition.resetFns)for(let c of r.definition.resetFns)c(t,n$1);let l=b(r.freeStore,n$1);return r.freeHandles.set(n$1,l),r.maxPoolSize=Math.max(r.maxPoolSize,r.freeStore.size),true}function Fe(t){let e=g.get(t);return e?{name:t,pooled:e.freeStore.size,active:e.activeStore.size,totalAllocations:e.totalAllocations,totalRecycles:e.totalRecycles,hitRate:e.totalAllocations>0?e.totalRecycles/e.totalAllocations:0,maxPoolSize:e.maxPoolSize}:null}function ht(){let t=[],e=0,n=0,r=0,d=0;for(let[l]of g){let c=Fe(l);c&&(t.push(c),e+=c.active,n+=c.pooled,r+=c.totalAllocations,d+=c.totalRecycles);}return {archetypes:t,totalActive:e,totalPooled:n,overallHitRate:r>0?d/r:0}}function bt(t){let e=g.get(t);e&&(g$1(e.freeStore),e.freeHandles.clear(),g$1(e.activeStore),e.activeHandles.clear());}function Pt(t){let e=g.get(t);e&&(g$1(e.freeStore),e.freeHandles.clear(),g$1(e.activeStore),e.activeHandles.clear(),g.delete(t));}function Tt(){for(let t of g.values())g$1(t.freeStore),t.freeHandles.clear(),g$1(t.activeStore),t.activeHandles.clear();g.clear();}export{Fe as A,ht as B,bt as C,Pt as D,Tt as E,ze as a,Ue as b,_e as c,Oe as d,Ge as e,Ve as f,je as g,j as h,Qe as i,qe as j,Ke as k,Je as l,Xe as m,Ze as n,ve as o,Ae as p,Y as q,xe as r,ke as s,Ce as t,Ne as u,we as v,yt as w,mt as x,St as y,gt as z};
@@ -0,0 +1 @@
1
+ import {I as I$1,R as R$1,G as G$1,k as k$1,g as g$1}from'./chunk-LIVVHEOU.js';var D=["fg","bold","underline","blink","inverse"],k=["bg","transparent"],i=new Map,u=0;function C(){return u}function I(e){i.delete(e);}function R(){u++,i.clear();}function W(){i.clear();}function N(e){let t=i.get(e);return t!==void 0&&t.timestamp===u}function y(e,t){return R$1(e,t)?{fg:I$1.fg[t],bg:I$1.bg[t],bold:I$1.bold[t]===1,underline:I$1.underline[t]===1,blink:I$1.blink[t]===1,inverse:I$1.inverse[t]===1,transparent:I$1.transparent[t]===1,opacity:I$1.opacity[t]??1}:m()}function m(){return {fg:G$1,bg:0,bold:false,underline:false,blink:false,inverse:false,transparent:false,opacity:1}}function d(e,t){return {fg:t.fg!==G$1?t.fg:e.fg,bold:t.bold||e.bold,underline:t.underline||e.underline,blink:t.blink||e.blink,inverse:t.inverse||e.inverse,bg:t.bg,transparent:t.transparent,opacity:t.opacity}}function P(e){return e===G$1||e===0}function c(e,t){let n=i.get(t);if(n!==void 0&&n.timestamp===u)return n.style;let r=y(e,t);if(!k$1(e,t))return S(t,r),r;let o=g$1(e,t);if(o.length===0)return S(t,r),r;let l=x(e,o,r);return S(t,l),l}function x(e,t,n){let r=y(e,t[t.length-1]);for(let o=t.length-2;o>=0;o--){let l=y(e,t[o]);r=d(r,l);}return d(r,n)}function S(e,t){i.set(e,{style:t,timestamp:u});}function A(e,t){return c(e,t)}function G(e){return D.includes(e)}function T(e,t,n){return c(e,t)[n]}function _(e,t,n){let r=y(e,t);if(g(r,n))return t;if(!k$1(e,t))return 0;let o=g$1(e,t);for(let l of o){let E=y(e,l);if(g(E,n))return l}return 0}function g(e,t){let n=m();switch(t){case "fg":return e.fg!==n.fg;case "bg":return e.bg!==n.bg;case "bold":return e.bold!==n.bold;case "underline":return e.underline!==n.underline;case "blink":return e.blink!==n.blink;case "inverse":return e.inverse!==n.inverse;case "transparent":return e.transparent!==n.transparent;default:return false}}function H(e,t){for(let n of t)c(e,n);}function K(e,t){let n=new Map;for(let r of t)n.set(r,c(e,r));return n}export{D as a,k as b,C as c,I as d,R as e,W as f,N as g,y as h,m as i,d as j,P as k,c as l,A as m,G as n,T as o,_ as p,H as q,K as r};
@@ -0,0 +1 @@
1
+ import {c,a}from'./chunk-FJLSHFCF.js';import {G as G$1}from'./chunk-JB5KFQPD.js';import {I as I$1,V}from'./chunk-LIVVHEOU.js';import {o,m as m$1}from'./chunk-7ZFQO3OQ.js';import {z as z$1}from'zod';function B(){let e=new Map;function r(t,o,s){let i=e.get(t);i||(i=new Set,e.set(t,i));let d={handler:o,once:s};return i.add(d),()=>{i.delete(d),i.size===0&&e.delete(t);}}let n={on(t,o){return r(t,o,false)},once(t,o){return r(t,o,true)},off(t,o){let s=e.get(t);if(!s)return n;for(let i of s)if(i.handler===o){s.delete(i);break}return s.size===0&&e.delete(t),n},emit(t,o){let s=e.get(t);if(!s||s.size===0)return false;let i=[];for(let d of s)d.handler(o),d.once&&i.push(d);for(let d of i)s.delete(d);return s.size===0&&e.delete(t),true},removeAllListeners(t){return t===void 0?e.clear():e.delete(t),n},listenerCount(t){return e.get(t)?.size??0},eventNames(){return Array.from(e.keys())},hasListeners(t){return n.listenerCount(t)>0}};return n}function U(){let e=new Map;return {get(r,n){return e.get(n)},getOrCreate(r,n){let t=e.get(n);return t||(t=B(),e.set(n,t)),t},set(r,n,t){e.set(n,t);},has(r,n){return e.has(n)},delete(r,n){return e.delete(n)},clear(){e.clear();}}}var Q=[{name:"renderables",components:[G$1,I$1]}],M=z$1.object({name:z$1.string().min(1),components:z$1.array(z$1.unknown()).min(1)}),z=z$1.object({queries:z$1.array(M),initialCapacity:z$1.number().int().positive().optional(),syncMode:z$1.enum(["all","render_only"]).optional()}),g=Object.freeze([]),K=Object.freeze([]);function P(e){return o(e,[G$1,I$1])}var m={type:"bitecs",queryRenderables:P},E=new WeakMap;function X(e={}){return {...m,...e,type:e.type??m.type,queryRenderables:e.queryRenderables??m.queryRenderables}}function G(e,r){E.set(e,r);}function L(e){return E.get(e)??m}function J(e){let r=L(e);I(r)&&r.sync(e);}function Z(e){E.delete(e);}function D(e,r){return {name:e,components:r,cachedResult:null,cachedSize:0,cacheFrameId:-1}}function f(e,r,n){if(e.cacheFrameId===n)return;let t=o(r,e.components);e.cachedResult=t,e.cachedSize=t.length,e.cacheFrameId=n;}function _(e){z.parse(e);let r=e.syncMode??"all",n=new Map;for(let i of e.queries)n.set(i.name,D(i.name,i.components));n.has("renderables")||n.set("renderables",D("renderables",[G$1,I$1]));let t=Object.freeze([...n.keys()]),o=null,s=0;return {type:"custom",syncMode:r,queryRenderables(i){let d=n.get("renderables");return d?(f(d,i,s),d.cachedResult??g):g},queryByName(i,d){let l=n.get(i);if(l)return f(l,d,s),l.cachedResult??g},sync(i){o=i,s++;},getQueryData(i){let d=n.get(i);return !d||!o?K:(f(d,o,s),d.cachedResult??K)},getQuerySize(i){let d=n.get(i);return !d||!o?0:(f(d,o,s),d.cachedSize)},getRegisteredQueries(){return t}}}function $(e=256){return _({queries:Q,syncMode:"render_only"})}function I(e){return "sync"in e&&"getQueryData"in e&&"getQuerySize"in e&&"getRegisteredQueries"in e}function oe(e,r){let n=e*r,t=Math.ceil(n/8);return {width:e,height:r,dirtyCells:new Uint8Array(t),dirtyEntities:new Set,entityBoundsCache:new Map,dirtyRegions:[],regionsStale:false,forceFullRedraw:false,frameCount:0}}function ie(e,r,n){if(e.dirtyEntities.add(n),!c(r,n))return;let t=Math.floor(a.x[n]),o=Math.floor(a.y[n]),s=Math.floor(a.width[n]),i=Math.floor(a.height[n]),d=m$1(r,n,I$1)&&V(r,n),l=e.entityBoundsCache.get(n);l?(l.wasVisible&&v(e,l.prevX,l.prevY,l.prevWidth,l.prevHeight),d&&v(e,t,o,s,i),l.prevX=t,l.prevY=o,l.prevWidth=s,l.prevHeight=i,l.wasVisible=d):(e.entityBoundsCache.set(n,{prevX:t,prevY:o,prevWidth:s,prevHeight:i,wasVisible:d}),d&&v(e,t,o,s,i)),e.regionsStale=true;}function de(e,r){e.dirtyEntities.delete(r),e.entityBoundsCache.delete(r);}function se(e,r,n){if(r<0||r>=e.width||n<0||n>=e.height)return;let t=n*e.width+r,o=Math.floor(t/8),s=t%8,i=e.dirtyCells[o];i!==void 0&&(e.dirtyCells[o]=i|1<<s),e.regionsStale=true;}function T(e,r,n){if(r<0||r>=e.width||n<0||n>=e.height)return false;let t=n*e.width+r,o=Math.floor(t/8),s=t%8,i=e.dirtyCells[o];return i!==void 0&&(i&1<<s)!==0}function v(e,r,n,t,o){let s=Math.max(0,r),i=Math.max(0,n),d=Math.min(e.width,r+t),l=Math.min(e.height,n+o);if(!(d<=s||l<=i)){for(let b=i;b<l;b++)for(let p=s;p<d;p++){let x=b*e.width+p,w=Math.floor(x/8),S=x%8,R=e.dirtyCells[w];R!==void 0&&(e.dirtyCells[w]=R|1<<S);}e.regionsStale=true;}}function k(e,r,n){let t=1;for(;r+t<e.width&&T(e,r+t,n);)t++;return t}function H(e,r,n,t){for(let o=0;o<t;o++)if(!T(e,r+o,n))return false;return true}function q(e,r,n,t){let o=1;for(;n+o<e.height&&H(e,r,n+o,t);)o++;return o}function F(e,r,n,t,o,s){for(let i=0;i<o;i++)for(let d=0;d<t;d++)s.add((n+i)*e.width+(r+d));}function le(e){if(e.forceFullRedraw)return [{x:0,y:0,width:e.width,height:e.height}];if(!e.regionsStale&&e.dirtyRegions.length>0)return e.dirtyRegions;e.dirtyRegions.length=0;let r=[],n=new Set;for(let t=0;t<e.height;t++)for(let o=0;o<e.width;o++){let s=t*e.width+o;if(n.has(s)||!T(e,o,t))continue;let i=k(e,o,t),d=q(e,o,t,i);F(e,o,t,i,d,n),r.push({x:o,y:t,width:i,height:d});}return e.dirtyRegions.length=0,e.dirtyRegions.push(...r),e.regionsStale=false,e.dirtyRegions}function ae(e){if(e.forceFullRedraw||e.dirtyEntities.size>0)return true;for(let r=0;r<e.dirtyCells.length;r++)if(e.dirtyCells[r]!==0)return true;return false}function ue(e){e.dirtyCells.fill(0),e.dirtyEntities.clear(),e.dirtyRegions.length=0,e.regionsStale=false,e.forceFullRedraw=false,e.frameCount++;}function ye(e){e.forceFullRedraw=true,e.regionsStale=true;}function ce(e){let r=0;for(let n=0;n<e.dirtyCells.length;n++){let t=e.dirtyCells[n];if(t!==void 0)for(let o=0;o<8;o++)t&1<<o&&r++;}return {dirtyCellCount:r,dirtyEntityCount:e.dirtyEntities.size,cachedEntityCount:e.entityBoundsCache.size,dirtyRegionCount:e.regionsStale?0:e.dirtyRegions.length,frameCount:e.frameCount}}export{B as a,U as b,M as c,z as d,m as e,X as f,G as g,L as h,J as i,Z as j,_ as k,$ as l,I as m,oe as n,ie as o,de as p,se as q,T as r,v as s,le as t,ae as u,ue as v,ye as w,ce as x};