blecsd 0.6.0 → 0.6.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (78) hide show
  1. package/README.md +50 -28
  2. package/dist/blend-BZDmQFAm.d.ts +1215 -0
  3. package/dist/chunk-3PGACJB6.js +1 -0
  4. package/dist/chunk-4XW4WIPH.js +1 -0
  5. package/dist/chunk-7CLV3LTZ.js +4 -0
  6. package/dist/chunk-APPZ3YHO.js +0 -0
  7. package/dist/chunk-EKE2BXPS.js +1 -0
  8. package/dist/chunk-ESMSDY3P.js +1 -0
  9. package/dist/chunk-FJLSHFCF.js +1 -0
  10. package/dist/chunk-GIMWA5WA.js +1 -0
  11. package/dist/chunk-IXUFU6TE.js +3 -0
  12. package/dist/chunk-JB5KFQPD.js +1 -0
  13. package/dist/chunk-JCLNGU3K.js +1 -0
  14. package/dist/chunk-JRRJCATR.js +1 -0
  15. package/dist/{chunk-UKVY43V3.js → chunk-JWIVZCKW.js} +1 -1
  16. package/dist/chunk-K5UMVDQX.js +1 -0
  17. package/dist/chunk-L4FIDOS6.js +1 -0
  18. package/dist/chunk-LIVVHEOU.js +1 -0
  19. package/dist/chunk-M5FXA5FL.js +1 -0
  20. package/dist/{chunk-XH5GTWCV.js → chunk-MEJJLDEQ.js} +1 -1
  21. package/dist/chunk-NYIMY4UV.js +1 -0
  22. package/dist/chunk-PQZTNWLA.js +1 -0
  23. package/dist/chunk-SXOBHRXF.js +2 -0
  24. package/dist/chunk-T2EQLWMN.js +1 -0
  25. package/dist/chunk-T62UPG63.js +4 -0
  26. package/dist/chunk-TPBILYDM.js +10 -0
  27. package/dist/chunk-UWS6FIU5.js +1 -0
  28. package/dist/{chunk-4N7IFBRQ.js → chunk-W64J7C25.js} +1 -1
  29. package/dist/chunk-W6RELN6A.js +1 -0
  30. package/dist/chunk-ZAJI53SZ.js +1 -0
  31. package/dist/components/index.d.ts +3 -318
  32. package/dist/components/index.js +5 -5
  33. package/dist/core/index.d.ts +6 -251
  34. package/dist/core/index.js +1 -1
  35. package/dist/debug/index.js +7 -7
  36. package/dist/{dirtyTracking-kCS9-NVF.d.ts → dirtyTracking-D0SQrEeo.d.ts} +1 -1
  37. package/dist/{doubleBuffer-CWASihKh.d.ts → doubleBuffer-d9yVNtj1.d.ts} +21 -1
  38. package/dist/{mouseParser-CCqSEUVN.d.ts → events-CGqK6LGt.d.ts} +1 -176
  39. package/dist/index.d.ts +10 -9
  40. package/dist/index.js +1 -1
  41. package/dist/{inputStream-COARA4CP.d.ts → inputStream-BoFAEJ7g.d.ts} +205 -2
  42. package/dist/{interactiveSystem-h92W9W4n.d.ts → interactiveSystem-Dtv3xERg.d.ts} +316 -1
  43. package/dist/mouseParser-CTNGolIA.d.ts +177 -0
  44. package/dist/{panelMovement-DGzIQ8Ll.d.ts → panelMovement-DSLYdNOL.d.ts} +5 -4
  45. package/dist/style/index.d.ts +851 -0
  46. package/dist/style/index.js +1 -0
  47. package/dist/styleInheritance-CuRb5Dmp.d.ts +251 -0
  48. package/dist/systems/index.d.ts +6 -5
  49. package/dist/systems/index.js +1 -1
  50. package/dist/terminal/index.d.ts +201 -1295
  51. package/dist/terminal/index.js +1 -1
  52. package/dist/testing/index.d.ts +923 -0
  53. package/dist/testing/index.js +7 -0
  54. package/dist/text/index.js +1 -1
  55. package/dist/{textWrap-Ct2J8gO6.d.ts → textWrap-sY-PZzE7.d.ts} +1 -1
  56. package/dist/utils/index.d.ts +2 -2
  57. package/dist/widgets/bigText.js +1 -1
  58. package/dist/widgets/fonts/index.js +1 -1
  59. package/dist/widgets/index.js +18 -18
  60. package/package.json +16 -2
  61. package/dist/chunk-5YWRP2KG.js +0 -3
  62. package/dist/chunk-73Y45MLV.js +0 -12
  63. package/dist/chunk-A3GSH6MV.js +0 -1
  64. package/dist/chunk-A5B2BGUM.js +0 -1
  65. package/dist/chunk-EMZA6G2M.js +0 -4
  66. package/dist/chunk-ETFDYZVJ.js +0 -1
  67. package/dist/chunk-IANAVH2A.js +0 -1
  68. package/dist/chunk-JVMNMAHX.js +0 -1
  69. package/dist/chunk-K2QWNDXV.js +0 -1
  70. package/dist/chunk-LI3ZYXUT.js +0 -1
  71. package/dist/chunk-QABNK7IA.js +0 -1
  72. package/dist/chunk-QTDRFJG2.js +0 -1
  73. package/dist/chunk-SVHITP3F.js +0 -2
  74. package/dist/chunk-VIT4KE6Q.js +0 -1
  75. package/dist/chunk-XG5PVDOP.js +0 -1
  76. package/dist/chunk-YRSSCEAS.js +0 -1
  77. package/dist/chunk-ZL46COQF.js +0 -1
  78. /package/dist/{chunk-4XCFTNGN.js → chunk-4EV3YS7F.js} +0 -0
@@ -1,4 +0,0 @@
1
- import {i as i$1,b as b$1,c as c$3,d as d$2}from'./chunk-XH5GTWCV.js';import {a as a$3}from'./chunk-VIT4KE6Q.js';import {a}from'./chunk-5N3O25O7.js';import {c,a as a$2}from'./chunk-ZL46COQF.js';import {f,v,d as d$3}from'./chunk-LI3ZYXUT.js';import {m as m$1}from'./chunk-RJULLVTH.js';import {g,b as b$2,c as c$2,h as h$2,i as i$4,j as j$1}from'./chunk-UKVY43V3.js';import {u,c as c$1,i as i$3}from'./chunk-K2QWNDXV.js';import {o,k,p}from'./chunk-EOFT3PNU.js';import {d as d$1,l as l$1,f as f$3}from'./chunk-JN2OGNK3.js';import {Ea as Ea$1,Da as Da$1,Ca as Ca$1,ba as ba$1,a as a$1,i,Ga as Ga$1,b,fa as fa$1,Ba as Ba$1,d,f as f$1,e,sa as sa$1,ka as ka$1,M,na as na$1,I,$,ea as ea$1,R as R$1,G,k as k$2,g as g$1}from'./chunk-ETFDYZVJ.js';import {b as b$3,f as f$4}from'./chunk-NPDPBAW6.js';import {m,i as i$2,o as o$1,k as k$1,f as f$2,l,j,h as h$1}from'./chunk-7ZFQO3OQ.js';import {z}from'zod';function Nt(e){if(!d$3(e))return {width:80,height:24};let t=f(e);return !t||!fa$1(e,t)?{width:80,height:24}:{width:$.width[t],height:$.height[t]}}function jn(e,t,n){Ea$1(e,t,true);let r=Da$1(e,t)?.y??0;return Ca$1(e,t,n,r),t}function Gn(e,t,n){let o=Nt(e),i=ba$1(e,t)?.width??0;Ea$1(e,t,true);let a=o.width-n-i,l=Da$1(e,t)?.y??0;return Ca$1(e,t,a,l),t}function Yn(e,t,n){Ea$1(e,t,true);let r=Da$1(e,t)?.x??0;return Ca$1(e,t,r,n),t}function Jn(e,t,n){let o=Nt(e),i=ba$1(e,t)?.height??0;Ea$1(e,t,true);let a=o.height-n-i,l=Da$1(e,t)?.x??0;return Ca$1(e,t,l,a),t}function ti(e,t,n){let{left:o,right:r,top:i,bottom:a}=n;return Ea$1(e,t,true),o!==void 0?jn(e,t,o):r!==void 0&&Gn(e,t,r),i!==void 0?Yn(e,t,i):a!==void 0&&Jn(e,t,a),t}function ni(e,t){let n=Da$1(e,t);if(!n||!n.absolute)return;let o=ba$1(e,t),r=o?.width??0,i=o?.height??0,a=Nt(e),s=n.x,l=a.width-s-r,c=n.y,p=a.height-c-i;return {left:s,right:l,top:c,bottom:p}}function Zn(e){let t=f(e);return t?v(e,t):false}function Ut(e,t){let n={left:0,top:0,right:0,bottom:0};return !Zn(e)||!o(e,t)||k.type[t]===0?n:{left:k.left[t]===1?1:0,top:k.top[t]===1?1:0,right:k.right[t]===1?1:0,bottom:k.bottom[t]===1?1:0}}function $n(e,t){let n=g(e,t),o=n?.left??0,r=n?.top??0,i=n?.right??0,a=n?.bottom??0,s=Ut(e,t),l=o+s.left,c=r+s.top,p=i+s.right,u=a+s.bottom;return {left:l,top:c,right:p,bottom:u,horizontal:l+p,vertical:c+u}}function ri(e,t){let n=$n(e,t);return n.left+n.top+n.right+n.bottom}function ii(e,t){let n=Ut(e,t);return n.left>0||n.top>0||n.right>0||n.bottom>0}var _t={teeRight:9500,teeLeft:9508,teeDown:9516,teeUp:9524,cross:9532,horizontal:9472,vertical:9474},Xn={teeRight:9568,teeLeft:9571,teeDown:9574,teeUp:9577,cross:9580,horizontal:9552,vertical:9553},qn={teeRight:9507,teeLeft:9515,teeDown:9523,teeUp:9531,cross:9547,horizontal:9473,vertical:9475},Qn={teeRight:43,teeLeft:43,teeDown:43,teeUp:43,cross:43,horizontal:45,vertical:124};function ai(e,t,n={}){return {width:e,height:t,edges:new Map,enabled:n.enabled??true}}function si(e){e.edges.clear();}function li(e,t,n){return {...e,width:t,height:n}}function Se(e,t){return `${e},${t}`}function eo(e){let[t,n]=e.split(",");return {x:Number.parseInt(t??"0",10),y:Number.parseInt(n??"0",10)}}function zt(e){return e===9472||e===9474||e===9484||e===9488||e===9492||e===9496||e===9500||e===9508||e===9516||e===9524||e===9532?"single":e===9552||e===9553||e===9556||e===9559||e===9562||e===9565||e===9568||e===9571||e===9574||e===9577||e===9580?"double":e===9473||e===9475||e===9487||e===9491||e===9495||e===9499||e===9507||e===9515||e===9523||e===9531||e===9547?"bold":e===45||e===124||e===43?"ascii":"unknown"}function Ht(e){switch(e){case "single":return _t;case "double":return Xn;case "bold":return qn;case "ascii":return Qn;default:return _t}}function Q(e,t,n,o,r,i,a){let s=Se(t,n),l={x:t,y:n,type:o,char:r,fg:i,bg:a,style:zt(r)},c=e.edges.get(s);c?c.push(l):e.edges.set(s,[l]);}function ui(e,t,n,o,r,i,a,s,l){for(let c=1;c<o-1;c++)Q(e,t+c,n,"h",i,s,l);for(let c=1;c<o-1;c++)Q(e,t+c,n+r-1,"h",i,s,l);for(let c=1;c<r-1;c++)Q(e,t,n+c,"v",a,s,l);for(let c=1;c<r-1;c++)Q(e,t+o-1,n+c,"v",a,s,l);Q(e,t,n,"c",0,s,l),Q(e,t+o-1,n,"c",0,s,l),Q(e,t,n+r-1,"c",0,s,l),Q(e,t+o-1,n+r-1,"c",0,s,l);}function Vt(e,t,n){let o=e.edges.get(Se(t-1,n)),r=e.edges.get(Se(t+1,n)),i=e.edges.get(Se(t,n-1)),a=e.edges.get(Se(t,n+1));return {left:o?.some(s=>s.type==="h"||s.type==="c")??false,right:r?.some(s=>s.type==="h"||s.type==="c")??false,top:i?.some(s=>s.type==="v"||s.type==="c")??false,bottom:a?.some(s=>s.type==="v"||s.type==="c")??false}}function jt(e,t){let{left:n,top:o,right:r,bottom:i}=e;return (n?1:0)+(o?1:0)+(r?1:0)+(i?1:0)<3?null:n&&o&&r&&i?t.cross:n&&o&&i?t.teeLeft:r&&o&&i?t.teeRight:n&&r&&i?t.teeDown:n&&r&&o?t.teeUp:null}function ci(e){if(!e.enabled)return [];let t=[],n=new Set;for(let[o,r]of e.edges){if(n.has(o)||(n.add(o),r.length<2))continue;let{x:i,y:a}=eo(o),s=Vt(e,i,a),l=r[0];if(!l)continue;let c=Ht(l.style),p=jt(s,c);p!==null&&t.push({x:i,y:a,char:p,fg:l.fg,bg:l.bg});}return t}function di(e,t){let n=t.some(r=>r.type==="h"),o=t.some(r=>r.type==="v");return {left:e.left||n,right:e.right||n,top:e.top||o,bottom:e.bottom||o}}function fi(e,t,n,o){if(!e.some(l=>l.type==="c")||e.length<=1)return null;let i=e[0];if(!i)return null;let a=Ht(i.style),s=jt(t,a);return s===null?null:{x:n,y:o,char:s,fg:i.fg,bg:i.bg}}function pi(e){if(!e.enabled)return [];let t=[],n=new Set;for(let[o,r]of e.edges){if(n.has(o))continue;n.add(o);let{x:i,y:a}=eo(o),s=Vt(e,i,a),l=di(s,r),c=fi(r,l,i,a);c&&t.push(c);}return t}function mi(e,t){for(let n of t)n.x>=0&&n.x<e.width&&n.y>=0&&n.y<e.height&&e.setCell(n.x,n.y,{char:String.fromCodePoint(n.char),fg:n.fg,bg:n.bg});}function yi(e){return e.map(t=>({x:t.x,y:t.y,char:String.fromCodePoint(t.char),fg:t.fg,bg:t.bg}))}function gi(e){return zt(e)!=="unknown"}function bi(e){return e>=9500&&e<=9532||e>=9568&&e<=9580||e>=9507&&e<=9547||e===43}function hi(e){return e.edges.size}function vi(e,t,n){return e.edges.get(Se(t,n))??[]}var it=1e4,se={HIDDEN:0,VISIBLE:1,SCROLL:2},T={overflow:new Uint8Array(it),overflowX:new Uint8Array(it),overflowY:new Uint8Array(it),hasIndependentOverflow:new Uint8Array(it)};function Ei(e,t){m(e,t,T)||(l(e,t,T),T.overflow[t]=se.HIDDEN,T.overflowX[t]=se.HIDDEN,T.overflowY[t]=se.HIDDEN,T.hasIndependentOverflow[t]=0);}function xi(e,t){return m(e,t,T)}function Si(e,t,n){return Ei(e,t),typeof n=="number"?(T.overflow[t]=n,T.overflowX[t]=n,T.overflowY[t]=n,T.hasIndependentOverflow[t]=0):(n.overflow!==void 0&&(T.overflow[t]=n.overflow,T.overflowX[t]=n.overflow,T.overflowY[t]=n.overflow),n.overflowX!==void 0&&(T.overflowX[t]=n.overflowX,T.hasIndependentOverflow[t]=1),n.overflowY!==void 0&&(T.overflowY[t]=n.overflowY,T.hasIndependentOverflow[t]=1)),t}function at(e,t){return m(e,t,T)?T.overflow[t]:se.HIDDEN}function Ci(e,t){if(m(e,t,T))return {overflow:T.overflow[t],overflowX:T.overflowX[t],overflowY:T.overflowY[t]}}function Di(e,t,n,o){return {x1:e,y1:t,x2:e+n,y2:t+o}}function ze(){return {x1:-1/0,y1:-1/0,x2:1/0,y2:1/0}}function Ti(e){return e.x1>=e.x2||e.y1>=e.y2}function Pi(e,t,n){return t>=e.x1&&t<e.x2&&n>=e.y1&&n<e.y2}function ki(e,t,n,o,r){return t<e.x2&&t+o>e.x1&&n<e.y2&&n+r>e.y1}function st(e,t){return {x1:Math.max(e.x1,t.x1),y1:Math.max(e.y1,t.y1),x2:Math.min(e.x2,t.x2),y2:Math.min(e.y2,t.y2)}}function Ai(e,t,n){return {x:Math.max(e.x1,Math.min(e.x2-1,t)),y:Math.max(e.y1,Math.min(e.y2-1,n))}}function Ii(e){return e.x2-e.x1}function Ri(e){return e.y2-e.y1}function Bi(e,t){return p(e,t)?{top:k.top[t]===1?1:0,right:k.right[t]===1?1:0,bottom:k.bottom[t]===1?1:0,left:k.left[t]===1?1:0}:{top:0,right:0,bottom:0,left:0}}function to(e,t){if(!c(e,t))return null;let n=a$2.x[t],o=a$2.y[t],r=a$2.width[t],i=a$2.height[t],a=Bi(e,t);return {x1:n+a.left,y1:o+a.top,x2:n+r-a.right,y2:o+i-a.bottom}}function Wi(e,t){let n=ze(),o=t;for(;o!==a$1;){if(at(e,o)!==se.VISIBLE){let a=to(e,o);a&&(n=st(n,a));}o=i(e,o)??a$1;}return n}function Mi(e,t,n){let o=ze(),r=t;for(;r!==a$1&&r!==n;){if(at(e,r)!==se.VISIBLE){let s=to(e,r);s&&(o=st(o,s));}r=i(e,r)??a$1;}return o}function wi(e,t){return at(e,t)!==se.VISIBLE}function Li(){return {stack:[],current:ze()}}function Fi(e,t){let n=[...e.stack,e.current],o=st(e.current,t);return {stack:n,current:o}}function Oi(e){if(e.stack.length===0)return e;let t=e.stack.slice(0,-1),n=e.stack[e.stack.length-1];return {stack:t,current:n??ze()}}function Ki(e){return e.current}function Gt(e,t){return o(e,t)?k.type[t]===0?0:1:0}function Yt(e,t){if(!fa$1(e,t))return {width:0,height:0};let n=ba$1(e,t);return {width:n?.width??0,height:n?.height??0}}function Ni(e,t){let n=Gt(e,t),o=n,r=g(e,t);return r&&(n+=r.left,o+=r.top),{x:n,y:o}}function no(e,t){let n=0,o=0;if(!m(e,t,b))return {x:n,y:o};let r=i(e,t);for(;r!==a$1;){if(!Ga$1(e,r)){r=i(e,r);continue}let i$1=Da$1(e,r);if(!i$1){r=i(e,r);continue}n+=i$1.x,o+=i$1.y;let a=Ni(e,r);if(n+=a.x,o+=a.y,i$1.absolute)break;r=i(e,r);}return {x:n,y:o}}function lt(e,t){if(!Ga$1(e,t))return;let n=Da$1(e,t);if(!n)return;let o=Yt(e,t);if(n.absolute)return {left:n.x,top:n.y,right:n.x+o.width-1,bottom:n.y+o.height-1};let r=no(e,t),i=n.x+r.x,a=n.y+r.y;return {left:i,top:a,right:i+o.width-1,bottom:a+o.height-1}}function oo(e,t){if(!Ga$1(e,t))return;let n=Da$1(e,t);if(!n)return;let o=Yt(e,t),r=0,i$1=0;if(m(e,t,b)){let a=i(e,t);if(a!==a$1){let s=ut(e,a);s&&(r=s.width,i$1=s.height);}}return {left:n.x,top:n.y,right:Math.max(0,r-n.x-o.width),bottom:Math.max(0,i$1-n.y-o.height)}}function Jt(e,t){let n=lt(e,t);if(!n)return;let o=Gt(e,t),r=g(e,t),i=r?.left??0,a=r?.top??0,s=r?.right??0,l=r?.bottom??0;return {left:n.left+o+i,top:n.top+o+a,right:n.right-o-s,bottom:n.bottom-o-l}}function ut(e,t){if(!fa$1(e,t))return;let n=ba$1(e,t);if(!n)return;let o=Gt(e,t),r=g(e,t),i=(r?.left??0)+(r?.right??0),a=(r?.top??0)+(r?.bottom??0);return {width:Math.max(0,n.width-o*2-i),height:Math.max(0,n.height-o*2-a)}}function ro(e,t){let n=g(e,t),o=n?.left??0,r=n?.right??0,i=n?.top??0,a=n?.bottom??0;return {horizontal:o+r,vertical:i+a,total:o+r+i+a}}function Ui(e,t,n,o){let r=no(e,t),i=n-r.x,a=o-r.y;return Ba$1.x[t]=i,Ba$1.y[t]=a,t}function _i(e,t,n){let o=Yt(e,t),r=0,i$1=0;if(m(e,t,b)){let l=i(e,t);if(l!==a$1){let c=ut(e,l);c&&(r=c.width,i$1=c.height);}}let a;n.left!==void 0?a=n.left:n.right!==void 0?a=r-o.width-n.right:a=Ba$1.x[t];let s;return n.top!==void 0?s=n.top:n.bottom!==void 0?s=i$1-o.height-n.bottom:s=Ba$1.y[t],Ba$1.x[t]=a,Ba$1.y[t]=s,t}function zi(e,t){let n=lt(e,t);if(!n)return;let o=oo(e,t);if(!o)return;let r=Jt(e,t);if(!r)return;let i=ut(e,t)??{width:0,height:0},a=ro(e,t);return {absolute:n,relative:o,inner:r,innerDimensions:i,totalPadding:a}}function Zt(e,t,n,o){let r=lt(e,t);return r?n>=r.left&&n<=r.right&&o>=r.top&&o<=r.bottom:false}function Hi(e,t,n,o){let r=Jt(e,t);return r?n>=r.left&&n<=r.right&&o>=r.top&&o<=r.bottom:false}var $t=new Map,Xt=new Map;function io(e,t){return `${e}:${t}`}function Vi(e,t){$t.set(e,t);}function ct(e,t,n){Xt.set(io(e,t),n);}function ao(e){return typeof e=="function"}function ji(e){return ao(e)?e():e}function qt(e,t={},n=[]){return {type:e,config:t,children:n}}function Gi(e,t,n,o=[]){return {type:e,config:t,children:o,ref:n}}function Yi(e={},t=[]){return qt("box",{...e,layout:"vertical"},t)}function Ji(e={},t=[]){return qt("box",{...e,layout:"horizontal"},t)}function Zi(e,t,n){let o=[],r=[];so(e,t,n,o,r);let i=o[0];if(i===void 0)throw new Error(`Failed to mount widget of type '${t.type}': no entity created`);return {root:i,entities:[...o],dispose:()=>{for(let a of r)a.dispose();r.length=0;}}}function so(e,t,n,o,r){let i=$t.get(t.type);if(!i)throw new Error(`No factory registered for widget type '${t.type}'. Call registerWidgetFactory() first.`);let a={};for(let[l,c]of Object.entries(t.config))a[l]=ji(c);let s=i(e,a);o.push(s),n!==void 0&&d(e,n,s);for(let[l,c]of Object.entries(t.config)){if(!ao(c))continue;let p=Xt.get(io(t.type,l));if(!p)continue;let u=c,f=i$1(()=>{let m=u();p(e,s,m);});r.push(f);}t.ref&&t.ref(s);for(let l of t.children)so(e,l,s,o,r);return s}function $i(e){e.dispose();}function Xi(e,t,n,o){return i$1(()=>{let r=n();o(e,t,r);})}function qi(e){let t=["box","text","gauge","list","progressbar"];for(let n of t)ct(n,"content",e.setContent),ct(n,"width",e.setWidth),ct(n,"height",e.setHeight);}function Qi(){$t.clear(),Xt.clear();}function uo(e,t){let n=e*t,o=Math.ceil(n/8);return {width:e,height:t,dirtyCells:new Uint8Array(o),dirtyEntities:new Set,entityBounds:m$1({iterable:true}),dirtyRegions:[],regionsStale:true,forceFullRedraw:true,frameCount:0}}function ea(e,t,n){let o=uo(t,n);return e.entityBounds.forEach((r,i)=>{r.prevX<t&&r.prevY<n&&o.entityBounds.set(i,{...r});}),o.forceFullRedraw=true,o}function ta(e,t,n){if(t<0||t>=e.width||n<0||n>=e.height)return;let o=n*e.width+t,r=o>>3,i=o&7,a=e.dirtyCells[r];a!==void 0&&(e.dirtyCells[r]=a|1<<i),e.regionsStale=true;}function na(e,t,n){if(t<0||t>=e.width||n<0||n>=e.height)return false;let o=n*e.width+t,r=o>>3,i=o&7,a=e.dirtyCells[r];return a===void 0?false:(a&1<<i)!==0}function dt(e,t,n,o,r){let i=Math.max(0,Math.floor(t)),a=Math.max(0,Math.floor(n)),s=Math.min(e.width,Math.floor(t+o)),l=Math.min(e.height,Math.floor(n+r));if(!(s<=i||l<=a)){for(let c=a;c<l;c++)for(let p=i;p<s;p++){let u=c*e.width+p,f=u>>3,m=u&7,D=e.dirtyCells[f];D!==void 0&&(e.dirtyCells[f]=D|1<<m);}e.regionsStale=true;}}function co(e,t,n){if(e.dirtyEntities.add(n),!c(t,n))return;let o=a$2.x[n],r=a$2.y[n],i=a$2.width[n],a=a$2.height[n],s=e.entityBounds.get(n);s&&(s.prevX!==o||s.prevY!==r||s.prevWidth!==i||s.prevHeight!==a)&&dt(e,s.prevX,s.prevY,s.prevWidth,s.prevHeight),dt(e,o,r,i,a),e.regionsStale=true;}function oa(e,t,n,o){if(!c(t,n)){e.entityBounds.delete(n);return}let r={prevX:a$2.x[n],prevY:a$2.y[n],prevWidth:a$2.width[n],prevHeight:a$2.height[n],wasVisible:o};e.entityBounds.set(n,r);}function ra(e,t){let n=e.entityBounds.get(t);n?.wasVisible&&dt(e,n.prevX,n.prevY,n.prevWidth,n.prevHeight),e.dirtyEntities.delete(t),e.entityBounds.delete(t);}function ia(e,t){return e.dirtyEntities.has(t)}function ft(e,t,n){let o=t*n+e;return {byteIndex:o>>3,bitIndex:o&7}}function lo(e,t,n){let o=e[t];if(o!==void 0)return (o&1<<n)!==0}function aa(e,t,n){let o=e[t];o!==void 0&&(e[t]=o|1<<n);}function Qt(e,t,n,o){let r=lo(e,n,o),i=lo(t,n,o);return r===void 0||i===void 0?false:r&&!i}function sa(e){if(e.forceFullRedraw)return [{x:0,y:0,width:e.width,height:e.height}];let t=[],n=new Uint8Array(e.dirtyCells.length);for(let o=0;o<e.height;o++)for(let r=0;r<e.width;r++){let{byteIndex:i,bitIndex:a}=ft(r,o,e.width);if(Qt(e.dirtyCells,n,i,a)){let s=da(e,n,r,o);s.width>0&&s.height>0&&t.push(s);}}return pa(t)}function la(e,t,n,o,r,i){let a=n;for(;a<i;){let{byteIndex:s,bitIndex:l}=ft(a,o,r);if(!Qt(e,t,s,l))break;a++;}return a}function ua(e,t,n,o,r,i){for(let a=n;a<o;a++){let{byteIndex:s,bitIndex:l}=ft(a,r,i);if(!Qt(e,t,s,l))return false}return true}function ca(e,t,n,o,r,i){for(let a=n;a<r;a++)for(let s=t;s<o;s++){let{byteIndex:l,bitIndex:c}=ft(s,a,i);aa(e,l,c);}}function da(e,t,n,o){let r=la(e.dirtyCells,t,n,o,e.width,e.width),i=r-n;if(i===0)return {x:n,y:o,width:0,height:0};let a=o;for(;a<e.height&&ua(e.dirtyCells,t,n,r,a,e.width);)a++;return ca(t,n,o,r,a,e.width),{x:n,y:o,width:i,height:a-o}}function fa(e,t,n,o){let r=e,i=false;for(let a=o;a<t.length;a++){if(n.has(a))continue;let s=t[a];s&&ma(r,s)&&(r=ya(r,s),n.add(a),i=true);}return {merged:r,didMerge:i}}function pa(e){if(e.length<2)return e;let t=[...e].sort((r,i)=>i.width*i.height-r.width*r.height),n=[],o=new Set;for(let r=0;r<t.length;r++){if(o.has(r))continue;let i=t[r];if(!i)continue;o.add(r);let a=true;for(;a;){let s=fa(i,t,o,r+1);i=s.merged,a=s.didMerge;}n.push(i);}return n}function ma(e,t){let n=e.x+e.width,o=e.y+e.height,r=t.x+t.width,i=t.y+t.height;return !(t.x>n+1||r<e.x-1||t.y>o+1||i<e.y-1)}function ya(e,t){let n=Math.min(e.x,t.x),o=Math.min(e.y,t.y),r=Math.max(e.x+e.width,t.x+t.width),i=Math.max(e.y+e.height,t.y+t.height);return {x:n,y:o,width:r-n,height:i-o}}function pt(e){return e.regionsStale&&(e.dirtyRegions.length=0,e.dirtyRegions.push(...sa(e)),e.regionsStale=false),e.dirtyRegions}function ga(e){return e.forceFullRedraw?true:e.dirtyEntities.size>0}function ba(e){return e.forceFullRedraw}function ha(e){return e.dirtyEntities}function va(e){let t=pt(e),n=e.width*e.height,o=0;for(let r of t)o+=r.width*r.height;return {dirtyEntityCount:e.dirtyEntities.size,dirtyRegionCount:t.length,dirtyArea:o,dirtyPercent:n>0?o/n*100:0,fullRedraw:e.forceFullRedraw,trackedEntityCount:e.entityBounds.size}}function Ea(e){e.dirtyCells.fill(0),e.dirtyEntities.clear(),e.dirtyRegions.length=0,e.regionsStale=true,e.forceFullRedraw=false,e.frameCount++;}function xa(e){e.forceFullRedraw=true,e.regionsStale=true;}function Sa(e,t){e.entityBounds.forEach((n,o)=>{co(e,t,o);});}function Ca(e,t,n,o,r){if(e.forceFullRedraw)return true;let i=pt(e);for(let a of i)if(t<a.x+a.width&&t+o>a.x&&n<a.y+a.height&&n+r>a.y)return true;return false}function Da(e,t,n,o,r){let i=pt(e),a=[];for(let s of i){let l=Math.max(s.x,t),c=Math.max(s.y,n),p=Math.min(s.x+s.width,t+o),u=Math.min(s.y+s.height,n+r);p>l&&u>c&&a.push({x:l,y:c,width:p-l,height:u-c});}return a}var mt=new Map;function ee(e,t){let n=mt.get(e);return n||(n=t(),mt.set(e,n)),n}function en(e){mt.delete(e);}function Ta(){mt.clear();}function Pa(e,t,n,o){e.emit("reparent",{entity:t,oldParent:n,newParent:o});}function ka(e,t,n){e.emit("adopt",{parent:t,child:n});}function Aa(e,t,n){e.emit("attach",{entity:t,screen:n});}function Ia(e,t,n){e.emit("detach",{entity:t,screen:n});}function Ra(e,t,n){e.emit("remove",{parent:t,child:n});}function tn(e,t){e.emit("destroy",{entity:t});}function Ba(e,t,n){return ee(e,n).on("reparent",t)}function Wa(e,t,n){return ee(e,n).on("adopt",t)}function Ma(e,t,n){return ee(e,n).on("attach",t)}function wa(e,t,n){return ee(e,n).on("detach",t)}function La(e,t,n){return ee(e,n).on("remove",t)}function Fa(e,t,n){return ee(e,n).on("destroy",t)}var te=new Set,nn=new WeakMap,Ce=[];function yt(e){let t=nn.get(e);return t||(t=new Set,nn.set(e,t)),t}function Oa(e){return Ce.push(e),()=>{let t=Ce.indexOf(e);t!==-1&&Ce.splice(t,1);}}function fo(){Ce.length=0;}function po(e,t,n={}){let{immediate:o=false,destroyChildren:r=true,emitEvent:i=true}=n;if(o)on(e,t,r,i);else {let a=yt(e);if(a.add(t),te.add(t),r&&m(e,t,b)){let s=f$1(e,t);for(let l of s)a.add(l),te.add(l);}}}function Ka(e,t,n={}){if(!m(e,t,b))return;let o=f$1(e,t);for(let r of o)po(e,r,n);}function Na(e){return te.has(e)}function Ua(e){let t=yt(e),n=t.size;if(n===0)return 0;let o=Array.from(t);o.sort((r,i)=>{let a=m(e,r,b)?b.depth[r]??0:0;return (m(e,i,b)?b.depth[i]??0:0)-a});for(let r of o)te.has(r)&&on(e,r,false,true);return t.clear(),n}function on(e$1,t,n,o){if(te.delete(t),o)try{let r=ee(t,()=>a$3());tn(r,t);}catch{}if(n&&m(e$1,t,b)){let r=f$1(e$1,t);for(let i of r)on(e$1,i,true,o);}if(m(e$1,t,b)){let r=i(e$1,t);r!==a$1&&e(e$1,r,t);}for(let r of Ce)try{r(e$1,t);}catch{}en(t);try{i$2(e$1,t);}catch{}}function _a(e){yt(e).clear(),te.clear(),fo();}function za(e){return e?nn.get(e)?.size??0:te.size}function Ha(e){let t=yt(e);for(let n of t)te.delete(n);t.clear();}function Va(){te.clear(),Ce.length=0;}var U=new Map;function De(e,t,n){return typeof n=="function"?n(e,t):n}function Te(e,t,n){let o={};return n.fg!==void 0&&(o.fg=De(e,t,n.fg)),n.bg!==void 0&&(o.bg=De(e,t,n.bg)),n.bold!==void 0&&(o.bold=De(e,t,n.bold)),n.underline!==void 0&&(o.underline=De(e,t,n.underline)),n.blink!==void 0&&(o.blink=De(e,t,n.blink)),n.inverse!==void 0&&(o.inverse=De(e,t,n.inverse)),o}function ja(e,t){return R$1(e,t)?{fg:I.fg[t],bg:I.bg[t],bold:I.bold[t]===1,underline:I.underline[t]===1,blink:I.blink[t]===1,inverse:I.inverse[t]===1,transparent:I.transparent[t]===1,opacity:I.opacity[t]??1}:{fg:I.fg[t],bg:I.bg[t],bold:false,underline:false,blink:false,inverse:false,transparent:false,opacity:1}}function He(e,t){let n=U.get(t);return n||(n={original:ja(e,t),focusApplied:false,hoverApplied:false},U.set(t,n)),n}function Ga(e,t){return U.get(t)}function Ya(e,t){return U.has(t)}function Ja(e,t){U.delete(t);}function Za(){U.clear();}function pe(e,t,n){n.fg!==void 0&&(I.fg[t]=n.fg),n.bg!==void 0&&(I.bg[t]=n.bg),n.bold!==void 0&&(I.bold[t]=n.bold?1:0),n.underline!==void 0&&(I.underline[t]=n.underline?1:0),n.blink!==void 0&&(I.blink[t]=n.blink?1:0),n.inverse!==void 0&&(I.inverse[t]=n.inverse?1:0);}function Ve(e,t,n){I.fg[t]=n.fg,I.bg[t]=n.bg,I.bold[t]=n.bold?1:0,I.underline[t]=n.underline?1:0,I.blink[t]=n.blink?1:0,I.inverse[t]=n.inverse?1:0,I.transparent[t]=n.transparent?1:0;}function mo(e,t){if(!sa$1(e,t))return;let n=He(e,t);if(n.focusApplied)return;let o={},r=ka$1.focusEffectFg[t],i=ka$1.focusEffectBg[t];(r&4278190080)!==0&&(o.fg=r),(i&4278190080)!==0&&(o.bg=i),pe(e,t,o),n.focusApplied=true,M(e,t);}function yo(e,t){let n=U.get(t);!n||!n.focusApplied||(n.focusApplied=false,n.hoverApplied?$a(e,t,n):(Ve(e,t,n.original),U.delete(t)),M(e,t));}function gt(e,t){return U.get(t)?.focusApplied??false}function $a(e,t,n){if(!u(e,t))return;Ve(e,t,n.original);let o={},r=c$1.hoverEffectFg[t],i=c$1.hoverEffectBg[t];(r&4278190080)!==0&&(o.fg=r),(i&4278190080)!==0&&(o.bg=i),pe(e,t,o);}function go(e,t){if(!u(e,t))return;let n=He(e,t);if(n.hoverApplied)return;let o={},r=c$1.hoverEffectFg[t],i=c$1.hoverEffectBg[t];(r&4278190080)!==0&&(o.fg=r),(i&4278190080)!==0&&(o.bg=i),pe(e,t,o),n.hoverApplied=true,M(e,t);}function bo(e,t){let n=U.get(t);!n||!n.hoverApplied||(n.hoverApplied=false,n.focusApplied?Xa(e,t,n):(Ve(e,t,n.original),U.delete(t)),M(e,t));}function Xa(e,t,n){if(!sa$1(e,t))return;Ve(e,t,n.original);let o={},r=ka$1.focusEffectFg[t],i=ka$1.focusEffectBg[t];(r&4278190080)!==0&&(o.fg=r),(i&4278190080)!==0&&(o.bg=i),pe(e,t,o);}function bt(e,t){return U.get(t)?.hoverApplied??false}function qa(e,t,n){He(e,t);let o=Te(e,t,n);pe(e,t,o),M(e,t);}function ho(e,t){let n=U.get(t);n&&(Ve(e,t,n.original),U.delete(t),M(e,t));}function ht(e,t){let n=sa$1(e,t)&&na$1(e,t),o=u(e,t)&&i$3(e,t),r=gt(e,t),i=bt(e,t);n&&!r?mo(e,t):!n&&r&&yo(e,t),o&&!i?go(e,t):!o&&i&&bo(e,t);}function vo(e,t){return {fg:I.fg[t],bg:I.bg[t],bold:I.bold[t]===1,underline:I.underline[t]===1,blink:I.blink[t]===1,inverse:I.inverse[t]===1,transparent:I.transparent[t]===1,opacity:I.opacity[t]??1}}function Qa(e,t){let n=U.get(t);return n?n.original:vo(e,t)}var me=new Map,ne=new Map;function es(e,t,n){if(me.set(t,n),n.focus&&sa$1(e,t)){let o=Te(e,t,n.focus);o.fg!==void 0&&(ka$1.focusEffectFg[t]=o.fg),o.bg!==void 0&&(ka$1.focusEffectBg[t]=o.bg);}if(n.hover&&u(e,t)){let o=Te(e,t,n.hover);o.fg!==void 0&&(c$1.hoverEffectFg[t]=o.fg),o.bg!==void 0&&(c$1.hoverEffectBg[t]=o.bg);}ht(e,t);}function ts(e,t){return me.get(t)}function ns(e,t){me.delete(t),ne.delete(t),ho(e,t);}function Eo(e,t){let n=ne.get(t);return n||(n={pressApplied:false,disabledApplied:false},ne.set(t,n)),n}function os(e,t){let n=me.get(t);if(!n?.press)return;let o=Eo(e,t);if(o.pressApplied)return;He(e,t);let r=Te(e,t,n.press);pe(e,t,r),o.pressApplied=true,M(e,t);}function rs(e,t){let n=ne.get(t);n?.pressApplied&&(n.pressApplied=false,ht(e,t));}function is(e,t){let n=me.get(t);if(!n?.disabled)return;let o=Eo(e,t);if(o.disabledApplied)return;He(e,t);let r=Te(e,t,n.disabled);pe(e,t,r),o.disabledApplied=true,M(e,t);}function as(e,t){let n=ne.get(t);n?.disabledApplied&&(n.disabledApplied=false,ht(e,t));}function rn(e,t){return ne.get(t)?.pressApplied??false}function an(e,t){return ne.get(t)?.disabledApplied??false}function ss(e,t){return gt(e,t)||bt(e,t)||rn(e,t)||an(e,t)}function ls(e,t){return {focus:gt(e,t),hover:bt(e,t),press:rn(e,t),disabled:an(e,t)}}function us(e,t){U.delete(t),me.delete(t),ne.delete(t);}function cs(){me.clear(),ne.clear();}function ds(e){let{type:t,target:n,payload:o,bubbles:r=true}=e,i={type:t,target:n,currentTarget:n,bubbles:r,defaultPrevented:false,propagationStopped:false,immediatePropagationStopped:false,payload:o,stopPropagation(){i.propagationStopped=true;},stopImmediatePropagation(){i.propagationStopped=true,i.immediatePropagationStopped=true;},preventDefault(){i.defaultPrevented=true;}};return i}function fs(e,t,n){let o=0,r=t.target;for(;r!==a$1;){t.currentTarget=r;let i$1=n(e,r);if(i$1&&(i$1.emit(t.type,t),o++,t.immediatePropagationStopped)||t.propagationStopped||!t.bubbles||!m(e,r,b))break;r=i(e,r);}return {defaultPrevented:t.defaultPrevented,propagationStopped:t.propagationStopped,dispatchCount:o}}var Xo=z.object({dispatchCount:z.number().int().nonnegative(),maxDepth:z.number().int().nonnegative(),circularReferenceDetected:z.boolean()}),qo=z.object({maxDepth:z.number().int().positive().optional(),includeRoot:z.boolean().optional()});function ps(e,t,n,o,r,i){let a=i?qo.parse(i):{includeRoot:true,maxDepth:Number.POSITIVE_INFINITY},s=a.maxDepth??Number.POSITIVE_INFINITY,l=a.includeRoot??true,c=new Set,p=0,u=0,f=false;function m$1(P,K){if(K>s)return;if(c.has(P)){f=true;return}if(c.add(P),u=Math.max(u,K),K>0||l){let M=r(e,P);M&&(M.emit(n,o),p++);}if(!m(e,P,b))return;let W=b.firstChild[P];for(;W!==a$1;)m$1(W,K+1),W=b.nextSibling[W];}m$1(t,0);let D={dispatchCount:p,maxDepth:u,circularReferenceDetected:f};return Xo.parse(D)}var ms=z.object({tickRate:z.number().positive(),maxUpdatesPerFrame:z.number().int().positive(),interpolate:z.boolean()}),ys=z.object({targetFPS:z.number().nonnegative().optional(),fixedTimestep:z.boolean().optional(),maxDeltaTime:z.number().positive().optional(),fixedTimestepMode:ms.optional()}),Qo=(o=>(o[o.STOPPED=0]="STOPPED",o[o.RUNNING=1]="RUNNING",o[o.PAUSED=2]="PAUSED",o))(Qo||{});function je(){let[e,t]=process.hrtime();return e+t/1e9}function gs(e,t={},n={}){let o=ys.parse(t),r=e,i=b$1(),a={...n},s=0,l={targetFPS:o.targetFPS??60,fixedTimestep:o.fixedTimestep??true,maxDeltaTime:o.maxDeltaTime??.1,fixedTimestepMode:o.fixedTimestepMode},c=0,p=l.targetFPS>0?1/l.targetFPS:0,u=0,f=0,m=0,D=0,P=0,K=0,W=0,M=l.fixedTimestepMode?1/l.fixedTimestepMode.tickRate:1/60,G=0,he=0,ve=0,re=0,d=0,g=null,E=null;function A(){if(l.targetFPS===0)g=setImmediate(()=>It());else {let I=je()-c,$=Math.max(0,p-I);$>.001?E=setTimeout(()=>It(),$*1e3):g=setImmediate(()=>It());}}function j(){g!==null&&(clearImmediate(g),g=null),E!==null&&(clearTimeout(E),E=null);}function Pn(b){a.onBeforeInput?.(r,b),r=i.run(r,b),a.onAfterInput?.(r,b),a.onBeforeUpdate?.(r,b),a.onAfterUpdate?.(r,b),a.onBeforeRender?.(r,b),a.onAfterRender?.(r,b),u++;}function kn(b){let I=l.fixedTimestepMode;if(!I)return;a.onBeforeInput?.(r,b),r=i.runInputOnly(r,b),a.onAfterInput?.(r,b),W+=b,d=0;let $=0;for(;W>=M;){if($>=I.maxUpdatesPerFrame){d=Math.floor(W/M),W=W%M;break}a.onBeforeFixedUpdate?.(r,M,G),a.onBeforeUpdate?.(r,M),r=i.runFixedUpdatePhases(r,M),a.onAfterUpdate?.(r,M),a.onAfterFixedUpdate?.(r,M,G),W-=M,G++,he++,$++;}re=I.interpolate?W/M:0,I.interpolate&&a.onInterpolate&&a.onInterpolate(r,re),a.onBeforeRender?.(r,b),r=i.runRenderPhases(r,b),a.onAfterRender?.(r,b),u++;}function ei(b,I){K=I*1e3,D++,b-m>=1&&(P=D,ve=he,D=0,he=0,m=b);}function It(){if(s!==1)return;let b=je(),I=b-c;c=b,I>l.maxDeltaTime&&(I=l.maxDeltaTime),l.fixedTimestepMode?kn(I):Pn(I),ei(b,I),A();}let An={getState(){return s},isRunning(){return s===1},isPaused(){return s===2},isStopped(){return s===0},getStats(){return {fps:P,frameTime:K,frameCount:u,runningTime:s!==0?je()-f:0,tickCount:G,ticksPerSecond:ve,interpolationAlpha:re,skippedUpdates:d}},getInterpolationAlpha(){return re},getFixedTimestepConfig(){return l.fixedTimestepMode},isFixedTimestepMode(){return l.fixedTimestepMode!==void 0},getScheduler(){return i},getWorld(){return r},setWorld(b){if(s!==0)throw new Error("Cannot change world while loop is running");r=b;},setTargetFPS(b){l.targetFPS=b,p=b>0?1/b:0;},getTargetFPS(){return l.targetFPS},registerSystem(b,I,$=0){i.registerSystem(b,I,$);},unregisterSystem(b){i.unregisterSystem(b);},registerInputSystem(b,I=0){i.registerInputSystem(b,I);},setHooks(b){a={...a,...b};},start(){if(s===1)return;let b=s===0;s=1,c=je(),b?(u=0,f=c,m=c,D=0,W=0,G=0,he=0,ve=0,re=0,d=0,a.onStart?.()):a.onResume?.(),A();},stop(){s!==0&&(j(),s=0,a.onStop?.());},pause(){s===1&&(j(),s=2,a.onPause?.());},resume(){s===2&&An.start();},step(b){let I=je(),$=b??(c>0?I-c:1/60);c=I;let Xe=Math.min($,l.maxDeltaTime);l.fixedTimestepMode?kn(Xe):Pn(Xe),K=Xe*1e3;},stepFixed(){if(!l.fixedTimestepMode)throw new Error("stepFixed() requires fixedTimestepMode to be enabled");a.onBeforeFixedUpdate?.(r,M,G),a.onBeforeUpdate?.(r,M),r=i.runFixedUpdatePhases(r,M),a.onAfterUpdate?.(r,M),a.onAfterFixedUpdate?.(r,M,G),G++;}};return An}function bs(e){return e?.isRunning()??false}function hs(e){return e?.isPaused()??false}var S={xi:new Float32Array(1e4),xl:new Float32Array(1e4),yi:new Float32Array(1e4),yl:new Float32Array(1e4),base:new Float32Array(1e4),valid:new Uint8Array(1e4)};function vs(e,t,n){S.xi[t]=n.xi,S.xl[t]=n.xl,S.yi[t]=n.yi,S.yl[t]=n.yl,S.base[t]=n.base,S.valid[t]=1;}function Es(e,t){if(S.valid[t]===1)return {xi:S.xi[t],xl:S.xl[t],yi:S.yi[t],yl:S.yl[t],base:S.base[t]}}function xs(e,t){return S.valid[t]===1}function Ss(e,t){S.valid[t]=0;}function Cs(e,t,n){S.valid[t]=0;let o=n(e,t);for(let r of o)S.valid[r]=0;}function Ds(e){S.valid.fill(0);}function Ts(e,t){return S.valid[t]!==1?0:S.xl[t]-S.xi[t]}function Ps(e,t){return S.valid[t]!==1?0:S.yl[t]-S.yi[t]}function ks(e,t,n){S.valid[t]===1&&(S.base[t]=n);}function sn(e,t,n,o){if(S.valid[t]!==1)return false;let r=S.xi[t],i=S.xl[t],a=S.yi[t],s=S.yl[t];return n>=r&&n<i&&o>=a&&o<s}function As(e){return o$1(e,[Ba$1,$,I])}function Is(e){return o$1(e,[ka$1])}function Pe(e){return o$1(e,[c$1])}function Rs(e){return o$1(e,[b$2])}function Bs(e){return o$1(e,[Ba$1,$,I,d$1])}function Ws(e){return o$1(e,[Ba$1,$,I,k])}function Ms(e){return o$1(e,[Ba$1,$,I,c$2])}function er(e){return o$1(e,[b])}function ws(e,t){return t.filter(n=>I.visible[n]===1)}function Ls(e,t){return t.filter(n=>I.dirty[n]===1)}function Fs(e,t){return t.filter(n=>I.visible[n]===1&&I.dirty[n]===1)}function tr(e,t){let n=[],o=b.firstChild[t];for(;o!==0;)n.push(o),o=b.nextSibling[o];return n}function Os(e,t){let n=[],o=[t];for(;o.length>0;){let r=o.pop(),i=tr(e,r);for(let a of i)n.push(a),o.push(a);}return n}function Ks(e){return er(e).filter(n=>b.parent[n]===0)}function Ns(e,t){return t.filter(n=>ka$1.focusable[n]===1)}function Us(e,t){return t.filter(n=>c$1.clickable[n]===1)}function _s(e,t){return [...t].sort((n,o)=>{let r=ka$1.tabIndex[n]??0,i=ka$1.tabIndex[o]??0;return r===0&&i!==0?1:i===0&&r!==0?-1:r-i})}function zs(e,t){return [...t].sort((n,o)=>(b.depth[n]??0)-(b.depth[o]??0))}var R=0,vt=2147483647,Et=-2147483648,nr=1e4,h={zIndex:new Int32Array(nr),localZ:new Int32Array(nr)};function Hs(e){h.zIndex[e]=R,h.localZ[e]=R;}function ge(e,t){m(e,t,h)||(l(e,t,h),Hs(t));}function ke(e,t){return m(e,t,h)?h.zIndex[t]??R:R}function Vs(e,t){return m(e,t,h)?h.localZ[t]??R:R}function xt(e,t){return m(e,t,h)}function js(e,t,n){ge(e,t),h.zIndex[t]=Math.max(Et,Math.min(vt,Math.floor(n)));}function Gs(e,t,n){ge(e,t),h.localZ[t]=Math.max(Et,Math.min(vt,Math.floor(n)));}function Ys(e,t){ge(e,t);let n=St(e,t);if(n.length===0)return;let o=h.zIndex[t]??R;for(let r of n)if(m(e,r,h)){let i=h.zIndex[r]??R;i>=o&&(o=i+1);}h.zIndex[t]=o;}function Js(e,t){ge(e,t);let n=St(e,t);if(n.length===0)return;let o=h.zIndex[t]??R;for(let r of n)if(m(e,r,h)){let i=h.zIndex[r]??R;i<=o&&(o=i-1);}h.zIndex[t]=o;}function Zs(e,t){ge(e,t);let n=St(e,t),o=h.zIndex[t]??R,r=null,i=vt;for(let a of n)if(m(e,a,h)){let s=h.zIndex[a]??R;s>o&&s<i&&(r=a,i=s);}return r!==null?(h.zIndex[t]=i,h.zIndex[r]=o,true):false}function $s(e,t){ge(e,t);let n=St(e,t),o=h.zIndex[t]??R,r=null,i=Et;for(let a of n)if(m(e,a,h)){let s=h.zIndex[a]??R;s<o&&s>i&&(r=a,i=s);}return r!==null?(h.zIndex[t]=i,h.zIndex[r]=o,true):false}function or(e,t){return [...t].sort((n,o)=>{let r=m(e,n,h)?h.zIndex[n]??R:R,i=m(e,o,h)?h.zIndex[o]??R:R;return r-i})}function rr(e,t){let n=f$1(e,t);return or(e,n)}function St(e,t){if(!m(e,t,b))return [];let n=i(e,t);return n===a$1?[]:f$1(e,n).filter(r=>r!==t)}function Xs(e,t){let n=rr(e,t);for(let o=0;o<n.length;o++){let r=n[o];r!==void 0&&(ge(e,r),h.zIndex[r]=o);}}function qs(e){h.zIndex[e]=R,h.localZ[e]=R;}function Qs(){return {entities:[],dirty:true,lastCount:0}}function el(e){e.dirty=true;}function tl(e){return e.dirty}function Re(e,t){if(!t.dirty)return;let o=Pe(e).filter(r=>c$1.clickable[r]===1||c$1.hoverable[r]===1);o.sort((r,i)=>{let a=xt(e,r)?h.zIndex[r]??0:0;return (xt(e,i)?h.zIndex[i]??0:0)-a}),t.entities=o,t.lastCount=o.length,t.dirty=false;}function nl(e,t){return Re(e,t),t.entities}function ol(e,t){return Re(e,t),t.entities.length}var ln={useCachedPositions:true,clickableOnly:true,hoverableOnly:false,interactiveOnly:false};function Ae(e,t,n){return m(e,t,c$1)?n.interactiveOnly?c$1.clickable[t]===1||c$1.hoverable[t]===1:n.clickableOnly&&n.hoverableOnly?c$1.clickable[t]===1&&c$1.hoverable[t]===1:n.clickableOnly?c$1.clickable[t]===1:n.hoverableOnly?c$1.hoverable[t]===1:true:false}function Ie(e,t,n,o,r){return r?sn(e,t,n,o):Zt(e,t,n,o)}function rl(e,t,n,o,r){let i=r.useCachedPositions??true;Re(e,t);for(let a of t.entities)if(Ae(e,a,r)&&Ie(e,a,n,o,i))return a;return null}function il(e,t,n,o){let r=o.useCachedPositions??true,i=Pe(e),a=[];for(let s of i)Ae(e,s,o)&&Ie(e,s,t,n,r)&&a.push({eid:s,z:ke(e,s)});return a.length===0?null:(a.sort((s,l)=>l.z-s.z),a[0]?.eid??null)}function Ge(e,t,n,o,r=ln){return o?rl(e,o,t,n,r):il(e,t,n,r)}function un(e,t,n,o,r=ln){let i=r.useCachedPositions??true,a=[];if(o){Re(e,o);for(let c of o.entities)Ae(e,c,r)&&Ie(e,c,t,n,i)&&a.push(c);return a}let s=Pe(e),l=[];for(let c of s)Ae(e,c,r)&&Ie(e,c,t,n,i)&&l.push({eid:c,z:ke(e,c)});return l.sort((c,p)=>p.z-c.z),l.map(c=>c.eid)}function al(e,t,n,o,r=ln){let i=r.useCachedPositions??true,a=[];if(o){Re(e,o);for(let l of o.entities)Ae(e,l,r)&&Ie(e,l,t,n,i)&&a.push({entity:l,zIndex:ke(e,l)});return a}let s=Pe(e);for(let l of s)Ae(e,l,r)&&Ie(e,l,t,n,i)&&a.push({entity:l,zIndex:ke(e,l)});return a.sort((l,c)=>c.zIndex-l.zIndex),a}function sl(e,t,n,o){return Ge(e,t,n,o,{clickableOnly:true,useCachedPositions:true})!==null}function ll(e,t,n,o){return Ge(e,t,n,o,{hoverableOnly:true,clickableOnly:false,useCachedPositions:true})!==null}function ul(e,t,n,o){return Ge(e,t,n,o,{clickableOnly:true,useCachedPositions:true})}function cl(e,t,n,o){return Ge(e,t,n,o,{hoverableOnly:true,clickableOnly:false,useCachedPositions:true})}function dl(e,t,n,o){return un(e,t,n,o,{clickableOnly:true,useCachedPositions:true})}function fl(e,t,n,o){return un(e,t,n,o,{hoverableOnly:true,clickableOnly:false,useCachedPositions:true})}var ar=z.object({action:z.string().min(1,"Action name is required"),keys:z.array(z.string()).default([]),mouseButtons:z.array(z.enum(["left","right","middle","wheelUp","wheelDown","unknown"])).optional(),continuous:z.boolean().default(false),deadzone:z.number().min(0).max(1).default(.1)}),sr=z.object({version:z.number().int().positive(),bindings:z.array(z.object({action:z.string(),keys:z.array(z.string()),mouseButtons:z.array(z.string()).optional(),continuous:z.boolean().optional()}))}),ir={active:false,justActivated:false,justDeactivated:false,activeTime:0,value:0},pl=1;function ml(e,t){for(let n of e.keys)if(t.isKeyDown(n))return true;for(let n of e.mouseButtons)if(t.isMouseButtonDown(n))return true;return false}function yl(e){let t=new Map,n=new Map,o=new Map,r=new Set;function i(u,f,m){u.active=true,u.justActivated=true,u.activeTime=0,u.value=1,c(f,u,m);}function a(u,f,m){u.active=false,u.justDeactivated=true,u.value=0,c(f,u,m);}function s(u,f,m,D,P){u.activeTime+=D,u.value=1,f.continuous&&c(m,u,P);}function l(u,f,m,D,P){m.justActivated=false,m.justDeactivated=false;let K=m.active,W=ml(f,P);W&&!K?i(m,u,P):!W&&K?a(m,u,P):W&&s(m,f,u,D,P);}function c(u,f,m){let D=o.get(u);if(D)for(let P of D)P(u,f,m);for(let P of r)P(u,f,m);}let p={register(u){let f=ar.parse(u),m={action:f.action,keys:[...f.keys],mouseButtons:f.mouseButtons?[...f.mouseButtons]:[],continuous:f.continuous??false,deadzone:f.deadzone??.1};return t.set(f.action,m),n.has(f.action)||n.set(f.action,{...ir}),p},registerAll(u){for(let f of u)p.register(f);return p},unregister(u){let f=t.delete(u);return n.delete(u),o.delete(u),f},hasAction(u){return t.has(u)},getActions(){return [...t.keys()]},getBinding(u){let f=t.get(u);if(f)return {action:f.action,keys:[...f.keys],mouseButtons:f.mouseButtons.length>0?[...f.mouseButtons]:void 0,continuous:f.continuous,deadzone:f.deadzone}},update(u,f){let m=f*1e3;for(let[D,P]of t){let K=n.get(D);K&&l(D,P,K,m,u);}},isActive(u){return n.get(u)?.active??false},isJustActivated(u){return n.get(u)?.justActivated??false},isJustDeactivated(u){return n.get(u)?.justDeactivated??false},getValue(u){return n.get(u)?.value??0},getActiveTime(u){return n.get(u)?.activeTime??0},getState(u){return n.get(u)??ir},getActiveActions(){let u=[];for(let[f,m]of n)m.active&&u.push(f);return u},rebindKeys(u,f){let m=t.get(u);return m?(m.keys=[...f],true):false},rebindMouseButtons(u,f){let m=t.get(u);return m?(m.mouseButtons=[...f],true):false},addKey(u,f){let m=t.get(u);return m?(m.keys.includes(f)||m.keys.push(f),true):false},removeKey(u,f){let m=t.get(u);if(!m)return false;let D=m.keys.indexOf(f);return D!==-1?(m.keys.splice(D,1),true):false},getKeysForAction(u){let f=t.get(u);return f?[...f.keys]:[]},getMouseButtonsForAction(u){let f=t.get(u);return f?[...f.mouseButtons]:[]},getActionsForKey(u){let f=[];for(let[m,D]of t)D.keys.includes(u)&&f.push(m);return f},onAction(u,f){let m=o.get(u);return m||(m=new Set,o.set(u,m)),m.add(f),()=>{m?.delete(f);}},onAnyAction(u){return r.add(u),()=>{r.delete(u);}},saveBindings(){let u=[];for(let[,f]of t)u.push({action:f.action,keys:[...f.keys],mouseButtons:f.mouseButtons.length>0?[...f.mouseButtons]:void 0,continuous:f.continuous||void 0});return {version:pl,bindings:u}},loadBindings(u){let f=sr.parse(u);t.clear(),n.clear();for(let m of f.bindings)p.register({action:m.action,keys:m.keys,mouseButtons:m.mouseButtons,continuous:m.continuous});},toJSON(u=false){let f=p.saveBindings();return u?JSON.stringify(f,null,2):JSON.stringify(f)},fromJSON(u){let f=JSON.parse(u);p.loadBindings(f);},resetStates(){for(let u of n.values())u.active=false,u.justActivated=false,u.justDeactivated=false,u.activeTime=0,u.value=0;},clear(){t.clear(),n.clear(),o.clear(),r.clear();}};return e&&p.registerAll(e),p}var gl={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 Ct(){return performance.now()}function cn(e){return e.length===0?0:e.reduce((n,o)=>n+o,0)/e.length}function lr(e,t){if(e.length===0)return 0;if(e.length===1)return e[0]??0;let n=Math.ceil(t*e.length)-1;return e[Math.max(0,Math.min(n,e.length-1))]??0}function bl(e,t){t&&console.warn(`[InputEventBuffer] Dropped ${e} events due to buffer overflow`);}function ur(e={}){let t=e.warnOnOverflow??true;return {keyEvents:[],mouseEvents:[],latencySamples:[],frameProcessingTimes:[],frameStartTime:0,totalKeyEvents:0,totalMouseEvents:0,droppedEvents:0,config:{maxBufferSize:e.maxBufferSize??1e3,maxLatencySamples:e.maxLatencySamples??1e3,maxFrameSamples:e.maxFrameSamples??100,warnOnOverflow:t,onOverflow:e.onOverflow??(n=>bl(n,t))}}}function cr(e,t){let n=e.config.maxBufferSize;if(n<=0)return 0;if(t.length>n){let o=t.length-n;return t.splice(0,o),e.droppedEvents+=o,e.config.onOverflow(o),o}return 0}function hl(e,t,n){e.totalKeyEvents++;let o={type:"key",event:t,timestamp:n??Ct()};e.keyEvents.push(o),cr(e,e.keyEvents);}function vl(e,t,n){e.totalMouseEvents++;let o={type:"mouse",event:t,timestamp:n??Ct()};e.mouseEvents.push(o),cr(e,e.mouseEvents);}function dr(e){let t=e.keyEvents;return e.keyEvents=[],t}function fr(e){let t=e.mouseEvents;return e.mouseEvents=[],t}function El(e){let t=dr(e),n=fr(e),o=[...t,...n];return o.sort((r,i)=>r.timestamp-i.timestamp),o}function xl(e){let t=[...e.keyEvents,...e.mouseEvents];return t.sort((n,o)=>n.timestamp-o.timestamp),t}function Sl(e){return e.keyEvents}function Cl(e){return e.mouseEvents}function Dl(e){e.keyEvents=[],e.mouseEvents=[];}function Tl(e){return e.keyEvents.length}function Pl(e){return e.mouseEvents.length}function kl(e){return e.keyEvents.length+e.mouseEvents.length}function Al(e){return e.keyEvents.length>0||e.mouseEvents.length>0}function Il(e){return {totalKeyEvents:e.totalKeyEvents,totalMouseEvents:e.totalMouseEvents,pendingKeyEvents:e.keyEvents.length,pendingMouseEvents:e.mouseEvents.length,droppedEvents:e.droppedEvents,maxBufferSize:e.config.maxBufferSize}}function Rl(e){e.totalKeyEvents=0,e.totalMouseEvents=0,e.droppedEvents=0;}function Bl(e){e.frameStartTime=Ct();}function Wl(e){let n=Ct()-e.frameStartTime;return e.frameProcessingTimes.push(n),e.frameProcessingTimes.length>e.config.maxFrameSamples&&e.frameProcessingTimes.shift(),n}function Ml(e,t){e.latencySamples.push(t),e.latencySamples.length>e.config.maxLatencySamples&&e.latencySamples.shift();}function wl(e,t,n){for(let o=0;o<Math.min(n,10);o++)e.latencySamples.push(t);for(;e.latencySamples.length>e.config.maxLatencySamples;)e.latencySamples.shift();}function dn(e){let t=e.latencySamples,n=e.frameProcessingTimes;if(t.length===0)return {min:0,max:0,avg:0,p95:0,p99:0,sampleCount:0,lastFrameProcessingTime:n[n.length-1]??0,avgFrameProcessingTime:cn(n)};let o=[...t].sort((r,i)=>r-i);return {min:o[0]??0,max:o[o.length-1]??0,avg:cn(o),p95:lr(o,.95),p99:lr(o,.99),sampleCount:o.length,lastFrameProcessingTime:n[n.length-1]??0,avgFrameProcessingTime:cn(n)}}function Ll(e){e.latencySamples=[],e.frameProcessingTimes=[];}function Fl(e,t=16){return dn(e).p95<=t}function Ol(e,t=1){return dn(e).avgFrameProcessingTime<=t}var Kl=ur();var Nl=z.object({trackRepeats:z.boolean().optional(),debounceTime:z.number().nonnegative().optional(),customRepeatRate:z.number().positive().optional(),customRepeatDelay:z.number().positive().optional()}),pr={pressed:false,justPressed:false,justReleased:false,heldTime:0,repeatCount:0,lastEventTime:0},Be={pressed:false,justPressed:false,justReleased:false,heldTime:0,lastEventTime:0};function mr(){return {x:0,y:0,deltaX:0,deltaY:0,wheelDelta:0,buttons:{left:{...Be},right:{...Be},middle:{...Be},wheelUp:{...Be},wheelDown:{...Be},unknown:{...Be}}}}function Ul(e,t){return e.toLowerCase()}function _l(e={}){let t=Nl.parse(e),n={trackRepeats:t.trackRepeats??true,debounceTime:t.debounceTime??0,customRepeatRate:t.customRepeatRate??0,customRepeatDelay:t.customRepeatDelay??500},o=new Map,r=mr(),i=0,a=0,s=0,l=false,c=false,p=false;function u(){for(let d of o.values())d.justPressed=false,d.justReleased=false;for(let d of Object.values(r.buttons))d.justPressed=false,d.justReleased=false;}function f(d){for(let g of o.values())g.pressed&&(g.heldTime+=d);}function m(d,g){return n.debounceTime<=0||d.lastEventTime<=0?false:g-d.lastEventTime<n.debounceTime}function D(d){n.trackRepeats&&d.repeatCount++;}function P(d){d.pressed=true,d.justPressed=true,d.justReleased=false,d.heldTime=0,d.repeatCount=0;}function K(d,g){let E=Ul(d.name),A=o.get(E);A||(A={...pr},o.set(E,A)),!m(A,g)&&(A.pressed?D(A):P(A),A.lastEventTime=g,d.ctrl&&!A.pressed&&(l=true),d.meta&&!A.pressed&&(c=true),d.shift&&!A.pressed&&(p=true));}function W(d,g){let E=o.get(d);!E||!E.pressed||(E.pressed=false,E.justPressed=false,E.justReleased=true,E.lastEventTime=g,d==="ctrl"&&(l=false),d==="alt"&&(c=false),d==="shift"&&(p=false));}function M(d){let g=r.x,E=r.y;r.x=d.x,r.y=d.y,r.deltaX+=d.x-g,r.deltaY+=d.y-E;}function G(d,g,E){g==="press"&&!d.pressed?(d.pressed=true,d.justPressed=true,d.justReleased=false,d.heldTime=0):g==="release"&&d.pressed&&(d.pressed=false,d.justPressed=false,d.justReleased=true),d.lastEventTime=E;}function he(d,g){M(d),d.button==="wheelUp"?r.wheelDelta+=1:d.button==="wheelDown"&&(r.wheelDelta-=1);let E=r.buttons[d.button];E&&G(E,d.action,g);}let ve=()=>{let d=performance.now();for(let[g,E]of o)E.pressed&&W(g,d);l=false,c=false,p=false;},re=()=>{let d=performance.now();for(let g of Object.values(r.buttons))g.pressed&&(g.pressed=false,g.justReleased=true,g.lastEventTime=d);};return {update(d,g,E){i++,a=d.length,s=g.length;let A=E*1e3;u(),f(A);for(let j of d)K(j.event,j.timestamp);r.deltaX=0,r.deltaY=0,r.wheelDelta=0;for(let j of g)he(j.event,j.timestamp);for(let j of Object.values(r.buttons))j.pressed&&(j.heldTime+=A);},isKeyDown(d){return o.get(d.toLowerCase())?.pressed??false},isKeyPressed(d){return o.get(d.toLowerCase())?.justPressed??false},isKeyReleased(d){return o.get(d.toLowerCase())?.justReleased??false},getKeyHeldTime(d){return o.get(d.toLowerCase())?.heldTime??0},getKeyState(d){return o.get(d.toLowerCase())??pr},getKeyRepeatCount(d){return o.get(d.toLowerCase())?.repeatCount??0},getPressedKeys(){let d=[];for(let[g,E]of o)E.pressed&&d.push(g);return d},getJustPressedKeys(){let d=[];for(let[g,E]of o)E.justPressed&&d.push(g);return d},getJustReleasedKeys(){let d=[];for(let[g,E]of o)E.justReleased&&d.push(g);return d},isCtrlDown(){return l},isAltDown(){return c},isShiftDown(){return p},hasModifier(){return l||c||p},isMouseButtonDown(d){return r.buttons[d]?.pressed??false},isMouseButtonPressed(d){return r.buttons[d]?.justPressed??false},isMouseButtonReleased(d){return r.buttons[d]?.justReleased??false},getMouseX(){return r.x},getMouseY(){return r.y},getMousePosition(){return {x:r.x,y:r.y}},getMouseDelta(){return {deltaX:r.deltaX,deltaY:r.deltaY}},getWheelDelta(){return r.wheelDelta},getMouseState(){return r},releaseKey(d){W(d.toLowerCase(),performance.now());},releaseAllKeys:ve,releaseAllMouseButtons:re,releaseAll(){ve(),re();},getStats(){let d=0,g=0,E=0;for(let A of o.values())A.pressed&&d++,A.justPressed&&g++,A.justReleased&&E++;return {keysDown:d,keysPressed:g,keysReleased:E,keyEventsThisFrame:a,mouseEventsThisFrame:s,frameCount:i}},getFrameCount(){return i},reset(){o.clear(),r=mr(),i=0,a=0,s=0,l=false,c=false,p=false;}}}function zl(e,t){for(let n of t)if(e.isKeyDown(n))return true;return false}function Hl(e,t){for(let n of t)if(!e.isKeyDown(n))return false;return true}function Vl(e,t){for(let n of t)if(e.isKeyPressed(n))return true;return false}function jl(e){let t=0,n=0;return (e.isKeyDown("a")||e.isKeyDown("left"))&&(t-=1),(e.isKeyDown("d")||e.isKeyDown("right"))&&(t+=1),(e.isKeyDown("w")||e.isKeyDown("up"))&&(n-=1),(e.isKeyDown("s")||e.isKeyDown("down"))&&(n+=1),{x:t,y:n}}var yr=z.object({keys:z.union([z.string(),z.array(z.string()).readonly()]),action:z.string().min(1),when:z.string().optional(),preventDefault:z.boolean().optional(),description:z.string().optional()}),Gl=z.array(yr),Yl={esc:"escape",ret:"return",cr:"return",lf:"enter",bs:"backspace",del:"delete",ins:"insert",pgup:"pageup",pgdn:"pagedown",pgdown:"pagedown",arrow_up:"up",arrow_down:"down",arrow_left:"left",arrow_right:"right"},Jl={control:"ctrl",cmd:"meta",command:"meta",option:"meta",alt:"meta",win:"meta",super:"meta"};function Zl(e,t){t==="ctrl"?e.ctrl=true:t==="meta"?e.meta=true:t==="shift"&&(e.shift=true);}function $l(e,t,n){if(t){let o=Xl(e);if(!o)return false;n.name=o;}else {let o=ql(e);if(!o)return false;Zl(n,o);}return true}function pn(e){if(!e)return null;let t=e.toLowerCase().split("+").map(o=>o.trim());if(t.length===0)return null;let n={name:"undefined",ctrl:false,meta:false,shift:false};for(let o=0;o<t.length;o++){let r=t[o];if(r&&!$l(r,o===t.length-1,n))return null}return n.name==="undefined"?null:n}function Xl(e){let t=e.toLowerCase(),n=Yl[t];return n||(t.length===1||/^f(1[0-2]|[1-9])$/.test(t)||new Set(["up","down","left","right","home","end","pageup","pagedown","insert","delete","clear","return","enter","tab","backspace","escape","space"]).has(t)?t:null)}function ql(e){let t=e.toLowerCase();return t==="ctrl"||t==="meta"||t==="shift"?t:Jl[t]??null}function mn(e){let t=[];return e.ctrl&&t.push("ctrl"),e.meta&&t.push("meta"),e.shift&&t.push("shift"),t.push(e.name),t.join("+")}function gr(e){let t=[];return e.ctrl&&t.push("ctrl"),e.meta&&t.push("meta"),e.shift&&t.push("shift"),t.push(e.name),t.join("+")}function Ql(){return {bindings:new Map,keyIndex:new Map}}function br(e,t){let n=new Map(e.bindings),o=new Map;for(let[i,a]of e.keyIndex)o.set(i,[...a]);n.set(t.action,t);let r=Array.isArray(t.keys)?t.keys:[t.keys];for(let i of r){let a=pn(i);if(!a)continue;let s=mn(a),l=o.get(s)??[];o.set(s,[...l,t]);}return {bindings:n,keyIndex:o}}function eu(e,t){return t.reduce((n,o)=>br(n,o),e)}function tu(e,t){if(!e.bindings.get(t))return e;let o=new Map(e.bindings),r=new Map;for(let[i,a]of e.keyIndex){let s=a.filter(l=>l.action!==t);s.length>0&&r.set(i,s);}return o.delete(t),{bindings:o,keyIndex:r}}function nu(e,t){return e.bindings.get(t)}function ou(e,t){let n=mn(t);return e.keyIndex.get(n)??[]}function ru(e,t){let n=Array.isArray(e.keys)?e.keys:[e.keys];for(let o of n){let r=pn(o);if(r&&r.name===t.name&&r.ctrl===t.ctrl&&r.meta===t.meta&&r.shift===t.shift)return true}return false}function hr(e,t){if(!e)return true;let n=e.split("&&").map(o=>o.trim());for(let o of n)if(!vr(o,t))return false;return true}function vr(e,t){let n=e.trim();if(n.startsWith("!"))return !vr(n.slice(1),t);if(n.includes("==")){let r=n.split("==").map(c=>c.trim()),i=r[0],a=r[1];if(!i||!a)return false;let s=fn(i,t),l=a.replace(/^['"]|['"]$/g,"");return String(s)===l}if(n.includes("!=")){let r=n.split("!=").map(c=>c.trim()),i=r[0],a=r[1];if(!i||!a)return false;let s=fn(i,t),l=a.replace(/^['"]|['"]$/g,"");return String(s)!==l}return !!fn(n,t)}function fn(e,t){let n=e.trim();return t[n]}function iu(e,t,n={}){let o=gr(t),r=e.keyIndex.get(o)??[],i=[];for(let a of r)a.when&&!hr(a.when,n)||i.push({binding:a,action:a.action,preventDefault:a.preventDefault??true});return i}function au(e){return mn(e)}function su(e){return gr(e)}function lu(e){return [...e.bindings.values()]}var uu=[{keys:["ctrl+c"],action:"copy",description:"Copy selection"},{keys:["ctrl+v"],action:"paste",description:"Paste clipboard"},{keys:["ctrl+x"],action:"cut",description:"Cut selection"},{keys:["ctrl+z"],action:"undo",description:"Undo"},{keys:["ctrl+shift+z","ctrl+y"],action:"redo",description:"Redo"},{keys:["ctrl+a"],action:"selectAll",description:"Select all"},{keys:["backspace"],action:"deleteBack",description:"Delete backwards"},{keys:["delete"],action:"deleteForward",description:"Delete forwards"},{keys:["home"],action:"moveToLineStart",description:"Move to line start"},{keys:["end"],action:"moveToLineEnd",description:"Move to line end"},{keys:["ctrl+home"],action:"moveToStart",description:"Move to document start"},{keys:["ctrl+end"],action:"moveToEnd",description:"Move to document end"}],cu=[{keys:["tab"],action:"focusNext",description:"Focus next element"},{keys:["shift+tab"],action:"focusPrev",description:"Focus previous element"},{keys:["escape"],action:"cancel",description:"Cancel/close"},{keys:["enter","return"],action:"confirm",description:"Confirm/submit"},{keys:["up"],action:"moveUp",description:"Move up"},{keys:["down"],action:"moveDown",description:"Move down"},{keys:["left"],action:"moveLeft",description:"Move left"},{keys:["right"],action:"moveRight",description:"Move right"},{keys:["pageup"],action:"pageUp",description:"Page up"},{keys:["pagedown"],action:"pageDown",description:"Page down"}];var Er={CRITICAL:0,HIGH:1,NORMAL:2,LOW:3};function du(e){let t,n=false;return {get(){return n||(t=e(),n=true),t},isInitialized(){return n},reset(){t=void 0,n=false;}}}var be=[],We=null,Dt=null;function fu(e,t,n){be.find(r=>r.name===e)||be.push({name:e,priority:t,initFn:n,initialized:false,initTimeMs:null});}function xr(e){let t=be.find(r=>r.name===e);if(!t||t.initialized)return null;We===null&&(We=performance.now());let n=performance.now();t.initFn();let o=performance.now()-n;return t.initialized=true,t.initTimeMs=o,Dt===null&&(Dt=performance.now()-We),o}function pu(e=Er.LOW){We===null&&(We=performance.now());let t=0,n=[...be].filter(o=>!o.initialized&&o.priority<=e).sort((o,r)=>o.priority-r.priority);for(let o of n){let r=xr(o.name);r!==null&&(t+=r);}return t}function mu(){return {totalMs:be.filter(n=>n.initialized).reduce((n,o)=>n+(o.initTimeMs??0),0),subsystems:be.map(n=>({name:n.name,priority:n.priority,initTimeMs:n.initTimeMs??0,lazy:!n.initialized})),timeToFirstInit:Dt??0}}function yu(e){let t=[],n=["CRITICAL","HIGH","NORMAL","LOW"];t.push("Startup Report"),t.push("\u2550".repeat(40)),t.push(`Total init time: ${e.totalMs.toFixed(1)}ms`),t.push(`Time to first init: ${e.timeToFirstInit.toFixed(1)}ms`),t.push("");for(let o of e.subsystems){let r=o.lazy?"(lazy)":`${o.initTimeMs.toFixed(1)}ms`,i=n[o.priority]??"UNKNOWN";t.push(` [${i}] ${o.name}: ${r}`);}return t.join(`
2
- `)}function gu(){be.length=0,We=null,Dt=null;}function bu(e=6e4){let t=yn.value;if(t&&Date.now()-t.cachedAt<e)return t;let n=process.env,o=n.TERM??"",r=n.COLORTERM??"",i=r==="truecolor"||r==="24bit"||o.includes("24bit")||o.includes("truecolor"),a=i||o.includes("256color")||r==="256color",s=(n.LANG??"").includes("UTF-8")||(n.LC_ALL??"").includes("UTF-8"),l={term:o,trueColor:i,color256:a,unicode:s,width:process.stdout.columns??80,height:process.stdout.rows??24,cachedAt:Date.now()};return yn.value=l,l}var yn={value:null};function hu(){yn.value=null;}var Cr={0:"INPUT",1:"EARLY_UPDATE",2:"UPDATE",3:"LATE_UPDATE",4:"PHYSICS",5:"LAYOUT",6:"RENDER",7:"POST_RENDER"};function vu(e){return typeof e=="number"&&e>=0&&e<=7}function Sr(e){for(let t=0;t<=7;t++)e.set(t,{id:t,name:Cr[t]??`PHASE_${t}`,order:t*1e3,isBuiltin:true});}function Dr(){let e=new Map,t=0,n=true,o=[];Sr(e);function r(a){let s=Number.MAX_SAFE_INTEGER;for(let l of e.values())l.order>a&&l.order<s&&(s=l.order);return s===Number.MAX_SAFE_INTEGER&&(s=a+1e3),s}function i(){let a=Array.from(e.values());a.sort((s,l)=>s.order-l.order),o=a.map(s=>s.id),n=false;}return {registerPhase(a,s){let l=e.get(s);if(!l)throw new Error(`Cannot register phase after unknown phase: ${String(s)}`);let c=`custom_${a}_${++t}`,p=l.order,u=r(p),f=p+(u-p)/2;return e.set(c,{id:c,name:a,order:f,isBuiltin:false}),n=true,c},unregisterPhase(a){let s=e.get(a);if(!s)return false;if(s.isBuiltin)throw new Error(`Cannot remove built-in phase: ${s.name}`);return e.delete(a),n=true,true},getPhaseOrder(){return n&&i(),o},getPhaseName(a){return e.get(a)?.name},hasPhase(a){return e.has(a)},isBuiltin(a){return e.get(a)?.isBuiltin??false},getPhaseCount(){return e.size},getCustomPhaseCount(){let a=0;for(let s of e.values())s.isBuiltin||a++;return a},getCustomPhases(){let a=[];for(let s of e.values())!s.isBuiltin&&typeof s.id=="string"&&a.push(s.id);return a},clearCustomPhases(){for(let[a,s]of e)s.isBuiltin||e.delete(a);t=0,n=true;},reset(){e.clear(),t=0,Sr(e),n=true;}}}var Eu=Dr();var Tr=z.object({name:z.string().min(1),store:z.unknown()}),Pr=z.object({system:z.function(),phase:z.nativeEnum(a),priority:z.number().optional()}),kr=z.object({name:z.string().min(1),description:z.string().optional(),factory:z.function(),tags:z.array(z.string()).readonly().optional()}),Ar=z.object({name:z.string().min(1),theme:z.record(z.string(),z.unknown())}),Ir=z.object({name:z.string().min(1),version:z.string().min(1),dependencies:z.array(z.string().min(1)).readonly().optional(),components:z.array(Tr).readonly().optional(),systems:z.array(Pr).readonly().optional(),widgets:z.array(kr).readonly().optional(),themes:z.array(Ar).readonly().optional(),configSchema:z.unknown().optional(),init:z.function().optional(),onActivate:z.function().optional(),onDeactivate:z.function().optional(),cleanup:z.function().optional()});function xu(){return {_plugins:new Map}}function Su(e,t,n,o){let r=Ir.safeParse(o);if(!r.success)return {success:false,error:`Invalid plugin manifest: ${r.error.message}`,systemsRegistered:0,componentsRegistered:0};let i=e._plugins;if(i.has(o.name))return {success:false,error:`Plugin "${o.name}" is already registered`,systemsRegistered:0,componentsRegistered:0};if(o.dependencies){for(let s of o.dependencies)if(!i.has(s))return {success:false,error:`Missing dependency: "${s}" (required by "${o.name}")`,systemsRegistered:0,componentsRegistered:0}}let a=[];if(o.systems)for(let s of o.systems)t.registerSystem(s.phase,s.system,s.priority??0),a.push(s);return i.set(o.name,{plugin:o,registeredSystems:a,active:true}),o.init&&o.init(n),o.onActivate&&o.onActivate(n),{success:true,systemsRegistered:a.length,componentsRegistered:o.components?.length??0}}function Cu(e,t,n,o){let r=e._plugins,i=r.get(o);if(!i)return false;for(let[a,s]of r)if(a!==o&&s.plugin.dependencies?.includes(o))return false;i.active&&i.plugin.onDeactivate&&i.plugin.onDeactivate(n);for(let a of i.registeredSystems)t.unregisterSystem(a.system);return i.plugin.cleanup&&i.plugin.cleanup(n),r.delete(o),true}function Du(e){let t=[];for(let n of e._plugins.values())t.push({name:n.plugin.name,version:n.plugin.version,dependencies:n.plugin.dependencies??[],componentCount:n.plugin.components?.length??0,systemCount:n.registeredSystems.length,widgetCount:n.plugin.widgets?.length??0,themeCount:n.plugin.themes?.length??0,active:n.active});return t}function Tu(e,t){return e._plugins.has(t)}function Pu(e){return e._plugins.size}function ku(e,t,n){let o=e._plugins,r=[...o.keys()].reverse();for(let i of r){let a=o.get(i);if(a){a.active&&a.plugin.onDeactivate&&a.plugin.onDeactivate(n);for(let s of a.registeredSystems)t.unregisterSystem(s.system);a.plugin.cleanup&&a.plugin.cleanup(n);}}o.clear();}function Au(e){return e}function Iu(e,t,n,o){let i=e._plugins.get(o);if(!i)return false;if(i.active)return true;for(let a of i.registeredSystems)t.registerSystem(a.phase,a.system,a.priority??0);return i.active=true,i.plugin.onActivate&&i.plugin.onActivate(n),true}function Ru(e,t,n,o){let i=e._plugins.get(o);if(!i)return false;if(!i.active)return true;i.plugin.onDeactivate&&i.plugin.onDeactivate(n);for(let a of i.registeredSystems)t.unregisterSystem(a.system);return i.active=false,true}function Bu(e,t){return e._plugins.get(t)?.active??false}function Wu(e,t){return e.configSchema?e.configSchema.parse(t):t}var Mu=z.union([z.number(),z.string().refine(e=>!!(["center","half","left","right","top","bottom"].includes(e)||/^\d+(\.\d+)?%$/.test(e)||/^(\d+(\.\d+)?%?)([-+]\d+(\.\d+)?)?$/.test(e)),{message:'Position must be a number, percentage (e.g. "50%"), expression (e.g. "50%-5"), or keyword (center, half)'})]),Rr={center:"center",half:"half",left:"start",right:"end",top:"start",bottom:"end"};function wu(e){let t=e.match(/^(\d+(?:\.\d+)?)(%?)(([+-])(\d+(?:\.\d+)?))?$/);if(!t)return null;let n=Number.parseFloat(t[1]),o=t[2]==="%",r=0;if(t[3]){let i=t[4],a=Number.parseFloat(t[5]);r=i==="-"?-a:a;}return {base:n,isPercent:o,offset:r}}function Tt(e,t,n=0){if(typeof e=="number")return Math.floor(e)||0;let o=Rr[e];if(o)switch(o){case "center":return Math.floor((t-n)/2);case "half":return Math.floor(t/2);case "start":return 0;case "end":return t-n}let r=wu(e);if(!r)return 0;let i;return r.isPercent?i=r.base/100*t:i=r.base,i+=r.offset,Math.floor(i)}function Lu(e,t,n=0){if(typeof e=="number"&&e<0)return t+e-n;if(typeof e=="string"&&e.startsWith("-")){let o=e.match(/^-(\d+(?:\.\d+)?)$/);if(o){let r=Number.parseFloat(o[1]);return t-r-n}}return Tt(e,t,n)}function bn(e,t,n=0){let o=t-n;return e<0?0:e>o?Math.max(0,o):e}function Fu(e){return typeof e=="number"?false:e.includes("%")}function Ou(e){return typeof e=="number"?false:e in Rr}function Ku(){return "center"}function Nu(e){return `${e}%`}function Uu(e,t){return t>=0?`${e}%+${t}`:`${e}%${t}`}function Br(e,t,n,o,r=0,i=0){return {x:Tt(e,n,r),y:Tt(t,o,i)}}function _u(e,t,n,o,r=0,i=0){let a=Br(e,t,n,o,r,i);return {x:bn(a.x,n,r),y:bn(a.y,o,i)}}function zu(e,t){let[n,o]=c$3(e()),r=setInterval(()=>{o(e());},t);return [n,()=>{clearInterval(r);}]}function Hu(e){let t=Date.now(),[n,o]=c$3(0),r=setInterval(()=>{let s=Date.now()-t,l=Math.min(s/e,1);o(l),l>=1&&clearInterval(r);},16);return [n,()=>{clearInterval(r);}]}function Vu(e,t){let[n,o]=c$3(t);return [n,i=>{let a=n(),s=e(a,i);o(s);}]}function ju(e,t){return d$2(()=>{let n=e.map(o=>o());return t(...n)})}function Gu(e,t){let{transform:n=p=>p.toString("utf8"),initialValue:o,destroyOnDispose:r=false}=t,[i,a]=c$3(o),s=(...p)=>{let u=p[0];a(n(u));},l=(...p)=>{let u=p[0];console.error("Stream error:",u);};return e.on("data",s),e.on("error",l),[i,()=>{e.removeListener("data",s),e.removeListener("error",l),r&&e.destroy&&e.destroy();}]}function Yu(e,t){let[n,o]=c$3(t),r=e(i=>{o(i);});return [n,r]}function Ju(e,t,n){let[o,r]=c$3(n),i=false,a=async()=>{if(!i)try{let c=await e();i||r(c);}catch(c){console.error("Polling error:",c);}};a();let s=setInterval(()=>{a();},t);return [o,()=>{i=true,clearInterval(s);}]}function Zu(e,t,n){let[o,r]=c$3(n),i=(...s)=>{let l=s[0];r(l);};return e.on(t,i),[o,()=>{e.removeListener(t,i);}]}function hn(e,t,n,o,r){e.transition={transition:r,elapsed:0,fromScene:n,toScene:o},r.onStart?.(t);}function $u(e,t){e.transition&&(e.transition.transition.onComplete?.(t),e.transition=null);}function vn(e,t){e.created||(e.scene.onCreate?.(t),e.created=true);}function Pt(e,t){vn(e,t),e.scene.onEnter?.(t);}function ue(e,t){e.onExit?.(t);}function Xu(e,t,n){for(let o=e.stack.length-1;o>=0;o--){let r=e.stack[o];r&&ue(r,t);}e.stack=[n.scene],Pt(n,t);}function qu(e,t,n){let o=e.stack[e.stack.length-1];o&&ue(o,t),e.stack.push(n.scene),Pt(n,t);}function Qu(e,t){if(e.stack.length<=0)return false;let n=e.stack[e.stack.length-1];n&&ue(n,t),e.stack.pop();let o=e.stack[e.stack.length-1];if(o){let r=e.registry.get(o.name);r&&Pt(r,t);}return true}function ec(){let e={registry:new Map,stack:[],transition:null};return {registerScene(t){return e.registry.has(t.name)?false:(e.registry.set(t.name,{scene:t,created:false}),true)},unregisterScene(t,n){let o=e.registry.get(n);if(!o)return false;let r=e.stack.indexOf(o.scene);return r!==-1&&(ue(o.scene,t),e.stack.splice(r,1)),o.created&&o.scene.onDestroy?.(t),e.registry.delete(n),true},switchTo(t,n,o){let r=e.registry.get(n);if(!r)return false;if(o){let i=e.stack[e.stack.length-1]??null;for(let a=e.stack.length-1;a>=0;a--){let s=e.stack[a];s&&ue(s,t);}e.stack=[r.scene],vn(r,t),hn(e,t,i,r.scene,o);}else Xu(e,t,r);return true},push(t,n,o){let r=e.registry.get(n);if(!r)return false;if(o){let i=e.stack[e.stack.length-1]??null;i&&ue(i,t),e.stack.push(r.scene),vn(r,t),hn(e,t,i,r.scene,o);}else qu(e,t,r);return true},pop(t,n){if(e.stack.length<=0)return false;if(n){let o=e.stack[e.stack.length-1]??null;o&&ue(o,t),e.stack.pop();let r=e.stack[e.stack.length-1]??null;return r?hn(e,t,o,r,n):e.transition=null,true}return Qu(e,t)},getCurrentScene(){return e.stack[e.stack.length-1]??null},getSceneStack(){return [...e.stack]},getRegisteredScenes(){return Array.from(e.registry.keys())},isTransitioning(){return e.transition!==null},getTransitionState(){return e.transition},updateTransition(t,n){if(!e.transition)return;e.transition.elapsed+=n;let o=Math.min(1,e.transition.elapsed/e.transition.transition.duration);if(e.transition.transition.onUpdate?.(t,o),o>=1){let r=e.transition.toScene;$u(e,t);let i=e.registry.get(r.name);i&&Pt(i,t);}},reset(t){e.transition=null;for(let n=e.stack.length-1;n>=0;n--){let o=e.stack[n];o&&ue(o,t);}for(let n of e.registry.values())n.created&&n.scene.onDestroy?.(t);e.registry.clear(),e.stack=[];}}}function tc(e,t){return {duration:e,onUpdate:t}}function nc(e,t,n){return {duration:e,onUpdate(o,r){n?.(o,r,t);}}}function oc(e,t){return n=>{let o=t();return e.isTransitioning()&&e.updateTransition(n,o),e.isTransitioning()||e.getCurrentScene()?.onUpdate?.(n,o),n}}function Wr(e,t,n,o){let r=[],i={};for(let s of n.fields)i[s]=[];let a=n.component;for(let s of t)if(o(e,s,n.component)){r.push(s);for(let l of n.fields){let c=a[l];c&&typeof c[s]<"u"?i[l]?.push(c[s]??0):i[l]?.push(0);}}return r.length===0?null:{name:n.name,entities:r,values:i}}function Mr(e){let t=new Set;for(let n of e.components)for(let o of n.entities)t.add(o);return t}function wr(e,t,n){let o=new Map,r=Array.from(t).sort((i,a)=>i-a);for(let i of r){let a=n(e);o.set(i,a);}return o}function Lr(e,t,n,o,r){for(let i of r){let a=n[i];if(!a||typeof a[o]>"u")continue;let s=e[i];s&&(s[t]=a[o]);}}function En(e){let t=new Set;for(let n of e.components)for(let o of n.entities)t.add(o);return t}function Fr(e,t){let n=[],o=[];for(let r of t)e.has(r)||n.push(r);for(let r of e)t.has(r)||o.push(r);return {added:n,removed:o}}function rc(e,t,n,o){if(!n||!n.entities.includes(o))return true;let r=n.entities.indexOf(o);for(let i of Object.keys(e.values)){let a=e.values[i]?.[t],s=n.values[i]?.[r];if(a!==s)return true}return false}function Or(e,t,n){let o=[],r={};for(let i of Object.keys(e.values))r[i]=[];for(let i=0;i<e.entities.length;i++){let a=e.entities[i];if(!(a===void 0||n.includes(a))&&rc(e,i,t,a)){o.push(a);for(let s of Object.keys(e.values)){let l=e.values[s]?.[i];l!==void 0&&r[s]?.push(l);}}}return o.length===0?null:{name:e.name,entities:o,values:r}}function ic(e,t){let n={};for(let o of Object.keys(t.values))n[o]=[...e.values[o]||[],...t.values[o]||[]];return {name:e.name,entities:[...e.entities,...t.entities],values:n}}function Kr(e,t,n){let o=[],r={};for(let s of Object.keys(e.values))r[s]=[];for(let s=0;s<e.entities.length;s++){let l=e.entities[s];if(!(l===void 0||!t.includes(l))){o.push(l);for(let c of Object.keys(e.values)){let p=e.values[c]?.[s];p!==void 0&&r[c]?.push(p);}}}if(o.length===0)return;let i={name:e.name,entities:o,values:r},a=n.find(s=>s.name===e.name);if(a){let s=ic(a,i),l=n.indexOf(a);n[l]=s;}else n.push(i);}function Nr(e){let t=new Map;for(let n of e)t.set(n,n);return t}function Ur(e,t,n,o,r){for(let i of t)if(!r(e,i)){let a=o(e);for(;a!==i&&a<i;)a=o(e);n.set(i,a);}}function _r(e,t,n,o,r,i,a,s){if(!s(e,t))return;i(e,t,n.component)||a(e,t,n.component);let l=n.component;for(let c of n.fields){let p=o.values[c];if(!p||typeof p[r]>"u")continue;let u=l[c];u&&(u[t]=p[r]);}}var ac=z.record(z.string(),z.array(z.number())),zr=z.object({name:z.string(),entities:z.array(z.number()),values:ac}),kt=z.object({version:z.number().int().positive(),timestamp:z.number().int().nonnegative(),entityCount:z.number().int().nonnegative(),components:z.array(zr)}),Hr=z.object({baseTimestamp:z.number().int().nonnegative(),timestamp:z.number().int().nonnegative(),addedEntities:z.array(z.number()),removedEntities:z.array(z.number()),changedComponents:z.array(zr)}),xn=[];function sc(e){xn=e;}function lc(){return xn}var uc=1;function cc(e,t){let n=k$1(e),o=[];for(let i of t){let a=Wr(e,n,i,m);a&&o.push(a);}let r={version:uc,timestamp:Date.now(),entityCount:n.length,components:o};return kt.parse(r)}function dc(e){kt.parse(e);let t=f$2(),n=Mr(e),o=wr(t,n,h$1);for(let r of e.components){let i=xn.find(a=>a.name===r.name);if(!i)throw new Error(`Component ${r.name} not registered`);for(let a=0;a<r.entities.length;a++){let s=r.entities[a];if(s===void 0)continue;let l$1=o.get(s);l$1!==void 0&&(l(t,l$1,i.component),Lr(i.component,l$1,r.values,a,i.fields));}}return t}function fc(e,t){kt.parse(e),kt.parse(t);let n=En(e),o=En(t),{added:r,removed:i}=Fr(n,o),a=[];for(let l of t.components){let c=e.components.find(u=>u.name===l.name),p=Or(l,c,r);p&&a.push(p);}for(let l of t.components)Kr(l,r,a);let s={baseTimestamp:e.timestamp,timestamp:t.timestamp,addedEntities:r,removedEntities:i,changedComponents:a};return Hr.parse(s)}function pc(e,t,n){Hr.parse(t);for(let i of t.removedEntities)j(e,i)&&i$2(e,i);let o=k$1(e),r=Nr(o);Ur(e,t.addedEntities,r,h$1,j);for(let i of t.changedComponents){let a=n.find(s=>s.name===i.name);if(!a)throw new Error(`Component ${i.name} not registered`);for(let s=0;s<i.entities.length;s++){let l$1=i.entities[s];if(l$1===void 0)continue;let c=r.get(l$1)||l$1;_r(e,c,a,i,s,m,l,j);}}return e}function jr(e,t){return o(e,t)?{h:2,v:2}:{h:0,v:0}}function At(e,t){let n=jr(e,t),o=h$2(e,t)?i$4(e,t):0;return n.h+o}function Vr(e,t){let n=jr(e,t),o=h$2(e,t)?j$1(e,t):0;return n.v+o}function Gr(e,t){if(!l$1(e,t))return At(e,t);let n=f$3(e,t);if(!n)return At(e,t);let o=n.split(`
3
- `),r=0;for(let i of o){let a=b$3(i);a>r&&(r=a);}return r+At(e,t)}function Yr(e,t,n){if(!l$1(e,t))return Vr(e,t);let o=f$3(e,t),r=At(e,t),i=n?n-r:void 0,a;return i&&i>0?a=f$4(o,{width:i,wrap:true}).length:a=o.split(`
4
- `).length,a+Vr(e,t)}function Sn(e,t){let n=Gr(e,t),o=Yr(e,t,n);return {width:n,height:o}}function mc(e,t){if(!ea$1(e,t)||!fa$1(e,t))return false;let n=Sn(e,t),o=$.minWidth[t],r=$.minHeight[t],i=$.maxWidth[t],a=$.maxHeight[t],s=Math.min(Math.max(n.width,o),i),l=Math.min(Math.max(n.height,r),a);return $.width[t]=s,$.height[t]=l,true}function yc(e,t){if(!fa$1(e,t))return;let n=Sn(e,t),o=$.minWidth[t],r=$.minHeight[t],i=$.maxWidth[t],a=$.maxHeight[t];return {width:Math.min(Math.max(n.width,o),i),height:Math.min(Math.max(n.height,r),a)}}var Zr=["fg","bold","underline","blink","inverse"],gc=["bg","transparent"],we=new Map,Je=0;function bc(){return Je}function hc(e){we.delete(e);}function vc(){Je++,we.clear();}function Ec(){we.clear();}function xc(e){let t=we.get(e);return t!==void 0&&t.timestamp===Je}function Me(e,t){return R$1(e,t)?{fg:I.fg[t],bg:I.bg[t],bold:I.bold[t]===1,underline:I.underline[t]===1,blink:I.blink[t]===1,inverse:I.inverse[t]===1,transparent:I.transparent[t]===1,opacity:I.opacity[t]??1}:Tn()}function Tn(){return {fg:G,bg:0,bold:false,underline:false,blink:false,inverse:false,transparent:false,opacity:1}}function Dn(e,t){return {fg:t.fg!==G?t.fg:e.fg,bold:t.bold||e.bold,underline:t.underline||e.underline,blink:t.blink||e.blink,inverse:t.inverse||e.inverse,bg:t.bg,transparent:t.transparent,opacity:t.opacity}}function Sc(e){return e===G||e===0}function Ze(e,t){let n=we.get(t);if(n!==void 0&&n.timestamp===Je)return n.style;let o=Me(e,t);if(!k$2(e,t))return Cn(t,o),o;let r=g$1(e,t);if(r.length===0)return Cn(t,o),o;let i=Cc(e,r,o);return Cn(t,i),i}function Cc(e,t,n){let o=Me(e,t[t.length-1]);for(let r=t.length-2;r>=0;r--){let i=Me(e,t[r]);o=Dn(o,i);}return Dn(o,n)}function Cn(e,t){we.set(e,{style:t,timestamp:Je});}function Dc(e,t){return Ze(e,t)}function Tc(e){return Zr.includes(e)}function Pc(e,t,n){return Ze(e,t)[n]}function kc(e,t,n){let o=Me(e,t);if(Jr(o,n))return t;if(!k$2(e,t))return 0;let r=g$1(e,t);for(let i of r){let a=Me(e,i);if(Jr(a,n))return i}return 0}function Jr(e,t){let n=Tn();switch(t){case "fg":return e.fg!==n.fg;case "bg":return e.bg!==n.bg;case "bold":return e.bold!==n.bold;case "underline":return e.underline!==n.underline;case "blink":return e.blink!==n.blink;case "inverse":return e.inverse!==n.inverse;case "transparent":return e.transparent!==n.transparent;default:return false}}function Ac(e,t){for(let n of t)Ze(e,n);}function Ic(e,t){let n=new Map;for(let o of t)n.set(o,Ze(e,o));return n}var oe={TERMINAL_TOO_SMALL:"terminal-too-small",UNSUPPORTED_CAPABILITY:"unsupported-capability",DEPRECATED_API:"deprecated-api",PERFORMANCE_ISSUE:"performance-issue"},$r=z.object({width:z.number().int().nonnegative(),height:z.number().int().nonnegative(),minWidth:z.number().int().positive(),minHeight:z.number().int().positive()}),Xr=z.object({capability:z.string(),fallback:z.string().optional()}),qr=z.object({api:z.string(),replacement:z.string(),since:z.string()}),Qr=z.object({metric:z.string(),value:z.number(),threshold:z.number(),frameTime:z.number().optional()}),$e=z.object({type:z.enum([oe.TERMINAL_TOO_SMALL,oe.UNSUPPORTED_CAPABILITY,oe.DEPRECATED_API,oe.PERFORMANCE_ISSUE]),message:z.string(),metadata:z.union([$r,Xr,qr,Qr]),timestamp:z.number()});function Rc(){return a$3()}function Bc(e,t,n,o,r){let i={width:t,height:n,minWidth:o,minHeight:r},a={type:oe.TERMINAL_TOO_SMALL,message:`Terminal size (${t}x${n}) is smaller than recommended (${o}x${r})`,metadata:i,timestamp:Date.now()};e.emit("warning",$e.parse(a));}function Wc(e,t,n){let o={capability:t,fallback:n},r={type:oe.UNSUPPORTED_CAPABILITY,message:`Terminal capability '${t}' is not supported${n?`. ${n}`:""}`,metadata:o,timestamp:Date.now()};e.emit("warning",$e.parse(r));}function Mc(e,t,n,o){let r={api:t,replacement:n,since:o},i={type:oe.DEPRECATED_API,message:`API '${t}' is deprecated since ${o}. Use '${n}' instead.`,metadata:r,timestamp:Date.now()};e.emit("warning",$e.parse(i));}function wc(e,t,n,o,r){let i={metric:t,value:n,threshold:o,frameTime:r},a={type:oe.PERFORMANCE_ISSUE,message:`Performance issue: ${t} (${n.toFixed(2)}) exceeds threshold (${o.toFixed(2)})`,metadata:i,timestamp:Date.now()};e.emit("warning",$e.parse(a));}export{er as $,_t as $a,uo as $b,gs as $c,Er as $d,sc as $e,oo as A,qs as Aa,Di as Ab,go as Ac,dn as Ad,Iu as Ae,Ac as Af,Jt as B,Qs as Ba,ze as Bb,bo as Bc,Ll as Bd,Ru as Be,Ic as Bf,ut as C,el as Ca,Ti as Cb,bt as Cc,Fl as Cd,Bu as Ce,oe as Cf,ro as D,tl as Da,Pi as Db,qa as Dc,Ol as Dd,Wu as De,$r as Df,Ui as E,Re as Ea,ki as Eb,ho as Ec,Kl as Ed,Mu as Ee,Xr as Ef,_i as F,nl as Fa,st as Fb,ht as Fc,_l as Fd,Tt as Fe,qr as Ff,zi as G,ol as Ga,Ai as Gb,vo as Gc,zl as Gd,Lu as Ge,Qr as Gf,Zt as H,Ge as Ha,Ii as Hb,Qa as Hc,Hl as Hd,bn as He,$e as Hf,Hi as I,un as Ia,Ri as Ib,es as Ic,Vl as Id,Fu as Ie,Rc as If,S as J,al as Ja,Wi as Jb,ts as Jc,jl as Jd,Ou as Je,Bc as Jf,vs as K,sl as Ka,Mi as Kb,ns as Kc,yr as Kd,Ku as Ke,Wc as Kf,Es as L,ll as La,wi as Lb,os as Lc,Gl as Ld,Nu as Le,Mc as Lf,xs as M,ul as Ma,Li as Mb,rs as Mc,pn as Md,Uu as Me,wc as Mf,Ss as N,cl as Na,Fi as Nb,is as Nc,Ql as Nd,Br as Ne,Cs as O,dl as Oa,Oi as Ob,as as Oc,br as Od,_u as Oe,Ds as P,fl as Pa,Ki as Pb,rn as Pc,eu as Pd,zu as Pe,Ts as Q,jn as Qa,Vi as Qb,an as Qc,tu as Qd,Hu as Qe,Ps as R,Gn as Ra,ct as Rb,ss as Rc,nu as Rd,Vu as Re,ks as S,Yn as Sa,qt as Sb,ls as Sc,ou as Sd,ju as Se,sn as T,Jn as Ta,Gi as Tb,us as Tc,ru as Td,Gu as Te,As as U,ti as Ua,Yi as Ub,cs as Uc,hr as Ud,Yu as Ue,Is as V,ni as Va,Ji as Vb,ds as Vc,iu as Vd,Ju as Ve,Pe as W,Zn as Wa,Zi as Wb,fs as Wc,au as Wd,Zu as We,Rs as X,Ut as Xa,$i as Xb,Xo as Xc,su as Xd,ec as Xe,Bs as Y,$n as Ya,Xi as Yb,qo as Yc,lu as Yd,tc as Ye,Ws as Z,ri as Za,qi as Zb,ps as Zc,uu as Zd,nc as Ze,Ms as _,ii as _a,Qi as _b,Qo as _c,cu as _d,oc as _e,ee as a,ws as aa,Xn as ab,ea as ac,bs as ad,du as ae,lc as af,en as b,Ls as ba,qn as bb,ta as bc,hs as bd,fu as be,cc as bf,Ta as c,Fs as ca,Qn as cb,na as cc,ar as cd,xr as ce,dc as cf,Pa as d,tr as da,ai as db,dt as dc,sr as dd,pu as de,fc as df,ka as e,Os as ea,si as eb,co as ec,yl as ed,mu as ee,pc as ef,Aa as f,Ks as fa,li as fb,oa as fc,gl as fd,yu as fe,Gr as ff,Ia as g,Ns as ga,zt as gb,ra as gc,ur as gd,gu as ge,Yr as gf,Ra as h,Us as ha,Ht as hb,ia as hc,hl as hd,bu as he,Sn as hf,tn as i,_s as ia,Q as ib,pt as ic,vl as id,hu as ie,mc as if,Ba as j,zs as ja,ui as jb,ga as jc,dr as jd,Cr as je,yc as jf,Wa as k,R as ka,Vt as kb,ba as kc,fr as kd,vu as ke,Zr as kf,Ma as l,vt as la,jt as lb,ha as lc,El as ld,Dr as le,gc as lf,wa as m,Et as ma,ci as mb,va as mc,xl as md,Eu as me,bc as mf,La as n,h as na,pi as nb,Ea as nc,Sl as nd,Tr as ne,hc as nf,Fa as o,ke as oa,mi as ob,xa as oc,Cl as od,Pr as oe,vc as of,Oa as p,Vs as pa,yi as pb,Sa as pc,Dl as pd,kr as pe,Ec as pf,fo as q,xt as qa,gi as qb,Ca as qc,Tl as qd,Ar as qe,xc as qf,po as r,js as ra,bi as rb,Da as rc,Pl as rd,Ir as re,Me as rf,Ka as s,Gs as sa,hi as sb,Te as sc,kl as sd,xu as se,Tn as sf,Na as t,Ys as ta,vi as tb,Ga as tc,Al as td,Su as te,Dn as tf,Ua as u,Js as ua,se as ub,Ya as uc,Il as ud,Cu as ue,Sc as uf,_a as v,Zs as va,T as vb,Ja as vc,Rl as vd,Du as ve,Ze as vf,za as w,$s as wa,xi as wb,Za as wc,Bl as wd,Tu as we,Dc as wf,Ha as x,or as xa,Si as xb,mo as xc,Wl as xd,Pu as xe,Tc as xf,Va as y,rr as ya,at as yb,yo as yc,Ml as yd,ku as ye,Pc as yf,lt as z,Xs as za,Ci as zb,gt as zc,wl as zd,Au as ze,kc as zf};
@@ -1 +0,0 @@
1
- import {r,m as m$1,l as l$1,v as v$1}from'./chunk-7ZFQO3OQ.js';import {i as i$1,c as c$1,e,a as a$1,b}from'./chunk-Z4EZERNE.js';var I=1e4,a=0,i={parent:new Uint32Array(I),firstChild:new Uint32Array(I),nextSibling:new Uint32Array(I),prevSibling:new Uint32Array(I),childCount:new Uint16Array(I),depth:new Uint16Array(I)};function et(n){i.parent[n]=a,i.firstChild[n]=a,i.nextSibling[n]=a,i.prevSibling[n]=a,i.childCount[n]=0,i.depth[n]=0;}function C(n,t){m$1(n,t,i)||(l$1(n,t,i),et(t));}function v(n,t){i.depth[n]=t;let r=i.firstChild[n];for(;r!==a;)v(r,t+1),r=i.nextSibling[r];}function _(n,t,r){C(n,t),r!==a&&C(n,r);let e=i.parent[t];return e===r||(e!==a&&P(t,e),r!==a?it(t,r):(i.parent[t]=a,v(t,0))),t}function P(n,t){let r=i.prevSibling[n],e=i.nextSibling[n];r!==a?i.nextSibling[r]=e:i.firstChild[t]=e,e!==a&&(i.prevSibling[e]=r),i.prevSibling[n]=a,i.nextSibling[n]=a,i.childCount[t]=i.childCount[t]-1;}function it(n,t){i.parent[n]=t;let r=i.firstChild[t];if(r===a)i.firstChild[t]=n;else {let o=r;for(;i.nextSibling[o]!==a;)o=i.nextSibling[o];i.nextSibling[o]=n,i.prevSibling[n]=o;}i.childCount[t]=i.childCount[t]+1;let e=i.depth[t];v(n,e+1);}function ot(n,t,r){return _(n,r,t),t}function Wt(n,t,r){return !m$1(n,r,i)||i.parent[r]!==t||_(n,r,a),t}function Ct(n,t){if(!m$1(n,t,i))return [];let r=[],e=i.firstChild[t];for(;e!==a;)r.push(e),e=i.nextSibling[e];return r}function V(n,t){if(!m$1(n,t,i))return [];let r=[],e=i.parent[t];for(;e!==a;)r.push(e),e=i.parent[e];return r}function St(n,t){if(!m$1(n,t,i))return [];let r=[],e=[],o=i.firstChild[t];for(;o!==a;)e.push(o),o=i.nextSibling[o];for(;e.length>0;){let f=e.pop();r.push(f);let b=[],E=i.firstChild[f];for(;E!==a;)b.push(E),E=i.nextSibling[E];for(let h=b.length-1;h>=0;h--)e.push(b[h]);}return r}function B(n,t){return m$1(n,t,i)?i.parent[t]:a}function It(n,t){if(m$1(n,t,i))return {parent:i.parent[t],firstChild:i.firstChild[t],nextSibling:i.nextSibling[t],prevSibling:i.prevSibling[t],childCount:i.childCount[t],depth:i.depth[t]}}function M(n,t){return m$1(n,t,i)}function Z(n,t){return m$1(n,t,i)?i.parent[t]===a:true}function vt(n,t){return m$1(n,t,i)?i.childCount[t]===0:true}function At(n,t){return m$1(n,t,i)?i.depth[t]:0}function Ft(n,t){return m$1(n,t,i)?i.nextSibling[t]:a}function Dt(n,t){return m$1(n,t,i)?i.prevSibling[t]:a}function ut(n,t,r){C(n,r),C(n,t);let e=i.parent[r];e!==a&&P(r,e);let o=i.firstChild[t];i.parent[r]=t,i.firstChild[t]=r,i.prevSibling[r]=a,i.nextSibling[r]=o,o!==a&&(i.prevSibling[o]=r),i.childCount[t]=i.childCount[t]+1;let f=i.depth[t];return v(r,f+1),t}function Tt(n,t,r,e){C(n,t);let o=i.childCount[t],f=e;if(f<0&&(f=Math.max(0,o+f)),f>=o)return ot(n,t,r);if(f===0)return ut(n,t,r);let b=i.firstChild[t];for(let E=0;E<f;E++)b=i.nextSibling[b];return at(n,r,b)}function at(n,t,r){if(!m$1(n,r,i))return t;let e=i.parent[r];if(e===a)return t;C(n,t);let o=i.parent[t];o!==a&&P(t,o);let f=i.prevSibling[r];i.parent[t]=e,i.prevSibling[t]=f,i.nextSibling[t]=r,i.prevSibling[r]=t,f!==a?i.nextSibling[f]=t:i.firstChild[e]=t,i.childCount[e]=i.childCount[e]+1;let b=i.depth[e];return v(t,b+1),t}function Pt(n,t,r){if(!m$1(n,r,i))return t;let e=i.parent[r];if(e===a)return t;C(n,t);let o=i.parent[t];o!==a&&P(t,o);let f=i.nextSibling[r];i.parent[t]=e,i.prevSibling[t]=r,i.nextSibling[t]=f,i.nextSibling[r]=t,f!==a&&(i.prevSibling[f]=t),i.childCount[e]=i.childCount[e]+1;let b=i.depth[e];return v(t,b+1),t}function kt(n,t){return _(n,t,a)}function Ut(n,t){if(!m$1(n,t,i))return a;let r=i.firstChild[t];if(r===a)return a;for(;i.nextSibling[r]!==a;)r=i.nextSibling[r];return r}function Ht(n,t){return m$1(n,t,i)?i.firstChild[t]:a}function Ot(n,t){if(!m$1(n,t,i))return -1;let r=i.parent[t];if(r===a)return -1;let e=0,o=i.firstChild[r];for(;o!==a;){if(o===t)return e;e++,o=i.nextSibling[o];}return -1}function Nt(n,t,r){if(!m$1(n,t,i)||r<0)return a;let e=i.firstChild[t];for(let o=0;o<r&&e!==a;o++)e=i.nextSibling[e];return e}function q(n,t){let r=[],e=i.firstChild[n];for(;e!==a;)r.push({entity:e,depth:t}),e=i.nextSibling[e];return r}function J(n,t){for(let r=n.length-1;r>=0;r--){let e=n[r];e&&t.push(e);}}function zt(n,t,r){if(!m$1(n,t,i))return true;let e=[],o=i.depth[t]??0,f=q(t,o+1);for(J(f,e);e.length>0;){let b=e.pop();if(!b)continue;let{entity:E,depth:h}=b;if(r(E,h-o)===false)return false;let rt=q(E,h+1);J(rt,e);}return true}function wt(n,t,r){if(!m$1(n,t,i))return true;let e=1,o=i.parent[t];for(;o!==a;){if(r(o,e)===false)return false;o=i.parent[o],e++;}return true}function st(n,t,r){if(!m$1(n,t,i)||!m$1(n,r,i)||t===r)return false;let e=i.parent[r];for(;e!==a;){if(e===t)return true;e=i.parent[e];}return false}function _t(n,t,r){return st(n,r,t)}function Vt(n,t){if(!m$1(n,t,i))return t;let r=t,e=i.parent[r];for(;e!==a;)r=e,e=i.parent[r];return r}function Bt(n,t,r){if(!m$1(n,t,i)||!m$1(n,r,i))return a;let e=new Set;e.add(t);let o=i.parent[t];for(;o!==a;)e.add(o),o=i.parent[o];if(e.has(r))return r;for(o=i.parent[r];o!==a;){if(e.has(o))return o;o=i.parent[o];}return a}function Mt(n,t){if(!m$1(n,t,i))return [];let r=i.parent[t];if(r===a)return [];let e=[],o=i.firstChild[r];for(;o!==a;)o!==t&&e.push(o),o=i.nextSibling[o];return e}var x=1e4,ft=r(255,255,255),lt=r(0,0,0,0),s={visible:new Uint8Array(x),dirty:new Uint8Array(x),fg:new Uint32Array(x),bg:new Uint32Array(x),bold:new Uint8Array(x),underline:new Uint8Array(x),blink:new Uint8Array(x),inverse:new Uint8Array(x),transparent:new Uint8Array(x),opacity:new Uint8Array(x)};function yt(n){s.visible[n]=1,s.dirty[n]=1,s.fg[n]=ft,s.bg[n]=lt,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 R(n,t){m$1(n,t,s)||(l$1(n,t,s),yt(t));}function qt(n,t,r){return i$1.parse(r),R(n,t),Et(t,r),s.dirty[t]=1,t}function ct(n,t){t.fg!==void 0&&(s.fg[n]=v$1(t.fg)),t.bg!==void 0&&(s.bg[n]=v$1(t.bg));}function F(n,t,r){r!==void 0&&(t[n]=r?1:0);}function bt(n,t){if(F(n,s.bold,t.bold),F(n,s.underline,t.underline),F(n,s.blink,t.blink),F(n,s.inverse,t.inverse),F(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 Et(n,t){ct(n,t),bt(n,t);}function Jt(n,t){if(m$1(n,t,s))return {fg:s.fg[t],bg:s.bg[t],bold:s.bold[t]===1,underline:s.underline[t]===1,blink:s.blink[t]===1,inverse:s.inverse[t]===1,transparent:s.transparent[t]===1,opacity:s.opacity[t]/255}}function Qt(n,t){if(m$1(n,t,s))return {visible:s.visible[t]===1,dirty:s.dirty[t]===1,fg:s.fg[t],bg:s.bg[t],bold:s.bold[t]===1,underline:s.underline[t]===1,blink:s.blink[t]===1,inverse:s.inverse[t]===1,transparent:s.transparent[t]===1,opacity:s.opacity[t]/255}}function Xt(n,t){return R(n,t),s.dirty[t]=1,t}function tn(n,t){return m$1(n,t,s)&&(s.dirty[t]=0),t}function nn(n,t){return m$1(n,t,s)?s.dirty[t]===1:false}function Y(n,t,r){R(n,t);let e=s.visible[t]===1;return s.visible[t]=r?1:0,e!==r&&(s.dirty[t]=1),t}function L(n,t){return m$1(n,t,s)?s.visible[t]===1:false}function rn(n,t){return m$1(n,t,s)}function en(n,t){return Y(n,t,true)}function on(n,t){return Y(n,t,false)}function un(n,t){let r=L(n,t);return Y(n,t,!r)}function an(n,t){if(!L(n,t))return false;if(!M(n,t))return true;let r=V(n,t);for(let e of r)if(!L(n,e))return false;return true}function sn(n,t){if(!M(n,t)||Z(n,t))return false;let r=V(n,t);if(r.length===0)return true;let e=r[r.length-1];return e===void 0?true:!Z(n,e)}var S=1e4,d=-1;function pt(n){return -(n+2)}function X(n){if(n>=d)return null;let t=-(n+2);return t===0?0:t}function bn(n){return n<d}var y={width:new Float32Array(S),height:new Float32Array(S),minWidth:new Float32Array(S),minHeight:new Float32Array(S),maxWidth:new Float32Array(S),maxHeight:new Float32Array(S),shrink:new Uint8Array(S)};function Q(n){if(n==="auto")return d;if(typeof n=="string"){let t=Number.parseFloat(n);return pt(t)}return n}function En(n,t,r,e){return c$1.parse(r),c$1.parse(e),m$1(n,t,y)||(l$1(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]=Q(r),y.height[t]=Q(e),t}function k(n,t){if(m$1(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 pn(n,t,r){return e.parse(r),m$1(n,t,y)||(l$1(n,t,y),y.width[t]=d,y.height[t]=d,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 mn(n,t,r){return m$1(n,t,y)||(l$1(n,t,y),y.width[t]=d,y.height[t]=d,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 xn(n,t){return m$1(n,t,y)?y.shrink[t]===1:false}function hn(n,t){return m$1(n,t,y)}function gn(n,t,r){if(!m$1(n,t,y))return;let e=y.width[t];if(e===d)return;let o=X(e);return o!==null?o/100*r:e}function dn(n,t,r){if(!m$1(n,t,y))return;let e=y.height[t];if(e===d)return;let o=X(e);return o!==null?o/100*r:e}var D=1e4,mt=4294967295,xt=0,c={focusable:new Uint8Array(D),focused:new Uint8Array(D),tabIndex:new Int16Array(D),focusEffectFg:new Uint32Array(D),focusEffectBg:new Uint32Array(D)},m=null;function ht(n){c.focusable[n]=1,c.focused[n]=0,c.tabIndex[n]=0,c.focusEffectFg[n]=mt,c.focusEffectBg[n]=xt;}function U(n,t){m$1(n,t,c)||(l$1(n,t,c),ht(t));}function Sn(n,t,r){return U(n,t),r.focusable!==void 0&&(c.focusable[t]=r.focusable?1:0),r.tabIndex!==void 0&&(c.tabIndex[t]=r.tabIndex),r.focusEffectFg!==void 0&&(c.focusEffectFg[t]=r.focusEffectFg),r.focusEffectBg!==void 0&&(c.focusEffectBg[t]=r.focusEffectBg),t}function In(n,t,r){return U(n,t),c.focusable[t]=r?1:0,t}function vn(n,t){return m$1(n,t,c)?c.focused[t]===1:false}function An(n,t){return m$1(n,t,c)?c.focusable[t]===1:false}function tt(n,t){return U(n,t),c.focusable[t]!==1||(m!==null&&m!==t&&m$1(n,m,c)&&(c.focused[m]=0),c.focused[t]=1,m=t),t}function Fn(n,t){return m$1(n,t,c)&&(c.focused[t]=0,m===t&&(m=null)),t}function Dn(n,t){if(m$1(n,t,c))return {focusable:c.focusable[t]===1,focused:c.focused[t]===1,tabIndex:c.tabIndex[t],focusEffectFg:c.focusEffectFg[t],focusEffectBg:c.focusEffectBg[t]}}function Tn(n,t){return m$1(n,t,c)}function Pn(){return m}function kn(n,t,r){return U(n,t),c.tabIndex[t]=r,t}function Un(n,t){return m$1(n,t,c)?c.tabIndex[t]:-1}function gt(n,t){return m$1(n,t,c)?c.tabIndex[t]>=0&&c.focusable[t]===1:false}function nt(n,t){return t.filter(r=>gt(n,r)).sort((r,e)=>c.tabIndex[r]-c.tabIndex[e])}function Hn(n,t){let r=nt(n,t);if(r.length===0)return null;let o=((m!==null?r.indexOf(m):-1)+1)%r.length,f=r[o];return f!==void 0?(tt(n,f),f):null}function On(n,t){let r=nt(n,t);if(r.length===0)return null;let o=((m!==null?r.indexOf(m):0)-1+r.length)%r.length,f=r[o];return f!==void 0?(tt(n,f),f):null}function Nn(){m=null;}var H=1e4,l={x:new Float32Array(H),y:new Float32Array(H),z:new Uint16Array(H),absolute:new Uint8Array(H)};function W(n,t,r,e,o=0){return a$1.parse({x:r,y:e,z:o}),m$1(n,t,l)||(l$1(n,t,l),l.absolute[t]=0),l.x[t]=r,l.y[t]=e,l.z[t]=o,t}function Mn(n,t){if(m$1(n,t,l))return {x:l.x[t],y:l.y[t],z:l.z[t],absolute:l.absolute[t]===1}}function Zn(n,t,r){return m$1(n,t,l)||(l$1(n,t,l),l.x[t]=0,l.y[t]=0,l.z[t]=0),l.absolute[t]=r?1:0,t}function Ln(n,t){return m$1(n,t,l)?l.absolute[t]===1:false}function Rn(n,t){return m$1(n,t,l)}function Yn(n,t,r,e){return m$1(n,t,l)||(l$1(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]+e,t}function A(n,t,r){return b.parse(r),m$1(n,t,l)||(l$1(n,t,l),l.x[t]=0,l.y[t]=0,l.absolute[t]=0),l.z[t]=r,t}function N(n,t){return m$1(n,t,l)?l.z[t]:0}function Gn(n,t,r){let e=0;for(let f of r)if(f!==t&&m$1(n,f,l)){let b=l.z[f];b>e&&(e=b);}let o=Math.min(e+1,65535);return A(n,t,o)}function Kn(n,t,r){let e=65535;for(let f of r)if(f!==t&&m$1(n,f,l)){let b=l.z[f];b<e&&(e=b);}let o=Math.max(e-1,0);return A(n,t,o)}function $n(n,t,r){let e=N(n,t),o=65535,f=false;for(let b of r)if(b!==t&&m$1(n,b,l)){let E=l.z[b];E>e&&E<o&&(o=E,f=true);}return f?A(n,t,Math.min(o+1,65535)):t}function jn(n,t,r){let e=N(n,t),o=0,f=false;for(let b of r)if(b!==t&&m$1(n,b,l)){let E=l.z[b];E<e&&E>o&&(o=E,f=true);}return f?A(n,t,Math.max(o-1,0)):t}function qn(n,t){let r=[];for(let e of t)m$1(n,e,l)&&r.push({entity:e,z:l.z[e]});r.sort((e,o)=>e.z-o.z);for(let e=0;e<r.length;e++){let o=r[e];o&&(l.z[o.entity]=e);}}function Jn(n,t,r){let e=N(n,t),o=N(n,r);A(n,t,o),A(n,r,e);}function Qn(n,t,r){if(!m$1(n,t,i)){let g=O(r,0,0,0,0);return W(n,t,g.x,g.y),t}let e=B(n,t);if(e===0){let g=O(r,0,0,0,0);return W(n,t,g.x,g.y),t}let o=k(n,e);if(!o){let g=O(r,0,0,0,0);return W(n,t,g.x,g.y),t}let f=k(n,t),b=f?.width??0,E=f?.height??0,h=O(r,o.width,o.height,b,E);return W(n,t,h.x,h.y),t}function O(n,t,r,e,o){switch(n){case "center":return {x:Math.floor((t-e)/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-e),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-e),y:Math.max(0,r-o)};default:return {x:0,y:0}}}function Xn(n,t,r,e){if(!m$1(n,t,i))return W(n,t,0,0),t;let o=B(n,t);if(o===0)return W(n,t,0,0),t;let f=k(n,o);if(!f)return W(n,t,0,0),t;let b=Math.floor(f.width*r/100),E=Math.floor(f.height*e/100);return W(n,t,b,E),t}export{y as $,wt as A,Nn as Aa,st as B,l as Ba,_t as C,W as Ca,Vt as D,Mn as Da,Bt as E,Zn as Ea,Mt as F,Ln as Fa,ft as G,Rn as Ga,lt as H,Yn as Ha,s as I,A as Ia,qt as J,N as Ja,Jt as K,Gn as Ka,Qt as L,Kn as La,Xt as M,$n as Ma,tn as N,jn as Na,nn as O,qn as Oa,Y as P,Jn as Pa,L as Q,Qn as Qa,rn as R,Xn as Ra,en as S,on as T,un as U,an as V,sn as W,d as X,pt as Y,X as Z,bn as _,a,En as aa,i as b,k as ba,_ as c,pn as ca,ot as d,mn as da,Wt as e,xn as ea,Ct as f,hn as fa,V as g,gn as ga,St as h,dn as ha,B as i,mt as ia,It as j,xt as ja,M as k,c as ka,Z as l,Sn as la,vt as m,In as ma,At as n,vn as na,Ft as o,An as oa,Dt as p,tt as pa,ut as q,Fn as qa,Tt as r,Dn as ra,at as s,Tn as sa,Pt as t,Pn as ta,kt as u,kn as ua,Ut as v,Un as va,Ht as w,gt as wa,Ot as x,nt as xa,Nt as y,Hn as ya,zt as z,On as za};
@@ -1 +0,0 @@
1
- import {Ba,Ga}from'./chunk-ETFDYZVJ.js';import {m,l,n}from'./chunk-7ZFQO3OQ.js';var x=1e4,M=(r=>(r[r.BOX=0]="BOX",r[r.CIRCLE=1]="CIRCLE",r))(M||{}),o={type:new Uint8Array(x),width:new Float32Array(x),height:new Float32Array(x),offsetX:new Float32Array(x),offsetY:new Float32Array(x),layer:new Uint16Array(x),mask:new Uint16Array(x),isTrigger:new Uint8Array(x)},k=1,w=65535;function B(t,n){o.type[n]=0,o.width[n]=1,o.height[n]=1,o.offsetX[n]=0,o.offsetY[n]=0,o.layer[n]=k,o.mask[n]=w,o.isTrigger[n]=0;}function H(t,n,r={}){return m(t,n,o)||(l(t,n,o),B(t,n)),r.type!==void 0&&(o.type[n]=r.type),r.width!==void 0&&(o.width[n]=r.width),r.height!==void 0&&(o.height[n]=r.height),r.offsetX!==void 0&&(o.offsetX[n]=r.offsetX),r.offsetY!==void 0&&(o.offsetY[n]=r.offsetY),r.layer!==void 0&&(o.layer[n]=r.layer),r.mask!==void 0&&(o.mask[n]=r.mask),r.isTrigger!==void 0&&(o.isTrigger[n]=r.isTrigger?1:0),n}function j(t,n){if(m(t,n,o))return {type:o.type[n],width:o.width[n],height:o.height[n],offsetX:o.offsetX[n],offsetY:o.offsetY[n],layer:o.layer[n],mask:o.mask[n],isTrigger:o.isTrigger[n]===1}}function z(t,n){return m(t,n,o)}function G(t,n$1){return m(t,n$1,o)&&n(t,n$1,o),n$1}function J(t,n,r){return m(t,n,o)||(l(t,n,o),B(t,n)),o.layer[n]=r,n}function N(t,n,r){return m(t,n,o)||(l(t,n,o),B(t,n)),o.mask[n]=r,n}function Q(t,n,r){return m(t,n,o)||(l(t,n,o),B(t,n)),o.isTrigger[n]=r?1:0,n}function Z(t,n){return m(t,n,o)?o.isTrigger[n]===1:false}function nn(t,n,r,a){return (n&r)!==0&&(a&t)!==0}function T(t,n,r,a){let f=o.type[n],y=o.width[n],c=o.height[n],m=o.offsetX[n],b=o.offsetY[n],l=r+m,A=a+b;if(f===1){let p=y/2;return {minX:l-p,minY:A-p,maxX:l+p,maxY:A+p}}let W=y/2,Y=c/2;return {minX:l-W,minY:A-Y,maxX:l+W,maxY:A+Y}}function D(t,n){return t.minX<n.maxX&&t.maxX>n.minX&&t.minY<n.maxY&&t.maxY>n.minY}function P(t,n,r,a,f,y){let c=a-t,m=f-n,b=c*c+m*m,l=r+y;return b<l*l}function V(t,n,r,a){let f=Math.max(a.minX,Math.min(t,a.maxX)),y=Math.max(a.minY,Math.min(n,a.maxY)),c=t-f,m=n-y;return c*c+m*m<r*r}function tn(t,n,r,a,f,y,c){let m=o.type[n],b=o.type[f],l=o.offsetX[n],A=o.offsetY[n],W=o.offsetX[f],Y=o.offsetY[f],p=r+l,v=a+A,S=y+W,F=c+Y;if(m===1&&b===1){let E=o.width[n]/2,h=o.width[f]/2;return P(p,v,E,S,F,h)}if(m===0&&b===0){let E=T(t,n,r,a),h=T(t,f,y,c);return D(E,h)}if(m===1&&b===0){let E=o.width[n]/2,h=T(t,f,y,c);return V(p,v,E,h)}if(m===0&&b===1){let E=T(t,n,r,a),h=o.width[f]/2;return V(S,F,h,E)}return false}function rn(t,n,r){return t<n?{entityA:t,entityB:n,isTrigger:r}:{entityA:n,entityB:t,isTrigger:r}}function en(t){return `${t.entityA}:${t.entityB}`}var g=1e4,e={x:new Float32Array(g),y:new Float32Array(g),maxSpeed:new Float32Array(g),friction:new Float32Array(g)};function X(t){e.x[t]=0,e.y[t]=0,e.maxSpeed[t]=0,e.friction[t]=0;}function fn(t,n,r,a){return m(t,n,e)||(l(t,n,e),X(n)),e.x[n]=r,e.y[n]=a,n}function yn(t,n,r){return m(t,n,e)||(l(t,n,e),X(n)),r.x!==void 0&&(e.x[n]=r.x),r.y!==void 0&&(e.y[n]=r.y),r.maxSpeed!==void 0&&(e.maxSpeed[n]=r.maxSpeed),r.friction!==void 0&&(e.friction[n]=r.friction),n}function mn(t,n){if(m(t,n,e))return {x:e.x[n],y:e.y[n],maxSpeed:e.maxSpeed[n],friction:e.friction[n]}}function I(t,n){return m(t,n,e)}function sn(t,n,r){return m(t,n,e)||(l(t,n,e),X(n)),e.maxSpeed[n]=r,n}function cn(t,n,r){return m(t,n,e)||(l(t,n,e),X(n)),e.friction[n]=Math.max(0,Math.min(1,r)),n}function ln(t,n,r,a){return m(t,n,e)||(l(t,n,e),X(n)),e.x[n]=e.x[n]+r,e.y[n]=e.y[n]+a,n}function bn(t,n){if(!m(t,n,e))return 0;let r=e.x[n],a=e.y[n];return Math.sqrt(r*r+a*a)}function xn(t,n){return m(t,n,e)&&(e.x[n]=0,e.y[n]=0),n}function pn(t,n){return m(t,n,e)&&(e.x[n]=0,e.y[n]=0,e.maxSpeed[n]=0,e.friction[n]=0),n}var i={x:new Float32Array(g),y:new Float32Array(g)};function U(t){i.x[t]=0,i.y[t]=0;}function En(t,n,r,a){return m(t,n,i)||(l(t,n,i),U(n)),i.x[n]=r,i.y[n]=a,n}function hn(t,n){if(m(t,n,i))return {x:i.x[n],y:i.y[n]}}function R(t,n){return m(t,n,i)}function An(t,n){return m(t,n,i)&&(i.x[n]=0,i.y[n]=0),n}function Cn(t,n){return m(t,n,i)&&(i.x[n]=0,i.y[n]=0),n}function q(t,n){i.x[t]===void 0||e.x[t]===void 0||(e.x[t]=e.x[t]+i.x[t]*n,e.y[t]=e.y[t]+i.y[t]*n);}function _(t,n){let r=e.friction[t];if(r<=0)return;let a=1-r*n;if(a<=0){e.x[t]=0,e.y[t]=0;return}e.x[t]=e.x[t]*a,e.y[t]=e.y[t]*a;}function K(t){let n=e.maxSpeed[t];if(n<=0)return;let r=e.x[t],a=e.y[t],f=Math.sqrt(r*r+a*a);if(f>n){let y=n/f;e.x[t]=r*y,e.y[t]=a*y;}}function $(t,n){Ba.x[t]===void 0||e.x[t]===void 0||(Ba.x[t]=Ba.x[t]+e.x[t]*n,Ba.y[t]=Ba.y[t]+e.y[t]*n);}function gn(t,n,r){I(t,n)&&(R(t,n)&&q(n,r),_(n,r),K(n),Ga(t,n)&&$(n,r));}export{cn as A,ln as B,bn as C,xn as D,pn as E,i as F,En as G,hn as H,R as I,An as J,Cn as K,q as L,_ as M,K as N,$ as O,gn as P,M as a,o as b,k as c,w as d,H as e,j as f,z as g,G as h,J as i,N as j,Q as k,Z as l,nn as m,T as n,D as o,P as p,V as q,tn as r,rn as s,en as t,e as u,fn as v,yn as w,mn as x,I as y,sn as z};
@@ -1 +0,0 @@
1
- import {f,c as c$2,e}from'./chunk-4LWWONFK.js';import {k as k$1,m as m$2,p,s,i,c as c$3,n as n$1,r as r$1}from'./chunk-GRMSEMU7.js';import {a as a$2,e as e$1,r,t,o as o$2}from'./chunk-C5PCEQ6G.js';import {a as a$1,h,o as o$3}from'./chunk-VIT4KE6Q.js';import {c as c$4,a as a$3}from'./chunk-ZL46COQF.js';import {c as c$1,u,o as o$1,m as m$3,p as p$2,k as k$2}from'./chunk-K2QWNDXV.js';import {p as p$1,n,k as k$3}from'./chunk-EOFT3PNU.js';import {Ba,$,ka,K as K$1,V,O,I,ta,za,ya,N,oa,pa}from'./chunk-ETFDYZVJ.js';import {m as m$1,o,a as a$4}from'./chunk-7ZFQO3OQ.js';var l={eventQueue:[],capturedEntity:null,lastMouseX:0,lastMouseY:0,lastHoveredEntity:null,eventBus:a$1()};function Oe(){l.eventQueue=[],l.capturedEntity=null,l.lastMouseX=0,l.lastMouseY=0,l.lastHoveredEntity=null;}function De(t){l.eventQueue.push({type:"key",event:t,timestamp:Date.now()});}function Ne(t){l.eventQueue.push({type:"mouse",event:t,timestamp:Date.now()});}function Te(){return l.eventQueue}function Me(){l.eventQueue=[];}function ke(){return l.eventBus}function We(t){l.capturedEntity=t;}function Dt(){l.capturedEntity=null;}function $e(){return l.capturedEntity!==null}function Pe(){return l.capturedEntity}function Nt(t,e,n,r){return !m$1(t,e,Ba)||!m$1(t,e,$)?false:gt(e,n,r)}function gt(t,e,n){let r=Ba.x[t]??0,o=Ba.y[t]??0,u=$.width[t]??0,i=$.height[t]??0;return u<=0||i<=0?false:e>=r&&e<r+u&&n>=o&&n<o+i}function Ae(t,e,n){let r=[],o$1=o(t,[Ba,$]);for(let u of o$1){if(!Nt(t,u,e,n))continue;let i=Ba.x[u]??0,s=Ba.y[u]??0,p=Ba.z[u]??0;r.push({entity:u,localX:e-i,localY:n-s,zIndex:p});}return r.sort((u,i)=>i.zIndex-u.zIndex),r}function Tt(t,e,n){let r=null,o$1=Number.NEGATIVE_INFINITY;for(let u of o(t,[Ba,$,c$1])){if(!gt(u,e,n))continue;let i=Ba.z[u]??0;i<o$1||(o$1=i,r=u);}return r}function Mt(t){switch(t){case "left":return c$3.LEFT;case "middle":return c$3.MIDDLE;case "right":return c$3.RIGHT;case "wheelUp":return c$3.WHEEL_UP;case "wheelDown":return c$3.WHEEL_DOWN;default:return c$3.NONE}}function kt(t,e){let n=ta();if(e.name==="tab"){let r=Array.from(o(t,[ka]));e.shift?za(t,r):ya(t,r);return}if(n!==null){let r=e.raw.length>0?e.raw[0]??0:0;i(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 Wt(t,e,n,r,o){e!==n&&(e!==null&&u(t,e)&&(o$1(t,e,false),l.eventBus.emit("mouseleave",{x:r,y:o})),n!==null&&u(t,n)&&m$3(t,n)&&(o$1(t,n,true),l.eventBus.emit("mouseenter",{x:r,y:o})),l.lastHoveredEntity=n);}function $t(t,e,n,r,o){p(t,e)&&(n$1(t,e,{x:n,y:r,button:o,pressed:true}),r$1(t,e,n,r,o)),u(t,e)&&p$2(t,e,true),l.eventBus.emit("mousedown",{x:n,y:r,button:o}),oa(t,e)&&pa(t,e);}function Pt(t,e,n,r,o){p(t,e)&&n$1(t,e,{x:n,y:r,button:o,pressed:false}),u(t,e)&&p$2(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&&Dt();}function At(t,e){let n=e.x,r=e.y,o=Mt(e.button);l.lastMouseX=n,l.lastMouseY=r;let u=l.capturedEntity;if(u===null&&(u=Tt(t,n,r)),Wt(t,l.lastHoveredEntity,u,n,r),l.eventBus.emit("mousemove",{x:n,y:r}),u!==null)switch(e.action){case "press":$t(t,u,n,r,o);break;case "release":Pt(t,u,n,r,o);break;case "move":p(t,u)&&n$1(t,u,{x:n,y:r});break;case "wheel":{let i=o===c$3.WHEEL_UP?"up":"down";l.eventBus.emit("scroll",{direction:i,amount:1});break}}}var Et=t=>{let e=l.eventQueue;l.eventQueue=[];for(let n of e)n.type==="key"?kt(t,n.event):n.type==="mouse"&&At(t,n.event);return t};function Le(){return Et}function He(t,e=0){t.registerInputSystem(Et,e);}function Ke(t,e){k$1(t,e)&&m$2(t,e),p(t,e)&&s(t,e);}var P=[];function Fe(t){P.length=0;let e=new Set;for(let n of o(t,[c$1]))e.has(n)||(e.add(n),P.push(n));for(let n of o(t,[ka]))e.has(n)||(e.add(n),P.push(n));return P}var c="\x1B[",y={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 xt(){return {lastX:-1,lastY:-1,lastFg:-1,lastBg:-1,lastAttrs:-1,alternateScreen:false,mouseTracking:false,mouseMode:null,syncOutput:false,bracketedPaste:false,focusReporting:false}}function L(t){return a$4(t,"output:colorCache")}function x(...t){return `${c}${t.join(";")}m`}function vt(t,e){return `${c}${e+1};${t+1}H`}function Lt(t){return `${c}${t+1}G`}function Ht(t){return t===1?`${c}C`:`${c}${t}C`}function Bt(t){return {a:t>>>24&255,r:t>>>16&255,g:t>>>8&255,b:t&255}}function Kt(t,e){let n=e|4294967296,r=L(t).get(n);if(r!==void 0)return r;let{r:o,g:u,b:i,a:s}=Bt(e),p=s===0?x(39):x(y.FG_256,2,o,u,i);return L(t).set(n,p),p}function Ft(t,e){let n=L(t).get(e);if(n!==void 0)return n;let{r,g:o,b:u,a:i}=Bt(e),s=i===0?x(49):x(y.BG_256,2,r,o,u);return L(t).set(e,s),s}function wt(t){let e=[];return t===a$2.NONE||(t&a$2.BOLD&&e.push(y.BOLD),t&a$2.DIM&&e.push(y.DIM),t&a$2.ITALIC&&e.push(y.ITALIC),t&a$2.UNDERLINE&&e.push(y.UNDERLINE),t&a$2.BLINK&&e.push(y.BLINK),t&a$2.INVERSE&&e.push(y.INVERSE),t&a$2.HIDDEN&&e.push(y.HIDDEN),t&a$2.STRIKETHROUGH&&e.push(y.STRIKETHROUGH),e.length===0)?"":x(...e)}function St(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?Ht(r):Lt(e)}return vt(e,n)}function Ct(t,e,n){let r="";return e.lastAttrs!==-1&&e.lastAttrs!==a$2.NONE&&n.attrs===a$2.NONE&&(r+=x(y.RESET),e.lastFg=-1,e.lastBg=-1,e.lastAttrs=-1),n.attrs!==e.lastAttrs&&n.attrs!==a$2.NONE?(e.lastAttrs!==-1&&e.lastAttrs!==a$2.NONE&&(r+=x(y.RESET),e.lastFg=-1,e.lastBg=-1),r+=wt(n.attrs),e.lastAttrs=n.attrs):n.attrs===a$2.NONE&&e.lastAttrs===-1&&(e.lastAttrs=a$2.NONE),n.fg!==e.lastFg&&(r+=Kt(t,n.fg),e.lastFg=n.fg),n.bg!==e.lastBg&&(r+=Ft(t,n.bg),e.lastBg=n.bg),r}function Qt(t,e,n){let{x:r,y:o,cell:u}=n,i="";return i+=St(e,r,o),i+=Ct(t,e,u),i+=u.char,e.lastX=r+1,e.lastY=o,i}function Vt(t,e){if(e)return t;let n=Array.from(t);return n.sort((r,o)=>r.y!==o.y?r.y-o.y:r.x-o.x),n}function Yt(t,e){let n=e+1;for(;n<t.length;){let r=t[n],o=t[n-1];if(!r||!o||!(r.y===o.y&&r.x===o.x+1&&r.cell.fg===o.cell.fg&&r.cell.bg===o.cell.bg&&r.cell.attrs===o.cell.attrs))break;n++;}return n}function Xt(t,e,n,r,o,u){let i=n[r];if(i){u.push(St(e,i.x,i.y)),u.push(Ct(t,e,i.cell));for(let s=r;s<o;s++){let p=n[s];p&&u.push(p.cell.char);}e.lastX=i.x+(o-r),e.lastY=i.y;}}function Ut(t,e,n,r=false){if(n.length===0)return "";let o=[],u=Vt(n,r),i=0;for(;i<u.length&&u[i];){let s=Yt(u,i);if(s-i===1){let p=u[i];p&&o.push(Qt(t,e,p));}else Xt(t,e,u,i,s,o);i=s;}return o.join("")}var A=null,B=null,b=null;function Xe(t){B=t;}function Ue(){return B}function _e(){B=null;}function qe(t){b=t;}function ze(){return b}function Ge(){b=null;}function m(){return A||(A=xt()),A}function je(){A=xt();}var _t=t=>{if(!B||!b)return t;let e$1=m(),n=b.fullRedraw,r=f(b);if(r.length===0)return c$2(b),e(b),t;let o=Ut(t,e$1,r,n);return o.length>0&&B.write(o),c$2(b),e(b),t};function Je(){return _t}function a(t){B&&B.write(t);}function Ze(){a(`${c}?25l`);}function qt(){a(`${c}?25h`);}function tn(){a(`${c}?1049h`);let t=m();t.alternateScreen=true;}function zt(){a(`${c}?1049l`);let t=m();t.alternateScreen=false;}function en(){a(`${c}2J`);}function Gt(){a(`${c}H`);let t=m();t.lastX=0,t.lastY=0;}function jt(){a(x(y.RESET));let t=m();t.lastFg=-1,t.lastBg=-1,t.lastAttrs=-1;}function nn(){a("\x07");}function rn(t,e){a(vt(t,e));let n=m();n.lastX=t,n.lastY=e;}function on(t="any"){let e=m();a(`${c}?1006h`),a(t==="normal"?`${c}?1000h`:t==="button"?`${c}?1002h`:`${c}?1003h`),e.mouseTracking=true,e.mouseMode=t;}function Jt(){let t=m();a(`${c}?1000l`),a(`${c}?1002l`),a(`${c}?1003l`),a(`${c}?1006l`),t.mouseTracking=false,t.mouseMode=null;}function un(t){a(`${c}${t==="block"?2:t==="underline"?4:6} q`);}function sn(t){a(`\x1B]2;${t}\x07`);}function ln(){a(`${c}?2026h`);let t=m();t.syncOutput=true;}function Zt(){a(`${c}?2026l`);let t=m();t.syncOutput=false;}function an(){a("\x1B7");}function cn(){a("\x1B8");}function fn(){a(`${c}?2004h`);let t=m();t.bracketedPaste=true;}function te(){a(`${c}?2004l`);let t=m();t.bracketedPaste=false;}function pn(){a(`${c}?1004h`);let t=m();t.focusReporting=true;}function ee(){a(`${c}?1004l`);let t=m();t.focusReporting=false;}function mn(){let t=m();t.bracketedPaste&&te(),t.focusReporting&&ee(),t.mouseTracking&&Jt(),t.syncOutput&&Zt(),t.alternateScreen&&zt(),jt(),qt(),Gt();}var ne=[],re=[];function oe(t,e){if(!m$1(t,e,I))return a$2.NONE;let n=a$2.NONE;return I.bold[e]===1&&(n|=a$2.BOLD),I.underline[e]===1&&(n|=a$2.UNDERLINE),I.blink[e]===1&&(n|=a$2.BLINK),I.inverse[e]===1&&(n|=a$2.INVERSE),n}function Ot(t,e){if(c$4(t,e))return {x:a$3.x[e],y:a$3.y[e],width:a$3.width[e],height:a$3.height[e]}}function ue(t,e){return p$1(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 ie(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 se(t,e,n){let{world:r$1,buffer:o}=t,u=K$1(r$1,e);if(!u||u.transparent)return;let i=oe(r$1,e),s=e$1(" ",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$2(t,e,n,e$1(i,o,u));}function Rt(t,e,n,r,o,u,i){let s=String.fromCodePoint(o),p=e$1(s,u,i);for(let h=0;h<r;h++)o$2(t,e+h,n,p);}function It(t,e,n,r,o,u,i){let s=String.fromCodePoint(o),p=e$1(s,u,i);for(let h=0;h<r;h++)o$2(t,e,n+h,p);}function le(t,e,n,r,o,u){if(!e)return;let{x:i,y:s,width:p,height:h}=n;r.top&&r.left&&H(t,i,s,e.charTopLeft,o,u),r.top&&r.right&&H(t,i+p-1,s,e.charTopRight,o,u),r.bottom&&r.left&&H(t,i,s+h-1,e.charBottomLeft,o,u),r.bottom&&r.right&&H(t,i+p-1,s+h-1,e.charBottomRight,o,u);}function ae(t,e,n,r,o,u){let i=r.left?1:0,s=n.width-i-(r.right?1:0);s<=0||(r.top&&Rt(t,n.x+i,n.y,s,e,o,u),r.bottom&&Rt(t,n.x+i,n.y+n.height-1,s,e,o,u));}function ce(t,e,n,r,o,u){let i=r.top?1:0,s=n.height-i-(r.bottom?1:0);s<=0||(r.left&&It(t,n.x,n.y+i,s,e,o,u),r.right&&It(t,n.x+n.width-1,n.y+i,s,e,o,u));}function fe(t,e,n$1){let{world:r,buffer:o}=t;if(!p$1(r,e))return;let u=n(r,e);if(!u||u.type===0||n$1.width<1||n$1.height<1)return;let{fg:i,bg:s}=u,p={left:u.left,top:u.top,right:u.right,bottom:u.bottom};le(o,u,n$1,p,i,s),ae(o,u.charHorizontal,n$1,p,i,s),ce(o,u.charVertical,n$1,p,i,s);}function Cn(t,e,n){}function Rn(t,e,n){}function pe(t,e){let{world:n}=t,r=Ot(n,e);if(!r||r.width<=0||r.height<=0)return;se(t,e,r),fe(t,e,r);let o=ue(n,e);ie(r,o);o$3(t.dirtyTracker,n,e),N(n,e);}var g=null;function In(t){g=t;}function On(){return g}function me(t){return g?t.x+t.width<=g.x||t.x>=g.x+g.width||t.y+t.height<=g.y||t.y>=g.y+g.height:false}function de(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 ye(t,e){if(e.length===0)return false;for(let n of e)if(de(t,n))return true;return false}function he(t,e){t.push({x:e.x,y:e.y,width:e.width,height:e.height});}function be(t,e,n){let{world:r}=t,o=Ot(r,e);return !o||o.width<=0||o.height<=0?(N(r,e),false):me(o)?(N(r,e),false):F&&ye(o,n)?(N(r,e),false):(pe(t,e),F&&he(n,o),true)}var k=null,K=null,F=false;function Dn(t,e){k=t,K=e;}function Nn(){return k}function Tn(){k=null,K=null;}function Mn(t){F=t;}function kn(){return F}var ge=t=>{if(!k||!K)return t;let e={world:t,buffer:K,dirtyTracker:k},n=h(t).queryRenderables(t),r=n.length,o=ne;o.length=0;for(let i=0;i<r;i++){let s=n[i];V(t,s)&&O(t,s)&&o.push(s);}o.length>1&&o.sort((i,s)=>Ba.z[i]-Ba.z[s]);let u=re;u.length=0;for(let i of o)be(e,i,u);return t};function Wn(){return ge}function $n(t$1,e,n,r,o,u,i=a$2.NONE){return t(t$1,e,n,r,o,u,i)}function Pn(t,e,n,r$1,o,u){r(t,e,n,r$1,o,u);}function An(t){let e=h(t).queryRenderables(t),n=e.length;for(let r=0;r<n;r++)I.dirty[e[r]]=1;}export{mn as $,Ge as A,m as B,je as C,_t as D,Je as E,a as F,Ze as G,qt as H,tn as I,zt as J,en as K,Gt as L,jt as M,nn as N,rn as O,on as P,Jt as Q,un as R,sn as S,ln as T,Zt as U,an as V,cn as W,fn as X,te as Y,pn as Z,ee as _,l as a,se as aa,Oe as b,fe as ba,De as c,Cn as ca,Ne as d,Rn as da,Te as e,In as ea,Me as f,On as fa,ke as g,Dn as ga,We as h,Nn as ha,Dt as i,Tn as ia,$e as j,Mn as ja,Pe as k,kn as ka,Nt as l,ge as la,Ae as m,Wn as ma,Tt as n,$n as na,Et as o,Pn as oa,Le as p,An as pa,He as q,Ke as r,Fe as s,xt as t,Ut as u,Xe as v,Ue as w,_e as x,qe as y,ze as z};
@@ -1 +0,0 @@
1
- import {ma}from'./chunk-ETFDYZVJ.js';import {m as m$1,l as l$1}from'./chunk-7ZFQO3OQ.js';var b=4294967295,E=0;var t={clickable:new Uint8Array(1e4),draggable:new Uint8Array(1e4),hoverable:new Uint8Array(1e4),hovered:new Uint8Array(1e4),pressed:new Uint8Array(1e4),keyable:new Uint8Array(1e4),focusable:new Uint8Array(1e4),focused:new Uint8Array(1e4),tabIndex:new Int16Array(1e4),enabled:new Uint8Array(1e4),hoverEffectFg:new Uint32Array(1e4),hoverEffectBg:new Uint32Array(1e4),focusEffectFg:new Uint32Array(1e4),focusEffectBg:new Uint32Array(1e4)};function A(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]=4294967295,t.hoverEffectBg[n]=0,t.focusEffectFg[n]=4278255615,t.focusEffectBg[n]=0;}function a(n,e){m$1(n,e,t)||(l$1(n,e,t),A(e));}function f(n,e,r){r!==void 0&&(e[n]=r?1:0);}function l(n,e,r){r!==void 0&&(e[n]=r);}function F(n,e,r){return a(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),l(e,t.tabIndex,r.tabIndex),l(e,t.hoverEffectFg,r.hoverEffectFg),l(e,t.hoverEffectBg,r.hoverEffectBg),l(e,t.focusEffectFg,r.focusEffectFg),l(e,t.focusEffectBg,r.focusEffectBg),r.focusable!==void 0&&ma(n,e,r.focusable),e}function h(n,e,r){return a(n,e),t.clickable[e]=r?1:0,e}function I(n,e,r){return a(n,e),t.draggable[e]=r?1:0,e}function U(n,e,r){return a(n,e),t.hoverable[e]=r?1:0,e}function T(n,e,r){return a(n,e),t.keyable[e]=r?1:0,e}function C(n,e){return m$1(n,e,t)?t.hovered[e]===1:false}function W(n,e){return m$1(n,e,t)?t.pressed[e]===1:false}function m(n,e){return m$1(n,e,t)?t.clickable[e]===1:false}function k(n,e){return m$1(n,e,t)?t.draggable[e]===1:false}function d(n,e){return m$1(n,e,t)?t.hoverable[e]===1:false}function _(n,e){return m$1(n,e,t)?t.keyable[e]===1:false}function D(n,e,r){return a(n,e),t.hovered[e]=r?1:0,e}function B(n,e,r){return a(n,e),t.pressed[e]=r?1:0,e}function L(n,e,r){return a(n,e),t.focused[e]=r?1:0,e}function P(n,e){if(m$1(n,e,t))return {fg:t.focusEffectFg[e],bg:t.focusEffectBg[e]}}function Y(n,e,r,s){return a(n,e),t.focusEffectFg[e]=r,t.focusEffectBg[e]=s,e}function O(n,e){if(m$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 w(n,e){return m$1(n,e,t)}function G(n,e){return m$1(n,e,t)&&(t.hovered[e]=0,t.pressed[e]=0,t.focused[e]=0),e}function H(n,e){return a(n,e),t.clickable[e]=1,t.hoverable[e]=1,e}function S(n,e){return m$1(n,e,t)&&(t.clickable[e]=0,t.hoverable[e]=0),e}function K(n,e){return a(n,e),t.keyable[e]=1,e}function R(n,e){return m$1(n,e,t)&&(t.keyable[e]=0),e}function V(n,e){return a(n,e),t.clickable[e]=1,t.hoverable[e]=1,t.keyable[e]=1,e}function M(n,e){return m$1(n,e,t)&&(t.clickable[e]=0,t.hoverable[e]=0,t.keyable[e]=0),e}function N(n,e){return m$1(n,e,t)?t.clickable[e]===1||t.hoverable[e]===1:false}function j(n,e){return m$1(n,e,t)?t.keyable[e]===1:false}function q(n,e){return m$1(n,e,t)?t.clickable[e]===1||t.hoverable[e]===1||t.keyable[e]===1:false}function z(n,e){return a(n,e),t.enabled[e]=1,e}function J(n,e){return a(n,e),t.enabled[e]=0,t.hovered[e]=0,t.pressed[e]=0,t.focused[e]=0,e}function Q(n,e){return m$1(n,e,t)?t.enabled[e]===1:true}export{V as A,M as B,N as C,j as D,q as E,z as F,J as G,Q as H,b as a,E as b,t as c,F as d,h as e,I as f,U as g,T as h,C as i,W as j,m as k,k as l,d as m,_ as n,D as o,B as p,L as q,P as r,Y as s,O as t,w as u,G as v,H as w,S as x,K as y,R as z};
@@ -1 +0,0 @@
1
- import {a as a$1,ba,aa,I as I$1}from'./chunk-ETFDYZVJ.js';import {l as l$1,m}from'./chunk-7ZFQO3OQ.js';var l=1e4,h={BLOCK:0,UNDERLINE:1,BAR:2,BLINKING_BLOCK:3,BLINKING_UNDERLINE:4,BLINKING_BAR:5},o={cursorX:new Uint16Array(l),cursorY:new Uint16Array(l),cursorVisible:new Uint8Array(l),cursorShape:new Uint8Array(l),focused:new Uint32Array(l),hovered:new Uint32Array(l),fullUnicode:new Uint8Array(l),autoPadding:new Uint8Array(l)},a=new WeakMap;function x(r,e,n={}){l$1(r,e,o),o.cursorX[e]=0,o.cursorY[e]=0,o.cursorVisible[e]=n.cursorVisible!==false?1:0,o.cursorShape[e]=n.cursorShape??h.BLOCK,o.focused[e]=a$1,o.hovered[e]=a$1,o.fullUnicode[e]=n.fullUnicode!==false?1:0,o.autoPadding[e]=n.autoPadding===true?1:0;}function g(r){return a.has(r)}function W(r,e){if(a.has(r))throw new Error("A screen already exists in this world. Only one screen is allowed.");a.set(r,e);}function C(r){return a.get(r)??null}function U(r,e){return a.get(r)===e}function t(r,e){return m(r,e,o)}function v(r,e){if(t(r,e))return {x:o.cursorX[e],y:o.cursorY[e],visible:o.cursorVisible[e]===1,shape:o.cursorShape[e]}}function A(r,e,n,i){return t(r,e)?(o.cursorX[e]=Math.max(0,Math.floor(n)),o.cursorY[e]=Math.max(0,Math.floor(i)),true):false}function V(r,e,n){return t(r,e)?(o.cursorVisible[e]=n?1:0,true):false}function w(r,e,n){return t(r,e)?(o.cursorShape[e]=n,true):false}function N(r,e){if(!t(r,e))return null;let n=o.focused[e];return n===a$1?null:n}function P(r,e,n){return t(r,e)?(o.focused[e]=n??a$1,true):false}function L(r,e){if(!t(r,e))return null;let n=o.hovered[e];return n===a$1?null:n}function I(r,e,n){return t(r,e)?(o.hovered[e]=n??a$1,true):false}function B(r,e){if(!t(r,e))return;let n=ba(r,e),i=o.focused[e],c=o.hovered[e];return {cursor:{x:o.cursorX[e],y:o.cursorY[e],visible:o.cursorVisible[e]===1,shape:o.cursorShape[e]},focused:i===a$1?null:i,hovered:c===a$1?null:c,fullUnicode:o.fullUnicode[e]===1,autoPadding:o.autoPadding[e]===1,width:n?.width??0,height:n?.height??0}}function D(r,e){if(!t(r,e))return;let n=ba(r,e);if(n)return {width:n.width,height:n.height}}function Y(r,e,n,i){return !t(r,e)||n<=0||i<=0?false:(aa(r,e,n,i),I$1.dirty[e]=1,true)}function K(r,e){return t(r,e)?o.fullUnicode[e]===1:false}function M(r,e,n){return t(r,e)?(o.fullUnicode[e]=n?1:0,true):false}function O(r,e){return t(r,e)?o.autoPadding[e]===1:false}function F(r,e,n){return t(r,e)?(o.autoPadding[e]=n?1:0,true):false}function R(r){return a.get(r)===void 0?false:(a.delete(r),true)}function X(r){a.delete(r);}export{h as a,o as b,x as c,g as d,W as e,C as f,U as g,t as h,v as i,A as j,V as k,w as l,N as m,P as n,L as o,I as p,B as q,D as r,Y as s,K as t,M as u,O as v,F as w,R as x,X as y};
@@ -1 +0,0 @@
1
- import {j}from'./chunk-FUW7OD3H.js';import {z}from'zod';function m(e,r){let t=e.r-r.r,o=e.g-r.g,a=e.b-r.b;return t*t+o*o+a*a}function c(e,r={}){let{distance:t=m,palette:o=j,indices:a}=r,l=0,n=Number.POSITIVE_INFINITY;for(let i=0;i<o.length;i++){let d=o[i];if(!d)continue;let b=t(e,d);if(b<n&&(n=b,l=a?a[i]??i:i),b===0)break}return l}function y(e=1024){let r=new Map;function t(o){return o.r<<16|o.g<<8|o.b}return {get(o){let a=t(o),l=r.get(a);return l!==void 0&&(r.delete(a),r.set(a,l)),l},set(o,a){let l=t(o);if(r.has(l)&&r.delete(l),r.size>=e){let n=r.keys().next().value;n!==void 0&&r.delete(n);}r.set(l,a);},clear(){r.clear();},get size(){return r.size}}}var C=y(4096);function k(e,r){if(!r||r.distance===void 0&&r.palette===void 0){let t=C.get(e);if(t!==void 0)return t;let o=c(e,r);return C.set(e,o),o}return c(e,r)}j.slice(232,256);Array.from({length:24},(e,r)=>232+r);j.slice(16,232);Array.from({length:216},(e,r)=>16+r);j.slice(0,16);Array.from({length:16},(e,r)=>r);var g={black:0,red:1,green:2,yellow:3,blue:4,magenta:5,cyan:6,white:7,lightblack:8,lightred:9,lightgreen:10,lightyellow:11,lightblue:12,lightmagenta:13,lightcyan:14,lightwhite:15,brightblack:8,brightred:9,brightgreen:10,brightyellow:11,brightblue:12,brightmagenta:13,brightcyan:14,brightwhite:15,darkred:1,darkgreen:2,darkyellow:3,darkblue:4,darkmagenta:5,darkcyan:6,darkgray:8,darkgrey:8,gray:8,grey:8,silver:7,maroon:1,olive:3,navy:4,purple:5,teal:6,aqua:14,lime:10,fuchsia:13,orange:208},h={grey:"gray",lightgrey:"lightblack",lightgray:"lightblack",darkgrey:"darkgray",bright:"light",hi:"light",crimson:"red",scarlet:"red",vermillion:"red",emerald:"green",forest:"green",azure:"blue",cobalt:"blue",indigo:"blue",violet:"magenta",pink:"lightmagenta",gold:"yellow",brown:"maroon",colour:"color"};var x=Object.keys(g);z.string().transform(e=>e.toLowerCase().trim()).refine(e=>x.includes(e)||e==="default"||e==="transparent"||e==="inherit",{message:"Invalid color name"});function p(e){let r=e.toLowerCase().trim();if(r in g)return g[r]??null;let t=h[r];if(t&&t in g)return g[t]??null;if(r==="default"||r==="transparent"||r==="inherit")return null;let o=r.split(/[-_\s]+/);if(o.length===2){let a=o[0],l=o[1];if(a&&l){let n=a+l;if(n in g)return g[n]??null}}return null}var f={indianred:{r:205,g:92,b:92},lightcoral:{r:240,g:128,b:128},salmon:{r:250,g:128,b:114},darksalmon:{r:233,g:150,b:122},lightsalmon:{r:255,g:160,b:122},crimson:{r:220,g:20,b:60},firebrick:{r:178,g:34,b:34},darkred:{r:139,g:0,b:0},pink:{r:255,g:192,b:203},lightpink:{r:255,g:182,b:193},hotpink:{r:255,g:105,b:180},deeppink:{r:255,g:20,b:147},mediumvioletred:{r:199,g:21,b:133},palevioletred:{r:219,g:112,b:147},coral:{r:255,g:127,b:80},tomato:{r:255,g:99,b:71},orangered:{r:255,g:69,b:0},darkorange:{r:255,g:140,b:0},orange:{r:255,g:165,b:0},gold:{r:255,g:215,b:0},lightyellow:{r:255,g:255,b:224},lemonchiffon:{r:255,g:250,b:205},papayawhip:{r:255,g:239,b:213},moccasin:{r:255,g:228,b:181},peachpuff:{r:255,g:218,b:185},palegoldenrod:{r:238,g:232,b:170},khaki:{r:240,g:230,b:140},darkkhaki:{r:189,g:183,b:107},lavender:{r:230,g:230,b:250},thistle:{r:216,g:191,b:216},plum:{r:221,g:160,b:221},violet:{r:238,g:130,b:238},orchid:{r:218,g:112,b:214},mediumorchid:{r:186,g:85,b:211},mediumpurple:{r:147,g:112,b:219},rebeccapurple:{r:102,g:51,b:153},blueviolet:{r:138,g:43,b:226},darkviolet:{r:148,g:0,b:211},darkorchid:{r:153,g:50,b:204},darkmagenta:{r:139,g:0,b:139},indigo:{r:75,g:0,b:130},slateblue:{r:106,g:90,b:205},darkslateblue:{r:72,g:61,b:139},greenyellow:{r:173,g:255,b:47},chartreuse:{r:127,g:255,b:0},lawngreen:{r:124,g:252,b:0},limegreen:{r:50,g:205,b:50},palegreen:{r:152,g:251,b:152},lightgreen:{r:144,g:238,b:144},mediumspringgreen:{r:0,g:250,b:154},springgreen:{r:0,g:255,b:127},mediumseagreen:{r:60,g:179,b:113},seagreen:{r:46,g:139,b:87},forestgreen:{r:34,g:139,b:34},darkgreen:{r:0,g:100,b:0},yellowgreen:{r:154,g:205,b:50},olivedrab:{r:107,g:142,b:35},darkolivegreen:{r:85,g:107,b:47},mediumaquamarine:{r:102,g:205,b:170},darkseagreen:{r:143,g:188,b:143},lightseagreen:{r:32,g:178,b:170},darkcyan:{r:0,g:139,b:139},lightcyan:{r:224,g:255,b:255},paleturquoise:{r:175,g:238,b:238},aquamarine:{r:127,g:255,b:212},turquoise:{r:64,g:224,b:208},mediumturquoise:{r:72,g:209,b:204},darkturquoise:{r:0,g:206,b:209},cadetblue:{r:95,g:158,b:160},steelblue:{r:70,g:130,b:180},lightsteelblue:{r:176,g:196,b:222},powderblue:{r:176,g:224,b:230},lightblue:{r:173,g:216,b:230},skyblue:{r:135,g:206,b:235},lightskyblue:{r:135,g:206,b:250},deepskyblue:{r:0,g:191,b:255},dodgerblue:{r:30,g:144,b:255},cornflowerblue:{r:100,g:149,b:237},royalblue:{r:65,g:105,b:225},mediumblue:{r:0,g:0,b:205},darkblue:{r:0,g:0,b:139},midnightblue:{r:25,g:25,b:112},cornsilk:{r:255,g:248,b:220},blanchedalmond:{r:255,g:235,b:205},bisque:{r:255,g:228,b:196},navajowhite:{r:255,g:222,b:173},wheat:{r:245,g:222,b:179},burlywood:{r:222,g:184,b:135},tan:{r:210,g:180,b:140},rosybrown:{r:188,g:143,b:143},sandybrown:{r:244,g:164,b:96},goldenrod:{r:218,g:165,b:32},darkgoldenrod:{r:184,g:134,b:11},peru:{r:205,g:133,b:63},chocolate:{r:210,g:105,b:30},saddlebrown:{r:139,g:69,b:19},sienna:{r:160,g:82,b:45},brown:{r:165,g:42,b:42},snow:{r:255,g:250,b:250},honeydew:{r:240,g:255,b:240},mintcream:{r:245,g:255,b:250},azure:{r:240,g:255,b:255},aliceblue:{r:240,g:248,b:255},ghostwhite:{r:248,g:248,b:255},whitesmoke:{r:245,g:245,b:245},seashell:{r:255,g:245,b:238},beige:{r:245,g:245,b:220},oldlace:{r:253,g:245,b:230},floralwhite:{r:255,g:250,b:240},ivory:{r:255,g:255,b:240},antiquewhite:{r:250,g:235,b:215},linen:{r:250,g:240,b:230},lavenderblush:{r:255,g:240,b:245},mistyrose:{r:255,g:228,b:225},gainsboro:{r:220,g:220,b:220},lightgray:{r:211,g:211,b:211},lightgrey:{r:211,g:211,b:211},darkgray:{r:169,g:169,b:169},dimgray:{r:105,g:105,b:105},dimgrey:{r:105,g:105,b:105},lightslategray:{r:119,g:136,b:153},lightslategrey:{r:119,g:136,b:153},slategray:{r:112,g:128,b:144},slategrey:{r:112,g:128,b:144},darkslategray:{r:47,g:79,b:79},darkslategrey:{r:47,g:79,b:79}},u=new Map;function S(e){let r=e.toLowerCase().trim(),t=u.get(r);if(t!==void 0)return t;let o=p(r);if(o!==null)return u.set(r,o),o;let a=f[r];if(a){let l=c(a);return u.set(r,l),l}return null}export{c as a,k as b,p as c,S as d};
@@ -1 +0,0 @@
1
- import {b,d as d$2}from'./chunk-4LWWONFK.js';import {k as k$1}from'./chunk-VOCM5T2G.js';import {d as d$1,A,i,B as B$1}from'./chunk-LNEISTXM.js';import {a,e,r,o as o$1,t}from'./chunk-C5PCEQ6G.js';import {c,a as a$2}from'./chunk-ZL46COQF.js';import {p as p$1,k}from'./chunk-EOFT3PNU.js';import {Ba,I,V,N,K}from'./chunk-ETFDYZVJ.js';import {o,a as a$1,m}from'./chunk-7ZFQO3OQ.js';import {z}from'zod';var d=z.number().int().min(0).max(4294967295),Q=z.number().int().min(0).max(65535),te=z.object({fg:d.optional(),bg:d.optional(),selectedFg:d.optional(),selectedBg:d.optional(),cursorFg:d.optional(),cursorBg:d.optional(),showLineNumbers:z.boolean().optional(),lineNumberWidth:z.number().int().nonnegative().max(20).optional(),attrs:Q.optional()}),Ce=z.object({fg:d.default(4294967295),bg:d.default(255),selectedFg:d.default(255),selectedBg:d.default(4294967295),cursorFg:d.default(255),cursorBg:d.default(16711935),showLineNumbers:z.boolean().default(false),lineNumberWidth:z.number().int().nonnegative().max(20).default(0),attrs:Q.default(a.NONE)}),T={fg:4294967295,bg:255,selectedFg:255,selectedBg:4294967295,cursorFg:255,cursorBg:16711935,showLineNumbers:false,lineNumberWidth:0,attrs:a.NONE},p=null;function L(t){return a$1(t,"virtualRender:lineStore")}function B(t){return a$1(t,"virtualRender:lineConfig")}function Se(t){p=t;}function Ne(){return p}function Ve(){p=null;}function ve(t,e,r){L(t).set(e,r);}function We(t,e){return L(t).get(e)}function ze(t,e){L(t).delete(e);}function De(t,e,r){L(t).set(e,r);}function we(t,e,r){let f=te.parse(r),i={};for(let[o,u]of Object.entries(f))u!==void 0&&(i[o]=u);let n=B(t).get(e)??T;B(t).set(e,{...n,...i});}function ne(t,e){return B(t).get(e)??T}function Fe(t,e){B(t).delete(e);}function re(t,e){if(!m(t,e,I))return a.NONE;let r=a.NONE;return I.bold[e]===1&&(r|=a.BOLD),I.underline[e]===1&&(r|=a.UNDERLINE),I.blink[e]===1&&(r|=a.BLINK),I.inverse[e]===1&&(r|=a.INVERSE),r}function ie(t,e){if(c(t,e))return {x:a$2.x[e],y:a$2.y[e],width:a$2.width[e],height:a$2.height[e]}}function oe(t,e){return p$1(t,e)?{top:k.top[e]===1?1:0,right:k.right[e]===1?1:0,bottom:k.bottom[e]===1?1:0,left:k.left[e]===1?1:0}:{top:0,right:0,bottom:0,left:0}}function fe(t,e){return {x:t.x+e.left,y:t.y+e.top,width:Math.max(0,t.width-e.left-e.right),height:Math.max(0,t.height-e.top-e.bottom)}}function O(t$1,e$1,r,f,i,n,o,u){let m=e(" ",n,o,u);for(let l=0;l<f;l++)o$1(t$1,e$1+l,r,m);let a=i.length>f?i.slice(0,f):i;a.length>0&&t(t$1,e$1,r,a,n,o,u);}function ue(t$1,e,r,f,i,n,o){let u=`${String(i+1).padStart(f-1," ")} `;t(t$1,e,r,u.slice(0,f),n,o,a.DIM);}function le(t,e,r,f,i,n){let{buffer:o}=t,{x:u,y:m,width:a$1,height:l}=r,x=k$1(i,f.start,f.end),N=n.showLineNumbers?u+n.lineNumberWidth:u,V=n.showLineNumbers?Math.max(0,a$1-n.lineNumberWidth):a$1,b=d$1.selectedLine[e],v=d$1.cursorLine[e];for(let c=0;c<x.lines.length;c++){let E=m+c;if(c>=l)break;let z=x.startLine+c,ee=x.lines[c]??"",D=n.fg,w=n.bg;z===v?(D=n.cursorFg,w=n.cursorBg):z===b&&(D=n.selectedFg,w=n.selectedBg),n.showLineNumbers&&ue(o,u,E,n.lineNumberWidth,z,n.fg,n.bg),O(o,N,E,V,ee,D,w,n.attrs);}let Z=Math.min(x.lines.length,l);for(let c=Z;c<l;c++){let E=m+c;n.showLineNumbers&&O(o,u,E,n.lineNumberWidth,"",n.fg,n.bg,a.NONE),O(o,N,E,V,"",n.fg,n.bg,a.NONE);}}function ae(t,e$1,r,f,i){if(r<=i)return;let{buffer:n}=t,o=e$1.height,u=e$1.x+e$1.width-1,m=e$1.y,a=i/r,l=Math.max(1,Math.floor(o*a)),x=Math.floor(f/r*o),N=e("\u2502",1717987071,255);for(let b=0;b<o;b++)o$1(n,u,m+b,N);let V=e("\u2588",2863311615,255);for(let b=0;b<l;b++){let v=m+x+b;v<m+o&&o$1(n,u,v,V);}}function se(t,e$1,r$1){let{world:f,buffer:i}=t,n=K(f,e$1);if(!n||n.transparent)return;let o=re(f,e$1),u=e(" ",n.fg,n.bg,o);r(i,r$1.x,r$1.y,r$1.width,r$1.height,u);}function de(t,e){let{world:r,doubleBuffer:f}=t,i$1=ie(r,e);if(!i$1||i$1.width<=0||i$1.height<=0)return;let n=L(r).get(e);if(!n)return;let o=i(r,e);if(!o)return;let u=ne(r,e);se(t,e,i$1);let m=oe(r,e),a=fe(i$1,m);a.width>0&&a.height>0&&le(t,e,a,o,n,u);let l={firstVisibleLine:d$1.firstVisibleLine[e],visibleLineCount:d$1.visibleLineCount[e],totalLineCount:d$1.totalLineCount[e]};l.totalLineCount>l.visibleLineCount&&ae(t,a,l.totalLineCount,l.firstVisibleLine,l.visibleLineCount),d$2(f,i$1.x,i$1.y,i$1.width,i$1.height),B$1(r,e),N(r,e);}var me=t=>{if(!p)return t;let e=b(p),r={world:t,buffer:e,doubleBuffer:p},f=o(t,[d$1,Ba,I]);for(let i of f)V(t,i)&&(!A(t,i)&&I.dirty[i]!==1||de(r,i));return t};function Me(){return me}function Oe(t){p=null,L(t).clear(),B(t).clear();}function ke(t,e){L(t).delete(e),B(t).delete(e);}export{Ce as a,Se as b,Ne as c,Ve as d,ve as e,We as f,ze as g,De as h,we as i,ne as j,Fe as k,me as l,Me as m,Oe as n,ke as o};
@@ -1,2 +0,0 @@
1
- import {H as H$1,o,n,q,ka as ka$1,Ba as Ba$1,fa,ea,Yc,yd,Wd,we,Ae as Ae$1,kb,ob,Mb,Fb,_b,qc,wc,Gc,Lc,Hc,Le as Le$1,Be as Be$1}from'./chunk-XG5PVDOP.js';import {d as d$3,c as c$2,e as e$1}from'./chunk-LI3ZYXUT.js';import {b as b$1,c as c$3,d as d$4}from'./chunk-UKVY43V3.js';import {c as c$1,d as d$2}from'./chunk-K2QWNDXV.js';import {k as k$1,l as l$1}from'./chunk-EOFT3PNU.js';import {d as d$1,e}from'./chunk-JN2OGNK3.js';import {c,ka,la,Ba,$,I as I$1,b,J}from'./chunk-ETFDYZVJ.js';import {h as h$1,l}from'./chunk-7ZFQO3OQ.js';import {z as z$1}from'zod';var S=z$1.object({x:z$1.number().optional(),y:z$1.number().optional(),z:z$1.number().optional(),absolute:z$1.boolean().optional()}),B=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()}),k=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()}),F=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()}),I=z$1.object({left:z$1.number().optional(),right:z$1.number().optional(),top:z$1.number().optional(),bottom:z$1.number().optional()}),Ue=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()}),j=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()}),T=z$1.object({focusable:z$1.boolean().optional(),tabIndex:z$1.number().optional(),focusEffectFg:z$1.number().optional(),focusEffectBg:z$1.number().optional()}),Ce=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()}),xe=z$1.object({parent:z$1.number().optional(),border:F.optional(),padding:I.optional()}).merge(S).merge(B).merge(k),Ee=z$1.object({parent:z$1.number().optional(),border:F.optional(),padding:I.optional()}).merge(S).merge(B).merge(k).merge(Ue),ve=z$1.object({parent:z$1.number().optional(),label:z$1.string().optional(),border:F.optional(),padding:I.optional()}).merge(S).merge(B).merge(k).merge(j).merge(T),Se=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()}),Be=z$1.object({parent:z$1.number().optional(),value:z$1.string().optional(),placeholder:z$1.string().optional(),maxLength:z$1.number().optional(),border:F.optional(),padding:I.optional()}).merge(S).merge(B).merge(k).merge(j).merge(T),ke=z$1.object({parent:z$1.number().optional(),items:z$1.array(z$1.string()).optional(),selectedIndex:z$1.number().optional(),border:F.optional(),padding:I.optional()}).merge(S).merge(B).merge(k).merge(Ce).merge(T),Fe=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:F.optional(),padding:I.optional()}).merge(S).merge(B).merge(k).merge(j).merge(T),Ie=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:F.optional(),padding:I.optional()}).merge(S).merge(B).merge(k).merge(j).merge(T),Oe=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:F.optional(),padding:I.optional()}).merge(S).merge(B).merge(k).merge(j).merge(T).merge(Ce),We=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:F.optional(),padding:I.optional()}).merge(S).merge(B).merge(k).merge(j).merge(T),Te=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:F.optional(),padding:I.optional()}).merge(S).merge(B).merge(k).merge(j).merge(T),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:F.optional(),padding:I.optional()}).merge(S).merge(B).merge(k),je=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:F.optional(),padding:I.optional()}).merge(S).merge(B).merge(k),ze=z$1.object({parent:z$1.number().optional(),selectedIndex:z$1.number().optional(),border:F.optional(),padding:I.optional()}).merge(S).merge(B).merge(k),De=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:F.optional(),padding:I.optional()}).merge(S).merge(B).merge(k).merge(j).merge(T);function d(n,o){l(n,o,Ba),l(n,o,$),l(n,o,I$1),l(n,o,b),Ba.x[o]=0,Ba.y[o]=0,Ba.z[o]=0,Ba.absolute[o]=0,$.width[o]=0,$.height[o]=0,$.minWidth[o]=0,$.minHeight[o]=0,$.maxWidth[o]=Number.POSITIVE_INFINITY,$.maxHeight[o]=Number.POSITIVE_INFINITY,$.shrink[o]=0,I$1.visible[o]=1,I$1.dirty[o]=1,I$1.fg[o]=4294967295,I$1.bg[o]=255,I$1.bold[o]=0,I$1.underline[o]=0,I$1.blink[o]=0,I$1.inverse[o]=0,I$1.transparent[o]=0,b.parent[o]=0,b.firstChild[o]=0,b.nextSibling[o]=0,b.prevSibling[o]=0,b.childCount[o]=0,b.depth[o]=0;}function h(n,o){o.x!==void 0&&(Ba.x[n]=o.x),o.y!==void 0&&(Ba.y[n]=o.y),o.z!==void 0&&(Ba.z[n]=o.z),o.absolute!==void 0&&(Ba.absolute[n]=o.absolute?1:0);}function He(n){return typeof n=="string"&&n.endsWith("%")?-(Number.parseFloat(n)+2):n==="auto"?-1:n}function Me(n,o){o.minWidth!==void 0&&($.minWidth[n]=o.minWidth),o.maxWidth!==void 0&&($.maxWidth[n]=o.maxWidth),o.minHeight!==void 0&&($.minHeight[n]=o.minHeight),o.maxHeight!==void 0&&($.maxHeight[n]=o.maxHeight),o.shrink!==void 0&&($.shrink[n]=o.shrink?1:0);}function y(n,o){o.width!==void 0&&($.width[n]=He(o.width)),o.height!==void 0&&($.height[n]=He(o.height)),Me(n,o);}function C(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&&J(n,o,t),e.visible!==void 0&&(I$1.visible[o]=e.visible?1:0);}function x(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$1(n,o,a);}function E(n,o,e){if(!e||!(e.left!==void 0||e.right!==void 0||e.top!==void 0||e.bottom!==void 0))return;c$3.left[o]=0,c$3.right[o]=0,c$3.top[o]=0,c$3.bottom[o]=0;let a={};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),d$4(n,o,a);}function z(n,o){l(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 Ke(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 Ve(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 Ke(o,e$1);}function Le(n,o,e){l(n,o,b$1),b$1.scrollX[o]=0,b$1.scrollY[o]=0,b$1.scrollWidth[o]=0,b$1.scrollHeight[o]=e,b$1.scrollbarVisible[o]=2;}function Re(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&&Le$1(n,o,t);}function Ye(n){c$1.clickable[n]=1,c$1.draggable[n]=0,c$1.hoverable[n]=0,c$1.hovered[n]=0,c$1.pressed[n]=0,c$1.keyable[n]=1,c$1.hoverEffectFg[n]=4294967295,c$1.hoverEffectBg[n]=1145324799;}function Xe(n,o){l(n,o,ka),ka.focusable[o]=1,ka.focused[o]=0,ka.tabIndex[o]=0,ka.focusEffectFg[o]=4294967295,ka.focusEffectBg[o]=6750207;}function D(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&&la(n,o,t);}function H(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 V(n,o){l(n,o,c$1),c$1.clickable[o]=1,c$1.draggable[o]=0,c$1.hoverable[o]=1,c$1.hovered[o]=0,c$1.pressed[o]=0,c$1.keyable[o]=1,c$1.hoverEffectFg[o]=4294967295,c$1.hoverEffectBg[o]=1145324799;}function L(n,o){l(n,o,ka),ka.focusable[o]=1,ka.focused[o]=0,ka.tabIndex[o]=0,ka.focusEffectFg[o]=4294967295,ka.focusEffectBg[o]=6750207;}function Ae(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&&Le$1(n,o,t);}function Ne(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),Be$1(n,o,t);}function Tt(n,o={}){let e=xe.parse(o),t=h$1(n);return d(n,t),h(t,e),y(t,e),C(n,t,e),x(n,t,e.border),E(n,t,e.padding),e.parent!==void 0&&c(n,t,e.parent),t}function Pt(n,o={}){let e=Ee.parse(o),t=h$1(n);return d(n,t),h(t,e),y(t,e),C(n,t,e),x(n,t,e.border),E(n,t,e.padding),z(n,t),Ve(n,t,e),e.parent!==void 0&&c(n,t,e.parent),t}function jt(n,o={}){let e$1=ve.parse(o),t=h$1(n);d(n,t),h(t,e$1),y(t,e$1),C(n,t,e$1),x(n,t,e$1.border),E(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),l(n,t,c$1),c$1.clickable[t]=1,c$1.draggable[t]=0,c$1.hoverable[t]=1,c$1.hovered[t]=0,c$1.pressed[t]=0,c$1.keyable[t]=1,c$1.hoverEffectFg[t]=4294967295,c$1.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),l(n,t,ka),ka.focusable[t]=1,ka.focused[t]=0,ka.tabIndex[t]=0,ka.focusEffectFg[t]=4294967295,ka.focusEffectBg[t]=6750207;let p={};return e$1.focusable!==void 0&&(p.focusable=e$1.focusable),e$1.tabIndex!==void 0&&(p.tabIndex=e$1.tabIndex),e$1.focusEffectFg!==void 0&&(p.focusEffectFg=e$1.focusEffectFg),e$1.focusEffectBg!==void 0&&(p.focusEffectBg=e$1.focusEffectBg),Object.keys(p).length>0&&la(n,t,p),e$1.parent!==void 0&&c(n,t,e$1.parent),t}function zt(n,o){if(d$3(n))throw new Error("A screen already exists in this world. Only one screen is allowed.");let e=Se.parse(o),t=h$1(n);return d(n,t),Ba.x[t]=0,Ba.y[t]=0,Ba.z[t]=0,Ba.absolute[t]=0,$.width[t]=e.width,$.height[t]=e.height,I$1.visible[t]=1,I$1.dirty[t]=1,b.parent[t]=0,b.depth[t]=0,c$2(n,t,{cursorVisible:e.cursorVisible,cursorShape:e.cursorShape,fullUnicode:e.fullUnicode,autoPadding:e.autoPadding}),e$1(n,t),t}function Dt(n,o={}){let e$1=Be.parse(o),t=h$1(n);d(n,t),h(t,e$1),y(t,e$1),C(n,t,e$1),x(n,t,e$1.border),E(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$1.clickable[t]=1,c$1.draggable[t]=0,c$1.hoverable[t]=1,c$1.hovered[t]=0,c$1.pressed[t]=0,c$1.keyable[t]=1,c$1.hoverEffectFg[t]=4294967295,c$1.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),l(n,t,ka),ka.focusable[t]=1,ka.focused[t]=0,ka.tabIndex[t]=0,ka.focusEffectFg[t]=4294967295,ka.focusEffectBg[t]=6750207;let p={};return e$1.focusable!==void 0&&(p.focusable=e$1.focusable),e$1.tabIndex!==void 0&&(p.tabIndex=e$1.tabIndex),e$1.focusEffectFg!==void 0&&(p.focusEffectFg=e$1.focusEffectFg),e$1.focusEffectBg!==void 0&&(p.focusEffectBg=e$1.focusEffectBg),Object.keys(p).length>0&&la(n,t,p),e$1.parent!==void 0&&c(n,t,e$1.parent),t}function Ht(n,o={}){let e$1=ke.parse(o),t=h$1(n);return d(n,t),h(t,e$1),y(t,e$1),C(n,t,e$1),x(n,t,e$1.border),E(n,t,e$1.padding),z(n,t),e$1.items!==void 0&&e$1.items.length>0&&e(n,t,e$1.items.join(`
2
- `)),Le(n,t,e$1.items?.length??0),Re(n,t,e$1),Xe(n,t),D(n,t,e$1),Ye(t),e$1.parent!==void 0&&c(n,t,e$1.parent),t}function Vt(n$1,o$1={}){let e$1=Fe.parse(o$1),t=h$1(n$1);return d(n$1,t),h(t,e$1),y(t,e$1),C(n$1,t,e$1),x(n$1,t,e$1.border),E(n$1,t,e$1.padding),z(n$1,t),d$1.align[t]=0,d$1.valign[t]=1,e$1.label!==void 0&&e(n$1,t,e$1.label),V(n$1,t),H(n$1,t,e$1),L(n$1,t),D(n$1,t,e$1),H$1(n$1,t,{checkedChar:e$1.checkedChar??n,uncheckedChar:e$1.uncheckedChar??o}),q(n$1,t,e$1.checked??false),e$1.parent!==void 0&&c(n$1,t,e$1.parent),t}function Lt(n,o={}){let e$1=Ie.parse(o),t=h$1(n);return d(n,t),h(t,e$1),y(t,e$1),C(n,t,e$1),x(n,t,e$1.border),E(n,t,e$1.padding),z(n,t),d$1.align[t]=0,d$1.valign[t]=1,e$1.value!==void 0&&e(n,t,e$1.value),V(n,t),c$1.hoverEffectBg[t]=858993663,H(n,t,e$1),L(n,t),D(n,t,e$1),ka$1(n,t),Ba$1(n,t,{secret:e$1.secret??false,censor:e$1.censor??ea,placeholder:e$1.placeholder??fa,maxLength:e$1.maxLength??0}),e$1.parent!==void 0&&c(n,t,e$1.parent),t}function Rt(n,o={}){let e$1=Oe.parse(o),t=h$1(n);return d(n,t),h(t,e$1),y(t,e$1),C(n,t,e$1),x(n,t,e$1.border),E(n,t,e$1.padding),z(n,t),d$1.align[t]=0,d$1.valign[t]=0,e$1.value!==void 0&&e(n,t,e$1.value),V(n,t),c$1.hoverEffectBg[t]=858993663,H(n,t,e$1),L(n,t),D(n,t,e$1),e$1.scrollable&&(l(n,t,b$1),b$1.scrollX[t]=0,b$1.scrollY[t]=0,b$1.scrollWidth[t]=0,b$1.scrollHeight[t]=0,b$1.scrollbarVisible[t]=2,Ae(n,t,e$1)),ka$1(n,t),Ba$1(n,t,{secret:false,censor:"",placeholder:e$1.placeholder??fa,maxLength:e$1.maxLength??0,multiline:true}),e$1.parent!==void 0&&c(n,t,e$1.parent),t}function Yt(n,o={}){let e$1=We.parse(o),t=h$1(n);d(n,t),h(t,e$1),y(t,e$1),C(n,t,e$1),x(n,t,e$1.border),E(n,t,e$1.padding),z(n,t),d$1.align[t]=0,d$1.valign[t]=1,V(n,t),c$1.hoverEffectBg[t]=858993663,H(n,t,e$1),L(n,t),D(n,t,e$1);let a=e$1.options??[],p=e$1.selectedIndex??-1;Yc(n,t,a,p);let R={};return e$1.closedIndicator!==void 0&&(R.closedIndicator=e$1.closedIndicator),e$1.openIndicator!==void 0&&(R.openIndicator=e$1.openIndicator),e$1.selectedMark!==void 0&&(R.selectedMark=e$1.selectedMark),yd(n,t,R),p>=0&&a[p]?e(n,t,a[p].label):e$1.placeholder&&e(n,t,e$1.placeholder),e$1.parent!==void 0&&c(n,t,e$1.parent),t}function Xt(n,o={}){let e=Te.parse(o),t=h$1(n);d(n,t),h(t,e),y(t,e),C(n,t,e),x(n,t,e.border),E(n,t,e.padding),V(n,t),c$1.draggable[t]=1,c$1.hoverEffectBg[t]=858993663,H(n,t,e),L(n,t),D(n,t,e);let a=e.min??0,p=e.max??100,R=e.value??0,_e=e.step??1;return Wd(n,t,a,p,R,_e),e.orientation!==void 0&&we(n,t,e.orientation),e.showValue!==void 0&&Ae$1(n,t,e.showValue),Ne(n,t,e),e.parent!==void 0&&c(n,t,e.parent),t}function At(n,o={}){let e=Pe.parse(o),t=h$1(n);if(d(n,t),h(t,e),y(t,e),C(n,t,e),x(n,t,e.border),E(n,t,e.padding),kb(n,t,{keys:e.keys??true,submitOnEnter:e.submitOnEnter??true}),e.fields)for(let a of e.fields)ob(n,t,a.entity,a.name,a.initialValue);return e.parent!==void 0&&c(n,t,e.parent),t}function Nt(n,o={}){let e=je.parse(o),t=h$1(n);return d(n,t),h(t,e),y(t,e),C(n,t,e),x(n,t,e.border),E(n,t,e.padding),Mb(n,t,{value:e.value??0,min:e.min??0,max:e.max??100,orientation:e.orientation??Fb.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)&&_b(n,t,{fillChar:e.fillChar,emptyChar:e.emptyChar,fillFg:e.fillFg,fillBg:e.fillBg,emptyFg:e.emptyFg,emptyBg:e.emptyBg}),e.parent!==void 0&&c(n,t,e.parent),t}function _t(n,o={}){let e=ze.parse(o),t=h$1(n);return d(n,t),h(t,e),y(t,e),C(n,t,e),x(n,t,e.border),E(n,t,e.padding),qc(n,t),e.parent!==void 0&&c(n,t,e.parent),t}function Ut(n,o={}){let e$1=De.parse(o),t=h$1(n);return d(n,t),h(t,e$1),y(t,e$1),C(n,t,e$1),x(n,t,e$1.border),E(n,t,e$1.padding),z(n,t),d$1.align[t]=0,d$1.valign[t]=1,e$1.label!==void 0&&e(n,t,e$1.label),V(n,t),c$1.hoverEffectBg[t]=858993663,H(n,t,e$1),L(n,t),D(n,t,e$1),wc(n,t,e$1.radioSet),e$1.value!==void 0&&Gc(n,t,e$1.value),(e$1.selectedChar!==void 0||e$1.unselectedChar!==void 0)&&Lc(n,t,{selectedChar:e$1.selectedChar,unselectedChar:e$1.unselectedChar}),e$1.parent!==void 0&&c(n,t,e$1.parent),e$1.selected&&Hc(n,t),t}export{At as A,Nt as B,_t as C,Ut as D,xe as a,Ee as b,ve as c,Se as d,Be as e,ke as f,Fe as g,Ie as h,Oe as i,We as j,Te as k,Pe as l,je as m,ze as n,De as o,Tt as p,Pt as q,jt as r,zt as s,Dt as t,Ht as u,Vt as v,Lt as w,Rt as x,Yt as y,Xt as z};
@@ -1 +0,0 @@
1
- import {c,a}from'./chunk-ZL46COQF.js';import {Ba,I as I$1,V}from'./chunk-ETFDYZVJ.js';import {o,m as m$1}from'./chunk-7ZFQO3OQ.js';import {z as z$1}from'zod';function B(){let e=new Map;function r(t,o,s){let i=e.get(t);i||(i=new Set,e.set(t,i));let d={handler:o,once:s};return i.add(d),()=>{i.delete(d),i.size===0&&e.delete(t);}}let n={on(t,o){return r(t,o,false)},once(t,o){return r(t,o,true)},off(t,o){let s=e.get(t);if(!s)return n;for(let i of s)if(i.handler===o){s.delete(i);break}return s.size===0&&e.delete(t),n},emit(t,o){let s=e.get(t);if(!s||s.size===0)return false;let i=[];for(let d of s)d.handler(o),d.once&&i.push(d);for(let d of i)s.delete(d);return s.size===0&&e.delete(t),true},removeAllListeners(t){return t===void 0?e.clear():e.delete(t),n},listenerCount(t){return e.get(t)?.size??0},eventNames(){return Array.from(e.keys())},hasListeners(t){return n.listenerCount(t)>0}};return n}function U(){let e=new Map;return {get(r,n){return e.get(n)},getOrCreate(r,n){let t=e.get(n);return t||(t=B(),e.set(n,t)),t},set(r,n,t){e.set(n,t);},has(r,n){return e.has(n)},delete(r,n){return e.delete(n)},clear(){e.clear();}}}var Q=[{name:"renderables",components:[Ba,I$1]}],M=z$1.object({name:z$1.string().min(1),components:z$1.array(z$1.unknown()).min(1)}),z=z$1.object({queries:z$1.array(M),initialCapacity:z$1.number().int().positive().optional(),syncMode:z$1.enum(["all","render_only"]).optional()}),g=Object.freeze([]),K=Object.freeze([]);function P(e){return o(e,[Ba,I$1])}var m={type:"bitecs",queryRenderables:P},E=new WeakMap;function X(e={}){return {...m,...e,type:e.type??m.type,queryRenderables:e.queryRenderables??m.queryRenderables}}function G(e,r){E.set(e,r);}function L(e){return E.get(e)??m}function J(e){let r=L(e);I(r)&&r.sync(e);}function Z(e){E.delete(e);}function D(e,r){return {name:e,components:r,cachedResult:null,cachedSize:0,cacheFrameId:-1}}function f(e,r,n){if(e.cacheFrameId===n)return;let t=o(r,e.components);e.cachedResult=t,e.cachedSize=t.length,e.cacheFrameId=n;}function _(e){z.parse(e);let r=e.syncMode??"all",n=new Map;for(let i of e.queries)n.set(i.name,D(i.name,i.components));n.has("renderables")||n.set("renderables",D("renderables",[Ba,I$1]));let t=Object.freeze([...n.keys()]),o=null,s=0;return {type:"custom",syncMode:r,queryRenderables(i){let d=n.get("renderables");return d?(f(d,i,s),d.cachedResult??g):g},queryByName(i,d){let l=n.get(i);if(l)return f(l,d,s),l.cachedResult??g},sync(i){o=i,s++;},getQueryData(i){let d=n.get(i);return !d||!o?K:(f(d,o,s),d.cachedResult??K)},getQuerySize(i){let d=n.get(i);return !d||!o?0:(f(d,o,s),d.cachedSize)},getRegisteredQueries(){return t}}}function $(e=256){return _({queries:Q,syncMode:"render_only"})}function I(e){return "sync"in e&&"getQueryData"in e&&"getQuerySize"in e&&"getRegisteredQueries"in e}function oe(e,r){let n=e*r,t=Math.ceil(n/8);return {width:e,height:r,dirtyCells:new Uint8Array(t),dirtyEntities:new Set,entityBoundsCache:new Map,dirtyRegions:[],regionsStale:false,forceFullRedraw:false,frameCount:0}}function ie(e,r,n){if(e.dirtyEntities.add(n),!c(r,n))return;let t=Math.floor(a.x[n]),o=Math.floor(a.y[n]),s=Math.floor(a.width[n]),i=Math.floor(a.height[n]),d=m$1(r,n,I$1)&&V(r,n),l=e.entityBoundsCache.get(n);l?(l.wasVisible&&v(e,l.prevX,l.prevY,l.prevWidth,l.prevHeight),d&&v(e,t,o,s,i),l.prevX=t,l.prevY=o,l.prevWidth=s,l.prevHeight=i,l.wasVisible=d):(e.entityBoundsCache.set(n,{prevX:t,prevY:o,prevWidth:s,prevHeight:i,wasVisible:d}),d&&v(e,t,o,s,i)),e.regionsStale=true;}function de(e,r){e.dirtyEntities.delete(r),e.entityBoundsCache.delete(r);}function se(e,r,n){if(r<0||r>=e.width||n<0||n>=e.height)return;let t=n*e.width+r,o=Math.floor(t/8),s=t%8,i=e.dirtyCells[o];i!==void 0&&(e.dirtyCells[o]=i|1<<s),e.regionsStale=true;}function T(e,r,n){if(r<0||r>=e.width||n<0||n>=e.height)return false;let t=n*e.width+r,o=Math.floor(t/8),s=t%8,i=e.dirtyCells[o];return i!==void 0&&(i&1<<s)!==0}function v(e,r,n,t,o){let s=Math.max(0,r),i=Math.max(0,n),d=Math.min(e.width,r+t),l=Math.min(e.height,n+o);if(!(d<=s||l<=i)){for(let b=i;b<l;b++)for(let p=s;p<d;p++){let x=b*e.width+p,w=Math.floor(x/8),S=x%8,R=e.dirtyCells[w];R!==void 0&&(e.dirtyCells[w]=R|1<<S);}e.regionsStale=true;}}function k(e,r,n){let t=1;for(;r+t<e.width&&T(e,r+t,n);)t++;return t}function H(e,r,n,t){for(let o=0;o<t;o++)if(!T(e,r+o,n))return false;return true}function q(e,r,n,t){let o=1;for(;n+o<e.height&&H(e,r,n+o,t);)o++;return o}function F(e,r,n,t,o,s){for(let i=0;i<o;i++)for(let d=0;d<t;d++)s.add((n+i)*e.width+(r+d));}function le(e){if(e.forceFullRedraw)return [{x:0,y:0,width:e.width,height:e.height}];if(!e.regionsStale&&e.dirtyRegions.length>0)return e.dirtyRegions;e.dirtyRegions.length=0;let r=[],n=new Set;for(let t=0;t<e.height;t++)for(let o=0;o<e.width;o++){let s=t*e.width+o;if(n.has(s)||!T(e,o,t))continue;let i=k(e,o,t),d=q(e,o,t,i);F(e,o,t,i,d,n),r.push({x:o,y:t,width:i,height:d});}return e.dirtyRegions.length=0,e.dirtyRegions.push(...r),e.regionsStale=false,e.dirtyRegions}function ae(e){if(e.forceFullRedraw||e.dirtyEntities.size>0)return true;for(let r=0;r<e.dirtyCells.length;r++)if(e.dirtyCells[r]!==0)return true;return false}function ue(e){e.dirtyCells.fill(0),e.dirtyEntities.clear(),e.dirtyRegions.length=0,e.regionsStale=false,e.forceFullRedraw=false,e.frameCount++;}function ye(e){e.forceFullRedraw=true,e.regionsStale=true;}function ce(e){let r=0;for(let n=0;n<e.dirtyCells.length;n++){let t=e.dirtyCells[n];if(t!==void 0)for(let o=0;o<8;o++)t&1<<o&&r++;}return {dirtyCellCount:r,dirtyEntityCount:e.dirtyEntities.size,cachedEntityCount:e.entityBoundsCache.size,dirtyRegionCount:e.regionsStale?0:e.dirtyRegions.length,frameCount:e.frameCount}}export{B as a,U as b,M as c,z as d,m as e,X as f,G as g,L as h,J as i,Z as j,_ as k,$ as l,I as m,oe as n,ie as o,de as p,se as q,T as r,v as s,le as t,ae as u,ue as v,ye as w,ce as x};
@@ -1 +0,0 @@
1
- import {b}from'./chunk-UKVY43V3.js';import {f as f$1,e}from'./chunk-JN2OGNK3.js';import {M as M$1,oa,ya as ya$1,za as za$1,h as h$1,xa as xa$1}from'./chunk-ETFDYZVJ.js';import {l,m as m$1,n,p as p$1,q as q$1,a}from'./chunk-7ZFQO3OQ.js';import {m as m$2,n as n$1,j as j$1}from'./chunk-Z4EZERNE.js';import {z as z$1}from'zod';function Fe(e){return typeof e=="string"?{target:e}:e}function Be(e){let t=e.initial,n=e.context,r=new Set;function o(u){if(u)for(let d of u)d(n);}function i(u){if(u!==t)for(let d of r)d(t,u);}let a=e.states[t];if(a?.entry)for(let u of a.entry)u(n);let x={get current(){return t},get context(){return n},send(u){let d=e.states[t];if(!d?.on)return false;let b=d.on[u];if(b===void 0)return false;let{target:k,actions:vn,guard:Se}=Fe(b);if(Se&&!Se(n))return false;let Wn=t;return o(d.exit),o(vn),t=k,o(e.states[t]?.entry),i(Wn),true},can(u){let d=e.states[t];if(!d?.on)return false;let b=d.on[u];if(b===void 0)return false;let{guard:k}=Fe(b);return !(k&&!k(n))},matches(u){return t===u},subscribe(u){return r.add(u),()=>{r.delete(u);}},validEvents(){let u=e.states[t];if(!u?.on)return [];let d=[];for(let b of Object.keys(u.on))x.can(b)&&d.push(b);return d},reset(){let u=t;o(e.states[t]?.exit),t=e.initial,o(e.states[t]?.entry),i(u);}};return x}var In=z$1.union([z$1.string(),z$1.object({target:z$1.string()})]),Tn=z$1.object({entry:z$1.array(z$1.function()).optional(),exit:z$1.array(z$1.function()).optional(),on:z$1.record(z$1.string(),In).optional()});z$1.object({initial:z$1.string(),states:z$1.record(z$1.string(),Tn),context:z$1.unknown().optional()});var An=1e4;function kn(e=An){return {machineId:new Uint32Array(e),currentState:new Uint16Array(e),previousState:new Uint16Array(e),stateAge:new Float32Array(e)}}var m=kn(),De=new WeakSet,Re=null;function R(e){return De.has(e)||(Re=p$1(e,q$1(()=>m)),De.add(e)),Re}var Rt=new Map,Lt=new Map,Ut=new Map,Le=1,D={register(e){let t=Le++,n=Be(e);Rt.set(t,n);let r=Object.keys(e.states),o=new Map;for(let i=0;i<r.length;i++){let a=r[i];a!==void 0&&o.set(a,i);}return Lt.set(t,o),Ut.set(t,r),t},getMachine(e){return Rt.get(e)},getStateIndex(e,t){return Lt.get(e)?.get(t)??0},getStateName(e,t){return Ut.get(e)?.[t]??""},unregister(e){Rt.delete(e),Lt.delete(e),Ut.delete(e);},clear(){Rt.clear(),Lt.clear(),Ut.clear(),Le=1;}};function I(e,t,n){let r=R(e),o=D.register(n),i=D.getStateIndex(o,n.initial);return l(e,t,r),m.machineId[t]=o,m.currentState[t]=i,m.previousState[t]=i,m.stateAge[t]=0,o}function Wo(e,t){let n$1=R(e);if(!m$1(e,t,n$1))return;let r=m.machineId[t]??0;D.unregister(r),n(e,t,n$1);}function h(e,t){let n=R(e);if(!m$1(e,t,n))return "";let r=m.machineId[t]??0,o=m.currentState[t]??0;return D.getStateName(r,o)}function Io(e,t){let n=R(e);if(!m$1(e,t,n))return "";let r=m.machineId[t]??0,o=m.previousState[t]??0;return D.getStateName(r,o)}function W(e,t,n){let r=R(e);if(!m$1(e,t,r))return false;let o=m.machineId[t]??0,i=D.getMachine(o);if(!i)return false;let a=i.current,x=i.send(n);if(x){let u=D.getStateIndex(o,i.current),d=D.getStateIndex(o,a);m.previousState[t]=d,m.currentState[t]=u,m.stateAge[t]=0;}return x}function To(e,t,n){let r=R(e);if(!m$1(e,t,r))return false;let o=m.machineId[t]??0,i=D.getMachine(o);return i?i.can(n):false}function Ao(e,t){let n=R(e);return m$1(e,t,n)?m.stateAge[t]??0:0}function P(e,t,n){return h(e,t)===n}function ko(e,t,n){let r=R(e);for(let o of t)if(m$1(e,o,r)){let i=m.stateAge[o]??0;m.stateAge[o]=i+n;}}function T(e,t){let n=R(e);return m$1(e,t,n)}var _n={initial:"unchecked",states:{unchecked:{on:{toggle:"checked",check:"checked",disable:"disabled"}},checked:{on:{toggle:"unchecked",uncheck:"unchecked",disable:"disabled"}},disabled:{on:{enable:"unchecked"}}}},Mn=1e4;function Fn(e=Mn){return {isCheckbox:new Uint8Array(e),machineId:new Uint32Array(e)}}var bt=Fn(),$=new Map,Ue="\u2611",Oe="\u2610",mt=new Map;function Bo(){bt.isCheckbox.fill(0),bt.machineId.fill(0),$.clear(),mt.clear();}function Do(e,t,n=false){let r=I(e,t,_n);return bt.isCheckbox[t]=1,bt.machineId[t]=r,n&&W(e,t,"check"),r}function L(e,t){return (bt.isCheckbox[t]??0)===1&&T(e,t)}function zt(e,t){if(L(e,t))return h(e,t)}function ht(e,t,n){if(!L(e,t))return false;let r=h(e,t),o=W(e,t,n);if(o){M$1(e,t);let i=h(e,t);(r==="checked"||r==="unchecked")&&(i==="checked"||i==="unchecked")&&r!==i&&Ln(e,t,i==="checked");}return o}function jt(e,t,n){return L(e,t)?P(e,t,n):false}function Pe(e,t){return jt(e,t,"checked")}function Ro(e,t){return jt(e,t,"unchecked")}function Lo(e,t){return jt(e,t,"disabled")}function Bn(e,t){return ht(e,t,"toggle")}function Dn(e,t){return ht(e,t,"check")}function Rn(e,t){return ht(e,t,"uncheck")}function Uo(e,t){return ht(e,t,"disable")}function Oo(e,t){return ht(e,t,"enable")}function He(e,t,n){if(!L(e,t))return false;let r=zt(e,t);return r==="disabled"?false:n&&r==="unchecked"?Dn(e,t):!n&&r==="checked"?Rn(e,t):false}function Po(e,t,n){let r=$.get(t);return r||(r=[],$.set(t,r)),r.push(n),()=>{let o=$.get(t);if(o){let i=o.indexOf(n);i!==-1&&o.splice(i,1);}}}function Ln(e,t,n){let r=$.get(t);if(r)for(let o of r)o(n);}function Ho(e,t){$.delete(t);}function Vo(e,t,n){return !L(e,t)||zt(e,t)==="disabled"?false:n==="return"||n==="enter"||n==="space"?(Bn(e,t),true):false}function wo(e,t,n){let r=mt.get(t)??{checkedChar:Ue,uncheckedChar:Oe};mt.set(t,{checkedChar:n.checkedChar??r.checkedChar,uncheckedChar:n.uncheckedChar??r.uncheckedChar});}function Un(e,t){return mt.get(t)??{checkedChar:Ue,uncheckedChar:Oe}}function No(e,t){let n=Un(e,t);return zt(e,t)==="checked"?n.checkedChar:n.uncheckedChar}function Yo(e,t){mt.delete(t);}var On={initial:"idle",states:{idle:{on:{mouseenter:"hovered",focus:"focused",disable:"disabled"}},hovered:{on:{mousedown:"pressed",mouseleave:"idle",focus:"focused",disable:"disabled"}},pressed:{on:{mouseup:"hovered",mouseleave:"idle"}},focused:{on:{blur:"idle",mouseenter:"hovered",disable:"disabled"}},disabled:{on:{enable:"idle"}}}},Pn=1e4;function Hn(e=Pn){return {isButton:new Uint8Array(e),machineId:new Uint32Array(e)}}var Et=Hn(),q=new Map;function zo(){Et.isButton.fill(0),Et.machineId.fill(0),q.clear();}function jo(e,t){let n=I(e,t,On);return Et.isButton[t]=1,Et.machineId[t]=n,n}function Y(e,t){return (Et.isButton[t]??0)===1&&T(e,t)}function Ot(e,t){if(Y(e,t))return h(e,t)}function Ve(e,t,n){if(!Y(e,t))return false;let r=h(e,t),o=W(e,t,n);return o&&(M$1(e,t),r==="pressed"&&n==="mouseup"&&we(t)),o}function Pt(e,t,n){return Y(e,t)?P(e,t,n):false}function $o(e,t){return Pt(e,t,"hovered")}function qo(e,t){return Pt(e,t,"pressed")}function Jo(e,t){return Pt(e,t,"focused")}function Qo(e,t){return Pt(e,t,"disabled")}function Zo(e,t){return Ve(e,t,"disable")}function ti(e,t){return Ve(e,t,"enable")}function ei(e,t){let n=q.get(e);return n||(n=[],q.set(e,n)),n.push(t),()=>{let r=q.get(e);if(r){let o=r.indexOf(t);o!==-1&&r.splice(o,1);}}}function we(e){let t=q.get(e);if(t)for(let n of t)n();}function Vn(e,t){return !Y(e,t)||Ot(e,t)==="disabled"?false:(we(t),true)}function ni(e){q.delete(e);}function ri(e,t,n){if(!Y(e,t))return false;let r=Ot(e,t);return r==="disabled"||r!=="focused"?false:n==="return"||n==="enter"||n==="space"?(Vn(e,t),true):false}var $t={initial:"idle",states:{idle:{on:{focus:"focused",disable:"disabled"}},focused:{on:{startEdit:"editing",blur:"idle",error:"error",disable:"disabled"}},editing:{on:{endEdit:"focused",blur:"idle",error:"error"}},error:{on:{clearError:"focused",blur:"idle",disable:"disabled"}},disabled:{on:{enable:"idle"}}}},qt=1e4,F={Line:0,Block:1},Jt=530,J="*",Q="",Qt="\u2502",Zt="\u2588",B=new Map,H=new Map,V=new Map,w=new Map,U=new Map,St=new Map;function wn(e=qt){return {isTextInput:new Uint8Array(e),machineId:new Uint32Array(e),cursorPos:new Uint32Array(e),selectionStart:new Int32Array(e).fill(-1),selectionEnd:new Int32Array(e).fill(-1),inputMode:new Uint8Array(e),cursorMode:new Uint8Array(e),cursorBlink:new Uint8Array(e).fill(1),cursorBlinkStart:new Float64Array(e)}}var f=wn();function Nn(){f.isTextInput.fill(0),f.machineId.fill(0),f.cursorPos.fill(0),f.selectionStart.fill(-1),f.selectionEnd.fill(-1),f.inputMode.fill(0),f.cursorMode.fill(0),f.cursorBlink.fill(1),f.cursorBlinkStart.fill(0),B.clear(),H.clear(),V.clear(),w.clear(),St.clear(),U.clear();}function Yn(e,t){let n=I(e,t,$t);return f.isTextInput[t]=1,f.machineId[t]=n,f.cursorPos[t]=0,f.selectionStart[t]=-1,f.selectionEnd[t]=-1,f.inputMode[t]=0,f.cursorMode[t]=F.Line,f.cursorBlink[t]=1,f.cursorBlinkStart[t]=Date.now(),B.set(t,{secret:false,censor:J,placeholder:Q,maxLength:0,multiline:false}),n}function S(e,t){return (f.isTextInput[t]??0)===1&&T(e,t)}function Z(e,t){if(S(e,t))return h(e,t)}function O(e,t,n){if(!S(e,t))return false;let r=W(e,t,n);if(r){M$1(e,t);let o=h(e,t);f.inputMode[t]=o==="editing"?1:0;}return r}function Ht(e,t,n){return S(e,t)?P(e,t,n):false}function Xn(e,t){let n=Z(e,t);return n==="focused"||n==="editing"}function Kn(e,t){return Ht(e,t,"editing")}function Gn(e,t){return Ht(e,t,"error")}function zn(e,t){return Ht(e,t,"disabled")}function te(e,t){return O(e,t,"focus")}function jn(e,t){return O(e,t,"blur")}function $n(e,t){return O(e,t,"startEdit")}function qn(e,t){return O(e,t,"endEdit")}function Jn(e,t){return O(e,t,"disable")}function Qn(e,t){return O(e,t,"enable")}function Zn(e,t){return O(e,t,"error")}function tr(e,t){return O(e,t,"clearError")}function er(e,t,n){let r=B.get(t)??{secret:false,censor:J,placeholder:Q,maxLength:0,multiline:false,validator:void 0,validationTiming:"both"};B.set(t,{secret:n.secret??r.secret,censor:n.censor??r.censor,placeholder:n.placeholder??r.placeholder,maxLength:n.maxLength??r.maxLength,multiline:n.multiline??r.multiline,validator:n.validator??r.validator,validationTiming:n.validationTiming??r.validationTiming});}function C(e,t){return B.get(t)??{secret:false,censor:J,placeholder:Q,maxLength:0,multiline:false,validator:void 0,validationTiming:"both"}}function Ne(e,t){return C(e,t).secret}function Ye(e,t){return C(e,t).censor}function nr(e,t){return C(e,t).placeholder}function rr(e,t){return C(e,t).maxLength}function or(e,t){return C(e,t).multiline}function ir(e,t,n){return Ne(e,t)?Ye(e,t).repeat(n.length):n}function ee(e,t,n){let r=C(e,t);if(!r.validator)return U.set(t,null),true;let o=r.validator(n);return o===true?(U.set(t,null),true):o===false?(U.set(t,"Invalid input"),false):(U.set(t,o),false)}function lr(e,t,n){let r=H.get(t);return r||(r=[],H.set(t,r)),r.push(n),()=>{let o=H.get(t);if(o){let i=o.indexOf(n);i!==-1&&o.splice(i,1);}}}function ar(e,t,n){let r=V.get(t);return r||(r=[],V.set(t,r)),r.push(n),()=>{let o=V.get(t);if(o){let i=o.indexOf(n);i!==-1&&o.splice(i,1);}}}function sr(e,t,n){let r=w.get(t);return r||(r=[],w.set(t,r)),r.push(n),()=>{let o=w.get(t);if(o){let i=o.indexOf(n);i!==-1&&o.splice(i,1);}}}function cr(e,t,n){let r=C(e,t);r.validator&&(r.validationTiming==="onChange"||r.validationTiming==="both")&&ee(e,t,n);let o=H.get(t);if(o)for(let i of o)i(n);}function ur(e,t,n){let r=C(e,t);if(r.validator&&(r.validationTiming==="onSubmit"||r.validationTiming==="both")&&!ee(e,t,n))return false;let o=V.get(t);if(o)for(let i of o)i(n);return true}function fr(e,t){let n=w.get(t);if(n)for(let r of n)r();}function pr(e,t){H.delete(t),V.delete(t),w.delete(t),B.delete(t),U.delete(t);}function tt(e,t){return f.cursorPos[t]??0}function Xe(e,t,n){S(e,t)&&(f.cursorPos[t]=Math.max(0,n),f.cursorBlinkStart[t]=Date.now(),M$1(e,t));}function dr(e,t,n){let r=tt(e,t);Xe(e,t,r+n);}function Vt(e,t){let n=f.selectionStart[t],r=f.selectionEnd[t];return n===void 0||r===void 0||n<0||r<0?null:[n,r]}function gr(e,t,n,r){S(e,t)&&(f.selectionStart[t]=n,f.selectionEnd[t]=r,M$1(e,t));}function xr(e,t){S(e,t)&&(f.selectionStart[t]=-1,f.selectionEnd[t]=-1,M$1(e,t));}function yr(e,t){return Vt(e,t)!==null}function Ct(e,t){return St.get(t)??{blink:true,blinkIntervalMs:Jt,lineChar:Qt,blockChar:Zt}}function br(e,t,n){let r=Ct(e,t);St.set(t,{blink:n.blink??r.blink,blinkIntervalMs:n.blinkIntervalMs??r.blinkIntervalMs,lineChar:n.lineChar??r.lineChar,blockChar:n.blockChar??r.blockChar});}function vt(e,t){return f.cursorMode[t]??0}function Ke(e,t,n){S(e,t)&&(f.cursorMode[t]=n,M$1(e,t));}function mr(e,t){let r=vt(e,t)===F.Line?F.Block:F.Line;return Ke(e,t,r),r}function ne(e,t){return (f.cursorBlink[t]??1)===1}function hr(e,t,n){S(e,t)&&(f.cursorBlink[t]=n?1:0,n&&(f.cursorBlinkStart[t]=Date.now()),M$1(e,t));}function Er(e,t){f.cursorBlinkStart[t]=Date.now();}function re(e,t){let n=Ct(e,t);return vt(e,t)===F.Block?n.blockChar:n.lineChar}function Sr(e,t,n){return e.multiline?e.maxLength>0&&n.length>=e.maxLength?null:{type:"newline",position:t}:{type:"submit",value:n}}function Cr(e,t){return e.multiline?{type:"submit",value:t}:{type:"cancel"}}function vr(e,t,n){return e==="left"&&t>0?{type:"moveCursor",position:t-1}:e==="right"&&t<n?{type:"moveCursor",position:t+1}:e==="home"&&t!==0?{type:"moveCursor",position:0}:e==="end"&&t!==n?{type:"moveCursor",position:n}:null}function Wr(e,t,n){return e==="backspace"&&t>0?{type:"delete",start:t-1,end:t}:e==="delete"&&t<n?{type:"delete",start:t,end:t+1}:null}function Ir(e,t,n){return e==="left"?{type:"moveWordLeft",text:n,position:t}:e==="right"?{type:"moveWordRight",text:n,position:t}:e==="backspace"?{type:"deleteWordBackward",text:n,position:t}:e==="delete"?{type:"deleteWordForward",text:n,position:t}:null}function Tr(e,t,n,r){return e.length!==1||n.maxLength>0&&r>=n.maxLength?null:{type:"insert",char:e,position:t}}function Ar(e,t,n,r,o=false){if(!S(e,t))return null;let i=Z(e,t);if(i==="disabled")return null;if(i==="idle")return te(e,t),null;let a=tt(e,t),x=C(e,t),u=r.length;if(n==="return"||n==="enter")return Sr(x,a,r);if(n==="escape")return Cr(x,r);if(o){let k=Ir(n,a,r);if(k)return k}let d=Wr(n,a,u);if(d)return d;let b=vr(n,a,u);return b||Tr(n,a,x,u)}function Ge(e,t){let n=Z(e,t);if(n!=="focused"&&n!=="editing")return false;if(!ne(e,t))return true;let r=Ct(e,t),o=f.cursorBlinkStart[t]??Date.now(),i=Date.now()-o;return Math.floor(i/r.blinkIntervalMs)%2===0}function kr(e,t,n){let r=C(e,t),o=tt(e,t),i=n;if(r.secret&&(i=r.censor.repeat(n.length)),i.length===0&&r.placeholder)return {displayText:r.placeholder,cursorVisible:false,cursorPosition:0};if(!Ge(e,t))return {displayText:i,cursorVisible:false,cursorPosition:o};let x=re(e,t),u=vt(e,t),d;return u===F.Block&&o<i.length?d=i.substring(0,o)+x+i.substring(o+1):d=i.substring(0,o)+x+i.substring(o),{displayText:d,cursorVisible:true,cursorPosition:o}}function _r(e,t){let n=Vt(e,t);if(!n)return null;let[r,o]=n;return {start:Math.min(r,o),end:Math.max(r,o)}}var Mr=1e4,ze=1,je=2;function Fr(e=Mr){return {isForm:new Uint8Array(e),flags:new Uint8Array(e)}}var X=Fr(),K=new Map,Wt=new Map,et=new Map,nt=new Map;function Zi(){X.isForm.fill(0),X.flags.fill(0),K.clear(),Wt.clear(),et.clear(),nt.clear();}function tl(e,t,n={}){X.isForm[t]=1;let r=0;n.keys!==false&&(r|=ze),n.submitOnEnter!==false&&(r|=je),X.flags[t]=r,K.set(t,new Map),Wt.set(t,new Map),M$1(e,t);}function $e(e,t){return X.isForm[t]===1}function Br(e,t){return (X.flags[t]&ze)!==0}function Dr(e,t){return (X.flags[t]&je)!==0}function Rr(e,t,n,r,o){if(!$e(e,t))return;let i=K.get(t),a=Wt.get(t);i&&a&&(i.set(n,r),o!==void 0?a.set(n,o):a.set(n,Je(e,n)));}function el(e,t,n){let r=K.get(t),o=Wt.get(t);r&&r.delete(n),o&&o.delete(n);}function qe(e,t){let n=K.get(t);return n?Array.from(n.keys()):[]}function nl(e,t){return K.get(e)?.get(t)}function Je(e,t){return S(e,t)?f$1(e,t)??"":L(e,t)?Pe(e,t):Y(e,t)?Ot(e,t)==="pressed":f$1(e,t)??null}function Lr(e$1,t,n){if(S(e$1,t)){e(e$1,t,String(n??""));return}if(L(e$1,t)){He(e$1,t,!!n);return}n!==null&&e(e$1,t,String(n));}function Ur(e,t){let n={},r=K.get(t);if(!r)return n;for(let[o,i]of r)n[i]=Je(e,o);return n}function rl(e,t){let n=Wt.get(t);if(!n)return;for(let[o,i]of n)Lr(e,o,i);let r=nt.get(t);if(r)for(let o of r)o();M$1(e,t);}function Or(e,t){let n=Ur(e,t),r=et.get(t);if(r)for(let o of r)o(n);return n}function ol(e,t,n){let r=et.get(t)??[];return r.push(n),et.set(t,r),()=>{let o=et.get(t);if(o){let i=o.indexOf(n);i!==-1&&o.splice(i,1);}}}function il(e,t,n){let r=nt.get(t)??[];return r.push(n),nt.set(t,r),()=>{let o=nt.get(t);if(o){let i=o.indexOf(n);i!==-1&&o.splice(i,1);}}}function ll(e,t){et.delete(t),nt.delete(t);}function Pr(e,t){let r=qe(e,t).filter(o=>oa(e,o));return ya$1(e,r)}function Hr(e,t){let r=qe(e,t).filter(o=>oa(e,o));return za$1(e,r)}function al(e,t){let r=h$1(e,t).filter(o=>oa(e,o));return xa$1(e,r)}function sl(e,t,n,r){return !$e(e,t)||!Br(e,t)?false:n==="tab"?(r?Hr(e,t):Pr(e,t),true):(n==="return"||n==="enter")&&Dr(e,t)?(Or(e,t),true):false}function cl(e,t,n="field_"){let r=h$1(e,t);for(let o of r)if(S(e,o)||L(e,o)){let i=`${n}${o}`;Rr(e,t,o,i);}}var Vr=1e4,It={Horizontal:0,Vertical:1};function wr(e=Vr){return {isProgressBar:new Uint8Array(e),value:new Float32Array(e),min:new Float32Array(e),max:new Float32Array(e),orientation:new Uint8Array(e),showPercentage:new Uint8Array(e)}}var p=wr(),Qe="\u2588",Ze="\u2591",tn="\u2588",en="\u2591",Tt=new Map,rt=new Map,ot=new Map;function pl(){p.isProgressBar.fill(0),p.value.fill(0),p.min.fill(0),p.max.fill(0),p.orientation.fill(0),p.showPercentage.fill(0),Tt.clear(),rt.clear(),ot.clear();}function dl(e,t,n={}){p.isProgressBar[t]=1,p.min[t]=n.min??0,p.max[t]=n.max??100,p.value[t]=n.value??0,p.orientation[t]=n.orientation??It.Horizontal,p.showPercentage[t]=n.showPercentage?1:0,Nr(e,t,{}),M$1(e,t);}function gl(e,t){return p.isProgressBar[t]===1}function xl(e,t){return p.value[t]}function yl(e,t){return p.min[t]}function bl(e,t){return p.max[t]}function nn(e,t){let n=p.min[t],r=p.max[t],o=p.value[t];return r===n?0:(o-n)/(r-n)*100}function ml(e,t){return p.orientation[t]}function hl(e,t){return p.showPercentage[t]===1}function At(e,t,n){let r=p.min[t],o=p.max[t],i=p.value[t],a=Math.max(r,Math.min(o,n));if(p.value[t]=a,M$1(e,t),a!==i){let x=nn(e,t);Xr(e,t,a,x),a===o&&i<o&&Yr(e,t);}}function El(e,t,n=1){let r=p.value[t];At(e,t,r+n);}function Sl(e,t,n=1){let r=p.value[t];At(e,t,r-n);}function Cl(e,t){let n=p.min[t];At(e,t,n);}function vl(e,t){let n=p.max[t];At(e,t,n);}function Wl(e,t){let n=p.max[t];return p.value[t]>=n}function Nr(e,t,n){let r=Tt.get(t),o=p.orientation[t],i=o===It.Vertical?tn:Qe,a=o===It.Vertical?en:Ze;Tt.set(t,{fillChar:n.fillChar??r?.fillChar??i,emptyChar:n.emptyChar??r?.emptyChar??a,fillFg:n.fillFg??r?.fillFg??16711935,fillBg:n.fillBg??r?.fillBg??255,emptyFg:n.emptyFg??r?.emptyFg??1717987071,emptyBg:n.emptyBg??r?.emptyBg??255});}function oe(e,t){let n=Tt.get(t);if(n)return n;let r=p.orientation[t],o=r===It.Vertical?tn:Qe,i=r===It.Vertical?en:Ze;return {fillChar:o,emptyChar:i,fillFg:16711935,fillBg:255,emptyFg:1717987071,emptyBg:255}}function Il(e,t){Tt.delete(t);}function Tl(e,t){return oe(e,t).fillChar}function Al(e,t){return oe(e,t).emptyChar}function kl(e,t,n){let r=nn(e,t)/100,o=oe(e,t),i=Math.round(n*r),a=n-i;return o.fillChar.repeat(i)+o.emptyChar.repeat(a)}function _l(e,t,n){let r=rt.get(t)??[];return r.push(n),rt.set(t,r),()=>{let o=rt.get(t);if(o){let i=o.indexOf(n);i!==-1&&o.splice(i,1);}}}function Ml(e,t,n){let r=ot.get(t)??[];return r.push(n),ot.set(t,r),()=>{let o=ot.get(t);if(o){let i=o.indexOf(n);i!==-1&&o.splice(i,1);}}}function Yr(e,t){let n=rt.get(t);if(n)for(let r of n)r();}function Xr(e,t,n,r){let o=ot.get(t);if(o)for(let i of o)i(n,r);}function Fl(e,t){rt.delete(t),ot.delete(t);}function Bl(e,t,n){p.orientation[t]=n,M$1(e,t);}function Dl(e,t,n){p.showPercentage[t]=n?1:0,M$1(e,t);}function Rl(e,t,n,r){p.min[t]=n,p.max[t]=r;let o=p.value[t];(o<n||o>r)&&At(e,t,Math.max(n,Math.min(r,o))),M$1(e,t);}var Kr={initial:"unselected",states:{unselected:{on:{select:"selected",disable:"disabled"}},selected:{on:{deselect:"unselected",disable:"disabled"}},disabled:{on:{enable:"unselected"}}}},rn=1e4;function Gr(e=rn){return {isRadioButton:new Uint8Array(e),machineId:new Uint32Array(e),radioSetId:new Uint32Array(e)}}var v=Gr();function zr(e=rn){return {isRadioSet:new Uint8Array(e),selectedButton:new Uint32Array(e)}}var M=zr(),on="\u25C9",ln="\u25CB",kt=new Map,lt=new Map,it=new Map;function Pl(){v.isRadioButton.fill(0),v.machineId.fill(0),v.radioSetId.fill(0),M.isRadioSet.fill(0),M.selectedButton.fill(0),kt.clear(),lt.clear(),it.clear();}function Hl(e,t){M.isRadioSet[t]=1,M.selectedButton[t]=0,M$1(e,t);}function Vl(e,t){return M.isRadioSet[t]===1}function jr(e,t){return M.selectedButton[t]}function wl(e,t){let n=M.selectedButton[t];return n===0?null:lt.get(n)??null}function Nl(e,t,n){let r=it.get(t)??[];return r.push(n),it.set(t,r),()=>{let o=it.get(t);if(o){let i=o.indexOf(n);i!==-1&&o.splice(i,1);}}}function an(e,t){let n=it.get(t);if(n){let r=jr(e,t),o=r!==0?lt.get(r)??null:null;for(let i of n)i(o,r!==0?r:null);}}function Yl(e,t){it.delete(t);}function Xl(e,t,n){v.isRadioButton[t]=1,v.radioSetId[t]=n??0;let r=I(e,t,Kr);return v.machineId[t]=r,qr(e,t,{}),M$1(e,t),r}function at(e,t){return v.isRadioButton[t]===1}function Kl(e,t){if(at(e,t)&&T(e,t))return h(e,t)}function _t(e,t,n){return at(e,t)?W(e,t,n):false}function sn(e,t,n){return at(e,t)?P(e,t,n):false}function $r(e,t){return sn(e,t,"selected")}function cn(e,t){return sn(e,t,"disabled")}function Gl(e,t){return v.radioSetId[t]}function zl(e,t,n){v.radioSetId[t]=n;}function jl(e,t){return lt.get(t)}function $l(e,t,n){lt.set(t,n);}function un(e,t){if(!at(e,t)||cn(e,t))return;let n=v.radioSetId[t];if(n!==0){let r=M.selectedButton[n];r!==0&&r!==t&&_t(e,r,"deselect"),M.selectedButton[n]=t;}_t(e,t,"select"),M$1(e,t),n!==0&&an(e,n);}function ql(e,t){if(!at(e,t))return;_t(e,t,"deselect");let n=v.radioSetId[t];n!==0&&M.selectedButton[n]===t&&(M.selectedButton[n]=0,an(e,n)),M$1(e,t);}function Jl(e,t){_t(e,t,"disable"),M$1(e,t);}function Ql(e,t){_t(e,t,"enable"),M$1(e,t);}function qr(e,t,n){let r=kt.get(t);kt.set(t,{selectedChar:n.selectedChar??r?.selectedChar??on,unselectedChar:n.unselectedChar??r?.unselectedChar??ln});}function Jr(e,t){return kt.get(t)??{selectedChar:on,unselectedChar:ln}}function Zl(e,t){let n=Jr(e,t);return $r(e,t)?n.selectedChar:n.unselectedChar}function ta(e,t){kt.delete(t);}function ea(e,t,n){return !at(e,t)||cn(e,t)?false:n==="space"||n==="return"||n==="enter"?(un(e,t),true):false}function Qr(e){let t=[];for(let n=0;n<v.isRadioButton.length;n++)v.isRadioButton[n]===1&&v.radioSetId[n]===e&&t.push(n);return t}function na(e,t,n){let r=Qr(t);for(let o of r)if(lt.get(o)===n)return un(e,o),true;return false}var ie="\u25BC",le="\u25B2",ae="\u25CF",se=" ";var g={isSelect:new Uint8Array(1e4),selectedIndex:new Int32Array(1e4).fill(-1),highlightedIndex:new Int32Array(1e4).fill(0),optionCount:new Uint32Array(1e4)},fn={initial:"closed",states:{closed:{on:{open:"open",toggle:"open",disable:"disabled"}},open:{on:{close:"closed",select:"closed",toggle:"closed",disable:"disabled"}},disabled:{on:{enable:"closed"}}}};function G(e){return a(e,"select:options")}function Mt(e){return a(e,"select:display")}function st(e){return a(e,"select:changeCallbacks")}function ct(e){return a(e,"select:openCallbacks")}function ut(e){return a(e,"select:closeCallbacks")}function pn(e,t){let n=t.get(e);if(n)for(let r of n)r();}function Zr(e,t,n,r){n!=="open"&&r==="open"?pn(t,ct(e)):n==="open"&&r!=="open"&&pn(t,ut(e));}function ca(e,t,n=[],r=-1){g.isSelect[t]=1,g.selectedIndex[t]=r,g.highlightedIndex[t]=r>=0?r:0,g.optionCount[t]=n.length,G(e).set(t,[...n]),I(e,t,fn);}function dn(e,t){return g.isSelect[t]===1&&T(e,t)}function wt(e,t){return h(e,t)??"closed"}function gn(e,t,n){return wt(e,t)===n}function to(e,t){return gn(e,t,"open")}function eo(e,t){return gn(e,t,"disabled")}function ft(e,t,n){if(!dn(e,t))return false;let r=wt(e,t),o=W(e,t,n);if(o){let i=wt(e,t);M$1(e,t),Zr(e,t,r,i);}return o}function ua(e,t){return ft(e,t,"open")}function fa(e,t){return ft(e,t,"close")}function pa(e,t){return ft(e,t,"toggle")}function da(e,t){return ft(e,t,"disable")}function ga(e,t){return ft(e,t,"enable")}function xa(e,t){return G(e).get(t)??[]}function ya(e,t,n){G(e).set(t,[...n]),g.optionCount[t]=n.length,(g.selectedIndex[t]??-1)>=n.length&&(g.selectedIndex[t]=n.length>0?0:-1),g.highlightedIndex[t]=0,M$1(e,t);}function ba(e,t){return g.optionCount[t]??0}function no(e,t,n){return G(e).get(t)?.[n]}function ma(e,t){return g.selectedIndex[t]??-1}function xn(e,t){let n=g.selectedIndex[t]??-1;if(!(n<0))return no(e,t,n)}function ha(e,t){return xn(e,t)?.value}function Ea(e,t){return xn(e,t)?.label}function yn(e,t,n){let r=G(e).get(t);if(!r||n<0||n>=r.length||(g.selectedIndex[t]??-1)===n)return false;g.selectedIndex[t]=n,g.highlightedIndex[t]=n,M$1(e,t);let i=r[n],a=st(e).get(t);if(a&&i)for(let x of a)x(i.value,i.label,n);return ft(e,t,"select"),true}function Sa(e,t,n){let r=G(e).get(t);if(!r)return false;let o=r.findIndex(i=>i.value===n);return o<0?false:yn(e,t,o)}function Ca(e,t){g.selectedIndex[t]=-1,M$1(e,t);}function ro(e,t){return g.highlightedIndex[t]??0}function bn(e,t,n){let r=g.optionCount[t]??0;if(r===0)return;let o=Math.max(0,Math.min(n,r-1));g.highlightedIndex[t]=o,M$1(e,t);}function va(e,t,n=true){let r=g.optionCount[t]??0;if(r===0)return;let o=(g.highlightedIndex[t]??0)+1;o>=r&&(o=n?0:r-1),bn(e,t,o);}function Wa(e,t,n=true){let r=g.optionCount[t]??0;if(r===0)return;let o=(g.highlightedIndex[t]??0)-1;o<0&&(o=n?r-1:0),bn(e,t,o);}function Ia(e,t){let n=g.highlightedIndex[t]??0;return yn(e,t,n)}function Ta(e,t,n){let r=Mt(e).get(t);Mt(e).set(t,{closedIndicator:n.closedIndicator??r?.closedIndicator??"\u25BC",openIndicator:n.openIndicator??r?.openIndicator??"\u25B2",selectedMark:n.selectedMark??r?.selectedMark??"\u25CF",separator:n.separator??r?.separator??" "});}function oo(e,t){return Mt(e).get(t)??{closedIndicator:"\u25BC",openIndicator:"\u25B2",selectedMark:"\u25CF",separator:" "}}function Aa(e,t){Mt(e).delete(t);}function ka(e,t){let n=oo(e,t);return wt(e,t)==="open"?n.openIndicator:n.closedIndicator}function _a(e,t,n){let r=st(e).get(t)??[];return r.push(n),st(e).set(t,r),()=>{let o=st(e).get(t);if(o){let i=o.indexOf(n);i!==-1&&o.splice(i,1);}}}function Ma(e,t,n){let r=ct(e).get(t)??[];return r.push(n),ct(e).set(t,r),()=>{let o=ct(e).get(t);if(o){let i=o.indexOf(n);i!==-1&&o.splice(i,1);}}}function Fa(e,t,n){let r=ut(e).get(t)??[];return r.push(n),ut(e).set(t,r),()=>{let o=ut(e).get(t);if(o){let i=o.indexOf(n);i!==-1&&o.splice(i,1);}}}function Ba(e,t){st(e).delete(t),ct(e).delete(t),ut(e).delete(t);}function Da(e,t,n){if(!dn(e,t)||eo(e,t))return null;let r=to(e,t);switch(n){case "return":case "enter":case "space":return r?{type:"select",index:ro(e,t)}:{type:"open"};case "escape":return r?{type:"close"}:null;case "up":return r?{type:"highlightPrev"}:{type:"open"};case "down":return r?{type:"highlightNext"}:{type:"open"};case "home":return r?{type:"highlightFirst"}:null;case "end":return r?{type:"highlightLast"}:null;default:return null}}function Ra(e){g.isSelect.fill(0),g.selectedIndex.fill(-1),g.highlightedIndex.fill(0),g.optionCount.fill(0),G(e).clear(),Mt(e).clear(),st(e).clear(),ct(e).clear(),ut(e).clear();}var N={Horizontal:0,Vertical:1},ce="\u2500",ue="\u2502",fe="\u25CF",pe="\u2501",de="\u2503",ge=1717987071,xe=255,ye=4294967295,be=6750207,me=16711935,he=255,z=1e4,s={isSlider:new Uint8Array(z),value:new Float32Array(z),min:new Float32Array(z),max:new Float32Array(z).fill(100),step:new Float32Array(z).fill(1),orientation:new Uint8Array(z),showValue:new Uint8Array(z)},mn={initial:"idle",states:{idle:{on:{focus:"focused",disable:"disabled"}},focused:{on:{blur:"idle",dragStart:"dragging",disable:"disabled"}},dragging:{on:{dragEnd:"focused",blur:"idle",disable:"disabled"}},disabled:{on:{enable:"idle"}}}};function Ft(e){return a(e,"slider:display")}function pt(e){return a(e,"slider:changeCallbacks")}function dt(e){return a(e,"slider:dragStartCallbacks")}function gt(e){return a(e,"slider:dragEndCallbacks")}function Ee(e,t,n){return Math.max(t,Math.min(n,e))}function En(e,t,n){return t<=0?e:n+Math.round((e-n)/t)*t}function hn(e,t){let n=t.get(e);if(n)for(let r of n)r();}function lo(e,t,n,r){n!=="dragging"&&r==="dragging"?hn(t,dt(e)):n==="dragging"&&r!=="dragging"&&hn(t,gt(e));}function Ya(e,t,n=0,r=100,o=0,i=1){s.isSlider[t]=1,s.min[t]=n,s.max[t]=r,s.value[t]=Ee(o,n,r),s.step[t]=i,s.orientation[t]=N.Horizontal,s.showValue[t]=0,I(e,t,mn);}function Sn(e,t){return s.isSlider[t]===1&&T(e,t)}function Nt(e,t){return h(e,t)??"idle"}function Cn(e,t,n){return Nt(e,t)===n}function Xa(e,t){let n=Nt(e,t);return n==="focused"||n==="dragging"}function Ka(e,t){return Cn(e,t,"dragging")}function ao(e,t){return Cn(e,t,"disabled")}function xt(e,t,n){if(!Sn(e,t))return false;let r=Nt(e,t),o=W(e,t,n);if(o){let i=Nt(e,t);M$1(e,t),lo(e,t,r,i);}return o}function Ga(e,t){return xt(e,t,"focus")}function za(e,t){return xt(e,t,"blur")}function ja(e,t){return xt(e,t,"dragStart")}function $a(e,t){return xt(e,t,"dragEnd")}function qa(e,t){return xt(e,t,"disable")}function Ja(e,t){return xt(e,t,"enable")}function so(e,t){return s.value[t]??0}function j(e,t,n){let r=s.min[t]??0,o=s.max[t]??100,i=s.step[t]??1,a=Ee(En(n,i,r),r,o),x=s.value[t]??0;if(a!==x){s.value[t]=a,M$1(e,t);let u=pt(e).get(t);if(u)for(let d of u)d(a);}}function Qa(e,t){return s.min[t]??0}function Za(e,t){return s.max[t]??100}function ts(e,t){return s.step[t]??1}function es(e,t,n,r){m$2.parse({min:n,max:r}),s.min[t]=n,s.max[t]=r;let o=s.value[t]??0,i=Ee(o,n,r);i!==o&&j(e,t,i),M$1(e,t);}function ns(e,t,n){n$1.parse(n),s.step[t]=n;let r=s.value[t]??0,o=s.min[t]??0,i=En(r,n,o);i!==r&&j(e,t,i),M$1(e,t);}function co(e,t){let n=s.min[t]??0,r=s.max[t]??100,o=s.value[t]??0;return r===n?0:(o-n)/(r-n)}function rs(e,t,n){z$1.number().finite().parse(n);let r=s.min[t]??0,o=s.max[t]??100,i=Math.max(0,Math.min(1,n)),a=r+i*(o-r);j(e,t,a);}function os(e,t,n=1){let r=s.step[t]??1,o=s.value[t]??0;j(e,t,o+r*n);}function is(e,t,n=1){let r=s.step[t]??1,o=s.value[t]??0;j(e,t,o-r*n);}function ls(e,t){j(e,t,s.min[t]??0);}function as(e,t){j(e,t,s.max[t]??100);}function Yt(e,t){return s.orientation[t]}function ss(e,t,n){s.orientation[t]=n,M$1(e,t);}function uo(e,t){return Yt(e,t)===N.Horizontal}function cs(e,t){return Yt(e,t)===N.Vertical}function fo(e,t){return s.showValue[t]===1}function us(e,t,n){s.showValue[t]=n?1:0,M$1(e,t);}function fs(e,t,n){let r=Ft(e).get(t),o=Yt(e,t),i=o===N.Vertical?ue:ce,a=o===N.Vertical?de:pe;Ft(e).set(t,{trackChar:n.trackChar??r?.trackChar??i,thumbChar:n.thumbChar??r?.thumbChar??fe,fillChar:n.fillChar??r?.fillChar??a,trackFg:n.trackFg??r?.trackFg??ge,trackBg:n.trackBg??r?.trackBg??xe,thumbFg:n.thumbFg??r?.thumbFg??ye,thumbBg:n.thumbBg??r?.thumbBg??be,fillFg:n.fillFg??r?.fillFg??me,fillBg:n.fillBg??r?.fillBg??he});}function po(e,t){let n=Yt(e,t),r=n===N.Vertical?ue:ce,o=n===N.Vertical?de:pe;return Ft(e).get(t)??{trackChar:r,thumbChar:fe,fillChar:o,trackFg:ge,trackBg:xe,thumbFg:ye,thumbBg:be,fillFg:me,fillBg:he}}function ps(e,t){Ft(e).delete(t);}function ds(e,t,n){let r=pt(e).get(t)??[];return r.push(n),pt(e).set(t,r),()=>{let o=pt(e).get(t);if(o){let i=o.indexOf(n);i!==-1&&o.splice(i,1);}}}function gs(e,t,n){let r=dt(e).get(t)??[];return r.push(n),dt(e).set(t,r),()=>{let o=dt(e).get(t);if(o){let i=o.indexOf(n);i!==-1&&o.splice(i,1);}}}function xs(e,t,n){let r=gt(e).get(t)??[];return r.push(n),gt(e).set(t,r),()=>{let o=gt(e).get(t);if(o){let i=o.indexOf(n);i!==-1&&o.splice(i,1);}}}function ys(e,t){pt(e).delete(t),dt(e).delete(t),gt(e).delete(t);}function bs(e,t,n){if(!Sn(e,t)||ao(e,t))return null;let r=uo(e,t);switch(n){case "right":return r?{type:"increment",multiplier:1}:null;case "left":return r?{type:"decrement",multiplier:1}:null;case "up":return r?null:{type:"increment",multiplier:1};case "down":return r?null:{type:"decrement",multiplier:1};case "pageup":return {type:"increment",multiplier:10};case "pagedown":return {type:"decrement",multiplier:10};case "home":return {type:"toMin"};case "end":return {type:"toMax"};default:return null}}function ms(e,t,n){if(n<=0)return "";let r=co(e,t),o=po(e,t),i=fo(e,t),a="",x=n;i&&(a=` ${so(e,t)}`,x=Math.max(1,n-a.length));let u=Math.round(r*(x-1)),d="";for(let b=0;b<x;b++)b===u?d+=o.thumbChar:b<u?d+=o.fillChar:d+=o.trackChar;return d+a}function hs(e){s.isSlider.fill(0),s.value.fill(0),s.min.fill(0),s.max.fill(100),s.step.fill(1),s.orientation.fill(0),s.showValue.fill(0),Ft(e).clear(),pt(e).clear(),dt(e).clear(),gt(e).clear();}function go(e){b.scrollX[e]=0,b.scrollY[e]=0,b.scrollWidth[e]=0,b.scrollHeight[e]=0,b.viewportWidth[e]=0,b.viewportHeight[e]=0,b.scrollbarVisible[e]=2,b.trackVisible[e]=1,b.alwaysScroll[e]=0,b.clampEnabled[e]=1;}function A(e,t){m$1(e,t,b)||(l(e,t,b),go(t));}function yt(e){if(!(b.clampEnabled[e]===1))return;let n=b.viewportWidth[e],r=b.viewportHeight[e],o=b.scrollWidth[e],i=b.scrollHeight[e];if(n>0){let a=Math.max(0,o-n);b.scrollX[e]=Math.max(0,Math.min(a,b.scrollX[e]));}else b.scrollX[e]=Math.max(0,b.scrollX[e]);if(r>0){let a=Math.max(0,i-r);b.scrollY[e]=Math.max(0,Math.min(a,b.scrollY[e]));}else b.scrollY[e]=Math.max(0,b.scrollY[e]);}function xo(e,t){t.scrollWidth!==void 0&&(b.scrollWidth[e]=t.scrollWidth),t.scrollHeight!==void 0&&(b.scrollHeight[e]=t.scrollHeight),t.viewportWidth!==void 0&&(b.viewportWidth[e]=t.viewportWidth),t.viewportHeight!==void 0&&(b.viewportHeight[e]=t.viewportHeight),t.scrollbarVisible!==void 0&&(b.scrollbarVisible[e]=t.scrollbarVisible);}function yo(e,t){t.trackVisible!==void 0&&(b.trackVisible[e]=t.trackVisible?1:0),t.alwaysScroll!==void 0&&(b.alwaysScroll[e]=t.alwaysScroll?1:0),t.clampEnabled!==void 0&&(b.clampEnabled[e]=t.clampEnabled?1:0);}function bo(e,t){xo(e,t),yo(e,t),t.scrollX!==void 0&&(b.scrollX[e]=t.scrollX),t.scrollY!==void 0&&(b.scrollY[e]=t.scrollY),yt(e);}function Is(e,t,n){return j$1.parse(n),A(e,t),bo(t,n),t}function mo(e,t,n,r){return A(e,t),b.scrollX[t]=n,b.scrollY[t]=r,yt(t),t}function Ts(e,t){return m$1(e,t,b)?{x:b.scrollX[t],y:b.scrollY[t]}:{x:0,y:0}}function As(e,t,n,r){return A(e,t),b.scrollX[t]=b.scrollX[t]+n,b.scrollY[t]=b.scrollY[t]+r,yt(t),t}function ks(e,t,n,r){return mo(e,t,n,r)}function _s(e,t){if(!m$1(e,t,b))return {x:0,y:0};let n=b.scrollX[t],r=b.scrollY[t],o=b.scrollWidth[t],i=b.scrollHeight[t],a=b.viewportWidth[t],x=b.viewportHeight[t],u=o-a,d=i-x,b$1=u>0?n/u*100:0,k=d>0?r/d*100:0;return {x:Math.min(100,Math.max(0,b$1)),y:Math.min(100,Math.max(0,k))}}function Ms(e,t,n,r){A(e,t);let o=b.scrollWidth[t],i=b.scrollHeight[t],a=b.viewportWidth[t],x=b.viewportHeight[t],u=Math.min(100,Math.max(0,n)),d=Math.min(100,Math.max(0,r)),b$1=Math.max(0,o-a),k=Math.max(0,i-x);return b.scrollX[t]=u/100*b$1,b.scrollY[t]=d/100*k,t}function Fs(e,t){if(m$1(e,t,b))return {scrollX:b.scrollX[t],scrollY:b.scrollY[t],scrollWidth:b.scrollWidth[t],scrollHeight:b.scrollHeight[t],viewportWidth:b.viewportWidth[t],viewportHeight:b.viewportHeight[t],scrollbarVisible:b.scrollbarVisible[t],trackVisible:b.trackVisible[t]===1,alwaysScroll:b.alwaysScroll[t]===1,clampEnabled:b.clampEnabled[t]===1}}function Bs(e,t){return m$1(e,t,b)}function Ds(e,t,n,r){return A(e,t),b.scrollWidth[t]=n,b.scrollHeight[t]=r,yt(t),t}function Rs(e,t,n,r){return A(e,t),b.viewportWidth[t]=n,b.viewportHeight[t]=r,yt(t),t}function Ls(e,t,n){return A(e,t),b.clampEnabled[t]=n?1:0,n&&yt(t),t}function Us(e,t,n){return A(e,t),b.scrollbarVisible[t]=n,t}function Os(e,t){return A(e,t),b.scrollY[t]=0,t}function Ps(e,t){A(e,t);let n=b.scrollHeight[t],r=b.viewportHeight[t];return b.scrollY[t]=Math.max(0,n-r),t}function Hs(e,t){return A(e,t),b.scrollX[t]=0,t}function Vs(e,t){A(e,t);let n=b.scrollWidth[t],r=b.viewportWidth[t];return b.scrollX[t]=Math.max(0,n-r),t}function ws(e,t){if(!m$1(e,t,b))return false;let n=b.scrollWidth[t],r=b.scrollHeight[t],o=b.viewportWidth[t],i=b.viewportHeight[t];return o>0||i>0?n>o||r>i:n>0||r>0}function Ns(e,t){if(!m$1(e,t,b))return false;let n=b.scrollWidth[t],r=b.viewportWidth[t];return n>r}function Ys(e,t){if(!m$1(e,t,b))return false;let n=b.scrollHeight[t],r=b.viewportHeight[t];return n>r}function Xs(e,t){return m$1(e,t,b)?b.scrollY[t]<=0:true}function Ks(e,t){if(!m$1(e,t,b))return true;let n=b.scrollY[t],r=b.scrollHeight[t],o=b.viewportHeight[t],i=Math.max(0,r-o);return n>=i}function Gs(e,t){return m$1(e,t,b)?b.scrollX[t]<=0:true}function zs(e,t){if(!m$1(e,t,b))return true;let n=b.scrollX[t],r=b.scrollWidth[t],o=b.viewportWidth[t],i=Math.max(0,r-o);return n>=i}export{ni as $,mr as $a,oe as $b,gn as $c,Ka as $d,Vs as $e,Rn as A,tr as Aa,Pr as Ab,sn as Ac,Aa as Ad,us as Ae,Uo as B,er as Ba,Hr as Bb,$r as Bc,ka as Bd,fs as Be,Oo as C,C as Ca,al as Cb,cn as Cc,_a as Cd,po as Ce,He as D,Ne as Da,sl as Db,Gl as Dc,Ma as Dd,ps as De,Po as E,Ye as Ea,cl as Eb,zl as Ec,Fa as Ed,ds as Ee,Ho as F,nr as Fa,It as Fb,jl as Fc,Ba as Fd,gs as Fe,Vo as G,rr as Ga,p as Gb,$l as Gc,Da as Gd,xs as Ge,wo as H,or as Ha,Qe as Hb,un as Hc,Ra as Hd,ys as He,Un as I,ir as Ia,Ze as Ib,ql as Ic,N as Id,bs as Ie,No as J,lr as Ja,tn as Jb,Jl as Jc,ce as Jd,ms as Je,Yo as K,ar as Ka,en as Kb,Ql as Kc,ue as Kd,hs as Ke,On as L,sr as La,pl as Lb,qr as Lc,fe as Ld,Is as Le,Et as M,cr as Ma,dl as Mb,Jr as Mc,pe as Md,mo as Me,zo as N,ur as Na,gl as Nb,Zl as Nc,de as Nd,Ts as Ne,jo as O,fr as Oa,xl as Ob,ta as Oc,ge as Od,As as Oe,Y as P,pr as Pa,yl as Pb,ea as Pc,xe as Pd,ks as Pe,Ot as Q,tt as Qa,bl as Qb,Qr as Qc,ye as Qd,_s as Qe,Ve as R,Xe as Ra,nn as Rb,na as Rc,be as Rd,Ms as Re,Pt as S,dr as Sa,ml as Sb,ie as Sc,me as Sd,Fs as Se,$o as T,Vt as Ta,hl as Tb,le as Tc,he as Td,Bs as Te,qo as U,gr as Ua,At as Ub,ae as Uc,s as Ud,Ds as Ue,Jo as V,xr as Va,El as Vb,se as Vc,mn as Vd,Rs as Ve,Qo as W,yr as Wa,Sl as Wb,g as Wc,Ya as Wd,Ls as We,Zo as X,Ct as Xa,Cl as Xb,fn as Xc,Sn as Xd,Us as Xe,ti as Y,br as Ya,vl as Yb,ca as Yc,Nt as Yd,Os as Ye,ei as Z,vt as Za,Wl as Zb,dn as Zc,Cn as Zd,Ps as Ze,Vn as _,Ke as _a,Nr as _b,wt as _c,Xa as _d,Hs as _e,D as a,ri as aa,ne as ab,Il as ac,to as ad,ao as ae,ws as af,I as b,$t as ba,hr as bb,Tl as bc,eo as bd,xt as be,Ns as bf,Wo as c,F as ca,Er as cb,Al as cc,ft as cd,Ga as ce,Ys as cf,h as d,Jt as da,re as db,kl as dc,ua as dd,za as de,Xs as df,Io as e,J as ea,Ar as eb,_l as ec,fa as ed,ja as ee,Ks as ef,W as f,Q as fa,Ge as fb,Ml as fc,pa as fd,$a as fe,Gs as ff,To as g,Qt as ga,kr as gb,Fl as gc,da as gd,qa as ge,zs as gf,Ao as h,Zt as ha,_r as hb,Bl as hc,ga as hd,Ja as he,P as i,f as ia,X as ib,Dl as ic,xa as id,so as ie,ko as j,Nn as ja,Zi as jb,Rl as jc,ya as jd,j as je,T as k,Yn as ka,tl as kb,Kr as kc,ba as kd,Qa as ke,_n as l,S as la,$e as lb,v as lc,no as ld,Za as le,bt as m,Z as ma,Br as mb,M as mc,ma as md,ts as me,Ue as n,O as na,Dr as nb,on as nc,xn as nd,es as ne,Oe as o,Ht as oa,Rr as ob,ln as oc,ha as od,ns as oe,Bo as p,Xn as pa,el as pb,Pl as pc,Ea as pd,co as pe,Do as q,Kn as qa,qe as qb,Hl as qc,yn as qd,rs as qe,L as r,Gn as ra,nl as rb,Vl as rc,Sa as rd,os as re,zt as s,zn as sa,Je as sb,jr as sc,Ca as sd,is as se,ht as t,te as ta,Lr as tb,wl as tc,ro as td,ls as te,jt as u,jn as ua,Ur as ub,Nl as uc,bn as ud,as as ue,Pe as v,$n as va,rl as vb,Yl as vc,va as vd,Yt as ve,Ro as w,qn as wa,Or as wb,Xl as wc,Wa as wd,ss as we,Lo as x,Jn as xa,ol as xb,at as xc,Ia as xd,uo as xe,Bn as y,Qn as ya,il as yb,Kl as yc,Ta as yd,cs as ye,Dn as z,Zn as za,ll as zb,_t as zc,oo as zd,fo as ze};
@@ -1 +0,0 @@
1
- import {a as a$1,f as f$1,j,b}from'./chunk-RJULLVTH.js';import {Ga,Ba}from'./chunk-ETFDYZVJ.js';import {m as m$1,l,n}from'./chunk-7ZFQO3OQ.js';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,U=new Map;function ae(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 he(t,e,n={}){return m$1(t,e,a)||(l(t,e,a),ae(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 ge(t,e){if(m$1(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 xe(t,e){return m$1(t,e,a)}function Te(t,e){return m$1(t,e,a)&&n(t,e,a),Y.delete(e),U.delete(e),e}function ve(t,e){m$1(t,e,a)&&(a.behaviorType[e]=M.Idle,a.state[e]=h.Active,a.targetEntity[e]=0);}function Ee(t,e,n,o={}){m$1(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 we(t,e,n){m$1(t,e,a)&&(a.behaviorType[e]=M.Chase,a.state[e]=h.Active,a.targetEntity[e]=n);}function Ce(t,e,n){m$1(t,e,a)&&(a.behaviorType[e]=M.Flee,a.state[e]=h.Active,a.targetEntity[e]=n);}function We(t,e,n){m$1(t,e,a)&&(a.behaviorType[e]=M.Custom,a.state[e]=h.Active,U.set(e,n));}function Ae(t,e){if(m$1(t,e,a))return a.behaviorType[e]}function Ie(t,e){if(m$1(t,e,a))return a.state[e]}function Pe(t,e){return m$1(t,e,a)?a.targetEntity[e]:0}function Fe(t,e,n){m$1(t,e,a)&&(a.targetEntity[e]=n);}function Be(t,e,n){m$1(t,e,a)&&(a.speed[e]=n);}function Me(t,e,n){m$1(t,e,a)&&(a.detectionRange[e]=n);}function Ye(t,e){return m$1(t,e,a)?a.state[e]===h.Active:false}function De(t,e){return m$1(t,e,a)?a.state[e]===h.Waiting:false}function Re(t,e){return m$1(t,e,a)?a.state[e]===h.Completed:false}function Xe(t,e){if(m$1(t,e,a))return Y.get(e)}function Ue(t,e){if(!m$1(t,e,a))return;let n=Y.get(e);if(!n)return;let o=a.patrolIndex[e];return n.points[o]}function Se(t,e,n,o,u){if(!m$1(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?oe(e,l):{dx:b/p*x,dy:y/p*x}}function oe(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 Ze(t,e,n,o,u,l){if(!m$1(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 ke(t,e,n,o,u,l){if(!m$1(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 Oe(t,e,n){if(!m$1(t,e,a))return;let o=U.get(e);o&&o(t,e,n);}function Le(t,e,n){if(!m$1(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 Ve(){Y.clear(),U.clear();}var E=1e4,S=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)},ie=80,ue=24;function X(t){r.x[t]=0,r.y[t]=0,r.width[t]=ie,r.height[t]=ue,r.followTarget[t]=S,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 Ne(t,e,n={}){return m$1(t,e,r)||(l(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 ze(t,e){if(m$1(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 Ge(t,e){return m$1(t,e,r)}function je(t,e){return m$1(t,e,r)&&n(t,e,r),e}function Je(t,e,n,o){return m$1(t,e,r)||(l(t,e,r),X(e)),r.followTarget[e]=n,o!==void 0&&(r.smoothing[e]=Math.max(0,Math.min(1,o))),e}function Ke(t,e){return m$1(t,e,r)?r.followTarget[e]:S}function Qe(t,e){return m$1(t,e,r)?r.followTarget[e]!==S:false}function $e(t,e,n,o){return m$1(t,e,r)||(l(t,e,r),X(e)),r.deadZoneX[e]=n,r.deadZoneY[e]=o,e}function et(t,e,n){return m$1(t,e,r)||(l(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 tt(t,e){return m$1(t,e,r)&&(r.bounded[e]=0),e}function nt(t,e){return m$1(t,e,r)?r.bounded[e]===1:false}function rt(t,e,n,o){return m$1(t,e,r)||(l(t,e,r),X(e)),r.x[e]=n,r.y[e]=o,r.bounded[e]===1&&Z(e),e}function at(t,e){if(m$1(t,e,r))return {x:r.x[e],y:r.y[e]}}function ot(t,e,n,o){return m$1(t,e,r)&&(r.x[e]=r.x[e]+n,r.y[e]=r.y[e]+o,r.bounded[e]===1&&Z(e)),e}function Z(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 it(t,e,n,o){if(!m$1(t,e,r))return;let u=r.x[e],l=r.y[e];return {x:n-u,y:o-l}}function ut(t,e,n,o){if(!m$1(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(!m$1(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 mt(t,e,n,o,u,l){if(!m$1(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 st(t,e,n){if(!m$1(t,e,r))return;let o=r.followTarget[e];if(o===S||!Ga(t,o))return;let u=Ba.x[o],l=Ba.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],V=w,G=I,ne=w+c/2,re=I+s/2,j=u-ne,J=l-re;if(Math.abs(j)>y){let H=j>0?x+y:x-y;V=$(w,H,b,n);}if(Math.abs(J)>p){let H=J>0?B+p:B-p;G=$(I,H,b,n);}r.x[e]=V,r.y[e]=G,r.bounded[e]===1&&Z(e);}function $(t,e,n,o){if(n<=0)return e;let u=1-n**(o*10);return t+(e-t)*u}function ft(t,e,n,o){if(!m$1(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&&Z(e),e}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)},O=new Map,C=a$1(256),A=new Map;function le(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 yt(t,e,n){return m$1(t,e,f)||(l(t,e,f),le(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 pt(t,e){if(m$1(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 ht(t,e){return m$1(t,e,f)}function gt(t,e){if(m$1(t,e,f)){let n$1=A.get(e);n$1&&(f$1(C,n$1),A.delete(e)),n(t,e,f);}return e}function xt(t,e){return m$1(t,e,f)?f.age[e]>=f.lifetime[e]:true}function me(t,e){if(!m$1(t,e,f))return 1;let n=f.lifetime[e];return n<=0?1:Math.min(1,f.age[e]/n)}function k(t,e,n){return Math.round(t+(e-t)*n)}function se(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=k(u,b,o),w=k(l,y,o),I=k(c,p,o);return ((k(s,x,o)&255)<<24|(B&255)<<16|(w&255)<<8|I&255)>>>0}function Tt(t,e){if(!m$1(t,e,f))return 0;let n=me(t,e);return se(f.startFg[e],f.endFg[e],n)}function fe(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 vt(t,e,n){return m$1(t,e,m)||(l(t,e,m),fe(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 Et(t,e){if(m$1(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 wt(t,e){return m$1(t,e,m)}function Ct(t,e){if(m$1(t,e,m)){n(t,e,m),O.delete(e);let n$1=j(C),o=[];for(let u=0;u<C.size;u++){let l=n$1[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 Wt(t,e){O.set(t,e);}function At(t){return O.get(t)}function It(t){let e=new Set,n=j(C);for(let o=0;o<C.size;o++){let u=n[o];u&&u.emitterId===t&&e.add(u.particleId);}return e}function Pt(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 Ft(t,e){let n=A.get(e);n&&(f$1(C,n),A.delete(e));}function Bt(t,e){m$1(t,e,m)&&(m.active[e]=1);}function Mt(t,e){m$1(t,e,m)&&(m.active[e]=0);}function Yt(t,e){return m$1(t,e,m)?m.active[e]===1:false}function Dt(t,e,n){m$1(t,e,m)&&(m.rate[e]=n);}function Rt(t,e,n){m$1(t,e,m)&&(m.speed[e]=n);}function Xt(t,e,n){m$1(t,e,m)&&(m.gravity[e]=n);}function Ut(){return C}function St(){O.clear(),C=a$1(256),A.clear();}var D=1e4,L=0,ee=1,W={tilesets:new Map,nameToId:new Map};function Ot(){W.tilesets.clear(),W.nameToId.clear(),ee=1;}function Lt(t){let e=ee++,n={id:e,name:t.name,tiles:t.tiles};return W.tilesets.set(e,n),W.nameToId.set(t.name,e),e}function Vt(t){return W.tilesets.get(t)}function Ht(t){let e=W.nameToId.get(t);if(e!==void 0)return W.tilesets.get(e)}function _t(t){let e=W.tilesets.get(t);return e?(W.nameToId.delete(e.name),W.tilesets.delete(t),true):false}var te=1,T={data:new Map};function qt(){T.data.clear(),te=1;}function ce(t,e,n=1){let o=te++,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 Nt(t){return T.data.get(t)}function zt(t){return T.data.delete(t)}function Gt(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 L;let l=u.layers[e];return !l||n<0||n>=u.width||o<0||o>=u.height?L:l.tiles[o*u.width+n]}function Jt(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 Kt(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 Qt(t){let e=T.data.get(t);return e?e.layers.length:0}function $t(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 en(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 tn(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 be(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 nn(t,e,n){if(m$1(t,e,d)||(l(t,e,d),be(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=ce(n.width,n.height,n.layerCount??1);d.dataId[e]=o;}return e}function rn(t,e){if(m$1(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 an(t,e){return m$1(t,e,d)}function on(t,e,n$1=false){if(!m$1(t,e,d))return e;if(!n$1){let o=d.dataId[e];o>0&&T.data.delete(o);}return n(t,e,d),e}function un(t,e){return m$1(t,e,d)?d.dataId[e]:0}var z={char:" ",fg:0,bg:0};function de(t){let e=[];for(let n=0;n<t;n++)e.push({...z});return e}function ye(t,e,n,o){if(n<0||n>=t.width||o<0||o>=t.height)return z;let u=z;for(let l of t.layers){if(!l.visible)continue;let c=l.tiles[o*t.width+n];if(c===L)continue;let s=e.tiles[c];s&&(u={char:s.char,fg:s.fg,bg:s.bg});}return u}function ln(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(de(u));return b}for(let y=0;y<l;y++){let p=[];for(let x=0;x<u;x++)p.push(ye(c,s,n+x,o+y));b.push(p);}return b}export{m as $,Oe as A,W as Aa,Le as B,Ot as Ba,Ve as C,Lt as Ca,r as D,Vt as Da,ie as E,Ht as Ea,ue as F,_t as Fa,Ne as G,T as Ga,ze as H,qt as Ha,Ge as I,ce as Ia,je as J,Nt as Ja,Je as K,zt as Ka,Ke as L,Gt as La,Qe as M,jt as Ma,$e as N,Jt as Na,et as O,Kt as Oa,tt as P,Qt as Pa,nt as Q,$t as Qa,rt as R,en as Ra,at as S,tn as Sa,ot as T,d as Ta,it as U,nn as Ua,ut as V,rn as Va,lt as W,an as Wa,mt as X,on as Xa,st as Y,un as Ya,ft as Z,ln as Za,f as _,a,yt as aa,M as b,pt as ba,h as c,ht as ca,he as d,gt as da,ge as e,xt as ea,xe as f,me as fa,Te as g,se as ga,ve as h,Tt as ha,Ee as i,vt as ia,we as j,Et as ja,Ce as k,wt as ka,We as l,Ct as la,Ae as m,Wt as ma,Ie as n,At as na,Pe as o,It as oa,Fe as p,Pt as pa,Be as q,Ft as qa,Me as r,Bt as ra,Ye as s,Mt as sa,De as t,Yt as ta,Re as u,Dt as ua,Xe as v,Rt as va,Ue as w,Xt as wa,Se as x,Ut as xa,Ze as y,St as ya,ke as z,L as za};
@@ -1 +0,0 @@
1
- import {d,f}from'./chunk-LI3ZYXUT.js';import {Ba,Ga,k,i,a,$,fa,f as f$1,Fa,X,_,Z}from'./chunk-ETFDYZVJ.js';import {m,o as o$1,l}from'./chunk-7ZFQO3OQ.js';var p=1e4,o={x:new Float32Array(p),y:new Float32Array(p),width:new Float32Array(p),height:new Float32Array(p),valid:new Uint8Array(p)};function A(n,t){if(m(n,t,o)&&o.valid[t]===1)return {x:o.x[t],y:o.y[t],width:o.width[t],height:o.height[t]}}function nt(n,t){return m(n,t,o)&&o.valid[t]===1}function et(n,t){m(n,t,o)&&(o.valid[t]=0);}function z(n,t){m(n,t,o)||(l(n,t,o),o.x[t]=0,o.y[t]=0,o.width[t]=0,o.height[t]=0,o.valid[t]=0);}function x(n){if(!d(n))return {width:80,height:24};let t=f(n);return !t||!fa(n,t)?{width:80,height:24}:{width:$.width[t],height:$.height[t]}}function I(n,t,e,i,s){let r;if(n===X)r=e;else if(_(n)){let u=Z(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,i,s,r){z(n,t);let u=Ga(n,t)?Ba.x[t]:0,m=Ga(n,t)?Ba.y[t]:0,a=Fa(n,t),f,y;a?(f=u,y=m):(f=e+u,y=i+m);let l=0,g=0;if(fa(n,t)){let _=$.width[t],k=$.height[t],O=$.minWidth[t],q=$.minHeight[t],B=$.maxWidth[t],R=$.maxHeight[t],S=$.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+s&&(l=Math.max(0,e+s-f)),y+g>i+r&&(g=Math.max(0,i+r-y))),o.x[t]=f,o.y[t]=y,o.width[t]=l,o.height[t]=g,o.valid[t]=1;}function Y(n,t,e,i,s,r){U(n,t,e,i,s,r);let u=A(n,t);if(!u)return;let m=f$1(n,t);for(let a of m)Y(n,a,u.x,u.y,u.width,u.height);}function G(n){let t=o$1(n,[Ba]),e=[];for(let i$1 of t)k(n,i$1)?i(n,i$1)===a&&e.push(i$1):e.push(i$1);return e}var J=n=>{let t=x(n),e=G(n);for(let i of e)Y(n,i,0,0,t.width,t.height);return n};function ot(){return J}function rt(n){let t=o$1(n,[Ba]);for(let e of t)m(n,e,o)&&(o.valid[e]=0);}function K(n,t){if(!Ga(n,t))return;let e=0,i$1=0,s,r;if(k(n,t)){let u=i(n,t);if(u!==a){let m=K(n,u);if(m)e=m.x,i$1=m.y,s=m.width,r=m.height;else {let a=x(n);s=a.width,r=a.height;}}else {let m=x(n);s=m.width,r=m.height;}}else {let u=x(n);s=u.width,r=u.height;}return U(n,t,e,i$1,s,r),A(n,t)}function it(n,t){let e=A(n,t);if(e)return {left:e.x,top:e.y,right:e.x+e.width-1,bottom:e.y+e.height-1}}export{o as a,A as b,nt as c,et as d,J as e,ot as f,rt as g,K as h,it as i};
File without changes