Socket
Socket
Sign inDemoInstall

stage-js

Package Overview
Dependencies
Maintainers
1
Versions
26
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

stage-js - npm Package Compare versions

Comparing version 0.8.11 to 0.9.3

dist/stage.cordova.js.map

40

dist/stage.cordova.min.js

@@ -1,8 +0,36 @@

/*
* Stage.js 0.8.10
/*!
*
* @copyright 2017 Ali Shakiba http://shakiba.me/stage.js
* @license The MIT License
* Planck.js v0.9.3
*
* @copyright Copyright (c) 2020 Ali Shakiba http://shakiba.me/stage.js
* @license The MIT License (MIT)
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*
*
*/
!function(t){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=t();else if("function"==typeof define&&define.amd)define([],t);else{var e;"undefined"!=typeof window?e=window:"undefined"!=typeof global?e=global:"undefined"!=typeof self&&(e=self),e.Stage=t()}}(function(){return function t(e,i,n){function r(o,h){if(!i[o]){if(!e[o]){var a="function"==typeof require&&require;if(!h&&a)return a(o,!0);if(s)return s(o,!0);var u=new Error("Cannot find module '"+o+"'");throw u.code="MODULE_NOT_FOUND",u}var f=i[o]={exports:{}};e[o][0].call(f.exports,function(t){var i=e[o][1][t];return r(i?i:t)},f,f.exports,t,e,i,n)}return i[o].exports}for(var s="function"==typeof require&&require,o=0;o<n.length;o++)r(n[o]);return r}({1:[function(t,e){e.exports=t("../lib/"),e.exports.internal={},t("../lib/canvas"),e.exports.internal.Image=t("../lib/image"),t("../lib/anim"),t("../lib/str"),t("../lib/layout"),t("../lib/addon/tween"),e.exports.Mouse=t("../lib/addon/mouse"),e.exports.Math=t("../lib/util/math"),e.exports._extend=t("../lib/util/extend"),e.exports._create=t("../lib/util/create"),t("../lib/loader/cordova")},{"../lib/":11,"../lib/addon/mouse":3,"../lib/addon/tween":4,"../lib/anim":5,"../lib/canvas":7,"../lib/image":10,"../lib/layout":12,"../lib/loader/cordova":13,"../lib/str":18,"../lib/util/create":22,"../lib/util/extend":24,"../lib/util/math":26}],2:[function(t,e){function i(t){return t}function n(t){if("function"==typeof t)return t;if("string"!=typeof t)return i;var e=r[t];if(e)return e;var n=/^(\w+)(-(in|out|in-out|out-in))?(\((.*)\))?$/i.exec(t);if(!n||!n.length)return i;var h=o[n[1]],a=s[n[3]],u=n[5];return e=h&&h.fn?h.fn:h&&h.fc?h.fc.apply(h.fc,u&&u.replace(/\s+/,"").split(",")):i,a&&(e=a.fn(e)),r[t]=e,e}var r={},s={},o={};n.add=function(t){for(var e=(t.name||t.mode).split(/\s+/),i=0;i<e.length;i++){var n=e[i];n&&((t.name?o:s)[n]=t)}},n.add({mode:"in",fn:function(t){return t}}),n.add({mode:"out",fn:function(t){return function(e){return 1-t(1-e)}}}),n.add({mode:"in-out",fn:function(t){return function(e){return.5>e?t(2*e)/2:1-t(2*(1-e))/2}}}),n.add({mode:"out-in",fn:function(t){return function(e){return.5>e?1-t(2*(1-e))/2:t(2*e)/2}}}),n.add({name:"linear",fn:function(t){return t}}),n.add({name:"quad",fn:function(t){return t*t}}),n.add({name:"cubic",fn:function(t){return t*t*t}}),n.add({name:"quart",fn:function(t){return t*t*t*t}}),n.add({name:"quint",fn:function(t){return t*t*t*t*t}}),n.add({name:"sin sine",fn:function(t){return 1-Math.cos(t*Math.PI/2)}}),n.add({name:"exp expo",fn:function(t){return 0==t?0:Math.pow(2,10*(t-1))}}),n.add({name:"circle circ",fn:function(t){return 1-Math.sqrt(1-t*t)}}),n.add({name:"bounce",fn:function(t){return 1/2.75>t?7.5625*t*t:2/2.75>t?7.5625*(t-=1.5/2.75)*t+.75:2.5/2.75>t?7.5625*(t-=2.25/2.75)*t+.9375:7.5625*(t-=2.625/2.75)*t+.984375}}),n.add({name:"poly",fc:function(t){return function(e){return Math.pow(e,t)}}}),n.add({name:"elastic",fc:function(t,e){e=e||.45,t=t||1;var i=e/(2*Math.PI)*Math.asin(1/t);return function(n){return 1+t*Math.pow(2,-10*n)*Math.sin(2*(n-i)*Math.PI/e)}}}),n.add({name:"back",fc:function(t){return t="undefined"!=typeof t?t:1.70158,function(e){return e*e*((t+1)*e-t)}}}),e.exports=n},{}],3:[function(t,e){function i(t,e){if(this instanceof i){var n=t.viewport().ratio||1;t.on("viewport",function(t){n=t.ratio||n}),this.x=0,this.y=0,this.toString=function(){return(0|this.x)+"x"+(0|this.y)},this.locate=function(t){r(e,t,this),this.x*=n,this.y*=n},this.lookup=function(e,i){this.type=e,this.root=t,this.event=null,i.length=0,this.collect=i,this.root.visit(this.visitor,this)},this.publish=function(e,i,n){if(this.type=e,this.root=t,this.event=i,this.collect=!1,this.timeStamp=Date.now(),"mousemove"!==e&&"touchmove"!==e&&DEBUG&&console.log(this.type+" "+this),n){for(;n.length&&!this.visitor.end(n.shift(),this););n.length=0}else this.root.visit(this.visitor,this)},this.visitor={reverse:!0,visible:!0,start:function(t,e){return!t._flag(e.type)},end:function(t,e){s.raw=e.event,s.type=e.type,s.timeStamp=e.timeStamp,s.abs.x=e.x,s.abs.y=e.y;var i=t.listeners(e.type);if(i&&(t.matrix().inverse().map(e,s),(t===e.root||t.hitTest(s))&&(e.collect&&e.collect.push(t),e.event))){for(var n=!1,r=0;r<i.length;r++)n=i[r].call(t,s)?!0:n;return n}}}}}function n(t,e,i){Object.defineProperty(t,e,{value:i})}function r(t,e,i){e.touches&&e.touches.length?(i.x=e.touches[0].clientX,i.y=e.touches[0].clientY):(i.x=e.clientX,i.y=e.clientY);var n=t.getBoundingClientRect();return i.x-=n.left,i.y-=n.top,i.x-=0|t.clientLeft,i.y-=0|t.clientTop,i}"undefined"==typeof DEBUG&&(DEBUG=!0),t("../core")._load(function(t,e){i.subscribe(t,e)}),i.CLICK="click",i.START="touchstart mousedown",i.MOVE="touchmove mousemove",i.END="touchend mouseup",i.CANCEL="touchcancel mousecancel",i.subscribe=function(t,e){function n(e){e.preventDefault(),t.mouse.locate(e),t.mouse.publish(e.type,e),t.mouse.lookup("click",h),t.mouse.lookup("mousecancel",a)}function r(e){e.preventDefault(),t.mouse.locate(e),t.mouse.publish(e.type,e)}function s(e){e.preventDefault(),t.mouse.publish(e.type,e),h.length&&t.mouse.publish("click",e,h),a.length=0}function o(e){a.length&&t.mouse.publish("mousecancel",e,a),h.length=0}if(!t.mouse){t.mouse=new i(t,e),e.addEventListener("touchstart",n),e.addEventListener("touchend",s),e.addEventListener("touchmove",r),e.addEventListener("touchcancel",o),e.addEventListener("mousedown",n),e.addEventListener("mouseup",s),e.addEventListener("mousemove",r),document.addEventListener("mouseup",o),window.addEventListener("blur",o);var h=[],a=[]}};var s={},o={};n(s,"clone",function(t){return t=t||{},t.x=this.x,t.y=this.y,t}),n(s,"toString",function(){return(0|this.x)+"x"+(0|this.y)+" ("+this.abs+")"}),n(s,"abs",o),n(o,"clone",function(t){return t=t||{},t.x=this.x,t.y=this.y,t}),n(o,"toString",function(){return(0|this.x)+"x"+(0|this.y)}),e.exports=i},{"../core":8}],4:[function(t,e){function i(t,e,i){this._end={},this._duration=e||400,this._delay=i||0,this._owner=t,this._time=0}function n(t,e,i,n){"number"==typeof t.pin(i)?e[i]=n:"number"==typeof t.pin(i+"X")&&"number"==typeof t.pin(i+"Y")&&(e[i+"X"]=n,e[i+"Y"]=n)}var r=t("./easing"),s=t("../core"),o=t("../pin");s.prototype.tween=function(t,e,n){if("number"!=typeof t?(n=t,e=0,t=0):"number"!=typeof e&&(n=e,e=0),!this._tweens){this._tweens=[];var r=0;this.tick(function(t,e,i){if(this._tweens.length){var n=r!=i;if(r=e,n)return!0;var s=this._tweens[0],o=s.tick(this,t,e,i);if(o&&s===this._tweens[0]&&this._tweens.shift(),"function"==typeof o)try{o.call(this)}catch(h){console.log(h)}return"object"==typeof o&&this._tweens.unshift(o),!0}},!0)}this.touch(),n||(this._tweens.length=0);var s=new i(this,t,e);return this._tweens.push(s),s},i.prototype.tick=function(t,e){if(this._time+=e,!(this._time<this._delay)){var i=this._time-this._delay;if(!this._start){this._start={};for(var n in this._end)this._start[n]=this._owner.pin(n)}var r,s;i<this._duration?(r=i/this._duration,s=!1):(r=1,s=!0),"function"==typeof this._easing&&(r=this._easing(r));var o=1-r;for(var n in this._end)this._owner.pin(n,this._start[n]*o+this._end[n]*r);return s?this._next||this._done||!0:void 0}},i.prototype.tween=function(t,e){return this._next=new i(this._owner,t,e)},i.prototype.duration=function(t){return this._duration=t,this},i.prototype.delay=function(t){return this._delay=t,this},i.prototype.ease=function(t){return this._easing=r(t),this},i.prototype.done=function(t){return this._done=t,this},i.prototype.hide=function(){return this.done(function(){this.hide()}),this},i.prototype.remove=function(){return this.done(function(){this.remove()}),this},i.prototype.pin=function(t,e){if("object"==typeof t)for(var i in t)n(this._owner,this._end,i,t[i]);else"undefined"!=typeof e&&n(this._owner,this._end,t,e);return this},o._add_shortcuts(i),i.prototype.then=function(t){return this.done(t),this},i.prototype.clear=function(){return this},e.exports=i},{"../core":8,"../pin":16,"./easing":2}],5:[function(t){function e(){e._super.call(this),this.label("Anim"),this._textures=[],this._fps=i.Anim.FPS,this._ft=1e3/this._fps,this._time=-1,this._repeat=0,this._index=0,this._frames=[];var t=0;this.tick(function(e,i,n){if(!(this._time<0||this._frames.length<=1)){var r=t!=n;if(t=i,r)return!0;if(this._time+=e,this._time<this._ft)return!0;var s=this._time/this._ft|0;return this._time-=s*this._ft,this.moveFrame(s),this._repeat>0&&(this._repeat-=s)<=0?(this.stop(),this._callback&&this._callback(),!1):!0}},!1)}var i=t("./core");t("./pin"),t("./loop");var n=t("./util/create"),r=t("./util/math");i.anim=function(t,i){var n=new e;return n.frames(t).gotoFrame(0),i&&n.fps(i),n},e._super=i,e.prototype=n(e._super.prototype),i.Anim={FPS:15},e.prototype.fps=function(t){return"undefined"==typeof t?this._fps:(this._fps=t>0?t:i.Anim.FPS,this._ft=1e3/this._fps,this)},e.prototype.setFrames=function(t,e,i){return this.frames(t,e,i)},e.prototype.frames=function(t){return this._index=0,this._frames=i.texture(t).array(),this.touch(),this},e.prototype.length=function(){return this._frames?this._frames.length:0},e.prototype.gotoFrame=function(t,e){return this._index=0|r.rotate(t,this._frames.length),e=e||!this._textures[0],this._textures[0]=this._frames[this._index],e&&(this.pin("width",this._textures[0].width),this.pin("height",this._textures[0].height)),this.touch(),this},e.prototype.moveFrame=function(t){return this.gotoFrame(this._index+t)},e.prototype.repeat=function(t,e){return this._repeat=t*this._frames.length-1,this._callback=e,this.play(),this},e.prototype.play=function(t){return"undefined"!=typeof t?(this.gotoFrame(t),this._time=0):this._time<0&&(this._time=0),this.touch(),this},e.prototype.stop=function(t){return this._time=-1,"undefined"!=typeof t&&this.gotoFrame(t),this}},{"./core":8,"./loop":14,"./pin":16,"./util/create":22,"./util/math":26}],6:[function(t,e){function i(t){function e(t){if(!t||u.fn(t.draw))return t;t=h({},t),u.fn(a)&&(t=a(t)),1!=c&&(t.x*=c,t.y*=c,t.width*=c,t.height*=c,t.top*=c,t.bottom*=c,t.left*=c,t.right*=c),0!=p&&(t.x+=p,t.y+=p,t.width-=2*p,t.height-=2*p,t.top-=p,t.bottom-=p,t.left-=p,t.right-=p);var e=o.pipe();return e.top=t.top,e.bottom=t.bottom,e.left=t.left,e.right=t.right,e.src(t.x,t.y,t.width,t.height),e}function s(t){if(l){if(u.fn(l))return l(t);if(u.hash(l))return l[t]}if(d){for(var e=null,i=0,n=0;n<d.length;n++)f.startsWith(d[n].name,t)&&(0===i?e=d[n]:1===i?e=[e,d[n]]:e.push(d[n]),i++);return 0===i&&u.fn(_)&&(e=function(e){return _(t+(e?e:""))}),e}}i._super.call(this);var o=this;r(t,"filter"),r(t,"cutouts"),r(t,"sprites"),r(t,"factory");var a=t.map||t.filter,c=t.ppu||t.ratio||1,p=t.trim||0,l=t.textures,_=t.factory,d=t.cutouts||t.sprites;this.select=function(t){if(!t)return new n(this.pipe());var i=s(t);return i?new n(i,s,e):void 0}}function n(t,e,i){function n(t,r){return t?u.fn(t.draw)?t:u.hash(t)&&u.number(t.width)&&u.number(t.height)&&u.fn(i)?i(t):u.hash(t)&&u.defined(r)?n(t[r]):u.fn(t)?n(t(r)):u.array(t)?n(t[0]):u.string(t)&&u.fn(e)?n(e(t)):void 0:l}this.one=function(e){return n(t,e)},this.array=function(e){var i=u.array(e)?e:[];if(u.array(t))for(var r=0;r<t.length;r++)i[r]=n(t[r]);else i[0]=n(t);return i}}function r(t,e,i){e in t&&console.log(i?i.replace("%name",e):"'"+e+"' field of texture atlas is deprecated.")}"undefined"==typeof DEBUG&&(DEBUG=!0);var s=t("./core"),o=t("./texture"),h=t("./util/extend"),a=t("./util/create"),u=t("./util/is"),f=t("./util/string"),c={},p=[];s.atlas=function(t){var e=u.fn(t.draw)?t:new i(t);t.name&&(c[t.name]=e),p.push(e),r(t,"imagePath"),r(t,"imageRatio");var n=t.imagePath,o=t.imageRatio||1;return u.string(t.image)?n=t.image:u.hash(t.image)&&(n=t.image.src||t.image.url,o=t.image.ratio||o),n&&s.preload(function(t){n=s.resolve(n),DEBUG&&console.log("Loading atlas: "+n);var i=s.config("image-loader");i(n,function(i){DEBUG&&console.log("Image loaded: "+n),e.src(i,o),t()},function(e){DEBUG&&console.log("Error loading atlas: "+n,e),t()})}),e},i._super=o,i.prototype=a(i._super.prototype);var l=new o;l.x=l.y=l.width=l.height=0,l.pipe=l.src=l.dest=function(){return this},l.draw=function(){};var _=new n(l);s.texture=function(t){if(!u.string(t))return new n(t);var e,i,r=null;for((i=t.indexOf(":"))>0&&t.length>i+1&&(e=c[t.slice(0,i)],r=e&&e.select(t.slice(i+1))),!r&&(e=c[t])&&(r=e.select()),i=0;!r&&i<p.length;i++)r=p[i].select(t);return r||(console.error("Texture not found: "+t),r=_),r},e.exports=i},{"./core":8,"./texture":19,"./util/create":22,"./util/extend":24,"./util/is":25,"./util/string":30}],7:[function(t){var e=t("./core"),i=t("./texture");e.canvas=function(t,e,n){"string"==typeof t?"object"==typeof e||("function"==typeof e&&(n=e),e={}):("function"==typeof t&&(n=t),e={},t="2d");var r=document.createElement("canvas"),s=r.getContext(t,e),o=new i(r);return o.context=function(){return s},o.size=function(t,e,i){return i=i||1,r.width=t*i,r.height=e*i,this.src(r,i),this},o.canvas=function(t){return"function"==typeof t?t.call(this,s):"undefined"==typeof t&&"function"==typeof n&&n.call(this,s),this},"function"==typeof n&&n.call(o,s),o}},{"./core":8,"./texture":19}],8:[function(t,e){function i(t){if(!(this instanceof i))return o.fn(t)?i.app.apply(i,arguments):o.object(t)?i.atlas.apply(i,arguments):t;r.create++;for(var e=0;e<a.length;e++)a[e].call(this)}function n(t,e){var i=document.createElement("script");i.addEventListener("load",function(){e()}),i.addEventListener("error",function(i){e(i||"Error loading script: "+t)}),i.src=t,i.id="preload-"+Date.now(),document.body.appendChild(i)}"undefined"==typeof DEBUG&&(DEBUG=!0);var r=t("./util/stats"),s=t("./util/extend"),o=t("./util/is"),h=t("./util/await");r.create=0;var a=[];i._init=function(t){a.push(t)};var u=[];i._load=function(t){u.push(t)};var f={};i.config=function(){return 1===arguments.length&&o.string(arguments[0])?f[arguments[0]]:(1===arguments.length&&o.object(arguments[0])&&s(f,arguments[0]),void(2===arguments.length&&o.string(arguments[0])&&f[(arguments[0],arguments[1])]))};var c=[],p=[],l=!1,_=!1;i.app=function(t,e){if(!l)return void c.push(arguments);DEBUG&&console.log("Creating app...");var n=i.config("app-loader");n(function(e,i){DEBUG&&console.log("Initing app...");for(var n=0;n<u.length;n++)u[n].call(this,e,i);t(e,i),p.push(e),DEBUG&&console.log("Starting app..."),e.start()},e)};var d=h();i.preload=function(t){if("string"==typeof t){var e=i.resolve(t);/\.js($|\?|\#)/.test(e)&&(DEBUG&&console.log("Loading script: "+e),t=function(t){n(e,t)})}"function"==typeof t&&t(d())},i.start=function(t){DEBUG&&console.log("Starting..."),i.config(t),d.then(function(){for(DEBUG&&console.log("Loading apps..."),l=!0;c.length;){var t=c.shift();i.app.apply(i,t)}})},i.pause=function(){if(!_){_=!0;for(var t=p.length-1;t>=0;t--)p[t].pause()}},i.resume=function(){if(_){_=!1;for(var t=p.length-1;t>=0;t--)p[t].resume()}},i.create=function(){return new i},i.resolve=function(){function t(){if(document.currentScript)return document.currentScript.src;var t;try{var i=new Error;if(!i.stack)throw i;t=i.stack}catch(i){t=i.stack}if("string"==typeof t){t=t.split("\n");for(var n=t.length;n--;){var r=t[n].match(/(\w+\:\/\/[^\/]*?\/.+?)(:\d+)(:\d+)?/);if(r)return r[1]}}if(e.length&&"readyState"in e[0])for(var n=e.length;n--;)if("interactive"===e[n].readyState)return e[n].src;return location.href}if("undefined"==typeof window||"undefined"==typeof document)return function(t){return t};var e=document.getElementsByTagName("script");return function(e){if(/^\.\//.test(e)){var i=t(),n=i.substring(0,i.lastIndexOf("/")+1);e=n+e.substring(2)}return e}}(),e.exports=i},{"./util/await":21,"./util/extend":24,"./util/is":25,"./util/stats":29}],9:[function(t){t("./util/event")(t("./core").prototype,function(t,e,i){t._flag(e,i)})},{"./core":8,"./util/event":23}],10:[function(t,e){function i(){i._super.call(this),this.label("Image"),this._textures=[],this._image=null}var n=t("./core");t("./pin"),t("./loop");var r=t("./util/repeat"),s=t("./util/create");e.exports=i,n.image=function(t){var e=new i;return t&&e.image(t),e},i._super=n,i.prototype=s(i._super.prototype),i.prototype.setImage=function(t,e,i){return this.image(t,e,i)},i.prototype.image=function(t){return this._image=n.texture(t).one(),this.pin("width",this._image?this._image.width:0),this.pin("height",this._image?this._image.height:0),this._textures[0]=this._image.pipe(),this._textures.length=1,this},i.prototype.tile=function(t){return this._repeat(!1,t),this},i.prototype.stretch=function(t){return this._repeat(!0,t),this},i.prototype._repeat=function(t,e){function i(t,e,i,r,s,o,h,a,u){var f=n._textures.length>t?n._textures[t]:n._textures[t]=n._image.pipe();f.src(e,i,r,s),f.dest(o,h,a,u)}var n=this;this.untick(this._repeatTicker),this.tick(this._repeatTicker=function(){if(this._mo_stretch!=this._pin._ts_transform){this._mo_stretch=this._pin._ts_transform;var n=this.pin("width"),s=this.pin("height");this._textures.length=r(this._image,n,s,t,e,i)}})}},{"./core":8,"./loop":14,"./pin":16,"./util/create":22,"./util/repeat":28}],11:[function(t,e){e.exports=t("./core"),e.exports.Matrix=t("./matrix"),e.exports.Texture=t("./texture"),t("./atlas"),t("./tree"),t("./event"),t("./pin"),t("./loop"),t("./root")},{"./atlas":6,"./core":8,"./event":9,"./loop":14,"./matrix":15,"./pin":16,"./root":17,"./texture":19,"./tree":20}],12:[function(t){var e=t("./core");t("./pin"),t("./loop");t("./util/create");e.row=function(t){return e.create().row(t).label("Row")},e.prototype.row=function(t){return this.sequence("row",t),this},e.column=function(t){return e.create().column(t).label("Row")},e.prototype.column=function(t){return this.sequence("column",t),this},e.sequence=function(t,i){return e.create().sequence(t,i).label("Sequence")},e.prototype.sequence=function(t,e){return this._padding=this._padding||0,this._spacing=this._spacing||0,this.untick(this._layoutTiker),this.tick(this._layoutTiker=function(){if(this._mo_seq!=this._ts_touch){this._mo_seq=this._ts_touch;var i=this._mo_seqAlign!=this._ts_children;this._mo_seqAlign=this._ts_children;for(var n,r=0,s=0,o=this.first(!0),h=!0;n=o;){o=n.next(!0),n.matrix(!0);var a=n.pin("boxWidth"),u=n.pin("boxHeight");"column"==t?(!h&&(s+=this._spacing),n.pin("offsetY")!=s&&n.pin("offsetY",s),r=Math.max(r,a),s+=u,i&&n.pin("alignX",e)):"row"==t&&(!h&&(r+=this._spacing),n.pin("offsetX")!=r&&n.pin("offsetX",r),r+=a,s=Math.max(s,u),i&&n.pin("alignY",e)),h=!1}r+=2*this._padding,s+=2*this._padding,this.pin("width")!=r&&this.pin("width",r),this.pin("height")!=s&&this.pin("height",s)}}),this},e.box=function(){return e.create().box().label("Box")},e.prototype.box=function(){return this._padding=this._padding||0,this.untick(this._layoutTiker),this.tick(this._layoutTiker=function(){if(this._mo_box!=this._ts_touch){this._mo_box=this._ts_touch;for(var t,e=0,i=0,n=this.first(!0);t=n;){n=t.next(!0),t.matrix(!0);var r=t.pin("boxWidth"),s=t.pin("boxHeight");e=Math.max(e,r),i=Math.max(i,s)}e+=2*this._padding,i+=2*this._padding,this.pin("width")!=e&&this.pin("width",e),this.pin("height")!=i&&this.pin("height",i)}}),this},e.layer=function(){return e.create().layer().label("Layer")},e.prototype.layer=function(){return this.untick(this._layoutTiker),this.tick(this._layoutTiker=function(){var t=this.parent();if(t){var e=t.pin("width");this.pin("width")!=e&&this.pin("width",e);var i=t.pin("height");this.pin("height")!=i&&this.pin("height",i)}},!0),this},e.prototype.padding=function(t){return this._padding=t,this},e.prototype.spacing=function(t){return this._spacing=t,this}},{"./core":8,"./loop":14,"./pin":16,"./util/create":22}],13:[function(t){function e(t,e){function i(){o.isFast?(o.clear(),o.setTransform(1,0,0,1,0,0)):(o.setTransform(1,0,0,1,0,0),o.clearRect(0,0,a,u)),d.render(o)}function r(){h?(a=window.innerWidth>0?window.innerWidth:screen.width,u=window.innerHeight>0?window.innerHeight:screen.height,s.style.width=a+"px",s.style.height=u+"px"):(a=s.clientWidth,u=s.clientHeight),a*=f,u*=f,(s.width!==a||s.height!==u)&&(s.width=a,s.height=u,DEBUG&&console.log("Resize: "+a+" x "+u+" / "+f),d.viewport(a,u,f),i())}e=e||{};var s=e.canvas,o=null,h=!1,a=0,u=0,f=1;if("string"==typeof s&&(s=document.getElementById(s)),s||(s=document.getElementById("cutjs")||document.getElementById("stage")),!s){h=!0,DEBUG&&console.log("Creating Canvas..."),s=document.createElement("canvas"),s.style.position="absolute",s.style.top="0",s.style.left="0";var c=document.body;c.insertBefore(s,c.firstChild)}o=s.getContext("2d",{fastcontext:!0}),o.isFast=!!o.isFast,h=h||o.isFast,DEBUG&&console.log("FastContext: "+o.isFast);var p=window.devicePixelRatio||1,l=o.webkitBackingStorePixelRatio||o.mozBackingStorePixelRatio||o.msBackingStorePixelRatio||o.oBackingStorePixelRatio||o.backingStorePixelRatio||1;f=p/l;var _=window.requestAnimationFrame||window.msRequestAnimationFrame||window.mozRequestAnimationFrame||window.webkitRequestAnimationFrame||window.oRequestAnimationFrame||function(t){return window.setTimeout(t,1e3/60)};DEBUG&&console.log("Creating stage...");var d=n.root(_,i);d.background=function(t){return o.isFast?o.setBackgroundColor&&o.setBackgroundColor(t):s.style.backgroundColor=t,this},t(d,s),r(),window.addEventListener("resize",r,!1),window.addEventListener("orientationchange",r,!1)}function i(t,e,i){function n(){e(r)}DEBUG&&console.log("Loading image: "+t);var r;FastContext?r=FastContext.createImage(t,n,i):(r=new Image,r.onload=n,r.onerror=i,r.src=t)}"undefined"==typeof DEBUG&&(DEBUG=!0);var n=t("../core"),r=t("../util/once");"undefined"==typeof FastContext&&(FastContext=window.FastContext),n._supported=function(){var t=document.createElement("canvas");return t.getContext&&t.getContext("2d")?!0:!1}(),window.addEventListener("load",function(){DEBUG&&console.log("On load.");var t=r(function(t){DEBUG&&t&&console.log("Started on "+t),n._supported&&n.start()});document.addEventListener("click",function(){t("click")},!1),document.addEventListener("mousemove",function(){t("mousemove")},!1),document.addEventListener("deviceready",function(){t("deviceready")},!1),document.addEventListener("pause",function(){n.pause()},!1),document.addEventListener("resume",function(){n.resume()},!1)},!1),n.config({"app-loader":e,"image-loader":i})},{"../core":8,"../util/once":27}],14:[function(t){var e=t("./core");t("./pin");var i=t("./util/stats");e.prototype._textures=null,e.prototype._alpha=1,e.prototype.render=function(t){if(this._visible){i.node++;var e=this.matrix();t.setTransform(e.a,e.b,e.c,e.d,e.e,e.f),this._alpha=this._pin._alpha*(this._parent?this._parent._alpha:1);var n=this._pin._textureAlpha*this._alpha;if(t.globalAlpha!=n&&(t.globalAlpha=n),null!==this._textures)for(var r=0,s=this._textures.length;s>r;r++)this._textures[r].draw(t);t.globalAlpha!=this._alpha&&(t.globalAlpha=this._alpha);for(var o,h=this._first;o=h;)h=o._next,o.render(t)}},e.prototype._tickBefore=null,e.prototype._tickAfter=null,e.prototype.MAX_ELAPSE=1/0,e.prototype._tick=function(t,e,n){if(this._visible){t>this.MAX_ELAPSE&&(t=this.MAX_ELAPSE);var r=!1;if(null!==this._tickBefore)for(var s=0;s<this._tickBefore.length;s++){i.tick++;var o=this._tickBefore[s];r=o.call(this,t,e,n)===!0||r}for(var h,a=this._first;h=a;)a=h._next,h._flag("_tick")&&(r=h._tick(t,e,n)===!0?!0:r);if(null!==this._tickAfter)for(var s=0;s<this._tickAfter.length;s++){i.tick++;var o=this._tickAfter[s];r=o.call(this,t,e,n)===!0||r}return r}},e.prototype.tick=function(t,e){"function"==typeof t&&(e?(null===this._tickBefore&&(this._tickBefore=[]),this._tickBefore.push(t)):(null===this._tickAfter&&(this._tickAfter=[]),this._tickAfter.push(t)),this._flag("_tick",null!==this._tickAfter&&this._tickAfter.length>0||null!==this._tickBefore&&this._tickBefore.length>0))},e.prototype.untick=function(t){if("function"==typeof t){var e;null!==this._tickBefore&&(e=this._tickBefore.indexOf(t))>=0&&this._tickBefore.splice(e,1),null!==this._tickAfter&&(e=this._tickAfter.indexOf(t))>=0&&this._tickAfter.splice(e,1)}},e.prototype.timeout=function(t,e){this.setTimeout(t,e)},e.prototype.setTimeout=function(t,e){function i(n){return(e-=n)<0?(this.untick(i),void t.call(this)):!0}return this.tick(i),i},e.prototype.clearTimeout=function(t){this.untick(t)}},{"./core":8,"./pin":16,"./util/stats":29}],15:[function(t,e){function i(t,e,i,n,r,s){this.reset(t,e,i,n,r,s)}i.prototype.toString=function(){return"["+this.a+", "+this.b+", "+this.c+", "+this.d+", "+this.e+", "+this.f+"]"},i.prototype.clone=function(){return new i(this.a,this.b,this.c,this.d,this.e,this.f)},i.prototype.reset=function(t,e,i,n,r,s){return this._dirty=!0,"object"==typeof t?(this.a=t.a,this.d=t.d,this.b=t.b,this.c=t.c,this.e=t.e,this.f=t.f):(this.a=t||1,this.d=n||1,this.b=e||0,this.c=i||0,this.e=r||0,this.f=s||0),this},i.prototype.identity=function(){return this._dirty=!0,this.a=1,this.b=0,this.c=0,this.d=1,this.e=0,this.f=0,this},i.prototype.rotate=function(t){if(!t)return this;this._dirty=!0;var e=t?Math.cos(t):1,i=t?Math.sin(t):0,n=e*this.a-i*this.b,r=e*this.b+i*this.a,s=e*this.c-i*this.d,o=e*this.d+i*this.c,h=e*this.e-i*this.f,a=e*this.f+i*this.e;return this.a=n,this.b=r,this.c=s,this.d=o,this.e=h,this.f=a,this},i.prototype.translate=function(t,e){return t||e?(this._dirty=!0,this.e+=t,this.f+=e,this):this},i.prototype.scale=function(t,e){return t-1||e-1?(this._dirty=!0,this.a*=t,this.b*=e,this.c*=t,this.d*=e,this.e*=t,this.f*=e,this):this},i.prototype.skew=function(t,e){if(!t&&!e)return this;this._dirty=!0;var i=this.a+this.b*t,n=this.b+this.a*e,r=this.c+this.d*t,s=this.d+this.c*e,o=this.e+this.f*t,h=this.f+this.e*e;return this.a=i,this.b=n,this.c=r,this.d=s,this.e=o,this.f=h,this},i.prototype.concat=function(t){this._dirty=!0;var e=this,i=e.a*t.a+e.b*t.c,n=e.b*t.d+e.a*t.b,r=e.c*t.a+e.d*t.c,s=e.d*t.d+e.c*t.b,o=e.e*t.a+t.e+e.f*t.c,h=e.f*t.d+t.f+e.e*t.b;return this.a=i,this.b=n,this.c=r,this.d=s,this.e=o,this.f=h,this},i.prototype.inverse=i.prototype.reverse=function(){if(this._dirty){this._dirty=!1,this.inversed=this.inversed||new i;var t=this.a*this.d-this.b*this.c;this.inversed.a=this.d/t,this.inversed.b=-this.b/t,this.inversed.c=-this.c/t,this.inversed.d=this.a/t,this.inversed.e=(this.c*this.f-this.e*this.d)/t,this.inversed.f=(this.e*this.b-this.a*this.f)/t}return this.inversed},i.prototype.map=function(t,e){return e=e||{},e.x=this.a*t.x+this.c*t.y+this.e,e.y=this.b*t.x+this.d*t.y+this.f,e},i.prototype.mapX=function(t,e){return"object"==typeof t&&(e=t.y,t=t.x),this.a*t+this.c*e+this.e},i.prototype.mapY=function(t,e){return"object"==typeof t&&(e=t.y,t=t.x),this.b*t+this.d*e+this.f},e.exports=i},{}],16:[function(t,e){function i(t){this._owner=t,this._parent=null,this._relativeMatrix=new s,this._absoluteMatrix=new s,this.reset()}function n(t,e,i,n){var r="number"==typeof e,s="number"==typeof i,h="string"==typeof n;t._ts_transform=++o,r&&(t._scaleX=e/t._width_,t._width=t._width_),s&&(t._scaleY=i/t._height_,t._height=t._height_),r&&s&&h&&("out"==n||"out-crop"==n?t._scaleX=t._scaleY=Math.max(t._scaleX,t._scaleY):("in"==n||"in-pad"==n)&&(t._scaleX=t._scaleY=Math.min(t._scaleX,t._scaleY)),("out-crop"==n||"in-pad"==n)&&(t._width=e/t._scaleX,t._height=i/t._scaleY))}var r=t("./core"),s=t("./matrix"),o=0;r._init(function(){this._pin=new i(this)}),r.prototype.matrix=function(t){return t===!0?this._pin.relativeMatrix():this._pin.absoluteMatrix()},r.prototype.pin=function(t,e){return"object"==typeof t?(this._pin.set(t),this):"string"==typeof t?"undefined"==typeof e?this._pin.get(t):(this._pin.set(t,e),this):"undefined"==typeof t?this._pin:void 0},i.prototype.reset=function(){this._textureAlpha=1,this._alpha=1,this._width=0,this._height=0,this._scaleX=1,this._scaleY=1,this._skewX=0,this._skewY=0,this._rotation=0,this._pivoted=!1,this._pivotX=null,this._pivotY=null,this._handled=!1,this._handleX=0,this._handleY=0,this._aligned=!1,this._alignX=0,this._alignY=0,this._offsetX=0,this._offsetY=0,this._boxX=0,this._boxY=0,this._boxWidth=this._width,this._boxHeight=this._height,this._ts_translate=++o,this._ts_transform=++o,this._ts_matrix=++o},i.prototype._update=function(){return this._parent=this._owner._parent&&this._owner._parent._pin,this._handled&&this._mo_handle!=this._ts_transform&&(this._mo_handle=this._ts_transform,this._ts_translate=++o),this._aligned&&this._parent&&this._mo_align!=this._parent._ts_transform&&(this._mo_align=this._parent._ts_transform,this._ts_translate=++o),this},i.prototype.toString=function(){return this._owner+" ("+(this._parent?this._parent._owner:null)+")"},i.prototype.absoluteMatrix=function(){this._update();var t=Math.max(this._ts_transform,this._ts_translate,this._parent?this._parent._ts_matrix:0);if(this._mo_abs==t)return this._absoluteMatrix;this._mo_abs=t;var e=this._absoluteMatrix;return e.reset(this.relativeMatrix()),this._parent&&e.concat(this._parent._absoluteMatrix),this._ts_matrix=++o,e},i.prototype.relativeMatrix=function(){this._update();var t=Math.max(this._ts_transform,this._ts_translate,this._parent?this._parent._ts_transform:0);if(this._mo_rel==t)return this._relativeMatrix;this._mo_rel=t;var e=this._relativeMatrix;if(e.identity(),this._pivoted&&e.translate(-this._pivotX*this._width,-this._pivotY*this._height),e.scale(this._scaleX,this._scaleY),e.skew(this._skewX,this._skewY),e.rotate(this._rotation),this._pivoted&&e.translate(this._pivotX*this._width,this._pivotY*this._height),this._pivoted)this._boxX=0,this._boxY=0,this._boxWidth=this._width,this._boxHeight=this._height;else{var i,n;e.a>0&&e.c>0||e.a<0&&e.c<0?(i=0,n=e.a*this._width+e.c*this._height):(i=e.a*this._width,n=e.c*this._height),i>n?(this._boxX=n,this._boxWidth=i-n):(this._boxX=i,this._boxWidth=n-i),e.b>0&&e.d>0||e.b<0&&e.d<0?(i=0,n=e.b*this._width+e.d*this._height):(i=e.b*this._width,n=e.d*this._height),i>n?(this._boxY=n,this._boxHeight=i-n):(this._boxY=i,this._boxHeight=n-i)}return this._x=this._offsetX,this._y=this._offsetY,this._x-=this._boxX+this._handleX*this._boxWidth,this._y-=this._boxY+this._handleY*this._boxHeight,this._aligned&&this._parent&&(this._parent.relativeMatrix(),this._x+=this._alignX*this._parent._width,this._y+=this._alignY*this._parent._height),e.translate(this._x,this._y),this._relativeMatrix},i.prototype.get=function(t){return"function"==typeof h[t]?h[t](this):void 0},i.prototype.set=function(t,e){if("string"==typeof t)"function"==typeof a[t]&&"undefined"!=typeof e&&a[t](this,e);else if("object"==typeof t)for(e in t)"function"==typeof a[e]&&"undefined"!=typeof t[e]&&a[e](this,t[e],t);return this._owner&&(this._owner._ts_pin=++o,this._owner.touch()),this};var h={alpha:function(t){return t._alpha},textureAlpha:function(t){return t._textureAlpha},width:function(t){return t._width},height:function(t){return t._height},boxWidth:function(t){return t._boxWidth},boxHeight:function(t){return t._boxHeight},scaleX:function(t){return t._scaleX},scaleY:function(t){return t._scaleY},skewX:function(t){return t._skewX},skewY:function(t){return t._skewY},rotation:function(t){return t._rotation},pivotX:function(t){return t._pivotX},pivotY:function(t){return t._pivotY},offsetX:function(t){return t._offsetX},offsetY:function(t){return t._offsetY},alignX:function(t){return t._alignX},alignY:function(t){return t._alignY},handleX:function(t){return t._handleX},handleY:function(t){return t._handleY}},a={alpha:function(t,e){t._alpha=e},textureAlpha:function(t,e){t._textureAlpha=e},width:function(t,e){t._width_=e,t._width=e,t._ts_transform=++o},height:function(t,e){t._height_=e,t._height=e,t._ts_transform=++o},scale:function(t,e){t._scaleX=e,t._scaleY=e,t._ts_transform=++o},scaleX:function(t,e){t._scaleX=e,t._ts_transform=++o},scaleY:function(t,e){t._scaleY=e,t._ts_transform=++o},skew:function(t,e){t._skewX=e,t._skewY=e,t._ts_transform=++o},skewX:function(t,e){t._skewX=e,t._ts_transform=++o},skewY:function(t,e){t._skewY=e,t._ts_transform=++o},rotation:function(t,e){t._rotation=e,t._ts_transform=++o},pivot:function(t,e){t._pivotX=e,t._pivotY=e,t._pivoted=!0,t._ts_transform=++o},pivotX:function(t,e){t._pivotX=e,t._pivoted=!0,t._ts_transform=++o},pivotY:function(t,e){t._pivotY=e,t._pivoted=!0,t._ts_transform=++o},offset:function(t,e){t._offsetX=e,t._offsetY=e,t._ts_translate=++o},offsetX:function(t,e){t._offsetX=e,t._ts_translate=++o
},offsetY:function(t,e){t._offsetY=e,t._ts_translate=++o},align:function(t,e){this.alignX(t,e),this.alignY(t,e)},alignX:function(t,e){t._alignX=e,t._aligned=!0,t._ts_translate=++o,this.handleX(t,e)},alignY:function(t,e){t._alignY=e,t._aligned=!0,t._ts_translate=++o,this.handleY(t,e)},handle:function(t,e){this.handleX(t,e),this.handleY(t,e)},handleX:function(t,e){t._handleX=e,t._handled=!0,t._ts_translate=++o},handleY:function(t,e){t._handleY=e,t._handled=!0,t._ts_translate=++o},resizeMode:function(t,e,i){i&&("in"==e?e="in-pad":"out"==e&&(e="out-crop"),n(t,i.resizeWidth,i.resizeHeight,e))},resizeWidth:function(t,e,i){i&&i.resizeMode||n(t,e,null)},resizeHeight:function(t,e,i){i&&i.resizeMode||n(t,null,e)},scaleMode:function(t,e,i){i&&n(t,i.scaleWidth,i.scaleHeight,e)},scaleWidth:function(t,e,i){i&&i.scaleMode||n(t,e,null)},scaleHeight:function(t,e,i){i&&i.scaleMode||n(t,null,e)},matrix:function(t,e){this.scaleX(t,e.a),this.skewX(t,e.c/e.d),this.skewY(t,e.b/e.a),this.scaleY(t,e.d),this.offsetX(t,e.e),this.offsetY(t,e.f),this.rotation(t,0)}};r.prototype.scaleTo=function(t,e,i){return"object"==typeof t&&(i=e,e=t.y,t=t.x),n(this._pin,t,e,i),this},i._add_shortcuts=function(t){t.prototype.size=function(t,e){return this.pin("width",t),this.pin("height",e),this},t.prototype.width=function(t){return"undefined"==typeof t?this.pin("width"):(this.pin("width",t),this)},t.prototype.height=function(t){return"undefined"==typeof t?this.pin("height"):(this.pin("height",t),this)},t.prototype.offset=function(t,e){return"object"==typeof t&&(e=t.y,t=t.x),this.pin("offsetX",t),this.pin("offsetY",e),this},t.prototype.rotate=function(t){return this.pin("rotation",t),this},t.prototype.skew=function(t,e){return"object"==typeof t?(e=t.y,t=t.x):"undefined"==typeof e&&(e=t),this.pin("skewX",t),this.pin("skewY",e),this},t.prototype.scale=function(t,e){return"object"==typeof t?(e=t.y,t=t.x):"undefined"==typeof e&&(e=t),this.pin("scaleX",t),this.pin("scaleY",e),this},t.prototype.alpha=function(t,e){return this.pin("alpha",t),"undefined"!=typeof e&&this.pin("textureAlpha",e),this}},i._add_shortcuts(r),e.exports=i},{"./core":8,"./matrix":15}],17:[function(t){function e(t,i){e._super.call(this),this.label("Root");var r=!0,s=this,o=0,h=function(e){if(r!==!0){n.tick=n.node=n.draw=0;var a=o||e,u=e-a;o=e;var f=s._tick(u,e,a);s._mo_touch!=s._ts_touch?(s._mo_touch=s._ts_touch,i(s),t(h)):f?t(h):r=!0,n.fps=u?1e3/u:0}};this.start=function(){return this.resume()},this.resume=function(){return r&&(this.publish("resume"),r=!1,t(h)),this},this.pause=function(){return r||this.publish("pause"),r=!0,this},this.touch_root=this.touch,this.touch=function(){return this.resume(),this.touch_root()}}var i=t("./core");t("./pin"),t("./loop");var n=t("./util/stats"),r=t("./util/create"),s=t("./util/extend");e._super=i,e.prototype=r(e._super.prototype),i.root=function(t,i){return new e(t,i)},e.prototype.background=function(){return this},e.prototype.viewport=function(t,e,i){if("undefined"==typeof t)return s({},this._viewport);this._viewport={width:t,height:e,ratio:i||1},this.viewbox();var n=s({},this._viewport);return this.visit({start:function(t){return t._flag("viewport")?void t.publish("viewport",[n]):!0}}),this},e.prototype.viewbox=function(t,e,i){"number"==typeof t&&"number"==typeof e&&(this._viewbox={width:t,height:e,mode:/^(in|out|in-pad|out-crop)$/.test(i)?i:"in-pad"});var n=this._viewbox,r=this._viewport;return r&&n?(this.pin({width:n.width,height:n.height}),this.scaleTo(r.width,r.height,n.mode)):r&&this.pin({width:r.width,height:r.height}),this}},{"./core":8,"./loop":14,"./pin":16,"./util/create":22,"./util/extend":24,"./util/stats":29}],18:[function(t){function e(){e._super.call(this),this.label("String"),this._textures=[]}var i=t("./core");t("./pin"),t("./loop");var n=t("./util/create"),r=t("./util/is");i.string=function(t){return(new e).frames(t)},e._super=i,e.prototype=n(e._super.prototype),e.prototype.setFont=function(t,e,i){return this.frames(t,e,i)},e.prototype.frames=function(t){return this._textures=[],"string"==typeof t?(t=i.texture(t),this._item=function(e){return t.one(e)}):"object"==typeof t?this._item=function(e){return t[e]}:"function"==typeof t&&(this._item=t),this},e.prototype.setValue=function(t,e,i){return this.value(t,e,i)},e.prototype.value=function(t){if("undefined"==typeof t)return this._value;if(this._value===t)return this;this._value=t,null===t?t="":"string"==typeof t||r.array(t)||(t=t.toString()),this._spacing=this._spacing||0;for(var e=0,i=0,n=0;n<t.length;n++){var s=this._textures[n]=this._item(t[n]);e+=n>0?this._spacing:0,s.dest(e,0),e+=s.width,i=Math.max(i,s.height)}return this.pin("width",e),this.pin("height",i),this._textures.length=t.length,this}},{"./core":8,"./loop":14,"./pin":16,"./util/create":22,"./util/is":25}],19:[function(t,e){function i(t,e){"object"==typeof t&&this.src(t,e)}var n=t("./util/stats"),r=t("./util/math");i.prototype.pipe=function(){return new i(this)},i.prototype.src=function(t,e,i,n){if("object"==typeof t){var r=t,s=e||1;this._image=r,this._sx=this._dx=0,this._sy=this._dy=0,this._sw=this._dw=r.width/s,this._sh=this._dh=r.height/s,this.width=r.width/s,this.height=r.height/s,this.ratio=s}else"undefined"==typeof i?(i=t,n=e):(this._sx=t,this._sy=e),this._sw=this._dw=i,this._sh=this._dh=n,this.width=i,this.height=n;return this},i.prototype.dest=function(t,e,i,n){return this._dx=t,this._dy=e,this._dx=t,this._dy=e,"undefined"!=typeof i&&(this._dw=i,this._dh=n,this.width=i,this.height=n),this},i.prototype.draw=function(t,e,i,s,o,h,a,u,f){var c=this._image;if(null!==c&&"object"==typeof c){var p=this._sx,l=this._sy,_=this._sw,d=this._sh,g=this._dx,y=this._dy,m=this._dw,v=this._dh;"undefined"!=typeof h?(e=r.limit(e,0,this._sw),s=r.limit(s,0,this._sw-e),i=r.limit(i,0,this._sh),o=r.limit(o,0,this._sh-i),p+=e,l+=i,_=s,d=o,g=h,y=a,m=u,v=f):"undefined"!=typeof s?(g=e,y=i,m=s,v=o):"undefined"!=typeof e&&(m=e,v=i);var x=this.ratio||1;p*=x,l*=x,_*=x,d*=x;try{"function"==typeof c.draw?c.draw(t,p,l,_,d,g,y,m,v):(n.draw++,t.drawImage(c,p,l,_,d,g,y,m,v))}catch(b){c._draw_failed||(console.log("Unable to draw: ",c),console.log(b),c._draw_failed=!0)}}},e.exports=i},{"./util/math":26,"./util/stats":29}],20:[function(t,e){function i(t,e){o(e),o(t),e.remove(),t._last&&(t._last._next=e,e._prev=t._last),e._parent=t,t._last=e,t._first||(t._first=e),e._parent._flag(e,!0),e._ts_parent=++u,t._ts_children=++u,t.touch()}function n(t,e){o(e),o(t),e.remove(),t._first&&(t._first._prev=e,e._next=t._first),e._parent=t,t._first=e,t._last||(t._last=e),e._parent._flag(e,!0),e._ts_parent=++u,t._ts_children=++u,t.touch()}function r(t,e){o(t),o(e),t.remove();var i=e._parent,n=e._prev;e._prev=t,n&&(n._next=t)||i&&(i._first=t),t._parent=i,t._prev=n,t._next=e,t._parent._flag(t,!0),t._ts_parent=++u,t.touch()}function s(t,e){o(t),o(e),t.remove();var i=e._parent,n=e._next;e._next=t,n&&(n._prev=t)||i&&(i._last=t),t._parent=i,t._prev=e,t._next=n,t._parent._flag(t,!0),t._ts_parent=++u,t.touch()}function o(t){if(t&&t instanceof h)return t;throw"Invalid node: "+t}var h=t("./core"),a=t("./util/is"),u=0;h.prototype._label="",h.prototype._visible=!0,h.prototype._parent=null,h.prototype._next=null,h.prototype._prev=null,h.prototype._first=null,h.prototype._last=null,h.prototype._attrs=null,h.prototype._flags=null,h.prototype.toString=function(){return"["+this._label+"]"},h.prototype.id=function(t){return this.label(t)},h.prototype.label=function(t){return"undefined"==typeof t?this._label:(this._label=t,this)},h.prototype.attr=function(t,e){return"undefined"==typeof e?null!==this._attrs?this._attrs[t]:void 0:((null!==this._attrs?this._attrs:this._attrs={})[t]=e,this)},h.prototype.visible=function(t){return"undefined"==typeof t?this._visible:(this._visible=t,this._parent&&(this._parent._ts_children=++u),this._ts_pin=++u,this.touch(),this)},h.prototype.hide=function(){return this.visible(!1)},h.prototype.show=function(){return this.visible(!0)},h.prototype.parent=function(){return this._parent},h.prototype.next=function(t){for(var e=this._next;e&&t&&!e._visible;)e=e._next;return e},h.prototype.prev=function(t){for(var e=this._prev;e&&t&&!e._visible;)e=e._prev;return e},h.prototype.first=function(t){for(var e=this._first;e&&t&&!e._visible;)e=e._next;return e},h.prototype.last=function(t){for(var e=this._last;e&&t&&!e._visible;)e=e._prev;return e},h.prototype.visit=function(t,e){var i=t.reverse,n=t.visible;if(!t.start||!t.start(this,e)){for(var r,s=i?this.last(n):this.first(n);r=s;)if(s=i?r.prev(n):r.next(n),r.visit(t,e))return!0;return t.end&&t.end(this,e)}},h.prototype.append=function(t,e){if(a.array(t))for(var n=0;n<t.length;n++)i(this,t[n]);else if("undefined"!=typeof e)for(var n=0;n<arguments.length;n++)i(this,arguments[n]);else"undefined"!=typeof t&&i(this,t);return this},h.prototype.prepend=function(t,e){if(a.array(t))for(var i=t.length-1;i>=0;i--)n(this,t[i]);else if("undefined"!=typeof e)for(var i=arguments.length-1;i>=0;i--)n(this,arguments[i]);else"undefined"!=typeof t&&n(this,t);return this},h.prototype.appendTo=function(t){return i(t,this),this},h.prototype.prependTo=function(t){return n(t,this),this},h.prototype.insertNext=function(t,e){if(a.array(t))for(var i=0;i<t.length;i++)s(t[i],this);else if("undefined"!=typeof e)for(var i=0;i<arguments.length;i++)s(arguments[i],this);else"undefined"!=typeof t&&s(t,this);return this},h.prototype.insertPrev=function(t,e){if(a.array(t))for(var i=t.length-1;i>=0;i--)r(t[i],this);else if("undefined"!=typeof e)for(var i=arguments.length-1;i>=0;i--)r(arguments[i],this);else"undefined"!=typeof t&&r(t,this);return this},h.prototype.insertAfter=function(t){return s(this,t),this},h.prototype.insertBefore=function(t){return r(this,t),this},h.prototype.remove=function(t,e){if("undefined"!=typeof t){if(a.array(t))for(var i=0;i<t.length;i++)o(t[i]).remove();else if("undefined"!=typeof e)for(var i=0;i<arguments.length;i++)o(arguments[i]).remove();else o(t).remove();return this}return this._prev&&(this._prev._next=this._next),this._next&&(this._next._prev=this._prev),this._parent&&(this._parent._first===this&&(this._parent._first=this._next),this._parent._last===this&&(this._parent._last=this._prev),this._parent._flag(this,!1),this._parent._ts_children=++u,this._parent.touch()),this._prev=this._next=this._parent=null,this._ts_parent=++u,this},h.prototype.empty=function(){for(var t,e=this._first;t=e;)e=t._next,t._prev=t._next=t._parent=null,this._flag(t,!1);return this._first=this._last=null,this._ts_children=++u,this.touch(),this},h.prototype.touch=function(){return this._ts_touch=++u,this._parent&&this._parent.touch(),this},h.prototype._flag=function(t,e){if("undefined"==typeof e)return null!==this._flags&&this._flags[t]||0;if("string"==typeof t&&(e?(this._flags=this._flags||{},!this._flags[t]&&this._parent&&this._parent._flag(t,!0),this._flags[t]=(this._flags[t]||0)+1):this._flags&&this._flags[t]>0&&(1==this._flags[t]&&this._parent&&this._parent._flag(t,!1),this._flags[t]=this._flags[t]-1)),"object"==typeof t&&t._flags)for(var i in t._flags)t._flags[i]>0&&this._flag(i,e);return this},h.prototype.hitTest=function(t){return this.attr("spy")?!0:t.x>=0&&t.x<=this._pin._width&&t.y>=0&&t.y<=this._pin._height},e.exports=h},{"./core":8,"./util/is":25}],21:[function(t,e){e.exports=function(){function t(t,n){return i+=n="number"==typeof n&&n>=1?n:1,function(){t&&t.apply(this,arguments),n>0&&(n--,i--,e())}}function e(){if(0===i)for(;n.length;)setTimeout(n.shift(),0)}var i=0,n=[];return t.then=function(t){0===i?setTimeout(t,0):n.push(t)},t}},{}],22:[function(t,e){function i(){}e.exports="function"==typeof Object.create?function(t,e){return Object.create.call(Object,t,e)}:function(t,e){if(e)throw Error("Second argument is not supported!");if("object"!=typeof t||null===t)throw Error("Invalid prototype!");return i.prototype=t,new i}},{}],23:[function(t,e){e.exports=function(t,e){t._listeners=null,t.on=t.listen=function(t,i){if(!t||!t.length||"function"!=typeof i)return this;null===this._listeners&&(this._listeners={});var n="string"!=typeof t&&"function"==typeof t.join;if(t=(n?t.join(" "):t).match(/\S+/g))for(var r=0;r<t.length;r++){var s=t[r];this._listeners[s]=this._listeners[s]||[],this._listeners[s].push(i),"function"==typeof e&&e(this,s,!0)}return this},t.off=function(t,i){if(!t||!t.length||"function"!=typeof i)return this;if(null===this._listeners)return this;var n="string"!=typeof t&&"function"==typeof t.join;if(t=(n?t.join(" "):t).match(/\S+/g))for(var r=0;r<t.length;r++){var s,o=t[r],h=this._listeners[o];h&&(s=h.indexOf(i))>=0&&(h.splice(s,1),h.length||delete this._listeners[o],"function"==typeof e&&e(this,o,!1))}return this},t.listeners=function(t){return this._listeners&&this._listeners[t]},t.publish=function(t,e){var i=this.listeners(t);if(!i||!i.length)return 0;for(var n=0;n<i.length;n++)i[n].apply(this,e);return i.length},t.trigger=function(t,e){return this.publish(t,e),this}}},{}],24:[function(t,e){e.exports=function(t){for(var e=1;e<arguments.length;e++){var i=arguments[e];for(var n in i)i.hasOwnProperty(n)&&(t[n]=i[n])}return t}},{}],25:[function(t,e){var i=Object.prototype,n=i.hasOwnProperty,r=i.toString,s=/^[A-Fa-f0-9]+$/,o=e.exports={};o.a=o.an=o.type=function(t,e){return typeof t===e},o.defined=function(t){return"undefined"!=typeof t},o.empty=function(t){var e,i=r.call(t);if("[object Array]"===i||"[object Arguments]"===i||"[object String]"===i)return 0===t.length;if("[object Object]"===i){for(e in t)if(n.call(t,e))return!1;return!0}return!t},o.equal=function(t,e){if(t===e)return!0;var i,n=r.call(t);if(n!==r.call(e))return!1;if("[object Object]"===n){for(i in t)if(!(o.equal(t[i],e[i])&&i in e))return!1;for(i in e)if(!(o.equal(t[i],e[i])&&i in t))return!1;return!0}if("[object Array]"===n){if(i=t.length,i!==e.length)return!1;for(;--i;)if(!o.equal(t[i],e[i]))return!1;return!0}return"[object Function]"===n?t.prototype===e.prototype:"[object Date]"===n?t.getTime()===e.getTime():!1},o.instance=function(t,e){return t instanceof e},o.nil=function(t){return null===t},o.undef=function(t){return"undefined"==typeof t},o.array=function(t){return"[object Array]"===r.call(t)},o.emptyarray=function(t){return o.array(t)&&0===t.length},o.arraylike=function(t){return!!t&&!o["boolean"](t)&&n.call(t,"length")&&isFinite(t.length)&&o.number(t.length)&&t.length>=0},o["boolean"]=function(t){return"[object Boolean]"===r.call(t)},o.element=function(t){return void 0!==t&&"undefined"!=typeof HTMLElement&&t instanceof HTMLElement&&1===t.nodeType},o.fn=function(t){return"[object Function]"===r.call(t)},o.number=function(t){return"[object Number]"===r.call(t)},o.nan=function(t){return!o.number(t)||t!==t},o.object=function(t){return"[object Object]"===r.call(t)},o.hash=function(t){return o.object(t)&&t.constructor===Object&&!t.nodeType&&!t.setInterval},o.regexp=function(t){return"[object RegExp]"===r.call(t)},o.string=function(t){return"[object String]"===r.call(t)},o.hex=function(t){return o.string(t)&&(!t.length||s.test(t))}},{}],26:[function(t,e){var i=t("./create"),n=Math;e.exports=i(Math),e.exports.random=function(t,e){return"undefined"==typeof t?(e=1,t=0):"undefined"==typeof e&&(e=t,t=0),t==e?t:n.random()*(e-t)+t},e.exports.rotate=function(t,e,i){return"undefined"==typeof e?(i=1,e=0):"undefined"==typeof i&&(i=e,e=0),i>e?(t=(t-e)%(i-e),t+(0>t?i:e)):(t=(t-i)%(e-i),t+(0>=t?e:i))},e.exports.limit=function(t,e,i){return e>t?e:t>i?i:t},e.exports.length=function(t,e){return n.sqrt(t*t+e*e)}},{"./create":22}],27:[function(t,e){e.exports=function(t,e){var i=!1;return function(){i||(i=!0,t.apply(e,arguments))}}},{}],28:[function(t,e){e.exports=function(t,e,i,n,r,s){var o=t.width,h=t.height,a=t.left,u=t.right,f=t.top,c=t.bottom;a="number"==typeof a&&a===a?a:0,u="number"==typeof u&&u===u?u:0,f="number"==typeof f&&f===f?f:0,c="number"==typeof c&&c===c?c:0,o=o-a-u,h=h-f-c,r||(e=Math.max(e-a-u,0),i=Math.max(i-f-c,0));var p=0;if(f>0&&a>0&&s(p++,0,0,a,f,0,0,a,f),c>0&&a>0&&s(p++,0,h+f,a,c,0,i+f,a,c),f>0&&u>0&&s(p++,o+a,0,u,f,e+a,0,u,f),c>0&&u>0&&s(p++,o+a,h+f,u,c,e+a,i+f,u,c),n)f>0&&s(p++,a,0,o,f,a,0,e,f),c>0&&s(p++,a,h+f,o,c,a,i+f,e,c),a>0&&s(p++,0,f,a,h,0,f,a,i),u>0&&s(p++,o+a,f,u,h,e+a,f,u,i),s(p++,a,f,o,h,a,f,e,i);else for(var l,_=a,d=e;d>0;){l=Math.min(o,d),d-=o;for(var g,y=f,m=i;m>0;)g=Math.min(h,m),m-=h,s(p++,a,f,l,g,_,y,l,g),0>=d&&(a&&s(p++,0,f,a,g,0,y,a,g),u&&s(p++,o+a,f,u,g,_+l,y,u,g)),y+=g;f&&s(p++,a,0,l,f,_,0,l,f),c&&s(p++,a,h+f,l,c,_,y,l,c),_+=l}return p}},{}],29:[function(t,e){e.exports={}},{}],30:[function(t,e){e.exports.startsWith=function(t,e){return"string"==typeof t&&"string"==typeof e&&t.substring(0,e.length)==e}},{}]},{},[1])(1)});
!function(t,i){"object"==typeof exports&&"object"==typeof module?module.exports=i():"function"==typeof define&&define.amd?define([],i):"object"==typeof exports?exports.Stage=i():t.Stage=i()}(window,(function(){return function(t){var i={};function e(n){if(i[n])return i[n].exports;var r=i[n]={i:n,l:!1,exports:{}};return t[n].call(r.exports,r,r.exports,e),r.l=!0,r.exports}return e.m=t,e.c=i,e.d=function(t,i,n){e.o(t,i)||Object.defineProperty(t,i,{enumerable:!0,get:n})},e.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},e.t=function(t,i){if(1&i&&(t=e(t)),8&i)return t;if(4&i&&"object"==typeof t&&t&&t.__esModule)return t;var n=Object.create(null);if(e.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:t}),2&i&&"string"!=typeof t)for(var r in t)e.d(n,r,function(i){return t[i]}.bind(null,r));return n},e.n=function(t){var i=t&&t.__esModule?function(){return t.default}:function(){return t};return e.d(i,"a",i),i},e.o=function(t,i){return Object.prototype.hasOwnProperty.call(t,i)},e.p="",e(e.s=29)}([function(t,i,e){var n=e(4),r=e(5),s=e(6),o=e(11);function h(t){if(!(this instanceof h))return s.fn(t)?h.app.apply(h,arguments):s.object(t)?h.atlas.apply(h,arguments):t;n.create++;for(var i=0;i<a.length;i++)a[i].call(this)}n.create=0;var a=[];h._init=function(t){a.push(t)};var u=[];h._load=function(t){u.push(t)};var f={};h.config=function(){if(1===arguments.length&&s.string(arguments[0]))return f[arguments[0]];1===arguments.length&&s.object(arguments[0])&&r(f,arguments[0]),2===arguments.length&&s.string(arguments[0])};var c=[],p=[],_=!1,l=!1;h.app=function(t,i){if(_){var e=h.config("app-loader");e((function(i,e){for(var n=0;n<u.length;n++)u[n].call(this,i,e);t(i,e),p.push(i),i.start()}),i)}else c.push(arguments)};var d=o();h.preload=function(t){if("string"==typeof t){var i=h.resolve(t);/\.js($|\?|\#)/.test(i)&&(t=function(t){!function(t,i){var e=document.createElement("script");e.addEventListener("load",(function(){i()})),e.addEventListener("error",(function(e){i(e||"Error loading script: "+t)})),e.src=t,e.id="preload-"+Date.now(),document.body.appendChild(e)}(i,t)})}"function"==typeof t&&t(d())},h.start=function(t){h.config(t),d.then((function(){for(_=!0;c.length;){var t=c.shift();h.app.apply(h,t)}}))},h.pause=function(){if(!l){l=!0;for(var t=p.length-1;t>=0;t--)p[t].pause()}},h.resume=function(){if(l){l=!1;for(var t=p.length-1;t>=0;t--)p[t].resume()}},h.create=function(){return new h},h.resolve=function(){if("undefined"==typeof window||"undefined"==typeof document)return function(t){return t};var t=document.getElementsByTagName("script");return function(i){if(/^\.\//.test(i)){var e=function(){if(document.currentScript)return document.currentScript.src;var i;try{var e=new Error;if(!e.stack)throw e;i=e.stack}catch(e){i=e.stack}if("string"==typeof i)for(var n=(i=i.split("\n")).length;n--;){var r=i[n].match(/(\w+\:\/\/[^/]*?\/.+?)(:\d+)(:\d+)?/);if(r)return r[1]}if(t.length&&"readyState"in t[0])for(n=t.length;n--;)if("interactive"===t[n].readyState)return t[n].src;return location.href}();i=e.substring(0,e.lastIndexOf("/")+1)+i.substring(2)}return i}}(),t.exports=h},function(t,i){if("function"==typeof Object.create)t.exports=function(t,i){return Object.create.call(Object,t,i)};else{function e(){}t.exports=function(t,i){if(i)throw Error("Second argument is not supported!");if("object"!=typeof t||null===t)throw Error("Invalid prototype!");return e.prototype=t,new e}}},function(t,i,e){var n=e(0),r=e(9),s=0;function o(t){this._owner=t,this._parent=null,this._relativeMatrix=new r,this._absoluteMatrix=new r,this.reset()}n._init((function(){this._pin=new o(this)})),n.prototype.matrix=function(t){return!0===t?this._pin.relativeMatrix():this._pin.absoluteMatrix()},n.prototype.pin=function(t,i){return"object"==typeof t?(this._pin.set(t),this):"string"==typeof t?void 0===i?this._pin.get(t):(this._pin.set(t,i),this):void 0===t?this._pin:void 0},o.prototype.reset=function(){this._textureAlpha=1,this._alpha=1,this._width=0,this._height=0,this._scaleX=1,this._scaleY=1,this._skewX=0,this._skewY=0,this._rotation=0,this._pivoted=!1,this._pivotX=null,this._pivotY=null,this._handled=!1,this._handleX=0,this._handleY=0,this._aligned=!1,this._alignX=0,this._alignY=0,this._offsetX=0,this._offsetY=0,this._boxX=0,this._boxY=0,this._boxWidth=this._width,this._boxHeight=this._height,this._ts_translate=++s,this._ts_transform=++s,this._ts_matrix=++s},o.prototype._update=function(){return this._parent=this._owner._parent&&this._owner._parent._pin,this._handled&&this._mo_handle!=this._ts_transform&&(this._mo_handle=this._ts_transform,this._ts_translate=++s),this._aligned&&this._parent&&this._mo_align!=this._parent._ts_transform&&(this._mo_align=this._parent._ts_transform,this._ts_translate=++s),this},o.prototype.toString=function(){return this._owner+" ("+(this._parent?this._parent._owner:null)+")"},o.prototype.absoluteMatrix=function(){this._update();var t=Math.max(this._ts_transform,this._ts_translate,this._parent?this._parent._ts_matrix:0);if(this._mo_abs==t)return this._absoluteMatrix;this._mo_abs=t;var i=this._absoluteMatrix;return i.reset(this.relativeMatrix()),this._parent&&i.concat(this._parent._absoluteMatrix),this._ts_matrix=++s,i},o.prototype.relativeMatrix=function(){this._update();var t=Math.max(this._ts_transform,this._ts_translate,this._parent?this._parent._ts_transform:0);if(this._mo_rel==t)return this._relativeMatrix;this._mo_rel=t;var i,e,n=this._relativeMatrix;(n.identity(),this._pivoted&&n.translate(-this._pivotX*this._width,-this._pivotY*this._height),n.scale(this._scaleX,this._scaleY),n.skew(this._skewX,this._skewY),n.rotate(this._rotation),this._pivoted&&n.translate(this._pivotX*this._width,this._pivotY*this._height),this._pivoted)?(this._boxX=0,this._boxY=0,this._boxWidth=this._width,this._boxHeight=this._height):(n.a>0&&n.c>0||n.a<0&&n.c<0?(i=0,e=n.a*this._width+n.c*this._height):(i=n.a*this._width,e=n.c*this._height),i>e?(this._boxX=e,this._boxWidth=i-e):(this._boxX=i,this._boxWidth=e-i),n.b>0&&n.d>0||n.b<0&&n.d<0?(i=0,e=n.b*this._width+n.d*this._height):(i=n.b*this._width,e=n.d*this._height),i>e?(this._boxY=e,this._boxHeight=i-e):(this._boxY=i,this._boxHeight=e-i));return this._x=this._offsetX,this._y=this._offsetY,this._x-=this._boxX+this._handleX*this._boxWidth,this._y-=this._boxY+this._handleY*this._boxHeight,this._aligned&&this._parent&&(this._parent.relativeMatrix(),this._x+=this._alignX*this._parent._width,this._y+=this._alignY*this._parent._height),n.translate(this._x,this._y),this._relativeMatrix},o.prototype.get=function(t){if("function"==typeof h[t])return h[t](this)},o.prototype.set=function(t,i){if("string"==typeof t)"function"==typeof a[t]&&void 0!==i&&a[t](this,i);else if("object"==typeof t)for(i in t)"function"==typeof a[i]&&void 0!==t[i]&&a[i](this,t[i],t);return this._owner&&(this._owner._ts_pin=++s,this._owner.touch()),this};var h={alpha:function(t){return t._alpha},textureAlpha:function(t){return t._textureAlpha},width:function(t){return t._width},height:function(t){return t._height},boxWidth:function(t){return t._boxWidth},boxHeight:function(t){return t._boxHeight},scaleX:function(t){return t._scaleX},scaleY:function(t){return t._scaleY},skewX:function(t){return t._skewX},skewY:function(t){return t._skewY},rotation:function(t){return t._rotation},pivotX:function(t){return t._pivotX},pivotY:function(t){return t._pivotY},offsetX:function(t){return t._offsetX},offsetY:function(t){return t._offsetY},alignX:function(t){return t._alignX},alignY:function(t){return t._alignY},handleX:function(t){return t._handleX},handleY:function(t){return t._handleY}},a={alpha:function(t,i){t._alpha=i},textureAlpha:function(t,i){t._textureAlpha=i},width:function(t,i){t._width_=i,t._width=i,t._ts_transform=++s},height:function(t,i){t._height_=i,t._height=i,t._ts_transform=++s},scale:function(t,i){t._scaleX=i,t._scaleY=i,t._ts_transform=++s},scaleX:function(t,i){t._scaleX=i,t._ts_transform=++s},scaleY:function(t,i){t._scaleY=i,t._ts_transform=++s},skew:function(t,i){t._skewX=i,t._skewY=i,t._ts_transform=++s},skewX:function(t,i){t._skewX=i,t._ts_transform=++s},skewY:function(t,i){t._skewY=i,t._ts_transform=++s},rotation:function(t,i){t._rotation=i,t._ts_transform=++s},pivot:function(t,i){t._pivotX=i,t._pivotY=i,t._pivoted=!0,t._ts_transform=++s},pivotX:function(t,i){t._pivotX=i,t._pivoted=!0,t._ts_transform=++s},pivotY:function(t,i){t._pivotY=i,t._pivoted=!0,t._ts_transform=++s},offset:function(t,i){t._offsetX=i,t._offsetY=i,t._ts_translate=++s},offsetX:function(t,i){t._offsetX=i,t._ts_translate=++s},offsetY:function(t,i){t._offsetY=i,t._ts_translate=++s},align:function(t,i){this.alignX(t,i),this.alignY(t,i)},alignX:function(t,i){t._alignX=i,t._aligned=!0,t._ts_translate=++s,this.handleX(t,i)},alignY:function(t,i){t._alignY=i,t._aligned=!0,t._ts_translate=++s,this.handleY(t,i)},handle:function(t,i){this.handleX(t,i),this.handleY(t,i)},handleX:function(t,i){t._handleX=i,t._handled=!0,t._ts_translate=++s},handleY:function(t,i){t._handleY=i,t._handled=!0,t._ts_translate=++s},resizeMode:function(t,i,e){e&&("in"==i?i="in-pad":"out"==i&&(i="out-crop"),u(t,e.resizeWidth,e.resizeHeight,i))},resizeWidth:function(t,i,e){e&&e.resizeMode||u(t,i,null)},resizeHeight:function(t,i,e){e&&e.resizeMode||u(t,null,i)},scaleMode:function(t,i,e){e&&u(t,e.scaleWidth,e.scaleHeight,i)},scaleWidth:function(t,i,e){e&&e.scaleMode||u(t,i,null)},scaleHeight:function(t,i,e){e&&e.scaleMode||u(t,null,i)},matrix:function(t,i){this.scaleX(t,i.a),this.skewX(t,i.c/i.d),this.skewY(t,i.b/i.a),this.scaleY(t,i.d),this.offsetX(t,i.e),this.offsetY(t,i.f),this.rotation(t,0)}};function u(t,i,e,n){var r="number"==typeof i,o="number"==typeof e,h="string"==typeof n;t._ts_transform=++s,r&&(t._scaleX=i/t._width_,t._width=t._width_),o&&(t._scaleY=e/t._height_,t._height=t._height_),r&&o&&h&&("out"==n||"out-crop"==n?t._scaleX=t._scaleY=Math.max(t._scaleX,t._scaleY):"in"!=n&&"in-pad"!=n||(t._scaleX=t._scaleY=Math.min(t._scaleX,t._scaleY)),"out-crop"!=n&&"in-pad"!=n||(t._width=i/t._scaleX,t._height=e/t._scaleY))}n.prototype.scaleTo=function(t,i,e){return"object"==typeof t&&(e=i,i=t.y,t=t.x),u(this._pin,t,i,e),this},o._add_shortcuts=function(t){t.prototype.size=function(t,i){return this.pin("width",t),this.pin("height",i),this},t.prototype.width=function(t){return void 0===t?this.pin("width"):(this.pin("width",t),this)},t.prototype.height=function(t){return void 0===t?this.pin("height"):(this.pin("height",t),this)},t.prototype.offset=function(t,i){return"object"==typeof t&&(i=t.y,t=t.x),this.pin("offsetX",t),this.pin("offsetY",i),this},t.prototype.rotate=function(t){return this.pin("rotation",t),this},t.prototype.skew=function(t,i){return"object"==typeof t?(i=t.y,t=t.x):void 0===i&&(i=t),this.pin("skewX",t),this.pin("skewY",i),this},t.prototype.scale=function(t,i){return"object"==typeof t?(i=t.y,t=t.x):void 0===i&&(i=t),this.pin("scaleX",t),this.pin("scaleY",i),this},t.prototype.alpha=function(t,i){return this.pin("alpha",t),void 0!==i&&this.pin("textureAlpha",i),this}},o._add_shortcuts(n),t.exports=o},function(t,i,e){var n=e(0);e(2);var r=e(4);n.prototype._textures=null,n.prototype._alpha=1,n.prototype.render=function(t){if(this._visible){r.node++;var i=this.matrix();t.setTransform(i.a,i.b,i.c,i.d,i.e,i.f),this._alpha=this._pin._alpha*(this._parent?this._parent._alpha:1);var e=this._pin._textureAlpha*this._alpha;if(t.globalAlpha!=e&&(t.globalAlpha=e),null!==this._textures)for(var n=0,s=this._textures.length;n<s;n++)this._textures[n].draw(t);t.globalAlpha!=this._alpha&&(t.globalAlpha=this._alpha);for(var o,h=this._first;o=h;)h=o._next,o.render(t)}},n.prototype._tickBefore=null,n.prototype._tickAfter=null,n.prototype.MAX_ELAPSE=1/0,n.prototype._tick=function(t,i,e){if(this._visible){t>this.MAX_ELAPSE&&(t=this.MAX_ELAPSE);var n=!1;if(null!==this._tickBefore)for(var s=0;s<this._tickBefore.length;s++){r.tick++,n=!0===this._tickBefore[s].call(this,t,i,e)||n}for(var o,h=this._first;o=h;)h=o._next,o._flag("_tick")&&(n=!0===o._tick(t,i,e)||n);if(null!==this._tickAfter)for(s=0;s<this._tickAfter.length;s++){r.tick++,n=!0===this._tickAfter[s].call(this,t,i,e)||n}return n}},n.prototype.tick=function(t,i){"function"==typeof t&&(i?(null===this._tickBefore&&(this._tickBefore=[]),this._tickBefore.push(t)):(null===this._tickAfter&&(this._tickAfter=[]),this._tickAfter.push(t)),this._flag("_tick",null!==this._tickAfter&&this._tickAfter.length>0||null!==this._tickBefore&&this._tickBefore.length>0))},n.prototype.untick=function(t){var i;"function"==typeof t&&(null!==this._tickBefore&&(i=this._tickBefore.indexOf(t))>=0&&this._tickBefore.splice(i,1),null!==this._tickAfter&&(i=this._tickAfter.indexOf(t))>=0&&this._tickAfter.splice(i,1))},n.prototype.timeout=function(t,i){this.setTimeout(t,i)},n.prototype.setTimeout=function(t,i){function e(n){if(!((i-=n)<0))return!0;this.untick(e),t.call(this)}return this.tick(e),e},n.prototype.clearTimeout=function(t){this.untick(t)}},function(t,i){t.exports={}},function(t,i){t.exports=function(t){for(var i=1;i<arguments.length;i++){var e=arguments[i];for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])}return t}},function(t,i){
/**
* ! is the definitive JavaScript type testing library
*
* @copyright 2013-2014 Enrico Marino / Jordan Harband
* @license MIT
*/
var e=Object.prototype,n=e.hasOwnProperty,r=e.toString,s=/^[A-Fa-f0-9]+$/,o=t.exports={};o.a=o.an=o.type=function(t,i){return typeof t===i},o.defined=function(t){return void 0!==t},o.empty=function(t){var i,e=r.call(t);if("[object Array]"===e||"[object Arguments]"===e||"[object String]"===e)return 0===t.length;if("[object Object]"===e){for(i in t)if(n.call(t,i))return!1;return!0}return!t},o.equal=function(t,i){if(t===i)return!0;var e,n=r.call(t);if(n!==r.call(i))return!1;if("[object Object]"===n){for(e in t)if(!o.equal(t[e],i[e])||!(e in i))return!1;for(e in i)if(!o.equal(t[e],i[e])||!(e in t))return!1;return!0}if("[object Array]"===n){if((e=t.length)!==i.length)return!1;for(;--e;)if(!o.equal(t[e],i[e]))return!1;return!0}return"[object Function]"===n?t.prototype===i.prototype:"[object Date]"===n&&t.getTime()===i.getTime()},o.instance=function(t,i){return t instanceof i},o.nil=function(t){return null===t},o.undef=function(t){return void 0===t},o.array=function(t){return"[object Array]"===r.call(t)},o.emptyarray=function(t){return o.array(t)&&0===t.length},o.arraylike=function(t){return!!t&&!o.boolean(t)&&n.call(t,"length")&&isFinite(t.length)&&o.number(t.length)&&t.length>=0},o.boolean=function(t){return"[object Boolean]"===r.call(t)},o.element=function(t){return void 0!==t&&"undefined"!=typeof HTMLElement&&t instanceof HTMLElement&&1===t.nodeType},o.fn=function(t){return"[object Function]"===r.call(t)},o.number=function(t){return"[object Number]"===r.call(t)},o.nan=function(t){return!o.number(t)||t!=t},o.object=function(t){return"[object Object]"===r.call(t)},o.hash=function(t){return o.object(t)&&t.constructor===Object&&!t.nodeType&&!t.setInterval},o.regexp=function(t){return"[object RegExp]"===r.call(t)},o.string=function(t){return"[object String]"===r.call(t)},o.hex=function(t){return o.string(t)&&(!t.length||s.test(t))}},function(t,i,e){var n=e(4),r=e(8);function s(t,i){"object"==typeof t&&this.src(t,i)}s.prototype.pipe=function(){return new s(this)},s.prototype.src=function(t,i,e,n){if("object"==typeof t){var r=t,s=i||1;this._image=r,this._sx=this._dx=0,this._sy=this._dy=0,this._sw=this._dw=r.width/s,this._sh=this._dh=r.height/s,this.width=r.width/s,this.height=r.height/s,this.ratio=s}else void 0===e?(e=t,n=i):(this._sx=t,this._sy=i),this._sw=this._dw=e,this._sh=this._dh=n,this.width=e,this.height=n;return this},s.prototype.dest=function(t,i,e,n){return this._dx=t,this._dy=i,this._dx=t,this._dy=i,void 0!==e&&(this._dw=e,this._dh=n,this.width=e,this.height=n),this},s.prototype.draw=function(t,i,e,s,o,h,a,u,f){var c=this._image;if(null!==c&&"object"==typeof c){var p=this._sx,_=this._sy,l=this._sw,d=this._sh,v=this._dx,g=this._dy,y=this._dw,m=this._dh;void 0!==h?(i=r.limit(i,0,this._sw),s=r.limit(s,0,this._sw-i),p+=i,_+=e=r.limit(e,0,this._sh),l=s,d=o=r.limit(o,0,this._sh-e),v=h,g=a,y=u,m=f):void 0!==s?(v=i,g=e,y=s,m=o):void 0!==i&&(y=i,m=e);var x=this.ratio||1;p*=x,_*=x,l*=x,d*=x;try{"function"==typeof c.draw?c.draw(t,p,_,l,d,v,g,y,m):(n.draw++,t.drawImage(c,p,_,l,d,v,g,y,m))}catch(t){c._draw_failed||(console.log("Unable to draw: ",c),console.log(t),c._draw_failed=!0)}}},t.exports=s},function(t,i,e){var n=e(1),r=Math;t.exports=n(Math),t.exports.random=function(t,i){return void 0===t?(i=1,t=0):void 0===i&&(i=t,t=0),t==i?t:r.random()*(i-t)+t},t.exports.rotate=function(t,i,e){return void 0===i?(e=1,i=0):void 0===e&&(e=i,i=0),e>i?(t=(t-i)%(e-i))+(t<0?e:i):(t=(t-e)%(i-e))+(t<=0?i:e)},t.exports.limit=function(t,i,e){return t<i?i:t>e?e:t},t.exports.length=function(t,i){return r.sqrt(t*t+i*i)}},function(t,i){function e(t,i,e,n,r,s){this.reset(t,i,e,n,r,s)}e.prototype.toString=function(){return"["+this.a+", "+this.b+", "+this.c+", "+this.d+", "+this.e+", "+this.f+"]"},e.prototype.clone=function(){return new e(this.a,this.b,this.c,this.d,this.e,this.f)},e.prototype.reset=function(t,i,e,n,r,s){return this._dirty=!0,"object"==typeof t?(this.a=t.a,this.d=t.d,this.b=t.b,this.c=t.c,this.e=t.e,this.f=t.f):(this.a=t||1,this.d=n||1,this.b=i||0,this.c=e||0,this.e=r||0,this.f=s||0),this},e.prototype.identity=function(){return this._dirty=!0,this.a=1,this.b=0,this.c=0,this.d=1,this.e=0,this.f=0,this},e.prototype.rotate=function(t){if(!t)return this;this._dirty=!0;var i=t?Math.cos(t):1,e=t?Math.sin(t):0,n=i*this.a-e*this.b,r=i*this.b+e*this.a,s=i*this.c-e*this.d,o=i*this.d+e*this.c,h=i*this.e-e*this.f,a=i*this.f+e*this.e;return this.a=n,this.b=r,this.c=s,this.d=o,this.e=h,this.f=a,this},e.prototype.translate=function(t,i){return t||i?(this._dirty=!0,this.e+=t,this.f+=i,this):this},e.prototype.scale=function(t,i){return t-1||i-1?(this._dirty=!0,this.a*=t,this.b*=i,this.c*=t,this.d*=i,this.e*=t,this.f*=i,this):this},e.prototype.skew=function(t,i){if(!t&&!i)return this;this._dirty=!0;var e=this.a+this.b*t,n=this.b+this.a*i,r=this.c+this.d*t,s=this.d+this.c*i,o=this.e+this.f*t,h=this.f+this.e*i;return this.a=e,this.b=n,this.c=r,this.d=s,this.e=o,this.f=h,this},e.prototype.concat=function(t){this._dirty=!0;var i=this,e=i.a*t.a+i.b*t.c,n=i.b*t.d+i.a*t.b,r=i.c*t.a+i.d*t.c,s=i.d*t.d+i.c*t.b,o=i.e*t.a+t.e+i.f*t.c,h=i.f*t.d+t.f+i.e*t.b;return this.a=e,this.b=n,this.c=r,this.d=s,this.e=o,this.f=h,this},e.prototype.inverse=e.prototype.reverse=function(){if(this._dirty){this._dirty=!1,this.inversed=this.inversed||new e;var t=this.a*this.d-this.b*this.c;this.inversed.a=this.d/t,this.inversed.b=-this.b/t,this.inversed.c=-this.c/t,this.inversed.d=this.a/t,this.inversed.e=(this.c*this.f-this.e*this.d)/t,this.inversed.f=(this.e*this.b-this.a*this.f)/t}return this.inversed},e.prototype.map=function(t,i){return(i=i||{}).x=this.a*t.x+this.c*t.y+this.e,i.y=this.b*t.x+this.d*t.y+this.f,i},e.prototype.mapX=function(t,i){return"object"==typeof t&&(i=t.y,t=t.x),this.a*t+this.c*i+this.e},e.prototype.mapY=function(t,i){return"object"==typeof t&&(i=t.y,t=t.x),this.b*t+this.d*i+this.f},t.exports=e},function(t,i,e){t.exports=e(0),t.exports.Matrix=e(9),t.exports.Texture=e(7),e(12),e(14),e(15),e(2),e(3),e(17)},function(t,i){t.exports=function(){var t=0;function i(i,e){return t+=e="number"==typeof e&&e>=1?e:1,function(){i&&i.apply(this,arguments),e>0&&(e--,t--,n())}}var e=[];function n(){if(0===t)for(;e.length;)setTimeout(e.shift(),0)}return i.then=function(i){0===t?setTimeout(i,0):e.push(i)},i}},function(t,i,e){var n=e(0),r=e(7),s=e(5),o=e(1),h=e(6),a=e(13),u={},f=[];function c(t){c._super.call(this);var i=this;d(t,"filter"),d(t,"cutouts"),d(t,"sprites"),d(t,"factory");var e=t.map||t.filter,n=t.ppu||t.ratio||1,r=t.trim||0,o=t.textures,u=t.factory,f=t.cutouts||t.sprites;function p(t){if(!t||h.fn(t.draw))return t;t=s({},t),h.fn(e)&&(t=e(t)),1!=n&&(t.x*=n,t.y*=n,t.width*=n,t.height*=n,t.top*=n,t.bottom*=n,t.left*=n,t.right*=n),0!=r&&(t.x+=r,t.y+=r,t.width-=2*r,t.height-=2*r,t.top-=r,t.bottom-=r,t.left-=r,t.right-=r);var o=i.pipe();return o.top=t.top,o.bottom=t.bottom,o.left=t.left,o.right=t.right,o.src(t.x,t.y,t.width,t.height),o}function _(t){if(o){if(h.fn(o))return o(t);if(h.hash(o))return o[t]}if(f){for(var i=null,e=0,n=0;n<f.length;n++)a.startsWith(f[n].name,t)&&(0===e?i=f[n]:1===e?i=[i,f[n]]:i.push(f[n]),e++);return 0===e&&h.fn(u)&&(i=function(i){return u(t+(i||""))}),i}}this.select=function(t){if(!t)return new l(this.pipe());var i=_(t);return i?new l(i,_,p):void 0}}n.atlas=function(t){var i=h.fn(t.draw)?t:new c(t);t.name&&(u[t.name]=i),f.push(i),d(t,"imagePath"),d(t,"imageRatio");var e=t.imagePath,r=t.imageRatio||1;return h.string(t.image)?e=t.image:h.hash(t.image)&&(e=t.image.src||t.image.url,r=t.image.ratio||r),e&&n.preload((function(t){e=n.resolve(e),n.config("image-loader")(e,(function(e){i.src(e,r),t()}),(function(i){t()}))})),i},c._super=r,c.prototype=o(c._super.prototype);var p=new r;p.x=p.y=p.width=p.height=0,p.pipe=p.src=p.dest=function(){return this},p.draw=function(){};var _=new l(p);function l(t,i,e){function n(t,r){return t?h.fn(t.draw)?t:h.hash(t)&&h.number(t.width)&&h.number(t.height)&&h.fn(e)?e(t):h.hash(t)&&h.defined(r)?n(t[r]):h.fn(t)?n(t(r)):h.array(t)?n(t[0]):h.string(t)&&h.fn(i)?n(i(t)):void 0:p}this.one=function(i){return n(t,i)},this.array=function(i){var e=h.array(i)?i:[];if(h.array(t))for(var r=0;r<t.length;r++)e[r]=n(t[r]);else e[0]=n(t);return e}}function d(t,i,e){i in t&&console.log(e?e.replace("%name",i):"'"+i+"' field of texture atlas is deprecated.")}n.texture=function(t){if(!h.string(t))return new l(t);var i,e,n=null;for((e=t.indexOf(":"))>0&&t.length>e+1&&(n=(i=u[t.slice(0,e)])&&i.select(t.slice(e+1))),!n&&(i=u[t])&&(n=i.select()),e=0;!n&&e<f.length;e++)n=f[e].select(t);return n||(console.error("Texture not found: "+t),n=_),n},t.exports=c},function(t,i){t.exports.startsWith=function(t,i){return"string"==typeof t&&"string"==typeof i&&t.substring(0,i.length)==i}},function(t,i,e){var n=e(0),r=e(6),s=0;function o(t,i){f(i),f(t),i.remove(),t._last&&(t._last._next=i,i._prev=t._last),i._parent=t,t._last=i,t._first||(t._first=i),i._parent._flag(i,!0),i._ts_parent=++s,t._ts_children=++s,t.touch()}function h(t,i){f(i),f(t),i.remove(),t._first&&(t._first._prev=i,i._next=t._first),i._parent=t,t._first=i,t._last||(t._last=i),i._parent._flag(i,!0),i._ts_parent=++s,t._ts_children=++s,t.touch()}function a(t,i){f(t),f(i),t.remove();var e=i._parent,n=i._prev;i._prev=t,n&&(n._next=t)||e&&(e._first=t),t._parent=e,t._prev=n,t._next=i,t._parent._flag(t,!0),t._ts_parent=++s,t.touch()}function u(t,i){f(t),f(i),t.remove();var e=i._parent,n=i._next;i._next=t,n&&(n._prev=t)||e&&(e._last=t),t._parent=e,t._prev=i,t._next=n,t._parent._flag(t,!0),t._ts_parent=++s,t.touch()}function f(t){if(t&&t instanceof n)return t;throw"Invalid node: "+t}n.prototype._label="",n.prototype._visible=!0,n.prototype._parent=null,n.prototype._next=null,n.prototype._prev=null,n.prototype._first=null,n.prototype._last=null,n.prototype._attrs=null,n.prototype._flags=null,n.prototype.toString=function(){return"["+this._label+"]"},n.prototype.id=function(t){return this.label(t)},n.prototype.label=function(t){return void 0===t?this._label:(this._label=t,this)},n.prototype.attr=function(t,i){return void 0===i?null!==this._attrs?this._attrs[t]:void 0:((null!==this._attrs?this._attrs:this._attrs={})[t]=i,this)},n.prototype.visible=function(t){return void 0===t?this._visible:(this._visible=t,this._parent&&(this._parent._ts_children=++s),this._ts_pin=++s,this.touch(),this)},n.prototype.hide=function(){return this.visible(!1)},n.prototype.show=function(){return this.visible(!0)},n.prototype.parent=function(){return this._parent},n.prototype.next=function(t){for(var i=this._next;i&&t&&!i._visible;)i=i._next;return i},n.prototype.prev=function(t){for(var i=this._prev;i&&t&&!i._visible;)i=i._prev;return i},n.prototype.first=function(t){for(var i=this._first;i&&t&&!i._visible;)i=i._next;return i},n.prototype.last=function(t){for(var i=this._last;i&&t&&!i._visible;)i=i._prev;return i},n.prototype.visit=function(t,i){var e=t.reverse,n=t.visible;if(!t.start||!t.start(this,i)){for(var r,s=e?this.last(n):this.first(n);r=s;)if(s=e?r.prev(n):r.next(n),r.visit(t,i))return!0;return t.end&&t.end(this,i)}},n.prototype.append=function(t,i){if(r.array(t))for(var e=0;e<t.length;e++)o(this,t[e]);else if(void 0!==i)for(e=0;e<arguments.length;e++)o(this,arguments[e]);else void 0!==t&&o(this,t);return this},n.prototype.prepend=function(t,i){if(r.array(t))for(var e=t.length-1;e>=0;e--)h(this,t[e]);else if(void 0!==i)for(e=arguments.length-1;e>=0;e--)h(this,arguments[e]);else void 0!==t&&h(this,t);return this},n.prototype.appendTo=function(t){return o(t,this),this},n.prototype.prependTo=function(t){return h(t,this),this},n.prototype.insertNext=function(t,i){if(r.array(t))for(var e=0;e<t.length;e++)u(t[e],this);else if(void 0!==i)for(e=0;e<arguments.length;e++)u(arguments[e],this);else void 0!==t&&u(t,this);return this},n.prototype.insertPrev=function(t,i){if(r.array(t))for(var e=t.length-1;e>=0;e--)a(t[e],this);else if(void 0!==i)for(e=arguments.length-1;e>=0;e--)a(arguments[e],this);else void 0!==t&&a(t,this);return this},n.prototype.insertAfter=function(t){return u(this,t),this},n.prototype.insertBefore=function(t){return a(this,t),this},n.prototype.remove=function(t,i){if(void 0!==t){if(r.array(t))for(var e=0;e<t.length;e++)f(t[e]).remove();else if(void 0!==i)for(e=0;e<arguments.length;e++)f(arguments[e]).remove();else f(t).remove();return this}return this._prev&&(this._prev._next=this._next),this._next&&(this._next._prev=this._prev),this._parent&&(this._parent._first===this&&(this._parent._first=this._next),this._parent._last===this&&(this._parent._last=this._prev),this._parent._flag(this,!1),this._parent._ts_children=++s,this._parent.touch()),this._prev=this._next=this._parent=null,this._ts_parent=++s,this},n.prototype.empty=function(){for(var t,i=this._first;t=i;)i=t._next,t._prev=t._next=t._parent=null,this._flag(t,!1);return this._first=this._last=null,this._ts_children=++s,this.touch(),this},n.prototype.touch=function(){return this._ts_touch=++s,this._parent&&this._parent.touch(),this},n.prototype._flag=function(t,i){if(void 0===i)return null!==this._flags&&this._flags[t]||0;if("string"==typeof t&&(i?(this._flags=this._flags||{},!this._flags[t]&&this._parent&&this._parent._flag(t,!0),this._flags[t]=(this._flags[t]||0)+1):this._flags&&this._flags[t]>0&&(1==this._flags[t]&&this._parent&&this._parent._flag(t,!1),this._flags[t]=this._flags[t]-1)),"object"==typeof t&&t._flags)for(var e in t._flags)t._flags[e]>0&&this._flag(e,i);return this},n.prototype.hitTest=function(t){var i=this._pin._width,e=this._pin._height;return t.x>=0&&t.x<=i&&t.y>=0&&t.y<=e},t.exports=n},function(t,i,e){e(16)(e(0).prototype,(function(t,i,e){t._flag(i,e)}))},function(t,i){t.exports=function(t,i){t._listeners=null,t.on=t.listen=function(t,e){if(!t||!t.length||"function"!=typeof e)return this;if(null===this._listeners&&(this._listeners={}),t=("string"!=typeof t&&"function"==typeof t.join?t.join(" "):t).match(/\S+/g))for(var n=0;n<t.length;n++){var r=t[n];this._listeners[r]=this._listeners[r]||[],this._listeners[r].push(e),"function"==typeof i&&i(this,r,!0)}return this},t.off=function(t,e){if(!t||!t.length||"function"!=typeof e)return this;if(null===this._listeners)return this;if(t=("string"!=typeof t&&"function"==typeof t.join?t.join(" "):t).match(/\S+/g))for(var n=0;n<t.length;n++){var r,s=t[n],o=this._listeners[s];o&&(r=o.indexOf(e))>=0&&(o.splice(r,1),o.length||delete this._listeners[s],"function"==typeof i&&i(this,s,!1))}return this},t.listeners=function(t){return this._listeners&&this._listeners[t]},t.publish=function(t,i){var e=this.listeners(t);if(!e||!e.length)return 0;for(var n=0;n<e.length;n++)e[n].apply(this,i);return e.length},t.trigger=function(t,i){return this.publish(t,i),this}}},function(t,i,e){var n=e(0);e(2),e(3);var r=e(4),s=e(1),o=e(5);function h(t,i){h._super.call(this),this.label("Root");var e=!0,n=!0,s=this,o=0,a=function(h){if(!0!==e&&!0!==n){r.tick=r.node=r.draw=0;var u=o||h,f=h-u;o=h;var c=s._tick(f,h,u);s._mo_touch!=s._ts_touch?(s._mo_touch=s._ts_touch,i(s),t(a)):c?t(a):e=!0,r.fps=f?1e3/f:0}};this.start=function(){return n=!1,this.resume()},this.resume=function(){return e&&(this.publish("resume"),e=!1,t(a)),this},this.pause=function(){return e||this.publish("pause"),e=!0,this},this.touch_root=this.touch,this.touch=function(){return this.resume(),this.touch_root()},this.stop=function(){return n=!0,this}}h._super=n,h.prototype=s(h._super.prototype),n.root=function(t,i){return new h(t,i)},h.prototype.background=function(t){return this},h.prototype.viewport=function(t,i,e){if(void 0===t)return o({},this._viewport);this._viewport={width:t,height:i,ratio:e||1},this.viewbox();var n=o({},this._viewport);return this.visit({start:function(t){if(!t._flag("viewport"))return!0;t.publish("viewport",[n])}}),this},h.prototype.viewbox=function(t,i,e){"number"==typeof t&&"number"==typeof i&&(this._viewbox={width:t,height:i,mode:/^(in|out|in-pad|out-crop)$/.test(e)?e:"in-pad"});var n=this._viewbox,r=this._viewport;return r&&n?(this.pin({width:n.width,height:n.height}),this.scaleTo(r.width,r.height,n.mode)):r&&this.pin({width:r.width,height:r.height}),this}},function(t,i,e){var n=e(0),r=e(7);n.canvas=function(t,i,e){"string"==typeof t?"object"==typeof i||("function"==typeof i&&(e=i),i={}):("function"==typeof t&&(e=t),i={},t="2d");var n=document.createElement("canvas"),s=n.getContext(t,i),o=new r(n);return o.context=function(){return s},o.size=function(t,i,e){return e=e||1,n.width=t*e,n.height=i*e,this.src(n,e),this},o.canvas=function(t){return"function"==typeof t?t.call(this,s):void 0===t&&"function"==typeof e&&e.call(this,s),this},"function"==typeof e&&e.call(o,s),o}},function(t,i,e){var n=e(0);e(2),e(3);var r=e(20),s=e(1);function o(){o._super.call(this),this.label("Image"),this._textures=[],this._image=null}t.exports=o,n.image=function(t){var i=new o;return t&&i.image(t),i},o._super=n,o.prototype=s(o._super.prototype),o.prototype.setImage=function(t,i,e){return this.image(t,i,e)},o.prototype.image=function(t){return this._image=n.texture(t).one(),this.pin("width",this._image?this._image.width:0),this.pin("height",this._image?this._image.height:0),this._textures[0]=this._image.pipe(),this._textures.length=1,this},o.prototype.tile=function(t){return this._repeat(!1,t),this},o.prototype.stretch=function(t){return this._repeat(!0,t),this},o.prototype._repeat=function(t,i){var e=this;function n(t,i,n,r,s,o,h,a,u){var f=e._textures.length>t?e._textures[t]:e._textures[t]=e._image.pipe();f.src(i,n,r,s),f.dest(o,h,a,u)}this.untick(this._repeatTicker),this.tick(this._repeatTicker=function(){if(this._mo_stretch!=this._pin._ts_transform){this._mo_stretch=this._pin._ts_transform;var e=this.pin("width"),s=this.pin("height");this._textures.length=r(this._image,e,s,t,i,n)}})}},function(t,i){t.exports=function(t,i,e,n,r,s){var o=t.width,h=t.height,a=t.left,u=t.right,f=t.top,c=t.bottom;o=o-(a="number"==typeof a&&a==a?a:0)-(u="number"==typeof u&&u==u?u:0),h=h-(f="number"==typeof f&&f==f?f:0)-(c="number"==typeof c&&c==c?c:0),r||(i=Math.max(i-a-u,0),e=Math.max(e-f-c,0));var p=0;if(f>0&&a>0&&s(p++,0,0,a,f,0,0,a,f),c>0&&a>0&&s(p++,0,h+f,a,c,0,e+f,a,c),f>0&&u>0&&s(p++,o+a,0,u,f,i+a,0,u,f),c>0&&u>0&&s(p++,o+a,h+f,u,c,i+a,e+f,u,c),n)f>0&&s(p++,a,0,o,f,a,0,i,f),c>0&&s(p++,a,h+f,o,c,a,e+f,i,c),a>0&&s(p++,0,f,a,h,0,f,a,e),u>0&&s(p++,o+a,f,u,h,i+a,f,u,e),s(p++,a,f,o,h,a,f,i,e);else for(var _,l=a,d=i;d>0;){_=Math.min(o,d),d-=o;for(var v,g=f,y=e;y>0;)v=Math.min(h,y),y-=h,s(p++,a,f,_,v,l,g,_,v),d<=0&&(a&&s(p++,0,f,a,v,0,g,a,v),u&&s(p++,o+a,f,u,v,l+_,g,u,v)),g+=v;f&&s(p++,a,0,_,f,l,0,_,f),c&&s(p++,a,h+f,_,c,l,g,_,c),l+=_}return p}},function(t,i,e){var n=e(0);e(2),e(3);var r=e(1),s=e(8);function o(){o._super.call(this),this.label("Anim"),this._textures=[],this._fps=n.Anim.FPS,this._ft=1e3/this._fps,this._time=-1,this._repeat=0,this._index=0,this._frames=[];var t=0;this.tick((function(i,e,n){if(!(this._time<0||this._frames.length<=1)){var r=t!=n;if(t=e,r)return!0;if(this._time+=i,this._time<this._ft)return!0;var s=this._time/this._ft|0;return this._time-=s*this._ft,this.moveFrame(s),!(this._repeat>0&&(this._repeat-=s)<=0)||(this.stop(),this._callback&&this._callback(),!1)}}),!1)}n.anim=function(t,i){var e=new o;return e.frames(t).gotoFrame(0),i&&e.fps(i),e},o._super=n,o.prototype=r(o._super.prototype),n.Anim={FPS:15},o.prototype.fps=function(t){return void 0===t?this._fps:(this._fps=t>0?t:n.Anim.FPS,this._ft=1e3/this._fps,this)},o.prototype.setFrames=function(t,i,e){return this.frames(t,i,e)},o.prototype.frames=function(t){return this._index=0,this._frames=n.texture(t).array(),this.touch(),this},o.prototype.length=function(){return this._frames?this._frames.length:0},o.prototype.gotoFrame=function(t,i){return this._index=0|s.rotate(t,this._frames.length),i=i||!this._textures[0],this._textures[0]=this._frames[this._index],i&&(this.pin("width",this._textures[0].width),this.pin("height",this._textures[0].height)),this.touch(),this},o.prototype.moveFrame=function(t){return this.gotoFrame(this._index+t)},o.prototype.repeat=function(t,i){return this._repeat=t*this._frames.length-1,this._callback=i,this.play(),this},o.prototype.play=function(t){return void 0!==t?(this.gotoFrame(t),this._time=0):this._time<0&&(this._time=0),this.touch(),this},o.prototype.stop=function(t){return this._time=-1,void 0!==t&&this.gotoFrame(t),this}},function(t,i,e){var n=e(0);e(2),e(3);var r=e(1),s=e(6);function o(){o._super.call(this),this.label("String"),this._textures=[]}n.string=function(t){return(new o).frames(t)},o._super=n,o.prototype=r(o._super.prototype),o.prototype.setFont=function(t,i,e){return this.frames(t,i,e)},o.prototype.frames=function(t){return this._textures=[],"string"==typeof t?(t=n.texture(t),this._item=function(i){return t.one(i)}):"object"==typeof t?this._item=function(i){return t[i]}:"function"==typeof t&&(this._item=t),this},o.prototype.setValue=function(t,i,e){return this.value(t,i,e)},o.prototype.value=function(t){if(void 0===t)return this._value;if(this._value===t)return this;this._value=t,null===t?t="":"string"==typeof t||s.array(t)||(t=t.toString()),this._spacing=this._spacing||0;for(var i=0,e=0,n=0;n<t.length;n++){var r=this._textures[n]=this._item(t[n]);i+=n>0?this._spacing:0,r.dest(i,0),i+=r.width,e=Math.max(e,r.height)}return this.pin("width",i),this.pin("height",e),this._textures.length=t.length,this}},function(t,i,e){var n=e(0);e(2),e(3);e(1);n.row=function(t){return n.create().row(t).label("Row")},n.prototype.row=function(t){return this.sequence("row",t),this},n.column=function(t){return n.create().column(t).label("Row")},n.prototype.column=function(t){return this.sequence("column",t),this},n.sequence=function(t,i){return n.create().sequence(t,i).label("Sequence")},n.prototype.sequence=function(t,i){return this._padding=this._padding||0,this._spacing=this._spacing||0,this.untick(this._layoutTiker),this.tick(this._layoutTiker=function(){if(this._mo_seq!=this._ts_touch){this._mo_seq=this._ts_touch;var e=this._mo_seqAlign!=this._ts_children;this._mo_seqAlign=this._ts_children;for(var n,r=0,s=0,o=this.first(!0),h=!0;n=o;){o=n.next(!0),n.matrix(!0);var a=n.pin("boxWidth"),u=n.pin("boxHeight");"column"==t?(!h&&(s+=this._spacing),n.pin("offsetY")!=s&&n.pin("offsetY",s),r=Math.max(r,a),s+=u,e&&n.pin("alignX",i)):"row"==t&&(!h&&(r+=this._spacing),n.pin("offsetX")!=r&&n.pin("offsetX",r),r+=a,s=Math.max(s,u),e&&n.pin("alignY",i)),h=!1}r+=2*this._padding,s+=2*this._padding,this.pin("width")!=r&&this.pin("width",r),this.pin("height")!=s&&this.pin("height",s)}}),this},n.box=function(){return n.create().box().label("Box")},n.prototype.box=function(){return this._padding=this._padding||0,this.untick(this._layoutTiker),this.tick(this._layoutTiker=function(){if(this._mo_box!=this._ts_touch){this._mo_box=this._ts_touch;for(var t,i=0,e=0,n=this.first(!0);t=n;){n=t.next(!0),t.matrix(!0);var r=t.pin("boxWidth"),s=t.pin("boxHeight");i=Math.max(i,r),e=Math.max(e,s)}i+=2*this._padding,e+=2*this._padding,this.pin("width")!=i&&this.pin("width",i),this.pin("height")!=e&&this.pin("height",e)}}),this},n.layer=function(){return n.create().layer().label("Layer")},n.prototype.layer=function(){return this.untick(this._layoutTiker),this.tick(this._layoutTiker=function(){var t=this.parent();if(t){var i=t.pin("width");this.pin("width")!=i&&this.pin("width",i);var e=t.pin("height");this.pin("height")!=e&&this.pin("height",e)}},!0),this},n.prototype.padding=function(t){return this._padding=t,this},n.prototype.spacing=function(t){return this._spacing=t,this}},function(t,i,e){var n=e(25),r=e(0),s=e(2);function o(t,i,e){this._end={},this._duration=i||400,this._delay=e||0,this._owner=t,this._time=0}function h(t,i,e,n){"number"==typeof t.pin(e)?i[e]=n:"number"==typeof t.pin(e+"X")&&"number"==typeof t.pin(e+"Y")&&(i[e+"X"]=n,i[e+"Y"]=n)}r.prototype.tween=function(t,i,e){if("number"!=typeof t?(e=t,i=0,t=0):"number"!=typeof i&&(e=i,i=0),!this._tweens){this._tweens=[];var n=0;this.tick((function(t,i,e){if(this._tweens.length){var r=n!=e;if(n=i,r)return!0;var s=this._tweens[0],o=s.tick(this,t,i,e);if(o&&s===this._tweens[0]&&this._tweens.shift(),Array.isArray(o))for(var h=0;h<o.length;h++)try{o[h].call(this)}catch(t){console.log(t)}else"object"==typeof o&&this._tweens.unshift(o);return!0}}),!0)}this.touch(),e||(this._tweens.length=0);var r=new o(this,t,i);return this._tweens.push(r),r},o.prototype.tick=function(t,i,e,n){if(this._time+=i,!(this._time<this._delay)){var r,s,o=this._time-this._delay;if(!this._start)for(var h in this._start={},this._end)this._start[h]=this._owner.pin(h);o<this._duration?(r=o/this._duration,s=!1):(r=1,s=!0),"function"==typeof this._easing&&(r=this._easing(r));var a=1-r;for(var h in this._end)this._owner.pin(h,this._start[h]*a+this._end[h]*r);if(s){var u=[this._hide,this._remove,this._done];return u=u.filter((function(t){return"function"==typeof t})),this._next||u}}},o.prototype.tween=function(t,i){return this._next=new o(this._owner,t,i)},o.prototype.duration=function(t){return this._duration=t,this},o.prototype.delay=function(t){return this._delay=t,this},o.prototype.ease=function(t){return this._easing=n(t),this},o.prototype.done=function(t){return this._done=t,this},o.prototype.hide=function(){return this._hide=function(){this.hide()},this},o.prototype.remove=function(){return this._remove=function(){this.remove()},this},o.prototype.pin=function(t,i){if("object"==typeof t)for(var e in t)h(this._owner,this._end,e,t[e]);else void 0!==i&&h(this._owner,this._end,t,i);return this},s._add_shortcuts(o),o.prototype.then=function(t){return this.done(t),this},o.prototype.clear=function(t){return this},t.exports=o},function(t,i){function e(t){return t}var n={},r={},s={};function o(t){if("function"==typeof t)return t;if("string"!=typeof t)return e;var i=n[t];if(i)return i;var o=/^(\w+)(-(in|out|in-out|out-in))?(\((.*)\))?$/i.exec(t);if(!o||!o.length)return e;var h=s[o[1]],a=r[o[3]],u=o[5];return i=h&&h.fn?h.fn:h&&h.fc?h.fc.apply(h.fc,u&&u.replace(/\s+/,"").split(",")):e,a&&(i=a.fn(i)),n[t]=i,i}o.add=function(t){for(var i=(t.name||t.mode).split(/\s+/),e=0;e<i.length;e++){var n=i[e];n&&((t.name?s:r)[n]=t)}},o.add({mode:"in",fn:function(t){return t}}),o.add({mode:"out",fn:function(t){return function(i){return 1-t(1-i)}}}),o.add({mode:"in-out",fn:function(t){return function(i){return i<.5?t(2*i)/2:1-t(2*(1-i))/2}}}),o.add({mode:"out-in",fn:function(t){return function(i){return i<.5?1-t(2*(1-i))/2:t(2*i)/2}}}),o.add({name:"linear",fn:function(t){return t}}),o.add({name:"quad",fn:function(t){return t*t}}),o.add({name:"cubic",fn:function(t){return t*t*t}}),o.add({name:"quart",fn:function(t){return t*t*t*t}}),o.add({name:"quint",fn:function(t){return t*t*t*t*t}}),o.add({name:"sin sine",fn:function(t){return 1-Math.cos(t*Math.PI/2)}}),o.add({name:"exp expo",fn:function(t){return 0==t?0:Math.pow(2,10*(t-1))}}),o.add({name:"circle circ",fn:function(t){return 1-Math.sqrt(1-t*t)}}),o.add({name:"bounce",fn:function(t){return t<1/2.75?7.5625*t*t:t<2/2.75?7.5625*(t-=1.5/2.75)*t+.75:t<2.5/2.75?7.5625*(t-=2.25/2.75)*t+.9375:7.5625*(t-=2.625/2.75)*t+.984375}}),o.add({name:"poly",fc:function(t){return function(i){return Math.pow(i,t)}}}),o.add({name:"elastic",fc:function(t,i){t=t||1;var e=(i=i||.45)/(2*Math.PI)*Math.asin(1/t);return function(n){return 1+t*Math.pow(2,-10*n)*Math.sin((n-e)*(2*Math.PI)/i)}}}),o.add({name:"back",fc:function(t){return t=void 0!==t?t:1.70158,function(i){return i*i*((t+1)*i-t)}}}),t.exports=o},function(t,i,e){function n(t,i){if(this instanceof n){var e=t.viewport().ratio||1;t.on("viewport",(function(t){e=t.ratio||e})),this.x=0,this.y=0,this.toString=function(){return(0|this.x)+"x"+(0|this.y)},this.locate=function(t){!function(t,i,e){i.touches&&i.touches.length?(e.x=i.touches[0].clientX,e.y=i.touches[0].clientY):(e.x=i.clientX,e.y=i.clientY);var n=t.getBoundingClientRect();e.x-=n.left,e.y-=n.top,e.x-=0|t.clientLeft,e.y-=0|t.clientTop}(i,t,this),this.x*=e,this.y*=e},this.lookup=function(i,e){this.type=i,this.root=t,this.event=null,e.length=0,this.collect=e,this.root.visit(this.visitor,this)},this.publish=function(i,e,n){if(this.type=i,this.root=t,this.event=e,this.collect=!1,this.timeStamp=Date.now(),n){for(;n.length&&!this.visitor.end(n.shift(),this););n.length=0}else this.root.visit(this.visitor,this)},this.visitor={reverse:!0,visible:!0,start:function(t,i){return!t._flag(i.type)},end:function(t,i){r.raw=i.event,r.type=i.type,r.timeStamp=i.timeStamp,r.abs.x=i.x,r.abs.y=i.y;var e=t.listeners(i.type);if(e&&(t.matrix().inverse().map(i,r),(t===i.root||t.attr("spy")||t.hitTest(r))&&(i.collect&&i.collect.push(t),i.event))){for(var n=!1,s=0;s<e.length;s++)n=!!e[s].call(t,r)||n;return n}}}}}e(0)._load((function(t,i){n.subscribe(t,i)})),n.CLICK="click",n.START="touchstart mousedown",n.MOVE="touchmove mousemove",n.END="touchend mouseup",n.CANCEL="touchcancel mousecancel",n.subscribe=function(t,i){if(!t.mouse){t.mouse=new n(t,i),i.addEventListener("touchstart",s),i.addEventListener("touchend",h),i.addEventListener("touchmove",o),i.addEventListener("touchcancel",a),i.addEventListener("mousedown",s),i.addEventListener("mouseup",h),i.addEventListener("mousemove",o),document.addEventListener("mouseup",a),window.addEventListener("blur",a);var e=[],r=[]}function s(i){i.preventDefault(),t.mouse.locate(i),t.mouse.publish(i.type,i),t.mouse.lookup("click",e),t.mouse.lookup("mousecancel",r)}function o(i){i.preventDefault(),t.mouse.locate(i),t.mouse.publish(i.type,i)}function h(i){i.preventDefault(),t.mouse.publish(i.type,i),e.length&&t.mouse.publish("click",i,e),r.length=0}function a(i){r.length&&t.mouse.publish("mousecancel",i,r),e.length=0}};var r={},s={};function o(t,i,e){Object.defineProperty(t,i,{value:e})}o(r,"clone",(function(t){return(t=t||{}).x=this.x,t.y=this.y,t})),o(r,"toString",(function(){return(0|this.x)+"x"+(0|this.y)+" ("+this.abs+")"})),o(r,"abs",s),o(s,"clone",(function(t){return(t=t||{}).x=this.x,t.y=this.y,t})),o(s,"toString",(function(){return(0|this.x)+"x"+(0|this.y)})),t.exports=n},,,function(t,i,e){t.exports=e(10),t.exports.internal={},e(18),t.exports.internal.Image=e(19),e(21),e(22),e(23),e(24),t.exports.Mouse=e(26),t.exports.Math=e(8),t.exports._extend=e(5),t.exports._create=e(1),e(30)},function(t,i,e){var n,r=e(0),s=e(31);"undefined"==typeof FastContext&&(FastContext=window.FastContext),r._supported=!(!(n=document.createElement("canvas")).getContext||!n.getContext("2d")),window.addEventListener("load",(function(){var t=s((function(t){r._supported&&r.start()}));document.addEventListener("click",(function(){t("click")}),!1),document.addEventListener("mousemove",(function(){t("mousemove")}),!1),document.addEventListener("deviceready",(function(){t("deviceready")}),!1),document.addEventListener("pause",(function(){r.pause()}),!1),document.addEventListener("resume",(function(){r.resume()}),!1)}),!1),r.config({"app-loader":function(t,i){var e,n=(i=i||{}).canvas,s=null,o=!1,h=0,a=0;"string"==typeof n&&(n=document.getElementById(n));n||(n=document.getElementById("cutjs")||document.getElementById("stage"));if(!n){o=!0,(n=document.createElement("canvas")).style.position="absolute",n.style.top="0",n.style.left="0";var u=document.body;u.insertBefore(n,u.firstChild)}(s=n.getContext("2d",{fastcontext:!0})).isFast=!!s.isFast,o=o||s.isFast;var f=window.devicePixelRatio||1,c=s.webkitBackingStorePixelRatio||s.mozBackingStorePixelRatio||s.msBackingStorePixelRatio||s.oBackingStorePixelRatio||s.backingStorePixelRatio||1;e=f/c;var p=window.requestAnimationFrame||window.msRequestAnimationFrame||window.mozRequestAnimationFrame||window.webkitRequestAnimationFrame||window.oRequestAnimationFrame||function(t){return window.setTimeout(t,1e3/60)};var _=r.root(p,l);function l(){s.isFast?(s.clear(),s.setTransform(1,0,0,1,0,0)):(s.setTransform(1,0,0,1,0,0),s.clearRect(0,0,h,a)),_.render(s)}function d(){o?(h=window.innerWidth>0?window.innerWidth:screen.width,a=window.innerHeight>0?window.innerHeight:screen.height,n.style.width=h+"px",n.style.height=a+"px"):(h=n.clientWidth,a=n.clientHeight),h*=e,a*=e,n.width===h&&n.height===a||(n.width=h,n.height=a,_.viewport(h,a,e),l())}_.background=function(t){return s.isFast?s.setBackgroundColor&&s.setBackgroundColor(t):n.style.backgroundColor=t,this},t(_,n),d(),window.addEventListener("resize",d,!1),window.addEventListener("orientationchange",d,!1)},"image-loader":function(t,i,e){var n;FastContext?n=FastContext.createImage(t,r,e):((n=new Image).onload=r,n.onerror=e,n.src=t);function r(){i(n)}}})},function(t,i){t.exports=function(t,i){var e=!1;return function(){e||(e=!0,t.apply(i,arguments))}}}])}));
//# sourceMappingURL=stage.cordova.min.js.map

@@ -1,8 +0,36 @@

/*
* Stage.js 0.8.10
/*!
*
* @copyright 2017 Ali Shakiba http://shakiba.me/stage.js
* @license The MIT License
* Planck.js v0.9.3
*
* @copyright Copyright (c) 2020 Ali Shakiba http://shakiba.me/stage.js
* @license The MIT License (MIT)
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*
*
*/
!function(t){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=t();else if("function"==typeof define&&define.amd)define([],t);else{var i;"undefined"!=typeof window?i=window:"undefined"!=typeof global?i=global:"undefined"!=typeof self&&(i=self),i.Stage=t()}}(function(){return function t(i,e,n){function r(o,h){if(!e[o]){if(!i[o]){var a="function"==typeof require&&require;if(!h&&a)return a(o,!0);if(s)return s(o,!0);var u=new Error("Cannot find module '"+o+"'");throw u.code="MODULE_NOT_FOUND",u}var f=e[o]={exports:{}};i[o][0].call(f.exports,function(t){var e=i[o][1][t];return r(e?e:t)},f,f.exports,t,i,e,n)}return e[o].exports}for(var s="function"==typeof require&&require,o=0;o<n.length;o++)r(n[o]);return r}({1:[function(t,i){i.exports=t("../lib/"),i.exports.internal={},t("../lib/canvas"),i.exports.internal.Image=t("../lib/image"),t("../lib/anim"),t("../lib/str"),t("../lib/layout"),t("../lib/addon/tween"),i.exports.Mouse=t("../lib/addon/mouse"),i.exports.Math=t("../lib/util/math"),i.exports._extend=t("../lib/util/extend"),i.exports._create=t("../lib/util/create"),t("../lib/loader/web")},{"../lib/":11,"../lib/addon/mouse":3,"../lib/addon/tween":4,"../lib/anim":5,"../lib/canvas":7,"../lib/image":10,"../lib/layout":12,"../lib/loader/web":13,"../lib/str":18,"../lib/util/create":22,"../lib/util/extend":24,"../lib/util/math":26}],2:[function(t,i){function e(t){return t}function n(t){if("function"==typeof t)return t;if("string"!=typeof t)return e;var i=r[t];if(i)return i;var n=/^(\w+)(-(in|out|in-out|out-in))?(\((.*)\))?$/i.exec(t);if(!n||!n.length)return e;var h=o[n[1]],a=s[n[3]],u=n[5];return i=h&&h.fn?h.fn:h&&h.fc?h.fc.apply(h.fc,u&&u.replace(/\s+/,"").split(",")):e,a&&(i=a.fn(i)),r[t]=i,i}var r={},s={},o={};n.add=function(t){for(var i=(t.name||t.mode).split(/\s+/),e=0;e<i.length;e++){var n=i[e];n&&((t.name?o:s)[n]=t)}},n.add({mode:"in",fn:function(t){return t}}),n.add({mode:"out",fn:function(t){return function(i){return 1-t(1-i)}}}),n.add({mode:"in-out",fn:function(t){return function(i){return.5>i?t(2*i)/2:1-t(2*(1-i))/2}}}),n.add({mode:"out-in",fn:function(t){return function(i){return.5>i?1-t(2*(1-i))/2:t(2*i)/2}}}),n.add({name:"linear",fn:function(t){return t}}),n.add({name:"quad",fn:function(t){return t*t}}),n.add({name:"cubic",fn:function(t){return t*t*t}}),n.add({name:"quart",fn:function(t){return t*t*t*t}}),n.add({name:"quint",fn:function(t){return t*t*t*t*t}}),n.add({name:"sin sine",fn:function(t){return 1-Math.cos(t*Math.PI/2)}}),n.add({name:"exp expo",fn:function(t){return 0==t?0:Math.pow(2,10*(t-1))}}),n.add({name:"circle circ",fn:function(t){return 1-Math.sqrt(1-t*t)}}),n.add({name:"bounce",fn:function(t){return 1/2.75>t?7.5625*t*t:2/2.75>t?7.5625*(t-=1.5/2.75)*t+.75:2.5/2.75>t?7.5625*(t-=2.25/2.75)*t+.9375:7.5625*(t-=2.625/2.75)*t+.984375}}),n.add({name:"poly",fc:function(t){return function(i){return Math.pow(i,t)}}}),n.add({name:"elastic",fc:function(t,i){i=i||.45,t=t||1;var e=i/(2*Math.PI)*Math.asin(1/t);return function(n){return 1+t*Math.pow(2,-10*n)*Math.sin(2*(n-e)*Math.PI/i)}}}),n.add({name:"back",fc:function(t){return t="undefined"!=typeof t?t:1.70158,function(i){return i*i*((t+1)*i-t)}}}),i.exports=n},{}],3:[function(t,i){function e(t,i){if(this instanceof e){var n=t.viewport().ratio||1;t.on("viewport",function(t){n=t.ratio||n}),this.x=0,this.y=0,this.toString=function(){return(0|this.x)+"x"+(0|this.y)},this.locate=function(t){r(i,t,this),this.x*=n,this.y*=n},this.lookup=function(i,e){this.type=i,this.root=t,this.event=null,e.length=0,this.collect=e,this.root.visit(this.visitor,this)},this.publish=function(i,e,n){if(this.type=i,this.root=t,this.event=e,this.collect=!1,this.timeStamp=Date.now(),"mousemove"!==i&&"touchmove"!==i&&DEBUG&&console.log(this.type+" "+this),n){for(;n.length&&!this.visitor.end(n.shift(),this););n.length=0}else this.root.visit(this.visitor,this)},this.visitor={reverse:!0,visible:!0,start:function(t,i){return!t._flag(i.type)},end:function(t,i){s.raw=i.event,s.type=i.type,s.timeStamp=i.timeStamp,s.abs.x=i.x,s.abs.y=i.y;var e=t.listeners(i.type);if(e&&(t.matrix().inverse().map(i,s),(t===i.root||t.hitTest(s))&&(i.collect&&i.collect.push(t),i.event))){for(var n=!1,r=0;r<e.length;r++)n=e[r].call(t,s)?!0:n;return n}}}}}function n(t,i,e){Object.defineProperty(t,i,{value:e})}function r(t,i,e){i.touches&&i.touches.length?(e.x=i.touches[0].clientX,e.y=i.touches[0].clientY):(e.x=i.clientX,e.y=i.clientY);var n=t.getBoundingClientRect();return e.x-=n.left,e.y-=n.top,e.x-=0|t.clientLeft,e.y-=0|t.clientTop,e}"undefined"==typeof DEBUG&&(DEBUG=!0),t("../core")._load(function(t,i){e.subscribe(t,i)}),e.CLICK="click",e.START="touchstart mousedown",e.MOVE="touchmove mousemove",e.END="touchend mouseup",e.CANCEL="touchcancel mousecancel",e.subscribe=function(t,i){function n(i){i.preventDefault(),t.mouse.locate(i),t.mouse.publish(i.type,i),t.mouse.lookup("click",h),t.mouse.lookup("mousecancel",a)}function r(i){i.preventDefault(),t.mouse.locate(i),t.mouse.publish(i.type,i)}function s(i){i.preventDefault(),t.mouse.publish(i.type,i),h.length&&t.mouse.publish("click",i,h),a.length=0}function o(i){a.length&&t.mouse.publish("mousecancel",i,a),h.length=0}if(!t.mouse){t.mouse=new e(t,i),i.addEventListener("touchstart",n),i.addEventListener("touchend",s),i.addEventListener("touchmove",r),i.addEventListener("touchcancel",o),i.addEventListener("mousedown",n),i.addEventListener("mouseup",s),i.addEventListener("mousemove",r),document.addEventListener("mouseup",o),window.addEventListener("blur",o);var h=[],a=[]}};var s={},o={};n(s,"clone",function(t){return t=t||{},t.x=this.x,t.y=this.y,t}),n(s,"toString",function(){return(0|this.x)+"x"+(0|this.y)+" ("+this.abs+")"}),n(s,"abs",o),n(o,"clone",function(t){return t=t||{},t.x=this.x,t.y=this.y,t}),n(o,"toString",function(){return(0|this.x)+"x"+(0|this.y)}),i.exports=e},{"../core":8}],4:[function(t,i){function e(t,i,e){this._end={},this._duration=i||400,this._delay=e||0,this._owner=t,this._time=0}function n(t,i,e,n){"number"==typeof t.pin(e)?i[e]=n:"number"==typeof t.pin(e+"X")&&"number"==typeof t.pin(e+"Y")&&(i[e+"X"]=n,i[e+"Y"]=n)}var r=t("./easing"),s=t("../core"),o=t("../pin");s.prototype.tween=function(t,i,n){if("number"!=typeof t?(n=t,i=0,t=0):"number"!=typeof i&&(n=i,i=0),!this._tweens){this._tweens=[];var r=0;this.tick(function(t,i,e){if(this._tweens.length){var n=r!=e;if(r=i,n)return!0;var s=this._tweens[0],o=s.tick(this,t,i,e);if(o&&s===this._tweens[0]&&this._tweens.shift(),"function"==typeof o)try{o.call(this)}catch(h){console.log(h)}return"object"==typeof o&&this._tweens.unshift(o),!0}},!0)}this.touch(),n||(this._tweens.length=0);var s=new e(this,t,i);return this._tweens.push(s),s},e.prototype.tick=function(t,i){if(this._time+=i,!(this._time<this._delay)){var e=this._time-this._delay;if(!this._start){this._start={};for(var n in this._end)this._start[n]=this._owner.pin(n)}var r,s;e<this._duration?(r=e/this._duration,s=!1):(r=1,s=!0),"function"==typeof this._easing&&(r=this._easing(r));var o=1-r;for(var n in this._end)this._owner.pin(n,this._start[n]*o+this._end[n]*r);return s?this._next||this._done||!0:void 0}},e.prototype.tween=function(t,i){return this._next=new e(this._owner,t,i)},e.prototype.duration=function(t){return this._duration=t,this},e.prototype.delay=function(t){return this._delay=t,this},e.prototype.ease=function(t){return this._easing=r(t),this},e.prototype.done=function(t){return this._done=t,this},e.prototype.hide=function(){return this.done(function(){this.hide()}),this},e.prototype.remove=function(){return this.done(function(){this.remove()}),this},e.prototype.pin=function(t,i){if("object"==typeof t)for(var e in t)n(this._owner,this._end,e,t[e]);else"undefined"!=typeof i&&n(this._owner,this._end,t,i);return this},o._add_shortcuts(e),e.prototype.then=function(t){return this.done(t),this},e.prototype.clear=function(){return this},i.exports=e},{"../core":8,"../pin":16,"./easing":2}],5:[function(t){function i(){i._super.call(this),this.label("Anim"),this._textures=[],this._fps=e.Anim.FPS,this._ft=1e3/this._fps,this._time=-1,this._repeat=0,this._index=0,this._frames=[];var t=0;this.tick(function(i,e,n){if(!(this._time<0||this._frames.length<=1)){var r=t!=n;if(t=e,r)return!0;if(this._time+=i,this._time<this._ft)return!0;var s=this._time/this._ft|0;return this._time-=s*this._ft,this.moveFrame(s),this._repeat>0&&(this._repeat-=s)<=0?(this.stop(),this._callback&&this._callback(),!1):!0}},!1)}var e=t("./core");t("./pin"),t("./loop");var n=t("./util/create"),r=t("./util/math");e.anim=function(t,e){var n=new i;return n.frames(t).gotoFrame(0),e&&n.fps(e),n},i._super=e,i.prototype=n(i._super.prototype),e.Anim={FPS:15},i.prototype.fps=function(t){return"undefined"==typeof t?this._fps:(this._fps=t>0?t:e.Anim.FPS,this._ft=1e3/this._fps,this)},i.prototype.setFrames=function(t,i,e){return this.frames(t,i,e)},i.prototype.frames=function(t){return this._index=0,this._frames=e.texture(t).array(),this.touch(),this},i.prototype.length=function(){return this._frames?this._frames.length:0},i.prototype.gotoFrame=function(t,i){return this._index=0|r.rotate(t,this._frames.length),i=i||!this._textures[0],this._textures[0]=this._frames[this._index],i&&(this.pin("width",this._textures[0].width),this.pin("height",this._textures[0].height)),this.touch(),this},i.prototype.moveFrame=function(t){return this.gotoFrame(this._index+t)},i.prototype.repeat=function(t,i){return this._repeat=t*this._frames.length-1,this._callback=i,this.play(),this},i.prototype.play=function(t){return"undefined"!=typeof t?(this.gotoFrame(t),this._time=0):this._time<0&&(this._time=0),this.touch(),this},i.prototype.stop=function(t){return this._time=-1,"undefined"!=typeof t&&this.gotoFrame(t),this}},{"./core":8,"./loop":14,"./pin":16,"./util/create":22,"./util/math":26}],6:[function(t,i){function e(t){function i(t){if(!t||u.fn(t.draw))return t;t=h({},t),u.fn(a)&&(t=a(t)),1!=c&&(t.x*=c,t.y*=c,t.width*=c,t.height*=c,t.top*=c,t.bottom*=c,t.left*=c,t.right*=c),0!=p&&(t.x+=p,t.y+=p,t.width-=2*p,t.height-=2*p,t.top-=p,t.bottom-=p,t.left-=p,t.right-=p);var i=o.pipe();return i.top=t.top,i.bottom=t.bottom,i.left=t.left,i.right=t.right,i.src(t.x,t.y,t.width,t.height),i}function s(t){if(l){if(u.fn(l))return l(t);if(u.hash(l))return l[t]}if(d){for(var i=null,e=0,n=0;n<d.length;n++)f.startsWith(d[n].name,t)&&(0===e?i=d[n]:1===e?i=[i,d[n]]:i.push(d[n]),e++);return 0===e&&u.fn(_)&&(i=function(i){return _(t+(i?i:""))}),i}}e._super.call(this);var o=this;r(t,"filter"),r(t,"cutouts"),r(t,"sprites"),r(t,"factory");var a=t.map||t.filter,c=t.ppu||t.ratio||1,p=t.trim||0,l=t.textures,_=t.factory,d=t.cutouts||t.sprites;this.select=function(t){if(!t)return new n(this.pipe());var e=s(t);return e?new n(e,s,i):void 0}}function n(t,i,e){function n(t,r){return t?u.fn(t.draw)?t:u.hash(t)&&u.number(t.width)&&u.number(t.height)&&u.fn(e)?e(t):u.hash(t)&&u.defined(r)?n(t[r]):u.fn(t)?n(t(r)):u.array(t)?n(t[0]):u.string(t)&&u.fn(i)?n(i(t)):void 0:l}this.one=function(i){return n(t,i)},this.array=function(i){var e=u.array(i)?i:[];if(u.array(t))for(var r=0;r<t.length;r++)e[r]=n(t[r]);else e[0]=n(t);return e}}function r(t,i,e){i in t&&console.log(e?e.replace("%name",i):"'"+i+"' field of texture atlas is deprecated.")}"undefined"==typeof DEBUG&&(DEBUG=!0);var s=t("./core"),o=t("./texture"),h=t("./util/extend"),a=t("./util/create"),u=t("./util/is"),f=t("./util/string"),c={},p=[];s.atlas=function(t){var i=u.fn(t.draw)?t:new e(t);t.name&&(c[t.name]=i),p.push(i),r(t,"imagePath"),r(t,"imageRatio");var n=t.imagePath,o=t.imageRatio||1;return u.string(t.image)?n=t.image:u.hash(t.image)&&(n=t.image.src||t.image.url,o=t.image.ratio||o),n&&s.preload(function(t){n=s.resolve(n),DEBUG&&console.log("Loading atlas: "+n);var e=s.config("image-loader");e(n,function(e){DEBUG&&console.log("Image loaded: "+n),i.src(e,o),t()},function(i){DEBUG&&console.log("Error loading atlas: "+n,i),t()})}),i},e._super=o,e.prototype=a(e._super.prototype);var l=new o;l.x=l.y=l.width=l.height=0,l.pipe=l.src=l.dest=function(){return this},l.draw=function(){};var _=new n(l);s.texture=function(t){if(!u.string(t))return new n(t);var i,e,r=null;for((e=t.indexOf(":"))>0&&t.length>e+1&&(i=c[t.slice(0,e)],r=i&&i.select(t.slice(e+1))),!r&&(i=c[t])&&(r=i.select()),e=0;!r&&e<p.length;e++)r=p[e].select(t);return r||(console.error("Texture not found: "+t),r=_),r},i.exports=e},{"./core":8,"./texture":19,"./util/create":22,"./util/extend":24,"./util/is":25,"./util/string":29}],7:[function(t){var i=t("./core"),e=t("./texture");i.canvas=function(t,i,n){"string"==typeof t?"object"==typeof i||("function"==typeof i&&(n=i),i={}):("function"==typeof t&&(n=t),i={},t="2d");var r=document.createElement("canvas"),s=r.getContext(t,i),o=new e(r);return o.context=function(){return s},o.size=function(t,i,e){return e=e||1,r.width=t*e,r.height=i*e,this.src(r,e),this},o.canvas=function(t){return"function"==typeof t?t.call(this,s):"undefined"==typeof t&&"function"==typeof n&&n.call(this,s),this},"function"==typeof n&&n.call(o,s),o}},{"./core":8,"./texture":19}],8:[function(t,i){function e(t){if(!(this instanceof e))return o.fn(t)?e.app.apply(e,arguments):o.object(t)?e.atlas.apply(e,arguments):t;r.create++;for(var i=0;i<a.length;i++)a[i].call(this)}function n(t,i){var e=document.createElement("script");e.addEventListener("load",function(){i()}),e.addEventListener("error",function(e){i(e||"Error loading script: "+t)}),e.src=t,e.id="preload-"+Date.now(),document.body.appendChild(e)}"undefined"==typeof DEBUG&&(DEBUG=!0);var r=t("./util/stats"),s=t("./util/extend"),o=t("./util/is"),h=t("./util/await");r.create=0;var a=[];e._init=function(t){a.push(t)};var u=[];e._load=function(t){u.push(t)};var f={};e.config=function(){return 1===arguments.length&&o.string(arguments[0])?f[arguments[0]]:(1===arguments.length&&o.object(arguments[0])&&s(f,arguments[0]),void(2===arguments.length&&o.string(arguments[0])&&f[(arguments[0],arguments[1])]))};var c=[],p=[],l=!1,_=!1;e.app=function(t,i){if(!l)return void c.push(arguments);DEBUG&&console.log("Creating app...");var n=e.config("app-loader");n(function(i,e){DEBUG&&console.log("Initing app...");for(var n=0;n<u.length;n++)u[n].call(this,i,e);t(i,e),p.push(i),DEBUG&&console.log("Starting app..."),i.start()},i)};var d=h();e.preload=function(t){if("string"==typeof t){var i=e.resolve(t);/\.js($|\?|\#)/.test(i)&&(DEBUG&&console.log("Loading script: "+i),t=function(t){n(i,t)})}"function"==typeof t&&t(d())},e.start=function(t){DEBUG&&console.log("Starting..."),e.config(t),d.then(function(){for(DEBUG&&console.log("Loading apps..."),l=!0;c.length;){var t=c.shift();e.app.apply(e,t)}})},e.pause=function(){if(!_){_=!0;for(var t=p.length-1;t>=0;t--)p[t].pause()}},e.resume=function(){if(_){_=!1;for(var t=p.length-1;t>=0;t--)p[t].resume()}},e.create=function(){return new e},e.resolve=function(){function t(){if(document.currentScript)return document.currentScript.src;var t;try{var e=new Error;if(!e.stack)throw e;t=e.stack}catch(e){t=e.stack}if("string"==typeof t){t=t.split("\n");for(var n=t.length;n--;){var r=t[n].match(/(\w+\:\/\/[^\/]*?\/.+?)(:\d+)(:\d+)?/);if(r)return r[1]}}if(i.length&&"readyState"in i[0])for(var n=i.length;n--;)if("interactive"===i[n].readyState)return i[n].src;return location.href}if("undefined"==typeof window||"undefined"==typeof document)return function(t){return t};var i=document.getElementsByTagName("script");return function(i){if(/^\.\//.test(i)){var e=t(),n=e.substring(0,e.lastIndexOf("/")+1);i=n+i.substring(2)}return i}}(),i.exports=e},{"./util/await":21,"./util/extend":24,"./util/is":25,"./util/stats":28}],9:[function(t){t("./util/event")(t("./core").prototype,function(t,i,e){t._flag(i,e)})},{"./core":8,"./util/event":23}],10:[function(t,i){function e(){e._super.call(this),this.label("Image"),this._textures=[],this._image=null}var n=t("./core");t("./pin"),t("./loop");var r=t("./util/repeat"),s=t("./util/create");i.exports=e,n.image=function(t){var i=new e;return t&&i.image(t),i},e._super=n,e.prototype=s(e._super.prototype),e.prototype.setImage=function(t,i,e){return this.image(t,i,e)},e.prototype.image=function(t){return this._image=n.texture(t).one(),this.pin("width",this._image?this._image.width:0),this.pin("height",this._image?this._image.height:0),this._textures[0]=this._image.pipe(),this._textures.length=1,this},e.prototype.tile=function(t){return this._repeat(!1,t),this},e.prototype.stretch=function(t){return this._repeat(!0,t),this},e.prototype._repeat=function(t,i){function e(t,i,e,r,s,o,h,a,u){var f=n._textures.length>t?n._textures[t]:n._textures[t]=n._image.pipe();f.src(i,e,r,s),f.dest(o,h,a,u)}var n=this;this.untick(this._repeatTicker),this.tick(this._repeatTicker=function(){if(this._mo_stretch!=this._pin._ts_transform){this._mo_stretch=this._pin._ts_transform;var n=this.pin("width"),s=this.pin("height");this._textures.length=r(this._image,n,s,t,i,e)}})}},{"./core":8,"./loop":14,"./pin":16,"./util/create":22,"./util/repeat":27}],11:[function(t,i){i.exports=t("./core"),i.exports.Matrix=t("./matrix"),i.exports.Texture=t("./texture"),t("./atlas"),t("./tree"),t("./event"),t("./pin"),t("./loop"),t("./root")},{"./atlas":6,"./core":8,"./event":9,"./loop":14,"./matrix":15,"./pin":16,"./root":17,"./texture":19,"./tree":20}],12:[function(t){var i=t("./core");t("./pin"),t("./loop");t("./util/create");i.row=function(t){return i.create().row(t).label("Row")},i.prototype.row=function(t){return this.sequence("row",t),this},i.column=function(t){return i.create().column(t).label("Row")},i.prototype.column=function(t){return this.sequence("column",t),this},i.sequence=function(t,e){return i.create().sequence(t,e).label("Sequence")},i.prototype.sequence=function(t,i){return this._padding=this._padding||0,this._spacing=this._spacing||0,this.untick(this._layoutTiker),this.tick(this._layoutTiker=function(){if(this._mo_seq!=this._ts_touch){this._mo_seq=this._ts_touch;var e=this._mo_seqAlign!=this._ts_children;this._mo_seqAlign=this._ts_children;for(var n,r=0,s=0,o=this.first(!0),h=!0;n=o;){o=n.next(!0),n.matrix(!0);var a=n.pin("boxWidth"),u=n.pin("boxHeight");"column"==t?(!h&&(s+=this._spacing),n.pin("offsetY")!=s&&n.pin("offsetY",s),r=Math.max(r,a),s+=u,e&&n.pin("alignX",i)):"row"==t&&(!h&&(r+=this._spacing),n.pin("offsetX")!=r&&n.pin("offsetX",r),r+=a,s=Math.max(s,u),e&&n.pin("alignY",i)),h=!1}r+=2*this._padding,s+=2*this._padding,this.pin("width")!=r&&this.pin("width",r),this.pin("height")!=s&&this.pin("height",s)}}),this},i.box=function(){return i.create().box().label("Box")},i.prototype.box=function(){return this._padding=this._padding||0,this.untick(this._layoutTiker),this.tick(this._layoutTiker=function(){if(this._mo_box!=this._ts_touch){this._mo_box=this._ts_touch;for(var t,i=0,e=0,n=this.first(!0);t=n;){n=t.next(!0),t.matrix(!0);var r=t.pin("boxWidth"),s=t.pin("boxHeight");i=Math.max(i,r),e=Math.max(e,s)}i+=2*this._padding,e+=2*this._padding,this.pin("width")!=i&&this.pin("width",i),this.pin("height")!=e&&this.pin("height",e)}}),this},i.layer=function(){return i.create().layer().label("Layer")},i.prototype.layer=function(){return this.untick(this._layoutTiker),this.tick(this._layoutTiker=function(){var t=this.parent();if(t){var i=t.pin("width");this.pin("width")!=i&&this.pin("width",i);var e=t.pin("height");this.pin("height")!=e&&this.pin("height",e)}},!0),this},i.prototype.padding=function(t){return this._padding=t,this},i.prototype.spacing=function(t){return this._spacing=t,this}},{"./core":8,"./loop":14,"./pin":16,"./util/create":22}],13:[function(t){function i(t,i){function e(){o.setTransform(1,0,0,1,0,0),o.clearRect(0,0,a,u),d.render(o)}function r(){h?(a=window.innerWidth>0?window.innerWidth:screen.width,u=window.innerHeight>0?window.innerHeight:screen.height,s.style.width=a+"px",s.style.height=u+"px"):(a=s.clientWidth,u=s.clientHeight),a*=f,u*=f,(s.width!==a||s.height!==u)&&(s.width=a,s.height=u,DEBUG&&console.log("Resize: "+a+" x "+u+" / "+f),d.viewport(a,u,f),e())}i=i||{};var s=i.canvas,o=null,h=!1,a=0,u=0,f=1;if("string"==typeof s&&(s=document.getElementById(s)),s||(s=document.getElementById("cutjs")||document.getElementById("stage")),!s){h=!0,DEBUG&&console.log("Creating Canvas..."),s=document.createElement("canvas"),s.style.position="absolute",s.style.top="0",s.style.left="0";var c=document.body;c.insertBefore(s,c.firstChild)}o=s.getContext("2d");var p=window.devicePixelRatio||1,l=o.webkitBackingStorePixelRatio||o.mozBackingStorePixelRatio||o.msBackingStorePixelRatio||o.oBackingStorePixelRatio||o.backingStorePixelRatio||1;f=p/l;var _=window.requestAnimationFrame||window.msRequestAnimationFrame||window.mozRequestAnimationFrame||window.webkitRequestAnimationFrame||window.oRequestAnimationFrame||function(t){return window.setTimeout(t,1e3/60)};DEBUG&&console.log("Creating stage...");var d=n.root(_,e);d.background=function(t){return s.style.backgroundColor=t,this},t(d,s),r(),window.addEventListener("resize",r,!1),window.addEventListener("orientationchange",r,!1)}function e(t,i,e){DEBUG&&console.log("Loading image: "+t);var n=new Image;n.onload=function(){i(n)},n.onerror=e,n.src=t}"undefined"==typeof DEBUG&&(DEBUG=!0);var n=t("../core");n._supported=function(){var t=document.createElement("canvas");return t.getContext&&t.getContext("2d")?!0:!1}(),window.addEventListener("load",function(){DEBUG&&console.log("On load."),n._supported&&n.start()},!1),n.config({"app-loader":i,"image-loader":e})},{"../core":8}],14:[function(t){var i=t("./core");t("./pin");var e=t("./util/stats");i.prototype._textures=null,i.prototype._alpha=1,i.prototype.render=function(t){if(this._visible){e.node++;var i=this.matrix();t.setTransform(i.a,i.b,i.c,i.d,i.e,i.f),this._alpha=this._pin._alpha*(this._parent?this._parent._alpha:1);var n=this._pin._textureAlpha*this._alpha;if(t.globalAlpha!=n&&(t.globalAlpha=n),null!==this._textures)for(var r=0,s=this._textures.length;s>r;r++)this._textures[r].draw(t);t.globalAlpha!=this._alpha&&(t.globalAlpha=this._alpha);for(var o,h=this._first;o=h;)h=o._next,o.render(t)}},i.prototype._tickBefore=null,i.prototype._tickAfter=null,i.prototype.MAX_ELAPSE=1/0,i.prototype._tick=function(t,i,n){if(this._visible){t>this.MAX_ELAPSE&&(t=this.MAX_ELAPSE);var r=!1;if(null!==this._tickBefore)for(var s=0;s<this._tickBefore.length;s++){e.tick++;var o=this._tickBefore[s];r=o.call(this,t,i,n)===!0||r}for(var h,a=this._first;h=a;)a=h._next,h._flag("_tick")&&(r=h._tick(t,i,n)===!0?!0:r);if(null!==this._tickAfter)for(var s=0;s<this._tickAfter.length;s++){e.tick++;var o=this._tickAfter[s];r=o.call(this,t,i,n)===!0||r}return r}},i.prototype.tick=function(t,i){"function"==typeof t&&(i?(null===this._tickBefore&&(this._tickBefore=[]),this._tickBefore.push(t)):(null===this._tickAfter&&(this._tickAfter=[]),this._tickAfter.push(t)),this._flag("_tick",null!==this._tickAfter&&this._tickAfter.length>0||null!==this._tickBefore&&this._tickBefore.length>0))},i.prototype.untick=function(t){if("function"==typeof t){var i;null!==this._tickBefore&&(i=this._tickBefore.indexOf(t))>=0&&this._tickBefore.splice(i,1),null!==this._tickAfter&&(i=this._tickAfter.indexOf(t))>=0&&this._tickAfter.splice(i,1)}},i.prototype.timeout=function(t,i){this.setTimeout(t,i)},i.prototype.setTimeout=function(t,i){function e(n){return(i-=n)<0?(this.untick(e),void t.call(this)):!0}return this.tick(e),e},i.prototype.clearTimeout=function(t){this.untick(t)}},{"./core":8,"./pin":16,"./util/stats":28}],15:[function(t,i){function e(t,i,e,n,r,s){this.reset(t,i,e,n,r,s)}e.prototype.toString=function(){return"["+this.a+", "+this.b+", "+this.c+", "+this.d+", "+this.e+", "+this.f+"]"},e.prototype.clone=function(){return new e(this.a,this.b,this.c,this.d,this.e,this.f)},e.prototype.reset=function(t,i,e,n,r,s){return this._dirty=!0,"object"==typeof t?(this.a=t.a,this.d=t.d,this.b=t.b,this.c=t.c,this.e=t.e,this.f=t.f):(this.a=t||1,this.d=n||1,this.b=i||0,this.c=e||0,this.e=r||0,this.f=s||0),this},e.prototype.identity=function(){return this._dirty=!0,this.a=1,this.b=0,this.c=0,this.d=1,this.e=0,this.f=0,this},e.prototype.rotate=function(t){if(!t)return this;this._dirty=!0;var i=t?Math.cos(t):1,e=t?Math.sin(t):0,n=i*this.a-e*this.b,r=i*this.b+e*this.a,s=i*this.c-e*this.d,o=i*this.d+e*this.c,h=i*this.e-e*this.f,a=i*this.f+e*this.e;return this.a=n,this.b=r,this.c=s,this.d=o,this.e=h,this.f=a,this},e.prototype.translate=function(t,i){return t||i?(this._dirty=!0,this.e+=t,this.f+=i,this):this},e.prototype.scale=function(t,i){return t-1||i-1?(this._dirty=!0,this.a*=t,this.b*=i,this.c*=t,this.d*=i,this.e*=t,this.f*=i,this):this},e.prototype.skew=function(t,i){if(!t&&!i)return this;this._dirty=!0;var e=this.a+this.b*t,n=this.b+this.a*i,r=this.c+this.d*t,s=this.d+this.c*i,o=this.e+this.f*t,h=this.f+this.e*i;return this.a=e,this.b=n,this.c=r,this.d=s,this.e=o,this.f=h,this},e.prototype.concat=function(t){this._dirty=!0;var i=this,e=i.a*t.a+i.b*t.c,n=i.b*t.d+i.a*t.b,r=i.c*t.a+i.d*t.c,s=i.d*t.d+i.c*t.b,o=i.e*t.a+t.e+i.f*t.c,h=i.f*t.d+t.f+i.e*t.b;return this.a=e,this.b=n,this.c=r,this.d=s,this.e=o,this.f=h,this},e.prototype.inverse=e.prototype.reverse=function(){if(this._dirty){this._dirty=!1,this.inversed=this.inversed||new e;var t=this.a*this.d-this.b*this.c;this.inversed.a=this.d/t,this.inversed.b=-this.b/t,this.inversed.c=-this.c/t,this.inversed.d=this.a/t,this.inversed.e=(this.c*this.f-this.e*this.d)/t,this.inversed.f=(this.e*this.b-this.a*this.f)/t}return this.inversed},e.prototype.map=function(t,i){return i=i||{},i.x=this.a*t.x+this.c*t.y+this.e,i.y=this.b*t.x+this.d*t.y+this.f,i},e.prototype.mapX=function(t,i){return"object"==typeof t&&(i=t.y,t=t.x),this.a*t+this.c*i+this.e},e.prototype.mapY=function(t,i){return"object"==typeof t&&(i=t.y,t=t.x),this.b*t+this.d*i+this.f},i.exports=e},{}],16:[function(t,i){function e(t){this._owner=t,this._parent=null,this._relativeMatrix=new s,this._absoluteMatrix=new s,this.reset()}function n(t,i,e,n){var r="number"==typeof i,s="number"==typeof e,h="string"==typeof n;t._ts_transform=++o,r&&(t._scaleX=i/t._width_,t._width=t._width_),s&&(t._scaleY=e/t._height_,t._height=t._height_),r&&s&&h&&("out"==n||"out-crop"==n?t._scaleX=t._scaleY=Math.max(t._scaleX,t._scaleY):("in"==n||"in-pad"==n)&&(t._scaleX=t._scaleY=Math.min(t._scaleX,t._scaleY)),("out-crop"==n||"in-pad"==n)&&(t._width=i/t._scaleX,t._height=e/t._scaleY))}var r=t("./core"),s=t("./matrix"),o=0;r._init(function(){this._pin=new e(this)}),r.prototype.matrix=function(t){return t===!0?this._pin.relativeMatrix():this._pin.absoluteMatrix()},r.prototype.pin=function(t,i){return"object"==typeof t?(this._pin.set(t),this):"string"==typeof t?"undefined"==typeof i?this._pin.get(t):(this._pin.set(t,i),this):"undefined"==typeof t?this._pin:void 0},e.prototype.reset=function(){this._textureAlpha=1,this._alpha=1,this._width=0,this._height=0,this._scaleX=1,this._scaleY=1,this._skewX=0,this._skewY=0,this._rotation=0,this._pivoted=!1,this._pivotX=null,this._pivotY=null,this._handled=!1,this._handleX=0,this._handleY=0,this._aligned=!1,this._alignX=0,this._alignY=0,this._offsetX=0,this._offsetY=0,this._boxX=0,this._boxY=0,this._boxWidth=this._width,this._boxHeight=this._height,this._ts_translate=++o,this._ts_transform=++o,this._ts_matrix=++o},e.prototype._update=function(){return this._parent=this._owner._parent&&this._owner._parent._pin,this._handled&&this._mo_handle!=this._ts_transform&&(this._mo_handle=this._ts_transform,this._ts_translate=++o),this._aligned&&this._parent&&this._mo_align!=this._parent._ts_transform&&(this._mo_align=this._parent._ts_transform,this._ts_translate=++o),this},e.prototype.toString=function(){return this._owner+" ("+(this._parent?this._parent._owner:null)+")"},e.prototype.absoluteMatrix=function(){this._update();var t=Math.max(this._ts_transform,this._ts_translate,this._parent?this._parent._ts_matrix:0);if(this._mo_abs==t)return this._absoluteMatrix;this._mo_abs=t;var i=this._absoluteMatrix;return i.reset(this.relativeMatrix()),this._parent&&i.concat(this._parent._absoluteMatrix),this._ts_matrix=++o,i},e.prototype.relativeMatrix=function(){this._update();var t=Math.max(this._ts_transform,this._ts_translate,this._parent?this._parent._ts_transform:0);if(this._mo_rel==t)return this._relativeMatrix;this._mo_rel=t;var i=this._relativeMatrix;if(i.identity(),this._pivoted&&i.translate(-this._pivotX*this._width,-this._pivotY*this._height),i.scale(this._scaleX,this._scaleY),i.skew(this._skewX,this._skewY),i.rotate(this._rotation),this._pivoted&&i.translate(this._pivotX*this._width,this._pivotY*this._height),this._pivoted)this._boxX=0,this._boxY=0,this._boxWidth=this._width,this._boxHeight=this._height;else{var e,n;i.a>0&&i.c>0||i.a<0&&i.c<0?(e=0,n=i.a*this._width+i.c*this._height):(e=i.a*this._width,n=i.c*this._height),e>n?(this._boxX=n,this._boxWidth=e-n):(this._boxX=e,this._boxWidth=n-e),i.b>0&&i.d>0||i.b<0&&i.d<0?(e=0,n=i.b*this._width+i.d*this._height):(e=i.b*this._width,n=i.d*this._height),e>n?(this._boxY=n,this._boxHeight=e-n):(this._boxY=e,this._boxHeight=n-e)}return this._x=this._offsetX,this._y=this._offsetY,this._x-=this._boxX+this._handleX*this._boxWidth,this._y-=this._boxY+this._handleY*this._boxHeight,this._aligned&&this._parent&&(this._parent.relativeMatrix(),this._x+=this._alignX*this._parent._width,this._y+=this._alignY*this._parent._height),i.translate(this._x,this._y),this._relativeMatrix},e.prototype.get=function(t){return"function"==typeof h[t]?h[t](this):void 0},e.prototype.set=function(t,i){if("string"==typeof t)"function"==typeof a[t]&&"undefined"!=typeof i&&a[t](this,i);else if("object"==typeof t)for(i in t)"function"==typeof a[i]&&"undefined"!=typeof t[i]&&a[i](this,t[i],t);return this._owner&&(this._owner._ts_pin=++o,this._owner.touch()),this};var h={alpha:function(t){return t._alpha},textureAlpha:function(t){return t._textureAlpha},width:function(t){return t._width},height:function(t){return t._height},boxWidth:function(t){return t._boxWidth},boxHeight:function(t){return t._boxHeight},scaleX:function(t){return t._scaleX},scaleY:function(t){return t._scaleY},skewX:function(t){return t._skewX},skewY:function(t){return t._skewY},rotation:function(t){return t._rotation},pivotX:function(t){return t._pivotX},pivotY:function(t){return t._pivotY},offsetX:function(t){return t._offsetX},offsetY:function(t){return t._offsetY},alignX:function(t){return t._alignX},alignY:function(t){return t._alignY},handleX:function(t){return t._handleX},handleY:function(t){return t._handleY}},a={alpha:function(t,i){t._alpha=i},textureAlpha:function(t,i){t._textureAlpha=i},width:function(t,i){t._width_=i,t._width=i,t._ts_transform=++o},height:function(t,i){t._height_=i,t._height=i,t._ts_transform=++o},scale:function(t,i){t._scaleX=i,t._scaleY=i,t._ts_transform=++o},scaleX:function(t,i){t._scaleX=i,t._ts_transform=++o},scaleY:function(t,i){t._scaleY=i,t._ts_transform=++o},skew:function(t,i){t._skewX=i,t._skewY=i,t._ts_transform=++o},skewX:function(t,i){t._skewX=i,t._ts_transform=++o},skewY:function(t,i){t._skewY=i,t._ts_transform=++o},rotation:function(t,i){t._rotation=i,t._ts_transform=++o},pivot:function(t,i){t._pivotX=i,t._pivotY=i,t._pivoted=!0,t._ts_transform=++o},pivotX:function(t,i){t._pivotX=i,t._pivoted=!0,t._ts_transform=++o},pivotY:function(t,i){t._pivotY=i,t._pivoted=!0,t._ts_transform=++o},offset:function(t,i){t._offsetX=i,t._offsetY=i,t._ts_translate=++o},offsetX:function(t,i){t._offsetX=i,t._ts_translate=++o},offsetY:function(t,i){t._offsetY=i,t._ts_translate=++o},align:function(t,i){this.alignX(t,i),this.alignY(t,i)},alignX:function(t,i){t._alignX=i,t._aligned=!0,t._ts_translate=++o,this.handleX(t,i)},alignY:function(t,i){t._alignY=i,t._aligned=!0,t._ts_translate=++o,this.handleY(t,i)},handle:function(t,i){this.handleX(t,i),this.handleY(t,i)},handleX:function(t,i){t._handleX=i,t._handled=!0,t._ts_translate=++o},handleY:function(t,i){t._handleY=i,t._handled=!0,t._ts_translate=++o},resizeMode:function(t,i,e){e&&("in"==i?i="in-pad":"out"==i&&(i="out-crop"),n(t,e.resizeWidth,e.resizeHeight,i))},resizeWidth:function(t,i,e){e&&e.resizeMode||n(t,i,null)},resizeHeight:function(t,i,e){e&&e.resizeMode||n(t,null,i)
},scaleMode:function(t,i,e){e&&n(t,e.scaleWidth,e.scaleHeight,i)},scaleWidth:function(t,i,e){e&&e.scaleMode||n(t,i,null)},scaleHeight:function(t,i,e){e&&e.scaleMode||n(t,null,i)},matrix:function(t,i){this.scaleX(t,i.a),this.skewX(t,i.c/i.d),this.skewY(t,i.b/i.a),this.scaleY(t,i.d),this.offsetX(t,i.e),this.offsetY(t,i.f),this.rotation(t,0)}};r.prototype.scaleTo=function(t,i,e){return"object"==typeof t&&(e=i,i=t.y,t=t.x),n(this._pin,t,i,e),this},e._add_shortcuts=function(t){t.prototype.size=function(t,i){return this.pin("width",t),this.pin("height",i),this},t.prototype.width=function(t){return"undefined"==typeof t?this.pin("width"):(this.pin("width",t),this)},t.prototype.height=function(t){return"undefined"==typeof t?this.pin("height"):(this.pin("height",t),this)},t.prototype.offset=function(t,i){return"object"==typeof t&&(i=t.y,t=t.x),this.pin("offsetX",t),this.pin("offsetY",i),this},t.prototype.rotate=function(t){return this.pin("rotation",t),this},t.prototype.skew=function(t,i){return"object"==typeof t?(i=t.y,t=t.x):"undefined"==typeof i&&(i=t),this.pin("skewX",t),this.pin("skewY",i),this},t.prototype.scale=function(t,i){return"object"==typeof t?(i=t.y,t=t.x):"undefined"==typeof i&&(i=t),this.pin("scaleX",t),this.pin("scaleY",i),this},t.prototype.alpha=function(t,i){return this.pin("alpha",t),"undefined"!=typeof i&&this.pin("textureAlpha",i),this}},e._add_shortcuts(r),i.exports=e},{"./core":8,"./matrix":15}],17:[function(t){function i(t,e){i._super.call(this),this.label("Root");var r=!0,s=this,o=0,h=function(i){if(r!==!0){n.tick=n.node=n.draw=0;var a=o||i,u=i-a;o=i;var f=s._tick(u,i,a);s._mo_touch!=s._ts_touch?(s._mo_touch=s._ts_touch,e(s),t(h)):f?t(h):r=!0,n.fps=u?1e3/u:0}};this.start=function(){return this.resume()},this.resume=function(){return r&&(this.publish("resume"),r=!1,t(h)),this},this.pause=function(){return r||this.publish("pause"),r=!0,this},this.touch_root=this.touch,this.touch=function(){return this.resume(),this.touch_root()}}var e=t("./core");t("./pin"),t("./loop");var n=t("./util/stats"),r=t("./util/create"),s=t("./util/extend");i._super=e,i.prototype=r(i._super.prototype),e.root=function(t,e){return new i(t,e)},i.prototype.background=function(){return this},i.prototype.viewport=function(t,i,e){if("undefined"==typeof t)return s({},this._viewport);this._viewport={width:t,height:i,ratio:e||1},this.viewbox();var n=s({},this._viewport);return this.visit({start:function(t){return t._flag("viewport")?void t.publish("viewport",[n]):!0}}),this},i.prototype.viewbox=function(t,i,e){"number"==typeof t&&"number"==typeof i&&(this._viewbox={width:t,height:i,mode:/^(in|out|in-pad|out-crop)$/.test(e)?e:"in-pad"});var n=this._viewbox,r=this._viewport;return r&&n?(this.pin({width:n.width,height:n.height}),this.scaleTo(r.width,r.height,n.mode)):r&&this.pin({width:r.width,height:r.height}),this}},{"./core":8,"./loop":14,"./pin":16,"./util/create":22,"./util/extend":24,"./util/stats":28}],18:[function(t){function i(){i._super.call(this),this.label("String"),this._textures=[]}var e=t("./core");t("./pin"),t("./loop");var n=t("./util/create"),r=t("./util/is");e.string=function(t){return(new i).frames(t)},i._super=e,i.prototype=n(i._super.prototype),i.prototype.setFont=function(t,i,e){return this.frames(t,i,e)},i.prototype.frames=function(t){return this._textures=[],"string"==typeof t?(t=e.texture(t),this._item=function(i){return t.one(i)}):"object"==typeof t?this._item=function(i){return t[i]}:"function"==typeof t&&(this._item=t),this},i.prototype.setValue=function(t,i,e){return this.value(t,i,e)},i.prototype.value=function(t){if("undefined"==typeof t)return this._value;if(this._value===t)return this;this._value=t,null===t?t="":"string"==typeof t||r.array(t)||(t=t.toString()),this._spacing=this._spacing||0;for(var i=0,e=0,n=0;n<t.length;n++){var s=this._textures[n]=this._item(t[n]);i+=n>0?this._spacing:0,s.dest(i,0),i+=s.width,e=Math.max(e,s.height)}return this.pin("width",i),this.pin("height",e),this._textures.length=t.length,this}},{"./core":8,"./loop":14,"./pin":16,"./util/create":22,"./util/is":25}],19:[function(t,i){function e(t,i){"object"==typeof t&&this.src(t,i)}var n=t("./util/stats"),r=t("./util/math");e.prototype.pipe=function(){return new e(this)},e.prototype.src=function(t,i,e,n){if("object"==typeof t){var r=t,s=i||1;this._image=r,this._sx=this._dx=0,this._sy=this._dy=0,this._sw=this._dw=r.width/s,this._sh=this._dh=r.height/s,this.width=r.width/s,this.height=r.height/s,this.ratio=s}else"undefined"==typeof e?(e=t,n=i):(this._sx=t,this._sy=i),this._sw=this._dw=e,this._sh=this._dh=n,this.width=e,this.height=n;return this},e.prototype.dest=function(t,i,e,n){return this._dx=t,this._dy=i,this._dx=t,this._dy=i,"undefined"!=typeof e&&(this._dw=e,this._dh=n,this.width=e,this.height=n),this},e.prototype.draw=function(t,i,e,s,o,h,a,u,f){var c=this._image;if(null!==c&&"object"==typeof c){var p=this._sx,l=this._sy,_=this._sw,d=this._sh,g=this._dx,y=this._dy,m=this._dw,v=this._dh;"undefined"!=typeof h?(i=r.limit(i,0,this._sw),s=r.limit(s,0,this._sw-i),e=r.limit(e,0,this._sh),o=r.limit(o,0,this._sh-e),p+=i,l+=e,_=s,d=o,g=h,y=a,m=u,v=f):"undefined"!=typeof s?(g=i,y=e,m=s,v=o):"undefined"!=typeof i&&(m=i,v=e);var x=this.ratio||1;p*=x,l*=x,_*=x,d*=x;try{"function"==typeof c.draw?c.draw(t,p,l,_,d,g,y,m,v):(n.draw++,t.drawImage(c,p,l,_,d,g,y,m,v))}catch(b){c._draw_failed||(console.log("Unable to draw: ",c),console.log(b),c._draw_failed=!0)}}},i.exports=e},{"./util/math":26,"./util/stats":28}],20:[function(t,i){function e(t,i){o(i),o(t),i.remove(),t._last&&(t._last._next=i,i._prev=t._last),i._parent=t,t._last=i,t._first||(t._first=i),i._parent._flag(i,!0),i._ts_parent=++u,t._ts_children=++u,t.touch()}function n(t,i){o(i),o(t),i.remove(),t._first&&(t._first._prev=i,i._next=t._first),i._parent=t,t._first=i,t._last||(t._last=i),i._parent._flag(i,!0),i._ts_parent=++u,t._ts_children=++u,t.touch()}function r(t,i){o(t),o(i),t.remove();var e=i._parent,n=i._prev;i._prev=t,n&&(n._next=t)||e&&(e._first=t),t._parent=e,t._prev=n,t._next=i,t._parent._flag(t,!0),t._ts_parent=++u,t.touch()}function s(t,i){o(t),o(i),t.remove();var e=i._parent,n=i._next;i._next=t,n&&(n._prev=t)||e&&(e._last=t),t._parent=e,t._prev=i,t._next=n,t._parent._flag(t,!0),t._ts_parent=++u,t.touch()}function o(t){if(t&&t instanceof h)return t;throw"Invalid node: "+t}var h=t("./core"),a=t("./util/is"),u=0;h.prototype._label="",h.prototype._visible=!0,h.prototype._parent=null,h.prototype._next=null,h.prototype._prev=null,h.prototype._first=null,h.prototype._last=null,h.prototype._attrs=null,h.prototype._flags=null,h.prototype.toString=function(){return"["+this._label+"]"},h.prototype.id=function(t){return this.label(t)},h.prototype.label=function(t){return"undefined"==typeof t?this._label:(this._label=t,this)},h.prototype.attr=function(t,i){return"undefined"==typeof i?null!==this._attrs?this._attrs[t]:void 0:((null!==this._attrs?this._attrs:this._attrs={})[t]=i,this)},h.prototype.visible=function(t){return"undefined"==typeof t?this._visible:(this._visible=t,this._parent&&(this._parent._ts_children=++u),this._ts_pin=++u,this.touch(),this)},h.prototype.hide=function(){return this.visible(!1)},h.prototype.show=function(){return this.visible(!0)},h.prototype.parent=function(){return this._parent},h.prototype.next=function(t){for(var i=this._next;i&&t&&!i._visible;)i=i._next;return i},h.prototype.prev=function(t){for(var i=this._prev;i&&t&&!i._visible;)i=i._prev;return i},h.prototype.first=function(t){for(var i=this._first;i&&t&&!i._visible;)i=i._next;return i},h.prototype.last=function(t){for(var i=this._last;i&&t&&!i._visible;)i=i._prev;return i},h.prototype.visit=function(t,i){var e=t.reverse,n=t.visible;if(!t.start||!t.start(this,i)){for(var r,s=e?this.last(n):this.first(n);r=s;)if(s=e?r.prev(n):r.next(n),r.visit(t,i))return!0;return t.end&&t.end(this,i)}},h.prototype.append=function(t,i){if(a.array(t))for(var n=0;n<t.length;n++)e(this,t[n]);else if("undefined"!=typeof i)for(var n=0;n<arguments.length;n++)e(this,arguments[n]);else"undefined"!=typeof t&&e(this,t);return this},h.prototype.prepend=function(t,i){if(a.array(t))for(var e=t.length-1;e>=0;e--)n(this,t[e]);else if("undefined"!=typeof i)for(var e=arguments.length-1;e>=0;e--)n(this,arguments[e]);else"undefined"!=typeof t&&n(this,t);return this},h.prototype.appendTo=function(t){return e(t,this),this},h.prototype.prependTo=function(t){return n(t,this),this},h.prototype.insertNext=function(t,i){if(a.array(t))for(var e=0;e<t.length;e++)s(t[e],this);else if("undefined"!=typeof i)for(var e=0;e<arguments.length;e++)s(arguments[e],this);else"undefined"!=typeof t&&s(t,this);return this},h.prototype.insertPrev=function(t,i){if(a.array(t))for(var e=t.length-1;e>=0;e--)r(t[e],this);else if("undefined"!=typeof i)for(var e=arguments.length-1;e>=0;e--)r(arguments[e],this);else"undefined"!=typeof t&&r(t,this);return this},h.prototype.insertAfter=function(t){return s(this,t),this},h.prototype.insertBefore=function(t){return r(this,t),this},h.prototype.remove=function(t,i){if("undefined"!=typeof t){if(a.array(t))for(var e=0;e<t.length;e++)o(t[e]).remove();else if("undefined"!=typeof i)for(var e=0;e<arguments.length;e++)o(arguments[e]).remove();else o(t).remove();return this}return this._prev&&(this._prev._next=this._next),this._next&&(this._next._prev=this._prev),this._parent&&(this._parent._first===this&&(this._parent._first=this._next),this._parent._last===this&&(this._parent._last=this._prev),this._parent._flag(this,!1),this._parent._ts_children=++u,this._parent.touch()),this._prev=this._next=this._parent=null,this._ts_parent=++u,this},h.prototype.empty=function(){for(var t,i=this._first;t=i;)i=t._next,t._prev=t._next=t._parent=null,this._flag(t,!1);return this._first=this._last=null,this._ts_children=++u,this.touch(),this},h.prototype.touch=function(){return this._ts_touch=++u,this._parent&&this._parent.touch(),this},h.prototype._flag=function(t,i){if("undefined"==typeof i)return null!==this._flags&&this._flags[t]||0;if("string"==typeof t&&(i?(this._flags=this._flags||{},!this._flags[t]&&this._parent&&this._parent._flag(t,!0),this._flags[t]=(this._flags[t]||0)+1):this._flags&&this._flags[t]>0&&(1==this._flags[t]&&this._parent&&this._parent._flag(t,!1),this._flags[t]=this._flags[t]-1)),"object"==typeof t&&t._flags)for(var e in t._flags)t._flags[e]>0&&this._flag(e,i);return this},h.prototype.hitTest=function(t){return this.attr("spy")?!0:t.x>=0&&t.x<=this._pin._width&&t.y>=0&&t.y<=this._pin._height},i.exports=h},{"./core":8,"./util/is":25}],21:[function(t,i){i.exports=function(){function t(t,n){return e+=n="number"==typeof n&&n>=1?n:1,function(){t&&t.apply(this,arguments),n>0&&(n--,e--,i())}}function i(){if(0===e)for(;n.length;)setTimeout(n.shift(),0)}var e=0,n=[];return t.then=function(t){0===e?setTimeout(t,0):n.push(t)},t}},{}],22:[function(t,i){function e(){}i.exports="function"==typeof Object.create?function(t,i){return Object.create.call(Object,t,i)}:function(t,i){if(i)throw Error("Second argument is not supported!");if("object"!=typeof t||null===t)throw Error("Invalid prototype!");return e.prototype=t,new e}},{}],23:[function(t,i){i.exports=function(t,i){t._listeners=null,t.on=t.listen=function(t,e){if(!t||!t.length||"function"!=typeof e)return this;null===this._listeners&&(this._listeners={});var n="string"!=typeof t&&"function"==typeof t.join;if(t=(n?t.join(" "):t).match(/\S+/g))for(var r=0;r<t.length;r++){var s=t[r];this._listeners[s]=this._listeners[s]||[],this._listeners[s].push(e),"function"==typeof i&&i(this,s,!0)}return this},t.off=function(t,e){if(!t||!t.length||"function"!=typeof e)return this;if(null===this._listeners)return this;var n="string"!=typeof t&&"function"==typeof t.join;if(t=(n?t.join(" "):t).match(/\S+/g))for(var r=0;r<t.length;r++){var s,o=t[r],h=this._listeners[o];h&&(s=h.indexOf(e))>=0&&(h.splice(s,1),h.length||delete this._listeners[o],"function"==typeof i&&i(this,o,!1))}return this},t.listeners=function(t){return this._listeners&&this._listeners[t]},t.publish=function(t,i){var e=this.listeners(t);if(!e||!e.length)return 0;for(var n=0;n<e.length;n++)e[n].apply(this,i);return e.length},t.trigger=function(t,i){return this.publish(t,i),this}}},{}],24:[function(t,i){i.exports=function(t){for(var i=1;i<arguments.length;i++){var e=arguments[i];for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])}return t}},{}],25:[function(t,i){var e=Object.prototype,n=e.hasOwnProperty,r=e.toString,s=/^[A-Fa-f0-9]+$/,o=i.exports={};o.a=o.an=o.type=function(t,i){return typeof t===i},o.defined=function(t){return"undefined"!=typeof t},o.empty=function(t){var i,e=r.call(t);if("[object Array]"===e||"[object Arguments]"===e||"[object String]"===e)return 0===t.length;if("[object Object]"===e){for(i in t)if(n.call(t,i))return!1;return!0}return!t},o.equal=function(t,i){if(t===i)return!0;var e,n=r.call(t);if(n!==r.call(i))return!1;if("[object Object]"===n){for(e in t)if(!(o.equal(t[e],i[e])&&e in i))return!1;for(e in i)if(!(o.equal(t[e],i[e])&&e in t))return!1;return!0}if("[object Array]"===n){if(e=t.length,e!==i.length)return!1;for(;--e;)if(!o.equal(t[e],i[e]))return!1;return!0}return"[object Function]"===n?t.prototype===i.prototype:"[object Date]"===n?t.getTime()===i.getTime():!1},o.instance=function(t,i){return t instanceof i},o.nil=function(t){return null===t},o.undef=function(t){return"undefined"==typeof t},o.array=function(t){return"[object Array]"===r.call(t)},o.emptyarray=function(t){return o.array(t)&&0===t.length},o.arraylike=function(t){return!!t&&!o["boolean"](t)&&n.call(t,"length")&&isFinite(t.length)&&o.number(t.length)&&t.length>=0},o["boolean"]=function(t){return"[object Boolean]"===r.call(t)},o.element=function(t){return void 0!==t&&"undefined"!=typeof HTMLElement&&t instanceof HTMLElement&&1===t.nodeType},o.fn=function(t){return"[object Function]"===r.call(t)},o.number=function(t){return"[object Number]"===r.call(t)},o.nan=function(t){return!o.number(t)||t!==t},o.object=function(t){return"[object Object]"===r.call(t)},o.hash=function(t){return o.object(t)&&t.constructor===Object&&!t.nodeType&&!t.setInterval},o.regexp=function(t){return"[object RegExp]"===r.call(t)},o.string=function(t){return"[object String]"===r.call(t)},o.hex=function(t){return o.string(t)&&(!t.length||s.test(t))}},{}],26:[function(t,i){var e=t("./create"),n=Math;i.exports=e(Math),i.exports.random=function(t,i){return"undefined"==typeof t?(i=1,t=0):"undefined"==typeof i&&(i=t,t=0),t==i?t:n.random()*(i-t)+t},i.exports.rotate=function(t,i,e){return"undefined"==typeof i?(e=1,i=0):"undefined"==typeof e&&(e=i,i=0),e>i?(t=(t-i)%(e-i),t+(0>t?e:i)):(t=(t-e)%(i-e),t+(0>=t?i:e))},i.exports.limit=function(t,i,e){return i>t?i:t>e?e:t},i.exports.length=function(t,i){return n.sqrt(t*t+i*i)}},{"./create":22}],27:[function(t,i){i.exports=function(t,i,e,n,r,s){var o=t.width,h=t.height,a=t.left,u=t.right,f=t.top,c=t.bottom;a="number"==typeof a&&a===a?a:0,u="number"==typeof u&&u===u?u:0,f="number"==typeof f&&f===f?f:0,c="number"==typeof c&&c===c?c:0,o=o-a-u,h=h-f-c,r||(i=Math.max(i-a-u,0),e=Math.max(e-f-c,0));var p=0;if(f>0&&a>0&&s(p++,0,0,a,f,0,0,a,f),c>0&&a>0&&s(p++,0,h+f,a,c,0,e+f,a,c),f>0&&u>0&&s(p++,o+a,0,u,f,i+a,0,u,f),c>0&&u>0&&s(p++,o+a,h+f,u,c,i+a,e+f,u,c),n)f>0&&s(p++,a,0,o,f,a,0,i,f),c>0&&s(p++,a,h+f,o,c,a,e+f,i,c),a>0&&s(p++,0,f,a,h,0,f,a,e),u>0&&s(p++,o+a,f,u,h,i+a,f,u,e),s(p++,a,f,o,h,a,f,i,e);else for(var l,_=a,d=i;d>0;){l=Math.min(o,d),d-=o;for(var g,y=f,m=e;m>0;)g=Math.min(h,m),m-=h,s(p++,a,f,l,g,_,y,l,g),0>=d&&(a&&s(p++,0,f,a,g,0,y,a,g),u&&s(p++,o+a,f,u,g,_+l,y,u,g)),y+=g;f&&s(p++,a,0,l,f,_,0,l,f),c&&s(p++,a,h+f,l,c,_,y,l,c),_+=l}return p}},{}],28:[function(t,i){i.exports={}},{}],29:[function(t,i){i.exports.startsWith=function(t,i){return"string"==typeof t&&"string"==typeof i&&t.substring(0,i.length)==i}},{}]},{},[1])(1)});
!function(t,i){"object"==typeof exports&&"object"==typeof module?module.exports=i():"function"==typeof define&&define.amd?define([],i):"object"==typeof exports?exports.Stage=i():t.Stage=i()}(window,(function(){return function(t){var i={};function e(n){if(i[n])return i[n].exports;var r=i[n]={i:n,l:!1,exports:{}};return t[n].call(r.exports,r,r.exports,e),r.l=!0,r.exports}return e.m=t,e.c=i,e.d=function(t,i,n){e.o(t,i)||Object.defineProperty(t,i,{enumerable:!0,get:n})},e.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},e.t=function(t,i){if(1&i&&(t=e(t)),8&i)return t;if(4&i&&"object"==typeof t&&t&&t.__esModule)return t;var n=Object.create(null);if(e.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:t}),2&i&&"string"!=typeof t)for(var r in t)e.d(n,r,function(i){return t[i]}.bind(null,r));return n},e.n=function(t){var i=t&&t.__esModule?function(){return t.default}:function(){return t};return e.d(i,"a",i),i},e.o=function(t,i){return Object.prototype.hasOwnProperty.call(t,i)},e.p="",e(e.s=27)}([function(t,i,e){var n=e(4),r=e(5),s=e(6),o=e(11);function h(t){if(!(this instanceof h))return s.fn(t)?h.app.apply(h,arguments):s.object(t)?h.atlas.apply(h,arguments):t;n.create++;for(var i=0;i<a.length;i++)a[i].call(this)}n.create=0;var a=[];h._init=function(t){a.push(t)};var u=[];h._load=function(t){u.push(t)};var f={};h.config=function(){if(1===arguments.length&&s.string(arguments[0]))return f[arguments[0]];1===arguments.length&&s.object(arguments[0])&&r(f,arguments[0]),2===arguments.length&&s.string(arguments[0])};var c=[],p=[],_=!1,l=!1;h.app=function(t,i){if(_){var e=h.config("app-loader");e((function(i,e){for(var n=0;n<u.length;n++)u[n].call(this,i,e);t(i,e),p.push(i),i.start()}),i)}else c.push(arguments)};var d=o();h.preload=function(t){if("string"==typeof t){var i=h.resolve(t);/\.js($|\?|\#)/.test(i)&&(t=function(t){!function(t,i){var e=document.createElement("script");e.addEventListener("load",(function(){i()})),e.addEventListener("error",(function(e){i(e||"Error loading script: "+t)})),e.src=t,e.id="preload-"+Date.now(),document.body.appendChild(e)}(i,t)})}"function"==typeof t&&t(d())},h.start=function(t){h.config(t),d.then((function(){for(_=!0;c.length;){var t=c.shift();h.app.apply(h,t)}}))},h.pause=function(){if(!l){l=!0;for(var t=p.length-1;t>=0;t--)p[t].pause()}},h.resume=function(){if(l){l=!1;for(var t=p.length-1;t>=0;t--)p[t].resume()}},h.create=function(){return new h},h.resolve=function(){if("undefined"==typeof window||"undefined"==typeof document)return function(t){return t};var t=document.getElementsByTagName("script");return function(i){if(/^\.\//.test(i)){var e=function(){if(document.currentScript)return document.currentScript.src;var i;try{var e=new Error;if(!e.stack)throw e;i=e.stack}catch(e){i=e.stack}if("string"==typeof i)for(var n=(i=i.split("\n")).length;n--;){var r=i[n].match(/(\w+\:\/\/[^/]*?\/.+?)(:\d+)(:\d+)?/);if(r)return r[1]}if(t.length&&"readyState"in t[0])for(n=t.length;n--;)if("interactive"===t[n].readyState)return t[n].src;return location.href}();i=e.substring(0,e.lastIndexOf("/")+1)+i.substring(2)}return i}}(),t.exports=h},function(t,i){if("function"==typeof Object.create)t.exports=function(t,i){return Object.create.call(Object,t,i)};else{function e(){}t.exports=function(t,i){if(i)throw Error("Second argument is not supported!");if("object"!=typeof t||null===t)throw Error("Invalid prototype!");return e.prototype=t,new e}}},function(t,i,e){var n=e(0),r=e(9),s=0;function o(t){this._owner=t,this._parent=null,this._relativeMatrix=new r,this._absoluteMatrix=new r,this.reset()}n._init((function(){this._pin=new o(this)})),n.prototype.matrix=function(t){return!0===t?this._pin.relativeMatrix():this._pin.absoluteMatrix()},n.prototype.pin=function(t,i){return"object"==typeof t?(this._pin.set(t),this):"string"==typeof t?void 0===i?this._pin.get(t):(this._pin.set(t,i),this):void 0===t?this._pin:void 0},o.prototype.reset=function(){this._textureAlpha=1,this._alpha=1,this._width=0,this._height=0,this._scaleX=1,this._scaleY=1,this._skewX=0,this._skewY=0,this._rotation=0,this._pivoted=!1,this._pivotX=null,this._pivotY=null,this._handled=!1,this._handleX=0,this._handleY=0,this._aligned=!1,this._alignX=0,this._alignY=0,this._offsetX=0,this._offsetY=0,this._boxX=0,this._boxY=0,this._boxWidth=this._width,this._boxHeight=this._height,this._ts_translate=++s,this._ts_transform=++s,this._ts_matrix=++s},o.prototype._update=function(){return this._parent=this._owner._parent&&this._owner._parent._pin,this._handled&&this._mo_handle!=this._ts_transform&&(this._mo_handle=this._ts_transform,this._ts_translate=++s),this._aligned&&this._parent&&this._mo_align!=this._parent._ts_transform&&(this._mo_align=this._parent._ts_transform,this._ts_translate=++s),this},o.prototype.toString=function(){return this._owner+" ("+(this._parent?this._parent._owner:null)+")"},o.prototype.absoluteMatrix=function(){this._update();var t=Math.max(this._ts_transform,this._ts_translate,this._parent?this._parent._ts_matrix:0);if(this._mo_abs==t)return this._absoluteMatrix;this._mo_abs=t;var i=this._absoluteMatrix;return i.reset(this.relativeMatrix()),this._parent&&i.concat(this._parent._absoluteMatrix),this._ts_matrix=++s,i},o.prototype.relativeMatrix=function(){this._update();var t=Math.max(this._ts_transform,this._ts_translate,this._parent?this._parent._ts_transform:0);if(this._mo_rel==t)return this._relativeMatrix;this._mo_rel=t;var i,e,n=this._relativeMatrix;(n.identity(),this._pivoted&&n.translate(-this._pivotX*this._width,-this._pivotY*this._height),n.scale(this._scaleX,this._scaleY),n.skew(this._skewX,this._skewY),n.rotate(this._rotation),this._pivoted&&n.translate(this._pivotX*this._width,this._pivotY*this._height),this._pivoted)?(this._boxX=0,this._boxY=0,this._boxWidth=this._width,this._boxHeight=this._height):(n.a>0&&n.c>0||n.a<0&&n.c<0?(i=0,e=n.a*this._width+n.c*this._height):(i=n.a*this._width,e=n.c*this._height),i>e?(this._boxX=e,this._boxWidth=i-e):(this._boxX=i,this._boxWidth=e-i),n.b>0&&n.d>0||n.b<0&&n.d<0?(i=0,e=n.b*this._width+n.d*this._height):(i=n.b*this._width,e=n.d*this._height),i>e?(this._boxY=e,this._boxHeight=i-e):(this._boxY=i,this._boxHeight=e-i));return this._x=this._offsetX,this._y=this._offsetY,this._x-=this._boxX+this._handleX*this._boxWidth,this._y-=this._boxY+this._handleY*this._boxHeight,this._aligned&&this._parent&&(this._parent.relativeMatrix(),this._x+=this._alignX*this._parent._width,this._y+=this._alignY*this._parent._height),n.translate(this._x,this._y),this._relativeMatrix},o.prototype.get=function(t){if("function"==typeof h[t])return h[t](this)},o.prototype.set=function(t,i){if("string"==typeof t)"function"==typeof a[t]&&void 0!==i&&a[t](this,i);else if("object"==typeof t)for(i in t)"function"==typeof a[i]&&void 0!==t[i]&&a[i](this,t[i],t);return this._owner&&(this._owner._ts_pin=++s,this._owner.touch()),this};var h={alpha:function(t){return t._alpha},textureAlpha:function(t){return t._textureAlpha},width:function(t){return t._width},height:function(t){return t._height},boxWidth:function(t){return t._boxWidth},boxHeight:function(t){return t._boxHeight},scaleX:function(t){return t._scaleX},scaleY:function(t){return t._scaleY},skewX:function(t){return t._skewX},skewY:function(t){return t._skewY},rotation:function(t){return t._rotation},pivotX:function(t){return t._pivotX},pivotY:function(t){return t._pivotY},offsetX:function(t){return t._offsetX},offsetY:function(t){return t._offsetY},alignX:function(t){return t._alignX},alignY:function(t){return t._alignY},handleX:function(t){return t._handleX},handleY:function(t){return t._handleY}},a={alpha:function(t,i){t._alpha=i},textureAlpha:function(t,i){t._textureAlpha=i},width:function(t,i){t._width_=i,t._width=i,t._ts_transform=++s},height:function(t,i){t._height_=i,t._height=i,t._ts_transform=++s},scale:function(t,i){t._scaleX=i,t._scaleY=i,t._ts_transform=++s},scaleX:function(t,i){t._scaleX=i,t._ts_transform=++s},scaleY:function(t,i){t._scaleY=i,t._ts_transform=++s},skew:function(t,i){t._skewX=i,t._skewY=i,t._ts_transform=++s},skewX:function(t,i){t._skewX=i,t._ts_transform=++s},skewY:function(t,i){t._skewY=i,t._ts_transform=++s},rotation:function(t,i){t._rotation=i,t._ts_transform=++s},pivot:function(t,i){t._pivotX=i,t._pivotY=i,t._pivoted=!0,t._ts_transform=++s},pivotX:function(t,i){t._pivotX=i,t._pivoted=!0,t._ts_transform=++s},pivotY:function(t,i){t._pivotY=i,t._pivoted=!0,t._ts_transform=++s},offset:function(t,i){t._offsetX=i,t._offsetY=i,t._ts_translate=++s},offsetX:function(t,i){t._offsetX=i,t._ts_translate=++s},offsetY:function(t,i){t._offsetY=i,t._ts_translate=++s},align:function(t,i){this.alignX(t,i),this.alignY(t,i)},alignX:function(t,i){t._alignX=i,t._aligned=!0,t._ts_translate=++s,this.handleX(t,i)},alignY:function(t,i){t._alignY=i,t._aligned=!0,t._ts_translate=++s,this.handleY(t,i)},handle:function(t,i){this.handleX(t,i),this.handleY(t,i)},handleX:function(t,i){t._handleX=i,t._handled=!0,t._ts_translate=++s},handleY:function(t,i){t._handleY=i,t._handled=!0,t._ts_translate=++s},resizeMode:function(t,i,e){e&&("in"==i?i="in-pad":"out"==i&&(i="out-crop"),u(t,e.resizeWidth,e.resizeHeight,i))},resizeWidth:function(t,i,e){e&&e.resizeMode||u(t,i,null)},resizeHeight:function(t,i,e){e&&e.resizeMode||u(t,null,i)},scaleMode:function(t,i,e){e&&u(t,e.scaleWidth,e.scaleHeight,i)},scaleWidth:function(t,i,e){e&&e.scaleMode||u(t,i,null)},scaleHeight:function(t,i,e){e&&e.scaleMode||u(t,null,i)},matrix:function(t,i){this.scaleX(t,i.a),this.skewX(t,i.c/i.d),this.skewY(t,i.b/i.a),this.scaleY(t,i.d),this.offsetX(t,i.e),this.offsetY(t,i.f),this.rotation(t,0)}};function u(t,i,e,n){var r="number"==typeof i,o="number"==typeof e,h="string"==typeof n;t._ts_transform=++s,r&&(t._scaleX=i/t._width_,t._width=t._width_),o&&(t._scaleY=e/t._height_,t._height=t._height_),r&&o&&h&&("out"==n||"out-crop"==n?t._scaleX=t._scaleY=Math.max(t._scaleX,t._scaleY):"in"!=n&&"in-pad"!=n||(t._scaleX=t._scaleY=Math.min(t._scaleX,t._scaleY)),"out-crop"!=n&&"in-pad"!=n||(t._width=i/t._scaleX,t._height=e/t._scaleY))}n.prototype.scaleTo=function(t,i,e){return"object"==typeof t&&(e=i,i=t.y,t=t.x),u(this._pin,t,i,e),this},o._add_shortcuts=function(t){t.prototype.size=function(t,i){return this.pin("width",t),this.pin("height",i),this},t.prototype.width=function(t){return void 0===t?this.pin("width"):(this.pin("width",t),this)},t.prototype.height=function(t){return void 0===t?this.pin("height"):(this.pin("height",t),this)},t.prototype.offset=function(t,i){return"object"==typeof t&&(i=t.y,t=t.x),this.pin("offsetX",t),this.pin("offsetY",i),this},t.prototype.rotate=function(t){return this.pin("rotation",t),this},t.prototype.skew=function(t,i){return"object"==typeof t?(i=t.y,t=t.x):void 0===i&&(i=t),this.pin("skewX",t),this.pin("skewY",i),this},t.prototype.scale=function(t,i){return"object"==typeof t?(i=t.y,t=t.x):void 0===i&&(i=t),this.pin("scaleX",t),this.pin("scaleY",i),this},t.prototype.alpha=function(t,i){return this.pin("alpha",t),void 0!==i&&this.pin("textureAlpha",i),this}},o._add_shortcuts(n),t.exports=o},function(t,i,e){var n=e(0);e(2);var r=e(4);n.prototype._textures=null,n.prototype._alpha=1,n.prototype.render=function(t){if(this._visible){r.node++;var i=this.matrix();t.setTransform(i.a,i.b,i.c,i.d,i.e,i.f),this._alpha=this._pin._alpha*(this._parent?this._parent._alpha:1);var e=this._pin._textureAlpha*this._alpha;if(t.globalAlpha!=e&&(t.globalAlpha=e),null!==this._textures)for(var n=0,s=this._textures.length;n<s;n++)this._textures[n].draw(t);t.globalAlpha!=this._alpha&&(t.globalAlpha=this._alpha);for(var o,h=this._first;o=h;)h=o._next,o.render(t)}},n.prototype._tickBefore=null,n.prototype._tickAfter=null,n.prototype.MAX_ELAPSE=1/0,n.prototype._tick=function(t,i,e){if(this._visible){t>this.MAX_ELAPSE&&(t=this.MAX_ELAPSE);var n=!1;if(null!==this._tickBefore)for(var s=0;s<this._tickBefore.length;s++){r.tick++,n=!0===this._tickBefore[s].call(this,t,i,e)||n}for(var o,h=this._first;o=h;)h=o._next,o._flag("_tick")&&(n=!0===o._tick(t,i,e)||n);if(null!==this._tickAfter)for(s=0;s<this._tickAfter.length;s++){r.tick++,n=!0===this._tickAfter[s].call(this,t,i,e)||n}return n}},n.prototype.tick=function(t,i){"function"==typeof t&&(i?(null===this._tickBefore&&(this._tickBefore=[]),this._tickBefore.push(t)):(null===this._tickAfter&&(this._tickAfter=[]),this._tickAfter.push(t)),this._flag("_tick",null!==this._tickAfter&&this._tickAfter.length>0||null!==this._tickBefore&&this._tickBefore.length>0))},n.prototype.untick=function(t){var i;"function"==typeof t&&(null!==this._tickBefore&&(i=this._tickBefore.indexOf(t))>=0&&this._tickBefore.splice(i,1),null!==this._tickAfter&&(i=this._tickAfter.indexOf(t))>=0&&this._tickAfter.splice(i,1))},n.prototype.timeout=function(t,i){this.setTimeout(t,i)},n.prototype.setTimeout=function(t,i){function e(n){if(!((i-=n)<0))return!0;this.untick(e),t.call(this)}return this.tick(e),e},n.prototype.clearTimeout=function(t){this.untick(t)}},function(t,i){t.exports={}},function(t,i){t.exports=function(t){for(var i=1;i<arguments.length;i++){var e=arguments[i];for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])}return t}},function(t,i){
/**
* ! is the definitive JavaScript type testing library
*
* @copyright 2013-2014 Enrico Marino / Jordan Harband
* @license MIT
*/
var e=Object.prototype,n=e.hasOwnProperty,r=e.toString,s=/^[A-Fa-f0-9]+$/,o=t.exports={};o.a=o.an=o.type=function(t,i){return typeof t===i},o.defined=function(t){return void 0!==t},o.empty=function(t){var i,e=r.call(t);if("[object Array]"===e||"[object Arguments]"===e||"[object String]"===e)return 0===t.length;if("[object Object]"===e){for(i in t)if(n.call(t,i))return!1;return!0}return!t},o.equal=function(t,i){if(t===i)return!0;var e,n=r.call(t);if(n!==r.call(i))return!1;if("[object Object]"===n){for(e in t)if(!o.equal(t[e],i[e])||!(e in i))return!1;for(e in i)if(!o.equal(t[e],i[e])||!(e in t))return!1;return!0}if("[object Array]"===n){if((e=t.length)!==i.length)return!1;for(;--e;)if(!o.equal(t[e],i[e]))return!1;return!0}return"[object Function]"===n?t.prototype===i.prototype:"[object Date]"===n&&t.getTime()===i.getTime()},o.instance=function(t,i){return t instanceof i},o.nil=function(t){return null===t},o.undef=function(t){return void 0===t},o.array=function(t){return"[object Array]"===r.call(t)},o.emptyarray=function(t){return o.array(t)&&0===t.length},o.arraylike=function(t){return!!t&&!o.boolean(t)&&n.call(t,"length")&&isFinite(t.length)&&o.number(t.length)&&t.length>=0},o.boolean=function(t){return"[object Boolean]"===r.call(t)},o.element=function(t){return void 0!==t&&"undefined"!=typeof HTMLElement&&t instanceof HTMLElement&&1===t.nodeType},o.fn=function(t){return"[object Function]"===r.call(t)},o.number=function(t){return"[object Number]"===r.call(t)},o.nan=function(t){return!o.number(t)||t!=t},o.object=function(t){return"[object Object]"===r.call(t)},o.hash=function(t){return o.object(t)&&t.constructor===Object&&!t.nodeType&&!t.setInterval},o.regexp=function(t){return"[object RegExp]"===r.call(t)},o.string=function(t){return"[object String]"===r.call(t)},o.hex=function(t){return o.string(t)&&(!t.length||s.test(t))}},function(t,i,e){var n=e(4),r=e(8);function s(t,i){"object"==typeof t&&this.src(t,i)}s.prototype.pipe=function(){return new s(this)},s.prototype.src=function(t,i,e,n){if("object"==typeof t){var r=t,s=i||1;this._image=r,this._sx=this._dx=0,this._sy=this._dy=0,this._sw=this._dw=r.width/s,this._sh=this._dh=r.height/s,this.width=r.width/s,this.height=r.height/s,this.ratio=s}else void 0===e?(e=t,n=i):(this._sx=t,this._sy=i),this._sw=this._dw=e,this._sh=this._dh=n,this.width=e,this.height=n;return this},s.prototype.dest=function(t,i,e,n){return this._dx=t,this._dy=i,this._dx=t,this._dy=i,void 0!==e&&(this._dw=e,this._dh=n,this.width=e,this.height=n),this},s.prototype.draw=function(t,i,e,s,o,h,a,u,f){var c=this._image;if(null!==c&&"object"==typeof c){var p=this._sx,_=this._sy,l=this._sw,d=this._sh,v=this._dx,g=this._dy,y=this._dw,m=this._dh;void 0!==h?(i=r.limit(i,0,this._sw),s=r.limit(s,0,this._sw-i),p+=i,_+=e=r.limit(e,0,this._sh),l=s,d=o=r.limit(o,0,this._sh-e),v=h,g=a,y=u,m=f):void 0!==s?(v=i,g=e,y=s,m=o):void 0!==i&&(y=i,m=e);var x=this.ratio||1;p*=x,_*=x,l*=x,d*=x;try{"function"==typeof c.draw?c.draw(t,p,_,l,d,v,g,y,m):(n.draw++,t.drawImage(c,p,_,l,d,v,g,y,m))}catch(t){c._draw_failed||(console.log("Unable to draw: ",c),console.log(t),c._draw_failed=!0)}}},t.exports=s},function(t,i,e){var n=e(1),r=Math;t.exports=n(Math),t.exports.random=function(t,i){return void 0===t?(i=1,t=0):void 0===i&&(i=t,t=0),t==i?t:r.random()*(i-t)+t},t.exports.rotate=function(t,i,e){return void 0===i?(e=1,i=0):void 0===e&&(e=i,i=0),e>i?(t=(t-i)%(e-i))+(t<0?e:i):(t=(t-e)%(i-e))+(t<=0?i:e)},t.exports.limit=function(t,i,e){return t<i?i:t>e?e:t},t.exports.length=function(t,i){return r.sqrt(t*t+i*i)}},function(t,i){function e(t,i,e,n,r,s){this.reset(t,i,e,n,r,s)}e.prototype.toString=function(){return"["+this.a+", "+this.b+", "+this.c+", "+this.d+", "+this.e+", "+this.f+"]"},e.prototype.clone=function(){return new e(this.a,this.b,this.c,this.d,this.e,this.f)},e.prototype.reset=function(t,i,e,n,r,s){return this._dirty=!0,"object"==typeof t?(this.a=t.a,this.d=t.d,this.b=t.b,this.c=t.c,this.e=t.e,this.f=t.f):(this.a=t||1,this.d=n||1,this.b=i||0,this.c=e||0,this.e=r||0,this.f=s||0),this},e.prototype.identity=function(){return this._dirty=!0,this.a=1,this.b=0,this.c=0,this.d=1,this.e=0,this.f=0,this},e.prototype.rotate=function(t){if(!t)return this;this._dirty=!0;var i=t?Math.cos(t):1,e=t?Math.sin(t):0,n=i*this.a-e*this.b,r=i*this.b+e*this.a,s=i*this.c-e*this.d,o=i*this.d+e*this.c,h=i*this.e-e*this.f,a=i*this.f+e*this.e;return this.a=n,this.b=r,this.c=s,this.d=o,this.e=h,this.f=a,this},e.prototype.translate=function(t,i){return t||i?(this._dirty=!0,this.e+=t,this.f+=i,this):this},e.prototype.scale=function(t,i){return t-1||i-1?(this._dirty=!0,this.a*=t,this.b*=i,this.c*=t,this.d*=i,this.e*=t,this.f*=i,this):this},e.prototype.skew=function(t,i){if(!t&&!i)return this;this._dirty=!0;var e=this.a+this.b*t,n=this.b+this.a*i,r=this.c+this.d*t,s=this.d+this.c*i,o=this.e+this.f*t,h=this.f+this.e*i;return this.a=e,this.b=n,this.c=r,this.d=s,this.e=o,this.f=h,this},e.prototype.concat=function(t){this._dirty=!0;var i=this,e=i.a*t.a+i.b*t.c,n=i.b*t.d+i.a*t.b,r=i.c*t.a+i.d*t.c,s=i.d*t.d+i.c*t.b,o=i.e*t.a+t.e+i.f*t.c,h=i.f*t.d+t.f+i.e*t.b;return this.a=e,this.b=n,this.c=r,this.d=s,this.e=o,this.f=h,this},e.prototype.inverse=e.prototype.reverse=function(){if(this._dirty){this._dirty=!1,this.inversed=this.inversed||new e;var t=this.a*this.d-this.b*this.c;this.inversed.a=this.d/t,this.inversed.b=-this.b/t,this.inversed.c=-this.c/t,this.inversed.d=this.a/t,this.inversed.e=(this.c*this.f-this.e*this.d)/t,this.inversed.f=(this.e*this.b-this.a*this.f)/t}return this.inversed},e.prototype.map=function(t,i){return(i=i||{}).x=this.a*t.x+this.c*t.y+this.e,i.y=this.b*t.x+this.d*t.y+this.f,i},e.prototype.mapX=function(t,i){return"object"==typeof t&&(i=t.y,t=t.x),this.a*t+this.c*i+this.e},e.prototype.mapY=function(t,i){return"object"==typeof t&&(i=t.y,t=t.x),this.b*t+this.d*i+this.f},t.exports=e},function(t,i,e){t.exports=e(0),t.exports.Matrix=e(9),t.exports.Texture=e(7),e(12),e(14),e(15),e(2),e(3),e(17)},function(t,i){t.exports=function(){var t=0;function i(i,e){return t+=e="number"==typeof e&&e>=1?e:1,function(){i&&i.apply(this,arguments),e>0&&(e--,t--,n())}}var e=[];function n(){if(0===t)for(;e.length;)setTimeout(e.shift(),0)}return i.then=function(i){0===t?setTimeout(i,0):e.push(i)},i}},function(t,i,e){var n=e(0),r=e(7),s=e(5),o=e(1),h=e(6),a=e(13),u={},f=[];function c(t){c._super.call(this);var i=this;d(t,"filter"),d(t,"cutouts"),d(t,"sprites"),d(t,"factory");var e=t.map||t.filter,n=t.ppu||t.ratio||1,r=t.trim||0,o=t.textures,u=t.factory,f=t.cutouts||t.sprites;function p(t){if(!t||h.fn(t.draw))return t;t=s({},t),h.fn(e)&&(t=e(t)),1!=n&&(t.x*=n,t.y*=n,t.width*=n,t.height*=n,t.top*=n,t.bottom*=n,t.left*=n,t.right*=n),0!=r&&(t.x+=r,t.y+=r,t.width-=2*r,t.height-=2*r,t.top-=r,t.bottom-=r,t.left-=r,t.right-=r);var o=i.pipe();return o.top=t.top,o.bottom=t.bottom,o.left=t.left,o.right=t.right,o.src(t.x,t.y,t.width,t.height),o}function _(t){if(o){if(h.fn(o))return o(t);if(h.hash(o))return o[t]}if(f){for(var i=null,e=0,n=0;n<f.length;n++)a.startsWith(f[n].name,t)&&(0===e?i=f[n]:1===e?i=[i,f[n]]:i.push(f[n]),e++);return 0===e&&h.fn(u)&&(i=function(i){return u(t+(i||""))}),i}}this.select=function(t){if(!t)return new l(this.pipe());var i=_(t);return i?new l(i,_,p):void 0}}n.atlas=function(t){var i=h.fn(t.draw)?t:new c(t);t.name&&(u[t.name]=i),f.push(i),d(t,"imagePath"),d(t,"imageRatio");var e=t.imagePath,r=t.imageRatio||1;return h.string(t.image)?e=t.image:h.hash(t.image)&&(e=t.image.src||t.image.url,r=t.image.ratio||r),e&&n.preload((function(t){e=n.resolve(e),n.config("image-loader")(e,(function(e){i.src(e,r),t()}),(function(i){t()}))})),i},c._super=r,c.prototype=o(c._super.prototype);var p=new r;p.x=p.y=p.width=p.height=0,p.pipe=p.src=p.dest=function(){return this},p.draw=function(){};var _=new l(p);function l(t,i,e){function n(t,r){return t?h.fn(t.draw)?t:h.hash(t)&&h.number(t.width)&&h.number(t.height)&&h.fn(e)?e(t):h.hash(t)&&h.defined(r)?n(t[r]):h.fn(t)?n(t(r)):h.array(t)?n(t[0]):h.string(t)&&h.fn(i)?n(i(t)):void 0:p}this.one=function(i){return n(t,i)},this.array=function(i){var e=h.array(i)?i:[];if(h.array(t))for(var r=0;r<t.length;r++)e[r]=n(t[r]);else e[0]=n(t);return e}}function d(t,i,e){i in t&&console.log(e?e.replace("%name",i):"'"+i+"' field of texture atlas is deprecated.")}n.texture=function(t){if(!h.string(t))return new l(t);var i,e,n=null;for((e=t.indexOf(":"))>0&&t.length>e+1&&(n=(i=u[t.slice(0,e)])&&i.select(t.slice(e+1))),!n&&(i=u[t])&&(n=i.select()),e=0;!n&&e<f.length;e++)n=f[e].select(t);return n||(console.error("Texture not found: "+t),n=_),n},t.exports=c},function(t,i){t.exports.startsWith=function(t,i){return"string"==typeof t&&"string"==typeof i&&t.substring(0,i.length)==i}},function(t,i,e){var n=e(0),r=e(6),s=0;function o(t,i){f(i),f(t),i.remove(),t._last&&(t._last._next=i,i._prev=t._last),i._parent=t,t._last=i,t._first||(t._first=i),i._parent._flag(i,!0),i._ts_parent=++s,t._ts_children=++s,t.touch()}function h(t,i){f(i),f(t),i.remove(),t._first&&(t._first._prev=i,i._next=t._first),i._parent=t,t._first=i,t._last||(t._last=i),i._parent._flag(i,!0),i._ts_parent=++s,t._ts_children=++s,t.touch()}function a(t,i){f(t),f(i),t.remove();var e=i._parent,n=i._prev;i._prev=t,n&&(n._next=t)||e&&(e._first=t),t._parent=e,t._prev=n,t._next=i,t._parent._flag(t,!0),t._ts_parent=++s,t.touch()}function u(t,i){f(t),f(i),t.remove();var e=i._parent,n=i._next;i._next=t,n&&(n._prev=t)||e&&(e._last=t),t._parent=e,t._prev=i,t._next=n,t._parent._flag(t,!0),t._ts_parent=++s,t.touch()}function f(t){if(t&&t instanceof n)return t;throw"Invalid node: "+t}n.prototype._label="",n.prototype._visible=!0,n.prototype._parent=null,n.prototype._next=null,n.prototype._prev=null,n.prototype._first=null,n.prototype._last=null,n.prototype._attrs=null,n.prototype._flags=null,n.prototype.toString=function(){return"["+this._label+"]"},n.prototype.id=function(t){return this.label(t)},n.prototype.label=function(t){return void 0===t?this._label:(this._label=t,this)},n.prototype.attr=function(t,i){return void 0===i?null!==this._attrs?this._attrs[t]:void 0:((null!==this._attrs?this._attrs:this._attrs={})[t]=i,this)},n.prototype.visible=function(t){return void 0===t?this._visible:(this._visible=t,this._parent&&(this._parent._ts_children=++s),this._ts_pin=++s,this.touch(),this)},n.prototype.hide=function(){return this.visible(!1)},n.prototype.show=function(){return this.visible(!0)},n.prototype.parent=function(){return this._parent},n.prototype.next=function(t){for(var i=this._next;i&&t&&!i._visible;)i=i._next;return i},n.prototype.prev=function(t){for(var i=this._prev;i&&t&&!i._visible;)i=i._prev;return i},n.prototype.first=function(t){for(var i=this._first;i&&t&&!i._visible;)i=i._next;return i},n.prototype.last=function(t){for(var i=this._last;i&&t&&!i._visible;)i=i._prev;return i},n.prototype.visit=function(t,i){var e=t.reverse,n=t.visible;if(!t.start||!t.start(this,i)){for(var r,s=e?this.last(n):this.first(n);r=s;)if(s=e?r.prev(n):r.next(n),r.visit(t,i))return!0;return t.end&&t.end(this,i)}},n.prototype.append=function(t,i){if(r.array(t))for(var e=0;e<t.length;e++)o(this,t[e]);else if(void 0!==i)for(e=0;e<arguments.length;e++)o(this,arguments[e]);else void 0!==t&&o(this,t);return this},n.prototype.prepend=function(t,i){if(r.array(t))for(var e=t.length-1;e>=0;e--)h(this,t[e]);else if(void 0!==i)for(e=arguments.length-1;e>=0;e--)h(this,arguments[e]);else void 0!==t&&h(this,t);return this},n.prototype.appendTo=function(t){return o(t,this),this},n.prototype.prependTo=function(t){return h(t,this),this},n.prototype.insertNext=function(t,i){if(r.array(t))for(var e=0;e<t.length;e++)u(t[e],this);else if(void 0!==i)for(e=0;e<arguments.length;e++)u(arguments[e],this);else void 0!==t&&u(t,this);return this},n.prototype.insertPrev=function(t,i){if(r.array(t))for(var e=t.length-1;e>=0;e--)a(t[e],this);else if(void 0!==i)for(e=arguments.length-1;e>=0;e--)a(arguments[e],this);else void 0!==t&&a(t,this);return this},n.prototype.insertAfter=function(t){return u(this,t),this},n.prototype.insertBefore=function(t){return a(this,t),this},n.prototype.remove=function(t,i){if(void 0!==t){if(r.array(t))for(var e=0;e<t.length;e++)f(t[e]).remove();else if(void 0!==i)for(e=0;e<arguments.length;e++)f(arguments[e]).remove();else f(t).remove();return this}return this._prev&&(this._prev._next=this._next),this._next&&(this._next._prev=this._prev),this._parent&&(this._parent._first===this&&(this._parent._first=this._next),this._parent._last===this&&(this._parent._last=this._prev),this._parent._flag(this,!1),this._parent._ts_children=++s,this._parent.touch()),this._prev=this._next=this._parent=null,this._ts_parent=++s,this},n.prototype.empty=function(){for(var t,i=this._first;t=i;)i=t._next,t._prev=t._next=t._parent=null,this._flag(t,!1);return this._first=this._last=null,this._ts_children=++s,this.touch(),this},n.prototype.touch=function(){return this._ts_touch=++s,this._parent&&this._parent.touch(),this},n.prototype._flag=function(t,i){if(void 0===i)return null!==this._flags&&this._flags[t]||0;if("string"==typeof t&&(i?(this._flags=this._flags||{},!this._flags[t]&&this._parent&&this._parent._flag(t,!0),this._flags[t]=(this._flags[t]||0)+1):this._flags&&this._flags[t]>0&&(1==this._flags[t]&&this._parent&&this._parent._flag(t,!1),this._flags[t]=this._flags[t]-1)),"object"==typeof t&&t._flags)for(var e in t._flags)t._flags[e]>0&&this._flag(e,i);return this},n.prototype.hitTest=function(t){var i=this._pin._width,e=this._pin._height;return t.x>=0&&t.x<=i&&t.y>=0&&t.y<=e},t.exports=n},function(t,i,e){e(16)(e(0).prototype,(function(t,i,e){t._flag(i,e)}))},function(t,i){t.exports=function(t,i){t._listeners=null,t.on=t.listen=function(t,e){if(!t||!t.length||"function"!=typeof e)return this;if(null===this._listeners&&(this._listeners={}),t=("string"!=typeof t&&"function"==typeof t.join?t.join(" "):t).match(/\S+/g))for(var n=0;n<t.length;n++){var r=t[n];this._listeners[r]=this._listeners[r]||[],this._listeners[r].push(e),"function"==typeof i&&i(this,r,!0)}return this},t.off=function(t,e){if(!t||!t.length||"function"!=typeof e)return this;if(null===this._listeners)return this;if(t=("string"!=typeof t&&"function"==typeof t.join?t.join(" "):t).match(/\S+/g))for(var n=0;n<t.length;n++){var r,s=t[n],o=this._listeners[s];o&&(r=o.indexOf(e))>=0&&(o.splice(r,1),o.length||delete this._listeners[s],"function"==typeof i&&i(this,s,!1))}return this},t.listeners=function(t){return this._listeners&&this._listeners[t]},t.publish=function(t,i){var e=this.listeners(t);if(!e||!e.length)return 0;for(var n=0;n<e.length;n++)e[n].apply(this,i);return e.length},t.trigger=function(t,i){return this.publish(t,i),this}}},function(t,i,e){var n=e(0);e(2),e(3);var r=e(4),s=e(1),o=e(5);function h(t,i){h._super.call(this),this.label("Root");var e=!0,n=!0,s=this,o=0,a=function(h){if(!0!==e&&!0!==n){r.tick=r.node=r.draw=0;var u=o||h,f=h-u;o=h;var c=s._tick(f,h,u);s._mo_touch!=s._ts_touch?(s._mo_touch=s._ts_touch,i(s),t(a)):c?t(a):e=!0,r.fps=f?1e3/f:0}};this.start=function(){return n=!1,this.resume()},this.resume=function(){return e&&(this.publish("resume"),e=!1,t(a)),this},this.pause=function(){return e||this.publish("pause"),e=!0,this},this.touch_root=this.touch,this.touch=function(){return this.resume(),this.touch_root()},this.stop=function(){return n=!0,this}}h._super=n,h.prototype=s(h._super.prototype),n.root=function(t,i){return new h(t,i)},h.prototype.background=function(t){return this},h.prototype.viewport=function(t,i,e){if(void 0===t)return o({},this._viewport);this._viewport={width:t,height:i,ratio:e||1},this.viewbox();var n=o({},this._viewport);return this.visit({start:function(t){if(!t._flag("viewport"))return!0;t.publish("viewport",[n])}}),this},h.prototype.viewbox=function(t,i,e){"number"==typeof t&&"number"==typeof i&&(this._viewbox={width:t,height:i,mode:/^(in|out|in-pad|out-crop)$/.test(e)?e:"in-pad"});var n=this._viewbox,r=this._viewport;return r&&n?(this.pin({width:n.width,height:n.height}),this.scaleTo(r.width,r.height,n.mode)):r&&this.pin({width:r.width,height:r.height}),this}},function(t,i,e){var n=e(0),r=e(7);n.canvas=function(t,i,e){"string"==typeof t?"object"==typeof i||("function"==typeof i&&(e=i),i={}):("function"==typeof t&&(e=t),i={},t="2d");var n=document.createElement("canvas"),s=n.getContext(t,i),o=new r(n);return o.context=function(){return s},o.size=function(t,i,e){return e=e||1,n.width=t*e,n.height=i*e,this.src(n,e),this},o.canvas=function(t){return"function"==typeof t?t.call(this,s):void 0===t&&"function"==typeof e&&e.call(this,s),this},"function"==typeof e&&e.call(o,s),o}},function(t,i,e){var n=e(0);e(2),e(3);var r=e(20),s=e(1);function o(){o._super.call(this),this.label("Image"),this._textures=[],this._image=null}t.exports=o,n.image=function(t){var i=new o;return t&&i.image(t),i},o._super=n,o.prototype=s(o._super.prototype),o.prototype.setImage=function(t,i,e){return this.image(t,i,e)},o.prototype.image=function(t){return this._image=n.texture(t).one(),this.pin("width",this._image?this._image.width:0),this.pin("height",this._image?this._image.height:0),this._textures[0]=this._image.pipe(),this._textures.length=1,this},o.prototype.tile=function(t){return this._repeat(!1,t),this},o.prototype.stretch=function(t){return this._repeat(!0,t),this},o.prototype._repeat=function(t,i){var e=this;function n(t,i,n,r,s,o,h,a,u){var f=e._textures.length>t?e._textures[t]:e._textures[t]=e._image.pipe();f.src(i,n,r,s),f.dest(o,h,a,u)}this.untick(this._repeatTicker),this.tick(this._repeatTicker=function(){if(this._mo_stretch!=this._pin._ts_transform){this._mo_stretch=this._pin._ts_transform;var e=this.pin("width"),s=this.pin("height");this._textures.length=r(this._image,e,s,t,i,n)}})}},function(t,i){t.exports=function(t,i,e,n,r,s){var o=t.width,h=t.height,a=t.left,u=t.right,f=t.top,c=t.bottom;o=o-(a="number"==typeof a&&a==a?a:0)-(u="number"==typeof u&&u==u?u:0),h=h-(f="number"==typeof f&&f==f?f:0)-(c="number"==typeof c&&c==c?c:0),r||(i=Math.max(i-a-u,0),e=Math.max(e-f-c,0));var p=0;if(f>0&&a>0&&s(p++,0,0,a,f,0,0,a,f),c>0&&a>0&&s(p++,0,h+f,a,c,0,e+f,a,c),f>0&&u>0&&s(p++,o+a,0,u,f,i+a,0,u,f),c>0&&u>0&&s(p++,o+a,h+f,u,c,i+a,e+f,u,c),n)f>0&&s(p++,a,0,o,f,a,0,i,f),c>0&&s(p++,a,h+f,o,c,a,e+f,i,c),a>0&&s(p++,0,f,a,h,0,f,a,e),u>0&&s(p++,o+a,f,u,h,i+a,f,u,e),s(p++,a,f,o,h,a,f,i,e);else for(var _,l=a,d=i;d>0;){_=Math.min(o,d),d-=o;for(var v,g=f,y=e;y>0;)v=Math.min(h,y),y-=h,s(p++,a,f,_,v,l,g,_,v),d<=0&&(a&&s(p++,0,f,a,v,0,g,a,v),u&&s(p++,o+a,f,u,v,l+_,g,u,v)),g+=v;f&&s(p++,a,0,_,f,l,0,_,f),c&&s(p++,a,h+f,_,c,l,g,_,c),l+=_}return p}},function(t,i,e){var n=e(0);e(2),e(3);var r=e(1),s=e(8);function o(){o._super.call(this),this.label("Anim"),this._textures=[],this._fps=n.Anim.FPS,this._ft=1e3/this._fps,this._time=-1,this._repeat=0,this._index=0,this._frames=[];var t=0;this.tick((function(i,e,n){if(!(this._time<0||this._frames.length<=1)){var r=t!=n;if(t=e,r)return!0;if(this._time+=i,this._time<this._ft)return!0;var s=this._time/this._ft|0;return this._time-=s*this._ft,this.moveFrame(s),!(this._repeat>0&&(this._repeat-=s)<=0)||(this.stop(),this._callback&&this._callback(),!1)}}),!1)}n.anim=function(t,i){var e=new o;return e.frames(t).gotoFrame(0),i&&e.fps(i),e},o._super=n,o.prototype=r(o._super.prototype),n.Anim={FPS:15},o.prototype.fps=function(t){return void 0===t?this._fps:(this._fps=t>0?t:n.Anim.FPS,this._ft=1e3/this._fps,this)},o.prototype.setFrames=function(t,i,e){return this.frames(t,i,e)},o.prototype.frames=function(t){return this._index=0,this._frames=n.texture(t).array(),this.touch(),this},o.prototype.length=function(){return this._frames?this._frames.length:0},o.prototype.gotoFrame=function(t,i){return this._index=0|s.rotate(t,this._frames.length),i=i||!this._textures[0],this._textures[0]=this._frames[this._index],i&&(this.pin("width",this._textures[0].width),this.pin("height",this._textures[0].height)),this.touch(),this},o.prototype.moveFrame=function(t){return this.gotoFrame(this._index+t)},o.prototype.repeat=function(t,i){return this._repeat=t*this._frames.length-1,this._callback=i,this.play(),this},o.prototype.play=function(t){return void 0!==t?(this.gotoFrame(t),this._time=0):this._time<0&&(this._time=0),this.touch(),this},o.prototype.stop=function(t){return this._time=-1,void 0!==t&&this.gotoFrame(t),this}},function(t,i,e){var n=e(0);e(2),e(3);var r=e(1),s=e(6);function o(){o._super.call(this),this.label("String"),this._textures=[]}n.string=function(t){return(new o).frames(t)},o._super=n,o.prototype=r(o._super.prototype),o.prototype.setFont=function(t,i,e){return this.frames(t,i,e)},o.prototype.frames=function(t){return this._textures=[],"string"==typeof t?(t=n.texture(t),this._item=function(i){return t.one(i)}):"object"==typeof t?this._item=function(i){return t[i]}:"function"==typeof t&&(this._item=t),this},o.prototype.setValue=function(t,i,e){return this.value(t,i,e)},o.prototype.value=function(t){if(void 0===t)return this._value;if(this._value===t)return this;this._value=t,null===t?t="":"string"==typeof t||s.array(t)||(t=t.toString()),this._spacing=this._spacing||0;for(var i=0,e=0,n=0;n<t.length;n++){var r=this._textures[n]=this._item(t[n]);i+=n>0?this._spacing:0,r.dest(i,0),i+=r.width,e=Math.max(e,r.height)}return this.pin("width",i),this.pin("height",e),this._textures.length=t.length,this}},function(t,i,e){var n=e(0);e(2),e(3);e(1);n.row=function(t){return n.create().row(t).label("Row")},n.prototype.row=function(t){return this.sequence("row",t),this},n.column=function(t){return n.create().column(t).label("Row")},n.prototype.column=function(t){return this.sequence("column",t),this},n.sequence=function(t,i){return n.create().sequence(t,i).label("Sequence")},n.prototype.sequence=function(t,i){return this._padding=this._padding||0,this._spacing=this._spacing||0,this.untick(this._layoutTiker),this.tick(this._layoutTiker=function(){if(this._mo_seq!=this._ts_touch){this._mo_seq=this._ts_touch;var e=this._mo_seqAlign!=this._ts_children;this._mo_seqAlign=this._ts_children;for(var n,r=0,s=0,o=this.first(!0),h=!0;n=o;){o=n.next(!0),n.matrix(!0);var a=n.pin("boxWidth"),u=n.pin("boxHeight");"column"==t?(!h&&(s+=this._spacing),n.pin("offsetY")!=s&&n.pin("offsetY",s),r=Math.max(r,a),s+=u,e&&n.pin("alignX",i)):"row"==t&&(!h&&(r+=this._spacing),n.pin("offsetX")!=r&&n.pin("offsetX",r),r+=a,s=Math.max(s,u),e&&n.pin("alignY",i)),h=!1}r+=2*this._padding,s+=2*this._padding,this.pin("width")!=r&&this.pin("width",r),this.pin("height")!=s&&this.pin("height",s)}}),this},n.box=function(){return n.create().box().label("Box")},n.prototype.box=function(){return this._padding=this._padding||0,this.untick(this._layoutTiker),this.tick(this._layoutTiker=function(){if(this._mo_box!=this._ts_touch){this._mo_box=this._ts_touch;for(var t,i=0,e=0,n=this.first(!0);t=n;){n=t.next(!0),t.matrix(!0);var r=t.pin("boxWidth"),s=t.pin("boxHeight");i=Math.max(i,r),e=Math.max(e,s)}i+=2*this._padding,e+=2*this._padding,this.pin("width")!=i&&this.pin("width",i),this.pin("height")!=e&&this.pin("height",e)}}),this},n.layer=function(){return n.create().layer().label("Layer")},n.prototype.layer=function(){return this.untick(this._layoutTiker),this.tick(this._layoutTiker=function(){var t=this.parent();if(t){var i=t.pin("width");this.pin("width")!=i&&this.pin("width",i);var e=t.pin("height");this.pin("height")!=e&&this.pin("height",e)}},!0),this},n.prototype.padding=function(t){return this._padding=t,this},n.prototype.spacing=function(t){return this._spacing=t,this}},function(t,i,e){var n=e(25),r=e(0),s=e(2);function o(t,i,e){this._end={},this._duration=i||400,this._delay=e||0,this._owner=t,this._time=0}function h(t,i,e,n){"number"==typeof t.pin(e)?i[e]=n:"number"==typeof t.pin(e+"X")&&"number"==typeof t.pin(e+"Y")&&(i[e+"X"]=n,i[e+"Y"]=n)}r.prototype.tween=function(t,i,e){if("number"!=typeof t?(e=t,i=0,t=0):"number"!=typeof i&&(e=i,i=0),!this._tweens){this._tweens=[];var n=0;this.tick((function(t,i,e){if(this._tweens.length){var r=n!=e;if(n=i,r)return!0;var s=this._tweens[0],o=s.tick(this,t,i,e);if(o&&s===this._tweens[0]&&this._tweens.shift(),Array.isArray(o))for(var h=0;h<o.length;h++)try{o[h].call(this)}catch(t){console.log(t)}else"object"==typeof o&&this._tweens.unshift(o);return!0}}),!0)}this.touch(),e||(this._tweens.length=0);var r=new o(this,t,i);return this._tweens.push(r),r},o.prototype.tick=function(t,i,e,n){if(this._time+=i,!(this._time<this._delay)){var r,s,o=this._time-this._delay;if(!this._start)for(var h in this._start={},this._end)this._start[h]=this._owner.pin(h);o<this._duration?(r=o/this._duration,s=!1):(r=1,s=!0),"function"==typeof this._easing&&(r=this._easing(r));var a=1-r;for(var h in this._end)this._owner.pin(h,this._start[h]*a+this._end[h]*r);if(s){var u=[this._hide,this._remove,this._done];return u=u.filter((function(t){return"function"==typeof t})),this._next||u}}},o.prototype.tween=function(t,i){return this._next=new o(this._owner,t,i)},o.prototype.duration=function(t){return this._duration=t,this},o.prototype.delay=function(t){return this._delay=t,this},o.prototype.ease=function(t){return this._easing=n(t),this},o.prototype.done=function(t){return this._done=t,this},o.prototype.hide=function(){return this._hide=function(){this.hide()},this},o.prototype.remove=function(){return this._remove=function(){this.remove()},this},o.prototype.pin=function(t,i){if("object"==typeof t)for(var e in t)h(this._owner,this._end,e,t[e]);else void 0!==i&&h(this._owner,this._end,t,i);return this},s._add_shortcuts(o),o.prototype.then=function(t){return this.done(t),this},o.prototype.clear=function(t){return this},t.exports=o},function(t,i){function e(t){return t}var n={},r={},s={};function o(t){if("function"==typeof t)return t;if("string"!=typeof t)return e;var i=n[t];if(i)return i;var o=/^(\w+)(-(in|out|in-out|out-in))?(\((.*)\))?$/i.exec(t);if(!o||!o.length)return e;var h=s[o[1]],a=r[o[3]],u=o[5];return i=h&&h.fn?h.fn:h&&h.fc?h.fc.apply(h.fc,u&&u.replace(/\s+/,"").split(",")):e,a&&(i=a.fn(i)),n[t]=i,i}o.add=function(t){for(var i=(t.name||t.mode).split(/\s+/),e=0;e<i.length;e++){var n=i[e];n&&((t.name?s:r)[n]=t)}},o.add({mode:"in",fn:function(t){return t}}),o.add({mode:"out",fn:function(t){return function(i){return 1-t(1-i)}}}),o.add({mode:"in-out",fn:function(t){return function(i){return i<.5?t(2*i)/2:1-t(2*(1-i))/2}}}),o.add({mode:"out-in",fn:function(t){return function(i){return i<.5?1-t(2*(1-i))/2:t(2*i)/2}}}),o.add({name:"linear",fn:function(t){return t}}),o.add({name:"quad",fn:function(t){return t*t}}),o.add({name:"cubic",fn:function(t){return t*t*t}}),o.add({name:"quart",fn:function(t){return t*t*t*t}}),o.add({name:"quint",fn:function(t){return t*t*t*t*t}}),o.add({name:"sin sine",fn:function(t){return 1-Math.cos(t*Math.PI/2)}}),o.add({name:"exp expo",fn:function(t){return 0==t?0:Math.pow(2,10*(t-1))}}),o.add({name:"circle circ",fn:function(t){return 1-Math.sqrt(1-t*t)}}),o.add({name:"bounce",fn:function(t){return t<1/2.75?7.5625*t*t:t<2/2.75?7.5625*(t-=1.5/2.75)*t+.75:t<2.5/2.75?7.5625*(t-=2.25/2.75)*t+.9375:7.5625*(t-=2.625/2.75)*t+.984375}}),o.add({name:"poly",fc:function(t){return function(i){return Math.pow(i,t)}}}),o.add({name:"elastic",fc:function(t,i){t=t||1;var e=(i=i||.45)/(2*Math.PI)*Math.asin(1/t);return function(n){return 1+t*Math.pow(2,-10*n)*Math.sin((n-e)*(2*Math.PI)/i)}}}),o.add({name:"back",fc:function(t){return t=void 0!==t?t:1.70158,function(i){return i*i*((t+1)*i-t)}}}),t.exports=o},function(t,i,e){function n(t,i){if(this instanceof n){var e=t.viewport().ratio||1;t.on("viewport",(function(t){e=t.ratio||e})),this.x=0,this.y=0,this.toString=function(){return(0|this.x)+"x"+(0|this.y)},this.locate=function(t){!function(t,i,e){i.touches&&i.touches.length?(e.x=i.touches[0].clientX,e.y=i.touches[0].clientY):(e.x=i.clientX,e.y=i.clientY);var n=t.getBoundingClientRect();e.x-=n.left,e.y-=n.top,e.x-=0|t.clientLeft,e.y-=0|t.clientTop}(i,t,this),this.x*=e,this.y*=e},this.lookup=function(i,e){this.type=i,this.root=t,this.event=null,e.length=0,this.collect=e,this.root.visit(this.visitor,this)},this.publish=function(i,e,n){if(this.type=i,this.root=t,this.event=e,this.collect=!1,this.timeStamp=Date.now(),n){for(;n.length&&!this.visitor.end(n.shift(),this););n.length=0}else this.root.visit(this.visitor,this)},this.visitor={reverse:!0,visible:!0,start:function(t,i){return!t._flag(i.type)},end:function(t,i){r.raw=i.event,r.type=i.type,r.timeStamp=i.timeStamp,r.abs.x=i.x,r.abs.y=i.y;var e=t.listeners(i.type);if(e&&(t.matrix().inverse().map(i,r),(t===i.root||t.attr("spy")||t.hitTest(r))&&(i.collect&&i.collect.push(t),i.event))){for(var n=!1,s=0;s<e.length;s++)n=!!e[s].call(t,r)||n;return n}}}}}e(0)._load((function(t,i){n.subscribe(t,i)})),n.CLICK="click",n.START="touchstart mousedown",n.MOVE="touchmove mousemove",n.END="touchend mouseup",n.CANCEL="touchcancel mousecancel",n.subscribe=function(t,i){if(!t.mouse){t.mouse=new n(t,i),i.addEventListener("touchstart",s),i.addEventListener("touchend",h),i.addEventListener("touchmove",o),i.addEventListener("touchcancel",a),i.addEventListener("mousedown",s),i.addEventListener("mouseup",h),i.addEventListener("mousemove",o),document.addEventListener("mouseup",a),window.addEventListener("blur",a);var e=[],r=[]}function s(i){i.preventDefault(),t.mouse.locate(i),t.mouse.publish(i.type,i),t.mouse.lookup("click",e),t.mouse.lookup("mousecancel",r)}function o(i){i.preventDefault(),t.mouse.locate(i),t.mouse.publish(i.type,i)}function h(i){i.preventDefault(),t.mouse.publish(i.type,i),e.length&&t.mouse.publish("click",i,e),r.length=0}function a(i){r.length&&t.mouse.publish("mousecancel",i,r),e.length=0}};var r={},s={};function o(t,i,e){Object.defineProperty(t,i,{value:e})}o(r,"clone",(function(t){return(t=t||{}).x=this.x,t.y=this.y,t})),o(r,"toString",(function(){return(0|this.x)+"x"+(0|this.y)+" ("+this.abs+")"})),o(r,"abs",s),o(s,"clone",(function(t){return(t=t||{}).x=this.x,t.y=this.y,t})),o(s,"toString",(function(){return(0|this.x)+"x"+(0|this.y)})),t.exports=n},function(t,i,e){t.exports=e(10),t.exports.internal={},e(18),t.exports.internal.Image=e(19),e(21),e(22),e(23),e(24),t.exports.Mouse=e(26),t.exports.Math=e(8),t.exports._extend=e(5),t.exports._create=e(1),e(28)},function(t,i,e){var n,r=e(0);r._supported=!(!(n=document.createElement("canvas")).getContext||!n.getContext("2d")),window.addEventListener("load",(function(){r._supported&&r.start()}),!1),r.config({"app-loader":function(t,i){var e,n=(i=i||{}).canvas,s=null,o=!1,h=0,a=0;"string"==typeof n&&(n=document.getElementById(n));n||(n=document.getElementById("cutjs")||document.getElementById("stage"));if(!n){o=!0,(n=document.createElement("canvas")).style.position="absolute",n.style.top="0",n.style.left="0";var u=document.body;u.insertBefore(n,u.firstChild)}s=n.getContext("2d");var f=window.devicePixelRatio||1,c=s.webkitBackingStorePixelRatio||s.mozBackingStorePixelRatio||s.msBackingStorePixelRatio||s.oBackingStorePixelRatio||s.backingStorePixelRatio||1;e=f/c;var p=window.requestAnimationFrame||window.msRequestAnimationFrame||window.mozRequestAnimationFrame||window.webkitRequestAnimationFrame||window.oRequestAnimationFrame||function(t){return window.setTimeout(t,1e3/60)};var _=r.root(p,l);function l(){h>0&&a>0&&(s.setTransform(1,0,0,1,0,0),s.clearRect(0,0,h,a),_.render(s))}_.background=function(t){return n.style.backgroundColor=t,this},t(_,n);var d=-1,v=-1;function g(){o?(h=window.innerWidth>0?window.innerWidth:screen.width,a=window.innerHeight>0?window.innerHeight:screen.height,n.style.width=h+"px",n.style.height=a+"px"):(h=n.clientWidth,a=n.clientHeight),h*=e,a*=e,n.width===h&&n.height===a||(n.width=h,n.height=a,_.viewport(h,a,e),l())}!function t(){var i,e;o?(i=window.innerWidth>0?window.innerWidth:screen.width,e=window.innerHeight>0?window.innerHeight:screen.height):(i=n.clientWidth,e=n.clientHeight),d===i&&v===e||(d=i,v=e,g()),p(t)}()},"image-loader":function(t,i,e){var n=new Image;n.onload=function(){i(n)},n.onerror=e,n.src=t}})}])}));
//# sourceMappingURL=stage.web.min.js.map

2

lib/addon/mouse.js

@@ -148,3 +148,3 @@ if (typeof DEBUG === 'undefined')

node.matrix().inverse().map(mouse, rel);
if (!(node === mouse.root || node.hitTest(rel))) {
if (!(node === mouse.root || node.attr('spy') || node.hitTest(rel))) {
return;

@@ -151,0 +151,0 @@ }

@@ -35,11 +35,11 @@ var Easing = require('./easing');

if (typeof next === 'function') {
try {
next.call(this);
} catch (e) {
console.log(e);
if (Array.isArray(next)) {
for (var i = 0; i < next.length; i++) {
try {
next[i].call(this);
} catch (e) {
console.log(e);
}
}
}
if (typeof next === 'object') {
} else if (typeof next === 'object') {
this._tweens.unshift(next);

@@ -106,3 +106,7 @@ }

if (over) {
return this._next || this._done || true;
var actions = [this._hide, this._remove, this._done];
actions = actions.filter(function( element ) {
return typeof element === 'function';
});
return this._next || actions;
}

@@ -136,5 +140,5 @@ };

Tween.prototype.hide = function() {
this.done(function() {
this._hide = function() {
this.hide();
});
};
return this;

@@ -144,5 +148,5 @@ };

Tween.prototype.remove = function() {
this.done(function() {
this._remove = function() {
this.remove();
});
};
return this;

@@ -189,2 +193,2 @@ };

module.exports = Tween;
module.exports = Tween;
var Class = require('./core');
var Texture = require('./texture');
Class.canvas = function(type, attributes, callback) {
Class.canvas = function(type, attributes, drawFn) {
if (typeof type === 'string') {

@@ -9,3 +9,3 @@ if (typeof attributes === 'object') {

if (typeof attributes === 'function') {
callback = attributes;
drawFn = attributes;
}

@@ -16,3 +16,3 @@ attributes = {};

if (typeof type === 'function') {
callback = type;
drawFn = type;
}

@@ -42,4 +42,4 @@ attributes = {};

fn.call(this, context);
} else if (typeof fn === 'undefined' && typeof callback === 'function') {
callback.call(this, context);
} else if (typeof fn === 'undefined' && typeof drawFn === 'function') {
drawFn.call(this, context);
}

@@ -49,4 +49,4 @@ return this;

if (typeof callback === 'function') {
callback.call(texture, context);
if (typeof drawFn === 'function') {
drawFn.call(texture, context);
}

@@ -53,0 +53,0 @@

@@ -73,5 +73,7 @@ /**

function render() {
context.setTransform(1, 0, 0, 1, 0, 0);
context.clearRect(0, 0, width, height);
root.render(context);
if (width > 0 && height > 0) {
context.setTransform(1, 0, 0, 1, 0, 0);
context.clearRect(0, 0, width, height);
root.render(context);
}
}

@@ -86,6 +88,26 @@

resize();
window.addEventListener('resize', resize, false);
window.addEventListener('orientationchange', resize, false);
// resize();
// window.addEventListener('resize', resize, false);
// window.addEventListener('orientationchange', resize, false);
var lastWidth = -1;
var lastHeight = -1;
(function resizeLoop() {
var width, height;
if (full) {
// screen.availWidth/Height?
width = (window.innerWidth > 0 ? window.innerWidth : screen.width);
height = (window.innerHeight > 0 ? window.innerHeight : screen.height);
} else {
width = canvas.clientWidth;
height = canvas.clientHeight;
}
if (lastWidth !== width || lastHeight !== height) {
lastWidth = width;
lastHeight = height;
resize();
}
requestAnimationFrame(resizeLoop);
})();
function resize() {

@@ -92,0 +114,0 @@

@@ -118,4 +118,7 @@ var Class = require('./core');

this._update();
var ts = Math.max(this._ts_transform, this._ts_translate,
this._parent ? this._parent._ts_matrix : 0);
var ts = Math.max(
this._ts_transform,
this._ts_translate,
this._parent ? this._parent._ts_matrix : 0
);
if (this._mo_abs == ts) {

@@ -122,0 +125,0 @@ return this._absoluteMatrix;

@@ -21,2 +21,3 @@ var Class = require('./core');

var paused = true;
var stopped = true;

@@ -26,3 +27,3 @@ var self = this;

var loop = function(now) {
if (paused === true) {
if (paused === true || stopped === true) {
return;

@@ -52,2 +53,3 @@ }

this.start = function() {
stopped = false;
return this.resume();

@@ -78,2 +80,6 @@ };

};
this.stop = function() {
stopped = true;
return this;
};
};

@@ -80,0 +86,0 @@

@@ -398,7 +398,5 @@ var Class = require('./core');

Class.prototype.hitTest = function(hit) {
if (this.attr('spy')) {
return true;
}
return hit.x >= 0 && hit.x <= this._pin._width && hit.y >= 0
&& hit.y <= this._pin._height;
var width = this._pin._width;
var height = this._pin._height;
return hit.x >= 0 && hit.x <= width && hit.y >= 0 && hit.y <= height;
};

@@ -405,0 +403,0 @@

@@ -1,5 +0,4 @@

The MIT License (MIT)
@copyright Copyright (c) 2020 Ali Shakiba http://shakiba.me/stage.js
@license The MIT License (MIT)
Copyright (c) 2017 Ali Shakiba http://shakiba.me/stage.js
Permission is hereby granted, free of charge, to any person obtaining a copy

@@ -21,2 +20,2 @@ of this software and associated documentation files (the "Software"), to deal

OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
SOFTWARE.
{
"name": "stage-js",
"version": "0.8.11",
"description": "2D JavaScript library for cross-platform HTML5 game development",
"version": "0.9.3",
"description": "2D HTML5 Rendering and Layout",
"homepage": "http://piqnt.com/stage.js/",
"author": "Ali Shakiba (http://shakiba.me/stage.js)",
"license": "MIT",
"repository": {
"type": "git",
"url": "git://github.com/shakiba/stage.js.git"
},
"keywords": [

@@ -10,12 +16,10 @@ "html5",

"rendering",
"layout",
"engine",
"2d",
"canvas",
"cross-platform",
"web",
"mobile"
],
"license": "MIT",
"repository": {
"type": "git",
"url": "git://github.com/shakiba/stage.js.git"
},
"main": "lib/index.js",

@@ -31,30 +35,19 @@ "files": [

"devDependencies": {
"browserify": "^8.1.3",
"browserify-middleware": "^7.0.0",
"expect.js": "*",
"express": "^4.13.4",
"gulp": "*",
"gulp-browserify": "*",
"gulp-bump": "*",
"gulp-concat": "*",
"gulp-header": "^1.7.1",
"gulp-mocha": "*",
"gulp-rename": "^1.2.0",
"gulp-uglify": "*",
"gulp-util": "^3.0.5",
"gulp-wrap": "*",
"minimist": "*",
"express": "^4.17.1",
"mocha": "^6.2.3",
"nodemon": "^1.19.1",
"sandboxed-module": "^2.0.0",
"serve-index": "^1.7.3",
"sinon": "*",
"uglifyify": "^3.0.1",
"vinyl-buffer": "^1.0.0",
"vinyl-source-stream": "^1.0.0",
"vinyl-transform": "^1.0.0"
"serve-index": "^1.9.1",
"sinon": "^9.0.2",
"webpack": "^4.33.0",
"webpack-cli": "^3.3.3",
"webpack-dev-middleware": "^3.7.0"
},
"scripts": {
"test": "mocha test/*.js",
"dist": "gulp",
"dev": "node server.js"
"build": "webpack -p",
"watch": "webpack --watch",
"dev": "nodemon server.js"
}
}

@@ -1,2 +0,2 @@

#![Stage](https://s3.amazonaws.com/piqnt.com/stage.js/stage.png)
[![Stage](https://s3.amazonaws.com/piqnt.com/stage.js/stage.png)](http://piqnt.com/stage.js/)

@@ -14,13 +14,13 @@ Stage.js is a 2D HTML5 JavaScript library for cross-platform game development, it is lightweight, fast and open-source.

Canvas is the graphic component of HTML5 game development, but it only has a drawing API and there is no data model like DOM to compose your application.
Canvas is the graphic component of HTML5 game development, but it only has a drawing API and there is no data model like the DOM to compose your application.
You need to manually draw your application and manage rendering cycles to play it.
Moreover, mouse events are only available at entire Canvas level and they also need to be processed manually.
Moreover, mouse events are only available at the entire Canvas level and they also need to be processed manually.
Stage.js provides a DOM-like tree data model to compose your application and internally manages rendering cycles and drawing of your application.
Stage.js provides a DOM-like tree data model to compose your application and internally manages rendering cycles and the drawing of your application.
It also processes and distributes mouse and touch events to targeted tree nodes.
A Stage.js application consists of a tree of nodes. Each node is pinned (transformed) against its parent and has zero, one or more image textures.
Each rendering cycle consists of ticking and drawing tree nodes. On ticking nodes adjust themselves to recent updates and then on drawing each node transforms according to its pinning and draws its textures.
Each rendering cycle consists of ticking and drawing tree nodes. On ticking, nodes adjust themselves to recent updates while on drawing each node transforms according to its pinning and draws its textures.
Rendering is retained and is paused when there is no changed.
Rendering is retained and is paused when there is no change.

@@ -65,3 +65,3 @@ ### Example

#### Download
Latest builds are available in project [releases page](https://github.com/shakiba/stage.js/releases/latest).
Latest builds are available in the project [releases page](https://github.com/shakiba/stage.js/releases/latest).

@@ -85,3 +85,3 @@ #### NPM

Include an appropriate build file from `dist` directory in your HTML page before your application, for example:
Include an appropriate build file from `dist` directory in your HTML page before your application. For example:

@@ -114,3 +114,3 @@ ```html

An application is created by passing a callback function to `Stage()`.
The library will load, create and initialize all required components and then will call the provided function with the application root node and display container which normally is a Canvas element.
The library will load, create and initialize all required components and will then call the provided function with the application root node and display the container which is normally a Canvas element.

@@ -139,3 +139,3 @@ ```javascript

### Tree Model
Every app consists of a tree, tree's root is provided as `stage`.
Every app consists of a tree. The tree's root is provided as `stage`.

@@ -216,9 +216,9 @@ ```javascript

### Game Loop
Each rendering cycle consists of ticking and redrawing application tree.
Each rendering cycle consists of ticking and redrawing the application tree.
Application and its nodes can be updated during ticking.
Depending on application activities there can be three different follow-ups after ticking:
* If at least one node is touched then entire application tree will be redrawn and game loop will continue.
* If no node is touched but at least one ticking function returns `true` then game loop will continue but previous drawing will be retained.
* If no node is touched and no ticking function returns `true` then application will pause until it is touched directly or indirectly.
* If at least one node is touched then the entire application tree will be redrawn and the game loop will continue.
* If no node is touched but at least one ticking function returns `true` then the game loop will continue but the previous drawing will be retained.
* If no node is touched and no ticking function returns `true` then the application will pause until it is touched directly or indirectly.

@@ -298,5 +298,5 @@ Nodes can be touched directly by calling `node.touch()` but usually they are touched indirectly by other actions such as pinning or tree manipulation.

#### Positioning
When positioning, *handle* point on self is positioned at *offset* distance from *align* point on parent.
Handle and align are defined as ratio of width/height, 0 is top/left and 1 is bottom/right.
Handle defaults to align value when it is not specified.
When positioning, *handle* point on self is positioned at *offset* distance from *align* point on the parent.
Handle and align are defined as a ratio of width/height, 0 is top/left and 1 is bottom/right.
Handle defaults to the align value when it is not specified.

@@ -318,4 +318,4 @@ ```javascript

By default axis-aligned bounding box (AABB) after transformation is used for positioning,
however it is possible to use non-transformed box by setting pivot location.
By default an axis-aligned bounding box (AABB) after transformation is used for positioning,
however it is possible to use a non-transformed box by setting a pivot location.
Pivot location is defined as ratio of non-transformed width/height and is used as central point on self for scale, skew and rotation.

@@ -345,5 +345,5 @@

#### Scale To
Scale to new width/height, if mode is set scale proportionally. Valid modes are:
- `in`: maximum scale which keeps node edges inside scaleWidth/Height
- `in-pad`: like `in`, but evenly pads node to fill entire scaleWidth/Height
Scale to a new width/height, if mode is set to scale proportionally. Valid modes are:
- `in`: maximum scale which keeps node edges inside the scaleWidth/Height
- `in-pad`: like `in`, but evenly pads node to fill the entire scaleWidth/Height
- `out`: minimum scale which keeps node edges outside scaleWidth/Height

@@ -388,3 +388,3 @@ - `out-crop`: like `out`, but evenly crops it to scaleWidth/Height

Native mouse and touch events are captured, processed and published to application nodes.
Nodes receive mouse events in local coordinate, that is mouse location is specified as distance to top-left of the node.
Nodes receive mouse events in local coordinates, i.e. mouse location is specified as the distance to the top-left of the node.

@@ -400,3 +400,3 @@ ```javascript

Instead of native click events, syntatic click events are created and published to nodes.
In addition to standard event types, syntatic `mousecancel` event type is also supported which is similar to `touchcancel` but is published when a `mousedown` is not followed by `mouseup`.
In addition to standard event types, a syntactic `mousecancel` event type is also supported which is similar to `touchcancel` but is published when a `mousedown` is not followed by `mouseup`.

@@ -458,3 +458,3 @@ ```javascript

If image src starts with `./` it will be resolved relative to current script URL.
If image src starts with `./` it will be resolved relative to the current script URL.

@@ -652,3 +652,3 @@

## License
Copyright 2017 Ali Shakiba http://shakiba.me/stage.js
Copyright 2020 Ali Shakiba http://shakiba.me/stage.js
Available under the MIT License

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc