var okapi=function(){var e={};e.SOURCE_OVER="source-over";e.SOURCE_IN="source-in";e.SOURCE_OUT="source-out";e.SOURCE_ATOP="source-atop";e.DESTINATION_OVER="distination-over";e.DESTINATION_IN="destination-in";e.DESTINATION_OUT="destination-out";e.DESTINATION_ATOP="destination-atop";e.LIGHTER="lighter";e.COPY="copy";e.XOR="xor";var j=function(a,b){var c=0,f=0,d;this.rotation=this.y=this.x=this.cy=this.cx=0;this.scaleY=this.scaleX=1;this.shadowOffsetY=this.shadowOffsetX=this.shadowBlur=0;this.shadowColor=
"rgba(0, 0, 0, 0)";this.alpha=1;this.compositeOperation="source-over";this.scaleList=[];if(a instanceof Array)for(d=0;d<a.length;++d){this.scaleList[d]={canvas:a[d].canvas,scale:a[d].scale,cx:0,cy:0};c=Math.max(c,a[d].canvas.width);f=Math.max(f,a[d].canvas.height)}else{this.scaleList[0]={canvas:a,scale:1,cx:0,cy:0};c=a.width;f=a.height}this.scaleList=this.scaleList.sort(function(k,l){return k.scale-l.scale});if(b)for(d=0;d<this.scaleList.length;++d){this.scaleList[d].cx=c*this.scaleList[d].scale/
2;this.scaleList[d].cy=f*this.scaleList[d].scale/2}};j.prototype.onBeforeDraw=function(){};j.prototype.onAfterDraw=function(){};j.prototype.draw=function(a){var b={},c,f,d;this.onBeforeDraw();b.shadowBlur=a.shadowBlur;b.shadowOffsetX=a.shadowOffsetX;b.shadowOffsetY=a.shadowOffsetY;b.shadowColor=a.shadowColor;b.globalAlpha=a.globalAlpha;b.globalCompositeOperation=a.globalCompositeOperation;a.save();a.shadowBlur=this.shadowBlur;a.shadowOffsetX=this.shadowOffsetX;a.shadowOffsetY=this.shadowOffsetY;a.shadowColor=
this.shadowColor;a.globalAlpha=this.alpha;a.globalCompositeOperation=this.compositeOperation;a.translate(this.x,this.y);a.rotate(this.rotation);c=Math.max(this.scaleX,this.scaleY);d=this.scaleList.length;for(f=0;f<d-1&&c>this.scaleList[f].scale;)++f;c=this.scaleList[f];a.scale(this.scaleX/c.scale,this.scaleY/c.scale);a.translate(-c.cx,-c.cy);a.drawImage(c.canvas,0,0);a.restore();a.shadowBlur=b.shadowBlur;a.shadowOffsetX=b.shadowOffsetX;a.shadowOffsetY=b.shadowOffsetY;a.shadowColor=b.shadowColor;a.globalAlpha=
b.globalAlpha;a.globalCompositeOperation=b.globalCompositeOperation;this.onAfterDraw()};var g=function(a,b){this.canvas=document.createElement("canvas");this.canvas.setAttribute("width",a);this.canvas.setAttribute("height",b);this.context=this.canvas.getContext("2d");this.displayList=[];this.continuous=false;this.length=0};g.prototype.draw=function(a){var b,c;this.onBeforeDraw();this.continuous||this.context.clearRect(0,0,this.canvas.width,this.canvas.height);b=this.displayList.length;for(c=0;c<b;++c)this.displayList[c].draw(this.context);
a!=null&&a.drawImage(this.canvas,0,0);this.onAfterDraw()};g.prototype.addChild=function(a){++this.length;this.displayList.push(a)};g.prototype.removeChild=function(a){a=this.displayList.indexOf(a);if(a>-1){--this.length;this.displayList.splice(a,1);return true}else return false};g.prototype.removeChildFromIndex=function(a){if(this.length>a&&a>-1){--this.length;this.displayList.splice(a,1);return true}else return false};g.prototype.removeAll=function(){for(;this.removeChildFromIndex(0););};g.prototype.onBeforeDraw=
function(){};g.prototype.onAfterDraw=function(){};var h=function(a){this.runId=-1;this.displayList=[];this.continuous=false;this.canvas=a;this.context=a.getContext("2d")};h.prototype=new g;h.prototype.start=function(a){var b=this;this.draw();clearInterval(this.runId);this.runId=setInterval(function(){b.draw.apply(b)},a)};h.prototype.clear=function(){this.context.clearRect(0,0,this.canvas.width,this.canvas.height)};h.prototype.stop=function(){clearInterval(this.runId)};var i={};i.CompositeOperation=
e;i.Sprite=j;i.Container=g;i.Engine=h;return i}();
