Your REAL Website Traffic Is Here.

Your REAL Website Traffic Is Here.

HOW IT WORKS

HOW IT WORKS

We have traffic that will change the dynamic of all your internet efforts.  And  when you have real traffic, you get the kind of results that dreams are made of.  And internet Marketing gets real fun all of a sudden.

We have traffic that will change the dynamic of all your internet efforts.  And  when you have real traffic, you get the kind of results that dreams are made of.  And internet Marketing gets real fun all of a sudden.

THE MRX TRAFFIC AND SALES FUNNEL SYSTEM WAS DESIGNED TO MAKE YOU MONEY.  WE PROVIDE FREE TRAFFIC AND VIP DISCOUNT PURCHASES ON ADDITIONAL TRAFFIC AND IF YOU ARE ARE A SELLER WITH US, WE  SET YOU UP WITH 12 CUSTOM  FUNNEL SYSTEMS THAT CONVERTS LIKE NO TOMORROW...

THE MRX TRAFFIC AND SALES FUNNEL SYSTEM WAS DESIGNED TO MAKE YOU MONEY.  WE PROVIDE FREE TRAFFIC AND VIP DISCOUNT PURCHASES ON ADDITIONAL TRAFFIC AND IF YOU ARE ARE A SELLER WITH US, WE  SET YOU UP WITH 12 CUSTOM  FUNNEL SYSTEMS THAT CONVERTS LIKE NO TOMORROW...

THE LONG WAIT IS OVER

THE LONG WAIT IS OVER

OUR TRAFFIC IS THE BEST YOU CAN GET AND ALL YOU DO IS TELL US WHAT URL TO ADVERTISE.  OUR AFFILIATE PROGRAM IS SET UP TO WORK ON ALL MOBILE DEVICES WORLD WIDE SO YOU MAKE MONEY ACROSS ALL PLATFORMS.

OUR TRAFFIC IS THE BEST YOU CAN GET AND ALL YOU DO IS TELL US WHAT URL TO ADVERTISE.  OUR AFFILIATE PROGRAM IS SET UP TO WORK ON ALL MOBILE DEVICES WORLD WIDE SO YOU MAKE MONEY ACROSS ALL PLATFORMS.

WHEN YOU PLUG INTO MRX YOU  GET MASSIVE AMOUNTS OF FREE MRX TRAFFIC DIRECTLY TO ANY WEBSITE YOU CHOOSE, AND FOR MORE OF IT YOU GET A VIP MEMBERS DISCOUNT SO YOU CAN SEND TRAFFIC TO ANY WEBSITE YOU WANT.

WHEN YOU PLUG INTO MRX YOU  GET MASSIVE AMOUNTS OF FREE MRX TRAFFIC DIRECTLY TO ANY WEBSITE YOU CHOOSE, AND FOR MORE OF IT YOU GET A VIP MEMBERS DISCOUNT SO YOU CAN SEND TRAFFIC TO ANY WEBSITE YOU WANT.

THE MRX RESELLERS SYSTEM IS ON FIRE, YOU ARE LOOKING AT IT RIGHT NOW.  IT PAYS YOU RESIDUAL WEEKLY AND MONTHLY INCOME AND LITERALLY CAN CREATE THE KIND OF INCOME THAT MOST PEOPLE ONLY DREAM ABOUT.

THE MRX RESELLERS SYSTEM IS ON FIRE, YOU ARE LOOKING AT IT RIGHT NOW.  IT PAYS YOU RESIDUAL WEEKLY AND MONTHLY INCOME AND LITERALLY CAN CREATE THE KIND OF INCOME THAT MOST PEOPLE ONLY DREAM ABOUT.

MrX Traffic.  This is Rock Star Stuff.

MrX Traffic.  This is Rock Star Stuff.

DO YOU WANT TO MAKE MONEY?

IF YOU WANT TO MAKE MONEY ONLINE THEN YOU HAVE TO HAVE PEOPLE SEEING YOUR OFFERINGS.  MRX SENDS REAL VISITORS TO YOUR WEBSITES.

DO YOU WANT TO MAKE MONEY?

IF YOU WANT TO MAKE MONEY ONLINE THEN YOU HAVE TO HAVE PEOPLE SEEING YOUR OFFERINGS.  MRX SENDS REAL VISITORS TO YOUR WEBSITES.

HOW TO MAKE MONEY ONLINE

ALL YOU NEED TO DO IS HAVE SOMETHING THAT SELLS.  THEN SEND PEOPLE TO YOUR WEBSITE AND THEN WORK YOUR NEW LIST.

HOW TO MAKE MONEY ONLINE

ALL YOU NEED TO DO IS HAVE SOMETHING THAT SELLS.  THEN SEND PEOPLE TO YOUR WEBSITE AND THEN WORK YOUR NEW LIST.

YOU GET FREE TRAFFIC INCLUDED

MRX MEMBERSHIPS ARE DESIGNED FOR MEMBERS TO MAKE MONEY AND TO GET TRAFFIC AT MEMBER PRICING BUT WE ALSO INCLUDE FREE TRAFFIC TO ANY WEBSITE YOU WANT WITH YOUR MEMBERSHIP.

YOU GET FREE TRAFFIC INCLUDED

MRX MEMBERSHIPS ARE DESIGNED FOR MEMBERS TO MAKE MONEY AND TO GET TRAFFIC AT MEMBER PRICING BUT WE ALSO INCLUDE FREE TRAFFIC TO ANY WEBSITE YOU WANT WITH YOUR MEMBERSHIP.

THE PROCESS IS SIMPLE

IF YOU WANT TO MAKE MONEY THEN YOU HAVE TO GET ORDERS.  IF YOU WANT ORDERS SEND REAL TRAFFIC TO A GOOD WEBSITE.  DONE.  END OF STORY.

THE PROCESS IS SIMPLE

IF YOU WANT TO MAKE MONEY THEN YOU HAVE TO GET ORDERS.  IF YOU WANT ORDERS SEND REAL TRAFFIC TO A GOOD WEBSITE.  DONE.  END OF STORY.

OUR NEW TV COMMERCIAL SHOWS EVERYTHING YOU NEED TO KNOW!

OUR NEW TV COMMERCIAL SHOWS EVERYTHING YOU NEED TO KNOW!

And since we believe you are, we want you to get in on what we have.  The marketing system that dreams are made of, the traffic that actually gets you buying customers.  The success and freedom from money worries.

You have three choices, one, walk away and keep having what you have right now.  Two, get MrX Traffic and create your own rock star life,.  you can choose the weekly or monthly membership.

Not only do you get MrX Traffic when you join at VIP Membership Pricing but you also get introduced and a free trial to the marketing platform of your dreams. 

You get free traffic and the option to purchase more for any websites you want, at specially discounted MrX VIP members pricing...

Just look at everything you get when you join us and become a MrX VIP member yourself:

And since we believe you are, we want you to get in on what we have.  The marketing system that dreams are made of, the traffic that actually gets you buying customers.  The success and freedom from money worries.

You have three choices, one, walk away and keep having what you have right now.  Two, get MrX Traffic and create your own rock star life,.  you can choose the weekly or monthly membership.

Not only do you get MrX Traffic when you join at VIP Membership Pricing but you also get introduced and a free trial to the marketing platform of your dreams. 

You get free traffic and the option to purchase more for any websites you want, at specially discounted MrX VIP members pricing...

Just look at everything you get when you join us and become a MrX VIP member yourself:

ARE YOU A WINNER? WE ARE BETTING YOU ARE...

ARE YOU A WINNER? WE ARE BETTING YOU ARE...

What you are getting with a MrX VIP Membership:

1.  Access to MrX Traffic, this is rock star stuff, traffic to build your list, get you orders and fund your life.

2.  Not only do you get  MrX Traffic for 1/2 price, but your membership includes free bulk traffic every week

3. Do you want to make money online? Then you have to have traffic.  MrX Traffic is BUYERS traffic.

4. We are offering full VIP membership for a full week to try us out for only $1.  Do you have $1 to make your life better?

What you are getting with a MrX VIP Membership:

1.  Access to MrX Traffic, this is rock star stuff, traffic to build your list, get you orders and fund your life.

2.  Not only do you get  MrX Traffic for 1/2 price, but your membership includes free bulk traffic every week

3. Do you want to make money online? Then you have to have traffic.  MrX Traffic is BUYERS traffic.

4. We are offering full VIP membership for a full week to try us out for only $1.  Do you have $1 to make your life better?

This Is You Having Freedom From Money Worries

  This is what it feels like to be one of the success stories that other people are reading about.  We are doing it.  You can have this all, too...  If you don't join MrX you  won't have the orders and income and fun, that would hurt.

This Is You Having Freedom From Money Worries

  This is what it feels like to be one of the success stories that other people are reading about.  We are doing it.  You can have this all, too...  If you don't join MrX you  won't have the orders and income and fun, that would hurt.

Copyright        MrX Traffic Program  2018       Refund Policy  Affiliate Agreement   TOS  Earnings Disclaimer  Contact

Copyright        MrX Traffic Program  2018       Refund Policy  Affiliate Agreement   TOS  Earnings Disclaimer  Contact

MrX Traffic sends you buyers!

MrX Traffic sends you buyers!

BECAUSE NOW I AM THE SUCCESS STORY, THAT'S WHY.

BECAUSE NOW I AM THE SUCCESS STORY, THAT'S WHY.

Just tell them...

Just tell them...

Do you want  real buyers traffic so  you can sell stuff on the internet or not?

You'll get free members  bulk traffic plus you get 1/2 on the best buyers traffic on the net, either you want to make money with this stuff or you do not.  This is your chance if you do...

Do you want  real buyers traffic so  you can sell stuff on the internet or not?

You'll get free members  bulk traffic plus you get 1/2 on the best buyers traffic on the net, either you want to make money with this stuff or you do not.  This is your chance if you do...

Your MrX purchases come with an unconditional money back guarantee. You may cancel  at anytime and can request a full and prompt refund for any current and active billing period.

Your MrX purchases come with an unconditional money back guarantee. You may cancel  at anytime and can request a full and prompt refund for any current and active billing period.

'),r=e();return Kinetic.document=a,Kinetic.window=Kinetic.document.createWindow(),Kinetic.window.Image=i.Image,Kinetic.root=t,Kinetic._nodeCanvas=i,void(module.exports=r)};'function'==typeof define&&define.amd&&define(e),Kinetic.document=document,Kinetic.window=window,Kinetic.root=t}((1,eval)('this'),function(){return Kinetic}),function(){Kinetic.Collection=function(){var e=[].slice.call(arguments),i=e.length,t=0;for(this.length=i;i>t;t++)this[t]=e[t];return this},Kinetic.Collection.prototype=[],Kinetic.Collection.prototype.each=function(t){for(var e=0;et;t++)e.push(this[t]);return e},Kinetic.Collection.toCollection=function(t){var e,i=new Kinetic.Collection,n=t.length;for(e=0;n>e;e++)i.push(t[e]);return i},Kinetic.Collection._mapMethod=function(t){Kinetic.Collection.prototype[t]=function(){var e,i=this.length,n=[].slice.call(arguments);for(e=0;i>e;e++)this[e][t].apply(this[e],n);return this}},Kinetic.Collection.mapMethods=function(t){var i=t.prototype;for(var e in i)Kinetic.Collection._mapMethod(e)},Kinetic.Transform=function(t){this.m=t&&t.slice()||[1,0,0,1,0,0]},Kinetic.Transform.prototype={copy:function(){return new Kinetic.Transform(this.m)},point:function(t){var e=this.m;return{x:e[0]*t.x+e[2]*t.y+e[4],y:e[1]*t.x+e[3]*t.y+e[5]}},translate:function(t,e){return this.m[4]+=this.m[0]*t+this.m[2]*e,this.m[5]+=this.m[1]*t+this.m[3]*e,this},scale:function(t,e){return this.m[0]*=t,this.m[1]*=t,this.m[2]*=e,this.m[3]*=e,this},rotate:function(t){var e=Math.cos(t),i=Math.sin(t),n=this.m[0]*e+this.m[2]*i,a=this.m[1]*e+this.m[3]*i,r=this.m[0]*-i+this.m[2]*e,s=this.m[1]*-i+this.m[3]*e;return this.m[0]=n,this.m[1]=a,this.m[2]=r,this.m[3]=s,this},getTranslation:function(){return{x:this.m[4],y:this.m[5]}},skew:function(t,e){var i=this.m[0]+this.m[2]*e,n=this.m[1]+this.m[3]*e,a=this.m[2]+this.m[0]*t,r=this.m[3]+this.m[1]*t;return this.m[0]=i,this.m[1]=n,this.m[2]=a,this.m[3]=r,this},multiply:function(t){var e=this.m[0]*t.m[0]+this.m[2]*t.m[1],i=this.m[1]*t.m[0]+this.m[3]*t.m[1],n=this.m[0]*t.m[2]+this.m[2]*t.m[3],a=this.m[1]*t.m[2]+this.m[3]*t.m[3],r=this.m[0]*t.m[4]+this.m[2]*t.m[5]+this.m[4],s=this.m[1]*t.m[4]+this.m[3]*t.m[5]+this.m[5];return this.m[0]=e,this.m[1]=i,this.m[2]=n,this.m[3]=a,this.m[4]=r,this.m[5]=s,this},invert:function(){var t=1/(this.m[0]*this.m[3]-this.m[1]*this.m[2]),e=this.m[3]*t,i=-this.m[1]*t,n=-this.m[2]*t,a=this.m[0]*t,r=t*(this.m[2]*this.m[5]-this.m[3]*this.m[4]),s=t*(this.m[1]*this.m[4]-this.m[0]*this.m[5]);return this.m[0]=e,this.m[1]=i,this.m[2]=n,this.m[3]=a,this.m[4]=r,this.m[5]=s,this},getMatrix:function(){return this.m},setAbsolutePosition:function(t,e){var i=this.m[0],n=this.m[1],a=this.m[2],o=this.m[3],r=this.m[4],c=this.m[5],s=(i*(e-c)-n*(t-r))/(i*o-n*a),h=(t-r-a*s)/i;return this.translate(h,s)}};var n='2d',a='[object Array]',r='[object Number]',s='[object String]',o=Math.PI/180,c=180/Math.PI,t='#',e='',h='0',l='Kinetic warning: ',d='Kinetic error: ',u='rgb(',i={aqua:[0,255,255],lime:[0,255,0],silver:[192,192,192],black:[0,0,0],maroon:[128,0,0],teal:[0,128,128],blue:[0,0,255],navy:[0,0,128],white:[255,255,255],fuchsia:[255,0,255],olive:[128,128,0],yellow:[255,255,0],orange:[255,165,0],gray:[128,128,128],purple:[128,0,128],green:[0,128,0],red:[255,0,0],pink:[255,192,203],cyan:[0,255,255],transparent:[255,255,255,0]},f=/rgb\((\d{1,3}),(\d{1,3}),(\d{1,3})\)/;Kinetic.Util={_isElement:function(t){return!(!t||1!=t.nodeType)},_isFunction:function(t){return!!(t&&t.constructor&&t.call&&t.apply)},_isObject:function(t){return!!t&&t.constructor==Object},_isArray:function(t){return Object.prototype.toString.call(t)==a},_isNumber:function(t){return Object.prototype.toString.call(t)==r},_isString:function(t){return Object.prototype.toString.call(t)==s},_throttle:function(t,e,i){var n,a,o,r=null,s=0;i||(i={});var c=function(){s=i.leading===!1?0:(new Date).getTime(),r=null,o=t.apply(n,a),n=a=null};return function(){var h=(new Date).getTime();s||i.leading!==!1||(s=h);var l=e-(h-s);return n=this,a=arguments,0>=l?(clearTimeout(r),r=null,s=h,o=t.apply(n,a),n=a=null):r||i.trailing===!1||(r=setTimeout(c,l)),o}},_hasMethods:function(t){var e,i=[];for(e in t)this._isFunction(t[e])&&i.push(e);return i.length>0},createCanvasElement:function(){var t=Kinetic.document.createElement('canvas');return t.style=t.style||{},t},isBrowser:function(){return'object'!=typeof exports},_isInDocument:function(t){for(;t=t.parentNode;)if(t==Kinetic.document)return!0;return!1},_simplifyArray:function(t){var i,e,n=[],r=t.length,a=Kinetic.Util;for(i=0;r>i;i++)e=t[i],a._isNumber(e)?e=Math.round(1e3*e)/1e3:a._isString(e)||(e=e.toString()),n.push(e);return n},_getImage:function(t,e){var a,i;if(t)if(this._isElement(t))e(t);else if(this._isString(t))a=new Kinetic.window.Image,a.onload=function(){e(a)},a.src=t;else if(t.data){i=Kinetic.Util.createCanvasElement(),i.width=t.width,i.height=t.height;var r=i.getContext(n);r.putImageData(t,0,0),this._getImage(i.toDataURL(),e)} else e(null);else e(null)},_getRGBAString:function(t){var i=t.red||0,n=t.green||0,a=t.blue||0,r=t.alpha||1;return['rgba(',i,',',n,',',a,',',r,')'].join(e)},_rgbToHex:function(t,e,i){return((1<<24)+(t<<16)+(e<<8)+i).toString(16).slice(1)},_hexToRgb:function(i){i=i.replace(t,e);var n=parseInt(i,16);return{r:n>>16&255,g:n>>8&255,b:255&n}},getRandomColor:function(){for(var e=(16777215*Math.random()<<0).toString(16);e.length<6;)e=h+e;return t+e},get:function(t,e){return void 0===t?e:t},getRGB:function(e){var n;return e in i?(n=i[e],{r:n[0],g:n[1],b:n[2]}):e[0]===t?this._hexToRgb(e.substring(1)):e.substr(0,4)===u?(n=f.exec(e.replace(/ /g,'')),{r:parseInt(n[1],10),g:parseInt(n[2],10),b:parseInt(n[3],10)}):{r:0,g:0,b:0}},_merge:function(t,e){var n=this._clone(e);for(var i in t)n[i]=this._isObject(t[i])?this._merge(t[i],n[i]):t[i];return n},cloneObject:function(t){var i={};for(var e in t)i[e]=this._isObject(t[e])?this.cloneObject(t[e]):this._isArray(t[e])?this.cloneArray(t[e]):t[e];return i},cloneArray:function(t){return t.slice(0)},_degToRad:function(t){return t*o},_radToDeg:function(t){return t*c},_capitalize:function(t){return t.charAt(0).toUpperCase()+t.slice(1)},error:function(t){throw new Error(d+t)},warn:function(t){Kinetic.root.console&&console.warn&&console.warn(l+t)},extend:function(t,e){for(var i in e.prototype)i in t.prototype||(t.prototype[i]=e.prototype[i])},addMethods:function(t,e){var i;for(i in e)t.prototype[i]=e[i]},_getControlPoints:function(t,e,i,n,a,r,s){var o=Math.sqrt(Math.pow(i-t,2)+Math.pow(n-e,2)),c=Math.sqrt(Math.pow(a-i,2)+Math.pow(r-n,2)),h=s*o/(o+c),l=s*c/(o+c),d=i-h*(a-t),u=n-h*(r-e),f=i+l*(a-t),g=n+l*(r-e);return[d,u,f,g]},_expandPoints:function(t,e){var i,a,r=t.length,n=[];for(i=2;r-2>i;i+=2)a=Kinetic.Util._getControlPoints(t[i-2],t[i-1],t[i],t[i+1],t[i+2],t[i+3],e),n.push(a[0]),n.push(a[1]),n.push(t[i]),n.push(t[i+1]),n.push(a[2]),n.push(a[3]);return n},_removeLastLetter:function(t){return t.substring(0,t.length-1)}}}(),function(){var e=Kinetic.Util.createCanvasElement(),t=e.getContext('2d'),i=Kinetic.UA.mobile?function(){var e=window.devicePixelRatio||1,i=t.webkitBackingStorePixelRatio||t.mozBackingStorePixelRatio||t.msBackingStorePixelRatio||t.oBackingStorePixelRatio||t.backingStorePixelRatio||1;return e/i}():1;Kinetic.Canvas=function(t){this.init(t)},Kinetic.Canvas.prototype={init:function(t){t=t||{};var e=t.pixelRatio||Kinetic.pixelRatio||i;this.pixelRatio=e,this._canvas=Kinetic.Util.createCanvasElement(),this._canvas.style.padding=0,this._canvas.style.margin=0,this._canvas.style.border=0,this._canvas.style.background='transparent',this._canvas.style.position='absolute',this._canvas.style.top=0,this._canvas.style.left=0},getContext:function(){return this.context},getPixelRatio:function(){return this.pixelRatio},setPixelRatio:function(t){this.pixelRatio=t,this.setSize(this.getWidth(),this.getHeight())},setWidth:function(t){this.width=this._canvas.width=t*this.pixelRatio,this._canvas.style.width=t+'px'},setHeight:function(t){this.height=this._canvas.height=t*this.pixelRatio,this._canvas.style.height=t+'px'},getWidth:function(){return this.width},getHeight:function(){return this.height},setSize:function(t,e){this.setWidth(t),this.setHeight(e)},toDataURL:function(t,e){try{return this._canvas.toDataURL(t,e)}catch(i){try{return this._canvas.toDataURL()}catch(i){return Kinetic.Util.warn('Unable to get data URL. '+i.message),''}}}},Kinetic.SceneCanvas=function(t){t=t||{};var e=t.width||0,i=t.height||0;Kinetic.Canvas.call(this,t),this.context=new Kinetic.SceneContext(this),this.setSize(e,i)},Kinetic.SceneCanvas.prototype={setWidth:function(t){var e=this.pixelRatio,i=this.getContext()._context;Kinetic.Canvas.prototype.setWidth.call(this,t),i.scale(e,e)},setHeight:function(t){var e=this.pixelRatio,i=this.getContext()._context;Kinetic.Canvas.prototype.setHeight.call(this,t),i.scale(e,e)}},Kinetic.Util.extend(Kinetic.SceneCanvas,Kinetic.Canvas),Kinetic.HitCanvas=function(t){t=t||{};var e=t.width||0,i=t.height||0;Kinetic.Canvas.call(this,t),this.context=new Kinetic.HitContext(this),this.setSize(e,i)},Kinetic.Util.extend(Kinetic.HitCanvas,Kinetic.Canvas)}(),function(){var t=',',i='(',n=')',a='([',r='])',s=';',o='()',c='=',e=['arc','arcTo','beginPath','bezierCurveTo','clearRect','clip','closePath','createLinearGradient','createPattern','createRadialGradient','drawImage','fill','fillText','getImageData','createImageData','lineTo','moveTo','putImageData','quadraticCurveTo','rect','restore','rotate','save','scale','setLineDash','setTransform','stroke','strokeText','transform','translate'];Kinetic.Context=function(t){this.init(t)},Kinetic.Context.prototype={init:function(t){this.canvas=t,this._context=t._canvas.getContext('2d'),Kinetic.enableTrace&&(this.traceArr=[],this._enableTrace())},fillShape:function(t){t.getFillEnabled()&&this._fill(t)},strokeShape:function(t){t.getStrokeEnabled()&&this._stroke(t)},fillStrokeShape:function(t){var e=t.getFillEnabled();e&&this._fill(t),t.getStrokeEnabled()&&this._stroke(t)},getTrace:function(e){var d,l,f,u,g=this.traceArr,p=g.length,h='';for(d=0;p>d;d++)l=g[d],f=l.method,f?(u=l.args,h+=f,h+=e?o:Kinetic.Util._isArray(u[0])?a+u.join(t)+r:i+u.join(t)+n):(h+=l.property,e||(h+=c+l.val)),h+=s;return h},clearTrace:function(){this.traceArr=[]},_trace:function(t){var i,e=this.traceArr;e.push(t),i=e.length,i>=Kinetic.traceArrMax&&e.shift()},reset:function(){var t=this.getCanvas().getPixelRatio();this.setTransform(1*t,0,0,1*t,0,0)},getCanvas:function(){return this.canvas},clear:function(t){var e=this.getCanvas();t?this.clearRect(t.x||0,t.y||0,t.width||0,t.height||0):this.clearRect(0,0,e.getWidth(),e.getHeight())},_applyLineCap:function(t){var e=t.getLineCap();e&&this.setAttr('lineCap',e)},_applyOpacity:function(t){var e=t.getAbsoluteOpacity();1!==e&&this.setAttr('globalAlpha',e)},_applyLineJoin:function(t){var e=t.getLineJoin();e&&this.setAttr('lineJoin',e)},setAttr:function(t,e){this._context[t]=e},arc:function(){var t=arguments;this._context.arc(t[0],t[1],t[2],t[3],t[4],t[5])},beginPath:function(){this._context.beginPath()},bezierCurveTo:function(){var t=arguments;this._context.bezierCurveTo(t[0],t[1],t[2],t[3],t[4],t[5])},clearRect:function(){var t=arguments;this._context.clearRect(t[0],t[1],t[2],t[3])},clip:function(){this._context.clip()},closePath:function(){this._context.closePath()},createImageData:function(){var t=arguments;return 2===t.length?this._context.createImageData(t[0],t[1]):1===t.length?this._context.createImageData(t[0]):void 0},createLinearGradient:function(){var t=arguments;return this._context.createLinearGradient(t[0],t[1],t[2],t[3])},createPattern:function(){var t=arguments;return this._context.createPattern(t[0],t[1])},createRadialGradient:function(){var t=arguments;return this._context.createRadialGradient(t[0],t[1],t[2],t[3],t[4],t[5])},drawImage:function(){var t=arguments,e=this._context;3===t.length?e.drawImage(t[0],t[1],t[2]):5===t.length?e.drawImage(t[0],t[1],t[2],t[3],t[4]):9===t.length&&e.drawImage(t[0],t[1],t[2],t[3],t[4],t[5],t[6],t[7],t[8])},fill:function(){this._context.fill()},fillText:function(){var t=arguments;this._context.fillText(t[0],t[1],t[2])},getImageData:function(){var t=arguments;return this._context.getImageData(t[0],t[1],t[2],t[3])},lineTo:function(){var t=arguments;this._context.lineTo(t[0],t[1])},moveTo:function(){var t=arguments;this._context.moveTo(t[0],t[1])},rect:function(){var t=arguments;this._context.rect(t[0],t[1],t[2],t[3])},putImageData:function(){var t=arguments;this._context.putImageData(t[0],t[1],t[2])},quadraticCurveTo:function(){var t=arguments;this._context.quadraticCurveTo(t[0],t[1],t[2],t[3])},restore:function(){this._context.restore()},rotate:function(){var t=arguments;this._context.rotate(t[0])},save:function(){this._context.save()},scale:function(){var t=arguments;this._context.scale(t[0],t[1])},setLineDash:function(){var e=arguments,t=this._context;this._context.setLineDash?t.setLineDash(e[0]):'mozDash'in t?t.mozDash=e[0]:'webkitLineDash'in t&&(t.webkitLineDash=e[0])},setTransform:function(){var t=arguments;this._context.setTransform(t[0],t[1],t[2],t[3],t[4],t[5])},stroke:function(){this._context.stroke()},strokeText:function(){var t=arguments;this._context.strokeText(t[0],t[1],t[2])},transform:function(){var t=arguments;this._context.transform(t[0],t[1],t[2],t[3],t[4],t[5])},translate:function(){var t=arguments;this._context.translate(t[0],t[1])},_enableTrace:function(){var i,n,t=this,a=e.length,r=Kinetic.Util._simplifyArray,s=this.setAttr,o=function(e){var i,a=t[e];t[e]=function(){return n=r(Array.prototype.slice.call(arguments,0)),i=a.apply(t,arguments),t._trace({method:e,args:n}),i}};for(i=0;a>i;i++)o(e[i]);t.setAttr=function(){s.apply(t,arguments),t._trace({property:arguments[0],val:arguments[1]})}}},Kinetic.SceneContext=function(t){Kinetic.Context.call(this,t)},Kinetic.SceneContext.prototype={_fillColor:function(t){var e=t.fill()||Kinetic.Util._getRGBAString({red:t.fillRed(),green:t.fillGreen(),blue:t.fillBlue(),alpha:t.fillAlpha()});this.setAttr('fillStyle',e),t._fillFunc(this)},_fillPattern:function(t){var s=t.getFillPatternImage(),n=t.getFillPatternX(),a=t.getFillPatternY(),e=t.getFillPatternScale(),r=Kinetic.getAngle(t.getFillPatternRotation()),i=t.getFillPatternOffset(),o=t.getFillPatternRepeat();(n||a)&&this.translate(n||0,a||0),r&&this.rotate(r),e&&this.scale(e.x,e.y),i&&this.translate(-1*i.x,-1*i.y),this.setAttr('fillStyle',this.createPattern(s,o||'repeat')),this.fill()},_fillLinearGradient:function(t){var n=t.getFillLinearGradientStartPoint(),a=t.getFillLinearGradientEndPoint(),i=t.getFillLinearGradientColorStops(),r=this.createLinearGradient(n.x,n.y,a.x,a.y);if(i){for(var e=0;eo;o++)h=a[o],t[h]=this.getAttr(n+c(h));return t},i.prototype[u]=function(t){var e,i=this.attrs[n];r&&(t=r.call(this,t));for(e in t)this._setAttr(n+c(e),t[e]);return this._fireChangeEvent(n,i,t),s&&s.call(this),this},this.addOverloadedGetterSetter(i,n)},addOverloadedGetterSetter:function(i,n){var a=Kinetic.Util._capitalize(n),r=e+a,s=t+a;i.prototype[n]=function(){return arguments.length?(this[r](arguments[0]),this):this[s]()}},backCompat:function(t,e){var i;for(i in e)t.prototype[i]=t.prototype[e[i]]},afterSetFilter:function(){this._filterUpToDate=!1}},Kinetic.Validators={RGBComponent:function(t){return t>255?255:0>t?0:Math.round(t)},alphaComponent:function(t){return t>1?1:1e-4>t?1e-4:t}}}(),function(){var i='absoluteOpacity',t='absoluteTransform',d='Change',u='children',s='.',f='',g='get',p='id',v='kinetic',n='listening',K='mouseenter',m='mouseleave',y='name',o='set',c='Shape',a=' ',h='stage',e='transform',S='Stage',r='visible',l=['id'],C=['xChange.kinetic','yChange.kinetic','scaleXChange.kinetic','scaleYChange.kinetic','skewXChange.kinetic','skewYChange.kinetic','rotationChange.kinetic','offsetXChange.kinetic','offsetYChange.kinetic','transformsEnabledChange.kinetic'].join(a);Kinetic.Util.addMethods(Kinetic.Node,{_init:function(a){var s=this;this._id=Kinetic.idCounter++,this.eventListeners={},this.attrs={},this._cache={},this._filterUpToDate=!1,this.setAttrs(a),this.on(C,function(){this._clearCache(e),s._clearSelfAndDescendantCache(t)}),this.on('visibleChange.kinetic',function(){s._clearSelfAndDescendantCache(r)}),this.on('listeningChange.kinetic',function(){s._clearSelfAndDescendantCache(n)}),this.on('opacityChange.kinetic',function(){s._clearSelfAndDescendantCache(i)})},_clearCache:function(t){t?delete this._cache[t]:this._cache={}},_getCache:function(t,e){var i=this._cache[t];return void 0===i&&(this._cache[t]=e.call(this)),this._cache[t]},_clearSelfAndDescendantCache:function(t){this._clearCache(t),this.children&&this.getChildren().each(function(e){e._clearSelfAndDescendantCache(t)})},clearCache:function(){return delete this._cache.canvas,this._filterUpToDate=!1,this},cache:function(t){{var i=t||{},c=i.x||0,h=i.y||0,n=i.width||this.width(),a=i.height||this.height(),d=i.drawBorder||!1;this.getLayer()};if(0===n||0===a)return void Kinetic.Util.warn('Width or height of caching configuration equals 0. Cache is ignored.');var s=new Kinetic.SceneCanvas({pixelRatio:1,width:n,height:a}),l=new Kinetic.SceneCanvas({pixelRatio:1,width:n,height:a}),o=new Kinetic.HitCanvas({width:n,height:a}),e=(this.transformsEnabled(),this.x(),this.y(),s.getContext()),r=o.getContext();return this.clearCache(),e.save(),r.save(),d&&(e.save(),e.beginPath(),e.rect(0,0,n,a),e.closePath(),e.setAttr('strokeStyle','red'),e.setAttr('lineWidth',5),e.stroke(),e.restore()),e.translate(-1*c,-1*h),r.translate(-1*c,-1*h),'Shape'===this.nodeType&&(e.translate(-1*this.x(),-1*this.y()),r.translate(-1*this.x(),-1*this.y())),this.drawScene(s,this),this.drawHit(o,this),e.restore(),r.restore(),this._cache.canvas={scene:s,filter:l,hit:o},this},_drawCachedSceneCanvas:function(t){t.save(),this.getLayer()._applyTransform(this,t),t.drawImage(this._getCachedSceneCanvas()._canvas,0,0),t.restore()},_getCachedSceneCanvas:function(){var s,a,t,o,r=this.filters(),c=this._cache.canvas,h=c.scene,e=c.filter,i=e.getContext();if(r){if(!this._filterUpToDate){try{for(s=r.length,i.clear(),i.drawImage(h._canvas,0,0),a=i.getImageData(0,0,e.getWidth(),e.getHeight()),t=0;s>t;t++)o=r[t],o.call(this,a),i.putImageData(a,0,0)}catch(n){Kinetic.Util.warn('Unable to apply filter. '+n.message)};this._filterUpToDate=!0};return e};return h},_drawCachedHitCanvas:function(t){var e=this._cache.canvas,i=e.hit;t.save(),this.getLayer()._applyTransform(this,t),t.drawImage(i._canvas,0,0),t.restore()},on:function(t,e){var i,o,r,n,c,h=t.split(a),l=h.length;for(i=0;l>i;i++)o=h[i],r=o.split(s),n=r[0],c=r[1]||f,this.eventListeners[n]||(this.eventListeners[n]=[]),this.eventListeners[n].push({name:c,handler:e});return this},off:function(t){var e,o,c,n,i,r,h=t.split(a),l=h.length;for(e=0;l>e;e++)if(c=h[e],n=c.split(s),i=n[0],r=n[1],i)this.eventListeners[i]&&this._off(i,r);else for(o in this.eventListeners)this._off(o,r);return this},dispatchEvent:function(t){var e={target:this,type:t.type,evt:t};this.fire(t.type,e)},addEventListener:function(t,e){this.on(t,function(t){e.call(this,t.evt)})},remove:function(){var e=this.getParent();return e&&e.children&&(e.children.splice(this.index,1),e._setChildrenIndices(),delete this.parent),this._clearSelfAndDescendantCache(h),this._clearSelfAndDescendantCache(t),this._clearSelfAndDescendantCache(r),this._clearSelfAndDescendantCache(n),this._clearSelfAndDescendantCache(i),this},destroy:function(){Kinetic._removeId(this.getId()),Kinetic._removeName(this.getName(),this._id),this.remove()},getAttr:function(t){var e=g+Kinetic.Util._capitalize(t);return Kinetic.Util._isFunction(this[e])?this[e]():this.attrs[t]},getAncestors:function(){for(var t=this.getParent(),e=new Kinetic.Collection;t;)e.push(t),t=t.getParent();return e},getAttrs:function(){return this.attrs||{}},setAttrs:function(t){var e,i;if(t)for(e in t)e===u||(i=o+Kinetic.Util._capitalize(e),Kinetic.Util._isFunction(this[i])?this[i](t[e]):this._setAttr(e,t[e]));return this},isListening:function(){return this._getCache(n,this._isListening)},_isListening:function(){var t=this.getListening(),e=this.getParent();return'inherit'===t?e?e.isListening():!0:t},isVisible:function(){return this._getCache(r,this._isVisible)},_isVisible:function(){var t=this.getVisible(),e=this.getParent();return'inherit'===t?e?e.isVisible():!0:t},shouldDrawHit:function(){var t=this.getLayer();return t&&t.hitGraphEnabled()&&this.isListening()&&this.isVisible()&&!Kinetic.isDragging()},show:function(){return this.setVisible(!0),this},hide:function(){return this.setVisible(!1),this},getZIndex:function(){return this.index||0},getAbsoluteZIndex:function(){function s(h){for(t=[],n=h.length,e=0;n>e;e++)i=h[e],r++,i.nodeType!==c&&(t=t.concat(i.getChildren().toArray())),i._id===a._id&&(e=n);t.length>0&&t[0].getDepth()<=o&&s(t)};var t,n,e,i,o=this.getDepth(),a=this,r=0;return a.nodeType!==S&&s(a.getStage().getChildren()),r},getDepth:function(){for(var e=0,t=this.parent;t;)e++,t=t.parent;return e},setPosition:function(t){return this.setX(t.x),this.setY(t.y),this},getPosition:function(){return{x:this.getX(),y:this.getY()}},getAbsolutePosition:function(){var i=this.getAbsoluteTransform().getMatrix(),t=new Kinetic.Transform,e=this.offset();return t.m=i.slice(),t.translate(e.x,e.y),t.getTranslation()},setAbsolutePosition:function(t){var e,i=this._clearTransform();return this.attrs.x=i.x,this.attrs.y=i.y,delete i.x,delete i.y,e=this.getAbsoluteTransform(),e.invert(),e.translate(t.x,t.y),t={x:this.attrs.x+e.getTranslation().x,y:this.attrs.y+e.getTranslation().y},this.setPosition({x:t.x,y:t.y}),this._setTransform(i),this},_setTransform:function(i){var n;for(n in i)this.attrs[n]=i[n];this._clearCache(e),this._clearSelfAndDescendantCache(t)},_clearTransform:function(){var i={x:this.getX(),y:this.getY(),rotation:this.getRotation(),scaleX:this.getScaleX(),scaleY:this.getScaleY(),offsetX:this.getOffsetX(),offsetY:this.getOffsetY(),skewX:this.getSkewX(),skewY:this.getSkewY()};return this.attrs.x=0,this.attrs.y=0,this.attrs.rotation=0,this.attrs.scaleX=1,this.attrs.scaleY=1,this.attrs.offsetX=0,this.attrs.offsetY=0,this.attrs.skewX=0,this.attrs.skewY=0,this._clearCache(e),this._clearSelfAndDescendantCache(t),i},move:function(t){var e=t.x,i=t.y,n=this.getX(),a=this.getY();return void 0!==e&&(n+=e),void 0!==i&&(a+=i),this.setPosition({x:n,y:a}),this},_eachAncestorReverse:function(t,e){var r,n,a=[],i=this.getParent();if(e&&e._id===this._id)return t(this),!0;for(a.unshift(this);i&&(!e||i._id!==e._id);)a.unshift(i),i=i.parent;for(r=a.length,n=0;r>n;n++)t(a[n])},rotate:function(t){return this.setRotation(this.getRotation()+t),this},moveToTop:function(){if(!this.parent)return void Kinetic.Util.warn('Node has no parent. moveToTop function is ignored.');var t=this.index;return this.parent.children.splice(t,1),this.parent.children.push(this),this.parent._setChildrenIndices(),!0},moveUp:function(){if(!this.parent)return void Kinetic.Util.warn('Node has no parent. moveUp function is ignored.');var t=this.index,e=this.parent.getChildren().length;return e-1>t?(this.parent.children.splice(t,1),this.parent.children.splice(t+1,0,this),this.parent._setChildrenIndices(),!0):!1},moveDown:function(){if(!this.parent)return void Kinetic.Util.warn('Node has no parent. moveDown function is ignored.');var t=this.index;return t>0?(this.parent.children.splice(t,1),this.parent.children.splice(t-1,0,this),this.parent._setChildrenIndices(),!0):!1},moveToBottom:function(){if(!this.parent)return void Kinetic.Util.warn('Node has no parent. moveToBottom function is ignored.');var t=this.index;return t>0?(this.parent.children.splice(t,1),this.parent.children.unshift(this),this.parent._setChildrenIndices(),!0):!1},setZIndex:function(t){if(!this.parent)return void Kinetic.Util.warn('Node has no parent. zIndex parameter is ignored.');var e=this.index;return this.parent.children.splice(e,1),this.parent.children.splice(t,0,this),this.parent._setChildrenIndices(),this},getAbsoluteOpacity:function(){return this._getCache(i,this._getAbsoluteOpacity)},_getAbsoluteOpacity:function(){var t=this.getOpacity();return this.getParent()&&(t*=this.getParent().getAbsoluteOpacity()),t},moveTo:function(t){return Kinetic.Node.prototype.remove.call(this),t.add(this),this},toObject:function(){var e,t,r,s,i=Kinetic.Util,n={},a=this.getAttrs();n.attrs={};for(e in a)t=a[e],i._isFunction(t)||i._isElement(t)||i._isObject(t)&&i._hasMethods(t)||(r=this[e],delete a[e],s=r?r.call(this):null,a[e]=t,s!==t&&(n.attrs[e]=t));return n.className=this.getClassName(),n},toJSON:function(){return JSON.stringify(this.toObject())},getParent:function(){return this.parent},getLayer:function(){var t=this.getParent();return t?t.getLayer():null},getStage:function(){return this._getCache(h,this._getStage)},_getStage:function(){var t=this.getParent();return t?t.getStage():void 0},fire:function(t,e,i){return i?this._fireAndBubble(t,e||{}):this._fire(t,e||{}),this},getAbsoluteTransform:function(e){return e?this._getAbsoluteTransform(e):this._getCache(t,this._getAbsoluteTransform)},_getAbsoluteTransform:function(t){var e,n,i=new Kinetic.Transform;return this._eachAncestorReverse(function(t){e=t.transformsEnabled(),n=t.getTransform(),'all'===e?i.multiply(n):'position'===e&&i.translate(t.x(),t.y())},t),i},getTransform:function(){return this._getCache(e,this._getTransform)},_getTransform:function(){var t=new Kinetic.Transform,e=this.getX(),i=this.getY(),n=Kinetic.getAngle(this.getRotation()),a=this.getScaleX(),r=this.getScaleY(),s=this.getSkewX(),o=this.getSkewY(),c=this.getOffsetX(),h=this.getOffsetY();return(0!==e||0!==i)&&t.translate(e,i),0!==n&&t.rotate(n),(0!==s||0!==o)&&t.skew(s,o),(1!==a||1!==r)&&t.scale(a,r),(0!==c||0!==h)&&t.translate(-1*c,-1*h),t},clone:function(t){var e,a,o,n,r,d=this.getClassName(),s=Kinetic.Util.cloneObject(this.attrs);for(var h in l){var c=l[h];delete s[c]};for(e in t)s[e]=t[e];var i=new Kinetic[d](s);for(e in this.eventListeners)for(a=this.eventListeners[e],o=a.length,n=0;o>n;n++)r=a[n],r.name.indexOf(v)<0&&(i.eventListeners[e]||(i.eventListeners[e]=[]),i.eventListeners[e].push(r));return i},toDataURL:function(t){t=t||{};var s=t.mimeType||null,o=t.quality||null,e=this.getStage(),a=t.x||0,r=t.y||0,i=new Kinetic.SceneCanvas({width:t.width||this.getWidth()||(e?e.getWidth():0),height:t.height||this.getHeight()||(e?e.getHeight():0),pixelRatio:1}),n=i.getContext();return n.save(),(a||r)&&n.translate(-1*a,-1*r),this.drawScene(i),n.restore(),i.toDataURL(s,o)},toImage:function(t){Kinetic.Util._getImage(this.toDataURL(t),function(e){t.callback(e)})},setSize:function(t){return this.setWidth(t.width),this.setHeight(t.height),this},getSize:function(){return{width:this.getWidth(),height:this.getHeight()}},getWidth:function(){return this.attrs.width||0},getHeight:function(){return this.attrs.height||0},getClassName:function(){return this.className||this.nodeType},getType:function(){return this.nodeType},getDragDistance:function(){return void 0!==this.attrs.dragDistance?this.attrs.dragDistance:this.parent?this.parent.getDragDistance():Kinetic.dragDistance},_get:function(t){return this.nodeType===t?[this]:[]},_off:function(t,e){var i,a,n=this.eventListeners[t];for(i=0;ii;i++)n.add(this._createNode(a[i]));return n},Kinetic.Factory.addOverloadedGetterSetter(Kinetic.Node,'position'),Kinetic.Factory.addGetterSetter(Kinetic.Node,'x',0),Kinetic.Factory.addGetterSetter(Kinetic.Node,'y',0),Kinetic.Factory.addGetterSetter(Kinetic.Node,'opacity',1),Kinetic.Factory.addGetter(Kinetic.Node,'name'),Kinetic.Factory.addOverloadedGetterSetter(Kinetic.Node,'name'),Kinetic.Factory.addGetter(Kinetic.Node,'id'),Kinetic.Factory.addOverloadedGetterSetter(Kinetic.Node,'id'),Kinetic.Factory.addGetterSetter(Kinetic.Node,'rotation',0),Kinetic.Factory.addComponentsGetterSetter(Kinetic.Node,'scale',['x','y']),Kinetic.Factory.addGetterSetter(Kinetic.Node,'scaleX',1),Kinetic.Factory.addGetterSetter(Kinetic.Node,'scaleY',1),Kinetic.Factory.addComponentsGetterSetter(Kinetic.Node,'skew',['x','y']),Kinetic.Factory.addGetterSetter(Kinetic.Node,'skewX',0),Kinetic.Factory.addGetterSetter(Kinetic.Node,'skewY',0),Kinetic.Factory.addComponentsGetterSetter(Kinetic.Node,'offset',['x','y']),Kinetic.Factory.addGetterSetter(Kinetic.Node,'offsetX',0),Kinetic.Factory.addGetterSetter(Kinetic.Node,'offsetY',0),Kinetic.Factory.addSetter(Kinetic.Node,'dragDistance'),Kinetic.Factory.addOverloadedGetterSetter(Kinetic.Node,'dragDistance'),Kinetic.Factory.addSetter(Kinetic.Node,'width',0),Kinetic.Factory.addOverloadedGetterSetter(Kinetic.Node,'width'),Kinetic.Factory.addSetter(Kinetic.Node,'height',0),Kinetic.Factory.addOverloadedGetterSetter(Kinetic.Node,'height'),Kinetic.Factory.addGetterSetter(Kinetic.Node,'listening','inherit'),Kinetic.Factory.addGetterSetter(Kinetic.Node,'filters',void 0,function(t){return this._filterUpToDate=!1,t}),Kinetic.Factory.addGetterSetter(Kinetic.Node,'visible','inherit'),Kinetic.Factory.addGetterSetter(Kinetic.Node,'transformsEnabled','all'),Kinetic.Factory.addOverloadedGetterSetter(Kinetic.Node,'size'),Kinetic.Factory.backCompat(Kinetic.Node,{rotateDeg:'rotate',setRotationDeg:'setRotation',getRotationDeg:'getRotation'}),Kinetic.Collection.mapMethods(Kinetic.Node)}(),function(){Kinetic.Filters.Grayscale=function(t){var e,n,i=t.data,a=i.length;for(e=0;a>e;e+=4)n=.34*i[e]+.5*i[e+1]+.16*i[e+2],i[e]=n,i[e+1]=n,i[e+2]=n}}(),function(){Kinetic.Filters.Brighten=function(t){var e,n=255*this.brightness(),i=t.data,a=i.length;for(e=0;a>e;e+=4)i[e]+=n,i[e+1]+=n,i[e+2]+=n},Kinetic.Factory.addGetterSetter(Kinetic.Node,'brightness',0,null,Kinetic.Factory.afterSetFilter)}(),function(){Kinetic.Filters.Invert=function(t){var e,i=t.data,n=i.length;for(e=0;n>e;e+=4)i[e]=255-i[e],i[e+1]=255-i[e+1],i[e+2]=255-i[e+2]}}(),function(){function t(){this.r=0,this.g=0,this.b=0,this.a=0,this.next=null};function n(n,a){var C,O,d,c,N,h,B,K,m,y,S,b,A,L,P,w,x,F,T,f,g,p,o,R,r=n.data,D=n.width,U=n.height,z=a+a+1,G=D-1,W=U-1,u=a+1,k=u*(u+1)/2,I=new t,H=null,s=I,l=null,v=null,E=e[a],M=i[a];for(d=1;z>d;d++)s=s.next=new t,d==u&&(H=s);for(s.next=I,B=h=0,O=0;U>O;O++){for(w=x=F=T=K=m=y=S=0,b=u*(f=r[h]),A=u*(g=r[h+1]),L=u*(p=r[h+2]),P=u*(o=r[h+3]),K+=k*f,m+=k*g,y+=k*p,S+=k*o,s=I,d=0;u>d;d++)s.r=f,s.g=g,s.b=p,s.a=o,s=s.next;for(d=1;u>d;d++)c=h+((d>G?G:d)<<2),K+=(s.r=f=r[c])*(R=u-d),m+=(s.g=g=r[c+1])*R,y+=(s.b=p=r[c+2])*R,S+=(s.a=o=r[c+3])*R,w+=f,x+=g,F+=p,T+=o,s=s.next;for(l=I,v=H,C=0;D>C;C++)r[h+3]=o=S*E>>M,0!==o?(o=255/o,r[h]=(K*E>>M)*o,r[h+1]=(m*E>>M)*o,r[h+2]=(y*E>>M)*o):r[h]=r[h+1]=r[h+2]=0,K-=b,m-=A,y-=L,S-=P,b-=l.r,A-=l.g,L-=l.b,P-=l.a,c=B+((c=C+a+1)C;C++){for(x=F=T=w=m=y=S=K=0,h=C<<2,b=u*(f=r[h]),A=u*(g=r[h+1]),L=u*(p=r[h+2]),P=u*(o=r[h+3]),K+=k*f,m+=k*g,y+=k*p,S+=k*o,s=I,d=0;u>d;d++)s.r=f,s.g=g,s.b=p,s.a=o,s=s.next;for(N=D,d=1;a>=d;d++)h=N+C<<2,K+=(s.r=f=r[h])*(R=u-d),m+=(s.g=g=r[h+1])*R,y+=(s.b=p=r[h+2])*R,S+=(s.a=o=r[h+3])*R,w+=f,x+=g,F+=p,T+=o,s=s.next,W>d&&(N+=D);for(h=C,l=I,v=H,O=0;U>O;O++)c=h<<2,r[c+3]=o=S*E>>M,o>0?(o=255/o,r[c]=(K*E>>M)*o,r[c+1]=(m*E>>M)*o,r[c+2]=(y*E>>M)*o):r[c]=r[c+1]=r[c+2]=0,K-=b,m-=A,y-=L,S-=P,b-=l.r,A-=l.g,L-=l.b,P-=l.a,c=C+((c=O+u)0&&n(t,e)},Kinetic.Factory.addGetterSetter(Kinetic.Node,'blurRadius',0,null,Kinetic.Factory.afterSetFilter)}(),function(){function e(t,e,i){var n=4*(i*t.width+e),a=[];return a.push(t.data[n++],t.data[n++],t.data[n++],t.data[n++]),a};function t(t,e){return Math.sqrt(Math.pow(t[0]-e[0],2)+Math.pow(t[1]-e[1],2)+Math.pow(t[2]-e[2],2))};function i(t){for(var e=[0,0,0],i=0;iu?0:255};return d}};function a(t,e){for(var i=0;io;o++)for(var r=0;e>r;r++){for(var v=o*e+r,l=0,a=0;s>a;a++)for(var n=0;s>n;n++){var c=o+a-u,h=r+n-u;if(c>=0&&i>c&&h>=0&&e>h){var g=c*e+h,p=d[a*s+n];l+=t[g]*p}};f[v]=2040===l?255:0};return f};function s(t,e,i){for(var d=[1,1,1,1,1,1,1,1,1],s=Math.round(Math.sqrt(d.length)),u=Math.floor(s/2),f=[],o=0;i>o;o++)for(var r=0;e>r;r++){for(var v=o*e+r,l=0,a=0;s>a;a++)for(var n=0;s>n;n++){var c=o+a-u,h=r+n-u;if(c>=0&&i>c&&h>=0&&e>h){var g=c*e+h,p=d[a*s+n];l+=t[g]*p}};f[v]=l>=1020?255:0};return f};function o(t,e,i){for(var d=[1/9,1/9,1/9,1/9,1/9,1/9,1/9,1/9,1/9],s=Math.round(Math.sqrt(d.length)),u=Math.floor(s/2),f=[],o=0;i>o;o++)for(var r=0;e>r;r++){for(var v=o*e+r,l=0,a=0;s>a;a++)for(var n=0;s>n;n++){var c=o+a-u,h=r+n-u;if(c>=0&&i>c&&h>=0&&e>h){var g=c*e+h,p=d[a*s+n];l+=t[g]*p}};f[v]=l};return f};Kinetic.Filters.Mask=function(t){var i=this.threshold(),e=n(t,i);return e&&(e=r(e,t.width,t.height),e=s(e,t.width,t.height),e=o(e,t.width,t.height),a(t,e)),t},Kinetic.Factory.addGetterSetter(Kinetic.Node,'threshold',0,null,Kinetic.Factory.afterSetFilter)}(),function(){Kinetic.Filters.RGB=function(t){var e,n,i=t.data,a=i.length,r=this.red(),s=this.green(),o=this.blue();for(e=0;a>e;e+=4)n=(.34*i[e]+.5*i[e+1]+.16*i[e+2])/255,i[e]=n*r,i[e+1]=n*s,i[e+2]=n*o,i[e+3]=i[e+3]},Kinetic.Factory.addGetterSetter(Kinetic.Node,'red',0,function(t){return this._filterUpToDate=!1,t>255?255:0>t?0:Math.round(t)}),Kinetic.Factory.addGetterSetter(Kinetic.Node,'green',0,function(t){return this._filterUpToDate=!1,t>255?255:0>t?0:Math.round(t)}),Kinetic.Factory.addGetterSetter(Kinetic.Node,'blue',0,Kinetic.Validators.RGBComponent,Kinetic.Factory.afterSetFilter)}(),function(){Kinetic.Filters.HSV=function(t){var e,s,o,c,h,n=t.data,u=n.length,i=Math.pow(2,this.value()),l=Math.pow(2,this.saturation()),d=Math.abs(this.hue()+360)%360,a=i*l*Math.cos(d*Math.PI/180),r=i*l*Math.sin(d*Math.PI/180),f=.299*i+.701*a+.167*r,g=.587*i-.587*a+.33*r,p=.114*i-.114*a-.497*r,v=.299*i-.299*a-.328*r,K=.587*i+.413*a+.035*r,m=.114*i-.114*a+.293*r,y=.299*i-.3*a+1.25*r,S=.587*i-.586*a-1.05*r,C=.114*i+.886*a-.2*r;for(e=0;u>e;e+=4)s=n[e+0],o=n[e+1],c=n[e+2],h=n[e+3],n[e+0]=f*s+g*o+p*c,n[e+1]=v*s+K*o+m*c,n[e+2]=y*s+S*o+C*c,n[e+3]=h},Kinetic.Factory.addGetterSetter(Kinetic.Node,'hue',0,null,Kinetic.Factory.afterSetFilter),Kinetic.Factory.addGetterSetter(Kinetic.Node,'saturation',0,null,Kinetic.Factory.afterSetFilter),Kinetic.Factory.addGetterSetter(Kinetic.Node,'value',0,null,Kinetic.Factory.afterSetFilter)}(),function(){Kinetic.Factory.addGetterSetter(Kinetic.Node,'hue',0,null,Kinetic.Factory.afterSetFilter),Kinetic.Factory.addGetterSetter(Kinetic.Node,'saturation',0,null,Kinetic.Factory.afterSetFilter),Kinetic.Factory.addGetterSetter(Kinetic.Node,'luminance',0,null,Kinetic.Factory.afterSetFilter),Kinetic.Filters.HSL=function(t){var e,s,o,c,l,n=t.data,f=n.length,i=1,d=Math.pow(2,this.saturation()),u=Math.abs(this.hue()+360)%360,h=127*this.luminance(),a=i*d*Math.cos(u*Math.PI/180),r=i*d*Math.sin(u*Math.PI/180),g=.299*i+.701*a+.167*r,p=.587*i-.587*a+.33*r,v=.114*i-.114*a-.497*r,K=.299*i-.299*a-.328*r,m=.587*i+.413*a+.035*r,y=.114*i-.114*a+.293*r,S=.299*i-.3*a+1.25*r,C=.587*i-.586*a-1.05*r,w=.114*i+.886*a-.2*r;for(e=0;f>e;e+=4)s=n[e+0],o=n[e+1],c=n[e+2],l=n[e+3],n[e+0]=g*s+p*o+v*c+h,n[e+1]=K*s+m*o+y*c+h,n[e+2]=S*s+C*o+w*c+h,n[e+3]=l}}(),function(){Kinetic.Filters.Emboss=function(t){var T=10*this.embossStrength(),b=255*this.embossWhiteLevel(),A=this.embossDirection(),L=this.embossBlend(),a=0,r=0,e=t.data,f=t.width,y=t.height,P=4*f,l=y;switch(A){case'top-left':a=-1,r=-1;break;case'top':a=-1,r=0;break;case'top-right':a=-1,r=1;break;case'right':a=0,r=1;break;case'bottom-right':a=1,r=1;break;case'bottom':a=1,r=0;break;case'bottom-left':a=1,r=-1;break;case'left':a=0,r=-1};do{var F=(l-1)*P,h=a;1>l+h&&(h=0),l+h>y&&(h=0);var x=(l-1+h)*f*4,c=f;do{var i=F+4*(c-1),o=r;1>c+o&&(o=0),c+o>f&&(o=0);var K=x+4*(c-1+o),S=e[i]-e[K],d=e[i+1]-e[K+1],u=e[i+2]-e[K+2],n=S,m=n>0?n:-n,C=d>0?d:-d,w=u>0?u:-u;if(C>m&&(n=d),w>m&&(n=u),n*=T,L){var g=e[i]+n,p=e[i+1]+n,v=e[i+2]+n;e[i]=g>255?255:0>g?0:g,e[i+1]=p>255?255:0>p?0:p,e[i+2]=v>255?255:0>v?0:v} else{var s=b-n;0>s?s=0:s>255&&(s=255),e[i]=e[i+1]=e[i+2]=s}} while(--c)} while(--l)},Kinetic.Factory.addGetterSetter(Kinetic.Node,'embossStrength',.5,null,Kinetic.Factory.afterSetFilter),Kinetic.Factory.addGetterSetter(Kinetic.Node,'embossWhiteLevel',.5,null,Kinetic.Factory.afterSetFilter),Kinetic.Factory.addGetterSetter(Kinetic.Node,'embossDirection','top-left',null,Kinetic.Factory.afterSetFilter),Kinetic.Factory.addGetterSetter(Kinetic.Node,'embossBlend',!1,null,Kinetic.Factory.afterSetFilter)}(),function(){function t(t,e,i,n,a){var r,o=i-e,s=a-n;return 0===o?n+s/2:0===s?n:(r=(t-e)/o,r=s*r+n)};Kinetic.Filters.Enhance=function(e){var f,g,p,n,a=e.data,L=a.length,r=a[0],c=r,s=a[1],h=s,o=a[2],l=o,d=a[3],u=d,i=this.enhance();if(0!==i){for(n=0;L>n;n+=4)f=a[n+0],r>f?r=f:f>c&&(c=f),g=a[n+1],s>g?s=g:g>h&&(h=g),p=a[n+2],o>p?o=p:p>l&&(l=p);c===r&&(c=255,r=0),h===s&&(h=255,s=0),l===o&&(l=255,o=0),u===d&&(u=255,d=0);var v,K,m,y,S,C,w,x,b,F,A,T;for(i>0?(K=c+i*(255-c),m=r-i*(r-0),S=h+i*(255-h),C=s-i*(s-0),x=l+i*(255-l),T=o-i*(o-0),A=u+i*(255-u),b=d-i*(d-0)):(v=.5*(c+r),K=c+i*(c-v),m=r+i*(r-v),y=.5*(h+s),S=h+i*(h-y),C=s+i*(s-y),w=.5*(l+o),x=l+i*(l-w),T=o+i*(o-w),F=.5*(u+d),A=u+i*(u-F),b=d+i*(d-F)),n=0;L>n;n+=4)a[n+0]=t(a[n+0],r,c,m,K),a[n+1]=t(a[n+1],s,h,C,S),a[n+2]=t(a[n+2],o,l,T,x)}},Kinetic.Factory.addGetterSetter(Kinetic.Node,'enhance',0,null,Kinetic.Factory.afterSetFilter)}(),function(){Kinetic.Filters.Posterize=function(t){var e,a=Math.round(254*this.levels())+1,i=t.data,r=i.length,n=255/a;for(e=0;r>e;e+=1)i[e]=Math.floor(i[e]/n)*n},Kinetic.Factory.addGetterSetter(Kinetic.Node,'levels',.5,null,Kinetic.Factory.afterSetFilter)}(),function(){Kinetic.Filters.Noise=function(t){var e,a=255*this.noise(),n=t.data,r=n.length,i=a/2;for(e=0;r>e;e+=4)n[e+0]+=i-2*i*Math.random(),n[e+1]+=i-2*i*Math.random(),n[e+2]+=i-2*i*Math.random()},Kinetic.Factory.addGetterSetter(Kinetic.Node,'noise',.2,null,Kinetic.Factory.afterSetFilter)}(),function(){Kinetic.Filters.Pixelate=function(t){var e,i,n,o,c,h,g,l,p,d,v,u,f,r,a=Math.ceil(this.pixelSize()),s=t.width,K=t.height,m=Math.ceil(s/a),y=Math.ceil(K/a);for(t=t.data,u=0;m>u;u+=1)for(f=0;y>f;f+=1){for(o=0,c=0,h=0,g=0,l=u*a,p=l+a,d=f*a,v=d+a,r=0,e=l;p>e;e+=1)if(!(e>=s))for(i=d;v>i;i+=1)i>=K||(n=4*(s*i+e),o+=t[n+0],c+=t[n+1],h+=t[n+2],g+=t[n+3],r+=1);for(o/=r,c/=r,h/=r,e=l;p>e;e+=1)if(!(e>=s))for(i=d;v>i;i+=1)i>=K||(n=4*(s*i+e),t[n+0]=o,t[n+1]=c,t[n+2]=h,t[n+3]=g)}},Kinetic.Factory.addGetterSetter(Kinetic.Node,'pixelSize',8,null,Kinetic.Factory.afterSetFilter)}(),function(){Kinetic.Filters.Threshold=function(t){var e,n=255*this.threshold(),i=t.data,a=i.length;for(e=0;a>e;e+=1)i[e]=i[e]255?255:o,i[e+1]=c>255?255:c,i[e+2]=h>255?255:h,i[e+3]=i[e+3];while(--s)} while(--u)}}(),function(){Kinetic.Filters.Solarize=function(t){var i=t.data,o=t.width,l=t.height,d=4*o,c=l;do{var h=(c-1)*d,s=o;do{var e=h+4*(s-1),n=i[e],a=i[e+1],r=i[e+2];n>127&&(n=255-n),a>127&&(a=255-a),r>127&&(r=255-r),i[e]=n,i[e+1]=a,i[e+2]=r} while(--s)} while(--c)}}(),function(){var e=function(t,e,i){var n,s,o,p,l=t.data,d=e.data,c=t.width,v=t.height,u=i.polarCenterX||c/2,f=i.polarCenterY||v/2,C=0,w=0,x=0,F=0,h=Math.sqrt(u*u+f*f);s=c-u,o=v-f,p=Math.sqrt(s*s+o*o),h=p>h?p:h;var a,r,K,m,g=v,y=c,S=360/y*Math.PI/180;for(r=0;y>r;r+=1)for(K=Math.sin(r*S),m=Math.cos(r*S),a=0;g>a;a+=1)s=Math.floor(u+h*a/g*m),o=Math.floor(f+h*a/g*K),n=4*(o*c+s),C=l[n+0],w=l[n+1],x=l[n+2],F=l[n+3],n=4*(r+a*c),d[n+0]=C,d[n+1]=w,d[n+2]=x,d[n+3]=F},i=function(t,e,i){var n,a,r,c,h,v,l=t.data,d=e.data,s=t.width,u=t.height,f=i.polarCenterX||s/2,g=i.polarCenterY||u/2,S=0,C=0,w=0,x=0,p=Math.sqrt(f*f+g*g);a=s-f,r=u-g,v=Math.sqrt(a*a+r*r),p=v>p?v:p;var K,o,m,y,F=u,T=s,b=i.polarRotation||0;for(a=0;s>a;a+=1)for(r=0;u>r;r+=1)c=a-f,h=r-g,K=Math.sqrt(c*c+h*h)*F/p,o=(180*Math.atan2(h,c)/Math.PI+360+b)%360,o=o*T/360,m=Math.floor(o),y=Math.floor(K),n=4*(y*s+m),S=l[n+0],C=l[n+1],w=l[n+2],x=l[n+3],n=4*(r*s+a),d[n+0]=S,d[n+1]=C,d[n+2]=w,d[n+3]=x},t=Kinetic.Util.createCanvasElement();Kinetic.Filters.Kaleidoscope=function(n){var s,o,w,m,f,g,p,v,c,h,r=n.width,u=n.height,K=Math.round(this.kaleidoscopePower()),F=Math.round(this.kaleidoscopeAngle()),x=Math.floor(r*(F%360)/360);if(!(1>K)){t.width=r,t.height=u;var a=t.getContext('2d').getImageData(0,0,r,u);e(n,a,{polarCenterX:r/2,polarCenterY:u/2});for(var l=r/Math.pow(2,K);8>=l;)l=2*l,K-=1;l=Math.ceil(l);var d=l,y=0,S=d,C=1;for(x+l>r&&(y=d,S=0,C=-1),o=0;u>o;o+=1)for(s=y;s!==S;s+=C)w=Math.round(s+x)%r,c=4*(r*o+w),f=a.data[c+0],g=a.data[c+1],p=a.data[c+2],v=a.data[c+3],h=4*(r*o+s),a.data[h+0]=f,a.data[h+1]=g,a.data[h+2]=p,a.data[h+3]=v;for(o=0;u>o;o+=1)for(d=Math.floor(l),m=0;K>m;m+=1){for(s=0;d+1>s;s+=1)c=4*(r*o+s),f=a.data[c+0],g=a.data[c+1],p=a.data[c+2],v=a.data[c+3],h=4*(r*o+2*d-s-1),a.data[h+0]=f,a.data[h+1]=g,a.data[h+2]=p,a.data[h+3]=v;d*=2};i(a,n,{polarRotation:0})}},Kinetic.Factory.addGetterSetter(Kinetic.Node,'kaleidoscopePower',2,null,Kinetic.Factory.afterSetFilter),Kinetic.Factory.addGetterSetter(Kinetic.Node,'kaleidoscopeAngle',0,null,Kinetic.Factory.afterSetFilter)}(),function(){function a(t){Kinetic.root.setTimeout(t,1e3/60)};function r(){return n.apply(Kinetic.root,arguments)};var i=500,t=function(){return Kinetic.root.performance&&Kinetic.root.performance.now?function(){return Kinetic.root.performance.now()}:function(){return(new Date).getTime()}}(),n=function(){return Kinetic.root.requestAnimationFrame||Kinetic.root.webkitRequestAnimationFrame||Kinetic.root.mozRequestAnimationFrame||Kinetic.root.oRequestAnimationFrame||Kinetic.root.msRequestAnimationFrame||a}();Kinetic.Animation=function(e,i){var n=Kinetic.Animation;this.func=e,this.setLayers(i),this.id=n.animIdCounter++,this.frame={time:0,timeDiff:0,lastTime:t()}},Kinetic.Animation.prototype={setLayers:function(t){var e=[];e=t?t.length>0?t:[t]:[],this.layers=e},getLayers:function(){return this.layers},addLayer:function(t){var n,e,i=this.layers;if(i){for(n=i.length,e=0;n>e;e++)if(i[e]._id===t._id)return!1} else this.layers=[];return this.layers.push(t),!0},isRunning:function(){var t,i=Kinetic.Animation,e=i.animations,n=e.length;for(t=0;n>t;t++)if(e[t].id===this.id)return!0;return!1},start:function(){var e=Kinetic.Animation;this.stop(),this.frame.timeDiff=0,this.frame.lastTime=t(),e._addAnimation(this)},stop:function(){Kinetic.Animation._removeAnimation(this)},_updateFrameObject:function(t){this.frame.timeDiff=t-this.frame.lastTime,this.frame.lastTime=t,this.frame.time+=this.frame.timeDiff,this.frame.frameRate=1e3/this.frame.timeDiff}},Kinetic.Animation.animations=[],Kinetic.Animation.animIdCounter=0,Kinetic.Animation.animRunning=!1,Kinetic.Animation._addAnimation=function(t){this.animations.push(t),this._handleAnimation()},Kinetic.Animation._removeAnimation=function(t){var e,n=t.id,i=this.animations,a=i.length;for(e=0;a>e;e++)if(i[e].id===n){this.animations.splice(e,1);break}},Kinetic.Animation._runFrames=function(){var e,r,s,i,n,c,a,h,o={},l=this.animations;for(i=0;in;n++)a=r[n],void 0!==a._id&&(o[a._id]=a);s&&s.call(e,e.frame)};for(h in o)o[h].draw()},Kinetic.Animation._animationLoop=function(){var t=Kinetic.Animation;t.animations.length?(r(t._animationLoop),t._runFrames()):t.animRunning=!1},Kinetic.Animation._handleAnimation=function(){var t=this;this.animRunning||(this.animRunning=!0,t._animationLoop())};var e=Kinetic.Node.prototype.moveTo;Kinetic.Node.prototype.moveTo=function(t){e.call(this,t)},Kinetic.Layer.prototype.batchDraw=function(){var e=this,n=Kinetic.Animation;this.batchAnim||(this.batchAnim=new n(function(){e.lastBatchDrawTime&&t()-e.lastBatchDrawTime>i&&e.batchAnim.stop()},this)),this.lastBatchDrawTime=t(),this.batchAnim.isRunning()||(this.draw(),this.batchAnim.start())},Kinetic.Stage.prototype.batchDraw=function(){this.getChildren().each(function(t){t.batchDraw()})}}((1,eval)('this')),function(){var n={node:1,duration:1,easing:1,onFinish:1,yoyo:1},a=1,e=2,i=3,r=0;Kinetic.Tween=function(e){var a,o=this,s=e.node,i=s._id,c=e.duration||1,h=e.easing||Kinetic.Easings.Linear,l=!!e.yoyo;this.node=s,this._id=r++,this.anim=new Kinetic.Animation(function(){o.tween.onEnterFrame()},s.getLayer()),this.tween=new t(a,function(t){o._tweenFunc(t)},h,0,1,1e3*c,l),this._addListeners(),Kinetic.Tween.attrs[i]||(Kinetic.Tween.attrs[i]={}),Kinetic.Tween.attrs[i][this._id]||(Kinetic.Tween.attrs[i][this._id]={}),Kinetic.Tween.tweens[i]||(Kinetic.Tween.tweens[i]={});for(a in e)void 0===n[a]&&this._addAttr(a,e[a]);this.reset(),this.onFinish=e.onFinish,this.onReset=e.onReset},Kinetic.Tween.attrs={},Kinetic.Tween.tweens={},Kinetic.Tween.prototype={_addAttr:function(t,e){var n,a,s,i,o,c=this.node,r=c._id;if(s=Kinetic.Tween.tweens[r][t],s&&delete Kinetic.Tween.attrs[r][s][t],n=c.getAttr(t),Kinetic.Util._isArray(e))for(a=[],o=e.length,i=0;o>i;i++)a.push(e[i]-n[i]);else a=e-n;Kinetic.Tween.attrs[r][this._id][t]={start:n,diff:a},Kinetic.Tween.tweens[r][t]=this._id},_tweenFunc:function(t){var a,r,e,s,n,i,o,c=this.node,h=Kinetic.Tween.attrs[c._id][this._id];for(a in h){if(r=h[a],e=r.start,s=r.diff,Kinetic.Util._isArray(e))for(n=[],o=e.length,i=0;o>i;i++)n.push(e[i]+s[i]*t);else n=e+s*t;c.setAttr(a,n)}},_addListeners:function(){var t=this;this.tween.onPlay=function(){t.anim.start()},this.tween.onReverse=function(){t.anim.start()},this.tween.onPause=function(){t.anim.stop()},this.tween.onFinish=function(){t.onFinish&&t.onFinish()},this.tween.onReset=function(){t.onReset&&t.onReset()}},play:function(){return this.tween.play(),this},reverse:function(){return this.tween.reverse(),this},reset:function(){this.node;return this.tween.reset(),this},seek:function(t){this.node;return this.tween.seek(1e3*t),this},pause:function(){return this.tween.pause(),this},finish:function(){this.node;return this.tween.finish(),this},destroy:function(){var e,t=this.node._id,i=this._id,n=Kinetic.Tween.tweens[t];this.pause();for(e in n)delete Kinetic.Tween.tweens[t][e];delete Kinetic.Tween.attrs[t][i]}};var t=function(t,e,i,n,a,r,s){this.prop=t,this.propFunc=e,this.begin=n,this._pos=n,this.duration=r,this._change=0,this.prevPos=0,this.yoyo=s,this._time=0,this._position=0,this._startTime=0,this._finish=0,this.func=i,this._change=a-this.begin,this.pause()};t.prototype={fire:function(t){var e=this[t];e&&e()},setTime:function(t){t>this.duration?this.yoyo?(this._time=this.duration,this.reverse()):this.finish():0>t?this.yoyo?(this._time=0,this.play()):this.reset():(this._time=t,this.update())},getTime:function(){return this._time},setPosition:function(t){this.prevPos=this._pos,this.propFunc(t),this._pos=t},getPosition:function(t){return void 0===t&&(t=this._time),this.func(t,this.begin,this._change,this.duration)},play:function(){this.state=e,this._startTime=this.getTimer()-this._time,this.onEnterFrame(),this.fire('onPlay')},reverse:function(){this.state=i,this._time=this.duration-this._time,this._startTime=this.getTimer()-this._time,this.onEnterFrame(),this.fire('onReverse')},seek:function(t){this.pause(),this._time=t,this.update(),this.fire('onSeek')},reset:function(){this.pause(),this._time=0,this.update(),this.fire('onReset')},finish:function(){this.pause(),this._time=this.duration,this.update(),this.fire('onFinish')},update:function(){this.setPosition(this.getPosition(this._time))},onEnterFrame:function(){var t=this.getTimer()-this._startTime;this.state===e?this.setTime(t):this.state===i&&this.setTime(this.duration-t)},pause:function(){this.state=a,this.fire('onPause')},getTimer:function(){return(new Date).getTime()}},Kinetic.Easings={BackEaseIn:function(t,e,i,n){var a=1.70158;return i*(t/=n)*t*((a+1)*t-a)+e},BackEaseOut:function(t,e,i,n){var a=1.70158;return i*((t=t/n-1)*t*((a+1)*t+a)+1)+e},BackEaseInOut:function(t,e,i,n){var a=1.70158;return(t/=n/2)<1?i/2*t*t*(((a*=1.525)+1)*t-a)+e:i/2*((t-=2)*t*(((a*=1.525)+1)*t+a)+2)+e},ElasticEaseIn:function(t,e,i,n,a,r){var s=0;return 0===t?e:1==(t/=n)?e+i:(r||(r=.3*n),!a||at?-.5*a*Math.pow(2,10*(t-=1))*Math.sin(2*(t*n-s)*Math.PI/r)+e:a*Math.pow(2,-10*(t-=1))*Math.sin(2*(t*n-s)*Math.PI/r)*.5+i+e)},BounceEaseOut:function(t,e,i,n){return(t/=n)<1/2.75?7.5625*i*t*t+e:2/2.75>t?i*(7.5625*(t-=1.5/2.75)*t+.75)+e:2.5/2.75>t?i*(7.5625*(t-=2.25/2.75)*t+.9375)+e:i*(7.5625*(t-=2.625/2.75)*t+.984375)+e},BounceEaseIn:function(t,e,i,n){return i-Kinetic.Easings.BounceEaseOut(n-t,0,i,n)+e},BounceEaseInOut:function(t,e,i,n){return n/2>t?.5*Kinetic.Easings.BounceEaseIn(2*t,0,i,n)+e:.5*Kinetic.Easings.BounceEaseOut(2*t-n,0,i,n)+.5*i+e},EaseIn:function(t,e,i,n){return i*(t/=n)*t+e},EaseOut:function(t,e,i,n){return-i*(t/=n)*(t-2)+e},EaseInOut:function(t,e,i,n){return(t/=n/2)<1?i/2*t*t+e:-i/2*(--t*(t-2)-1)+e},StrongEaseIn:function(t,e,i,n){return i*(t/=n)*t*t*t*t+e},StrongEaseOut:function(t,e,i,n){return i*((t=t/n-1)*t*t*t*t+1)+e},StrongEaseInOut:function(t,e,i,n){return(t/=n/2)<1?i/2*t*t*t*t*t+e:i/2*((t-=2)*t*t*t*t+2)+e},Linear:function(t,e,i,n){return i*t/n+e}}}(),function(){Kinetic.DD={anim:new Kinetic.Animation,isDragging:!1,offset:{x:0,y:0},node:null,_drag:function(t){var i=Kinetic.DD,e=i.node;if(e){if(!i.isDragging){var n=e.getStage().getPointerPosition(),a=e.dragDistance(),r=Math.max(Math.abs(n.x-i.startPointerPos.x),Math.abs(n.y-i.startPointerPos.y));if(a>r)return};e._setDragPosition(t),i.isDragging||(i.isDragging=!0,e.fire('dragstart',{type:'dragstart',target:e,evt:t},!0)),e.fire('dragmove',{type:'dragmove',target:e,evt:t},!0)}},_endDragBefore:function(t){var a,n,e=Kinetic.DD,i=e.node;i&&(a=i.nodeType,n=i.getLayer(),e.anim.stop(),e.isDragging&&(e.isDragging=!1,Kinetic.listenClickTap=!1,t&&(t.dragEndNode=i)),delete e.node,(n||i).draw())},_endDragAfter:function(t){t=t||{};var e=t.dragEndNode;t&&e&&e.fire('dragend',{type:'dragend',target:e,evt:t},!0)}},Kinetic.Node.prototype.startDrag=function(){var t=Kinetic.DD,n=this.getStage(),a=this.getLayer(),e=n.getPointerPosition(),i=this.getAbsolutePosition();e&&(t.node&&t.node.stopDrag(),t.node=this,t.startPointerPos=e,t.offset.x=e.x-i.x,t.offset.y=e.y-i.y,t.anim.setLayers(a||this.getLayers()),t.anim.start(),this._setDragPosition())},Kinetic.Node.prototype._setDragPosition=function(t){var n=Kinetic.DD,i=this.getStage().getPointerPosition(),a=this.getDragBoundFunc();if(i){var e={x:i.x-n.offset.x,y:i.y-n.offset.y};void 0!==a&&(e=a.call(this,e,t)),this.setAbsolutePosition(e)}},Kinetic.Node.prototype.stopDrag=function(){var t=Kinetic.DD,e={};t._endDragBefore(e),t._endDragAfter(e)},Kinetic.Node.prototype.setDraggable=function(t){this._setAttr('draggable',t),this._dragChange()};var e=Kinetic.Node.prototype.destroy;Kinetic.Node.prototype.destroy=function(){var t=Kinetic.DD;t.node&&t.node._id===this._id&&this.stopDrag(),e.call(this)},Kinetic.Node.prototype.isDragging=function(){var t=Kinetic.DD;return t.node&&t.node._id===this._id&&t.isDragging},Kinetic.Node.prototype._listenDrag=function(){var t=this;this._dragCleanup(),'Stage'===this.getClassName()?this.on('contentMousedown.kinetic contentTouchstart.kinetic',function(e){Kinetic.DD.node||t.startDrag(e)}):this.on('mousedown.kinetic touchstart.kinetic',function(e){Kinetic.DD.node||t.startDrag(e)})},Kinetic.Node.prototype._dragChange=function(){if(this.attrs.draggable)this._listenDrag();else{this._dragCleanup();var e=this.getStage(),t=Kinetic.DD;e&&t.node&&t.node._id===this._id&&t.node.stopDrag()}},Kinetic.Node.prototype._dragCleanup=function(){'Stage'===this.getClassName()?(this.off('contentMousedown.kinetic'),this.off('contentTouchstart.kinetic')):(this.off('mousedown.kinetic'),this.off('touchstart.kinetic'))},Kinetic.Factory.addGetterSetter(Kinetic.Node,'dragBoundFunc'),Kinetic.Factory.addGetter(Kinetic.Node,'draggable',!1),Kinetic.Factory.addOverloadedGetterSetter(Kinetic.Node,'draggable');var t=Kinetic.document.documentElement;t.addEventListener('mouseup',Kinetic.DD._endDragBefore,!0),t.addEventListener('touchend',Kinetic.DD._endDragBefore,!0),t.addEventListener('mouseup',Kinetic.DD._endDragAfter,!1),t.addEventListener('touchend',Kinetic.DD._endDragAfter,!1)}(),function(){Kinetic.Util.addMethods(Kinetic.Container,{__init:function(t){this.children=new Kinetic.Collection,Kinetic.Node.call(this,t)},getChildren:function(t){if(t){var e=new Kinetic.Collection;return this.children.each(function(i){t(i)&&e.push(i)}),e};return this.children},hasChildren:function(){return this.getChildren().length>0},removeChildren:function(){for(var t,e=Kinetic.Collection.toCollection(this.children),i=0;i1)){if(t.getParent())return void t.moveTo(this);var i=this.children;return this._validateAdd(t),t.index=i.length,t.parent=this,i.push(t),this._fire('add',{child:t}),this};for(var e=0;en;n++)if(e=h[n],'#'===e.charAt(0))r=this._getNodeById(e.slice(1)),r&&i.push(r);else if('.'===e.charAt(0))o=this._getNodesByName(e.slice(1)),i=i.concat(o);else for(s=this.getChildren(),c=s.length,a=0;c>a;a++)i=i.concat(s[a]._get(e));return Kinetic.Collection.toCollection(i)},_getNodeById:function(t){var e=Kinetic.ids[t];return void 0!==e&&this.isAncestorOf(e)?e:null},_getNodesByName:function(t){var e=Kinetic.names[t]||[];return this._getDescendants(e)},_get:function(t){for(var e=Kinetic.Node.prototype._get.call(this,t),n=this.getChildren(),a=n.length,i=0;a>i;i++)e=e.concat(n[i]._get(t));return e},toObject:function(){var e=Kinetic.Node.prototype.toObject.call(this);e.children=[];for(var i=this.getChildren(),a=i.length,t=0;a>t;t++){var n=i[t];e.children.push(n.toObject())};return e},_getDescendants:function(t){for(var n=[],a=t.length,e=0;a>e;e++){var i=t[e];this.isAncestorOf(i)&&n.push(i)};return n},isAncestorOf:function(t){for(var e=t.getParent();e;){if(e._id===this._id)return!0;e=e.getParent()};return!1},clone:function(t){var e=Kinetic.Node.prototype.clone.call(this,t);return this.getChildren().each(function(t){e.add(t.clone())}),e},getAllIntersections:function(t){var e=[];return this.find('Shape').each(function(i){i.isVisible()&&i.intersects(t)&&e.push(i)}),e},_setChildrenIndices:function(){this.children.each(function(t,e){t.index=e})},drawScene:function(t,e){var n=this.getLayer(),i=t||n&&n.getCanvas(),r=i&&i.getContext(),a=this._cache.canvas,s=a&&a.scene;return this.isVisible()&&(s?this._drawCachedSceneCanvas(r):this._drawChildren(i,'drawScene',e)),this},drawHit:function(t,e){var n=this.getLayer(),i=t||n&&n.hitCanvas,r=i&&i.getContext(),a=this._cache.canvas,s=a&&a.hit;return this.shouldDrawHit()&&(s?this._drawCachedHitCanvas(r):this._drawChildren(i,'drawHit',e)),this},_drawChildren:function(t,e,i){var a,r,s=this.getLayer(),n=t&&t.getContext(),o=this.getClipWidth(),c=this.getClipHeight(),h=o&&c;h&&s&&(a=this.getClipX(),r=this.getClipY(),n.save(),s._applyTransform(this,n),n.beginPath(),n.rect(a,r,o,c),n.clip(),n.reset()),this.children.each(function(n){n[e](t,i)}),h&&n.restore()}}),Kinetic.Util.extend(Kinetic.Container,Kinetic.Node),Kinetic.Container.prototype.get=Kinetic.Container.prototype.find,Kinetic.Factory.addComponentsGetterSetter(Kinetic.Container,'clip',['x','y','width','height']),Kinetic.Factory.addGetterSetter(Kinetic.Container,'clipX'),Kinetic.Factory.addGetterSetter(Kinetic.Container,'clipY'),Kinetic.Factory.addGetterSetter(Kinetic.Container,'clipWidth'),Kinetic.Factory.addGetterSetter(Kinetic.Container,'clipHeight'),Kinetic.Collection.mapMethods(Kinetic.Container)}(),function(){function e(t){t.fill()};function i(t){t.stroke()};function n(t){t.fill()};function a(t){t.stroke()};function r(){this._clearCache(t)};var t='hasShadow';Kinetic.Util.addMethods(Kinetic.Shape,{__init:function(t){this.nodeType='Shape',this._fillFunc=e,this._strokeFunc=i,this._fillFuncHit=n,this._strokeFuncHit=a;for(var s,o=Kinetic.shapes;;)if(s=Kinetic.Util.getRandomColor(),s&&!(s in o))break;this.colorKey=s,o[s]=this,Kinetic.Node.call(this,t),this.on('shadowColorChange.kinetic shadowBlurChange.kinetic shadowOffsetChange.kinetic shadowOpacityChange.kinetic shadowEnabledChange.kinetic',r)},hasChildren:function(){return!1},getChildren:function(){return[]},getContext:function(){return this.getLayer().getContext()},getCanvas:function(){return this.getLayer().getCanvas()},hasShadow:function(){return this._getCache(t,this._hasShadow)},_hasShadow:function(){return this.getShadowEnabled()&&0!==this.getShadowOpacity()&&!!(this.getShadowColor()||this.getShadowBlur()||this.getShadowOffsetX()||this.getShadowOffsetY())},hasFill:function(){return!!(this.getFill()||this.getFillPatternImage()||this.getFillLinearGradientColorStops()||this.getFillRadialGradientColorStops())},hasStroke:function(){return!!(this.stroke()||this.strokeRed()||this.strokeGreen()||this.strokeBlue())},_get:function(t){return this.className===t||this.nodeType===t?[this]:[]},intersects:function(t){var i,n=this.getStage(),e=n.bufferHitCanvas;return e.getContext().clear(),this.drawScene(e),i=e.context.getImageData(Math.round(t.x),Math.round(t.y),1,1).data,i[3]>0},destroy:function(){Kinetic.Node.prototype.destroy.call(this),delete Kinetic.shapes[this.colorKey]},_useBufferCanvas:function(){return(this.hasShadow()||1!==this.getAbsoluteOpacity())&&this.hasFill()&&this.hasStroke()&&this.getStage()},drawScene:function(t,e){var o,a,n,s=this.getLayer(),h=t||s.getCanvas(),i=h.getContext(),l=this._cache.canvas,r=this.sceneFunc(),c=this.hasShadow();return this.isVisible()&&(l?this._drawCachedSceneCanvas(i):r&&(i.save(),this._useBufferCanvas()?(o=this.getStage(),a=o.bufferCanvas,n=a.getContext(),n.clear(),n.save(),n._applyLineJoin(this),s._applyTransform(this,n,e),r.call(this,n),n.restore(),c&&(i.save(),i._applyShadow(this),i.drawImage(a._canvas,0,0),i.restore()),i._applyOpacity(this),i.drawImage(a._canvas,0,0)):(i._applyLineJoin(this),s._applyTransform(this,i,e),c&&(i.save(),i._applyShadow(this),r.call(this,i),i.restore()),i._applyOpacity(this),r.call(this,i)),i.restore())),this},drawHit:function(t,e){var n=this.getLayer(),s=t||n.hitCanvas,i=s.getContext(),a=this.hitFunc()||this.sceneFunc(),r=this._cache.canvas,o=r&&r.hit;return this.shouldDrawHit()&&(o?this._drawCachedHitCanvas(i):a&&(i.save(),i._applyLineJoin(this),n._applyTransform(this,i,e),a.call(this,i),i.restore())),this},drawHitFromCache:function(t){var h,r,s,i,l,n,e,d,g=t||0,p=this._cache.canvas,o=this._getCachedSceneCanvas(),v=o.getContext(),K=p.hit,c=K.getContext(),u=o.getWidth(),f=o.getHeight();c.clear();try{for(h=v.getImageData(0,0,u,f),r=h.data,s=c.getImageData(0,0,u,f),i=s.data,l=r.length,n=Kinetic.Util._hexToRgb(this.colorKey),e=0;l>e;e+=4)d=r[e+3],d>g&&(i[e]=n.r,i[e+1]=n.g,i[e+2]=n.b,i[e+3]=255);c.putImageData(s,0,0)}catch(a){Kinetic.Util.warn('Unable to draw hit graph from cached scene canvas. '+a.message)};return this}}),Kinetic.Util.extend(Kinetic.Shape,Kinetic.Node),Kinetic.Factory.addGetterSetter(Kinetic.Shape,'stroke'),Kinetic.Factory.addGetterSetter(Kinetic.Shape,'strokeRed',0,Kinetic.Validators.RGBComponent),Kinetic.Factory.addGetterSetter(Kinetic.Shape,'strokeGreen',0,Kinetic.Validators.RGBComponent),Kinetic.Factory.addGetterSetter(Kinetic.Shape,'strokeBlue',0,Kinetic.Validators.RGBComponent),Kinetic.Factory.addGetterSetter(Kinetic.Shape,'strokeAlpha',1,Kinetic.Validators.alphaComponent),Kinetic.Factory.addGetterSetter(Kinetic.Shape,'strokeWidth',2),Kinetic.Factory.addGetterSetter(Kinetic.Shape,'lineJoin'),Kinetic.Factory.addGetterSetter(Kinetic.Shape,'lineCap'),Kinetic.Factory.addGetterSetter(Kinetic.Shape,'sceneFunc'),Kinetic.Factory.addGetterSetter(Kinetic.Shape,'hitFunc'),Kinetic.Factory.addGetterSetter(Kinetic.Shape,'dash'),Kinetic.Factory.addGetterSetter(Kinetic.Shape,'shadowColor'),Kinetic.Factory.addGetterSetter(Kinetic.Shape,'shadowRed',0,Kinetic.Validators.RGBComponent),Kinetic.Factory.addGetterSetter(Kinetic.Shape,'shadowGreen',0,Kinetic.Validators.RGBComponent),Kinetic.Factory.addGetterSetter(Kinetic.Shape,'shadowBlue',0,Kinetic.Validators.RGBComponent),Kinetic.Factory.addGetterSetter(Kinetic.Shape,'shadowAlpha',1,Kinetic.Validators.alphaComponent),Kinetic.Factory.addGetterSetter(Kinetic.Shape,'shadowBlur'),Kinetic.Factory.addGetterSetter(Kinetic.Shape,'shadowOpacity'),Kinetic.Factory.addComponentsGetterSetter(Kinetic.Shape,'shadowOffset',['x','y']),Kinetic.Factory.addGetterSetter(Kinetic.Shape,'shadowOffsetX',0),Kinetic.Factory.addGetterSetter(Kinetic.Shape,'shadowOffsetY',0),Kinetic.Factory.addGetterSetter(Kinetic.Shape,'fillPatternImage'),Kinetic.Factory.addGetterSetter(Kinetic.Shape,'fill'),Kinetic.Factory.addGetterSetter(Kinetic.Shape,'fillRed',0,Kinetic.Validators.RGBComponent),Kinetic.Factory.addGetterSetter(Kinetic.Shape,'fillGreen',0,Kinetic.Validators.RGBComponent),Kinetic.Factory.addGetterSetter(Kinetic.Shape,'fillBlue',0,Kinetic.Validators.RGBComponent),Kinetic.Factory.addGetterSetter(Kinetic.Shape,'fillAlpha',1,Kinetic.Validators.alphaComponent),Kinetic.Factory.addGetterSetter(Kinetic.Shape,'fillPatternX',0),Kinetic.Factory.addGetterSetter(Kinetic.Shape,'fillPatternY',0),Kinetic.Factory.addGetterSetter(Kinetic.Shape,'fillLinearGradientColorStops'),Kinetic.Factory.addGetterSetter(Kinetic.Shape,'fillRadialGradientStartRadius',0),Kinetic.Factory.addGetterSetter(Kinetic.Shape,'fillRadialGradientEndRadius',0),Kinetic.Factory.addGetterSetter(Kinetic.Shape,'fillRadialGradientColorStops'),Kinetic.Factory.addGetterSetter(Kinetic.Shape,'fillPatternRepeat','repeat'),Kinetic.Factory.addGetterSetter(Kinetic.Shape,'fillEnabled',!0),Kinetic.Factory.addGetterSetter(Kinetic.Shape,'strokeEnabled',!0),Kinetic.Factory.addGetterSetter(Kinetic.Shape,'shadowEnabled',!0),Kinetic.Factory.addGetterSetter(Kinetic.Shape,'dashEnabled',!0),Kinetic.Factory.addGetterSetter(Kinetic.Shape,'strokeScaleEnabled',!0),Kinetic.Factory.addGetterSetter(Kinetic.Shape,'fillPriority','color'),Kinetic.Factory.addComponentsGetterSetter(Kinetic.Shape,'fillPatternOffset',['x','y']),Kinetic.Factory.addGetterSetter(Kinetic.Shape,'fillPatternOffsetX',0),Kinetic.Factory.addGetterSetter(Kinetic.Shape,'fillPatternOffsetY',0),Kinetic.Factory.addComponentsGetterSetter(Kinetic.Shape,'fillPatternScale',['x','y']),Kinetic.Factory.addGetterSetter(Kinetic.Shape,'fillPatternScaleX',1),Kinetic.Factory.addGetterSetter(Kinetic.Shape,'fillPatternScaleY',1),Kinetic.Factory.addComponentsGetterSetter(Kinetic.Shape,'fillLinearGradientStartPoint',['x','y']),Kinetic.Factory.addGetterSetter(Kinetic.Shape,'fillLinearGradientStartPointX',0),Kinetic.Factory.addGetterSetter(Kinetic.Shape,'fillLinearGradientStartPointY',0),Kinetic.Factory.addComponentsGetterSetter(Kinetic.Shape,'fillLinearGradientEndPoint',['x','y']),Kinetic.Factory.addGetterSetter(Kinetic.Shape,'fillLinearGradientEndPointX',0),Kinetic.Factory.addGetterSetter(Kinetic.Shape,'fillLinearGradientEndPointY',0),Kinetic.Factory.addComponentsGetterSetter(Kinetic.Shape,'fillRadialGradientStartPoint',['x','y']),Kinetic.Factory.addGetterSetter(Kinetic.Shape,'fillRadialGradientStartPointX',0),Kinetic.Factory.addGetterSetter(Kinetic.Shape,'fillRadialGradientStartPointY',0),Kinetic.Factory.addComponentsGetterSetter(Kinetic.Shape,'fillRadialGradientEndPoint',['x','y']),Kinetic.Factory.addGetterSetter(Kinetic.Shape,'fillRadialGradientEndPointX',0),Kinetic.Factory.addGetterSetter(Kinetic.Shape,'fillRadialGradientEndPointY',0),Kinetic.Factory.addGetterSetter(Kinetic.Shape,'fillPatternRotation',0),Kinetic.Factory.backCompat(Kinetic.Shape,{dashArray:'dash',getDashArray:'getDash',setDashArray:'getDash',drawFunc:'sceneFunc',getDrawFunc:'getSceneFunc',setDrawFunc:'setSceneFunc',drawHitFunc:'hitFunc',getDrawHitFunc:'getHitFunc',setDrawHitFunc:'setHitFunc'}),Kinetic.Collection.mapMethods(Kinetic.Shape)}(),function(){function N(t,e){t.content.addEventListener(e,function(i){t[M+e](i)},!1)};var u='Stage',f='string',n='px',t='mouseout',e='mouseleave',a='mouseover',g='mouseenter',r='mousemove',s='mousedown',o='mouseup',p='click',v='dblclick',c='touchstart',h='touchend',K='tap',m='dbltap',l='touchmove',y='contentMouseout',S='contentMouseover',C='contentMousemove',w='contentMousedown',x='contentMouseup',F='contentClick',T='contentDblclick',b='contentTouchstart',A='contentTouchend',L='contentDbltap',P='contentTouchmove',i='div',R='relative',D='inline-block',k='kineticjs-content',E=' ',M='_',O='container',I='',d=[s,r,o,t,c,l,h,a],G=d.length;Kinetic.Util.addMethods(Kinetic.Stage,{___init:function(t){this.nodeType=u,Kinetic.Container.call(this,t),this._id=Kinetic.idCounter++,this._buildDOM(),this._bindContentEvents(),this._enableNestedTransforms=!1,Kinetic.stages.push(this)},_validateAdd:function(t){'Layer'!==t.getType()&&Kinetic.Util.error('You may only add layers to the stage.')},setContainer:function(t){if(typeof t===f){var e=t;if(t=Kinetic.document.getElementById(t),!t)throw'Can not find container in document with id '+e};return this._setAttr(O,t),this},shouldDrawHit:function(){return!0},draw:function(){return Kinetic.Node.prototype.draw.call(this),this},setHeight:function(t){return Kinetic.Node.prototype.setHeight.call(this,t),this._resizeDOM(),this},setWidth:function(t){return Kinetic.Node.prototype.setWidth.call(this,t),this._resizeDOM(),this},clear:function(){var t,e=this.children,i=e.length;for(t=0;i>t;t++)e[t].clear();return this},clone:function(t){return t||(t={}),t.container=Kinetic.document.createElement(i),Kinetic.Container.prototype.clone.call(this,t)},destroy:function(){var t=this.content;Kinetic.Container.prototype.destroy.call(this),t&&Kinetic.Util._isInDocument(t)&&this.getContainer().removeChild(t);var e=Kinetic.stages.indexOf(this);e>-1&&Kinetic.stages.splice(e,1)},getPointerPosition:function(){return this.pointerPos},getStage:function(){return this},getContent:function(){return this.content},toDataURL:function(t){function s(e){var h=r[e],l=h.toDataURL(),i=new Kinetic.window.Image;i.onload=function(){a.drawImage(i,0,0),e=0;e--)if(i=n[e].getIntersection(t))return i;return null},_resizeDOM:function(){if(this.content){var i,a,t=this.getWidth(),e=this.getHeight(),r=this.getChildren(),s=r.length;for(this.content.style.width=t+n,this.content.style.height=e+n,this.bufferCanvas.setSize(t,e),this.bufferHitCanvas.setSize(t,e),i=0;s>i;i++)a=r[i],a.getCanvas().setSize(t,e),a.hitCanvas.setSize(t,e),a.draw()}},add:function(t){if(!(arguments.length>1))return Kinetic.Container.prototype.add.call(this,t),t._setCanvasSize(this.width(),this.height()),t.draw(),this.content.appendChild(t.canvas._canvas),this;for(var e=0;et;t++)N(this,d[t])},_mouseover:function(t){Kinetic.UA.mobile||(this._setPointerPosition(t),this._fire(S,{evt:t}))},_mouseout:function(i){if(!Kinetic.UA.mobile){this._setPointerPosition(i);var n=this.targetShape;n&&!Kinetic.isDragging()&&(n._fireAndBubble(t,{evt:i}),n._fireAndBubble(e,{evt:i}),this.targetShape=null),this.pointerPos=void 0,this._fire(y,{evt:i})}},_mousemove:function(i){if(!Kinetic.UA.mobile){this._setPointerPosition(i);var s=Kinetic.DD,n=this.getIntersection(this.getPointerPosition());n&&n.isListening()?Kinetic.isDragging()||this.targetShape&&this.targetShape._id===n._id?n._fireAndBubble(r,{evt:i}):(this.targetShape&&(this.targetShape._fireAndBubble(t,{evt:i},n),this.targetShape._fireAndBubble(e,{evt:i},n)),n._fireAndBubble(a,{evt:i},this.targetShape),n._fireAndBubble(g,{evt:i},this.targetShape),this.targetShape=n):this.targetShape&&!Kinetic.isDragging()&&(this.targetShape._fireAndBubble(t,{evt:i}),this.targetShape._fireAndBubble(e,{evt:i}),this.targetShape=null),this._fire(C,{evt:i}),s&&s._drag(i)};i.preventDefault&&i.preventDefault()},_mousedown:function(t){if(!Kinetic.UA.mobile){this._setPointerPosition(t);var e=this.getIntersection(this.getPointerPosition());Kinetic.listenClickTap=!0,e&&e.isListening()&&(this.clickStartShape=e,e._fireAndBubble(s,{evt:t})),this._fire(w,{evt:t})};t.preventDefault&&t.preventDefault()},_mouseup:function(t){if(!Kinetic.UA.mobile){this._setPointerPosition(t);var e=this.getIntersection(this.getPointerPosition()),n=this.clickStartShape,i=!1;Kinetic.inDblClickWindow?(i=!0,Kinetic.inDblClickWindow=!1):Kinetic.inDblClickWindow=!0,setTimeout(function(){Kinetic.inDblClickWindow=!1},Kinetic.dblClickWindow),e&&e.isListening()&&(e._fireAndBubble(o,{evt:t}),Kinetic.listenClickTap&&n&&n._id===e._id&&(e._fireAndBubble(p,{evt:t}),i&&e._fireAndBubble(v,{evt:t}))),this._fire(x,{evt:t}),Kinetic.listenClickTap&&(this._fire(F,{evt:t}),i&&this._fire(T,{evt:t})),Kinetic.listenClickTap=!1};t.preventDefault&&t.preventDefault()},_touchstart:function(t){this._setPointerPosition(t);var e=this.getIntersection(this.getPointerPosition());Kinetic.listenClickTap=!0,e&&e.isListening()&&(this.tapStartShape=e,e._fireAndBubble(c,{evt:t}),e.isListening()&&t.preventDefault&&t.preventDefault()),this._fire(b,{evt:t})},_touchend:function(t){this._setPointerPosition(t);var e=this.getIntersection(this.getPointerPosition()),i=!1;Kinetic.inDblClickWindow?(i=!0,Kinetic.inDblClickWindow=!1):Kinetic.inDblClickWindow=!0,setTimeout(function(){Kinetic.inDblClickWindow=!1},Kinetic.dblClickWindow),e&&e.isListening()&&(e._fireAndBubble(h,{evt:t}),Kinetic.listenClickTap&&e._id===this.tapStartShape._id&&(e._fireAndBubble(K,{evt:t}),i&&e._fireAndBubble(m,{evt:t})),e.isListening()&&t.preventDefault&&t.preventDefault()),Kinetic.listenClickTap&&(this._fire(A,{evt:t}),i&&this._fire(L,{evt:t})),Kinetic.listenClickTap=!1},_touchmove:function(t){this._setPointerPosition(t);var i=Kinetic.DD,e=this.getIntersection(this.getPointerPosition());e&&e.isListening()&&(e._fireAndBubble(l,{evt:t}),e.isListening()&&t.preventDefault&&t.preventDefault()),this._fire(P,{evt:t}),i&&i._drag(t)},_setPointerPosition:function(t){var a,n=this._getContentPosition(),r=t.offsetX,s=t.clientX,e=null,i=null;t=t?t:window.event,void 0!==t.touches?t.touches.length>0&&(a=t.touches[0],e=a.clientX-n.left,i=a.clientY-n.top):void 0!==r?(e=r,i=t.offsetY):'mozilla'===Kinetic.UA.browser?(e=t.layerX,i=t.layerY):void 0!==s&&n&&(e=s-n.left,i=t.clientY-n.top),null!==e&&null!==i&&(this.pointerPos={x:e,y:i})},_getContentPosition:function(){var t=this.content.getBoundingClientRect?this.content.getBoundingClientRect():{top:0,left:0};return{top:t.top,left:t.left}},_buildDOM:function(){var t=this.getContainer();if(!t){if(Kinetic.Util.isBrowser())throw'Stage has not container. But container is required';t=Kinetic.document.createElement(i)};t.innerHTML=I,this.content=Kinetic.document.createElement(i),this.content.style.position=R,this.content.style.display=D,this.content.className=k,this.content.setAttribute('role','presentation'),t.appendChild(this.content),this.bufferCanvas=new Kinetic.SceneCanvas({pixelRatio:1}),this.bufferHitCanvas=new Kinetic.HitCanvas,this._resizeDOM()},_onContent:function(t,e){var i,n,a=t.split(E),r=a.length;for(i=0;r>i;i++)n=a[i],this.content.addEventListener(n,e,!1)},cache:function(){Kinetic.Util.warn('Cache function is not allowed for stage. You may use cache only for layers, groups and shapes.')},clearCache:function(){}}),Kinetic.Util.extend(Kinetic.Stage,Kinetic.Container),Kinetic.Factory.addGetter(Kinetic.Stage,'container'),Kinetic.Factory.addOverloadedGetterSetter(Kinetic.Stage,'container')}(),function(){Kinetic.Util.addMethods(Kinetic.BaseLayer,{___init:function(t){this.nodeType='Layer',Kinetic.Container.call(this,t)},createPNGStream:function(){return this.canvas._canvas.createPNGStream()},getCanvas:function(){return this.canvas},getHitCanvas:function(){return this.hitCanvas},getContext:function(){return this.getCanvas().getContext()},clear:function(t){return this.getContext().clear(t),this.getHitCanvas().getContext().clear(t),this},setZIndex:function(t){Kinetic.Node.prototype.setZIndex.call(this,t);var e=this.getStage();return e&&(e.content.removeChild(this.getCanvas()._canvas),ti;i++){if(r=t[i],n=this._getIntersection({x:e.x+r.x,y:e.y+r.y}),s=n.shape)return s;if(!n.antialiased)return null}},_getIntersection:function(t){var n,a,i=this.hitCanvas.context._context.getImageData(t.x,t.y,1,1).data,r=i[3];return 255===r?(n=Kinetic.Util._rgbToHex(i[0],i[1],i[2]),a=Kinetic.shapes[e+n],{shape:a}):r>0?{antialiased:!0}:{}},drawScene:function(t,e){var a=this.getLayer(),r=t||a&&a.getCanvas();return this._fire(i,{node:this}),this.getClearBeforeDraw()&&r.getContext().clear(),Kinetic.Container.prototype.drawScene.call(this,r,e),this._fire(n,{node:this}),this},_applyTransform:function(t,e,i){var n=t.getAbsoluteTransform(i).getMatrix();e.transform(n[0],n[1],n[2],n[3],n[4],n[5])},drawHit:function(t,e){var i=this.getLayer(),n=t||i&&i.hitCanvas;return i&&i.getClearBeforeDraw()&&i.getHitCanvas().getContext().clear(),Kinetic.Container.prototype.drawHit.call(this,n,e),this},clear:function(t){return this.getContext().clear(t),this.getHitCanvas().getContext().clear(t),this},setVisible:function(t){return Kinetic.Node.prototype.setVisible.call(this,t),t?(this.getCanvas()._canvas.style.display='block',this.hitCanvas._canvas.style.display='block'):(this.getCanvas()._canvas.style.display='none',this.hitCanvas._canvas.style.display='none'),this},enableHitGraph:function(){return this.setHitGraphEnabled(!0),this},disableHitGraph:function(){return this.setHitGraphEnabled(!1),this}}),Kinetic.Util.extend(Kinetic.Layer,Kinetic.BaseLayer),Kinetic.Factory.addGetterSetter(Kinetic.Layer,'hitGraphEnabled',!0),Kinetic.Collection.mapMethods(Kinetic.Layer)}(),function(){Kinetic.Util.addMethods(Kinetic.FastLayer,{____init:function(t){this.nodeType='Layer',this.canvas=new Kinetic.SceneCanvas,Kinetic.BaseLayer.call(this,t)},_validateAdd:function(t){var e=t.getType();'Shape'!==e&&Kinetic.Util.error('You may only add shapes to a fast layer.')},_setCanvasSize:function(t,e){this.canvas.setSize(t,e)},hitGraphEnabled:function(){return!1},getIntersection:function(){return null},drawScene:function(t){var e=this.getLayer(),i=t||e&&e.getCanvas();return this.getClearBeforeDraw()&&i.getContext().clear(),Kinetic.Container.prototype.drawScene.call(this,i),this},_applyTransform:function(t,e,i){if(!i||i._id!==this._id){var n=t.getTransform().getMatrix();e.transform(n[0],n[1],n[2],n[3],n[4],n[5])}},draw:function(){return this.drawScene(),this},clear:function(t){return this.getContext().clear(t),this},setVisible:function(t){return Kinetic.Node.prototype.setVisible.call(this,t),this.getCanvas()._canvas.style.display=t?'block':'none',this}}),Kinetic.Util.extend(Kinetic.FastLayer,Kinetic.BaseLayer),Kinetic.Collection.mapMethods(Kinetic.FastLayer)}(),function(){Kinetic.Util.addMethods(Kinetic.Group,{___init:function(t){this.nodeType='Group',Kinetic.Container.call(this,t)},_validateAdd:function(t){var e=t.getType();'Group'!==e&&'Shape'!==e&&Kinetic.Util.error('You may only add groups and shapes to groups.')}}),Kinetic.Util.extend(Kinetic.Group,Kinetic.Container),Kinetic.Collection.mapMethods(Kinetic.Group)}(),function(){Kinetic.Rect=function(t){this.___init(t)},Kinetic.Rect.prototype={___init:function(t){Kinetic.Shape.call(this,t),this.className='Rect',this.sceneFunc(this._sceneFunc)},_sceneFunc:function(t){var e=this.getCornerRadius(),i=this.getWidth(),n=this.getHeight();t.beginPath(),e?(t.moveTo(e,0),t.lineTo(i-e,0),t.arc(i-e,e,e,3*Math.PI/2,0,!1),t.lineTo(i,n-e),t.arc(i-e,n-e,e,0,Math.PI/2,!1),t.lineTo(e,n),t.arc(e,n-e,e,Math.PI/2,Math.PI,!1),t.lineTo(0,e),t.arc(e,e,e,Math.PI,3*Math.PI/2,!1)):t.rect(0,0,i,n),t.closePath(),t.fillStrokeShape(this)}},Kinetic.Util.extend(Kinetic.Rect,Kinetic.Shape),Kinetic.Factory.addGetterSetter(Kinetic.Rect,'cornerRadius',0),Kinetic.Collection.mapMethods(Kinetic.Rect)}(),function(){var t=2*Math.PI-1e-4,e='Circle';Kinetic.Circle=function(t){this.___init(t)},Kinetic.Circle.prototype={___init:function(t){Kinetic.Shape.call(this,t),this.className=e,this.sceneFunc(this._sceneFunc)},_sceneFunc:function(e){e.beginPath(),e.arc(0,0,this.getRadius(),0,t,!1),e.closePath(),e.fillStrokeShape(this)},getWidth:function(){return 2*this.getRadius()},getHeight:function(){return 2*this.getRadius()},setWidth:function(t){Kinetic.Node.prototype.setWidth.call(this,t),this.setRadius(t/2)},setHeight:function(t){Kinetic.Node.prototype.setHeight.call(this,t),this.setRadius(t/2)}},Kinetic.Util.extend(Kinetic.Circle,Kinetic.Shape),Kinetic.Factory.addGetterSetter(Kinetic.Circle,'radius',0),Kinetic.Collection.mapMethods(Kinetic.Circle)}(),function(){var t=2*Math.PI-1e-4,e='Ellipse';Kinetic.Ellipse=function(t){this.___init(t)},Kinetic.Ellipse.prototype={___init:function(t){Kinetic.Shape.call(this,t),this.className=e,this.sceneFunc(this._sceneFunc)},_sceneFunc:function(e){var n=this.getRadius(),i=n.x,a=n.y;e.beginPath(),e.save(),i!==a&&e.scale(1,a/i),e.arc(0,0,i,0,t,!1),e.restore(),e.closePath(),e.fillStrokeShape(this)},getWidth:function(){return 2*this.getRadius().x},getHeight:function(){return 2*this.getRadius().y},setWidth:function(t){Kinetic.Node.prototype.setWidth.call(this,t),this.setRadius({x:t/2})},setHeight:function(t){Kinetic.Node.prototype.setHeight.call(this,t),this.setRadius({y:t/2})}},Kinetic.Util.extend(Kinetic.Ellipse,Kinetic.Shape),Kinetic.Factory.addComponentsGetterSetter(Kinetic.Ellipse,'radius',['x','y']),Kinetic.Factory.addGetterSetter(Kinetic.Ellipse,'radiusX',0),Kinetic.Factory.addGetterSetter(Kinetic.Ellipse,'radiusY',0),Kinetic.Collection.mapMethods(Kinetic.Ellipse)}(),function(){var t=2*Math.PI-1e-4;Kinetic.Ring=function(t){this.___init(t)},Kinetic.Ring.prototype={___init:function(t){Kinetic.Shape.call(this,t),this.className='Ring',this.sceneFunc(this._sceneFunc)},_sceneFunc:function(e){e.beginPath(),e.arc(0,0,this.getInnerRadius(),0,t,!1),e.moveTo(this.getOuterRadius(),0),e.arc(0,0,this.getOuterRadius(),t,0,!0),e.closePath(),e.fillStrokeShape(this)},getWidth:function(){return 2*this.getOuterRadius()},getHeight:function(){return 2*this.getOuterRadius()},setWidth:function(t){Kinetic.Node.prototype.setWidth.call(this,t),this.setOuterRadius(t/2)},setHeight:function(t){Kinetic.Node.prototype.setHeight.call(this,t),this.setOuterRadius(t/2)}},Kinetic.Util.extend(Kinetic.Ring,Kinetic.Shape),Kinetic.Factory.addGetterSetter(Kinetic.Ring,'innerRadius',0),Kinetic.Factory.addGetterSetter(Kinetic.Ring,'outerRadius',0),Kinetic.Collection.mapMethods(Kinetic.Ring)}(),function(){Kinetic.Wedge=function(t){this.___init(t)},Kinetic.Wedge.prototype={___init:function(t){Kinetic.Shape.call(this,t),this.className='Wedge',this.sceneFunc(this._sceneFunc)},_sceneFunc:function(t){t.beginPath(),t.arc(0,0,this.getRadius(),0,Kinetic.getAngle(this.getAngle()),this.getClockwise()),t.lineTo(0,0),t.closePath(),t.fillStrokeShape(this)}},Kinetic.Util.extend(Kinetic.Wedge,Kinetic.Shape),Kinetic.Factory.addGetterSetter(Kinetic.Wedge,'radius',0),Kinetic.Factory.addGetterSetter(Kinetic.Wedge,'angle',0),Kinetic.Factory.addGetterSetter(Kinetic.Wedge,'clockwise',!1),Kinetic.Factory.backCompat(Kinetic.Wedge,{angleDeg:'angle',getAngleDeg:'getAngle',setAngleDeg:'setAngle'}),Kinetic.Collection.mapMethods(Kinetic.Wedge)}(),function(){Math.PI/180;Kinetic.Arc=function(t){this.___init(t)},Kinetic.Arc.prototype={___init:function(t){Kinetic.Shape.call(this,t),this.className='Arc',this.sceneFunc(this._sceneFunc)},_sceneFunc:function(t){var e=Kinetic.getAngle(this.angle()),i=this.clockwise();t.beginPath(),t.arc(0,0,this.getOuterRadius(),0,e,i),t.arc(0,0,this.getInnerRadius(),e,0,!i),t.closePath(),t.fillStrokeShape(this)}},Kinetic.Util.extend(Kinetic.Arc,Kinetic.Shape),Kinetic.Factory.addGetterSetter(Kinetic.Arc,'innerRadius',0),Kinetic.Factory.addGetterSetter(Kinetic.Arc,'outerRadius',0),Kinetic.Factory.addGetterSetter(Kinetic.Arc,'angle',0),Kinetic.Factory.addGetterSetter(Kinetic.Arc,'clockwise',!1),Kinetic.Collection.mapMethods(Kinetic.Arc)}(),function(){var t='Image';Kinetic.Image=function(t){this.___init(t)},Kinetic.Image.prototype={___init:function(e){Kinetic.Shape.call(this,e),this.className=t,this.sceneFunc(this._sceneFunc),this.hitFunc(this._hitFunc)},_useBufferCanvas:function(){return(this.hasShadow()||1!==this.getAbsoluteOpacity())&&this.hasStroke()},_sceneFunc:function(t){var e,n,a,o,r=this.getWidth(),s=this.getHeight(),i=this.getImage();i&&(e=this.getCrop(),n=e.width,a=e.height,o=n&&a?[i,e.x,e.y,n,a,0,0,r,s]:[i,0,0,r,s]),t.beginPath(),t.rect(0,0,r,s),t.closePath(),t.fillStrokeShape(this),i&&t.drawImage.apply(t,o)},_hitFunc:function(t){var e=this.getWidth(),i=this.getHeight();t.beginPath(),t.rect(0,0,e,i),t.closePath(),t.fillStrokeShape(this)},getWidth:function(){var t=this.getImage();return this.attrs.width||(t?t.width:0)},getHeight:function(){var t=this.getImage();return this.attrs.height||(t?t.height:0)}},Kinetic.Util.extend(Kinetic.Image,Kinetic.Shape),Kinetic.Factory.addGetterSetter(Kinetic.Image,'image'),Kinetic.Factory.addComponentsGetterSetter(Kinetic.Image,'crop',['x','y','width','height']),Kinetic.Factory.addGetterSetter(Kinetic.Image,'cropX',0),Kinetic.Factory.addGetterSetter(Kinetic.Image,'cropY',0),Kinetic.Factory.addGetterSetter(Kinetic.Image,'cropWidth',0),Kinetic.Factory.addGetterSetter(Kinetic.Image,'cropHeight',0),Kinetic.Collection.mapMethods(Kinetic.Image)}(),function(){function S(t){t.fillText(this.partialText,0,0)};function C(t){t.strokeText(this.partialText,0,0)};var t='auto',s='center',o='Change.kinetic',c='2d',h='-',l='',n='left',d='text',u='Text',f='middle',a='normal',g='px ',i=' ',p='right',v='word',K='char',m='none',r=['fontFamily','fontSize','fontStyle','fontVariant','padding','align','lineHeight','text','width','height','wrap'],y=r.length,e=Kinetic.Util.createCanvasElement().getContext(c);Kinetic.Text=function(t){this.___init(t)},Kinetic.Text.prototype={___init:function(e){var n=this;void 0===e.width&&(e.width=t),void 0===e.height&&(e.height=t),Kinetic.Shape.call(this,e),this._fillFunc=S,this._strokeFunc=C,this.className=u;for(var i=0;y>i;i++)this.on(r[i]+o,n._setTextData);this._setTextData(),this.sceneFunc(this._sceneFunc),this.hitFunc(this._hitFunc)},_sceneFunc:function(t){var e,i=this.getPadding(),o=this.getTextHeight(),d=this.getLineHeight()*o,c=this.textArr,u=c.length,h=this.getWidth();for(t.setAttr('font',this._getContextFont()),t.setAttr('textBaseline',f),t.setAttr('textAlign',n),t.save(),t.translate(i,0),t.translate(0,i+o/2),e=0;u>e;e++){var a=c[e],l=a.text,r=a.width;t.save(),this.getAlign()===p?t.translate(h-r-2*i,0):this.getAlign()===s&&t.translate((h-r-2*i)/2,0),this.partialText=l,t.fillStrokeShape(this),t.restore(),t.translate(0,d)};t.restore()},_hitFunc:function(t){var e=this.getWidth(),i=this.getHeight();t.beginPath(),t.rect(0,0,e,i),t.closePath(),t.fillStrokeShape(this)},setText:function(t){var e=Kinetic.Util._isString(t)?t:t.toString();return this._setAttr(d,e),this},getWidth:function(){return this.attrs.width===t?this.getTextWidth()+2*this.getPadding():this.attrs.width},getHeight:function(){return this.attrs.height===t?this.getTextHeight()*this.textArr.length*this.getLineHeight()+2*this.getPadding():this.attrs.height},getTextWidth:function(){return this.textWidth},getTextHeight:function(){return this.textHeight},_getTextSize:function(t){var n,i=e,a=this.getFontSize();return i.save(),i.font=this._getContextFont(),n=i.measureText(t),i.restore(),{width:n.width,height:parseInt(a,10)}},_getContextFont:function(){return this.getFontStyle()+i+this.getFontVariant()+i+this.getFontSize()+g+this.getFontFamily()},_addTextLine:function(t,e){return this.textArr.push({text:t,width:e})},_getTextWidth:function(t){return e.measureText(t).width},_setTextData:function(){var C=this.getText().split('\n'),w=+this.getFontSize(),s=0,c=this.getLineHeight()*w,x=this.attrs.width,F=this.attrs.height,D=x!==t,T=F!==t,b=this.getPadding(),p=x-2*b,A=F-2*b,l=0,L=this.getWrap(),P=L!==m,k=L!==K&&P;this.textArr=[],e.save(),e.font=this._getContextFont();for(var g=0,R=C.length;R>g;++g){var n=C[g],r=this._getTextWidth(n);if(D&&r>p)for(;n.length>0;){for(var o=0,f=n.length,a='',d=0;f>o;){var u=o+f>>>1,y=n.slice(0,u+1),S=this._getTextWidth(y);p>=S?(o=u+1,a=y,d=S):f=u};if(!a)break;if(k){var v=Math.max(a.lastIndexOf(i),a.lastIndexOf(h))+1;v>0&&(o=v,a=a.slice(0,o),d=this._getTextWidth(a))};if(this._addTextLine(a,d),s=Math.max(s,d),l+=c,!P||T&&l+c>A)break;if(n=n.slice(o),n.length>0&&(r=this._getTextWidth(n),p>=r)){this._addTextLine(n,r),l+=c,s=Math.max(s,r);break}} else this._addTextLine(n,r),l+=c,s=Math.max(s,r);if(T&&l+c>A)break};e.restore(),this.textHeight=w,this.textWidth=s}},Kinetic.Util.extend(Kinetic.Text,Kinetic.Shape),Kinetic.Factory.addGetterSetter(Kinetic.Text,'fontFamily','Arial'),Kinetic.Factory.addGetterSetter(Kinetic.Text,'fontSize',12),Kinetic.Factory.addGetterSetter(Kinetic.Text,'fontStyle',a),Kinetic.Factory.addGetterSetter(Kinetic.Text,'fontVariant',a),Kinetic.Factory.addGetterSetter(Kinetic.Text,'padding',0),Kinetic.Factory.addGetterSetter(Kinetic.Text,'align',n),Kinetic.Factory.addGetterSetter(Kinetic.Text,'lineHeight',1),Kinetic.Factory.addGetterSetter(Kinetic.Text,'wrap',v),Kinetic.Factory.addGetter(Kinetic.Text,'text',l),Kinetic.Factory.addOverloadedGetterSetter(Kinetic.Text,'text'),Kinetic.Collection.mapMethods(Kinetic.Text)}(),function(){Kinetic.Line=function(t){this.___init(t)},Kinetic.Line.prototype={___init:function(t){Kinetic.Shape.call(this,t),this.className='Line',this.on('pointsChange.kinetic tensionChange.kinetic closedChange.kinetic',function(){this._clearCache('tensionPoints')}),this.sceneFunc(this._sceneFunc)},_sceneFunc:function(t){var e,a,i,n=this.getPoints(),r=n.length,o=this.getTension(),s=this.getClosed();if(t.beginPath(),t.moveTo(n[0],n[1]),0!==o&&r>4){for(e=this.getTensionPoints(),a=e.length,i=s?0:4,s||t.quadraticCurveTo(e[0],e[1],e[2],e[3]);a-2>i;)t.bezierCurveTo(e[i++],e[i++],e[i++],e[i++],e[i++],e[i++]);s||t.quadraticCurveTo(e[a-2],e[a-1],n[r-2],n[r-1])} else for(i=2;r>i;i+=2)t.lineTo(n[i],n[i+1]);s?(t.closePath(),t.fillStrokeShape(this)):t.strokeShape(this)},getTensionPoints:function(){return this._getCache('tensionPoints',this._getTensionPoints)},_getTensionPoints:function(){return this.getClosed()?this._getTensionPointsClosed():Kinetic.Util._expandPoints(this.getPoints(),this.getTension())},_getTensionPointsClosed:function(){var t=this.getPoints(),e=t.length,a=this.getTension(),r=Kinetic.Util,i=r._getControlPoints(t[e-2],t[e-1],t[0],t[1],t[2],t[3],a),n=r._getControlPoints(t[e-4],t[e-3],t[e-2],t[e-1],t[0],t[1],a),s=Kinetic.Util._expandPoints(t,a),o=[i[2],i[3]].concat(s).concat([n[0],n[1],t[e-2],t[e-1],n[2],n[3],i[0],i[1],t[0],t[1]]);return o}},Kinetic.Util.extend(Kinetic.Line,Kinetic.Shape),Kinetic.Factory.addGetterSetter(Kinetic.Line,'closed',!1),Kinetic.Factory.addGetterSetter(Kinetic.Line,'tension',0),Kinetic.Factory.addGetterSetter(Kinetic.Line,'points'),Kinetic.Collection.mapMethods(Kinetic.Line)}(),function(){Kinetic.Sprite=function(t){this.___init(t)},Kinetic.Sprite.prototype={___init:function(t){Kinetic.Shape.call(this,t),this.className='Sprite',this.anim=new Kinetic.Animation,this.on('animationChange.kinetic',function(){this.frameIndex(0)}),this.on('frameRateChange.kinetic',function(){this.anim.isRunning()&&(clearInterval(this.interval),this._setInterval())}),this.sceneFunc(this._sceneFunc),this.hitFunc(this._hitFunc)},_sceneFunc:function(t){var s=this.getAnimation(),o=this.frameIndex(),e=4*o,i=this.getAnimations()[s],c=i[e+0],h=i[e+1],n=i[e+2],a=i[e+3],r=this.getImage();r&&t.drawImage(r,c,h,n,a,0,0,n,a)},_hitFunc:function(t){var n=this.getAnimation(),a=this.frameIndex(),e=4*a,i=this.getAnimations()[n],r=i[e+2],s=i[e+3];t.beginPath(),t.rect(0,0,r,s),t.closePath(),t.fillShape(this)},_useBufferCanvas:function(){return(this.hasShadow()||1!==this.getAbsoluteOpacity())&&this.hasStroke()},_setInterval:function(){var t=this;this.interval=setInterval(function(){t._updateIndex()},1e3/this.getFrameRate())},start:function(){var t=this.getLayer();this.anim.setLayers(t),this._setInterval(),this.anim.start()},stop:function(){this.anim.stop(),clearInterval(this.interval)},isRunning:function(){return this.anim.isRunning()},_updateIndex:function(){var t=this.frameIndex(),e=this.getAnimation(),i=this.getAnimations(),n=i[e],a=n.length/4;this.frameIndex(a-1>t?t+1:0)}},Kinetic.Util.extend(Kinetic.Sprite,Kinetic.Shape),Kinetic.Factory.addGetterSetter(Kinetic.Sprite,'animation'),Kinetic.Factory.addGetterSetter(Kinetic.Sprite,'animations'),Kinetic.Factory.addGetterSetter(Kinetic.Sprite,'image'),Kinetic.Factory.addGetterSetter(Kinetic.Sprite,'frameIndex',0),Kinetic.Factory.addGetterSetter(Kinetic.Sprite,'frameRate',17),Kinetic.Factory.backCompat(Kinetic.Sprite,{index:'frameIndex',getIndex:'getFrameIndex',setIndex:'setFrameIndex'}),Kinetic.Collection.mapMethods(Kinetic.Sprite)}(),function(){Kinetic.Path=function(t){this.___init(t)},Kinetic.Path.prototype={___init:function(t){this.dataArray=[];var e=this;Kinetic.Shape.call(this,t),this.className='Path',this.dataArray=Kinetic.Path.parsePathData(this.getData()),this.on('dataChange.kinetic',function(){e.dataArray=Kinetic.Path.parsePathData(this.getData())}),this.sceneFunc(this._sceneFunc)},_sceneFunc:function(t){var r=this.dataArray,u=!1;t.beginPath();for(var a=0;an?i:n,l=i>n?1:i/n,d=i>n?n/i:1;t.translate(s,o),t.rotate(h),t.scale(l,d),t.arc(0,0,p,c,c+f,1-g),t.scale(1/l,1/d),t.rotate(-h),t.translate(-s,-o);break;case'z':t.closePath(),u=!0}};u?t.fillStrokeShape(this):t.strokeShape(this)}},Kinetic.Util.extend(Kinetic.Path,Kinetic.Shape),Kinetic.Path.getLineLength=function(t,e,i,n){return Math.sqrt((i-t)*(i-t)+(n-e)*(n-e))},Kinetic.Path.getPointOnLine=function(t,e,i,n,a,r,s){void 0===r&&(r=e),void 0===s&&(s=i);var o=(a-i)/(n-e+1e-8),c=Math.sqrt(t*t/(1+o*o));e>n&&(c*=-1);var h,l=o*c;if(n===e)h={x:r,y:s+l};else if((s-i)/(r-e+1e-8)===o)h={x:r+c,y:s+l};else{var u,f,g=this.getLineLength(e,i,n,a);if(1e-8>g)return void 0;var d=(r-e)*(n-e)+(s-i)*(a-i);d/=g*g,u=e+d*(n-e),f=i+d*(a-i);var p=this.getLineLength(r,s,u,f),v=Math.sqrt(t*t-p*p);c=Math.sqrt(v*v/(1+o*o)),e>n&&(c*=-1),l=o*c,h={x:u+c,y:f+l}};return h},Kinetic.Path.getPointOnCubicBezier=function(t,e,i,n,a,r,s,o,c){function h(t){return t*t*t};function l(t){return 3*t*t*(1-t)};function d(t){return 3*t*(1-t)*(1-t)};function u(t){return(1-t)*(1-t)*(1-t)};var f=o*h(t)+r*l(t)+n*d(t)+e*u(t),g=c*h(t)+s*l(t)+a*d(t)+i*u(t);return{x:f,y:g}},Kinetic.Path.getPointOnQuadraticBezier=function(t,e,i,n,a,r,s){function o(t){return t*t};function c(t){return 2*t*(1-t)};function h(t){return(1-t)*(1-t)};var l=r*o(t)+n*c(t)+e*h(t),d=s*o(t)+a*c(t)+i*h(t);return{x:l,y:d}},Kinetic.Path.getPointOnEllipticalArc=function(t,e,i,n,a,r){var o=Math.cos(r),c=Math.sin(r),s={x:i*Math.cos(a),y:n*Math.sin(a)};return{x:t+(s.x*o-s.y*c),y:e+(s.x*c+s.y*o)}},Kinetic.Path.parsePathData=function(t){if(!t)return[];var g=t,x=['m','M','l','L','v','V','h','H','z','Z','c','C','q','Q','t','T','s','S','a','A'];g=g.replace(new RegExp(' ','g'),',');for(var d=0;d0&&''===e[0]&&e.shift();for(var w=0;w0&&!isNaN(e[0]);){var o,c,h,p,v,K,m,y,S,C,s=null,a=[],b=i,A=n;switch(u){case'l':i+=e.shift(),n+=e.shift(),s='L',a.push(i,n);break;case'L':i=e.shift(),n=e.shift(),a.push(i,n);break;case'm':var F=e.shift(),T=e.shift();if(i+=F,n+=T,s='M',r.length>2&&'z'===r[r.length-1].command)for(var f=r.length-2;f>=0;f--)if('M'===r[f].command){i=r[f].points[0]+F,n=r[f].points[1]+T;break};a.push(i,n),u='l';break;case'M':i=e.shift(),n=e.shift(),s='M',a.push(i,n),u='L';break;case'h':i+=e.shift(),s='L',a.push(i,n);break;case'H':i=e.shift(),s='L',a.push(i,n);break;case'v':n+=e.shift(),s='L',a.push(i,n);break;case'V':n=e.shift(),s='L',a.push(i,n);break;case'C':a.push(e.shift(),e.shift(),e.shift(),e.shift()),i=e.shift(),n=e.shift(),a.push(i,n);break;case'c':a.push(i+e.shift(),n+e.shift(),i+e.shift(),n+e.shift()),i+=e.shift(),n+=e.shift(),s='C',a.push(i,n);break;case'S':c=i,h=n,o=r[r.length-1],'C'===o.command&&(c=i+(i-o.points[2]),h=n+(n-o.points[3])),a.push(c,h,e.shift(),e.shift()),i=e.shift(),n=e.shift(),s='C',a.push(i,n);break;case's':c=i,h=n,o=r[r.length-1],'C'===o.command&&(c=i+(i-o.points[2]),h=n+(n-o.points[3])),a.push(c,h,i+e.shift(),n+e.shift()),i+=e.shift(),n+=e.shift(),s='C',a.push(i,n);break;case'Q':a.push(e.shift(),e.shift()),i=e.shift(),n=e.shift(),a.push(i,n);break;case'q':a.push(i+e.shift(),n+e.shift()),i+=e.shift(),n+=e.shift(),s='Q',a.push(i,n);break;case'T':c=i,h=n,o=r[r.length-1],'Q'===o.command&&(c=i+(i-o.points[0]),h=n+(n-o.points[1])),i=e.shift(),n=e.shift(),s='Q',a.push(c,h,i,n);break;case't':c=i,h=n,o=r[r.length-1],'Q'===o.command&&(c=i+(i-o.points[0]),h=n+(n-o.points[1])),i+=e.shift(),n+=e.shift(),s='Q',a.push(c,h,i,n);break;case'A':p=e.shift(),v=e.shift(),K=e.shift(),m=e.shift(),y=e.shift(),S=i,C=n,i=e.shift(),n=e.shift(),s='A',a=this.convertEndpointToCenterParameterization(S,C,i,n,m,y,p,v,K);break;case'a':p=e.shift(),v=e.shift(),K=e.shift(),m=e.shift(),y=e.shift(),S=i,C=n,i+=e.shift(),n+=e.shift(),s='A',a=this.convertEndpointToCenterParameterization(S,C,i,n,m,y,p,v,K)};r.push({command:s||u,points:a,start:{x:b,y:A},pathLength:this.calcLength(b,A,s||u,a)})}('z'===u||'Z'===u)&&r.push({command:'z',points:[],start:void 0,pathLength:0})};return r},Kinetic.Path.calcLength=function(t,e,n,i){var c,r,a,s,o=Kinetic.Path;switch(n){case'L':return o.getLineLength(t,e,i[0],i[1]);case'C':for(c=0,r=o.getPointOnCubicBezier(0,t,e,i[0],i[1],i[2],i[3],i[4],i[5]),s=.01;1>=s;s+=.01)a=o.getPointOnCubicBezier(s,t,e,i[0],i[1],i[2],i[3],i[4],i[5]),c+=o.getLineLength(r.x,r.y,a.x,a.y),r=a;return c;case'Q':for(c=0,r=o.getPointOnQuadraticBezier(0,t,e,i[0],i[1],i[2],i[3]),s=.01;1>=s;s+=.01)a=o.getPointOnQuadraticBezier(s,t,e,i[0],i[1],i[2],i[3]),c+=o.getLineLength(r.x,r.y,a.x,a.y),r=a;return c;case'A':c=0;var l=i[4],u=i[5],d=i[4]+u,h=Math.PI/180;if(Math.abs(l-d)u)for(s=l-h;s>d;s-=h)a=o.getPointOnEllipticalArc(i[0],i[1],i[2],i[3],s,0),c+=o.getLineLength(r.x,r.y,a.x,a.y),r=a;else for(s=l+h;d>s;s+=h)a=o.getPointOnEllipticalArc(i[0],i[1],i[2],i[3],s,0),c+=o.getLineLength(r.x,r.y,a.x,a.y),r=a;return a=o.getPointOnEllipticalArc(i[0],i[1],i[2],i[3],d,0),c+=o.getLineLength(r.x,r.y,a.x,a.y)};return 0},Kinetic.Path.convertEndpointToCenterParameterization=function(t,e,i,n,r,o,a,s,y){var l=y*(Math.PI/180),c=Math.cos(l)*(t-i)/2+Math.sin(l)*(e-n)/2,h=-1*Math.sin(l)*(t-i)/2+Math.cos(l)*(e-n)/2,m=c*c/(a*a)+h*h/(s*s);m>1&&(a*=Math.sqrt(m),s*=Math.sqrt(m));var g=Math.sqrt((a*a*s*s-a*a*h*h-s*s*c*c)/(a*a*h*h+s*s*c*c));r===o&&(g*=-1),isNaN(g)&&(g=0);var u=g*a*h/s,f=g*-s*c/a,w=(t+i)/2+Math.cos(l)*u-Math.sin(l)*f,x=(e+n)/2+Math.sin(l)*u+Math.cos(l)*f,S=function(t){return Math.sqrt(t[0]*t[0]+t[1]*t[1])},p=function(t,e){return(t[0]*e[0]+t[1]*e[1])/(S(t)*S(e))},C=function(t,e){return(t[0]*e[1]=1&&(d=0),0===o&&d>0&&(d-=2*Math.PI),1===o&&0>d&&(d+=2*Math.PI),[w,x,a,s,F,d,l,o]},Kinetic.Factory.addGetterSetter(Kinetic.Path,'data'),Kinetic.Collection.mapMethods(Kinetic.Path)}(),function(){function e(t){t.fillText(this.partialText,0,0)};function i(t){t.strokeText(this.partialText,0,0)};var n='',t='normal';Kinetic.TextPath=function(t){this.___init(t)},Kinetic.TextPath.prototype={___init:function(t){var n=this;this.dummyCanvas=Kinetic.Util.createCanvasElement(),this.dataArray=[],Kinetic.Shape.call(this,t),this._fillFunc=e,this._strokeFunc=i,this._fillFuncHit=e,this._strokeFuncHit=i,this.className='TextPath',this.dataArray=Kinetic.Path.parsePathData(this.attrs.data),this.on('dataChange.kinetic',function(){n.dataArray=Kinetic.Path.parsePathData(this.attrs.data)}),this.on('textChange.kinetic textStroke.kinetic textStrokeWidth.kinetic',n._setTextData),n._setTextData(),this.sceneFunc(this._sceneFunc)},_sceneFunc:function(t){t.setAttr('font',this._getContextFont()),t.setAttr('textBaseline','middle'),t.setAttr('textAlign','left'),t.save();for(var i=this.glyphInfo,e=0;e0)return o=t,n[t];'M'==n[t].command&&(i={x:n[t].points[0],y:n[t].points[1]})};return{}},g=function(a){var r=c._getTextSize(a).width,s=0,u=0;for(n=void 0;Math.abs(r-s)/r>.01&&25>u;){u++;for(var d=s;void 0===t;)t=f(),t&&d+t.pathLengthr?n=Kinetic.Path.getPointOnLine(r,i.x,i.y,t.points[0],t.points[1],i.x,i.y):t=void 0;break;case'A':var g=t.points[4],o=t.points[5],l=t.points[4]+o;0===e?e=g+1e-8:r>s?e+=Math.PI/180*o/Math.abs(o):e-=Math.PI/360*o/Math.abs(o),(0>o&&l>e||o>=0&&e>l)&&(e=l,h=!0),n=Kinetic.Path.getPointOnEllipticalArc(t.points[0],t.points[1],t.points[2],t.points[3],e,t.points[6]);break;case'C':0===e?e=r>t.pathLength?1e-8:r/t.pathLength:r>s?e+=(r-s)/t.pathLength:e-=(s-r)/t.pathLength,e>1&&(e=1,h=!0),n=Kinetic.Path.getPointOnCubicBezier(e,t.start.x,t.start.y,t.points[0],t.points[1],t.points[2],t.points[3],t.points[4],t.points[5]);break;case'Q':0===e?e=r/t.pathLength:r>s?e+=(r-s)/t.pathLength:e-=(s-r)/t.pathLength,e>1&&(e=1,h=!0),n=Kinetic.Path.getPointOnQuadraticBezier(e,t.start.x,t.start.y,t.points[0],t.points[1],t.points[2],t.points[3])};void 0!==n&&(s=Kinetic.Path.getLineLength(i.x,i.y,n.x,n.y)),h&&(h=!1,t=void 0)}},a=0;ae;e++)a=n*Math.sin(2*e*Math.PI/i),r=-1*n*Math.cos(2*e*Math.PI/i),t.lineTo(a,r);t.closePath(),t.fillStrokeShape(this)}},Kinetic.Util.extend(Kinetic.RegularPolygon,Kinetic.Shape),Kinetic.Factory.addGetterSetter(Kinetic.RegularPolygon,'radius',0),Kinetic.Factory.addGetterSetter(Kinetic.RegularPolygon,'sides',0),Kinetic.Collection.mapMethods(Kinetic.RegularPolygon)}(),function(){Kinetic.Star=function(t){this.___init(t)},Kinetic.Star.prototype={___init:function(t){Kinetic.Shape.call(this,t),this.className='Star',this.sceneFunc(this._sceneFunc)},_sceneFunc:function(t){var o=this.innerRadius(),a=this.outerRadius(),i=this.numPoints();t.beginPath(),t.moveTo(0,0-a);for(var e=1;2*i>e;e++){var n=e%2===0?a:o,r=n*Math.sin(e*Math.PI/i),s=-1*n*Math.cos(e*Math.PI/i);t.lineTo(r,s)};t.closePath(),t.fillStrokeShape(this)}},Kinetic.Util.extend(Kinetic.Star,Kinetic.Shape),Kinetic.Factory.addGetterSetter(Kinetic.Star,'numPoints',5),Kinetic.Factory.addGetterSetter(Kinetic.Star,'innerRadius',0),Kinetic.Factory.addGetterSetter(Kinetic.Star,'outerRadius',0),Kinetic.Collection.mapMethods(Kinetic.Star)}(),function(){var t=['fontFamily','fontSize','fontStyle','padding','lineHeight','text'],r='Change.kinetic',s='none',e='up',i='right',n='down',a='left',o='Label',c=t.length;Kinetic.Label=function(t){this.____init(t)},Kinetic.Label.prototype={____init:function(t){var e=this;this.className=o,Kinetic.Group.call(this,t),this.on('add.kinetic',function(t){e._addListeners(t.child),e._sync()})},getText:function(){return this.find('Text')[0]},getTag:function(){return this.find('Tag')[0]},_addListeners:function(e){var i,n=this,a=function(){n._sync()};for(i=0;c>i;i++)e.on(t[i]+r,a)},getWidth:function(){return this.getText().getWidth()},getHeight:function(){return this.getText().getHeight()},_sync:function(){var s,o,u,l,t,r,d,h=this.getText(),c=this.getTag();if(h&&c){switch(s=h.getWidth(),o=h.getHeight(),u=c.getPointerDirection(),l=c.getPointerWidth(),d=c.getPointerHeight(),t=0,r=0,u){case e:t=s/2,r=-1*d;break;case i:t=s+l,r=o/2;break;case n:t=s/2,r=o+d;break;case a:t=-1*l,r=o/2};c.setAttrs({x:-1*t,y:-1*r,width:s,height:o}),h.setAttrs({x:-1*t,y:-1*r})}}},Kinetic.Util.extend(Kinetic.Label,Kinetic.Group),Kinetic.Collection.mapMethods(Kinetic.Label),Kinetic.Tag=function(t){this.___init(t)},Kinetic.Tag.prototype={___init:function(t){Kinetic.Shape.call(this,t),this.className='Tag',this.sceneFunc(this._sceneFunc)},_sceneFunc:function(t){var r=this.getWidth(),s=this.getHeight(),h=this.getPointerDirection(),o=this.getPointerWidth(),c=this.getPointerHeight();t.beginPath(),t.moveTo(0,0),h===e&&(t.lineTo((r-o)/2,0),t.lineTo(r/2,-1*c),t.lineTo((r+o)/2,0)),t.lineTo(r,0),h===i&&(t.lineTo(r,(s-c)/2),t.lineTo(r+o,s/2),t.lineTo(r,(s+c)/2)),t.lineTo(r,s),h===n&&(t.lineTo((r+o)/2,s),t.lineTo(r/2,s+c),t.lineTo((r-o)/2,s)),t.lineTo(0,s),h===a&&(t.lineTo(0,(s+c)/2),t.lineTo(-1*o,s/2),t.lineTo(0,(s-c)/2)),t.closePath(),t.fillStrokeShape(this)}},Kinetic.Util.extend(Kinetic.Tag,Kinetic.Shape),Kinetic.Factory.addGetterSetter(Kinetic.Tag,'pointerDirection',s),Kinetic.Factory.addGetterSetter(Kinetic.Tag,'pointerWidth',0),Kinetic.Factory.addGetterSetter(Kinetic.Tag,'pointerHeight',0),Kinetic.Factory.addGetterSetter(Kinetic.Tag,'cornerRadius',0),Kinetic.Collection.mapMethods(Kinetic.Tag)}();var CountdownCanvas=function(){this.stage=null;this.layer=null};CountdownCanvas.DefaultConfig={showLabels:!0,showValues:!0,showLabelsBelow:!0,showArcs:!1,showColons:!0,fontFamily:'\'Roboto\', sans-serif',fontColor:'rgb(0, 0, 0)',fontWeight:'400',arcWidth:7,arcColor:'rgb(0, 0, 0)'};CountdownCanvas.init=function(t,e,i){var n=new CountdownCanvas();n.initStage(t,e,i);n.initLayer();n.stage.add(n.layer);return n};CountdownCanvas.prototype.initStage=function(t,e,i){this.stage=new Kinetic.Stage({container:t[0],width:e,height:i})};CountdownCanvas.prototype.initLayer=function(){this.layer=new Kinetic.Layer()};CountdownCanvas.prototype.clearStage=function(){this.stage.destroyChildren()};CountdownCanvas.prototype.clearLayer=function(){this.layer.destroyChildren()};CountdownCanvas.prototype.getTimeLeft=function(t){return{days:t?t.totalDays:0,hours:t?t.hours:0,minutes:t?t.minutes:0,seconds:t?t.seconds:0}};CountdownCanvas.prototype.getConfig=function(t){var e={};if(undefined!==t.skinConfig.showLabels){e.showLabels=t.skinConfig.showLabels} else{e.showLabels=CountdownCanvas.DefaultConfig.showLabels};if(undefined!==t.skinConfig.showValues){e.showValues=t.skinConfig.showValues} else{e.showValues=CountdownCanvas.DefaultConfig.showValues};if(undefined!==t.skinConfig.showLabelsBelow){e.showLabelsBelow=t.skinConfig.showLabelsBelow} else{e.showLabelsBelow=CountdownCanvas.DefaultConfig.showLabelsBelow};e.showArcs='circular'===t.skin;e.showColons='simple'===t.skin;e.fontFamily=t.skinConfig.fontFamily||CountdownCanvas.DefaultConfig.fontFamily;e.fontColor=t.skinConfig.fontColor||CountdownCanvas.DefaultConfig.fontColor;e.fontWeight=t.skinConfig.fontWeight||CountdownCanvas.DefaultConfig.fontWeight;e.arcWidth=t.skinConfig.arcWidth||CountdownCanvas.DefaultConfig.arcWidth;e.arcColor=t.skinConfig.arcColor||CountdownCanvas.DefaultConfig.arcColor;return e};CountdownCanvas.prototype.getH=function(t,e){return Math.min(e,t/4)};CountdownCanvas.prototype.drawArc=function(t,e,i,n,a){return new Kinetic.Arc(this._mergeOpts(t,{angle:(e/i)*360,x:n*a}))};CountdownCanvas.prototype.drawText=function(t,e,i,n,a){return new Kinetic.Text(this._mergeOpts(t,{text:e,x:i*n-a*0.4}))};CountdownCanvas.prototype.drawArcs=function(t,e,i,n,a){var s={fillEnabled:!1,innerRadius:a.h*0.4,outerRadius:a.h*0.4,stroke:n.arcColor,strokeWidth:n.arcWidth,y:e*0.5,rotation:-90};var r=CountdownCanvas.Constants.COMMON;return[this.drawArc(s,i.days,a.daysMax,r.DAYS_OFFSET,t),this.drawArc(s,i.hours,r.HOURS_MAX,r.HOURS_OFFSET,t),this.drawArc(s,i.minutes,r.MINS_MAX,r.MINS_OFFSET,t),this.drawArc(s,i.seconds,r.SECS_MAX,r.SECS_OFFSET,t)]};CountdownCanvas.prototype.drawValues=function(t,e,i,n,a){var s={align:'center',fill:n.fontColor,y:e*0.5+a.h*a.valueYOffsetRatio,fontSize:a.h*a.valueSizeRatio,fontStyle:n.fontWeight,width:a.textWidthBase*0.8,fontFamily:n.fontFamily};var r=CountdownCanvas.Constants.COMMON;return[this.drawText(s,i.days,r.DAYS_OFFSET,t,a.textWidthBase),this.drawText(s,i.hours,r.HOURS_OFFSET,t,a.textWidthBase),this.drawText(s,i.minutes,r.MINS_OFFSET,t,a.textWidthBase),this.drawText(s,i.seconds,r.SECS_OFFSET,t,a.textWidthBase)]};CountdownCanvas.prototype.drawLabels=function(t,e,i,n){var r={align:'center',fill:i.fontColor,fontSize:n.h*n.labelSizeRatio,fontStyle:i.fontWeight,width:n.textWidthBase*0.8,y:e*0.5+n.h*n.labelYOffsetRatio,fontFamily:i.fontFamily};var a=CountdownCanvas.Constants.COMMON;return[this.drawText(r,'days',a.DAYS_OFFSET,t,n.textWidthBase),this.drawText(r,'hours',a.HOURS_OFFSET,t,n.textWidthBase),this.drawText(r,'mins',a.MINS_OFFSET,t,n.textWidthBase),this.drawText(r,'secs',a.SECS_OFFSET,t,n.textWidthBase)]};CountdownCanvas.prototype.drawColons=function(t,e,i,n){var r={align:'center',fill:i.fontColor,y:e*0.5+n.h*n.valueYOffsetRatio,fontSize:n.h*n.valueSizeRatio,fontStyle:i.fontWeight,width:n.textWidthBase*0.8,fontFamily:i.fontFamily};var a=CountdownCanvas.Constants.COMMON;return[this.drawText(r,':',a.COLON1_OFFSET,t,n.textWidthBase),this.drawText(r,':',a.COLON2_OFFSET,t,n.textWidthBase),this.drawText(r,':',a.COLON3_OFFSET,t,n.textWidthBase)]};CountdownCanvas.Constants={COMMON:{DAYS_OFFSET:0.125,HOURS_OFFSET:0.375,MINS_OFFSET:0.625,SECS_OFFSET:0.875,COLON1_OFFSET:0.25,COLON2_OFFSET:0.5,COLON3_OFFSET:0.75,HOURS_MAX:24,MINS_MAX:60,SECS_MAX:60},WITH_ARCS:{VALUE_SIZE_RATIO:0.3,LABEL_SIZE_RATIO:0.15,WITH_LABELS_BELOW:{VALUE_Y_OFFSET_RATIO:-0.15,LABEL_Y_OFFSET_RATIO:0.15},WITH_LABELS_ABOVE:{VALUE_Y_OFFSET_RATIO:-0.15,LABEL_Y_OFFSET_RATIO:-0.3},WITHOUT_LABELS:{VALUE_Y_OFFSET_RATIO:-0.3},WITHOUT_VALUES:{LABEL_Y_OFFSET_RATIO:-0.075}},WITHOUT_ARCS:{VALUE_SIZE_RATIO:0.6,LABEL_SIZE_RATIO:0.3,WITH_LABELS_BELOW:{VALUE_Y_OFFSET_RATIO:-0.45,LABEL_Y_OFFSET_RATIO:0.15},WITH_LABELS_ABOVE:{VALUE_Y_OFFSET_RATIO:-0.15,LABEL_Y_OFFSET_RATIO:-0.45},WITHOUT_LABELS:{VALUE_Y_OFFSET_RATIO:-0.3}}};CountdownCanvas.prototype.getNumData=function(t,e,i,n){return{h:this.getH(t,e),daysMax:Math.ceil(i.days/365)*365}};CountdownCanvas.prototype.getArcsNumData=function(t,e,i,n){var a=this.getNumData(t,e,i,n),r=CountdownCanvas.Constants.WITH_ARCS;a.textWidthBase=this.getH(t,e);a.valueSizeRatio=r.VALUE_SIZE_RATIO;a.labelSizeRatio=r.LABEL_SIZE_RATIO;if(n.showValues&&n.showLabels&&n.showLabelsBelow){a.valueYOffsetRatio=r.WITH_LABELS_BELOW.VALUE_Y_OFFSET_RATIO;a.labelYOffsetRatio=r.WITH_LABELS_BELOW.LABEL_Y_OFFSET_RATIO} else if(n.showValues&&n.showLabels){a.valueYOffsetRatio=r.WITH_LABELS_ABOVE.VALUE_Y_OFFSET_RATIO;a.labelYOffsetRatio=r.WITH_LABELS_ABOVE.LABEL_Y_OFFSET_RATIO} else if(n.showValues){a.valueYOffsetRatio=r.WITHOUT_LABELS.VALUE_Y_OFFSET_RATIO} else if(n.showLabels){a.labelYOffsetRatio=r.WITHOUT_VALUES.LABEL_Y_OFFSET_RATIO};return a};CountdownCanvas.prototype.getNoArcsNumData=function(t,e,i,n){var a=this.getNumData(t,e,i,n),r=CountdownCanvas.Constants.WITHOUT_ARCS;a.textWidthBase=t/4;a.valueSizeRatio=r.VALUE_SIZE_RATIO;a.labelSizeRatio=r.LABEL_SIZE_RATIO;if(n.showLabels&&n.showLabelsBelow){a.valueYOffsetRatio=r.WITH_LABELS_BELOW.VALUE_Y_OFFSET_RATIO;a.labelYOffsetRatio=r.WITH_LABELS_BELOW.LABEL_Y_OFFSET_RATIO} else if(n.showLabels){a.valueYOffsetRatio=r.WITH_LABELS_ABOVE.VALUE_Y_OFFSET_RATIO;a.labelYOffsetRatio=r.WITH_LABELS_ABOVE.LABEL_Y_OFFSET_RATIO} else{a.valueYOffsetRatio=r.WITHOUT_LABELS.VALUE_Y_OFFSET_RATIO};return a};CountdownCanvas.prototype.getLayerChildren=function(t,e,i,n){n=n||CountdownCanvas.DefaultConfig;var a=[],r=n.showArcs?this.getArcsNumData(t,e,i,n):this.getNoArcsNumData(t,e,i,n);if(n.showArcs){a=a.concat(this.drawArcs(t,e,i,n,r))};if(n.showValues){a=a.concat(this.drawValues(t,e,i,n,r))};if(n.showLabels){a=a.concat(this.drawLabels(t,e,n,r))};if(n.showColons){a=a.concat(this.drawColons(t,e,n,r))};return a};CountdownCanvas.prototype.draw=function(t,e,i,n,a){this.clearLayer();var s=this.getLayerChildren(e,i,n,a);for(var r=0;rr;++r){var n=s[r].match(/%(-|!)?([a-zA-Z]{1})(:[^;]+;)?/),l=o(n[0]),c=n[1]||'',d=n[3]||'',i=null;n=n[2],a.hasOwnProperty(n)&&(i=a[n],i=Number(t[i])),null!==i&&('!'===c&&(i=h(d,i)),''===c&&10>i&&(i='0'+i.toString()),e=e.replace(l,i.toString()))};return e=e.replace(/%%/,'%')}};function h(t,e){var i='s',n='';return t&&(t=t.replace(/(:|;|\s)/gi,'').split(/\,/),1===t.length?i=t[0]:(n=t[0],i=t[1])),1===Math.abs(e)?n:i};var i=[],e=[],r={precision:100,elapse:!1};e.push(/^[0-9]*$/.source),e.push(/([0-9]{1,2}\/){2}[0-9]{4}( [0-9]{1,2}(:[0-9]{2}){2})?/.source),e.push(/[0-9]{4}([\/\-][0-9]{1,2}){2}( [0-9]{1,2}(:[0-9]{2}){2})?/.source),e=new RegExp(e.join('|'));var a={Y:'years',m:'months',n:'daysToMonth',w:'weeks',d:'daysToWeek',D:'totalDays',H:'hours',M:'minutes',S:'seconds'},n=function(e,n,a){this.el=e,this.$el=t(e),this.interval=null,this.offset={},this.options=t.extend({},r),this.instanceNumber=i.length,i.push(this),this.$el.data('countdown-instance',this.instanceNumber),a&&('function'==typeof a?(this.$el.on('update.countdown',a),this.$el.on('stoped.countdown',a),this.$el.on('finish.countdown',a)):this.options=t.extend({},r,a)),this.setFinalDate(n),this.start()};t.extend(n.prototype,{start:function(){null!==this.interval&&clearInterval(this.interval);var t=this;this.update(),this.interval=setInterval(function(){t.update.call(t)},this.options.precision)},stop:function(){clearInterval(this.interval),this.interval=null,this.dispatchEvent('stoped')},toggle:function(){this.interval?this.stop():this.start()},pause:function(){this.stop()},resume:function(){this.start()},remove:function(){this.stop.call(this),i[this.instanceNumber]=null,delete this.$el.data().countdownInstance},setFinalDate:function(t){this.finalDate=s(t)},update:function(){if(0===this.$el.closest('html').length)return void this.remove();var e,n=void 0!==t._data(this.el,'events'),i=new Date;e=this.finalDate.getTime()-i.getTime(),e=Math.ceil(e/1e3),e=!this.options.elapse&&0>e?0:Math.abs(e),this.totalSecsLeft!==e&&n&&(this.totalSecsLeft=e,this.elapsed=i>=this.finalDate,this.offset={seconds:this.totalSecsLeft%60,minutes:Math.floor(this.totalSecsLeft/60)%60,hours:Math.floor(this.totalSecsLeft/60/60)%24,days:Math.floor(this.totalSecsLeft/60/60/24)%7,daysToWeek:Math.floor(this.totalSecsLeft/60/60/24)%7,daysToMonth:Math.floor(this.totalSecsLeft/60/60/24%30.4368),totalDays:Math.floor(this.totalSecsLeft/60/60/24),weeks:Math.floor(this.totalSecsLeft/60/60/24/7),months:Math.floor(this.totalSecsLeft/60/60/24/30.4368),years:Math.abs(this.finalDate.getFullYear()-i.getFullYear())},this.options.elapse||0!==this.totalSecsLeft?this.dispatchEvent('update'):(this.stop(),this.dispatchEvent('finish')))},dispatchEvent:function(e){var i=t.Event(e+'.countdown');i.finalDate=this.finalDate,i.elapsed=this.elapsed,i.offset=t.extend({},this.offset),i.strftime=c(this.offset),this.$el.trigger(i)}}),t.fn.countdown=function(){var e=Array.prototype.slice.call(arguments,0);return this.each(function(){var s=t(this).data('countdown-instance');if(void 0!==s){var a=i[s],r=e[0];n.prototype.hasOwnProperty(r)?a[r].apply(a,e.slice(1)):null===String(r).match(/^[$A-Z_][0-9A-Z_$]*$/i)?(a.setFinalDate.call(a,r),a.start()):t.error('Method %s does not exist on jQuery.countdown'.replace(/\%s/gi,r))} else new n(this,e[0],e[1])})}})});needsJQuery.ready(function(t){t.fn.initResizeListener=function(e,i,n){i=i||'cvt-element-resize';n=n||100;e=e||t.noop;var a,r;setInterval(function(){var n=t(this),s=!1;if(a!=n.width()){s=!0;a=n.width()};if(r!=n.height()){s=!0;r=n.height()};if(s){n.trigger(i);e.call(this)}}.bind(this),n)}});var Countdown=Countdown||{};Countdown.OnExpiry={Hide:1,Show:2,Redirect:3};Countdown.fixUrl=function(t){var e=/^[a-z][a-z0-9\-\+\.]*:/,i=/^\/\//;if(t.match(e)||t.match(i)){return t};return'//'+t};Countdown.hasExpired=function(t){return t.endAt<=new Date().getTime()};Countdown.showOnExpiry=function(t){return Countdown.OnExpiry.Show===t.config.onExpiry};Countdown.drawCanvas=function(t,e,i,n){var a=t.getConfig(i);t.draw(e,i.width,i.height,n,a)};Countdown.drawEmptyCanvas=function(t,e,i){t.drawEmpty(e,i.width,i.height)};needsJQuery.ready(function(t){t('[data-countdown]').each(function(){var g=1000*60*60*24*365*5,i=t(this),e={width:i.width(),height:i.height(),config:t.parseJSON(i.attr('data-countdown-config')),skinConfig:t.parseJSON(i.attr('data-countdown-skin-config')),skin:i.attr('data-countdown-skin')};var f=i.attr('data-countdown-mode');if('Fixed'===f){e.endAt=a(i,'data-countdown-end-at')} else{var l=a(i,'data-countdown-duration-days'),d=a(i,'data-countdown-duration-hours'),u=a(i,'data-countdown-duration-minutes'),o=K(i);if(o){e.endAt=parseInt(o)} else{var h=new Date();e.endAt=h.getTime()+1000*60*u+1000*60*60*d+1000*60*60*24*l;var s=new Date();s.setTime(e.endAt+g);m(i,e.endAt,s.toUTCString())}};i.initResizeListener(function(){e.width=t(this).width();e.height=t(this).height();t(this).countdown('stop');t(this).countdown(e.endAt+1000);t(this).countdown(e.endAt);t(this).countdown('start')});var n=CountdownCanvas.init(i,e.width,e.height);if(Countdown.hasExpired(e)&&Countdown.showOnExpiry(e)){var r=n.getTimeLeft(null);Countdown.drawCanvas(n,i,e,r);setInterval(function(){Countdown.drawCanvas(n,i,e,r)},1000);return};i.countdown(e.endAt).on('update.countdown',v).on('finish.countdown',p);function p(t){switch(e.config.onExpiry){case Countdown.OnExpiry.Hide:Countdown.drawEmptyCanvas(n,i,e);break;case Countdown.OnExpiry.Show:var a=n.getTimeLeft(t.offset);Countdown.drawCanvas(n,i,e,a);setInterval(function(){Countdown.drawCanvas(n,i,e,a)},1000);break;case Countdown.OnExpiry.Redirect:if(e.config.redirectUrl){window.location.assign(Countdown.fixUrl(e.config.redirectUrl))};break}};function v(t){var a=n.getTimeLeft(t.offset);Countdown.drawCanvas(n,i,e,a)};function a(t,e){return parseInt(t.attr(e))};function K(t){return y(c(t))};function m(t,e,i){var n=c(t)+'='+e+';path='+location.pathname+';expires='+i;document.cookie=n};function c(t){return t.attr('data-countdown-id').replace(/-/g,'')};function y(t){var i='; '+document.cookie,e=i.split('; '+t+'=');if(e.length==2){return e.pop().split(';').shift()};return null}})});needsJQuery.ready(function(t){t('a[href^="#"]:not([href="#"])').click(function(e){var n=this.hash.slice(1),a=t('[name=\''+decodeURI(n)+'\']');if(!a.length){return};var r=a.offset().top,i='html, body';if(navigator.userAgent.match(/(iPod|iPhone|iPad|Android)/)&&!navigator.userAgent.match(/(Windows Phone)/)){i='body'};t(i).animate({scrollTop:r},{duration:500,complete:function(){window.location.hash=n}});e.preventDefault()})});needsJQuery.ready(function(t){ViewportResizer.init(convertriParameters.tabletModeWidth)});var ViewportResizer=function(t){this.state=ViewportResizer.State.REAL;this.fakeWidth=t||960};ViewportResizer.META_ID='viewport-meta';ViewportResizer.State={FAKE:0,REAL:1};ViewportResizer.prototype.getState=function(){return this.state};ViewportResizer.prototype.setState=function(t){this.state=t;return this};ViewportResizer.prototype._getScreenWidth=function(){return window.screen.width};ViewportResizer.prototype.updateViewportMeta=function(t){var e=document.getElementById(ViewportResizer.META_ID);if(!e){return};e.content='width='+t;if(window.parent!==window){window.parent.postMessage('META_CONTENT: '+e.content,'*')}};ViewportResizer.prototype.performCheck=function(){var t=this._getScreenWidth();if(t<960&&t>=600&&ViewportResizer.State.FAKE!==this.getState()){this.setState(ViewportResizer.State.FAKE);this.updateViewportMeta(this.fakeWidth);this.tabletModeOn();return};if((t>=960||t<600)&&ViewportResizer.State.REAL!==this.getState()){this.setState(ViewportResizer.State.REAL);this.updateViewportMeta('device-width');this.tabletModeOff()}};ViewportResizer.prototype.tabletModeOn=function(){$('.fixed-bg').addClass('fixed-bg-tablet')};ViewportResizer.prototype.tabletModeOff=function(){$('.fixed-bg').removeClass('fixed-bg-tablet')};ViewportResizer.init=function(t){var e=new ViewportResizer(t);e.performCheck();setInterval(function(){e.performCheck()},500)};needsJQuery.ready(function(t){var e=navigator.userAgent,i=e.indexOf('Android')!==-1&&e.match(/(Chrome\/[.0-9]*)/);if(!i){return};neutralizeTextScaling()});function neutralizeTextScaling(){var a=10,t=$('');$('body').append(t);var e=t.css('font-size'),i=a/parseFloat(e),n=Math.round(100*i)+'%';$('html').css('text-size-adjust',n);t.remove()};function visibilityChanged(t){if(window.manageIframesState){window.manageIframesState(t)};if(window.manageHtmlVideosPlayback){window.manageHtmlVideosPlayback(t)};if(window.manageYtVideosPlayback){window.manageYtVideosPlayback(t)};if(window.manageLayerScrollbars){window.manageLayerScrollbars(t)}};var MobileDetector={MOBILE_VARIANT:'mobile',isMobile:function(){var e=window.getComputedStyle(document.body,':after'),t=e.getPropertyValue('content');t=t.replace(new RegExp('"','g'),'');return MobileDetector.MOBILE_VARIANT===t}};