-
Notifications
You must be signed in to change notification settings - Fork 0
/
FourSouls.79ab49a7.js
2 lines (2 loc) · 165 KB
/
FourSouls.79ab49a7.js
1
2
!function(){var e={};var t=function(t){var a=e[t];if(null==a)throw new Error("Could not resolve bundle with id "+t);return a};(function(t){for(var a=Object.keys(t),r=0;r<a.length;r++)e[a[r]]=t[a[r]]})(JSON.parse('{"42dd58089660cbcd":"FourSouls.79ab49a7.js","b814f469032f748d":"16x16_sm.aad8ab90.png"}'));var a={};Object.defineProperty(a,"__esModule",{value:!0});var r=function(e,t,a){const r=function(e,t,a){const r=[],n=(e,i)=>{const s=i?(0,o.bound)(i,e.bounds):e.bounds;(0,o.isOver)(a,s)&&(null!=e.handlers[t]&&r.push(e.handlers[t]),e.getChildren().forEach(e=>n(e,s)))};return n(e),r}(e,t,a);r.length&&r[r.length-1]()};a.handleMouseEvent=r;var n=function(e,t){{const a=function(e,t){const a=[],r=(e,n)=>{const i=n?(0,o.bound)(n,e.bounds):e.bounds;if((0,o.isOver)(t,i)){a.push(e);const t=e.getChildren();t&&t.forEach(e=>r(e,i))}};return r(e),a}(e,t),r=a.filter(e=>!O.find(t=>t.type===e.type&&(0,o.boundsAreSame)(e.bounds,t.bounds))),n=O.filter(e=>!a.find(t=>t.type===e.type&&(0,o.boundsAreSame)(e.bounds,t.bounds)));r.forEach(e=>{e.handlers.hover&&e.handlers.hover()}),n.forEach(e=>{e.handlers.out&&e.handlers.out()}),O=a}};a.handleHover=n;var i=function(e,t,a,r){const n=function(e,t){const a=[],r=e=>{null!=e.handlers[t]&&a.push(e.handlers[t]),e.getChildren().forEach(e=>r(e))};return r(e),a}(e,t);if(n.length)for(let e=n.length-1;0<=e;e--)if(n[e](a,r))return};a.handleKeyEvent=i;var o={};Object.defineProperty(o,"__esModule",{value:!0});var s=D;o.bound=s;var l=function(e,t){return e.x===t.x&&e.y===t.y&&e.w===t.w&&e.h===t.h};o.boundsAreSame=l;var d=(k=void 0,P=o.isOver=k,j=o.LayerComp=P,o.createElement=j);o.focusComponent=d;var u={};Object.defineProperty(u,"__esModule",{value:!0});var c=void 0;u.ButtonComp=c;var h={};Object.defineProperty(h,"__esModule",{value:!0});var f=void 0;h.default=f;f={BLACK:"#01001d",GREY_1:"#0d0d0d",GREY_2:"#1d1d1f",GREY_3:"#333334",B_GREY_1:"#443752",B_GREY_2:"#5f5473",B_GREY_3:"#827d9a",B_GREY_4:"#a5a4ba",B_GREY_5:"#dcdce6",RED_1:"#702931",RED_2:"#994639",RED_4:"#e0c270",BROWN_4:"#9e7762",BLUE_1:"#45538f",BROWN_1:"#523839",BROWN_2:"#78524d",BROWN_3:"#9e7762"},h.default=f;var g,p=(g=h)&&g.__esModule?g:{default:g},m={};Object.defineProperty(m,"__esModule",{value:!0});var y=(v=void 0,w=m.floodFill=v,b=m.borderFill=w,m.lineDraw=b);m.vertLineDraw=y;var v=(e,t,a)=>{const r=t.x+t.w,n=t.y+t.h;for(let i=t.y;i<n;i++)for(let n=t.x;n<r;n++)e.draw(n,i," ",null,a)};m.floodFill=v;var w=(e,t)=>{const a=t.x+t.w-1,r=t.y+t.h-1;e.draw(t.x,t.y,"+",null,null),e.draw(t.x,r,"+",null,null),e.draw(a,t.y,"+",null,null),e.draw(a,r,"+",null,null);for(let n=t.y+1;n<r;n++)e.draw(t.x,n,"|",null,null),e.draw(a,n,"|",null,null);for(let n=t.x+1;n<a;n++)e.draw(n,t.y,"-",null,null),e.draw(n,r,"-",null,null)};m.borderFill=w;var b=(e,t,a)=>{const r=t.x+t.w-1;for(let a=t.x;a<=r;a++)e.draw(a,t.y,"-",null,null);if(a){const r=t.x+Math.floor((t.w-a.length)/2),n=Math.max(t.x,r);e.drawText(n,t.y,a)}};m.lineDraw=b;y=(e,t)=>{const a=t.y+t.h-1;for(let r=t.y;r<=a;r++)e.draw(t.x,r,"|",null,null)},m.vertLineDraw=y;var _={};Object.defineProperty(_,"__esModule",{value:!0});var x=function(e,t){t.keys&&(e.handlers.keypress=e=>{if(Array.isArray(t.keys)){for(let a=t.keys.length;a>=0;a--)if(t.keys[a]===e)return t.onClick(),!0}else if(t.keys===e)return t.onClick(),!0;return!1})};_.handleKeyOnClick=x;c=(e,t)=>{const[a,r]=e.useState({hover:!1});(0,m.floodFill)(e.display,e.bounds,a.hover?"#45538f":p.default.B_GREY_1);let n=e.bounds.x;t.showKey&&(e.display.drawOver(n,e.bounds.y,Array.isArray(t.keys)?t.keys[0]:t.keys,p.default.RED_4,null),n+=2);for(let a=0;a<t.title.length;a++)e.display.drawOver(a+n,e.bounds.y,t.title[a],p.default.B_GREY_5,null);e.handlers.hover=()=>{r({hover:!0})},e.handlers.out=()=>{r({hover:!1})},e.handlers.press=()=>{t.onClick()},(0,_.handleKeyOnClick)(e,t)},u.ButtonComp=c;var T={};Object.defineProperty(T,"__esModule",{value:!0});var E=void 0;T.Panel=E;var M={};Object.defineProperty(M,"__esModule",{value:!0});var A=void 0;M.Container=A;A=(e,t)=>t.children,M.Container=A;function D(e,t){const a={x:e.x+t.x,y:e.y+t.y};return null!=t.w&&(a.w=t.w,a.h=t.h),a}E=(e,t)=>((0,m.borderFill)(e.display,e.bounds),[(0,o.createElement)(M.Container,{x:1,y:1,w:e.bounds.w-2,h:e.bounds.h-2},t)]),T.Panel=E;var k=(e,t)=>t.x<=e[0]&&e[0]<t.x+t.w&&t.y<=e[1]&&e[1]<t.y+t.h;o.isOver=k;var P=()=>[S(T.Panel,{x:0,y:0,w:29,h:29},{children:[S(u.ButtonComp,{x:2,y:2,w:5,h:5})]})];o.LayerComp=P;const S=(e,t,a={})=>{let r=!1,n={};const i=e=>Object.assign(n,e),o=e=>(r||(Object.assign(n,e),r=!0),[n,i]),s={};let l=!1;const d=e=>{l||(l=!0,e())};let u=[];return Object.assign((i,l,c)=>{c&&(r=!0,n=c);const h=l?D(l,t):t,f=e({useMount:d,useState:o,display:i,handlers:s,bounds:h},a)||[];f.forEach((e,t)=>{t<u.length&&e.type===u[t].type?(e.setChildren(u[t].getChildren()),e(i,h,u[t].getState())):e(i,h)}),u=f},{type:e,getChildren:()=>u,setChildren:e=>u=e,getState:()=>n,bounds:t,handlers:s})};var j=S;o.createElement=j;d=(e,t)=>{const a=[...e.getChildren()];for(;a.length;){const e=a.pop();e.getState().uiFocus&&(e.getState().uiFocus=!1,t.getState().uiFocus=!0);const r=null==e?void 0:e.getChildren();a.push(...r)}},o.focusComponent=d;let O=[];var R={};Object.defineProperty(R,"__esModule",{value:!0});var C=void 0;R.RDisplay=C;class I{constructor(){this._seed=0,this._s0=0,this._s1=0,this._s2=0,this._c=0}getSeed(){return this._seed}setSeed(e){return e=e<1?1/e:e,this._seed=e,this._s0=2.3283064365386963e-10*(e>>>0),e=69069*e+1>>>0,this._s1=2.3283064365386963e-10*e,e=69069*e+1>>>0,this._s2=2.3283064365386963e-10*e,this._c=1,this}getUniform(){let e=2091639*this._s0+2.3283064365386963e-10*this._c;return this._s0=this._s1,this._s1=this._s2,this._c=0|e,this._s2=e-this._c,this._s2}getUniformInt(e,t){let a=Math.max(e,t),r=Math.min(e,t);return Math.floor(this.getUniform()*(a-r+1))+r}getNormal(e=0,t=1){let a,r,n;do{a=2*this.getUniform()-1,r=2*this.getUniform()-1,n=a*a+r*r}while(n>1||0==n);return e+a*Math.sqrt(-2*Math.log(n)/n)*t}getPercentage(){return 1+Math.floor(100*this.getUniform())}getItem(e){return e.length?e[Math.floor(this.getUniform()*e.length)]:null}shuffle(e){let t=[],a=e.slice();for(;a.length;){let e=a.indexOf(this.getItem(a));t.push(a.splice(e,1)[0])}return t}getWeightedValue(e){let t=0;for(let a in e)t+=e[a];let a,r=this.getUniform()*t,n=0;for(a in e)if(n+=e[a],r<n)return a;return a}getState(){return[this._s0,this._s1,this._s2,this._c]}setState(e){return this._s0=e[0],this._s1=e[1],this._s2=e[2],this._c=e[3],this}clone(){return(new I).setState(this.getState())}}var L=(new I).setSeed(Date.now());class B{getContainer(){return null}setOptions(e){this._options=e}}class N extends B{constructor(){super(),this._ctx=document.createElement("canvas").getContext("2d")}schedule(e){requestAnimationFrame(e)}getContainer(){return this._ctx.canvas}setOptions(e){super.setOptions(e);const t=`${e.fontStyle?e.fontStyle+" ":""} ${e.fontSize}px ${e.fontFamily}`;this._ctx.font=t,this._updateSize(),this._ctx.font=t,this._ctx.textAlign="center",this._ctx.textBaseline="middle"}clear(){this._ctx.fillStyle=this._options.bg,this._ctx.fillRect(0,0,this._ctx.canvas.width,this._ctx.canvas.height)}eventToPosition(e,t){let a=this._ctx.canvas,r=a.getBoundingClientRect();return e-=r.left,t-=r.top,e*=a.width/r.width,t*=a.height/r.height,e<0||t<0||e>=a.width||t>=a.height?[-1,-1]:this._normalizedEventToPosition(e,t)}}class $ extends N{constructor(){super(),this._spacingX=0,this._spacingY=0,this._hexSize=0}draw(e,t){let[a,r,n,i,o]=e,s=[(a+1)*this._spacingX,r*this._spacingY+this._hexSize];if(this._options.transpose&&s.reverse(),t&&(this._ctx.fillStyle=o,this._fill(s[0],s[1])),!n)return;this._ctx.fillStyle=i;let l=[].concat(n);for(let e=0;e<l.length;e++)this._ctx.fillText(l[e],s[0],Math.ceil(s[1]))}computeSize(e,t){return this._options.transpose&&(e+=t,e-=t=e-t),[Math.floor(e/this._spacingX)-1,Math.floor((t-2*this._hexSize)/this._spacingY+1)]}computeFontSize(e,t){this._options.transpose&&(e+=t,e-=t=e-t);let a=2*e/((this._options.width+1)*Math.sqrt(3))-1,r=t/(2+1.5*(this._options.height-1)),n=Math.min(a,r),i=this._ctx.font;this._ctx.font="100px "+this._options.fontFamily;let o=Math.ceil(this._ctx.measureText("W").width);this._ctx.font=i;let s=o/100;n=Math.floor(n)+1;let l=2*n/(this._options.spacing*(1+s/Math.sqrt(3)));return Math.ceil(l)-1}_normalizedEventToPosition(e,t){let a;this._options.transpose?(e+=t,e-=t=e-t,a=this._ctx.canvas.width):a=this._ctx.canvas.height;let r=a/this._options.height;return!function(e,t){return(e%t+t)%t}(t=Math.floor(t/r),2)?e=2*Math.floor(e/(2*this._spacingX)):(e-=this._spacingX,e=1+2*Math.floor(e/(2*this._spacingX))),[e,t]}_fill(e,t){let a=this._hexSize,r=this._options.border;const n=this._ctx;n.beginPath(),this._options.transpose?(n.moveTo(e-a+r,t),n.lineTo(e-a/2+r,t+this._spacingX-r),n.lineTo(e+a/2-r,t+this._spacingX-r),n.lineTo(e+a-r,t),n.lineTo(e+a/2-r,t-this._spacingX+r),n.lineTo(e-a/2+r,t-this._spacingX+r),n.lineTo(e-a+r,t)):(n.moveTo(e,t-a+r),n.lineTo(e+this._spacingX-r,t-a/2+r),n.lineTo(e+this._spacingX-r,t+a/2-r),n.lineTo(e,t+a-r),n.lineTo(e-this._spacingX+r,t+a/2-r),n.lineTo(e-this._spacingX+r,t-a/2+r),n.lineTo(e,t-a+r)),n.fill()}_updateSize(){const e=this._options,t=Math.ceil(this._ctx.measureText("W").width);let a,r;this._hexSize=Math.floor(e.spacing*(e.fontSize+t/Math.sqrt(3))/2),this._spacingX=this._hexSize*Math.sqrt(3)/2,this._spacingY=1.5*this._hexSize,e.transpose?(a="height",r="width"):(a="width",r="height"),this._ctx.canvas[a]=Math.ceil((e.width+1)*this._spacingX),this._ctx.canvas[r]=Math.ceil((e.height-1)*this._spacingY+2*this._hexSize)}}let F=(()=>{class e extends N{constructor(){super(),this._spacingX=0,this._spacingY=0,this._canvasCache={}}setOptions(e){super.setOptions(e),this._canvasCache={}}draw(t,a){e.cache?this._drawWithCache(t):this._drawNoCache(t,a)}_drawWithCache(e){let t,[a,r,n,i,o]=e,s=""+n+i+o;if(s in this._canvasCache)t=this._canvasCache[s];else{let e=this._options.border;t=document.createElement("canvas");let a=t.getContext("2d");if(t.width=this._spacingX,t.height=this._spacingY,a.fillStyle=o,a.fillRect(e,e,t.width-e,t.height-e),n){a.fillStyle=i,a.font=this._ctx.font,a.textAlign="center",a.textBaseline="middle";let e=[].concat(n);for(let t=0;t<e.length;t++)a.fillText(e[t],this._spacingX/2,Math.ceil(this._spacingY/2))}this._canvasCache[s]=t}this._ctx.drawImage(t,a*this._spacingX,r*this._spacingY)}_drawNoCache(e,t){let[a,r,n,i,o]=e;if(t){let e=this._options.border;this._ctx.fillStyle=o,this._ctx.fillRect(a*this._spacingX+e,r*this._spacingY+e,this._spacingX-e,this._spacingY-e)}if(!n)return;this._ctx.fillStyle=i;let s=[].concat(n);for(let e=0;e<s.length;e++)this._ctx.fillText(s[e],(a+.5)*this._spacingX,Math.ceil((r+.5)*this._spacingY))}computeSize(e,t){return[Math.floor(e/this._spacingX),Math.floor(t/this._spacingY)]}computeFontSize(e,t){let a=Math.floor(e/this._options.width),r=Math.floor(t/this._options.height),n=this._ctx.font;this._ctx.font="100px "+this._options.fontFamily;let i=Math.ceil(this._ctx.measureText("W").width);this._ctx.font=n;let o=i/100*r/a;return o>1&&(r=Math.floor(r/o)),Math.floor(r/this._options.spacing)}_normalizedEventToPosition(e,t){return[Math.floor(e/this._spacingX),Math.floor(t/this._spacingY)]}_updateSize(){const e=this._options,t=Math.ceil(this._ctx.measureText("W").width);this._spacingX=Math.ceil(e.spacing*t),this._spacingY=Math.ceil(e.spacing*e.fontSize),e.forceSquareRatio&&(this._spacingX=this._spacingY=Math.max(this._spacingX,this._spacingY)),this._ctx.canvas.width=e.width*this._spacingX,this._ctx.canvas.height=e.height*this._spacingY}}return e.cache=!1,e})();class W extends N{constructor(){super(),this._colorCanvas=document.createElement("canvas")}draw(e,t){let[a,r,n,i,o]=e,s=this._options.tileWidth,l=this._options.tileHeight;if(t&&(this._options.tileColorize?this._ctx.clearRect(a*s,r*l,s,l):(this._ctx.fillStyle=o,this._ctx.fillRect(a*s,r*l,s,l))),!n)return;let d=[].concat(n),u=[].concat(i),c=[].concat(o);for(let e=0;e<d.length;e++){let t=this._options.tileMap[d[e]];if(!t)throw new Error(`Char "${d[e]}" not found in tileMap`);if(this._options.tileColorize){let n=this._colorCanvas,i=n.getContext("2d");i.globalCompositeOperation="source-over",i.clearRect(0,0,s,l);let o=u[e],d=c[e];i.drawImage(this._options.tileSet,t[0],t[1],s,l,0,0,s,l),"transparent"!=o&&(i.fillStyle=o,i.globalCompositeOperation="source-atop",i.fillRect(0,0,s,l)),"transparent"!=d&&(i.fillStyle=d,i.globalCompositeOperation="destination-over",i.fillRect(0,0,s,l)),this._ctx.drawImage(n,a*s,r*l,s,l)}else this._ctx.drawImage(this._options.tileSet,t[0],t[1],s,l,a*s,r*l,s,l)}}computeSize(e,t){return[Math.floor(e/this._options.tileWidth),Math.floor(t/this._options.tileHeight)]}computeFontSize(){throw new Error("Tile backend does not understand font size")}_normalizedEventToPosition(e,t){return[Math.floor(e/this._options.tileWidth),Math.floor(t/this._options.tileHeight)]}_updateSize(){const e=this._options;this._ctx.canvas.width=e.width*e.tileWidth,this._ctx.canvas.height=e.height*e.tileHeight,this._colorCanvas.width=e.tileWidth,this._colorCanvas.height=e.tileHeight}}function U(e){let t,a;if(e in G)t=G[e];else{if("#"==e.charAt(0)){let a=(e.match(/[0-9a-f]/gi)||[]).map(e=>parseInt(e,16));if(3==a.length)t=a.map(e=>17*e);else{for(let e=0;e<3;e++)a[e+1]+=16*a[e],a.splice(e,1);t=a}}else t=(a=e.match(/rgb\(([0-9, ]+)\)/i))?a[1].split(/\s*,\s*/).map(e=>parseInt(e)):[0,0,0];G[e]=t}return t.slice()}const G={black:[0,0,0],navy:[0,0,128],darkblue:[0,0,139],mediumblue:[0,0,205],blue:[0,0,255],darkgreen:[0,100,0],green:[0,128,0],teal:[0,128,128],darkcyan:[0,139,139],deepskyblue:[0,191,255],darkturquoise:[0,206,209],mediumspringgreen:[0,250,154],lime:[0,255,0],springgreen:[0,255,127],aqua:[0,255,255],cyan:[0,255,255],midnightblue:[25,25,112],dodgerblue:[30,144,255],forestgreen:[34,139,34],seagreen:[46,139,87],darkslategray:[47,79,79],darkslategrey:[47,79,79],limegreen:[50,205,50],mediumseagreen:[60,179,113],turquoise:[64,224,208],royalblue:[65,105,225],steelblue:[70,130,180],darkslateblue:[72,61,139],mediumturquoise:[72,209,204],indigo:[75,0,130],darkolivegreen:[85,107,47],cadetblue:[95,158,160],cornflowerblue:[100,149,237],mediumaquamarine:[102,205,170],dimgray:[105,105,105],dimgrey:[105,105,105],slateblue:[106,90,205],olivedrab:[107,142,35],slategray:[112,128,144],slategrey:[112,128,144],lightslategray:[119,136,153],lightslategrey:[119,136,153],mediumslateblue:[123,104,238],lawngreen:[124,252,0],chartreuse:[127,255,0],aquamarine:[127,255,212],maroon:[128,0,0],purple:[128,0,128],olive:[128,128,0],gray:[128,128,128],grey:[128,128,128],skyblue:[135,206,235],lightskyblue:[135,206,250],blueviolet:[138,43,226],darkred:[139,0,0],darkmagenta:[139,0,139],saddlebrown:[139,69,19],darkseagreen:[143,188,143],lightgreen:[144,238,144],mediumpurple:[147,112,216],darkviolet:[148,0,211],palegreen:[152,251,152],darkorchid:[153,50,204],yellowgreen:[154,205,50],sienna:[160,82,45],brown:[165,42,42],darkgray:[169,169,169],darkgrey:[169,169,169],lightblue:[173,216,230],greenyellow:[173,255,47],paleturquoise:[175,238,238],lightsteelblue:[176,196,222],powderblue:[176,224,230],firebrick:[178,34,34],darkgoldenrod:[184,134,11],mediumorchid:[186,85,211],rosybrown:[188,143,143],darkkhaki:[189,183,107],silver:[192,192,192],mediumvioletred:[199,21,133],indianred:[205,92,92],peru:[205,133,63],chocolate:[210,105,30],tan:[210,180,140],lightgray:[211,211,211],lightgrey:[211,211,211],palevioletred:[216,112,147],thistle:[216,191,216],orchid:[218,112,214],goldenrod:[218,165,32],crimson:[220,20,60],gainsboro:[220,220,220],plum:[221,160,221],burlywood:[222,184,135],lightcyan:[224,255,255],lavender:[230,230,250],darksalmon:[233,150,122],violet:[238,130,238],palegoldenrod:[238,232,170],lightcoral:[240,128,128],khaki:[240,230,140],aliceblue:[240,248,255],honeydew:[240,255,240],azure:[240,255,255],sandybrown:[244,164,96],wheat:[245,222,179],beige:[245,245,220],whitesmoke:[245,245,245],mintcream:[245,255,250],ghostwhite:[248,248,255],salmon:[250,128,114],antiquewhite:[250,235,215],linen:[250,240,230],lightgoldenrodyellow:[250,250,210],oldlace:[253,245,230],red:[255,0,0],fuchsia:[255,0,255],magenta:[255,0,255],deeppink:[255,20,147],orangered:[255,69,0],tomato:[255,99,71],hotpink:[255,105,180],coral:[255,127,80],darkorange:[255,140,0],lightsalmon:[255,160,122],orange:[255,165,0],lightpink:[255,182,193],pink:[255,192,203],gold:[255,215,0],peachpuff:[255,218,185],navajowhite:[255,222,173],moccasin:[255,228,181],bisque:[255,228,196],mistyrose:[255,228,225],blanchedalmond:[255,235,205],papayawhip:[255,239,213],lavenderblush:[255,240,245],seashell:[255,245,238],cornsilk:[255,248,220],lemonchiffon:[255,250,205],floralwhite:[255,250,240],snow:[255,250,250],yellow:[255,255,0],lightyellow:[255,255,224],ivory:[255,255,240],white:[255,255,255]};class Y extends B{constructor(){super(),this._uniforms={};try{this._gl=this._initWebGL()}catch(e){alert(e.message)}}static isSupported(){return!!document.createElement("canvas").getContext("webgl2",{preserveDrawingBuffer:!0})}schedule(e){requestAnimationFrame(e)}getContainer(){return this._gl.canvas}setOptions(e){super.setOptions(e),this._updateSize();let t=this._options.tileSet;t&&"complete"in t&&!t.complete?t.addEventListener("load",()=>this._updateTexture(t)):this._updateTexture(t)}draw(e,t){const a=this._gl,r=this._options;let[n,i,o,s,l]=e,d=a.canvas.height-(i+1)*r.tileHeight;if(a.scissor(n*r.tileWidth,d,r.tileWidth,r.tileHeight),t&&(r.tileColorize?a.clearColor(0,0,0,0):a.clearColor(...V(l)),a.clear(a.COLOR_BUFFER_BIT)),!o)return;let u=[].concat(o),c=[].concat(l),h=[].concat(s);a.uniform2fv(this._uniforms.targetPosRel,[n,i]);for(let e=0;e<u.length;e++){let t=this._options.tileMap[u[e]];if(!t)throw new Error(`Char "${u[e]}" not found in tileMap`);a.uniform1f(this._uniforms.colorize,r.tileColorize?1:0),a.uniform2fv(this._uniforms.tilesetPosAbs,t),r.tileColorize&&(a.uniform4fv(this._uniforms.tint,V(h[e])),a.uniform4fv(this._uniforms.bg,V(c[e]))),a.drawArrays(a.TRIANGLE_STRIP,0,4)}}clear(){const e=this._gl;e.clearColor(...V(this._options.bg)),e.scissor(0,0,e.canvas.width,e.canvas.height),e.clear(e.COLOR_BUFFER_BIT)}computeSize(e,t){return[Math.floor(e/this._options.tileWidth),Math.floor(t/this._options.tileHeight)]}computeFontSize(){throw new Error("Tile backend does not understand font size")}eventToPosition(e,t){let a=this._gl.canvas,r=a.getBoundingClientRect();return e-=r.left,t-=r.top,e*=a.width/r.width,t*=a.height/r.height,e<0||t<0||e>=a.width||t>=a.height?[-1,-1]:this._normalizedEventToPosition(e,t)}_initWebGL(){let e=document.createElement("canvas").getContext("webgl2",{preserveDrawingBuffer:!0});window.gl=e;let t=function(e,t,a){const r=e.createShader(e.VERTEX_SHADER);if(e.shaderSource(r,t),e.compileShader(r),!e.getShaderParameter(r,e.COMPILE_STATUS))throw new Error(e.getShaderInfoLog(r)||"");const n=e.createShader(e.FRAGMENT_SHADER);if(e.shaderSource(n,a),e.compileShader(n),!e.getShaderParameter(n,e.COMPILE_STATUS))throw new Error(e.getShaderInfoLog(n)||"");const i=e.createProgram();if(e.attachShader(i,r),e.attachShader(i,n),e.linkProgram(i),!e.getProgramParameter(i,e.LINK_STATUS))throw new Error(e.getProgramInfoLog(i)||"");return i}(e,z,K);return e.useProgram(t),function(e){const t=new Float32Array([0,0,1,0,0,1,1,1]),a=e.createBuffer();e.bindBuffer(e.ARRAY_BUFFER,a),e.bufferData(e.ARRAY_BUFFER,t,e.STATIC_DRAW),e.enableVertexAttribArray(0),e.vertexAttribPointer(0,2,e.FLOAT,!1,0,0)}(e),H.forEach(a=>this._uniforms[a]=e.getUniformLocation(t,a)),this._program=t,e.enable(e.BLEND),e.blendFuncSeparate(e.SRC_ALPHA,e.ONE_MINUS_SRC_ALPHA,e.ONE,e.ONE_MINUS_SRC_ALPHA),e.enable(e.SCISSOR_TEST),e}_normalizedEventToPosition(e,t){return[Math.floor(e/this._options.tileWidth),Math.floor(t/this._options.tileHeight)]}_updateSize(){const e=this._gl,t=this._options,a=[t.width*t.tileWidth,t.height*t.tileHeight];e.canvas.width=a[0],e.canvas.height=a[1],e.viewport(0,0,a[0],a[1]),e.uniform2fv(this._uniforms.tileSize,[t.tileWidth,t.tileHeight]),e.uniform2fv(this._uniforms.targetSize,a)}_updateTexture(e){!function(e,t){let a=e.createTexture();e.bindTexture(e.TEXTURE_2D,a),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MAG_FILTER,e.NEAREST),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,e.NEAREST),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_S,e.REPEAT),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_T,e.REPEAT),e.pixelStorei(e.UNPACK_FLIP_Y_WEBGL,0),e.texImage2D(e.TEXTURE_2D,0,e.RGBA,e.RGBA,e.UNSIGNED_BYTE,t)}(this._gl,e)}}const H=["targetPosRel","tilesetPosAbs","tileSize","targetSize","colorize","bg","tint"],z="\n#version 300 es\n\nin vec2 tilePosRel;\nout vec2 tilesetPosPx;\n\nuniform vec2 tilesetPosAbs;\nuniform vec2 tileSize;\nuniform vec2 targetSize;\nuniform vec2 targetPosRel;\n\nvoid main() {\n\tvec2 targetPosPx = (targetPosRel + tilePosRel) * tileSize;\n\tvec2 targetPosNdc = ((targetPosPx / targetSize)-0.5)*2.0;\n\ttargetPosNdc.y *= -1.0;\n\n\tgl_Position = vec4(targetPosNdc, 0.0, 1.0);\n\ttilesetPosPx = tilesetPosAbs + tilePosRel * tileSize;\n}".trim(),K="\n#version 300 es\nprecision highp float;\n\nin vec2 tilesetPosPx;\nout vec4 fragColor;\nuniform sampler2D image;\nuniform bool colorize;\nuniform vec4 bg;\nuniform vec4 tint;\n\nvoid main() {\n\tfragColor = vec4(0, 0, 0, 1);\n\n\tvec4 texel = texelFetch(image, ivec2(tilesetPosPx), 0);\n\n\tif (colorize) {\n\t\ttexel.rgb = tint.a * tint.rgb + (1.0-tint.a) * texel.rgb;\n\t\tfragColor.rgb = texel.a*texel.rgb + (1.0-texel.a)*bg.rgb;\n\t\tfragColor.a = texel.a + (1.0-texel.a)*bg.a;\n\t} else {\n\t\tfragColor = texel;\n\t}\n}".trim();let X={};function V(e){if(!(e in X)){let t;if("transparent"==e)t=[0,0,0,0];else if(e.indexOf("rgba")>-1){t=(e.match(/[\d.]+/g)||[]).map(Number);for(let e=0;e<3;e++)t[e]=t[e]/255}else t=U(e).map(e=>e/255),t.push(1);X[e]=t}return X[e]}var q,Z,Q={},J=Q={};function ee(){throw new Error("setTimeout has not been defined")}function te(){throw new Error("clearTimeout has not been defined")}function ae(e){if(q===setTimeout)return setTimeout(e,0);if((q===ee||!q)&&setTimeout)return q=setTimeout,setTimeout(e,0);try{return q(e,0)}catch(t){try{return q.call(null,e,0)}catch(t){return q.call(this,e,0)}}}!function(){try{q="function"==typeof setTimeout?setTimeout:ee}catch(e){q=ee}try{Z="function"==typeof clearTimeout?clearTimeout:te}catch(e){Z=te}}();var re,ne=[],ie=!1,oe=-1;function se(){ie&&re&&(ie=!1,re.length?ne=re.concat(ne):oe=-1,ne.length&&le())}function le(){if(!ie){var e=ae(se);ie=!0;for(var t=ne.length;t;){for(re=ne,ne=[];++oe<t;)re&&re[oe].run();oe=-1,t=ne.length}re=null,ie=!1,function(e){if(Z===clearTimeout)return clearTimeout(e);if((Z===te||!Z)&&clearTimeout)return Z=clearTimeout,clearTimeout(e);try{Z(e)}catch(t){try{return Z.call(null,e)}catch(t){return Z.call(this,e)}}}(e)}}function de(e,t){this.fun=e,this.array=t}function ue(){}function ce(e){let t=U(e);return 36*Math.floor(t[0]*(6/256))+6*Math.floor(t[1]*(6/256))+1*Math.floor(t[2]*(6/256))+16}J.nextTick=function(e){var t=new Array(arguments.length-1);if(arguments.length>1)for(var a=1;a<arguments.length;a++)t[a-1]=arguments[a];ne.push(new de(e,t)),1!==ne.length||ie||ae(le)},de.prototype.run=function(){this.fun.apply(null,this.array)},J.title="browser",J.browser=!0,J.env={},J.argv=[],J.version="",J.versions={},J.on=ue,J.addListener=ue,J.once=ue,J.off=ue,J.removeListener=ue,J.removeAllListeners=ue,J.emit=ue,J.prependListener=ue,J.prependOnceListener=ue,J.listeners=function(e){return[]},J.binding=function(e){throw new Error("process.binding is not supported")},J.cwd=function(){return"/"},J.chdir=function(e){throw new Error("process.chdir is not supported")},J.umask=function(){return 0};class he extends B{constructor(){super(),this._offset=[0,0],this._cursor=[-1,-1],this._lastColor=""}schedule(e){setTimeout(e,1e3/60)}setOptions(e){super.setOptions(e);let t=[e.width,e.height],a=this.computeSize();this._offset=a.map((e,a)=>Math.floor((e-t[a])/2))}clear(){Q.stdout.write(`[0;48;5;${ce(this._options.bg)}m[2J`)}draw(e,t){let[a,r,n,i,o]=e,s=this._offset[0]+a,l=this._offset[1]+r,d=this.computeSize();if(s<0||s>=d[0])return;if(l<0||l>=d[1])return;if(s===this._cursor[0]&&l===this._cursor[1]||(Q.stdout.write(function(e,t){return`[${t+1};${e+1}H`}(s,l)),this._cursor[0]=s,this._cursor[1]=l),t&&(n||(n=" ")),!n)return;let u=function(e,t){return`[0;38;5;${ce(e)};48;5;${ce(t)}m`}(i,o);if(u!==this._lastColor&&(Q.stdout.write(u),this._lastColor=u),"\t"!=n){let e=[].concat(n);Q.stdout.write(e[0])}this._cursor[0]++,this._cursor[0]>=d[0]&&(this._cursor[0]=0,this._cursor[1]++)}computeFontSize(){throw new Error("Terminal backend has no notion of font size")}eventToPosition(e,t){return[e,t]}computeSize(){return[Q.stdout.columns,Q.stdout.rows]}}const fe=/%([bc]){([^}]*)}/g;function ge(e,t){let a={width:0,height:1},r=pe(e,t),n=0;for(let e=0;e<r.length;e++){let t=r[e];switch(t.type){case 0:n+=t.value.length;break;case 1:a.height++,a.width=Math.max(a.width,n),n=0}}return a.width=Math.max(a.width,n),a}function pe(e,t){let a=[],r=0;e.replace(fe,(function(t,n,i,o){let s=e.substring(r,o);return s.length&&a.push({type:0,value:s}),a.push({type:"c"==n?2:3,value:i.trim()}),r=o+t.length,""}));let n=e.substring(r);return n.length&&a.push({type:0,value:n}),function(e,t){t||(t=1/0);let a=0,r=0,n=-1;for(;a<e.length;){let i=e[a];if(1==i.type&&(r=0,n=-1),0!=i.type){a++;continue}for(;0==r&&" "==i.value.charAt(0);)i.value=i.value.substring(1);let o=i.value.indexOf("\n");if(-1!=o){i.value=me(e,a,o,!0);let t=i.value.split("");for(;t.length&&" "==t[t.length-1];)t.pop();i.value=t.join("")}if(i.value.length){if(r+i.value.length>t){let o=-1;for(;;){let e=i.value.indexOf(" ",o+1);if(-1==e)break;if(r+e>t)break;o=e}if(-1!=o)i.value=me(e,a,o,!0);else if(-1!=n){let t=e[n],r=t.value.lastIndexOf(" ");t.value=me(e,n,r,!0),a=n}else i.value=me(e,a,t-r,!1)}else r+=i.value.length,-1!=i.value.indexOf(" ")&&(n=a);a++}else e.splice(a,1)}e.push({type:1});let i=null;for(let t=0;t<e.length;t++){let a=e[t];switch(a.type){case 0:i=a;break;case 1:if(i){let e=i.value.split("");for(;e.length&&" "==e[e.length-1];)e.pop();i.value=e.join("")}i=null}}return e.pop(),e}(a,t)}function me(e,t,a,r){let n={type:1},i={type:0,value:e[t].value.substring(a+(r?1:0))};return e.splice(t+1,0,n,i),e[t].value.substring(0,a)}const ye={hex:$,rect:F,tile:W,"tile-gl":Y,term:he},ve={width:80,height:25,transpose:!1,layout:"rect",fontSize:15,spacing:1,border:0,forceSquareRatio:!1,fontFamily:"monospace",fontStyle:"",fg:"#ccc",bg:"#000",tileWidth:32,tileHeight:32,tileMap:{},tileSet:null,tileColorize:!1};let we=(()=>{class e{constructor(e={}){this._data={},this._dirty=!1,this._options={},e=Object.assign({},ve,e),this.setOptions(e),this.DEBUG=this.DEBUG.bind(this),this._tick=this._tick.bind(this),this._backend.schedule(this._tick)}DEBUG(e,t,a){let r=[this._options.bg,this._options.fg];this.draw(e,t,null,null,r[a%r.length])}clear(){this._data={},this._dirty=!0}setOptions(e){if(Object.assign(this._options,e),e.width||e.height||e.fontSize||e.fontFamily||e.spacing||e.layout){if(e.layout){let t=ye[e.layout];this._backend=new t}this._backend.setOptions(this._options),this._dirty=!0}return this}getOptions(){return this._options}getContainer(){return this._backend.getContainer()}computeSize(e,t){return this._backend.computeSize(e,t)}computeFontSize(e,t){return this._backend.computeFontSize(e,t)}computeTileSize(e,t){return[Math.floor(e/this._options.width),Math.floor(t/this._options.height)]}eventToPosition(e){let t,a;return"touches"in e?(t=e.touches[0].clientX,a=e.touches[0].clientY):(t=e.clientX,a=e.clientY),this._backend.eventToPosition(t,a)}draw(e,t,a,r,n){r||(r=this._options.fg),n||(n=this._options.bg);let i=`${e},${t}`;this._data[i]=[e,t,a,r,n],!0!==this._dirty&&(this._dirty||(this._dirty={}),this._dirty[i]=!0)}drawText(e,t,a,r){let n=null,i=null,o=e,s=t,l=1;r||(r=this._options.width-e);let d=pe(a,r);for(;d.length;){let t=d.shift();switch(t.type){case 0:let a=!1,r=!1,d=!1,u=!1;for(let e=0;e<t.value.length;e++){let l=t.value.charCodeAt(e),c=t.value.charAt(e);if("term"===this._options.layout){let e=l>>8;if(17===e||e>=46&&e<=159||e>=172&&e<=215||l>=43360&&l<=43391){this.draw(o+0,s,c,n,i),this.draw(o+1,s,"\t",n,i),o+=2;continue}}d=l>65280&&l<65377||l>65500&&l<65512||l>65518,a=32==c.charCodeAt(0)||12288==c.charCodeAt(0),!u||d||a||o++,d&&!r&&o++,this.draw(o++,s,c,n,i),r=a,u=d}break;case 2:n=t.value||null;break;case 3:i=t.value||null;break;case 1:o=e,s++,l++}}return l}_tick(){if(this._backend.schedule(this._tick),this._dirty){if(!0===this._dirty){this._backend.clear();for(let e in this._data)this._draw(e,!1)}else for(let e in this._dirty)this._draw(e,!0);this._dirty=!1}}_draw(e,t){let a=this._data[e];a[4]!=this._options.bg&&(t=!0),this._backend.draw(a,t)}}return e.Rect=F,e.Hex=$,e.Tile=W,e.TileGL=Y,e.Term=he,e})();Math.sqrt(3),Math.sqrt(3);C=class extends we{constructor(e){super(e)}drawOver(e,t,a,r,n){const i=`${e},${t}`,o=this._data[i];o?(o[2]=a||o[2],o[3]=r||o[3],o[4]=n||o[4]):this.draw(e,t,a,r,n)}drawAppend(e,t,a,r,n){const i=`${e},${t}`,o=this._data[i];o?(o[2]=Array.isArray(o[2])?[...o[2],a]:[o[2],a],o[3]=Array.isArray(o[3])?[...o[3],r]:[o[3],r],o[4]=Array.isArray(o[4])?[...o[4],n]:[o[4],n]):this.draw(e,t,a,r,n)}drawOverFirst(e,t,a,r,n){const i=`${e},${t}`,o=this._data[i];o?Array.isArray(o[2])&&Array.isArray(o[3])&&Array.isArray(o[4])?(o[2][0]=a||o[2][0],o[3][0]=r||o[3][0],o[4][0]=r||o[4][0]):this.drawOver(e,t,a,r,n):this.draw(e,t,a||" ",r,n)}drawOverLast(e,t,a,r,n){const i=`${e},${t}`,o=this._data[i];if(o)if(Array.isArray(o[2])&&Array.isArray(o[3])&&Array.isArray(o[4])){const e=o[2].length-1;o[2][e]=a||o[2][e],o[3][e]=r||o[3][e],o[4][e]=n||o[4][e]}else this.drawOver(e,t,a,r,n);else this.draw(e,t,a||" ",r,n)}},R.RDisplay=C;var be={};Object.defineProperty(be,"__esModule",{value:!0});var _e=function(e){Me.destroy(),Me=e,Me.create()};be.setScene=_e;var xe=function(){return Me};be.getScene=xe;var Te=void 0;be.Scene=Te;class Ee{update(e,t){}render(e){this.ui(e)}destroy(){}create(){}}Te=Ee,be.Scene=Te;let Me=new class extends Ee{ui=(0,o.createElement)(M.Container,{x:0,y:0,w:0,h:0})};var Ae={};Object.defineProperty(Ae,"__esModule",{value:!0});var De=(Be=void 0,Ae.TILE_TYPES=Be);Ae.getTileOptions=De;var ke=null;var Pe,Se=function(){return ke||(ke=function(){try{throw new Error}catch(t){var e=(""+t.stack).match(/(https?|file|ftp):\/\/[^)\n]+/g);if(e)return(""+e[0]).replace(/^((?:https?|file|ftp):\/\/.+)\/[^/]+$/,"$1")+"/"}return"/"}()),ke},je=t;function Oe(e){if(""===e)return".";var t="/"===e[e.length-1]?e.slice(0,e.length-1):e,a=t.lastIndexOf("/");return-1===a?".":t.slice(0,a)}function Re(e,t){if(e===t)return"";var a=e.split("/");"."===a[0]&&a.shift();var r,n,i=t.split("/");for("."===i[0]&&i.shift(),r=0;(r<i.length||r<a.length)&&null==n;r++)a[r]!==i[r]&&(n=r);var o=[];for(r=0;r<a.length-n;r++)o.push("..");return i.length>n&&o.push.apply(o,i.slice(n)),o.join("/")}(Pe=function(e,t){return Re(Oe(je(e)),je(t))})._dirname=Oe,Pe._relative=Re;var Ce=Le(Se()+Pe("42dd58089660cbcd","b814f469032f748d")),Ie=Le(h);function Le(e){return e&&e.__esModule?e:{default:e}}var Be={EMPTY:String.fromCharCode(176),UL_:String.fromCharCode(176),U_:String.fromCharCode(178),L_:String.fromCharCode(177),_L:String.fromCharCode(179),_U:String.fromCharCode(180),_R:String.fromCharCode(181),_D:String.fromCharCode(182)};Ae.TILE_TYPES=Be;const Ne=document.createElement("img");Ne.src=Ce.default;const $e=new Promise(e=>Ne.onload=e),Fe={};for(let e=32;e<=126;e++)Fe[String.fromCharCode(e)]=[e%16*16,16*Math.floor(e/16)];Fe[" "]=[0,0];for(let e=176;e<=193;e++)Fe[String.fromCharCode(e)]=[e%16*16,16*Math.floor(e/16)];De=async()=>(await $e,{layout:"tile-gl",tileColorize:!0,fg:Ie.default.B_GREY_4,bg:Ie.default.BLACK,tileWidth:16,tileHeight:16,tileMap:Fe,tileSet:Ne}),Ae.getTileOptions=De;var We={};Object.defineProperty(We,"__esModule",{value:!0});var Ue=void 0;We.Main=Ue;var Ge={};Object.defineProperty(Ge,"__esModule",{value:!0});var Ye=void 0;Ge.HomeComponent=Ye;var He=function(e){return e&&e.__esModule?e:{default:e}}(h),ze={};Object.defineProperty(ze,"__esModule",{value:!0});var Ke=void 0;ze.GameScene=Ke;var Xe={};Object.defineProperty(Xe,"__esModule",{value:!0});var Ve=(ot=void 0,Xe.LogContents=ot);Xe.LogList=Ve;var qe={};Object.defineProperty(qe,"__esModule",{value:!0});var Ze=void 0;qe.CharButton=Ze;Ze=(e,t)=>{const[a,r]=e.useState({hover:!1});e.display.draw(e.bounds.x,e.bounds.y,t.title,t.disabled?"#555555":a.hover?"#FFFFFF":"#AAAAAA",null),t.disabled||(e.handlers.hover=()=>{r({hover:!0})},e.handlers.out=()=>{r({hover:!1})},e.handlers.press=()=>{t.onClick()}),(0,_.handleKeyOnClick)(e,t)},qe.CharButton=Ze;var Qe={};Object.defineProperty(Qe,"__esModule",{value:!0});var Je=function(){nt=[]};Qe.clearLog=Je;var et=function(e){200===nt.length&&nt.unshift();nt.push(e)};Qe.log=et;var tt=function(){return nt};Qe.getLog=tt;var at=function(){return nt.length};Qe.getLogSize=at;var rt=function(e,t){return ge(e,t).height};Qe.lineCount=rt;let nt=[];const it=(e,t)=>{const a=(0,Qe.getLog)();let r=a.length-1+t.offset;const n=e.bounds.y;let i=e.bounds.y+e.bounds.h;for(;i>n&&r>=0;){i-=(0,Qe.lineCount)(a[r],e.bounds.w),i>=n&&(e.display.drawText(e.bounds.x,i,a[r],e.bounds.w),r-=1)}};var ot=it;Xe.LogContents=ot;Ve=e=>{const[t,a]=e.useState({offset:0}),r=(0,Qe.getLogSize)(),n=-1*t.offset<r&&e.bounds.h-1<r+t.offset,i=t.offset<0,s=()=>{n&&a({offset:t.offset-1})},l=()=>{i&&a({offset:t.offset+1})};return e.handlers.keypress=e=>"+"===e||"="===e?(l(),!0):("-"===e||"_"===e)&&(s(),!0),[(0,o.createElement)(it,{x:0,y:0,w:e.bounds.w-2,h:e.bounds.h},{offset:t.offset}),(0,o.createElement)(qe.CharButton,{x:e.bounds.w-1,y:0,w:1,h:1},{disabled:!n,title:"-",onClick:s}),(0,o.createElement)(qe.CharButton,{x:e.bounds.w-1,y:e.bounds.h-1,w:1,h:1},{disabled:!i,title:"+",onClick:l})]},Xe.LogList=Ve;var st={};Object.defineProperty(st,"__esModule",{value:!0});var lt=(ct=void 0,ht=st.openModal=ct,st.closeModal=ht);st.Modal=lt;let dt=0,ut=[];var ct=e=>{const t=dt;return dt+=1,ut.push({id:t,content:e}),t};st.openModal=ct;var ht=e=>{null!=e?ut=ut.filter(t=>t.id!==e):ut.pop()};st.closeModal=ht;const ft=(e,{content:t})=>((0,m.borderFill)(e.display,e.bounds),[(0,o.createElement)(M.Container,{x:1,y:1,w:e.bounds.w-2,h:e.bounds.h-2},{children:[t]})]);lt=e=>ut.map(({content:t})=>{const a=t.bounds.w,r=t.bounds.h,n={x:e.bounds.x+Math.floor((e.bounds.w-(t.bounds.w+2))/2),y:e.bounds.y+Math.floor((e.bounds.h-(t.bounds.h+2))/2),w:a+2,h:r+2};return(0,o.createElement)(ft,n,{content:t})}),st.Modal=lt;var gt={};Object.defineProperty(gt,"__esModule",{value:!0});var pt=void 0;gt.PanelGroup=pt;const mt=(e,t)=>t.children;pt=(e,t)=>{(0,m.borderFill)(e.display,e.bounds);let a=0;return t.children.map(({title:t,value:r})=>{(0,m.lineDraw)(e.display,{x:1,y:a,w:e.bounds.w-2,h:1},t);const n=(0,o.createElement)(mt,{x:1,y:a+1,w:e.bounds.w-2,h:r.bounds.h},{children:[r]});return a=a+r.bounds.h+1,n})},gt.PanelGroup=pt;var yt={};Object.defineProperty(yt,"__esModule",{value:!0});var vt=(bd=void 0,_d=yt.gameData=bd,xd=yt.initializeState=_d,Td=yt.handleInput=xd,Md=yt.runPlayerAction=Td,Dd=yt.advanceTurn=Md,kd=yt.runActionQueue=Dd,Pd=yt.drawWorld=kd,yt.findActorForPosition=Pd);yt.getItemsForPosition=vt;var wt={};Object.defineProperty(wt,"__esModule",{value:!0}),Object.defineProperty(wt,"ifDev",{enumerable:!0,get:function(){return xt.default}}),Object.defineProperty(wt,"throwOrLog",{enumerable:!0,get:function(){return Tt.throwOrLog}}),Object.defineProperty(wt,"logInDev",{enumerable:!0,get:function(){return Mt.logInDev}}),Object.defineProperty(wt,"infoInDev",{enumerable:!0,get:function(){return Mt.infoInDev}}),Object.defineProperty(wt,"warnInDev",{enumerable:!0,get:function(){return Mt.warnInDev}});var bt={};Object.defineProperty(bt,"__esModule",{value:!0});var _t=function(e){return(...e)=>{0}};bt.default=_t;var xt=function(e){return e&&e.__esModule?e:{default:e}}(bt),Tt={};Object.defineProperty(Tt,"__esModule",{value:!0});var Et=void 0;Tt.throwOrLog=Et;Et=e=>console.error(e),Tt.throwOrLog=Et;var Mt={};Object.defineProperty(Mt,"__esModule",{value:!0});var At=(Dt=void 0,kt=Mt.logInDev=Dt,Mt.infoInDev=kt);Mt.warnInDev=At;var Dt=e=>!1;Mt.logInDev=Dt;var kt=e=>!1;Mt.infoInDev=kt;At=e=>!1,Mt.warnInDev=At;var Pt={};Object.defineProperty(Pt,"__esModule",{value:!0});var St=void 0;Pt.default=St;var jt={};Object.defineProperty(jt,"__esModule",{value:!0});var Ot=Ut;jt.getEntryFromConfig=Ot;var Rt=(Gt=void 0,jt.getInputNameForKey=Gt);jt.getActionNameFromInput=Rt;var Ct={};Object.defineProperty(Ct,"__esModule",{value:!0});var It=void 0;Ct.default=It;It={base:{look:["look",null]},move:{up:["move",{x:0,y:-1}],left:["move",{x:-1,y:0}],right:["move",{x:1,y:0}],down:["move",{x:0,y:1}],mouseTile:["mouseTileMove",null],sUp:["sprint",{x:0,y:-1}],sLeft:["sprint",{x:-1,y:0}],sRight:["sprint",{x:1,y:0}],sDown:["sprint",{x:0,y:1}]},focusMove:{up:["focusMove",{x:0,y:-1}],left:["focusMove",{x:-1,y:0}],right:["focusMove",{x:1,y:0}],down:["focusMove",{x:0,y:1}],mouseTile:["mouseTileMove",null]},playerActions:{cheat:["cheat",null],wait:["wait",null]}},Ct.default=It;var Lt=Wt(Ct),Bt={};Object.defineProperty(Bt,"__esModule",{value:!0});var Nt=void 0;Bt.default=Nt;const $t=(e,t)=>{const a={};return e.forEach(e=>{e.forEach((e,r)=>{a[e]=t[r]})}),a};Nt={cancel:{Escape:"cancel",Backspace:"cancel"},advance:{" ":"advance",Enter:"advance"},graphMovement:{...$t([["w","a","s","d"],["k","h","l","j"],["ArrowUp","ArrowLeft","ArrowDown","ArrowRight"]],["up","left","down","right"]),...$t([["W","A","S","D"],["K","H","L","J"],["SArrowUp","SArrowLeft","SArrowDown","SArrowRight"]],["sUp","sLeft","sDown","sRight"])},baseActions:{v:"look"},playerActions:{"\\":"cheat",".":"wait"},DEBUG_MENUS:{p:"DEBUG_MAP"}},Bt.default=Nt;var Ft=Wt(Bt);function Wt(e){return e&&e.__esModule?e:{default:e}}function Ut(e,t,a=""){let r;if(!Array.isArray(t))return r=e[t],r[a]||r.any;{let n;const i=t.length;for(let o=0;o<i;o++)if(r=e[t[o]],r){if(n=r[a]||r.any,n)return n}else(0,wt.warnInDev)(`Invalid binding: ${t[o]} provided`)}}var Gt=(e,t)=>Ut(Ft.default,e,t);jt.getInputNameForKey=Gt;Rt=(e,t)=>Ut(Lt.default,e,t),jt.getActionNameFromInput=Rt;St=new class{constructor(){this.keyHandlers=[],this.inputHandlers=[]}addMouseHandler(e){this.mouseHandler=e}pushKeyHandler(e){(0,wt.logInDev)("Adding Key Handlers "+(Array.isArray(e)?e.join(","):e)),this.keyHandlers.push(e)}popKeyHandler(){this.keyHandlers.pop()}pushInputHandler(e){(0,wt.logInDev)("Adding Input Handlers "+(Array.isArray(e)?e.join(","):e)),this.inputHandlers.push(e)}popInputHandler(){this.inputHandlers.pop()}keyToAction(e){if(this.inputHandlers.length&&this.keyHandlers.length)return(0,jt.getActionNameFromInput)(this.inputHandlers[this.inputHandlers.length-1],(0,jt.getInputNameForKey)(this.keyHandlers[this.keyHandlers.length-1],e))}inputToActionName(e){return(0,jt.getActionNameFromInput)(this.inputHandlers[this.inputHandlers.length-1],e)}triggerMouseAction(e,t){this.mouseHandler&&this.mouseHandler(e,t)}},Pt.default=St;var Yt=vd(Pt),Ht={};Object.defineProperty(Ht,"__esModule",{value:!0});var zt=void 0;Ht.Commands=zt;var Kt=function(e){return e&&e.__esModule?e:{default:e}}(Pt),Xt={};Object.defineProperty(Xt,"__esModule",{value:!0});var Vt=function(e){switch(e){case na.Up:return na.Down;case na.Left:return na.Right;case na.Down:return na.Up;case na.Right:return na.Left;case na.UpLeft:return na.DownRight;case na.UpRight:return na.DownLeft;case na.DownRight:return na.UpLeft}(()=>{throw new Error("Unrecognized direction")})()};Xt.getOppositeDirection=Vt;var qt=function(e,t){switch(t){case na.Up:return{x:e.x,y:e.y-1};case na.Left:return{x:e.x-1,y:e.y};case na.Down:return{x:e.x,y:e.y+1};case na.Right:return{x:e.x+1,y:e.y};case na.UpLeft:return{x:e.x-1,y:e.y-1};case na.UpRight:return{x:e.x+1,y:e.y-1};case na.DownLeft:return{x:e.x-1,y:e.y+1};case na.DownRight:return{x:e.x+1,y:e.y+1}}(()=>{throw new Error("Unrecognized direction")})()};Xt.getInDirection=qt;var Zt=function(e,t){if(e.x>t.x)return na.Left;if(e.x<t.x)return na.Right;if(e.y>t.y)return na.Up;if(e.y<t.y)return na.Down;throw new Error("Unrecognized direction")};Xt.getDirectionTowards=Zt;var Qt=function(e){if(e.x<0)return 0===e.y?na.Left:e.y<0?na.UpLeft:na.DownLeft;if(e.x>0)return 0===e.y?na.Right:e.y<0?na.UpRight:na.DownRight;if(e.y<0)return na.Up;if(e.y>0)return na.Down};Xt.getDirectionFromVector=Qt;var Jt=function(e){return[{x:e.x,y:e.y-1},{x:e.x-1,y:e.y},{x:e.x,y:e.y+1},{x:e.x+1,y:e.y}]};Xt.getAllDirections=Jt;var ea=function(e){return[{x:e.x,y:e.y-1},{x:e.x-1,y:e.y-1},{x:e.x-1,y:e.y},{x:e.x-1,y:e.y+1},{x:e.x,y:e.y+1},{x:e.x+1,y:e.y+1},{x:e.x+1,y:e.y},{x:e.x+1,y:e.y-1}]};Xt.getAllWithDiagonal=ea;var ta=function*(e){yield{x:e.x,y:e.y-1},yield{x:e.x-1,y:e.y},yield{x:e.x,y:e.y+1},yield{x:e.x+1,y:e.y}};Xt.genAllDirections=ta;var aa=function*(e){yield{x:e.x,y:e.y-1},yield{x:e.x-1,y:e.y-1},yield{x:e.x-1,y:e.y},yield{x:e.x-1,y:e.y+1},yield{x:e.x,y:e.y+1},yield{x:e.x+1,y:e.y+1},yield{x:e.x+1,y:e.y},yield{x:e.x+1,y:e.y-1}};Xt.genAllWithDiagonal=aa;var ra=(oa=void 0,sa=Xt.Directions=oa,Xt.allDirections=sa);let na;Xt.allDirectionWithDiagonals=ra;var ia,oa=na;Xt.Directions=oa,(ia=na||(oa=na={},Xt.Directions=oa))[ia.UpLeft=0]="UpLeft",ia[ia.Up=1]="Up",ia[ia.UpRight=2]="UpRight",ia[ia.DownLeft=3]="DownLeft",ia[ia.Down=4]="Down",ia[ia.DownRight=5]="DownRight",ia[ia.Left=6]="Left",ia[ia.Right=7]="Right";var sa=[na.Up,na.Down,na.Left,na.Right];Xt.allDirections=sa;ra=[na.UpLeft,na.Up,na.UpRight,na.Left,na.Right,na.DownLeft,na.Down,na.DownRight],Xt.allDirectionWithDiagonals=ra;var la={};Object.defineProperty(la,"__esModule",{value:!0});var da=function(e,t,a,r=ha.MEDIUM){return{perform:e,options:a,actor:t,speed:r}};la.createAction=da;var ua=function(e){if(e.actor.alive&&!e.actor.status.staggered)return e.perform(e.actor,e.options)};la.runAction=ua;var ca=void 0;let ha;var fa;la.ActionSpeed=ca,ca=ha,la.ActionSpeed=ca,(fa=ha||(ca=ha={},la.ActionSpeed=ca))[fa.SLOW=0]="SLOW",fa[fa.MEDIUM=1]="MEDIUM",fa[fa.FAST=2]="FAST";var ga={};Object.defineProperty(ga,"__esModule",{value:!0});var pa=(wi=void 0,_i=ga.attackTo=wi,ga.attackTowards=_i);ga.blockAttacks=pa;var ma={};Object.defineProperty(ma,"__esModule",{value:!0});var ya=(Ia=void 0,Ba=ma.adjInCheck=Ia,ma.adjOutCheck=Ba);ma.CheckMovement=ya;var va={};Object.defineProperty(va,"__esModule",{value:!0});var wa=(Pa=void 0,Oa=va.FloorTypes=Pa,va.AdjTypes=Oa);va.drawTile=wa;var ba={};Object.defineProperty(ba,"__esModule",{value:!0});var _a=(Ea=void 0,Ma=ba.TileVisibility=Ea,ba.WorldTile=Ma);let xa;ba.LevelMap=_a;var Ta,Ea=xa;ba.TileVisibility=Ea,(Ta=xa||(Ea=xa={},ba.TileVisibility=Ea))[Ta.VISIBLE=0]="VISIBLE",Ta[Ta.SEEN=1]="SEEN",Ta[Ta.HIDDEN=2]="HIDDEN";var Ma=class{seen=!1;z=1;constructor(e,t){this.type=e,this.adj=t}};ba.WorldTile=Ma;_a=class{constructor(e,t,a){this.drawTile=e,this.width=t,this.height=a,this.tiles=[]}draw(e,t,a,r){for(let n=a.y;n<a.h+a.y;n++)for(let i=a.x;i<a.w+a.x;i++){const o=this.tiles[n*this.width+i];o&&this.drawTile(e,i+t.x-a.x,n+t.y-a.y,o,r.has(i+n*this.width)?xa.VISIBLE:o.seen?xa.SEEN:xa.HIDDEN)}}fillAll(e){this.tiles=[];const t=this.height*this.width;for(let a=0;a<t;a++)this.tiles.push(e())}},ba.LevelMap=_a;var Aa=function(e){return e&&e.__esModule?e:{default:e}}(h);let Da;var ka,Pa=Da;let Sa;va.FloorTypes=Pa,(ka=Da||(Pa=Da={},va.FloorTypes=Pa))[ka.EMPTY=0]="EMPTY",ka[ka.CHASM=1]="CHASM",ka[ka.OOB=2]="OOB";var ja,Oa=Sa;va.AdjTypes=Oa,(ja=Sa||(Oa=Sa={},va.AdjTypes=Oa))[ja.OPEN=0]="OPEN",ja[ja.WALL=1]="WALL",ja[ja.ONE_OUT=2]="ONE_OUT",ja[ja.ONE_IN=3]="ONE_IN",ja[ja.Z_OUT=4]="Z_OUT",ja[ja.Z_IN=5]="Z_IN";const Ra={wall:Aa.default.B_GREY_5,floor:Aa.default.BROWN_1,bgs:[Aa.default.BROWN_1,Aa.default.BROWN_2,Aa.default.BROWN_3,Aa.default.RED_2]},Ca={wall:Aa.default.B_GREY_5,floor:Aa.default.GREY_1,bgs:[Aa.default.GREY_1,Aa.default.GREY_2,Aa.default.GREY_3,Aa.default.RED_2]};wa=(e,t,a,r,n)=>{const i=n===ba.TileVisibility.VISIBLE||yt.gameData.seeAll?Ra:Ca;switch(r.type){case Da.EMPTY:e.draw(t,a,Ae.TILE_TYPES.EMPTY,i.floor,i.bgs[r.z]);break;case Da.OOB:e.draw(t,a," ",Aa.default.BLACK,Aa.default.BLACK)}let o=null;r.adj.up===Sa.WALL&&r.adj.left===Sa.WALL?o=Ae.TILE_TYPES.UL_:r.adj.up===Sa.WALL?o=Ae.TILE_TYPES.U_:r.adj.left===Sa.WALL&&(o=Ae.TILE_TYPES.L_),o&&e.drawAppend(t,a,o,i.wall,"transparent"),r.adj.left===Sa.Z_IN&&e.drawAppend(t,a,Ae.TILE_TYPES._L,i.bgs[r.z+1],"transparent"),r.adj.up===Sa.Z_IN&&e.drawAppend(t,a,Ae.TILE_TYPES._U,i.bgs[r.z+1],"transparent"),r.adj.right===Sa.Z_IN&&e.drawAppend(t,a,Ae.TILE_TYPES._R,i.bgs[r.z+1],"transparent"),r.adj.down===Sa.Z_IN&&e.drawAppend(t,a,Ae.TILE_TYPES._D,i.bgs[r.z+1],"transparent")},va.drawTile=wa;var Ia=e=>e!==va.AdjTypes.WALL&&e!==va.AdjTypes.ONE_OUT;ma.adjInCheck=Ia;const La=e=>e!==va.AdjTypes.WALL&&e!==va.AdjTypes.ONE_IN;var Ba=La;ma.adjOutCheck=Ba;ya={[Xt.Directions.Left]:e=>La(e.adj.left),[Xt.Directions.Up]:e=>La(e.adj.up),[Xt.Directions.Right]:e=>La(e.adj.right),[Xt.Directions.Down]:e=>La(e.adj.down),[Xt.Directions.UpLeft]:e=>La(e.adj.up)&&La(e.adj.left),[Xt.Directions.UpRight]:e=>La(e.adj.up)&&La(e.adj.right),[Xt.Directions.DownRight]:e=>La(e.adj.down)&&La(e.adj.right),[Xt.Directions.DownLeft]:e=>La(e.adj.down)&&La(e.adj.left)},ma.CheckMovement=ya;var Na={};Object.defineProperty(Na,"__esModule",{value:!0});var $a=(En=void 0,Na.ParticleManager=En);Na.GibManager=$a;var Fa={};Object.defineProperty(Fa,"__esModule",{value:!0});var Wa=function(e){return new Promise(t=>{gn({onComplete:t,...e})})};Fa.awaitAnimate=Wa;var Ua=(wn=void 0,xn=Fa.Animatable=wn,Fa.ParticleModes=xn);Fa.Particle=Ua;var Ga=function(){return(Ga=Object.assign||function(e){for(var t,a=1,r=arguments.length;a<r;a++)for(var n in t=arguments[a])Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e}).apply(this,arguments)};function Ya(e,t){var a={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(a[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(r=Object.getOwnPropertySymbols(e);n<r.length;n++)t.indexOf(r[n])<0&&Object.prototype.propertyIsEnumerable.call(e,r[n])&&(a[r[n]]=e[r[n]])}return a}var Ha=function(){},za=function(){};var Ka=function(e,t){return function(a){return Math.max(Math.min(a,t),e)}},Xa=function(e){return e%1?Number(e.toFixed(5)):e},Va=/(-)?([\d]*\.?[\d])+/g,qa=/(#[0-9a-f]{6}|#[0-9a-f]{3}|#(?:[0-9a-f]{2}){2,4}|(rgb|hsl)a?\((-?[\d\.]+%?[,\s]+){2,3}\s*\/*\s*[\d\.]+%?\))/gi,Za=/^(#[0-9a-f]{3}|#(?:[0-9a-f]{2}){2,4}|(rgb|hsl)a?\((-?[\d\.]+%?[,\s]+){2,3}\s*\/*\s*[\d\.]+%?\))$/i;function Qa(e){return"string"==typeof e}var Ja={test:function(e){return"number"==typeof e},parse:parseFloat,transform:function(e){return e}},er=Ga(Ga({},Ja),{transform:Ka(0,1)}),tr=(Ga(Ga({},Ja),{default:1}),function(e){return{test:function(t){return Qa(t)&&t.endsWith(e)&&1===t.split(" ").length},parse:parseFloat,transform:function(t){return""+t+e}}}),ar=(tr("deg"),tr("%")),rr=(tr("px"),tr("vh"),tr("vw"),Ga(Ga({},ar),{parse:function(e){return ar.parse(e)/100},transform:function(e){return ar.transform(100*e)}}),function(e,t){return function(a){return Qa(a)&&Za.test(a)&&a.startsWith(e)||t&&Object.prototype.hasOwnProperty.call(a,t)}}),nr=function(e,t,a){return function(r){var n;if(!Qa(r))return r;var i=r.match(Va),o=i[0],s=i[1],l=i[2],d=i[3];return(n={})[e]=parseFloat(o),n[t]=parseFloat(s),n[a]=parseFloat(l),n.alpha=void 0!==d?parseFloat(d):1,n}},ir={test:rr("hsl","hue"),parse:nr("hue","saturation","lightness"),transform:function(e){var t=e.hue,a=e.saturation,r=e.lightness,n=e.alpha,i=void 0===n?1:n;return"hsla("+Math.round(t)+", "+ar.transform(Xa(a))+", "+ar.transform(Xa(r))+", "+Xa(er.transform(i))+")"}},or=Ka(0,255),sr=Ga(Ga({},Ja),{transform:function(e){return Math.round(or(e))}}),lr={test:rr("rgb","red"),parse:nr("red","green","blue"),transform:function(e){var t=e.red,a=e.green,r=e.blue,n=e.alpha,i=void 0===n?1:n;return"rgba("+sr.transform(t)+", "+sr.transform(a)+", "+sr.transform(r)+", "+Xa(er.transform(i))+")"}};var dr={test:rr("#"),parse:function(e){var t="",a="",r="",n="";return e.length>5?(t=e.substr(1,2),a=e.substr(3,2),r=e.substr(5,2),n=e.substr(7,2)):(t=e.substr(1,1),a=e.substr(2,1),r=e.substr(3,1),n=e.substr(4,1),t+=t,a+=a,r+=r,n+=n),{red:parseInt(t,16),green:parseInt(a,16),blue:parseInt(r,16),alpha:n?parseInt(n,16)/255:1}},transform:lr.transform},ur=function(e){return lr.test(e)||dr.test(e)||ir.test(e)},cr=function(e){return lr.test(e)?lr.parse(e):ir.test(e)?ir.parse(e):dr.parse(e)},hr=function(e){return Qa(e)?e:e.hasOwnProperty("red")?lr.transform(e):ir.transform(e)};function fr(e){var t=[],a=0,r=e.match(qa);r&&(a=r.length,e=e.replace(qa,"${c}"),t.push.apply(t,r.map(cr)));var n=e.match(Va);return n&&(e=e.replace(Va,"${n}"),t.push.apply(t,n.map(Ja.parse))),{values:t,numColors:a,tokenised:e}}function gr(e){return fr(e).values}function pr(e){var t=fr(e),a=t.values,r=t.numColors,n=t.tokenised,i=a.length;return function(e){for(var t=n,a=0;a<i;a++)t=t.replace(a<r?"${c}":"${n}",a<r?hr(e[a]):Xa(e[a]));return t}}var mr=function(e){return"number"==typeof e?0:e};var yr={test:function(e){var t,a,r,n;return isNaN(e)&&Qa(e)&&(null!==(a=null===(t=e.match(Va))||void 0===t?void 0:t.length)&&void 0!==a?a:0)+(null!==(n=null===(r=e.match(qa))||void 0===r?void 0:r.length)&&void 0!==n?n:0)>0},parse:gr,createTransformer:pr,getAnimatableNone:function(e){var t=gr(e);return pr(e)(t.map(mr))}},vr=new Set(["brightness","contrast","saturate","opacity"]);function wr(e){var t=e.slice(0,-1).split("("),a=t[0],r=t[1];if("drop-shadow"===a)return e;var n=(r.match(Va)||[])[0];if(!n)return e;var i=r.replace(n,""),o=vr.has(a)?1:0;return n!==r&&(o*=100),a+"("+o+i+")"}var br=/([a-z-]*)\(.*?\)/g,_r=(Ga(Ga({},yr),{getAnimatableNone:function(e){var t=e.match(br);return t?t.map(wr).join(" "):e}}),"undefined"!=typeof performance?function(){return performance.now()}:function(){return Date.now()}),xr="undefined"!=typeof window?function(e){return window.requestAnimationFrame(e)}:function(e){return setTimeout((function(){return e(_r())}),1/60*1e3)};var Tr=!0,Er=!1,Mr=!1,Ar={delta:0,timestamp:0},Dr=["read","update","preRender","render","postRender"],kr=Dr.reduce((function(e,t){var a,r,n,i,o,s,l;return e[t]=(a=function(){return Er=!0},r=[],n=[],i=0,o=!1,s=new WeakSet,l={schedule:function(e,t,a){void 0===t&&(t=!1),void 0===a&&(a=!1);var l=a&&o,d=l?r:n;return t&&s.add(e),-1===d.indexOf(e)&&(d.push(e),l&&o&&(i=r.length)),e},cancel:function(e){var t=n.indexOf(e);-1!==t&&n.splice(t,1),s.delete(e)},process:function(e){var t;if(o=!0,r=(t=[n,r])[0],(n=t[1]).length=0,i=r.length)for(var d=0;d<i;d++){var u=r[d];u(e),s.has(u)&&(l.schedule(u),a())}o=!1}}),e}),{}),Pr=Dr.reduce((function(e,t){var a=kr[t];return e[t]=function(e,t,r){return void 0===t&&(t=!1),void 0===r&&(r=!1),Er||Rr(),a.schedule(e,t,r)},e}),{}),Sr=Dr.reduce((function(e,t){return e[t]=kr[t].cancel,e}),{}),jr=function(e){return kr[e].process(Ar)},Or=function(e){Er=!1,Ar.delta=Tr?1/60*1e3:Math.max(Math.min(e-Ar.timestamp,40),1),Ar.timestamp=e,Mr=!0,Dr.forEach(jr),Mr=!1,Er&&(Tr=!1,xr(Or))},Rr=function(){Er=!0,Tr=!0,Mr||xr(Or)},Cr=function(e,t,a){return Math.min(Math.max(a,e),t)};function Ir(e){var t,a,r=e.duration,n=void 0===r?800:r,i=e.bounce,o=void 0===i?.25:i,s=e.velocity,l=void 0===s?0:s,d=e.mass,u=void 0===d?1:d;Ha(n<=1e4,"Spring duration must be 10 seconds or less");var c=1-o;c=Cr(.05,1,c),n=Cr(.01,10,n/1e3),c<1?(t=function(e){var t=e*c,a=t*n;return.001-(t-l)/Lr(e,c)*Math.exp(-a)},a=function(e){var a=e*c*n,r=a*l+l,i=Math.pow(c,2)*Math.pow(e,2)*n,o=Math.exp(-a),s=Lr(Math.pow(e,2),c);return(.001-t(e)>0?-1:1)*((r-i)*o)/s}):(t=function(e){return Math.exp(-e*n)*((e-l)*n+1)-.001},a=function(e){return Math.exp(-e*n)*(n*n*(l-e))});var h=function(e,t,a){for(var r=a,n=1;n<12;n++)r-=e(r)/t(r);return r}(t,a,5/n);if(isNaN(h))return{stiffness:100,damping:10};var f=Math.pow(h,2)*u;return{stiffness:f,damping:2*c*Math.sqrt(u*f)}}function Lr(e,t){return e*Math.sqrt(1-t*t)}var Br=["duration","bounce"],Nr=["stiffness","damping","mass"];function $r(e,t){return t.some((function(t){return void 0!==e[t]}))}function Fr(e){var t=e.from,a=void 0===t?0:t,r=e.to,n=void 0===r?1:r,i=e.restSpeed,o=void 0===i?2:i,s=e.restDelta,l=Ya(e,["from","to","restSpeed","restDelta"]),d={done:!1,value:a},u=function(e){var t=Ga({velocity:0,stiffness:100,damping:10,mass:1,isResolvedFromDuration:!1},e);if(!$r(e,Nr)&&$r(e,Br)){var a=Ir(e);(t=Ga(Ga(Ga({},t),a),{velocity:0,mass:1})).isResolvedFromDuration=!0}return t}(l),c=u.stiffness,h=u.damping,f=u.mass,g=u.velocity,p=u.isResolvedFromDuration,m=Wr,y=Wr;function v(){var e=g?-g/1e3:0,t=n-a,r=h/(2*Math.sqrt(c*f)),i=Math.sqrt(c/f)/1e3;if(null!=s||(s=Math.abs(n-a)<=1?.01:.4),r<1){var o=Lr(i,r);m=function(a){var s=Math.exp(-r*i*a);return n-s*((e+r*i*t)/o*Math.sin(o*a)+t*Math.cos(o*a))},y=function(a){var n=Math.exp(-r*i*a);return r*i*n*(Math.sin(o*a)*(e+r*i*t)/o+t*Math.cos(o*a))-n*(Math.cos(o*a)*(e+r*i*t)-o*t*Math.sin(o*a))}}else if(1===r)m=function(a){return n-Math.exp(-i*a)*(t+(e+i*t)*a)};else{var l=i*Math.sqrt(r*r-1);m=function(a){var o=Math.exp(-r*i*a),s=Math.min(l*a,300);return n-o*((e+r*i*t)*Math.sinh(s)+l*t*Math.cosh(s))/l}}}return v(),{next:function(e){var t=m(e);if(p)d.done=e>=l.duration;else{var a=1e3*y(e),r=Math.abs(a)<=o,i=Math.abs(n-t)<=s;d.done=r&&i}return d.value=d.done?n:t,d},flipTarget:function(){var e;g=-g,a=(e=[n,a])[0],n=e[1],v()}}}Fr.needsInterpolation=function(e,t){return"string"==typeof e||"string"==typeof t};var Wr=function(e){return 0},Ur=function(e,t,a){var r=t-e;return 0===r?1:(a-e)/r},Gr=function(e,t,a){return-a*e+a*t+e},Yr=function(e,t,a){var r=e*e,n=t*t;return Math.sqrt(Math.max(0,a*(n-r)+r))},Hr=[dr,lr,ir],zr=function(e){return Hr.find((function(t){return t.test(e)}))},Kr=function(e){return"'"+e+"' is not an animatable color. Use the equivalent color code instead."},Xr=function(e,t){var a=zr(e),r=zr(t);za(!!a,Kr(e)),za(!!r,Kr(t)),za(a.transform===r.transform,"Both colors must be hex/RGBA, OR both must be HSLA.");var n=a.parse(e),i=r.parse(t),o=Ga({},n),s=a===ir?Gr:Yr;return function(e){for(var t in o)"alpha"!==t&&(o[t]=s(n[t],i[t],e));return o.alpha=Gr(n.alpha,i.alpha,e),a.transform(o)}},Vr=function(e,t){return function(a){return t(e(a))}},qr=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return e.reduce(Vr)};function Zr(e,t){return"number"==typeof e?function(a){return Gr(e,t,a)}:ur(e)?Xr(e,t):tn(e,t)}var Qr=function(e,t){var a=function(){for(var e=0,t=0,a=arguments.length;t<a;t++)e+=arguments[t].length;var r=Array(e),n=0;for(t=0;t<a;t++)for(var i=arguments[t],o=0,s=i.length;o<s;o++,n++)r[n]=i[o];return r}(e),r=a.length,n=e.map((function(e,a){return Zr(e,t[a])}));return function(e){for(var t=0;t<r;t++)a[t]=n[t](e);return a}},Jr=function(e,t){var a=Ga(Ga({},e),t),r={};for(var n in a)void 0!==e[n]&&void 0!==t[n]&&(r[n]=Zr(e[n],t[n]));return function(e){for(var t in r)a[t]=r[t](e);return a}};function en(e){for(var t=yr.parse(e),a=t.length,r=0,n=0,i=0,o=0;o<a;o++)r||"number"==typeof t[o]?r++:void 0!==t[o].hue?i++:n++;return{parsed:t,numNumbers:r,numRGB:n,numHSL:i}}var tn=function(e,t){var a=yr.createTransformer(t),r=en(e),n=en(t);return za(r.numHSL===n.numHSL&&r.numRGB===n.numRGB&&r.numNumbers>=n.numNumbers,"Complex values '"+e+"' and '"+t+"' too different to mix. Ensure all colors are of the same type."),qr(Qr(r.parsed,n.parsed),a)},an=function(e,t){return function(a){return Gr(e,t,a)}};function rn(e,t,a){for(var r,n=[],i=a||("number"==typeof(r=e[0])?an:"string"==typeof r?ur(r)?Xr:tn:Array.isArray(r)?Qr:"object"==typeof r?Jr:void 0),o=e.length-1,s=0;s<o;s++){var l=i(e[s],e[s+1]);if(t){var d=Array.isArray(t)?t[s]:t;l=qr(d,l)}n.push(l)}return n}function nn(e,t,a){var r=void 0===a?{}:a,n=r.clamp,i=void 0===n||n,o=r.ease,s=r.mixer,l=e.length;za(l===t.length,"Both input and output ranges must be the same length"),za(!o||!Array.isArray(o)||o.length===l-1,"Array of easing functions must be of length `input.length - 1`, as it applies to the transitions **between** the defined values."),e[0]>e[l-1]&&(e=[].concat(e),t=[].concat(t),e.reverse(),t.reverse());var d=rn(t,o,s),u=2===l?function(e,t){var a=e[0],r=e[1],n=t[0];return function(e){return n(Ur(a,r,e))}}(e,d):function(e,t){var a=e.length,r=a-1;return function(n){var i=0,o=!1;if(n<=e[0]?o=!0:n>=e[r]&&(i=r-1,o=!0),!o){for(var s=1;s<a&&!(e[s]>n||s===r);s++);i=s-1}var l=Ur(e[i],e[i+1],n);return t[i](l)}}(e,d);return i?function(t){return u(Cr(e[0],e[l-1],t))}:u}var on=function(e){return function(t){return t<=.5?e(2*t)/2:(2-e(2*(1-t)))/2}},sn=function(e){return function(t){return Math.pow(t,e)}}(2),ln=on(sn);function dn(e,t){return e.map((function(){return t||ln})).splice(0,e.length-1)}function un(e){var t=e.from,a=void 0===t?0:t,r=e.to,n=void 0===r?1:r,i=e.ease,o=e.offset,s=e.duration,l=void 0===s?300:s,d={done:!1,value:a},u=Array.isArray(n)?n:[a,n],c=function(e,t){return e.map((function(e){return e*t}))}(o&&o.length===u.length?o:function(e){var t=e.length;return e.map((function(e,a){return 0!==a?a/(t-1):0}))}(u),l);function h(){return nn(c,u,{ease:Array.isArray(i)?i:dn(u,i)})}var f=h();return{next:function(e){return d.value=f(e),d.done=e>=l,d},flipTarget:function(){u.reverse(),f=h()}}}var cn={keyframes:un,spring:Fr,decay:function(e){var t=e.velocity,a=void 0===t?0:t,r=e.from,n=void 0===r?0:r,i=e.power,o=void 0===i?.8:i,s=e.timeConstant,l=void 0===s?350:s,d=e.restDelta,u=void 0===d?.5:d,c=e.modifyTarget,h={done:!1,value:n},f=o*a,g=n+f,p=void 0===c?g:c(g);return p!==g&&(f=p-n),{next:function(e){var t=-f*Math.exp(-e/l);return h.done=!(t>u||t<-u),h.value=h.done?p:p+t,h},flipTarget:function(){}}}};function hn(e,t,a){return void 0===a&&(a=0),e-t-a}var fn=function(e){var t=function(t){var a=t.delta;return e(a)};return{start:function(){return Pr.update(t,!0,!0)},stop:function(){return Sr.update(t)}}};function gn(e){var t,a,r,n,i,o=e.from,s=e.autoplay,l=void 0===s||s,d=e.driver,u=void 0===d?fn:d,c=e.elapsed,h=void 0===c?0:c,f=e.repeat,g=void 0===f?0:f,p=e.repeatType,m=void 0===p?"loop":p,y=e.repeatDelay,v=void 0===y?0:y,w=e.onPlay,b=e.onStop,_=e.onComplete,x=e.onRepeat,T=e.onUpdate,E=Ya(e,["from","autoplay","driver","elapsed","repeat","repeatType","repeatDelay","onPlay","onStop","onComplete","onRepeat","onUpdate"]),M=E.to,A=0,D=E.duration,k=!1,P=!0,S=function(e){if(Array.isArray(e.to))return un;if(cn[e.type])return cn[e.type];var t=new Set(Object.keys(e));return t.has("ease")||t.has("duration")&&!t.has("dampingRatio")?un:t.has("dampingRatio")||t.has("stiffness")||t.has("mass")||t.has("damping")||t.has("restSpeed")||t.has("restDelta")?Fr:un}(E);(null===(a=(t=S).needsInterpolation)||void 0===a?void 0:a.call(t,o,M))&&(i=nn([0,100],[o,M],{clamp:!1}),o=0,M=100);var j=S(Ga(Ga({},E),{from:o,to:M}));function O(){A++,"reverse"===m?h=function(e,t,a,r){return void 0===a&&(a=0),void 0===r&&(r=!0),r?hn(t+-e,t,a):t-(e-t)+a}(h,D,v,P=A%2==0):(h=hn(h,D,v),"mirror"===m&&j.flipTarget()),k=!1,x&&x()}function R(e){if(P||(e=-e),h+=e,!k){var t=j.next(Math.max(0,h));n=t.value,i&&(n=i(n)),k=P?t.done:h<=0}null==T||T(n),k&&(0===A&&(null!=D||(D=h)),A<g?function(e,t,a,r){return r?e>=t+a:e<=-a}(h,D,v,P)&&O():(r.stop(),_&&_()))}return l&&(null==w||w(),(r=u(R)).start()),{stop:function(){null==b||b(),r.stop()}}}var pn=function(e){return e},mn=function(e){return void 0===e&&(e=pn),function(t,a,r){var n=a-r,i=-(0-t+1)*(0-e(Math.abs(n)));return n<=0?a+i:a-i}};Math.sqrt;const yn=new Promise(e=>e());class vn{status=yn;updatable=()=>null;driver=e=>({start:()=>this.updatable=e,stop:()=>this.updatable=()=>null});update(e){this.updatable(e)}}var wn=vn;let bn;Fa.Animatable=wn;var _n,xn=bn;Fa.ParticleModes=xn,(_n=bn||(xn=bn={},Fa.ParticleModes=xn))[_n.DRAW=0]="DRAW",_n[_n.DRAW_OVER=1]="DRAW_OVER",_n[_n.DRAW_APPEND=2]="DRAW_APPEND",_n[_n.DRAW_OVER_FIRST=3]="DRAW_OVER_FIRST",_n[_n.DRAW_OVER_LAST=4]="DRAW_OVER_LAST";Ua=class extends vn{constructor(e,t,a,r,n){super(),this.id=t,this.x=a,this.y=r,this.options=n,this.mode=e.mode,this.char=e.char,this.fg=e.fg,this.bg=e.bg;const i=new Promise(e=>this._end=e);this.status=Promise.race([e.animate(this),i])}finish(){this._end&&this._end()}render(e,t,a){let r,n=this.char;switch(this.mode){case bn.DRAW:r="draw";break;case bn.DRAW_OVER:r="drawOver";break;case bn.DRAW_APPEND:r="drawAppend",n=n||"";break;case bn.DRAW_OVER_FIRST:r="drawOverFirst";break;case bn.DRAW_OVER_LAST:r="drawOverLast"}e[r](this.x+t.x-a.x,this.y+t.y-a.y,n,this.fg,this.bg)}},Fa.Particle=Ua;class Tn{id=0;startOfTurn=[];endOfTurn=[];constructor(e){this.getData=e}createParticle(e,t,a,r){const n=this.getData(),i=this.id,o=new Fa.Particle(e,i,t,a,r);return n.add(i,o),this.id+=1,o.status.then(()=>n.remove(i)),o}async runThenDestroy(e,t,a,r){const n=this.createParticle(e,t,a,r);await n.status}makeUntilEndOfTurn(e,t,a,r){const n=this.createParticle(e,t,a,r);return this.endOfTurn.push(n),n}makeUntilStartOfTurn(e,t,a,r){const n=this.createParticle(e,t,a,r);return this.startOfTurn.push(n),n}clearStartOfTurn(){let e;for(;e=this.startOfTurn.pop();)e.finish()}clearEndOfTurn(){let e;for(;e=this.endOfTurn.pop();)e.finish()}}var En=new Tn(()=>yt.gameData.particles);Na.ParticleManager=En;$a=new Tn(()=>yt.gameData.gibs),Na.GibManager=$a;var Mn={};Object.defineProperty(Mn,"__esModule",{value:!0});var An=void 0;Mn.HitParticle=An;An={mode:Fa.ParticleModes.DRAW_OVER_LAST,char:null,fg:null,bg:"rgba(255, 100, 200, 0.75)",animate:async e=>{await(0,Fa.awaitAnimate)({driver:e.driver,from:"rgba(255, 100, 200, 0.75)",to:"rgba(255, 100, 200, 0.25)",duration:100,onUpdate:t=>{e.bg=t}}),await(0,Fa.awaitAnimate)({driver:e.driver,from:"rgba(255, 100, 200, 0.25)",to:"rgba(255, 100, 200, 0.75)",duration:100,onUpdate:t=>{e.bg=t}}),await(0,Fa.awaitAnimate)({driver:e.driver,from:"rgba(255, 100, 200, 0.75)",to:"rgba(255, 100, 200, 0.25)",duration:100,onUpdate:t=>{e.bg=t}})}},Mn.HitParticle=An;var Dn={};Object.defineProperty(Dn,"__esModule",{value:!0});var kn=(Jn=void 0,ei=Dn.damageWithForce=Jn,ti=Dn.getDamageReduction=ei,ai=Dn.getEquipmentWeight=ti,ri=Dn.getActorArmor=ai,ii=Dn.getActorWeight=ri,oi=Dn.getWeightLoad=ii,si=Dn.getWeightLevel=oi,li=Dn.weightToActionSpeed=si,Dn.reduceDamage=li);Dn.hasStrength=kn;var Pn={};Object.defineProperty(Pn,"__esModule",{value:!0});var Sn=($n=void 0,Wn=Pn.Encumbrance=$n,Hn=Pn.Stat=Wn,Xn=Pn.WieldMode=Hn,Zn=Pn.ActorBreed=Xn,Pn.Hands=Zn);Pn.Actor=Sn;var jn={};Object.defineProperty(jn,"__esModule",{value:!0});var On=void 0;jn.Entity=On;On=class{constructor(e,t,a=0,r=0){this.id=e,this.breed=t,this.x=a,this.y=r}},jn.Entity=On;var Rn={};Object.defineProperty(Rn,"__esModule",{value:!0});var Cn=void 0;Rn.Breed=Cn;Cn=class{fg=null;bg=null;ch=null;name="";info="";description="";logName="";displayPriority=1;constructor(e,t){this.key=e,Object.assign(this,t.glyph,t.text),this.displayPriority=t.displayPriority||1}},Rn.Breed=Cn;var In={};Object.defineProperty(In,"__esModule",{value:!0});var Ln=void 0;In.SparseMap=Ln;let Bn;Ln=class{size=0;keys=new Map;data=[];idRef=[];clear(){this.size=0,this.keys.clear(),this.data=[],this.idRef=[]}add(e,t){this.size+=1,this.keys.set(e,this.data.push(t)-1),this.idRef.push(e)}remove(e){this.size-=1;const t=this.keys.get(e);if(null!=t){const a=this.data[t];this.keys.delete(e);if(t===this.data.length-1)this.data.pop(),this.idRef.pop();else{const e=this.data.pop(),a=this.idRef.pop();this.data[t]=e,this.idRef[t]=a,this.keys.set(a,t)}return a}}get(e){const t=this.keys.get(e);if(null!=t)return this.data[t];console.warn(`Entity ${e} not found!`)}forEach(e){this.data.forEach(e)}map(e){this.data.map(e)}filter(e){return this.data.filter(e)}find(e){return this.data.find(e)}},In.SparseMap=Ln;var Nn,$n=Bn;Pn.Encumbrance=$n,(Nn=Bn||($n=Bn={},Pn.Encumbrance=$n))[Nn.LIGHT=0]="LIGHT",Nn[Nn.MEDIUM=1]="MEDIUM",Nn[Nn.HEAVY=2]="HEAVY";class Fn{emptyTriggered=!1;current=0;constructor(e,t,a){this.max=e,this.trigger=t,a&&(this.current=e)}change(e){0<e?(this.emptyTriggered=!1,this.current=Math.min(this.max,this.current+e)):this.current=Math.max(0,this.current+e),this.current||!this.trigger||this.emptyTriggered||(this.emptyTriggered=!0,this.trigger())}adjustMax(e,t){this.max=Math.max(0,this.max+e),t?(this.emptyTriggered=!1,this.change(e)):this.current=Math.min(this.max,this.current)}fill(){this.emptyTriggered=!1,this.current=this.max}}var Wn=Fn;Pn.Stat=Wn;const Un={level:0,health:0,stamina:0,poise:0,armor:0,weight:0,strength:0,force:0};let Gn;var Yn,Hn=Gn;Pn.WieldMode=Hn,(Yn=Gn||(Hn=Gn={},Pn.WieldMode=Hn))[Yn.oneHanded=0]="oneHanded",Yn[Yn.twoHanded=1]="twoHanded";const zn={damage:1,poise:5,stamina:20};class Kn extends Rn.Breed{baseStats=Un;statTriggers={};defaultWielding={};defaultWearing={};defaultContains=[];controller=null;constructor(e,t){super(e,t),this.controller=t.actionController,this.baseStats=t.baseStats||Un,this.statTriggers=t.triggers||{},this.defaultWielding=t.wielding,this.defaultWearing=t.wearing,this.defaultContains=t.contains,this.baseAttack=t.baseAttack||zn}}var Xn=Kn;let Vn;Pn.ActorBreed=Xn;var qn,Zn=Vn;Pn.Hands=Zn,(qn=Vn||(Zn=Vn={},Pn.Hands=Zn))[qn.LEFT=0]="LEFT",qn[qn.RIGHT=1]="RIGHT";class Qn extends jn.Entity{alive=!0;wielding={mode:Gn.oneHanded,activeHand:Vn.LEFT};wearing={};contains=new In.SparseMap;status={};ownedParticles=new Map;seenPlayer=0;constructor(e,t,a,r){super(e,t,a,r),this.level=t.baseStats.level,this.health=new Fn(t.baseStats.health,t.statTriggers.health&&t.statTriggers.health.bind(null,this),!0),this.stamina=new Fn(t.baseStats.stamina,t.statTriggers.stamina&&t.statTriggers.stamina.bind(null,this),!0),this.poise=new Fn(t.baseStats.poise,t.statTriggers.poise&&t.statTriggers.poise.bind(null,this),!0),this.attributes={force:t.baseStats.force,strength:t.baseStats.strength,weight:t.baseStats.weight,armor:t.baseStats.armor}}plan(){return this.breed.controller&&this.breed.controller(this)}end(){this.alive=!1,this.ownedParticles.forEach(e=>e.finish())}async addParticle(e){this.ownedParticles.set(e.id,e),await e.status,this.ownedParticles.delete(e.id)}}Sn=Qn,Pn.Actor=Sn;var Jn=(e,t)=>(e+2*t)*(1+.05*t);Dn.damageWithForce=Jn;var ei=e=>1-.05*e/(1+.05*Math.abs(e));Dn.getDamageReduction=ei;var ti=e=>{var t,a,r;return((null===(t=e.wielding.left)||void 0===t?void 0:t.breed.stats.weight)||0)+((null===(a=e.wielding.right)||void 0===a?void 0:a.breed.stats.weight)||0)+((null===(r=e.wearing.armor)||void 0===r?void 0:r.breed.stats.weight)||0)};Dn.getEquipmentWeight=ti;var ai=e=>{var t,a,r;return(e.attributes.armor||0)+((null===(t=e.wielding.left)||void 0===t?void 0:t.breed.stats.armor)||0)+((null===(a=e.wielding.right)||void 0===a?void 0:a.breed.stats.armor)||0)+((null===(r=e.wearing.armor)||void 0===r?void 0:r.breed.stats.armor)||0)};Dn.getActorArmor=ai;var ri=e=>{var t,a,r;return((null===(t=e.wielding.left)||void 0===t?void 0:t.breed.stats.weight)||0)+((null===(a=e.wielding.right)||void 0===a?void 0:a.breed.stats.weight)||0)+((null===(r=e.wearing.armor)||void 0===r?void 0:r.breed.stats.weight)||0)};Dn.getActorWeight=ri;const ni=(e,t)=>Math.floor(100*e/t);var ii=ni;Dn.getWeightLoad=ii;var oi=(e,t)=>{const a=ni(e,t);return a<=25?Pn.Encumbrance.LIGHT:a<=75?Pn.Encumbrance.MEDIUM:Pn.Encumbrance.HEAVY};Dn.getWeightLevel=oi;var si=e=>{switch(e){case Pn.Encumbrance.LIGHT:return la.ActionSpeed.FAST;case Pn.Encumbrance.MEDIUM:return la.ActionSpeed.MEDIUM;case Pn.Encumbrance.HEAVY:return la.ActionSpeed.SLOW}};Dn.weightToActionSpeed=si;var li=(e,t)=>Math.max(Math.round(e*t),1);Dn.reduceDamage=li;kn=(e,t)=>(t.strength||0)<=e.attributes.strength,Dn.hasStrength=kn;var di={};Object.defineProperty(di,"__esModule",{value:!0});var ui=(hi=void 0,fi=di.attackMsg=hi,gi=di.staggeredMsg=fi,pi=di.diedMsg=gi,mi=di.blockMsg=pi,di.blockFailMsg=mi);di.blockSuccMsg=ui;var ci=function(e){return e&&e.__esModule?e:{default:e}}(h);var hi=(e,t,a)=>{(0,Qe.log)(e===yt.gameData.player?`%c{${ci.default.B_GREY_4}}${e.breed.logName} hit ${t.breed.logName} for %c{${ci.default.RED_4}}${a}`:`%c{${ci.default.B_GREY_4}}${e.breed.logName} hits ${t.breed.logName} for %c{${ci.default.RED_4}}${a}`)};di.attackMsg=hi;var fi=e=>{(0,Qe.log)(e===yt.gameData.player?`${e.breed.logName} are %c{${ci.default.BLUE_1}}staggered%c{} and unable to react.`:`${e.breed.logName} is %c{${ci.default.BLUE_1}}staggered%c{} and unable to react.`)};di.staggeredMsg=fi;var gi=e=>{(0,Qe.log)(e===yt.gameData.player?e.breed.logName+" have fallen in battle.":`%c{${ci.default.B_GREY_4}}${e.breed.logName} has fallen in battle.`)};di.diedMsg=gi;var pi=(e,t,a)=>{(0,Qe.log)(t===yt.gameData.player?`${t.breed.logName} take %c{${ci.default.RED_4}}${a}%c{} damage blocking ${e.breed.logName}'s attack.`:`${t.breed.logName} takes %c{${ci.default.RED_4}}${a}%c{} damage blocking your attack.`)};di.blockMsg=pi;var mi=e=>{(0,Qe.log)(e===yt.gameData.player?"The mighty blow is too much for you to block.":`The might blow is too much for ${e.breed.logName} to block`)};di.blockFailMsg=mi;ui=e=>{(0,Qe.log)(e===yt.gameData.player?e.breed.logName+" recoil from being blocked.":e.breed.logName+" recoils from being blocked.")},di.blockSuccMsg=ui;var yi={};Object.defineProperty(yi,"__esModule",{value:!0});var vi=void 0;yi.getActiveAttack=vi;vi=e=>{var t,a,r,n;if(e.wielding.mode===Pn.WieldMode.twoHanded)return(null===(t=e.wielding.left)||void 0===t||null===(a=t.breed.attacks)||void 0===a?void 0:a.twohanded)||(null===(r=e.wielding.right)||void 0===r||null===(n=r.breed.attacks)||void 0===n?void 0:n.twohanded)||e.breed.baseAttack;if(e.wielding.activeHand===Pn.Hands.LEFT){var i;const t=e.wielding.left;return(null==t||null===(i=t.breed.attacks)||void 0===i?void 0:i.onehanded)||e.breed.baseAttack}{var o;const t=e.wielding.right;return(null==t||null===(o=t.breed.attacks)||void 0===o?void 0:o.onehanded)||e.breed.baseAttack}},yi.getActiveAttack=vi;var wi=(e,t)=>{const a=(0,Xt.getDirectionTowards)(e,t.target);return bi(e,{dir:a})};ga.attackTo=wi;const bi=async(e,t)=>{const a=yt.gameData.current.tiles[e.x+e.y*yt.gameData.current.width];let r=e.x,n=e.y;if(!ma.CheckMovement[t.dir](a))return{valid:!1};switch(t.dir){case Xt.Directions.Up:n-=1;break;case Xt.Directions.Right:r+=1;break;case Xt.Directions.Down:n+=1;break;case Xt.Directions.Left:r-=1}const i=(0,yt.findActorForPosition)(r,n);if(i){const t=(0,yi.getActiveAttack)(e);await Na.GibManager.runThenDestroy(Mn.HitParticle,r,n);const a=(0,Dn.getDamageReduction)((0,Dn.getActorArmor)(i)),o=(0,Dn.damageWithForce)(t.damage||1,e.attributes.force||0);if(i.status.blocking){const r=(0,yi.getActiveAttack)(i);if(r&&r.blocks){const n=(0,Dn.reduceDamage)(o,1-r.blocks),s=t.stamina||0,l=(0,Dn.reduceDamage)(s,1-(r.stability||0)/100),d=l-e.stamina.current,u=2*(r.stability||0)-(o+s),c=(0,Dn.reduceDamage)(n,a);(0,di.blockMsg)(e,i,c),0<d?(i.poise.change(-1*(d+(t.poise||0))),(0,di.blockFailMsg)(i)):0<u&&((0,di.blockSuccMsg)(e),e.poise.change(-1*u),e.status.hit=!0),i.stamina.change(-1*l),i.health.change(-1*c)}else console.warn("blocked attack without a blocking attack.")}else{const r=(0,Dn.reduceDamage)(o,a);i.health.change(-1*r),i.poise.change(-1*(t.poise||0)),(0,di.attackMsg)(e,i,r)}return e.stamina.change(-1*t.stamina),i.status.hit=!0,{valid:!0}}return{valid:!0}};var _i=bi;ga.attackTowards=_i;pa=e=>(e.status.blocking=!0,{valid:!0}),ga.blockAttacks=pa;var xi={};Object.defineProperty(xi,"__esModule",{value:!0});var Ti=(ml=void 0,yl=xi.wait=ml,vl=xi.sprintTowards=yl,xi.moveTo=vl);xi.moveTowards=Ti;var Ei={};Object.defineProperty(Ei,"__esModule",{value:!0});var Mi=void 0;Ei.FootstepParticle=Mi;var Ai=function(e){return e&&e.__esModule?e:{default:e}}(h);const Di=Ai.default.B_GREY_4,ki=Ai.default.B_GREY_2;Mi={mode:Fa.ParticleModes.DRAW_APPEND,char:".",fg:Di,bg:"transparent",animate:async e=>{await(0,Fa.awaitAnimate)({driver:e.driver,from:Di,to:ki,duration:300,onUpdate:t=>{e.fg=t}})}},Ei.FootstepParticle=Mi;var Pi={};Object.defineProperty(Pi,"__esModule",{value:!0});var Si=void 0;Pi.default=Si;var ji={};Object.defineProperty(ji,"__esModule",{value:!0});var Oi=(Ci=void 0,Li=ji.ItemBreed=Ci,ji.BASIC_STATS=Li);ji.Item=Oi;class Ri extends Rn.Breed{mandatory=!1;furniture=!1;stackLimit=1;constructor(e,t){super(e,t),this.stats=t.stats,this.wearable=t.wearable,this.furniture=t.furniture,this.mandatory=t.mandatory,this.usable=t.usable,this.interact=t.interact,this.attacks=t.attacks}}var Ci=Ri;ji.ItemBreed=Ci;const Ii=["health","stamina","poise"];var Li=Ii;ji.BASIC_STATS=Li;class Bi extends jn.Entity{everHeld=!1;uses=null;constructor(e,t,a,r){super(e,t,a,r),t.usable&&(this.uses=new Pn.Stat(t.usable.uses,null,!0))}useItem(e){if(this.uses){this.uses.change(-1);const t=this.breed.usable;t&&(t.consumeOnEmpty&&this.uses.current<=0&&e.contains.remove(this.id),t.stats.health&&e.health.change(t.stats.health),t.stats.stamina&&e.health.change(t.stats.stamina))}}async interact(e){this.breed.interact&&await this.breed.interact(e)}applyStats(e,t){this.breed.stats&&Ii.forEach(a=>{null!=this.breed.stats[a]&&e[a].adjustMax(this.breed.stats[a],t)})}removeStats(e){this.breed.stats&&Ii.forEach(t=>{null!=this.breed.stats[t]&&e[t].adjustMax(-1*this.breed.stats[t])})}}Oi=Bi,ji.Item=Oi;var Ni={};Object.defineProperty(Ni,"__esModule",{value:!0});var $i=(dl=void 0,Ni.items=dl);Ni.ItemTypes=$i;var Fi={};Object.defineProperty(Fi,"__esModule",{value:!0});var Wi=void 0;Fi.armors=Wi;const Ui={glyph:{fg:function(e){return e&&e.__esModule?e:{default:e}}(h).default.B_GREY_4,ch:"&"}};Wi={frock:{...Ui,text:{name:"An Unadorned Frock",info:"A light robe, provides minimal poise",description:"These unassuming frocks are worn the world over. The monks of the floating abbey first popularized their use.",logName:"Frock"},wearable:"armor",stats:{weight:2,armor:0,poise:20}},tunic:{...Ui,text:{name:"A Threadbare Tunic",info:"Light and easy to wear",description:"A well worn garment made of cloth and linen.",logName:"Tunic"},wearable:"armor",stats:{weight:6,armor:5,poise:20}},bCoat:{...Ui,text:{name:"Buff Coat",logName:"Coat",info:"Solid protection from attacks without much weight.",description:"The war for which this was made is long forgotten. Features an emblem of a divine horse over trampled men."},wearable:"armor",stats:{weight:8,armor:8,poise:40}},gambeson:{...Ui,text:{name:"Gambeson",logName:"Gambeson",info:"Strong protection without inhibiting movement",description:"Deemed contraband by the church, this armor has been passed down through generations."},wearable:"armor",stats:{weight:10,armor:15,poise:60}},curiass:{...Ui,text:{name:"Linen Curiass",logName:"Cuirass",info:"Its heft offers good protection.",description:"Strongly woven linen, but still breathable. A rare relic of the Long Wars."},wearable:"armor",stats:{weight:15,armor:20,poise:80}},bouilli:{...Ui,text:{name:"Cuir bouilli",logName:"Cuir bouilli",info:"Heavy and bulky, but can stop even a dedicated blow.",description:"Layers of glue and boiled leather hastily assembled into an armor. Worn often by those wishing to challenge the church's armaments"},wearable:"armor",stats:{weight:30,armor:40,poise:120}}},Fi.armors=Wi;var Gi={};Object.defineProperty(Gi,"__esModule",{value:!0});var Yi=void 0;Gi.consumables=Yi;Yi={flask:{glyph:{fg:function(e){return e&&e.__esModule?e:{default:e}}(h).default.RED_4,ch:"X"},text:{name:"Flask of Restoration",info:"Heals %c{#FF0000} 40%c{} health. Restore uses by resting (%c{#e0c270}z%c{}) at a shrine (%c{#e0c270}_%c{})",description:"A drink to sooth your wounds and forget the world for a moment. Just don't forget too long or you may never remember",logName:"flask"},mandatory:!0,usable:{uses:5,consumeOnEmpty:!1,fillOnRest:!0,stats:{health:40}}}},Gi.consumables=Yi;var Hi={};Object.defineProperty(Hi,"__esModule",{value:!0});var zi=void 0;Hi.furniture=zi;var Ki={};Object.defineProperty(Ki,"__esModule",{value:!0});var Xi=void 0;Ki.FontParticle=Xi;Xi={mode:Fa.ParticleModes.DRAW_OVER_LAST,char:null,fg:null,bg:"rgba(100, 100, 200, 0.25)",animate:async e=>{await(0,Fa.awaitAnimate)({driver:e.driver,from:"rgba(100, 100, 200, 0.75)",to:"rgba(100, 100, 200, 0.25)",duration:200,onUpdate:t=>{e.bg=t}}),await(0,Fa.awaitAnimate)({driver:e.driver,from:"rgba(255, 100, 200, 0.25)",to:"rgba(255, 255, 255, 0.75)",duration:200,onUpdate:t=>{e.bg=t}}),await(0,Fa.awaitAnimate)({driver:e.driver,from:"rgba(255, 255, 255, 0.75)",to:"rgba(255, 100, 200, 0.25)",duration:200,onUpdate:t=>{e.bg=t}})}},Ki.FontParticle=Xi;var Vi=function(e){return e&&e.__esModule?e:{default:e}}(h),qi={};Object.defineProperty(qi,"__esModule",{value:!0});var Zi=void 0;qi.generateMap=Zi;var Qi={};Object.defineProperty(Qi,"__esModule",{value:!0});var Ji=void 0;Qi.BreedTypes=Ji;var eo={};Object.defineProperty(eo,"__esModule",{value:!0});var to=void 0;eo.StaggeredParticle=to;to={mode:Fa.ParticleModes.DRAW_OVER_LAST,char:null,fg:"rgba(100, 100, 255, 1.0)",bg:null,animate:async e=>{const t=e.options||"rgba(100, 100, 100, 1.0)";for(;;)await(0,Fa.awaitAnimate)({driver:e.driver,from:t,to:"rgba(100, 100, 255, 1.0)",duration:1e3,onUpdate:t=>{e.fg=t}}),await(0,Fa.awaitAnimate)({driver:e.driver,from:"rgba(100, 100, 255, 1.0)",to:t,duration:1e3,onUpdate:t=>{e.fg=t}})}},eo.StaggeredParticle=to;var ao=function(e){return e&&e.__esModule?e:{default:e}}(h),ro={};Object.defineProperty(ro,"__esModule",{value:!0});var no=void 0;ro.DeathModal=no;var io={};Object.defineProperty(io,"__esModule",{value:!0});var oo=(uo=void 0,fo=io.ALIGN_TYPE=uo,io.VERT_TYPE=fo);let so;io.TextType=oo;var lo,uo=so;let co;io.ALIGN_TYPE=uo,(lo=so||(uo=so={},io.ALIGN_TYPE=uo))[lo.left=0]="left",lo[lo.center=1]="center",lo[lo.right=2]="right";var ho,fo=co;io.VERT_TYPE=fo,(ho=co||(fo=co={},io.VERT_TYPE=fo))[ho.top=0]="top",ho[ho.middle=1]="middle",ho[ho.bottom=2]="bottom";oo=(e,t={title:"",align:so.left,vert:co.top})=>{let a,r;switch(t.align){case so.right:a=e.bounds.x+e.bounds.w-t.title.length;break;case so.center:a=e.bounds.x+Math.floor((e.bounds.w-t.title.length)/2);break;default:a=e.bounds.x}switch(t.vert){case co.middle:r=e.bounds.y+Math.floor((e.bounds.h-1)/2);break;case co.bottom:r=e.bounds.y+e.bounds.h-1;break;default:r=e.bounds.y}e.display.drawText(a,r,t.title,e.bounds.w)},io.TextType=oo;var go=function(e){return e&&e.__esModule?e:{default:e}}(h);no=(e,t)=>((0,m.floodFill)(e.display,e.bounds,go.default.BLACK),e.handlers.keypress=e=>"Enter"!==e,[(0,o.createElement)(io.TextType,{x:1,y:0,w:e.bounds.w-2,h:1},{title:"DEFEAT",align:io.ALIGN_TYPE.center}),(0,o.createElement)(io.TextType,{x:1,y:1,w:e.bounds.w-2,h:1},{title:"Unwaivering was your faith, but it wasn't enough to overcome despair. Your wounds are fatal."}),(0,o.createElement)(u.ButtonComp,{x:1,y:e.bounds.h-2,w:e.bounds.w-2,h:1},{title:"(Enter) Restart",keys:["Escape","Enter"],onClick:()=>{(0,st.closeModal)(),(0,be.setScene)(new We.Main)}})]),ro.DeathModal=no;var po={};Object.defineProperty(po,"__esModule",{value:!0});var mo=(No=void 0,$o=po.genericController=No,po.surroundController=$o);po.onlyIfTypeAdjacentController=mo;var yo={};Object.defineProperty(yo,"__esModule",{value:!0});var vo=(Eo=void 0,Mo=yo.updateSeen=Eo,Do=yo.staggered=Mo,Po=yo.bestMoveTowardsPlayer=Do,jo=yo.bestMoveOrAttackPlayer=Po,Oo=yo.getMoveAway=jo,Ro=yo.conditionalApproach=Oo,Io=yo.getRandomOpen=Ro,Bo=yo.addAttackParticle=Io,yo.getDistance=Bo);yo.getAdjacentToPlayer=vo;var wo={};Object.defineProperty(wo,"__esModule",{value:!0});var bo=void 0;wo.AttackingParticle=bo;bo={mode:Fa.ParticleModes.DRAW_OVER_LAST,char:null,fg:"rgba(255, 180, 180, 1.0)",bg:null,animate:async e=>{const t=e.options||"rgba(100, 100, 100, 1.0)";for(;;)await(0,Fa.awaitAnimate)({driver:e.driver,from:t,to:"rgba(255, 180, 180, 1.0)",duration:1e3,onUpdate:t=>{e.fg=t}}),await(0,Fa.awaitAnimate)({driver:e.driver,from:"rgba(255, 180, 180, 1.0)",to:t,duration:1e3,onUpdate:t=>{e.fg=t}})}},wo.AttackingParticle=bo;var _o={};Object.defineProperty(_o,"__esModule",{value:!0});var xo=(To=void 0,_o.moveIn=To);_o.moveOut=xo;var To=(e,t)=>{const a=yt.gameData.current.tiles[t.x+t.y*yt.gameData.current.width];switch((0,Xt.getDirectionTowards)(t,e)){case Xt.Directions.Left:return(0,ma.adjInCheck)(a.adj.left);case Xt.Directions.Up:return(0,ma.adjInCheck)(a.adj.up);case Xt.Directions.Right:return(0,ma.adjInCheck)(a.adj.right);case Xt.Directions.Down:return(0,ma.adjInCheck)(a.adj.down)}};_o.moveIn=To;xo=(e,t)=>{const a=yt.gameData.current.tiles[t.x+t.y*yt.gameData.current.width];switch((0,Xt.getDirectionTowards)(t,e)){case Xt.Directions.Left:return(0,ma.adjOutCheck)(a.adj.left);case Xt.Directions.Up:return(0,ma.adjOutCheck)(a.adj.up);case Xt.Directions.Right:return(0,ma.adjOutCheck)(a.adj.right);case Xt.Directions.Down:return(0,ma.adjOutCheck)(a.adj.down)}},_o.moveOut=xo;var Eo=e=>{const t=yt.gameData.fov.get(e.x+e.y*yt.gameData.current.width);return t?e.seenPlayer=10:e.seenPlayer&&(e.seenPlayer-=1),t};yo.updateSeen=Eo;var Mo=e=>{if(e.status.staggered)return e.addParticle(Na.ParticleManager.makeUntilEndOfTurn(eo.StaggeredParticle,e.x,e.y,e.breed.fg)),(0,la.createAction)(xi.wait,e,null)};yo.staggered=Mo;const Ao=e=>{var t;const a=null===(t=yt.gameData.dMapPlayer)||void 0===t?void 0:t.getSortedAdjacent(e,_o.moveOut);if(a)for(let e=0;e<a.length;e++){const t=a[e],r=(0,yt.findActorForPosition)(t.x,t.y);if(!r||r===yt.gameData.player)return[t,r]}return[]};var Do=Ao;yo.bestMoveTowardsPlayer=Do;const ko=e=>{const[t,a]=Ao(e);if(t)if(a===yt.gameData.player){if((0,yi.getActiveAttack)(e).stamina<=e.stamina.current)return Co(e),(0,la.createAction)(ga.attackTo,e,{target:t})}else if(!a)return(0,la.createAction)(xi.moveTo,e,{target:t})};var Po=ko;yo.bestMoveOrAttackPlayer=Po;const So=e=>{var t;const a=null===(t=yt.gameData.dMapPlayer)||void 0===t?void 0:t.getSortedAdjacent({x:e.x,y:e.y},_o.moveOut);if(a)for(let t=a.length-1;0<=t;t--){const r=a[t];if(!(0,yt.findActorForPosition)(r.x,r.y))return(0,la.createAction)(xi.moveTo,e,{target:r})}};var jo=So;yo.getMoveAway=jo;var Oo=(e,t,a)=>{let r;const n=Lo(e);if(n&&n<=t)if(a){if(r=ko(e),r)return r}else{if(1===n){if((0,yi.getActiveAttack)(e).stamina<=e.stamina.current)return Co(e),(0,la.createAction)(ga.attackTo,e,{target:{x:yt.gameData.player.x,y:yt.gameData.player.y}})}if(r=So(e),r)return r}else if(r=ko(e),r)return r};yo.conditionalApproach=Oo;var Ro=(e,t)=>{const a={},r={};for(const e of(0,Xt.genAllDirections)(t))if((0,_o.moveOut)(e,t)&&!(0,yt.findActorForPosition)(e.x,e.y)){var n;const t=null===(n=yt.gameData.dMapPlayer)||void 0===n?void 0:n.get(e);t&&(a[0]=e,r[0]=t)}const i=e.getWeightedValue(r);if(i)return a[i]};yo.getRandomOpen=Ro;const Co=e=>{e.addParticle(Na.ParticleManager.makeUntilStartOfTurn(wo.AttackingParticle,e.x,e.y,e.breed.fg))};var Io=Co;yo.addAttackParticle=Io;const Lo=e=>{var t;return null===(t=yt.gameData.dMapPlayer)||void 0===t?void 0:t.get(e)};var Bo=Lo;yo.getDistance=Bo;vo=e=>yt.gameData.actors.filter(t=>t!==e&&t!==yt.gameData.player&&Math.max(Math.pow(t.x-yt.gameData.player.x,2),Math.pow(t.y-yt.gameData.player.y,2))<=1),yo.getAdjacentToPlayer=vo;var No=e=>{const t=(0,yo.updateSeen)(e);let a=(0,yo.staggered)(e);return a||((t||e.seenPlayer)&&(a=(0,yo.bestMoveOrAttackPlayer)(e),a)?a:(0,la.createAction)(xi.wait,e,null))};po.genericController=No;var $o=e=>{const t=(0,yo.updateSeen)(e);let a=(0,yo.staggered)(e);if(a)return a;if(t||e.seenPlayer){const t=(0,yo.getAdjacentToPlayer)(e);if(a=(0,yo.conditionalApproach)(e,3,0<t.length),a)return a}return(0,la.createAction)(xi.wait,e,null)};po.surroundController=$o;mo=e=>{const t=(0,yo.updateSeen)(e);let a=(0,yo.staggered)(e);if(a)return a;if(t||e.seenPlayer){const t=(0,yo.getAdjacentToPlayer)(e);if(a=(0,yo.conditionalApproach)(e,2,0<t.length&&null!=t.find(t=>t.breed===e.controllerProps.aggressor)),a)return a}return(0,la.createAction)(xi.wait,e,null)},po.onlyIfTypeAdjacentController=mo;var Fo={};Object.defineProperty(Fo,"__esModule",{value:!0});var Wo=(Go=void 0,Ho=Fo.XPThresholds=Go,zo=Fo.isMaxLevel=Ho,Ko=Fo.hasLevelUp=zo,Xo=Fo.getXPProgress=Ko,Fo.canXPOnFloor=Xo);Fo.XPForDepth=Wo;const Uo=[2,4,6,8,10,12,15,18,22,26,30,40,50,60,80,100,130,160,190,200,240];var Go=Uo;Fo.XPThresholds=Go;const Yo=[10,40,80,160,240];var Ho=e=>Uo.length-1<=e;Fo.isMaxLevel=Ho;var zo=(e,t)=>Uo[e-1]<=t;Fo.hasLevelUp=zo;var Ko=(e,t)=>`${t}/${Uo[e-1]}`;Fo.getXPProgress=Ko;var Xo=(e,t)=>e<(Yo[t-1]||0);Fo.canXPOnFloor=Xo;Wo=(e,t)=>e+Math.floor(.5*(t-1)*e),Fo.XPForDepth=Wo;const Vo={health:e=>{(0,di.diedMsg)(e),e.end(),yt.gameData.actors.remove(e.id),(0,Fo.canXPOnFloor)(yt.gameData.xp,yt.gameData.current.depth)?(yt.gameData.xp+=(0,Fo.XPForDepth)(e.level||0,yt.gameData.current.depth),(0,Fo.hasLevelUp)(yt.gameData.player.level,yt.gameData.xp)?(0,Qe.log)(`%c{${ao.default.RED_4}}Level Up%c{} Press %c{${ao.default.RED_4}}x%c{} to level.`):(0,Qe.log)(`%c{${ao.default.B_GREY_4}}You gain %c{${ao.default.RED_4}}${e.level}%c{${ao.default.B_GREY_4}}xp for the victory`)):(0,Qe.log)("You feel nothing, delve deeper for more XP.")},poise:e=>{e.alive&&((0,di.staggeredMsg)(e),e.status.staggeredCount=0,e.status.staggered=!0)}},qo={player:{displayPriority:100,glyph:{fg:ao.default.B_GREY_5,bg:"transparent",ch:"@"},baseStats:{level:1,health:100,stamina:100,poise:10,force:1,strength:1,weight:20},triggers:{health:e=>{(0,di.diedMsg)(e),e.end(),(0,st.openModal)((0,o.createElement)(ro.DeathModal,{x:0,y:0,w:32,h:16},{}))},poise:e=>{(0,di.staggeredMsg)(e),e.addParticle(Na.ParticleManager.makeUntilStartOfTurn(eo.StaggeredParticle,e.x,e.y,e.breed.fg)),e.status.staggeredCount=0,e.status.staggered=!0}},text:{name:"A Pilgrim (You)",description:"You've journeyed far to get here. But why have you come?",logName:"You"},wielding:{left:"spade",right:"bLid",mode:Pn.WieldMode.oneHanded},wearing:{armor:"tunic"},contains:[["flask",1]]},faithless:{displayPriority:100,glyph:{fg:ao.default.B_GREY_4,bg:"transparent",ch:"F"},text:{name:"Faithless",description:"Those left empty without a cause to live for. They keep to the shadows, but are quick to strike when the chance arises.",logName:"Faithless"},baseStats:{level:1,health:30,stamina:100,poise:15},baseAttack:{stamina:50,poise:10,damage:16},triggers:Vo,actionController:po.surroundController},heretic:{displayPriority:100,glyph:{fg:ao.default.B_GREY_4,bg:"transparent",ch:"H"},text:{name:"Heretic",description:"Outcast long ago heretics seek only vengence from those that wronged them.",logName:"Heretic"},baseStats:{level:2,health:45,stamina:100,poise:20},baseAttack:{stamina:50,poise:14,damage:18},triggers:Vo,actionController:po.genericController},defiler:{displayPriority:100,glyph:{fg:ao.default.B_GREY_4,bg:"transparent",ch:"D"},text:{name:"Defiler",description:"They have betrayed their cause for their own ends. Carved out a piece of their soul for some coin in their purse.",logName:"Defiler"},baseStats:{level:4,health:60,stamina:100,poise:40},baseAttack:{stamina:30,poise:20,damage:20},triggers:Vo,actionController:po.surroundController},apostate:{displayPriority:100,glyph:{fg:ao.default.B_GREY_4,bg:"transparent",ch:"A"},text:{name:"Apostate",description:"They've turned their back on their cause in exchange for great power.",logName:"Apostate"},baseStats:{level:4,health:80,stamina:100,poise:40},baseAttack:{stamina:30,poise:15,damage:25},triggers:Vo,actionController:po.genericController},cultist:{displayPriority:100,glyph:{fg:ao.default.B_GREY_4,bg:"transparent",ch:"c"},text:{name:"Cultist",description:"A true believer of a false cause. Unwilling to act alone, but quick to defend their leaders.",logName:"Cultist"},baseStats:{level:2,health:40,stamina:100,poise:30},baseAttack:{stamina:60,poise:5,damage:30},triggers:Vo,actionController:po.surroundController},falseProphet:{displayPriority:100,glyph:{fg:ao.default.B_GREY_4,bg:"transparent",ch:"P"},text:{name:"False Prophet",description:"There are many ignobile causes in the world and each has their prophet.",logName:"False Prophet"},baseStats:{level:1,health:80,stamina:100,poise:50},baseAttack:{stamina:40,poise:15,damage:25},triggers:Vo,actionController:po.surroundController}};Ji=Object.entries(qo).reduce((e,[t,a])=>(e[t]=new Pn.ActorBreed(t,a),e),{}),Qi.BreedTypes=Ji;var Zo=function(e){return e&&e.__esModule?e:{default:e}}(Pi),Qo={};Object.defineProperty(Qo,"__esModule",{value:!0});var Jo=(es=void 0,as=Qo.fillEdges=es,rs=Qo.setAreaZLevel=as,ns=Qo.raiseAndDivideArea=rs,ds=Qo.makeRect=ns,us=Qo.carveShared=ds,cs=Qo.makeDoor=us,hs=Qo.carveZDifference=cs,Qo.makeSubsetLedge=hs);Qo.makeZRamp=Jo;var es=e=>{const t=(e.height-1)*e.width,a=(e.height-2)*e.width,r=e.width-1,n=e.width-2;for(let r=0;r<e.width;r++)e.tiles[r].adj.up=va.AdjTypes.WALL,e.tiles[r+a].adj.down=va.AdjTypes.WALL,e.tiles[r+t].adj.up=va.AdjTypes.WALL,e.tiles[r+t].type=va.FloorTypes.OOB;for(let t=0;t<e.height;t++)e.tiles[t*e.width].adj.left=va.AdjTypes.WALL,e.tiles[n+t*e.width].adj.right=va.AdjTypes.WALL,e.tiles[r+t*e.width].adj.left=va.AdjTypes.WALL,e.tiles[r+t*e.width].type=va.FloorTypes.OOB};Qo.fillEdges=es;const ts=(e,t,a)=>{for(let r=t.y;r<t.h+t.y;r++)for(let n=t.x;n<t.w+t.x;n++)e.tiles[n+r*e.width].z=a};var as=ts;Qo.setAreaZLevel=as;var rs=(e,t,a)=>{const r=t.h+t.y-1;for(let n=t.y;n<t.h+t.y;n++){e.tiles[n*e.width+t.x].adj.left=va.AdjTypes.ONE_OUT,e.tiles[n*e.width+t.x-1].adj.right=va.AdjTypes.ONE_IN,e.tiles[n*e.width+t.x+t.w-1].adj.right=va.AdjTypes.WALL,e.tiles[n*e.width+t.x+t.w].adj.left=va.AdjTypes.WALL;for(let i=t.x;i<t.w+t.x;i++)e.tiles[i+n*e.width].z=a,n===t.y&&(e.tiles[i+n*e.width].adj.up=va.AdjTypes.ONE_OUT,e.tiles[i+(n-1)*e.width].adj.down=va.AdjTypes.ONE_IN),n===r&&(e.tiles[i+n*e.width].adj.down=va.AdjTypes.WALL,e.tiles[i+(n+1)*e.width].adj.up=va.AdjTypes.WALL)}};Qo.raiseAndDivideArea=rs;var ns=(e,t,a)=>{const r=t.h+t.y-1;for(let n=t.y;n<t.h+t.y;n++){e.tiles[n*e.width+t.x].adj.left=va.AdjTypes.WALL,0<t.x&&(e.tiles[n*e.width+t.x-1].adj.right=va.AdjTypes.WALL),e.tiles[n*e.width+t.x+t.w-1].adj.right=va.AdjTypes.WALL,e.tiles[n*e.width+t.x+t.w].adj.left=va.AdjTypes.WALL;for(let i=t.x;i<t.w+t.x;i++)e.tiles[n*e.width+i].type=va.FloorTypes.EMPTY,e.tiles[n*e.width+i].z=a,n===t.y&&(e.tiles[i+n*e.width].adj.up=va.AdjTypes.WALL,0<n&&(e.tiles[i+(n-1)*e.width].adj.down=va.AdjTypes.WALL)),n===r&&(e.tiles[i+n*e.width].adj.down=va.AdjTypes.WALL,e.tiles[i+(n+1)*e.width].adj.up=va.AdjTypes.WALL)}};Qo.makeRect=ns;const is=(e,t,a)=>{const r=Math.max(t.x,a.x),n=Math.min(t.x+t.w,a.x+a.w);return n-r<3?e.getUniformInt(r,n):e.getUniformInt(r+1,n-1)},os=(e,t,a)=>{const r=Math.max(t.y,a.y),n=Math.min(t.y+t.h,a.y+a.h);return n-r<3?e.getUniformInt(r,n):e.getUniformInt(r+1,n-1)},ss=(e,t,a)=>{let r=Math.max(e.y,t.y);const n=Math.min(e.y+e.h,t.y+t.h);for(;r<n;r++)a(r)},ls=(e,t,a)=>{let r=Math.max(e.x,t.x);const n=Math.min(e.x+e.w,t.x+t.w);for(;r<n;r++)a(r)};var ds=(e,t,a)=>{t.x===a.x+a.w?ss(t,a,a=>{e.tiles[t.x+a*e.width].adj.left=va.AdjTypes.OPEN,e.tiles[t.x-1+a*e.width].adj.right=va.AdjTypes.OPEN}):t.x+t.w===a.x?ss(t,a,t=>{e.tiles[a.x+t*e.width].adj.right=va.AdjTypes.OPEN,e.tiles[a.x-1+t*e.width].adj.left=va.AdjTypes.OPEN}):t.y===a.y+a.h?ls(t,a,a=>{e.tiles[a+t.y*e.width].adj.up=va.AdjTypes.OPEN,e.tiles[a+(t.y-1)*e.width].adj.down=va.AdjTypes.OPEN}):t.y+t.h===a.y&&ls(t,a,t=>{e.tiles[t+a.y*e.width].adj.up=va.AdjTypes.OPEN,e.tiles[t+(a.y-1)*e.width].adj.down=va.AdjTypes.OPEN})};Qo.carveShared=ds;var us=(e,t,a,r)=>{if(a.x===r.x+r.w){const n=a.x,i=os(e,a,r);t.tiles[n+i*t.width].adj.left=va.AdjTypes.OPEN,t.tiles[n-1+i*t.width].adj.right=va.AdjTypes.OPEN}else if(a.x+a.w===r.x){const n=r.x,i=os(e,a,r);t.tiles[n+i*t.width].adj.right=va.AdjTypes.OPEN,t.tiles[n-1+i*t.width].adj.left=va.AdjTypes.OPEN}else if(a.y===r.y+r.h){const n=is(e,a,r),i=a.y;t.tiles[n+i*t.width].adj.up=va.AdjTypes.OPEN,t.tiles[n+(i-1)*t.width].adj.down=va.AdjTypes.OPEN}else if(a.y+a.h===r.y){const n=is(e,a,r),i=r.y;t.tiles[n+i*t.width].adj.up=va.AdjTypes.OPEN,t.tiles[n+(i-1)*t.width].adj.down=va.AdjTypes.OPEN}};Qo.makeDoor=us;var cs=(e,t,a,r)=>{t.x===a.x+a.w?ss(t,a,a=>{e.tiles[t.x+a*e.width].adj.left=r?va.AdjTypes.ONE_OUT:va.AdjTypes.ONE_IN,e.tiles[t.x-1+a*e.width].adj.right=r?va.AdjTypes.ONE_IN:va.AdjTypes.ONE_OUT}):t.x+t.w===a.x?ss(t,a,t=>{e.tiles[a.x+t*e.width].adj.right=r?va.AdjTypes.ONE_IN:va.AdjTypes.ONE_OUT,e.tiles[a.x-1+t*e.width].adj.left=r?va.AdjTypes.ONE_OUT:va.AdjTypes.ONE_IN}):t.y===a.y+a.h?ls(t,a,a=>{e.tiles[a+t.y*e.width].adj.up=r?va.AdjTypes.ONE_OUT:va.AdjTypes.ONE_IN,e.tiles[a+(t.y-1)*e.width].adj.down=r?va.AdjTypes.ONE_IN:va.AdjTypes.ONE_OUT}):t.y+t.h===a.y&&ls(t,a,t=>{e.tiles[t+a.y*e.width].adj.up=r?va.AdjTypes.ONE_IN:va.AdjTypes.ONE_OUT,e.tiles[t+(a.y-1)*e.width].adj.down=r?va.AdjTypes.ONE_OUT:va.AdjTypes.ONE_IN})};Qo.carveZDifference=cs;var hs=(e,t,a,r=2)=>{const n=e.getUniformInt(r,a.w-1),i=e.getUniformInt(r,a.h-1),o=e.getUniformInt(0,a.w-n)+a.x,s=e.getUniformInt(0,a.h-i)+a.y;ts(t,{x:o,y:s,w:n,h:i},2)};Qo.makeSubsetLedge=hs;Jo=(e,t,a,r)=>{t.x===a.x+a.w?ss(t,a,a=>{e.tiles[t.x+a*e.width].adj.left=r?va.AdjTypes.Z_OUT:va.AdjTypes.Z_IN,e.tiles[t.x-1+a*e.width].adj.right=r?va.AdjTypes.Z_IN:va.AdjTypes.Z_OUT}):t.x+t.w===a.x?ss(t,a,t=>{e.tiles[a.x+t*e.width].adj.left=r?va.AdjTypes.Z_IN:va.AdjTypes.Z_OUT,e.tiles[a.x-1+t*e.width].adj.right=r?va.AdjTypes.Z_OUT:va.AdjTypes.Z_IN}):t.y===a.y+a.h?ls(t,a,a=>{e.tiles[a+t.y*e.width].adj.up=r?va.AdjTypes.Z_OUT:va.AdjTypes.Z_IN,e.tiles[a+(t.y-1)*e.width].adj.down=r?va.AdjTypes.Z_IN:va.AdjTypes.Z_OUT}):t.y+t.h===a.y&&ls(t,a,t=>{e.tiles[t+a.y*e.width].adj.up=r?va.AdjTypes.Z_IN:va.AdjTypes.Z_OUT,e.tiles[t+(a.y-1)*e.width].adj.down=r?va.AdjTypes.Z_OUT:va.AdjTypes.Z_IN})},Qo.makeZRamp=Jo;var fs={};Object.defineProperty(fs,"__esModule",{value:!0});var gs=void 0;fs.BSPGenerate=gs;var ps={};Object.defineProperty(ps,"__esModule",{value:!0});var ms=function(e,t){const a=[],r=[],n=new ws.default(e=>e[2].weight,e.size),i=new Map;a[t]=!0;const o=e.get(t);if(o){i.set(t,{bounds:o.bounds,weight:1,adj:[],z:1}),o.adj.forEach(a=>{const i=e.get(a);i&&(n.push([t,a,i]),r[a]=i.weight)});let s,l,d,u=1;for(;u<=e.size&&n.size();)if([s,l,d]=n.pop(),!a[l]){const t=i.get(s);t?t.adj.push(l):console.warn("mst: from node not found"),i.set(l,{weight:d.weight,bounds:d.bounds,adj:[s],z:1}),a[l]=!0,u+=1,d.adj.forEach(t=>{if(!a[t]||r[t]&&r[t]<t){const a=e.get(t);a&&(n.push([l,t,a]),r[l]=a.weight)}})}}return i};ps.default=ms;var ys={};Object.defineProperty(ys,"__esModule",{value:!0});var vs=void 0;ys.default=vs;vs=class{constructor(e,t=20){this.tree=[],this.comparator=e}push(e){this.tree.push(e),this.bubbleUp(this.tree.length-1)}pushAll(e){e.forEach(e=>this.push(e))}pop(){const e=this.tree[0],t=this.tree.pop();return void 0!==t&&this.tree.length>0&&(this.tree[0]=t,this.sinkDown(0)),e}size(){return this.tree.length}bubbleUp(e){const t=this.tree[e],a=this.comparator(t);let r,n;for(;e>0&&(n=Math.floor((e+1)/2)-1,r=this.tree[n],!(a>=this.comparator(r)));)this.tree[e]=r,this.tree[n]=t,e=n}sinkDown(e){const t=this.tree.length,a=this.tree[e],r=this.comparator(a);let n,i,o,s,l,d;for(;l=2*(e+1),i=l-1,t>i&&(n=this.tree[i],o=this.comparator(n),t>l&&(s=this.tree[l],d=this.comparator(s),d<o&&(n=s,o=d,i=l)),o<r);)this.tree[e]=n,this.tree[i]=a,e=i}},ys.default=vs;var ws=function(e){return e&&e.__esModule?e:{default:e}}(ys);var bs=function(e){return e&&e.__esModule?e:{default:e}}(ps);gs=(e,t,a)=>{const r=Ts(e,_s(e,8,t,a)),n=(0,bs.default)(r,0);return Ds(n),Ms(e,.45,r,n),As(e,1,n),n},fs.BSPGenerate=gs;const _s=(e,t,a,r)=>{const n=[],i=[[{x:0,y:0,w:a,h:r},0]];let o,s,l,d,u;for(;o=i.pop();)[s,l]=o,l<=t&&(8<=s.w||8<=s.h)?([d,u]=xs(e,s),i.push([d,l+1],[u,l+1])):n.push(s);return n},xs=(e,t)=>{let a,r;if(8<=t.w&&.45<t.w/t.h){const n=Math.floor(.45*t.w),i=Math.ceil(.55*t.w);a={x:t.x,y:t.y,w:e.getUniformInt(n,i),h:t.h},r={x:t.x+a.w,y:t.y,w:t.w-a.w,h:t.h}}else{const n=Math.floor(.45*t.h),i=Math.ceil(.55*t.h);a={x:t.x,y:t.y,w:t.w,h:e.getUniformInt(n,i)},r={x:t.x,y:t.y+a.h,w:t.w,h:t.h-a.h}}return[a,r]},Ts=(e,t)=>{const a=new Map;let r,n,i,o;for(let d=0;d<t.length;d++){r=t[d],i=a.get(d)||a.set(d,{bounds:r,adj:[],weight:e.getUniform(),z:1}).get(d);for(let u=d+1;u<t.length;u++){var s,l;if(n=t[u],Es(r,n))o=a.get(u)||a.set(u,{bounds:n,adj:[],weight:e.getUniform(),z:1}).get(u),null===(s=i)||void 0===s||s.adj.push(u),null===(l=o)||void 0===l||l.adj.push(d)}}return a},Es=(e,t)=>{const a=e.x<=t.x+t.w&&t.x<=e.x+e.w,r=e.y<=t.y+t.h&&t.y<=e.y+e.h,n=e.x<t.x+t.w&&t.x<e.x+e.w,i=e.y<t.y+t.h&&t.y<e.y+e.h;return a&&i||r&&n},Ms=(e,t,a,r)=>{const n=Math.floor(r.size*t);for(let t=0;t<=n;t++)for(let t=0;t<=100;t++){const t=e.getUniformInt(0,r.size-1),n=r.get(t);if(n){const i=a.get(t);if(i){if(n.adj.length<i.adj.length){const a=i.adj.filter(e=>!n.adj.includes(e)),o=e.getItem(a);if(null!=o){const e=r.get(o);null==e||e.adj.push(t),n.adj.push(o);break}}}else console.log("no full room found")}}},As=(e,t,a)=>{const r=[];let n,i,o,s;for([i,n]of a.entries())1===n.adj.length&&r.push([i,n,0]);for(;s=r.pop();){[i,n,o]=s,a.delete(i);const e=a.get(n.adj[0]);e&&(e.adj=e.adj.filter(e=>e!==i),1===e.adj.length&&o<=t&&r.push([n.adj[0],e,o+1]))}},Ds=e=>{let t,a;for([a,t]of e.entries())1===t.adj.length&&(t.z=2)};var ks={};Object.defineProperty(ks,"__esModule",{value:!0});var Ps=void 0;ks.placeMonsters=Ps;var Ss={};Object.defineProperty(Ss,"__esModule",{value:!0}),Object.defineProperty(Ss,"shuffle",{enumerable:!0,get:function(){return js.shuffle}}),Object.defineProperty(Ss,"removeShuffled",{enumerable:!0,get:function(){return js.removeShuffled}}),Object.defineProperty(Ss,"shuffleGenerator",{enumerable:!0,get:function(){return js.shuffleGenerator}});var js={};Object.defineProperty(js,"__esModule",{value:!0});var Os=function(e){if(!e.length)return e;let t,a,r=e.length;for(;--r;)t=Math.floor(Math.random()*(r+1)),a=e[r],e[r]=e[t],e[t]=a;return e};js.shuffle=Os;var Rs=function(e){let t,a;if(e.length){if(a=Math.random()*e.length<<0,a===e.length-1)return e.pop();const r=e.pop();return t=e[a],e[a]=r,t}};js.removeShuffled=Rs;var Cs=function*(e){if(!e.length)return;let t,a,r=e.length;for(;--r;)t=Math.floor(Math.random()*(r+1)),t>=e.length&&console.log("hit it!"),a=e[t],e[t]=e[r],e[r]=a,yield a;return};js.shuffleGenerator=Cs;var Is=function(e){return e&&e.__esModule?e:{default:e}}(Pi),Ls={};Object.defineProperty(Ls,"__esModule",{value:!0});var Bs=void 0;Ls.getRandomInBounds=Bs;Bs=(e,t)=>({x:e.getUniformInt(t.x+1,t.x+t.w-2),y:e.getUniformInt(t.y+1,t.y+t.h-2)}),Ls.getRandomInBounds=Bs;const Ns={none:{cost:0,monsters:[],iChance:.15},faithlessBasic:{cost:1,monsters:[{min:1,max:2,breed:Qi.BreedTypes.faithless}],iChance:.75},faithlessDense:{cost:1,monsters:[{min:2,max:3,breed:Qi.BreedTypes.faithless}],iChance:1},faithlessHeretic:{cost:2,monsters:[{min:2,max:2,breed:Qi.BreedTypes.heretic},{min:1,max:1,breed:Qi.BreedTypes.faithless}],iChance:1},simpleHeretic:{cost:2,monsters:[{min:1,max:2,breed:Qi.BreedTypes.heretic}],iChance:.25},defilerSimple:{cost:4,monsters:[{min:1,max:1,breed:Qi.BreedTypes.defiler}],iChance:.5},defilerDense:{cost:4,monsters:[{min:2,max:2,breed:Qi.BreedTypes.defiler}],iChance:.5},apostateSimple:{cost:4,monsters:[{min:1,max:1,breed:Qi.BreedTypes.apostate}],iChance:.75},apostateDefiler:{cost:4,monsters:[{min:1,max:1,breed:Qi.BreedTypes.defiler},{min:1,max:1,breed:Qi.BreedTypes.apostate}],iChance:.75},apostateDense:{cost:4,monsters:[{min:2,max:2,breed:Qi.BreedTypes.apostate}],iChance:.75},simpleProphet:{cost:4,monsters:[{min:1,max:1,breed:Qi.BreedTypes.falseProphet},{min:2,max:5,breed:Qi.BreedTypes.cultist}],iChance:1}},$s=[{none:26,faithlessBasic:20,faithlessDense:5},{none:40,faithlessDense:5,hereticSimple:10,faithlessHeretic:20,defilerSimple:5},{none:40,faithlessHeretic:20,defilerSimple:20,defilerDense:2,apostateSimple:5},{none:40,faithlessHeretic:15,defilerSimple:10,defilerDense:5,apostateDefiler:5,apostateDense:5,simpleProphet:5},{none:18,simpleProphet:25,defilerDense:3,apostateDefiler:3,apostateDense:3}];Ps=(e,t,a,r)=>{let n=0;const i={};let o,s,l=[];for([o,s]of t.lootTable.entries())for(let e=0;e<s;e++)l.push(o);l=(0,Ss.shuffle)(l),console.log($s[t.depth-1]);for(const o of a.values()){if(!o||o.bounds===r)continue;const a=e.getWeightedValue($s[t.depth-1]||$s[$s.length-1]);if(a){const r=Ns[a];if(r&&(n+=r.cost,r.monsters.forEach(a=>{const r=e.getUniformInt(a.min,a.max);for(let n=0;n<r;n++)for(let r=0;r<100;r++){const r=(0,Ls.getRandomInBounds)(e,o.bounds);if(!i[r.x+r.y*t.width]){i[r.x+r.y*t.width]=!0,Is.default.createActor(a.breed,r.x,r.y);break}}}),l.length&&e.getUniform()<=r.iChance)){const t=(0,Ls.getRandomInBounds)(e,o.bounds);Is.default.createItem(Ni.ItemTypes[l.pop()],t.x,t.y)}}}},ks.placeMonsters=Ps;var Fs={};Object.defineProperty(Fs,"__esModule",{value:!0});var Ws=void 0;Fs.placeShrines=Ws;var Us=function(e){return e&&e.__esModule?e:{default:e}}(Pi);Ws=(e,t,a)=>{let r,n=null,i=null;for(;!n||!i;){const o=e.getUniformInt(5,t.height-5),s=o<t.height/2?e.getUniformInt(Math.floor(t.height/2),t.height-5):e.getUniformInt(5,Math.floor(t.height/2));for(r of a.values())r.bounds.y<=o&&o<=r.bounds.y+r.bounds.h&&(!n||r.bounds.x<=n.x)&&(n=r.bounds),r.bounds.y<=s&&s<=r.bounds.y+r.bounds.h&&(!i||i.x<=r.bounds.x)&&(i=r.bounds)}const o=(0,Ls.getRandomInBounds)(e,n),s=(0,Ls.getRandomInBounds)(e,i);return e.getUniformInt(0,1)?(Us.default.createItem(Ni.ItemTypes.oldFont,o.x,o.y),Us.default.createItem(Ni.ItemTypes.newFont,s.x,s.y),[o,n]):(Us.default.createItem(Ni.ItemTypes.newFont,o.x,o.y),Us.default.createItem(Ni.ItemTypes.oldFont,s.x,s.y),[s,i])},Fs.placeShrines=Ws;Zi=(e,t,a)=>{const r=(0,fs.BSPGenerate)(e,t.width-1,t.height-1);let n,i;for(n of(t.generate(e),r.values()))(0,Qo.makeRect)(t,n.bounds,n.z);for([i,n]of r.entries())n.adj.forEach(a=>{if(i<a){const i=r.get(a);i&&(n.z!==i.z?(0,Qo.carveZDifference)(t,n.bounds,i.bounds,i.z<n.z):e.getUniformInt(0,1)?(0,Qo.carveShared)(t,n.bounds,i.bounds):(0,Qo.makeDoor)(e,t,n.bounds,i.bounds))}});Gs(e,t,r);const[o,s]=(0,Fs.placeShrines)(e,t,r);a?(a.x=o.x,a.y=o.y):yt.gameData.player=Zo.default.createActor(Qi.BreedTypes.player,o.x,o.y),(0,ks.placeMonsters)(e,t,r,s)},qi.generateMap=Zi;const Gs=(e,t,a)=>{const r=a.keys().next().value,n=[],i=[],o=[r];let s,l;for(n[r]=!0;0<o.length;)if(l=o.pop(),!i[l])if(s=a.get(l),s)if(1<s.z){const r=[];let d,u,c;const h=[[l,null]];for(;0<h.length;)[d,u]=h.pop(),c=a.get(d),c&&(s.z===c.z?(i[d]=!0,n[d]=!0,c.adj.forEach(e=>{i[e]||h.push([e,d])})):(i[d]||n[d]||(n[d]=!0,o.push(d)),u&&r.push([d,u])));const f=r.length?e.getItem(r):[e.getItem(s.adj),l];if(f){const e=a.get(f[0]),r=a.get(f[1]);e&&r&&(0,Qo.makeZRamp)(t,e.bounds,r.bounds,!1)}else console.warn("No target connection found")}else s.adj.forEach(e=>{i[e]||n[e]||(n[e]=!0,o.push(e))});else console.warn("Room not found for z-diff")};var Ys={};Object.defineProperty(Ys,"__esModule",{value:!0});var Hs=void 0;Ys.ShrineMap=Hs;var zs={};Object.defineProperty(zs,"__esModule",{value:!0});var Ks=void 0;zs.generateLootTable=Ks;const Xs=[10,20,20,20,20],Vs=[{shears:10,knife:5,spade:5,mallet:10,staff:10,pitchfork:10,scythe:1,frock:20,bCoat:20,gambeson:10,curiass:1,buckler:10,barricade:1},{shears:5,spade:1,knife:10,cleaver:5,mallet:5,needle:5,flail:5,staff:5,pitchfork:5,scythe:5,sledgehammer:1,frock:10,bCoat:10,gambeson:20,curiass:10,bouilli:2,buckler:10,barricade:5},{shears:1,knife:1,cleaver:10,mallet:1,needle:10,flail:10,staff:1,pitchfork:1,scythe:5,sledgehammer:10,frock:2,bCoat:2,gambeson:2,curiass:20,bouilli:20,buckler:2,barricade:20},{shears:1,knife:1,cleaver:10,mallet:1,needle:10,flail:10,staff:1,pitchfork:1,scythe:5,sledgehammer:10,frock:2,bCoat:2,gambeson:10,curiass:20,bouilli:20,buckler:5,barricade:10},{shears:1,knife:1,cleaver:10,mallet:1,needle:10,flail:10,staff:1,pitchfork:1,scythe:5,sledgehammer:10,frock:2,bCoat:2,gambeson:10,curiass:20,bouilli:20,buckler:5,barricade:10}];Ks=(e,t)=>{for(let a=0;a<Xs[t.depth-1];a++){const a=e.getWeightedValue(Vs[0]);if(a){const e=t.lootTable.get(a);t.lootTable.set(a,(e||0)+1)}}},zs.generateLootTable=Ks;class qs extends ba.LevelMap{lootTable=new Map;hasGenerated=!1;constructor(e,t,a,r=1){super(va.drawTile,e,t),this.rng=a,this.depth=r}generate(e){this.hasGenerated||(0,zs.generateLootTable)(e,this),this.hasGenerated=!0,this.fillAll(()=>new ba.WorldTile(va.FloorTypes.OOB,{left:va.AdjTypes.OPEN,up:va.AdjTypes.OPEN,right:va.AdjTypes.OPEN,down:va.AdjTypes.OPEN}))}}Hs=qs,Ys.ShrineMap=Hs;var Zs={};Object.defineProperty(Zs,"__esModule",{value:!0});var Qs=void 0;Zs.VictoryModal=Qs;var Js=function(e){return e&&e.__esModule?e:{default:e}}(h);Qs=(e,t)=>((0,m.floodFill)(e.display,e.bounds,Js.default.BLACK),e.handlers.keypress=e=>"Enter"!==e,[(0,o.createElement)(io.TextType,{x:1,y:0,w:e.bounds.w-2,h:1},{title:"Atonement",align:io.ALIGN_TYPE.center}),(0,o.createElement)(io.TextType,{x:1,y:1,w:e.bounds.w-2,h:e.bounds.h-2},{title:"You have found peace among the ruins. As you make your final rest the world begins to stabilize around you."}),(0,o.createElement)(io.TextType,{x:1,y:8,w:e.bounds.w-2,h:e.bounds.h-2},{title:"Thank you for playing, find me on Twitter @IAmSlogo or in the Roguelike Discord."}),(0,o.createElement)(u.ButtonComp,{x:1,y:e.bounds.h-2,w:e.bounds.w-2,h:1},{title:"(Enter) End Game",keys:["Escape","Enter"],onClick:()=>{(0,st.closeModal)(),(0,be.setScene)(new We.Main)}})]),Zs.VictoryModal=Qs;const el=[0,25,33,33,33,25],tl=async(e,t=!1)=>{e.health.fill(),e.stamina.fill(),e.poise.fill(),e.contains.forEach(e=>{e.uses&&e.breed.usable&&e.breed.usable.fillOnRest&&e.uses.fill()}),e===yt.gameData.player&&(await Na.ParticleManager.runThenDestroy(Ki.FontParticle,e.x,e.y),yt.gameData.items.clear(),yt.gameData.actors.clear(),yt.gameData.gibs.clear(),yt.gameData.particles.clear(),yt.gameData.actors.add(yt.gameData.player.id,yt.gameData.player),t&&(yt.gameData.current=new Ys.ShrineMap(el[yt.gameData.current.depth+1],el[yt.gameData.current.depth+1],yt.gameData.seedRng.getGenerator(),yt.gameData.current.depth+1)),(0,qi.generateMap)(yt.gameData.current.rng.getRNG(),yt.gameData.current,yt.gameData.player))};zi={oldFont:{displayPriority:15,glyph:{fg:Vi.default.RED_4,ch:"_"},text:{name:"A tended shrine",info:"Interact with the shrine to rest, restoring your health and flask.",description:"Among the shifting planes those that came before have built shrines dedicated to their cause. This one has been visited recently.",logName:"font"},furniture:!0,interact:async e=>{await tl(e)}},newFont:{displayPriority:15,glyph:{fg:Vi.default.RED_4,ch:"_"},text:{name:"A neglected shrine",info:"Interact with the shrine to rest and journey onwards.",description:"Among the shifting planes those that came before have built shrines dedicated to their cause. You are the first one to find this shrine in a long time.",logName:"shrine"},furniture:!0,interact:async e=>{5===yt.gameData.current.depth?(0,st.openModal)((0,o.createElement)(Zs.VictoryModal,{x:0,y:0,w:32,h:32})):await tl(e,!0)}}},Hi.furniture=zi;var al={};Object.defineProperty(al,"__esModule",{value:!0});var rl=void 0;al.shields=rl;const nl={displayPriority:10,glyph:{fg:function(e){return e&&e.__esModule?e:{default:e}}(h).default.B_GREY_4,ch:"}"}};rl={bLid:{...nl,text:{name:"Barrel Lid",info:"Blocks stability can leave you staggered if you block too many attacks.",description:"One leather strap poorly latched to the wood is all it takes to make a shield.",logName:"B. Lid"},stats:{weight:2},attacks:{onehanded:{blocks:.65,stability:80,stamina:0,strength:1},twohanded:{blocks:.65,stability:80,stamina:0,strength:1}}},buckler:{...nl,text:{name:"Ornamental Buckler",info:"A modest stability makes for an effective block.",description:"The church has turned a blind eye to these defensive instruments. Perhaps because many feature religious symbolism.",logName:"Buckler"},stats:{weight:6},attacks:{onehanded:{blocks:.8,stability:90,stamina:0,strength:2},twohanded:{blocks:.8,stability:90,stamina:0,strength:1}}},barricade:{...nl,text:{name:"Fortified Barricade",info:"Total defense but heavy as a house.",description:"Unclear if any single person should even be carrying this around alone.",logName:"Barricade"},stats:{weight:14},attacks:{onehanded:{blocks:.5,stability:95,stamina:0,strength:6},twohanded:{blocks:.95,stability:95,stamina:0,strength:3}}}},al.shields=rl;var il={};Object.defineProperty(il,"__esModule",{value:!0});var ol=void 0;il.weapons=ol;const sl={displayPriority:10,glyph:{fg:function(e){return e&&e.__esModule?e:{default:e}}(h).default.B_GREY_4,ch:"%"}};ol={needle:{...sl,text:{name:"Large Steel Sowing Needle",info:"Swift and deadly, but offers no poise damage",description:"The chipping paint was once used to conceal the item's material. Far deadlier than a permitted wooden needle.",logName:"Needle"},stats:{weight:1},attacks:{onehanded:{strength:1,stamina:10,poise:0,damage:18},twohanded:{strength:1,stamina:20,poise:4,damage:18}}},shears:{...sl,text:{name:"Halfshears",info:"A strong slash, but the crude craftsmanship makes it clumsy to wield",description:"One half of a hand shear, rusted over then crudely sharpened. A favorite of brigands who could arm two by splitting the shears.",logName:"Halfshears"},stats:{weight:2},attacks:{onehanded:{strength:2,stamina:30,poise:10,damage:17},twohanded:{strength:1,stamina:20,poise:10,damage:17}}},knife:{...sl,text:{name:"Kitchen knife",info:"Well balanced and serviceable weapon",description:"A long kitchen knife. Blacksmiths supplying these knives undergo strict watch by the church's guards to comply with size limits.",logName:"Knife"},stats:{weight:4},attacks:{onehanded:{strength:3,stamina:25,poise:10,damage:22},twohanded:{strength:1,stamina:25,poise:15,damage:22}}},cleaver:{...sl,text:{name:"Butcher's Cleaver",info:"Hard hitting and versitile, but requires a lot of stamina.",description:'Despite strict licensing ineveitably butcher cleaver\'s go "missing" and wind up in the wrong hands.',logName:"Cleaver"},stats:{weight:5},attacks:{onehanded:{strength:4,stamina:30,poise:20,damage:26},twohanded:{strength:2,stamina:30,poise:20,damage:32}}},spade:{...sl,text:{name:"Digging Spade",info:"A decent punch, but unwieldy and heavy",description:"Garden tools are a common choice for a weapon when one has no other choice.",logName:"Spade"},stats:{weight:7},attacks:{onehanded:{strength:1,stamina:30,poise:15,damage:14},twohanded:{strength:1,stamina:30,poise:20,damage:20}}},mallet:{...sl,text:{name:"Wooden Mallet",info:"A good swing that can stagger enemies easily.",description:"Common among carpenters, these mallets are easy to find and difficult to control the supply of.",logName:"Mallet"},stats:{weight:4},attacks:{onehanded:{strength:2,stamina:25,poise:25,damage:16},twohanded:{strength:1,stamina:25,poise:25,damage:16}}},flail:{...sl,text:{name:"Threshing Flail",info:"A heavy strong blow that can rival metal weapons",description:"Commonly used the thresh wheat, these tools are deadly when swung with a good strong blow",logName:"Flail"},stats:{weight:8},attacks:{onehanded:{strength:4,stamina:40,poise:30,damage:28},twohanded:{strength:2,stamina:40,poise:30,damage:28}}},staff:{...sl,text:{name:"Wooden Staff",info:"Quick to strike and easy to stagger a foe.",description:"Often concealed as a walking stick, when carried it's important to know which guard will give you trouble over its length.",logName:"Staff"},stats:{weight:8},attacks:{onehanded:{strength:6,stamina:25,poise:30,damage:26},twohanded:{strength:3,stamina:25,poise:30,damage:26}}},pitchfork:{...sl,text:{name:"Three Pronged Pitchfork",info:"High stabbing damage, but not as much impact in the strike.",description:"Symbology of the pitchfork is banned after the three pronged rebellion of 712cs, but the tool itself is still permitted for farming.",logName:"Pitchfork"},stats:{weight:10},attacks:{onehanded:{strength:6,stamina:30,poise:15,damage:44},twohanded:{strength:3,stamina:30,poise:15,damage:44}}},scythe:{...sl,text:{name:"Scythe",info:"Deadly and sharp, but requires great effort to swing.",description:"Not as effective as a purpose built polearm, but the blade has been repositioned for ease of use",logName:"Scythe"},stats:{weight:14},attacks:{onehanded:{strength:8,stamina:40,poise:30,damage:70},twohanded:{strength:4,stamina:40,poise:30,damage:70}}},sledgehammer:{...sl,text:{name:"Sledgehammer",info:"Crush any enemy in a single blow, if you can swing it.",description:"Only used in earnest as a show of force, the few that can wield a sledgehammer in combat strike fear in their foes.",logName:"Sledgehammer"},stats:{weight:20},attacks:{onehanded:{strength:12,stamina:60,poise:60,damage:160},twohanded:{strength:6,stamina:60,poise:60,damage:160}}}},il.weapons=ol;const ll={...Fi.armors,...il.weapons,...Hi.furniture,...Gi.consumables,...al.shields};var dl=ll;Ni.items=dl;$i=Object.entries(ll).reduce((e,[t,a])=>(e[t]=new ji.ItemBreed(t,a),e),{}),Ni.ItemTypes=$i;Si=new class{id=1;getId(){const e=this.id;return this.id+=1,e}resetIds(){this.id=1}addActorChildren(e){const t=e.breed;t.defaultWielding&&(t.defaultWielding.left&&(e.wielding.left=this.createItem(Ni.ItemTypes[t.defaultWielding.left]),e.wielding.left.everHeld=!0,e.wielding.left.applyStats(e,!0)),t.defaultWielding.right&&(e.wielding.right=this.createItem(Ni.ItemTypes[t.defaultWielding.right]),e.wielding.right.everHeld=!0,e.wielding.right.applyStats(e,!0)),t.defaultWielding.mode&&(e.wielding.mode=t.defaultWielding.mode||t.defaultWielding.mode)),t.defaultWearing&&t.defaultWearing.armor&&(e.wearing.armor=this.createItem(Ni.ItemTypes[t.defaultWearing.armor]),e.wearing.armor.everHeld=!0,e.wearing.armor.applyStats(e,!0)),t.defaultContains&&t.defaultContains.forEach(([t,a])=>{const r=this.createItem(Ni.ItemTypes[t]);r.everHeld=!0,e.contains.add(r.id,r)})}createActor(e,t,a){const r=this.getId(),n=new Pn.Actor(r,e,t,a);return null==t&&null==a||yt.gameData.actors.add(r,n),this.addActorChildren(n),n}createItem(e,t,a){const r=this.getId(),n=new ji.Item(r,e,t,a);return null==t&&null==a||yt.gameData.items.add(r,n),n}drawEntities=(e,t,a)=>{const r={};let n,i;yt.gameData.items.forEach(e=>{e.x<a.x||a.x+a.w<=e.x||e.y<a.y||a.y+a.h<=e.y||(i=e.x+e.y*yt.gameData.current.width,(yt.gameData.seeAll||yt.gameData.fov.has(i))&&(n=r[i],n?(n[1]=!0,n[0].breed.displayPriority<e.breed.displayPriority&&(n[0]=e)):r[i]=[e,!1]))}),yt.gameData.actors.forEach(e=>{e.x<a.x||a.x+a.w<=e.x||e.y<a.y||a.y+a.h<=e.y||(i=e.x+e.y*yt.gameData.current.width,n=r[i],(yt.gameData.seeAll||yt.gameData.fov.has(i))&&(n?(n[1]=!0,n[0].breed.displayPriority<e.breed.displayPriority&&(n[0]=e)):r[i]=[e,!1]))}),Object.values(r).forEach(([r])=>{e.drawAppend(r.x+t.x-a.x,r.y+t.y-a.y,r.breed.ch,r.breed.fg,r.breed.bg||"transparent")})};actorPlan(){yt.gameData.actors.forEach(e=>{const t=e.plan();if(t)switch(t.speed){case la.ActionSpeed.FAST:yt.gameData.quickActionQueue.unshift(t);break;case la.ActionSpeed.MEDIUM:yt.gameData.actionQueue.unshift(t);break;case la.ActionSpeed.SLOW:yt.gameData.slowActionQueue.unshift(t)}})}actorReplan(e){const t=e.plan();t&&yt.gameData.slowActionQueue.push(t)}},Pi.default=Si;var ul=function(e){return e&&e.__esModule?e:{default:e}}(Pi),cl={};Object.defineProperty(cl,"__esModule",{value:!0}),Object.defineProperty(cl,"createDMap",{enumerable:!0,get:function(){return hl.createDMap}});var hl={};Object.defineProperty(hl,"__esModule",{value:!0});var fl=function(e,t,a=50){const r={},n=[];for(const t of e)r[1e4*t.x+t.y]=0,n.push({position:t,weight:0});let i;for(;n.length;){const{position:e,weight:o}=n.shift();o<a&&Xt.allDirections.forEach(a=>{i=(0,Xt.getInDirection)(e,a),t(i,e)&&null==r[1e4*i.x+i.y]&&(r[1e4*i.x+i.y]=o+1,n.push({position:i,weight:o+1}))})}return new pl(r)};hl.createDMap=fl;var gl=void 0;hl.DMap=gl;class pl{constructor(e){this.map=e}get(e){return this.map[1e4*e.x+e.y]}getLowestAdjacent(e,t){let a,r=[],n=Number.MAX_SAFE_INTEGER;for(const i of(0,Xt.genAllDirections)(e))a=this.get(i),a<n&&t(i,e)?(n=a,r=[i]):a===n&&r.push(i);return r}getHighestAdjacent(e,t){let a,r=[],n=Number.MAX_SAFE_INTEGER;for(const i of(0,Xt.genAllDirections)(e))a=this.get(i),n<a&&t(i,e)?(n=a,r=[i]):a===n&&r.push(i);return r}getSortedAdjacent(e,t){const a=[];for(const r of(0,Xt.genAllDirections)(e))t(r,e)&&a.push(r);return a.sort((e,t)=>{const a=this.get(e),r=this.get(t);return null==a?1:null==r?-1:a-r})}}gl=pl,hl.DMap=gl;var ml=e=>(e.status.waited=!0,{valid:!0});xi.wait=ml;var yl=(e,t)=>{const a=(0,Dn.getWeightLevel)((0,Dn.getActorWeight)(e),e.attributes.weight);if(a===Pn.Encumbrance.HEAVY)return{valid:!1};e.stamina.change(a===Pn.Encumbrance.LIGHT?-15:-30),wl(e,t);const{x:r,y:n}=(0,Xt.getInDirection)(e,t.dir);if((0,yt.findActorForPosition)(r,n)){if(a===Pn.Encumbrance.LIGHT){const a=(0,yi.getActiveAttack)(e);a.stamina<=e.stamina.current&&(0,Dn.hasStrength)(e,a)&&(0,ga.attackTowards)(e,t)}}else wl(e,t);return e.status.sprinted=!0,{valid:!0}};xi.sprintTowards=yl;var vl=(e,t)=>{const a=(0,Xt.getDirectionTowards)(e,t.target);return wl(e,{dir:a})};xi.moveTo=vl;const wl=(e,t)=>{const a=yt.gameData.current.tiles[e.x+e.y*yt.gameData.current.width];if(!ma.CheckMovement[t.dir](a))return{valid:!1};const{x:r,y:n}=(0,Xt.getInDirection)(e,t.dir),i=(0,Dn.getWeightLevel)((0,Dn.getActorWeight)(yt.gameData.player),yt.gameData.player.attributes.weight);if(i!==Pn.Encumbrance.LIGHT&&e!==yt.gameData.player){const[t,a]=(0,yo.bestMoveTowardsPlayer)(e);if(!e.status.replanned&&yt.gameData.player.status.moved&&a&&a===yt.gameData.player)return e.status.replanned=!0,ul.default.actorReplan(e),{valid:!0}}return(0,yt.findActorForPosition)(r,n)||(Na.GibManager.runThenDestroy(Ei.FootstepParticle,e.x,e.y),e.x=r,e.y=n),i!==Pn.Encumbrance.LIGHT&&e===yt.gameData.player&&(yt.gameData.dMapPlayer=(0,cl.createDMap)([e],_o.moveIn,5)),e.status.moved=!0,{valid:!0}};Ti=wl,xi.moveTowards=Ti;var bl={};Object.defineProperty(bl,"__esModule",{value:!0});var _l=void 0;bl.LookParticle=_l;_l={mode:Fa.ParticleModes.DRAW_OVER_LAST,char:null,fg:null,bg:"rgba(100, 100, 200, 0.75)",animate:async e=>{for(;;)await(0,Fa.awaitAnimate)({driver:e.driver,from:"rgba(100, 100, 200, 0.75)",to:"rgba(125, 125, 225, 0.75)",duration:1e3,onUpdate:t=>{e.bg=t}}),await(0,Fa.awaitAnimate)({driver:e.driver,from:"rgba(125, 125, 225, 0.75)",to:"rgba(100, 100, 200, 0.75)",duration:1e3,onUpdate:t=>{e.bg=t}})}},bl.LookParticle=_l;var xl={};Object.defineProperty(xl,"__esModule",{value:!0});var Tl=void 0;xl.CheatModal=Tl;var El=function(e){return e&&e.__esModule?e:{default:e}}(h),Ml={};Object.defineProperty(Ml,"__esModule",{value:!0});var Al=void 0;Ml.PlayerPosition=Al;var Dl={};Object.defineProperty(Dl,"__esModule",{value:!0});var kl=(Ol=void 0,Dl.InputPrompt=Ol);Dl.promptInput=kl;var Pl={};Object.defineProperty(Pl,"__esModule",{value:!0});var Sl=void 0;Pl.Input=Sl;Sl=(e,t)=>{const[a,r]=e.useState({entry:t.initialValue});e.display.drawText(e.bounds.x,e.bounds.y,a.entry),e.handlers.keypress=e=>{if("Delete"===e||"Backspace"===e)r({entry:a.entry.substr(0,a.entry.length-1)});else if("Enter"===e)t.onSubmit(a.entry);else{if(1!==e.length)return!1;r({entry:a.entry+e})}return!0}},Pl.Input=Sl;const jl=(e,t)=>[(0,o.createElement)(io.TextType,{x:0,y:0,h:1,w:24},{title:t.title}),(0,o.createElement)(Pl.Input,{x:0,y:1,h:1,w:24},{initialValue:t.initial||"",onSubmit:e=>{(0,st.closeModal)(),t.onSubmit(e)}})];var Ol=jl;Dl.InputPrompt=Ol;kl=e=>{(0,st.openModal)((0,o.createElement)(jl,{x:0,y:0,h:3,w:24},e))},Dl.promptInput=kl;Al=(e,t)=>{const[a,r]=e.useState({x:0,y:0});return[(0,o.createElement)(u.ButtonComp,{x:0,y:0,w:6,h:1},{title:"X: "+a.x,onClick:()=>(0,Dl.promptInput)({title:"X",initial:a.x,onSubmit:e=>r({x:parseInt(e)})})}),(0,o.createElement)(u.ButtonComp,{x:8,y:0,w:6,h:1},{title:"Y: "+a.y,onClick:()=>(0,Dl.promptInput)({title:"Y",initial:a.y,onSubmit:e=>r({y:parseInt(e)})})}),(0,o.createElement)(u.ButtonComp,{x:34,y:0,w:6,h:1},{title:"Move",onClick:()=>{yt.gameData.player.x=a.x,yt.gameData.player.y=a.y,(0,st.closeModal)()}})]},Ml.PlayerPosition=Al;var Rl={};Object.defineProperty(Rl,"__esModule",{value:!0});var Cl=void 0;Rl.LevelModal=Cl;var Il=function(e){return e&&e.__esModule?e:{default:e}}(h),Ll={};Object.defineProperty(Ll,"__esModule",{value:!0});var Bl=(Nl=void 0,$l=Ll.isUpKey=Nl,Fl=Ll.isRightKey=$l,Ll.isLeftKey=Fl);Ll.isDownKey=Bl;var Nl=e=>"ArrowUp"===e||"w"===e||"k"===e;Ll.isUpKey=Nl;var $l=e=>"ArrowRight"===e||"d"===e||"l"===e;Ll.isRightKey=$l;var Fl=e=>"ArrowLeft"===e||"a"===e||"h"===e;Ll.isLeftKey=Fl;Bl=e=>"ArrowDown"===e||"s"===e||"j"===e,Ll.isDownKey=Bl;const Wl=[{title:"Health (+20)",description:"How much punishment you can take",apply:()=>{yt.gameData.player.level=yt.gameData.player.level+1,yt.gameData.player.health.adjustMax(20,!1)}},{title:"Stamina (+20)",description:"How much you can do before tiring",apply:()=>{yt.gameData.player.level=yt.gameData.player.level+1,yt.gameData.player.stamina.adjustMax(20)}},{title:"Max Weight (+5)",description:"How much equipment load you can wear",apply:()=>{yt.gameData.player.level=yt.gameData.player.level+1,yt.gameData.player.attributes.weight=yt.gameData.player.attributes.weight+5}},{title:"Force (+1)",description:"How impactful your blows are",apply:()=>{yt.gameData.player.level=yt.gameData.player.level+1,yt.gameData.player.attributes.force=yt.gameData.player.attributes.force+1}},{title:"Strength (+1)",description:"How big a weapon you can wield",apply:()=>{yt.gameData.player.level=yt.gameData.player.level+1,yt.gameData.player.attributes.strength=yt.gameData.player.attributes.strength+1}}];Cl=(e,t)=>{const[a,r]=e.useState({selected:0});(0,m.floodFill)(e.display,e.bounds,Il.default.BLACK);let n=e.bounds.y;e.display.drawText(e.bounds.x,n,"Level Up"),n+=1,e.display.drawText(e.bounds.x,n,"Select a stat to improve"),n+=2,Wl.forEach((t,r)=>{let i=Il.default.B_GREY_3,o=Il.default.B_GREY_2;a.selected===r&&(i=Il.default.B_GREY_5,o=Il.default.B_GREY_4,e.display.drawText(e.bounds.x,n,">")),e.display.drawText(e.bounds.x+1,n,`%c{${i}}${t.title}`),n+=1,e.display.drawText(e.bounds.x+2,n,`%c{${o}}${t.description}`),n+=2}),e.display.drawText(e.bounds.x,e.bounds.y+e.bounds.h-1,`%c{${Il.default.RED_4}} Enter %c{}Confirm %c{${Il.default.RED_4}}Esc%c{} Cancel`),e.handlers.keypress=e=>{if((0,Ll.isUpKey)(e)&&0<a.selected)r({selected:a.selected-1});else if((0,Ll.isDownKey)(e)&&a.selected<Wl.length-1)r({selected:a.selected+1});else{if("Enter"===e)return Wl[a.selected].apply(),(0,st.closeModal)(),!0;if("Escape"===e)return(0,st.closeModal)(),!0}return!0}},Rl.LevelModal=Cl;Tl=(e,t)=>((0,m.floodFill)(e.display,e.bounds,El.default.BLACK),[(0,o.createElement)(io.TextType,{x:0,y:0,w:24,h:1},{title:"Cheat Menu Options"}),(0,o.createElement)(Ml.PlayerPosition,{x:0,y:1,w:40,h:1}),(0,o.createElement)(u.ButtonComp,{x:2,y:14,w:6,h:1},{title:"Level",onClick:()=>{(0,st.closeModal)(),(0,st.openModal)((0,o.createElement)(Rl.LevelModal,{x:0,y:0,w:48,h:24},{}))}}),(0,o.createElement)(u.ButtonComp,{x:2,y:16,w:6,h:1},{title:"Close",onClick:()=>(0,st.closeModal)()})]),xl.CheatModal=Tl;zt={cheat:()=>{(0,st.openModal)((0,o.createElement)(xl.CheatModal,{x:0,y:0,w:40,h:20}))},wait:()=>(0,la.createAction)(xi.wait,yt.gameData.player,null),move:e=>{const t=yt.gameData.player,a=(0,Xt.getDirectionFromVector)(e),r=yt.gameData.current.tiles[t.x+t.y*yt.gameData.current.width];if(a&&ma.CheckMovement[a](r)){if(!(0,yt.findActorForPosition)(t.x+e.x,t.y+e.y))return(0,la.createAction)(xi.moveTowards,yt.gameData.player,{dir:a},(0,Dn.weightToActionSpeed)((0,Dn.getWeightLevel)((0,Dn.getActorWeight)(yt.gameData.player),yt.gameData.player.attributes.weight)));{const e=(0,yi.getActiveAttack)(yt.gameData.player);if(yt.gameData.player.stamina.current<e.stamina)(0,Qe.log)("Not enough stamina to attack");else{if((0,Dn.hasStrength)(yt.gameData.player,e))return e.blocks?(0,la.createAction)(ga.blockAttacks,yt.gameData.player,null,la.ActionSpeed.FAST):(0,la.createAction)(ga.attackTowards,yt.gameData.player,{dir:a});(0,Qe.log)("You are not strong enough to use this attack")}}}else(0,Qe.log)("You cannot move or attack in that direction.")},sprint:e=>{const t=yt.gameData.player,a=(0,Dn.getWeightLevel)((0,Dn.getActorWeight)(t),t.attributes.weight);if(a!==Pn.Encumbrance.HEAVY)if(a===Pn.Encumbrance.LIGHT&&15<t.stamina.current||a===Pn.Encumbrance.MEDIUM&&30<t.stamina.current){const a=(0,Xt.getDirectionFromVector)(e),r=yt.gameData.current.tiles[t.x+t.y*yt.gameData.current.width];if(a&&ma.CheckMovement[a](r)){if(!(0,yt.findActorForPosition)(t.x+e.x,t.y+e.y))return(0,la.createAction)(xi.sprintTowards,yt.gameData.player,{dir:a});(0,Qe.log)("You cannot sprint directly into enemies.")}}else(0,Qe.log)("Not enough stamina to sprint.");else(0,Qe.log)("You cannot sprint while slow (75%+ carry load)")},look:()=>{var e;yt.gameData.looking?(Kt.default.popInputHandler(),yt.gameData.looking=!1,null===(e=yt.gameData.targetFocus)||void 0===e||e.finish(),yt.gameData.targetFocus=null):(Kt.default.pushInputHandler(["base","focusMove"]),yt.gameData.looking=!0,yt.gameData.targetFocus=Na.ParticleManager.createParticle(bl.LookParticle,yt.gameData.player.x,yt.gameData.player.y))},focusMove:e=>{yt.gameData.targetFocus&&(yt.gameData.targetFocus.x+=e.x,yt.gameData.targetFocus.y+=e.y)}},Ht.Commands=zt;var Ul={};Object.defineProperty(Ul,"__esModule",{value:!0});var Gl=void 0;Ul.buildState=Gl;var Yl={};Object.defineProperty(Yl,"__esModule",{value:!0});var Hl=void 0;Yl.RNGGenerator=Hl;class zl{constructor(e){this.rng=L.clone().setSeed(e)}getRNG(){return L.clone().setSeed(this.rng.getUniform())}getGenerator(){return new zl(this.rng.getUniform())}}Hl=zl,Yl.RNGGenerator=Hl;Gl=e=>{const t=new Yl.RNGGenerator(e||Date.now()),a=new Ys.ShrineMap(25,25,t.getGenerator());return{seedRng:t,current:a,actors:new In.SparseMap,items:new In.SparseMap,gibs:new In.SparseMap,particles:new In.SparseMap,quickActionQueue:[],actionQueue:[],slowActionQueue:[],player:new Pn.Actor(-1,new Pn.ActorBreed("",{}),0,0),fov:new Map,xp:0,dMapPlayer:null,actionPending:!1,looking:!1,targetFocus:null,seeAll:!1}},Ul.buildState=Gl;var Kl=vd(Pi),Xl={};Object.defineProperty(Xl,"__esModule",{value:!0});var Vl=void 0;Xl.default=Vl;Vl=new class{pending=[];addPending(e){this.pending.push(e)}waitForPending(){const e=Promise.all(this.pending);return this.pending=[],e}},Xl.default=Vl;var ql=vd(Xl),Zl={};Object.defineProperty(Zl,"__esModule",{value:!0});var Ql=(td=void 0,rd=Zl.SkinnyRecursiveShadowcasting=td,Zl.PlayerVisibility=rd);Zl.getPlayerVisibility=Ql;const Jl=[[-1,0,0,1],[0,-1,1,0],[0,-1,-1,0],[-1,0,0,-1],[1,0,0,-1],[0,1,-1,0],[0,1,1,0],[1,0,0,1]];class ed{constructor(e,t){this._lightCasts=e,this._lightPasses=t}compute(e,t,a,r){r(e,t,0,1);for(let n=0;n<Jl.length;n++)this._renderOctant(e,t,Jl[n],a,r)}compute180(e,t,a,r,n){n(e,t,0,1);const i=(r-1+8)%8,o=(r-2+8)%8,s=(r+1+8)%8;this._renderOctant(e,t,Jl[o],a,n),this._renderOctant(e,t,Jl[i],a,n),this._renderOctant(e,t,Jl[r],a,n),this._renderOctant(e,t,Jl[s],a,n)}compute90(e,t,a,r,n){n(e,t,0,1);const i=(r-1+8)%8;this._renderOctant(e,t,Jl[r],a,n),this._renderOctant(e,t,Jl[i],a,n)}_renderOctant(e,t,a,r,n){this._lightPasses(e,t,a[0],-1*a[1],a[2],-1*a[3])&&this._castVisibility(e,t,1,1,0,r+1,a[0],a[1],a[2],a[3],n)}_castVisibility(e,t,a,r,n,i,o,s,l,d,u){if(!(r<n))for(let c=a;c<=i;c++){let a=-c-1;const h=-c;let f=!1,g=0;for(;a<=0;){a+=1;const p=e+a*o+h*s,m=t+a*l+h*d,y=(a-.5)/(h+.5),v=(a+.5)/(h-.5);if(v>r)continue;if(y<n)break;const w=this._lightCasts(p,m,o,-1*s,l,-1*d);if(a*a+h*h<i*i&&(w||0===a)&&u(p,m,c,1),f){if(!this._lightPasses(p,m,o,-1*s,l,-1*d)){g=v;continue}f=!1,r=g}else{this._lightPasses(p,m,o,-1*s,l,-1*d)&&c<i?!w&&a<0&&(this._castVisibility(e,t,c+1,r,y,i,o,s,l,d,u),g=v,f=!0):(this._castVisibility(e,t,c+1,r,y,i,o,s,l,d,u),g=v,f=!0)}}if(f)break}}}var td=ed;Zl.SkinnyRecursiveShadowcasting=td;const ad=new ed((e,t,a,r,n,i)=>{const o=yt.gameData.current;if(0<=e&&e<o.width&&0<=t&&t<o.height){if(-1===a)return o.tiles[e+t*o.width].adj.left!==va.AdjTypes.WALL;if(1===a)return o.tiles[e+t*o.width].adj.right!==va.AdjTypes.WALL;if(-1===n)return o.tiles[e+t*o.width].adj.up!==va.AdjTypes.WALL;if(1===n)return o.tiles[e+t*o.width].adj.down!==va.AdjTypes.WALL}return!1},(e,t,a,r,n,i)=>{const o=yt.gameData.current;if(0<=e&&e<o.width&&0<=t&&t<o.height){if(-1===r)return o.tiles[e+t*o.width].adj.left!==va.AdjTypes.WALL;if(1===r)return o.tiles[e+t*o.width].adj.right!==va.AdjTypes.WALL;if(-1===i)return o.tiles[e+t*o.width].adj.up!==va.AdjTypes.WALL;if(1===i)return o.tiles[e+t*o.width].adj.down!==va.AdjTypes.WALL}return!1});var rd=ad;Zl.PlayerVisibility=rd;Ql=(e,t,a,r,n=new Map)=>{n.clear(),ad.compute(t,a,r,(t,a,r,i)=>{i&&n.set(t+a*e,!0)})},Zl.getPlayerVisibility=Ql;var nd={};Object.defineProperty(nd,"__esModule",{value:!0});var id=(od=void 0,nd.moveIn=od);nd.moveOut=id;var od=(e,t)=>{const a=yt.gameData.current.tiles[t.x+t.y*yt.gameData.current.width];switch((0,Xt.getDirectionTowards)(t,e)){case Xt.Directions.Left:return(0,ma.adjInCheck)(a.adj.left);case Xt.Directions.Up:return(0,ma.adjInCheck)(a.adj.up);case Xt.Directions.Right:return(0,ma.adjInCheck)(a.adj.right);case Xt.Directions.Down:return(0,ma.adjInCheck)(a.adj.down)}};nd.moveIn=od;id=(e,t)=>{const a=yt.gameData.current.tiles[t.x+t.y*yt.gameData.current.width];switch((0,Xt.getDirectionTowards)(t,e)){case Xt.Directions.Left:return(0,ma.adjOutCheck)(a.adj.left);case Xt.Directions.Up:return(0,ma.adjOutCheck)(a.adj.up);case Xt.Directions.Right:return(0,ma.adjOutCheck)(a.adj.right);case Xt.Directions.Down:return(0,ma.adjOutCheck)(a.adj.down)}},nd.moveOut=id;var sd={};Object.defineProperty(sd,"__esModule",{value:!0});var ld=(dd=void 0,cd=sd.endOfTurnEffects=dd,fd=sd.accumulateStagger=cd,pd=sd.regenStats=fd,sd.expireStatuses=pd);sd.clearStates=ld;var dd=()=>{yt.gameData.actors.forEach(e=>{ud(e),hd(e),gd(e),md(e)})};sd.endOfTurnEffects=dd;const ud=e=>{e.status.staggered&&(e.status.staggeredCount=1+(e.status.staggeredCount||0))};var cd=ud;sd.accumulateStagger=cd;const hd=e=>{e.status.hit||e.poise.change(Math.ceil(.33333*e.poise.max));const t=100<=(0,Dn.getWeightLoad)((0,Dn.getActorWeight)(e),e.attributes.weight)?0:1;if(100<=(0,Dn.getWeightLoad)((0,Dn.getActorWeight)(e),e.attributes.weight))e.stamina.change(-2);else{if(e.status.sprinted||e.status.staggered)return;e.status.waited?e.stamina.change(40*t):e.status.moved&&e.stamina.change(20*t)}};var fd=hd;sd.regenStats=fd;const gd=e=>{e.poise.current?(e.status.staggeredCount=0,e.status.staggered=!1):yt.gameData.player===e&&3<=(e.status.staggeredCount||0)&&(e.status.staggeredCount=0,e.status.staggered=!1,e.poise.fill())};var pd=gd;sd.expireStatuses=pd;const md=e=>{e.status.waited=!1,e.status.hit=!1,e.status.moved=!1,e.status.blocking=!1,e.status.replanned=!1,e.status.sprinted=!1};ld=md,sd.clearStates=ld;var yd=vd(h);function vd(e){return e&&e.__esModule?e:{default:e}}let wd=(0,Ul.buildState)();var bd=wd;yt.gameData=bd;var _d=()=>{(0,Qe.clearLog)(),(0,Qe.log)(`%c{${yd.default.B_GREY_3}}Welcome to Pieux move with wasd, hjkl, or arrow keys.`),(0,Qe.log)(`%c{${yd.default.B_GREY_3}}Shift + movement keys will sprint if available.`),(0,Qe.log)("As you awaken, the world has shifted around you"),(0,Qe.log)(`With your flask of restoration (%c{${yd.default.RED_4}}u%c{}), you set out.`),bd=wd=(0,Ul.buildState)(),yt.gameData=bd,Yt.default.pushKeyHandler(["baseActions","playerActions","graphMovement","advance","cancel"]),Yt.default.pushInputHandler(["base","move","playerActions"]);const e=wd.seedRng.getRNG();(0,qi.generateMap)(e,wd.current),(0,Zl.getPlayerVisibility)(wd.current.width,wd.player.x,wd.player.y,7,wd.fov),wd.dMapPlayer=(0,cl.createDMap)([wd.player],nd.moveIn,20),Kl.default.actorPlan()};yt.initializeState=_d;var xd=(e,t)=>{if(t&&(e=(e=>e.startsWith("Arrow")?"S"+e:e)(e)),!wd.actionPending){const t=Yt.default.keyToAction(e);if(t){const[e,a]=t,r=Ht.Commands[e](a);if(r){if(Array.isArray(r))r.forEach(e=>{switch(e.speed){case la.ActionSpeed.FAST:wd.quickActionQueue.unshift(e);break;case la.ActionSpeed.MEDIUM:wd.actionQueue.unshift(e);break;case la.ActionSpeed.SLOW:wd.slowActionQueue.unshift(e)}});else switch(r.speed){case la.ActionSpeed.FAST:wd.quickActionQueue.unshift(r);break;case la.ActionSpeed.MEDIUM:wd.actionQueue.unshift(r);break;case la.ActionSpeed.SLOW:wd.slowActionQueue.unshift(r)}Ed()}return!0}(0,wt.warnInDev)("No action for input: "+e)}return!1};yt.handleInput=xd;var Td=e=>{switch(e.speed){case la.ActionSpeed.FAST:wd.quickActionQueue.unshift(e);break;case la.ActionSpeed.MEDIUM:wd.actionQueue.unshift(e);break;case la.ActionSpeed.SLOW:wd.slowActionQueue.unshift(e)}Ed()};yt.runPlayerAction=Td;const Ed=async()=>{Na.ParticleManager.clearStartOfTurn(),wd.actionPending=!0,await Ad(),(0,Zl.getPlayerVisibility)(wd.current.width,wd.player.x,wd.player.y,5,wd.fov),wd.dMapPlayer=(0,cl.createDMap)([wd.player],nd.moveIn,20),Na.ParticleManager.clearEndOfTurn(),(0,sd.endOfTurnEffects)(),Kl.default.actorPlan(),wd.actionPending=!1};var Md=Ed;yt.advanceTurn=Md;const Ad=async()=>{for(;wd.quickActionQueue.length;)await(0,la.runAction)(wd.quickActionQueue.shift());for(;wd.actionQueue.length;)await(0,la.runAction)(wd.actionQueue.shift());for(;wd.slowActionQueue.length;)await(0,la.runAction)(wd.slowActionQueue.shift());await ql.default.waitForPending()};var Dd=Ad;yt.runActionQueue=Dd;var kd=(e,t,a)=>{wd.current.draw(e,t,a,wd.fov),wd.gibs.forEach(r=>{r.render(e,t,a)}),Kl.default.drawEntities(e,t,a),wd.particles.forEach(r=>{r.render(e,t,a)})};yt.drawWorld=kd;var Pd=(e,t)=>wd.actors.find(a=>a.x===e&&a.y===t);yt.findActorForPosition=Pd;vt=(e,t)=>wd.items.filter(a=>a.x===e&&a.y===t),yt.getItemsForPosition=vt;var Sd={};Object.defineProperty(Sd,"__esModule",{value:!0});var jd=void 0;Sd.MapUI=jd;jd=e=>{e.handlers.keypress=yt.handleInput;const t=yt.gameData.targetFocus;(0,yt.drawWorld)(e.display,e.bounds,((e,t,a)=>{const r=a.w/2,n=a.h/2;return{x:Math.floor(Math.max(0,Math.min(e.width-a.w,t.x-r))),y:Math.floor(Math.max(0,Math.min(e.height-a.h,t.y-n))),w:Math.min(a.w,e.width),h:Math.min(a.h,e.height)}})(yt.gameData.current,t?{x:t.x,y:t.y}:{x:yt.gameData.player.x,y:yt.gameData.player.y},e.bounds))},Sd.MapUI=jd;var Od={};Object.defineProperty(Od,"__esModule",{value:!0});var Rd=void 0;Od.StatsPanel=Rd;var Cd={};Object.defineProperty(Cd,"__esModule",{value:!0});var Id=void 0;Cd.LabeledBar=Id;var Ld={};Object.defineProperty(Ld,"__esModule",{value:!0});var Bd=void 0;Ld.Bar=Bd;var Nd=function(e){return e&&e.__esModule?e:{default:e}}(h);Bd=(e,t={current:0,max:0,fillColor:"#FFFFFF"})=>{const a=t.current/t.max;let r=0;const n=`${t.current} / ${t.max}`,i=n.length;for(e.display.drawText(e.bounds.x,e.bounds.y,`%c{${Nd.default.B_GREY_5}}${n}`);r/e.bounds.w<a;r++)e.display.drawOver(r+e.bounds.x,e.bounds.y,i<=r?" ":null,null,t.fillColor);for(;r<e.bounds.w;r++)e.display.drawOver(r+e.bounds.x,e.bounds.y,i<=r?" ":null,null,Nd.default.B_GREY_2)},Ld.Bar=Bd;Id=(e,t={current:0,title:"",fillColor:"#FFFFFF"})=>[(0,o.createElement)(io.TextType,{x:0,y:0,w:e.bounds.w,h:1},{title:t.title}),(0,o.createElement)(Ld.Bar,{x:0,y:1,w:e.bounds.w,h:1},t)],Cd.LabeledBar=Id;var $d=function(e){return e&&e.__esModule?e:{default:e}}(h),Fd={};Object.defineProperty(Fd,"__esModule",{value:!0});var Wd=void 0;Fd.XPBar=Wd;Wd=(e,t)=>{if(e.display.drawText(e.bounds.x,e.bounds.y,"Level: "+yt.gameData.player.level,e.bounds.w-11),(0,Fo.isMaxLevel)(yt.gameData.player.level))e.display.drawText(e.bounds.x,e.bounds.y+1,"XP: Max");else{if((0,Fo.hasLevelUp)(yt.gameData.player.level,yt.gameData.xp))return[(0,o.createElement)(u.ButtonComp,{x:0,y:1,w:e.bounds.w,h:1},{title:"Lvl Up",keys:"x",showKey:!0,onClick:()=>{yt.gameData.actionPending||(0,st.openModal)((0,o.createElement)(Rl.LevelModal,{x:0,y:0,w:48,h:24},{}))}})];e.display.drawText(e.bounds.x,e.bounds.y+1,"XP: "+(0,Fo.getXPProgress)(yt.gameData.player.level,yt.gameData.xp))}},Fd.XPBar=Wd;Rd=(e,t)=>{e.display.drawText(e.bounds.x,e.bounds.y+3,"FRC: "+yt.gameData.player.attributes.force),e.display.drawText(e.bounds.x,e.bounds.y+4,"STR: "+yt.gameData.player.attributes.strength);const a=(0,Dn.getActorWeight)(yt.gameData.player),r=yt.gameData.player.attributes.weight;e.display.drawText(e.bounds.x,e.bounds.y+7,`WEIGHT: ${a}/${r} (${(0,Dn.getWeightLoad)(a,r)}%)`);const n=(0,Dn.getWeightLevel)(a,r);return e.display.drawText(e.bounds.x,e.bounds.y+8,n===Pn.Encumbrance.HEAVY?"Slow movement":n===Pn.Encumbrance.MEDIUM?"Medium Movement":"Fast Movement"),e.display.drawText(e.bounds.x,e.bounds.y+9,n===Pn.Encumbrance.HEAVY?`%c{${$d.default.RED_2}}No Sprinting`:n===Pn.Encumbrance.MEDIUM?"Shift Move Sprint":"Shift Move Sprint Atk"),[(0,o.createElement)(Fd.XPBar,{x:0,y:0,w:e.bounds.w-11,h:3}),(0,o.createElement)(Cd.LabeledBar,{x:e.bounds.w-10,y:0,w:10,h:1},{title:"Health",fillColor:"#702931",current:yt.gameData.player.health.current,max:yt.gameData.player.health.max}),(0,o.createElement)(Cd.LabeledBar,{x:e.bounds.w-10,y:2,w:10,h:1},{title:"Stamina",fillColor:"#2b4147",current:yt.gameData.player.stamina.current,max:yt.gameData.player.stamina.max}),(0,o.createElement)(Cd.LabeledBar,{x:e.bounds.w-10,y:4,w:10,h:1},{title:"Poise",fillColor:"#45538f",current:yt.gameData.player.poise.current,max:yt.gameData.player.poise.max})]},Od.StatsPanel=Rd;var Ud={};Object.defineProperty(Ud,"__esModule",{value:!0});var Gd=void 0;Ud.TileContents=Gd;var Yd=function(e){return e&&e.__esModule?e:{default:e}}(h);const Hd=(e,t)=>`%c{${e}}${t}%c{}`;Gd=e=>{let t,a;null!=yt.gameData.targetFocus?(t=yt.gameData.targetFocus.x,a=yt.gameData.targetFocus.y):(t=yt.gameData.player.x,a=yt.gameData.player.y);const r=yt.gameData.fov.get(t+a*yt.gameData.current.width),n=(0,yt.getItemsForPosition)(t,a),i=(0,yt.findActorForPosition)(t,a);if(r){const t=e.bounds.y+e.bounds.h-3;let a=e.bounds.y+1;i&&i!=yt.gameData.player&&a<t&&(a+=e.display.drawText(e.bounds.x,a,Hd(Yd.default.B_GREY_4,i.breed.name),e.bounds.w-1),i.breed.info&&a<t&&(a+=e.display.drawText(e.bounds.x,a,Hd(Yd.default.B_GREY_3,i.breed.info),e.bounds.w-1)),a+=1,i.breed.description&&a<t&&(a+=e.display.drawText(e.bounds.x,a,Hd(Yd.default.B_GREY_2,i.breed.description),e.bounds.w-1)),a+=1),n.length&&n.forEach(r=>{a<t&&(a+=e.display.drawText(e.bounds.x,a,Hd(Yd.default.B_GREY_4,r.breed.name),e.bounds.w-1),r.breed.info&&a<t&&(a+=e.display.drawText(e.bounds.x,a,Hd(Yd.default.B_GREY_3,r.breed.info),e.bounds.w-1)),a+=1,r.breed.description&&a<t&&(a+=e.display.drawText(e.bounds.x,a,Hd(Yd.default.B_GREY_2,r.breed.description),e.bounds.w-1)),a+=1)})}else e.display.drawText(e.bounds.x,e.bounds.y,"You cannot see here");yt.gameData.looking?e.display.drawText(e.bounds.x,e.bounds.y+e.bounds.h-1,`%c{${Yd.default.RED_4}}v%c{} to stop looking`,e.bounds.w-1):e.display.drawText(e.bounds.x,e.bounds.y+e.bounds.h-1,`%c{${Yd.default.RED_4}}v%c{} to look`,e.bounds.w-1)},Ud.TileContents=Gd;var zd={};Object.defineProperty(zd,"__esModule",{value:!0});var Kd=void 0;zd.InventoryPanel=Kd;var Xd={};Object.defineProperty(Xd,"__esModule",{value:!0});var Vd=void 0;Xd.TabbedContents=Vd;var qd=function(e){return e&&e.__esModule?e:{default:e}}(h);const Zd=(e,t)=>{const a=Array.isArray(t.keys)?t.keys[0]:t.keys,[r,n]=e.useState({hover:!1}),i=t.selected||r.hover?qd.default.B_GREY_5:qd.default.B_GREY_3;a&&e.display.drawText(e.bounds.x,e.bounds.y,`%c{${qd.default.RED_4}}${a}`),e.display.drawText(e.bounds.x+(a?1:0),e.bounds.y,`%c{${i}}${t.title}`),e.handlers.hover=()=>{n({hover:!0})},e.handlers.out=()=>{n({hover:!1})},e.handlers.press=()=>{t.onClick()},(0,_.handleKeyOnClick)(e,t)},Qd=(e,t)=>t.children;Vd=(e,{children:t})=>{const[a,r]=e.useState({selected:0});let n=0;return[...t.map((e,t)=>{const i=e.title.length+(e.keys?2:1),s=(0,o.createElement)(Zd,{x:n,y:0,w:i,h:1},{selected:t===a.selected,title:e.title,keys:e.keys,onClick:()=>r({selected:t})});return n+=i,s}),(0,o.createElement)(Qd,{x:0,y:2,w:e.bounds.w,h:e.bounds.h-2},{children:[t[a.selected<t.length?a.selected:0].value]})]},Xd.TabbedContents=Vd;var Jd={};Object.defineProperty(Jd,"__esModule",{value:!0});var eu=void 0;Jd.EquipmentPanel=eu;var tu=function(e){return e&&e.__esModule?e:{default:e}}(h),au={};Object.defineProperty(au,"__esModule",{value:!0});var ru=(iu=void 0,au.drawShieldDetails=iu);au.drawAttackDetails=ru;var nu=function(e){return e&&e.__esModule?e:{default:e}}(h);var iu=(e,t,a,r,n,i,o)=>{let s=1;return s+=e.drawText(r,n+s,`%c{${(0,Dn.hasStrength)(t,a)?o:nu.default.RED_2}}Str Req: ${a.strength||0}`,i),s+=e.drawText(r,n+s,`%c{${o}}Stability: ${a.stability||0}`,i),s+=e.drawText(r,n+s,`%c{${o}}Block: ${100*(a.blocks||0)}`,i),s+=e.drawText(r,n+s,`%c{${o}}STA Cost: ${a.stamina||0}`,i),s};au.drawShieldDetails=iu;ru=(e,t,a,r,n,i,o)=>{let s=1;return s+=e.drawText(r,n+s,`%c{${(0,Dn.hasStrength)(t,a)?o:nu.default.RED_2}}Str Req: ${a.strength||0}`,i),s+=e.drawText(r,n+s,`%c{${o}}DMG: ${(0,Dn.reduceDamage)((0,Dn.damageWithForce)(a.damage||0,t.attributes.force),1)}`,i),s+=e.drawText(r,n+s,`%c{${o}}Poise: ${a.poise}`,i),s+=e.drawText(r,n+s,`%c{${o}}STA Cost: ${a.stamina||0}`,i),s},au.drawAttackDetails=ru;eu=e=>{var t;let a=e.bounds.y+2;const r=yt.gameData.player.wielding.mode===Pn.WieldMode.twoHanded,n=yt.gameData.player.wielding.left,i=yt.gameData.player.wielding.right;a+=e.display.drawText(e.bounds.x,a,"Wielding:");const s=`L: %c{${n?tu.default.B_GREY_5:tu.default.B_GREY_2}}${(null==n?void 0:n.breed.logName)||"None"} ${n&&r?"(2h)":""}`;a+=e.display.drawText(e.bounds.x,a,s);const l=`R: %c{${!i||r&&n?tu.default.B_GREY_2:tu.default.B_GREY_5}}${(null==i?void 0:i.breed.logName)||"None"} ${i&&!n&&r?"(2h)":""}`;if(a+=1+e.display.drawText(e.bounds.x,a,l),r){const t=yt.gameData.player.wielding.left||yt.gameData.player.wielding.right;if(t){var d;const r=null===(d=t.breed.attacks)||void 0===d?void 0:d.twohanded;r&&(r.blocks?(a+=e.display.drawText(e.bounds.x,a,"Two Handed Block",e.bounds.w),a+=(0,au.drawShieldDetails)(e.display,yt.gameData.player,r,e.bounds.x,a,e.bounds.w,(0,Dn.hasStrength)(yt.gameData.player,r)?tu.default.B_GREY_5:tu.default.B_GREY_4)):(a+=e.display.drawText(e.bounds.x,a,"Two Handed Attack",e.bounds.w),a+=(0,au.drawAttackDetails)(e.display,yt.gameData.player,r,e.bounds.x,a,e.bounds.w,(0,Dn.hasStrength)(yt.gameData.player,r)?tu.default.B_GREY_5:tu.default.B_GREY_4)))}}else{var u,c;if(n&&null!==(u=n.breed.attacks)&&void 0!==u&&u.onehanded){const t=n.breed.attacks.onehanded,r=yt.gameData.player.wielding.activeHand===Pn.Hands.LEFT?(0,Dn.hasStrength)(yt.gameData.player,t)?tu.default.B_GREY_5:tu.default.B_GREY_4:tu.default.B_GREY_2;t.blocks?(a+=e.display.drawText(e.bounds.x,a,`%c{${tu.default.RED_4}}1%c{${r}} Left Hand Block`,e.bounds.w),a+=(0,au.drawShieldDetails)(e.display,yt.gameData.player,n.breed.attacks.onehanded,e.bounds.x,a,e.bounds.w,r),a+=1):(a+=e.display.drawText(e.bounds.x,a,`%c{${tu.default.RED_4}}1%c{${r}} Left Hand Attack`,e.bounds.w),a+=(0,au.drawAttackDetails)(e.display,yt.gameData.player,n.breed.attacks.onehanded,e.bounds.x,a,e.bounds.w,r),a+=1)}if(i&&null!==(c=i.breed.attacks)&&void 0!==c&&c.onehanded){const t=i.breed.attacks.onehanded,r=yt.gameData.player.wielding.activeHand===Pn.Hands.RIGHT?(0,Dn.hasStrength)(yt.gameData.player,t)?tu.default.B_GREY_5:tu.default.B_GREY_4:tu.default.B_GREY_2;t.blocks?(a+=e.display.drawText(e.bounds.x,a,`%c{${tu.default.RED_4}}2%c{${r}} Right Hand Block`,e.bounds.w),a+=(0,au.drawShieldDetails)(e.display,yt.gameData.player,t,e.bounds.x,a,e.bounds.w,r)):(a+=e.display.drawText(e.bounds.x,a,`%c{${tu.default.RED_4}}2%c{${r}} Right Hand Attack`,e.bounds.w),a+=(0,au.drawAttackDetails)(e.display,yt.gameData.player,t,e.bounds.x,a,e.bounds.w,r))}}return e.handlers.keypress=e=>{var t,a,r,n;return"1"===e?(yt.gameData.player.wielding.activeHand=Pn.Hands.LEFT,null!==(t=yt.gameData.player.wielding.left)&&void 0!==t&&null!==(a=t.breed.attacks)&&void 0!==a&&a.onehanded.blocks&&(0,Qe.log)("Shield Active, Move into enemy to block all incoming attacks"),!0):"2"===e&&(yt.gameData.player.wielding.activeHand=Pn.Hands.RIGHT,null!==(r=yt.gameData.player.wielding.right)&&void 0!==r&&null!==(n=r.breed.attacks)&&void 0!==n&&n.onehanded.blocks&&(0,Qe.log)("Shield Active, Move into enemy to block all incoming attacks"),!0)},[(0,o.createElement)(io.TextType,{x:0,y:0,w:e.bounds.w-2,h:1},{title:`Armor: ${(null===(t=yt.gameData.player.wearing.armor)||void 0===t?void 0:t.breed.logName)||"None"} (${(0,Dn.getActorArmor)(yt.gameData.player)})`})]},Jd.EquipmentPanel=eu;var ou={};Object.defineProperty(ou,"__esModule",{value:!0});var su=void 0;ou.ContainsPanel=su;su=e=>{let t=e.bounds.y;yt.gameData.player.contains.forEach(a=>{e.display.drawText(e.bounds.x,t,a.breed.name,e.bounds.w-1),t+=1})},ou.ContainsPanel=su;var lu={};Object.defineProperty(lu,"__esModule",{value:!0});var du=void 0;lu.InventoryControls=du;var uu={};Object.defineProperty(uu,"__esModule",{value:!0});var cu=(_u=void 0,xu=uu.stanceChange=_u,Tu=uu.wieldWeapon=xu,Eu=uu.wearArmor=Tu,Mu=uu.pickupItem=Eu,Au=uu.dropItem=Mu,uu.useItem=Au);uu.interact=cu;var hu=function(e){return e&&e.__esModule?e:{default:e}}(h),fu={};Object.defineProperty(fu,"__esModule",{value:!0});var gu=(pu=void 0,mu=fu.wield2hMsg=pu,yu=fu.wield1hMsg=mu,vu=fu.wearArmorMsg=yu,wu=fu.takeOffMsg=vu,fu.pickupMsg=wu);fu.dropMsg=gu;var pu=e=>{const t=e.wielding.left||e.wielding.right;(0,Qe.log)(e===yt.gameData.player?`${e.breed.logName} wield ${null==t?void 0:t.breed.logName} in both hands`:`${e.breed.logName} wields ${null==t?void 0:t.breed.logName} in both hands`)};fu.wield2hMsg=pu;var mu=e=>{const t=e.wielding.right,a=e.wielding.left;t&&(0,Qe.log)(yt.gameData.player?`${e.breed.logName} wield ${t.breed.logName} with your right hand`:`${e.breed.logName} wields ${t.breed.logName} with their right hand`),a&&(0,Qe.log)(yt.gameData.player?`${e.breed.logName} wield ${a.breed.logName} with your left hand`:`${e.breed.logName} wields ${a.breed.logName} with their left hand`)};fu.wield1hMsg=mu;var yu=e=>{const t=e.wearing.armor;t&&(0,Qe.log)(yt.gameData.player?`${e.breed.logName} wear the ${t.breed.logName}`:`${e.breed.logName} wears the ${t.breed.logName}`)};fu.wearArmorMsg=yu;var vu=(e,t)=>{(0,Qe.log)(yt.gameData.player?`${e.breed.logName} take off the ${t.breed.logName}`:`${e.breed.logName} takes the ${t.breed.logName}`)};fu.takeOffMsg=vu;var wu=(e,t)=>{(0,Qe.log)(yt.gameData.player?`${e.breed.logName} pick up the ${t.breed.logName}`:`${e.breed.logName} picks up the ${t.breed.logName}`)};fu.pickupMsg=wu;gu=(e,t)=>{(0,Qe.log)(yt.gameData.player?`${e.breed.logName} drop up the ${t.breed.logName}`:`${e.breed.logName} drops up the ${t.breed.logName}`)},fu.dropMsg=gu;const bu=e=>{const t=(0,Dn.getWeightLoad)((0,Dn.getActorWeight)(e),e.attributes.weight);e===yt.gameData.player&&100<=t&&(0,Qe.log)(`%c{${hu.default.B_GREY_5}}You are overencumbered (${t}%). Exhaustion drains your stamina.`)};var _u=e=>(e.wielding.mode===Pn.WieldMode.oneHanded?((0,fu.wield2hMsg)(e),e.wielding.mode=Pn.WieldMode.twoHanded):((0,fu.wield1hMsg)(e),e.wielding.mode=Pn.WieldMode.oneHanded),{valid:!0});uu.stanceChange=_u;var xu=(e,{left:t,right:a})=>{var r,n;const i=null!=a&&a===(null===(r=e.wielding.left)||void 0===r?void 0:r.id),o=null!=t&&t===(null===(n=e.wielding.right)||void 0===n?void 0:n.id);let s=null!=t&&(o?e.wielding.right:e.contains.remove(t)),l=null!=a&&(i?e.wielding.left:e.contains.remove(a));const d=e.wielding.right,u=e.wielding.left;(null==d?void 0:d.id)===a&&(l=d),(null==u?void 0:u.id)===t&&(s=u),console.log(t,a,i,o,u,s,d,l),u&&u!==s&&(u.removeStats(e),i||e.contains.add(u.id,u)),d&&(i||d!==l)&&(d.removeStats(e),o||e.contains.add(d.id,d)),e.wielding.left=s||null,s&&s.applyStats(e),e.wielding.right=l||null,l&&l.applyStats(e);return(null!=t&&null!=a||(u&&!d&&null==t&&l||d&&!u&&null==a&&s))&&(e.wielding.mode=Pn.WieldMode.oneHanded),e.wielding.mode===Pn.WieldMode.oneHanded?(0,fu.wield1hMsg)(e):(0,fu.wield2hMsg)(e),bu(e),{valid:!0}};uu.wieldWeapon=xu;var Tu=(e,{id:t})=>{const a=e.wearing.armor;a&&((0,fu.takeOffMsg)(e,a),a.removeStats(e),e.contains.add(a.id,a));const r=e.contains.remove(t);return r?(e.wearing.armor=r,(0,fu.wearArmorMsg)(e),r.applyStats(e)):e.wearing.armor=null,bu(e),{valid:!0}};uu.wearArmor=Tu;var Eu=(e,{id:t})=>{const a=yt.gameData.items.remove(t);if(a){if(!a.everHeld){const e=yt.gameData.current.lootTable.get(a.breed.key);e?yt.gameData.current.lootTable.set(a.breed.key,e-1):console.warn("wanted to adjust loot table for item with no quantity")}return a.everHeld=!0,e.contains.add(a.id,a),(0,fu.pickupMsg)(e,a),{valid:!0}}return{valid:!1}};uu.pickupItem=Eu;var Mu=(e,{id:t})=>{const a=e.contains.remove(t);return a?(a.x=e.x,a.y=e.y,yt.gameData.items.add(a.id,a),(0,fu.dropMsg)(e,a),{valid:!0}):{valid:!1}};uu.dropItem=Mu;var Au=(e,{id:t})=>{const a=e.contains.get(t);return a?(a.useItem(e),{valid:!0}):{valid:!1}};uu.useItem=Au;cu=async e=>{const t=(0,yt.getItemsForPosition)(e.x,e.y).filter(e=>e.breed.interact);if(t.length)for(let a=0;a<t.length;a++)(0,Qe.log)("You pray at the shrine, but no one answers. The world shifts around you."),(0,Qe.log)(`You fill your flask of restoration (%c{${hu.default.RED_4}}u%c{})`),await t[a].interact(e);return{valid:!0}},uu.interact=cu;var Du={};Object.defineProperty(Du,"__esModule",{value:!0});var ku=void 0;Du.WearableModal=ku;var Pu=function(e){return e&&e.__esModule?e:{default:e}}(h),Su={};Object.defineProperty(Su,"__esModule",{value:!0});var ju=(Ru=void 0,Su.drawArmorText=Ru);Su.drawArmorDetails=ju;var Ou=function(e){return e&&e.__esModule?e:{default:e}}(h);var Ru=(e,t,a,r,n)=>{let i=0;var o,s;return i+=e.drawText(a,i+r,(o=Ou.default.B_GREY_5,s=t.breed.name,`%c{${o}}${s}%c{}`),n),t.breed.info&&(i+=e.drawText(a,i+r,t.breed.info,n)),i+=1,i+=e.drawText(a,r+i,`%c{${Ou.default.B_GREY_3}}${t.breed.description}`,n),i};Su.drawArmorText=Ru;ju=(e,t,a,r,n)=>{let i=1;return i+=e.drawText(a,r+i,"Weight: "+t.breed.stats.weight,n),i+=e.drawText(a,r+i,"Armor: "+t.breed.stats.armor,n),i+=e.drawText(a,r+i,"Poise: "+t.breed.stats.poise,n),i},Su.drawArmorDetails=ju;ku=(e,t)=>{var a,r;const n=(()=>{const e=yt.gameData.player,t=e.contains.filter(e=>null!=e.breed.wearable);return e.wearing.armor&&t.unshift(e.wearing.armor),t.push(null),t})(),[i,s]=e.useState({selected:(null===(a=yt.gameData.player.wearing.armor)||void 0===a?void 0:a.id)||n[0].id||-1,wearing:(null===(r=yt.gameData.player.wearing.armor)||void 0===r?void 0:r.id)||-1});(0,m.floodFill)(e.display,e.bounds,Pu.default.BLACK);let l=12;(0,m.lineDraw)(e.display,(0,o.bound)(e.bounds,{x:0,y:11,w:e.bounds.w,h:e.bounds.h}),"-");const d=[],u=i.wearing&&n.find(e=>(null==e?void 0:e.id)===i.wearing);return u?((0,Su.drawArmorText)(e.display,u,e.bounds.x,e.bounds.y,24),(0,Su.drawArmorDetails)(e.display,u,e.bounds.x+24,e.bounds.y,e.bounds.w-24)):e.display.drawText(e.bounds.x,e.bounds.y,"Wearing: None"),n.forEach(t=>{if(null==t)null==i.selected&&d.push((0,o.createElement)(io.TextType,{x:0,y:l,w:1,h:1},{title:">"})),e.display.drawText(e.bounds.x+1,e.bounds.y+l,`%c{${null===i.selected?Pu.default.B_GREY_5:null===i.wearing?Pu.default.RED_4:Pu.default.B_GREY_3}}None`,e.bounds.w-24);else if(t.breed.wearable){if(i.selected===t.id){d.push((0,o.createElement)(io.TextType,{x:0,y:l,w:1,h:1},{title:">"}));const a=(0,Su.drawArmorText)(e.display,t,e.bounds.x+24,e.bounds.y+12,24);(0,Su.drawArmorDetails)(e.display,t,e.bounds.x+24,e.bounds.y+12+a,e.bounds.w-24)}d.push((0,o.createElement)(io.TextType,{x:1,y:l,w:30,h:1},{title:`%c{${i.selected===t.id?Pu.default.B_GREY_5:i.wearing===t.id?Pu.default.RED_4:Pu.default.B_GREY_3}}${t.breed.logName}${i.wearing===t.id?" (Wearing)":""}`})),l+=1}}),e.display.drawText(e.bounds.x,e.bounds.y+e.bounds.h-1,`%c{${Pu.default.RED_4}} Enter %c{}Select %c{${Pu.default.RED_4}}Esc%c{} Cancel`),e.handlers.keypress=e=>{if((0,Ll.isUpKey)(e)){const e=n.findIndex(e=>((null==e?void 0:e.id)||null)===i.selected);var t;if(0<e)s({selected:(null===(t=n[e-1])||void 0===t?void 0:t.id)||null})}else if((0,Ll.isDownKey)(e)){const e=n.findIndex(e=>((null==e?void 0:e.id)||null)===i.selected);var a;if(e<n.length-1)s({selected:(null===(a=n[e+1])||void 0===a?void 0:a.id)||null})}else{var r;if("Enter"===e)return i.selected!==(null===(r=yt.gameData.player.wearing.armor)||void 0===r?void 0:r.id)&&(0,yt.runPlayerAction)((0,la.createAction)(uu.wearArmor,yt.gameData.player,{id:i.selected})),(0,st.closeModal)(),!0;if("Escape"===e)return(0,st.closeModal)(),!0}return!0},d},Du.WearableModal=ku;var Cu={};Object.defineProperty(Cu,"__esModule",{value:!0});var Iu=void 0;Cu.WieldableModal=Iu;var Lu=function(e){return e&&e.__esModule?e:{default:e}}(h),Bu={};Object.defineProperty(Bu,"__esModule",{value:!0});var Nu=(Uu=void 0,Bu.weaponInfoDraw=Uu);Bu.WeaponDisplay=Nu;var $u=function(e){return e&&e.__esModule?e:{default:e}}(h);const Fu=(e,t)=>`%c{${e}}${t}%c{}`,Wu=(e,t,a,r,n)=>{const i=n.breed;a+=e.drawText(t,a,Fu($u.default.B_GREY_5,i.name),r);const o=i.stats;o&&(a+=e.drawText(t,a,Fu($u.default.B_GREY_5,"Weight: "+o.weight),r)),a+=1,a+=e.drawText(t,a,i.info,r),a+=1,a+=e.drawText(t,a,`%c{${$u.default.B_GREY_3}}${n.breed.description}`,r),a+=1;const s=n.breed.attacks;var l,d;s&&(e.drawText(t,a,"One Handed"),null!==(l=n.breed.attacks)&&void 0!==l&&l.onehanded.blocks?(0,au.drawShieldDetails)(e,yt.gameData.player,s.onehanded,t,a,Math.floor(r/2),$u.default.B_GREY_5):(e.drawText(t,a,"One Handed"),(0,au.drawAttackDetails)(e,yt.gameData.player,s.onehanded,t,a,Math.floor(r/2),$u.default.B_GREY_5)),null!==(d=n.breed.attacks)&&void 0!==d&&d.twohanded.blocks?(e.drawText(t+Math.floor(r/2)+1,a,"Two Handed"),(0,au.drawShieldDetails)(e,yt.gameData.player,s.twohanded,t+Math.floor(r/2)+1,a,Math.floor(r/2),$u.default.B_GREY_5)):(e.drawText(t+Math.floor(r/2)+1,a,"Two Handed"),(0,au.drawAttackDetails)(e,yt.gameData.player,s.twohanded,t+Math.floor(r/2)+1,a,Math.floor(r/2),$u.default.B_GREY_5)))};var Uu=Wu;Bu.weaponInfoDraw=Uu;Nu=(e,{left:t,right:a})=>{const r=Math.floor(e.bounds.w/2)+e.bounds.x+1;(0,m.vertLineDraw)(e.display,{x:r-1,y:e.bounds.y,w:1,h:e.bounds.h}),null==t?(e.display.drawText(e.bounds.x,e.bounds.y,"Left Hand:"),e.display.drawText(e.bounds.x,e.bounds.y+1,`%c{${$u.default.B_GREY_3}} None`)):(e.display.drawText(e.bounds.x,e.bounds.y,"Left Hand:"),Wu(e.display,e.bounds.x,e.bounds.y+2,r-e.bounds.x,t)),null==a?(e.display.drawText(r,e.bounds.y,"Right Hand:"),e.display.drawText(r,e.bounds.y+1,`%c{${$u.default.B_GREY_3}} None`)):(e.display.drawText(r,e.bounds.y,"Right Hand:"),Wu(e.display,r,e.bounds.y+1,e.bounds.w-1-r,a))},Bu.WeaponDisplay=Nu;Iu=(e,t)=>{var a,r,n,i;const s=(()=>{const e=yt.gameData.player,t=e.contains.filter(e=>e.breed.attacks);return e.wielding.left&&t.unshift(e.wielding.left),e.wielding.right&&t.unshift(e.wielding.right),t})(),[l,d]=e.useState({selected:(null===(a=yt.gameData.player.wielding.left)||void 0===a?void 0:a.id)||(null===(r=yt.gameData.player.wielding.right)||void 0===r?void 0:r.id)||s[0].id||-1,left:(null===(n=yt.gameData.player.wielding.left)||void 0===n?void 0:n.id)||-1,right:(null===(i=yt.gameData.player.wielding.right)||void 0===i?void 0:i.id)||-1});(0,m.floodFill)(e.display,e.bounds,Lu.default.BLACK);let u=24;(0,m.lineDraw)(e.display,(0,o.bound)(e.bounds,{x:0,y:23,w:e.bounds.w,h:e.bounds.h}),"-");const c=[],h=l.left&&s.find(e=>e.id===l.left),f=l.right&&s.find(e=>e.id===l.right);return c.push((0,o.createElement)(Bu.WeaponDisplay,{x:0,y:0,w:e.bounds.w,h:23},{left:h,right:f})),s.forEach(t=>{t.breed.attacks&&(l.selected===t.id&&(c.push((0,o.createElement)(io.TextType,{x:0,y:u,w:1,h:1},{title:">"})),(0,Bu.weaponInfoDraw)(e.display,e.bounds.x+32,e.bounds.y+24,e.bounds.w-33,t)),c.push((0,o.createElement)(io.TextType,{x:1,y:u,w:30,h:1},{title:`%c{${l.selected===t.id?Lu.default.B_GREY_5:l.left===t.id||l.right===t.id?Lu.default.RED_4:Lu.default.B_GREY_3}}${t.breed.name}${l.right===t.id?" (Right Hand)":l.left===t.id?" (Left Hand)":""}`})),u+=1)}),e.display.drawText(e.bounds.x,e.bounds.y+e.bounds.h-2,"Use Left & Right to select weapon for that hand"),e.display.drawText(e.bounds.x,e.bounds.y+e.bounds.h-1,`%c{${Lu.default.RED_4}} Enter %c{}Confirm %c{${Lu.default.RED_4}}Esc%c{} Cancel`),e.handlers.keypress=e=>{if((0,Ll.isUpKey)(e)){const e=s.findIndex(e=>e.id===l.selected);0<e&&d({selected:s[e-1].id})}else if((0,Ll.isDownKey)(e)){const e=s.findIndex(e=>e.id===l.selected);e<s.length-1&&d({selected:s[e+1].id})}else if((0,Ll.isLeftKey)(e))l.left===l.selected?d({left:null}):d({left:l.selected,right:l.selected===l.right?null:l.right});else if((0,Ll.isRightKey)(e))l.right===l.selected?d({right:null}):d({right:l.selected,left:l.selected===l.left?null:l.left});else{var t,a;if("Enter"===e)return l.left===(null===(t=yt.gameData.player.wielding.left)||void 0===t?void 0:t.id)&&l.right===(null===(a=yt.gameData.player.wielding.right)||void 0===a?void 0:a.id)||(0,yt.runPlayerAction)((0,la.createAction)(uu.wieldWeapon,yt.gameData.player,{left:l.left,right:l.right})),(0,st.closeModal)(),!0;if("Escape"===e)return(0,st.closeModal)(),!0}return!0},c},Cu.WieldableModal=Iu;var Gu={};Object.defineProperty(Gu,"__esModule",{value:!0});var Yu=void 0;Gu.DropModal=Yu;var Hu=function(e){return e&&e.__esModule?e:{default:e}}(h),zu={};Object.defineProperty(zu,"__esModule",{value:!0});var Ku=void 0;zu.ItemInfoDisplay=Ku;var Xu=function(e){return e&&e.__esModule?e:{default:e}}(h);Ku=(e,{item:t})=>{if(null===t)return void e.display.drawText(e.bounds.x,e.bounds.y,"None");let a=e.display.drawText(e.bounds.x,e.bounds.y,t.breed.info,e.bounds.w-1);a+=1,a+=e.display.drawText(e.bounds.x,e.bounds.y+a,`%c{${Xu.default.B_GREY_3}}${t.breed.description}`,e.bounds.w-1);let r=a+e.bounds.y+1;const n=t.breed;t.uses&&(e.display.drawText(e.bounds.x,r,`Uses: ${t.uses.current} / ${t.uses.max}`),r+=1),n.stats&&(null!=n.stats.weight&&e.display.drawText(e.bounds.x,r,"Weight: "+n.stats.weight),null!=n.stats.armor&&e.display.drawText(e.bounds.x,r+1,"Armor: "+n.stats.armor),null!=n.stats.poise&&e.display.drawText(e.bounds.x,r+2,"Poise: "+n.stats.poise))},zu.ItemInfoDisplay=Ku;Yu=(e,t)=>{const[a,r]=e.useState({selected:0,id:null});(0,m.floodFill)(e.display,e.bounds,Hu.default.BLACK);let n=0;e.display.draw(e.bounds.x,e.bounds.y+n+a.selected,">",Hu.default.B_GREY_5,null);const i=[],s=[];return yt.gameData.player.contains.forEach((t,r)=>{t.breed.mandatory||(s.push(t.id),i.push((0,o.createElement)(io.TextType,{x:1,y:n,w:20,h:1},{title:`%c{${a.selected===r?Hu.default.B_GREY_5:Hu.default.B_GREY_3}}${t.breed.name}`})),r===a.selected&&i.push((0,o.createElement)(zu.ItemInfoDisplay,{x:30,y:0,w:e.bounds.w-31,h:e.bounds.h-1},{item:t})),n+=1)}),e.display.drawText(e.bounds.x,e.bounds.y+e.bounds.h-1,`%c{${Hu.default.RED_4}} Enter %c{}Confirm %c{${Hu.default.RED_4}}Esc%c{} Cancel`),e.handlers.keypress=e=>{if((0,Ll.isUpKey)(e)&&0<a.selected)r({selected:a.selected-1});else if((0,Ll.isDownKey)(e)&&a.selected<s.length-1)r({selected:a.selected+1});else{if("Enter"===e)return(0,yt.runPlayerAction)((0,la.createAction)(uu.dropItem,yt.gameData.player,{id:s[a.selected]})),(0,st.closeModal)(),!0;if("Escape"===e)return(0,st.closeModal)(),!0}return!0},i},Gu.DropModal=Yu;var Vu={};Object.defineProperty(Vu,"__esModule",{value:!0});var qu=void 0;Vu.PickupModal=qu;var Zu=function(e){return e&&e.__esModule?e:{default:e}}(h);qu=(e,t)=>{const[a,r]=e.useState({selected:0,id:null});(0,m.floodFill)(e.display,e.bounds,Zu.default.BLACK);let n=0;e.display.draw(e.bounds.x,e.bounds.y+n+a.selected,">",Zu.default.B_GREY_5,null);const i=[],s=[];return(0,yt.getItemsForPosition)(yt.gameData.player.x,yt.gameData.player.y).forEach((t,r)=>{t.breed.furniture||(s.push(t.id),i.push((0,o.createElement)(io.TextType,{x:1,y:n,w:20,h:1},{title:`%c{${a.selected===r?Zu.default.B_GREY_5:Zu.default.B_GREY_3}}${t.breed.name}`})),r===a.selected&&i.push((0,o.createElement)(zu.ItemInfoDisplay,{x:30,y:0,w:e.bounds.w-31,h:e.bounds.h-7},{item:t})),n+=1)}),e.display.drawText(e.bounds.x,e.bounds.y+e.bounds.h-1,`%c{${Zu.default.RED_4}} Enter %c{}Confirm %c{${Zu.default.RED_4}}Esc%c{} Cancel`),e.handlers.keypress=e=>{if((0,Ll.isUpKey)(e)&&0<a.selected)r({selected:a.selected-1});else if((0,Ll.isDownKey)(e)&&a.selected<s.length-1)r({selected:a.selected+1});else{if("Enter"===e)return(0,yt.runPlayerAction)((0,la.createAction)(uu.pickupItem,yt.gameData.player,{id:s[a.selected]})),(0,st.closeModal)(),!0;if("Escape"===e)return(0,st.closeModal)(),!0}return!0},i},Vu.PickupModal=qu;var Qu={};Object.defineProperty(Qu,"__esModule",{value:!0});var Ju=void 0;Qu.UseModal=Ju;var ec=function(e){return e&&e.__esModule?e:{default:e}}(h);Ju=(e,t)=>{const[a,r]=e.useState({selected:0,id:null});(0,m.floodFill)(e.display,e.bounds,ec.default.BLACK);let n=0;e.display.draw(e.bounds.x,e.bounds.y+n+a.selected,">",ec.default.B_GREY_5,null);const i=[],s=[];return yt.gameData.player.contains.forEach((t,r)=>{null!=t.breed.usable&&(s.push(t.id),i.push((0,o.createElement)(io.TextType,{x:1,y:n,w:20,h:1},{title:`%c{${a.selected===r?ec.default.B_GREY_5:ec.default.B_GREY_3}}${t.breed.name}`})),r===a.selected&&i.push((0,o.createElement)(zu.ItemInfoDisplay,{x:30,y:0,w:e.bounds.w-31,h:e.bounds.h-1},{item:t})),n+=1)}),e.handlers.keypress=e=>{if((0,Ll.isUpKey)(e)&&0<a.selected)r({selected:a.selected-1});else if((0,Ll.isDownKey)(e)&&a.selected<s.length-1)r({selected:a.selected+1});else{if("Enter"===e){var t;const e=yt.gameData.player.contains.get(s[a.selected]);return null!=e&&null!==(t=e.uses)&&void 0!==t&&t.current?(0,yt.runPlayerAction)((0,la.createAction)(uu.useItem,yt.gameData.player,{id:s[a.selected]})):e&&(0,Qe.log)("No uses remaining for "+e.breed.logName),(0,st.closeModal)(),!0}if("Escape"===e)return(0,st.closeModal)(),!0}return!0},i},Qu.UseModal=Ju;du=e=>[(0,o.createElement)(u.ButtonComp,{x:0,y:0,w:e.bounds.w,h:1},{title:"Use Item",keys:"u",showKey:!0,onClick:()=>{yt.gameData.actionPending||(0,st.openModal)((0,o.createElement)(Qu.UseModal,{x:0,y:0,w:60,h:32}))}}),(0,o.createElement)(u.ButtonComp,{x:0,y:1,w:e.bounds.w,h:1},{title:"Pickup Item",keys:"p",showKey:!0,onClick:()=>{if(!yt.gameData.actionPending){if(16<yt.gameData.player.contains.size)return void(0,Qe.log)("Cannot pick up items, inventory full");(0,yt.getItemsForPosition)(yt.gameData.player.x,yt.gameData.player.y).find(e=>!e.breed.furniture)?(0,st.openModal)((0,o.createElement)(Vu.PickupModal,{x:0,y:0,w:60,h:32})):(0,Qe.log)("Nothing here to pick up.")}}}),(0,o.createElement)(u.ButtonComp,{x:0,y:2,w:e.bounds.w,h:1},{title:"Equip Weapon",keys:"r",showKey:!0,onClick:()=>{yt.gameData.actionPending||(0,st.openModal)((0,o.createElement)(Cu.WieldableModal,{x:0,y:0,w:78,h:46}))}}),(0,o.createElement)(u.ButtonComp,{x:0,y:3,w:e.bounds.w,h:1},{title:"Wear Armor",keys:"q",showKey:!0,onClick:()=>{yt.gameData.actionPending||(0,st.openModal)((0,o.createElement)(Du.WearableModal,{x:0,y:0,w:48,h:36}))}}),(0,o.createElement)(u.ButtonComp,{x:0,y:4,w:e.bounds.w,h:1},{title:"Drop Item",keys:"o",showKey:!0,onClick:()=>{yt.gameData.actionPending||(yt.gameData.player.contains.find(e=>!e.breed.mandatory)?(0,st.openModal)((0,o.createElement)(Gu.DropModal,{x:0,y:0,w:60,h:32})):(0,Qe.log)("Nothing to drop"))}}),(0,o.createElement)(u.ButtonComp,{x:0,y:5,w:e.bounds.w,h:1},{title:"Swap 1h/2h stance",keys:"t",showKey:!0,onClick:()=>{yt.gameData.actionPending||(0,yt.runPlayerAction)((0,la.createAction)(uu.stanceChange,yt.gameData.player,null))}}),(0,o.createElement)(u.ButtonComp,{x:0,y:6,w:e.bounds.w,h:1},{title:"Interact",keys:"z",showKey:!0,onClick:()=>{if(!yt.gameData.actionPending){(0,yt.getItemsForPosition)(yt.gameData.player.x,yt.gameData.player.y).filter(e=>e.breed.interact).length?(0,yt.runPlayerAction)((0,la.createAction)(uu.interact,yt.gameData.player,null)):(0,Qe.log)("There is nothing to interact with here")}}})],lu.InventoryControls=du;Kd=e=>{const t=e.bounds.h-8;return[(0,o.createElement)(Xd.TabbedContents,{x:0,y:0,w:e.bounds.w,h:t},{children:[{keys:["E","e"],title:"quip",value:(0,o.createElement)(Jd.EquipmentPanel,{x:0,y:0,w:e.bounds.w,h:t-1})},{keys:["I","i"],title:"nventory",value:(0,o.createElement)(ou.ContainsPanel,{x:0,y:0,w:e.bounds.w,h:t-1})}]}),(0,o.createElement)(lu.InventoryControls,{x:0,y:t+1,w:e.bounds.w,h:e.bounds.h-t})]},zd.InventoryPanel=Kd;var tc={};Object.defineProperty(tc,"__esModule",{value:!0});var ac=void 0;tc.TopInfo=ac;var rc=function(e){return e&&e.__esModule?e:{default:e}}(h),nc={};Object.defineProperty(nc,"__esModule",{value:!0});var ic=void 0;nc.HelpModal=ic;var oc=function(e){return e&&e.__esModule?e:{default:e}}(h),sc={};Object.defineProperty(sc,"__esModule",{value:!0});var lc=void 0;sc.HelpComponent=lc;var dc=function(e){return e&&e.__esModule?e:{default:e}}(h);const uc=e=>`%c{${dc.default.RED_4}}${e}%c{}`,cc=`%c{${dc.default.RED_4}}w%c{}/%c{${dc.default.RED_4}}a%c{}/%c{${dc.default.RED_4}}s%c{}/%c{${dc.default.RED_4}}d%c{}`,hc=`%c{${dc.default.RED_4}}h%c{}/%c{${dc.default.RED_4}}j%c{}/%c{${dc.default.RED_4}}k%c{}/%c{${dc.default.RED_4}}l%c{}`,fc=`%c{${dc.default.RED_4}}Arrows%c{}`,gc=`Each Shrine(%c{${dc.default.RED_4}}_%c{}) can be used to rest as often as you need. But beware, as you rest the world will shift around you. `,pc=`Health %c{${dc.default.B_GREY_3}}Determines how big a weapon you can swing`,mc=`Stamina %c{${dc.default.B_GREY_3}}Used to attack, move or wait to restore`,yc=`Poise %c{${dc.default.B_GREY_3}}Losing all poise causes staggered, making you unable to act (. or any command to advance turn)`,vc=`Strength (STR) %c{${dc.default.B_GREY_3}}Determines how big a weapon you can swing`,wc=`Force (FRC) %c{${dc.default.B_GREY_3}}Improves ability to strike, causing more damage`,bc=`Weapons can be wielded in one or two hands. Use ${uc("1")} or ${uc("2")} to select which hand to attack with. Two hand usage reduces strength requirements. Shields can be used to block attack by moving into an enemy to block all attacks that turn.`,_c=[`${cc} Movement (Also supported: ${hc} or ${fc})`,uc("Shift Movement")+" Sprint 2 tiles in a direction",uc(".")+" Wait a turn, restoring stamina",uc("?")+" Open this help dialogue"],xc=`The map features two levels of terrain, use ramps (%b{${dc.default.BROWN_4}} %b{${dc.default.BROWN_2}}%c{${dc.default.BROWN_4}}${Ae.TILE_TYPES._L}%c{}%b{}) to go between levels or jump down anywhere.`;lc=e=>{let t=e.bounds.y;_c.forEach(a=>{t+=e.display.drawText(e.bounds.x,t,a,e.bounds.w)}),t+=1,t+=1+e.display.drawText(e.bounds.x,t,gc,e.bounds.w),t+=1+e.display.drawText(e.bounds.x,t,"Carry weight affects your capabilities, under 25% and you can sprint attack and move freely, over 75% and you will move after enemies and cannot sprint",e.bounds.w),t+=e.display.drawText(e.bounds.x,t,pc,e.bounds.w),t+=e.display.drawText(e.bounds.x,t,mc,e.bounds.w),t+=e.display.drawText(e.bounds.x,t,yc,e.bounds.w),t+=1,t+=e.display.drawText(e.bounds.x,t,vc,e.bounds.w),t+=e.display.drawText(e.bounds.x,t,wc,e.bounds.w),t+=1,t+=1+e.display.drawText(e.bounds.x,t,bc,e.bounds.w),t+=e.display.drawText(e.bounds.x,t,xc,e.bounds.w)},sc.HelpComponent=lc;ic=e=>((0,m.floodFill)(e.display,e.bounds,oc.default.BLACK),e.display.drawText(e.bounds.x+e.bounds.w/2-26,e.bounds.y+e.bounds.h-2,`%c{${oc.default.RED_4}}Enter%c{} or %c{${oc.default.RED_4}}Escape%c{} Close Help`),e.handlers.keypress=e=>("Enter"!==e&&"Escape"!==e||(0,st.closeModal)(),!0),[(0,o.createElement)(sc.HelpComponent,{x:0,y:0,w:e.bounds.w,h:e.bounds.h-2})]),nc.HelpModal=ic;ac=(e,t)=>{e.display.drawText(e.bounds.x+5,e.bounds.y,`Depth ${yt.gameData.current.depth} of 5`),e.display.drawText(e.bounds.x+e.bounds.w-11,e.bounds.y,`%c{${rc.default.RED_4}}?%c{} Help`),e.handlers.keypress=e=>("/"===e||"?"===e)&&((0,st.openModal)((0,o.createElement)(nc.HelpModal,{x:0,y:0,w:78,h:46})),!0)},tc.TopInfo=ac;class Tc extends be.Scene{ui=(0,o.createElement)(M.Container,{x:0,y:0,w:80,h:48},{children:[(0,o.createElement)(tc.TopInfo,{x:24,w:30,y:0,h:1}),(0,o.createElement)(Sd.MapUI,{x:24,w:32,y:1,h:35}),(0,o.createElement)(gt.PanelGroup,{x:0,y:0,w:24,h:48},{children:[{title:"Stats",value:(0,o.createElement)(Od.StatsPanel,{x:0,y:0,w:22,h:12})},{value:(0,o.createElement)(zd.InventoryPanel,{x:0,y:0,w:22,h:32})}]}),(0,o.createElement)(T.Panel,{x:23,y:36,w:57,h:12},{children:[(0,o.createElement)(Xe.LogList,{x:0,y:0,w:55,h:10})]}),(0,o.createElement)(T.Panel,{x:56,y:0,w:24,h:37},{children:[(0,o.createElement)(Ud.TileContents,{x:0,y:0,w:22,h:35})]}),(0,o.createElement)(st.Modal,{x:0,y:0,w:80,h:48})]});constructor(){super(),(0,yt.initializeState)()}update(e,t){yt.gameData.gibs.forEach(e=>e.update(t)),yt.gameData.particles.forEach(e=>e.update(t))}}Ke=Tc,ze.GameScene=Ke;Ye=e=>((0,m.floodFill)(e.display,{x:8,y:0,h:e.bounds.h,w:4},He.default.B_GREY_1),(0,m.floodFill)(e.display,{x:0,y:7,h:3,w:e.bounds.w},He.default.B_GREY_1),e.display.drawText(e.bounds.x+12,e.bounds.y+8,`%b{${He.default.B_GREY_1}}Pieux`,16),e.display.drawText(e.bounds.x+e.bounds.w/2-9,e.bounds.y+e.bounds.h-2,`%c{${He.default.RED_4}}Enter%c{} - Start Game`),e.handlers.keypress=e=>"Enter"===e&&((0,be.setScene)(new ze.GameScene),!0),[(0,o.createElement)(sc.HelpComponent,{x:14,y:12,w:e.bounds.w-14,h:e.bounds.h-10})]),Ge.HomeComponent=Ye;class Ec extends be.Scene{ui=(0,o.createElement)(Ge.HomeComponent,{x:0,y:0,w:80,h:48})}let Mc;Ue=Ec,We.Main=Ue,async function(){const e=await(0,Ae.getTileOptions)();Mc=new R.RDisplay({width:80,height:48,...e}),(0,be.setScene)(new We.Main),window.onmousedown=e=>{(0,a.handleMouseEvent)((0,be.getScene)().ui,"press",Mc.eventToPosition(e))},window.onmouseup=e=>{(0,a.handleMouseEvent)((0,be.getScene)().ui,"release",Mc.eventToPosition(e))},window.onmousemove=e=>{(0,a.handleHover)((0,be.getScene)().ui,Mc.eventToPosition(e))},window.onkeydown=e=>{(0,a.handleKeyEvent)((0,be.getScene)().ui,"keypress",e.key,e.shiftKey)};const t=Mc.getContainer();if(t){var r;null===(r=document.getElementById("app"))||void 0===r||r.append(t),requestAnimationFrame(kc)}}();let Ac=0,Dc=1e3/30;function kc(e){if(!document.hidden){const t=(0,be.getScene)();if(Dc+=e-(Ac||e),Ac=e,Dc>=1e3/30){for(;Dc>=1e3/30;)Dc-=1e3/30,t.update(Mc,1e3/30);Mc.clear(),t.render(Mc)}}requestAnimationFrame(kc)}}();
//# sourceMappingURL=FourSouls.79ab49a7.js.map