// Class: openfl.display.Stage

var $global = typeof window != "undefined" ? window : typeof global != "undefined" ? global : typeof self != "undefined" ? self : this

$global.Object.defineProperty(exports, "__esModule", {value: true});

var __map_reserved = {};

// Imports

var $hxClasses = require("./../../hxClasses_stub").default;
var $bind = require("./../../bind_stub").default;
var $import = require("./../../import_stub").default;
var $extend = require("./../../extend_stub").default;
function lime_app_IModule() {return require("./../../lime/app/IModule");}
function openfl_display_DisplayObjectContainer() {return require("./../../openfl/display/DisplayObjectContainer");}
function lime_ui_Gamepad() {return require("./../../lime/ui/Gamepad");}
function lime_ui_Touch() {return require("./../../lime/ui/Touch");}
function openfl_ui_GameInput() {return require("./../../openfl/ui/GameInput");}
function js__$Boot_HaxeError() {return require("./../../js/_Boot/HaxeError");}
function openfl_events_Event() {return require("./../../openfl/events/Event");}
function Std() {return require("./../../Std");}
function openfl_events_TextEvent() {return require("./../../openfl/events/TextEvent");}
function openfl_events_FullScreenEvent() {return require("./../../openfl/events/FullScreenEvent");}
function openfl_display_Stage3D() {return require("./../../openfl/display/Stage3D");}
function lime_graphics_RendererType() {return require("./../../lime/graphics/RendererType");}
function Type() {return require("./../../Type");}
function openfl_display_DisplayObject() {return require("./../../openfl/display/DisplayObject");}
function openfl__$internal_renderer_opengl_GLRenderer() {return require("./../../openfl/_internal/renderer/opengl/GLRenderer");}
function openfl__$internal_renderer_canvas_CanvasRenderer() {return require("./../../openfl/_internal/renderer/canvas/CanvasRenderer");}
function openfl__$internal_renderer_dom_DOMRenderer() {return require("./../../openfl/_internal/renderer/dom/DOMRenderer");}
function openfl_events_UncaughtErrorEvent() {return require("./../../openfl/events/UncaughtErrorEvent");}
function openfl_Lib() {return require("./../../openfl/Lib");}
function haxe_CallStack() {return require("./../../haxe/CallStack");}
function Reflect() {return require("./../../Reflect");}
function openfl_events_MouseEvent() {return require("./../../openfl/events/MouseEvent");}
function lime_ui__$KeyModifier_KeyModifier_$Impl_$() {return require("./../../lime/ui/_KeyModifier/KeyModifier_Impl_");}
function openfl_ui_Keyboard() {return require("./../../openfl/ui/Keyboard");}
function openfl_events_KeyboardEvent() {return require("./../../openfl/events/KeyboardEvent");}
function openfl_geom_Point() {return require("./../../openfl/geom/Point");}
function js_Boot() {return require("./../../js/Boot");}
function openfl_display_InteractiveObject() {return require("./../../openfl/display/InteractiveObject");}
function openfl_ui_Mouse() {return require("./../../openfl/ui/Mouse");}
function openfl_ui__$MouseCursor_MouseCursor_$Impl_$() {return require("./../../openfl/ui/_MouseCursor/MouseCursor_Impl_");}
function lime__$backend_html5_HTML5Mouse() {return require("./../../lime/_backend/html5/HTML5Mouse");}
function HxOverrides() {return require("./../../HxOverrides");}
function openfl__$internal_TouchData() {return require("./../../openfl/_internal/TouchData");}
function openfl_events_TouchEvent() {return require("./../../openfl/events/TouchEvent");}
function StringTools() {return require("./../../StringTools");}
function openfl_events_FocusEvent() {return require("./../../openfl/events/FocusEvent");}
function openfl_display_LoaderInfo() {return require("./../../openfl/display/LoaderInfo");}
function js_Browser() {return require("./../../js/Browser");}
function lime_ui_Window() {return require("./../../lime/ui/Window");}
function lime_app_Application() {return require("./../../lime/app/Application");}
function openfl_geom_Matrix() {return require("./../../openfl/geom/Matrix");}
function openfl__$Vector_Vector_$Impl_$() {return require("./../../openfl/_Vector/Vector_Impl_");}
function openfl_geom_Rectangle() {return require("./../../openfl/geom/Rectangle");}
function haxe_ds_IntMap() {return require("./../../haxe/ds/IntMap");}

// Constructor

var Stage = function(width,height,color,documentClass,windowConfig) {
	if(height == null) {
		height = 0;
	}
	if(width == null) {
		width = 0;
	}
	(openfl_display_DisplayObjectContainer().default).call(this);
	if(!isNaN(width)) {
		if((openfl_Lib().default).get_current().__loaderInfo == null) {
			(openfl_Lib().default).get_current().__loaderInfo = (openfl_display_LoaderInfo().default).create(null);
			(openfl_Lib().default).get_current().__loaderInfo.content = (openfl_Lib().default).get_current();
		}
		var resizable = width == 0 && width == 0;
		this.element = (js_Browser().default).get_document().createElement("div");
		if(resizable) {
			this.element.style.width = "100%";
			this.element.style.height = "100%";
		}
		if(windowConfig == null) {
			windowConfig = { };
		}
		windowConfig.width = width;
		windowConfig.height = height;
		windowConfig.element = this.element;
		windowConfig.resizable = resizable;
		if(!(Reflect().default).hasField(windowConfig,"stencilBuffer")) {
			windowConfig.stencilBuffer = true;
		}
		if(!(Reflect().default).hasField(windowConfig,"depthBuffer")) {
			windowConfig.depthBuffer = true;
		}
		if(!(Reflect().default).hasField(windowConfig,"background")) {
			windowConfig.background = null;
		}
		this.window = new (lime_ui_Window().default)(windowConfig);
		this.window.stage = this;
		var app = new (lime_app_Application().default)();
		app.create({ });
		app.createWindow(this.window);
		app.exec();
		this.set_color(color);
	} else {
		this.window = width;
		this.set_color(height);
	}
	this.set_name(null);
	this.__contentsScaleFactor = this.window.get_scale();
	this.__deltaTime = 0;
	this.__displayState = "normal";
	this.__mouseX = 0;
	this.__mouseY = 0;
	this.__lastClickTime = 0;
	this.__logicalWidth = 0;
	this.__logicalHeight = 0;
	this.__displayMatrix = new (openfl_geom_Matrix().default)();
	this.__renderDirty = true;
	this.__wasFullscreen = this.window.get_fullscreen();
	this.stage3Ds = (openfl__$Vector_Vector_$Impl_$().default)._new();
	this.stage3Ds.push(new (openfl_display_Stage3D().default)());
	this.__resize();
	this.stage = this;
	this.align = "topLeft";
	this.allowsFullScreen = false;
	this.allowsFullScreenInteractive = false;
	this.quality = "high";
	this.scaleMode = "noScale";
	this.showDefaultContextMenu = true;
	this.softKeyboardRect = new (openfl_geom_Rectangle().default)();
	this.stageFocusRect = true;
	this.__macKeyboard = /AppleWebKit/.test (navigator.userAgent) && /Mobile\/\w+/.test (navigator.userAgent) || /Mac/.test (navigator.platform);
	this.__clearBeforeRender = true;
	this.__stack = [];
	this.__rollOutStack = [];
	this.__touchData = new (haxe_ds_IntMap().default)();
	if((openfl_Lib().default).get_current().stage == null) {
		this.stage.addChild((openfl_Lib().default).get_current());
	}
	if(!this.window.config.resizable) {
		this.__setLogicalSize(this.window.config.width,this.window.config.height);
	}
	if(documentClass != null) {
		(openfl_display_DisplayObject().default).__initStage = this;
		var sprite = (Type().default).createInstance(documentClass,[]);
		this.addChild(sprite);
	}
	(lime_app_Application().default).current.addModule(this);
}

// Meta

Stage.__name__ = ["openfl","display","Stage"];
Stage.__interfaces__ = [(lime_app_IModule().default)];
Stage.__super__ = (openfl_display_DisplayObjectContainer().default);
Stage.prototype = $extend((openfl_display_DisplayObjectContainer().default).prototype, {
	addRenderer: function(renderer) {
		var f = $bind(this,this.render);
		var a1 = renderer;
		var tmp = function() {
			f(a1);
		};
		renderer.onRender.add(tmp);
		var f1 = $bind(this,this.onRenderContextLost);
		var a11 = renderer;
		var tmp1 = function() {
			f1(a11);
		};
		renderer.onContextLost.add(tmp1);
		var f2 = $bind(this,this.onRenderContextRestored);
		var a12 = renderer;
		var tmp2 = function(a2) {
			f2(a12,a2);
		};
		renderer.onContextRestored.add(tmp2);
	},
	addWindow: function(window) {
		if(this.window != window) {
			return;
		}
		var f = $bind(this,this.onWindowActivate);
		var a1 = window;
		var tmp = function() {
			f(a1);
		};
		window.onActivate.add(tmp);
		var f1 = $bind(this,this.onWindowClose);
		var a11 = window;
		var tmp1 = function() {
			f1(a11);
		};
		window.onClose.add(tmp1,false,-9000);
		var f2 = $bind(this,this.onWindowCreate);
		var a12 = window;
		var tmp2 = function() {
			f2(a12);
		};
		window.onCreate.add(tmp2);
		var f3 = $bind(this,this.onWindowDeactivate);
		var a13 = window;
		var tmp3 = function() {
			f3(a13);
		};
		window.onDeactivate.add(tmp3);
		var f4 = $bind(this,this.onWindowDropFile);
		var a14 = window;
		var tmp4 = function(a2) {
			f4(a14,a2);
		};
		window.onDropFile.add(tmp4);
		var f5 = $bind(this,this.onWindowEnter);
		var a15 = window;
		var tmp5 = function() {
			f5(a15);
		};
		window.onEnter.add(tmp5);
		var f6 = $bind(this,this.onWindowFocusIn);
		var a16 = window;
		var tmp6 = function() {
			f6(a16);
		};
		window.onFocusIn.add(tmp6);
		var f7 = $bind(this,this.onWindowFocusOut);
		var a17 = window;
		var tmp7 = function() {
			f7(a17);
		};
		window.onFocusOut.add(tmp7);
		var f8 = $bind(this,this.onWindowFullscreen);
		var a18 = window;
		var tmp8 = function() {
			f8(a18);
		};
		window.onFullscreen.add(tmp8);
		var f9 = $bind(this,this.onKeyDown);
		var a19 = window;
		var tmp9 = function(a21,a3) {
			f9(a19,a21,a3);
		};
		window.onKeyDown.add(tmp9);
		var f10 = $bind(this,this.onKeyUp);
		var a110 = window;
		var tmp10 = function(a22,a31) {
			f10(a110,a22,a31);
		};
		window.onKeyUp.add(tmp10);
		var f11 = $bind(this,this.onWindowLeave);
		var a111 = window;
		var tmp11 = function() {
			f11(a111);
		};
		window.onLeave.add(tmp11);
		var f12 = $bind(this,this.onWindowMinimize);
		var a112 = window;
		var tmp12 = function() {
			f12(a112);
		};
		window.onMinimize.add(tmp12);
		var f13 = $bind(this,this.onMouseDown);
		var a113 = window;
		var tmp13 = function(x,y,a23) {
			f13(a113,x,y,a23);
		};
		window.onMouseDown.add(tmp13);
		var f14 = $bind(this,this.onMouseMove);
		var a114 = window;
		var tmp14 = function(x1,y1) {
			f14(a114,x1,y1);
		};
		window.onMouseMove.add(tmp14);
		var f15 = $bind(this,this.onMouseMoveRelative);
		var a115 = window;
		var tmp15 = function(x2,y2) {
			f15(a115,x2,y2);
		};
		window.onMouseMoveRelative.add(tmp15);
		var f16 = $bind(this,this.onMouseUp);
		var a116 = window;
		var tmp16 = function(x3,y3,a24) {
			f16(a116,x3,y3,a24);
		};
		window.onMouseUp.add(tmp16);
		var f17 = $bind(this,this.onMouseWheel);
		var a117 = window;
		var tmp17 = function(a25,a32) {
			f17(a117,a25,a32);
		};
		window.onMouseWheel.add(tmp17);
		var f18 = $bind(this,this.onWindowMove);
		var a118 = window;
		var tmp18 = function(x4,y4) {
			f18(a118,x4,y4);
		};
		window.onMove.add(tmp18);
		var f19 = $bind(this,this.onWindowResize);
		var a119 = window;
		var tmp19 = function(a26,a33) {
			f19(a119,a26,a33);
		};
		window.onResize.add(tmp19);
		var f20 = $bind(this,this.onWindowRestore);
		var a120 = window;
		var tmp20 = function() {
			f20(a120);
		};
		window.onRestore.add(tmp20);
		var f21 = $bind(this,this.onTextEdit);
		var a121 = window;
		var tmp21 = function(a27,a34,a4) {
			f21(a121,a27,a34,a4);
		};
		window.onTextEdit.add(tmp21);
		var f22 = $bind(this,this.onTextInput);
		var a122 = window;
		var tmp22 = function(a28) {
			f22(a122,a28);
		};
		window.onTextInput.add(tmp22);
		if(window.id > -1) {
			this.onWindowCreate(window);
		}
	},
	registerModule: function(application) {
		application.onExit.add($bind(this,this.onModuleExit),false,0);
		application.onUpdate.add($bind(this,this.update));
		var gamepad = (lime_ui_Gamepad().default).devices.iterator();
		while(gamepad.hasNext()) {
			var gamepad1 = gamepad.next();
			this.__onGamepadConnect(gamepad1);
		}
		(lime_ui_Gamepad().default).onConnect.add($bind(this,this.__onGamepadConnect));
		(lime_ui_Touch().default).onStart.add($bind(this,this.onTouchStart));
		(lime_ui_Touch().default).onMove.add($bind(this,this.onTouchMove));
		(lime_ui_Touch().default).onEnd.add($bind(this,this.onTouchEnd));
	},
	removeRenderer: function(renderer) {
	},
	removeWindow: function(window) {
	},
	setPreloader: function(preloader) {
	},
	unregisterModule: function(application) {
		application.onExit.remove($bind(this,this.onModuleExit));
		application.onUpdate.remove($bind(this,this.update));
		(lime_ui_Gamepad().default).onConnect.remove($bind(this,this.__onGamepadConnect));
		(lime_ui_Touch().default).onStart.remove($bind(this,this.onTouchStart));
		(lime_ui_Touch().default).onMove.remove($bind(this,this.onTouchMove));
		(lime_ui_Touch().default).onEnd.remove($bind(this,this.onTouchEnd));
	},
	invalidate: function() {
		this.__invalidated = true;
	},
	localToGlobal: function(pos) {
		return pos.clone();
	},
	onGamepadAxisMove: function(gamepad,axis,value) {
		try {
			(openfl_ui_GameInput().default).__onGamepadAxisMove(gamepad,axis,value);
		} catch( e ) {
			if (e instanceof (js__$Boot_HaxeError().default)) e = e.val;
			this.__handleError(e);
		}
	},
	onGamepadButtonDown: function(gamepad,button) {
		try {
			(openfl_ui_GameInput().default).__onGamepadButtonDown(gamepad,button);
		} catch( e ) {
			if (e instanceof (js__$Boot_HaxeError().default)) e = e.val;
			this.__handleError(e);
		}
	},
	onGamepadButtonUp: function(gamepad,button) {
		try {
			(openfl_ui_GameInput().default).__onGamepadButtonUp(gamepad,button);
		} catch( e ) {
			if (e instanceof (js__$Boot_HaxeError().default)) e = e.val;
			this.__handleError(e);
		}
	},
	onGamepadConnect: function(gamepad) {
		try {
			(openfl_ui_GameInput().default).__onGamepadConnect(gamepad);
		} catch( e ) {
			if (e instanceof (js__$Boot_HaxeError().default)) e = e.val;
			this.__handleError(e);
		}
	},
	onGamepadDisconnect: function(gamepad) {
		try {
			(openfl_ui_GameInput().default).__onGamepadDisconnect(gamepad);
		} catch( e ) {
			if (e instanceof (js__$Boot_HaxeError().default)) e = e.val;
			this.__handleError(e);
		}
	},
	onJoystickAxisMove: function(joystick,axis,value) {
	},
	onJoystickButtonDown: function(joystick,button) {
	},
	onJoystickButtonUp: function(joystick,button) {
	},
	onJoystickConnect: function(joystick) {
	},
	onJoystickDisconnect: function(joystick) {
	},
	onJoystickHatMove: function(joystick,hat,position) {
	},
	onJoystickTrackballMove: function(joystick,trackball,value) {
	},
	onKeyDown: function(window,keyCode,modifier) {
		if(this.window == null || this.window != window) {
			return;
		}
		this.__onKey("keyDown",keyCode,modifier);
	},
	onKeyUp: function(window,keyCode,modifier) {
		if(this.window == null || this.window != window) {
			return;
		}
		this.__onKey("keyUp",keyCode,modifier);
	},
	onModuleExit: function(code) {
		if(this.window != null) {
			this.__broadcastEvent(new (openfl_events_Event().default)("deactivate"));
		}
	},
	onMouseDown: function(window,x,y,button) {
		if(this.window == null || this.window != window) {
			return;
		}
		var type;
		switch(button) {
		case 1:
			type = "middleMouseDown";
			break;
		case 2:
			type = "rightMouseDown";
			break;
		default:
			type = "mouseDown";
		}
		this.__onMouse(type,(Std().default)["int"](x * window.get_scale()),(Std().default)["int"](y * window.get_scale()),button);
	},
	onMouseMove: function(window,x,y) {
		if(this.window == null || this.window != window) {
			return;
		}
		this.__onMouse("mouseMove",(Std().default)["int"](x * window.get_scale()),(Std().default)["int"](y * window.get_scale()),0);
	},
	onMouseMoveRelative: function(window,x,y) {
	},
	onMouseUp: function(window,x,y,button) {
		if(this.window == null || this.window != window) {
			return;
		}
		var type;
		switch(button) {
		case 1:
			type = "middleMouseUp";
			break;
		case 2:
			type = "rightMouseUp";
			break;
		default:
			type = "mouseUp";
		}
		this.__onMouse(type,(Std().default)["int"](x * window.get_scale()),(Std().default)["int"](y * window.get_scale()),button);
		if(!this.showDefaultContextMenu && button == 2) {
			window.onMouseUp.cancel();
		}
	},
	onMouseWheel: function(window,deltaX,deltaY) {
		if(this.window == null || this.window != window) {
			return;
		}
		this.__onMouseWheel((Std().default)["int"](deltaX * window.get_scale()),(Std().default)["int"](deltaY * window.get_scale()));
	},
	onPreloadComplete: function() {
	},
	onPreloadProgress: function(loaded,total) {
	},
	onRenderContextLost: function(renderer) {
		this.__renderer = null;
	},
	onRenderContextRestored: function(renderer,context) {
		this.__createRenderer();
	},
	onTextEdit: function(window,text,start,length) {
	},
	onTextInput: function(window,text) {
		if(this.window == null || this.window != window) {
			return;
		}
		var stack = [];
		if(this.__focus == null) {
			this.__getInteractive(stack);
		} else {
			this.__focus.__getInteractive(stack);
		}
		var event = new (openfl_events_TextEvent().default)("textInput",true,false,text);
		if(stack.length > 0) {
			stack.reverse();
			this.__dispatchStack(event,stack);
		} else {
			this.__dispatchEvent(event);
		}
	},
	onTouchMove: function(touch) {
		this.__onTouch("touchMove",touch);
	},
	onTouchEnd: function(touch) {
		if(this.__primaryTouch == touch) {
			this.__primaryTouch = null;
		}
		this.__onTouch("touchEnd",touch);
	},
	onTouchStart: function(touch) {
		if(this.__primaryTouch == null) {
			this.__primaryTouch = touch;
		}
		this.__onTouch("touchBegin",touch);
	},
	onWindowActivate: function(window) {
		if(this.window == null || this.window != window) {
			return;
		}
	},
	onWindowClose: function(window) {
		if(this.window == window) {
			this.window = null;
		}
		this.__primaryTouch = null;
		this.__broadcastEvent(new (openfl_events_Event().default)("deactivate"));
	},
	onWindowCreate: function(window) {
		if(this.window == null || this.window != window) {
			return;
		}
		if(window.renderer != null) {
			this.__createRenderer();
		}
	},
	onWindowDeactivate: function(window) {
		if(this.window == null || this.window != window) {
			return;
		}
	},
	onWindowDropFile: function(window,file) {
	},
	onWindowEnter: function(window) {
	},
	onWindowFocusIn: function(window) {
		if(this.window == null || this.window != window) {
			return;
		}
		this.__renderDirty = true;
		this.__broadcastEvent(new (openfl_events_Event().default)("activate"));
		this.set_focus(this.__cacheFocus);
	},
	onWindowFocusOut: function(window) {
		if(this.window == null || this.window != window) {
			return;
		}
		this.__primaryTouch = null;
		this.__broadcastEvent(new (openfl_events_Event().default)("deactivate"));
		var currentFocus = this.get_focus();
		this.set_focus(null);
		this.__cacheFocus = currentFocus;
	},
	onWindowFullscreen: function(window) {
		if(this.window == null || this.window != window) {
			return;
		}
		this.__resize();
		if(!this.__wasFullscreen) {
			this.__wasFullscreen = true;
			if(this.__displayState == "normal") {
				this.__displayState = "fullScreenInteractive";
			}
			this.__dispatchEvent(new (openfl_events_FullScreenEvent().default)("fullScreen",false,false,false,true));
		}
	},
	onWindowLeave: function(window) {
		if(this.window == null || this.window != window) {
			return;
		}
		this.__dispatchEvent(new (openfl_events_Event().default)("mouseLeave"));
	},
	onWindowMinimize: function(window) {
		if(this.window == null || this.window != window) {
			return;
		}
	},
	onWindowMove: function(window,x,y) {
	},
	onWindowResize: function(window,width,height) {
		if(this.window == null || this.window != window) {
			return;
		}
		this.__renderDirty = true;
		this.__resize();
		if(this.__wasFullscreen && !window.get_fullscreen()) {
			this.__wasFullscreen = false;
			this.__displayState = "normal";
			this.__dispatchEvent(new (openfl_events_FullScreenEvent().default)("fullScreen",false,false,true,true));
		}
	},
	onWindowRestore: function(window) {
		if(this.window == null || this.window != window) {
			return;
		}
	},
	render: function(renderer) {
		if(renderer.window == null || renderer.window != this.window) {
			return;
		}
		if(this.__rendering) {
			return;
		}
		this.__rendering = true;
		if(this.__renderer != null && ((openfl_display_Stage3D().default).__active || this.stage3Ds.get(0).__contextRequested)) {
			this.__renderer.clear();
			this.__renderer.renderStage3D();
			this.__renderDirty = true;
		}
		this.__broadcastEvent(new (openfl_events_Event().default)("enterFrame"));
		this.__broadcastEvent(new (openfl_events_Event().default)("frameConstructed"));
		this.__broadcastEvent(new (openfl_events_Event().default)("exitFrame"));
		if(this.__invalidated) {
			this.__invalidated = false;
			this.__broadcastEvent(new (openfl_events_Event().default)("render"));
		}
		this.__renderable = true;
		this.__enterFrame(this.__deltaTime);
		this.__deltaTime = 0;
		this.__update(false,true);
		if(this.__renderer != null && this.__renderDirty) {
			if(!(openfl_display_Stage3D().default).__active) {
				this.__renderer.clear();
			}
			if(renderer.type == (lime_graphics_RendererType().default).CAIRO) {
				var _g = renderer.context;
				if((Type().default).enumIndex(_g) == 4) {
					var cairo = _g[2];
				}
			}
			this.__renderer.render();
		} else {
			renderer.onRender.cancel();
		}
		this.__rendering = false;
	},
	update: function(deltaTime) {
		this.__deltaTime = deltaTime;
	},
	__broadcastEvent: function(event) {
		if((openfl_display_DisplayObject().default).__broadcastEvents.exists(event.type)) {
			var dispatchers = (openfl_display_DisplayObject().default).__broadcastEvents.get(event.type);
			var _g = 0;
			while(_g < dispatchers.length) {
				var dispatcher = dispatchers[_g];
				++_g;
				if(dispatcher.stage == this || dispatcher.stage == null) {
					try {
						dispatcher.__dispatch(event);
					} catch( e ) {
						if (e instanceof (js__$Boot_HaxeError().default)) e = e.val;
						this.__handleError(e);
					}
				}
			}
		}
	},
	__createRenderer: function() {
		var _g = this.window.renderer.context;
		switch((Type().default).enumIndex(_g)) {
		case 0:
			var gl = _g[2];
			this.__renderer = new (openfl__$internal_renderer_opengl_GLRenderer().default)(this,gl);
			break;
		case 1:
			var context = _g[2];
			this.__renderer = new (openfl__$internal_renderer_canvas_CanvasRenderer().default)(this,context);
			break;
		case 2:
			var element = _g[2];
			this.__renderer = new (openfl__$internal_renderer_dom_DOMRenderer().default)(this,element);
			break;
		case 4:
			var cairo = _g[2];
			break;
		case 5:
			var ctx = _g[2];
			break;
		default:
		}
	},
	__dispatchEvent: function(event) {
		try {
			return (openfl_display_DisplayObjectContainer().default).prototype.__dispatchEvent.call(this,event);
		} catch( e ) {
			if (e instanceof (js__$Boot_HaxeError().default)) e = e.val;
			this.__handleError(e);
			return false;
		}
	},
	__dispatchStack: function(event,stack) {
		try {
			var target;
			var length = stack.length;
			if(length == 0) {
				event.eventPhase = 2;
				target = event.target;
				target.__dispatch(event);
			} else {
				event.eventPhase = 1;
				event.target = stack[stack.length - 1];
				var _g1 = 0;
				var _g = length - 1;
				while(_g1 < _g) {
					var i = _g1++;
					stack[i].__dispatch(event);
					if(event.__isCanceled) {
						return;
					}
				}
				event.eventPhase = 2;
				target = event.target;
				target.__dispatch(event);
				if(event.__isCanceled) {
					return;
				}
				if(event.bubbles) {
					event.eventPhase = 3;
					var i1 = length - 2;
					while(i1 >= 0) {
						stack[i1].__dispatch(event);
						if(event.__isCanceled) {
							return;
						}
						--i1;
					}
				}
			}
		} catch( e ) {
			if (e instanceof (js__$Boot_HaxeError().default)) e = e.val;
			this.__handleError(e);
		}
	},
	__dispatchTarget: function(target,event) {
		try {
			return target.__dispatchEvent(event);
		} catch( e ) {
			if (e instanceof (js__$Boot_HaxeError().default)) e = e.val;
			this.__handleError(e);
			return false;
		}
	},
	__drag: function(mouse) {
		var parent = this.__dragObject.parent;
		if(parent != null) {
			parent.__getWorldTransform().__transformInversePoint(mouse);
		}
		var x = mouse.x + this.__dragOffsetX;
		var y = mouse.y + this.__dragOffsetY;
		if(this.__dragBounds != null) {
			if(x < this.__dragBounds.x) {
				x = this.__dragBounds.x;
			} else if(x > this.__dragBounds.get_right()) {
				x = this.__dragBounds.get_right();
			}
			if(y < this.__dragBounds.y) {
				y = this.__dragBounds.y;
			} else if(y > this.__dragBounds.get_bottom()) {
				y = this.__dragBounds.get_bottom();
			}
		}
		this.__dragObject.set_x(x);
		this.__dragObject.set_y(y);
	},
	__getInteractive: function(stack) {
		if(stack != null) {
			stack.push(this);
		}
		return true;
	},
	__globalToLocal: function(global,local) {
		if(global != local) {
			local.copyFrom(global);
		}
		return local;
	},
	__handleError: function(e) {
		var event = new (openfl_events_UncaughtErrorEvent().default)("uncaughtError",true,true,e);
		(openfl_Lib().default).get_current().__loaderInfo.uncaughtErrorEvents.dispatchEvent(event);
		if(!event.__preventDefault) {
			try {
				var exc = (haxe_CallStack().default).lastException;
				if(exc != null && (Reflect().default).hasField(exc,"stack") && exc.stack != null && exc.stack != "") {
					console.log(exc.stack);
					e.stack = exc.stack;
				} else {
					var msg = (haxe_CallStack().default).toString((haxe_CallStack().default).callStack());
					console.log(msg);
				}
			} catch( e2 ) {
			}
			throw e;
		}
	},
	__onKey: function(type,keyCode,modifier) {
		(openfl_events_MouseEvent().default).__altKey = (lime_ui__$KeyModifier_KeyModifier_$Impl_$().default).get_altKey(modifier);
		(openfl_events_MouseEvent().default).__commandKey = (lime_ui__$KeyModifier_KeyModifier_$Impl_$().default).get_metaKey(modifier);
		(openfl_events_MouseEvent().default).__ctrlKey = (lime_ui__$KeyModifier_KeyModifier_$Impl_$().default).get_ctrlKey(modifier);
		(openfl_events_MouseEvent().default).__shiftKey = (lime_ui__$KeyModifier_KeyModifier_$Impl_$().default).get_shiftKey(modifier);
		var stack = [];
		if(this.__focus == null) {
			this.__getInteractive(stack);
		} else {
			this.__focus.__getInteractive(stack);
		}
		if(stack.length > 0) {
			var keyLocation = (openfl_ui_Keyboard().default).__getKeyLocation(keyCode);
			var keyCode1 = (openfl_ui_Keyboard().default).__convertKeyCode(keyCode);
			var charCode = (openfl_ui_Keyboard().default).__getCharCode(keyCode1,(lime_ui__$KeyModifier_KeyModifier_$Impl_$().default).get_shiftKey(modifier));
			var event = new (openfl_events_KeyboardEvent().default)(type,true,true,charCode,keyCode1,keyLocation,this.__macKeyboard ? (lime_ui__$KeyModifier_KeyModifier_$Impl_$().default).get_ctrlKey(modifier) || (lime_ui__$KeyModifier_KeyModifier_$Impl_$().default).get_metaKey(modifier) : (lime_ui__$KeyModifier_KeyModifier_$Impl_$().default).get_ctrlKey(modifier),(lime_ui__$KeyModifier_KeyModifier_$Impl_$().default).get_altKey(modifier),(lime_ui__$KeyModifier_KeyModifier_$Impl_$().default).get_shiftKey(modifier),(lime_ui__$KeyModifier_KeyModifier_$Impl_$().default).get_ctrlKey(modifier),(lime_ui__$KeyModifier_KeyModifier_$Impl_$().default).get_metaKey(modifier));
			stack.reverse();
			this.__dispatchStack(event,stack);
			if(event.__preventDefault) {
				if(type == "keyDown") {
					this.window.onKeyDown.cancel();
				} else {
					this.window.onKeyUp.cancel();
				}
			}
		}
	},
	__onGamepadConnect: function(gamepad) {
		this.onGamepadConnect(gamepad);
		var f = $bind(this,this.onGamepadAxisMove);
		var a1 = gamepad;
		var tmp = function(a2,a3) {
			f(a1,a2,a3);
		};
		gamepad.onAxisMove.add(tmp);
		var f1 = $bind(this,this.onGamepadButtonDown);
		var a11 = gamepad;
		var tmp1 = function(a21) {
			f1(a11,a21);
		};
		gamepad.onButtonDown.add(tmp1);
		var f2 = $bind(this,this.onGamepadButtonUp);
		var a12 = gamepad;
		var tmp2 = function(a22) {
			f2(a12,a22);
		};
		gamepad.onButtonUp.add(tmp2);
		var f3 = $bind(this,this.onGamepadDisconnect);
		var a13 = gamepad;
		var tmp3 = function() {
			f3(a13);
		};
		gamepad.onDisconnect.add(tmp3);
	},
	__onMouse: function(type,x,y,button) {
		if(button > 2) {
			return;
		}
		var targetPoint = (openfl_geom_Point().default).__pool.get();
		targetPoint.setTo(x,y);
		this.__displayMatrix.__transformInversePoint(targetPoint);
		this.__mouseX = targetPoint.x;
		this.__mouseY = targetPoint.y;
		var stack = [];
		var target = null;
		if(this.__hitTest(this.__mouseX,this.__mouseY,true,stack,true,this)) {
			target = stack[stack.length - 1];
		} else {
			target = this;
			stack = [this];
		}
		if(target == null) {
			target = this;
		}
		var clickType = null;
		switch(type) {
		case "middleMouseDown":
			this.__mouseDownMiddle = target;
			break;
		case "middleMouseUp":
			if(this.__mouseDownMiddle == target) {
				clickType = "middleClick";
			}
			this.__mouseDownMiddle = null;
			break;
		case "mouseDown":
			if(target.__allowMouseFocus()) {
				this.set_focus(target);
			} else {
				this.set_focus(null);
			}
			this.__mouseDownLeft = target;
			(openfl_events_MouseEvent().default).__buttonDown = true;
			break;
		case "mouseUp":
			if(this.__mouseDownLeft != null) {
				(openfl_events_MouseEvent().default).__buttonDown = false;
				if(this.__mouseX < 0 || this.__mouseY < 0) {
					this.__dispatchEvent((openfl_events_MouseEvent().default).__create("releaseOutside",1,this.__mouseX,this.__mouseY,new (openfl_geom_Point().default)(this.__mouseX,this.__mouseY),this));
				} else if(this.__mouseDownLeft == target) {
					clickType = "click";
				}
				this.__mouseDownLeft = null;
			}
			break;
		case "rightMouseDown":
			this.__mouseDownRight = target;
			break;
		case "rightMouseUp":
			if(this.__mouseDownRight == target) {
				clickType = "rightClick";
			}
			this.__mouseDownRight = null;
			break;
		default:
		}
		var localPoint = (openfl_geom_Point().default).__pool.get();
		this.__dispatchStack((openfl_events_MouseEvent().default).__create(type,button,this.__mouseX,this.__mouseY,target.__globalToLocal(targetPoint,localPoint),target),stack);
		if(clickType != null) {
			this.__dispatchStack((openfl_events_MouseEvent().default).__create(clickType,button,this.__mouseX,this.__mouseY,target.__globalToLocal(targetPoint,localPoint),target),stack);
			if(type == "mouseUp" && ((js_Boot().default).__cast(target , (openfl_display_InteractiveObject().default))).doubleClickEnabled) {
				var currentTime = (openfl_Lib().default).getTimer();
				if(currentTime - this.__lastClickTime < 500) {
					this.__dispatchStack((openfl_events_MouseEvent().default).__create("doubleClick",button,this.__mouseX,this.__mouseY,target.__globalToLocal(targetPoint,localPoint),target),stack);
					this.__lastClickTime = 0;
				} else {
					this.__lastClickTime = currentTime;
				}
			}
		}
		if((openfl_ui_Mouse().default).__cursor == "auto") {
			var cursor = null;
			if(this.__mouseDownLeft != null) {
				cursor = this.__mouseDownLeft.__getCursor();
			} else {
				var _g = 0;
				while(_g < stack.length) {
					var target1 = stack[_g];
					++_g;
					cursor = target1.__getCursor();
					if(cursor != null) {
						if((openfl_ui__$MouseCursor_MouseCursor_$Impl_$().default).fromLimeCursor(cursor) != this.__cursor && !(lime__$backend_html5_HTML5Mouse().default).__hidden) {
							var tmp;
							switch((Type().default).enumIndex(cursor)) {
							case 0:
								tmp = "default";
								break;
							case 1:
								tmp = "crosshair";
								break;
							case 3:
								tmp = "move";
								break;
							case 4:
								tmp = "pointer";
								break;
							case 5:
								tmp = "nesw-resize";
								break;
							case 6:
								tmp = "ns-resize";
								break;
							case 7:
								tmp = "nwse-resize";
								break;
							case 8:
								tmp = "ew-resize";
								break;
							case 9:
								tmp = "text";
								break;
							case 10:
								tmp = "wait";
								break;
							case 11:
								tmp = "wait";
								break;
							default:
								tmp = "auto";
							}
							this.window.backend.element.style.cursor = tmp;
							this.__cursor = (openfl_ui__$MouseCursor_MouseCursor_$Impl_$().default).fromLimeCursor(cursor);
						}
						break;
					}
				}
			}
			if(cursor == null) {
				if(this.__cursor != null && !(lime__$backend_html5_HTML5Mouse().default).__hidden) {
					this.window.backend.element.style.cursor = "default";
					this.__cursor = null;
				}
			}
		}
		var event;
		if(target != this.__mouseOverTarget) {
			if(this.__mouseOverTarget != null) {
				event = (openfl_events_MouseEvent().default).__create("mouseOut",button,this.__mouseX,this.__mouseY,this.__mouseOverTarget.__globalToLocal(targetPoint,localPoint),this.__mouseOverTarget);
				this.__dispatchTarget(this.__mouseOverTarget,event);
			}
		}
		var _g1 = 0;
		var _g11 = this.__rollOutStack;
		while(_g1 < _g11.length) {
			var target2 = _g11[_g1];
			++_g1;
			if(stack.indexOf(target2) == -1) {
				(HxOverrides().default).remove(this.__rollOutStack,target2);
				event = (openfl_events_MouseEvent().default).__create("rollOut",button,this.__mouseX,this.__mouseY,this.__mouseOverTarget.__globalToLocal(targetPoint,localPoint),this.__mouseOverTarget);
				event.bubbles = false;
				this.__dispatchTarget(target2,event);
			}
		}
		var _g2 = 0;
		while(_g2 < stack.length) {
			var target3 = stack[_g2];
			++_g2;
			if(this.__rollOutStack.indexOf(target3) == -1 && this.__mouseOverTarget != null) {
				if(target3.hasEventListener("rollOver")) {
					event = (openfl_events_MouseEvent().default).__create("rollOver",button,this.__mouseX,this.__mouseY,this.__mouseOverTarget.__globalToLocal(targetPoint,localPoint),target3);
					event.bubbles = false;
					this.__dispatchTarget(target3,event);
				}
				if(target3.hasEventListener("rollOut")) {
					this.__rollOutStack.push(target3);
				}
			}
		}
		if(target != this.__mouseOverTarget) {
			if(target != null) {
				event = (openfl_events_MouseEvent().default).__create("mouseOver",button,this.__mouseX,this.__mouseY,target.__globalToLocal(targetPoint,localPoint),target);
				event.bubbles = true;
				this.__dispatchTarget(target,event);
			}
			this.__mouseOverTarget = target;
		}
		if(this.__dragObject != null) {
			this.__drag(targetPoint);
			var dropTarget = null;
			if(this.__mouseOverTarget == this.__dragObject) {
				var cacheMouseEnabled = this.__dragObject.mouseEnabled;
				var cacheMouseChildren = this.__dragObject.mouseChildren;
				this.__dragObject.mouseEnabled = false;
				this.__dragObject.mouseChildren = false;
				var stack1 = [];
				if(this.__hitTest(this.__mouseX,this.__mouseY,true,stack1,true,this)) {
					dropTarget = stack1[stack1.length - 1];
				}
				this.__dragObject.mouseEnabled = cacheMouseEnabled;
				this.__dragObject.mouseChildren = cacheMouseChildren;
			} else if(this.__mouseOverTarget != this) {
				dropTarget = this.__mouseOverTarget;
			}
			this.__dragObject.dropTarget = dropTarget;
		}
		(openfl_geom_Point().default).__pool.release(targetPoint);
		(openfl_geom_Point().default).__pool.release(localPoint);
	},
	__onMouseWheel: function(deltaX,deltaY) {
		var x = this.__mouseX;
		var y = this.__mouseY;
		var stack = [];
		var target = null;
		if(this.__hitTest(this.__mouseX,this.__mouseY,true,stack,true,this)) {
			target = stack[stack.length - 1];
		} else {
			target = this;
			stack = [this];
		}
		if(target == null) {
			target = this;
		}
		var targetPoint = (openfl_geom_Point().default).__pool.get();
		targetPoint.setTo(x,y);
		this.__displayMatrix.__transformInversePoint(targetPoint);
		var delta = (Std().default)["int"](deltaY);
		this.__dispatchStack((openfl_events_MouseEvent().default).__create("mouseWheel",0,this.__mouseX,this.__mouseY,target.__globalToLocal(targetPoint,targetPoint),target,delta),stack);
		(openfl_geom_Point().default).__pool.release(targetPoint);
	},
	__onTouch: function(type,touch) {
		var targetPoint = (openfl_geom_Point().default).__pool.get();
		targetPoint.setTo(Math.round(touch.x * this.window.get_width() * this.window.get_scale()),Math.round(touch.y * this.window.get_height() * this.window.get_scale()));
		this.__displayMatrix.__transformInversePoint(targetPoint);
		var touchX = targetPoint.x;
		var touchY = targetPoint.y;
		var stack = [];
		var target = null;
		if(this.__hitTest(touchX,touchY,false,stack,true,this)) {
			target = stack[stack.length - 1];
		} else {
			target = this;
			stack = [this];
		}
		if(target == null) {
			target = this;
		}
		var touchId = touch.id;
		var touchData = null;
		if(this.__touchData.exists(touchId)) {
			touchData = this.__touchData.get(touchId);
		} else {
			touchData = (openfl__$internal_TouchData().default).__pool.get();
			touchData.reset();
			touchData.touch = touch;
			this.__touchData.set(touchId,touchData);
		}
		var touchType = null;
		var releaseTouchData = false;
		switch(type) {
		case "touchBegin":
			touchData.touchDownTarget = target;
			break;
		case "touchEnd":
			if(touchData.touchDownTarget == target) {
				touchType = "touchTap";
			}
			touchData.touchDownTarget = null;
			releaseTouchData = true;
			break;
		default:
		}
		var localPoint = (openfl_geom_Point().default).__pool.get();
		var isPrimaryTouchPoint = this.__primaryTouch == touch;
		var touchEvent = (openfl_events_TouchEvent().default).__create(type,null,touchX,touchY,target.__globalToLocal(targetPoint,localPoint),target);
		touchEvent.touchPointID = touchId;
		touchEvent.isPrimaryTouchPoint = isPrimaryTouchPoint;
		this.__dispatchStack(touchEvent,stack);
		if(touchType != null) {
			touchEvent = (openfl_events_TouchEvent().default).__create(touchType,null,touchX,touchY,target.__globalToLocal(targetPoint,localPoint),target);
			touchEvent.touchPointID = touchId;
			touchEvent.isPrimaryTouchPoint = isPrimaryTouchPoint;
			this.__dispatchStack(touchEvent,stack);
		}
		var touchOverTarget = touchData.touchOverTarget;
		if(target != touchOverTarget && touchOverTarget != null) {
			touchEvent = (openfl_events_TouchEvent().default).__create("touchOut",null,touchX,touchY,touchOverTarget.__globalToLocal(targetPoint,localPoint),touchOverTarget);
			touchEvent.touchPointID = touchId;
			touchEvent.isPrimaryTouchPoint = isPrimaryTouchPoint;
			this.__dispatchTarget(touchOverTarget,touchEvent);
		}
		var touchOutStack = touchData.rollOutStack;
		var _g = 0;
		while(_g < touchOutStack.length) {
			var target1 = touchOutStack[_g];
			++_g;
			if(stack.indexOf(target1) == -1) {
				(HxOverrides().default).remove(touchOutStack,target1);
				touchEvent = (openfl_events_TouchEvent().default).__create("touchRollOut",null,touchX,touchY,touchOverTarget.__globalToLocal(targetPoint,localPoint),touchOverTarget);
				touchEvent.touchPointID = touchId;
				touchEvent.isPrimaryTouchPoint = isPrimaryTouchPoint;
				touchEvent.bubbles = false;
				this.__dispatchTarget(target1,touchEvent);
			}
		}
		var _g1 = 0;
		while(_g1 < stack.length) {
			var target2 = stack[_g1];
			++_g1;
			if(touchOutStack.indexOf(target2) == -1) {
				if(target2.hasEventListener("touchRollOver")) {
					touchEvent = (openfl_events_TouchEvent().default).__create("touchRollOver",null,touchX,touchY,touchOverTarget.__globalToLocal(targetPoint,localPoint),target2);
					touchEvent.touchPointID = touchId;
					touchEvent.isPrimaryTouchPoint = isPrimaryTouchPoint;
					touchEvent.bubbles = false;
					this.__dispatchTarget(target2,touchEvent);
				}
				if(target2.hasEventListener("touchRollOut")) {
					touchOutStack.push(target2);
				}
			}
		}
		if(target != touchOverTarget) {
			if(target != null) {
				touchEvent = (openfl_events_TouchEvent().default).__create("touchOver",null,touchX,touchY,target.__globalToLocal(targetPoint,localPoint),target);
				touchEvent.touchPointID = touchId;
				touchEvent.isPrimaryTouchPoint = isPrimaryTouchPoint;
				touchEvent.bubbles = true;
				this.__dispatchTarget(target,touchEvent);
			}
			touchData.touchOverTarget = target;
		}
		(openfl_geom_Point().default).__pool.release(targetPoint);
		(openfl_geom_Point().default).__pool.release(localPoint);
		if(releaseTouchData) {
			this.__touchData.remove(touchId);
			touchData.reset();
			(openfl__$internal_TouchData().default).__pool.release(touchData);
		}
	},
	__resize: function() {
		var cacheWidth = this.stageWidth;
		var cacheHeight = this.stageHeight;
		var windowWidth = (Std().default)["int"](this.window.get_width() * this.window.get_scale());
		var windowHeight = (Std().default)["int"](this.window.get_height() * this.window.get_scale());
		this.__logicalWidth = windowWidth;
		this.__logicalHeight = windowHeight;
		this.__displayMatrix.identity();
		if(this.__logicalWidth == 0 && this.__logicalHeight == 0) {
			this.stageWidth = windowWidth;
			this.stageHeight = windowHeight;
		} else {
			this.stageWidth = this.__logicalWidth;
			this.stageHeight = this.__logicalHeight;
			var scaleX = windowWidth / this.stageWidth;
			var scaleY = windowHeight / this.stageHeight;
			var targetScale = Math.min(scaleX,scaleY);
			var offsetX = Math.round((windowWidth - this.stageWidth * targetScale) / 2);
			var offsetY = Math.round((windowHeight - this.stageHeight * targetScale) / 2);
			this.__displayMatrix.scale(targetScale,targetScale);
			this.__displayMatrix.translate(offsetX,offsetY);
		}
		var _g = 0;
		var _g1 = this.stage3Ds;
		while(_g < _g1.get_length()) {
			var stage3D = _g1.get(_g);
			++_g;
			stage3D.__resize(this.stageWidth,this.stageHeight);
		}
		if(this.__renderer != null) {
			this.__renderer.resize(windowWidth,windowHeight);
		}
		if(this.stageWidth != cacheWidth || this.stageHeight != cacheHeight) {
			this.__dispatchEvent(new (openfl_events_Event().default)("resize"));
		}
	},
	__setLogicalSize: function(width,height) {
		this.__logicalWidth = width;
		this.__logicalHeight = height;
		this.__resize();
	},
	__startDrag: function(sprite,lockCenter,bounds) {
		this.__dragBounds = bounds == null ? null : bounds.clone();
		this.__dragObject = sprite;
		if(this.__dragObject != null) {
			if(lockCenter) {
				this.__dragOffsetX = 0;
				this.__dragOffsetY = 0;
			} else {
				var mouse = (openfl_geom_Point().default).__pool.get();
				mouse.setTo(this.get_mouseX(),this.get_mouseY());
				var parent = this.__dragObject.parent;
				if(parent != null) {
					parent.__getWorldTransform().__transformInversePoint(mouse);
				}
				this.__dragOffsetX = this.__dragObject.get_x() - mouse.x;
				this.__dragOffsetY = this.__dragObject.get_y() - mouse.y;
				(openfl_geom_Point().default).__pool.release(mouse);
			}
		}
	},
	__stopDrag: function(sprite) {
		this.__dragBounds = null;
		this.__dragObject = null;
	},
	__update: function(transformOnly,updateChildren,maskGraphics) {
		if(transformOnly) {
			if(this.__transformDirty) {
				(openfl_display_DisplayObjectContainer().default).prototype.__update.call(this,true,updateChildren,maskGraphics);
				if(updateChildren) {
					this.__transformDirty = false;
				}
			}
		} else if(this.__transformDirty || this.__renderDirty) {
			(openfl_display_DisplayObjectContainer().default).prototype.__update.call(this,false,updateChildren,maskGraphics);
			if(updateChildren) {
				if((openfl_display_DisplayObject().default).__supportDOM) {
					this.__wasDirty = true;
				}
			}
		} else if(this.__wasDirty) {
			(openfl_display_DisplayObjectContainer().default).prototype.__update.call(this,false,updateChildren,maskGraphics);
			if(updateChildren) {
				this.__wasDirty = false;
			}
		}
	},
	get_color: function() {
		return this.__color;
	},
	set_color: function(value) {
		if(value == null) {
			this.__transparent = true;
			value = 0;
		} else {
			this.__transparent = false;
		}
		var r = (value & 16711680) >>> 16;
		var g = (value & 65280) >>> 8;
		var b = value & 255;
		this.__colorSplit = [r / 255,g / 255,b / 255];
		this.__colorString = "#" + (StringTools().default).hex(value & 16777215,6);
		return this.__color = value;
	},
	get_contentsScaleFactor: function() {
		return this.__contentsScaleFactor;
	},
	get_displayState: function() {
		return this.__displayState;
	},
	set_displayState: function(value) {
		if(this.window != null) {
			if(value == "normal") {
				if(this.window.get_fullscreen()) {
					this.window.set_fullscreen(false);
				}
			} else if(!this.window.get_fullscreen()) {
				this.window.set_fullscreen(true);
			}
		}
		return this.__displayState = value;
	},
	get_focus: function() {
		return this.__focus;
	},
	set_focus: function(value) {
		if(value != this.__focus) {
			var oldFocus = this.__focus;
			this.__focus = value;
			this.__cacheFocus = value;
			if(oldFocus != null) {
				var event = new (openfl_events_FocusEvent().default)("focusOut",true,false,value,false,0);
				var stack = [];
				oldFocus.__getInteractive(stack);
				stack.reverse();
				this.__dispatchStack(event,stack);
			}
			if(value != null) {
				var event1 = new (openfl_events_FocusEvent().default)("focusIn",true,false,oldFocus,false,0);
				var stack1 = [];
				value.__getInteractive(stack1);
				stack1.reverse();
				this.__dispatchStack(event1,stack1);
			}
		}
		return value;
	},
	get_frameRate: function() {
		if(this.application != null) {
			return this.application.get_frameRate();
		}
		return 0;
	},
	set_frameRate: function(value) {
		if(this.application != null) {
			return this.application.set_frameRate(value);
		}
		return value;
	},
	get_fullScreenHeight: function() {
		return Math.ceil(this.window.get_display().currentMode.height * this.window.get_scale());
	},
	get_fullScreenWidth: function() {
		return Math.ceil(this.window.get_display().currentMode.width * this.window.get_scale());
	},
	set_height: function(value) {
		return this.get_height();
	},
	get_mouseX: function() {
		return this.__mouseX;
	},
	get_mouseY: function() {
		return this.__mouseY;
	},
	set_rotation: function(value) {
		return 0;
	},
	set_scaleX: function(value) {
		return 0;
	},
	set_scaleY: function(value) {
		return 0;
	},
	set_transform: function(value) {
		return this.get_transform();
	},
	set_width: function(value) {
		return this.get_width();
	},
	set_x: function(value) {
		return 0;
	},
	set_y: function(value) {
		return 0;
	}
});
Stage.prototype.__class__ = $hxClasses["openfl.display.Stage"] = Stage;

// Init

Object.defineProperties(Stage.prototype,{ "color" : { get : function () { return this.get_color (); }, set : function (v) { return this.set_color (v); }}, "contentsScaleFactor" : { get : function () { return this.get_contentsScaleFactor (); }}, "displayState" : { get : function () { return this.get_displayState (); }, set : function (v) { return this.set_displayState (v); }}, "focus" : { get : function () { return this.get_focus (); }, set : function (v) { return this.set_focus (v); }}, "frameRate" : { get : function () { return this.get_frameRate (); }, set : function (v) { return this.set_frameRate (v); }}, "fullScreenHeight" : { get : function () { return this.get_fullScreenHeight (); }}, "fullScreenWidth" : { get : function () { return this.get_fullScreenWidth (); }}});

// Statics




// Export

exports.default = Stage;