var t = require; var e = module; var i = exports; var a; function r(t) { return -1 < "+-*/()".indexOf(t); } function l(t) { switch (t) { case "+": case "-": return 1; case "*": case "/": return 2; default: return 0; } } Object.defineProperty(i, "__esModule", {value: !0}), (i.MathUtils = i.Dir = void 0), ((e = a = i.Dir || (i.Dir = {}))[(e.Top = 0)] = "Top"), (e[(e.TopRight = 1)] = "TopRight"), (e[(e.Right = 2)] = "Right"), (e[(e.BottomRight = 3)] = "BottomRight"), (e[(e.Bottom = 4)] = "Bottom"), (e[(e.BottomLeft = 5)] = "BottomLeft"), (e[(e.Left = 6)] = "Left"), (e[(e.TopLeft = 7)] = "TopLeft"), (i.MathUtils = class { getAngle(t) { return (180 * t) / Math.PI; } getRadian(t) { return (t / 180) * Math.PI; } getRadian2(t, e, i, s) { return Math.atan2(s - e, i - t); } getDistance(t, e, i, s) { (t = i - t), (e = s - e); return Math.sqrt(t * t + e * e); } computeGameObjDir(t, e, i, s) { var o, s = this.getRadian2(t, e, i, s), s = this.getAngle(s); return ( 0 == s ? (o = a.Right) : 90 == s ? (o = a.Bottom) : 180 == s ? (o = a.Left) : -90 == s ? (o = a.Top) : 0 < s && s < 90 ? (o = a.BottomRight) : 90 < s && s < 180 ? (o = a.BottomLeft) : -180 < s && s < -90 ? (o = a.TopLeft) : -90 < s && s < 0 && (o = a.TopRight), o ); } evalRpn(t) { let e = (function (t) { for (var e, i = t.match(/(\(|\)|\*|\+|\-|\/|\d+\.?\d*)/g), s = [], o = []; 0 < i.length; ) { var a = i.shift(); if (r(a)) { if ("(" == a) s.push(a); else if (")" == a) { for (var n = s.pop(); "(" != n && 0 < s.length; ) o.push(n), (n = s.pop()); if ("(" != n) throw "error: unmatched ()"; } else { for (; (e = s[s.length - 1]), l(a) <= l(e) && 0 < s.length; ) o.push(s.pop()); s.push(a); } } else o.push(parseFloat(a)); } if (0 < s.length) { if (")" == s[s.length - 1] || "(" == s[s.length - 1]) throw "error: unmatched ()"; for (; 0 < s.length; ) o.push(s.pop()); } return o; })(t); for (var i = []; 0 < e.length; ) { var s = e.shift(); if (r(s)) { if (i.length < 2) throw "unvalid stack length"; var o = i.pop(), a = i.pop(); i.push( (function (t, e, i) { switch (i) { case "+": return t + e; case "-": return t - e; case "*": return t * e; case "/": return t / e; } })(a, o, s) ); } else i.push(s); } if (1 != i.length) throw "unvalid expression"; return i[0]; } });