diff --git a/lib/easeljs.js b/lib/easeljs.js index d28e13489..6aff9371a 100644 --- a/lib/easeljs.js +++ b/lib/easeljs.js @@ -461,381 +461,381 @@ this.createjs = this.createjs||{}; // EventDispatcher.js //############################################################################## -this.createjs = this.createjs||{}; - -(function() { - "use strict"; - - -// constructor: - /** - * EventDispatcher provides methods for managing queues of event listeners and dispatching events. - * - * You can either extend EventDispatcher or mix its methods into an existing prototype or instance by using the - * EventDispatcher {{#crossLink "EventDispatcher/initialize"}}{{/crossLink}} method. - * - * Together with the CreateJS Event class, EventDispatcher provides an extended event model that is based on the - * DOM Level 2 event model, including addEventListener, removeEventListener, and dispatchEvent. It supports - * bubbling / capture, preventDefault, stopPropagation, stopImmediatePropagation, and handleEvent. - * - * EventDispatcher also exposes a {{#crossLink "EventDispatcher/on"}}{{/crossLink}} method, which makes it easier - * to create scoped listeners, listeners that only run once, and listeners with associated arbitrary data. The - * {{#crossLink "EventDispatcher/off"}}{{/crossLink}} method is merely an alias to - * {{#crossLink "EventDispatcher/removeEventListener"}}{{/crossLink}}. - * - * Another addition to the DOM Level 2 model is the {{#crossLink "EventDispatcher/removeAllEventListeners"}}{{/crossLink}} - * method, which can be used to listeners for all events, or listeners for a specific event. The Event object also - * includes a {{#crossLink "Event/remove"}}{{/crossLink}} method which removes the active listener. - * - *

Example

- * Add EventDispatcher capabilities to the "MyClass" class. - * - * EventDispatcher.initialize(MyClass.prototype); - * - * Add an event (see {{#crossLink "EventDispatcher/addEventListener"}}{{/crossLink}}). - * - * instance.addEventListener("eventName", handlerMethod); - * function handlerMethod(event) { - * console.log(event.target + " Was Clicked"); - * } - * - * Maintaining proper scope
- * Scope (ie. "this") can be be a challenge with events. Using the {{#crossLink "EventDispatcher/on"}}{{/crossLink}} - * method to subscribe to events simplifies this. - * - * instance.addEventListener("click", function(event) { - * console.log(instance == this); // false, scope is ambiguous. - * }); - * - * instance.on("click", function(event) { - * console.log(instance == this); // true, "on" uses dispatcher scope by default. - * }); - * - * If you want to use addEventListener instead, you may want to use function.bind() or a similar proxy to manage - * scope. - * - * Browser support - * The event model in CreateJS can be used separately from the suite in any project, however the inheritance model - * requires modern browsers (IE9+). - * - * - * @class EventDispatcher - * @constructor - **/ - function EventDispatcher() { - - - // private properties: - /** - * @protected - * @property _listeners - * @type Object - **/ - this._listeners = null; - - /** - * @protected - * @property _captureListeners - * @type Object - **/ - this._captureListeners = null; - } - var p = EventDispatcher.prototype; - -// static public methods: - /** - * Static initializer to mix EventDispatcher methods into a target object or prototype. - * - * EventDispatcher.initialize(MyClass.prototype); // add to the prototype of the class - * EventDispatcher.initialize(myObject); // add to a specific instance - * - * @method initialize - * @static - * @param {Object} target The target object to inject EventDispatcher methods into. This can be an instance or a - * prototype. - **/ - EventDispatcher.initialize = function(target) { - target.addEventListener = p.addEventListener; - target.on = p.on; - target.removeEventListener = target.off = p.removeEventListener; - target.removeAllEventListeners = p.removeAllEventListeners; - target.hasEventListener = p.hasEventListener; - target.dispatchEvent = p.dispatchEvent; - target._dispatchEvent = p._dispatchEvent; - target.willTrigger = p.willTrigger; - }; - - -// public methods: - /** - * Adds the specified event listener. Note that adding multiple listeners to the same function will result in - * multiple callbacks getting fired. - * - *

Example

- * - * displayObject.addEventListener("click", handleClick); - * function handleClick(event) { - * // Click happened. - * } - * - * @method addEventListener - * @param {String} type The string type of the event. - * @param {Function | Object} listener An object with a handleEvent method, or a function that will be called when - * the event is dispatched. - * @param {Boolean} [useCapture] For events that bubble, indicates whether to listen for the event in the capture or bubbling/target phase. - * @return {Function | Object} Returns the listener for chaining or assignment. - **/ - p.addEventListener = function(type, listener, useCapture) { - var listeners; - if (useCapture) { - listeners = this._captureListeners = this._captureListeners||{}; - } else { - listeners = this._listeners = this._listeners||{}; - } - var arr = listeners[type]; - if (arr) { this.removeEventListener(type, listener, useCapture); } - arr = listeners[type]; // remove may have deleted the array - if (!arr) { listeners[type] = [listener]; } - else { arr.push(listener); } - return listener; - }; - - /** - * A shortcut method for using addEventListener that makes it easier to specify an execution scope, have a listener - * only run once, associate arbitrary data with the listener, and remove the listener. - * - * This method works by creating an anonymous wrapper function and subscribing it with addEventListener. - * The wrapper function is returned for use with `removeEventListener` (or `off`). - * - * IMPORTANT: To remove a listener added with `on`, you must pass in the returned wrapper function as the listener, or use - * {{#crossLink "Event/remove"}}{{/crossLink}}. Likewise, each time you call `on` a NEW wrapper function is subscribed, so multiple calls - * to `on` with the same params will create multiple listeners. - * - *

Example

- * - * var listener = myBtn.on("click", handleClick, null, false, {count:3}); - * function handleClick(evt, data) { - * data.count -= 1; - * console.log(this == myBtn); // true - scope defaults to the dispatcher - * if (data.count == 0) { - * alert("clicked 3 times!"); - * myBtn.off("click", listener); - * // alternately: evt.remove(); - * } - * } - * - * @method on - * @param {String} type The string type of the event. - * @param {Function | Object} listener An object with a handleEvent method, or a function that will be called when - * the event is dispatched. - * @param {Object} [scope] The scope to execute the listener in. Defaults to the dispatcher/currentTarget for function listeners, and to the listener itself for object listeners (ie. using handleEvent). - * @param {Boolean} [once=false] If true, the listener will remove itself after the first time it is triggered. - * @param {*} [data] Arbitrary data that will be included as the second parameter when the listener is called. - * @param {Boolean} [useCapture=false] For events that bubble, indicates whether to listen for the event in the capture or bubbling/target phase. - * @return {Function} Returns the anonymous function that was created and assigned as the listener. This is needed to remove the listener later using .removeEventListener. - **/ - p.on = function(type, listener, scope, once, data, useCapture) { - if (listener.handleEvent) { - scope = scope||listener; - listener = listener.handleEvent; - } - scope = scope||this; - return this.addEventListener(type, function(evt) { - listener.call(scope, evt, data); - once&&evt.remove(); - }, useCapture); - }; - - /** - * Removes the specified event listener. - * - * Important Note: that you must pass the exact function reference used when the event was added. If a proxy - * function, or function closure is used as the callback, the proxy/closure reference must be used - a new proxy or - * closure will not work. - * - *

Example

- * - * displayObject.removeEventListener("click", handleClick); - * - * @method removeEventListener - * @param {String} type The string type of the event. - * @param {Function | Object} listener The listener function or object. - * @param {Boolean} [useCapture] For events that bubble, indicates whether to listen for the event in the capture or bubbling/target phase. - **/ - p.removeEventListener = function(type, listener, useCapture) { - var listeners = useCapture ? this._captureListeners : this._listeners; - if (!listeners) { return; } - var arr = listeners[type]; - if (!arr) { return; } - for (var i=0,l=arr.length; iIMPORTANT: To remove a listener added with `on`, you must pass in the returned wrapper function as the listener. See - * {{#crossLink "EventDispatcher/on"}}{{/crossLink}} for an example. - * - * @method off - * @param {String} type The string type of the event. - * @param {Function | Object} listener The listener function or object. - * @param {Boolean} [useCapture] For events that bubble, indicates whether to listen for the event in the capture or bubbling/target phase. - **/ - p.off = p.removeEventListener; - - /** - * Removes all listeners for the specified type, or all listeners of all types. - * - *

Example

- * - * // Remove all listeners - * displayObject.removeAllEventListeners(); - * - * // Remove all click listeners - * displayObject.removeAllEventListeners("click"); - * - * @method removeAllEventListeners - * @param {String} [type] The string type of the event. If omitted, all listeners for all types will be removed. - **/ - p.removeAllEventListeners = function(type) { - if (!type) { this._listeners = this._captureListeners = null; } - else { - if (this._listeners) { delete(this._listeners[type]); } - if (this._captureListeners) { delete(this._captureListeners[type]); } - } - }; - - /** - * Dispatches the specified event to all listeners. - * - *

Example

- * - * // Use a string event - * this.dispatchEvent("complete"); - * - * // Use an Event instance - * var event = new createjs.Event("progress"); - * this.dispatchEvent(event); - * - * @method dispatchEvent - * @param {Object | String | Event} eventObj An object with a "type" property, or a string type. - * While a generic object will work, it is recommended to use a CreateJS Event instance. If a string is used, - * dispatchEvent will construct an Event instance if necessary with the specified type. This latter approach can - * be used to avoid event object instantiation for non-bubbling events that may not have any listeners. - * @param {Boolean} [bubbles] Specifies the `bubbles` value when a string was passed to eventObj. - * @param {Boolean} [cancelable] Specifies the `cancelable` value when a string was passed to eventObj. - * @return {Boolean} Returns false if `preventDefault()` was called on a cancelable event, true otherwise. - **/ - p.dispatchEvent = function(eventObj, bubbles, cancelable) { - if (typeof eventObj == "string") { - // skip everything if there's no listeners and it doesn't bubble: - var listeners = this._listeners; - if (!bubbles && (!listeners || !listeners[eventObj])) { return true; } - eventObj = new createjs.Event(eventObj, bubbles, cancelable); - } else if (eventObj.target && eventObj.clone) { - // redispatching an active event object, so clone it: - eventObj = eventObj.clone(); - } - - // TODO: it would be nice to eliminate this. Maybe in favour of evtObj instanceof Event? Or !!evtObj.createEvent - try { eventObj.target = this; } catch (e) {} // try/catch allows redispatching of native events - - if (!eventObj.bubbles || !this.parent) { - this._dispatchEvent(eventObj, 2); - } else { - var top=this, list=[top]; - while (top.parent) { list.push(top = top.parent); } - var i, l=list.length; - - // capture & atTarget - for (i=l-1; i>=0 && !eventObj.propagationStopped; i--) { - list[i]._dispatchEvent(eventObj, 1+(i==0)); - } - // bubbling - for (i=1; iExample + * Add EventDispatcher capabilities to the "MyClass" class. + * + * EventDispatcher.initialize(MyClass.prototype); + * + * Add an event (see {{#crossLink "EventDispatcher/addEventListener"}}{{/crossLink}}). + * + * instance.addEventListener("eventName", handlerMethod); + * function handlerMethod(event) { + * console.log(event.target + " Was Clicked"); + * } + * + * Maintaining proper scope
+ * Scope (ie. "this") can be be a challenge with events. Using the {{#crossLink "EventDispatcher/on"}}{{/crossLink}} + * method to subscribe to events simplifies this. + * + * instance.addEventListener("click", function(event) { + * console.log(instance == this); // false, scope is ambiguous. + * }); + * + * instance.on("click", function(event) { + * console.log(instance == this); // true, "on" uses dispatcher scope by default. + * }); + * + * If you want to use addEventListener instead, you may want to use function.bind() or a similar proxy to manage + * scope. + * + * Browser support + * The event model in CreateJS can be used separately from the suite in any project, however the inheritance model + * requires modern browsers (IE9+). + * + * + * @class EventDispatcher + * @constructor + **/ + function EventDispatcher() { + + + // private properties: + /** + * @protected + * @property _listeners + * @type Object + **/ + this._listeners = null; + + /** + * @protected + * @property _captureListeners + * @type Object + **/ + this._captureListeners = null; + } + var p = EventDispatcher.prototype; + +// static public methods: + /** + * Static initializer to mix EventDispatcher methods into a target object or prototype. + * + * EventDispatcher.initialize(MyClass.prototype); // add to the prototype of the class + * EventDispatcher.initialize(myObject); // add to a specific instance + * + * @method initialize + * @static + * @param {Object} target The target object to inject EventDispatcher methods into. This can be an instance or a + * prototype. + **/ + EventDispatcher.initialize = function(target) { + target.addEventListener = p.addEventListener; + target.on = p.on; + target.removeEventListener = target.off = p.removeEventListener; + target.removeAllEventListeners = p.removeAllEventListeners; + target.hasEventListener = p.hasEventListener; + target.dispatchEvent = p.dispatchEvent; + target._dispatchEvent = p._dispatchEvent; + target.willTrigger = p.willTrigger; + }; + + +// public methods: + /** + * Adds the specified event listener. Note that adding multiple listeners to the same function will result in + * multiple callbacks getting fired. + * + *

Example

+ * + * displayObject.addEventListener("click", handleClick); + * function handleClick(event) { + * // Click happened. + * } + * + * @method addEventListener + * @param {String} type The string type of the event. + * @param {Function | Object} listener An object with a handleEvent method, or a function that will be called when + * the event is dispatched. + * @param {Boolean} [useCapture] For events that bubble, indicates whether to listen for the event in the capture or bubbling/target phase. + * @return {Function | Object} Returns the listener for chaining or assignment. + **/ + p.addEventListener = function(type, listener, useCapture) { + var listeners; + if (useCapture) { + listeners = this._captureListeners = this._captureListeners||{}; + } else { + listeners = this._listeners = this._listeners||{}; + } + var arr = listeners[type]; + if (arr) { this.removeEventListener(type, listener, useCapture); } + arr = listeners[type]; // remove may have deleted the array + if (!arr) { listeners[type] = [listener]; } + else { arr.push(listener); } + return listener; + }; + + /** + * A shortcut method for using addEventListener that makes it easier to specify an execution scope, have a listener + * only run once, associate arbitrary data with the listener, and remove the listener. + * + * This method works by creating an anonymous wrapper function and subscribing it with addEventListener. + * The wrapper function is returned for use with `removeEventListener` (or `off`). + * + * IMPORTANT: To remove a listener added with `on`, you must pass in the returned wrapper function as the listener, or use + * {{#crossLink "Event/remove"}}{{/crossLink}}. Likewise, each time you call `on` a NEW wrapper function is subscribed, so multiple calls + * to `on` with the same params will create multiple listeners. + * + *

Example

+ * + * var listener = myBtn.on("click", handleClick, null, false, {count:3}); + * function handleClick(evt, data) { + * data.count -= 1; + * console.log(this == myBtn); // true - scope defaults to the dispatcher + * if (data.count == 0) { + * alert("clicked 3 times!"); + * myBtn.off("click", listener); + * // alternately: evt.remove(); + * } + * } + * + * @method on + * @param {String} type The string type of the event. + * @param {Function | Object} listener An object with a handleEvent method, or a function that will be called when + * the event is dispatched. + * @param {Object} [scope] The scope to execute the listener in. Defaults to the dispatcher/currentTarget for function listeners, and to the listener itself for object listeners (ie. using handleEvent). + * @param {Boolean} [once=false] If true, the listener will remove itself after the first time it is triggered. + * @param {*} [data] Arbitrary data that will be included as the second parameter when the listener is called. + * @param {Boolean} [useCapture=false] For events that bubble, indicates whether to listen for the event in the capture or bubbling/target phase. + * @return {Function} Returns the anonymous function that was created and assigned as the listener. This is needed to remove the listener later using .removeEventListener. + **/ + p.on = function(type, listener, scope, once, data, useCapture) { + if (listener.handleEvent) { + scope = scope||listener; + listener = listener.handleEvent; + } + scope = scope||this; + return this.addEventListener(type, function(evt) { + listener.call(scope, evt, data); + once&&evt.remove(); + }, useCapture); + }; + + /** + * Removes the specified event listener. + * + * Important Note: that you must pass the exact function reference used when the event was added. If a proxy + * function, or function closure is used as the callback, the proxy/closure reference must be used - a new proxy or + * closure will not work. + * + *

Example

+ * + * displayObject.removeEventListener("click", handleClick); + * + * @method removeEventListener + * @param {String} type The string type of the event. + * @param {Function | Object} listener The listener function or object. + * @param {Boolean} [useCapture] For events that bubble, indicates whether to listen for the event in the capture or bubbling/target phase. + **/ + p.removeEventListener = function(type, listener, useCapture) { + var listeners = useCapture ? this._captureListeners : this._listeners; + if (!listeners) { return; } + var arr = listeners[type]; + if (!arr) { return; } + for (var i=0,l=arr.length; iIMPORTANT: To remove a listener added with `on`, you must pass in the returned wrapper function as the listener. See + * {{#crossLink "EventDispatcher/on"}}{{/crossLink}} for an example. + * + * @method off + * @param {String} type The string type of the event. + * @param {Function | Object} listener The listener function or object. + * @param {Boolean} [useCapture] For events that bubble, indicates whether to listen for the event in the capture or bubbling/target phase. + **/ + p.off = p.removeEventListener; + + /** + * Removes all listeners for the specified type, or all listeners of all types. + * + *

Example

+ * + * // Remove all listeners + * displayObject.removeAllEventListeners(); + * + * // Remove all click listeners + * displayObject.removeAllEventListeners("click"); + * + * @method removeAllEventListeners + * @param {String} [type] The string type of the event. If omitted, all listeners for all types will be removed. + **/ + p.removeAllEventListeners = function(type) { + if (!type) { this._listeners = this._captureListeners = null; } + else { + if (this._listeners) { delete(this._listeners[type]); } + if (this._captureListeners) { delete(this._captureListeners[type]); } + } + }; + + /** + * Dispatches the specified event to all listeners. + * + *

Example

+ * + * // Use a string event + * this.dispatchEvent("complete"); + * + * // Use an Event instance + * var event = new createjs.Event("progress"); + * this.dispatchEvent(event); + * + * @method dispatchEvent + * @param {Object | String | Event} eventObj An object with a "type" property, or a string type. + * While a generic object will work, it is recommended to use a CreateJS Event instance. If a string is used, + * dispatchEvent will construct an Event instance if necessary with the specified type. This latter approach can + * be used to avoid event object instantiation for non-bubbling events that may not have any listeners. + * @param {Boolean} [bubbles] Specifies the `bubbles` value when a string was passed to eventObj. + * @param {Boolean} [cancelable] Specifies the `cancelable` value when a string was passed to eventObj. + * @return {Boolean} Returns false if `preventDefault()` was called on a cancelable event, true otherwise. + **/ + p.dispatchEvent = function(eventObj, bubbles, cancelable) { + if (typeof eventObj == "string") { + // skip everything if there's no listeners and it doesn't bubble: + var listeners = this._listeners; + if (!bubbles && (!listeners || !listeners[eventObj])) { return true; } + eventObj = new createjs.Event(eventObj, bubbles, cancelable); + } else if (eventObj.target && eventObj.clone) { + // redispatching an active event object, so clone it: + eventObj = eventObj.clone(); + } + + // TODO: it would be nice to eliminate this. Maybe in favour of evtObj instanceof Event? Or !!evtObj.createEvent + try { eventObj.target = this; } catch (e) {} // try/catch allows redispatching of native events + + if (!eventObj.bubbles || !this.parent) { + this._dispatchEvent(eventObj, 2); + } else { + var top=this, list=[top]; + while (top.parent) { list.push(top = top.parent); } + var i, l=list.length; + + // capture & atTarget + for (i=l-1; i>=0 && !eventObj.propagationStopped; i--) { + list[i]._dispatchEvent(eventObj, 1+(i==0)); + } + // bubbling + for (i=1; iNote: In EaselJS 0.7.0, the mouseEnabled property will not work properly with nested Containers. Please + * check out the latest NEXT version in GitHub for an updated version with this issue resolved. The fix will be + * provided in the next release of EaselJS. + * @property mouseEnabled + * @type {Boolean} + * @default true + **/ + this.mouseEnabled = true; + + /** + * If false, the tick will not run on this display object (or its children). This can provide some performance benefits. + * In addition to preventing the "tick" event from being dispatched, it will also prevent tick related updates + * on some display objects (ex. Sprite & MovieClip frame advancing, and DOMElement display properties). + * @property tickEnabled + * @type Boolean + * @default true + **/ + this.tickEnabled = true; + + /** + * An optional name for this display object. Included in {{#crossLink "DisplayObject/toString"}}{{/crossLink}} . Useful for + * debugging. + * @property name + * @type {String} + * @default null + **/ + this.name = null; + + /** + * A reference to the {{#crossLink "Container"}}{{/crossLink}} or {{#crossLink "Stage"}}{{/crossLink}} object that + * contains this display object, or null if it has not been added + * to one. + * @property parent + * @final + * @type {Container} + * @default null + * @readonly + **/ + this.parent = null; + + /** + * The left offset for this display object's registration point. For example, to make a 100x100px Bitmap rotate + * around its center, you would set regX and {{#crossLink "DisplayObject/regY:property"}}{{/crossLink}} to 50. + * Cached object's registration points should be set based on pre-cache conditions, not cached size. + * @property regX + * @type {Number} + * @default 0 + **/ + this.regX = 0; + + /** + * The y offset for this display object's registration point. For example, to make a 100x100px Bitmap rotate around + * its center, you would set {{#crossLink "DisplayObject/regX:property"}}{{/crossLink}} and regY to 50. + * Cached object's registration points should be set based on pre-cache conditions, not cached size. + * @property regY + * @type {Number} + * @default 0 + **/ + this.regY = 0; + + /** + * The rotation in degrees for this display object. + * @property rotation + * @type {Number} + * @default 0 + **/ + this.rotation = 0; + + /** + * The factor to stretch this display object horizontally. For example, setting scaleX to 2 will stretch the display + * object to twice its nominal width. To horizontally flip an object, set the scale to a negative number. + * @property scaleX + * @type {Number} + * @default 1 + **/ + this.scaleX = 1; + + /** + * The factor to stretch this display object vertically. For example, setting scaleY to 0.5 will stretch the display + * object to half its nominal height. To vertically flip an object, set the scale to a negative number. + * @property scaleY + * @type {Number} + * @default 1 + **/ + this.scaleY = 1; + + /** + * The factor to skew this display object horizontally. + * @property skewX + * @type {Number} + * @default 0 + **/ + this.skewX = 0; + + /** + * The factor to skew this display object vertically. + * @property skewY + * @type {Number} + * @default 0 + **/ + this.skewY = 0; + + /** + * A shadow object that defines the shadow to render on this display object. Set to `null` to remove a shadow. If + * null, this property is inherited from the parent container. + * @property shadow + * @type {Shadow} + * @default null + **/ + this.shadow = null; + + /** + * Indicates whether this display object should be rendered to the canvas and included when running the Stage + * {{#crossLink "Stage/getObjectsUnderPoint"}}{{/crossLink}} method. + * @property visible + * @type {Boolean} + * @default true + **/ + this.visible = true; + + /** + * The x (horizontal) position of the display object, relative to its parent. + * @property x + * @type {Number} + * @default 0 + **/ + this.x = 0; + + /** The y (vertical) position of the display object, relative to its parent. + * @property y + * @type {Number} + * @default 0 + **/ + this.y = 0; + + /** + * If set, defines the transformation for this display object, overriding all other transformation properties + * (x, y, rotation, scale, skew). + * @property transformMatrix + * @type {Matrix2D} + * @default null + **/ + this.transformMatrix = null; + + /** + * The composite operation indicates how the pixels of this display object will be composited with the elements + * behind it. If `null`, this property is inherited from the parent container. For more information, read the + * + * whatwg spec on compositing. For a list of supported compositeOperation value, visit + * the W3C draft on Compositing and Blending. + * @property compositeOperation + * @type {String} + * @default null + **/ + this.compositeOperation = null; + + /** + * Indicates whether the display object should be drawn to a whole pixel when + * {{#crossLink "Stage/snapToPixelEnabled"}}{{/crossLink}} is true. To enable/disable snapping on whole + * categories of display objects, set this value on the prototype (Ex. Text.prototype.snapToPixel = true). + * @property snapToPixel + * @type {Boolean} + * @default true + **/ + this.snapToPixel = true; + + /** + * An array of Filter objects to apply to this display object. Filters are only applied / updated when {{#crossLink "cache"}}{{/crossLink}} + * or {{#crossLink "updateCache"}}{{/crossLink}} is called on the display object, and only apply to the area that is + * cached. + * @property filters + * @type {Array} + * @default null + **/ + this.filters = null; + + /** + * A Shape instance that defines a vector mask (clipping path) for this display object. The shape's transformation + * will be applied relative to the display object's parent coordinates (as if it were a child of the parent). + * @property mask + * @type {Shape} + * @default null + */ + this.mask = null; + + /** + * A display object that will be tested when checking mouse interactions or testing {{#crossLink "Container/getObjectsUnderPoint"}}{{/crossLink}}. + * The hit area will have its transformation applied relative to this display object's coordinate space (as though + * the hit test object were a child of this display object and relative to its regX/Y). The hitArea will be tested + * using only its own `alpha` value regardless of the alpha value on the target display object, or the target's + * ancestors (parents). + * + * If set on a {{#crossLink "Container"}}{{/crossLink}}, children of the Container will not receive mouse events. + * This is similar to setting {{#crossLink "mouseChildren"}}{{/crossLink}} to false. + * + * Note that hitArea is NOT currently used by the `hitTest()` method, nor is it supported for {{#crossLink "Stage"}}{{/crossLink}}. + * @property hitArea + * @type {DisplayObject} + * @default null + */ + this.hitArea = null; + + /** + * A CSS cursor (ex. "pointer", "help", "text", etc) that will be displayed when the user hovers over this display + * object. You must enable mouseover events using the {{#crossLink "Stage/enableMouseOver"}}{{/crossLink}} method to + * use this property. Setting a non-null cursor on a Container will override the cursor set on its descendants. + * @property cursor + * @type {String} + * @default null + */ + this.cursor = null; + + + // private properties: + /** + * Moved to {{#crossLink "BitmapCache"}}{{/crossLink}} + * @property _cacheScale + * @protected + * @type {Number} + * @default 1 + * @deprecated + **/ + + /** + * Moved to {{#crossLink "BitmapCache"}}{{/crossLink}} + * @property _cacheDataURLID + * @protected + * @type {Number} + * @default 0 + * @deprecated + */ + + /** + * Moved to {{#crossLink "BitmapCache"}}{{/crossLink}} + * @property _cacheDataURL + * @protected + * @type {String} + * @default null + * @deprecated + */ + + /** + * @property _props + * @protected + * @type {DisplayObject} + * @default null + **/ + this._props = new createjs.DisplayProps(); + + /** + * @property _rectangle + * @protected + * @type {Rectangle} + * @default null + **/ + this._rectangle = new createjs.Rectangle(); + + /** + * @property _bounds + * @protected + * @type {Rectangle} + * @default null + **/ + this._bounds = null; + + /** + * Where StageGL should look for required display properties, matters only for leaf display objects. Containers + * or cached objects won't use this property, it's for native display of terminal elements. + * @property _webGLRenderStyle + * @protected + * @type {number} + * @default 0 + */ + this._webGLRenderStyle = DisplayObject._StageGL_NONE; + } + var p = createjs.extend(DisplayObject, createjs.EventDispatcher); + +// static properties: + /** + * Listing of mouse event names. Used in _hasMouseEventListener. + * @property _MOUSE_EVENTS + * @protected + * @static + * @type {Array} + **/ + DisplayObject._MOUSE_EVENTS = ["click","dblclick","mousedown","mouseout","mouseover","pressmove","pressup","rollout","rollover"]; + + /** + * Suppresses errors generated when using features like hitTest, mouse events, and {{#crossLink "getObjectsUnderPoint"}}{{/crossLink}} + * with cross domain content. + * @property suppressCrossDomainErrors + * @static + * @type {Boolean} + * @default false + **/ + DisplayObject.suppressCrossDomainErrors = false; + + /** + * @property _snapToPixelEnabled + * @protected + * @static + * @type {Boolean} + * @default false + **/ + DisplayObject._snapToPixelEnabled = false; // stage.snapToPixelEnabled is temporarily copied here during a draw to provide global access. + + /** + * Enum like property for determining StageGL render lookup, i.e. where to expect properties. + * @property _StageGL_NONE + * @protected + * @static + * @type {number} + */ + DisplayObject._StageGL_NONE = 0; + + /** + * Enum like property for determining StageGL render lookup, i.e. where to expect properties. + * @property _StageGL_SPRITE + * @protected + * @static + * @type {number} + */ + DisplayObject._StageGL_SPRITE = 1; + + /** + * Enum like property for determining StageGL render lookup, i.e. where to expect properties. + * @property _StageGL_BITMAP + * @protected + * @static + * @type {number} + */ + DisplayObject._StageGL_BITMAP = 2; + + /** + * @property _hitTestCanvas + * @type {HTMLCanvasElement | Object} + * @static + * @protected + **/ + /** + * @property _hitTestContext + * @type {CanvasRenderingContext2D} + * @static + * @protected + **/ + var canvas = createjs.createCanvas?createjs.createCanvas():document.createElement("canvas"); // prevent errors on load in browsers without canvas. + if (canvas.getContext) { + DisplayObject._hitTestCanvas = canvas; + DisplayObject._hitTestContext = canvas.getContext("2d"); + canvas.width = canvas.height = 1; + } + +// events: + /** + * Dispatched when the user presses their left mouse button over the display object. See the + * {{#crossLink "MouseEvent"}}{{/crossLink}} class for a listing of event properties. + * @event mousedown + * @since 0.6.0 + */ + + /** + * Dispatched when the user presses their left mouse button and then releases it while over the display object. + * See the {{#crossLink "MouseEvent"}}{{/crossLink}} class for a listing of event properties. + * @event click + * @since 0.6.0 + */ + + /** + * Dispatched when the user double clicks their left mouse button over this display object. + * See the {{#crossLink "MouseEvent"}}{{/crossLink}} class for a listing of event properties. + * @event dblclick + * @since 0.6.0 + */ + + /** + * Dispatched when the user's mouse enters this display object. This event must be enabled using + * {{#crossLink "Stage/enableMouseOver"}}{{/crossLink}}. See also {{#crossLink "DisplayObject/rollover:event"}}{{/crossLink}}. + * See the {{#crossLink "MouseEvent"}}{{/crossLink}} class for a listing of event properties. + * @event mouseover + * @since 0.6.0 + */ + + /** + * Dispatched when the user's mouse leaves this display object. This event must be enabled using + * {{#crossLink "Stage/enableMouseOver"}}{{/crossLink}}. See also {{#crossLink "DisplayObject/rollout:event"}}{{/crossLink}}. + * See the {{#crossLink "MouseEvent"}}{{/crossLink}} class for a listing of event properties. + * @event mouseout + * @since 0.6.0 + */ + + /** + * This event is similar to {{#crossLink "DisplayObject/mouseover:event"}}{{/crossLink}}, with the following + * differences: it does not bubble, and it considers {{#crossLink "Container"}}{{/crossLink}} instances as an + * aggregate of their content. + * + * For example, myContainer contains two overlapping children: shapeA and shapeB. The user moves their mouse over + * shapeA and then directly on to shapeB. With a listener for {{#crossLink "mouseover:event"}}{{/crossLink}} on + * myContainer, two events would be received, each targeting a child element:
    + *
  1. when the mouse enters shapeA (target=shapeA)
  2. + *
  3. when the mouse enters shapeB (target=shapeB)
  4. + *
+ * However, with a listener for "rollover" instead, only a single event is received when the mouse first enters + * the aggregate myContainer content (target=myContainer). + * + * This event must be enabled using {{#crossLink "Stage/enableMouseOver"}}{{/crossLink}}. + * See the {{#crossLink "MouseEvent"}}{{/crossLink}} class for a listing of event properties. + * @event rollover + * @since 0.7.0 + */ + + /** + * This event is similar to {{#crossLink "DisplayObject/mouseout:event"}}{{/crossLink}}, with the following + * differences: it does not bubble, and it considers {{#crossLink "Container"}}{{/crossLink}} instances as an + * aggregate of their content. + * + * For example, myContainer contains two overlapping children: shapeA and shapeB. The user moves their mouse over + * shapeA, then directly on to shapeB, then off both. With a listener for {{#crossLink "mouseout:event"}}{{/crossLink}} + * on myContainer, two events would be received, each targeting a child element:
    + *
  1. when the mouse leaves shapeA (target=shapeA)
  2. + *
  3. when the mouse leaves shapeB (target=shapeB)
  4. + *
+ * However, with a listener for "rollout" instead, only a single event is received when the mouse leaves + * the aggregate myContainer content (target=myContainer). + * + * This event must be enabled using {{#crossLink "Stage/enableMouseOver"}}{{/crossLink}}. + * See the {{#crossLink "MouseEvent"}}{{/crossLink}} class for a listing of event properties. + * @event rollout + * @since 0.7.0 + */ + + /** + * After a {{#crossLink "DisplayObject/mousedown:event"}}{{/crossLink}} occurs on a display object, a pressmove + * event will be generated on that object whenever the mouse moves until the mouse press is released. This can be + * useful for dragging and similar operations. + * + * **Please note** that if the initial mouse target from a `mousedown` event is removed from the stage after being pressed + * (e.g. during a `pressmove` event), a `pressmove` event is still generated. However since it is no longer in the + * display list, the event can not bubble. This means that previous ancestors (parent containers) will not receive + * the event, and therefore can not re-dispatch it. If you intend to listen for `{{#crossLink "DisplayObject/pressup:event"}}{{/crossLink}}` + * or `pressmove` on a dynamic object (such as a {{#crossLink "MovieClip"}}{{/crossLink}} or {{#crossLink "Container"}}{{/crossLink}}), + * then ensure you set {{#crossLink "Container/mouseChildren:property"}}{{/crossLink}} to `false`. + * @event pressmove + * @since 0.7.0 + */ + + /** + * After a {{#crossLink "DisplayObject/mousedown:event"}}{{/crossLink}} occurs on a display object, a pressup event + * will be generated on that object when that mouse press is released. This can be useful for dragging and similar + * operations. + * + * **Please note** that if the initial mouse target from a `mousedown` event is removed from the stage after being pressed + * (e.g. during a `pressmove` event), a `pressup` event is still generated. However since it is no longer in the + * display list, the event can not bubble. This means that previous ancestors (parent containers) will not receive + * the event, and therefore can not re-dispatch it. If you intend to listen for `{{#crossLink "DisplayObject/pressmove:event"}}{{/crossLink}}` + * or `pressup` on a dynamic object (such as a {{#crossLink "MovieClip"}}{{/crossLink}} or {{#crossLink "Container"}}{{/crossLink}}), + * then ensure you set {{#crossLink "Container/mouseChildren:property"}}{{/crossLink}} to `false`. + * @event pressup + * @since 0.7.0 + */ + + /** + * Dispatched when the display object is added to a parent container. + * @event added + */ + + /** + * Dispatched when the display object is removed from its parent container. + * @event removed + */ + + /** + * Dispatched on each display object on a stage whenever the stage updates. This occurs immediately before the + * rendering (draw) pass. When {{#crossLink "Stage/update"}}{{/crossLink}} is called, first all display objects on + * the stage dispatch the tick event, then all of the display objects are drawn to stage. Children will have their + * {{#crossLink "tick:event"}}{{/crossLink}} event dispatched in order of their depth prior to the event being + * dispatched on their parent. + * @event tick + * @param {Object} target The object that dispatched the event. + * @param {String} type The event type. + * @param {Array} params An array containing any arguments that were passed to the Stage.update() method. For + * example if you called stage.update("hello"), then the params would be ["hello"]. + * @since 0.6.0 + */ + + +// getter / setters: + /** + * Use the {{#crossLink "DisplayObject/stage:property"}}{{/crossLink}} property instead. + * @method _getStage + * @protected + * @return {Stage} + **/ + p._getStage = function() { + // uses dynamic access to avoid circular dependencies; + var o = this, _Stage = createjs["Stage"]; + while (o.parent) { o = o.parent; } + if (o instanceof _Stage) { return o; } + return null; + }; + // DisplayObject.getStage is @deprecated. Remove for 1.1+ + p.getStage = createjs.deprecate(p._getStage, "DisplayObject.getStage"); + + /** + * Returns the Stage instance that this display object will be rendered on, or null if it has not been added to one. + * @property stage + * @type {Stage} + * @readonly + **/ + + /** + * Returns an ID number that uniquely identifies the current cache for this display object. This can be used to + * determine if the cache has changed since a previous check. + * Moved to {{#crossLink "BitmapCache"}}{{/crossLink}} + * @property cacheID + * @deprecated + * @type {Number} + * @default 0 + */ + + /** + * Set both the {{#crossLink "DisplayObject/scaleX:property"}}{{/crossLink}} and the {{#crossLink "DisplayObject/scaleY"}}{{/crossLink}} + * property to the same value. Note that when you get the value, if the `scaleX` and `scaleY` are different values, + * it will return only the `scaleX`. + * @property scaleX + * @type {Number} + * @default 1 + */ + try { + Object.defineProperties(p, { + stage: { get: p._getStage }, + cacheID: { + get: function(){ return this.bitmapCache && this.bitmapCache.cacheID }, + set: function(a){ this.bitmapCache && (this.bitmapCache.cacheID = a) } + }, + scale: { + get: function() { return this.scaleX; }, + set: function(scale) { this.scaleX = this.scaleY = scale; }, + } + }); + } catch (e) {} + + +// public methods: + /** + * Returns true or false indicating whether the display object would be visible if drawn to a canvas. + * This does not account for whether it would be visible within the boundaries of the stage. + * + * NOTE: This method is mainly for internal use, though it may be useful for advanced uses. + * @method isVisible + * @return {Boolean} Boolean indicating whether the display object would be visible if drawn to a canvas + **/ + p.isVisible = function() { + return !!(this.visible && this.alpha > 0 && this.scaleX != 0 && this.scaleY != 0); + }; + + /** + * Draws the display object into the specified context ignoring its visible, alpha, shadow, and transform. + * Returns true if the draw was handled (useful for overriding functionality). + * + * NOTE: This method is mainly for internal use, though it may be useful for advanced uses. + * @method draw + * @param {CanvasRenderingContext2D} ctx The canvas 2D context object to draw into. + * @param {Boolean} [ignoreCache=false] Indicates whether the draw operation should ignore any current cache. For example, + * used for drawing the cache (to prevent it from simply drawing an existing cache back into itself). + * @return {Boolean} + **/ + p.draw = function(ctx, ignoreCache) { + var cache = this.bitmapCache; + if(cache && !ignoreCache) { + return cache.draw(ctx); + } + return false; + }; + + /** + * Applies this display object's transformation, alpha, globalCompositeOperation, clipping path (mask), and shadow + * to the specified context. This is typically called prior to {{#crossLink "DisplayObject/draw"}}{{/crossLink}}. + * @method updateContext + * @param {CanvasRenderingContext2D} ctx The canvas 2D to update. + **/ + p.updateContext = function(ctx) { + var o=this, mask=o.mask, mtx= o._props.matrix; + + if (mask && mask.graphics && !mask.graphics.isEmpty()) { + mask.getMatrix(mtx); + ctx.transform(mtx.a, mtx.b, mtx.c, mtx.d, mtx.tx, mtx.ty); + + mask.graphics.drawAsPath(ctx); + ctx.clip(); + + mtx.invert(); + ctx.transform(mtx.a, mtx.b, mtx.c, mtx.d, mtx.tx, mtx.ty); + } + + this.getMatrix(mtx); + var tx = mtx.tx, ty = mtx.ty; + if (DisplayObject._snapToPixelEnabled && o.snapToPixel) { + tx = tx + (tx < 0 ? -0.5 : 0.5) | 0; + ty = ty + (ty < 0 ? -0.5 : 0.5) | 0; + } + ctx.transform(mtx.a, mtx.b, mtx.c, mtx.d, tx, ty); + ctx.globalAlpha *= o.alpha; + if (o.compositeOperation) { ctx.globalCompositeOperation = o.compositeOperation; } + if (o.shadow) { this._applyShadow(ctx, o.shadow); } + }; + + /** + * Draws the display object into a new element, which is then used for subsequent draws. Intended for complex content + * that does not change frequently (ex. a Container with many children that do not move, or a complex vector Shape), + * this can provide for much faster rendering because the content does not need to be re-rendered each tick. The + * cached display object can be moved, rotated, faded, etc freely, however if its content changes, you must manually + * update the cache by calling updateCache() again. You must specify the cached area via the x, y, w, + * and h parameters. This defines the rectangle that will be rendered and cached using this display object's coordinates. + * + *

Example

+ * For example if you defined a Shape that drew a circle at 0, 0 with a radius of 25: + * + * var shape = new createjs.Shape(); + * shape.graphics.beginFill("#ff0000").drawCircle(0, 0, 25); + * shape.cache(-25, -25, 50, 50); + * + * Note that filters need to be defined before the cache is applied or you will have to call updateCache after + * application. Check out the {{#crossLink "Filter"}}{{/crossLink}} class for more information. Some filters + * (ex. BlurFilter) may not work as expected in conjunction with the scale param. + * + * Usually, the resulting cacheCanvas will have the dimensions width * scale, height * scale, however some filters (ex. BlurFilter) + * will add padding to the canvas dimensions. + * + * In previous versions caching was handled on DisplayObject but has since been moved to {{#crossLink "BitmapCache"}}{{/crossLink}}. + * This allows for easier interaction and alternate cache methods like WebGL with {{#crossLink "StageGL"}}{{/crossLink}}. + * For more information on the options object, see the BitmapCache {{#crossLink "BitmapCache/define"}}{{/crossLink}}. + * + * @method cache + * @param {Number} x The x coordinate origin for the cache region. + * @param {Number} y The y coordinate origin for the cache region. + * @param {Number} width The width of the cache region. + * @param {Number} height The height of the cache region. + * @param {Number} [scale=1] The scale at which the cache will be created. For example, if you cache a vector shape using + * myShape.cache(0,0,100,100,2) then the resulting cacheCanvas will be 200x200 px. This lets you scale and rotate + * cached elements with greater fidelity. Default is 1. + * @param {Object} [options=undefined] Specify additional parameters for the cache logic + **/ + p.cache = function(x, y, width, height, scale, options) { + if(!this.bitmapCache){ + this.bitmapCache = new createjs.BitmapCache(); + } + this.bitmapCache.define(this, x, y, width, height, scale, options); + }; + + /** + * Redraws the display object to its cache. Calling updateCache without an active cache will throw an error. + * If compositeOperation is null the current cache will be cleared prior to drawing. Otherwise the display object + * will be drawn over the existing cache using the specified compositeOperation. + * + *

Example

+ * Clear the current graphics of a cached shape, draw some new instructions, and then update the cache. The new line + * will be drawn on top of the old one. + * + * // Not shown: Creating the shape, and caching it. + * shapeInstance.clear(); + * shapeInstance.setStrokeStyle(3).beginStroke("#ff0000").moveTo(100, 100).lineTo(200,200); + * shapeInstance.updateCache(); + * + * In previous versions caching was handled on DisplayObject but has since been moved to {{#crossLink "BitmapCache"}}{{/crossLink}}. + * This allows for easier interaction and alternate cache methods like WebGL and {{#crossLink "StageGL"}}{{/crossLink}}. + * + * @method updateCache + * @param {String} compositeOperation The compositeOperation to use, or null to clear the cache and redraw it. + * + * whatwg spec on compositing. + **/ + p.updateCache = function(compositeOperation) { + if(!this.bitmapCache) { + throw "cache() must be called before updateCache()"; + } + this.bitmapCache.update(compositeOperation); + }; + + /** + * Clears the current cache. See {{#crossLink "DisplayObject/cache"}}{{/crossLink}} for more information. + * @method uncache + **/ + p.uncache = function() { + if(this.bitmapCache) { + this.bitmapCache.release(); + this.bitmapCache = undefined; + } + }; + + /** + * Returns a data URL for the cache, or null if this display object is not cached. + * Only generated if the cache has changed, otherwise returns last result. + * @method getCacheDataURL + * @return {String} The image data url for the cache. + **/ + p.getCacheDataURL = function() { + return this.bitmapCache?this.bitmapCache.getCacheDataURL():null; + }; + + /** + * Transforms the specified x and y position from the coordinate space of the display object + * to the global (stage) coordinate space. For example, this could be used to position an HTML label + * over a specific point on a nested display object. Returns a Point instance with x and y properties + * correlating to the transformed coordinates on the stage. + * + *

Example

+ * + * displayObject.x = 300; + * displayObject.y = 200; + * stage.addChild(displayObject); + * var point = displayObject.localToGlobal(100, 100); + * // Results in x=400, y=300 + * + * @method localToGlobal + * @param {Number} x The x position in the source display object to transform. + * @param {Number} y The y position in the source display object to transform. + * @param {Point | Object} [pt] An object to copy the result into. If omitted a new Point object with x/y properties will be returned. + * @return {Point} A Point instance with x and y properties correlating to the transformed coordinates + * on the stage. + **/ + p.localToGlobal = function(x, y, pt) { + return this.getConcatenatedMatrix(this._props.matrix).transformPoint(x,y, pt||new createjs.Point()); + }; + + /** + * Transforms the specified x and y position from the global (stage) coordinate space to the + * coordinate space of the display object. For example, this could be used to determine + * the current mouse position within the display object. Returns a Point instance with x and y properties + * correlating to the transformed position in the display object's coordinate space. + * + *

Example

+ * + * displayObject.x = 300; + * displayObject.y = 200; + * stage.addChild(displayObject); + * var point = displayObject.globalToLocal(100, 100); + * // Results in x=-200, y=-100 + * + * @method globalToLocal + * @param {Number} x The x position on the stage to transform. + * @param {Number} y The y position on the stage to transform. + * @param {Point | Object} [pt] An object to copy the result into. If omitted a new Point object with x/y properties will be returned. + * @return {Point} A Point instance with x and y properties correlating to the transformed position in the + * display object's coordinate space. + **/ + p.globalToLocal = function(x, y, pt) { + return this.getConcatenatedMatrix(this._props.matrix).invert().transformPoint(x,y, pt||new createjs.Point()); + }; + + /** + * Transforms the specified x and y position from the coordinate space of this display object to the coordinate + * space of the target display object. Returns a Point instance with x and y properties correlating to the + * transformed position in the target's coordinate space. Effectively the same as using the following code with + * {{#crossLink "DisplayObject/localToGlobal"}}{{/crossLink}} and {{#crossLink "DisplayObject/globalToLocal"}}{{/crossLink}}. + * + * var pt = this.localToGlobal(x, y); + * pt = target.globalToLocal(pt.x, pt.y); + * + * @method localToLocal + * @param {Number} x The x position in the source display object to transform. + * @param {Number} y The y position on the source display object to transform. + * @param {DisplayObject} target The target display object to which the coordinates will be transformed. + * @param {Point | Object} [pt] An object to copy the result into. If omitted a new Point object with x/y properties will be returned. + * @return {Point} Returns a Point instance with x and y properties correlating to the transformed position + * in the target's coordinate space. + **/ + p.localToLocal = function(x, y, target, pt) { + pt = this.localToGlobal(x, y, pt); + return target.globalToLocal(pt.x, pt.y, pt); + }; + + /** + * Shortcut method to quickly set the transform properties on the display object. All parameters are optional. + * Omitted parameters will have the default value set. + * + *

Example

+ * + * displayObject.setTransform(100, 100, 2, 2); + * + * @method setTransform + * @param {Number} [x=0] The horizontal translation (x position) in pixels + * @param {Number} [y=0] The vertical translation (y position) in pixels + * @param {Number} [scaleX=1] The horizontal scale, as a percentage of 1 + * @param {Number} [scaleY=1] the vertical scale, as a percentage of 1 + * @param {Number} [rotation=0] The rotation, in degrees + * @param {Number} [skewX=0] The horizontal skew factor + * @param {Number} [skewY=0] The vertical skew factor + * @param {Number} [regX=0] The horizontal registration point in pixels + * @param {Number} [regY=0] The vertical registration point in pixels + * @return {DisplayObject} Returns this instance. Useful for chaining commands. + * @chainable + */ + p.setTransform = function(x, y, scaleX, scaleY, rotation, skewX, skewY, regX, regY) { + this.x = x || 0; + this.y = y || 0; + this.scaleX = scaleX == null ? 1 : scaleX; + this.scaleY = scaleY == null ? 1 : scaleY; + this.rotation = rotation || 0; + this.skewX = skewX || 0; + this.skewY = skewY || 0; + this.regX = regX || 0; + this.regY = regY || 0; + return this; + }; + + /** + * Returns a matrix based on this object's current transform. + * @method getMatrix + * @param {Matrix2D} matrix Optional. A Matrix2D object to populate with the calculated values. If null, a new + * Matrix object is returned. + * @return {Matrix2D} A matrix representing this display object's transform. + **/ + p.getMatrix = function(matrix) { + var o = this, mtx = matrix&&matrix.identity() || new createjs.Matrix2D(); + return o.transformMatrix ? mtx.copy(o.transformMatrix) : mtx.appendTransform(o.x, o.y, o.scaleX, o.scaleY, o.rotation, o.skewX, o.skewY, o.regX, o.regY); + }; + + /** + * Generates a Matrix2D object representing the combined transform of the display object and all of its + * parent Containers up to the highest level ancestor (usually the {{#crossLink "Stage"}}{{/crossLink}}). This can + * be used to transform positions between coordinate spaces, such as with {{#crossLink "DisplayObject/localToGlobal"}}{{/crossLink}} + * and {{#crossLink "DisplayObject/globalToLocal"}}{{/crossLink}}. + * @method getConcatenatedMatrix + * @param {Matrix2D} [matrix] A {{#crossLink "Matrix2D"}}{{/crossLink}} object to populate with the calculated values. + * If null, a new Matrix2D object is returned. + * @return {Matrix2D} The combined matrix. + **/ + p.getConcatenatedMatrix = function(matrix) { + var o = this, mtx = this.getMatrix(matrix); + while (o = o.parent) { + mtx.prependMatrix(o.getMatrix(o._props.matrix)); + } + return mtx; + }; + + /** + * Generates a DisplayProps object representing the combined display properties of the object and all of its + * parent Containers up to the highest level ancestor (usually the {{#crossLink "Stage"}}{{/crossLink}}). + * @method getConcatenatedDisplayProps + * @param {DisplayProps} [props] A {{#crossLink "DisplayProps"}}{{/crossLink}} object to populate with the calculated values. + * If null, a new DisplayProps object is returned. + * @return {DisplayProps} The combined display properties. + **/ + p.getConcatenatedDisplayProps = function(props) { + props = props ? props.identity() : new createjs.DisplayProps(); + var o = this, mtx = o.getMatrix(props.matrix); + do { + props.prepend(o.visible, o.alpha, o.shadow, o.compositeOperation); + + // we do this to avoid problems with the matrix being used for both operations when o._props.matrix is passed in as the props param. + // this could be simplified (ie. just done as part of the prepend above) if we switched to using a pool. + if (o != this) { mtx.prependMatrix(o.getMatrix(o._props.matrix)); } + } while (o = o.parent); + return props; + }; + + /** + * Tests whether the display object intersects the specified point in local coordinates (ie. draws a pixel with alpha > 0 at + * the specified position). This ignores the alpha, shadow, hitArea, mask, and compositeOperation of the display object. + * + *

Example

+ * + * stage.addEventListener("stagemousedown", handleMouseDown); + * function handleMouseDown(event) { + * var hit = myShape.hitTest(event.stageX, event.stageY); + * } + * + * Please note that shape-to-shape collision is not currently supported by EaselJS. + * @method hitTest + * @param {Number} x The x position to check in the display object's local coordinates. + * @param {Number} y The y position to check in the display object's local coordinates. + * @return {Boolean} A Boolean indicating whether a visible portion of the DisplayObject intersect the specified + * local Point. + */ + p.hitTest = function(x, y) { + var ctx = DisplayObject._hitTestContext; + ctx.setTransform(1, 0, 0, 1, -x, -y); + this.draw(ctx); + + var hit = this._testHit(ctx); + ctx.setTransform(1, 0, 0, 1, 0, 0); + ctx.clearRect(0, 0, 2, 2); + return hit; + }; + + /** + * Provides a chainable shortcut method for setting a number of properties on the instance. + * + *

Example

+ * + * var myGraphics = new createjs.Graphics().beginFill("#ff0000").drawCircle(0, 0, 25); + * var shape = stage.addChild(new Shape()).set({graphics:myGraphics, x:100, y:100, alpha:0.5}); + * + * @method set + * @param {Object} props A generic object containing properties to copy to the DisplayObject instance. + * @return {DisplayObject} Returns the instance the method is called on (useful for chaining calls.) + * @chainable + */ + p.set = function(props) { + for (var n in props) { this[n] = props[n]; } + return this; + }; + + /** + * Returns a rectangle representing this object's bounds in its local coordinate system (ie. with no transformation). + * Objects that have been cached will return the bounds of the cache. + * + * Not all display objects can calculate their own bounds (ex. Shape). For these objects, you can use + * {{#crossLink "DisplayObject/setBounds"}}{{/crossLink}} so that they are included when calculating Container + * bounds. + * + * + * + * + * + * + * + * + * + *
All + * All display objects support setting bounds manually using setBounds(). Likewise, display objects that + * have been cached using cache() will return the bounds of their cache. Manual and cache bounds will override + * the automatic calculations listed below. + *
Bitmap + * Returns the width and height of the sourceRect (if specified) or image, extending from (x=0,y=0). + *
Sprite + * Returns the bounds of the current frame. May have non-zero x/y if a frame registration point was specified + * in the spritesheet data. See also {{#crossLink "SpriteSheet/getFrameBounds"}}{{/crossLink}} + *
Container + * Returns the aggregate (combined) bounds of all children that return a non-null value from getBounds(). + *
Shape + * Does not currently support automatic bounds calculations. Use setBounds() to manually define bounds. + *
Text + * Returns approximate bounds. Horizontal values (x/width) are quite accurate, but vertical values (y/height) are + * not, especially when using textBaseline values other than "top". + *
BitmapText + * Returns approximate bounds. Values will be more accurate if spritesheet frame registration points are close + * to (x=0,y=0). + *
+ * + * Bounds can be expensive to calculate for some objects (ex. text, or containers with many children), and + * are recalculated each time you call getBounds(). You can prevent recalculation on static objects by setting the + * bounds explicitly: + * + * var bounds = obj.getBounds(); + * obj.setBounds(bounds.x, bounds.y, bounds.width, bounds.height); + * // getBounds will now use the set values, instead of recalculating + * + * To reduce memory impact, the returned Rectangle instance may be reused internally; clone the instance or copy its + * values if you need to retain it. + * + * var myBounds = obj.getBounds().clone(); + * // OR: + * myRect.copy(obj.getBounds()); + * + * @method getBounds + * @return {Rectangle} A Rectangle instance representing the bounds, or null if bounds are not available for this + * object. + **/ + p.getBounds = function() { + if (this._bounds) { return this._rectangle.copy(this._bounds); } + var cacheCanvas = this.cacheCanvas; + if (cacheCanvas) { + var scale = this._cacheScale; + return this._rectangle.setValues(this._cacheOffsetX, this._cacheOffsetY, cacheCanvas.width/scale, cacheCanvas.height/scale); + } + return null; + }; + + /** + * Returns a rectangle representing this object's bounds in its parent's coordinate system (ie. with transformations applied). + * Objects that have been cached will return the transformed bounds of the cache. + * + * Not all display objects can calculate their own bounds (ex. Shape). For these objects, you can use + * {{#crossLink "DisplayObject/setBounds"}}{{/crossLink}} so that they are included when calculating Container + * bounds. + * + * To reduce memory impact, the returned Rectangle instance may be reused internally; clone the instance or copy its + * values if you need to retain it. + * + * Container instances calculate aggregate bounds for all children that return bounds via getBounds. + * @method getTransformedBounds + * @return {Rectangle} A Rectangle instance representing the bounds, or null if bounds are not available for this object. + **/ + p.getTransformedBounds = function() { + return this._getBounds(); + }; + + /** + * Allows you to manually specify the bounds of an object that either cannot calculate their own bounds (ex. Shape & + * Text) for future reference, or so the object can be included in Container bounds. Manually set bounds will always + * override calculated bounds. + * + * The bounds should be specified in the object's local (untransformed) coordinates. For example, a Shape instance + * with a 25px radius circle centered at 0,0 would have bounds of (-25, -25, 50, 50). + * @method setBounds + * @param {Number} x The x origin of the bounds. Pass null to remove the manual bounds. + * @param {Number} y The y origin of the bounds. + * @param {Number} width The width of the bounds. + * @param {Number} height The height of the bounds. + **/ + p.setBounds = function(x, y, width, height) { + if (x == null) { this._bounds = x; return; } + this._bounds = (this._bounds || new createjs.Rectangle()).setValues(x, y, width, height); + }; + + /** + * Returns a clone of this DisplayObject. Some properties that are specific to this instance's current context are + * reverted to their defaults (for example .parent). Caches are not maintained across clones, and some elements + * are copied by reference (masks, individual filter instances, hit area) + * @method clone + * @return {DisplayObject} A clone of the current DisplayObject instance. + **/ + p.clone = function() { + return this._cloneProps(new DisplayObject()); + }; + + /** + * Returns a string representation of this object. + * @method toString + * @return {String} a string representation of the instance. + **/ + p.toString = function() { + return "[DisplayObject (name="+ this.name +")]"; + }; + + +// private methods: + /** + * Called before the object gets drawn and is a chance to ensure the display state of the object is correct. + * Mostly used by {{#crossLink "MovieClip"}}{{/crossLink}} and {{#crossLink "BitmapText"}}{{/crossLink}} to + * correct their internal state and children prior to being drawn. + * + * Is manually called via draw in a {{#crossLink "Stage"}}{{/crossLink}} but is automatically called when + * present in a {{#crossLink "StageGL"}}{{/crossLink}} instance. + * + * @method _updateState + * @default null + */ + p._updateState = null; + + // separated so it can be used more easily in subclasses: + /** + * @method _cloneProps + * @param {DisplayObject} o The DisplayObject instance which will have properties from the current DisplayObject + * instance copied into. + * @return {DisplayObject} o + * @protected + **/ + p._cloneProps = function(o) { + o.alpha = this.alpha; + o.mouseEnabled = this.mouseEnabled; + o.tickEnabled = this.tickEnabled; + o.name = this.name; + o.regX = this.regX; + o.regY = this.regY; + o.rotation = this.rotation; + o.scaleX = this.scaleX; + o.scaleY = this.scaleY; + o.shadow = this.shadow; + o.skewX = this.skewX; + o.skewY = this.skewY; + o.visible = this.visible; + o.x = this.x; + o.y = this.y; + o.compositeOperation = this.compositeOperation; + o.snapToPixel = this.snapToPixel; + o.filters = this.filters==null?null:this.filters.slice(0); + o.mask = this.mask; + o.hitArea = this.hitArea; + o.cursor = this.cursor; + o._bounds = this._bounds; + return o; + }; + + /** + * @method _applyShadow + * @protected + * @param {CanvasRenderingContext2D} ctx + * @param {Shadow} shadow + **/ + p._applyShadow = function(ctx, shadow) { + shadow = shadow || Shadow.identity; + ctx.shadowColor = shadow.color; + ctx.shadowOffsetX = shadow.offsetX; + ctx.shadowOffsetY = shadow.offsetY; + ctx.shadowBlur = shadow.blur; + }; + + /** + * @method _tick + * @param {Object} evtObj An event object that will be dispatched to all tick listeners. This object is reused between dispatchers to reduce construction & GC costs. + * @protected + **/ + p._tick = function(evtObj) { + // because tick can be really performance sensitive, check for listeners before calling dispatchEvent. + var ls = this._listeners; + if (ls && ls["tick"]) { + // reset & reuse the event object to avoid construction / GC costs: + evtObj.target = null; + evtObj.propagationStopped = evtObj.immediatePropagationStopped = false; + this.dispatchEvent(evtObj); + } + }; + + /** + * @method _testHit + * @protected + * @param {CanvasRenderingContext2D} ctx + * @return {Boolean} + **/ + p._testHit = function(ctx) { + try { + var hit = ctx.getImageData(0, 0, 1, 1).data[3] > 1; + } catch (e) { + if (!DisplayObject.suppressCrossDomainErrors) { + throw "An error has occurred. This is most likely due to security restrictions on reading canvas pixel data with local or cross-domain images."; + } + } + return hit; + }; + + /** + * @method _getBounds + * @param {Matrix2D} matrix + * @param {Boolean} ignoreTransform If true, does not apply this object's transform. + * @return {Rectangle} + * @protected + **/ + p._getBounds = function(matrix, ignoreTransform){ + return this._transformBounds(this.getBounds(), matrix, ignoreTransform); + }; + + /** + * @method _transformBounds + * @param {Rectangle} bounds + * @param {Matrix2D} matrix + * @param {Boolean} ignoreTransform + * @return {Rectangle} + * @protected + **/ + p._transformBounds = function(bounds, matrix, ignoreTransform) { + if (!bounds) { return bounds; } + var x = bounds.x, y = bounds.y, width = bounds.width, height = bounds.height, mtx = this._props.matrix; + mtx = ignoreTransform ? mtx.identity() : this.getMatrix(mtx); + + if (x || y) { mtx.appendTransform(0,0,1,1,0,0,0,-x,-y); } // TODO: simplify this. + if (matrix) { mtx.prependMatrix(matrix); } + + var x_a = width*mtx.a, x_b = width*mtx.b; + var y_c = height*mtx.c, y_d = height*mtx.d; + var tx = mtx.tx, ty = mtx.ty; + + var minX = tx, maxX = tx, minY = ty, maxY = ty; + + if ((x = x_a + tx) < minX) { minX = x; } else if (x > maxX) { maxX = x; } + if ((x = x_a + y_c + tx) < minX) { minX = x; } else if (x > maxX) { maxX = x; } + if ((x = y_c + tx) < minX) { minX = x; } else if (x > maxX) { maxX = x; } + + if ((y = x_b + ty) < minY) { minY = y; } else if (y > maxY) { maxY = y; } + if ((y = x_b + y_d + ty) < minY) { minY = y; } else if (y > maxY) { maxY = y; } + if ((y = y_d + ty) < minY) { minY = y; } else if (y > maxY) { maxY = y; } + + return bounds.setValues(minX, minY, maxX-minX, maxY-minY); + }; + + /** + * Indicates whether the display object has any mouse event listeners or a cursor. + * @method _isMouseOpaque + * @return {Boolean} + * @protected + **/ + p._hasMouseEventListener = function() { + var evts = DisplayObject._MOUSE_EVENTS; + for (var i= 0, l=evts.length; itransform and alpha properties concatenated with their parent + * Container. + * + * For example, a {{#crossLink "Shape"}}{{/crossLink}} with x=100 and alpha=0.5, placed in a Container with x=50 + * and alpha=0.7 will be rendered to the canvas at x=150 and alpha=0.35. + * Containers have some overhead, so you generally shouldn't create a Container to hold a single child. + * + *

Example

+ * + * var container = new createjs.Container(); + * container.addChild(bitmapInstance, shapeInstance); + * container.x = 100; + * + * @class Container + * @extends DisplayObject + * @constructor + **/ + function Container() { + this.DisplayObject_constructor(); + + // public properties: + /** + * The array of children in the display list. You should usually use the child management methods such as + * {{#crossLink "Container/addChild"}}{{/crossLink}}, {{#crossLink "Container/removeChild"}}{{/crossLink}}, + * {{#crossLink "Container/swapChildren"}}{{/crossLink}}, etc, rather than accessing this directly, but it is + * included for advanced uses. + * @property children + * @type Array + * @default null + **/ + this.children = []; + + /** + * Indicates whether the children of this container are independently enabled for mouse/pointer interaction. + * If false, the children will be aggregated under the container - for example, a click on a child shape would + * trigger a click event on the container. + * @property mouseChildren + * @type Boolean + * @default true + **/ + this.mouseChildren = true; + + /** + * If false, the tick will not be propagated to children of this Container. This can provide some performance benefits. + * In addition to preventing the "tick" event from being dispatched, it will also prevent tick related updates + * on some display objects (ex. Sprite & MovieClip frame advancing, DOMElement visibility handling). + * @property tickChildren + * @type Boolean + * @default true + **/ + this.tickChildren = true; + } + var p = createjs.extend(Container, createjs.DisplayObject); + + +// getter / setters: + /** + * Use the {{#crossLink "Container/numChildren:property"}}{{/crossLink}} property instead. + * @method _getNumChildren + * @protected + * @return {Number} + **/ + p._getNumChildren = function() { + return this.children.length; + }; + // Container.getNumChildren is @deprecated. Remove for 1.1+ + p.getNumChildren = createjs.deprecate(p._getNumChildren, "Container.getNumChildren"); + + /** + * Returns the number of children in the container. + * @property numChildren + * @type {Number} + * @readonly + **/ + try { + Object.defineProperties(p, { + numChildren: { get: p._getNumChildren } + }); + } catch (e) {} + + +// public methods: + /** + * Constructor alias for backwards compatibility. This method will be removed in future versions. + * Subclasses should be updated to use {{#crossLink "Utility Methods/extends"}}{{/crossLink}}. + * @method initialize + * @deprecated in favour of `createjs.promote()` + **/ + p.initialize = Container; // TODO: deprecated. + + /** + * Returns true or false indicating whether the display object would be visible if drawn to a canvas. + * This does not account for whether it would be visible within the boundaries of the stage. + * + * NOTE: This method is mainly for internal use, though it may be useful for advanced uses. + * @method isVisible + * @return {Boolean} Boolean indicating whether the display object would be visible if drawn to a canvas + **/ + p.isVisible = function() { + var hasContent = this.cacheCanvas || this.children.length; + return !!(this.visible && this.alpha > 0 && this.scaleX != 0 && this.scaleY != 0 && hasContent); + }; + + /** + * Draws the display object into the specified context ignoring its visible, alpha, shadow, and transform. + * Returns true if the draw was handled (useful for overriding functionality). + * + * NOTE: This method is mainly for internal use, though it may be useful for advanced uses. + * @method draw + * @param {CanvasRenderingContext2D} ctx The canvas 2D context object to draw into. + * @param {Boolean} [ignoreCache=false] Indicates whether the draw operation should ignore any current cache. + * For example, used for drawing the cache (to prevent it from simply drawing an existing cache back + * into itself). + **/ + p.draw = function(ctx, ignoreCache) { + if (this.DisplayObject_draw(ctx, ignoreCache)) { return true; } + + // this ensures we don't have issues with display list changes that occur during a draw: + var list = this.children.slice(); + for (var i=0,l=list.length; iExample + * + * container.addChild(bitmapInstance); + * + * You can also add multiple children at once: + * + * container.addChild(bitmapInstance, shapeInstance, textInstance); + * + * @method addChild + * @param {DisplayObject} child The display object to add. + * @return {DisplayObject} The child that was added, or the last child if multiple children were added. + **/ + p.addChild = function(child) { + if (child == null) { return child; } + var l = arguments.length; + if (l > 1) { + for (var i=0; iExample + * + * addChildAt(child1, index); + * + * You can also add multiple children, such as: + * + * addChildAt(child1, child2, ..., index); + * + * The index must be between 0 and numChildren. For example, to add myShape under otherShape in the display list, + * you could use: + * + * container.addChildAt(myShape, container.getChildIndex(otherShape)); + * + * This would also bump otherShape's index up by one. Fails silently if the index is out of range. + * + * @method addChildAt + * @param {DisplayObject} child The display object to add. + * @param {Number} index The index to add the child at. + * @return {DisplayObject} Returns the last child that was added, or the last child if multiple children were added. + **/ + p.addChildAt = function(child, index) { + var l = arguments.length; + var indx = arguments[l-1]; // can't use the same name as the index param or it replaces arguments[1] + if (indx < 0 || indx > this.children.length) { return arguments[l-2]; } + if (l > 2) { + for (var i=0; iExample + * + * container.removeChild(child); + * + * You can also remove multiple children: + * + * removeChild(child1, child2, ...); + * + * Returns true if the child (or children) was removed, or false if it was not in the display list. + * @method removeChild + * @param {DisplayObject} child The child to remove. + * @return {Boolean} true if the child (or children) was removed, or false if it was not in the display list. + **/ + p.removeChild = function(child) { + var l = arguments.length; + if (l > 1) { + var good = true; + for (var i=0; iExample + * + * container.removeChildAt(2); + * + * You can also remove multiple children: + * + * container.removeChild(2, 7, ...) + * + * Returns true if the child (or children) was removed, or false if any index was out of range. + * @method removeChildAt + * @param {Number} index The index of the child to remove. + * @return {Boolean} true if the child (or children) was removed, or false if any index was out of range. + **/ + p.removeChildAt = function(index) { + var l = arguments.length; + if (l > 1) { + var a = []; + for (var i=0; iExample + * + * container.removeAllChildren(); + * + * @method removeAllChildren + **/ + p.removeAllChildren = function() { + var kids = this.children; + while (kids.length) { this._removeChildAt(0); } + }; + + /** + * Returns the child at the specified index. + * + *

Example

+ * + * container.getChildAt(2); + * + * @method getChildAt + * @param {Number} index The index of the child to return. + * @return {DisplayObject} The child at the specified index. Returns null if there is no child at the index. + **/ + p.getChildAt = function(index) { + return this.children[index]; + }; + + /** + * Returns the child with the specified name. + * @method getChildByName + * @param {String} name The name of the child to return. + * @return {DisplayObject} The child with the specified name. + **/ + p.getChildByName = function(name) { + var kids = this.children; + for (var i=0,l=kids.length;iExample: Display children with a higher y in front. + * + * var sortFunction = function(obj1, obj2, options) { + * if (obj1.y > obj2.y) { return 1; } + * if (obj1.y < obj2.y) { return -1; } + * return 0; + * } + * container.sortChildren(sortFunction); + * + * @method sortChildren + * @param {Function} sortFunction the function to use to sort the child list. See JavaScript's Array.sort + * documentation for details. + **/ + p.sortChildren = function(sortFunction) { + this.children.sort(sortFunction); + }; + + /** + * Returns the index of the specified child in the display list, or -1 if it is not in the display list. + * + *

Example

+ * + * var index = container.getChildIndex(child); + * + * @method getChildIndex + * @param {DisplayObject} child The child to return the index of. + * @return {Number} The index of the specified child. -1 if the child is not found. + **/ + p.getChildIndex = function(child) { + return createjs.indexOf(this.children, child); + }; + + /** + * Swaps the children at the specified indexes. Fails silently if either index is out of range. + * @method swapChildrenAt + * @param {Number} index1 + * @param {Number} index2 + **/ + p.swapChildrenAt = function(index1, index2) { + var kids = this.children; + var o1 = kids[index1]; + var o2 = kids[index2]; + if (!o1 || !o2) { return; } + kids[index1] = o2; + kids[index2] = o1; + }; + + /** + * Swaps the specified children's depth in the display list. Fails silently if either child is not a child of this + * Container. + * @method swapChildren + * @param {DisplayObject} child1 + * @param {DisplayObject} child2 + **/ + p.swapChildren = function(child1, child2) { + var kids = this.children; + var index1,index2; + for (var i=0,l=kids.length;i= l) { return; } + for (var i=0;i 0 at the + * specified position). This ignores the alpha, shadow and compositeOperation of the display object, and all + * transform properties including regX/Y. + * @method hitTest + * @param {Number} x The x position to check in the display object's local coordinates. + * @param {Number} y The y position to check in the display object's local coordinates. + * @return {Boolean} A Boolean indicating whether there is a visible section of a DisplayObject that overlaps the specified + * coordinates. + **/ + p.hitTest = function(x, y) { + // TODO: optimize to use the fast cache check where possible. + return (this.getObjectUnderPoint(x, y) != null); + }; - ctx.moveTo(x, ym); - ctx.bezierCurveTo(x, ym-oy, xm-ox, y, xm, y); - ctx.bezierCurveTo(xm+ox, y, xe, ym-oy, xe, ym); - ctx.bezierCurveTo(xe, ym+oy, xm+ox, ye, xm, ye); - ctx.bezierCurveTo(xm-ox, ye, x, ym+oy, x, ym); + /** + * Returns an array of all display objects under the specified coordinates that are in this container's display + * list. This routine ignores any display objects with {{#crossLink "DisplayObject/mouseEnabled:property"}}{{/crossLink}} + * set to `false`. The array will be sorted in order of visual depth, with the top-most display object at index 0. + * This uses shape based hit detection, and can be an expensive operation to run, so it is best to use it carefully. + * For example, if testing for objects under the mouse, test on tick (instead of on {{#crossLink "DisplayObject/mousemove:event"}}{{/crossLink}}), + * and only if the mouse's position has changed. + * + *
    + *
  • By default (mode=0) this method evaluates all display objects.
  • + *
  • By setting the `mode` parameter to `1`, the {{#crossLink "DisplayObject/mouseEnabled:property"}}{{/crossLink}} + * and {{#crossLink "mouseChildren:property"}}{{/crossLink}} properties will be respected.
  • + *
  • Setting the `mode` to `2` additionally excludes display objects that do not have active mouse event + * listeners or a {{#crossLink "DisplayObject:cursor:property"}}{{/crossLink}} property. That is, only objects + * that would normally intercept mouse interaction will be included. This can significantly improve performance + * in some cases by reducing the number of display objects that need to be tested.
  • + * + * + * This method accounts for both {{#crossLink "DisplayObject/hitArea:property"}}{{/crossLink}} and {{#crossLink "DisplayObject/mask:property"}}{{/crossLink}}. + * @method getObjectsUnderPoint + * @param {Number} x The x position in the container to test. + * @param {Number} y The y position in the container to test. + * @param {Number} [mode=0] The mode to use to determine which display objects to include. 0-all, 1-respect mouseEnabled/mouseChildren, 2-only mouse opaque objects. + * @return {Array} An Array of DisplayObjects under the specified coordinates. + **/ + p.getObjectsUnderPoint = function(x, y, mode) { + var arr = []; + var pt = this.localToGlobal(x, y); + this._getObjectsUnderPoint(pt.x, pt.y, arr, mode>0, mode==1); + return arr; }; /** - * Graphics command object. See {{#crossLink "Graphics/drawPolyStar"}}{{/crossLink}} and {{#crossLink "Graphics/append"}}{{/crossLink}} for more information. - * @class PolyStar - * @constructor - * @param {Number} x - * @param {Number} y - * @param {Number} radius - * @param {Number} sides - * @param {Number} pointSize - * @param {Number} angle + * Similar to {{#crossLink "Container/getObjectsUnderPoint"}}{{/crossLink}}, but returns only the top-most display + * object. This runs significantly faster than getObjectsUnderPoint(), but is still potentially an expensive + * operation. See {{#crossLink "Container/getObjectsUnderPoint"}}{{/crossLink}} for more information. + * @method getObjectUnderPoint + * @param {Number} x The x position in the container to test. + * @param {Number} y The y position in the container to test. + * @param {Number} mode The mode to use to determine which display objects to include. 0-all, 1-respect mouseEnabled/mouseChildren, 2-only mouse opaque objects. + * @return {DisplayObject} The top-most display object under the specified coordinates. **/ + p.getObjectUnderPoint = function(x, y, mode) { + var pt = this.localToGlobal(x, y); + return this._getObjectsUnderPoint(pt.x, pt.y, null, mode>0, mode==1); + }; + /** - * @property x - * @type Number + * Docced in superclass. */ + p.getBounds = function() { + return this._getBounds(null, true); + }; + + /** - * @property y - * @type Number + * Docced in superclass. */ + p.getTransformedBounds = function() { + return this._getBounds(); + }; + /** - * @property radius - * @type Number - */ + * Returns a clone of this Container. Some properties that are specific to this instance's current context are + * reverted to their defaults (for example .parent). + * @method clone + * @param {Boolean} [recursive=false] If true, all of the descendants of this container will be cloned recursively. If false, the + * properties of the container will be cloned, but the new instance will not have any children. + * @return {Container} A clone of the current Container instance. + **/ + p.clone = function(recursive) { + var o = this._cloneProps(new Container()); + if (recursive) { this._cloneChildren(o); } + return o; + }; + /** - * @property sides - * @type Number - */ + * Returns a string representation of this object. + * @method toString + * @return {String} a string representation of the instance. + **/ + p.toString = function() { + return "[Container (name="+ this.name +")]"; + }; + + +// private methods: /** - * @property pointSize - * @type Number - */ + * @method _tick + * @param {Object} evtObj An event object that will be dispatched to all tick listeners. This object is reused between dispatchers to reduce construction & GC costs. + * @protected + **/ + p._tick = function(evtObj) { + if (this.tickChildren) { + for (var i=this.children.length-1; i>=0; i--) { + var child = this.children[i]; + if (child.tickEnabled && child._tick) { child._tick(evtObj); } + } + } + this.DisplayObject__tick(evtObj); + }; + /** - * @property angle - * @type Number - */ + * Recursively clones all children of this container, and adds them to the target container. + * @method cloneChildren + * @protected + * @param {Container} o The target container. + **/ + p._cloneChildren = function(o) { + if (o.children.length) { o.removeAllChildren(); } + var arr = o.children; + for (var i=0, l=this.children.length; i this.children.length-1) { return false; } + var child = this.children[index]; + if (child) { child.parent = null; } + this.children.splice(index, 1); + if (!silent) { child.dispatchEvent("removed"); } + return true; + }; - ctx.moveTo(x+Math.cos(angle)*radius, y+Math.sin(angle)*radius); - for (var i=0; i=0; i--) { + var child = children[i]; + var hitArea = child.hitArea; + if (!child.visible || (!hitArea && !child.isVisible()) || (mouse && !child.mouseEnabled)) { continue; } + if (!hitArea && !this._testMask(child, x, y)) { continue; } + + // if a child container has a hitArea then we only need to check its hitAre2a, so we can treat it as a normal DO: + if (!hitArea && child instanceof Container) { + var result = child._getObjectsUnderPoint(x, y, arr, mouse, activeListener, currentDepth+1); + if (!arr && result) { return (mouse && !this.mouseChildren) ? this : result; } + } else { + if (mouse && !activeListener && !child._hasMouseEventListener()) { continue; } + + // TODO: can we pass displayProps forward, to avoid having to calculate this backwards every time? It's kind of a mixed bag. When we're only hunting for DOs with event listeners, it may not make sense. + var props = child.getConcatenatedDisplayProps(child._props); + mtx = props.matrix; + + if (hitArea) { + mtx.appendMatrix(hitArea.getMatrix(hitArea._props.matrix)); + props.alpha = hitArea.alpha; + } + + ctx.globalAlpha = props.alpha; + ctx.setTransform(mtx.a, mtx.b, mtx.c, mtx.d, mtx.tx-x, mtx.ty-y); + (hitArea||child).draw(ctx); + if (!this._testHit(ctx)) { continue; } + ctx.setTransform(1, 0, 0, 1, 0, 0); + ctx.clearRect(0, 0, 2, 2); + if (arr) { arr.push(child); } + else { return (mouse && !this.mouseChildren) ? this : child; } } - angle += a; - ctx.lineTo(x+Math.cos(angle)*radius, y+Math.sin(angle)*radius); } - ctx.closePath(); + return null; + }; + + /** + * @method _testMask + * @param {DisplayObject} target + * @param {Number} x + * @param {Number} y + * @return {Boolean} Indicates whether the x/y is within the masked region. + * @protected + **/ + p._testMask = function(target, x, y) { + var mask = target.mask; + if (!mask || !mask.graphics || mask.graphics.isEmpty()) { return true; } + + var mtx = this._props.matrix, parent = target.parent; + mtx = parent ? parent.getConcatenatedMatrix(mtx) : mtx.identity(); + mtx = mask.getMatrix(mask._props.matrix).prependMatrix(mtx); + + var ctx = createjs.DisplayObject._hitTestContext; + ctx.setTransform(mtx.a, mtx.b, mtx.c, mtx.d, mtx.tx-x, mtx.ty-y); + + // draw the mask as a solid fill: + mask.graphics.drawAsPath(ctx); + ctx.fillStyle = "#000"; + ctx.fill(); + + if (!this._testHit(ctx)) { return false; } + ctx.setTransform(1, 0, 0, 1, 0, 0); + ctx.clearRect(0, 0, 2, 2); + + return true; + }; + + /** + * @method _getBounds + * @param {Matrix2D} matrix + * @param {Boolean} ignoreTransform If true, does not apply this object's transform. + * @return {Rectangle} + * @protected + **/ + p._getBounds = function(matrix, ignoreTransform) { + var bounds = this.DisplayObject_getBounds(); + if (bounds) { return this._transformBounds(bounds, matrix, ignoreTransform); } + + var mtx = this._props.matrix; + mtx = ignoreTransform ? mtx.identity() : this.getMatrix(mtx); + if (matrix) { mtx.prependMatrix(matrix); } + + var l = this.children.length, rect=null; + for (var i=0; iNote: In EaselJS 0.7.0, the mouseEnabled property will not work properly with nested Containers. Please - * check out the latest NEXT version in GitHub for an updated version with this issue resolved. The fix will be - * provided in the next release of EaselJS. - * @property mouseEnabled - * @type {Boolean} - * @default true - **/ - this.mouseEnabled = true; - - /** - * If false, the tick will not run on this display object (or its children). This can provide some performance benefits. - * In addition to preventing the "tick" event from being dispatched, it will also prevent tick related updates - * on some display objects (ex. Sprite & MovieClip frame advancing, and DOMElement display properties). - * @property tickEnabled - * @type Boolean - * @default true - **/ - this.tickEnabled = true; - - /** - * An optional name for this display object. Included in {{#crossLink "DisplayObject/toString"}}{{/crossLink}} . Useful for - * debugging. - * @property name - * @type {String} - * @default null - **/ - this.name = null; - - /** - * A reference to the {{#crossLink "Container"}}{{/crossLink}} or {{#crossLink "Stage"}}{{/crossLink}} object that - * contains this display object, or null if it has not been added - * to one. - * @property parent - * @final - * @type {Container} - * @default null - * @readonly - **/ - this.parent = null; - - /** - * The left offset for this display object's registration point. For example, to make a 100x100px Bitmap rotate - * around its center, you would set regX and {{#crossLink "DisplayObject/regY:property"}}{{/crossLink}} to 50. - * Cached object's registration points should be set based on pre-cache conditions, not cached size. - * @property regX - * @type {Number} - * @default 0 - **/ - this.regX = 0; - - /** - * The y offset for this display object's registration point. For example, to make a 100x100px Bitmap rotate around - * its center, you would set {{#crossLink "DisplayObject/regX:property"}}{{/crossLink}} and regY to 50. - * Cached object's registration points should be set based on pre-cache conditions, not cached size. - * @property regY - * @type {Number} - * @default 0 - **/ - this.regY = 0; - - /** - * The rotation in degrees for this display object. - * @property rotation - * @type {Number} - * @default 0 - **/ - this.rotation = 0; - - /** - * The factor to stretch this display object horizontally. For example, setting scaleX to 2 will stretch the display - * object to twice its nominal width. To horizontally flip an object, set the scale to a negative number. - * @property scaleX - * @type {Number} - * @default 1 - **/ - this.scaleX = 1; - - /** - * The factor to stretch this display object vertically. For example, setting scaleY to 0.5 will stretch the display - * object to half its nominal height. To vertically flip an object, set the scale to a negative number. - * @property scaleY - * @type {Number} - * @default 1 - **/ - this.scaleY = 1; - - /** - * The factor to skew this display object horizontally. - * @property skewX - * @type {Number} - * @default 0 - **/ - this.skewX = 0; - - /** - * The factor to skew this display object vertically. - * @property skewY - * @type {Number} - * @default 0 - **/ - this.skewY = 0; - - /** - * A shadow object that defines the shadow to render on this display object. Set to `null` to remove a shadow. If - * null, this property is inherited from the parent container. - * @property shadow - * @type {Shadow} - * @default null - **/ - this.shadow = null; - - /** - * Indicates whether this display object should be rendered to the canvas and included when running the Stage - * {{#crossLink "Stage/getObjectsUnderPoint"}}{{/crossLink}} method. - * @property visible - * @type {Boolean} - * @default true - **/ - this.visible = true; - - /** - * The x (horizontal) position of the display object, relative to its parent. - * @property x - * @type {Number} - * @default 0 - **/ - this.x = 0; - - /** The y (vertical) position of the display object, relative to its parent. - * @property y - * @type {Number} - * @default 0 - **/ - this.y = 0; - - /** - * If set, defines the transformation for this display object, overriding all other transformation properties - * (x, y, rotation, scale, skew). - * @property transformMatrix - * @type {Matrix2D} - * @default null - **/ - this.transformMatrix = null; - - /** - * The composite operation indicates how the pixels of this display object will be composited with the elements - * behind it. If `null`, this property is inherited from the parent container. For more information, read the - * - * whatwg spec on compositing. For a list of supported compositeOperation value, visit - * the W3C draft on Compositing and Blending. - * @property compositeOperation - * @type {String} - * @default null - **/ - this.compositeOperation = null; - - /** - * Indicates whether the display object should be drawn to a whole pixel when - * {{#crossLink "Stage/snapToPixelEnabled"}}{{/crossLink}} is true. To enable/disable snapping on whole - * categories of display objects, set this value on the prototype (Ex. Text.prototype.snapToPixel = true). - * @property snapToPixel - * @type {Boolean} - * @default true - **/ - this.snapToPixel = true; - - /** - * An array of Filter objects to apply to this display object. Filters are only applied / updated when {{#crossLink "cache"}}{{/crossLink}} - * or {{#crossLink "updateCache"}}{{/crossLink}} is called on the display object, and only apply to the area that is - * cached. - * @property filters - * @type {Array} - * @default null - **/ - this.filters = null; - - /** - * A Shape instance that defines a vector mask (clipping path) for this display object. The shape's transformation - * will be applied relative to the display object's parent coordinates (as if it were a child of the parent). - * @property mask - * @type {Shape} - * @default null - */ - this.mask = null; - - /** - * A display object that will be tested when checking mouse interactions or testing {{#crossLink "Container/getObjectsUnderPoint"}}{{/crossLink}}. - * The hit area will have its transformation applied relative to this display object's coordinate space (as though - * the hit test object were a child of this display object and relative to its regX/Y). The hitArea will be tested - * using only its own `alpha` value regardless of the alpha value on the target display object, or the target's - * ancestors (parents). - * - * If set on a {{#crossLink "Container"}}{{/crossLink}}, children of the Container will not receive mouse events. - * This is similar to setting {{#crossLink "mouseChildren"}}{{/crossLink}} to false. - * - * Note that hitArea is NOT currently used by the `hitTest()` method, nor is it supported for {{#crossLink "Stage"}}{{/crossLink}}. - * @property hitArea - * @type {DisplayObject} - * @default null - */ - this.hitArea = null; - - /** - * A CSS cursor (ex. "pointer", "help", "text", etc) that will be displayed when the user hovers over this display - * object. You must enable mouseover events using the {{#crossLink "Stage/enableMouseOver"}}{{/crossLink}} method to - * use this property. Setting a non-null cursor on a Container will override the cursor set on its descendants. - * @property cursor - * @type {String} - * @default null - */ - this.cursor = null; - - - // private properties: - /** - * Moved to {{#crossLink "BitmapCache"}}{{/crossLink}} - * @property _cacheScale - * @protected - * @type {Number} - * @default 1 - * @deprecated - **/ - - /** - * Moved to {{#crossLink "BitmapCache"}}{{/crossLink}} - * @property _cacheDataURLID - * @protected - * @type {Number} - * @default 0 - * @deprecated - */ - - /** - * Moved to {{#crossLink "BitmapCache"}}{{/crossLink}} - * @property _cacheDataURL - * @protected - * @type {String} - * @default null - * @deprecated - */ - - /** - * @property _props - * @protected - * @type {DisplayObject} - * @default null - **/ - this._props = new createjs.DisplayProps(); - - /** - * @property _rectangle - * @protected - * @type {Rectangle} - * @default null - **/ - this._rectangle = new createjs.Rectangle(); - - /** - * @property _bounds - * @protected - * @type {Rectangle} - * @default null - **/ - this._bounds = null; - - /** - * Where StageGL should look for required display properties, matters only for leaf display objects. Containers - * or cached objects won't use this property, it's for native display of terminal elements. - * @property _webGLRenderStyle - * @protected - * @type {number} - * @default 0 - */ - this._webGLRenderStyle = DisplayObject._StageGL_NONE; - } - var p = createjs.extend(DisplayObject, createjs.EventDispatcher); - -// static properties: - /** - * Listing of mouse event names. Used in _hasMouseEventListener. - * @property _MOUSE_EVENTS - * @protected - * @static - * @type {Array} - **/ - DisplayObject._MOUSE_EVENTS = ["click","dblclick","mousedown","mouseout","mouseover","pressmove","pressup","rollout","rollover"]; - - /** - * Suppresses errors generated when using features like hitTest, mouse events, and {{#crossLink "getObjectsUnderPoint"}}{{/crossLink}} - * with cross domain content. - * @property suppressCrossDomainErrors - * @static - * @type {Boolean} - * @default false - **/ - DisplayObject.suppressCrossDomainErrors = false; - - /** - * @property _snapToPixelEnabled - * @protected - * @static - * @type {Boolean} - * @default false - **/ - DisplayObject._snapToPixelEnabled = false; // stage.snapToPixelEnabled is temporarily copied here during a draw to provide global access. - - /** - * Enum like property for determining StageGL render lookup, i.e. where to expect properties. - * @property _StageGL_NONE - * @protected - * @static - * @type {number} - */ - DisplayObject._StageGL_NONE = 0; - - /** - * Enum like property for determining StageGL render lookup, i.e. where to expect properties. - * @property _StageGL_SPRITE - * @protected - * @static - * @type {number} - */ - DisplayObject._StageGL_SPRITE = 1; - - /** - * Enum like property for determining StageGL render lookup, i.e. where to expect properties. - * @property _StageGL_BITMAP - * @protected - * @static - * @type {number} - */ - DisplayObject._StageGL_BITMAP = 2; - - /** - * @property _hitTestCanvas - * @type {HTMLCanvasElement | Object} - * @static - * @protected - **/ - /** - * @property _hitTestContext - * @type {CanvasRenderingContext2D} - * @static - * @protected - **/ - var canvas = createjs.createCanvas?createjs.createCanvas():document.createElement("canvas"); // prevent errors on load in browsers without canvas. - if (canvas.getContext) { - DisplayObject._hitTestCanvas = canvas; - DisplayObject._hitTestContext = canvas.getContext("2d"); - canvas.width = canvas.height = 1; - } - -// events: - /** - * Dispatched when the user presses their left mouse button over the display object. See the - * {{#crossLink "MouseEvent"}}{{/crossLink}} class for a listing of event properties. - * @event mousedown - * @since 0.6.0 - */ - - /** - * Dispatched when the user presses their left mouse button and then releases it while over the display object. - * See the {{#crossLink "MouseEvent"}}{{/crossLink}} class for a listing of event properties. - * @event click - * @since 0.6.0 - */ - - /** - * Dispatched when the user double clicks their left mouse button over this display object. - * See the {{#crossLink "MouseEvent"}}{{/crossLink}} class for a listing of event properties. - * @event dblclick - * @since 0.6.0 - */ - - /** - * Dispatched when the user's mouse enters this display object. This event must be enabled using - * {{#crossLink "Stage/enableMouseOver"}}{{/crossLink}}. See also {{#crossLink "DisplayObject/rollover:event"}}{{/crossLink}}. - * See the {{#crossLink "MouseEvent"}}{{/crossLink}} class for a listing of event properties. - * @event mouseover - * @since 0.6.0 - */ - - /** - * Dispatched when the user's mouse leaves this display object. This event must be enabled using - * {{#crossLink "Stage/enableMouseOver"}}{{/crossLink}}. See also {{#crossLink "DisplayObject/rollout:event"}}{{/crossLink}}. - * See the {{#crossLink "MouseEvent"}}{{/crossLink}} class for a listing of event properties. - * @event mouseout - * @since 0.6.0 - */ - - /** - * This event is similar to {{#crossLink "DisplayObject/mouseover:event"}}{{/crossLink}}, with the following - * differences: it does not bubble, and it considers {{#crossLink "Container"}}{{/crossLink}} instances as an - * aggregate of their content. - * - * For example, myContainer contains two overlapping children: shapeA and shapeB. The user moves their mouse over - * shapeA and then directly on to shapeB. With a listener for {{#crossLink "mouseover:event"}}{{/crossLink}} on - * myContainer, two events would be received, each targeting a child element:
      - *
    1. when the mouse enters shapeA (target=shapeA)
    2. - *
    3. when the mouse enters shapeB (target=shapeB)
    4. - *
    - * However, with a listener for "rollover" instead, only a single event is received when the mouse first enters - * the aggregate myContainer content (target=myContainer). - * - * This event must be enabled using {{#crossLink "Stage/enableMouseOver"}}{{/crossLink}}. - * See the {{#crossLink "MouseEvent"}}{{/crossLink}} class for a listing of event properties. - * @event rollover - * @since 0.7.0 - */ - - /** - * This event is similar to {{#crossLink "DisplayObject/mouseout:event"}}{{/crossLink}}, with the following - * differences: it does not bubble, and it considers {{#crossLink "Container"}}{{/crossLink}} instances as an - * aggregate of their content. - * - * For example, myContainer contains two overlapping children: shapeA and shapeB. The user moves their mouse over - * shapeA, then directly on to shapeB, then off both. With a listener for {{#crossLink "mouseout:event"}}{{/crossLink}} - * on myContainer, two events would be received, each targeting a child element:
      - *
    1. when the mouse leaves shapeA (target=shapeA)
    2. - *
    3. when the mouse leaves shapeB (target=shapeB)
    4. - *
    - * However, with a listener for "rollout" instead, only a single event is received when the mouse leaves - * the aggregate myContainer content (target=myContainer). - * - * This event must be enabled using {{#crossLink "Stage/enableMouseOver"}}{{/crossLink}}. - * See the {{#crossLink "MouseEvent"}}{{/crossLink}} class for a listing of event properties. - * @event rollout - * @since 0.7.0 - */ - - /** - * After a {{#crossLink "DisplayObject/mousedown:event"}}{{/crossLink}} occurs on a display object, a pressmove - * event will be generated on that object whenever the mouse moves until the mouse press is released. This can be - * useful for dragging and similar operations. - * - * **Please note** that if the initial mouse target from a `mousedown` event is removed from the stage after being pressed - * (e.g. during a `pressmove` event), a `pressmove` event is still generated. However since it is no longer in the - * display list, the event can not bubble. This means that previous ancestors (parent containers) will not receive - * the event, and therefore can not re-dispatch it. If you intend to listen for `{{#crossLink "DisplayObject/pressup:event"}}{{/crossLink}}` - * or `pressmove` on a dynamic object (such as a {{#crossLink "MovieClip"}}{{/crossLink}} or {{#crossLink "Container"}}{{/crossLink}}), - * then ensure you set {{#crossLink "Container/mouseChildren:property"}}{{/crossLink}} to `false`. - * @event pressmove - * @since 0.7.0 - */ - - /** - * After a {{#crossLink "DisplayObject/mousedown:event"}}{{/crossLink}} occurs on a display object, a pressup event - * will be generated on that object when that mouse press is released. This can be useful for dragging and similar - * operations. - * - * **Please note** that if the initial mouse target from a `mousedown` event is removed from the stage after being pressed - * (e.g. during a `pressmove` event), a `pressup` event is still generated. However since it is no longer in the - * display list, the event can not bubble. This means that previous ancestors (parent containers) will not receive - * the event, and therefore can not re-dispatch it. If you intend to listen for `{{#crossLink "DisplayObject/pressmove:event"}}{{/crossLink}}` - * or `pressup` on a dynamic object (such as a {{#crossLink "MovieClip"}}{{/crossLink}} or {{#crossLink "Container"}}{{/crossLink}}), - * then ensure you set {{#crossLink "Container/mouseChildren:property"}}{{/crossLink}} to `false`. - * @event pressup - * @since 0.7.0 - */ - - /** - * Dispatched when the display object is added to a parent container. - * @event added - */ - - /** - * Dispatched when the display object is removed from its parent container. - * @event removed - */ - - /** - * Dispatched on each display object on a stage whenever the stage updates. This occurs immediately before the - * rendering (draw) pass. When {{#crossLink "Stage/update"}}{{/crossLink}} is called, first all display objects on - * the stage dispatch the tick event, then all of the display objects are drawn to stage. Children will have their - * {{#crossLink "tick:event"}}{{/crossLink}} event dispatched in order of their depth prior to the event being - * dispatched on their parent. - * @event tick - * @param {Object} target The object that dispatched the event. - * @param {String} type The event type. - * @param {Array} params An array containing any arguments that were passed to the Stage.update() method. For - * example if you called stage.update("hello"), then the params would be ["hello"]. - * @since 0.6.0 - */ - - -// getter / setters: - /** - * Use the {{#crossLink "DisplayObject/stage:property"}}{{/crossLink}} property instead. - * @method _getStage - * @protected - * @return {Stage} - **/ - p._getStage = function() { - // uses dynamic access to avoid circular dependencies; - var o = this, _Stage = createjs["Stage"]; - while (o.parent) { o = o.parent; } - if (o instanceof _Stage) { return o; } - return null; - }; - // DisplayObject.getStage is @deprecated. Remove for 1.1+ - p.getStage = createjs.deprecate(p._getStage, "DisplayObject.getStage"); - - /** - * Returns the Stage instance that this display object will be rendered on, or null if it has not been added to one. - * @property stage - * @type {Stage} - * @readonly - **/ - - /** - * Returns an ID number that uniquely identifies the current cache for this display object. This can be used to - * determine if the cache has changed since a previous check. - * Moved to {{#crossLink "BitmapCache"}}{{/crossLink}} - * @property cacheID - * @deprecated - * @type {Number} - * @default 0 - */ - - /** - * Set both the {{#crossLink "DisplayObject/scaleX:property"}}{{/crossLink}} and the {{#crossLink "DisplayObject/scaleY"}}{{/crossLink}} - * property to the same value. Note that when you get the value, if the `scaleX` and `scaleY` are different values, - * it will return only the `scaleX`. - * @property scaleX - * @type {Number} - * @default 1 - */ - try { - Object.defineProperties(p, { - stage: { get: p._getStage }, - cacheID: { - get: function(){ return this.bitmapCache && this.bitmapCache.cacheID }, - set: function(a){ this.bitmapCache && (this.bitmapCache.cacheID = a) } - }, - scale: { - get: function() { return this.scaleX; }, - set: function(scale) { this.scaleX = this.scaleY = scale; }, - } - }); - } catch (e) {} - - -// public methods: - /** - * Returns true or false indicating whether the display object would be visible if drawn to a canvas. - * This does not account for whether it would be visible within the boundaries of the stage. - * - * NOTE: This method is mainly for internal use, though it may be useful for advanced uses. - * @method isVisible - * @return {Boolean} Boolean indicating whether the display object would be visible if drawn to a canvas - **/ - p.isVisible = function() { - return !!(this.visible && this.alpha > 0 && this.scaleX != 0 && this.scaleY != 0); - }; - - /** - * Draws the display object into the specified context ignoring its visible, alpha, shadow, and transform. - * Returns true if the draw was handled (useful for overriding functionality). - * - * NOTE: This method is mainly for internal use, though it may be useful for advanced uses. - * @method draw - * @param {CanvasRenderingContext2D} ctx The canvas 2D context object to draw into. - * @param {Boolean} [ignoreCache=false] Indicates whether the draw operation should ignore any current cache. For example, - * used for drawing the cache (to prevent it from simply drawing an existing cache back into itself). - * @return {Boolean} - **/ - p.draw = function(ctx, ignoreCache) { - var cache = this.bitmapCache; - if(cache && !ignoreCache) { - return cache.draw(ctx); - } - return false; - }; - - /** - * Applies this display object's transformation, alpha, globalCompositeOperation, clipping path (mask), and shadow - * to the specified context. This is typically called prior to {{#crossLink "DisplayObject/draw"}}{{/crossLink}}. - * @method updateContext - * @param {CanvasRenderingContext2D} ctx The canvas 2D to update. - **/ - p.updateContext = function(ctx) { - var o=this, mask=o.mask, mtx= o._props.matrix; - - if (mask && mask.graphics && !mask.graphics.isEmpty()) { - mask.getMatrix(mtx); - ctx.transform(mtx.a, mtx.b, mtx.c, mtx.d, mtx.tx, mtx.ty); - - mask.graphics.drawAsPath(ctx); - ctx.clip(); - - mtx.invert(); - ctx.transform(mtx.a, mtx.b, mtx.c, mtx.d, mtx.tx, mtx.ty); - } - - this.getMatrix(mtx); - var tx = mtx.tx, ty = mtx.ty; - if (DisplayObject._snapToPixelEnabled && o.snapToPixel) { - tx = tx + (tx < 0 ? -0.5 : 0.5) | 0; - ty = ty + (ty < 0 ? -0.5 : 0.5) | 0; - } - ctx.transform(mtx.a, mtx.b, mtx.c, mtx.d, tx, ty); - ctx.globalAlpha *= o.alpha; - if (o.compositeOperation) { ctx.globalCompositeOperation = o.compositeOperation; } - if (o.shadow) { this._applyShadow(ctx, o.shadow); } - }; - - /** - * Draws the display object into a new element, which is then used for subsequent draws. Intended for complex content - * that does not change frequently (ex. a Container with many children that do not move, or a complex vector Shape), - * this can provide for much faster rendering because the content does not need to be re-rendered each tick. The - * cached display object can be moved, rotated, faded, etc freely, however if its content changes, you must manually - * update the cache by calling updateCache() again. You must specify the cached area via the x, y, w, - * and h parameters. This defines the rectangle that will be rendered and cached using this display object's coordinates. - * - *

    Example

    - * For example if you defined a Shape that drew a circle at 0, 0 with a radius of 25: - * - * var shape = new createjs.Shape(); - * shape.graphics.beginFill("#ff0000").drawCircle(0, 0, 25); - * shape.cache(-25, -25, 50, 50); - * - * Note that filters need to be defined before the cache is applied or you will have to call updateCache after - * application. Check out the {{#crossLink "Filter"}}{{/crossLink}} class for more information. Some filters - * (ex. BlurFilter) may not work as expected in conjunction with the scale param. - * - * Usually, the resulting cacheCanvas will have the dimensions width * scale, height * scale, however some filters (ex. BlurFilter) - * will add padding to the canvas dimensions. - * - * In previous versions caching was handled on DisplayObject but has since been moved to {{#crossLink "BitmapCache"}}{{/crossLink}}. - * This allows for easier interaction and alternate cache methods like WebGL with {{#crossLink "StageGL"}}{{/crossLink}}. - * For more information on the options object, see the BitmapCache {{#crossLink "BitmapCache/define"}}{{/crossLink}}. - * - * @method cache - * @param {Number} x The x coordinate origin for the cache region. - * @param {Number} y The y coordinate origin for the cache region. - * @param {Number} width The width of the cache region. - * @param {Number} height The height of the cache region. - * @param {Number} [scale=1] The scale at which the cache will be created. For example, if you cache a vector shape using - * myShape.cache(0,0,100,100,2) then the resulting cacheCanvas will be 200x200 px. This lets you scale and rotate - * cached elements with greater fidelity. Default is 1. - * @param {Object} [options=undefined] Specify additional parameters for the cache logic - **/ - p.cache = function(x, y, width, height, scale, options) { - if(!this.bitmapCache){ - this.bitmapCache = new createjs.BitmapCache(); - } - this.bitmapCache.define(this, x, y, width, height, scale, options); - }; - - /** - * Redraws the display object to its cache. Calling updateCache without an active cache will throw an error. - * If compositeOperation is null the current cache will be cleared prior to drawing. Otherwise the display object - * will be drawn over the existing cache using the specified compositeOperation. - * - *

    Example

    - * Clear the current graphics of a cached shape, draw some new instructions, and then update the cache. The new line - * will be drawn on top of the old one. - * - * // Not shown: Creating the shape, and caching it. - * shapeInstance.clear(); - * shapeInstance.setStrokeStyle(3).beginStroke("#ff0000").moveTo(100, 100).lineTo(200,200); - * shapeInstance.updateCache(); - * - * In previous versions caching was handled on DisplayObject but has since been moved to {{#crossLink "BitmapCache"}}{{/crossLink}}. - * This allows for easier interaction and alternate cache methods like WebGL and {{#crossLink "StageGL"}}{{/crossLink}}. - * - * @method updateCache - * @param {String} compositeOperation The compositeOperation to use, or null to clear the cache and redraw it. - * - * whatwg spec on compositing. - **/ - p.updateCache = function(compositeOperation) { - if(!this.bitmapCache) { - throw "cache() must be called before updateCache()"; - } - this.bitmapCache.update(compositeOperation); - }; - - /** - * Clears the current cache. See {{#crossLink "DisplayObject/cache"}}{{/crossLink}} for more information. - * @method uncache - **/ - p.uncache = function() { - if(this.bitmapCache) { - this.bitmapCache.release(); - this.bitmapCache = undefined; - } - }; - - /** - * Returns a data URL for the cache, or null if this display object is not cached. - * Only generated if the cache has changed, otherwise returns last result. - * @method getCacheDataURL - * @return {String} The image data url for the cache. - **/ - p.getCacheDataURL = function() { - return this.bitmapCache?this.bitmapCache.getCacheDataURL():null; - }; - - /** - * Transforms the specified x and y position from the coordinate space of the display object - * to the global (stage) coordinate space. For example, this could be used to position an HTML label - * over a specific point on a nested display object. Returns a Point instance with x and y properties - * correlating to the transformed coordinates on the stage. - * - *

    Example

    - * - * displayObject.x = 300; - * displayObject.y = 200; - * stage.addChild(displayObject); - * var point = displayObject.localToGlobal(100, 100); - * // Results in x=400, y=300 - * - * @method localToGlobal - * @param {Number} x The x position in the source display object to transform. - * @param {Number} y The y position in the source display object to transform. - * @param {Point | Object} [pt] An object to copy the result into. If omitted a new Point object with x/y properties will be returned. - * @return {Point} A Point instance with x and y properties correlating to the transformed coordinates - * on the stage. - **/ - p.localToGlobal = function(x, y, pt) { - return this.getConcatenatedMatrix(this._props.matrix).transformPoint(x,y, pt||new createjs.Point()); - }; - - /** - * Transforms the specified x and y position from the global (stage) coordinate space to the - * coordinate space of the display object. For example, this could be used to determine - * the current mouse position within the display object. Returns a Point instance with x and y properties - * correlating to the transformed position in the display object's coordinate space. - * - *

    Example

    - * - * displayObject.x = 300; - * displayObject.y = 200; - * stage.addChild(displayObject); - * var point = displayObject.globalToLocal(100, 100); - * // Results in x=-200, y=-100 - * - * @method globalToLocal - * @param {Number} x The x position on the stage to transform. - * @param {Number} y The y position on the stage to transform. - * @param {Point | Object} [pt] An object to copy the result into. If omitted a new Point object with x/y properties will be returned. - * @return {Point} A Point instance with x and y properties correlating to the transformed position in the - * display object's coordinate space. - **/ - p.globalToLocal = function(x, y, pt) { - return this.getConcatenatedMatrix(this._props.matrix).invert().transformPoint(x,y, pt||new createjs.Point()); - }; - - /** - * Transforms the specified x and y position from the coordinate space of this display object to the coordinate - * space of the target display object. Returns a Point instance with x and y properties correlating to the - * transformed position in the target's coordinate space. Effectively the same as using the following code with - * {{#crossLink "DisplayObject/localToGlobal"}}{{/crossLink}} and {{#crossLink "DisplayObject/globalToLocal"}}{{/crossLink}}. - * - * var pt = this.localToGlobal(x, y); - * pt = target.globalToLocal(pt.x, pt.y); - * - * @method localToLocal - * @param {Number} x The x position in the source display object to transform. - * @param {Number} y The y position on the source display object to transform. - * @param {DisplayObject} target The target display object to which the coordinates will be transformed. - * @param {Point | Object} [pt] An object to copy the result into. If omitted a new Point object with x/y properties will be returned. - * @return {Point} Returns a Point instance with x and y properties correlating to the transformed position - * in the target's coordinate space. - **/ - p.localToLocal = function(x, y, target, pt) { - pt = this.localToGlobal(x, y, pt); - return target.globalToLocal(pt.x, pt.y, pt); - }; - - /** - * Shortcut method to quickly set the transform properties on the display object. All parameters are optional. - * Omitted parameters will have the default value set. - * - *

    Example

    - * - * displayObject.setTransform(100, 100, 2, 2); - * - * @method setTransform - * @param {Number} [x=0] The horizontal translation (x position) in pixels - * @param {Number} [y=0] The vertical translation (y position) in pixels - * @param {Number} [scaleX=1] The horizontal scale, as a percentage of 1 - * @param {Number} [scaleY=1] the vertical scale, as a percentage of 1 - * @param {Number} [rotation=0] The rotation, in degrees - * @param {Number} [skewX=0] The horizontal skew factor - * @param {Number} [skewY=0] The vertical skew factor - * @param {Number} [regX=0] The horizontal registration point in pixels - * @param {Number} [regY=0] The vertical registration point in pixels - * @return {DisplayObject} Returns this instance. Useful for chaining commands. - * @chainable - */ - p.setTransform = function(x, y, scaleX, scaleY, rotation, skewX, skewY, regX, regY) { - this.x = x || 0; - this.y = y || 0; - this.scaleX = scaleX == null ? 1 : scaleX; - this.scaleY = scaleY == null ? 1 : scaleY; - this.rotation = rotation || 0; - this.skewX = skewX || 0; - this.skewY = skewY || 0; - this.regX = regX || 0; - this.regY = regY || 0; - return this; - }; - - /** - * Returns a matrix based on this object's current transform. - * @method getMatrix - * @param {Matrix2D} matrix Optional. A Matrix2D object to populate with the calculated values. If null, a new - * Matrix object is returned. - * @return {Matrix2D} A matrix representing this display object's transform. - **/ - p.getMatrix = function(matrix) { - var o = this, mtx = matrix&&matrix.identity() || new createjs.Matrix2D(); - return o.transformMatrix ? mtx.copy(o.transformMatrix) : mtx.appendTransform(o.x, o.y, o.scaleX, o.scaleY, o.rotation, o.skewX, o.skewY, o.regX, o.regY); - }; - - /** - * Generates a Matrix2D object representing the combined transform of the display object and all of its - * parent Containers up to the highest level ancestor (usually the {{#crossLink "Stage"}}{{/crossLink}}). This can - * be used to transform positions between coordinate spaces, such as with {{#crossLink "DisplayObject/localToGlobal"}}{{/crossLink}} - * and {{#crossLink "DisplayObject/globalToLocal"}}{{/crossLink}}. - * @method getConcatenatedMatrix - * @param {Matrix2D} [matrix] A {{#crossLink "Matrix2D"}}{{/crossLink}} object to populate with the calculated values. - * If null, a new Matrix2D object is returned. - * @return {Matrix2D} The combined matrix. - **/ - p.getConcatenatedMatrix = function(matrix) { - var o = this, mtx = this.getMatrix(matrix); - while (o = o.parent) { - mtx.prependMatrix(o.getMatrix(o._props.matrix)); - } - return mtx; - }; - - /** - * Generates a DisplayProps object representing the combined display properties of the object and all of its - * parent Containers up to the highest level ancestor (usually the {{#crossLink "Stage"}}{{/crossLink}}). - * @method getConcatenatedDisplayProps - * @param {DisplayProps} [props] A {{#crossLink "DisplayProps"}}{{/crossLink}} object to populate with the calculated values. - * If null, a new DisplayProps object is returned. - * @return {DisplayProps} The combined display properties. - **/ - p.getConcatenatedDisplayProps = function(props) { - props = props ? props.identity() : new createjs.DisplayProps(); - var o = this, mtx = o.getMatrix(props.matrix); - do { - props.prepend(o.visible, o.alpha, o.shadow, o.compositeOperation); - - // we do this to avoid problems with the matrix being used for both operations when o._props.matrix is passed in as the props param. - // this could be simplified (ie. just done as part of the prepend above) if we switched to using a pool. - if (o != this) { mtx.prependMatrix(o.getMatrix(o._props.matrix)); } - } while (o = o.parent); - return props; - }; - - /** - * Tests whether the display object intersects the specified point in local coordinates (ie. draws a pixel with alpha > 0 at - * the specified position). This ignores the alpha, shadow, hitArea, mask, and compositeOperation of the display object. - * - *

    Example

    - * - * stage.addEventListener("stagemousedown", handleMouseDown); - * function handleMouseDown(event) { - * var hit = myShape.hitTest(event.stageX, event.stageY); - * } - * - * Please note that shape-to-shape collision is not currently supported by EaselJS. - * @method hitTest - * @param {Number} x The x position to check in the display object's local coordinates. - * @param {Number} y The y position to check in the display object's local coordinates. - * @return {Boolean} A Boolean indicating whether a visible portion of the DisplayObject intersect the specified - * local Point. - */ - p.hitTest = function(x, y) { - var ctx = DisplayObject._hitTestContext; - ctx.setTransform(1, 0, 0, 1, -x, -y); - this.draw(ctx); - - var hit = this._testHit(ctx); - ctx.setTransform(1, 0, 0, 1, 0, 0); - ctx.clearRect(0, 0, 2, 2); - return hit; - }; - - /** - * Provides a chainable shortcut method for setting a number of properties on the instance. - * - *

    Example

    - * - * var myGraphics = new createjs.Graphics().beginFill("#ff0000").drawCircle(0, 0, 25); - * var shape = stage.addChild(new Shape()).set({graphics:myGraphics, x:100, y:100, alpha:0.5}); - * - * @method set - * @param {Object} props A generic object containing properties to copy to the DisplayObject instance. - * @return {DisplayObject} Returns the instance the method is called on (useful for chaining calls.) - * @chainable - */ - p.set = function(props) { - for (var n in props) { this[n] = props[n]; } - return this; - }; - - /** - * Returns a rectangle representing this object's bounds in its local coordinate system (ie. with no transformation). - * Objects that have been cached will return the bounds of the cache. - * - * Not all display objects can calculate their own bounds (ex. Shape). For these objects, you can use - * {{#crossLink "DisplayObject/setBounds"}}{{/crossLink}} so that they are included when calculating Container - * bounds. - * - * - * - * - * - * - * - * - * - *
    All - * All display objects support setting bounds manually using setBounds(). Likewise, display objects that - * have been cached using cache() will return the bounds of their cache. Manual and cache bounds will override - * the automatic calculations listed below. - *
    Bitmap - * Returns the width and height of the sourceRect (if specified) or image, extending from (x=0,y=0). - *
    Sprite - * Returns the bounds of the current frame. May have non-zero x/y if a frame registration point was specified - * in the spritesheet data. See also {{#crossLink "SpriteSheet/getFrameBounds"}}{{/crossLink}} - *
    Container - * Returns the aggregate (combined) bounds of all children that return a non-null value from getBounds(). - *
    Shape - * Does not currently support automatic bounds calculations. Use setBounds() to manually define bounds. - *
    Text - * Returns approximate bounds. Horizontal values (x/width) are quite accurate, but vertical values (y/height) are - * not, especially when using textBaseline values other than "top". - *
    BitmapText - * Returns approximate bounds. Values will be more accurate if spritesheet frame registration points are close - * to (x=0,y=0). - *
    - * - * Bounds can be expensive to calculate for some objects (ex. text, or containers with many children), and - * are recalculated each time you call getBounds(). You can prevent recalculation on static objects by setting the - * bounds explicitly: - * - * var bounds = obj.getBounds(); - * obj.setBounds(bounds.x, bounds.y, bounds.width, bounds.height); - * // getBounds will now use the set values, instead of recalculating - * - * To reduce memory impact, the returned Rectangle instance may be reused internally; clone the instance or copy its - * values if you need to retain it. - * - * var myBounds = obj.getBounds().clone(); - * // OR: - * myRect.copy(obj.getBounds()); - * - * @method getBounds - * @return {Rectangle} A Rectangle instance representing the bounds, or null if bounds are not available for this - * object. - **/ - p.getBounds = function() { - if (this._bounds) { return this._rectangle.copy(this._bounds); } - var cacheCanvas = this.cacheCanvas; - if (cacheCanvas) { - var scale = this._cacheScale; - return this._rectangle.setValues(this._cacheOffsetX, this._cacheOffsetY, cacheCanvas.width/scale, cacheCanvas.height/scale); - } - return null; - }; - - /** - * Returns a rectangle representing this object's bounds in its parent's coordinate system (ie. with transformations applied). - * Objects that have been cached will return the transformed bounds of the cache. - * - * Not all display objects can calculate their own bounds (ex. Shape). For these objects, you can use - * {{#crossLink "DisplayObject/setBounds"}}{{/crossLink}} so that they are included when calculating Container - * bounds. - * - * To reduce memory impact, the returned Rectangle instance may be reused internally; clone the instance or copy its - * values if you need to retain it. - * - * Container instances calculate aggregate bounds for all children that return bounds via getBounds. - * @method getTransformedBounds - * @return {Rectangle} A Rectangle instance representing the bounds, or null if bounds are not available for this object. - **/ - p.getTransformedBounds = function() { - return this._getBounds(); - }; - - /** - * Allows you to manually specify the bounds of an object that either cannot calculate their own bounds (ex. Shape & - * Text) for future reference, or so the object can be included in Container bounds. Manually set bounds will always - * override calculated bounds. - * - * The bounds should be specified in the object's local (untransformed) coordinates. For example, a Shape instance - * with a 25px radius circle centered at 0,0 would have bounds of (-25, -25, 50, 50). - * @method setBounds - * @param {Number} x The x origin of the bounds. Pass null to remove the manual bounds. - * @param {Number} y The y origin of the bounds. - * @param {Number} width The width of the bounds. - * @param {Number} height The height of the bounds. - **/ - p.setBounds = function(x, y, width, height) { - if (x == null) { this._bounds = x; return; } - this._bounds = (this._bounds || new createjs.Rectangle()).setValues(x, y, width, height); - }; - - /** - * Returns a clone of this DisplayObject. Some properties that are specific to this instance's current context are - * reverted to their defaults (for example .parent). Caches are not maintained across clones, and some elements - * are copied by reference (masks, individual filter instances, hit area) - * @method clone - * @return {DisplayObject} A clone of the current DisplayObject instance. - **/ - p.clone = function() { - return this._cloneProps(new DisplayObject()); - }; - - /** - * Returns a string representation of this object. - * @method toString - * @return {String} a string representation of the instance. - **/ - p.toString = function() { - return "[DisplayObject (name="+ this.name +")]"; - }; - - -// private methods: - /** - * Called before the object gets drawn and is a chance to ensure the display state of the object is correct. - * Mostly used by {{#crossLink "MovieClip"}}{{/crossLink}} and {{#crossLink "BitmapText"}}{{/crossLink}} to - * correct their internal state and children prior to being drawn. - * - * Is manually called via draw in a {{#crossLink "Stage"}}{{/crossLink}} but is automatically called when - * present in a {{#crossLink "StageGL"}}{{/crossLink}} instance. - * - * @method _updateState - * @default null - */ - p._updateState = null; - - // separated so it can be used more easily in subclasses: - /** - * @method _cloneProps - * @param {DisplayObject} o The DisplayObject instance which will have properties from the current DisplayObject - * instance copied into. - * @return {DisplayObject} o - * @protected - **/ - p._cloneProps = function(o) { - o.alpha = this.alpha; - o.mouseEnabled = this.mouseEnabled; - o.tickEnabled = this.tickEnabled; - o.name = this.name; - o.regX = this.regX; - o.regY = this.regY; - o.rotation = this.rotation; - o.scaleX = this.scaleX; - o.scaleY = this.scaleY; - o.shadow = this.shadow; - o.skewX = this.skewX; - o.skewY = this.skewY; - o.visible = this.visible; - o.x = this.x; - o.y = this.y; - o.compositeOperation = this.compositeOperation; - o.snapToPixel = this.snapToPixel; - o.filters = this.filters==null?null:this.filters.slice(0); - o.mask = this.mask; - o.hitArea = this.hitArea; - o.cursor = this.cursor; - o._bounds = this._bounds; - return o; - }; - - /** - * @method _applyShadow - * @protected - * @param {CanvasRenderingContext2D} ctx - * @param {Shadow} shadow - **/ - p._applyShadow = function(ctx, shadow) { - shadow = shadow || Shadow.identity; - ctx.shadowColor = shadow.color; - ctx.shadowOffsetX = shadow.offsetX; - ctx.shadowOffsetY = shadow.offsetY; - ctx.shadowBlur = shadow.blur; - }; - - /** - * @method _tick - * @param {Object} evtObj An event object that will be dispatched to all tick listeners. This object is reused between dispatchers to reduce construction & GC costs. - * @protected - **/ - p._tick = function(evtObj) { - // because tick can be really performance sensitive, check for listeners before calling dispatchEvent. - var ls = this._listeners; - if (ls && ls["tick"]) { - // reset & reuse the event object to avoid construction / GC costs: - evtObj.target = null; - evtObj.propagationStopped = evtObj.immediatePropagationStopped = false; - this.dispatchEvent(evtObj); - } - }; - - /** - * @method _testHit - * @protected - * @param {CanvasRenderingContext2D} ctx - * @return {Boolean} - **/ - p._testHit = function(ctx) { - try { - var hit = ctx.getImageData(0, 0, 1, 1).data[3] > 1; - } catch (e) { - if (!DisplayObject.suppressCrossDomainErrors) { - throw "An error has occurred. This is most likely due to security restrictions on reading canvas pixel data with local or cross-domain images."; - } - } - return hit; - }; - - /** - * @method _getBounds - * @param {Matrix2D} matrix - * @param {Boolean} ignoreTransform If true, does not apply this object's transform. - * @return {Rectangle} - * @protected - **/ - p._getBounds = function(matrix, ignoreTransform){ - return this._transformBounds(this.getBounds(), matrix, ignoreTransform); - }; - - /** - * @method _transformBounds - * @param {Rectangle} bounds - * @param {Matrix2D} matrix - * @param {Boolean} ignoreTransform - * @return {Rectangle} - * @protected - **/ - p._transformBounds = function(bounds, matrix, ignoreTransform) { - if (!bounds) { return bounds; } - var x = bounds.x, y = bounds.y, width = bounds.width, height = bounds.height, mtx = this._props.matrix; - mtx = ignoreTransform ? mtx.identity() : this.getMatrix(mtx); - - if (x || y) { mtx.appendTransform(0,0,1,1,0,0,0,-x,-y); } // TODO: simplify this. - if (matrix) { mtx.prependMatrix(matrix); } - - var x_a = width*mtx.a, x_b = width*mtx.b; - var y_c = height*mtx.c, y_d = height*mtx.d; - var tx = mtx.tx, ty = mtx.ty; - - var minX = tx, maxX = tx, minY = ty, maxY = ty; - - if ((x = x_a + tx) < minX) { minX = x; } else if (x > maxX) { maxX = x; } - if ((x = x_a + y_c + tx) < minX) { minX = x; } else if (x > maxX) { maxX = x; } - if ((x = y_c + tx) < minX) { minX = x; } else if (x > maxX) { maxX = x; } - - if ((y = x_b + ty) < minY) { minY = y; } else if (y > maxY) { maxY = y; } - if ((y = x_b + y_d + ty) < minY) { minY = y; } else if (y > maxY) { maxY = y; } - if ((y = y_d + ty) < minY) { minY = y; } else if (y > maxY) { maxY = y; } - - return bounds.setValues(minX, minY, maxX-minX, maxY-minY); - }; - - /** - * Indicates whether the display object has any mouse event listeners or a cursor. - * @method _isMouseOpaque - * @return {Boolean} - * @protected - **/ - p._hasMouseEventListener = function() { - var evts = DisplayObject._MOUSE_EVENTS; - for (var i= 0, l=evts.length; itransform and alpha properties concatenated with their parent - * Container. - * - * For example, a {{#crossLink "Shape"}}{{/crossLink}} with x=100 and alpha=0.5, placed in a Container with x=50 - * and alpha=0.7 will be rendered to the canvas at x=150 and alpha=0.35. - * Containers have some overhead, so you generally shouldn't create a Container to hold a single child. - * - *

    Example

    - * - * var container = new createjs.Container(); - * container.addChild(bitmapInstance, shapeInstance); - * container.x = 100; - * - * @class Container - * @extends DisplayObject - * @constructor - **/ - function Container() { - this.DisplayObject_constructor(); - - // public properties: - /** - * The array of children in the display list. You should usually use the child management methods such as - * {{#crossLink "Container/addChild"}}{{/crossLink}}, {{#crossLink "Container/removeChild"}}{{/crossLink}}, - * {{#crossLink "Container/swapChildren"}}{{/crossLink}}, etc, rather than accessing this directly, but it is - * included for advanced uses. - * @property children - * @type Array - * @default null - **/ - this.children = []; - - /** - * Indicates whether the children of this container are independently enabled for mouse/pointer interaction. - * If false, the children will be aggregated under the container - for example, a click on a child shape would - * trigger a click event on the container. - * @property mouseChildren - * @type Boolean - * @default true - **/ - this.mouseChildren = true; - - /** - * If false, the tick will not be propagated to children of this Container. This can provide some performance benefits. - * In addition to preventing the "tick" event from being dispatched, it will also prevent tick related updates - * on some display objects (ex. Sprite & MovieClip frame advancing, DOMElement visibility handling). - * @property tickChildren - * @type Boolean - * @default true - **/ - this.tickChildren = true; - } - var p = createjs.extend(Container, createjs.DisplayObject); - - -// getter / setters: - /** - * Use the {{#crossLink "Container/numChildren:property"}}{{/crossLink}} property instead. - * @method _getNumChildren - * @protected - * @return {Number} - **/ - p._getNumChildren = function() { - return this.children.length; - }; - // Container.getNumChildren is @deprecated. Remove for 1.1+ - p.getNumChildren = createjs.deprecate(p._getNumChildren, "Container.getNumChildren"); - - /** - * Returns the number of children in the container. - * @property numChildren - * @type {Number} - * @readonly - **/ - try { - Object.defineProperties(p, { - numChildren: { get: p._getNumChildren } - }); - } catch (e) {} - - -// public methods: - /** - * Constructor alias for backwards compatibility. This method will be removed in future versions. - * Subclasses should be updated to use {{#crossLink "Utility Methods/extends"}}{{/crossLink}}. - * @method initialize - * @deprecated in favour of `createjs.promote()` - **/ - p.initialize = Container; // TODO: deprecated. - - /** - * Returns true or false indicating whether the display object would be visible if drawn to a canvas. - * This does not account for whether it would be visible within the boundaries of the stage. - * - * NOTE: This method is mainly for internal use, though it may be useful for advanced uses. - * @method isVisible - * @return {Boolean} Boolean indicating whether the display object would be visible if drawn to a canvas - **/ - p.isVisible = function() { - var hasContent = this.cacheCanvas || this.children.length; - return !!(this.visible && this.alpha > 0 && this.scaleX != 0 && this.scaleY != 0 && hasContent); - }; - - /** - * Draws the display object into the specified context ignoring its visible, alpha, shadow, and transform. - * Returns true if the draw was handled (useful for overriding functionality). - * - * NOTE: This method is mainly for internal use, though it may be useful for advanced uses. - * @method draw - * @param {CanvasRenderingContext2D} ctx The canvas 2D context object to draw into. - * @param {Boolean} [ignoreCache=false] Indicates whether the draw operation should ignore any current cache. - * For example, used for drawing the cache (to prevent it from simply drawing an existing cache back - * into itself). - **/ - p.draw = function(ctx, ignoreCache) { - if (this.DisplayObject_draw(ctx, ignoreCache)) { return true; } - - // this ensures we don't have issues with display list changes that occur during a draw: - var list = this.children.slice(); - for (var i=0,l=list.length; iExample - * - * container.addChild(bitmapInstance); - * - * You can also add multiple children at once: - * - * container.addChild(bitmapInstance, shapeInstance, textInstance); - * - * @method addChild - * @param {DisplayObject} child The display object to add. - * @return {DisplayObject} The child that was added, or the last child if multiple children were added. - **/ - p.addChild = function(child) { - if (child == null) { return child; } - var l = arguments.length; - if (l > 1) { - for (var i=0; iExample - * - * addChildAt(child1, index); - * - * You can also add multiple children, such as: - * - * addChildAt(child1, child2, ..., index); - * - * The index must be between 0 and numChildren. For example, to add myShape under otherShape in the display list, - * you could use: - * - * container.addChildAt(myShape, container.getChildIndex(otherShape)); - * - * This would also bump otherShape's index up by one. Fails silently if the index is out of range. - * - * @method addChildAt - * @param {DisplayObject} child The display object to add. - * @param {Number} index The index to add the child at. - * @return {DisplayObject} Returns the last child that was added, or the last child if multiple children were added. - **/ - p.addChildAt = function(child, index) { - var l = arguments.length; - var indx = arguments[l-1]; // can't use the same name as the index param or it replaces arguments[1] - if (indx < 0 || indx > this.children.length) { return arguments[l-2]; } - if (l > 2) { - for (var i=0; iExample - * - * container.removeChild(child); - * - * You can also remove multiple children: - * - * removeChild(child1, child2, ...); - * - * Returns true if the child (or children) was removed, or false if it was not in the display list. - * @method removeChild - * @param {DisplayObject} child The child to remove. - * @return {Boolean} true if the child (or children) was removed, or false if it was not in the display list. - **/ - p.removeChild = function(child) { - var l = arguments.length; - if (l > 1) { - var good = true; - for (var i=0; iExample - * - * container.removeChildAt(2); - * - * You can also remove multiple children: - * - * container.removeChild(2, 7, ...) - * - * Returns true if the child (or children) was removed, or false if any index was out of range. - * @method removeChildAt - * @param {Number} index The index of the child to remove. - * @return {Boolean} true if the child (or children) was removed, or false if any index was out of range. - **/ - p.removeChildAt = function(index) { - var l = arguments.length; - if (l > 1) { - var a = []; - for (var i=0; iExample - * - * container.removeAllChildren(); - * - * @method removeAllChildren - **/ - p.removeAllChildren = function() { - var kids = this.children; - while (kids.length) { this._removeChildAt(0); } - }; - - /** - * Returns the child at the specified index. - * - *

    Example

    - * - * container.getChildAt(2); - * - * @method getChildAt - * @param {Number} index The index of the child to return. - * @return {DisplayObject} The child at the specified index. Returns null if there is no child at the index. - **/ - p.getChildAt = function(index) { - return this.children[index]; - }; - - /** - * Returns the child with the specified name. - * @method getChildByName - * @param {String} name The name of the child to return. - * @return {DisplayObject} The child with the specified name. - **/ - p.getChildByName = function(name) { - var kids = this.children; - for (var i=0,l=kids.length;iExample: Display children with a higher y in front. - * - * var sortFunction = function(obj1, obj2, options) { - * if (obj1.y > obj2.y) { return 1; } - * if (obj1.y < obj2.y) { return -1; } - * return 0; - * } - * container.sortChildren(sortFunction); - * - * @method sortChildren - * @param {Function} sortFunction the function to use to sort the child list. See JavaScript's Array.sort - * documentation for details. - **/ - p.sortChildren = function(sortFunction) { - this.children.sort(sortFunction); - }; - - /** - * Returns the index of the specified child in the display list, or -1 if it is not in the display list. - * - *

    Example

    - * - * var index = container.getChildIndex(child); - * - * @method getChildIndex - * @param {DisplayObject} child The child to return the index of. - * @return {Number} The index of the specified child. -1 if the child is not found. - **/ - p.getChildIndex = function(child) { - return createjs.indexOf(this.children, child); - }; - - /** - * Swaps the children at the specified indexes. Fails silently if either index is out of range. - * @method swapChildrenAt - * @param {Number} index1 - * @param {Number} index2 - **/ - p.swapChildrenAt = function(index1, index2) { - var kids = this.children; - var o1 = kids[index1]; - var o2 = kids[index2]; - if (!o1 || !o2) { return; } - kids[index1] = o2; - kids[index2] = o1; - }; - - /** - * Swaps the specified children's depth in the display list. Fails silently if either child is not a child of this - * Container. - * @method swapChildren - * @param {DisplayObject} child1 - * @param {DisplayObject} child2 - **/ - p.swapChildren = function(child1, child2) { - var kids = this.children; - var index1,index2; - for (var i=0,l=kids.length;i= l) { return; } - for (var i=0;i 0 at the - * specified position). This ignores the alpha, shadow and compositeOperation of the display object, and all - * transform properties including regX/Y. - * @method hitTest - * @param {Number} x The x position to check in the display object's local coordinates. - * @param {Number} y The y position to check in the display object's local coordinates. - * @return {Boolean} A Boolean indicating whether there is a visible section of a DisplayObject that overlaps the specified - * coordinates. - **/ - p.hitTest = function(x, y) { - // TODO: optimize to use the fast cache check where possible. - return (this.getObjectUnderPoint(x, y) != null); - }; - - /** - * Returns an array of all display objects under the specified coordinates that are in this container's display - * list. This routine ignores any display objects with {{#crossLink "DisplayObject/mouseEnabled:property"}}{{/crossLink}} - * set to `false`. The array will be sorted in order of visual depth, with the top-most display object at index 0. - * This uses shape based hit detection, and can be an expensive operation to run, so it is best to use it carefully. - * For example, if testing for objects under the mouse, test on tick (instead of on {{#crossLink "DisplayObject/mousemove:event"}}{{/crossLink}}), - * and only if the mouse's position has changed. - * - *
      - *
    • By default (mode=0) this method evaluates all display objects.
    • - *
    • By setting the `mode` parameter to `1`, the {{#crossLink "DisplayObject/mouseEnabled:property"}}{{/crossLink}} - * and {{#crossLink "mouseChildren:property"}}{{/crossLink}} properties will be respected.
    • - *
    • Setting the `mode` to `2` additionally excludes display objects that do not have active mouse event - * listeners or a {{#crossLink "DisplayObject:cursor:property"}}{{/crossLink}} property. That is, only objects - * that would normally intercept mouse interaction will be included. This can significantly improve performance - * in some cases by reducing the number of display objects that need to be tested.
    • - * - * - * This method accounts for both {{#crossLink "DisplayObject/hitArea:property"}}{{/crossLink}} and {{#crossLink "DisplayObject/mask:property"}}{{/crossLink}}. - * @method getObjectsUnderPoint - * @param {Number} x The x position in the container to test. - * @param {Number} y The y position in the container to test. - * @param {Number} [mode=0] The mode to use to determine which display objects to include. 0-all, 1-respect mouseEnabled/mouseChildren, 2-only mouse opaque objects. - * @return {Array} An Array of DisplayObjects under the specified coordinates. - **/ - p.getObjectsUnderPoint = function(x, y, mode) { - var arr = []; - var pt = this.localToGlobal(x, y); - this._getObjectsUnderPoint(pt.x, pt.y, arr, mode>0, mode==1); - return arr; - }; - - /** - * Similar to {{#crossLink "Container/getObjectsUnderPoint"}}{{/crossLink}}, but returns only the top-most display - * object. This runs significantly faster than getObjectsUnderPoint(), but is still potentially an expensive - * operation. See {{#crossLink "Container/getObjectsUnderPoint"}}{{/crossLink}} for more information. - * @method getObjectUnderPoint - * @param {Number} x The x position in the container to test. - * @param {Number} y The y position in the container to test. - * @param {Number} mode The mode to use to determine which display objects to include. 0-all, 1-respect mouseEnabled/mouseChildren, 2-only mouse opaque objects. - * @return {DisplayObject} The top-most display object under the specified coordinates. - **/ - p.getObjectUnderPoint = function(x, y, mode) { - var pt = this.localToGlobal(x, y); - return this._getObjectsUnderPoint(pt.x, pt.y, null, mode>0, mode==1); - }; - - /** - * Docced in superclass. - */ - p.getBounds = function() { - return this._getBounds(null, true); - }; - - - /** - * Docced in superclass. - */ - p.getTransformedBounds = function() { - return this._getBounds(); - }; - - /** - * Returns a clone of this Container. Some properties that are specific to this instance's current context are - * reverted to their defaults (for example .parent). - * @method clone - * @param {Boolean} [recursive=false] If true, all of the descendants of this container will be cloned recursively. If false, the - * properties of the container will be cloned, but the new instance will not have any children. - * @return {Container} A clone of the current Container instance. - **/ - p.clone = function(recursive) { - var o = this._cloneProps(new Container()); - if (recursive) { this._cloneChildren(o); } - return o; - }; - - /** - * Returns a string representation of this object. - * @method toString - * @return {String} a string representation of the instance. - **/ - p.toString = function() { - return "[Container (name="+ this.name +")]"; - }; - - -// private methods: - /** - * @method _tick - * @param {Object} evtObj An event object that will be dispatched to all tick listeners. This object is reused between dispatchers to reduce construction & GC costs. - * @protected - **/ - p._tick = function(evtObj) { - if (this.tickChildren) { - for (var i=this.children.length-1; i>=0; i--) { - var child = this.children[i]; - if (child.tickEnabled && child._tick) { child._tick(evtObj); } - } - } - this.DisplayObject__tick(evtObj); - }; - - /** - * Recursively clones all children of this container, and adds them to the target container. - * @method cloneChildren - * @protected - * @param {Container} o The target container. - **/ - p._cloneChildren = function(o) { - if (o.children.length) { o.removeAllChildren(); } - var arr = o.children; - for (var i=0, l=this.children.length; i this.children.length-1) { return false; } - var child = this.children[index]; - if (child) { child.parent = null; } - this.children.splice(index, 1); - if (!silent) { child.dispatchEvent("removed"); } - return true; - }; - - /** - * @method _getObjectsUnderPoint - * @param {Number} x - * @param {Number} y - * @param {Array} arr - * @param {Boolean} mouse If true, it will respect mouse interaction properties like mouseEnabled, mouseChildren, and active listeners. - * @param {Boolean} activeListener If true, there is an active mouse event listener on a parent object. - * @param {Number} currentDepth Indicates the current depth of the search. - * @return {DisplayObject} - * @protected - **/ - p._getObjectsUnderPoint = function(x, y, arr, mouse, activeListener, currentDepth) { - currentDepth = currentDepth || 0; - if (!currentDepth && !this._testMask(this, x, y)) { return null; } - var mtx, ctx = createjs.DisplayObject._hitTestContext; - activeListener = activeListener || (mouse&&this._hasMouseEventListener()); - - // draw children one at a time, and check if we get a hit: - var children = this.children, l = children.length; - for (var i=l-1; i>=0; i--) { - var child = children[i]; - var hitArea = child.hitArea; - if (!child.visible || (!hitArea && !child.isVisible()) || (mouse && !child.mouseEnabled)) { continue; } - if (!hitArea && !this._testMask(child, x, y)) { continue; } - - // if a child container has a hitArea then we only need to check its hitAre2a, so we can treat it as a normal DO: - if (!hitArea && child instanceof Container) { - var result = child._getObjectsUnderPoint(x, y, arr, mouse, activeListener, currentDepth+1); - if (!arr && result) { return (mouse && !this.mouseChildren) ? this : result; } - } else { - if (mouse && !activeListener && !child._hasMouseEventListener()) { continue; } - - // TODO: can we pass displayProps forward, to avoid having to calculate this backwards every time? It's kind of a mixed bag. When we're only hunting for DOs with event listeners, it may not make sense. - var props = child.getConcatenatedDisplayProps(child._props); - mtx = props.matrix; - - if (hitArea) { - mtx.appendMatrix(hitArea.getMatrix(hitArea._props.matrix)); - props.alpha = hitArea.alpha; - } - - ctx.globalAlpha = props.alpha; - ctx.setTransform(mtx.a, mtx.b, mtx.c, mtx.d, mtx.tx-x, mtx.ty-y); - (hitArea||child).draw(ctx); - if (!this._testHit(ctx)) { continue; } - ctx.setTransform(1, 0, 0, 1, 0, 0); - ctx.clearRect(0, 0, 2, 2); - if (arr) { arr.push(child); } - else { return (mouse && !this.mouseChildren) ? this : child; } - } - } - return null; - }; - - /** - * @method _testMask - * @param {DisplayObject} target - * @param {Number} x - * @param {Number} y - * @return {Boolean} Indicates whether the x/y is within the masked region. - * @protected - **/ - p._testMask = function(target, x, y) { - var mask = target.mask; - if (!mask || !mask.graphics || mask.graphics.isEmpty()) { return true; } - - var mtx = this._props.matrix, parent = target.parent; - mtx = parent ? parent.getConcatenatedMatrix(mtx) : mtx.identity(); - mtx = mask.getMatrix(mask._props.matrix).prependMatrix(mtx); - - var ctx = createjs.DisplayObject._hitTestContext; - ctx.setTransform(mtx.a, mtx.b, mtx.c, mtx.d, mtx.tx-x, mtx.ty-y); - - // draw the mask as a solid fill: - mask.graphics.drawAsPath(ctx); - ctx.fillStyle = "#000"; - ctx.fill(); - - if (!this._testHit(ctx)) { return false; } - ctx.setTransform(1, 0, 0, 1, 0, 0); - ctx.clearRect(0, 0, 2, 2); - - return true; - }; - - /** - * @method _getBounds - * @param {Matrix2D} matrix - * @param {Boolean} ignoreTransform If true, does not apply this object's transform. - * @return {Rectangle} - * @protected - **/ - p._getBounds = function(matrix, ignoreTransform) { - var bounds = this.DisplayObject_getBounds(); - if (bounds) { return this._transformBounds(bounds, matrix, ignoreTransform); } - - var mtx = this._props.matrix; - mtx = ignoreTransform ? mtx.identity() : this.getMatrix(mtx); - if (matrix) { mtx.prependMatrix(matrix); } - - var l = this.children.length, rect=null; - for (var i=0; iWARNING: In almost all cases it is better to display a single frame using a {{#crossLink "Sprite"}}{{/crossLink}} - * with a {{#crossLink "Sprite/gotoAndStop"}}{{/crossLink}} call than it is to slice out a frame using this - * method and display it with a Bitmap instance. You can also crop an image using the {{#crossLink "Bitmap/sourceRect"}}{{/crossLink}} - * property of {{#crossLink "Bitmap"}}{{/crossLink}}. - * - * The extractFrame method may cause cross-domain warnings since it accesses pixels directly on the canvas. - * @method extractFrame - * @static - * @param {SpriteSheet} spriteSheet The SpriteSheet instance to extract a frame from. - * @param {Number|String} frameOrAnimation The frame number or animation name to extract. If an animation - * name is specified, only the first frame of the animation will be extracted. - * @return {HTMLImageElement} a single frame of the specified sprite sheet as a new PNG image. - */ - SpriteSheetUtils.extractFrame = function(spriteSheet, frameOrAnimation) { - if (isNaN(frameOrAnimation)) { - frameOrAnimation = spriteSheet.getAnimation(frameOrAnimation).frames[0]; - } - var data = spriteSheet.getFrame(frameOrAnimation); - if (!data) { return null; } - var r = data.rect; - var canvas = SpriteSheetUtils._workingCanvas; - canvas.width = r.width; - canvas.height = r.height; - SpriteSheetUtils._workingContext.drawImage(data.image, r.x, r.y, r.width, r.height, 0, 0, r.width, r.height); - var img = document.createElement("img"); - img.src = canvas.toDataURL("image/png"); - return img; - }; - - // SpriteSheetUtils.addFlippedFrames is @deprecated. Remove for 1.1+ - SpriteSheetUtils.addFlippedFrames = createjs.deprecate(null, "SpriteSheetUtils.addFlippedFrames"); - - // SpriteSheetUtils.addFlippedFrames is @deprecated. Remove for 1.1+ - SpriteSheetUtils.mergeAlpha = createjs.deprecate(null, "SpriteSheetUtils.mergeAlpha"); - - -// private static methods: - SpriteSheetUtils._flip = function(spriteSheet, count, h, v) { - var imgs = spriteSheet._images; - var canvas = SpriteSheetUtils._workingCanvas; - var ctx = SpriteSheetUtils._workingContext; - var il = imgs.length/count; - for (var i=0;iWARNING: In almost all cases it is better to display a single frame using a {{#crossLink "Sprite"}}{{/crossLink}} + * with a {{#crossLink "Sprite/gotoAndStop"}}{{/crossLink}} call than it is to slice out a frame using this + * method and display it with a Bitmap instance. You can also crop an image using the {{#crossLink "Bitmap/sourceRect"}}{{/crossLink}} + * property of {{#crossLink "Bitmap"}}{{/crossLink}}. + * + * The extractFrame method may cause cross-domain warnings since it accesses pixels directly on the canvas. + * @method extractFrame + * @static + * @param {SpriteSheet} spriteSheet The SpriteSheet instance to extract a frame from. + * @param {Number|String} frameOrAnimation The frame number or animation name to extract. If an animation + * name is specified, only the first frame of the animation will be extracted. + * @return {HTMLImageElement} a single frame of the specified sprite sheet as a new PNG image. + */ + SpriteSheetUtils.extractFrame = function(spriteSheet, frameOrAnimation) { + if (isNaN(frameOrAnimation)) { + frameOrAnimation = spriteSheet.getAnimation(frameOrAnimation).frames[0]; + } + var data = spriteSheet.getFrame(frameOrAnimation); + if (!data) { return null; } + var r = data.rect; + var canvas = SpriteSheetUtils._workingCanvas; + canvas.width = r.width; + canvas.height = r.height; + SpriteSheetUtils._workingContext.drawImage(data.image, r.x, r.y, r.width, r.height, 0, 0, r.width, r.height); + var img = document.createElement("img"); + img.src = canvas.toDataURL("image/png"); + return img; + }; + + // SpriteSheetUtils.addFlippedFrames is @deprecated. Remove for 1.1+ + SpriteSheetUtils.addFlippedFrames = createjs.deprecate(null, "SpriteSheetUtils.addFlippedFrames"); + + // SpriteSheetUtils.addFlippedFrames is @deprecated. Remove for 1.1+ + SpriteSheetUtils.mergeAlpha = createjs.deprecate(null, "SpriteSheetUtils.mergeAlpha"); + + +// private static methods: + SpriteSheetUtils._flip = function(spriteSheet, count, h, v) { + var imgs = spriteSheet._images; + var canvas = SpriteSheetUtils._workingCanvas; + var ctx = SpriteSheetUtils._workingContext; + var il = imgs.length/count; + for (var i=0;ic;c++)if(b===a[c])return c;return-1},this.createjs=this.createjs||{},function(){"use strict";function a(){throw"UID cannot be instantiated"}a._nextID=0,a.get=function(){return a._nextID++},createjs.UID=a}(),this.createjs=this.createjs||{},createjs.deprecate=function(a,b){"use strict";return function(){var c="Deprecated property or method '"+b+"'. See docs for info.";return console&&(console.warn?console.warn(c):console.log(c)),a&&a.apply(this,arguments)}},this.createjs=this.createjs||{},function(){"use strict";function a(a,b,c){this.type=a,this.target=null,this.currentTarget=null,this.eventPhase=0,this.bubbles=!!b,this.cancelable=!!c,this.timeStamp=(new Date).getTime(),this.defaultPrevented=!1,this.propagationStopped=!1,this.immediatePropagationStopped=!1,this.removed=!1}var b=a.prototype;b.preventDefault=function(){this.defaultPrevented=this.cancelable&&!0},b.stopPropagation=function(){this.propagationStopped=!0},b.stopImmediatePropagation=function(){this.immediatePropagationStopped=this.propagationStopped=!0},b.remove=function(){this.removed=!0},b.clone=function(){return new a(this.type,this.bubbles,this.cancelable)},b.set=function(a){for(var b in a)this[b]=a[b];return this},b.toString=function(){return"[Event (type="+this.type+")]"},createjs.Event=a}(),this.createjs=this.createjs||{},function(){"use strict";function a(){this._listeners=null,this._captureListeners=null}var b=a.prototype;a.initialize=function(a){a.addEventListener=b.addEventListener,a.on=b.on,a.removeEventListener=a.off=b.removeEventListener,a.removeAllEventListeners=b.removeAllEventListeners,a.hasEventListener=b.hasEventListener,a.dispatchEvent=b.dispatchEvent,a._dispatchEvent=b._dispatchEvent,a.willTrigger=b.willTrigger},b.addEventListener=function(a,b,c){var d;d=c?this._captureListeners=this._captureListeners||{}:this._listeners=this._listeners||{};var e=d[a];return e&&this.removeEventListener(a,b,c),e=d[a],e?e.push(b):d[a]=[b],b},b.on=function(a,b,c,d,e,f){return b.handleEvent&&(c=c||b,b=b.handleEvent),c=c||this,this.addEventListener(a,function(a){b.call(c,a,e),d&&a.remove()},f)},b.removeEventListener=function(a,b,c){var d=c?this._captureListeners:this._listeners;if(d){var e=d[a];if(e)for(var f=0,g=e.length;g>f;f++)if(e[f]==b){1==g?delete d[a]:e.splice(f,1);break}}},b.off=b.removeEventListener,b.removeAllEventListeners=function(a){a?(this._listeners&&delete this._listeners[a],this._captureListeners&&delete this._captureListeners[a]):this._listeners=this._captureListeners=null},b.dispatchEvent=function(a,b,c){if("string"==typeof a){var d=this._listeners;if(!(b||d&&d[a]))return!0;a=new createjs.Event(a,b,c)}else a.target&&a.clone&&(a=a.clone());try{a.target=this}catch(e){}if(a.bubbles&&this.parent){for(var f=this,g=[f];f.parent;)g.push(f=f.parent);var h,i=g.length;for(h=i-1;h>=0&&!a.propagationStopped;h--)g[h]._dispatchEvent(a,1+(0==h));for(h=1;i>h&&!a.propagationStopped;h++)g[h]._dispatchEvent(a,3)}else this._dispatchEvent(a,2);return!a.defaultPrevented},b.hasEventListener=function(a){var b=this._listeners,c=this._captureListeners;return!!(b&&b[a]||c&&c[a])},b.willTrigger=function(a){for(var b=this;b;){if(b.hasEventListener(a))return!0;b=b.parent}return!1},b.toString=function(){return"[EventDispatcher]"},b._dispatchEvent=function(a,b){var c,d,e=2>=b?this._captureListeners:this._listeners;if(a&&e&&(d=e[a.type])&&(c=d.length)){try{a.currentTarget=this}catch(f){}try{a.eventPhase=0|b}catch(f){}a.removed=!1,d=d.slice();for(var g=0;c>g&&!a.immediatePropagationStopped;g++){var h=d[g];h.handleEvent?h.handleEvent(a):h(a),a.removed&&(this.off(a.type,h,1==b),a.removed=!1)}}2===b&&this._dispatchEvent(a,2.1)},createjs.EventDispatcher=a}(),this.createjs=this.createjs||{},function(){"use strict";function a(){throw"Ticker cannot be instantiated."}a.RAF_SYNCHED="synched",a.RAF="raf",a.TIMEOUT="timeout",a.timingMode=null,a.maxDelta=0,a.paused=!1,a.removeEventListener=null,a.removeAllEventListeners=null,a.dispatchEvent=null,a.hasEventListener=null,a._listeners=null,createjs.EventDispatcher.initialize(a),a._addEventListener=a.addEventListener,a.addEventListener=function(){return!a._inited&&a.init(),a._addEventListener.apply(a,arguments)},a._inited=!1,a._startTime=0,a._pausedTime=0,a._ticks=0,a._pausedTicks=0,a._interval=50,a._lastTime=0,a._times=null,a._tickTimes=null,a._timerId=null,a._raf=!0,a._setInterval=function(b){a._interval=b,a._inited&&a._setupTick()},a.setInterval=createjs.deprecate(a._setInterval,"Ticker.setInterval"),a._getInterval=function(){return a._interval},a.getInterval=createjs.deprecate(a._getInterval,"Ticker.getInterval"),a._setFPS=function(b){a._setInterval(1e3/b)},a.setFPS=createjs.deprecate(a._setFPS,"Ticker.setFPS"),a._getFPS=function(){return 1e3/a._interval},a.getFPS=createjs.deprecate(a._getFPS,"Ticker.getFPS");try{Object.defineProperties(a,{interval:{get:a._getInterval,set:a._setInterval},framerate:{get:a._getFPS,set:a._setFPS}})}catch(b){console.log(b)}a.init=function(){a._inited||(a._inited=!0,a._times=[],a._tickTimes=[],a._startTime=a._getTime(),a._times.push(a._lastTime=0),a.interval=a._interval)},a.reset=function(){if(a._raf){var b=window.cancelAnimationFrame||window.webkitCancelAnimationFrame||window.mozCancelAnimationFrame||window.oCancelAnimationFrame||window.msCancelAnimationFrame;b&&b(a._timerId)}else clearTimeout(a._timerId);a.removeAllEventListeners("tick"),a._timerId=a._times=a._tickTimes=null,a._startTime=a._lastTime=a._ticks=a._pausedTime=0,a._inited=!1},a.getMeasuredTickTime=function(b){var c=0,d=a._tickTimes;if(!d||d.length<1)return-1;b=Math.min(d.length,b||0|a._getFPS());for(var e=0;b>e;e++)c+=d[e];return c/b},a.getMeasuredFPS=function(b){var c=a._times;return!c||c.length<2?-1:(b=Math.min(c.length-1,b||0|a._getFPS()),1e3/((c[0]-c[b])/b))},a.getTime=function(b){return a._startTime?a._getTime()-(b?a._pausedTime:0):-1},a.getEventTime=function(b){return a._startTime?(a._lastTime||a._startTime)-(b?a._pausedTime:0):-1},a.getTicks=function(b){return a._ticks-(b?a._pausedTicks:0)},a._handleSynch=function(){a._timerId=null,a._setupTick(),a._getTime()-a._lastTime>=.97*(a._interval-1)&&a._tick()},a._handleRAF=function(){a._timerId=null,a._setupTick(),a._tick()},a._handleTimeout=function(){a._timerId=null,a._setupTick(),a._tick()},a._setupTick=function(){if(null==a._timerId){var b=a.timingMode;if(b==a.RAF_SYNCHED||b==a.RAF){var c=window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||window.oRequestAnimationFrame||window.msRequestAnimationFrame;if(c)return a._timerId=c(b==a.RAF?a._handleRAF:a._handleSynch),void(a._raf=!0)}a._raf=!1,a._timerId=setTimeout(a._handleTimeout,a._interval)}},a._tick=function(){var b=a.paused,c=a._getTime(),d=c-a._lastTime;if(a._lastTime=c,a._ticks++,b&&(a._pausedTicks++,a._pausedTime+=d),a.hasEventListener("tick")){var e=new createjs.Event("tick"),f=a.maxDelta;e.delta=f&&d>f?f:d,e.paused=b,e.time=c,e.runTime=c-a._pausedTime,a.dispatchEvent(e)}for(a._tickTimes.unshift(a._getTime()-c);a._tickTimes.length>100;)a._tickTimes.pop();for(a._times.unshift(c);a._times.length>100;)a._times.pop()};var c=window,d=c.performance.now||c.performance.mozNow||c.performance.msNow||c.performance.oNow||c.performance.webkitNow;a._getTime=function(){return(d&&d.call(c.performance)||(new Date).getTime())-a._startTime},createjs.Ticker=a}(),this.createjs=this.createjs||{},function(){"use strict";function a(a){this.readyState=a.readyState,this._video=a,this._canvas=null,this._lastTime=-1,this.readyState<2&&a.addEventListener("canplaythrough",this._videoReady.bind(this))}var b=a.prototype;b.getImage=function(){if(!(this.readyState<2)){var a=this._canvas,b=this._video;if(a||(a=this._canvas=createjs.createCanvas?createjs.createCanvas():document.createElement("canvas"),a.width=b.videoWidth,a.height=b.videoHeight),b.readyState>=2&&b.currentTime!==this._lastTime){var c=a.getContext("2d");c.clearRect(0,0,a.width,a.height),c.drawImage(b,0,0,a.width,a.height),this._lastTime=b.currentTime}return a}},b._videoReady=function(){this.readyState=2},createjs.VideoBuffer=a}(),this.createjs=this.createjs||{},function(){"use strict";function a(a,b,c,d,e,f,g,h,i,j,k){this.Event_constructor(a,b,c),this.stageX=d,this.stageY=e,this.rawX=null==i?d:i,this.rawY=null==j?e:j,this.nativeEvent=f,this.pointerID=g,this.primary=!!h,this.relatedTarget=k}var b=createjs.extend(a,createjs.Event);b._get_localX=function(){return this.currentTarget.globalToLocal(this.rawX,this.rawY).x},b._get_localY=function(){return this.currentTarget.globalToLocal(this.rawX,this.rawY).y},b._get_isTouch=function(){return-1!==this.pointerID};try{Object.defineProperties(b,{localX:{get:b._get_localX},localY:{get:b._get_localY},isTouch:{get:b._get_isTouch}})}catch(c){}b.clone=function(){return new a(this.type,this.bubbles,this.cancelable,this.stageX,this.stageY,this.nativeEvent,this.pointerID,this.primary,this.rawX,this.rawY)},b.toString=function(){return"[MouseEvent (type="+this.type+" stageX="+this.stageX+" stageY="+this.stageY+")]"},createjs.MouseEvent=createjs.promote(a,"Event")}(),this.createjs=this.createjs||{},function(){"use strict";function a(a,b,c,d,e,f){this.setValues(a,b,c,d,e,f)}var b=a.prototype;a.DEG_TO_RAD=Math.PI/180,a.identity=null,b.setValues=function(a,b,c,d,e,f){return this.a=null==a?1:a,this.b=b||0,this.c=c||0,this.d=null==d?1:d,this.tx=e||0,this.ty=f||0,this},b.append=function(a,b,c,d,e,f){var g=this.a,h=this.b,i=this.c,j=this.d;return(1!=a||0!=b||0!=c||1!=d)&&(this.a=g*a+i*b,this.b=h*a+j*b,this.c=g*c+i*d,this.d=h*c+j*d),this.tx=g*e+i*f+this.tx,this.ty=h*e+j*f+this.ty,this},b.prepend=function(a,b,c,d,e,f){var g=this.a,h=this.c,i=this.tx;return this.a=a*g+c*this.b,this.b=b*g+d*this.b,this.c=a*h+c*this.d,this.d=b*h+d*this.d,this.tx=a*i+c*this.ty+e,this.ty=b*i+d*this.ty+f,this},b.appendMatrix=function(a){return this.append(a.a,a.b,a.c,a.d,a.tx,a.ty)},b.prependMatrix=function(a){return this.prepend(a.a,a.b,a.c,a.d,a.tx,a.ty)},b.appendTransform=function(b,c,d,e,f,g,h,i,j){if(f%360)var k=f*a.DEG_TO_RAD,l=Math.cos(k),m=Math.sin(k);else l=1,m=0;return g||h?(g*=a.DEG_TO_RAD,h*=a.DEG_TO_RAD,this.append(Math.cos(h),Math.sin(h),-Math.sin(g),Math.cos(g),b,c),this.append(l*d,m*d,-m*e,l*e,0,0)):this.append(l*d,m*d,-m*e,l*e,b,c),(i||j)&&(this.tx-=i*this.a+j*this.c,this.ty-=i*this.b+j*this.d),this},b.prependTransform=function(b,c,d,e,f,g,h,i,j){if(f%360)var k=f*a.DEG_TO_RAD,l=Math.cos(k),m=Math.sin(k);else l=1,m=0;return(i||j)&&(this.tx-=i,this.ty-=j),g||h?(g*=a.DEG_TO_RAD,h*=a.DEG_TO_RAD,this.prepend(l*d,m*d,-m*e,l*e,0,0),this.prepend(Math.cos(h),Math.sin(h),-Math.sin(g),Math.cos(g),b,c)):this.prepend(l*d,m*d,-m*e,l*e,b,c),this},b.rotate=function(b){b*=a.DEG_TO_RAD;var c=Math.cos(b),d=Math.sin(b),e=this.a,f=this.b;return this.a=e*c+this.c*d,this.b=f*c+this.d*d,this.c=-e*d+this.c*c,this.d=-f*d+this.d*c,this},b.skew=function(b,c){return b*=a.DEG_TO_RAD,c*=a.DEG_TO_RAD,this.append(Math.cos(c),Math.sin(c),-Math.sin(b),Math.cos(b),0,0),this},b.scale=function(a,b){return this.a*=a,this.b*=a,this.c*=b,this.d*=b,this},b.translate=function(a,b){return this.tx+=this.a*a+this.c*b,this.ty+=this.b*a+this.d*b,this},b.identity=function(){return this.a=this.d=1,this.b=this.c=this.tx=this.ty=0,this},b.invert=function(){var a=this.a,b=this.b,c=this.c,d=this.d,e=this.tx,f=a*d-b*c;return this.a=d/f,this.b=-b/f,this.c=-c/f,this.d=a/f,this.tx=(c*this.ty-d*e)/f,this.ty=-(a*this.ty-b*e)/f,this},b.isIdentity=function(){return 0===this.tx&&0===this.ty&&1===this.a&&0===this.b&&0===this.c&&1===this.d},b.equals=function(a){return this.tx===a.tx&&this.ty===a.ty&&this.a===a.a&&this.b===a.b&&this.c===a.c&&this.d===a.d},b.transformPoint=function(a,b,c){return c=c||{},c.x=a*this.a+b*this.c+this.tx,c.y=a*this.b+b*this.d+this.ty,c},b.decompose=function(b){null==b&&(b={}),b.x=this.tx,b.y=this.ty,b.scaleX=Math.sqrt(this.a*this.a+this.b*this.b),b.scaleY=Math.sqrt(this.c*this.c+this.d*this.d);var c=Math.atan2(-this.c,this.d),d=Math.atan2(this.b,this.a),e=Math.abs(1-c/d);return 1e-5>e?(b.rotation=d/a.DEG_TO_RAD,this.a<0&&this.d>=0&&(b.rotation+=b.rotation<=0?180:-180),b.skewX=b.skewY=0):(b.skewX=c/a.DEG_TO_RAD,b.skewY=d/a.DEG_TO_RAD),b},b.copy=function(a){return this.setValues(a.a,a.b,a.c,a.d,a.tx,a.ty)},b.clone=function(){return new a(this.a,this.b,this.c,this.d,this.tx,this.ty)},b.toString=function(){return"[Matrix2D (a="+this.a+" b="+this.b+" c="+this.c+" d="+this.d+" tx="+this.tx+" ty="+this.ty+")]"},a.identity=new a,createjs.Matrix2D=a}(),this.createjs=this.createjs||{},function(){"use strict";function a(a,b,c,d,e){this.setValues(a,b,c,d,e)}var b=a.prototype;b.setValues=function(a,b,c,d,e){return this.visible=null==a?!0:!!a,this.alpha=null==b?1:b,this.shadow=c,this.compositeOperation=d,this.matrix=e||this.matrix&&this.matrix.identity()||new createjs.Matrix2D,this},b.append=function(a,b,c,d,e){return this.alpha*=b,this.shadow=c||this.shadow,this.compositeOperation=d||this.compositeOperation,this.visible=this.visible&&a,e&&this.matrix.appendMatrix(e),this},b.prepend=function(a,b,c,d,e){return this.alpha*=b,this.shadow=this.shadow||c,this.compositeOperation=this.compositeOperation||d,this.visible=this.visible&&a,e&&this.matrix.prependMatrix(e),this},b.identity=function(){return this.visible=!0,this.alpha=1,this.shadow=this.compositeOperation=null,this.matrix.identity(),this},b.clone=function(){return new a(this.alpha,this.shadow,this.compositeOperation,this.visible,this.matrix.clone())},createjs.DisplayProps=a}(),this.createjs=this.createjs||{},function(){"use strict";function a(a,b){this.setValues(a,b)}var b=a.prototype;b.setValues=function(a,b){return this.x=a||0,this.y=b||0,this},b.copy=function(a){return this.x=a.x,this.y=a.y,this},b.clone=function(){return new a(this.x,this.y)},b.toString=function(){return"[Point (x="+this.x+" y="+this.y+")]"},createjs.Point=a}(),this.createjs=this.createjs||{},function(){"use strict";function a(a,b,c,d){this.setValues(a,b,c,d)}var b=a.prototype;b.setValues=function(a,b,c,d){return this.x=a||0,this.y=b||0,this.width=c||0,this.height=d||0,this},b.extend=function(a,b,c,d){return c=c||0,d=d||0,a+c>this.x+this.width&&(this.width=a+c-this.x),b+d>this.y+this.height&&(this.height=b+d-this.y),a=this.x&&a+c<=this.x+this.width&&b>=this.y&&b+d<=this.y+this.height},b.union=function(a){return this.clone().extend(a.x,a.y,a.width,a.height)},b.intersection=function(b){var c=b.x,d=b.y,e=c+b.width,f=d+b.height;return this.x>c&&(c=this.x),this.y>d&&(d=this.y),this.x+this.width=e||d>=f?null:new a(c,d,e-c,f-d)},b.intersects=function(a){return a.x<=this.x+this.width&&this.x<=a.x+a.width&&a.y<=this.y+this.height&&this.y<=a.y+a.height},b.isEmpty=function(){return this.width<=0||this.height<=0},b.clone=function(){return new a(this.x,this.y,this.width,this.height)},b.toString=function(){return"[Rectangle (x="+this.x+" y="+this.y+" width="+this.width+" height="+this.height+")]"},createjs.Rectangle=a}(),this.createjs=this.createjs||{},function(){"use strict";function a(a,b,c,d,e,f,g){a.addEventListener&&(this.target=a,this.overLabel=null==c?"over":c,this.outLabel=null==b?"out":b,this.downLabel=null==d?"down":d,this.play=e,this._isPressed=!1,this._isOver=!1,this._enabled=!1,a.mouseChildren=!1,this.enabled=!0,this.handleEvent({}),f&&(g&&(f.actionsEnabled=!1,f.gotoAndStop&&f.gotoAndStop(g)),a.hitArea=f))}var b=a.prototype;b._setEnabled=function(a){if(a!=this._enabled){var b=this.target;this._enabled=a,a?(b.cursor="pointer",b.addEventListener("rollover",this),b.addEventListener("rollout",this),b.addEventListener("mousedown",this),b.addEventListener("pressup",this),b._reset&&(b.__reset=b._reset,b._reset=this._reset)):(b.cursor=null,b.removeEventListener("rollover",this),b.removeEventListener("rollout",this),b.removeEventListener("mousedown",this),b.removeEventListener("pressup",this),b.__reset&&(b._reset=b.__reset,delete b.__reset))}},b.setEnabled=createjs.deprecate(b._setEnabled,"ButtonHelper.setEnabled"),b._getEnabled=function(){return this._enabled},b.getEnabled=createjs.deprecate(b._getEnabled,"ButtonHelper.getEnabled");try{Object.defineProperties(b,{enabled:{get:b._getEnabled,set:b._setEnabled}})}catch(c){}b.toString=function(){return"[ButtonHelper]"},b.handleEvent=function(a){var b,c=this.target,d=a.type;"mousedown"==d?(this._isPressed=!0,b=this.downLabel):"pressup"==d?(this._isPressed=!1,b=this._isOver?this.overLabel:this.outLabel):"rollover"==d?(this._isOver=!0,b=this._isPressed?this.downLabel:this.overLabel):(this._isOver=!1,b=this._isPressed?this.overLabel:this.outLabel),this.play?c.gotoAndPlay&&c.gotoAndPlay(b):c.gotoAndStop&&c.gotoAndStop(b)},b._reset=function(){var a=this.paused;this.__reset(),this.paused=a},createjs.ButtonHelper=a}(),this.createjs=this.createjs||{},function(){"use strict";function a(a,b,c,d){this.color=a||"black",this.offsetX=b||0,this.offsetY=c||0,this.blur=d||0}var b=a.prototype;a.identity=new a("transparent",0,0,0),b.toString=function(){return"[Shadow]"},b.clone=function(){return new a(this.color,this.offsetX,this.offsetY,this.blur)},createjs.Shadow=a}(),this.createjs=this.createjs||{},function(){"use strict";function a(a){this.EventDispatcher_constructor(),this.complete=!0,this.framerate=0,this._animations=null,this._frames=null,this._images=null,this._data=null,this._loadCount=0,this._frameHeight=0,this._frameWidth=0,this._numFrames=0,this._regX=0,this._regY=0,this._spacing=0,this._margin=0,this._parseData(a)}var b=createjs.extend(a,createjs.EventDispatcher);b._getAnimations=function(){return this._animations.slice()},b.getAnimations=createjs.deprecate(b._getAnimations,"SpriteSheet.getAnimations");try{Object.defineProperties(b,{animations:{get:b._getAnimations}})}catch(c){}b.getNumFrames=function(a){if(null==a)return this._frames?this._frames.length:this._numFrames||0;var b=this._data[a];return null==b?0:b.frames.length},b.getAnimation=function(a){return this._data[a]},b.getFrame=function(a){var b;return this._frames&&(b=this._frames[a])?b:null},b.getFrameBounds=function(a,b){var c=this.getFrame(a);return c?(b||new createjs.Rectangle).setValues(-c.regX,-c.regY,c.rect.width,c.rect.height):null},b.toString=function(){return"[SpriteSheet]"},b.clone=function(){throw"SpriteSheet cannot be cloned."},b._parseData=function(a){var b,c,d,e;if(null!=a){if(this.framerate=a.framerate||0,a.images&&(c=a.images.length)>0)for(e=this._images=[],b=0;c>b;b++){var f=a.images[b];if("string"==typeof f){var g=f;f=document.createElement("img"),f.src=g}e.push(f),f.getContext||f.naturalWidth||(this._loadCount++,this.complete=!1,function(a,b){f.onload=function(){a._handleImageLoad(b)}}(this,g),function(a,b){f.onerror=function(){a._handleImageError(b)}}(this,g))}if(null==a.frames);else if(Array.isArray(a.frames))for(this._frames=[],e=a.frames,b=0,c=e.length;c>b;b++){var h=e[b];this._frames.push({image:this._images[h[4]?h[4]:0],rect:new createjs.Rectangle(h[0],h[1],h[2],h[3]),regX:h[5]||0,regY:h[6]||0})}else d=a.frames,this._frameWidth=d.width,this._frameHeight=d.height,this._regX=d.regX||0,this._regY=d.regY||0,this._spacing=d.spacing||0,this._margin=d.margin||0,this._numFrames=d.count,0==this._loadCount&&this._calculateFrames();if(this._animations=[],null!=(d=a.animations)){this._data={};var i;for(i in d){var j={name:i},k=d[i];if("number"==typeof k)e=j.frames=[k];else if(Array.isArray(k))if(1==k.length)j.frames=[k[0]];else for(j.speed=k[3],j.next=k[2],e=j.frames=[],b=k[0];b<=k[1];b++)e.push(b);else{j.speed=k.speed,j.next=k.next;var l=k.frames;e=j.frames="number"==typeof l?[l]:l.slice(0)}(j.next===!0||void 0===j.next)&&(j.next=i),(j.next===!1||e.length<2&&j.next==i)&&(j.next=null),j.speed||(j.speed=1),this._animations.push(i),this._data[i]=j}}}},b._handleImageLoad=function(){0==--this._loadCount&&(this._calculateFrames(),this.complete=!0,this.dispatchEvent("complete"))},b._handleImageError=function(a){var b=new createjs.Event("error");b.src=a,this.dispatchEvent(b),0==--this._loadCount&&this.dispatchEvent("complete")},b._calculateFrames=function(){if(!this._frames&&0!=this._frameWidth){this._frames=[];var a=this._numFrames||1e5,b=0,c=this._frameWidth,d=this._frameHeight,e=this._spacing,f=this._margin;a:for(var g=0,h=this._images;g=l;){for(var m=f;j-f-c>=m;){if(b>=a)break a;b++,this._frames.push({image:i,rect:new createjs.Rectangle(m,l,c,d),regX:this._regX,regY:this._regY}),m+=c+e}l+=d+e}this._numFrames=b}},createjs.SpriteSheet=createjs.promote(a,"EventDispatcher")}(),this.createjs=this.createjs||{},function(){"use strict";function a(){this.command=null,this._stroke=null,this._strokeStyle=null,this._oldStrokeStyle=null,this._strokeDash=null,this._oldStrokeDash=null,this._strokeIgnoreScale=!1,this._fill=null,this._instructions=[],this._commitIndex=0,this._activeInstructions=[],this._dirty=!1,this._storeIndex=0,this.clear()}var b=a.prototype,c=a;a.getRGB=function(a,b,c,d){return null!=a&&null==c&&(d=b,c=255&a,b=a>>8&255,a=a>>16&255),null==d?"rgb("+a+","+b+","+c+")":"rgba("+a+","+b+","+c+","+d+")"},a.getHSL=function(a,b,c,d){return null==d?"hsl("+a%360+","+b+"%,"+c+"%)":"hsla("+a%360+","+b+"%,"+c+"%,"+d+")"},a.BASE_64={A:0,B:1,C:2,D:3,E:4,F:5,G:6,H:7,I:8,J:9,K:10,L:11,M:12,N:13,O:14,P:15,Q:16,R:17,S:18,T:19,U:20,V:21,W:22,X:23,Y:24,Z:25,a:26,b:27,c:28,d:29,e:30,f:31,g:32,h:33,i:34,j:35,k:36,l:37,m:38,n:39,o:40,p:41,q:42,r:43,s:44,t:45,u:46,v:47,w:48,x:49,y:50,z:51,0:52,1:53,2:54,3:55,4:56,5:57,6:58,7:59,8:60,9:61,"+":62,"/":63},a.STROKE_CAPS_MAP=["butt","round","square"],a.STROKE_JOINTS_MAP=["miter","round","bevel"];var d=createjs.createCanvas?createjs.createCanvas():document.createElement("canvas");d.getContext&&(a._ctx=d.getContext("2d"),d.width=d.height=1),b._getInstructions=function(){return this._updateInstructions(),this._instructions},b.getInstructions=createjs.deprecate(b._getInstructions,"Graphics.getInstructions");try{Object.defineProperties(b,{instructions:{get:b._getInstructions}})}catch(e){}b.isEmpty=function(){return!(this._instructions.length||this._activeInstructions.length)},b.draw=function(a,b){this._updateInstructions();for(var c=this._instructions,d=this._storeIndex,e=c.length;e>d;d++)c[d].exec(a,b)},b.drawAsPath=function(a){this._updateInstructions();for(var b,c=this._instructions,d=this._storeIndex,e=c.length;e>d;d++)(b=c[d]).path!==!1&&b.exec(a)},b.moveTo=function(a,b){return this.append(new c.MoveTo(a,b),!0)},b.lineTo=function(a,b){return this.append(new c.LineTo(a,b))},b.arcTo=function(a,b,d,e,f){return this.append(new c.ArcTo(a,b,d,e,f))},b.arc=function(a,b,d,e,f,g){return this.append(new c.Arc(a,b,d,e,f,g))},b.quadraticCurveTo=function(a,b,d,e){return this.append(new c.QuadraticCurveTo(a,b,d,e))},b.bezierCurveTo=function(a,b,d,e,f,g){return this.append(new c.BezierCurveTo(a,b,d,e,f,g))},b.rect=function(a,b,d,e){return this.append(new c.Rect(a,b,d,e))},b.closePath=function(){return this._activeInstructions.length?this.append(new c.ClosePath):this},b.clear=function(){return this._instructions.length=this._activeInstructions.length=this._commitIndex=0,this._strokeStyle=this._oldStrokeStyle=this._stroke=this._fill=this._strokeDash=this._oldStrokeDash=null,this._dirty=this._strokeIgnoreScale=!1,this},b.beginFill=function(a){return this._setFill(a?new c.Fill(a):null)},b.beginLinearGradientFill=function(a,b,d,e,f,g){return this._setFill((new c.Fill).linearGradient(a,b,d,e,f,g))},b.beginRadialGradientFill=function(a,b,d,e,f,g,h,i){return this._setFill((new c.Fill).radialGradient(a,b,d,e,f,g,h,i))},b.beginBitmapFill=function(a,b,d){return this._setFill(new c.Fill(null,d).bitmap(a,b))},b.endFill=function(){return this.beginFill()},b.setStrokeStyle=function(a,b,d,e,f){return this._updateInstructions(!0),this._strokeStyle=this.command=new c.StrokeStyle(a,b,d,e,f),this._stroke&&(this._stroke.ignoreScale=f),this._strokeIgnoreScale=f,this},b.setStrokeDash=function(a,b){return this._updateInstructions(!0),this._strokeDash=this.command=new c.StrokeDash(a,b),this},b.beginStroke=function(a){return this._setStroke(a?new c.Stroke(a):null)},b.beginLinearGradientStroke=function(a,b,d,e,f,g){return this._setStroke((new c.Stroke).linearGradient(a,b,d,e,f,g))},b.beginRadialGradientStroke=function(a,b,d,e,f,g,h,i){return this._setStroke((new c.Stroke).radialGradient(a,b,d,e,f,g,h,i))},b.beginBitmapStroke=function(a,b){return this._setStroke((new c.Stroke).bitmap(a,b))},b.endStroke=function(){return this.beginStroke()},b.curveTo=b.quadraticCurveTo,b.drawRect=b.rect,b.drawRoundRect=function(a,b,c,d,e){return this.drawRoundRectComplex(a,b,c,d,e,e,e,e)},b.drawRoundRectComplex=function(a,b,d,e,f,g,h,i){return this.append(new c.RoundRect(a,b,d,e,f,g,h,i))},b.drawCircle=function(a,b,d){return this.append(new c.Circle(a,b,d))},b.drawEllipse=function(a,b,d,e){return this.append(new c.Ellipse(a,b,d,e))},b.drawPolyStar=function(a,b,d,e,f,g){return this.append(new c.PolyStar(a,b,d,e,f,g))},b.append=function(a,b){return this._activeInstructions.push(a),this.command=a,b||(this._dirty=!0),this},b.decodePath=function(b){for(var c=[this.moveTo,this.lineTo,this.quadraticCurveTo,this.bezierCurveTo,this.closePath],d=[2,2,4,6,0],e=0,f=b.length,g=[],h=0,i=0,j=a.BASE_64;f>e;){var k=b.charAt(e),l=j[k],m=l>>3,n=c[m];if(!n||3&l)throw"bad path data (@"+e+"): "+k;var o=d[m];m||(h=i=0),g.length=0,e++;for(var p=(l>>2&1)+2,q=0;o>q;q++){var r=j[b.charAt(e)],s=r>>5?-1:1;r=(31&r)<<6|j[b.charAt(e+1)],3==p&&(r=r<<6|j[b.charAt(e+2)]),r=s*r/10,q%2?h=r+=h:i=r+=i,g[q]=r,e+=p}n.apply(this,g)}return this},b.store=function(){return this._updateInstructions(!0),this._storeIndex=this._instructions.length,this},b.unstore=function(){return this._storeIndex=0,this},b.clone=function(){var b=new a;return b.command=this.command,b._stroke=this._stroke,b._strokeStyle=this._strokeStyle,b._strokeDash=this._strokeDash,b._strokeIgnoreScale=this._strokeIgnoreScale,b._fill=this._fill,b._instructions=this._instructions.slice(),b._commitIndex=this._commitIndex,b._activeInstructions=this._activeInstructions.slice(),b._dirty=this._dirty,b._storeIndex=this._storeIndex,b},b.toString=function(){return"[Graphics]"},b.mt=b.moveTo,b.lt=b.lineTo,b.at=b.arcTo,b.bt=b.bezierCurveTo,b.qt=b.quadraticCurveTo,b.a=b.arc,b.r=b.rect,b.cp=b.closePath,b.c=b.clear,b.f=b.beginFill,b.lf=b.beginLinearGradientFill,b.rf=b.beginRadialGradientFill,b.bf=b.beginBitmapFill,b.ef=b.endFill,b.ss=b.setStrokeStyle,b.sd=b.setStrokeDash,b.s=b.beginStroke,b.ls=b.beginLinearGradientStroke,b.rs=b.beginRadialGradientStroke,b.bs=b.beginBitmapStroke,b.es=b.endStroke,b.dr=b.drawRect,b.rr=b.drawRoundRect,b.rc=b.drawRoundRectComplex,b.dc=b.drawCircle,b.de=b.drawEllipse,b.dp=b.drawPolyStar,b.p=b.decodePath,b._updateInstructions=function(b){var c=this._instructions,d=this._activeInstructions,e=this._commitIndex;if(this._dirty&&d.length){c.length=e,c.push(a.beginCmd);var f=d.length,g=c.length;c.length=g+f;for(var h=0;f>h;h++)c[h+g]=d[h];this._fill&&c.push(this._fill),this._stroke&&(this._strokeDash!==this._oldStrokeDash&&c.push(this._strokeDash),this._strokeStyle!==this._oldStrokeStyle&&c.push(this._strokeStyle),b&&(this._oldStrokeStyle=this._strokeStyle,this._oldStrokeDash=this._strokeDash),c.push(this._stroke)),this._dirty=!1}b&&(d.length=0,this._commitIndex=c.length)},b._setFill=function(a){return this._updateInstructions(!0),this.command=this._fill=a,this},b._setStroke=function(a){return this._updateInstructions(!0),(this.command=this._stroke=a)&&(a.ignoreScale=this._strokeIgnoreScale),this},(c.LineTo=function(a,b){this.x=a,this.y=b}).prototype.exec=function(a){a.lineTo(this.x,this.y)},(c.MoveTo=function(a,b){this.x=a,this.y=b}).prototype.exec=function(a){a.moveTo(this.x,this.y)},(c.ArcTo=function(a,b,c,d,e){this.x1=a,this.y1=b,this.x2=c,this.y2=d,this.radius=e}).prototype.exec=function(a){a.arcTo(this.x1,this.y1,this.x2,this.y2,this.radius)},(c.Arc=function(a,b,c,d,e,f){this.x=a,this.y=b,this.radius=c,this.startAngle=d,this.endAngle=e,this.anticlockwise=!!f}).prototype.exec=function(a){a.arc(this.x,this.y,this.radius,this.startAngle,this.endAngle,this.anticlockwise)},(c.QuadraticCurveTo=function(a,b,c,d){this.cpx=a,this.cpy=b,this.x=c,this.y=d}).prototype.exec=function(a){a.quadraticCurveTo(this.cpx,this.cpy,this.x,this.y)},(c.BezierCurveTo=function(a,b,c,d,e,f){this.cp1x=a,this.cp1y=b,this.cp2x=c,this.cp2y=d,this.x=e,this.y=f}).prototype.exec=function(a){a.bezierCurveTo(this.cp1x,this.cp1y,this.cp2x,this.cp2y,this.x,this.y)},(c.Rect=function(a,b,c,d){this.x=a,this.y=b,this.w=c,this.h=d}).prototype.exec=function(a){a.rect(this.x,this.y,this.w,this.h)},(c.ClosePath=function(){}).prototype.exec=function(a){a.closePath()},(c.BeginPath=function(){}).prototype.exec=function(a){a.beginPath()},b=(c.Fill=function(a,b){this.style=a,this.matrix=b}).prototype,b.exec=function(a){if(this.style){a.fillStyle=this.style;var b=this.matrix;b&&(a.save(),a.transform(b.a,b.b,b.c,b.d,b.tx,b.ty)),a.fill(),b&&a.restore()}},b.linearGradient=function(b,c,d,e,f,g){for(var h=this.style=a._ctx.createLinearGradient(d,e,f,g),i=0,j=b.length;j>i;i++)h.addColorStop(c[i],b[i]);return h.props={colors:b,ratios:c,x0:d,y0:e,x1:f,y1:g,type:"linear"},this},b.radialGradient=function(b,c,d,e,f,g,h,i){for(var j=this.style=a._ctx.createRadialGradient(d,e,f,g,h,i),k=0,l=b.length;l>k;k++)j.addColorStop(c[k],b[k]);return j.props={colors:b,ratios:c,x0:d,y0:e,r0:f,x1:g,y1:h,r1:i,type:"radial"},this},b.bitmap=function(b,c){if(b.naturalWidth||b.getContext||b.readyState>=2){var d=this.style=a._ctx.createPattern(b,c||"");d.props={image:b,repetition:c,type:"bitmap"}}return this},b.path=!1,b=(c.Stroke=function(a,b){this.style=a,this.ignoreScale=b}).prototype,b.exec=function(a){this.style&&(a.strokeStyle=this.style,this.ignoreScale&&(a.save(),a.setTransform(1,0,0,1,0,0)),a.stroke(),this.ignoreScale&&a.restore())},b.linearGradient=c.Fill.prototype.linearGradient,b.radialGradient=c.Fill.prototype.radialGradient,b.bitmap=c.Fill.prototype.bitmap,b.path=!1,b=(c.StrokeStyle=function(a,b,c,d,e){this.width=a,this.caps=b,this.joints=c,this.miterLimit=d,this.ignoreScale=e}).prototype,b.exec=function(b){b.lineWidth=null==this.width?"1":this.width,b.lineCap=null==this.caps?"butt":isNaN(this.caps)?this.caps:a.STROKE_CAPS_MAP[this.caps],b.lineJoin=null==this.joints?"miter":isNaN(this.joints)?this.joints:a.STROKE_JOINTS_MAP[this.joints],b.miterLimit=null==this.miterLimit?"10":this.miterLimit,b.ignoreScale=null==this.ignoreScale?!1:this.ignoreScale},b.path=!1,(c.StrokeDash=function(a,b){this.segments=a,this.offset=b||0}).prototype.exec=function(a){a.setLineDash&&(a.setLineDash(this.segments||c.StrokeDash.EMPTY_SEGMENTS),a.lineDashOffset=this.offset||0)},c.StrokeDash.EMPTY_SEGMENTS=[],(c.RoundRect=function(a,b,c,d,e,f,g,h){this.x=a,this.y=b,this.w=c,this.h=d,this.radiusTL=e,this.radiusTR=f,this.radiusBR=g,this.radiusBL=h}).prototype.exec=function(a){var b=(j>i?i:j)/2,c=0,d=0,e=0,f=0,g=this.x,h=this.y,i=this.w,j=this.h,k=this.radiusTL,l=this.radiusTR,m=this.radiusBR,n=this.radiusBL;0>k&&(k*=c=-1),k>b&&(k=b),0>l&&(l*=d=-1),l>b&&(l=b),0>m&&(m*=e=-1),m>b&&(m=b),0>n&&(n*=f=-1),n>b&&(n=b),a.moveTo(g+i-l,h),a.arcTo(g+i+l*d,h-l*d,g+i,h+l,l),a.lineTo(g+i,h+j-m),a.arcTo(g+i+m*e,h+j+m*e,g+i-m,h+j,m),a.lineTo(g+n,h+j),a.arcTo(g-n*f,h+j+n*f,g,h+j-n,n),a.lineTo(g,h+k),a.arcTo(g-k*c,h-k*c,g+k,h,k),a.closePath() -},(c.Circle=function(a,b,c){this.x=a,this.y=b,this.radius=c}).prototype.exec=function(a){a.arc(this.x,this.y,this.radius,0,2*Math.PI)},(c.Ellipse=function(a,b,c,d){this.x=a,this.y=b,this.w=c,this.h=d}).prototype.exec=function(a){var b=this.x,c=this.y,d=this.w,e=this.h,f=.5522848,g=d/2*f,h=e/2*f,i=b+d,j=c+e,k=b+d/2,l=c+e/2;a.moveTo(b,l),a.bezierCurveTo(b,l-h,k-g,c,k,c),a.bezierCurveTo(k+g,c,i,l-h,i,l),a.bezierCurveTo(i,l+h,k+g,j,k,j),a.bezierCurveTo(k-g,j,b,l+h,b,l)},(c.PolyStar=function(a,b,c,d,e,f){this.x=a,this.y=b,this.radius=c,this.sides=d,this.pointSize=e,this.angle=f}).prototype.exec=function(a){var b=this.x,c=this.y,d=this.radius,e=(this.angle||0)/180*Math.PI,f=this.sides,g=1-(this.pointSize||0),h=Math.PI/f;a.moveTo(b+Math.cos(e)*d,c+Math.sin(e)*d);for(var i=0;f>i;i++)e+=h,1!=g&&a.lineTo(b+Math.cos(e)*d*g,c+Math.sin(e)*d*g),e+=h,a.lineTo(b+Math.cos(e)*d,c+Math.sin(e)*d);a.closePath()},a.beginCmd=new c.BeginPath,createjs.Graphics=a}(),this.createjs=this.createjs||{},function(){"use strict";function a(){this.EventDispatcher_constructor(),this.alpha=1,this.cacheCanvas=null,this.bitmapCache=null,this.id=createjs.UID.get(),this.mouseEnabled=!0,this.tickEnabled=!0,this.name=null,this.parent=null,this.regX=0,this.regY=0,this.rotation=0,this.scaleX=1,this.scaleY=1,this.skewX=0,this.skewY=0,this.shadow=null,this.visible=!0,this.x=0,this.y=0,this.transformMatrix=null,this.compositeOperation=null,this.snapToPixel=!0,this.filters=null,this.mask=null,this.hitArea=null,this.cursor=null,this._props=new createjs.DisplayProps,this._rectangle=new createjs.Rectangle,this._bounds=null,this._webGLRenderStyle=a._StageGL_NONE}var b=createjs.extend(a,createjs.EventDispatcher);a._MOUSE_EVENTS=["click","dblclick","mousedown","mouseout","mouseover","pressmove","pressup","rollout","rollover"],a.suppressCrossDomainErrors=!1,a._snapToPixelEnabled=!1,a._StageGL_NONE=0,a._StageGL_SPRITE=1,a._StageGL_BITMAP=2;var c=createjs.createCanvas?createjs.createCanvas():document.createElement("canvas");c.getContext&&(a._hitTestCanvas=c,a._hitTestContext=c.getContext("2d"),c.width=c.height=1),b._getStage=function(){for(var a=this,b=createjs.Stage;a.parent;)a=a.parent;return a instanceof b?a:null},b.getStage=createjs.deprecate(b._getStage,"DisplayObject.getStage");try{Object.defineProperties(b,{stage:{get:b._getStage},cacheID:{get:function(){return this.bitmapCache&&this.bitmapCache.cacheID},set:function(a){this.bitmapCache&&(this.bitmapCache.cacheID=a)}},scale:{get:function(){return this.scaleX},set:function(a){this.scaleX=this.scaleY=a}}})}catch(d){}b.isVisible=function(){return!!(this.visible&&this.alpha>0&&0!=this.scaleX&&0!=this.scaleY)},b.draw=function(a,b){var c=this.bitmapCache;return c&&!b?c.draw(a):!1},b.updateContext=function(b){var c=this,d=c.mask,e=c._props.matrix;d&&d.graphics&&!d.graphics.isEmpty()&&(d.getMatrix(e),b.transform(e.a,e.b,e.c,e.d,e.tx,e.ty),d.graphics.drawAsPath(b),b.clip(),e.invert(),b.transform(e.a,e.b,e.c,e.d,e.tx,e.ty)),this.getMatrix(e);var f=e.tx,g=e.ty;a._snapToPixelEnabled&&c.snapToPixel&&(f=f+(0>f?-.5:.5)|0,g=g+(0>g?-.5:.5)|0),b.transform(e.a,e.b,e.c,e.d,f,g),b.globalAlpha*=c.alpha,c.compositeOperation&&(b.globalCompositeOperation=c.compositeOperation),c.shadow&&this._applyShadow(b,c.shadow)},b.cache=function(a,b,c,d,e,f){this.bitmapCache||(this.bitmapCache=new createjs.BitmapCache),this.bitmapCache.define(this,a,b,c,d,e,f)},b.updateCache=function(a){if(!this.bitmapCache)throw"cache() must be called before updateCache()";this.bitmapCache.update(a)},b.uncache=function(){this.bitmapCache&&(this.bitmapCache.release(),this.bitmapCache=void 0)},b.getCacheDataURL=function(){return this.bitmapCache?this.bitmapCache.getDataURL():null},b.localToGlobal=function(a,b,c){return this.getConcatenatedMatrix(this._props.matrix).transformPoint(a,b,c||new createjs.Point)},b.globalToLocal=function(a,b,c){return this.getConcatenatedMatrix(this._props.matrix).invert().transformPoint(a,b,c||new createjs.Point)},b.localToLocal=function(a,b,c,d){return d=this.localToGlobal(a,b,d),c.globalToLocal(d.x,d.y,d)},b.setTransform=function(a,b,c,d,e,f,g,h,i){return this.x=a||0,this.y=b||0,this.scaleX=null==c?1:c,this.scaleY=null==d?1:d,this.rotation=e||0,this.skewX=f||0,this.skewY=g||0,this.regX=h||0,this.regY=i||0,this},b.getMatrix=function(a){var b=this,c=a&&a.identity()||new createjs.Matrix2D;return b.transformMatrix?c.copy(b.transformMatrix):c.appendTransform(b.x,b.y,b.scaleX,b.scaleY,b.rotation,b.skewX,b.skewY,b.regX,b.regY)},b.getConcatenatedMatrix=function(a){for(var b=this,c=this.getMatrix(a);b=b.parent;)c.prependMatrix(b.getMatrix(b._props.matrix));return c},b.getConcatenatedDisplayProps=function(a){a=a?a.identity():new createjs.DisplayProps;var b=this,c=b.getMatrix(a.matrix);do a.prepend(b.visible,b.alpha,b.shadow,b.compositeOperation),b!=this&&c.prependMatrix(b.getMatrix(b._props.matrix));while(b=b.parent);return a},b.hitTest=function(b,c){var d=a._hitTestContext;d.setTransform(1,0,0,1,-b,-c),this.draw(d);var e=this._testHit(d);return d.setTransform(1,0,0,1,0,0),d.clearRect(0,0,2,2),e},b.set=function(a){for(var b in a)this[b]=a[b];return this},b.getBounds=function(){if(this._bounds)return this._rectangle.copy(this._bounds);var a=this.cacheCanvas;if(a){var b=this._cacheScale;return this._rectangle.setValues(this._cacheOffsetX,this._cacheOffsetY,a.width/b,a.height/b)}return null},b.getTransformedBounds=function(){return this._getBounds()},b.setBounds=function(a,b,c,d){return null==a?void(this._bounds=a):void(this._bounds=(this._bounds||new createjs.Rectangle).setValues(a,b,c,d))},b.clone=function(){return this._cloneProps(new a)},b.toString=function(){return"[DisplayObject (name="+this.name+")]"},b._updateState=null,b._cloneProps=function(a){return a.alpha=this.alpha,a.mouseEnabled=this.mouseEnabled,a.tickEnabled=this.tickEnabled,a.name=this.name,a.regX=this.regX,a.regY=this.regY,a.rotation=this.rotation,a.scaleX=this.scaleX,a.scaleY=this.scaleY,a.shadow=this.shadow,a.skewX=this.skewX,a.skewY=this.skewY,a.visible=this.visible,a.x=this.x,a.y=this.y,a.compositeOperation=this.compositeOperation,a.snapToPixel=this.snapToPixel,a.filters=null==this.filters?null:this.filters.slice(0),a.mask=this.mask,a.hitArea=this.hitArea,a.cursor=this.cursor,a._bounds=this._bounds,a},b._applyShadow=function(a,b){b=b||Shadow.identity,a.shadowColor=b.color,a.shadowOffsetX=b.offsetX,a.shadowOffsetY=b.offsetY,a.shadowBlur=b.blur},b._tick=function(a){var b=this._listeners;b&&b.tick&&(a.target=null,a.propagationStopped=a.immediatePropagationStopped=!1,this.dispatchEvent(a))},b._testHit=function(b){try{var c=b.getImageData(0,0,1,1).data[3]>1}catch(d){if(!a.suppressCrossDomainErrors)throw"An error has occurred. This is most likely due to security restrictions on reading canvas pixel data with local or cross-domain images."}return c},b._getBounds=function(a,b){return this._transformBounds(this.getBounds(),a,b)},b._transformBounds=function(a,b,c){if(!a)return a;var d=a.x,e=a.y,f=a.width,g=a.height,h=this._props.matrix;h=c?h.identity():this.getMatrix(h),(d||e)&&h.appendTransform(0,0,1,1,0,0,0,-d,-e),b&&h.prependMatrix(b);var i=f*h.a,j=f*h.b,k=g*h.c,l=g*h.d,m=h.tx,n=h.ty,o=m,p=m,q=n,r=n;return(d=i+m)p&&(p=d),(d=i+k+m)p&&(p=d),(d=k+m)p&&(p=d),(e=j+n)r&&(r=e),(e=j+l+n)r&&(r=e),(e=l+n)r&&(r=e),a.setValues(o,q,p-o,r-q)},b._hasMouseEventListener=function(){for(var b=a._MOUSE_EVENTS,c=0,d=b.length;d>c;c++)if(this.hasEventListener(b[c]))return!0;return!!this.cursor},createjs.DisplayObject=createjs.promote(a,"EventDispatcher")}(),this.createjs=this.createjs||{},function(){"use strict";function a(){this.DisplayObject_constructor(),this.children=[],this.mouseChildren=!0,this.tickChildren=!0}var b=createjs.extend(a,createjs.DisplayObject);b._getNumChildren=function(){return this.children.length},b.getNumChildren=createjs.deprecate(b._getNumChildren,"Container.getNumChildren");try{Object.defineProperties(b,{numChildren:{get:b._getNumChildren}})}catch(c){}b.initialize=a,b.isVisible=function(){var a=this.cacheCanvas||this.children.length;return!!(this.visible&&this.alpha>0&&0!=this.scaleX&&0!=this.scaleY&&a)},b.draw=function(a,b){if(this.DisplayObject_draw(a,b))return!0;for(var c=this.children.slice(),d=0,e=c.length;e>d;d++){var f=c[d];f.isVisible()&&(a.save(),f.updateContext(a),f.draw(a),a.restore())}return!0},b.addChild=function(a){if(null==a)return a;var b=arguments.length;if(b>1){for(var c=0;b>c;c++)this.addChild(arguments[c]);return arguments[b-1]}var d=a.parent,e=d===this;return d&&d._removeChildAt(createjs.indexOf(d.children,a),e),a.parent=this,this.children.push(a),e||a.dispatchEvent("added"),a},b.addChildAt=function(a,b){var c=arguments.length,d=arguments[c-1];if(0>d||d>this.children.length)return arguments[c-2];if(c>2){for(var e=0;c-1>e;e++)this.addChildAt(arguments[e],d+e);return arguments[c-2]}var f=a.parent,g=f===this;return f&&f._removeChildAt(createjs.indexOf(f.children,a),g),a.parent=this,this.children.splice(b,0,a),g||a.dispatchEvent("added"),a},b.removeChild=function(a){var b=arguments.length;if(b>1){for(var c=!0,d=0;b>d;d++)c=c&&this.removeChild(arguments[d]);return c}return this._removeChildAt(createjs.indexOf(this.children,a))},b.removeChildAt=function(a){var b=arguments.length;if(b>1){for(var c=[],d=0;b>d;d++)c[d]=arguments[d];c.sort(function(a,b){return b-a});for(var e=!0,d=0;b>d;d++)e=e&&this._removeChildAt(c[d]);return e}return this._removeChildAt(a)},b.removeAllChildren=function(){for(var a=this.children;a.length;)this._removeChildAt(0)},b.getChildAt=function(a){return this.children[a]},b.getChildByName=function(a){for(var b=this.children,c=0,d=b.length;d>c;c++)if(b[c].name==a)return b[c];return null},b.sortChildren=function(a){this.children.sort(a)},b.getChildIndex=function(a){return createjs.indexOf(this.children,a)},b.swapChildrenAt=function(a,b){var c=this.children,d=c[a],e=c[b];d&&e&&(c[a]=e,c[b]=d)},b.swapChildren=function(a,b){for(var c,d,e=this.children,f=0,g=e.length;g>f&&(e[f]==a&&(c=f),e[f]==b&&(d=f),null==c||null==d);f++);f!=g&&(e[c]=b,e[d]=a)},b.setChildIndex=function(a,b){var c=this.children,d=c.length;if(!(a.parent!=this||0>b||b>=d)){for(var e=0;d>e&&c[e]!=a;e++);e!=d&&e!=b&&(c.splice(e,1),c.splice(b,0,a))}},b.contains=function(a){for(;a;){if(a==this)return!0;a=a.parent}return!1},b.hitTest=function(a,b){return null!=this.getObjectUnderPoint(a,b)},b.getObjectsUnderPoint=function(a,b,c){var d=[],e=this.localToGlobal(a,b);return this._getObjectsUnderPoint(e.x,e.y,d,c>0,1==c),d},b.getObjectUnderPoint=function(a,b,c){var d=this.localToGlobal(a,b);return this._getObjectsUnderPoint(d.x,d.y,null,c>0,1==c)},b.getBounds=function(){return this._getBounds(null,!0)},b.getTransformedBounds=function(){return this._getBounds()},b.clone=function(b){var c=this._cloneProps(new a);return b&&this._cloneChildren(c),c},b.toString=function(){return"[Container (name="+this.name+")]"},b._tick=function(a){if(this.tickChildren)for(var b=this.children.length-1;b>=0;b--){var c=this.children[b];c.tickEnabled&&c._tick&&c._tick(a)}this.DisplayObject__tick(a)},b._cloneChildren=function(a){a.children.length&&a.removeAllChildren();for(var b=a.children,c=0,d=this.children.length;d>c;c++){var e=this.children[c].clone(!0);e.parent=a,b.push(e)}},b._removeChildAt=function(a,b){if(0>a||a>this.children.length-1)return!1;var c=this.children[a];return c&&(c.parent=null),this.children.splice(a,1),b||c.dispatchEvent("removed"),!0},b._getObjectsUnderPoint=function(b,c,d,e,f,g){if(g=g||0,!g&&!this._testMask(this,b,c))return null;var h,i=createjs.DisplayObject._hitTestContext;f=f||e&&this._hasMouseEventListener();for(var j=this.children,k=j.length,l=k-1;l>=0;l--){var m=j[l],n=m.hitArea;if(m.visible&&(n||m.isVisible())&&(!e||m.mouseEnabled)&&(n||this._testMask(m,b,c)))if(!n&&m instanceof a){var o=m._getObjectsUnderPoint(b,c,d,e,f,g+1);if(!d&&o)return e&&!this.mouseChildren?this:o}else{if(e&&!f&&!m._hasMouseEventListener())continue;var p=m.getConcatenatedDisplayProps(m._props);if(h=p.matrix,n&&(h.appendMatrix(n.getMatrix(n._props.matrix)),p.alpha=n.alpha),i.globalAlpha=p.alpha,i.setTransform(h.a,h.b,h.c,h.d,h.tx-b,h.ty-c),(n||m).draw(i),!this._testHit(i))continue;if(i.setTransform(1,0,0,1,0,0),i.clearRect(0,0,2,2),!d)return e&&!this.mouseChildren?this:m;d.push(m)}}return null},b._testMask=function(a,b,c){var d=a.mask;if(!d||!d.graphics||d.graphics.isEmpty())return!0;var e=this._props.matrix,f=a.parent;e=f?f.getConcatenatedMatrix(e):e.identity(),e=d.getMatrix(d._props.matrix).prependMatrix(e);var g=createjs.DisplayObject._hitTestContext;return g.setTransform(e.a,e.b,e.c,e.d,e.tx-b,e.ty-c),d.graphics.drawAsPath(g),g.fillStyle="#000",g.fill(),this._testHit(g)?(g.setTransform(1,0,0,1,0,0),g.clearRect(0,0,2,2),!0):!1},b._getBounds=function(a,b){var c=this.DisplayObject_getBounds();if(c)return this._transformBounds(c,a,b);var d=this._props.matrix;d=b?d.identity():this.getMatrix(d),a&&d.prependMatrix(a);for(var e=this.children.length,f=null,g=0;e>g;g++){var h=this.children[g];h.visible&&(c=h._getBounds(d))&&(f?f.extend(c.x,c.y,c.width,c.height):f=c.clone())}return f},createjs.Container=createjs.promote(a,"DisplayObject")}(),this.createjs=this.createjs||{},function(){"use strict";function a(a){this.Container_constructor(),this.autoClear=!0,this.canvas="string"==typeof a?document.getElementById(a):a,this.mouseX=0,this.mouseY=0,this.drawRect=null,this.snapToPixelEnabled=!1,this.mouseInBounds=!1,this.tickOnUpdate=!0,this.mouseMoveOutside=!1,this.preventSelection=!0,this._pointerData={},this._pointerCount=0,this._primaryPointerID=null,this._mouseOverIntervalID=null,this._nextStage=null,this._prevStage=null,this.enableDOMEvents(!0)}var b=createjs.extend(a,createjs.Container);b._get_nextStage=function(){return this._nextStage},b._set_nextStage=function(a){this._nextStage&&(this._nextStage._prevStage=null),a&&(a._prevStage=this),this._nextStage=a};try{Object.defineProperties(b,{nextStage:{get:b._get_nextStage,set:b._set_nextStage}})}catch(c){}b.update=function(a){if(this.canvas&&(this.tickOnUpdate&&this.tick(a),this.dispatchEvent("drawstart",!1,!0)!==!1)){createjs.DisplayObject._snapToPixelEnabled=this.snapToPixelEnabled;var b=this.drawRect,c=this.canvas.getContext("2d");c.setTransform(1,0,0,1,0,0),this.autoClear&&(b?c.clearRect(b.x,b.y,b.width,b.height):c.clearRect(0,0,this.canvas.width+1,this.canvas.height+1)),c.save(),this.drawRect&&(c.beginPath(),c.rect(b.x,b.y,b.width,b.height),c.clip()),this.updateContext(c),this.draw(c,!1),c.restore(),this.dispatchEvent("drawend")}},b.tick=function(a){if(this.tickEnabled&&this.dispatchEvent("tickstart",!1,!0)!==!1){var b=new createjs.Event("tick");if(a)for(var c in a)a.hasOwnProperty(c)&&(b[c]=a[c]);this._tick(b),this.dispatchEvent("tickend")}},b.handleEvent=function(a){"tick"==a.type&&this.update(a)},b.clear=function(){if(this.canvas){var a=this.canvas.getContext("2d");a.setTransform(1,0,0,1,0,0),a.clearRect(0,0,this.canvas.width+1,this.canvas.height+1)}},b.toDataURL=function(a,b){var c,d=this.canvas.getContext("2d"),e=this.canvas.width,f=this.canvas.height;if(a){c=d.getImageData(0,0,e,f);var g=d.globalCompositeOperation;d.globalCompositeOperation="destination-over",d.fillStyle=a,d.fillRect(0,0,e,f)}var h=this.canvas.toDataURL(b||"image/png");return a&&(d.putImageData(c,0,0),d.globalCompositeOperation=g),h},b.enableMouseOver=function(a){if(this._mouseOverIntervalID&&(clearInterval(this._mouseOverIntervalID),this._mouseOverIntervalID=null,0==a&&this._testMouseOver(!0)),null==a)a=20;else if(0>=a)return;var b=this;this._mouseOverIntervalID=setInterval(function(){b._testMouseOver()},1e3/Math.min(50,a))},b.enableDOMEvents=function(a){null==a&&(a=!0);var b,c,d=this._eventListeners;if(!a&&d){for(b in d)c=d[b],c.t.removeEventListener(b,c.f,!1);this._eventListeners=null}else if(a&&!d&&this.canvas){var e=window.addEventListener?window:document,f=this;d=this._eventListeners={},d.mouseup={t:e,f:function(a){f._handleMouseUp(a)}},d.mousemove={t:e,f:function(a){f._handleMouseMove(a)}},d.dblclick={t:this.canvas,f:function(a){f._handleDoubleClick(a)}},d.mousedown={t:this.canvas,f:function(a){f._handleMouseDown(a)}};for(b in d)c=d[b],c.t.addEventListener(b,c.f,!1)}},b.clone=function(){throw"Stage cannot be cloned."},b.toString=function(){return"[Stage (name="+this.name+")]"},b._getElementRect=function(a){var b;try{b=a.getBoundingClientRect()}catch(c){b={top:a.offsetTop,left:a.offsetLeft,width:a.offsetWidth,height:a.offsetHeight}}var d=(window.pageXOffset||document.scrollLeft||0)-(document.clientLeft||document.body.clientLeft||0),e=(window.pageYOffset||document.scrollTop||0)-(document.clientTop||document.body.clientTop||0),f=window.getComputedStyle?getComputedStyle(a,null):a.currentStyle,g=parseInt(f.paddingLeft)+parseInt(f.borderLeftWidth),h=parseInt(f.paddingTop)+parseInt(f.borderTopWidth),i=parseInt(f.paddingRight)+parseInt(f.borderRightWidth),j=parseInt(f.paddingBottom)+parseInt(f.borderBottomWidth);return{left:b.left+d+g,right:b.right+d-i,top:b.top+e+h,bottom:b.bottom+e-j}},b._getPointerData=function(a){var b=this._pointerData[a];return b||(b=this._pointerData[a]={x:0,y:0}),b},b._handleMouseMove=function(a){a||(a=window.event),this._handlePointerMove(-1,a,a.pageX,a.pageY)},b._handlePointerMove=function(a,b,c,d,e){if((!this._prevStage||void 0!==e)&&this.canvas){var f=this._nextStage,g=this._getPointerData(a),h=g.inBounds;this._updatePointerPosition(a,b,c,d),(h||g.inBounds||this.mouseMoveOutside)&&(-1===a&&g.inBounds==!h&&this._dispatchMouseEvent(this,h?"mouseleave":"mouseenter",!1,a,g,b),this._dispatchMouseEvent(this,"stagemousemove",!1,a,g,b),this._dispatchMouseEvent(g.target,"pressmove",!0,a,g,b)),f&&f._handlePointerMove(a,b,c,d,null)}},b._updatePointerPosition=function(a,b,c,d){var e=this._getElementRect(this.canvas);c-=e.left,d-=e.top;var f=this.canvas.width,g=this.canvas.height;c/=(e.right-e.left)/f,d/=(e.bottom-e.top)/g;var h=this._getPointerData(a);(h.inBounds=c>=0&&d>=0&&f-1>=c&&g-1>=d)?(h.x=c,h.y=d):this.mouseMoveOutside&&(h.x=0>c?0:c>f-1?f-1:c,h.y=0>d?0:d>g-1?g-1:d),h.posEvtObj=b,h.rawX=c,h.rawY=d,(a===this._primaryPointerID||-1===a)&&(this.mouseX=h.x,this.mouseY=h.y,this.mouseInBounds=h.inBounds)},b._handleMouseUp=function(a){this._handlePointerUp(-1,a,!1)},b._handlePointerUp=function(a,b,c,d){var e=this._nextStage,f=this._getPointerData(a);if(!this._prevStage||void 0!==d){var g=null,h=f.target;d||!h&&!e||(g=this._getObjectsUnderPoint(f.x,f.y,null,!0)),f.down&&(this._dispatchMouseEvent(this,"stagemouseup",!1,a,f,b,g),f.down=!1),g==h&&this._dispatchMouseEvent(h,"click",!0,a,f,b),this._dispatchMouseEvent(h,"pressup",!0,a,f,b),c?(a==this._primaryPointerID&&(this._primaryPointerID=null),delete this._pointerData[a]):f.target=null,e&&e._handlePointerUp(a,b,c,d||g&&this)}},b._handleMouseDown=function(a){this._handlePointerDown(-1,a,a.pageX,a.pageY)},b._handlePointerDown=function(a,b,c,d,e){this.preventSelection&&b.preventDefault(),(null==this._primaryPointerID||-1===a)&&(this._primaryPointerID=a),null!=d&&this._updatePointerPosition(a,b,c,d);var f=null,g=this._nextStage,h=this._getPointerData(a);e||(f=h.target=this._getObjectsUnderPoint(h.x,h.y,null,!0)),h.inBounds&&(this._dispatchMouseEvent(this,"stagemousedown",!1,a,h,b,f),h.down=!0),this._dispatchMouseEvent(f,"mousedown",!0,a,h,b),g&&g._handlePointerDown(a,b,c,d,e||f&&this)},b._testMouseOver=function(a,b,c){if(!this._prevStage||void 0!==b){var d=this._nextStage;if(!this._mouseOverIntervalID)return void(d&&d._testMouseOver(a,b,c));var e=this._getPointerData(-1);if(e&&(a||this.mouseX!=this._mouseOverX||this.mouseY!=this._mouseOverY||!this.mouseInBounds)){var f,g,h,i=e.posEvtObj,j=c||i&&i.target==this.canvas,k=null,l=-1,m="";!b&&(a||this.mouseInBounds&&j)&&(k=this._getObjectsUnderPoint(this.mouseX,this.mouseY,null,!0),this._mouseOverX=this.mouseX,this._mouseOverY=this.mouseY);var n=this._mouseOverTarget||[],o=n[n.length-1],p=this._mouseOverTarget=[];for(f=k;f;)p.unshift(f),m||(m=f.cursor),f=f.parent;for(this.canvas.style.cursor=m,!b&&c&&(c.canvas.style.cursor=m),g=0,h=p.length;h>g&&p[g]==n[g];g++)l=g;for(o!=k&&this._dispatchMouseEvent(o,"mouseout",!0,-1,e,i,k),g=n.length-1;g>l;g--)this._dispatchMouseEvent(n[g],"rollout",!1,-1,e,i,k);for(g=p.length-1;g>l;g--)this._dispatchMouseEvent(p[g],"rollover",!1,-1,e,i,o);o!=k&&this._dispatchMouseEvent(k,"mouseover",!0,-1,e,i,o),d&&d._testMouseOver(a,b||k&&this,c||j&&this)}}},b._handleDoubleClick=function(a,b){var c=null,d=this._nextStage,e=this._getPointerData(-1);b||(c=this._getObjectsUnderPoint(e.x,e.y,null,!0),this._dispatchMouseEvent(c,"dblclick",!0,-1,e,a)),d&&d._handleDoubleClick(a,b||c&&this)},b._dispatchMouseEvent=function(a,b,c,d,e,f,g){if(a&&(c||a.hasEventListener(b))){var h=new createjs.MouseEvent(b,c,!1,e.x,e.y,f,d,d===this._primaryPointerID||-1===d,e.rawX,e.rawY,g);a.dispatchEvent(h)}},createjs.Stage=createjs.promote(a,"Container")}(),this.createjs=this.createjs||{},function(){"use strict";function a(b,c){if(this.Stage_constructor(b),void 0!==c){if("object"!=typeof c)throw"Invalid options object";var d=c.premultiply,e=c.transparent,f=c.antialias,g=c.preserveBuffer,h=c.autoPurge}this.vocalDebug=!1,this._preserveBuffer=g||!1,this._antialias=f||!1,this._transparent=e||!1,this._premultiply=d||!1,this._autoPurge=void 0,this.autoPurge=h,this._viewportWidth=0,this._viewportHeight=0,this._projectionMatrix=null,this._webGLContext=null,this._clearColor={r:.5,g:.5,b:.5,a:0},this._maxCardsPerBatch=a.DEFAULT_MAX_BATCH_SIZE,this._activeShader=null,this._vertices=null,this._vertexPositionBuffer=null,this._uvs=null,this._uvPositionBuffer=null,this._indices=null,this._textureIndexBuffer=null,this._alphas=null,this._alphaBuffer=null,this._textureDictionary=[],this._textureIDs={},this._batchTextures=[],this._baseTextures=[],this._batchTextureCount=8,this._lastTextureInsert=-1,this._batchID=0,this._drawID=0,this._slotBlacklist=[],this._isDrawing=0,this._lastTrackedCanvas=0,this.isCacheControlled=!1,this._cacheContainer=new createjs.Container,this._initializeWebGL()}var b=createjs.extend(a,createjs.Stage);a.buildUVRects=function(a,b,c){if(!a||!a._frames)return null;void 0===b&&(b=-1),void 0===c&&(c=!1);for(var d=-1!=b&&c?b:0,e=-1!=b&&c?b+1:a._frames.length,f=d;e>f;f++){var g=a._frames[f];if(!(g.uvRect||g.image.width<=0||g.image.height<=0)){var h=g.rect;g.uvRect={t:h.y/g.image.height,l:h.x/g.image.width,b:(h.y+h.height)/g.image.height,r:(h.x+h.width)/g.image.width}}}return a._frames[-1!=b?b:0].uvRect||{t:0,l:0,b:1,r:1}},a.isWebGLActive=function(a){return a&&a instanceof WebGLRenderingContext&&"undefined"!=typeof WebGLRenderingContext},a.VERTEX_PROPERTY_COUNT=6,a.INDICIES_PER_CARD=6,a.DEFAULT_MAX_BATCH_SIZE=1e4,a.WEBGL_MAX_INDEX_NUM=Math.pow(2,16),a.UV_RECT={t:0,l:0,b:1,r:1};try{a.COVER_VERT=new Float32Array([-1,1,1,1,-1,-1,1,1,1,-1,-1,-1]),a.COVER_UV=new Float32Array([0,0,1,0,0,1,1,0,1,1,0,1]),a.COVER_UV_FLIP=new Float32Array([0,1,1,1,0,0,1,1,1,0,0,0])}catch(c){}a.REGULAR_VARYING_HEADER="precision mediump float;varying vec2 vTextureCoord;varying lowp float indexPicker;varying lowp float alphaValue;",a.REGULAR_VERTEX_HEADER=a.REGULAR_VARYING_HEADER+"attribute vec2 vertexPosition;attribute vec2 uvPosition;attribute lowp float textureIndex;attribute lowp float objectAlpha;uniform mat4 pMatrix;",a.REGULAR_FRAGMENT_HEADER=a.REGULAR_VARYING_HEADER+"uniform sampler2D uSampler[{{count}}];",a.REGULAR_VERTEX_BODY="void main(void) {gl_Position = vec4((vertexPosition.x * pMatrix[0][0]) + pMatrix[3][0],(vertexPosition.y * pMatrix[1][1]) + pMatrix[3][1],pMatrix[3][2],1.0);alphaValue = objectAlpha;indexPicker = textureIndex;vTextureCoord = uvPosition;}",a.REGULAR_FRAGMENT_BODY="void main(void) {vec4 color = vec4(1.0, 0.0, 0.0, 1.0);if (indexPicker <= 0.5) {color = texture2D(uSampler[0], vTextureCoord);{{alternates}}}{{fragColor}}}",a.REGULAR_FRAG_COLOR_NORMAL="gl_FragColor = vec4(color.rgb, color.a * alphaValue);",a.REGULAR_FRAG_COLOR_PREMULTIPLY="if(color.a > 0.0035) {gl_FragColor = vec4(color.rgb/color.a, color.a * alphaValue);} else {gl_FragColor = vec4(0.0, 0.0, 0.0, 0.0);}",a.PARTICLE_VERTEX_BODY=a.REGULAR_VERTEX_BODY,a.PARTICLE_FRAGMENT_BODY=a.REGULAR_FRAGMENT_BODY,a.COVER_VARYING_HEADER="precision mediump float;varying highp vec2 vRenderCoord;varying highp vec2 vTextureCoord;",a.COVER_VERTEX_HEADER=a.COVER_VARYING_HEADER+"attribute vec2 vertexPosition;attribute vec2 uvPosition;uniform float uUpright;",a.COVER_FRAGMENT_HEADER=a.COVER_VARYING_HEADER+"uniform sampler2D uSampler;",a.COVER_VERTEX_BODY="void main(void) {gl_Position = vec4(vertexPosition.x, vertexPosition.y, 0.0, 1.0);vRenderCoord = uvPosition;vTextureCoord = vec2(uvPosition.x, abs(uUpright - uvPosition.y));}",a.COVER_FRAGMENT_BODY="void main(void) {vec4 color = texture2D(uSampler, vRenderCoord);gl_FragColor = color;}",b._get_isWebGL=function(){return!!this._webGLContext},b._set_autoPurge=function(a){a=isNaN(a)?1200:a,-1!=a&&(a=10>a?10:a),this._autoPurge=a},b._get_autoPurge=function(){return Number(this._autoPurge)};try{Object.defineProperties(b,{isWebGL:{get:b._get_isWebGL},autoPurge:{get:b._get_autoPurge,set:b._set_autoPurge}})}catch(c){}b._initializeWebGL=function(){if(this.canvas){if(!this._webGLContext||this._webGLContext.canvas!==this.canvas){var a={depth:!1,alpha:this._transparent,stencil:!0,antialias:this._antialias,premultipliedAlpha:this._premultiply,preserveDrawingBuffer:this._preserveBuffer},b=this._webGLContext=this._fetchWebGLContext(this.canvas,a);if(!b)return null;this.updateSimultaneousTextureCount(b.getParameter(b.MAX_TEXTURE_IMAGE_UNITS)),this._maxTextureSlots=b.getParameter(b.MAX_COMBINED_TEXTURE_IMAGE_UNITS),this._createBuffers(b),this._initTextures(b),b.disable(b.DEPTH_TEST),b.enable(b.BLEND),b.blendFuncSeparate(b.SRC_ALPHA,b.ONE_MINUS_SRC_ALPHA,b.ONE,b.ONE_MINUS_SRC_ALPHA),b.pixelStorei(b.UNPACK_PREMULTIPLY_ALPHA_WEBGL,this._premultiply),this._webGLContext.clearColor(this._clearColor.r,this._clearColor.g,this._clearColor.b,this._clearColor.a),this.updateViewport(this._viewportWidth||this.canvas.width,this._viewportHeight||this.canvas.height)}}else this._webGLContext=null;return this._webGLContext},b.update=function(a){if(this.canvas){if(this.tickOnUpdate&&this.tick(a),this.dispatchEvent("drawstart"),this.autoClear&&this.clear(),this._webGLContext)this._batchDraw(this,this._webGLContext),-1==this._autoPurge||this._drawID%(this._autoPurge/2|0)||this.purgeTextures(this._autoPurge);else{var b=this.canvas.getContext("2d");b.save(),this.updateContext(b),this.draw(b,!1),b.restore()}this.dispatchEvent("drawend")}},b.clear=function(){if(this.canvas)if(a.isWebGLActive(this._webGLContext)){var b=this._webGLContext,c=this._clearColor,d=this._transparent?c.a:1;this._webGLContext.clearColor(c.r*d,c.g*d,c.b*d,d),b.clear(b.COLOR_BUFFER_BIT),this._webGLContext.clearColor(c.r,c.g,c.b,c.a)}else this.Stage_clear()},b.draw=function(b,c){if(b===this._webGLContext&&a.isWebGLActive(this._webGLContext)){var d=this._webGLContext;return this._batchDraw(this,d,c),!0}return this.Stage_draw(b,c)},b.cacheDraw=function(b,c,d){if(a.isWebGLActive(this._webGLContext)){var e=this._webGLContext;return this._cacheDraw(e,b,c,d),!0}return!1},b.protectTextureSlot=function(a,b){if(a>this._maxTextureSlots||0>a)throw"Slot outside of acceptable range";this._slotBlacklist[a]=!!b},b.getTargetRenderTexture=function(a,b,c){var d,e=!1,f=this._webGLContext;if(void 0!==a.__lastRT&&a.__lastRT===a.__rtA&&(e=!0),e?(void 0===a.__rtB?a.__rtB=this.getRenderBufferTexture(b,c):((b!=a.__rtB._width||c!=a.__rtB._height)&&this.resizeTexture(a.__rtB,b,c),this.setTextureParams(f)),d=a.__rtB):(void 0===a.__rtA?a.__rtA=this.getRenderBufferTexture(b,c):((b!=a.__rtA._width||c!=a.__rtA._height)&&this.resizeTexture(a.__rtA,b,c),this.setTextureParams(f)),d=a.__rtA),!d)throw"Problems creating render textures, known causes include using too much VRAM by not releasing WebGL texture instances";return a.__lastRT=d,d},b.releaseTexture=function(a){var b,c;if(a){if(a.children)for(b=0,c=a.children.length;c>b;b++)this.releaseTexture(a.children[b]);a.cacheCanvas&&a.uncache();var d=void 0;if(void 0!==a._storeID){if(a===this._textureDictionary[a._storeID])return this._killTextureObject(a),void(a._storeID=void 0);d=a}else if(2===a._webGLRenderStyle)d=a.image;else if(1===a._webGLRenderStyle){for(b=0,c=a.spriteSheet._images.length;c>b;b++)this.releaseTexture(a.spriteSheet._images[b]);return}if(void 0===d)return void(this.vocalDebug&&console.log("No associated texture found on release"));this._killTextureObject(this._textureDictionary[d._storeID]),d._storeID=void 0}},b.purgeTextures=function(a){void 0==a&&(a=100);for(var b=this._textureDictionary,c=b.length,d=0;c>d;d++){var e=b[d];e&&e._drawID+a<=this._drawID&&this._killTextureObject(e)}},b.updateSimultaneousTextureCount=function(a){var b=this._webGLContext,c=!1;for((1>a||isNaN(a))&&(a=1),this._batchTextureCount=a;!c;)try{this._activeShader=this._fetchShaderProgram(b),c=!0}catch(d){if(1==this._batchTextureCount)throw"Cannot compile shader "+d;this._batchTextureCount-=4,this._batchTextureCount<1&&(this._batchTextureCount=1),this.vocalDebug&&console.log("Reducing desired texture count due to errors: "+this._batchTextureCount)}},b.updateViewport=function(a,b){this._viewportWidth=0|a,this._viewportHeight=0|b;var c=this._webGLContext;c&&(c.viewport(0,0,this._viewportWidth,this._viewportHeight),this._projectionMatrix=new Float32Array([2/this._viewportWidth,0,0,0,0,-2/this._viewportHeight,1,0,0,0,1,0,-1,1,.1,0]),this._projectionMatrixFlip=new Float32Array([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]),this._projectionMatrixFlip.set(this._projectionMatrix),this._projectionMatrixFlip[5]*=-1,this._projectionMatrixFlip[13]*=-1)},b.getFilterShader=function(a){a||(a=this);var b=this._webGLContext,c=this._activeShader;if(a._builtShader)c=a._builtShader,a.shaderParamSetup&&(b.useProgram(c),a.shaderParamSetup(b,this,c));else try{c=this._fetchShaderProgram(b,"filter",a.VTX_SHADER_BODY,a.FRAG_SHADER_BODY,a.shaderParamSetup&&a.shaderParamSetup.bind(a)),a._builtShader=c,c._name=a.toString()}catch(d){console&&console.log("SHADER SWITCH FAILURE",d)}return c},b.getBaseTexture=function(a,b){var c=Math.ceil(a>0?a:1)||1,d=Math.ceil(b>0?b:1)||1,e=this._webGLContext,f=e.createTexture();return this.resizeTexture(f,c,d),this.setTextureParams(e,!1),f},b.resizeTexture=function(a,b,c){var d=this._webGLContext;d.bindTexture(d.TEXTURE_2D,a),d.texImage2D(d.TEXTURE_2D,0,d.RGBA,b,c,0,d.RGBA,d.UNSIGNED_BYTE,null),a.width=b,a.height=c},b.getRenderBufferTexture=function(a,b){var c=this._webGLContext,d=this.getBaseTexture(a,b);if(!d)return null;var e=c.createFramebuffer();return e?(d.width=a,d.height=b,c.bindFramebuffer(c.FRAMEBUFFER,e),c.framebufferTexture2D(c.FRAMEBUFFER,c.COLOR_ATTACHMENT0,c.TEXTURE_2D,d,0),e._renderTexture=d,d._frameBuffer=e,d._storeID=this._textureDictionary.length,this._textureDictionary[d._storeID]=d,c.bindFramebuffer(c.FRAMEBUFFER,null),d):null},b.setTextureParams=function(a,b){b&&this._antialias?(a.texParameteri(a.TEXTURE_2D,a.TEXTURE_MIN_FILTER,a.LINEAR),a.texParameteri(a.TEXTURE_2D,a.TEXTURE_MAG_FILTER,a.LINEAR)):(a.texParameteri(a.TEXTURE_2D,a.TEXTURE_MIN_FILTER,a.NEAREST),a.texParameteri(a.TEXTURE_2D,a.TEXTURE_MAG_FILTER,a.NEAREST)),a.texParameteri(a.TEXTURE_2D,a.TEXTURE_WRAP_S,a.CLAMP_TO_EDGE),a.texParameteri(a.TEXTURE_2D,a.TEXTURE_WRAP_T,a.CLAMP_TO_EDGE)},b.setClearColor=function(a){var b,c,d,e,f;"string"==typeof a?0==a.indexOf("#")?(4==a.length&&(a="#"+a.charAt(1)+a.charAt(1)+a.charAt(2)+a.charAt(2)+a.charAt(3)+a.charAt(3)),b=Number("0x"+a.slice(1,3))/255,c=Number("0x"+a.slice(3,5))/255,d=Number("0x"+a.slice(5,7))/255,e=Number("0x"+a.slice(7,9))/255):0==a.indexOf("rgba(")&&(f=a.slice(5,-1).split(","),b=Number(f[0])/255,c=Number(f[1])/255,d=Number(f[2])/255,e=Number(f[3])):(b=((4278190080&a)>>>24)/255,c=((16711680&a)>>>16)/255,d=((65280&a)>>>8)/255,e=(255&a)/255),this._clearColor.r=b||0,this._clearColor.g=c||0,this._clearColor.b=d||0,this._clearColor.a=e||0,this._webGLContext&&this._webGLContext.clearColor(this._clearColor.r,this._clearColor.g,this._clearColor.b,this._clearColor.a)},b.toString=function(){return"[StageGL (name="+this.name+")]" -},b._fetchWebGLContext=function(a,b){var c;try{c=a.getContext("webgl",b)||a.getContext("experimental-webgl",b)}catch(d){}if(c)c.viewportWidth=a.width,c.viewportHeight=a.height;else{var e="Could not initialize WebGL";console.error?console.error(e):console.log(e)}return c},b._fetchShaderProgram=function(b,c,d,e,f){b.useProgram(null);var g,h;switch(c){case"filter":h=a.COVER_VERTEX_HEADER+(d||a.COVER_VERTEX_BODY),g=a.COVER_FRAGMENT_HEADER+(e||a.COVER_FRAGMENT_BODY);break;case"particle":h=a.REGULAR_VERTEX_HEADER+a.PARTICLE_VERTEX_BODY,g=a.REGULAR_FRAGMENT_HEADER+a.PARTICLE_FRAGMENT_BODY;break;case"override":h=a.REGULAR_VERTEX_HEADER+(d||a.REGULAR_VERTEX_BODY),g=a.REGULAR_FRAGMENT_HEADER+(e||a.REGULAR_FRAGMENT_BODY);break;case"regular":default:h=a.REGULAR_VERTEX_HEADER+a.REGULAR_VERTEX_BODY,g=a.REGULAR_FRAGMENT_HEADER+a.REGULAR_FRAGMENT_BODY}var i=this._createShader(b,b.VERTEX_SHADER,h),j=this._createShader(b,b.FRAGMENT_SHADER,g),k=b.createProgram();if(b.attachShader(k,i),b.attachShader(k,j),b.linkProgram(k),k._type=c,!b.getProgramParameter(k,b.LINK_STATUS))throw b.useProgram(this._activeShader),b.getProgramInfoLog(k);switch(b.useProgram(k),c){case"filter":k.vertexPositionAttribute=b.getAttribLocation(k,"vertexPosition"),b.enableVertexAttribArray(k.vertexPositionAttribute),k.uvPositionAttribute=b.getAttribLocation(k,"uvPosition"),b.enableVertexAttribArray(k.uvPositionAttribute),k.samplerUniform=b.getUniformLocation(k,"uSampler"),b.uniform1i(k.samplerUniform,0),k.uprightUniform=b.getUniformLocation(k,"uUpright"),b.uniform1f(k.uprightUniform,0),f&&f(b,this,k);break;case"override":case"particle":case"regular":default:k.vertexPositionAttribute=b.getAttribLocation(k,"vertexPosition"),b.enableVertexAttribArray(k.vertexPositionAttribute),k.uvPositionAttribute=b.getAttribLocation(k,"uvPosition"),b.enableVertexAttribArray(k.uvPositionAttribute),k.textureIndexAttribute=b.getAttribLocation(k,"textureIndex"),b.enableVertexAttribArray(k.textureIndexAttribute),k.alphaAttribute=b.getAttribLocation(k,"objectAlpha"),b.enableVertexAttribArray(k.alphaAttribute);for(var l=[],m=0;md;d+=c)h[d]=h[d+1]=0;b.bufferData(b.ARRAY_BUFFER,h,b.DYNAMIC_DRAW),g.itemSize=c,g.numItems=f;var i=this._uvPositionBuffer=b.createBuffer();b.bindBuffer(b.ARRAY_BUFFER,i),c=2;var j=this._uvs=new Float32Array(f*c);for(d=0,e=j.length;e>d;d+=c)j[d]=j[d+1]=0;b.bufferData(b.ARRAY_BUFFER,j,b.DYNAMIC_DRAW),i.itemSize=c,i.numItems=f;var k=this._textureIndexBuffer=b.createBuffer();b.bindBuffer(b.ARRAY_BUFFER,k),c=1;var l=this._indices=new Float32Array(f*c);for(d=0,e=l.length;e>d;d++)l[d]=0;b.bufferData(b.ARRAY_BUFFER,l,b.DYNAMIC_DRAW),k.itemSize=c,k.numItems=f;var m=this._alphaBuffer=b.createBuffer();b.bindBuffer(b.ARRAY_BUFFER,m),c=1;var n=this._alphas=new Float32Array(f*c);for(d=0,e=n.length;e>d;d++)n[d]=1;b.bufferData(b.ARRAY_BUFFER,n,b.DYNAMIC_DRAW),m.itemSize=c,m.numItems=f},b._initTextures=function(){this._lastTextureInsert=-1,this._textureDictionary=[],this._textureIDs={},this._baseTextures=[],this._batchTextures=[];for(var a=0;aa.MAX_TEXTURE_SIZE||b.height>a.MAX_TEXTURE_SIZE)&&console&&console.error("Oversized Texture: "+b.width+"x"+b.height+" vs "+a.MAX_TEXTURE_SIZE+"max"))},b._insertTextureInBatch=function(a,b){if(this._batchTextures[b._activeIndex]!==b){var c=-1,d=(this._lastTextureInsert+1)%this._batchTextureCount,e=d;do{if(this._batchTextures[e]._batchID!=this._batchID&&!this._slotBlacklist[e]){c=e;break}e=(e+1)%this._batchTextureCount}while(e!==d);-1===c&&(this.batchReason="textureOverflow",this._drawBuffers(a),this.batchCardCount=0,c=d),this._batchTextures[c]=b,b._activeIndex=c;var f=b._imageData;f&&f._invalid&&void 0!==b._drawID?this._updateTextureImageData(a,f):(a.activeTexture(a.TEXTURE0+c),a.bindTexture(a.TEXTURE_2D,b),this.setTextureParams(a)),this._lastTextureInsert=c}else{var f=b._imageData;void 0!=b._storeID&&f&&f._invalid&&this._updateTextureImageData(a,f)}b._drawID=this._drawID,b._batchID=this._batchID},b._killTextureObject=function(a){if(a){var b=this._webGLContext;if(void 0!==a._storeID&&a._storeID>=0){this._textureDictionary[a._storeID]=void 0;for(var c in this._textureIDs)this._textureIDs[c]==a._storeID&&delete this._textureIDs[c];a._imageData&&(a._imageData._storeID=void 0),a._imageData=a._storeID=void 0}void 0!==a._activeIndex&&this._batchTextures[a._activeIndex]===a&&(this._batchTextures[a._activeIndex]=this._baseTextures[a._activeIndex]);try{a._frameBuffer&&b.deleteFramebuffer(a._frameBuffer),a._frameBuffer=void 0}catch(d){this.vocalDebug&&console.log(d)}try{b.deleteTexture(a)}catch(d){this.vocalDebug&&console.log(d)}}},b._backupBatchTextures=function(a,b){var c=this._webGLContext;this._backupTextures||(this._backupTextures=[]),void 0===b&&(b=this._backupTextures);for(var d=0;d0&&this._drawBuffers(b),this._isDrawing++,this._drawID++,this.batchCardCount=0,this.depth=0,this._appendToBatchGroup(a,b,new createjs.Matrix2D,this.alpha,c),this.batchReason="drawFinish",this._drawBuffers(b),this._isDrawing--},b._cacheDraw=function(a,b,c,d){var e,f=this._activeShader,g=this._slotBlacklist,h=this._maxTextureSlots-1,i=this._viewportWidth,j=this._viewportHeight;this.protectTextureSlot(h,!0);var k=b.getMatrix();k=k.clone(),k.scale(1/d.scale,1/d.scale),k=k.invert(),k.translate(-d.offX/d.scale*b.scaleX,-d.offY/d.scale*b.scaleY);var l=this._cacheContainer;l.children=[b],l.transformMatrix=k,this._backupBatchTextures(!1),c&&c.length?this._drawFilters(b,c,d):this.isCacheControlled?(a.clear(a.COLOR_BUFFER_BIT),this._batchDraw(l,a,!0)):(a.activeTexture(a.TEXTURE0+h),b.cacheCanvas=this.getTargetRenderTexture(b,d._drawWidth,d._drawHeight),e=b.cacheCanvas,a.bindFramebuffer(a.FRAMEBUFFER,e._frameBuffer),this.updateViewport(d._drawWidth,d._drawHeight),this._projectionMatrix=this._projectionMatrixFlip,a.clear(a.COLOR_BUFFER_BIT),this._batchDraw(l,a,!0),a.bindFramebuffer(a.FRAMEBUFFER,null),this.updateViewport(i,j)),this._backupBatchTextures(!0),this.protectTextureSlot(h,!1),this._activeShader=f,this._slotBlacklist=g},b._drawFilters=function(a,b,c){var d,e=this._webGLContext,f=this._maxTextureSlots-1,g=this._viewportWidth,h=this._viewportHeight,i=this._cacheContainer,j=b.length;e.activeTexture(e.TEXTURE0+f),d=this.getTargetRenderTexture(a,c._drawWidth,c._drawHeight),e.bindFramebuffer(e.FRAMEBUFFER,d._frameBuffer),this.updateViewport(c._drawWidth,c._drawHeight),e.clear(e.COLOR_BUFFER_BIT),this._batchDraw(i,e,!0),e.activeTexture(e.TEXTURE0),e.bindTexture(e.TEXTURE_2D,d),this.setTextureParams(e);var k=!1,l=0,m=b[l];do this._activeShader=this.getFilterShader(m),this._activeShader&&(e.activeTexture(e.TEXTURE0+f),d=this.getTargetRenderTexture(a,c._drawWidth,c._drawHeight),e.bindFramebuffer(e.FRAMEBUFFER,d._frameBuffer),e.viewport(0,0,c._drawWidth,c._drawHeight),e.clear(e.COLOR_BUFFER_BIT),this._drawCover(e,k),e.activeTexture(e.TEXTURE0),e.bindTexture(e.TEXTURE_2D,d),this.setTextureParams(e),(j>1||b[0]._multiPass)&&(k=!k),m=null!==m._multiPass?m._multiPass:b[++l]);while(m);this.isCacheControlled?(e.bindFramebuffer(e.FRAMEBUFFER,null),this.updateViewport(g,h),this._activeShader=this.getFilterShader(this),e.clear(e.COLOR_BUFFER_BIT),this._drawCover(e,k)):(k&&(e.activeTexture(e.TEXTURE0+f),d=this.getTargetRenderTexture(a,c._drawWidth,c._drawHeight),e.bindFramebuffer(e.FRAMEBUFFER,d._frameBuffer),this._activeShader=this.getFilterShader(this),e.viewport(0,0,c._drawWidth,c._drawHeight),e.clear(e.COLOR_BUFFER_BIT),this._drawCover(e,!k)),e.bindFramebuffer(e.FRAMEBUFFER,null),this.updateViewport(g,h),a.cacheCanvas=d)},b._appendToBatchGroup=function(b,c,d,e,f){b._glMtx||(b._glMtx=new createjs.Matrix2D);var g=b._glMtx;g.copy(d),b.transformMatrix?g.appendMatrix(b.transformMatrix):g.appendTransform(b.x,b.y,b.scaleX,b.scaleY,b.rotation,b.skewX,b.skewY,b.regX,b.regY);for(var h,i,j,k,l=b.children.length,m=0;l>m;m++){var n=b.children[m];if(n.visible&&e)if(n.cacheCanvas&&!f||(n._updateState&&n._updateState(),!n.children)){this.batchCardCount+1>this._maxCardsPerBatch&&(this.batchReason="vertexOverflow",this._drawBuffers(c),this.batchCardCount=0),n._glMtx||(n._glMtx=new createjs.Matrix2D);var o=n._glMtx;o.copy(g),n.transformMatrix?o.appendMatrix(n.transformMatrix):o.appendTransform(n.x,n.y,n.scaleX,n.scaleY,n.rotation,n.skewX,n.skewY,n.regX,n.regY);var p,q,r,s,t,u,v=n.cacheCanvas&&!f;if(2===n._webGLRenderStyle||v)r=(f?!1:n.cacheCanvas)||n.image;else{if(1!==n._webGLRenderStyle)continue;if(s=n.spriteSheet.getFrame(n.currentFrame),null===s)continue;r=s.image}var w=this._uvs,x=this._vertices,y=this._indices,z=this._alphas;if(r){if(void 0===r._storeID)t=this._loadTextureImage(c,r),this._insertTextureInBatch(c,t);else{if(t=this._textureDictionary[r._storeID],!t){this.vocalDebug&&console.log("Texture should not be looked up while not being stored.");continue}t._batchID!==this._batchID&&this._insertTextureInBatch(c,t)}if(q=t._activeIndex,2===n._webGLRenderStyle||v)!v&&n.sourceRect?(n._uvRect||(n._uvRect={}),u=n.sourceRect,p=n._uvRect,p.t=u.y/r.height,p.l=u.x/r.width,p.b=(u.y+u.height)/r.height,p.r=(u.x+u.width)/r.width,h=0,i=0,j=u.width+h,k=u.height+i):(p=a.UV_RECT,v?(u=n.bitmapCache,h=u.x+u._filterOffX/u.scale,i=u.y+u._filterOffY/u.scale,j=u._drawWidth/u.scale+h,k=u._drawHeight/u.scale+i):(h=0,i=0,j=r.width+h,k=r.height+i));else if(1===n._webGLRenderStyle){var A=s.rect;p=s.uvRect,p||(p=a.buildUVRects(n.spriteSheet,n.currentFrame,!1)),h=-s.regX,i=-s.regY,j=A.width-s.regX,k=A.height-s.regY}var B=this.batchCardCount*a.INDICIES_PER_CARD,C=2*B;x[C]=h*o.a+i*o.c+o.tx,x[C+1]=h*o.b+i*o.d+o.ty,x[C+2]=h*o.a+k*o.c+o.tx,x[C+3]=h*o.b+k*o.d+o.ty,x[C+4]=j*o.a+i*o.c+o.tx,x[C+5]=j*o.b+i*o.d+o.ty,x[C+6]=x[C+2],x[C+7]=x[C+3],x[C+8]=x[C+4],x[C+9]=x[C+5],x[C+10]=j*o.a+k*o.c+o.tx,x[C+11]=j*o.b+k*o.d+o.ty,w[C]=p.l,w[C+1]=p.t,w[C+2]=p.l,w[C+3]=p.b,w[C+4]=p.r,w[C+5]=p.t,w[C+6]=p.l,w[C+7]=p.b,w[C+8]=p.r,w[C+9]=p.t,w[C+10]=p.r,w[C+11]=p.b,y[B]=y[B+1]=y[B+2]=y[B+3]=y[B+4]=y[B+5]=q,z[B]=z[B+1]=z[B+2]=z[B+3]=z[B+4]=z[B+5]=n.alpha*e,this.batchCardCount++}}else this._appendToBatchGroup(n,c,g,n.alpha*e)}},b._drawBuffers=function(b){if(!(this.batchCardCount<=0)){this.vocalDebug&&console.log("Draw["+this._drawID+":"+this._batchID+"] : "+this.batchReason);var c=this._activeShader,d=this._vertexPositionBuffer,e=this._textureIndexBuffer,f=this._uvPositionBuffer,g=this._alphaBuffer;b.useProgram(c),b.bindBuffer(b.ARRAY_BUFFER,d),b.vertexAttribPointer(c.vertexPositionAttribute,d.itemSize,b.FLOAT,!1,0,0),b.bufferSubData(b.ARRAY_BUFFER,0,this._vertices),b.bindBuffer(b.ARRAY_BUFFER,e),b.vertexAttribPointer(c.textureIndexAttribute,e.itemSize,b.FLOAT,!1,0,0),b.bufferSubData(b.ARRAY_BUFFER,0,this._indices),b.bindBuffer(b.ARRAY_BUFFER,f),b.vertexAttribPointer(c.uvPositionAttribute,f.itemSize,b.FLOAT,!1,0,0),b.bufferSubData(b.ARRAY_BUFFER,0,this._uvs),b.bindBuffer(b.ARRAY_BUFFER,g),b.vertexAttribPointer(c.alphaAttribute,g.itemSize,b.FLOAT,!1,0,0),b.bufferSubData(b.ARRAY_BUFFER,0,this._alphas),b.uniformMatrix4fv(c.pMatrixUniform,b.FALSE,this._projectionMatrix);for(var h=0;h0&&this._drawBuffers(b),this.vocalDebug&&console.log("Draw["+this._drawID+":"+this._batchID+"] : Cover");var d=this._activeShader,e=this._vertexPositionBuffer,f=this._uvPositionBuffer;b.clear(b.COLOR_BUFFER_BIT),b.useProgram(d),b.bindBuffer(b.ARRAY_BUFFER,e),b.vertexAttribPointer(d.vertexPositionAttribute,e.itemSize,b.FLOAT,!1,0,0),b.bufferSubData(b.ARRAY_BUFFER,0,a.COVER_VERT),b.bindBuffer(b.ARRAY_BUFFER,f),b.vertexAttribPointer(d.uvPositionAttribute,f.itemSize,b.FLOAT,!1,0,0),b.bufferSubData(b.ARRAY_BUFFER,0,c?a.COVER_UV_FLIP:a.COVER_UV),b.uniform1i(d.samplerUniform,0),b.uniform1f(d.uprightUniform,c?0:1),b.drawArrays(b.TRIANGLES,0,a.INDICIES_PER_CARD)},createjs.StageGL=createjs.promote(a,"Stage")}(),this.createjs=this.createjs||{},function(){function a(a){this.DisplayObject_constructor(),"string"==typeof a?(this.image=document.createElement("img"),this.image.src=a):this.image=a,this.sourceRect=null,this._webGLRenderStyle=createjs.DisplayObject._StageGL_BITMAP}var b=createjs.extend(a,createjs.DisplayObject);b.initialize=a,b.isVisible=function(){var a=this.image,b=this.cacheCanvas||a&&(a.naturalWidth||a.getContext||a.readyState>=2);return!!(this.visible&&this.alpha>0&&0!=this.scaleX&&0!=this.scaleY&&b)},b.draw=function(a,b){if(this.DisplayObject_draw(a,b))return!0;var c=this.image,d=this.sourceRect;if(c.getImage&&(c=c.getImage()),!c)return!0;if(d){var e=d.x,f=d.y,g=e+d.width,h=f+d.height,i=0,j=0,k=c.width,l=c.height;0>e&&(i-=e,e=0),g>k&&(g=k),0>f&&(j-=f,f=0),h>l&&(h=l),a.drawImage(c,e,f,g-e,h-f,i,j,g-e,h-f)}else a.drawImage(c,0,0);return!0},b.getBounds=function(){var a=this.DisplayObject_getBounds();if(a)return a;var b=this.image,c=this.sourceRect||b,d=b&&(b.naturalWidth||b.getContext||b.readyState>=2);return d?this._rectangle.setValues(0,0,c.width,c.height):null},b.clone=function(b){var c=this.image;c&&b&&(c=c.cloneNode());var d=new a(c);return this.sourceRect&&(d.sourceRect=this.sourceRect.clone()),this._cloneProps(d),d},b.toString=function(){return"[Bitmap (name="+this.name+")]"},createjs.Bitmap=createjs.promote(a,"DisplayObject")}(),this.createjs=this.createjs||{},function(){"use strict";function a(a,b){this.DisplayObject_constructor(),this.currentFrame=0,this.currentAnimation=null,this.paused=!0,this.spriteSheet=a,this.currentAnimationFrame=0,this.framerate=0,this._animation=null,this._currentFrame=null,this._skipAdvance=!1,this._webGLRenderStyle=createjs.DisplayObject._StageGL_SPRITE,null!=b&&this.gotoAndPlay(b)}var b=createjs.extend(a,createjs.DisplayObject);b.initialize=a,b.isVisible=function(){var a=this.cacheCanvas||this.spriteSheet.complete;return!!(this.visible&&this.alpha>0&&0!=this.scaleX&&0!=this.scaleY&&a)},b.draw=function(a,b){if(this.DisplayObject_draw(a,b))return!0;this._normalizeFrame();var c=this.spriteSheet.getFrame(0|this._currentFrame);if(!c)return!1;var d=c.rect;return d.width&&d.height&&a.drawImage(c.image,d.x,d.y,d.width,d.height,-c.regX,-c.regY,d.width,d.height),!0},b.play=function(){this.paused=!1},b.stop=function(){this.paused=!0},b.gotoAndPlay=function(a){this.paused=!1,this._skipAdvance=!0,this._goto(a)},b.gotoAndStop=function(a){this.paused=!0,this._goto(a)},b.advance=function(a){var b=this.framerate||this.spriteSheet.framerate,c=b&&null!=a?a/(1e3/b):1;this._normalizeFrame(c)},b.getBounds=function(){return this.DisplayObject_getBounds()||this.spriteSheet.getFrameBounds(this.currentFrame,this._rectangle)},b.clone=function(){return this._cloneProps(new a(this.spriteSheet))},b.toString=function(){return"[Sprite (name="+this.name+")]"},b._cloneProps=function(a){return this.DisplayObject__cloneProps(a),a.currentFrame=this.currentFrame,a.currentAnimation=this.currentAnimation,a.paused=this.paused,a.currentAnimationFrame=this.currentAnimationFrame,a.framerate=this.framerate,a._animation=this._animation,a._currentFrame=this._currentFrame,a._skipAdvance=this._skipAdvance,a},b._tick=function(a){this.paused||(this._skipAdvance||this.advance(a&&a.delta),this._skipAdvance=!1),this.DisplayObject__tick(a)},b._normalizeFrame=function(a){a=a||0;var b,c=this._animation,d=this.paused,e=this._currentFrame;if(c){var f=c.speed||1,g=this.currentAnimationFrame;if(b=c.frames.length,g+a*f>=b){var h=c.next;if(this._dispatchAnimationEnd(c,e,d,h,b-1))return;if(h)return this._goto(h,a-(b-g)/f);this.paused=!0,g=c.frames.length-1}else g+=a*f;this.currentAnimationFrame=g,this._currentFrame=c.frames[0|g]}else if(e=this._currentFrame+=a,b=this.spriteSheet.getNumFrames(),e>=b&&b>0&&!this._dispatchAnimationEnd(c,e,d,b-1)&&(this._currentFrame-=b)>=b)return this._normalizeFrame();e=0|this._currentFrame,this.currentFrame!=e&&(this.currentFrame=e,this.dispatchEvent("change"))},b._dispatchAnimationEnd=function(a,b,c,d,e){var f=a?a.name:null;if(this.hasEventListener("animationend")){var g=new createjs.Event("animationend");g.name=f,g.next=d,this.dispatchEvent(g)}var h=this._animation!=a||this._currentFrame!=b;return h||c||!this.paused||(this.currentAnimationFrame=e,h=!0),h},b._goto=function(a,b){if(this.currentAnimationFrame=0,isNaN(a)){var c=this.spriteSheet.getAnimation(a);c&&(this._animation=c,this.currentAnimation=a,this._normalizeFrame(b))}else this.currentAnimation=this._animation=null,this._currentFrame=a,this._normalizeFrame()},createjs.Sprite=createjs.promote(a,"DisplayObject")}(),this.createjs=this.createjs||{},function(){"use strict";function a(a){this.DisplayObject_constructor(),this.graphics=a?a:new createjs.Graphics}var b=createjs.extend(a,createjs.DisplayObject);b.isVisible=function(){var a=this.cacheCanvas||this.graphics&&!this.graphics.isEmpty();return!!(this.visible&&this.alpha>0&&0!=this.scaleX&&0!=this.scaleY&&a)},b.draw=function(a,b){return this.DisplayObject_draw(a,b)?!0:(this.graphics.draw(a,this),!0)},b.clone=function(b){var c=b&&this.graphics?this.graphics.clone():this.graphics;return this._cloneProps(new a(c))},b.toString=function(){return"[Shape (name="+this.name+")]"},createjs.Shape=createjs.promote(a,"DisplayObject")}(),this.createjs=this.createjs||{},function(){"use strict";function a(a,b,c){this.DisplayObject_constructor(),this.text=a,this.font=b,this.color=c,this.textAlign="left",this.textBaseline="top",this.maxWidth=null,this.outline=0,this.lineHeight=0,this.lineWidth=null}var b=createjs.extend(a,createjs.DisplayObject),c=createjs.createCanvas?createjs.createCanvas():document.createElement("canvas");c.getContext&&(a._workingContext=c.getContext("2d"),c.width=c.height=1),a.H_OFFSETS={start:0,left:0,center:-.5,end:-1,right:-1},a.V_OFFSETS={top:0,hanging:-.01,middle:-.4,alphabetic:-.8,ideographic:-.85,bottom:-1},b.isVisible=function(){var a=this.cacheCanvas||null!=this.text&&""!==this.text;return!!(this.visible&&this.alpha>0&&0!=this.scaleX&&0!=this.scaleY&&a)},b.draw=function(a,b){if(this.DisplayObject_draw(a,b))return!0;var c=this.color||"#000";return this.outline?(a.strokeStyle=c,a.lineWidth=1*this.outline):a.fillStyle=c,this._drawText(this._prepContext(a)),!0},b.getMeasuredWidth=function(){return this._getMeasuredWidth(this.text)},b.getMeasuredLineHeight=function(){return 1.2*this._getMeasuredWidth("M")},b.getMeasuredHeight=function(){return this._drawText(null,{}).height},b.getBounds=function(){var b=this.DisplayObject_getBounds();if(b)return b;if(null==this.text||""===this.text)return null;var c=this._drawText(null,{}),d=this.maxWidth&&this.maxWidthj;j++){var l=i[j],m=null;if(null!=this.lineWidth&&(m=b.measureText(l).width)>this.lineWidth){var n=l.split(/(\s)/);l=n[0],m=b.measureText(l).width;for(var o=1,p=n.length;p>o;o+=2){var q=b.measureText(n[o]+n[o+1]).width;m+q>this.lineWidth?(e&&this._drawTextLine(b,l,h*f),d&&d.push(l),m>g&&(g=m),l=n[o+1],m=b.measureText(l).width,h++):(l+=n[o]+n[o+1],m+=q)}}e&&this._drawTextLine(b,l,h*f),d&&d.push(l),c&&null==m&&(m=b.measureText(l).width),m>g&&(g=m),h++}return c&&(c.width=g,c.height=h*f),e||b.restore(),c},b._drawTextLine=function(a,b,c){this.outline?a.strokeText(b,0,c,this.maxWidth||65535):a.fillText(b,0,c,this.maxWidth||65535)},b._getMeasuredWidth=function(b){var c=a._workingContext;c.save();var d=this._prepContext(c).measureText(b).width;return c.restore(),d},createjs.Text=createjs.promote(a,"DisplayObject")}(),this.createjs=this.createjs||{},function(){"use strict";function a(a,b){this.Container_constructor(),this.text=a||"",this.spriteSheet=b,this.lineHeight=0,this.letterSpacing=0,this.spaceWidth=0,this._oldProps={text:0,spriteSheet:0,lineHeight:0,letterSpacing:0,spaceWidth:0},this._oldStage=null,this._drawAction=null}var b=createjs.extend(a,createjs.Container);a.maxPoolSize=100,a._spritePool=[],b.draw=function(a,b){this.DisplayObject_draw(a,b)||(this._updateState(),this.Container_draw(a,b))},b.getBounds=function(){return this._updateText(),this.Container_getBounds()},b.isVisible=function(){var a=this.cacheCanvas||this.spriteSheet&&this.spriteSheet.complete&&this.text;return!!(this.visible&&this.alpha>0&&0!==this.scaleX&&0!==this.scaleY&&a)},b.clone=function(){return this._cloneProps(new a(this.text,this.spriteSheet))},b.addChild=b.addChildAt=b.removeChild=b.removeChildAt=b.removeAllChildren=function(){},b._updateState=function(){this._updateText()},b._cloneProps=function(a){return this.Container__cloneProps(a),a.lineHeight=this.lineHeight,a.letterSpacing=this.letterSpacing,a.spaceWidth=this.spaceWidth,a},b._getFrameIndex=function(a,b){var c,d=b.getAnimation(a);return d||(a!=(c=a.toUpperCase())||a!=(c=a.toLowerCase())||(c=null),c&&(d=b.getAnimation(c))),d&&d.frames[0]},b._getFrame=function(a,b){var c=this._getFrameIndex(a,b);return null==c?c:b.getFrame(c)},b._getLineHeight=function(a){var b=this._getFrame("1",a)||this._getFrame("T",a)||this._getFrame("L",a)||a.getFrame(0);return b?b.rect.height:1},b._getSpaceWidth=function(a){var b=this._getFrame("1",a)||this._getFrame("l",a)||this._getFrame("e",a)||this._getFrame("a",a)||a.getFrame(0);return b?b.rect.width:1},b._updateText=function(){var b,c=0,d=0,e=this._oldProps,f=!1,g=this.spaceWidth,h=this.lineHeight,i=this.spriteSheet,j=a._spritePool,k=this.children,l=0,m=k.length;for(var n in e)e[n]!=this[n]&&(e[n]=this[n],f=!0);if(f){var o=!!this._getFrame(" ",i);o||g||(g=this._getSpaceWidth(i)),h||(h=this._getLineHeight(i));for(var p=0,q=this.text.length;q>p;p++){var r=this.text.charAt(p);if(" "!=r||o)if("\n"!=r&&"\r"!=r){var s=this._getFrameIndex(r,i);null!=s&&(m>l?b=k[l]:(k.push(b=j.length?j.pop():new createjs.Sprite),b.parent=this,m++),b.spriteSheet=i,b.gotoAndStop(s),b.x=c,b.y=d,l++,c+=b.getBounds().width+this.letterSpacing)}else"\r"==r&&"\n"==this.text.charAt(p+1)&&p++,c=0,d+=h;else c+=g}for(;m>l;)j.push(b=k.pop()),b.parent=null,m--;j.length>a.maxPoolSize&&(j.length=a.maxPoolSize)}},createjs.BitmapText=createjs.promote(a,"Container")}(),this.createjs=this.createjs||{},function(){"use strict";function a(b){this.Container_constructor(),!a.inited&&a.init();var c,d,e,f;b instanceof String||arguments.length>1?(c=b,d=arguments[1],e=arguments[2],f=arguments[3],null==e&&(e=-1),b=null):b&&(c=b.mode,d=b.startPosition,e=b.loop,f=b.labels),b||(b={labels:f}),this.mode=c||a.INDEPENDENT,this.startPosition=d||0,this.loop=e===!0?-1:e||0,this.currentFrame=0,this.paused=b.paused||!1,this.actionsEnabled=!0,this.autoReset=!0,this.frameBounds=this.frameBounds||b.frameBounds,this.framerate=null,b.useTicks=b.paused=!0,this.timeline=new createjs.Timeline(b),this._synchOffset=0,this._rawPosition=-1,this._bound_resolveState=this._resolveState.bind(this),this._t=0,this._managed={}}function b(){throw"MovieClipPlugin cannot be instantiated."}var c=createjs.extend(a,createjs.Container);a.INDEPENDENT="independent",a.SINGLE_FRAME="single",a.SYNCHED="synched",a.inited=!1,a.init=function(){a.inited||(b.install(),a.inited=!0)},c._getLabels=function(){return this.timeline.getLabels()},c.getLabels=createjs.deprecate(c._getLabels,"MovieClip.getLabels"),c._getCurrentLabel=function(){return this.timeline.currentLabel},c.getCurrentLabel=createjs.deprecate(c._getCurrentLabel,"MovieClip.getCurrentLabel"),c._getDuration=function(){return this.timeline.duration},c.getDuration=createjs.deprecate(c._getDuration,"MovieClip.getDuration");try{Object.defineProperties(c,{labels:{get:c._getLabels},currentLabel:{get:c._getCurrentLabel},totalFrames:{get:c._getDuration},duration:{get:c._getDuration}})}catch(d){}c.initialize=a,c.isVisible=function(){return!!(this.visible&&this.alpha>0&&0!=this.scaleX&&0!=this.scaleY)},c.draw=function(a,b){return this.DisplayObject_draw(a,b)?!0:(this._updateState(),this.Container_draw(a,b),!0)},c.play=function(){this.paused=!1},c.stop=function(){this.paused=!0},c.gotoAndPlay=function(a){this.paused=!1,this._goto(a)},c.gotoAndStop=function(a){this.paused=!0,this._goto(a)},c.advance=function(b){var c=a.INDEPENDENT;if(this.mode===c){for(var d=this,e=d.framerate;(d=d.parent)&&null===e;)d.mode===c&&(e=d._framerate);if(this._framerate=e,!this.paused){var f=null!==e&&-1!==e&&null!==b?b/(1e3/e)+this._t:1,g=0|f;for(this._t=f-g;g--;)this._updateTimeline(this._rawPosition+1,!1)}}},c.clone=function(){throw"MovieClip cannot be cloned."},c.toString=function(){return"[MovieClip (name="+this.name+")]"},c._updateState=function(){(-1===this._rawPosition||this.mode!==a.INDEPENDENT)&&this._updateTimeline(-1)},c._tick=function(a){this.advance(a&&a.delta),this.Container__tick(a)},c._goto=function(a){var b=this.timeline.resolve(a);null!=b&&(this._t=0,this._updateTimeline(b,!0))},c._reset=function(){this._rawPosition=-1,this._t=this.currentFrame=0,this.paused=!1},c._updateTimeline=function(b,c){var d=this.mode!==a.INDEPENDENT,e=this.timeline;d&&(b=this.startPosition+(this.mode===a.SINGLE_FRAME?0:this._synchOffset)),0>b&&(b=0),(this._rawPosition!==b||d)&&(this._rawPosition=b,e.loop=this.loop,e.setPosition(b,d||!this.actionsEnabled,c,this._bound_resolveState))},c._renderFirstFrame=function(){var a=this.timeline,b=a.rawPosition;a.setPosition(0,!0,!0,this._bound_resolveState),a.rawPosition=b},c._resolveState=function(){var a=this.timeline;this.currentFrame=a.position;for(var b in this._managed)this._managed[b]=1;for(var c=a.tweens,d=0,e=c.length;e>d;d++){var f=c[d],g=f.target;if(g!==this&&!f.passive){var h=f._stepPosition;g instanceof createjs.DisplayObject?this._addManagedChild(g,h):this._setState(g.state,h)}}var i=this.children;for(d=i.length-1;d>=0;d--){var j=i[d].id;1===this._managed[j]&&(this.removeChildAt(d),delete this._managed[j])}},c._setState=function(a,b){if(a)for(var c=a.length-1;c>=0;c--){var d=a[c],e=d.t,f=d.p;for(var g in f)e[g]=f[g];this._addManagedChild(e,b)}},c._addManagedChild=function(b,c){b._off||(this.addChildAt(b,0),b instanceof a&&(b._synchOffset=c,b.mode===a.INDEPENDENT&&b.autoReset&&!this._managed[b.id]&&b._reset()),this._managed[b.id]=2)},c._getBounds=function(a,b){var c=this.DisplayObject_getBounds();return c||this.frameBounds&&(c=this._rectangle.copy(this.frameBounds[this.currentFrame])),c?this._transformBounds(c,a,b):this.Container__getBounds(a,b)},createjs.MovieClip=createjs.promote(a,"Container"),b.priority=100,b.ID="MovieClip",b.install=function(){createjs.Tween._installPlugin(b)},b.init=function(c,d){"startPosition"===d&&c.target instanceof a&&c._addPlugin(b)},b.step=function(){},b.change=function(a,b,c,d,e){return"startPosition"===c?1===e?b.props[c]:b.prev.props[c]:void 0}}(),this.createjs=this.createjs||{},function(){"use strict";function a(){throw"SpriteSheetUtils cannot be instantiated"}var b=createjs.createCanvas?createjs.createCanvas():document.createElement("canvas");b.getContext&&(a._workingCanvas=b,a._workingContext=b.getContext("2d"),b.width=b.height=1),a.extractFrame=function(b,c){isNaN(c)&&(c=b.getAnimation(c).frames[0]);var d=b.getFrame(c);if(!d)return null;var e=d.rect,f=a._workingCanvas;f.width=e.width,f.height=e.height,a._workingContext.drawImage(d.image,e.x,e.y,e.width,e.height,0,0,e.width,e.height);var g=document.createElement("img");return g.src=f.toDataURL("image/png"),g},a.addFlippedFrames=createjs.deprecate(null,"SpriteSheetUtils.addFlippedFrames"),a.mergeAlpha=createjs.deprecate(null,"SpriteSheetUtils.mergeAlpha"),a._flip=function(b,c,d,e){for(var f=b._images,g=a._workingCanvas,h=a._workingContext,i=f.length/c,j=0;i>j;j++){var k=f[j];k.__tmp=j,h.setTransform(1,0,0,1,0,0),h.clearRect(0,0,g.width+1,g.height+1),g.width=k.width,g.height=k.height,h.setTransform(d?-1:1,0,0,e?-1:1,d?k.width:0,e?k.height:0),h.drawImage(k,0,0);var l=document.createElement("img");l.src=g.toDataURL("image/png"),l.width=k.width||k.naturalWidth,l.height=k.height||k.naturalHeight,f.push(l)}var m=b._frames,n=m.length/c;for(j=0;n>j;j++){k=m[j]; -var o=k.rect.clone();l=f[k.image.__tmp+i*c];var p={image:l,rect:o,regX:k.regX,regY:k.regY};d&&(o.x=(l.width||l.naturalWidth)-o.x-o.width,p.regX=o.width-k.regX),e&&(o.y=(l.height||l.naturalHeight)-o.y-o.height,p.regY=o.height-k.regY),m.push(p)}var q="_"+(d?"h":"")+(e?"v":""),r=b._animations,s=b._data,t=r.length/c;for(j=0;t>j;j++){var u=r[j];k=s[u];var v={name:u+q,speed:k.speed,next:k.next,frames:[]};k.next&&(v.next+=q),m=k.frames;for(var w=0,x=m.length;x>w;w++)v.frames.push(m[w]+n*c);s[v.name]=v,r.push(v.name)}},createjs.SpriteSheetUtils=a}(),this.createjs=this.createjs||{},function(){"use strict";function a(a){this.EventDispatcher_constructor(),this.maxWidth=2048,this.maxHeight=2048,this.spriteSheet=null,this.scale=1,this.padding=1,this.timeSlice=.3,this.progress=-1,this.framerate=a||0,this._frames=[],this._animations={},this._data=null,this._nextFrameIndex=0,this._index=0,this._timerID=null,this._scale=1}var b=createjs.extend(a,createjs.EventDispatcher);a.ERR_DIMENSIONS="frame dimensions exceed max spritesheet dimensions",a.ERR_RUNNING="a build is already running",b.addFrame=function(b,c,d,e,f){if(this._data)throw a.ERR_RUNNING;var g=c||b.bounds||b.nominalBounds;return!g&&b.getBounds&&(g=b.getBounds()),g?(d=d||1,this._frames.push({source:b,sourceRect:g,scale:d,funct:e,data:f,index:this._frames.length,height:g.height*d})-1):null},b.addAnimation=function(b,c,d,e){if(this._data)throw a.ERR_RUNNING;this._animations[b]={frames:c,next:d,speed:e}},b.addMovieClip=function(b,c,d,e,f,g){if(this._data)throw a.ERR_RUNNING;var h=b.frameBounds,i=c||b.bounds||b.nominalBounds;if(!i&&b.getBounds&&(i=b.getBounds()),i||h){var j,k,l=this._frames.length,m=b.timeline.duration;for(j=0;m>j;j++){var n=h&&h[j]?h[j]:i;this.addFrame(b,n,d,this._setupMovieClipFrame,{i:j,f:e,d:f})}var o=b.timeline._labels,p=[];for(var q in o)p.push({index:o[q],label:q});if(p.length)for(p.sort(function(a,b){return a.index-b.index}),j=0,k=p.length;k>j;j++){for(var r=p[j].label,s=l+p[j].index,t=l+(j==k-1?m:p[j+1].index),u=[],v=s;t>v;v++)u.push(v);(!g||(r=g(r,b,s,t)))&&this.addAnimation(r,u,!0)}}},b.build=function(){if(this._data)throw a.ERR_RUNNING;for(this._startBuild();this._drawNext(););return this._endBuild(),this.spriteSheet},b.buildAsync=function(b){if(this._data)throw a.ERR_RUNNING;this.timeSlice=b,this._startBuild();var c=this;this._timerID=setTimeout(function(){c._run()},50-50*Math.max(.01,Math.min(.99,this.timeSlice||.3)))},b.stopAsync=function(){clearTimeout(this._timerID),this._data=null},b.clone=function(){throw"SpriteSheetBuilder cannot be cloned."},b.toString=function(){return"[SpriteSheetBuilder]"},b._startBuild=function(){var b=this.padding||0;this.progress=0,this.spriteSheet=null,this._index=0,this._scale=this.scale;var c=[];this._data={images:[],frames:c,framerate:this.framerate,animations:this._animations};var d=this._frames.slice();if(d.sort(function(a,b){return a.height<=b.height?-1:1}),d[d.length-1].height+2*b>this.maxHeight)throw a.ERR_DIMENSIONS;for(var e=0,f=0,g=0;d.length;){var h=this._fillRow(d,e,g,c,b);if(h.w>f&&(f=h.w),e+=h.h,!h.h||!d.length){var i=createjs.createCanvas?createjs.createCanvas():document.createElement("canvas");i.width=this._getSize(f,this.maxWidth),i.height=this._getSize(e,this.maxHeight),this._data.images[g]=i,h.h||(f=e=0,g++)}}},b._setupMovieClipFrame=function(a,b){var c=a.actionsEnabled;a.actionsEnabled=!1,a.gotoAndStop(b.i),a.actionsEnabled=c,b.f&&b.f(a,b.d,b.i)},b._getSize=function(a,b){for(var c=4;Math.pow(2,++c)=0;l--){var m=b[l],n=this._scale*m.scale,o=m.sourceRect,p=m.source,q=Math.floor(n*o.x-f),r=Math.floor(n*o.y-f),s=Math.ceil(n*o.height+2*f),t=Math.ceil(n*o.width+2*f);if(t>g)throw a.ERR_DIMENSIONS;s>i||j+t>g||(m.img=d,m.rect=new createjs.Rectangle(j,c,t,s),k=k||s,b.splice(l,1),e[m.index]=[j,c,t,s,d,Math.round(-q+n*p.regX-f),Math.round(-r+n*p.regY-f)],j+=t)}return{w:j,h:k}},b._endBuild=function(){this.spriteSheet=new createjs.SpriteSheet(this._data),this._data=null,this.progress=1,this.dispatchEvent("complete")},b._run=function(){for(var a=50*Math.max(.01,Math.min(.99,this.timeSlice||.3)),b=(new Date).getTime()+a,c=!1;b>(new Date).getTime();)if(!this._drawNext()){c=!0;break}if(c)this._endBuild();else{var d=this;this._timerID=setTimeout(function(){d._run()},50-a)}var e=this.progress=this._index/this._frames.length;if(this.hasEventListener("progress")){var f=new createjs.Event("progress");f.progress=e,this.dispatchEvent(f)}},b._drawNext=function(){var a=this._frames[this._index],b=a.scale*this._scale,c=a.rect,d=a.sourceRect,e=this._data.images[a.img],f=e.getContext("2d");return a.funct&&a.funct(a.source,a.data),f.save(),f.beginPath(),f.rect(c.x,c.y,c.width,c.height),f.clip(),f.translate(Math.ceil(c.x-d.x*b),Math.ceil(c.y-d.y*b)),f.scale(b,b),a.source.draw(f),f.restore(),++this._index=!!d)return b;for(var e=0;d>e;e++){var f=c[e];if(f&&f.getBounds){var g=f.getBounds();g&&(0==e?b.setValues(g.x,g.y,g.width,g.height):b.extend(g.x,g.y,g.width,g.height))}}return b},b.toString=function(){return"[BitmapCache]"},b.define=function(a,b,c,d,e,f,g){if(!a)throw"No symbol to cache";this._options=g,this.target=a,this.width=d>=1?d:1,this.height=e>=1?e:1,this.x=b||0,this.y=c||0,this.scale=f||1,this.update()},b.update=function(b){if(!this.target)throw"define() must be called before update()";var c=a.getFilterBounds(this.target),d=this.target.cacheCanvas;this._drawWidth=Math.ceil(this.width*this.scale)+c.width,this._drawHeight=Math.ceil(this.height*this.scale)+c.height,d&&this._drawWidth==d.width&&this._drawHeight==d.height||this._updateSurface(),this._filterOffX=c.x,this._filterOffY=c.y,this.offX=this.x*this.scale+this._filterOffX,this.offY=this.y*this.scale+this._filterOffY,this._drawToCache(b),this.cacheID=this.cacheID?this.cacheID+1:1},b.release=function(){if(this._webGLCache)this._webGLCache.isCacheControlled||(this.__lastRT&&(this.__lastRT=void 0),this.__rtA&&this._webGLCache._killTextureObject(this.__rtA),this.__rtB&&this._webGLCache._killTextureObject(this.__rtB),this.target&&this.target.cacheCanvas&&this._webGLCache._killTextureObject(this.target.cacheCanvas)),this._webGLCache=!1;else{var a=this.target.stage;a instanceof createjs.StageGL&&a.releaseTexture(this.target.cacheCanvas)}this.target=this.target.cacheCanvas=null,this.cacheID=this._cacheDataURLID=this._cacheDataURL=void 0,this.width=this.height=this.x=this.y=this.offX=this.offY=0,this.scale=1},b.getCacheDataURL=function(){var a=this.target&&this.target.cacheCanvas;return a?(this.cacheID!=this._cacheDataURLID&&(this._cacheDataURLID=this.cacheID,this._cacheDataURL=a.toDataURL?a.toDataURL():null),this._cacheDataURL):null},b.draw=function(a){return this.target?(a.drawImage(this.target.cacheCanvas,this.x+this._filterOffX/this.scale,this.y+this._filterOffY/this.scale,this._drawWidth/this.scale,this._drawHeight/this.scale),!0):!1},b._updateSurface=function(){if(!this._options||!this._options.useGL){var a=this.target.cacheCanvas;return a||(a=this.target.cacheCanvas=createjs.createCanvas?createjs.createCanvas():document.createElement("canvas")),a.width=this._drawWidth,void(a.height=this._drawHeight)}if(!this._webGLCache)if("stage"===this._options.useGL){if(!this.target.stage||!this.target.stage.isWebGL){var b="Cannot use 'stage' for cache because the object's parent stage is ";throw b+=this.target.stage?"non WebGL.":"not set, please addChild to the correct stage."}this.target.cacheCanvas=!0,this._webGLCache=this.target.stage}else if("new"===this._options.useGL)this.target.cacheCanvas=document.createElement("canvas"),this._webGLCache=new createjs.StageGL(this.target.cacheCanvas,{antialias:!0,transparent:!0,autoPurge:-1}),this._webGLCache.isCacheControlled=!0;else{if(!(this._options.useGL instanceof createjs.StageGL))throw"Invalid option provided to useGL, expected ['stage', 'new', StageGL, undefined], got "+this._options.useGL;this.target.cacheCanvas=!0,this._webGLCache=this._options.useGL,this._webGLCache.isCacheControlled=!0}var a=this.target.cacheCanvas,c=this._webGLCache;c.isCacheControlled&&(a.width=this._drawWidth,a.height=this._drawHeight,c.updateViewport(this._drawWidth,this._drawHeight)),this.target.filters?(c.getTargetRenderTexture(this.target,this._drawWidth,this._drawHeight),c.getTargetRenderTexture(this.target,this._drawWidth,this._drawHeight)):c.isCacheControlled||c.getTargetRenderTexture(this.target,this._drawWidth,this._drawHeight)},b._drawToCache=function(a){var b=this.target.cacheCanvas,c=this.target,d=this._webGLCache;if(d)d.cacheDraw(c,c.filters,this),b=this.target.cacheCanvas,b.width=this._drawWidth,b.height=this._drawHeight;else{var e=b.getContext("2d");a||e.clearRect(0,0,this._drawWidth+1,this._drawHeight+1),e.save(),e.globalCompositeOperation=a,e.setTransform(this.scale,0,0,this.scale,-this._filterOffX,-this._filterOffY),e.translate(-this.x,-this.y),c.draw(e,!0),e.restore(),c.filters&&c.filters.length&&this._applyFilters(e)}b._invalid=!0},b._applyFilters=function(a){var b,c=this.target.filters,d=this._drawWidth,e=this._drawHeight,f=0,g=c[f];do g.usesContext?(b&&(a.putImageData(b,0,0),b=null),g.applyFilter(a,0,0,d,e)):(b||(b=a.getImageData(0,0,d,e)),g._applyFilter(b)),g=null!==g._multiPass?g._multiPass:c[++f];while(g);b&&a.putImageData(b,0,0)},createjs.BitmapCache=a}(),this.createjs=this.createjs||{},function(){"use strict";function a(a,b,c){this.Filter_constructor(),this._blurX=a,this._blurXTable=[],this._lastBlurX=null,this._blurY=b,this._blurYTable=[],this._lastBlurY=null,this._quality,this._lastQuality=null,this.FRAG_SHADER_TEMPLATE="uniform float xWeight[{{blurX}}];uniform float yWeight[{{blurY}}];uniform vec2 textureOffset;void main(void) {vec4 color = vec4(0.0);float xAdj = ({{blurX}}.0-1.0)/2.0;float yAdj = ({{blurY}}.0-1.0)/2.0;vec2 sampleOffset;for(int i=0; i<{{blurX}}; i++) {for(int j=0; j<{{blurY}}; j++) {sampleOffset = vRenderCoord + (textureOffset * vec2(float(i)-xAdj, float(j)-yAdj));color += texture2D(uSampler, sampleOffset) * (xWeight[i] * yWeight[j]);}}gl_FragColor = color.rgba;}",(isNaN(c)||1>c)&&(c=1),this.setQuality(0|c)}var b=createjs.extend(a,createjs.Filter);b.getBlurX=function(){return this._blurX},b.getBlurY=function(){return this._blurY},b.setBlurX=function(a){(isNaN(a)||0>a)&&(a=0),this._blurX=a},b.setBlurY=function(a){(isNaN(a)||0>a)&&(a=0),this._blurY=a},b.getQuality=function(){return this._quality},b.setQuality=function(a){(isNaN(a)||0>a)&&(a=0),this._quality=0|a},b._getShader=function(){var a=this._lastBlurX!==this._blurX,b=this._lastBlurY!==this._blurY,c=this._lastQuality!==this._quality;return a||b||c?((a||c)&&(this._blurXTable=this._getTable(this._blurX*this._quality)),(b||c)&&(this._blurYTable=this._getTable(this._blurY*this._quality)),this._updateShader(),this._lastBlurX=this._blurX,this._lastBlurY=this._blurY,void(this._lastQuality=this._quality)):this._compiledShader},b._setShader=function(){this._compiledShader};try{Object.defineProperties(b,{blurX:{get:b.getBlurX,set:b.setBlurX},blurY:{get:b.getBlurY,set:b.setBlurY},quality:{get:b.getQuality,set:b.setQuality},_builtShader:{get:b._getShader,set:b._setShader}})}catch(c){console.log(c)}b._getTable=function(a){var b=4.2;if(1>=a)return[1];var c=[],d=Math.ceil(2*a);d+=d%2?0:1;for(var e=d/2|0,f=-e;e>=f;f++){var g=f/e*b;c.push(1/Math.sqrt(2*Math.PI)*Math.pow(Math.E,-(Math.pow(g,2)/4)))}var h=c.reduce(function(a,b){return a+b});return c.map(function(a){return a/h})},b._updateShader=function(){if(void 0!==this._blurX&&void 0!==this._blurY){var a=this.FRAG_SHADER_TEMPLATE;a=a.replace(/\{\{blurX\}\}/g,this._blurXTable.length.toFixed(0)),a=a.replace(/\{\{blurY\}\}/g,this._blurYTable.length.toFixed(0)),this.FRAG_SHADER_BODY=a}},b.shaderParamSetup=function(a,b,c){a.uniform1fv(a.getUniformLocation(c,"xWeight"),this._blurXTable),a.uniform1fv(a.getUniformLocation(c,"yWeight"),this._blurYTable),a.uniform2f(a.getUniformLocation(c,"textureOffset"),2/(b._viewportWidth*this._quality),2/(b._viewportHeight*this._quality))},a.MUL_TABLE=[1,171,205,293,57,373,79,137,241,27,391,357,41,19,283,265,497,469,443,421,25,191,365,349,335,161,155,149,9,278,269,261,505,245,475,231,449,437,213,415,405,395,193,377,369,361,353,345,169,331,325,319,313,307,301,37,145,285,281,69,271,267,263,259,509,501,493,243,479,118,465,459,113,446,55,435,429,423,209,413,51,403,199,393,97,3,379,375,371,367,363,359,355,351,347,43,85,337,333,165,327,323,5,317,157,311,77,305,303,75,297,294,73,289,287,71,141,279,277,275,68,135,67,133,33,262,260,129,511,507,503,499,495,491,61,121,481,477,237,235,467,232,115,457,227,451,7,445,221,439,218,433,215,427,425,211,419,417,207,411,409,203,202,401,399,396,197,49,389,387,385,383,95,189,47,187,93,185,23,183,91,181,45,179,89,177,11,175,87,173,345,343,341,339,337,21,167,83,331,329,327,163,81,323,321,319,159,79,315,313,39,155,309,307,153,305,303,151,75,299,149,37,295,147,73,291,145,289,287,143,285,71,141,281,35,279,139,69,275,137,273,17,271,135,269,267,133,265,33,263,131,261,130,259,129,257,1],a.SHG_TABLE=[0,9,10,11,9,12,10,11,12,9,13,13,10,9,13,13,14,14,14,14,10,13,14,14,14,13,13,13,9,14,14,14,15,14,15,14,15,15,14,15,15,15,14,15,15,15,15,15,14,15,15,15,15,15,15,12,14,15,15,13,15,15,15,15,16,16,16,15,16,14,16,16,14,16,13,16,16,16,15,16,13,16,15,16,14,9,16,16,16,16,16,16,16,16,16,13,14,16,16,15,16,16,10,16,15,16,14,16,16,14,16,16,14,16,16,14,15,16,16,16,14,15,14,15,13,16,16,15,17,17,17,17,17,17,14,15,17,17,16,16,17,16,15,17,16,17,11,17,16,17,16,17,16,17,17,16,17,17,16,17,17,16,16,17,17,17,16,14,17,17,17,17,15,16,14,16,15,16,13,16,15,16,14,16,15,16,12,16,15,16,17,17,17,17,17,13,16,15,17,17,17,16,15,17,17,17,16,15,17,17,14,16,17,17,16,17,17,16,15,17,16,14,17,16,15,17,16,17,17,16,17,15,16,17,14,17,16,15,17,16,17,13,17,16,17,17,16,17,14,17,16,17,16,17,16,17,9],b.getBounds=function(a){var b=0|this.blurX,c=0|this.blurY;if(0>=b&&0>=c)return a;var d=Math.pow(this.quality,.2);return(a||new createjs.Rectangle).pad(c*d+1,b*d+1,c*d+1,b*d+1)},b.clone=function(){return new a(this.blurX,this.blurY,this.quality)},b.toString=function(){return"[BlurFilter]"},b._applyFilter=function(b){var c=this._blurX>>1;if(isNaN(c)||0>c)return!1;var d=this._blurY>>1;if(isNaN(d)||0>d)return!1;if(0==c&&0==d)return!1;var e=this.quality;(isNaN(e)||1>e)&&(e=1),e|=0,e>3&&(e=3),1>e&&(e=1);var f=b.data,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=c+c+1|0,w=d+d+1|0,x=0|b.width,y=0|b.height,z=x-1|0,A=y-1|0,B=c+1|0,C=d+1|0,D={r:0,b:0,g:0,a:0},E=D;for(i=1;v>i;i++)E=E.n={r:0,b:0,g:0,a:0};E.n=D;var F={r:0,b:0,g:0,a:0},G=F;for(i=1;w>i;i++)G=G.n={r:0,b:0,g:0,a:0};G.n=F;for(var H=null,I=0|a.MUL_TABLE[c],J=0|a.SHG_TABLE[c],K=0|a.MUL_TABLE[d],L=0|a.SHG_TABLE[d];e-->0;){m=l=0;var M=I,N=J;for(h=y;--h>-1;){for(n=B*(r=f[0|l]),o=B*(s=f[l+1|0]),p=B*(t=f[l+2|0]),q=B*(u=f[l+3|0]),E=D,i=B;--i>-1;)E.r=r,E.g=s,E.b=t,E.a=u,E=E.n;for(i=1;B>i;i++)j=l+((i>z?z:i)<<2)|0,n+=E.r=f[j],o+=E.g=f[j+1],p+=E.b=f[j+2],q+=E.a=f[j+3],E=E.n;for(H=D,g=0;x>g;g++)f[l++]=n*M>>>N,f[l++]=o*M>>>N,f[l++]=p*M>>>N,f[l++]=q*M>>>N,j=m+((j=g+c+1)g;g++){for(l=g<<2|0,n=C*(r=f[l])|0,o=C*(s=f[l+1|0])|0,p=C*(t=f[l+2|0])|0,q=C*(u=f[l+3|0])|0,G=F,i=0;C>i;i++)G.r=r,G.g=s,G.b=t,G.a=u,G=G.n;for(k=x,i=1;d>=i;i++)l=k+g<<2,n+=G.r=f[l],o+=G.g=f[l+1],p+=G.b=f[l+2],q+=G.a=f[l+3],G=G.n,A>i&&(k+=x);if(l=g,H=F,e>0)for(h=0;y>h;h++)j=l<<2,f[j+3]=u=q*M>>>N,u>0?(f[j]=n*M>>>N,f[j+1]=o*M>>>N,f[j+2]=p*M>>>N):f[j]=f[j+1]=f[j+2]=0,j=g+((j=h+C)h;h++)j=l<<2,f[j+3]=u=q*M>>>N,u>0?(u=255/u,f[j]=(n*M>>>N)*u,f[j+1]=(o*M>>>N)*u,f[j+2]=(p*M>>>N)*u):f[j]=f[j+1]=f[j+2]=0,j=g+((j=h+C)d;d+=4)b[d+3]=c[d]||0;return!0},b._prepAlphaMap=function(){if(!this.alphaMap)return!1;if(this.alphaMap==this._alphaMap&&this._mapData)return!0;this._mapData=null;var a,b=this._alphaMap=this.alphaMap,c=b;b instanceof HTMLCanvasElement?a=c.getContext("2d"):(c=createjs.createCanvas?createjs.createCanvas():document.createElement("canvas"),c.width=b.width,c.height=b.height,a=c.getContext("2d"),a.drawImage(b,0,0));try{var d=a.getImageData(0,0,b.width,b.height)}catch(e){return!1}return this._mapData=d.data,!0},createjs.AlphaMapFilter=createjs.promote(a,"Filter")}(),this.createjs=this.createjs||{},function(){"use strict";function a(a){this.Filter_constructor(),this.mask=a,this.usesContext=!0,this.FRAG_SHADER_BODY="uniform sampler2D uAlphaSampler;void main(void) {vec4 color = texture2D(uSampler, vRenderCoord);vec4 alphaMap = texture2D(uAlphaSampler, vTextureCoord);gl_FragColor = vec4(color.rgb, color.a * alphaMap.a);}"}var b=createjs.extend(a,createjs.Filter);b.shaderParamSetup=function(a,b,c){this._mapTexture||(this._mapTexture=a.createTexture()),a.activeTexture(a.TEXTURE1),a.bindTexture(a.TEXTURE_2D,this._mapTexture),b.setTextureParams(a),a.texImage2D(a.TEXTURE_2D,0,a.RGBA,a.RGBA,a.UNSIGNED_BYTE,this.mask),a.uniform1i(a.getUniformLocation(c,"uAlphaSampler"),1)},b.applyFilter=function(a,b,c,d,e,f,g,h){return this.mask?(f=f||a,null==g&&(g=b),null==h&&(h=c),f.save(),a!=f?!1:(f.globalCompositeOperation="destination-in",f.drawImage(this.mask,g,h),f.restore(),!0)):!0},b.clone=function(){return new a(this.mask)},b.toString=function(){return"[AlphaMaskFilter]"},createjs.AlphaMaskFilter=createjs.promote(a,"Filter")}(),this.createjs=this.createjs||{},function(){"use strict";function a(a,b,c,d,e,f,g,h){this.Filter_constructor(),this.redMultiplier=null!=a?a:1,this.greenMultiplier=null!=b?b:1,this.blueMultiplier=null!=c?c:1,this.alphaMultiplier=null!=d?d:1,this.redOffset=e||0,this.greenOffset=f||0,this.blueOffset=g||0,this.alphaOffset=h||0,this.FRAG_SHADER_BODY="uniform vec4 uColorMultiplier;uniform vec4 uColorOffset;void main(void) {vec4 color = texture2D(uSampler, vRenderCoord);gl_FragColor = (color * uColorMultiplier) + uColorOffset;}"}var b=createjs.extend(a,createjs.Filter);b.shaderParamSetup=function(a,b,c){a.uniform4f(a.getUniformLocation(c,"uColorMultiplier"),this.redMultiplier,this.greenMultiplier,this.blueMultiplier,this.alphaMultiplier),a.uniform4f(a.getUniformLocation(c,"uColorOffset"),this.redOffset/255,this.greenOffset/255,this.blueOffset/255,this.alphaOffset/255)},b.toString=function(){return"[ColorFilter]"},b.clone=function(){return new a(this.redMultiplier,this.greenMultiplier,this.blueMultiplier,this.alphaMultiplier,this.redOffset,this.greenOffset,this.blueOffset,this.alphaOffset)},b._applyFilter=function(a){for(var b=a.data,c=b.length,d=0;c>d;d+=4)b[d]=b[d]*this.redMultiplier+this.redOffset,b[d+1]=b[d+1]*this.greenMultiplier+this.greenOffset,b[d+2]=b[d+2]*this.blueMultiplier+this.blueOffset,b[d+3]=b[d+3]*this.alphaMultiplier+this.alphaOffset;return!0},createjs.ColorFilter=createjs.promote(a,"Filter")}(),this.createjs=this.createjs||{},function(){"use strict";function a(a,b,c,d){this.setColor(a,b,c,d)}var b=a.prototype;a.DELTA_INDEX=[0,.01,.02,.04,.05,.06,.07,.08,.1,.11,.12,.14,.15,.16,.17,.18,.2,.21,.22,.24,.25,.27,.28,.3,.32,.34,.36,.38,.4,.42,.44,.46,.48,.5,.53,.56,.59,.62,.65,.68,.71,.74,.77,.8,.83,.86,.89,.92,.95,.98,1,1.06,1.12,1.18,1.24,1.3,1.36,1.42,1.48,1.54,1.6,1.66,1.72,1.78,1.84,1.9,1.96,2,2.12,2.25,2.37,2.5,2.62,2.75,2.87,3,3.2,3.4,3.6,3.8,4,4.3,4.7,4.9,5,5.5,6,6.5,6.8,7,7.3,7.5,7.8,8,8.4,8.7,9,9.4,9.6,9.8,10],a.IDENTITY_MATRIX=[1,0,0,0,0,0,1,0,0,0,0,0,1,0,0,0,0,0,1,0,0,0,0,0,1],a.LENGTH=a.IDENTITY_MATRIX.length,b.setColor=function(a,b,c,d){return this.reset().adjustColor(a,b,c,d)},b.reset=function(){return this.copy(a.IDENTITY_MATRIX)},b.adjustColor=function(a,b,c,d){return this.adjustHue(d),this.adjustContrast(b),this.adjustBrightness(a),this.adjustSaturation(c)},b.adjustBrightness=function(a){return 0==a||isNaN(a)?this:(a=this._cleanValue(a,255),this._multiplyMatrix([1,0,0,0,a,0,1,0,0,a,0,0,1,0,a,0,0,0,1,0,0,0,0,0,1]),this)},b.adjustContrast=function(b){if(0==b||isNaN(b))return this;b=this._cleanValue(b,100);var c;return 0>b?c=127+b/100*127:(c=b%1,c=0==c?a.DELTA_INDEX[b]:a.DELTA_INDEX[b<<0]*(1-c)+a.DELTA_INDEX[(b<<0)+1]*c,c=127*c+127),this._multiplyMatrix([c/127,0,0,0,.5*(127-c),0,c/127,0,0,.5*(127-c),0,0,c/127,0,.5*(127-c),0,0,0,1,0,0,0,0,0,1]),this},b.adjustSaturation=function(a){if(0==a||isNaN(a))return this;a=this._cleanValue(a,100);var b=1+(a>0?3*a/100:a/100),c=.3086,d=.6094,e=.082;return this._multiplyMatrix([c*(1-b)+b,d*(1-b),e*(1-b),0,0,c*(1-b),d*(1-b)+b,e*(1-b),0,0,c*(1-b),d*(1-b),e*(1-b)+b,0,0,0,0,0,1,0,0,0,0,0,1]),this},b.adjustHue=function(a){if(0==a||isNaN(a))return this;a=this._cleanValue(a,180)/180*Math.PI;var b=Math.cos(a),c=Math.sin(a),d=.213,e=.715,f=.072;return this._multiplyMatrix([d+b*(1-d)+c*-d,e+b*-e+c*-e,f+b*-f+c*(1-f),0,0,d+b*-d+.143*c,e+b*(1-e)+.14*c,f+b*-f+c*-.283,0,0,d+b*-d+c*-(1-d),e+b*-e+c*e,f+b*(1-f)+c*f,0,0,0,0,0,1,0,0,0,0,0,1]),this},b.concat=function(b){return b=this._fixMatrix(b),b.length!=a.LENGTH?this:(this._multiplyMatrix(b),this)},b.clone=function(){return(new a).copy(this)},b.toArray=function(){for(var b=[],c=0,d=a.LENGTH;d>c;c++)b[c]=this[c];return b},b.copy=function(b){for(var c=a.LENGTH,d=0;c>d;d++)this[d]=b[d];return this},b.toString=function(){return"[ColorMatrix]"},b._multiplyMatrix=function(a){var b,c,d,e=[];for(b=0;5>b;b++){for(c=0;5>c;c++)e[c]=this[c+5*b];for(c=0;5>c;c++){var f=0;for(d=0;5>d;d++)f+=a[c+5*d]*e[d];this[c+5*b]=f}}},b._cleanValue=function(a,b){return Math.min(b,Math.max(-b,a))},b._fixMatrix=function(b){return b instanceof a&&(b=b.toArray()),b.lengtha.LENGTH&&(b=b.slice(0,a.LENGTH)),b},createjs.ColorMatrix=a}(),this.createjs=this.createjs||{},function(){"use strict";function a(a){this.Filter_constructor(),this.matrix=a,this.FRAG_SHADER_BODY="uniform mat4 uColorMatrix;uniform vec4 uColorMatrixOffset;void main(void) {vec4 color = texture2D(uSampler, vRenderCoord);mat4 m = uColorMatrix;vec4 newColor = vec4(0,0,0,0);newColor.r = color.r*m[0][0] + color.g*m[0][1] + color.b*m[0][2] + color.a*m[0][3];newColor.g = color.r*m[1][0] + color.g*m[1][1] + color.b*m[1][2] + color.a*m[1][3];newColor.b = color.r*m[2][0] + color.g*m[2][1] + color.b*m[2][2] + color.a*m[2][3];newColor.a = color.r*m[3][0] + color.g*m[3][1] + color.b*m[3][2] + color.a*m[3][3];gl_FragColor = newColor + uColorMatrixOffset;}"}var b=createjs.extend(a,createjs.Filter);b.shaderParamSetup=function(a,b,c){var d=this.matrix,e=new Float32Array([d[0],d[1],d[2],d[3],d[5],d[6],d[7],d[8],d[10],d[11],d[12],d[13],d[15],d[16],d[17],d[18]]);a.uniformMatrix4fv(a.getUniformLocation(c,"uColorMatrix"),!1,e),a.uniform4f(a.getUniformLocation(c,"uColorMatrixOffset"),d[4]/255,d[9]/255,d[14]/255,d[19]/255)},b.toString=function(){return"[ColorMatrixFilter]"},b.clone=function(){return new a(this.matrix)},b._applyFilter=function(a){for(var b,c,d,e,f=a.data,g=f.length,h=this.matrix,i=h[0],j=h[1],k=h[2],l=h[3],m=h[4],n=h[5],o=h[6],p=h[7],q=h[8],r=h[9],s=h[10],t=h[11],u=h[12],v=h[13],w=h[14],x=h[15],y=h[16],z=h[17],A=h[18],B=h[19],C=0;g>C;C+=4)b=f[C],c=f[C+1],d=f[C+2],e=f[C+3],f[C]=b*i+c*j+d*k+e*l+m,f[C+1]=b*n+c*o+d*p+e*q+r,f[C+2]=b*s+c*t+d*u+e*v+w,f[C+3]=b*x+c*y+d*z+e*A+B;return!0},createjs.ColorMatrixFilter=createjs.promote(a,"Filter")}(),this.createjs=this.createjs||{},function(){"use strict";function a(){throw"Touch cannot be instantiated"}a.isSupported=function(){return!!("ontouchstart"in window||window.navigator.msPointerEnabled&&window.navigator.msMaxTouchPoints>0||window.navigator.pointerEnabled&&window.navigator.maxTouchPoints>0)},a.enable=function(b,c,d){return b&&b.canvas&&a.isSupported()?b.__touch?!0:(b.__touch={pointers:{},multitouch:!c,preventDefault:!d,count:0},"ontouchstart"in window?a._IOS_enable(b):(window.navigator.msPointerEnabled||window.navigator.pointerEnabled)&&a._IE_enable(b),!0):!1},a.disable=function(b){b&&("ontouchstart"in window?a._IOS_disable(b):(window.navigator.msPointerEnabled||window.navigator.pointerEnabled)&&a._IE_disable(b),delete b.__touch)},a._IOS_enable=function(b){var c=b.canvas,d=b.__touch.f=function(c){a._IOS_handleEvent(b,c)};c.addEventListener("touchstart",d,!1),c.addEventListener("touchmove",d,!1),c.addEventListener("touchend",d,!1),c.addEventListener("touchcancel",d,!1)},a._IOS_disable=function(a){var b=a.canvas;if(b){var c=a.__touch.f;b.removeEventListener("touchstart",c,!1),b.removeEventListener("touchmove",c,!1),b.removeEventListener("touchend",c,!1),b.removeEventListener("touchcancel",c,!1)}},a._IOS_handleEvent=function(a,b){if(a){a.__touch.preventDefault&&b.preventDefault&&b.preventDefault();for(var c=b.changedTouches,d=b.type,e=0,f=c.length;f>e;e++){var g=c[e],h=g.identifier;g.target==a.canvas&&("touchstart"==d?this._handleStart(a,h,b,g.pageX,g.pageY):"touchmove"==d?this._handleMove(a,h,b,g.pageX,g.pageY):("touchend"==d||"touchcancel"==d)&&this._handleEnd(a,h,b))}}},a._IE_enable=function(b){var c=b.canvas,d=b.__touch.f=function(c){a._IE_handleEvent(b,c)};void 0===window.navigator.pointerEnabled?(c.addEventListener("MSPointerDown",d,!1),window.addEventListener("MSPointerMove",d,!1),window.addEventListener("MSPointerUp",d,!1),window.addEventListener("MSPointerCancel",d,!1),b.__touch.preventDefault&&(c.style.msTouchAction="none")):(c.addEventListener("pointerdown",d,!1),window.addEventListener("pointermove",d,!1),window.addEventListener("pointerup",d,!1),window.addEventListener("pointercancel",d,!1),b.__touch.preventDefault&&(c.style.touchAction="none")),b.__touch.activeIDs={}},a._IE_disable=function(a){var b=a.__touch.f;void 0===window.navigator.pointerEnabled?(window.removeEventListener("MSPointerMove",b,!1),window.removeEventListener("MSPointerUp",b,!1),window.removeEventListener("MSPointerCancel",b,!1),a.canvas&&a.canvas.removeEventListener("MSPointerDown",b,!1)):(window.removeEventListener("pointermove",b,!1),window.removeEventListener("pointerup",b,!1),window.removeEventListener("pointercancel",b,!1),a.canvas&&a.canvas.removeEventListener("pointerdown",b,!1))},a._IE_handleEvent=function(a,b){if(a){a.__touch.preventDefault&&b.preventDefault&&b.preventDefault();var c=b.type,d=b.pointerId,e=a.__touch.activeIDs;if("MSPointerDown"==c||"pointerdown"==c){if(b.srcElement!=a.canvas)return;e[d]=!0,this._handleStart(a,d,b,b.pageX,b.pageY)}else e[d]&&("MSPointerMove"==c||"pointermove"==c?this._handleMove(a,d,b,b.pageX,b.pageY):("MSPointerUp"==c||"MSPointerCancel"==c||"pointerup"==c||"pointercancel"==c)&&(delete e[d],this._handleEnd(a,d,b)))}},a._handleStart=function(a,b,c,d,e){var f=a.__touch;if(f.multitouch||!f.count){var g=f.pointers;g[b]||(g[b]=!0,f.count++,a._handlePointerDown(b,c,d,e))}},a._handleMove=function(a,b,c,d,e){a.__touch.pointers[b]&&a._handlePointerMove(b,c,d,e)},a._handleEnd=function(a,b,c){var d=a.__touch,e=d.pointers;e[b]&&(d.count--,a._handlePointerUp(b,c,!0),delete e[b])},createjs.Touch=a}(),this.createjs=this.createjs||{},function(){"use strict";var a=createjs.EaselJS=createjs.EaselJS||{};a.version="1.0.0",a.buildDate="Thu, 14 Sep 2017 19:47:53 GMT"}(); \ No newline at end of file +this.createjs=this.createjs||{};createjs.extend=function(t,e){"use strict";function i(){this.constructor=t}i.prototype=e.prototype;return t.prototype=new i};this.createjs=this.createjs||{};createjs.promote=function(t,e){"use strict";var i=t.prototype,r=Object.getPrototypeOf&&Object.getPrototypeOf(i)||i.__proto__;if(r){i[(e+="_")+"constructor"]=r.constructor;for(var s in r){if(i.hasOwnProperty(s)&&typeof r[s]=="function"){i[e+s]=r[s]}}}return t};this.createjs=this.createjs||{};createjs.indexOf=function(t,e){"use strict";for(var i=0,r=t.length;i=0&&!t.propagationStopped;n--){a[n]._dispatchEvent(t,1+(n==0))}for(n=1;n=(a._interval-1)*.97){a._tick()}};a._handleRAF=function(){a._timerId=null;a._setupTick();a._tick()};a._handleTimeout=function(){a._timerId=null;a._setupTick();a._tick()};a._setupTick=function(){if(a._timerId!=null){return}var t=a.timingMode;if(t==a.RAF_SYNCHED||t==a.RAF){var e=window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||window.oRequestAnimationFrame||window.msRequestAnimationFrame;if(e){a._timerId=e(t==a.RAF?a._handleRAF:a._handleSynch);a._raf=true;return}}a._raf=false;a._timerId=setTimeout(a._handleTimeout,a._interval)};a._tick=function(){var t=a.paused;var e=a._getTime();var i=e-a._lastTime;a._lastTime=e;a._ticks++;if(t){a._pausedTicks++;a._pausedTime+=i}if(a.hasEventListener("tick")){var r=new createjs.Event("tick");var s=a.maxDelta;r.delta=s&&i>s?s:i;r.paused=t;r.time=e;r.runTime=e-a._pausedTime;a.dispatchEvent(r)}a._tickTimes.unshift(a._getTime()-e);while(a._tickTimes.length>100){a._tickTimes.pop()}a._times.unshift(e);while(a._times.length>100){a._times.pop()}};var t=window,e=t.performance.now||t.performance.mozNow||t.performance.msNow||t.performance.oNow||t.performance.webkitNow;a._getTime=function(){return(e&&e.call(t.performance)||(new Date).getTime())-a._startTime};createjs.Ticker=a})();this.createjs=this.createjs||{};(function(){"use strict";function t(t){this.readyState=t.readyState;this._video=t;this._canvas=null;this._lastTime=-1;if(this.readyState<2){t.addEventListener("canplaythrough",this._videoReady.bind(this))}}var e=t.prototype;e.getImage=function(){if(this.readyState<2){return}var t=this._canvas,e=this._video;if(!t){t=this._canvas=createjs.createCanvas?createjs.createCanvas():document.createElement("canvas");t.width=e.videoWidth;t.height=e.videoHeight}if(e.readyState>=2&&e.currentTime!==this._lastTime){var i=t.getContext("2d");i.clearRect(0,0,t.width,t.height);i.drawImage(e,0,0,t.width,t.height);this._lastTime=e.currentTime}return t};e._videoReady=function(){this.readyState=2};createjs.VideoBuffer=t})();this.createjs=this.createjs||{};(function(){"use strict";function t(t,e,i,r,s,a,n,h,o,u,l){this.Event_constructor(t,e,i);this.stageX=r;this.stageY=s;this.rawX=o==null?r:o;this.rawY=u==null?s:u;this.nativeEvent=a;this.pointerID=n;this.primary=!!h;this.relatedTarget=l}var e=createjs.extend(t,createjs.Event);e._get_localX=function(){return this.currentTarget.globalToLocal(this.rawX,this.rawY).x};e._get_localY=function(){return this.currentTarget.globalToLocal(this.rawX,this.rawY).y};e._get_isTouch=function(){return this.pointerID!==-1};try{Object.defineProperties(e,{localX:{get:e._get_localX},localY:{get:e._get_localY},isTouch:{get:e._get_isTouch}})}catch(t){}e.clone=function(){return new t(this.type,this.bubbles,this.cancelable,this.stageX,this.stageY,this.nativeEvent,this.pointerID,this.primary,this.rawX,this.rawY)};e.toString=function(){return"[MouseEvent (type="+this.type+" stageX="+this.stageX+" stageY="+this.stageY+")]"};createjs.MouseEvent=createjs.promote(t,"Event")})();this.createjs=this.createjs||{};(function(){"use strict";function f(t,e,i,r,s,a){this.setValues(t,e,i,r,s,a)}var t=f.prototype;f.DEG_TO_RAD=Math.PI/180;f.identity=null;t.setValues=function(t,e,i,r,s,a){this.a=t==null?1:t;this.b=e||0;this.c=i||0;this.d=r==null?1:r;this.tx=s||0;this.ty=a||0;return this};t.append=function(t,e,i,r,s,a){var n=this.a;var h=this.b;var o=this.c;var u=this.d;if(t!=1||e!=0||i!=0||r!=1){this.a=n*t+o*e;this.b=h*t+u*e;this.c=n*i+o*r;this.d=h*i+u*r}this.tx=n*s+o*a+this.tx;this.ty=h*s+u*a+this.ty;return this};t.prepend=function(t,e,i,r,s,a){var n=this.a;var h=this.c;var o=this.tx;this.a=t*n+i*this.b;this.b=e*n+r*this.b;this.c=t*h+i*this.d;this.d=e*h+r*this.d;this.tx=t*o+i*this.ty+s;this.ty=e*o+r*this.ty+a;return this};t.appendMatrix=function(t){return this.append(t.a,t.b,t.c,t.d,t.tx,t.ty)};t.prependMatrix=function(t){return this.prepend(t.a,t.b,t.c,t.d,t.tx,t.ty)};t.appendTransform=function(t,e,i,r,s,a,n,h,o){if(s%360){var u=s*f.DEG_TO_RAD;var l=Math.cos(u);var c=Math.sin(u)}else{l=1;c=0}if(a||n){a*=f.DEG_TO_RAD;n*=f.DEG_TO_RAD;this.append(Math.cos(n),Math.sin(n),-Math.sin(a),Math.cos(a),t,e);this.append(l*i,c*i,-c*r,l*r,0,0)}else{this.append(l*i,c*i,-c*r,l*r,t,e)}if(h||o){this.tx-=h*this.a+o*this.c;this.ty-=h*this.b+o*this.d}return this};t.prependTransform=function(t,e,i,r,s,a,n,h,o){if(s%360){var u=s*f.DEG_TO_RAD;var l=Math.cos(u);var c=Math.sin(u)}else{l=1;c=0}if(h||o){this.tx-=h;this.ty-=o}if(a||n){a*=f.DEG_TO_RAD;n*=f.DEG_TO_RAD;this.prepend(l*i,c*i,-c*r,l*r,0,0);this.prepend(Math.cos(n),Math.sin(n),-Math.sin(a),Math.cos(a),t,e)}else{this.prepend(l*i,c*i,-c*r,l*r,t,e)}return this};t.rotate=function(t){t=t*f.DEG_TO_RAD;var e=Math.cos(t);var i=Math.sin(t);var r=this.a;var s=this.b;this.a=r*e+this.c*i;this.b=s*e+this.d*i;this.c=-r*i+this.c*e;this.d=-s*i+this.d*e;return this};t.skew=function(t,e){t=t*f.DEG_TO_RAD;e=e*f.DEG_TO_RAD;this.append(Math.cos(e),Math.sin(e),-Math.sin(t),Math.cos(t),0,0);return this};t.scale=function(t,e){this.a*=t;this.b*=t;this.c*=e;this.d*=e;return this};t.translate=function(t,e){this.tx+=this.a*t+this.c*e;this.ty+=this.b*t+this.d*e;return this};t.identity=function(){this.a=this.d=1;this.b=this.c=this.tx=this.ty=0;return this};t.invert=function(){var t=this.a;var e=this.b;var i=this.c;var r=this.d;var s=this.tx;var a=t*r-e*i;this.a=r/a;this.b=-e/a;this.c=-i/a;this.d=t/a;this.tx=(i*this.ty-r*s)/a;this.ty=-(t*this.ty-e*s)/a;return this};t.isIdentity=function(){return this.tx===0&&this.ty===0&&this.a===1&&this.b===0&&this.c===0&&this.d===1};t.equals=function(t){return this.tx===t.tx&&this.ty===t.ty&&this.a===t.a&&this.b===t.b&&this.c===t.c&&this.d===t.d};t.transformPoint=function(t,e,i){i=i||{};i.x=t*this.a+e*this.c+this.tx;i.y=t*this.b+e*this.d+this.ty;return i};t.decompose=function(t){if(t==null){t={}}t.x=this.tx;t.y=this.ty;t.scaleX=Math.sqrt(this.a*this.a+this.b*this.b);t.scaleY=Math.sqrt(this.c*this.c+this.d*this.d);var e=Math.atan2(-this.c,this.d);var i=Math.atan2(this.b,this.a);var r=Math.abs(1-e/i);if(r<1e-5){t.rotation=i/f.DEG_TO_RAD;if(this.a<0&&this.d>=0){t.rotation+=t.rotation<=0?180:-180}t.skewX=t.skewY=0}else{t.skewX=e/f.DEG_TO_RAD;t.skewY=i/f.DEG_TO_RAD}return t};t.copy=function(t){return this.setValues(t.a,t.b,t.c,t.d,t.tx,t.ty)};t.clone=function(){return new f(this.a,this.b,this.c,this.d,this.tx,this.ty)};t.toString=function(){return"[Matrix2D (a="+this.a+" b="+this.b+" c="+this.c+" d="+this.d+" tx="+this.tx+" ty="+this.ty+")]"};f.identity=new f;createjs.Matrix2D=f})();this.createjs=this.createjs||{};(function(){"use strict";function t(t,e,i,r,s){this.setValues(t,e,i,r,s)}var e=t.prototype;e.setValues=function(t,e,i,r,s){this.visible=t==null?true:!!t;this.alpha=e==null?1:e;this.shadow=i;this.compositeOperation=r;this.matrix=s||this.matrix&&this.matrix.identity()||new createjs.Matrix2D;return this};e.append=function(t,e,i,r,s){this.alpha*=e;this.shadow=i||this.shadow;this.compositeOperation=r||this.compositeOperation;this.visible=this.visible&&t;s&&this.matrix.appendMatrix(s);return this};e.prepend=function(t,e,i,r,s){this.alpha*=e;this.shadow=this.shadow||i;this.compositeOperation=this.compositeOperation||r;this.visible=this.visible&&t;s&&this.matrix.prependMatrix(s);return this};e.identity=function(){this.visible=true;this.alpha=1;this.shadow=this.compositeOperation=null;this.matrix.identity();return this};e.clone=function(){return new t(this.alpha,this.shadow,this.compositeOperation,this.visible,this.matrix.clone())};createjs.DisplayProps=t})();this.createjs=this.createjs||{};(function(){"use strict";function t(t,e){this.setValues(t,e)}var e=t.prototype;e.setValues=function(t,e){this.x=t||0;this.y=e||0;return this};e.copy=function(t){this.x=t.x;this.y=t.y;return this};e.clone=function(){return new t(this.x,this.y)};e.toString=function(){return"[Point (x="+this.x+" y="+this.y+")]"};createjs.Point=t})();this.createjs=this.createjs||{};(function(){"use strict";function a(t,e,i,r){this.setValues(t,e,i,r)}var t=a.prototype;t.setValues=function(t,e,i,r){this.x=t||0;this.y=e||0;this.width=i||0;this.height=r||0;return this};t.extend=function(t,e,i,r){i=i||0;r=r||0;if(t+i>this.x+this.width){this.width=t+i-this.x}if(e+r>this.y+this.height){this.height=e+r-this.y}if(t=this.x&&t+i<=this.x+this.width&&e>=this.y&&e+r<=this.y+this.height};t.union=function(t){return this.clone().extend(t.x,t.y,t.width,t.height)};t.intersection=function(t){var e=t.x,i=t.y,r=e+t.width,s=i+t.height;if(this.x>e){e=this.x}if(this.y>i){i=this.y}if(this.x+this.width0){s=this._images=[];for(e=0;e=t){break t}e++;this._frames.push({image:o,rect:new createjs.Rectangle(f,c,i,r),regX:this._regX,regY:this._regY});f+=i+s}c+=r+s}}this._numFrames=e};createjs.SpriteSheet=createjs.promote(t,"EventDispatcher")})();this.createjs=this.createjs||{};(function(){"use strict";function m(){this.command=null;this._stroke=null;this._strokeStyle=null;this._oldStrokeStyle=null;this._strokeDash=null;this._oldStrokeDash=null;this._strokeIgnoreScale=false;this._fill=null;this._instructions=[];this._commitIndex=0;this._activeInstructions=[];this._dirty=false;this._storeIndex=0;this.clear()}var t=m.prototype;var o=m;m.getRGB=function(t,e,i,r){if(t!=null&&i==null){r=e;i=t&255;e=t>>8&255;t=t>>16&255}if(r==null){return"rgb("+t+","+e+","+i+")"}else{return"rgba("+t+","+e+","+i+","+r+")"}};m.getHSL=function(t,e,i,r){if(r==null){return"hsl("+t%360+","+e+"%,"+i+"%)"}else{return"hsla("+t%360+","+e+"%,"+i+"%,"+r+")"}};m.BASE_64={A:0,B:1,C:2,D:3,E:4,F:5,G:6,H:7,I:8,J:9,K:10,L:11,M:12,N:13,O:14,P:15,Q:16,R:17,S:18,T:19,U:20,V:21,W:22,X:23,Y:24,Z:25,a:26,b:27,c:28,d:29,e:30,f:31,g:32,h:33,i:34,j:35,k:36,l:37,m:38,n:39,o:40,p:41,q:42,r:43,s:44,t:45,u:46,v:47,w:48,x:49,y:50,z:51,0:52,1:53,2:54,3:55,4:56,5:57,6:58,7:59,8:60,9:61,"+":62,"/":63};m.STROKE_CAPS_MAP=["butt","round","square"];m.STROKE_JOINTS_MAP=["miter","round","bevel"];var e=createjs.createCanvas?createjs.createCanvas():document.createElement("canvas");if(e.getContext){m._ctx=e.getContext("2d");e.width=e.height=1}t._getInstructions=function(){this._updateInstructions();return this._instructions};t.getInstructions=createjs.deprecate(t._getInstructions,"Graphics.getInstructions");try{Object.defineProperties(t,{instructions:{get:t._getInstructions}})}catch(t){}t.isEmpty=function(){return!(this._instructions.length||this._activeInstructions.length)};t.draw=function(t,e){this._updateInstructions();var i=this._instructions;for(var r=this._storeIndex,s=i.length;r>3;var f=e[c];if(!f||l&3){throw"bad path data (@"+r+"): "+u}var d=i[c];if(!c){n=h=0}a.length=0;r++;var _=(l>>2&1)+2;for(var p=0;p>5?-1:1;v=(v&31)<<6|o[t.charAt(r+1)];if(_==3){v=v<<6|o[t.charAt(r+2)]}v=g*v/10;if(p%2){n=v+=n}else{h=v+=h}a[p]=v;r+=_}f.apply(this,a)}return this};t.store=function(){this._updateInstructions(true);this._storeIndex=this._instructions.length;return this};t.unstore=function(){this._storeIndex=0;return this};t.clone=function(){var t=new m;t.command=this.command;t._stroke=this._stroke;t._strokeStyle=this._strokeStyle;t._strokeDash=this._strokeDash;t._strokeIgnoreScale=this._strokeIgnoreScale;t._fill=this._fill;t._instructions=this._instructions.slice();t._commitIndex=this._commitIndex;t._activeInstructions=this._activeInstructions.slice();t._dirty=this._dirty;t._storeIndex=this._storeIndex;return t};t.toString=function(){return"[Graphics]"};t.mt=t.moveTo;t.lt=t.lineTo;t.at=t.arcTo;t.bt=t.bezierCurveTo;t.qt=t.quadraticCurveTo;t.a=t.arc;t.r=t.rect;t.cp=t.closePath;t.c=t.clear;t.f=t.beginFill;t.lf=t.beginLinearGradientFill;t.rf=t.beginRadialGradientFill;t.bf=t.beginBitmapFill;t.ef=t.endFill;t.ss=t.setStrokeStyle;t.sd=t.setStrokeDash;t.s=t.beginStroke;t.ls=t.beginLinearGradientStroke;t.rs=t.beginRadialGradientStroke;t.bs=t.beginBitmapStroke;t.es=t.endStroke;t.dr=t.drawRect;t.rr=t.drawRoundRect;t.rc=t.drawRoundRectComplex;t.dc=t.drawCircle;t.de=t.drawEllipse;t.dp=t.drawPolyStar;t.p=t.decodePath;t._updateInstructions=function(t){var e=this._instructions,i=this._activeInstructions,r=this._commitIndex;if(this._dirty&&i.length){e.length=r;e.push(m.beginCmd);var s=i.length,a=e.length;e.length=a+s;for(var n=0;n=2){var i=this.style=m._ctx.createPattern(t,e||"");i.props={image:t,repetition:e,type:"bitmap"}}return this};t.path=false;t=(o.Stroke=function(t,e){this.style=t;this.ignoreScale=e}).prototype;t.exec=function(t){if(!this.style){return}t.strokeStyle=this.style;if(this.ignoreScale){t.save();t.setTransform(1,0,0,1,0,0)}t.stroke();if(this.ignoreScale){t.restore()}};t.linearGradient=o.Fill.prototype.linearGradient;t.radialGradient=o.Fill.prototype.radialGradient;t.bitmap=o.Fill.prototype.bitmap;t.path=false;t=(o.StrokeStyle=function(t,e,i,r,s){this.width=t;this.caps=e;this.joints=i;this.miterLimit=r;this.ignoreScale=s}).prototype;t.exec=function(t){t.lineWidth=this.width==null?"1":this.width;t.lineCap=this.caps==null?"butt":isNaN(this.caps)?this.caps:m.STROKE_CAPS_MAP[this.caps];t.lineJoin=this.joints==null?"miter":isNaN(this.joints)?this.joints:m.STROKE_JOINTS_MAP[this.joints];t.miterLimit=this.miterLimit==null?"10":this.miterLimit;t.ignoreScale=this.ignoreScale==null?false:this.ignoreScale};t.path=false;(o.StrokeDash=function(t,e){this.segments=t;this.offset=e||0}).prototype.exec=function(t){if(t.setLineDash){t.setLineDash(this.segments||o.StrokeDash.EMPTY_SEGMENTS);t.lineDashOffset=this.offset||0}};o.StrokeDash.EMPTY_SEGMENTS=[];(o.RoundRect=function(t,e,i,r,s,a,n,h){this.x=t;this.y=e;this.w=i;this.h=r;this.radiusTL=s;this.radiusTR=a;this.radiusBR=n;this.radiusBL=h}).prototype.exec=function(t){var e=(oe){l=e}if(c<0){c*=r=-1}if(c>e){c=e}if(f<0){f*=s=-1}if(f>e){f=e}if(d<0){d*=a=-1}if(d>e){d=e}t.moveTo(n+o-c,h);t.arcTo(n+o+c*r,h-c*r,n+o,h+c,c);t.lineTo(n+o,h+u-f);t.arcTo(n+o+f*s,h+u+f*s,n+o-f,h+u,f);t.lineTo(n+d,h+u);t.arcTo(n-d*a,h+u+d*a,n,h+u-d,d);t.lineTo(n,h+l);t.arcTo(n-l*i,h-l*i,n+l,h,l);t.closePath()};(o.Circle=function(t,e,i){this.x=t;this.y=e;this.radius=i}).prototype.exec=function(t){t.arc(this.x,this.y,this.radius,0,Math.PI*2)};(o.Ellipse=function(t,e,i,r){this.x=t;this.y=e;this.w=i;this.h=r}).prototype.exec=function(t){var e=this.x,i=this.y;var r=this.w,s=this.h;var a=.5522848;var n=r/2*a;var h=s/2*a;var o=e+r;var u=i+s;var l=e+r/2;var c=i+s/2;t.moveTo(e,c);t.bezierCurveTo(e,c-h,l-n,i,l,i);t.bezierCurveTo(l+n,i,o,c-h,o,c);t.bezierCurveTo(o,c+h,l+n,u,l,u);t.bezierCurveTo(l-n,u,e,c+h,e,c)};(o.PolyStar=function(t,e,i,r,s,a){this.x=t;this.y=e;this.radius=i;this.sides=r;this.pointSize=s;this.angle=a}).prototype.exec=function(t){var e=this.x,i=this.y;var r=this.radius;var s=(this.angle||0)/180*Math.PI;var a=this.sides;var n=1-(this.pointSize||0);var h=Math.PI/a;t.moveTo(e+Math.cos(s)*r,i+Math.sin(s)*r);for(var o=0;o0&&this.scaleX!=0&&this.scaleY!=0)};t.draw=function(t,e){var i=this.bitmapCache;if(i&&!e){return i.draw(t)}return false};t.updateContext=function(t){var e=this,i=e.mask,r=e._props.matrix;if(i&&i.graphics&&!i.graphics.isEmpty()){i.getMatrix(r);t.transform(r.a,r.b,r.c,r.d,r.tx,r.ty);i.graphics.drawAsPath(t);t.clip();r.invert();t.transform(r.a,r.b,r.c,r.d,r.tx,r.ty)}this.getMatrix(r);var s=r.tx,a=r.ty;if(n._snapToPixelEnabled&&e.snapToPixel){s=s+(s<0?-.5:.5)|0;a=a+(a<0?-.5:.5)|0}t.transform(r.a,r.b,r.c,r.d,s,a);t.globalAlpha*=e.alpha;if(e.compositeOperation){t.globalCompositeOperation=e.compositeOperation}if(e.shadow){this._applyShadow(t,e.shadow)}};t.cache=function(t,e,i,r,s,a){if(!this.bitmapCache){this.bitmapCache=new createjs.BitmapCache}this.bitmapCache.define(this,t,e,i,r,s,a)};t.updateCache=function(t){if(!this.bitmapCache){throw"cache() must be called before updateCache()"}this.bitmapCache.update(t)};t.uncache=function(){if(this.bitmapCache){this.bitmapCache.release();this.bitmapCache=undefined}};t.getCacheDataURL=function(){return this.bitmapCache?this.bitmapCache.getCacheDataURL():null};t.localToGlobal=function(t,e,i){return this.getConcatenatedMatrix(this._props.matrix).transformPoint(t,e,i||new createjs.Point)};t.globalToLocal=function(t,e,i){return this.getConcatenatedMatrix(this._props.matrix).invert().transformPoint(t,e,i||new createjs.Point)};t.localToLocal=function(t,e,i,r){r=this.localToGlobal(t,e,r);return i.globalToLocal(r.x,r.y,r)};t.setTransform=function(t,e,i,r,s,a,n,h,o){this.x=t||0;this.y=e||0;this.scaleX=i==null?1:i;this.scaleY=r==null?1:r;this.rotation=s||0;this.skewX=a||0;this.skewY=n||0;this.regX=h||0;this.regY=o||0;return this};t.getMatrix=function(t){var e=this,i=t&&t.identity()||new createjs.Matrix2D;return e.transformMatrix?i.copy(e.transformMatrix):i.appendTransform(e.x,e.y,e.scaleX,e.scaleY,e.rotation,e.skewX,e.skewY,e.regX,e.regY)};t.getConcatenatedMatrix=function(t){var e=this,i=this.getMatrix(t);while(e=e.parent){i.prependMatrix(e.getMatrix(e._props.matrix))}return i};t.getConcatenatedDisplayProps=function(t){t=t?t.identity():new createjs.DisplayProps;var e=this,i=e.getMatrix(t.matrix);do{t.prepend(e.visible,e.alpha,e.shadow,e.compositeOperation);if(e!=this){i.prependMatrix(e.getMatrix(e._props.matrix))}}while(e=e.parent);return t};t.hitTest=function(t,e){var i=n._hitTestContext;i.setTransform(1,0,0,1,-t,-e);this.draw(i);var r=this._testHit(i);i.setTransform(1,0,0,1,0,0);i.clearRect(0,0,2,2);return r};t.set=function(t){for(var e in t){this[e]=t[e]}return this};t.getBounds=function(){if(this._bounds){return this._rectangle.copy(this._bounds)}var t=this.cacheCanvas;if(t){var e=this._cacheScale;return this._rectangle.setValues(this._cacheOffsetX,this._cacheOffsetY,t.width/e,t.height/e)}return null};t.getTransformedBounds=function(){return this._getBounds()};t.setBounds=function(t,e,i,r){if(t==null){this._bounds=t;return}this._bounds=(this._bounds||new createjs.Rectangle).setValues(t,e,i,r)};t.clone=function(){return this._cloneProps(new n)};t.toString=function(){return"[DisplayObject (name="+this.name+")]"};t._updateState=null;t._cloneProps=function(t){t.alpha=this.alpha;t.mouseEnabled=this.mouseEnabled;t.tickEnabled=this.tickEnabled;t.name=this.name;t.regX=this.regX;t.regY=this.regY;t.rotation=this.rotation;t.scaleX=this.scaleX;t.scaleY=this.scaleY;t.shadow=this.shadow;t.skewX=this.skewX;t.skewY=this.skewY;t.visible=this.visible;t.x=this.x;t.y=this.y;t.compositeOperation=this.compositeOperation;t.snapToPixel=this.snapToPixel;t.filters=this.filters==null?null:this.filters.slice(0);t.mask=this.mask;t.hitArea=this.hitArea;t.cursor=this.cursor;t._bounds=this._bounds;return t};t._applyShadow=function(t,e){e=e||Shadow.identity;t.shadowColor=e.color;t.shadowOffsetX=e.offsetX;t.shadowOffsetY=e.offsetY;t.shadowBlur=e.blur};t._tick=function(t){var e=this._listeners;if(e&&e["tick"]){t.target=null;t.propagationStopped=t.immediatePropagationStopped=false;this.dispatchEvent(t)}};t._testHit=function(t){try{var e=t.getImageData(0,0,1,1).data[3]>1}catch(t){if(!n.suppressCrossDomainErrors){throw"An error has occurred. This is most likely due to security restrictions on reading canvas pixel data with local or cross-domain images."}}return e};t._getBounds=function(t,e){return this._transformBounds(this.getBounds(),t,e)};t._transformBounds=function(t,e,i){if(!t){return t}var r=t.x,s=t.y,a=t.width,n=t.height,h=this._props.matrix;h=i?h.identity():this.getMatrix(h);if(r||s){h.appendTransform(0,0,1,1,0,0,0,-r,-s)}if(e){h.prependMatrix(e)}var o=a*h.a,u=a*h.b;var l=n*h.c,c=n*h.d;var f=h.tx,d=h.ty;var _=f,p=f,v=d,g=d;if((r=o+f)<_){_=r}else if(r>p){p=r}if((r=o+l+f)<_){_=r}else if(r>p){p=r}if((r=l+f)<_){_=r}else if(r>p){p=r}if((s=u+d)g){g=s}if((s=u+c+d)g){g=s}if((s=c+d)g){g=s}return t.setValues(_,v,p-_,g-v)};t._hasMouseEventListener=function(){var t=n._MOUSE_EVENTS;for(var e=0,i=t.length;e0&&this.scaleX!=0&&this.scaleY!=0&&t)};t.draw=function(t,e){if(this.DisplayObject_draw(t,e)){return true}var i=this.children.slice();for(var r=0,s=i.length;r1){for(var i=0;ithis.children.length){return arguments[i-2]}if(i>2){for(var s=0;s1){var i=true;for(var r=0;r1){var i=[];for(var r=0;r=r){return}for(var s=0;s0,i==1);return r};t.getObjectUnderPoint=function(t,e,i){var r=this.localToGlobal(t,e);return this._getObjectsUnderPoint(r.x,r.y,null,i>0,i==1)};t.getBounds=function(){return this._getBounds(null,true)};t.getTransformedBounds=function(){return this._getBounds()};t.clone=function(t){var e=this._cloneProps(new p);if(t){this._cloneChildren(e)}return e};t.toString=function(){return"[Container (name="+this.name+")]"};t._tick=function(t){if(this.tickChildren){for(var e=this.children.length-1;e>=0;e--){var i=this.children[e];if(i.tickEnabled&&i._tick){i._tick(t)}}}this.DisplayObject__tick(t)};t._cloneChildren=function(t){if(t.children.length){t.removeAllChildren()}var e=t.children;for(var i=0,r=this.children.length;ithis.children.length-1){return false}var i=this.children[t];if(i){i.parent=null}this.children.splice(t,1);if(!e){i.dispatchEvent("removed")}return true};t._getObjectsUnderPoint=function(t,e,i,r,s,a){a=a||0;if(!a&&!this._testMask(this,t,e)){return null}var n,h=createjs.DisplayObject._hitTestContext;s=s||r&&this._hasMouseEventListener();var o=this.children,u=o.length;for(var l=u-1;l>=0;l--){var c=o[l];var f=c.hitArea;if(!c.visible||!f&&!c.isVisible()||r&&!c.mouseEnabled){continue}if(!f&&!this._testMask(c,t,e)){continue}if(!f&&c instanceof p){var d=c._getObjectsUnderPoint(t,e,i,r,s,a+1);if(!i&&d){return r&&!this.mouseChildren?this:d}}else{if(r&&!s&&!c._hasMouseEventListener()){continue}var _=c.getConcatenatedDisplayProps(c._props);n=_.matrix;if(f){n.appendMatrix(f.getMatrix(f._props.matrix));_.alpha=f.alpha}h.globalAlpha=_.alpha;h.setTransform(n.a,n.b,n.c,n.d,n.tx-t,n.ty-e);(f||c).draw(h);if(!this._testHit(h)){continue}h.setTransform(1,0,0,1,0,0);h.clearRect(0,0,2,2);if(i){i.push(c)}else{return r&&!this.mouseChildren?this:c}}}return null};t._testMask=function(t,e,i){var r=t.mask;if(!r||!r.graphics||r.graphics.isEmpty()){return true}var s=this._props.matrix,a=t.parent;s=a?a.getConcatenatedMatrix(s):s.identity();s=r.getMatrix(r._props.matrix).prependMatrix(s);var n=createjs.DisplayObject._hitTestContext;n.setTransform(s.a,s.b,s.c,s.d,s.tx-e,s.ty-i);r.graphics.drawAsPath(n);n.fillStyle="#000";n.fill();if(!this._testHit(n)){return false}n.setTransform(1,0,0,1,0,0);n.clearRect(0,0,2,2);return true};t._getBounds=function(t,e){var i=this.DisplayObject_getBounds();if(i){return this._transformBounds(i,t,e)}var r=this._props.matrix;r=e?r.identity():this.getMatrix(r);if(t){r.prependMatrix(t)}var s=this.children.length,a=null;for(var n=0;n=0&&r>=0&&i<=a-1&&r<=n-1){h.x=i;h.y=r}else if(this.mouseMoveOutside){h.x=i<0?0:i>a-1?a-1:i;h.y=r<0?0:r>n-1?n-1:r}h.posEvtObj=e;h.rawX=i;h.rawY=r;if(t===this._primaryPointerID||t===-1){this.mouseX=h.x;this.mouseY=h.y;this.mouseInBounds=h.inBounds}};e.recalculatePointerPosition=function(){var t=this._lastMouseClientXY;var e=window.scrollX||window.pageXOffset||document.documentElement.scrollLeft;var i=window.scrollY||window.pageYOffset||document.documentElement.scrollTop;if(t!=null){var r=t.ratio/this.getRatio();var s={};s.clientX=Math.round(t.clientX*r);s.clientY=Math.round(t.clientY*r);s.pageX=Math.round(s.clientX+e);s.pageY=Math.round(s.clientY+i);this._updatePointerPosition(-1,s,s.pageX,s.pageY)}};e.getRatio=function(){var t=0;var e=window.screen;var i=navigator.userAgent.toLowerCase();if(window.devicePixelRatio!==undefined){t=window.devicePixelRatio}else if(~i.indexOf("msie")){if(e.deviceXDPI&&e.logicalXDPI){t=e.deviceXDPI/e.logicalXDPI}}else if(window.outerWidth!==undefined&&window.innerWidth!==undefined){t=window.outerWidth/window.innerWidth}return t};e._handleMouseUp=function(t){this._handlePointerUp(-1,t,false)};e._handlePointerUp=function(t,e,i,r){var s=this._nextStage,a=this._getPointerData(t);if(this._prevStage&&r===undefined){return}var n=null,h=a.target;if(!r&&(h||s)){n=this._getObjectsUnderPoint(a.x,a.y,null,true)}if(a.down){this._dispatchMouseEvent(this,"stagemouseup",false,t,a,e,n);a.down=false}if(n==h){this._dispatchMouseEvent(h,"click",true,t,a,e)}this._dispatchMouseEvent(h,"pressup",true,t,a,e);if(i){if(t==this._primaryPointerID){this._primaryPointerID=null}delete this._pointerData[t]}else{a.target=null}s&&s._handlePointerUp(t,e,i,r||n&&this)};e._handleMouseDown=function(t){this._handlePointerDown(-1,t,t.pageX,t.pageY)};e._handlePointerDown=function(t,e,i,r,s){if(this.preventSelection){e.preventDefault()}if(this._primaryPointerID==null||t===-1){this._primaryPointerID=t}if(r!=null){this._updatePointerPosition(t,e,i,r)}var a=null,n=this._nextStage,h=this._getPointerData(t);if(!s){a=h.target=this._getObjectsUnderPoint(h.x,h.y,null,true)}if(h.inBounds){this._dispatchMouseEvent(this,"stagemousedown",false,t,h,e,a);h.down=true}this._dispatchMouseEvent(a,"mousedown",true,t,h,e);n&&n._handlePointerDown(t,e,i,r,s||a&&this)};e._testMouseOver=function(t,e,i){if(this._prevStage&&e===undefined){return}var r=this._nextStage;if(!this._mouseOverIntervalID){r&&r._testMouseOver(t,e,i);return}var s=this._getPointerData(-1);if(!s||!t&&this.mouseX==this._mouseOverX&&this.mouseY==this._mouseOverY&&this.mouseInBounds){return}var a=s.posEvtObj;var n=i||a&&a.target==this.canvas;var h=null,o=-1,u="",l,c,f;if(!e&&(t||this.mouseInBounds&&n)){h=this._getObjectsUnderPoint(this.mouseX,this.mouseY,null,true);this._mouseOverX=this.mouseX;this._mouseOverY=this.mouseY}var d=this._mouseOverTarget||[];var _=d[d.length-1];var p=this._mouseOverTarget=[];l=h;while(l){p.unshift(l);if(!u){u=l.cursor}l=l.parent}this.canvas.style.cursor=u;if(!e&&i){i.canvas.style.cursor=u}for(c=0,f=p.length;co;c--){this._dispatchMouseEvent(d[c],"rollout",false,-1,s,a,h)}for(c=p.length-1;c>o;c--){this._dispatchMouseEvent(p[c],"rollover",false,-1,s,a,_)}if(_!=h){this._dispatchMouseEvent(h,"mouseover",true,-1,s,a,_)}r&&r._testMouseOver(t,e||h&&this,i||n&&this)};e._handleDoubleClick=function(t,e){var i=null,r=this._nextStage,s=this._getPointerData(-1);if(!e){i=this._getObjectsUnderPoint(s.x,s.y,null,true);this._dispatchMouseEvent(i,"dblclick",true,-1,s,t)}r&&r._handleDoubleClick(t,e||i&&this)};e._dispatchMouseEvent=function(t,e,i,r,s,a,n){if(!t||!i&&!t.hasEventListener(e)){return}var h=new createjs.MouseEvent(e,i,false,s.x,s.y,a,r,r===this._primaryPointerID||r===-1,s.rawX,s.rawY,n);t.dispatchEvent(h)};createjs.Stage=createjs.promote(t,"Container")})();this.createjs=this.createjs||{};(function(){"use strict";function D(t,e){this.Stage_constructor(t);if(e!==undefined){if(typeof e!=="object"){throw"Invalid options object"}var i=e.premultiply;var r=e.transparent;var s=e.antialias;var a=e.preserveBuffer;var n=e.autoPurge}this.vocalDebug=false;this._preserveBuffer=a||false;this._antialias=s||false;this._transparent=r||false;this._premultiply=i||false;this._autoPurge=undefined;this.autoPurge=n;this._viewportWidth=0;this._viewportHeight=0;this._projectionMatrix=null;this._webGLContext=null;this._clearColor={r:.5,g:.5,b:.5,a:0};this._maxCardsPerBatch=D.DEFAULT_MAX_BATCH_SIZE;this._activeShader=null;this._vertices=null;this._vertexPositionBuffer=null;this._uvs=null;this._uvPositionBuffer=null;this._indices=null;this._textureIndexBuffer=null;this._alphas=null;this._alphaBuffer=null;this._textureDictionary=[];this._textureIDs={};this._batchTextures=[];this._baseTextures=[];this._batchTextureCount=8;this._lastTextureInsert=-1;this._batchID=0;this._drawID=0;this._slotBlacklist=[];this._isDrawing=0;this._lastTrackedCanvas=0;this.isCacheControlled=false;this._cacheContainer=new createjs.Container;this._initializeWebGL()}var t=createjs.extend(D,createjs.Stage);D.buildUVRects=function(t,e,i){if(!t||!t._frames){return null}if(e===undefined){e=-1}if(i===undefined){i=false}var r=e!=-1&&i?e:0;var s=e!=-1&&i?e+1:t._frames.length;for(var a=r;athis._maxTextureSlots||t<0){throw"Slot outside of acceptable range"}this._slotBlacklist[t]=!!e};t.getTargetRenderTexture=function(t,e,i){var r,s=false;var a=this._webGLContext;if(t.__lastRT!==undefined&&t.__lastRT===t.__rtA){s=true}if(!s){if(t.__rtA===undefined){t.__rtA=this.getRenderBufferTexture(e,i)}else{if(e!=t.__rtA._width||i!=t.__rtA._height){this.resizeTexture(t.__rtA,e,i)}this.setTextureParams(a)}r=t.__rtA}else{if(t.__rtB===undefined){t.__rtB=this.getRenderBufferTexture(e,i)}else{if(e!=t.__rtB._width||i!=t.__rtB._height){this.resizeTexture(t.__rtB,e,i)}this.setTextureParams(a)}r=t.__rtB}if(!r){throw"Problems creating render textures, known causes include using too much VRAM by not releasing WebGL texture instances"}t.__lastRT=r;return r};t.releaseTexture=function(t){var e,i;if(!t){return}if(t.children){for(e=0,i=t.children.length;e0?t:1)||1;var r=Math.ceil(e>0?e:1)||1;var s=this._webGLContext;var a=s.createTexture();this.resizeTexture(a,i,r);this.setTextureParams(s,false);return a};t.resizeTexture=function(t,e,i){var r=this._webGLContext;r.bindTexture(r.TEXTURE_2D,t);r.texImage2D(r.TEXTURE_2D,0,r.RGBA,e,i,0,r.RGBA,r.UNSIGNED_BYTE,null);t.width=e;t.height=i};t.getRenderBufferTexture=function(t,e){var i=this._webGLContext;var r=this.getBaseTexture(t,e);if(!r){return null}var s=i.createFramebuffer();if(!s){return null}r.width=t;r.height=e;i.bindFramebuffer(i.FRAMEBUFFER,s);i.framebufferTexture2D(i.FRAMEBUFFER,i.COLOR_ATTACHMENT0,i.TEXTURE_2D,r,0);s._renderTexture=r;r._frameBuffer=s;r._storeID=this._textureDictionary.length;this._textureDictionary[r._storeID]=r;i.bindFramebuffer(i.FRAMEBUFFER,null);return r};t.setTextureParams=function(t,e){if(e&&this._antialias){t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MIN_FILTER,t.LINEAR);t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MAG_FILTER,t.LINEAR)}else{t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MIN_FILTER,t.NEAREST);t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MAG_FILTER,t.NEAREST)}t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_S,t.CLAMP_TO_EDGE);t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_T,t.CLAMP_TO_EDGE)};t.setClearColor=function(t){var e,i,r,s,a;if(typeof t=="string"){if(t.indexOf("#")==0){if(t.length==4){t="#"+t.charAt(1)+t.charAt(1)+t.charAt(2)+t.charAt(2)+t.charAt(3)+t.charAt(3)}e=Number("0x"+t.slice(1,3))/255;i=Number("0x"+t.slice(3,5))/255;r=Number("0x"+t.slice(5,7))/255;s=Number("0x"+t.slice(7,9))/255}else if(t.indexOf("rgba(")==0){a=t.slice(5,-1).split(",");e=Number(a[0])/255;i=Number(a[1])/255;r=Number(a[2])/255;s=Number(a[3])}}else{e=((t&4278190080)>>>24)/255;i=((t&16711680)>>>16)/255;r=((t&65280)>>>8)/255;s=(t&255)/255}this._clearColor.r=e||0;this._clearColor.g=i||0;this._clearColor.b=r||0;this._clearColor.a=s||0;if(!this._webGLContext){return}this._webGLContext.clearColor(this._clearColor.r,this._clearColor.g,this._clearColor.b,this._clearColor.a)};t.toString=function(){return"[StageGL (name="+this.name+")]"};t._fetchWebGLContext=function(t,e){var i;try{i=t.getContext("webgl",e)||t.getContext("experimental-webgl",e)}catch(t){}if(!i){var r="Could not initialize WebGL";console.error?console.error(r):console.log(r)}else{i.viewportWidth=t.width;i.viewportHeight=t.height}return i};t._fetchShaderProgram=function(t,e,i,r,s){t.useProgram(null);var a,n;switch(e){case"filter":n=D.COVER_VERTEX_HEADER+(i||D.COVER_VERTEX_BODY);a=D.COVER_FRAGMENT_HEADER+(r||D.COVER_FRAGMENT_BODY);break;case"particle":n=D.REGULAR_VERTEX_HEADER+D.PARTICLE_VERTEX_BODY;a=D.REGULAR_FRAGMENT_HEADER+D.PARTICLE_FRAGMENT_BODY;break;case"override":n=D.REGULAR_VERTEX_HEADER+(i||D.REGULAR_VERTEX_BODY);a=D.REGULAR_FRAGMENT_HEADER+(r||D.REGULAR_FRAGMENT_BODY);break;case"regular":default:n=D.REGULAR_VERTEX_HEADER+D.REGULAR_VERTEX_BODY;a=D.REGULAR_FRAGMENT_HEADER+D.REGULAR_FRAGMENT_BODY;break}var h=this._createShader(t,t.VERTEX_SHADER,n);var o=this._createShader(t,t.FRAGMENT_SHADER,a);var u=t.createProgram();t.attachShader(u,h);t.attachShader(u,o);t.linkProgram(u);u._type=e;if(!t.getProgramParameter(u,t.LINK_STATUS)){t.useProgram(this._activeShader);throw t.getProgramInfoLog(u)}t.useProgram(u);switch(e){case"filter":u.vertexPositionAttribute=t.getAttribLocation(u,"vertexPosition");t.enableVertexAttribArray(u.vertexPositionAttribute);u.uvPositionAttribute=t.getAttribLocation(u,"uvPosition");t.enableVertexAttribArray(u.uvPositionAttribute);u.samplerUniform=t.getUniformLocation(u,"uSampler");t.uniform1i(u.samplerUniform,0);u.uprightUniform=t.getUniformLocation(u,"uUpright");t.uniform1f(u.uprightUniform,0);if(s){s(t,this,u)}break;case"override":case"particle":case"regular":default:u.vertexPositionAttribute=t.getAttribLocation(u,"vertexPosition");t.enableVertexAttribArray(u.vertexPositionAttribute);u.uvPositionAttribute=t.getAttribLocation(u,"uvPosition");t.enableVertexAttribArray(u.uvPositionAttribute);u.textureIndexAttribute=t.getAttribLocation(u,"textureIndex");t.enableVertexAttribArray(u.textureIndexAttribute);u.alphaAttribute=t.getAttribLocation(u,"objectAlpha");t.enableVertexAttribArray(u.alphaAttribute);var l=[];for(var c=0;ct.MAX_TEXTURE_SIZE||e.height>t.MAX_TEXTURE_SIZE){console&&console.error("Oversized Texture: "+e.width+"x"+e.height+" vs "+t.MAX_TEXTURE_SIZE+"max")}}};t._insertTextureInBatch=function(t,e){if(this._batchTextures[e._activeIndex]!==e){var i=-1;var r=(this._lastTextureInsert+1)%this._batchTextureCount;var s=r;do{if(this._batchTextures[s]._batchID!=this._batchID&&!this._slotBlacklist[s]){i=s;break}s=(s+1)%this._batchTextureCount}while(s!==r);if(i===-1){this.batchReason="textureOverflow";this._drawBuffers(t);this.batchCardCount=0;i=r}this._batchTextures[i]=e;e._activeIndex=i;var a=e._imageData;if(a&&a._invalid&&e._drawID!==undefined){this._updateTextureImageData(t,a)}else{t.activeTexture(t.TEXTURE0+i);t.bindTexture(t.TEXTURE_2D,e);this.setTextureParams(t)}this._lastTextureInsert=i}else{var a=e._imageData;if(e._storeID!=undefined&&a&&a._invalid){this._updateTextureImageData(t,a)}}e._drawID=this._drawID;e._batchID=this._batchID};t._killTextureObject=function(t){if(!t){return}var e=this._webGLContext;if(t._storeID!==undefined&&t._storeID>=0){this._textureDictionary[t._storeID]=undefined;for(var i in this._textureIDs){if(this._textureIDs[i]==t._storeID){delete this._textureIDs[i]}}if(t._imageData){t._imageData._storeID=undefined}t._imageData=t._storeID=undefined}if(t._activeIndex!==undefined&&this._batchTextures[t._activeIndex]===t){this._batchTextures[t._activeIndex]=this._baseTextures[t._activeIndex]}try{if(t._frameBuffer){e.deleteFramebuffer(t._frameBuffer)}t._frameBuffer=undefined}catch(t){if(this.vocalDebug){console.log(t)}}try{e.deleteTexture(t)}catch(t){if(this.vocalDebug){console.log(t)}}};t._backupBatchTextures=function(t,e){var i=this._webGLContext;if(!this._backupTextures){this._backupTextures=[]}if(e===undefined){e=this._backupTextures}for(var r=0;r0){this._drawBuffers(e)}this._isDrawing++;this._drawID++;this.batchCardCount=0;this.depth=0;this._appendToBatchGroup(t,e,new createjs.Matrix2D,this.alpha,i);this.batchReason="drawFinish";this._drawBuffers(e);this._isDrawing--};t._cacheDraw=function(t,e,i,r){var s;var a=this._activeShader;var n=this._slotBlacklist;var h=this._maxTextureSlots-1;var o=this._viewportWidth,u=this._viewportHeight;this.protectTextureSlot(h,true);var l=e.getMatrix();l=l.clone();l.scale(1/r.scale,1/r.scale);l=l.invert();l.translate(-r.offX/r.scale*e.scaleX,-r.offY/r.scale*e.scaleY);var c=this._cacheContainer;c.children=[e];c.transformMatrix=l;this._backupBatchTextures(false);if(i&&i.length){this._drawFilters(e,i,r)}else{if(this.isCacheControlled){t.clear(t.COLOR_BUFFER_BIT);this._batchDraw(c,t,true)}else{t.activeTexture(t.TEXTURE0+h);e.cacheCanvas=this.getTargetRenderTexture(e,r._drawWidth,r._drawHeight);s=e.cacheCanvas;t.bindFramebuffer(t.FRAMEBUFFER,s._frameBuffer);this.updateViewport(r._drawWidth,r._drawHeight);this._projectionMatrix=this._projectionMatrixFlip;t.clear(t.COLOR_BUFFER_BIT);this._batchDraw(c,t,true);t.bindFramebuffer(t.FRAMEBUFFER,null);this.updateViewport(o,u)}}this._backupBatchTextures(true);this.protectTextureSlot(h,false);this._activeShader=a;this._slotBlacklist=n};t._drawFilters=function(t,e,i){var r=this._webGLContext;var s;var a=this._maxTextureSlots-1;var n=this._viewportWidth,h=this._viewportHeight;var o=this._cacheContainer;var u=e.length;r.activeTexture(r.TEXTURE0+a);s=this.getTargetRenderTexture(t,i._drawWidth,i._drawHeight);r.bindFramebuffer(r.FRAMEBUFFER,s._frameBuffer);this.updateViewport(i._drawWidth,i._drawHeight);r.clear(r.COLOR_BUFFER_BIT);this._batchDraw(o,r,true);r.activeTexture(r.TEXTURE0);r.bindTexture(r.TEXTURE_2D,s);this.setTextureParams(r);var l=false;var c=0,f=e[c];do{this._activeShader=this.getFilterShader(f);if(!this._activeShader){continue}r.activeTexture(r.TEXTURE0+a);s=this.getTargetRenderTexture(t,i._drawWidth,i._drawHeight);r.bindFramebuffer(r.FRAMEBUFFER,s._frameBuffer);r.viewport(0,0,i._drawWidth,i._drawHeight);r.clear(r.COLOR_BUFFER_BIT);this._drawCover(r,l);r.activeTexture(r.TEXTURE0);r.bindTexture(r.TEXTURE_2D,s);this.setTextureParams(r);if(u>1||e[0]._multiPass){l=!l}f=f._multiPass!==null?f._multiPass:e[++c]}while(f);if(this.isCacheControlled){r.bindFramebuffer(r.FRAMEBUFFER,null);this.updateViewport(n,h);this._activeShader=this.getFilterShader(this);r.clear(r.COLOR_BUFFER_BIT);this._drawCover(r,l)}else{if(l){r.activeTexture(r.TEXTURE0+a);s=this.getTargetRenderTexture(t,i._drawWidth,i._drawHeight);r.bindFramebuffer(r.FRAMEBUFFER,s._frameBuffer);this._activeShader=this.getFilterShader(this);r.viewport(0,0,i._drawWidth,i._drawHeight);r.clear(r.COLOR_BUFFER_BIT);this._drawCover(r,!l)}r.bindFramebuffer(r.FRAMEBUFFER,null);this.updateViewport(n,h);t.cacheCanvas=s}};t._appendToBatchGroup=function(t,e,i,r,s){if(!t._glMtx){t._glMtx=new createjs.Matrix2D}var a=t._glMtx;a.copy(i);if(t.transformMatrix){a.appendMatrix(t.transformMatrix)}else{a.appendTransform(t.x,t.y,t.scaleX,t.scaleY,t.rotation,t.skewX,t.skewY,t.regX,t.regY)}var n,h,o,u;var l=t.children.length;for(var c=0;cthis._maxCardsPerBatch){this.batchReason="vertexOverflow";this._drawBuffers(e);this.batchCardCount=0}if(!f._glMtx){f._glMtx=new createjs.Matrix2D}var d=f._glMtx;d.copy(a);if(f.transformMatrix){d.appendMatrix(f.transformMatrix)}else{d.appendTransform(f.x,f.y,f.scaleX,f.scaleY,f.rotation,f.skewX,f.skewY,f.regX,f.regY)}var _,p,v,g,m,x;var b=f.cacheCanvas&&!s;if(f._webGLRenderStyle===2||b){v=(s?false:f.cacheCanvas)||f.image}else if(f._webGLRenderStyle===1){g=f.spriteSheet.getFrame(f.currentFrame);if(g===null){continue}v=g.image}else{continue}var w=this._uvs;var E=this._vertices;var T=this._indices;var R=this._alphas;if(!v){continue}if(v._storeID===undefined){m=this._loadTextureImage(e,v);this._insertTextureInBatch(e,m)}else{m=this._textureDictionary[v._storeID];if(!m){if(this.vocalDebug){console.log("Texture should not be looked up while not being stored.")}continue}if(m._batchID!==this._batchID){this._insertTextureInBatch(e,m)}}p=m._activeIndex;if(f._webGLRenderStyle===2||b){if(!b&&f.sourceRect){if(!f._uvRect){f._uvRect={}}x=f.sourceRect;_=f._uvRect;_.t=x.y/v.height;_.l=x.x/v.width;_.b=(x.y+x.height)/v.height;_.r=(x.x+x.width)/v.width;n=0;h=0;o=x.width+n;u=x.height+h}else{_=D.UV_RECT;if(b){x=f.bitmapCache;n=x.x+x._filterOffX/x.scale;h=x.y+x._filterOffY/x.scale;o=x._drawWidth/x.scale+n;u=x._drawHeight/x.scale+h}else{n=0;h=0;o=v.width+n;u=v.height+h}}}else if(f._webGLRenderStyle===1){var y=g.rect;_=g.uvRect;if(!_){_=D.buildUVRects(f.spriteSheet,f.currentFrame,false)}n=-g.regX;h=-g.regY;o=y.width-g.regX;u=y.height-g.regY}var C=this.batchCardCount*D.INDICIES_PER_CARD;var S=C*2;E[S]=n*d.a+h*d.c+d.tx;E[S+1]=n*d.b+h*d.d+d.ty;E[S+2]=n*d.a+u*d.c+d.tx;E[S+3]=n*d.b+u*d.d+d.ty;E[S+4]=o*d.a+h*d.c+d.tx;E[S+5]=o*d.b+h*d.d+d.ty;E[S+6]=E[S+2];E[S+7]=E[S+3];E[S+8]=E[S+4];E[S+9]=E[S+5];E[S+10]=o*d.a+u*d.c+d.tx;E[S+11]=o*d.b+u*d.d+d.ty;w[S]=_.l;w[S+1]=_.t;w[S+2]=_.l;w[S+3]=_.b;w[S+4]=_.r;w[S+5]=_.t;w[S+6]=_.l;w[S+7]=_.b;w[S+8]=_.r;w[S+9]=_.t;w[S+10]=_.r;w[S+11]=_.b;T[C]=T[C+1]=T[C+2]=T[C+3]=T[C+4]=T[C+5]=p;R[C]=R[C+1]=R[C+2]=R[C+3]=R[C+4]=R[C+5]=f.alpha*r;this.batchCardCount++}};t._drawBuffers=function(t){if(this.batchCardCount<=0){return}if(this.vocalDebug){console.log("Draw["+this._drawID+":"+this._batchID+"] : "+this.batchReason)}var e=this._activeShader;var i=this._vertexPositionBuffer;var r=this._textureIndexBuffer;var s=this._uvPositionBuffer;var a=this._alphaBuffer;t.useProgram(e);t.bindBuffer(t.ARRAY_BUFFER,i);t.vertexAttribPointer(e.vertexPositionAttribute,i.itemSize,t.FLOAT,false,0,0);t.bufferSubData(t.ARRAY_BUFFER,0,this._vertices);t.bindBuffer(t.ARRAY_BUFFER,r);t.vertexAttribPointer(e.textureIndexAttribute,r.itemSize,t.FLOAT,false,0,0);t.bufferSubData(t.ARRAY_BUFFER,0,this._indices);t.bindBuffer(t.ARRAY_BUFFER,s);t.vertexAttribPointer(e.uvPositionAttribute,s.itemSize,t.FLOAT,false,0,0);t.bufferSubData(t.ARRAY_BUFFER,0,this._uvs);t.bindBuffer(t.ARRAY_BUFFER,a);t.vertexAttribPointer(e.alphaAttribute,a.itemSize,t.FLOAT,false,0,0);t.bufferSubData(t.ARRAY_BUFFER,0,this._alphas);t.uniformMatrix4fv(e.pMatrixUniform,t.FALSE,this._projectionMatrix);for(var n=0;n0){this._drawBuffers(t)}if(this.vocalDebug){console.log("Draw["+this._drawID+":"+this._batchID+"] : "+"Cover")}var i=this._activeShader;var r=this._vertexPositionBuffer;var s=this._uvPositionBuffer;t.clear(t.COLOR_BUFFER_BIT);t.useProgram(i);t.bindBuffer(t.ARRAY_BUFFER,r);t.vertexAttribPointer(i.vertexPositionAttribute,r.itemSize,t.FLOAT,false,0,0);t.bufferSubData(t.ARRAY_BUFFER,0,D.COVER_VERT);t.bindBuffer(t.ARRAY_BUFFER,s);t.vertexAttribPointer(i.uvPositionAttribute,s.itemSize,t.FLOAT,false,0,0);t.bufferSubData(t.ARRAY_BUFFER,0,e?D.COVER_UV_FLIP:D.COVER_UV);t.uniform1i(i.samplerUniform,0);t.uniform1f(i.uprightUniform,e?0:1);t.drawArrays(t.TRIANGLES,0,D.INDICIES_PER_CARD)};createjs.StageGL=createjs.promote(D,"Stage")})();this.createjs=this.createjs||{};(function(){function r(t){this.DisplayObject_constructor();if(typeof t=="string"){this.image=document.createElement("img");this.image.src=t}else{this.image=t}this.sourceRect=null;this._webGLRenderStyle=createjs.DisplayObject._StageGL_BITMAP}var t=createjs.extend(r,createjs.DisplayObject);t.initialize=r;t.isVisible=function(){var t=this.image;var e=this.cacheCanvas||t&&(t.naturalWidth||t.getContext||t.readyState>=2);return!!(this.visible&&this.alpha>0&&this.scaleX!=0&&this.scaleY!=0&&e)};t.draw=function(t,e){if(this.DisplayObject_draw(t,e)){return true}var i=this.image,r=this.sourceRect;if(i.getImage){i=i.getImage()}if(!i){return true}if(r){var s=r.x,a=r.y,n=s+r.width,h=a+r.height,o=0,u=0,l=i.width,c=i.height;if(s<0){o-=s;s=0}if(n>l){n=l}if(a<0){u-=a;a=0}if(h>c){h=c}t.drawImage(i,s,a,n-s,h-a,o,u,n-s,h-a)}else{t.drawImage(i,0,0)}return true};t.getBounds=function(){var t=this.DisplayObject_getBounds();if(t){return t}var e=this.image,i=this.sourceRect||e;var r=e&&(e.naturalWidth||e.getContext||e.readyState>=2);return r?this._rectangle.setValues(0,0,i.width,i.height):null};t.clone=function(t){var e=this.image;if(e&&t){e=e.cloneNode()}var i=new r(e);if(this.sourceRect){i.sourceRect=this.sourceRect.clone()}this._cloneProps(i);return i};t.toString=function(){return"[Bitmap (name="+this.name+")]"};createjs.Bitmap=createjs.promote(r,"DisplayObject")})();this.createjs=this.createjs||{};(function(){"use strict";function t(t,e){this.DisplayObject_constructor();this.currentFrame=0;this.currentAnimation=null;this.paused=true;this.spriteSheet=t;this.currentAnimationFrame=0;this.framerate=0;this._animation=null;this._currentFrame=null;this._skipAdvance=false;this._webGLRenderStyle=createjs.DisplayObject._StageGL_SPRITE;if(e!=null){this.gotoAndPlay(e)}}var e=createjs.extend(t,createjs.DisplayObject);e.initialize=t;e.isVisible=function(){var t=this.cacheCanvas||this.spriteSheet.complete;return!!(this.visible&&this.alpha>0&&this.scaleX!=0&&this.scaleY!=0&&t)};e.draw=function(t,e){if(this.DisplayObject_draw(t,e)){return true}this._normalizeFrame();var i=this.spriteSheet.getFrame(this._currentFrame|0);if(!i){return false}var r=i.rect;if(r.width&&r.height){t.drawImage(i.image,r.x,r.y,r.width,r.height,-i.regX,-i.regY,r.width,r.height)}return true};e.play=function(){this.paused=false};e.stop=function(){this.paused=true};e.gotoAndPlay=function(t){this.paused=false;this._skipAdvance=true;this._goto(t)};e.gotoAndStop=function(t){this.paused=true;this._goto(t)};e.advance=function(t){var e=this.framerate||this.spriteSheet.framerate;var i=e&&t!=null?t/(1e3/e):1;this._normalizeFrame(i)};e.getBounds=function(){return this.DisplayObject_getBounds()||this.spriteSheet.getFrameBounds(this.currentFrame,this._rectangle)};e.clone=function(){return this._cloneProps(new t(this.spriteSheet))};e.toString=function(){return"[Sprite (name="+this.name+")]"};e._cloneProps=function(t){this.DisplayObject__cloneProps(t);t.currentFrame=this.currentFrame;t.currentAnimation=this.currentAnimation;t.paused=this.paused;t.currentAnimationFrame=this.currentAnimationFrame;t.framerate=this.framerate;t._animation=this._animation;t._currentFrame=this._currentFrame;t._skipAdvance=this._skipAdvance;return t};e._tick=function(t){if(!this.paused){if(!this._skipAdvance){this.advance(t&&t.delta)}this._skipAdvance=false}this.DisplayObject__tick(t)};e._normalizeFrame=function(t){t=t||0;var e=this._animation;var i=this.paused;var r=this._currentFrame;var s;if(e){var a=e.speed||1;var n=this.currentAnimationFrame;s=e.frames.length;if(n+t*a>=s){var h=e.next;if(this._dispatchAnimationEnd(e,r,i,h,s-1)){return}else if(h){return this._goto(h,t-(s-n)/a)}else{this.paused=true;n=e.frames.length-1}}else{n+=t*a}this.currentAnimationFrame=n;this._currentFrame=e.frames[n|0]}else{r=this._currentFrame+=t;s=this.spriteSheet.getNumFrames();if(r>=s&&s>0){if(!this._dispatchAnimationEnd(e,r,i,s-1)){if((this._currentFrame-=s)>=s){return this._normalizeFrame()}}}}r=this._currentFrame|0;if(this.currentFrame!=r){this.currentFrame=r;this.dispatchEvent("change")}};e._dispatchAnimationEnd=function(t,e,i,r,s){var a=t?t.name:null;if(this.hasEventListener("animationend")){var n=new createjs.Event("animationend");n.name=a;n.next=r;this.dispatchEvent(n)}var h=this._animation!=t||this._currentFrame!=e;if(!h&&!i&&this.paused){this.currentAnimationFrame=s;h=true}return h};e._goto=function(t,e){this.currentAnimationFrame=0;if(isNaN(t)){var i=this.spriteSheet.getAnimation(t);if(i){this._animation=i;this.currentAnimation=t;this._normalizeFrame(e)}}else{this.currentAnimation=this._animation=null;this._currentFrame=t;this._normalizeFrame()}};createjs.Sprite=createjs.promote(t,"DisplayObject")})();this.createjs=this.createjs||{};(function(){"use strict";function i(t){this.DisplayObject_constructor();this.graphics=t?t:new createjs.Graphics}var t=createjs.extend(i,createjs.DisplayObject);t.isVisible=function(){var t=this.cacheCanvas||this.graphics&&!this.graphics.isEmpty();return!!(this.visible&&this.alpha>0&&this.scaleX!=0&&this.scaleY!=0&&t)};t.draw=function(t,e){if(this.DisplayObject_draw(t,e)){return true}this.graphics.draw(t,this);return true};t.clone=function(t){var e=t&&this.graphics?this.graphics.clone():this.graphics;return this._cloneProps(new i(e))};t.toString=function(){return"[Shape (name="+this.name+")]"};createjs.Shape=createjs.promote(i,"DisplayObject")})();this.createjs=this.createjs||{};(function(){"use strict";function v(t,e,i){this.DisplayObject_constructor();this.text=t;this.font=e;this.color=i;this.textAlign="left";this.textBaseline="top";this.maxWidth=null;this.outline=0;this.lineHeight=0;this.lineWidth=null}var t=createjs.extend(v,createjs.DisplayObject);var e=createjs.createCanvas?createjs.createCanvas():document.createElement("canvas");if(e.getContext){v._workingContext=e.getContext("2d");e.width=e.height=1}v.H_OFFSETS={start:0,left:0,center:-.5,end:-1,right:-1};v.V_OFFSETS={top:0,hanging:-.01,middle:-.4,alphabetic:-.8,ideographic:-.85,bottom:-1};t.isVisible=function(){var t=this.cacheCanvas||this.text!=null&&this.text!=="";return!!(this.visible&&this.alpha>0&&this.scaleX!=0&&this.scaleY!=0&&t)};t.draw=function(t,e){if(this.DisplayObject_draw(t,e)){return true}var i=this.color||"#000";if(this.outline){t.strokeStyle=i;t.lineWidth=this.outline*1}else{t.fillStyle=i}this._drawText(this._prepContext(t));return true};t.getMeasuredWidth=function(){return this._getMeasuredWidth(this.text)};t.getMeasuredLineHeight=function(){return this._getMeasuredWidth("M")*1.2};t.getMeasuredHeight=function(){return this._drawText(null,{}).height};t.getBounds=function(){var t=this.DisplayObject_getBounds();if(t){return t}if(this.text==null||this.text===""){return null}var e=this._drawText(null,{});var i=this.maxWidth&&this.maxWidththis.lineWidth){var f=l.split(/(\s)/);l=f[0];c=t.measureText(l).width;for(var d=1,_=f.length;d<_;d+=2){var p=t.measureText(f[d]+f[d+1]).width;if(c+p>this.lineWidth){if(r){this._drawTextLine(t,l,n*s)}if(i){i.push(l)}if(c>a){a=c}l=f[d+1];c=t.measureText(l).width;n++}else{l+=f[d]+f[d+1];c+=p}}}if(r){this._drawTextLine(t,l,n*s)}if(i){i.push(l)}if(e&&c==null){c=t.measureText(l).width}if(c>a){a=c}n++}if(e){e.width=a;e.height=n*s}if(!r){t.restore()}return e};t._drawTextLine=function(t,e,i){if(this.outline){t.strokeText(e,0,i,this.maxWidth||65535)}else{t.fillText(e,0,i,this.maxWidth||65535)}};t._getMeasuredWidth=function(t){var e=v._workingContext;e.save();var i=this._prepContext(e).measureText(t).width;e.restore();return i};createjs.Text=createjs.promote(v,"DisplayObject")})();this.createjs=this.createjs||{};(function(){"use strict";function m(t,e){this.Container_constructor();this.text=t||"";this.spriteSheet=e;this.lineHeight=0;this.letterSpacing=0;this.spaceWidth=0;this._oldProps={text:0,spriteSheet:0,lineHeight:0,letterSpacing:0,spaceWidth:0};this._oldStage=null;this._drawAction=null}var t=createjs.extend(m,createjs.Container);m.maxPoolSize=100;m._spritePool=[];t.draw=function(t,e){if(this.DisplayObject_draw(t,e)){return}this._updateState();this.Container_draw(t,e)};t.getBounds=function(){this._updateText();return this.Container_getBounds()};t.isVisible=function(){var t=this.cacheCanvas||this.spriteSheet&&this.spriteSheet.complete&&this.text;return!!(this.visible&&this.alpha>0&&this.scaleX!==0&&this.scaleY!==0&&t)};t.clone=function(){return this._cloneProps(new m(this.text,this.spriteSheet))};t.addChild=t.addChildAt=t.removeChild=t.removeChildAt=t.removeAllChildren=function(){};t._updateState=function(){this._updateText()};t._cloneProps=function(t){this.Container__cloneProps(t);t.lineHeight=this.lineHeight;t.letterSpacing=this.letterSpacing;t.spaceWidth=this.spaceWidth;return t};t._getFrameIndex=function(t,e){var i,r=e.getAnimation(t);if(!r){t!=(i=t.toUpperCase())||t!=(i=t.toLowerCase())||(i=null);if(i){r=e.getAnimation(i)}}return r&&r.frames[0]};t._getFrame=function(t,e){var i=this._getFrameIndex(t,e);return i==null?i:e.getFrame(i)};t._getLineHeight=function(t){var e=this._getFrame("1",t)||this._getFrame("T",t)||this._getFrame("L",t)||t.getFrame(0);return e?e.rect.height:1};t._getSpaceWidth=function(t){var e=this._getFrame("1",t)||this._getFrame("l",t)||this._getFrame("e",t)||this._getFrame("a",t)||t.getFrame(0);return e?e.rect.width:1};t._updateText=function(){var t=0,e=0,i=this._oldProps,r=false,s=this.spaceWidth,a=this.lineHeight,n=this.spriteSheet;var h=m._spritePool,o=this.children,u=0,l=o.length,c;for(var f in i){if(i[f]!=this[f]){i[f]=this[f];r=true}}if(!r){return}var d=!!this._getFrame(" ",n);if(!d&&!s){s=this._getSpaceWidth(n)}if(!a){a=this._getLineHeight(n)}for(var _=0,p=this.text.length;_u){h.push(c=o.pop());c.parent=null;l--}if(h.length>m.maxPoolSize){h.length=m.maxPoolSize}};createjs.BitmapText=createjs.promote(m,"Container")})();this.createjs=this.createjs||{};(function(){"use strict";function n(t){this.Container_constructor();!n.inited&&n.init();var e,i,r,s;if(t instanceof String||arguments.length>1){e=t;i=arguments[1];r=arguments[2];s=arguments[3];if(r==null){r=-1}t=null}else if(t){e=t.mode;i=t.startPosition;r=t.loop;s=t.labels}if(!t){t={labels:s}}this.mode=e||n.INDEPENDENT;this.startPosition=i||0;this.loop=r===true?-1:r||0;this.currentFrame=0;this.paused=t.paused||false;this.actionsEnabled=true;this.autoReset=true;this.frameBounds=this.frameBounds||t.frameBounds;this.framerate=null;t.useTicks=t.paused=true;this.timeline=new createjs.Timeline(t);this._synchOffset=0;this._rawPosition=-1;this._bound_resolveState=this._resolveState.bind(this);this._t=0;this._managed={}}var t=createjs.extend(n,createjs.Container);n.INDEPENDENT="independent";n.SINGLE_FRAME="single";n.SYNCHED="synched";n.inited=false;n.init=function(){if(n.inited){return}r.install();n.inited=true};t._getLabels=function(){return this.timeline.getLabels()};t.getLabels=createjs.deprecate(t._getLabels,"MovieClip.getLabels");t._getCurrentLabel=function(){return this.timeline.currentLabel};t.getCurrentLabel=createjs.deprecate(t._getCurrentLabel,"MovieClip.getCurrentLabel");t._getDuration=function(){return this.timeline.duration};t.getDuration=createjs.deprecate(t._getDuration,"MovieClip.getDuration");try{Object.defineProperties(t,{labels:{get:t._getLabels},currentLabel:{get:t._getCurrentLabel},totalFrames:{get:t._getDuration},duration:{get:t._getDuration}})}catch(t){}t.initialize=n;t.isVisible=function(){return!!(this.visible&&this.alpha>0&&this.scaleX!=0&&this.scaleY!=0)};t.draw=function(t,e){if(this.DisplayObject_draw(t,e)){return true}this._updateState();this.Container_draw(t,e);return true};t.play=function(){this.paused=false};t.stop=function(){this.paused=true};t.gotoAndPlay=function(t){this.paused=false;this._goto(t)};t.gotoAndStop=function(t){this.paused=true;this._goto(t)};t.advance=function(t){var e=n.INDEPENDENT;if(this.mode!==e){return}var i=this,r=i.framerate;while((i=i.parent)&&r===null){if(i.mode===e){r=i._framerate}}this._framerate=r;if(this.paused){return}var s=r!==null&&r!==-1&&t!==null?t/(1e3/r)+this._t:1;var a=s|0;this._t=s-a;while(a--){this._updateTimeline(this._rawPosition+1,false)}};t.clone=function(){throw"MovieClip cannot be cloned."};t.toString=function(){return"[MovieClip (name="+this.name+")]"};t._updateState=function(){if(this._rawPosition===-1||this.mode!==n.INDEPENDENT){this._updateTimeline(-1)}};t._tick=function(t){this.advance(t&&t.delta);this.Container__tick(t)};t._goto=function(t){var e=this.timeline.resolve(t);if(e==null){return}this._t=0;this._updateTimeline(e,true)};t._reset=function(){this._rawPosition=-1;this._t=this.currentFrame=0;this.paused=false};t._updateTimeline=function(t,e){var i=this.mode!==n.INDEPENDENT,r=this.timeline;if(i){t=this.startPosition+(this.mode===n.SINGLE_FRAME?0:this._synchOffset)}if(t<0){t=0}if(this._rawPosition===t&&!i){return}this._rawPosition=t;r.loop=this.loop;r.setPosition(t,i||!this.actionsEnabled,e,this._bound_resolveState)};t._renderFirstFrame=function(){var t=this.timeline,e=t.rawPosition;t.setPosition(0,true,true,this._bound_resolveState);t.rawPosition=e};t._resolveState=function(){var t=this.timeline;this.currentFrame=t.position;for(var e in this._managed){this._managed[e]=1}var i=t.tweens;for(var r=0,s=i.length;r=0;r--){var u=o[r].id;if(this._managed[u]===1){this.removeChildAt(r);delete this._managed[u]}}};t._setState=function(t,e){if(!t){return}for(var i=t.length-1;i>=0;i--){var r=t[i];var s=r.t;var a=r.p;for(var n in a){s[n]=a[n]}this._addManagedChild(s,e)}};t._addManagedChild=function(t,e){if(t._off){return}this.addChildAt(t,0);if(t instanceof n){t._synchOffset=e;if(t.mode===n.INDEPENDENT&&t.autoReset&&!this._managed[t.id]){t._reset()}}this._managed[t.id]=2};t._getBounds=function(t,e){var i=this.DisplayObject_getBounds();if(!i){if(this.frameBounds){i=this._rectangle.copy(this.frameBounds[this.currentFrame])}}if(i){return this._transformBounds(i,t,e)}return this.Container__getBounds(t,e)};createjs.MovieClip=createjs.promote(n,"Container");function r(){throw"MovieClipPlugin cannot be instantiated."}r.priority=100;r.ID="MovieClip";r.install=function(){createjs.Tween._installPlugin(r)};r.init=function(t,e,i){if(e==="startPosition"&&t.target instanceof n){t._addPlugin(r)}};r.step=function(t,e,i){};r.change=function(t,e,i,r,s,a){if(i==="startPosition"){return s===1?e.props[i]:e.prev.props[i]}}})();this.createjs=this.createjs||{};(function(){"use strict";function T(){throw"SpriteSheetUtils cannot be instantiated"}var t=createjs.createCanvas?createjs.createCanvas():document.createElement("canvas");if(t.getContext){T._workingCanvas=t;T._workingContext=t.getContext("2d");t.width=t.height=1}T.extractFrame=function(t,e){if(isNaN(e)){e=t.getAnimation(e).frames[0]}var i=t.getFrame(e);if(!i){return null}var r=i.rect;var s=T._workingCanvas;s.width=r.width;s.height=r.height;T._workingContext.drawImage(i.image,r.x,r.y,r.width,r.height,0,0,r.width,r.height);var a=document.createElement("img");a.src=s.toDataURL("image/png");return a};T.addFlippedFrames=createjs.deprecate(null,"SpriteSheetUtils.addFlippedFrames");T.mergeAlpha=createjs.deprecate(null,"SpriteSheetUtils.mergeAlpha");T._flip=function(t,e,i,r){var s=t._images;var a=T._workingCanvas;var n=T._workingContext;var h=s.length/e;for(var o=0;othis.maxHeight){throw w.ERR_DIMENSIONS}var r=0,s=0;var a=0;while(i.length){var n=this._fillRow(i,r,a,e,t);if(n.w>s){s=n.w}r+=n.h;if(!n.h||!i.length){var h=createjs.createCanvas?createjs.createCanvas():document.createElement("canvas");h.width=this._getSize(s,this.maxWidth);h.height=this._getSize(r,this.maxHeight);this._data.images[a]=h;if(!n.h){s=r=0;a++}}}};t._setupMovieClipFrame=function(t,e){var i=t.actionsEnabled;t.actionsEnabled=false;t.gotoAndStop(e.i);t.actionsEnabled=i;e.f&&e.f(t,e.d,e.i)};t._getSize=function(t,e){var i=4;while(Math.pow(2,++i)=0;l--){var c=t[l];var f=this._scale*c.scale;var d=c.sourceRect;var _=c.source;var p=Math.floor(f*d.x-s);var v=Math.floor(f*d.y-s);var g=Math.ceil(f*d.height+s*2);var m=Math.ceil(f*d.width+s*2);if(m>a){throw w.ERR_DIMENSIONS}if(g>h||o+m>a){continue}c.img=i;c.rect=new createjs.Rectangle(o,e,m,g);u=u||g;t.splice(l,1);r[c.index]=[o,e,m,g,i,Math.round(-p+f*_.regX-s),Math.round(-v+f*_.regY-s)];o+=m}return{w:o,h:u}};t._endBuild=function(){this.spriteSheet=new createjs.SpriteSheet(this._data);this._data=null;this.progress=1;this.dispatchEvent("complete")};t._run=function(){var t=Math.max(.01,Math.min(.99,this.timeSlice||.3))*50;var e=(new Date).getTime()+t;var i=false;while(e>(new Date).getTime()){if(!this._drawNext()){i=true;break}}if(i){this._endBuild()}else{var r=this;this._timerID=setTimeout(function(){r._run()},50-t)}var s=this.progress=this._index/this._frames.length;if(this.hasEventListener("progress")){var a=new createjs.Event("progress");a.progress=s;this.dispatchEvent(a)}};t._drawNext=function(){var t=this._frames[this._index];var e=t.scale*this._scale;var i=t.rect;var r=t.sourceRect;var s=this._data.images[t.img];var a=s.getContext("2d");t.funct&&t.funct(t.source,t.data);a.save();a.beginPath();a.rect(i.x,i.y,i.width,i.height);a.clip();a.translate(Math.ceil(i.x-r.x*e),Math.ceil(i.y-r.y*e));a.scale(e,e);t.source.draw(a);a.restore();return++this._index=1?r:1;this.height=s>=1?s:1;this.x=e||0;this.y=i||0;this.scale=a||1;this.update()};t.update=function(t){if(!this.target){throw"define() must be called before update()"}var e=r.getFilterBounds(this.target);var i=this.target.cacheCanvas;this._drawWidth=Math.ceil(this.width*this.scale)+e.width;this._drawHeight=Math.ceil(this.height*this.scale)+e.height;if(!i||this._drawWidth!=i.width||this._drawHeight!=i.height){this._updateSurface()}this._filterOffX=e.x;this._filterOffY=e.y;this.offX=this.x*this.scale+this._filterOffX;this.offY=this.y*this.scale+this._filterOffY;this._drawToCache(t);this.cacheID=this.cacheID?this.cacheID+1:1};t.release=function(){if(this._webGLCache){if(!this._webGLCache.isCacheControlled){if(this.__lastRT){this.__lastRT=undefined}if(this.__rtA){this._webGLCache._killTextureObject(this.__rtA)}if(this.__rtB){this._webGLCache._killTextureObject(this.__rtB)}if(this.target&&this.target.cacheCanvas){this._webGLCache._killTextureObject(this.target.cacheCanvas)}}this._webGLCache=false}else{var t=this.target.stage;if(t instanceof createjs.StageGL){t.releaseTexture(this.target.cacheCanvas)}}this.target=this.target.cacheCanvas=null;this.cacheID=this._cacheDataURLID=this._cacheDataURL=undefined;this.width=this.height=this.x=this.y=this.offX=this.offY=0;this.scale=1};t.getCacheDataURL=function(){var t=this.target&&this.target.cacheCanvas;if(!t){return null}if(this.cacheID!=this._cacheDataURLID){this._cacheDataURLID=this.cacheID;this._cacheDataURL=t.toDataURL?t.toDataURL():null}return this._cacheDataURL};t.draw=function(t){if(!this.target){return false}t.drawImage(this.target.cacheCanvas,this.x+this._filterOffX/this.scale,this.y+this._filterOffY/this.scale,this._drawWidth/this.scale,this._drawHeight/this.scale);return true};t._updateSurface=function(){if(!this._options||!this._options.useGL){var t=this.target.cacheCanvas;if(!t){t=this.target.cacheCanvas=createjs.createCanvas?createjs.createCanvas():document.createElement("canvas")}t.width=this._drawWidth;t.height=this._drawHeight;return}if(!this._webGLCache){if(this._options.useGL==="stage"){if(!(this.target.stage&&this.target.stage.isWebGL)){var e="Cannot use 'stage' for cache because the object's parent stage is ";e+=this.target.stage?"non WebGL.":"not set, please addChild to the correct stage.";throw e}this.target.cacheCanvas=true;this._webGLCache=this.target.stage}else if(this._options.useGL==="new"){this.target.cacheCanvas=document.createElement("canvas");this._webGLCache=new createjs.StageGL(this.target.cacheCanvas,{antialias:true,transparent:true,autoPurge:-1});this._webGLCache.isCacheControlled=true}else if(this._options.useGL instanceof createjs.StageGL){this.target.cacheCanvas=true;this._webGLCache=this._options.useGL;this._webGLCache.isCacheControlled=true}else{throw"Invalid option provided to useGL, expected ['stage', 'new', StageGL, undefined], got "+this._options.useGL}}var t=this.target.cacheCanvas;var i=this._webGLCache;if(i.isCacheControlled){t.width=this._drawWidth;t.height=this._drawHeight;i.updateViewport(this._drawWidth,this._drawHeight)}if(this.target.filters){i.getTargetRenderTexture(this.target,this._drawWidth,this._drawHeight);i.getTargetRenderTexture(this.target,this._drawWidth,this._drawHeight)}else{if(!i.isCacheControlled){i.getTargetRenderTexture(this.target,this._drawWidth,this._drawHeight)}}};t._drawToCache=function(t){var e=this.target.cacheCanvas;var i=this.target;var r=this._webGLCache;if(r){r.cacheDraw(i,i.filters,this);e=this.target.cacheCanvas;e.width=this._drawWidth;e.height=this._drawHeight}else{var s=e.getContext("2d");if(!t){s.clearRect(0,0,this._drawWidth+1,this._drawHeight+1)}s.save();s.globalCompositeOperation=t;s.setTransform(this.scale,0,0,this.scale,-this._filterOffX,-this._filterOffY);s.translate(-this.x,-this.y);i.draw(s,true);s.restore();if(i.filters&&i.filters.length){this._applyFilters(s)}}e._invalid=true};t._applyFilters=function(t){var e=this.target.filters;var i=this._drawWidth;var r=this._drawHeight;var s;var a=0,n=e[a];do{if(n.usesContext){if(s){t.putImageData(s,0,0);s=null}n.applyFilter(t,0,0,i,r)}else{if(!s){s=t.getImageData(0,0,i,r)}n._applyFilter(s)}n=n._multiPass!==null?n._multiPass:e[++a]}while(n);if(s){t.putImageData(s,0,0)}};createjs.BitmapCache=r})();this.createjs=this.createjs||{};(function(){"use strict";function G(t,e,i){this.Filter_constructor();this._blurX=t;this._blurXTable=[];this._lastBlurX=null;this._blurY=e;this._blurYTable=[];this._lastBlurY=null;this._quality;this._lastQuality=null;this.FRAG_SHADER_TEMPLATE="uniform float xWeight[{{blurX}}];"+"uniform float yWeight[{{blurY}}];"+"uniform vec2 textureOffset;"+"void main(void) {"+"vec4 color = vec4(0.0);"+"float xAdj = ({{blurX}}.0-1.0)/2.0;"+"float yAdj = ({{blurY}}.0-1.0)/2.0;"+"vec2 sampleOffset;"+"for(int i=0; i<{{blurX}}; i++) {"+"for(int j=0; j<{{blurY}}; j++) {"+"sampleOffset = vRenderCoord + (textureOffset * vec2(float(i)-xAdj, float(j)-yAdj));"+"color += texture2D(uSampler, sampleOffset) * (xWeight[i] * yWeight[j]);"+"}"+"}"+"gl_FragColor = color.rgba;"+"}";if(isNaN(i)||i<1){i=1}this.setQuality(i|0)}var t=createjs.extend(G,createjs.Filter);t.getBlurX=function(){return this._blurX};t.getBlurY=function(){return this._blurY};t.setBlurX=function(t){if(isNaN(t)||t<0){t=0}this._blurX=t};t.setBlurY=function(t){if(isNaN(t)||t<0){t=0}this._blurY=t};t.getQuality=function(){return this._quality};t.setQuality=function(t){if(isNaN(t)||t<0){t=0}this._quality=t|0};t._getShader=function(){var t=this._lastBlurX!==this._blurX;var e=this._lastBlurY!==this._blurY;var i=this._lastQuality!==this._quality;if(t||e||i){if(t||i){this._blurXTable=this._getTable(this._blurX*this._quality)}if(e||i){this._blurYTable=this._getTable(this._blurY*this._quality)}this._updateShader();this._lastBlurX=this._blurX;this._lastBlurY=this._blurY;this._lastQuality=this._quality;return undefined}return this._compiledShader};t._setShader=function(){this._compiledShader};try{Object.defineProperties(t,{blurX:{get:t.getBlurX,set:t.setBlurX},blurY:{get:t.getBlurY,set:t.setBlurY},quality:{get:t.getQuality,set:t.setQuality},_builtShader:{get:t._getShader,set:t._setShader}})}catch(t){console.log(t)}t._getTable=function(t){var e=4.2;if(t<=1){return[1]}var i=[];var r=Math.ceil(t*2);r+=r%2?0:1;var s=r/2|0;for(var a=-s;a<=s;a++){var n=a/s*e;i.push(1/Math.sqrt(2*Math.PI)*Math.pow(Math.E,-(Math.pow(n,2)/4)))}var h=i.reduce(function(t,e){return t+e});return i.map(function(t,e,i){return t/h})};t._updateShader=function(){if(this._blurX===undefined||this._blurY===undefined){return}var t=this.FRAG_SHADER_TEMPLATE;t=t.replace(/\{\{blurX\}\}/g,this._blurXTable.length.toFixed(0));t=t.replace(/\{\{blurY\}\}/g,this._blurYTable.length.toFixed(0));this.FRAG_SHADER_BODY=t};t.shaderParamSetup=function(t,e,i){t.uniform1fv(t.getUniformLocation(i,"xWeight"),this._blurXTable);t.uniform1fv(t.getUniformLocation(i,"yWeight"),this._blurYTable);t.uniform2f(t.getUniformLocation(i,"textureOffset"),2/(e._viewportWidth*this._quality),2/(e._viewportHeight*this._quality))};G.MUL_TABLE=[1,171,205,293,57,373,79,137,241,27,391,357,41,19,283,265,497,469,443,421,25,191,365,349,335,161,155,149,9,278,269,261,505,245,475,231,449,437,213,415,405,395,193,377,369,361,353,345,169,331,325,319,313,307,301,37,145,285,281,69,271,267,263,259,509,501,493,243,479,118,465,459,113,446,55,435,429,423,209,413,51,403,199,393,97,3,379,375,371,367,363,359,355,351,347,43,85,337,333,165,327,323,5,317,157,311,77,305,303,75,297,294,73,289,287,71,141,279,277,275,68,135,67,133,33,262,260,129,511,507,503,499,495,491,61,121,481,477,237,235,467,232,115,457,227,451,7,445,221,439,218,433,215,427,425,211,419,417,207,411,409,203,202,401,399,396,197,49,389,387,385,383,95,189,47,187,93,185,23,183,91,181,45,179,89,177,11,175,87,173,345,343,341,339,337,21,167,83,331,329,327,163,81,323,321,319,159,79,315,313,39,155,309,307,153,305,303,151,75,299,149,37,295,147,73,291,145,289,287,143,285,71,141,281,35,279,139,69,275,137,273,17,271,135,269,267,133,265,33,263,131,261,130,259,129,257,1];G.SHG_TABLE=[0,9,10,11,9,12,10,11,12,9,13,13,10,9,13,13,14,14,14,14,10,13,14,14,14,13,13,13,9,14,14,14,15,14,15,14,15,15,14,15,15,15,14,15,15,15,15,15,14,15,15,15,15,15,15,12,14,15,15,13,15,15,15,15,16,16,16,15,16,14,16,16,14,16,13,16,16,16,15,16,13,16,15,16,14,9,16,16,16,16,16,16,16,16,16,13,14,16,16,15,16,16,10,16,15,16,14,16,16,14,16,16,14,16,16,14,15,16,16,16,14,15,14,15,13,16,16,15,17,17,17,17,17,17,14,15,17,17,16,16,17,16,15,17,16,17,11,17,16,17,16,17,16,17,17,16,17,17,16,17,17,16,16,17,17,17,16,14,17,17,17,17,15,16,14,16,15,16,13,16,15,16,14,16,15,16,12,16,15,16,17,17,17,17,17,13,16,15,17,17,17,16,15,17,17,17,16,15,17,17,14,16,17,17,16,17,17,16,15,17,16,14,17,16,15,17,16,17,17,16,17,15,16,17,14,17,16,15,17,16,17,13,17,16,17,17,16,17,14,17,16,17,16,17,16,17,9];t.getBounds=function(t){var e=this.blurX|0,i=this.blurY|0;if(e<=0&&i<=0){return t}var r=Math.pow(this.quality,.2);return(t||new createjs.Rectangle).pad(i*r+1,e*r+1,i*r+1,e*r+1)};t.clone=function(){return new G(this.blurX,this.blurY,this.quality)};t.toString=function(){return"[BlurFilter]"};t._applyFilter=function(t){var e=this._blurX>>1;if(isNaN(e)||e<0)return false;var i=this._blurY>>1;if(isNaN(i)||i<0)return false;if(e==0&&i==0)return false;var r=this.quality;if(isNaN(r)||r<1)r=1;r|=0;if(r>3)r=3;if(r<1)r=1;var s=t.data;var a=0,n=0,h=0,o=0,u=0,l=0,c=0,f=0,d=0,_=0,p=0,v=0,g=0,m=0,x=0;var b=e+e+1|0;var w=i+i+1|0;var E=t.width|0;var T=t.height|0;var R=E-1|0;var y=T-1|0;var C=e+1|0;var S=i+1|0;var D={r:0,b:0,g:0,a:0};var A=D;for(h=1;h0){c=l=0;var j=L;var F=O;for(n=T;--n>-1;){f=C*(v=s[l|0]);d=C*(g=s[l+1|0]);_=C*(m=s[l+2|0]);p=C*(x=s[l+3|0]);A=D;for(h=C;--h>-1;){A.r=v;A.g=g;A.b=m;A.a=x;A=A.n}for(h=1;h>>F;s[l++]=d*j>>>F;s[l++]=_*j>>>F;s[l++]=p*j>>>F;o=c+((o=a+e+1)0){for(n=0;n>>F;if(x>0){s[o]=f*j>>>F;s[o+1]=d*j>>>F;s[o+2]=_*j>>>F}else{s[o]=s[o+1]=s[o+2]=0}o=a+((o=n+S)>>F;if(x>0){x=255/x;s[o]=(f*j>>>F)*x;s[o+1]=(d*j>>>F)*x;s[o+2]=(_*j>>>F)*x}else{s[o]=s[o+1]=s[o+2]=0}o=a+((o=n+S)0?3*t/100:t/100);var i=.3086;var r=.6094;var s=.082;this._multiplyMatrix([i*(1-e)+e,r*(1-e),s*(1-e),0,0,i*(1-e),r*(1-e)+e,s*(1-e),0,0,i*(1-e),r*(1-e),s*(1-e)+e,0,0,0,0,0,1,0,0,0,0,0,1]);return this};t.adjustHue=function(t){if(t==0||isNaN(t)){return this}t=this._cleanValue(t,180)/180*Math.PI;var e=Math.cos(t);var i=Math.sin(t);var r=.213;var s=.715;var a=.072;this._multiplyMatrix([r+e*(1-r)+i*-r,s+e*-s+i*-s,a+e*-a+i*(1-a),0,0,r+e*-r+i*.143,s+e*(1-s)+i*.14,a+e*-a+i*-.283,0,0,r+e*-r+i*-(1-r),s+e*-s+i*s,a+e*(1-a)+i*a,0,0,0,0,0,1,0,0,0,0,0,1]);return this};t.concat=function(t){t=this._fixMatrix(t);if(t.length!=r.LENGTH){return this}this._multiplyMatrix(t);return this};t.clone=function(){return(new r).copy(this)};t.toArray=function(){var t=[];for(var e=0,i=r.LENGTH;er.LENGTH){t=t.slice(0,r.LENGTH)}return t};createjs.ColorMatrix=r})();this.createjs=this.createjs||{};(function(){"use strict";function t(t){this.Filter_constructor();this.matrix=t;this.FRAG_SHADER_BODY="uniform mat4 uColorMatrix;"+"uniform vec4 uColorMatrixOffset;"+"void main(void) {"+"vec4 color = texture2D(uSampler, vRenderCoord);"+"mat4 m = uColorMatrix;"+"vec4 newColor = vec4(0,0,0,0);"+"newColor.r = color.r*m[0][0] + color.g*m[0][1] + color.b*m[0][2] + color.a*m[0][3];"+"newColor.g = color.r*m[1][0] + color.g*m[1][1] + color.b*m[1][2] + color.a*m[1][3];"+"newColor.b = color.r*m[2][0] + color.g*m[2][1] + color.b*m[2][2] + color.a*m[2][3];"+"newColor.a = color.r*m[3][0] + color.g*m[3][1] + color.b*m[3][2] + color.a*m[3][3];"+"gl_FragColor = newColor + uColorMatrixOffset;"+"}"}var e=createjs.extend(t,createjs.Filter);e.shaderParamSetup=function(t,e,i){var r=this.matrix;var s=new Float32Array([r[0],r[1],r[2],r[3],r[5],r[6],r[7],r[8],r[10],r[11],r[12],r[13],r[15],r[16],r[17],r[18]]);t.uniformMatrix4fv(t.getUniformLocation(i,"uColorMatrix"),false,s);t.uniform4f(t.getUniformLocation(i,"uColorMatrixOffset"),r[4]/255,r[9]/255,r[14]/255,r[19]/255)};e.toString=function(){return"[ColorMatrixFilter]"};e.clone=function(){return new t(this.matrix)};e._applyFilter=function(t){var e=t.data;var i=e.length;var r,s,a,n;var h=this.matrix;var o=h[0],u=h[1],l=h[2],c=h[3],f=h[4];var d=h[5],_=h[6],p=h[7],v=h[8],g=h[9];var m=h[10],x=h[11],b=h[12],w=h[13],E=h[14];var T=h[15],R=h[16],y=h[17],C=h[18],S=h[19];for(var D=0;D0||window.navigator["pointerEnabled"]&&window.navigator["maxTouchPoints"]>0)};r.enable=function(t,e,i){if(!t||!t.canvas||!r.isSupported()){return false}if(t.__touch){return true}t.__touch={pointers:{},multitouch:!e,preventDefault:!i,count:0};if("ontouchstart"in window){r._IOS_enable(t)}else if(window.navigator["msPointerEnabled"]||window.navigator["pointerEnabled"]){r._IE_enable(t)}return true};r.disable=function(t){if(!t){return}if("ontouchstart"in window){r._IOS_disable(t)}else if(window.navigator["msPointerEnabled"]||window.navigator["pointerEnabled"]){r._IE_disable(t)}delete t.__touch};r._IOS_enable=function(e){var t=e.canvas;var i=e.__touch.f=function(t){r._IOS_handleEvent(e,t)};t.addEventListener("touchstart",i,false);t.addEventListener("touchmove",i,false);t.addEventListener("touchend",i,false);t.addEventListener("touchcancel",i,false)};r._IOS_disable=function(t){var e=t.canvas;if(!e){return}var i=t.__touch.f;e.removeEventListener("touchstart",i,false);e.removeEventListener("touchmove",i,false);e.removeEventListener("touchend",i,false);e.removeEventListener("touchcancel",i,false)};r._IOS_handleEvent=function(t,e){if(!t){return}if(t.__touch.preventDefault){e.preventDefault&&e.preventDefault()}var i=e.changedTouches;var r=e.type;for(var s=0,a=i.length;s