(function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.PIXI=f()}})(function(){var define,module,exports;return function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o=0&&arr.length%1===0}function _arrayEach(arr,iterator){var index=-1,length=arr.length;while(++index3){eachfn(arr,limit,iteratee,done)}else{cb=iterator;iterator=limit;eachfn(arr,iteratee,done)}}}async.any=async.some=_createTester(async.eachOf,toBool,identity);async.someLimit=_createTester(async.eachOfLimit,toBool,identity);async.all=async.every=_createTester(async.eachOf,notId,notId);async.everyLimit=_createTester(async.eachOfLimit,notId,notId);function _findGetResult(v,x){return x}async.detect=_createTester(async.eachOf,identity,_findGetResult);async.detectSeries=_createTester(async.eachOfSeries,identity,_findGetResult);async.detectLimit=_createTester(async.eachOfLimit,identity,_findGetResult);async.sortBy=function(arr,iterator,callback){async.map(arr,function(x,callback){iterator(x,function(err,criteria){if(err){callback(err)}else{callback(null,{value:x,criteria:criteria})}})},function(err,results){if(err){return callback(err)}else{callback(null,_map(results.sort(comparator),function(x){return x.value}))}});function comparator(left,right){var a=left.criteria,b=right.criteria;return ab?1:0}};async.auto=function(tasks,concurrency,callback){if(typeof arguments[1]==="function"){callback=concurrency;concurrency=null}callback=_once(callback||noop);var keys=_keys(tasks);var remainingTasks=keys.length;if(!remainingTasks){return callback(null)}if(!concurrency){concurrency=remainingTasks}var results={};var runningTasks=0;var hasError=false;var listeners=[];function addListener(fn){listeners.unshift(fn)}function removeListener(fn){var idx=_indexOf(listeners,fn);if(idx>=0)listeners.splice(idx,1)}function taskComplete(){remainingTasks--;_arrayEach(listeners.slice(0),function(fn){fn()})}addListener(function(){if(!remainingTasks){callback(null,results)}});_arrayEach(keys,function(k){if(hasError)return;var task=_isArray(tasks[k])?tasks[k]:[tasks[k]];var taskCallback=_restParam(function(err,args){runningTasks--;if(args.length<=1){args=args[0]}if(err){var safeResults={};_forEachOf(results,function(val,rkey){safeResults[rkey]=val});safeResults[k]=args;hasError=true;callback(err,safeResults)}else{results[k]=args;async.setImmediate(taskComplete)}});var requires=task.slice(0,task.length-1);var len=requires.length;var dep;while(len--){if(!(dep=tasks[requires[len]])){throw new Error("Has nonexistent dependency in "+requires.join(", "))}if(_isArray(dep)&&_indexOf(dep,k)>=0){throw new Error("Has cyclic dependencies")}}function ready(){return runningTasks3){throw new Error("Invalid arguments - must be either (task), (task, callback), (times, task) or (times, task, callback)")}else if(length<=2&&typeof times==="function"){callback=task;task=times}if(typeof times!=="function"){parseTimes(opts,times)}opts.callback=callback;opts.task=task;function wrappedTask(wrappedCallback,wrappedResults){function retryAttempt(task,finalAttempt){return function(seriesCallback){task(function(err,result){seriesCallback(!err||finalAttempt,{err:err,result:result})},wrappedResults)}}function retryInterval(interval){return function(seriesCallback){setTimeout(function(){seriesCallback(null)},interval)}}while(opts.times){var finalAttempt=!(opts.times-=1);attempts.push(retryAttempt(opts.task,finalAttempt));if(!finalAttempt&&opts.interval>0){attempts.push(retryInterval(opts.interval))}}async.series(attempts,function(done,data){data=data[data.length-1];(wrappedCallback||opts.callback)(data.err,data.result)})}return opts.callback?wrappedTask():wrappedTask};async.waterfall=function(tasks,callback){callback=_once(callback||noop);if(!_isArray(tasks)){var err=new Error("First argument to waterfall must be an array of functions");return callback(err)}if(!tasks.length){return callback()}function wrapIterator(iterator){return _restParam(function(err,args){if(err){callback.apply(null,[err].concat(args))}else{var next=iterator.next();if(next){args.push(wrapIterator(next))}else{args.push(callback)}ensureAsync(iterator).apply(null,args)}})}wrapIterator(async.iterator(tasks))()};function _parallel(eachfn,tasks,callback){callback=callback||noop;var results=_isArrayLike(tasks)?[]:{};eachfn(tasks,function(task,key,callback){task(_restParam(function(err,args){if(args.length<=1){args=args[0]}results[key]=args;callback(err)}))},function(err){callback(err,results)})}async.parallel=function(tasks,callback){_parallel(async.eachOf,tasks,callback)};async.parallelLimit=function(tasks,limit,callback){_parallel(_eachOfLimit(limit),tasks,callback)};async.series=function(tasks,callback){_parallel(async.eachOfSeries,tasks,callback)};async.iterator=function(tasks){function makeCallback(index){function fn(){if(tasks.length){tasks[index].apply(null,arguments)}return fn.next()}fn.next=function(){return index>>1);if(compare(item,sequence[mid])>=0){beg=mid}else{end=mid-1}}return beg}function _insert(q,data,priority,callback){if(callback!=null&&typeof callback!=="function"){throw new Error("task callback must be a function")}q.started=true;if(!_isArray(data)){data=[data]}if(data.length===0){return async.setImmediate(function(){q.drain()})}_arrayEach(data,function(task){var item={data:task,priority:priority,callback:typeof callback==="function"?callback:noop};q.tasks.splice(_binarySearch(q.tasks,item,_compareTasks)+1,0,item);if(q.tasks.length===q.concurrency){q.saturated()}async.setImmediate(q.process)})}var q=async.queue(worker,concurrency);q.push=function(data,priority,callback){_insert(q,data,priority,callback)};delete q.unshift;return q};async.cargo=function(worker,payload){return _queue(worker,1,payload)};function _console_fn(name){return _restParam(function(fn,args){fn.apply(null,args.concat([_restParam(function(err,args){if(typeof console==="object"){if(err){if(console.error){console.error(err)}}else if(console[name]){_arrayEach(args,function(x){console[name](x)})}}})]))})}async.log=_console_fn("log");async.dir=_console_fn("dir");async.memoize=function(fn,hasher){var memo={};var queues={};var has=Object.prototype.hasOwnProperty;hasher=hasher||identity;var memoized=_restParam(function memoized(args){var callback=args.pop();var key=hasher.apply(null,args);if(has.call(memo,key)){async.setImmediate(function(){callback.apply(null,memo[key])})}else if(has.call(queues,key)){queues[key].push(callback)}else{queues[key]=[callback];fn.apply(null,args.concat([_restParam(function(args){memo[key]=args;var q=queues[key];delete queues[key];for(var i=0,l=q.length;i=0;i--){var last=parts[i];if(last==="."){parts.splice(i,1)}else if(last===".."){parts.splice(i,1);up++}else if(up){parts.splice(i,1);up--}}if(allowAboveRoot){for(;up--;up){parts.unshift("..")}}return parts}var splitPathRe=/^(\/?|)([\s\S]*?)((?:\.{1,2}|[^\/]+?|)(\.[^.\/]*|))(?:[\/]*)$/;var splitPath=function(filename){return splitPathRe.exec(filename).slice(1)};exports.resolve=function(){var resolvedPath="",resolvedAbsolute=false;for(var i=arguments.length-1;i>=-1&&!resolvedAbsolute;i--){var path=i>=0?arguments[i]:process.cwd();if(typeof path!=="string"){throw new TypeError("Arguments to path.resolve must be strings")}else if(!path){continue}resolvedPath=path+"/"+resolvedPath;resolvedAbsolute=path.charAt(0)==="/"}resolvedPath=normalizeArray(filter(resolvedPath.split("/"),function(p){return!!p}),!resolvedAbsolute).join("/");return(resolvedAbsolute?"/":"")+resolvedPath||"."};exports.normalize=function(path){var isAbsolute=exports.isAbsolute(path),trailingSlash=substr(path,-1)==="/";path=normalizeArray(filter(path.split("/"),function(p){return!!p}),!isAbsolute).join("/");if(!path&&!isAbsolute){path="."}if(path&&trailingSlash){path+="/"}return(isAbsolute?"/":"")+path};exports.isAbsolute=function(path){return path.charAt(0)==="/"};exports.join=function(){var paths=Array.prototype.slice.call(arguments,0);return exports.normalize(filter(paths,function(p,index){if(typeof p!=="string"){throw new TypeError("Arguments to path.join must be strings")}return p}).join("/"))};exports.relative=function(from,to){from=exports.resolve(from).substr(1);to=exports.resolve(to).substr(1);function trim(arr){var start=0;for(;start=0;end--){if(arr[end]!=="")break}if(start>end)return[];return arr.slice(start,end-start+1)}var fromParts=trim(from.split("/"));var toParts=trim(to.split("/"));var length=Math.min(fromParts.length,toParts.length);var samePartsLength=length;for(var i=0;i1){for(var i=1;i= 0x80 (not a basic code point)","invalid-input":"Invalid input"},baseMinusTMin=base-tMin,floor=Math.floor,stringFromCharCode=String.fromCharCode,key;function error(type){throw new RangeError(errors[type])}function map(array,fn){var length=array.length;var result=[];while(length--){result[length]=fn(array[length])}return result}function mapDomain(string,fn){var parts=string.split("@");var result="";if(parts.length>1){result=parts[0]+"@";string=parts[1]}string=string.replace(regexSeparators,".");var labels=string.split(".");var encoded=map(labels,fn).join(".");return result+encoded}function ucs2decode(string){var output=[],counter=0,length=string.length,value,extra;while(counter=55296&&value<=56319&&counter65535){value-=65536;output+=stringFromCharCode(value>>>10&1023|55296);value=56320|value&1023}output+=stringFromCharCode(value);return output}).join("")}function basicToDigit(codePoint){if(codePoint-48<10){return codePoint-22}if(codePoint-65<26){return codePoint-65}if(codePoint-97<26){return codePoint-97}return base}function digitToBasic(digit,flag){return digit+22+75*(digit<26)-((flag!=0)<<5)}function adapt(delta,numPoints,firstTime){var k=0;delta=firstTime?floor(delta/damp):delta>>1;delta+=floor(delta/numPoints);for(;delta>baseMinusTMin*tMax>>1;k+=base){delta=floor(delta/baseMinusTMin)}return floor(k+(baseMinusTMin+1)*delta/(delta+skew))}function decode(input){var output=[],inputLength=input.length,out,i=0,n=initialN,bias=initialBias,basic,j,index,oldi,w,k,digit,t,baseMinusT;basic=input.lastIndexOf(delimiter);if(basic<0){basic=0}for(j=0;j=128){error("not-basic")}output.push(input.charCodeAt(j))}for(index=basic>0?basic+1:0;index=inputLength){error("invalid-input")}digit=basicToDigit(input.charCodeAt(index++));if(digit>=base||digit>floor((maxInt-i)/w)){error("overflow")}i+=digit*w;t=k<=bias?tMin:k>=bias+tMax?tMax:k-bias;if(digitfloor(maxInt/baseMinusT)){error("overflow")}w*=baseMinusT}out=output.length+1;bias=adapt(i-oldi,out,oldi==0);if(floor(i/out)>maxInt-n){error("overflow")}n+=floor(i/out);i%=out;output.splice(i++,0,n)}return ucs2encode(output)}function encode(input){var n,delta,handledCPCount,basicLength,bias,j,m,q,k,t,currentValue,output=[],inputLength,handledCPCountPlusOne,baseMinusT,qMinusT;input=ucs2decode(input);inputLength=input.length;n=initialN;delta=0;bias=initialBias;for(j=0;j=n&¤tValuefloor((maxInt-delta)/handledCPCountPlusOne)){error("overflow")}delta+=(m-n)*handledCPCountPlusOne;n=m;for(j=0;jmaxInt){error("overflow")}if(currentValue==n){for(q=delta,k=base;;k+=base){t=k<=bias?tMin:k>=bias+tMax?tMax:k-bias;if(q0&&len>maxKeys){len=maxKeys}for(var i=0;i=0){kstr=x.substr(0,idx);vstr=x.substr(idx+1)}else{kstr=x;vstr=""}k=decodeURIComponent(kstr);v=decodeURIComponent(vstr);if(!hasOwnProperty(obj,k)){obj[k]=v}else if(isArray(obj[k])){obj[k].push(v)}else{obj[k]=[obj[k],v]}}return obj};var isArray=Array.isArray||function(xs){return Object.prototype.toString.call(xs)==="[object Array]"}},{}],6:[function(require,module,exports){"use strict";var stringifyPrimitive=function(v){switch(typeof v){case"string":return v;case"boolean":return v?"true":"false";case"number":return isFinite(v)?v:"";default:return""}};module.exports=function(obj,sep,eq,name){sep=sep||"&";eq=eq||"=";if(obj===null){obj=undefined}if(typeof obj==="object"){return map(objectKeys(obj),function(k){var ks=encodeURIComponent(stringifyPrimitive(k))+eq;if(isArray(obj[k])){return map(obj[k],function(v){return ks+encodeURIComponent(stringifyPrimitive(v))}).join(sep)}else{return ks+encodeURIComponent(stringifyPrimitive(obj[k]))}}).join(sep)}if(!name)return"";return encodeURIComponent(stringifyPrimitive(name))+eq+encodeURIComponent(stringifyPrimitive(obj))};var isArray=Array.isArray||function(xs){return Object.prototype.toString.call(xs)==="[object Array]"};function map(xs,f){if(xs.map)return xs.map(f);var res=[];for(var i=0;i",'"',"`"," ","\r","\n"," "],unwise=["{","}","|","\\","^","`"].concat(delims),autoEscape=["'"].concat(unwise),nonHostChars=["%","/","?",";","#"].concat(autoEscape),hostEndingChars=["/","?","#"],hostnameMaxLen=255,hostnamePartPattern=/^[a-z0-9A-Z_-]{0,63}$/,hostnamePartStart=/^([a-z0-9A-Z_-]{0,63})(.*)$/,unsafeProtocol={javascript:true,"javascript:":true},hostlessProtocol={javascript:true,"javascript:":true},slashedProtocol={http:true,https:true,ftp:true,gopher:true,file:true,"http:":true,"https:":true,"ftp:":true,"gopher:":true,"file:":true},querystring=require("querystring");function urlParse(url,parseQueryString,slashesDenoteHost){if(url&&isObject(url)&&url instanceof Url)return url;var u=new Url;u.parse(url,parseQueryString,slashesDenoteHost);return u}Url.prototype.parse=function(url,parseQueryString,slashesDenoteHost){if(!isString(url)){throw new TypeError("Parameter 'url' must be a string, not "+typeof url)}var rest=url;rest=rest.trim();var proto=protocolPattern.exec(rest);if(proto){proto=proto[0];var lowerProto=proto.toLowerCase();this.protocol=lowerProto;rest=rest.substr(proto.length)}if(slashesDenoteHost||proto||rest.match(/^\/\/[^@\/]+@[^@\/]+/)){var slashes=rest.substr(0,2)==="//";if(slashes&&!(proto&&hostlessProtocol[proto])){rest=rest.substr(2);this.slashes=true}}if(!hostlessProtocol[proto]&&(slashes||proto&&!slashedProtocol[proto])){var hostEnd=-1;for(var i=0;i127){newpart+="x"}else{newpart+=part[j]}}if(!newpart.match(hostnamePartPattern)){var validParts=hostparts.slice(0,i);var notHost=hostparts.slice(i+1);var bit=part.match(hostnamePartStart);if(bit){validParts.push(bit[1]);notHost.unshift(bit[2])}if(notHost.length){rest="/"+notHost.join(".")+rest}this.hostname=validParts.join(".");break}}}}if(this.hostname.length>hostnameMaxLen){this.hostname=""}else{this.hostname=this.hostname.toLowerCase()}if(!ipv6Hostname){var domainArray=this.hostname.split(".");var newOut=[];for(var i=0;i0?result.host.split("@"):false;if(authInHost){result.auth=authInHost.shift();result.host=result.hostname=authInHost.shift()}}result.search=relative.search;result.query=relative.query;if(!isNull(result.pathname)||!isNull(result.search)){result.path=(result.pathname?result.pathname:"")+(result.search?result.search:"")}result.href=result.format();return result}if(!srcPath.length){result.pathname=null;if(result.search){result.path="/"+result.search}else{result.path=null}result.href=result.format();return result}var last=srcPath.slice(-1)[0];var hasTrailingSlash=(result.host||relative.host)&&(last==="."||last==="..")||last==="";var up=0;for(var i=srcPath.length;i>=0;i--){last=srcPath[i];if(last=="."){srcPath.splice(i,1)}else if(last===".."){srcPath.splice(i,1);up++}else if(up){srcPath.splice(i,1);up--}}if(!mustEndAbs&&!removeAllDots){for(;up--;up){srcPath.unshift("..")}}if(mustEndAbs&&srcPath[0]!==""&&(!srcPath[0]||srcPath[0].charAt(0)!=="/")){srcPath.unshift("")}if(hasTrailingSlash&&srcPath.join("/").substr(-1)!=="/"){srcPath.push("")}var isAbsolute=srcPath[0]===""||srcPath[0]&&srcPath[0].charAt(0)==="/";if(psychotic){result.hostname=result.host=isAbsolute?"":srcPath.length?srcPath.shift():"";var authInHost=result.host&&result.host.indexOf("@")>0?result.host.split("@"):false;if(authInHost){result.auth=authInHost.shift();result.host=result.hostname=authInHost.shift()}}mustEndAbs=mustEndAbs||result.host&&srcPath.length;if(mustEndAbs&&!isAbsolute){srcPath.unshift("")}if(!srcPath.length){result.pathname=null;result.path=null}else{result.pathname=srcPath.join("/")}if(!isNull(result.pathname)||!isNull(result.search)){result.path=(result.pathname?result.pathname:"")+(result.search?result.search:"")}result.auth=relative.auth||result.auth;result.slashes=result.slashes||relative.slashes;result.href=result.format();return result};Url.prototype.parseHost=function(){var host=this.host;var port=portPattern.exec(host);if(port){port=port[0];if(port!==":"){this.port=port.substr(1)}host=host.substr(0,host.length-port.length)}if(host)this.hostname=host};function isString(arg){return typeof arg==="string"}function isObject(arg){return typeof arg==="object"&&arg!==null}function isNull(arg){return arg===null}function isNullOrUndefined(arg){return arg==null}},{punycode:4,querystring:7}],9:[function(require,module,exports){"use strict";module.exports=earcut;function earcut(data,holeIndices,dim){dim=dim||2;var hasHoles=holeIndices&&holeIndices.length,outerLen=hasHoles?holeIndices[0]*dim:data.length,outerNode=linkedList(data,0,outerLen,dim,true),triangles=[];if(!outerNode)return triangles;var minX,minY,maxX,maxY,x,y,size;if(hasHoles)outerNode=eliminateHoles(data,holeIndices,outerNode,dim);if(data.length>80*dim){minX=maxX=data[0];minY=maxY=data[1];for(var i=dim;imaxX)maxX=x;if(y>maxY)maxY=y}size=Math.max(maxX-minX,maxY-minY)}earcutLinked(outerNode,triangles,dim,minX,minY,size);return triangles}function linkedList(data,start,end,dim,clockwise){var sum=0,i,j,last;for(i=start,j=end-dim;i0){for(i=start;i=start;i-=dim)last=insertNode(i,data[i],data[i+1],last)}return last}function filterPoints(start,end){if(!start)return start;if(!end)end=start;var p=start,again;do{again=false;if(!p.steiner&&(equals(p,p.next)||area(p.prev,p,p.next)===0)){removeNode(p);p=end=p.prev;if(p===p.next)return null;again=true}else{p=p.next}}while(again||p!==end);return end}function earcutLinked(ear,triangles,dim,minX,minY,size,pass){if(!ear)return;if(!pass&&size)indexCurve(ear,minX,minY,size);var stop=ear,prev,next;while(ear.prev!==ear.next){prev=ear.prev;next=ear.next;if(size?isEarHashed(ear,minX,minY,size):isEar(ear)){triangles.push(prev.i/dim);triangles.push(ear.i/dim);triangles.push(next.i/dim);removeNode(ear);ear=next.next;stop=next.next;continue}ear=next;if(ear===stop){if(!pass){earcutLinked(filterPoints(ear),triangles,dim,minX,minY,size,1)}else if(pass===1){ear=cureLocalIntersections(ear,triangles,dim);earcutLinked(ear,triangles,dim,minX,minY,size,2)}else if(pass===2){splitEarcut(ear,triangles,dim,minX,minY,size)}break}}}function isEar(ear){var a=ear.prev,b=ear,c=ear.next;if(area(a,b,c)>=0)return false;var p=ear.next.next;while(p!==ear.prev){if(pointInTriangle(a.x,a.y,b.x,b.y,c.x,c.y,p.x,p.y)&&area(p.prev,p,p.next)>=0)return false;p=p.next}return true}function isEarHashed(ear,minX,minY,size){var a=ear.prev,b=ear,c=ear.next;if(area(a,b,c)>=0)return false;var minTX=a.xb.x?a.x>c.x?a.x:c.x:b.x>c.x?b.x:c.x,maxTY=a.y>b.y?a.y>c.y?a.y:c.y:b.y>c.y?b.y:c.y;var minZ=zOrder(minTX,minTY,minX,minY,size),maxZ=zOrder(maxTX,maxTY,minX,minY,size);var p=ear.nextZ;while(p&&p.z<=maxZ){if(p!==ear.prev&&p!==ear.next&&pointInTriangle(a.x,a.y,b.x,b.y,c.x,c.y,p.x,p.y)&&area(p.prev,p,p.next)>=0)return false;p=p.nextZ}p=ear.prevZ;while(p&&p.z>=minZ){if(p!==ear.prev&&p!==ear.next&&pointInTriangle(a.x,a.y,b.x,b.y,c.x,c.y,p.x,p.y)&&area(p.prev,p,p.next)>=0)return false;p=p.prevZ}return true}function cureLocalIntersections(start,triangles,dim){var p=start;do{var a=p.prev,b=p.next.next;if(intersects(a,p,p.next,b)&&locallyInside(a,b)&&locallyInside(b,a)){triangles.push(a.i/dim);triangles.push(p.i/dim);triangles.push(b.i/dim);removeNode(p);removeNode(p.next);p=start=b}p=p.next}while(p!==start);return p}function splitEarcut(start,triangles,dim,minX,minY,size){var a=start;do{var b=a.next.next;while(b!==a.prev){if(a.i!==b.i&&isValidDiagonal(a,b)){var c=splitPolygon(a,b);a=filterPoints(a,a.next);c=filterPoints(c,c.next);earcutLinked(a,triangles,dim,minX,minY,size);earcutLinked(c,triangles,dim,minX,minY,size);return}b=b.next}a=a.next}while(a!==start)}function eliminateHoles(data,holeIndices,outerNode,dim){var queue=[],i,len,start,end,list;for(i=0,len=holeIndices.length;i=p.next.y){var x=p.x+(hy-p.y)*(p.next.x-p.x)/(p.next.y-p.y);if(x<=hx&&x>qx){qx=x;m=p.x=p.x&&p.x>=m.x&&pointInTriangle(hym.x)&&locallyInside(p,hole)){m=p;tanMin=tan}}p=p.next}return m}function indexCurve(start,minX,minY,size){var p=start;do{if(p.z===null)p.z=zOrder(p.x,p.y,minX,minY,size);p.prevZ=p.prev;p.nextZ=p.next;p=p.next}while(p!==start);p.prevZ.nextZ=null;p.prevZ=null;sortLinked(p)}function sortLinked(list){var i,p,q,e,tail,numMerges,pSize,qSize,inSize=1;do{p=list;list=null;tail=null;numMerges=0;while(p){numMerges++;q=p;pSize=0;for(i=0;i0||qSize>0&&q){if(pSize===0){e=q;q=q.nextZ;qSize--}else if(qSize===0||!q){e=p;p=p.nextZ;pSize--}else if(p.z<=q.z){e=p;p=p.nextZ;pSize--}else{e=q;q=q.nextZ;qSize--}if(tail)tail.nextZ=e;else list=e;e.prevZ=tail;tail=e}p=q}tail.nextZ=null;inSize*=2}while(numMerges>1);return list}function zOrder(x,y,minX,minY,size){x=32767*(x-minX)/size;y=32767*(y-minY)/size;x=(x|x<<8)&16711935;x=(x|x<<4)&252645135;x=(x|x<<2)&858993459;x=(x|x<<1)&1431655765;y=(y|y<<8)&16711935;y=(y|y<<4)&252645135;y=(y|y<<2)&858993459;y=(y|y<<1)&1431655765;return x|y<<1}function getLeftmost(start){var p=start,leftmost=start;do{if(p.x=0&&(ax-px)*(by-py)-(bx-px)*(ay-py)>=0&&(bx-px)*(cy-py)-(cx-px)*(by-py)>=0}function isValidDiagonal(a,b){return equals(a,b)||a.next.i!==b.i&&a.prev.i!==b.i&&!intersectsPolygon(a,b)&&locallyInside(a,b)&&locallyInside(b,a)&&middleInside(a,b)}function area(p,q,r){return(q.y-p.y)*(r.x-q.x)-(q.x-p.x)*(r.y-q.y)}function equals(p1,p2){return p1.x===p2.x&&p1.y===p2.y}function intersects(p1,q1,p2,q2){return area(p1,q1,p2)>0!==area(p1,q1,q2)>0&&area(p2,q2,p1)>0!==area(p2,q2,q1)>0}function intersectsPolygon(a,b){var p=a;do{if(p.i!==a.i&&p.next.i!==a.i&&p.i!==b.i&&p.next.i!==b.i&&intersects(p,p.next,a,b))return true;p=p.next}while(p!==a);return false}function locallyInside(a,b){return area(a.prev,a,a.next)<0?area(a,b,a.next)>=0&&area(a,a.prev,b)>=0:area(a,b,a.prev)<0||area(a,a.next,b)<0}function middleInside(a,b){var p=a,inside=false,px=(a.x+b.x)/2,py=(a.y+b.y)/2;do{if(p.y>py!==p.next.y>py&&px<(p.next.x-p.x)*(py-p.y)/(p.next.y-p.y)+p.x)inside=!inside;p=p.next}while(p!==a);return inside}function splitPolygon(a,b){var a2=new Node(a.i,a.x,a.y),b2=new Node(b.i,b.x,b.y),an=a.next,bp=b.prev;a.next=b;b.prev=a;a2.next=an;an.prev=a2;b2.next=a2;a2.prev=b2;bp.next=b2;b2.prev=bp;return b2}function insertNode(i,x,y,last){var p=new Node(i,x,y);if(!last){p.prev=p;p.next=p}else{p.next=last.next;p.prev=last;last.next.prev=p;last.next=p}return p}function removeNode(p){p.next.prev=p.prev;p.prev.next=p.next;if(p.prevZ)p.prevZ.nextZ=p.nextZ;if(p.nextZ)p.nextZ.prevZ=p.prevZ}function Node(i,x,y){this.i=i;this.x=x;this.y=y;this.prev=null;this.next=null;this.z=null;this.prevZ=null;this.nextZ=null;this.steiner=false}},{}],10:[function(require,module,exports){"use strict";var prefix=typeof Object.create!=="function"?"~":false;function EE(fn,context,once){this.fn=fn;this.context=context;this.once=once||false}function EventEmitter(){}EventEmitter.prototype._events=undefined;EventEmitter.prototype.listeners=function listeners(event,exists){var evt=prefix?prefix+event:event,available=this._events&&this._events[evt];if(exists)return!!available;if(!available)return[];if(available.fn)return[available.fn];for(var i=0,l=available.length,ee=new Array(l);i=arr.length){callback()}}}};async.forEach=async.each;async.eachSeries=function(arr,iterator,callback){callback=callback||function(){};if(!arr.length){return callback()}var completed=0;var iterate=function(){iterator(arr[completed],function(err){if(err){callback(err);callback=function(){}}else{completed+=1;if(completed>=arr.length){callback()}else{iterate()}}})};iterate()};async.forEachSeries=async.eachSeries;async.eachLimit=function(arr,limit,iterator,callback){var fn=_eachLimit(limit);fn.apply(null,[arr,iterator,callback])};async.forEachLimit=async.eachLimit;var _eachLimit=function(limit){return function(arr,iterator,callback){callback=callback||function(){};if(!arr.length||limit<=0){return callback()}var completed=0;var started=0;var running=0;(function replenish(){if(completed>=arr.length){return callback()}while(running=arr.length){callback()}else{replenish()}}})}})()}};var doParallel=function(fn){return function(){var args=Array.prototype.slice.call(arguments);return fn.apply(null,[async.each].concat(args))}};var doParallelLimit=function(limit,fn){return function(){var args=Array.prototype.slice.call(arguments);return fn.apply(null,[_eachLimit(limit)].concat(args))}};var doSeries=function(fn){return function(){var args=Array.prototype.slice.call(arguments);return fn.apply(null,[async.eachSeries].concat(args))}};var _asyncMap=function(eachfn,arr,iterator,callback){arr=_map(arr,function(x,i){return{index:i,value:x}});if(!callback){eachfn(arr,function(x,callback){iterator(x.value,function(err){callback(err)})})}else{var results=[];eachfn(arr,function(x,callback){iterator(x.value,function(err,v){results[x.index]=v;callback(err)})},function(err){callback(err,results)})}};async.map=doParallel(_asyncMap);async.mapSeries=doSeries(_asyncMap);async.mapLimit=function(arr,limit,iterator,callback){return _mapLimit(limit)(arr,iterator,callback)};var _mapLimit=function(limit){return doParallelLimit(limit,_asyncMap)};async.reduce=function(arr,memo,iterator,callback){async.eachSeries(arr,function(x,callback){iterator(memo,x,function(err,v){memo=v;callback(err)})},function(err){callback(err,memo)})};async.inject=async.reduce;async.foldl=async.reduce;async.reduceRight=function(arr,memo,iterator,callback){var reversed=_map(arr,function(x){return x}).reverse();async.reduce(reversed,memo,iterator,callback)};async.foldr=async.reduceRight;var _filter=function(eachfn,arr,iterator,callback){var results=[];arr=_map(arr,function(x,i){return{index:i,value:x}});eachfn(arr,function(x,callback){iterator(x.value,function(v){if(v){results.push(x)}callback()})},function(err){callback(_map(results.sort(function(a,b){return a.index-b.index}),function(x){return x.value}))})};async.filter=doParallel(_filter);async.filterSeries=doSeries(_filter);async.select=async.filter;async.selectSeries=async.filterSeries;var _reject=function(eachfn,arr,iterator,callback){var results=[];arr=_map(arr,function(x,i){return{index:i,value:x}});eachfn(arr,function(x,callback){iterator(x.value,function(v){if(!v){results.push(x)}callback()})},function(err){callback(_map(results.sort(function(a,b){return a.index-b.index}),function(x){return x.value}))})};async.reject=doParallel(_reject);async.rejectSeries=doSeries(_reject);var _detect=function(eachfn,arr,iterator,main_callback){eachfn(arr,function(x,callback){iterator(x,function(result){if(result){main_callback(x);main_callback=function(){}}else{callback()}})},function(err){main_callback()})};async.detect=doParallel(_detect);async.detectSeries=doSeries(_detect);async.some=function(arr,iterator,main_callback){async.each(arr,function(x,callback){iterator(x,function(v){if(v){main_callback(true);main_callback=function(){}}callback()})},function(err){main_callback(false)})};async.any=async.some;async.every=function(arr,iterator,main_callback){async.each(arr,function(x,callback){iterator(x,function(v){if(!v){main_callback(false);main_callback=function(){}}callback()})},function(err){main_callback(true)})};async.all=async.every;async.sortBy=function(arr,iterator,callback){async.map(arr,function(x,callback){iterator(x,function(err,criteria){if(err){callback(err)}else{callback(null,{value:x,criteria:criteria})}})},function(err,results){if(err){return callback(err)}else{var fn=function(left,right){var a=left.criteria,b=right.criteria;return ab?1:0};callback(null,_map(results.sort(fn),function(x){return x.value}))}})};async.auto=function(tasks,callback){callback=callback||function(){};var keys=_keys(tasks);var remainingTasks=keys.length;if(!remainingTasks){return callback()}var results={};var listeners=[];var addListener=function(fn){listeners.unshift(fn)};var removeListener=function(fn){for(var i=0;i>>1);if(compare(item,sequence[mid])>=0){beg=mid}else{end=mid-1}}return beg}function _insert(q,data,priority,callback){if(!q.started){q.started=true}if(!_isArray(data)){data=[data]}if(data.length==0){return async.setImmediate(function(){if(q.drain){q.drain()}})}_each(data,function(task){var item={data:task,priority:priority,callback:typeof callback==="function"?callback:null};q.tasks.splice(_binarySearch(q.tasks,item,_compareTasks)+1,0,item);if(q.saturated&&q.tasks.length===q.concurrency){q.saturated()}async.setImmediate(q.process)})}var q=async.queue(worker,concurrency);q.push=function(data,priority,callback){_insert(q,data,priority,callback)};delete q.unshift;return q};async.cargo=function(worker,payload){var working=false,tasks=[];var cargo={tasks:tasks,payload:payload,saturated:null,empty:null,drain:null,drained:true,push:function(data,callback){if(!_isArray(data)){data=[data]}_each(data,function(task){tasks.push({data:task,callback:typeof callback==="function"?callback:null});cargo.drained=false;if(cargo.saturated&&tasks.length===payload){cargo.saturated()}});async.setImmediate(cargo.process)},process:function process(){if(working)return;if(tasks.length===0){if(cargo.drain&&!cargo.drained)cargo.drain();cargo.drained=true;return}var ts=typeof payload==="number"?tasks.splice(0,payload):tasks.splice(0,tasks.length);var ds=_map(ts,function(task){return task.data});if(cargo.empty)cargo.empty();working=true;worker(ds,function(){working=false;var args=arguments;_each(ts,function(data){if(data.callback){data.callback.apply(null,args)}});process()})},length:function(){return tasks.length},running:function(){return working}};return cargo};var _console_fn=function(name){return function(fn){var args=Array.prototype.slice.call(arguments,1);fn.apply(null,args.concat([function(err){var args=Array.prototype.slice.call(arguments,1);if(typeof console!=="undefined"){if(err){if(console.error){console.error(err)}}else if(console[name]){_each(args,function(x){console[name](x)})}}}]))}};async.log=_console_fn("log");async.dir=_console_fn("dir");async.memoize=function(fn,hasher){var memo={};var queues={};hasher=hasher||function(x){return x};var memoized=function(){var args=Array.prototype.slice.call(arguments);var callback=args.pop();var key=hasher.apply(null,args);if(key in memo){async.nextTick(function(){callback.apply(null,memo[key])})}else if(key in queues){queues[key].push(callback)}else{queues[key]=[callback];fn.apply(null,args.concat([function(){memo[key]=arguments;var q=queues[key];delete queues[key];for(var i=0,l=q.length;i2){var args=Array.prototype.slice.call(arguments,2);return go.apply(this,args)}else{return go}};async.applyEach=doParallel(_applyEach);async.applyEachSeries=doSeries(_applyEach);async.forever=function(fn,callback){function next(err){if(err){if(callback){return callback(err)}throw err}fn(next)}next()};if(typeof module!=="undefined"&&module.exports){module.exports=async}else if(typeof define!=="undefined"&&define.amd){define([],function(){return async})}else{root.async=async}})()}).call(this,require("_process"))},{_process:3}],13:[function(require,module,exports){var async=require("async"),urlParser=require("url"),Resource=require("./Resource"),EventEmitter=require("eventemitter3");function Loader(baseUrl,concurrency){EventEmitter.call(this);concurrency=concurrency||10;this.baseUrl=baseUrl||"";this.progress=0;this.loading=false;this._progressChunk=0;this._beforeMiddleware=[];this._afterMiddleware=[];this._boundLoadResource=this._loadResource.bind(this);this._boundOnLoad=this._onLoad.bind(this);this._buffer=[];this._numToLoad=0;this._queue=async.queue(this._boundLoadResource,concurrency);this.resources={}}Loader.prototype=Object.create(EventEmitter.prototype);Loader.prototype.constructor=Loader;module.exports=Loader;Loader.prototype.add=Loader.prototype.enqueue=function(name,url,options,cb){if(Array.isArray(name)){for(var i=0;i0){if(this.xhrType===Resource.XHR_RESPONSE_TYPE.TEXT){this.data=xhr.responseText}else if(this.xhrType===Resource.XHR_RESPONSE_TYPE.JSON){try{this.data=JSON.parse(xhr.responseText);this.isJson=true}catch(e){this.error=new Error("Error trying to parse loaded json:",e)}}else if(this.xhrType===Resource.XHR_RESPONSE_TYPE.DOCUMENT){try{if(window.DOMParser){var domparser=new DOMParser;this.data=domparser.parseFromString(xhr.responseText,"text/xml")}else{var div=document.createElement("div");div.innerHTML=xhr.responseText;this.data=div}this.isXml=true}catch(e){this.error=new Error("Error trying to parse loaded xml:",e)}}else{this.data=xhr.response||xhr.responseText}}else{this.error=new Error("["+xhr.status+"]"+xhr.statusText+":"+xhr.responseURL)}this.complete()};function reqType(xhr){return xhr.toString().replace("object ","")}Resource.prototype._determineCrossOrigin=function(url,loc){if(url.indexOf("data:")===0){return""}loc=loc||window.location;if(!tempAnchor){tempAnchor=document.createElement("a")}tempAnchor.href=url;url=_url.parse(tempAnchor.href);var samePort=!url.port&&loc.port===""||url.port===loc.port;if(url.hostname!==loc.hostname||!samePort||url.protocol!==loc.protocol){return"anonymous"}return""};Resource.prototype._determineXhrType=function(){return Resource._xhrTypeMap[this._getExtension()]||Resource.XHR_RESPONSE_TYPE.TEXT};Resource.prototype._determineLoadType=function(){return Resource._loadTypeMap[this._getExtension()]||Resource.LOAD_TYPE.XHR};Resource.prototype._getExtension=function(){var url=this.url,ext;if(this.isDataUrl){var slashIndex=url.indexOf("/");ext=url.substring(slashIndex+1,url.indexOf(";",slashIndex))}else{var queryStart=url.indexOf("?");if(queryStart!==-1){url=url.substring(0,queryStart)}ext=url.substring(url.lastIndexOf(".")+1)}return ext};Resource.prototype._getMimeFromXhrType=function(type){switch(type){case Resource.XHR_RESPONSE_TYPE.BUFFER:return"application/octet-binary";case Resource.XHR_RESPONSE_TYPE.BLOB:return"application/blob";case Resource.XHR_RESPONSE_TYPE.DOCUMENT:return"application/xml";case Resource.XHR_RESPONSE_TYPE.JSON:return"application/json";case Resource.XHR_RESPONSE_TYPE.DEFAULT:case Resource.XHR_RESPONSE_TYPE.TEXT:default:return"text/plain"}};Resource.LOAD_TYPE={XHR:1,IMAGE:2,AUDIO:3,VIDEO:4};Resource.XHR_READY_STATE={UNSENT:0,OPENED:1,HEADERS_RECEIVED:2,LOADING:3,DONE:4};Resource.XHR_RESPONSE_TYPE={DEFAULT:"text",BUFFER:"arraybuffer",BLOB:"blob",DOCUMENT:"document",JSON:"json",TEXT:"text"};Resource._loadTypeMap={gif:Resource.LOAD_TYPE.IMAGE,png:Resource.LOAD_TYPE.IMAGE,bmp:Resource.LOAD_TYPE.IMAGE,jpg:Resource.LOAD_TYPE.IMAGE,jpeg:Resource.LOAD_TYPE.IMAGE,tif:Resource.LOAD_TYPE.IMAGE,tiff:Resource.LOAD_TYPE.IMAGE,webp:Resource.LOAD_TYPE.IMAGE,tga:Resource.LOAD_TYPE.IMAGE};Resource._xhrTypeMap={xhtml:Resource.XHR_RESPONSE_TYPE.DOCUMENT,html:Resource.XHR_RESPONSE_TYPE.DOCUMENT,htm:Resource.XHR_RESPONSE_TYPE.DOCUMENT,xml:Resource.XHR_RESPONSE_TYPE.DOCUMENT,tmx:Resource.XHR_RESPONSE_TYPE.DOCUMENT,tsx:Resource.XHR_RESPONSE_TYPE.DOCUMENT,svg:Resource.XHR_RESPONSE_TYPE.DOCUMENT,gif:Resource.XHR_RESPONSE_TYPE.BLOB,png:Resource.XHR_RESPONSE_TYPE.BLOB,bmp:Resource.XHR_RESPONSE_TYPE.BLOB,jpg:Resource.XHR_RESPONSE_TYPE.BLOB,jpeg:Resource.XHR_RESPONSE_TYPE.BLOB,tif:Resource.XHR_RESPONSE_TYPE.BLOB,tiff:Resource.XHR_RESPONSE_TYPE.BLOB,webp:Resource.XHR_RESPONSE_TYPE.BLOB,tga:Resource.XHR_RESPONSE_TYPE.BLOB,json:Resource.XHR_RESPONSE_TYPE.JSON,text:Resource.XHR_RESPONSE_TYPE.TEXT,txt:Resource.XHR_RESPONSE_TYPE.TEXT};Resource.setExtensionLoadType=function(extname,loadType){setExtMap(Resource._loadTypeMap,extname,loadType)};Resource.setExtensionXhrType=function(extname,xhrType){setExtMap(Resource._xhrTypeMap,extname,xhrType)};function setExtMap(map,extname,val){if(extname&&extname.indexOf(".")===0){extname=extname.substring(1)}if(!extname){return}map[extname]=val}},{eventemitter3:10,url:8}],15:[function(require,module,exports){module.exports={_keyStr:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",encodeBinary:function(input){var output="";var bytebuffer;var encodedCharIndexes=new Array(4);var inx=0;var jnx=0;var paddingBytes=0;while(inx>2;encodedCharIndexes[1]=(bytebuffer[0]&3)<<4|bytebuffer[1]>>4;encodedCharIndexes[2]=(bytebuffer[1]&15)<<2|bytebuffer[2]>>6;encodedCharIndexes[3]=bytebuffer[2]&63;paddingBytes=inx-(input.length-1);switch(paddingBytes){case 2:encodedCharIndexes[3]=64;encodedCharIndexes[2]=64;break;case 1:encodedCharIndexes[3]=64;break;default:break}for(jnx=0;jnx=0;i--){this.updateAccessibleObjects(children[i])}}};AccessibilityManager.prototype.update=function(){this.updateAccessibleObjects(this.renderer._lastObjectRendered);var rect=this.renderer.view.getBoundingClientRect();var sx=rect.width/this.renderer.width;var sy=rect.height/this.renderer.height;var div=this.div;div.style.left=rect.left+"px";div.style.top=rect.top+"px";div.style.width=this.renderer.width+"px";div.style.height=this.renderer.height+"px";for(var i=0;ithis.renderer.width){hitArea.width=this.renderer.width-hitArea.x}if(hitArea.y+hitArea.height>this.renderer.height){hitArea.height=this.renderer.height-hitArea.y}};AccessibilityManager.prototype.addChild=function(displayObject){var div=this.pool.pop();if(!div){div=document.createElement("button");div.style.width=100+"px";div.style.height=100+"px";div.style.backgroundColor=this.debug?"rgba(255,0,0,0.5)":"transparent";div.style.position="absolute";div.style.zIndex=2;div.style.borderStyle="none";div.addEventListener("click",this._onClick.bind(this));div.addEventListener("focus",this._onFocus.bind(this));div.addEventListener("focusout",this._onFocusOut.bind(this))}div.title=displayObject.accessibleTitle||"displayObject "+this.tabIndex;displayObject._accessibleActive=true;displayObject._accessibleDiv=div;div.displayObject=displayObject;this.children.push(displayObject);this.div.appendChild(displayObject._accessibleDiv);displayObject._accessibleDiv.tabIndex=displayObject.tabIndex};AccessibilityManager.prototype._onClick=function(e){var interactionManager=this.renderer.plugins.interaction;interactionManager.dispatchEvent(e.target.displayObject,"click",interactionManager.eventData)};AccessibilityManager.prototype._onFocus=function(e){var interactionManager=this.renderer.plugins.interaction;interactionManager.dispatchEvent(e.target.displayObject,"mouseover",interactionManager.eventData)};AccessibilityManager.prototype._onFocusOut=function(e){var interactionManager=this.renderer.plugins.interaction;interactionManager.dispatchEvent(e.target.displayObject,"mouseout",interactionManager.eventData)};AccessibilityManager.prototype._onKeyDown=function(e){if(e.keyCode!==9){return}this.activate()};AccessibilityManager.prototype._onMouseMove=function(){this.deactivate()};AccessibilityManager.prototype.destroy=function(){this.div=null;for(var i=0;i1){for(var i=0;i=0&&index<=this.children.length){if(child.parent){child.parent.removeChild(child)}child.parent=this;this.children.splice(index,0,child);this.onChildrenChange(index);child.emit("added",this);return child}else{throw new Error(child+"addChildAt: The index "+index+" supplied is out of bounds "+this.children.length)}};Container.prototype.swapChildren=function(child,child2){if(child===child2){return}var index1=this.getChildIndex(child);var index2=this.getChildIndex(child2);if(index1<0||index2<0){throw new Error("swapChildren: Both the supplied DisplayObjects must be children of the caller.")}this.children[index1]=child2;this.children[index2]=child;this.onChildrenChange(index1=this.children.length){throw new Error("The supplied index is out of bounds")}var currentIndex=this.getChildIndex(child);utils.removeItems(this.children,currentIndex,1);this.children.splice(index,0,child);this.onChildrenChange(index)};Container.prototype.getChildAt=function(index){if(index<0||index>=this.children.length){throw new Error("getChildAt: Supplied index "+index+" does not exist in the child list, or the supplied DisplayObject is not a child of the caller")}return this.children[index]};Container.prototype.removeChild=function(child){var argumentsLength=arguments.length;if(argumentsLength>1){for(var i=0;i0&&range<=end){removed=this.children.splice(begin,range);for(i=0;ichildMaxX?maxX:childMaxX;maxY=maxY>childMaxY?maxY:childMaxY}if(!childVisible){return math.Rectangle.EMPTY}var bounds=this._bounds;bounds.x=minX;bounds.y=minY;bounds.width=maxX-minX;bounds.height=maxY-minY;this._currentBounds=bounds}return this._currentBounds};Container.prototype.containerGetBounds=Container.prototype.getBounds;Container.prototype.getLocalBounds=function(){var matrixCache=this.worldTransform;this.worldTransform=math.Matrix.IDENTITY;for(var i=0,j=this.children.length;ib2*a1)}this.dirty=this.boundsDirty=true;return this};Graphics.prototype.arc=function(cx,cy,radius,startAngle,endAngle,anticlockwise){anticlockwise=anticlockwise||false;if(startAngle===endAngle){return this}if(!anticlockwise&&endAngle<=startAngle){endAngle+=Math.PI*2}else if(anticlockwise&&startAngle<=endAngle){startAngle+=Math.PI*2}var sweep=anticlockwise?(startAngle-endAngle)*-1:endAngle-startAngle;var segs=Math.ceil(Math.abs(sweep)/(Math.PI*2))*40;if(sweep===0){return this}var startX=cx+Math.cos(startAngle)*radius;var startY=cy+Math.sin(startAngle)*radius;if(this.currentPath){this.currentPath.shape.points.push(startX,startY)}else{this.moveTo(startX,startY)}var points=this.currentPath.shape.points;var theta=sweep/(segs*2);var theta2=theta*2;var cTheta=Math.cos(theta);var sTheta=Math.sin(theta);var segMinus=segs-1;var remainder=segMinus%1/segMinus;for(var i=0;i<=segMinus;i++){var real=i+remainder*i;var angle=theta+startAngle+theta2*real;var c=Math.cos(angle);var s=-Math.sin(angle);points.push((cTheta*c+sTheta*s)*radius+cx,(cTheta*-s+sTheta*c)*radius+cy)}this.dirty=this.boundsDirty=true;return this};Graphics.prototype.beginFill=function(color,alpha){this.filling=true;this.fillColor=color||0;this.fillAlpha=alpha===undefined?1:alpha;if(this.currentPath){if(this.currentPath.shape.points.length<=2){this.currentPath.fill=this.filling;this.currentPath.fillColor=this.fillColor;this.currentPath.fillAlpha=this.fillAlpha}}return this};Graphics.prototype.endFill=function(){this.filling=false;this.fillColor=null;this.fillAlpha=1;return this};Graphics.prototype.drawRect=function(x,y,width,height){this.drawShape(new math.Rectangle(x,y,width,height));return this};Graphics.prototype.drawRoundedRect=function(x,y,width,height,radius){this.drawShape(new math.RoundedRectangle(x,y,width,height,radius));return this};Graphics.prototype.drawCircle=function(x,y,radius){this.drawShape(new math.Circle(x,y,radius));return this};Graphics.prototype.drawEllipse=function(x,y,width,height){this.drawShape(new math.Ellipse(x,y,width,height));return this};Graphics.prototype.drawPolygon=function(path){var points=path;var closed=true;if(points instanceof math.Polygon){closed=points.closed;points=points.points}if(!Array.isArray(points)){points=new Array(arguments.length);for(var i=0;imaxX?x2:maxX;maxX=x3>maxX?x3:maxX;maxX=x4>maxX?x4:maxX;maxY=y2>maxY?y2:maxY;maxY=y3>maxY?y3:maxY;maxY=y4>maxY?y4:maxY;this._bounds.x=minX;this._bounds.width=maxX-minX;this._bounds.y=minY;this._bounds.height=maxY-minY;this._currentBounds=this._bounds}return this._currentBounds};Graphics.prototype.containsPoint=function(point){this.worldTransform.applyInverse(point,tempPoint);var graphicsData=this.graphicsData;for(var i=0;imaxX?x+w:maxX;minY=ymaxY?y+h:maxY}else if(type===CONST.SHAPES.CIRC){x=shape.x;y=shape.y;w=shape.radius+lineWidth/2;h=shape.radius+lineWidth/2;minX=x-wmaxX?x+w:maxX;minY=y-hmaxY?y+h:maxY}else if(type===CONST.SHAPES.ELIP){x=shape.x;y=shape.y;w=shape.width+lineWidth/2;h=shape.height+lineWidth/2;minX=x-wmaxX?x+w:maxX;minY=y-hmaxY?y+h:maxY}else{points=shape.points;for(var j=0;jmaxX?x+lineWidth:maxX;minY=y-lineWidthmaxY?y+lineWidth:maxY}}}}else{minX=0;maxX=0;minY=0;maxY=0}var padding=this.boundsPadding;this._localBounds.x=minX-padding;this._localBounds.width=maxX-minX+padding*2;this._localBounds.y=minY-padding;this._localBounds.height=maxY-minY+padding*2};Graphics.prototype.drawShape=function(shape){if(this.currentPath){if(this.currentPath.shape.points.length<=2){this.graphicsData.pop()}}this.currentPath=null;var data=new GraphicsData(this.lineWidth,this.lineColor,this.lineAlpha,this.fillColor,this.fillAlpha,this.filling,shape);this.graphicsData.push(data);if(data.type===CONST.SHAPES.POLY){data.shape.closed=data.shape.closed||this.filling;this.currentPath=data}this.dirty=this.boundsDirty=true;return data};Graphics.prototype.destroy=function(){Container.prototype.destroy.apply(this,arguments);for(var i=0;i=6){if(data.points.length0){webGLData=this.switchMode(webGL,0);this.buildLine(data,webGLData)}}else{webGLData=this.switchMode(webGL,0);if(data.type===CONST.SHAPES.RECT){this.buildRectangle(data,webGLData)}else if(data.type===CONST.SHAPES.CIRC||data.type===CONST.SHAPES.ELIP){this.buildCircle(data,webGLData)}else if(data.type===CONST.SHAPES.RREC){this.buildRoundedRectangle(data,webGLData)}}webGL.lastIndex++}for(i=0;i32e4||webGLData.mode!==type||type===1){webGLData=this.graphicsDataPool.pop()||new WebGLGraphicsData(webGL.gl);webGLData.mode=type;webGL.data.push(webGLData)}}webGLData.dirty=true;return webGLData};GraphicsRenderer.prototype.buildRectangle=function(graphicsData,webGLData){var rectData=graphicsData.shape;var x=rectData.x;var y=rectData.y;var width=rectData.width;var height=rectData.height;if(graphicsData.fill){var color=utils.hex2rgb(graphicsData.fillColor);var alpha=graphicsData.fillAlpha;var r=color[0]*alpha;var g=color[1]*alpha;var b=color[2]*alpha;var verts=webGLData.points;var indices=webGLData.indices;var vertPos=verts.length/6;verts.push(x,y);verts.push(r,g,b,alpha);verts.push(x+width,y);verts.push(r,g,b,alpha);verts.push(x,y+height);verts.push(r,g,b,alpha);verts.push(x+width,y+height);verts.push(r,g,b,alpha);indices.push(vertPos,vertPos,vertPos+1,vertPos+2,vertPos+3,vertPos+3)}if(graphicsData.lineWidth){var tempPoints=graphicsData.points;graphicsData.points=[x,y,x+width,y,x+width,y+height,x,y+height,x,y];this.buildLine(graphicsData,webGLData);graphicsData.points=tempPoints}};GraphicsRenderer.prototype.buildRoundedRectangle=function(graphicsData,webGLData){var rrectData=graphicsData.shape;var x=rrectData.x;var y=rrectData.y;var width=rrectData.width;var height=rrectData.height;var radius=rrectData.radius;var recPoints=[];recPoints.push(x,y+radius);this.quadraticBezierCurve(x,y+height-radius,x,y+height,x+radius,y+height,recPoints); this.quadraticBezierCurve(x+width-radius,y+height,x+width,y+height,x+width,y+height-radius,recPoints);this.quadraticBezierCurve(x+width,y+radius,x+width,y,x+width-radius,y,recPoints);this.quadraticBezierCurve(x+radius,y,x,y,x,y+radius+1e-10,recPoints);if(graphicsData.fill){var color=utils.hex2rgb(graphicsData.fillColor);var alpha=graphicsData.fillAlpha;var r=color[0]*alpha;var g=color[1]*alpha;var b=color[2]*alpha;var verts=webGLData.points;var indices=webGLData.indices;var vecPos=verts.length/6;var triangles=earcut(recPoints,null,2);var i=0;for(i=0;i140*140){perp3x=perpx-perp2x;perp3y=perpy-perp2y;dist=Math.sqrt(perp3x*perp3x+perp3y*perp3y);perp3x/=dist;perp3y/=dist;perp3x*=width;perp3y*=width;verts.push(p2x-perp3x,p2y-perp3y);verts.push(r,g,b,alpha);verts.push(p2x+perp3x,p2y+perp3y);verts.push(r,g,b,alpha);verts.push(p2x-perp3x,p2y-perp3y);verts.push(r,g,b,alpha);indexCount++}else{verts.push(px,py);verts.push(r,g,b,alpha);verts.push(p2x-(px-p2x),p2y-(py-p2y));verts.push(r,g,b,alpha)}}p1x=points[(length-2)*2];p1y=points[(length-2)*2+1];p2x=points[(length-1)*2];p2y=points[(length-1)*2+1];perpx=-(p1y-p2y);perpy=p1x-p2x;dist=Math.sqrt(perpx*perpx+perpy*perpy);perpx/=dist;perpy/=dist;perpx*=width;perpy*=width;verts.push(p2x-perpx,p2y-perpy);verts.push(r,g,b,alpha);verts.push(p2x+perpx,p2y+perpy);verts.push(r,g,b,alpha);indices.push(indexStart);for(i=0;imaxX?x:maxX;minY=ymaxY?y:maxY}points.push(minX,minY,maxX,minY,maxX,maxY,minX,maxY);var length=points.length/2;for(i=0;i0){return 1}return 0}function init(){for(var i=0;i<16;i++){var row=[];mul.push(row);for(var j=0;j<16;j++){var _ux=signum(ux[i]*ux[j]+vx[i]*uy[j]);var _uy=signum(uy[i]*ux[j]+vy[i]*uy[j]);var _vx=signum(ux[i]*vx[j]+vx[i]*vy[j]);var _vy=signum(uy[i]*vx[j]+vy[i]*vy[j]);for(var k=0;k<16;k++){if(ux[k]===_ux&&uy[k]===_uy&&vx[k]===_vx&&vy[k]===_vy){row.push(k);break}}}}for(i=0;i<16;i++){var mat=new Matrix;mat.set(ux[i],uy[i],vx[i],vy[i],0,0);tempMatrices.push(mat)}}init();var GroupD8={E:0,SE:1,S:2,SW:3,W:4,NW:5,N:6,NE:7,MIRROR_VERTICAL:8,MIRROR_HORIZONTAL:12,uX:function(ind){return ux[ind]},uY:function(ind){return uy[ind]},vX:function(ind){return vx[ind]},vY:function(ind){return vy[ind]},inv:function(rotation){if(rotation&8){return rotation&15}return-rotation&7},add:function(rotationSecond,rotationFirst){return mul[rotationSecond][rotationFirst]},sub:function(rotationSecond,rotationFirst){return mul[rotationSecond][GroupD8.inv(rotationFirst)]},rotate180:function(rotation){return rotation^4},isSwapWidthHeight:function(rotation){return(rotation&3)===2},byDirection:function(dx,dy){if(Math.abs(dx)*2<=Math.abs(dy)){if(dy>=0){return GroupD8.S}else{return GroupD8.N}}else if(Math.abs(dy)*2<=Math.abs(dx)){if(dx>0){return GroupD8.E}else{return GroupD8.W}}else{if(dy>0){if(dx>0){return GroupD8.SE}else{return GroupD8.SW}}else if(dx>0){return GroupD8.NE}else{return GroupD8.NW}}},matrixAppendRotationInv:function(matrix,rotation,tx,ty){var mat=tempMatrices[GroupD8.inv(rotation)];tx=tx||0;ty=ty||0;mat.tx=tx;mat.ty=ty;matrix.append(mat)}};module.exports=GroupD8},{"./Matrix":31}],31:[function(require,module,exports){var Point=require("./Point");function Matrix(){this.a=1;this.b=0;this.c=0;this.d=1;this.tx=0;this.ty=0}Matrix.prototype.constructor=Matrix;module.exports=Matrix;Matrix.prototype.fromArray=function(array){this.a=array[0];this.b=array[1];this.c=array[3];this.d=array[4];this.tx=array[2];this.ty=array[5]};Matrix.prototype.set=function(a,b,c,d,tx,ty){this.a=a;this.b=b;this.c=c;this.d=d;this.tx=tx;this.ty=ty;return this};Matrix.prototype.toArray=function(transpose,out){if(!this.array){this.array=new Float32Array(9)}var array=out||this.array;if(transpose){array[0]=this.a;array[1]=this.b;array[2]=0;array[3]=this.c;array[4]=this.d;array[5]=0;array[6]=this.tx;array[7]=this.ty;array[8]=1}else{array[0]=this.a;array[1]=this.c;array[2]=this.tx;array[3]=this.b;array[4]=this.d;array[5]=this.ty;array[6]=0;array[7]=0;array[8]=1}return array};Matrix.prototype.apply=function(pos,newPos){newPos=newPos||new Point;var x=pos.x;var y=pos.y;newPos.x=this.a*x+this.c*y+this.tx;newPos.y=this.b*x+this.d*y+this.ty;return newPos};Matrix.prototype.applyInverse=function(pos,newPos){newPos=newPos||new Point;var id=1/(this.a*this.d+this.c*-this.b);var x=pos.x;var y=pos.y;newPos.x=this.d*id*x+-this.c*id*y+(this.ty*this.c-this.tx*this.d)*id;newPos.y=this.a*id*y+-this.b*id*x+(-this.ty*this.a+this.tx*this.b)*id;return newPos};Matrix.prototype.translate=function(x,y){this.tx+=x;this.ty+=y;return this};Matrix.prototype.scale=function(x,y){this.a*=x;this.d*=y;this.c*=x;this.b*=y;this.tx*=x;this.ty*=y;return this};Matrix.prototype.rotate=function(angle){var cos=Math.cos(angle);var sin=Math.sin(angle);var a1=this.a;var c1=this.c;var tx1=this.tx;this.a=a1*cos-this.b*sin;this.b=a1*sin+this.b*cos;this.c=c1*cos-this.d*sin;this.d=c1*sin+this.d*cos;this.tx=tx1*cos-this.ty*sin;this.ty=tx1*sin+this.ty*cos;return this};Matrix.prototype.append=function(matrix){var a1=this.a;var b1=this.b;var c1=this.c;var d1=this.d;this.a=matrix.a*a1+matrix.b*c1;this.b=matrix.a*b1+matrix.b*d1;this.c=matrix.c*a1+matrix.d*c1;this.d=matrix.c*b1+matrix.d*d1;this.tx=matrix.tx*a1+matrix.ty*c1+this.tx;this.ty=matrix.tx*b1+matrix.ty*d1+this.ty;return this};Matrix.prototype.setTransform=function(x,y,pivotX,pivotY,scaleX,scaleY,rotation,skewX,skewY){var a,b,c,d,sr,cr,cy,sy,nsx,cx;sr=Math.sin(rotation);cr=Math.cos(rotation);cy=Math.cos(skewY);sy=Math.sin(skewY);nsx=-Math.sin(skewX);cx=Math.cos(skewX);a=cr*scaleX;b=sr*scaleX;c=-sr*scaleY;d=cr*scaleY;this.a=cy*a+sy*c;this.b=cy*b+sy*d;this.c=nsx*a+cx*c;this.d=nsx*b+cx*d;this.tx=x+(pivotX*a+pivotY*c);this.ty=y+(pivotX*b+pivotY*d);return this};Matrix.prototype.prepend=function(matrix){var tx1=this.tx;if(matrix.a!==1||matrix.b!==0||matrix.c!==0||matrix.d!==1){var a1=this.a;var c1=this.c;this.a=a1*matrix.a+this.b*matrix.c;this.b=a1*matrix.b+this.b*matrix.d;this.c=c1*matrix.a+this.d*matrix.c;this.d=c1*matrix.b+this.d*matrix.d}this.tx=tx1*matrix.a+this.ty*matrix.c+matrix.tx;this.ty=tx1*matrix.b+this.ty*matrix.d+matrix.ty;return this};Matrix.prototype.invert=function(){var a1=this.a;var b1=this.b;var c1=this.c;var d1=this.d;var tx1=this.tx;var n=a1*d1-b1*c1;this.a=d1/n;this.b=-b1/n;this.c=-c1/n;this.d=a1/n;this.tx=(c1*this.ty-d1*tx1)/n;this.ty=-(a1*this.ty-b1*tx1)/n;return this};Matrix.prototype.identity=function(){this.a=1;this.b=0;this.c=0;this.d=1;this.tx=0;this.ty=0;return this};Matrix.prototype.clone=function(){var matrix=new Matrix;matrix.a=this.a;matrix.b=this.b;matrix.c=this.c;matrix.d=this.d;matrix.tx=this.tx;matrix.ty=this.ty;return matrix};Matrix.prototype.copy=function(matrix){matrix.a=this.a;matrix.b=this.b;matrix.c=this.c;matrix.d=this.d;matrix.tx=this.tx;matrix.ty=this.ty;return matrix};Matrix.IDENTITY=new Matrix;Matrix.TEMP_MATRIX=new Matrix},{"./Point":32}],32:[function(require,module,exports){function Point(x,y){this.x=x||0;this.y=y||0}Point.prototype.constructor=Point;module.exports=Point;Point.prototype.clone=function(){return new Point(this.x,this.y)};Point.prototype.copy=function(p){this.set(p.x,p.y)};Point.prototype.equals=function(p){return p.x===this.x&&p.y===this.y};Point.prototype.set=function(x,y){this.x=x||0;this.y=y||(y!==0?this.x:0)}},{}],33:[function(require,module,exports){module.exports={Point:require("./Point"),Matrix:require("./Matrix"),GroupD8:require("./GroupD8"),Circle:require("./shapes/Circle"),Ellipse:require("./shapes/Ellipse"),Polygon:require("./shapes/Polygon"),Rectangle:require("./shapes/Rectangle"),RoundedRectangle:require("./shapes/RoundedRectangle")}},{"./GroupD8":30,"./Matrix":31,"./Point":32,"./shapes/Circle":34,"./shapes/Ellipse":35,"./shapes/Polygon":36,"./shapes/Rectangle":37,"./shapes/RoundedRectangle":38}],34:[function(require,module,exports){var Rectangle=require("./Rectangle"),CONST=require("../../const");function Circle(x,y,radius){this.x=x||0;this.y=y||0;this.radius=radius||0;this.type=CONST.SHAPES.CIRC}Circle.prototype.constructor=Circle;module.exports=Circle;Circle.prototype.clone=function(){return new Circle(this.x,this.y,this.radius)};Circle.prototype.contains=function(x,y){if(this.radius<=0){return false}var dx=this.x-x,dy=this.y-y,r2=this.radius*this.radius;dx*=dx;dy*=dy;return dx+dy<=r2};Circle.prototype.getBounds=function(){return new Rectangle(this.x-this.radius,this.y-this.radius,this.radius*2,this.radius*2)}},{"../../const":22,"./Rectangle":37}],35:[function(require,module,exports){var Rectangle=require("./Rectangle"),CONST=require("../../const");function Ellipse(x,y,width,height){this.x=x||0;this.y=y||0;this.width=width||0;this.height=height||0;this.type=CONST.SHAPES.ELIP}Ellipse.prototype.constructor=Ellipse;module.exports=Ellipse;Ellipse.prototype.clone=function(){return new Ellipse(this.x,this.y,this.width,this.height)};Ellipse.prototype.contains=function(x,y){if(this.width<=0||this.height<=0){return false}var normx=(x-this.x)/this.width,normy=(y-this.y)/this.height;normx*=normx;normy*=normy;return normx+normy<=1};Ellipse.prototype.getBounds=function(){return new Rectangle(this.x-this.width,this.y-this.height,this.width,this.height)}},{"../../const":22,"./Rectangle":37}],36:[function(require,module,exports){var Point=require("../Point"),CONST=require("../../const");function Polygon(points_){var points=points_;if(!Array.isArray(points)){points=new Array(arguments.length);for(var a=0;ay!==yj>y&&x<(xj-xi)*(y-yi)/(yj-yi)+xi;if(intersect){inside=!inside}}return inside}},{"../../const":22,"../Point":32}],37:[function(require,module,exports){var CONST=require("../../const");function Rectangle(x,y,width,height){this.x=x||0;this.y=y||0;this.width=width||0;this.height=height||0;this.type=CONST.SHAPES.RECT}Rectangle.prototype.constructor=Rectangle;module.exports=Rectangle;Rectangle.EMPTY=new Rectangle(0,0,0,0);Rectangle.prototype.clone=function(){return new Rectangle(this.x,this.y,this.width,this.height)};Rectangle.prototype.contains=function(x,y){if(this.width<=0||this.height<=0){return false}if(x>=this.x&&x=this.y&&y=this.x&&x<=this.x+this.width){if(y>=this.y&&y<=this.y+this.height){return true}}return false}},{"../../const":22}],39:[function(require,module,exports){var Container=require("../display/Container"),CONST=require("../const");function ParticleContainer(maxSize,properties,batchSize){Container.call(this);batchSize=batchSize||15e3;maxSize=maxSize||15e3;var maxBatchSize=16384;if(batchSize>maxBatchSize){batchSize=maxBatchSize}if(batchSize>maxSize){batchSize=maxSize}this._properties=[false,true,false,false,false];this._maxSize=maxSize;this._batchSize=batchSize;this._buffers=null;this._bufferToUpdate=0;this.interactiveChildren=false;this.blendMode=CONST.BLEND_MODES.NORMAL;this.roundPixels=true;this.setProperties(properties)}ParticleContainer.prototype=Object.create(Container.prototype);ParticleContainer.prototype.constructor=ParticleContainer;module.exports=ParticleContainer;ParticleContainer.prototype.setProperties=function(properties){if(properties){this._properties[0]="scale"in properties?!!properties.scale:this._properties[0];this._properties[1]="position"in properties?!!properties.position:this._properties[1];this._properties[2]="rotation"in properties?!!properties.rotation:this._properties[2];this._properties[3]="uvs"in properties?!!properties.uvs:this._properties[3];this._properties[4]="alpha"in properties?!!properties.alpha:this._properties[4]}};ParticleContainer.prototype.updateTransform=function(){this.displayObjectUpdateTransform()};ParticleContainer.prototype.renderWebGL=function(renderer){if(!this.visible||this.worldAlpha<=0||!this.children.length||!this.renderable){return}renderer.setObjectRenderer(renderer.plugins.particle);renderer.plugins.particle.render(this)};ParticleContainer.prototype.onChildrenChange=function(smallestChildIndex){var bufferIndex=Math.floor(smallestChildIndex/this._batchSize);if(bufferIndexmaxSize){totalChildren=maxSize}if(!container._buffers){container._buffers=this.generateBuffers(container)}this.renderer.blendModeManager.setBlendMode(container.blendMode);var gl=this.renderer.gl;var m=container.worldTransform.copy(this.tempMatrix);m.prepend(this.renderer.currentRenderTarget.projectionMatrix);gl.uniformMatrix3fv(this.shader.uniforms.projectionMatrix._location,false,m.toArray(true));gl.uniform1f(this.shader.uniforms.uAlpha._location,container.worldAlpha);var baseTexture=children[0]._texture.baseTexture;if(!baseTexture._glTextures[gl.id]){if(!this.renderer.updateTexture(baseTexture)){return}if(!container._properties[0]||!container._properties[3]){container._bufferToUpdate=0}}else{gl.bindTexture(gl.TEXTURE_2D,baseTexture._glTextures[gl.id])}for(var i=0,j=0;ibatchSize){amount=batchSize}var buffer=container._buffers[j];buffer.uploadDynamic(children,i,amount);if(container._bufferToUpdate===j){buffer.uploadStatic(children,i,amount);container._bufferToUpdate=j+1}buffer.bind(this.shader);gl.drawElements(gl.TRIANGLES,amount*6,gl.UNSIGNED_SHORT,0);this.renderer.drawCount++}};ParticleRenderer.prototype.generateBuffers=function(container){ var gl=this.renderer.gl,buffers=[],size=container._maxSize,batchSize=container._batchSize,dynamicPropertyFlags=container._properties,i;for(i=0;imaxRadius?maxRadius:radius;context.beginPath();context.moveTo(rx,ry+radius);context.lineTo(rx,ry+height-radius);context.quadraticCurveTo(rx,ry+height,rx+radius,ry+height);context.lineTo(rx+width-radius,ry+height);context.quadraticCurveTo(rx+width,ry+height,rx+width,ry+height-radius);context.lineTo(rx+width,ry+radius);context.quadraticCurveTo(rx+width,ry,rx+width-radius,ry);context.lineTo(rx+radius,ry);context.quadraticCurveTo(rx,ry,rx,ry+radius);context.closePath();if(data.fillColor||data.fillColor===0){context.globalAlpha=data.fillAlpha*worldAlpha;context.fillStyle="#"+("00000"+(fillColor|0).toString(16)).substr(-6);context.fill()}if(data.lineWidth){context.globalAlpha=data.lineAlpha*worldAlpha;context.strokeStyle="#"+("00000"+(lineColor|0).toString(16)).substr(-6);context.stroke()}}}};CanvasGraphics.renderGraphicsMask=function(graphics,context){var len=graphics.graphicsData.length;if(len===0){return}context.beginPath();for(var i=0;imaxRadius?maxRadius:radius;context.moveTo(rx,ry+radius);context.lineTo(rx,ry+height-radius);context.quadraticCurveTo(rx,ry+height,rx+radius,ry+height);context.lineTo(rx+width-radius,ry+height);context.quadraticCurveTo(rx+width,ry+height,rx+width,ry+height-radius);context.lineTo(rx+width,ry+radius);context.quadraticCurveTo(rx+width,ry,rx+width-radius,ry);context.lineTo(rx+radius,ry);context.quadraticCurveTo(rx,ry,rx,ry+radius);context.closePath()}}};CanvasGraphics.updateGraphicsTint=function(graphics){if(graphics.tint===16777215&&graphics._prevTint===graphics.tint){return}graphics._prevTint=graphics.tint;var tintR=(graphics.tint>>16&255)/255;var tintG=(graphics.tint>>8&255)/255;var tintB=(graphics.tint&255)/255;for(var i=0;i>16&255)/255*tintR*255<<16)+((fillColor>>8&255)/255*tintG*255<<8)+(fillColor&255)/255*tintB*255;data._lineTint=((lineColor>>16&255)/255*tintR*255<<16)+((lineColor>>8&255)/255*tintG*255<<8)+(lineColor&255)/255*tintB*255}}},{"../../../const":22}],47:[function(require,module,exports){var CanvasGraphics=require("./CanvasGraphics");function CanvasMaskManager(){}CanvasMaskManager.prototype.constructor=CanvasMaskManager;module.exports=CanvasMaskManager;CanvasMaskManager.prototype.pushMask=function(maskData,renderer){renderer.context.save();var cacheAlpha=maskData.alpha;var transform=maskData.worldTransform;var resolution=renderer.resolution;renderer.context.setTransform(transform.a*resolution,transform.b*resolution,transform.c*resolution,transform.d*resolution,transform.tx*resolution,transform.ty*resolution);if(!maskData.texture){CanvasGraphics.renderGraphicsMask(maskData,renderer.context);renderer.context.clip()}maskData.worldAlpha=cacheAlpha};CanvasMaskManager.prototype.popMask=function(renderer){renderer.context.restore()};CanvasMaskManager.prototype.destroy=function(){}},{"./CanvasGraphics":46}],48:[function(require,module,exports){var utils=require("../../../utils");var CanvasTinter={};module.exports=CanvasTinter;CanvasTinter.getTintedTexture=function(sprite,color){var texture=sprite.texture;color=CanvasTinter.roundColor(color);var stringColor="#"+("00000"+(color|0).toString(16)).substr(-6);texture.tintCache=texture.tintCache||{};if(texture.tintCache[stringColor]){return texture.tintCache[stringColor]}var canvas=CanvasTinter.canvas||document.createElement("canvas");CanvasTinter.tintMethod(texture,color,canvas);if(CanvasTinter.convertTintToImage){var tintImage=new Image;tintImage.src=canvas.toDataURL();texture.tintCache[stringColor]=tintImage}else{texture.tintCache[stringColor]=canvas;CanvasTinter.canvas=null}return canvas};CanvasTinter.tintWithMultiply=function(texture,color,canvas){var context=canvas.getContext("2d");var resolution=texture.baseTexture.resolution;var crop=texture.crop.clone();crop.x*=resolution;crop.y*=resolution;crop.width*=resolution;crop.height*=resolution;canvas.width=crop.width;canvas.height=crop.height;context.fillStyle="#"+("00000"+(color|0).toString(16)).substr(-6);context.fillRect(0,0,crop.width,crop.height);context.globalCompositeOperation="multiply";context.drawImage(texture.baseTexture.source,crop.x,crop.y,crop.width,crop.height,0,0,crop.width,crop.height);context.globalCompositeOperation="destination-atop";context.drawImage(texture.baseTexture.source,crop.x,crop.y,crop.width,crop.height,0,0,crop.width,crop.height)};CanvasTinter.tintWithOverlay=function(texture,color,canvas){var context=canvas.getContext("2d");var resolution=texture.baseTexture.resolution;var crop=texture.crop.clone();crop.x*=resolution;crop.y*=resolution;crop.width*=resolution;crop.height*=resolution;canvas.width=crop.width;canvas.height=crop.height;context.globalCompositeOperation="copy";context.fillStyle="#"+("00000"+(color|0).toString(16)).substr(-6);context.fillRect(0,0,crop.width,crop.height);context.globalCompositeOperation="destination-atop";context.drawImage(texture.baseTexture.source,crop.x,crop.y,crop.width,crop.height,0,0,crop.width,crop.height)};CanvasTinter.tintWithPerPixel=function(texture,color,canvas){var context=canvas.getContext("2d");var resolution=texture.baseTexture.resolution;var crop=texture.crop.clone();crop.x*=resolution;crop.y*=resolution;crop.width*=resolution;crop.height*=resolution;canvas.width=crop.width;canvas.height=crop.height;context.globalCompositeOperation="copy";context.drawImage(texture.baseTexture.source,crop.x,crop.y,crop.width,crop.height,0,0,crop.width,crop.height);var rgbValues=utils.hex2rgb(color);var r=rgbValues[0],g=rgbValues[1],b=rgbValues[2];var pixelData=context.getImageData(0,0,crop.width,crop.height);var pixels=pixelData.data;for(var i=0;i lumaMax))\n color = vec4(rgbA, texColor.a);\n else\n color = vec4(rgbB, texColor.a);\n return color;\n}\n\n\nvarying vec2 vTextureCoord;\nvarying vec4 vColor;\nvarying vec2 vResolution;\n\n//texcoords computed in vertex step\n//to avoid dependent texture reads\nvarying vec2 v_rgbNW;\nvarying vec2 v_rgbNE;\nvarying vec2 v_rgbSW;\nvarying vec2 v_rgbSE;\nvarying vec2 v_rgbM;\n\nuniform sampler2D uSampler;\n\n\nvoid main(void){\n\n gl_FragColor = fxaa(uSampler, vTextureCoord * vResolution, vResolution, v_rgbNW, v_rgbNE, v_rgbSW, v_rgbSE, v_rgbM);\n\n}\n',{resolution:{type:"v2",value:{x:1,y:1}}})}FXAAFilter.prototype=Object.create(AbstractFilter.prototype);FXAAFilter.prototype.constructor=FXAAFilter;module.exports=FXAAFilter;FXAAFilter.prototype.applyFilter=function(renderer,input,output){var filterManager=renderer.filterManager;var shader=this.getShader(renderer);filterManager.applyFilter(shader,input,output)}},{"./AbstractFilter":50}],52:[function(require,module,exports){var AbstractFilter=require("./AbstractFilter"),math=require("../../../math");function SpriteMaskFilter(sprite){var maskMatrix=new math.Matrix;AbstractFilter.call(this,"attribute vec2 aVertexPosition;\nattribute vec2 aTextureCoord;\nattribute vec4 aColor;\n\nuniform mat3 projectionMatrix;\nuniform mat3 otherMatrix;\n\nvarying vec2 vMaskCoord;\nvarying vec2 vTextureCoord;\nvarying vec4 vColor;\n\nvoid main(void)\n{\n gl_Position = vec4((projectionMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);\n vTextureCoord = aTextureCoord;\n vMaskCoord = ( otherMatrix * vec3( aTextureCoord, 1.0) ).xy;\n vColor = vec4(aColor.rgb * aColor.a, aColor.a);\n}\n","precision lowp float;\n\nvarying vec2 vMaskCoord;\nvarying vec2 vTextureCoord;\nvarying vec4 vColor;\n\nuniform sampler2D uSampler;\nuniform float alpha;\nuniform sampler2D mask;\n\nvoid main(void)\n{\n // check clip! this will stop the mask bleeding out from the edges\n vec2 text = abs( vMaskCoord - 0.5 );\n text = step(0.5, text);\n float clip = 1.0 - max(text.y, text.x);\n vec4 original = texture2D(uSampler, vTextureCoord);\n vec4 masky = texture2D(mask, vMaskCoord);\n original *= (masky.r * masky.a * alpha * clip);\n gl_FragColor = original;\n}\n",{mask:{type:"sampler2D",value:sprite._texture},alpha:{type:"f",value:1},otherMatrix:{type:"mat3",value:maskMatrix.toArray(true)}});this.maskSprite=sprite;this.maskMatrix=maskMatrix}SpriteMaskFilter.prototype=Object.create(AbstractFilter.prototype);SpriteMaskFilter.prototype.constructor=SpriteMaskFilter;module.exports=SpriteMaskFilter;SpriteMaskFilter.prototype.applyFilter=function(renderer,input,output){var filterManager=renderer.filterManager;this.uniforms.mask.value=this.maskSprite._texture;filterManager.calculateMappedMatrix(input.frame,this.maskSprite,this.maskMatrix);this.uniforms.otherMatrix.value=this.maskMatrix.toArray(true);this.uniforms.alpha.value=this.maskSprite.worldAlpha;var shader=this.getShader(renderer);filterManager.applyFilter(shader,input,output)};Object.defineProperties(SpriteMaskFilter.prototype,{map:{get:function(){return this.uniforms.mask.value},set:function(value){this.uniforms.mask.value=value}},offset:{get:function(){return this.uniforms.offset.value},set:function(value){this.uniforms.offset.value=value}}})},{"../../../math":33,"./AbstractFilter":50}],53:[function(require,module,exports){var WebGLManager=require("./WebGLManager");function BlendModeManager(renderer){WebGLManager.call(this,renderer);this.currentBlendMode=99999}BlendModeManager.prototype=Object.create(WebGLManager.prototype);BlendModeManager.prototype.constructor=BlendModeManager;module.exports=BlendModeManager;BlendModeManager.prototype.setBlendMode=function(blendMode){if(this.currentBlendMode===blendMode){return false}this.currentBlendMode=blendMode;var mode=this.renderer.blendModes[this.currentBlendMode];this.renderer.gl.blendFunc(mode[0],mode[1]);return true}},{"./WebGLManager":58}],54:[function(require,module,exports){var WebGLManager=require("./WebGLManager"),RenderTarget=require("../utils/RenderTarget"),CONST=require("../../../const"),Quad=require("../utils/Quad"),math=require("../../../math");function FilterManager(renderer){WebGLManager.call(this,renderer);this.filterStack=[];this.filterStack.push({renderTarget:renderer.currentRenderTarget,filter:[],bounds:null});this.texturePool=[];this.textureSize=new math.Rectangle(0,0,renderer.width,renderer.height);this.currentFrame=null}FilterManager.prototype=Object.create(WebGLManager.prototype);FilterManager.prototype.constructor=FilterManager;module.exports=FilterManager;FilterManager.prototype.onContextChange=function(){this.texturePool.length=0;var gl=this.renderer.gl;this.quad=new Quad(gl)};FilterManager.prototype.setFilterStack=function(filterStack){this.filterStack=filterStack};FilterManager.prototype.pushFilter=function(target,filters){var bounds=target.filterArea?target.filterArea.clone():target.getBounds();bounds.x=bounds.x|0;bounds.y=bounds.y|0;bounds.width=bounds.width|0;bounds.height=bounds.height|0;var padding=filters[0].padding|0;bounds.x-=padding;bounds.y-=padding;bounds.width+=padding*2;bounds.height+=padding*2;if(this.renderer.currentRenderTarget.transform){var transform=this.renderer.currentRenderTarget.transform;bounds.x+=transform.tx;bounds.y+=transform.ty;this.capFilterArea(bounds);bounds.x-=transform.tx;bounds.y-=transform.ty}else{this.capFilterArea(bounds)}if(bounds.width>0&&bounds.height>0){this.currentFrame=bounds;var texture=this.getRenderTarget();this.renderer.setRenderTarget(texture);texture.clear();this.filterStack.push({renderTarget:texture,filter:filters})}else{this.filterStack.push({renderTarget:null,filter:filters})}};FilterManager.prototype.popFilter=function(){var filterData=this.filterStack.pop();var previousFilterData=this.filterStack[this.filterStack.length-1];var input=filterData.renderTarget;if(!filterData.renderTarget){return}var output=previousFilterData.renderTarget;var gl=this.renderer.gl;this.currentFrame=input.frame;this.quad.map(this.textureSize,input.frame);gl.bindBuffer(gl.ARRAY_BUFFER,this.quad.vertexBuffer);gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER,this.quad.indexBuffer);var filters=filterData.filter;gl.vertexAttribPointer(this.renderer.shaderManager.defaultShader.attributes.aVertexPosition,2,gl.FLOAT,false,0,0);gl.vertexAttribPointer(this.renderer.shaderManager.defaultShader.attributes.aTextureCoord,2,gl.FLOAT,false,0,2*4*4);gl.vertexAttribPointer(this.renderer.shaderManager.defaultShader.attributes.aColor,4,gl.FLOAT,false,0,4*4*4);this.renderer.blendModeManager.setBlendMode(CONST.BLEND_MODES.NORMAL);if(filters.length===1){if(filters[0].uniforms.dimensions){filters[0].uniforms.dimensions.value[0]=this.renderer.width;filters[0].uniforms.dimensions.value[1]=this.renderer.height;filters[0].uniforms.dimensions.value[2]=this.quad.vertices[0];filters[0].uniforms.dimensions.value[3]=this.quad.vertices[5]}filters[0].applyFilter(this.renderer,input,output);this.returnRenderTarget(input)}else{var flipTexture=input;var flopTexture=this.getRenderTarget(true);for(var i=0;ithis.textureSize.width){filterArea.width=this.textureSize.width-filterArea.x}if(filterArea.y+filterArea.height>this.textureSize.height){filterArea.height=this.textureSize.height-filterArea.y}};FilterManager.prototype.resize=function(width,height){this.textureSize.width=width;this.textureSize.height=height;for(var i=0;imaxX?x2:maxX;maxX=x3>maxX?x3:maxX;maxX=x4>maxX?x4:maxX;maxY=y1;maxY=y2>maxY?y2:maxY;maxY=y3>maxY?y3:maxY;maxY=y4>maxY?y4:maxY;if(this.children.length){var childBounds=this.containerGetBounds();w0=childBounds.x;w1=childBounds.x+childBounds.width;h0=childBounds.y;h1=childBounds.y+childBounds.height;minX=minXw1?maxX:w1;maxY=maxY>h1?maxY:h1}var bounds=this._bounds;bounds.x=minX;bounds.width=maxX-minX;bounds.y=minY;bounds.height=maxY-minY;this._currentBounds=bounds}return this._currentBounds};Sprite.prototype.getLocalBounds=function(){this._bounds.x=-this._texture._frame.width*this.anchor.x;this._bounds.y=-this._texture._frame.height*this.anchor.y;this._bounds.width=this._texture._frame.width;this._bounds.height=this._texture._frame.height;return this._bounds};Sprite.prototype.containsPoint=function(point){this.worldTransform.applyInverse(point,tempPoint);var width=this._texture._frame.width;var height=this._texture._frame.height;var x1=-width*this.anchor.x;var y1;if(tempPoint.x>x1&&tempPoint.xy1&&tempPoint.y=this.size){this.flush()}var uvs=texture._uvs;if(!uvs){return}var aX=sprite.anchor.x;var aY=sprite.anchor.y;var w0,w1,h0,h1;if(texture.trim&&sprite.tileScale===undefined){var trim=texture.trim;w1=trim.x-aX*trim.width;w0=w1+texture.crop.width;h1=trim.y-aY*trim.height;h0=h1+texture.crop.height}else{w0=texture._frame.width*(1-aX);w1=texture._frame.width*-aX;h0=texture._frame.height*(1-aY);h1=texture._frame.height*-aY}var index=this.currentBatchSize*this.vertByteSize;var worldTransform=sprite.worldTransform;var a=worldTransform.a;var b=worldTransform.b;var c=worldTransform.c;var d=worldTransform.d;var tx=worldTransform.tx;var ty=worldTransform.ty;var colors=this.colors;var positions=this.positions;if(this.renderer.roundPixels){var resolution=this.renderer.resolution;positions[index]=((a*w1+c*h1+tx)*resolution|0)/resolution;positions[index+1]=((d*h1+b*w1+ty)*resolution|0)/resolution;positions[index+5]=((a*w0+c*h1+tx)*resolution|0)/resolution;positions[index+6]=((d*h1+b*w0+ty)*resolution|0)/resolution;positions[index+10]=((a*w0+c*h0+tx)*resolution|0)/resolution;positions[index+11]=((d*h0+b*w0+ty)*resolution|0)/resolution;positions[index+15]=((a*w1+c*h0+tx)*resolution|0)/resolution;positions[index+16]=((d*h0+b*w1+ty)*resolution|0)/resolution}else{positions[index]=a*w1+c*h1+tx;positions[index+1]=d*h1+b*w1+ty;positions[index+5]=a*w0+c*h1+tx;positions[index+6]=d*h1+b*w0+ty;positions[index+10]=a*w0+c*h0+tx;positions[index+11]=d*h0+b*w0+ty;positions[index+15]=a*w1+c*h0+tx;positions[index+16]=d*h0+b*w1+ty}positions[index+2]=uvs.x0;positions[index+3]=uvs.y0;positions[index+7]=uvs.x1;positions[index+8]=uvs.y1;positions[index+12]=uvs.x2;positions[index+13]=uvs.y2;positions[index+17]=uvs.x3;positions[index+18]=uvs.y3;var tint=sprite.tint;colors[index+4]=colors[index+9]=colors[index+14]=colors[index+19]=(tint>>16)+(tint&65280)+((tint&255)<<16)+(sprite.worldAlpha*255<<24);this.sprites[this.currentBatchSize++]=sprite};SpriteRenderer.prototype.flush=function(){if(this.currentBatchSize===0){return}var gl=this.renderer.gl;var shader;if(this.currentBatchSize>this.size*.5){gl.bufferSubData(gl.ARRAY_BUFFER,0,this.vertices)}else{var view=this.positions.subarray(0,this.currentBatchSize*this.vertByteSize);gl.bufferSubData(gl.ARRAY_BUFFER,0,view)}var nextTexture,nextBlendMode,nextShader;var batchSize=0;var start=0;var currentBaseTexture=null;var currentBlendMode=this.renderer.blendModeManager.currentBlendMode;var currentShader=null;var blendSwap=false;var shaderSwap=false;var sprite;for(var i=0,j=this.currentBatchSize;i0){this.context.shadowColor=style.dropShadowColor;this.context.shadowBlur=style.dropShadowBlur}else{this.context.fillStyle=style.dropShadowColor}var xShadowOffset=Math.cos(style.dropShadowAngle)*style.dropShadowDistance;var yShadowOffset=Math.sin(style.dropShadowAngle)*style.dropShadowDistance;for(i=0;ibaseline;i--){for(j=0;jwordWrapWidth){var characters=words[j].split("");for(var c=0;cspaceLeft){result+="\n"+characters[c];spaceLeft=wordWrapWidth-characterWidth}else{if(c===0){result+=" "}result+=characters[c];spaceLeft-=characterWidth}}}else{var wordWidthWithSpace=wordWidth+this.context.measureText(" ").width;if(j===0||wordWidthWithSpace>spaceLeft){if(j>0){result+="\n"}result+=words[j];spaceLeft=wordWrapWidth-wordWidth}else{spaceLeft-=wordWidthWithSpace;result+=" "+words[j]}}}if(i0&&height>0;this.width=this._frame.width=this.crop.width=width;this.height=this._frame.height=this.crop.height=height;if(updateBase){this.baseTexture.width=this.width;this.baseTexture.height=this.height}if(!this.valid){return}this.textureBuffer.resize(this.width,this.height);if(this.filterManager){this.filterManager.resize(this.width,this.height)}};RenderTexture.prototype.clear=function(){if(!this.valid){return}if(this.renderer.type===CONST.RENDERER_TYPE.WEBGL){this.renderer.gl.bindFramebuffer(this.renderer.gl.FRAMEBUFFER,this.textureBuffer.frameBuffer)}this.textureBuffer.clear()};RenderTexture.prototype.renderWebGL=function(displayObject,matrix,clear,updateTransform){if(!this.valid){return}updateTransform=updateTransform!==undefined?updateTransform:true;this.textureBuffer.transform=matrix;this.textureBuffer.activate();displayObject.worldAlpha=1;if(updateTransform){displayObject.worldTransform.identity();displayObject.currentBounds=null;var children=displayObject.children;var i,j;for(i=0,j=children.length;ithis.baseTexture.width||frame.y+frame.height>this.baseTexture.height)){throw new Error("Texture Error: frame does not fit inside the base Texture dimensions "+this)}this.valid=frame&&frame.width&&frame.height&&this.baseTexture.hasLoaded;if(this.trim){this.width=this.trim.width;this.height=this.trim.height;this._frame.width=this.trim.width;this._frame.height=this.trim.height}else{this.crop=frame}if(this.valid){this._updateUvs()}}},rotate:{get:function(){return this._rotate},set:function(rotate){this._rotate=rotate;if(this.valid){this._updateUvs()}}}});Texture.prototype.update=function(){this.baseTexture.update()};Texture.prototype.onBaseTextureLoaded=function(baseTexture){if(this.noFrame){this.frame=new math.Rectangle(0,0,baseTexture.width,baseTexture.height)}else{this.frame=this._frame}this.emit("update",this)};Texture.prototype.onBaseTextureUpdated=function(baseTexture){this._frame.width=baseTexture.width;this._frame.height=baseTexture.height;this.emit("update",this)};Texture.prototype.destroy=function(destroyBase){if(this.baseTexture){if(destroyBase){this.baseTexture.destroy()}this.baseTexture.off("update",this.onBaseTextureUpdated,this);this.baseTexture.off("loaded",this.onBaseTextureLoaded,this);this.baseTexture=null}this._frame=null;this._uvs=null;this.trim=null;this.crop=null;this.valid=false;this.off("dispose",this.dispose,this);this.off("update",this.update,this)};Texture.prototype.clone=function(){return new Texture(this.baseTexture,this.frame,this.crop,this.trim,this.rotate)};Texture.prototype._updateUvs=function(){if(!this._uvs){this._uvs=new TextureUvs}this._uvs.set(this.crop,this.baseTexture,this.rotate)};Texture.fromImage=function(imageUrl,crossorigin,scaleMode){var texture=utils.TextureCache[imageUrl];if(!texture){texture=new Texture(BaseTexture.fromImage(imageUrl,crossorigin,scaleMode));utils.TextureCache[imageUrl]=texture}return texture};Texture.fromFrame=function(frameId){var texture=utils.TextureCache[frameId];if(!texture){throw new Error('The frameId "'+frameId+'" does not exist in the texture cache')}return texture};Texture.fromCanvas=function(canvas,scaleMode){return new Texture(BaseTexture.fromCanvas(canvas,scaleMode))};Texture.fromVideo=function(video,scaleMode){if(typeof video==="string"){return Texture.fromVideoUrl(video,scaleMode)}else{return new Texture(VideoBaseTexture.fromVideo(video,scaleMode))}};Texture.fromVideoUrl=function(videoUrl,scaleMode){return new Texture(VideoBaseTexture.fromUrl(videoUrl,scaleMode))};Texture.addTextureToCache=function(texture,id){utils.TextureCache[id]=texture};Texture.removeTextureFromCache=function(id){var texture=utils.TextureCache[id];delete utils.TextureCache[id];delete utils.BaseTextureCache[id];return texture};Texture.EMPTY=new Texture(new BaseTexture)},{"../math":33,"../utils":77,"./BaseTexture":70,"./TextureUvs":73,"./VideoBaseTexture":74,eventemitter3:10}],73:[function(require,module,exports){function TextureUvs(){this.x0=0;this.y0=0;this.x1=1;this.y1=0;this.x2=1;this.y2=1;this.x3=0;this.y3=1}module.exports=TextureUvs;var GroupD8=require("../math/GroupD8");TextureUvs.prototype.set=function(frame,baseFrame,rotate){var tw=baseFrame.width;var th=baseFrame.height;if(rotate){var swapWidthHeight=GroupD8.isSwapWidthHeight(rotate);var w2=(swapWidthHeight?frame.height:frame.width)/2/tw;var h2=(swapWidthHeight?frame.width:frame.height)/2/th;var cX=frame.x/tw+w2;var cY=frame.y/th+h2;rotate=GroupD8.add(rotate,GroupD8.NW);this.x0=cX+w2*GroupD8.uX(rotate);this.y0=cY+h2*GroupD8.uY(rotate);rotate=GroupD8.add(rotate,2);this.x1=cX+w2*GroupD8.uX(rotate);this.y1=cY+h2*GroupD8.uY(rotate);rotate=GroupD8.add(rotate,2);this.x2=cX+w2*GroupD8.uX(rotate);this.y2=cY+h2*GroupD8.uY(rotate);rotate=GroupD8.add(rotate,2);this.x3=cX+w2*GroupD8.uX(rotate);this.y3=cY+h2*GroupD8.uY(rotate)}else{this.x0=frame.x/tw;this.y0=frame.y/th;this.x1=(frame.x+frame.width)/tw;this.y1=frame.y/th;this.x2=(frame.x+frame.width)/tw;this.y2=(frame.y+frame.height)/th;this.x3=frame.x/tw;this.y3=(frame.y+frame.height)/th}}},{"../math/GroupD8":30}],74:[function(require,module,exports){var BaseTexture=require("./BaseTexture"),utils=require("../utils");function VideoBaseTexture(source,scaleMode){if(!source){throw new Error("No video source element specified.")}if((source.readyState===source.HAVE_ENOUGH_DATA||source.readyState===source.HAVE_FUTURE_DATA)&&source.width&&source.height){source.complete=true}BaseTexture.call(this,source,scaleMode);this.autoUpdate=false;this._onUpdate=this._onUpdate.bind(this);this._onCanPlay=this._onCanPlay.bind(this);if(!source.complete){source.addEventListener("canplay",this._onCanPlay);source.addEventListener("canplaythrough",this._onCanPlay);source.addEventListener("play",this._onPlayStart.bind(this));source.addEventListener("pause",this._onPlayStop.bind(this))}this.__loaded=false}VideoBaseTexture.prototype=Object.create(BaseTexture.prototype);VideoBaseTexture.prototype.constructor=VideoBaseTexture;module.exports=VideoBaseTexture;VideoBaseTexture.prototype._onUpdate=function(){if(this.autoUpdate){window.requestAnimationFrame(this._onUpdate);this.update()}};VideoBaseTexture.prototype._onPlayStart=function(){if(!this.autoUpdate){window.requestAnimationFrame(this._onUpdate);this.autoUpdate=true}};VideoBaseTexture.prototype._onPlayStop=function(){this.autoUpdate=false};VideoBaseTexture.prototype._onCanPlay=function(){this.hasLoaded=true;if(this.source){this.source.removeEventListener("canplay",this._onCanPlay);this.source.removeEventListener("canplaythrough",this._onCanPlay);this.width=this.source.videoWidth;this.height=this.source.videoHeight;this.source.play();if(!this.__loaded){this.__loaded=true;this.emit("loaded",this)}}};VideoBaseTexture.prototype.destroy=function(){if(this.source&&this.source._pixiId){delete utils.BaseTextureCache[this.source._pixiId];delete this.source._pixiId}BaseTexture.prototype.destroy.call(this)};VideoBaseTexture.fromVideo=function(video,scaleMode){if(!video._pixiId){video._pixiId="video_"+utils.uid()}var baseTexture=utils.BaseTextureCache[video._pixiId];if(!baseTexture){baseTexture=new VideoBaseTexture(video,scaleMode);utils.BaseTextureCache[video._pixiId]=baseTexture}return baseTexture};VideoBaseTexture.fromUrl=function(videoSrc,scaleMode){var video=document.createElement("video");if(Array.isArray(videoSrc)){for(var i=0;ithis._maxElapsedMS){elapsedMS=this._maxElapsedMS}this.deltaTime=elapsedMS*CONST.TARGET_FPMS*this.speed;this._emitter.emit(TICK,this.deltaTime);this.lastTime=currentTime};module.exports=Ticker},{"../const":22,eventemitter3:10}],76:[function(require,module,exports){var Ticker=require("./Ticker");var shared=new Ticker;shared.autoStart=true;module.exports={shared:shared,Ticker:Ticker}},{"./Ticker":75}],77:[function(require,module,exports){var CONST=require("../const");var utils=module.exports={_uid:0,_saidHello:false,EventEmitter:require("eventemitter3"),pluginTarget:require("./pluginTarget"),async:require("async"),uid:function(){return++utils._uid},hex2rgb:function(hex,out){out=out||[];out[0]=(hex>>16&255)/255;out[1]=(hex>>8&255)/255;out[2]=(hex&255)/255;return out},hex2string:function(hex){hex=hex.toString(16);hex="000000".substr(0,6-hex.length)+hex;return"#"+hex},rgb2hex:function(rgb){return(rgb[0]*255<<16)+(rgb[1]*255<<8)+rgb[2]*255},canUseNewCanvasBlendModes:function(){if(typeof document==="undefined"){return false}var pngHead="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAQAAAABAQMAAADD8p2OAAAAA1BMVEX/";var pngEnd="AAAACklEQVQI12NgAAAAAgAB4iG8MwAAAABJRU5ErkJggg==";var magenta=new Image;magenta.src=pngHead+"AP804Oa6"+pngEnd;var yellow=new Image;yellow.src=pngHead+"/wCKxvRF"+pngEnd;var canvas=document.createElement("canvas");canvas.width=6;canvas.height=1;var context=canvas.getContext("2d");context.globalCompositeOperation="multiply";context.drawImage(magenta,0,0);context.drawImage(yellow,2,0);var data=context.getImageData(2,0,1,1).data;return data[0]===255&&data[1]===0&&data[2]===0},getNextPowerOfTwo:function(number){if(number>0&&(number&number-1)===0){return number}else{var result=1;while(result0&&(width&width-1)===0&&height>0&&(height&height-1)===0},getResolutionOfUrl:function(url){var resolution=CONST.RETINA_PREFIX.exec(url);if(resolution){return parseFloat(resolution[1])}return 1},sayHello:function(type){if(utils._saidHello){return}if(navigator.userAgent.toLowerCase().indexOf("chrome")>-1){var args=["\n %c %c %c Pixi.js "+CONST.VERSION+" - ✰ "+type+" ✰ %c "+" %c "+" http://www.pixijs.com/ %c %c ♥%c♥%c♥ \n\n","background: #ff66a5; padding:5px 0;","background: #ff66a5; padding:5px 0;","color: #ff66a5; background: #030307; padding:5px 0;","background: #ff66a5; padding:5px 0;","background: #ffc3dc; padding:5px 0;","background: #ff66a5; padding:5px 0;","color: #ff2424; background: #fff; padding:5px 0;","color: #ff2424; background: #fff; padding:5px 0;","color: #ff2424; background: #fff; padding:5px 0;"];window.console.log.apply(console,args)}else if(window.console){window.console.log("Pixi.js "+CONST.VERSION+" - "+type+" - http://www.pixijs.com/")}utils._saidHello=true},isWebGLSupported:function(){var contextOptions={stencil:true};try{if(!window.WebGLRenderingContext){return false}var canvas=document.createElement("canvas"),gl=canvas.getContext("webgl",contextOptions)||canvas.getContext("experimental-webgl",contextOptions);return!!(gl&&gl.getContextAttributes().stencil)}catch(e){return false}},sign:function(n){return n?n<0?-1:1:0},removeItems:function(arr,startIdx,removeCount){var length=arr.length;if(startIdx>=length||removeCount===0){return}removeCount=startIdx+removeCount>length?length-startIdx:removeCount;for(var i=startIdx,len=length-removeCount;i=0?value:16777215;this.dirty=true}},align:{get:function(){return this._font.align},set:function(value){this._font.align=value||"left";this.dirty=true}},font:{get:function(){return this._font},set:function(value){if(!value){return}if(typeof value==="string"){value=value.split(" ");this._font.name=value.length===1?value[0]:value.slice(1).join(" ");this._font.size=value.length>=2?parseInt(value[0],10):BitmapText.fonts[this._font.name].size}else{this._font.name=value.name;this._font.size=typeof value.size==="number"?value.size:parseInt(value.size,10)}this.dirty=true}},text:{get:function(){return this._text},set:function(value){value=value.toString()||" ";if(this._text===value){return}this._text=value;this.dirty=true}}});BitmapText.prototype.updateText=function(){var data=BitmapText.fonts[this._font.name];var pos=new core.Point;var prevCharCode=null;var chars=[];var lastLineWidth=0;var maxLineWidth=0;var lineWidths=[];var line=0;var scale=this._font.size/data.size;var lastSpace=-1;var maxLineHeight=0;for(var i=0;i0&&pos.x*scale>this.maxWidth){core.utils.removeItems(chars,lastSpace,i-lastSpace);i=lastSpace;lastSpace=-1;lineWidths.push(lastLineWidth);maxLineWidth=Math.max(maxLineWidth,lastLineWidth);line++;pos.x=0;pos.y+=data.lineHeight;prevCharCode=null;continue}var charData=data.chars[charCode];if(!charData){continue}if(prevCharCode&&charData.kerning[prevCharCode]){pos.x+=charData.kerning[prevCharCode]}chars.push({texture:charData.texture,line:line,charCode:charCode,position:new core.Point(pos.x+charData.xOffset,pos.y+charData.yOffset)});lastLineWidth=pos.x+(charData.texture.width+charData.xOffset);pos.x+=charData.xAdvance;maxLineHeight=Math.max(maxLineHeight,charData.yOffset+charData.texture.height);prevCharCode=charCode}lineWidths.push(lastLineWidth);maxLineWidth=Math.max(maxLineWidth,lastLineWidth);var lineAlignOffsets=[];for(i=0;i<=line;i++){var alignOffset=0;if(this._font.align==="right"){alignOffset=maxLineWidth-lineWidths[i]}else if(this._font.align==="center"){alignOffset=(maxLineWidth-lineWidths[i])/2}lineAlignOffsets.push(alignOffset)}var lenChars=chars.length;var tint=this.tint;for(i=0;i=this._durations[this.currentFrame]){lag-=this._durations[this.currentFrame]*sign;this._currentTime+=sign}this._currentTime+=lag/this._durations[this.currentFrame]}else{this._currentTime+=elapsed}if(this._currentTime<0&&!this.loop){this.gotoAndStop(0);if(this.onComplete){this.onComplete()}}else if(this._currentTime>=this._textures.length&&!this.loop){this.gotoAndStop(this._textures.length-1);if(this.onComplete){this.onComplete()}}else{this._texture=this._textures[this.currentFrame]}};MovieClip.prototype.destroy=function(){this.stop();core.Sprite.prototype.destroy.call(this)};MovieClip.fromFrames=function(frames){var textures=[];for(var i=0;imaxX?x2:maxX;maxX=x3>maxX?x3:maxX;maxX=x4>maxX?x4:maxX;maxY=y1;maxY=y2>maxY?y2:maxY;maxY=y3>maxY?y3:maxY;maxY=y4>maxY?y4:maxY;var bounds=this._bounds;bounds.x=minX;bounds.width=maxX-minX;bounds.y=minY;bounds.height=maxY-minY;this._currentBounds=bounds;return bounds};TilingSprite.prototype.containsPoint=function(point){this.worldTransform.applyInverse(point,tempPoint);var width=this._width;var height=this._height;var x1=-width*this.anchor.x;var y1;if(tempPoint.x>x1&&tempPoint.xy1&&tempPoint.y 0.2) n = 65600.0; // :\n if (gray > 0.3) n = 332772.0; // *\n if (gray > 0.4) n = 15255086.0; // o\n if (gray > 0.5) n = 23385164.0; // &\n if (gray > 0.6) n = 15252014.0; // 8\n if (gray > 0.7) n = 13199452.0; // @\n if (gray > 0.8) n = 11512810.0; // #\n\n vec2 p = mod( uv / ( pixelSize * 0.5 ), 2.0) - vec2(1.0);\n col = col * character(n, p);\n\n gl_FragColor = vec4(col, 1.0);\n}\n",{dimensions:{type:"4fv",value:new Float32Array([0,0,0,0])},pixelSize:{type:"1f",value:8}})}AsciiFilter.prototype=Object.create(core.AbstractFilter.prototype);AsciiFilter.prototype.constructor=AsciiFilter;module.exports=AsciiFilter;Object.defineProperties(AsciiFilter.prototype,{size:{get:function(){return this.uniforms.pixelSize.value},set:function(value){this.uniforms.pixelSize.value=value}}})},{"../../core":29}],88:[function(require,module,exports){var core=require("../../core"),BlurXFilter=require("../blur/BlurXFilter"),BlurYFilter=require("../blur/BlurYFilter");function BloomFilter(){core.AbstractFilter.call(this);this.blurXFilter=new BlurXFilter;this.blurYFilter=new BlurYFilter;this.defaultFilter=new core.AbstractFilter}BloomFilter.prototype=Object.create(core.AbstractFilter.prototype);BloomFilter.prototype.constructor=BloomFilter;module.exports=BloomFilter;BloomFilter.prototype.applyFilter=function(renderer,input,output){var renderTarget=renderer.filterManager.getRenderTarget(true);this.defaultFilter.applyFilter(renderer,input,output);this.blurXFilter.applyFilter(renderer,input,renderTarget);renderer.blendModeManager.setBlendMode(core.BLEND_MODES.SCREEN);this.blurYFilter.applyFilter(renderer,renderTarget,output);renderer.blendModeManager.setBlendMode(core.BLEND_MODES.NORMAL);renderer.filterManager.returnRenderTarget(renderTarget)};Object.defineProperties(BloomFilter.prototype,{blur:{get:function(){return this.blurXFilter.blur},set:function(value){this.blurXFilter.blur=this.blurYFilter.blur=value}},blurX:{get:function(){return this.blurXFilter.blur},set:function(value){this.blurXFilter.blur=value}},blurY:{get:function(){return this.blurYFilter.blur},set:function(value){this.blurYFilter.blur=value}}})},{"../../core":29,"../blur/BlurXFilter":91,"../blur/BlurYFilter":92}],89:[function(require,module,exports){var core=require("../../core");function BlurDirFilter(dirX,dirY){core.AbstractFilter.call(this,"attribute vec2 aVertexPosition;\nattribute vec2 aTextureCoord;\nattribute vec4 aColor;\n\nuniform float strength;\nuniform float dirX;\nuniform float dirY;\nuniform mat3 projectionMatrix;\n\nvarying vec2 vTextureCoord;\nvarying vec4 vColor;\nvarying vec2 vBlurTexCoords[3];\n\nvoid main(void)\n{\n gl_Position = vec4((projectionMatrix * vec3((aVertexPosition), 1.0)).xy, 0.0, 1.0);\n vTextureCoord = aTextureCoord;\n\n vBlurTexCoords[0] = aTextureCoord + vec2( (0.004 * strength) * dirX, (0.004 * strength) * dirY );\n vBlurTexCoords[1] = aTextureCoord + vec2( (0.008 * strength) * dirX, (0.008 * strength) * dirY );\n vBlurTexCoords[2] = aTextureCoord + vec2( (0.012 * strength) * dirX, (0.012 * strength) * dirY );\n\n vColor = vec4(aColor.rgb * aColor.a, aColor.a);\n}\n","precision lowp float;\n\nvarying vec2 vTextureCoord;\nvarying vec2 vBlurTexCoords[3];\nvarying vec4 vColor;\n\nuniform sampler2D uSampler;\n\nvoid main(void)\n{\n gl_FragColor = vec4(0.0);\n\n gl_FragColor += texture2D(uSampler, vTextureCoord ) * 0.3989422804014327;\n gl_FragColor += texture2D(uSampler, vBlurTexCoords[ 0]) * 0.2419707245191454;\n gl_FragColor += texture2D(uSampler, vBlurTexCoords[ 1]) * 0.05399096651318985;\n gl_FragColor += texture2D(uSampler, vBlurTexCoords[ 2]) * 0.004431848411938341;\n}\n",{strength:{type:"1f",value:1},dirX:{type:"1f",value:dirX||0},dirY:{type:"1f",value:dirY||0}});this.defaultFilter=new core.AbstractFilter;this.passes=1;this.dirX=dirX||0;this.dirY=dirY||0;this.strength=4}BlurDirFilter.prototype=Object.create(core.AbstractFilter.prototype);BlurDirFilter.prototype.constructor=BlurDirFilter;module.exports=BlurDirFilter;BlurDirFilter.prototype.applyFilter=function(renderer,input,output,clear){var shader=this.getShader(renderer);this.uniforms.strength.value=this.strength/4/this.passes*(input.frame.width/input.size.width);if(this.passes===1){renderer.filterManager.applyFilter(shader,input,output,clear)}else{var renderTarget=renderer.filterManager.getRenderTarget(true);renderer.filterManager.applyFilter(shader,input,renderTarget,clear);for(var i=0;i>16&255)/255;var lG=(lightColor>>8&255)/255;var lB=(lightColor&255)/255;var dR=(darkColor>>16&255)/255;var dG=(darkColor>>8&255)/255;var dB=(darkColor&255)/255;var matrix=[.3,.59,.11,0,0,lR,lG,lB,desaturation,0,dR,dG,dB,toned,0,lR-dR,lG-dG,lB-dB,0,0];this._loadMatrix(matrix,multiply)};ColorMatrixFilter.prototype.night=function(intensity,multiply){intensity=intensity||.1;var matrix=[intensity*-2,-intensity,0,0,0,-intensity,0,intensity,0,0,0,intensity,intensity*2,0,0,0,0,0,1,0];this._loadMatrix(matrix,multiply)};ColorMatrixFilter.prototype.predator=function(amount,multiply){var matrix=[11.224130630493164*amount,-4.794486999511719*amount,-2.8746118545532227*amount,0*amount,.40342438220977783*amount,-3.6330697536468506*amount,9.193157196044922*amount,-2.951810836791992*amount,0*amount,-1.316135048866272*amount,-3.2184197902679443*amount,-4.2375030517578125*amount,7.476448059082031*amount,0*amount,.8044459223747253*amount,0,0,0,1,0];this._loadMatrix(matrix,multiply)};ColorMatrixFilter.prototype.lsd=function(multiply){var matrix=[2,-.4,.5,0,0,-.5,2,-.4,0,0,-.4,-.5,3,0,0,0,0,0,1,0];this._loadMatrix(matrix,multiply)};ColorMatrixFilter.prototype.reset=function(){var matrix=[1,0,0,0,0,0,1,0,0,0,0,0,1,0,0,0,0,0,1,0];this._loadMatrix(matrix,false)};Object.defineProperties(ColorMatrixFilter.prototype,{matrix:{get:function(){return this.uniforms.m.value},set:function(value){this.uniforms.m.value=value}}})},{"../../core":29}],95:[function(require,module,exports){var core=require("../../core");function ColorStepFilter(){core.AbstractFilter.call(this,null,"precision mediump float;\n\nvarying vec2 vTextureCoord;\n\nuniform sampler2D uSampler;\nuniform float step;\n\nvoid main(void)\n{\n vec4 color = texture2D(uSampler, vTextureCoord);\n\n color = floor(color * step) / step;\n\n gl_FragColor = color;\n}\n",{step:{type:"1f",value:5}})}ColorStepFilter.prototype=Object.create(core.AbstractFilter.prototype);ColorStepFilter.prototype.constructor=ColorStepFilter;module.exports=ColorStepFilter;Object.defineProperties(ColorStepFilter.prototype,{step:{get:function(){return this.uniforms.step.value},set:function(value){this.uniforms.step.value=value}}})},{"../../core":29}],96:[function(require,module,exports){var core=require("../../core");function ConvolutionFilter(matrix,width,height){core.AbstractFilter.call(this,null,"precision mediump float;\n\nvarying mediump vec2 vTextureCoord;\n\nuniform sampler2D uSampler;\nuniform vec2 texelSize;\nuniform float matrix[9];\n\nvoid main(void)\n{\n vec4 c11 = texture2D(uSampler, vTextureCoord - texelSize); // top left\n vec4 c12 = texture2D(uSampler, vec2(vTextureCoord.x, vTextureCoord.y - texelSize.y)); // top center\n vec4 c13 = texture2D(uSampler, vec2(vTextureCoord.x + texelSize.x, vTextureCoord.y - texelSize.y)); // top right\n\n vec4 c21 = texture2D(uSampler, vec2(vTextureCoord.x - texelSize.x, vTextureCoord.y)); // mid left\n vec4 c22 = texture2D(uSampler, vTextureCoord); // mid center\n vec4 c23 = texture2D(uSampler, vec2(vTextureCoord.x + texelSize.x, vTextureCoord.y)); // mid right\n\n vec4 c31 = texture2D(uSampler, vec2(vTextureCoord.x - texelSize.x, vTextureCoord.y + texelSize.y)); // bottom left\n vec4 c32 = texture2D(uSampler, vec2(vTextureCoord.x, vTextureCoord.y + texelSize.y)); // bottom center\n vec4 c33 = texture2D(uSampler, vTextureCoord + texelSize); // bottom right\n\n gl_FragColor =\n c11 * matrix[0] + c12 * matrix[1] + c13 * matrix[2] +\n c21 * matrix[3] + c22 * matrix[4] + c23 * matrix[5] +\n c31 * matrix[6] + c32 * matrix[7] + c33 * matrix[8];\n\n gl_FragColor.a = c22.a;\n}\n",{matrix:{type:"1fv",value:new Float32Array(matrix)},texelSize:{type:"v2",value:{x:1/width,y:1/height}}})}ConvolutionFilter.prototype=Object.create(core.AbstractFilter.prototype);ConvolutionFilter.prototype.constructor=ConvolutionFilter;module.exports=ConvolutionFilter;Object.defineProperties(ConvolutionFilter.prototype,{matrix:{get:function(){return this.uniforms.matrix.value},set:function(value){this.uniforms.matrix.value=new Float32Array(value)}},width:{get:function(){return 1/this.uniforms.texelSize.value.x},set:function(value){this.uniforms.texelSize.value.x=1/value}},height:{get:function(){return 1/this.uniforms.texelSize.value.y},set:function(value){this.uniforms.texelSize.value.y=1/value}}})},{"../../core":29}],97:[function(require,module,exports){var core=require("../../core");function CrossHatchFilter(){core.AbstractFilter.call(this,null,"precision mediump float;\n\nvarying vec2 vTextureCoord;\n\nuniform sampler2D uSampler;\n\nvoid main(void)\n{\n float lum = length(texture2D(uSampler, vTextureCoord.xy).rgb);\n\n gl_FragColor = vec4(1.0, 1.0, 1.0, 1.0);\n\n if (lum < 1.00)\n {\n if (mod(gl_FragCoord.x + gl_FragCoord.y, 10.0) == 0.0)\n {\n gl_FragColor = vec4(0.0, 0.0, 0.0, 1.0);\n }\n }\n\n if (lum < 0.75)\n {\n if (mod(gl_FragCoord.x - gl_FragCoord.y, 10.0) == 0.0)\n {\n gl_FragColor = vec4(0.0, 0.0, 0.0, 1.0);\n }\n }\n\n if (lum < 0.50)\n {\n if (mod(gl_FragCoord.x + gl_FragCoord.y - 5.0, 10.0) == 0.0)\n {\n gl_FragColor = vec4(0.0, 0.0, 0.0, 1.0);\n }\n }\n\n if (lum < 0.3)\n {\n if (mod(gl_FragCoord.x - gl_FragCoord.y - 5.0, 10.0) == 0.0)\n {\n gl_FragColor = vec4(0.0, 0.0, 0.0, 1.0);\n }\n }\n}\n")}CrossHatchFilter.prototype=Object.create(core.AbstractFilter.prototype);CrossHatchFilter.prototype.constructor=CrossHatchFilter;module.exports=CrossHatchFilter},{"../../core":29}],98:[function(require,module,exports){var core=require("../../core");function DisplacementFilter(sprite,scale){var maskMatrix=new core.Matrix;sprite.renderable=false;core.AbstractFilter.call(this,"attribute vec2 aVertexPosition;\nattribute vec2 aTextureCoord;\nattribute vec4 aColor;\n\nuniform mat3 projectionMatrix;\nuniform mat3 otherMatrix;\n\nvarying vec2 vMapCoord;\nvarying vec2 vTextureCoord;\nvarying vec4 vColor;\n\nvoid main(void)\n{\n gl_Position = vec4((projectionMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);\n vTextureCoord = aTextureCoord;\n vMapCoord = ( otherMatrix * vec3( aTextureCoord, 1.0) ).xy;\n vColor = vec4(aColor.rgb * aColor.a, aColor.a);\n}\n","precision mediump float;\n\nvarying vec2 vMapCoord;\nvarying vec2 vTextureCoord;\nvarying vec4 vColor;\n\nuniform vec2 scale;\n\nuniform sampler2D uSampler;\nuniform sampler2D mapSampler;\n\nvoid main(void)\n{\n vec4 map = texture2D(mapSampler, vMapCoord);\n\n map -= 0.5;\n map.xy *= scale;\n\n gl_FragColor = texture2D(uSampler, vec2(vTextureCoord.x + map.x, vTextureCoord.y + map.y));\n}\n",{mapSampler:{type:"sampler2D",value:sprite.texture},otherMatrix:{type:"mat3",value:maskMatrix.toArray(true)},scale:{type:"v2",value:{x:1,y:1}}});this.maskSprite=sprite;this.maskMatrix=maskMatrix;if(scale===null||scale===undefined){scale=20}this.scale=new core.Point(scale,scale)}DisplacementFilter.prototype=Object.create(core.AbstractFilter.prototype);DisplacementFilter.prototype.constructor=DisplacementFilter;module.exports=DisplacementFilter;DisplacementFilter.prototype.applyFilter=function(renderer,input,output){var filterManager=renderer.filterManager;filterManager.calculateMappedMatrix(input.frame,this.maskSprite,this.maskMatrix);this.uniforms.otherMatrix.value=this.maskMatrix.toArray(true);this.uniforms.scale.value.x=this.scale.x*(1/input.frame.width);this.uniforms.scale.value.y=this.scale.y*(1/input.frame.height);var shader=this.getShader(renderer);filterManager.applyFilter(shader,input,output)};Object.defineProperties(DisplacementFilter.prototype,{map:{get:function(){return this.uniforms.mapSampler.value},set:function(value){this.uniforms.mapSampler.value=value}}})},{"../../core":29}],99:[function(require,module,exports){var core=require("../../core");function DotScreenFilter(){core.AbstractFilter.call(this,null,"precision mediump float;\n\nvarying vec2 vTextureCoord;\nvarying vec4 vColor;\n\nuniform vec4 dimensions;\nuniform sampler2D uSampler;\n\nuniform float angle;\nuniform float scale;\n\nfloat pattern()\n{\n float s = sin(angle), c = cos(angle);\n vec2 tex = vTextureCoord * dimensions.xy;\n vec2 point = vec2(\n c * tex.x - s * tex.y,\n s * tex.x + c * tex.y\n ) * scale;\n return (sin(point.x) * sin(point.y)) * 4.0;\n}\n\nvoid main()\n{\n vec4 color = texture2D(uSampler, vTextureCoord);\n float average = (color.r + color.g + color.b) / 3.0;\n gl_FragColor = vec4(vec3(average * 10.0 - 5.0 + pattern()), color.a);\n}\n",{scale:{type:"1f",value:1},angle:{type:"1f",value:5},dimensions:{type:"4fv",value:[0,0,0,0]}})}DotScreenFilter.prototype=Object.create(core.AbstractFilter.prototype);DotScreenFilter.prototype.constructor=DotScreenFilter;module.exports=DotScreenFilter;Object.defineProperties(DotScreenFilter.prototype,{scale:{get:function(){return this.uniforms.scale.value},set:function(value){this.uniforms.scale.value=value}},angle:{get:function(){return this.uniforms.angle.value},set:function(value){this.uniforms.angle.value=value}}})},{"../../core":29}],100:[function(require,module,exports){var core=require("../../core");function BlurYTintFilter(){core.AbstractFilter.call(this,"attribute vec2 aVertexPosition;\nattribute vec2 aTextureCoord;\nattribute vec4 aColor;\n\nuniform float strength;\nuniform vec2 offset;\n\nuniform mat3 projectionMatrix;\n\nvarying vec2 vTextureCoord;\nvarying vec4 vColor;\nvarying vec2 vBlurTexCoords[6];\n\nvoid main(void)\n{\n gl_Position = vec4((projectionMatrix * vec3((aVertexPosition+offset), 1.0)).xy, 0.0, 1.0);\n vTextureCoord = aTextureCoord;\n\n vBlurTexCoords[ 0] = aTextureCoord + vec2(0.0, -0.012 * strength);\n vBlurTexCoords[ 1] = aTextureCoord + vec2(0.0, -0.008 * strength);\n vBlurTexCoords[ 2] = aTextureCoord + vec2(0.0, -0.004 * strength);\n vBlurTexCoords[ 3] = aTextureCoord + vec2(0.0, 0.004 * strength);\n vBlurTexCoords[ 4] = aTextureCoord + vec2(0.0, 0.008 * strength);\n vBlurTexCoords[ 5] = aTextureCoord + vec2(0.0, 0.012 * strength);\n\n vColor = vec4(aColor.rgb * aColor.a, aColor.a);\n}\n","precision lowp float;\n\nvarying vec2 vTextureCoord;\nvarying vec2 vBlurTexCoords[6];\nvarying vec4 vColor;\n\nuniform vec3 color;\nuniform float alpha;\n\nuniform sampler2D uSampler;\n\nvoid main(void)\n{\n vec4 sum = vec4(0.0);\n\n sum += texture2D(uSampler, vBlurTexCoords[ 0])*0.004431848411938341;\n sum += texture2D(uSampler, vBlurTexCoords[ 1])*0.05399096651318985;\n sum += texture2D(uSampler, vBlurTexCoords[ 2])*0.2419707245191454;\n sum += texture2D(uSampler, vTextureCoord )*0.3989422804014327;\n sum += texture2D(uSampler, vBlurTexCoords[ 3])*0.2419707245191454;\n sum += texture2D(uSampler, vBlurTexCoords[ 4])*0.05399096651318985;\n sum += texture2D(uSampler, vBlurTexCoords[ 5])*0.004431848411938341;\n\n gl_FragColor = vec4( color.rgb * sum.a * alpha, sum.a * alpha );\n}\n",{blur:{type:"1f",value:1/512},color:{type:"c",value:[0,0,0]},alpha:{type:"1f",value:.7},offset:{type:"2f",value:[5,5]},strength:{type:"1f",value:1}});this.passes=1;this.strength=4}BlurYTintFilter.prototype=Object.create(core.AbstractFilter.prototype);BlurYTintFilter.prototype.constructor=BlurYTintFilter;module.exports=BlurYTintFilter;BlurYTintFilter.prototype.applyFilter=function(renderer,input,output,clear){var shader=this.getShader(renderer);this.uniforms.strength.value=this.strength/4/this.passes*(input.frame.height/input.size.height);if(this.passes===1){renderer.filterManager.applyFilter(shader,input,output,clear)}else{var renderTarget=renderer.filterManager.getRenderTarget(true);var flip=input;var flop=renderTarget;for(var i=0;i= (time - params.z)) )\n {\n float diff = (dist - time);\n float powDiff = 1.0 - pow(abs(diff*params.x), params.y);\n\n float diffTime = diff * powDiff;\n vec2 diffUV = normalize(uv - center);\n texCoord = uv + (diffUV * diffTime);\n }\n\n gl_FragColor = texture2D(uSampler, texCoord);\n}\n",{center:{type:"v2",value:{x:.5,y:.5}},params:{type:"v3",value:{x:10,y:.8,z:.1}},time:{type:"1f",value:0}})}ShockwaveFilter.prototype=Object.create(core.AbstractFilter.prototype);ShockwaveFilter.prototype.constructor=ShockwaveFilter;module.exports=ShockwaveFilter;Object.defineProperties(ShockwaveFilter.prototype,{center:{get:function(){return this.uniforms.center.value},set:function(value){this.uniforms.center.value=value}},params:{get:function(){return this.uniforms.params.value},set:function(value){this.uniforms.params.value=value}},time:{get:function(){return this.uniforms.time.value},set:function(value){this.uniforms.time.value=value}}})},{"../../core":29}],110:[function(require,module,exports){var core=require("../../core");function TiltShiftAxisFilter(){core.AbstractFilter.call(this,null,"precision mediump float;\n\nvarying vec2 vTextureCoord;\n\nuniform sampler2D uSampler;\nuniform float blur;\nuniform float gradientBlur;\nuniform vec2 start;\nuniform vec2 end;\nuniform vec2 delta;\nuniform vec2 texSize;\n\nfloat random(vec3 scale, float seed)\n{\n return fract(sin(dot(gl_FragCoord.xyz + seed, scale)) * 43758.5453 + seed);\n}\n\nvoid main(void)\n{\n vec4 color = vec4(0.0);\n float total = 0.0;\n\n float offset = random(vec3(12.9898, 78.233, 151.7182), 0.0);\n vec2 normal = normalize(vec2(start.y - end.y, end.x - start.x));\n float radius = smoothstep(0.0, 1.0, abs(dot(vTextureCoord * texSize - start, normal)) / gradientBlur) * blur;\n\n for (float t = -30.0; t <= 30.0; t++)\n {\n float percent = (t + offset - 0.5) / 30.0;\n float weight = 1.0 - abs(percent);\n vec4 sample = texture2D(uSampler, vTextureCoord + delta / texSize * percent * radius);\n sample.rgb *= sample.a;\n color += sample * weight;\n total += weight;\n }\n\n gl_FragColor = color / total;\n gl_FragColor.rgb /= gl_FragColor.a + 0.00001;\n}\n",{blur:{type:"1f",value:100},gradientBlur:{type:"1f",value:600},start:{type:"v2",value:{x:0,y:window.innerHeight/2}},end:{type:"v2",value:{x:600,y:window.innerHeight/2}},delta:{type:"v2",value:{x:30,y:30}},texSize:{type:"v2",value:{x:window.innerWidth,y:window.innerHeight}}});this.updateDelta()}TiltShiftAxisFilter.prototype=Object.create(core.AbstractFilter.prototype);TiltShiftAxisFilter.prototype.constructor=TiltShiftAxisFilter;module.exports=TiltShiftAxisFilter;TiltShiftAxisFilter.prototype.updateDelta=function(){this.uniforms.delta.value.x=0;this.uniforms.delta.value.y=0};Object.defineProperties(TiltShiftAxisFilter.prototype,{blur:{get:function(){return this.uniforms.blur.value},set:function(value){this.uniforms.blur.value=value}},gradientBlur:{get:function(){return this.uniforms.gradientBlur.value},set:function(value){this.uniforms.gradientBlur.value=value}},start:{get:function(){return this.uniforms.start.value},set:function(value){this.uniforms.start.value=value;this.updateDelta()}},end:{get:function(){return this.uniforms.end.value},set:function(value){this.uniforms.end.value=value;this.updateDelta()}}})},{"../../core":29}],111:[function(require,module,exports){var core=require("../../core"),TiltShiftXFilter=require("./TiltShiftXFilter"),TiltShiftYFilter=require("./TiltShiftYFilter");function TiltShiftFilter(){core.AbstractFilter.call(this);this.tiltShiftXFilter=new TiltShiftXFilter;this.tiltShiftYFilter=new TiltShiftYFilter}TiltShiftFilter.prototype=Object.create(core.AbstractFilter.prototype);TiltShiftFilter.prototype.constructor=TiltShiftFilter;module.exports=TiltShiftFilter;TiltShiftFilter.prototype.applyFilter=function(renderer,input,output){ var renderTarget=renderer.filterManager.getRenderTarget(true);this.tiltShiftXFilter.applyFilter(renderer,input,renderTarget);this.tiltShiftYFilter.applyFilter(renderer,renderTarget,output);renderer.filterManager.returnRenderTarget(renderTarget)};Object.defineProperties(TiltShiftFilter.prototype,{blur:{get:function(){return this.tiltShiftXFilter.blur},set:function(value){this.tiltShiftXFilter.blur=this.tiltShiftYFilter.blur=value}},gradientBlur:{get:function(){return this.tiltShiftXFilter.gradientBlur},set:function(value){this.tiltShiftXFilter.gradientBlur=this.tiltShiftYFilter.gradientBlur=value}},start:{get:function(){return this.tiltShiftXFilter.start},set:function(value){this.tiltShiftXFilter.start=this.tiltShiftYFilter.start=value}},end:{get:function(){return this.tiltShiftXFilter.end},set:function(value){this.tiltShiftXFilter.end=this.tiltShiftYFilter.end=value}}})},{"../../core":29,"./TiltShiftXFilter":112,"./TiltShiftYFilter":113}],112:[function(require,module,exports){var TiltShiftAxisFilter=require("./TiltShiftAxisFilter");function TiltShiftXFilter(){TiltShiftAxisFilter.call(this)}TiltShiftXFilter.prototype=Object.create(TiltShiftAxisFilter.prototype);TiltShiftXFilter.prototype.constructor=TiltShiftXFilter;module.exports=TiltShiftXFilter;TiltShiftXFilter.prototype.updateDelta=function(){var dx=this.uniforms.end.value.x-this.uniforms.start.value.x;var dy=this.uniforms.end.value.y-this.uniforms.start.value.y;var d=Math.sqrt(dx*dx+dy*dy);this.uniforms.delta.value.x=dx/d;this.uniforms.delta.value.y=dy/d}},{"./TiltShiftAxisFilter":110}],113:[function(require,module,exports){var TiltShiftAxisFilter=require("./TiltShiftAxisFilter");function TiltShiftYFilter(){TiltShiftAxisFilter.call(this)}TiltShiftYFilter.prototype=Object.create(TiltShiftAxisFilter.prototype);TiltShiftYFilter.prototype.constructor=TiltShiftYFilter;module.exports=TiltShiftYFilter;TiltShiftYFilter.prototype.updateDelta=function(){var dx=this.uniforms.end.value.x-this.uniforms.start.value.x;var dy=this.uniforms.end.value.y-this.uniforms.start.value.y;var d=Math.sqrt(dx*dx+dy*dy);this.uniforms.delta.value.x=-dy/d;this.uniforms.delta.value.y=dx/d}},{"./TiltShiftAxisFilter":110}],114:[function(require,module,exports){var core=require("../../core");function TwistFilter(){core.AbstractFilter.call(this,null,"precision mediump float;\n\nvarying vec2 vTextureCoord;\n\nuniform sampler2D uSampler;\nuniform float radius;\nuniform float angle;\nuniform vec2 offset;\n\nvoid main(void)\n{\n vec2 coord = vTextureCoord - offset;\n float dist = length(coord);\n\n if (dist < radius)\n {\n float ratio = (radius - dist) / radius;\n float angleMod = ratio * ratio * angle;\n float s = sin(angleMod);\n float c = cos(angleMod);\n coord = vec2(coord.x * c - coord.y * s, coord.x * s + coord.y * c);\n }\n\n gl_FragColor = texture2D(uSampler, coord+offset);\n}\n",{radius:{type:"1f",value:.5},angle:{type:"1f",value:5},offset:{type:"v2",value:{x:.5,y:.5}}})}TwistFilter.prototype=Object.create(core.AbstractFilter.prototype);TwistFilter.prototype.constructor=TwistFilter;module.exports=TwistFilter;Object.defineProperties(TwistFilter.prototype,{offset:{get:function(){return this.uniforms.offset.value},set:function(value){this.uniforms.offset.value=value}},radius:{get:function(){return this.uniforms.radius.value},set:function(value){this.uniforms.radius.value=value}},angle:{get:function(){return this.uniforms.angle.value},set:function(value){this.uniforms.angle.value=value}}})},{"../../core":29}],115:[function(require,module,exports){(function(global){require("./polyfill");var core=module.exports=require("./core");core.extras=require("./extras");core.filters=require("./filters");core.interaction=require("./interaction");core.loaders=require("./loaders");core.mesh=require("./mesh");core.accessibility=require("./accessibility");core.loader=new core.loaders.Loader;Object.assign(core,require("./deprecation"));global.PIXI=core}).call(this,typeof global!=="undefined"?global:typeof self!=="undefined"?self:typeof window!=="undefined"?window:{})},{"./accessibility":21,"./core":29,"./deprecation":79,"./extras":86,"./filters":103,"./interaction":118,"./loaders":121,"./mesh":128,"./polyfill":133}],116:[function(require,module,exports){var core=require("../core");function InteractionData(){this.global=new core.Point;this.target=null;this.originalEvent=null}InteractionData.prototype.constructor=InteractionData;module.exports=InteractionData;InteractionData.prototype.getLocalPosition=function(displayObject,point,globalPos){return displayObject.worldTransform.applyInverse(globalPos||this.global,point)}},{"../core":29}],117:[function(require,module,exports){var core=require("../core"),InteractionData=require("./InteractionData");Object.assign(core.DisplayObject.prototype,require("./interactiveTarget"));function InteractionManager(renderer,options){options=options||{};this.renderer=renderer;this.autoPreventDefault=options.autoPreventDefault!==undefined?options.autoPreventDefault:true;this.interactionFrequency=options.interactionFrequency||10;this.mouse=new InteractionData;this.eventData={stopped:false,target:null,type:null,data:this.mouse,stopPropagation:function(){this.stopped=true}};this.interactiveDataPool=[];this.interactionDOMElement=null;this.moveWhenInside=false;this.eventsAdded=false;this.onMouseUp=this.onMouseUp.bind(this);this.processMouseUp=this.processMouseUp.bind(this);this.onMouseDown=this.onMouseDown.bind(this);this.processMouseDown=this.processMouseDown.bind(this);this.onMouseMove=this.onMouseMove.bind(this);this.processMouseMove=this.processMouseMove.bind(this);this.onMouseOut=this.onMouseOut.bind(this);this.processMouseOverOut=this.processMouseOverOut.bind(this);this.onTouchStart=this.onTouchStart.bind(this);this.processTouchStart=this.processTouchStart.bind(this);this.onTouchEnd=this.onTouchEnd.bind(this);this.processTouchEnd=this.processTouchEnd.bind(this);this.onTouchMove=this.onTouchMove.bind(this);this.processTouchMove=this.processTouchMove.bind(this);this.last=0;this.currentCursorStyle="inherit";this._tempPoint=new core.Point;this.resolution=1;this.setTargetElement(this.renderer.view,this.renderer.resolution)}InteractionManager.prototype.constructor=InteractionManager;module.exports=InteractionManager;InteractionManager.prototype.setTargetElement=function(element,resolution){this.removeEvents();this.interactionDOMElement=element;this.resolution=resolution||1;this.addEvents()};InteractionManager.prototype.addEvents=function(){if(!this.interactionDOMElement){return}core.ticker.shared.add(this.update,this);if(window.navigator.msPointerEnabled){this.interactionDOMElement.style["-ms-content-zooming"]="none";this.interactionDOMElement.style["-ms-touch-action"]="none"}window.document.addEventListener("mousemove",this.onMouseMove,true);this.interactionDOMElement.addEventListener("mousedown",this.onMouseDown,true);this.interactionDOMElement.addEventListener("mouseout",this.onMouseOut,true);this.interactionDOMElement.addEventListener("touchstart",this.onTouchStart,true);this.interactionDOMElement.addEventListener("touchend",this.onTouchEnd,true);this.interactionDOMElement.addEventListener("touchmove",this.onTouchMove,true);window.addEventListener("mouseup",this.onMouseUp,true);this.eventsAdded=true};InteractionManager.prototype.removeEvents=function(){if(!this.interactionDOMElement){return}core.ticker.shared.remove(this.update);if(window.navigator.msPointerEnabled){this.interactionDOMElement.style["-ms-content-zooming"]="";this.interactionDOMElement.style["-ms-touch-action"]=""}window.document.removeEventListener("mousemove",this.onMouseMove,true);this.interactionDOMElement.removeEventListener("mousedown",this.onMouseDown,true);this.interactionDOMElement.removeEventListener("mouseout",this.onMouseOut,true);this.interactionDOMElement.removeEventListener("touchstart",this.onTouchStart,true);this.interactionDOMElement.removeEventListener("touchend",this.onTouchEnd,true);this.interactionDOMElement.removeEventListener("touchmove",this.onTouchMove,true);this.interactionDOMElement=null;window.removeEventListener("mouseup",this.onMouseUp,true);this.eventsAdded=false};InteractionManager.prototype.update=function(deltaTime){this._deltaTime+=deltaTime;if(this._deltaTime=0;i--){var child=children[i];if(this.processInteractive(point,child,func,hitTest,interactiveParent)){if(!child.parent){continue}hit=true;interactiveParent=false;hitTest=false}}}if(interactive){if(hitTest&&!hit){if(displayObject.hitArea){displayObject.worldTransform.applyInverse(point,this._tempPoint);hit=displayObject.hitArea.contains(this._tempPoint.x,this._tempPoint.y)}else if(displayObject.containsPoint){hit=displayObject.containsPoint(point)}}if(displayObject.interactive){func(displayObject,hit)}}return hit};InteractionManager.prototype.onMouseDown=function(event){this.mouse.originalEvent=event;this.eventData.data=this.mouse;this.eventData.stopped=false;this.mapPositionToPoint(this.mouse.global,event.clientX,event.clientY);if(this.autoPreventDefault){this.mouse.originalEvent.preventDefault()}this.processInteractive(this.mouse.global,this.renderer._lastObjectRendered,this.processMouseDown,true)};InteractionManager.prototype.processMouseDown=function(displayObject,hit){var e=this.mouse.originalEvent;var isRightButton=e.button===2||e.which===3;if(hit){displayObject[isRightButton?"_isRightDown":"_isLeftDown"]=true;this.dispatchEvent(displayObject,isRightButton?"rightdown":"mousedown",this.eventData)}};InteractionManager.prototype.onMouseUp=function(event){this.mouse.originalEvent=event;this.eventData.data=this.mouse;this.eventData.stopped=false;this.mapPositionToPoint(this.mouse.global,event.clientX,event.clientY);this.processInteractive(this.mouse.global,this.renderer._lastObjectRendered,this.processMouseUp,true)};InteractionManager.prototype.processMouseUp=function(displayObject,hit){var e=this.mouse.originalEvent;var isRightButton=e.button===2||e.which===3;var isDown=isRightButton?"_isRightDown":"_isLeftDown";if(hit){this.dispatchEvent(displayObject,isRightButton?"rightup":"mouseup",this.eventData);if(displayObject[isDown]){displayObject[isDown]=false;this.dispatchEvent(displayObject,isRightButton?"rightclick":"click",this.eventData)}}else{if(displayObject[isDown]){displayObject[isDown]=false;this.dispatchEvent(displayObject,isRightButton?"rightupoutside":"mouseupoutside",this.eventData)}}};InteractionManager.prototype.onMouseMove=function(event){this.mouse.originalEvent=event;this.eventData.data=this.mouse;this.eventData.stopped=false;this.mapPositionToPoint(this.mouse.global,event.clientX,event.clientY);this.didMove=true;this.cursor="inherit";this.processInteractive(this.mouse.global,this.renderer._lastObjectRendered,this.processMouseMove,true);if(this.currentCursorStyle!==this.cursor){this.currentCursorStyle=this.cursor;this.interactionDOMElement.style.cursor=this.cursor}};InteractionManager.prototype.processMouseMove=function(displayObject,hit){this.processMouseOverOut(displayObject,hit);if(!this.moveWhenInside||hit){this.dispatchEvent(displayObject,"mousemove",this.eventData)}};InteractionManager.prototype.onMouseOut=function(event){this.mouse.originalEvent=event;this.eventData.stopped=false;this.mapPositionToPoint(this.mouse.global,event.clientX,event.clientY);this.interactionDOMElement.style.cursor="inherit";this.mapPositionToPoint(this.mouse.global,event.clientX,event.clientY);this.processInteractive(this.mouse.global,this.renderer._lastObjectRendered,this.processMouseOverOut,false)};InteractionManager.prototype.processMouseOverOut=function(displayObject,hit){if(hit){if(!displayObject._over){displayObject._over=true;this.dispatchEvent(displayObject,"mouseover",this.eventData)}if(displayObject.buttonMode){this.cursor=displayObject.defaultCursor}}else{if(displayObject._over){displayObject._over=false;this.dispatchEvent(displayObject,"mouseout",this.eventData)}}};InteractionManager.prototype.onTouchStart=function(event){if(this.autoPreventDefault){event.preventDefault()}var changedTouches=event.changedTouches;var cLength=changedTouches.length;for(var i=0;i0){var paddingX=this.canvasPadding/this.worldTransform.a;var paddingY=this.canvasPadding/this.worldTransform.d;var centerX=(x0+x1+x2)/3;var centerY=(y0+y1+y2)/3;var normX=x0-centerX;var normY=y0-centerY;var dist=Math.sqrt(normX*normX+normY*normY);x0=centerX+normX/dist*(dist+paddingX);y0=centerY+normY/dist*(dist+paddingY);normX=x1-centerX;normY=y1-centerY;dist=Math.sqrt(normX*normX+normY*normY);x1=centerX+normX/dist*(dist+paddingX);y1=centerY+normY/dist*(dist+paddingY);normX=x2-centerX;normY=y2-centerY;dist=Math.sqrt(normX*normX+normY*normY);x2=centerX+normX/dist*(dist+paddingX);y2=centerY+normY/dist*(dist+paddingY)}context.save();context.beginPath();context.moveTo(x0,y0);context.lineTo(x1,y1);context.lineTo(x2,y2);context.closePath();context.clip();var delta=u0*v1+v0*u2+u1*v2-v1*u2-v0*u1-u0*v2;var deltaA=x0*v1+v0*x2+x1*v2-v1*x2-v0*x1-x0*v2;var deltaB=u0*x1+x0*u2+u1*x2-x1*u2-x0*u1-u0*x2;var deltaC=u0*v1*x2+v0*x1*u2+x0*u1*v2-x0*v1*u2-v0*u1*x2-u0*x1*v2;var deltaD=y0*v1+v0*y2+y1*v2-v1*y2-v0*y1-y0*v2;var deltaE=u0*y1+y0*u2+u1*y2-y1*u2-y0*u1-u0*y2;var deltaF=u0*v1*y2+v0*y1*u2+y0*u1*v2-y0*v1*u2-v0*u1*y2-u0*y1*v2;context.transform(deltaA/delta,deltaD/delta,deltaB/delta,deltaE/delta,deltaC/delta,deltaF/delta);context.drawImage(textureSource,0,0,textureWidth*base.resolution,textureHeight*base.resolution,0,0,textureWidth,textureHeight);context.restore()};Mesh.prototype.renderMeshFlat=function(Mesh){var context=this.context;var vertices=Mesh.vertices;var length=vertices.length/2;context.beginPath();for(var i=1;imaxX?x:maxX;maxY=y>maxY?y:maxY}if(minX===-Infinity||maxY===Infinity){return core.Rectangle.EMPTY}var bounds=this._bounds;bounds.x=minX;bounds.width=maxX-minX;bounds.y=minY;bounds.height=maxY-minY;this._currentBounds=bounds}return this._currentBounds};Mesh.prototype.containsPoint=function(point){if(!this.getBounds().contains(point.x,point.y)){return false}this.worldTransform.applyInverse(point,tempPoint);var vertices=this.vertices;var points=tempPolygon.points;var i,len;if(this.drawMode===Mesh.DRAW_MODES.TRIANGLES){var indices=this.indices;len=this.indices.length;for(i=0;i1){ratio=1}perpLength=Math.sqrt(perpX*perpX+perpY*perpY);num=this._texture.height/2;perpX/=perpLength;perpY/=perpLength;perpX*=num;perpY*=num;vertices[index]=point.x+perpX;vertices[index+1]=point.y+perpY;vertices[index+2]=point.x-perpX;vertices[index+3]=point.y-perpY;lastPoint=point}this.containerUpdateTransform()}},{"../core":29,"./Mesh":125}],128:[function(require,module,exports){module.exports={Mesh:require("./Mesh"),Plane:require("./Plane"),Rope:require("./Rope"),MeshRenderer:require("./webgl/MeshRenderer"),MeshShader:require("./webgl/MeshShader")}},{"./Mesh":125,"./Plane":126,"./Rope":127,"./webgl/MeshRenderer":129,"./webgl/MeshShader":130}],129:[function(require,module,exports){var core=require("../../core"),Mesh=require("../Mesh");function MeshRenderer(renderer){core.ObjectRenderer.call(this,renderer);this.indices=new Uint16Array(15e3);for(var i=0,j=0;i<15e3;i+=6,j+=4){this.indices[i+0]=j+0;this.indices[i+1]=j+1;this.indices[i+2]=j+2;this.indices[i+3]=j+0;this.indices[i+4]=j+2;this.indices[i+5]=j+3}this.currentShader=null}MeshRenderer.prototype=Object.create(core.ObjectRenderer.prototype);MeshRenderer.prototype.constructor=MeshRenderer;module.exports=MeshRenderer;core.WebGLRenderer.registerPlugin("mesh",MeshRenderer);MeshRenderer.prototype.onContextChange=function(){};MeshRenderer.prototype.render=function(mesh){if(!mesh._vertexBuffer){this._initWebGL(mesh)}var renderer=this.renderer,gl=renderer.gl,texture=mesh._texture.baseTexture,shader=mesh.shader;var drawMode=mesh.drawMode===Mesh.DRAW_MODES.TRIANGLE_MESH?gl.TRIANGLE_STRIP:gl.TRIANGLES;renderer.blendModeManager.setBlendMode(mesh.blendMode);if(!shader){shader=renderer.shaderManager.plugins.meshShader}else{shader=shader.shaders[gl.id]||shader.getShader(renderer)}this.renderer.shaderManager.setShader(shader);shader.uniforms.translationMatrix.value=mesh.worldTransform.toArray(true);shader.uniforms.projectionMatrix.value=renderer.currentRenderTarget.projectionMatrix.toArray(true);shader.uniforms.alpha.value=mesh.worldAlpha;shader.syncUniforms();if(!mesh.dirty){gl.bindBuffer(gl.ARRAY_BUFFER,mesh._vertexBuffer);gl.bufferSubData(gl.ARRAY_BUFFER,0,mesh.vertices);gl.vertexAttribPointer(shader.attributes.aVertexPosition,2,gl.FLOAT,false,0,0);gl.bindBuffer(gl.ARRAY_BUFFER,mesh._uvBuffer);gl.vertexAttribPointer(shader.attributes.aTextureCoord,2,gl.FLOAT,false,0,0);gl.activeTexture(gl.TEXTURE0);if(!texture._glTextures[gl.id]){this.renderer.updateTexture(texture)}else{gl.bindTexture(gl.TEXTURE_2D,texture._glTextures[gl.id])}gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER,mesh._indexBuffer);gl.bufferSubData(gl.ELEMENT_ARRAY_BUFFER,0,mesh.indices)}else{mesh.dirty=false;gl.bindBuffer(gl.ARRAY_BUFFER,mesh._vertexBuffer);gl.bufferData(gl.ARRAY_BUFFER,mesh.vertices,gl.STATIC_DRAW);gl.vertexAttribPointer(shader.attributes.aVertexPosition,2,gl.FLOAT,false,0,0);gl.bindBuffer(gl.ARRAY_BUFFER,mesh._uvBuffer);gl.bufferData(gl.ARRAY_BUFFER,mesh.uvs,gl.STATIC_DRAW);gl.vertexAttribPointer(shader.attributes.aTextureCoord,2,gl.FLOAT,false,0,0);gl.activeTexture(gl.TEXTURE0);if(!texture._glTextures[gl.id]){this.renderer.updateTexture(texture)}else{gl.bindTexture(gl.TEXTURE_2D,texture._glTextures[gl.id])}gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER,mesh._indexBuffer);gl.bufferData(gl.ELEMENT_ARRAY_BUFFER,mesh.indices,gl.STATIC_DRAW)}gl.drawElements(drawMode,mesh.indices.length,gl.UNSIGNED_SHORT,0)};MeshRenderer.prototype._initWebGL=function(mesh){var gl=this.renderer.gl;mesh._vertexBuffer=gl.createBuffer();mesh._indexBuffer=gl.createBuffer();mesh._uvBuffer=gl.createBuffer();gl.bindBuffer(gl.ARRAY_BUFFER,mesh._vertexBuffer);gl.bufferData(gl.ARRAY_BUFFER,mesh.vertices,gl.DYNAMIC_DRAW);gl.bindBuffer(gl.ARRAY_BUFFER,mesh._uvBuffer);gl.bufferData(gl.ARRAY_BUFFER,mesh.uvs,gl.STATIC_DRAW);if(mesh.colors){mesh._colorBuffer=gl.createBuffer();gl.bindBuffer(gl.ARRAY_BUFFER,mesh._colorBuffer);gl.bufferData(gl.ARRAY_BUFFER,mesh.colors,gl.STATIC_DRAW)}gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER,mesh._indexBuffer);gl.bufferData(gl.ELEMENT_ARRAY_BUFFER,mesh.indices,gl.STATIC_DRAW)};MeshRenderer.prototype.flush=function(){};MeshRenderer.prototype.start=function(){this.currentShader=null};MeshRenderer.prototype.destroy=function(){core.ObjectRenderer.prototype.destroy.call(this)}},{"../../core":29,"../Mesh":125}],130:[function(require,module,exports){var core=require("../../core");function MeshShader(shaderManager){core.Shader.call(this,shaderManager,["precision lowp float;","attribute vec2 aVertexPosition;","attribute vec2 aTextureCoord;","uniform mat3 translationMatrix;","uniform mat3 projectionMatrix;","varying vec2 vTextureCoord;","void main(void){"," gl_Position = vec4((projectionMatrix * translationMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);"," vTextureCoord = aTextureCoord;","}"].join("\n"),["precision lowp float;","varying vec2 vTextureCoord;","uniform float alpha;","uniform sampler2D uSampler;","void main(void){"," gl_FragColor = texture2D(uSampler, vTextureCoord) * alpha ;","}"].join("\n"),{alpha:{type:"1f",value:0},translationMatrix:{type:"mat3",value:new Float32Array(9)},projectionMatrix:{type:"mat3",value:new Float32Array(9)}},{aVertexPosition:0,aTextureCoord:0})}MeshShader.prototype=Object.create(core.Shader.prototype);MeshShader.prototype.constructor=MeshShader;module.exports=MeshShader;core.ShaderManager.registerPlugin("meshShader",MeshShader)},{"../../core":29}],131:[function(require,module,exports){if(!Math.sign){Math.sign=function(x){x=+x;if(x===0||isNaN(x)){return x}return x>0?1:-1}}},{}],132:[function(require,module,exports){if(!Object.assign){Object.assign=require("object-assign")}},{"object-assign":11}],133:[function(require,module,exports){require("./Object.assign");require("./requestAnimationFrame");require("./Math.sign")},{"./Math.sign":131,"./Object.assign":132,"./requestAnimationFrame":134}],134:[function(require,module,exports){(function(global){if(!(Date.now&&Date.prototype.getTime)){Date.now=function now(){return(new Date).getTime()}}if(!(global.performance&&global.performance.now)){var startTime=Date.now();if(!global.performance){global.performance={}}global.performance.now=function(){return Date.now()-startTime}}var lastTime=Date.now();var vendors=["ms","moz","webkit","o"];for(var x=0;x0){o.feedbackNode.connect(o.filterNode);o.filterNode.connect(o.delayNode)}else{o.feedbackNode.connect(o.delayNode)}o.volumeNode.connect(o.delayNode);o.delayNode.connect(o.panNode)}o.soundNode.loop=o.loop;o.soundNode.start(0,o.startOffset%o.buffer.duration);o.playing=true};o.pause=function(){if(o.playing){o.soundNode.stop(0);o.startOffset+=actx.currentTime-o.startTime;o.playing=false}};o.restart=function(){if(o.playing){o.soundNode.stop(0)}o.startOffset=0;o.play()};o.playFrom=function(value){if(o.playing){o.soundNode.stop(0)}o.startOffset=value;o.play()};o.setEcho=function(delayValue,feedbackValue,filterValue){if(delayValue===undefined)delayValue=.3;if(feedbackValue===undefined)feedbackValue=.3;if(filterValue===undefined)filterValue=0;o.delayValue=delayValue;o.feebackValue=feedbackValue;o.filterValue=filterValue;o.echo=true};o.setReverb=function(duration,decay,reverse){if(duration===undefined)duration=2;if(decay===undefined)decay=2;if(reverse===undefined)reverse=false;o.reverbImpulse=impulseResponse(duration,decay,reverse,actx);o.reverb=true};o.fade=function(endValue,durationInSeconds){if(o.playing){o.volumeNode.gain.linearRampToValueAtTime(o.volumeNode.gain.value,actx.currentTime);o.volumeNode.gain.linearRampToValueAtTime(endValue,actx.currentTime+durationInSeconds)}};o.fadeIn=function(durationInSeconds){o.volumeNode.gain.value=0;o.fade(1,durationInSeconds)};o.fadeOut=function(durationInSeconds){o.fade(0,durationInSeconds)};Object.defineProperties(o,{volume:{get:function(){return o.volumeValue},set:function(value){o.volumeNode.gain.value=value;o.volumeValue=value},enumerable:true,configurable:true},pan:{get:function(){if(!actx.createStereoPanner){return o.panValue}else{return o.panNode.pan.value}},set:function(value){if(!actx.createStereoPanner){var x=value,y=0,z=1-Math.abs(x);o.panNode.setPosition(x,y,z);o.panValue=value}else{o.panNode.pan.value=value}},enumerable:true,configurable:true}});if(loadSound){this.loadSound(o,source,loadHandler,failHandler)}if(xhr){this.decodeAudio(o,xhr,loadHandler,failHandler)}return o}function loadSound(o,source,loadHandler,failHandler){var xhr=new XMLHttpRequest;xhr.open("GET",source,true);xhr.responseType="arraybuffer";xhr.addEventListener("load",decodeAudio.bind(this,o,xhr,loadHandler,failHandler));xhr.send()}function decodeAudio(o,xhr,loadHandler,failHandler){actx.decodeAudioData(xhr.response,function(buffer){o.buffer=buffer;o.hasLoaded=true;if(loadHandler){loadHandler()}},function(error){if(failHandler)failHandler(o.source,error)})}function soundEffect(frequencyValue,attack,decay,type,volumeValue,panValue,wait,pitchBendAmount,reverse,randomValue,dissonance,echo,reverb,timeout){if(frequencyValue===undefined)frequencyValue=200;if(attack===undefined)attack=0;if(decay===undefined)decay=1;if(type===undefined)type="sine";if(volumeValue===undefined)volumeValue=1;if(panValue===undefined)panValue=0;if(wait===undefined)wait=0;if(pitchBendAmount===undefined)pitchBendAmount=0;if(reverse===undefined)reverse=false;if(randomValue===undefined)randomValue=0;if(dissonance===undefined)dissonance=0;if(echo===undefined)echo=undefined;if(reverb===undefined)reverb=undefined;if(timeout===undefined)timeout=undefined;var oscillator,volume,pan;oscillator=actx.createOscillator();volume=actx.createGain();if(!actx.createStereoPanner){pan=actx.createPanner()}else{pan=actx.createStereoPanner()}oscillator.connect(volume);volume.connect(pan);pan.connect(actx.destination);volume.gain.value=volumeValue;if(!actx.createStereoPanner){pan.setPosition(panValue,0,1-Math.abs(panValue))}else{pan.pan.value=panValue}oscillator.type=type;var frequency;var randomInt=function(min,max){return Math.floor(Math.random()*(max-min+1))+min};if(randomValue>0){frequency=randomInt(frequencyValue-randomValue/2,frequencyValue+randomValue/2)}else{frequency=frequencyValue}oscillator.frequency.value=frequency;if(attack>0)fadeIn(volume);fadeOut(volume);if(pitchBendAmount>0)pitchBend(oscillator);if(echo)addEcho(volume);if(reverb)addReverb(volume);if(dissonance>0)addDissonance();play(oscillator);function addReverb(volumeNode){var convolver=actx.createConvolver();convolver.buffer=impulseResponse(reverb[0],reverb[1],reverb[2],actx);volumeNode.connect(convolver);convolver.connect(pan)}function addEcho(volumeNode){var feedback=actx.createGain(),delay=actx.createDelay(),filter=actx.createBiquadFilter();delay.delayTime.value=echo[0];feedback.gain.value=echo[1];if(echo[2])filter.frequency.value=echo[2];delay.connect(feedback);if(echo[2]){feedback.connect(filter);filter.connect(delay)}else{feedback.connect(delay)}volumeNode.connect(delay);delay.connect(pan)}function fadeIn(volumeNode){volumeNode.gain.value=0;volumeNode.gain.linearRampToValueAtTime(0,actx.currentTime+wait);volumeNode.gain.linearRampToValueAtTime(volumeValue,actx.currentTime+wait+attack)}function fadeOut(volumeNode){volumeNode.gain.linearRampToValueAtTime(volumeValue,actx.currentTime+attack+wait);volumeNode.gain.linearRampToValueAtTime(0,actx.currentTime+wait+attack+decay)}function pitchBend(oscillatorNode){var frequency=oscillatorNode.frequency.value;if(!reverse){oscillatorNode.frequency.linearRampToValueAtTime(frequency,actx.currentTime+wait);oscillatorNode.frequency.linearRampToValueAtTime(frequency-pitchBendAmount,actx.currentTime+wait+attack+decay)}else{oscillatorNode.frequency.linearRampToValueAtTime(frequency,actx.currentTime+wait);oscillatorNode.frequency.linearRampToValueAtTime(frequency+pitchBendAmount,actx.currentTime+wait+attack+decay)}}function addDissonance(){var d1=actx.createOscillator(),d2=actx.createOscillator(),d1Volume=actx.createGain(),d2Volume=actx.createGain();d1Volume.gain.value=volumeValue;d2Volume.gain.value=volumeValue;d1.connect(d1Volume);d1Volume.connect(actx.destination);d2.connect(d2Volume);d2Volume.connect(actx.destination);d1.type="sawtooth";d2.type="sawtooth";d1.frequency.value=frequency+dissonance;d2.frequency.value=frequency-dissonance;if(attack>0){fadeIn(d1Volume);fadeIn(d2Volume)}if(decay>0){fadeOut(d1Volume);fadeOut(d2Volume)}if(pitchBendAmount>0){pitchBend(d1);pitchBend(d2)}if(echo){addEcho(d1Volume);addEcho(d2Volume)}if(reverb){addReverb(d1Volume);addReverb(d2Volume)}play(d1);play(d2)}function play(node){node.start(actx.currentTime+wait);node.stop(actx.currentTime+wait+2)}}function impulseResponse(duration,decay,reverse,actx){var length=actx.sampleRate*duration;var impulse=actx.createBuffer(2,length,actx.sampleRate);var left=impulse.getChannelData(0),right=impulse.getChannelData(1);for(var i=0;icanvas.offsetHeight){if(canvas.offsetWidth*scale-1){}else{}}return scale}"use strict";var _createClass=function(){function defineProperties(target,props){for(var i=0;ileft&&point.xtop&&point.yc2.x?xSide=1:xSide=-1;c1.y>c2.y?ySide=1:ySide=-1;c1.x=c1.x+s.vxHalf*xSide;c1.y=c1.y+s.vyHalf*ySide;c2.x=c2.x+s.vxHalf*-xSide;c2.y=c2.y+s.vyHalf*-ySide;s.lx=s.vy;s.ly=-s.vx;var dp1=c1.vx*s.dx+c1.vy*s.dy;p1A.x=dp1*s.dx;p1A.y=dp1*s.dy;var dp2=c1.vx*(s.lx/s.magnitude)+c1.vy*(s.ly/s.magnitude);p1B.x=dp2*(s.lx/s.magnitude);p1B.y=dp2*(s.ly/s.magnitude);var dp3=c2.vx*s.dx+c2.vy*s.dy;p2A.x=dp3*s.dx;p2A.y=dp3*s.dy;var dp4=c2.vx*(s.lx/s.magnitude)+c2.vy*(s.ly/s.magnitude);p2B.x=dp4*(s.lx/s.magnitude);p2B.y=dp4*(s.ly/s.magnitude);c1.bounce={};c1.bounce.x=p1B.x+p2A.x;c1.bounce.y=p1B.y+p2A.y;c2.bounce={};c2.bounce.x=p1A.x+p2B.x;c2.bounce.y=p1A.y+p2B.y;c1.vx=c1.bounce.x/c1.mass;c1.vy=c1.bounce.y/c1.mass;c2.vx=c2.bounce.x/c2.mass;c2.vy=c2.bounce.y/c2.mass}return hit}},{key:"multipleCircleCollision",value:function multipleCircleCollision(arrayOfCircles){var global=arguments.length<=1||arguments[1]===undefined?false:arguments[1];for(var i=0;i=overlapY){if(vy>0){collision="top";r1.y=r1.y+overlapY}else{collision="bottom";r1.y=r1.y-overlapY}if(bounce){r1.vy*=-1}}else{if(vx>0){collision="left";r1.x=r1.x+overlapX}else{collision="right";r1.x=r1.x-overlapX}if(bounce){r1.vx*=-1}}}else{}}else{}return collision}},{key:"hitTestRectangle",value:function hitTestRectangle(r1,r2){var global=arguments.length<=2||arguments[2]===undefined?false:arguments[2];if(!r1._bumpPropertiesAdded)this.addCollisionProperties(r1); if(!r2._bumpPropertiesAdded)this.addCollisionProperties(r2);var hit=undefined,combinedHalfWidths=undefined,combinedHalfHeights=undefined,vx=undefined,vy=undefined;hit=false;if(global){vx=r1.gx+Math.abs(r1.halfWidth)-r1.xAnchorOffset-(r2.gx+Math.abs(r2.halfWidth)-r2.xAnchorOffset);vy=r1.gy+Math.abs(r1.halfHeight)-r1.yAnchorOffset-(r2.gy+Math.abs(r2.halfHeight)-r2.yAnchorOffset)}else{vx=r1.x+Math.abs(r1.halfWidth)-r1.xAnchorOffset-(r2.x+Math.abs(r2.halfWidth)-r2.xAnchorOffset);vy=r1.y+Math.abs(r1.halfHeight)-r1.yAnchorOffset-(r2.y+Math.abs(r2.halfHeight)-r2.yAnchorOffset)}combinedHalfWidths=Math.abs(r1.halfWidth)+Math.abs(r2.halfWidth);combinedHalfHeights=Math.abs(r1.halfHeight)+Math.abs(r2.halfHeight);if(Math.abs(vx)r1x+1+Math.abs(r1.halfWidth)-r1.xAnchorOffset){region="topRight"}else{region="topMiddle"}}else if(c1y-c1.yAnchorOffset>r1y+Math.abs(r1.halfHeight)-r1.yAnchorOffset){if(c1x-c1.xAnchorOffsetr1x+1+Math.abs(r1.halfWidth)-r1.xAnchorOffset){region="bottomRight"}else{region="bottomMiddle"}}else{if(c1x-c1.xAnchorOffsetr1x+1+Math.abs(r1.halfWidth)-r1.xAnchorOffset){region="topRight"}else{region="topMiddle"}}else if(c1y-c1.yAnchorOffset>r1y+Math.abs(r1.halfHeight)-r1.yAnchorOffset){if(c1x-c1.xAnchorOffsetr1x+1+Math.abs(r1.halfWidth)-r1.xAnchorOffset){region="bottomRight"}else{region="bottomMiddle"}}else{if(c1x-c1.xAnchorOffsetcontainer.width-container.xAnchorOffset){if(bounce)sprite.vx*=-1;if(sprite.mass)sprite.vx/=sprite.mass;sprite.x=container.width-sprite.width-container.xAnchorOffset+sprite.xAnchorOffset;collision.add("right")}if(sprite.y-sprite.yAnchorOffset+sprite.height>container.height-container.yAnchorOffset){if(bounce)sprite.vy*=-1;if(sprite.mass)sprite.vy/=sprite.mass;sprite.y=container.height-sprite.height-container.yAnchorOffset+sprite.yAnchorOffset;collision.add("bottom")}if(collision.size===0)collision=undefined;if(collision&&extra)extra(collision);return collision}},{key:"outsideBounds",value:function outsideBounds(s,bounds,extra){var x=bounds.x,y=bounds.y,width=bounds.width,height=bounds.height;var collision=new Set;if(s.xwidth+s.width){collision.add("right")}if(s.y>height+s.height){collision.add("bottom")}if(collision.size===0)collision=undefined;if(collision&&extra)extra(collision);return collision}},{key:"_getCenter",value:function _getCenter(o,dimension,axis){if(o.anchor!==undefined){if(o.anchor[axis]!==0){return 0}else{return dimension/2}}else{return dimension}}},{key:"hit",value:function hit(a,b){var react=arguments.length<=2||arguments[2]===undefined?false:arguments[2];var bounce=arguments.length<=3||arguments[3]===undefined?false:arguments[3];var global=arguments[4];var extra=arguments.length<=5||arguments[5]===undefined?undefined:arguments[5];var hitTestPoint=this.hitTestPoint.bind(this),hitTestRectangle=this.hitTestRectangle.bind(this),hitTestCircle=this.hitTestCircle.bind(this),movingCircleCollision=this.movingCircleCollision.bind(this),circleCollision=this.circleCollision.bind(this),hitTestCircleRectangle=this.hitTestCircleRectangle.bind(this),rectangleCollision=this.rectangleCollision.bind(this),circleRectangleCollision=this.circleRectangleCollision.bind(this);var collision=undefined,aIsASprite=a.parent!==undefined,bIsASprite=b.parent!==undefined;if(aIsASprite&&b instanceof Array||bIsASprite&&a instanceof Array){spriteVsArray()}else{collision=findCollisionType(a,b);if(collision&&extra)extra(collision)}return collision;function findCollisionType(a,b){var aIsASprite=a.parent!==undefined;var bIsASprite=b.parent!==undefined;if(aIsASprite&&bIsASprite){if(a.diameter&&b.diameter){return circleVsCircle(a,b)}else if(a.diameter&&!b.diameter){return circleVsRectangle(a,b)}else{return rectangleVsRectangle(a,b)}}else if(bIsASprite&&!(a.x===undefined)&&!(a.y===undefined)){return hitTestPoint(a,b)}else{throw new Error("I'm sorry, "+a+" and "+b+" cannot be use together in a collision test.'")}}function spriteVsArray(){if(a instanceof Array){var _ref=[_b,_a];var _a=_ref[0];var _b=_ref[1]}for(var i=b.length-1;i>=0;i--){var sprite=b[i];collision=findCollisionType(a,sprite);if(collision&&extra)extra(collision,sprite)}}function circleVsCircle(a,b){if(!react){return hitTestCircle(a,b)}else{if(a.vx+a.vy!==0&&b.vx+b.vy!==0){return movingCircleCollision(a,b,global)}else{return circleCollision(a,b,bounce,global)}}}function rectangleVsRectangle(a,b){if(!react){return hitTestRectangle(a,b,global)}else{return rectangleCollision(a,b,bounce,global)}}function circleVsRectangle(a,b){if(!react){return hitTestCircleRectangle(a,b,global)}else{return circleRectangleCollision(a,b,bounce,global)}}}}]);return Bump}();var _createClass=function(){function defineProperties(target,props){for(var i=0;i1){tween.endValue*=friction;if(tween.endValue<=1){tween.endValue=1;_this4.removeTween(tween)}}}});return o}},{key:"followCurve",value:function followCurve(sprite,pointsArray,totalFrames){var type=arguments.length<=3||arguments[3]===undefined?"smoothstep":arguments[3];var _this5=this;var yoyo=arguments.length<=4||arguments[4]===undefined?false:arguments[4];var delayBeforeRepeat=arguments.length<=5||arguments[5]===undefined?0:arguments[5];var o={};var typeArray=type.split(" ");if(typeArray[0]==="bounce"){o.startMagnitude=parseInt(typeArray[1]);o.endMagnitude=parseInt(typeArray[2])}o.start=function(pointsArray){o.playing=true;o.totalFrames=totalFrames;o.frameCounter=0;o.pointsArray=JSON.parse(JSON.stringify(pointsArray));_this5.globalTweens.push(o)};o.start(pointsArray);o.update=function(){var normalizedTime=undefined,curvedTime=undefined,p=o.pointsArray;if(o.playing){if(o.frameCounter0){for(var i=this.globalTweens.length-1;i>=0;i--){var tween=this.globalTweens[i];if(tween)tween.update()}}}}]);return Charm}();var _createClass=function(){function defineProperties(target,props){for(var i=0;i0){for(var i=spritesArray.length-1;i>=0;i--){var sprite=spritesArray[i];this.draggableSprites.push(sprite);if(sprite.draggable===undefined){sprite.draggable=true;sprite._localDraggableAllocation=true}}}}}},{key:"makeUndraggable",value:function makeUndraggable(){var _this2=this;for(var _len2=arguments.length,sprites=Array(_len2),_key2=0;_key2<_len2;_key2++){sprites[_key2]=arguments[_key2]}if(!(sprites[0]instanceof Array)){sprites.forEach(function(sprite){_this2.draggableSprites.splice(_this2.draggableSprites.indexOf(sprite),1);if(sprite._localDraggableAllocation===true)sprite.draggable=false})}else{var spritesArray=sprites[0];if(spritesArray.length>0){for(var i=spritesArray.length-1;i>=0;i--){var sprite=spritesArray[i];this.draggableSprites.splice(this.draggableSprites.indexOf(sprite),1);if(sprite._localDraggableAllocation===true)sprite.draggable=false}}}}},{key:"makePointer",value:function makePointer(){var element=arguments.length<=0||arguments[0]===undefined?this.element:arguments[0];var scale=arguments.length<=1||arguments[1]===undefined?this.scale:arguments[1];var draggableSprites=this.draggableSprites;var addGlobalPositionProperties=this.addGlobalPositionProperties;var pointer={element:element,_scale:scale,_x:0,_y:0,width:1,height:1,get x(){return this._x/this.scale},get y(){return this._y/this.scale},get centerX(){return this.x},get centerY(){return this.y},get position(){return{x:this.x,y:this.y}},get scale(){return this._scale},set scale(value){this._scale=value},get cursor(){return this.element.style.cursor},set cursor(value){this.element.style.cursor=value},isDown:false,isUp:true,tapped:false,downTime:0,elapsedTime:0,press:undefined,release:undefined,tap:undefined,dragSprite:null,dragOffsetX:0,dragOffsetY:0,_visible:true,get visible(){return this._visible},set visible(value){if(value===true){this.cursor="auto"}else{this.cursor="none"}this._visible=value},moveHandler:function moveHandler(event){var element=event.target;this._x=event.pageX-element.offsetLeft;this._y=event.pageY-element.offsetTop;event.preventDefault()},touchmoveHandler:function touchmoveHandler(event){var element=event.target;this._x=event.targetTouches[0].pageX-element.offsetLeft;this._y=event.targetTouches[0].pageY-element.offsetTop;event.preventDefault()},downHandler:function downHandler(event){this.isDown=true;this.isUp=false;this.tapped=false;this.downTime=Date.now();if(this.press)this.press();event.preventDefault()},touchstartHandler:function touchstartHandler(event){var element=event.target;this._x=event.targetTouches[0].pageX-element.offsetLeft;this._y=event.targetTouches[0].pageY-element.offsetTop;this.isDown=true;this.isUp=false;this.tapped=false;this.downTime=Date.now();if(this.press)this.press();event.preventDefault()},upHandler:function upHandler(event){this.elapsedTime=Math.abs(this.downTime-Date.now());if(this.elapsedTime<=200&&this.tapped===false){this.tapped=true;if(this.tap)this.tap()}this.isUp=true;this.isDown=false;if(this.release)this.release()},touchendHandler:function touchendHandler(event){this.elapsedTime=Math.abs(this.downTime-Date.now());if(this.elapsedTime<=200&&this.tapped===false){this.tapped=true;if(this.tap)this.tap()}this.isUp=true;this.isDown=false;if(this.release)this.release()},hitTestSprite:function hitTestSprite(sprite){addGlobalPositionProperties(sprite);var hit=false;var xAnchorOffset=undefined,yAnchorOffset=undefined;if(sprite.anchor!==undefined){xAnchorOffset=sprite.width*sprite.anchor.x;yAnchorOffset=sprite.height*sprite.anchor.y}else{xAnchorOffset=0;yAnchorOffset=0}if(!sprite.circular){var left=sprite.gx-xAnchorOffset,right=sprite.gx+sprite.width-xAnchorOffset,top=sprite.gy-yAnchorOffset,bottom=sprite.gy+sprite.height-yAnchorOffset;hit=this.x>left&&this.xtop&&this.y-1;i--){var sprite=draggableSprites[i];if(pointer.hitTestSprite(sprite)&&sprite.draggable){pointer.dragOffsetX=pointer.x-sprite.gx;pointer.dragOffsetY=pointer.y-sprite.gy;pointer.dragSprite=sprite;var children=sprite.parent.children;children.splice(children.indexOf(sprite),1);children.push(sprite);draggableSprites.splice(draggableSprites.indexOf(sprite),1);draggableSprites.push(sprite);break}}}else{pointer.dragSprite.x=pointer.x-pointer.dragOffsetX;pointer.dragSprite.y=pointer.y-pointer.dragOffsetY}}if(pointer.isUp){pointer.dragSprite=null}draggableSprites.some(function(sprite){if(pointer.hitTestSprite(sprite)&&sprite.draggable){ if(pointer.visible)pointer.cursor="pointer";return true}else{if(pointer.visible)pointer.cursor="auto";return false}})})}},{key:"makeInteractive",value:function makeInteractive(o){o.press=o.press||undefined;o.release=o.release||undefined;o.over=o.over||undefined;o.out=o.out||undefined;o.tap=o.tap||undefined;o.state="up";o.action="";o.pressed=false;o.hoverOver=false;o.tinkType="";o.enabled=true;this.buttons.push(o)}},{key:"updateButtons",value:function updateButtons(){var _this3=this;if(this.pointers.length===0){this.makePointer(this.element,this.scale)}this.pointers.forEach(function(pointer){pointer.shouldBeHand=false;_this3.buttons.forEach(function(o){if(o.enabled){var hit=pointer.hitTestSprite(o);if(pointer.isUp){o.state="up";if(o.tinkType==="button")o.gotoAndStop(0)}if(hit){o.state="over";if(o.totalFrames&&o.totalFrames===3&&o.tinkType==="button"){o.gotoAndStop(1)}if(pointer.isDown){o.state="down";if(o.tinkType==="button"){if(o.totalFrames===3){o.gotoAndStop(2)}else{o.gotoAndStop(1)}}}pointer.shouldBeHand=true;if(pointer.visible)pointer.cursor="pointer"}else{if(pointer.visible)pointer.cursor="auto"}if(o.state==="down"){if(!o.pressed){if(o.press)o.press();o.pressed=true;o.action="pressed"}}if(o.state==="over"){if(o.pressed){if(o.release)o.release();o.pressed=false;o.action="released";if(pointer.tapped&&o.tap)o.tap()}if(!o.hoverOver){if(o.over)o.over();o.hoverOver=true}}if(o.state==="up"){if(o.pressed){if(o.release)o.release();o.pressed=false;o.action="released"}if(o.hoverOver){if(o.out)o.out();o.hoverOver=false}}}});if(pointer.shouldBeHand){pointer.cursor="pointer"}else{pointer.cursor="auto"}})}},{key:"button",value:function button(source){var x=arguments.length<=1||arguments[1]===undefined?0:arguments[1];var y=arguments.length<=2||arguments[2]===undefined?0:arguments[2];var o=undefined;if(typeof source[0]==="string"){if(this.TextureCache[source[0]]){o=this.AnimatedSprite.fromFrames(source)}else{o=this.AnimatedSprite.fromImages(source)}}else if(source[0]instanceof this.Texture){o=new this.AnimatedSprite(source)}this.makeInteractive(o);o.tinkType="button";o.x=x;o.y=y;return o}},{key:"update",value:function update(){if(this.draggableSprites.length!==0)this.updateDragAndDrop(this.draggableSprites);if(this.buttons.length!==0)this.updateButtons()}},{key:"keyboard",value:function keyboard(keyCode){var key={};key.code=keyCode;key.isDown=false;key.isUp=true;key.press=undefined;key.release=undefined;key.downHandler=function(event){if(event.keyCode===key.code){if(key.isUp&&key.press)key.press();key.isDown=true;key.isUp=false}event.preventDefault()};key.upHandler=function(event){if(event.keyCode===key.code){if(key.isDown&&key.release)key.release();key.isDown=false;key.isUp=true}event.preventDefault()};window.addEventListener("keydown",key.downHandler.bind(key),false);window.addEventListener("keyup",key.upHandler.bind(key),false);return key}},{key:"arrowControl",value:function arrowControl(sprite,speed){if(speed===undefined){throw new Error("Please supply the arrowControl method with the speed at which you want the sprite to move")}var upArrow=this.keyboard(38),rightArrow=this.keyboard(39),downArrow=this.keyboard(40),leftArrow=this.keyboard(37);leftArrow.press=function(){sprite.vx=-speed;sprite.vy=0};leftArrow.release=function(){if(!rightArrow.isDown&&sprite.vy===0){sprite.vx=0}};upArrow.press=function(){sprite.vy=-speed;sprite.vx=0};upArrow.release=function(){if(!downArrow.isDown&&sprite.vx===0){sprite.vy=0}};rightArrow.press=function(){sprite.vx=speed;sprite.vy=0};rightArrow.release=function(){if(!leftArrow.isDown&&sprite.vy===0){sprite.vx=0}};downArrow.press=function(){sprite.vy=speed;sprite.vx=0};downArrow.release=function(){if(!upArrow.isDown&&sprite.vx===0){sprite.vy=0}}}},{key:"scale",get:function get(){return this._scale},set:function set(value){this._scale=value;this.pointers.forEach(function(pointer){return pointer.scale=value})}}]);return Tink}();var _createClass=function(){function defineProperties(target,props){for(var i=0;i0){particle.gotoAndStop(_this.randomInt(0,particle.totalFrames-1))}var size=_this.randomInt(minSize,maxSize);particle.width=size;particle.height=size;particle.anchor.set(.5,.5);particle.x=x;particle.y=y;particle.scaleSpeed=_this.randomFloat(minScaleSpeed,maxScaleSpeed);particle.alphaSpeed=_this.randomFloat(minAlphaSpeed,maxAlphaSpeed);particle.rotationSpeed=_this.randomFloat(minRotationSpeed,maxRotationSpeed);var speed=_this.randomFloat(minSpeed,maxSpeed);particle.vx=speed*Math.cos(angle);particle.vy=speed*Math.sin(angle);particles.push(particle);container.addChild(particle);particle.updateParticle=function(){particle.vy+=gravity;particle.x+=particle.vx;particle.y+=particle.vy;if(particle.scale.x-particle.scaleSpeed>0){particle.scale.x-=particle.scaleSpeed}if(particle.scale.y-particle.scaleSpeed>0){particle.scale.y-=particle.scaleSpeed}particle.rotation+=particle.rotationSpeed;particle.alpha-=particle.alphaSpeed;if(particle.alpha<=0){container.removeChild(particle);particles.splice(particles.indexOf(particle),1)}}};angles.forEach(function(angle){return makeParticle(angle)});return particles}},{key:"emitter",value:function emitter(interval,particleFunction){var emitterObject={},timerInterval=undefined;emitterObject.playing=false;function play(){if(!emitterObject.playing){particleFunction();timerInterval=setInterval(emitParticle.bind(this),interval);emitterObject.playing=true}}function stop(){if(emitterObject.playing){clearInterval(timerInterval);emitterObject.playing=false}}function emitParticle(){particleFunction()}emitterObject.play=play;emitterObject.stop=stop;return emitterObject}},{key:"update",value:function update(){if(this.globalParticles.length>0){for(var i=this.globalParticles.length-1;i>=0;i--){var particles=this.globalParticles[i];if(particles.length>0){for(var j=particles.length-1;j>=0;j--){var particle=particles[j];particle.updateParticle()}}else{this.globalParticles.splice(this.globalParticles.indexOf(particles),1)}}}}}]);return Dust}();var _createClass=function(){function defineProperties(target,props){for(var i=0;i0){for(var i=this.shakingSprites.length-1;i>=0;i--){var shakingSprite=this.shakingSprites[i];if(shakingSprite.updateShake)shakingSprite.updateShake()}}}},{key:"sprite",value:function sprite(source){var x=arguments.length<=1||arguments[1]===undefined?0:arguments[1];var y=arguments.length<=2||arguments[2]===undefined?0:arguments[2];var tiling=arguments.length<=3||arguments[3]===undefined?false:arguments[3];var width=arguments[4];var height=arguments[5];var o=undefined,texture=undefined;if(typeof source==="string"){if(this.TextureCache[source]){texture=this.TextureCache[source]}else{texture=this.Texture.fromImage(source)}if(texture){if(!tiling){o=new this.Sprite(texture)}else{o=new this.TilingSprite(texture,width,height)}}else{throw new Error(source+" cannot be found")}}else if(source instanceof this.Texture){if(!tiling){o=new this.Sprite(source)}else{o=new this.TilingSprite(source,width,height)}}else if(source instanceof Array){if(typeof source[0]==="string"){if(this.TextureCache[source[0]]){o=this.MovieClip.fromFrames(source)}else{o=this.MovieClip.fromImages(source)}}else if(source[0]instanceof this.Texture){o=new this.MovieClip(source)}}if(o){o.x=x;o.y=y;if(width)o.width=width;if(height)o.height=height;if(o instanceof this.MovieClip)this.addStatePlayer(o);return o}}},{key:"addStatePlayer",value:function addStatePlayer(sprite){var frameCounter=0,numberOfFrames=0,startFrame=0,endFrame=0,timerInterval=undefined;function show(frameNumber){reset();sprite.gotoAndStop(frameNumber)}function stopAnimation(){reset();sprite.gotoAndStop(sprite.currentFrame)}function playAnimation(sequenceArray){reset();if(!sequenceArray){startFrame=0;endFrame=sprite.totalFrames-1}else{startFrame=sequenceArray[0];endFrame=sequenceArray[1]}numberOfFrames=endFrame-startFrame;if(!sprite.fps)sprite.fps=12;var frameRate=1e3/sprite.fps;sprite.gotoAndStop(startFrame);frameCounter=1;if(!sprite.animating){timerInterval=setInterval(advanceFrame.bind(this),frameRate);sprite.animating=true}}function advanceFrame(){if(frameCounter0){x+=spacing+spacing*i%columns;y+=spacing+spacing*Math.floor(i/columns)}positions.push([x,y])}return this.frames(texture,positions,frameWidth,frameHeight)}},{key:"frame",value:function frame(source,x,y,width,height){var texture=undefined,imageFrame=undefined;if(typeof source==="string"){if(this.TextureCache[source]){texture=new this.Texture(this.TextureCache[source])}}else if(source instanceof this.Texture){texture=new this.Texture(source)}if(!texture){throw new Error("Please load the "+source+" texture into the cache.")}else{imageFrame=new this.Rectangle(x,y,width,height);texture.frame=imageFrame;return texture}}},{key:"frames",value:function frames(source,coordinates,frameWidth,frameHeight){var _this=this;var baseTexture=undefined,textures=undefined;if(typeof source==="string"){if(this.TextureCache[source]){baseTexture=new this.Texture(this.TextureCache[source])}}else if(source instanceof this.Texture){baseTexture=new this.Texture(source)}if(!baseTexture){throw new Error("Please load the "+source+" texture into the cache.")}else{var _textures=coordinates.map(function(position){var x=position[0],y=position[1];var imageFrame=new _this.Rectangle(x,y,frameWidth,frameHeight);var frameTexture=new _this.Texture(baseTexture);frameTexture.frame=imageFrame;return frameTexture});return _textures}}},{key:"frameSeries",value:function frameSeries(){var startNumber=arguments.length<=0||arguments[0]===undefined?0:arguments[0];var endNumber=arguments.length<=1||arguments[1]===undefined?1:arguments[1];var baseName=arguments.length<=2||arguments[2]===undefined?"":arguments[2];var extension=arguments.length<=3||arguments[3]===undefined?"":arguments[3];var frames=[];for(var i=startNumber;i0){o.lineStyle(lineWidth,strokeStyle,1)}o.drawRect(0,0,width,height);o.endFill()};draw(o._width,o._height,o._fillStyle,o._strokeStyle,o._lineWidth);var texture=o.generateTexture();var sprite=new this.Sprite(texture);sprite.x=x;sprite.y=y;var self=this;Object.defineProperties(sprite,{fillStyle:{get:function get(){return o._fillStyle},set:function set(value){o._fillStyle=self.color(value);draw(o._width,o._height,o._fillStyle,o._strokeStyle,o._lineWidth,o._x,o._y);var texture=o.generateTexture();o._sprite.texture=texture},enumerable:true,configurable:true},strokeStyle:{get:function get(){return o._strokeStyle},set:function set(value){o._strokeStyle=self.color(value);draw(o._width,o._height,o._fillStyle,o._strokeStyle,o._lineWidth,o._x,o._y);var texture=o.generateTexture();o._sprite.texture=texture},enumerable:true,configurable:true},lineWidth:{get:function get(){return o._lineWidth},set:function set(value){o._lineWidth=value;draw(o._width,o._height,o._fillStyle,o._strokeStyle,o._lineWidth,o._x,o._y);var texture=o.generateTexture();o._sprite.texture=texture},enumerable:true,configurable:true}});o._sprite=sprite;return sprite}},{key:"circle",value:function circle(){var diameter=arguments.length<=0||arguments[0]===undefined?32:arguments[0];var fillStyle=arguments.length<=1||arguments[1]===undefined?16724736:arguments[1];var strokeStyle=arguments.length<=2||arguments[2]===undefined?13260:arguments[2];var lineWidth=arguments.length<=3||arguments[3]===undefined?0:arguments[3];var x=arguments.length<=4||arguments[4]===undefined?0:arguments[4];var y=arguments.length<=5||arguments[5]===undefined?0:arguments[5];var o=new this.Graphics;o._diameter=diameter;o._fillStyle=this.color(fillStyle);o._strokeStyle=this.color(strokeStyle);o._lineWidth=lineWidth;var draw=function draw(diameter,fillStyle,strokeStyle,lineWidth){o.clear();o.beginFill(fillStyle);if(lineWidth>0){o.lineStyle(lineWidth,strokeStyle,1)}o.drawCircle(0,0,diameter/2);o.endFill()};draw(o._diameter,o._fillStyle,o._strokeStyle,o._lineWidth);var texture=o.generateTexture();var sprite=new this.Sprite(texture);sprite.x=x;sprite.y=y;var self=this;Object.defineProperties(sprite,{fillStyle:{get:function get(){return o._fillStyle},set:function set(value){o._fillStyle=self.color(value);draw(o._diameter,o._fillStyle,o._strokeStyle,o._lineWidth);var texture=o.generateTexture();o._sprite.texture=texture},enumerable:true,configurable:true},strokeStyle:{get:function get(){return o._strokeStyle},set:function set(value){o._strokeStyle=self.color(value);draw(o._diameter,o._fillStyle,o._strokeStyle,o._lineWidth);var texture=o.generateTexture();o._sprite.texture=texture},enumerable:true,configurable:true},diameter:{get:function get(){return o._diameter},set:function set(value){o._lineWidth=10;draw(o._diameter,o._fillStyle,o._strokeStyle,o._lineWidth);var texture=o.generateTexture();o._sprite.texture=texture},enumerable:true,configurable:true},radius:{get:function get(){return o._diameter/2},set:function set(value){draw(value*2,o._fillStyle,o._strokeStyle,o._lineWidth);var texture=o.generateTexture();o._sprite.texture=texture},enumerable:true,configurable:true}});o._sprite=sprite;return sprite}},{key:"line",value:function line(){var strokeStyle=arguments.length<=0||arguments[0]===undefined?0:arguments[0];var lineWidth=arguments.length<=1||arguments[1]===undefined?1:arguments[1];var ax=arguments.length<=2||arguments[2]===undefined?0:arguments[2];var ay=arguments.length<=3||arguments[3]===undefined?0:arguments[3];var bx=arguments.length<=4||arguments[4]===undefined?32:arguments[4];var by=arguments.length<=5||arguments[5]===undefined?32:arguments[5];var o=new this.Graphics;o._strokeStyle=this.color(strokeStyle);o._width=lineWidth;o._ax=ax;o._ay=ay;o._bx=bx;o._by=by;var draw=function draw(strokeStyle,lineWidth,ax,ay,bx,by){o.clear();o.lineStyle(lineWidth,strokeStyle,1);o.moveTo(ax,ay);o.lineTo(bx,by)};draw(o._strokeStyle,o._width,o._ax,o._ay,o._bx,o._by);var self=this;Object.defineProperties(o,{ax:{get:function get(){return o._ax},set:function set(value){o._ax=value;draw(o._strokeStyle,o._width,o._ax,o._ay,o._bx,o._by)},enumerable:true,configurable:true},ay:{get:function get(){return o._ay},set:function set(value){o._ay=value;draw(o._strokeStyle,o._width,o._ax,o._ay,o._bx,o._by)},enumerable:true,configurable:true},bx:{get:function get(){return o._bx},set:function set(value){o._bx=value;draw(o._strokeStyle,o._width,o._ax,o._ay,o._bx,o._by)},enumerable:true,configurable:true},by:{get:function get(){return o._by},set:function set(value){o._by=value;draw(o._strokeStyle,o._width,o._ax,o._ay,o._bx,o._by)},enumerable:true,configurable:true},strokeStyle:{get:function get(){return o._strokeStyle},set:function set(value){o._strokeStyle=self.color(value);draw(o._strokeStyle,o._width,o._ax,o._ay,o._bx,o._by)},enumerable:true,configurable:true},width:{get:function get(){return o._width},set:function set(value){o._width=value;draw(o._strokeStyle,o._width,o._ax,o._ay,o._bx,o._by)},enumerable:true,configurable:true}});return o}},{key:"grid",value:function grid(){var columns=arguments.length<=0||arguments[0]===undefined?0:arguments[0];var rows=arguments.length<=1||arguments[1]===undefined?0:arguments[1];var cellWidth=arguments.length<=2||arguments[2]===undefined?32:arguments[2];var cellHeight=arguments.length<=3||arguments[3]===undefined?32:arguments[3];var centerCell=arguments.length<=4||arguments[4]===undefined?false:arguments[4];var xOffset=arguments.length<=5||arguments[5]===undefined?0:arguments[5];var yOffset=arguments.length<=6||arguments[6]===undefined?0:arguments[6];var makeSprite=arguments.length<=7||arguments[7]===undefined?undefined:arguments[7];var extra=arguments.length<=8||arguments[8]===undefined?undefined:arguments[8];var container=new this.Container;var createGrid=function createGrid(){var length=columns*rows;for(var i=0;i=numberOfShakes){sprite.x=startX;sprite.y=startY;self.shakingSprites.splice(self.shakingSprites.indexOf(sprite),1)}}var tiltAngle=1;function angularShake(){if(counter=numberOfShakes){sprite.rotation=startAngle;self.shakingSprites.splice(self.shakingSprites.indexOf(sprite),1)}}}},{key:"_getCenter",value:function _getCenter(o,dimension,axis){if(o.anchor!==undefined){if(o.anchor[axis]!==0){return 0}else{return dimension/2}}else{return dimension}}},{key:"group",value:function group(){var container=new this.Container;for(var _len=arguments.length,sprites=Array(_len),_key=0;_key<_len;_key++){sprites[_key]=arguments[_key]}sprites.forEach(function(sprite){container.addChild(sprite)});return container}},{key:"batch",value:function batch(){var size=arguments.length<=0||arguments[0]===undefined?15e3:arguments[0];var options=arguments.length<=1||arguments[1]===undefined?{rotation:true,alpha:true,scale:true,uvs:true}:arguments[1];var o=new this.ParticleContainer(size,options);return o}},{key:"remove",value:function remove(){for(var _len2=arguments.length,sprites=Array(_len2),_key2=0;_key2<_len2;_key2++){sprites[_key2]=arguments[_key2]}if(!(sprites[0]instanceof Array)){if(sprites.length>1){sprites.forEach(function(sprite){sprite.parent.removeChild(sprite)})}else{sprites[0].parent.removeChild(sprites[0])}}else{var spritesArray=sprites[0];if(spritesArray.length>0){for(var i=spritesArray.length-1;i>=0;i--){var sprite=spritesArray[i];sprite.parent.removeChild(sprite);spritesArray.splice(spritesArray.indexOf(sprite),1)}}}}},{key:"colorToRGBA",value:function colorToRGBA(color){var cvs,ctx;cvs=document.createElement("canvas");cvs.height=1;cvs.width=1;ctx=cvs.getContext("2d");ctx.fillStyle=color;ctx.fillRect(0,0,1,1);var data=ctx.getImageData(0,0,1,1).data;return data}},{key:"byteToHex",value:function byteToHex(num){return("0"+num.toString(16)).slice(-2)}},{key:"colorToHex",value:function colorToHex(color){var _this2=this;var rgba,hex;rgba=this.colorToRGBA(color);hex=[0,1,2].map(function(idx){return _this2.byteToHex(rgba[idx])}).join("");return"0x"+hex}},{key:"color",value:function color(value){if(!isNaN(value)){return value}else{return parseInt(this.colorToHex(value))}}}]);return SpriteUtilities}();var _createClass=function(){function defineProperties(target,props){for(var i=0;i=1){follower.x+=vx*speed;follower.y+=vy*speed}}},{key:"followConstant",value:function followConstant(follower,leader,speed){var vx=leader.x+this._getCenter(leader,leader.width,"x")-(follower.x+this._getCenter(follower,follower.width,"x")),vy=leader.y+this._getCenter(leader,leader.height,"y")-(follower.y+this._getCenter(follower,follower.height,"y")),distance=Math.sqrt(vx*vx+vy*vy);if(distance>=speed){follower.x+=vx/distance*speed;follower.y+=vy/distance*speed}}},{key:"angle",value:function angle(s1,s2){return Math.atan2(s2.y+this._getCenter(s2,s2.height,"y")-(s1.y+this._getCenter(s1,s1.height,"y")),s2.x+this._getCenter(s2,s2.width,"x")-(s1.x+this._getCenter(s1,s1.width,"x")))}},{key:"_getCenter",value:function _getCenter(o,dimension,axis){if(o.anchor!==undefined){if(o.anchor[axis]!==0){return 0}else{return dimension/2}}else{return dimension}}},{key:"rotateAroundSprite",value:function rotateAroundSprite(rotatingSprite,centerSprite,distance,angle){ rotatingSprite.x=centerSprite.x+this._getCenter(centerSprite,centerSprite.width,"x")-rotatingSprite.parent.x+distance*Math.cos(angle)-this._getCenter(rotatingSprite,rotatingSprite.width,"x");rotatingSprite.y=centerSprite.y+this._getCenter(centerSprite,centerSprite.height,"y")-rotatingSprite.parent.y+distance*Math.sin(angle)-this._getCenter(rotatingSprite,rotatingSprite.height,"y")}},{key:"rotateAroundPoint",value:function rotateAroundPoint(pointX,pointY,distanceX,distanceY,angle){var point={};point.x=pointX+Math.cos(angle)*distanceX;point.y=pointY+Math.sin(angle)*distanceY;return point}},{key:"randomInt",value:function randomInt(min,max){return Math.floor(Math.random()*(max-min+1))+min}},{key:"randomFloat",value:function randomFloat(min,max){return min+Math.random()*(max-min)}},{key:"wait",value:function wait(duration,callBack){setTimeout(callBack,duration)}},{key:"move",value:function move(){for(var _len=arguments.length,sprites=Array(_len),_key=0;_key<_len;_key++){sprites[_key]=arguments[_key]}if(!(sprites[0]instanceof Array)){if(sprites.length>1){sprites.forEach(function(sprite){sprite.x+=sprite.vx;sprite.y+=sprite.vy})}else{sprites[0].x+=sprites[0].vx;sprites[0].y+=sprites[0].vy}}else{var spritesArray=sprites[0];if(spritesArray.length>0){for(var i=spritesArray.length-1;i>=0;i--){var sprite=spritesArray[i];sprite.x+=sprite.vx;sprite.y+=sprite.vy}}}}},{key:"worldCamera",value:function worldCamera(world,worldWidth,worldHeight,canvas){var camera={width:canvas.width,height:canvas.height,_x:0,_y:0,get x(){return this._x},set x(value){this._x=value;world.x=-this._x},get y(){return this._y},set y(value){this._y=value;world.y=-this._y},get centerX(){return this.x+this.width/2},get centerY(){return this.y+this.height/2},get rightInnerBoundary(){return this.x+this.width/2+this.width/4},get leftInnerBoundary(){return this.x+this.width/2-this.width/4},get topInnerBoundary(){return this.y+this.height/2-this.height/4},get bottomInnerBoundary(){return this.y+this.height/2+this.height/4},follow:function follow(sprite){if(sprite.xthis.rightInnerBoundary){this.x=sprite.x+sprite.width-this.width/4*3}if(sprite.y+sprite.height>this.bottomInnerBoundary){this.y=sprite.y+sprite.height-this.height/4*3}if(this.x<0){this.x=0}if(this.y<0){this.y=0}if(this.x+this.width>worldWidth){this.x=worldWidth-this.width}if(this.y+this.height>worldHeight){this.y=worldHeight-this.height}},centerOver:function centerOver(sprite){this.x=sprite.x+sprite.halfWidth-this.width/2;this.y=sprite.y+sprite.halfHeight-this.height/2}};return camera}},{key:"lineOfSight",value:function lineOfSight(s1,s2,obstacles){var segment=arguments.length<=3||arguments[3]===undefined?32:arguments[3];spriteOneCenterX=s1.x+this._getCenter(s1,s1.width,"x");spriteOneCenterY=s1.y+this._getCenter(s1,s1.height,"y");spriteTwoCenterX=s2.x+this._getCenter(s2,s2.width,"x");spriteTwoCenterY=s2.y+this._getCenter(s2,s2.height,"y");var vx=spriteTwoCenterX-spriteOneCenterX,vy=spriteTwoCenterY-spriteOneCenterY;var magnitude=Math.sqrt(vx*vx+vy*vy);var numberOfPoints=magnitude/segment;var points=function points(){var arrayOfPoints=[];for(var i=1;i<=numberOfPoints;i++){var newMagnitude=segment*i;var dx=vx/magnitude,dy=vy/magnitude;var x=spriteOneCenterX+dx*newMagnitude,y=spriteOneCenterY+dy*newMagnitude;arrayOfPoints.push({x:x,y:y})}return arrayOfPoints};var hitTestPoint=function hitTestPoint(point,sprite){var left=point.x>sprite.x,right=point.xsprite.y,bottom=point.y1e3)elapsed=_this._frameDuration;_this._startTime=current;_this._lag+=elapsed;while(_this._lag>=_this._frameDuration){_this.capturePreviousSpriteProperties();_this.update();_this._lag-=_this._frameDuration}_this._lagOffset=_this._lag/_this._frameDuration;_this.render(_this._lagOffset)};if(this._fps===undefined){this.update();this.render()}else{if(this._renderFps===undefined){interpolate()}else{if(timestamp>=this._renderStartTime){interpolate();this._renderStartTime=timestamp+this._renderDuration}}}}}},{key:"capturePreviousSpriteProperties",value:function capturePreviousSpriteProperties(){var _this2=this;var setProperties=function setProperties(sprite){if(_this2.properties.position){sprite._previousX=sprite.x;sprite._previousY=sprite.y}if(_this2.properties.rotation){sprite._previousRotation=sprite.rotation}if(_this2.properties.size){sprite._previousWidth=sprite.width;sprite._previousHeight=sprite.height}if(_this2.properties.scale){sprite._previousScaleX=sprite.scale.x;sprite._previousScaleY=sprite.scale.y}if(_this2.properties.alpha){sprite._previousAlpha=sprite.alpha}if(_this2.properties.tile){if(sprite.tilePosition!==undefined){sprite._previousTilePositionX=sprite.tilePosition.x;sprite._previousTilePositionY=sprite.tilePosition.y}if(sprite.tileScale!==undefined){sprite._previousTileScaleX=sprite.tileScale.x;sprite._previousTileScaleY=sprite.tileScale.y}}if(sprite.children&&sprite.children.length>0){for(var i=0;i0){tilesetX+=spacing+spacing*((gid-1)%numberOfTilesetColumns);tilesetY+=spacing+spacing*Math.floor((gid-1)/numberOfTilesetColumns)}texture=_this3.frame(tileset,tilesetX,tilesetY,world.tilewidth,world.tileheight);var tileproperties=tiledMap.tilesets[0].tileproperties,key=String(gid-1);if(tileproperties[key]&&tileproperties[key].name){tileSprite=new _this3.Sprite(texture);Object.keys(tileproperties[key]).forEach(function(property){tileSprite[property]=tileproperties[key][property]});world.objects.push(tileSprite)}else{tileSprite=new _this3.Sprite(texture)}tileSprite.x=mapX;tileSprite.y=mapY;tileSprite.index=index;tileSprite.gid=gid;layerGroup.addChild(tileSprite)})()}})}if(tiledLayer.type==="objectgroup"){tiledLayer.objects.forEach(function(object){object.group=layerGroup;world.objects.push(object)})}});world.getObject=function(objectName){var searchForObject=function searchForObject(){var foundObject=undefined;world.objects.some(function(object){if(object.name&&object.name===objectName){foundObject=object;return true}});if(foundObject){return foundObject}else{throw new Error("There is no object with the property name: "+objectName)}};return searchForObject()};world.getObjects=function(objectNames){var foundObjects=[];world.objects.forEach(function(object){if(object.name&&objectNames.indexOf(object.name)!==-1){foundObjects.push(object)}});if(foundObjects.length>0){return foundObjects}else{throw new Error("I could not find those objects")}return foundObjects};return world}},{key:"byDepth",value:function byDepth(a,b){a.depth=(a.cartX+a.cartY)*(a.z+1);b.depth=(b.cartX+b.cartY)*(b.z+1);if(a.depthb.depth){return 1}else{return 0}}},{key:"hitTestIsoTile",value:function hitTestIsoTile(sprite,mapArray,gidToCheck,world,pointsToCheck){var _this4=this;var checkPoints=function checkPoints(key){var point=sprite.collisionPoints[key];collision.index=_this4.getIndex(point.x,point.y,world.cartTilewidth,world.cartTileheight,world.widthInTiles);collision.gid=mapArray[collision.index];if(collision.gid===gidToCheck){return true}else{return false}};pointsToCheck=pointsToCheck||"some";var collision={};switch(pointsToCheck){case"center":var point={center:{x:s.cartX+ca.x+ca.width/2,y:s.cartY+ca.y+ca.height/2}};sprite.collisionPoints=point;collision.hit=Object.keys(sprite.collisionPoints).some(checkPoints);break;case"every":sprite.collisionPoints=this.getIsoPoints(sprite);collision.hit=Object.keys(sprite.collisionPoints).every(checkPoints);break;case"some":sprite.collisionPoints=this.getIsoPoints(sprite);collision.hit=Object.keys(sprite.collisionPoints).some(checkPoints);break}return collision}},{key:"getIsoPoints",value:function getIsoPoints(s){var ca=s.collisionArea;if(ca!==undefined){return{topLeft:{x:s.cartX+ca.x,y:s.cartY+ca.y},topRight:{x:s.cartX+ca.x+ca.width,y:s.cartY+ca.y},bottomLeft:{x:s.cartX+ca.x,y:s.cartY+ca.y+ca.height},bottomRight:{x:s.cartX+ca.x+ca.width,y:s.cartY+ca.y+ca.height}}}else{return{topLeft:{x:s.cartX,y:s.cartY},topRight:{x:s.cartX+s.cartWidth-1,y:s.cartY},bottomLeft:{x:s.cartX,y:s.cartY+s.cartHeight-1},bottomRight:{x:s.cartX+s.cartWidth-1,y:s.cartY+s.cartHeight-1}}}}},{key:"makeIsoPointer",value:function makeIsoPointer(pointer,world){Object.defineProperties(pointer,{cartX:{get:function get(){var x=(2*this.y+this.x-(2*world.y+world.x))/2-world.cartTilewidth/2;return x},enumerable:true,configurable:true},cartY:{get:function get(){var y=(2*this.y-this.x-(2*world.y-world.x))/2+world.cartTileheight/2;return y},enumerable:true,configurable:true},column:{get:function get(){return Math.floor(this.cartX/world.cartTilewidth)},enumerable:true,configurable:true},row:{get:function get(){return Math.floor(this.cartY/world.cartTileheight)},enumerable:true,configurable:true},index:{get:function get(){var index={};index.x=Math.floor(this.cartX/world.cartTilewidth);index.y=Math.floor(this.cartY/world.cartTileheight);return index.x+index.y*world.widthInTiles},enumerable:true,configurable:true}})}},{key:"isoRectangle",value:function isoRectangle(width,height,fillStyle){var halfHeight=height/2;var rectangle=new this.Graphics;rectangle.beginFill(fillStyle);rectangle.moveTo(0,0);rectangle.lineTo(width,halfHeight);rectangle.lineTo(0,height);rectangle.lineTo(-width,halfHeight);rectangle.lineTo(0,0);rectangle.endFill();var texture=rectangle.generateTexture();var sprite=new this.Sprite(texture);return sprite}},{key:"addIsoProperties",value:function addIsoProperties(sprite,x,y,width,height){sprite.cartX=x;sprite.cartY=y;sprite.cartWidth=width;sprite.cartHeight=height;Object.defineProperties(sprite,{isoX:{get:function get(){return this.cartX-this.cartY},enumerable:true,configurable:true},isoY:{get:function get(){return(this.cartX+this.cartY)/2},enumerable:true,configurable:true}})}},{key:"makeIsoTiledWorld",value:function makeIsoTiledWorld(jsonTiledMap,tileset){var _this5=this;var tiledMap=PIXI.loader.resources[jsonTiledMap].data;if(!tiledMap.properties.cartTilewidth&&!tiledMap.properties.cartTileheight&&!tiledMao.properties.tileDepth){throw new Error("Set custom cartTilewidth, cartTileheight and tileDepth map properties in Tiled Editor")}var world=new this.Container;world.tileheight=parseInt(tiledMap.properties.tileDepth);world.tilewidth=tiledMap.tilewidth;world.cartTileheight=parseInt(tiledMap.properties.cartTileheight);world.cartTilewidth=parseInt(tiledMap.properties.cartTilewidth);world.worldWidth=tiledMap.width*world.cartTilewidth;world.worldHeight=tiledMap.height*world.cartTileheight;world.widthInTiles=tiledMap.width;world.heightInTiles=tiledMap.height;world.objects=[];var spacing=tiledMap.tilesets[0].spacing;var numberOfTilesetColumns=Math.floor(tiledMap.tilesets[0].imagewidth/(tiledMap.tilewidth+spacing));var z=0;tiledMap.layers.forEach(function(tiledLayer){var layerGroup=new _this5.Container;Object.keys(tiledLayer).forEach(function(key){if(key!=="width"&&key!=="height"){layerGroup[key]=tiledLayer[key]}});layerGroup.alpha=tiledLayer.opacity;world.addChild(layerGroup);world.objects.push(layerGroup);if(tiledLayer.type==="tilelayer"){tiledLayer.data.forEach(function(gid,index){var tileSprite=undefined,texture=undefined,mapX=undefined,mapY=undefined,tilesetX=undefined,tilesetY=undefined,mapColumn=undefined,mapRow=undefined,tilesetColumn=undefined,tilesetRow=undefined;if(gid!==0){(function(){mapColumn=index%world.widthInTiles;mapRow=Math.floor(index/world.widthInTiles);mapX=mapColumn*world.cartTilewidth;mapY=mapRow*world.cartTileheight;tilesetColumn=(gid-1)%numberOfTilesetColumns;tilesetRow=Math.floor((gid-1)/numberOfTilesetColumns);tilesetX=tilesetColumn*world.tilewidth;tilesetY=tilesetRow*world.tileheight;if(spacing>0){tilesetX+=spacing+spacing*((gid-1)%numberOfTilesetColumns);tilesetY+=spacing+spacing*Math.floor((gid-1)/numberOfTilesetColumns)}texture=_this5.frame(tileset,tilesetX,tilesetY,world.tilewidth,world.tileheight);var tileproperties=tiledMap.tilesets[0].tileproperties,key=String(gid-1);if(tileproperties[key]&&tileproperties[key].name){tileSprite=new _this5.Sprite(texture);Object.keys(tileproperties[key]).forEach(function(property){tileSprite[property]=tileproperties[key][property]});world.objects.push(tileSprite)}else{tileSprite=new _this5.Sprite(texture)}_this5.addIsoProperties(tileSprite,mapX,mapY,world.cartTilewidth,world.cartTileheight);tileSprite.x=tileSprite.isoX;tileSprite.y=tileSprite.isoY;tileSprite.z=z;tileSprite.index=index;tileSprite.gid=gid;layerGroup.addChild(tileSprite)})()}})}if(tiledLayer.type==="objectgroup"){tiledLayer.objects.forEach(function(object){object.group=layerGroup;world.objects.push(object)})}z+=1});world.getObject=function(objectName){var searchForObject=function searchForObject(){var foundObject=undefined;world.objects.some(function(object){if(object.name&&object.name===objectName){foundObject=object;return true}});if(foundObject){return foundObject}else{throw new Error("There is no object with the property name: "+objectName)}};return searchForObject()};world.getObjects=function(objectNames){var foundObjects=[];world.objects.forEach(function(object){if(object.name&&objectNames.indexOf(object.name)!==-1){foundObjects.push(object)}});if(foundObjects.length>0){return foundObjects}else{throw new Error("I could not find those objects")}return foundObjects};return world}},{key:"shortestPath",value:function shortestPath(startIndex,destinationIndex,mapArray,mapWidthInTiles){var obstacleGids=arguments.length<=4||arguments[4]===undefined?[]:arguments[4];var heuristic=arguments.length<=5||arguments[5]===undefined?"manhattan":arguments[5];var useDiagonalNodes=arguments.length<=6||arguments[6]===undefined?true:arguments[6];var nodes=function nodes(mapArray,mapWidthInTiles){return mapArray.map(function(cell,index){var column=index%mapWidthInTiles;var row=Math.floor(index/mapWidthInTiles);return node={f:0,g:0,h:0,parent:null,column:column,row:row,index:index}})};var theShortestPath=[];var nodeMap=nodes(mapArray,mapWidthInTiles);var closedList=[];var openList=[];var straightCost=10;var diagonalCost=14;var startNode=nodeMap[startIndex];var centerNode=startNode;openList.push(centerNode);var destinationNode=nodeMap[destinationIndex];var surroundingNodes=function surroundingNodes(index,mapArray,mapWidthInTiles,useDiagonalNodes){var allSurroundingNodes=[nodeMap[index-mapWidthInTiles-1],nodeMap[index-mapWidthInTiles],nodeMap[index-mapWidthInTiles+1],nodeMap[index-1],nodeMap[index+1],nodeMap[index+mapWidthInTiles-1],nodeMap[index+mapWidthInTiles],nodeMap[index+mapWidthInTiles+1]];var crossSurroundingNodes=[nodeMap[index-mapWidthInTiles],nodeMap[index-1],nodeMap[index+1],nodeMap[index+mapWidthInTiles]];var nodesToCheck=undefined;if(useDiagonalNodes){nodesToCheck=allSurroundingNodes}else{nodesToCheck=crossSurroundingNodes}var validSurroundingNodes=nodesToCheck.filter(function(node){var nodeIsWithinTopAndBottomBounds=node!==undefined;if(nodeIsWithinTopAndBottomBounds){var indexIsOnLeftBorder=index%mapWidthInTiles===0;var indexIsOnRightBorder=(index+1)%mapWidthInTiles===0;var nodeIsBeyondLeftBorder=node.column%(mapWidthInTiles-1)===0&&node.column!==0;var nodeIsBeyondRightBorder=node.column%mapWidthInTiles===0;var nodeContainsAnObstacle=obstacleGids.some(function(obstacle){return mapArray[node.index]===obstacle});if(indexIsOnLeftBorder){return!nodeIsBeyondLeftBorder}else if(indexIsOnRightBorder){return!nodeIsBeyondRightBorder}else if(nodeContainsAnObstacle){return false}else{return true}}});return validSurroundingNodes};var manhattan=function manhattan(testNode,destinationNode){var h=Math.abs(testNode.row-destinationNode.row)*straightCost+Math.abs(testNode.column-destinationNode.column)*straightCost;return h};var euclidean=function euclidean(testNode,destinationNode){var vx=destinationNode.column-testNode.column,vy=destinationNode.row-testNode.row,h=Math.floor(Math.sqrt(vx*vx+vy*vy)*straightCost);return h};var diagonal=function diagonal(testNode,destinationNode){var vx=Math.abs(destinationNode.column-testNode.column),vy=Math.abs(destinationNode.row-testNode.row),h=0;if(vx>vy){h=Math.floor(diagonalCost*vy+straightCost*(vx-vy))}else{h=Math.floor(diagonalCost*vx+straightCost*(vy-vx))}return h};while(centerNode!==destinationNode){var surroundingTestNodes=surroundingNodes(centerNode.index,mapArray,mapWidthInTiles,useDiagonalNodes);var _loop=function _loop(i){var testNode=surroundingTestNodes[i];var cost=0;if(centerNode.row===testNode.row||centerNode.column===testNode.column){cost=straightCost}else{cost=diagonalCost}var g=centerNode.g+cost;var h=undefined;switch(heuristic){case"manhattan":h=manhattan(testNode,destinationNode);break;case"euclidean":h=euclidean(testNode,destinationNode);break;case"diagonal":h=diagonal(testNode,destinationNode);break;default:throw new Error("Oops! It looks like you misspelled the name of the heuristic")}var f=g+h;var isOnOpenList=openList.some(function(node){return testNode===node});var isOnClosedList=closedList.some(function(node){return testNode===node});if(isOnOpenList||isOnClosedList){if(testNode.f>f){testNode.f=f;testNode.g=g;testNode.h=h;testNode.parent=centerNode}}else{testNode.f=f;testNode.g=g;testNode.h=h;testNode.parent=centerNode;openList.push(testNode)}};for(var i=0;i=Math.abs(vy)){if(vx<=0){return"left"}else{return"right"}}else{if(vy<=0){return"up"}else{return"down"}}}}}]);return TileUtilities}();var _createClass=function(){function defineProperties(target,props){for(var i=0;i0){this.spanElements=[];fontFiles.forEach(function(source){var fontFamily=source.split("/").pop().split(".")[0];if(_this.fontFamilies)_this.fontFamilies.push(fontFamily);var newStyle=document.createElement("style");var fontFace="@font-face {font-family: '"+fontFamily+"'; src: url('"+source+"');}";newStyle.appendChild(document.createTextNode(fontFace));document.head.appendChild(newStyle);var span=document.createElement("span");span.style.fontFamily=fontFamily;document.body.appendChild(span);span.innerHTML="?";span.style.display="block";span.style.opacity="0";_this.spanElements.push(span)})}var Resource=PIXI.loaders.Resource;Resource.setExtensionLoadType("wav",Resource.LOAD_TYPE.XHR);Resource.setExtensionLoadType("mp3",Resource.LOAD_TYPE.XHR);Resource.setExtensionLoadType("ogg",Resource.LOAD_TYPE.XHR);Resource.setExtensionLoadType("webm",Resource.LOAD_TYPE.XHR);Resource.setExtensionXhrType("wav",Resource.XHR_RESPONSE_TYPE.BUFFER);Resource.setExtensionXhrType("mp3",Resource.XHR_RESPONSE_TYPE.BUFFER);Resource.setExtensionXhrType("ogg",Resource.XHR_RESPONSE_TYPE.BUFFER);Resource.setExtensionXhrType("webm",Resource.XHR_RESPONSE_TYPE.BUFFER);var loadProgressHandler=function loadProgressHandler(loader,resource){_this.loadingFile=resource.url;_this.loadingProgress=loader.progress};this.loader.reset();this.loadingProgress=0;this.loadingFile="";this.loader.add(assetsToLoad).on("progress",loadProgressHandler).load(callbackFunction.bind(this))}},{key:"validateAssets",value:function validateAssets(){var _this2=this;console.log("All assets loaded");var finishLoadingState=function finishLoadingState(){_this2.assetsToLoad=[];_this2.loadState=undefined;_this2.state=undefined;if(_this2._progressBarAdded){_this2.progressBar.remove()}if(_this2.spanElements){_this2.spanElements.forEach(function(element){element.style.display="none"})}_this2.setupState()};var soundsToDecode=0,soundsDecoded=0;var soundExtensions=["wav","mp3","ogg","webm"];var decodeHandler=function decodeHandler(){soundsDecoded+=1;if(soundsToDecode===soundsDecoded){finishLoadingState()}};Object.keys(this.loader.resources).forEach(function(resource){var extension=resource.split(".").pop();if(soundExtensions.indexOf(extension)!==-1){soundsToDecode+=1;var xhr=_this2.loader.resources[resource].xhr,url=_this2.loader.resources[resource].url;var soundSprite=makeSound(url,decodeHandler.bind(_this2),false,xhr);soundSprite.name=_this2.loader.resources[resource].name;_this2.soundObjects[soundSprite.name]=soundSprite}});if(soundsToDecode===0){finishLoadingState()}}},{key:"update",value:function update(){this.modulesToUpdate.forEach(function(module){return module.update()});if(this.state&&!this.paused){this.state()}}},{key:"pause",value:function pause(){this.paused=true}},{key:"resume",value:function resume(){this.paused=false}},{key:"createModulePropertyAliases",value:function createModulePropertyAliases(){var _this3=this;this.Container=PIXI.Container;this.loader=PIXI.loader;this.TextureCache=PIXI.utils.TextureCache;this.filters=PIXI.filters;this.dropShadowFilter=function(){return new _this3.filters.DropShadowFilter};this.asciiFilter=function(){return new _this3.filters.AsciiFilter};this.alphaMaskFilter=function(){return new _this3.filters.AlphaMaskFilter};this.bloomFilter=function(){return new _this3.filters.BloomFilter};this.blurDirFilter=function(){return new _this3.filters.BlurDirFilter};this.blurFilter=function(){return new _this3.filters.BlurFilter};this.colorMatrixFilter=function(){return new _this3.filters.ColorMatrixFilter};this.colorStepFilter=function(){return new _this3.filters.ColorStepFilter};this.crossHatchFilter=function(){return new _this3.filters.CrossHatchFilter};this.displacementFilter=function(){return new _this3.filters.DisplacementFilter};this.dotScreenFilter=function(){return new _this3.filters.DotScreenFilter};this.grayFilter=function(){return new _this3.filters.GrayFilter};this.invertFilter=function(){return new _this3.filters.InvertFilter};this.pixelateFilter=function(){return new _this3.filters.PixelateFilter};this.sepiaFilter=function(){return new _this3.filters.SepiaFilter};this.shockwaveFilter=function(){return new _this3.filters.ShockwaveFilter};this.twistFilter=function(){return new _this3.filters.TwistFilter};this.rgbSplitFilter=function(){return new _this3.filters.RGBSplitFilter};this.smartBlurFilter=function(){return new _this3.filters.SmartBlurFilter};this.tiltShiftFilter=function(){return new _this3.filters.TiltShiftFilter};this.draggableSprites=this.tink.draggableSprites;this.pointers=this.tink.pointers;this.buttons=this.tink.buttons;this.makePointer=function(canvas,scale){return _this3.tink.makePointer(canvas,scale)};this.makeDraggable=function(){var _tink;return(_tink=_this3.tink).makeDraggable.apply(_tink,arguments)};this.makeUndraggable=function(){var _tink2;return(_tink2=_this3.tink).makeUndraggable.apply(_tink2,arguments)};this.makeInteractive=function(o){return _this3.tink.makeInteractive(o)};this.keyboard=this.tink.keyboard;this.arrowControl=function(sprite,speed){return _this3.tink.arrowControl(sprite,speed)};this.createParticles=function(x,y,spriteFunction,container,numberOfParticles,gravity,randomSpacing,minAngle,maxAngle,minSize,maxSize,minSpeed,maxSpeed,minScaleSpeed,maxScaleSpeed,minAlphaSpeed,maxAlphaSpeed,minRotationSpeed,maxRotationSpeed){return _this3.dust.create(x,y,spriteFunction,container,numberOfParticles,gravity,randomSpacing,minAngle,maxAngle,minSize,maxSize,minSpeed,maxSpeed,minScaleSpeed,maxScaleSpeed,minAlphaSpeed,maxAlphaSpeed,minRotationSpeed,maxRotationSpeed)};this.particleEmitter=function(interval,particleFunction){return _this3.dust.emitter(interval,particleFunction)};this.filmstrip=function(texture,frameWidth,frameHeight,spacing){return _this3.spriteUtilities.filmstrip(texture,frameWidth,frameHeight,spacing)};this.frame=function(source,x,y,width,height){return _this3.spriteUtilities.frame(source,x,y,width,height)};this.frames=function(source,coordinates,frameWidth,frameHeight){return _this3.spriteUtilities.frames(source,coordinates,frameWidth,frameHeight)};this.frameSeries=function(startNumber,endNumber,baseName,extension){return _this3.spriteUtilities.frames(startNumber,endNumber,baseName,extension)};this.colorToRGBA=function(value){return _this3.spriteUtilities.colorToRGBA(value)};this.colorToHex=function(value){return _this3.spriteUtilities.colorToHex(value)};this.byteToHex=function(value){return _this3.spriteUtilities.byteToHex(value)};this.color=function(value){return _this3.spriteUtilities.color(value)};this.shoot=function(shooter,angle,x,y,container,bulletSpeed,bulletArray,bulletSprite){return _this3.spriteUtilities.shoot(shooter,angle,x,y,container,bulletSpeed,bulletArray,bulletSprite)};this.shake=function(sprite){var magnitude=arguments.length<=1||arguments[1]===undefined?16:arguments[1];var angular=arguments.length<=2||arguments[2]===undefined?false:arguments[2];console.log("shake");return _this3.spriteUtilities.shake(sprite,magnitude,angular)};this.fadeOut=function(sprite){var frames=arguments.length<=1||arguments[1]===undefined?60:arguments[1];return _this3.charm.fadeOut(sprite,frames)};this.fadeIn=function(sprite){var frames=arguments.length<=1||arguments[1]===undefined?60:arguments[1];return _this3.charm.fadeIn(sprite,frames)};this.pulse=function(sprite){var frames=arguments.length<=1||arguments[1]===undefined?60:arguments[1];var minAlpha=arguments.length<=2||arguments[2]===undefined?0:arguments[2];return _this3.charm.pulse(sprite,frames,minAlpha)};this.slide=function(sprite,endX,endY){var frames=arguments.length<=3||arguments[3]===undefined?60:arguments[3];var type=arguments.length<=4||arguments[4]===undefined?"smoothstep":arguments[4];var yoyo=arguments.length<=5||arguments[5]===undefined?false:arguments[5];var delayBeforeRepeat=arguments.length<=6||arguments[6]===undefined?0:arguments[6];return _this3.charm.slide(sprite,endX,endY,frames,type,yoyo,delayBeforeRepeat=0)};this.breathe=function(sprite){var endScaleX=arguments.length<=1||arguments[1]===undefined?.8:arguments[1];var endScaleY=arguments.length<=2||arguments[2]===undefined?.8:arguments[2];var frames=arguments.length<=3||arguments[3]===undefined?60:arguments[3];var yoyo=arguments.length<=4||arguments[4]===undefined?true:arguments[4];var delayBeforeRepeat=arguments.length<=5||arguments[5]===undefined?0:arguments[5];return _this3.charm.breathe(sprite,endScaleX,endScaleY,frames,yoyo,delayBeforeRepeat)};this.scale=function(sprite){var endScaleX=arguments.length<=1||arguments[1]===undefined?.5:arguments[1];var endScaleY=arguments.length<=2||arguments[2]===undefined?.5:arguments[2];var frames=arguments.length<=3||arguments[3]===undefined?60:arguments[3];return _this3.charm.scale(sprite,endScaleX,endScaleY,frames)};this.strobe=function(sprite){var scaleFactor=arguments.length<=1||arguments[1]===undefined?1.3:arguments[1];var startMagnitude=arguments.length<=2||arguments[2]===undefined?10:arguments[2];var endMagnitude=arguments.length<=3||arguments[3]===undefined?20:arguments[3];var frames=arguments.length<=4||arguments[4]===undefined?10:arguments[4];var yoyo=arguments.length<=5||arguments[5]===undefined?true:arguments[5];var delayBeforeRepeat=arguments.length<=6||arguments[6]===undefined?0:arguments[6];return _this3.charm.strobe(sprite,scaleFactor,startMagnitude,endMagnitude,frames,yoyo,delayBeforeRepeat)};this.wobble=function(sprite){var scaleFactorX=arguments.length<=1||arguments[1]===undefined?1.2:arguments[1];var scaleFactorY=arguments.length<=2||arguments[2]===undefined?1.2:arguments[2];var frames=arguments.length<=3||arguments[3]===undefined?10:arguments[3];var xStartMagnitude=arguments.length<=4||arguments[4]===undefined?10:arguments[4];var xEndMagnitude=arguments.length<=5||arguments[5]===undefined?10:arguments[5];var yStartMagnitude=arguments.length<=6||arguments[6]===undefined?-10:arguments[6];var yEndMagnitude=arguments.length<=7||arguments[7]===undefined?-10:arguments[7];var friction=arguments.length<=8||arguments[8]===undefined?.98:arguments[8];var yoyo=arguments.length<=9||arguments[9]===undefined?true:arguments[9];var delayBeforeRepeat=arguments.length<=10||arguments[10]===undefined?0:arguments[10];return _this3.charm.wobble(sprite,scaleFactorX=1.2,scaleFactorY=1.2,frames=10,xStartMagnitude=10,xEndMagnitude=10,yStartMagnitude=-10,yEndMagnitude=-10,friction=.98,yoyo=true,delayBeforeRepeat=0)};this.followCurve=function(sprite,pointsArray,totalFrames){var type=arguments.length<=3||arguments[3]===undefined?"smoothstep":arguments[3];var yoyo=arguments.length<=4||arguments[4]===undefined?false:arguments[4];var delayBeforeRepeat=arguments.length<=5||arguments[5]===undefined?0:arguments[5];return _this3.charm.followCurve(sprite,pointsArray,totalFrames,type,yoyo,delayBeforeRepeat)};this.walkPath=function(sprite,originalPathArray){var totalFrames=arguments.length<=2||arguments[2]===undefined?300:arguments[2];var type=arguments.length<=3||arguments[3]===undefined?"smoothstep":arguments[3];var loop=arguments.length<=4||arguments[4]===undefined?false:arguments[4];var yoyo=arguments.length<=5||arguments[5]===undefined?false:arguments[5];var delayBetweenSections=arguments.length<=6||arguments[6]===undefined?0:arguments[6];return _this3.charm.walkPath(sprite,originalPathArray,totalFrames,type,loop,yoyo,delayBetweenSections)};this.walkCurve=function(sprite,pathArray){var totalFrames=arguments.length<=2||arguments[2]===undefined?300:arguments[2];var type=arguments.length<=3||arguments[3]===undefined?"smoothstep":arguments[3];var loop=arguments.length<=4||arguments[4]===undefined?false:arguments[4];var yoyo=arguments.length<=5||arguments[5]===undefined?false:arguments[5];var delayBeforeContinue=arguments.length<=6||arguments[6]===undefined?0:arguments[6];return _this3.charm.walkCurve(sprite,pathArray,totalFrames,type,loop,yoyo,delayBeforeContinue)};this.removeTween=function(tweenObject){return _this3.charm.removeTween(tweenObject)};this.makeTween=function(tweensToAdd){return _this3.charm.makeTween(tweensToAdd)};this.tweenProperty=function(sprite,property,startValue,endValue,totalFrames){var type=arguments.length<=5||arguments[5]===undefined?"smoothstep":arguments[5];var yoyo=arguments.length<=6||arguments[6]===undefined?false:arguments[6];var delayBeforeRepeat=arguments.length<=7||arguments[7]===undefined?0:arguments[7];return _this3.charm.tweenProperty(sprite,property,startValue,endValue,totalFrames,type,yoyo,delayBeforeRepeat)};this.hitTestPoint=function(point,sprite){return _this3.bump.hitTestPoint(point,sprite)};this.hitTestCircle=function(c1,c2){var global=arguments.length<=2||arguments[2]===undefined?false:arguments[2];return _this3.bump.hitTestCircle(c1,c2,global)};this.circleCollision=function(c1,c2){var bounce=arguments.length<=2||arguments[2]===undefined?false:arguments[2];var global=arguments.length<=3||arguments[3]===undefined?false:arguments[3];return _this3.bump.circleCollision(c1,c2,bounce,global)};this.movingCircleCollision=function(c1,c2){var global=arguments.length<=2||arguments[2]===undefined?false:arguments[2];return _this3.bump.movingCircleCollision(c1,c2,global)};this.multipleCircleCollision=function(arrayOfCircles){var global=arguments.length<=1||arguments[1]===undefined?false:arguments[1];return _this3.bump.multipleCircleCollision(arrayOfCircles,global)};this.rectangleCollision=function(r1,r2){var bounce=arguments.length<=2||arguments[2]===undefined?false:arguments[2];var global=arguments.length<=3||arguments[3]===undefined?true:arguments[3];return _this3.bump.rectangleCollision(r1,r2,bounce,global)};this.hitTestRectangle=function(r1,r2){var global=arguments.length<=2||arguments[2]===undefined?false:arguments[2];return _this3.bump.hitTestRectangle(r1,r2,global)};this.hitTestCircleRectangle=function(c1,r1){var global=arguments.length<=2||arguments[2]===undefined?false:arguments[2];return _this3.bump.hitTestCircleRectangle(c1,r1,global)};this.hitTestCirclePoint=function(c1,point){var global=arguments.length<=2||arguments[2]===undefined?false:arguments[2];return _this3.bump.hitTestCirclePoint(c1,point,global)};this.circleRectangleCollision=function(c1,r1){var bounce=arguments.length<=2||arguments[2]===undefined?false:arguments[2];var global=arguments.length<=3||arguments[3]===undefined?false:arguments[3];return _this3.bump.circleRectangleCollision(c1,r1,bounce,global)};this.circlePointCollision=function(c1,point){var bounce=arguments.length<=2||arguments[2]===undefined?false:arguments[2];var global=arguments.length<=3||arguments[3]===undefined?false:arguments[3];return _this3.bump.circlePointCollision(c1,point,bounce,global)};this.bounceOffSurface=function(o,s){return _this3.bump.bounceOffSurface(o,s)};this.hit=function(a,b){var react=arguments.length<=2||arguments[2]===undefined?false:arguments[2];var bounce=arguments.length<=3||arguments[3]===undefined?false:arguments[3];var global=arguments[4];var extra=arguments.length<=5||arguments[5]===undefined?undefined:arguments[5];return _this3.bump.hit(a,b,react,bounce,global,extra)};this.shortestPath=function(startIndex,destinationIndex,mapArray,mapWidthInTiles){var obstacleGids=arguments.length<=4||arguments[4]===undefined?[]:arguments[4];var heuristic=arguments.length<=5||arguments[5]===undefined?"manhattan":arguments[5];var useDiagonalNodes=arguments.length<=6||arguments[6]===undefined?true:arguments[6];return _this3.tileUtilities.shortestPath(startIndex,destinationIndex,mapArray,mapWidthInTiles,obstacleGids,heuristic,useDiagonalNodes)};this.tileBasedLineOfSight=function(spriteOne,spriteTwo,mapArray,world){var emptyGid=arguments.length<=4||arguments[4]===undefined?0:arguments[4];var segment=arguments.length<=5||arguments[5]===undefined?32:arguments[5];var angles=arguments.length<=6||arguments[6]===undefined?[]:arguments[6];return _this3.tileUtilities.tileBasedLineOfSight(spriteOne,spriteTwo,mapArray,world,emptyGid,segment,angles)};this.contain=function(sprite,container){var bounce=arguments.length<=2||arguments[2]===undefined?false:arguments[2];var extra=arguments.length<=3||arguments[3]===undefined?undefined:arguments[3];var o={};if(container._stage){o=_this3.compensateForStageSize(container)}else{o=container}return _this3.bump.contain(sprite,o,bounce,extra)};this.outsideBounds=function(sprite,container){var extra=arguments.length<=2||arguments[2]===undefined?undefined:arguments[2];var o={};if(container._stage){o=_this3.compensateForStageSize(container)}else{o=container}return _this3.bump.outsideBounds(sprite,o,extra)};this.distance=function(s1,s2){return _this3.gameUtilities.distance(s1,s2)};this.followEase=function(follower,leader,speed){return _this3.gameUtilities.followEase(follower,leader,speed)};this.followConstant=function(follower,leader,speed){return _this3.gameUtilities.followConstant(follower,leader,speed)};this.angle=function(s1,s2){return _this3.gameUtilities.angle(s1,s2)};this.rotateAroundSprite=function(rotatingSprite,centerSprite,distance,angle){return _this3.gameUtilities.rotateAroundSprite(rotatingSprite,centerSprite,distance,angle)};this.rotateAroundPoint=this.gameUtilities.rotateAroundPoint;this.randomInt=this.gameUtilities.randomInt;this.randomFloat=this.gameUtilities.randomFloat;this.move=this.gameUtilities.move;this.wait=this.gameUtilities.wait;this.worldCamera=function(world,worldWidth,worldHeight){var canvas=arguments.length<=3||arguments[3]===undefined?_this3.canvas:arguments[3];return _this3.gameUtilities.worldCamera(world,worldWidth,worldHeight,canvas)};this.lineOfSight=function(spriteOne,spriteTwo,obstacles){var segment=arguments.length<=3||arguments[3]===undefined?32:arguments[3];return _this3.gameUtilities.lineOfSight(spriteOne,spriteTwo,obstacles,segment)};this.soundEffect=function(frequencyValue,attack,decay,type,volumeValue,panValue,wait,pitchBendAmount,reverse,randomValue,dissonance,echo,reverb){return soundEffect(frequencyValue,attack,decay,type,volumeValue,panValue,wait,pitchBendAmount,reverse,randomValue,dissonance,echo,reverb)};this.hitTestTile=function(sprite,mapArray,gidToCheck,world,pointsToCheck){return _this3.tileUtilities.hitTestTile(sprite,mapArray,gidToCheck,world,pointsToCheck)};this.getIndex=function(x,y,tilewidth,tileheight,mapWidthInTiles){return _this3.tileUtilities.getIndex(x,y,tilewidth,tileheight,mapWidthInTiles)};this.getTile=this.tileUtilities.getTile;this.surroundingCells=this.tileUtilities.surroundingCells;this.getPoints=this.tileUtilities.getPoints;this.updateMap=function(mapArray,spritesToUpdate,world){return _this3.tileUtilities.updateMap(mapArray,spritesToUpdate,world)};this.byDepth=this.tileUtilities.byDepth;this.hitTestIsoTile=function(sprite,mapArray,gidToCheck,world,pointsToCheck){return _this3.tileUtilities.hitTestIsoTile(sprite,mapArray,gidToCheck,world,pointsToCheck)};this.getIsoPoints=this.tileUtilities.getIsoPoints;this.makeIsoPointer=function(pointer,world){return _this3.tileUtilities.makeIsoPointer(pointer,world)};this.isoRectangle=function(width,height,fillStyle){return _this3.tileUtilities.isoRectangle(width,height,fillStyle)};this.addIsoProperties=function(sprite,x,y,width,height){return _this3.tileUtilities.addIsoProperties(sprite,x,y,width,height)};this.makeIsoTiledWorld=function(jsonTiledMap,tileset){return _this3.tileUtilities.makeIsoTiledWorld(jsonTiledMap,tileset)}}},{key:"sprite",value:function sprite(source){var x=arguments.length<=1||arguments[1]===undefined?0:arguments[1];var y=arguments.length<=2||arguments[2]===undefined?0:arguments[2];var tiling=arguments.length<=3||arguments[3]===undefined?false:arguments[3];var width=arguments[4];var height=arguments[5];var o=this.spriteUtilities.sprite(source,x,y,tiling,width,height);this.addProperties(o);this.stage.addChild(o);return o}},{key:"tilingSprite",value:function tilingSprite(source,width,height){var x=arguments.length<=3||arguments[3]===undefined?0:arguments[3];var y=arguments.length<=4||arguments[4]===undefined?0:arguments[4];var o=this.spriteUtilities.tilingSprite(source,width,height,x,y);this.addProperties(o);this.stage.addChild(o);return o}},{key:"text",value:function text(){var content=arguments.length<=0||arguments[0]===undefined?"message":arguments[0];var font=arguments.length<=1||arguments[1]===undefined?"16px sans":arguments[1];var fillStyle=arguments.length<=2||arguments[2]===undefined?"red":arguments[2];var x=arguments.length<=3||arguments[3]===undefined?0:arguments[3];var y=arguments.length<=4||arguments[4]===undefined?0:arguments[4];var message=this.spriteUtilities.text(content,font,fillStyle,x,y);this.addProperties(message);this.stage.addChild(message);return message}},{key:"bitmapText",value:function bitmapText(){var content=arguments.length<=0||arguments[0]===undefined?"message":arguments[0];var font=arguments[1];var align=arguments[2];var tint=arguments[3];var x=arguments.length<=4||arguments[4]===undefined?0:arguments[4];var y=arguments.length<=5||arguments[5]===undefined?0:arguments[5];var message=this.spriteUtilities.bitmapText(content,font,align,tint,x,y);this.addProperties(message);this.stage.addChild(message);return message}},{key:"rectangle",value:function rectangle(){var width=arguments.length<=0||arguments[0]===undefined?32:arguments[0];var height=arguments.length<=1||arguments[1]===undefined?32:arguments[1];var fillStyle=arguments.length<=2||arguments[2]===undefined?16724736:arguments[2];var strokeStyle=arguments.length<=3||arguments[3]===undefined?13260:arguments[3];var lineWidth=arguments.length<=4||arguments[4]===undefined?0:arguments[4];var x=arguments.length<=5||arguments[5]===undefined?0:arguments[5];var y=arguments.length<=6||arguments[6]===undefined?0:arguments[6];var o=this.spriteUtilities.rectangle(width,height,fillStyle,strokeStyle,lineWidth,x,y);this.addProperties(o);this.stage.addChild(o);return o}},{key:"circle",value:function circle(){var diameter=arguments.length<=0||arguments[0]===undefined?32:arguments[0];var fillStyle=arguments.length<=1||arguments[1]===undefined?16724736:arguments[1];var strokeStyle=arguments.length<=2||arguments[2]===undefined?13260:arguments[2];var lineWidth=arguments.length<=3||arguments[3]===undefined?0:arguments[3];var x=arguments.length<=4||arguments[4]===undefined?0:arguments[4];var y=arguments.length<=5||arguments[5]===undefined?0:arguments[5];var o=this.spriteUtilities.circle(diameter,fillStyle,strokeStyle,lineWidth,x,y);this.addProperties(o);o.circular=true;this.stage.addChild(o);return o}},{key:"line",value:function line(){var strokeStyle=arguments.length<=0||arguments[0]===undefined?0:arguments[0];var lineWidth=arguments.length<=1||arguments[1]===undefined?1:arguments[1];var ax=arguments.length<=2||arguments[2]===undefined?0:arguments[2];var ay=arguments.length<=3||arguments[3]===undefined?0:arguments[3];var bx=arguments.length<=4||arguments[4]===undefined?32:arguments[4];var by=arguments.length<=5||arguments[5]===undefined?32:arguments[5];var o=this.spriteUtilities.line(strokeStyle,lineWidth,ax,ay,bx,by);this.addProperties(o);this.stage.addChild(o);return o}},{key:"button",value:function button(source,x,y){var o=this.tink.button(source,x,y);this.addProperties(o);this.stage.addChild(o);return o}},{key:"group",value:function group(){var _spriteUtilities;var o=(_spriteUtilities=this.spriteUtilities).group.apply(_spriteUtilities,arguments);this.addProperties(o);this.stage.addChild(o);return o}},{key:"batch",value:function batch(size,options){var o=this.spriteUtilities.batch(size,options);this.addProperties(o);this.stage.addChild(o);return o}},{key:"grid",value:function grid(){var columns=arguments.length<=0||arguments[0]===undefined?0:arguments[0];var rows=arguments.length<=1||arguments[1]===undefined?0:arguments[1];var cellWidth=arguments.length<=2||arguments[2]===undefined?32:arguments[2];var cellHeight=arguments.length<=3||arguments[3]===undefined?32:arguments[3];var centerCell=arguments.length<=4||arguments[4]===undefined?false:arguments[4];var xOffset=arguments.length<=5||arguments[5]===undefined?0:arguments[5];var yOffset=arguments.length<=6||arguments[6]===undefined?0:arguments[6];var makeSprite=arguments.length<=7||arguments[7]===undefined?undefined:arguments[7];var extra=arguments.length<=8||arguments[8]===undefined?undefined:arguments[8];var o=this.spriteUtilities.grid(columns,rows,cellWidth,cellHeight,centerCell,xOffset,yOffset,makeSprite,extra);this.addProperties(o);this.stage.addChild(o);return o}},{key:"makeTiledWorld",value:function makeTiledWorld(jsonTiledMap,tileset){var _this4=this;var o=this.tileUtilities.makeTiledWorld(jsonTiledMap,tileset);this.addProperties(o);var addHexiSpriteProperties=function addHexiSpriteProperties(object){_this4.addProperties(object);if(object.children){if(object.children.length>0){object.children.forEach(function(child){addHexiSpriteProperties(child)})}}};if(o.children){if(o.children.length>0){ o.children.forEach(function(child){addHexiSpriteProperties(child)})}}this.stage.addChild(o);return o}},{key:"remove",value:function remove(){var _spriteUtilities2;(_spriteUtilities2=this.spriteUtilities).remove.apply(_spriteUtilities2,arguments)}},{key:"flowRight",value:function flowRight(padding){var flowSprites=function flowSprites(spritesToFlow){if(spritesToFlow.length>0){for(var i=0;i1?_len-1:0),_key=1;_key<_len;_key++){sprites[_key-1]=arguments[_key]}if(!(sprites[0]instanceof Array)){flowSprites(sprites)}else{var spritesArray=sprites[0];flowSprites(spritesArray)}}},{key:"flowDown",value:function flowDown(padding){var flowSprites=function flowSprites(spritesToFlow){if(spritesToFlow.length>0){for(var i=0;i1?_len2-1:0),_key2=1;_key2<_len2;_key2++){sprites[_key2-1]=arguments[_key2]}if(!(sprites[0]instanceof Array)){flowSprites(sprites)}else{var spritesArray=sprites[0];flowSprites(spritesArray)}}},{key:"flowLeft",value:function flowLeft(padding){var flowSprites=function flowSprites(spritesToFlow){if(spritesToFlow.length>0){for(var i=0;i1?_len3-1:0),_key3=1;_key3<_len3;_key3++){sprites[_key3-1]=arguments[_key3]}if(!(sprites[0]instanceof Array)){flowSprites(sprites)}else{var spritesArray=sprites[0];flowSprites(spritesArray)}}},{key:"flowUp",value:function flowUp(padding){var flowSprites=function flowSprites(spritesToFlow){if(spritesToFlow.length>0){for(var i=0;i1?_len4-1:0),_key4=1;_key4<_len4;_key4++){sprites[_key4-1]=arguments[_key4]}if(!(sprites[0]instanceof Array)){flowSprites(sprites)}else{var spritesArray=sprites[0];flowSprites(spritesArray)}}},{key:"addProperties",value:function addProperties(o){var _this5=this;o.vx=0;o.vy=0;o._layer=0;o._circular=false;o._interact=false;o._draggable=false;o._bumpPropertiesAdded=true;o.swapChildren=function(child1,child2){var index1=o.children.indexOf(child1),index2=o.children.indexOf(child2);if(index1!==-1&&index2!==-1){child1.childIndex=index2;child2.childIndex=index1;o.children[index1]=child2;o.children[index2]=child1}else{throw new Error(child+" Both objects must be a child of the caller "+o)}};o.add=function(){for(var _len5=arguments.length,sprites=Array(_len5),_key5=0;_key5<_len5;_key5++){sprites[_key5]=arguments[_key5]}if(sprites.length>1){sprites.forEach(function(sprite){return o.addChild(sprite)})}else{o.addChild(sprites[0])}};o.remove=function(){for(var _len6=arguments.length,sprites=Array(_len6),_key6=0;_key6<_len6;_key6++){sprites[_key6]=arguments[_key6]}if(sprites.length>1){sprites.forEach(function(sprite){return o.removeChild(sprite)})}else{o.removeChild(sprites[0])}};var a=o;var nudgeAnchor=function nudgeAnchor(o,value,axis){if(o.anchor!==undefined){if(o.anchor[axis]!==0){return value*(1-o.anchor[axis]-o.anchor[axis])}else{return value}}else{return value}};var compensateForAnchor=function compensateForAnchor(o,value,axis){if(o.anchor!==undefined){if(o.anchor[axis]!==0){return value*o.anchor[axis]}else{return 0}}else{return 0}};var compensateForAnchors=function compensateForAnchors(a,b,property1,property2){return compensateForAnchor(a,a[property1],property2)+compensateForAnchor(b,b[property1],property2)};o.putCenter=function(b){var xOffset=arguments.length<=1||arguments[1]===undefined?0:arguments[1];var yOffset=arguments.length<=2||arguments[2]===undefined?0:arguments[2];if(o._stage)a=_this5.compensateForStageSize(o);b.x=a.x+nudgeAnchor(a,a.halfWidth,"x")-nudgeAnchor(b,b.halfWidth,"x")+xOffset;b.y=a.y+nudgeAnchor(a,a.halfHeight,"y")-nudgeAnchor(b,b.halfHeight,"y")+yOffset;if(!o._stage)o.compensateForParentPosition(a,b)};o.putLeft=function(b){var xOffset=arguments.length<=1||arguments[1]===undefined?0:arguments[1];var yOffset=arguments.length<=2||arguments[2]===undefined?0:arguments[2];if(o._stage)a=_this5.compensateForStageSize(o);b.x=a.x-nudgeAnchor(b,b.width,"x")+xOffset-compensateForAnchors(a,b,"width","x");b.y=a.y+nudgeAnchor(a,a.halfHeight,"y")-nudgeAnchor(b,b.halfHeight,"y")+yOffset;if(!o._stage)o.compensateForParentPosition(a,b)};o.putTop=function(b){var xOffset=arguments.length<=1||arguments[1]===undefined?0:arguments[1];var yOffset=arguments.length<=2||arguments[2]===undefined?0:arguments[2];if(o._stage)a=_this5.compensateForStageSize(o);b.x=a.x+nudgeAnchor(a,a.halfWidth,"x")-nudgeAnchor(b,b.halfWidth,"x")+xOffset;b.y=a.y-nudgeAnchor(b,b.height,"y")+yOffset-compensateForAnchors(a,b,"height","y");if(!o._stage)o.compensateForParentPosition(a,b)};o.putRight=function(b){var xOffset=arguments.length<=1||arguments[1]===undefined?0:arguments[1];var yOffset=arguments.length<=2||arguments[2]===undefined?0:arguments[2];if(o._stage)a=_this5.compensateForStageSize(o);b.x=a.x+nudgeAnchor(a,a.width,"x")+xOffset+compensateForAnchors(a,b,"width","x");b.y=a.y+nudgeAnchor(a,a.halfHeight,"y")-nudgeAnchor(b,b.halfHeight,"y")+yOffset;if(!o._stage)o.compensateForParentPosition(a,b)};o.putBottom=function(b){var xOffset=arguments.length<=1||arguments[1]===undefined?0:arguments[1];var yOffset=arguments.length<=2||arguments[2]===undefined?0:arguments[2];if(o._stage)a=_this5.compensateForStageSize(o);b.x=a.x+nudgeAnchor(a,a.halfWidth,"x")-nudgeAnchor(b,b.halfWidth,"x")+xOffset;b.y=a.y+nudgeAnchor(a,a.height,"y")+yOffset+compensateForAnchors(a,b,"height","y");if(!o._stage)o.compensateForParentPosition(a,b)};o.compensateForParentPosition=function(a,b){if(b.parent.gx!==0||b.parent.gy!==0){b.x-=a.gx;b.y-=a.gy}};var self=this;Object.defineProperties(o,{gx:{get:function get(){return o.getGlobalPosition().x},enumerable:true,configurable:true},gy:{get:function get(){return o.getGlobalPosition().y},enumerable:true,configurable:true},centerX:{get:function get(){return o.x+o.width/2-o.xAnchorOffset},enumerable:true,configurable:true},centerY:{get:function get(){return o.y+o.height/2-o.yAnchorOffset},enumerable:true,configurable:true},halfWidth:{get:function get(){return o.width/2},enumerable:true,configurable:true},halfHeight:{get:function get(){return o.height/2},enumerable:true,configurable:true},scaleModeNearest:{set:function set(value){if(o.texture.baseTexture){if(value){o.texture.baseTexture.scaleMode=PIXI.SCALE_MODES.NEAREST}else{o.texture.baseTexture.scaleMode=PIXI.SCALE_MODES.LINEAR}}else{throw new Error("The scale mode of "+o+" cannot be modified")}},enumerable:true,configurable:true},pivotX:{get:function get(){return o.anchor.x},set:function set(value){if(o.anchor===undefined){throw new Error(o+" does not have a PivotX value")}o.anchor.x=value;if(!o._previousPivotX){o.x+=value*o.width}else{o.x+=(value-o._previousPivotX)*o.width}o._previousPivotX=value},enumerable:true,configurable:true},pivotY:{get:function get(){return o.anchor.y},set:function set(value){if(o.anchor===undefined){throw new Error(o+" does not have a PivotY value")}o.anchor.y=value;if(!o._previousPivotY){o.y+=value*o.height}else{o.y+=(value-o._previousPivotY)*o.height}o._previousPivotY=value},enumerable:true,configurable:true},xAnchorOffset:{get:function get(){if(o.anchor!==undefined){return o.height*o.anchor.x}else{return 0}},enumerable:true,configurable:true},yAnchorOffset:{get:function get(){if(o.anchor!==undefined){return o.width*o.anchor.y}else{return 0}},enumerable:true,configurable:true},scaleX:{get:function get(){return o.scale.x},set:function set(value){o.scale.x=value},enumerable:true,configurable:true},scaleY:{get:function get(){return o.scale.y},set:function set(value){o.scale.y=value},enumerable:true,configurable:true},layer:{get:function get(){return o._layer},set:function set(value){o._layer=value;if(o.parent){o.parent.children.sort(function(a,b){return a.layer-b.layer})}},enumerable:true,configurable:true},interact:{get:function get(){return o._interact},set:function set(value){if(value===true){if(!o._interact){self.makeInteractive(o);o._interact=true}}else{if(self.tink.buttons.indexOf(o)!==-1){self.tink.buttons.splice(self.tink.buttons.indexOf(o),1);o._interact=false}}},enumerable:true,configurable:true},draggable:{get:function get(){return o._draggable},set:function set(value){if(value===true){if(!o._draggable){self.makeDraggable(o);o._draggable=true}}else{self.makeUndraggable(o);o._draggable=false}},enumerable:true,configurable:true},localBounds:{get:function get(){return{x:0,y:0,width:o.width,height:o.height}},enumerable:true,configurable:true},globalBounds:{get:function get(){return{x:o.gx,y:o.gy,width:o.gx+o.width,height:o.gy+o.height}},enumerable:true,configurable:true},empty:{get:function get(){if(o.children.length===0){return true}else{return false}},enumerable:true,configurable:true},circular:{get:function get(){return o._circular},set:function set(value){if(value===true&&o._circular===false){Object.defineProperties(o,{diameter:{get:function get(){return o.width},set:function set(value){o.width=value;o.height=value},enumerable:true,configurable:true},radius:{get:function get(){return o.halfWidth},set:function set(value){o.width=value*2;o.height=value*2},enumerable:true,configurable:true}});o._circular=true}if(value===false&&o._circular===true){delete o.diameter;delete o.radius;o._circular=false}},enumerable:true,configurable:true}});o.setPosition=function(x,y){o.x=x;o.y=y};o.setScale=function(xScale,yScale){o.scale.x=xScale;o.scale.y=yScale};o.setPivot=function(xPivot,yPivot){o.pivotX=xPivot;o.pivotY=yPivot};if(o.circular){Object.defineProperty(o,"radius",{get:function get(){return o.width/2},enumerable:true,configurable:true})}}},{key:"scaleToWindow",value:function(_scaleToWindow){function scaleToWindow(){return _scaleToWindow.apply(this,arguments)}scaleToWindow.toString=function(){return _scaleToWindow.toString()};return scaleToWindow}(function(){var _this6=this;var scaleBorderColor=arguments.length<=0||arguments[0]===undefined?"#2C3539":arguments[0];var newStyle=document.createElement("style");var style="* {padding: 0; margin: 0}";newStyle.appendChild(document.createTextNode(style));document.head.appendChild(newStyle);this.scale=scaleToWindow(this.canvas,scaleBorderColor);this.pointer.scale=this.scale;console.log(this.pointer);window.addEventListener("resize",function(event){_this6.scale=scaleToWindow(_this6.canvas,scaleBorderColor);_this6.pointer.scale=_this6.scale});this.canvas.scaled=true})},{key:"log",value:function log(value){return console.log(value)}},{key:"makeProgressBar",value:function makeProgressBar(hexiObject){var hexi=hexiObject;hexi.progressBar={maxWidth:0,height:0,backgroundColor:"0x808080",foregroundColor:"0x00FFFF",backBar:null,frontBar:null,percentage:null,assets:null,initialized:false,create:function create(){this.maxWidth=hexi.canvas.width/2;this.backBar=hexi.rectangle(this.maxWidth,32,this.backgroundColor);this.backBar.x=hexi.canvas.width/2-this.maxWidth/2;this.backBar.y=hexi.canvas.height/2-16;this.frontBar=hexi.rectangle(this.maxWidth,32,this.foregroundColor);this.frontBar.x=hexi.canvas.width/2-this.maxWidth/2;this.frontBar.y=hexi.canvas.height/2-16;this.percentage=hexi.text("0%","28px sans-serif","black");this.percentage.x=hexi.canvas.width/2-this.maxWidth/2+12;this.percentage.y=hexi.canvas.height/2-17},update:function update(){var ratio=hexi.loadingProgress/100;this.frontBar.width=this.maxWidth*ratio;this.percentage.content=Math.round(hexi.loadingProgress)+" %"},remove:function remove(){hexi.stage.removeChild(this.frontBar);hexi.stage.removeChild(this.backBar);hexi.stage.removeChild(this.percentage)}}}},{key:"loadingBar",value:function loadingBar(){if(!this._progressBarAdded){this.makeProgressBar(this);this.progressBar.create();this._progressBarAdded=true}else{this.progressBar.update()}}},{key:"compensateForStageSize",value:function compensateForStageSize(o){if(o._stage===true){var a={};a.x=0;a.y=0;a.width=this.canvas.width;a.height=this.canvas.height;a.halfWidth=this.canvas.width/2;a.halfHeight=this.canvas.height/2;a.xAnchorOffset=0;a.yAnchorOffset=0;return a}}},{key:"image",value:function image(imageFileName){if(this.TextureCache[imageFileName]){return this.TextureCache[imageFileName]}else{throw new Error(imageFileName+" does not appear to be an image")}}},{key:"id",value:function id(textureAtlasFrameId){if(this.TextureCache[textureAtlasFrameId]){return this.TextureCache[textureAtlasFrameId]}else{throw new Error(textureAtlasFrameId+" does not appear to be a texture atlas frame id")}}},{key:"json",value:function json(jsonFileName){if(this.loader.resources[jsonFileName].data){return this.resources[jsonFileName].data}else{throw new Error(jsonFileName+" does not appear to be a JSON data file")}}},{key:"xml",value:function xml(xmlFileName){if(this.loader.resources[xmlFileName].data){return this.resources[xmlFileName].data}else{throw new Error(xmlFileName+" does not appear to be a XML data file")}}},{key:"sound",value:function sound(soundFileName){if(this.soundObjects[soundFileName]){return this.soundObjects[soundFileName]}else{throw new Error(soundFileName+" does not appear to be a sound object")}}},{key:"resources",get:function get(){return this.loader.resources}},{key:"fps",get:function get(){return this.smoothie.fps},set:function set(value){this.smoothie.fps=value}},{key:"renderFps",get:function get(){return this.smoothie.renderFps},set:function set(value){this.smoothie.renderFps=value}},{key:"interpolate",get:function get(){return this.smoothie.interpolate},set:function set(value){this.smoothie.interpolate=value}},{key:"interpolationProperties",get:function get(){return this.smoothie.properties},set:function set(value){this.smoothie.properties=value}},{key:"border",set:function set(value){this.canvas.style.border=value}},{key:"backgroundColor",set:function set(value){this.renderer.backgroundColor=this.color(value)}}]);return Hexi}();