diff --git a/bin/pixi.js b/bin/pixi.js index 0416880..98629ca 100644 --- a/bin/pixi.js +++ b/bin/pixi.js @@ -21994,7 +21994,7 @@ return next(); } - var textureUrl = this.baseUrl + resource.data.getElementsByTagName('page')[0].getAttribute('file'); + var textureUrl = resource.data.getElementsByTagName('page')[0].getAttribute('file'); var loadOptions = { crossOrigin: resource.crossOrigin, loadType: Resource.LOAD_TYPE.IMAGE @@ -22216,7 +22216,7 @@ var resolution = core.utils.getResolutionOfUrl( resource.url ); // load the image for this sheet - this.add(resource.name + '_image', this.baseUrl + route + '/' + resource.data.meta.image, loadOptions, function (res) + this.add(resource.name + '_image', route + '/' + resource.data.meta.image, loadOptions, function (res) { resource.textures = {}; @@ -25651,11 +25651,11 @@ * @member {object} * @private */ - this._style = { + this._font = { tint: style.tint, align: style.align, - fontName: null, - fontSize: 0 + name: null, + size: 0 }; /** @@ -25707,11 +25707,11 @@ tint: { get: function () { - return this._style.tint; + return this._font.tint; }, set: function (value) { - this._style.tint = (typeof value === 'number' && value >= 0) ? value : 0xFFFFFF; + this._font.tint = (typeof value === 'number' && value >= 0) ? value : 0xFFFFFF; this.dirty = true; } @@ -25727,11 +25727,11 @@ align: { get: function () { - return this._style.align; + return this._font.align; }, set: function (value) { - this._style.align = value; + this._font.align = value; this.dirty = true; } @@ -25746,19 +25746,19 @@ font: { get: function () { - return this._style.font; + return this._font; }, set: function (value) { if (typeof value === 'string') { value = value.split(' '); - this._style.fontName = value.slice(1).join(' '); - this._style.fontSize = value.length >= 2 ? parseInt(value[0], 10) : BitmapText.fonts[this.fontName].size; + this._font.name = value.length === 1 ? value[0] : value.slice(1).join(' '); + this._font.size = value.length >= 2 ? parseInt(value[0], 10) : BitmapText.fonts[this._font.name].size; } else { - this._style.fontName = value.name; - this._style.fontSize = typeof value.size === 'number' ? value.size : parseInt(value.size, 10); + this._font.name = value.name; + this._font.size = typeof value.size === 'number' ? value.size : parseInt(value.size, 10); } this.dirty = true; @@ -25792,7 +25792,7 @@ */ BitmapText.prototype.updateText = function () { - var data = BitmapText.fonts[this._style.fontName]; + var data = BitmapText.fonts[this._font.name]; var pos = new core.math.Point(); var prevCharCode = null; var chars = []; @@ -25800,7 +25800,7 @@ var maxLineWidth = 0; var lineWidths = []; var line = 0; - var scale = this._style.fontSize / data.size; + var scale = this._font.size / data.size; var lastSpace = -1; for (var i = 0; i < this.text.length; i++) @@ -25864,11 +25864,11 @@ { var alignOffset = 0; - if (this._style.align === 'right') + if (this._font.align === 'right') { alignOffset = maxLineWidth - lineWidths[i]; } - else if (this._style.align === 'center') + else if (this._font.align === 'center') { alignOffset = (maxLineWidth - lineWidths[i]) / 2; } diff --git a/bin/pixi.js b/bin/pixi.js index 0416880..98629ca 100644 --- a/bin/pixi.js +++ b/bin/pixi.js @@ -21994,7 +21994,7 @@ return next(); } - var textureUrl = this.baseUrl + resource.data.getElementsByTagName('page')[0].getAttribute('file'); + var textureUrl = resource.data.getElementsByTagName('page')[0].getAttribute('file'); var loadOptions = { crossOrigin: resource.crossOrigin, loadType: Resource.LOAD_TYPE.IMAGE @@ -22216,7 +22216,7 @@ var resolution = core.utils.getResolutionOfUrl( resource.url ); // load the image for this sheet - this.add(resource.name + '_image', this.baseUrl + route + '/' + resource.data.meta.image, loadOptions, function (res) + this.add(resource.name + '_image', route + '/' + resource.data.meta.image, loadOptions, function (res) { resource.textures = {}; @@ -25651,11 +25651,11 @@ * @member {object} * @private */ - this._style = { + this._font = { tint: style.tint, align: style.align, - fontName: null, - fontSize: 0 + name: null, + size: 0 }; /** @@ -25707,11 +25707,11 @@ tint: { get: function () { - return this._style.tint; + return this._font.tint; }, set: function (value) { - this._style.tint = (typeof value === 'number' && value >= 0) ? value : 0xFFFFFF; + this._font.tint = (typeof value === 'number' && value >= 0) ? value : 0xFFFFFF; this.dirty = true; } @@ -25727,11 +25727,11 @@ align: { get: function () { - return this._style.align; + return this._font.align; }, set: function (value) { - this._style.align = value; + this._font.align = value; this.dirty = true; } @@ -25746,19 +25746,19 @@ font: { get: function () { - return this._style.font; + return this._font; }, set: function (value) { if (typeof value === 'string') { value = value.split(' '); - this._style.fontName = value.slice(1).join(' '); - this._style.fontSize = value.length >= 2 ? parseInt(value[0], 10) : BitmapText.fonts[this.fontName].size; + this._font.name = value.length === 1 ? value[0] : value.slice(1).join(' '); + this._font.size = value.length >= 2 ? parseInt(value[0], 10) : BitmapText.fonts[this._font.name].size; } else { - this._style.fontName = value.name; - this._style.fontSize = typeof value.size === 'number' ? value.size : parseInt(value.size, 10); + this._font.name = value.name; + this._font.size = typeof value.size === 'number' ? value.size : parseInt(value.size, 10); } this.dirty = true; @@ -25792,7 +25792,7 @@ */ BitmapText.prototype.updateText = function () { - var data = BitmapText.fonts[this._style.fontName]; + var data = BitmapText.fonts[this._font.name]; var pos = new core.math.Point(); var prevCharCode = null; var chars = []; @@ -25800,7 +25800,7 @@ var maxLineWidth = 0; var lineWidths = []; var line = 0; - var scale = this._style.fontSize / data.size; + var scale = this._font.size / data.size; var lastSpace = -1; for (var i = 0; i < this.text.length; i++) @@ -25864,11 +25864,11 @@ { var alignOffset = 0; - if (this._style.align === 'right') + if (this._font.align === 'right') { alignOffset = maxLineWidth - lineWidths[i]; } - else if (this._style.align === 'center') + else if (this._font.align === 'center') { alignOffset = (maxLineWidth - lineWidths[i]) / 2; } diff --git a/bin/pixi.js.map b/bin/pixi.js.map index 45af07e..4a5fb04 100644 --- a/bin/pixi.js.map +++ b/bin/pixi.js.map @@ -246,16 +246,16 @@ "var core = require('../core'),\n InteractionData = require('./InteractionData');\n\n\n// TODO: Obviously rewrite this...\nvar INTERACTION_FREQUENCY = 10;\nvar AUTO_PREVENT_DEFAULT = true;\n\n/**\n * The interaction manager deals with mouse and touch events. Any DisplayObject can be interactive\n * if its interactive parameter is set to true\n * This manager also supports multitouch.\n *\n * @class\n * @memberof PIXI.interaction\n * @param renderer {CanvasRenderer|WebGLRenderer} A reference to the current renderer\n */\nfunction InteractionManager( renderer )\n{\n this.renderer = renderer;\n\n /**\n * The mouse data\n *\n * @member {InteractionData}\n */\n this.mouse = new InteractionData();\n\n /**\n * An event data object to handle all the event tracking/dispatching\n *\n * @member {EventData}\n */\n this.eventData = new core.utils.EventData();\n this.eventData.data = this.mouse;\n\n /**\n * Tiny little interactiveData pool !\n *\n * @member {Array}\n */\n this.interactiveDataPool = [];\n\n /**\n * The DOM element to bind to.\n *\n * @member {HTMLElement}\n * @private\n */\n this.interactionDOMElement = null;\n\n /**\n * Have events been attached to the dom element?\n *\n * @member {boolean}\n * @private\n */\n this.eventsAdded = false;\n\n //this will make it so that you don't have to call bind all the time\n\n /**\n * @member {Function}\n */\n this.onMouseUp = this.onMouseUp.bind(this);\n this.processMouseUp = this.processMouseUp.bind( this );\n\n\n /**\n * @member {Function}\n */\n this.onMouseDown = this.onMouseDown.bind(this);\n this.processMouseDown = this.processMouseDown.bind( this );\n\n /**\n * @member {Function}\n */\n this.onMouseMove = this.onMouseMove.bind( this );\n this.processMouseMove = this.processMouseMove.bind( this );\n\n /**\n * @member {Function}\n */\n this.onMouseOut = this.onMouseOut.bind(this);\n this.processMouseOverOut = this.processMouseOverOut.bind( this );\n\n\n /**\n * @member {Function}\n */\n this.onTouchStart = this.onTouchStart.bind(this);\n this.processTouchStart = this.processTouchStart.bind(this);\n\n /**\n * @member {Function}\n */\n this.onTouchEnd = this.onTouchEnd.bind(this);\n this.processTouchEnd = this.processTouchEnd.bind(this);\n\n /**\n * @member {Function}\n */\n this.onTouchMove = this.onTouchMove.bind(this);\n this.processTouchMove = this.processTouchMove.bind(this);\n\n /**\n * @member {number}\n */\n this.last = 0;\n\n /**\n * The css style of the cursor that is being used\n * @member {string}\n */\n this.currentCursorStyle = 'inherit';\n\n /**\n * Internal cached var\n * @member {Point}\n * @private\n */\n this._tempPoint = new core.math.Point();\n\n /**\n * The current resolution\n * @member {number}\n */\n this.resolution = 1;\n\n this.setTargetElement(this.renderer.view, this.renderer.resolution);\n\n this.update();\n}\n\nInteractionManager.prototype.constructor = InteractionManager;\nmodule.exports = InteractionManager;\n\n/**\n * Sets the DOM element which will receive mouse/touch events. This is useful for when you have\n * other DOM elements on top of the renderers Canvas element. With this you'll be bale to deletegate\n * another DOM element to receive those events.\n *\n * @param element {HTMLElement} the DOM element which will receive mouse and touch events.\n * @param [resolution=1] {number} THe resolution of the new element (relative to the canvas).\n * @private\n */\nInteractionManager.prototype.setTargetElement = function (element, resolution)\n{\n this.removeEvents();\n\n this.interactionDOMElement = element;\n\n this.resolution = resolution || 1;\n\n this.addEvents();\n};\n\n/**\n * Registers all the DOM events\n * @private\n */\nInteractionManager.prototype.addEvents = function ()\n{\n if (!this.interactionDOMElement)\n {\n return;\n }\n\n if (window.navigator.msPointerEnabled)\n {\n this.interactionDOMElement.style['-ms-content-zooming'] = 'none';\n this.interactionDOMElement.style['-ms-touch-action'] = 'none';\n }\n\n this.interactionDOMElement.addEventListener('mousemove', this.onMouseMove, true);\n this.interactionDOMElement.addEventListener('mousedown', this.onMouseDown, true);\n this.interactionDOMElement.addEventListener('mouseout', this.onMouseOut, true);\n\n this.interactionDOMElement.addEventListener('touchstart', this.onTouchStart, true);\n this.interactionDOMElement.addEventListener('touchend', this.onTouchEnd, true);\n this.interactionDOMElement.addEventListener('touchmove', this.onTouchMove, true);\n\n window.addEventListener('mouseup', this.onMouseUp, true);\n\n this.eventsAdded = true;\n};\n\n/**\n * Removes all the DOM events that were previously registered\n * @private\n */\nInteractionManager.prototype.removeEvents = function ()\n{\n if (!this.interactionDOMElement)\n {\n return;\n }\n\n if (window.navigator.msPointerEnabled)\n {\n this.interactionDOMElement.style['-ms-content-zooming'] = '';\n this.interactionDOMElement.style['-ms-touch-action'] = '';\n }\n\n this.interactionDOMElement.removeEventListener('mousemove', this.onMouseMove, true);\n this.interactionDOMElement.removeEventListener('mousedown', this.onMouseDown, true);\n this.interactionDOMElement.removeEventListener('mouseout', this.onMouseOut, true);\n\n this.interactionDOMElement.removeEventListener('touchstart', this.onTouchStart, true);\n this.interactionDOMElement.removeEventListener('touchend', this.onTouchEnd, true);\n this.interactionDOMElement.removeEventListener('touchmove', this.onTouchMove, true);\n\n this.interactionDOMElement = null;\n\n window.removeEventListener('mouseup', this.onMouseUp, true);\n\n this.eventsAdded = false;\n};\n\n/**\n * updates the state of interactive objects\n *\n * @private\n */\nInteractionManager.prototype.update = function ()\n{\n requestAnimationFrame(this.update.bind(this));\n\n if( this.throttleUpdate() || !this.interactionDOMElement)\n {\n return;\n }\n\n // if the user move the mouse this check has already been dfone using the mouse move!\n if(this.didMove)\n {\n this.didMove = false;\n return;\n }\n\n this.cursor = 'inherit';\n\n this.processInteractive(this.mouse.global, this.renderer._lastObjectRendered , this.processMouseOverOut.bind(this) , true );\n\n if (this.currentCursorStyle !== this.cursor)\n {\n this.currentCursorStyle = this.cursor;\n this.interactionDOMElement.style.cursor = this.cursor;\n }\n\n //TODO\n};\n\n/**\n * Dispatches an event on the display object that was interacted with\n * @param displayObject {Container|Sprite|TilingSprite} the display object in question\n * @param eventString {string} the name of the event (e.g, mousedown)\n * @param eventData {EventData} the event data object\n * @private\n */\nInteractionManager.prototype.dispatchEvent = function ( displayObject, eventString, eventData )\n{\n if(!eventData.stopped)\n {\n eventData.target = displayObject;\n eventData.type = eventString;\n\n displayObject.emit( eventString, eventData );\n\n if( displayObject[eventString] )\n {\n displayObject[eventString]( eventData );\n }\n }\n};\n\n/**\n * Ensures the interaction checks don't happen too often by delaying the update loop\n * @private\n */\nInteractionManager.prototype.throttleUpdate = function ()\n{\n // frequency of 30fps??\n var now = Date.now();\n var diff = now - this.last;\n diff = (diff * INTERACTION_FREQUENCY ) / 1000;\n if (diff < 1)\n {\n return true;\n }\n\n this.last = now;\n\n return false;\n};\n\n/**\n * Maps x and y coords from a DOM object and maps them correctly to the pixi view. The resulting value is stored in the point.\n * This takes into account the fact that the DOM element could be scaled and positioned anywhere on the screen.\n *\n * @param {Point} point the point that the result will be stored in\n * @param {number} x the x coord of the position to map\n * @param {number} y the y coord of the position to map\n */\nInteractionManager.prototype.mapPositionToPoint = function ( point, x, y )\n{\n var rect = this.interactionDOMElement.getBoundingClientRect();\n point.x = ( ( x - rect.left ) * (this.interactionDOMElement.width / rect.width ) ) / this.resolution;\n point.y = ( ( y - rect.top ) * (this.interactionDOMElement.height / rect.height ) ) / this.resolution;\n};\n\n/**\n * This function is provides a neat way of crawling through the scene graph and running a specified function on all interactive objects it finds.\n * It will also take care of hit testing the interactive objects and passes the hit across in the function.\n *\n * @param {Point} point the point that is tested for collision\n * @param {Container|Sprite|TilingSprite} displayObject the displayObject that will be hit test (recurcsivly crawls its children)\n * @param {function} func the function that will be called on each interactive object. The displayObject and hit will be passed to the function\n * @param {boolean} hitTest this indicates if the objects inside should be hit test against the point\n * @return {boolean} returns true if the displayObject hit the point\n */\nInteractionManager.prototype.processInteractive = function (point, displayObject, func, hitTest, interactive )\n{\n if(!displayObject.visible)\n {\n return false;\n }\n\n var children = displayObject.children;\n\n var hit = false;\n\n // if the object is interactive we must hit test all its children..\n interactive = interactive || displayObject.interactive;\n\n if(displayObject.interactiveChildren)\n {\n\n for (var i = children.length-1; i >= 0; i--)\n {\n if(! hit && hitTest)\n {\n hit = this.processInteractive(point, children[i], func, true, interactive );\n }\n else\n {\n // now we know we can miss it all!\n this.processInteractive(point, children[i], func, false, false );\n }\n }\n\n }\n\n if(interactive)\n {\n if(hitTest)\n {\n if(displayObject.hitArea)\n {\n // lets use the hit object first!\n displayObject.worldTransform.applyInverse(point, this._tempPoint);\n hit = displayObject.hitArea.contains( this._tempPoint.x, this._tempPoint.y );\n }\n else if(displayObject.containsPoint)\n {\n hit = displayObject.containsPoint(point);\n }\n }\n\n if(displayObject.interactive)\n {\n func(displayObject, hit);\n }\n }\n\n return hit;\n};\n\n\n\n\n/**\n * Is called when the mouse button is pressed down on the renderer element\n *\n * @param event {Event} The DOM event of a mouse button being pressed down\n * @private\n */\nInteractionManager.prototype.onMouseDown = function (event)\n{\n this.mouse.originalEvent = event;\n this.eventData.data = this.mouse;\n this.eventData.stopped = false;\n\n if (AUTO_PREVENT_DEFAULT)\n {\n this.mouse.originalEvent.preventDefault();\n }\n\n this.processInteractive(this.mouse.global, this.renderer._lastObjectRendered, this.processMouseDown, true );\n};\n\n/**\n * Processes the result of the mouse down check and dispatches the event if need be\n *\n * @param displayObject {Container|Sprite|TilingSprite} The display object that was tested\n * @param hit {boolean} the result of the hit test on the dispay object\n * @private\n */\nInteractionManager.prototype.processMouseDown = function ( displayObject, hit )\n{\n var e = this.mouse.originalEvent;\n\n var isRightButton = e.button === 2 || e.which === 3;\n\n if(hit)\n {\n displayObject[ isRightButton ? '_isRightDown' : '_isLeftDown' ] = true;\n this.dispatchEvent( displayObject, isRightButton ? 'rightdown' : 'mousedown', this.eventData );\n }\n};\n\n\n\n/**\n * Is called when the mouse button is released on the renderer element\n *\n * @param event {Event} The DOM event of a mouse button being released\n * @private\n */\nInteractionManager.prototype.onMouseUp = function (event)\n{\n this.mouse.originalEvent = event;\n this.eventData.data = this.mouse;\n this.eventData.stopped = false;\n\n this.processInteractive(this.mouse.global, this.renderer._lastObjectRendered, this.processMouseUp, true );\n};\n\n/**\n * Processes the result of the mouse up check and dispatches the event if need be\n *\n * @param displayObject {Container|Sprite|TilingSprite} The display object that was tested\n * @param hit {boolean} the result of the hit test on the display object\n * @private\n */\nInteractionManager.prototype.processMouseUp = function ( displayObject, hit )\n{\n var e = this.mouse.originalEvent;\n\n var isRightButton = e.button === 2 || e.which === 3;\n var isDown = isRightButton ? '_isRightDown' : '_isLeftDown';\n\n if(hit)\n {\n this.dispatchEvent( displayObject, isRightButton ? 'rightup' : 'mouseup', this.eventData );\n\n if( displayObject[ isDown ] )\n {\n displayObject[ isDown ] = false;\n this.dispatchEvent( displayObject, isRightButton ? 'rightclick' : 'click', this.eventData );\n }\n }\n else\n {\n if( displayObject[ isDown ] )\n {\n displayObject[ isDown ] = false;\n this.dispatchEvent( displayObject, isRightButton ? 'rightupoutside' : 'mouseupoutside', this.eventData );\n }\n }\n};\n\n\n/**\n * Is called when the mouse moves across the renderer element\n *\n * @param event {Event} The DOM event of the mouse moving\n * @private\n */\nInteractionManager.prototype.onMouseMove = function (event)\n{\n this.mouse.originalEvent = event;\n this.eventData.data = this.mouse;\n this.eventData.stopped = false;\n\n this.mapPositionToPoint( this.mouse.global, event.clientX, event.clientY);\n\n this.didMove = true;\n\n this.cursor = 'inherit';\n\n this.processInteractive(this.mouse.global, this.renderer._lastObjectRendered, this.processMouseMove, true );\n\n if (this.currentCursorStyle !== this.cursor)\n {\n this.currentCursorStyle = this.cursor;\n this.interactionDOMElement.style.cursor = this.cursor;\n }\n\n //TODO BUG for parents ineractive object (border order issue)\n};\n\n/**\n * Processes the result of the mouse move check and dispatches the event if need be\n *\n * @param displayObject {Container|Sprite|TilingSprite} The display object that was tested\n * @param hit {boolean} the result of the hit test on the display object\n * @private\n */\nInteractionManager.prototype.processMouseMove = function ( displayObject, hit )\n{\n this.dispatchEvent( displayObject, 'mousemove', this.eventData);\n this.processMouseOverOut(displayObject, hit);\n};\n\n\n/**\n * Is called when the mouse is moved out of the renderer element\n *\n * @param event {Event} The DOM event of a mouse being moved out\n * @private\n */\nInteractionManager.prototype.onMouseOut = function (event)\n{\n this.mouse.originalEvent = event;\n this.eventData.stopped = false;\n\n this.interactionDOMElement.style.cursor = 'inherit';\n\n // TODO optimize by not check EVERY TIME! maybe half as often? //\n this.mapPositionToPoint( this.mouse.global, event.clientX, event.clientY );\n\n this.processInteractive( this.mouse.global, this.renderer._lastObjectRendered, this.processMouseOverOut, false );\n};\n\n/**\n * Processes the result of the mouse over/out check and dispatches the event if need be\n *\n * @param displayObject {Container|Sprite|TilingSprite} The display object that was tested\n * @param hit {boolean} the result of the hit test on the display object\n * @private\n */\nInteractionManager.prototype.processMouseOverOut = function ( displayObject, hit )\n{\n if(hit)\n {\n if(!displayObject._over)\n {\n displayObject._over = true;\n this.dispatchEvent( displayObject, 'mouseover', this.eventData );\n }\n\n if (displayObject.buttonMode)\n {\n this.cursor = displayObject.defaultCursor;\n }\n }\n else\n {\n if(displayObject._over)\n {\n displayObject._over = false;\n this.dispatchEvent( displayObject, 'mouseout', this.eventData);\n }\n }\n};\n\n\n/**\n * Is called when a touch is started on the renderer element\n *\n * @param event {Event} The DOM event of a touch starting on the renderer view\n * @private\n */\nInteractionManager.prototype.onTouchStart = function (event)\n{\n if (AUTO_PREVENT_DEFAULT)\n {\n event.preventDefault();\n }\n\n var changedTouches = event.changedTouches;\n\n for (var i=0; i < changedTouches.length; i++)\n {\n var touchEvent = changedTouches[i];\n //TODO POOL\n var touchData = this.getTouchData( touchEvent );\n\n touchData.originalEvent = event;\n\n this.eventData.data = touchData;\n this.eventData.stopped = false;\n\n this.processInteractive( touchData.global, this.renderer._lastObjectRendered, this.processTouchStart, true );\n\n this.returnTouchData( touchData );\n }\n};\n\n/**\n * Processes the result of a touch check and dispatches the event if need be\n *\n * @param displayObject {Container|Sprite|TilingSprite} The display object that was tested\n * @param hit {boolean} the result of the hit test on the display object\n * @private\n */\nInteractionManager.prototype.processTouchStart = function ( displayObject, hit )\n{\n //console.log(\"hit\" + hit)\n if(hit)\n {\n displayObject._touchDown = true;\n this.dispatchEvent( displayObject, 'touchstart', this.eventData );\n }\n};\n\n\n/**\n * Is called when a touch ends on the renderer element\n * @param event {Event} The DOM event of a touch ending on the renderer view\n *\n */\nInteractionManager.prototype.onTouchEnd = function (event)\n{\n if (AUTO_PREVENT_DEFAULT)\n {\n event.preventDefault();\n }\n\n var changedTouches = event.changedTouches;\n\n for (var i=0; i < changedTouches.length; i++)\n {\n var touchEvent = changedTouches[i];\n\n var touchData = this.getTouchData( touchEvent );\n\n touchData.originalEvent = event;\n\n //TODO this should be passed along.. no set\n this.eventData.data = touchData;\n this.eventData.stopped = false;\n\n\n this.processInteractive( touchData.global, this.renderer._lastObjectRendered, this.processTouchEnd, true );\n\n this.returnTouchData( touchData );\n }\n};\n\n/**\n * Processes the result of the end of a touch and dispatches the event if need be\n *\n * @param displayObject {Container|Sprite|TilingSprite} The display object that was tested\n * @param hit {boolean} the result of the hit test on the display object\n * @private\n */\nInteractionManager.prototype.processTouchEnd = function ( displayObject, hit )\n{\n if(hit)\n {\n this.dispatchEvent( displayObject, 'touchend', this.eventData );\n\n if( displayObject._touchDown )\n {\n displayObject._touchDown = false;\n this.dispatchEvent( displayObject, 'tap', this.eventData );\n }\n }\n else\n {\n if( displayObject._touchDown )\n {\n displayObject._touchDown = false;\n this.dispatchEvent( displayObject, 'touchendoutside', this.eventData );\n }\n }\n};\n\n/**\n * Is called when a touch is moved across the renderer element\n *\n * @param event {Event} The DOM event of a touch moving across the renderer view\n * @private\n */\nInteractionManager.prototype.onTouchMove = function (event)\n{\n if (AUTO_PREVENT_DEFAULT)\n {\n event.preventDefault();\n }\n\n var changedTouches = event.changedTouches;\n\n for (var i=0; i < changedTouches.length; i++)\n {\n var touchEvent = changedTouches[i];\n\n var touchData = this.getTouchData( touchEvent );\n\n touchData.originalEvent = event;\n\n this.eventData.data = touchData;\n this.eventData.stopped = false;\n\n this.processInteractive( touchData.global, this.renderer._lastObjectRendered, this.processTouchMove, false );\n\n this.returnTouchData( touchData );\n }\n};\n\n/**\n * Processes the result of a touch move check and dispatches the event if need be\n *\n * @param displayObject {Container|Sprite|TilingSprite} The display object that was tested\n * @param hit {boolean} the result of the hit test on the display object\n * @private\n */\nInteractionManager.prototype.processTouchMove = function ( displayObject, hit )\n{\n hit = hit;\n this.dispatchEvent( displayObject, 'touchmove', this.eventData);\n};\n\n/**\n * Grabs an interaction data object from the internal pool\n *\n * @param touchEvent {EventData} The touch event we need to pair with an interactionData object\n *\n * @private\n */\nInteractionManager.prototype.getTouchData = function (touchEvent)\n{\n var touchData = this.interactiveDataPool.pop();\n\n if(!touchData)\n {\n touchData = new InteractionData();\n }\n\n touchData.identifier = touchEvent.identifier;\n this.mapPositionToPoint( touchData.global, touchEvent.clientX, touchEvent.clientY );\n\n return touchData;\n};\n\n/**\n * Returns an interaction data object to the internal pool\n *\n * @param touchData {InteractionData} The touch data object we want to return to the pool\n *\n * @private\n */\nInteractionManager.prototype.returnTouchData = function ( touchData )\n{\n this.interactiveDataPool.push( touchData );\n};\n\ncore.WebGLRenderer.registerPlugin('interaction', InteractionManager);\ncore.CanvasRenderer.registerPlugin('interaction', InteractionManager);\n", "/**\n * @file Main export of the PIXI interactions library\n * @author Mat Groves \n * @copyright 2013-2015 GoodBoyDigital\n * @license {@link https://github.com/GoodBoyDigital/pixi.js/blob/master/LICENSE|MIT License}\n */\n\n/**\n * @namespace PIXI.interaction\n */\nmodule.exports = {\n InteractionData: require('./InteractionData'),\n InteractionManager: require('./InteractionManager'),\n interactiveTarget: require('./interactiveTarget')\n};\n", "var core = require('../core');\n\n\ncore.DisplayObject.prototype.interactive = false;\ncore.DisplayObject.prototype.buttonMode = false;\ncore.DisplayObject.prototype.interactiveChildren = true;\ncore.DisplayObject.prototype.defaultCursor = 'pointer';\n\n// some internal checks..\ncore.DisplayObject.prototype._over = false;\ncore.DisplayObject.prototype._touchDown = false;\n\nmodule.exports = {};\n", - "var Resource = require('resource-loader').Resource,\n core = require('../core'),\n text = require('../text');\n\nmodule.exports = function ()\n{\n return function (resource, next)\n {\n if (!resource.data || navigator.isCocoonJS)\n {\n if (window.DOMParser)\n {\n var domparser = new DOMParser();\n resource.data = domparser.parseFromString(this.xhr.responseText, 'text/xml');\n }\n else\n {\n var div = document.createElement('div');\n div.innerHTML = this.xhr.responseText;\n resource.data = div;\n }\n }\n\n var name = resource.data.nodeName;\n\n // skip if no data\n if (!resource.data || !name || (name.toLowerCase() !== '#document' && name.toLowerCase() !== 'div'))\n {\n return next();\n }\n\n var textureUrl = this.baseUrl + resource.data.getElementsByTagName('page')[0].getAttribute('file');\n var loadOptions = {\n crossOrigin: resource.crossOrigin,\n loadType: Resource.LOAD_TYPE.IMAGE\n };\n\n // load the texture for the font\n this.add(resource.name + '_image', textureUrl, loadOptions, function (res)\n {\n var data = {};\n var info = resource.data.getElementsByTagName('info')[0];\n var common = resource.data.getElementsByTagName('common')[0];\n\n data.font = info.getAttribute('face');\n data.size = parseInt(info.getAttribute('size'), 10);\n data.lineHeight = parseInt(common.getAttribute('lineHeight'), 10);\n data.chars = {};\n\n //parse letters\n var letters = resource.data.getElementsByTagName('char');\n\n for (var i = 0; i < letters.length; i++)\n {\n var charCode = parseInt(letters[i].getAttribute('id'), 10);\n\n var textureRect = new core.math.Rectangle(\n parseInt(letters[i].getAttribute('x'), 10),\n parseInt(letters[i].getAttribute('y'), 10),\n parseInt(letters[i].getAttribute('width'), 10),\n parseInt(letters[i].getAttribute('height'), 10)\n );\n\n data.chars[charCode] = {\n xOffset: parseInt(letters[i].getAttribute('xoffset'), 10),\n yOffset: parseInt(letters[i].getAttribute('yoffset'), 10),\n xAdvance: parseInt(letters[i].getAttribute('xadvance'), 10),\n kerning: {},\n texture: core.utils.TextureCache[charCode] = new core.Texture(res.texture.baseTexture, textureRect)\n\n };\n }\n\n //parse kernings\n var kernings = resource.data.getElementsByTagName('kerning');\n for (i = 0; i < kernings.length; i++)\n {\n var first = parseInt(kernings[i].getAttribute('first'), 10);\n var second = parseInt(kernings[i].getAttribute('second'), 10);\n var amount = parseInt(kernings[i].getAttribute('amount'), 10);\n\n data.chars[second].kerning[first] = amount;\n\n }\n\n resource.bitmapFont = data;\n\n // I'm leaving this as a temporary fix so we can test the bitmap fonts in v3\n // but it's very likely to change\n text.BitmapText.fonts[data.font] = data;\n\n next();\n });\n };\n};\n", + "var Resource = require('resource-loader').Resource,\n core = require('../core'),\n text = require('../text');\n\nmodule.exports = function ()\n{\n return function (resource, next)\n {\n if (!resource.data || navigator.isCocoonJS)\n {\n if (window.DOMParser)\n {\n var domparser = new DOMParser();\n resource.data = domparser.parseFromString(this.xhr.responseText, 'text/xml');\n }\n else\n {\n var div = document.createElement('div');\n div.innerHTML = this.xhr.responseText;\n resource.data = div;\n }\n }\n\n var name = resource.data.nodeName;\n\n // skip if no data\n if (!resource.data || !name || (name.toLowerCase() !== '#document' && name.toLowerCase() !== 'div'))\n {\n return next();\n }\n\n var textureUrl = resource.data.getElementsByTagName('page')[0].getAttribute('file');\n var loadOptions = {\n crossOrigin: resource.crossOrigin,\n loadType: Resource.LOAD_TYPE.IMAGE\n };\n\n // load the texture for the font\n this.add(resource.name + '_image', textureUrl, loadOptions, function (res)\n {\n var data = {};\n var info = resource.data.getElementsByTagName('info')[0];\n var common = resource.data.getElementsByTagName('common')[0];\n\n data.font = info.getAttribute('face');\n data.size = parseInt(info.getAttribute('size'), 10);\n data.lineHeight = parseInt(common.getAttribute('lineHeight'), 10);\n data.chars = {};\n\n //parse letters\n var letters = resource.data.getElementsByTagName('char');\n\n for (var i = 0; i < letters.length; i++)\n {\n var charCode = parseInt(letters[i].getAttribute('id'), 10);\n\n var textureRect = new core.math.Rectangle(\n parseInt(letters[i].getAttribute('x'), 10),\n parseInt(letters[i].getAttribute('y'), 10),\n parseInt(letters[i].getAttribute('width'), 10),\n parseInt(letters[i].getAttribute('height'), 10)\n );\n\n data.chars[charCode] = {\n xOffset: parseInt(letters[i].getAttribute('xoffset'), 10),\n yOffset: parseInt(letters[i].getAttribute('yoffset'), 10),\n xAdvance: parseInt(letters[i].getAttribute('xadvance'), 10),\n kerning: {},\n texture: core.utils.TextureCache[charCode] = new core.Texture(res.texture.baseTexture, textureRect)\n\n };\n }\n\n //parse kernings\n var kernings = resource.data.getElementsByTagName('kerning');\n for (i = 0; i < kernings.length; i++)\n {\n var first = parseInt(kernings[i].getAttribute('first'), 10);\n var second = parseInt(kernings[i].getAttribute('second'), 10);\n var amount = parseInt(kernings[i].getAttribute('amount'), 10);\n\n data.chars[second].kerning[first] = amount;\n\n }\n\n resource.bitmapFont = data;\n\n // I'm leaving this as a temporary fix so we can test the bitmap fonts in v3\n // but it's very likely to change\n text.BitmapText.fonts[data.font] = data;\n\n next();\n });\n };\n};\n", "/**\n * @file Main export of the PIXI loaders library\n * @author Mat Groves \n * @copyright 2013-2015 GoodBoyDigital\n * @license {@link https://github.com/GoodBoyDigital/pixi.js/blob/master/LICENSE|MIT License}\n */\n\n/**\n * @namespace PIXI.loaders\n */\nmodule.exports = {\n Loader: require('./loader'),\n\n // parsers\n bitmapFontParser: require('./bitmapFontParser'),\n spineAtlasParser: require('./spineAtlasParser'),\n spritesheetParser: require('./spritesheetParser'),\n textureParser: require('./textureParser')\n};\n\n\nmodule.exports.loader = new module.exports.Loader();\n", "var ResourceLoader = require('resource-loader'),\n textureParser = require('./textureParser'),\n spritesheetParser = require('./spritesheetParser'),\n spineAtlasParser = require('./spineAtlasParser'),\n bitmapFontParser = require('./bitmapFontParser');\n\n/**\n *\n * The new loader, extends Resource Loader by Chad Engler : https://github.com/englercj/resource-loader\n *\n * ```js\n * var loader = new PIXI.loader();\n *\n * loader.add('spineboy',\"data/spineboy.json\");\n *\n * loader.once('complete',onAssetsLoaded);\n *\n * loader.load();\n * ```\n *\n * @class\n * @extends ResourceLoader\n * @memberof PIXI.loaders\n */\nvar Loader = function()\n{\n ResourceLoader.call(this);\n\n // parse any json strings into objects\n this.use(ResourceLoader.middleware.parsing.json())\n\n // parse any blob into more usable objects (e.g. Image)\n .use(ResourceLoader.middleware.parsing.blob())\n\n // parse any Image objects into textures\n .use(textureParser())\n\n // parse any spritesheet data into multiple textures\n .use(spritesheetParser())\n\n // parse any spine data into a spine object\n .use(spineAtlasParser())\n\n // parse any spritesheet data into multiple textures\n .use(bitmapFontParser());\n};\n\nLoader.prototype = Object.create(ResourceLoader.prototype);\nLoader.prototype.constructor = Loader;\n\nmodule.exports = Loader;\n", "var Resource = require('resource-loader').Resource,\n async = require('async'),\n spine = require('../spine');\n\nmodule.exports = function ()\n{\n return function (resource, next)\n {\n // if this is a spritesheet object\n if (resource.data && resource.data.bones)\n {\n /**\n * use a bit of hackery to load the atlas file, here we assume that the .json, .atlas and .png files\n * that correspond to the spine file are in the same base URL and that the .json and .atlas files\n * have the same name\n */\n var atlasPath = resource.url.substr(0, resource.url.lastIndexOf('.')) + '.atlas';\n var atlasOptions = {\n crossOrigin: resource.crossOrigin,\n xhrType: Resource.XHR_RESPONSE_TYPE.TEXT\n };\n var baseUrl = resource.url.substr(0, resource.url.lastIndexOf('/') + 1);\n\n\n this.add(resource.name + '_atlas', atlasPath, atlasOptions, function (res)\n {\n // create a spine atlas using the loaded text\n var spineAtlas = new spine.SpineRuntime.Atlas(this.xhr.responseText, baseUrl, res.crossOrigin);\n\n // spine animation\n var spineJsonParser = new spine.SpineRuntime.SkeletonJsonParser(new spine.SpineRuntime.AtlasAttachmentParser(spineAtlas));\n var skeletonData = spineJsonParser.readSkeletonData(resource.data);\n\n resource.spineData = skeletonData;\n resource.spineAtlas = spineAtlas;\n\n // Go through each spineAtlas.pages and wait for page.rendererObject (a baseTexture) to\n // load. Once all loaded, then call the next function.\n async.each(spineAtlas.pages, function (page, done)\n {\n if (page.rendererObject.hasLoaded)\n {\n done();\n }\n else\n {\n page.rendererObject.once('loaded', done);\n }\n }, next);\n });\n }\n else {\n next();\n }\n };\n};\n", - "var Resource = require('resource-loader').Resource,\n path = require('path'),\n core = require('../core');\n\nmodule.exports = function ()\n{\n return function (resource, next)\n {\n // if this is a spritesheet object\n if (resource.data && resource.data.frames)\n {\n var loadOptions = {\n crossOrigin: resource.crossOrigin,\n loadType: Resource.LOAD_TYPE.IMAGE\n };\n\n var route = path.dirname(resource.url.replace(this.baseUrl, ''));\n\n var resolution = core.utils.getResolutionOfUrl( resource.url );\n\n // load the image for this sheet\n this.add(resource.name + '_image', this.baseUrl + route + '/' + resource.data.meta.image, loadOptions, function (res)\n {\n resource.textures = {};\n\n var frames = resource.data.frames;\n\n for (var i in frames)\n {\n var rect = frames[i].frame;\n\n if (rect)\n {\n var size = null;\n var trim = null;\n\n if (frames[i].rotated) {\n size = new core.math.Rectangle(rect.x, rect.y, rect.h, rect.w);\n }\n else {\n size = new core.math.Rectangle(rect.x, rect.y, rect.w, rect.h);\n }\n\n // Check to see if the sprite is trimmed\n if (frames[i].trimmed)\n {\n trim = new core.math.Rectangle(\n frames[i].spriteSourceSize.x / resolution,\n frames[i].spriteSourceSize.y / resolution,\n frames[i].sourceSize.w / resolution,\n frames[i].sourceSize.h / resolution\n );\n }\n\n // flip the width and height!\n if (frames[i].rotated)\n {\n var temp = size.width;\n size.width = size.height;\n size.height = temp;\n }\n\n size.x /= resolution;\n size.y /= resolution;\n size.width /= resolution;\n size.height /= resolution;\n\n resource.textures[i] = new core.Texture(res.texture.baseTexture, size, size.clone(), trim, frames[i].rotated);\n\n // lets also add the frame to pixi's global cache for fromFrame and fromImage fucntions\n core.utils.TextureCache[i] = resource.textures[i];\n }\n }\n\n next();\n });\n }\n else {\n next();\n }\n };\n};\n", + "var Resource = require('resource-loader').Resource,\n path = require('path'),\n core = require('../core');\n\nmodule.exports = function ()\n{\n return function (resource, next)\n {\n // if this is a spritesheet object\n if (resource.data && resource.data.frames)\n {\n var loadOptions = {\n crossOrigin: resource.crossOrigin,\n loadType: Resource.LOAD_TYPE.IMAGE\n };\n\n var route = path.dirname(resource.url.replace(this.baseUrl, ''));\n\n var resolution = core.utils.getResolutionOfUrl( resource.url );\n\n // load the image for this sheet\n this.add(resource.name + '_image', route + '/' + resource.data.meta.image, loadOptions, function (res)\n {\n resource.textures = {};\n\n var frames = resource.data.frames;\n\n for (var i in frames)\n {\n var rect = frames[i].frame;\n\n if (rect)\n {\n var size = null;\n var trim = null;\n\n if (frames[i].rotated) {\n size = new core.math.Rectangle(rect.x, rect.y, rect.h, rect.w);\n }\n else {\n size = new core.math.Rectangle(rect.x, rect.y, rect.w, rect.h);\n }\n\n // Check to see if the sprite is trimmed\n if (frames[i].trimmed)\n {\n trim = new core.math.Rectangle(\n frames[i].spriteSourceSize.x / resolution,\n frames[i].spriteSourceSize.y / resolution,\n frames[i].sourceSize.w / resolution,\n frames[i].sourceSize.h / resolution\n );\n }\n\n // flip the width and height!\n if (frames[i].rotated)\n {\n var temp = size.width;\n size.width = size.height;\n size.height = temp;\n }\n\n size.x /= resolution;\n size.y /= resolution;\n size.width /= resolution;\n size.height /= resolution;\n\n resource.textures[i] = new core.Texture(res.texture.baseTexture, size, size.clone(), trim, frames[i].rotated);\n\n // lets also add the frame to pixi's global cache for fromFrame and fromImage fucntions\n core.utils.TextureCache[i] = resource.textures[i];\n }\n }\n\n next();\n });\n }\n else {\n next();\n }\n };\n};\n", "var core = require('../core');\n\nmodule.exports = function ()\n{\n return function (resource, next)\n {\n // create a new texture if the data is an Image object\n if (resource.data && resource.data.nodeName && resource.data.nodeName.toLowerCase() === 'img')\n {\n resource.texture = new core.Texture(new core.BaseTexture(resource.data, null, core.utils.getResolutionOfUrl(resource.url)));\n // lets also add the frame to pixi's global cache for fromFrame and fromImage fucntions\n core.utils.TextureCache[resource.url] = resource.texture;\n }\n\n next();\n };\n};\n", "var core = require('../core'),\n spine = require('./SpineRuntime');\n\n/* Esoteric Software SPINE wrapper for pixi.js */\n\nspine.Bone.yDown = true;\n\n/**\n * A class that enables the you to import and run your spine animations in pixi.\n * The Spine animation data needs to be loaded using either the Loader or a SpineLoader before it can be used by this class\n * See example 12 (http://www.goodboydigital.com/pixijs/examples/12/) to see a working example and check out the source\n *\n * ```js\n * var spineAnimation = new PIXI.Spine(spineData);\n * ```\n *\n * @class\n * @extends Container\n * @memberof PIXI.spine\n * @param spineData {object} The spine data loaded from a spine atlas.\n */\nfunction Spine(spineData)\n{\n core.Container.call(this);\n\n if (!spineData)\n {\n throw new Error('The spineData param is required.');\n }\n\n /**\n * The spineData object\n *\n * @member {object}\n */\n this.spineData = spineData;\n\n /**\n * A spine Skeleton object\n *\n * @member {object}\n */\n this.skeleton = new spine.Skeleton(spineData);\n this.skeleton.updateWorldTransform();\n\n /**\n * A spine AnimationStateData object created from the spine data passed in the constructor\n *\n * @member {object}\n */\n this.stateData = new spine.AnimationStateData(spineData);\n\n /**\n * A spine AnimationState object created from the spine AnimationStateData object\n *\n * @member {object}\n */\n this.state = new spine.AnimationState(this.stateData);\n\n /**\n * An array of containers\n *\n * @member {Container[]}\n */\n this.slotContainers = [];\n\n for (var i = 0, n = this.skeleton.drawOrder.length; i < n; i++)\n {\n var slot = this.skeleton.drawOrder[i];\n var attachment = slot.attachment;\n var slotContainer = new core.Container();\n this.slotContainers.push(slotContainer);\n this.addChild(slotContainer);\n\n if (attachment instanceof spine.RegionAttachment)\n {\n var spriteName = attachment.rendererObject.name;\n var sprite = this.createSprite(slot, attachment);\n slot.currentSprite = sprite;\n slot.currentSpriteName = spriteName;\n slotContainer.addChild(sprite);\n }\n else if (attachment instanceof spine.MeshAttachment)\n {\n var mesh = this.createMesh(slot, attachment);\n slot.currentMesh = mesh;\n slot.currentMeshName = attachment.name;\n slotContainer.addChild(mesh);\n }\n else\n {\n continue;\n }\n\n }\n\n /**\n * Should the Spine object update its transforms\n *\n * @member {boolean}\n */\n this.autoUpdate = true;\n}\n\nSpine.prototype = Object.create(core.Container.prototype);\nSpine.prototype.constructor = Spine;\nmodule.exports = Spine;\n\nObject.defineProperties(Spine.prototype, {\n /**\n * If this flag is set to true, the spine animation will be autoupdated every time\n * the object id drawn. The down side of this approach is that the delta time is\n * automatically calculated and you could miss out on cool effects like slow motion,\n * pause, skip ahead and the sorts. Most of these effects can be achieved even with\n * autoupdate enabled but are harder to achieve.\n *\n * @member {boolean}\n * @memberof Spine#\n * @default true\n */\n autoUpdate: {\n get: function ()\n {\n return (this.updateTransform === Spine.prototype.autoUpdateTransform);\n },\n\n set: function (value)\n {\n this.updateTransform = value ? Spine.prototype.autoUpdateTransform : core.Container.prototype.updateTransform;\n }\n }\n});\n\n/**\n * Update the spine skeleton and its animations by delta time (dt)\n *\n * @param dt {number} Delta time. Time by which the animation should be updated\n */\nSpine.prototype.update = function (dt)\n{\n this.state.update(dt);\n this.state.apply(this.skeleton);\n this.skeleton.updateWorldTransform();\n\n var drawOrder = this.skeleton.drawOrder;\n for (var i = 0, n = drawOrder.length; i < n; i++)\n {\n var slot = drawOrder[i];\n var attachment = slot.attachment;\n var slotContainer = this.slotContainers[i];\n\n if (!attachment)\n {\n slotContainer.visible = false;\n continue;\n }\n\n var type = attachment.type;\n if (type === spine.AttachmentType.region)\n {\n if (attachment.rendererObject)\n {\n if (!slot.currentSpriteName || slot.currentSpriteName !== attachment.rendererObject.name)\n {\n var spriteName = attachment.rendererObject.name;\n if (slot.currentSprite !== undefined)\n {\n slot.currentSprite.visible = false;\n }\n slot.sprites = slot.sprites || {};\n if (slot.sprites[spriteName] !== undefined)\n {\n slot.sprites[spriteName].visible = true;\n }\n else\n {\n var sprite = this.createSprite(slot, attachment);\n slotContainer.addChild(sprite);\n }\n slot.currentSprite = slot.sprites[spriteName];\n slot.currentSpriteName = spriteName;\n }\n }\n\n var bone = slot.bone;\n\n slotContainer.position.x = bone.worldX + attachment.x * bone.m00 + attachment.y * bone.m01;\n slotContainer.position.y = bone.worldY + attachment.x * bone.m10 + attachment.y * bone.m11;\n slotContainer.scale.x = bone.worldScaleX;\n slotContainer.scale.y = bone.worldScaleY;\n\n slotContainer.rotation = -(slot.bone.worldRotation * spine.degRad);\n\n slot.currentSprite.tint = core.utils.rgb2hex([slot.r,slot.g,slot.b]);\n }\n else if (type === spine.AttachmentType.skinnedmesh)\n {\n if (!slot.currentMeshName || slot.currentMeshName !== attachment.name)\n {\n var meshName = attachment.name;\n if (slot.currentMesh !== undefined)\n {\n slot.currentMesh.visible = false;\n }\n\n slot.meshes = slot.meshes || {};\n\n if (slot.meshes[meshName] !== undefined)\n {\n slot.meshes[meshName].visible = true;\n }\n else\n {\n var mesh = this.createMesh(slot, attachment);\n slotContainer.addChild(mesh);\n }\n\n slot.currentMesh = slot.meshes[meshName];\n slot.currentMeshName = meshName;\n }\n\n attachment.computeWorldVertices(slot.bone.skeleton.x, slot.bone.skeleton.y, slot, slot.currentMesh.vertices);\n\n }\n else\n {\n slotContainer.visible = false;\n continue;\n }\n slotContainer.visible = true;\n\n slotContainer.alpha = slot.a;\n }\n};\n\n/**\n * When autoupdate is set to yes this function is used as pixi's updateTransform function\n *\n * @private\n */\nSpine.prototype.autoUpdateTransform = function ()\n{\n this.lastTime = this.lastTime || Date.now();\n var timeDelta = (Date.now() - this.lastTime) * 0.001;\n this.lastTime = Date.now();\n\n this.update(timeDelta);\n\n core.Container.prototype.updateTransform.call(this);\n};\n\n/**\n * Create a new sprite to be used with spine.RegionAttachment\n *\n * @param slot {spine.Slot} The slot to which the attachment is parented\n * @param attachment {spine.RegionAttachment} The attachment that the sprite will represent\n * @private\n */\nSpine.prototype.createSprite = function (slot, attachment)\n{\n var descriptor = attachment.rendererObject;\n var baseTexture = descriptor.page.rendererObject;\n var spriteRect = new core.math.Rectangle(descriptor.x,\n descriptor.y,\n descriptor.rotate ? descriptor.height : descriptor.width,\n descriptor.rotate ? descriptor.width : descriptor.height);\n var spriteTexture = new core.Texture(baseTexture, spriteRect);\n var sprite = new core.Sprite(spriteTexture);\n\n var baseRotation = descriptor.rotate ? Math.PI * 0.5 : 0.0;\n sprite.scale.set(descriptor.width / descriptor.originalWidth, descriptor.height / descriptor.originalHeight);\n sprite.rotation = baseRotation - (attachment.rotation * spine.degRad);\n sprite.anchor.x = sprite.anchor.y = 0.5;\n\n slot.sprites = slot.sprites || {};\n slot.sprites[descriptor.name] = sprite;\n return sprite;\n};\n\n/**\n * Creates a Strip from the spine data\n * @param slot {spine.Slot} The slot to which the attachment is parented\n * @param attachment {spine.RegionAttachment} The attachment that the sprite will represent\n * @private\n */\nSpine.prototype.createMesh = function (slot, attachment)\n{\n var descriptor = attachment.rendererObject;\n var baseTexture = descriptor.page.rendererObject;\n var texture = new core.Texture(baseTexture);\n\n var strip = new core.Strip(texture);\n strip.drawMode = core.Strip.DRAW_MODES.TRIANGLES;\n strip.canvasPadding = 1.5;\n\n strip.vertices = new Float32Array(attachment.uvs.length);\n strip.uvs = attachment.uvs;\n strip.indices = attachment.triangles;\n\n slot.meshes = slot.meshes || {};\n slot.meshes[attachment.name] = strip;\n\n return strip;\n};\n", "/******************************************************************************\n * Spine Runtimes Software License\n * Version 2.1\n *\n * Copyright (c) 2013, Esoteric Software\n * All rights reserved.\n *\n * You are granted a perpetual, non-exclusive, non-sublicensable and\n * non-transferable license to install, execute and perform the Spine Runtimes\n * Software (the \"Software\") solely for internal use. Without the written\n * permission of Esoteric Software (typically granted by licensing Spine), you\n * may not (a) modify, translate, adapt or otherwise create derivative works,\n * improvements of the Software or develop new applications using the Software\n * or (b) remove, delete, alter or obscure any trademarks or any copyright,\n * trademark, patent or other intellectual property or proprietary rights\n * notices on or in the Software, including any copy thereof. Redistributions\n * in binary or source form must include this license and terms.\n *\n * THIS SOFTWARE IS PROVIDED BY ESOTERIC SOFTWARE \"AS IS\" AND ANY EXPRESS OR\n * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF\n * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO\n * EVENT SHALL ESOTERIC SOFTARE BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\n * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,\n * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;\n * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,\n * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR\n * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF\n * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n *****************************************************************************/\nvar core = require('../core');\n\n\nvar spine = module.exports = {\n\tradDeg: 180 / Math.PI,\n\tdegRad: Math.PI / 180,\n\ttemp: [],\n Float32Array: (typeof(Float32Array) === 'undefined') ? Array : Float32Array,\n Uint16Array: (typeof(Uint16Array) === 'undefined') ? Array : Uint16Array\n};\n\nspine.BoneData = function (name, parent)\n{\n\tthis.name = name;\n\tthis.parent = parent;\n};\nspine.BoneData.prototype = {\n\tlength: 0,\n\tx: 0, y: 0,\n\trotation: 0,\n\tscaleX: 1, scaleY: 1,\n\tinheritScale: true,\n\tinheritRotation: true,\n\tflipX: false, flipY: false\n};\n\nspine.SlotData = function (name, boneData)\n{\n\tthis.name = name;\n\tthis.boneData = boneData;\n};\nspine.SlotData.prototype = {\n\tr: 1, g: 1, b: 1, a: 1,\n\tattachmentName: null,\n\tadditiveBlending: false\n};\n\nspine.IkConstraintData = function (name)\n{\n\tthis.name = name;\n\tthis.bones = [];\n};\nspine.IkConstraintData.prototype = {\n\ttarget: null,\n\tbendDirection: 1,\n\tmix: 1\n};\n\nspine.Bone = function (boneData, skeleton, parent)\n{\n\tthis.data = boneData;\n\tthis.skeleton = skeleton;\n\tthis.parent = parent;\n\tthis.setToSetupPose();\n};\nspine.Bone.yDown = false;\nspine.Bone.prototype = {\n\tx: 0, y: 0,\n\trotation: 0, rotationIK: 0,\n\tscaleX: 1, scaleY: 1,\n\tflipX: false, flipY: false,\n\tm00: 0, m01: 0, worldX: 0, // a b x\n\tm10: 0, m11: 0, worldY: 0, // c d y\n\tworldRotation: 0,\n\tworldScaleX: 1, worldScaleY: 1,\n\tworldFlipX: false, worldFlipY: false,\n updateWorldTransform: function ()\n {\n\t\tvar parent = this.parent;\n if (parent)\n {\n\t\t\tthis.worldX = this.x * parent.m00 + this.y * parent.m01 + parent.worldX;\n\t\t\tthis.worldY = this.x * parent.m10 + this.y * parent.m11 + parent.worldY;\n if (this.data.inheritScale)\n {\n\t\t\t\tthis.worldScaleX = parent.worldScaleX * this.scaleX;\n\t\t\t\tthis.worldScaleY = parent.worldScaleY * this.scaleY;\n\t\t\t} else {\n\t\t\t\tthis.worldScaleX = this.scaleX;\n\t\t\t\tthis.worldScaleY = this.scaleY;\n\t\t\t}\n\t\t\tthis.worldRotation = this.data.inheritRotation ? (parent.worldRotation + this.rotationIK) : this.rotationIK;\n\t\t\tthis.worldFlipX = parent.worldFlipX != this.flipX;\n\t\t\tthis.worldFlipY = parent.worldFlipY != this.flipY;\n\t\t} else {\n\t\t\tvar skeletonFlipX = this.skeleton.flipX, skeletonFlipY = this.skeleton.flipY;\n\t\t\tthis.worldX = skeletonFlipX ? -this.x : this.x;\n\t\t\tthis.worldY = (skeletonFlipY != spine.Bone.yDown) ? -this.y : this.y;\n\t\t\tthis.worldScaleX = this.scaleX;\n\t\t\tthis.worldScaleY = this.scaleY;\n\t\t\tthis.worldRotation = this.rotationIK;\n\t\t\tthis.worldFlipX = skeletonFlipX != this.flipX;\n\t\t\tthis.worldFlipY = skeletonFlipY != this.flipY;\n\t\t}\n\t\tvar radians = this.worldRotation * spine.degRad;\n\t\tvar cos = Math.cos(radians);\n\t\tvar sin = Math.sin(radians);\n if (this.worldFlipX)\n {\n\t\t\tthis.m00 = -cos * this.worldScaleX;\n\t\t\tthis.m01 = sin * this.worldScaleY;\n\t\t} else {\n\t\t\tthis.m00 = cos * this.worldScaleX;\n\t\t\tthis.m01 = -sin * this.worldScaleY;\n\t\t}\n if (this.worldFlipY != spine.Bone.yDown)\n {\n\t\t\tthis.m10 = -sin * this.worldScaleX;\n\t\t\tthis.m11 = -cos * this.worldScaleY;\n\t\t} else {\n\t\t\tthis.m10 = sin * this.worldScaleX;\n\t\t\tthis.m11 = cos * this.worldScaleY;\n\t\t}\n\t},\n setToSetupPose: function ()\n {\n\t\tvar data = this.data;\n\t\tthis.x = data.x;\n\t\tthis.y = data.y;\n\t\tthis.rotation = data.rotation;\n\t\tthis.rotationIK = this.rotation;\n\t\tthis.scaleX = data.scaleX;\n\t\tthis.scaleY = data.scaleY;\n\t\tthis.flipX = data.flipX;\n\t\tthis.flipY = data.flipY;\n\t},\n worldToLocal: function (world)\n {\n\t\tvar dx = world[0] - this.worldX, dy = world[1] - this.worldY;\n\t\tvar m00 = this.m00, m10 = this.m10, m01 = this.m01, m11 = this.m11;\n if (this.worldFlipX != (this.worldFlipY != spine.Bone.yDown))\n {\n\t\t\tm00 = -m00;\n\t\t\tm11 = -m11;\n\t\t}\n\t\tvar invDet = 1 / (m00 * m11 - m01 * m10);\n\t\tworld[0] = dx * m00 * invDet - dy * m01 * invDet;\n\t\tworld[1] = dy * m11 * invDet - dx * m10 * invDet;\n\t},\n localToWorld: function (local)\n {\n\t\tvar localX = local[0], localY = local[1];\n\t\tlocal[0] = localX * this.m00 + localY * this.m01 + this.worldX;\n\t\tlocal[1] = localX * this.m10 + localY * this.m11 + this.worldY;\n\t}\n};\n\nspine.Slot = function (slotData, bone)\n{\n\tthis.data = slotData;\n\tthis.bone = bone;\n\tthis.setToSetupPose();\n};\nspine.Slot.prototype = {\n\tr: 1, g: 1, b: 1, a: 1,\n\t_attachmentTime: 0,\n\tattachment: null,\n\tattachmentVertices: [],\n setAttachment: function (attachment)\n {\n\t\tthis.attachment = attachment;\n\t\tthis._attachmentTime = this.bone.skeleton.time;\n\t\tthis.attachmentVertices.length = 0;\n\t},\n setAttachmentTime: function (time)\n {\n\t\tthis._attachmentTime = this.bone.skeleton.time - time;\n\t},\n getAttachmentTime: function ()\n {\n\t\treturn this.bone.skeleton.time - this._attachmentTime;\n\t},\n setToSetupPose: function ()\n {\n\t\tvar data = this.data;\n\t\tthis.r = data.r;\n\t\tthis.g = data.g;\n\t\tthis.b = data.b;\n\t\tthis.a = data.a;\n\n\t\tvar slotDatas = this.bone.skeleton.data.slots;\n for (var i = 0, n = slotDatas.length; i < n; i++)\n {\n if (slotDatas[i] == data)\n {\n\t\t\t\tthis.setAttachment(!data.attachmentName ? null : this.bone.skeleton.getAttachmentBySlotIndex(i, data.attachmentName));\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t}\n};\n\nspine.IkConstraint = function (data, skeleton)\n{\n\tthis.data = data;\n\tthis.mix = data.mix;\n\tthis.bendDirection = data.bendDirection;\n\n\tthis.bones = [];\n\tfor (var i = 0, n = data.bones.length; i < n; i++)\n\t\tthis.bones.push(skeleton.findBone(data.bones[i].name));\n\tthis.target = skeleton.findBone(data.target.name);\n};\nspine.IkConstraint.prototype = {\n apply: function ()\n {\n\t\tvar target = this.target;\n\t\tvar bones = this.bones;\n switch (bones.length)\n {\n\t\tcase 1:\n\t\t\tspine.IkConstraint.apply1(bones[0], target.worldX, target.worldY, this.mix);\n\t\t\tbreak;\n\t\tcase 2:\n\t\t\tspine.IkConstraint.apply2(bones[0], bones[1], target.worldX, target.worldY, this.bendDirection, this.mix);\n\t\t\tbreak;\n\t\t}\n\t}\n};\n/** Adjusts the bone rotation so the tip is as close to the target position as possible. The target is specified in the world\n * coordinate system. */\nspine.IkConstraint.apply1 = function (bone, targetX, targetY, alpha)\n{\n\tvar parentRotation = (!bone.data.inheritRotation || !bone.parent) ? 0 : bone.parent.worldRotation;\n\tvar rotation = bone.rotation;\n\tvar rotationIK = Math.atan2(targetY - bone.worldY, targetX - bone.worldX) * spine.radDeg - parentRotation;\n\tbone.rotationIK = rotation + (rotationIK - rotation) * alpha;\n};\n/** Adjusts the parent and child bone rotations so the tip of the child is as close to the target position as possible. The\n * target is specified in the world coordinate system.\n * @param child Any descendant bone of the parent. */\nspine.IkConstraint.apply2 = function (parent, child, targetX, targetY, bendDirection, alpha)\n{\n\tvar childRotation = child.rotation, parentRotation = parent.rotation;\n if (!alpha)\n {\n\t\tchild.rotationIK = childRotation;\n\t\tparent.rotationIK = parentRotation;\n\t\treturn;\n\t}\n\tvar positionX, positionY, tempPosition = spine.temp;\n\tvar parentParent = parent.parent;\n if (parentParent)\n {\n\t\ttempPosition[0] = targetX;\n\t\ttempPosition[1] = targetY;\n\t\tparentParent.worldToLocal(tempPosition);\n\t\ttargetX = (tempPosition[0] - parent.x) * parentParent.worldScaleX;\n\t\ttargetY = (tempPosition[1] - parent.y) * parentParent.worldScaleY;\n\t} else {\n\t\ttargetX -= parent.x;\n\t\ttargetY -= parent.y;\n\t}\n if (child.parent == parent)\n {\n\t\tpositionX = child.x;\n\t\tpositionY = child.y;\n\t} else {\n\t\ttempPosition[0] = child.x;\n\t\ttempPosition[1] = child.y;\n\t\tchild.parent.localToWorld(tempPosition);\n\t\tparent.worldToLocal(tempPosition);\n\t\tpositionX = tempPosition[0];\n\t\tpositionY = tempPosition[1];\n\t}\n\tvar childX = positionX * parent.worldScaleX, childY = positionY * parent.worldScaleY;\n\tvar offset = Math.atan2(childY, childX);\n\tvar len1 = Math.sqrt(childX * childX + childY * childY), len2 = child.data.length * child.worldScaleX;\n\t// Based on code by Ryan Juckett with permission: Copyright (c) 2008-2009 Ryan Juckett, http://www.ryanjuckett.com/\n\tvar cosDenom = 2 * len1 * len2;\n if (cosDenom < 0.0001)\n {\n\t\tchild.rotationIK = childRotation + (Math.atan2(targetY, targetX) * spine.radDeg - parentRotation - childRotation) * alpha;\n\t\treturn;\n\t}\n\tvar cos = (targetX * targetX + targetY * targetY - len1 * len1 - len2 * len2) / cosDenom;\n\tif (cos < -1)\n\t\tcos = -1;\n\telse if (cos > 1)\n\t\tcos = 1;\n\tvar childAngle = Math.acos(cos) * bendDirection;\n\tvar adjacent = len1 + len2 * cos, opposite = len2 * Math.sin(childAngle);\n\tvar parentAngle = Math.atan2(targetY * adjacent - targetX * opposite, targetX * adjacent + targetY * opposite);\n\tvar rotation = (parentAngle - offset) * spine.radDeg - parentRotation;\n\tif (rotation > 180)\n\t\trotation -= 360;\n\telse if (rotation < -180) //\n\t\trotation += 360;\n\tparent.rotationIK = parentRotation + rotation * alpha;\n\trotation = (childAngle + offset) * spine.radDeg - childRotation;\n\tif (rotation > 180)\n\t\trotation -= 360;\n\telse if (rotation < -180) //\n\t\trotation += 360;\n\tchild.rotationIK = childRotation + (rotation + parent.worldRotation - child.parent.worldRotation) * alpha;\n};\n\nspine.Skin = function (name)\n{\n\tthis.name = name;\n\tthis.attachments = {};\n};\nspine.Skin.prototype = {\n addAttachment: function (slotIndex, name, attachment)\n {\n\t\tthis.attachments[slotIndex + \":\" + name] = attachment;\n\t},\n getAttachment: function (slotIndex, name)\n {\n\t\treturn this.attachments[slotIndex + \":\" + name];\n\t},\n _attachAll: function (skeleton, oldSkin)\n {\n for (var key in oldSkin.attachments)\n {\n\t\t\tvar colon = key.indexOf(\":\");\n\t\t\tvar slotIndex = parseInt(key.substring(0, colon));\n\t\t\tvar name = key.substring(colon + 1);\n\t\t\tvar slot = skeleton.slots[slotIndex];\n if (slot.attachment && slot.attachment.name == name)\n {\n\t\t\t\tvar attachment = this.getAttachment(slotIndex, name);\n\t\t\t\tif (attachment) slot.setAttachment(attachment);\n\t\t\t}\n\t\t}\n\t}\n};\n\nspine.Animation = function (name, timelines, duration)\n{\n\tthis.name = name;\n\tthis.timelines = timelines;\n\tthis.duration = duration;\n};\nspine.Animation.prototype = {\n apply: function (skeleton, lastTime, time, loop, events)\n {\n if (loop && this.duration != 0)\n {\n\t\t\ttime %= this.duration;\n\t\t\tlastTime %= this.duration;\n\t\t}\n\t\tvar timelines = this.timelines;\n\t\tfor (var i = 0, n = timelines.length; i < n; i++)\n\t\t\ttimelines[i].apply(skeleton, lastTime, time, events, 1);\n\t},\n mix: function (skeleton, lastTime, time, loop, events, alpha)\n {\n if (loop && this.duration != 0)\n {\n\t\t\ttime %= this.duration;\n\t\t\tlastTime %= this.duration;\n\t\t}\n\t\tvar timelines = this.timelines;\n\t\tfor (var i = 0, n = timelines.length; i < n; i++)\n\t\t\ttimelines[i].apply(skeleton, lastTime, time, events, alpha);\n\t}\n};\nspine.Animation.binarySearch = function (values, target, step)\n{\n\tvar low = 0;\n\tvar high = Math.floor(values.length / step) - 2;\n\tif (!high) return step;\n\tvar current = high >>> 1;\n while (true)\n {\n\t\tif (values[(current + 1) * step] <= target)\n\t\t\tlow = current + 1;\n\t\telse\n\t\t\thigh = current;\n\t\tif (low == high) return (low + 1) * step;\n\t\tcurrent = (low + high) >>> 1;\n\t}\n};\nspine.Animation.binarySearch1 = function (values, target)\n{\n\tvar low = 0;\n\tvar high = values.length - 2;\n\tif (!high) return 1;\n\tvar current = high >>> 1;\n while (true)\n {\n\t\tif (values[current + 1] <= target)\n\t\t\tlow = current + 1;\n\t\telse\n\t\t\thigh = current;\n\t\tif (low == high) return low + 1;\n\t\tcurrent = (low + high) >>> 1;\n\t}\n};\nspine.Animation.linearSearch = function (values, target, step)\n{\n\tfor (var i = 0, last = values.length - step; i <= last; i += step)\n\t\tif (values[i] > target) return i;\n\treturn -1;\n};\n\nspine.Curves = function (frameCount)\n{\n\tthis.curves = []; // type, x, y, ...\n\t//this.curves.length = (frameCount - 1) * 19/*BEZIER_SIZE*/;\n};\nspine.Curves.prototype = {\n setLinear: function (frameIndex)\n {\n\t\tthis.curves[frameIndex * 19/*BEZIER_SIZE*/] = 0/*LINEAR*/;\n\t},\n setStepped: function (frameIndex)\n {\n\t\tthis.curves[frameIndex * 19/*BEZIER_SIZE*/] = 1/*STEPPED*/;\n\t},\n\t/** Sets the control handle positions for an interpolation bezier curve used to transition from this keyframe to the next.\n\t * cx1 and cx2 are from 0 to 1, representing the percent of time between the two keyframes. cy1 and cy2 are the percent of\n\t * the difference between the keyframe's values. */\n setCurve: function (frameIndex, cx1, cy1, cx2, cy2)\n {\n\t\tvar subdiv1 = 1 / 10/*BEZIER_SEGMENTS*/, subdiv2 = subdiv1 * subdiv1, subdiv3 = subdiv2 * subdiv1;\n\t\tvar pre1 = 3 * subdiv1, pre2 = 3 * subdiv2, pre4 = 6 * subdiv2, pre5 = 6 * subdiv3;\n\t\tvar tmp1x = -cx1 * 2 + cx2, tmp1y = -cy1 * 2 + cy2, tmp2x = (cx1 - cx2) * 3 + 1, tmp2y = (cy1 - cy2) * 3 + 1;\n\t\tvar dfx = cx1 * pre1 + tmp1x * pre2 + tmp2x * subdiv3, dfy = cy1 * pre1 + tmp1y * pre2 + tmp2y * subdiv3;\n\t\tvar ddfx = tmp1x * pre4 + tmp2x * pre5, ddfy = tmp1y * pre4 + tmp2y * pre5;\n\t\tvar dddfx = tmp2x * pre5, dddfy = tmp2y * pre5;\n\n\t\tvar i = frameIndex * 19/*BEZIER_SIZE*/;\n\t\tvar curves = this.curves;\n\t\tcurves[i++] = 2/*BEZIER*/;\n\n\t\tvar x = dfx, y = dfy;\n for (var n = i + 19/*BEZIER_SIZE*/ - 1; i < n; i += 2)\n {\n\t\t\tcurves[i] = x;\n\t\t\tcurves[i + 1] = y;\n\t\t\tdfx += ddfx;\n\t\t\tdfy += ddfy;\n\t\t\tddfx += dddfx;\n\t\t\tddfy += dddfy;\n\t\t\tx += dfx;\n\t\t\ty += dfy;\n\t\t}\n\t},\n getCurvePercent: function (frameIndex, percent)\n {\n\t\tpercent = percent < 0 ? 0 : (percent > 1 ? 1 : percent);\n\t\tvar curves = this.curves;\n\t\tvar i = frameIndex * 19/*BEZIER_SIZE*/;\n\t\tvar type = curves[i];\n\t\tif (type === 0/*LINEAR*/) return percent;\n\t\tif (type == 1/*STEPPED*/) return 0;\n\t\ti++;\n\t\tvar x = 0;\n for (var start = i, n = i + 19/*BEZIER_SIZE*/ - 1; i < n; i += 2)\n {\n\t\t\tx = curves[i];\n if (x >= percent)\n {\n\t\t\t\tvar prevX, prevY;\n if (i == start)\n {\n\t\t\t\t\tprevX = 0;\n\t\t\t\t\tprevY = 0;\n\t\t\t\t} else {\n\t\t\t\t\tprevX = curves[i - 2];\n\t\t\t\t\tprevY = curves[i - 1];\n\t\t\t\t}\n\t\t\t\treturn prevY + (curves[i + 1] - prevY) * (percent - prevX) / (x - prevX);\n\t\t\t}\n\t\t}\n\t\tvar y = curves[i - 1];\n\t\treturn y + (1 - y) * (percent - x) / (1 - x); // Last point is 1,1.\n\t}\n};\n\nspine.RotateTimeline = function (frameCount)\n{\n\tthis.curves = new spine.Curves(frameCount);\n\tthis.frames = []; // time, angle, ...\n\tthis.frames.length = frameCount * 2;\n};\nspine.RotateTimeline.prototype = {\n\tboneIndex: 0,\n getFrameCount: function ()\n {\n\t\treturn this.frames.length / 2;\n\t},\n setFrame: function (frameIndex, time, angle)\n {\n\t\tframeIndex *= 2;\n\t\tthis.frames[frameIndex] = time;\n\t\tthis.frames[frameIndex + 1] = angle;\n\t},\n apply: function (skeleton, lastTime, time, firedEvents, alpha)\n {\n\t\tvar frames = this.frames;\n\t\tif (time < frames[0]) return; // Time is before first frame.\n\n\t\tvar bone = skeleton.bones[this.boneIndex];\n\n if (time >= frames[frames.length - 2])\n { // Time is after last frame.\n\t\t\tvar amount = bone.data.rotation + frames[frames.length - 1] - bone.rotation;\n\t\t\twhile (amount > 180)\n\t\t\t\tamount -= 360;\n\t\t\twhile (amount < -180)\n\t\t\t\tamount += 360;\n\t\t\tbone.rotation += amount * alpha;\n\t\t\treturn;\n\t\t}\n\n\t\t// Interpolate between the previous frame and the current frame.\n\t\tvar frameIndex = spine.Animation.binarySearch(frames, time, 2);\n\t\tvar prevFrameValue = frames[frameIndex - 1];\n\t\tvar frameTime = frames[frameIndex];\n\t\tvar percent = 1 - (time - frameTime) / (frames[frameIndex - 2/*PREV_FRAME_TIME*/] - frameTime);\n\t\tpercent = this.curves.getCurvePercent(frameIndex / 2 - 1, percent);\n\n\t\tvar amount = frames[frameIndex + 1/*FRAME_VALUE*/] - prevFrameValue;\n\t\twhile (amount > 180)\n\t\t\tamount -= 360;\n\t\twhile (amount < -180)\n\t\t\tamount += 360;\n\t\tamount = bone.data.rotation + (prevFrameValue + amount * percent) - bone.rotation;\n\t\twhile (amount > 180)\n\t\t\tamount -= 360;\n\t\twhile (amount < -180)\n\t\t\tamount += 360;\n\t\tbone.rotation += amount * alpha;\n\t}\n};\n\nspine.TranslateTimeline = function (frameCount)\n{\n\tthis.curves = new spine.Curves(frameCount);\n\tthis.frames = []; // time, x, y, ...\n\tthis.frames.length = frameCount * 3;\n};\nspine.TranslateTimeline.prototype = {\n\tboneIndex: 0,\n getFrameCount: function ()\n {\n\t\treturn this.frames.length / 3;\n\t},\n setFrame: function (frameIndex, time, x, y)\n {\n\t\tframeIndex *= 3;\n\t\tthis.frames[frameIndex] = time;\n\t\tthis.frames[frameIndex + 1] = x;\n\t\tthis.frames[frameIndex + 2] = y;\n\t},\n apply: function (skeleton, lastTime, time, firedEvents, alpha)\n {\n\t\tvar frames = this.frames;\n\t\tif (time < frames[0]) return; // Time is before first frame.\n\n\t\tvar bone = skeleton.bones[this.boneIndex];\n\n if (time >= frames[frames.length - 3])\n { // Time is after last frame.\n\t\t\tbone.x += (bone.data.x + frames[frames.length - 2] - bone.x) * alpha;\n\t\t\tbone.y += (bone.data.y + frames[frames.length - 1] - bone.y) * alpha;\n\t\t\treturn;\n\t\t}\n\n\t\t// Interpolate between the previous frame and the current frame.\n\t\tvar frameIndex = spine.Animation.binarySearch(frames, time, 3);\n\t\tvar prevFrameX = frames[frameIndex - 2];\n\t\tvar prevFrameY = frames[frameIndex - 1];\n\t\tvar frameTime = frames[frameIndex];\n\t\tvar percent = 1 - (time - frameTime) / (frames[frameIndex + -3/*PREV_FRAME_TIME*/] - frameTime);\n\t\tpercent = this.curves.getCurvePercent(frameIndex / 3 - 1, percent);\n\n\t\tbone.x += (bone.data.x + prevFrameX + (frames[frameIndex + 1/*FRAME_X*/] - prevFrameX) * percent - bone.x) * alpha;\n\t\tbone.y += (bone.data.y + prevFrameY + (frames[frameIndex + 2/*FRAME_Y*/] - prevFrameY) * percent - bone.y) * alpha;\n\t}\n};\n\nspine.ScaleTimeline = function (frameCount)\n{\n\tthis.curves = new spine.Curves(frameCount);\n\tthis.frames = []; // time, x, y, ...\n\tthis.frames.length = frameCount * 3;\n};\nspine.ScaleTimeline.prototype = {\n\tboneIndex: 0,\n getFrameCount: function ()\n {\n\t\treturn this.frames.length / 3;\n\t},\n setFrame: function (frameIndex, time, x, y)\n {\n\t\tframeIndex *= 3;\n\t\tthis.frames[frameIndex] = time;\n\t\tthis.frames[frameIndex + 1] = x;\n\t\tthis.frames[frameIndex + 2] = y;\n\t},\n apply: function (skeleton, lastTime, time, firedEvents, alpha)\n {\n\t\tvar frames = this.frames;\n\t\tif (time < frames[0]) return; // Time is before first frame.\n\n\t\tvar bone = skeleton.bones[this.boneIndex];\n\n if (time >= frames[frames.length - 3])\n { // Time is after last frame.\n\t\t\tbone.scaleX += (bone.data.scaleX * frames[frames.length - 2] - bone.scaleX) * alpha;\n\t\t\tbone.scaleY += (bone.data.scaleY * frames[frames.length - 1] - bone.scaleY) * alpha;\n\t\t\treturn;\n\t\t}\n\n\t\t// Interpolate between the previous frame and the current frame.\n\t\tvar frameIndex = spine.Animation.binarySearch(frames, time, 3);\n\t\tvar prevFrameX = frames[frameIndex - 2];\n\t\tvar prevFrameY = frames[frameIndex - 1];\n\t\tvar frameTime = frames[frameIndex];\n\t\tvar percent = 1 - (time - frameTime) / (frames[frameIndex + -3/*PREV_FRAME_TIME*/] - frameTime);\n\t\tpercent = this.curves.getCurvePercent(frameIndex / 3 - 1, percent);\n\n\t\tbone.scaleX += (bone.data.scaleX * (prevFrameX + (frames[frameIndex + 1/*FRAME_X*/] - prevFrameX) * percent) - bone.scaleX) * alpha;\n\t\tbone.scaleY += (bone.data.scaleY * (prevFrameY + (frames[frameIndex + 2/*FRAME_Y*/] - prevFrameY) * percent) - bone.scaleY) * alpha;\n\t}\n};\n\nspine.ColorTimeline = function (frameCount)\n{\n\tthis.curves = new spine.Curves(frameCount);\n\tthis.frames = []; // time, r, g, b, a, ...\n\tthis.frames.length = frameCount * 5;\n};\nspine.ColorTimeline.prototype = {\n\tslotIndex: 0,\n getFrameCount: function ()\n {\n\t\treturn this.frames.length / 5;\n\t},\n setFrame: function (frameIndex, time, r, g, b, a)\n {\n\t\tframeIndex *= 5;\n\t\tthis.frames[frameIndex] = time;\n\t\tthis.frames[frameIndex + 1] = r;\n\t\tthis.frames[frameIndex + 2] = g;\n\t\tthis.frames[frameIndex + 3] = b;\n\t\tthis.frames[frameIndex + 4] = a;\n\t},\n apply: function (skeleton, lastTime, time, firedEvents, alpha)\n {\n\t\tvar frames = this.frames;\n\t\tif (time < frames[0]) return; // Time is before first frame.\n\n\t\tvar r, g, b, a;\n if (time >= frames[frames.length - 5])\n {\n\t\t\t// Time is after last frame.\n\t\t\tvar i = frames.length - 1;\n\t\t\tr = frames[i - 3];\n\t\t\tg = frames[i - 2];\n\t\t\tb = frames[i - 1];\n\t\t\ta = frames[i];\n\t\t} else {\n\t\t\t// Interpolate between the previous frame and the current frame.\n\t\t\tvar frameIndex = spine.Animation.binarySearch(frames, time, 5);\n\t\t\tvar prevFrameR = frames[frameIndex - 4];\n\t\t\tvar prevFrameG = frames[frameIndex - 3];\n\t\t\tvar prevFrameB = frames[frameIndex - 2];\n\t\t\tvar prevFrameA = frames[frameIndex - 1];\n\t\t\tvar frameTime = frames[frameIndex];\n\t\t\tvar percent = 1 - (time - frameTime) / (frames[frameIndex - 5/*PREV_FRAME_TIME*/] - frameTime);\n\t\t\tpercent = this.curves.getCurvePercent(frameIndex / 5 - 1, percent);\n\n\t\t\tr = prevFrameR + (frames[frameIndex + 1/*FRAME_R*/] - prevFrameR) * percent;\n\t\t\tg = prevFrameG + (frames[frameIndex + 2/*FRAME_G*/] - prevFrameG) * percent;\n\t\t\tb = prevFrameB + (frames[frameIndex + 3/*FRAME_B*/] - prevFrameB) * percent;\n\t\t\ta = prevFrameA + (frames[frameIndex + 4/*FRAME_A*/] - prevFrameA) * percent;\n\t\t}\n\t\tvar slot = skeleton.slots[this.slotIndex];\n if (alpha < 1)\n {\n\t\t\tslot.r += (r - slot.r) * alpha;\n\t\t\tslot.g += (g - slot.g) * alpha;\n\t\t\tslot.b += (b - slot.b) * alpha;\n\t\t\tslot.a += (a - slot.a) * alpha;\n\t\t} else {\n\t\t\tslot.r = r;\n\t\t\tslot.g = g;\n\t\t\tslot.b = b;\n\t\t\tslot.a = a;\n\t\t}\n\t}\n};\n\nspine.AttachmentTimeline = function (frameCount)\n{\n\tthis.curves = new spine.Curves(frameCount);\n\tthis.frames = []; // time, ...\n\tthis.frames.length = frameCount;\n\tthis.attachmentNames = [];\n\tthis.attachmentNames.length = frameCount;\n};\nspine.AttachmentTimeline.prototype = {\n\tslotIndex: 0,\n getFrameCount: function ()\n {\n\t\treturn this.frames.length;\n\t},\n setFrame: function (frameIndex, time, attachmentName)\n {\n\t\tthis.frames[frameIndex] = time;\n\t\tthis.attachmentNames[frameIndex] = attachmentName;\n\t},\n apply: function (skeleton, lastTime, time, firedEvents, alpha)\n {\n\t\tvar frames = this.frames;\n if (time < frames[0])\n {\n\t\t\tif (lastTime > time) this.apply(skeleton, lastTime, Number.MAX_VALUE, null, 0);\n\t\t\treturn;\n\t\t} else if (lastTime > time) //\n\t\t\tlastTime = -1;\n\n\t\tvar frameIndex = time >= frames[frames.length - 1] ? frames.length - 1 : spine.Animation.binarySearch1(frames, time) - 1;\n\t\tif (frames[frameIndex] < lastTime) return;\n\n\t\tvar attachmentName = this.attachmentNames[frameIndex];\n\t\tskeleton.slots[this.slotIndex].setAttachment(\n\t\t\t!attachmentName ? null : skeleton.getAttachmentBySlotIndex(this.slotIndex, attachmentName));\n\t}\n};\n\nspine.EventTimeline = function (frameCount)\n{\n\tthis.frames = []; // time, ...\n\tthis.frames.length = frameCount;\n\tthis.events = [];\n\tthis.events.length = frameCount;\n};\nspine.EventTimeline.prototype = {\n getFrameCount: function ()\n {\n\t\treturn this.frames.length;\n\t},\n setFrame: function (frameIndex, time, event)\n {\n\t\tthis.frames[frameIndex] = time;\n\t\tthis.events[frameIndex] = event;\n\t},\n\t/** Fires events for frames > lastTime and <= time. */\n apply: function (skeleton, lastTime, time, firedEvents, alpha)\n {\n\t\tif (!firedEvents) return;\n\n\t\tvar frames = this.frames;\n\t\tvar frameCount = frames.length;\n\n if (lastTime > time)\n { // Fire events after last time for looped animations.\n\t\t\tthis.apply(skeleton, lastTime, Number.MAX_VALUE, firedEvents, alpha);\n\t\t\tlastTime = -1;\n\t\t} else if (lastTime >= frames[frameCount - 1]) // Last time is after last frame.\n\t\t\treturn;\n\t\tif (time < frames[0]) return; // Time is before first frame.\n\n\t\tvar frameIndex;\n\t\tif (lastTime < frames[0])\n\t\t\tframeIndex = 0;\n else\n {\n\t\t\tframeIndex = spine.Animation.binarySearch1(frames, lastTime);\n\t\t\tvar frame = frames[frameIndex];\n while (frameIndex > 0)\n { // Fire multiple events with the same frame.\n\t\t\t\tif (frames[frameIndex - 1] != frame) break;\n\t\t\t\tframeIndex--;\n\t\t\t}\n\t\t}\n\t\tvar events = this.events;\n\t\tfor (; frameIndex < frameCount && time >= frames[frameIndex]; frameIndex++)\n\t\t\tfiredEvents.push(events[frameIndex]);\n\t}\n};\n\nspine.DrawOrderTimeline = function (frameCount)\n{\n\tthis.frames = []; // time, ...\n\tthis.frames.length = frameCount;\n\tthis.drawOrders = [];\n\tthis.drawOrders.length = frameCount;\n};\nspine.DrawOrderTimeline.prototype = {\n getFrameCount: function ()\n {\n\t\treturn this.frames.length;\n\t},\n setFrame: function (frameIndex, time, drawOrder)\n {\n\t\tthis.frames[frameIndex] = time;\n\t\tthis.drawOrders[frameIndex] = drawOrder;\n\t},\n apply: function (skeleton, lastTime, time, firedEvents, alpha)\n {\n\t\tvar frames = this.frames;\n\t\tif (time < frames[0]) return; // Time is before first frame.\n\n\t\tvar frameIndex;\n\t\tif (time >= frames[frames.length - 1]) // Time is after last frame.\n\t\t\tframeIndex = frames.length - 1;\n\t\telse\n\t\t\tframeIndex = spine.Animation.binarySearch1(frames, time) - 1;\n\n\t\tvar drawOrder = skeleton.drawOrder;\n\t\tvar slots = skeleton.slots;\n\t\tvar drawOrderToSetupIndex = this.drawOrders[frameIndex];\n if (!drawOrderToSetupIndex)\n {\n\t\t\tfor (var i = 0, n = slots.length; i < n; i++)\n\t\t\t\tdrawOrder[i] = slots[i];\n\t\t} else {\n\t\t\tfor (var i = 0, n = drawOrderToSetupIndex.length; i < n; i++)\n\t\t\t\tdrawOrder[i] = skeleton.slots[drawOrderToSetupIndex[i]];\n\t\t}\n\n\t}\n};\n\nspine.FfdTimeline = function (frameCount)\n{\n\tthis.curves = new spine.Curves(frameCount);\n\tthis.frames = [];\n\tthis.frames.length = frameCount;\n\tthis.frameVertices = [];\n\tthis.frameVertices.length = frameCount;\n};\nspine.FfdTimeline.prototype = {\n\tslotIndex: 0,\n\tattachment: 0,\n getFrameCount: function ()\n {\n\t\treturn this.frames.length;\n\t},\n setFrame: function (frameIndex, time, vertices)\n {\n\t\tthis.frames[frameIndex] = time;\n\t\tthis.frameVertices[frameIndex] = vertices;\n\t},\n apply: function (skeleton, lastTime, time, firedEvents, alpha)\n {\n\t\tvar slot = skeleton.slots[this.slotIndex];\n\t\tif (slot.attachment != this.attachment) return;\n\n\t\tvar frames = this.frames;\n\t\tif (time < frames[0]) return; // Time is before first frame.\n\n\t\tvar frameVertices = this.frameVertices;\n\t\tvar vertexCount = frameVertices[0].length;\n\n\t\tvar vertices = slot.attachmentVertices;\n\t\tif (vertices.length != vertexCount) alpha = 1;\n\t\tvertices.length = vertexCount;\n\n if (time >= frames[frames.length - 1])\n { // Time is after last frame.\n\t\t\tvar lastVertices = frameVertices[frames.length - 1];\n if (alpha < 1)\n {\n\t\t\t\tfor (var i = 0; i < vertexCount; i++)\n\t\t\t\t\tvertices[i] += (lastVertices[i] - vertices[i]) * alpha;\n\t\t\t} else {\n\t\t\t\tfor (var i = 0; i < vertexCount; i++)\n\t\t\t\t\tvertices[i] = lastVertices[i];\n\t\t\t}\n\t\t\treturn;\n\t\t}\n\n\t\t// Interpolate between the previous frame and the current frame.\n\t\tvar frameIndex = spine.Animation.binarySearch1(frames, time);\n\t\tvar frameTime = frames[frameIndex];\n\t\tvar percent = 1 - (time - frameTime) / (frames[frameIndex - 1] - frameTime);\n\t\tpercent = this.curves.getCurvePercent(frameIndex - 1, percent < 0 ? 0 : (percent > 1 ? 1 : percent));\n\n\t\tvar prevVertices = frameVertices[frameIndex - 1];\n\t\tvar nextVertices = frameVertices[frameIndex];\n\n if (alpha < 1)\n {\n for (var i = 0; i < vertexCount; i++)\n {\n\t\t\t\tvar prev = prevVertices[i];\n\t\t\t\tvertices[i] += (prev + (nextVertices[i] - prev) * percent - vertices[i]) * alpha;\n\t\t\t}\n\t\t} else {\n for (var i = 0; i < vertexCount; i++)\n {\n\t\t\t\tvar prev = prevVertices[i];\n\t\t\t\tvertices[i] = prev + (nextVertices[i] - prev) * percent;\n\t\t\t}\n\t\t}\n\t}\n};\n\nspine.IkConstraintTimeline = function (frameCount)\n{\n\tthis.curves = new spine.Curves(frameCount);\n\tthis.frames = []; // time, mix, bendDirection, ...\n\tthis.frames.length = frameCount * 3;\n};\nspine.IkConstraintTimeline.prototype = {\n\tikConstraintIndex: 0,\n getFrameCount: function ()\n {\n\t\treturn this.frames.length / 3;\n\t},\n setFrame: function (frameIndex, time, mix, bendDirection)\n {\n\t\tframeIndex *= 3;\n\t\tthis.frames[frameIndex] = time;\n\t\tthis.frames[frameIndex + 1] = mix;\n\t\tthis.frames[frameIndex + 2] = bendDirection;\n\t},\n apply: function (skeleton, lastTime, time, firedEvents, alpha)\n {\n\t\tvar frames = this.frames;\n\t\tif (time < frames[0]) return; // Time is before first frame.\n\n\t\tvar ikConstraint = skeleton.ikConstraints[this.ikConstraintIndex];\n\n if (time >= frames[frames.length - 3])\n { // Time is after last frame.\n\t\t\tikConstraint.mix += (frames[frames.length - 2] - ikConstraint.mix) * alpha;\n\t\t\tikConstraint.bendDirection = frames[frames.length - 1];\n\t\t\treturn;\n\t\t}\n\n\t\t// Interpolate between the previous frame and the current frame.\n\t\tvar frameIndex = spine.Animation.binarySearch(frames, time, 3);\n\t\tvar prevFrameMix = frames[frameIndex + -2/*PREV_FRAME_MIX*/];\n\t\tvar frameTime = frames[frameIndex];\n\t\tvar percent = 1 - (time - frameTime) / (frames[frameIndex + -3/*PREV_FRAME_TIME*/] - frameTime);\n\t\tpercent = this.curves.getCurvePercent(frameIndex / 3 - 1, percent);\n\n\t\tvar mix = prevFrameMix + (frames[frameIndex + 1/*FRAME_MIX*/] - prevFrameMix) * percent;\n\t\tikConstraint.mix += (mix - ikConstraint.mix) * alpha;\n\t\tikConstraint.bendDirection = frames[frameIndex + -1/*PREV_FRAME_BEND_DIRECTION*/];\n\t}\n};\n\nspine.FlipXTimeline = function (frameCount)\n{\n\tthis.curves = new spine.Curves(frameCount);\n\tthis.frames = []; // time, flip, ...\n\tthis.frames.length = frameCount * 2;\n};\nspine.FlipXTimeline.prototype = {\n\tboneIndex: 0,\n getFrameCount: function ()\n {\n\t\treturn this.frames.length / 2;\n\t},\n setFrame: function (frameIndex, time, flip)\n {\n\t\tframeIndex *= 2;\n\t\tthis.frames[frameIndex] = time;\n\t\tthis.frames[frameIndex + 1] = flip ? 1 : 0;\n\t},\n apply: function (skeleton, lastTime, time, firedEvents, alpha)\n {\n\t\tvar frames = this.frames;\n if (time < frames[0])\n {\n\t\t\tif (lastTime > time) this.apply(skeleton, lastTime, Number.MAX_VALUE, null, 0);\n\t\t\treturn;\n\t\t} else if (lastTime > time) //\n\t\t\tlastTime = -1;\n\t\tvar frameIndex = (time >= frames[frames.length - 2] ? frames.length : spine.Animation.binarySearch(frames, time, 2)) - 2;\n\t\tif (frames[frameIndex] < lastTime) return;\n\t\tskeleton.bones[boneIndex].flipX = frames[frameIndex + 1] != 0;\n\t}\n};\n\nspine.FlipYTimeline = function (frameCount)\n{\n\tthis.curves = new spine.Curves(frameCount);\n\tthis.frames = []; // time, flip, ...\n\tthis.frames.length = frameCount * 2;\n};\nspine.FlipYTimeline.prototype = {\n\tboneIndex: 0,\n getFrameCount: function ()\n {\n\t\treturn this.frames.length / 2;\n\t},\n setFrame: function (frameIndex, time, flip)\n {\n\t\tframeIndex *= 2;\n\t\tthis.frames[frameIndex] = time;\n\t\tthis.frames[frameIndex + 1] = flip ? 1 : 0;\n\t},\n apply: function (skeleton, lastTime, time, firedEvents, alpha)\n {\n\t\tvar frames = this.frames;\n if (time < frames[0])\n {\n\t\t\tif (lastTime > time) this.apply(skeleton, lastTime, Number.MAX_VALUE, null, 0);\n\t\t\treturn;\n\t\t} else if (lastTime > time) //\n\t\t\tlastTime = -1;\n\t\tvar frameIndex = (time >= frames[frames.length - 2] ? frames.length : spine.Animation.binarySearch(frames, time, 2)) - 2;\n\t\tif (frames[frameIndex] < lastTime) return;\n\t\tskeleton.bones[boneIndex].flipY = frames[frameIndex + 1] != 0;\n\t}\n};\n\nspine.SkeletonData = function ()\n{\n\tthis.bones = [];\n\tthis.slots = [];\n\tthis.skins = [];\n\tthis.events = [];\n\tthis.animations = [];\n\tthis.ikConstraints = [];\n};\nspine.SkeletonData.prototype = {\n\tname: null,\n\tdefaultSkin: null,\n\twidth: 0, height: 0,\n\tversion: null, hash: null,\n\t/** @return May be null. */\n findBone: function (boneName)\n {\n\t\tvar bones = this.bones;\n\t\tfor (var i = 0, n = bones.length; i < n; i++)\n\t\t\tif (bones[i].name == boneName) return bones[i];\n\t\treturn null;\n\t},\n\t/** @return -1 if the bone was not found. */\n findBoneIndex: function (boneName)\n {\n\t\tvar bones = this.bones;\n\t\tfor (var i = 0, n = bones.length; i < n; i++)\n\t\t\tif (bones[i].name == boneName) return i;\n\t\treturn -1;\n\t},\n\t/** @return May be null. */\n findSlot: function (slotName)\n {\n\t\tvar slots = this.slots;\n for (var i = 0, n = slots.length; i < n; i++)\n {\n\t\t\tif (slots[i].name == slotName) return slot[i];\n\t\t}\n\t\treturn null;\n\t},\n\t/** @return -1 if the bone was not found. */\n findSlotIndex: function (slotName)\n {\n\t\tvar slots = this.slots;\n\t\tfor (var i = 0, n = slots.length; i < n; i++)\n\t\t\tif (slots[i].name == slotName) return i;\n\t\treturn -1;\n\t},\n\t/** @return May be null. */\n findSkin: function (skinName)\n {\n\t\tvar skins = this.skins;\n\t\tfor (var i = 0, n = skins.length; i < n; i++)\n\t\t\tif (skins[i].name == skinName) return skins[i];\n\t\treturn null;\n\t},\n\t/** @return May be null. */\n findEvent: function (eventName)\n {\n\t\tvar events = this.events;\n\t\tfor (var i = 0, n = events.length; i < n; i++)\n\t\t\tif (events[i].name == eventName) return events[i];\n\t\treturn null;\n\t},\n\t/** @return May be null. */\n findAnimation: function (animationName)\n {\n\t\tvar animations = this.animations;\n\t\tfor (var i = 0, n = animations.length; i < n; i++)\n\t\t\tif (animations[i].name == animationName) return animations[i];\n\t\treturn null;\n\t},\n\t/** @return May be null. */\n findIkConstraint: function (ikConstraintName)\n {\n\t\tvar ikConstraints = this.ikConstraints;\n\t\tfor (var i = 0, n = ikConstraints.length; i < n; i++)\n\t\t\tif (ikConstraints[i].name == ikConstraintName) return ikConstraints[i];\n\t\treturn null;\n\t}\n};\n\nspine.Skeleton = function (skeletonData)\n{\n\tthis.data = skeletonData;\n\n\tthis.bones = [];\n for (var i = 0, n = skeletonData.bones.length; i < n; i++)\n {\n\t\tvar boneData = skeletonData.bones[i];\n\t\tvar parent = !boneData.parent ? null : this.bones[skeletonData.bones.indexOf(boneData.parent)];\n\t\tthis.bones.push(new spine.Bone(boneData, this, parent));\n\t}\n\n\tthis.slots = [];\n\tthis.drawOrder = [];\n for (var i = 0, n = skeletonData.slots.length; i < n; i++)\n {\n\t\tvar slotData = skeletonData.slots[i];\n\t\tvar bone = this.bones[skeletonData.bones.indexOf(slotData.boneData)];\n\t\tvar slot = new spine.Slot(slotData, bone);\n\t\tthis.slots.push(slot);\n\t\tthis.drawOrder.push(slot);\n\t}\n\n\tthis.ikConstraints = [];\n\tfor (var i = 0, n = skeletonData.ikConstraints.length; i < n; i++)\n\t\tthis.ikConstraints.push(new spine.IkConstraint(skeletonData.ikConstraints[i], this));\n\n\tthis.boneCache = [];\n\tthis.updateCache();\n};\nspine.Skeleton.prototype = {\n\tx: 0, y: 0,\n\tskin: null,\n\tr: 1, g: 1, b: 1, a: 1,\n\ttime: 0,\n\tflipX: false, flipY: false,\n\t/** Caches information about bones and IK constraints. Must be called if bones or IK constraints are added or removed. */\n updateCache: function ()\n {\n\t\tvar ikConstraints = this.ikConstraints;\n\t\tvar ikConstraintsCount = ikConstraints.length;\n\n\t\tvar arrayCount = ikConstraintsCount + 1;\n\t\tvar boneCache = this.boneCache;\n\t\tif (boneCache.length > arrayCount) boneCache.length = arrayCount;\n\t\tfor (var i = 0, n = boneCache.length; i < n; i++)\n\t\t\tboneCache[i].length = 0;\n\t\twhile (boneCache.length < arrayCount)\n\t\t\tboneCache[boneCache.length] = [];\n\n\t\tvar nonIkBones = boneCache[0];\n\t\tvar bones = this.bones;\n\n\t\touter:\n for (var i = 0, n = bones.length; i < n; i++)\n {\n\t\t\tvar bone = bones[i];\n\t\t\tvar current = bone;\n\t\t\tdo {\n for (var ii = 0; ii < ikConstraintsCount; ii++)\n {\n\t\t\t\t\tvar ikConstraint = ikConstraints[ii];\n\t\t\t\t\tvar parent = ikConstraint.bones[0];\n\t\t\t\t\tvar child= ikConstraint.bones[ikConstraint.bones.length - 1];\n while (true)\n {\n if (current == child)\n {\n\t\t\t\t\t\t\tboneCache[ii].push(bone);\n\t\t\t\t\t\t\tboneCache[ii + 1].push(bone);\n\t\t\t\t\t\t\tcontinue outer;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif (child == parent) break;\n\t\t\t\t\t\tchild = child.parent;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tcurrent = current.parent;\n\t\t\t} while (current);\n\t\t\tnonIkBones[nonIkBones.length] = bone;\n\t\t}\n\t},\n\t/** Updates the world transform for each bone. */\n updateWorldTransform: function ()\n {\n\t\tvar bones = this.bones;\n for (var i = 0, n = bones.length; i < n; i++)\n {\n\t\t\tvar bone = bones[i];\n\t\t\tbone.rotationIK = bone.rotation;\n\t\t}\n\t\tvar i = 0, last = this.boneCache.length - 1;\n while (true)\n {\n\t\t\tvar cacheBones = this.boneCache[i];\n\t\t\tfor (var ii = 0, nn = cacheBones.length; ii < nn; ii++)\n\t\t\t\tcacheBones[ii].updateWorldTransform();\n\t\t\tif (i == last) break;\n\t\t\tthis.ikConstraints[i].apply();\n\t\t\ti++;\n\t\t}\n\t},\n\t/** Sets the bones and slots to their setup pose values. */\n setToSetupPose: function ()\n {\n\t\tthis.setBonesToSetupPose();\n\t\tthis.setSlotsToSetupPose();\n\t},\n setBonesToSetupPose: function ()\n {\n\t\tvar bones = this.bones;\n\t\tfor (var i = 0, n = bones.length; i < n; i++)\n\t\t\tbones[i].setToSetupPose();\n\n\t\tvar ikConstraints = this.ikConstraints;\n for (var i = 0, n = ikConstraints.length; i < n; i++)\n {\n\t\t\tvar ikConstraint = ikConstraints[i];\n\t\t\tikConstraint.bendDirection = ikConstraint.data.bendDirection;\n\t\t\tikConstraint.mix = ikConstraint.data.mix;\n\t\t}\n\t},\n setSlotsToSetupPose: function ()\n {\n\t\tvar slots = this.slots;\n\t\tvar drawOrder = this.drawOrder;\n for (var i = 0, n = slots.length; i < n; i++)\n {\n\t\t\tdrawOrder[i] = slots[i];\n\t\t\tslots[i].setToSetupPose(i);\n\t\t}\n\t},\n\t/** @return May return null. */\n getRootBone: function ()\n {\n\t\treturn this.bones.length ? this.bones[0] : null;\n\t},\n\t/** @return May be null. */\n findBone: function (boneName)\n {\n\t\tvar bones = this.bones;\n\t\tfor (var i = 0, n = bones.length; i < n; i++)\n\t\t\tif (bones[i].data.name == boneName) return bones[i];\n\t\treturn null;\n\t},\n\t/** @return -1 if the bone was not found. */\n findBoneIndex: function (boneName)\n {\n\t\tvar bones = this.bones;\n\t\tfor (var i = 0, n = bones.length; i < n; i++)\n\t\t\tif (bones[i].data.name == boneName) return i;\n\t\treturn -1;\n\t},\n\t/** @return May be null. */\n findSlot: function (slotName)\n {\n\t\tvar slots = this.slots;\n\t\tfor (var i = 0, n = slots.length; i < n; i++)\n\t\t\tif (slots[i].data.name == slotName) return slots[i];\n\t\treturn null;\n\t},\n\t/** @return -1 if the bone was not found. */\n findSlotIndex: function (slotName)\n {\n\t\tvar slots = this.slots;\n\t\tfor (var i = 0, n = slots.length; i < n; i++)\n\t\t\tif (slots[i].data.name == slotName) return i;\n\t\treturn -1;\n\t},\n setSkinByName: function (skinName)\n {\n\t\tvar skin = this.data.findSkin(skinName);\n\t\tif (!skin) throw \"Skin not found: \" + skinName;\n\t\tthis.setSkin(skin);\n\t},\n\t/** Sets the skin used to look up attachments before looking in the {@link SkeletonData#getDefaultSkin() default skin}.\n\t * Attachments from the new skin are attached if the corresponding attachment from the old skin was attached. If there was\n\t * no old skin, each slot's setup mode attachment is attached from the new skin.\n\t * @param newSkin May be null. */\n setSkin: function (newSkin)\n {\n if (newSkin)\n {\n\t\t\tif (this.skin)\n\t\t\t\tnewSkin._attachAll(this, this.skin);\n else\n {\n\t\t\t\tvar slots = this.slots;\n for (var i = 0, n = slots.length; i < n; i++)\n {\n\t\t\t\t\tvar slot = slots[i];\n\t\t\t\t\tvar name = slot.data.attachmentName;\n if (name)\n {\n\t\t\t\t\t\tvar attachment = newSkin.getAttachment(i, name);\n\t\t\t\t\t\tif (attachment) slot.setAttachment(attachment);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tthis.skin = newSkin;\n\t},\n\t/** @return May be null. */\n getAttachmentBySlotName: function (slotName, attachmentName)\n {\n\t\treturn this.getAttachmentBySlotIndex(this.data.findSlotIndex(slotName), attachmentName);\n\t},\n\t/** @return May be null. */\n getAttachmentBySlotIndex: function (slotIndex, attachmentName)\n {\n if (this.skin)\n {\n\t\t\tvar attachment = this.skin.getAttachment(slotIndex, attachmentName);\n\t\t\tif (attachment) return attachment;\n\t\t}\n\t\tif (this.data.defaultSkin) return this.data.defaultSkin.getAttachment(slotIndex, attachmentName);\n\t\treturn null;\n\t},\n\t/** @param attachmentName May be null. */\n setAttachment: function (slotName, attachmentName)\n {\n\t\tvar slots = this.slots;\n for (var i = 0, n = slots.length; i < n; i++)\n {\n\t\t\tvar slot = slots[i];\n if (slot.data.name == slotName)\n {\n\t\t\t\tvar attachment = null;\n if (attachmentName)\n {\n\t\t\t\t\tattachment = this.getAttachmentBySlotIndex(i, attachmentName);\n\t\t\t\t\tif (!attachment) throw \"Attachment not found: \" + attachmentName + \", for slot: \" + slotName;\n\t\t\t\t}\n\t\t\t\tslot.setAttachment(attachment);\n\t\t\t\treturn;\n\t\t\t}\n\t\t}\n\t\tthrow \"Slot not found: \" + slotName;\n\t},\n\t/** @return May be null. */\n findIkConstraint: function (ikConstraintName)\n {\n\t\tvar ikConstraints = this.ikConstraints;\n\t\tfor (var i = 0, n = ikConstraints.length; i < n; i++)\n\t\t\tif (ikConstraints[i].data.name == ikConstraintName) return ikConstraints[i];\n\t\treturn null;\n\t},\n update: function (delta)\n {\n\t\tthis.time += delta;\n\t}\n};\n\nspine.EventData = function (name)\n{\n\tthis.name = name;\n};\nspine.EventData.prototype = {\n\tintValue: 0,\n\tfloatValue: 0,\n\tstringValue: null\n};\n\nspine.Event = function (data)\n{\n\tthis.data = data;\n};\nspine.Event.prototype = {\n\tintValue: 0,\n\tfloatValue: 0,\n\tstringValue: null\n};\n\nspine.AttachmentType = {\n\tregion: 0,\n\tboundingbox: 1,\n\tmesh: 2,\n\tskinnedmesh: 3\n};\n\nspine.RegionAttachment = function (name)\n{\n\tthis.name = name;\n\tthis.offset = [];\n\tthis.offset.length = 8;\n\tthis.uvs = [];\n\tthis.uvs.length = 8;\n};\nspine.RegionAttachment.prototype = {\n\ttype: spine.AttachmentType.region,\n\tx: 0, y: 0,\n\trotation: 0,\n\tscaleX: 1, scaleY: 1,\n\twidth: 0, height: 0,\n\tr: 1, g: 1, b: 1, a: 1,\n\tpath: null,\n\trendererObject: null,\n\tregionOffsetX: 0, regionOffsetY: 0,\n\tregionWidth: 0, regionHeight: 0,\n\tregionOriginalWidth: 0, regionOriginalHeight: 0,\n setUVs: function (u, v, u2, v2, rotate)\n {\n\t\tvar uvs = this.uvs;\n if (rotate)\n {\n\t\t\tuvs[2/*X2*/] = u;\n\t\t\tuvs[3/*Y2*/] = v2;\n\t\t\tuvs[4/*X3*/] = u;\n\t\t\tuvs[5/*Y3*/] = v;\n\t\t\tuvs[6/*X4*/] = u2;\n\t\t\tuvs[7/*Y4*/] = v;\n\t\t\tuvs[0/*X1*/] = u2;\n\t\t\tuvs[1/*Y1*/] = v2;\n\t\t} else {\n\t\t\tuvs[0/*X1*/] = u;\n\t\t\tuvs[1/*Y1*/] = v2;\n\t\t\tuvs[2/*X2*/] = u;\n\t\t\tuvs[3/*Y2*/] = v;\n\t\t\tuvs[4/*X3*/] = u2;\n\t\t\tuvs[5/*Y3*/] = v;\n\t\t\tuvs[6/*X4*/] = u2;\n\t\t\tuvs[7/*Y4*/] = v2;\n\t\t}\n\t},\n updateOffset: function ()\n {\n\t\tvar regionScaleX = this.width / this.regionOriginalWidth * this.scaleX;\n\t\tvar regionScaleY = this.height / this.regionOriginalHeight * this.scaleY;\n\t\tvar localX = -this.width / 2 * this.scaleX + this.regionOffsetX * regionScaleX;\n\t\tvar localY = -this.height / 2 * this.scaleY + this.regionOffsetY * regionScaleY;\n\t\tvar localX2 = localX + this.regionWidth * regionScaleX;\n\t\tvar localY2 = localY + this.regionHeight * regionScaleY;\n\t\tvar radians = this.rotation * spine.degRad;\n\t\tvar cos = Math.cos(radians);\n\t\tvar sin = Math.sin(radians);\n\t\tvar localXCos = localX * cos + this.x;\n\t\tvar localXSin = localX * sin;\n\t\tvar localYCos = localY * cos + this.y;\n\t\tvar localYSin = localY * sin;\n\t\tvar localX2Cos = localX2 * cos + this.x;\n\t\tvar localX2Sin = localX2 * sin;\n\t\tvar localY2Cos = localY2 * cos + this.y;\n\t\tvar localY2Sin = localY2 * sin;\n\t\tvar offset = this.offset;\n\t\toffset[0/*X1*/] = localXCos - localYSin;\n\t\toffset[1/*Y1*/] = localYCos + localXSin;\n\t\toffset[2/*X2*/] = localXCos - localY2Sin;\n\t\toffset[3/*Y2*/] = localY2Cos + localXSin;\n\t\toffset[4/*X3*/] = localX2Cos - localY2Sin;\n\t\toffset[5/*Y3*/] = localY2Cos + localX2Sin;\n\t\toffset[6/*X4*/] = localX2Cos - localYSin;\n\t\toffset[7/*Y4*/] = localYCos + localX2Sin;\n\t},\n computeVertices: function (x, y, bone, vertices)\n {\n\t\tx += bone.worldX;\n\t\ty += bone.worldY;\n\t\tvar m00 = bone.m00, m01 = bone.m01, m10 = bone.m10, m11 = bone.m11;\n\t\tvar offset = this.offset;\n\t\tvertices[0/*X1*/] = offset[0/*X1*/] * m00 + offset[1/*Y1*/] * m01 + x;\n\t\tvertices[1/*Y1*/] = offset[0/*X1*/] * m10 + offset[1/*Y1*/] * m11 + y;\n\t\tvertices[2/*X2*/] = offset[2/*X2*/] * m00 + offset[3/*Y2*/] * m01 + x;\n\t\tvertices[3/*Y2*/] = offset[2/*X2*/] * m10 + offset[3/*Y2*/] * m11 + y;\n\t\tvertices[4/*X3*/] = offset[4/*X3*/] * m00 + offset[5/*X3*/] * m01 + x;\n\t\tvertices[5/*X3*/] = offset[4/*X3*/] * m10 + offset[5/*X3*/] * m11 + y;\n\t\tvertices[6/*X4*/] = offset[6/*X4*/] * m00 + offset[7/*Y4*/] * m01 + x;\n\t\tvertices[7/*Y4*/] = offset[6/*X4*/] * m10 + offset[7/*Y4*/] * m11 + y;\n\t}\n};\n\nspine.MeshAttachment = function (name)\n{\n\tthis.name = name;\n};\nspine.MeshAttachment.prototype = {\n\ttype: spine.AttachmentType.mesh,\n\tvertices: null,\n\tuvs: null,\n\tregionUVs: null,\n\ttriangles: null,\n\thullLength: 0,\n\tr: 1, g: 1, b: 1, a: 1,\n\tpath: null,\n\trendererObject: null,\n\tregionU: 0, regionV: 0, regionU2: 0, regionV2: 0, regionRotate: false,\n\tregionOffsetX: 0, regionOffsetY: 0,\n\tregionWidth: 0, regionHeight: 0,\n\tregionOriginalWidth: 0, regionOriginalHeight: 0,\n\tedges: null,\n\twidth: 0, height: 0,\n updateUVs: function ()\n {\n\t\tvar width = this.regionU2 - this.regionU, height = this.regionV2 - this.regionV;\n\t\tvar n = this.regionUVs.length;\n if (!this.uvs || this.uvs.length != n)\n {\n this.uvs = new spine.Float32Array(n);\n\t\t}\n if (this.regionRotate)\n {\n for (var i = 0; i < n; i += 2)\n {\n this.uvs[i] = this.regionU + this.regionUVs[i + 1] * width;\n this.uvs[i + 1] = this.regionV + height - this.regionUVs[i] * height;\n\t\t\t}\n\t\t} else {\n for (var i = 0; i < n; i += 2)\n {\n this.uvs[i] = this.regionU + this.regionUVs[i] * width;\n this.uvs[i + 1] = this.regionV + this.regionUVs[i + 1] * height;\n\t\t\t}\n\t\t}\n\t},\n computeWorldVertices: function (x, y, slot, worldVertices)\n {\n\t\tvar bone = slot.bone;\n\t\tx += bone.worldX;\n\t\ty += bone.worldY;\n\t\tvar m00 = bone.m00, m01 = bone.m01, m10 = bone.m10, m11 = bone.m11;\n\t\tvar vertices = this.vertices;\n\t\tvar verticesCount = vertices.length;\n\t\tif (slot.attachmentVertices.length == verticesCount) vertices = slot.attachmentVertices;\n for (var i = 0; i < verticesCount; i += 2)\n {\n\t\t\tvar vx = vertices[i];\n\t\t\tvar vy = vertices[i + 1];\n\t\t\tworldVertices[i] = vx * m00 + vy * m01 + x;\n\t\t\tworldVertices[i + 1] = vx * m10 + vy * m11 + y;\n\t\t}\n\t}\n};\n\nspine.SkinnedMeshAttachment = function (name)\n{\n\tthis.name = name;\n};\nspine.SkinnedMeshAttachment.prototype = {\n\ttype: spine.AttachmentType.skinnedmesh,\n\tbones: null,\n\tweights: null,\n\tuvs: null,\n\tregionUVs: null,\n\ttriangles: null,\n\thullLength: 0,\n\tr: 1, g: 1, b: 1, a: 1,\n\tpath: null,\n\trendererObject: null,\n\tregionU: 0, regionV: 0, regionU2: 0, regionV2: 0, regionRotate: false,\n\tregionOffsetX: 0, regionOffsetY: 0,\n\tregionWidth: 0, regionHeight: 0,\n\tregionOriginalWidth: 0, regionOriginalHeight: 0,\n\tedges: null,\n\twidth: 0, height: 0,\n updateUVs: function (u, v, u2, v2, rotate)\n {\n\t\tvar width = this.regionU2 - this.regionU, height = this.regionV2 - this.regionV;\n\t\tvar n = this.regionUVs.length;\n if (!this.uvs || this.uvs.length != n)\n {\n this.uvs = new spine.Float32Array(n);\n\t\t}\n if (this.regionRotate)\n {\n for (var i = 0; i < n; i += 2)\n {\n this.uvs[i] = this.regionU + this.regionUVs[i + 1] * width;\n this.uvs[i + 1] = this.regionV + height - this.regionUVs[i] * height;\n\t\t\t}\n\t\t} else {\n for (var i = 0; i < n; i += 2)\n {\n this.uvs[i] = this.regionU + this.regionUVs[i] * width;\n this.uvs[i + 1] = this.regionV + this.regionUVs[i + 1] * height;\n\t\t\t}\n\t\t}\n\t},\n computeWorldVertices: function (x, y, slot, worldVertices)\n {\n\t\tvar skeletonBones = slot.bone.skeleton.bones;\n\t\tvar weights = this.weights;\n\t\tvar bones = this.bones;\n\n\t\tvar w = 0, v = 0, b = 0, f = 0, n = bones.length, nn;\n\t\tvar wx, wy, bone, vx, vy, weight;\n if (!slot.attachmentVertices.length)\n {\n for (; v < n; w += 2)\n {\n\t\t\t\twx = 0;\n\t\t\t\twy = 0;\n\t\t\t\tnn = bones[v++] + v;\n for (; v < nn; v++, b += 3)\n {\n\t\t\t\t\tbone = skeletonBones[bones[v]];\n\t\t\t\t\tvx = weights[b];\n\t\t\t\t\tvy = weights[b + 1];\n\t\t\t\t\tweight = weights[b + 2];\n\t\t\t\t\twx += (vx * bone.m00 + vy * bone.m01 + bone.worldX) * weight;\n\t\t\t\t\twy += (vx * bone.m10 + vy * bone.m11 + bone.worldY) * weight;\n\t\t\t\t}\n\t\t\t\tworldVertices[w] = wx + x;\n\t\t\t\tworldVertices[w + 1] = wy + y;\n\t\t\t}\n\t\t} else {\n\t\t\tvar ffd = slot.attachmentVertices;\n for (; v < n; w += 2)\n {\n\t\t\t\twx = 0;\n\t\t\t\twy = 0;\n\t\t\t\tnn = bones[v++] + v;\n for (; v < nn; v++, b += 3, f += 2)\n {\n\t\t\t\t\tbone = skeletonBones[bones[v]];\n\t\t\t\t\tvx = weights[b] + ffd[f];\n\t\t\t\t\tvy = weights[b + 1] + ffd[f + 1];\n\t\t\t\t\tweight = weights[b + 2];\n\t\t\t\t\twx += (vx * bone.m00 + vy * bone.m01 + bone.worldX) * weight;\n\t\t\t\t\twy += (vx * bone.m10 + vy * bone.m11 + bone.worldY) * weight;\n\t\t\t\t}\n\t\t\t\tworldVertices[w] = wx + x;\n\t\t\t\tworldVertices[w + 1] = wy + y;\n\t\t\t}\n\t\t}\n\t}\n};\n\nspine.BoundingBoxAttachment = function (name)\n{\n\tthis.name = name;\n\tthis.vertices = [];\n};\nspine.BoundingBoxAttachment.prototype = {\n\ttype: spine.AttachmentType.boundingbox,\n computeWorldVertices: function (x, y, bone, worldVertices)\n {\n\t\tx += bone.worldX;\n\t\ty += bone.worldY;\n\t\tvar m00 = bone.m00, m01 = bone.m01, m10 = bone.m10, m11 = bone.m11;\n\t\tvar vertices = this.vertices;\n for (var i = 0, n = vertices.length; i < n; i += 2)\n {\n\t\t\tvar px = vertices[i];\n\t\t\tvar py = vertices[i + 1];\n\t\t\tworldVertices[i] = px * m00 + py * m01 + x;\n\t\t\tworldVertices[i + 1] = px * m10 + py * m11 + y;\n\t\t}\n\t}\n};\n\nspine.AnimationStateData = function (skeletonData)\n{\n\tthis.skeletonData = skeletonData;\n\tthis.animationToMixTime = {};\n};\nspine.AnimationStateData.prototype = {\n\tdefaultMix: 0,\n setMixByName: function (fromName, toName, duration)\n {\n\t\tvar from = this.skeletonData.findAnimation(fromName);\n\t\tif (!from) throw \"Animation not found: \" + fromName;\n\t\tvar to = this.skeletonData.findAnimation(toName);\n\t\tif (!to) throw \"Animation not found: \" + toName;\n\t\tthis.setMix(from, to, duration);\n\t},\n setMix: function (from, to, duration)\n {\n\t\tthis.animationToMixTime[from.name + \":\" + to.name] = duration;\n\t},\n getMix: function (from, to)\n {\n\t\tvar key = from.name + \":\" + to.name;\n\t\treturn this.animationToMixTime.hasOwnProperty(key) ? this.animationToMixTime[key] : this.defaultMix;\n\t}\n};\n\nspine.TrackEntry = function ()\n{};\nspine.TrackEntry.prototype = {\n\tnext: null, previous: null,\n\tanimation: null,\n\tloop: false,\n\tdelay: 0, time: 0, lastTime: -1, endTime: 0,\n\ttimeScale: 1,\n\tmixTime: 0, mixDuration: 0, mix: 1,\n\tonStart: null, onEnd: null, onComplete: null, onEvent: null\n};\n\nspine.AnimationState = function (stateData)\n{\n\tthis.data = stateData;\n\tthis.tracks = [];\n\tthis.events = [];\n};\nspine.AnimationState.prototype = {\n\tonStart: null,\n\tonEnd: null,\n\tonComplete: null,\n\tonEvent: null,\n\ttimeScale: 1,\n update: function (delta)\n {\n\t\tdelta *= this.timeScale;\n for (var i = 0; i < this.tracks.length; i++)\n {\n\t\t\tvar current = this.tracks[i];\n\t\t\tif (!current) continue;\n\n\t\t\tcurrent.time += delta * current.timeScale;\n if (current.previous)\n {\n\t\t\t\tvar previousDelta = delta * current.previous.timeScale;\n\t\t\t\tcurrent.previous.time += previousDelta;\n\t\t\t\tcurrent.mixTime += previousDelta;\n\t\t\t}\n\n\t\t\tvar next = current.next;\n if (next)\n {\n\t\t\t\tnext.time = current.lastTime - next.delay;\n\t\t\t\tif (next.time >= 0) this.setCurrent(i, next);\n\t\t\t} else {\n\t\t\t\t// End non-looping animation when it reaches its end time and there is no next entry.\n\t\t\t\tif (!current.loop && current.lastTime >= current.endTime) this.clearTrack(i);\n\t\t\t}\n\t\t}\n\t},\n apply: function (skeleton)\n {\n for (var i = 0; i < this.tracks.length; i++)\n {\n\t\t\tvar current = this.tracks[i];\n\t\t\tif (!current) continue;\n\n\t\t\tthis.events.length = 0;\n\n\t\t\tvar time = current.time;\n\t\t\tvar lastTime = current.lastTime;\n\t\t\tvar endTime = current.endTime;\n\t\t\tvar loop = current.loop;\n\t\t\tif (!loop && time > endTime) time = endTime;\n\n\t\t\tvar previous = current.previous;\n if (!previous)\n {\n\t\t\t\tif (current.mix == 1)\n\t\t\t\t\tcurrent.animation.apply(skeleton, current.lastTime, time, loop, this.events);\n\t\t\t\telse\n\t\t\t\t\tcurrent.animation.mix(skeleton, current.lastTime, time, loop, this.events, current.mix);\n\t\t\t} else {\n\t\t\t\tvar previousTime = previous.time;\n\t\t\t\tif (!previous.loop && previousTime > previous.endTime) previousTime = previous.endTime;\n\t\t\t\tprevious.animation.apply(skeleton, previousTime, previousTime, previous.loop, null);\n\n\t\t\t\tvar alpha = current.mixTime / current.mixDuration * current.mix;\n if (alpha >= 1)\n {\n\t\t\t\t\talpha = 1;\n\t\t\t\t\tcurrent.previous = null;\n\t\t\t\t}\n\t\t\t\tcurrent.animation.mix(skeleton, current.lastTime, time, loop, this.events, alpha);\n\t\t\t}\n\n for (var ii = 0, nn = this.events.length; ii < nn; ii++)\n {\n\t\t\t\tvar event = this.events[ii];\n\t\t\t\tif (current.onEvent) current.onEvent(i, event);\n\t\t\t\tif (this.onEvent) this.onEvent(i, event);\n\t\t\t}\n\n\t\t\t// Check if completed the animation or a loop iteration.\n if (loop ? (lastTime % endTime > time % endTime) : (lastTime < endTime && time >= endTime))\n {\n\t\t\t\tvar count = Math.floor(time / endTime);\n\t\t\t\tif (current.onComplete) current.onComplete(i, count);\n\t\t\t\tif (this.onComplete) this.onComplete(i, count);\n\t\t\t}\n\n\t\t\tcurrent.lastTime = current.time;\n\t\t}\n\t},\n clearTracks: function ()\n {\n\t\tfor (var i = 0, n = this.tracks.length; i < n; i++)\n\t\t\tthis.clearTrack(i);\n\t\tthis.tracks.length = 0;\n\t},\n clearTrack: function (trackIndex)\n {\n\t\tif (trackIndex >= this.tracks.length) return;\n\t\tvar current = this.tracks[trackIndex];\n\t\tif (!current) return;\n\n\t\tif (current.onEnd) current.onEnd(trackIndex);\n\t\tif (this.onEnd) this.onEnd(trackIndex);\n\n\t\tthis.tracks[trackIndex] = null;\n\t},\n _expandToIndex: function (index)\n {\n\t\tif (index < this.tracks.length) return this.tracks[index];\n\t\twhile (index >= this.tracks.length)\n\t\t\tthis.tracks.push(null);\n\t\treturn null;\n\t},\n setCurrent: function (index, entry)\n {\n\t\tvar current = this._expandToIndex(index);\n if (current)\n {\n\t\t\tvar previous = current.previous;\n\t\t\tcurrent.previous = null;\n\n\t\t\tif (current.onEnd) current.onEnd(index);\n\t\t\tif (this.onEnd) this.onEnd(index);\n\n\t\t\tentry.mixDuration = this.data.getMix(current.animation, entry.animation);\n if (entry.mixDuration > 0)\n {\n\t\t\t\tentry.mixTime = 0;\n\t\t\t\t// If a mix is in progress, mix from the closest animation.\n\t\t\t\tif (previous && current.mixTime / current.mixDuration < 0.5)\n\t\t\t\t\tentry.previous = previous;\n\t\t\t\telse\n\t\t\t\t\tentry.previous = current;\n\t\t\t}\n\t\t}\n\n\t\tthis.tracks[index] = entry;\n\n\t\tif (entry.onStart) entry.onStart(index);\n\t\tif (this.onStart) this.onStart(index);\n\t},\n setAnimationByName: function (trackIndex, animationName, loop)\n {\n\t\tvar animation = this.data.skeletonData.findAnimation(animationName);\n\t\tif (!animation) throw \"Animation not found: \" + animationName;\n\t\treturn this.setAnimation(trackIndex, animation, loop);\n\t},\n\t/** Set the current animation. Any queued animations are cleared. */\n setAnimation: function (trackIndex, animation, loop)\n {\n\t\tvar entry = new spine.TrackEntry();\n\t\tentry.animation = animation;\n\t\tentry.loop = loop;\n\t\tentry.endTime = animation.duration;\n\t\tthis.setCurrent(trackIndex, entry);\n\t\treturn entry;\n\t},\n addAnimationByName: function (trackIndex, animationName, loop, delay)\n {\n\t\tvar animation = this.data.skeletonData.findAnimation(animationName);\n\t\tif (!animation) throw \"Animation not found: \" + animationName;\n\t\treturn this.addAnimation(trackIndex, animation, loop, delay);\n\t},\n\t/** Adds an animation to be played delay seconds after the current or last queued animation.\n\t * @param delay May be <= 0 to use duration of previous animation minus any mix duration plus the negative delay. */\n addAnimation: function (trackIndex, animation, loop, delay)\n {\n\t\tvar entry = new spine.TrackEntry();\n\t\tentry.animation = animation;\n\t\tentry.loop = loop;\n\t\tentry.endTime = animation.duration;\n\n\t\tvar last = this._expandToIndex(trackIndex);\n if (last)\n {\n\t\t\twhile (last.next)\n\t\t\t\tlast = last.next;\n\t\t\tlast.next = entry;\n\t\t} else\n\t\t\tthis.tracks[trackIndex] = entry;\n\n if (delay <= 0)\n {\n\t\t\tif (last)\n\t\t\t\tdelay += last.endTime - this.data.getMix(last.animation, animation);\n\t\t\telse\n\t\t\t\tdelay = 0;\n\t\t}\n\t\tentry.delay = delay;\n\n\t\treturn entry;\n\t},\n\t/** May be null. */\n getCurrent: function (trackIndex)\n {\n\t\tif (trackIndex >= this.tracks.length) return null;\n\t\treturn this.tracks[trackIndex];\n\t}\n};\n\nspine.SkeletonJsonParser = function (attachmentLoader)\n{\n\tthis.attachmentLoader = attachmentLoader;\n};\nspine.SkeletonJsonParser.prototype = {\n\tscale: 1,\n readSkeletonData: function (root, name)\n {\n\t\tvar skeletonData = new spine.SkeletonData();\n\t\tskeletonData.name = name;\n\n\t\t// Skeleton.\n\t\tvar skeletonMap = root[\"skeleton\"];\n if (skeletonMap)\n {\n\t\t\tskeletonData.hash = skeletonMap[\"hash\"];\n\t\t\tskeletonData.version = skeletonMap[\"spine\"];\n\t\t\tskeletonData.width = skeletonMap[\"width\"] || 0;\n\t\t\tskeletonData.height = skeletonMap[\"height\"] || 0;\n\t\t}\n\n\t\t// Bones.\n\t\tvar bones = root[\"bones\"];\n for (var i = 0, n = bones.length; i < n; i++)\n {\n\t\t\tvar boneMap = bones[i];\n\t\t\tvar parent = null;\n if (boneMap[\"parent\"])\n {\n\t\t\t\tparent = skeletonData.findBone(boneMap[\"parent\"]);\n\t\t\t\tif (!parent) throw \"Parent bone not found: \" + boneMap[\"parent\"];\n\t\t\t}\n\t\t\tvar boneData = new spine.BoneData(boneMap[\"name\"], parent);\n\t\t\tboneData.length = (boneMap[\"length\"] || 0) * this.scale;\n\t\t\tboneData.x = (boneMap[\"x\"] || 0) * this.scale;\n\t\t\tboneData.y = (boneMap[\"y\"] || 0) * this.scale;\n\t\t\tboneData.rotation = (boneMap[\"rotation\"] || 0);\n\t\t\tboneData.scaleX = boneMap.hasOwnProperty(\"scaleX\") ? boneMap[\"scaleX\"] : 1;\n\t\t\tboneData.scaleY = boneMap.hasOwnProperty(\"scaleY\") ? boneMap[\"scaleY\"] : 1;\n\t\t\tboneData.inheritScale = boneMap.hasOwnProperty(\"inheritScale\") ? boneMap[\"inheritScale\"] : true;\n\t\t\tboneData.inheritRotation = boneMap.hasOwnProperty(\"inheritRotation\") ? boneMap[\"inheritRotation\"] : true;\n\t\t\tskeletonData.bones.push(boneData);\n\t\t}\n\n\t\t// IK constraints.\n\t\tvar ik = root[\"ik\"];\n if (ik)\n {\n for (var i = 0, n = ik.length; i < n; i++)\n {\n\t\t\t\tvar ikMap = ik[i];\n\t\t\t\tvar ikConstraintData = new spine.IkConstraintData(ikMap[\"name\"]);\n\n\t\t\t\tvar bones = ikMap[\"bones\"];\n for (var ii = 0, nn = bones.length; ii < nn; ii++)\n {\n\t\t\t\t\tvar bone = skeletonData.findBone(bones[ii]);\n\t\t\t\t\tif (!bone) throw \"IK bone not found: \" + bones[ii];\n\t\t\t\t\tikConstraintData.bones.push(bone);\n\t\t\t\t}\n\n\t\t\t\tikConstraintData.target = skeletonData.findBone(ikMap[\"target\"]);\n\t\t\t\tif (!ikConstraintData.target) throw \"Target bone not found: \" + ikMap[\"target\"];\n\n\t\t\t\tikConstraintData.bendDirection = (!ikMap.hasOwnProperty(\"bendPositive\") || ikMap[\"bendPositive\"]) ? 1 : -1;\n\t\t\t\tikConstraintData.mix = ikMap.hasOwnProperty(\"mix\") ? ikMap[\"mix\"] : 1;\n\n\t\t\t\tskeletonData.ikConstraints.push(ikConstraintData);\n\t\t\t}\n\t\t}\n\n\t\t// Slots.\n\t\tvar slots = root[\"slots\"];\n for (var i = 0, n = slots.length; i < n; i++)\n {\n\t\t\tvar slotMap = slots[i];\n\t\t\tvar boneData = skeletonData.findBone(slotMap[\"bone\"]);\n\t\t\tif (!boneData) throw \"Slot bone not found: \" + slotMap[\"bone\"];\n\t\t\tvar slotData = new spine.SlotData(slotMap[\"name\"], boneData);\n\n\t\t\tvar color = slotMap[\"color\"];\n if (color)\n {\n\t\t\t\tslotData.r = this.toColor(color, 0);\n\t\t\t\tslotData.g = this.toColor(color, 1);\n\t\t\t\tslotData.b = this.toColor(color, 2);\n\t\t\t\tslotData.a = this.toColor(color, 3);\n\t\t\t}\n\n\t\t\tslotData.attachmentName = slotMap[\"attachment\"];\n\t\t\tslotData.additiveBlending = slotMap[\"additive\"] && slotMap[\"additive\"] == \"true\";\n\n\t\t\tskeletonData.slots.push(slotData);\n\t\t}\n\n\t\t// Skins.\n\t\tvar skins = root[\"skins\"];\n for (var skinName in skins)\n {\n\t\t\tif (!skins.hasOwnProperty(skinName)) continue;\n\t\t\tvar skinMap = skins[skinName];\n\t\t\tvar skin = new spine.Skin(skinName);\n for (var slotName in skinMap)\n {\n\t\t\t\tif (!skinMap.hasOwnProperty(slotName)) continue;\n\t\t\t\tvar slotIndex = skeletonData.findSlotIndex(slotName);\n\t\t\t\tvar slotEntry = skinMap[slotName];\n for (var attachmentName in slotEntry)\n {\n\t\t\t\t\tif (!slotEntry.hasOwnProperty(attachmentName)) continue;\n\t\t\t\t\tvar attachment = this.readAttachment(skin, attachmentName, slotEntry[attachmentName]);\n\t\t\t\t\tif (attachment) skin.addAttachment(slotIndex, attachmentName, attachment);\n\t\t\t\t}\n\t\t\t}\n\t\t\tskeletonData.skins.push(skin);\n\t\t\tif (skin.name == \"default\") skeletonData.defaultSkin = skin;\n\t\t}\n\n\t\t// Events.\n\t\tvar events = root[\"events\"];\n for (var eventName in events)\n {\n\t\t\tif (!events.hasOwnProperty(eventName)) continue;\n\t\t\tvar eventMap = events[eventName];\n\t\t\tvar eventData = new spine.EventData(eventName);\n\t\t\teventData.intValue = eventMap[\"int\"] || 0;\n\t\t\teventData.floatValue = eventMap[\"float\"] || 0;\n\t\t\teventData.stringValue = eventMap[\"string\"] || null;\n\t\t\tskeletonData.events.push(eventData);\n\t\t}\n\n\t\t// Animations.\n\t\tvar animations = root[\"animations\"];\n for (var animationName in animations)\n {\n\t\t\tif (!animations.hasOwnProperty(animationName)) continue;\n\t\t\tthis.readAnimation(animationName, animations[animationName], skeletonData);\n\t\t}\n\n\t\treturn skeletonData;\n\t},\n readAttachment: function (skin, name, map)\n {\n\t\tname = map[\"name\"] || name;\n\n\t\tvar type = spine.AttachmentType[map[\"type\"] || \"region\"];\n\t\tvar path = map[\"path\"] || name;\n\n\t\tvar scale = this.scale;\n if (type == spine.AttachmentType.region)\n {\n\t\t\tvar region = this.attachmentLoader.newRegionAttachment(skin, name, path);\n\t\t\tif (!region) return null;\n\t\t\tregion.path = path;\n\t\t\tregion.x = (map[\"x\"] || 0) * scale;\n\t\t\tregion.y = (map[\"y\"] || 0) * scale;\n\t\t\tregion.scaleX = map.hasOwnProperty(\"scaleX\") ? map[\"scaleX\"] : 1;\n\t\t\tregion.scaleY = map.hasOwnProperty(\"scaleY\") ? map[\"scaleY\"] : 1;\n\t\t\tregion.rotation = map[\"rotation\"] || 0;\n\t\t\tregion.width = (map[\"width\"] || 0) * scale;\n\t\t\tregion.height = (map[\"height\"] || 0) * scale;\n\n\t\t\tvar color = map[\"color\"];\n if (color)\n {\n\t\t\t\tregion.r = this.toColor(color, 0);\n\t\t\t\tregion.g = this.toColor(color, 1);\n\t\t\t\tregion.b = this.toColor(color, 2);\n\t\t\t\tregion.a = this.toColor(color, 3);\n\t\t\t}\n\n\t\t\tregion.updateOffset();\n\t\t\treturn region;\n } else if (type == spine.AttachmentType.mesh)\n {\n\t\t\tvar mesh = this.attachmentLoader.newMeshAttachment(skin, name, path);\n\t\t\tif (!mesh) return null;\n\t\t\tmesh.path = path;\n\t\t\tmesh.vertices = this.getFloatArray(map, \"vertices\", scale);\n\t\t\tmesh.triangles = this.getIntArray(map, \"triangles\");\n\t\t\tmesh.regionUVs = this.getFloatArray(map, \"uvs\", 1);\n\t\t\tmesh.updateUVs();\n\n\t\t\tcolor = map[\"color\"];\n if (color)\n {\n\t\t\t\tmesh.r = this.toColor(color, 0);\n\t\t\t\tmesh.g = this.toColor(color, 1);\n\t\t\t\tmesh.b = this.toColor(color, 2);\n\t\t\t\tmesh.a = this.toColor(color, 3);\n\t\t\t}\n\n\t\t\tmesh.hullLength = (map[\"hull\"] || 0) * 2;\n\t\t\tif (map[\"edges\"]) mesh.edges = this.getIntArray(map, \"edges\");\n\t\t\tmesh.width = (map[\"width\"] || 0) * scale;\n\t\t\tmesh.height = (map[\"height\"] || 0) * scale;\n\t\t\treturn mesh;\n } else if (type == spine.AttachmentType.skinnedmesh)\n {\n\t\t\tvar mesh = this.attachmentLoader.newSkinnedMeshAttachment(skin, name, path);\n\t\t\tif (!mesh) return null;\n\t\t\tmesh.path = path;\n\n\t\t\tvar uvs = this.getFloatArray(map, \"uvs\", 1);\n\t\t\tvar vertices = this.getFloatArray(map, \"vertices\", 1);\n\t\t\tvar weights = [];\n\t\t\tvar bones = [];\n for (var i = 0, n = vertices.length; i < n; )\n {\n\t\t\t\tvar boneCount = vertices[i++] | 0;\n\t\t\t\tbones[bones.length] = boneCount;\n for (var nn = i + boneCount * 4; i < nn; )\n {\n\t\t\t\t\tbones[bones.length] = vertices[i];\n\t\t\t\t\tweights[weights.length] = vertices[i + 1] * scale;\n\t\t\t\t\tweights[weights.length] = vertices[i + 2] * scale;\n\t\t\t\t\tweights[weights.length] = vertices[i + 3];\n\t\t\t\t\ti += 4;\n\t\t\t\t}\n\t\t\t}\n\t\t\tmesh.bones = bones;\n\t\t\tmesh.weights = weights;\n\t\t\tmesh.triangles = this.getIntArray(map, \"triangles\");\n\t\t\tmesh.regionUVs = uvs;\n\t\t\tmesh.updateUVs();\n\n\t\t\tcolor = map[\"color\"];\n if (color)\n {\n\t\t\t\tmesh.r = this.toColor(color, 0);\n\t\t\t\tmesh.g = this.toColor(color, 1);\n\t\t\t\tmesh.b = this.toColor(color, 2);\n\t\t\t\tmesh.a = this.toColor(color, 3);\n\t\t\t}\n\n\t\t\tmesh.hullLength = (map[\"hull\"] || 0) * 2;\n\t\t\tif (map[\"edges\"]) mesh.edges = this.getIntArray(map, \"edges\");\n\t\t\tmesh.width = (map[\"width\"] || 0) * scale;\n\t\t\tmesh.height = (map[\"height\"] || 0) * scale;\n\t\t\treturn mesh;\n } else if (type == spine.AttachmentType.boundingbox)\n {\n\t\t\tvar attachment = this.attachmentLoader.newBoundingBoxAttachment(skin, name);\n\t\t\tvar vertices = map[\"vertices\"];\n\t\t\tfor (var i = 0, n = vertices.length; i < n; i++)\n\t\t\t\tattachment.vertices.push(vertices[i] * scale);\n\t\t\treturn attachment;\n\t\t}\n\t\tthrow \"Unknown attachment type: \" + type;\n\t},\n readAnimation: function (name, map, skeletonData)\n {\n\t\tvar timelines = [];\n\t\tvar duration = 0;\n\n\t\tvar slots = map[\"slots\"];\n for (var slotName in slots)\n {\n\t\t\tif (!slots.hasOwnProperty(slotName)) continue;\n\t\t\tvar slotMap = slots[slotName];\n\t\t\tvar slotIndex = skeletonData.findSlotIndex(slotName);\n\n for (var timelineName in slotMap)\n {\n\t\t\t\tif (!slotMap.hasOwnProperty(timelineName)) continue;\n\t\t\t\tvar values = slotMap[timelineName];\n if (timelineName == \"color\")\n {\n\t\t\t\t\tvar timeline = new spine.ColorTimeline(values.length);\n\t\t\t\t\ttimeline.slotIndex = slotIndex;\n\n\t\t\t\t\tvar frameIndex = 0;\n for (var i = 0, n = values.length; i < n; i++)\n {\n\t\t\t\t\t\tvar valueMap = values[i];\n\t\t\t\t\t\tvar color = valueMap[\"color\"];\n\t\t\t\t\t\tvar r = this.toColor(color, 0);\n\t\t\t\t\t\tvar g = this.toColor(color, 1);\n\t\t\t\t\t\tvar b = this.toColor(color, 2);\n\t\t\t\t\t\tvar a = this.toColor(color, 3);\n\t\t\t\t\t\ttimeline.setFrame(frameIndex, valueMap[\"time\"], r, g, b, a);\n\t\t\t\t\t\tthis.readCurve(timeline, frameIndex, valueMap);\n\t\t\t\t\t\tframeIndex++;\n\t\t\t\t\t}\n\t\t\t\t\ttimelines.push(timeline);\n\t\t\t\t\tduration = Math.max(duration, timeline.frames[timeline.getFrameCount() * 5 - 5]);\n\n } else if (timelineName == \"attachment\")\n {\n\t\t\t\t\tvar timeline = new spine.AttachmentTimeline(values.length);\n\t\t\t\t\ttimeline.slotIndex = slotIndex;\n\n\t\t\t\t\tvar frameIndex = 0;\n for (var i = 0, n = values.length; i < n; i++)\n {\n\t\t\t\t\t\tvar valueMap = values[i];\n\t\t\t\t\t\ttimeline.setFrame(frameIndex++, valueMap[\"time\"], valueMap[\"name\"]);\n\t\t\t\t\t}\n\t\t\t\t\ttimelines.push(timeline);\n\t\t\t\t\tduration = Math.max(duration, timeline.frames[timeline.getFrameCount() - 1]);\n\n\t\t\t\t} else\n\t\t\t\t\tthrow \"Invalid timeline type for a slot: \" + timelineName + \" (\" + slotName + \")\";\n\t\t\t}\n\t\t}\n\n\t\tvar bones = map[\"bones\"];\n for (var boneName in bones)\n {\n\t\t\tif (!bones.hasOwnProperty(boneName)) continue;\n\t\t\tvar boneIndex = skeletonData.findBoneIndex(boneName);\n\t\t\tif (boneIndex == -1) throw \"Bone not found: \" + boneName;\n\t\t\tvar boneMap = bones[boneName];\n\n for (var timelineName in boneMap)\n {\n\t\t\t\tif (!boneMap.hasOwnProperty(timelineName)) continue;\n\t\t\t\tvar values = boneMap[timelineName];\n if (timelineName == \"rotate\")\n {\n\t\t\t\t\tvar timeline = new spine.RotateTimeline(values.length);\n\t\t\t\t\ttimeline.boneIndex = boneIndex;\n\n\t\t\t\t\tvar frameIndex = 0;\n for (var i = 0, n = values.length; i < n; i++)\n {\n\t\t\t\t\t\tvar valueMap = values[i];\n\t\t\t\t\t\ttimeline.setFrame(frameIndex, valueMap[\"time\"], valueMap[\"angle\"]);\n\t\t\t\t\t\tthis.readCurve(timeline, frameIndex, valueMap);\n\t\t\t\t\t\tframeIndex++;\n\t\t\t\t\t}\n\t\t\t\t\ttimelines.push(timeline);\n\t\t\t\t\tduration = Math.max(duration, timeline.frames[timeline.getFrameCount() * 2 - 2]);\n\n } else if (timelineName == \"translate\" || timelineName == \"scale\")\n {\n\t\t\t\t\tvar timeline;\n\t\t\t\t\tvar timelineScale = 1;\n\t\t\t\t\tif (timelineName == \"scale\")\n\t\t\t\t\t\ttimeline = new spine.ScaleTimeline(values.length);\n else\n {\n\t\t\t\t\t\ttimeline = new spine.TranslateTimeline(values.length);\n\t\t\t\t\t\ttimelineScale = this.scale;\n\t\t\t\t\t}\n\t\t\t\t\ttimeline.boneIndex = boneIndex;\n\n\t\t\t\t\tvar frameIndex = 0;\n for (var i = 0, n = values.length; i < n; i++)\n {\n\t\t\t\t\t\tvar valueMap = values[i];\n\t\t\t\t\t\tvar x = (valueMap[\"x\"] || 0) * timelineScale;\n\t\t\t\t\t\tvar y = (valueMap[\"y\"] || 0) * timelineScale;\n\t\t\t\t\t\ttimeline.setFrame(frameIndex, valueMap[\"time\"], x, y);\n\t\t\t\t\t\tthis.readCurve(timeline, frameIndex, valueMap);\n\t\t\t\t\t\tframeIndex++;\n\t\t\t\t\t}\n\t\t\t\t\ttimelines.push(timeline);\n\t\t\t\t\tduration = Math.max(duration, timeline.frames[timeline.getFrameCount() * 3 - 3]);\n\n } else if (timelineName == \"flipX\" || timelineName == \"flipY\")\n {\n\t\t\t\t\tvar x = timelineName == \"flipX\";\n\t\t\t\t\tvar timeline = x ? new spine.FlipXTimeline(values.length) : new spine.FlipYTimeline(values.length);\n\t\t\t\t\ttimeline.boneIndex = boneIndex;\n\n\t\t\t\t\tvar field = x ? \"x\" : \"y\";\n\t\t\t\t\tvar frameIndex = 0;\n for (var i = 0, n = values.length; i < n; i++)\n {\n\t\t\t\t\t\tvar valueMap = values[i];\n\t\t\t\t\t\ttimeline.setFrame(frameIndex, valueMap[\"time\"], valueMap[field] || false);\n\t\t\t\t\t\tframeIndex++;\n\t\t\t\t\t}\n\t\t\t\t\ttimelines.push(timeline);\n\t\t\t\t\tduration = Math.max(duration, timeline.frames[timeline.getFrameCount() * 2 - 2]);\n\t\t\t\t} else\n\t\t\t\t\tthrow \"Invalid timeline type for a bone: \" + timelineName + \" (\" + boneName + \")\";\n\t\t\t}\n\t\t}\n\n\t\tvar ikMap = map[\"ik\"];\n for (var ikConstraintName in ikMap)\n {\n\t\t\tif (!ikMap.hasOwnProperty(ikConstraintName)) continue;\n\t\t\tvar ikConstraint = skeletonData.findIkConstraint(ikConstraintName);\n\t\t\tvar values = ikMap[ikConstraintName];\n\t\t\tvar timeline = new spine.IkConstraintTimeline(values.length);\n\t\t\ttimeline.ikConstraintIndex = skeletonData.ikConstraints.indexOf(ikConstraint);\n\t\t\tvar frameIndex = 0;\n for (var i = 0, n = values.length; i < n; i++)\n {\n\t\t\t\tvar valueMap = values[i];\n\t\t\t\tvar mix = valueMap.hasOwnProperty(\"mix\") ? valueMap[\"mix\"] : 1;\n\t\t\t\tvar bendDirection = (!valueMap.hasOwnProperty(\"bendPositive\") || valueMap[\"bendPositive\"]) ? 1 : -1;\n\t\t\t\ttimeline.setFrame(frameIndex, valueMap[\"time\"], mix, bendDirection);\n\t\t\t\tthis.readCurve(timeline, frameIndex, valueMap);\n\t\t\t\tframeIndex++;\n\t\t\t}\n\t\t\ttimelines.push(timeline);\n\t\t\tduration = Math.max(duration, timeline.frames[timeline.frameCount * 3 - 3]);\n\t\t}\n\n\t\tvar ffd = map[\"ffd\"];\n for (var skinName in ffd)\n {\n\t\t\tvar skin = skeletonData.findSkin(skinName);\n\t\t\tvar slotMap = ffd[skinName];\n for (slotName in slotMap)\n {\n\t\t\t\tvar slotIndex = skeletonData.findSlotIndex(slotName);\n\t\t\t\tvar meshMap = slotMap[slotName];\n for (var meshName in meshMap)\n {\n\t\t\t\t\tvar values = meshMap[meshName];\n\t\t\t\t\tvar timeline = new spine.FfdTimeline(values.length);\n\t\t\t\t\tvar attachment = skin.getAttachment(slotIndex, meshName);\n\t\t\t\t\tif (!attachment) throw \"FFD attachment not found: \" + meshName;\n\t\t\t\t\ttimeline.slotIndex = slotIndex;\n\t\t\t\t\ttimeline.attachment = attachment;\n\n\t\t\t\t\tvar isMesh = attachment.type == spine.AttachmentType.mesh;\n\t\t\t\t\tvar vertexCount;\n\t\t\t\t\tif (isMesh)\n\t\t\t\t\t\tvertexCount = attachment.vertices.length;\n\t\t\t\t\telse\n\t\t\t\t\t\tvertexCount = attachment.weights.length / 3 * 2;\n\n\t\t\t\t\tvar frameIndex = 0;\n for (var i = 0, n = values.length; i < n; i++)\n {\n\t\t\t\t\t\tvar valueMap = values[i];\n\t\t\t\t\t\tvar vertices;\n if (!valueMap[\"vertices\"])\n {\n\t\t\t\t\t\t\tif (isMesh)\n\t\t\t\t\t\t\t\tvertices = attachment.vertices;\n else\n {\n\t\t\t\t\t\t\t\tvertices = [];\n\t\t\t\t\t\t\t\tvertices.length = vertexCount;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tvar verticesValue = valueMap[\"vertices\"];\n\t\t\t\t\t\t\tvar vertices = [];\n\t\t\t\t\t\t\tvertices.length = vertexCount;\n\t\t\t\t\t\t\tvar start = valueMap[\"offset\"] || 0;\n\t\t\t\t\t\t\tvar nn = verticesValue.length;\n if (this.scale == 1)\n {\n\t\t\t\t\t\t\t\tfor (var ii = 0; ii < nn; ii++)\n\t\t\t\t\t\t\t\t\tvertices[ii + start] = verticesValue[ii];\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\tfor (var ii = 0; ii < nn; ii++)\n\t\t\t\t\t\t\t\t\tvertices[ii + start] = verticesValue[ii] * this.scale;\n\t\t\t\t\t\t\t}\n if (isMesh)\n {\n\t\t\t\t\t\t\t\tvar meshVertices = attachment.vertices;\n\t\t\t\t\t\t\t\tfor (var ii = 0, nn = vertices.length; ii < nn; ii++)\n\t\t\t\t\t\t\t\t\tvertices[ii] += meshVertices[ii];\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\ttimeline.setFrame(frameIndex, valueMap[\"time\"], vertices);\n\t\t\t\t\t\tthis.readCurve(timeline, frameIndex, valueMap);\n\t\t\t\t\t\tframeIndex++;\n\t\t\t\t\t}\n\t\t\t\t\ttimelines[timelines.length] = timeline;\n\t\t\t\t\tduration = Math.max(duration, timeline.frames[timeline.frameCount - 1]);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tvar drawOrderValues = map[\"drawOrder\"];\n\t\tif (!drawOrderValues) drawOrderValues = map[\"draworder\"];\n if (drawOrderValues)\n {\n\t\t\tvar timeline = new spine.DrawOrderTimeline(drawOrderValues.length);\n\t\t\tvar slotCount = skeletonData.slots.length;\n\t\t\tvar frameIndex = 0;\n for (var i = 0, n = drawOrderValues.length; i < n; i++)\n {\n\t\t\t\tvar drawOrderMap = drawOrderValues[i];\n\t\t\t\tvar drawOrder = null;\n if (drawOrderMap[\"offsets\"])\n {\n\t\t\t\t\tdrawOrder = [];\n\t\t\t\t\tdrawOrder.length = slotCount;\n\t\t\t\t\tfor (var ii = slotCount - 1; ii >= 0; ii--)\n\t\t\t\t\t\tdrawOrder[ii] = -1;\n\t\t\t\t\tvar offsets = drawOrderMap[\"offsets\"];\n\t\t\t\t\tvar unchanged = [];\n\t\t\t\t\tunchanged.length = slotCount - offsets.length;\n\t\t\t\t\tvar originalIndex = 0, unchangedIndex = 0;\n for (var ii = 0, nn = offsets.length; ii < nn; ii++)\n {\n\t\t\t\t\t\tvar offsetMap = offsets[ii];\n\t\t\t\t\t\tvar slotIndex = skeletonData.findSlotIndex(offsetMap[\"slot\"]);\n\t\t\t\t\t\tif (slotIndex == -1) throw \"Slot not found: \" + offsetMap[\"slot\"];\n\t\t\t\t\t\t// Collect unchanged items.\n\t\t\t\t\t\twhile (originalIndex != slotIndex)\n\t\t\t\t\t\t\tunchanged[unchangedIndex++] = originalIndex++;\n\t\t\t\t\t\t// Set changed items.\n\t\t\t\t\t\tdrawOrder[originalIndex + offsetMap[\"offset\"]] = originalIndex++;\n\t\t\t\t\t}\n\t\t\t\t\t// Collect remaining unchanged items.\n\t\t\t\t\twhile (originalIndex < slotCount)\n\t\t\t\t\t\tunchanged[unchangedIndex++] = originalIndex++;\n\t\t\t\t\t// Fill in unchanged items.\n\t\t\t\t\tfor (var ii = slotCount - 1; ii >= 0; ii--)\n\t\t\t\t\t\tif (drawOrder[ii] == -1) drawOrder[ii] = unchanged[--unchangedIndex];\n\t\t\t\t}\n\t\t\t\ttimeline.setFrame(frameIndex++, drawOrderMap[\"time\"], drawOrder);\n\t\t\t}\n\t\t\ttimelines.push(timeline);\n\t\t\tduration = Math.max(duration, timeline.frames[timeline.getFrameCount() - 1]);\n\t\t}\n\n\t\tvar events = map[\"events\"];\n if (events)\n {\n\t\t\tvar timeline = new spine.EventTimeline(events.length);\n\t\t\tvar frameIndex = 0;\n for (var i = 0, n = events.length; i < n; i++)\n {\n\t\t\t\tvar eventMap = events[i];\n\t\t\t\tvar eventData = skeletonData.findEvent(eventMap[\"name\"]);\n\t\t\t\tif (!eventData) throw \"Event not found: \" + eventMap[\"name\"];\n\t\t\t\tvar event = new spine.Event(eventData);\n\t\t\t\tevent.intValue = eventMap.hasOwnProperty(\"int\") ? eventMap[\"int\"] : eventData.intValue;\n\t\t\t\tevent.floatValue = eventMap.hasOwnProperty(\"float\") ? eventMap[\"float\"] : eventData.floatValue;\n\t\t\t\tevent.stringValue = eventMap.hasOwnProperty(\"string\") ? eventMap[\"string\"] : eventData.stringValue;\n\t\t\t\ttimeline.setFrame(frameIndex++, eventMap[\"time\"], event);\n\t\t\t}\n\t\t\ttimelines.push(timeline);\n\t\t\tduration = Math.max(duration, timeline.frames[timeline.getFrameCount() - 1]);\n\t\t}\n\n\t\tskeletonData.animations.push(new spine.Animation(name, timelines, duration));\n\t},\n readCurve: function (timeline, frameIndex, valueMap)\n {\n\t\tvar curve = valueMap[\"curve\"];\n\t\tif (!curve)\n\t\t\ttimeline.curves.setLinear(frameIndex);\n\t\telse if (curve == \"stepped\")\n\t\t\ttimeline.curves.setStepped(frameIndex);\n\t\telse if (curve instanceof Array)\n\t\t\ttimeline.curves.setCurve(frameIndex, curve[0], curve[1], curve[2], curve[3]);\n\t},\n toColor: function (hexString, colorIndex)\n {\n\t\tif (hexString.length != 8) throw \"Color hexidecimal length must be 8, recieved: \" + hexString;\n\t\treturn parseInt(hexString.substring(colorIndex * 2, (colorIndex * 2) + 2), 16) / 255;\n\t},\n getFloatArray: function (map, name, scale)\n {\n\t\tvar list = map[name];\n\t\tvar values = new spine.Float32Array(list.length);\n\t\tvar i = 0, n = list.length;\n if (scale == 1)\n {\n\t\t\tfor (; i < n; i++)\n\t\t\t\tvalues[i] = list[i];\n\t\t} else {\n\t\t\tfor (; i < n; i++)\n\t\t\t\tvalues[i] = list[i] * scale;\n\t\t}\n\t\treturn values;\n\t},\n getIntArray: function (map, name)\n {\n\t\tvar list = map[name];\n\t\tvar values = new spine.Uint16Array(list.length);\n\t\tfor (var i = 0, n = list.length; i < n; i++)\n\t\t\tvalues[i] = list[i] | 0;\n\t\treturn values;\n\t}\n};\n\nspine.Atlas = function (atlasText, baseUrl, crossOrigin)\n{\n if (baseUrl && baseUrl.indexOf('/') !== baseUrl.length)\n {\n baseUrl += '/';\n }\n\n\tthis.pages = [];\n\tthis.regions = [];\n\n this.texturesLoading = 0;\n\n var self = this;\n\n\tvar reader = new spine.AtlasReader(atlasText);\n\tvar tuple = [];\n\ttuple.length = 4;\n\tvar page = null;\n while (true)\n {\n\t\tvar line = reader.readLine();\n\t\tif (line === null) break;\n\t\tline = reader.trim(line);\n\t\tif (!line.length)\n\t\t\tpage = null;\n else if (!page)\n {\n\t\t\tpage = new spine.AtlasPage();\n\t\t\tpage.name = line;\n\n if (reader.readTuple(tuple) == 2)\n { // size is only optional for an atlas packed with an old TexturePacker.\n\t\t\t\tpage.width = parseInt(tuple[0]);\n\t\t\t\tpage.height = parseInt(tuple[1]);\n\t\t\t\treader.readTuple(tuple);\n\t\t\t}\n\t\t\tpage.format = spine.Atlas.Format[tuple[0]];\n\n\t\t\treader.readTuple(tuple);\n\t\t\tpage.minFilter = spine.Atlas.TextureFilter[tuple[0]];\n\t\t\tpage.magFilter = spine.Atlas.TextureFilter[tuple[1]];\n\n\t\t\tvar direction = reader.readValue();\n\t\t\tpage.uWrap = spine.Atlas.TextureWrap.clampToEdge;\n\t\t\tpage.vWrap = spine.Atlas.TextureWrap.clampToEdge;\n\t\t\tif (direction == \"x\")\n\t\t\t\tpage.uWrap = spine.Atlas.TextureWrap.repeat;\n\t\t\telse if (direction == \"y\")\n\t\t\t\tpage.vWrap = spine.Atlas.TextureWrap.repeat;\n\t\t\telse if (direction == \"xy\")\n\t\t\t\tpage.uWrap = page.vWrap = spine.Atlas.TextureWrap.repeat;\n\n page.rendererObject = core.BaseTexture.fromImage(baseUrl + line, crossOrigin);\n\n\t\t\tthis.pages.push(page);\n\n\t\t} else {\n\t\t\tvar region = new spine.AtlasRegion();\n\t\t\tregion.name = line;\n\t\t\tregion.page = page;\n\n\t\t\tregion.rotate = reader.readValue() == \"true\";\n\n\t\t\treader.readTuple(tuple);\n\t\t\tvar x = parseInt(tuple[0]);\n\t\t\tvar y = parseInt(tuple[1]);\n\n\t\t\treader.readTuple(tuple);\n\t\t\tvar width = parseInt(tuple[0]);\n\t\t\tvar height = parseInt(tuple[1]);\n\n\t\t\tregion.u = x / page.width;\n\t\t\tregion.v = y / page.height;\n if (region.rotate)\n {\n\t\t\t\tregion.u2 = (x + height) / page.width;\n\t\t\t\tregion.v2 = (y + width) / page.height;\n\t\t\t} else {\n\t\t\t\tregion.u2 = (x + width) / page.width;\n\t\t\t\tregion.v2 = (y + height) / page.height;\n\t\t\t}\n\t\t\tregion.x = x;\n\t\t\tregion.y = y;\n\t\t\tregion.width = Math.abs(width);\n\t\t\tregion.height = Math.abs(height);\n\n if (reader.readTuple(tuple) == 4)\n { // split is optional\n\t\t\t\tregion.splits = [parseInt(tuple[0]), parseInt(tuple[1]), parseInt(tuple[2]), parseInt(tuple[3])];\n\n if (reader.readTuple(tuple) == 4)\n { // pad is optional, but only present with splits\n\t\t\t\t\tregion.pads = [parseInt(tuple[0]), parseInt(tuple[1]), parseInt(tuple[2]), parseInt(tuple[3])];\n\n\t\t\t\t\treader.readTuple(tuple);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tregion.originalWidth = parseInt(tuple[0]);\n\t\t\tregion.originalHeight = parseInt(tuple[1]);\n\n\t\t\treader.readTuple(tuple);\n\t\t\tregion.offsetX = parseInt(tuple[0]);\n\t\t\tregion.offsetY = parseInt(tuple[1]);\n\n\t\t\tregion.index = parseInt(reader.readValue());\n\n\t\t\tthis.regions.push(region);\n\t\t}\n\t}\n};\nspine.Atlas.prototype = {\n findRegion: function (name)\n {\n\t\tvar regions = this.regions;\n\t\tfor (var i = 0, n = regions.length; i < n; i++)\n\t\t\tif (regions[i].name == name) return regions[i];\n\t\treturn null;\n\t},\n dispose: function ()\n {\n\t\tvar pages = this.pages;\n\t\tfor (var i = 0, n = pages.length; i < n; i++)\n\t\t\tpages[i].rendererObject.destroy(true);\n\t},\n updateUVs: function (page)\n {\n\t\tvar regions = this.regions;\n for (var i = 0, n = regions.length; i < n; i++)\n {\n\t\t\tvar region = regions[i];\n\t\t\tif (region.page != page) continue;\n\t\t\tregion.u = region.x / page.width;\n\t\t\tregion.v = region.y / page.height;\n if (region.rotate)\n {\n\t\t\t\tregion.u2 = (region.x + region.height) / page.width;\n\t\t\t\tregion.v2 = (region.y + region.width) / page.height;\n\t\t\t} else {\n\t\t\t\tregion.u2 = (region.x + region.width) / page.width;\n\t\t\t\tregion.v2 = (region.y + region.height) / page.height;\n\t\t\t}\n\t\t}\n\t}\n};\n\nspine.Atlas.Format = {\n\talpha: 0,\n\tintensity: 1,\n\tluminanceAlpha: 2,\n\trgb565: 3,\n\trgba4444: 4,\n\trgb888: 5,\n\trgba8888: 6\n};\n\nspine.Atlas.TextureFilter = {\n\tnearest: 0,\n\tlinear: 1,\n\tmipMap: 2,\n\tmipMapNearestNearest: 3,\n\tmipMapLinearNearest: 4,\n\tmipMapNearestLinear: 5,\n\tmipMapLinearLinear: 6\n};\n\nspine.Atlas.TextureWrap = {\n\tmirroredRepeat: 0,\n\tclampToEdge: 1,\n\trepeat: 2\n};\n\nspine.AtlasPage = function ()\n{};\nspine.AtlasPage.prototype = {\n\tname: null,\n\tformat: null,\n\tminFilter: null,\n\tmagFilter: null,\n\tuWrap: null,\n\tvWrap: null,\n\trendererObject: null,\n\twidth: 0,\n\theight: 0\n};\n\nspine.AtlasRegion = function ()\n{};\nspine.AtlasRegion.prototype = {\n\tpage: null,\n\tname: null,\n\tx: 0, y: 0,\n\twidth: 0, height: 0,\n\tu: 0, v: 0, u2: 0, v2: 0,\n\toffsetX: 0, offsetY: 0,\n\toriginalWidth: 0, originalHeight: 0,\n\tindex: 0,\n\trotate: false,\n\tsplits: null,\n\tpads: null\n};\n\nspine.AtlasReader = function (text)\n{\n\tthis.lines = text.split(/\\r\\n|\\r|\\n/);\n};\nspine.AtlasReader.prototype = {\n\tindex: 0,\n trim: function (value)\n {\n\t\treturn value.replace(/^\\s+|\\s+$/g, \"\");\n\t},\n readLine: function ()\n {\n\t\tif (this.index >= this.lines.length) return null;\n\t\treturn this.lines[this.index++];\n\t},\n readValue: function ()\n {\n\t\tvar line = this.readLine();\n\t\tvar colon = line.indexOf(\":\");\n\t\tif (colon == -1) throw \"Invalid line: \" + line;\n\t\treturn this.trim(line.substring(colon + 1));\n\t},\n\t/** Returns the number of tuple values read (1, 2 or 4). */\n readTuple: function (tuple)\n {\n\t\tvar line = this.readLine();\n\t\tvar colon = line.indexOf(\":\");\n\t\tif (colon == -1) throw \"Invalid line: \" + line;\n\t\tvar i = 0, lastMatch = colon + 1;\n for (; i < 3; i++)\n {\n\t\t\tvar comma = line.indexOf(\",\", lastMatch);\n\t\t\tif (comma == -1) break;\n\t\t\ttuple[i] = this.trim(line.substr(lastMatch, comma - lastMatch));\n\t\t\tlastMatch = comma + 1;\n\t\t}\n\t\ttuple[i] = this.trim(line.substring(lastMatch));\n\t\treturn i + 1;\n\t}\n};\n\nspine.AtlasAttachmentParser = function (atlas)\n{\n\tthis.atlas = atlas;\n};\nspine.AtlasAttachmentParser.prototype = {\n newRegionAttachment: function (skin, name, path)\n {\n\t\tvar region = this.atlas.findRegion(path);\n\t\tif (!region) throw \"Region not found in atlas: \" + path + \" (region attachment: \" + name + \")\";\n\t\tvar attachment = new spine.RegionAttachment(name);\n\t\tattachment.rendererObject = region;\n\t\tattachment.setUVs(region.u, region.v, region.u2, region.v2, region.rotate);\n\t\tattachment.regionOffsetX = region.offsetX;\n\t\tattachment.regionOffsetY = region.offsetY;\n\t\tattachment.regionWidth = region.width;\n\t\tattachment.regionHeight = region.height;\n\t\tattachment.regionOriginalWidth = region.originalWidth;\n\t\tattachment.regionOriginalHeight = region.originalHeight;\n\t\treturn attachment;\n\t},\n newMeshAttachment: function (skin, name, path)\n {\n\t\tvar region = this.atlas.findRegion(path);\n\t\tif (!region) throw \"Region not found in atlas: \" + path + \" (mesh attachment: \" + name + \")\";\n\t\tvar attachment = new spine.MeshAttachment(name);\n\t\tattachment.rendererObject = region;\n\t\tattachment.regionU = region.u;\n\t\tattachment.regionV = region.v;\n\t\tattachment.regionU2 = region.u2;\n\t\tattachment.regionV2 = region.v2;\n\t\tattachment.regionRotate = region.rotate;\n\t\tattachment.regionOffsetX = region.offsetX;\n\t\tattachment.regionOffsetY = region.offsetY;\n\t\tattachment.regionWidth = region.width;\n\t\tattachment.regionHeight = region.height;\n\t\tattachment.regionOriginalWidth = region.originalWidth;\n\t\tattachment.regionOriginalHeight = region.originalHeight;\n\t\treturn attachment;\n\t},\n newSkinnedMeshAttachment: function (skin, name, path)\n {\n\t\tvar region = this.atlas.findRegion(path);\n\t\tif (!region) throw \"Region not found in atlas: \" + path + \" (skinned mesh attachment: \" + name + \")\";\n\t\tvar attachment = new spine.SkinnedMeshAttachment(name);\n\t\tattachment.rendererObject = region;\n\t\tattachment.regionU = region.u;\n\t\tattachment.regionV = region.v;\n\t\tattachment.regionU2 = region.u2;\n\t\tattachment.regionV2 = region.v2;\n\t\tattachment.regionRotate = region.rotate;\n\t\tattachment.regionOffsetX = region.offsetX;\n\t\tattachment.regionOffsetY = region.offsetY;\n\t\tattachment.regionWidth = region.width;\n\t\tattachment.regionHeight = region.height;\n\t\tattachment.regionOriginalWidth = region.originalWidth;\n\t\tattachment.regionOriginalHeight = region.originalHeight;\n\t\treturn attachment;\n\t},\n newBoundingBoxAttachment: function (skin, name)\n {\n\t\treturn new spine.BoundingBoxAttachment(name);\n\t}\n};\n\nspine.SkeletonBounds = function ()\n{\n\tthis.polygonPool = [];\n\tthis.polygons = [];\n\tthis.boundingBoxes = [];\n};\nspine.SkeletonBounds.prototype = {\n\tminX: 0, minY: 0, maxX: 0, maxY: 0,\n update: function (skeleton, updateAabb)\n {\n\t\tvar slots = skeleton.slots;\n\t\tvar slotCount = slots.length;\n\t\tvar x = skeleton.x, y = skeleton.y;\n\t\tvar boundingBoxes = this.boundingBoxes;\n\t\tvar polygonPool = this.polygonPool;\n\t\tvar polygons = this.polygons;\n\n\t\tboundingBoxes.length = 0;\n\t\tfor (var i = 0, n = polygons.length; i < n; i++)\n\t\t\tpolygonPool.push(polygons[i]);\n\t\tpolygons.length = 0;\n\n for (var i = 0; i < slotCount; i++)\n {\n\t\t\tvar slot = slots[i];\n\t\t\tvar boundingBox = slot.attachment;\n\t\t\tif (boundingBox.type != spine.AttachmentType.boundingbox) continue;\n\t\t\tboundingBoxes.push(boundingBox);\n\n\t\t\tvar poolCount = polygonPool.length, polygon;\n if (poolCount > 0)\n {\n\t\t\t\tpolygon = polygonPool[poolCount - 1];\n\t\t\t\tpolygonPool.splice(poolCount - 1, 1);\n\t\t\t} else\n\t\t\t\tpolygon = [];\n\t\t\tpolygons.push(polygon);\n\n\t\t\tpolygon.length = boundingBox.vertices.length;\n\t\t\tboundingBox.computeWorldVertices(x, y, slot.bone, polygon);\n\t\t}\n\n\t\tif (updateAabb) this.aabbCompute();\n\t},\n aabbCompute: function ()\n {\n\t\tvar polygons = this.polygons;\n\t\tvar minX = Number.MAX_VALUE, minY = Number.MAX_VALUE, maxX = Number.MIN_VALUE, maxY = Number.MIN_VALUE;\n for (var i = 0, n = polygons.length; i < n; i++)\n {\n\t\t\tvar vertices = polygons[i];\n for (var ii = 0, nn = vertices.length; ii < nn; ii += 2)\n {\n\t\t\t\tvar x = vertices[ii];\n\t\t\t\tvar y = vertices[ii + 1];\n\t\t\t\tminX = Math.min(minX, x);\n\t\t\t\tminY = Math.min(minY, y);\n\t\t\t\tmaxX = Math.max(maxX, x);\n\t\t\t\tmaxY = Math.max(maxY, y);\n\t\t\t}\n\t\t}\n\t\tthis.minX = minX;\n\t\tthis.minY = minY;\n\t\tthis.maxX = maxX;\n\t\tthis.maxY = maxY;\n\t},\n\t/** Returns true if the axis aligned bounding box contains the point. */\n aabbContainsPoint: function (x, y)\n {\n\t\treturn x >= this.minX && x <= this.maxX && y >= this.minY && y <= this.maxY;\n\t},\n\t/** Returns true if the axis aligned bounding box intersects the line segment. */\n aabbIntersectsSegment: function (x1, y1, x2, y2)\n {\n\t\tvar minX = this.minX, minY = this.minY, maxX = this.maxX, maxY = this.maxY;\n\t\tif ((x1 <= minX && x2 <= minX) || (y1 <= minY && y2 <= minY) || (x1 >= maxX && x2 >= maxX) || (y1 >= maxY && y2 >= maxY))\n\t\t\treturn false;\n\t\tvar m = (y2 - y1) / (x2 - x1);\n\t\tvar y = m * (minX - x1) + y1;\n\t\tif (y > minY && y < maxY) return true;\n\t\ty = m * (maxX - x1) + y1;\n\t\tif (y > minY && y < maxY) return true;\n\t\tvar x = (minY - y1) / m + x1;\n\t\tif (x > minX && x < maxX) return true;\n\t\tx = (maxY - y1) / m + x1;\n\t\tif (x > minX && x < maxX) return true;\n\t\treturn false;\n\t},\n\t/** Returns true if the axis aligned bounding box intersects the axis aligned bounding box of the specified bounds. */\n aabbIntersectsSkeleton: function (bounds)\n {\n\t\treturn this.minX < bounds.maxX && this.maxX > bounds.minX && this.minY < bounds.maxY && this.maxY > bounds.minY;\n\t},\n\t/** Returns the first bounding box attachment that contains the point, or null. When doing many checks, it is usually more\n\t * efficient to only call this method if {@link #aabbContainsPoint(float, float)} returns true. */\n containsPoint: function (x, y)\n {\n\t\tvar polygons = this.polygons;\n\t\tfor (var i = 0, n = polygons.length; i < n; i++)\n\t\t\tif (this.polygonContainsPoint(polygons[i], x, y)) return this.boundingBoxes[i];\n\t\treturn null;\n\t},\n\t/** Returns the first bounding box attachment that contains the line segment, or null. When doing many checks, it is usually\n\t * more efficient to only call this method if {@link #aabbIntersectsSegment(float, float, float, float)} returns true. */\n intersectsSegment: function (x1, y1, x2, y2)\n {\n\t\tvar polygons = this.polygons;\n\t\tfor (var i = 0, n = polygons.length; i < n; i++)\n\t\t\tif (polygons[i].intersectsSegment(x1, y1, x2, y2)) return this.boundingBoxes[i];\n\t\treturn null;\n\t},\n\t/** Returns true if the polygon contains the point. */\n polygonContainsPoint: function (polygon, x, y)\n {\n\t\tvar nn = polygon.length;\n\t\tvar prevIndex = nn - 2;\n\t\tvar inside = false;\n for (var ii = 0; ii < nn; ii += 2)\n {\n\t\t\tvar vertexY = polygon[ii + 1];\n\t\t\tvar prevY = polygon[prevIndex + 1];\n if ((vertexY < y && prevY >= y) || (prevY < y && vertexY >= y))\n {\n\t\t\t\tvar vertexX = polygon[ii];\n\t\t\t\tif (vertexX + (y - vertexY) / (prevY - vertexY) * (polygon[prevIndex] - vertexX) < x) inside = !inside;\n\t\t\t}\n\t\t\tprevIndex = ii;\n\t\t}\n\t\treturn inside;\n\t},\n\t/** Returns true if the polygon contains the line segment. */\n polygonIntersectsSegment: function (polygon, x1, y1, x2, y2)\n {\n\t\tvar nn = polygon.length;\n\t\tvar width12 = x1 - x2, height12 = y1 - y2;\n\t\tvar det1 = x1 * y2 - y1 * x2;\n\t\tvar x3 = polygon[nn - 2], y3 = polygon[nn - 1];\n for (var ii = 0; ii < nn; ii += 2)\n {\n\t\t\tvar x4 = polygon[ii], y4 = polygon[ii + 1];\n\t\t\tvar det2 = x3 * y4 - y3 * x4;\n\t\t\tvar width34 = x3 - x4, height34 = y3 - y4;\n\t\t\tvar det3 = width12 * height34 - height12 * width34;\n\t\t\tvar x = (det1 * width34 - width12 * det2) / det3;\n if (((x >= x3 && x <= x4) || (x >= x4 && x <= x3)) && ((x >= x1 && x <= x2) || (x >= x2 && x <= x1)))\n {\n\t\t\t\tvar y = (det1 * height34 - height12 * det2) / det3;\n\t\t\t\tif (((y >= y3 && y <= y4) || (y >= y4 && y <= y3)) && ((y >= y1 && y <= y2) || (y >= y2 && y <= y1))) return true;\n\t\t\t}\n\t\t\tx3 = x4;\n\t\t\ty3 = y4;\n\t\t}\n\t\treturn false;\n\t},\n getPolygon: function (attachment)\n {\n\t\tvar index = this.boundingBoxes.indexOf(attachment);\n\t\treturn index == -1 ? null : this.polygons[index];\n\t},\n getWidth: function ()\n {\n\t\treturn this.maxX - this.minX;\n\t},\n getHeight: function ()\n {\n\t\treturn this.maxY - this.minY;\n\t}\n};\n", "/**\n * @file Main export of the PIXI spine library\n * @author Mat Groves \n * @copyright 2013-2015 GoodBoyDigital\n * @license {@link https://github.com/GoodBoyDigital/pixi.js/blob/master/LICENSE|MIT License}\n */\n\n/**\n * @namespace PIXI.spine\n */\nmodule.exports = {\n Spine: require('./Spine'),\n SpineRuntime: require('./SpineRuntime')\n};\n", - "var core = require('../core');\n\n/**\n * A BitmapText object will create a line or multiple lines of text using bitmap font. To\n * split a line you can use '\\n', '\\r' or '\\r\\n' in your string. You can generate the fnt files using:\n *\n * A BitmapText can only be created when the font is loaded\n *\n * ```js\n * // in this case the font is in a file called 'desyrel.fnt'\n * var bitmapText = new PIXI.BitmapText(\"text using a fancy font!\", {font: \"35px Desyrel\", align: \"right\"});\n * ```\n *\n *\n * http://www.angelcode.com/products/bmfont/ for windows or\n * http://www.bmglyph.com/ for mac.\n *\n * @class\n * @extends Container\n * @memberof PIXI.text\n * @param text {string} The copy that you would like the text to display\n * @param style {object} The style parameters\n * @param style.font {string|object} The font descriptor for the object, can be passed as a string of form\n * \"24px FontName\" or \"FontName\" or as an object with explicit name/size properties.\n * @param [style.font.size] {number} The size of the font in pixels, e.g. 24\n * @param [style.font.name] {string} The bitmap font id\n * @param [style.align='left'] {string} Alignment for multiline text ('left', 'center' or 'right'), does not affect single line text\n */\nfunction BitmapText(text, style)\n{\n core.Container.call(this);\n\n /**\n * The width of the overall text, different from fontSize,\n * which is defined in the style object\n *\n * @member {number}\n * @readOnly\n */\n this.textWidth = 0;\n\n /**\n * The height of the overall text, different from fontSize,\n * which is defined in the style object\n *\n * @member {number}\n * @readOnly\n */\n this.textHeight = 0;\n\n /**\n * Private tracker for the letter sprite pool.\n *\n * @member {Sprite[]}\n * @private\n */\n this._glyphs = [];\n\n /**\n * Private tracker for the current style.\n *\n * @member {object}\n * @private\n */\n this._style = {\n tint: style.tint,\n align: style.align,\n fontName: null,\n fontSize: 0\n };\n\n /**\n * Private tracker for the current font.\n *\n * @member {object}\n * @private\n */\n this.font = style.font; // run font setter\n\n /**\n * Private tracker for the current text.\n *\n * @member {string}\n * @private\n */\n this._text = text;\n\n /**\n * The max width of this bitmap text in pixels. If the text provided is longer than the value provided, line breaks will be automatically inserted in the last whitespace.\n * Disable by setting value to 0\n *\n * @member {number}\n */\n this.maxWidth = 0;\n\n /**\n * The dirty state of this object.\n *\n * @member {boolean}\n */\n this.dirty = false;\n\n this.updateText();\n}\n\n// constructor\nBitmapText.prototype = Object.create(core.Container.prototype);\nBitmapText.prototype.constructor = BitmapText;\nmodule.exports = BitmapText;\n\nObject.defineProperties(BitmapText.prototype, {\n /**\n * The tint of the BitmapText object\n *\n * @member {number}\n * @memberof BitmapText#\n */\n tint: {\n get: function ()\n {\n return this._style.tint;\n },\n set: function (value)\n {\n this._style.tint = (typeof value === 'number' && value >= 0) ? value : 0xFFFFFF;\n\n this.dirty = true;\n }\n },\n\n /**\n * The alignment of the BitmapText object\n *\n * @member {string}\n * @default 'left'\n * @memberof BitmapText#\n */\n align: {\n get: function ()\n {\n return this._style.align;\n },\n set: function (value)\n {\n this._style.align = value;\n\n this.dirty = true;\n }\n },\n\n /**\n * The font descriptor of the BitmapText object\n *\n * @member {Font}\n * @memberof BitmapText#\n */\n font: {\n get: function ()\n {\n return this._style.font;\n },\n set: function (value)\n {\n if (typeof value === 'string') {\n value = value.split(' ');\n\n this._style.fontName = value.slice(1).join(' ');\n this._style.fontSize = value.length >= 2 ? parseInt(value[0], 10) : BitmapText.fonts[this.fontName].size;\n }\n else {\n this._style.fontName = value.name;\n this._style.fontSize = typeof value.size === 'number' ? value.size : parseInt(value.size, 10);\n }\n\n this.dirty = true;\n }\n },\n\n /**\n * The text of the BitmapText object\n *\n * @member {string}\n * @memberof BitmapText#\n */\n text: {\n get: function ()\n {\n return this._text;\n },\n set: function (value)\n {\n this._text = value;\n\n this.dirty = true;\n }\n }\n});\n\n/**\n * Renders text and updates it when needed\n *\n * @private\n */\nBitmapText.prototype.updateText = function ()\n{\n var data = BitmapText.fonts[this._style.fontName];\n var pos = new core.math.Point();\n var prevCharCode = null;\n var chars = [];\n var lastLineWidth = 0;\n var maxLineWidth = 0;\n var lineWidths = [];\n var line = 0;\n var scale = this._style.fontSize / data.size;\n var lastSpace = -1;\n\n for (var i = 0; i < this.text.length; i++)\n {\n var charCode = this.text.charCodeAt(i);\n lastSpace = /(\\s)/.test(this.text.charAt(i)) ? i : lastSpace;\n\n if (/(?:\\r\\n|\\r|\\n)/.test(this.text.charAt(i)))\n {\n lineWidths.push(lastLineWidth);\n maxLineWidth = Math.max(maxLineWidth, lastLineWidth);\n line++;\n\n pos.x = 0;\n pos.y += data.lineHeight;\n prevCharCode = null;\n continue;\n }\n\n if (lastSpace !== -1 && this.maxWidth > 0 && pos.x * scale > this.maxWidth)\n {\n chars.splice(lastSpace, i - lastSpace);\n i = lastSpace;\n lastSpace = -1;\n\n lineWidths.push(lastLineWidth);\n maxLineWidth = Math.max(maxLineWidth, lastLineWidth);\n line++;\n\n pos.x = 0;\n pos.y += data.lineHeight;\n prevCharCode = null;\n continue;\n }\n\n var charData = data.chars[charCode];\n\n if (!charData)\n {\n continue;\n }\n\n if (prevCharCode && charData.kerning[prevCharCode])\n {\n pos.x += charData.kerning[prevCharCode];\n }\n\n chars.push({texture:charData.texture, line: line, charCode: charCode, position: new core.math.Point(pos.x + charData.xOffset, pos.y + charData.yOffset)});\n lastLineWidth = pos.x + (charData.texture.width + charData.xOffset);\n pos.x += charData.xAdvance;\n\n prevCharCode = charCode;\n }\n\n lineWidths.push(lastLineWidth);\n maxLineWidth = Math.max(maxLineWidth, lastLineWidth);\n\n var lineAlignOffsets = [];\n\n for (i = 0; i <= line; i++)\n {\n var alignOffset = 0;\n\n if (this._style.align === 'right')\n {\n alignOffset = maxLineWidth - lineWidths[i];\n }\n else if (this._style.align === 'center')\n {\n alignOffset = (maxLineWidth - lineWidths[i]) / 2;\n }\n\n lineAlignOffsets.push(alignOffset);\n }\n\n var lenChars = chars.length;\n var tint = this.tint;\n\n for (i = 0; i < lenChars; i++)\n {\n var c = this._glyphs[i]; // get the next glyph sprite\n\n if (c)\n {\n c.texture = chars[i].texture;\n }\n else\n {\n c = new core.Sprite(chars[i].texture);\n this._glyphs.push(c);\n }\n\n c.position.x = (chars[i].position.x + lineAlignOffsets[chars[i].line]) * scale;\n c.position.y = chars[i].position.y * scale;\n c.scale.x = c.scale.y = scale;\n c.tint = tint;\n\n if (!c.parent)\n {\n this.addChild(c);\n }\n }\n\n // remove unnecessary children.\n for (i = lenChars; i < this._glyphs.length; ++i)\n {\n this.removeChild(this._glyphs[i]);\n }\n\n this.textWidth = maxLineWidth * scale;\n this.textHeight = (pos.y + data.lineHeight) * scale;\n};\n\n/**\n * Updates the transform of this object\n *\n * @private\n */\nBitmapText.prototype.updateTransform = function ()\n{\n if (this.dirty)\n {\n this.updateText();\n this.dirty = false;\n }\n\n this.containerUpdateTransform();\n};\n\nBitmapText.fonts = {};\n", + "var core = require('../core');\n\n/**\n * A BitmapText object will create a line or multiple lines of text using bitmap font. To\n * split a line you can use '\\n', '\\r' or '\\r\\n' in your string. You can generate the fnt files using:\n *\n * A BitmapText can only be created when the font is loaded\n *\n * ```js\n * // in this case the font is in a file called 'desyrel.fnt'\n * var bitmapText = new PIXI.BitmapText(\"text using a fancy font!\", {font: \"35px Desyrel\", align: \"right\"});\n * ```\n *\n *\n * http://www.angelcode.com/products/bmfont/ for windows or\n * http://www.bmglyph.com/ for mac.\n *\n * @class\n * @extends Container\n * @memberof PIXI.text\n * @param text {string} The copy that you would like the text to display\n * @param style {object} The style parameters\n * @param style.font {string|object} The font descriptor for the object, can be passed as a string of form\n * \"24px FontName\" or \"FontName\" or as an object with explicit name/size properties.\n * @param [style.font.size] {number} The size of the font in pixels, e.g. 24\n * @param [style.font.name] {string} The bitmap font id\n * @param [style.align='left'] {string} Alignment for multiline text ('left', 'center' or 'right'), does not affect single line text\n */\nfunction BitmapText(text, style)\n{\n core.Container.call(this);\n\n /**\n * The width of the overall text, different from fontSize,\n * which is defined in the style object\n *\n * @member {number}\n * @readOnly\n */\n this.textWidth = 0;\n\n /**\n * The height of the overall text, different from fontSize,\n * which is defined in the style object\n *\n * @member {number}\n * @readOnly\n */\n this.textHeight = 0;\n\n /**\n * Private tracker for the letter sprite pool.\n *\n * @member {Sprite[]}\n * @private\n */\n this._glyphs = [];\n\n /**\n * Private tracker for the current style.\n *\n * @member {object}\n * @private\n */\n this._font = {\n tint: style.tint,\n align: style.align,\n name: null,\n size: 0\n };\n\n /**\n * Private tracker for the current font.\n *\n * @member {object}\n * @private\n */\n this.font = style.font; // run font setter\n\n /**\n * Private tracker for the current text.\n *\n * @member {string}\n * @private\n */\n this._text = text;\n\n /**\n * The max width of this bitmap text in pixels. If the text provided is longer than the value provided, line breaks will be automatically inserted in the last whitespace.\n * Disable by setting value to 0\n *\n * @member {number}\n */\n this.maxWidth = 0;\n\n /**\n * The dirty state of this object.\n *\n * @member {boolean}\n */\n this.dirty = false;\n\n this.updateText();\n}\n\n// constructor\nBitmapText.prototype = Object.create(core.Container.prototype);\nBitmapText.prototype.constructor = BitmapText;\nmodule.exports = BitmapText;\n\nObject.defineProperties(BitmapText.prototype, {\n /**\n * The tint of the BitmapText object\n *\n * @member {number}\n * @memberof BitmapText#\n */\n tint: {\n get: function ()\n {\n return this._font.tint;\n },\n set: function (value)\n {\n this._font.tint = (typeof value === 'number' && value >= 0) ? value : 0xFFFFFF;\n\n this.dirty = true;\n }\n },\n\n /**\n * The alignment of the BitmapText object\n *\n * @member {string}\n * @default 'left'\n * @memberof BitmapText#\n */\n align: {\n get: function ()\n {\n return this._font.align;\n },\n set: function (value)\n {\n this._font.align = value;\n\n this.dirty = true;\n }\n },\n\n /**\n * The font descriptor of the BitmapText object\n *\n * @member {Font}\n * @memberof BitmapText#\n */\n font: {\n get: function ()\n {\n return this._font;\n },\n set: function (value)\n {\n if (typeof value === 'string') {\n value = value.split(' ');\n\n this._font.name = value.length === 1 ? value[0] : value.slice(1).join(' ');\n this._font.size = value.length >= 2 ? parseInt(value[0], 10) : BitmapText.fonts[this._font.name].size;\n }\n else {\n this._font.name = value.name;\n this._font.size = typeof value.size === 'number' ? value.size : parseInt(value.size, 10);\n }\n\n this.dirty = true;\n }\n },\n\n /**\n * The text of the BitmapText object\n *\n * @member {string}\n * @memberof BitmapText#\n */\n text: {\n get: function ()\n {\n return this._text;\n },\n set: function (value)\n {\n this._text = value;\n\n this.dirty = true;\n }\n }\n});\n\n/**\n * Renders text and updates it when needed\n *\n * @private\n */\nBitmapText.prototype.updateText = function ()\n{\n var data = BitmapText.fonts[this._font.name];\n var pos = new core.math.Point();\n var prevCharCode = null;\n var chars = [];\n var lastLineWidth = 0;\n var maxLineWidth = 0;\n var lineWidths = [];\n var line = 0;\n var scale = this._font.size / data.size;\n var lastSpace = -1;\n\n for (var i = 0; i < this.text.length; i++)\n {\n var charCode = this.text.charCodeAt(i);\n lastSpace = /(\\s)/.test(this.text.charAt(i)) ? i : lastSpace;\n\n if (/(?:\\r\\n|\\r|\\n)/.test(this.text.charAt(i)))\n {\n lineWidths.push(lastLineWidth);\n maxLineWidth = Math.max(maxLineWidth, lastLineWidth);\n line++;\n\n pos.x = 0;\n pos.y += data.lineHeight;\n prevCharCode = null;\n continue;\n }\n\n if (lastSpace !== -1 && this.maxWidth > 0 && pos.x * scale > this.maxWidth)\n {\n chars.splice(lastSpace, i - lastSpace);\n i = lastSpace;\n lastSpace = -1;\n\n lineWidths.push(lastLineWidth);\n maxLineWidth = Math.max(maxLineWidth, lastLineWidth);\n line++;\n\n pos.x = 0;\n pos.y += data.lineHeight;\n prevCharCode = null;\n continue;\n }\n\n var charData = data.chars[charCode];\n\n if (!charData)\n {\n continue;\n }\n\n if (prevCharCode && charData.kerning[prevCharCode])\n {\n pos.x += charData.kerning[prevCharCode];\n }\n\n chars.push({texture:charData.texture, line: line, charCode: charCode, position: new core.math.Point(pos.x + charData.xOffset, pos.y + charData.yOffset)});\n lastLineWidth = pos.x + (charData.texture.width + charData.xOffset);\n pos.x += charData.xAdvance;\n\n prevCharCode = charCode;\n }\n\n lineWidths.push(lastLineWidth);\n maxLineWidth = Math.max(maxLineWidth, lastLineWidth);\n\n var lineAlignOffsets = [];\n\n for (i = 0; i <= line; i++)\n {\n var alignOffset = 0;\n\n if (this._font.align === 'right')\n {\n alignOffset = maxLineWidth - lineWidths[i];\n }\n else if (this._font.align === 'center')\n {\n alignOffset = (maxLineWidth - lineWidths[i]) / 2;\n }\n\n lineAlignOffsets.push(alignOffset);\n }\n\n var lenChars = chars.length;\n var tint = this.tint;\n\n for (i = 0; i < lenChars; i++)\n {\n var c = this._glyphs[i]; // get the next glyph sprite\n\n if (c)\n {\n c.texture = chars[i].texture;\n }\n else\n {\n c = new core.Sprite(chars[i].texture);\n this._glyphs.push(c);\n }\n\n c.position.x = (chars[i].position.x + lineAlignOffsets[chars[i].line]) * scale;\n c.position.y = chars[i].position.y * scale;\n c.scale.x = c.scale.y = scale;\n c.tint = tint;\n\n if (!c.parent)\n {\n this.addChild(c);\n }\n }\n\n // remove unnecessary children.\n for (i = lenChars; i < this._glyphs.length; ++i)\n {\n this.removeChild(this._glyphs[i]);\n }\n\n this.textWidth = maxLineWidth * scale;\n this.textHeight = (pos.y + data.lineHeight) * scale;\n};\n\n/**\n * Updates the transform of this object\n *\n * @private\n */\nBitmapText.prototype.updateTransform = function ()\n{\n if (this.dirty)\n {\n this.updateText();\n this.dirty = false;\n }\n\n this.containerUpdateTransform();\n};\n\nBitmapText.fonts = {};\n", "var core = require('../core');\n\n/**\n * A Text Object will create a line or multiple lines of text. To split a line you can use '\\n' in your text string,\n * or add a wordWrap property set to true and and wordWrapWidth property with a value in the style object.\n *\n * A Text can be created directly from a string and a style object\n *\n * ```js\n * var text = new PIXI.Text('This is a pixi text',{font : '24px Arial', fill : 0xff1010, align : 'center'});\n * ```\n *\n * @class\n * @extends Sprite\n * @memberof PIXI.text\n * @param text {string} The copy that you would like the text to display\n * @param [style] {object} The style parameters\n * @param [style.font] {string} default 'bold 20px Arial' The style and size of the font\n * @param [style.fill='black'] {String|Number} A canvas fillstyle that will be used on the text e.g 'red', '#00FF00'\n * @param [style.align='left'] {string} Alignment for multiline text ('left', 'center' or 'right'), does not affect single line text\n * @param [style.stroke] {String|Number} A canvas fillstyle that will be used on the text stroke e.g 'blue', '#FCFF00'\n * @param [style.strokeThickness=0] {number} A number that represents the thickness of the stroke. Default is 0 (no stroke)\n * @param [style.wordWrap=false] {boolean} Indicates if word wrap should be used\n * @param [style.wordWrapWidth=100] {number} The width at which text will wrap, it needs wordWrap to be set to true\n * @param [style.lineHeight] {number} The line height, a number that represents the vertical space that a letter uses\n * @param [style.dropShadow=false] {boolean} Set a drop shadow for the text\n * @param [style.dropShadowColor='#000000'] {string} A fill style to be used on the dropshadow e.g 'red', '#00FF00'\n * @param [style.dropShadowAngle=Math.PI/4] {number} Set a angle of the drop shadow\n * @param [style.dropShadowDistance=5] {number} Set a distance of the drop shadow\n * @param [style.padding=0] {number} Occasionally some fonts are cropped. Adding some padding will prevent this from happening\n */\nfunction Text(text, style, resolution)\n{\n /**\n * The canvas element that everything is drawn to\n *\n * @member {HTMLCanvasElement}\n */\n this.canvas = document.createElement('canvas');\n\n /**\n * The canvas 2d context that everything is drawn with\n * @member {HTMLCanvasElement}\n */\n this.context = this.canvas.getContext('2d');\n\n /**\n * The resolution of the canvas.\n * @member {number}\n */\n this.resolution = resolution || core.RESOLUTION;\n\n /**\n * Private tracker for the current text.\n *\n * @member {string}\n * @private\n */\n this._text = null;\n\n /**\n * Private tracker for the current style.\n *\n * @member {object}\n * @private\n */\n this._style = null;\n\n var texture = core.Texture.fromCanvas(this.canvas);\n texture.trim = new core.math.Rectangle();\n core.Sprite.call(this, texture);\n\n\n this.text = text;\n this.style = style;\n}\n\n// constructor\nText.prototype = Object.create(core.Sprite.prototype);\nText.prototype.constructor = Text;\nmodule.exports = Text;\n\nText.fontPropertiesCache = {};\nText.fontPropertiesCanvas = document.createElement('canvas');\nText.fontPropertiesContext = Text.fontPropertiesCanvas.getContext('2d');\n\nObject.defineProperties(Text.prototype, {\n /**\n * The width of the Text, setting this will actually modify the scale to achieve the value set\n *\n * @member {number}\n * @memberof Text#\n */\n width: {\n get: function ()\n {\n if (this.dirty)\n {\n this.updateText();\n }\n\n return this.scale.x * this._texture._frame.width;\n },\n set: function (value)\n {\n this.scale.x = value / this._texture._frame.width;\n this._width = value;\n }\n },\n\n /**\n * The height of the Text, setting this will actually modify the scale to achieve the value set\n *\n * @member {number}\n * @memberof Text#\n */\n height: {\n get: function ()\n {\n if (this.dirty)\n {\n this.updateText();\n }\n\n return this.scale.y * this._texture._frame.height;\n },\n set: function (value)\n {\n this.scale.y = value / this._texture._frame.height;\n this._height = value;\n }\n },\n\n /**\n * Set the style of the text\n *\n * @param [style] {object} The style parameters\n * @param [style.font='bold 20pt Arial'] {string} The style and size of the font\n * @param [style.fill='black'] {object} A canvas fillstyle that will be used on the text eg 'red', '#00FF00'\n * @param [style.align='left'] {string} Alignment for multiline text ('left', 'center' or 'right'), does not affect single line text\n * @param [style.stroke='black'] {string} A canvas fillstyle that will be used on the text stroke eg 'blue', '#FCFF00'\n * @param [style.strokeThickness=0] {number} A number that represents the thickness of the stroke. Default is 0 (no stroke)\n * @param [style.wordWrap=false] {boolean} Indicates if word wrap should be used\n * @param [style.wordWrapWidth=100] {number} The width at which text will wrap\n * @param [style.lineHeight] {number} The line height, a number that represents the vertical space that a letter uses\n * @param [style.dropShadow=false] {boolean} Set a drop shadow for the text\n * @param [style.dropShadowColor='#000000'] {string} A fill style to be used on the dropshadow e.g 'red', '#00FF00'\n * @param [style.dropShadowAngle=Math.PI/6] {number} Set a angle of the drop shadow\n * @param [style.dropShadowDistance=5] {number} Set a distance of the drop shadow\n * @param [style.padding=0] {number} Occasionally some fonts are cropped. Adding some padding will prevent this from happening\n * @memberof Text#\n */\n style: {\n get: function ()\n {\n return this._style;\n },\n set: function (style)\n {\n style = style || {};\n style.font = style.font || 'bold 20pt Arial';\n style.fill = style.fill || 'black';\n style.align = style.align || 'left';\n style.stroke = style.stroke || 'black'; //provide a default, see: https://github.com/GoodBoyDigital/pixi.js/issues/136\n style.strokeThickness = style.strokeThickness || 0;\n style.wordWrap = style.wordWrap || false;\n style.wordWrapWidth = style.wordWrapWidth || 100;\n\n style.dropShadow = style.dropShadow || false;\n style.dropShadowColor = style.dropShadowColor || '#000000';\n style.dropShadowAngle = style.dropShadowAngle || Math.PI / 6;\n style.dropShadowDistance = style.dropShadowDistance || 5;\n\n style.padding = style.padding || 0;\n\n this._style = style;\n this.dirty = true;\n }\n },\n\n /**\n * Set the copy for the text object. To split a line you can use '\\n'.\n *\n * @param text {string} The copy that you would like the text to display\n * @memberof Text#\n */\n text: {\n get: function()\n {\n return this._text;\n },\n set: function (text){\n text = text.toString() || ' ';\n if (this._text === text)\n {\n return;\n }\n this._text = text;\n this.dirty = true;\n }\n }\n});\n\n/**\n * Renders text and updates it when needed\n *\n * @private\n */\nText.prototype.updateText = function ()\n{\n var style = this._style;\n this.context.font = style.font;\n\n // word wrap\n // preserve original text\n var outputText = style.wordWrap ? this.wordWrap(this._text) : this._text;\n\n // split text into lines\n var lines = outputText.split(/(?:\\r\\n|\\r|\\n)/);\n\n // calculate text width\n var lineWidths = new Array(lines.length);\n var maxLineWidth = 0;\n var fontProperties = this.determineFontProperties(style.font);\n for (var i = 0; i < lines.length; i++)\n {\n var lineWidth = this.context.measureText(lines[i]).width;\n lineWidths[i] = lineWidth;\n maxLineWidth = Math.max(maxLineWidth, lineWidth);\n }\n\n var width = maxLineWidth + style.strokeThickness;\n if (style.dropShadow)\n {\n width += style.dropShadowDistance;\n }\n\n this.canvas.width = ( width + this.context.lineWidth ) * this.resolution;\n\n // calculate text height\n var lineHeight = this.style.lineHeight || fontProperties.fontSize + style.strokeThickness;\n\n var height = lineHeight * lines.length;\n if (style.dropShadow)\n {\n height += style.dropShadowDistance;\n }\n\n this.canvas.height = ( height + this._style.padding * 2 ) * this.resolution;\n\n this.context.scale( this.resolution, this.resolution);\n\n if (navigator.isCocoonJS)\n {\n this.context.clearRect(0, 0, this.canvas.width, this.canvas.height);\n\n }\n\n //this.context.fillStyle=\"#FF0000\";\n //this.context.fillRect(0, 0, this.canvas.width, this.canvas.height);\n\n this.context.font = style.font;\n this.context.strokeStyle = style.stroke;\n this.context.lineWidth = style.strokeThickness;\n this.context.textBaseline = 'alphabetic';\n //this.context.lineJoin = 'round';\n\n var linePositionX;\n var linePositionY;\n\n if (style.dropShadow)\n {\n this.context.fillStyle = style.dropShadowColor;\n\n var xShadowOffset = Math.cos(style.dropShadowAngle) * style.dropShadowDistance;\n var yShadowOffset = Math.sin(style.dropShadowAngle) * style.dropShadowDistance;\n\n for (i = 0; i < lines.length; i++)\n {\n linePositionX = style.strokeThickness / 2;\n linePositionY = (style.strokeThickness / 2 + i * lineHeight) + fontProperties.ascent;\n\n if (style.align === 'right')\n {\n linePositionX += maxLineWidth - lineWidths[i];\n }\n else if (style.align === 'center')\n {\n linePositionX += (maxLineWidth - lineWidths[i]) / 2;\n }\n\n if (style.fill)\n {\n this.context.fillText(lines[i], linePositionX + xShadowOffset, linePositionY + yShadowOffset + this._style.padding);\n }\n }\n }\n\n //set canvas text styles\n this.context.fillStyle = style.fill;\n\n //draw lines line by line\n for (i = 0; i < lines.length; i++)\n {\n linePositionX = style.strokeThickness / 2;\n linePositionY = (style.strokeThickness / 2 + i * lineHeight) + fontProperties.ascent;\n\n if (style.align === 'right')\n {\n linePositionX += maxLineWidth - lineWidths[i];\n }\n else if (style.align === 'center')\n {\n linePositionX += (maxLineWidth - lineWidths[i]) / 2;\n }\n\n if (style.stroke && style.strokeThickness)\n {\n this.context.strokeText(lines[i], linePositionX, linePositionY + this._style.padding);\n }\n\n if (style.fill)\n {\n this.context.fillText(lines[i], linePositionX, linePositionY + this._style.padding);\n }\n }\n\n this.updateTexture();\n};\n\n/**\n * Updates texture size based on canvas size\n *\n * @private\n */\nText.prototype.updateTexture = function ()\n{\n var texture = this._texture;\n\n texture.baseTexture.hasLoaded = true;\n texture.baseTexture.resolution = this.resolution;\n\n texture.baseTexture.width = this.canvas.width / this.resolution;\n texture.baseTexture.height = this.canvas.height / this.resolution;\n texture.crop.width = texture._frame.width = this.canvas.width / this.resolution;\n texture.crop.height = texture._frame.height = this.canvas.height / this.resolution;\n\n texture.trim.x = 0;\n texture.trim.y = -this._style.padding;\n\n texture.trim.width = texture._frame.width;\n texture.trim.height = texture._frame.height - this._style.padding*2;\n\n this._width = this.canvas.width / this.resolution;\n this._height = this.canvas.height / this.resolution;\n\n texture.update();\n\n this.dirty = false;\n};\n\n/**\n * Renders the object using the WebGL renderer\n *\n * @param renderer {WebGLRenderer}\n */\nText.prototype.renderWebGL = function (renderer)\n{\n if (this.dirty)\n {\n //this.resolution = 1//renderer.resolution;\n\n this.updateText();\n }\n\n core.Sprite.prototype.renderWebGL.call(this, renderer);\n};\n\n/**\n * Renders the object using the Canvas renderer\n *\n * @param renderer {CanvasRenderer}\n */\nText.prototype._renderCanvas = function (renderer)\n{\n if (this.dirty)\n {\n // this.resolution = 1//renderer.resolution;\n\n this.updateText();\n }\n\n core.Sprite.prototype._renderCanvas.call(this, renderer);\n};\n\n/**\n * Calculates the ascent, descent and fontSize of a given fontStyle\n *\n * @param fontStyle {object}\n * @private\n */\nText.prototype.determineFontProperties = function (fontStyle)\n{\n var properties = Text.fontPropertiesCache[fontStyle];\n\n if (!properties)\n {\n properties = {};\n\n var canvas = Text.fontPropertiesCanvas;\n var context = Text.fontPropertiesContext;\n\n context.font = fontStyle;\n\n var width = Math.ceil(context.measureText('|MÉq').width);\n var baseline = Math.ceil(context.measureText('M').width);\n var height = 2 * baseline;\n\n baseline = baseline * 1.4 | 0;\n\n canvas.width = width;\n canvas.height = height;\n\n context.fillStyle = '#f00';\n context.fillRect(0, 0, width, height);\n\n context.font = fontStyle;\n\n context.textBaseline = 'alphabetic';\n context.fillStyle = '#000';\n context.fillText('|MÉq', 0, baseline);\n\n var imagedata = context.getImageData(0, 0, width, height).data;\n var pixels = imagedata.length;\n var line = width * 4;\n\n var i, j;\n\n var idx = 0;\n var stop = false;\n\n // ascent. scan from top to bottom until we find a non red pixel\n for (i = 0; i < baseline; i++)\n {\n for (j = 0; j < line; j += 4)\n {\n if (imagedata[idx + j] !== 255)\n {\n stop = true;\n break;\n }\n }\n if (!stop)\n {\n idx += line;\n }\n else\n {\n break;\n }\n }\n\n properties.ascent = baseline - i;\n\n idx = pixels - line;\n stop = false;\n\n // descent. scan from bottom to top until we find a non red pixel\n for (i = height; i > baseline; i--)\n {\n for (j = 0; j < line; j += 4)\n {\n if (imagedata[idx + j] !== 255)\n {\n stop = true;\n break;\n }\n }\n if (!stop)\n {\n idx -= line;\n }\n else\n {\n break;\n }\n }\n\n properties.descent = i - baseline;\n properties.fontSize = properties.ascent + properties.descent;\n\n Text.fontPropertiesCache[fontStyle] = properties;\n }\n\n return properties;\n};\n\n/**\n * Applies newlines to a string to have it optimally fit into the horizontal\n * bounds set by the Text object's wordWrapWidth property.\n *\n * @param text {string}\n * @private\n */\nText.prototype.wordWrap = function (text)\n{\n // Greedy wrapping algorithm that will wrap words as the line grows longer\n // than its horizontal bounds.\n var result = '';\n var lines = text.split('\\n');\n var wordWrapWidth = this._style.wordWrapWidth;\n for (var i = 0; i < lines.length; i++)\n {\n var spaceLeft = wordWrapWidth;\n var words = lines[i].split(' ');\n for (var j = 0; j < words.length; j++)\n {\n var wordWidth = this.context.measureText(words[j]).width;\n var wordWidthWithSpace = wordWidth + this.context.measureText(' ').width;\n if (j === 0 || wordWidthWithSpace > spaceLeft)\n {\n // Skip printing the newline if it's the first word of the line that is\n // greater than the word wrap width.\n if (j > 0)\n {\n result += '\\n';\n }\n result += words[j];\n spaceLeft = wordWrapWidth - wordWidth;\n }\n else\n {\n spaceLeft -= wordWidthWithSpace;\n result += ' ' + words[j];\n }\n }\n\n if (i < lines.length-1)\n {\n result += '\\n';\n }\n }\n return result;\n};\n\n/**\n * Returns the bounds of the Text as a rectangle. The bounds calculation takes the worldTransform into account.\n *\n * @param matrix {Matrix} the transformation matrix of the Text\n * @return {Rectangle} the framing rectangle\n */\nText.prototype.getBounds = function (matrix)\n{\n if (this.dirty)\n {\n this.updateText();\n }\n\n return core.Sprite.prototype.getBounds.call(this, matrix);\n};\n\n/**\n * Destroys this text object.\n *\n * @param destroyBaseTexture {boolean} whether to destroy the base texture as well\n */\nText.prototype.destroy = function (destroyBaseTexture)\n{\n // make sure to reset the the context and canvas.. dont want this hanging around in memory!\n this.context = null;\n this.canvas = null;\n\n this._texture.destroy(destroyBaseTexture === undefined ? true : destroyBaseTexture);\n};\n", "/**\n * @file Main export of the PIXI text library\n * @author Mat Groves \n * @copyright 2013-2015 GoodBoyDigital\n * @license {@link https://github.com/GoodBoyDigital/pixi.js/blob/master/LICENSE|MIT License}\n */\n\n/**\n * @namespace PIXI.text\n */\nmodule.exports = {\n Text: require('./Text'),\n BitmapText: require('./BitmapText')\n};\n", "var core = require('./core');\n\nextendCore(require('./extras'));\nextendCore(require('./filters'));\nextendCore(require('./interaction'));\nextendCore(require('./loaders'));\nextendCore(require('./spine'));\nextendCore(require('./text'));\nextendCore(require('./deprecation'));\n\nfunction extendCore(obj)\n{\n for(var key in obj)\n {\n core[key] = obj[key];\n }\n}\n\nmodule.exports = core;\n" diff --git a/bin/pixi.js b/bin/pixi.js index 0416880..98629ca 100644 --- a/bin/pixi.js +++ b/bin/pixi.js @@ -21994,7 +21994,7 @@ return next(); } - var textureUrl = this.baseUrl + resource.data.getElementsByTagName('page')[0].getAttribute('file'); + var textureUrl = resource.data.getElementsByTagName('page')[0].getAttribute('file'); var loadOptions = { crossOrigin: resource.crossOrigin, loadType: Resource.LOAD_TYPE.IMAGE @@ -22216,7 +22216,7 @@ var resolution = core.utils.getResolutionOfUrl( resource.url ); // load the image for this sheet - this.add(resource.name + '_image', this.baseUrl + route + '/' + resource.data.meta.image, loadOptions, function (res) + this.add(resource.name + '_image', route + '/' + resource.data.meta.image, loadOptions, function (res) { resource.textures = {}; @@ -25651,11 +25651,11 @@ * @member {object} * @private */ - this._style = { + this._font = { tint: style.tint, align: style.align, - fontName: null, - fontSize: 0 + name: null, + size: 0 }; /** @@ -25707,11 +25707,11 @@ tint: { get: function () { - return this._style.tint; + return this._font.tint; }, set: function (value) { - this._style.tint = (typeof value === 'number' && value >= 0) ? value : 0xFFFFFF; + this._font.tint = (typeof value === 'number' && value >= 0) ? value : 0xFFFFFF; this.dirty = true; } @@ -25727,11 +25727,11 @@ align: { get: function () { - return this._style.align; + return this._font.align; }, set: function (value) { - this._style.align = value; + this._font.align = value; this.dirty = true; } @@ -25746,19 +25746,19 @@ font: { get: function () { - return this._style.font; + return this._font; }, set: function (value) { if (typeof value === 'string') { value = value.split(' '); - this._style.fontName = value.slice(1).join(' '); - this._style.fontSize = value.length >= 2 ? parseInt(value[0], 10) : BitmapText.fonts[this.fontName].size; + this._font.name = value.length === 1 ? value[0] : value.slice(1).join(' '); + this._font.size = value.length >= 2 ? parseInt(value[0], 10) : BitmapText.fonts[this._font.name].size; } else { - this._style.fontName = value.name; - this._style.fontSize = typeof value.size === 'number' ? value.size : parseInt(value.size, 10); + this._font.name = value.name; + this._font.size = typeof value.size === 'number' ? value.size : parseInt(value.size, 10); } this.dirty = true; @@ -25792,7 +25792,7 @@ */ BitmapText.prototype.updateText = function () { - var data = BitmapText.fonts[this._style.fontName]; + var data = BitmapText.fonts[this._font.name]; var pos = new core.math.Point(); var prevCharCode = null; var chars = []; @@ -25800,7 +25800,7 @@ var maxLineWidth = 0; var lineWidths = []; var line = 0; - var scale = this._style.fontSize / data.size; + var scale = this._font.size / data.size; var lastSpace = -1; for (var i = 0; i < this.text.length; i++) @@ -25864,11 +25864,11 @@ { var alignOffset = 0; - if (this._style.align === 'right') + if (this._font.align === 'right') { alignOffset = maxLineWidth - lineWidths[i]; } - else if (this._style.align === 'center') + else if (this._font.align === 'center') { alignOffset = (maxLineWidth - lineWidths[i]) / 2; } diff --git a/bin/pixi.js.map b/bin/pixi.js.map index 45af07e..4a5fb04 100644 --- a/bin/pixi.js.map +++ b/bin/pixi.js.map @@ -246,16 +246,16 @@ "var core = require('../core'),\n InteractionData = require('./InteractionData');\n\n\n// TODO: Obviously rewrite this...\nvar INTERACTION_FREQUENCY = 10;\nvar AUTO_PREVENT_DEFAULT = true;\n\n/**\n * The interaction manager deals with mouse and touch events. Any DisplayObject can be interactive\n * if its interactive parameter is set to true\n * This manager also supports multitouch.\n *\n * @class\n * @memberof PIXI.interaction\n * @param renderer {CanvasRenderer|WebGLRenderer} A reference to the current renderer\n */\nfunction InteractionManager( renderer )\n{\n this.renderer = renderer;\n\n /**\n * The mouse data\n *\n * @member {InteractionData}\n */\n this.mouse = new InteractionData();\n\n /**\n * An event data object to handle all the event tracking/dispatching\n *\n * @member {EventData}\n */\n this.eventData = new core.utils.EventData();\n this.eventData.data = this.mouse;\n\n /**\n * Tiny little interactiveData pool !\n *\n * @member {Array}\n */\n this.interactiveDataPool = [];\n\n /**\n * The DOM element to bind to.\n *\n * @member {HTMLElement}\n * @private\n */\n this.interactionDOMElement = null;\n\n /**\n * Have events been attached to the dom element?\n *\n * @member {boolean}\n * @private\n */\n this.eventsAdded = false;\n\n //this will make it so that you don't have to call bind all the time\n\n /**\n * @member {Function}\n */\n this.onMouseUp = this.onMouseUp.bind(this);\n this.processMouseUp = this.processMouseUp.bind( this );\n\n\n /**\n * @member {Function}\n */\n this.onMouseDown = this.onMouseDown.bind(this);\n this.processMouseDown = this.processMouseDown.bind( this );\n\n /**\n * @member {Function}\n */\n this.onMouseMove = this.onMouseMove.bind( this );\n this.processMouseMove = this.processMouseMove.bind( this );\n\n /**\n * @member {Function}\n */\n this.onMouseOut = this.onMouseOut.bind(this);\n this.processMouseOverOut = this.processMouseOverOut.bind( this );\n\n\n /**\n * @member {Function}\n */\n this.onTouchStart = this.onTouchStart.bind(this);\n this.processTouchStart = this.processTouchStart.bind(this);\n\n /**\n * @member {Function}\n */\n this.onTouchEnd = this.onTouchEnd.bind(this);\n this.processTouchEnd = this.processTouchEnd.bind(this);\n\n /**\n * @member {Function}\n */\n this.onTouchMove = this.onTouchMove.bind(this);\n this.processTouchMove = this.processTouchMove.bind(this);\n\n /**\n * @member {number}\n */\n this.last = 0;\n\n /**\n * The css style of the cursor that is being used\n * @member {string}\n */\n this.currentCursorStyle = 'inherit';\n\n /**\n * Internal cached var\n * @member {Point}\n * @private\n */\n this._tempPoint = new core.math.Point();\n\n /**\n * The current resolution\n * @member {number}\n */\n this.resolution = 1;\n\n this.setTargetElement(this.renderer.view, this.renderer.resolution);\n\n this.update();\n}\n\nInteractionManager.prototype.constructor = InteractionManager;\nmodule.exports = InteractionManager;\n\n/**\n * Sets the DOM element which will receive mouse/touch events. This is useful for when you have\n * other DOM elements on top of the renderers Canvas element. With this you'll be bale to deletegate\n * another DOM element to receive those events.\n *\n * @param element {HTMLElement} the DOM element which will receive mouse and touch events.\n * @param [resolution=1] {number} THe resolution of the new element (relative to the canvas).\n * @private\n */\nInteractionManager.prototype.setTargetElement = function (element, resolution)\n{\n this.removeEvents();\n\n this.interactionDOMElement = element;\n\n this.resolution = resolution || 1;\n\n this.addEvents();\n};\n\n/**\n * Registers all the DOM events\n * @private\n */\nInteractionManager.prototype.addEvents = function ()\n{\n if (!this.interactionDOMElement)\n {\n return;\n }\n\n if (window.navigator.msPointerEnabled)\n {\n this.interactionDOMElement.style['-ms-content-zooming'] = 'none';\n this.interactionDOMElement.style['-ms-touch-action'] = 'none';\n }\n\n this.interactionDOMElement.addEventListener('mousemove', this.onMouseMove, true);\n this.interactionDOMElement.addEventListener('mousedown', this.onMouseDown, true);\n this.interactionDOMElement.addEventListener('mouseout', this.onMouseOut, true);\n\n this.interactionDOMElement.addEventListener('touchstart', this.onTouchStart, true);\n this.interactionDOMElement.addEventListener('touchend', this.onTouchEnd, true);\n this.interactionDOMElement.addEventListener('touchmove', this.onTouchMove, true);\n\n window.addEventListener('mouseup', this.onMouseUp, true);\n\n this.eventsAdded = true;\n};\n\n/**\n * Removes all the DOM events that were previously registered\n * @private\n */\nInteractionManager.prototype.removeEvents = function ()\n{\n if (!this.interactionDOMElement)\n {\n return;\n }\n\n if (window.navigator.msPointerEnabled)\n {\n this.interactionDOMElement.style['-ms-content-zooming'] = '';\n this.interactionDOMElement.style['-ms-touch-action'] = '';\n }\n\n this.interactionDOMElement.removeEventListener('mousemove', this.onMouseMove, true);\n this.interactionDOMElement.removeEventListener('mousedown', this.onMouseDown, true);\n this.interactionDOMElement.removeEventListener('mouseout', this.onMouseOut, true);\n\n this.interactionDOMElement.removeEventListener('touchstart', this.onTouchStart, true);\n this.interactionDOMElement.removeEventListener('touchend', this.onTouchEnd, true);\n this.interactionDOMElement.removeEventListener('touchmove', this.onTouchMove, true);\n\n this.interactionDOMElement = null;\n\n window.removeEventListener('mouseup', this.onMouseUp, true);\n\n this.eventsAdded = false;\n};\n\n/**\n * updates the state of interactive objects\n *\n * @private\n */\nInteractionManager.prototype.update = function ()\n{\n requestAnimationFrame(this.update.bind(this));\n\n if( this.throttleUpdate() || !this.interactionDOMElement)\n {\n return;\n }\n\n // if the user move the mouse this check has already been dfone using the mouse move!\n if(this.didMove)\n {\n this.didMove = false;\n return;\n }\n\n this.cursor = 'inherit';\n\n this.processInteractive(this.mouse.global, this.renderer._lastObjectRendered , this.processMouseOverOut.bind(this) , true );\n\n if (this.currentCursorStyle !== this.cursor)\n {\n this.currentCursorStyle = this.cursor;\n this.interactionDOMElement.style.cursor = this.cursor;\n }\n\n //TODO\n};\n\n/**\n * Dispatches an event on the display object that was interacted with\n * @param displayObject {Container|Sprite|TilingSprite} the display object in question\n * @param eventString {string} the name of the event (e.g, mousedown)\n * @param eventData {EventData} the event data object\n * @private\n */\nInteractionManager.prototype.dispatchEvent = function ( displayObject, eventString, eventData )\n{\n if(!eventData.stopped)\n {\n eventData.target = displayObject;\n eventData.type = eventString;\n\n displayObject.emit( eventString, eventData );\n\n if( displayObject[eventString] )\n {\n displayObject[eventString]( eventData );\n }\n }\n};\n\n/**\n * Ensures the interaction checks don't happen too often by delaying the update loop\n * @private\n */\nInteractionManager.prototype.throttleUpdate = function ()\n{\n // frequency of 30fps??\n var now = Date.now();\n var diff = now - this.last;\n diff = (diff * INTERACTION_FREQUENCY ) / 1000;\n if (diff < 1)\n {\n return true;\n }\n\n this.last = now;\n\n return false;\n};\n\n/**\n * Maps x and y coords from a DOM object and maps them correctly to the pixi view. The resulting value is stored in the point.\n * This takes into account the fact that the DOM element could be scaled and positioned anywhere on the screen.\n *\n * @param {Point} point the point that the result will be stored in\n * @param {number} x the x coord of the position to map\n * @param {number} y the y coord of the position to map\n */\nInteractionManager.prototype.mapPositionToPoint = function ( point, x, y )\n{\n var rect = this.interactionDOMElement.getBoundingClientRect();\n point.x = ( ( x - rect.left ) * (this.interactionDOMElement.width / rect.width ) ) / this.resolution;\n point.y = ( ( y - rect.top ) * (this.interactionDOMElement.height / rect.height ) ) / this.resolution;\n};\n\n/**\n * This function is provides a neat way of crawling through the scene graph and running a specified function on all interactive objects it finds.\n * It will also take care of hit testing the interactive objects and passes the hit across in the function.\n *\n * @param {Point} point the point that is tested for collision\n * @param {Container|Sprite|TilingSprite} displayObject the displayObject that will be hit test (recurcsivly crawls its children)\n * @param {function} func the function that will be called on each interactive object. The displayObject and hit will be passed to the function\n * @param {boolean} hitTest this indicates if the objects inside should be hit test against the point\n * @return {boolean} returns true if the displayObject hit the point\n */\nInteractionManager.prototype.processInteractive = function (point, displayObject, func, hitTest, interactive )\n{\n if(!displayObject.visible)\n {\n return false;\n }\n\n var children = displayObject.children;\n\n var hit = false;\n\n // if the object is interactive we must hit test all its children..\n interactive = interactive || displayObject.interactive;\n\n if(displayObject.interactiveChildren)\n {\n\n for (var i = children.length-1; i >= 0; i--)\n {\n if(! hit && hitTest)\n {\n hit = this.processInteractive(point, children[i], func, true, interactive );\n }\n else\n {\n // now we know we can miss it all!\n this.processInteractive(point, children[i], func, false, false );\n }\n }\n\n }\n\n if(interactive)\n {\n if(hitTest)\n {\n if(displayObject.hitArea)\n {\n // lets use the hit object first!\n displayObject.worldTransform.applyInverse(point, this._tempPoint);\n hit = displayObject.hitArea.contains( this._tempPoint.x, this._tempPoint.y );\n }\n else if(displayObject.containsPoint)\n {\n hit = displayObject.containsPoint(point);\n }\n }\n\n if(displayObject.interactive)\n {\n func(displayObject, hit);\n }\n }\n\n return hit;\n};\n\n\n\n\n/**\n * Is called when the mouse button is pressed down on the renderer element\n *\n * @param event {Event} The DOM event of a mouse button being pressed down\n * @private\n */\nInteractionManager.prototype.onMouseDown = function (event)\n{\n this.mouse.originalEvent = event;\n this.eventData.data = this.mouse;\n this.eventData.stopped = false;\n\n if (AUTO_PREVENT_DEFAULT)\n {\n this.mouse.originalEvent.preventDefault();\n }\n\n this.processInteractive(this.mouse.global, this.renderer._lastObjectRendered, this.processMouseDown, true );\n};\n\n/**\n * Processes the result of the mouse down check and dispatches the event if need be\n *\n * @param displayObject {Container|Sprite|TilingSprite} The display object that was tested\n * @param hit {boolean} the result of the hit test on the dispay object\n * @private\n */\nInteractionManager.prototype.processMouseDown = function ( displayObject, hit )\n{\n var e = this.mouse.originalEvent;\n\n var isRightButton = e.button === 2 || e.which === 3;\n\n if(hit)\n {\n displayObject[ isRightButton ? '_isRightDown' : '_isLeftDown' ] = true;\n this.dispatchEvent( displayObject, isRightButton ? 'rightdown' : 'mousedown', this.eventData );\n }\n};\n\n\n\n/**\n * Is called when the mouse button is released on the renderer element\n *\n * @param event {Event} The DOM event of a mouse button being released\n * @private\n */\nInteractionManager.prototype.onMouseUp = function (event)\n{\n this.mouse.originalEvent = event;\n this.eventData.data = this.mouse;\n this.eventData.stopped = false;\n\n this.processInteractive(this.mouse.global, this.renderer._lastObjectRendered, this.processMouseUp, true );\n};\n\n/**\n * Processes the result of the mouse up check and dispatches the event if need be\n *\n * @param displayObject {Container|Sprite|TilingSprite} The display object that was tested\n * @param hit {boolean} the result of the hit test on the display object\n * @private\n */\nInteractionManager.prototype.processMouseUp = function ( displayObject, hit )\n{\n var e = this.mouse.originalEvent;\n\n var isRightButton = e.button === 2 || e.which === 3;\n var isDown = isRightButton ? '_isRightDown' : '_isLeftDown';\n\n if(hit)\n {\n this.dispatchEvent( displayObject, isRightButton ? 'rightup' : 'mouseup', this.eventData );\n\n if( displayObject[ isDown ] )\n {\n displayObject[ isDown ] = false;\n this.dispatchEvent( displayObject, isRightButton ? 'rightclick' : 'click', this.eventData );\n }\n }\n else\n {\n if( displayObject[ isDown ] )\n {\n displayObject[ isDown ] = false;\n this.dispatchEvent( displayObject, isRightButton ? 'rightupoutside' : 'mouseupoutside', this.eventData );\n }\n }\n};\n\n\n/**\n * Is called when the mouse moves across the renderer element\n *\n * @param event {Event} The DOM event of the mouse moving\n * @private\n */\nInteractionManager.prototype.onMouseMove = function (event)\n{\n this.mouse.originalEvent = event;\n this.eventData.data = this.mouse;\n this.eventData.stopped = false;\n\n this.mapPositionToPoint( this.mouse.global, event.clientX, event.clientY);\n\n this.didMove = true;\n\n this.cursor = 'inherit';\n\n this.processInteractive(this.mouse.global, this.renderer._lastObjectRendered, this.processMouseMove, true );\n\n if (this.currentCursorStyle !== this.cursor)\n {\n this.currentCursorStyle = this.cursor;\n this.interactionDOMElement.style.cursor = this.cursor;\n }\n\n //TODO BUG for parents ineractive object (border order issue)\n};\n\n/**\n * Processes the result of the mouse move check and dispatches the event if need be\n *\n * @param displayObject {Container|Sprite|TilingSprite} The display object that was tested\n * @param hit {boolean} the result of the hit test on the display object\n * @private\n */\nInteractionManager.prototype.processMouseMove = function ( displayObject, hit )\n{\n this.dispatchEvent( displayObject, 'mousemove', this.eventData);\n this.processMouseOverOut(displayObject, hit);\n};\n\n\n/**\n * Is called when the mouse is moved out of the renderer element\n *\n * @param event {Event} The DOM event of a mouse being moved out\n * @private\n */\nInteractionManager.prototype.onMouseOut = function (event)\n{\n this.mouse.originalEvent = event;\n this.eventData.stopped = false;\n\n this.interactionDOMElement.style.cursor = 'inherit';\n\n // TODO optimize by not check EVERY TIME! maybe half as often? //\n this.mapPositionToPoint( this.mouse.global, event.clientX, event.clientY );\n\n this.processInteractive( this.mouse.global, this.renderer._lastObjectRendered, this.processMouseOverOut, false );\n};\n\n/**\n * Processes the result of the mouse over/out check and dispatches the event if need be\n *\n * @param displayObject {Container|Sprite|TilingSprite} The display object that was tested\n * @param hit {boolean} the result of the hit test on the display object\n * @private\n */\nInteractionManager.prototype.processMouseOverOut = function ( displayObject, hit )\n{\n if(hit)\n {\n if(!displayObject._over)\n {\n displayObject._over = true;\n this.dispatchEvent( displayObject, 'mouseover', this.eventData );\n }\n\n if (displayObject.buttonMode)\n {\n this.cursor = displayObject.defaultCursor;\n }\n }\n else\n {\n if(displayObject._over)\n {\n displayObject._over = false;\n this.dispatchEvent( displayObject, 'mouseout', this.eventData);\n }\n }\n};\n\n\n/**\n * Is called when a touch is started on the renderer element\n *\n * @param event {Event} The DOM event of a touch starting on the renderer view\n * @private\n */\nInteractionManager.prototype.onTouchStart = function (event)\n{\n if (AUTO_PREVENT_DEFAULT)\n {\n event.preventDefault();\n }\n\n var changedTouches = event.changedTouches;\n\n for (var i=0; i < changedTouches.length; i++)\n {\n var touchEvent = changedTouches[i];\n //TODO POOL\n var touchData = this.getTouchData( touchEvent );\n\n touchData.originalEvent = event;\n\n this.eventData.data = touchData;\n this.eventData.stopped = false;\n\n this.processInteractive( touchData.global, this.renderer._lastObjectRendered, this.processTouchStart, true );\n\n this.returnTouchData( touchData );\n }\n};\n\n/**\n * Processes the result of a touch check and dispatches the event if need be\n *\n * @param displayObject {Container|Sprite|TilingSprite} The display object that was tested\n * @param hit {boolean} the result of the hit test on the display object\n * @private\n */\nInteractionManager.prototype.processTouchStart = function ( displayObject, hit )\n{\n //console.log(\"hit\" + hit)\n if(hit)\n {\n displayObject._touchDown = true;\n this.dispatchEvent( displayObject, 'touchstart', this.eventData );\n }\n};\n\n\n/**\n * Is called when a touch ends on the renderer element\n * @param event {Event} The DOM event of a touch ending on the renderer view\n *\n */\nInteractionManager.prototype.onTouchEnd = function (event)\n{\n if (AUTO_PREVENT_DEFAULT)\n {\n event.preventDefault();\n }\n\n var changedTouches = event.changedTouches;\n\n for (var i=0; i < changedTouches.length; i++)\n {\n var touchEvent = changedTouches[i];\n\n var touchData = this.getTouchData( touchEvent );\n\n touchData.originalEvent = event;\n\n //TODO this should be passed along.. no set\n this.eventData.data = touchData;\n this.eventData.stopped = false;\n\n\n this.processInteractive( touchData.global, this.renderer._lastObjectRendered, this.processTouchEnd, true );\n\n this.returnTouchData( touchData );\n }\n};\n\n/**\n * Processes the result of the end of a touch and dispatches the event if need be\n *\n * @param displayObject {Container|Sprite|TilingSprite} The display object that was tested\n * @param hit {boolean} the result of the hit test on the display object\n * @private\n */\nInteractionManager.prototype.processTouchEnd = function ( displayObject, hit )\n{\n if(hit)\n {\n this.dispatchEvent( displayObject, 'touchend', this.eventData );\n\n if( displayObject._touchDown )\n {\n displayObject._touchDown = false;\n this.dispatchEvent( displayObject, 'tap', this.eventData );\n }\n }\n else\n {\n if( displayObject._touchDown )\n {\n displayObject._touchDown = false;\n this.dispatchEvent( displayObject, 'touchendoutside', this.eventData );\n }\n }\n};\n\n/**\n * Is called when a touch is moved across the renderer element\n *\n * @param event {Event} The DOM event of a touch moving across the renderer view\n * @private\n */\nInteractionManager.prototype.onTouchMove = function (event)\n{\n if (AUTO_PREVENT_DEFAULT)\n {\n event.preventDefault();\n }\n\n var changedTouches = event.changedTouches;\n\n for (var i=0; i < changedTouches.length; i++)\n {\n var touchEvent = changedTouches[i];\n\n var touchData = this.getTouchData( touchEvent );\n\n touchData.originalEvent = event;\n\n this.eventData.data = touchData;\n this.eventData.stopped = false;\n\n this.processInteractive( touchData.global, this.renderer._lastObjectRendered, this.processTouchMove, false );\n\n this.returnTouchData( touchData );\n }\n};\n\n/**\n * Processes the result of a touch move check and dispatches the event if need be\n *\n * @param displayObject {Container|Sprite|TilingSprite} The display object that was tested\n * @param hit {boolean} the result of the hit test on the display object\n * @private\n */\nInteractionManager.prototype.processTouchMove = function ( displayObject, hit )\n{\n hit = hit;\n this.dispatchEvent( displayObject, 'touchmove', this.eventData);\n};\n\n/**\n * Grabs an interaction data object from the internal pool\n *\n * @param touchEvent {EventData} The touch event we need to pair with an interactionData object\n *\n * @private\n */\nInteractionManager.prototype.getTouchData = function (touchEvent)\n{\n var touchData = this.interactiveDataPool.pop();\n\n if(!touchData)\n {\n touchData = new InteractionData();\n }\n\n touchData.identifier = touchEvent.identifier;\n this.mapPositionToPoint( touchData.global, touchEvent.clientX, touchEvent.clientY );\n\n return touchData;\n};\n\n/**\n * Returns an interaction data object to the internal pool\n *\n * @param touchData {InteractionData} The touch data object we want to return to the pool\n *\n * @private\n */\nInteractionManager.prototype.returnTouchData = function ( touchData )\n{\n this.interactiveDataPool.push( touchData );\n};\n\ncore.WebGLRenderer.registerPlugin('interaction', InteractionManager);\ncore.CanvasRenderer.registerPlugin('interaction', InteractionManager);\n", "/**\n * @file Main export of the PIXI interactions library\n * @author Mat Groves \n * @copyright 2013-2015 GoodBoyDigital\n * @license {@link https://github.com/GoodBoyDigital/pixi.js/blob/master/LICENSE|MIT License}\n */\n\n/**\n * @namespace PIXI.interaction\n */\nmodule.exports = {\n InteractionData: require('./InteractionData'),\n InteractionManager: require('./InteractionManager'),\n interactiveTarget: require('./interactiveTarget')\n};\n", "var core = require('../core');\n\n\ncore.DisplayObject.prototype.interactive = false;\ncore.DisplayObject.prototype.buttonMode = false;\ncore.DisplayObject.prototype.interactiveChildren = true;\ncore.DisplayObject.prototype.defaultCursor = 'pointer';\n\n// some internal checks..\ncore.DisplayObject.prototype._over = false;\ncore.DisplayObject.prototype._touchDown = false;\n\nmodule.exports = {};\n", - "var Resource = require('resource-loader').Resource,\n core = require('../core'),\n text = require('../text');\n\nmodule.exports = function ()\n{\n return function (resource, next)\n {\n if (!resource.data || navigator.isCocoonJS)\n {\n if (window.DOMParser)\n {\n var domparser = new DOMParser();\n resource.data = domparser.parseFromString(this.xhr.responseText, 'text/xml');\n }\n else\n {\n var div = document.createElement('div');\n div.innerHTML = this.xhr.responseText;\n resource.data = div;\n }\n }\n\n var name = resource.data.nodeName;\n\n // skip if no data\n if (!resource.data || !name || (name.toLowerCase() !== '#document' && name.toLowerCase() !== 'div'))\n {\n return next();\n }\n\n var textureUrl = this.baseUrl + resource.data.getElementsByTagName('page')[0].getAttribute('file');\n var loadOptions = {\n crossOrigin: resource.crossOrigin,\n loadType: Resource.LOAD_TYPE.IMAGE\n };\n\n // load the texture for the font\n this.add(resource.name + '_image', textureUrl, loadOptions, function (res)\n {\n var data = {};\n var info = resource.data.getElementsByTagName('info')[0];\n var common = resource.data.getElementsByTagName('common')[0];\n\n data.font = info.getAttribute('face');\n data.size = parseInt(info.getAttribute('size'), 10);\n data.lineHeight = parseInt(common.getAttribute('lineHeight'), 10);\n data.chars = {};\n\n //parse letters\n var letters = resource.data.getElementsByTagName('char');\n\n for (var i = 0; i < letters.length; i++)\n {\n var charCode = parseInt(letters[i].getAttribute('id'), 10);\n\n var textureRect = new core.math.Rectangle(\n parseInt(letters[i].getAttribute('x'), 10),\n parseInt(letters[i].getAttribute('y'), 10),\n parseInt(letters[i].getAttribute('width'), 10),\n parseInt(letters[i].getAttribute('height'), 10)\n );\n\n data.chars[charCode] = {\n xOffset: parseInt(letters[i].getAttribute('xoffset'), 10),\n yOffset: parseInt(letters[i].getAttribute('yoffset'), 10),\n xAdvance: parseInt(letters[i].getAttribute('xadvance'), 10),\n kerning: {},\n texture: core.utils.TextureCache[charCode] = new core.Texture(res.texture.baseTexture, textureRect)\n\n };\n }\n\n //parse kernings\n var kernings = resource.data.getElementsByTagName('kerning');\n for (i = 0; i < kernings.length; i++)\n {\n var first = parseInt(kernings[i].getAttribute('first'), 10);\n var second = parseInt(kernings[i].getAttribute('second'), 10);\n var amount = parseInt(kernings[i].getAttribute('amount'), 10);\n\n data.chars[second].kerning[first] = amount;\n\n }\n\n resource.bitmapFont = data;\n\n // I'm leaving this as a temporary fix so we can test the bitmap fonts in v3\n // but it's very likely to change\n text.BitmapText.fonts[data.font] = data;\n\n next();\n });\n };\n};\n", + "var Resource = require('resource-loader').Resource,\n core = require('../core'),\n text = require('../text');\n\nmodule.exports = function ()\n{\n return function (resource, next)\n {\n if (!resource.data || navigator.isCocoonJS)\n {\n if (window.DOMParser)\n {\n var domparser = new DOMParser();\n resource.data = domparser.parseFromString(this.xhr.responseText, 'text/xml');\n }\n else\n {\n var div = document.createElement('div');\n div.innerHTML = this.xhr.responseText;\n resource.data = div;\n }\n }\n\n var name = resource.data.nodeName;\n\n // skip if no data\n if (!resource.data || !name || (name.toLowerCase() !== '#document' && name.toLowerCase() !== 'div'))\n {\n return next();\n }\n\n var textureUrl = resource.data.getElementsByTagName('page')[0].getAttribute('file');\n var loadOptions = {\n crossOrigin: resource.crossOrigin,\n loadType: Resource.LOAD_TYPE.IMAGE\n };\n\n // load the texture for the font\n this.add(resource.name + '_image', textureUrl, loadOptions, function (res)\n {\n var data = {};\n var info = resource.data.getElementsByTagName('info')[0];\n var common = resource.data.getElementsByTagName('common')[0];\n\n data.font = info.getAttribute('face');\n data.size = parseInt(info.getAttribute('size'), 10);\n data.lineHeight = parseInt(common.getAttribute('lineHeight'), 10);\n data.chars = {};\n\n //parse letters\n var letters = resource.data.getElementsByTagName('char');\n\n for (var i = 0; i < letters.length; i++)\n {\n var charCode = parseInt(letters[i].getAttribute('id'), 10);\n\n var textureRect = new core.math.Rectangle(\n parseInt(letters[i].getAttribute('x'), 10),\n parseInt(letters[i].getAttribute('y'), 10),\n parseInt(letters[i].getAttribute('width'), 10),\n parseInt(letters[i].getAttribute('height'), 10)\n );\n\n data.chars[charCode] = {\n xOffset: parseInt(letters[i].getAttribute('xoffset'), 10),\n yOffset: parseInt(letters[i].getAttribute('yoffset'), 10),\n xAdvance: parseInt(letters[i].getAttribute('xadvance'), 10),\n kerning: {},\n texture: core.utils.TextureCache[charCode] = new core.Texture(res.texture.baseTexture, textureRect)\n\n };\n }\n\n //parse kernings\n var kernings = resource.data.getElementsByTagName('kerning');\n for (i = 0; i < kernings.length; i++)\n {\n var first = parseInt(kernings[i].getAttribute('first'), 10);\n var second = parseInt(kernings[i].getAttribute('second'), 10);\n var amount = parseInt(kernings[i].getAttribute('amount'), 10);\n\n data.chars[second].kerning[first] = amount;\n\n }\n\n resource.bitmapFont = data;\n\n // I'm leaving this as a temporary fix so we can test the bitmap fonts in v3\n // but it's very likely to change\n text.BitmapText.fonts[data.font] = data;\n\n next();\n });\n };\n};\n", "/**\n * @file Main export of the PIXI loaders library\n * @author Mat Groves \n * @copyright 2013-2015 GoodBoyDigital\n * @license {@link https://github.com/GoodBoyDigital/pixi.js/blob/master/LICENSE|MIT License}\n */\n\n/**\n * @namespace PIXI.loaders\n */\nmodule.exports = {\n Loader: require('./loader'),\n\n // parsers\n bitmapFontParser: require('./bitmapFontParser'),\n spineAtlasParser: require('./spineAtlasParser'),\n spritesheetParser: require('./spritesheetParser'),\n textureParser: require('./textureParser')\n};\n\n\nmodule.exports.loader = new module.exports.Loader();\n", "var ResourceLoader = require('resource-loader'),\n textureParser = require('./textureParser'),\n spritesheetParser = require('./spritesheetParser'),\n spineAtlasParser = require('./spineAtlasParser'),\n bitmapFontParser = require('./bitmapFontParser');\n\n/**\n *\n * The new loader, extends Resource Loader by Chad Engler : https://github.com/englercj/resource-loader\n *\n * ```js\n * var loader = new PIXI.loader();\n *\n * loader.add('spineboy',\"data/spineboy.json\");\n *\n * loader.once('complete',onAssetsLoaded);\n *\n * loader.load();\n * ```\n *\n * @class\n * @extends ResourceLoader\n * @memberof PIXI.loaders\n */\nvar Loader = function()\n{\n ResourceLoader.call(this);\n\n // parse any json strings into objects\n this.use(ResourceLoader.middleware.parsing.json())\n\n // parse any blob into more usable objects (e.g. Image)\n .use(ResourceLoader.middleware.parsing.blob())\n\n // parse any Image objects into textures\n .use(textureParser())\n\n // parse any spritesheet data into multiple textures\n .use(spritesheetParser())\n\n // parse any spine data into a spine object\n .use(spineAtlasParser())\n\n // parse any spritesheet data into multiple textures\n .use(bitmapFontParser());\n};\n\nLoader.prototype = Object.create(ResourceLoader.prototype);\nLoader.prototype.constructor = Loader;\n\nmodule.exports = Loader;\n", "var Resource = require('resource-loader').Resource,\n async = require('async'),\n spine = require('../spine');\n\nmodule.exports = function ()\n{\n return function (resource, next)\n {\n // if this is a spritesheet object\n if (resource.data && resource.data.bones)\n {\n /**\n * use a bit of hackery to load the atlas file, here we assume that the .json, .atlas and .png files\n * that correspond to the spine file are in the same base URL and that the .json and .atlas files\n * have the same name\n */\n var atlasPath = resource.url.substr(0, resource.url.lastIndexOf('.')) + '.atlas';\n var atlasOptions = {\n crossOrigin: resource.crossOrigin,\n xhrType: Resource.XHR_RESPONSE_TYPE.TEXT\n };\n var baseUrl = resource.url.substr(0, resource.url.lastIndexOf('/') + 1);\n\n\n this.add(resource.name + '_atlas', atlasPath, atlasOptions, function (res)\n {\n // create a spine atlas using the loaded text\n var spineAtlas = new spine.SpineRuntime.Atlas(this.xhr.responseText, baseUrl, res.crossOrigin);\n\n // spine animation\n var spineJsonParser = new spine.SpineRuntime.SkeletonJsonParser(new spine.SpineRuntime.AtlasAttachmentParser(spineAtlas));\n var skeletonData = spineJsonParser.readSkeletonData(resource.data);\n\n resource.spineData = skeletonData;\n resource.spineAtlas = spineAtlas;\n\n // Go through each spineAtlas.pages and wait for page.rendererObject (a baseTexture) to\n // load. Once all loaded, then call the next function.\n async.each(spineAtlas.pages, function (page, done)\n {\n if (page.rendererObject.hasLoaded)\n {\n done();\n }\n else\n {\n page.rendererObject.once('loaded', done);\n }\n }, next);\n });\n }\n else {\n next();\n }\n };\n};\n", - "var Resource = require('resource-loader').Resource,\n path = require('path'),\n core = require('../core');\n\nmodule.exports = function ()\n{\n return function (resource, next)\n {\n // if this is a spritesheet object\n if (resource.data && resource.data.frames)\n {\n var loadOptions = {\n crossOrigin: resource.crossOrigin,\n loadType: Resource.LOAD_TYPE.IMAGE\n };\n\n var route = path.dirname(resource.url.replace(this.baseUrl, ''));\n\n var resolution = core.utils.getResolutionOfUrl( resource.url );\n\n // load the image for this sheet\n this.add(resource.name + '_image', this.baseUrl + route + '/' + resource.data.meta.image, loadOptions, function (res)\n {\n resource.textures = {};\n\n var frames = resource.data.frames;\n\n for (var i in frames)\n {\n var rect = frames[i].frame;\n\n if (rect)\n {\n var size = null;\n var trim = null;\n\n if (frames[i].rotated) {\n size = new core.math.Rectangle(rect.x, rect.y, rect.h, rect.w);\n }\n else {\n size = new core.math.Rectangle(rect.x, rect.y, rect.w, rect.h);\n }\n\n // Check to see if the sprite is trimmed\n if (frames[i].trimmed)\n {\n trim = new core.math.Rectangle(\n frames[i].spriteSourceSize.x / resolution,\n frames[i].spriteSourceSize.y / resolution,\n frames[i].sourceSize.w / resolution,\n frames[i].sourceSize.h / resolution\n );\n }\n\n // flip the width and height!\n if (frames[i].rotated)\n {\n var temp = size.width;\n size.width = size.height;\n size.height = temp;\n }\n\n size.x /= resolution;\n size.y /= resolution;\n size.width /= resolution;\n size.height /= resolution;\n\n resource.textures[i] = new core.Texture(res.texture.baseTexture, size, size.clone(), trim, frames[i].rotated);\n\n // lets also add the frame to pixi's global cache for fromFrame and fromImage fucntions\n core.utils.TextureCache[i] = resource.textures[i];\n }\n }\n\n next();\n });\n }\n else {\n next();\n }\n };\n};\n", + "var Resource = require('resource-loader').Resource,\n path = require('path'),\n core = require('../core');\n\nmodule.exports = function ()\n{\n return function (resource, next)\n {\n // if this is a spritesheet object\n if (resource.data && resource.data.frames)\n {\n var loadOptions = {\n crossOrigin: resource.crossOrigin,\n loadType: Resource.LOAD_TYPE.IMAGE\n };\n\n var route = path.dirname(resource.url.replace(this.baseUrl, ''));\n\n var resolution = core.utils.getResolutionOfUrl( resource.url );\n\n // load the image for this sheet\n this.add(resource.name + '_image', route + '/' + resource.data.meta.image, loadOptions, function (res)\n {\n resource.textures = {};\n\n var frames = resource.data.frames;\n\n for (var i in frames)\n {\n var rect = frames[i].frame;\n\n if (rect)\n {\n var size = null;\n var trim = null;\n\n if (frames[i].rotated) {\n size = new core.math.Rectangle(rect.x, rect.y, rect.h, rect.w);\n }\n else {\n size = new core.math.Rectangle(rect.x, rect.y, rect.w, rect.h);\n }\n\n // Check to see if the sprite is trimmed\n if (frames[i].trimmed)\n {\n trim = new core.math.Rectangle(\n frames[i].spriteSourceSize.x / resolution,\n frames[i].spriteSourceSize.y / resolution,\n frames[i].sourceSize.w / resolution,\n frames[i].sourceSize.h / resolution\n );\n }\n\n // flip the width and height!\n if (frames[i].rotated)\n {\n var temp = size.width;\n size.width = size.height;\n size.height = temp;\n }\n\n size.x /= resolution;\n size.y /= resolution;\n size.width /= resolution;\n size.height /= resolution;\n\n resource.textures[i] = new core.Texture(res.texture.baseTexture, size, size.clone(), trim, frames[i].rotated);\n\n // lets also add the frame to pixi's global cache for fromFrame and fromImage fucntions\n core.utils.TextureCache[i] = resource.textures[i];\n }\n }\n\n next();\n });\n }\n else {\n next();\n }\n };\n};\n", "var core = require('../core');\n\nmodule.exports = function ()\n{\n return function (resource, next)\n {\n // create a new texture if the data is an Image object\n if (resource.data && resource.data.nodeName && resource.data.nodeName.toLowerCase() === 'img')\n {\n resource.texture = new core.Texture(new core.BaseTexture(resource.data, null, core.utils.getResolutionOfUrl(resource.url)));\n // lets also add the frame to pixi's global cache for fromFrame and fromImage fucntions\n core.utils.TextureCache[resource.url] = resource.texture;\n }\n\n next();\n };\n};\n", "var core = require('../core'),\n spine = require('./SpineRuntime');\n\n/* Esoteric Software SPINE wrapper for pixi.js */\n\nspine.Bone.yDown = true;\n\n/**\n * A class that enables the you to import and run your spine animations in pixi.\n * The Spine animation data needs to be loaded using either the Loader or a SpineLoader before it can be used by this class\n * See example 12 (http://www.goodboydigital.com/pixijs/examples/12/) to see a working example and check out the source\n *\n * ```js\n * var spineAnimation = new PIXI.Spine(spineData);\n * ```\n *\n * @class\n * @extends Container\n * @memberof PIXI.spine\n * @param spineData {object} The spine data loaded from a spine atlas.\n */\nfunction Spine(spineData)\n{\n core.Container.call(this);\n\n if (!spineData)\n {\n throw new Error('The spineData param is required.');\n }\n\n /**\n * The spineData object\n *\n * @member {object}\n */\n this.spineData = spineData;\n\n /**\n * A spine Skeleton object\n *\n * @member {object}\n */\n this.skeleton = new spine.Skeleton(spineData);\n this.skeleton.updateWorldTransform();\n\n /**\n * A spine AnimationStateData object created from the spine data passed in the constructor\n *\n * @member {object}\n */\n this.stateData = new spine.AnimationStateData(spineData);\n\n /**\n * A spine AnimationState object created from the spine AnimationStateData object\n *\n * @member {object}\n */\n this.state = new spine.AnimationState(this.stateData);\n\n /**\n * An array of containers\n *\n * @member {Container[]}\n */\n this.slotContainers = [];\n\n for (var i = 0, n = this.skeleton.drawOrder.length; i < n; i++)\n {\n var slot = this.skeleton.drawOrder[i];\n var attachment = slot.attachment;\n var slotContainer = new core.Container();\n this.slotContainers.push(slotContainer);\n this.addChild(slotContainer);\n\n if (attachment instanceof spine.RegionAttachment)\n {\n var spriteName = attachment.rendererObject.name;\n var sprite = this.createSprite(slot, attachment);\n slot.currentSprite = sprite;\n slot.currentSpriteName = spriteName;\n slotContainer.addChild(sprite);\n }\n else if (attachment instanceof spine.MeshAttachment)\n {\n var mesh = this.createMesh(slot, attachment);\n slot.currentMesh = mesh;\n slot.currentMeshName = attachment.name;\n slotContainer.addChild(mesh);\n }\n else\n {\n continue;\n }\n\n }\n\n /**\n * Should the Spine object update its transforms\n *\n * @member {boolean}\n */\n this.autoUpdate = true;\n}\n\nSpine.prototype = Object.create(core.Container.prototype);\nSpine.prototype.constructor = Spine;\nmodule.exports = Spine;\n\nObject.defineProperties(Spine.prototype, {\n /**\n * If this flag is set to true, the spine animation will be autoupdated every time\n * the object id drawn. The down side of this approach is that the delta time is\n * automatically calculated and you could miss out on cool effects like slow motion,\n * pause, skip ahead and the sorts. Most of these effects can be achieved even with\n * autoupdate enabled but are harder to achieve.\n *\n * @member {boolean}\n * @memberof Spine#\n * @default true\n */\n autoUpdate: {\n get: function ()\n {\n return (this.updateTransform === Spine.prototype.autoUpdateTransform);\n },\n\n set: function (value)\n {\n this.updateTransform = value ? Spine.prototype.autoUpdateTransform : core.Container.prototype.updateTransform;\n }\n }\n});\n\n/**\n * Update the spine skeleton and its animations by delta time (dt)\n *\n * @param dt {number} Delta time. Time by which the animation should be updated\n */\nSpine.prototype.update = function (dt)\n{\n this.state.update(dt);\n this.state.apply(this.skeleton);\n this.skeleton.updateWorldTransform();\n\n var drawOrder = this.skeleton.drawOrder;\n for (var i = 0, n = drawOrder.length; i < n; i++)\n {\n var slot = drawOrder[i];\n var attachment = slot.attachment;\n var slotContainer = this.slotContainers[i];\n\n if (!attachment)\n {\n slotContainer.visible = false;\n continue;\n }\n\n var type = attachment.type;\n if (type === spine.AttachmentType.region)\n {\n if (attachment.rendererObject)\n {\n if (!slot.currentSpriteName || slot.currentSpriteName !== attachment.rendererObject.name)\n {\n var spriteName = attachment.rendererObject.name;\n if (slot.currentSprite !== undefined)\n {\n slot.currentSprite.visible = false;\n }\n slot.sprites = slot.sprites || {};\n if (slot.sprites[spriteName] !== undefined)\n {\n slot.sprites[spriteName].visible = true;\n }\n else\n {\n var sprite = this.createSprite(slot, attachment);\n slotContainer.addChild(sprite);\n }\n slot.currentSprite = slot.sprites[spriteName];\n slot.currentSpriteName = spriteName;\n }\n }\n\n var bone = slot.bone;\n\n slotContainer.position.x = bone.worldX + attachment.x * bone.m00 + attachment.y * bone.m01;\n slotContainer.position.y = bone.worldY + attachment.x * bone.m10 + attachment.y * bone.m11;\n slotContainer.scale.x = bone.worldScaleX;\n slotContainer.scale.y = bone.worldScaleY;\n\n slotContainer.rotation = -(slot.bone.worldRotation * spine.degRad);\n\n slot.currentSprite.tint = core.utils.rgb2hex([slot.r,slot.g,slot.b]);\n }\n else if (type === spine.AttachmentType.skinnedmesh)\n {\n if (!slot.currentMeshName || slot.currentMeshName !== attachment.name)\n {\n var meshName = attachment.name;\n if (slot.currentMesh !== undefined)\n {\n slot.currentMesh.visible = false;\n }\n\n slot.meshes = slot.meshes || {};\n\n if (slot.meshes[meshName] !== undefined)\n {\n slot.meshes[meshName].visible = true;\n }\n else\n {\n var mesh = this.createMesh(slot, attachment);\n slotContainer.addChild(mesh);\n }\n\n slot.currentMesh = slot.meshes[meshName];\n slot.currentMeshName = meshName;\n }\n\n attachment.computeWorldVertices(slot.bone.skeleton.x, slot.bone.skeleton.y, slot, slot.currentMesh.vertices);\n\n }\n else\n {\n slotContainer.visible = false;\n continue;\n }\n slotContainer.visible = true;\n\n slotContainer.alpha = slot.a;\n }\n};\n\n/**\n * When autoupdate is set to yes this function is used as pixi's updateTransform function\n *\n * @private\n */\nSpine.prototype.autoUpdateTransform = function ()\n{\n this.lastTime = this.lastTime || Date.now();\n var timeDelta = (Date.now() - this.lastTime) * 0.001;\n this.lastTime = Date.now();\n\n this.update(timeDelta);\n\n core.Container.prototype.updateTransform.call(this);\n};\n\n/**\n * Create a new sprite to be used with spine.RegionAttachment\n *\n * @param slot {spine.Slot} The slot to which the attachment is parented\n * @param attachment {spine.RegionAttachment} The attachment that the sprite will represent\n * @private\n */\nSpine.prototype.createSprite = function (slot, attachment)\n{\n var descriptor = attachment.rendererObject;\n var baseTexture = descriptor.page.rendererObject;\n var spriteRect = new core.math.Rectangle(descriptor.x,\n descriptor.y,\n descriptor.rotate ? descriptor.height : descriptor.width,\n descriptor.rotate ? descriptor.width : descriptor.height);\n var spriteTexture = new core.Texture(baseTexture, spriteRect);\n var sprite = new core.Sprite(spriteTexture);\n\n var baseRotation = descriptor.rotate ? Math.PI * 0.5 : 0.0;\n sprite.scale.set(descriptor.width / descriptor.originalWidth, descriptor.height / descriptor.originalHeight);\n sprite.rotation = baseRotation - (attachment.rotation * spine.degRad);\n sprite.anchor.x = sprite.anchor.y = 0.5;\n\n slot.sprites = slot.sprites || {};\n slot.sprites[descriptor.name] = sprite;\n return sprite;\n};\n\n/**\n * Creates a Strip from the spine data\n * @param slot {spine.Slot} The slot to which the attachment is parented\n * @param attachment {spine.RegionAttachment} The attachment that the sprite will represent\n * @private\n */\nSpine.prototype.createMesh = function (slot, attachment)\n{\n var descriptor = attachment.rendererObject;\n var baseTexture = descriptor.page.rendererObject;\n var texture = new core.Texture(baseTexture);\n\n var strip = new core.Strip(texture);\n strip.drawMode = core.Strip.DRAW_MODES.TRIANGLES;\n strip.canvasPadding = 1.5;\n\n strip.vertices = new Float32Array(attachment.uvs.length);\n strip.uvs = attachment.uvs;\n strip.indices = attachment.triangles;\n\n slot.meshes = slot.meshes || {};\n slot.meshes[attachment.name] = strip;\n\n return strip;\n};\n", "/******************************************************************************\n * Spine Runtimes Software License\n * Version 2.1\n *\n * Copyright (c) 2013, Esoteric Software\n * All rights reserved.\n *\n * You are granted a perpetual, non-exclusive, non-sublicensable and\n * non-transferable license to install, execute and perform the Spine Runtimes\n * Software (the \"Software\") solely for internal use. Without the written\n * permission of Esoteric Software (typically granted by licensing Spine), you\n * may not (a) modify, translate, adapt or otherwise create derivative works,\n * improvements of the Software or develop new applications using the Software\n * or (b) remove, delete, alter or obscure any trademarks or any copyright,\n * trademark, patent or other intellectual property or proprietary rights\n * notices on or in the Software, including any copy thereof. Redistributions\n * in binary or source form must include this license and terms.\n *\n * THIS SOFTWARE IS PROVIDED BY ESOTERIC SOFTWARE \"AS IS\" AND ANY EXPRESS OR\n * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF\n * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO\n * EVENT SHALL ESOTERIC SOFTARE BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\n * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,\n * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;\n * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,\n * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR\n * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF\n * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n *****************************************************************************/\nvar core = require('../core');\n\n\nvar spine = module.exports = {\n\tradDeg: 180 / Math.PI,\n\tdegRad: Math.PI / 180,\n\ttemp: [],\n Float32Array: (typeof(Float32Array) === 'undefined') ? Array : Float32Array,\n Uint16Array: (typeof(Uint16Array) === 'undefined') ? Array : Uint16Array\n};\n\nspine.BoneData = function (name, parent)\n{\n\tthis.name = name;\n\tthis.parent = parent;\n};\nspine.BoneData.prototype = {\n\tlength: 0,\n\tx: 0, y: 0,\n\trotation: 0,\n\tscaleX: 1, scaleY: 1,\n\tinheritScale: true,\n\tinheritRotation: true,\n\tflipX: false, flipY: false\n};\n\nspine.SlotData = function (name, boneData)\n{\n\tthis.name = name;\n\tthis.boneData = boneData;\n};\nspine.SlotData.prototype = {\n\tr: 1, g: 1, b: 1, a: 1,\n\tattachmentName: null,\n\tadditiveBlending: false\n};\n\nspine.IkConstraintData = function (name)\n{\n\tthis.name = name;\n\tthis.bones = [];\n};\nspine.IkConstraintData.prototype = {\n\ttarget: null,\n\tbendDirection: 1,\n\tmix: 1\n};\n\nspine.Bone = function (boneData, skeleton, parent)\n{\n\tthis.data = boneData;\n\tthis.skeleton = skeleton;\n\tthis.parent = parent;\n\tthis.setToSetupPose();\n};\nspine.Bone.yDown = false;\nspine.Bone.prototype = {\n\tx: 0, y: 0,\n\trotation: 0, rotationIK: 0,\n\tscaleX: 1, scaleY: 1,\n\tflipX: false, flipY: false,\n\tm00: 0, m01: 0, worldX: 0, // a b x\n\tm10: 0, m11: 0, worldY: 0, // c d y\n\tworldRotation: 0,\n\tworldScaleX: 1, worldScaleY: 1,\n\tworldFlipX: false, worldFlipY: false,\n updateWorldTransform: function ()\n {\n\t\tvar parent = this.parent;\n if (parent)\n {\n\t\t\tthis.worldX = this.x * parent.m00 + this.y * parent.m01 + parent.worldX;\n\t\t\tthis.worldY = this.x * parent.m10 + this.y * parent.m11 + parent.worldY;\n if (this.data.inheritScale)\n {\n\t\t\t\tthis.worldScaleX = parent.worldScaleX * this.scaleX;\n\t\t\t\tthis.worldScaleY = parent.worldScaleY * this.scaleY;\n\t\t\t} else {\n\t\t\t\tthis.worldScaleX = this.scaleX;\n\t\t\t\tthis.worldScaleY = this.scaleY;\n\t\t\t}\n\t\t\tthis.worldRotation = this.data.inheritRotation ? (parent.worldRotation + this.rotationIK) : this.rotationIK;\n\t\t\tthis.worldFlipX = parent.worldFlipX != this.flipX;\n\t\t\tthis.worldFlipY = parent.worldFlipY != this.flipY;\n\t\t} else {\n\t\t\tvar skeletonFlipX = this.skeleton.flipX, skeletonFlipY = this.skeleton.flipY;\n\t\t\tthis.worldX = skeletonFlipX ? -this.x : this.x;\n\t\t\tthis.worldY = (skeletonFlipY != spine.Bone.yDown) ? -this.y : this.y;\n\t\t\tthis.worldScaleX = this.scaleX;\n\t\t\tthis.worldScaleY = this.scaleY;\n\t\t\tthis.worldRotation = this.rotationIK;\n\t\t\tthis.worldFlipX = skeletonFlipX != this.flipX;\n\t\t\tthis.worldFlipY = skeletonFlipY != this.flipY;\n\t\t}\n\t\tvar radians = this.worldRotation * spine.degRad;\n\t\tvar cos = Math.cos(radians);\n\t\tvar sin = Math.sin(radians);\n if (this.worldFlipX)\n {\n\t\t\tthis.m00 = -cos * this.worldScaleX;\n\t\t\tthis.m01 = sin * this.worldScaleY;\n\t\t} else {\n\t\t\tthis.m00 = cos * this.worldScaleX;\n\t\t\tthis.m01 = -sin * this.worldScaleY;\n\t\t}\n if (this.worldFlipY != spine.Bone.yDown)\n {\n\t\t\tthis.m10 = -sin * this.worldScaleX;\n\t\t\tthis.m11 = -cos * this.worldScaleY;\n\t\t} else {\n\t\t\tthis.m10 = sin * this.worldScaleX;\n\t\t\tthis.m11 = cos * this.worldScaleY;\n\t\t}\n\t},\n setToSetupPose: function ()\n {\n\t\tvar data = this.data;\n\t\tthis.x = data.x;\n\t\tthis.y = data.y;\n\t\tthis.rotation = data.rotation;\n\t\tthis.rotationIK = this.rotation;\n\t\tthis.scaleX = data.scaleX;\n\t\tthis.scaleY = data.scaleY;\n\t\tthis.flipX = data.flipX;\n\t\tthis.flipY = data.flipY;\n\t},\n worldToLocal: function (world)\n {\n\t\tvar dx = world[0] - this.worldX, dy = world[1] - this.worldY;\n\t\tvar m00 = this.m00, m10 = this.m10, m01 = this.m01, m11 = this.m11;\n if (this.worldFlipX != (this.worldFlipY != spine.Bone.yDown))\n {\n\t\t\tm00 = -m00;\n\t\t\tm11 = -m11;\n\t\t}\n\t\tvar invDet = 1 / (m00 * m11 - m01 * m10);\n\t\tworld[0] = dx * m00 * invDet - dy * m01 * invDet;\n\t\tworld[1] = dy * m11 * invDet - dx * m10 * invDet;\n\t},\n localToWorld: function (local)\n {\n\t\tvar localX = local[0], localY = local[1];\n\t\tlocal[0] = localX * this.m00 + localY * this.m01 + this.worldX;\n\t\tlocal[1] = localX * this.m10 + localY * this.m11 + this.worldY;\n\t}\n};\n\nspine.Slot = function (slotData, bone)\n{\n\tthis.data = slotData;\n\tthis.bone = bone;\n\tthis.setToSetupPose();\n};\nspine.Slot.prototype = {\n\tr: 1, g: 1, b: 1, a: 1,\n\t_attachmentTime: 0,\n\tattachment: null,\n\tattachmentVertices: [],\n setAttachment: function (attachment)\n {\n\t\tthis.attachment = attachment;\n\t\tthis._attachmentTime = this.bone.skeleton.time;\n\t\tthis.attachmentVertices.length = 0;\n\t},\n setAttachmentTime: function (time)\n {\n\t\tthis._attachmentTime = this.bone.skeleton.time - time;\n\t},\n getAttachmentTime: function ()\n {\n\t\treturn this.bone.skeleton.time - this._attachmentTime;\n\t},\n setToSetupPose: function ()\n {\n\t\tvar data = this.data;\n\t\tthis.r = data.r;\n\t\tthis.g = data.g;\n\t\tthis.b = data.b;\n\t\tthis.a = data.a;\n\n\t\tvar slotDatas = this.bone.skeleton.data.slots;\n for (var i = 0, n = slotDatas.length; i < n; i++)\n {\n if (slotDatas[i] == data)\n {\n\t\t\t\tthis.setAttachment(!data.attachmentName ? null : this.bone.skeleton.getAttachmentBySlotIndex(i, data.attachmentName));\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t}\n};\n\nspine.IkConstraint = function (data, skeleton)\n{\n\tthis.data = data;\n\tthis.mix = data.mix;\n\tthis.bendDirection = data.bendDirection;\n\n\tthis.bones = [];\n\tfor (var i = 0, n = data.bones.length; i < n; i++)\n\t\tthis.bones.push(skeleton.findBone(data.bones[i].name));\n\tthis.target = skeleton.findBone(data.target.name);\n};\nspine.IkConstraint.prototype = {\n apply: function ()\n {\n\t\tvar target = this.target;\n\t\tvar bones = this.bones;\n switch (bones.length)\n {\n\t\tcase 1:\n\t\t\tspine.IkConstraint.apply1(bones[0], target.worldX, target.worldY, this.mix);\n\t\t\tbreak;\n\t\tcase 2:\n\t\t\tspine.IkConstraint.apply2(bones[0], bones[1], target.worldX, target.worldY, this.bendDirection, this.mix);\n\t\t\tbreak;\n\t\t}\n\t}\n};\n/** Adjusts the bone rotation so the tip is as close to the target position as possible. The target is specified in the world\n * coordinate system. */\nspine.IkConstraint.apply1 = function (bone, targetX, targetY, alpha)\n{\n\tvar parentRotation = (!bone.data.inheritRotation || !bone.parent) ? 0 : bone.parent.worldRotation;\n\tvar rotation = bone.rotation;\n\tvar rotationIK = Math.atan2(targetY - bone.worldY, targetX - bone.worldX) * spine.radDeg - parentRotation;\n\tbone.rotationIK = rotation + (rotationIK - rotation) * alpha;\n};\n/** Adjusts the parent and child bone rotations so the tip of the child is as close to the target position as possible. The\n * target is specified in the world coordinate system.\n * @param child Any descendant bone of the parent. */\nspine.IkConstraint.apply2 = function (parent, child, targetX, targetY, bendDirection, alpha)\n{\n\tvar childRotation = child.rotation, parentRotation = parent.rotation;\n if (!alpha)\n {\n\t\tchild.rotationIK = childRotation;\n\t\tparent.rotationIK = parentRotation;\n\t\treturn;\n\t}\n\tvar positionX, positionY, tempPosition = spine.temp;\n\tvar parentParent = parent.parent;\n if (parentParent)\n {\n\t\ttempPosition[0] = targetX;\n\t\ttempPosition[1] = targetY;\n\t\tparentParent.worldToLocal(tempPosition);\n\t\ttargetX = (tempPosition[0] - parent.x) * parentParent.worldScaleX;\n\t\ttargetY = (tempPosition[1] - parent.y) * parentParent.worldScaleY;\n\t} else {\n\t\ttargetX -= parent.x;\n\t\ttargetY -= parent.y;\n\t}\n if (child.parent == parent)\n {\n\t\tpositionX = child.x;\n\t\tpositionY = child.y;\n\t} else {\n\t\ttempPosition[0] = child.x;\n\t\ttempPosition[1] = child.y;\n\t\tchild.parent.localToWorld(tempPosition);\n\t\tparent.worldToLocal(tempPosition);\n\t\tpositionX = tempPosition[0];\n\t\tpositionY = tempPosition[1];\n\t}\n\tvar childX = positionX * parent.worldScaleX, childY = positionY * parent.worldScaleY;\n\tvar offset = Math.atan2(childY, childX);\n\tvar len1 = Math.sqrt(childX * childX + childY * childY), len2 = child.data.length * child.worldScaleX;\n\t// Based on code by Ryan Juckett with permission: Copyright (c) 2008-2009 Ryan Juckett, http://www.ryanjuckett.com/\n\tvar cosDenom = 2 * len1 * len2;\n if (cosDenom < 0.0001)\n {\n\t\tchild.rotationIK = childRotation + (Math.atan2(targetY, targetX) * spine.radDeg - parentRotation - childRotation) * alpha;\n\t\treturn;\n\t}\n\tvar cos = (targetX * targetX + targetY * targetY - len1 * len1 - len2 * len2) / cosDenom;\n\tif (cos < -1)\n\t\tcos = -1;\n\telse if (cos > 1)\n\t\tcos = 1;\n\tvar childAngle = Math.acos(cos) * bendDirection;\n\tvar adjacent = len1 + len2 * cos, opposite = len2 * Math.sin(childAngle);\n\tvar parentAngle = Math.atan2(targetY * adjacent - targetX * opposite, targetX * adjacent + targetY * opposite);\n\tvar rotation = (parentAngle - offset) * spine.radDeg - parentRotation;\n\tif (rotation > 180)\n\t\trotation -= 360;\n\telse if (rotation < -180) //\n\t\trotation += 360;\n\tparent.rotationIK = parentRotation + rotation * alpha;\n\trotation = (childAngle + offset) * spine.radDeg - childRotation;\n\tif (rotation > 180)\n\t\trotation -= 360;\n\telse if (rotation < -180) //\n\t\trotation += 360;\n\tchild.rotationIK = childRotation + (rotation + parent.worldRotation - child.parent.worldRotation) * alpha;\n};\n\nspine.Skin = function (name)\n{\n\tthis.name = name;\n\tthis.attachments = {};\n};\nspine.Skin.prototype = {\n addAttachment: function (slotIndex, name, attachment)\n {\n\t\tthis.attachments[slotIndex + \":\" + name] = attachment;\n\t},\n getAttachment: function (slotIndex, name)\n {\n\t\treturn this.attachments[slotIndex + \":\" + name];\n\t},\n _attachAll: function (skeleton, oldSkin)\n {\n for (var key in oldSkin.attachments)\n {\n\t\t\tvar colon = key.indexOf(\":\");\n\t\t\tvar slotIndex = parseInt(key.substring(0, colon));\n\t\t\tvar name = key.substring(colon + 1);\n\t\t\tvar slot = skeleton.slots[slotIndex];\n if (slot.attachment && slot.attachment.name == name)\n {\n\t\t\t\tvar attachment = this.getAttachment(slotIndex, name);\n\t\t\t\tif (attachment) slot.setAttachment(attachment);\n\t\t\t}\n\t\t}\n\t}\n};\n\nspine.Animation = function (name, timelines, duration)\n{\n\tthis.name = name;\n\tthis.timelines = timelines;\n\tthis.duration = duration;\n};\nspine.Animation.prototype = {\n apply: function (skeleton, lastTime, time, loop, events)\n {\n if (loop && this.duration != 0)\n {\n\t\t\ttime %= this.duration;\n\t\t\tlastTime %= this.duration;\n\t\t}\n\t\tvar timelines = this.timelines;\n\t\tfor (var i = 0, n = timelines.length; i < n; i++)\n\t\t\ttimelines[i].apply(skeleton, lastTime, time, events, 1);\n\t},\n mix: function (skeleton, lastTime, time, loop, events, alpha)\n {\n if (loop && this.duration != 0)\n {\n\t\t\ttime %= this.duration;\n\t\t\tlastTime %= this.duration;\n\t\t}\n\t\tvar timelines = this.timelines;\n\t\tfor (var i = 0, n = timelines.length; i < n; i++)\n\t\t\ttimelines[i].apply(skeleton, lastTime, time, events, alpha);\n\t}\n};\nspine.Animation.binarySearch = function (values, target, step)\n{\n\tvar low = 0;\n\tvar high = Math.floor(values.length / step) - 2;\n\tif (!high) return step;\n\tvar current = high >>> 1;\n while (true)\n {\n\t\tif (values[(current + 1) * step] <= target)\n\t\t\tlow = current + 1;\n\t\telse\n\t\t\thigh = current;\n\t\tif (low == high) return (low + 1) * step;\n\t\tcurrent = (low + high) >>> 1;\n\t}\n};\nspine.Animation.binarySearch1 = function (values, target)\n{\n\tvar low = 0;\n\tvar high = values.length - 2;\n\tif (!high) return 1;\n\tvar current = high >>> 1;\n while (true)\n {\n\t\tif (values[current + 1] <= target)\n\t\t\tlow = current + 1;\n\t\telse\n\t\t\thigh = current;\n\t\tif (low == high) return low + 1;\n\t\tcurrent = (low + high) >>> 1;\n\t}\n};\nspine.Animation.linearSearch = function (values, target, step)\n{\n\tfor (var i = 0, last = values.length - step; i <= last; i += step)\n\t\tif (values[i] > target) return i;\n\treturn -1;\n};\n\nspine.Curves = function (frameCount)\n{\n\tthis.curves = []; // type, x, y, ...\n\t//this.curves.length = (frameCount - 1) * 19/*BEZIER_SIZE*/;\n};\nspine.Curves.prototype = {\n setLinear: function (frameIndex)\n {\n\t\tthis.curves[frameIndex * 19/*BEZIER_SIZE*/] = 0/*LINEAR*/;\n\t},\n setStepped: function (frameIndex)\n {\n\t\tthis.curves[frameIndex * 19/*BEZIER_SIZE*/] = 1/*STEPPED*/;\n\t},\n\t/** Sets the control handle positions for an interpolation bezier curve used to transition from this keyframe to the next.\n\t * cx1 and cx2 are from 0 to 1, representing the percent of time between the two keyframes. cy1 and cy2 are the percent of\n\t * the difference between the keyframe's values. */\n setCurve: function (frameIndex, cx1, cy1, cx2, cy2)\n {\n\t\tvar subdiv1 = 1 / 10/*BEZIER_SEGMENTS*/, subdiv2 = subdiv1 * subdiv1, subdiv3 = subdiv2 * subdiv1;\n\t\tvar pre1 = 3 * subdiv1, pre2 = 3 * subdiv2, pre4 = 6 * subdiv2, pre5 = 6 * subdiv3;\n\t\tvar tmp1x = -cx1 * 2 + cx2, tmp1y = -cy1 * 2 + cy2, tmp2x = (cx1 - cx2) * 3 + 1, tmp2y = (cy1 - cy2) * 3 + 1;\n\t\tvar dfx = cx1 * pre1 + tmp1x * pre2 + tmp2x * subdiv3, dfy = cy1 * pre1 + tmp1y * pre2 + tmp2y * subdiv3;\n\t\tvar ddfx = tmp1x * pre4 + tmp2x * pre5, ddfy = tmp1y * pre4 + tmp2y * pre5;\n\t\tvar dddfx = tmp2x * pre5, dddfy = tmp2y * pre5;\n\n\t\tvar i = frameIndex * 19/*BEZIER_SIZE*/;\n\t\tvar curves = this.curves;\n\t\tcurves[i++] = 2/*BEZIER*/;\n\n\t\tvar x = dfx, y = dfy;\n for (var n = i + 19/*BEZIER_SIZE*/ - 1; i < n; i += 2)\n {\n\t\t\tcurves[i] = x;\n\t\t\tcurves[i + 1] = y;\n\t\t\tdfx += ddfx;\n\t\t\tdfy += ddfy;\n\t\t\tddfx += dddfx;\n\t\t\tddfy += dddfy;\n\t\t\tx += dfx;\n\t\t\ty += dfy;\n\t\t}\n\t},\n getCurvePercent: function (frameIndex, percent)\n {\n\t\tpercent = percent < 0 ? 0 : (percent > 1 ? 1 : percent);\n\t\tvar curves = this.curves;\n\t\tvar i = frameIndex * 19/*BEZIER_SIZE*/;\n\t\tvar type = curves[i];\n\t\tif (type === 0/*LINEAR*/) return percent;\n\t\tif (type == 1/*STEPPED*/) return 0;\n\t\ti++;\n\t\tvar x = 0;\n for (var start = i, n = i + 19/*BEZIER_SIZE*/ - 1; i < n; i += 2)\n {\n\t\t\tx = curves[i];\n if (x >= percent)\n {\n\t\t\t\tvar prevX, prevY;\n if (i == start)\n {\n\t\t\t\t\tprevX = 0;\n\t\t\t\t\tprevY = 0;\n\t\t\t\t} else {\n\t\t\t\t\tprevX = curves[i - 2];\n\t\t\t\t\tprevY = curves[i - 1];\n\t\t\t\t}\n\t\t\t\treturn prevY + (curves[i + 1] - prevY) * (percent - prevX) / (x - prevX);\n\t\t\t}\n\t\t}\n\t\tvar y = curves[i - 1];\n\t\treturn y + (1 - y) * (percent - x) / (1 - x); // Last point is 1,1.\n\t}\n};\n\nspine.RotateTimeline = function (frameCount)\n{\n\tthis.curves = new spine.Curves(frameCount);\n\tthis.frames = []; // time, angle, ...\n\tthis.frames.length = frameCount * 2;\n};\nspine.RotateTimeline.prototype = {\n\tboneIndex: 0,\n getFrameCount: function ()\n {\n\t\treturn this.frames.length / 2;\n\t},\n setFrame: function (frameIndex, time, angle)\n {\n\t\tframeIndex *= 2;\n\t\tthis.frames[frameIndex] = time;\n\t\tthis.frames[frameIndex + 1] = angle;\n\t},\n apply: function (skeleton, lastTime, time, firedEvents, alpha)\n {\n\t\tvar frames = this.frames;\n\t\tif (time < frames[0]) return; // Time is before first frame.\n\n\t\tvar bone = skeleton.bones[this.boneIndex];\n\n if (time >= frames[frames.length - 2])\n { // Time is after last frame.\n\t\t\tvar amount = bone.data.rotation + frames[frames.length - 1] - bone.rotation;\n\t\t\twhile (amount > 180)\n\t\t\t\tamount -= 360;\n\t\t\twhile (amount < -180)\n\t\t\t\tamount += 360;\n\t\t\tbone.rotation += amount * alpha;\n\t\t\treturn;\n\t\t}\n\n\t\t// Interpolate between the previous frame and the current frame.\n\t\tvar frameIndex = spine.Animation.binarySearch(frames, time, 2);\n\t\tvar prevFrameValue = frames[frameIndex - 1];\n\t\tvar frameTime = frames[frameIndex];\n\t\tvar percent = 1 - (time - frameTime) / (frames[frameIndex - 2/*PREV_FRAME_TIME*/] - frameTime);\n\t\tpercent = this.curves.getCurvePercent(frameIndex / 2 - 1, percent);\n\n\t\tvar amount = frames[frameIndex + 1/*FRAME_VALUE*/] - prevFrameValue;\n\t\twhile (amount > 180)\n\t\t\tamount -= 360;\n\t\twhile (amount < -180)\n\t\t\tamount += 360;\n\t\tamount = bone.data.rotation + (prevFrameValue + amount * percent) - bone.rotation;\n\t\twhile (amount > 180)\n\t\t\tamount -= 360;\n\t\twhile (amount < -180)\n\t\t\tamount += 360;\n\t\tbone.rotation += amount * alpha;\n\t}\n};\n\nspine.TranslateTimeline = function (frameCount)\n{\n\tthis.curves = new spine.Curves(frameCount);\n\tthis.frames = []; // time, x, y, ...\n\tthis.frames.length = frameCount * 3;\n};\nspine.TranslateTimeline.prototype = {\n\tboneIndex: 0,\n getFrameCount: function ()\n {\n\t\treturn this.frames.length / 3;\n\t},\n setFrame: function (frameIndex, time, x, y)\n {\n\t\tframeIndex *= 3;\n\t\tthis.frames[frameIndex] = time;\n\t\tthis.frames[frameIndex + 1] = x;\n\t\tthis.frames[frameIndex + 2] = y;\n\t},\n apply: function (skeleton, lastTime, time, firedEvents, alpha)\n {\n\t\tvar frames = this.frames;\n\t\tif (time < frames[0]) return; // Time is before first frame.\n\n\t\tvar bone = skeleton.bones[this.boneIndex];\n\n if (time >= frames[frames.length - 3])\n { // Time is after last frame.\n\t\t\tbone.x += (bone.data.x + frames[frames.length - 2] - bone.x) * alpha;\n\t\t\tbone.y += (bone.data.y + frames[frames.length - 1] - bone.y) * alpha;\n\t\t\treturn;\n\t\t}\n\n\t\t// Interpolate between the previous frame and the current frame.\n\t\tvar frameIndex = spine.Animation.binarySearch(frames, time, 3);\n\t\tvar prevFrameX = frames[frameIndex - 2];\n\t\tvar prevFrameY = frames[frameIndex - 1];\n\t\tvar frameTime = frames[frameIndex];\n\t\tvar percent = 1 - (time - frameTime) / (frames[frameIndex + -3/*PREV_FRAME_TIME*/] - frameTime);\n\t\tpercent = this.curves.getCurvePercent(frameIndex / 3 - 1, percent);\n\n\t\tbone.x += (bone.data.x + prevFrameX + (frames[frameIndex + 1/*FRAME_X*/] - prevFrameX) * percent - bone.x) * alpha;\n\t\tbone.y += (bone.data.y + prevFrameY + (frames[frameIndex + 2/*FRAME_Y*/] - prevFrameY) * percent - bone.y) * alpha;\n\t}\n};\n\nspine.ScaleTimeline = function (frameCount)\n{\n\tthis.curves = new spine.Curves(frameCount);\n\tthis.frames = []; // time, x, y, ...\n\tthis.frames.length = frameCount * 3;\n};\nspine.ScaleTimeline.prototype = {\n\tboneIndex: 0,\n getFrameCount: function ()\n {\n\t\treturn this.frames.length / 3;\n\t},\n setFrame: function (frameIndex, time, x, y)\n {\n\t\tframeIndex *= 3;\n\t\tthis.frames[frameIndex] = time;\n\t\tthis.frames[frameIndex + 1] = x;\n\t\tthis.frames[frameIndex + 2] = y;\n\t},\n apply: function (skeleton, lastTime, time, firedEvents, alpha)\n {\n\t\tvar frames = this.frames;\n\t\tif (time < frames[0]) return; // Time is before first frame.\n\n\t\tvar bone = skeleton.bones[this.boneIndex];\n\n if (time >= frames[frames.length - 3])\n { // Time is after last frame.\n\t\t\tbone.scaleX += (bone.data.scaleX * frames[frames.length - 2] - bone.scaleX) * alpha;\n\t\t\tbone.scaleY += (bone.data.scaleY * frames[frames.length - 1] - bone.scaleY) * alpha;\n\t\t\treturn;\n\t\t}\n\n\t\t// Interpolate between the previous frame and the current frame.\n\t\tvar frameIndex = spine.Animation.binarySearch(frames, time, 3);\n\t\tvar prevFrameX = frames[frameIndex - 2];\n\t\tvar prevFrameY = frames[frameIndex - 1];\n\t\tvar frameTime = frames[frameIndex];\n\t\tvar percent = 1 - (time - frameTime) / (frames[frameIndex + -3/*PREV_FRAME_TIME*/] - frameTime);\n\t\tpercent = this.curves.getCurvePercent(frameIndex / 3 - 1, percent);\n\n\t\tbone.scaleX += (bone.data.scaleX * (prevFrameX + (frames[frameIndex + 1/*FRAME_X*/] - prevFrameX) * percent) - bone.scaleX) * alpha;\n\t\tbone.scaleY += (bone.data.scaleY * (prevFrameY + (frames[frameIndex + 2/*FRAME_Y*/] - prevFrameY) * percent) - bone.scaleY) * alpha;\n\t}\n};\n\nspine.ColorTimeline = function (frameCount)\n{\n\tthis.curves = new spine.Curves(frameCount);\n\tthis.frames = []; // time, r, g, b, a, ...\n\tthis.frames.length = frameCount * 5;\n};\nspine.ColorTimeline.prototype = {\n\tslotIndex: 0,\n getFrameCount: function ()\n {\n\t\treturn this.frames.length / 5;\n\t},\n setFrame: function (frameIndex, time, r, g, b, a)\n {\n\t\tframeIndex *= 5;\n\t\tthis.frames[frameIndex] = time;\n\t\tthis.frames[frameIndex + 1] = r;\n\t\tthis.frames[frameIndex + 2] = g;\n\t\tthis.frames[frameIndex + 3] = b;\n\t\tthis.frames[frameIndex + 4] = a;\n\t},\n apply: function (skeleton, lastTime, time, firedEvents, alpha)\n {\n\t\tvar frames = this.frames;\n\t\tif (time < frames[0]) return; // Time is before first frame.\n\n\t\tvar r, g, b, a;\n if (time >= frames[frames.length - 5])\n {\n\t\t\t// Time is after last frame.\n\t\t\tvar i = frames.length - 1;\n\t\t\tr = frames[i - 3];\n\t\t\tg = frames[i - 2];\n\t\t\tb = frames[i - 1];\n\t\t\ta = frames[i];\n\t\t} else {\n\t\t\t// Interpolate between the previous frame and the current frame.\n\t\t\tvar frameIndex = spine.Animation.binarySearch(frames, time, 5);\n\t\t\tvar prevFrameR = frames[frameIndex - 4];\n\t\t\tvar prevFrameG = frames[frameIndex - 3];\n\t\t\tvar prevFrameB = frames[frameIndex - 2];\n\t\t\tvar prevFrameA = frames[frameIndex - 1];\n\t\t\tvar frameTime = frames[frameIndex];\n\t\t\tvar percent = 1 - (time - frameTime) / (frames[frameIndex - 5/*PREV_FRAME_TIME*/] - frameTime);\n\t\t\tpercent = this.curves.getCurvePercent(frameIndex / 5 - 1, percent);\n\n\t\t\tr = prevFrameR + (frames[frameIndex + 1/*FRAME_R*/] - prevFrameR) * percent;\n\t\t\tg = prevFrameG + (frames[frameIndex + 2/*FRAME_G*/] - prevFrameG) * percent;\n\t\t\tb = prevFrameB + (frames[frameIndex + 3/*FRAME_B*/] - prevFrameB) * percent;\n\t\t\ta = prevFrameA + (frames[frameIndex + 4/*FRAME_A*/] - prevFrameA) * percent;\n\t\t}\n\t\tvar slot = skeleton.slots[this.slotIndex];\n if (alpha < 1)\n {\n\t\t\tslot.r += (r - slot.r) * alpha;\n\t\t\tslot.g += (g - slot.g) * alpha;\n\t\t\tslot.b += (b - slot.b) * alpha;\n\t\t\tslot.a += (a - slot.a) * alpha;\n\t\t} else {\n\t\t\tslot.r = r;\n\t\t\tslot.g = g;\n\t\t\tslot.b = b;\n\t\t\tslot.a = a;\n\t\t}\n\t}\n};\n\nspine.AttachmentTimeline = function (frameCount)\n{\n\tthis.curves = new spine.Curves(frameCount);\n\tthis.frames = []; // time, ...\n\tthis.frames.length = frameCount;\n\tthis.attachmentNames = [];\n\tthis.attachmentNames.length = frameCount;\n};\nspine.AttachmentTimeline.prototype = {\n\tslotIndex: 0,\n getFrameCount: function ()\n {\n\t\treturn this.frames.length;\n\t},\n setFrame: function (frameIndex, time, attachmentName)\n {\n\t\tthis.frames[frameIndex] = time;\n\t\tthis.attachmentNames[frameIndex] = attachmentName;\n\t},\n apply: function (skeleton, lastTime, time, firedEvents, alpha)\n {\n\t\tvar frames = this.frames;\n if (time < frames[0])\n {\n\t\t\tif (lastTime > time) this.apply(skeleton, lastTime, Number.MAX_VALUE, null, 0);\n\t\t\treturn;\n\t\t} else if (lastTime > time) //\n\t\t\tlastTime = -1;\n\n\t\tvar frameIndex = time >= frames[frames.length - 1] ? frames.length - 1 : spine.Animation.binarySearch1(frames, time) - 1;\n\t\tif (frames[frameIndex] < lastTime) return;\n\n\t\tvar attachmentName = this.attachmentNames[frameIndex];\n\t\tskeleton.slots[this.slotIndex].setAttachment(\n\t\t\t!attachmentName ? null : skeleton.getAttachmentBySlotIndex(this.slotIndex, attachmentName));\n\t}\n};\n\nspine.EventTimeline = function (frameCount)\n{\n\tthis.frames = []; // time, ...\n\tthis.frames.length = frameCount;\n\tthis.events = [];\n\tthis.events.length = frameCount;\n};\nspine.EventTimeline.prototype = {\n getFrameCount: function ()\n {\n\t\treturn this.frames.length;\n\t},\n setFrame: function (frameIndex, time, event)\n {\n\t\tthis.frames[frameIndex] = time;\n\t\tthis.events[frameIndex] = event;\n\t},\n\t/** Fires events for frames > lastTime and <= time. */\n apply: function (skeleton, lastTime, time, firedEvents, alpha)\n {\n\t\tif (!firedEvents) return;\n\n\t\tvar frames = this.frames;\n\t\tvar frameCount = frames.length;\n\n if (lastTime > time)\n { // Fire events after last time for looped animations.\n\t\t\tthis.apply(skeleton, lastTime, Number.MAX_VALUE, firedEvents, alpha);\n\t\t\tlastTime = -1;\n\t\t} else if (lastTime >= frames[frameCount - 1]) // Last time is after last frame.\n\t\t\treturn;\n\t\tif (time < frames[0]) return; // Time is before first frame.\n\n\t\tvar frameIndex;\n\t\tif (lastTime < frames[0])\n\t\t\tframeIndex = 0;\n else\n {\n\t\t\tframeIndex = spine.Animation.binarySearch1(frames, lastTime);\n\t\t\tvar frame = frames[frameIndex];\n while (frameIndex > 0)\n { // Fire multiple events with the same frame.\n\t\t\t\tif (frames[frameIndex - 1] != frame) break;\n\t\t\t\tframeIndex--;\n\t\t\t}\n\t\t}\n\t\tvar events = this.events;\n\t\tfor (; frameIndex < frameCount && time >= frames[frameIndex]; frameIndex++)\n\t\t\tfiredEvents.push(events[frameIndex]);\n\t}\n};\n\nspine.DrawOrderTimeline = function (frameCount)\n{\n\tthis.frames = []; // time, ...\n\tthis.frames.length = frameCount;\n\tthis.drawOrders = [];\n\tthis.drawOrders.length = frameCount;\n};\nspine.DrawOrderTimeline.prototype = {\n getFrameCount: function ()\n {\n\t\treturn this.frames.length;\n\t},\n setFrame: function (frameIndex, time, drawOrder)\n {\n\t\tthis.frames[frameIndex] = time;\n\t\tthis.drawOrders[frameIndex] = drawOrder;\n\t},\n apply: function (skeleton, lastTime, time, firedEvents, alpha)\n {\n\t\tvar frames = this.frames;\n\t\tif (time < frames[0]) return; // Time is before first frame.\n\n\t\tvar frameIndex;\n\t\tif (time >= frames[frames.length - 1]) // Time is after last frame.\n\t\t\tframeIndex = frames.length - 1;\n\t\telse\n\t\t\tframeIndex = spine.Animation.binarySearch1(frames, time) - 1;\n\n\t\tvar drawOrder = skeleton.drawOrder;\n\t\tvar slots = skeleton.slots;\n\t\tvar drawOrderToSetupIndex = this.drawOrders[frameIndex];\n if (!drawOrderToSetupIndex)\n {\n\t\t\tfor (var i = 0, n = slots.length; i < n; i++)\n\t\t\t\tdrawOrder[i] = slots[i];\n\t\t} else {\n\t\t\tfor (var i = 0, n = drawOrderToSetupIndex.length; i < n; i++)\n\t\t\t\tdrawOrder[i] = skeleton.slots[drawOrderToSetupIndex[i]];\n\t\t}\n\n\t}\n};\n\nspine.FfdTimeline = function (frameCount)\n{\n\tthis.curves = new spine.Curves(frameCount);\n\tthis.frames = [];\n\tthis.frames.length = frameCount;\n\tthis.frameVertices = [];\n\tthis.frameVertices.length = frameCount;\n};\nspine.FfdTimeline.prototype = {\n\tslotIndex: 0,\n\tattachment: 0,\n getFrameCount: function ()\n {\n\t\treturn this.frames.length;\n\t},\n setFrame: function (frameIndex, time, vertices)\n {\n\t\tthis.frames[frameIndex] = time;\n\t\tthis.frameVertices[frameIndex] = vertices;\n\t},\n apply: function (skeleton, lastTime, time, firedEvents, alpha)\n {\n\t\tvar slot = skeleton.slots[this.slotIndex];\n\t\tif (slot.attachment != this.attachment) return;\n\n\t\tvar frames = this.frames;\n\t\tif (time < frames[0]) return; // Time is before first frame.\n\n\t\tvar frameVertices = this.frameVertices;\n\t\tvar vertexCount = frameVertices[0].length;\n\n\t\tvar vertices = slot.attachmentVertices;\n\t\tif (vertices.length != vertexCount) alpha = 1;\n\t\tvertices.length = vertexCount;\n\n if (time >= frames[frames.length - 1])\n { // Time is after last frame.\n\t\t\tvar lastVertices = frameVertices[frames.length - 1];\n if (alpha < 1)\n {\n\t\t\t\tfor (var i = 0; i < vertexCount; i++)\n\t\t\t\t\tvertices[i] += (lastVertices[i] - vertices[i]) * alpha;\n\t\t\t} else {\n\t\t\t\tfor (var i = 0; i < vertexCount; i++)\n\t\t\t\t\tvertices[i] = lastVertices[i];\n\t\t\t}\n\t\t\treturn;\n\t\t}\n\n\t\t// Interpolate between the previous frame and the current frame.\n\t\tvar frameIndex = spine.Animation.binarySearch1(frames, time);\n\t\tvar frameTime = frames[frameIndex];\n\t\tvar percent = 1 - (time - frameTime) / (frames[frameIndex - 1] - frameTime);\n\t\tpercent = this.curves.getCurvePercent(frameIndex - 1, percent < 0 ? 0 : (percent > 1 ? 1 : percent));\n\n\t\tvar prevVertices = frameVertices[frameIndex - 1];\n\t\tvar nextVertices = frameVertices[frameIndex];\n\n if (alpha < 1)\n {\n for (var i = 0; i < vertexCount; i++)\n {\n\t\t\t\tvar prev = prevVertices[i];\n\t\t\t\tvertices[i] += (prev + (nextVertices[i] - prev) * percent - vertices[i]) * alpha;\n\t\t\t}\n\t\t} else {\n for (var i = 0; i < vertexCount; i++)\n {\n\t\t\t\tvar prev = prevVertices[i];\n\t\t\t\tvertices[i] = prev + (nextVertices[i] - prev) * percent;\n\t\t\t}\n\t\t}\n\t}\n};\n\nspine.IkConstraintTimeline = function (frameCount)\n{\n\tthis.curves = new spine.Curves(frameCount);\n\tthis.frames = []; // time, mix, bendDirection, ...\n\tthis.frames.length = frameCount * 3;\n};\nspine.IkConstraintTimeline.prototype = {\n\tikConstraintIndex: 0,\n getFrameCount: function ()\n {\n\t\treturn this.frames.length / 3;\n\t},\n setFrame: function (frameIndex, time, mix, bendDirection)\n {\n\t\tframeIndex *= 3;\n\t\tthis.frames[frameIndex] = time;\n\t\tthis.frames[frameIndex + 1] = mix;\n\t\tthis.frames[frameIndex + 2] = bendDirection;\n\t},\n apply: function (skeleton, lastTime, time, firedEvents, alpha)\n {\n\t\tvar frames = this.frames;\n\t\tif (time < frames[0]) return; // Time is before first frame.\n\n\t\tvar ikConstraint = skeleton.ikConstraints[this.ikConstraintIndex];\n\n if (time >= frames[frames.length - 3])\n { // Time is after last frame.\n\t\t\tikConstraint.mix += (frames[frames.length - 2] - ikConstraint.mix) * alpha;\n\t\t\tikConstraint.bendDirection = frames[frames.length - 1];\n\t\t\treturn;\n\t\t}\n\n\t\t// Interpolate between the previous frame and the current frame.\n\t\tvar frameIndex = spine.Animation.binarySearch(frames, time, 3);\n\t\tvar prevFrameMix = frames[frameIndex + -2/*PREV_FRAME_MIX*/];\n\t\tvar frameTime = frames[frameIndex];\n\t\tvar percent = 1 - (time - frameTime) / (frames[frameIndex + -3/*PREV_FRAME_TIME*/] - frameTime);\n\t\tpercent = this.curves.getCurvePercent(frameIndex / 3 - 1, percent);\n\n\t\tvar mix = prevFrameMix + (frames[frameIndex + 1/*FRAME_MIX*/] - prevFrameMix) * percent;\n\t\tikConstraint.mix += (mix - ikConstraint.mix) * alpha;\n\t\tikConstraint.bendDirection = frames[frameIndex + -1/*PREV_FRAME_BEND_DIRECTION*/];\n\t}\n};\n\nspine.FlipXTimeline = function (frameCount)\n{\n\tthis.curves = new spine.Curves(frameCount);\n\tthis.frames = []; // time, flip, ...\n\tthis.frames.length = frameCount * 2;\n};\nspine.FlipXTimeline.prototype = {\n\tboneIndex: 0,\n getFrameCount: function ()\n {\n\t\treturn this.frames.length / 2;\n\t},\n setFrame: function (frameIndex, time, flip)\n {\n\t\tframeIndex *= 2;\n\t\tthis.frames[frameIndex] = time;\n\t\tthis.frames[frameIndex + 1] = flip ? 1 : 0;\n\t},\n apply: function (skeleton, lastTime, time, firedEvents, alpha)\n {\n\t\tvar frames = this.frames;\n if (time < frames[0])\n {\n\t\t\tif (lastTime > time) this.apply(skeleton, lastTime, Number.MAX_VALUE, null, 0);\n\t\t\treturn;\n\t\t} else if (lastTime > time) //\n\t\t\tlastTime = -1;\n\t\tvar frameIndex = (time >= frames[frames.length - 2] ? frames.length : spine.Animation.binarySearch(frames, time, 2)) - 2;\n\t\tif (frames[frameIndex] < lastTime) return;\n\t\tskeleton.bones[boneIndex].flipX = frames[frameIndex + 1] != 0;\n\t}\n};\n\nspine.FlipYTimeline = function (frameCount)\n{\n\tthis.curves = new spine.Curves(frameCount);\n\tthis.frames = []; // time, flip, ...\n\tthis.frames.length = frameCount * 2;\n};\nspine.FlipYTimeline.prototype = {\n\tboneIndex: 0,\n getFrameCount: function ()\n {\n\t\treturn this.frames.length / 2;\n\t},\n setFrame: function (frameIndex, time, flip)\n {\n\t\tframeIndex *= 2;\n\t\tthis.frames[frameIndex] = time;\n\t\tthis.frames[frameIndex + 1] = flip ? 1 : 0;\n\t},\n apply: function (skeleton, lastTime, time, firedEvents, alpha)\n {\n\t\tvar frames = this.frames;\n if (time < frames[0])\n {\n\t\t\tif (lastTime > time) this.apply(skeleton, lastTime, Number.MAX_VALUE, null, 0);\n\t\t\treturn;\n\t\t} else if (lastTime > time) //\n\t\t\tlastTime = -1;\n\t\tvar frameIndex = (time >= frames[frames.length - 2] ? frames.length : spine.Animation.binarySearch(frames, time, 2)) - 2;\n\t\tif (frames[frameIndex] < lastTime) return;\n\t\tskeleton.bones[boneIndex].flipY = frames[frameIndex + 1] != 0;\n\t}\n};\n\nspine.SkeletonData = function ()\n{\n\tthis.bones = [];\n\tthis.slots = [];\n\tthis.skins = [];\n\tthis.events = [];\n\tthis.animations = [];\n\tthis.ikConstraints = [];\n};\nspine.SkeletonData.prototype = {\n\tname: null,\n\tdefaultSkin: null,\n\twidth: 0, height: 0,\n\tversion: null, hash: null,\n\t/** @return May be null. */\n findBone: function (boneName)\n {\n\t\tvar bones = this.bones;\n\t\tfor (var i = 0, n = bones.length; i < n; i++)\n\t\t\tif (bones[i].name == boneName) return bones[i];\n\t\treturn null;\n\t},\n\t/** @return -1 if the bone was not found. */\n findBoneIndex: function (boneName)\n {\n\t\tvar bones = this.bones;\n\t\tfor (var i = 0, n = bones.length; i < n; i++)\n\t\t\tif (bones[i].name == boneName) return i;\n\t\treturn -1;\n\t},\n\t/** @return May be null. */\n findSlot: function (slotName)\n {\n\t\tvar slots = this.slots;\n for (var i = 0, n = slots.length; i < n; i++)\n {\n\t\t\tif (slots[i].name == slotName) return slot[i];\n\t\t}\n\t\treturn null;\n\t},\n\t/** @return -1 if the bone was not found. */\n findSlotIndex: function (slotName)\n {\n\t\tvar slots = this.slots;\n\t\tfor (var i = 0, n = slots.length; i < n; i++)\n\t\t\tif (slots[i].name == slotName) return i;\n\t\treturn -1;\n\t},\n\t/** @return May be null. */\n findSkin: function (skinName)\n {\n\t\tvar skins = this.skins;\n\t\tfor (var i = 0, n = skins.length; i < n; i++)\n\t\t\tif (skins[i].name == skinName) return skins[i];\n\t\treturn null;\n\t},\n\t/** @return May be null. */\n findEvent: function (eventName)\n {\n\t\tvar events = this.events;\n\t\tfor (var i = 0, n = events.length; i < n; i++)\n\t\t\tif (events[i].name == eventName) return events[i];\n\t\treturn null;\n\t},\n\t/** @return May be null. */\n findAnimation: function (animationName)\n {\n\t\tvar animations = this.animations;\n\t\tfor (var i = 0, n = animations.length; i < n; i++)\n\t\t\tif (animations[i].name == animationName) return animations[i];\n\t\treturn null;\n\t},\n\t/** @return May be null. */\n findIkConstraint: function (ikConstraintName)\n {\n\t\tvar ikConstraints = this.ikConstraints;\n\t\tfor (var i = 0, n = ikConstraints.length; i < n; i++)\n\t\t\tif (ikConstraints[i].name == ikConstraintName) return ikConstraints[i];\n\t\treturn null;\n\t}\n};\n\nspine.Skeleton = function (skeletonData)\n{\n\tthis.data = skeletonData;\n\n\tthis.bones = [];\n for (var i = 0, n = skeletonData.bones.length; i < n; i++)\n {\n\t\tvar boneData = skeletonData.bones[i];\n\t\tvar parent = !boneData.parent ? null : this.bones[skeletonData.bones.indexOf(boneData.parent)];\n\t\tthis.bones.push(new spine.Bone(boneData, this, parent));\n\t}\n\n\tthis.slots = [];\n\tthis.drawOrder = [];\n for (var i = 0, n = skeletonData.slots.length; i < n; i++)\n {\n\t\tvar slotData = skeletonData.slots[i];\n\t\tvar bone = this.bones[skeletonData.bones.indexOf(slotData.boneData)];\n\t\tvar slot = new spine.Slot(slotData, bone);\n\t\tthis.slots.push(slot);\n\t\tthis.drawOrder.push(slot);\n\t}\n\n\tthis.ikConstraints = [];\n\tfor (var i = 0, n = skeletonData.ikConstraints.length; i < n; i++)\n\t\tthis.ikConstraints.push(new spine.IkConstraint(skeletonData.ikConstraints[i], this));\n\n\tthis.boneCache = [];\n\tthis.updateCache();\n};\nspine.Skeleton.prototype = {\n\tx: 0, y: 0,\n\tskin: null,\n\tr: 1, g: 1, b: 1, a: 1,\n\ttime: 0,\n\tflipX: false, flipY: false,\n\t/** Caches information about bones and IK constraints. Must be called if bones or IK constraints are added or removed. */\n updateCache: function ()\n {\n\t\tvar ikConstraints = this.ikConstraints;\n\t\tvar ikConstraintsCount = ikConstraints.length;\n\n\t\tvar arrayCount = ikConstraintsCount + 1;\n\t\tvar boneCache = this.boneCache;\n\t\tif (boneCache.length > arrayCount) boneCache.length = arrayCount;\n\t\tfor (var i = 0, n = boneCache.length; i < n; i++)\n\t\t\tboneCache[i].length = 0;\n\t\twhile (boneCache.length < arrayCount)\n\t\t\tboneCache[boneCache.length] = [];\n\n\t\tvar nonIkBones = boneCache[0];\n\t\tvar bones = this.bones;\n\n\t\touter:\n for (var i = 0, n = bones.length; i < n; i++)\n {\n\t\t\tvar bone = bones[i];\n\t\t\tvar current = bone;\n\t\t\tdo {\n for (var ii = 0; ii < ikConstraintsCount; ii++)\n {\n\t\t\t\t\tvar ikConstraint = ikConstraints[ii];\n\t\t\t\t\tvar parent = ikConstraint.bones[0];\n\t\t\t\t\tvar child= ikConstraint.bones[ikConstraint.bones.length - 1];\n while (true)\n {\n if (current == child)\n {\n\t\t\t\t\t\t\tboneCache[ii].push(bone);\n\t\t\t\t\t\t\tboneCache[ii + 1].push(bone);\n\t\t\t\t\t\t\tcontinue outer;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif (child == parent) break;\n\t\t\t\t\t\tchild = child.parent;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tcurrent = current.parent;\n\t\t\t} while (current);\n\t\t\tnonIkBones[nonIkBones.length] = bone;\n\t\t}\n\t},\n\t/** Updates the world transform for each bone. */\n updateWorldTransform: function ()\n {\n\t\tvar bones = this.bones;\n for (var i = 0, n = bones.length; i < n; i++)\n {\n\t\t\tvar bone = bones[i];\n\t\t\tbone.rotationIK = bone.rotation;\n\t\t}\n\t\tvar i = 0, last = this.boneCache.length - 1;\n while (true)\n {\n\t\t\tvar cacheBones = this.boneCache[i];\n\t\t\tfor (var ii = 0, nn = cacheBones.length; ii < nn; ii++)\n\t\t\t\tcacheBones[ii].updateWorldTransform();\n\t\t\tif (i == last) break;\n\t\t\tthis.ikConstraints[i].apply();\n\t\t\ti++;\n\t\t}\n\t},\n\t/** Sets the bones and slots to their setup pose values. */\n setToSetupPose: function ()\n {\n\t\tthis.setBonesToSetupPose();\n\t\tthis.setSlotsToSetupPose();\n\t},\n setBonesToSetupPose: function ()\n {\n\t\tvar bones = this.bones;\n\t\tfor (var i = 0, n = bones.length; i < n; i++)\n\t\t\tbones[i].setToSetupPose();\n\n\t\tvar ikConstraints = this.ikConstraints;\n for (var i = 0, n = ikConstraints.length; i < n; i++)\n {\n\t\t\tvar ikConstraint = ikConstraints[i];\n\t\t\tikConstraint.bendDirection = ikConstraint.data.bendDirection;\n\t\t\tikConstraint.mix = ikConstraint.data.mix;\n\t\t}\n\t},\n setSlotsToSetupPose: function ()\n {\n\t\tvar slots = this.slots;\n\t\tvar drawOrder = this.drawOrder;\n for (var i = 0, n = slots.length; i < n; i++)\n {\n\t\t\tdrawOrder[i] = slots[i];\n\t\t\tslots[i].setToSetupPose(i);\n\t\t}\n\t},\n\t/** @return May return null. */\n getRootBone: function ()\n {\n\t\treturn this.bones.length ? this.bones[0] : null;\n\t},\n\t/** @return May be null. */\n findBone: function (boneName)\n {\n\t\tvar bones = this.bones;\n\t\tfor (var i = 0, n = bones.length; i < n; i++)\n\t\t\tif (bones[i].data.name == boneName) return bones[i];\n\t\treturn null;\n\t},\n\t/** @return -1 if the bone was not found. */\n findBoneIndex: function (boneName)\n {\n\t\tvar bones = this.bones;\n\t\tfor (var i = 0, n = bones.length; i < n; i++)\n\t\t\tif (bones[i].data.name == boneName) return i;\n\t\treturn -1;\n\t},\n\t/** @return May be null. */\n findSlot: function (slotName)\n {\n\t\tvar slots = this.slots;\n\t\tfor (var i = 0, n = slots.length; i < n; i++)\n\t\t\tif (slots[i].data.name == slotName) return slots[i];\n\t\treturn null;\n\t},\n\t/** @return -1 if the bone was not found. */\n findSlotIndex: function (slotName)\n {\n\t\tvar slots = this.slots;\n\t\tfor (var i = 0, n = slots.length; i < n; i++)\n\t\t\tif (slots[i].data.name == slotName) return i;\n\t\treturn -1;\n\t},\n setSkinByName: function (skinName)\n {\n\t\tvar skin = this.data.findSkin(skinName);\n\t\tif (!skin) throw \"Skin not found: \" + skinName;\n\t\tthis.setSkin(skin);\n\t},\n\t/** Sets the skin used to look up attachments before looking in the {@link SkeletonData#getDefaultSkin() default skin}.\n\t * Attachments from the new skin are attached if the corresponding attachment from the old skin was attached. If there was\n\t * no old skin, each slot's setup mode attachment is attached from the new skin.\n\t * @param newSkin May be null. */\n setSkin: function (newSkin)\n {\n if (newSkin)\n {\n\t\t\tif (this.skin)\n\t\t\t\tnewSkin._attachAll(this, this.skin);\n else\n {\n\t\t\t\tvar slots = this.slots;\n for (var i = 0, n = slots.length; i < n; i++)\n {\n\t\t\t\t\tvar slot = slots[i];\n\t\t\t\t\tvar name = slot.data.attachmentName;\n if (name)\n {\n\t\t\t\t\t\tvar attachment = newSkin.getAttachment(i, name);\n\t\t\t\t\t\tif (attachment) slot.setAttachment(attachment);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tthis.skin = newSkin;\n\t},\n\t/** @return May be null. */\n getAttachmentBySlotName: function (slotName, attachmentName)\n {\n\t\treturn this.getAttachmentBySlotIndex(this.data.findSlotIndex(slotName), attachmentName);\n\t},\n\t/** @return May be null. */\n getAttachmentBySlotIndex: function (slotIndex, attachmentName)\n {\n if (this.skin)\n {\n\t\t\tvar attachment = this.skin.getAttachment(slotIndex, attachmentName);\n\t\t\tif (attachment) return attachment;\n\t\t}\n\t\tif (this.data.defaultSkin) return this.data.defaultSkin.getAttachment(slotIndex, attachmentName);\n\t\treturn null;\n\t},\n\t/** @param attachmentName May be null. */\n setAttachment: function (slotName, attachmentName)\n {\n\t\tvar slots = this.slots;\n for (var i = 0, n = slots.length; i < n; i++)\n {\n\t\t\tvar slot = slots[i];\n if (slot.data.name == slotName)\n {\n\t\t\t\tvar attachment = null;\n if (attachmentName)\n {\n\t\t\t\t\tattachment = this.getAttachmentBySlotIndex(i, attachmentName);\n\t\t\t\t\tif (!attachment) throw \"Attachment not found: \" + attachmentName + \", for slot: \" + slotName;\n\t\t\t\t}\n\t\t\t\tslot.setAttachment(attachment);\n\t\t\t\treturn;\n\t\t\t}\n\t\t}\n\t\tthrow \"Slot not found: \" + slotName;\n\t},\n\t/** @return May be null. */\n findIkConstraint: function (ikConstraintName)\n {\n\t\tvar ikConstraints = this.ikConstraints;\n\t\tfor (var i = 0, n = ikConstraints.length; i < n; i++)\n\t\t\tif (ikConstraints[i].data.name == ikConstraintName) return ikConstraints[i];\n\t\treturn null;\n\t},\n update: function (delta)\n {\n\t\tthis.time += delta;\n\t}\n};\n\nspine.EventData = function (name)\n{\n\tthis.name = name;\n};\nspine.EventData.prototype = {\n\tintValue: 0,\n\tfloatValue: 0,\n\tstringValue: null\n};\n\nspine.Event = function (data)\n{\n\tthis.data = data;\n};\nspine.Event.prototype = {\n\tintValue: 0,\n\tfloatValue: 0,\n\tstringValue: null\n};\n\nspine.AttachmentType = {\n\tregion: 0,\n\tboundingbox: 1,\n\tmesh: 2,\n\tskinnedmesh: 3\n};\n\nspine.RegionAttachment = function (name)\n{\n\tthis.name = name;\n\tthis.offset = [];\n\tthis.offset.length = 8;\n\tthis.uvs = [];\n\tthis.uvs.length = 8;\n};\nspine.RegionAttachment.prototype = {\n\ttype: spine.AttachmentType.region,\n\tx: 0, y: 0,\n\trotation: 0,\n\tscaleX: 1, scaleY: 1,\n\twidth: 0, height: 0,\n\tr: 1, g: 1, b: 1, a: 1,\n\tpath: null,\n\trendererObject: null,\n\tregionOffsetX: 0, regionOffsetY: 0,\n\tregionWidth: 0, regionHeight: 0,\n\tregionOriginalWidth: 0, regionOriginalHeight: 0,\n setUVs: function (u, v, u2, v2, rotate)\n {\n\t\tvar uvs = this.uvs;\n if (rotate)\n {\n\t\t\tuvs[2/*X2*/] = u;\n\t\t\tuvs[3/*Y2*/] = v2;\n\t\t\tuvs[4/*X3*/] = u;\n\t\t\tuvs[5/*Y3*/] = v;\n\t\t\tuvs[6/*X4*/] = u2;\n\t\t\tuvs[7/*Y4*/] = v;\n\t\t\tuvs[0/*X1*/] = u2;\n\t\t\tuvs[1/*Y1*/] = v2;\n\t\t} else {\n\t\t\tuvs[0/*X1*/] = u;\n\t\t\tuvs[1/*Y1*/] = v2;\n\t\t\tuvs[2/*X2*/] = u;\n\t\t\tuvs[3/*Y2*/] = v;\n\t\t\tuvs[4/*X3*/] = u2;\n\t\t\tuvs[5/*Y3*/] = v;\n\t\t\tuvs[6/*X4*/] = u2;\n\t\t\tuvs[7/*Y4*/] = v2;\n\t\t}\n\t},\n updateOffset: function ()\n {\n\t\tvar regionScaleX = this.width / this.regionOriginalWidth * this.scaleX;\n\t\tvar regionScaleY = this.height / this.regionOriginalHeight * this.scaleY;\n\t\tvar localX = -this.width / 2 * this.scaleX + this.regionOffsetX * regionScaleX;\n\t\tvar localY = -this.height / 2 * this.scaleY + this.regionOffsetY * regionScaleY;\n\t\tvar localX2 = localX + this.regionWidth * regionScaleX;\n\t\tvar localY2 = localY + this.regionHeight * regionScaleY;\n\t\tvar radians = this.rotation * spine.degRad;\n\t\tvar cos = Math.cos(radians);\n\t\tvar sin = Math.sin(radians);\n\t\tvar localXCos = localX * cos + this.x;\n\t\tvar localXSin = localX * sin;\n\t\tvar localYCos = localY * cos + this.y;\n\t\tvar localYSin = localY * sin;\n\t\tvar localX2Cos = localX2 * cos + this.x;\n\t\tvar localX2Sin = localX2 * sin;\n\t\tvar localY2Cos = localY2 * cos + this.y;\n\t\tvar localY2Sin = localY2 * sin;\n\t\tvar offset = this.offset;\n\t\toffset[0/*X1*/] = localXCos - localYSin;\n\t\toffset[1/*Y1*/] = localYCos + localXSin;\n\t\toffset[2/*X2*/] = localXCos - localY2Sin;\n\t\toffset[3/*Y2*/] = localY2Cos + localXSin;\n\t\toffset[4/*X3*/] = localX2Cos - localY2Sin;\n\t\toffset[5/*Y3*/] = localY2Cos + localX2Sin;\n\t\toffset[6/*X4*/] = localX2Cos - localYSin;\n\t\toffset[7/*Y4*/] = localYCos + localX2Sin;\n\t},\n computeVertices: function (x, y, bone, vertices)\n {\n\t\tx += bone.worldX;\n\t\ty += bone.worldY;\n\t\tvar m00 = bone.m00, m01 = bone.m01, m10 = bone.m10, m11 = bone.m11;\n\t\tvar offset = this.offset;\n\t\tvertices[0/*X1*/] = offset[0/*X1*/] * m00 + offset[1/*Y1*/] * m01 + x;\n\t\tvertices[1/*Y1*/] = offset[0/*X1*/] * m10 + offset[1/*Y1*/] * m11 + y;\n\t\tvertices[2/*X2*/] = offset[2/*X2*/] * m00 + offset[3/*Y2*/] * m01 + x;\n\t\tvertices[3/*Y2*/] = offset[2/*X2*/] * m10 + offset[3/*Y2*/] * m11 + y;\n\t\tvertices[4/*X3*/] = offset[4/*X3*/] * m00 + offset[5/*X3*/] * m01 + x;\n\t\tvertices[5/*X3*/] = offset[4/*X3*/] * m10 + offset[5/*X3*/] * m11 + y;\n\t\tvertices[6/*X4*/] = offset[6/*X4*/] * m00 + offset[7/*Y4*/] * m01 + x;\n\t\tvertices[7/*Y4*/] = offset[6/*X4*/] * m10 + offset[7/*Y4*/] * m11 + y;\n\t}\n};\n\nspine.MeshAttachment = function (name)\n{\n\tthis.name = name;\n};\nspine.MeshAttachment.prototype = {\n\ttype: spine.AttachmentType.mesh,\n\tvertices: null,\n\tuvs: null,\n\tregionUVs: null,\n\ttriangles: null,\n\thullLength: 0,\n\tr: 1, g: 1, b: 1, a: 1,\n\tpath: null,\n\trendererObject: null,\n\tregionU: 0, regionV: 0, regionU2: 0, regionV2: 0, regionRotate: false,\n\tregionOffsetX: 0, regionOffsetY: 0,\n\tregionWidth: 0, regionHeight: 0,\n\tregionOriginalWidth: 0, regionOriginalHeight: 0,\n\tedges: null,\n\twidth: 0, height: 0,\n updateUVs: function ()\n {\n\t\tvar width = this.regionU2 - this.regionU, height = this.regionV2 - this.regionV;\n\t\tvar n = this.regionUVs.length;\n if (!this.uvs || this.uvs.length != n)\n {\n this.uvs = new spine.Float32Array(n);\n\t\t}\n if (this.regionRotate)\n {\n for (var i = 0; i < n; i += 2)\n {\n this.uvs[i] = this.regionU + this.regionUVs[i + 1] * width;\n this.uvs[i + 1] = this.regionV + height - this.regionUVs[i] * height;\n\t\t\t}\n\t\t} else {\n for (var i = 0; i < n; i += 2)\n {\n this.uvs[i] = this.regionU + this.regionUVs[i] * width;\n this.uvs[i + 1] = this.regionV + this.regionUVs[i + 1] * height;\n\t\t\t}\n\t\t}\n\t},\n computeWorldVertices: function (x, y, slot, worldVertices)\n {\n\t\tvar bone = slot.bone;\n\t\tx += bone.worldX;\n\t\ty += bone.worldY;\n\t\tvar m00 = bone.m00, m01 = bone.m01, m10 = bone.m10, m11 = bone.m11;\n\t\tvar vertices = this.vertices;\n\t\tvar verticesCount = vertices.length;\n\t\tif (slot.attachmentVertices.length == verticesCount) vertices = slot.attachmentVertices;\n for (var i = 0; i < verticesCount; i += 2)\n {\n\t\t\tvar vx = vertices[i];\n\t\t\tvar vy = vertices[i + 1];\n\t\t\tworldVertices[i] = vx * m00 + vy * m01 + x;\n\t\t\tworldVertices[i + 1] = vx * m10 + vy * m11 + y;\n\t\t}\n\t}\n};\n\nspine.SkinnedMeshAttachment = function (name)\n{\n\tthis.name = name;\n};\nspine.SkinnedMeshAttachment.prototype = {\n\ttype: spine.AttachmentType.skinnedmesh,\n\tbones: null,\n\tweights: null,\n\tuvs: null,\n\tregionUVs: null,\n\ttriangles: null,\n\thullLength: 0,\n\tr: 1, g: 1, b: 1, a: 1,\n\tpath: null,\n\trendererObject: null,\n\tregionU: 0, regionV: 0, regionU2: 0, regionV2: 0, regionRotate: false,\n\tregionOffsetX: 0, regionOffsetY: 0,\n\tregionWidth: 0, regionHeight: 0,\n\tregionOriginalWidth: 0, regionOriginalHeight: 0,\n\tedges: null,\n\twidth: 0, height: 0,\n updateUVs: function (u, v, u2, v2, rotate)\n {\n\t\tvar width = this.regionU2 - this.regionU, height = this.regionV2 - this.regionV;\n\t\tvar n = this.regionUVs.length;\n if (!this.uvs || this.uvs.length != n)\n {\n this.uvs = new spine.Float32Array(n);\n\t\t}\n if (this.regionRotate)\n {\n for (var i = 0; i < n; i += 2)\n {\n this.uvs[i] = this.regionU + this.regionUVs[i + 1] * width;\n this.uvs[i + 1] = this.regionV + height - this.regionUVs[i] * height;\n\t\t\t}\n\t\t} else {\n for (var i = 0; i < n; i += 2)\n {\n this.uvs[i] = this.regionU + this.regionUVs[i] * width;\n this.uvs[i + 1] = this.regionV + this.regionUVs[i + 1] * height;\n\t\t\t}\n\t\t}\n\t},\n computeWorldVertices: function (x, y, slot, worldVertices)\n {\n\t\tvar skeletonBones = slot.bone.skeleton.bones;\n\t\tvar weights = this.weights;\n\t\tvar bones = this.bones;\n\n\t\tvar w = 0, v = 0, b = 0, f = 0, n = bones.length, nn;\n\t\tvar wx, wy, bone, vx, vy, weight;\n if (!slot.attachmentVertices.length)\n {\n for (; v < n; w += 2)\n {\n\t\t\t\twx = 0;\n\t\t\t\twy = 0;\n\t\t\t\tnn = bones[v++] + v;\n for (; v < nn; v++, b += 3)\n {\n\t\t\t\t\tbone = skeletonBones[bones[v]];\n\t\t\t\t\tvx = weights[b];\n\t\t\t\t\tvy = weights[b + 1];\n\t\t\t\t\tweight = weights[b + 2];\n\t\t\t\t\twx += (vx * bone.m00 + vy * bone.m01 + bone.worldX) * weight;\n\t\t\t\t\twy += (vx * bone.m10 + vy * bone.m11 + bone.worldY) * weight;\n\t\t\t\t}\n\t\t\t\tworldVertices[w] = wx + x;\n\t\t\t\tworldVertices[w + 1] = wy + y;\n\t\t\t}\n\t\t} else {\n\t\t\tvar ffd = slot.attachmentVertices;\n for (; v < n; w += 2)\n {\n\t\t\t\twx = 0;\n\t\t\t\twy = 0;\n\t\t\t\tnn = bones[v++] + v;\n for (; v < nn; v++, b += 3, f += 2)\n {\n\t\t\t\t\tbone = skeletonBones[bones[v]];\n\t\t\t\t\tvx = weights[b] + ffd[f];\n\t\t\t\t\tvy = weights[b + 1] + ffd[f + 1];\n\t\t\t\t\tweight = weights[b + 2];\n\t\t\t\t\twx += (vx * bone.m00 + vy * bone.m01 + bone.worldX) * weight;\n\t\t\t\t\twy += (vx * bone.m10 + vy * bone.m11 + bone.worldY) * weight;\n\t\t\t\t}\n\t\t\t\tworldVertices[w] = wx + x;\n\t\t\t\tworldVertices[w + 1] = wy + y;\n\t\t\t}\n\t\t}\n\t}\n};\n\nspine.BoundingBoxAttachment = function (name)\n{\n\tthis.name = name;\n\tthis.vertices = [];\n};\nspine.BoundingBoxAttachment.prototype = {\n\ttype: spine.AttachmentType.boundingbox,\n computeWorldVertices: function (x, y, bone, worldVertices)\n {\n\t\tx += bone.worldX;\n\t\ty += bone.worldY;\n\t\tvar m00 = bone.m00, m01 = bone.m01, m10 = bone.m10, m11 = bone.m11;\n\t\tvar vertices = this.vertices;\n for (var i = 0, n = vertices.length; i < n; i += 2)\n {\n\t\t\tvar px = vertices[i];\n\t\t\tvar py = vertices[i + 1];\n\t\t\tworldVertices[i] = px * m00 + py * m01 + x;\n\t\t\tworldVertices[i + 1] = px * m10 + py * m11 + y;\n\t\t}\n\t}\n};\n\nspine.AnimationStateData = function (skeletonData)\n{\n\tthis.skeletonData = skeletonData;\n\tthis.animationToMixTime = {};\n};\nspine.AnimationStateData.prototype = {\n\tdefaultMix: 0,\n setMixByName: function (fromName, toName, duration)\n {\n\t\tvar from = this.skeletonData.findAnimation(fromName);\n\t\tif (!from) throw \"Animation not found: \" + fromName;\n\t\tvar to = this.skeletonData.findAnimation(toName);\n\t\tif (!to) throw \"Animation not found: \" + toName;\n\t\tthis.setMix(from, to, duration);\n\t},\n setMix: function (from, to, duration)\n {\n\t\tthis.animationToMixTime[from.name + \":\" + to.name] = duration;\n\t},\n getMix: function (from, to)\n {\n\t\tvar key = from.name + \":\" + to.name;\n\t\treturn this.animationToMixTime.hasOwnProperty(key) ? this.animationToMixTime[key] : this.defaultMix;\n\t}\n};\n\nspine.TrackEntry = function ()\n{};\nspine.TrackEntry.prototype = {\n\tnext: null, previous: null,\n\tanimation: null,\n\tloop: false,\n\tdelay: 0, time: 0, lastTime: -1, endTime: 0,\n\ttimeScale: 1,\n\tmixTime: 0, mixDuration: 0, mix: 1,\n\tonStart: null, onEnd: null, onComplete: null, onEvent: null\n};\n\nspine.AnimationState = function (stateData)\n{\n\tthis.data = stateData;\n\tthis.tracks = [];\n\tthis.events = [];\n};\nspine.AnimationState.prototype = {\n\tonStart: null,\n\tonEnd: null,\n\tonComplete: null,\n\tonEvent: null,\n\ttimeScale: 1,\n update: function (delta)\n {\n\t\tdelta *= this.timeScale;\n for (var i = 0; i < this.tracks.length; i++)\n {\n\t\t\tvar current = this.tracks[i];\n\t\t\tif (!current) continue;\n\n\t\t\tcurrent.time += delta * current.timeScale;\n if (current.previous)\n {\n\t\t\t\tvar previousDelta = delta * current.previous.timeScale;\n\t\t\t\tcurrent.previous.time += previousDelta;\n\t\t\t\tcurrent.mixTime += previousDelta;\n\t\t\t}\n\n\t\t\tvar next = current.next;\n if (next)\n {\n\t\t\t\tnext.time = current.lastTime - next.delay;\n\t\t\t\tif (next.time >= 0) this.setCurrent(i, next);\n\t\t\t} else {\n\t\t\t\t// End non-looping animation when it reaches its end time and there is no next entry.\n\t\t\t\tif (!current.loop && current.lastTime >= current.endTime) this.clearTrack(i);\n\t\t\t}\n\t\t}\n\t},\n apply: function (skeleton)\n {\n for (var i = 0; i < this.tracks.length; i++)\n {\n\t\t\tvar current = this.tracks[i];\n\t\t\tif (!current) continue;\n\n\t\t\tthis.events.length = 0;\n\n\t\t\tvar time = current.time;\n\t\t\tvar lastTime = current.lastTime;\n\t\t\tvar endTime = current.endTime;\n\t\t\tvar loop = current.loop;\n\t\t\tif (!loop && time > endTime) time = endTime;\n\n\t\t\tvar previous = current.previous;\n if (!previous)\n {\n\t\t\t\tif (current.mix == 1)\n\t\t\t\t\tcurrent.animation.apply(skeleton, current.lastTime, time, loop, this.events);\n\t\t\t\telse\n\t\t\t\t\tcurrent.animation.mix(skeleton, current.lastTime, time, loop, this.events, current.mix);\n\t\t\t} else {\n\t\t\t\tvar previousTime = previous.time;\n\t\t\t\tif (!previous.loop && previousTime > previous.endTime) previousTime = previous.endTime;\n\t\t\t\tprevious.animation.apply(skeleton, previousTime, previousTime, previous.loop, null);\n\n\t\t\t\tvar alpha = current.mixTime / current.mixDuration * current.mix;\n if (alpha >= 1)\n {\n\t\t\t\t\talpha = 1;\n\t\t\t\t\tcurrent.previous = null;\n\t\t\t\t}\n\t\t\t\tcurrent.animation.mix(skeleton, current.lastTime, time, loop, this.events, alpha);\n\t\t\t}\n\n for (var ii = 0, nn = this.events.length; ii < nn; ii++)\n {\n\t\t\t\tvar event = this.events[ii];\n\t\t\t\tif (current.onEvent) current.onEvent(i, event);\n\t\t\t\tif (this.onEvent) this.onEvent(i, event);\n\t\t\t}\n\n\t\t\t// Check if completed the animation or a loop iteration.\n if (loop ? (lastTime % endTime > time % endTime) : (lastTime < endTime && time >= endTime))\n {\n\t\t\t\tvar count = Math.floor(time / endTime);\n\t\t\t\tif (current.onComplete) current.onComplete(i, count);\n\t\t\t\tif (this.onComplete) this.onComplete(i, count);\n\t\t\t}\n\n\t\t\tcurrent.lastTime = current.time;\n\t\t}\n\t},\n clearTracks: function ()\n {\n\t\tfor (var i = 0, n = this.tracks.length; i < n; i++)\n\t\t\tthis.clearTrack(i);\n\t\tthis.tracks.length = 0;\n\t},\n clearTrack: function (trackIndex)\n {\n\t\tif (trackIndex >= this.tracks.length) return;\n\t\tvar current = this.tracks[trackIndex];\n\t\tif (!current) return;\n\n\t\tif (current.onEnd) current.onEnd(trackIndex);\n\t\tif (this.onEnd) this.onEnd(trackIndex);\n\n\t\tthis.tracks[trackIndex] = null;\n\t},\n _expandToIndex: function (index)\n {\n\t\tif (index < this.tracks.length) return this.tracks[index];\n\t\twhile (index >= this.tracks.length)\n\t\t\tthis.tracks.push(null);\n\t\treturn null;\n\t},\n setCurrent: function (index, entry)\n {\n\t\tvar current = this._expandToIndex(index);\n if (current)\n {\n\t\t\tvar previous = current.previous;\n\t\t\tcurrent.previous = null;\n\n\t\t\tif (current.onEnd) current.onEnd(index);\n\t\t\tif (this.onEnd) this.onEnd(index);\n\n\t\t\tentry.mixDuration = this.data.getMix(current.animation, entry.animation);\n if (entry.mixDuration > 0)\n {\n\t\t\t\tentry.mixTime = 0;\n\t\t\t\t// If a mix is in progress, mix from the closest animation.\n\t\t\t\tif (previous && current.mixTime / current.mixDuration < 0.5)\n\t\t\t\t\tentry.previous = previous;\n\t\t\t\telse\n\t\t\t\t\tentry.previous = current;\n\t\t\t}\n\t\t}\n\n\t\tthis.tracks[index] = entry;\n\n\t\tif (entry.onStart) entry.onStart(index);\n\t\tif (this.onStart) this.onStart(index);\n\t},\n setAnimationByName: function (trackIndex, animationName, loop)\n {\n\t\tvar animation = this.data.skeletonData.findAnimation(animationName);\n\t\tif (!animation) throw \"Animation not found: \" + animationName;\n\t\treturn this.setAnimation(trackIndex, animation, loop);\n\t},\n\t/** Set the current animation. Any queued animations are cleared. */\n setAnimation: function (trackIndex, animation, loop)\n {\n\t\tvar entry = new spine.TrackEntry();\n\t\tentry.animation = animation;\n\t\tentry.loop = loop;\n\t\tentry.endTime = animation.duration;\n\t\tthis.setCurrent(trackIndex, entry);\n\t\treturn entry;\n\t},\n addAnimationByName: function (trackIndex, animationName, loop, delay)\n {\n\t\tvar animation = this.data.skeletonData.findAnimation(animationName);\n\t\tif (!animation) throw \"Animation not found: \" + animationName;\n\t\treturn this.addAnimation(trackIndex, animation, loop, delay);\n\t},\n\t/** Adds an animation to be played delay seconds after the current or last queued animation.\n\t * @param delay May be <= 0 to use duration of previous animation minus any mix duration plus the negative delay. */\n addAnimation: function (trackIndex, animation, loop, delay)\n {\n\t\tvar entry = new spine.TrackEntry();\n\t\tentry.animation = animation;\n\t\tentry.loop = loop;\n\t\tentry.endTime = animation.duration;\n\n\t\tvar last = this._expandToIndex(trackIndex);\n if (last)\n {\n\t\t\twhile (last.next)\n\t\t\t\tlast = last.next;\n\t\t\tlast.next = entry;\n\t\t} else\n\t\t\tthis.tracks[trackIndex] = entry;\n\n if (delay <= 0)\n {\n\t\t\tif (last)\n\t\t\t\tdelay += last.endTime - this.data.getMix(last.animation, animation);\n\t\t\telse\n\t\t\t\tdelay = 0;\n\t\t}\n\t\tentry.delay = delay;\n\n\t\treturn entry;\n\t},\n\t/** May be null. */\n getCurrent: function (trackIndex)\n {\n\t\tif (trackIndex >= this.tracks.length) return null;\n\t\treturn this.tracks[trackIndex];\n\t}\n};\n\nspine.SkeletonJsonParser = function (attachmentLoader)\n{\n\tthis.attachmentLoader = attachmentLoader;\n};\nspine.SkeletonJsonParser.prototype = {\n\tscale: 1,\n readSkeletonData: function (root, name)\n {\n\t\tvar skeletonData = new spine.SkeletonData();\n\t\tskeletonData.name = name;\n\n\t\t// Skeleton.\n\t\tvar skeletonMap = root[\"skeleton\"];\n if (skeletonMap)\n {\n\t\t\tskeletonData.hash = skeletonMap[\"hash\"];\n\t\t\tskeletonData.version = skeletonMap[\"spine\"];\n\t\t\tskeletonData.width = skeletonMap[\"width\"] || 0;\n\t\t\tskeletonData.height = skeletonMap[\"height\"] || 0;\n\t\t}\n\n\t\t// Bones.\n\t\tvar bones = root[\"bones\"];\n for (var i = 0, n = bones.length; i < n; i++)\n {\n\t\t\tvar boneMap = bones[i];\n\t\t\tvar parent = null;\n if (boneMap[\"parent\"])\n {\n\t\t\t\tparent = skeletonData.findBone(boneMap[\"parent\"]);\n\t\t\t\tif (!parent) throw \"Parent bone not found: \" + boneMap[\"parent\"];\n\t\t\t}\n\t\t\tvar boneData = new spine.BoneData(boneMap[\"name\"], parent);\n\t\t\tboneData.length = (boneMap[\"length\"] || 0) * this.scale;\n\t\t\tboneData.x = (boneMap[\"x\"] || 0) * this.scale;\n\t\t\tboneData.y = (boneMap[\"y\"] || 0) * this.scale;\n\t\t\tboneData.rotation = (boneMap[\"rotation\"] || 0);\n\t\t\tboneData.scaleX = boneMap.hasOwnProperty(\"scaleX\") ? boneMap[\"scaleX\"] : 1;\n\t\t\tboneData.scaleY = boneMap.hasOwnProperty(\"scaleY\") ? boneMap[\"scaleY\"] : 1;\n\t\t\tboneData.inheritScale = boneMap.hasOwnProperty(\"inheritScale\") ? boneMap[\"inheritScale\"] : true;\n\t\t\tboneData.inheritRotation = boneMap.hasOwnProperty(\"inheritRotation\") ? boneMap[\"inheritRotation\"] : true;\n\t\t\tskeletonData.bones.push(boneData);\n\t\t}\n\n\t\t// IK constraints.\n\t\tvar ik = root[\"ik\"];\n if (ik)\n {\n for (var i = 0, n = ik.length; i < n; i++)\n {\n\t\t\t\tvar ikMap = ik[i];\n\t\t\t\tvar ikConstraintData = new spine.IkConstraintData(ikMap[\"name\"]);\n\n\t\t\t\tvar bones = ikMap[\"bones\"];\n for (var ii = 0, nn = bones.length; ii < nn; ii++)\n {\n\t\t\t\t\tvar bone = skeletonData.findBone(bones[ii]);\n\t\t\t\t\tif (!bone) throw \"IK bone not found: \" + bones[ii];\n\t\t\t\t\tikConstraintData.bones.push(bone);\n\t\t\t\t}\n\n\t\t\t\tikConstraintData.target = skeletonData.findBone(ikMap[\"target\"]);\n\t\t\t\tif (!ikConstraintData.target) throw \"Target bone not found: \" + ikMap[\"target\"];\n\n\t\t\t\tikConstraintData.bendDirection = (!ikMap.hasOwnProperty(\"bendPositive\") || ikMap[\"bendPositive\"]) ? 1 : -1;\n\t\t\t\tikConstraintData.mix = ikMap.hasOwnProperty(\"mix\") ? ikMap[\"mix\"] : 1;\n\n\t\t\t\tskeletonData.ikConstraints.push(ikConstraintData);\n\t\t\t}\n\t\t}\n\n\t\t// Slots.\n\t\tvar slots = root[\"slots\"];\n for (var i = 0, n = slots.length; i < n; i++)\n {\n\t\t\tvar slotMap = slots[i];\n\t\t\tvar boneData = skeletonData.findBone(slotMap[\"bone\"]);\n\t\t\tif (!boneData) throw \"Slot bone not found: \" + slotMap[\"bone\"];\n\t\t\tvar slotData = new spine.SlotData(slotMap[\"name\"], boneData);\n\n\t\t\tvar color = slotMap[\"color\"];\n if (color)\n {\n\t\t\t\tslotData.r = this.toColor(color, 0);\n\t\t\t\tslotData.g = this.toColor(color, 1);\n\t\t\t\tslotData.b = this.toColor(color, 2);\n\t\t\t\tslotData.a = this.toColor(color, 3);\n\t\t\t}\n\n\t\t\tslotData.attachmentName = slotMap[\"attachment\"];\n\t\t\tslotData.additiveBlending = slotMap[\"additive\"] && slotMap[\"additive\"] == \"true\";\n\n\t\t\tskeletonData.slots.push(slotData);\n\t\t}\n\n\t\t// Skins.\n\t\tvar skins = root[\"skins\"];\n for (var skinName in skins)\n {\n\t\t\tif (!skins.hasOwnProperty(skinName)) continue;\n\t\t\tvar skinMap = skins[skinName];\n\t\t\tvar skin = new spine.Skin(skinName);\n for (var slotName in skinMap)\n {\n\t\t\t\tif (!skinMap.hasOwnProperty(slotName)) continue;\n\t\t\t\tvar slotIndex = skeletonData.findSlotIndex(slotName);\n\t\t\t\tvar slotEntry = skinMap[slotName];\n for (var attachmentName in slotEntry)\n {\n\t\t\t\t\tif (!slotEntry.hasOwnProperty(attachmentName)) continue;\n\t\t\t\t\tvar attachment = this.readAttachment(skin, attachmentName, slotEntry[attachmentName]);\n\t\t\t\t\tif (attachment) skin.addAttachment(slotIndex, attachmentName, attachment);\n\t\t\t\t}\n\t\t\t}\n\t\t\tskeletonData.skins.push(skin);\n\t\t\tif (skin.name == \"default\") skeletonData.defaultSkin = skin;\n\t\t}\n\n\t\t// Events.\n\t\tvar events = root[\"events\"];\n for (var eventName in events)\n {\n\t\t\tif (!events.hasOwnProperty(eventName)) continue;\n\t\t\tvar eventMap = events[eventName];\n\t\t\tvar eventData = new spine.EventData(eventName);\n\t\t\teventData.intValue = eventMap[\"int\"] || 0;\n\t\t\teventData.floatValue = eventMap[\"float\"] || 0;\n\t\t\teventData.stringValue = eventMap[\"string\"] || null;\n\t\t\tskeletonData.events.push(eventData);\n\t\t}\n\n\t\t// Animations.\n\t\tvar animations = root[\"animations\"];\n for (var animationName in animations)\n {\n\t\t\tif (!animations.hasOwnProperty(animationName)) continue;\n\t\t\tthis.readAnimation(animationName, animations[animationName], skeletonData);\n\t\t}\n\n\t\treturn skeletonData;\n\t},\n readAttachment: function (skin, name, map)\n {\n\t\tname = map[\"name\"] || name;\n\n\t\tvar type = spine.AttachmentType[map[\"type\"] || \"region\"];\n\t\tvar path = map[\"path\"] || name;\n\n\t\tvar scale = this.scale;\n if (type == spine.AttachmentType.region)\n {\n\t\t\tvar region = this.attachmentLoader.newRegionAttachment(skin, name, path);\n\t\t\tif (!region) return null;\n\t\t\tregion.path = path;\n\t\t\tregion.x = (map[\"x\"] || 0) * scale;\n\t\t\tregion.y = (map[\"y\"] || 0) * scale;\n\t\t\tregion.scaleX = map.hasOwnProperty(\"scaleX\") ? map[\"scaleX\"] : 1;\n\t\t\tregion.scaleY = map.hasOwnProperty(\"scaleY\") ? map[\"scaleY\"] : 1;\n\t\t\tregion.rotation = map[\"rotation\"] || 0;\n\t\t\tregion.width = (map[\"width\"] || 0) * scale;\n\t\t\tregion.height = (map[\"height\"] || 0) * scale;\n\n\t\t\tvar color = map[\"color\"];\n if (color)\n {\n\t\t\t\tregion.r = this.toColor(color, 0);\n\t\t\t\tregion.g = this.toColor(color, 1);\n\t\t\t\tregion.b = this.toColor(color, 2);\n\t\t\t\tregion.a = this.toColor(color, 3);\n\t\t\t}\n\n\t\t\tregion.updateOffset();\n\t\t\treturn region;\n } else if (type == spine.AttachmentType.mesh)\n {\n\t\t\tvar mesh = this.attachmentLoader.newMeshAttachment(skin, name, path);\n\t\t\tif (!mesh) return null;\n\t\t\tmesh.path = path;\n\t\t\tmesh.vertices = this.getFloatArray(map, \"vertices\", scale);\n\t\t\tmesh.triangles = this.getIntArray(map, \"triangles\");\n\t\t\tmesh.regionUVs = this.getFloatArray(map, \"uvs\", 1);\n\t\t\tmesh.updateUVs();\n\n\t\t\tcolor = map[\"color\"];\n if (color)\n {\n\t\t\t\tmesh.r = this.toColor(color, 0);\n\t\t\t\tmesh.g = this.toColor(color, 1);\n\t\t\t\tmesh.b = this.toColor(color, 2);\n\t\t\t\tmesh.a = this.toColor(color, 3);\n\t\t\t}\n\n\t\t\tmesh.hullLength = (map[\"hull\"] || 0) * 2;\n\t\t\tif (map[\"edges\"]) mesh.edges = this.getIntArray(map, \"edges\");\n\t\t\tmesh.width = (map[\"width\"] || 0) * scale;\n\t\t\tmesh.height = (map[\"height\"] || 0) * scale;\n\t\t\treturn mesh;\n } else if (type == spine.AttachmentType.skinnedmesh)\n {\n\t\t\tvar mesh = this.attachmentLoader.newSkinnedMeshAttachment(skin, name, path);\n\t\t\tif (!mesh) return null;\n\t\t\tmesh.path = path;\n\n\t\t\tvar uvs = this.getFloatArray(map, \"uvs\", 1);\n\t\t\tvar vertices = this.getFloatArray(map, \"vertices\", 1);\n\t\t\tvar weights = [];\n\t\t\tvar bones = [];\n for (var i = 0, n = vertices.length; i < n; )\n {\n\t\t\t\tvar boneCount = vertices[i++] | 0;\n\t\t\t\tbones[bones.length] = boneCount;\n for (var nn = i + boneCount * 4; i < nn; )\n {\n\t\t\t\t\tbones[bones.length] = vertices[i];\n\t\t\t\t\tweights[weights.length] = vertices[i + 1] * scale;\n\t\t\t\t\tweights[weights.length] = vertices[i + 2] * scale;\n\t\t\t\t\tweights[weights.length] = vertices[i + 3];\n\t\t\t\t\ti += 4;\n\t\t\t\t}\n\t\t\t}\n\t\t\tmesh.bones = bones;\n\t\t\tmesh.weights = weights;\n\t\t\tmesh.triangles = this.getIntArray(map, \"triangles\");\n\t\t\tmesh.regionUVs = uvs;\n\t\t\tmesh.updateUVs();\n\n\t\t\tcolor = map[\"color\"];\n if (color)\n {\n\t\t\t\tmesh.r = this.toColor(color, 0);\n\t\t\t\tmesh.g = this.toColor(color, 1);\n\t\t\t\tmesh.b = this.toColor(color, 2);\n\t\t\t\tmesh.a = this.toColor(color, 3);\n\t\t\t}\n\n\t\t\tmesh.hullLength = (map[\"hull\"] || 0) * 2;\n\t\t\tif (map[\"edges\"]) mesh.edges = this.getIntArray(map, \"edges\");\n\t\t\tmesh.width = (map[\"width\"] || 0) * scale;\n\t\t\tmesh.height = (map[\"height\"] || 0) * scale;\n\t\t\treturn mesh;\n } else if (type == spine.AttachmentType.boundingbox)\n {\n\t\t\tvar attachment = this.attachmentLoader.newBoundingBoxAttachment(skin, name);\n\t\t\tvar vertices = map[\"vertices\"];\n\t\t\tfor (var i = 0, n = vertices.length; i < n; i++)\n\t\t\t\tattachment.vertices.push(vertices[i] * scale);\n\t\t\treturn attachment;\n\t\t}\n\t\tthrow \"Unknown attachment type: \" + type;\n\t},\n readAnimation: function (name, map, skeletonData)\n {\n\t\tvar timelines = [];\n\t\tvar duration = 0;\n\n\t\tvar slots = map[\"slots\"];\n for (var slotName in slots)\n {\n\t\t\tif (!slots.hasOwnProperty(slotName)) continue;\n\t\t\tvar slotMap = slots[slotName];\n\t\t\tvar slotIndex = skeletonData.findSlotIndex(slotName);\n\n for (var timelineName in slotMap)\n {\n\t\t\t\tif (!slotMap.hasOwnProperty(timelineName)) continue;\n\t\t\t\tvar values = slotMap[timelineName];\n if (timelineName == \"color\")\n {\n\t\t\t\t\tvar timeline = new spine.ColorTimeline(values.length);\n\t\t\t\t\ttimeline.slotIndex = slotIndex;\n\n\t\t\t\t\tvar frameIndex = 0;\n for (var i = 0, n = values.length; i < n; i++)\n {\n\t\t\t\t\t\tvar valueMap = values[i];\n\t\t\t\t\t\tvar color = valueMap[\"color\"];\n\t\t\t\t\t\tvar r = this.toColor(color, 0);\n\t\t\t\t\t\tvar g = this.toColor(color, 1);\n\t\t\t\t\t\tvar b = this.toColor(color, 2);\n\t\t\t\t\t\tvar a = this.toColor(color, 3);\n\t\t\t\t\t\ttimeline.setFrame(frameIndex, valueMap[\"time\"], r, g, b, a);\n\t\t\t\t\t\tthis.readCurve(timeline, frameIndex, valueMap);\n\t\t\t\t\t\tframeIndex++;\n\t\t\t\t\t}\n\t\t\t\t\ttimelines.push(timeline);\n\t\t\t\t\tduration = Math.max(duration, timeline.frames[timeline.getFrameCount() * 5 - 5]);\n\n } else if (timelineName == \"attachment\")\n {\n\t\t\t\t\tvar timeline = new spine.AttachmentTimeline(values.length);\n\t\t\t\t\ttimeline.slotIndex = slotIndex;\n\n\t\t\t\t\tvar frameIndex = 0;\n for (var i = 0, n = values.length; i < n; i++)\n {\n\t\t\t\t\t\tvar valueMap = values[i];\n\t\t\t\t\t\ttimeline.setFrame(frameIndex++, valueMap[\"time\"], valueMap[\"name\"]);\n\t\t\t\t\t}\n\t\t\t\t\ttimelines.push(timeline);\n\t\t\t\t\tduration = Math.max(duration, timeline.frames[timeline.getFrameCount() - 1]);\n\n\t\t\t\t} else\n\t\t\t\t\tthrow \"Invalid timeline type for a slot: \" + timelineName + \" (\" + slotName + \")\";\n\t\t\t}\n\t\t}\n\n\t\tvar bones = map[\"bones\"];\n for (var boneName in bones)\n {\n\t\t\tif (!bones.hasOwnProperty(boneName)) continue;\n\t\t\tvar boneIndex = skeletonData.findBoneIndex(boneName);\n\t\t\tif (boneIndex == -1) throw \"Bone not found: \" + boneName;\n\t\t\tvar boneMap = bones[boneName];\n\n for (var timelineName in boneMap)\n {\n\t\t\t\tif (!boneMap.hasOwnProperty(timelineName)) continue;\n\t\t\t\tvar values = boneMap[timelineName];\n if (timelineName == \"rotate\")\n {\n\t\t\t\t\tvar timeline = new spine.RotateTimeline(values.length);\n\t\t\t\t\ttimeline.boneIndex = boneIndex;\n\n\t\t\t\t\tvar frameIndex = 0;\n for (var i = 0, n = values.length; i < n; i++)\n {\n\t\t\t\t\t\tvar valueMap = values[i];\n\t\t\t\t\t\ttimeline.setFrame(frameIndex, valueMap[\"time\"], valueMap[\"angle\"]);\n\t\t\t\t\t\tthis.readCurve(timeline, frameIndex, valueMap);\n\t\t\t\t\t\tframeIndex++;\n\t\t\t\t\t}\n\t\t\t\t\ttimelines.push(timeline);\n\t\t\t\t\tduration = Math.max(duration, timeline.frames[timeline.getFrameCount() * 2 - 2]);\n\n } else if (timelineName == \"translate\" || timelineName == \"scale\")\n {\n\t\t\t\t\tvar timeline;\n\t\t\t\t\tvar timelineScale = 1;\n\t\t\t\t\tif (timelineName == \"scale\")\n\t\t\t\t\t\ttimeline = new spine.ScaleTimeline(values.length);\n else\n {\n\t\t\t\t\t\ttimeline = new spine.TranslateTimeline(values.length);\n\t\t\t\t\t\ttimelineScale = this.scale;\n\t\t\t\t\t}\n\t\t\t\t\ttimeline.boneIndex = boneIndex;\n\n\t\t\t\t\tvar frameIndex = 0;\n for (var i = 0, n = values.length; i < n; i++)\n {\n\t\t\t\t\t\tvar valueMap = values[i];\n\t\t\t\t\t\tvar x = (valueMap[\"x\"] || 0) * timelineScale;\n\t\t\t\t\t\tvar y = (valueMap[\"y\"] || 0) * timelineScale;\n\t\t\t\t\t\ttimeline.setFrame(frameIndex, valueMap[\"time\"], x, y);\n\t\t\t\t\t\tthis.readCurve(timeline, frameIndex, valueMap);\n\t\t\t\t\t\tframeIndex++;\n\t\t\t\t\t}\n\t\t\t\t\ttimelines.push(timeline);\n\t\t\t\t\tduration = Math.max(duration, timeline.frames[timeline.getFrameCount() * 3 - 3]);\n\n } else if (timelineName == \"flipX\" || timelineName == \"flipY\")\n {\n\t\t\t\t\tvar x = timelineName == \"flipX\";\n\t\t\t\t\tvar timeline = x ? new spine.FlipXTimeline(values.length) : new spine.FlipYTimeline(values.length);\n\t\t\t\t\ttimeline.boneIndex = boneIndex;\n\n\t\t\t\t\tvar field = x ? \"x\" : \"y\";\n\t\t\t\t\tvar frameIndex = 0;\n for (var i = 0, n = values.length; i < n; i++)\n {\n\t\t\t\t\t\tvar valueMap = values[i];\n\t\t\t\t\t\ttimeline.setFrame(frameIndex, valueMap[\"time\"], valueMap[field] || false);\n\t\t\t\t\t\tframeIndex++;\n\t\t\t\t\t}\n\t\t\t\t\ttimelines.push(timeline);\n\t\t\t\t\tduration = Math.max(duration, timeline.frames[timeline.getFrameCount() * 2 - 2]);\n\t\t\t\t} else\n\t\t\t\t\tthrow \"Invalid timeline type for a bone: \" + timelineName + \" (\" + boneName + \")\";\n\t\t\t}\n\t\t}\n\n\t\tvar ikMap = map[\"ik\"];\n for (var ikConstraintName in ikMap)\n {\n\t\t\tif (!ikMap.hasOwnProperty(ikConstraintName)) continue;\n\t\t\tvar ikConstraint = skeletonData.findIkConstraint(ikConstraintName);\n\t\t\tvar values = ikMap[ikConstraintName];\n\t\t\tvar timeline = new spine.IkConstraintTimeline(values.length);\n\t\t\ttimeline.ikConstraintIndex = skeletonData.ikConstraints.indexOf(ikConstraint);\n\t\t\tvar frameIndex = 0;\n for (var i = 0, n = values.length; i < n; i++)\n {\n\t\t\t\tvar valueMap = values[i];\n\t\t\t\tvar mix = valueMap.hasOwnProperty(\"mix\") ? valueMap[\"mix\"] : 1;\n\t\t\t\tvar bendDirection = (!valueMap.hasOwnProperty(\"bendPositive\") || valueMap[\"bendPositive\"]) ? 1 : -1;\n\t\t\t\ttimeline.setFrame(frameIndex, valueMap[\"time\"], mix, bendDirection);\n\t\t\t\tthis.readCurve(timeline, frameIndex, valueMap);\n\t\t\t\tframeIndex++;\n\t\t\t}\n\t\t\ttimelines.push(timeline);\n\t\t\tduration = Math.max(duration, timeline.frames[timeline.frameCount * 3 - 3]);\n\t\t}\n\n\t\tvar ffd = map[\"ffd\"];\n for (var skinName in ffd)\n {\n\t\t\tvar skin = skeletonData.findSkin(skinName);\n\t\t\tvar slotMap = ffd[skinName];\n for (slotName in slotMap)\n {\n\t\t\t\tvar slotIndex = skeletonData.findSlotIndex(slotName);\n\t\t\t\tvar meshMap = slotMap[slotName];\n for (var meshName in meshMap)\n {\n\t\t\t\t\tvar values = meshMap[meshName];\n\t\t\t\t\tvar timeline = new spine.FfdTimeline(values.length);\n\t\t\t\t\tvar attachment = skin.getAttachment(slotIndex, meshName);\n\t\t\t\t\tif (!attachment) throw \"FFD attachment not found: \" + meshName;\n\t\t\t\t\ttimeline.slotIndex = slotIndex;\n\t\t\t\t\ttimeline.attachment = attachment;\n\n\t\t\t\t\tvar isMesh = attachment.type == spine.AttachmentType.mesh;\n\t\t\t\t\tvar vertexCount;\n\t\t\t\t\tif (isMesh)\n\t\t\t\t\t\tvertexCount = attachment.vertices.length;\n\t\t\t\t\telse\n\t\t\t\t\t\tvertexCount = attachment.weights.length / 3 * 2;\n\n\t\t\t\t\tvar frameIndex = 0;\n for (var i = 0, n = values.length; i < n; i++)\n {\n\t\t\t\t\t\tvar valueMap = values[i];\n\t\t\t\t\t\tvar vertices;\n if (!valueMap[\"vertices\"])\n {\n\t\t\t\t\t\t\tif (isMesh)\n\t\t\t\t\t\t\t\tvertices = attachment.vertices;\n else\n {\n\t\t\t\t\t\t\t\tvertices = [];\n\t\t\t\t\t\t\t\tvertices.length = vertexCount;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tvar verticesValue = valueMap[\"vertices\"];\n\t\t\t\t\t\t\tvar vertices = [];\n\t\t\t\t\t\t\tvertices.length = vertexCount;\n\t\t\t\t\t\t\tvar start = valueMap[\"offset\"] || 0;\n\t\t\t\t\t\t\tvar nn = verticesValue.length;\n if (this.scale == 1)\n {\n\t\t\t\t\t\t\t\tfor (var ii = 0; ii < nn; ii++)\n\t\t\t\t\t\t\t\t\tvertices[ii + start] = verticesValue[ii];\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\tfor (var ii = 0; ii < nn; ii++)\n\t\t\t\t\t\t\t\t\tvertices[ii + start] = verticesValue[ii] * this.scale;\n\t\t\t\t\t\t\t}\n if (isMesh)\n {\n\t\t\t\t\t\t\t\tvar meshVertices = attachment.vertices;\n\t\t\t\t\t\t\t\tfor (var ii = 0, nn = vertices.length; ii < nn; ii++)\n\t\t\t\t\t\t\t\t\tvertices[ii] += meshVertices[ii];\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\ttimeline.setFrame(frameIndex, valueMap[\"time\"], vertices);\n\t\t\t\t\t\tthis.readCurve(timeline, frameIndex, valueMap);\n\t\t\t\t\t\tframeIndex++;\n\t\t\t\t\t}\n\t\t\t\t\ttimelines[timelines.length] = timeline;\n\t\t\t\t\tduration = Math.max(duration, timeline.frames[timeline.frameCount - 1]);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tvar drawOrderValues = map[\"drawOrder\"];\n\t\tif (!drawOrderValues) drawOrderValues = map[\"draworder\"];\n if (drawOrderValues)\n {\n\t\t\tvar timeline = new spine.DrawOrderTimeline(drawOrderValues.length);\n\t\t\tvar slotCount = skeletonData.slots.length;\n\t\t\tvar frameIndex = 0;\n for (var i = 0, n = drawOrderValues.length; i < n; i++)\n {\n\t\t\t\tvar drawOrderMap = drawOrderValues[i];\n\t\t\t\tvar drawOrder = null;\n if (drawOrderMap[\"offsets\"])\n {\n\t\t\t\t\tdrawOrder = [];\n\t\t\t\t\tdrawOrder.length = slotCount;\n\t\t\t\t\tfor (var ii = slotCount - 1; ii >= 0; ii--)\n\t\t\t\t\t\tdrawOrder[ii] = -1;\n\t\t\t\t\tvar offsets = drawOrderMap[\"offsets\"];\n\t\t\t\t\tvar unchanged = [];\n\t\t\t\t\tunchanged.length = slotCount - offsets.length;\n\t\t\t\t\tvar originalIndex = 0, unchangedIndex = 0;\n for (var ii = 0, nn = offsets.length; ii < nn; ii++)\n {\n\t\t\t\t\t\tvar offsetMap = offsets[ii];\n\t\t\t\t\t\tvar slotIndex = skeletonData.findSlotIndex(offsetMap[\"slot\"]);\n\t\t\t\t\t\tif (slotIndex == -1) throw \"Slot not found: \" + offsetMap[\"slot\"];\n\t\t\t\t\t\t// Collect unchanged items.\n\t\t\t\t\t\twhile (originalIndex != slotIndex)\n\t\t\t\t\t\t\tunchanged[unchangedIndex++] = originalIndex++;\n\t\t\t\t\t\t// Set changed items.\n\t\t\t\t\t\tdrawOrder[originalIndex + offsetMap[\"offset\"]] = originalIndex++;\n\t\t\t\t\t}\n\t\t\t\t\t// Collect remaining unchanged items.\n\t\t\t\t\twhile (originalIndex < slotCount)\n\t\t\t\t\t\tunchanged[unchangedIndex++] = originalIndex++;\n\t\t\t\t\t// Fill in unchanged items.\n\t\t\t\t\tfor (var ii = slotCount - 1; ii >= 0; ii--)\n\t\t\t\t\t\tif (drawOrder[ii] == -1) drawOrder[ii] = unchanged[--unchangedIndex];\n\t\t\t\t}\n\t\t\t\ttimeline.setFrame(frameIndex++, drawOrderMap[\"time\"], drawOrder);\n\t\t\t}\n\t\t\ttimelines.push(timeline);\n\t\t\tduration = Math.max(duration, timeline.frames[timeline.getFrameCount() - 1]);\n\t\t}\n\n\t\tvar events = map[\"events\"];\n if (events)\n {\n\t\t\tvar timeline = new spine.EventTimeline(events.length);\n\t\t\tvar frameIndex = 0;\n for (var i = 0, n = events.length; i < n; i++)\n {\n\t\t\t\tvar eventMap = events[i];\n\t\t\t\tvar eventData = skeletonData.findEvent(eventMap[\"name\"]);\n\t\t\t\tif (!eventData) throw \"Event not found: \" + eventMap[\"name\"];\n\t\t\t\tvar event = new spine.Event(eventData);\n\t\t\t\tevent.intValue = eventMap.hasOwnProperty(\"int\") ? eventMap[\"int\"] : eventData.intValue;\n\t\t\t\tevent.floatValue = eventMap.hasOwnProperty(\"float\") ? eventMap[\"float\"] : eventData.floatValue;\n\t\t\t\tevent.stringValue = eventMap.hasOwnProperty(\"string\") ? eventMap[\"string\"] : eventData.stringValue;\n\t\t\t\ttimeline.setFrame(frameIndex++, eventMap[\"time\"], event);\n\t\t\t}\n\t\t\ttimelines.push(timeline);\n\t\t\tduration = Math.max(duration, timeline.frames[timeline.getFrameCount() - 1]);\n\t\t}\n\n\t\tskeletonData.animations.push(new spine.Animation(name, timelines, duration));\n\t},\n readCurve: function (timeline, frameIndex, valueMap)\n {\n\t\tvar curve = valueMap[\"curve\"];\n\t\tif (!curve)\n\t\t\ttimeline.curves.setLinear(frameIndex);\n\t\telse if (curve == \"stepped\")\n\t\t\ttimeline.curves.setStepped(frameIndex);\n\t\telse if (curve instanceof Array)\n\t\t\ttimeline.curves.setCurve(frameIndex, curve[0], curve[1], curve[2], curve[3]);\n\t},\n toColor: function (hexString, colorIndex)\n {\n\t\tif (hexString.length != 8) throw \"Color hexidecimal length must be 8, recieved: \" + hexString;\n\t\treturn parseInt(hexString.substring(colorIndex * 2, (colorIndex * 2) + 2), 16) / 255;\n\t},\n getFloatArray: function (map, name, scale)\n {\n\t\tvar list = map[name];\n\t\tvar values = new spine.Float32Array(list.length);\n\t\tvar i = 0, n = list.length;\n if (scale == 1)\n {\n\t\t\tfor (; i < n; i++)\n\t\t\t\tvalues[i] = list[i];\n\t\t} else {\n\t\t\tfor (; i < n; i++)\n\t\t\t\tvalues[i] = list[i] * scale;\n\t\t}\n\t\treturn values;\n\t},\n getIntArray: function (map, name)\n {\n\t\tvar list = map[name];\n\t\tvar values = new spine.Uint16Array(list.length);\n\t\tfor (var i = 0, n = list.length; i < n; i++)\n\t\t\tvalues[i] = list[i] | 0;\n\t\treturn values;\n\t}\n};\n\nspine.Atlas = function (atlasText, baseUrl, crossOrigin)\n{\n if (baseUrl && baseUrl.indexOf('/') !== baseUrl.length)\n {\n baseUrl += '/';\n }\n\n\tthis.pages = [];\n\tthis.regions = [];\n\n this.texturesLoading = 0;\n\n var self = this;\n\n\tvar reader = new spine.AtlasReader(atlasText);\n\tvar tuple = [];\n\ttuple.length = 4;\n\tvar page = null;\n while (true)\n {\n\t\tvar line = reader.readLine();\n\t\tif (line === null) break;\n\t\tline = reader.trim(line);\n\t\tif (!line.length)\n\t\t\tpage = null;\n else if (!page)\n {\n\t\t\tpage = new spine.AtlasPage();\n\t\t\tpage.name = line;\n\n if (reader.readTuple(tuple) == 2)\n { // size is only optional for an atlas packed with an old TexturePacker.\n\t\t\t\tpage.width = parseInt(tuple[0]);\n\t\t\t\tpage.height = parseInt(tuple[1]);\n\t\t\t\treader.readTuple(tuple);\n\t\t\t}\n\t\t\tpage.format = spine.Atlas.Format[tuple[0]];\n\n\t\t\treader.readTuple(tuple);\n\t\t\tpage.minFilter = spine.Atlas.TextureFilter[tuple[0]];\n\t\t\tpage.magFilter = spine.Atlas.TextureFilter[tuple[1]];\n\n\t\t\tvar direction = reader.readValue();\n\t\t\tpage.uWrap = spine.Atlas.TextureWrap.clampToEdge;\n\t\t\tpage.vWrap = spine.Atlas.TextureWrap.clampToEdge;\n\t\t\tif (direction == \"x\")\n\t\t\t\tpage.uWrap = spine.Atlas.TextureWrap.repeat;\n\t\t\telse if (direction == \"y\")\n\t\t\t\tpage.vWrap = spine.Atlas.TextureWrap.repeat;\n\t\t\telse if (direction == \"xy\")\n\t\t\t\tpage.uWrap = page.vWrap = spine.Atlas.TextureWrap.repeat;\n\n page.rendererObject = core.BaseTexture.fromImage(baseUrl + line, crossOrigin);\n\n\t\t\tthis.pages.push(page);\n\n\t\t} else {\n\t\t\tvar region = new spine.AtlasRegion();\n\t\t\tregion.name = line;\n\t\t\tregion.page = page;\n\n\t\t\tregion.rotate = reader.readValue() == \"true\";\n\n\t\t\treader.readTuple(tuple);\n\t\t\tvar x = parseInt(tuple[0]);\n\t\t\tvar y = parseInt(tuple[1]);\n\n\t\t\treader.readTuple(tuple);\n\t\t\tvar width = parseInt(tuple[0]);\n\t\t\tvar height = parseInt(tuple[1]);\n\n\t\t\tregion.u = x / page.width;\n\t\t\tregion.v = y / page.height;\n if (region.rotate)\n {\n\t\t\t\tregion.u2 = (x + height) / page.width;\n\t\t\t\tregion.v2 = (y + width) / page.height;\n\t\t\t} else {\n\t\t\t\tregion.u2 = (x + width) / page.width;\n\t\t\t\tregion.v2 = (y + height) / page.height;\n\t\t\t}\n\t\t\tregion.x = x;\n\t\t\tregion.y = y;\n\t\t\tregion.width = Math.abs(width);\n\t\t\tregion.height = Math.abs(height);\n\n if (reader.readTuple(tuple) == 4)\n { // split is optional\n\t\t\t\tregion.splits = [parseInt(tuple[0]), parseInt(tuple[1]), parseInt(tuple[2]), parseInt(tuple[3])];\n\n if (reader.readTuple(tuple) == 4)\n { // pad is optional, but only present with splits\n\t\t\t\t\tregion.pads = [parseInt(tuple[0]), parseInt(tuple[1]), parseInt(tuple[2]), parseInt(tuple[3])];\n\n\t\t\t\t\treader.readTuple(tuple);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tregion.originalWidth = parseInt(tuple[0]);\n\t\t\tregion.originalHeight = parseInt(tuple[1]);\n\n\t\t\treader.readTuple(tuple);\n\t\t\tregion.offsetX = parseInt(tuple[0]);\n\t\t\tregion.offsetY = parseInt(tuple[1]);\n\n\t\t\tregion.index = parseInt(reader.readValue());\n\n\t\t\tthis.regions.push(region);\n\t\t}\n\t}\n};\nspine.Atlas.prototype = {\n findRegion: function (name)\n {\n\t\tvar regions = this.regions;\n\t\tfor (var i = 0, n = regions.length; i < n; i++)\n\t\t\tif (regions[i].name == name) return regions[i];\n\t\treturn null;\n\t},\n dispose: function ()\n {\n\t\tvar pages = this.pages;\n\t\tfor (var i = 0, n = pages.length; i < n; i++)\n\t\t\tpages[i].rendererObject.destroy(true);\n\t},\n updateUVs: function (page)\n {\n\t\tvar regions = this.regions;\n for (var i = 0, n = regions.length; i < n; i++)\n {\n\t\t\tvar region = regions[i];\n\t\t\tif (region.page != page) continue;\n\t\t\tregion.u = region.x / page.width;\n\t\t\tregion.v = region.y / page.height;\n if (region.rotate)\n {\n\t\t\t\tregion.u2 = (region.x + region.height) / page.width;\n\t\t\t\tregion.v2 = (region.y + region.width) / page.height;\n\t\t\t} else {\n\t\t\t\tregion.u2 = (region.x + region.width) / page.width;\n\t\t\t\tregion.v2 = (region.y + region.height) / page.height;\n\t\t\t}\n\t\t}\n\t}\n};\n\nspine.Atlas.Format = {\n\talpha: 0,\n\tintensity: 1,\n\tluminanceAlpha: 2,\n\trgb565: 3,\n\trgba4444: 4,\n\trgb888: 5,\n\trgba8888: 6\n};\n\nspine.Atlas.TextureFilter = {\n\tnearest: 0,\n\tlinear: 1,\n\tmipMap: 2,\n\tmipMapNearestNearest: 3,\n\tmipMapLinearNearest: 4,\n\tmipMapNearestLinear: 5,\n\tmipMapLinearLinear: 6\n};\n\nspine.Atlas.TextureWrap = {\n\tmirroredRepeat: 0,\n\tclampToEdge: 1,\n\trepeat: 2\n};\n\nspine.AtlasPage = function ()\n{};\nspine.AtlasPage.prototype = {\n\tname: null,\n\tformat: null,\n\tminFilter: null,\n\tmagFilter: null,\n\tuWrap: null,\n\tvWrap: null,\n\trendererObject: null,\n\twidth: 0,\n\theight: 0\n};\n\nspine.AtlasRegion = function ()\n{};\nspine.AtlasRegion.prototype = {\n\tpage: null,\n\tname: null,\n\tx: 0, y: 0,\n\twidth: 0, height: 0,\n\tu: 0, v: 0, u2: 0, v2: 0,\n\toffsetX: 0, offsetY: 0,\n\toriginalWidth: 0, originalHeight: 0,\n\tindex: 0,\n\trotate: false,\n\tsplits: null,\n\tpads: null\n};\n\nspine.AtlasReader = function (text)\n{\n\tthis.lines = text.split(/\\r\\n|\\r|\\n/);\n};\nspine.AtlasReader.prototype = {\n\tindex: 0,\n trim: function (value)\n {\n\t\treturn value.replace(/^\\s+|\\s+$/g, \"\");\n\t},\n readLine: function ()\n {\n\t\tif (this.index >= this.lines.length) return null;\n\t\treturn this.lines[this.index++];\n\t},\n readValue: function ()\n {\n\t\tvar line = this.readLine();\n\t\tvar colon = line.indexOf(\":\");\n\t\tif (colon == -1) throw \"Invalid line: \" + line;\n\t\treturn this.trim(line.substring(colon + 1));\n\t},\n\t/** Returns the number of tuple values read (1, 2 or 4). */\n readTuple: function (tuple)\n {\n\t\tvar line = this.readLine();\n\t\tvar colon = line.indexOf(\":\");\n\t\tif (colon == -1) throw \"Invalid line: \" + line;\n\t\tvar i = 0, lastMatch = colon + 1;\n for (; i < 3; i++)\n {\n\t\t\tvar comma = line.indexOf(\",\", lastMatch);\n\t\t\tif (comma == -1) break;\n\t\t\ttuple[i] = this.trim(line.substr(lastMatch, comma - lastMatch));\n\t\t\tlastMatch = comma + 1;\n\t\t}\n\t\ttuple[i] = this.trim(line.substring(lastMatch));\n\t\treturn i + 1;\n\t}\n};\n\nspine.AtlasAttachmentParser = function (atlas)\n{\n\tthis.atlas = atlas;\n};\nspine.AtlasAttachmentParser.prototype = {\n newRegionAttachment: function (skin, name, path)\n {\n\t\tvar region = this.atlas.findRegion(path);\n\t\tif (!region) throw \"Region not found in atlas: \" + path + \" (region attachment: \" + name + \")\";\n\t\tvar attachment = new spine.RegionAttachment(name);\n\t\tattachment.rendererObject = region;\n\t\tattachment.setUVs(region.u, region.v, region.u2, region.v2, region.rotate);\n\t\tattachment.regionOffsetX = region.offsetX;\n\t\tattachment.regionOffsetY = region.offsetY;\n\t\tattachment.regionWidth = region.width;\n\t\tattachment.regionHeight = region.height;\n\t\tattachment.regionOriginalWidth = region.originalWidth;\n\t\tattachment.regionOriginalHeight = region.originalHeight;\n\t\treturn attachment;\n\t},\n newMeshAttachment: function (skin, name, path)\n {\n\t\tvar region = this.atlas.findRegion(path);\n\t\tif (!region) throw \"Region not found in atlas: \" + path + \" (mesh attachment: \" + name + \")\";\n\t\tvar attachment = new spine.MeshAttachment(name);\n\t\tattachment.rendererObject = region;\n\t\tattachment.regionU = region.u;\n\t\tattachment.regionV = region.v;\n\t\tattachment.regionU2 = region.u2;\n\t\tattachment.regionV2 = region.v2;\n\t\tattachment.regionRotate = region.rotate;\n\t\tattachment.regionOffsetX = region.offsetX;\n\t\tattachment.regionOffsetY = region.offsetY;\n\t\tattachment.regionWidth = region.width;\n\t\tattachment.regionHeight = region.height;\n\t\tattachment.regionOriginalWidth = region.originalWidth;\n\t\tattachment.regionOriginalHeight = region.originalHeight;\n\t\treturn attachment;\n\t},\n newSkinnedMeshAttachment: function (skin, name, path)\n {\n\t\tvar region = this.atlas.findRegion(path);\n\t\tif (!region) throw \"Region not found in atlas: \" + path + \" (skinned mesh attachment: \" + name + \")\";\n\t\tvar attachment = new spine.SkinnedMeshAttachment(name);\n\t\tattachment.rendererObject = region;\n\t\tattachment.regionU = region.u;\n\t\tattachment.regionV = region.v;\n\t\tattachment.regionU2 = region.u2;\n\t\tattachment.regionV2 = region.v2;\n\t\tattachment.regionRotate = region.rotate;\n\t\tattachment.regionOffsetX = region.offsetX;\n\t\tattachment.regionOffsetY = region.offsetY;\n\t\tattachment.regionWidth = region.width;\n\t\tattachment.regionHeight = region.height;\n\t\tattachment.regionOriginalWidth = region.originalWidth;\n\t\tattachment.regionOriginalHeight = region.originalHeight;\n\t\treturn attachment;\n\t},\n newBoundingBoxAttachment: function (skin, name)\n {\n\t\treturn new spine.BoundingBoxAttachment(name);\n\t}\n};\n\nspine.SkeletonBounds = function ()\n{\n\tthis.polygonPool = [];\n\tthis.polygons = [];\n\tthis.boundingBoxes = [];\n};\nspine.SkeletonBounds.prototype = {\n\tminX: 0, minY: 0, maxX: 0, maxY: 0,\n update: function (skeleton, updateAabb)\n {\n\t\tvar slots = skeleton.slots;\n\t\tvar slotCount = slots.length;\n\t\tvar x = skeleton.x, y = skeleton.y;\n\t\tvar boundingBoxes = this.boundingBoxes;\n\t\tvar polygonPool = this.polygonPool;\n\t\tvar polygons = this.polygons;\n\n\t\tboundingBoxes.length = 0;\n\t\tfor (var i = 0, n = polygons.length; i < n; i++)\n\t\t\tpolygonPool.push(polygons[i]);\n\t\tpolygons.length = 0;\n\n for (var i = 0; i < slotCount; i++)\n {\n\t\t\tvar slot = slots[i];\n\t\t\tvar boundingBox = slot.attachment;\n\t\t\tif (boundingBox.type != spine.AttachmentType.boundingbox) continue;\n\t\t\tboundingBoxes.push(boundingBox);\n\n\t\t\tvar poolCount = polygonPool.length, polygon;\n if (poolCount > 0)\n {\n\t\t\t\tpolygon = polygonPool[poolCount - 1];\n\t\t\t\tpolygonPool.splice(poolCount - 1, 1);\n\t\t\t} else\n\t\t\t\tpolygon = [];\n\t\t\tpolygons.push(polygon);\n\n\t\t\tpolygon.length = boundingBox.vertices.length;\n\t\t\tboundingBox.computeWorldVertices(x, y, slot.bone, polygon);\n\t\t}\n\n\t\tif (updateAabb) this.aabbCompute();\n\t},\n aabbCompute: function ()\n {\n\t\tvar polygons = this.polygons;\n\t\tvar minX = Number.MAX_VALUE, minY = Number.MAX_VALUE, maxX = Number.MIN_VALUE, maxY = Number.MIN_VALUE;\n for (var i = 0, n = polygons.length; i < n; i++)\n {\n\t\t\tvar vertices = polygons[i];\n for (var ii = 0, nn = vertices.length; ii < nn; ii += 2)\n {\n\t\t\t\tvar x = vertices[ii];\n\t\t\t\tvar y = vertices[ii + 1];\n\t\t\t\tminX = Math.min(minX, x);\n\t\t\t\tminY = Math.min(minY, y);\n\t\t\t\tmaxX = Math.max(maxX, x);\n\t\t\t\tmaxY = Math.max(maxY, y);\n\t\t\t}\n\t\t}\n\t\tthis.minX = minX;\n\t\tthis.minY = minY;\n\t\tthis.maxX = maxX;\n\t\tthis.maxY = maxY;\n\t},\n\t/** Returns true if the axis aligned bounding box contains the point. */\n aabbContainsPoint: function (x, y)\n {\n\t\treturn x >= this.minX && x <= this.maxX && y >= this.minY && y <= this.maxY;\n\t},\n\t/** Returns true if the axis aligned bounding box intersects the line segment. */\n aabbIntersectsSegment: function (x1, y1, x2, y2)\n {\n\t\tvar minX = this.minX, minY = this.minY, maxX = this.maxX, maxY = this.maxY;\n\t\tif ((x1 <= minX && x2 <= minX) || (y1 <= minY && y2 <= minY) || (x1 >= maxX && x2 >= maxX) || (y1 >= maxY && y2 >= maxY))\n\t\t\treturn false;\n\t\tvar m = (y2 - y1) / (x2 - x1);\n\t\tvar y = m * (minX - x1) + y1;\n\t\tif (y > minY && y < maxY) return true;\n\t\ty = m * (maxX - x1) + y1;\n\t\tif (y > minY && y < maxY) return true;\n\t\tvar x = (minY - y1) / m + x1;\n\t\tif (x > minX && x < maxX) return true;\n\t\tx = (maxY - y1) / m + x1;\n\t\tif (x > minX && x < maxX) return true;\n\t\treturn false;\n\t},\n\t/** Returns true if the axis aligned bounding box intersects the axis aligned bounding box of the specified bounds. */\n aabbIntersectsSkeleton: function (bounds)\n {\n\t\treturn this.minX < bounds.maxX && this.maxX > bounds.minX && this.minY < bounds.maxY && this.maxY > bounds.minY;\n\t},\n\t/** Returns the first bounding box attachment that contains the point, or null. When doing many checks, it is usually more\n\t * efficient to only call this method if {@link #aabbContainsPoint(float, float)} returns true. */\n containsPoint: function (x, y)\n {\n\t\tvar polygons = this.polygons;\n\t\tfor (var i = 0, n = polygons.length; i < n; i++)\n\t\t\tif (this.polygonContainsPoint(polygons[i], x, y)) return this.boundingBoxes[i];\n\t\treturn null;\n\t},\n\t/** Returns the first bounding box attachment that contains the line segment, or null. When doing many checks, it is usually\n\t * more efficient to only call this method if {@link #aabbIntersectsSegment(float, float, float, float)} returns true. */\n intersectsSegment: function (x1, y1, x2, y2)\n {\n\t\tvar polygons = this.polygons;\n\t\tfor (var i = 0, n = polygons.length; i < n; i++)\n\t\t\tif (polygons[i].intersectsSegment(x1, y1, x2, y2)) return this.boundingBoxes[i];\n\t\treturn null;\n\t},\n\t/** Returns true if the polygon contains the point. */\n polygonContainsPoint: function (polygon, x, y)\n {\n\t\tvar nn = polygon.length;\n\t\tvar prevIndex = nn - 2;\n\t\tvar inside = false;\n for (var ii = 0; ii < nn; ii += 2)\n {\n\t\t\tvar vertexY = polygon[ii + 1];\n\t\t\tvar prevY = polygon[prevIndex + 1];\n if ((vertexY < y && prevY >= y) || (prevY < y && vertexY >= y))\n {\n\t\t\t\tvar vertexX = polygon[ii];\n\t\t\t\tif (vertexX + (y - vertexY) / (prevY - vertexY) * (polygon[prevIndex] - vertexX) < x) inside = !inside;\n\t\t\t}\n\t\t\tprevIndex = ii;\n\t\t}\n\t\treturn inside;\n\t},\n\t/** Returns true if the polygon contains the line segment. */\n polygonIntersectsSegment: function (polygon, x1, y1, x2, y2)\n {\n\t\tvar nn = polygon.length;\n\t\tvar width12 = x1 - x2, height12 = y1 - y2;\n\t\tvar det1 = x1 * y2 - y1 * x2;\n\t\tvar x3 = polygon[nn - 2], y3 = polygon[nn - 1];\n for (var ii = 0; ii < nn; ii += 2)\n {\n\t\t\tvar x4 = polygon[ii], y4 = polygon[ii + 1];\n\t\t\tvar det2 = x3 * y4 - y3 * x4;\n\t\t\tvar width34 = x3 - x4, height34 = y3 - y4;\n\t\t\tvar det3 = width12 * height34 - height12 * width34;\n\t\t\tvar x = (det1 * width34 - width12 * det2) / det3;\n if (((x >= x3 && x <= x4) || (x >= x4 && x <= x3)) && ((x >= x1 && x <= x2) || (x >= x2 && x <= x1)))\n {\n\t\t\t\tvar y = (det1 * height34 - height12 * det2) / det3;\n\t\t\t\tif (((y >= y3 && y <= y4) || (y >= y4 && y <= y3)) && ((y >= y1 && y <= y2) || (y >= y2 && y <= y1))) return true;\n\t\t\t}\n\t\t\tx3 = x4;\n\t\t\ty3 = y4;\n\t\t}\n\t\treturn false;\n\t},\n getPolygon: function (attachment)\n {\n\t\tvar index = this.boundingBoxes.indexOf(attachment);\n\t\treturn index == -1 ? null : this.polygons[index];\n\t},\n getWidth: function ()\n {\n\t\treturn this.maxX - this.minX;\n\t},\n getHeight: function ()\n {\n\t\treturn this.maxY - this.minY;\n\t}\n};\n", "/**\n * @file Main export of the PIXI spine library\n * @author Mat Groves \n * @copyright 2013-2015 GoodBoyDigital\n * @license {@link https://github.com/GoodBoyDigital/pixi.js/blob/master/LICENSE|MIT License}\n */\n\n/**\n * @namespace PIXI.spine\n */\nmodule.exports = {\n Spine: require('./Spine'),\n SpineRuntime: require('./SpineRuntime')\n};\n", - "var core = require('../core');\n\n/**\n * A BitmapText object will create a line or multiple lines of text using bitmap font. To\n * split a line you can use '\\n', '\\r' or '\\r\\n' in your string. You can generate the fnt files using:\n *\n * A BitmapText can only be created when the font is loaded\n *\n * ```js\n * // in this case the font is in a file called 'desyrel.fnt'\n * var bitmapText = new PIXI.BitmapText(\"text using a fancy font!\", {font: \"35px Desyrel\", align: \"right\"});\n * ```\n *\n *\n * http://www.angelcode.com/products/bmfont/ for windows or\n * http://www.bmglyph.com/ for mac.\n *\n * @class\n * @extends Container\n * @memberof PIXI.text\n * @param text {string} The copy that you would like the text to display\n * @param style {object} The style parameters\n * @param style.font {string|object} The font descriptor for the object, can be passed as a string of form\n * \"24px FontName\" or \"FontName\" or as an object with explicit name/size properties.\n * @param [style.font.size] {number} The size of the font in pixels, e.g. 24\n * @param [style.font.name] {string} The bitmap font id\n * @param [style.align='left'] {string} Alignment for multiline text ('left', 'center' or 'right'), does not affect single line text\n */\nfunction BitmapText(text, style)\n{\n core.Container.call(this);\n\n /**\n * The width of the overall text, different from fontSize,\n * which is defined in the style object\n *\n * @member {number}\n * @readOnly\n */\n this.textWidth = 0;\n\n /**\n * The height of the overall text, different from fontSize,\n * which is defined in the style object\n *\n * @member {number}\n * @readOnly\n */\n this.textHeight = 0;\n\n /**\n * Private tracker for the letter sprite pool.\n *\n * @member {Sprite[]}\n * @private\n */\n this._glyphs = [];\n\n /**\n * Private tracker for the current style.\n *\n * @member {object}\n * @private\n */\n this._style = {\n tint: style.tint,\n align: style.align,\n fontName: null,\n fontSize: 0\n };\n\n /**\n * Private tracker for the current font.\n *\n * @member {object}\n * @private\n */\n this.font = style.font; // run font setter\n\n /**\n * Private tracker for the current text.\n *\n * @member {string}\n * @private\n */\n this._text = text;\n\n /**\n * The max width of this bitmap text in pixels. If the text provided is longer than the value provided, line breaks will be automatically inserted in the last whitespace.\n * Disable by setting value to 0\n *\n * @member {number}\n */\n this.maxWidth = 0;\n\n /**\n * The dirty state of this object.\n *\n * @member {boolean}\n */\n this.dirty = false;\n\n this.updateText();\n}\n\n// constructor\nBitmapText.prototype = Object.create(core.Container.prototype);\nBitmapText.prototype.constructor = BitmapText;\nmodule.exports = BitmapText;\n\nObject.defineProperties(BitmapText.prototype, {\n /**\n * The tint of the BitmapText object\n *\n * @member {number}\n * @memberof BitmapText#\n */\n tint: {\n get: function ()\n {\n return this._style.tint;\n },\n set: function (value)\n {\n this._style.tint = (typeof value === 'number' && value >= 0) ? value : 0xFFFFFF;\n\n this.dirty = true;\n }\n },\n\n /**\n * The alignment of the BitmapText object\n *\n * @member {string}\n * @default 'left'\n * @memberof BitmapText#\n */\n align: {\n get: function ()\n {\n return this._style.align;\n },\n set: function (value)\n {\n this._style.align = value;\n\n this.dirty = true;\n }\n },\n\n /**\n * The font descriptor of the BitmapText object\n *\n * @member {Font}\n * @memberof BitmapText#\n */\n font: {\n get: function ()\n {\n return this._style.font;\n },\n set: function (value)\n {\n if (typeof value === 'string') {\n value = value.split(' ');\n\n this._style.fontName = value.slice(1).join(' ');\n this._style.fontSize = value.length >= 2 ? parseInt(value[0], 10) : BitmapText.fonts[this.fontName].size;\n }\n else {\n this._style.fontName = value.name;\n this._style.fontSize = typeof value.size === 'number' ? value.size : parseInt(value.size, 10);\n }\n\n this.dirty = true;\n }\n },\n\n /**\n * The text of the BitmapText object\n *\n * @member {string}\n * @memberof BitmapText#\n */\n text: {\n get: function ()\n {\n return this._text;\n },\n set: function (value)\n {\n this._text = value;\n\n this.dirty = true;\n }\n }\n});\n\n/**\n * Renders text and updates it when needed\n *\n * @private\n */\nBitmapText.prototype.updateText = function ()\n{\n var data = BitmapText.fonts[this._style.fontName];\n var pos = new core.math.Point();\n var prevCharCode = null;\n var chars = [];\n var lastLineWidth = 0;\n var maxLineWidth = 0;\n var lineWidths = [];\n var line = 0;\n var scale = this._style.fontSize / data.size;\n var lastSpace = -1;\n\n for (var i = 0; i < this.text.length; i++)\n {\n var charCode = this.text.charCodeAt(i);\n lastSpace = /(\\s)/.test(this.text.charAt(i)) ? i : lastSpace;\n\n if (/(?:\\r\\n|\\r|\\n)/.test(this.text.charAt(i)))\n {\n lineWidths.push(lastLineWidth);\n maxLineWidth = Math.max(maxLineWidth, lastLineWidth);\n line++;\n\n pos.x = 0;\n pos.y += data.lineHeight;\n prevCharCode = null;\n continue;\n }\n\n if (lastSpace !== -1 && this.maxWidth > 0 && pos.x * scale > this.maxWidth)\n {\n chars.splice(lastSpace, i - lastSpace);\n i = lastSpace;\n lastSpace = -1;\n\n lineWidths.push(lastLineWidth);\n maxLineWidth = Math.max(maxLineWidth, lastLineWidth);\n line++;\n\n pos.x = 0;\n pos.y += data.lineHeight;\n prevCharCode = null;\n continue;\n }\n\n var charData = data.chars[charCode];\n\n if (!charData)\n {\n continue;\n }\n\n if (prevCharCode && charData.kerning[prevCharCode])\n {\n pos.x += charData.kerning[prevCharCode];\n }\n\n chars.push({texture:charData.texture, line: line, charCode: charCode, position: new core.math.Point(pos.x + charData.xOffset, pos.y + charData.yOffset)});\n lastLineWidth = pos.x + (charData.texture.width + charData.xOffset);\n pos.x += charData.xAdvance;\n\n prevCharCode = charCode;\n }\n\n lineWidths.push(lastLineWidth);\n maxLineWidth = Math.max(maxLineWidth, lastLineWidth);\n\n var lineAlignOffsets = [];\n\n for (i = 0; i <= line; i++)\n {\n var alignOffset = 0;\n\n if (this._style.align === 'right')\n {\n alignOffset = maxLineWidth - lineWidths[i];\n }\n else if (this._style.align === 'center')\n {\n alignOffset = (maxLineWidth - lineWidths[i]) / 2;\n }\n\n lineAlignOffsets.push(alignOffset);\n }\n\n var lenChars = chars.length;\n var tint = this.tint;\n\n for (i = 0; i < lenChars; i++)\n {\n var c = this._glyphs[i]; // get the next glyph sprite\n\n if (c)\n {\n c.texture = chars[i].texture;\n }\n else\n {\n c = new core.Sprite(chars[i].texture);\n this._glyphs.push(c);\n }\n\n c.position.x = (chars[i].position.x + lineAlignOffsets[chars[i].line]) * scale;\n c.position.y = chars[i].position.y * scale;\n c.scale.x = c.scale.y = scale;\n c.tint = tint;\n\n if (!c.parent)\n {\n this.addChild(c);\n }\n }\n\n // remove unnecessary children.\n for (i = lenChars; i < this._glyphs.length; ++i)\n {\n this.removeChild(this._glyphs[i]);\n }\n\n this.textWidth = maxLineWidth * scale;\n this.textHeight = (pos.y + data.lineHeight) * scale;\n};\n\n/**\n * Updates the transform of this object\n *\n * @private\n */\nBitmapText.prototype.updateTransform = function ()\n{\n if (this.dirty)\n {\n this.updateText();\n this.dirty = false;\n }\n\n this.containerUpdateTransform();\n};\n\nBitmapText.fonts = {};\n", + "var core = require('../core');\n\n/**\n * A BitmapText object will create a line or multiple lines of text using bitmap font. To\n * split a line you can use '\\n', '\\r' or '\\r\\n' in your string. You can generate the fnt files using:\n *\n * A BitmapText can only be created when the font is loaded\n *\n * ```js\n * // in this case the font is in a file called 'desyrel.fnt'\n * var bitmapText = new PIXI.BitmapText(\"text using a fancy font!\", {font: \"35px Desyrel\", align: \"right\"});\n * ```\n *\n *\n * http://www.angelcode.com/products/bmfont/ for windows or\n * http://www.bmglyph.com/ for mac.\n *\n * @class\n * @extends Container\n * @memberof PIXI.text\n * @param text {string} The copy that you would like the text to display\n * @param style {object} The style parameters\n * @param style.font {string|object} The font descriptor for the object, can be passed as a string of form\n * \"24px FontName\" or \"FontName\" or as an object with explicit name/size properties.\n * @param [style.font.size] {number} The size of the font in pixels, e.g. 24\n * @param [style.font.name] {string} The bitmap font id\n * @param [style.align='left'] {string} Alignment for multiline text ('left', 'center' or 'right'), does not affect single line text\n */\nfunction BitmapText(text, style)\n{\n core.Container.call(this);\n\n /**\n * The width of the overall text, different from fontSize,\n * which is defined in the style object\n *\n * @member {number}\n * @readOnly\n */\n this.textWidth = 0;\n\n /**\n * The height of the overall text, different from fontSize,\n * which is defined in the style object\n *\n * @member {number}\n * @readOnly\n */\n this.textHeight = 0;\n\n /**\n * Private tracker for the letter sprite pool.\n *\n * @member {Sprite[]}\n * @private\n */\n this._glyphs = [];\n\n /**\n * Private tracker for the current style.\n *\n * @member {object}\n * @private\n */\n this._font = {\n tint: style.tint,\n align: style.align,\n name: null,\n size: 0\n };\n\n /**\n * Private tracker for the current font.\n *\n * @member {object}\n * @private\n */\n this.font = style.font; // run font setter\n\n /**\n * Private tracker for the current text.\n *\n * @member {string}\n * @private\n */\n this._text = text;\n\n /**\n * The max width of this bitmap text in pixels. If the text provided is longer than the value provided, line breaks will be automatically inserted in the last whitespace.\n * Disable by setting value to 0\n *\n * @member {number}\n */\n this.maxWidth = 0;\n\n /**\n * The dirty state of this object.\n *\n * @member {boolean}\n */\n this.dirty = false;\n\n this.updateText();\n}\n\n// constructor\nBitmapText.prototype = Object.create(core.Container.prototype);\nBitmapText.prototype.constructor = BitmapText;\nmodule.exports = BitmapText;\n\nObject.defineProperties(BitmapText.prototype, {\n /**\n * The tint of the BitmapText object\n *\n * @member {number}\n * @memberof BitmapText#\n */\n tint: {\n get: function ()\n {\n return this._font.tint;\n },\n set: function (value)\n {\n this._font.tint = (typeof value === 'number' && value >= 0) ? value : 0xFFFFFF;\n\n this.dirty = true;\n }\n },\n\n /**\n * The alignment of the BitmapText object\n *\n * @member {string}\n * @default 'left'\n * @memberof BitmapText#\n */\n align: {\n get: function ()\n {\n return this._font.align;\n },\n set: function (value)\n {\n this._font.align = value;\n\n this.dirty = true;\n }\n },\n\n /**\n * The font descriptor of the BitmapText object\n *\n * @member {Font}\n * @memberof BitmapText#\n */\n font: {\n get: function ()\n {\n return this._font;\n },\n set: function (value)\n {\n if (typeof value === 'string') {\n value = value.split(' ');\n\n this._font.name = value.length === 1 ? value[0] : value.slice(1).join(' ');\n this._font.size = value.length >= 2 ? parseInt(value[0], 10) : BitmapText.fonts[this._font.name].size;\n }\n else {\n this._font.name = value.name;\n this._font.size = typeof value.size === 'number' ? value.size : parseInt(value.size, 10);\n }\n\n this.dirty = true;\n }\n },\n\n /**\n * The text of the BitmapText object\n *\n * @member {string}\n * @memberof BitmapText#\n */\n text: {\n get: function ()\n {\n return this._text;\n },\n set: function (value)\n {\n this._text = value;\n\n this.dirty = true;\n }\n }\n});\n\n/**\n * Renders text and updates it when needed\n *\n * @private\n */\nBitmapText.prototype.updateText = function ()\n{\n var data = BitmapText.fonts[this._font.name];\n var pos = new core.math.Point();\n var prevCharCode = null;\n var chars = [];\n var lastLineWidth = 0;\n var maxLineWidth = 0;\n var lineWidths = [];\n var line = 0;\n var scale = this._font.size / data.size;\n var lastSpace = -1;\n\n for (var i = 0; i < this.text.length; i++)\n {\n var charCode = this.text.charCodeAt(i);\n lastSpace = /(\\s)/.test(this.text.charAt(i)) ? i : lastSpace;\n\n if (/(?:\\r\\n|\\r|\\n)/.test(this.text.charAt(i)))\n {\n lineWidths.push(lastLineWidth);\n maxLineWidth = Math.max(maxLineWidth, lastLineWidth);\n line++;\n\n pos.x = 0;\n pos.y += data.lineHeight;\n prevCharCode = null;\n continue;\n }\n\n if (lastSpace !== -1 && this.maxWidth > 0 && pos.x * scale > this.maxWidth)\n {\n chars.splice(lastSpace, i - lastSpace);\n i = lastSpace;\n lastSpace = -1;\n\n lineWidths.push(lastLineWidth);\n maxLineWidth = Math.max(maxLineWidth, lastLineWidth);\n line++;\n\n pos.x = 0;\n pos.y += data.lineHeight;\n prevCharCode = null;\n continue;\n }\n\n var charData = data.chars[charCode];\n\n if (!charData)\n {\n continue;\n }\n\n if (prevCharCode && charData.kerning[prevCharCode])\n {\n pos.x += charData.kerning[prevCharCode];\n }\n\n chars.push({texture:charData.texture, line: line, charCode: charCode, position: new core.math.Point(pos.x + charData.xOffset, pos.y + charData.yOffset)});\n lastLineWidth = pos.x + (charData.texture.width + charData.xOffset);\n pos.x += charData.xAdvance;\n\n prevCharCode = charCode;\n }\n\n lineWidths.push(lastLineWidth);\n maxLineWidth = Math.max(maxLineWidth, lastLineWidth);\n\n var lineAlignOffsets = [];\n\n for (i = 0; i <= line; i++)\n {\n var alignOffset = 0;\n\n if (this._font.align === 'right')\n {\n alignOffset = maxLineWidth - lineWidths[i];\n }\n else if (this._font.align === 'center')\n {\n alignOffset = (maxLineWidth - lineWidths[i]) / 2;\n }\n\n lineAlignOffsets.push(alignOffset);\n }\n\n var lenChars = chars.length;\n var tint = this.tint;\n\n for (i = 0; i < lenChars; i++)\n {\n var c = this._glyphs[i]; // get the next glyph sprite\n\n if (c)\n {\n c.texture = chars[i].texture;\n }\n else\n {\n c = new core.Sprite(chars[i].texture);\n this._glyphs.push(c);\n }\n\n c.position.x = (chars[i].position.x + lineAlignOffsets[chars[i].line]) * scale;\n c.position.y = chars[i].position.y * scale;\n c.scale.x = c.scale.y = scale;\n c.tint = tint;\n\n if (!c.parent)\n {\n this.addChild(c);\n }\n }\n\n // remove unnecessary children.\n for (i = lenChars; i < this._glyphs.length; ++i)\n {\n this.removeChild(this._glyphs[i]);\n }\n\n this.textWidth = maxLineWidth * scale;\n this.textHeight = (pos.y + data.lineHeight) * scale;\n};\n\n/**\n * Updates the transform of this object\n *\n * @private\n */\nBitmapText.prototype.updateTransform = function ()\n{\n if (this.dirty)\n {\n this.updateText();\n this.dirty = false;\n }\n\n this.containerUpdateTransform();\n};\n\nBitmapText.fonts = {};\n", "var core = require('../core');\n\n/**\n * A Text Object will create a line or multiple lines of text. To split a line you can use '\\n' in your text string,\n * or add a wordWrap property set to true and and wordWrapWidth property with a value in the style object.\n *\n * A Text can be created directly from a string and a style object\n *\n * ```js\n * var text = new PIXI.Text('This is a pixi text',{font : '24px Arial', fill : 0xff1010, align : 'center'});\n * ```\n *\n * @class\n * @extends Sprite\n * @memberof PIXI.text\n * @param text {string} The copy that you would like the text to display\n * @param [style] {object} The style parameters\n * @param [style.font] {string} default 'bold 20px Arial' The style and size of the font\n * @param [style.fill='black'] {String|Number} A canvas fillstyle that will be used on the text e.g 'red', '#00FF00'\n * @param [style.align='left'] {string} Alignment for multiline text ('left', 'center' or 'right'), does not affect single line text\n * @param [style.stroke] {String|Number} A canvas fillstyle that will be used on the text stroke e.g 'blue', '#FCFF00'\n * @param [style.strokeThickness=0] {number} A number that represents the thickness of the stroke. Default is 0 (no stroke)\n * @param [style.wordWrap=false] {boolean} Indicates if word wrap should be used\n * @param [style.wordWrapWidth=100] {number} The width at which text will wrap, it needs wordWrap to be set to true\n * @param [style.lineHeight] {number} The line height, a number that represents the vertical space that a letter uses\n * @param [style.dropShadow=false] {boolean} Set a drop shadow for the text\n * @param [style.dropShadowColor='#000000'] {string} A fill style to be used on the dropshadow e.g 'red', '#00FF00'\n * @param [style.dropShadowAngle=Math.PI/4] {number} Set a angle of the drop shadow\n * @param [style.dropShadowDistance=5] {number} Set a distance of the drop shadow\n * @param [style.padding=0] {number} Occasionally some fonts are cropped. Adding some padding will prevent this from happening\n */\nfunction Text(text, style, resolution)\n{\n /**\n * The canvas element that everything is drawn to\n *\n * @member {HTMLCanvasElement}\n */\n this.canvas = document.createElement('canvas');\n\n /**\n * The canvas 2d context that everything is drawn with\n * @member {HTMLCanvasElement}\n */\n this.context = this.canvas.getContext('2d');\n\n /**\n * The resolution of the canvas.\n * @member {number}\n */\n this.resolution = resolution || core.RESOLUTION;\n\n /**\n * Private tracker for the current text.\n *\n * @member {string}\n * @private\n */\n this._text = null;\n\n /**\n * Private tracker for the current style.\n *\n * @member {object}\n * @private\n */\n this._style = null;\n\n var texture = core.Texture.fromCanvas(this.canvas);\n texture.trim = new core.math.Rectangle();\n core.Sprite.call(this, texture);\n\n\n this.text = text;\n this.style = style;\n}\n\n// constructor\nText.prototype = Object.create(core.Sprite.prototype);\nText.prototype.constructor = Text;\nmodule.exports = Text;\n\nText.fontPropertiesCache = {};\nText.fontPropertiesCanvas = document.createElement('canvas');\nText.fontPropertiesContext = Text.fontPropertiesCanvas.getContext('2d');\n\nObject.defineProperties(Text.prototype, {\n /**\n * The width of the Text, setting this will actually modify the scale to achieve the value set\n *\n * @member {number}\n * @memberof Text#\n */\n width: {\n get: function ()\n {\n if (this.dirty)\n {\n this.updateText();\n }\n\n return this.scale.x * this._texture._frame.width;\n },\n set: function (value)\n {\n this.scale.x = value / this._texture._frame.width;\n this._width = value;\n }\n },\n\n /**\n * The height of the Text, setting this will actually modify the scale to achieve the value set\n *\n * @member {number}\n * @memberof Text#\n */\n height: {\n get: function ()\n {\n if (this.dirty)\n {\n this.updateText();\n }\n\n return this.scale.y * this._texture._frame.height;\n },\n set: function (value)\n {\n this.scale.y = value / this._texture._frame.height;\n this._height = value;\n }\n },\n\n /**\n * Set the style of the text\n *\n * @param [style] {object} The style parameters\n * @param [style.font='bold 20pt Arial'] {string} The style and size of the font\n * @param [style.fill='black'] {object} A canvas fillstyle that will be used on the text eg 'red', '#00FF00'\n * @param [style.align='left'] {string} Alignment for multiline text ('left', 'center' or 'right'), does not affect single line text\n * @param [style.stroke='black'] {string} A canvas fillstyle that will be used on the text stroke eg 'blue', '#FCFF00'\n * @param [style.strokeThickness=0] {number} A number that represents the thickness of the stroke. Default is 0 (no stroke)\n * @param [style.wordWrap=false] {boolean} Indicates if word wrap should be used\n * @param [style.wordWrapWidth=100] {number} The width at which text will wrap\n * @param [style.lineHeight] {number} The line height, a number that represents the vertical space that a letter uses\n * @param [style.dropShadow=false] {boolean} Set a drop shadow for the text\n * @param [style.dropShadowColor='#000000'] {string} A fill style to be used on the dropshadow e.g 'red', '#00FF00'\n * @param [style.dropShadowAngle=Math.PI/6] {number} Set a angle of the drop shadow\n * @param [style.dropShadowDistance=5] {number} Set a distance of the drop shadow\n * @param [style.padding=0] {number} Occasionally some fonts are cropped. Adding some padding will prevent this from happening\n * @memberof Text#\n */\n style: {\n get: function ()\n {\n return this._style;\n },\n set: function (style)\n {\n style = style || {};\n style.font = style.font || 'bold 20pt Arial';\n style.fill = style.fill || 'black';\n style.align = style.align || 'left';\n style.stroke = style.stroke || 'black'; //provide a default, see: https://github.com/GoodBoyDigital/pixi.js/issues/136\n style.strokeThickness = style.strokeThickness || 0;\n style.wordWrap = style.wordWrap || false;\n style.wordWrapWidth = style.wordWrapWidth || 100;\n\n style.dropShadow = style.dropShadow || false;\n style.dropShadowColor = style.dropShadowColor || '#000000';\n style.dropShadowAngle = style.dropShadowAngle || Math.PI / 6;\n style.dropShadowDistance = style.dropShadowDistance || 5;\n\n style.padding = style.padding || 0;\n\n this._style = style;\n this.dirty = true;\n }\n },\n\n /**\n * Set the copy for the text object. To split a line you can use '\\n'.\n *\n * @param text {string} The copy that you would like the text to display\n * @memberof Text#\n */\n text: {\n get: function()\n {\n return this._text;\n },\n set: function (text){\n text = text.toString() || ' ';\n if (this._text === text)\n {\n return;\n }\n this._text = text;\n this.dirty = true;\n }\n }\n});\n\n/**\n * Renders text and updates it when needed\n *\n * @private\n */\nText.prototype.updateText = function ()\n{\n var style = this._style;\n this.context.font = style.font;\n\n // word wrap\n // preserve original text\n var outputText = style.wordWrap ? this.wordWrap(this._text) : this._text;\n\n // split text into lines\n var lines = outputText.split(/(?:\\r\\n|\\r|\\n)/);\n\n // calculate text width\n var lineWidths = new Array(lines.length);\n var maxLineWidth = 0;\n var fontProperties = this.determineFontProperties(style.font);\n for (var i = 0; i < lines.length; i++)\n {\n var lineWidth = this.context.measureText(lines[i]).width;\n lineWidths[i] = lineWidth;\n maxLineWidth = Math.max(maxLineWidth, lineWidth);\n }\n\n var width = maxLineWidth + style.strokeThickness;\n if (style.dropShadow)\n {\n width += style.dropShadowDistance;\n }\n\n this.canvas.width = ( width + this.context.lineWidth ) * this.resolution;\n\n // calculate text height\n var lineHeight = this.style.lineHeight || fontProperties.fontSize + style.strokeThickness;\n\n var height = lineHeight * lines.length;\n if (style.dropShadow)\n {\n height += style.dropShadowDistance;\n }\n\n this.canvas.height = ( height + this._style.padding * 2 ) * this.resolution;\n\n this.context.scale( this.resolution, this.resolution);\n\n if (navigator.isCocoonJS)\n {\n this.context.clearRect(0, 0, this.canvas.width, this.canvas.height);\n\n }\n\n //this.context.fillStyle=\"#FF0000\";\n //this.context.fillRect(0, 0, this.canvas.width, this.canvas.height);\n\n this.context.font = style.font;\n this.context.strokeStyle = style.stroke;\n this.context.lineWidth = style.strokeThickness;\n this.context.textBaseline = 'alphabetic';\n //this.context.lineJoin = 'round';\n\n var linePositionX;\n var linePositionY;\n\n if (style.dropShadow)\n {\n this.context.fillStyle = style.dropShadowColor;\n\n var xShadowOffset = Math.cos(style.dropShadowAngle) * style.dropShadowDistance;\n var yShadowOffset = Math.sin(style.dropShadowAngle) * style.dropShadowDistance;\n\n for (i = 0; i < lines.length; i++)\n {\n linePositionX = style.strokeThickness / 2;\n linePositionY = (style.strokeThickness / 2 + i * lineHeight) + fontProperties.ascent;\n\n if (style.align === 'right')\n {\n linePositionX += maxLineWidth - lineWidths[i];\n }\n else if (style.align === 'center')\n {\n linePositionX += (maxLineWidth - lineWidths[i]) / 2;\n }\n\n if (style.fill)\n {\n this.context.fillText(lines[i], linePositionX + xShadowOffset, linePositionY + yShadowOffset + this._style.padding);\n }\n }\n }\n\n //set canvas text styles\n this.context.fillStyle = style.fill;\n\n //draw lines line by line\n for (i = 0; i < lines.length; i++)\n {\n linePositionX = style.strokeThickness / 2;\n linePositionY = (style.strokeThickness / 2 + i * lineHeight) + fontProperties.ascent;\n\n if (style.align === 'right')\n {\n linePositionX += maxLineWidth - lineWidths[i];\n }\n else if (style.align === 'center')\n {\n linePositionX += (maxLineWidth - lineWidths[i]) / 2;\n }\n\n if (style.stroke && style.strokeThickness)\n {\n this.context.strokeText(lines[i], linePositionX, linePositionY + this._style.padding);\n }\n\n if (style.fill)\n {\n this.context.fillText(lines[i], linePositionX, linePositionY + this._style.padding);\n }\n }\n\n this.updateTexture();\n};\n\n/**\n * Updates texture size based on canvas size\n *\n * @private\n */\nText.prototype.updateTexture = function ()\n{\n var texture = this._texture;\n\n texture.baseTexture.hasLoaded = true;\n texture.baseTexture.resolution = this.resolution;\n\n texture.baseTexture.width = this.canvas.width / this.resolution;\n texture.baseTexture.height = this.canvas.height / this.resolution;\n texture.crop.width = texture._frame.width = this.canvas.width / this.resolution;\n texture.crop.height = texture._frame.height = this.canvas.height / this.resolution;\n\n texture.trim.x = 0;\n texture.trim.y = -this._style.padding;\n\n texture.trim.width = texture._frame.width;\n texture.trim.height = texture._frame.height - this._style.padding*2;\n\n this._width = this.canvas.width / this.resolution;\n this._height = this.canvas.height / this.resolution;\n\n texture.update();\n\n this.dirty = false;\n};\n\n/**\n * Renders the object using the WebGL renderer\n *\n * @param renderer {WebGLRenderer}\n */\nText.prototype.renderWebGL = function (renderer)\n{\n if (this.dirty)\n {\n //this.resolution = 1//renderer.resolution;\n\n this.updateText();\n }\n\n core.Sprite.prototype.renderWebGL.call(this, renderer);\n};\n\n/**\n * Renders the object using the Canvas renderer\n *\n * @param renderer {CanvasRenderer}\n */\nText.prototype._renderCanvas = function (renderer)\n{\n if (this.dirty)\n {\n // this.resolution = 1//renderer.resolution;\n\n this.updateText();\n }\n\n core.Sprite.prototype._renderCanvas.call(this, renderer);\n};\n\n/**\n * Calculates the ascent, descent and fontSize of a given fontStyle\n *\n * @param fontStyle {object}\n * @private\n */\nText.prototype.determineFontProperties = function (fontStyle)\n{\n var properties = Text.fontPropertiesCache[fontStyle];\n\n if (!properties)\n {\n properties = {};\n\n var canvas = Text.fontPropertiesCanvas;\n var context = Text.fontPropertiesContext;\n\n context.font = fontStyle;\n\n var width = Math.ceil(context.measureText('|MÉq').width);\n var baseline = Math.ceil(context.measureText('M').width);\n var height = 2 * baseline;\n\n baseline = baseline * 1.4 | 0;\n\n canvas.width = width;\n canvas.height = height;\n\n context.fillStyle = '#f00';\n context.fillRect(0, 0, width, height);\n\n context.font = fontStyle;\n\n context.textBaseline = 'alphabetic';\n context.fillStyle = '#000';\n context.fillText('|MÉq', 0, baseline);\n\n var imagedata = context.getImageData(0, 0, width, height).data;\n var pixels = imagedata.length;\n var line = width * 4;\n\n var i, j;\n\n var idx = 0;\n var stop = false;\n\n // ascent. scan from top to bottom until we find a non red pixel\n for (i = 0; i < baseline; i++)\n {\n for (j = 0; j < line; j += 4)\n {\n if (imagedata[idx + j] !== 255)\n {\n stop = true;\n break;\n }\n }\n if (!stop)\n {\n idx += line;\n }\n else\n {\n break;\n }\n }\n\n properties.ascent = baseline - i;\n\n idx = pixels - line;\n stop = false;\n\n // descent. scan from bottom to top until we find a non red pixel\n for (i = height; i > baseline; i--)\n {\n for (j = 0; j < line; j += 4)\n {\n if (imagedata[idx + j] !== 255)\n {\n stop = true;\n break;\n }\n }\n if (!stop)\n {\n idx -= line;\n }\n else\n {\n break;\n }\n }\n\n properties.descent = i - baseline;\n properties.fontSize = properties.ascent + properties.descent;\n\n Text.fontPropertiesCache[fontStyle] = properties;\n }\n\n return properties;\n};\n\n/**\n * Applies newlines to a string to have it optimally fit into the horizontal\n * bounds set by the Text object's wordWrapWidth property.\n *\n * @param text {string}\n * @private\n */\nText.prototype.wordWrap = function (text)\n{\n // Greedy wrapping algorithm that will wrap words as the line grows longer\n // than its horizontal bounds.\n var result = '';\n var lines = text.split('\\n');\n var wordWrapWidth = this._style.wordWrapWidth;\n for (var i = 0; i < lines.length; i++)\n {\n var spaceLeft = wordWrapWidth;\n var words = lines[i].split(' ');\n for (var j = 0; j < words.length; j++)\n {\n var wordWidth = this.context.measureText(words[j]).width;\n var wordWidthWithSpace = wordWidth + this.context.measureText(' ').width;\n if (j === 0 || wordWidthWithSpace > spaceLeft)\n {\n // Skip printing the newline if it's the first word of the line that is\n // greater than the word wrap width.\n if (j > 0)\n {\n result += '\\n';\n }\n result += words[j];\n spaceLeft = wordWrapWidth - wordWidth;\n }\n else\n {\n spaceLeft -= wordWidthWithSpace;\n result += ' ' + words[j];\n }\n }\n\n if (i < lines.length-1)\n {\n result += '\\n';\n }\n }\n return result;\n};\n\n/**\n * Returns the bounds of the Text as a rectangle. The bounds calculation takes the worldTransform into account.\n *\n * @param matrix {Matrix} the transformation matrix of the Text\n * @return {Rectangle} the framing rectangle\n */\nText.prototype.getBounds = function (matrix)\n{\n if (this.dirty)\n {\n this.updateText();\n }\n\n return core.Sprite.prototype.getBounds.call(this, matrix);\n};\n\n/**\n * Destroys this text object.\n *\n * @param destroyBaseTexture {boolean} whether to destroy the base texture as well\n */\nText.prototype.destroy = function (destroyBaseTexture)\n{\n // make sure to reset the the context and canvas.. dont want this hanging around in memory!\n this.context = null;\n this.canvas = null;\n\n this._texture.destroy(destroyBaseTexture === undefined ? true : destroyBaseTexture);\n};\n", "/**\n * @file Main export of the PIXI text library\n * @author Mat Groves \n * @copyright 2013-2015 GoodBoyDigital\n * @license {@link https://github.com/GoodBoyDigital/pixi.js/blob/master/LICENSE|MIT License}\n */\n\n/**\n * @namespace PIXI.text\n */\nmodule.exports = {\n Text: require('./Text'),\n BitmapText: require('./BitmapText')\n};\n", "var core = require('./core');\n\nextendCore(require('./extras'));\nextendCore(require('./filters'));\nextendCore(require('./interaction'));\nextendCore(require('./loaders'));\nextendCore(require('./spine'));\nextendCore(require('./text'));\nextendCore(require('./deprecation'));\n\nfunction extendCore(obj)\n{\n for(var key in obj)\n {\n core[key] = obj[key];\n }\n}\n\nmodule.exports = core;\n" diff --git a/bin/pixi.min.js b/bin/pixi.min.js index 9678809..d7ff119 100644 --- a/bin/pixi.min.js +++ b/bin/pixi.min.js @@ -5,5 +5,5 @@ }var i=t("../../renderers/webgl/utils/ObjectRenderer"),n=(t("../../renderers/webgl/shaders/Shader"),t("../../renderers/webgl/WebGLRenderer")),o=t("../../const");r.prototype=Object.create(i.prototype),r.prototype.constructor=r,e.exports=r,n.registerPlugin("sprite",r),r.prototype.onContextChange=function(){var t=this.renderer.gl;this.shader=this.renderer.shaderManager.defaultShader,this.vertexBuffer=t.createBuffer(),this.indexBuffer=t.createBuffer(),t.bindBuffer(t.ELEMENT_ARRAY_BUFFER,this.indexBuffer),t.bufferData(t.ELEMENT_ARRAY_BUFFER,this.indices,t.STATIC_DRAW),t.bindBuffer(t.ARRAY_BUFFER,this.vertexBuffer),t.bufferData(t.ARRAY_BUFFER,this.vertices,t.DYNAMIC_DRAW),this.currentBlendMode=99999},r.prototype.render=function(t){var e=t._texture;this.currentBatchSize>=this.size&&(this.flush(),this.currentBaseTexture=e.baseTexture);var r=e._uvs;if(r){var i,n,o,s,a=t.anchor.x,h=t.anchor.y;if(e.trim){var l=e.trim;n=l.x-a*l.width,i=n+e.crop.width,s=l.y-h*l.height,o=s+e.crop.height}else i=e._frame.width*(1-a),n=e._frame.width*-a,o=e._frame.height*(1-h),s=e._frame.height*-h;var u=this.currentBatchSize*this.vertByteSize,c=t.worldTransform,d=c.a,p=c.b,f=c.c,g=c.d,v=c.tx,m=c.ty,y=this.colors,x=this.positions;this.renderer.roundPixels?(x[u]=d*n+f*s+v|0,x[u+1]=g*s+p*n+m|0,x[u+5]=d*i+f*s+v|0,x[u+6]=g*s+p*i+m|0,x[u+10]=d*i+f*o+v|0,x[u+11]=g*o+p*i+m|0,x[u+15]=d*n+f*o+v|0,x[u+16]=g*o+p*n+m|0):(x[u]=d*n+f*s+v,x[u+1]=g*s+p*n+m,x[u+5]=d*i+f*s+v,x[u+6]=g*s+p*i+m,x[u+10]=d*i+f*o+v,x[u+11]=g*o+p*i+m,x[u+15]=d*n+f*o+v,x[u+16]=g*o+p*n+m),x[u+2]=r.x0,x[u+3]=r.y0,x[u+7]=r.x1,x[u+8]=r.y1,x[u+12]=r.x2,x[u+13]=r.y2,x[u+17]=r.x3,x[u+18]=r.y3;var b=t.tint;y[u+4]=y[u+9]=y[u+14]=y[u+19]=(b>>16)+(65280&b)+((255&b)<<16)+(255*t.worldAlpha<<24),this.sprites[this.currentBatchSize++]=t}},r.prototype.flush=function(){if(0!==this.currentBatchSize){var t,e=this.renderer.gl;if(this.currentBatchSize>.5*this.size)e.bufferSubData(e.ARRAY_BUFFER,0,this.vertices);else{var r=this.positions.subarray(0,this.currentBatchSize*this.vertByteSize);e.bufferSubData(e.ARRAY_BUFFER,0,r)}for(var i,n,o,s,a=0,h=0,l=null,u=this.renderer.blendModeManager.currentBlendMode,c=null,d=!1,p=!1,f=0,g=this.currentBatchSize;g>f;f++)s=this.sprites[f],i=s._texture.baseTexture,n=s.blendMode,o=s.shader||this.shader,d=u!==n,p=c!==o,(l!==i||d||p)&&(this.renderBatch(l,a,h),h=f,a=0,l=i,d&&(u=n,this.renderer.blendModeManager.setBlendMode(u)),p&&(c=o,t=c.shaders?c.shaders[e.id]:c,t||(t=c.getShader(this.renderer)),this.renderer.shaderManager.setShader(t),t.uniforms.projectionMatrix.value=this.renderer.currentRenderTarget.projectionMatrix.toArray(!0),t.syncUniforms(),e.activeTexture(e.TEXTURE0))),a++;this.renderBatch(l,a,h),this.currentBatchSize=0}},r.prototype.renderBatch=function(t,e,r){if(0!==e){var i=this.renderer.gl;t._glTextures[i.id]?i.bindTexture(i.TEXTURE_2D,t._glTextures[i.id]):this.renderer.updateTexture(t),i.drawElements(i.TRIANGLES,6*e,i.UNSIGNED_SHORT,6*r*2),this.renderer.drawCount++}},r.prototype.start=function(){var t=this.renderer.gl;t.bindBuffer(t.ARRAY_BUFFER,this.vertexBuffer),t.bindBuffer(t.ELEMENT_ARRAY_BUFFER,this.indexBuffer);var e=this.vertByteSize;t.vertexAttribPointer(this.shader.attributes.aVertexPosition,2,t.FLOAT,!1,e,0),t.vertexAttribPointer(this.shader.attributes.aTextureCoord,2,t.FLOAT,!1,e,8),t.vertexAttribPointer(this.shader.attributes.aColor,4,t.UNSIGNED_BYTE,!0,e,16)},r.prototype.destroy=function(){this.renderer.gl.deleteBuffer(this.vertexBuffer),this.renderer.gl.deleteBuffer(this.indexBuffer),this.shader.destroy(),this.renderer=null,this.vertices=null,this.positions=null,this.colors=null,this.indices=null,this.vertexBuffer=null,this.indexBuffer=null,this.currentBaseTexture=null,this.drawing=!1,this.textures=null,this.blendModes=null,this.shaders=null,this.sprites=null,this.shader=null}},{"../../const":12,"../../renderers/webgl/WebGLRenderer":38,"../../renderers/webgl/shaders/Shader":50,"../../renderers/webgl/utils/ObjectRenderer":52}],58:[function(t,e){function r(t,e,r){this.uuid=i.uuid(),this.resolution=r||1,this.width=100,this.height=100,this.realWidth=100,this.realHeight=100,this.scaleMode=e||n.SCALE_MODES.DEFAULT,this.hasLoaded=!1,this.isLoading=!1,this.source=null,this.premultipliedAlpha=!0,this.imageUrl=null,this.isPowerOfTwo=!1,this.mipmap=!1,this._glTextures=[],t&&this.loadSource(t)}var i=t("../utils"),n=t("../const");r.prototype.constructor=r,e.exports=r,i.eventTarget.mixin(r.prototype),r.prototype.update=function(){this.emit("update",this)},r.prototype.loadSource=function(t){var e=this.isLoading;if(this.hasLoaded=!1,this.isLoading=!1,e&&this.source&&(this.source.onload=null,this.source.onerror=null),this.source=t,(this.source.complete||this.source.getContext)&&this.source.width&&this.source.height)this._sourceLoaded();else if(!t.getContext){this.isLoading=!0;var r=this;t.onload=function(){t.onload=null,t.onerror=null,r.isLoading&&(r.isLoading=!1,r._sourceLoaded(),r.emit("loaded",r))},t.onerror=function(){t.onload=null,t.onerror=null,r.isLoading&&(r.isLoading=!1,r.emit("error",r))},t.complete&&t.src&&(this.isLoading=!1,t.onload=null,t.onerror=null,t.width&&t.height?(this._sourceLoaded(),e&&this.emit("loaded",this)):e&&this.emit("error",this))}},r.prototype._sourceLoaded=function(){this.hasLoaded=!0,this.realWidth=this.source.naturalWidth||this.source.width,this.realHeight=this.source.naturalHeight||this.source.height,this.width=this.realWidth/this.resolution,this.height=this.realHeight/this.resolution,this.isPowerOfTwo=i.isPowerOfTwo(this.width,this.height),this.update()},r.prototype.destroy=function(){this.imageUrl?(delete i.BaseTextureCache[this.imageUrl],delete i.TextureCache[this.imageUrl],this.imageUrl=null,navigator.isCocoonJS||(this.source.src="")):this.source&&this.source._pixiId&&delete i.BaseTextureCache[this.source._pixiId],this.source=null,this.dispose()},r.prototype.dispose=function(){this.emit("dispose",this)},r.prototype.updateSourceImage=function(t){this.source.src=t,this.loadSource(this.source)},r.fromImage=function(t,e,n){var o=i.BaseTextureCache[t];if(void 0===e&&0!==t.indexOf("data:")&&(e=!0),!o){var s=new Image;e&&(s.crossOrigin=""),o=new r(s,n),o.imageUrl=t,s.src=t,i.BaseTextureCache[t]=o,o.resolution=i.getResolutionOfUrl(t)}return o},r.fromCanvas=function(t,e){t._pixiId||(t._pixiId="canvas_"+i.uuid());var n=i.BaseTextureCache[t._pixiId];return n||(n=new r(t,e),i.BaseTextureCache[t._pixiId]=n),n}},{"../const":12,"../utils":67}],59:[function(t,e){function r(t,e,r,u,c){if(!t)throw new Error("Unable to create RenderTexture, you must pass a renderer into the constructor.");e=e||100,r=r||100,c=c||l.RESOLUTION;var d=new i;if(d.width=e,d.height=r,d.resolution=c,d.scaleMode=u||l.SCALE_MODES.DEFAULT,d.hasLoaded=!0,n.call(this,d,new h.Rectangle(0,0,e,r)),this.width=e,this.height=r,this.resolution=c,this.render=null,this.renderer=t,this.renderer.type===l.RENDERER_TYPE.WEBGL){var p=this.renderer.gl;this.textureBuffer=new o(p,this.width,this.height,null,this.resolution),this.baseTexture._glTextures[p.id]=this.textureBuffer.texture,this.filterManager=new s(this.renderer),this.filterManager.onContextChange(),this.filterManager.resize(e,r),this.render=this.renderWebGL,this.renderer.currentRenderer.start()}else this.render=this.renderCanvas,this.textureBuffer=new a(this.width*this.resolution,this.height*this.resolution),this.baseTexture.source=this.textureBuffer.canvas;this.valid=!0,this._updateUvs()}var i=t("./BaseTexture"),n=t("./Texture"),o=t("../renderers/webgl/utils/RenderTarget"),s=t("../renderers/webgl/managers/FilterManager"),a=t("../renderers/canvas/utils/CanvasBuffer"),h=t("../math"),l=t("../const"),u=new h.Matrix;r.prototype=Object.create(n.prototype),r.prototype.constructor=r,e.exports=r,r.prototype.resize=function(t,e,r){(t!==this.width||e!==this.height)&&(this.valid=t>0&&e>0,this.width=this._frame.width=this.crop.width=t,this.height=this._frame.height=this.crop.height=e,r&&(this.baseTexture.width=this.width,this.baseTexture.height=this.height),this.renderer.type===l.RENDERER_TYPE.WEBGL&&(this.projection.x=this.width/2,this.projection.y=-this.height/2),this.valid&&(this.textureBuffer.resize(this.width*this.resolution,this.height*this.resolution),this.filterManager&&this.filterManager.resize(this.width,this.height)))},r.prototype.clear=function(){this.valid&&(this.renderer.type===l.RENDERER_TYPE.WEBGL&&this.renderer.gl.bindFramebuffer(this.renderer.gl.FRAMEBUFFER,this.textureBuffer.frameBuffer),this.textureBuffer.clear())},r.prototype.renderWebGL=function(t,e,r,i){if(this.valid){if(i=!!i,this.textureBuffer.transform=e,t.worldAlpha=t.alpha,i){t.worldTransform.identity(),t.currentBounds=null;var n,o,s=t.children;for(n=0,o=s.length;o>n;++n)s[n].updateTransform()}r&&this.textureBuffer.clear();var a=this.renderer.filterManager;this.renderer.filterManager=this.filterManager,this.renderer.renderDisplayObject(t,this.textureBuffer),this.renderer.filterManager=a}},r.prototype.renderCanvas=function(t,e,r,i){if(this.valid){i=!!i;var n=t.worldTransform,o=u;o.identity(),e&&o.append(e),t.worldTransform=o,t.worldAlpha=1;var s,a,h=t.children;for(s=0,a=h.length;a>s;++s)h[s].updateTransform();r&&this.textureBuffer.clear(),t.worldTransform=n;var l=this.textureBuffer.context,c=this.renderer.resolution;this.renderer.resolution=this.resolution,this.renderer.renderDisplayObject(t,l),this.renderer.resolution=c}},r.prototype.destroy=function(){n.prototype.destroy.call(this,!0),this.textureBuffer.destroy(),this.filterManager&&this.filterManager.destroy(),this.renderer=null},r.prototype.getImage=function(){var t=new Image;return t.src=this.getBase64(),t},r.prototype.getBase64=function(){return this.getCanvas().toDataURL()},r.prototype.getCanvas=function(){if(this.renderer.type===l.RENDERER_TYPE.WEBGL){var t=this.renderer.gl,e=this.textureBuffer.width,r=this.textureBuffer.height,i=new Uint8Array(4*e*r);t.bindFramebuffer(t.FRAMEBUFFER,this.textureBuffer.frameBuffer),t.readPixels(0,0,e,r,t.RGBA,t.UNSIGNED_BYTE,i),t.bindFramebuffer(t.FRAMEBUFFER,null);var n=new a(e,r),o=n.context.getImageData(0,0,e,r);return o.data.set(i),n.context.putImageData(o,0,0),n.canvas}return this.textureBuffer.canvas}},{"../const":12,"../math":22,"../renderers/canvas/utils/CanvasBuffer":34,"../renderers/webgl/managers/FilterManager":43,"../renderers/webgl/utils/RenderTarget":54,"./BaseTexture":58,"./Texture":60}],60:[function(t,e){function r(t,e,i,n,o){this.noFrame=!1,e||(this.noFrame=!0,e=new a.Rectangle(0,0,1,1)),t instanceof r&&(t=t.baseTexture),this.baseTexture=t,this._frame=e,this.trim=n,this.valid=!1,this.requiresUpdate=!1,this._uvs=null,this.width=0,this.height=0,this.crop=i||e,this.rotate=!!o,t.hasLoaded?(this.noFrame&&(e=new a.Rectangle(0,0,t.width,t.height)),this.frame=e):t.addEventListener("loaded",this.onBaseTextureLoaded.bind(this))}var i=t("./BaseTexture"),n=t("./VideoBaseTexture"),o=t("./TextureUvs"),s=t("../utils/eventTarget"),a=t("../math"),h=t("../utils");r.prototype.constructor=r,e.exports=r,s.mixin(r.prototype),Object.defineProperties(r.prototype,{frame:{get:function(){return this._frame},set:function(t){if(this._frame=t,this.noFrame=!1,this.width=t.width,this.height=t.height,!this.trim&&!this.rotate&&(t.x+t.width>this.baseTexture.width||t.y+t.height>this.baseTexture.height))throw new Error("Texture Error: frame does not fit inside the base Texture dimensions "+this);this.valid=t&&t.width&&t.height&&this.baseTexture.hasLoaded,this.trim?(this.width=this.trim.width,this.height=this.trim.height,this._frame.width=this.trim.width,this._frame.height=this.trim.height):this.crop=t,this.valid&&this._updateUvs()}}}),r.prototype.update=function(){this.baseTexture.update()},r.prototype.onBaseTextureLoaded=function(){var t=this.baseTexture;t.removeEventListener("loaded",this.onLoaded),this.frame=this.noFrame?new a.Rectangle(0,0,t.width,t.height):this._frame,this.emit("update",this)},r.prototype.destroy=function(t){t&&this.baseTexture.destroy(),this.valid=!1},r.prototype.clone=function(){return new r(this.baseTexture,this.frame,this.crop,this.trim,this.rotate)},r.prototype._updateUvs=function(){this._uvs||(this._uvs=new o),this._uvs.set(this.crop,this.baseTexture,this.rotate)},r.fromImage=function(t,e,n){var o=h.TextureCache[t];return o||(o=new r(i.fromImage(t,e,n)),h.TextureCache[t]=o),o},r.fromFrame=function(t){var e=h.TextureCache[t];if(!e)throw new Error('The frameId "'+t+'" does not exist in the texture cache');return e},r.fromCanvas=function(t,e){return new r(i.fromCanvas(t,e))},r.fromVideo=function(t,e){return new r(n.baseTextureFromVideo(t,e))},r.fromVideoUrl=function(t,e){return new r(n.fromUrl(t,e))},r.addTextureToCache=function(t,e){h.TextureCache[e]=t},r.removeTextureFromCache=function(t){var e=h.TextureCache[t];return delete h.TextureCache[t],delete h.BaseTextureCache[t],e},r.emptyTexture=new r(new i)},{"../math":22,"../utils":67,"../utils/eventTarget":66,"./BaseTexture":58,"./TextureUvs":61,"./VideoBaseTexture":62}],61:[function(t,e){function r(){this.x0=0,this.y0=0,this.x1=0,this.y1=0,this.x2=0,this.y2=0,this.x3=0,this.y3=0}e.exports=r,r.prototype.set=function(t,e,r){var i=e.width,n=e.height;r?(this.x0=(t.x+t.height)/i,this.y0=t.y/n,this.x1=(t.x+t.height)/i,this.y1=(t.y+t.width)/n,this.x2=t.x/i,this.y2=(t.y+t.width)/n,this.x3=t.x/i,this.y3=t.y/n):(this.x0=t.x/i,this.y0=t.y/n,this.x1=(t.x+t.width)/i,this.y1=t.y/n,this.x2=(t.x+t.width)/i,this.y2=(t.y+t.height)/n,this.x3=t.x/i,this.y3=(t.y+t.height)/n)}},{}],62:[function(t,e){function r(t,e){if(!t)throw new Error("No video source element specified.");(t.readyState===t.HAVE_ENOUGH_DATA||t.readyState===t.HAVE_FUTURE_DATA)&&t.width&&t.height&&(t.complete=!0),n.call(this,t,e),this.autoUpdate=!1,this._onUpdate=this._onUpdate.bind(this),this._onCanPlay=this._onCanPlay.bind(this),t.complete||(t.addEventListener("canplay",this._onCanPlay),t.addEventListener("canplaythrough",this._onCanPlay),t.addEventListener("play",this._onPlayStart.bind(this)),t.addEventListener("pause",this._onPlayStop.bind(this))),this.__loaded=!1}function i(t,e){e||(e="video/"+t.substr(t.lastIndexOf(".")+1));var r=document.createElement("source");return r.src=t,r.type=e,r}var n=t("./BaseTexture"),o=t("../utils");r.prototype=Object.create(n.prototype),r.prototype.constructor=r,e.exports=r,r.prototype._onUpdate=function(){this.autoUpdate&&(window.requestAnimationFrame(this._onUpdate),this.update())},r.prototype._onPlayStart=function(){this.autoUpdate||(window.requestAnimationFrame(this._onUpdate),this.autoUpdate=!0)},r.prototype._onPlayStop=function(){this.autoUpdate=!1},r.prototype._onCanPlay=function(){this.hasLoaded=!0,this.source&&(this.source.removeEventListener("canplay",this._onCanPlay),this.source.removeEventListener("canplaythrough",this._onCanPlay),this.width=this.source.videoWidth,this.height=this.source.videoHeight,this.source.play(),this.__loaded||(this.__loaded=!0,this.emit("loaded",this)))},r.prototype.destroy=function(){this.source&&this.source._pixiId&&(o.BaseTextureCache[this.source._pixiId]=null,delete o.BaseTextureCache[this.source._pixiId],this.source._pixiId=null,delete this.source._pixiId),n.prototype.destroy.call(this)},r.fromVideo=function(t,e){t._pixiId||(t._pixiId="video_"+o.uuid());var i=o.BaseTextureCache[t._pixiId];return i||(i=new r(t,e),o.BaseTextureCache[t._pixiId]=i),i},r.fromUrl=function(t,e){var n=document.createElement("video");if(Array.isArray(t))for(var o=0;o>1;if(3>i)return[];for(var n=[],o=[],s=0;i>s;s++)o.push(s);s=0;for(var a=i;a>3;){var h=o[(s+0)%a],l=o[(s+1)%a],u=o[(s+2)%a],c=t[2*h],d=t[2*h+1],p=t[2*l],f=t[2*l+1],g=t[2*u],v=t[2*u+1],m=!1;if(r._convex(c,d,p,f,g,v,e)){m=!0;for(var y=0;a>y;y++){var x=o[y];if(x!==h&&x!==l&&x!==u&&r._PointInTriangle(t[2*x],t[2*x+1],c,d,p,f,g,v)){m=!1;break}}}if(m)n.push(h,l,u),o.splice((s+1)%a,1),a--,s=0;else if(s++>3*a){if(!e)return null;for(n=[],o=[],s=0;i>s;s++)o.push(s);s=0,a=i,e=!1}}return n.push(o[0],o[1],o[2]),n},r._PointInTriangle=function(t,e,r,i,n,o,s,a){var h=s-r,l=a-i,u=n-r,c=o-i,d=t-r,p=e-i,f=h*h+l*l,g=h*u+l*c,v=h*d+l*p,m=u*u+c*c,y=u*d+c*p,x=1/(f*m-g*g),b=(m*v-g*y)*x,T=(f*y-g*v)*x;return b>=0&&T>=0&&1>b+T},r._convex=function(t,e,r,i,n,o,s){return(e-i)*(n-r)+(r-t)*(o-i)>=0===s}},{}],65:[function(t,e){var r=t("./eventTarget"),i=t("./EventData"),n=function(){this.updateBind=this.update.bind(this),this.active=!1,this.eventData=new i(this,"tick",{deltaTime:1}),this.deltaTime=1,this.timeElapsed=0,this.lastTime=0,this.speed=1,this.start()};r.mixin(n.prototype),n.prototype.start=function(){this.active||(this.active=!0,requestAnimationFrame(this.updateBind))},n.prototype.stop=function(){this.active&&(this.active=!1)},n.prototype.update=function(){if(this.active){requestAnimationFrame(this.updateBind);var t=(new Date).getTime(),e=t-this.lastTime;e>100&&(e=100),this.deltaTime=.06*e,this.deltaTime*=this.speed,this.eventData.data.deltaTime=this.deltaTime,this.emit("tick",this.eventData),this.lastTime=t}},e.exports=new n},{"./EventData":63,"./eventTarget":66}],66:[function(t,e){function r(t){t.listeners=function(t){return this._listeners=this._listeners||{},this._listeners[t]?this._listeners[t].slice():[]},t.emit=t.dispatchEvent=function(t,e){if(this._listeners=this._listeners||{},this._listeners[t]){e&&e.__isEventObject||(n.target=this,n.type=t,n.data=e,e=n);var r,i=this._listeners[t].slice(0),o=i.length,s=i[0];for(r=0;o>r;s=i[++r])if(s(e),e.stoppedImmediate)return this;return e.stopped?this:this}},t.on=t.addEventListener=function(t,e){return this._listeners=this._listeners||{},(this._listeners[t]=this._listeners[t]||[]).push(e),this},t.once=function(t,e){function r(){e.apply(i.off(t,r),arguments)}this._listeners=this._listeners||{};var i=this;return r._originalHandler=e,this.on(t,r)},t.off=t.removeEventListener=function(t,e){if(this._listeners=this._listeners||{},!this._listeners[t])return this;for(var r=this._listeners[t],i=e?r.length:0;i-->0;)(r[i]===e||r[i]._originalHandler===e)&&r.splice(i,1);return 0===r.length&&(this._listeners[t]=null),this},t.removeAllListeners=function(t){return this._listeners=this._listeners||{},this._listeners[t]?(this._listeners[t]=null,this):this}}var i=t("./EventData"),n=new i(null,null,{});e.exports={mixin:function(t){r(t)}}},{"./EventData":63}],67:[function(t,e){var r=t("../const"),i=e.exports={_uid:0,_saidHello:!1,RAFramePolyfill:t("./requestAnimationFramePolyfill"),Ticker:t("./Ticker"),EventData:t("./EventData"),eventTarget:t("./eventTarget"),pluginTarget:t("./pluginTarget"),PolyK:t("./PolyK"),uuid:function(){return++i._uid},hex2rgb:function(t,e){return e=e||[],e[0]=(t>>16&255)/255,e[1]=(t>>8&255)/255,e[2]=(255&t)/255,e},hex2string:function(t){return t=t.toString(16),t="000000".substr(0,6-t.length)+t,"#"+t},rgb2hex:function(t){return(255*t[0]<<16)+(255*t[1]<<8)+255*t[2]},canUseNewCanvasBlendModes:function(){if("undefined"==typeof document)return!1;var t="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAQAAAABAQMAAADD8p2OAAAAA1BMVEX/",e="AAAACklEQVQI12NgAAAAAgAB4iG8MwAAAABJRU5ErkJggg==",r=new Image;r.src=t+"AP804Oa6"+e;var i=new Image;i.src=t+"/wCKxvRF"+e;var n=document.createElement("canvas");n.width=6,n.height=1;var o=n.getContext("2d");o.globalCompositeOperation="multiply",o.drawImage(r,0,0),o.drawImage(i,2,0);var s=o.getImageData(2,0,1,1).data;return 255===s[0]&&0===s[1]&&0===s[2]},getNextPowerOfTwo:function(t){if(t>0&&0===(t&t-1))return t;for(var e=1;t>e;)e<<=1;return e},isPowerOfTwo:function(t,e){return t>0&&0===(t&t-1)&&e>0&&0===(e&e-1)},getResolutionOfUrl:function(t){var e=r.RETINA_PREFIX.exec(t);return e?parseFloat(e[1]):1},sayHello:function(t){if(!i._saidHello){if(navigator.userAgent.toLowerCase().indexOf("chrome")>-1){var e=["%c %c %c Pixi.js "+r.VERSION+" - "+t+" %c %c http://www.pixijs.com/ %c %c ♥%c♥%c♥ ","background: #ff66a5","background: #ff66a5","color: #ff66a5; background: #030307;","background: #ff66a5","background: #ffc3dc","background: #ff66a5","color: #ff2424; background: #fff","color: #ff2424; background: #fff","color: #ff2424; background: #fff"];window.console.log.apply(console,e)}else window.console&&window.console.log("Pixi.js "+r.VERSION+" - "+t+" - http://www.pixijs.com/");i._saidHello=!0}},TextureCache:{},BaseTextureCache:{}}},{"../const":12,"./EventData":63,"./PolyK":64,"./Ticker":65,"./eventTarget":66,"./pluginTarget":68,"./requestAnimationFramePolyfill":69}],68:[function(t,e){function r(t){t.__plugins={},t.registerPlugin=function(e,r){t.__plugins[e]=r},t.prototype.initPlugins=function(){this.plugins=this.plugins||{};for(var e in t.__plugins)this.plugins[e]=new t.__plugins[e](this)},t.prototype.destroyPlugins=function(){for(var t in this.plugins)this.plugins[t].destroy(),this.plugins[t]=null;this.plugins=null}}e.exports={mixin:function(t){r(t)}}},{}],69:[function(){!function(t){for(var e=0,r=["ms","moz","webkit","o"],i=0;ie?this.loop?(this.currentFrame+=this._textures.length,this.texture=this._textures[this.currentFrame]):(this.gotoAndStop(0),this.onComplete&&this.onComplete()):this.loop||e=this._textures.length&&(this.gotoAndStop(this.textures.length-1),this.onComplete&&this.onComplete())},r.prototype.destroy=function(){this.stop(),i.Sprite.prototype.destroy.call(this)},r.fromFrames=function(t){for(var e=[],n=0;nx?x:t,t=t>T?T:t,t=t>E?E:t,r=y,r=r>b?b:r,r=r>_?_:r,r=r>w?w:r,e=m,e=x>e?x:e,e=T>e?T:e,e=E>e?E:e,i=y,i=b>i?b:i,i=_>i?_:i,i=w>i?w:i;var S=this._bounds;return S.x=t,S.width=e-t,S.y=r,S.height=i-r,this._currentBounds=S,S},r.prototype.onTextureUpdate=function(){},r.prototype.generateTilingTexture=function(t,e,r){if(this.texture.baseTexture.hasLoaded){e=this.originalTexture||this._texture;var n,a,h=e.frame,l=h.width!==e.baseTexture.width||h.height!==e.baseTexture.height;if(r&&!e.baseTexture.isPowerOfTwo||l){n=i.utils.getNextPowerOfTwo(h.width),a=i.utils.getNextPowerOfTwo(h.height),s.texture=e;var u=new o(t,n,a,e.baseTexture.scaleMode,e.baseTexture.resolution);s.worldTransform.a=(n+1)/h.width,s.worldTransform.d=(a+1)/h.height,s.worldTransform.tx-=.5,s.worldTransform.ty-=.5;var c=t.currentRenderTarget;u.render(s,s.worldTransform,!0,!1),t.setRenderTarget(c),this._tileScaleOffset.x=n/h.width,this._tileScaleOffset.y=a/h.height,this._tilingTexture=u}else this._tilingTexture&&this._tilingTexture.isTiling&&this._tilingTexture.destroy(!0),this._tileScaleOffset.x=1,this._tileScaleOffset.y=1,this._tilingTexture=e;this._refreshTexture=!1,this.originalTexture=this.texture,this._texture=this._tilingTexture}},r.prototype.containsPoint=function(t){this.worldTransform.applyInverse(t,a);var e,r=this._width,i=this._height,n=-r*this.anchor.x;return a.x>n&&a.xe&&a.yn;n++){var o=2*n;this._renderCanvasDrawTriangle(t,e,r,o,o+2,o+4)}},r.prototype._renderCanvasTriangles=function(t){for(var e=this.vertices,r=this.uvs,i=this.indices,n=i.length,o=0;n>o;o+=3){var s=2*i[o],a=2*i[o+1],h=2*i[o+2];this._renderCanvasDrawTriangle(t,e,r,s,a,h)}},r.prototype._renderCanvasDrawTriangle=function(t,e,r,i,n,o){var s=this.texture.baseTexture.source,a=this.texture.width,h=this.texture.height,l=e[i],u=e[n],c=e[o],d=e[i+1],p=e[n+1],f=e[o+1],g=r[i]*a,v=r[n]*a,m=r[o]*a,y=r[i+1]*h,x=r[n+1]*h,b=r[o+1]*h;if(this.canvasPadding>0){var T=this.canvasPadding/this.worldTransform.a,_=this.canvasPadding/this.worldTransform.d,E=(l+u+c)/3,w=(d+p+f)/3,S=l-E,A=d-w,C=Math.sqrt(S*S+A*A);l=E+S/C*(C+T),d=w+A/C*(C+_),S=u-E,A=p-w,C=Math.sqrt(S*S+A*A),u=E+S/C*(C+T),p=w+A/C*(C+_),S=c-E,A=f-w,C=Math.sqrt(S*S+A*A),c=E+S/C*(C+T),f=w+A/C*(C+_)}t.save(),t.beginPath(),t.moveTo(l,d),t.lineTo(u,p),t.lineTo(c,f),t.closePath(),t.clip();var M=g*x+y*m+v*b-x*m-y*v-g*b,R=l*x+y*c+u*b-x*c-y*u-l*b,F=g*u+l*m+v*c-u*m-l*v-g*c,D=g*x*c+y*u*m+l*v*b-l*x*m-y*v*c-g*u*b,O=d*x+y*f+p*b-x*f-y*p-d*b,P=g*p+d*m+v*f-p*m-d*v-g*f,B=g*x*f+y*p*m+d*v*b-d*x*m-y*v*f-g*p*b;t.transform(R/M,O/M,F/M,P/M,D/M,B/M),t.drawImage(s,0,0),t.restore()},r.prototype.renderMeshFlat=function(t){var e=this.context,r=t.vertices,i=r.length/2;e.beginPath();for(var n=1;i-2>n;n++){var o=2*n,s=r[o],a=r[o+2],h=r[o+4],l=r[o+1],u=r[o+3],c=r[o+5];e.moveTo(s,l),e.lineTo(a,u),e.lineTo(h,c)}e.fillStyle="#FF0000",e.fill(),e.closePath()},r.prototype.onTextureUpdate=function(){this.updateFrame=!0},r.prototype.getBounds=function(t){for(var e=t||this.worldTransform,r=e.a,n=e.b,o=e.c,s=e.d,a=e.tx,h=e.ty,l=-1/0,u=-1/0,c=1/0,d=1/0,p=this.vertices,f=0,g=p.length;g>f;f+=2){var v=p[f],m=p[f+1],y=r*v+o*m+a,x=s*m+n*v+h;c=c>y?y:c,d=d>x?x:d,l=y>l?y:l,u=x>u?x:u}if(c===-1/0||1/0===u)return i.math.Rectangle.EMPTY;var b=this._bounds;return b.x=c,b.width=l-c,b.y=d,b.height=u-d,this._currentBounds=b,b},r.DRAW_MODES={TRIANGLE_MESH:0,TRIANGLES:1}},{"../../core":19}],77:[function(t,e){function r(t,e){i.call(this,t),this.points=e,this.vertices=new Float32Array(4*e.length),this.uvs=new Float32Array(4*e.length),this.colors=new Float32Array(2*e.length),this.indices=new Uint16Array(2*e.length),this.refresh()}var i=t("./Mesh");r.prototype=Object.create(i.prototype),r.prototype.constructor=r,e.exports=r,r.prototype.refresh=function(){var t=this.points;if(!(t.length<1)){var e=this.uvs,r=this.indices,i=this.colors;e[0]=0,e[1]=0,e[2]=0,e[3]=1,i[0]=1,i[1]=1,r[0]=0,r[1]=1;for(var n,o,s,a=t.length,h=1;a>h;h++)n=t[h],o=4*h,s=h/(a-1),h%2?(e[o]=s,e[o+1]=0,e[o+2]=s,e[o+3]=1):(e[o]=s,e[o+1]=0,e[o+2]=s,e[o+3]=1),o=2*h,i[o]=1,i[o+1]=1,o=2*h,r[o]=o,r[o+1]=o+1}},r.prototype.updateTransform=function(){var t=this.points;if(!(t.length<1)){for(var e,r,i,n,o,s,a=t[0],h=0,l=0,u=this.vertices,c=t.length,d=0;c>d;d++)r=t[d],i=4*d,e=d1&&(n=1),o=Math.sqrt(h*h+l*l),s=this.texture.height/2,h/=o,l/=o,h*=s,l*=s,u[i]=r.x+h,u[i+1]=r.y+l,u[i+2]=r.x-h,u[i+3]=r.y-l,a=r;this.containerUpdateTransform()}}},{"./Mesh":76}],78:[function(t,e){e.exports={Mesh:t("./Mesh"),Rope:t("./Rope"),MeshRenderer:t("./webgl/MeshRenderer"),MeshShader:t("./webgl/MeshShader")}},{"./Mesh":76,"./Rope":77,"./webgl/MeshRenderer":79,"./webgl/MeshShader":80}],79:[function(t,e){function r(t){i.call(this,t),this.indices=new Uint16Array(15e3);for(var e=0,r=0;15e3>e;e+=6,r+=4)this.indices[e+0]=r+0,this.indices[e+1]=r+1,this.indices[e+2]=r+2,this.indices[e+3]=r+0,this.indices[e+4]=r+2,this.indices[e+5]=r+3}var i=t("../../../core/renderers/webgl/utils/ObjectRenderer"),n=t("../../../core/renderers/webgl/WebGLRenderer");r.prototype=Object.create(i.prototype),r.prototype.constructor=r,e.exports=r,n.registerPlugin("mesh",r),r.prototype.onContextChange=function(){},r.prototype.render=function(t){t._vertexBuffer||this._initWebGL(t);var e=this.renderer,r=e.gl,i=t.texture.baseTexture,n=e.shaderManager.plugins.meshShader,o=r.TRIANGLE_STRIP;e.blendModeManager.setBlendMode(t.blendMode),r.uniformMatrix3fv(n.uniforms.translationMatrix._location,!1,t.worldTransform.toArray(!0)),r.uniformMatrix3fv(n.uniforms.projectionMatrix._location,!1,e.currentRenderTarget.projectionMatrix.toArray(!0)),r.uniform1f(n.uniforms.alpha._location,t.worldAlpha),t.dirty?(t.dirty=!1,r.bindBuffer(r.ARRAY_BUFFER,t._vertexBuffer),r.bufferData(r.ARRAY_BUFFER,t.vertices,r.STATIC_DRAW),r.vertexAttribPointer(n.attributes.aVertexPosition,2,r.FLOAT,!1,0,0),r.bindBuffer(r.ARRAY_BUFFER,t._uvBuffer),r.bufferData(r.ARRAY_BUFFER,t.uvs,r.STATIC_DRAW),r.vertexAttribPointer(n.attributes.aTextureCoord,2,r.FLOAT,!1,0,0),r.activeTexture(r.TEXTURE0),i._glTextures[r.id]?r.bindTexture(r.TEXTURE_2D,i._glTextures[r.id]):this.renderer.updateTexture(i),r.bindBuffer(r.ELEMENT_ARRAY_BUFFER,t._indexBuffer),r.bufferData(r.ELEMENT_ARRAY_BUFFER,t.indices,r.STATIC_DRAW)):(r.bindBuffer(r.ARRAY_BUFFER,t._vertexBuffer),r.bufferSubData(r.ARRAY_BUFFER,0,t.vertices),r.vertexAttribPointer(n.attributes.aVertexPosition,2,r.FLOAT,!1,0,0),r.bindBuffer(r.ARRAY_BUFFER,t._uvBuffer),r.vertexAttribPointer(n.attributes.aTextureCoord,2,r.FLOAT,!1,0,0),r.activeTexture(r.TEXTURE0),i._glTextures[r.id]?r.bindTexture(r.TEXTURE_2D,i._glTextures[r.id]):this.renderer.updateTexture(i)),r.drawElements(o,t.indices.length,r.UNSIGNED_SHORT,0)},r.prototype._initWebGL=function(t){var e=this.renderer.gl;t._vertexBuffer=e.createBuffer(),t._indexBuffer=e.createBuffer(),t._uvBuffer=e.createBuffer(),t._colorBuffer=e.createBuffer(),e.bindBuffer(e.ARRAY_BUFFER,t._vertexBuffer),e.bufferData(e.ARRAY_BUFFER,t.vertices,e.DYNAMIC_DRAW),e.bindBuffer(e.ARRAY_BUFFER,t._uvBuffer),e.bufferData(e.ARRAY_BUFFER,t.uvs,e.STATIC_DRAW),e.bindBuffer(e.ARRAY_BUFFER,t._colorBuffer),e.bufferData(e.ARRAY_BUFFER,t.colors,e.STATIC_DRAW),e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,t._indexBuffer),e.bufferData(e.ELEMENT_ARRAY_BUFFER,t.indices,e.STATIC_DRAW)},r.prototype.flush=function(){},r.prototype.start=function(){var t=(this.renderer.gl,this.renderer.shaderManager.plugins.meshShader);this.renderer.shaderManager.setShader(t)},r.prototype.destroy=function(){}},{"../../../core/renderers/webgl/WebGLRenderer":38,"../../../core/renderers/webgl/utils/ObjectRenderer":52}],80:[function(t,e){function r(t){i.Shader.call(this,t,["precision lowp float;","attribute vec2 aVertexPosition;","attribute vec2 aTextureCoord;","uniform mat3 translationMatrix;","uniform mat3 projectionMatrix;","varying vec2 vTextureCoord;","void main(void){"," gl_Position = vec4((projectionMatrix * translationMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);"," vTextureCoord = aTextureCoord;","}"].join("\n"),["precision lowp float;","varying vec2 vTextureCoord;","uniform float alpha;","uniform sampler2D uSampler;","void main(void){"," gl_FragColor = texture2D(uSampler, vTextureCoord) * alpha ;","}"].join("\n"),{alpha:{type:"1f",value:0},translationMatrix:{type:"mat3",value:new Float32Array(9)},projectionMatrix:{type:"mat3",value:new Float32Array(9)}},{aVertexPosition:0,aTextureCoord:0})}var i=t("../../../core");r.prototype=Object.create(i.Shader.prototype),r.prototype.constructor=r,e.exports=r,i.ShaderManager.registerPlugin("meshShader",r)},{"../../../core":19}],81:[function(t,e){function r(){i.AbstractFilter.call(this,null,"precision mediump float;\n\nuniform vec4 dimensions;\nuniform float pixelSize;\nuniform sampler2D uSampler;\n\nfloat character(float n, vec2 p)\n{\n p = floor(p*vec2(4.0, -4.0) + 2.5);\n if (clamp(p.x, 0.0, 4.0) == p.x && clamp(p.y, 0.0, 4.0) == p.y)\n {\n if (int(mod(n/exp2(p.x + 5.0*p.y), 2.0)) == 1) return 1.0;\n }\n return 0.0;\n}\n\nvoid main()\n{\n vec2 uv = gl_FragCoord.xy;\n\n vec3 col = texture2D(uSampler, floor( uv / pixelSize ) * pixelSize / dimensions.xy).rgb;\n\n float gray = (col.r + col.g + col.b) / 3.0;\n\n float n = 65536.0; // .\n if (gray > 0.2) n = 65600.0; // :\n if (gray > 0.3) n = 332772.0; // *\n if (gray > 0.4) n = 15255086.0; // o\n if (gray > 0.5) n = 23385164.0; // &\n if (gray > 0.6) n = 15252014.0; // 8\n if (gray > 0.7) n = 13199452.0; // @\n if (gray > 0.8) n = 11512810.0; // #\n\n vec2 p = mod( uv / ( pixelSize * 0.5 ), 2.0) - vec2(1.0);\n col = col * character(n, p);\n\n gl_FragColor = vec4(col, 1.0);\n}\n",{dimensions:{type:"4fv",value:new Float32Array([0,0,0,0])},pixelSize:{type:"1f",value:8}})}var i=t("../../core");r.prototype=Object.create(i.AbstractFilter.prototype),r.prototype.constructor=r,e.exports=r,Object.defineProperties(r.prototype,{size:{get:function(){return this.uniforms.pixelSize.value},set:function(t){this.uniforms.pixelSize.value=t}}})},{"../../core":19}],82:[function(t,e){function r(){i.AbstractFilter.call(this),this.blurXFilter=new n,this.blurYFilter=new o,this.defaultFilter=new i.AbstractFilter}var i=t("../../core"),n=t("../blur/BlurXFilter"),o=t("../blur/BlurYFilter");r.prototype=Object.create(i.AbstractFilter.prototype),r.prototype.constructor=r,e.exports=r,r.prototype.applyFilter=function(t,e,r){var n=t.filterManager.getRenderTarget(!0);this.defaultFilter.applyFilter(t,e,r),this.blurXFilter.applyFilter(t,e,n),t.blendModeManager.setBlendMode(i.CONST.BLEND_MODES.SCREEN),this.blurYFilter.applyFilter(t,n,r),t.blendModeManager.setBlendMode(i.CONST.BLEND_MODES.NORMAL),t.filterManager.returnRenderTarget(n)},Object.defineProperties(r.prototype,{blur:{get:function(){return this.blurXFilter.blur},set:function(t){this.blurXFilter.blur=this.blurYFilter.blur=t}},blurX:{get:function(){return this.blurXFilter.blur},set:function(t){this.blurXFilter.blur=t}},blurY:{get:function(){return this.blurYFilter.blur},set:function(t){this.blurYFilter.blur=t}}})},{"../../core":19,"../blur/BlurXFilter":84,"../blur/BlurYFilter":85}],83:[function(t,e){function r(){i.AbstractFilter.call(this),this.blurXFilter=new n,this.blurYFilter=new o}var i=t("../../core"),n=t("./BlurXFilter"),o=t("./BlurYFilter");r.prototype=Object.create(i.AbstractFilter.prototype),r.prototype.constructor=r,e.exports=r,r.prototype.applyFilter=function(t,e,r){var i=t.filterManager.getRenderTarget(!0);this.blurXFilter.applyFilter(t,e,i),this.blurYFilter.applyFilter(t,i,r),t.filterManager.returnRenderTarget(i)},Object.defineProperties(r.prototype,{blur:{get:function(){return this.blurXFilter.blur},set:function(t){this.padding=.5*t,this.blurXFilter.blur=this.blurYFilter.blur=t}},passes:{get:function(){return this.blurXFilter.passes},set:function(t){this.blurXFilter.passes=this.blurYFilter.passes=t}},blurX:{get:function(){return this.blurXFilter.blur},set:function(t){this.blurXFilter.blur=t}},blurY:{get:function(){return this.blurYFilter.blur},set:function(t){this.blurYFilter.blur=t}}})},{"../../core":19,"./BlurXFilter":84,"./BlurYFilter":85}],84:[function(t,e){function r(){i.AbstractFilter.call(this,"attribute vec2 aVertexPosition;\nattribute vec2 aTextureCoord;\nattribute vec4 aColor;\n\nuniform float strength;\nuniform mat3 projectionMatrix;\n\nvarying vec2 vTextureCoord;\nvarying vec4 vColor;\nvarying vec2 vBlurTexCoords[6];\n\nvoid main(void)\n{\n gl_Position = vec4((projectionMatrix * vec3((aVertexPosition), 1.0)).xy, 0.0, 1.0);\n vTextureCoord = aTextureCoord;\n\n vBlurTexCoords[ 0] = aTextureCoord + vec2(-0.012 * strength, 0.0);\n vBlurTexCoords[ 1] = aTextureCoord + vec2(-0.008 * strength, 0.0);\n vBlurTexCoords[ 2] = aTextureCoord + vec2(-0.004 * strength, 0.0);\n vBlurTexCoords[ 3] = aTextureCoord + vec2( 0.004 * strength, 0.0);\n vBlurTexCoords[ 4] = aTextureCoord + vec2( 0.008 * strength, 0.0);\n vBlurTexCoords[ 5] = aTextureCoord + vec2( 0.012 * strength, 0.0);\n\n vColor = vec4(aColor.rgb * aColor.a, aColor.a);\n}\n","precision lowp float;\n\nvarying vec2 vTextureCoord;\nvarying vec2 vBlurTexCoords[6];\nvarying vec4 vColor;\n\nuniform sampler2D uSampler;\n\nvoid main(void)\n{\n gl_FragColor = vec4(0.0);\n\n gl_FragColor += texture2D(uSampler, vBlurTexCoords[ 0])*0.004431848411938341;\n gl_FragColor += texture2D(uSampler, vBlurTexCoords[ 1])*0.05399096651318985;\n gl_FragColor += texture2D(uSampler, vBlurTexCoords[ 2])*0.2419707245191454;\n gl_FragColor += texture2D(uSampler, vTextureCoord )*0.3989422804014327;\n gl_FragColor += texture2D(uSampler, vBlurTexCoords[ 3])*0.2419707245191454;\n gl_FragColor += texture2D(uSampler, vBlurTexCoords[ 4])*0.05399096651318985;\n gl_FragColor += texture2D(uSampler, vBlurTexCoords[ 5])*0.004431848411938341;\n}\n",{strength:{type:"1f",value:1}}),this.passes=1,this.strength=4}var i=t("../../core");r.prototype=Object.create(i.AbstractFilter.prototype),r.prototype.constructor=r,e.exports=r,r.prototype.applyFilter=function(t,e,r,i){var n=this.getShader(t);if(this.uniforms.strength.value=this.strength/4/this.passes*(e.frame.width/e.size.width),1===this.passes)t.filterManager.applyFilter(n,e,r,i);else{for(var o=t.filterManager.getRenderTarget(!0),s=e,a=o,h=0;h>16&255)/255,s=(r>>8&255)/255,a=(255&r)/255,h=(i>>16&255)/255,l=(i>>8&255)/255,u=(255&i)/255,c=[.3,.59,.11,0,0,o,s,a,t,0,h,l,u,e,0,o-h,s-l,a-u,0,0,0,0,0,0,1];this._loadMatrix(c,n)},r.prototype.night=function(t,e){t=t||.1;var r=[-2*t,-t,0,0,0,-t,0,t,0,0,0,t,2*t,0,0,0,0,0,1,0,0,0,0,0,1];this._loadMatrix(r,e)},r.prototype.predator=function(t,e){var r=[11.224130630493164*t,-4.794486999511719*t,-2.8746118545532227*t,0*t,.40342438220977783*t,-3.6330697536468506*t,9.193157196044922*t,-2.951810836791992*t,0*t,-1.316135048866272*t,-3.2184197902679443*t,-4.2375030517578125*t,7.476448059082031*t,0*t,.8044459223747253*t,0,0,0,1,0,0,0,0,0,0];this._loadMatrix(r,e)},r.prototype.lsd=function(t){var e=[2,-.4,.5,0,0,-.5,2,-.4,0,0,-.4,-.5,3,0,0,0,0,0,1,0,0,0,0,0,1];this._loadMatrix(e,t)},r.prototype.reset=function(){var t=[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];this._loadMatrix(t,!1)},Object.defineProperties(r.prototype,{matrix:{get:function(){return this.uniforms.matrix.value},set:function(t){this.uniforms.matrix.value=t}}})},{"../../core":19}],88:[function(t,e){function r(){i.AbstractFilter.call(this,null,"precision mediump float;\n\nvarying vec2 vTextureCoord;\n\nuniform sampler2D uSampler;\nuniform float step;\n\nvoid main(void)\n{\n vec4 color = texture2D(uSampler, vTextureCoord);\n\n color = floor(color * step) / step;\n\n gl_FragColor = color;\n}\n",{step:{type:"1f",value:5}})}var i=t("../../core");r.prototype=Object.create(i.AbstractFilter.prototype),r.prototype.constructor=r,e.exports=r,Object.defineProperties(r.prototype,{step:{get:function(){return this.uniforms.step.value},set:function(t){this.uniforms.step.value=t}}})},{"../../core":19}],89:[function(t,e){function r(t,e,r){i.AbstractFilter.call(this,null,"precision mediump float;\n\nvarying mediump vec2 vTextureCoord;\n\nuniform sampler2D uSampler;\nuniform vec2 texelSize;\nuniform float matrix[9];\n\nvoid main(void)\n{\n vec4 c11 = texture2D(uSampler, vTextureCoord - texelSize); // top left\n vec4 c12 = texture2D(uSampler, vec2(vTextureCoord.x, vTextureCoord.y - texelSize.y)); // top center\n vec4 c13 = texture2D(uSampler, vec2(vTextureCoord.x + texelSize.x, vTextureCoord.y - texelSize.y)); // top right\n\n vec4 c21 = texture2D(uSampler, vec2(vTextureCoord.x - texelSize.x, vTextureCoord.y)); // mid left\n vec4 c22 = texture2D(uSampler, vTextureCoord); // mid center\n vec4 c23 = texture2D(uSampler, vec2(vTextureCoord.x + texelSize.x, vTextureCoord.y)); // mid right\n\n vec4 c31 = texture2D(uSampler, vec2(vTextureCoord.x - texelSize.x, vTextureCoord.y + texelSize.y)); // bottom left\n vec4 c32 = texture2D(uSampler, vec2(vTextureCoord.x, vTextureCoord.y + texelSize.y)); // bottom center\n vec4 c33 = texture2D(uSampler, vTextureCoord + texelSize); // bottom right\n\n gl_FragColor =\n c11 * matrix[0] + c12 * matrix[1] + c13 * matrix[2] +\n c21 * matrix[3] + c22 * matrix[4] + c23 * matrix[5] +\n c31 * matrix[6] + c32 * matrix[7] + c33 * matrix[8];\n\n gl_FragColor.a = c22.a;\n}\n",{matrix:{type:"1fv",value:new Float32Array(t)},texelSize:{type:"2v",value:{x:1/e,y:1/r}}})}var i=t("../../core");r.prototype=Object.create(i.AbstractFilter.prototype),r.prototype.constructor=r,e.exports=r,Object.defineProperties(r.prototype,{matrix:{get:function(){return this.uniforms.matrix.value},set:function(t){this.uniforms.matrix.value=new Float32Array(t)}},width:{get:function(){return 1/this.uniforms.texelSize.value.x},set:function(t){this.uniforms.texelSize.value.x=1/t}},height:{get:function(){return 1/this.uniforms.texelSize.value.y},set:function(t){this.uniforms.texelSize.value.y=1/t}}})},{"../../core":19}],90:[function(t,e){function r(){i.AbstractFilter.call(this,null,"precision mediump float;\n\nvarying vec2 vTextureCoord;\n\nuniform sampler2D uSampler;\n\nvoid main(void)\n{\n float lum = length(texture2D(uSampler, vTextureCoord.xy).rgb);\n\n gl_FragColor = vec4(1.0, 1.0, 1.0, 1.0);\n\n if (lum < 1.00)\n {\n if (mod(gl_FragCoord.x + gl_FragCoord.y, 10.0) == 0.0)\n {\n gl_FragColor = vec4(0.0, 0.0, 0.0, 1.0);\n }\n }\n\n if (lum < 0.75)\n {\n if (mod(gl_FragCoord.x - gl_FragCoord.y, 10.0) == 0.0)\n {\n gl_FragColor = vec4(0.0, 0.0, 0.0, 1.0);\n }\n }\n\n if (lum < 0.50)\n {\n if (mod(gl_FragCoord.x + gl_FragCoord.y - 5.0, 10.0) == 0.0)\n {\n gl_FragColor = vec4(0.0, 0.0, 0.0, 1.0);\n }\n }\n\n if (lum < 0.3)\n {\n if (mod(gl_FragCoord.x - gl_FragCoord.y - 5.0, 10.0) == 0.0)\n {\n gl_FragColor = vec4(0.0, 0.0, 0.0, 1.0);\n }\n }\n}\n")}var i=t("../../core");r.prototype=Object.create(i.AbstractFilter.prototype),r.prototype.constructor=r,e.exports=r},{"../../core":19}],91:[function(t,e){function r(t){var e=new i.math.Matrix;t.renderable=!1,i.AbstractFilter.call(this,"attribute vec2 aVertexPosition;\nattribute vec2 aTextureCoord;\nattribute vec4 aColor;\n\nuniform mat3 projectionMatrix;\nuniform mat3 otherMatrix;\n\nvarying vec2 vMapCoord;\nvarying vec2 vTextureCoord;\nvarying vec4 vColor;\n\nvoid main(void)\n{\n gl_Position = vec4((projectionMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);\n vTextureCoord = aTextureCoord;\n vMapCoord = ( otherMatrix * vec3( aTextureCoord, 1.0) ).xy;\n vColor = vec4(aColor.rgb * aColor.a, aColor.a);\n}\n","precision lowp float;\n\nvarying vec2 vMapCoord;\nvarying vec2 vTextureCoord;\nvarying vec4 vColor;\n\nuniform vec2 scale;\n\nuniform sampler2D uSampler;\nuniform sampler2D mapSampler;\n\nvoid main(void)\n{\n vec4 original = texture2D(uSampler, vTextureCoord);\n vec4 map = texture2D(mapSampler, vMapCoord);\n\n map -= 0.5;\n map.xy *= scale;\n\n gl_FragColor = texture2D(uSampler, vec2(vTextureCoord.x + map.x, vTextureCoord.y + map.y));\n}\n",{mapSampler:{type:"sampler2D",value:t.texture},otherMatrix:{type:"mat3",value:e.toArray(!0)},scale:{type:"v2",value:{x:1,y:1}}}),this.maskSprite=t,this.maskMatrix=e,this.scale=new i.math.Point(20,20)}var i=t("../../core");r.prototype=Object.create(i.AbstractFilter.prototype),r.prototype.constructor=r,e.exports=r,r.prototype.applyFilter=function(t,e,r){var i=t.filterManager;i.calculateMappedMatrix(e.frame,this.maskSprite,this.maskMatrix),this.uniforms.otherMatrix.value=this.maskMatrix.toArray(!0),this.uniforms.scale.value.x=this.scale.x*(1/e.frame.width),this.uniforms.scale.value.y=this.scale.y*(1/e.frame.height);var n=this.getShader(t);i.applyFilter(n,e,r)},Object.defineProperties(r.prototype,{map:{get:function(){return this.uniforms.mapSampler.value},set:function(t){this.uniforms.mapSampler.value=t}}})},{"../../core":19}],92:[function(t,e){function r(){i.AbstractFilter.call(this,null,"precision mediump float;\n\nvarying vec2 vTextureCoord;\nvarying vec4 vColor;\n\nuniform vec4 dimensions;\nuniform sampler2D uSampler;\n\nuniform float angle;\nuniform float scale;\n\nfloat pattern()\n{\n float s = sin(angle), c = cos(angle);\n vec2 tex = vTextureCoord * dimensions.xy;\n vec2 point = vec2(\n c * tex.x - s * tex.y,\n s * tex.x + c * tex.y\n ) * scale;\n return (sin(point.x) * sin(point.y)) * 4.0;\n}\n\nvoid main()\n{\n vec4 color = texture2D(uSampler, vTextureCoord);\n float average = (color.r + color.g + color.b) / 3.0;\n gl_FragColor = vec4(vec3(average * 10.0 - 5.0 + pattern()), color.a);\n}\n",{scale:{type:"1f",value:1},angle:{type:"1f",value:5},dimensions:{type:"4fv",value:[0,0,0,0]}}) }var i=t("../../core");r.prototype=Object.create(i.AbstractFilter.prototype),r.prototype.constructor=r,e.exports=r,Object.defineProperties(r.prototype,{scale:{get:function(){return this.uniforms.scale.value},set:function(t){this.uniforms.scale.value=t}},angle:{get:function(){return this.uniforms.angle.value},set:function(t){this.uniforms.angle.value=t}}})},{"../../core":19}],93:[function(t,e){function r(){i.AbstractFilter.call(this,"attribute vec2 aVertexPosition;\nattribute vec2 aTextureCoord;\nattribute vec4 aColor;\n\nuniform float strength;\nuniform vec2 offset;\n\nuniform mat3 projectionMatrix;\n\nvarying vec2 vTextureCoord;\nvarying vec4 vColor;\nvarying vec2 vBlurTexCoords[6];\n\nvoid main(void)\n{\n gl_Position = vec4((projectionMatrix * vec3((aVertexPosition+offset), 1.0)).xy, 0.0, 1.0);\n vTextureCoord = aTextureCoord;\n\n vBlurTexCoords[ 0] = aTextureCoord + vec2(0.0, -0.012 * strength);\n vBlurTexCoords[ 1] = aTextureCoord + vec2(0.0, -0.008 * strength);\n vBlurTexCoords[ 2] = aTextureCoord + vec2(0.0, -0.004 * strength);\n vBlurTexCoords[ 3] = aTextureCoord + vec2(0.0, 0.004 * strength);\n vBlurTexCoords[ 4] = aTextureCoord + vec2(0.0, 0.008 * strength);\n vBlurTexCoords[ 5] = aTextureCoord + vec2(0.0, 0.012 * strength);\n\n vColor = vec4(aColor.rgb * aColor.a, aColor.a);\n}\n","precision lowp float;\n\nvarying vec2 vTextureCoord;\nvarying vec2 vBlurTexCoords[6];\nvarying vec4 vColor;\n\nuniform vec3 color;\nuniform float alpha;\n\nuniform sampler2D uSampler;\n\nvoid main(void)\n{\n vec4 sum = vec4(0.0);\n\n sum += texture2D(uSampler, vBlurTexCoords[ 0])*0.004431848411938341;\n sum += texture2D(uSampler, vBlurTexCoords[ 1])*0.05399096651318985;\n sum += texture2D(uSampler, vBlurTexCoords[ 2])*0.2419707245191454;\n sum += texture2D(uSampler, vTextureCoord )*0.3989422804014327;\n sum += texture2D(uSampler, vBlurTexCoords[ 3])*0.2419707245191454;\n sum += texture2D(uSampler, vBlurTexCoords[ 4])*0.05399096651318985;\n sum += texture2D(uSampler, vBlurTexCoords[ 5])*0.004431848411938341;\n\n gl_FragColor = vec4( color.rgb * sum.a * alpha, sum.a * alpha );\n}\n",{blur:{type:"1f",value:1/512},color:{type:"c",value:[0,0,0]},alpha:{type:"1f",value:.7},offset:{type:"2f",value:[5,5]},strength:{type:"1f",value:1}}),this.passes=1,this.strength=4}var i=t("../../core");r.prototype=Object.create(i.AbstractFilter.prototype),r.prototype.constructor=r,e.exports=r,r.prototype.applyFilter=function(t,e,r,i){var n=this.getShader(t);if(this.uniforms.strength.value=this.strength/4/this.passes*(e.frame.height/e.size.height),1===this.passes)t.filterManager.applyFilter(n,e,r,i);else{for(var o=t.filterManager.getRenderTarget(!0),s=e,a=o,h=0;h= (time - params.z)) )\n {\n float diff = (dist - time);\n float powDiff = 1.0 - pow(abs(diff*params.x), params.y);\n\n float diffTime = diff * powDiff;\n vec2 diffUV = normalize(uv - center);\n texCoord = uv + (diffUV * diffTime);\n }\n\n gl_FragColor = texture2D(uSampler, texCoord);\n}\n",{center:{type:"v2",value:{x:.5,y:.5}},params:{type:"v3",value:{x:10,y:.8,z:.1}},time:{type:"1f",value:0}})}var i=t("../../core");r.prototype=Object.create(i.AbstractFilter.prototype),r.prototype.constructor=r,e.exports=r,Object.defineProperties(r.prototype,{center:{get:function(){return this.uniforms.center.value},set:function(t){this.uniforms.center.value=t}},params:{get:function(){return this.uniforms.params.value},set:function(t){this.uniforms.params.value=t}},time:{get:function(){return this.uniforms.time.value},set:function(t){this.uniforms.time.value=t}}})},{"../../core":19}],104:[function(t,e){function r(){i.AbstractFilter.call(this,null,"precision mediump float;\n\nvarying vec2 vTextureCoord;\n\nuniform sampler2D uSampler;\nuniform float blur;\nuniform float gradientBlur;\nuniform vec2 start;\nuniform vec2 end;\nuniform vec2 delta;\nuniform vec2 texSize;\n\nfloat random(vec3 scale, float seed)\n{\n return fract(sin(dot(gl_FragCoord.xyz + seed, scale)) * 43758.5453 + seed);\n}\n\nvoid main(void)\n{\n vec4 color = vec4(0.0);\n float total = 0.0;\n\n float offset = random(vec3(12.9898, 78.233, 151.7182), 0.0);\n vec2 normal = normalize(vec2(start.y - end.y, end.x - start.x));\n float radius = smoothstep(0.0, 1.0, abs(dot(vTextureCoord * texSize - start, normal)) / gradientBlur) * blur;\n\n for (float t = -30.0; t <= 30.0; t++)\n {\n float percent = (t + offset - 0.5) / 30.0;\n float weight = 1.0 - abs(percent);\n vec4 sample = texture2D(uSampler, vTextureCoord + delta / texSize * percent * radius);\n sample.rgb *= sample.a;\n color += sample * weight;\n total += weight;\n }\n\n gl_FragColor = color / total;\n gl_FragColor.rgb /= gl_FragColor.a + 0.00001;\n}\n",{blur:{type:"1f",value:100},gradientBlur:{type:"1f",value:600},start:{type:"v2",value:{x:0,y:window.innerHeight/2}},end:{type:"v2",value:{x:600,y:window.innerHeight/2}},delta:{type:"v2",value:{x:30,y:30}},texSize:{type:"v2",value:{x:window.innerWidth,y:window.innerHeight}}}),this.updateDelta()}var i=t("../../core");r.prototype=Object.create(i.AbstractFilter.prototype),r.prototype.constructor=r,e.exports=r,r.prototype.updateDelta=function(){this.uniforms.delta.value.x=0,this.uniforms.delta.value.y=0},Object.defineProperties(r.prototype,{blur:{get:function(){return this.uniforms.blur.value},set:function(t){this.uniforms.blur.value=t}},gradientBlur:{get:function(){return this.uniforms.gradientBlur.value},set:function(t){this.uniforms.gradientBlur.value=t}},start:{get:function(){return this.uniforms.start.value},set:function(t){this.uniforms.start.value=t,this.updateDelta()}},end:{get:function(){return this.uniforms.end.value},set:function(t){this.uniforms.end.value=t,this.updateDelta()}}})},{"../../core":19}],105:[function(t,e){function r(){i.AbstractFilter.call(this),this.tiltShiftXFilter=new n,this.tiltShiftYFilter=new o}var i=t("../../core"),n=t("./TiltShiftXFilter"),o=t("./TiltShiftYFilter");r.prototype=Object.create(i.AbstractFilter.prototype),r.prototype.constructor=r,e.exports=r,r.prototype.applyFilter=function(t,e,r){var i=t.filterManager.getRenderTarget(!0);this.tiltShiftXFilter.applyFilter(t,e,i),this.tiltShiftYFilter.applyFilter(t,i,r),t.filterManager.returnRenderTarget(i)},Object.defineProperties(r.prototype,{blur:{get:function(){return this.tiltShiftXFilter.blur},set:function(t){this.tiltShiftXFilter.blur=this.tiltShiftYFilter.blur=t}},gradientBlur:{get:function(){return this.tiltShiftXFilter.gradientBlur},set:function(t){this.tiltShiftXFilter.gradientBlur=this.tiltShiftYFilter.gradientBlur=t}},start:{get:function(){return this.tiltShiftXFilter.start},set:function(t){this.tiltShiftXFilter.start=this.tiltShiftYFilter.start=t}},end:{get:function(){return this.tiltShiftXFilter.end},set:function(t){this.tiltShiftXFilter.end=this.tiltShiftYFilter.end=t}}})},{"../../core":19,"./TiltShiftXFilter":106,"./TiltShiftYFilter":107}],106:[function(t,e){function r(){i.call(this)}var i=t("./TiltShiftAxisFilter");r.prototype=Object.create(i.prototype),r.prototype.constructor=r,e.exports=r,r.prototype.updateDelta=function(){var t=this.uniforms.end.value.x-this.uniforms.start.value.x,e=this.uniforms.end.value.y-this.uniforms.start.value.y,r=Math.sqrt(t*t+e*e);this.uniforms.delta.value.x=t/r,this.uniforms.delta.value.y=e/r}},{"./TiltShiftAxisFilter":104}],107:[function(t,e){function r(){i.call(this)}var i=t("./TiltShiftAxisFilter");r.prototype=Object.create(i.prototype),r.prototype.constructor=r,e.exports=r,r.prototype.updateDelta=function(){var t=this.uniforms.end.value.x-this.uniforms.start.value.x,e=this.uniforms.end.value.y-this.uniforms.start.value.y,r=Math.sqrt(t*t+e*e);this.uniforms.delta.value.x=-e/r,this.uniforms.delta.value.y=t/r}},{"./TiltShiftAxisFilter":104}],108:[function(t,e){function r(){i.AbstractFilter.call(this,null,"precision mediump float;\n\nvarying vec2 vTextureCoord;\n\nuniform sampler2D uSampler;\nuniform float radius;\nuniform float angle;\nuniform vec2 offset;\n\nvoid main(void)\n{\n vec2 coord = vTextureCoord - offset;\n float dist = length(coord);\n\n if (dist < radius)\n {\n float ratio = (radius - dist) / radius;\n float angleMod = ratio * ratio * angle;\n float s = sin(angleMod);\n float c = cos(angleMod);\n coord = vec2(coord.x * c - coord.y * s, coord.x * s + coord.y * c);\n }\n\n gl_FragColor = texture2D(uSampler, coord+offset);\n}\n",{radius:{type:"1f",value:.5},angle:{type:"1f",value:5},offset:{type:"v2",value:{x:.5,y:.5}}})}var i=t("../../core");r.prototype=Object.create(i.AbstractFilter.prototype),r.prototype.constructor=r,e.exports=r,Object.defineProperties(r.prototype,{offset:{get:function(){return this.uniforms.offset.value},set:function(t){this.uniforms.offset.value=t}},radius:{get:function(){return this.uniforms.radius.value},set:function(t){this.uniforms.radius.value=t}},angle:{get:function(){return this.uniforms.angle.value},set:function(t){this.uniforms.angle.value=t}}})},{"../../core":19}],109:[function(t,e){function r(){this.global=new i.math.Point,this.target=null,this.originalEvent=null}var i=t("../core");r.prototype.constructor=r,e.exports=r,r.prototype.getLocalPosition=function(t,e){var r=t.worldTransform,n=this.global,o=r.a,s=r.c,a=r.tx,h=r.b,l=r.d,u=r.ty,c=1/(o*l+s*-h);return e=e||new i.math.Point,e.x=l*c*n.x+-s*c*n.y+(u*s-a*l)*c,e.y=o*c*n.y+-h*c*n.x+(-u*o+a*h)*c,e}},{"../core":19}],110:[function(t,e){function r(t){this.renderer=t,this.mouse=new n,this.eventData=new i.utils.EventData,this.eventData.data=this.mouse,this.interactiveDataPool=[],this.interactionDOMElement=null,this.eventsAdded=!1,this.onMouseUp=this.onMouseUp.bind(this),this.processMouseUp=this.processMouseUp.bind(this),this.onMouseDown=this.onMouseDown.bind(this),this.processMouseDown=this.processMouseDown.bind(this),this.onMouseMove=this.onMouseMove.bind(this),this.processMouseMove=this.processMouseMove.bind(this),this.onMouseOut=this.onMouseOut.bind(this),this.processMouseOverOut=this.processMouseOverOut.bind(this),this.onTouchStart=this.onTouchStart.bind(this),this.processTouchStart=this.processTouchStart.bind(this),this.onTouchEnd=this.onTouchEnd.bind(this),this.processTouchEnd=this.processTouchEnd.bind(this),this.onTouchMove=this.onTouchMove.bind(this),this.processTouchMove=this.processTouchMove.bind(this),this.last=0,this.currentCursorStyle="inherit",this._tempPoint=new i.math.Point,this.resolution=1,this.setTargetElement(this.renderer.view,this.renderer.resolution),this.update()}var i=t("../core"),n=t("./InteractionData"),o=10,s=!0;r.prototype.constructor=r,e.exports=r,r.prototype.setTargetElement=function(t,e){this.removeEvents(),this.interactionDOMElement=t,this.resolution=e||1,this.addEvents()},r.prototype.addEvents=function(){this.interactionDOMElement&&(window.navigator.msPointerEnabled&&(this.interactionDOMElement.style["-ms-content-zooming"]="none",this.interactionDOMElement.style["-ms-touch-action"]="none"),this.interactionDOMElement.addEventListener("mousemove",this.onMouseMove,!0),this.interactionDOMElement.addEventListener("mousedown",this.onMouseDown,!0),this.interactionDOMElement.addEventListener("mouseout",this.onMouseOut,!0),this.interactionDOMElement.addEventListener("touchstart",this.onTouchStart,!0),this.interactionDOMElement.addEventListener("touchend",this.onTouchEnd,!0),this.interactionDOMElement.addEventListener("touchmove",this.onTouchMove,!0),window.addEventListener("mouseup",this.onMouseUp,!0),this.eventsAdded=!0)},r.prototype.removeEvents=function(){this.interactionDOMElement&&(window.navigator.msPointerEnabled&&(this.interactionDOMElement.style["-ms-content-zooming"]="",this.interactionDOMElement.style["-ms-touch-action"]=""),this.interactionDOMElement.removeEventListener("mousemove",this.onMouseMove,!0),this.interactionDOMElement.removeEventListener("mousedown",this.onMouseDown,!0),this.interactionDOMElement.removeEventListener("mouseout",this.onMouseOut,!0),this.interactionDOMElement.removeEventListener("touchstart",this.onTouchStart,!0),this.interactionDOMElement.removeEventListener("touchend",this.onTouchEnd,!0),this.interactionDOMElement.removeEventListener("touchmove",this.onTouchMove,!0),this.interactionDOMElement=null,window.removeEventListener("mouseup",this.onMouseUp,!0),this.eventsAdded=!1)},r.prototype.update=function(){if(requestAnimationFrame(this.update.bind(this)),!this.throttleUpdate()&&this.interactionDOMElement){if(this.didMove)return void(this.didMove=!1);this.cursor="inherit",this.processInteractive(this.mouse.global,this.renderer._lastObjectRendered,this.processMouseOverOut.bind(this),!0),this.currentCursorStyle!==this.cursor&&(this.currentCursorStyle=this.cursor,this.interactionDOMElement.style.cursor=this.cursor)}},r.prototype.dispatchEvent=function(t,e,r){r.stopped||(r.target=t,r.type=e,t.emit(e,r),t[e]&&t[e](r))},r.prototype.throttleUpdate=function(){var t=Date.now(),e=t-this.last;return e=e*o/1e3,1>e?!0:(this.last=t,!1)},r.prototype.mapPositionToPoint=function(t,e,r){var i=this.interactionDOMElement.getBoundingClientRect();t.x=(e-i.left)*(this.interactionDOMElement.width/i.width)/this.resolution,t.y=(r-i.top)*(this.interactionDOMElement.height/i.height)/this.resolution},r.prototype.processInteractive=function(t,e,r,i,n){if(!e.visible)return!1;var o=e.children,s=!1;if(n=n||e.interactive,e.interactiveChildren)for(var a=o.length-1;a>=0;a--)!s&&i?s=this.processInteractive(t,o[a],r,!0,n):this.processInteractive(t,o[a],r,!1,!1);return n&&(i&&(e.hitArea?(e.worldTransform.applyInverse(t,this._tempPoint),s=e.hitArea.contains(this._tempPoint.x,this._tempPoint.y)):e.containsPoint&&(s=e.containsPoint(t))),e.interactive&&r(e,s)),s},r.prototype.onMouseDown=function(t){this.mouse.originalEvent=t,this.eventData.data=this.mouse,this.eventData.stopped=!1,s&&this.mouse.originalEvent.preventDefault(),this.processInteractive(this.mouse.global,this.renderer._lastObjectRendered,this.processMouseDown,!0)},r.prototype.processMouseDown=function(t,e){var r=this.mouse.originalEvent,i=2===r.button||3===r.which;e&&(t[i?"_isRightDown":"_isLeftDown"]=!0,this.dispatchEvent(t,i?"rightdown":"mousedown",this.eventData))},r.prototype.onMouseUp=function(t){this.mouse.originalEvent=t,this.eventData.data=this.mouse,this.eventData.stopped=!1,this.processInteractive(this.mouse.global,this.renderer._lastObjectRendered,this.processMouseUp,!0)},r.prototype.processMouseUp=function(t,e){var r=this.mouse.originalEvent,i=2===r.button||3===r.which,n=i?"_isRightDown":"_isLeftDown";e?(this.dispatchEvent(t,i?"rightup":"mouseup",this.eventData),t[n]&&(t[n]=!1,this.dispatchEvent(t,i?"rightclick":"click",this.eventData))):t[n]&&(t[n]=!1,this.dispatchEvent(t,i?"rightupoutside":"mouseupoutside",this.eventData))},r.prototype.onMouseMove=function(t){this.mouse.originalEvent=t,this.eventData.data=this.mouse,this.eventData.stopped=!1,this.mapPositionToPoint(this.mouse.global,t.clientX,t.clientY),this.didMove=!0,this.cursor="inherit",this.processInteractive(this.mouse.global,this.renderer._lastObjectRendered,this.processMouseMove,!0),this.currentCursorStyle!==this.cursor&&(this.currentCursorStyle=this.cursor,this.interactionDOMElement.style.cursor=this.cursor)},r.prototype.processMouseMove=function(t,e){this.dispatchEvent(t,"mousemove",this.eventData),this.processMouseOverOut(t,e)},r.prototype.onMouseOut=function(t){this.mouse.originalEvent=t,this.eventData.stopped=!1,this.interactionDOMElement.style.cursor="inherit",this.mapPositionToPoint(this.mouse.global,t.clientX,t.clientY),this.processInteractive(this.mouse.global,this.renderer._lastObjectRendered,this.processMouseOverOut,!1)},r.prototype.processMouseOverOut=function(t,e){e?(t._over||(t._over=!0,this.dispatchEvent(t,"mouseover",this.eventData)),t.buttonMode&&(this.cursor=t.defaultCursor)):t._over&&(t._over=!1,this.dispatchEvent(t,"mouseout",this.eventData))},r.prototype.onTouchStart=function(t){s&&t.preventDefault();for(var e=t.changedTouches,r=0;re;e++){var o=this.skeleton.drawOrder[e],s=o.attachment,a=new i.Container;if(this.slotContainers.push(a),this.addChild(a),s instanceof n.RegionAttachment){var h=s.rendererObject.name,l=this.createSprite(o,s);o.currentSprite=l,o.currentSpriteName=h,a.addChild(l)}else{if(!(s instanceof n.MeshAttachment))continue;var u=this.createMesh(o,s);o.currentMesh=u,o.currentMeshName=s.name,a.addChild(u)}}this.autoUpdate=!0}var i=t("../core"),n=t("./SpineRuntime");n.Bone.yDown=!0,r.prototype=Object.create(i.Container.prototype),r.prototype.constructor=r,e.exports=r,Object.defineProperties(r.prototype,{autoUpdate:{get:function(){return this.updateTransform===r.prototype.autoUpdateTransform},set:function(t){this.updateTransform=t?r.prototype.autoUpdateTransform:i.Container.prototype.updateTransform}}}),r.prototype.update=function(t){this.state.update(t),this.state.apply(this.skeleton),this.skeleton.updateWorldTransform();for(var e=this.skeleton.drawOrder,r=0,o=e.length;o>r;r++){var s=e[r],a=s.attachment,h=this.slotContainers[r];if(a){var l=a.type;if(l===n.AttachmentType.region){if(a.rendererObject&&(!s.currentSpriteName||s.currentSpriteName!==a.rendererObject.name)){var u=a.rendererObject.name;if(void 0!==s.currentSprite&&(s.currentSprite.visible=!1),s.sprites=s.sprites||{},void 0!==s.sprites[u])s.sprites[u].visible=!0;else{var c=this.createSprite(s,a);h.addChild(c)}s.currentSprite=s.sprites[u],s.currentSpriteName=u}var d=s.bone;h.position.x=d.worldX+a.x*d.m00+a.y*d.m01,h.position.y=d.worldY+a.x*d.m10+a.y*d.m11,h.scale.x=d.worldScaleX,h.scale.y=d.worldScaleY,h.rotation=-(s.bone.worldRotation*n.degRad),s.currentSprite.tint=i.utils.rgb2hex([s.r,s.g,s.b])}else{if(l!==n.AttachmentType.skinnedmesh){h.visible=!1;continue}if(!s.currentMeshName||s.currentMeshName!==a.name){var p=a.name;if(void 0!==s.currentMesh&&(s.currentMesh.visible=!1),s.meshes=s.meshes||{},void 0!==s.meshes[p])s.meshes[p].visible=!0;else{var f=this.createMesh(s,a);h.addChild(f)}s.currentMesh=s.meshes[p],s.currentMeshName=p}a.computeWorldVertices(s.bone.skeleton.x,s.bone.skeleton.y,s,s.currentMesh.vertices)}h.visible=!0,h.alpha=s.a}else h.visible=!1}},r.prototype.autoUpdateTransform=function(){this.lastTime=this.lastTime||Date.now();var t=.001*(Date.now()-this.lastTime);this.lastTime=Date.now(),this.update(t),i.Container.prototype.updateTransform.call(this)},r.prototype.createSprite=function(t,e){var r=e.rendererObject,o=r.page.rendererObject,s=new i.math.Rectangle(r.x,r.y,r.rotate?r.height:r.width,r.rotate?r.width:r.height),a=new i.Texture(o,s),h=new i.Sprite(a),l=r.rotate?.5*Math.PI:0;return h.scale.set(r.width/r.originalWidth,r.height/r.originalHeight),h.rotation=l-e.rotation*n.degRad,h.anchor.x=h.anchor.y=.5,t.sprites=t.sprites||{},t.sprites[r.name]=h,h},r.prototype.createMesh=function(t,e){var r=e.rendererObject,n=r.page.rendererObject,o=new i.Texture(n),s=new i.Strip(o);return s.drawMode=i.Strip.DRAW_MODES.TRIANGLES,s.canvasPadding=1.5,s.vertices=new Float32Array(e.uvs.length),s.uvs=e.uvs,s.indices=e.triangles,t.meshes=t.meshes||{},t.meshes[e.name]=s,s}},{"../core":19,"./SpineRuntime":120}],120:[function(t,e){var r=t("../core"),i=e.exports={radDeg:180/Math.PI,degRad:Math.PI/180,temp:[],Float32Array:"undefined"==typeof Float32Array?Array:Float32Array,Uint16Array:"undefined"==typeof Uint16Array?Array:Uint16Array};i.BoneData=function(t,e){this.name=t,this.parent=e},i.BoneData.prototype={length:0,x:0,y:0,rotation:0,scaleX:1,scaleY:1,inheritScale:!0,inheritRotation:!0,flipX:!1,flipY:!1},i.SlotData=function(t,e){this.name=t,this.boneData=e},i.SlotData.prototype={r:1,g:1,b:1,a:1,attachmentName:null,additiveBlending:!1},i.IkConstraintData=function(t){this.name=t,this.bones=[]},i.IkConstraintData.prototype={target:null,bendDirection:1,mix:1},i.Bone=function(t,e,r){this.data=t,this.skeleton=e,this.parent=r,this.setToSetupPose()},i.Bone.yDown=!1,i.Bone.prototype={x:0,y:0,rotation:0,rotationIK:0,scaleX:1,scaleY:1,flipX:!1,flipY:!1,m00:0,m01:0,worldX:0,m10:0,m11:0,worldY:0,worldRotation:0,worldScaleX:1,worldScaleY:1,worldFlipX:!1,worldFlipY:!1,updateWorldTransform:function(){var t=this.parent;if(t)this.worldX=this.x*t.m00+this.y*t.m01+t.worldX,this.worldY=this.x*t.m10+this.y*t.m11+t.worldY,this.data.inheritScale?(this.worldScaleX=t.worldScaleX*this.scaleX,this.worldScaleY=t.worldScaleY*this.scaleY):(this.worldScaleX=this.scaleX,this.worldScaleY=this.scaleY),this.worldRotation=this.data.inheritRotation?t.worldRotation+this.rotationIK:this.rotationIK,this.worldFlipX=t.worldFlipX!=this.flipX,this.worldFlipY=t.worldFlipY!=this.flipY;else{var e=this.skeleton.flipX,r=this.skeleton.flipY;this.worldX=e?-this.x:this.x,this.worldY=r!=i.Bone.yDown?-this.y:this.y,this.worldScaleX=this.scaleX,this.worldScaleY=this.scaleY,this.worldRotation=this.rotationIK,this.worldFlipX=e!=this.flipX,this.worldFlipY=r!=this.flipY}var n=this.worldRotation*i.degRad,o=Math.cos(n),s=Math.sin(n);this.worldFlipX?(this.m00=-o*this.worldScaleX,this.m01=s*this.worldScaleY):(this.m00=o*this.worldScaleX,this.m01=-s*this.worldScaleY),this.worldFlipY!=i.Bone.yDown?(this.m10=-s*this.worldScaleX,this.m11=-o*this.worldScaleY):(this.m10=s*this.worldScaleX,this.m11=o*this.worldScaleY)},setToSetupPose:function(){var t=this.data;this.x=t.x,this.y=t.y,this.rotation=t.rotation,this.rotationIK=this.rotation,this.scaleX=t.scaleX,this.scaleY=t.scaleY,this.flipX=t.flipX,this.flipY=t.flipY},worldToLocal:function(t){var e=t[0]-this.worldX,r=t[1]-this.worldY,n=this.m00,o=this.m10,s=this.m01,a=this.m11;this.worldFlipX!=(this.worldFlipY!=i.Bone.yDown)&&(n=-n,a=-a);var h=1/(n*a-s*o);t[0]=e*n*h-r*s*h,t[1]=r*a*h-e*o*h},localToWorld:function(t){var e=t[0],r=t[1];t[0]=e*this.m00+r*this.m01+this.worldX,t[1]=e*this.m10+r*this.m11+this.worldY}},i.Slot=function(t,e){this.data=t,this.bone=e,this.setToSetupPose()},i.Slot.prototype={r:1,g:1,b:1,a:1,_attachmentTime:0,attachment:null,attachmentVertices:[],setAttachment:function(t){this.attachment=t,this._attachmentTime=this.bone.skeleton.time,this.attachmentVertices.length=0},setAttachmentTime:function(t){this._attachmentTime=this.bone.skeleton.time-t},getAttachmentTime:function(){return this.bone.skeleton.time-this._attachmentTime},setToSetupPose:function(){var t=this.data;this.r=t.r,this.g=t.g,this.b=t.b,this.a=t.a;for(var e=this.bone.skeleton.data.slots,r=0,i=e.length;i>r;r++)if(e[r]==t){this.setAttachment(t.attachmentName?this.bone.skeleton.getAttachmentBySlotIndex(r,t.attachmentName):null);break}}},i.IkConstraint=function(t,e){this.data=t,this.mix=t.mix,this.bendDirection=t.bendDirection,this.bones=[];for(var r=0,i=t.bones.length;i>r;r++)this.bones.push(e.findBone(t.bones[r].name));this.target=e.findBone(t.target.name)},i.IkConstraint.prototype={apply:function(){var t=this.target,e=this.bones;switch(e.length){case 1:i.IkConstraint.apply1(e[0],t.worldX,t.worldY,this.mix);break;case 2:i.IkConstraint.apply2(e[0],e[1],t.worldX,t.worldY,this.bendDirection,this.mix)}}},i.IkConstraint.apply1=function(t,e,r,n){var o=t.data.inheritRotation&&t.parent?t.parent.worldRotation:0,s=t.rotation,a=Math.atan2(r-t.worldY,e-t.worldX)*i.radDeg-o;t.rotationIK=s+(a-s)*n},i.IkConstraint.apply2=function(t,e,r,n,o,s){var a=e.rotation,h=t.rotation;if(!s)return e.rotationIK=a,void(t.rotationIK=h);var l,u,c=i.temp,d=t.parent;d?(c[0]=r,c[1]=n,d.worldToLocal(c),r=(c[0]-t.x)*d.worldScaleX,n=(c[1]-t.y)*d.worldScaleY):(r-=t.x,n-=t.y),e.parent==t?(l=e.x,u=e.y):(c[0]=e.x,c[1]=e.y,e.parent.localToWorld(c),t.worldToLocal(c),l=c[0],u=c[1]);var p=l*t.worldScaleX,f=u*t.worldScaleY,g=Math.atan2(f,p),v=Math.sqrt(p*p+f*f),m=e.data.length*e.worldScaleX,y=2*v*m;if(1e-4>y)return void(e.rotationIK=a+(Math.atan2(n,r)*i.radDeg-h-a)*s);var x=(r*r+n*n-v*v-m*m)/y;-1>x?x=-1:x>1&&(x=1);var b=Math.acos(x)*o,T=v+m*x,_=m*Math.sin(b),E=Math.atan2(n*T-r*_,r*T+n*_),w=(E-g)*i.radDeg-h;w>180?w-=360:-180>w&&(w+=360),t.rotationIK=h+w*s,w=(b+g)*i.radDeg-a,w>180?w-=360:-180>w&&(w+=360),e.rotationIK=a+(w+t.worldRotation-e.parent.worldRotation)*s},i.Skin=function(t){this.name=t,this.attachments={}},i.Skin.prototype={addAttachment:function(t,e,r){this.attachments[t+":"+e]=r},getAttachment:function(t,e){return this.attachments[t+":"+e]},_attachAll:function(t,e){for(var r in e.attachments){var i=r.indexOf(":"),n=parseInt(r.substring(0,i)),o=r.substring(i+1),s=t.slots[n];if(s.attachment&&s.attachment.name==o){var a=this.getAttachment(n,o);a&&s.setAttachment(a)}}}},i.Animation=function(t,e,r){this.name=t,this.timelines=e,this.duration=r},i.Animation.prototype={apply:function(t,e,r,i,n){i&&0!=this.duration&&(r%=this.duration,e%=this.duration);for(var o=this.timelines,s=0,a=o.length;a>s;s++)o[s].apply(t,e,r,n,1)},mix:function(t,e,r,i,n,o){i&&0!=this.duration&&(r%=this.duration,e%=this.duration);for(var s=this.timelines,a=0,h=s.length;h>a;a++)s[a].apply(t,e,r,n,o)}},i.Animation.binarySearch=function(t,e,r){var i=0,n=Math.floor(t.length/r)-2;if(!n)return r;for(var o=n>>>1;;){if(t[(o+1)*r]<=e?i=o+1:n=o,i==n)return(i+1)*r;o=i+n>>>1}},i.Animation.binarySearch1=function(t,e){var r=0,i=t.length-2;if(!i)return 1;for(var n=i>>>1;;){if(t[n+1]<=e?r=n+1:i=n,r==i)return r+1;n=r+i>>>1}},i.Animation.linearSearch=function(t,e,r){for(var i=0,n=t.length-r;n>=i;i+=r)if(t[i]>e)return i;return-1},i.Curves=function(){this.curves=[]},i.Curves.prototype={setLinear:function(t){this.curves[19*t]=0},setStepped:function(t){this.curves[19*t]=1},setCurve:function(t,e,r,i,n){var o=.1,s=o*o,a=s*o,h=3*o,l=3*s,u=6*s,c=6*a,d=2*-e+i,p=2*-r+n,f=3*(e-i)+1,g=3*(r-n)+1,v=e*h+d*l+f*a,m=r*h+p*l+g*a,y=d*u+f*c,x=p*u+g*c,b=f*c,T=g*c,_=19*t,E=this.curves;E[_++]=2;for(var w=v,S=m,A=_+19-1;A>_;_+=2)E[_]=w,E[_+1]=S,v+=y,m+=x,y+=b,x+=T,w+=v,S+=m},getCurvePercent:function(t,e){e=0>e?0:e>1?1:e;var r=this.curves,i=19*t,n=r[i];if(0===n)return e;if(1==n)return 0;i++;for(var o=0,s=i,a=i+19-1;a>i;i+=2)if(o=r[i],o>=e){var h,l;return i==s?(h=0,l=0):(h=r[i-2],l=r[i-1]),l+(r[i+1]-l)*(e-h)/(o-h)}var u=r[i-1];return u+(1-u)*(e-o)/(1-o)}},i.RotateTimeline=function(t){this.curves=new i.Curves(t),this.frames=[],this.frames.length=2*t},i.RotateTimeline.prototype={boneIndex:0,getFrameCount:function(){return this.frames.length/2},setFrame:function(t,e,r){t*=2,this.frames[t]=e,this.frames[t+1]=r},apply:function(t,e,r,n,o){var s=this.frames;if(!(r=s[s.length-2]){for(var h=a.data.rotation+s[s.length-1]-a.rotation;h>180;)h-=360;for(;-180>h;)h+=360;return void(a.rotation+=h*o)}var l=i.Animation.binarySearch(s,r,2),u=s[l-1],c=s[l],d=1-(r-c)/(s[l-2]-c);d=this.curves.getCurvePercent(l/2-1,d);for(var h=s[l+1]-u;h>180;)h-=360;for(;-180>h;)h+=360;for(h=a.data.rotation+(u+h*d)-a.rotation;h>180;)h-=360;for(;-180>h;)h+=360;a.rotation+=h*o}}},i.TranslateTimeline=function(t){this.curves=new i.Curves(t),this.frames=[],this.frames.length=3*t},i.TranslateTimeline.prototype={boneIndex:0,getFrameCount:function(){return this.frames.length/3},setFrame:function(t,e,r,i){t*=3,this.frames[t]=e,this.frames[t+1]=r,this.frames[t+2]=i},apply:function(t,e,r,n,o){var s=this.frames;if(!(r=s[s.length-3])return a.x+=(a.data.x+s[s.length-2]-a.x)*o,void(a.y+=(a.data.y+s[s.length-1]-a.y)*o);var h=i.Animation.binarySearch(s,r,3),l=s[h-2],u=s[h-1],c=s[h],d=1-(r-c)/(s[h+-3]-c);d=this.curves.getCurvePercent(h/3-1,d),a.x+=(a.data.x+l+(s[h+1]-l)*d-a.x)*o,a.y+=(a.data.y+u+(s[h+2]-u)*d-a.y)*o}}},i.ScaleTimeline=function(t){this.curves=new i.Curves(t),this.frames=[],this.frames.length=3*t},i.ScaleTimeline.prototype={boneIndex:0,getFrameCount:function(){return this.frames.length/3},setFrame:function(t,e,r,i){t*=3,this.frames[t]=e,this.frames[t+1]=r,this.frames[t+2]=i},apply:function(t,e,r,n,o){var s=this.frames;if(!(r=s[s.length-3])return a.scaleX+=(a.data.scaleX*s[s.length-2]-a.scaleX)*o,void(a.scaleY+=(a.data.scaleY*s[s.length-1]-a.scaleY)*o);var h=i.Animation.binarySearch(s,r,3),l=s[h-2],u=s[h-1],c=s[h],d=1-(r-c)/(s[h+-3]-c);d=this.curves.getCurvePercent(h/3-1,d),a.scaleX+=(a.data.scaleX*(l+(s[h+1]-l)*d)-a.scaleX)*o,a.scaleY+=(a.data.scaleY*(u+(s[h+2]-u)*d)-a.scaleY)*o}}},i.ColorTimeline=function(t){this.curves=new i.Curves(t),this.frames=[],this.frames.length=5*t},i.ColorTimeline.prototype={slotIndex:0,getFrameCount:function(){return this.frames.length/5},setFrame:function(t,e,r,i,n,o){t*=5,this.frames[t]=e,this.frames[t+1]=r,this.frames[t+2]=i,this.frames[t+3]=n,this.frames[t+4]=o},apply:function(t,e,r,n,o){var s=this.frames;if(!(r=s[s.length-5]){var c=s.length-1;a=s[c-3],h=s[c-2],l=s[c-1],u=s[c]}else{var d=i.Animation.binarySearch(s,r,5),p=s[d-4],f=s[d-3],g=s[d-2],v=s[d-1],m=s[d],y=1-(r-m)/(s[d-5]-m);y=this.curves.getCurvePercent(d/5-1,y),a=p+(s[d+1]-p)*y,h=f+(s[d+2]-f)*y,l=g+(s[d+3]-g)*y,u=v+(s[d+4]-v)*y}var x=t.slots[this.slotIndex];1>o?(x.r+=(a-x.r)*o,x.g+=(h-x.g)*o,x.b+=(l-x.b)*o,x.a+=(u-x.a)*o):(x.r=a,x.g=h,x.b=l,x.a=u)}}},i.AttachmentTimeline=function(t){this.curves=new i.Curves(t),this.frames=[],this.frames.length=t,this.attachmentNames=[],this.attachmentNames.length=t},i.AttachmentTimeline.prototype={slotIndex:0,getFrameCount:function(){return this.frames.length},setFrame:function(t,e,r){this.frames[t]=e,this.attachmentNames[t]=r},apply:function(t,e,r){var n=this.frames;if(rr&&this.apply(t,e,Number.MAX_VALUE,null,0));e>r&&(e=-1);var o=r>=n[n.length-1]?n.length-1:i.Animation.binarySearch1(n,r)-1;if(!(n[o]r)this.apply(t,e,Number.MAX_VALUE,n,o),e=-1;else if(e>=s[a-1])return;if(!(r0&&s[h-1]==l;)h--}for(var u=this.events;a>h&&r>=s[h];h++)n.push(u[h])}}}},i.DrawOrderTimeline=function(t){this.frames=[],this.frames.length=t,this.drawOrders=[],this.drawOrders.length=t},i.DrawOrderTimeline.prototype={getFrameCount:function(){return this.frames.length},setFrame:function(t,e,r){this.frames[t]=e,this.drawOrders[t]=r},apply:function(t,e,r){var n=this.frames;if(!(r=n[n.length-1]?n.length-1:i.Animation.binarySearch1(n,r)-1;var s=t.drawOrder,a=t.slots,h=this.drawOrders[o];if(h)for(var l=0,u=h.length;u>l;l++)s[l]=t.slots[h[l]];else for(var l=0,u=a.length;u>l;l++)s[l]=a[l]}}},i.FfdTimeline=function(t){this.curves=new i.Curves(t),this.frames=[],this.frames.length=t,this.frameVertices=[],this.frameVertices.length=t},i.FfdTimeline.prototype={slotIndex:0,attachment:0,getFrameCount:function(){return this.frames.length},setFrame:function(t,e,r){this.frames[t]=e,this.frameVertices[t]=r},apply:function(t,e,r,n,o){var s=t.slots[this.slotIndex];if(s.attachment==this.attachment){var a=this.frames;if(!(r=a[a.length-1]){var c=h[a.length-1];if(1>o)for(var d=0;l>d;d++)u[d]+=(c[d]-u[d])*o;else for(var d=0;l>d;d++)u[d]=c[d]}else{var p=i.Animation.binarySearch1(a,r),f=a[p],g=1-(r-f)/(a[p-1]-f);g=this.curves.getCurvePercent(p-1,0>g?0:g>1?1:g);var v=h[p-1],m=h[p];if(1>o)for(var d=0;l>d;d++){var y=v[d];u[d]+=(y+(m[d]-y)*g-u[d])*o}else for(var d=0;l>d;d++){var y=v[d];u[d]=y+(m[d]-y)*g}}}}}},i.IkConstraintTimeline=function(t){this.curves=new i.Curves(t),this.frames=[],this.frames.length=3*t},i.IkConstraintTimeline.prototype={ikConstraintIndex:0,getFrameCount:function(){return this.frames.length/3},setFrame:function(t,e,r,i){t*=3,this.frames[t]=e,this.frames[t+1]=r,this.frames[t+2]=i},apply:function(t,e,r,n,o){var s=this.frames;if(!(r=s[s.length-3])return a.mix+=(s[s.length-2]-a.mix)*o,void(a.bendDirection=s[s.length-1]);var h=i.Animation.binarySearch(s,r,3),l=s[h+-2],u=s[h],c=1-(r-u)/(s[h+-3]-u);c=this.curves.getCurvePercent(h/3-1,c);var d=l+(s[h+1]-l)*c;a.mix+=(d-a.mix)*o,a.bendDirection=s[h+-1]}}},i.FlipXTimeline=function(t){this.curves=new i.Curves(t),this.frames=[],this.frames.length=2*t},i.FlipXTimeline.prototype={boneIndex:0,getFrameCount:function(){return this.frames.length/2},setFrame:function(t,e,r){t*=2,this.frames[t]=e,this.frames[t+1]=r?1:0},apply:function(t,e,r){var n=this.frames;if(rr&&this.apply(t,e,Number.MAX_VALUE,null,0));e>r&&(e=-1);var o=(r>=n[n.length-2]?n.length:i.Animation.binarySearch(n,r,2))-2;n[o]r&&this.apply(t,e,Number.MAX_VALUE,null,0));e>r&&(e=-1);var o=(r>=n[n.length-2]?n.length:i.Animation.binarySearch(n,r,2))-2;n[o]r;r++)if(e[r].name==t)return e[r];return null},findBoneIndex:function(t){for(var e=this.bones,r=0,i=e.length;i>r;r++)if(e[r].name==t)return r;return-1},findSlot:function(t){for(var e=this.slots,r=0,i=e.length;i>r;r++)if(e[r].name==t)return slot[r];return null},findSlotIndex:function(t){for(var e=this.slots,r=0,i=e.length;i>r;r++)if(e[r].name==t)return r;return-1},findSkin:function(t){for(var e=this.skins,r=0,i=e.length;i>r;r++)if(e[r].name==t)return e[r];return null},findEvent:function(t){for(var e=this.events,r=0,i=e.length;i>r;r++)if(e[r].name==t)return e[r];return null},findAnimation:function(t){for(var e=this.animations,r=0,i=e.length;i>r;r++)if(e[r].name==t)return e[r];return null},findIkConstraint:function(t){for(var e=this.ikConstraints,r=0,i=e.length;i>r;r++)if(e[r].name==t)return e[r];return null}},i.Skeleton=function(t){this.data=t,this.bones=[];for(var e=0,r=t.bones.length;r>e;e++){var n=t.bones[e],o=n.parent?this.bones[t.bones.indexOf(n.parent)]:null;this.bones.push(new i.Bone(n,this,o))}this.slots=[],this.drawOrder=[];for(var e=0,r=t.slots.length;r>e;e++){var s=t.slots[e],a=this.bones[t.bones.indexOf(s.boneData)],h=new i.Slot(s,a);this.slots.push(h),this.drawOrder.push(h)}this.ikConstraints=[];for(var e=0,r=t.ikConstraints.length;r>e;e++)this.ikConstraints.push(new i.IkConstraint(t.ikConstraints[e],this));this.boneCache=[],this.updateCache()},i.Skeleton.prototype={x:0,y:0,skin:null,r:1,g:1,b:1,a:1,time:0,flipX:!1,flipY:!1,updateCache:function(){var t=this.ikConstraints,e=t.length,r=e+1,i=this.boneCache;i.length>r&&(i.length=r);for(var n=0,o=i.length;o>n;n++)i[n].length=0;for(;i.lengthn;n++){var h=a[n],l=h;do{for(var u=0;e>u;u++)for(var c=t[u],d=c.bones[0],p=c.bones[c.bones.length-1];;){if(l==p){i[u].push(h),i[u+1].push(h);continue t}if(p==d)break;p=p.parent}l=l.parent}while(l);s[s.length]=h}},updateWorldTransform:function(){for(var t=this.bones,e=0,r=t.length;r>e;e++){var i=t[e];i.rotationIK=i.rotation}for(var e=0,n=this.boneCache.length-1;;){for(var o=this.boneCache[e],s=0,a=o.length;a>s;s++)o[s].updateWorldTransform();if(e==n)break;this.ikConstraints[e].apply(),e++}},setToSetupPose:function(){this.setBonesToSetupPose(),this.setSlotsToSetupPose()},setBonesToSetupPose:function(){for(var t=this.bones,e=0,r=t.length;r>e;e++)t[e].setToSetupPose();for(var i=this.ikConstraints,e=0,r=i.length;r>e;e++){var n=i[e];n.bendDirection=n.data.bendDirection,n.mix=n.data.mix}},setSlotsToSetupPose:function(){for(var t=this.slots,e=this.drawOrder,r=0,i=t.length;i>r;r++)e[r]=t[r],t[r].setToSetupPose(r)},getRootBone:function(){return this.bones.length?this.bones[0]:null},findBone:function(t){for(var e=this.bones,r=0,i=e.length;i>r;r++)if(e[r].data.name==t)return e[r];return null},findBoneIndex:function(t){for(var e=this.bones,r=0,i=e.length;i>r;r++)if(e[r].data.name==t)return r;return-1},findSlot:function(t){for(var e=this.slots,r=0,i=e.length;i>r;r++)if(e[r].data.name==t)return e[r];return null},findSlotIndex:function(t){for(var e=this.slots,r=0,i=e.length;i>r;r++)if(e[r].data.name==t)return r;return-1},setSkinByName:function(t){var e=this.data.findSkin(t);if(!e)throw"Skin not found: "+t;this.setSkin(e)},setSkin:function(t){if(t)if(this.skin)t._attachAll(this,this.skin);else for(var e=this.slots,r=0,i=e.length;i>r;r++){var n=e[r],o=n.data.attachmentName;if(o){var s=t.getAttachment(r,o);s&&n.setAttachment(s)}}this.skin=t},getAttachmentBySlotName:function(t,e){return this.getAttachmentBySlotIndex(this.data.findSlotIndex(t),e)},getAttachmentBySlotIndex:function(t,e){if(this.skin){var r=this.skin.getAttachment(t,e);if(r)return r}return this.data.defaultSkin?this.data.defaultSkin.getAttachment(t,e):null},setAttachment:function(t,e){for(var r=this.slots,i=0,n=r.length;n>i;i++){var o=r[i];if(o.data.name==t){var s=null;if(e&&(s=this.getAttachmentBySlotIndex(i,e),!s))throw"Attachment not found: "+e+", for slot: "+t;return void o.setAttachment(s)}}throw"Slot not found: "+t},findIkConstraint:function(t){for(var e=this.ikConstraints,r=0,i=e.length;i>r;r++)if(e[r].data.name==t)return e[r];return null},update:function(t){this.time+=t}},i.EventData=function(t){this.name=t},i.EventData.prototype={intValue:0,floatValue:0,stringValue:null},i.Event=function(t){this.data=t},i.Event.prototype={intValue:0,floatValue:0,stringValue:null},i.AttachmentType={region:0,boundingbox:1,mesh:2,skinnedmesh:3},i.RegionAttachment=function(t){this.name=t,this.offset=[],this.offset.length=8,this.uvs=[],this.uvs.length=8},i.RegionAttachment.prototype={type:i.AttachmentType.region,x:0,y:0,rotation:0,scaleX:1,scaleY:1,width:0,height:0,r:1,g:1,b:1,a:1,path:null,rendererObject:null,regionOffsetX:0,regionOffsetY:0,regionWidth:0,regionHeight:0,regionOriginalWidth:0,regionOriginalHeight:0,setUVs:function(t,e,r,i,n){var o=this.uvs;n?(o[2]=t,o[3]=i,o[4]=t,o[5]=e,o[6]=r,o[7]=e,o[0]=r,o[1]=i):(o[0]=t,o[1]=i,o[2]=t,o[3]=e,o[4]=r,o[5]=e,o[6]=r,o[7]=i)},updateOffset:function(){var t=this.width/this.regionOriginalWidth*this.scaleX,e=this.height/this.regionOriginalHeight*this.scaleY,r=-this.width/2*this.scaleX+this.regionOffsetX*t,n=-this.height/2*this.scaleY+this.regionOffsetY*e,o=r+this.regionWidth*t,s=n+this.regionHeight*e,a=this.rotation*i.degRad,h=Math.cos(a),l=Math.sin(a),u=r*h+this.x,c=r*l,d=n*h+this.y,p=n*l,f=o*h+this.x,g=o*l,v=s*h+this.y,m=s*l,y=this.offset;y[0]=u-p,y[1]=d+c,y[2]=u-m,y[3]=v+c,y[4]=f-m,y[5]=v+g,y[6]=f-p,y[7]=d+g},computeVertices:function(t,e,r,i){t+=r.worldX,e+=r.worldY;var n=r.m00,o=r.m01,s=r.m10,a=r.m11,h=this.offset;i[0]=h[0]*n+h[1]*o+t,i[1]=h[0]*s+h[1]*a+e,i[2]=h[2]*n+h[3]*o+t,i[3]=h[2]*s+h[3]*a+e,i[4]=h[4]*n+h[5]*o+t,i[5]=h[4]*s+h[5]*a+e,i[6]=h[6]*n+h[7]*o+t,i[7]=h[6]*s+h[7]*a+e}},i.MeshAttachment=function(t){this.name=t},i.MeshAttachment.prototype={type:i.AttachmentType.mesh,vertices:null,uvs:null,regionUVs:null,triangles:null,hullLength:0,r:1,g:1,b:1,a:1,path:null,rendererObject:null,regionU:0,regionV:0,regionU2:0,regionV2:0,regionRotate:!1,regionOffsetX:0,regionOffsetY:0,regionWidth:0,regionHeight:0,regionOriginalWidth:0,regionOriginalHeight:0,edges:null,width:0,height:0,updateUVs:function(){var t=this.regionU2-this.regionU,e=this.regionV2-this.regionV,r=this.regionUVs.length;if(this.uvs&&this.uvs.length==r||(this.uvs=new i.Float32Array(r)),this.regionRotate)for(var n=0;r>n;n+=2)this.uvs[n]=this.regionU+this.regionUVs[n+1]*t,this.uvs[n+1]=this.regionV+e-this.regionUVs[n]*e;else for(var n=0;r>n;n+=2)this.uvs[n]=this.regionU+this.regionUVs[n]*t,this.uvs[n+1]=this.regionV+this.regionUVs[n+1]*e},computeWorldVertices:function(t,e,r,i){var n=r.bone;t+=n.worldX,e+=n.worldY;var o=n.m00,s=n.m01,a=n.m10,h=n.m11,l=this.vertices,u=l.length;r.attachmentVertices.length==u&&(l=r.attachmentVertices);for(var c=0;u>c;c+=2){var d=l[c],p=l[c+1];i[c]=d*o+p*s+t,i[c+1]=d*a+p*h+e}}},i.SkinnedMeshAttachment=function(t){this.name=t},i.SkinnedMeshAttachment.prototype={type:i.AttachmentType.skinnedmesh,bones:null,weights:null,uvs:null,regionUVs:null,triangles:null,hullLength:0,r:1,g:1,b:1,a:1,path:null,rendererObject:null,regionU:0,regionV:0,regionU2:0,regionV2:0,regionRotate:!1,regionOffsetX:0,regionOffsetY:0,regionWidth:0,regionHeight:0,regionOriginalWidth:0,regionOriginalHeight:0,edges:null,width:0,height:0,updateUVs:function(){var t=this.regionU2-this.regionU,e=this.regionV2-this.regionV,r=this.regionUVs.length;if(this.uvs&&this.uvs.length==r||(this.uvs=new i.Float32Array(r)),this.regionRotate)for(var n=0;r>n;n+=2)this.uvs[n]=this.regionU+this.regionUVs[n+1]*t,this.uvs[n+1]=this.regionV+e-this.regionUVs[n]*e;else for(var n=0;r>n;n+=2)this.uvs[n]=this.regionU+this.regionUVs[n]*t,this.uvs[n+1]=this.regionV+this.regionUVs[n+1]*e},computeWorldVertices:function(t,e,r,i){var n,o,s,a,h,l,u,c=r.bone.skeleton.bones,d=this.weights,p=this.bones,f=0,g=0,v=0,m=0,y=p.length;if(r.attachmentVertices.length)for(var x=r.attachmentVertices;y>g;f+=2){for(o=0,s=0,n=p[g++]+g;n>g;g++,v+=3,m+=2)a=c[p[g]],h=d[v]+x[m],l=d[v+1]+x[m+1],u=d[v+2],o+=(h*a.m00+l*a.m01+a.worldX)*u,s+=(h*a.m10+l*a.m11+a.worldY)*u;i[f]=o+t,i[f+1]=s+e}else for(;y>g;f+=2){for(o=0,s=0,n=p[g++]+g;n>g;g++,v+=3)a=c[p[g]],h=d[v],l=d[v+1],u=d[v+2],o+=(h*a.m00+l*a.m01+a.worldX)*u,s+=(h*a.m10+l*a.m11+a.worldY)*u;i[f]=o+t,i[f+1]=s+e}}},i.BoundingBoxAttachment=function(t){this.name=t,this.vertices=[]},i.BoundingBoxAttachment.prototype={type:i.AttachmentType.boundingbox,computeWorldVertices:function(t,e,r,i){t+=r.worldX,e+=r.worldY;for(var n=r.m00,o=r.m01,s=r.m10,a=r.m11,h=this.vertices,l=0,u=h.length;u>l;l+=2){var c=h[l],d=h[l+1];i[l]=c*n+d*o+t,i[l+1]=c*s+d*a+e}}},i.AnimationStateData=function(t){this.skeletonData=t,this.animationToMixTime={}},i.AnimationStateData.prototype={defaultMix:0,setMixByName:function(t,e,r){var i=this.skeletonData.findAnimation(t);if(!i)throw"Animation not found: "+t;var n=this.skeletonData.findAnimation(e);if(!n)throw"Animation not found: "+e;this.setMix(i,n,r)},setMix:function(t,e,r){this.animationToMixTime[t.name+":"+e.name]=r},getMix:function(t,e){var r=t.name+":"+e.name;return this.animationToMixTime.hasOwnProperty(r)?this.animationToMixTime[r]:this.defaultMix}},i.TrackEntry=function(){},i.TrackEntry.prototype={next:null,previous:null,animation:null,loop:!1,delay:0,time:0,lastTime:-1,endTime:0,timeScale:1,mixTime:0,mixDuration:0,mix:1,onStart:null,onEnd:null,onComplete:null,onEvent:null},i.AnimationState=function(t){this.data=t,this.tracks=[],this.events=[]},i.AnimationState.prototype={onStart:null,onEnd:null,onComplete:null,onEvent:null,timeScale:1,update:function(t){t*=this.timeScale;for(var e=0;e=0&&this.setCurrent(e,n)):!r.loop&&r.lastTime>=r.endTime&&this.clearTrack(e)}}},apply:function(t){for(var e=0;eo&&(i=o);var a=r.previous;if(a){var h=a.time;!a.loop&&h>a.endTime&&(h=a.endTime),a.animation.apply(t,h,h,a.loop,null);var l=r.mixTime/r.mixDuration*r.mix;l>=1&&(l=1,r.previous=null),r.animation.mix(t,r.lastTime,i,s,this.events,l)}else 1==r.mix?r.animation.apply(t,r.lastTime,i,s,this.events):r.animation.mix(t,r.lastTime,i,s,this.events,r.mix);for(var u=0,c=this.events.length;c>u;u++){var d=this.events[u];r.onEvent&&r.onEvent(e,d),this.onEvent&&this.onEvent(e,d)}if(s?n%o>i%o:o>n&&i>=o){var p=Math.floor(i/o);r.onComplete&&r.onComplete(e,p),this.onComplete&&this.onComplete(e,p)}r.lastTime=r.time}}},clearTracks:function(){for(var t=0,e=this.tracks.length;e>t;t++)this.clearTrack(t);this.tracks.length=0},clearTrack:function(t){if(!(t>=this.tracks.length)){var e=this.tracks[t];e&&(e.onEnd&&e.onEnd(t),this.onEnd&&this.onEnd(t),this.tracks[t]=null)}},_expandToIndex:function(t){if(t=this.tracks.length;)this.tracks.push(null);return null},setCurrent:function(t,e){var r=this._expandToIndex(t);if(r){var i=r.previous;r.previous=null,r.onEnd&&r.onEnd(t),this.onEnd&&this.onEnd(t),e.mixDuration=this.data.getMix(r.animation,e.animation),e.mixDuration>0&&(e.mixTime=0,e.previous=i&&r.mixTime/r.mixDuration<.5?i:r)}this.tracks[t]=e,e.onStart&&e.onStart(t),this.onStart&&this.onStart(t)},setAnimationByName:function(t,e,r){var i=this.data.skeletonData.findAnimation(e);if(!i)throw"Animation not found: "+e;return this.setAnimation(t,i,r)},setAnimation:function(t,e,r){var n=new i.TrackEntry;return n.animation=e,n.loop=r,n.endTime=e.duration,this.setCurrent(t,n),n},addAnimationByName:function(t,e,r,i){var n=this.data.skeletonData.findAnimation(e);if(!n)throw"Animation not found: "+e;return this.addAnimation(t,n,r,i)},addAnimation:function(t,e,r,n){var o=new i.TrackEntry;o.animation=e,o.loop=r,o.endTime=e.duration;var s=this._expandToIndex(t);if(s){for(;s.next;)s=s.next;s.next=o}else this.tracks[t]=o;return 0>=n&&(s?n+=s.endTime-this.data.getMix(s.animation,e):n=0),o.delay=n,o},getCurrent:function(t){return t>=this.tracks.length?null:this.tracks[t]}},i.SkeletonJsonParser=function(t){this.attachmentLoader=t},i.SkeletonJsonParser.prototype={scale:1,readSkeletonData:function(t,e){var r=new i.SkeletonData;r.name=e;var n=t.skeleton;n&&(r.hash=n.hash,r.version=n.spine,r.width=n.width||0,r.height=n.height||0);for(var o=t.bones,s=0,a=o.length;a>s;s++){var h=o[s],l=null;if(h.parent&&(l=r.findBone(h.parent),!l))throw"Parent bone not found: "+h.parent;var u=new i.BoneData(h.name,l);u.length=(h.length||0)*this.scale,u.x=(h.x||0)*this.scale,u.y=(h.y||0)*this.scale,u.rotation=h.rotation||0,u.scaleX=h.hasOwnProperty("scaleX")?h.scaleX:1,u.scaleY=h.hasOwnProperty("scaleY")?h.scaleY:1,u.inheritScale=h.hasOwnProperty("inheritScale")?h.inheritScale:!0,u.inheritRotation=h.hasOwnProperty("inheritRotation")?h.inheritRotation:!0,r.bones.push(u)}var c=t.ik;if(c)for(var s=0,a=c.length;a>s;s++){for(var d=c[s],p=new i.IkConstraintData(d.name),o=d.bones,f=0,g=o.length;g>f;f++){var v=r.findBone(o[f]);if(!v)throw"IK bone not found: "+o[f];p.bones.push(v)}if(p.target=r.findBone(d.target),!p.target)throw"Target bone not found: "+d.target;p.bendDirection=!d.hasOwnProperty("bendPositive")||d.bendPositive?1:-1,p.mix=d.hasOwnProperty("mix")?d.mix:1,r.ikConstraints.push(p)}for(var m=t.slots,s=0,a=m.length;a>s;s++){var y=m[s],u=r.findBone(y.bone);if(!u)throw"Slot bone not found: "+y.bone;var x=new i.SlotData(y.name,u),b=y.color;b&&(x.r=this.toColor(b,0),x.g=this.toColor(b,1),x.b=this.toColor(b,2),x.a=this.toColor(b,3)),x.attachmentName=y.attachment,x.additiveBlending=y.additive&&"true"==y.additive,r.slots.push(x)}var T=t.skins;for(var _ in T)if(T.hasOwnProperty(_)){var E=T[_],w=new i.Skin(_);for(var S in E)if(E.hasOwnProperty(S)){var A=r.findSlotIndex(S),C=E[S];for(var M in C)if(C.hasOwnProperty(M)){var R=this.readAttachment(w,M,C[M]);R&&w.addAttachment(A,M,R)}}r.skins.push(w),"default"==w.name&&(r.defaultSkin=w)}var F=t.events;for(var D in F)if(F.hasOwnProperty(D)){var O=F[D],P=new i.EventData(D);P.intValue=O["int"]||0,P.floatValue=O["float"]||0,P.stringValue=O.string||null,r.events.push(P)}var B=t.animations;for(var L in B)B.hasOwnProperty(L)&&this.readAnimation(L,B[L],r);return r},readAttachment:function(t,e,r){e=r.name||e;var n=i.AttachmentType[r.type||"region"],o=r.path||e,s=this.scale;if(n==i.AttachmentType.region){var a=this.attachmentLoader.newRegionAttachment(t,e,o);if(!a)return null;a.path=o,a.x=(r.x||0)*s,a.y=(r.y||0)*s,a.scaleX=r.hasOwnProperty("scaleX")?r.scaleX:1,a.scaleY=r.hasOwnProperty("scaleY")?r.scaleY:1,a.rotation=r.rotation||0,a.width=(r.width||0)*s,a.height=(r.height||0)*s;var h=r.color;return h&&(a.r=this.toColor(h,0),a.g=this.toColor(h,1),a.b=this.toColor(h,2),a.a=this.toColor(h,3)),a.updateOffset(),a}if(n==i.AttachmentType.mesh){var l=this.attachmentLoader.newMeshAttachment(t,e,o);return l?(l.path=o,l.vertices=this.getFloatArray(r,"vertices",s),l.triangles=this.getIntArray(r,"triangles"),l.regionUVs=this.getFloatArray(r,"uvs",1),l.updateUVs(),h=r.color,h&&(l.r=this.toColor(h,0),l.g=this.toColor(h,1),l.b=this.toColor(h,2),l.a=this.toColor(h,3)),l.hullLength=2*(r.hull||0),r.edges&&(l.edges=this.getIntArray(r,"edges")),l.width=(r.width||0)*s,l.height=(r.height||0)*s,l):null}if(n==i.AttachmentType.skinnedmesh){var l=this.attachmentLoader.newSkinnedMeshAttachment(t,e,o);if(!l)return null;l.path=o;for(var u=this.getFloatArray(r,"uvs",1),c=this.getFloatArray(r,"vertices",1),d=[],p=[],f=0,g=c.length;g>f;){var v=0|c[f++];p[p.length]=v;for(var m=f+4*v;m>f;)p[p.length]=c[f],d[d.length]=c[f+1]*s,d[d.length]=c[f+2]*s,d[d.length]=c[f+3],f+=4}return l.bones=p,l.weights=d,l.triangles=this.getIntArray(r,"triangles"),l.regionUVs=u,l.updateUVs(),h=r.color,h&&(l.r=this.toColor(h,0),l.g=this.toColor(h,1),l.b=this.toColor(h,2),l.a=this.toColor(h,3)),l.hullLength=2*(r.hull||0),r.edges&&(l.edges=this.getIntArray(r,"edges")),l.width=(r.width||0)*s,l.height=(r.height||0)*s,l}if(n==i.AttachmentType.boundingbox){for(var y=this.attachmentLoader.newBoundingBoxAttachment(t,e),c=r.vertices,f=0,g=c.length;g>f;f++)y.vertices.push(c[f]*s);return y}throw"Unknown attachment type: "+n},readAnimation:function(t,e,r){var n=[],o=0,s=e.slots;for(var a in s)if(s.hasOwnProperty(a)){var h=s[a],l=r.findSlotIndex(a);for(var u in h)if(h.hasOwnProperty(u)){var c=h[u];if("color"==u){var d=new i.ColorTimeline(c.length);d.slotIndex=l;for(var p=0,f=0,g=c.length;g>f;f++){var v=c[f],m=v.color,y=this.toColor(m,0),x=this.toColor(m,1),b=this.toColor(m,2),T=this.toColor(m,3);d.setFrame(p,v.time,y,x,b,T),this.readCurve(d,p,v),p++}n.push(d),o=Math.max(o,d.frames[5*d.getFrameCount()-5])}else{if("attachment"!=u)throw"Invalid timeline type for a slot: "+u+" ("+a+")";var d=new i.AttachmentTimeline(c.length);d.slotIndex=l;for(var p=0,f=0,g=c.length;g>f;f++){var v=c[f];d.setFrame(p++,v.time,v.name)}n.push(d),o=Math.max(o,d.frames[d.getFrameCount()-1])}}}var _=e.bones;for(var E in _)if(_.hasOwnProperty(E)){var w=r.findBoneIndex(E);if(-1==w)throw"Bone not found: "+E;var S=_[E];for(var u in S)if(S.hasOwnProperty(u)){var c=S[u];if("rotate"==u){var d=new i.RotateTimeline(c.length);d.boneIndex=w;for(var p=0,f=0,g=c.length;g>f;f++){var v=c[f];d.setFrame(p,v.time,v.angle),this.readCurve(d,p,v),p++}n.push(d),o=Math.max(o,d.frames[2*d.getFrameCount()-2])}else if("translate"==u||"scale"==u){var d,A=1;"scale"==u?d=new i.ScaleTimeline(c.length):(d=new i.TranslateTimeline(c.length),A=this.scale),d.boneIndex=w;for(var p=0,f=0,g=c.length;g>f;f++){var v=c[f],C=(v.x||0)*A,M=(v.y||0)*A;d.setFrame(p,v.time,C,M),this.readCurve(d,p,v),p++}n.push(d),o=Math.max(o,d.frames[3*d.getFrameCount()-3])}else{if("flipX"!=u&&"flipY"!=u)throw"Invalid timeline type for a bone: "+u+" ("+E+")";var C="flipX"==u,d=C?new i.FlipXTimeline(c.length):new i.FlipYTimeline(c.length);d.boneIndex=w;for(var R=C?"x":"y",p=0,f=0,g=c.length;g>f;f++){var v=c[f];d.setFrame(p,v.time,v[R]||!1),p++}n.push(d),o=Math.max(o,d.frames[2*d.getFrameCount()-2])}}}var F=e.ik;for(var D in F)if(F.hasOwnProperty(D)){var O=r.findIkConstraint(D),c=F[D],d=new i.IkConstraintTimeline(c.length);d.ikConstraintIndex=r.ikConstraints.indexOf(O);for(var p=0,f=0,g=c.length;g>f;f++){var v=c[f],P=v.hasOwnProperty("mix")?v.mix:1,B=!v.hasOwnProperty("bendPositive")||v.bendPositive?1:-1;d.setFrame(p,v.time,P,B),this.readCurve(d,p,v),p++}n.push(d),o=Math.max(o,d.frames[3*d.frameCount-3])}var L=e.ffd;for(var I in L){var N=r.findSkin(I),h=L[I];for(a in h){var l=r.findSlotIndex(a),k=h[a];for(var U in k){var c=k[U],d=new i.FfdTimeline(c.length),j=N.getAttachment(l,U);if(!j)throw"FFD attachment not found: "+U;d.slotIndex=l,d.attachment=j;var X,Y=j.type==i.AttachmentType.mesh;X=Y?j.vertices.length:j.weights.length/3*2;for(var p=0,f=0,g=c.length;g>f;f++){var W,v=c[f];if(v.vertices){var G=v.vertices,W=[];W.length=X;var z=v.offset||0,H=G.length;if(1==this.scale)for(var V=0;H>V;V++)W[V+z]=G[V];else for(var V=0;H>V;V++)W[V+z]=G[V]*this.scale;if(Y)for(var q=j.vertices,V=0,H=W.length;H>V;V++)W[V]+=q[V]}else Y?W=j.vertices:(W=[],W.length=X);d.setFrame(p,v.time,W),this.readCurve(d,p,v),p++}n[n.length]=d,o=Math.max(o,d.frames[d.frameCount-1])}}}var K=e.drawOrder;if(K||(K=e.draworder),K){for(var d=new i.DrawOrderTimeline(K.length),Q=r.slots.length,p=0,f=0,g=K.length;g>f;f++){var J=K[f],Z=null;if(J.offsets){Z=[],Z.length=Q;for(var V=Q-1;V>=0;V--)Z[V]=-1;var $=J.offsets,te=[];te.length=Q-$.length;for(var ee=0,re=0,V=0,H=$.length;H>V;V++){var ie=$[V],l=r.findSlotIndex(ie.slot);if(-1==l)throw"Slot not found: "+ie.slot;for(;ee!=l;)te[re++]=ee++;Z[ee+ie.offset]=ee++}for(;Q>ee;)te[re++]=ee++;for(var V=Q-1;V>=0;V--)-1==Z[V]&&(Z[V]=te[--re])}d.setFrame(p++,J.time,Z)}n.push(d),o=Math.max(o,d.frames[d.getFrameCount()-1])}var ne=e.events;if(ne){for(var d=new i.EventTimeline(ne.length),p=0,f=0,g=ne.length;g>f;f++){var oe=ne[f],se=r.findEvent(oe.name);if(!se)throw"Event not found: "+oe.name;var ae=new i.Event(se);ae.intValue=oe.hasOwnProperty("int")?oe["int"]:se.intValue,ae.floatValue=oe.hasOwnProperty("float")?oe["float"]:se.floatValue,ae.stringValue=oe.hasOwnProperty("string")?oe.string:se.stringValue,d.setFrame(p++,oe.time,ae)}n.push(d),o=Math.max(o,d.frames[d.getFrameCount()-1])}r.animations.push(new i.Animation(t,n,o))},readCurve:function(t,e,r){var i=r.curve;i?"stepped"==i?t.curves.setStepped(e):i instanceof Array&&t.curves.setCurve(e,i[0],i[1],i[2],i[3]):t.curves.setLinear(e)},toColor:function(t,e){if(8!=t.length)throw"Color hexidecimal length must be 8, recieved: "+t;return parseInt(t.substring(2*e,2*e+2),16)/255},getFloatArray:function(t,e,r){var n=t[e],o=new i.Float32Array(n.length),s=0,a=n.length;if(1==r)for(;a>s;s++)o[s]=n[s];else for(;a>s;s++)o[s]=n[s]*r;return o},getIntArray:function(t,e){for(var r=t[e],n=new i.Uint16Array(r.length),o=0,s=r.length;s>o;o++)n[o]=0|r[o];return n}},i.Atlas=function(t,e,n){e&&e.indexOf("/")!==e.length&&(e+="/"),this.pages=[],this.regions=[],this.texturesLoading=0;var o=new i.AtlasReader(t),s=[];s.length=4;for(var a=null;;){var h=o.readLine();if(null===h)break;if(h=o.trim(h),h.length)if(a){var l=new i.AtlasRegion;l.name=h,l.page=a,l.rotate="true"==o.readValue(),o.readTuple(s);var u=parseInt(s[0]),c=parseInt(s[1]);o.readTuple(s);var d=parseInt(s[0]),p=parseInt(s[1]);l.u=u/a.width,l.v=c/a.height,l.rotate?(l.u2=(u+p)/a.width,l.v2=(c+d)/a.height):(l.u2=(u+d)/a.width,l.v2=(c+p)/a.height),l.x=u,l.y=c,l.width=Math.abs(d),l.height=Math.abs(p),4==o.readTuple(s)&&(l.splits=[parseInt(s[0]),parseInt(s[1]),parseInt(s[2]),parseInt(s[3])],4==o.readTuple(s)&&(l.pads=[parseInt(s[0]),parseInt(s[1]),parseInt(s[2]),parseInt(s[3])],o.readTuple(s))),l.originalWidth=parseInt(s[0]),l.originalHeight=parseInt(s[1]),o.readTuple(s),l.offsetX=parseInt(s[0]),l.offsetY=parseInt(s[1]),l.index=parseInt(o.readValue()),this.regions.push(l)}else{a=new i.AtlasPage,a.name=h,2==o.readTuple(s)&&(a.width=parseInt(s[0]),a.height=parseInt(s[1]),o.readTuple(s)),a.format=i.Atlas.Format[s[0]],o.readTuple(s),a.minFilter=i.Atlas.TextureFilter[s[0]],a.magFilter=i.Atlas.TextureFilter[s[1]];var f=o.readValue();a.uWrap=i.Atlas.TextureWrap.clampToEdge,a.vWrap=i.Atlas.TextureWrap.clampToEdge,"x"==f?a.uWrap=i.Atlas.TextureWrap.repeat:"y"==f?a.vWrap=i.Atlas.TextureWrap.repeat:"xy"==f&&(a.uWrap=a.vWrap=i.Atlas.TextureWrap.repeat),a.rendererObject=r.BaseTexture.fromImage(e+h,n),this.pages.push(a)}else a=null}},i.Atlas.prototype={findRegion:function(t){for(var e=this.regions,r=0,i=e.length;i>r;r++)if(e[r].name==t)return e[r];return null},dispose:function(){for(var t=this.pages,e=0,r=t.length;r>e;e++)t[e].rendererObject.destroy(!0)},updateUVs:function(t){for(var e=this.regions,r=0,i=e.length;i>r;r++){var n=e[r];n.page==t&&(n.u=n.x/t.width,n.v=n.y/t.height,n.rotate?(n.u2=(n.x+n.height)/t.width,n.v2=(n.y+n.width)/t.height):(n.u2=(n.x+n.width)/t.width,n.v2=(n.y+n.height)/t.height))}}},i.Atlas.Format={alpha:0,intensity:1,luminanceAlpha:2,rgb565:3,rgba4444:4,rgb888:5,rgba8888:6},i.Atlas.TextureFilter={nearest:0,linear:1,mipMap:2,mipMapNearestNearest:3,mipMapLinearNearest:4,mipMapNearestLinear:5,mipMapLinearLinear:6},i.Atlas.TextureWrap={mirroredRepeat:0,clampToEdge:1,repeat:2},i.AtlasPage=function(){},i.AtlasPage.prototype={name:null,format:null,minFilter:null,magFilter:null,uWrap:null,vWrap:null,rendererObject:null,width:0,height:0},i.AtlasRegion=function(){},i.AtlasRegion.prototype={page:null,name:null,x:0,y:0,width:0,height:0,u:0,v:0,u2:0,v2:0,offsetX:0,offsetY:0,originalWidth:0,originalHeight:0,index:0,rotate:!1,splits:null,pads:null},i.AtlasReader=function(t){this.lines=t.split(/\r\n|\r|\n/)},i.AtlasReader.prototype={index:0,trim:function(t){return t.replace(/^\s+|\s+$/g,"")},readLine:function(){return this.index>=this.lines.length?null:this.lines[this.index++]},readValue:function(){var t=this.readLine(),e=t.indexOf(":");if(-1==e)throw"Invalid line: "+t;return this.trim(t.substring(e+1))},readTuple:function(t){var e=this.readLine(),r=e.indexOf(":");if(-1==r)throw"Invalid line: "+e;for(var i=0,n=r+1;3>i;i++){var o=e.indexOf(",",n);if(-1==o)break;t[i]=this.trim(e.substr(n,o-n)),n=o+1}return t[i]=this.trim(e.substring(n)),i+1}},i.AtlasAttachmentParser=function(t){this.atlas=t},i.AtlasAttachmentParser.prototype={newRegionAttachment:function(t,e,r){var n=this.atlas.findRegion(r);if(!n)throw"Region not found in atlas: "+r+" (region attachment: "+e+")";var o=new i.RegionAttachment(e);return o.rendererObject=n,o.setUVs(n.u,n.v,n.u2,n.v2,n.rotate),o.regionOffsetX=n.offsetX,o.regionOffsetY=n.offsetY,o.regionWidth=n.width,o.regionHeight=n.height,o.regionOriginalWidth=n.originalWidth,o.regionOriginalHeight=n.originalHeight,o},newMeshAttachment:function(t,e,r){var n=this.atlas.findRegion(r);if(!n)throw"Region not found in atlas: "+r+" (mesh attachment: "+e+")";var o=new i.MeshAttachment(e);return o.rendererObject=n,o.regionU=n.u,o.regionV=n.v,o.regionU2=n.u2,o.regionV2=n.v2,o.regionRotate=n.rotate,o.regionOffsetX=n.offsetX,o.regionOffsetY=n.offsetY,o.regionWidth=n.width,o.regionHeight=n.height,o.regionOriginalWidth=n.originalWidth,o.regionOriginalHeight=n.originalHeight,o},newSkinnedMeshAttachment:function(t,e,r){var n=this.atlas.findRegion(r);if(!n)throw"Region not found in atlas: "+r+" (skinned mesh attachment: "+e+")";var o=new i.SkinnedMeshAttachment(e);return o.rendererObject=n,o.regionU=n.u,o.regionV=n.v,o.regionU2=n.u2,o.regionV2=n.v2,o.regionRotate=n.rotate,o.regionOffsetX=n.offsetX,o.regionOffsetY=n.offsetY,o.regionWidth=n.width,o.regionHeight=n.height,o.regionOriginalWidth=n.originalWidth,o.regionOriginalHeight=n.originalHeight,o},newBoundingBoxAttachment:function(t,e){return new i.BoundingBoxAttachment(e)}},i.SkeletonBounds=function(){this.polygonPool=[],this.polygons=[],this.boundingBoxes=[]},i.SkeletonBounds.prototype={minX:0,minY:0,maxX:0,maxY:0,update:function(t,e){var r=t.slots,n=r.length,o=t.x,s=t.y,a=this.boundingBoxes,h=this.polygonPool,l=this.polygons;a.length=0;for(var u=0,c=l.length;c>u;u++)h.push(l[u]);l.length=0;for(var u=0;n>u;u++){var d=r[u],p=d.attachment;if(p.type==i.AttachmentType.boundingbox){a.push(p);var f,g=h.length;g>0?(f=h[g-1],h.splice(g-1,1)):f=[],l.push(f),f.length=p.vertices.length,p.computeWorldVertices(o,s,d.bone,f)}}e&&this.aabbCompute()},aabbCompute:function(){for(var t=this.polygons,e=Number.MAX_VALUE,r=Number.MAX_VALUE,i=Number.MIN_VALUE,n=Number.MIN_VALUE,o=0,s=t.length;s>o;o++)for(var a=t[o],h=0,l=a.length;l>h;h+=2){var u=a[h],c=a[h+1];e=Math.min(e,u),r=Math.min(r,c),i=Math.max(i,u),n=Math.max(n,c)}this.minX=e,this.minY=r,this.maxX=i,this.maxY=n},aabbContainsPoint:function(t,e){return t>=this.minX&&t<=this.maxX&&e>=this.minY&&e<=this.maxY},aabbIntersectsSegment:function(t,e,r,i){var n=this.minX,o=this.minY,s=this.maxX,a=this.maxY;if(n>=t&&n>=r||o>=e&&o>=i||t>=s&&r>=s||e>=a&&i>=a)return!1;var h=(i-e)/(r-t),l=h*(n-t)+e;if(l>o&&a>l)return!0;if(l=h*(s-t)+e,l>o&&a>l)return!0;var u=(o-e)/h+t;return u>n&&s>u?!0:(u=(a-e)/h+t,u>n&&s>u?!0:!1)},aabbIntersectsSkeleton:function(t){return this.minXt.minX&&this.minYt.minY},containsPoint:function(t,e){for(var r=this.polygons,i=0,n=r.length;n>i;i++)if(this.polygonContainsPoint(r[i],t,e))return this.boundingBoxes[i];return null},intersectsSegment:function(t,e,r,i){for(var n=this.polygons,o=0,s=n.length;s>o;o++)if(n[o].intersectsSegment(t,e,r,i))return this.boundingBoxes[o];return null},polygonContainsPoint:function(t,e,r){for(var i=t.length,n=i-2,o=!1,s=0;i>s;s+=2){var a=t[s+1],h=t[n+1];if(r>a&&h>=r||r>h&&a>=r){var l=t[s];l+(r-a)/(h-a)*(t[n]-l)c;c+=2){var d=t[c],p=t[c+1],f=l*p-u*d,g=l-d,v=u-p,m=s*v-a*g,y=(h*g-s*f)/m;if((y>=l&&d>=y||y>=d&&l>=y)&&(y>=e&&i>=y||y>=i&&e>=y)){var x=(h*v-a*f)/m;if((x>=u&&p>=x||x>=p&&u>=x)&&(x>=r&&n>=x||x>=n&&r>=x))return!0}l=d,u=p}return!1},getPolygon:function(t){var e=this.boundingBoxes.indexOf(t);return-1==e?null:this.polygons[e]},getWidth:function(){return this.maxX-this.minX},getHeight:function(){return this.maxY-this.minY}}},{"../core":19}],121:[function(t,e){e.exports={Spine:t("./Spine"),SpineRuntime:t("./SpineRuntime")}},{"./Spine":119,"./SpineRuntime":120}],122:[function(t,e){function r(t,e){i.Container.call(this),this.textWidth=0,this.textHeight=0,this._glyphs=[],this._style={tint:e.tint,align:e.align,fontName:null,fontSize:0},this.font=e.font,this._text=t,this.maxWidth=0,this.dirty=!1,this.updateText()}var i=t("../core");r.prototype=Object.create(i.Container.prototype),r.prototype.constructor=r,e.exports=r,Object.defineProperties(r.prototype,{tint:{get:function(){return this._style.tint},set:function(t){this._style.tint="number"==typeof t&&t>=0?t:16777215,this.dirty=!0}},align:{get:function(){return this._style.align},set:function(t){this._style.align=t,this.dirty=!0}},font:{get:function(){return this._style.font},set:function(t){"string"==typeof t?(t=t.split(" "),this._style.fontName=t.slice(1).join(" "),this._style.fontSize=t.length>=2?parseInt(t[0],10):r.fonts[this.fontName].size):(this._style.fontName=t.name,this._style.fontSize="number"==typeof t.size?t.size:parseInt(t.size,10)),this.dirty=!0}},text:{get:function(){return this._text},set:function(t){this._text=t,this.dirty=!0}}}),r.prototype.updateText=function(){for(var t=r.fonts[this._style.fontName],e=new i.math.Point,n=null,o=[],s=0,a=0,h=[],l=0,u=this._style.fontSize/t.size,c=-1,d=0;d0&&e.x*u>this.maxWidth)o.splice(c,d-c),d=c,c=-1,h.push(s),a=Math.max(a,s),l++,e.x=0,e.y+=t.lineHeight,n=null;else{var f=t.chars[p];f&&(n&&f.kerning[n]&&(e.x+=f.kerning[n]),o.push({texture:f.texture,line:l,charCode:p,position:new i.math.Point(e.x+f.xOffset,e.y+f.yOffset)}),s=e.x+(f.texture.width+f.xOffset),e.x+=f.xAdvance,n=p)}}h.push(s),a=Math.max(a,s);var g=[];for(d=0;l>=d;d++){var v=0;"right"===this._style.align?v=a-h[d]:"center"===this._style.align&&(v=(a-h[d])/2),g.push(v)}var m=o.length,y=this.tint;for(d=0;m>d;d++){var x=this._glyphs[d];x?x.texture=o[d].texture:(x=new i.Sprite(o[d].texture),this._glyphs.push(x)),x.position.x=(o[d].position.x+g[o[d].line])*u,x.position.y=o[d].position.y*u,x.scale.x=x.scale.y=u,x.tint=y,x.parent||this.addChild(x)}for(d=m;dh;h++){for(l=0;d>l;l+=4)if(255!==u[p+l]){f=!0;break}if(f)break;p+=d}for(e.ascent=s-h,p=c-d,f=!1,h=a;h>s;h--){for(l=0;d>l;l+=4)if(255!==u[p+l]){f=!0;break}if(f)break;p-=d}e.descent=h-s,e.fontSize=e.ascent+e.descent,r.fontPropertiesCache[t]=e}return e},r.prototype.wordWrap=function(t){for(var e="",r=t.split("\n"),i=this._style.wordWrapWidth,n=0;no?(a>0&&(e+="\n"),e+=s[a],o=i-h):(o-=l,e+=" "+s[a])}ne;e++){var o=this.skeleton.drawOrder[e],s=o.attachment,a=new i.Container;if(this.slotContainers.push(a),this.addChild(a),s instanceof n.RegionAttachment){var h=s.rendererObject.name,l=this.createSprite(o,s);o.currentSprite=l,o.currentSpriteName=h,a.addChild(l)}else{if(!(s instanceof n.MeshAttachment))continue;var u=this.createMesh(o,s);o.currentMesh=u,o.currentMeshName=s.name,a.addChild(u)}}this.autoUpdate=!0}var i=t("../core"),n=t("./SpineRuntime");n.Bone.yDown=!0,r.prototype=Object.create(i.Container.prototype),r.prototype.constructor=r,e.exports=r,Object.defineProperties(r.prototype,{autoUpdate:{get:function(){return this.updateTransform===r.prototype.autoUpdateTransform},set:function(t){this.updateTransform=t?r.prototype.autoUpdateTransform:i.Container.prototype.updateTransform}}}),r.prototype.update=function(t){this.state.update(t),this.state.apply(this.skeleton),this.skeleton.updateWorldTransform();for(var e=this.skeleton.drawOrder,r=0,o=e.length;o>r;r++){var s=e[r],a=s.attachment,h=this.slotContainers[r];if(a){var l=a.type;if(l===n.AttachmentType.region){if(a.rendererObject&&(!s.currentSpriteName||s.currentSpriteName!==a.rendererObject.name)){var u=a.rendererObject.name;if(void 0!==s.currentSprite&&(s.currentSprite.visible=!1),s.sprites=s.sprites||{},void 0!==s.sprites[u])s.sprites[u].visible=!0;else{var c=this.createSprite(s,a);h.addChild(c)}s.currentSprite=s.sprites[u],s.currentSpriteName=u}var d=s.bone;h.position.x=d.worldX+a.x*d.m00+a.y*d.m01,h.position.y=d.worldY+a.x*d.m10+a.y*d.m11,h.scale.x=d.worldScaleX,h.scale.y=d.worldScaleY,h.rotation=-(s.bone.worldRotation*n.degRad),s.currentSprite.tint=i.utils.rgb2hex([s.r,s.g,s.b])}else{if(l!==n.AttachmentType.skinnedmesh){h.visible=!1;continue}if(!s.currentMeshName||s.currentMeshName!==a.name){var p=a.name;if(void 0!==s.currentMesh&&(s.currentMesh.visible=!1),s.meshes=s.meshes||{},void 0!==s.meshes[p])s.meshes[p].visible=!0;else{var f=this.createMesh(s,a);h.addChild(f)}s.currentMesh=s.meshes[p],s.currentMeshName=p}a.computeWorldVertices(s.bone.skeleton.x,s.bone.skeleton.y,s,s.currentMesh.vertices)}h.visible=!0,h.alpha=s.a}else h.visible=!1}},r.prototype.autoUpdateTransform=function(){this.lastTime=this.lastTime||Date.now();var t=.001*(Date.now()-this.lastTime);this.lastTime=Date.now(),this.update(t),i.Container.prototype.updateTransform.call(this)},r.prototype.createSprite=function(t,e){var r=e.rendererObject,o=r.page.rendererObject,s=new i.math.Rectangle(r.x,r.y,r.rotate?r.height:r.width,r.rotate?r.width:r.height),a=new i.Texture(o,s),h=new i.Sprite(a),l=r.rotate?.5*Math.PI:0;return h.scale.set(r.width/r.originalWidth,r.height/r.originalHeight),h.rotation=l-e.rotation*n.degRad,h.anchor.x=h.anchor.y=.5,t.sprites=t.sprites||{},t.sprites[r.name]=h,h},r.prototype.createMesh=function(t,e){var r=e.rendererObject,n=r.page.rendererObject,o=new i.Texture(n),s=new i.Strip(o);return s.drawMode=i.Strip.DRAW_MODES.TRIANGLES,s.canvasPadding=1.5,s.vertices=new Float32Array(e.uvs.length),s.uvs=e.uvs,s.indices=e.triangles,t.meshes=t.meshes||{},t.meshes[e.name]=s,s}},{"../core":19,"./SpineRuntime":120}],120:[function(t,e){var r=t("../core"),i=e.exports={radDeg:180/Math.PI,degRad:Math.PI/180,temp:[],Float32Array:"undefined"==typeof Float32Array?Array:Float32Array,Uint16Array:"undefined"==typeof Uint16Array?Array:Uint16Array};i.BoneData=function(t,e){this.name=t,this.parent=e},i.BoneData.prototype={length:0,x:0,y:0,rotation:0,scaleX:1,scaleY:1,inheritScale:!0,inheritRotation:!0,flipX:!1,flipY:!1},i.SlotData=function(t,e){this.name=t,this.boneData=e},i.SlotData.prototype={r:1,g:1,b:1,a:1,attachmentName:null,additiveBlending:!1},i.IkConstraintData=function(t){this.name=t,this.bones=[]},i.IkConstraintData.prototype={target:null,bendDirection:1,mix:1},i.Bone=function(t,e,r){this.data=t,this.skeleton=e,this.parent=r,this.setToSetupPose()},i.Bone.yDown=!1,i.Bone.prototype={x:0,y:0,rotation:0,rotationIK:0,scaleX:1,scaleY:1,flipX:!1,flipY:!1,m00:0,m01:0,worldX:0,m10:0,m11:0,worldY:0,worldRotation:0,worldScaleX:1,worldScaleY:1,worldFlipX:!1,worldFlipY:!1,updateWorldTransform:function(){var t=this.parent;if(t)this.worldX=this.x*t.m00+this.y*t.m01+t.worldX,this.worldY=this.x*t.m10+this.y*t.m11+t.worldY,this.data.inheritScale?(this.worldScaleX=t.worldScaleX*this.scaleX,this.worldScaleY=t.worldScaleY*this.scaleY):(this.worldScaleX=this.scaleX,this.worldScaleY=this.scaleY),this.worldRotation=this.data.inheritRotation?t.worldRotation+this.rotationIK:this.rotationIK,this.worldFlipX=t.worldFlipX!=this.flipX,this.worldFlipY=t.worldFlipY!=this.flipY;else{var e=this.skeleton.flipX,r=this.skeleton.flipY;this.worldX=e?-this.x:this.x,this.worldY=r!=i.Bone.yDown?-this.y:this.y,this.worldScaleX=this.scaleX,this.worldScaleY=this.scaleY,this.worldRotation=this.rotationIK,this.worldFlipX=e!=this.flipX,this.worldFlipY=r!=this.flipY}var n=this.worldRotation*i.degRad,o=Math.cos(n),s=Math.sin(n);this.worldFlipX?(this.m00=-o*this.worldScaleX,this.m01=s*this.worldScaleY):(this.m00=o*this.worldScaleX,this.m01=-s*this.worldScaleY),this.worldFlipY!=i.Bone.yDown?(this.m10=-s*this.worldScaleX,this.m11=-o*this.worldScaleY):(this.m10=s*this.worldScaleX,this.m11=o*this.worldScaleY)},setToSetupPose:function(){var t=this.data;this.x=t.x,this.y=t.y,this.rotation=t.rotation,this.rotationIK=this.rotation,this.scaleX=t.scaleX,this.scaleY=t.scaleY,this.flipX=t.flipX,this.flipY=t.flipY},worldToLocal:function(t){var e=t[0]-this.worldX,r=t[1]-this.worldY,n=this.m00,o=this.m10,s=this.m01,a=this.m11;this.worldFlipX!=(this.worldFlipY!=i.Bone.yDown)&&(n=-n,a=-a);var h=1/(n*a-s*o);t[0]=e*n*h-r*s*h,t[1]=r*a*h-e*o*h},localToWorld:function(t){var e=t[0],r=t[1];t[0]=e*this.m00+r*this.m01+this.worldX,t[1]=e*this.m10+r*this.m11+this.worldY}},i.Slot=function(t,e){this.data=t,this.bone=e,this.setToSetupPose()},i.Slot.prototype={r:1,g:1,b:1,a:1,_attachmentTime:0,attachment:null,attachmentVertices:[],setAttachment:function(t){this.attachment=t,this._attachmentTime=this.bone.skeleton.time,this.attachmentVertices.length=0},setAttachmentTime:function(t){this._attachmentTime=this.bone.skeleton.time-t},getAttachmentTime:function(){return this.bone.skeleton.time-this._attachmentTime},setToSetupPose:function(){var t=this.data;this.r=t.r,this.g=t.g,this.b=t.b,this.a=t.a;for(var e=this.bone.skeleton.data.slots,r=0,i=e.length;i>r;r++)if(e[r]==t){this.setAttachment(t.attachmentName?this.bone.skeleton.getAttachmentBySlotIndex(r,t.attachmentName):null);break}}},i.IkConstraint=function(t,e){this.data=t,this.mix=t.mix,this.bendDirection=t.bendDirection,this.bones=[];for(var r=0,i=t.bones.length;i>r;r++)this.bones.push(e.findBone(t.bones[r].name));this.target=e.findBone(t.target.name)},i.IkConstraint.prototype={apply:function(){var t=this.target,e=this.bones;switch(e.length){case 1:i.IkConstraint.apply1(e[0],t.worldX,t.worldY,this.mix);break;case 2:i.IkConstraint.apply2(e[0],e[1],t.worldX,t.worldY,this.bendDirection,this.mix)}}},i.IkConstraint.apply1=function(t,e,r,n){var o=t.data.inheritRotation&&t.parent?t.parent.worldRotation:0,s=t.rotation,a=Math.atan2(r-t.worldY,e-t.worldX)*i.radDeg-o;t.rotationIK=s+(a-s)*n},i.IkConstraint.apply2=function(t,e,r,n,o,s){var a=e.rotation,h=t.rotation;if(!s)return e.rotationIK=a,void(t.rotationIK=h);var l,u,c=i.temp,d=t.parent;d?(c[0]=r,c[1]=n,d.worldToLocal(c),r=(c[0]-t.x)*d.worldScaleX,n=(c[1]-t.y)*d.worldScaleY):(r-=t.x,n-=t.y),e.parent==t?(l=e.x,u=e.y):(c[0]=e.x,c[1]=e.y,e.parent.localToWorld(c),t.worldToLocal(c),l=c[0],u=c[1]);var p=l*t.worldScaleX,f=u*t.worldScaleY,g=Math.atan2(f,p),v=Math.sqrt(p*p+f*f),m=e.data.length*e.worldScaleX,y=2*v*m;if(1e-4>y)return void(e.rotationIK=a+(Math.atan2(n,r)*i.radDeg-h-a)*s);var x=(r*r+n*n-v*v-m*m)/y;-1>x?x=-1:x>1&&(x=1);var b=Math.acos(x)*o,T=v+m*x,_=m*Math.sin(b),E=Math.atan2(n*T-r*_,r*T+n*_),w=(E-g)*i.radDeg-h;w>180?w-=360:-180>w&&(w+=360),t.rotationIK=h+w*s,w=(b+g)*i.radDeg-a,w>180?w-=360:-180>w&&(w+=360),e.rotationIK=a+(w+t.worldRotation-e.parent.worldRotation)*s},i.Skin=function(t){this.name=t,this.attachments={}},i.Skin.prototype={addAttachment:function(t,e,r){this.attachments[t+":"+e]=r},getAttachment:function(t,e){return this.attachments[t+":"+e]},_attachAll:function(t,e){for(var r in e.attachments){var i=r.indexOf(":"),n=parseInt(r.substring(0,i)),o=r.substring(i+1),s=t.slots[n];if(s.attachment&&s.attachment.name==o){var a=this.getAttachment(n,o);a&&s.setAttachment(a)}}}},i.Animation=function(t,e,r){this.name=t,this.timelines=e,this.duration=r},i.Animation.prototype={apply:function(t,e,r,i,n){i&&0!=this.duration&&(r%=this.duration,e%=this.duration);for(var o=this.timelines,s=0,a=o.length;a>s;s++)o[s].apply(t,e,r,n,1)},mix:function(t,e,r,i,n,o){i&&0!=this.duration&&(r%=this.duration,e%=this.duration);for(var s=this.timelines,a=0,h=s.length;h>a;a++)s[a].apply(t,e,r,n,o)}},i.Animation.binarySearch=function(t,e,r){var i=0,n=Math.floor(t.length/r)-2;if(!n)return r;for(var o=n>>>1;;){if(t[(o+1)*r]<=e?i=o+1:n=o,i==n)return(i+1)*r;o=i+n>>>1}},i.Animation.binarySearch1=function(t,e){var r=0,i=t.length-2;if(!i)return 1;for(var n=i>>>1;;){if(t[n+1]<=e?r=n+1:i=n,r==i)return r+1;n=r+i>>>1}},i.Animation.linearSearch=function(t,e,r){for(var i=0,n=t.length-r;n>=i;i+=r)if(t[i]>e)return i;return-1},i.Curves=function(){this.curves=[]},i.Curves.prototype={setLinear:function(t){this.curves[19*t]=0},setStepped:function(t){this.curves[19*t]=1},setCurve:function(t,e,r,i,n){var o=.1,s=o*o,a=s*o,h=3*o,l=3*s,u=6*s,c=6*a,d=2*-e+i,p=2*-r+n,f=3*(e-i)+1,g=3*(r-n)+1,v=e*h+d*l+f*a,m=r*h+p*l+g*a,y=d*u+f*c,x=p*u+g*c,b=f*c,T=g*c,_=19*t,E=this.curves;E[_++]=2;for(var w=v,S=m,A=_+19-1;A>_;_+=2)E[_]=w,E[_+1]=S,v+=y,m+=x,y+=b,x+=T,w+=v,S+=m},getCurvePercent:function(t,e){e=0>e?0:e>1?1:e;var r=this.curves,i=19*t,n=r[i];if(0===n)return e;if(1==n)return 0;i++;for(var o=0,s=i,a=i+19-1;a>i;i+=2)if(o=r[i],o>=e){var h,l;return i==s?(h=0,l=0):(h=r[i-2],l=r[i-1]),l+(r[i+1]-l)*(e-h)/(o-h)}var u=r[i-1];return u+(1-u)*(e-o)/(1-o)}},i.RotateTimeline=function(t){this.curves=new i.Curves(t),this.frames=[],this.frames.length=2*t},i.RotateTimeline.prototype={boneIndex:0,getFrameCount:function(){return this.frames.length/2},setFrame:function(t,e,r){t*=2,this.frames[t]=e,this.frames[t+1]=r},apply:function(t,e,r,n,o){var s=this.frames;if(!(r=s[s.length-2]){for(var h=a.data.rotation+s[s.length-1]-a.rotation;h>180;)h-=360;for(;-180>h;)h+=360;return void(a.rotation+=h*o)}var l=i.Animation.binarySearch(s,r,2),u=s[l-1],c=s[l],d=1-(r-c)/(s[l-2]-c);d=this.curves.getCurvePercent(l/2-1,d);for(var h=s[l+1]-u;h>180;)h-=360;for(;-180>h;)h+=360;for(h=a.data.rotation+(u+h*d)-a.rotation;h>180;)h-=360;for(;-180>h;)h+=360;a.rotation+=h*o}}},i.TranslateTimeline=function(t){this.curves=new i.Curves(t),this.frames=[],this.frames.length=3*t},i.TranslateTimeline.prototype={boneIndex:0,getFrameCount:function(){return this.frames.length/3},setFrame:function(t,e,r,i){t*=3,this.frames[t]=e,this.frames[t+1]=r,this.frames[t+2]=i},apply:function(t,e,r,n,o){var s=this.frames;if(!(r=s[s.length-3])return a.x+=(a.data.x+s[s.length-2]-a.x)*o,void(a.y+=(a.data.y+s[s.length-1]-a.y)*o);var h=i.Animation.binarySearch(s,r,3),l=s[h-2],u=s[h-1],c=s[h],d=1-(r-c)/(s[h+-3]-c);d=this.curves.getCurvePercent(h/3-1,d),a.x+=(a.data.x+l+(s[h+1]-l)*d-a.x)*o,a.y+=(a.data.y+u+(s[h+2]-u)*d-a.y)*o}}},i.ScaleTimeline=function(t){this.curves=new i.Curves(t),this.frames=[],this.frames.length=3*t},i.ScaleTimeline.prototype={boneIndex:0,getFrameCount:function(){return this.frames.length/3},setFrame:function(t,e,r,i){t*=3,this.frames[t]=e,this.frames[t+1]=r,this.frames[t+2]=i},apply:function(t,e,r,n,o){var s=this.frames;if(!(r=s[s.length-3])return a.scaleX+=(a.data.scaleX*s[s.length-2]-a.scaleX)*o,void(a.scaleY+=(a.data.scaleY*s[s.length-1]-a.scaleY)*o);var h=i.Animation.binarySearch(s,r,3),l=s[h-2],u=s[h-1],c=s[h],d=1-(r-c)/(s[h+-3]-c);d=this.curves.getCurvePercent(h/3-1,d),a.scaleX+=(a.data.scaleX*(l+(s[h+1]-l)*d)-a.scaleX)*o,a.scaleY+=(a.data.scaleY*(u+(s[h+2]-u)*d)-a.scaleY)*o}}},i.ColorTimeline=function(t){this.curves=new i.Curves(t),this.frames=[],this.frames.length=5*t},i.ColorTimeline.prototype={slotIndex:0,getFrameCount:function(){return this.frames.length/5},setFrame:function(t,e,r,i,n,o){t*=5,this.frames[t]=e,this.frames[t+1]=r,this.frames[t+2]=i,this.frames[t+3]=n,this.frames[t+4]=o},apply:function(t,e,r,n,o){var s=this.frames;if(!(r=s[s.length-5]){var c=s.length-1;a=s[c-3],h=s[c-2],l=s[c-1],u=s[c]}else{var d=i.Animation.binarySearch(s,r,5),p=s[d-4],f=s[d-3],g=s[d-2],v=s[d-1],m=s[d],y=1-(r-m)/(s[d-5]-m);y=this.curves.getCurvePercent(d/5-1,y),a=p+(s[d+1]-p)*y,h=f+(s[d+2]-f)*y,l=g+(s[d+3]-g)*y,u=v+(s[d+4]-v)*y}var x=t.slots[this.slotIndex];1>o?(x.r+=(a-x.r)*o,x.g+=(h-x.g)*o,x.b+=(l-x.b)*o,x.a+=(u-x.a)*o):(x.r=a,x.g=h,x.b=l,x.a=u)}}},i.AttachmentTimeline=function(t){this.curves=new i.Curves(t),this.frames=[],this.frames.length=t,this.attachmentNames=[],this.attachmentNames.length=t},i.AttachmentTimeline.prototype={slotIndex:0,getFrameCount:function(){return this.frames.length},setFrame:function(t,e,r){this.frames[t]=e,this.attachmentNames[t]=r},apply:function(t,e,r){var n=this.frames;if(rr&&this.apply(t,e,Number.MAX_VALUE,null,0));e>r&&(e=-1);var o=r>=n[n.length-1]?n.length-1:i.Animation.binarySearch1(n,r)-1;if(!(n[o]r)this.apply(t,e,Number.MAX_VALUE,n,o),e=-1;else if(e>=s[a-1])return;if(!(r0&&s[h-1]==l;)h--}for(var u=this.events;a>h&&r>=s[h];h++)n.push(u[h])}}}},i.DrawOrderTimeline=function(t){this.frames=[],this.frames.length=t,this.drawOrders=[],this.drawOrders.length=t},i.DrawOrderTimeline.prototype={getFrameCount:function(){return this.frames.length},setFrame:function(t,e,r){this.frames[t]=e,this.drawOrders[t]=r},apply:function(t,e,r){var n=this.frames;if(!(r=n[n.length-1]?n.length-1:i.Animation.binarySearch1(n,r)-1;var s=t.drawOrder,a=t.slots,h=this.drawOrders[o];if(h)for(var l=0,u=h.length;u>l;l++)s[l]=t.slots[h[l]];else for(var l=0,u=a.length;u>l;l++)s[l]=a[l]}}},i.FfdTimeline=function(t){this.curves=new i.Curves(t),this.frames=[],this.frames.length=t,this.frameVertices=[],this.frameVertices.length=t},i.FfdTimeline.prototype={slotIndex:0,attachment:0,getFrameCount:function(){return this.frames.length},setFrame:function(t,e,r){this.frames[t]=e,this.frameVertices[t]=r},apply:function(t,e,r,n,o){var s=t.slots[this.slotIndex];if(s.attachment==this.attachment){var a=this.frames;if(!(r=a[a.length-1]){var c=h[a.length-1];if(1>o)for(var d=0;l>d;d++)u[d]+=(c[d]-u[d])*o;else for(var d=0;l>d;d++)u[d]=c[d]}else{var p=i.Animation.binarySearch1(a,r),f=a[p],g=1-(r-f)/(a[p-1]-f);g=this.curves.getCurvePercent(p-1,0>g?0:g>1?1:g);var v=h[p-1],m=h[p];if(1>o)for(var d=0;l>d;d++){var y=v[d];u[d]+=(y+(m[d]-y)*g-u[d])*o}else for(var d=0;l>d;d++){var y=v[d];u[d]=y+(m[d]-y)*g}}}}}},i.IkConstraintTimeline=function(t){this.curves=new i.Curves(t),this.frames=[],this.frames.length=3*t},i.IkConstraintTimeline.prototype={ikConstraintIndex:0,getFrameCount:function(){return this.frames.length/3},setFrame:function(t,e,r,i){t*=3,this.frames[t]=e,this.frames[t+1]=r,this.frames[t+2]=i},apply:function(t,e,r,n,o){var s=this.frames;if(!(r=s[s.length-3])return a.mix+=(s[s.length-2]-a.mix)*o,void(a.bendDirection=s[s.length-1]);var h=i.Animation.binarySearch(s,r,3),l=s[h+-2],u=s[h],c=1-(r-u)/(s[h+-3]-u);c=this.curves.getCurvePercent(h/3-1,c);var d=l+(s[h+1]-l)*c;a.mix+=(d-a.mix)*o,a.bendDirection=s[h+-1]}}},i.FlipXTimeline=function(t){this.curves=new i.Curves(t),this.frames=[],this.frames.length=2*t},i.FlipXTimeline.prototype={boneIndex:0,getFrameCount:function(){return this.frames.length/2},setFrame:function(t,e,r){t*=2,this.frames[t]=e,this.frames[t+1]=r?1:0},apply:function(t,e,r){var n=this.frames;if(rr&&this.apply(t,e,Number.MAX_VALUE,null,0));e>r&&(e=-1);var o=(r>=n[n.length-2]?n.length:i.Animation.binarySearch(n,r,2))-2;n[o]r&&this.apply(t,e,Number.MAX_VALUE,null,0));e>r&&(e=-1);var o=(r>=n[n.length-2]?n.length:i.Animation.binarySearch(n,r,2))-2;n[o]r;r++)if(e[r].name==t)return e[r];return null},findBoneIndex:function(t){for(var e=this.bones,r=0,i=e.length;i>r;r++)if(e[r].name==t)return r;return-1},findSlot:function(t){for(var e=this.slots,r=0,i=e.length;i>r;r++)if(e[r].name==t)return slot[r];return null},findSlotIndex:function(t){for(var e=this.slots,r=0,i=e.length;i>r;r++)if(e[r].name==t)return r;return-1},findSkin:function(t){for(var e=this.skins,r=0,i=e.length;i>r;r++)if(e[r].name==t)return e[r];return null},findEvent:function(t){for(var e=this.events,r=0,i=e.length;i>r;r++)if(e[r].name==t)return e[r];return null},findAnimation:function(t){for(var e=this.animations,r=0,i=e.length;i>r;r++)if(e[r].name==t)return e[r];return null},findIkConstraint:function(t){for(var e=this.ikConstraints,r=0,i=e.length;i>r;r++)if(e[r].name==t)return e[r];return null}},i.Skeleton=function(t){this.data=t,this.bones=[];for(var e=0,r=t.bones.length;r>e;e++){var n=t.bones[e],o=n.parent?this.bones[t.bones.indexOf(n.parent)]:null;this.bones.push(new i.Bone(n,this,o))}this.slots=[],this.drawOrder=[];for(var e=0,r=t.slots.length;r>e;e++){var s=t.slots[e],a=this.bones[t.bones.indexOf(s.boneData)],h=new i.Slot(s,a);this.slots.push(h),this.drawOrder.push(h)}this.ikConstraints=[];for(var e=0,r=t.ikConstraints.length;r>e;e++)this.ikConstraints.push(new i.IkConstraint(t.ikConstraints[e],this));this.boneCache=[],this.updateCache()},i.Skeleton.prototype={x:0,y:0,skin:null,r:1,g:1,b:1,a:1,time:0,flipX:!1,flipY:!1,updateCache:function(){var t=this.ikConstraints,e=t.length,r=e+1,i=this.boneCache;i.length>r&&(i.length=r);for(var n=0,o=i.length;o>n;n++)i[n].length=0;for(;i.lengthn;n++){var h=a[n],l=h;do{for(var u=0;e>u;u++)for(var c=t[u],d=c.bones[0],p=c.bones[c.bones.length-1];;){if(l==p){i[u].push(h),i[u+1].push(h);continue t}if(p==d)break;p=p.parent}l=l.parent}while(l);s[s.length]=h}},updateWorldTransform:function(){for(var t=this.bones,e=0,r=t.length;r>e;e++){var i=t[e];i.rotationIK=i.rotation}for(var e=0,n=this.boneCache.length-1;;){for(var o=this.boneCache[e],s=0,a=o.length;a>s;s++)o[s].updateWorldTransform();if(e==n)break;this.ikConstraints[e].apply(),e++}},setToSetupPose:function(){this.setBonesToSetupPose(),this.setSlotsToSetupPose()},setBonesToSetupPose:function(){for(var t=this.bones,e=0,r=t.length;r>e;e++)t[e].setToSetupPose();for(var i=this.ikConstraints,e=0,r=i.length;r>e;e++){var n=i[e];n.bendDirection=n.data.bendDirection,n.mix=n.data.mix}},setSlotsToSetupPose:function(){for(var t=this.slots,e=this.drawOrder,r=0,i=t.length;i>r;r++)e[r]=t[r],t[r].setToSetupPose(r)},getRootBone:function(){return this.bones.length?this.bones[0]:null},findBone:function(t){for(var e=this.bones,r=0,i=e.length;i>r;r++)if(e[r].data.name==t)return e[r];return null},findBoneIndex:function(t){for(var e=this.bones,r=0,i=e.length;i>r;r++)if(e[r].data.name==t)return r;return-1},findSlot:function(t){for(var e=this.slots,r=0,i=e.length;i>r;r++)if(e[r].data.name==t)return e[r];return null},findSlotIndex:function(t){for(var e=this.slots,r=0,i=e.length;i>r;r++)if(e[r].data.name==t)return r;return-1},setSkinByName:function(t){var e=this.data.findSkin(t);if(!e)throw"Skin not found: "+t;this.setSkin(e)},setSkin:function(t){if(t)if(this.skin)t._attachAll(this,this.skin);else for(var e=this.slots,r=0,i=e.length;i>r;r++){var n=e[r],o=n.data.attachmentName;if(o){var s=t.getAttachment(r,o);s&&n.setAttachment(s)}}this.skin=t},getAttachmentBySlotName:function(t,e){return this.getAttachmentBySlotIndex(this.data.findSlotIndex(t),e)},getAttachmentBySlotIndex:function(t,e){if(this.skin){var r=this.skin.getAttachment(t,e);if(r)return r}return this.data.defaultSkin?this.data.defaultSkin.getAttachment(t,e):null},setAttachment:function(t,e){for(var r=this.slots,i=0,n=r.length;n>i;i++){var o=r[i];if(o.data.name==t){var s=null;if(e&&(s=this.getAttachmentBySlotIndex(i,e),!s))throw"Attachment not found: "+e+", for slot: "+t;return void o.setAttachment(s)}}throw"Slot not found: "+t},findIkConstraint:function(t){for(var e=this.ikConstraints,r=0,i=e.length;i>r;r++)if(e[r].data.name==t)return e[r];return null},update:function(t){this.time+=t}},i.EventData=function(t){this.name=t},i.EventData.prototype={intValue:0,floatValue:0,stringValue:null},i.Event=function(t){this.data=t},i.Event.prototype={intValue:0,floatValue:0,stringValue:null},i.AttachmentType={region:0,boundingbox:1,mesh:2,skinnedmesh:3},i.RegionAttachment=function(t){this.name=t,this.offset=[],this.offset.length=8,this.uvs=[],this.uvs.length=8},i.RegionAttachment.prototype={type:i.AttachmentType.region,x:0,y:0,rotation:0,scaleX:1,scaleY:1,width:0,height:0,r:1,g:1,b:1,a:1,path:null,rendererObject:null,regionOffsetX:0,regionOffsetY:0,regionWidth:0,regionHeight:0,regionOriginalWidth:0,regionOriginalHeight:0,setUVs:function(t,e,r,i,n){var o=this.uvs;n?(o[2]=t,o[3]=i,o[4]=t,o[5]=e,o[6]=r,o[7]=e,o[0]=r,o[1]=i):(o[0]=t,o[1]=i,o[2]=t,o[3]=e,o[4]=r,o[5]=e,o[6]=r,o[7]=i)},updateOffset:function(){var t=this.width/this.regionOriginalWidth*this.scaleX,e=this.height/this.regionOriginalHeight*this.scaleY,r=-this.width/2*this.scaleX+this.regionOffsetX*t,n=-this.height/2*this.scaleY+this.regionOffsetY*e,o=r+this.regionWidth*t,s=n+this.regionHeight*e,a=this.rotation*i.degRad,h=Math.cos(a),l=Math.sin(a),u=r*h+this.x,c=r*l,d=n*h+this.y,p=n*l,f=o*h+this.x,g=o*l,v=s*h+this.y,m=s*l,y=this.offset;y[0]=u-p,y[1]=d+c,y[2]=u-m,y[3]=v+c,y[4]=f-m,y[5]=v+g,y[6]=f-p,y[7]=d+g},computeVertices:function(t,e,r,i){t+=r.worldX,e+=r.worldY;var n=r.m00,o=r.m01,s=r.m10,a=r.m11,h=this.offset;i[0]=h[0]*n+h[1]*o+t,i[1]=h[0]*s+h[1]*a+e,i[2]=h[2]*n+h[3]*o+t,i[3]=h[2]*s+h[3]*a+e,i[4]=h[4]*n+h[5]*o+t,i[5]=h[4]*s+h[5]*a+e,i[6]=h[6]*n+h[7]*o+t,i[7]=h[6]*s+h[7]*a+e}},i.MeshAttachment=function(t){this.name=t},i.MeshAttachment.prototype={type:i.AttachmentType.mesh,vertices:null,uvs:null,regionUVs:null,triangles:null,hullLength:0,r:1,g:1,b:1,a:1,path:null,rendererObject:null,regionU:0,regionV:0,regionU2:0,regionV2:0,regionRotate:!1,regionOffsetX:0,regionOffsetY:0,regionWidth:0,regionHeight:0,regionOriginalWidth:0,regionOriginalHeight:0,edges:null,width:0,height:0,updateUVs:function(){var t=this.regionU2-this.regionU,e=this.regionV2-this.regionV,r=this.regionUVs.length;if(this.uvs&&this.uvs.length==r||(this.uvs=new i.Float32Array(r)),this.regionRotate)for(var n=0;r>n;n+=2)this.uvs[n]=this.regionU+this.regionUVs[n+1]*t,this.uvs[n+1]=this.regionV+e-this.regionUVs[n]*e;else for(var n=0;r>n;n+=2)this.uvs[n]=this.regionU+this.regionUVs[n]*t,this.uvs[n+1]=this.regionV+this.regionUVs[n+1]*e},computeWorldVertices:function(t,e,r,i){var n=r.bone;t+=n.worldX,e+=n.worldY;var o=n.m00,s=n.m01,a=n.m10,h=n.m11,l=this.vertices,u=l.length;r.attachmentVertices.length==u&&(l=r.attachmentVertices);for(var c=0;u>c;c+=2){var d=l[c],p=l[c+1];i[c]=d*o+p*s+t,i[c+1]=d*a+p*h+e}}},i.SkinnedMeshAttachment=function(t){this.name=t},i.SkinnedMeshAttachment.prototype={type:i.AttachmentType.skinnedmesh,bones:null,weights:null,uvs:null,regionUVs:null,triangles:null,hullLength:0,r:1,g:1,b:1,a:1,path:null,rendererObject:null,regionU:0,regionV:0,regionU2:0,regionV2:0,regionRotate:!1,regionOffsetX:0,regionOffsetY:0,regionWidth:0,regionHeight:0,regionOriginalWidth:0,regionOriginalHeight:0,edges:null,width:0,height:0,updateUVs:function(){var t=this.regionU2-this.regionU,e=this.regionV2-this.regionV,r=this.regionUVs.length;if(this.uvs&&this.uvs.length==r||(this.uvs=new i.Float32Array(r)),this.regionRotate)for(var n=0;r>n;n+=2)this.uvs[n]=this.regionU+this.regionUVs[n+1]*t,this.uvs[n+1]=this.regionV+e-this.regionUVs[n]*e;else for(var n=0;r>n;n+=2)this.uvs[n]=this.regionU+this.regionUVs[n]*t,this.uvs[n+1]=this.regionV+this.regionUVs[n+1]*e},computeWorldVertices:function(t,e,r,i){var n,o,s,a,h,l,u,c=r.bone.skeleton.bones,d=this.weights,p=this.bones,f=0,g=0,v=0,m=0,y=p.length;if(r.attachmentVertices.length)for(var x=r.attachmentVertices;y>g;f+=2){for(o=0,s=0,n=p[g++]+g;n>g;g++,v+=3,m+=2)a=c[p[g]],h=d[v]+x[m],l=d[v+1]+x[m+1],u=d[v+2],o+=(h*a.m00+l*a.m01+a.worldX)*u,s+=(h*a.m10+l*a.m11+a.worldY)*u;i[f]=o+t,i[f+1]=s+e}else for(;y>g;f+=2){for(o=0,s=0,n=p[g++]+g;n>g;g++,v+=3)a=c[p[g]],h=d[v],l=d[v+1],u=d[v+2],o+=(h*a.m00+l*a.m01+a.worldX)*u,s+=(h*a.m10+l*a.m11+a.worldY)*u;i[f]=o+t,i[f+1]=s+e}}},i.BoundingBoxAttachment=function(t){this.name=t,this.vertices=[]},i.BoundingBoxAttachment.prototype={type:i.AttachmentType.boundingbox,computeWorldVertices:function(t,e,r,i){t+=r.worldX,e+=r.worldY;for(var n=r.m00,o=r.m01,s=r.m10,a=r.m11,h=this.vertices,l=0,u=h.length;u>l;l+=2){var c=h[l],d=h[l+1];i[l]=c*n+d*o+t,i[l+1]=c*s+d*a+e}}},i.AnimationStateData=function(t){this.skeletonData=t,this.animationToMixTime={}},i.AnimationStateData.prototype={defaultMix:0,setMixByName:function(t,e,r){var i=this.skeletonData.findAnimation(t);if(!i)throw"Animation not found: "+t;var n=this.skeletonData.findAnimation(e);if(!n)throw"Animation not found: "+e;this.setMix(i,n,r)},setMix:function(t,e,r){this.animationToMixTime[t.name+":"+e.name]=r},getMix:function(t,e){var r=t.name+":"+e.name;return this.animationToMixTime.hasOwnProperty(r)?this.animationToMixTime[r]:this.defaultMix}},i.TrackEntry=function(){},i.TrackEntry.prototype={next:null,previous:null,animation:null,loop:!1,delay:0,time:0,lastTime:-1,endTime:0,timeScale:1,mixTime:0,mixDuration:0,mix:1,onStart:null,onEnd:null,onComplete:null,onEvent:null},i.AnimationState=function(t){this.data=t,this.tracks=[],this.events=[]},i.AnimationState.prototype={onStart:null,onEnd:null,onComplete:null,onEvent:null,timeScale:1,update:function(t){t*=this.timeScale;for(var e=0;e=0&&this.setCurrent(e,n)):!r.loop&&r.lastTime>=r.endTime&&this.clearTrack(e)}}},apply:function(t){for(var e=0;eo&&(i=o);var a=r.previous;if(a){var h=a.time;!a.loop&&h>a.endTime&&(h=a.endTime),a.animation.apply(t,h,h,a.loop,null);var l=r.mixTime/r.mixDuration*r.mix;l>=1&&(l=1,r.previous=null),r.animation.mix(t,r.lastTime,i,s,this.events,l)}else 1==r.mix?r.animation.apply(t,r.lastTime,i,s,this.events):r.animation.mix(t,r.lastTime,i,s,this.events,r.mix);for(var u=0,c=this.events.length;c>u;u++){var d=this.events[u];r.onEvent&&r.onEvent(e,d),this.onEvent&&this.onEvent(e,d)}if(s?n%o>i%o:o>n&&i>=o){var p=Math.floor(i/o);r.onComplete&&r.onComplete(e,p),this.onComplete&&this.onComplete(e,p)}r.lastTime=r.time}}},clearTracks:function(){for(var t=0,e=this.tracks.length;e>t;t++)this.clearTrack(t);this.tracks.length=0},clearTrack:function(t){if(!(t>=this.tracks.length)){var e=this.tracks[t];e&&(e.onEnd&&e.onEnd(t),this.onEnd&&this.onEnd(t),this.tracks[t]=null)}},_expandToIndex:function(t){if(t=this.tracks.length;)this.tracks.push(null);return null},setCurrent:function(t,e){var r=this._expandToIndex(t);if(r){var i=r.previous;r.previous=null,r.onEnd&&r.onEnd(t),this.onEnd&&this.onEnd(t),e.mixDuration=this.data.getMix(r.animation,e.animation),e.mixDuration>0&&(e.mixTime=0,e.previous=i&&r.mixTime/r.mixDuration<.5?i:r)}this.tracks[t]=e,e.onStart&&e.onStart(t),this.onStart&&this.onStart(t)},setAnimationByName:function(t,e,r){var i=this.data.skeletonData.findAnimation(e);if(!i)throw"Animation not found: "+e;return this.setAnimation(t,i,r)},setAnimation:function(t,e,r){var n=new i.TrackEntry;return n.animation=e,n.loop=r,n.endTime=e.duration,this.setCurrent(t,n),n},addAnimationByName:function(t,e,r,i){var n=this.data.skeletonData.findAnimation(e);if(!n)throw"Animation not found: "+e;return this.addAnimation(t,n,r,i)},addAnimation:function(t,e,r,n){var o=new i.TrackEntry;o.animation=e,o.loop=r,o.endTime=e.duration;var s=this._expandToIndex(t);if(s){for(;s.next;)s=s.next;s.next=o}else this.tracks[t]=o;return 0>=n&&(s?n+=s.endTime-this.data.getMix(s.animation,e):n=0),o.delay=n,o},getCurrent:function(t){return t>=this.tracks.length?null:this.tracks[t]}},i.SkeletonJsonParser=function(t){this.attachmentLoader=t},i.SkeletonJsonParser.prototype={scale:1,readSkeletonData:function(t,e){var r=new i.SkeletonData;r.name=e;var n=t.skeleton;n&&(r.hash=n.hash,r.version=n.spine,r.width=n.width||0,r.height=n.height||0);for(var o=t.bones,s=0,a=o.length;a>s;s++){var h=o[s],l=null;if(h.parent&&(l=r.findBone(h.parent),!l))throw"Parent bone not found: "+h.parent;var u=new i.BoneData(h.name,l);u.length=(h.length||0)*this.scale,u.x=(h.x||0)*this.scale,u.y=(h.y||0)*this.scale,u.rotation=h.rotation||0,u.scaleX=h.hasOwnProperty("scaleX")?h.scaleX:1,u.scaleY=h.hasOwnProperty("scaleY")?h.scaleY:1,u.inheritScale=h.hasOwnProperty("inheritScale")?h.inheritScale:!0,u.inheritRotation=h.hasOwnProperty("inheritRotation")?h.inheritRotation:!0,r.bones.push(u)}var c=t.ik;if(c)for(var s=0,a=c.length;a>s;s++){for(var d=c[s],p=new i.IkConstraintData(d.name),o=d.bones,f=0,g=o.length;g>f;f++){var v=r.findBone(o[f]);if(!v)throw"IK bone not found: "+o[f];p.bones.push(v)}if(p.target=r.findBone(d.target),!p.target)throw"Target bone not found: "+d.target;p.bendDirection=!d.hasOwnProperty("bendPositive")||d.bendPositive?1:-1,p.mix=d.hasOwnProperty("mix")?d.mix:1,r.ikConstraints.push(p)}for(var m=t.slots,s=0,a=m.length;a>s;s++){var y=m[s],u=r.findBone(y.bone);if(!u)throw"Slot bone not found: "+y.bone;var x=new i.SlotData(y.name,u),b=y.color;b&&(x.r=this.toColor(b,0),x.g=this.toColor(b,1),x.b=this.toColor(b,2),x.a=this.toColor(b,3)),x.attachmentName=y.attachment,x.additiveBlending=y.additive&&"true"==y.additive,r.slots.push(x)}var T=t.skins;for(var _ in T)if(T.hasOwnProperty(_)){var E=T[_],w=new i.Skin(_);for(var S in E)if(E.hasOwnProperty(S)){var A=r.findSlotIndex(S),C=E[S];for(var M in C)if(C.hasOwnProperty(M)){var R=this.readAttachment(w,M,C[M]);R&&w.addAttachment(A,M,R)}}r.skins.push(w),"default"==w.name&&(r.defaultSkin=w)}var F=t.events;for(var D in F)if(F.hasOwnProperty(D)){var O=F[D],P=new i.EventData(D);P.intValue=O["int"]||0,P.floatValue=O["float"]||0,P.stringValue=O.string||null,r.events.push(P)}var B=t.animations;for(var L in B)B.hasOwnProperty(L)&&this.readAnimation(L,B[L],r);return r},readAttachment:function(t,e,r){e=r.name||e;var n=i.AttachmentType[r.type||"region"],o=r.path||e,s=this.scale;if(n==i.AttachmentType.region){var a=this.attachmentLoader.newRegionAttachment(t,e,o);if(!a)return null;a.path=o,a.x=(r.x||0)*s,a.y=(r.y||0)*s,a.scaleX=r.hasOwnProperty("scaleX")?r.scaleX:1,a.scaleY=r.hasOwnProperty("scaleY")?r.scaleY:1,a.rotation=r.rotation||0,a.width=(r.width||0)*s,a.height=(r.height||0)*s;var h=r.color;return h&&(a.r=this.toColor(h,0),a.g=this.toColor(h,1),a.b=this.toColor(h,2),a.a=this.toColor(h,3)),a.updateOffset(),a}if(n==i.AttachmentType.mesh){var l=this.attachmentLoader.newMeshAttachment(t,e,o);return l?(l.path=o,l.vertices=this.getFloatArray(r,"vertices",s),l.triangles=this.getIntArray(r,"triangles"),l.regionUVs=this.getFloatArray(r,"uvs",1),l.updateUVs(),h=r.color,h&&(l.r=this.toColor(h,0),l.g=this.toColor(h,1),l.b=this.toColor(h,2),l.a=this.toColor(h,3)),l.hullLength=2*(r.hull||0),r.edges&&(l.edges=this.getIntArray(r,"edges")),l.width=(r.width||0)*s,l.height=(r.height||0)*s,l):null}if(n==i.AttachmentType.skinnedmesh){var l=this.attachmentLoader.newSkinnedMeshAttachment(t,e,o);if(!l)return null;l.path=o;for(var u=this.getFloatArray(r,"uvs",1),c=this.getFloatArray(r,"vertices",1),d=[],p=[],f=0,g=c.length;g>f;){var v=0|c[f++];p[p.length]=v;for(var m=f+4*v;m>f;)p[p.length]=c[f],d[d.length]=c[f+1]*s,d[d.length]=c[f+2]*s,d[d.length]=c[f+3],f+=4}return l.bones=p,l.weights=d,l.triangles=this.getIntArray(r,"triangles"),l.regionUVs=u,l.updateUVs(),h=r.color,h&&(l.r=this.toColor(h,0),l.g=this.toColor(h,1),l.b=this.toColor(h,2),l.a=this.toColor(h,3)),l.hullLength=2*(r.hull||0),r.edges&&(l.edges=this.getIntArray(r,"edges")),l.width=(r.width||0)*s,l.height=(r.height||0)*s,l}if(n==i.AttachmentType.boundingbox){for(var y=this.attachmentLoader.newBoundingBoxAttachment(t,e),c=r.vertices,f=0,g=c.length;g>f;f++)y.vertices.push(c[f]*s);return y}throw"Unknown attachment type: "+n},readAnimation:function(t,e,r){var n=[],o=0,s=e.slots;for(var a in s)if(s.hasOwnProperty(a)){var h=s[a],l=r.findSlotIndex(a);for(var u in h)if(h.hasOwnProperty(u)){var c=h[u];if("color"==u){var d=new i.ColorTimeline(c.length);d.slotIndex=l;for(var p=0,f=0,g=c.length;g>f;f++){var v=c[f],m=v.color,y=this.toColor(m,0),x=this.toColor(m,1),b=this.toColor(m,2),T=this.toColor(m,3);d.setFrame(p,v.time,y,x,b,T),this.readCurve(d,p,v),p++}n.push(d),o=Math.max(o,d.frames[5*d.getFrameCount()-5])}else{if("attachment"!=u)throw"Invalid timeline type for a slot: "+u+" ("+a+")";var d=new i.AttachmentTimeline(c.length);d.slotIndex=l;for(var p=0,f=0,g=c.length;g>f;f++){var v=c[f];d.setFrame(p++,v.time,v.name)}n.push(d),o=Math.max(o,d.frames[d.getFrameCount()-1])}}}var _=e.bones;for(var E in _)if(_.hasOwnProperty(E)){var w=r.findBoneIndex(E);if(-1==w)throw"Bone not found: "+E;var S=_[E];for(var u in S)if(S.hasOwnProperty(u)){var c=S[u];if("rotate"==u){var d=new i.RotateTimeline(c.length);d.boneIndex=w;for(var p=0,f=0,g=c.length;g>f;f++){var v=c[f];d.setFrame(p,v.time,v.angle),this.readCurve(d,p,v),p++}n.push(d),o=Math.max(o,d.frames[2*d.getFrameCount()-2])}else if("translate"==u||"scale"==u){var d,A=1;"scale"==u?d=new i.ScaleTimeline(c.length):(d=new i.TranslateTimeline(c.length),A=this.scale),d.boneIndex=w;for(var p=0,f=0,g=c.length;g>f;f++){var v=c[f],C=(v.x||0)*A,M=(v.y||0)*A;d.setFrame(p,v.time,C,M),this.readCurve(d,p,v),p++}n.push(d),o=Math.max(o,d.frames[3*d.getFrameCount()-3])}else{if("flipX"!=u&&"flipY"!=u)throw"Invalid timeline type for a bone: "+u+" ("+E+")";var C="flipX"==u,d=C?new i.FlipXTimeline(c.length):new i.FlipYTimeline(c.length);d.boneIndex=w;for(var R=C?"x":"y",p=0,f=0,g=c.length;g>f;f++){var v=c[f];d.setFrame(p,v.time,v[R]||!1),p++}n.push(d),o=Math.max(o,d.frames[2*d.getFrameCount()-2])}}}var F=e.ik;for(var D in F)if(F.hasOwnProperty(D)){var O=r.findIkConstraint(D),c=F[D],d=new i.IkConstraintTimeline(c.length);d.ikConstraintIndex=r.ikConstraints.indexOf(O);for(var p=0,f=0,g=c.length;g>f;f++){var v=c[f],P=v.hasOwnProperty("mix")?v.mix:1,B=!v.hasOwnProperty("bendPositive")||v.bendPositive?1:-1;d.setFrame(p,v.time,P,B),this.readCurve(d,p,v),p++}n.push(d),o=Math.max(o,d.frames[3*d.frameCount-3])}var L=e.ffd;for(var I in L){var N=r.findSkin(I),h=L[I];for(a in h){var l=r.findSlotIndex(a),k=h[a];for(var U in k){var c=k[U],d=new i.FfdTimeline(c.length),j=N.getAttachment(l,U);if(!j)throw"FFD attachment not found: "+U;d.slotIndex=l,d.attachment=j;var X,Y=j.type==i.AttachmentType.mesh;X=Y?j.vertices.length:j.weights.length/3*2;for(var p=0,f=0,g=c.length;g>f;f++){var W,v=c[f];if(v.vertices){var G=v.vertices,W=[];W.length=X;var z=v.offset||0,H=G.length;if(1==this.scale)for(var V=0;H>V;V++)W[V+z]=G[V];else for(var V=0;H>V;V++)W[V+z]=G[V]*this.scale;if(Y)for(var q=j.vertices,V=0,H=W.length;H>V;V++)W[V]+=q[V]}else Y?W=j.vertices:(W=[],W.length=X);d.setFrame(p,v.time,W),this.readCurve(d,p,v),p++}n[n.length]=d,o=Math.max(o,d.frames[d.frameCount-1])}}}var K=e.drawOrder;if(K||(K=e.draworder),K){for(var d=new i.DrawOrderTimeline(K.length),Q=r.slots.length,p=0,f=0,g=K.length;g>f;f++){var J=K[f],Z=null;if(J.offsets){Z=[],Z.length=Q;for(var V=Q-1;V>=0;V--)Z[V]=-1;var $=J.offsets,te=[];te.length=Q-$.length;for(var ee=0,re=0,V=0,H=$.length;H>V;V++){var ie=$[V],l=r.findSlotIndex(ie.slot);if(-1==l)throw"Slot not found: "+ie.slot;for(;ee!=l;)te[re++]=ee++;Z[ee+ie.offset]=ee++}for(;Q>ee;)te[re++]=ee++;for(var V=Q-1;V>=0;V--)-1==Z[V]&&(Z[V]=te[--re])}d.setFrame(p++,J.time,Z)}n.push(d),o=Math.max(o,d.frames[d.getFrameCount()-1])}var ne=e.events;if(ne){for(var d=new i.EventTimeline(ne.length),p=0,f=0,g=ne.length;g>f;f++){var oe=ne[f],se=r.findEvent(oe.name);if(!se)throw"Event not found: "+oe.name;var ae=new i.Event(se);ae.intValue=oe.hasOwnProperty("int")?oe["int"]:se.intValue,ae.floatValue=oe.hasOwnProperty("float")?oe["float"]:se.floatValue,ae.stringValue=oe.hasOwnProperty("string")?oe.string:se.stringValue,d.setFrame(p++,oe.time,ae)}n.push(d),o=Math.max(o,d.frames[d.getFrameCount()-1])}r.animations.push(new i.Animation(t,n,o))},readCurve:function(t,e,r){var i=r.curve;i?"stepped"==i?t.curves.setStepped(e):i instanceof Array&&t.curves.setCurve(e,i[0],i[1],i[2],i[3]):t.curves.setLinear(e)},toColor:function(t,e){if(8!=t.length)throw"Color hexidecimal length must be 8, recieved: "+t;return parseInt(t.substring(2*e,2*e+2),16)/255},getFloatArray:function(t,e,r){var n=t[e],o=new i.Float32Array(n.length),s=0,a=n.length;if(1==r)for(;a>s;s++)o[s]=n[s];else for(;a>s;s++)o[s]=n[s]*r;return o},getIntArray:function(t,e){for(var r=t[e],n=new i.Uint16Array(r.length),o=0,s=r.length;s>o;o++)n[o]=0|r[o];return n}},i.Atlas=function(t,e,n){e&&e.indexOf("/")!==e.length&&(e+="/"),this.pages=[],this.regions=[],this.texturesLoading=0;var o=new i.AtlasReader(t),s=[];s.length=4;for(var a=null;;){var h=o.readLine();if(null===h)break;if(h=o.trim(h),h.length)if(a){var l=new i.AtlasRegion;l.name=h,l.page=a,l.rotate="true"==o.readValue(),o.readTuple(s);var u=parseInt(s[0]),c=parseInt(s[1]);o.readTuple(s);var d=parseInt(s[0]),p=parseInt(s[1]);l.u=u/a.width,l.v=c/a.height,l.rotate?(l.u2=(u+p)/a.width,l.v2=(c+d)/a.height):(l.u2=(u+d)/a.width,l.v2=(c+p)/a.height),l.x=u,l.y=c,l.width=Math.abs(d),l.height=Math.abs(p),4==o.readTuple(s)&&(l.splits=[parseInt(s[0]),parseInt(s[1]),parseInt(s[2]),parseInt(s[3])],4==o.readTuple(s)&&(l.pads=[parseInt(s[0]),parseInt(s[1]),parseInt(s[2]),parseInt(s[3])],o.readTuple(s))),l.originalWidth=parseInt(s[0]),l.originalHeight=parseInt(s[1]),o.readTuple(s),l.offsetX=parseInt(s[0]),l.offsetY=parseInt(s[1]),l.index=parseInt(o.readValue()),this.regions.push(l)}else{a=new i.AtlasPage,a.name=h,2==o.readTuple(s)&&(a.width=parseInt(s[0]),a.height=parseInt(s[1]),o.readTuple(s)),a.format=i.Atlas.Format[s[0]],o.readTuple(s),a.minFilter=i.Atlas.TextureFilter[s[0]],a.magFilter=i.Atlas.TextureFilter[s[1]];var f=o.readValue();a.uWrap=i.Atlas.TextureWrap.clampToEdge,a.vWrap=i.Atlas.TextureWrap.clampToEdge,"x"==f?a.uWrap=i.Atlas.TextureWrap.repeat:"y"==f?a.vWrap=i.Atlas.TextureWrap.repeat:"xy"==f&&(a.uWrap=a.vWrap=i.Atlas.TextureWrap.repeat),a.rendererObject=r.BaseTexture.fromImage(e+h,n),this.pages.push(a)}else a=null}},i.Atlas.prototype={findRegion:function(t){for(var e=this.regions,r=0,i=e.length;i>r;r++)if(e[r].name==t)return e[r];return null},dispose:function(){for(var t=this.pages,e=0,r=t.length;r>e;e++)t[e].rendererObject.destroy(!0)},updateUVs:function(t){for(var e=this.regions,r=0,i=e.length;i>r;r++){var n=e[r];n.page==t&&(n.u=n.x/t.width,n.v=n.y/t.height,n.rotate?(n.u2=(n.x+n.height)/t.width,n.v2=(n.y+n.width)/t.height):(n.u2=(n.x+n.width)/t.width,n.v2=(n.y+n.height)/t.height))}}},i.Atlas.Format={alpha:0,intensity:1,luminanceAlpha:2,rgb565:3,rgba4444:4,rgb888:5,rgba8888:6},i.Atlas.TextureFilter={nearest:0,linear:1,mipMap:2,mipMapNearestNearest:3,mipMapLinearNearest:4,mipMapNearestLinear:5,mipMapLinearLinear:6},i.Atlas.TextureWrap={mirroredRepeat:0,clampToEdge:1,repeat:2},i.AtlasPage=function(){},i.AtlasPage.prototype={name:null,format:null,minFilter:null,magFilter:null,uWrap:null,vWrap:null,rendererObject:null,width:0,height:0},i.AtlasRegion=function(){},i.AtlasRegion.prototype={page:null,name:null,x:0,y:0,width:0,height:0,u:0,v:0,u2:0,v2:0,offsetX:0,offsetY:0,originalWidth:0,originalHeight:0,index:0,rotate:!1,splits:null,pads:null},i.AtlasReader=function(t){this.lines=t.split(/\r\n|\r|\n/)},i.AtlasReader.prototype={index:0,trim:function(t){return t.replace(/^\s+|\s+$/g,"")},readLine:function(){return this.index>=this.lines.length?null:this.lines[this.index++]},readValue:function(){var t=this.readLine(),e=t.indexOf(":");if(-1==e)throw"Invalid line: "+t;return this.trim(t.substring(e+1))},readTuple:function(t){var e=this.readLine(),r=e.indexOf(":");if(-1==r)throw"Invalid line: "+e;for(var i=0,n=r+1;3>i;i++){var o=e.indexOf(",",n);if(-1==o)break;t[i]=this.trim(e.substr(n,o-n)),n=o+1}return t[i]=this.trim(e.substring(n)),i+1}},i.AtlasAttachmentParser=function(t){this.atlas=t},i.AtlasAttachmentParser.prototype={newRegionAttachment:function(t,e,r){var n=this.atlas.findRegion(r);if(!n)throw"Region not found in atlas: "+r+" (region attachment: "+e+")";var o=new i.RegionAttachment(e);return o.rendererObject=n,o.setUVs(n.u,n.v,n.u2,n.v2,n.rotate),o.regionOffsetX=n.offsetX,o.regionOffsetY=n.offsetY,o.regionWidth=n.width,o.regionHeight=n.height,o.regionOriginalWidth=n.originalWidth,o.regionOriginalHeight=n.originalHeight,o},newMeshAttachment:function(t,e,r){var n=this.atlas.findRegion(r);if(!n)throw"Region not found in atlas: "+r+" (mesh attachment: "+e+")";var o=new i.MeshAttachment(e);return o.rendererObject=n,o.regionU=n.u,o.regionV=n.v,o.regionU2=n.u2,o.regionV2=n.v2,o.regionRotate=n.rotate,o.regionOffsetX=n.offsetX,o.regionOffsetY=n.offsetY,o.regionWidth=n.width,o.regionHeight=n.height,o.regionOriginalWidth=n.originalWidth,o.regionOriginalHeight=n.originalHeight,o},newSkinnedMeshAttachment:function(t,e,r){var n=this.atlas.findRegion(r);if(!n)throw"Region not found in atlas: "+r+" (skinned mesh attachment: "+e+")";var o=new i.SkinnedMeshAttachment(e);return o.rendererObject=n,o.regionU=n.u,o.regionV=n.v,o.regionU2=n.u2,o.regionV2=n.v2,o.regionRotate=n.rotate,o.regionOffsetX=n.offsetX,o.regionOffsetY=n.offsetY,o.regionWidth=n.width,o.regionHeight=n.height,o.regionOriginalWidth=n.originalWidth,o.regionOriginalHeight=n.originalHeight,o},newBoundingBoxAttachment:function(t,e){return new i.BoundingBoxAttachment(e)}},i.SkeletonBounds=function(){this.polygonPool=[],this.polygons=[],this.boundingBoxes=[]},i.SkeletonBounds.prototype={minX:0,minY:0,maxX:0,maxY:0,update:function(t,e){var r=t.slots,n=r.length,o=t.x,s=t.y,a=this.boundingBoxes,h=this.polygonPool,l=this.polygons;a.length=0;for(var u=0,c=l.length;c>u;u++)h.push(l[u]);l.length=0;for(var u=0;n>u;u++){var d=r[u],p=d.attachment;if(p.type==i.AttachmentType.boundingbox){a.push(p);var f,g=h.length;g>0?(f=h[g-1],h.splice(g-1,1)):f=[],l.push(f),f.length=p.vertices.length,p.computeWorldVertices(o,s,d.bone,f)}}e&&this.aabbCompute()},aabbCompute:function(){for(var t=this.polygons,e=Number.MAX_VALUE,r=Number.MAX_VALUE,i=Number.MIN_VALUE,n=Number.MIN_VALUE,o=0,s=t.length;s>o;o++)for(var a=t[o],h=0,l=a.length;l>h;h+=2){var u=a[h],c=a[h+1];e=Math.min(e,u),r=Math.min(r,c),i=Math.max(i,u),n=Math.max(n,c)}this.minX=e,this.minY=r,this.maxX=i,this.maxY=n},aabbContainsPoint:function(t,e){return t>=this.minX&&t<=this.maxX&&e>=this.minY&&e<=this.maxY},aabbIntersectsSegment:function(t,e,r,i){var n=this.minX,o=this.minY,s=this.maxX,a=this.maxY;if(n>=t&&n>=r||o>=e&&o>=i||t>=s&&r>=s||e>=a&&i>=a)return!1;var h=(i-e)/(r-t),l=h*(n-t)+e;if(l>o&&a>l)return!0;if(l=h*(s-t)+e,l>o&&a>l)return!0;var u=(o-e)/h+t;return u>n&&s>u?!0:(u=(a-e)/h+t,u>n&&s>u?!0:!1)},aabbIntersectsSkeleton:function(t){return this.minXt.minX&&this.minYt.minY},containsPoint:function(t,e){for(var r=this.polygons,i=0,n=r.length;n>i;i++)if(this.polygonContainsPoint(r[i],t,e))return this.boundingBoxes[i];return null},intersectsSegment:function(t,e,r,i){for(var n=this.polygons,o=0,s=n.length;s>o;o++)if(n[o].intersectsSegment(t,e,r,i))return this.boundingBoxes[o];return null},polygonContainsPoint:function(t,e,r){for(var i=t.length,n=i-2,o=!1,s=0;i>s;s+=2){var a=t[s+1],h=t[n+1];if(r>a&&h>=r||r>h&&a>=r){var l=t[s];l+(r-a)/(h-a)*(t[n]-l)c;c+=2){var d=t[c],p=t[c+1],f=l*p-u*d,g=l-d,v=u-p,m=s*v-a*g,y=(h*g-s*f)/m;if((y>=l&&d>=y||y>=d&&l>=y)&&(y>=e&&i>=y||y>=i&&e>=y)){var x=(h*v-a*f)/m;if((x>=u&&p>=x||x>=p&&u>=x)&&(x>=r&&n>=x||x>=n&&r>=x))return!0}l=d,u=p}return!1},getPolygon:function(t){var e=this.boundingBoxes.indexOf(t);return-1==e?null:this.polygons[e]},getWidth:function(){return this.maxX-this.minX},getHeight:function(){return this.maxY-this.minY}}},{"../core":19}],121:[function(t,e){e.exports={Spine:t("./Spine"),SpineRuntime:t("./SpineRuntime")}},{"./Spine":119,"./SpineRuntime":120}],122:[function(t,e){function r(t,e){i.Container.call(this),this.textWidth=0,this.textHeight=0,this._glyphs=[],this._font={tint:e.tint,align:e.align,name:null,size:0},this.font=e.font,this._text=t,this.maxWidth=0,this.dirty=!1,this.updateText()}var i=t("../core");r.prototype=Object.create(i.Container.prototype),r.prototype.constructor=r,e.exports=r,Object.defineProperties(r.prototype,{tint:{get:function(){return this._font.tint},set:function(t){this._font.tint="number"==typeof t&&t>=0?t:16777215,this.dirty=!0}},align:{get:function(){return this._font.align},set:function(t){this._font.align=t,this.dirty=!0}},font:{get:function(){return this._font},set:function(t){"string"==typeof t?(t=t.split(" "),this._font.name=1===t.length?t[0]:t.slice(1).join(" "),this._font.size=t.length>=2?parseInt(t[0],10):r.fonts[this._font.name].size):(this._font.name=t.name,this._font.size="number"==typeof t.size?t.size:parseInt(t.size,10)),this.dirty=!0}},text:{get:function(){return this._text},set:function(t){this._text=t,this.dirty=!0}}}),r.prototype.updateText=function(){for(var t=r.fonts[this._font.name],e=new i.math.Point,n=null,o=[],s=0,a=0,h=[],l=0,u=this._font.size/t.size,c=-1,d=0;d0&&e.x*u>this.maxWidth)o.splice(c,d-c),d=c,c=-1,h.push(s),a=Math.max(a,s),l++,e.x=0,e.y+=t.lineHeight,n=null;else{var f=t.chars[p];f&&(n&&f.kerning[n]&&(e.x+=f.kerning[n]),o.push({texture:f.texture,line:l,charCode:p,position:new i.math.Point(e.x+f.xOffset,e.y+f.yOffset)}),s=e.x+(f.texture.width+f.xOffset),e.x+=f.xAdvance,n=p)}}h.push(s),a=Math.max(a,s);var g=[];for(d=0;l>=d;d++){var v=0;"right"===this._font.align?v=a-h[d]:"center"===this._font.align&&(v=(a-h[d])/2),g.push(v)}var m=o.length,y=this.tint;for(d=0;m>d;d++){var x=this._glyphs[d];x?x.texture=o[d].texture:(x=new i.Sprite(o[d].texture),this._glyphs.push(x)),x.position.x=(o[d].position.x+g[o[d].line])*u,x.position.y=o[d].position.y*u,x.scale.x=x.scale.y=u,x.tint=y,x.parent||this.addChild(x)}for(d=m;dh;h++){for(l=0;d>l;l+=4)if(255!==u[p+l]){f=!0;break}if(f)break;p+=d}for(e.ascent=s-h,p=c-d,f=!1,h=a;h>s;h--){for(l=0;d>l;l+=4)if(255!==u[p+l]){f=!0;break}if(f)break;p-=d}e.descent=h-s,e.fontSize=e.ascent+e.descent,r.fontPropertiesCache[t]=e}return e},r.prototype.wordWrap=function(t){for(var e="",r=t.split("\n"),i=this._style.wordWrapWidth,n=0;no?(a>0&&(e+="\n"),e+=s[a],o=i-h):(o-=l,e+=" "+s[a])}n