define("stateMachineEngine", ["clientkernelModulesApi", "clientkernelLoggerApi"],
    function(clientkernelModulesApi, clientkernelLoggerApi) {
        "use strict";

        function $iterator(o) {
            if (o instanceof Array) return function() {
                return {
                    cur: 0,
                    arr: o,
                    hasNext: function() {
                        return this.cur < this.arr.length;
                    },
                    next: function() {
                        return this.arr[this.cur++];
                    }
                };
            };
            return typeof(o.iterator) == 'function' ? $bind(o, o.iterator) : o.iterator;
        };;
        var $fid = 0;

        function $bind(o, m) {
            if (m == null) return null;
            if (m.__id__ == null) m.__id__ = $fid++;
            var f;
            if (o.hx__closures__ == null) o.hx__closures__ = {};
            else f = o.hx__closures__[m.__id__];
            if (f == null) {
                f = function() {
                    return f.method.apply(f.scope, arguments);
                };
                f.scope = o;
                f.method = m;
                o.hx__closures__[m.__id__] = f;
            }
            return f;
        };
        var $_;
        var $estr = function() {
            return _hcmn_.js_Boot.__string_rec(this, '');
        };
        var Xml = function(nodeType) {
            this.nodeType = nodeType;
            this.children = [];
            this.attributeMap = new _hcmn_.haxe_ds_StringMap();
        };
        Xml.__name__ = ["Xml"];
        Xml.prototype.nodeType = null;
        Xml.prototype.nodeName = null;
        Xml.prototype.nodeValue = null;
        Xml.prototype.parent = null;
        Xml.prototype.children = null;
        Xml.prototype.attributeMap = null;
        Xml.prototype.get_nodeName = function() {
            if (this.nodeType != Xml.Element) throw new js._Boot.HaxeError("Bad node type, expected Element but found " + this.nodeType);
            return this.nodeName;
        };
        Xml.prototype.get = function(att) {
            if (this.nodeType != Xml.Element) throw new js._Boot.HaxeError("Bad node type, expected Element but found " + this.nodeType);
            return this.attributeMap.get(att);
        };
        Xml.prototype.set = function(att, value) {
            if (this.nodeType != Xml.Element) throw new js._Boot.HaxeError("Bad node type, expected Element but found " + this.nodeType);
            this.attributeMap.set(att, value);
        };
        Xml.prototype.exists = function(att) {
            if (this.nodeType != Xml.Element) throw new js._Boot.HaxeError("Bad node type, expected Element but found " + this.nodeType);
            return this.attributeMap.exists(att);
        };
        Xml.prototype.elements = function() {
            if (this.nodeType != Xml.Document && this.nodeType != Xml.Element) throw new js._Boot.HaxeError("Bad node type, expected Element or Document but found " + this.nodeType);
            var ret;
            var _g = [];
            var _g1 = 0;
            var _g2 = this.children;
            while (_g1 < _g2.length) {
                var child = _g2[_g1];
                ++_g1;
                if (child.nodeType == Xml.Element) _g.push(child);
            }
            ret = _g;
            return _hcmn_.HxOverrides.iter(ret);
        };
        Xml.prototype.firstElement = function() {
            if (this.nodeType != Xml.Document && this.nodeType != Xml.Element) throw new js._Boot.HaxeError("Bad node type, expected Element or Document but found " + this.nodeType);
            var _g = 0;
            var _g1 = this.children;
            while (_g < _g1.length) {
                var child = _g1[_g];
                ++_g;
                if (child.nodeType == Xml.Element) return child;
            }
            return null;
        };
        Xml.prototype.addChild = function(x) {
            if (this.nodeType != Xml.Document && this.nodeType != Xml.Element) throw new js._Boot.HaxeError("Bad node type, expected Element or Document but found " + this.nodeType);
            if (x.parent != null) x.parent.removeChild(x);
            this.children.push(x);
            x.parent = this;
        };
        Xml.prototype.removeChild = function(x) {
            if (this.nodeType != Xml.Document && this.nodeType != Xml.Element) throw new js._Boot.HaxeError("Bad node type, expected Element or Document but found " + this.nodeType);
            if (_hcmn_.HxOverrides.remove(this.children, x)) {
                x.parent = null;
                return true;
            }
            return false;
        };
        Xml.parse = function(str) {
            return haxe.xml.Parser.parse(str);
        };
        Xml.createElement = function(name) {
            var xml = new Xml(Xml.Element);
            if (xml.nodeType != Xml.Element) throw new js._Boot.HaxeError("Bad node type, expected Element but found " + xml.nodeType);
            xml.nodeName = name;
            return xml;
        };
        Xml.createPCData = function(data) {
            var xml = new Xml(Xml.PCData);
            if (xml.nodeType == Xml.Document || xml.nodeType == Xml.Element) throw new js._Boot.HaxeError("Bad node type, unexpected " + xml.nodeType);
            xml.nodeValue = data;
            return xml;
        };
        Xml.createCData = function(data) {
            var xml = new Xml(Xml.CData);
            if (xml.nodeType == Xml.Document || xml.nodeType == Xml.Element) throw new js._Boot.HaxeError("Bad node type, unexpected " + xml.nodeType);
            xml.nodeValue = data;
            return xml;
        };
        Xml.createComment = function(data) {
            var xml = new Xml(Xml.Comment);
            if (xml.nodeType == Xml.Document || xml.nodeType == Xml.Element) throw new js._Boot.HaxeError("Bad node type, unexpected " + xml.nodeType);
            xml.nodeValue = data;
            return xml;
        };
        Xml.createDocType = function(data) {
            var xml = new Xml(Xml.DocType);
            if (xml.nodeType == Xml.Document || xml.nodeType == Xml.Element) throw new js._Boot.HaxeError("Bad node type, unexpected " + xml.nodeType);
            xml.nodeValue = data;
            return xml;
        };
        Xml.createProcessingInstruction = function(data) {
            var xml = new Xml(Xml.ProcessingInstruction);
            if (xml.nodeType == Xml.Document || xml.nodeType == Xml.Element) throw new js._Boot.HaxeError("Bad node type, unexpected " + xml.nodeType);
            xml.nodeValue = data;
            return xml;
        };
        Xml.createDocument = function() {
            return new Xml(Xml.Document);
        };
        Xml.prototype.__class__ = Xml;
        if (typeof haxe == 'undefined') {
            var haxe = {};
        };

        haxe.IMap = function() {}
        haxe.IMap.prototype = {

            get: function(k) {
                return {
                    arguments: ["*"],
                    returns: "null"
                };
            }
        };
        if (!haxe.ds) {
            haxe.ds = {};
        };
        if (!haxe.ds._StringMap) {
            haxe.ds._StringMap = {};
        };
        haxe.ds._StringMap.StringMapIterator = function(map, keys) {
            this.map = map;
            this.keys = keys;
            this.index = 0;
            this.count = keys.length;
        };
        haxe.ds._StringMap.StringMapIterator.__name__ = ["haxe", "ds", "_StringMap", "StringMapIterator"];
        haxe.ds._StringMap.StringMapIterator.prototype.map = null;
        haxe.ds._StringMap.StringMapIterator.prototype.keys = null;
        haxe.ds._StringMap.StringMapIterator.prototype.index = null;
        haxe.ds._StringMap.StringMapIterator.prototype.count = null;
        haxe.ds._StringMap.StringMapIterator.prototype.hasNext = function() {
            return this.index < this.count;
        };
        haxe.ds._StringMap.StringMapIterator.prototype.next = function() {
            return this.map.get(this.keys[this.index++]);
        };
        haxe.ds._StringMap.StringMapIterator.prototype.__class__ = haxe.ds._StringMap.StringMapIterator;
        if (!haxe.xml) {
            haxe.xml = {};
        };
        if (!haxe.xml._Fast) {
            haxe.xml._Fast = {};
        };
        haxe.xml._Fast.NodeAccess = function(x) {
            this.__x = x;
        };
        haxe.xml._Fast.NodeAccess.__name__ = ["haxe", "xml", "_Fast", "NodeAccess"];
        haxe.xml._Fast.NodeAccess.prototype.__x = null;
        haxe.xml._Fast.NodeAccess.prototype.__class__ = haxe.xml._Fast.NodeAccess;
        haxe.xml._Fast.AttribAccess = function(x) {
            this.__x = x;
        };
        haxe.xml._Fast.AttribAccess.__name__ = ["haxe", "xml", "_Fast", "AttribAccess"];
        haxe.xml._Fast.AttribAccess.prototype.__x = null;
        haxe.xml._Fast.AttribAccess.prototype.resolve = function(name) {
            if (this.__x.nodeType == Xml.Document) throw new js._Boot.HaxeError("Cannot access document attribute " + name);
            var v = this.__x.get(name);
            if (v == null) throw new js._Boot.HaxeError(this.__x.get_nodeName() + " is missing attribute " + name);
            return v;
        };
        haxe.xml._Fast.AttribAccess.prototype.__class__ = haxe.xml._Fast.AttribAccess;
        haxe.xml._Fast.HasAttribAccess = function(x) {
            this.__x = x;
        };
        haxe.xml._Fast.HasAttribAccess.__name__ = ["haxe", "xml", "_Fast", "HasAttribAccess"];
        haxe.xml._Fast.HasAttribAccess.prototype.__x = null;
        haxe.xml._Fast.HasAttribAccess.prototype.resolve = function(name) {
            if (this.__x.nodeType == Xml.Document) throw new js._Boot.HaxeError("Cannot access document attribute " + name);
            return this.__x.exists(name);
        };
        haxe.xml._Fast.HasAttribAccess.prototype.__class__ = haxe.xml._Fast.HasAttribAccess;
        haxe.xml._Fast.HasNodeAccess = function(x) {
            this.__x = x;
        };
        haxe.xml._Fast.HasNodeAccess.__name__ = ["haxe", "xml", "_Fast", "HasNodeAccess"];
        haxe.xml._Fast.HasNodeAccess.prototype.__x = null;
        haxe.xml._Fast.HasNodeAccess.prototype.__class__ = haxe.xml._Fast.HasNodeAccess;
        haxe.xml._Fast.NodeListAccess = function(x) {
            this.__x = x;
        };
        haxe.xml._Fast.NodeListAccess.__name__ = ["haxe", "xml", "_Fast", "NodeListAccess"];
        haxe.xml._Fast.NodeListAccess.prototype.__x = null;
        haxe.xml._Fast.NodeListAccess.prototype.__class__ = haxe.xml._Fast.NodeListAccess;
        haxe.xml.Fast = function(x) {
            if (x.nodeType != Xml.Document && x.nodeType != Xml.Element) throw new js._Boot.HaxeError("Invalid nodeType " + x.nodeType);
            this.x = x;
            this.node = new haxe.xml._Fast.NodeAccess(x);
            this.nodes = new haxe.xml._Fast.NodeListAccess(x);
            this.att = new haxe.xml._Fast.AttribAccess(x);
            this.has = new haxe.xml._Fast.HasAttribAccess(x);
            this.hasNode = new haxe.xml._Fast.HasNodeAccess(x);
        };
        haxe.xml.Fast.__name__ = ["haxe", "xml", "Fast"];
        haxe.xml.Fast.prototype.x = null;
        haxe.xml.Fast.prototype.node = null;
        haxe.xml.Fast.prototype.nodes = null;
        haxe.xml.Fast.prototype.att = null;
        haxe.xml.Fast.prototype.has = null;
        haxe.xml.Fast.prototype.hasNode = null;
        haxe.xml.Fast.prototype.get_name = function() {
            if (this.x.nodeType == Xml.Document) return "Document";
            else return this.x.get_nodeName();
        };
        haxe.xml.Fast.prototype.get_elements = function() {
            var it = this.x.elements();
            return {
                hasNext: $bind(it, it.hasNext),
                next: function() {
                    var x = it.next();
                    if (x == null) return null;
                    return new haxe.xml.Fast(x);
                }
            };
        };
        haxe.xml.Fast.prototype.__class__ = haxe.xml.Fast;
        haxe.xml.Parser = function() {};
        haxe.xml.Parser.__name__ = ["haxe", "xml", "Parser"];
        haxe.xml.Parser.parse = function(str, strict) {
            if (strict == null) strict = false;
            var doc = Xml.createDocument();
            haxe.xml.Parser.doParse(str, strict, 0, doc);
            return doc;
        };
        haxe.xml.Parser.doParse = function(str, strict, p, parent) {
            if (p == null) p = 0;
            var xml = null;
            var state = 1;
            var next = 1;
            var aname = null;
            var start = 0;
            var nsubs = 0;
            var nbrackets = 0;
            var c = str.charCodeAt(p);
            var buf = new _hcmn_.StringBuf();
            var escapeNext = 1;
            var attrValQuote = -1;
            while (!(c != c)) {
                switch (state) {
                    case 0:
                        switch (c) {
                            case 10:
                            case 13:
                            case 9:
                            case 32:
                                break;
                            default:
                                state = next;
                                continue;
                        }
                        break;
                    case 1:
                        switch (c) {
                            case 60:
                                state = 0;
                                next = 2;
                                break;
                            default:
                                start = p;
                                state = 13;
                                continue;
                        }
                        break;
                    case 13:
                        if (c == 60) {
                            buf.addSub(str, start, p - start);
                            var child = Xml.createPCData(buf.b);
                            buf = new _hcmn_.StringBuf();
                            parent.addChild(child);
                            nsubs++;
                            state = 0;
                            next = 2;
                        } else if (c == 38) {
                            buf.addSub(str, start, p - start);
                            state = 18;
                            escapeNext = 13;
                            start = p + 1;
                        }
                        break;
                    case 17:
                        if (c == 93 && str.charCodeAt(p + 1) == 93 && str.charCodeAt(p + 2) == 62) {
                            var child1 = Xml.createCData(_hcmn_.HxOverrides.substr(str, start, p - start));
                            parent.addChild(child1);
                            nsubs++;
                            p += 2;
                            state = 1;
                        }
                        break;
                    case 2:
                        switch (c) {
                            case 33:
                                if (str.charCodeAt(p + 1) == 91) {
                                    p += 2;
                                    if (_hcmn_.HxOverrides.substr(str, p, 6).toUpperCase() != "CDATA[") throw new js._Boot.HaxeError("Expected <![CDATA[");
                                    p += 5;
                                    state = 17;
                                    start = p + 1;
                                } else if (str.charCodeAt(p + 1) == 68 || str.charCodeAt(p + 1) == 100) {
                                    if (_hcmn_.HxOverrides.substr(str, p + 2, 6).toUpperCase() != "OCTYPE") throw new js._Boot.HaxeError("Expected <!DOCTYPE");
                                    p += 8;
                                    state = 16;
                                    start = p + 1;
                                } else if (str.charCodeAt(p + 1) != 45 || str.charCodeAt(p + 2) != 45) throw new js._Boot.HaxeError("Expected <!--");
                                else {
                                    p += 2;
                                    state = 15;
                                    start = p + 1;
                                }
                                break;
                            case 63:
                                state = 14;
                                start = p;
                                break;
                            case 47:
                                if (parent == null) throw new js._Boot.HaxeError("Expected node name");
                                start = p + 1;
                                state = 0;
                                next = 10;
                                break;
                            default:
                                state = 3;
                                start = p;
                                continue;
                        }
                        break;
                    case 3:
                        if (!(c >= 97 && c <= 122 || c >= 65 && c <= 90 || c >= 48 && c <= 57 || c == 58 || c == 46 || c == 95 || c == 45)) {
                            if (p == start) throw new js._Boot.HaxeError("Expected node name");
                            xml = Xml.createElement(_hcmn_.HxOverrides.substr(str, start, p - start));
                            parent.addChild(xml);
                            nsubs++;
                            state = 0;
                            next = 4;
                            continue;
                        }
                        break;
                    case 4:
                        switch (c) {
                            case 47:
                                state = 11;
                                break;
                            case 62:
                                state = 9;
                                break;
                            default:
                                state = 5;
                                start = p;
                                continue;
                        }
                        break;
                    case 5:
                        if (!(c >= 97 && c <= 122 || c >= 65 && c <= 90 || c >= 48 && c <= 57 || c == 58 || c == 46 || c == 95 || c == 45)) {
                            var tmp;
                            if (start == p) throw new js._Boot.HaxeError("Expected attribute name");
                            tmp = _hcmn_.HxOverrides.substr(str, start, p - start);
                            aname = tmp;
                            if (xml.exists(aname)) throw new js._Boot.HaxeError("Duplicate attribute");
                            state = 0;
                            next = 6;
                            continue;
                        }
                        break;
                    case 6:
                        switch (c) {
                            case 61:
                                state = 0;
                                next = 7;
                                break;
                            default:
                                throw new js._Boot.HaxeError("Expected =");
                        }
                        break;
                    case 7:
                        switch (c) {
                            case 34:
                            case 39:
                                buf = new _hcmn_.StringBuf();
                                state = 8;
                                start = p + 1;
                                attrValQuote = c;
                                break;
                            default:
                                throw new js._Boot.HaxeError("Expected \"");
                        }
                        break;
                    case 8:
                        switch (c) {
                            case 38:
                                buf.addSub(str, start, p - start);
                                state = 18;
                                escapeNext = 8;
                                start = p + 1;
                                break;
                            case 62:
                                if (strict) throw new js._Boot.HaxeError("Invalid unescaped " + String.fromCharCode(c) + " in attribute value");
                                else if (c == attrValQuote) {
                                    buf.addSub(str, start, p - start);
                                    var val = buf.b;
                                    buf = new _hcmn_.StringBuf();
                                    xml.set(aname, val);
                                    state = 0;
                                    next = 4;
                                }
                                break;
                            case 60:
                                if (strict) throw new js._Boot.HaxeError("Invalid unescaped " + String.fromCharCode(c) + " in attribute value");
                                else if (c == attrValQuote) {
                                    buf.addSub(str, start, p - start);
                                    var val1 = buf.b;
                                    buf = new _hcmn_.StringBuf();
                                    xml.set(aname, val1);
                                    state = 0;
                                    next = 4;
                                }
                                break;
                            default:
                                if (c == attrValQuote) {
                                    buf.addSub(str, start, p - start);
                                    var val2 = buf.b;
                                    buf = new _hcmn_.StringBuf();
                                    xml.set(aname, val2);
                                    state = 0;
                                    next = 4;
                                }
                        }
                        break;
                    case 9:
                        p = haxe.xml.Parser.doParse(str, strict, p, xml);
                        start = p;
                        state = 1;
                        break;
                    case 11:
                        switch (c) {
                            case 62:
                                state = 1;
                                break;
                            default:
                                throw new js._Boot.HaxeError("Expected >");
                        }
                        break;
                    case 12:
                        switch (c) {
                            case 62:
                                if (nsubs == 0) parent.addChild(Xml.createPCData(""));
                                return p;
                            default:
                                throw new js._Boot.HaxeError("Expected >");
                        }
                        break;
                    case 10:
                        if (!(c >= 97 && c <= 122 || c >= 65 && c <= 90 || c >= 48 && c <= 57 || c == 58 || c == 46 || c == 95 || c == 45)) {
                            if (start == p) throw new js._Boot.HaxeError("Expected node name");
                            var v = _hcmn_.HxOverrides.substr(str, start, p - start);
                            if (v != (function($this) {
                                    var $r;
                                    if (parent.nodeType != Xml.Element) throw new js._Boot.HaxeError("Bad node type, expected Element but found " + parent.nodeType);
                                    $r = parent.nodeName;
                                    return $r;
                                }(this))) throw new js._Boot.HaxeError("Expected </" + (function($this) {
                                var $r;
                                if (parent.nodeType != Xml.Element) throw "Bad node type, expected Element but found " + parent.nodeType;
                                $r = parent.nodeName;
                                return $r;
                            }(this)) + ">");
                            state = 0;
                            next = 12;
                            continue;
                        }
                        break;
                    case 15:
                        if (c == 45 && str.charCodeAt(p + 1) == 45 && str.charCodeAt(p + 2) == 62) {
                            var xml1 = Xml.createComment(_hcmn_.HxOverrides.substr(str, start, p - start));
                            parent.addChild(xml1);
                            nsubs++;
                            p += 2;
                            state = 1;
                        }
                        break;
                    case 16:
                        if (c == 91) nbrackets++;
                        else if (c == 93) nbrackets--;
                        else if (c == 62 && nbrackets == 0) {
                            var xml2 = Xml.createDocType(_hcmn_.HxOverrides.substr(str, start, p - start));
                            parent.addChild(xml2);
                            nsubs++;
                            state = 1;
                        }
                        break;
                    case 14:
                        if (c == 63 && str.charCodeAt(p + 1) == 62) {
                            p++;
                            var str1 = _hcmn_.HxOverrides.substr(str, start + 1, p - start - 2);
                            var xml3 = Xml.createProcessingInstruction(str1);
                            parent.addChild(xml3);
                            nsubs++;
                            state = 1;
                        }
                        break;
                    case 18:
                        if (c == 59) {
                            var s = _hcmn_.HxOverrides.substr(str, start, p - start);
                            if (s.charCodeAt(0) == 35) {
                                var c1;
                                if (s.charCodeAt(1) == 120) c1 = _hcmn_.Std.parseInt("0" + _hcmn_.HxOverrides.substr(s, 1, s.length - 1));
                                else c1 = _hcmn_.Std.parseInt(_hcmn_.HxOverrides.substr(s, 1, s.length - 1));
                                buf.b += String.fromCharCode(c1);
                            } else if (!haxe.xml.Parser.escapes.exists(s)) {
                                if (strict) throw new js._Boot.HaxeError("Undefined entity: " + s);
                                buf.b += _hcmn_.Std.string("&" + s + ";");
                            } else buf.add(haxe.xml.Parser.escapes.get(s));
                            start = p + 1;
                            state = escapeNext;
                        } else if (!(c >= 97 && c <= 122 || c >= 65 && c <= 90 || c >= 48 && c <= 57 || c == 58 || c == 46 || c == 95 || c == 45) && c != 35) {
                            if (strict) throw new js._Boot.HaxeError("Invalid character in entity: " + String.fromCharCode(c));
                            buf.b += "&";
                            buf.addSub(str, start, p - start);
                            p--;
                            start = p + 1;
                            state = escapeNext;
                        }
                        break;
                }
                c = _hcmn_.StringTools.fastCodeAt(str, ++p);
            }
            if (state == 1) {
                start = p;
                state = 13;
            }
            if (state == 13) {
                if (p != start || nsubs == 0) {
                    buf.addSub(str, start, p - start);
                    var xml4 = Xml.createPCData(buf.b);
                    parent.addChild(xml4);
                    nsubs++;
                }
                return p;
            }
            if (!strict && state == 18 && escapeNext == 13) {
                buf.b += "&";
                buf.addSub(str, start, p - start);
                var xml5 = Xml.createPCData(buf.b);
                parent.addChild(xml5);
                nsubs++;
                return p;
            }
            throw new js._Boot.HaxeError("Unexpected end");
        };
        haxe.xml.Parser.prototype.__class__ = haxe.xml.Parser;
        if (typeof js == 'undefined') {
            var js = {};
        };
        if (!js._Boot) {
            js._Boot = {};
        };
        js._Boot.HaxeError = function(val) {
            Error.call(this);
            this.val = val;
            this.message = String(val);
            if (Error.captureStackTrace) Error.captureStackTrace(this, js._Boot.HaxeError);
        };
        js._Boot.HaxeError.__name__ = ["js", "_Boot", "HaxeError"];
        js._Boot.HaxeError.__super__ = Error;
        for (var k in Error.prototype) js._Boot.HaxeError.prototype[k] = Error.prototype[k];
        js._Boot.HaxeError.prototype.val = null;
        js._Boot.HaxeError.prototype.__class__ = js._Boot.HaxeError;
        if (typeof stateMachineEngine == 'undefined') {
            var stateMachineEngine = {};
        };
        stateMachineEngine.Activator = function(context) {};
        stateMachineEngine.Activator = ck_implements(stateMachineEngine.Activator, clientkernelModulesApi.IModuleActivator);
        stateMachineEngine.Activator.__interfaces__ = [clientkernelModulesApi.IModuleActivator];
        stateMachineEngine.Activator.__name__ = ["stateMachineEngine", "Activator"];
        stateMachineEngine.Activator.prototype.start = function(context) {
            context.getServiceTracker([clientkernelLoggerApi.ILoggerFactory]).then(function(context1) {
                var lf = context1.getAnyService(clientkernelLoggerApi.ILoggerFactory);
                stateMachineEngine.StateMachine.logger = lf.getLogger("StateMachine");
            });
        };
        stateMachineEngine.Activator.prototype.stop = function(context) {};
        stateMachineEngine.Activator.main = function() {};
        stateMachineEngine.Activator.prototype.__class__ = stateMachineEngine.Activator;
        stateMachineEngine.Evaluator = function(contextValues) {
            this._contextValues = contextValues;
        };
        stateMachineEngine.Evaluator.__name__ = ["stateMachineEngine", "Evaluator"];
        stateMachineEngine.Evaluator.prototype._contextValues = null;
        stateMachineEngine.Evaluator.prototype.evaluate = function(condition_str) {
            var condition_arr = condition_str.split(",");
            var _g1 = 0;
            var _g = condition_arr.length;
            while (_g1 < _g) {
                var i = _g1++;
                if (!this.evaluate_item(condition_arr[i])) return false;
            }
            return true;
        };
        stateMachineEngine.Evaluator.prototype.evaluate_item = function(eval_str) {
            if (eval_str.indexOf("!") == 0) return (function($this) {
                var $r;
                var key = eval_str.split("!")[1];
                $r = $this._contextValues.get(key);
                return $r;
            }(this)) == false;
            var regString = new _hcmn_.EReg("(\\w+)(\\W+)(\\w+)", "g");
            var regNumbers = "$1|$2|$3";
            var eval_arr = regString.replace(eval_str, regNumbers).split("|");
            if (eval_arr.length == 1) return this._contextValues.get(eval_arr[0]);
            var compare_value;
            if (_hcmn_.Std.parseInt(eval_arr[2]) != null) compare_value = _hcmn_.Std.parseInt(eval_arr[2]);
            else compare_value = eval_arr[2];
            var operator = eval_arr[1];
            switch (operator) {
                case "==":
                    return this._contextValues.get(eval_arr[0]) == compare_value;
                case "!=":
                    return this._contextValues.get(eval_arr[0]) != compare_value;
                case ">":
                    return this._contextValues.get(eval_arr[0]) > compare_value;
                case "<":
                    return this._contextValues.get(eval_arr[0]) < compare_value;
                case ">=":
                    return this._contextValues.get(eval_arr[0]) >= compare_value;
                case "<=":
                    return this._contextValues.get(eval_arr[0]) <= compare_value;
                default:
                    throw new js._Boot.HaxeError("[Evaluator]: Invalid operator (" + operator + ") found in " + eval_str);
            }
            return false;
        };
        stateMachineEngine.Evaluator.prototype.__class__ = stateMachineEngine.Evaluator;
        stateMachineEngine.FSMInjector = function() {};
        stateMachineEngine.FSMInjector.__name__ = ["stateMachineEngine", "FSMInjector"];
        stateMachineEngine.FSMInjector.registerSM = function(statemachine1, fsm) {
            var stateDefs = new haxe.xml.Fast(Xml.parse(fsm).firstElement());
            var $it0 = stateDefs.get_elements();
            while ($it0.hasNext()) {
                var i = $it0.next();
                var state = new stateMachineEngine.State(i.att.resolve("name"));
                var $it1 = i.get_elements();
                while ($it1.hasNext()) {
                    var currentItem = $it1.next();
                    var _g = currentItem.get_name().toLowerCase();
                    switch (_g) {
                        case "transition":
                            if (currentItem.has.resolve("action") && currentItem.has.resolve("target")) {
                                if (currentItem.has.resolve("condition")) state.defineTrans(currentItem.att.resolve("action"), currentItem.att.resolve("target"), currentItem.att.resolve("condition"));
                                else state.defineTrans(currentItem.att.resolve("action"), currentItem.att.resolve("target"));
                            }
                            break;
                        case "operation":
                            if (currentItem.has.resolve("type") && currentItem.has.resolve("method")) state.defineOperation(currentItem.att.resolve("type"), currentItem.att.resolve("method"));
                            break;
                    }
                }
                statemachine1.registerState(state);
            }
            statemachine1.setInitialState(stateDefs.att.resolve("initial").toString());
            if (stateDefs.has.resolve("final")) statemachine1.setFinalState(stateDefs.att.resolve("final").toString());
            statemachine1.onCreate();
        };
        stateMachineEngine.FSMInjector.prototype.__class__ = stateMachineEngine.FSMInjector;
        stateMachineEngine.FSMRegistry = function() {};
        stateMachineEngine.FSMRegistry.__name__ = ["stateMachineEngine", "FSMRegistry"];
        stateMachineEngine.FSMRegistry.statemachines = null;
        stateMachineEngine.FSMRegistry.registerSM = function(id, statemachine1) {
            if (stateMachineEngine.FSMRegistry.statemachines == null) stateMachineEngine.FSMRegistry.statemachines = new _hcmn_.haxe_ds_StringMap();
            if (stateMachineEngine.FSMRegistry.statemachines.get(id) == null) {
                stateMachineEngine.FSMRegistry.statemachines.set(id, statemachine1);
                statemachine1;
            }
        };
        stateMachineEngine.FSMRegistry.unRegisterSM = function(id) {
            var sm = stateMachineEngine.FSMRegistry.statemachines.get(id);
            if (sm != null) {
                sm.destroy();
                stateMachineEngine.FSMRegistry.statemachines.remove(id);
            } else stateMachineEngine.StateMachine.logger.error("NO STATE MACHINE WITH ID: " + id + " registered in FSMRegistry");
        };
        stateMachineEngine.FSMRegistry.getstatemachine = function(id) {
            if (stateMachineEngine.FSMRegistry.statemachines.exists(id)) return stateMachineEngine.FSMRegistry.statemachines.get(id);
            else {
                stateMachineEngine.StateMachine.logger.error("NO STATE MACHINE WITH ID: " + id + " registered in FSMRegistry");
                return null;
            }
        };
        stateMachineEngine.FSMRegistry.hasstatemachine = function(id) {
            return stateMachineEngine.FSMRegistry.statemachines.exists(id);
        };
        stateMachineEngine.FSMRegistry.destroyAllstatemachines = function() {
            var $it0 = stateMachineEngine.FSMRegistry.statemachines.iterator();
            while ($it0.hasNext()) {
                var sm = $it0.next();
                stateMachineEngine.FSMRegistry.unRegisterSM(sm.statemachineID);
            }
            stateMachineEngine.FSMRegistry.statemachines = null;
        };
        stateMachineEngine.FSMRegistry.prototype.__class__ = stateMachineEngine.FSMRegistry;
        stateMachineEngine.Operation = function() {
            this.type = "";
            this.methods = [];
        };
        stateMachineEngine.Operation.__name__ = ["stateMachineEngine", "Operation"];
        stateMachineEngine.Operation.prototype.type = null;
        stateMachineEngine.Operation.prototype.methods = null;
        stateMachineEngine.Operation.prototype.__class__ = stateMachineEngine.Operation;
        stateMachineEngine.SMContext = function(dispatcher) {
            this.set_contextValues(new _hcmn_.haxe_ds_StringMap());
            this.set_contextMethods(new _hcmn_.haxe_ds_StringMap());
            this._dispatcher = dispatcher;
        };
        stateMachineEngine.SMContext.__name__ = ["stateMachineEngine", "SMContext"];
        stateMachineEngine.SMContext.prototype.contextValues = null;
        stateMachineEngine.SMContext.prototype._contextValues = null;
        stateMachineEngine.SMContext.prototype.contextMethods = null;
        stateMachineEngine.SMContext.prototype._contextMethods = null;
        stateMachineEngine.SMContext.prototype.eventDispatcher = null;
        stateMachineEngine.SMContext.prototype._dispatcher = null;
        stateMachineEngine.SMContext.prototype.get_contextMethods = function() {
            return this._contextMethods;
        };
        stateMachineEngine.SMContext.prototype.set_contextMethods = function(value) {
            return this._contextMethods = value;
        };
        stateMachineEngine.SMContext.prototype.get_contextValues = function() {
            return this._contextValues;
        };
        stateMachineEngine.SMContext.prototype.set_contextValues = function(value) {
            return this._contextValues = value;
        };
        stateMachineEngine.SMContext.prototype.get_eventDispatcher = function() {
            return this._dispatcher;
        };
        stateMachineEngine.SMContext.prototype.setContextValue = function(prop, value) {
            var value1 = value;
            this._contextValues.set(prop, value1);
        };
        stateMachineEngine.SMContext.prototype.setContextMethod = function(methodName, method) {
            this._contextMethods.set(methodName, method);
        };
        stateMachineEngine.SMContext.prototype.__class__ = stateMachineEngine.SMContext;
        stateMachineEngine.SMDClassBuildingMacro = function() {};
        stateMachineEngine.SMDClassBuildingMacro.__name__ = ["stateMachineEngine", "SMDClassBuildingMacro"];
        stateMachineEngine.SMDClassBuildingMacro.prototype.__class__ = stateMachineEngine.SMDClassBuildingMacro;
        stateMachineEngine.State = function(name) {
            this._name = name;
            this.transitions = new _hcmn_.haxe_ds_StringMap();
            this.operations = new _hcmn_.haxe_ds_StringMap();
        };
        stateMachineEngine.State.__name__ = ["stateMachineEngine", "State"];
        stateMachineEngine.State.prototype.name = null;
        stateMachineEngine.State.prototype._name = null;
        stateMachineEngine.State.prototype.transitions = null;
        stateMachineEngine.State.prototype.operations = null;
        stateMachineEngine.State.prototype.defineTrans = function(action, target, condition) {
            var transition = new stateMachineEngine.Transition();
            if (!this.transitions.exists(action)) {
                transition.action = action;
                transition.target.push(target);
                transition.conditions.push(condition); {
                    this.transitions.set(action, transition);
                    transition;
                }
            } else {
                transition = this.transitions.get(action);
                transition.target.push(target);
                transition.conditions.push(condition);
            }
        };
        stateMachineEngine.State.prototype.getTarget = function(action, evaluator) {
            var transition = this.transitions.get(action);
            if (transition != null) {
                if (this.transitions.get(action).conditions.length == 1) return transition.target[0];
                else {
                    var _g1 = 0;
                    var _g = transition.conditions.length;
                    while (_g1 < _g) {
                        var i = _g1++;
                        if (evaluator.evaluate(transition.conditions[i])) return transition.target[i];
                    }
                }
            }
            return null;
        };
        stateMachineEngine.State.prototype.defineOperation = function(type, method) {
            var operation = new stateMachineEngine.Operation();
            if (!this.operations.exists(type)) {
                operation.type = type;
                operation.methods.push(method);
                this.operations.set(type, operation);
            } else {
                operation = this.operations.get(type);
                operation.methods.push(method);
            }
        };
        stateMachineEngine.State.prototype.getOperationMethods = function(type) {
            var operation = this.operations.get(type);
            if (operation != null) return operation.methods;
            return null;
        };
        stateMachineEngine.State.prototype.get_name = function() {
            return this._name;
        };
        stateMachineEngine.State.prototype.set_name = function(value) {
            this._name = value;
            return this._name;
        };
        stateMachineEngine.State.prototype.__class__ = stateMachineEngine.State;
        stateMachineEngine.Event = function(type, bubbles, cancelable) {
            if (cancelable == null) cancelable = false;
            if (bubbles == null) bubbles = false;
            this.type = type;
            this.bubbles = bubbles;
            this.cancelable = cancelable;
            this.eventPhase = stateMachineEngine.EventPhase.AT_TARGET;
        };
        stateMachineEngine.Event.__name__ = ["stateMachineEngine", "Event"];
        stateMachineEngine.Event.prototype.bubbles = null;
        stateMachineEngine.Event.prototype.cancelable = null;
        stateMachineEngine.Event.prototype.currentTarget = null;
        stateMachineEngine.Event.prototype.eventPhase = null;
        stateMachineEngine.Event.prototype.target = null;
        stateMachineEngine.Event.prototype.type = null;
        stateMachineEngine.Event.prototype.__isCancelled = null;
        stateMachineEngine.Event.prototype.__isCancelledNow = null;
        stateMachineEngine.Event.prototype.clone = function() {
            return new stateMachineEngine.Event(this.type, this.bubbles, this.cancelable);
        };
        stateMachineEngine.Event.prototype.stopImmediatePropagation = function() {
            this.__isCancelled = true;
            this.__isCancelledNow = true;
        };
        stateMachineEngine.Event.prototype.stopPropagation = function() {
            this.__isCancelled = true;
        };
        stateMachineEngine.Event.prototype.__class__ = stateMachineEngine.Event;
        stateMachineEngine.StateEvent = function(type, action, state, delay) {
            if (delay == null) delay = 0;
            stateMachineEngine.Event.call(this, type);
            this.action = action;
            this.delay = delay;
            this.state = state;
        };
        stateMachineEngine.StateEvent.__name__ = ["stateMachineEngine", "StateEvent"];
        stateMachineEngine.StateEvent.__super__ = stateMachineEngine.Event;
        for (var k in stateMachineEngine.Event.prototype) stateMachineEngine.StateEvent.prototype[k] = stateMachineEngine.Event.prototype[k];
        stateMachineEngine.StateEvent.prototype.action = null;
        stateMachineEngine.StateEvent.prototype.state = null;
        stateMachineEngine.StateEvent.prototype.delay = null;
        stateMachineEngine.StateEvent.prototype.__class__ = stateMachineEngine.StateEvent;
        stateMachineEngine.StateMachine = function(dispatcher, id) {
            this.dispatchGlobalStateChange = false;
            this.onlyContextDriven = false;
            this.asynchronus = false;
            this.haveContext = false;
            this.logPrefix = "";
            this.logLevel = 3;
            this._dispatcher = dispatcher;
            this.statemachineID = id;
            this.states = new _hcmn_.haxe_ds_StringMap();
        };
        stateMachineEngine.StateMachine.__name__ = ["stateMachineEngine", "StateMachine"];
        stateMachineEngine.StateMachine.prototype._dispatcher = null;
        stateMachineEngine.StateMachine.prototype._smContext = null;
        stateMachineEngine.StateMachine.prototype.evaluator = null;
        stateMachineEngine.StateMachine.prototype.initialState = null;
        stateMachineEngine.StateMachine.prototype.finalState = null;
        stateMachineEngine.StateMachine.prototype.currentState = null;
        stateMachineEngine.StateMachine.prototype.previousState = null;
        stateMachineEngine.StateMachine.prototype.currentStateName = null;
        stateMachineEngine.StateMachine.prototype.statemachineID = null;
        stateMachineEngine.StateMachine.prototype.logLevel = null;
        stateMachineEngine.StateMachine.prototype.logPrefix = null;
        stateMachineEngine.StateMachine.prototype.destroyMethod = null;
        stateMachineEngine.StateMachine.prototype.states = null;
        stateMachineEngine.StateMachine.prototype.haveContext = null;
        stateMachineEngine.StateMachine.prototype.asynchronus = null;
        stateMachineEngine.StateMachine.prototype.onlyContextDriven = null;
        stateMachineEngine.StateMachine.prototype.dispatchGlobalStateChange = null;
        stateMachineEngine.StateMachine.prototype.registerState = function(state) {
            var key = state.get_name();
            this.states.set(key, state);
        };
        stateMachineEngine.StateMachine.prototype.onCreate = function() {
            stateMachineEngine.FSMRegistry.registerSM(this.statemachineID, this);
            this._dispatcher.addEventListener(this.statemachineID + stateMachineEngine.StateEvent.ACTION, $bind(this, this.actionHandle));
            if (this.initialState != null) this.transitionTo(this.initialState);
        };
        stateMachineEngine.StateMachine.prototype.actionHandle = function(stateEvent) {
            if (stateEvent.delay > 0) _hcmn_.haxe_Timer.delay((function(f, a1) {
                return function() {
                    f(a1);
                };
            })($bind(this, this.handleStateAction), stateEvent), stateEvent.delay);
            else if (this.asynchronus) _hcmn_.haxe_Timer.delay((function(f1, a11) {
                return function() {
                    f1(a11);
                };
            })($bind(this, this.handleStateAction), stateEvent), 1);
            else this.handleStateAction(stateEvent);
        };
        stateMachineEngine.StateMachine.prototype.handleStateAction = function(state) {
            var newStateTarget = this.currentState.getTarget(state.action, this.evaluator);
            if (newStateTarget == null) {
                this.log("[ERROR][" + this.currentState.get_name() + "] does not have " + state.action + " action to targetState : " + newStateTarget);
                return;
            }
            var newState = this.states.get(newStateTarget);
            if (newState != null) {
                if (this.onlyContextDriven) {
                    if (state.target == this._smContext) {
                        this.log("[" + this.currentState.get_name() + "] >>> action : (" + state.action + " signal)");
                        this.transitionTo(newState);
                    } else this.log("[" + this.currentState.get_name() + "] >>> action : (" + state.action + " ONLY CONTEXT(" + _hcmn_.Std.string(this._smContext) + ") CAN EXECUTE ACTIONS)");
                } else {
                    this.log("[" + this.currentState.get_name() + "] >>> action : (" + state.action + " signal)");
                    this.transitionTo(newState);
                }
            } else this.log("[ERROR][ STATE " + newStateTarget + " does not exist, check XML ");
        };
        stateMachineEngine.StateMachine.prototype.get_currentStateName = function() {
            return this.currentState.get_name();
        };
        stateMachineEngine.StateMachine.prototype.set_currentStateName = function(value) {
            return this.currentState.set_name(value);
        };
        stateMachineEngine.StateMachine.prototype.transitionTo = function(nextState) {
            if (nextState == null) return;
            if (this.currentState != null) {
                this.log(this.createStateLogMessage(stateMachineEngine.StateMachine.EXIT, this.currentState.get_name(), null, 1));
                var exitMethods = this.currentState.getOperationMethods("exit");
                this.callContextMethods(stateMachineEngine.StateMachine.ENTRY, this.currentState.get_name(), exitMethods);
                this.log(this.createStateLogMessage(stateMachineEngine.StateMachine.EXIT, this.currentState.get_name(), null, 2));
                this._dispatcher.dispatchEvent(new stateMachineEngine.StateEvent(this.statemachineID + this.currentState.get_name() + stateMachineEngine.StateMachine.EXIT_EVENT, null, this.currentState.get_name()));
            }
            this.log(this.createStateLogMessage(stateMachineEngine.StateMachine.ENTRY, null, nextState.get_name(), 1));
            var entryMethods = nextState.getOperationMethods("entry");
            this.callContextMethods(stateMachineEngine.StateMachine.ENTRY, null, entryMethods);
            this.log(this.createStateLogMessage(stateMachineEngine.StateMachine.ENTRY, null, nextState.get_name(), 2));
            this._dispatcher.dispatchEvent(new stateMachineEngine.StateEvent(this.statemachineID + nextState.get_name() + stateMachineEngine.StateMachine.ENTRY_EVENT, null, nextState.get_name()));
            this.previousState = this.currentState;
            this.currentState = nextState;
            this.log(this.createStateLogMessage(stateMachineEngine.StateMachine.IN, this.currentState.get_name(), null, 1));
            var completedMethods = this.currentState.getOperationMethods("do");
            this.callContextMethods(stateMachineEngine.StateMachine.IN, this.currentState.get_name(), completedMethods);
            this.log(this.createStateLogMessage(stateMachineEngine.StateMachine.IN, this.currentState.get_name(), null, 2));
            this._dispatcher.dispatchEvent(new stateMachineEngine.StateEvent(this.statemachineID + this.currentState.get_name() + stateMachineEngine.StateMachine.COMPLETED_EVENT, null, this.currentState.get_name()));
            if (this.dispatchGlobalStateChange) this._dispatcher.dispatchEvent(new stateMachineEngine.StateEvent(this.statemachineID + stateMachineEngine.StateEvent.CHANGE, null, this.currentState.get_name()));
            if (this.finalState != null && this.currentState.get_name() == this.finalState.get_name()) {}
        };
        stateMachineEngine.StateMachine.prototype.getCurrentStateName = function() {
            return this.currentState.get_name();
        };
        stateMachineEngine.StateMachine.prototype.callContextMethods = function(transition, currentStateName, methods) {
            if (currentStateName == null) currentStateName = "";
            if (methods != null) {
                var m;
                var _g = 0;
                while (_g < methods.length) {
                    var m1 = methods[_g];
                    ++_g;
                    this.log(this.createOperationLogMessage(transition, this.currentState.get_name(), m1));
                    ((function($this) {
                        var $r;
                        var this1 = $this._smContext.get_contextMethods();
                        $r = this1.get(m1);
                        return $r;
                    }(this)))();
                }
            }
        };
        stateMachineEngine.StateMachine.prototype.destroy = function() {
            this._dispatcher.removeEventListener(this.statemachineID + stateMachineEngine.StateEvent.ACTION, $bind(this, this.actionHandle));
            this.initialState = this.currentState = this.finalState = null;
            var st;
            var $it0 = this.states.iterator();
            while ($it0.hasNext()) {
                var st1 = $it0.next();
                var k = st1.get_name();
                this.states.set(k, null);
                null;
            }
            this.states = null;
        };
        stateMachineEngine.StateMachine.prototype.setContext = function(smContext) {
            this._smContext = smContext;
            this.haveContext = true;
            this.evaluator = new stateMachineEngine.Evaluator(smContext.get_contextValues());
        };
        stateMachineEngine.StateMachine.prototype.isInState = function(stateID) {
            return this.currentState.get_name() == stateID;
        };
        stateMachineEngine.StateMachine.prototype.log = function(message) {
            if (this.logLevel == 0 && message.indexOf("ERROR") == -1) return;
            var traceSMid = true;
            if (traceSMid && message != "") message = "[" + this.statemachineID + "]" + message;
            var traceUniqueID = true;
            if (traceUniqueID && message != "") message = this.logPrefix + "[SM]" + message;
            if (message != "" && stateMachineEngine.StateMachine.logger != null) stateMachineEngine.StateMachine.logger.debug(message);
        };
        stateMachineEngine.StateMachine.prototype.createStateLogMessage = function(transition, currentStateName, nextStateName, phase) {
            if (nextStateName == null) nextStateName = "";
            if (currentStateName == null) currentStateName = "";
            var msg = "";
            if (transition == stateMachineEngine.StateMachine.EXIT) {
                if (this.logLevel > 1 && phase == 1) msg = "[" + currentStateName + "] --> exiting";
                else msg = "";
                if (this.logLevel > 2 && phase == 2) msg += ": (" + currentStateName + stateMachineEngine.StateMachine.EXIT_EVENT + " dispatching)";
                else msg += "";
            } else if (transition == stateMachineEngine.StateMachine.ENTRY) {
                if (this.logLevel > 1 && phase == 1) msg = "[" + nextStateName + "] <-- entering";
                else msg = "";
                if (this.logLevel > 2 && phase == 2) msg += ": (" + nextStateName + stateMachineEngine.StateMachine.ENTRY_EVENT + " dispatching)";
                else msg += "";
            } else if (transition == stateMachineEngine.StateMachine.IN) {
                if (this.logLevel > 1 && phase == 1) msg = "[" + currentStateName + "] <=> in state";
                else msg = "";
                if (this.logLevel > 2 && phase == 2) msg += ": (" + currentStateName + stateMachineEngine.StateMachine.COMPLETED_EVENT + " dispatching)";
                else msg += "";
            }
            return msg;
        };
        stateMachineEngine.StateMachine.prototype.createOperationLogMessage = function(transition, currentStateName, methodName) {
            if (currentStateName == null) currentStateName = "";
            var msg = "";
            if (this.logLevel > 2) msg = "[" + currentStateName + "] --> " + transition + " operation call " + methodName + "()";
            else msg = "";
            return msg;
        };
        stateMachineEngine.StateMachine.prototype.setInitialState = function(value) {
            this.initialState = this.states.get(value);
        };
        stateMachineEngine.StateMachine.prototype.setFinalState = function(value) {
            this.finalState = this.states.get(value);
        };
        stateMachineEngine.StateMachine.prototype.get_haveContext = function() {
            return this.haveContext;
        };
        stateMachineEngine.StateMachine.prototype.__class__ = stateMachineEngine.StateMachine;
        stateMachineEngine.Transition = function() {
            this.action = "";
            this.target = [];
            this.conditions = [];
        };
        stateMachineEngine.Transition.__name__ = ["stateMachineEngine", "Transition"];
        stateMachineEngine.Transition.prototype.action = null;
        stateMachineEngine.Transition.prototype.target = null;
        stateMachineEngine.Transition.prototype.conditions = null;
        stateMachineEngine.Transition.prototype.__class__ = stateMachineEngine.Transition;

        stateMachineEngine.IEventDispatcher = function() {}
        stateMachineEngine.IEventDispatcher.prototype = {

            addEventListener: function(type, listener, useCapture, priority, useWeakReference) {
                return {
                    arguments: ["string", "*", {
                        type: "boolean",
                        opt: true
                    }, {
                        type: "number",
                        opt: true
                    }, {
                        type: "boolean",
                        opt: true
                    }],
                    returns: "void"
                };
            },
            dispatchEvent: function(event) {
                return {
                    arguments: ["*"],
                    returns: "boolean"
                };
            },
            hasEventListener: function(type) {
                return {
                    arguments: ["string"],
                    returns: "boolean"
                };
            },
            removeEventListener: function(type, listener, useCapture) {
                return {
                    arguments: ["string", "*", {
                        type: "boolean",
                        opt: true
                    }],
                    returns: "void"
                };
            },
            willTrigger: function(type) {
                return {
                    arguments: ["string"],
                    returns: "boolean"
                };
            }
        };
        stateMachineEngine.EventDispatcher = function(target) {
            if (target != null) this.__targetDispatcher = target;
        };
        stateMachineEngine.EventDispatcher = ck_implements(stateMachineEngine.EventDispatcher, stateMachineEngine.IEventDispatcher);
        stateMachineEngine.EventDispatcher.__interfaces__ = [stateMachineEngine.IEventDispatcher];
        stateMachineEngine.EventDispatcher.__name__ = ["stateMachineEngine", "EventDispatcher"];
        stateMachineEngine.EventDispatcher.prototype.__targetDispatcher = null;
        stateMachineEngine.EventDispatcher.prototype.__eventMap = null;
        stateMachineEngine.EventDispatcher.prototype.addEventListener = function(type, listener, useCapture, priority, useWeakReference) {
            if (useWeakReference == null) useWeakReference = false;
            if (priority == null) priority = 0;
            if (useCapture == null) useCapture = false;
            if (this.__eventMap == null) this.__eventMap = new _hcmn_.haxe_ds_StringMap();
            if (!this.__eventMap.exists(type)) {
                var list = [];
                list.push(new stateMachineEngine.Listener(listener, useCapture, priority));
                this.__eventMap.set(type, list);
            } else {
                var list1 = this.__eventMap.get(type);
                list1.push(new stateMachineEngine.Listener(listener, useCapture, priority));
                list1.sort(stateMachineEngine.EventDispatcher.__sortByPriority);
            }
        };
        stateMachineEngine.EventDispatcher.prototype.dispatchEvent = function(event) {
            if (this.__eventMap == null || event == null) return false;
            var list = this.__eventMap.get(event.type);
            if (list == null) return false;
            if (event.target == null) {
                if (this.__targetDispatcher != null) event.target = this.__targetDispatcher;
                else event.target = this;
            }
            var capture = event.eventPhase == stateMachineEngine.EventPhase.CAPTURING_PHASE;
            var index = 0;
            var listener;
            while (index < list.length) {
                listener = list[index];
                if (listener.useCapture == capture) {
                    listener.callback(event);
                    if (event.__isCancelledNow) return true;
                }
                if (listener == list[index]) index++;
            }
            return true;
        };
        stateMachineEngine.EventDispatcher.prototype.hasEventListener = function(type) {
            if (this.__eventMap == null) return false;
            return this.__eventMap.exists(type);
        };
        stateMachineEngine.EventDispatcher.prototype.removeEventListener = function(type, listener, capture) {
            if (capture == null) capture = false;
            if (this.__eventMap == null) return;
            var list = this.__eventMap.get(type);
            if (list == null) return;
            var _g1 = 0;
            var _g = list.length;
            while (_g1 < _g) {
                var i = _g1++;
                if (list[i].match(listener, capture)) {
                    list.splice(i, 1);
                    break;
                }
            }
            if (list.length == 0) this.__eventMap.remove(type);
            if (!this.__eventMap.iterator().hasNext()) this.__eventMap = null;
        };
        stateMachineEngine.EventDispatcher.prototype.toString = function() {
            return "[ " + this.__name__ + " ]";
        };
        stateMachineEngine.EventDispatcher.prototype.willTrigger = function(type) {
            return this.hasEventListener(type);
        };
        stateMachineEngine.EventDispatcher.__sortByPriority = function(l1, l2) {
            if (l1.priority == l2.priority) return 0;
            else if (l1.priority > l2.priority) return -1;
            else return 1;
        };
        stateMachineEngine.EventDispatcher.prototype.__class__ = stateMachineEngine.EventDispatcher;
        stateMachineEngine.EventPhase = function() {};
        stateMachineEngine.EventPhase.__name__ = ["stateMachineEngine", "EventPhase"];
        stateMachineEngine.EventPhase.prototype.__class__ = stateMachineEngine.EventPhase;
        stateMachineEngine.Listener = function(callback, useCapture, priority) {
            this.callback = callback;
            this.useCapture = useCapture;
            this.priority = priority;
        };
        stateMachineEngine.Listener.__name__ = ["stateMachineEngine", "Listener"];
        stateMachineEngine.Listener.prototype.callback = null;
        stateMachineEngine.Listener.prototype.priority = null;
        stateMachineEngine.Listener.prototype.useCapture = null;
        stateMachineEngine.Listener.prototype.match = function(callback, useCapture) {
            return this.callback == callback && this.useCapture == useCapture;
        };
        stateMachineEngine.Listener.prototype.__class__ = stateMachineEngine.Listener;
        Xml.Element = 0;;
        Xml.PCData = 1;;
        Xml.CData = 2;;
        Xml.Comment = 3;;
        Xml.DocType = 4;;
        Xml.ProcessingInstruction = 5;;
        Xml.Document = 6;;
        haxe.xml.Parser.escapes = (function($this) {
            var $r;
            var h = new _hcmn_.haxe_ds_StringMap();
            if (_hcmn_.__map_reserved.lt != null) h.setReserved("lt", "<");
            else h.h["lt"] = "<";
            if (_hcmn_.__map_reserved.gt != null) h.setReserved("gt", ">");
            else h.h["gt"] = ">";
            if (_hcmn_.__map_reserved.amp != null) h.setReserved("amp", "&");
            else h.h["amp"] = "&";
            if (_hcmn_.__map_reserved.quot != null) h.setReserved("quot", "\"");
            else h.h["quot"] = "\"";
            if (_hcmn_.__map_reserved.apos != null) h.setReserved("apos", "'");
            else h.h["apos"] = "'";
            $r = h;
            return $r;
        }(this));;
        stateMachineEngine.Event.ACTIVATE = "activate";;
        stateMachineEngine.Event.ADDED = "added";;
        stateMachineEngine.Event.ADDED_TO_STAGE = "addedToStage";;
        stateMachineEngine.Event.CANCEL = "cancel";;
        stateMachineEngine.Event.CHANGE = "change";;
        stateMachineEngine.Event.CLOSE = "close";;
        stateMachineEngine.Event.COMPLETE = "complete";;
        stateMachineEngine.Event.CONNECT = "connect";;
        stateMachineEngine.Event.CONTEXT3D_CREATE = "context3DCreate";;
        stateMachineEngine.Event.DEACTIVATE = "deactivate";;
        stateMachineEngine.Event.ENTER_FRAME = "enterFrame";;
        stateMachineEngine.Event.ID3 = "id3";;
        stateMachineEngine.Event.INIT = "init";;
        stateMachineEngine.Event.MOUSE_LEAVE = "mouseLeave";;
        stateMachineEngine.Event.OPEN = "open";;
        stateMachineEngine.Event.REMOVED = "removed";;
        stateMachineEngine.Event.REMOVED_FROM_STAGE = "removedFromStage";;
        stateMachineEngine.Event.RENDER = "render";;
        stateMachineEngine.Event.RESIZE = "resize";;
        stateMachineEngine.Event.SCROLL = "scroll";;
        stateMachineEngine.Event.SELECT = "select";;
        stateMachineEngine.Event.TAB_CHILDREN_CHANGE = "tabChildrenChange";;
        stateMachineEngine.Event.TAB_ENABLED_CHANGE = "tabEnabledChange";;
        stateMachineEngine.Event.TAB_INDEX_CHANGE = "tabIndexChange";;
        stateMachineEngine.Event.UNLOAD = "unload";;
        stateMachineEngine.Event.SOUND_COMPLETE = "soundComplete";;
        stateMachineEngine.StateEvent.ACTION = "ACTION";;
        stateMachineEngine.StateEvent.CHANGE = "CHANGE";;
        stateMachineEngine.StateMachine.logger = null;;
        stateMachineEngine.StateMachine.ENTRY = "ENTRY";;
        stateMachineEngine.StateMachine.IN = "IN";;
        stateMachineEngine.StateMachine.EXIT = "EXIT";;
        stateMachineEngine.StateMachine.ENTRY_EVENT = "_ENTRY_EVENT_";;
        stateMachineEngine.StateMachine.COMPLETED_EVENT = "_COMPLETED_EVENT_";;
        stateMachineEngine.StateMachine.EXIT_EVENT = "_EXIT_EVENT_";;
        stateMachineEngine.EventPhase.CAPTURING_PHASE = 0;;
        stateMachineEngine.EventPhase.AT_TARGET = 1;;
        stateMachineEngine.EventPhase.BUBBLING_PHASE = 2;;
        return {
            exports: stateMachineEngine
        };
    });
//# sourceURL=stateMachineEngine.js