text: /*
   * Stage.js 0.8.2
   * 
   * @copyright 2015 Ali Shakiba, Piqnt LLC
   * @license The MIT License
   */
  !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/"),t("../lib/canvas"),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);return n&&n.length?(easing=o[n[1]],mode=s[n[3]],params=n[5],i=easing&&easing.fn?easing.fn:easing&&easing.fc?easing.fc.apply(easing.fc,params&&params.replace(/\s+/,"").split(",")):e,mode&&(i=mode.fn(i)),r[t]=i,i):e}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].tick(this,t,i,e);return s&&this._tweens.shift(),"object"==typeof s&&this._tweens.unshift(s),!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),r="function"==typeof this._easing?this._easing(r):r;var o=1-r;for(var n in this._end)this._owner.pin(n,this._start[n]*o+this._end[n]*r);if(s){try{this._done&&this._done.call(this._owner)}catch(h){console.log(h)}return this._next||!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.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){function i(){i._super.call(this),this.label("Image"),this._textures=[],this._image=null}var e=t("./core");t("./pin"),t("./loop");var n=t("./util/repeat"),r=t("./util/create");e.image=function(t){var e=new i;return t&&e.image(t),e},i._super=e,i.prototype=r(i._super.prototype),i.prototype.setImage=function(t,i,e){return this.image(t,i,e)},i.prototype.image=function(t){return this._image=e.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,i){function e(t,i,e,n,s,o,h,a,u){var f=r._textures.length>t?r._textures[t]:r._textures[t]=r._image.pipe();f.src(i,e,n,s),f.dest(o,h,a,u)}var r=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 r=this.pin("width"),s=this.pin("height");this._textures.length=n(this._image,r,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";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");window.addEventListener("load",function(){DEBUG&&console.log("On load."),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,o=this._tickBefore.length;o>s;s++)e.tick++,r=this._tickBefore[s].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,o=this._tickAfter.length;o>s;s++)e.tick++,r=this._tickAfter[s].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.tick(function e(n){return(i-=n)<0?(this.untick(e),void t.call(this)):!0})}},{"./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&&(r=!1,t(h)),this},this.pause=function(){return 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)});