blecsd 0.4.0 → 0.6.0

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 (142) hide show
  1. package/README.md +145 -145
  2. package/dist/{border-DGNDfT6T.d.ts → border-Br-Jc027.d.ts} +2 -2
  3. package/dist/{cell-DwIu2ryP.d.ts → cell-5Ty_3yMs.d.ts} +1 -1
  4. package/dist/cellRenderer-D0-DJXWl.d.ts +374 -0
  5. package/dist/chunk-4N7IFBRQ.js +4 -0
  6. package/dist/{chunk-DNRXW56C.js → chunk-4XCFTNGN.js} +1 -1
  7. package/dist/chunk-5YWRP2KG.js +3 -0
  8. package/dist/chunk-73Y45MLV.js +12 -0
  9. package/dist/chunk-7ZFQO3OQ.js +1 -0
  10. package/dist/chunk-A3GSH6MV.js +1 -0
  11. package/dist/chunk-A5B2BGUM.js +1 -0
  12. package/dist/chunk-AM6IDSXI.js +1 -0
  13. package/dist/chunk-EHYOVHRL.js +2 -0
  14. package/dist/chunk-EMZA6G2M.js +4 -0
  15. package/dist/chunk-EOFT3PNU.js +1 -0
  16. package/dist/chunk-ETFDYZVJ.js +1 -0
  17. package/dist/chunk-FUW7OD3H.js +1 -0
  18. package/dist/chunk-GRMSEMU7.js +1 -0
  19. package/dist/chunk-I7AUKTXE.js +1 -0
  20. package/dist/chunk-IANAVH2A.js +1 -0
  21. package/dist/chunk-JN2OGNK3.js +1 -0
  22. package/dist/chunk-JVMNMAHX.js +1 -0
  23. package/dist/chunk-K2QWNDXV.js +1 -0
  24. package/dist/chunk-KYNS3GBJ.js +2 -0
  25. package/dist/chunk-LI3ZYXUT.js +1 -0
  26. package/dist/chunk-LNEISTXM.js +1 -0
  27. package/dist/chunk-QABNK7IA.js +1 -0
  28. package/dist/chunk-QS5QXZNJ.js +1 -0
  29. package/dist/chunk-QTDRFJG2.js +1 -0
  30. package/dist/chunk-SVHITP3F.js +2 -0
  31. package/dist/chunk-UKVY43V3.js +1 -0
  32. package/dist/chunk-VIT4KE6Q.js +1 -0
  33. package/dist/chunk-XG5PVDOP.js +1 -0
  34. package/dist/chunk-XH5GTWCV.js +1 -0
  35. package/dist/chunk-XYMPBCYW.js +1 -0
  36. package/dist/chunk-YRSSCEAS.js +1 -0
  37. package/dist/chunk-ZL46COQF.js +1 -0
  38. package/dist/cli/init.js +1 -1
  39. package/dist/{componentStorage-CJTh-TPO.d.ts → componentStorage-CXJvx4Lt.d.ts} +2 -2
  40. package/dist/components/index.d.ts +8172 -7777
  41. package/dist/components/index.js +5 -1
  42. package/dist/core/index.d.ts +4777 -3942
  43. package/dist/core/index.js +1 -1
  44. package/dist/debug/index.d.ts +310 -84
  45. package/dist/debug/index.js +8 -1
  46. package/dist/{dirtyTracking-C4v8MmM9.d.ts → dirtyTracking-kCS9-NVF.d.ts} +2 -2
  47. package/dist/{doubleBuffer-CKQFmlPN.d.ts → doubleBuffer-CWASihKh.d.ts} +1 -1
  48. package/dist/errors/index.js +1 -1
  49. package/dist/{inputActions-Fyw14_Gm.d.ts → factories-vW7bn_He.d.ts} +21 -786
  50. package/dist/{gameLoop-CSTb7e0L.d.ts → gameLoop-C1AyRWyP.d.ts} +3 -3
  51. package/dist/index.d.ts +24 -1217
  52. package/dist/index.js +1 -3
  53. package/dist/input/index.d.ts +1 -1
  54. package/dist/input/index.js +1 -1
  55. package/dist/inputStream-COARA4CP.d.ts +1182 -0
  56. package/dist/interactiveSystem-h92W9W4n.d.ts +1977 -0
  57. package/dist/{keyParser-m7fWto6g.d.ts → keyParser-DReXe2j-.d.ts} +28 -28
  58. package/dist/{events-9ForpTfM.d.ts → mouseParser-CCqSEUVN.d.ts} +177 -2
  59. package/dist/{packedStore-BgvnEdE7.d.ts → packedStore-480t2X74.d.ts} +1 -1
  60. package/dist/panelMovement-DGzIQ8Ll.d.ts +1908 -0
  61. package/dist/{parser-iMHmQuUh.d.ts → parser-Q1YLXYpF.d.ts} +1 -1
  62. package/dist/positioning-DiUivJXa.d.ts +917 -0
  63. package/dist/{renderable-CwqGwrEV.d.ts → renderable-IbSJao5y.d.ts} +2 -2
  64. package/dist/{scheduler-DeeZleia.d.ts → scheduler-NbHT3-D2.d.ts} +1 -1
  65. package/dist/schemas/index.d.ts +6 -6
  66. package/dist/schemas/index.js +1 -1
  67. package/dist/systems/index.d.ts +785 -1882
  68. package/dist/systems/index.js +1 -1
  69. package/dist/terminal/index.d.ts +7563 -3387
  70. package/dist/terminal/index.js +1 -1
  71. package/dist/terminalBuffer-BbUz27qM.d.ts +691 -0
  72. package/dist/{terminus-14-bold-HWSPRLJD.js → terminus-14-bold-ZS4IH465.js} +1 -1
  73. package/dist/{terminus-14-normal-T3SWMH4D.js → terminus-14-normal-HD5N7F5W.js} +1 -1
  74. package/dist/text/index.d.ts +263 -0
  75. package/dist/text/index.js +3 -0
  76. package/dist/textWrap-Ct2J8gO6.d.ts +761 -0
  77. package/dist/{tilemap-BirMJdbu.d.ts → tilemap-ByvTsepD.d.ts} +5 -5
  78. package/dist/{types-CPB4CpbH.d.ts → types-B8LmNkzG.d.ts} +1 -1
  79. package/dist/utils/index.d.ts +829 -782
  80. package/dist/utils/index.js +32 -1
  81. package/dist/{virtualScrollback-D9uLFe8l.d.ts → virtualScrollback-CiooIebp.d.ts} +4 -4
  82. package/dist/virtualViewport-fIlbIGPt.d.ts +657 -0
  83. package/dist/{virtualizedLineStore-DwPEvPkk.d.ts → virtualizedLineStore-DfyhojPZ.d.ts} +1 -1
  84. package/dist/widgets/bigText.d.ts +13 -13
  85. package/dist/widgets/bigText.js +1 -1
  86. package/dist/widgets/fonts/index.d.ts +1 -1
  87. package/dist/widgets/fonts/index.js +1 -1
  88. package/dist/widgets/index.d.ts +1620 -910
  89. package/dist/widgets/index.js +24 -1
  90. package/package.json +9 -22
  91. package/dist/3d/index.d.ts +0 -5
  92. package/dist/3d/index.js +0 -1
  93. package/dist/audio/index.d.ts +0 -177
  94. package/dist/audio/index.js +0 -1
  95. package/dist/chunk-25OEBENM.js +0 -3
  96. package/dist/chunk-26STV7ZS.js +0 -1
  97. package/dist/chunk-2NMGUEFC.js +0 -4
  98. package/dist/chunk-35LCBY6P.js +0 -1
  99. package/dist/chunk-4PRDJTCM.js +0 -1
  100. package/dist/chunk-5PELJRUQ.js +0 -1
  101. package/dist/chunk-5VEKHA3B.js +0 -5
  102. package/dist/chunk-6KEM3OS2.js +0 -11
  103. package/dist/chunk-6XWY6GB7.js +0 -1
  104. package/dist/chunk-735KKTP3.js +0 -1
  105. package/dist/chunk-7SWJNDOL.js +0 -26
  106. package/dist/chunk-APKUNIMB.js +0 -1
  107. package/dist/chunk-CJCSZRV6.js +0 -1
  108. package/dist/chunk-DMBMCCLN.js +0 -1
  109. package/dist/chunk-DQTVJITR.js +0 -1
  110. package/dist/chunk-DSKQ5J4R.js +0 -1
  111. package/dist/chunk-E4CJRSND.js +0 -1
  112. package/dist/chunk-EF4DC6IN.js +0 -1
  113. package/dist/chunk-EJAKECSN.js +0 -1
  114. package/dist/chunk-FNQRUMFD.js +0 -1
  115. package/dist/chunk-GJ3RS2VG.js +0 -1
  116. package/dist/chunk-KTVEMB2I.js +0 -1
  117. package/dist/chunk-KYAPE44E.js +0 -8
  118. package/dist/chunk-LI4Y7TBZ.js +0 -1
  119. package/dist/chunk-NHOL4BN6.js +0 -1
  120. package/dist/chunk-NPNUUSIB.js +0 -1
  121. package/dist/chunk-NZ55KBM6.js +0 -1
  122. package/dist/chunk-OFRWGW2G.js +0 -1
  123. package/dist/chunk-OMMJ7B5P.js +0 -1
  124. package/dist/chunk-OMU5BSAS.js +0 -2
  125. package/dist/chunk-P3ZLIQJP.js +0 -1
  126. package/dist/chunk-PWI36BQJ.js +0 -1
  127. package/dist/chunk-QQMUDJ32.js +0 -2
  128. package/dist/chunk-R3ICZOE4.js +0 -1
  129. package/dist/chunk-RZ7FGVI6.js +0 -1
  130. package/dist/chunk-S6WS46FE.js +0 -1
  131. package/dist/chunk-TSARUU56.js +0 -1
  132. package/dist/chunk-WJRVUAZR.js +0 -33
  133. package/dist/chunk-WY5EZOOL.js +0 -1
  134. package/dist/chunk-YY6RZCZH.js +0 -4
  135. package/dist/chunk-ZPGJCHXH.js +0 -1
  136. package/dist/chunk-ZPL2J25N.js +0 -1
  137. package/dist/game/index.d.ts +0 -486
  138. package/dist/game/index.js +0 -1
  139. package/dist/index-DBS5Uefn.d.ts +0 -3156
  140. package/dist/mouseParser-B7p5ow7K.d.ts +0 -177
  141. package/dist/viewport3d-xI33-_wq.d.ts +0 -182
  142. package/dist/virtualViewport-DTSN6jFk.d.ts +0 -1856
@@ -1 +0,0 @@
1
- import {n,i as i$1,h as h$1}from'./chunk-P3ZLIQJP.js';n();var c=1e4,d=4294967295,y=0,e={focusable:new Uint8Array(c),focused:new Uint8Array(c),tabIndex:new Int16Array(c),focusEffectFg:new Uint32Array(c),focusEffectBg:new Uint32Array(c)},u=null;function F(t){e.focusable[t]=1,e.focused[t]=0,e.tabIndex[t]=0,e.focusEffectFg[t]=d,e.focusEffectBg[t]=y;}function l(t,n){i$1(t,n,e)||(h$1(t,n,e),F(n));}function p(t,n,r){return l(t,n),r.focusable!==void 0&&(e.focusable[n]=r.focusable?1:0),r.tabIndex!==void 0&&(e.tabIndex[n]=r.tabIndex),r.focusEffectFg!==void 0&&(e.focusEffectFg[n]=r.focusEffectFg),r.focusEffectBg!==void 0&&(e.focusEffectBg[n]=r.focusEffectBg),n}function m(t,n,r){return l(t,n),e.focusable[n]=r?1:0,n}function W(t,n){return i$1(t,n,e)?e.focused[n]===1:false}function A(t,n){return i$1(t,n,e)?e.focusable[n]===1:false}function i(t,n){return l(t,n),e.focusable[n]!==1||(u!==null&&u!==n&&i$1(t,u,e)&&(e.focused[u]=0),e.focused[n]=1,u=n),n}function B(t,n){return i$1(t,n,e)&&(e.focused[n]=0,u===n&&(u=null)),n}function O(t,n){if(i$1(t,n,e))return {focusable:e.focusable[n]===1,focused:e.focused[n]===1,tabIndex:e.tabIndex[n],focusEffectFg:e.focusEffectFg[n],focusEffectBg:e.focusEffectBg[n]}}function U(t,n){return i$1(t,n,e)}function T(){return u}function h(t,n,r){return l(t,n),e.tabIndex[n]=r,n}function v(t,n){return i$1(t,n,e)?e.tabIndex[n]:-1}function g(t,n){return i$1(t,n,e)?e.tabIndex[n]>=0&&e.focusable[n]===1:false}function E(t,n){return n.filter(r=>g(t,r)).sort((r,s)=>e.tabIndex[r]-e.tabIndex[s])}function C(t,n){let r=E(t,n);if(r.length===0)return null;let a=((u!==null?r.indexOf(u):-1)+1)%r.length,f=r[a];return f!==void 0?(i(t,f),f):null}function D(t,n){let r=E(t,n);if(r.length===0)return null;let a=((u!==null?r.indexOf(u):0)-1+r.length)%r.length,f=r[a];return f!==void 0?(i(t,f),f):null}function _(){u=null;}export{d as a,y as b,e as c,p as d,m as e,W as f,A as g,i as h,B as i,O as j,U as k,T as l,h as m,v as n,g as o,E as p,C as q,D as r,_ as s};
@@ -1 +0,0 @@
1
- import {n,i as i$1,h as h$1,j as j$1}from'./chunk-P3ZLIQJP.js';n();var i=1e4,b={NONE:0,CTRL:1,META:2,SHIFT:4},s={lastKeyCode:new Uint32Array(i),lastKeyTime:new Float64Array(i),modifiers:new Uint8Array(i)},S={NONE:0,LEFT:1,MIDDLE:2,RIGHT:3,WHEEL_UP:4,WHEEL_DOWN:5},r={x:new Int16Array(i),y:new Int16Array(i),button:new Uint8Array(i),pressed:new Uint8Array(i),lastClickTime:new Float64Array(i),clickCount:new Uint8Array(i)},u={bufferId:new Uint32Array(i),cursorPos:new Uint16Array(i),selectionStart:new Int16Array(i),selectionEnd:new Int16Array(i)},l=new Map,I=1,p={create(t=""){let e=I++;return l.set(e,t),e},getText(t){return l.get(t)??""},setText(t,e){l.has(t)&&l.set(t,e);},insert(t,e,n){let o=l.get(t)??"",a=o.slice(0,e),c=o.slice(e);l.set(t,a+n+c);},delete(t,e,n){let o=l.get(t)??"",a=o.slice(0,e),c=o.slice(n);l.set(t,a+c);},getLength(t){return (l.get(t)??"").length},remove(t){return l.delete(t)},has(t){return l.has(t)},clear(){l.clear(),I=1;}};function k(t,e,n){let o=0;return t&&(o|=b.CTRL),e&&(o|=b.META),n&&(o|=b.SHIFT),o}function E(t){return {ctrl:!!(t&b.CTRL),meta:!!(t&b.META),shift:!!(t&b.SHIFT)}}function W(t){s.lastKeyCode[t]=0,s.lastKeyTime[t]=0,s.modifiers[t]=0;}function A(t,e,n){if(i$1(t,e,s)||(h$1(t,e,s),W(e)),n.lastKeyCode!==void 0&&(s.lastKeyCode[e]=n.lastKeyCode),n.lastKeyTime!==void 0&&(s.lastKeyTime[e]=n.lastKeyTime),n.modifiers!==void 0)s.modifiers[e]=n.modifiers;else if(n.ctrl!==void 0||n.meta!==void 0||n.shift!==void 0){let o=E(s.modifiers[e]??0);s.modifiers[e]=k(n.ctrl??o.ctrl,n.meta??o.meta,n.shift??o.shift);}return e}function B(t,e){if(!i$1(t,e,s))return;let n=s.modifiers[e]??0,o=E(n);return {lastKeyCode:s.lastKeyCode[e]??0,lastKeyTime:s.lastKeyTime[e]??0,modifiers:n,ctrl:o.ctrl,meta:o.meta,shift:o.shift}}function D(t,e){return i$1(t,e,s)}function L(t,e){i$1(t,e,s)&&j$1(t,e,s);}function O(t,e){i$1(t,e,s)&&(s.lastKeyCode[e]=0,s.modifiers[e]=0);}var M=500,g=3;function x(t){r.x[t]=0,r.y[t]=0,r.button[t]=0,r.pressed[t]=0,r.lastClickTime[t]=0,r.clickCount[t]=0;}function P(t,e,n){return i$1(t,e,r)||(h$1(t,e,r),x(e)),n.x!==void 0&&(r.x[e]=n.x),n.y!==void 0&&(r.y[e]=n.y),n.button!==void 0&&(r.button[e]=n.button),n.pressed!==void 0&&(r.pressed[e]=n.pressed?1:0),n.lastClickTime!==void 0&&(r.lastClickTime[e]=n.lastClickTime),n.clickCount!==void 0&&(r.clickCount[e]=n.clickCount),e}function U(t,e){if(i$1(t,e,r))return {x:r.x[e]??0,y:r.y[e]??0,button:r.button[e]??0,pressed:(r.pressed[e]??0)===1,lastClickTime:r.lastClickTime[e]??0,clickCount:r.clickCount[e]??0}}function w(t,e){return i$1(t,e,r)}function F(t,e){i$1(t,e,r)&&j$1(t,e,r);}function H(t,e,n,o,a,c=Date.now()){i$1(t,e,r)||(h$1(t,e,r),x(e));let C=r.lastClickTime[e]??0,T=r.button[e]??0,y=r.clickCount[e]??0;return a===T&&c-C<M?y=Math.min(y+1,g):y=1,r.x[e]=n,r.y[e]=o,r.button[e]=a,r.pressed[e]=1,r.lastClickTime[e]=c,r.clickCount[e]=y,y}function _(t,e){i$1(t,e,r)&&(r.button[e]=0,r.pressed[e]=0,r.clickCount[e]=0);}function h(t){u.bufferId[t]=0,u.cursorPos[t]=0,u.selectionStart[t]=-1,u.selectionEnd[t]=-1;}function N(t,e,n){return i$1(t,e,u)||(h$1(t,e,u),h(e)),n.bufferId!==void 0&&(u.bufferId[e]=n.bufferId),n.cursorPos!==void 0&&(u.cursorPos[e]=n.cursorPos),n.selectionStart!==void 0&&(u.selectionStart[e]=n.selectionStart),n.selectionEnd!==void 0&&(u.selectionEnd[e]=n.selectionEnd),e}function R(t,e){if(!i$1(t,e,u))return;let n=u.selectionStart[e]??-1,o=u.selectionEnd[e]??-1;return {bufferId:u.bufferId[e]??0,cursorPos:u.cursorPos[e]??0,selectionStart:n,selectionEnd:o,hasSelection:n>=0&&o>=0&&n!==o}}function G(t,e){return i$1(t,e,u)}function X(t,e){if(i$1(t,e,u)){let n=u.bufferId[e]??0;n>0&&p.remove(n),j$1(t,e,u);}}function Y(t,e){if(!i$1(t,e,u))return "";let n=u.bufferId[e]??0;return p.getText(n)}function j(t,e,n){if(!i$1(t,e,u))return;let o=u.bufferId[e]??0;o>0&&p.setText(o,n);}function q(t,e){i$1(t,e,u)&&(u.selectionStart[e]=-1,u.selectionEnd[e]=-1);}function z(t,e,n,o){i$1(t,e,u)&&(u.selectionStart[e]=n,u.selectionEnd[e]=o);}export{z as A,b as a,s as b,S as c,r as d,u as e,p as f,k as g,E as h,A as i,B as j,D as k,L as l,O as m,P as n,U as o,w as p,F as q,H as r,_ as s,N as t,R as u,G as v,X as w,Y as x,j as y,q as z};
@@ -1 +0,0 @@
1
- import {T,ka}from'./chunk-GJ3RS2VG.js';import {n,k as k$1}from'./chunk-P3ZLIQJP.js';import {z as z$1}from'zod';n();var b=[{name:"renderables",components:[T,ka]}],R=z$1.object({name:z$1.string().min(1),components:z$1.array(z$1.unknown()).min(1)}),h=z$1.object({queries:z$1.array(R),initialCapacity:z$1.number().int().positive().optional(),syncMode:z$1.enum(["all","render_only"]).optional()}),f=Object.freeze([]),A=Object.freeze([]);function E(e){return k$1(e,[T,ka])}var s={type:"bitecs",queryRenderables:E},g=new WeakMap;function C(e={}){return {...s,...e,type:e.type??s.type,queryRenderables:e.queryRenderables??s.queryRenderables}}function z(e,a){g.set(e,a);}function P(e){return g.get(e)??s}function M(e){let a=P(e);k(a)&&a.sync(e);}function D(e){g.delete(e);}function Q(e,a){return {name:e,components:a,cachedResult:null,cachedSize:0,cacheFrameId:-1}}function u(e,a,n){if(e.cacheFrameId===n)return;let l=k$1(a,e.components);e.cachedResult=l,e.cachedSize=l.length,e.cacheFrameId=n;}function x(e){h.parse(e);let a=e.syncMode??"all",n=new Map;for(let r of e.queries)n.set(r.name,Q(r.name,r.components));n.has("renderables")||n.set("renderables",Q("renderables",[T,ka]));let l=Object.freeze([...n.keys()]),d=null,y=0;return {type:"custom",syncMode:a,queryRenderables(r){let t=n.get("renderables");return t?(u(t,r,y),t.cachedResult??f):f},queryByName(r,t){let p=n.get(r);if(p)return u(p,t,y),p.cachedResult??f},sync(r){d=r,y++;},getQueryData(r){let t=n.get(r);return !t||!d?A:(u(t,d,y),t.cachedResult??A)},getQuerySize(r){let t=n.get(r);return !t||!d?0:(u(t,d,y),t.cachedSize)},getRegisteredQueries(){return l}}}function w(e=256){return x({queries:b,syncMode:"render_only"})}function k(e){return "sync"in e&&"getQueryData"in e&&"getQuerySize"in e&&"getRegisteredQueries"in e}export{R as a,h as b,s as c,C as d,z as e,P as f,M as g,D as h,x as i,w as j,k};
@@ -1 +0,0 @@
1
- import {n,i as i$1,h as h$1}from'./chunk-P3ZLIQJP.js';n();var a=1e4,y=4294967295,E=0,t={clickable:new Uint8Array(a),draggable:new Uint8Array(a),hoverable:new Uint8Array(a),hovered:new Uint8Array(a),pressed:new Uint8Array(a),keyable:new Uint8Array(a),focusable:new Uint8Array(a),focused:new Uint8Array(a),tabIndex:new Int16Array(a),enabled:new Uint8Array(a),hoverEffectFg:new Uint32Array(a),hoverEffectBg:new Uint32Array(a),focusEffectFg:new Uint32Array(a),focusEffectBg:new Uint32Array(a)},i=4278255615,g=0;function x(n){t.clickable[n]=0,t.draggable[n]=0,t.hoverable[n]=0,t.hovered[n]=0,t.pressed[n]=0,t.keyable[n]=0,t.focusable[n]=0,t.focused[n]=0,t.tabIndex[n]=0,t.enabled[n]=1,t.hoverEffectFg[n]=y,t.hoverEffectBg[n]=E,t.focusEffectFg[n]=i,t.focusEffectBg[n]=g;}function l(n,e){i$1(n,e,t)||(h$1(n,e,t),x(e));}function f(n,e,r){r!==void 0&&(e[n]=r?1:0);}function u(n,e,r){r!==void 0&&(e[n]=r);}function p(n,e,r){return l(n,e),f(e,t.clickable,r.clickable),f(e,t.draggable,r.draggable),f(e,t.hoverable,r.hoverable),f(e,t.keyable,r.keyable),f(e,t.focusable,r.focusable),f(e,t.enabled,r.enabled),u(e,t.tabIndex,r.tabIndex),u(e,t.hoverEffectFg,r.hoverEffectFg),u(e,t.hoverEffectBg,r.hoverEffectBg),u(e,t.focusEffectFg,r.focusEffectFg),u(e,t.focusEffectBg,r.focusEffectBg),e}function h(n,e,r){return l(n,e),t.clickable[e]=r?1:0,e}function W(n,e,r){return l(n,e),t.draggable[e]=r?1:0,e}function d(n,e,r){return l(n,e),t.hoverable[e]=r?1:0,e}function k(n,e,r){return l(n,e),t.keyable[e]=r?1:0,e}function F(n,e){return i$1(n,e,t)?t.hovered[e]===1:false}function m(n,e){return i$1(n,e,t)?t.pressed[e]===1:false}function I(n,e){return i$1(n,e,t)?t.clickable[e]===1:false}function A(n,e){return i$1(n,e,t)?t.draggable[e]===1:false}function U(n,e){return i$1(n,e,t)?t.hoverable[e]===1:false}function B(n,e){return i$1(n,e,t)?t.keyable[e]===1:false}function w(n,e,r){return l(n,e),t.hovered[e]=r?1:0,e}function D(n,e,r){return l(n,e),t.pressed[e]=r?1:0,e}function _(n,e){return i$1(n,e,t)?t.focusable[e]===1:false}function C(n,e,r){return l(n,e),t.focused[e]=r?1:0,e}function O(n,e){if(i$1(n,e,t))return {fg:t.focusEffectFg[e],bg:t.focusEffectBg[e]}}function T(n,e,r,b){return l(n,e),t.focusEffectFg[e]=r,t.focusEffectBg[e]=b,e}function H(n,e){if(i$1(n,e,t))return {clickable:t.clickable[e]===1,draggable:t.draggable[e]===1,hoverable:t.hoverable[e]===1,hovered:t.hovered[e]===1,pressed:t.pressed[e]===1,keyable:t.keyable[e]===1,focusable:t.focusable[e]===1,focused:t.focused[e]===1,tabIndex:t.tabIndex[e],enabled:t.enabled[e]===1,hoverEffectFg:t.hoverEffectFg[e],hoverEffectBg:t.hoverEffectBg[e],focusEffectFg:t.focusEffectFg[e],focusEffectBg:t.focusEffectBg[e]}}function K(n,e){return i$1(n,e,t)}function L(n,e){return i$1(n,e,t)&&(t.hovered[e]=0,t.pressed[e]=0,t.focused[e]=0),e}function G(n,e){return l(n,e),t.clickable[e]=1,t.hoverable[e]=1,e}function S(n,e){return i$1(n,e,t)&&(t.clickable[e]=0,t.hoverable[e]=0),e}function M(n,e){return l(n,e),t.keyable[e]=1,e}function P(n,e){return i$1(n,e,t)&&(t.keyable[e]=0),e}function R(n,e){return l(n,e),t.clickable[e]=1,t.hoverable[e]=1,t.keyable[e]=1,e}function V(n,e){return i$1(n,e,t)&&(t.clickable[e]=0,t.hoverable[e]=0,t.keyable[e]=0),e}function N(n,e){return i$1(n,e,t)?t.clickable[e]===1||t.hoverable[e]===1:false}function Y(n,e){return i$1(n,e,t)?t.keyable[e]===1:false}function j(n,e){return i$1(n,e,t)?t.clickable[e]===1||t.hoverable[e]===1||t.keyable[e]===1:false}function q(n,e){return l(n,e),t.enabled[e]=1,e}function z(n,e){return l(n,e),t.enabled[e]=0,t.hovered[e]=0,t.pressed[e]=0,t.focused[e]=0,e}function J(n,e){return i$1(n,e,t)?t.enabled[e]===1:true}export{P as A,R as B,V as C,N as D,Y as E,j as F,q as G,z as H,J as I,y as a,E as b,t as c,p as d,h as e,W as f,d as g,k as h,F as i,m as j,I as k,A as l,U as m,B as n,w as o,D as p,_ as q,C as r,O as s,T as t,H as u,K as v,L as w,G as x,S as y,M as z};
@@ -1 +0,0 @@
1
- import {oa}from'./chunk-GJ3RS2VG.js';import {n,h as h$1,i,j as j$1,l as l$1,m as m$1}from'./chunk-P3ZLIQJP.js';import {z as z$1}from'zod';n();function pt(e){return typeof e=="string"?{target:e}:e}function xt(e){let t=e.initial,n=e.context,o=new Set;function r(s){if(s)for(let c of s)c(n);}function i(s){if(s!==t)for(let c of o)c(t,s);}let d=e.states[t];if(d?.entry)for(let s of d.entry)s(n);let x={get current(){return t},get context(){return n},send(s){let c=e.states[t];if(!c?.on)return false;let b=c.on[s];if(b===void 0)return false;let{target:B,actions:Ut,guard:ct}=pt(b);if(ct&&!ct(n))return false;let _t=t;return r(c.exit),r(Ut),t=B,r(e.states[t]?.entry),i(_t),true},can(s){let c=e.states[t];if(!c?.on)return false;let b=c.on[s];if(b===void 0)return false;let{guard:B}=pt(b);return !(B&&!B(n))},matches(s){return t===s},subscribe(s){return o.add(s),()=>{o.delete(s);}},validEvents(){let s=e.states[t];if(!s?.on)return [];let c=[];for(let b of Object.keys(s.on))x.can(b)&&c.push(b);return c},reset(){let s=t;r(e.states[t]?.exit),t=e.initial,r(e.states[t]?.entry),i(s);}};return x}var Lt=z$1.union([z$1.string(),z$1.object({target:z$1.string()})]),Ot=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(),Lt).optional()});z$1.object({initial:z$1.string(),states:z$1.record(z$1.string(),Ot),context:z$1.unknown().optional()});var Ft=1e4;function wt(e=Ft){return {machineId:new Uint32Array(e),currentState:new Uint16Array(e),previousState:new Uint16Array(e),stateAge:new Float32Array(e)}}var l=wt(),ht=new WeakSet,bt=null;function S(e){return ht.has(e)||(bt=l$1(e,m$1(()=>l)),ht.add(e)),bt}var X=new Map,q=new Map,J=new Map,gt=1,C={register(e){let t=gt++,n=xt(e);X.set(t,n);let o=Object.keys(e.states),r=new Map;for(let i=0;i<o.length;i++){let d=o[i];d!==void 0&&r.set(d,i);}return q.set(t,r),J.set(t,o),t},getMachine(e){return X.get(e)},getStateIndex(e,t){return q.get(e)?.get(t)??0},getStateName(e,t){return J.get(e)?.[t]??""},unregister(e){X.delete(e),q.delete(e),J.delete(e);},clear(){X.clear(),q.clear(),J.clear(),gt=1;}};function k(e,t,n){let o=S(e),r=C.register(n),i=C.getStateIndex(r,n.initial);return h$1(e,t,o),l.machineId[t]=r,l.currentState[t]=i,l.previousState[t]=i,l.stateAge[t]=0,r}function Me(e,t){let n=S(e);if(!i(e,t,n))return;let o=l.machineId[t]??0;C.unregister(o),j$1(e,t,n);}function h(e,t){let n=S(e);if(!i(e,t,n))return "";let o=l.machineId[t]??0,r=l.currentState[t]??0;return C.getStateName(o,r)}function Re(e,t){let n=S(e);if(!i(e,t,n))return "";let o=l.machineId[t]??0,r=l.previousState[t]??0;return C.getStateName(o,r)}function m(e,t,n){let o=S(e);if(!i(e,t,o))return false;let r=l.machineId[t]??0,i$1=C.getMachine(r);if(!i$1)return false;let d=i$1.current,x=i$1.send(n);if(x){let s=C.getStateIndex(r,i$1.current),c=C.getStateIndex(r,d);l.previousState[t]=c,l.currentState[t]=s,l.stateAge[t]=0;}return x}function Ue(e,t,n){let o=S(e);if(!i(e,t,o))return false;let r=l.machineId[t]??0,i$1=C.getMachine(r);return i$1?i$1.can(n):false}function _e(e,t){let n=S(e);return i(e,t,n)?l.stateAge[t]??0:0}function I(e,t,n){return h(e,t)===n}function De(e,t,n){let o=S(e);for(let r of t)if(i(e,r,o)){let i=l.stateAge[r]??0;l.stateAge[r]=i+n;}}function W(e,t){let n=S(e);return i(e,t,n)}var Vt={initial:"unchecked",states:{unchecked:{on:{toggle:"checked",check:"checked",disable:"disabled"}},checked:{on:{toggle:"unchecked",uncheck:"unchecked",disable:"disabled"}},disabled:{on:{enable:"unchecked"}}}},Pt=1e4;function Ht(e=Pt){return {isCheckbox:new Uint8Array(e),machineId:new Uint32Array(e)}}var P=Ht(),A=new Map,yt="\u2611",Et="\u2610",H=new Map;function we(){P.isCheckbox.fill(0),P.machineId.fill(0),A.clear(),H.clear();}function Ve(e,t,n=false){let o=k(e,t,Vt);return P.isCheckbox[t]=1,P.machineId[t]=o,n&&m(e,t,"check"),o}function K(e,t){return (P.isCheckbox[t]??0)===1&&W(e,t)}function Z(e,t){if(K(e,t))return h(e,t)}function N(e,t,n){if(!K(e,t))return false;let o=h(e,t),r=m(e,t,n);if(r){oa(e,t);let i=h(e,t);(o==="checked"||o==="unchecked")&&(i==="checked"||i==="unchecked")&&o!==i&&Gt(t,i==="checked");}return r}function $(e,t,n){return K(e,t)?I(e,t,n):false}function Pe(e,t){return $(e,t,"checked")}function He(e,t){return $(e,t,"unchecked")}function Ke(e,t){return $(e,t,"disabled")}function Kt(e,t){return N(e,t,"toggle")}function Nt(e,t){return N(e,t,"check")}function jt(e,t){return N(e,t,"uncheck")}function Ne(e,t){return N(e,t,"disable")}function je(e,t){return N(e,t,"enable")}function Ge(e,t,n){if(!K(e,t))return false;let o=Z(e,t);return o==="disabled"?false:n&&o==="unchecked"?Nt(e,t):!n&&o==="checked"?jt(e,t):false}function Ye(e,t){let n=A.get(e);return n||(n=[],A.set(e,n)),n.push(t),()=>{let o=A.get(e);if(o){let r=o.indexOf(t);r!==-1&&o.splice(r,1);}}}function Gt(e,t){let n=A.get(e);if(n)for(let o of n)o(t);}function ze(e){A.delete(e);}function Xe(e,t,n){return !K(e,t)||Z(e,t)==="disabled"?false:n==="return"||n==="enter"||n==="space"?(Kt(e,t),true):false}function qe(e,t){let n=H.get(e)??{checkedChar:yt,uncheckedChar:Et};H.set(e,{checkedChar:t.checkedChar??n.checkedChar,uncheckedChar:t.uncheckedChar??n.uncheckedChar});}function Yt(e){return H.get(e)??{checkedChar:yt,uncheckedChar:Et}}function Je(e,t){let n=Yt(t);return Z(e,t)==="checked"?n.checkedChar:n.uncheckedChar}function Qe(e){H.delete(e);}var zt={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"}}}},Xt=1e4;function qt(e=Xt){return {isButton:new Uint8Array(e),machineId:new Uint32Array(e)}}var j=qt(),M=new Map;function en(){j.isButton.fill(0),j.machineId.fill(0),M.clear();}function nn(e,t){let n=k(e,t,zt);return j.isButton[t]=1,j.machineId[t]=n,n}function G(e,t){return (j.isButton[t]??0)===1&&W(e,t)}function Ct(e,t){if(G(e,t))return h(e,t)}function St(e,t,n){if(!G(e,t))return false;let o=h(e,t),r=m(e,t,n);return r&&(oa(e,t),o==="pressed"&&n==="mouseup"&&mt(t)),r}function Q(e,t,n){return G(e,t)?I(e,t,n):false}function on(e,t){return Q(e,t,"hovered")}function rn(e,t){return Q(e,t,"pressed")}function an(e,t){return Q(e,t,"focused")}function sn(e,t){return Q(e,t,"disabled")}function cn(e,t){return St(e,t,"disable")}function un(e,t){return St(e,t,"enable")}function ln(e,t){let n=M.get(e);return n||(n=[],M.set(e,n)),n.push(t),()=>{let o=M.get(e);if(o){let r=o.indexOf(t);r!==-1&&o.splice(r,1);}}}function mt(e){let t=M.get(e);if(t)for(let n of t)n();}function Jt(e,t){return !G(e,t)||Ct(e,t)==="disabled"?false:(mt(t),true)}function dn(e){M.delete(e);}function fn(e,t,n){if(!G(e,t))return false;let o=Ct(e,t);return o==="disabled"||o!=="focused"?false:n==="return"||n==="enter"||n==="space"?(Jt(e,t),true):false}var Qt={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"}}}},Zt=1e4,U={Line:0,Block:1},$t=530;function te(e=Zt){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 a=te(),tt="*",et="",O=new Map,_=new Map,D=new Map,L=new Map,R=new Map;function bn(){a.isTextInput.fill(0),a.machineId.fill(0),a.cursorPos.fill(0),a.selectionStart.fill(-1),a.selectionEnd.fill(-1),a.inputMode.fill(0),a.cursorMode.fill(0),a.cursorBlink.fill(1),a.cursorBlinkStart.fill(0),O.clear(),_.clear(),D.clear(),L.clear(),it.clear(),R.clear();}function gn(e,t){let n=k(e,t,Qt);return a.isTextInput[t]=1,a.machineId[t]=n,a.cursorPos[t]=0,a.selectionStart[t]=-1,a.selectionEnd[t]=-1,a.inputMode[t]=0,a.cursorMode[t]=U.Line,a.cursorBlink[t]=1,a.cursorBlinkStart[t]=Date.now(),O.set(t,{secret:false,censor:tt,placeholder:et,maxLength:0,multiline:false}),n}function v(e,t){return (a.isTextInput[t]??0)===1&&W(e,t)}function nt(e,t){if(v(e,t))return h(e,t)}function T(e,t,n){if(!v(e,t))return false;let o=m(e,t,n);if(o){oa(e,t);let r=h(e,t);a.inputMode[t]=r==="editing"?1:0;}return o}function ot(e,t,n){return v(e,t)?I(e,t,n):false}function yn(e,t){let n=nt(e,t);return n==="focused"||n==="editing"}function En(e,t){return ot(e,t,"editing")}function Cn(e,t){return ot(e,t,"error")}function Sn(e,t){return ot(e,t,"disabled")}function ee(e,t){return T(e,t,"focus")}function mn(e,t){return T(e,t,"blur")}function vn(e,t){return T(e,t,"startEdit")}function kn(e,t){return T(e,t,"endEdit")}function In(e,t){return T(e,t,"disable")}function Wn(e,t){return T(e,t,"enable")}function Tn(e,t){return T(e,t,"error")}function Bn(e,t){return T(e,t,"clearError")}function rt(e,t){return a.cursorPos[t]??0}function ne(e,t,n){v(e,t)&&(a.cursorPos[t]=Math.max(0,n),a.cursorBlinkStart[t]=Date.now(),oa(e,t));}function An(e,t,n){let o=rt(e,t);ne(e,t,o+n);}function vt(e,t){let n=a.selectionStart[t],o=a.selectionEnd[t];return n===void 0||o===void 0||n<0||o<0?null:[n,o]}function Mn(e,t,n,o){v(e,t)&&(a.selectionStart[t]=n,a.selectionEnd[t]=o,oa(e,t));}function Rn(e,t){v(e,t)&&(a.selectionStart[t]=-1,a.selectionEnd[t]=-1,oa(e,t));}function Un(e,t){return vt(e,t)!==null}var oe="\u2502",re="\u2588",it=new Map;function at(e,t){return it.get(t)??{blink:true,blinkIntervalMs:$t,lineChar:oe,blockChar:re}}function _n(e,t,n){let o=at(e,t);it.set(t,{blink:n.blink??o.blink,blinkIntervalMs:n.blinkIntervalMs??o.blinkIntervalMs,lineChar:n.lineChar??o.lineChar,blockChar:n.blockChar??o.blockChar});}function st(e,t){return a.cursorMode[t]??0}function ie(e,t,n){v(e,t)&&(a.cursorMode[t]=n,oa(e,t));}function Dn(e,t){let o=st(e,t)===U.Line?U.Block:U.Line;return ie(e,t,o),o}function ae(e,t){return (a.cursorBlink[t]??1)===1}function Ln(e,t,n){v(e,t)&&(a.cursorBlink[t]=n?1:0,n&&(a.cursorBlinkStart[t]=Date.now()),oa(e,t));}function On(e,t){a.cursorBlinkStart[t]=Date.now();}function se(e,t){let n=nt(e,t);if(n!=="focused"&&n!=="editing")return false;if(!ae(e,t))return true;let o=at(e,t),r=a.cursorBlinkStart[t]??Date.now(),i=Date.now()-r;return Math.floor(i/o.blinkIntervalMs)%2===0}function ce(e,t){let n=at(e,t);return st(e,t)===U.Block?n.blockChar:n.lineChar}function Fn(e,t,n){let o=y(e,t),r=rt(e,t),i=n;if(o.secret&&(i=o.censor.repeat(n.length)),i.length===0&&o.placeholder)return {displayText:o.placeholder,cursorVisible:false,cursorPosition:0};if(!se(e,t))return {displayText:i,cursorVisible:false,cursorPosition:r};let x=ce(e,t),s=st(e,t),c;return s===U.Block&&r<i.length?c=i.substring(0,r)+x+i.substring(r+1):c=i.substring(0,r)+x+i.substring(r),{displayText:c,cursorVisible:true,cursorPosition:r}}function wn(e,t){let n=vt(e,t);if(!n)return null;let[o,r]=n;return {start:Math.min(o,r),end:Math.max(o,r)}}function Vn(e,t,n){let o=O.get(t)??{secret:false,censor:tt,placeholder:et,maxLength:0,multiline:false,validator:void 0,validationTiming:"both"};O.set(t,{secret:n.secret??o.secret,censor:n.censor??o.censor,placeholder:n.placeholder??o.placeholder,maxLength:n.maxLength??o.maxLength,multiline:n.multiline??o.multiline,validator:n.validator??o.validator,validationTiming:n.validationTiming??o.validationTiming});}function y(e,t){return O.get(t)??{secret:false,censor:tt,placeholder:et,maxLength:0,multiline:false,validator:void 0,validationTiming:"both"}}function ue(e,t){return y(e,t).secret}function le(e,t){return y(e,t).censor}function Pn(e,t){return y(e,t).placeholder}function Hn(e,t){return y(e,t).maxLength}function Kn(e,t){return y(e,t).multiline}function Nn(e,t,n){return ue(e,t)?le(e,t).repeat(n.length):n}function jn(e,t,n){let o=_.get(t);return o||(o=[],_.set(t,o)),o.push(n),()=>{let r=_.get(t);if(r){let i=r.indexOf(n);i!==-1&&r.splice(i,1);}}}function Gn(e,t,n){let o=D.get(t);return o||(o=[],D.set(t,o)),o.push(n),()=>{let r=D.get(t);if(r){let i=r.indexOf(n);i!==-1&&r.splice(i,1);}}}function Yn(e,t,n){let o=L.get(t);return o||(o=[],L.set(t,o)),o.push(n),()=>{let r=L.get(t);if(r){let i=r.indexOf(n);i!==-1&&r.splice(i,1);}}}function zn(e,t,n){let o=y(e,t);o.validator&&(o.validationTiming==="onChange"||o.validationTiming==="both")&&kt(e,t,n);let r=_.get(t);if(r)for(let i of r)i(n);}function Xn(e,t,n){let o=y(e,t);if(o.validator&&(o.validationTiming==="onSubmit"||o.validationTiming==="both")&&!kt(e,t,n))return false;let r=D.get(t);if(r)for(let i of r)i(n);return true}function qn(e,t){let n=L.get(t);if(n)for(let o of n)o();}function Jn(e,t){_.delete(t),D.delete(t),L.delete(t),O.delete(t),R.delete(t);}function kt(e,t,n){let o=y(e,t);if(!o.validator)return R.set(t,null),true;let r=o.validator(n);return r===true?(R.set(t,null),true):r===false?(R.set(t,"Invalid input"),false):(R.set(t,r),false)}function de(e,t,n){return e.multiline?e.maxLength>0&&n.length>=e.maxLength?null:{type:"newline",position:t}:{type:"submit",value:n}}function fe(e,t){return e.multiline?{type:"submit",value:t}:{type:"cancel"}}function pe(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 xe(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 he(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 be(e,t,n,o){return e.length!==1||n.maxLength>0&&o>=n.maxLength?null:{type:"insert",char:e,position:t}}function Qn(e,t,n,o,r=false){if(!v(e,t))return null;let i=nt(e,t);if(i==="disabled")return null;if(i==="idle")return ee(e,t),null;let d=rt(e,t),x=y(e,t),s=o.length;if(n==="return"||n==="enter")return de(x,d,o);if(n==="escape")return fe(x,o);if(r){let B=he(n,d,o);if(B)return B}let c=xe(n,d,s);if(c)return c;let b=pe(n,d,s);return b||be(n,d,x,s)}var ge={initial:"unselected",states:{unselected:{on:{select:"selected",disable:"disabled"}},selected:{on:{deselect:"unselected",disable:"disabled"}},disabled:{on:{enable:"unselected"}}}},It=1e4;function ye(e=It){return {isRadioButton:new Uint8Array(e),machineId:new Uint32Array(e),radioSetId:new Uint32Array(e)}}var p=ye();function Ee(e=It){return {isRadioSet:new Uint8Array(e),selectedButton:new Uint32Array(e)}}var g=Ee(),Wt="\u25C9",Tt="\u25CB",Y=new Map,w=new Map,F=new Map;function eo(){p.isRadioButton.fill(0),p.machineId.fill(0),p.radioSetId.fill(0),g.isRadioSet.fill(0),g.selectedButton.fill(0),Y.clear(),w.clear(),F.clear();}function no(e,t){g.isRadioSet[t]=1,g.selectedButton[t]=0,oa(e,t);}function oo(e,t){return g.isRadioSet[t]===1}function Ce(e){return g.selectedButton[e]}function ro(e){let t=g.selectedButton[e];return t===0?null:w.get(t)??null}function io(e,t){let n=F.get(e)??[];return n.push(t),F.set(e,n),()=>{let o=F.get(e);if(o){let r=o.indexOf(t);r!==-1&&o.splice(r,1);}}}function Bt(e){let t=F.get(e);if(t){let n=Ce(e),o=n!==0?w.get(n)??null:null;for(let r of t)r(o,n!==0?n:null);}}function ao(e){F.delete(e);}function so(e,t,n){p.isRadioButton[t]=1,p.radioSetId[t]=n??0;let o=k(e,t,ge);return p.machineId[t]=o,me(t,{}),oa(e,t),o}function V(e,t){return p.isRadioButton[t]===1}function co(e,t){if(V(e,t)&&W(e,t))return h(e,t)}function z(e,t,n){return V(e,t)?m(e,t,n):false}function At(e,t,n){return V(e,t)?I(e,t,n):false}function Se(e,t){return At(e,t,"selected")}function Mt(e,t){return At(e,t,"disabled")}function uo(e){return p.radioSetId[e]}function lo(e,t){p.radioSetId[e]=t;}function fo(e){return w.get(e)}function po(e,t){w.set(e,t);}function Rt(e,t){if(!V(e,t)||Mt(e,t))return;let n=p.radioSetId[t];if(n!==0){let o=g.selectedButton[n];o!==0&&o!==t&&z(e,o,"deselect"),g.selectedButton[n]=t;}z(e,t,"select"),oa(e,t),n!==0&&Bt(n);}function xo(e,t){if(!V(e,t))return;z(e,t,"deselect");let n=p.radioSetId[t];n!==0&&g.selectedButton[n]===t&&(g.selectedButton[n]=0,Bt(n)),oa(e,t);}function ho(e,t){z(e,t,"disable"),oa(e,t);}function bo(e,t){z(e,t,"enable"),oa(e,t);}function me(e,t){let n=Y.get(e);Y.set(e,{selectedChar:t.selectedChar??n?.selectedChar??Wt,unselectedChar:t.unselectedChar??n?.unselectedChar??Tt});}function ve(e){return Y.get(e)??{selectedChar:Wt,unselectedChar:Tt}}function go(e,t){let n=ve(t);return Se(e,t)?n.selectedChar:n.unselectedChar}function yo(e){Y.delete(e);}function Eo(e,t,n){return !V(e,t)||Mt(e,t)?false:n==="space"||n==="return"||n==="enter"?(Rt(e,t),true):false}function ke(e){let t=[];for(let n=0;n<p.isRadioButton.length;n++)p.isRadioButton[n]===1&&p.radioSetId[n]===e&&t.push(n);return t}function Co(e,t,n){let o=ke(t);for(let r of o)if(w.get(r)===n)return Rt(e,r),true;return false}export{dn as $,Nn as $a,jt as A,ne as Aa,Mt as Ab,Ne as B,An as Ba,uo as Bb,je as C,vt as Ca,lo as Cb,Ge as D,Mn as Da,fo as Db,Ye as E,Rn as Ea,po as Eb,ze as F,Un as Fa,Rt as Fb,Xe as G,oe as Ga,xo as Gb,qe as H,re as Ha,ho as Hb,Yt as I,at as Ia,bo as Ib,Je as J,_n as Ja,me as Jb,Qe as K,st as Ka,ve as Kb,zt as L,ie as La,go as Lb,j as M,Dn as Ma,yo as Mb,en as N,ae as Na,Eo as Nb,nn as O,Ln as Oa,ke as Ob,G as P,On as Pa,Co as Pb,Ct as Q,se as Qa,St as R,ce as Ra,Q as S,Fn as Sa,on as T,wn as Ta,rn as U,Vn as Ua,an as V,y as Va,sn as W,ue as Wa,cn as X,le as Xa,un as Y,Pn as Ya,ln as Z,Hn as Za,Jt as _,Kn as _a,C as a,fn as aa,jn as ab,k as b,Qt as ba,Gn as bb,Me as c,U as ca,Yn as cb,h as d,$t as da,zn as db,Re as e,a as ea,Xn as eb,m as f,tt as fa,qn as fb,Ue as g,et as ga,Jn as gb,_e as h,bn as ha,Qn as hb,I as i,gn as ia,ge as ib,De as j,v as ja,p as jb,W as k,nt as ka,g as kb,Vt as l,T as la,Wt as lb,P as m,ot as ma,Tt as mb,yt as n,yn as na,eo as nb,Et as o,En as oa,no as ob,we as p,Cn as pa,oo as pb,Ve as q,Sn as qa,Ce as qb,K as r,ee as ra,ro as rb,Z as s,mn as sa,io as sb,N as t,vn as ta,ao as tb,$ as u,kn as ua,so as ub,Pe as v,In as va,V as vb,He as w,Wn as wa,co as wb,Ke as x,Tn as xa,z as xb,Kt as y,Bn as ya,At as yb,Nt as z,rt as za,Se as zb};
@@ -1 +0,0 @@
1
- import {z}from'zod';z.object({enabled:z.boolean(),scrollStep:z.number().int().positive(),horizontalStep:z.number().int().positive(),viewportHeight:z.number().int().positive()});var d={enabled:false,scrollStep:1,horizontalStep:1,viewportHeight:24};function m(){return {mode:"normal",searchBuffer:"",lastSearch:"",lastSearchDirection:"forward",countPrefix:0,gPending:false}}function p(e){return {...d,...e}}function h(e,r,n){return n.enabled?r.mode==="search"?w(e,r):x(e,r,n):[{type:"none"},r]}function s(e,r,n){if(!n.enabled)return false;if(r.mode==="search")return true;let t=e.name;if(!e.ctrl&&!e.meta&&t>="1"&&t<="9"||r.countPrefix>0&&t==="0")return true;let i=new Set(["j","k","h","l","g","/","n"]);return !!(!e.ctrl&&!e.meta&&!e.shift&&i.has(t)||e.shift&&(t==="g"||t==="h"||t==="m"||t==="l"||t==="n")||e.ctrl&&(t==="d"||t==="u"||t==="f"||t==="b"))}function g(e,r){let n=e.name;if(!e.ctrl&&!e.meta&&!e.shift&&n>="1"&&n<="9"){let t=Number(n);return [{type:"none"},{...r,countPrefix:r.countPrefix*10+t,gPending:false}]}return r.countPrefix>0&&n==="0"&&!e.ctrl&&!e.meta?[{type:"none"},{...r,countPrefix:r.countPrefix*10}]:null}function V(e,r,n,t){let i=e.name,o=!e.ctrl&&!e.meta&&!e.shift;return i==="j"&&o?[{type:"scroll",direction:"down",amount:r*n.scrollStep},t]:i==="k"&&o?[{type:"scroll",direction:"up",amount:r*n.scrollStep},t]:i==="h"&&o?[{type:"scroll",direction:"left",amount:r*n.horizontalStep},t]:i==="l"&&o?[{type:"scroll",direction:"right",amount:r*n.horizontalStep},t]:null}function y(e,r,n){let t=e.name;return t==="g"&&!e.ctrl&&!e.meta&&!e.shift?r.gPending?[{type:"jump",target:"top"},n]:[{type:"none"},{...r,gPending:true}]:e.shift&&t==="g"?[{type:"jump",target:"bottom"},n]:e.shift&&t==="h"?[{type:"jump",target:"high"},n]:e.shift&&t==="m"?[{type:"jump",target:"middle"},n]:e.shift&&t==="l"?[{type:"jump",target:"low"},n]:null}function S(e,r){let n=e.name;return e.ctrl&&n==="d"?[{type:"page",direction:"down",amount:"half"},r]:e.ctrl&&n==="u"?[{type:"page",direction:"up",amount:"half"},r]:e.ctrl&&n==="f"?[{type:"page",direction:"down",amount:"full"},r]:e.ctrl&&n==="b"?[{type:"page",direction:"up",amount:"full"},r]:null}function b(e,r,n){let t=e.name;return t==="/"&&!e.ctrl&&!e.meta&&!e.shift?[{type:"enterSearch"},{...n,mode:"search",searchBuffer:""}]:t==="n"&&!e.ctrl&&!e.meta&&!e.shift?r.lastSearch?[{type:"searchNext",direction:r.lastSearchDirection},n]:[{type:"none"},n]:e.shift&&t==="n"?r.lastSearch?[{type:"searchNext",direction:r.lastSearchDirection==="forward"?"backward":"forward"},n]:[{type:"none"},n]:null}function x(e,r,n){let t=g(e,r);if(t)return t;let i=r.countPrefix>0?r.countPrefix:1,o={...r,countPrefix:0,gPending:false},u=V(e,i,n,o);if(u)return u;let c=y(e,r,o);if(c)return c;let l=S(e,o);if(l)return l;let f=b(e,r,o);return f||[{type:"none"},o]}function w(e,r){if(e.name==="return"||e.name==="enter")return r.searchBuffer.length===0?[{type:"exitSearch"},{...r,mode:"normal"}]:[{type:"search",query:r.searchBuffer,direction:"forward"},{...r,mode:"normal",lastSearch:r.searchBuffer,lastSearchDirection:"forward",searchBuffer:""}];if(e.name==="escape")return [{type:"exitSearch"},{...r,mode:"normal",searchBuffer:""}];if(e.name==="backspace")return r.searchBuffer.length===0?[{type:"exitSearch"},{...r,mode:"normal"}]:[{type:"none"},{...r,searchBuffer:r.searchBuffer.slice(0,-1)}];if(e.sequence.length===1&&!e.ctrl&&!e.meta){let n=r.searchBuffer+e.sequence;return [{type:"searchInput",char:e.sequence},{...r,searchBuffer:n}]}return [{type:"none"},r]}function v(e,r){return e==="half"?Math.max(1,Math.floor(r/2)):Math.max(1,r-1)}function P(e,r,n,t){switch(e){case "top":return 0;case "bottom":return Math.max(0,t-1);case "high":return r;case "middle":return r+Math.floor(n/2);case "low":return r+n-1}}export{m as a,p as b,h as c,s as d,v as e,P as f};
@@ -1 +0,0 @@
1
- import {a,b as b$1,j as j$1,f,g as g$1}from'./chunk-RJULLVTH.js';import {n,d,h as h$1,i,j as j$2}from'./chunk-P3ZLIQJP.js';function v(e=1024){let t=Math.max(1,e),n=new Uint32Array(t),o=new Int32Array(t);for(let a=0;a<t-1;a++)o[a]=a+1;return o[t-1]=-1,{generations:n,freeList:o,freeHead:0,capacity:t,size:0}}function H(e){let t=e.capacity,n=t*2,o=new Uint32Array(n);o.set(e.generations);let a=new Int32Array(n);a.set(e.freeList);for(let i=t;i<n-1;i++)a[i]=i+1;a[n-1]=e.freeHead,e.freeHead=t,e.generations=o,e.freeList=a,e.capacity=n;}function b(e){e.freeHead===-1&&H(e);let t=e.freeHead,n=e.freeList[t];e.freeHead=n!==void 0?n:-1,e.freeList[t]=-2,e.size++;let o=e.generations[t];return {index:t,gen:o!==void 0?o:0}}function g(e,t){return t.index<0||t.index>=e.capacity?false:e.generations[t.index]===t.gen&&e.freeList[t.index]===-2}function z(e,t){if(!g(e,t))return false;let{index:n}=t,o=e.generations[n];return o!==void 0&&(e.generations[n]=o+1),e.freeList[n]=e.freeHead,e.freeHead=n,e.size--,true}function R(e){let{capacity:t}=e;for(let n=0;n<t;n++){let o=e.generations[n];o!==void 0&&(e.generations[n]=o+1);}for(let n=0;n<t-1;n++)e.freeList[n]=n+1;e.freeList[t-1]=-1,e.freeHead=0,e.size=0;}function h(e){return e.size}function C(e){return e.capacity}function F(e,t){if(!g(e,t))throw new Error(`Invalid entity handle: index=${t.index}, gen=${t.gen}, current_gen=${e.generations[t.index]??"out of bounds"}`)}n();var c=new Map,I={maxSize:0,preallocate:0};function Y(e,t){c.has(e.name)||c.set(e.name,{definition:e,config:{...I,...t},freeStore:a(),freeHandles:new Map,activeStore:a(),activeHandles:new Map,totalAllocations:0,totalRecycles:0,maxPoolSize:0});}function q(e,t,n){let o=c.get(t);if(!o)return;let a=n??o.config.preallocate;for(let i=0;i<a;i++){let r=d(e);for(let u of o.definition.components)h$1(e,r,u);let f=b$1(o.freeStore,r);o.freeHandles.set(r,f);}o.maxPoolSize=Math.max(o.maxPoolSize,o.freeStore.size);}function j(e,t){let n=c.get(t);if(!n)return null;if(n.totalAllocations++,n.freeStore.size>0){let r=j$1(n.freeStore)[n.freeStore.size-1];if(r!==void 0){n.totalRecycles++;let f$1=n.freeHandles.get(r);if(f$1&&(f(n.freeStore,f$1),n.freeHandles.delete(r)),n.definition.resetFns)for(let x of n.definition.resetFns)x(e,r);let u=b$1(n.activeStore,r);return n.activeHandles.set(r,u),r}}let o=d(e);for(let i of n.definition.components)h$1(e,o,i);let a=b$1(n.activeStore,o);return n.activeHandles.set(o,a),o}function B(e,t,n){let o=c.get(t);if(!o)return false;let a=o.activeHandles.get(n);if(!a)return false;if(f(o.activeStore,a),o.activeHandles.delete(n),o.config.maxSize>0&&o.freeStore.size>=o.config.maxSize){for(let r of o.definition.components)i(e,n,r)&&j$2(e,n,r);return false}if(o.definition.resetFns)for(let r of o.definition.resetFns)r(e,n);let i$1=b$1(o.freeStore,n);return o.freeHandles.set(n,i$1),o.maxPoolSize=Math.max(o.maxPoolSize,o.freeStore.size),true}function L(e){let t=c.get(e);return t?{name:e,pooled:t.freeStore.size,active:t.activeStore.size,totalAllocations:t.totalAllocations,totalRecycles:t.totalRecycles,hitRate:t.totalAllocations>0?t.totalRecycles/t.totalAllocations:0,maxPoolSize:t.maxPoolSize}:null}function J(){let e=[],t=0,n=0,o=0,a=0;for(let[i]of c){let r=L(i);r&&(e.push(r),t+=r.active,n+=r.pooled,o+=r.totalAllocations,a+=r.totalRecycles);}return {archetypes:e,totalActive:t,totalPooled:n,overallHitRate:o>0?a/o:0}}function K(e){let t=c.get(e);t&&(g$1(t.freeStore),t.freeHandles.clear(),g$1(t.activeStore),t.activeHandles.clear());}function Q(e){let t=c.get(e);t&&(g$1(t.freeStore),t.freeHandles.clear(),g$1(t.activeStore),t.activeHandles.clear(),c.delete(e));}function X(){for(let e of c.values())g$1(e.freeStore),e.freeHandles.clear(),g$1(e.activeStore),e.activeHandles.clear();c.clear();}export{v as a,b,g as c,z as d,R as e,h as f,C as g,F as h,Y as i,q as j,j as k,B as l,L as m,J as n,K as o,Q as p,X as q};
@@ -1 +0,0 @@
1
- import {a as a$1,f as f$1,j as j$1,b}from'./chunk-RJULLVTH.js';import {Y as Y$1,T as T$1}from'./chunk-GJ3RS2VG.js';import {n,i,h as h$1,j}from'./chunk-P3ZLIQJP.js';n();var F=1e4,a={behaviorType:new Uint8Array(F),state:new Uint8Array(F),targetEntity:new Uint32Array(F),waitTimer:new Float32Array(F),patrolIndex:new Uint16Array(F),patrolCount:new Uint16Array(F),speed:new Float32Array(F),detectionRange:new Float32Array(F),fleeRange:new Float32Array(F)},M={Idle:0,Patrol:1,Chase:2,Flee:3,Custom:4},h={Inactive:0,Active:1,Waiting:2,Completed:3},Y=new Map,S=new Map;function oe(t){a.behaviorType[t]=M.Idle,a.state[t]=h.Inactive,a.targetEntity[t]=0,a.waitTimer[t]=0,a.patrolIndex[t]=0,a.patrolCount[t]=0,a.speed[t]=1,a.detectionRange[t]=10,a.fleeRange[t]=15;}function ge(t,e,n={}){return i(t,e,a)||(h$1(t,e,a),oe(e)),a.behaviorType[e]=n.type??M.Idle,a.speed[e]=n.speed??1,a.targetEntity[e]=n.targetEntity??0,a.detectionRange[e]=n.detectionRange??10,a.fleeRange[e]=n.fleeRange??15,a.state[e]=h.Active,e}function xe(t,e){if(i(t,e,a))return {type:a.behaviorType[e],state:a.state[e],targetEntity:a.targetEntity[e],waitTimer:a.waitTimer[e],patrolIndex:a.patrolIndex[e],patrolCount:a.patrolCount[e],speed:a.speed[e],detectionRange:a.detectionRange[e],fleeRange:a.fleeRange[e]}}function Te(t,e){return i(t,e,a)}function ve(t,e){return i(t,e,a)&&j(t,e,a),Y.delete(e),S.delete(e),e}function Ee(t,e){i(t,e,a)&&(a.behaviorType[e]=M.Idle,a.state[e]=h.Active,a.targetEntity[e]=0);}function we(t,e,n,o={}){i(t,e,a)&&n.length!==0&&(a.behaviorType[e]=M.Patrol,a.state[e]=h.Active,a.patrolIndex[e]=0,a.patrolCount[e]=n.length,a.waitTimer[e]=0,Y.set(e,{points:[...n],loop:o.loop??true,waitTime:o.waitTime??0}));}function Ce(t,e,n){i(t,e,a)&&(a.behaviorType[e]=M.Chase,a.state[e]=h.Active,a.targetEntity[e]=n);}function We(t,e,n){i(t,e,a)&&(a.behaviorType[e]=M.Flee,a.state[e]=h.Active,a.targetEntity[e]=n);}function Ae(t,e,n){i(t,e,a)&&(a.behaviorType[e]=M.Custom,a.state[e]=h.Active,S.set(e,n));}function Ie(t,e){if(i(t,e,a))return a.behaviorType[e]}function Pe(t,e){if(i(t,e,a))return a.state[e]}function Fe(t,e){return i(t,e,a)?a.targetEntity[e]:0}function Be(t,e,n){i(t,e,a)&&(a.targetEntity[e]=n);}function Me(t,e,n){i(t,e,a)&&(a.speed[e]=n);}function Ye(t,e,n){i(t,e,a)&&(a.detectionRange[e]=n);}function De(t,e){return i(t,e,a)?a.state[e]===h.Active:false}function Re(t,e){return i(t,e,a)?a.state[e]===h.Waiting:false}function Xe(t,e){return i(t,e,a)?a.state[e]===h.Completed:false}function Ue(t,e){if(i(t,e,a))return Y.get(e)}function Se(t,e){if(!i(t,e,a))return;let n=Y.get(e);if(!n)return;let o=a.patrolIndex[e];return n.points[o]}function Ze(t,e,n,o,u){if(!i(t,e,a))return;let l=Y.get(e);if(!l||l.points.length===0)return;if(a.state[e]===h.Waiting){let w=a.waitTimer[e]-u;if(w>0){a.waitTimer[e]=w;return}a.waitTimer[e]=0,a.state[e]=h.Active;}let c=a.patrolIndex[e],s=l.points[c];if(!s)return;let b=s.x-n,y=s.y-o,p=Math.sqrt(b*b+y*y),x=a.speed[e],B=x*u*.5;return p<=B?ie(e,l):{dx:b/p*x,dy:y/p*x}}function ie(t,e){let n=a.patrolIndex[t]+1;if(n>=e.points.length)if(e.loop)a.patrolIndex[t]=0;else {a.state[t]=h.Completed;return}else a.patrolIndex[t]=n;if(e.waitTime>0){a.state[t]=h.Waiting,a.waitTimer[t]=e.waitTime;return}return {dx:0,dy:0}}function ke(t,e,n,o,u,l){if(!i(t,e,a))return;let c=u-n,s=l-o,b=Math.sqrt(c*c+s*s);if(b===0)return {dx:0,dy:0};let y=a.detectionRange[e];if(y>0&&b>y)return;let p=a.speed[e];return {dx:c/b*p,dy:s/b*p}}function Oe(t,e,n,o,u,l){if(!i(t,e,a))return;let c=n-u,s=o-l,b=Math.sqrt(c*c+s*s),y=a.fleeRange[e];if(y>0&&b>=y)return;if(b===0)return {dx:1,dy:0};let p=a.speed[e];return {dx:c/b*p,dy:s/b*p}}function Le(t,e,n){if(!i(t,e,a))return;let o=S.get(e);o&&o(t,e,n);}function Ve(t,e,n){if(!i(t,e,a)||a.state[e]!==h.Waiting)return;let o=a.waitTimer[e]-n;o<=0?(a.waitTimer[e]=0,a.state[e]=h.Active):a.waitTimer[e]=o;}function He(){Y.clear(),S.clear();}n();var E=1e4,Z=0,r={x:new Float32Array(E),y:new Float32Array(E),width:new Uint16Array(E),height:new Uint16Array(E),followTarget:new Uint32Array(E),smoothing:new Float32Array(E),deadZoneX:new Float32Array(E),deadZoneY:new Float32Array(E),bounded:new Uint8Array(E),minX:new Float32Array(E),maxX:new Float32Array(E),minY:new Float32Array(E),maxY:new Float32Array(E)},ue=80,le=24;function X(t){r.x[t]=0,r.y[t]=0,r.width[t]=ue,r.height[t]=le,r.followTarget[t]=Z,r.smoothing[t]=0,r.deadZoneX[t]=0,r.deadZoneY[t]=0,r.bounded[t]=0,r.minX[t]=0,r.maxX[t]=0,r.minY[t]=0,r.maxY[t]=0;}function ze(t,e,n={}){return i(t,e,r)||(h$1(t,e,r),X(e)),n.x!==void 0&&(r.x[e]=n.x),n.y!==void 0&&(r.y[e]=n.y),n.width!==void 0&&(r.width[e]=n.width),n.height!==void 0&&(r.height[e]=n.height),n.followTarget!==void 0&&(r.followTarget[e]=n.followTarget),n.smoothing!==void 0&&(r.smoothing[e]=Math.max(0,Math.min(1,n.smoothing))),n.deadZoneX!==void 0&&(r.deadZoneX[e]=n.deadZoneX),n.deadZoneY!==void 0&&(r.deadZoneY[e]=n.deadZoneY),e}function Ge(t,e){if(i(t,e,r))return {x:r.x[e],y:r.y[e],width:r.width[e],height:r.height[e],followTarget:r.followTarget[e],smoothing:r.smoothing[e],deadZoneX:r.deadZoneX[e],deadZoneY:r.deadZoneY[e],bounded:r.bounded[e]===1,minX:r.minX[e],maxX:r.maxX[e],minY:r.minY[e],maxY:r.maxY[e]}}function je(t,e){return i(t,e,r)}function Je(t,e){return i(t,e,r)&&j(t,e,r),e}function Ke(t,e,n,o){return i(t,e,r)||(h$1(t,e,r),X(e)),r.followTarget[e]=n,o!==void 0&&(r.smoothing[e]=Math.max(0,Math.min(1,o))),e}function Qe(t,e){return i(t,e,r)?r.followTarget[e]:Z}function $e(t,e){return i(t,e,r)?r.followTarget[e]!==Z:false}function et(t,e,n,o){return i(t,e,r)||(h$1(t,e,r),X(e)),r.deadZoneX[e]=n,r.deadZoneY[e]=o,e}function tt(t,e,n){return i(t,e,r)||(h$1(t,e,r),X(e)),r.bounded[e]=1,r.minX[e]=n.minX,r.maxX[e]=n.maxX,r.minY[e]=n.minY,r.maxY[e]=n.maxY,e}function nt(t,e){return i(t,e,r)&&(r.bounded[e]=0),e}function rt(t,e){return i(t,e,r)?r.bounded[e]===1:false}function at(t,e,n,o){return i(t,e,r)||(h$1(t,e,r),X(e)),r.x[e]=n,r.y[e]=o,r.bounded[e]===1&&k(e),e}function ot(t,e){if(i(t,e,r))return {x:r.x[e],y:r.y[e]}}function it(t,e,n,o){return i(t,e,r)&&(r.x[e]=r.x[e]+n,r.y[e]=r.y[e]+o,r.bounded[e]===1&&k(e)),e}function k(t){let e=r.width[t],n=r.height[t],o=r.minX[t],u=r.maxX[t],l=r.minY[t],c=r.maxY[t],s=u-e,b=c-n;r.x[t]=Math.max(o,Math.min(s,r.x[t])),r.y[t]=Math.max(l,Math.min(b,r.y[t]));}function ut(t,e,n,o){if(!i(t,e,r))return;let u=r.x[e],l=r.y[e];return {x:n-u,y:o-l}}function lt(t,e,n,o){if(!i(t,e,r))return;let u=r.x[e],l=r.y[e];return {x:n+u,y:o+l}}function mt(t,e,n,o){if(!i(t,e,r))return false;let u=r.x[e],l=r.y[e],c=r.width[e],s=r.height[e];return n>=u&&n<u+c&&o>=l&&o<l+s}function st(t,e,n,o,u,l){if(!i(t,e,r))return false;let c=r.x[e],s=r.y[e],b=r.width[e],y=r.height[e];return n<c+b&&n+u>c&&o<s+y&&o+l>s}function ft(t,e,n){if(!i(t,e,r))return;let o=r.followTarget[e];if(o===Z||!Y$1(t,o))return;let u=T$1.x[o],l=T$1.y[o],c=r.width[e],s=r.height[e],b=r.smoothing[e],y=r.deadZoneX[e],p=r.deadZoneY[e],x=u-c/2,B=l-s/2,w=r.x[e],I=r.y[e],H=w,j=I,re=w+c/2,ae=I+s/2,J=u-re,K=l-ae;if(Math.abs(J)>y){let _=J>0?x+y:x-y;H=ee(w,_,b,n);}if(Math.abs(K)>p){let _=K>0?B+p:B-p;j=ee(I,_,b,n);}r.x[e]=H,r.y[e]=j,r.bounded[e]===1&&k(e);}function ee(t,e,n,o){if(n<=0)return e;let u=1-n**(o*10);return t+(e-t)*u}function ct(t,e,n,o){if(!i(t,e,r))return e;let u=r.width[e],l=r.height[e];return r.x[e]=n-u/2,r.y[e]=o-l/2,r.bounded[e]===1&&k(e),e}n();var g=1e4,f={lifetime:new Float32Array(g),age:new Float32Array(g),fadeOut:new Uint8Array(g),char:new Uint32Array(g),startFg:new Uint32Array(g),endFg:new Uint32Array(g),emitter:new Uint32Array(g)},m={rate:new Float32Array(g),burstCount:new Uint16Array(g),lifetime:new Float32Array(g),spread:new Float32Array(g),speed:new Float32Array(g),gravity:new Float32Array(g),angle:new Float32Array(g),active:new Uint8Array(g),accumulator:new Float32Array(g)},L=new Map,C=a$1(256),A=new Map;function me(t){f.lifetime[t]=0,f.age[t]=0,f.fadeOut[t]=0,f.char[t]=0,f.startFg[t]=0,f.endFg[t]=0,f.emitter[t]=0;}function pt(t,e,n){return i(t,e,f)||(h$1(t,e,f),me(e)),f.lifetime[e]=n.lifetime,f.age[e]=0,f.fadeOut[e]=n.fadeOut?1:0,f.char[e]=n.char,f.startFg[e]=n.startFg,f.endFg[e]=n.endFg??n.startFg,f.emitter[e]=n.emitter??0,e}function ht(t,e){if(i(t,e,f))return {lifetime:f.lifetime[e],age:f.age[e],fadeOut:f.fadeOut[e]===1,char:f.char[e],startFg:f.startFg[e],endFg:f.endFg[e],emitter:f.emitter[e]}}function gt(t,e){return i(t,e,f)}function xt(t,e){if(i(t,e,f)){let n=A.get(e);n&&(f$1(C,n),A.delete(e)),j(t,e,f);}return e}function Tt(t,e){return i(t,e,f)?f.age[e]>=f.lifetime[e]:true}function se(t,e){if(!i(t,e,f))return 1;let n=f.lifetime[e];return n<=0?1:Math.min(1,f.age[e]/n)}function O(t,e,n){return Math.round(t+(e-t)*n)}function fe(t,e,n){let o=Math.max(0,Math.min(1,n)),u=t>>16&255,l=t>>8&255,c=t&255,s=t>>24&255,b=e>>16&255,y=e>>8&255,p=e&255,x=e>>24&255,B=O(u,b,o),w=O(l,y,o),I=O(c,p,o);return ((O(s,x,o)&255)<<24|(B&255)<<16|(w&255)<<8|I&255)>>>0}function vt(t,e){if(!i(t,e,f))return 0;let n=se(t,e);return fe(f.startFg[e],f.endFg[e],n)}function ce(t){m.rate[t]=0,m.burstCount[t]=0,m.lifetime[t]=1,m.spread[t]=Math.PI*2,m.speed[t]=3,m.gravity[t]=0,m.angle[t]=0,m.active[t]=1,m.accumulator[t]=0;}function Et(t,e,n){return i(t,e,m)||(h$1(t,e,m),ce(e)),m.lifetime[e]=n.lifetime,n.rate!==void 0&&(m.rate[e]=n.rate),n.burstCount!==void 0&&(m.burstCount[e]=n.burstCount),n.spread!==void 0&&(m.spread[e]=n.spread),n.speed!==void 0&&(m.speed[e]=n.speed),n.gravity!==void 0&&(m.gravity[e]=n.gravity),n.angle!==void 0&&(m.angle[e]=n.angle),n.active!==void 0&&(m.active[e]=n.active?1:0),e}function wt(t,e){if(i(t,e,m))return {rate:m.rate[e],burstCount:m.burstCount[e],lifetime:m.lifetime[e],spread:m.spread[e],speed:m.speed[e],gravity:m.gravity[e],angle:m.angle[e],active:m.active[e]===1}}function Ct(t,e){return i(t,e,m)}function Wt(t,e){if(i(t,e,m)){j(t,e,m),L.delete(e);let n=j$1(C),o=[];for(let u=0;u<C.size;u++){let l=n[u];if(l&&l.emitterId===e){let c=A.get(l.particleId);c&&o.push({handle:c,particleId:l.particleId});}}for(let u of o)f$1(C,u.handle),A.delete(u.particleId);}return e}function At(t,e){L.set(t,e);}function It(t){return L.get(t)}function Pt(t){let e=new Set,n=j$1(C);for(let o=0;o<C.size;o++){let u=n[o];u&&u.emitterId===t&&e.add(u.particleId);}return e}function Ft(t,e){let n=A.get(e);n&&(f$1(C,n),A.delete(e));let o=b(C,{particleId:e,emitterId:t});A.set(e,o);}function Bt(t,e){let n=A.get(e);n&&(f$1(C,n),A.delete(e));}function Mt(t,e){i(t,e,m)&&(m.active[e]=1);}function Yt(t,e){i(t,e,m)&&(m.active[e]=0);}function Dt(t,e){return i(t,e,m)?m.active[e]===1:false}function Rt(t,e,n){i(t,e,m)&&(m.rate[e]=n);}function Xt(t,e,n){i(t,e,m)&&(m.speed[e]=n);}function Ut(t,e,n){i(t,e,m)&&(m.gravity[e]=n);}function St(){return C}function Zt(){L.clear(),C=a$1(256),A.clear();}n();var D=1e4,V=0,te=1,W={tilesets:new Map,nameToId:new Map};function Lt(){W.tilesets.clear(),W.nameToId.clear(),te=1;}function Vt(t){let e=te++,n={id:e,name:t.name,tiles:t.tiles};return W.tilesets.set(e,n),W.nameToId.set(t.name,e),e}function Ht(t){return W.tilesets.get(t)}function _t(t){let e=W.nameToId.get(t);if(e!==void 0)return W.tilesets.get(e)}function qt(t){let e=W.tilesets.get(t);return e?(W.nameToId.delete(e.name),W.tilesets.delete(t),true):false}var ne=1,T={data:new Map};function Nt(){T.data.clear(),ne=1;}function be(t,e,n=1){let o=ne++,u=[];for(let l=0;l<n;l++)u.push({tiles:new Uint16Array(t*e),visible:true});return T.data.set(o,{width:t,height:e,layers:u}),o}function zt(t){return T.data.get(t)}function Gt(t){return T.data.delete(t)}function jt(t,e,n,o,u){let l=T.data.get(t);if(!l)return false;let c=l.layers[e];return !c||n<0||n>=l.width||o<0||o>=l.height?false:(c.tiles[o*l.width+n]=u,true)}function Jt(t,e,n,o){let u=T.data.get(t);if(!u)return V;let l=u.layers[e];return !l||n<0||n>=u.width||o<0||o>=u.height?V:l.tiles[o*u.width+n]}function Kt(t,e,n){let o=T.data.get(t);if(!o)return false;let u=o.layers[e];return u?(u.tiles.fill(n),true):false}function Qt(t,e,n,o,u,l,c){let s=T.data.get(t);if(!s)return false;let b=s.layers[e];if(!b)return false;let y=Math.max(0,n),p=Math.max(0,o),x=Math.min(s.width,n+u),B=Math.min(s.height,o+l);for(let w=p;w<B;w++)for(let I=y;I<x;I++)b.tiles[w*s.width+I]=c;return true}function $t(t){let e=T.data.get(t);return e?e.layers.length:0}function en(t){let e=T.data.get(t);if(!e)return -1;let n={tiles:new Uint16Array(e.width*e.height),visible:true};return e.layers.push(n),e.layers.length-1}function tn(t,e,n){let o=T.data.get(t);if(!o)return false;let u=o.layers[e];return u?(u.visible=n,true):false}function nn(t,e){let n=T.data.get(t);if(!n)return false;let o=n.layers[e];return o?o.visible:false}var d={width:new Uint16Array(D),height:new Uint16Array(D),tileWidth:new Uint8Array(D),tileHeight:new Uint8Array(D),dataId:new Uint32Array(D),tilesetId:new Uint32Array(D)};function de(t){d.width[t]=0,d.height[t]=0,d.tileWidth[t]=1,d.tileHeight[t]=1,d.dataId[t]=0,d.tilesetId[t]=0;}function rn(t,e,n){if(i(t,e,d)||(h$1(t,e,d),de(e)),d.width[e]=n.width,d.height[e]=n.height,d.tileWidth[e]=n.tileWidth??1,d.tileHeight[e]=n.tileHeight??1,d.tilesetId[e]=n.tilesetId,n.dataId!==void 0)d.dataId[e]=n.dataId;else {let o=be(n.width,n.height,n.layerCount??1);d.dataId[e]=o;}return e}function an(t,e){if(i(t,e,d))return {width:d.width[e],height:d.height[e],tileWidth:d.tileWidth[e],tileHeight:d.tileHeight[e],dataId:d.dataId[e],tilesetId:d.tilesetId[e]}}function on(t,e){return i(t,e,d)}function un(t,e,n=false){if(!i(t,e,d))return e;if(!n){let o=d.dataId[e];o>0&&T.data.delete(o);}return j(t,e,d),e}function ln(t,e){return i(t,e,d)?d.dataId[e]:0}var G={char:" ",fg:0,bg:0};function ye(t){let e=[];for(let n=0;n<t;n++)e.push({...G});return e}function pe(t,e,n,o){if(n<0||n>=t.width||o<0||o>=t.height)return G;let u=G;for(let l of t.layers){if(!l.visible)continue;let c=l.tiles[o*t.width+n];if(c===V)continue;let s=e.tiles[c];s&&(u={char:s.char,fg:s.fg,bg:s.bg});}return u}function mn(t,e,n,o,u,l){let c=T.data.get(t),s=W.tilesets.get(e),b=[];if(!c||!s){for(let y=0;y<l;y++)b.push(ye(u));return b}for(let y=0;y<l;y++){let p=[];for(let x=0;x<u;x++)p.push(pe(c,s,n+x,o+y));b.push(p);}return b}export{m as $,Le as A,W as Aa,Ve as B,Lt as Ba,He as C,Vt as Ca,r as D,Ht as Da,ue as E,_t as Ea,le as F,qt as Fa,ze as G,T as Ga,Ge as H,Nt as Ha,je as I,be as Ia,Je as J,zt as Ja,Ke as K,Gt as Ka,Qe as L,jt as La,$e as M,Jt as Ma,et as N,Kt as Na,tt as O,Qt as Oa,nt as P,$t as Pa,rt as Q,en as Qa,at as R,tn as Ra,ot as S,nn as Sa,it as T,d as Ta,ut as U,rn as Ua,lt as V,an as Va,mt as W,on as Wa,st as X,un as Xa,ft as Y,ln as Ya,ct as Z,mn as Za,f as _,a,pt as aa,M as b,ht as ba,h as c,gt as ca,ge as d,xt as da,xe as e,Tt as ea,Te as f,se as fa,ve as g,fe as ga,Ee as h,vt as ha,we as i,Et as ia,Ce as j,wt as ja,We as k,Ct as ka,Ae as l,Wt as la,Ie as m,At as ma,Pe as n,It as na,Fe as o,Pt as oa,Be as p,Ft as pa,Me as q,Bt as qa,Ye as r,Mt as ra,De as s,Yt as sa,Re as t,Dt as ta,Xe as u,Rt as ua,Ue as v,Xt as va,Se as w,Ut as wa,Ze as x,St as xa,ke as y,Zt as ya,Oe as z,V as za};
@@ -1 +0,0 @@
1
- import {d,f}from'./chunk-LI4Y7TBZ.js';import {T,Y as Y$1,x as x$1,v,n as n$1,e,k as k$1,s,X,a,d as d$1,c}from'./chunk-GJ3RS2VG.js';import {n,i,k,h}from'./chunk-P3ZLIQJP.js';n();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(i(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 et(n,t){return i(n,t,o)&&o.valid[t]===1}function ot(n,t){i(n,t,o)&&(o.valid[t]=0);}function G(n,t){i(n,t,o)||(h(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)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){G(n,t);let u=Y$1(n,t)?T.x[t]:0,m=Y$1(n,t)?T.y[t]:0,a=X(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$1,r){U(n,t,e,i,s$1,r);let u=A(n,t);if(!u)return;let m=s(n,t);for(let a of m)Y(n,a,u.x,u.y,u.width,u.height);}function J(n){let t=k(n,[T]),e=[];for(let i of t)x$1(n,i)?v(n,i)===n$1&&e.push(i):e.push(i);return e}var K=n=>{let t=x(n),e=J(n);for(let i of e)Y(n,i,0,0,t.width,t.height);return n};function rt(){return K}function it(n){let t=k(n,[T]);for(let e of t)i(n,e,o)&&(o.valid[e]=0);}function Q(n,t){if(!Y$1(n,t))return;let e=0,i=0,s,r;if(x$1(n,t)){let u=v(n,t);if(u!==n$1){let m=Q(n,u);if(m)e=m.x,i=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,s,r),A(n,t)}function ut(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,et as c,ot as d,K as e,rt as f,it as g,Q as h,ut as i};
@@ -1 +0,0 @@
1
- import {c,e as e$1,a,b,i as i$1}from'./chunk-Z4EZERNE.js';import {n,t,o,i,h,s as s$1}from'./chunk-P3ZLIQJP.js';n();var d=1e4,x=-1;function X(n){return -(n+2)}function j(n){if(n>=x)return null;let t=-(n+2);return t===0?0:t}function pt(n){return n<x}var y={width:new Float32Array(d),height:new Float32Array(d),minWidth:new Float32Array(d),minHeight:new Float32Array(d),maxWidth:new Float32Array(d),maxHeight:new Float32Array(d),shrink:new Uint8Array(d)};function $(n){if(n==="auto")return x;if(typeof n=="string"){let t=Number.parseFloat(n);return X(t)}return n}function mt(n,t,r,i$1){return c.parse(r),c.parse(i$1),i(n,t,y)||(h(n,t,y),y.minWidth[t]=0,y.minHeight[t]=0,y.maxWidth[t]=Number.POSITIVE_INFINITY,y.maxHeight[t]=Number.POSITIVE_INFINITY,y.shrink[t]=0),y.width[t]=$(r),y.height[t]=$(i$1),t}function P(n,t){if(i(n,t,y))return {width:y.width[t],height:y.height[t],minWidth:y.minWidth[t],minHeight:y.minHeight[t],maxWidth:y.maxWidth[t],maxHeight:y.maxHeight[t],shrink:y.shrink[t]===1}}function Et(n,t,r){return e$1.parse(r),i(n,t,y)||(h(n,t,y),y.width[t]=x,y.height[t]=x,y.minWidth[t]=0,y.minHeight[t]=0,y.maxWidth[t]=Number.POSITIVE_INFINITY,y.maxHeight[t]=Number.POSITIVE_INFINITY,y.shrink[t]=0),r.minWidth!==void 0&&(y.minWidth[t]=r.minWidth),r.minHeight!==void 0&&(y.minHeight[t]=r.minHeight),r.maxWidth!==void 0&&(y.maxWidth[t]=r.maxWidth),r.maxHeight!==void 0&&(y.maxHeight[t]=r.maxHeight),t}function ht(n,t,r){return i(n,t,y)||(h(n,t,y),y.width[t]=x,y.height[t]=x,y.minWidth[t]=0,y.minHeight[t]=0,y.maxWidth[t]=Number.POSITIVE_INFINITY,y.maxHeight[t]=Number.POSITIVE_INFINITY),y.shrink[t]=r?1:0,t}function xt(n,t){return i(n,t,y)?y.shrink[t]===1:false}function gt(n,t){return i(n,t,y)}function dt(n,t,r){if(!i(n,t,y))return;let i$1=y.width[t];if(i$1===x)return;let o=j(i$1);return o!==null?o/100*r:i$1}function Wt(n,t,r){if(!i(n,t,y))return;let i$1=y.height[t];if(i$1===x)return;let o=j(i$1);return o!==null?o/100*r:i$1}n();var S=1e4,u=0,e={parent:new Uint32Array(S),firstChild:new Uint32Array(S),nextSibling:new Uint32Array(S),prevSibling:new Uint32Array(S),childCount:new Uint16Array(S),depth:new Uint16Array(S)};function tt(n){e.parent[n]=u,e.firstChild[n]=u,e.nextSibling[n]=u,e.prevSibling[n]=u,e.childCount[n]=0,e.depth[n]=0;}function W(n,t){i(n,t,e)||(h(n,t,e),tt(t));}function C(n,t){e.depth[n]=t;let r=e.firstChild[n];for(;r!==u;)C(r,t+1),r=e.nextSibling[r];}function N(n,t,r){W(n,t),r!==u&&W(n,r);let i=e.parent[t];return i===r||(i!==u&&T(t,i),r!==u?nt(t,r):(e.parent[t]=u,C(t,0))),t}function T(n,t){let r=e.prevSibling[n],i=e.nextSibling[n];r!==u?e.nextSibling[r]=i:e.firstChild[t]=i,i!==u&&(e.prevSibling[i]=r),e.prevSibling[n]=u,e.nextSibling[n]=u,e.childCount[t]=e.childCount[t]-1;}function nt(n,t){e.parent[n]=t;let r=e.firstChild[t];if(r===u)e.firstChild[t]=n;else {let o=r;for(;e.nextSibling[o]!==u;)o=e.nextSibling[o];e.nextSibling[o]=n,e.prevSibling[n]=o;}e.childCount[t]=e.childCount[t]+1;let i=e.depth[t];C(n,i+1);}function rt(n,t,r){return N(n,r,t),t}function vt(n,t,r){return !i(n,r,e)||e.parent[r]!==t||N(n,r,u),t}function At(n,t){if(!i(n,t,e))return [];let r=[],i$1=e.firstChild[t];for(;i$1!==u;)r.push(i$1),i$1=e.nextSibling[i$1];return r}function w(n,t){if(!i(n,t,e))return [];let r=[],i$1=e.parent[t];for(;i$1!==u;)r.push(i$1),i$1=e.parent[i$1];return r}function Dt(n,t){if(!i(n,t,e))return [];let r=[],i$1=[],o=e.firstChild[t];for(;o!==u;)i$1.push(o),o=e.nextSibling[o];for(;i$1.length>0;){let f=i$1.pop();r.push(f);let c=[],b=e.firstChild[f];for(;b!==u;)c.push(b),b=e.nextSibling[b];for(let E=c.length-1;E>=0;E--)i$1.push(c[E]);}return r}function V(n,t){return i(n,t,e)?e.parent[t]:u}function It(n,t){if(i(n,t,e))return {parent:e.parent[t],firstChild:e.firstChild[t],nextSibling:e.nextSibling[t],prevSibling:e.prevSibling[t],childCount:e.childCount[t],depth:e.depth[t]}}function M(n,t){return i(n,t,e)}function O(n,t){return i(n,t,e)?e.parent[t]===u:true}function Pt(n,t){return i(n,t,e)?e.childCount[t]===0:true}function Tt(n,t){return i(n,t,e)?e.depth[t]:0}function kt(n,t){return i(n,t,e)?e.nextSibling[t]:u}function Ht(n,t){return i(n,t,e)?e.prevSibling[t]:u}function et(n,t,r){W(n,r),W(n,t);let i=e.parent[r];i!==u&&T(r,i);let o=e.firstChild[t];e.parent[r]=t,e.firstChild[t]=r,e.prevSibling[r]=u,e.nextSibling[r]=o,o!==u&&(e.prevSibling[o]=r),e.childCount[t]=e.childCount[t]+1;let f=e.depth[t];return C(r,f+1),t}function Ut(n,t,r,i){W(n,t);let o=e.childCount[t],f=i;if(f<0&&(f=Math.max(0,o+f)),f>=o)return rt(n,t,r);if(f===0)return et(n,t,r);let c=e.firstChild[t];for(let b=0;b<f;b++)c=e.nextSibling[c];return it(n,r,c)}function it(n,t,r){if(!i(n,r,e))return t;let i$1=e.parent[r];if(i$1===u)return t;W(n,t);let o=e.parent[t];o!==u&&T(t,o);let f=e.prevSibling[r];e.parent[t]=i$1,e.prevSibling[t]=f,e.nextSibling[t]=r,e.prevSibling[r]=t,f!==u?e.nextSibling[f]=t:e.firstChild[i$1]=t,e.childCount[i$1]=e.childCount[i$1]+1;let c=e.depth[i$1];return C(t,c+1),t}function Ft(n,t,r){if(!i(n,r,e))return t;let i$1=e.parent[r];if(i$1===u)return t;W(n,t);let o=e.parent[t];o!==u&&T(t,o);let f=e.nextSibling[r];e.parent[t]=i$1,e.prevSibling[t]=r,e.nextSibling[t]=f,e.nextSibling[r]=t,f!==u&&(e.prevSibling[f]=t),e.childCount[i$1]=e.childCount[i$1]+1;let c=e.depth[i$1];return C(t,c+1),t}function zt(n,t){return N(n,t,u)}function Nt(n,t){if(!i(n,t,e))return u;let r=e.firstChild[t];if(r===u)return u;for(;e.nextSibling[r]!==u;)r=e.nextSibling[r];return r}function wt(n,t){return i(n,t,e)?e.firstChild[t]:u}function Vt(n,t){if(!i(n,t,e))return -1;let r=e.parent[t];if(r===u)return -1;let i$1=0,o=e.firstChild[r];for(;o!==u;){if(o===t)return i$1;i$1++,o=e.nextSibling[o];}return -1}function Mt(n,t,r){if(!i(n,t,e)||r<0)return u;let i$1=e.firstChild[t];for(let o=0;o<r&&i$1!==u;o++)i$1=e.nextSibling[i$1];return i$1}function q(n,t){let r=[],i=e.firstChild[n];for(;i!==u;)r.push({entity:i,depth:t}),i=e.nextSibling[i];return r}function J(n,t){for(let r=n.length-1;r>=0;r--){let i=n[r];i&&t.push(i);}}function Ot(n,t,r){if(!i(n,t,e))return true;let i$1=[],o=e.depth[t]??0,f=q(t,o+1);for(J(f,i$1);i$1.length>0;){let c=i$1.pop();if(!c)continue;let{entity:b,depth:E}=c;if(r(b,E-o)===false)return false;let Q=q(b,E+1);J(Q,i$1);}return true}function Zt(n,t,r){if(!i(n,t,e))return true;let i$1=1,o=e.parent[t];for(;o!==u;){if(r(o,i$1)===false)return false;o=e.parent[o],i$1++;}return true}function ot(n,t,r){if(!i(n,t,e)||!i(n,r,e)||t===r)return false;let i$1=e.parent[r];for(;i$1!==u;){if(i$1===t)return true;i$1=e.parent[i$1];}return false}function _t(n,t,r){return ot(n,r,t)}function Rt(n,t){if(!i(n,t,e))return t;let r=t,i$1=e.parent[r];for(;i$1!==u;)r=i$1,i$1=e.parent[r];return r}function Yt(n,t,r){if(!i(n,t,e)||!i(n,r,e))return u;let i$1=new Set;i$1.add(t);let o=e.parent[t];for(;o!==u;)i$1.add(o),o=e.parent[o];if(i$1.has(r))return r;for(o=e.parent[r];o!==u;){if(i$1.has(o))return o;o=e.parent[o];}return u}function Lt(n,t){if(!i(n,t,e))return [];let r=e.parent[t];if(r===u)return [];let i$1=[],o=e.firstChild[r];for(;o!==u;)o!==t&&i$1.push(o),o=e.nextSibling[o];return i$1}n();var k=1e4,l={x:new Float32Array(k),y:new Float32Array(k),z:new Uint16Array(k),absolute:new Uint8Array(k)};function g(n,t,r,i$1,o=0){return a.parse({x:r,y:i$1,z:o}),i(n,t,l)||(h(n,t,l),l.absolute[t]=0),l.x[t]=r,l.y[t]=i$1,l.z[t]=o,t}function qt(n,t){if(i(n,t,l))return {x:l.x[t],y:l.y[t],z:l.z[t],absolute:l.absolute[t]===1}}function Jt(n,t,r){return i(n,t,l)||(h(n,t,l),l.x[t]=0,l.y[t]=0,l.z[t]=0),l.absolute[t]=r?1:0,t}function Qt(n,t){return i(n,t,l)?l.absolute[t]===1:false}function Xt(n,t){return i(n,t,l)}function tn(n,t,r,i$1){return i(n,t,l)||(h(n,t,l),l.x[t]=0,l.y[t]=0,l.z[t]=0,l.absolute[t]=0),l.x[t]=l.x[t]+r,l.y[t]=l.y[t]+i$1,t}function v(n,t,r){return b.parse(r),i(n,t,l)||(h(n,t,l),l.x[t]=0,l.y[t]=0,l.absolute[t]=0),l.z[t]=r,t}function U(n,t){return i(n,t,l)?l.z[t]:0}function nn(n,t,r){let i$1=0;for(let f of r)if(f!==t&&i(n,f,l)){let c=l.z[f];c>i$1&&(i$1=c);}let o=Math.min(i$1+1,65535);return v(n,t,o)}function rn(n,t,r){let i$1=65535;for(let f of r)if(f!==t&&i(n,f,l)){let c=l.z[f];c<i$1&&(i$1=c);}let o=Math.max(i$1-1,0);return v(n,t,o)}function en(n,t,r){let i$1=U(n,t),o=65535,f=false;for(let c of r)if(c!==t&&i(n,c,l)){let b=l.z[c];b>i$1&&b<o&&(o=b,f=true);}return f?v(n,t,Math.min(o+1,65535)):t}function on(n,t,r){let i$1=U(n,t),o=0,f=false;for(let c of r)if(c!==t&&i(n,c,l)){let b=l.z[c];b<i$1&&b>o&&(o=b,f=true);}return f?v(n,t,Math.max(o-1,0)):t}function an(n,t){let r=[];for(let i$1 of t)i(n,i$1,l)&&r.push({entity:i$1,z:l.z[i$1]});r.sort((i,o)=>i.z-o.z);for(let i=0;i<r.length;i++){let o=r[i];o&&(l.z[o.entity]=i);}}function un(n,t,r){let i=U(n,t),o=U(n,r);v(n,t,o),v(n,r,i);}function sn(n,t,r){if(!i(n,t,e)){let h=H(r,0,0,0,0);return g(n,t,h.x,h.y),t}let i$1=V(n,t);if(i$1===0){let h=H(r,0,0,0,0);return g(n,t,h.x,h.y),t}let o=P(n,i$1);if(!o){let h=H(r,0,0,0,0);return g(n,t,h.x,h.y),t}let f=P(n,t),c=f?.width??0,b=f?.height??0,E=H(r,o.width,o.height,c,b);return g(n,t,E.x,E.y),t}function H(n,t,r,i,o){switch(n){case "center":return {x:Math.floor((t-i)/2),y:Math.floor((r-o)/2)};case "top-left":case "tl":return {x:0,y:0};case "top-right":case "tr":return {x:Math.max(0,t-i),y:0};case "bottom-left":case "bl":return {x:0,y:Math.max(0,r-o)};case "bottom-right":case "br":return {x:Math.max(0,t-i),y:Math.max(0,r-o)};default:return {x:0,y:0}}}function ln(n,t,r,i$1){if(!i(n,t,e))return g(n,t,0,0),t;let o=V(n,t);if(o===0)return g(n,t,0,0),t;let f=P(n,o);if(!f)return g(n,t,0,0),t;let c=Math.floor(f.width*r/100),b=Math.floor(f.height*i$1/100);return g(n,t,c,b),t}n();t();t();var m=1e4,at=o(255,255,255),ut=o(0,0,0,0),s={visible:new Uint8Array(m),dirty:new Uint8Array(m),fg:new Uint32Array(m),bg:new Uint32Array(m),bold:new Uint8Array(m),underline:new Uint8Array(m),blink:new Uint8Array(m),inverse:new Uint8Array(m),transparent:new Uint8Array(m),opacity:new Uint8Array(m)};function st(n){s.visible[n]=1,s.dirty[n]=1,s.fg[n]=at,s.bg[n]=ut,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 _(n,t){i(n,t,s)||(h(n,t,s),st(t));}function xn(n,t,r){return i$1.parse(r),_(n,t),ft(t,r),s.dirty[t]=1,t}function lt(n,t){t.fg!==void 0&&(s.fg[n]=s$1(t.fg)),t.bg!==void 0&&(s.bg[n]=s$1(t.bg));}function A(n,t,r){r!==void 0&&(t[n]=r?1:0);}function yt(n,t){if(A(n,s.bold,t.bold),A(n,s.underline,t.underline),A(n,s.blink,t.blink),A(n,s.inverse,t.inverse),A(n,s.transparent,t.transparent),t.opacity!==void 0){let r=Math.max(0,Math.min(1,t.opacity));s.opacity[n]=Math.round(r*255);}}function ft(n,t){lt(n,t),yt(n,t);}function gn(n,t){if(i(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 dn(n,t){if(i(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 Wn(n,t){return _(n,t),s.dirty[t]=1,t}function Sn(n,t){return i(n,t,s)&&(s.dirty[t]=0),t}function Cn(n,t){return i(n,t,s)?s.dirty[t]===1:false}function R(n,t,r){_(n,t);let i=s.visible[t]===1;return s.visible[t]=r?1:0,i!==r&&(s.dirty[t]=1),t}function Z(n,t){return i(n,t,s)?s.visible[t]===1:false}function vn(n,t){return i(n,t,s)}function An(n,t){return R(n,t,true)}function Dn(n,t){return R(n,t,false)}function In(n,t){let r=Z(n,t);return R(n,t,!r)}function Pn(n,t){if(!Z(n,t))return false;if(!M(n,t))return true;let r=w(n,t);for(let i of r)if(!Z(n,i))return false;return true}function Tn(n,t){if(!M(n,t)||O(n,t))return false;let r=w(n,t);if(r.length===0)return true;let i=r[r.length-1];return i===void 0?true:!O(n,i)}export{U as $,Tt as A,kt as B,Ht as C,et as D,Ut as E,it as F,Ft as G,zt as H,Nt as I,wt as J,Vt as K,Mt as L,Ot as M,Zt as N,ot as O,_t as P,Rt as Q,Yt as R,Lt as S,l as T,g as U,qt as V,Jt as W,Qt as X,Xt as Y,tn as Z,v as _,x as a,nn as aa,X as b,rn as ba,j as c,en as ca,pt as d,on as da,y as e,an as ea,mt as f,un as fa,P as g,sn as ga,Et as h,ln as ha,ht as i,at as ia,xt as j,ut as ja,gt as k,s as ka,dt as l,xn as la,Wt as m,gn as ma,u as n,dn as na,e as o,Wn as oa,N as p,Sn as pa,rt as q,Cn as qa,vt as r,R as ra,At as s,Z as sa,w as t,vn as ta,Dt as u,An as ua,V as v,Dn as va,It as w,In as wa,M as x,Pn as xa,O as y,Tn as ya,Pt as z};
@@ -1 +0,0 @@
1
- import {s,M,ja,K,F,A,u,B,z as z$1,y,C,D,v,w,x,t,r,q,p,P,Q}from'./chunk-OMU5BSAS.js';import {n,a}from'./chunk-P3ZLIQJP.js';import {z}from'zod';n();var V=z.object({title:z.string().optional(),width:z.number().int().positive().optional().default(80),height:z.number().int().positive().optional().default(24),targetFPS:z.number().positive().optional().default(60),mouse:z.boolean().optional().default(true),alternateScreen:z.boolean().optional().default(true),hideCursor:z.boolean().optional().default(true),fixedTimestep:z.object({tickRate:z.number().positive().optional().default(60),maxUpdatesPerFrame:z.number().positive().optional().default(5),interpolate:z.boolean().optional().default(true)}).optional()});function ae(b={}){let t=V.parse(b),u=a(),n={width:t.width,height:t.height},r=s(u,n),l=M(),p=ja(),f=K(),i={targetFPS:t.targetFPS};t.fixedTimestep&&(i.fixedTimestepMode={tickRate:t.fixedTimestep.tickRate??60,maxUpdatesPerFrame:t.fixedTimestep.maxUpdatesPerFrame??5,interpolate:t.fixedTimestep.interpolate??true});let y=new Set,c=new Set,d=new Set,C=F(u,i,{onAfterFixedUpdate:(x,g,m)=>{for(let E of c)E(g,m);},onInterpolate:(x,g)=>{for(let m of d)m(g);}});return X({world:u,config:t,screen:r,loop:C,inputBuffer:l,inputState:p,actionManager:f,keyHandlers:new Map,anyKeyHandlers:new Set,mouseHandlers:new Set,updateCallbacks:y,fixedUpdateCallbacks:c,renderCallbacks:d,isQuitting:false})}function X(b){let{world:t$1,config:u$1,screen:n,loop:r$1,inputBuffer:l,inputState:p$1,actionManager:f,keyHandlers:i,anyKeyHandlers:y$1,mouseHandlers:c,updateCallbacks:d,fixedUpdateCallbacks:C$1,renderCallbacks:S}=b;function x$1(e){for(let s of y$1)s(e);let o=i.get(e.name);if(o)for(let s of o)s(e);}function g(e){for(let o of c)o(e);}function m(e){let o=P(l),s=Q(l);for(let v of o)x$1(v.event);for(let v of s)g(v.event);p$1.update(o,s,e),f.update(p$1,e);}function E(){return e=>{let o=r$1.getStats().frameTime/1e3;for(let s of d)s(o);return e}}function q$1(){return e=>{let o=r$1.getStats().frameTime/1e3;return m(o),e}}r$1.registerInputSystem(q$1());let k=false;function _(){k||(r$1.registerSystem(2,E()),k=true);}return {get world(){return t$1},get config(){return u$1},get screen(){return n},get loop(){return r$1},get inputBuffer(){return l},get inputState(){return p$1},createBox(e){return p(t$1,{...e,parent:e?.parent??n})},createText(e){return q(t$1,{...e,parent:e?.parent??n})},createButton(e){return r(t$1,{...e,parent:e?.parent??n})},createInput(e){return t(t$1,{...e,parent:e?.parent??n})},createTextarea(e){return x(t$1,{...e,parent:e?.parent??n})},createTextbox(e){return w(t$1,{...e,parent:e?.parent??n})},createCheckbox(e){return v(t$1,{...e,parent:e?.parent??n})},createRadioButton(e){return D(t$1,{...e,parent:e?.parent??n})},createRadioSet(e){return C(t$1,{...e,parent:e?.parent??n})},createSelect(e){return y(t$1,{...e,parent:e?.parent??n})},createSlider(e){return z$1(t$1,{...e,parent:e?.parent??n})},createProgressBar(e){return B(t$1,{...e,parent:e?.parent??n})},createList(e){return u(t$1,{...e,parent:e?.parent??n})},createForm(e){return A(t$1,{...e,parent:e?.parent??n})},onKey(e,o){return i.has(e)||i.set(e,new Set),i.get(e)?.add(o),()=>{i.get(e)?.delete(o);}},onAnyKey(e){return y$1.add(e),()=>{y$1.delete(e);}},onMouse(e){return c.add(e),()=>{c.delete(e);}},defineActions(e){f.registerAll(e);},isActionActive(e){return f.isActive(e)},isKeyDown(e){return p$1.isKeyDown(e)},onUpdate(e){return _(),d.add(e),()=>{d.delete(e);}},onFixedUpdate(e){return C$1.add(e),()=>{C$1.delete(e);}},onRender(e){return S.add(e),()=>{S.delete(e);}},registerSystem(e,o){return r$1.registerSystem(e,o),()=>{r$1.unregisterSystem(o);}},start(){r$1.start();},stop(){r$1.stop();},pause(){r$1.pause();},resume(){r$1.resume();},quit(){b.isQuitting=true,r$1.stop();},getStats(){return r$1.getStats()},isRunning(){return r$1.isRunning()},isPaused(){return r$1.isPaused()}}}export{V as a,ae as b};
@@ -1,8 +0,0 @@
1
- import {c as c$2,a as a$1,b}from'./chunk-OMMJ7B5P.js';import {i}from'./chunk-ZPL2J25N.js';import {ha,A,Q as Q$1,I}from'./chunk-WY5EZOOL.js';import {a,k as k$1}from'./chunk-6XWY6GB7.js';import {c,i as i$2,j}from'./chunk-DQTVJITR.js';import {u,k,o as o$1}from'./chunk-ZPGJCHXH.js';import {d,e as e$1}from'./chunk-735KKTP3.js';import {c as c$1,f as f$2}from'./chunk-APKUNIMB.js';import {T,e,ka,o,v,s,U,f,la,ua,va,q}from'./chunk-GJ3RS2VG.js';import {n,t,g,k as k$2,i as i$1,p,d as d$1,e as e$2,f as f$1,s as s$1}from'./chunk-P3ZLIQJP.js';import {z as z$1}from'zod';u();n();var z=false,N=new Map,H=null,ie=0,Oe=100;function se(n){z=n,n||N.clear();}function ae(){return z}function We(n,e){if(!z)return;let t=N.get(n);t?(t.totalTime+=e,t.callCount++):N.set(n,{name:n,totalTime:e,callCount:1});}function Ie(n,e){return(o=>{if(!z)return e(o);let r=performance.now(),s=e(o),p=performance.now()-r;return We(n,p),s})}function X(){let n={};for(let[e,t]of N)n[e]=t.callCount>0?t.totalTime/t.callCount:0;return n}function Ae(){N.clear();}function Be(){H=null,ie=0;}function J(n,e,t){let o=performance.now();if(H&&o-ie<Oe)return H;let r=t?.getStats()??{fps:0,frameTime:0,frameCount:0,runningTime:0},s=null;typeof process<"u"&&process.memoryUsage&&(s=process.memoryUsage().heapUsed/(1024*1024));let p=X();return H={fps:r.fps,frameTime:r.frameTime,frameCount:r.frameCount,runningTime:r.runningTime,entityCount:e,memoryUsageMB:s,systemTimings:p},ie=o,H}n();t();n();z$1.object({x:z$1.number().finite().optional(),y:z$1.number().finite().optional(),width:z$1.number().positive().optional(),toggleKey:z$1.string().optional(),showFPS:z$1.boolean().optional(),showEntityCount:z$1.boolean().optional(),showMemory:z$1.boolean().optional(),showSystemTimings:z$1.boolean().optional(),maxSystemsShown:z$1.number().int().positive().optional(),bgColor:z$1.number().int().nonnegative().optional(),fgColor:z$1.number().int().nonnegative().optional(),visibleOnStart:z$1.boolean().optional()});var _e={x:0,y:0,width:35,toggleKey:"F12",showFPS:true,showEntityCount:true,showMemory:true,showSystemTimings:true,maxSystemsShown:5,bgColor:33023,fgColor:4294967295,visibleOnStart:false};function me(n,e={}){let t={..._e,...e},o=t.visibleOnStart,r=null;t.showSystemTimings&&!ae()&&se(true);function s(){let m=d$1(n);return U(n,m,t.x,t.y,9999),f(n,m,t.width,10),la(n,m,{fg:t.fgColor,bg:t.bgColor}),ua(n,m),e$1(n,m,"Loading..."),b(m,"name","__debug_overlay__"),m}function p(m,y){return `\u2502 FPS: \x1B[${m>=55?"32":m>=30?"33":"31"}m${m.toString().padStart(3)}\x1B[0m (${y.toFixed(1)}ms)`}function f$1(m){let y=X(),v=Object.entries(y).filter(([,i])=>i>0).sort(([,i],[,a])=>a-i).slice(0,m);if(v.length===0)return [];let L=["\u251C\u2500 Systems \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2524"];for(let[i,a]of v){let l=a.toFixed(2).padStart(6),c=i.length>20?`${i.slice(0,17)}...`:i;L.push(`\u2502 ${c.padEnd(20)} ${l}ms`);}return L}function S(m){let y=["\u250C\u2500 Debug \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2510"];return t.showFPS&&y.push(p(m.fps,m.frameTime)),t.showEntityCount&&y.push(`\u2502 Entities: ${m.entityCount}`),t.showMemory&&m.memoryUsageMB!==null&&y.push(`\u2502 Memory: ${m.memoryUsageMB.toFixed(1)}MB`),t.showSystemTimings&&y.push(...f$1(t.maxSystemsShown)),y.push(`\u2502 Frame: ${m.frameCount}`),y.push(`\u2502 Time: ${m.runningTime.toFixed(1)}s`),y.push("\u2514\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2518"),y.join(`
2
- `)}let b$1={get visible(){return o},get entity(){return r},get config(){return t},show(){o=true,r||(r=s()),ua(n,r);},hide(){o=false,r&&va(n,r);},toggle(){o?b$1.hide():b$1.show();},update(m,y){if(!o||!r)return;let L=g(m).length,i=J(m,L,y),a=S(i);e$1(m,r,a);let l=a.split(`
3
- `).length;f(m,r,t.width,l);},destroy(){r&&(e$2(n,r),r=null),o=false;}};return o&&(r=s()),b$1}function Ue(n=20){let e=[];return {get entries(){return e},get maxEntries(){return n},log(t,o){for(e.push({type:t,detail:o,timestamp:Date.now()});e.length>n;)e.shift();},clear(){e.length=0;},getRecentEntries(t=5){return e.slice(-t)}}}function je(){let n=new Map,e=new Map;return {start(t){n.set(t,performance.now());},end(t){let o=n.get(t);if(o===void 0)return 0;let r=performance.now()-o;n.delete(t);let s=e.get(t);return s?(s.total+=r,s.min=Math.min(s.min,r),s.max=Math.max(s.max,r),s.count++):e.set(t,{total:r,min:r,max:r,count:1}),r},getAverage(t){let o=e.get(t);return !o||o.count===0?0:o.total/o.count},getAll(){let t={};for(let[o,r]of e)t[o]={avg:r.count>0?r.total/r.count:0,min:r.min,max:r.max,count:r.count};return t},reset(){n.clear(),e.clear();}}}function Ge(n=60){let e=[],t=0;return {addSample(o){for(e.push(o),t+=o;e.length>n;){let r=e.shift();r!==void 0&&(t-=r);}},getSamples(){return e},getCurrentFPS(){if(e.length===0)return 0;let o=e[e.length-1]??0;return o>0?1e3/o:0},getAverageFPS(){if(e.length===0)return 0;let o=t/e.length;return o>0?1e3/o:0},getMinMaxFPS(){if(e.length===0)return {min:0,max:0};let o=Number.MAX_VALUE,r=0;for(let s of e)o=Math.min(o,s),r=Math.max(r,s);return {min:r>0?1e3/r:0,max:o>0?1e3/o:0}},reset(){e.length=0,t=0;}}}var Re=z$1.object({enabled:z$1.boolean().optional().default(false),toggleKey:z$1.string().optional().default("F12"),showOverlay:z$1.boolean().optional().default(true),showLogs:z$1.boolean().optional().default(true),maxLogEntries:z$1.number().int().positive().optional().default(100),position:z$1.object({x:z$1.number(),y:z$1.number()}).optional(),dimensions:z$1.object({width:z$1.number().positive(),height:z$1.number().positive()}).optional(),theme:z$1.object({bg:z$1.union([z$1.string(),z$1.number()]).optional(),fg:z$1.union([z$1.string(),z$1.number()]).optional(),infoBg:z$1.union([z$1.string(),z$1.number()]).optional(),warnBg:z$1.union([z$1.string(),z$1.number()]).optional(),errorBg:z$1.union([z$1.string(),z$1.number()]).optional()}).optional()}),Q={enabled:false,toggleKey:"F12",showOverlay:true,showLogs:true,maxLogEntries:100,position:{x:0,y:0},dimensions:{width:80,height:20},theme:{bg:221,fg:4294967295,infoBg:65535,warnBg:4294902015,errorBg:4278190335}};function He(n,e={}){let t={...Q,...e,position:e.position??Q.position,dimensions:e.dimensions??Q.dimensions,theme:{...Q.theme,...e.theme??{}}};if(Re.parse(e),!t.enabled)return Ne(t);let o=[],r=false,s=null,p=null,f$2=null;t.showOverlay&&(f$2=me(n,{x:t.position.x,y:t.position.y,width:Math.floor(t.dimensions.width/2),toggleKey:t.toggleKey,visibleOnStart:false}));function S(){let u=d$1(n),x=t.showOverlay?t.position.x+Math.floor(t.dimensions.width/2)+1:t.position.x;return U(n,u,x,t.position.y,9999),f(n,u,Math.floor(t.dimensions.width/2),t.dimensions.height),la(n,u,{fg:s$1(t.theme.fg),bg:s$1(t.theme.bg)}),va(n,u),b(u,"name","__debug_console__"),u}function b$1(){let u=d$1(n);return U(n,u,0,0,0),f(n,u,Math.floor(t.dimensions.width/2),t.dimensions.height),la(n,u,{fg:s$1(t.theme.fg),bg:0}),e$1(n,u,`Debug Console
4
- \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500`),b(u,"name","__debug_log_panel__"),u}function m(){if(!p||!f$1(n,p))return;let u=t.dimensions.height-2,x=o.slice(-u),M=["Debug Console","\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500"];for(let w of x){let K=new Date(w.timestamp).toLocaleTimeString(),V=y(w.level);M.push(`${K} ${V} ${w.message}`);}e$1(n,p,M.join(`
5
- `));}function y(u){switch(u){case "debug":return "[D]";case "info":return "[I]";case "warn":return "[W]";case "error":return "[E]"}}function v(){r||(r=true,f$2&&f$2.show(),t.showLogs&&((!s||!f$1(n,s))&&(s=S(),p=b$1(),q(n,s,p)),s&&f$1(n,s)&&ua(n,s),m()));}function L(){r&&(r=false,f$2&&f$2.hide(),s&&f$1(n,s)&&va(n,s));}function i(){r?L():v();}function a(u,x="info"){let M={timestamp:Date.now(),level:x,message:u};for(o.push(M);o.length>t.maxLogEntries;)o.shift();switch(x){case "debug":console.debug(`[DEBUG] ${u}`);break;case "info":console.info(`[INFO] ${u}`);break;case "warn":console.warn(`[WARN] ${u}`);break;case "error":console.error(`[ERROR] ${u}`);break}r&&t.showLogs&&m();}function l(u,x){r&&(f$2&&f$2.update(u,x),t.showLogs&&p&&f$1(u,p)&&m());}function c(){o.length=0,r&&t.showLogs&&m();}function d(){f$2&&f$2.destroy(),p&&f$1(n,p)&&e$2(n,p),s&&f$1(n,s)&&e$2(n,s),o.length=0;}return {get enabled(){return t.enabled},get visible(){return r},get logs(){return o},get config(){return t},show:v,hide:L,toggle:i,log:a,update:l,clearLogs:c,destroy:d}}function Ne(n){return {enabled:false,visible:false,logs:[],config:n,show:()=>{},hide:()=>{},toggle:()=>{},log:()=>{},update:()=>{},clearLogs:()=>{},destroy:()=>{}}}function Ke(n,e,t="info"){switch(t){case "debug":console.debug(`[DEBUG] ${e}`);break;case "info":console.info(`[INFO] ${e}`);break;case "warn":console.warn(`[WARN] ${e}`);break;case "error":console.error(`[ERROR] ${e}`);break}}n();function Ve(n,e){let t=Y(n,e);return le(t)}function qe(n){let e=ue(n);return pe(e)}function ze(n){return g(n)}function Xe(n,e){return k$2(n,[e])}function Je(n,e){return e.length===0?[]:k$2(n,e)}function Qe(n,e){return g(n).includes(e)}function Ye(n,e){return Y(n,e).components.map(o=>o.name)}function Ze(n,e,t,o){if(!i$1(n,e,t))return;let s=t[o];if(ArrayBuffer.isView(s)||Array.isArray(s))return s[e]}n();z$1.object({snapshotInterval:z$1.number().nonnegative(),maxSnapshots:z$1.number().int().positive(),entityLeakThreshold:z$1.number().nonnegative(),heapLeakThreshold:z$1.number().nonnegative(),trackedComponents:z$1.array(z$1.object({component:z$1.unknown(),name:z$1.string()})).readonly()});var en={snapshotInterval:5e3,maxSnapshots:100,entityLeakThreshold:10,heapLeakThreshold:1024*1024,trackedComponents:[]};function nn(n){let e={...en,...n},t=[],o=null;function r(i){let a=g(i),l={};for(let{component:u,name:x}of e.trackedComponents){let M=0;for(let w of a)i$1(i,w,u)&&M++;l[x]=M;}let c=process.memoryUsage(),d={timestamp:Date.now(),entityCount:a.length,componentCounts:l,heapUsed:c.heapUsed,heapTotal:c.heapTotal,rss:c.rss,external:c.external};for(t.push(d);t.length>e.maxSnapshots;)t.shift();return d}function s(i,a){let l={},c=new Set([...Object.keys(i.componentCounts),...Object.keys(a.componentCounts)]);for(let d of c)l[d]=(a.componentCounts[d]??0)-(i.componentCounts[d]??0);return l}function p(i,a,l,c){let d=i/a;return d<=e.entityLeakThreshold?null:{type:"entity",message:`Entity count growing at ${d.toFixed(1)}/sec (${l.entityCount} -> ${c.entityCount})`,growthRate:d}}function f(i,a){let l=i/a;return l<=e.heapLeakThreshold?null:{type:"heap",message:`Heap growing at ${(l/1024).toFixed(1)}KB/sec`,growthRate:l}}function S(i,a){let l=[];for(let[c,d]of Object.entries(i)){let u=d/a;u>e.entityLeakThreshold&&l.push({type:"component",message:`${c} component growing at ${u.toFixed(1)}/sec`,growthRate:u});}return l}function b(i,a){let l=a.timestamp-i.timestamp,c=l/1e3,d=a.entityCount-i.entityCount,u=a.heapUsed-i.heapUsed,x=a.rss-i.rss,M=s(i,a),w=[];if(c>0){let K=p(d,c,i,a);K&&w.push(K);let V=f(u,c);V&&w.push(V);let Pe=S(M,c);w.push(...Pe);}return {elapsed:l,entityCountDelta:d,componentDeltas:M,heapUsedDelta:u,rssDelta:x,possibleLeaks:w}}function m(i){return Math.abs(i)<1024?`${i}B`:Math.abs(i)<1024*1024?`${(i/1024).toFixed(1)}KB`:`${(i/(1024*1024)).toFixed(1)}MB`}function y(i,a){i.push("Memory Profile Report"),i.push("\u2550".repeat(40)),i.push(`Entities: ${a.entityCount}`),i.push(`Heap Used: ${m(a.heapUsed)}`),i.push(`Heap Total: ${m(a.heapTotal)}`),i.push(`RSS: ${m(a.rss)}`),i.push(`External: ${m(a.external)}`);}function v(i,a){if(Object.keys(a.componentCounts).length!==0){i.push(""),i.push("Component Counts:");for(let[l,c]of Object.entries(a.componentCounts))i.push(` ${l}: ${c}`);}}function L(i,a){if(t.length<2)return;let l=t[0];if(!l)return;let c=b(l,a);if(i.push(""),i.push(`Trends (over ${(c.elapsed/1e3).toFixed(0)}s):`),i.push(` Entity delta: ${c.entityCountDelta>0?"+":""}${c.entityCountDelta}`),i.push(` Heap delta: ${c.heapUsedDelta>0?"+":""}${m(c.heapUsedDelta)}`),c.possibleLeaks.length>0){i.push(""),i.push("WARNINGS:");for(let d of c.possibleLeaks)i.push(` [${d.type}] ${d.message}`);}}return {snapshot(i){return r(i)},diff(i,a){return b(i,a)},getSnapshots(){return t},getLatestSnapshot(){return t.length>0?t[t.length-1]??null:null},getReport(i){let a=r(i),l=[];return y(l,a),v(l,a),L(l,a),l.join(`
6
- `)},startAutoSnapshot(i){o===null&&(e.snapshotInterval<=0||(r(i),o=setInterval(()=>{r(i);},e.snapshotInterval)));},stopAutoSnapshot(){o!==null&&(clearInterval(o),o=null);},reset(){t.length=0,o!==null&&(clearInterval(o),o=null);}}}var ce=[{component:T,name:"Position"},{component:e,name:"Dimensions"},{component:ka,name:"Renderable"},{component:d,name:"Content"},{component:k,name:"Border"},{component:a,name:"Padding"},{component:o,name:"Hierarchy"},{component:c,name:"Interactive"},{component:c$1,name:"Focusable"},{component:k$1,name:"Scrollable"},{component:ha,name:"Velocity"},{component:A,name:"Animation"},{component:Q$1,name:"Collider"},{component:i,name:"Shadow"}];function tn(n,e,t,o){if(!i$1(n,e,t))return null;let r={},s=t;for(let[p,f]of Object.entries(s))if(ArrayBuffer.isView(f)||Array.isArray(f)){let S=f;r[p]=S[e];}return {name:o,data:r}}function Y(n,e){let t=[];for(let{component:p,name:f}of ce){let S=tn(n,e,p,f);S&&t.push(S);}let o$1=i$1(n,e,o)?v(n,e):null,r=i$1(n,e,o)?s(n,e):[],s$1=c$2(e,"name")?a$1(e,"name")??null:null;return {entity:e,name:s$1,components:t,parent:o$1===0?null:o$1,children:r}}function le(n){let e=[],t=n.name?` (${n.name})`:"";e.push(`Entity ${n.entity}${t}`),n.parent!==null&&e.push(`\u251C\u2500 Parent: ${n.parent}`),n.children.length>0&&e.push(`\u251C\u2500 Children: [${n.children.join(", ")}]`);let o=n.components.length;return n.components.forEach((r,s)=>{let f=s===o-1?"\u2514\u2500":"\u251C\u2500",S=Object.entries(r.data).map(([b,m])=>{if(typeof m=="number"){if(b==="fg"||b==="bg"){let{r:y,g:v,b:L,a:i}=p(m>>>0),a=l=>l.toString(16).padStart(2,"0");return `${b}=#${a(y)}${a(v)}${a(L)}${a(Math.round(i*255))}`}if(!Number.isInteger(m))return `${b}=${m.toFixed(2)}`}return `${b}=${m}`}).join(", ");e.push(`${f} ${r.name}: ${S}`);}),e.join(`
7
- `)}function ue(n){let e=g(n),t={},o$1=[];for(let{name:r}of ce)t[r]=0;for(let r of e){for(let{component:s,name:p}of ce)if(i$1(n,r,s)){let f=t[p]??0;t[p]=f+1;}i$1(n,r,o)&&v(n,r)===0&&o$1.push(r);}return {entityCount:e.length,componentCounts:t,hierarchyRoots:o$1}}function pe(n){let e=[];e.push("World Statistics"),e.push("\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500"),e.push(`Entities: ${n.entityCount}`),e.push(""),e.push("Components:");let t=Object.entries(n.componentCounts).filter(([,o])=>o>0).sort(([,o],[,r])=>r-o);for(let[o,r]of t){let s=(r/n.entityCount*100).toFixed(0);e.push(` ${o}: ${r} (${s}%)`);}return n.hierarchyRoots.length>0&&(e.push(""),e.push(`Hierarchy Roots: [${n.hierarchyRoots.join(", ")}]`)),e.join(`
8
- `)}function Qn(n,e){let o=g(n).length;return J(n,o,e)}var E={enabled:false,showHitboxes:true,showPadding:false,showMargins:false,color:4278255360};function Yn(n,e){E.enabled=n,e&&(E.showHitboxes=e.showHitboxes??E.showHitboxes,E.showPadding=e.showPadding??E.showPadding,E.showMargins=e.showMargins??E.showMargins,E.color=e.color??E.color);}function Zn(){return E.enabled}function et(){return {...E}}function nt(n){return E.enabled?g(n).filter(t=>i$1(n,t,T)&&i$1(n,t,e)):[]}function on(n,e){let t=[];return i$1(n,e,c$1)&&f$2(n,e)&&t.push("focused"),i$1(n,e,c)&&(i$2(n,e)&&t.push("hovered"),j(n,e)&&t.push("pressed")),I(n,e)&&t.push("animated"),o$1(n,e)&&t.push("bordered"),t}function tt(n,e$1){let t=[],o=c$2(e$1,"name")?a$1(e$1,"name"):null;if(t.push(`Entity ${e$1}${o?` (${o})`:""}`),i$1(n,e$1,T)){let s=Math.round(T.x[e$1]??0),p=Math.round(T.y[e$1]??0);t.push(`@ ${s},${p}`);}i$1(n,e$1,e)&&t.push(`[${e.width[e$1]}x${e.height[e$1]}]`);let r=on(n,e$1);return r.length>0&&t.push(r.join(" ")),t.join(" ")}function ot(n,e){let t=Y(n,e),o=le(t);console.log(`[DEBUG] ${o}`);}function rt(n){let e=ue(n),t=pe(e);console.log(`[DEBUG] ${t}`);}export{ue as A,pe as B,Qn as C,Yn as D,Zn as E,et as F,nt as G,tt as H,ot as I,rt as J,se as a,ae as b,We as c,Ie as d,X as e,Ae as f,Be as g,me as h,Ue as i,je as j,Ge as k,Re as l,He as m,Ke as n,Ve as o,qe as p,ze as q,Xe as r,Je as s,Qe as t,Ye as u,Ze as v,nn as w,ce as x,Y as y,le as z};
@@ -1 +0,0 @@
1
- import {n as n$1,g as g$1,f,ka}from'./chunk-GJ3RS2VG.js';import {n,h,i}from'./chunk-P3ZLIQJP.js';n();var l=1e4,b={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 g(r,e,n={}){h(r,e,o),o.cursorX[e]=0,o.cursorY[e]=0,o.cursorVisible[e]=n.cursorVisible!==false?1:0,o.cursorShape[e]=n.cursorShape??b.BLOCK,o.focused[e]=n$1,o.hovered[e]=n$1,o.fullUnicode[e]=n.fullUnicode!==false?1:0,o.autoPadding[e]=n.autoPadding===true?1:0;}function W(r){return a.has(r)}function C(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 U(r){return a.get(r)??null}function v(r,e){return a.get(r)===e}function t(r,e){return i(r,e,o)}function A(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 V(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 w(r,e,n){return t(r,e)?(o.cursorVisible[e]=n?1:0,true):false}function N(r,e,n){return t(r,e)?(o.cursorShape[e]=n,true):false}function P(r,e){if(!t(r,e))return null;let n=o.focused[e];return n===n$1?null:n}function L(r,e,n){return t(r,e)?(o.focused[e]=n??n$1,true):false}function I(r,e){if(!t(r,e))return null;let n=o.hovered[e];return n===n$1?null:n}function B(r,e,n){return t(r,e)?(o.hovered[e]=n??n$1,true):false}function D(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===n$1?null:i,hovered:c===n$1?null:c,fullUnicode:o.fullUnicode[e]===1,autoPadding:o.autoPadding[e]===1,width:n?.width??0,height:n?.height??0}}function Y(r,e){if(!t(r,e))return;let n=g$1(r,e);if(n)return {width:n.width,height:n.height}}function K(r,e,n,i){return !t(r,e)||n<=0||i<=0?false:(f(r,e,n,i),ka.dirty[e]=1,true)}function M(r,e){return t(r,e)?o.fullUnicode[e]===1:false}function O(r,e,n){return t(r,e)?(o.fullUnicode[e]=n?1:0,true):false}function F(r,e){return t(r,e)?o.autoPadding[e]===1:false}function R(r,e,n){return t(r,e)?(o.autoPadding[e]=n?1:0,true):false}function X(r){return a.get(r)===void 0?false:(a.delete(r),true)}function _(r){a.delete(r);}export{b as a,o as b,g as c,W as d,C as e,U as f,v as g,t as h,A as i,V as j,w as k,N as l,P as m,L as n,I as o,B as p,D as q,Y as r,K as s,M as t,O as u,F as v,R as w,X as x,_ as y};
@@ -1 +0,0 @@
1
- import {l as l$1,b as b$1}from'./chunk-OFRWGW2G.js';import {f,c as c$3,e as e$1}from'./chunk-4LWWONFK.js';import {c as c$5,a as a$1}from'./chunk-FNQRUMFD.js';import {k as k$1,m,p as p$1,s,i as i$1,c as c$4,n as n$2,r as r$2}from'./chunk-CJCSZRV6.js';import {a,e as e$2,r,t,o as o$1}from'./chunk-C5PCEQ6G.js';import {f as f$1}from'./chunk-DMBMCCLN.js';import {c as c$1,v as v$1,o,m as m$1,p as p$3,k as k$2}from'./chunk-DQTVJITR.js';import {u,p as p$2,n as n$1,k as k$3}from'./chunk-ZPGJCHXH.js';import {c as c$2,l as l$2,r as r$1,q,g,h}from'./chunk-APKUNIMB.js';import {T,e,ma,xa,qa,ka,pa}from'./chunk-GJ3RS2VG.js';import {n,i,k}from'./chunk-P3ZLIQJP.js';n();var l={eventQueue:[],capturedEntity:null,lastMouseX:0,lastMouseY:0,lastHoveredEntity:null,eventBus:l$1()};function be(){l.eventQueue=[],l.capturedEntity=null,l.lastMouseX=0,l.lastMouseY=0,l.lastHoveredEntity=null;}function ge(t){l.eventQueue.push({type:"key",event:t,timestamp:Date.now()});}function ve(t){l.eventQueue.push({type:"mouse",event:t,timestamp:Date.now()});}function xe(){return l.eventQueue}function Be(){l.eventQueue=[];}function Se(){return l.eventBus}function Ie(t){l.capturedEntity=t;}function It(){l.capturedEntity=null;}function Ce(){return l.capturedEntity!==null}function Re(){return l.capturedEntity}function Ct(t,e$1,n,r){return !i(t,e$1,T)||!i(t,e$1,e)?false:Et(e$1,n,r)}function Et(t,e$1,n){let r=T.x[t]??0,o=T.y[t]??0,u=e.width[t]??0,i=e.height[t]??0;return u<=0||i<=0?false:e$1>=r&&e$1<r+u&&n>=o&&n<o+i}function De(t,e$1,n){let r=[],o=k(t,[T,e]);for(let u of o){if(!Ct(t,u,e$1,n))continue;let i=T.x[u]??0,s=T.y[u]??0,m=T.z[u]??0;r.push({entity:u,localX:e$1-i,localY:n-s,zIndex:m});}return r.sort((u,i)=>i.zIndex-u.zIndex),r}function Rt(t,e$1,n){let r=null,o=Number.NEGATIVE_INFINITY;for(let u of k(t,[T,e,c$1])){if(!Et(u,e$1,n))continue;let i=T.z[u]??0;i<o||(o=i,r=u);}return r}function Dt(t){switch(t){case "left":return c$4.LEFT;case "middle":return c$4.MIDDLE;case "right":return c$4.RIGHT;case "wheelUp":return c$4.WHEEL_UP;case "wheelDown":return c$4.WHEEL_DOWN;default:return c$4.NONE}}function Ot(t,e){let n=l$2();if(e.name==="tab"){let r=Array.from(k(t,[c$2]));e.shift?r$1(t,r):q(t,r);return}if(n!==null){let r=e.raw.length>0?e.raw[0]??0:0;i$1(t,n,{lastKeyCode:r,lastKeyTime:Date.now(),ctrl:e.ctrl,meta:e.meta,shift:e.shift}),l.eventBus.emit("keypress",{key:e.name,ctrl:e.ctrl,meta:e.meta,shift:e.shift});}}function Nt(t,e,n,r,o$1){e!==n&&(e!==null&&v$1(t,e)&&(o(t,e,false),l.eventBus.emit("mouseleave",{x:r,y:o$1})),n!==null&&v$1(t,n)&&m$1(t,n)&&(o(t,n,true),l.eventBus.emit("mouseenter",{x:r,y:o$1})),l.lastHoveredEntity=n);}function Mt(t,e,n,r,o){p$1(t,e)&&(n$2(t,e,{x:n,y:r,button:o,pressed:true}),r$2(t,e,n,r,o)),v$1(t,e)&&p$3(t,e,true),l.eventBus.emit("mousedown",{x:n,y:r,button:o}),g(t,e)&&h(t,e);}function Tt(t,e,n,r,o){p$1(t,e)&&n$2(t,e,{x:n,y:r,button:o,pressed:false}),v$1(t,e)&&p$3(t,e,false),l.eventBus.emit("mouseup",{x:n,y:r,button:o}),k$2(t,e)&&l.eventBus.emit("click",{x:n,y:r,button:o}),l.capturedEntity!==null&&It();}function Wt(t,e){let n=e.x,r=e.y,o=Dt(e.button);l.lastMouseX=n,l.lastMouseY=r;let u=l.capturedEntity;if(u===null&&(u=Rt(t,n,r)),Nt(t,l.lastHoveredEntity,u,n,r),l.eventBus.emit("mousemove",{x:n,y:r}),u!==null)switch(e.action){case "press":Mt(t,u,n,r,o);break;case "release":Tt(t,u,n,r,o);break;case "move":p$1(t,u)&&n$2(t,u,{x:n,y:r});break;case "wheel":{let i=o===c$4.WHEEL_UP?"up":"down";l.eventBus.emit("scroll",{direction:i,amount:1});break}}}var ht=t=>{let e=l.eventQueue;l.eventQueue=[];for(let n of e)n.type==="key"?Ot(t,n.event):n.type==="mouse"&&Wt(t,n.event);return t};function Oe(){return ht}function Ne(t,e=0){t.registerInputSystem(ht,e);}function Me(t,e){k$1(t,e)&&m(t,e),p$1(t,e)&&s(t,e);}function Te(t){let e=new Set;for(let n of k(t,[c$1]))e.add(n);for(let n of k(t,[c$2]))e.add(n);return Array.from(e)}var p="\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 bt(){return {lastX:-1,lastY:-1,lastFg:-1,lastBg:-1,lastAttrs:-1,alternateScreen:false}}function b(...t){return `${p}${t.join(";")}m`}function kt(t,e){return `${p}${e+1};${t+1}H`}function At(t){return `${p}${t+1}G`}function Lt(t){return t===1?`${p}C`:`${p}${t}C`}function gt(t){return {a:t>>>24&255,r:t>>>16&255,g:t>>>8&255,b:t&255}}function Ht(t){let{r:e,g:n,b:r,a:o}=gt(t);return o===0?b(39):b(c.FG_256,2,e,n,r)}function wt(t){let{r:e,g:n,b:r,a:o}=gt(t);return o===0?b(49):b(c.BG_256,2,e,n,r)}function Kt(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 Pt(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?Lt(r):At(e)}return kt(e,n)}function Ft(t,e){let n="";return t.lastAttrs!==-1&&t.lastAttrs!==a.NONE&&e.attrs===a.NONE&&(n+=b(c.RESET),t.lastFg=-1,t.lastBg=-1,t.lastAttrs=-1),e.attrs!==t.lastAttrs&&e.attrs!==a.NONE?(t.lastAttrs!==-1&&t.lastAttrs!==a.NONE&&(n+=b(c.RESET),t.lastFg=-1,t.lastBg=-1),n+=Kt(e.attrs),t.lastAttrs=e.attrs):e.attrs===a.NONE&&t.lastAttrs===-1&&(t.lastAttrs=a.NONE),e.fg!==t.lastFg&&(n+=Ht(e.fg),t.lastFg=e.fg),e.bg!==t.lastBg&&(n+=wt(e.bg),t.lastBg=e.bg),n}function Qt(t,e){let{x:n,y:r,cell:o}=e,u="";return u+=Pt(t,n,r),u+=Ft(t,o),u+=o.char,t.lastX=n+1,t.lastY=r,u}function Vt(t,e,n=false){if(e.length===0)return "";let r="",o;if(n)o=e;else {let u=Array.from(e);u.sort((i,s)=>i.y!==s.y?i.y-s.y:i.x-s.x),o=u;}for(let u of o)r+=Qt(t,u);return r}var L=null,v=null,d=null;function Le(t){v=t;}function He(){return v}function we(){v=null;}function Ke(t){d=t;}function Pe(){return d}function Fe(){d=null;}function I(){return L||(L=bt()),L}function Qe(){L=bt();}var $t=t=>{if(!v||!d)return t;let e=I(),n=d.fullRedraw,r=f(d);if(r.length===0)return c$3(d),e$1(d),t;let o=Vt(e,r,n);return o.length>0&&v.write(o),c$3(d),e$1(d),t};function Ve(){return $t}function x(t){v&&v.write(t);}function $e(){x(`${p}?25l`);}function Ut(){x(`${p}?25h`);}function Ue(){x(`${p}?1049h`);let t=I();t.alternateScreen=true;}function Yt(){x(`${p}?1049l`);let t=I();t.alternateScreen=false;}function Ye(){x(`${p}2J`);}function Xt(){x(`${p}H`);let t=I();t.lastX=0,t.lastY=0;}function zt(){x(b(c.RESET));let t=I();t.lastFg=-1,t.lastBg=-1,t.lastAttrs=-1;}function Xe(){I().alternateScreen&&Yt(),zt(),Ut(),Xt();}u();n();var _t=[],Gt=[];function qt(t,e){if(!i(t,e,ka))return a.NONE;let n=a.NONE;return ka.bold[e]===1&&(n|=a.BOLD),ka.underline[e]===1&&(n|=a.UNDERLINE),ka.blink[e]===1&&(n|=a.BLINK),ka.inverse[e]===1&&(n|=a.INVERSE),n}function Bt(t,e){if(c$5(t,e))return {x:a$1.x[e],y:a$1.y[e],width:a$1.width[e],height:a$1.height[e]}}function jt(t,e){return p$2(t,e)?{top:k$3.top[e]===1?1:0,right:k$3.right[e]===1?1:0,bottom:k$3.bottom[e]===1?1:0,left:k$3.left[e]===1?1:0}:{top:0,right:0,bottom:0,left:0}}function Jt(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 Zt(t,e,n){let{world:r$1,buffer:o}=t,u=ma(r$1,e);if(!u||u.transparent)return;let i=qt(r$1,e),s=e$2(" ",u.fg,u.bg,i);r(o,n.x,n.y,n.width,n.height,s);}function H(t,e,n,r,o,u){let i=String.fromCodePoint(r);o$1(t,e,n,e$2(i,o,u));}function vt(t,e,n,r,o,u,i){let s=String.fromCodePoint(o),m=e$2(s,u,i);for(let y=0;y<r;y++)o$1(t,e+y,n,m);}function xt(t,e,n,r,o,u,i){let s=String.fromCodePoint(o),m=e$2(s,u,i);for(let y=0;y<r;y++)o$1(t,e,n+y,m);}function te(t,e,n,r,o,u){if(!e)return;let{x:i,y:s,width:m,height:y}=n;r.top&&r.left&&H(t,i,s,e.charTopLeft,o,u),r.top&&r.right&&H(t,i+m-1,s,e.charTopRight,o,u),r.bottom&&r.left&&H(t,i,s+y-1,e.charBottomLeft,o,u),r.bottom&&r.right&&H(t,i+m-1,s+y-1,e.charBottomRight,o,u);}function ee(t,e,n,r,o,u){let i=r.left?1:0,s=n.width-i-(r.right?1:0);s<=0||(r.top&&vt(t,n.x+i,n.y,s,e,o,u),r.bottom&&vt(t,n.x+i,n.y+n.height-1,s,e,o,u));}function ne(t,e,n,r,o,u){let i=r.top?1:0,s=n.height-i-(r.bottom?1:0);s<=0||(r.left&&xt(t,n.x,n.y+i,s,e,o,u),r.right&&xt(t,n.x+n.width-1,n.y+i,s,e,o,u));}function re(t,e,n){let{world:r,buffer:o}=t;if(!p$2(r,e))return;let u=n$1(r,e);if(!u||u.type===0||n.width<1||n.height<1)return;let{fg:i,bg:s}=u,m={left:u.left,top:u.top,right:u.right,bottom:u.bottom};te(o,u,n,m,i,s),ee(o,u.charHorizontal,n,m,i,s),ne(o,u.charVertical,n,m,i,s);}function rn(t,e,n){}function on(t,e,n){}function oe(t,e){let{world:n}=t,r=Bt(n,e);if(!r||r.width<=0||r.height<=0)return;Zt(t,e,r),re(t,e,r);let o=jt(n,e);Jt(r,o);b$1(t.dirtyTracker,n,e),pa(n,e);}var E=null;function un(t){E=t;}function sn(){return E}function ue(t){return E?t.x+t.width<=E.x||t.x>=E.x+E.width||t.y+t.height<=E.y||t.y>=E.y+E.height:false}function ie(t,e){return t.x>=e.x&&t.y>=e.y&&t.x+t.width<=e.x+e.width&&t.y+t.height<=e.y+e.height}function se(t,e){if(e.length===0)return false;for(let n of e)if(ie(t,n))return true;return false}function le(t,e){t.push({x:e.x,y:e.y,width:e.width,height:e.height});}function ae(t,e,n){let{world:r}=t,o=Bt(r,e);return !o||o.width<=0||o.height<=0?(pa(r,e),false):ue(o)?(pa(r,e),false):K&&se(o,n)?(pa(r,e),false):(oe(t,e),K&&le(n,o),true)}var W=null,w=null,K=false;function ln(t,e){W=t,w=e;}function an(){return W}function fn(){W=null,w=null;}function cn(t){K=t;}function mn(){return K}var fe=t=>{if(!W||!w)return t;let e={world:t,buffer:w,dirtyTracker:W},n=f$1(t).queryRenderables(t),r=n.length,o=_t;o.length=0;for(let i=0;i<r;i++){let s=n[i];xa(t,s)&&qa(t,s)&&o.push(s);}o.length>1&&o.sort((i,s)=>T.z[i]-T.z[s]);let u=Gt;u.length=0;for(let i of o)ae(e,i,u);return t};function pn(){return fe}function yn(t$1,e,n,r,o,u,i=a.NONE){return t(t$1,e,n,r,o,u,i)}function dn(t,e,n,r$1,o,u){r(t,e,n,r$1,o,u);}function En(t){let e=f$1(t).queryRenderables(t),n=e.length;for(let r=0;r<n;r++)ka.dirty[e[r]]=1;}export{yn as $,Fe as A,I as B,Qe as C,$t as D,Ve as E,x as F,$e as G,Ut as H,Ue as I,Yt as J,Ye as K,Xt as L,zt as M,Xe as N,Zt as O,re as P,rn as Q,on as R,un as S,sn as T,ln as U,an as V,fn as W,cn as X,mn as Y,fe as Z,pn as _,l as a,dn as aa,be as b,En as ba,ge as c,ve as d,xe as e,Be as f,Se as g,Ie as h,It as i,Ce as j,Re as k,Ct as l,De as m,Rt as n,ht as o,Oe as p,Ne as q,Me as r,Te as s,bt as t,Vt as u,Le as v,He as w,we as x,Ke as y,Pe as z};
@@ -1 +0,0 @@
1
- import {f,k,g,c,e,j}from'./chunk-DMBMCCLN.js';import {a}from'./chunk-5N3O25O7.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 S=0,$=process.env.BLECSD_PACKED_ADAPTER==="1",L=new WeakSet;function se(){return S}function U(i){i.sort((m,l)=>m.priority-l.priority);}function ae(){let i=new Map,m=[],l=false,E=0,b=[],c$1=null,B=0,y=false,I=16.67,T=new Set([4]),A=null;for(let e=0;e<=7;e++)i.set(e,[]);function W(e$1){if($&&!L.has(e$1)){if(f(e$1)!==c){L.add(e$1);return}e(e$1,j()),L.add(e$1);}}function k$1(){let e=[];for(let t=0;t<=7;t++)e.push({phase:t,duration:0,systemCount:0});return {phases:e,totalFrameTime:0,frameNumber:B++,adapterSyncMs:0}}function v(e,t,r){if(!l||!c$1)return;let n=c$1.phases[e];n&&(n.duration=t,n.systemCount=r);}function C(){if(!l||!c$1)return;let e=0;for(let t of c$1.phases)e+=t.duration;if(c$1.totalFrameTime=e,E>0)for(b.push(c$1);b.length>E;)b.shift();}function M(e){let t=f(e),r=k(t)?t:null,n=r?.syncMode!=="render_only";return {syncAdapter:u=>{if(!r)return;let s=u??e;if(!l||!c$1){g(s);return}let a=performance.now();g(s),c$1.adapterSyncMs+=performance.now()-a;},shouldSyncInput:n,shouldSyncPhase:u=>r?r.syncMode==="all"?true:u===6:false}}function _(e,t,r){let n=e;r&&t(n);for(let o of m)n=o.system(n);return n}function O(e,t){return y&&t&&T.has(e)}function z(e,t,r){let n=e;r(n);for(let o of t)n=o.system(n);return n}function H(e,t){if(l)if(e===0){let r=performance.now();v(e,r-t,m.length);}else v(e,0,0);}function j$1(e,t){return e===0?t:l||y?performance.now():0}function Q(e,t,r,n){l&&v(e,r-t,n);}function Y(e,t,r){return !y||r?r:t-e>I}function K(e,t,r){if(!y)return;let o=performance.now()-e;A={exceeded:t,skippedPhases:[...r],remainingMs:I-o};}function q(e,t,r,n,o,d,u,s,a){if(O(t,d))return u.push(t),l&&v(t,0,0),{world:e,budgetExceeded:d};let p=j$1(t,o),J=z(e,r,Z=>{a(t)&&s(Z);}),N=l||y?performance.now():0,V=t===0?m.length+r.length:r.length;Q(t,p,N,V);let X=Y(n,N,d);return {world:J,budgetExceeded:X}}function G(e,t,r,n,o){let d=e,u=[],s=false;for(let a=0;a<=7;a++){let p=i.get(a);if(!p){H(a,r);continue}let F=q(d,a,p,t,r,s,u,n,o);d=F.world,s=F.budgetExceeded;}return {world:d,skippedPhases:u,budgetExceeded:s}}return {registerSystem(e,t,r=0){if(e===0)throw new Error("Cannot register systems to INPUT phase. INPUT phase is protected and always runs first.");let n=i.get(e);n&&(n.push({system:t,priority:r}),U(n));},registerInputSystem(e,t=0){m.push({system:e,priority:t}),U(m);},unregisterSystem(e){for(let[t,r]of i){if(t===0)continue;let n=r.findIndex(o=>o.system===e);n!==-1&&r.splice(n,1);}},unregisterInputSystem(e){let t=m.findIndex(r=>r.system===e);t!==-1&&m.splice(t,1);},run(e,t){S=t,l&&(c$1=k$1());let r=y||l?performance.now():0,n=e;W(n);let{syncAdapter:o,shouldSyncInput:d,shouldSyncPhase:u}=M(n),s=l||y?performance.now():0;n=_(n,o,d);let a=G(n,r,s,o,u);return n=a.world,l&&C(),K(r,a.budgetExceeded,a.skippedPhases),n},runInputOnly(e,t){S=t;let r=e;W(r);let n=f(r),d=(k(n)?n:null)?.syncMode!=="render_only";d&&g(r);for(let s of m)r=s.system(r);let u=i.get(0);if(u){d&&g(r);for(let s of u)r=s.system(r);}return r},runFixedUpdatePhases(e,t){S=t;let r=e;W(r);let n=f(r),o=k(n)?n:null,d=!!o&&o.syncMode==="all",u=[1,2,3,4];for(let s of u){let a=i.get(s);if(a){d&&g(r);for(let p of a)r=p.system(r);}}return r},runRenderPhases(e,t){S=t;let r=e;W(r);let n=f(r),o=k(n)?n:null,d=s=>o?o.syncMode==="all"?true:s===6:false,u=[5,6,7];for(let s of u){let a=i.get(s);if(a){d(s)&&g(r);for(let p of a)r=p.system(r);}}return r},getSystemsForPhase(e){if(e===0)return m.map(r=>r.system);let t=i.get(e);return t?t.map(r=>r.system):[]},getSystemCount(e){if(e===0)return m.length;let t=i.get(e);return t?t.length:0},getTotalSystemCount(){let e=m.length;for(let t of i.values())e+=t.length;return e},hasSystem(e){if(m.some(t=>t.system===e))return true;for(let t of i.values())if(t.some(r=>r.system===e))return true;return false},clearPhase(e){if(e===0)throw new Error("Cannot clear INPUT phase. INPUT phase is protected.");let t=i.get(e);t&&(t.length=0);},clearAllSystems(){for(let[e,t]of i)e!==0&&(t.length=0);},enableTelemetry(e={enabled:true}){l=e.enabled,E=e.historySize??0,l||(b.length=0,c$1=null);},disableTelemetry(){l=false,b.length=0,c$1=null;},getTelemetry(){return c$1},getTelemetryHistory(){return b},isTelemetryEnabled(){return l},enableFrameBudget(e={enabled:true}){y=e.enabled,I=e.budgetMs??16.67,e.skippablePhases?T=new Set(e.skippablePhases):T=new Set([4]),T.delete(0),y||(A=null);},disableFrameBudget(){y=false,A=null;},getAdaptiveFrameBudgetStatus(){return A},isFrameBudgetEnabled(){return y}}}export{se as a,ae as b};
@@ -1 +0,0 @@
1
- var u={Music:0,SFX:1},f={play:()=>{},stop:()=>{},stopAll:()=>{},setVolume:()=>{},setMuted:()=>{}};function h(m){let l=m,s=1,p=1,i=false,r=false,A=[];function t(){return l??f}function v(e){return e===u.Music?s:p}function c(e){return e===u.Music?i:r}function y(e,n){return c(e)?0:n*v(e)}let a={getState(){return {musicVolume:s,sfxVolume:p,musicMuted:i,sfxMuted:r,adapter:l}},setAdapter(e){l=e;},clearAdapter(){l=void 0;},play(e){let n=e.channel??u.SFX,o=e.volume??1,d=y(n,o);t().play({...e,volume:d,channel:n});},playSound(e,n){a.play({id:e,channel:n??u.SFX});},playMusic(e,n){a.play({id:e,loop:true,volume:n??1,channel:u.Music});},stop(e){t().stop(e);},stopAll(){t().stopAll();},setVolume(e,n){let o=Math.max(0,Math.min(1,n));e===u.Music?s=o:p=o,t().setVolume(e,o);},getVolume(e){return v(e)},mute(e){e===u.Music?i=true:r=true,t().setMuted(e,true);},unmute(e){e===u.Music?i=false:r=false,t().setMuted(e,false);},toggleMute(e){c(e)?a.unmute(e):a.mute(e);},isMuted(e){return c(e)},onEvent(e,n){let o=e.on(n.event,d=>{n.when&&!n.when(d)||a.play({id:n.soundId,...n.options});});return A.push(o),o},onEvents(e,n){let o=[];for(let d of n)o.push(a.onEvent(e,d));return ()=>{for(let d of o)d();}},destroy(){for(let e of A)e();A.length=0,t().stopAll(),l=void 0;}};return a}export{u as a,h as b};
@@ -1 +0,0 @@
1
- import {c,a}from'./chunk-FNQRUMFD.js';import {ka,xa}from'./chunk-GJ3RS2VG.js';import {n,i}from'./chunk-P3ZLIQJP.js';n();function W(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 H(e,r,n){if(e.dirtyEntities.add(n),!c(r,n))return;let t=Math.floor(a.x[n]),i$1=Math.floor(a.y[n]),s=Math.floor(a.width[n]),o=Math.floor(a.height[n]),l=i(r,n,ka)&&xa(r,n),u=e.entityBoundsCache.get(n);u?(u.wasVisible&&f(e,u.prevX,u.prevY,u.prevWidth,u.prevHeight),l&&f(e,t,i$1,s,o),u.prevX=t,u.prevY=i$1,u.prevWidth=s,u.prevHeight=o,u.wasVisible=l):(e.entityBoundsCache.set(n,{prevX:t,prevY:i$1,prevWidth:s,prevHeight:o,wasVisible:l}),l&&f(e,t,i$1,s,o)),e.regionsStale=true;}function L(e,r){e.dirtyEntities.delete(r),e.entityBoundsCache.delete(r);}function I(e,r,n){if(r<0||r>=e.width||n<0||n>=e.height)return;let t=n*e.width+r,i=Math.floor(t/8),s=t%8,o=e.dirtyCells[i];o!==void 0&&(e.dirtyCells[i]=o|1<<s),e.regionsStale=true;}function b(e,r,n){if(r<0||r>=e.width||n<0||n>=e.height)return false;let t=n*e.width+r,i=Math.floor(t/8),s=t%8,o=e.dirtyCells[i];return o!==void 0&&(o&1<<s)!==0}function f(e,r,n,t,i){let s=Math.max(0,r),o=Math.max(0,n),l=Math.min(e.width,r+t),u=Math.min(e.height,n+i);if(!(l<=s||u<=o)){for(let y=o;y<u;y++)for(let a=s;a<l;a++){let m=y*e.width+a,c=Math.floor(m/8),T=m%8,h=e.dirtyCells[c];h!==void 0&&(e.dirtyCells[c]=h|1<<T);}e.regionsStale=true;}}function w(e,r,n){let t=1;for(;r+t<e.width&&b(e,r+t,n);)t++;return t}function C(e,r,n,t){for(let i=0;i<t;i++)if(!b(e,r+i,n))return false;return true}function K(e,r,n,t){let i=1;for(;n+i<e.height&&C(e,r,n+i,t);)i++;return i}function R(e,r,n,t,i,s){for(let o=0;o<i;o++)for(let l=0;l<t;l++)s.add((n+o)*e.width+(r+l));}function z(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 i=0;i<e.width;i++){let s=t*e.width+i;if(n.has(s)||!b(e,i,t))continue;let o=w(e,i,t),l=K(e,i,t,o);R(e,i,t,o,l,n),r.push({x:i,y:t,width:o,height:l});}return e.dirtyRegions.length=0,e.dirtyRegions.push(...r),e.regionsStale=false,e.dirtyRegions}function U(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 A(e){e.dirtyCells.fill(0),e.dirtyEntities.clear(),e.dirtyRegions.length=0,e.regionsStale=false,e.forceFullRedraw=false,e.frameCount++;}function F(e){e.forceFullRedraw=true,e.regionsStale=true;}function V(e){let r=0;for(let n=0;n<e.dirtyCells.length;n++){let t=e.dirtyCells[n];if(t!==void 0)for(let i=0;i<8;i++)t&1<<i&&r++;}return {dirtyCellCount:r,dirtyEntityCount:e.dirtyEntities.size,cachedEntityCount:e.entityBoundsCache.size,dirtyRegionCount:e.regionsStale?0:e.dirtyRegions.length,frameCount:e.frameCount}}function B(){let e=new Map;function r(t,i,s){let o=e.get(t);o||(o=new Set,e.set(t,o));let l={handler:i,once:s};return o.add(l),()=>{o.delete(l),o.size===0&&e.delete(t);}}let n={on(t,i){return r(t,i,false)},once(t,i){return r(t,i,true)},off(t,i){let s=e.get(t);if(!s)return n;for(let o of s)if(o.handler===i){s.delete(o);break}return s.size===0&&e.delete(t),n},emit(t,i){let s=e.get(t);if(!s||s.size===0)return false;let o=[];for(let l of s)l.handler(i),l.once&&o.push(l);for(let l of o)s.delete(l);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 X(){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();}}}export{W as a,H as b,L as c,I as d,b as e,f,z as g,U as h,A as i,F as j,V as k,B as l,X as m};
@@ -1 +0,0 @@
1
- var r=new Map;function u(t,n,e){let a=r.get(t);if(!a)return e;let i=a.get(n);return i===void 0?e:i}function o(t,n,e){let a=r.get(t);a||(a=new Map,r.set(t,a)),a.set(n,e);}function s(t,n){return r.get(t)?.has(n)??false}function y(t,n){return r.get(t)?.delete(n)??false}function c(t){let n=r.get(t);return n?Array.from(n.keys()):[]}function l(t){let n=r.get(t);if(!n)return {};let e={};for(let[a,i]of n)e[a]=i;return e}function f(t,n){for(let[e,a]of Object.entries(n))o(t,e,a);}function E(t){r.delete(t);}function p(){r.clear();}function d(){return r.size}function D(t){let n=r.get(t);return n!==void 0&&n.size>0}function g(t,n,e){let a=u(t,n);o(t,n,e(a));}export{u as a,o as b,s as c,y as d,c as e,l as f,f as g,E as h,p as i,d as j,D as k,g as l};
@@ -1,2 +0,0 @@
1
- import {b}from'./chunk-NPNUUSIB.js';import {ia as ia$1,Ka,gb,Ib,Mb,c as c$3,g,E,x,S,Nb}from'./chunk-R3ICZOE4.js';import {H as H$1,o as o$1,n as n$1,q,ia,Ua,ga,fa,ob,ub,Eb,Jb,Fb}from'./chunk-DSKQ5J4R.js';import {d as d$4,c as c$2,e as e$2}from'./chunk-LI4Y7TBZ.js';import {k,a,b as b$1,l as l$1}from'./chunk-6XWY6GB7.js';import {c,d as d$2}from'./chunk-DQTVJITR.js';import {u,k as k$1,l}from'./chunk-ZPGJCHXH.js';import {d as d$1,e}from'./chunk-735KKTP3.js';import {c as c$1,d as d$3}from'./chunk-APKUNIMB.js';import {p,T,e as e$1,ka,o,la}from'./chunk-GJ3RS2VG.js';import {n,d,h}from'./chunk-P3ZLIQJP.js';import {z as z$1}from'zod';var H=z$1.object({x:z$1.number().optional(),y:z$1.number().optional(),z:z$1.number().optional(),absolute:z$1.boolean().optional()}),V=z$1.object({width:z$1.union([z$1.number(),z$1.string()]).optional(),height:z$1.union([z$1.number(),z$1.string()]).optional(),minWidth:z$1.number().optional(),maxWidth:z$1.number().optional(),minHeight:z$1.number().optional(),maxHeight:z$1.number().optional(),shrink:z$1.boolean().optional()}),Y=z$1.object({fg:z$1.number().optional(),bg:z$1.number().optional(),bold:z$1.boolean().optional(),italic:z$1.boolean().optional(),underline:z$1.boolean().optional(),strikethrough:z$1.boolean().optional(),dim:z$1.boolean().optional(),inverse:z$1.boolean().optional(),blink:z$1.boolean().optional(),visible:z$1.boolean().optional()}),_=z$1.object({type:z$1.number().optional(),left:z$1.boolean().optional(),right:z$1.boolean().optional(),top:z$1.boolean().optional(),bottom:z$1.boolean().optional(),fg:z$1.number().optional(),bg:z$1.number().optional(),chars:z$1.custom().optional()}),X=z$1.object({left:z$1.number().optional(),right:z$1.number().optional(),top:z$1.number().optional(),bottom:z$1.number().optional()}),$t=z$1.object({text:z$1.string().optional(),align:z$1.number().optional(),valign:z$1.number().optional(),wrap:z$1.boolean().optional(),parseTags:z$1.boolean().optional()}),ne=z$1.object({clickable:z$1.boolean().optional(),draggable:z$1.boolean().optional(),hoverable:z$1.boolean().optional(),keyable:z$1.boolean().optional(),hoverEffectFg:z$1.number().optional(),hoverEffectBg:z$1.number().optional()}),w=z$1.object({focusable:z$1.boolean().optional(),tabIndex:z$1.number().optional(),focusEffectFg:z$1.number().optional(),focusEffectBg:z$1.number().optional()}),ht=z$1.object({scrollable:z$1.boolean().optional(),scrollX:z$1.number().optional(),scrollY:z$1.number().optional(),scrollWidth:z$1.number().optional(),scrollHeight:z$1.number().optional(),scrollbarVisible:z$1.number().optional()}),he=z$1.object({parent:z$1.number().optional(),border:_.optional(),padding:X.optional()}).merge(H).merge(V).merge(Y),ve=z$1.object({parent:z$1.number().optional(),border:_.optional(),padding:X.optional()}).merge(H).merge(V).merge(Y).merge($t),Se=z$1.object({parent:z$1.number().optional(),label:z$1.string().optional(),border:_.optional(),padding:X.optional()}).merge(H).merge(V).merge(Y).merge(ne).merge(w),xe=z$1.object({width:z$1.number().int().positive(),height:z$1.number().int().positive(),title:z$1.string().optional(),cursorVisible:z$1.boolean().optional(),cursorShape:z$1.number().int().min(0).max(5).optional(),fullUnicode:z$1.boolean().optional(),autoPadding:z$1.boolean().optional()}),Ee=z$1.object({parent:z$1.number().optional(),value:z$1.string().optional(),placeholder:z$1.string().optional(),maxLength:z$1.number().optional(),border:_.optional(),padding:X.optional()}).merge(H).merge(V).merge(Y).merge(ne).merge(w),Ce=z$1.object({parent:z$1.number().optional(),items:z$1.array(z$1.string()).optional(),selectedIndex:z$1.number().optional(),border:_.optional(),padding:X.optional()}).merge(H).merge(V).merge(Y).merge(ht).merge(w),Be=z$1.object({parent:z$1.number().optional(),label:z$1.string().optional(),checked:z$1.boolean().optional(),checkedChar:z$1.string().optional(),uncheckedChar:z$1.string().optional(),border:_.optional(),padding:X.optional()}).merge(H).merge(V).merge(Y).merge(ne).merge(w),ke=z$1.object({parent:z$1.number().optional(),value:z$1.string().optional(),placeholder:z$1.string().optional(),secret:z$1.boolean().optional(),censor:z$1.string().optional(),maxLength:z$1.number().optional(),border:_.optional(),padding:X.optional()}).merge(H).merge(V).merge(Y).merge(ne).merge(w),Te=z$1.object({parent:z$1.number().optional(),value:z$1.string().optional(),placeholder:z$1.string().optional(),maxLength:z$1.number().optional(),scrollable:z$1.boolean().optional(),border:_.optional(),padding:X.optional()}).merge(H).merge(V).merge(Y).merge(ne).merge(w).merge(ht),Ie=z$1.object({parent:z$1.number().optional(),options:z$1.array(z$1.object({label:z$1.string(),value:z$1.string()})).optional(),selectedIndex:z$1.number().optional(),placeholder:z$1.string().optional(),closedIndicator:z$1.string().optional(),openIndicator:z$1.string().optional(),selectedMark:z$1.string().optional(),border:_.optional(),padding:X.optional()}).merge(H).merge(V).merge(Y).merge(ne).merge(w),Fe=z$1.object({parent:z$1.number().optional(),min:z$1.number().optional(),max:z$1.number().optional(),value:z$1.number().optional(),step:z$1.number().optional(),orientation:z$1.number().optional(),showValue:z$1.boolean().optional(),trackChar:z$1.string().optional(),thumbChar:z$1.string().optional(),fillChar:z$1.string().optional(),trackFg:z$1.number().optional(),trackBg:z$1.number().optional(),thumbFg:z$1.number().optional(),thumbBg:z$1.number().optional(),fillFg:z$1.number().optional(),fillBg:z$1.number().optional(),border:_.optional(),padding:X.optional()}).merge(H).merge(V).merge(Y).merge(ne).merge(w),Pe=z$1.object({parent:z$1.number().optional(),keys:z$1.boolean().optional(),submitOnEnter:z$1.boolean().optional(),fields:z$1.array(z$1.object({name:z$1.string(),entity:z$1.number(),initialValue:z$1.unknown().optional()})).optional(),border:_.optional(),padding:X.optional()}).merge(H).merge(V).merge(Y),Me=z$1.object({parent:z$1.number().optional(),value:z$1.number().optional(),min:z$1.number().optional(),max:z$1.number().optional(),orientation:z$1.number().optional(),showPercentage:z$1.boolean().optional(),fillChar:z$1.string().optional(),emptyChar:z$1.string().optional(),fillFg:z$1.number().optional(),fillBg:z$1.number().optional(),emptyFg:z$1.number().optional(),emptyBg:z$1.number().optional(),border:_.optional(),padding:X.optional()}).merge(H).merge(V).merge(Y),De=z$1.object({parent:z$1.number().optional(),selectedIndex:z$1.number().optional(),border:_.optional(),padding:X.optional()}).merge(H).merge(V).merge(Y),Ae=z$1.object({parent:z$1.number().optional(),radioSet:z$1.number().optional(),value:z$1.string().optional(),label:z$1.string().optional(),selected:z$1.boolean().optional(),selectedChar:z$1.string().optional(),unselectedChar:z$1.string().optional(),border:_.optional(),padding:X.optional()}).merge(H).merge(V).merge(Y).merge(ne).merge(w);n();u();n();function M(n,o$1){h(n,o$1,T),h(n,o$1,e$1),h(n,o$1,ka),h(n,o$1,o),T.x[o$1]=0,T.y[o$1]=0,T.z[o$1]=0,T.absolute[o$1]=0,e$1.width[o$1]=0,e$1.height[o$1]=0,e$1.minWidth[o$1]=0,e$1.minHeight[o$1]=0,e$1.maxWidth[o$1]=Number.POSITIVE_INFINITY,e$1.maxHeight[o$1]=Number.POSITIVE_INFINITY,e$1.shrink[o$1]=0,ka.visible[o$1]=1,ka.dirty[o$1]=1,ka.fg[o$1]=4294967295,ka.bg[o$1]=255,ka.bold[o$1]=0,ka.underline[o$1]=0,ka.blink[o$1]=0,ka.inverse[o$1]=0,ka.transparent[o$1]=0,o.parent[o$1]=0,o.firstChild[o$1]=0,o.nextSibling[o$1]=0,o.prevSibling[o$1]=0,o.childCount[o$1]=0,o.depth[o$1]=0;}function j(n,o){o.x!==void 0&&(T.x[n]=o.x),o.y!==void 0&&(T.y[n]=o.y),o.z!==void 0&&(T.z[n]=o.z),o.absolute!==void 0&&(T.absolute[n]=o.absolute?1:0);}function vt(n){return typeof n=="string"&&n.endsWith("%")?-(Number.parseFloat(n)+2):n==="auto"?-1:n}function Qt(n,o){o.minWidth!==void 0&&(e$1.minWidth[n]=o.minWidth),o.maxWidth!==void 0&&(e$1.maxWidth[n]=o.maxWidth),o.minHeight!==void 0&&(e$1.minHeight[n]=o.minHeight),o.maxHeight!==void 0&&(e$1.maxHeight[n]=o.maxHeight),o.shrink!==void 0&&(e$1.shrink[n]=o.shrink?1:0);}function L(n,o){o.width!==void 0&&(e$1.width[n]=vt(o.width)),o.height!==void 0&&(e$1.height[n]=vt(o.height)),Qt(n,o);}function W(n,o,e){let t={};e.fg!==void 0&&(t.fg=e.fg),e.bg!==void 0&&(t.bg=e.bg),e.bold!==void 0&&(t.bold=e.bold),e.underline!==void 0&&(t.underline=e.underline),e.inverse!==void 0&&(t.inverse=e.inverse),e.blink!==void 0&&(t.blink=e.blink),Object.keys(t).length>0&&la(n,o,t),e.visible!==void 0&&(ka.visible[o]=e.visible?1:0);}function N(n,o,e){if(!e||!(e.type!==void 0||e.left!==void 0||e.right!==void 0||e.top!==void 0||e.bottom!==void 0||e.fg!==void 0||e.bg!==void 0||e.chars!==void 0))return;k$1.type[o]=e.type??0,k$1.left[o]=0,k$1.right[o]=0,k$1.top[o]=0,k$1.bottom[o]=0,k$1.fg[o]=4294967295,k$1.bg[o]=255;let a={};e.type!==void 0&&(a.type=e.type),e.left!==void 0&&(a.left=e.left),e.right!==void 0&&(a.right=e.right),e.top!==void 0&&(a.top=e.top),e.bottom!==void 0&&(a.bottom=e.bottom),e.fg!==void 0&&(a.fg=e.fg),e.bg!==void 0&&(a.bg=e.bg),e.chars!==void 0&&(a.chars=e.chars),l(n,o,a);}function z(n,o,e){if(!e||!(e.left!==void 0||e.right!==void 0||e.top!==void 0||e.bottom!==void 0))return;a.left[o]=0,a.right[o]=0,a.top[o]=0,a.bottom[o]=0;let a$1={};e.left!==void 0&&(a$1.left=e.left),e.right!==void 0&&(a$1.right=e.right),e.top!==void 0&&(a$1.top=e.top),e.bottom!==void 0&&(a$1.bottom=e.bottom),b$1(n,o,a$1);}function oe(n,o){h(n,o,d$1),d$1.align[o]=0,d$1.valign[o]=0,d$1.wrap[o]=0,d$1.parseTags[o]=0,d$1.length[o]=0,d$1.hash[o]=0,d$1.contentId[o]=0;}function Zt(n,o){o.align!==void 0&&(d$1.align[n]=o.align),o.valign!==void 0&&(d$1.valign[n]=o.valign),o.wrap!==void 0&&(d$1.wrap[n]=o.wrap?1:0),o.parseTags!==void 0&&(d$1.parseTags[n]=o.parseTags?1:0);}function St(n,o,e$1){if(e$1.text!==void 0){let t={};e$1.align!==void 0&&(t.align=e$1.align),e$1.valign!==void 0&&(t.valign=e$1.valign),e$1.wrap!==void 0&&(t.wrap=e$1.wrap),e$1.parseTags!==void 0&&(t.parseTags=e$1.parseTags),e(n,o,e$1.text,t);}else Zt(o,e$1);}function xt(n,o,e){h(n,o,k),k.scrollX[o]=0,k.scrollY[o]=0,k.scrollWidth[o]=0,k.scrollHeight[o]=e,k.scrollbarVisible[o]=2;}function Et(n,o,e){let t={};e.scrollable!==void 0&&(t.scrollX=0),e.scrollX!==void 0&&(t.scrollX=e.scrollX),e.scrollY!==void 0&&(t.scrollY=e.scrollY),e.scrollWidth!==void 0&&(t.scrollWidth=e.scrollWidth),e.scrollHeight!==void 0&&(t.scrollHeight=e.scrollHeight),e.scrollbarVisible!==void 0&&(t.scrollbarVisible=e.scrollbarVisible),Object.keys(t).length>0&&l$1(n,o,t);}function Ct(n){c.clickable[n]=1,c.draggable[n]=0,c.hoverable[n]=0,c.hovered[n]=0,c.pressed[n]=0,c.keyable[n]=1,c.hoverEffectFg[n]=4294967295,c.hoverEffectBg[n]=1145324799;}function Bt(n,o){h(n,o,c$1),c$1.focusable[o]=1,c$1.focused[o]=0,c$1.tabIndex[o]=0,c$1.focusEffectFg[o]=4294967295,c$1.focusEffectBg[o]=6750207;}function ie(n,o,e){let t={};e.focusable!==void 0&&(t.focusable=e.focusable),e.tabIndex!==void 0&&(t.tabIndex=e.tabIndex),e.focusEffectFg!==void 0&&(t.focusEffectFg=e.focusEffectFg),e.focusEffectBg!==void 0&&(t.focusEffectBg=e.focusEffectBg),Object.keys(t).length>0&&d$3(n,o,t);}function re(n,o,e){let t={};e.clickable!==void 0&&(t.clickable=e.clickable),e.draggable!==void 0&&(t.draggable=e.draggable),e.hoverable!==void 0&&(t.hoverable=e.hoverable),e.keyable!==void 0&&(t.keyable=e.keyable),e.hoverEffectFg!==void 0&&(t.hoverEffectFg=e.hoverEffectFg),e.hoverEffectBg!==void 0&&(t.hoverEffectBg=e.hoverEffectBg),Object.keys(t).length>0&&d$2(n,o,t);}function se(n,o){h(n,o,c),c.clickable[o]=1,c.draggable[o]=0,c.hoverable[o]=1,c.hovered[o]=0,c.pressed[o]=0,c.keyable[o]=1,c.hoverEffectFg[o]=4294967295,c.hoverEffectBg[o]=1145324799;}function le(n,o){h(n,o,c$1),c$1.focusable[o]=1,c$1.focused[o]=0,c$1.tabIndex[o]=0,c$1.focusEffectFg[o]=4294967295,c$1.focusEffectBg[o]=6750207;}function kt(n,o,e){let t={};e.scrollX!==void 0&&(t.scrollX=e.scrollX),e.scrollY!==void 0&&(t.scrollY=e.scrollY),e.scrollWidth!==void 0&&(t.scrollWidth=e.scrollWidth),e.scrollHeight!==void 0&&(t.scrollHeight=e.scrollHeight),e.scrollbarVisible!==void 0&&(t.scrollbarVisible=e.scrollbarVisible),Object.keys(t).length>0&&l$1(n,o,t);}function Tt(n,o,e){let t={};e.trackChar!==void 0&&(t.trackChar=e.trackChar),e.thumbChar!==void 0&&(t.thumbChar=e.thumbChar),e.fillChar!==void 0&&(t.fillChar=e.fillChar),e.trackFg!==void 0&&(t.trackFg=e.trackFg),e.trackBg!==void 0&&(t.trackBg=e.trackBg),e.thumbFg!==void 0&&(t.thumbFg=e.thumbFg),e.thumbBg!==void 0&&(t.thumbBg=e.thumbBg),e.fillFg!==void 0&&(t.fillFg=e.fillFg),e.fillBg!==void 0&&(t.fillBg=e.fillBg),Nb(n,o,t);}function It(n,o={}){let e=he.parse(o),t=d(n);return M(n,t),j(t,e),L(t,e),W(n,t,e),N(n,t,e.border),z(n,t,e.padding),e.parent!==void 0&&p(n,t,e.parent),t}function Ft(n,o={}){let e=ve.parse(o),t=d(n);return M(n,t),j(t,e),L(t,e),W(n,t,e),N(n,t,e.border),z(n,t,e.padding),oe(n,t),St(n,t,e),e.parent!==void 0&&p(n,t,e.parent),t}function Pt(n,o={}){let e$1=Se.parse(o),t=d(n);M(n,t),j(t,e$1),L(t,e$1),W(n,t,e$1),N(n,t,e$1.border),z(n,t,e$1.padding),d$1.align[t]=1,d$1.valign[t]=1,d$1.wrap[t]=0,d$1.parseTags[t]=0,d$1.length[t]=0,d$1.hash[t]=0,e$1.label!==void 0&&e(n,t,e$1.label),h(n,t,c),c.clickable[t]=1,c.draggable[t]=0,c.hoverable[t]=1,c.hovered[t]=0,c.pressed[t]=0,c.keyable[t]=1,c.hoverEffectFg[t]=4294967295,c.hoverEffectBg[t]=1145324799;let a={};e$1.clickable!==void 0&&(a.clickable=e$1.clickable),e$1.draggable!==void 0&&(a.draggable=e$1.draggable),e$1.hoverable!==void 0&&(a.hoverable=e$1.hoverable),e$1.keyable!==void 0&&(a.keyable=e$1.keyable),e$1.hoverEffectFg!==void 0&&(a.hoverEffectFg=e$1.hoverEffectFg),e$1.hoverEffectBg!==void 0&&(a.hoverEffectBg=e$1.hoverEffectBg),Object.keys(a).length>0&&d$2(n,t,a),h(n,t,c$1),c$1.focusable[t]=1,c$1.focused[t]=0,c$1.tabIndex[t]=0,c$1.focusEffectFg[t]=4294967295,c$1.focusEffectBg[t]=6750207;let p$1={};return e$1.focusable!==void 0&&(p$1.focusable=e$1.focusable),e$1.tabIndex!==void 0&&(p$1.tabIndex=e$1.tabIndex),e$1.focusEffectFg!==void 0&&(p$1.focusEffectFg=e$1.focusEffectFg),e$1.focusEffectBg!==void 0&&(p$1.focusEffectBg=e$1.focusEffectBg),Object.keys(p$1).length>0&&d$3(n,t,p$1),e$1.parent!==void 0&&p(n,t,e$1.parent),t}function Mt(n,o$1){if(d$4(n))throw new Error("A screen already exists in this world. Only one screen is allowed.");let e=xe.parse(o$1),t=d(n);return M(n,t),T.x[t]=0,T.y[t]=0,T.z[t]=0,T.absolute[t]=0,e$1.width[t]=e.width,e$1.height[t]=e.height,ka.visible[t]=1,ka.dirty[t]=1,o.parent[t]=0,o.depth[t]=0,c$2(n,t,{cursorVisible:e.cursorVisible,cursorShape:e.cursorShape,fullUnicode:e.fullUnicode,autoPadding:e.autoPadding}),e$2(n,t),t}function Dt(n,o={}){let e$1=Ee.parse(o),t=d(n);M(n,t),j(t,e$1),L(t,e$1),W(n,t,e$1),N(n,t,e$1.border),z(n,t,e$1.padding),d$1.align[t]=0,d$1.valign[t]=1,d$1.wrap[t]=0,d$1.parseTags[t]=0,d$1.length[t]=0,d$1.hash[t]=0,e$1.value!==void 0&&e(n,t,e$1.value),c.clickable[t]=1,c.draggable[t]=0,c.hoverable[t]=1,c.hovered[t]=0,c.pressed[t]=0,c.keyable[t]=1,c.hoverEffectFg[t]=4294967295,c.hoverEffectBg[t]=858993663;let a={};e$1.clickable!==void 0&&(a.clickable=e$1.clickable),e$1.draggable!==void 0&&(a.draggable=e$1.draggable),e$1.hoverable!==void 0&&(a.hoverable=e$1.hoverable),e$1.keyable!==void 0&&(a.keyable=e$1.keyable),e$1.hoverEffectFg!==void 0&&(a.hoverEffectFg=e$1.hoverEffectFg),e$1.hoverEffectBg!==void 0&&(a.hoverEffectBg=e$1.hoverEffectBg),Object.keys(a).length>0&&d$2(n,t,a),h(n,t,c$1),c$1.focusable[t]=1,c$1.focused[t]=0,c$1.tabIndex[t]=0,c$1.focusEffectFg[t]=4294967295,c$1.focusEffectBg[t]=6750207;let p$1={};return e$1.focusable!==void 0&&(p$1.focusable=e$1.focusable),e$1.tabIndex!==void 0&&(p$1.tabIndex=e$1.tabIndex),e$1.focusEffectFg!==void 0&&(p$1.focusEffectFg=e$1.focusEffectFg),e$1.focusEffectBg!==void 0&&(p$1.focusEffectBg=e$1.focusEffectBg),Object.keys(p$1).length>0&&d$3(n,t,p$1),e$1.parent!==void 0&&p(n,t,e$1.parent),t}function At(n,o={}){let e$1=Ce.parse(o),t=d(n);return M(n,t),j(t,e$1),L(t,e$1),W(n,t,e$1),N(n,t,e$1.border),z(n,t,e$1.padding),oe(n,t),e$1.items!==void 0&&e$1.items.length>0&&e(n,t,e$1.items.join(`
2
- `)),xt(n,t,e$1.items?.length??0),Et(n,t,e$1),Bt(n,t),ie(n,t,e$1),Ct(t),e$1.parent!==void 0&&p(n,t,e$1.parent),t}function Ot(n,o={}){let e$1=Be.parse(o),t=d(n);return M(n,t),j(t,e$1),L(t,e$1),W(n,t,e$1),N(n,t,e$1.border),z(n,t,e$1.padding),oe(n,t),d$1.align[t]=0,d$1.valign[t]=1,e$1.label!==void 0&&e(n,t,e$1.label),se(n,t),re(n,t,e$1),le(n,t),ie(n,t,e$1),H$1(t,{checkedChar:e$1.checkedChar??n$1,uncheckedChar:e$1.uncheckedChar??o$1}),q(n,t,e$1.checked??false),e$1.parent!==void 0&&p(n,t,e$1.parent),t}function Rt(n,o={}){let e$1=ke.parse(o),t=d(n);return M(n,t),j(t,e$1),L(t,e$1),W(n,t,e$1),N(n,t,e$1.border),z(n,t,e$1.padding),oe(n,t),d$1.align[t]=0,d$1.valign[t]=1,e$1.value!==void 0&&e(n,t,e$1.value),se(n,t),c.hoverEffectBg[t]=858993663,re(n,t,e$1),le(n,t),ie(n,t,e$1),ia(n,t),Ua(n,t,{secret:e$1.secret??false,censor:e$1.censor??fa,placeholder:e$1.placeholder??ga,maxLength:e$1.maxLength??0}),e$1.parent!==void 0&&p(n,t,e$1.parent),t}function Kt(n,o={}){let e$1=Te.parse(o),t=d(n);return M(n,t),j(t,e$1),L(t,e$1),W(n,t,e$1),N(n,t,e$1.border),z(n,t,e$1.padding),oe(n,t),d$1.align[t]=0,d$1.valign[t]=0,e$1.value!==void 0&&e(n,t,e$1.value),se(n,t),c.hoverEffectBg[t]=858993663,re(n,t,e$1),le(n,t),ie(n,t,e$1),e$1.scrollable&&(h(n,t,k),k.scrollX[t]=0,k.scrollY[t]=0,k.scrollWidth[t]=0,k.scrollHeight[t]=0,k.scrollbarVisible[t]=2,kt(n,t,e$1)),ia(n,t),Ua(n,t,{secret:false,censor:"",placeholder:e$1.placeholder??ga,maxLength:e$1.maxLength??0,multiline:true}),e$1.parent!==void 0&&p(n,t,e$1.parent),t}function jt(n,o={}){let e$1=Ie.parse(o),t=d(n);M(n,t),j(t,e$1),L(t,e$1),W(n,t,e$1),N(n,t,e$1.border),z(n,t,e$1.padding),oe(n,t),d$1.align[t]=0,d$1.valign[t]=1,se(n,t),c.hoverEffectBg[t]=858993663,re(n,t,e$1),le(n,t),ie(n,t,e$1);let a=e$1.options??[],p$1=e$1.selectedIndex??-1;ia$1(n,t,a,p$1);let m={};return e$1.closedIndicator!==void 0&&(m.closedIndicator=e$1.closedIndicator),e$1.openIndicator!==void 0&&(m.openIndicator=e$1.openIndicator),e$1.selectedMark!==void 0&&(m.selectedMark=e$1.selectedMark),Ka(n,t,m),p$1>=0&&a[p$1]?e(n,t,a[p$1].label):e$1.placeholder&&e(n,t,e$1.placeholder),e$1.parent!==void 0&&p(n,t,e$1.parent),t}function Lt(n,o={}){let e=Fe.parse(o),t=d(n);M(n,t),j(t,e),L(t,e),W(n,t,e),N(n,t,e.border),z(n,t,e.padding),se(n,t),c.draggable[t]=1,c.hoverEffectBg[t]=858993663,re(n,t,e),le(n,t),ie(n,t,e);let a=e.min??0,p$1=e.max??100,m=e.value??0,v=e.step??1;return gb(n,t,a,p$1,m,v),e.orientation!==void 0&&Ib(n,t,e.orientation),e.showValue!==void 0&&Mb(n,t,e.showValue),Tt(n,t,e),e.parent!==void 0&&p(n,t,e.parent),t}function Wt(n,o={}){let e=Pe.parse(o),t=d(n);if(M(n,t),j(t,e),L(t,e),W(n,t,e),N(n,t,e.border),z(n,t,e.padding),c$3(n,t,{keys:e.keys??true,submitOnEnter:e.submitOnEnter??true}),e.fields)for(let a of e.fields)g(n,t,a.entity,a.name,a.initialValue);return e.parent!==void 0&&p(n,t,e.parent),t}function Nt(n,o={}){let e=Me.parse(o),t=d(n);return M(n,t),j(t,e),L(t,e),W(n,t,e),N(n,t,e.border),z(n,t,e.padding),E(n,t,{value:e.value??0,min:e.min??0,max:e.max??100,orientation:e.orientation??x.Horizontal,showPercentage:e.showPercentage??false}),(e.fillChar!==void 0||e.emptyChar!==void 0||e.fillFg!==void 0||e.fillBg!==void 0||e.emptyFg!==void 0||e.emptyBg!==void 0)&&S(n,t,{fillChar:e.fillChar,emptyChar:e.emptyChar,fillFg:e.fillFg,fillBg:e.fillBg,emptyFg:e.emptyFg,emptyBg:e.emptyBg}),e.parent!==void 0&&p(n,t,e.parent),t}function zt(n,o={}){let e=De.parse(o),t=d(n);return M(n,t),j(t,e),L(t,e),W(n,t,e),N(n,t,e.border),z(n,t,e.padding),ob(n,t),e.parent!==void 0&&p(n,t,e.parent),t}function Ut(n,o={}){let e$1=Ae.parse(o),t=d(n);return M(n,t),j(t,e$1),L(t,e$1),W(n,t,e$1),N(n,t,e$1.border),z(n,t,e$1.padding),oe(n,t),d$1.align[t]=0,d$1.valign[t]=1,e$1.label!==void 0&&e(n,t,e$1.label),se(n,t),c.hoverEffectBg[t]=858993663,re(n,t,e$1),le(n,t),ie(n,t,e$1),ub(n,t,e$1.radioSet),e$1.value!==void 0&&Eb(t,e$1.value),(e$1.selectedChar!==void 0||e$1.unselectedChar!==void 0)&&Jb(t,{selectedChar:e$1.selectedChar,unselectedChar:e$1.unselectedChar}),e$1.parent!==void 0&&p(n,t,e$1.parent),e$1.selected&&Fb(n,t),t}var wt=z$1.object({tickRate:z$1.number().positive(),maxUpdatesPerFrame:z$1.number().int().positive(),interpolate:z$1.boolean()}),en=z$1.object({targetFPS:z$1.number().nonnegative().optional(),fixedTimestep:z$1.boolean().optional(),maxDeltaTime:z$1.number().positive().optional(),fixedTimestepMode:wt.optional()}),tn=(t=>(t[t.STOPPED=0]="STOPPED",t[t.RUNNING=1]="RUNNING",t[t.PAUSED=2]="PAUSED",t))(tn||{});function ge(){let[n,o]=process.hrtime();return n+o/1e9}function to(n,o={},e={}){let t=en.parse(o),a=n,p=b(),m={...e},v=0,h={targetFPS:t.targetFPS??60,fixedTimestep:t.fixedTimestep??true,maxDeltaTime:t.maxDeltaTime??.1,fixedTimestepMode:t.fixedTimestepMode},C=0,k=h.targetFPS>0?1/h.targetFPS:0,s=0,l=0,u=0,S=0,I=0,J=0,D=0,F=h.fixedTimestepMode?1/h.fixedTimestepMode.tickRate:1/60,Q=0,ue=0,fe=0,ee=0,r=0,f=null,b$1=null;function x(){if(h.targetFPS===0)f=setImmediate(()=>Re());else {let E=ge()-C,Z=Math.max(0,k-E);Z>.001?b$1=setTimeout(()=>Re(),Z*1e3):f=setImmediate(()=>Re());}}function q(){f!==null&&(clearImmediate(f),f=null),b$1!==null&&(clearTimeout(b$1),b$1=null);}function ze(c){m.onBeforeInput?.(a,c),a=p.run(a,c),m.onAfterInput?.(a,c),m.onBeforeUpdate?.(a,c),m.onAfterUpdate?.(a,c),m.onBeforeRender?.(a,c),m.onAfterRender?.(a,c),s++;}function Ue(c){let E=h.fixedTimestepMode;if(!E)return;m.onBeforeInput?.(a,c),a=p.runInputOnly(a,c),m.onAfterInput?.(a,c),D+=c,r=0;let Z=0;for(;D>=F;){if(Z>=E.maxUpdatesPerFrame){r=Math.floor(D/F),D=D%F;break}m.onBeforeFixedUpdate?.(a,F,Q),m.onBeforeUpdate?.(a,F),a=p.runFixedUpdatePhases(a,F),m.onAfterUpdate?.(a,F),m.onAfterFixedUpdate?.(a,F,Q),D-=F,Q++,ue++,Z++;}ee=E.interpolate?D/F:0,E.interpolate&&m.onInterpolate&&m.onInterpolate(a,ee),m.onBeforeRender?.(a,c),a=p.runRenderPhases(a,c),m.onAfterRender?.(a,c),s++;}function Jt(c,E){J=E*1e3,S++,c-u>=1&&(I=S,fe=ue,S=0,ue=0,u=c);}function Re(){if(v!==1)return;let c=ge(),E=c-C;C=c,E>h.maxDeltaTime&&(E=h.maxDeltaTime),h.fixedTimestepMode?Ue(E):ze(E),Jt(c,E),x();}let He={getState(){return v},isRunning(){return v===1},isPaused(){return v===2},isStopped(){return v===0},getStats(){return {fps:I,frameTime:J,frameCount:s,runningTime:v!==0?ge()-l:0,tickCount:Q,ticksPerSecond:fe,interpolationAlpha:ee,skippedUpdates:r}},getInterpolationAlpha(){return ee},getFixedTimestepConfig(){return h.fixedTimestepMode},isFixedTimestepMode(){return h.fixedTimestepMode!==void 0},getScheduler(){return p},getWorld(){return a},setWorld(c){if(v!==0)throw new Error("Cannot change world while loop is running");a=c;},setTargetFPS(c){h.targetFPS=c,k=c>0?1/c:0;},getTargetFPS(){return h.targetFPS},registerSystem(c,E,Z=0){p.registerSystem(c,E,Z);},unregisterSystem(c){p.unregisterSystem(c);},registerInputSystem(c,E=0){p.registerInputSystem(c,E);},setHooks(c){m={...m,...c};},start(){if(v===1)return;let c=v===0;v=1,C=ge(),c?(s=0,l=C,u=C,S=0,D=0,Q=0,ue=0,fe=0,ee=0,r=0,m.onStart?.()):m.onResume?.(),x();},stop(){v!==0&&(q(),v=0,m.onStop?.());},pause(){v===1&&(q(),v=2,m.onPause?.());},resume(){v===2&&He.start();},step(c){let E=ge(),Z=c??(C>0?E-C:1/60);C=E;let ye=Math.min(Z,h.maxDeltaTime);h.fixedTimestepMode?Ue(ye):ze(ye),J=ye*1e3;},stepFixed(){if(!h.fixedTimestepMode)throw new Error("stepFixed() requires fixedTimestepMode to be enabled");m.onBeforeFixedUpdate?.(a,F,Q),m.onBeforeUpdate?.(a,F),a=p.runFixedUpdatePhases(a,F),m.onAfterUpdate?.(a,F),m.onAfterFixedUpdate?.(a,F,Q),Q++;}};return He}function no(n){return n?.isRunning()??false}function oo(n){return n?.isPaused()??false}var nn=z$1.object({action:z$1.string().min(1,"Action name is required"),keys:z$1.array(z$1.string()).default([]),mouseButtons:z$1.array(z$1.enum(["left","right","middle","wheelUp","wheelDown","unknown"])).optional(),continuous:z$1.boolean().default(false),deadzone:z$1.number().min(0).max(1).default(.1)}),on=z$1.object({version:z$1.number().int().positive(),bindings:z$1.array(z$1.object({action:z$1.string(),keys:z$1.array(z$1.string()),mouseButtons:z$1.array(z$1.string()).optional(),continuous:z$1.boolean().optional()}))}),Ht={active:false,justActivated:false,justDeactivated:false,activeTime:0,value:0},an=1;function rn(n,o){for(let e of n.keys)if(o.isKeyDown(e))return true;for(let e of n.mouseButtons)if(o.isMouseButtonDown(e))return true;return false}function ro(n){let o=new Map,e=new Map,t=new Map,a=new Set;function p(s,l,u){s.active=true,s.justActivated=true,s.activeTime=0,s.value=1,C(l,s,u);}function m(s,l,u){s.active=false,s.justDeactivated=true,s.value=0,C(l,s,u);}function v(s,l,u,S,I){s.activeTime+=S,s.value=1,l.continuous&&C(u,s,I);}function h(s,l,u,S,I){u.justActivated=false,u.justDeactivated=false;let J=u.active,D=rn(l,I);D&&!J?p(u,s,I):!D&&J?m(u,s,I):D&&v(u,l,s,S,I);}function C(s,l,u){let S=t.get(s);if(S)for(let I of S)I(s,l,u);for(let I of a)I(s,l,u);}let k={register(s){let l=nn.parse(s),u={action:l.action,keys:[...l.keys],mouseButtons:l.mouseButtons?[...l.mouseButtons]:[],continuous:l.continuous??false,deadzone:l.deadzone??.1};return o.set(l.action,u),e.has(l.action)||e.set(l.action,{...Ht}),k},registerAll(s){for(let l of s)k.register(l);return k},unregister(s){let l=o.delete(s);return e.delete(s),t.delete(s),l},hasAction(s){return o.has(s)},getActions(){return [...o.keys()]},getBinding(s){let l=o.get(s);if(l)return {action:l.action,keys:[...l.keys],mouseButtons:l.mouseButtons.length>0?[...l.mouseButtons]:void 0,continuous:l.continuous,deadzone:l.deadzone}},update(s,l){let u=l*1e3;for(let[S,I]of o){let J=e.get(S);J&&h(S,I,J,u,s);}},isActive(s){return e.get(s)?.active??false},isJustActivated(s){return e.get(s)?.justActivated??false},isJustDeactivated(s){return e.get(s)?.justDeactivated??false},getValue(s){return e.get(s)?.value??0},getActiveTime(s){return e.get(s)?.activeTime??0},getState(s){return e.get(s)??Ht},getActiveActions(){let s=[];for(let[l,u]of e)u.active&&s.push(l);return s},rebindKeys(s,l){let u=o.get(s);return u?(u.keys=[...l],true):false},rebindMouseButtons(s,l){let u=o.get(s);return u?(u.mouseButtons=[...l],true):false},addKey(s,l){let u=o.get(s);return u?(u.keys.includes(l)||u.keys.push(l),true):false},removeKey(s,l){let u=o.get(s);if(!u)return false;let S=u.keys.indexOf(l);return S!==-1?(u.keys.splice(S,1),true):false},getKeysForAction(s){let l=o.get(s);return l?[...l.keys]:[]},getMouseButtonsForAction(s){let l=o.get(s);return l?[...l.mouseButtons]:[]},getActionsForKey(s){let l=[];for(let[u,S]of o)S.keys.includes(s)&&l.push(u);return l},onAction(s,l){let u=t.get(s);return u||(u=new Set,t.set(s,u)),u.add(l),()=>{u?.delete(l);}},onAnyAction(s){return a.add(s),()=>{a.delete(s);}},saveBindings(){let s=[];for(let[,l]of o)s.push({action:l.action,keys:[...l.keys],mouseButtons:l.mouseButtons.length>0?[...l.mouseButtons]:void 0,continuous:l.continuous||void 0});return {version:an,bindings:s}},loadBindings(s){let l=on.parse(s);o.clear(),e.clear();for(let u of l.bindings)k.register({action:u.action,keys:u.keys,mouseButtons:u.mouseButtons,continuous:u.continuous});},toJSON(s=false){let l=k.saveBindings();return s?JSON.stringify(l,null,2):JSON.stringify(l)},fromJSON(s){let l=JSON.parse(s);k.loadBindings(l);},resetStates(){for(let s of e.values())s.active=false,s.justActivated=false,s.justDeactivated=false,s.activeTime=0,s.value=0;},clear(){o.clear(),e.clear(),t.clear(),a.clear();}};return n&&k.registerAll(n),k}var so={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 Oe(){return performance.now()}function Ne(n){return n.length===0?0:n.reduce((e,t)=>e+t,0)/n.length}function Vt(n,o){if(n.length===0)return 0;if(n.length===1)return n[0]??0;let e=Math.ceil(o*n.length)-1;return n[Math.max(0,Math.min(e,n.length-1))]??0}function sn(n,o){o&&console.warn(`[InputEventBuffer] Dropped ${n} events due to buffer overflow`);}function ln(n={}){let o=n.warnOnOverflow??true;return {keyEvents:[],mouseEvents:[],latencySamples:[],frameProcessingTimes:[],frameStartTime:0,totalKeyEvents:0,totalMouseEvents:0,droppedEvents:0,config:{maxBufferSize:n.maxBufferSize??1e3,maxLatencySamples:n.maxLatencySamples??1e3,maxFrameSamples:n.maxFrameSamples??100,warnOnOverflow:o,onOverflow:n.onOverflow??(e=>sn(e,o))}}}function Yt(n,o){let e=n.config.maxBufferSize;if(e<=0)return 0;if(o.length>e){let t=o.length-e;return o.splice(0,t),n.droppedEvents+=t,n.config.onOverflow(t),t}return 0}function uo(n,o,e){n.totalKeyEvents++;let t={type:"key",event:o,timestamp:e??Oe()};n.keyEvents.push(t),Yt(n,n.keyEvents);}function fo(n,o,e){n.totalMouseEvents++;let t={type:"mouse",event:o,timestamp:e??Oe()};n.mouseEvents.push(t),Yt(n,n.mouseEvents);}function un(n){let o=n.keyEvents;return n.keyEvents=[],o}function fn(n){let o=n.mouseEvents;return n.mouseEvents=[],o}function po(n){let o=un(n),e=fn(n),t=[...o,...e];return t.sort((a,p)=>a.timestamp-p.timestamp),t}function co(n){let o=[...n.keyEvents,...n.mouseEvents];return o.sort((e,t)=>e.timestamp-t.timestamp),o}function mo(n){return n.keyEvents}function go(n){return n.mouseEvents}function bo(n){n.keyEvents=[],n.mouseEvents=[];}function yo(n){return n.keyEvents.length}function ho(n){return n.mouseEvents.length}function vo(n){return n.keyEvents.length+n.mouseEvents.length}function So(n){return n.keyEvents.length>0||n.mouseEvents.length>0}function xo(n){return {totalKeyEvents:n.totalKeyEvents,totalMouseEvents:n.totalMouseEvents,pendingKeyEvents:n.keyEvents.length,pendingMouseEvents:n.mouseEvents.length,droppedEvents:n.droppedEvents,maxBufferSize:n.config.maxBufferSize}}function Eo(n){n.totalKeyEvents=0,n.totalMouseEvents=0,n.droppedEvents=0;}function Co(n){n.frameStartTime=Oe();}function Bo(n){let e=Oe()-n.frameStartTime;return n.frameProcessingTimes.push(e),n.frameProcessingTimes.length>n.config.maxFrameSamples&&n.frameProcessingTimes.shift(),e}function ko(n,o){n.latencySamples.push(o),n.latencySamples.length>n.config.maxLatencySamples&&n.latencySamples.shift();}function To(n,o,e){for(let t=0;t<Math.min(e,10);t++)n.latencySamples.push(o);for(;n.latencySamples.length>n.config.maxLatencySamples;)n.latencySamples.shift();}function _t(n){let o=n.latencySamples,e=n.frameProcessingTimes;if(o.length===0)return {min:0,max:0,avg:0,p95:0,p99:0,sampleCount:0,lastFrameProcessingTime:e[e.length-1]??0,avgFrameProcessingTime:Ne(e)};let t=[...o].sort((a,p)=>a-p);return {min:t[0]??0,max:t[t.length-1]??0,avg:Ne(t),p95:Vt(t,.95),p99:Vt(t,.99),sampleCount:t.length,lastFrameProcessingTime:e[e.length-1]??0,avgFrameProcessingTime:Ne(e)}}function Io(n){n.latencySamples=[],n.frameProcessingTimes=[];}function Fo(n,o=16){return _t(n).p95<=o}function Po(n,o=1){return _t(n).avgFrameProcessingTime<=o}var Mo=ln();var dn=z$1.object({trackRepeats:z$1.boolean().optional(),debounceTime:z$1.number().nonnegative().optional(),customRepeatRate:z$1.number().positive().optional(),customRepeatDelay:z$1.number().positive().optional()}),Xt={pressed:false,justPressed:false,justReleased:false,heldTime:0,repeatCount:0,lastEventTime:0},de={pressed:false,justPressed:false,justReleased:false,heldTime:0,lastEventTime:0};function Gt(){return {x:0,y:0,deltaX:0,deltaY:0,wheelDelta:0,buttons:{left:{...de},right:{...de},middle:{...de},wheelUp:{...de},wheelDown:{...de},unknown:{...de}}}}function pn(n,o){return n.toLowerCase()}function Oo(n={}){let o=dn.parse(n),e={trackRepeats:o.trackRepeats??true,debounceTime:o.debounceTime??0,customRepeatRate:o.customRepeatRate??0,customRepeatDelay:o.customRepeatDelay??500},t=new Map,a=Gt(),p=0,m=0,v=0,h=false,C=false,k=false;function s(){for(let r of t.values())r.justPressed=false,r.justReleased=false;for(let r of Object.values(a.buttons))r.justPressed=false,r.justReleased=false;}function l(r){for(let f of t.values())f.pressed&&(f.heldTime+=r);}function u(r,f){return e.debounceTime<=0||r.lastEventTime<=0?false:f-r.lastEventTime<e.debounceTime}function S(r){e.trackRepeats&&r.repeatCount++;}function I(r){r.pressed=true,r.justPressed=true,r.justReleased=false,r.heldTime=0,r.repeatCount=0;}function J(r,f){let b=pn(r.name),x=t.get(b);x||(x={...Xt},t.set(b,x)),!u(x,f)&&(x.pressed?S(x):I(x),x.lastEventTime=f,r.ctrl&&!x.pressed&&(h=true),r.meta&&!x.pressed&&(C=true),r.shift&&!x.pressed&&(k=true));}function D(r,f){let b=t.get(r);!b||!b.pressed||(b.pressed=false,b.justPressed=false,b.justReleased=true,b.lastEventTime=f,r==="ctrl"&&(h=false),r==="alt"&&(C=false),r==="shift"&&(k=false));}function F(r){let f=a.x,b=a.y;a.x=r.x,a.y=r.y,a.deltaX+=r.x-f,a.deltaY+=r.y-b;}function Q(r,f,b){f==="press"&&!r.pressed?(r.pressed=true,r.justPressed=true,r.justReleased=false,r.heldTime=0):f==="release"&&r.pressed&&(r.pressed=false,r.justPressed=false,r.justReleased=true),r.lastEventTime=b;}function ue(r,f){F(r),r.button==="wheelUp"?a.wheelDelta+=1:r.button==="wheelDown"&&(a.wheelDelta-=1);let b=a.buttons[r.button];b&&Q(b,r.action,f);}let fe=()=>{let r=performance.now();for(let[f,b]of t)b.pressed&&D(f,r);h=false,C=false,k=false;},ee=()=>{let r=performance.now();for(let f of Object.values(a.buttons))f.pressed&&(f.pressed=false,f.justReleased=true,f.lastEventTime=r);};return {update(r,f,b){p++,m=r.length,v=f.length;let x=b*1e3;s(),l(x);for(let q of r)J(q.event,q.timestamp);a.deltaX=0,a.deltaY=0,a.wheelDelta=0;for(let q of f)ue(q.event,q.timestamp);for(let q of Object.values(a.buttons))q.pressed&&(q.heldTime+=x);},isKeyDown(r){return t.get(r.toLowerCase())?.pressed??false},isKeyPressed(r){return t.get(r.toLowerCase())?.justPressed??false},isKeyReleased(r){return t.get(r.toLowerCase())?.justReleased??false},getKeyHeldTime(r){return t.get(r.toLowerCase())?.heldTime??0},getKeyState(r){return t.get(r.toLowerCase())??Xt},getKeyRepeatCount(r){return t.get(r.toLowerCase())?.repeatCount??0},getPressedKeys(){let r=[];for(let[f,b]of t)b.pressed&&r.push(f);return r},getJustPressedKeys(){let r=[];for(let[f,b]of t)b.justPressed&&r.push(f);return r},getJustReleasedKeys(){let r=[];for(let[f,b]of t)b.justReleased&&r.push(f);return r},isCtrlDown(){return h},isAltDown(){return C},isShiftDown(){return k},hasModifier(){return h||C||k},isMouseButtonDown(r){return a.buttons[r]?.pressed??false},isMouseButtonPressed(r){return a.buttons[r]?.justPressed??false},isMouseButtonReleased(r){return a.buttons[r]?.justReleased??false},getMouseX(){return a.x},getMouseY(){return a.y},getMousePosition(){return {x:a.x,y:a.y}},getMouseDelta(){return {deltaX:a.deltaX,deltaY:a.deltaY}},getWheelDelta(){return a.wheelDelta},getMouseState(){return a},releaseKey(r){D(r.toLowerCase(),performance.now());},releaseAllKeys:fe,releaseAllMouseButtons:ee,releaseAll(){fe(),ee();},getStats(){let r=0,f=0,b=0;for(let x of t.values())x.pressed&&r++,x.justPressed&&f++,x.justReleased&&b++;return {keysDown:r,keysPressed:f,keysReleased:b,keyEventsThisFrame:m,mouseEventsThisFrame:v,frameCount:p}},getFrameCount(){return p},reset(){t.clear(),a=Gt(),p=0,m=0,v=0,h=false,C=false,k=false;}}}function Ro(n,o){for(let e of o)if(n.isKeyDown(e))return true;return false}function Ko(n,o){for(let e of o)if(!n.isKeyDown(e))return false;return true}function jo(n,o){for(let e of o)if(n.isKeyPressed(e))return true;return false}function Lo(n){let o=0,e=0;return (n.isKeyDown("a")||n.isKeyDown("left"))&&(o-=1),(n.isKeyDown("d")||n.isKeyDown("right"))&&(o+=1),(n.isKeyDown("w")||n.isKeyDown("up"))&&(e-=1),(n.isKeyDown("s")||n.isKeyDown("down"))&&(e+=1),{x:o,y:e}}export{Eo as $,Wt as A,Nt as B,zt as C,Ut as D,tn as E,to as F,no as G,oo as H,nn as I,on as J,ro as K,so as L,ln as M,uo as N,fo as O,un as P,fn as Q,po as R,co as S,mo as T,go as U,bo as V,yo as W,ho as X,vo as Y,So as Z,xo as _,he as a,Co as aa,ve as b,Bo as ba,Se as c,ko as ca,xe as d,To as da,Ee as e,_t as ea,Ce as f,Io as fa,Be as g,Fo as ga,ke as h,Po as ha,Te as i,Mo as ia,Ie as j,Oo as ja,Fe as k,Ro as ka,Pe as l,Ko as la,Me as m,jo as ma,De as n,Lo as na,Ae as o,It as p,Ft as q,Pt as r,Mt as s,Dt as t,At as u,Ot as v,Rt as w,Kt as x,jt as y,Lt as z};
@@ -1 +0,0 @@
1
- import {b as b$1}from'./chunk-5PELJRUQ.js';import {createWorld,resetWorld,addEntity,removeEntity,entityExists,getAllEntities,addComponent,hasComponent,removeComponent,query,registerComponent,withStore}from'bitecs';function b(){return createWorld()}function d(t){resetWorld(t);}var c=b$1(()=>{});function q(t){return addEntity(t)}function w(t,e){removeEntity(t,e);}function G(t,e){return entityExists(t,e)}function j(t){return getAllEntities(t)}function z(t,e,r){addComponent(t,e,r);}function B(t,e,r){return hasComponent(t,e,r)}function D(t,e,r){removeComponent(t,e,r);}function F(t,e){return query(t,e)}var J,K,A=b$1(()=>{c();J=registerComponent,K=withStore;});function I(t,e,r,n=255){return ((n&255)<<24|(t&255)<<16|(e&255)<<8|r&255)>>>0}function N(t){return {r:t>>16&255,g:t>>8&255,b:t&255,a:t>>24&255}}function Q(t){let e=t.replace("#",""),r,n,o,i=255;if(e.length===3||e.length===4){let s=e.charAt(0),p=e.charAt(1),u=e.charAt(2);if(r=Number.parseInt(s+s,16),n=Number.parseInt(p+p,16),o=Number.parseInt(u+u,16),e.length===4){let m=e.charAt(3);i=Number.parseInt(m+m,16);}}else if(e.length===6||e.length===8)r=Number.parseInt(e.slice(0,2),16),n=Number.parseInt(e.slice(2,4),16),o=Number.parseInt(e.slice(4,6),16),e.length===8&&(i=Number.parseInt(e.slice(6,8),16));else return 0;return I(r,n,o,i)}function O(t,e=false){let{r,g:n,b:o,a:i}=N(t),s=r.toString(16).padStart(2,"0"),p=n.toString(16).padStart(2,"0"),u=o.toString(16).padStart(2,"0");if(e){let m=i.toString(16).padStart(2,"0");return `#${s}${p}${u}${m}`}return `#${s}${p}${u}`}function P(t){return typeof t=="string"?Q(t):t}var $=b$1(()=>{});export{b as a,d as b,c,q as d,w as e,G as f,j as g,z as h,B as i,D as j,F as k,J as l,K as m,A as n,I as o,N as p,Q as q,O as r,P as s,$ as t};
@@ -1 +0,0 @@
1
- import {k as k$2,l as l$2}from'./chunk-EF4DC6IN.js';import {l}from'./chunk-OFRWGW2G.js';import {f,B as B$1,a as a$2,b as b$1,A,x,y as y$1,z as z$1,D,Y as Y$1,$,aa as aa$1,pa as pa$1,na as na$1,_ as _$2,ka,qa,xa as xa$2,Ta,Ga,Aa as Aa$1,ca as ca$1,ea as ea$2,za as za$1}from'./chunk-EJAKECSN.js';import {a,m as m$1,g,j as j$1,b as b$3,f as f$2}from'./chunk-RJULLVTH.js';import {O,Q as Q$1,_,va,ya as ya$1,za,Aa,Ba,la as la$1,ia as ia$1,ha as ha$1,$ as $$1,ea as ea$1,fa as fa$1}from'./chunk-WY5EZOOL.js';import {a as a$1}from'./chunk-NPNUUSIB.js';import {a as a$3}from'./chunk-5N3O25O7.js';import {f as f$1,b as b$2,n as n$2}from'./chunk-LI4Y7TBZ.js';import {l as l$1,q,c,r}from'./chunk-DQTVJITR.js';import {T,U,V,_ as _$1,xa as xa$1,n as n$1,Y as Y$2,e as e$1,ka as ka$1,oa as oa$1,v,g as g$1}from'./chunk-GJ3RS2VG.js';import {n,k as k$1,i,d as d$1,j,e,h,l as l$3,m as m$2}from'./chunk-P3ZLIQJP.js';import {z}from'zod';n();var On=1e4;function Ln(e=On){return {animationId:new Uint32Array(e),playing:new Uint8Array(e),loop:new Uint8Array(e),speed:new Float32Array(e),elapsed:new Float32Array(e),currentFrameIndex:new Uint16Array(e),direction:new Int8Array(e)}}var Vn=Ln(),Nt=new WeakSet,_t=null;function jt(e){return Nt.has(e)||(_t=l$3(e,m$2(()=>Vn)),Nt.add(e)),_t}function Zt(e){let t=jt(e);return Array.from(k$1(e,[t]))}function Gn(e,t){let n=jt(e);return i(e,t,n)}var Ue=e=>{let t=a$1(),n=Zt(e);for(let r of n)O(e,r,t);return e};function qn(){return Ue}function Un(e,t=0){e.registerSystem(2,Ue,t);}function Nn(e,t,n){for(let r of t)O(e,r,n);}n();var _n=z.object({getPosition:z.function().optional(),applyMovement:z.function().optional(),getDelta:z.function()});function jn(e,t){if(Y$2(e,t))return {x:T.x[t],y:T.y[t]}}function Zn(e,t,n,r,o){i(e,t,T)&&(T.x[t]=T.x[t]+n*o,T.y[t]=T.y[t]+r*o);}function $n(e,t){let n=_n.parse(e),r=n.getPosition??jn,o=n.applyMovement??Zn;return i=>{let s=n.getDelta(),a=t(i);for(let l of a)f(i,l)&&(B$1(i,l,s),Qn(i,l,s,r,o));return i}}function Qn(e,t,n,r,o){let i=a$2.behaviorType[t];if(i===b$1.Idle)return;if(i===b$1.Custom){A(e,t,n);return}let s=r(e,t);if(!s)return;if(i===b$1.Patrol){Kn(e,t,s.x,s.y,n,o);return}let a=a$2.targetEntity[t];if(a===0)return;let l=r(e,a);l&&(i===b$1.Chase?Jn(e,t,s.x,s.y,l.x,l.y,n,o):i===b$1.Flee&&er(e,t,s.x,s.y,l.x,l.y,n,o));}function Kn(e,t,n,r,o,i){let s=x(e,t,n,r,o);s&&(s.dx!==0||s.dy!==0)&&i(e,t,s.dx,s.dy,o);}function Jn(e,t,n,r,o,i,s,a){let l=y$1(e,t,n,r,o,i);l&&(l.dx!==0||l.dy!==0)&&a(e,t,l.dx,l.dy,s);}function er(e,t,n,r,o,i,s,a){let l=z$1(e,t,n,r,o,i);l&&(l.dx!==0||l.dy!==0)&&a(e,t,l.dx,l.dy,s);}n();function Ne(e){return Array.from(k$1(e,[D]))}var _e=e=>{let t=a$1(),n=Ne(e);for(let r of n)Y$1(e,r,t);return e};function tr(){return _e}function nr(e,t=20){e.registerSystem(2,_e,t);}function rr(e,t){let n=Ne(e);for(let r of n)Y$1(e,r,t);}n();var Se=67108864;function je(e,t){if(e>=Se||t>=Se)throw new RangeError(`Entity IDs must be below ${Se} for collision-free pair keys. Got: ${e}, ${t}`);return e*Se+t}var d={eventBus:l(),activePairs:a(),activeTriggers:a(),pairHandles:new Map,triggerHandles:new Map};function or(){return d.eventBus}function ir(){return d.activePairs.size}function ar(){return {data:d.activePairs.data,size:d.activePairs.size}}function sr(){return d.activeTriggers.size}function lr(){return {data:d.activeTriggers.data,size:d.activeTriggers.size}}function ur(){g(d.activePairs),g(d.activeTriggers),d.pairHandles.clear(),d.triggerHandles.clear();}function Qt(e){return Array.from(k$1(e,[Q$1]))}function cr(e,t,n,r,o,i$1,s,a){if(!i(e,a,T))return;let l=Q$1.layer[a],u=Q$1.mask[a];if(!$$1(o,i$1,l,u))return;let f=T.x[a],p=T.y[a];if(!ea$1(t,n,r,a,f,p))return;let S=_(e,a);return fa$1(t,a,s||S)}function Kt(e){let t=Qt(e),n=[];for(let r=0;r<t.length;r++){let o=t[r];if(o===void 0||!i(e,o,T))continue;let i$1=T.x[o],s=T.y[o],a=Q$1.layer[o],l=Q$1.mask[o],u=_(e,o);for(let f=r+1;f<t.length;f++){let p=t[f];if(p===void 0)continue;let S=cr(e,o,i$1,s,a,l,u,p);S&&n.push(S);}}return n}function $t(e,t,n,r){let{data:o}=e;for(let i=e.size-1;i>=0;i--){let s=o[i];if(!s)continue;let a=je(s.entityA,s.entityB);if(n.has(a))continue;let l=t.get(a);l&&(t.delete(a),f$2(e,l),d.eventBus.emit(r,{entityA:s.entityA,entityB:s.entityB}));}}function mr(e,t,n){let r=je(e.entityA,e.entityB);if(e.isTrigger){if(n.add(r),!d.triggerHandles.has(r)){let o=b$3(d.activeTriggers,e);d.triggerHandles.set(r,o),d.eventBus.emit("triggerEnter",{entityA:e.entityA,entityB:e.entityB});}}else if(t.add(r),!d.pairHandles.has(r)){let o=b$3(d.activePairs,e);d.pairHandles.set(r,o),d.eventBus.emit("collisionStart",{entityA:e.entityA,entityB:e.entityB});}}function fr(e){let t=new Set,n=new Set;for(let r of e)mr(r,t,n);$t(d.activePairs,d.pairHandles,t,"collisionEnd"),$t(d.activeTriggers,d.triggerHandles,n,"triggerExit");}var Ze=e=>{let t=Kt(e);return fr(t),e};function pr(){return Ze}function dr(e,t=10){e.registerSystem(2,Ze,t);}function yr(e){let{data:t}=d.activePairs;for(let n=0;n<d.activePairs.size;n++){let r=t[n];if(r&&(r.entityA===e||r.entityB===e))return true}return false}function gr(e){let{data:t}=d.activeTriggers;for(let n=0;n<d.activeTriggers.size;n++){let r=t[n];if(r&&(r.entityA===e||r.entityB===e))return true}return false}function br(e){let t=[],{data:n}=d.activePairs;for(let r=0;r<d.activePairs.size;r++){let o=n[r];o&&(o.entityA===e?t.push(o.entityB):o.entityB===e&&t.push(o.entityA));}return t}function Sr(e){let t=[],{data:n}=d.activeTriggers;for(let r=0;r<d.activeTriggers.size;r++){let o=n[r];o&&(o.entityA===e?t.push(o.entityB):o.entityB===e&&t.push(o.entityA));}return t}function hr(e,t){let n=Math.min(e,t),r=Math.max(e,t),o=je(n,r);return d.pairHandles.has(o)||d.triggerHandles.has(o)}function xr(e){return {type:"fixed",value:e}}function vr(e){return {type:"percentage",value:e}}function Er(e){return {type:"min",value:e}}function Cr(e){return {type:"max",value:e}}function Mr(e,t){return {type:"ratio",numerator:e,denominator:t}}function Tr(e,t){switch(e.type){case "fixed":return Math.min(e.value,t);case "percentage":return Math.floor(e.value/100*t);case "min":return Math.min(e.value,t);case "max":return Math.min(e.value,t);case "ratio":return e.denominator===0?0:Math.floor(e.numerator/e.denominator*t)}}function Jt(e,t){let n=[],r=0,o=[];for(let i=0;i<e.length;i++){let s=e[i];if(!s){n.push(0);continue}if(s.type==="fixed"){let a=Math.min(s.value,t-r);n.push(a),r+=a;}else n.push(0),o.push(i);}for(let i of o){let s=e[i];s&&(n[i]=Tr(s,t));}return n}function Pr(e){let t=[];for(let n=0;n<e.length;n++){let r=e[n];r&&(r.type==="min"||r.type==="max")&&t.push(n);}return t}function kr(e,t,n,r){let o=n;if(r&&(o+=1),e.type==="max"){let i=e.value-t;o=Math.min(o,i);}return Math.max(0,o)}function en(e,t,n){if(n<=0)return;let r=Pr(e);if(r.length===0)return;let o=Math.floor(n/r.length),i=n%r.length;for(let s of r){let a=e[s],l=t[s];if(!a||l===void 0)continue;let u=kr(a,l,o,i>0);i>0&&(i-=1),t[s]=l+u;}}function Wr(e,t,n){if(n.length===0)return [];let r=Jt(n,t.width),o=0;for(let l of r)o+=l;let i=t.width-o;i>0&&en(n,r,i);let s=[],a=t.x;for(let l=0;l<r.length;l++){let u=r[l];u!==void 0&&(s.push({x:a,y:t.y,width:u,height:t.height}),a+=u);}return s}function Ar(e,t,n){if(n.length===0)return [];let r=Jt(n,t.height),o=0;for(let l of r)o+=l;let i=t.height-o;i>0&&en(n,r,i);let s=[],a=t.y;for(let l=0;l<r.length;l++){let u=r[l];u!==void 0&&(s.push({x:t.x,y:a,width:t.width,height:u}),a+=u);}return s}var xe=new Map,he=new Map;function Fr(){return {dragging:null,startX:0,startY:0,offsetX:0,offsetY:0,lastX:0,lastY:0,constraints:{},verifyCallback:null}}function Hr(e,t){xe.set(e,t);}function tn(e){return xe.get(e)??{}}function Dr(e){xe.delete(e);}function Rr(e,t){t?he.set(e,t):he.delete(e);}function nn(e){return he.get(e)??null}function Br(e,t,n,r){return r==="x"?{x:t,y:T.y[e]??n}:r==="y"?{x:T.x[e]??t,y:n}:{x:t,y:n}}function Yr(e,t,n){return n?{x:Math.round(e/n.x)*n.x,y:Math.round(t/n.y)*n.y}:{x:e,y:t}}function Xr(e,t,n){let r=e,o=t;return n.minX!==void 0&&(r=Math.max(r,n.minX)),n.maxX!==void 0&&(r=Math.min(r,n.maxX)),n.minY!==void 0&&(o=Math.max(o,n.minY)),n.maxY!==void 0&&(o=Math.min(o,n.maxY)),{x:r,y:o}}function zr(e,t,n,r,o){if(!o)return {x:n,y:r};let i=v(e,t);if(i===n$1)return {x:n,y:r};let s=g$1(e,i);if(!s)return {x:n,y:r};let a=g$1(e,t),l=a?.width??1,u=a?.height??1;return {x:Math.max(0,Math.min(n,s.width-l)),y:Math.max(0,Math.min(r,s.height-u))}}function Ir(e,t,n,r,o){let i=Br(t,n,r,o.constrainAxis);return i=Yr(i.x,i.y,o.snapToGrid),i=Xr(i.x,i.y,o),i=zr(e,t,i.x,i.y,o.constrainToParent),i}function wr(e){let t=Fr(),n=(r,o=null,i=false)=>{if(t.dragging===null)return;let s=t.dragging,a=V(r,s),l=a?.x??t.lastX,u=a?.y??t.lastY;e.emit("dragend",{entity:s,x:l,y:u,totalDx:l-t.startX,totalDy:u-t.startY,cancelled:i}),i||e.emit("drop",{entity:s,x:l,y:u,dropTarget:o}),t.dragging=null,t.startX=0,t.startY=0,t.offsetX=0,t.offsetY=0,t.lastX=0,t.lastY=0,t.constraints={},t.verifyCallback=null;};return {getState(){return t},isDragging(){return t.dragging!==null},getDraggingEntity(){return t.dragging},canDrag(r,o){return l$1(r,o)},startDrag(r,o,i,s){if(!l$1(r,o)||t.dragging!==null)return false;let a=V(r,o);if(!a)return false;if(t.dragging=o,t.startX=a.x,t.startY=a.y,t.offsetX=i-a.x,t.offsetY=s-a.y,t.lastX=a.x,t.lastY=a.y,t.constraints=tn(o),t.verifyCallback=nn(o),t.constraints.bringToFront){let l=t.constraints.frontZIndex??9999;_$1(r,o,l);}return e.emit("dragstart",{entity:o,startX:a.x,startY:a.y,mouseX:i,mouseY:s}),true},updateDrag(r,o,i){if(t.dragging===null)return false;let s=t.dragging,a=o-t.offsetX,l=i-t.offsetY,u=Ir(r,s,a,l,t.constraints);a=u.x,l=u.y;let f=a-t.lastX,p=l-t.lastY;return f===0&&p===0||t.verifyCallback&&!t.verifyCallback(s,f,p)?false:(U(r,s,a,l),t.lastX=a,t.lastY=l,e.emit("drag",{entity:s,x:a,y:l,dx:f,dy:p,mouseX:o,mouseY:i}),true)},endDrag:n,cancelDrag(r){if(t.dragging===null)return;let o=t.dragging;U(r,o,t.startX,t.startY),n(r,null,true);}}}function Or(){xe.clear(),he.clear();}n();var ve=null,ie=new WeakMap,$e=new WeakMap;function Qe(e){let t=ie.get(e);return t||(t=[],ie.set(e,t)),t}function rn(){return ve||(ve=l()),ve}function Lr(){ve=null;}var Vr=e=>k$1(e,[T,ka$1,c]);function Q(e){let t=Vr(e),n=[];for(let r of t){if(!q(e,r)||!xa$1(e,r))continue;let o=c.tabIndex[r];o<0||n.push({eid:r,tabIndex:o,y:T.y[r],x:T.x[r]});}return n.sort((r,o)=>r.tabIndex!==0&&o.tabIndex!==0?r.tabIndex-o.tabIndex:r.tabIndex!==0?-1:o.tabIndex!==0?1:r.y!==o.y?r.y-o.y:r.x-o.x),n.map(r=>r.eid)}function Ee(e){let t=f$1(e);if(!t)return null;let n=b$2.focused[t];return n===n$1?null:n}function K(e,t,n,r$1){let o=rn();r$1!==null&&(r(e,r$1,false),oa$1(e,r$1),o.emit("blur",{entity:r$1,previousEntity:null,nextEntity:n})),n!==null&&(r(e,n,true),oa$1(e,n),o.emit("focus",{entity:n,previousEntity:r$1,nextEntity:null})),n$2(e,t,n);}function w(e,t){let n=f$1(e);if(!n||!q(e,t)||!xa$1(e,t))return false;let r=b$2.focused[n],o=r===0?null:r;return o===t||K(e,n,t,o),true}function on(e){let t=f$1(e);if(!t)return;let n=b$2.focused[t],r=n===0?null:n;r!==null&&K(e,t,null,r);}function Gr(e){let t=f$1(e);if(!t)return null;let n=Q(e);if(n.length===0)return null;let r=b$2.focused[t],o=r===0?null:r,i=0;if(o!==null){let a=n.indexOf(o);a>=0&&(i=(a+1)%n.length);}let s=n[i];return s===void 0?null:(K(e,t,s,o),s)}function qr(e){let t=f$1(e);if(!t)return null;let n=Q(e);if(n.length===0)return null;let r=b$2.focused[t],o=r===0?null:r,i=n.length-1;if(o!==null){let a=n.indexOf(o);a>=0&&(i=(a-1+n.length)%n.length);}let s=n[i];return s===void 0?null:(K(e,t,s,o),s)}function an(e){let t=Q(e);if(t.length===0)return null;let n=t[0];return n===void 0?null:w(e,n)?n:null}function Ur(e){let t=Q(e);if(t.length===0)return null;let n=t[t.length-1];return n===void 0?null:w(e,n)?n:null}function Nr(e,t){let n=Qe(e),r=Ee(e);return r!==null&&n.push(r),w(e,t)}function _r(e){let t=Qe(e);if(t.length===0)return on(e),null;let n=t.pop();return q(e,n)&&xa$1(e,n)?(w(e,n),n):sn(e)}function jr(e){let t=Ee(e);$e.set(e,t);}function Zr(e){let t=$e.get(e);return $e.delete(e),t==null?null:q(e,t)&&xa$1(e,t)?(w(e,t),t):null}function sn(e){let t=Qe(e);for(;t.length>0;){let n=t.pop();if(q(e,n)&&xa$1(e,n))return w(e,n),n}return an(e)}function $r(e,t){if(t===0)return Ee(e);let n=f$1(e);if(!n)return null;let r=Q(e);if(r.length===0)return null;let o=b$2.focused[n],i=o===0?null:o,s=-1;i!==null&&(s=r.indexOf(i));let a;s<0?a=t>0?0:r.length-1:a=((s+t)%r.length+r.length)%r.length;let l=r[a];return l===void 0?null:(K(e,n,l,i),l)}function Qr(e){let t=ie.get(e);return t?t.length:0}function Kr(e){let t=ie.get(e);t&&(t.length=0);}function Jr(e){let t=ie.get(e);return !t||t.length===0?null:t[t.length-1]??null}var ln=e=>{let t=f$1(e);if(!t)return e;let n=b$2.focused[t];if(n!==0){let r=n;(!q(e,r)||!xa$1(e,r))&&K(e,t,null,r);}return e};function eo(){return ln}var to=z.object({targetFrameMs:z.number().positive(),phaseBudgets:z.record(z.string(),z.number().positive()),rollingWindowSize:z.number().int().positive(),warnOnOverrun:z.boolean()}),cn={targetFrameMs:16.67,phaseBudgets:{},rollingWindowSize:120,warnOnOverrun:true},y=null;function Ke(e){return {samples:Array.from({length:e},()=>0),idx:0,count:0,total:0,min:Number.POSITIVE_INFINITY,max:0}}function mn(e,t){let n=e.samples[e.idx%e.samples.length]??0;e.samples[e.idx%e.samples.length]=t,e.idx++,e.count<e.samples.length?(e.count++,e.total+=t):e.total+=t-n,t<e.min&&(e.min=t),t>e.max&&(e.max=t);}function J(e,t){if(e.count===0)return 0;let n=e.samples.slice(0,e.count).sort((o,i)=>o-i),r=Math.min(Math.floor(n.length*t),n.length-1);return n[r]??0}function un(e){return e.count>0?e.total/e.count:0}function no(e){let t={...cn,...e};return y={config:to.parse(t),systemSamples:new Map,phaseTotals:new Map,frameSamples:Ke(t.rollingWindowSize),totalFrames:0,budgetOverruns:0,alerts:[],onAlert:null},Je()}function fn(e,t){if(!y)return;let n=y.systemSamples.get(e);n||(n=Ke(y.config.rollingWindowSize),y.systemSamples.set(e,n)),mn(n,t);}function ro(e,t){if(!y)return;y.phaseTotals.set(e,t);let n=y.config.phaseBudgets[e];if(n!==void 0&&t>n){let r={phase:e,budgetMs:n,actualMs:t,frame:y.totalFrames};y.alerts.push(r),y.alerts.length>100&&y.alerts.shift(),y.budgetOverruns++,y.onAlert&&y.onAlert(r);}}function oo(e){y&&(mn(y.frameSamples,e),y.totalFrames++);}function io(e,t){return n=>{let r=performance.now(),o=t(n);return fn(e,performance.now()-r),o}}function Je(){if(!y)return {config:cn,stats:{frameTimeMs:0,avgFrameMs:0,p50FrameMs:0,p95FrameMs:0,p99FrameMs:0,fps:0,avgFps:0,totalFrames:0,budgetOverruns:0,systemTimings:[],phaseTimings:{}},alerts:[]};let e=y,t=[];for(let[i,s]of e.systemSamples)t.push({name:i,lastMs:s.count>0?s.samples[(s.idx-1+s.samples.length)%s.samples.length]??0:0,avgMs:un(s),minMs:s.min===Number.POSITIVE_INFINITY?0:s.min,maxMs:s.max,p50Ms:J(s,.5),p95Ms:J(s,.95),p99Ms:J(s,.99),count:s.count});let n={};for(let[i,s]of e.phaseTotals)n[a$3[i]??"unknown"]=s;let r=e.frameSamples.count>0?e.frameSamples.samples[(e.frameSamples.idx-1+e.frameSamples.samples.length)%e.frameSamples.samples.length]??0:0,o=un(e.frameSamples);return {config:e.config,stats:{frameTimeMs:r,avgFrameMs:o,p50FrameMs:J(e.frameSamples,.5),p95FrameMs:J(e.frameSamples,.95),p99FrameMs:J(e.frameSamples,.99),fps:r>0?1e3/r:0,avgFps:o>0?1e3/o:0,totalFrames:e.totalFrames,budgetOverruns:e.budgetOverruns,systemTimings:t,phaseTimings:n},alerts:[...e.alerts]}}function ao(e){y&&(y.onAlert=e);}function so(){y&&(y.systemSamples.clear(),y.phaseTotals.clear(),y.frameSamples=Ke(y.config.rollingWindowSize),y.totalFrames=0,y.budgetOverruns=0,y.alerts=[]);}function lo(){y=null;}function uo(){let e=Je();return {config:e.config,stats:e.stats,alerts:e.alerts,exportedAt:Date.now()}}n();var co=1e4;function mo(e=co){return {x:new Float32Array(e),y:new Float32Array(e),maxSpeed:new Float32Array(e),friction:new Float32Array(e)}}var fo=mo(),pn=new WeakSet,dn=null;function yn(e){return pn.has(e)||(dn=l$3(e,m$2(()=>fo)),pn.add(e)),dn}function gn(e){let t=yn(e);return Array.from(k$1(e,[t]))}function po(e,t){let n=yn(e);return i(e,t,n)}var et=e=>{let t=a$1(),n=gn(e);for(let r of n)va(e,r)&&ya$1(r,t),za(r,t),Aa(r),i(e,r,T)&&Ba(r,t);return e};function yo(){return et}function go(e,t=0){e.registerSystem(4,et,t);}function bo(e,t,n){for(let r of t)la$1(e,r)&&(va(e,r)&&ya$1(r,n),za(r,n),Aa(r),i(e,r,T)&&Ba(r,n));}var So=z.object({deferLayout:z.boolean(),outlineResize:z.boolean(),keyboardStep:z.number(),keyboardResizeStep:z.number()}),se={minWidth:4,minHeight:2,maxWidth:0,maxHeight:0,constrainToScreen:true,screenWidth:80,screenHeight:24,snapGrid:0},tt={deferLayout:true,outlineResize:false,keyboardStep:1,keyboardResizeStep:1};function bn(){return {entity:void 0,isMoving:false,isResizing:false,resizeHandle:void 0,startX:0,startY:0,panelStartX:0,panelStartY:0,panelStartWidth:0,panelStartHeight:0,layoutDeferred:false}}function ho(e){let t={...tt,...e};return So.parse(t)}function xo(e){return {...se,...e}}function vo(e,t,n,r,o,i,s,a,l){let u={...tt,...l};return {...e,entity:t,isMoving:true,isResizing:false,resizeHandle:void 0,startX:n,startY:r,panelStartX:o,panelStartY:i,panelStartWidth:s,panelStartHeight:a,layoutDeferred:u.deferLayout}}function Eo(e,t,n,r,o,i,s,a,l,u){let f={...tt,...u};return {...e,entity:t,isMoving:false,isResizing:true,resizeHandle:n,startX:r,startY:o,panelStartX:i,panelStartY:s,panelStartWidth:a,panelStartHeight:l,layoutDeferred:f.deferLayout}}function Co(e,t,n,r){if(!e.isMoving)return {x:e.panelStartX,y:e.panelStartY,width:e.panelStartWidth,height:e.panelStartHeight,dirtyRects:[],clamped:false};let o={...se,...r},i=t-e.startX,s=n-e.startY,a=e.panelStartX+i,l=e.panelStartY+s,u=false;if(o.snapGrid>0&&(a=Math.round(a/o.snapGrid)*o.snapGrid,l=Math.round(l/o.snapGrid)*o.snapGrid),o.constrainToScreen){let p=Math.max(0,Math.min(a,o.screenWidth-e.panelStartWidth)),S=Math.max(0,Math.min(l,o.screenHeight-e.panelStartHeight));(p!==a||S!==l)&&(u=true),a=p,l=S;}let f=Yo(e.panelStartX+(t-e.startX-i+i),e.panelStartY+(n-e.startY-s+s),a,l,e.panelStartWidth,e.panelStartHeight);return {x:a,y:l,width:e.panelStartWidth,height:e.panelStartHeight,dirtyRects:f,clamped:u}}function Mo(e,t,n,r,o,i,s){let a=t,l=n,u=r,f=o;return (e.includes("right")||e==="right")&&(u+=i),(e.includes("bottom")||e==="bottom")&&(f+=s),(e.includes("left")||e==="left")&&(a+=i,u-=i),(e.includes("top")||e==="top")&&(l+=s,f-=s),{x:a,y:l,w:u,h:f}}function To(e,t,n){let r=e,o=t,i=false;return r<n.minWidth&&(r=n.minWidth,i=true),o<n.minHeight&&(o=n.minHeight,i=true),n.maxWidth>0&&r>n.maxWidth&&(r=n.maxWidth,i=true),n.maxHeight>0&&o>n.maxHeight&&(o=n.maxHeight,i=true),{width:r,height:o,clamped:i}}function Po(e,t,n,r,o){return o<=0?{x:e,y:t,w:n,h:r}:{x:Math.round(e/o)*o,y:Math.round(t/o)*o,w:Math.round(n/o)*o,h:Math.round(r/o)*o}}function ko(e,t,n,r,o){if(!o.constrainToScreen)return {x:e,y:t,w:n,h:r};let i=Math.max(0,e),s=Math.max(0,t),a=n,l=r;return i+a>o.screenWidth&&(a=o.screenWidth-i),s+l>o.screenHeight&&(l=o.screenHeight-s),{x:i,y:s,w:a,h:l}}function Wo(e,t,n,r){if(!e.isResizing||!e.resizeHandle)return {x:e.panelStartX,y:e.panelStartY,width:e.panelStartWidth,height:e.panelStartHeight,dirtyRects:[],clamped:false};let o={...se,...r},i=t-e.startX,s=n-e.startY,a=Mo(e.resizeHandle,e.panelStartX,e.panelStartY,e.panelStartWidth,e.panelStartHeight,i,s),l=To(a.w,a.h,o);a.w=l.width,a.h=l.height;let u=l.clamped;a=Po(a.x,a.y,a.w,a.h,o.snapGrid),a=ko(a.x,a.y,a.w,a.h,o);let f=[{x:e.panelStartX,y:e.panelStartY,width:e.panelStartWidth,height:e.panelStartHeight},{x:a.x,y:a.y,width:a.w,height:a.h}];return {x:a.x,y:a.y,width:a.w,height:a.h,dirtyRects:f,clamped:u}}function Ao(e){return {...e,isMoving:false,isResizing:false,resizeHandle:void 0,layoutDeferred:false}}function Fo(e){return {state:bn(),restoreX:e.panelStartX,restoreY:e.panelStartY,restoreWidth:e.panelStartWidth,restoreHeight:e.panelStartHeight}}function Ho(e,t,n,r,o,i,s){let a={...se,...s},l=e,u=t;return o==="up"&&(u-=i),o==="down"&&(u+=i),o==="left"&&(l-=i),o==="right"&&(l+=i),a.constrainToScreen&&(l=Math.max(0,Math.min(l,a.screenWidth-n)),u=Math.max(0,Math.min(u,a.screenHeight-r))),a.snapGrid>0&&(l=Math.round(l/a.snapGrid)*a.snapGrid,u=Math.round(u/a.snapGrid)*a.snapGrid),{x:l,y:u}}function Do(e,t,n,r,o){let i={...se,...o},s=e,a=t;return n==="grow-horizontal"&&(s+=r),n==="shrink-horizontal"&&(s-=r),n==="grow-vertical"&&(a+=r),n==="shrink-vertical"&&(a-=r),s=Math.max(i.minWidth,s),a=Math.max(i.minHeight,a),i.maxWidth>0&&(s=Math.min(i.maxWidth,s)),i.maxHeight>0&&(a=Math.min(i.maxHeight,a)),{width:s,height:a}}function Ro(e,t,n,r,o=1){let i=e<o,s=e>=n-o,a=t<o,l=t>=r-o;if(a&&i)return "topLeft";if(a&&s)return "topRight";if(l&&i)return "bottomLeft";if(l&&s)return "bottomRight";if(a)return "top";if(l)return "bottom";if(i)return "left";if(s)return "right"}function Bo(e){if(e.length===0)return;let t=Number.POSITIVE_INFINITY,n=Number.POSITIVE_INFINITY,r=0,o=0;for(let i of e)t=Math.min(t,i.x),n=Math.min(n,i.y),r=Math.max(r,i.x+i.width),o=Math.max(o,i.y+i.height);return {x:t,y:n,width:r-t,height:o-n}}function Yo(e,t,n,r,o,i){return [{x:e,y:t,width:o,height:i},{x:n,y:r,width:o,height:i}]}n();var Xo=z.object({emitters:z.function(),particles:z.function(),maxParticles:z.number().int().positive().optional(),archetypeName:z.string().optional()});function nt(e,t,n,r){if(!i(e,t,$))return -1;let o;if(r){let T=k$2(e,r);if(T===null)return -1;o=T;}else o=d$1(e);let i$1=Math.floor(Math.random()*n.chars.length),s=n.chars[i$1]??42;aa$1(e,o,{lifetime:$.lifetime[t],char:s,startFg:n.startFg,endFg:n.endFg??n.startFg,fadeOut:n.fadeOut??true,emitter:t});let a=Y$2(e,t)?T.x[t]:0,l=Y$2(e,t)?T.y[t]:0;U(e,o,a,l);let u=$.angle[t],f=$.spread[t],p=u+(Math.random()-.5)*f,S=$.speed[t],C=Math.cos(p)*S,M=Math.sin(p)*S;return ia$1(e,o,C,M),pa$1(t,o),o}function zo(e,t,n,r=1e3,o=0){if(!i(e,t,$))return [];let i$1=na$1(t);if(!i$1)return [];let s=n??$.burstCount[t],a=[];for(let l=0;l<s&&!(o+a.length>=r);l++){let u=nt(e,t,i$1);u!==-1&&a.push(u);}return a}function rt(e,t,n){if(!i(e,t,_$2))return;_$2.age[t]=_$2.age[t]+n;let r=_$2.emitter[t];if(r>0&&ka(e,r)){let o=$.gravity[r];o!==0&&la$1(e,t)&&(ha$1.y[t]=ha$1.y[t]+o*n);}}function ot(e,t,n){!Y$2(e,t)||!la$1(e,t)||(T.x[t]=T.x[t]+ha$1.x[t]*n,T.y[t]=T.y[t]+ha$1.y[t]*n);}function it(e$1,t,n){let r=_$2.emitter[t];r>0&&qa(r,t),n?(j(e$1,t,_$2),l$2(e$1,n,t)):e(e$1,t);}function Io(e,t){return !(!i(e,t,$)||$.active[t]!==1)}function wo(e,t,n,r,o,i){let s=na$1(t);if(!s)return o;let a=$.rate[t];if(a<=0)return o;$.accumulator[t]=$.accumulator[t]+n;let l=1/a,u=o;for(;$.accumulator[t]>=l&&u<r;)$.accumulator[t]=$.accumulator[t]-l,nt(e,t,s,i)!==-1&&u++;return u}function Oo(e,t,n,r,o,i){let s=o;for(let a of t)Io(e,a)&&(s=wo(e,a,n,r,s,i));return s}function Lo(e,t,n,r){ca$1(e,t)&&(rt(e,t,n),ot(e,t,n),ea$2(e,t)&&it(e,t,r));}function Vo(e,t,n,r,o){for(let i=0;i<n;i++){let s=t[i];if(!s)continue;let a=s.particleId;ca$1(e,a)&&(o.add(a),rt(e,a,r),ot(e,a,r));}}function Go(e,t,n,r){for(let o=n-1;o>=0;o--){let i=t[o];if(!i)continue;let s=i.particleId;ca$1(e,s)?ea$2(e,s)&&it(e,s,r):qa(i.emitterId,s);}}function qo(e){let t=Xo.parse(e),n=t.maxParticles??1e3,r=t.archetypeName,o=new Set;return i=>{let s=.016666666666666666,a=t.emitters(i),l=xa$2(),u=j$1(l),f=t.particles(i);Oo(i,a,s,n,f.length,r),o.clear(),Vo(i,u,l.size,s,o),Go(i,u,l.size,r);for(let p of f)o.has(p)||Lo(i,p,s,r);return i}}var Sn=z.object({friction:z.number().min(0).max(1),minVelocity:z.number().nonnegative(),maxVelocity:z.number().positive(),sensitivity:z.number(),springStiffness:z.number().nonnegative(),springDamping:z.number().nonnegative(),maxOverscroll:z.number().nonnegative(),enableMomentum:z.boolean(),enableBounce:z.boolean()}),hn={friction:.92,minVelocity:.1,maxVelocity:200,sensitivity:1,springStiffness:.3,springDamping:.8,maxOverscroll:50,enableMomentum:true,enableBounce:true},k=m$1({iterable:true});function Uo(e,t,n,r,o){let i=k.get(e);return i?(i.contentWidth=t,i.contentHeight=n,i.viewportWidth=r,i.viewportHeight=o):(i={scrollX:0,scrollY:0,velocityX:0,velocityY:0,contentWidth:t,contentHeight:n,viewportWidth:r,viewportHeight:o,isAnimating:false,isUserScrolling:false,targetX:null,targetY:null},k.set(e,i)),i}function No(e){k.delete(e);}function _o(){k.clear();}function jo(e,t,n,r){let o={...hn,...r},i=Sn.parse(o),s=k.get(e);s&&(s.velocityX+=t*i.sensitivity,s.velocityY+=n*i.sensitivity,s.velocityX=Math.max(-i.maxVelocity,Math.min(i.maxVelocity,s.velocityX)),s.velocityY=Math.max(-i.maxVelocity,Math.min(i.maxVelocity,s.velocityY)),s.isAnimating=true,s.targetX=null,s.targetY=null);}function Zo(e,t,n){let r=k.get(e);r&&(r.targetX=t,r.targetY=n,r.isAnimating=true);}function $o(e,t,n){let r=k.get(e);r&&(r.scrollX=t,r.scrollY=n,r.velocityX=0,r.velocityY=0,r.targetX=null,r.targetY=null,r.isAnimating=false);}function Qo(e){let t=k.get(e);t&&(t.isUserScrolling=true,t.velocityX=0,t.velocityY=0);}function Ko(e,t,n){let r=k.get(e);r&&(r.isUserScrolling=false,r.velocityX=t,r.velocityY=n,r.isAnimating=Math.abs(t)>.1||Math.abs(n)>.1);}function Jo(e,t){let n=Math.max(0,e.contentWidth-e.viewportWidth),r=Math.max(0,e.contentHeight-e.viewportHeight);if(!t.enableBounce){e.scrollX=Math.max(0,Math.min(n,e.scrollX)),e.scrollY=Math.max(0,Math.min(r,e.scrollY));return}let o=e.scrollX<0?e.scrollX:e.scrollX>n?e.scrollX-n:0,i=e.scrollY<0?e.scrollY:e.scrollY>r?e.scrollY-r:0;Math.abs(o)>0&&!e.isUserScrolling&&(e.velocityX-=o*t.springStiffness,e.velocityX*=t.springDamping),Math.abs(i)>0&&!e.isUserScrolling&&(e.velocityY-=i*t.springStiffness,e.velocityY*=t.springDamping),e.scrollX=Math.max(-t.maxOverscroll,Math.min(n+t.maxOverscroll,e.scrollX)),e.scrollY=Math.max(-t.maxOverscroll,Math.min(r+t.maxOverscroll,e.scrollY));}function ei(e){if(!(e.targetX===null&&e.targetY===null)){if(e.targetX!==null){let t=e.targetX-e.scrollX;Math.abs(t)<.5?(e.scrollX=e.targetX,e.targetX=null,e.velocityX=0):e.velocityX=t*.15;}if(e.targetY!==null){let t=e.targetY-e.scrollY;Math.abs(t)<.5?(e.scrollY=e.targetY,e.targetY=null,e.velocityY=0):e.velocityY=t*.15;}}}function ti(e,t){e.scrollX+=e.velocityX*t*60,e.scrollY+=e.velocityY*t*60;}function ni(e,t){!t.enableMomentum||e.isUserScrolling||(e.velocityX*=t.friction,e.velocityY*=t.friction);}function ri(e,t){return Math.abs(e.velocityX)<t.minVelocity&&Math.abs(e.velocityY)<t.minVelocity&&e.targetX===null&&e.targetY===null}function oi(e){e.velocityX=0,e.velocityY=0,e.isAnimating=false,e.scrollX=Math.round(e.scrollX),e.scrollY=Math.round(e.scrollY);let t=Math.max(0,e.contentWidth-e.viewportWidth),n=Math.max(0,e.contentHeight-e.viewportHeight);e.scrollX=Math.max(0,Math.min(t,e.scrollX)),e.scrollY=Math.max(0,Math.min(n,e.scrollY));}function xn(e,t,n){let r={...hn,...n},o=Sn.parse(r);if(!e.isAnimating)return false;let i=e.scrollX,s=e.scrollY;return ei(e),ti(e,t),ni(e,o),Jo(e,o),ri(e,o)&&oi(e),e.scrollX!==i||e.scrollY!==s}function ii(e){return k.get(e)?.isAnimating??false}function ai(e){let t=k.get(e);return t?{x:t.scrollX,y:t.scrollY}:null}function si(e){let t=performance.now();return n=>{let r=performance.now(),o=Math.min((r-t)/1e3,1/15);return t=r,k.forEach(i=>{xn(i,o,e);}),n}}n();var li=z.object({cellSize:z.number().positive(),initialCapacity:z.number().int().positive()}),vn=8,ui=.5;function ci(e){let t={cellSize:e?.cellSize??vn,initialCapacity:e?.initialCapacity??256};return {cellSize:li.parse(t).cellSize,cells:new Map,entityCells:new Map}}function st(e,t){let n=e>=0?e*2:-e*2-1,r=t>=0?t*2:-t*2-1;return (n+r)*(n+r+1)/2+r}function mi(e,t,n){return {cx:Math.floor(t/e.cellSize),cy:Math.floor(n/e.cellSize)}}function ce(e,t,n,r,o=1,i=1){lt(e,t);let s=t,a=new Set,l=Math.floor(n/e.cellSize),u=Math.floor(r/e.cellSize),f=Math.floor((n+o-.001)/e.cellSize),p=Math.floor((r+i-.001)/e.cellSize);for(let S=l;S<=f;S++)for(let C=u;C<=p;C++){let M=st(S,C);a.add(M);let T=e.cells.get(M);T||(T=new Set,e.cells.set(M,T)),T.add(s);}e.entityCells.set(s,a);}function lt(e,t){let n=t,r=e.entityCells.get(n);if(r){for(let o of r){let i=e.cells.get(o);i&&(i.delete(n),i.size===0&&e.cells.delete(o));}e.entityCells.delete(n);}}function ut(e,t,n,r=1,o=1){let i=new Set,s=Math.floor(t/e.cellSize),a=Math.floor(n/e.cellSize),l=Math.floor((t+r-.001)/e.cellSize),u=Math.floor((n+o-.001)/e.cellSize);for(let f=s;f<=l;f++)for(let p=a;p<=u;p++){let S=st(f,p),C=e.cells.get(S);if(C)for(let M of C)i.add(M);}return i}function fi(e,t){let n=t,r=new Set,o=e.entityCells.get(n);if(!o)return r;for(let i of o){let s=e.cells.get(i);if(s)for(let a of s)a!==n&&r.add(a);}return r}function En(e,t,n){let r=st(t,n);return e.cells.get(r)??new Set}function pi(e,t,n){let r=Math.floor(t/e.cellSize),o=Math.floor(n/e.cellSize);return En(e,r,o)}function Cn(e){e.cells.clear(),e.entityCells.clear();}function di(e){let t=0,n=0;for(let o of e.cells.values())n+=o.size,o.size>t&&(t=o.size);let r=e.cells.size;return {cellCount:r,entityCount:e.entityCells.size,averageEntitiesPerCell:r>0?n/r:0,maxEntitiesInCell:t}}function ct(e,t){Cn(e);let n=k$1(t,[T,Q$1]);for(let r of n){let o=T.x[r],i=T.y[r],s=Q$1.width[r],a=Q$1.height[r],l=Q$1.offsetX[r],u=Q$1.offsetY[r];ce(e,r,o+l,i+u,s,a);}}function mt(e=ui){return {dirtyEntities:a(64),dirtyLookup:new Set,prevBounds:m$1({iterable:true}),initialized:false,dirtyThreshold:Math.max(0,Math.min(1,e))}}var ue=null,W=mt();function yi(e){e!==ue&&(W.initialized=false,W.prevBounds.clear()),ue=e;}function gi(){return ue}function bi(){return W}function Si(e){let t=e;W.dirtyLookup.has(t)||(b$3(W.dirtyEntities,t),W.dirtyLookup.add(t));}function hi(){return W.dirtyEntities.size}function xi(){W=mt(W.dirtyThreshold);}function vi(e){W.dirtyThreshold=Math.max(0,Math.min(1,e));}function ft(e){let t=T.x[e]+Q$1.offsetX[e],n=T.y[e]+Q$1.offsetY[e],r=Q$1.width[e],o=Q$1.height[e];return {x:t,y:n,w:r,h:o}}function Ei(e,t){for(let n of t){let{x:r,y:o,w:i,h:s}=ft(n),a=e.prevBounds.get(n);a?(a.x=r,a.y=o,a.w=i,a.h=s):e.prevBounds.set(n,{x:r,y:o,w:i,h:s});}}function Ci(e,t,n){let r=[];t.prevBounds.forEach((o,i)=>{n.has(i)||r.push(i);});for(let o of r)lt(e,o),t.prevBounds.delete(o);}function Mi(e,t){for(let n of t){let r=n,{x:o,y:i,w:s,h:a}=ft(n),l=e.prevBounds.get(n);(!l||o!==l.x||i!==l.y||s!==l.w||a!==l.h)&&(e.dirtyLookup.has(r)||(b$3(e.dirtyEntities,r),e.dirtyLookup.add(r))),l?(l.x=o,l.y=i,l.w=s,l.h=a):e.prevBounds.set(n,{x:o,y:i,w:s,h:a});}}function Ti(e,t,n){let{data:r,size:o}=n;for(let i$1=0;i$1<o;i$1++){let s=r[i$1];if(s===void 0)continue;let a=s;if(!i(t,a,T)||!i(t,a,Q$1))continue;let{x:l,y:u,w:f,h:p}=ft(a);ce(e,a,l,u,f,p);}}function Pi(e,t,n,r){let o=t.dirtyEntities.size;o!==0&&(r>0&&o>t.dirtyThreshold*r?ct(e,n):Ti(e,n,t.dirtyEntities));}function Mn(e,t,n){let r=k$1(n,[T,Q$1]);if(!t.initialized){ct(e,n),Ei(t,r),g(t.dirtyEntities),t.dirtyLookup.clear(),t.initialized=true;return}let o=new Set;for(let i of r)o.add(i);Ci(e,t,o),Mi(t,r),Pi(e,t,n,r.length),g(t.dirtyEntities),t.dirtyLookup.clear();}var Tn=e=>(ue&&Mn(ue,W,e),e);function ki(){return Tn}n();var ee=1e4,b={targetX:new Float32Array(ee),targetY:new Float32Array(ee),stiffness:new Float32Array(ee),damping:new Float32Array(ee),precision:new Float32Array(ee),active:new Uint8Array(ee)},Wi={stiffness:180,damping:8,precision:.01},Pn={stiffness:100,damping:15,precision:.01},Ai={stiffness:300,damping:20,precision:.01};function Fi(e,t,n=Pn){let r=i(e,t,T),o=r?T.x[t]??0:0,i$1=r?T.y[t]??0:0;return r||(h(e,t,T),T.x[t]=0,T.y[t]=0,T.z[t]=0,T.absolute[t]=0),i(e,t,ha$1)||(h(e,t,ha$1),ha$1.x[t]=0,ha$1.y[t]=0,ha$1.maxSpeed[t]=0,ha$1.friction[t]=0),i(e,t,b)||h(e,t,b),b.targetX[t]=o,b.targetY[t]=i$1,b.stiffness[t]=n.stiffness,b.damping[t]=n.damping,b.precision[t]=n.precision,b.active[t]=0,t}function Hi(e,t,n,r){i(e,t,b)&&(b.targetX[t]=n,b.targetY[t]=r,b.active[t]=1);}function Di(e,t){if(i(e,t,b))return {x:b.targetX[t]??0,y:b.targetY[t]??0}}function Ri(e,t){return i(e,t,b)&&b.active[t]===1}function Bi(e,t){if(b.active[e]===0)return;let n=T.x[e]??0,r=T.y[e]??0,o=b.targetX[e]??0,i=b.targetY[e]??0,s=b.stiffness[e]??100,a=b.damping[e]??15,l=b.precision[e]??.01,u=o-n,f=i-r,p=s*u,S=s*f,C=ha$1.x[e]??0,M=ha$1.y[e]??0,T$1=a*C,Te=a*M,L=C+(p-T$1)*t,V=M+(S-Te)*t;ha$1.x[e]=L,ha$1.y[e]=V,T.x[e]=n+L*t,T.y[e]=r+V*t;let Pe=Math.sqrt(u*u+f*f),G=Math.sqrt(L*L+V*V);Pe<l&&G<l&&(T.x[e]=o,T.y[e]=i,ha$1.x[e]=0,ha$1.y[e]=0,b.active[e]=0);}function Yi(e,t){let n=Xi(e);for(let r of n)Bi(r,t);return e}function Xi(e){return k$1(e,[b,T,ha$1])}n();var zi=1e4;function Ii(e=zi){return {machineId:new Uint32Array(e),currentState:new Uint16Array(e),previousState:new Uint16Array(e),stateAge:new Float32Array(e)}}var B=Ii(),kn=new WeakSet,Wn=null;function wi(e){return kn.has(e)||(Wn=l$3(e,m$2(()=>B)),kn.add(e)),Wn}function An(e){let t=wi(e);return Array.from(k$1(e,[t]))}function Oi(){return B.stateAge}var pt=e=>{let t=a$1(),n=An(e);for(let r of n){let o=B.stateAge[r]??0;B.stateAge[r]=o+t;}return e};function Li(){return pt}function Vi(e,t=0){e.registerSystem(2,pt,t);}function Gi(e,t){for(let n of e){let r=B.stateAge[n]??0;B.stateAge[n]=r+t;}}function qi(e){B.stateAge[e]=0;}function Ui(e){return B.stateAge[e]??0}n();z.object({viewportWidth:z.number().int().positive(),viewportHeight:z.number().int().positive(),camera:z.object({x:z.number().finite(),y:z.number().finite()})});var Y=null,Ce=null;function Ni(e){Y=e;}function _i(){return Y}function ji(){return Ce}function Zi(){Ce=null;}function $i(){Y=null,Ce=null;}function Fn(e,t){let n=[];for(let r=0;r<t;r++){let o=[];for(let i=0;i<e;i++)o.push({char:" ",fg:0,bg:0});n.push(o);}return {width:e,height:t,cells:n}}function Qi(e,t,n,r){let o=" ",i=0,s=0;for(let a of e.layers){if(!a.visible)continue;let l=a.tiles[r*e.width+n];if(l===za$1)continue;let u=t.tiles[l];u&&(o=u.char,i=u.fg,s=u.bg);}return {char:o,fg:i,bg:s}}function Ki(e,t,n,r,o,i){for(let s=0;s<i;s++){let a=r+s;if(a<0||a>=e.height)continue;let l=e.cells[a];if(l)for(let u=0;u<o;u++){let f=n+u;f<0||f>=e.width||(l[f]=t);}}}function Ji(e,t,n,r,o,i,s,a){let l=Math.max(0,Math.floor(-e/o)),u=Math.max(0,Math.floor(-t/i)),f=Math.min(n,Math.ceil((s-e)/o)),p=Math.min(r,Math.ceil((a-t)/i));return [l,u,f,p]}function Hn(e,t,n,r){let o=Ta.width[t],i=Ta.height[t],s=Ta.tileWidth[t],a=Ta.tileHeight[t],l=Ta.dataId[t],u=Ta.tilesetId[t],f=Ga.data.get(l),p=Aa$1.tilesets.get(u);if(!f||!p)return;let S=T.x[t],C=T.y[t],M=S-n,T$1=C-r,[Te,L,V,Pe]=Ji(M,T$1,o,i,s,a,e.width,e.height);for(let G=L;G<Pe;G++)for(let me=Te;me<V;me++){let zn=Qi(f,p,me,G),In=Math.round(M+me*s),wn=Math.round(T$1+G*a);Ki(e,zn,In,wn,s,a);}}function Dn(e){if(!Y)return null;let t=Fn(Y.viewportWidth,Y.viewportHeight),n=k$1(e,[Ta,T]);for(let r of n)Hn(t,r,Y.camera.x,Y.camera.y);return Ce=t,t}var Rn=e=>(Dn(e),e);function ea(){return Rn}n();function ta(){return {bounds:m$1({iterable:false})}}function Bn(e,t,n,r,o,i,s){let a=t.bounds.get(n);return a&&a.x===r&&a.y===o&&a.w===i&&a.h===s?false:(ce(e,n,r,o,i,s),a?(a.x=r,a.y=o,a.w=i,a.h=s):t.bounds.set(n,{x:r,y:o,w:i,h:s}),true)}function na(e,t){e.bounds.delete(t);}function ra(e){e.bounds.clear();}function dt(e,t){return ut(e,t.x,t.y,t.width,t.height)}function oa(e,t,n){let r=dt(e,t),o=Array.from(r);return {visible:o,total:n,culled:n-o.length}}function ia(e,t){return n=>{let r=k$1(n,[T]);for(let o of r){let i$1=T.x[o],s=T.y[o],a=1,l=1;i(n,o,e$1)&&(a=e$1.width[o],l=e$1.height[o]),Bn(e,t,o,i$1,s,a,l);}return n}}function aa(e,t){return n=>{let r=t();return dt(e,r),n}}var sa=z.object({maxWorkers:z.number().int().positive(),taskTimeout:z.number().positive(),enabled:z.boolean()});function la(){try{let e=globalThis.require?.("os");if(e?.cpus)return Math.max(1,e.cpus().length-1)}catch{}return 2}var Yn={maxWorkers:la(),taskTimeout:5e3,enabled:true},m=null,yt=0;function ua(e){let t={...Yn,...e};return m={config:sa.parse(t),queue:[],running:new Map,handlers:new Map,completedCount:0,cancelledCount:0,failedCount:0,totalDurationMs:0},Xn()}function ca(e,t){m&&m.handlers.set(e,t);}function ma(e,t,n="normal"){if(!m||!m.config.enabled)return ya(e,t);let r=`task-${yt++}`,o={id:r,type:e,input:t,priority:n,queuedAt:Date.now()};return new Promise(i=>{if(!m){i({id:r,type:e,output:void 0,cancelled:false,error:"Worker pool not initialized",durationMs:0});return}let s=m.handlers.get(e);if(!s){i({id:r,type:e,output:void 0,cancelled:false,error:`No handler registered for task type: ${e}`,durationMs:0});return}let a={task:o,resolve:i,handler:s,timerHandle:null},l={high:0,normal:1,low:2},u=l[n],f=m.queue.length;for(let p=0;p<m.queue.length;p++){let S=m.queue[p];if(S&&l[S.task.priority]>u){f=p;break}}m.queue.splice(f,0,a),queueMicrotask(()=>xa());})}function fa(e){if(!m)return false;let t=m.queue.findIndex(n=>n.task.id===e);if(t>=0){let[n]=m.queue.splice(t,1);return n?(n.resolve({id:e,type:n.task.type,output:void 0,cancelled:true,error:void 0,durationMs:0}),m.cancelledCount++,true):false}return false}function pa(e){if(!m)return 0;let t=0,n=[];for(let r of m.queue)r.task.type===e?(r.resolve({id:r.task.id,type:e,output:void 0,cancelled:true,error:void 0,durationMs:0}),t++):n.push(r);return m.queue=n,m.cancelledCount+=t,t}function Xn(){if(!m)return {config:Yn,stats:{activeWorkers:0,idleWorkers:0,queuedTasks:0,runningTasks:0,completedTasks:0,cancelledTasks:0,failedTasks:0,avgDurationMs:0,enabled:false}};let e=m.completedCount+m.failedCount;return {config:m.config,stats:{activeWorkers:m.running.size,idleWorkers:Math.max(0,m.config.maxWorkers-m.running.size),queuedTasks:m.queue.length,runningTasks:m.running.size,completedTasks:m.completedCount,cancelledTasks:m.cancelledCount,failedTasks:m.failedCount,avgDurationMs:e>0?m.totalDurationMs/e:0,enabled:m.config.enabled}}}function da(){if(m){for(let e of m.queue)e.resolve({id:e.task.id,type:e.task.type,output:void 0,cancelled:true,error:void 0,durationMs:0});for(let e of m.running.values())e.timerHandle&&clearTimeout(e.timerHandle);m=null,yt=0;}}function ya(e,t){let n=`sync-${yt++}`,r=m?.handlers.get(e);if(!r)return Promise.resolve({id:n,type:e,output:void 0,cancelled:false,error:`No handler registered for task type: ${e}`,durationMs:0});let o=performance.now();try{let i=r(t);return Promise.resolve({id:n,type:e,output:i,cancelled:!1,error:void 0,durationMs:performance.now()-o})}catch(i){return Promise.resolve({id:n,type:e,output:void 0,cancelled:false,error:i instanceof Error?i.message:String(i),durationMs:performance.now()-o})}}function ga(e,t){t<=0||(e.timerHandle=setTimeout(()=>{m&&(m.running.delete(e.task.id),m.failedCount++,e.resolve({id:e.task.id,type:e.task.type,output:void 0,cancelled:false,error:`Task timed out after ${t}ms`,durationMs:t}));},t));}function ba(e,t,n){m&&m.running.has(e.task.id)&&(e.timerHandle&&clearTimeout(e.timerHandle),m.running.delete(e.task.id),m.completedCount++,m.totalDurationMs+=n,e.resolve({id:e.task.id,type:e.task.type,output:t,cancelled:false,error:void 0,durationMs:n}));}function Sa(e,t,n){m&&m.running.has(e.task.id)&&(e.timerHandle&&clearTimeout(e.timerHandle),m.running.delete(e.task.id),m.failedCount++,m.totalDurationMs+=n,e.resolve({id:e.task.id,type:e.task.type,output:void 0,cancelled:false,error:t instanceof Error?t.message:String(t),durationMs:n}));}function ha(e){if(!m)return;ga(e,m.config.taskTimeout);let t=performance.now();try{let n=e.handler(e.task.input),r=performance.now()-t;ba(e,n,r);}catch(n){let r=performance.now()-t;Sa(e,n,r);}}function xa(){if(m)for(;m.queue.length>0&&m.running.size<m.config.maxWorkers;){let e=m.queue.shift();if(!e)break;m.running.set(e.task.id,e),ha(e);}}export{_r as $,ii as $a,Bn as $b,Sr as A,ho as Aa,Wi as Ab,hr as B,xo as Ba,Pn as Bb,xr as C,vo as Ca,Ai as Cb,vr as D,Eo as Da,Fi as Db,Er as E,Co as Ea,Hi as Eb,Cr as F,Wo as Fa,Di as Fb,Mr as G,Ao as Ga,Ri as Gb,Wr as H,Fo as Ha,Yi as Hb,Ar as I,Ho as Ia,An as Ib,Hr as J,Do as Ja,Oi as Jb,tn as K,Ro as Ka,pt as Kb,Dr as L,Bo as La,Li as Lb,Rr as M,nt as Ma,Vi as Mb,nn as N,zo as Na,Gi as Nb,wr as O,rt as Oa,qi as Ob,Or as P,ot as Pa,Ui as Pb,rn as Q,it as Qa,Ni as Qb,Lr as R,qo as Ra,_i as Rb,Q as S,Uo as Sa,ji as Sb,Ee as T,No as Ta,Zi as Tb,w as U,_o as Ua,$i as Ub,on as V,jo as Va,Fn as Vb,Gr as W,Zo as Wa,Hn as Wb,qr as X,$o as Xa,Dn as Xb,an as Y,Qo as Ya,Rn as Yb,Ur as Z,Ko as Za,ea as Zb,Nr as _,xn as _a,ta as _b,Zt as a,jr as aa,ai as ab,na as ac,Gn as b,Zr as ba,si as bb,ra as bc,Ue as c,sn as ca,vn as cb,dt as cc,qn as d,$r as da,ci as db,oa as dc,Un as e,Qr as ea,mi as eb,ia as ec,Nn as f,Kr as fa,ce as fb,aa as fc,$n as g,Jr as ga,lt as gb,ua as gc,Ne as h,ln as ha,ut as hb,ca as hc,_e as i,eo as ia,fi as ib,ma as ic,tr as j,no as ja,En as jb,fa as jc,nr as k,fn as ka,pi as kb,pa as kc,rr as l,ro as la,Cn as lb,Xn as lc,or as m,oo as ma,di as mb,da as mc,ir as n,io as na,ct as nb,ar as o,Je as oa,mt as ob,sr as p,ao as pa,yi as pb,lr as q,so as qa,gi as qb,ur as r,lo as ra,bi as rb,Qt as s,uo as sa,Si as sb,Kt as t,gn as ta,hi as tb,Ze as u,po as ua,xi as ub,pr as v,et as va,vi as vb,dr as w,yo as wa,Mn as wb,yr as x,go as xa,Tn as xb,gr as y,bo as ya,ki as yb,br as z,bn as za,b as zb};
@@ -1,2 +0,0 @@
1
- import {Oa,va,ka,la,qa,sa,ra,oa,pa,ia,ua,ma,ta,na,ja,ha,K,Qa,jb,ib,db,Z,S,Q,U,T,bb,ab,L as L$1,E,z,H as H$1,sb,pb,nb,Pa,La,Ma,Da,ya,Ga,Ha,Ca,Ba,Aa,za,xa,Ja,Fa,wa,Ia,Ka,Ea,W,Na,_a,X,V,_,C,R as R$1,B as B$1,$a,J,N,M as M$1,F as F$1,cb,A,qb,lb,kb,eb,gb,hb,fb,r,p,o,Ya,I as I$1,n,m,l,q,ob,O,rb,Za,Ra,fa,mb,v,Y,$,aa,Va,s,P,i,h,Ua,Sa,da,ea,x,G as G$1,u,D as D$1,ba,Ta,j,g,ca,d,c as c$1,Wa,ga,t,y as y$1,f,a,e,k as k$1,b as b$1,w,Xa}from'./chunk-4PRDJTCM.js';import {a as a$1}from'./chunk-NPNUUSIB.js';import {o as o$1,n as n$2,s as s$1}from'./chunk-GJ3RS2VG.js';import {n as n$1,i as i$1,h as h$1,j as j$1,k as k$2}from'./chunk-P3ZLIQJP.js';import {c}from'./chunk-5PELJRUQ.js';import {z as z$1}from'zod';var fn={};c(fn,{AmbientLightSchema:()=>Xa,Animation3D:()=>y,Animation3DConfigSchema:()=>w,BackendCapabilitiesSchema:()=>b$1,BackendPreferenceSchema:()=>k$1,BackendSelectionSchema:()=>e,BackendTypeSchema:()=>a,BrailleConfigSchema:()=>f,Camera3D:()=>y$1,Camera3DConfigSchema:()=>t,ClipRectSchema:()=>ga,CubeMeshOptionsSchema:()=>ue,CylinderMeshOptionsSchema:()=>fe,DirectionalLightSchema:()=>Wa,EncodedCellSchema:()=>c$1,EncodedOutputSchema:()=>d,EulerAnglesSchema:()=>ca,HalfBlockConfigSchema:()=>g,KittyConfigSchema:()=>j,LineEndpointSchema:()=>Ta,Mat4Schema:()=>ba,Material3D:()=>D$1,Material3DConfigSchema:()=>u,Mesh:()=>G$1,MouseInteraction3D:()=>b,MouseInteraction3DConfigSchema:()=>x,ObjLoadOptionsSchema:()=>ce,OrthographicConfigSchema:()=>ea,PerspectiveConfigSchema:()=>da,PixelBufferConfigSchema:()=>Sa,PlaneMeshOptionsSchema:()=>le,RGBAColorSchema:()=>Ua,SextantConfigSchema:()=>h,SixelConfigSchema:()=>i,SphereMeshOptionsSchema:()=>pe,Transform3D:()=>P,Transform3DConfigSchema:()=>s,TriangleVertexSchema:()=>Va,Vec3InputSchema:()=>aa,Vec3Schema:()=>$,Viewport3D:()=>Y,Viewport3DConfigSchema:()=>v,Viewport3DWidgetConfigSchema:()=>mb,ViewportConfigSchema:()=>fa,animation3DSystem:()=>Hr,backendStore:()=>G,blendPixel:()=>M,buildMVP:()=>Ra,clearBackendStore:()=>Jr,clearFramebuffer:()=>Za,clearFramebufferStore:()=>rb,clearMeshStore:()=>O,clearMouseInputStore:()=>me,clearOutputStore:()=>Qr,clearProjectionStore:()=>ob,clipLine:()=>Tr,computeBoundingBox:()=>ye,computeFaceNormal:()=>de,computeFlatShading:()=>he,computeOutcode:()=>L,createBackendByType:()=>q,createBrailleBackend:()=>l,createCubeMesh:()=>Nr,createCylinderMesh:()=>Gr,createHalfBlockBackend:()=>m,createKittyBackend:()=>n,createMeshFromArrays:()=>I$1,createPixelFramebuffer:()=>Ya,createPlaneMesh:()=>Xr,createSextantBackend:()=>o,createSixelBackend:()=>p,createSphereMesh:()=>Zr,detectBestBackend:()=>r,disableMouseInteraction:()=>Fr,drawLine:()=>fb,drawLineAA:()=>Yr,drawLineColor:()=>hb,drawLineDepth:()=>gb,enableMouseInteraction:()=>Ir,extractFrustumPlanes:()=>kr,feedMouseDrag:()=>Ar,feedMouseScroll:()=>zr,fillRect:()=>eb,fillTriangle:()=>kb,fillTriangleFlat:()=>lb,framebufferStore:()=>qb,getAnimation3D:()=>Or,getCamera3D:()=>A,getDepth:()=>cb,getMaterial3D:()=>F$1,getMesh:()=>M$1,getMeshCount:()=>N,getMeshData:()=>J,getMouseInteraction3D:()=>Pr,getPixel:()=>$a,getProjMatrix:()=>B$1,getTransform3D:()=>R$1,getViewMatrix:()=>C,getViewport3D:()=>_,getWorldMatrix:()=>V,isDirty:()=>X,isInBounds:()=>_a,isPointInFrustum:()=>Lr,isSphereInFrustum:()=>Rr,loadObjAsMesh:()=>Br,lookAt:()=>Na,markDirty:()=>W,mat4Determinant:()=>Ea,mat4Equals:()=>Ka,mat4FromTRS:()=>Ia,mat4Identity:()=>wa,mat4Invert:()=>Fa,mat4IsIdentity:()=>Ja,mat4Multiply:()=>xa,mat4RotateX:()=>za,mat4RotateY:()=>Aa,mat4RotateZ:()=>Ba,mat4Scale:()=>Ca,mat4TransformDirection:()=>Ha,mat4TransformVec3:()=>Ga,mat4Translate:()=>ya,mat4Transpose:()=>Da,mouseInputStore:()=>I,mouseInteraction3DSystem:()=>Ur,orthographicMatrix:()=>Ma,outputStore:()=>H,parseObj:()=>be,perspectiveMatrix:()=>La,projectVertex:()=>Pa,projectionStore:()=>nb,projectionSystem:()=>pb,rasterSystem:()=>sb,registerMesh:()=>H$1,sceneGraphSystem:()=>Kr,setAnimation3D:()=>vr,setCamera3D:()=>z,setMaterial3D:()=>E,setMesh:()=>L$1,setPixel:()=>ab,setPixelUnsafe:()=>bb,setRotation:()=>T,setScale:()=>U,setTransform3D:()=>Q,setTranslation:()=>S,setViewport3D:()=>Z,shadeFace:()=>Wr,testAndSetDepth:()=>db,triangleArea2:()=>ib,triangleBoundingBox:()=>jb,unprojectVertex:()=>Qa,unregisterMesh:()=>K,vec3:()=>ha,vec3Add:()=>ja,vec3Cross:()=>na,vec3Distance:()=>ta,vec3Dot:()=>ma,vec3Equals:()=>ua,vec3FromArray:()=>ia,vec3Length:()=>pa,vec3LengthSq:()=>oa,vec3Lerp:()=>ra,vec3Negate:()=>sa,vec3Normalize:()=>qa,vec3Scale:()=>la,vec3Sub:()=>ka,vec3Zero:()=>va,viewportOutputSystem:()=>$r,viewportTransform:()=>Oa});n$1();var D=1e4,y={rotateSpeedX:new Float32Array(D),rotateSpeedY:new Float32Array(D),rotateSpeedZ:new Float32Array(D),orbitCenterX:new Float32Array(D),orbitCenterY:new Float32Array(D),orbitCenterZ:new Float32Array(D),orbitSpeed:new Float32Array(D),orbitRadius:new Float32Array(D),orbitAngle:new Float32Array(D),orbitEnabled:new Uint8Array(D)};function vr(t,e,n){let r=w.parse(n);return i$1(t,e,y)||h$1(t,e,y),y.rotateSpeedX[e]=r.rotateSpeed.x,y.rotateSpeedY[e]=r.rotateSpeed.y,y.rotateSpeedZ[e]=r.rotateSpeed.z,r.orbitCenter&&(y.orbitCenterX[e]=r.orbitCenter[0],y.orbitCenterY[e]=r.orbitCenter[1],y.orbitCenterZ[e]=r.orbitCenter[2],y.orbitEnabled[e]=1),y.orbitSpeed[e]=r.orbitSpeed,r.orbitRadius!==void 0&&(y.orbitRadius[e]=r.orbitRadius),e}function Or(t,e){if(i$1(t,e,y))return {rotateSpeedX:y.rotateSpeedX[e],rotateSpeedY:y.rotateSpeedY[e],rotateSpeedZ:y.rotateSpeedZ[e],orbitCenterX:y.orbitCenterX[e],orbitCenterY:y.orbitCenterY[e],orbitCenterZ:y.orbitCenterZ[e],orbitSpeed:y.orbitSpeed[e],orbitRadius:y.orbitRadius[e],orbitAngle:y.orbitAngle[e],orbitEnabled:y.orbitEnabled[e]===1}}n$1();var B=1e4,b={rotationSensitivity:new Float32Array(B),zoomSensitivity:new Float32Array(B),zoomMin:new Float32Array(B),zoomMax:new Float32Array(B),invertY:new Uint8Array(B),distance:new Float32Array(B),yaw:new Float32Array(B),pitch:new Float32Array(B)},I=new Map;function me(){I.clear();}function Ar(t,e,n){let r=I.get(t);r?(r.dragDx+=e,r.dragDy+=n):I.set(t,{dragDx:e,dragDy:n,scrollDelta:0});}function zr(t,e){let n=I.get(t);n?n.scrollDelta+=e:I.set(t,{dragDx:0,dragDy:0,scrollDelta:e});}function Ir(t,e,n={},r=5){let o=x.parse(n);i$1(t,e,b)||h$1(t,e,b),b.rotationSensitivity[e]=o.rotationSensitivity,b.zoomSensitivity[e]=o.zoomSensitivity,b.zoomMin[e]=o.zoomMin,b.zoomMax[e]=o.zoomMax,b.invertY[e]=o.invertY?1:0;let a=Math.max(o.zoomMin,Math.min(o.zoomMax,r));return b.distance[e]=a,b.yaw[e]=0,b.pitch[e]=0,e}function Fr(t,e){i$1(t,e,b)&&j$1(t,e,b);}function Pr(t,e){if(i$1(t,e,b))return {rotationSensitivity:b.rotationSensitivity[e],zoomSensitivity:b.zoomSensitivity[e],zoomMin:b.zoomMin[e],zoomMax:b.zoomMax[e],invertY:b.invertY[e]===1,distance:b.distance[e],yaw:b.yaw[e],pitch:b.pitch[e]}}var ce=z$1.object({name:z$1.string().min(1).describe("Name for the mesh in meshStore"),flipYZ:z$1.boolean().default(false).describe("Swap Y and Z axes (some models use Z-up)"),scale:z$1.number().positive().default(1).describe("Uniform scale factor"),centerOrigin:z$1.boolean().default(true).describe("Center model at origin")}),ue=z$1.object({size:z$1.number().positive().default(1).describe("Half-extent of cube"),name:z$1.string().default("cube")}),pe=z$1.object({radius:z$1.number().positive().default(1),widthSegments:z$1.number().int().min(3).max(128).default(16),heightSegments:z$1.number().int().min(2).max(64).default(12),name:z$1.string().default("sphere")}),le=z$1.object({width:z$1.number().positive().default(2),height:z$1.number().positive().default(2),widthSegments:z$1.number().int().min(1).max(128).default(1),heightSegments:z$1.number().int().min(1).max(128).default(1),name:z$1.string().default("plane")}),fe=z$1.object({radiusTop:z$1.number().nonnegative().default(1),radiusBottom:z$1.number().nonnegative().default(1),height:z$1.number().positive().default(2),segments:z$1.number().int().min(3).max(128).default(16),name:z$1.string().default("cylinder")}).refine(t=>t.radiusTop>0||t.radiusBottom>0,{message:"At least one radius must be positive"});function wr(t){return t.length<4?null:{x:Number.parseFloat(t[1]),y:Number.parseFloat(t[2]),z:Number.parseFloat(t[3])}}function tn(t){return t.length<3?null:{u:Number.parseFloat(t[1]),v:Number.parseFloat(t[2])}}function rn(t,e,n,r){let o=t.split("/"),a=Number.parseInt(o[0],10);a=a<0?e+a:a-1;let s={vi:a};if(o.length>=2&&o[1]!==""){let i=Number.parseInt(o[1],10);i=i<0?n+i:i-1,s.ti=i;}if(o.length>=3&&o[2]!==""){let i=Number.parseInt(o[2],10);i=i<0?r+i:i-1,s.ni=i;}return s}function nn(t,e,n,r){if(t.length<4)return null;let o=[],a=[],s=[],i=false,c=false;for(let p=1;p<t.length;p++){let m=rn(t[p],e,n,r);o.push(m.vi),m.ti!==void 0&&(s.push(m.ti),c=true),m.ni!==void 0&&(a.push(m.ni),i=true);}return {vertexIndices:o,...i?{normalIndices:a}:{},...c?{texCoordIndices:s}:{}}}function on(t,e){let n=t[0];if(n==="v"){let r=wr(t);r&&e.vertices.push(r);return}if(n==="vn"){let r=wr(t);r&&e.normals.push(r);return}if(n==="vt"){let r=tn(t);r&&e.texCoords.push(r);return}if(n==="f"){let r=nn(t,e.vertices.length,e.texCoords.length,e.normals.length);r&&e.faces.push(r);return}(n==="g"||n==="o")&&t.length>=2&&e.groups.push({name:t.slice(1).join(" "),startFace:e.faces.length});}function be(t){let e={vertices:[],normals:[],texCoords:[],faces:[],groups:[]},n=t.split(`
2
- `);for(let r of n){let o=r.trim();if(o.length===0||o.startsWith("#"))continue;let a=o.split(/\s+/);on(a,e);}return e}function ye(t){if(t.length===0)return {min:{x:0,y:0,z:0},max:{x:0,y:0,z:0},center:{x:0,y:0,z:0}};let e=1/0,n=1/0,r=1/0,o=-1/0,a=-1/0,s=-1/0;for(let i of t)i.x<e&&(e=i.x),i.y<n&&(n=i.y),i.z<r&&(r=i.z),i.x>o&&(o=i.x),i.y>a&&(a=i.y),i.z>s&&(s=i.z);return {min:{x:e,y:n,z:r},max:{x:o,y:a,z:s},center:{x:(e+o)/2,y:(n+a)/2,z:(r+s)/2}}}function Br(t,e){let n=ce.parse(e),r=be(t),o=[...r.vertices];if(n.flipYZ&&(o=o.map(s=>({x:s.x,y:s.z,z:s.y}))),n.scale!==1){let s=n.scale;o=o.map(i=>({x:i.x*s,y:i.y*s,z:i.z*s}));}if(n.centerOrigin&&o.length>0){let s=ye(o),i=s.center.x,c=s.center.y,p=s.center.z;o=o.map(m=>({x:m.x-i,y:m.y-c,z:m.z-p}));}let a=r.faces.map(s=>[...s.vertexIndices]);return I$1(n.name,o,a)}var an=0,sn=1,Er=2,Vr=4,jr=8;function L(t,e,n){let r=an;return t<n.xMin?r|=sn:t>n.xMax&&(r|=Er),e<n.yMin?r|=Vr:e>n.yMax&&(r|=jr),r}function mn(t,e,n,r,o,a){return t&jr?{x:e+r*(a.yMax-n)/o,y:a.yMax}:t&Vr?{x:e+r*(a.yMin-n)/o,y:a.yMin}:t&Er?{x:a.xMax,y:n+o*(a.xMax-e)/r}:{x:a.xMin,y:n+o*(a.xMin-e)/r}}function Tr(t,e,n,r,o){let a=t,s=e,i=n,c=r,p=L(a,s,o),m=L(i,c,o);for(;;){if((p|m)===0)return {x0:a,y0:s,x1:i,y1:c};if((p&m)!==0)return null;let u=p!==0?p:m,f=i-a,h=c-s,d=mn(u,a,s,f,h,o);u===p?(a=d.x,s=d.y,p=L(a,s,o)):(i=d.x,c=d.y,m=L(i,c,o));}}function kr(t){let e=t,n=[];return n.push(k(e[3]+e[0],e[7]+e[4],e[11]+e[8],e[15]+e[12])),n.push(k(e[3]-e[0],e[7]-e[4],e[11]-e[8],e[15]-e[12])),n.push(k(e[3]+e[1],e[7]+e[5],e[11]+e[9],e[15]+e[13])),n.push(k(e[3]-e[1],e[7]-e[5],e[11]-e[9],e[15]-e[13])),n.push(k(e[3]+e[2],e[7]+e[6],e[11]+e[10],e[15]+e[14])),n.push(k(e[3]-e[2],e[7]-e[6],e[11]-e[10],e[15]-e[14])),n}function k(t,e,n,r){let o=Math.sqrt(t*t+e*e+n*n);if(o===0)return {normal:ha(0,0,0),distance:0};let a=1/o;return {normal:ha(t*a,e*a,n*a),distance:r*a}}function Lr(t,e){for(let n of e)if(ma(n.normal,t)+n.distance<0)return false;return true}function Rr(t,e,n){for(let r of n)if(ma(r.normal,t)+r.distance<-e)return false;return true}function M(t,e,n,r,o,a,s,i){if(!_a(t,e,n)||i<=0)return;if(i>=1){bb(t,e,n,r,o,a,s);return}let c=$a(t,e,n),p=1-i,m=Math.round(c.r*p+r*i),u=Math.round(c.g*p+o*i),f=Math.round(c.b*p+a*i),h=Math.round(c.a*p+s*i);bb(t,e,n,m,u,f,h);}function Yr(t,e,n,r,o,a,s,i,c=255){let p=Math.abs(o-n)>Math.abs(r-e),m=e,u=n,f=r,h=o;p&&([m,u]=[u,m],[f,h]=[h,f]),m>f&&([m,f]=[f,m],[u,h]=[h,u]);let d=f-m,v=h-u,P=d===0?1:v/d,E=Math.round(m),S=u+P*(E-m),O=1-F(m+.5),Y=E,q=Math.floor(S);p?(M(t,q,Y,a,s,i,c,R(S)*O),M(t,q+1,Y,a,s,i,c,F(S)*O)):(M(t,Y,q,a,s,i,c,R(S)*O),M(t,Y,q+1,a,s,i,c,F(S)*O));let V=S+P;E=Math.round(f),S=h+P*(E-f),O=F(f+.5);let W=E,U=Math.floor(S);p?(M(t,U,W,a,s,i,c,R(S)*O),M(t,U+1,W,a,s,i,c,F(S)*O)):(M(t,W,U,a,s,i,c,R(S)*O),M(t,W,U+1,a,s,i,c,F(S)*O));for(let j=Y+1;j<W;j++){let _=Math.floor(V);p?(M(t,_,j,a,s,i,c,R(V)),M(t,_+1,j,a,s,i,c,F(V))):(M(t,j,_,a,s,i,c,R(V)),M(t,j,_+1,a,s,i,c,F(V))),V+=P;}}function F(t){return t-Math.floor(t)}function R(t){return 1-F(t)}function de(t,e,n){let r=ka(e,t),o=ka(n,t);return qa(na(r,o))}function he(t,e,n,r){let o=e.direction,a=e.intensity??1,s=n.intensity??.1,i=-(t[0]*o[0]+t[1]*o[1]+t[2]*o[2]),c=Math.max(0,i)*a,p=Math.min(1,s+c),m=e.color??{r:255,g:255,b:255},u=n.color??{r:255,g:255,b:255},f=(u.r*s+m.r*c)/Math.max(.001,p),h=(u.g*s+m.g*c)/Math.max(.001,p),d=(u.b*s+m.b*c)/Math.max(.001,p);return {r:Math.round(Math.min(255,r.r*p*f/255)),g:Math.round(Math.min(255,r.g*p*h/255)),b:Math.round(Math.min(255,r.b*p*d/255)),a:r.a}}function Wr(t,e,n,r,o,a){let s=de(t,e,n);return he(s,r,o,a)}function Nr(t){let e=ue.parse(t??{}),n=e.size,r=[{x:-n,y:-n,z:-n},{x:n,y:-n,z:-n},{x:n,y:n,z:-n},{x:-n,y:n,z:-n},{x:-n,y:-n,z:n},{x:n,y:-n,z:n},{x:n,y:n,z:n},{x:-n,y:n,z:n}],o=[[0,1,2,3],[5,4,7,6],[4,0,3,7],[1,5,6,2],[3,2,6,7],[4,5,1,0]];return I$1(e.name,r,o)}function Zr(t){let e=pe.parse(t??{}),{radius:n,widthSegments:r,heightSegments:o,name:a}=e,s=[],i=[];for(let c=0;c<=o;c++){let p=c*Math.PI/o,m=Math.sin(p),u=Math.cos(p);for(let f=0;f<=r;f++){let h=f*2*Math.PI/r,d=n*m*Math.cos(h),v=n*u,P=n*m*Math.sin(h);s.push({x:d,y:v,z:P});}}for(let c=0;c<o;c++)for(let p=0;p<r;p++){let m=c*(r+1)+p,u=m+r+1;c!==0&&i.push([m,u,m+1]),c!==o-1&&i.push([u,u+1,m+1]);}return I$1(a,s,i)}function Xr(t){let e=le.parse(t??{}),{width:n,height:r,widthSegments:o,heightSegments:a,name:s}=e,i=[],c=[],p=n/2,m=r/2;for(let f=0;f<=a;f++){let h=f/a*r-m;for(let d=0;d<=o;d++){let v=d/o*n-p;i.push({x:v,y:0,z:h});}}let u=o+1;for(let f=0;f<a;f++)for(let h=0;h<o;h++){let d=f*u+h,v=d+1,P=d+u+1,E=d+u;c.push([d,v,P,E]);}return I$1(s,i,c)}function Gr(t){let e=fe.parse(t??{}),{radiusTop:n,radiusBottom:r,height:o,segments:a,name:s}=e,i=[],c=[],p=o/2;for(let m=0;m<a;m++){let u=m/a*Math.PI*2;i.push({x:n*Math.cos(u),y:p,z:n*Math.sin(u)});}for(let m=0;m<a;m++){let u=m/a*Math.PI*2;i.push({x:r*Math.cos(u),y:-p,z:r*Math.sin(u)});}for(let m=0;m<a;m++){let u=(m+1)%a,f=m,h=u,d=m+a,v=u+a;c.push([f,h,v,d]);}if(n>0){let m=i.length;i.push({x:0,y:p,z:0});for(let u=0;u<a;u++){let f=(u+1)%a;c.push([m,u,f]);}}if(r>0){let m=i.length;i.push({x:0,y:-p,z:0});for(let u=0;u<a;u++){let f=(u+1)%a;c.push([m,f+a,u+a]);}}return I$1(s,i,c)}n$1();var Hr=t=>{let e=a$1();if(e<=0)return t;let n=k$2(t,[y,P]);for(let r of n){let o=false,a=y.rotateSpeedX[r],s=y.rotateSpeedY[r],i=y.rotateSpeedZ[r];a!==0&&(P.rx[r]=P.rx[r]+a*e,o=true),s!==0&&(P.ry[r]=P.ry[r]+s*e,o=true),i!==0&&(P.rz[r]=P.rz[r]+i*e,o=true);let c=y.orbitEnabled[r],p=y.orbitSpeed[r];if(c===1&&p!==0){let m=y.orbitRadius[r],u=y.orbitCenterX[r],f=y.orbitCenterY[r],h=y.orbitCenterZ[r],d=y.orbitAngle[r]+p*e;y.orbitAngle[r]=d,P.tx[r]=u+Math.cos(d)*m,P.ty[r]=f,P.tz[r]=h+Math.sin(d)*m,o=true;}o&&(P.dirty[r]=1);}return t};n$1();var qr=Math.PI/2-.01,Ur=t=>{let e=k$2(t,[Y]);for(let n of e){let r=I.get(n);if(!r)continue;let o=Y.cameraEntity[n];if(o===0||!i$1(t,o,b))continue;let a=b.rotationSensitivity[o];if(r.dragDx!==0||r.dragDy!==0){let m=b.invertY[o]===1?-1:1,u=r.dragDx*a,f=r.dragDy*a*m,h=b.yaw[o]+u,d=Math.max(-qr,Math.min(qr,b.pitch[o]+f));b.yaw[o]=h,b.pitch[o]=d;}if(r.scrollDelta!==0){let m=b.zoomSensitivity[o],u=b.zoomMin[o],f=b.zoomMax[o],h=b.distance[o],d=Math.max(u,Math.min(f,h+r.scrollDelta*m));b.distance[o]=d;}let s=b.yaw[o],i=b.pitch[o],c=b.distance[o],p=Math.cos(i);P.tx[o]=Math.sin(s)*p*c,P.ty[o]=Math.sin(i)*c,P.tz[o]=Math.cos(s)*p*c,P.rx[o]=-i,P.ry[o]=-s,P.rz[o]=0,P.dirty[o]=1;}return me(),t};n$1();function cn(t){let e=ha(P.tx[t],P.ty[t],P.tz[t]),n=ha(P.rx[t],P.ry[t],P.rz[t]),r=ha(P.sx[t],P.sy[t],P.sz[t]);return Ia(e,n,r)}function un(t,e){let n=t*16;for(let r=0;r<16;r++)P.worldMatrix[n+r]=e[r];}function _r(t,e,n){if(!i$1(t,e,P))return;let r=P.dirty[e]!==0;if(r){let s=cn(e),i=n?xa(n,s):s;un(e,i),P.dirty[e]=0;}let o=e*16,a=P.worldMatrix.subarray(o,o+16);if(i$1(t,e,o$1)){let s=s$1(t,e);for(let i of s)r&&i$1(t,i,P)&&(P.dirty[i]=1),_r(t,i,a);}}var Kr=t=>{let e=k$2(t,[P]),n=[];for(let r of e){if(!i$1(t,r,o$1)){n.push(r);continue}let o=o$1.parent[r];(o===n$2||!i$1(t,o,P))&&n.push(r);}for(let r of n)_r(t,r,null);return t};n$1();var pn=["braille","braille","halfblock","sextant","sixel","kitty"],G=new Map,H=new Map;function Jr(){G.clear();}function Qr(){H.clear();}function ln(t){let e=Y.backendType[t],n=pn[e]??"braille",r=G.get(t);if(r&&r.type===n)return r;let o=q(n);return G.set(t,o),o}var $r=t=>{H.clear();let e=k$2(t,[Y]);for(let n of e){let r=qb.get(n);if(!r)continue;let o=ln(n),a=Y.left[n],s=Y.top[n],i=o.encode(r,a,s);H.set(n,{viewportEid:n,screenX:a,screenY:s,backendType:o.type,encoded:i});}return t};export{de as A,he as B,Wr as C,Nr as D,Zr as E,Xr as F,Gr as G,Hr as H,Ur as I,Kr as J,G as K,H as L,Jr as M,Qr as N,$r as O,fn as P,y as a,vr as b,Or as c,b as d,I as e,me as f,Ar as g,zr as h,Ir as i,Fr as j,Pr as k,ce as l,ue as m,pe as n,le as o,fe as p,be as q,ye as r,Br as s,L as t,Tr as u,kr as v,Lr as w,Rr as x,M as y,Yr as z};