define("displayengineImpl", ["cloudkid", "displayEngineApi", "displayEngineUtils", "PIXI", "clientkernelModulesApi", "preloadjs"],
    function(cloudkid, displayEngineApi, displayEngineUtils, PIXI, clientkernelModulesApi, preloadjs) {
        "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, '');
        };
        if (typeof displayengineImpl == 'undefined') {
            var displayengineImpl = {};
        };
        displayengineImpl.Activator = function() {};
        displayengineImpl.Activator = ck_implements(displayengineImpl.Activator, clientkernelModulesApi.IModuleActivator);
        displayengineImpl.Activator.__interfaces__ = [clientkernelModulesApi.IModuleActivator];
        displayengineImpl.Activator.__name__ = ["displayengineImpl", "Activator"];
        displayengineImpl.Activator.prototype.start = function(context) {
            context.registerService(new displayengineImpl.DisplayProvider(), displayEngineApi.IDisplayProvider, null);
        };
        displayengineImpl.Activator.prototype.stop = function(context) {};
        displayengineImpl.Activator.main = function() {};
        displayengineImpl.Activator.prototype.__class__ = displayengineImpl.Activator;
        displayengineImpl.Animation = function(name, object, animDef) {
            if (name == null) name = "";
            this.loop = true;
            if (animDef.anims != null) {
                if (object.emitter != null) this.object = object.emitter;
                else this.object = object;
                this.propertiesMap = new _hcmn_.haxe_ds_StringMap();
                var v = [];
                this.propertiesMap.set("x", v);
                v;
                var v1 = [];
                this.propertiesMap.set("y", v1);
                v1;
                var _g = 0;
                var _g1;
                _g1 = _hcmn_.js_Boot.__cast(animDef.anims, Array);
                while (_g < _g1.length) {
                    var anim = _g1[_g];
                    ++_g;
                    var _g2 = anim.prop;
                    switch (_g2) {
                        case "x":
                            this.propertiesMap.get("x").push(anim);
                            break;
                        case "y":
                            this.propertiesMap.get("y").push(anim);
                            break;
                    }
                }
                if (animDef.loop != null) this.loop = animDef.loop;
            }
        };
        displayengineImpl.Animation = ck_implements(displayengineImpl.Animation, displayEngineApi.IAnimation);
        displayengineImpl.Animation.__interfaces__ = [displayEngineApi.IAnimation];
        displayengineImpl.Animation.__name__ = ["displayengineImpl", "Animation"];
        displayengineImpl.Animation.prototype.propertiesMap = null;
        displayengineImpl.Animation.prototype.object = null;
        displayengineImpl.Animation.prototype.currentTween = null;
        displayengineImpl.Animation.prototype.loop = null;
        displayengineImpl.Animation.prototype.start = function() {
            this.currentTween = displayEngineUtils.TweenX.parallel([displayEngineUtils.TweenX.serial((function($this) {
                var $r;
                var _g = []; {
                    var _g2 = 0;
                    var _g1 = $this.propertiesMap.get("x").length;
                    while (_g2 < _g1) {
                        var i = _g2++;
                        _g.push($this.createParticlesAnimation($this.object, $this.propertiesMap.get("x")[i]));
                    }
                }
                $r = _g;
                return $r;
            }(this)), null, {
                fileName: "Animation.hx",
                lineNumber: 54,
                className: "displayengine.impl.displaylist.Animation",
                methodName: "start"
            }), displayEngineUtils.TweenX.serial((function($this) {
                var $r;
                var _g11 = []; {
                    var _g3 = 0;
                    var _g21 = $this.propertiesMap.get("y").length;
                    while (_g3 < _g21) {
                        var i1 = _g3++;
                        _g11.push($this.createParticlesAnimation($this.object, $this.propertiesMap.get("y")[i1]));
                    }
                }
                $r = _g11;
                return $r;
            }(this)), null, {
                fileName: "Animation.hx",
                lineNumber: 59,
                className: "displayengine.impl.displaylist.Animation",
                methodName: "start"
            })], null, {
                fileName: "Animation.hx",
                lineNumber: 53,
                className: "displayengine.impl.displaylist.Animation",
                methodName: "start"
            }).repeat(this.loop ? 0 : 1);
        };
        displayengineImpl.Animation.prototype.stop = function() {
            this.currentTween.stop();
        };
        displayengineImpl.Animation.prototype.createParticlesAnimation = function(emitter, anim) {
            var _g = anim.prop;
            switch (_g) {
                case "x":
                    return displayEngineUtils.ChainX.x(displayEngineUtils.TweenX.to(emitter.spawnPos, null, null, null, null, null, null, null, null, null, {
                        fileName: "Animation.hx",
                        lineNumber: 74,
                        className: "displayengine.impl.displaylist.Animation",
                        methodName: "createParticlesAnimation"
                    }), anim.val).time(anim.time).ease(this.extractEase(anim.ease));
                case "y":
                    return displayEngineUtils.ChainX.y(displayEngineUtils.TweenX.to(emitter.spawnPos, null, null, null, null, null, null, null, null, null, {
                        fileName: "Animation.hx",
                        lineNumber: 77,
                        className: "displayengine.impl.displaylist.Animation",
                        methodName: "createParticlesAnimation"
                    }), anim.val).time(anim.time).ease(this.extractEase(anim.ease));
            }
            return null;
        };
        displayengineImpl.Animation.prototype.extractEase = function(tweenDef) {
            switch (tweenDef) {
                case "Linear.EaseNone":
                    return displayEngineUtils.EaseX.linear;
                case "Quadratic.EaseIn":
                    return displayEngineUtils.EaseX.quadIn;
                case "Quadratic.EaseOut":
                    return displayEngineUtils.EaseX.quadOut;
                case "Quadratic.EaseInOut":
                    return displayEngineUtils.EaseX.quadInOut;
                case "Cubic.EaseIn":
                    return displayEngineUtils.EaseX.cubicIn;
                case "Cubic.EaseOut":
                    return displayEngineUtils.EaseX.cubicOut;
                case "Cubic.EaseInOut":
                    return displayEngineUtils.EaseX.cubicInOut;
                case "Elastic.EaseIn":
                    return displayEngineUtils.EaseX.elasticIn;
                case "Elastic.EaseOut":
                    return displayEngineUtils.EaseX.elasticOut;
                case "Elastic.EaseInOut":
                    return displayEngineUtils.EaseX.elasticInOut;
                case "Back.EaseIn":
                    return displayEngineUtils.EaseX.backIn;
                case "Back.EaseOut":
                    return displayEngineUtils.EaseX.backOut;
                case "Back.EaseInOut":
                    return displayEngineUtils.EaseX.backInOut;
                case "Bounce.EaseIn":
                    return displayEngineUtils.EaseX.bounceIn;
                case "Bounce.EaseOut":
                    return displayEngineUtils.EaseX.bounceOut;
                case "Bounce.EaseInOut":
                    return displayEngineUtils.EaseX.bounceInOut;
            }
            return displayEngineUtils.EaseX.linear;
        };
        displayengineImpl.Animation.prototype.__class__ = displayengineImpl.Animation;
        displayengineImpl.PixiDisplayObject = function() {
            this.stageName = displayEngineApi.DisplayConstants.DEFAULT_STAGE;
            this._allListeners = new _hcmn_.haxe_ds_StringMap();
            this._obj = new PIXI.Container();
            this.id = displayEngineUtils.Utils.uuid();
        };
        displayengineImpl.PixiDisplayObject = ck_implements(displayengineImpl.PixiDisplayObject, displayEngineApi.IDisplayObject);
        displayengineImpl.PixiDisplayObject.__interfaces__ = [displayEngineApi.IDisplayObject];
        displayengineImpl.PixiDisplayObject.__name__ = ["displayengineImpl", "PixiDisplayObject"];
        displayengineImpl.PixiDisplayObject.prototype._allListeners = null;
        displayengineImpl.PixiDisplayObject.prototype.stageName = null;
        displayengineImpl.PixiDisplayObject.prototype._obj = null;
        displayengineImpl.PixiDisplayObject.prototype.id = null;
        displayengineImpl.PixiDisplayObject.prototype.getDisplayObject = function() {
            return this._obj;
        };
        displayengineImpl.PixiDisplayObject.prototype.isType = function(type) {
            return false;
        };
        displayengineImpl.PixiDisplayObject.prototype.getId = function() {
            return this.id;
        };
        displayengineImpl.PixiDisplayObject.prototype.getStageName = function() {
            return this.stageName;
        };
        displayengineImpl.PixiDisplayObject.prototype.getName = function() {
            return this.getDisplayObject().name;
        };
        displayengineImpl.PixiDisplayObject.prototype.setName = function(val) {
            this.id = val;
            this.getDisplayObject().id = val;
            this.getDisplayObject().name = val;
        };
        displayengineImpl.PixiDisplayObject.prototype.getPivot = function() {
            return new displayEngineApi.Point(this._obj.pivot.x, this._obj.pivot.y);
        };
        displayengineImpl.PixiDisplayObject.prototype.setPivot = function(val) {
            this._obj.pivot.set(val.x, val.y);
        };
        displayengineImpl.PixiDisplayObject.prototype.getWidth = function() {
            return this._obj.width;
        };
        displayengineImpl.PixiDisplayObject.prototype.setWidth = function(val) {
            this._obj.width = val;
        };
        displayengineImpl.PixiDisplayObject.prototype.getHeight = function() {
            return this._obj.height;
        };
        displayengineImpl.PixiDisplayObject.prototype.setHeight = function(val) {
            this._obj.height = val;
        };
        displayengineImpl.PixiDisplayObject.prototype.getAlpha = function() {
            return this._obj.alpha;
        };
        displayengineImpl.PixiDisplayObject.prototype.setAlpha = function(val) {
            this._obj.alpha = val;
        };
        displayengineImpl.PixiDisplayObject.prototype.getRotation = function() {
            return displayEngineUtils.Utils.radToDeg(this._obj.rotation);
        };
        displayengineImpl.PixiDisplayObject.prototype.setRotation = function(val) {
            this._obj.rotation = displayEngineUtils.Utils.degToRad(val);
        };
        displayengineImpl.PixiDisplayObject.prototype.getVisible = function() {
            return this._obj.visible;
        };
        displayengineImpl.PixiDisplayObject.prototype.setVisible = function(val) {
            this._obj.visible = val;
        };
        displayengineImpl.PixiDisplayObject.prototype.getX = function() {
            return this._obj.x;
        };
        displayengineImpl.PixiDisplayObject.prototype.setX = function(val) {
            if (this.getUserData().isLabel == true) this._obj.x = val | 0;
            else this._obj.x = val;
        };
        displayengineImpl.PixiDisplayObject.prototype.getY = function() {
            return this._obj.y;
        };
        displayengineImpl.PixiDisplayObject.prototype.setY = function(val) {
            if (this.getUserData().isLabel == true) this._obj.y = val | 0;
            else this._obj.y = val;
        };
        displayengineImpl.PixiDisplayObject.prototype.getScaleX = function() {
            return this._obj.scale.x;
        };
        displayengineImpl.PixiDisplayObject.prototype.setScaleX = function(val) {
            this._obj.scale.x = val;
        };
        displayengineImpl.PixiDisplayObject.prototype.getScaleY = function() {
            return this._obj.scale.y;
        };
        displayengineImpl.PixiDisplayObject.prototype.setScaleY = function(val) {
            this._obj.scale.y = val;
        };
        displayengineImpl.PixiDisplayObject.prototype.getCursor = function() {
            return this._obj.defaultCursor;
        };
        displayengineImpl.PixiDisplayObject.prototype.setCursor = function(val) {
            this._obj.defaultCursor = val;
        };
        displayengineImpl.PixiDisplayObject.prototype.getButtonMode = function() {
            return this._obj.buttonMode;
        };
        displayengineImpl.PixiDisplayObject.prototype.setButtonMode = function(val) {
            this._obj.buttonMode = val;
        };
        displayengineImpl.PixiDisplayObject.prototype.getMask = function() {
            return this._obj.mask;
        };
        displayengineImpl.PixiDisplayObject.prototype.setMask = function(val) {
            this._obj.addChild((_hcmn_.js_Boot.__cast(val, displayengineImpl.Graphics)).getDisplayObject());
            this._obj.mask = (_hcmn_.js_Boot.__cast(val, displayengineImpl.Graphics)).getDisplayObject();
        };
        displayengineImpl.PixiDisplayObject.prototype.getHitArea = function() {
            return this._obj.hitArea;
        };
        displayengineImpl.PixiDisplayObject.prototype.setHitArea = function(val) {
            var pixiHitArea = new PIXI.Polygon(val);
            this._obj.hitArea = pixiHitArea;
        };
        displayengineImpl.PixiDisplayObject.prototype.getMouseEnabled = function() {
            return this._obj.interactive;
        };
        displayengineImpl.PixiDisplayObject.prototype.setMouseEnabled = function(val) {
            this._obj.interactive = val;
        };
        displayengineImpl.PixiDisplayObject.prototype.getParent = function() {
            if (this._obj != null && this._obj.parent != null && this._obj.parent.isStage == true) return displayengineImpl.DisplayProvider.stages.get(this.stageName);
            if (this._obj != null) {
                if (this._obj._parent != null) return this._obj._parent;
            }
            return null;
        };
        displayengineImpl.PixiDisplayObject.prototype.setCacheAsBitmap = function(val) {
            if (displayengineImpl.DisplayProvider.stages.exists(this.stageName)) {
                if (displayengineImpl.DisplayProvider.stages.get(this.stageName).getRendererType() != displayEngineApi.RendererType.RENDERER_WEBGL) this._obj.cacheAsBitmap = val;
            }
        };
        displayengineImpl.PixiDisplayObject.prototype.updateCache = function() {
            if (displayengineImpl.DisplayProvider.stages.exists(this.stageName)) {
                if (displayengineImpl.DisplayProvider.stages.get(this.stageName).getRendererType() != displayEngineApi.RendererType.RENDERER_WEBGL) {}
            }
        };
        displayengineImpl.PixiDisplayObject.prototype.getBounds = function() {
            var pixiRect = this.getDisplayObject().getBounds();
            return new displayEngineApi.Rectangle(pixiRect.x, pixiRect.y, pixiRect.width, pixiRect.height);
        };
        displayengineImpl.PixiDisplayObject.prototype.setBounds = function(x, y, width, height) {};
        displayengineImpl.PixiDisplayObject.prototype.globalToLocal = function(x, y) {
            var point = new displayEngineApi.Point(x, y);
            return this.getDisplayObject().toLocal(point);
        };
        displayengineImpl.PixiDisplayObject.prototype.localToGlobal = function(x, y) {
            var point = new displayEngineApi.Point(x, y);
            return this.getDisplayObject().toGlobal(point);
        };
        displayengineImpl.PixiDisplayObject.prototype.addEventListener = function(type, listener, useCapture) {
            var _g = this;
            this._obj.interactive = true;
            if (this._allListeners.exists(type)) this._allListeners.get(type).push(listener);
            else {
                var v = [];
                this._allListeners.set(type, v);
                v;
                this._allListeners.get(type).push(listener);
            }
            if (!Object.prototype.hasOwnProperty.call(this._obj, type)) this._obj[type] = function(evt) {
                if (_g._allListeners.get(type) != null) {
                    var _g1 = 0;
                    var _g2 = _g._allListeners.get(type);
                    while (_g1 < _g2.length) {
                        var fn = _g2[_g1];
                        ++_g1;
                        fn(evt);
                    }
                }
            };
        };
        displayengineImpl.PixiDisplayObject.prototype.removeEventListener = function(type, listener, useCapture) {
            var $it0 = this._allListeners.keys();
            while ($it0.hasNext()) {
                var key = $it0.next();
                if (key == type) {
                    var _this = this._allListeners.get(key);
                    var x = listener;
                    _hcmn_.HxOverrides.remove(_this, x);
                    return;
                }
            }
        };
        displayengineImpl.PixiDisplayObject.prototype.dispose = function() {
            this._allListeners = null;
            if (this.getParent() != null) {
                if (this.getParent().removeChild != null) this.getParent().removeChild(this);
            }
            this._obj = null;
        };
        displayengineImpl.PixiDisplayObject.prototype.getUserData = function() {
            return null;
        };
        displayengineImpl.PixiDisplayObject.prototype.isDraggable = function() {
            return null;
        };
        displayengineImpl.PixiDisplayObject.prototype.setDraggable = function(val) {};
        displayengineImpl.PixiDisplayObject.prototype.getDragBounds = function() {
            return null;
        };
        displayengineImpl.PixiDisplayObject.prototype.setDragBounds = function(val) {};
        displayengineImpl.PixiDisplayObject.prototype.on = function(type, listener, useCapture) {};
        displayengineImpl.PixiDisplayObject.prototype.onAddedToStage = function(handler) {};
        displayengineImpl.PixiDisplayObject.prototype.off = function(type, listener, useCapture) {};
        displayengineImpl.PixiDisplayObject.prototype.setScale = function(factor) {};
        displayengineImpl.PixiDisplayObject.prototype.setPos = function(x, y) {};
        displayengineImpl.PixiDisplayObject.prototype.setDim = function(width, height) {};
        displayengineImpl.PixiDisplayObject.prototype.getZIndex = function() {
            return -1;
        };
        displayengineImpl.PixiDisplayObject.prototype.setZIndex = function(zIndex) {};
        displayengineImpl.PixiDisplayObject.prototype.getZOrder = function() {
            return -1;
        };
        displayengineImpl.PixiDisplayObject.prototype.setZOrder = function(value) {};
        displayengineImpl.PixiDisplayObject.prototype.bringToTop = function() {};
        displayengineImpl.PixiDisplayObject.prototype.sendToBottom = function() {};
        displayengineImpl.PixiDisplayObject.prototype.__class__ = displayengineImpl.PixiDisplayObject;
        displayengineImpl.DisplayObject = function() {
            this.zIndex = -1;
            this._onDragHandlers = [];
            this._draggable = false;
            this.userData = {};
            displayengineImpl.PixiDisplayObject.call(this);
            this._obj._owner = this;
            this.setDisplayType();
        };
        displayengineImpl.DisplayObject = ck_implements(displayengineImpl.DisplayObject, displayEngineApi.IDisplayObject);
        displayengineImpl.DisplayObject.__interfaces__ = [displayEngineApi.IDisplayObject];
        displayengineImpl.DisplayObject.__name__ = ["displayengineImpl", "DisplayObject"];
        displayengineImpl.DisplayObject.__super__ = displayengineImpl.PixiDisplayObject;
        for (var k in displayengineImpl.PixiDisplayObject.prototype) displayengineImpl.DisplayObject.prototype[k] = displayengineImpl.PixiDisplayObject.prototype[k];
        displayengineImpl.DisplayObject.prototype.userData = null;
        displayengineImpl.DisplayObject.prototype._dragBounds = null;
        displayengineImpl.DisplayObject.prototype.__onDrag = null;
        displayengineImpl.DisplayObject.prototype.__dragOffset = null;
        displayengineImpl.DisplayObject.prototype._draggable = null;
        displayengineImpl.DisplayObject.prototype._onDragHandlers = null;
        displayengineImpl.DisplayObject.prototype.displayType = null;
        displayengineImpl.DisplayObject.prototype.displayObjectEvents = null;
        displayengineImpl.DisplayObject.prototype.zIndex = null;
        displayengineImpl.DisplayObject.prototype._onAddedToStage = null;
        displayengineImpl.DisplayObject.prototype.setDisplayType = function() {
            if (this.displayType == null) this.displayType = [];
            this.displayType.push(displayEngineApi.DisplayType.DISPLAY_OBJECT);
        };
        displayengineImpl.DisplayObject.prototype.isType = function(type) {
            var _g1 = 0;
            var _g = this.displayType.length;
            while (_g1 < _g) {
                var i = _g1++;
                if (_hcmn_.Std.string(type) == _hcmn_.Std.string(this.displayType[i])) return true;
            }
            return false;
        };
        displayengineImpl.DisplayObject.prototype.getUserData = function() {
            return this.userData;
        };
        displayengineImpl.DisplayObject.prototype.isDraggable = function() {
            return this._draggable;
        };
        displayengineImpl.DisplayObject.prototype.setDraggable = function(val) {
            this._draggable = val;
            if (val) this.addEventListener(displayEngineApi.DisplayObjectEvents.MOUSE_DOWN, $bind(this, this.onMouseDown_DRAG));
            else this.removeEventListener(displayEngineApi.DisplayObjectEvents.MOUSE_DOWN, $bind(this, this.onMouseDown_DRAG));
        };
        displayengineImpl.DisplayObject.prototype.getDisplayObject = function() {
            return this._obj;
        };
        displayengineImpl.DisplayObject.prototype.getDragBounds = function() {
            return this._dragBounds;
        };
        displayengineImpl.DisplayObject.prototype.setDragBounds = function(val) {
            if (val.x > val.w) {
                var _temp = val.w;
                val.w = val.x;
                val.x = _temp;
            }
            if (val.y > val.h) {
                var _temp1 = val.h;
                val.h = val.y;
                val.y = _temp1;
            }
            this._dragBounds = val;
        };
        displayengineImpl.DisplayObject.prototype.onMouseDown_DRAG = function(evt) {
            this.__dragOffset = new displayEngineApi.Point(this._obj.x - displayengineImpl.DisplayProvider.stages.get(this.stageName).getMouse(evt).x, this._obj.y - displayengineImpl.DisplayProvider.stages.get(this.stageName).getMouse(evt).y);
            displayengineImpl.DisplayProvider.stages.get(this.stageName).getCanvas().addEventListener(displayEngineApi.DisplayObjectEvents.MOUSE_UP, $bind(this, this.onMouseUp_DRAG));
            this.addEventListener(displayEngineApi.DisplayObjectEvents.MOUSE_MOVE, $bind(this, this.onMouseMove_DRAG));
        };
        displayengineImpl.DisplayObject.prototype.onMouseUp_DRAG = function(evt) {
            displayengineImpl.DisplayProvider.stages.get(this.stageName).getCanvas().removeEventListener(displayEngineApi.DisplayObjectEvents.MOUSE_UP, $bind(this, this.onMouseUp_DRAG));
            this.removeEventListener(displayEngineApi.DisplayObjectEvents.MOUSE_MOVE, $bind(this, this.onMouseMove_DRAG));
        };
        displayengineImpl.DisplayObject.prototype.onMouseMove_DRAG = function(evt) {
            if (this._draggable) {
                this.setX(displayengineImpl.DisplayProvider.stages.get(this.stageName).getMouse(evt).x + this.__dragOffset.x);
                this.setY(displayengineImpl.DisplayProvider.stages.get(this.stageName).getMouse(evt).y + this.__dragOffset.y);
                if (this._dragBounds != null) {
                    if (this._obj.x < this._dragBounds.x) {
                        if (this.getUserData().isLabel == true) this._obj.x = val | 0;
                        else this._obj.x = this._dragBounds.x;
                    }
                    if (this._obj.y < this._dragBounds.y) {
                        if (this.getUserData().isLabel == true) this._obj.y = val | 0;
                        else this._obj.y = this._dragBounds.y;
                    }
                    if (this._obj.x > this._dragBounds.w) {
                        if (this.getUserData().isLabel == true) this._obj.x = val | 0;
                        else this._obj.x = this._dragBounds.w;
                    }
                    if (this._obj.y > this._dragBounds.h) {
                        if (this.getUserData().isLabel == true) this._obj.y = val | 0;
                        else this._obj.y = this._dragBounds.h;
                    }
                }
                if (this.__onDrag != null) this.__onDrag(evt);
                var _g = 0;
                var _g1 = this._onDragHandlers;
                while (_g < _g1.length) {
                    var f = _g1[_g];
                    ++_g;
                    f();
                }
            }
        };
        displayengineImpl.DisplayObject.prototype.addEventListener = function(type, listener, useCapture) {
            if (type == displayEngineApi.DisplayObjectEvents.MOUSE_DRAG) {
                this.__onDrag = listener;
                return;
            }
            displayengineImpl.PixiDisplayObject.prototype.addEventListener.call(this, type, listener, useCapture);
        };
        displayengineImpl.DisplayObject.prototype.removeEventListener = function(type, listener, useCapture) {
            if (type == displayEngineApi.DisplayObjectEvents.MOUSE_DRAG) {
                this.__onDrag = null;
                return;
            }
            displayengineImpl.PixiDisplayObject.prototype.removeEventListener.call(this, type, listener, useCapture);
        };
        displayengineImpl.DisplayObject.prototype.on = function(type, listener, useCapture) {
            if (type == displayEngineApi.DisplayObjectEvents.MOUSE_WHEEL) this.addBrowserSpecificEventListener(type, listener, useCapture);
            else this.addEventListener(type, listener, useCapture);
        };
        displayengineImpl.DisplayObject.prototype.onAddedToStage = function(handler) {
            this._onAddedToStage = handler;
        };
        displayengineImpl.DisplayObject.prototype.addBrowserSpecificEventListener = function(type, listener, useCapture) {
            if (type == displayEngineApi.DisplayObjectEvents.MOUSE_WHEEL)
                if (window.navigator.userAgent.toLowerCase().indexOf("firefox") == -1) type = "mousewheel";
                else type = "DOMMouseScroll";
            window.document.addEventListener(type, listener);
        };
        displayengineImpl.DisplayObject.prototype.removeBrowserSpecificEventListener = function(type, listener, useCapture) {
            if (type == displayEngineApi.DisplayObjectEvents.MOUSE_WHEEL)
                if (window.navigator.userAgent.toLowerCase().indexOf("firefox") == -1) type = "mousewheel";
                else type = "DOMMouseScroll";
            window.document.removeEventListener(type, listener);
        };
        displayengineImpl.DisplayObject.prototype.off = function(type, listener, useCapture) {
            if (type == displayEngineApi.DisplayObjectEvents.MOUSE_WHEEL) this.removeBrowserSpecificEventListener(type, listener, useCapture);
            else this.removeEventListener(type, listener, useCapture);
        };
        displayengineImpl.DisplayObject.prototype.addDragHandler = function(f) {
            this._onDragHandlers.push(f);
        };
        displayengineImpl.DisplayObject.prototype.setScale = function(factor) {
            this._obj.scale.x = this._obj.scale.y = factor;
        };
        displayengineImpl.DisplayObject.prototype.setPos = function(x, y) {
            this._obj.x = x;
            this._obj.y = y;
        };
        displayengineImpl.DisplayObject.prototype.setDim = function(width, height) {
            this._obj.width = width;
            this._obj.height = height;
        };
        displayengineImpl.DisplayObject.prototype.bringToTop = function() {
            this._obj.parent.setChildIndex(this._obj, this._obj.parent.children.length - 1);
        };
        displayengineImpl.DisplayObject.prototype.sendToBottom = function() {
            this._obj.parent.setChildIndex(this._obj, 0);
        };
        displayengineImpl.DisplayObject.prototype.getZOrder = function() {
            return this._obj.parent.getChildIndex(this._obj);
        };
        displayengineImpl.DisplayObject.prototype.setZOrder = function(value) {
            if (this.getParent() == null) return;
            if (value < 0) value = 0;
            if (value > this._obj.parent.children.length - 1) value = this._obj.parent.children.length - 1 | 0;
            this._obj.parent.setChildIndex(this._obj, value);
        };
        displayengineImpl.DisplayObject.prototype.getZIndex = function() {
            return this.zIndex;
        };
        displayengineImpl.DisplayObject.prototype.setZIndex = function(value) {
            this.zIndex = value;
            if (this.getParent() != null) {
                var allChildren = this.getParent().children;
                var sortedChildren = [];
                var lowestZIndex = 0;
                var count = 0;
                var allC = allChildren;
                var $it0 = allC.keys();
                while ($it0.hasNext()) {
                    var key = $it0.next();
                    var c;
                    c = _hcmn_.__map_reserved[key] != null ? allC.getReserved(key) : allC.h[key];
                    sortedChildren.push(c);
                    if (count++ == 0) lowestZIndex = this.getParent().getChildIndex(_hcmn_.__map_reserved[key] != null ? allC.getReserved(key) : allC.h[key]);
                    else {
                        var currZIndex = this.getParent().getChildIndex(_hcmn_.__map_reserved[key] != null ? allC.getReserved(key) : allC.h[key]);
                        if (currZIndex < lowestZIndex) lowestZIndex = currZIndex;
                    }
                }
                sortedChildren.sort(function(a, b) {
                    return a.getZIndex() - b.getZIndex();
                });
                var _g1 = 0;
                var _g = sortedChildren.length;
                while (_g1 < _g) {
                    var i = _g1++;
                    sortedChildren[i]._setZIndex(lowestZIndex + i | 0);
                }
            }
        };
        displayengineImpl.DisplayObject.prototype._getZIndex = function() {
            if (this.getParent() != null) {
                if (this.getParent().getCanvas == null) return this.getParent().children.indexOf(this._obj);
                else return this.getParent().getChildIndex(this);
            } else if (this.parent != null) return this.parent.getChildIndex(this);
            return -1;
        };
        displayengineImpl.DisplayObject.prototype._setZIndex = function(zIndex) {
            if (this.getParent() != null) {
                if (this.getParent().getCanvas == null) this.getParent().setChildIndex(this._obj, zIndex);
                else this.getParent().setChildIndex(this, zIndex);
            }
        };
        displayengineImpl.DisplayObject.prototype.dispose = function() {
            this.userData = null;
            displayengineImpl.PixiDisplayObject.prototype.dispose.call(this);
        };
        displayengineImpl.DisplayObject.prototype.__class__ = displayengineImpl.DisplayObject;
        displayengineImpl.PixiBitmap = function(image, offset) {
            this.offscreenStage = null;
            this._imgUrl = "";
            this.type = "bitmap";
            var _g = this;
            displayengineImpl.DisplayObject.call(this);
            if (typeof(image) == "string" && (offset.w > 0 && offset.h > 0)) {
                var _this = window.document;
                this._image = _this.createElement("canvas");
                this._image.width = offset.w;
                this._image.height = offset.h;
                this.ctx = this._image.getContext("2d");
                this.ctx.scale(2, 2);
                this.imgData = this.ctx.getImageData(0, 0, offset.w / 2, offset.h / 2);
                this.ctx.fillStyle = image;
                this.ctx.fillRect(0, 0, offset.w / 2, offset.h / 2);
                var _bTexture = new PIXI.BaseTexture(this._image, null);
                this._texture = new PIXI.Texture(_bTexture);
            } else {
                if (Object.prototype.hasOwnProperty.call(image, "_stage") || _hcmn_.js_Boot.__instanceof(image, displayengineImpl.OffscreenStage)) {
                    this.offscreenStage = _hcmn_.js_Boot.__cast(image, displayengineImpl.OffscreenStage);
                    if (this.offscreenStage.getMaskedCanvas() != null) this._image = (_hcmn_.js_Boot.__cast(image, displayengineImpl.OffscreenStage)).getMaskedCanvas();
                    else this._image = (_hcmn_.js_Boot.__cast(image, displayengineImpl.OffscreenStage)).getCanvas();
                } else {
                    if (image.src != null) {
                        this._imgUrl = _hcmn_.Std.string(image.src) + "";
                        if (!displayengineImpl.PixiBitmap._imageBuffer.exists(this._imgUrl)) {
                            var value = image;
                            displayengineImpl.PixiBitmap._imageBuffer.set(this._imgUrl, value);
                            displayengineImpl.PixiBitmap.totalSourceImageCount.push({
                                url: image.src,
                                size: _hcmn_.Std.string(image.width) + "x" + _hcmn_.Std.string(image.height)
                            });
                        }
                    }
                    if (displayengineImpl.PixiBitmap._imageBuffer.exists(this._imgUrl)) this._image = displayengineImpl.PixiBitmap._imageBuffer.get(this._imgUrl);
                    else this._image = image;
                }
                this._offset = offset;
                var _bTexture1 = null;
                var _tex = null;
                var _off;
                if (offset != null) _off = new PIXI.Rectangle(offset.x, offset.y, offset.w, offset.h);
                else _off = null;
                if (image != null && image.src != null) {
                    if (!(function($this) {
                            var $r;
                            var key = image.src;
                            $r = displayengineImpl.PixiBitmap._textures.exists(key);
                            return $r;
                        }(this))) {
                        _bTexture1 = new PIXI.BaseTexture(this._image, null);
                        _tex = new PIXI.Texture(_bTexture1, _off);
                        var key1 = image.src;
                        displayengineImpl.PixiBitmap._textures.set(key1, _tex);
                    } else _tex = new PIXI.Texture((function($this) {
                        var $r;
                        var key2 = image.src;
                        $r = displayengineImpl.PixiBitmap._textures.get(key2);
                        return $r;
                    }(this)), _off);
                } else {
                    _bTexture1 = new PIXI.BaseTexture(this._image, null);
                    _tex = new PIXI.Texture(_bTexture1, _off);
                }
                this._texture = _tex;
                if (_hcmn_.js_Boot.__instanceof(image, displayengineImpl.OffscreenStage))(_hcmn_.js_Boot.__cast(image, displayengineImpl.OffscreenStage)).addBitmapChild(this);
            }
            this._obj = new PIXI.Sprite(this._texture);
            if (((function($this) {
                    var $r;
                    var key3 = $this.getStageName();
                    $r = displayengineImpl.DisplayProvider.stages.get(key3);
                    return $r;
                }(this))).getRendererType() == displayEngineApi.RendererType.RENDERER_WEBGL) {
                if (_hcmn_.js_Boot.__instanceof(image, displayengineImpl.OffscreenStage))(_hcmn_.js_Boot.__cast(image, displayengineImpl.OffscreenStage)).getStage().on(displayEngineApi.DisplayObjectEvents.ENTER_FRAME, function() {
                    _g._texture.update();
                });
            }
        };
        displayengineImpl.PixiBitmap = ck_implements(displayengineImpl.PixiBitmap, displayEngineApi.IBitmap);
        displayengineImpl.PixiBitmap.__interfaces__ = [displayEngineApi.IBitmap];
        displayengineImpl.PixiBitmap.__name__ = ["displayengineImpl", "PixiBitmap"];
        displayengineImpl.PixiBitmap.__super__ = displayengineImpl.DisplayObject;
        for (var k in displayengineImpl.DisplayObject.prototype) displayengineImpl.PixiBitmap.prototype[k] = displayengineImpl.DisplayObject.prototype[k];
        displayengineImpl.PixiBitmap.prototype.type = null;
        displayengineImpl.PixiBitmap.prototype._imgUrl = null;
        displayengineImpl.PixiBitmap.prototype._image = null;
        displayengineImpl.PixiBitmap.prototype._texture = null;
        displayengineImpl.PixiBitmap.prototype._offset = null;
        displayengineImpl.PixiBitmap.prototype.imgData = null;
        displayengineImpl.PixiBitmap.prototype.ctx = null;
        displayengineImpl.PixiBitmap.prototype.offscreenStage = null;
        displayengineImpl.PixiBitmap.prototype.setWebGL = function() {
            ((function($this) {
                var $r;
                var key = $this.getStageName();
                $r = displayengineImpl.DisplayProvider.stages.get(key);
                return $r;
            }(this))).on(displayEngineApi.DisplayObjectEvents.ENTER_FRAME, $bind(this, this.webGLUpdate));
        };
        displayengineImpl.PixiBitmap.prototype.webGLUpdate = function(e) {
            this._texture.update();
        };
        displayengineImpl.PixiBitmap.prototype.getInfo = function() {
            return null;
        };
        displayengineImpl.PixiBitmap.prototype.clone = function() {
            var newBmp = new displayengineImpl.PixiBitmap(this._image, this._offset);
            if (newBmp.getUserData().isLabel == true) newBmp._obj.x = val | 0;
            else newBmp._obj.x = this._obj.x;
            if (newBmp.getUserData().isLabel == true) newBmp._obj.y = val | 0;
            else newBmp._obj.y = this._obj.y;
            newBmp._obj.alpha = this._obj.alpha;
            newBmp.setRotation(displayEngineUtils.Utils.radToDeg(this._obj.rotation));
            newBmp.setDraggable(this.isDraggable());
            return newBmp;
        };
        displayengineImpl.PixiBitmap.prototype.update = function(c, width, height) {
            var _w = width | 0;
            var _h = _hcmn_.Std["int"](height);
            var _baseTexture = PIXI.BaseTexture.fromCanvas(c, PIXI.SCALE_MODES.DEFAULT);
            _baseTexture.update();
            var tex = new PIXI.Texture(_baseTexture);
            (_hcmn_.js_Boot.__cast(this._obj, PIXI.Sprite)).texture = tex;
            if (displayengineImpl.DisplayProvider.stages.exists(this.stageName)) {
                if (displayengineImpl.DisplayProvider.stages.get(this.stageName).getRendererType() == displayEngineApi.RendererType.RENDERER_WEBGL) {
                    this._obj.width = _w;
                    this._obj.height = _h + 1;
                } else {
                    this.getDisplayObject().texture.crop.width = _w;
                    this.getDisplayObject().texture.crop.height = _h;
                    this.getDisplayObject()._bounds.width = _w;
                }
            }
        };
        displayengineImpl.PixiBitmap.prototype.renderNoise = function(r, g, b, a) {};
        displayengineImpl.PixiBitmap.prototype.dispose = function() {
            if (this.getUserData().webGL)((function($this) {
                var $r;
                var key = $this.getStageName();
                $r = displayengineImpl.DisplayProvider.stages.get(key);
                return $r;
            }(this))).off(displayEngineApi.DisplayObjectEvents.ENTER_FRAME, $bind(this, this.webGLUpdate));
            displayengineImpl.DisplayObject.prototype.dispose.call(this);
            this._obj = null;
            this._image = null;
            this._imgUrl = null;
            this._texture = null;
            this._offset = null;
            this.imgData = null;
            this.ctx = null;
            this.offscreenStage = null;
        };
        displayengineImpl.PixiBitmap.prototype.__class__ = displayengineImpl.PixiBitmap;
        displayengineImpl.Bitmap = function(image, offset) {
            this.t = 0;
            if (typeof(image) == "string" && (offset.w > 0 && offset.h > 0)) this.perlinNoise = new displayengine.impl.displaylist.Perlin();
            displayengineImpl.PixiBitmap.call(this, image, offset);
            displayengineImpl.Bitmap.bmpCount++;
        };
        displayengineImpl.Bitmap = ck_implements(displayengineImpl.Bitmap, displayEngineApi.IBitmap);
        displayengineImpl.Bitmap.__interfaces__ = [displayEngineApi.IBitmap];
        displayengineImpl.Bitmap.__name__ = ["displayengineImpl", "Bitmap"];
        displayengineImpl.Bitmap.__super__ = displayengineImpl.PixiBitmap;
        for (var k in displayengineImpl.PixiBitmap.prototype) displayengineImpl.Bitmap.prototype[k] = displayengineImpl.PixiBitmap.prototype[k];
        displayengineImpl.Bitmap.prototype.perlinNoise = null;
        displayengineImpl.Bitmap.prototype.t = null;
        displayengineImpl.Bitmap.prototype.setDisplayType = function() {
            displayengineImpl.PixiBitmap.prototype.setDisplayType.call(this);
            this.displayType.push(displayEngineApi.DisplayType.BITMAP);
        };
        displayengineImpl.Bitmap.prototype.clone = function() {
            displayengineImpl.Bitmap.bmpCount++;
            return displayengineImpl.PixiBitmap.prototype.clone.call(this);
        };
        displayengineImpl.Bitmap.prototype.renderNoise = function(r, g, b, a) {
            var count = this._image.width / 2 | 0;
            var _g = 0;
            while (_g < count) {
                var x = _g++;
                var _g1 = 0;
                while (_g1 < count) {
                    var y = _g1++;
                    var _r = this.perlinNoise.noise3d(x / r.size, y / r.size, this.t / 16, null, null, null, null) * 0.5 + 0.5;
                    var _g2 = this.perlinNoise.noise3d(x / g.size, y / g.size, this.t / 16, null, null, null, null) * 0.5 + 0.5;
                    var _b = this.perlinNoise.noise3d(x / b.size, y / b.size, this.t / 16, null, null, null, null) * 0.5 + 0.5;
                    this.imgData.data[(x + y * count) * 4] = _r * r.strength;
                    this.imgData.data[(x + y * count) * 4 + 1] = _g2 * r.strength;
                    this.imgData.data[(x + y * count) * 4 + 2] = _b * r.strength;
                    this.imgData.data[(x + y * count) * 4 + 3] = a;
                }
            }
            this.t++;
            this.ctx.putImageData(this.imgData, 0, 0);
            this.ctx.drawImage(this._image, 0, 0, count * 2, count * 2);
            this.update(this._image, this._image.width, this._image.height);
        };
        displayengineImpl.Bitmap.prototype.dispose = function() {
            displayengineImpl.PixiBitmap.prototype.dispose.call(this);
            displayengineImpl.Bitmap.bmpCount--;
        };
        displayengineImpl.Bitmap.prototype.__class__ = displayengineImpl.Bitmap;
        if (typeof displayengine == 'undefined') {
            var displayengine = {};
        };
        if (!displayengine.impl) {
            displayengine.impl = {};
        };
        if (!displayengine.impl.displaylist) {
            displayengine.impl.displaylist = {};
        };
        displayengine.impl.displaylist.Gradient = function(x, y, z) {
            this.x = x;
            this.y = y;
            this.z = z;
        };
        displayengine.impl.displaylist.Gradient.__name__ = ["displayengine", "impl", "displaylist", "Gradient"];
        displayengine.impl.displaylist.Gradient.prototype.x = null;
        displayengine.impl.displaylist.Gradient.prototype.y = null;
        displayengine.impl.displaylist.Gradient.prototype.z = null;
        displayengine.impl.displaylist.Gradient.prototype.dot2 = function(x, y) {
            return this.x * x + this.y * y;
        };
        displayengine.impl.displaylist.Gradient.prototype.dot3 = function(x, y, z) {
            return this.x * x + this.y * y + this.z * z;
        };
        displayengine.impl.displaylist.Gradient.prototype.__class__ = displayengine.impl.displaylist.Gradient;
        displayengine.impl.displaylist.Perlin = function(seed) {
            this.perm = [];
            this.gradP = [];
            var _g = 0;
            while (_g < 512) {
                var i = _g++;
                this.perm.push(0);
                this.gradP.push(null);
            }
            if (seed == null) seed = _hcmn_.Std["int"](_hcmn_.Math.random() * 65536);
            seed %= 65536;
            if (seed < 256) seed |= seed << 8;
            var v;
            var _g1 = 0;
            while (_g1 < 256) {
                var i1 = _g1++;
                if ((i1 & 1) == 1) v = displayengine.impl.displaylist.Perlin.P[i1] ^ seed & 255;
                else v = displayengine.impl.displaylist.Perlin.P[i1] ^ seed >> 8 & 255;
                this.perm[i1] = this.perm[i1 + 256] = v;
                this.gradP[i1] = this.gradP[i1 + 256] = displayengine.impl.displaylist.Perlin.GRAD3[v % 12];
            }
        };
        displayengine.impl.displaylist.Perlin.__name__ = ["displayengine", "impl", "displaylist", "Perlin"];
        displayengine.impl.displaylist.Perlin.prototype.perm = null;
        displayengine.impl.displaylist.Perlin.prototype.gradP = null;
        displayengine.impl.displaylist.Perlin.prototype.fade = function(t) {
            return t * t * t * (t * (t * 6 - 15) + 10);
        };
        displayengine.impl.displaylist.Perlin.prototype.lerp = function(a, b, t) {
            return (1 - t) * a + t * b;
        };
        displayengine.impl.displaylist.Perlin.prototype.n2d = function(x, y) {
            var X = _hcmn_.Math.floor(x);
            var Y = _hcmn_.Math.floor(y);
            x = x - X;
            y = y - Y;
            X = X & 255;
            Y = Y & 255;
            var n00 = this.gradP[X + this.perm[Y]].dot2(x, y);
            var n01 = this.gradP[X + this.perm[Y + 1]].dot2(x, y - 1);
            var n10 = this.gradP[X + 1 + this.perm[Y]].dot2(x - 1, y);
            var n11 = this.gradP[X + 1 + this.perm[Y + 1]].dot2(x - 1, y - 1);
            var u = this.fade(x);
            var result = this.lerp(this.lerp(n00, n10, u), this.lerp(n01, n11, u), this.fade(y));
            return result / (_hcmn_.Math.sqrt(2) * 0.5);
        };
        displayengine.impl.displaylist.Perlin.prototype.n3d = function(x, y, z) {
            var X = _hcmn_.Math.floor(x);
            var Y = _hcmn_.Math.floor(y);
            var Z = _hcmn_.Math.floor(z);
            x = x - X;
            y = y - Y;
            z = z - Z;
            X = X & 255;
            Y = Y & 255;
            Z = Z & 255;
            var n000 = this.gradP[X + this.perm[Y + this.perm[Z]]].dot3(x, y, z);
            var n001 = this.gradP[X + this.perm[Y + this.perm[Z + 1]]].dot3(x, y, z - 1);
            var n010 = this.gradP[X + this.perm[Y + 1 + this.perm[Z]]].dot3(x, y - 1, z);
            var n011 = this.gradP[X + this.perm[Y + 1 + this.perm[Z + 1]]].dot3(x, y - 1, z - 1);
            var n100 = this.gradP[X + 1 + this.perm[Y + this.perm[Z]]].dot3(x - 1, y, z);
            var n101 = this.gradP[X + 1 + this.perm[Y + this.perm[Z + 1]]].dot3(x - 1, y, z - 1);
            var n110 = this.gradP[X + 1 + this.perm[Y + 1 + this.perm[Z]]].dot3(x - 1, y - 1, z);
            var n111 = this.gradP[X + 1 + this.perm[Y + 1 + this.perm[Z + 1]]].dot3(x - 1, y - 1, z - 1);
            var u = this.fade(x);
            var v = this.fade(y);
            var w = this.fade(z);
            var result = this.lerp(this.lerp(this.lerp(n000, n100, u), this.lerp(n001, n101, u), w), this.lerp(this.lerp(n010, n110, u), this.lerp(n011, n111, u), w), v);
            return result / (_hcmn_.Math.sqrt(3) * 0.5);
        };
        displayengine.impl.displaylist.Perlin.prototype.noise2d = function(x, y, octaves, amplitude, persistence, lacunarity) {
            if (lacunarity == null) lacunarity = 2;
            if (persistence == null) persistence = 0.9;
            if (amplitude == null) amplitude = 1;
            if (octaves == null) octaves = 1;
            if (octaves == 1) return amplitude * this.n2d(x, y);
            var sum = 0;
            var _g = 0;
            while (_g < octaves) {
                var i = _g++;
                sum += amplitude * this.n2d(x, y);
                amplitude *= persistence;
                x *= lacunarity;
                y *= lacunarity;
            }
            return sum;
        };
        displayengine.impl.displaylist.Perlin.prototype.noise3d = function(x, y, z, octaves, amplitude, persistence, lacunarity) {
            if (lacunarity == null) lacunarity = 2;
            if (persistence == null) persistence = 0.9;
            if (amplitude == null) amplitude = 1;
            if (octaves == null) octaves = 1;
            if (octaves == 1) return amplitude * this.n3d(x, y, z);
            var sum = 0;
            var _g = 0;
            while (_g < octaves) {
                var i = _g++;
                sum += amplitude * this.n3d(x, y, z);
                amplitude *= persistence;
                x *= lacunarity;
                y *= lacunarity;
            }
            return sum;
        };
        displayengine.impl.displaylist.Perlin.prototype.__class__ = displayengine.impl.displaylist.Perlin;
        displayengineImpl.Cache = function() {};
        displayengineImpl.Cache.__name__ = ["displayengineImpl", "Cache"];
        displayengineImpl.Cache.cache = function(elements) {
            var elementsParent = null;
            var _g = 0;
            while (_g < elements.length) {
                var e = elements[_g];
                ++_g;
                if (null == elementsParent) elementsParent = e.getParent();
                if (e.getParent() != elementsParent) return null;
            }
            var isParentStage = false;
            isParentStage = _hcmn_.js_Boot.__instanceof(elementsParent, displayengineImpl.Stage);
            elements.sort(function(a, b) {
                return a.getZOrder() - b.getZOrder();
            });
            var lowestZ;
            if (isParentStage) lowestZ = elements[0].getZIndex();
            else lowestZ = elements[0].getZOrder();
            var _g1 = 1;
            var _g2 = elements.length;
            while (_g1 < _g2) {
                var i = _g1++;
                if (elements[i].getZOrder() != elements[i - 1].getZOrder() + 1) return null;
            }
            var cachingContainer = new displayengineImpl.DisplayObjectContainer();
            if (isParentStage) cachingContainer.setZIndex(lowestZ);
            else cachingContainer.setZOrder(lowestZ);
            var _g3 = 0;
            while (_g3 < elements.length) {
                var e1 = elements[_g3];
                ++_g3;
                if (e1.getDisplayObject().cacheAsBitmap == true) {
                    e1.getUserData().prevCacheAsBitmap = true;
                    e1.setCacheAsBitmap(false);
                }
                cachingContainer.addChild(e1);
            }
            cachingContainer.setCacheAsBitmap(true);
            cachingContainer.getUserData().originalParent = elementsParent;
            elementsParent.addChild(cachingContainer);
            var cachedObjectID;
            cachedObjectID = "@_HCACHE_" + (function($this) {
                var $r;
                var _this = displayEngineUtils.Utils.uuid();
                $r = _hcmn_.HxOverrides.substr(_this, 0, 23);
                return $r;
            }(this));
            displayengineImpl.Cache.cachedObjects.set(cachedObjectID, cachingContainer);
            cachingContainer.getDisplayObject().name = cachedObjectID;
            return cachedObjectID;
        };
        displayengineImpl.Cache.uncache = function(objectID) {
            var object = displayengineImpl.Cache.cachedObjects.get(objectID);
            object.setCacheAsBitmap(false);
            var elements = object.getChildren();
            var lowestZ = object.getZOrder();
            var originalParent = object.getParent();
            originalParent.removeChild(object);
            var isParentStage = _hcmn_.js_Boot.__instanceof(originalParent, displayengineImpl.Stage);
            elements.sort(function(a, b) {
                return a.getZOrder() - b.getZOrder();
            });
            while (elements.length > 0) {
                var e = elements.shift();
                originalParent.addChild(e);
                e.setZOrder(lowestZ++);
                if (e.getUserData().prevCacheAsBitmap == true) {
                    e.getUserData().prevCacheAsBitmap = false;
                    e.setCacheAsBitmap(true);
                }
            }
            object = null;
            displayengineImpl.Cache.cachedObjects.remove(objectID);
        };
        displayengineImpl.Cache.prototype.__class__ = displayengineImpl.Cache;
        displayengineImpl.DisplayObjectContainer = function() {
            this.children = [];
            displayengineImpl.DisplayObject.call(this);
            displayengineImpl.DisplayObjectContainer.docCount++;
        };
        displayengineImpl.DisplayObjectContainer = ck_implements(displayengineImpl.DisplayObjectContainer, displayEngineApi.IDisplayObjectContainer);
        displayengineImpl.DisplayObjectContainer.__interfaces__ = [displayEngineApi.IDisplayObjectContainer];
        displayengineImpl.DisplayObjectContainer.__name__ = ["displayengineImpl", "DisplayObjectContainer"];
        displayengineImpl.DisplayObjectContainer.__super__ = displayengineImpl.DisplayObject;
        for (var k in displayengineImpl.DisplayObject.prototype) displayengineImpl.DisplayObjectContainer.prototype[k] = displayengineImpl.DisplayObject.prototype[k];
        displayengineImpl.DisplayObjectContainer.prototype.children = null;
        displayengineImpl.DisplayObjectContainer.prototype.setDisplayType = function() {
            displayengineImpl.DisplayObject.prototype.setDisplayType.call(this);
            this.displayType.push(displayEngineApi.DisplayType.DISPLAY_OBJECT_CONTAINER);
        };
        displayengineImpl.DisplayObjectContainer.prototype.updateChildren = function(child, action) {
            if (action == null) action = "add";
            var _g = 0;
            var _g1 = child.children;
            while (_g < _g1.length) {
                var c = _g1[_g];
                ++_g;
                if (action == "add") c.stageName = child.stageName;
                else c.stageName = c.stageName;
                if (action == "remove") c.stageName = "";
                else c.stageName = c.stageName;
                if (_hcmn_.js_Boot.__instanceof(c, displayengineImpl.DisplayObjectContainer)) this.updateChildren(c, action);
            }
        };
        displayengineImpl.DisplayObjectContainer.prototype.addChild = function(childToAdd) {
            var child = childToAdd;
            if (child.getParent != null && child.getParent() != null) {
                if (child.getParent().removeChild != null) child.getParent().removeChild(child);
            }
            if (child.getDisplayObject == null || child.getDisplayObject() == null) this._obj.addChild(child);
            else {
                this._obj.addChild(child.getDisplayObject());
                child._obj._parent = this;
                child.stageName = this.stageName;
                if (_hcmn_.js_Boot.__instanceof(child, displayengineImpl.DisplayObjectContainer)) this.updateChildren(child, "add");
            }
            this.children.push(child);
            if (child._onAddedToStage != null) {
                child._onAddedToStage();
                child._onAddedToStage = null;
            }
            return child;
        };
        displayengineImpl.DisplayObjectContainer.prototype.addChildAt = function(child, index) {
            var child1 = child;
            if ($bind(child1, child1.getParent) != null && child1.getParent() != null) {
                if (child1.getParent().removeChild != null) child1.getParent().removeChild(child1);
            }
            if ($bind(child1, child1.getDisplayObject) == null || child1.getDisplayObject() == null) this._obj.addChildAt(child1, index);
            else {
                this._obj.addChildAt(child1.getDisplayObject(), index);
                child1._obj._parent = this;
            }
            this.children.push(child1);
            if (child1._onAddedToStage != null) {
                child1._onAddedToStage();
                child1._onAddedToStage = null;
            }
            return child1;
        };
        displayengineImpl.DisplayObjectContainer.prototype.addChildren = function(_children_) {
            var _g = 0;
            while (_g < _children_.length) {
                var child = _children_[_g];
                ++_g;
                var child1 = child;
                if ($bind(child1, child1.getParent) != null && child1.getParent() != null) {
                    if (child1.getParent().removeChild != null) child1.getParent().removeChild(child1);
                }
                if ($bind(child1, child1.getDisplayObject) == null || child1.getDisplayObject() == null) this._obj.addChild(child1);
                else {
                    this._obj.addChild(child1.getDisplayObject());
                    child1._obj._parent = this;
                }
                this.children.push(child1);
                if (child1._onAddedToStage != null) {
                    child1._onAddedToStage();
                    child1._onAddedToStage = null;
                }
            }
        };
        displayengineImpl.DisplayObjectContainer.prototype.removeChild = function(child) {
            var child1 = child;
            if (this._obj != null && ($bind(child1, child1.getDisplayObject) == null || child1.getDisplayObject() == null)) this._obj.removeChild(child1);
            else if (this._obj != null) this._obj.removeChild(child1.getDisplayObject());
            _hcmn_.HxOverrides.remove(this.children, child1);
        };
        displayengineImpl.DisplayObjectContainer.prototype.removeChildAt = function(index) {
            var x = this.getChildAt(index)._owner;
            _hcmn_.HxOverrides.remove(this.children, x);
            this._obj.removeChildAt(index);
        };
        displayengineImpl.DisplayObjectContainer.prototype.removeChildren = function() {
            this.getDisplayObject().removeChildren();
            this.children = [];
        };
        displayengineImpl.DisplayObjectContainer.prototype.getChildAt = function(index) {
            return this.children[index];
        };
        displayengineImpl.DisplayObjectContainer.prototype.getChildIndex = function(child) {
            if (child._obj != null) child = child._obj;
            return this.getDisplayObject().getChildIndex(child);
        };
        displayengineImpl.DisplayObjectContainer.prototype.setChildIndex = function(child, index) {
            var child1 = child;
            if (child1.getDisplayObject() == null) this.getDisplayObject().setChildIndex(child1, index);
            else this._obj.setChildIndex(child1.getDisplayObject(), index);
        };
        displayengineImpl.DisplayObjectContainer.prototype.getNumChildren = function() {
            return this._obj.children.length;
        };
        displayengineImpl.DisplayObjectContainer.prototype.getChildren = function() {
            return this.children;
        };
        displayengineImpl.DisplayObjectContainer.prototype.getChildByName = function(name) {
            var _g = 0;
            var _g1 = this.children;
            while (_g < _g1.length) {
                var child = _g1[_g];
                ++_g;
                var child1 = child;
                if (child1.getName() == name) return child1;
            }
            return null;
        };
        displayengineImpl.DisplayObjectContainer.prototype.dispose = function() {
            var _g = 0;
            var _g1 = this.children;
            while (_g < _g1.length) {
                var child = _g1[_g];
                ++_g;
                child.dispose();
            }
            displayengineImpl.DisplayObject.prototype.dispose.call(this);
            displayengineImpl.DisplayObjectContainer.docCount--;
        };
        displayengineImpl.DisplayObjectContainer.create = function() {
            return new displayengineImpl.DisplayObjectContainer();
        };
        displayengineImpl.DisplayObjectContainer.prototype.__class__ = displayengineImpl.DisplayObjectContainer;
        displayengineImpl.PixiGraphics = function(cacheCommands) {
            if (cacheCommands == null) cacheCommands = false;
            this._lineStyle = {
                lineWidth: 1,
                color: 0,
                alpha: 1.0
            };
            this.commands = [];
            displayengineImpl.DisplayObject.call(this);
            this.cacheCommands = cacheCommands;
            this._g = new PIXI.Graphics();
            this._obj = this._g;
        };
        displayengineImpl.PixiGraphics = ck_implements(displayengineImpl.PixiGraphics, displayEngineApi.IGraphics);
        displayengineImpl.PixiGraphics.__interfaces__ = [displayEngineApi.IGraphics];
        displayengineImpl.PixiGraphics.__name__ = ["displayengineImpl", "PixiGraphics"];
        displayengineImpl.PixiGraphics.__super__ = displayengineImpl.DisplayObject;
        for (var k in displayengineImpl.DisplayObject.prototype) displayengineImpl.PixiGraphics.prototype[k] = displayengineImpl.DisplayObject.prototype[k];
        displayengineImpl.PixiGraphics.prototype.commands = null;
        displayengineImpl.PixiGraphics.prototype.cacheCommands = null;
        displayengineImpl.PixiGraphics.prototype._g = null;
        displayengineImpl.PixiGraphics.prototype._lineStyle = null;
        displayengineImpl.PixiGraphics.prototype.beginFill = function(color, alpha) {
            if (alpha == null) alpha = 1.0;
            if (this.cacheCommands) this.commands.push({
                name: "beginFill",
                data: {
                    color: color,
                    alpha: alpha
                }
            });
            this._g.beginFill(color, alpha);
            return this;
        };
        displayengineImpl.PixiGraphics.prototype.lineStyle = function(thickness, color, alpha) {
            if (alpha == null) alpha = 1.0;
            if (this.cacheCommands) this.commands.push({
                name: "lineStyle",
                data: {
                    thickness: thickness,
                    color: color,
                    alpha: alpha
                }
            });
            this._lineStyle.lineWidth = thickness;
            this._lineStyle.color = color;
            this._lineStyle.alpha = alpha;
            this._g.lineStyle(this._lineStyle.lineWidth | 0, this._lineStyle.color, this._lineStyle.alpha);
            return this;
        };
        displayengineImpl.PixiGraphics.prototype.drawRoundRect = function(x, y, width, height, borderRadius) {
            this._g.drawRect(x, y, width, height);
            return this;
        };
        displayengineImpl.PixiGraphics.prototype.getDisplayObject = function() {
            return this._g;
        };
        displayengineImpl.PixiGraphics.prototype.dispose = function() {
            displayengineImpl.DisplayObject.prototype.dispose.call(this);
            this._g = null;
            this._lineStyle = null;
        };
        displayengineImpl.PixiGraphics.prototype.lineTo = function(x, y) {
            return this;
        };
        displayengineImpl.PixiGraphics.prototype.moveTo = function(x, y) {
            return this;
        };
        displayengineImpl.PixiGraphics.prototype.clear = function() {
            return this;
        };
        displayengineImpl.PixiGraphics.prototype.drawRect = function(x, y, width, height) {
            return this;
        };
        displayengineImpl.PixiGraphics.prototype.drawCircle = function(x, y, radius) {
            return this;
        };
        displayengineImpl.PixiGraphics.prototype.drawEllipse = function(x, y, width, height) {
            return this;
        };
        displayengineImpl.PixiGraphics.prototype.drawPoly = function(polyDef, close) {
            if (close == null) close = false;
            return this;
        };
        displayengineImpl.PixiGraphics.prototype.arc = function(cx, cy, radius, startAngle, endAngle, anticlockwise) {
            if (anticlockwise == null) anticlockwise = false;
            return this;
        };
        displayengineImpl.PixiGraphics.prototype.bezierCurveTo = function(cpX, cpY, cpX2, cpY2, toX, toY) {
            return this;
        };
        displayengineImpl.PixiGraphics.prototype.quadraticCurveTo = function(cpX, cpY, toX, toY) {
            return this;
        };
        displayengineImpl.PixiGraphics.prototype.endFill = function() {
            return this;
        };
        displayengineImpl.PixiGraphics.prototype.endStroke = function() {
            return this;
        };
        displayengineImpl.PixiGraphics.prototype.clone = function(fillColor, fillAlpha, strokeColor, strokeThickness, strokeAlpha) {
            return null;
        };
        displayengineImpl.PixiGraphics.prototype.update = function(fillColor, fillAlpha, strokeColor, strokeThickness, strokeAlpha) {
            return null;
        };
        displayengineImpl.PixiGraphics.prototype.__class__ = displayengineImpl.PixiGraphics;
        displayengineImpl.Graphics = function(cacheCommands) {
            if (cacheCommands == null) cacheCommands = false;
            displayengineImpl.PixiGraphics.call(this, cacheCommands);
        };
        displayengineImpl.Graphics = ck_implements(displayengineImpl.Graphics, displayEngineApi.IGraphics);
        displayengineImpl.Graphics.__interfaces__ = [displayEngineApi.IGraphics];
        displayengineImpl.Graphics.__name__ = ["displayengineImpl", "Graphics"];
        displayengineImpl.Graphics.__super__ = displayengineImpl.PixiGraphics;
        for (var k in displayengineImpl.PixiGraphics.prototype) displayengineImpl.Graphics.prototype[k] = displayengineImpl.PixiGraphics.prototype[k];
        displayengineImpl.Graphics.prototype.setDisplayType = function() {
            displayengineImpl.PixiGraphics.prototype.setDisplayType.call(this);
            this.displayType.push(displayEngineApi.DisplayType.GRAPHICS);
        };
        displayengineImpl.Graphics.prototype.update = function(fillColor, fillAlpha, strokeColor, strokeThickness, strokeAlpha) {
            this.redraw(this, fillColor, fillAlpha, strokeColor, strokeThickness, strokeAlpha);
            return this;
        };
        displayengineImpl.Graphics.prototype.clone = function(fillColor, fillAlpha, strokeColor, strokeThickness, strokeAlpha) {
            var g = new displayengineImpl.Graphics(this.cacheCommands);
            this.redraw(g, fillColor, fillAlpha, strokeColor, strokeThickness, strokeAlpha);
            return g;
        };
        displayengineImpl.Graphics.prototype.redraw = function(g, fillColor, fillAlpha, strokeColor, strokeThickness, strokeAlpha) {
            var _g = 0;
            var _g1 = this.commands;
            while (_g < _g1.length) {
                var c = _g1[_g];
                ++_g;
                var _g2 = c.name;
                switch (_g2) {
                    case "moveTo":
                        g.moveTo(c.data.x, c.data.y);
                        break;
                    case "beginFill":
                        g.beginFill(fillColor != null ? fillColor : c.data.color, fillAlpha != null ? fillAlpha : c.data.alpha);
                        break;
                    case "lineStyle":
                        g.lineStyle(strokeThickness != null ? strokeThickness : c.data.thickness, strokeColor != null ? strokeColor : c.data.color, strokeAlpha != null ? strokeAlpha : c.data.alpha);
                        break;
                    case "clear":
                        g.clear();
                        break;
                    case "lineTo":
                        g.lineTo(c.data.x, c.data.y);
                        break;
                    case "drawRect":
                        g.drawRect(c.data.x, c.data.y, c.data.width, c.data.height);
                        break;
                    case "drawCircle":
                        g.drawCircle(c.data.x, c.data.y, c.data.radius);
                        break;
                    case "drawEllipse":
                        g.drawEllipse(c.data.x, c.data.y, c.data.width, c.data.height);
                        break;
                    case "drawPoly":
                        g.drawPoly(c.data.polyDef, c.data.close);
                        break;
                    case "arc":
                        g.arc(c.data.cx, c.data.cy, c.data.radius, c.data.startAngle, c.data.endAngle, c.data.anticlockwise);
                        break;
                    case "bezierCurveTo":
                        g.bezierCurveTo(c.data.cpX, c.data.cpY, c.data.cpX2, c.data.cpY2, c.data.toX, c.data.toY);
                        break;
                    case "quadraticCurveTo":
                        g.quadraticCurveTo(c.data.cpX, c.data.cpY, c.data.toX, c.data.toY);
                        break;
                    case "endFill":
                        g.endFill();
                        break;
                    case "endStroke":
                        g.endStroke();
                        break;
                }
            }
        };
        displayengineImpl.Graphics.prototype.moveTo = function(x, y) {
            if (this.cacheCommands) this.commands.push({
                name: "moveTo",
                data: {
                    x: x,
                    y: y
                }
            });
            this._g.moveTo(x, y);
            return this;
        };
        displayengineImpl.Graphics.prototype.clear = function() {
            if (this.cacheCommands) this.commands.push({
                name: "clear",
                data: {}
            });
            this._g.clear();
            return this;
        };
        displayengineImpl.Graphics.prototype.lineTo = function(x, y) {
            if (this.cacheCommands) this.commands.push({
                name: "lineTo",
                data: {
                    x: x,
                    y: y
                }
            });
            this._g.lineTo(x, y);
            return this;
        };
        displayengineImpl.Graphics.prototype.drawRect = function(x, y, width, height) {
            if (this.cacheCommands) this.commands.push({
                name: "drawRect",
                data: {
                    x: x,
                    y: y,
                    width: width,
                    height: height
                }
            });
            this._g.drawRect(x, y, width, height);
            return this;
        };
        displayengineImpl.Graphics.prototype.drawCircle = function(x, y, radius) {
            if (this.cacheCommands) this.commands.push({
                name: "drawCircle",
                data: {
                    x: x,
                    y: y,
                    radius: radius
                }
            });
            this._g.drawCircle(x, y, radius);
            return this;
        };
        displayengineImpl.Graphics.prototype.drawEllipse = function(x, y, width, height) {
            if (this.cacheCommands) this.commands.push({
                name: "drawEllipse",
                data: {
                    x: x,
                    y: y,
                    width: width,
                    height: height
                }
            });
            this._g.drawEllipse(x, y, width, height);
            return this;
        };
        displayengineImpl.Graphics.prototype.drawPoly = function(polyDef, close) {
            if (close == null) close = false;
            if (this.cacheCommands) this.commands.push({
                name: "drawPoly",
                data: {
                    polyDef: polyDef,
                    close: close
                }
            });
            var points = [];
            if (typeof(polyDef) == "string") {
                var pts = (_hcmn_.js_Boot.__cast(polyDef, String)).split(",");
                var i = 0;
                while (i < pts.length) {
                    points.push(new displayEngineApi.Point(parseFloat(pts[i]), parseFloat(pts[i + 1])));
                    i += 2;
                }
            } else if ((polyDef instanceof Array) && polyDef.__enum__ == null) {
                var i1 = 0;
                while (i1 < polyDef.length) points.push(new displayEngineApi.Point(polyDef[i1], polyDef[i1 + 1]));
            }
            this._g.moveTo(points[0].x, points[0].y);
            var _g1 = 1;
            var _g = points.length;
            while (_g1 < _g) {
                var i2 = _g1++;
                this._g.lineTo(points[i2].x, points[i2].y);
            }
            if (close) this._g.lineTo(points[0].x, points[0].y);
            return this;
        };
        displayengineImpl.Graphics.prototype.arc = function(cx, cy, radius, startAngle, endAngle, anticlockwise) {
            if (anticlockwise == null) anticlockwise = false;
            if (this.cacheCommands) this.commands.push({
                name: "arc",
                data: {
                    cx: cx,
                    cy: cy,
                    radius: radius,
                    startAngle: startAngle,
                    endAngle: endAngle,
                    anticlockwise: anticlockwise
                }
            });
            this._g.arc(cx, cy, radius, startAngle, endAngle, anticlockwise);
            return this;
        };
        displayengineImpl.Graphics.prototype.bezierCurveTo = function(cpX, cpY, cpX2, cpY2, toX, toY) {
            if (this.cacheCommands) this.commands.push({
                name: "bezierCurveTo",
                data: {
                    cpX: cpX,
                    cpY: cpY,
                    cpX2: cpX2,
                    cpY2: cpY2,
                    toX: toX,
                    toY: toY
                }
            });
            this._g.bezierCurveTo(cpX, cpY, cpX2, cpY2, toX, toY);
            return this;
        };
        displayengineImpl.Graphics.prototype.quadraticCurveTo = function(cpX, cpY, toX, toY) {
            if (this.cacheCommands) this.commands.push({
                name: "quadraticCurveTo",
                data: {
                    cpX: cpX,
                    cpY: cpY,
                    toX: toX,
                    toY: toY
                }
            });
            this._g.quadraticCurveTo(cpX, cpY, toX, toY);
            return this;
        };
        displayengineImpl.Graphics.prototype.endFill = function() {
            if (this.cacheCommands) {
                this.commands.push({
                    name: "endFill",
                    data: {}
                });
                this.cacheCommands = false;
            }
            this._g.endFill();
            return this;
        };
        displayengineImpl.Graphics.prototype.endStroke = function() {
            if (this.cacheCommands) {
                this.commands.push({
                    name: "endStroke",
                    data: {}
                });
                this.cacheCommands = false;
            }
            displayengineImpl.PixiGraphics.prototype.endStroke.call(this);
            return this;
        };
        displayengineImpl.Graphics.prototype.__class__ = displayengineImpl.Graphics;
        displayengine.impl.displaylist.VideoFilter = {
            __ename__: ["displayengine", "impl", "displaylist", "VideoFilter"],
            __constructs__: ["NONE", "GRAYSCALE", "CONVOLUTION", "INVERT", "RGB_TO_BRG", "RGB_TO_RBG", "RGB_TO_GBR", "RGB_TO_BGR", "RGB_TO_GRB", "GRADIENT", "SEPIA1", "SEPIA2", "GAMMA", "BRIGHTNESS", "NOISE"]
        };
        displayengine.impl.displaylist.VideoFilter.SEPIA2 = ["SEPIA2", 11];
        displayengine.impl.displaylist.VideoFilter.SEPIA2.toString = $estr;
        displayengine.impl.displaylist.VideoFilter.SEPIA2.__enum__ = displayengine.impl.displaylist.VideoFilter;
        displayengine.impl.displaylist.VideoFilter.RGB_TO_BGR = ["RGB_TO_BGR", 7];
        displayengine.impl.displaylist.VideoFilter.RGB_TO_BGR.toString = $estr;
        displayengine.impl.displaylist.VideoFilter.RGB_TO_BGR.__enum__ = displayengine.impl.displaylist.VideoFilter;
        displayengine.impl.displaylist.VideoFilter.GRAYSCALE = ["GRAYSCALE", 1];
        displayengine.impl.displaylist.VideoFilter.GRAYSCALE.toString = $estr;
        displayengine.impl.displaylist.VideoFilter.GRAYSCALE.__enum__ = displayengine.impl.displaylist.VideoFilter;
        displayengine.impl.displaylist.VideoFilter.NONE = ["NONE", 0];
        displayengine.impl.displaylist.VideoFilter.NONE.toString = $estr;
        displayengine.impl.displaylist.VideoFilter.NONE.__enum__ = displayengine.impl.displaylist.VideoFilter;
        displayengine.impl.displaylist.VideoFilter.RGB_TO_BRG = ["RGB_TO_BRG", 4];
        displayengine.impl.displaylist.VideoFilter.RGB_TO_BRG.toString = $estr;
        displayengine.impl.displaylist.VideoFilter.RGB_TO_BRG.__enum__ = displayengine.impl.displaylist.VideoFilter;
        displayengine.impl.displaylist.VideoFilter.GAMMA = ["GAMMA", 12];
        displayengine.impl.displaylist.VideoFilter.GAMMA.toString = $estr;
        displayengine.impl.displaylist.VideoFilter.GAMMA.__enum__ = displayengine.impl.displaylist.VideoFilter;
        displayengine.impl.displaylist.VideoFilter.RGB_TO_GBR = ["RGB_TO_GBR", 6];
        displayengine.impl.displaylist.VideoFilter.RGB_TO_GBR.toString = $estr;
        displayengine.impl.displaylist.VideoFilter.RGB_TO_GBR.__enum__ = displayengine.impl.displaylist.VideoFilter;
        displayengine.impl.displaylist.VideoFilter.RGB_TO_GRB = ["RGB_TO_GRB", 8];
        displayengine.impl.displaylist.VideoFilter.RGB_TO_GRB.toString = $estr;
        displayengine.impl.displaylist.VideoFilter.RGB_TO_GRB.__enum__ = displayengine.impl.displaylist.VideoFilter;
        displayengine.impl.displaylist.VideoFilter.RGB_TO_RBG = ["RGB_TO_RBG", 5];
        displayengine.impl.displaylist.VideoFilter.RGB_TO_RBG.toString = $estr;
        displayengine.impl.displaylist.VideoFilter.RGB_TO_RBG.__enum__ = displayengine.impl.displaylist.VideoFilter;
        displayengine.impl.displaylist.VideoFilter.GRADIENT = ["GRADIENT", 9];
        displayengine.impl.displaylist.VideoFilter.GRADIENT.toString = $estr;
        displayengine.impl.displaylist.VideoFilter.GRADIENT.__enum__ = displayengine.impl.displaylist.VideoFilter;
        displayengine.impl.displaylist.VideoFilter.INVERT = ["INVERT", 3];
        displayengine.impl.displaylist.VideoFilter.INVERT.toString = $estr;
        displayengine.impl.displaylist.VideoFilter.INVERT.__enum__ = displayengine.impl.displaylist.VideoFilter;
        displayengine.impl.displaylist.VideoFilter.NOISE = ["NOISE", 14];
        displayengine.impl.displaylist.VideoFilter.NOISE.toString = $estr;
        displayengine.impl.displaylist.VideoFilter.NOISE.__enum__ = displayengine.impl.displaylist.VideoFilter;
        displayengine.impl.displaylist.VideoFilter.CONVOLUTION = ["CONVOLUTION", 2];
        displayengine.impl.displaylist.VideoFilter.CONVOLUTION.toString = $estr;
        displayengine.impl.displaylist.VideoFilter.CONVOLUTION.__enum__ = displayengine.impl.displaylist.VideoFilter;
        displayengine.impl.displaylist.VideoFilter.BRIGHTNESS = ["BRIGHTNESS", 13];
        displayengine.impl.displaylist.VideoFilter.BRIGHTNESS.toString = $estr;
        displayengine.impl.displaylist.VideoFilter.BRIGHTNESS.__enum__ = displayengine.impl.displaylist.VideoFilter;
        displayengine.impl.displaylist.VideoFilter.SEPIA1 = ["SEPIA1", 10];
        displayengine.impl.displaylist.VideoFilter.SEPIA1.toString = $estr;
        displayengine.impl.displaylist.VideoFilter.SEPIA1.__enum__ = displayengine.impl.displaylist.VideoFilter;
        displayengineImpl.MCVideo = function(src, poster, width, height, framerate, autoPlay, loop) {
            if (loop == null) loop = true;
            if (autoPlay == null) autoPlay = true;
            if (framerate == null) framerate = 30;
            if (height == null) height = -1;
            if (width == null) width = -1;
            this.onPlayHandlers = [];
            this.noiseFilterFactor = 60;
            this.brightnessFilterFactor = 100;
            this.gammaFilterFactor = 5;
            this.gradientFilterFactor = 0;
            this.filterZone = new displayEngineApi.Rectangle(0, 0, 10, 0);
            this.filter = displayengine.impl.displaylist.VideoFilter.NONE;
            this.tiles = [];
            this.tileSpacing = 4;
            this.cols = 0;
            this.rows = 0;
            var _this = window.document;
            this.video = _this.createElement("video");
            if (this.canPlayFormat("video/mp4")) this.video.src = src + ".mp4";
            else if (this.canPlayFormat("video/webm")) this.video.src = src + ".webm";
            else if (this.canPlayFormat("video/ogg")) this.video.src = src + ".ogv";
            else {
                throw new js._Boot.HaxeError("Browser can't play video!");
                return;
            }
            this.video.loop = loop;
            this.video.autoplay = autoPlay;
            this.video.onplay = $bind(this, this.render);
            this.video.addEventListener("timeupdate", $bind(this, this.playerTimeUpdate));
            this.video.addEventListener("loadedmetadata", $bind(this, this.playerReady));
            if (width == -1) width = this.video.width;
            if (height == -1) height = this.video.height;
            this._w = width;
            this._h = height;
            this.filterZone.w = this._w;
            this.filterZone.h = this._h;
            var _this1 = window.document;
            this.canvas = _this1.createElement("canvas");
            this.canvas.setAttribute("width", this._w + "px");
            this.canvas.setAttribute("height", this._h + "px");
            this.canvas.style.backgroundColor = "transparent";
            this.ctx = this.canvas.getContext("2d", null);
            if (poster != null) {
                this.poster = new displayengineImpl.Bitmap(poster);
                this.ctx.drawImage(poster, 0, 0, this._w, this._h);
            }
            displayengineImpl.Bitmap.call(this, this.canvas);
            this.on(displayEngineApi.DisplayObjectEvents.MOUSE_DOWN, $bind(this, this.beginFilterZoneDraw));
        };
        displayengineImpl.MCVideo.__name__ = ["displayengineImpl", "MCVideo"];
        displayengineImpl.MCVideo.__super__ = displayengineImpl.Bitmap;
        for (var k in displayengineImpl.Bitmap.prototype) displayengineImpl.MCVideo.prototype[k] = displayengineImpl.Bitmap.prototype[k];
        displayengineImpl.MCVideo.prototype.isPaused = null;
        displayengineImpl.MCVideo.prototype.duration = null;
        displayengineImpl.MCVideo.prototype.currentTime = null;
        displayengineImpl.MCVideo.prototype.onPlayerReady = null;
        displayengineImpl.MCVideo.prototype.canvas = null;
        displayengineImpl.MCVideo.prototype.video = null;
        displayengineImpl.MCVideo.prototype.poster = null;
        displayengineImpl.MCVideo.prototype._w = null;
        displayengineImpl.MCVideo.prototype._h = null;
        displayengineImpl.MCVideo.prototype.rows = null;
        displayengineImpl.MCVideo.prototype.cols = null;
        displayengineImpl.MCVideo.prototype.tileSpacing = null;
        displayengineImpl.MCVideo.prototype.tiles = null;
        displayengineImpl.MCVideo.prototype.tileWidth = null;
        displayengineImpl.MCVideo.prototype.tileHeight = null;
        displayengineImpl.MCVideo.prototype.filter = null;
        displayengineImpl.MCVideo.prototype.filterZone = null;
        displayengineImpl.MCVideo.prototype.filterZoneGFX = null;
        displayengineImpl.MCVideo.prototype.filterZoneStartPoint = null;
        displayengineImpl.MCVideo.prototype.gradientFilterFactor = null;
        displayengineImpl.MCVideo.prototype.gammaFilterFactor = null;
        displayengineImpl.MCVideo.prototype.brightnessFilterFactor = null;
        displayengineImpl.MCVideo.prototype.noiseFilterFactor = null;
        displayengineImpl.MCVideo.prototype.onPlayHandlers = null;
        displayengineImpl.MCVideo.prototype.setDisplayType = function() {
            displayengineImpl.Bitmap.prototype.setDisplayType.call(this);
            this.displayType.push(displayEngineApi.DisplayType.VIDEO);
        };
        displayengineImpl.MCVideo.prototype.showPoster = function() {
            if (this.poster != null) this.poster._obj.visible = true;
        };
        displayengineImpl.MCVideo.prototype.play = function() {
            this.video.play();
        };
        displayengineImpl.MCVideo.prototype.pause = function() {
            this.video.pause();
        };
        displayengineImpl.MCVideo.prototype.getTimeFormated = function() {
            return this.secondsToTime(this.video.currentTime);
        };
        displayengineImpl.MCVideo.prototype.render = function() {
            if (this.video.paused || this.video.ended) return;
            if (this.poster != null) this.poster._obj.visible = false;
            this.ctx.clearRect(0, 0, this._w, this._h);
            this.ctx.drawImage(this.video, 0, 0, this._w, this._h);
            if (this.filter != displayengine.impl.displaylist.VideoFilter.NONE) this.applyFilter();
            this.update(this.canvas, this._w, this._h);
            window.setTimeout($bind(this, this.render), 20);
        };
        displayengineImpl.MCVideo.prototype.setFilter = function(filter) {
            this.filter = filter;
        };
        displayengineImpl.MCVideo.prototype.addOnPlayHandler = function(handler) {
            this.onPlayHandlers.push(handler);
        };
        displayengineImpl.MCVideo.prototype.removeOnPlayHandler = function(handler) {
            var x = handler;
            _hcmn_.HxOverrides.remove(this.onPlayHandlers, x);
        };
        displayengineImpl.MCVideo.prototype.playerTimeUpdate = function(e) {
            var _g = 0;
            var _g1 = this.onPlayHandlers;
            while (_g < _g1.length) {
                var fn = _g1[_g];
                ++_g;
                fn();
            }
        };
        displayengineImpl.MCVideo.prototype.beginFilterZoneDraw = function(e) {
            if (this.filterZoneGFX == null) this.filterZoneGFX = new displayengineImpl.Sprite();
            var mouse = displayengineImpl.DisplayProvider.stages.get(this.stageName).getMouse();
            this.filterZoneStartPoint = this.globalToLocal(mouse.x, mouse.y);
            this.filterZoneGFX.setX(this._obj.x);
            this.filterZoneGFX.setY(this._obj.y);
            this.getParent().addChild(this.filterZoneGFX.getDisplayObject());
            this.on(displayEngineApi.DisplayObjectEvents.MOUSE_UP, $bind(this, this.endFilterZoneDraw));
            displayengineImpl.DisplayProvider.stages.get(this.stageName).on(displayEngineApi.DisplayObjectEvents.ENTER_FRAME, $bind(this, this.drawFilterZone));
        };
        displayengineImpl.MCVideo.prototype.endFilterZoneDraw = function(e) {
            this.getParent().removeChild(this.filterZoneGFX.getDisplayObject());
            this.off(displayEngineApi.DisplayObjectEvents.MOUSE_UP, $bind(this, this.endFilterZoneDraw));
            displayengineImpl.DisplayProvider.stages.get(this.stageName).off(displayEngineApi.DisplayObjectEvents.ENTER_FRAME, $bind(this, this.drawFilterZone));
        };
        displayengineImpl.MCVideo.prototype.drawFilterZone = function(e) {
            var xy = this.globalToLocal(displayengineImpl.DisplayProvider.stages.get(this.stageName).getMouse().x, displayengineImpl.DisplayProvider.stages.get(this.stageName).getMouse().y);
            if (xy.x >= 0 && xy.x <= this._w && xy.y >= 0 && xy.y <= this._h) {
                var g = this.filterZoneGFX.getGraphics();
                var x1 = this.filterZoneStartPoint.x;
                var y1 = this.filterZoneStartPoint.y;
                var x2 = xy.x;
                var y2 = xy.y;
                if (x2 < x1) {
                    var temp = x1;
                    x1 = x2;
                    x2 = temp;
                }
                if (y2 < y1) {
                    var temp1 = y1;
                    y1 = y2;
                    y2 = temp1;
                }
                g.clear().lineStyle(2, 16711680, .8).beginFill(16711680, 0.4).drawRect(x1, y1, x2 - x1, y2 - y1);
                this.filterZone = new displayEngineApi.Rectangle(x1, y1, x2 - x1, y2 - y1);
            }
        };
        displayengineImpl.MCVideo.prototype.playerReady = function(e) {
            if (this.onPlayerReady != null) this.onPlayerReady(e.target);
        };
        displayengineImpl.MCVideo.prototype.canPlayFormat = function(format) {
            var res = this.video.canPlayType(format);
            if (res == "probably" || res == "maybe") return true;
            return false;
        };
        displayengineImpl.MCVideo.prototype.applyFilter = function() {
            var idata = this.ctx.getImageData(this.filterZone.x, this.filterZone.y, this.filterZone.w == 0 ? 1 : this.filterZone.w, this.filterZone.h == 0 ? 1 : this.filterZone.h);
            var data = idata.data;
            var _g = this.filter;
            switch (_g[1]) {
                case 2:
                    var w = idata.width;
                    var limit = data.length;
                    var _g1 = 0;
                    while (_g1 < limit) {
                        var i = _g1++;
                        if (i % 4 == 3) continue;
                        data[i] = 127 + 2 * data[i] - data[i + 4] - data[i + w * 4];
                    }
                    break;
                case 1:
                    var i1 = 0;
                    while (i1 < data.length) {
                        var r = data[i1];
                        var g = data[i1 + 1];
                        var b = data[i1 + 2];
                        var brightness = 3 * r + 4 * g + b >>> 3;
                        data[i1] = brightness;
                        data[i1 + 1] = brightness;
                        data[i1 + 2] = brightness;
                        i1 += 4;
                    }
                    break;
                case 3:
                    var i2 = 0;
                    while (i2 < data.length) {
                        data[i2] = 255 - data[i2];
                        data[i2 + 1] = 255 - data[i2 + 1];
                        data[i2 + 2] = 255 - data[i2 + 2];
                        i2 += 4;
                    }
                    break;
                case 9:
                    var total = data.length;
                    var i3 = 0;
                    while (i3 < data.length) {
                        data[i3 + 3] = this.gradientFilterFactor + 255 * (total - i3) / total | 0;
                        i3 += 4;
                    }
                    break;
                case 4:
                    var r1 = 0;
                    var g1 = 0;
                    var b1 = 0;
                    var i4 = 0;
                    while (i4 < data.length) {
                        r1 = data[i4];
                        g1 = data[i4 + 1];
                        b1 = data[i4 + 2];
                        data[i4] = b1;
                        data[i4 + 1] = r1;
                        data[i4 + 2] = g1;
                        i4 += 4;
                    }
                    break;
                case 5:
                    var g2 = 0;
                    var b2 = 0;
                    var i5 = 0;
                    while (i5 < data.length) {
                        g2 = data[i5 + 1];
                        b2 = data[i5 + 2];
                        data[i5 + 1] = b2;
                        data[i5 + 2] = g2;
                        i5 += 4;
                    }
                    break;
                case 6:
                    var r2 = 0;
                    var g3 = 0;
                    var b3 = 0;
                    var i6 = 0;
                    while (i6 < data.length) {
                        r2 = data[i6];
                        g3 = data[i6 + 1];
                        b3 = data[i6 + 2];
                        data[i6] = g3;
                        data[i6 + 1] = b3;
                        data[i6 + 2] = r2;
                        i6 += 4;
                    }
                    break;
                case 7:
                    var r3 = 0;
                    var g4 = 0;
                    var b4 = 0;
                    var i7 = 0;
                    while (i7 < data.length) {
                        r3 = data[i7];
                        g4 = data[i7 + 1];
                        b4 = data[i7 + 2];
                        data[i7] = b4;
                        data[i7 + 1] = g4;
                        data[i7 + 2] = r3;
                        i7 += 4;
                    }
                    break;
                case 8:
                    var r4 = 0;
                    var g5 = 0;
                    var b5 = 0;
                    var i8 = 0;
                    while (i8 < data.length) {
                        r4 = data[i8];
                        g5 = data[i8 + 1];
                        b5 = data[i8 + 2];
                        data[i8] = g5;
                        data[i8 + 1] = r4;
                        data[i8 + 2] = b5;
                        i8 += 4;
                    }
                    break;
                case 10:
                    var avg = 0;
                    var i9 = 0;
                    while (i9 < data.length) {
                        avg = 0.3 * data[i9] + 0.59 * data[i9 + 1] + 0.11 * data[i9 + 2] | 0;
                        data[i9] = avg + 100;
                        data[i9 + 1] = avg + 50;
                        data[i9 + 2] = avg;
                        i9 += 4;
                    }
                    break;
                case 11:
                    var i10 = 0;
                    while (i10 < data.length) {
                        data[i10] = (data[i10] * 0.393 + data[i10 + 1] * 0.769 + data[i10 + 2] * 0.189) / 1.351 | 0;
                        data[i10 + 1] = (data[i10] * 0.349 + data[i10 + 1] * 0.686 + data[i10 + 2] * 0.168) / 1.203 | 0;
                        data[i10 + 2] = (data[i10] * 0.272 + data[i10 + 1] * 0.534 + data[i10 + 2] * 0.131) / 2.140 | 0;
                        i10 += 4;
                    }
                    break;
                case 13:
                    var i11 = 0;
                    while (i11 < data.length) {
                        data[i11] += this.brightnessFilterFactor;
                        data[i11 + 1] += this.brightnessFilterFactor;
                        data[i11 + 2] += this.brightnessFilterFactor;
                        i11 += 4;
                    }
                    break;
                case 12:
                    var i12 = 0;
                    while (i12 < data.length) {
                        data[i12] = _hcmn_.Std["int"](_hcmn_.Math.pow(data[i12] / 255, this.gammaFilterFactor) * 255);
                        data[i12 + 1] = _hcmn_.Std["int"](_hcmn_.Math.pow(data[i12 + 1] / 255, this.gammaFilterFactor) * 255);
                        data[i12 + 2] = _hcmn_.Std["int"](_hcmn_.Math.pow(data[i12 + 2] / 255, this.gammaFilterFactor) * 255);
                        i12 += 4;
                    }
                    break;
                case 14:
                    var rand = 0;
                    var i13 = 0;
                    while (i13 < data.length) {
                        rand = _hcmn_.Std["int"]((0.5 - _hcmn_.Math.random()) * this.noiseFilterFactor);
                        data[i13] += rand;
                        data[i13 + 1] += rand;
                        data[i13 + 2] += rand;
                        i13 += 4;
                    }
                    break;
                default:
            }
            this.ctx.putImageData(idata, this.filterZone.x, this.filterZone.y);
        };
        displayengineImpl.MCVideo.prototype.setFilterZone = function(rec) {
            this.filterZone = rec;
        };
        displayengineImpl.MCVideo.prototype.setGradinetFactor = function(factor) {
            if (factor >= 0 && factor <= 255) this.gradientFilterFactor = factor;
        };
        displayengineImpl.MCVideo.prototype.setGammaFactor = function(factor) {
            if (factor >= 2 && factor <= 10) this.gammaFilterFactor = factor;
        };
        displayengineImpl.MCVideo.prototype.setBrightnessFactor = function(factor) {
            if (factor >= 0 && factor <= 255) this.brightnessFilterFactor = factor;
        };
        displayengineImpl.MCVideo.prototype.setNoiseFactor = function(factor) {
            if (factor >= 0 && factor <= 500) this.noiseFilterFactor = factor;
        };
        displayengineImpl.MCVideo.prototype.get_isPaused = function() {
            return this.video.paused;
        };
        displayengineImpl.MCVideo.prototype.get_duration = function() {
            return this.video.duration;
        };
        displayengineImpl.MCVideo.prototype.set_currentTime = function(val) {
            this.video.currentTime = val;
            return val;
        };
        displayengineImpl.MCVideo.prototype.get_currentTime = function() {
            return this.video.currentTime;
        };
        displayengineImpl.MCVideo.prototype.secondsToTime = function(s) {
            var h = _hcmn_.Math.floor(s / 3600);
            s -= h * 3600;
            var m = _hcmn_.Math.floor(s / 60);
            s -= m * 60;
            var ss = _hcmn_.Math.floor(s);
            return (h < 10 ? "0" + h : h + "") + ":" + (m < 10 ? "0" + m : m + "") + ":" + (ss < 10 ? "0" + ss : ss + "");
        };
        displayengineImpl.MCVideo.prototype.__class__ = displayengineImpl.MCVideo;
        displayengineImpl.Sprite = function() {
            displayengineImpl.DisplayObjectContainer.call(this);
        };
        displayengineImpl.Sprite = ck_implements(displayengineImpl.Sprite, displayEngineApi.ISprite);
        displayengineImpl.Sprite.__interfaces__ = [displayEngineApi.ISprite];
        displayengineImpl.Sprite.__name__ = ["displayengineImpl", "Sprite"];
        displayengineImpl.Sprite.__super__ = displayengineImpl.DisplayObjectContainer;
        for (var k in displayengineImpl.DisplayObjectContainer.prototype) displayengineImpl.Sprite.prototype[k] = displayengineImpl.DisplayObjectContainer.prototype[k];
        displayengineImpl.Sprite.prototype._graphics = null;
        displayengineImpl.Sprite.prototype.setDisplayType = function() {
            displayengineImpl.DisplayObjectContainer.prototype.setDisplayType.call(this);
            this.displayType.push(displayEngineApi.DisplayType.SPRITE);
        };
        displayengineImpl.Sprite.prototype.getGraphics = function() {
            if (this._graphics == null) {
                this._graphics = new displayengineImpl.Graphics();
                this.addChild(this._graphics);
            }
            return this._graphics;
        };
        displayengineImpl.Sprite.prototype.__class__ = displayengineImpl.Sprite;
        displayengineImpl.PixiMovieClip = function(mcDef) {
            this.mcDefVersion = 1;
            this.currentStateName = "default";
            this.allOnStartHandlers = [];
            this.allOnCompleteHandlers = [];
            this._enabled = true;
            this.allTextures = new _hcmn_.haxe_ds_StringMap();
            this.anims = new _hcmn_.haxe_ds_StringMap();
            this.allFrames = [];
            displayengineImpl.Sprite.call(this);
            this.mcDef = mcDef;
            if (mcDef.videoDef == null) {
                var tex;
                if (!displayengineImpl.PixiMovieClip.allBitmaps.exists(mcDef.name)) {
                    var _baseTexture = new PIXI.BaseTexture(mcDef.animationBitmap, 0);
                    tex = new PIXI.Texture(_baseTexture);
                    displayengineImpl.PixiMovieClip.allBitmaps.set(mcDef.name, tex);
                } else tex = displayengineImpl.PixiMovieClip.allBitmaps.get(mcDef.name);
                if (mcDef.animeDef.frames == null) this.mcDefVersion = 2;
                if (this.mcDefVersion == 1) {
                    var frames = mcDef.animeDef.frames;
                    var _g = 0;
                    while (_g < frames.length) {
                        var f = frames[_g];
                        ++_g;
                        if (f.spriteName == mcDef.name) this.allFrames.push(f);
                    }
                    this.allFrames.sort(function(a, b) {
                        return _hcmn_.Reflect.compare(a.frameNumber | 0, b.frameNumber | 0);
                    });
                    var _g1 = 0;
                    var _g11 = this.allFrames;
                    while (_g1 < _g11.length) {
                        var f1 = _g11[_g1];
                        ++_g1;
                        if (!(function($this) {
                                var $r;
                                var key = f1.state;
                                $r = $this.allTextures.exists(key);
                                return $r;
                            }(this))) {
                            var key1 = f1.state;
                            this.anims.set(key1, [f1.frameNumber]);
                            var key2 = f1.state;
                            var value = [new PIXI.Texture(tex, new PIXI.Rectangle(_hcmn_.Std.parseFloat(f1.frame.x), _hcmn_.Std.parseFloat(f1.frame.y), _hcmn_.Std.parseFloat(f1.frame.w), _hcmn_.Std.parseFloat(f1.frame.h)))];
                            this.allTextures.set(key2, value);
                        } else {
                            ((function($this) {
                                var $r;
                                var key3 = f1.state;
                                $r = $this.anims.get(key3);
                                return $r;
                            }(this))).push(f1.frameNumber);
                            ((function($this) {
                                var $r;
                                var key4 = f1.state;
                                $r = $this.allTextures.get(key4);
                                return $r;
                            }(this))).push(new PIXI.Texture(tex, new PIXI.Rectangle(_hcmn_.Std.parseFloat(f1.frame.x), _hcmn_.Std.parseFloat(f1.frame.y), _hcmn_.Std.parseFloat(f1.frame.w), _hcmn_.Std.parseFloat(f1.frame.h))));
                        }
                    }
                } else if (this.mcDefVersion == 2) {
                    this.allFrames = _hcmn_.Reflect.getProperty(mcDef.animeDef, mcDef.name).frames;
                    var fields = _hcmn_.Reflect.fields(this.allFrames);
                    var _g2 = 0;
                    while (_g2 < fields.length) {
                        var field = fields[_g2];
                        ++_g2;
                        var f2 = _hcmn_.Reflect.getProperty(this.allFrames, field);
                        if (!this.allTextures.exists(f2.lbl)) {
                            var value1 = [_hcmn_.Std.parseInt(field)];
                            this.anims.set(f2.lbl, value1);
                            var value2 = [new PIXI.Texture(tex, new PIXI.Rectangle(parseFloat(f2.rect.x), parseFloat(f2.rect.y), parseFloat(f2.rect.w), parseFloat(f2.rect.h)))];
                            this.allTextures.set(f2.lbl, value2);
                        } else {
                            this.anims.get(f2.lbl).push(_hcmn_.Std.parseInt(field));
                            this.allTextures.get(f2.lbl).push(new PIXI.Texture(tex, new PIXI.Rectangle(parseFloat(f2.rect.x), parseFloat(f2.rect.y), parseFloat(f2.rect.w), parseFloat(f2.rect.h))));
                        }
                    }
                }
                this._mc = new PIXI.extras.MovieClip(this.allTextures.get(mcDef.animDefState != null ? mcDef.animDefState : "default"));
                this._mc.interactive = false;
                this._mc.interactionFrequency = 0;
                this._mc.buttonMode = false;
                this._mc.animationSpeed = 0.5;
                this._mc.onComplete = $bind(this, this.runAllHandlers);
                this._mc.loop = false;
                this.currentStateName = mcDef.animDefState;
                if (mcDef.offScreen == true) {
                    this.osStage = new displayengineImpl.OffscreenStage(this._mc.width | 0, this._mc.height | 0);
                    this.osStage.getStage().addChild(this._mc);
                    this.bitmap = new displayengineImpl.Bitmap(this.osStage, new displayEngineApi.Rectangle(0, 0, this._mc.width, this._mc.height));
                    this.addChild(this.bitmap);
                } else this.addChild(this._mc);
            }
        };
        displayengineImpl.PixiMovieClip = ck_implements(displayengineImpl.PixiMovieClip, displayEngineApi.IMovieClip);
        displayengineImpl.PixiMovieClip.__interfaces__ = [displayEngineApi.IMovieClip];
        displayengineImpl.PixiMovieClip.__name__ = ["displayengineImpl", "PixiMovieClip"];
        displayengineImpl.PixiMovieClip.__super__ = displayengineImpl.Sprite;
        for (var k in displayengineImpl.Sprite.prototype) displayengineImpl.PixiMovieClip.prototype[k] = displayengineImpl.Sprite.prototype[k];
        displayengineImpl.PixiMovieClip.prototype._mc = null;
        displayengineImpl.PixiMovieClip.prototype.allFrames = null;
        displayengineImpl.PixiMovieClip.prototype.anims = null;
        displayengineImpl.PixiMovieClip.prototype.allTextures = null;
        displayengineImpl.PixiMovieClip.prototype._enabled = null;
        displayengineImpl.PixiMovieClip.prototype.allOnCompleteHandlers = null;
        displayengineImpl.PixiMovieClip.prototype.allOnStartHandlers = null;
        displayengineImpl.PixiMovieClip.prototype.currentStateName = null;
        displayengineImpl.PixiMovieClip.prototype.mcDefVersion = null;
        displayengineImpl.PixiMovieClip.prototype.mcDef = null;
        displayengineImpl.PixiMovieClip.prototype.bitmap = null;
        displayengineImpl.PixiMovieClip.prototype.osStage = null;
        displayengineImpl.PixiMovieClip.prototype.applyPNGMask = function(mask) {
            if (this.osStage != null) this.osStage.applyMask(mask);
        };
        displayengineImpl.PixiMovieClip.prototype.toBitmap = function() {
            if (this.osStage != null) return new displayengineImpl.Bitmap(this.osStage, new displayEngineApi.Rectangle(0, 0, this._obj.width, this._obj.height));
            return null;
        };
        displayengineImpl.PixiMovieClip.prototype.getStateFrameCount = function(stateName) {
            if (stateName == null) stateName = this.currentStateName;
            if (this.anims.exists(stateName)) return this.anims.get(stateName).length;
            return -1;
        };
        displayengineImpl.PixiMovieClip.prototype.gotoAndPlay = function(scene, fromFrame) {
            if (fromFrame == null) fromFrame = 0;
            if (scene == null) scene = "default";
            this.currentStateName = scene;
            if (this.allTextures.exists(scene)) {
                this._mc.textures = this.allTextures.get(scene);
                this._mc.gotoAndPlay(fromFrame);
            }
        };
        displayengineImpl.PixiMovieClip.prototype.gotoAndStop = function(scene, fromFrame) {
            if (fromFrame == null) fromFrame = 0;
            if (scene == null) scene = "default";
            this.currentStateName = scene;
            if (this.allTextures.exists(scene)) {
                this._mc.textures = this.allTextures.get(scene);
                this._mc.gotoAndStop(fromFrame);
            }
        };
        displayengineImpl.PixiMovieClip.prototype.gotoAndPlayReversed = function(scene, fromFrame) {
            if (fromFrame == null) fromFrame = 0;
            if (scene == null) scene = "default";
            this.currentStateName = scene;
            if (this.allTextures.exists(scene)) {
                var _this = this.allTextures.get(scene);
                this._mc.textures = _this.slice();
                this._mc.textures.reverse();
                this._mc.gotoAndPlay(fromFrame);
            }
        };
        displayengineImpl.PixiMovieClip.prototype.gotoAndStopReversed = function(scene, fromFrame) {
            if (fromFrame == null) fromFrame = 0;
            if (scene == null) scene = "default";
            this.currentStateName = scene;
            if (this.allTextures.exists(scene)) {
                var _this = this.allTextures.get(scene);
                this._mc.textures = _this.slice();
                this._mc.textures.reverse();
                this._mc.gotoAndStop(fromFrame);
            }
        };
        displayengineImpl.PixiMovieClip.prototype.nextFrame = function() {
            if (this._mc.currentFrame >= this.getStateFrameCount(this.currentStateName)) this._mc.currentFrame = 0;
            this.gotoAndStop(this.currentStateName, this._mc.currentFrame);
            ++this._mc.currentFrame;
        };
        displayengineImpl.PixiMovieClip.prototype.prevFrame = function() {
            this.gotoAndStop(this.currentStateName, this._mc.currentFrame);
            --this._mc.currentFrame;
            if (this._mc.currentFrame == 0) this._mc.currentFrame = this.getStateFrameCount(this.currentStateName) - 1;
        };
        displayengineImpl.PixiMovieClip.prototype.nextScene = function() {};
        displayengineImpl.PixiMovieClip.prototype.prevScene = function() {};
        displayengineImpl.PixiMovieClip.prototype.play = function() {
            this._mc.play();
        };
        displayengineImpl.PixiMovieClip.prototype.stop = function() {
            this._mc.stop();
        };
        displayengineImpl.PixiMovieClip.prototype.onAnimationEnd = function(handler) {
            this.allOnCompleteHandlers.push(handler);
        };
        displayengineImpl.PixiMovieClip.prototype.offAnimationEnd = function(handler) {
            var x = handler;
            _hcmn_.HxOverrides.remove(this.allOnCompleteHandlers, x);
        };
        displayengineImpl.PixiMovieClip.prototype.onAnimationStart = function(handler) {
            this.allOnStartHandlers.push(handler);
        };
        displayengineImpl.PixiMovieClip.prototype.offAnimationStart = function(handler) {
            var x = handler;
            _hcmn_.HxOverrides.remove(this.allOnStartHandlers, x);
        };
        displayengineImpl.PixiMovieClip.prototype.runAllHandlers = function() {
            var _g = 0;
            var _g1 = this.allOnCompleteHandlers;
            while (_g < _g1.length) {
                var handler = _g1[_g];
                ++_g;
                handler();
            }
            var _g2 = 0;
            var _g11 = this.allOnStartHandlers;
            while (_g2 < _g11.length) {
                var handler1 = _g11[_g2];
                ++_g2;
                handler1();
            }
        };
        displayengineImpl.PixiMovieClip.prototype.getEnabled = function() {
            return this._enabled;
        };
        displayengineImpl.PixiMovieClip.prototype.setEnabled = function(val) {
            this._enabled = val;
        };
        displayengineImpl.PixiMovieClip.prototype.getAnimationSpeed = function() {
            return this._mc.animationSpeed * 10 * 6;
        };
        displayengineImpl.PixiMovieClip.prototype.setAnimationSpeed = function(val) {
            this._mc.animationSpeed = val / 10 / 6;
        };
        displayengineImpl.PixiMovieClip.prototype.getPaused = function() {
            return !this._mc.playing;
        };
        displayengineImpl.PixiMovieClip.prototype.setPaused = function(value) {
            this._mc.playing = false;
        };
        displayengineImpl.PixiMovieClip.prototype.getLoop = function() {
            return this._mc.loop;
        };
        displayengineImpl.PixiMovieClip.prototype.setLoop = function(value) {
            this._mc.loop = value;
        };
        displayengineImpl.PixiMovieClip.prototype.getCurrentFrame = function() {
            return this._mc.currentFrame;
        };
        displayengineImpl.PixiMovieClip.prototype.setCurrentFrame = function(value) {
            this._mc.currentFrame = value;
        };
        displayengineImpl.PixiMovieClip.prototype.getMCEvents = function() {
            return null;
        };
        displayengineImpl.PixiMovieClip.prototype.dispose = function() {
            this.stop();
            var _g = 0;
            var _g1 = this.allFrames;
            while (_g < _g1.length) {
                var frame = _g1[_g];
                ++_g;
                frame = null;
            }
            this.allFrames = null;
            if (this.anims != null) {
                var $it0 = this.anims.keys();
                while ($it0.hasNext()) {
                    var key = $it0.next();
                    this.anims.remove(key);
                }
                this.anims = null;
            }
            if (this.allTextures != null) {
                var $it1 = this.allTextures.keys();
                while ($it1.hasNext()) {
                    var key1 = $it1.next();
                    this.allTextures.remove(key1);
                }
                this.allTextures = null;
            }
            var _g2 = 0;
            var _g11 = this.allOnCompleteHandlers;
            while (_g2 < _g11.length) {
                var handler = _g11[_g2];
                ++_g2;
                handler = null;
            }
            this.allOnCompleteHandlers = null;
            var _g3 = 0;
            var _g12 = this.allOnStartHandlers;
            while (_g3 < _g12.length) {
                var handler1 = _g12[_g3];
                ++_g3;
                handler1 = null;
            }
            this.allOnStartHandlers = null;
            displayengineImpl.Sprite.prototype.dispose.call(this);
            if (this.osStage != null) {
                this.osStage.dispose();
                this.osStage = null;
                this.bitmap.dispose();
            }
        };
        displayengineImpl.PixiMovieClip.prototype.clone = function() {
            return null;
        };
        displayengineImpl.PixiMovieClip.prototype.getOffscreenBitmaps = function() {
            return null;
        };
        displayengineImpl.PixiMovieClip.prototype.addUnderMask = function(maskId, objToMask) {
            null;
            return;
        };
        displayengineImpl.PixiMovieClip.prototype.__class__ = displayengineImpl.PixiMovieClip;
        displayengineImpl.MovieClip = function(mcDef) {
            if (mcDef.offScreen == null) mcDef.offScreen = false;
            displayengineImpl.PixiMovieClip.call(this, mcDef);
            if (mcDef.videoDef != null) this.initVideo(mcDef.videoDef);
            displayengineImpl.MovieClip.mcCount++;
        };
        displayengineImpl.MovieClip = ck_implements(displayengineImpl.MovieClip, displayEngineApi.IMovieClip);
        displayengineImpl.MovieClip.__interfaces__ = [displayEngineApi.IMovieClip];
        displayengineImpl.MovieClip.__name__ = ["displayengineImpl", "MovieClip"];
        displayengineImpl.MovieClip.__super__ = displayengineImpl.PixiMovieClip;
        for (var k in displayengineImpl.PixiMovieClip.prototype) displayengineImpl.MovieClip.prototype[k] = displayengineImpl.PixiMovieClip.prototype[k];
        displayengineImpl.MovieClip.prototype.getOffscreenBitmaps = function() {
            if (this.osStage != null) return this.osStage.getRegisteredBitmaps();
            return null;
        };
        displayengineImpl.MovieClip.prototype.createShapeMask = function(cfg) {
            var shape = new displayengineImpl.Graphics(true);
            shape.lineStyle(1, 0, 0);
            shape.beginFill(0);
            var shapePoints = cfg;
            shape.moveTo(shapePoints[0][0][0], shapePoints[0][0][1]);
            var _g1 = 0;
            var _g = shapePoints.length;
            while (_g1 < _g) {
                var i = _g1++;
                var points = shapePoints[i];
                var _g3 = 0;
                var _g2 = points.length;
                while (_g3 < _g2) {
                    var j = _g3++;
                    shape.quadraticCurveTo(points[1][0], points[1][1], points[2][0], points[2][1]);
                }
            }
            return shape;
        };
        displayengineImpl.MovieClip.prototype.createPNGMask = function(cfg) {
            var canvasMask;
            var _this = window.document;
            canvasMask = _this.createElement("canvas");
            var ctx = canvasMask.getContext("2d", null);
            ctx.fillStyle = "#ffffff";
            ctx.beginPath();
            ctx.moveTo(cfg[0][0][0], cfg[0][0][1]);
            var _g1 = 0;
            var _g = cfg.length;
            while (_g1 < _g) {
                var i = _g1++;
                var points = cfg[i];
                var _g3 = 0;
                var _g2 = points.length;
                while (_g3 < _g2) {
                    var j = _g3++;
                    ctx.quadraticCurveTo(points[1][0], points[1][1], points[2][0], points[2][1]);
                }
            }
            ctx.closePath();
            return canvasMask;
        };
        displayengineImpl.MovieClip.prototype.findDispObjByName = function(id, children) {
            var _g1 = 0;
            var _g = children.length;
            while (_g1 < _g) {
                var i = _g1++;
                var ob = children[i];
                if (ob.name == id) return ob;
                else if (ob != null && ob.getChildren != null && ob.getChildren() != null) {
                    var displayObj = this.findDispObjByName(id, ob.getChildren());
                    if (displayObj != null) return displayObj;
                } else {}
            }
            return null;
        };
        displayengineImpl.MovieClip.prototype.initVideo = function(videoDef) {
            var video = new displayengineImpl.MCVideo(videoDef.src, videoDef.poster, videoDef.width, videoDef.height, videoDef.framerate, videoDef.autoPlay, videoDef.loop);
            this.addChild(video);
        };
        displayengineImpl.MovieClip.prototype.setDisplayType = function() {
            displayengineImpl.PixiMovieClip.prototype.setDisplayType.call(this);
            this.displayType.push(displayEngineApi.DisplayType.MOVIE_CLIP);
        };
        displayengineImpl.MovieClip.prototype.gotoAndPlay = function(scene, fromFrame) {
            if (fromFrame == null) fromFrame = 0;
            if (scene == null) scene = "default";
            displayengineImpl.PixiMovieClip.prototype.gotoAndPlay.call(this, scene, fromFrame);
        };
        displayengineImpl.MovieClip.prototype.play = function() {
            displayengineImpl.PixiMovieClip.prototype.play.call(this);
        };
        displayengineImpl.MovieClip.prototype.stop = function() {
            displayengineImpl.PixiMovieClip.prototype.stop.call(this);
        };
        displayengineImpl.MovieClip.prototype.getPaused = function() {
            return displayengineImpl.PixiMovieClip.prototype.getPaused.call(this);
        };
        displayengineImpl.MovieClip.prototype.on = function(type, listener, useCapture) {
            this.addEventListener(type, listener, useCapture);
        };
        displayengineImpl.MovieClip.prototype.addEventListener = function(type, listener, useCapture) {
            if (_hcmn_.StringTools.startsWith(type, "mc_")) switch (type) {
                case displayEngineApi.MovieClipEvents.ANIMATION_COMPLETE:
                    this.onAnimationEnd(listener);
                    break;
                case displayEngineApi.MovieClipEvents.ANIMATION_START:
                    this.onAnimationStart(listener);
                    break;
                case displayEngineApi.MovieClipEvents.ANIMATION_TICK:
                    break;
                default:
            } else displayengineImpl.PixiMovieClip.prototype.addEventListener.call(this, type, listener, useCapture);
        };
        displayengineImpl.MovieClip.prototype.off = function(type, listener, useCapture) {
            this.removeEventListener(type, listener, useCapture);
        };
        displayengineImpl.MovieClip.prototype.removeEventListener = function(type, listener, useCapture) {
            if (_hcmn_.StringTools.startsWith(type, "mc_")) switch (type) {
                case displayEngineApi.MovieClipEvents.ANIMATION_COMPLETE:
                    this.offAnimationEnd(listener);
                    break;
                case displayEngineApi.MovieClipEvents.ANIMATION_START:
                    this.offAnimationStart(listener);
                    break;
                case displayEngineApi.MovieClipEvents.ANIMATION_TICK:
                    break;
                default:
            } else displayengineImpl.PixiMovieClip.prototype.removeEventListener.call(this, type, listener, useCapture);
        };
        displayengineImpl.MovieClip.prototype.dispose = function() {
            displayengineImpl.PixiMovieClip.prototype.dispose.call(this);
            displayengineImpl.MovieClip.mcCount--;
        };
        displayengineImpl.MovieClip.prototype.clone = function() {
            return new displayengineImpl.MovieClip(this.mcDef);
        };
        displayengineImpl.MovieClip.prototype.__class__ = displayengineImpl.MovieClip;
        displayengineImpl.OffscreenStage = function(width, height, isWebGL, timingMode, targetFPS) {
            if (targetFPS == null) targetFPS = 30;
            if (isWebGL == null) isWebGL = true;
            this.maskY = 0;
            this.maskX = 0;
            this._bitmapChildren = [];
            if (timingMode == null) timingMode = displayEngineApi.TimingMode.RAF;
            var _this = window.document;
            this._canvas = _this.createElement("canvas");
            this._canvas.width = width;
            this._canvas.height = height;
            this._canvas.setAttribute("style", "pointer-events: none; width: " + width + "px; height: " + height + "px; display: none;");
            this._width = width;
            this._height = height;
            this._isWebGL = isWebGL;
            if (!isWebGL) this._context = this._canvas.getContext("2d", null);
            this.id = displayEngineUtils.Utils.uuid();
            var stageDef = new displayEngineApi.StageDef("offscreen" + _hcmn_.Math.round(_hcmn_.Math.random() * 1000), new displayEngineApi.Point(width, height), this._canvas, isWebGL, timingMode, targetFPS);
            stageDef.targetFPS = targetFPS;
            this._stage = new displayengineImpl.Stage(stageDef);
            this._stage.set_isOffscreen(true);
            if (this.detectIE()) window.document.body.appendChild(this._canvas);
            displayengineImpl.OffscreenStage.allOffscreenStages.push(this);
        };
        displayengineImpl.OffscreenStage = ck_implements(displayengineImpl.OffscreenStage, displayEngineApi.IOffscreenStage);
        displayengineImpl.OffscreenStage.__interfaces__ = [displayEngineApi.IOffscreenStage];
        displayengineImpl.OffscreenStage.__name__ = ["displayengineImpl", "OffscreenStage"];
        displayengineImpl.OffscreenStage.prototype._canvas = null;
        displayengineImpl.OffscreenStage.prototype._maskedCanvas = null;
        displayengineImpl.OffscreenStage.prototype._context = null;
        displayengineImpl.OffscreenStage.prototype._maskedContext = null;
        displayengineImpl.OffscreenStage.prototype._stage = null;
        displayengineImpl.OffscreenStage.prototype._bitmapChildren = null;
        displayengineImpl.OffscreenStage.prototype._mask = null;
        displayengineImpl.OffscreenStage.prototype._isWebGL = null;
        displayengineImpl.OffscreenStage.prototype._width = null;
        displayengineImpl.OffscreenStage.prototype._height = null;
        displayengineImpl.OffscreenStage.prototype.maskX = null;
        displayengineImpl.OffscreenStage.prototype.maskY = null;
        displayengineImpl.OffscreenStage.prototype.id = null;
        displayengineImpl.OffscreenStage.prototype.applyMask = function(mask) {
            if (!this._isWebGL) {
                if (mask != null) this._mask = mask;
                if (this._mask != null) {
                    var _this = window.document;
                    this._maskedCanvas = _this.createElement("canvas");
                    this._maskedCanvas.width = this._width;
                    this._maskedCanvas.height = this._height;
                    this._maskedCanvas.setAttribute("style", "pointer-events: none; width: " + this._width + "px; height: " + this._height + "px; display: none;");
                    this._maskedContext = this._maskedCanvas.getContext("2d", null);
                    this._stage.on(displayEngineApi.DisplayObjectEvents.ENTER_FRAME, $bind(this, this.drawMask));
                    var _g = 0;
                    var _g1 = this._bitmapChildren;
                    while (_g < _g1.length) {
                        var bmp = _g1[_g];
                        ++_g;
                        bmp.update(this._maskedCanvas, this._width, this._height);
                    }
                }
            } else null;
        };
        displayengineImpl.OffscreenStage.prototype.drawMask = function() {
            this._maskedContext.drawImage(this._mask, this.maskX, this.maskY);
            this._maskedContext.globalCompositeOperation = "source-atop";
            this._maskedContext.drawImage(this._canvas, 0, 0, this._width, this._height);
        };
        displayengineImpl.OffscreenStage.prototype.dispose = function() {
            _hcmn_.HxOverrides.remove(displayengineImpl.OffscreenStage.allOffscreenStages, this);
            var _g = 0;
            var _g1 = this._bitmapChildren;
            while (_g < _g1.length) {
                var bitmap = _g1[_g];
                ++_g;
                if (bitmap != null && bitmap.getParent() != null) {
                    bitmap.getParent().removeChild(bitmap.getDisplayObject());
                    bitmap.dispose();
                    bitmap = null;
                }
            }
            this._bitmapChildren = null;
            this._stage.dispose();
            this._stage = null;
            if (this.detectIE() || this._canvas.parentElement != null) window.document.body.removeChild(this._canvas);
            this._context = null;
            this._canvas = null;
            this._maskedContext = null;
            this._mask = null;
            this._maskedCanvas = null;
        };
        displayengineImpl.OffscreenStage.prototype.addBitmapChild = function(bmp) {
            this._bitmapChildren.push(bmp);
        };
        displayengineImpl.OffscreenStage.prototype.getRegisteredBitmaps = function() {
            return this._bitmapChildren;
        };
        displayengineImpl.OffscreenStage.prototype.getCanvas = function() {
            return this._canvas;
        };
        displayengineImpl.OffscreenStage.prototype.getMaskedCanvas = function() {
            return this._maskedCanvas;
        };
        displayengineImpl.OffscreenStage.prototype.getStage = function() {
            return this._stage;
        };
        displayengineImpl.OffscreenStage.prototype.setMask = function(m) {
            this._mask = m;
        };
        displayengineImpl.OffscreenStage.prototype.detectIE = function() {
            var ua = window.navigator.userAgent.toUpperCase();
            var msie = ua.indexOf("MSIE ");
            if (msie > 0) return true;
            var trident = ua.indexOf("TRIDENT/");
            if (trident > 0) {
                var rv = ua.indexOf("RV:");
                return rv > 0;
            }
            var edge = ua.indexOf("EDGE/");
            if (edge > 0) return true;
            return false;
        };
        displayengineImpl.OffscreenStage.getAllStages = function() {
            return displayengineImpl.OffscreenStage.allOffscreenStages;
        };
        displayengineImpl.OffscreenStage.prototype.__class__ = displayengineImpl.OffscreenStage;
        displayengineImpl.ParticleSystem = function(bmp, type, config) {
            this.isRunning = false;
            this.loop = true;
            this.pathPassesNum = 0;
            this.position = 0;
            this.speed = 1;
            displayengineImpl.DisplayObjectContainer.call(this);
            if (_hcmn_.js_Boot.__instanceof(bmp, displayengineImpl.MovieClip)) this.bmp = bmp.toBitmap();
            else this.bmp = bmp;
            this.type = type;
            this.config = config;
            var art = null;
            if (_hcmn_.js_Boot.__instanceof(bmp, displayEngineApi.IBitmap)) art = bmp._texture;
            else if ((bmp instanceof Array) && bmp.__enum__ == null) {
                art = [];
                var _g = 0;
                var _g1;
                _g1 = _hcmn_.js_Boot.__cast(bmp, Array);
                while (_g < _g1.length) {
                    var b = _g1[_g];
                    ++_g;
                    if (_hcmn_.js_Boot.__instanceof(b, displayengineImpl.MovieClip)) {
                        var mcBMP = b.toBitmap();
                        if (mcBMP != null) art.push(mcBMP._texture);
                    } else art.push(b._texture);
                }
            }
            this.emitter = new cloudkid.Emitter(this._obj, art, config);
            if (type == "anim") this.emitter.particleConstructor = cloudkid.AnimatedParticle;
            else if (type == "path") this.emitter.particleConstructor = cloudkid.PathParticle;
        };
        displayengineImpl.ParticleSystem = ck_implements(displayengineImpl.ParticleSystem, displayEngineApi.IParticleSystem);
        displayengineImpl.ParticleSystem.__interfaces__ = [displayEngineApi.IParticleSystem];
        displayengineImpl.ParticleSystem.__name__ = ["displayengineImpl", "ParticleSystem"];
        displayengineImpl.ParticleSystem.__super__ = displayengineImpl.DisplayObjectContainer;
        for (var k in displayengineImpl.DisplayObjectContainer.prototype) displayengineImpl.ParticleSystem.prototype[k] = displayengineImpl.DisplayObjectContainer.prototype[k];
        displayengineImpl.ParticleSystem.prototype.emitter = null;
        displayengineImpl.ParticleSystem.prototype.speed = null;
        displayengineImpl.ParticleSystem.prototype.position = null;
        displayengineImpl.ParticleSystem.prototype.pathPassesNum = null;
        displayengineImpl.ParticleSystem.prototype.polypoints = null;
        displayengineImpl.ParticleSystem.prototype.loop = null;
        displayengineImpl.ParticleSystem.prototype.bmp = null;
        displayengineImpl.ParticleSystem.prototype.type = null;
        displayengineImpl.ParticleSystem.prototype.config = null;
        displayengineImpl.ParticleSystem.prototype.stage = null;
        displayengineImpl.ParticleSystem.prototype.isRunning = null;
        displayengineImpl.ParticleSystem.prototype.makePolyPoints = function(path) {
            var points = [];
            var firstPoint = path.points[0];
            var _g1 = 1;
            var _g = path.points.length;
            while (_g1 < _g) {
                var i = _g1++;
                var startPt = path.points[i - 1];
                var endPt = path.points[i];
                var dx = endPt.x - startPt.x;
                var dy = endPt.y - startPt.y;
                var _g2 = 0;
                while (_g2 < 51) {
                    var n = _g2++;
                    var x = startPt.x + dx * n / 50;
                    var y = startPt.y + dy * n / 50;
                    points.push(new displayEngineApi.Point(x - firstPoint.x, y - firstPoint.y));
                }
            }
            return points;
        };
        displayengineImpl.ParticleSystem.prototype.animateParticlesOnPath = function() {
            this.position += this.speed;
            if (this.position > this.polypoints.length - 1) {
                if (this.loop) this.position = 0;
                else return;
            }
            var pt = this.polypoints[this.position];
            this.moveTo(pt.x, pt.y);
        };
        displayengineImpl.ParticleSystem.prototype.update = function() {
            if (this.isRunning) {
                this.emitter.update(this.stage.getDeltaTime() / 1000);
                if (this.polypoints != null) this.animateParticlesOnPath();
            }
        };
        displayengineImpl.ParticleSystem.prototype.moveTo = function(x, y) {
            this.emitter.updateSpawnPos(x, y);
        };
        displayengineImpl.ParticleSystem.prototype.start = function(stage, path, loop) {
            if (loop == null) loop = true;
            var _g = this;
            this.stage = stage;
            this.stage = stage;
            this.loop = loop;
            if (path != null) this.polypoints = this.makePolyPoints(path);
            this.isRunning = true;
            _hcmn_.haxe_Timer.delay(function() {
                stage.on(displayEngineApi.DisplayObjectEvents.ENTER_FRAME, $bind(_g, _g.update));
            }, 1);
        };
        displayengineImpl.ParticleSystem.prototype.stop = function() {
            this.isRunning = false;
            this.stage.off(displayEngineApi.DisplayObjectEvents.ENTER_FRAME, $bind(this, this.update));
        };
        displayengineImpl.ParticleSystem.prototype.dispose = function() {
            this.stop();
            this.emitter.destroy();
            this.polypoints = null;
            this.bmp = null;
            this.config = null;
            displayengineImpl.DisplayObjectContainer.prototype.dispose.call(this);
        };
        displayengineImpl.ParticleSystem.prototype.__class__ = displayengineImpl.ParticleSystem;
        displayengineImpl.PixiStage = function(def) {
            this._mainLoop = [];
            this._allListeners = new _hcmn_.haxe_ds_StringMap();
            this._rendererName = displayEngineApi.RendererName.PIXI;
            this._stage = new PIXI.Container();
            this._stage.isStage = true;
            var options = {};
            if (def.canvas != null) options.view = def.canvas;
            options.antialias = true;
            options.resolution = 1;
            options.transparent = true;
            if (def.isWebgl) this._renderer = PIXI.autoDetectRenderer(def.dimension.x, def.dimension.y, options);
            else this._renderer = new PIXI.CanvasRenderer(def.dimension.x, def.dimension.y, options);
            this._canvas = this._renderer.view;
        };
        displayengineImpl.PixiStage = ck_implements(displayengineImpl.PixiStage, displayEngineApi.IStage);
        displayengineImpl.PixiStage.__interfaces__ = [displayEngineApi.IStage];
        displayengineImpl.PixiStage.__name__ = ["displayengineImpl", "PixiStage"];
        displayengineImpl.PixiStage.prototype._rendererName = null;
        displayengineImpl.PixiStage.prototype._stage = null;
        displayengineImpl.PixiStage.prototype._canvas = null;
        displayengineImpl.PixiStage.prototype._renderer = null;
        displayengineImpl.PixiStage.prototype._allListeners = null;
        displayengineImpl.PixiStage.prototype._mainLoop = null;
        displayengineImpl.PixiStage.prototype._fpsInfo = null;
        displayengineImpl.PixiStage.prototype.update = function(e) {
            this._renderer.render(this._stage);
        };
        displayengineImpl.PixiStage.prototype.getRendererType = function() {
            if (_hcmn_.js_Boot.__instanceof(this._renderer, PIXI.WebGLRenderer)) return displayEngineApi.RendererType.RENDERER_WEBGL;
            else return displayEngineApi.RendererType.RENDERER_CANVAS;
        };
        displayengineImpl.PixiStage.prototype.removeAllChildren = function() {
            this._stage.removeChildren(0, this._stage.children.length);
        };
        displayengineImpl.PixiStage.prototype.addEventListener = function(type, listener, useCapture) {
            var _g = this;
            if (type == displayEngineApi.DisplayObjectEvents.ENTER_FRAME) this._mainLoop.push(listener);
            else {
                this._stage.interactive = true;
                if (this._allListeners.exists(type)) this._allListeners.get(type).push(listener);
                else {
                    var v = [];
                    this._allListeners.set(type, v);
                    v;
                    this._allListeners.get(type).push(listener);
                }
                if (!Object.prototype.hasOwnProperty.call(this._stage, type)) this._stage[type] = function(evt) {
                    if (_g._allListeners.get(type) != null) {
                        var _g1 = 0;
                        var _g2 = _g._allListeners.get(type);
                        while (_g1 < _g2.length) {
                            var fn = _g2[_g1];
                            ++_g1;
                            fn(evt);
                        }
                    }
                };
            }
        };
        displayengineImpl.PixiStage.prototype.removeEventListener = function(type, listener, useCapture) {
            if (type == displayEngineApi.DisplayObjectEvents.ENTER_FRAME) {
                var x = listener;
                _hcmn_.HxOverrides.remove(this._mainLoop, x);
            } else {
                var $it0 = this._allListeners.keys();
                while ($it0.hasNext()) {
                    var key = $it0.next();
                    if (key == type) {
                        var _this = this._allListeners.get(key);
                        var x1 = listener;
                        _hcmn_.HxOverrides.remove(_this, x1);
                        return;
                    }
                }
            }
        };
        displayengineImpl.PixiStage.prototype.removeAllEventListeners = function() {
            this._mainLoop = [];
            this._allListeners = new _hcmn_.haxe_ds_StringMap();
        };
        displayengineImpl.PixiStage.prototype.dispose = function() {
            this.removeAllEventListeners();
            this._renderer = null;
            this._stage = null;
            this._canvas = null;
            var $it0 = this._allListeners.keys();
            while ($it0.hasNext()) {
                var key = $it0.next(); {
                    this._allListeners.set(key, null);
                    null;
                }
                this._allListeners.remove(key);
            }
            this._allListeners = null;
            this._mainLoop = null;
            this._fpsInfo = null;
        };
        displayengineImpl.PixiStage.prototype.getRenderer = function() {
            return this._rendererName;
        };
        displayengineImpl.PixiStage.prototype.getCanvas = function() {
            return this._canvas;
        };
        displayengineImpl.PixiStage.prototype.getId = function() {
            return null;
        };
        displayengineImpl.PixiStage.prototype.setTimingMode = function(val) {};
        displayengineImpl.PixiStage.prototype.getTimingMode = function() {
            return null;
        };
        displayengineImpl.PixiStage.prototype.setFPS = function(val) {};
        displayengineImpl.PixiStage.prototype.getHeight = function() {
            return null;
        };
        displayengineImpl.PixiStage.prototype.setHeight = function(val) {
            this._renderer.height = val;
        };
        displayengineImpl.PixiStage.prototype.getWidth = function() {
            return null;
        };
        displayengineImpl.PixiStage.prototype.setWidth = function(val) {
            this._renderer.width = val;
        };
        displayengineImpl.PixiStage.prototype.getScaleX = function() {
            return null;
        };
        displayengineImpl.PixiStage.prototype.setScaleX = function(val) {};
        displayengineImpl.PixiStage.prototype.getScaleY = function() {
            return null;
        };
        displayengineImpl.PixiStage.prototype.setScaleY = function(val) {};
        displayengineImpl.PixiStage.prototype.getAlpha = function() {
            return null;
        };
        displayengineImpl.PixiStage.prototype.setAlpha = function(alpha) {};
        displayengineImpl.PixiStage.prototype.getVisible = function() {
            return null;
        };
        displayengineImpl.PixiStage.prototype.setVisible = function(val) {};
        displayengineImpl.PixiStage.prototype.getMouse = function(event) {
            return null;
        };
        displayengineImpl.PixiStage.prototype.addChild = function(child) {};
        displayengineImpl.PixiStage.prototype.addChildAt = function(child, index) {};
        displayengineImpl.PixiStage.prototype.addChildren = function(_children_) {};
        displayengineImpl.PixiStage.prototype.removeChild = function(child) {};
        displayengineImpl.PixiStage.prototype.removeChildAt = function(index) {};
        displayengineImpl.PixiStage.prototype.getChildIndex = function(child) {
            return null;
        };
        displayengineImpl.PixiStage.prototype.setChildIndex = function(child, index) {};
        displayengineImpl.PixiStage.prototype.getChildAt = function(index) {
            return null;
        };
        displayengineImpl.PixiStage.prototype.getChildByID = function(id) {
            return null;
        };
        displayengineImpl.PixiStage.prototype.getNumChildren = function() {
            return null;
        };
        displayengineImpl.PixiStage.prototype.getChildren = function() {
            return null;
        };
        displayengineImpl.PixiStage.prototype.on = function(type, listener, useCapture) {};
        displayengineImpl.PixiStage.prototype.off = function(type, listener, useCapture) {};
        displayengineImpl.PixiStage.prototype.offAll = function() {};
        displayengineImpl.PixiStage.prototype.render = function() {};
        displayengineImpl.PixiStage.prototype.getDeltaTime = function() {
            return null;
        };
        displayengineImpl.PixiStage.prototype.onWindowTouch = function(handler, fireOnlyOnce) {
            if (fireOnlyOnce == null) fireOnlyOnce = true;
        };
        displayengineImpl.PixiStage.prototype.getFpsInfo = function() {
            return null;
        };
        displayengineImpl.PixiStage.prototype.__class__ = displayengineImpl.PixiStage;
        displayengineImpl.Stage = function(def) {
            this.lastCalledTime = 0;
            this._onPointerDown = null;
            this.lastTap = 0;
            this._deltaTime = 0;
            this._currentTime = 0;
            this.fps = 60;
            this.children = new _hcmn_.haxe_ds_StringMap();
            var _g = this;
            if (def.canvas != null) {
                if (typeof(def.canvas) == "string") def.canvas = window.document.getElementById(def.canvas);
                if (def.canvas != null && def.dimension.x == null && def.dimension.y == null) {
                    var dim = this.getCanvasDimensions(def.canvas);
                    def.dimension = dim;
                }
            }
            displayengineImpl.PixiStage.call(this, def);
            this._id = def.id;
            this._mousePoint = new displayEngineApi.Point(0, 0);
            this._canvas.addEventListener("mousemove", $bind(this, this.updateMousePos), false);
            if (displayengineImpl.DisplayProvider.stages == null) displayengineImpl.DisplayProvider.stages = new _hcmn_.haxe_ds_StringMap();
            if (displayengineImpl.DisplayProvider.stages.get(this._id) != null) this._id = "STAGE_" + displayEngineUtils.Utils.uuid();
            displayengineImpl.DisplayProvider.stages.set(this._id, this);
            this._ticker = new displayengineImpl.Ticker();
            this._ticker.setup(def.timingMode, this._rendererName, def.targetFPS);
            $bind(this, this.update).stage_tick_function = true;
            if (def.timingMode != displayEngineApi.TimingMode.ONCE) this._ticker.onTick($bind(this, this.update));
            this._fpsInfo = {
                fps: 0,
                time: 0
            };
            if (!displayengineImpl.Stage.tweenXSet) {
                displayengineImpl.Stage.tweenXSet = true;
                displayEngineUtils.TweenX.set_updateMode(displayEngineUtils.UpdateModeX.MANUAL);
                this.on(displayEngineApi.DisplayObjectEvents.ENTER_FRAME, function(e) {
                    displayEngineUtils.TweenX.manualUpdate(_g._deltaTime / 1000);
                });
            }
        };
        displayengineImpl.Stage = ck_implements(displayengineImpl.Stage, displayEngineApi.IStage);
        displayengineImpl.Stage.__interfaces__ = [displayEngineApi.IStage];
        displayengineImpl.Stage.__name__ = ["displayengineImpl", "Stage"];
        displayengineImpl.Stage.__super__ = displayengineImpl.PixiStage;
        for (var k in displayengineImpl.PixiStage.prototype) displayengineImpl.Stage.prototype[k] = displayengineImpl.PixiStage.prototype[k];
        displayengineImpl.Stage.prototype._self = null;
        displayengineImpl.Stage.prototype._id = null;
        displayengineImpl.Stage.prototype.parentDOMObject = null;
        displayengineImpl.Stage.prototype.children = null;
        displayengineImpl.Stage.prototype._mousePoint = null;
        displayengineImpl.Stage.prototype._ticker = null;
        displayengineImpl.Stage.prototype.isOffscreen = null;
        displayengineImpl.Stage.prototype.fps = null;
        displayengineImpl.Stage.prototype._currentTime = null;
        displayengineImpl.Stage.prototype._deltaTime = null;
        displayengineImpl.Stage.prototype.timeout = null;
        displayengineImpl.Stage.prototype.lastTap = null;
        displayengineImpl.Stage.prototype.get_isOffscreen = function() {
            if (this._stage.isOffscreen != null) return this._stage.isOffscreen;
            return false;
        };
        displayengineImpl.Stage.prototype.set_isOffscreen = function(val) {
            return this._stage.isOffscreen = val;
        };
        displayengineImpl.Stage.prototype.getCanvasDimensions = function(canvas) {
            var dimension = new displayEngineApi.Point(0, 0);
            if (canvas.width != null) dimension.x = canvas.width;
            if (canvas.height != null) dimension.y = canvas.height;
            return dimension;
        };
        displayengineImpl.Stage.prototype._onPointerDown = null;
        displayengineImpl.Stage.prototype.onWindowTouch = function(handler, fireOnlyOnce) {
            if (fireOnlyOnce == null) fireOnlyOnce = true;
            var _g = this;
            if (this._onPointerDown == null) {
                var touchDevice = 'ontouchstart' in document.documentElement;
                var elm = window.document.body;
                this._onPointerDown = function(_) {
                    handler();
                    if (fireOnlyOnce) {
                        elm.removeEventListener(touchDevice ? "touchstart" : "mousedown", _g._onPointerDown, false);
                        _g._onPointerDown = null;
                    }
                };
                elm.addEventListener(touchDevice ? "touchstart" : "mousedown", this._onPointerDown, false);
            }
        };
        displayengineImpl.Stage.prototype.updateMousePos = function(evt) {
            var rect = this._canvas.getBoundingClientRect();
            var mouseX = evt.clientX - rect.left;
            var mouseY = evt.clientY - rect.top;
            this._mousePoint.x = mouseX;
            this._mousePoint.y = mouseY;
        };
        displayengineImpl.Stage.prototype.update = function(e) {
            var _g = 0;
            var _g1 = this._mainLoop;
            while (_g < _g1.length) {
                var f = _g1[_g];
                ++_g;
                f(e);
            }
            displayengineImpl.PixiStage.prototype.update.call(this, e);
            this.calculateFps();
        };
        displayengineImpl.Stage.prototype.render = function() {
            this.update();
        };
        displayengineImpl.Stage.prototype.getDeltaTime = function() {
            return this._deltaTime;
        };
        displayengineImpl.Stage.prototype.updateChildren = function(child, action) {
            if (action == null) action = "add";
            var _g = 0;
            var _g1 = child.children;
            while (_g < _g1.length) {
                var c = _g1[_g];
                ++_g;
                if (action == "add") c.stageName = this._id;
                else c.stageName = c.stageName;
                if (action == "remove") c.stageName = "";
                else c.stageName = c.stageName;
                if (_hcmn_.js_Boot.__instanceof(c, displayengineImpl.DisplayObjectContainer)) this.updateChildren(c);
            }
            if (this._ticker.timingMode == displayEngineApi.TimingMode.ONCE) this.update();
        };
        displayengineImpl.Stage.prototype.addChild = function(child) {
            if (child.getParent != null && child.getParent() != null) {
                if (child.getParent().removeChild != null) child.getParent().removeChild(child);
            }
            if (child.getDisplayObject == null) this._stage.addChild(child);
            else {
                this._stage.addChild(child.getDisplayObject());
                var key = child.id;
                var value = child;
                this.children.set(key, value);
                child._parent = this;
            }
            child.stageName = this._id;
            if (_hcmn_.js_Boot.__instanceof(child, displayengineImpl.DisplayObjectContainer)) this.updateChildren(child, "add");
            if (child.getZIndex != null && child.setZIndex != null) child.setZIndex(child.getZIndex());
            if (this._ticker.timingMode == displayEngineApi.TimingMode.ONCE) this.update();
            if (child._onAddedToStage != null) {
                child._onAddedToStage();
                child._onAddedToStage = null;
            }
        };
        displayengineImpl.Stage.prototype.addChildAt = function(child, index) {
            if (child.getParent != null && child.getParent() != null) {
                if (child.getParent().removeChild != null) child.getParent().removeChild(child);
            }
            if (child.getDisplayObject == null) this._stage.addChildAt(child, index);
            else {
                this._stage.addChildAt(child.getDisplayObject(), index);
                var key = child.id;
                var value = child;
                this.children.set(key, value);
                child._parent = this;
            }
            child.stageName = this._id;
            if (_hcmn_.js_Boot.__instanceof(child, displayengineImpl.DisplayObjectContainer)) this.updateChildren(child, "add");
            if (this._ticker.timingMode == displayEngineApi.TimingMode.ONCE) this.update();
            if (child._onAddedToStage != null) {
                child._onAddedToStage();
                child._onAddedToStage = null;
            }
        };
        displayengineImpl.Stage.prototype.addChildren = function(_children_) {
            var _g = 0;
            while (_g < _children_.length) {
                var child = _children_[_g];
                ++_g;
                if (child.getParent != null && child.getParent() != null) {
                    if (child.getParent().removeChild != null) child.getParent().removeChild(child);
                }
                if (child.getDisplayObject == null) this._stage.addChild(child);
                else {
                    this._stage.addChild(child.getDisplayObject());
                    var key = child.id;
                    var value = child;
                    this.children.set(key, value);
                    child._parent = this;
                }
                child.stageName = this._id;
                if (_hcmn_.js_Boot.__instanceof(child, displayengineImpl.DisplayObjectContainer)) this.updateChildren(child, "add");
                if (child._onAddedToStage != null) {
                    child._onAddedToStage();
                    child._onAddedToStage = null;
                }
            }
            if (this._ticker.timingMode == displayEngineApi.TimingMode.ONCE) this.update();
        };
        displayengineImpl.Stage.prototype.removeChild = function(child) {
            if (child.getDisplayObject == null) this._stage.removeChild(child);
            else {
                var key = child.id;
                this.children.remove(key);
                this._stage.removeChild(child.getDisplayObject());
            }
            child.stageName = "";
            if (_hcmn_.js_Boot.__instanceof(child, displayengineImpl.DisplayObjectContainer)) this.updateChildren(child, "remove");
            if (this._ticker.timingMode == displayEngineApi.TimingMode.ONCE) this.update();
        };
        displayengineImpl.Stage.prototype.removeChildAt = function(index) {
            var child = this.getChildAt(index)._owner;
            this.children.remove(child.id);
            child.stageName = "";
            if (_hcmn_.js_Boot.__instanceof(child, displayengineImpl.DisplayObjectContainer)) this.updateChildren(child, "remove");
            this._stage.removeChildAt(index);
            if (this._ticker.timingMode == displayEngineApi.TimingMode.ONCE) this.update();
        };
        displayengineImpl.Stage.prototype.removeAllChildren = function() {
            displayengineImpl.PixiStage.prototype.removeAllChildren.call(this);
            var $it0 = this.children.keys();
            while ($it0.hasNext()) {
                var childID = $it0.next();
                if (this.children.get(childID) != null && this.children.get(childID).getDisplayObject != null) {
                    this.children.set(childID, null);
                    this.children.remove(childID);
                }
            }
            if (this._ticker.timingMode == displayEngineApi.TimingMode.ONCE) this.update();
        };
        displayengineImpl.Stage.prototype.getChildren = function() {
            var _children = [];
            var $it0 = this.children.keys();
            while ($it0.hasNext()) {
                var key = $it0.next();
                _children.push(this.children.get(key));
            }
            return _children;
        };
        displayengineImpl.Stage.prototype.getChildIndex = function(child) {
            if (child.getDisplayObject == null) return this._stage.getChildIndex(child);
            return this._stage.getChildIndex(child.getDisplayObject());
        };
        displayengineImpl.Stage.prototype.setChildIndex = function(child, index) {
            if (child.getDisplayObject == null) this._stage.setChildIndex(child, index);
            else this._stage.setChildIndex(child.getDisplayObject(), index);
            if (this._ticker.timingMode == displayEngineApi.TimingMode.ONCE) this.update();
        };
        displayengineImpl.Stage.prototype.getChildAt = function(index) {
            var $it0 = this.children.keys();
            while ($it0.hasNext()) {
                var key = $it0.next();
                if (this.children.get(key).getZOrder() == index) return this.children.get(key);
            }
            return null;
        };
        displayengineImpl.Stage.prototype.getChildByID = function(id) {
            return this.children.get(id);
        };
        displayengineImpl.Stage.prototype.on = function(type, listener, useCapture) {
            this.addEventListener(type, listener, useCapture);
        };
        displayengineImpl.Stage.prototype.off = function(type, listener, useCapture) {
            this.removeEventListener(type, listener, useCapture);
        };
        displayengineImpl.Stage.prototype.offAll = function() {
            this.removeAllEventListeners();
            this._ticker.offTickAll();
        };
        displayengineImpl.Stage.prototype.getSelf = function() {
            return this._stage;
        };
        displayengineImpl.Stage.prototype.getId = function() {
            return this._id;
        };
        displayengineImpl.Stage.prototype.getWidth = function() {
            var _w = this._canvas.width;
            var _width;
            try {
                _width = _hcmn_.Std.parseInt(_w);
            } catch (err) {
                if (err instanceof js._Boot.HaxeError) err = err.val;
                if (_hcmn_.js_Boot.__instanceof(err, Error)) {
                    _width = window.parseInt(_w);
                } else throw (err);
            }
            return _width;
        };
        displayengineImpl.Stage.prototype.setWidth = function(val) {
            displayengineImpl.PixiStage.prototype.setWidth.call(this, val);
            this._canvas.width = val;
        };
        displayengineImpl.Stage.prototype.getHeight = function() {
            var _h = this._canvas.height;
            var _height;
            try {
                _height = _hcmn_.Std.parseInt(_h);
            } catch (err) {
                if (err instanceof js._Boot.HaxeError) err = err.val;
                if (_hcmn_.js_Boot.__instanceof(err, Error)) {
                    _height = window.parseInt(_h);
                } else throw (err);
            }
            return _height;
        };
        displayengineImpl.Stage.prototype.setHeight = function(val) {
            displayengineImpl.PixiStage.prototype.setHeight.call(this, val);
            this._canvas.height = val;
        };
        displayengineImpl.Stage.prototype.getScaleX = function() {
            return this._stage.scale.x;
        };
        displayengineImpl.Stage.prototype.setScaleX = function(val) {
            this._stage.scale.x = val;
        };
        displayengineImpl.Stage.prototype.getScaleY = function() {
            return this._stage.scale.y;
        };
        displayengineImpl.Stage.prototype.setScaleY = function(val) {
            this._stage.scale.y = val;
        };
        displayengineImpl.Stage.prototype.getNumChildren = function() {
            return this._stage.children.length;
        };
        displayengineImpl.Stage.prototype.getVisible = function() {
            if (this._canvas != null) return this._canvas.style.display != "none";
            return false;
        };
        displayengineImpl.Stage.prototype.setVisible = function(val) {
            if (val) this._canvas.style.display = "block";
            else this._canvas.style.display = "none";
        };
        displayengineImpl.Stage.prototype.getAlpha = function() {
            return parseFloat(this._canvas.style.opacity);
        };
        displayengineImpl.Stage.prototype.setAlpha = function(val) {
            this._canvas.style.opacity = val + "";
            if (this._ticker.timingMode == displayEngineApi.TimingMode.ONCE) this.update();
        };
        displayengineImpl.Stage.prototype.getTimingMode = function() {
            return this._ticker.timingMode;
        };
        displayengineImpl.Stage.prototype.setTimingMode = function(val) {
            this._ticker.timingMode = val;
        };
        displayengineImpl.Stage.prototype.getMouse = function(event) {
            if (event != null) {
                this._mousePoint = new displayEngineApi.Point(event.data.originalEvent.clientX, event.data.originalEvent.clientY);
                return this._mousePoint;
            }
            return this._mousePoint;
        };
        displayengineImpl.Stage.prototype.lastCalledTime = null;
        displayengineImpl.Stage.prototype.calculateFps = function() {
            var _time = window.performance.now();
            this._deltaTime = _time - this.lastCalledTime;
            this.lastCalledTime = _time;
            this._fpsInfo.fps = displayengineImpl.Ticker.meter.fps | 0;
        };
        displayengineImpl.Stage.prototype.getFpsInfo = function() {
            return this._fpsInfo;
        };
        displayengineImpl.Stage.prototype.setFPS = function(val) {
            this.setFPS(val);
        };
        displayengineImpl.Stage.prototype.dispose = function() {
            displayengineImpl.DisplayProvider.stages.remove(this._id);
            this._self = null;
            this.parentDOMObject = null;
            var $it0 = this.children.keys();
            while ($it0.hasNext()) {
                var key = $it0.next();
                this.children.get(key).dispose();
            }
            this.children = null;
            this._ticker.reset();
            this._ticker.dispose();
            this._ticker = null;
            displayengineImpl.PixiStage.prototype.dispose.call(this);
        };
        displayengineImpl.Stage.prototype.__class__ = displayengineImpl.Stage;
        displayengineImpl.Ticker = function() {
            this.previousFrameTime = 0;
            this.check = 0;
            this.now = 0;
            this.allTickHandlers = [];
            this.rafFPS = 0;
            this._ms = 0;
            this._fps = 0;
            this._baseTime = window.performance.now();
            this._raf = true;
            this._timerId = null;
            this._lastTime = 0.0;
            this._interval = 50;
            this._pausedTicks = 0;
            this._ticks = 0;
            this._pausedTime = 0.0;
            this._startTime = 0.0;
            this._inited = false;
            this._id = 0;
            this._removeEventListener = null;
            this._addEventListener = null;
            this._listeners = null;
            this.hasEventListener = null;
            this.dispatchEvent = null;
            this.removeAllEventListeners = null;
            this.removeEventListener = null;
            this.paused = false;
            this.maxDelta = 0;
            this.timingMode = displayEngineApi.TimingMode.RAF;
            this.useRAF = false;
            this._id = ++displayengineImpl.Ticker._globalID;
            if (this._id <= 1) displayengineImpl.Ticker.createStats();
        };
        displayengineImpl.Ticker = ck_implements(displayengineImpl.Ticker, displayEngineApi.ITicker);
        displayengineImpl.Ticker.__interfaces__ = [displayEngineApi.ITicker];
        displayengineImpl.Ticker.__name__ = ["displayengineImpl", "Ticker"];
        displayengineImpl.Ticker.prototype.useRAF = null;
        displayengineImpl.Ticker.prototype.timingMode = null;
        displayengineImpl.Ticker.prototype.maxDelta = null;
        displayengineImpl.Ticker.prototype.paused = null;
        displayengineImpl.Ticker.prototype.renderer = null;
        displayengineImpl.Ticker.prototype.removeEventListener = null;
        displayengineImpl.Ticker.prototype.removeAllEventListeners = null;
        displayengineImpl.Ticker.prototype.dispatchEvent = null;
        displayengineImpl.Ticker.prototype.hasEventListener = null;
        displayengineImpl.Ticker.prototype._listeners = null;
        displayengineImpl.Ticker.prototype._addEventListener = null;
        displayengineImpl.Ticker.prototype._removeEventListener = null;
        displayengineImpl.Ticker.prototype._id = null;
        displayengineImpl.Ticker.prototype._inited = null;
        displayengineImpl.Ticker.prototype._startTime = null;
        displayengineImpl.Ticker.prototype._pausedTime = null;
        displayengineImpl.Ticker.prototype._ticks = null;
        displayengineImpl.Ticker.prototype._pausedTicks = null;
        displayengineImpl.Ticker.prototype._interval = null;
        displayengineImpl.Ticker.prototype._lastTime = null;
        displayengineImpl.Ticker.prototype._times = null;
        displayengineImpl.Ticker.prototype._tickTimes = null;
        displayengineImpl.Ticker.prototype._timerId = null;
        displayengineImpl.Ticker.prototype._raf = null;
        displayengineImpl.Ticker.prototype._targetFPS = null;
        displayengineImpl.Ticker.prototype._baseTime = null;
        displayengineImpl.Ticker.prototype._fps = null;
        displayengineImpl.Ticker.prototype._ms = null;
        displayengineImpl.Ticker.prototype.fps = null;
        displayengineImpl.Ticker.prototype.ms = null;
        displayengineImpl.Ticker.prototype.rafFPS = null;
        displayengineImpl.Ticker.prototype.get_fps = function() {
            return this._fps;
        };
        displayengineImpl.Ticker.prototype.get_ms = function() {
            return this._ms.toFixed(2);
        };
        displayengineImpl.Ticker.prototype.allTickHandlers = null;
        displayengineImpl.Ticker.prototype.setup = function(timingMode, renderer, targetFPS, maxDelta) {
            if (targetFPS == null) targetFPS = 60;
            this.maxDelta = maxDelta;
            this.timingMode = timingMode;
            this.renderer = renderer;
            this._targetFPS = targetFPS;
            this._interval = targetFPS;
            this.init();
        };
        displayengineImpl.Ticker.prototype.onTick = function(handler) {
            if ((function($this) {
                    var $r;
                    var x = handler;
                    $r = _hcmn_.HxOverrides.indexOf($this.allTickHandlers, x, 0);
                    return $r;
                }(this)) == -1) {
                this.allTickHandlers.push(handler);
                if (this.renderer == displayEngineApi.RendererName.EASEL) this._addEventListener("tick", handler);
            }
        };
        displayengineImpl.Ticker.prototype.offTick = function(handler) {
            if (this._inited) {
                var x = handler;
                _hcmn_.HxOverrides.remove(this.allTickHandlers, x);
                if (this.renderer == displayEngineApi.RendererName.EASEL) this._removeEventListener("tick", handler);
            }
        };
        displayengineImpl.Ticker.prototype.offTickAll = function() {
            if (this._inited) {
                var _g = 0;
                var _g1 = this.allTickHandlers;
                while (_g < _g1.length) {
                    var handler = _g1[_g];
                    ++_g;
                    if (!Object.prototype.hasOwnProperty.call(handler, "stage_tick_function")) {
                        if (this.renderer == displayEngineApi.RendererName.EASEL) this._removeEventListener("tick", handler);
                        this.allTickHandlers = [];
                    }
                }
            }
        };
        displayengineImpl.Ticker.prototype.setInterval = function(interval) {
            this._interval = interval;
            if (!this._inited) return;
            this._setupTick();
        };
        displayengineImpl.Ticker.prototype.getInterval = function() {
            return this._interval;
        };
        displayengineImpl.Ticker.prototype.setFPS = function(value) {
            if (this.timingMode == displayEngineApi.TimingMode.RAF) this._targetFPS = _hcmn_.Math.floor(value);
            else this.setInterval(1000 / value | 0);
        };
        displayengineImpl.Ticker.prototype.getFPS = function() {
            if (this.timingMode == displayEngineApi.TimingMode.RAF) return this._targetFPS;
            else return 1000 / this._interval;
        };
        displayengineImpl.Ticker.prototype.init = function() {
            if (this.renderer == displayEngineApi.RendererName.EASEL) {
                preloadjs.EventDispatcher.initialize(this);
                this._addEventListener = this.addEventListener;
                this._removeEventListener = this.removeEventListener;
            }
            this._inited = true;
            this._times = [];
            this._tickTimes = [];
            this._startTime = ($_ = window.performance, $bind($_, $_.now)) != null ? window.performance.now() : new _hcmn_.Date().getTime() - this._startTime;
            this._times.push(this._lastTime = 0);
            this.setInterval(this._interval);
            this.allTickHandlers = [];
        };
        displayengineImpl.Ticker.prototype.reset = function() {
            if (this._raf) {
                var f = ($_ = window, $bind($_, $_.cancelAnimationFrame));
                f(this._timerId);
            } else window.clearTimeout(this._timerId);
            this.allTickHandlers = [];
            this._timerId = null;
            this._times = null;
            this._tickTimes = null;
            this._startTime = 0.0;
            this._lastTime = 0.0;
            this._ticks = 0;
            this._inited = false;
        };
        displayengineImpl.Ticker.prototype.getMeasuredTickTime = function(ticks) {
            var ttl = 0.0;
            var times = this._tickTimes;
            if (times == null || times.length < 1) return -1;
            ticks = _hcmn_.Math.min(times.length, ticks != null ? ticks : this.timingMode == displayEngineApi.TimingMode.RAF ? this._targetFPS : 1000 / this._interval);
            var _g = 0;
            while (_g < ticks) {
                var i = _g++;
                ttl += times[i];
            }
            return ttl / ticks;
        };
        displayengineImpl.Ticker.prototype.getMeasuredFPS = function(ticks) {
            var times = this._times;
            if (times == null || times.length < 2) return -1;
            ticks = _hcmn_.Math.min(times.length - 1, ticks != null ? ticks : this.timingMode == displayEngineApi.TimingMode.RAF ? this._targetFPS : 1000 / this._interval);
            return 1000 / ((times[0] - times[ticks]) / ticks);
        };
        displayengineImpl.Ticker.prototype.setPaused = function(value) {
            this.paused = value;
        };
        displayengineImpl.Ticker.prototype.getPaused = function() {
            return this.paused;
        };
        displayengineImpl.Ticker.prototype.getTime = function(runTime) {
            if (this._startTime != null) return (($_ = window.performance, $bind($_, $_.now)) != null ? window.performance.now() : new _hcmn_.Date().getTime() - this._startTime) - (runTime != null ? this._pausedTime : 0);
            else return -1;
        };
        displayengineImpl.Ticker.prototype.getEventTime = function(runTime) {
            if (this._startTime != null) return (this._lastTime != null ? this._lastTime : this._startTime) - (runTime != null ? this._pausedTime : 0);
            else return -1;
        };
        displayengineImpl.Ticker.prototype.getTicks = function(paused) {
            return this._ticks - (paused ? this._pausedTicks : 0);
        };
        displayengineImpl.Ticker.prototype._handleSynch = function() {
            this._timerId = null;
            this._setupTick();
            if ((($_ = window.performance, $bind($_, $_.now)) != null ? window.performance.now() : new _hcmn_.Date().getTime() - this._startTime) - this._lastTime >= (this._interval - 1) * 0.97) this._tick();
        };
        displayengineImpl.Ticker.prototype.now = null;
        displayengineImpl.Ticker.prototype.check = null;
        displayengineImpl.Ticker.prototype.previousFrameTime = null;
        displayengineImpl.Ticker.prototype._handleRAF = function(rafTime) {
            if (this._id == 1) displayengineImpl.Ticker.meter.tickStart();
            this._timerId = null;
            this._setupTick();
            if (this._targetFPS == 60) {
                this._tick();
                if (this._id == 1) displayengineImpl.Ticker.meter.tick();
            } else {
                this.now = window.performance.now();
                this.check = this.now - this._baseTime;
                if (this.check / (1000 / this._targetFPS) >= 1) {
                    this._baseTime = this.now;
                    this._tick();
                    if (this._id == 1) displayengineImpl.Ticker.meter.tick();
                }
            }
        };
        displayengineImpl.Ticker.prototype._handleTimeout = function() {
            if (this._id == 1) displayengineImpl.Ticker.meter.tickStart();
            this._timerId = null;
            this._setupTick();
            this._tick();
            if (this._id == 1) displayengineImpl.Ticker.meter.tick();
        };
        displayengineImpl.Ticker.prototype._setupTick = function() {
            if (this._timerId != null) return;
            var mode = this.timingMode;
            if (mode == displayEngineApi.TimingMode.RAF || mode == displayEngineApi.TimingMode.RAF_SYNCHED) {
                var f = ($_ = window, $bind($_, $_.requestAnimationFrame));
                if (f != null) {
                    this._timerId = f(mode == displayEngineApi.TimingMode.RAF ? $bind(this, this._handleRAF) : $bind(this, this._handleSynch));
                    this._raf = true;
                    return;
                }
            }
            this._raf = false;
            this._timerId = window.setTimeout($bind(this, this._handleTimeout), this._interval);
        };
        displayengineImpl.Ticker.prototype._tick = function() {
            var _g = 0;
            var _g1 = this.allTickHandlers;
            while (_g < _g1.length) {
                var handler = _g1[_g];
                ++_g;
                handler();
            }
        };
        displayengineImpl.Ticker.prototype._getTime = function() {
            return ($_ = window.performance, $bind($_, $_.now)) != null ? window.performance.now() : new _hcmn_.Date().getTime() - this._startTime;
        };
        displayengineImpl.Ticker.prototype.dispose = function() {
            this.timingMode = null;
            this._listeners = null;
            this._addEventListener = null;
            this._removeEventListener = null;
            this._startTime = null;
            this._pausedTime = 0.0;
            this._ticks = null;
            this._interval = null;
            this._lastTime = null;
            this._times = null;
            this._tickTimes = null;
            this._timerId = null;
            this._baseTime = null;
        };
        displayengineImpl.Ticker.statsDiv = null;
        displayengineImpl.Ticker.bmpStatsDiv = null;
        displayengineImpl.Ticker.meter = null;
        displayengineImpl.Ticker.createStats = function() {
            if (displayengineImpl.Ticker.meter == null) {
                var fpsm;
                var _this = window.document;
                fpsm = _this.createElement("script");
                fpsm.innerHTML = displayengineImpl.Ticker.fpsMeter;
                window.document.body.appendChild(fpsm);
                displayengineImpl.Ticker.meter = new FPSMeter({
                    theme: 'dark',
                    zIndex: 999997,
                    left: '10px',
                    top: '10px',
                    graph: 1
                });
                if (window.location.search.indexOf("fps=true") == -1) displayengineImpl.Ticker.meter.hide();
            }
        };
        displayengineImpl.Ticker.prototype.__class__ = displayengineImpl.Ticker;
        displayengineImpl.DisplayProvider = function() {
            this.displayFactory = new displayengineImpl.Factory();
            displayengineImpl.DisplayProvider.stages = new _hcmn_.haxe_ds_StringMap();
        };
        displayengineImpl.DisplayProvider = ck_implements(displayengineImpl.DisplayProvider, clientkernelModulesApi.IService);
        displayengineImpl.DisplayProvider = ck_implements(displayengineImpl.DisplayProvider, displayEngineApi.IDisplayProvider);
        displayengineImpl.DisplayProvider.__interfaces__ = [clientkernelModulesApi.IService, displayEngineApi.IDisplayProvider];
        displayengineImpl.DisplayProvider.__name__ = ["displayengineImpl", "DisplayProvider"];
        displayengineImpl.DisplayProvider.prototype.displayFactory = null;
        displayengineImpl.DisplayProvider.prototype.getFactory = function() {
            return this.displayFactory;
        };
        displayengineImpl.DisplayProvider.prototype.getStages = function() {
            return displayengineImpl.DisplayProvider.stages;
        };
        displayengineImpl.DisplayProvider.prototype.getDefaultStage = function() {
            return displayengineImpl.DisplayProvider.stages.get(displayEngineApi.DisplayConstants.DEFAULT_STAGE);
        };
        displayengineImpl.DisplayProvider.stages = null;
        displayengineImpl.DisplayProvider.prototype.__class__ = displayengineImpl.DisplayProvider;
        displayengineImpl.Factory = function() {};
        displayengineImpl.Factory = ck_implements(displayengineImpl.Factory, displayEngineApi.IFactory);
        displayengineImpl.Factory.__interfaces__ = [displayEngineApi.IFactory];
        displayengineImpl.Factory.__name__ = ["displayengineImpl", "Factory"];
        displayengineImpl.Factory.prototype.createStage = function(def) {
            if (displayengineImpl.DisplayProvider.stages.get(def.id) != null) return displayengineImpl.DisplayProvider.stages.get(def.id);
            else {
                if (def.id == null) def.id = displayEngineApi.DisplayConstants.DEFAULT_STAGE;
                return new displayengineImpl.Stage(def);
            }
        };
        displayengineImpl.Factory.prototype.createOffscreenStage = function(width, height, isWebGL, timingMode, targetFPS) {
            if (isWebGL == null) isWebGL = false;
            return new displayengineImpl.OffscreenStage(width, height, isWebGL, timingMode, targetFPS);
        };
        displayengineImpl.Factory.prototype.createDisplayObjectContainer = function() {
            return new displayengineImpl.DisplayObjectContainer();
        };
        displayengineImpl.Factory.prototype.createMovieClip = function(def) {
            return new displayengineImpl.MovieClip(def);
        };
        displayengineImpl.Factory.prototype.createGraphics = function(cacheCommands) {
            if (cacheCommands == null) cacheCommands = false;
            return new displayengineImpl.Graphics(cacheCommands);
        };
        displayengineImpl.Factory.prototype.createBitmap = function(image, offset) {
            return new displayengineImpl.Bitmap(image, offset);
        };
        displayengineImpl.Factory.prototype.createSprite = function() {
            return new displayengineImpl.Sprite();
        };
        displayengineImpl.Factory.prototype.createParticleSystem = function(img, type, config) {
            return new displayengineImpl.ParticleSystem(img, type, config);
        };
        displayengineImpl.Factory.prototype.cache = function(objects) {
            return displayengineImpl.Cache.cache(objects);
        };
        displayengineImpl.Factory.prototype.uncache = function(objectID) {
            displayengineImpl.Cache.uncache(objectID);
        };
        displayengineImpl.Factory.prototype.createAnimation = function(name, object, animDef) {
            if (name == null) name = "";
            return new displayengineImpl.Animation(name, object, animDef);
        };
        displayengineImpl.Factory.prototype.__class__ = displayengineImpl.Factory;
        if (typeof haxe == 'undefined') {
            var haxe = {};
        };

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

        };
        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;
        displayengineImpl.Animation.__meta__ = {
            obj: {
                globnative: null
            }
        };;
        displayengineImpl.DisplayObject.__meta__ = {
            obj: {
                globnative: null
            }
        };;
        displayengineImpl.PixiBitmap._imageBuffer = new _hcmn_.haxe_ds_StringMap();;
        displayengineImpl.PixiBitmap._textures = new _hcmn_.haxe_ds_StringMap();;
        displayengineImpl.PixiBitmap.totalSourceImageCount = [];;
        displayengineImpl.Bitmap.bmpCount = 0;;
        displayengine.impl.displaylist.Perlin.GRAD3 = [new displayengine.impl.displaylist.Gradient(1, 1, 0), new displayengine.impl.displaylist.Gradient(-1, 1, 0), new displayengine.impl.displaylist.Gradient(1, -1, 0), new displayengine.impl.displaylist.Gradient(-1, -1, 0), new displayengine.impl.displaylist.Gradient(1, 0, 1), new displayengine.impl.displaylist.Gradient(-1, 0, 1), new displayengine.impl.displaylist.Gradient(1, 0, -1), new displayengine.impl.displaylist.Gradient(-1, 0, -1), new displayengine.impl.displaylist.Gradient(0, 1, 1), new displayengine.impl.displaylist.Gradient(0, -1, 1), new displayengine.impl.displaylist.Gradient(0, 1, -1), new displayengine.impl.displaylist.Gradient(0, -1, -1)];;
        displayengine.impl.displaylist.Perlin.P = [151, 160, 137, 91, 90, 15, 131, 13, 201, 95, 96, 53, 194, 233, 7, 225, 140, 36, 103, 30, 69, 142, 8, 99, 37, 240, 21, 10, 23, 190, 6, 148, 247, 120, 234, 75, 0, 26, 197, 62, 94, 252, 219, 203, 117, 35, 11, 32, 57, 177, 33, 88, 237, 149, 56, 87, 174, 20, 125, 136, 171, 168, 68, 175, 74, 165, 71, 134, 139, 48, 27, 166, 77, 146, 158, 231, 83, 111, 229, 122, 60, 211, 133, 230, 220, 105, 92, 41, 55, 46, 245, 40, 244, 102, 143, 54, 65, 25, 63, 161, 1, 216, 80, 73, 209, 76, 132, 187, 208, 89, 18, 169, 200, 196, 135, 130, 116, 188, 159, 86, 164, 100, 109, 198, 173, 186, 3, 64, 52, 217, 226, 250, 124, 123, 5, 202, 38, 147, 118, 126, 255, 82, 85, 212, 207, 206, 59, 227, 47, 16, 58, 17, 182, 189, 28, 42, 223, 183, 170, 213, 119, 248, 152, 2, 44, 154, 163, 70, 221, 153, 101, 155, 167, 43, 172, 9, 129, 22, 39, 253, 19, 98, 108, 110, 79, 113, 224, 232, 178, 185, 112, 104, 218, 246, 97, 228, 251, 34, 242, 193, 238, 210, 144, 12, 191, 179, 162, 241, 81, 51, 145, 235, 249, 14, 239, 107, 49, 192, 214, 31, 181, 199, 106, 157, 184, 84, 204, 176, 115, 121, 50, 45, 127, 4, 150, 254, 138, 236, 205, 93, 222, 114, 67, 29, 24, 72, 243, 141, 128, 195, 78, 66, 215, 61, 156, 180];;
        displayengineImpl.Cache.cachedObjects = new _hcmn_.haxe_ds_StringMap();;
        displayengineImpl.DisplayObjectContainer.__meta__ = {
            obj: {
                globnative: null
            }
        };;
        displayengineImpl.DisplayObjectContainer.docCount = 0;;
        displayengineImpl.Graphics.__meta__ = {
            obj: {
                globnative: null
            }
        };;
        displayengineImpl.MCVideo.__meta__ = {
            obj: {
                globnative: null
            }
        };;
        displayengineImpl.Sprite.__meta__ = {
            obj: {
                globnative: null
            }
        };;
        displayengineImpl.PixiMovieClip.allBitmaps = new _hcmn_.haxe_ds_StringMap();;
        displayengineImpl.MovieClip.__meta__ = {
            obj: {
                globnative: null
            }
        };;
        displayengineImpl.MovieClip.mcCount = 0;;
        displayengineImpl.OffscreenStage.allOffscreenStages = [];;
        displayengineImpl.OffscreenStage.MASK_COMPOSITION_OPERATION = "source-atop";;
        displayengineImpl.Stage.tweenXSet = false;;
        displayengineImpl.Ticker.fpsMeter = "!function(t,n){'use strict';function e(t){return document.createElement(t)}function o(t,n){for(var e in n)try{t.style[e]=n[e]}catch(o){}return t}function a(t){return null==t?String(t):'object'==typeof t||'function'==typeof t?Object.prototype.toString.call(t).match(/\\s([a-z]+)/i)[1].toLowerCase()||'object':typeof t}function i(t,n){if('array'!==a(n))return-1;if(n.indexOf)return n.indexOf(t);for(var e=0,o=n.length;o>e;e++)if(n[e]===t)return e;return-1}function r(){var t=arguments;for(var n in t[1])if(t[1].hasOwnProperty(n))switch(a(t[1][n])){case'object':t[0][n]=r({},t[0][n],t[1][n]);break;case'array':t[0][n]=t[1][n].slice(0);break;default:t[0][n]=t[1][n]}return t.length>2?r.apply(null,[t[0]].concat(Array.prototype.slice.call(t,2))):t[0]}function h(t,n,e){var o,a,i,r,h,s,u,c,p;return r=.5>=e?e*(1+n):e+n-e*n,0===r?'#000':(h=2*e-r,s=(r-h)/r,t=6*t,u=Math.floor(t),c=t-u,p=r*s*c,0===u||6===u?(o=r,a=h+p,i=h):1===u?(o=r-p,a=r,i=h):2===u?(o=h,a=r,i=h+p):3===u?(o=h,a=r-p,i=r):4===u?(o=h+p,a=h,i=r):(o=r,a=h,i=r-p),'#'+l(o)+l(a)+l(i))}function l(t){return t=Math.round(255*t).toString(16),1===t.length?'0'+t:t}function s(t,n,e,o){t.addEventListener?t[o?'removeEventListener':'addEventListener'](n,e,!1):t.attachEvent&&t[o?'detachEvent':'attachEvent']('on'+n,e)}function u(t,l){function x(){for(j=D.history;j--;)K[j]=0===j?q.fps:K[j-1],Q[j]=0===j?q.duration:Q[j-1]}function b(t,n,e,o){return z[0|t][_hcmn_.Math.round(_hcmn_.Math.min((n-e)/(o-e)*B,B))]}function w(){L.legend.fps!==U&&(L.legend.fps=U,L.legend[g]=U?'FPS':'ms'),T=U?q.fps:q.duration,L.count[g]=T>999?'999+':T.toFixed(T>99?0:D.decimals)}function y(){if(A=c(),J<A-D.threshold&&(q.fps-=q.fps/Math.max(1,60*D.smoothing/D.interval),q.duration=1e3/q.fps),x(),w(),D.heat){if(N.length)for(j=N.length;j--;)N[j].el.style[M[N[j].name].heatOn]=U?b(M[N[j].name].heatmap,q.fps,0,D.maxFps):b(M[N[j].name].heatmap,q.duration,D.threshold,0);if(L.graph&&M.column.heatOn)for(j=R.length;j--;)R[j].style[M.column.heatOn]=U?b(M.column.heatmap,K[j],0,D.maxFps):b(M.column.heatmap,Q[j],D.threshold,0)}if(L.graph)for(I=0;I<D.history;I++)R[I].style.height=(U?K[I]?Math.round(H/D.maxFps*Math.min(K[I],D.maxFps)):0:Q[I]?Math.round(H/D.threshold*Math.min(Q[I],D.threshold)):0)+'px'}function v(){D.interval<20?(E=d(v),y()):(E=setTimeout(v,D.interval),P=d(y))}function k(t){t=t||window.event,t.preventDefault?(t.preventDefault(),t.stopPropagation()):(t.returnValue=!1,t.cancelBubble=!0),q.toggle()}function O(){D.toggleOn&&s(L.container,D.toggleOn,k,1),t.removeChild(L.container)}function S(){if(M=u.theme[D.theme],z=M.compiledHeatmaps||[],!z.length&&M.heatmaps.length){for(I=0;I<M.heatmaps.length;I++)for(z[I]=[],j=0;B>=j;j++)z[I][j]=h(.33/B*j,M.heatmaps[I].saturation,M.heatmaps[I].lightness);M.compiledHeatmaps=z}}function F(){L.container&&O(),S(),L.container=o(e('div'),M.container),L.count=L.container.appendChild(o(e('div'),M.count)),L.legend=L.container.appendChild(o(e('div'),M.legend)),L.graph=D.graph?L.container.appendChild(o(e('div'),M.graph)):0,N.length=0;for(var n in L)L[n]&&M[n].heatOn&&N.push({name:n,el:L[n]});if(R.length=0,L.graph)for(L.graph.style.width=D.history*M.column.width+(D.history-1)*M.column.spacing+'px',j=0;j<D.history;j++)R[j]=L.graph.appendChild(o(e('div'),M.column)),R[j].style.position='absolute',R[j].style.bottom=0,R[j].style.right=j*M.column.width+j*M.column.spacing+'px',R[j].style.width=M.column.width+'px',R[j].style.height='0px';C(),w(),t.appendChild(L.container),L.graph&&(H=L.graph.clientHeight),D.toggleOn&&('click'===D.toggleOn&&(L.container.style.cursor='pointer'),s(L.container,D.toggleOn,k))}function C(){o(L.container,D)}'object'===a(t)&&t.nodeType===n&&(l=t,t=document.body),t||(t=document.body);var M,z,A,E,P,H,T,j,I,q=this,D=r({},u.defaults,l||{}),L={},R=[],B=100,N=[],V=0,W=D.threshold,G=0,J=c()-W,K=[],Q=[],U='fps'===D.show;q.options=D,q.fps=0,q.duration=0,q.isPaused=0,q.tickStart=function(){G=c()},q.tick=function(){A=c(),V=A-J,W+=(V-W)/D.smoothing,q.fps=1e3/W,q.duration=J>G?W:A-G,J=A},q.pause=function(){return E&&(q.isPaused=1,clearTimeout(E),p(E),p(P),E=P=0),q},q.resume=function(){return E||(q.isPaused=0,v()),q},q.set=function(t,n){return D[t]=n,U='fps'===D.show,-1!==i(t,f)&&F(),-1!==i(t,m)&&C(),q},q.showDuration=function(){return q.set('show','ms'),q},q.showFps=function(){return q.set('show','fps'),q},q.toggle=function(){return q.set('show',U?'ms':'fps'),q},q.hide=function(){return q.pause(),L.container.style.display='none',q},q.show=function(){return q.resume(),L.container.style.display='block',q},q.destroy=function(){q.pause(),O(),q.tick=q.tickStart=function(){}},function(){F(),v()}()}var c;!function(){var n=t.performance;if(n&&(n.now||n.webkitNow)){var e=n.now?'now':'webkitNow';c=n[e].bind(n)}else c=function(){return+new _hcmn_.Date}}();var p=t.cancelAnimationFrame||t.cancelRequestAnimationFrame,d=t.requestAnimationFrame;!function(){for(var n=['moz','webkit','o'],e=0,o=0,a=n.length;a>o&&!p;++o)p=t[n[o]+'CancelAnimationFrame']||t[n[o]+'CancelRequestAnimationFrame'],d=p&&t[n[o]+'RequestAnimationFrame'];p||(d=function(n){var o=c(),a=Math.max(0,16-(o-e));return e=o+a,t.setTimeout(function(){n(o+a)},a)},p=function(t){clearTimeout(t)})}();var g='string'===a(document.createElement('div').textContent)?'textContent':'innerText';u.extend=r,window.FPSMeter=u,u.defaults={interval:100,smoothing:10,show:'fps',toggleOn:'click',decimals:1,maxFps:60,threshold:100,position:'absolute',zIndex:10,left:'5px',top:'5px',right:'auto',bottom:'auto',margin:'0 0 0 0',theme:'dark',heat:0,graph:0,history:20};var f=['toggleOn','theme','heat','graph','history'],m=['position','zIndex','left','top','right','bottom','margin']}(window),function(t,n,e){'use strict';n.theme={};var o=n.theme.base={heatmaps:[],container:{heatOn:null,heatmap:null,padding:'5px',minWidth:'95px',height:'30px',lineHeight:'30px',textAlign:'right',textShadow:'none'},count:{heatOn:null,heatmap:null,position:'absolute',top:0,right:0,padding:'5px 10px',height:'30px',fontSize:'24px',fontFamily:'Consolas, Andale Mono, monospace',zIndex:2},legend:{heatOn:null,heatmap:null,position:'absolute',top:0,left:0,padding:'5px 10px',height:'30px',fontSize:'12px',lineHeight:'32px',fontFamily:'sans-serif',textAlign:'left',zIndex:2},graph:{heatOn:null,heatmap:null,position:'relative',boxSizing:'padding-box',MozBoxSizing:'padding-box',height:'100%',zIndex:1},column:{width:4,spacing:1,heatOn:null,heatmap:null}};n.theme.dark=n.extend({},o,{heatmaps:[{saturation:.8,lightness:.8}],container:{background:'#222',color:'#fff',border:'1px solid #1a1a1a',textShadow:'1px 1px 0 #222'},count:{heatOn:'color'},column:{background:'#3f3f3f'}}),n.theme.light=n.extend({},o,{heatmaps:[{saturation:.5,lightness:.5}],container:{color:'#666',background:'#fff',textShadow:'1px 1px 0 rgba(255,255,255,.5), -1px -1px 0 rgba(255,255,255,.5)',boxShadow:'0 0 0 1px rgba(0,0,0,.1)'},count:{heatOn:'color'},column:{background:'#eaeaea'}}),n.theme.colorful=n.extend({},o,{heatmaps:[{saturation:.5,lightness:.6}],container:{heatOn:'backgroundColor',background:'#888',color:'#fff',textShadow:'1px 1px 0 rgba(0,0,0,.2)',boxShadow:'0 0 0 1px rgba(0,0,0,.1)'},column:{background:'#777',backgroundColor:'rgba(0,0,0,.2)'}}),n.theme.transparent=n.extend({},o,{heatmaps:[{saturation:.8,lightness:.5}],container:{padding:0,color:'#fff',textShadow:'1px 1px 0 rgba(0,0,0,.5)'},count:{padding:'0 5px',height:'40px',lineHeight:'40px'},legend:{padding:'0 5px',height:'40px',lineHeight:'42px'},graph:{height:'40px'},column:{width:5,background:'#999',heatOn:'backgroundColor',opacity:.5}})}(window,FPSMeter);";;
        displayengineImpl.Ticker._globalID = 0;;
        return {
            exports: displayengineImpl,
            activator: displayengineImpl.Activator
        };
    });
//# sourceURL=displayEngine.js