"undefined"==typeof zon&&(zon=!1),"undefined"==typeof zns&&(zns=!1);var zog=console.log.bind(console);function zid(e){return z_d("1"),document.getElementById(e)}function zss(e){if(z_d("2"),document.getElementById(e))return document.getElementById(e).style;zon&&zog("zim wrap - zss(): id not found")}function zgo(e,t,o,n,i,r){if(z_d("3"),!(zot(t)&&""!=t||"_self"==t)){var a="";return o&&(a+="width="+o+","),n&&(a+="height="+n+","),i&&(a+="fullscreen=yes,"),r&&(a+="modal=yes,alwaysRaised=yes"),window.open(e,t,a)}window.location.href=e}function zum(e){if(z_d("4"),!zot(e))return Number(String(e).replace(/[^\d\.\-]/g,""))}function zot(e){return null==e}function zop(e){z_d("5"),zot(e)||(e.stopImmediatePropagation&&e.stopImmediatePropagation(),window.event&&(window.event.cancelBubble=!0))}function zil(){z_d("6");var e=function(e){e||(e=event),e.keyCode&&e.keyCode>=32&&e.keyCode<=40&&e.preventDefault()},t=function(e){e||(e=event),e.preventDefault()},o=t;return window.addEventListener("keydown",e),window.addEventListener("wheel",t),window.addEventListener("DOMMouseScroll",o),[e,t,o]}function zet(e){return z_d("6.1"),new function(){var t=this;this.on=function(o,n){if(!(zot(e)||zot(o)||zot(n)))for(var i=t.tags,r=0;r<i.length;r++)i[r].addEventListener(o,n)},this.off=function(o,n){if(!(zot(e)||zot(o)||zot(n)))for(var i=t.tags,r=0;r<i.length;r++)i[r].removeEventListener(o,n)},Object.defineProperty(t,"tags",{get:function(){return zot(e)?[]:"string"==typeof e||e instanceof String?document.querySelectorAll(e):"string"==typeof e.innerHTML?[e]:[]},set:function(e){}}),this.css=function(e,o){for(var n=t.tags,i=0;i<n.length;i++)if(1==arguments.length&&arguments[0].constructor==={}.constructor)for(var r in e)n[i].style[r]=e[r];else{if(1==arguments.length)return t.tags[0].style[e];n[i].style[e]=o}},this.prop=function(e,o){if(!zot(e)){for(var n=t.tags,i=[],r=0;r<n.length;r++)if(zot(o))if(e.constructor==={}.constructor)for(var a in e)n[r][a]=e[a];else i.push(n[r][e]);else n[r][e]=o;return zot(o)?i:void 0}}}}function isDUO(e){return 1==e.length&&null!=e[0]&&e[0].constructor==={}.constructor}function zob(e,t,o,n){if(isDUO(t)){z_d("7");var i,r,a,s=t[0],l=zot(o)?e.toString().split(/\n/,1)[0].match(/\((.*)\)/)[1].replace(/\s+/g,"").split(","):o.replace(/\s+/g,"").split(","),d=[];for(i=0;i<l.length;i++)r=l[i].split("=")[0],l[i]=r,d.push(s[r]);for(i in s)l.indexOf(i)<0&&zon&&zog(e,"bad argument "+i);return!(a=e.prototype.isPrototypeOf(n)?new(e.bind.apply(e,[null].concat(d))):e.apply(null,d))||a}}function zik(e){if(z_d("7.5"),!zot(e)){if(e.constructor==={}.constructor||Array.isArray(e)||"function"==typeof e){if(Array.isArray(e))return zik(e[Math.floor(Math.random()*e.length)]);if(e.constructor==={}.constructor)return zot(e.noZik)?zot(e.max)?e:(zot(e.integer)&&(e.integer=!1),zim.rand (e.min,e.max,e.integer,e.negative)):e.noZik;if("function"==typeof e)return zik(e())}return e}}function z_d(e){zim&&(zim.DISTILL||window.DISTILL)&&zim.distillery.push(e)}function zimify(e,t){z_d("83.3");var o={drag:function(e,t,o,n,i,r,a,s,l,d,c,u,h){return isDUO(arguments)?(arguments[0].obj=this,zim.drag(arguments[0])):zim.drag(this,e,t,o,n,i,r,a,s,l,d,c,u,h)},noDrag:function(){return zim.noDrag(this)},dragRect:function(e){return zim.dragRect(this,e)},transform:function(e,t,o,n,i,r,a,s,l,d,c,u,h,f,p,m,g,z,v,b,y,w){return isDUO(arguments)?(arguments[0].obj=this,zim.transform(arguments[0])):zim.transform(this,e,t,o,n,i,r,a,s,l,d,c,u,h,f,p,m,g,z,v,b,y,w)},setSwipe:function(e){return zim.setSwipe(this,e)},gesture:function(e,t,o,n,i,r,a,s,l){return isDUO(arguments)?(arguments[0].obj=this,zim.gesture(arguments[0])):zim.gesture(this,e,t,o,n,i,r,a,s,l)},noGesture:function(e,t,o){if(isDUO(arguments))return arguments[0].obj=this,zim.noGesture(arguments[0]);zim.noGesture(this,e,t,o)},gestureRect:function(e){return zim.gestureRect(this,e)},hitTestPoint:function(e,t,o){return zim.hitTestPoint(this,e,t,o)},hitTestReg:function(e,t){return zim.hitTestReg(this,e,t)},hitTestRect:function(e,t,o){return zim.hitTestRect(this,e,t,o)},hitTestCircle:function(e,t,o){return zim.hitTestCircle(this,e,t,o)},hitTestCircles:function(e,t){return zim.hitTestCircles(this,e,t)},hitTestBounds:function(e,t,o){return zim.hitTestBounds(this,e,t,o)},boundsToGlobal:function(e,t){return zim.boundsToGlobal(this,e,t)},hitTestGrid:function(e,t,o,n,i,r,a,s,l,d,c,u){return zim.hitTestGrid(this,e,t,o,n,i,r,a,s,l,d,c,u)},animate:function(e,t,o,n,i,r,a,s,l,d,c,u,h,f,p,m,g,z,v,b,y,w,x,C,T,k,E,M,j,S,A,P,O){return isDUO(arguments)?(arguments[0].target=this,zim.animate(arguments[0])):zim.animate(this,e,t,o,n,i,r,a,s,l,d,c,u,h,f,p,m,g,z,v,b,y,w,x,C,T,k,E,M,j,S,A,P,O)},pauseAnimate:function(){return this},stopAnimate:function(){return this},wiggle:function(e,t,o,n,i,r,a,s,l,d,c,u){return isDUO(arguments)?(arguments[0].target=this,zim.wiggle(arguments[0])):zim.wiggle(this,e,t,o,n,i,r,a,s,l,d,c,u)},loop:function(e,t,o,n,i){return zim.loop(this,e,t,o,n,i)},copyMatrix:function(e){return zim.copyMatrix(this,e)},cur:function(e){return zim.cur(this,e)},sha:function(e,t,o,n){return zim.sha(this,e,t,o,n)},pos:function(e,t,o,n){return zim.pos(this,e,t,o,n)},mov:function(e,t){return zim.mov(this,e,t)},dep:function(e){return zim.dep(this,e)},alp:function(e){return zim.alp(this,e)},rot:function(e){return zim.rot(this,e)},siz:function(e,t,o){return zim.siz(this,e,t,o)},ske:function(e,t){return zim.ske(this,e,t)},reg:function(e,t){return zim.reg(this,e,t)},sca:function(e,t){return zim.sca(this,e,t)},scaleTo:function(e,t,o,n,i){return isDUO(arguments)?(arguments[0].obj=this,zim.scaleTo(arguments[0])):zim.scaleTo(this,e,t,o,n,i)},fit:function(e,t,o,n,i){return isDUO(arguments)?(arguments[0].obj=this,zim.fit(arguments[0])):zim.fit(this,e,t,o,n,i)},outline:function(e,t){return isDUO(arguments)?(arguments[0].obj=this,zim.outline(arguments[0])):zim.outline(this,e,t)},addTo:function(e,t){return zim.addTo(this,e,t)},removeFrom:function(e){return zim.removeFrom(this,e)},added:function(e,t,o){return zim.added(this,e,t,o)},centerReg:function(e,t,o){return isDUO(arguments)?(arguments[0].obj=this,zim.centerReg(arguments[0])):zim.centerReg(this,e,t,o)},center:function(e,t,o){return isDUO(arguments)?(arguments[0].obj=this,zim.center(arguments[0])):zim.center(this,e,t,o)},place:function(e){return zim.place(this,e)},placeReg:function(e){return zim.placeReg(this,e)},expand:function(e,t){return zim.expand (this,e,t)},setMask:function(e,t){return zim.setMask(this,e,t)},cloneProps:function(e){return e.alpha=this.alpha,e.rotation=this.rotation,e.mouseEnabled=this.mouseEnabled,e.tickEnabled=this.tickEnabled,e.name=this.name,e.regX=this.regX,e.regY=this.regY,e.visible=this.visible,e.shadow=this.shadow,zim.copyMatrix(e,this),e.compositeOperation=this.compositeOperation,e.snapToPixel=this.snapToPixel,e.filters=null==this.filters?null:this.filters.slice(0),e.mask=this.mask,e.hitArea=this.hitArea,this._bounds&&e.setBounds(this._bounds.x,this._bounds.y,this._bounds.width,this._bounds.height),e},cloneChildren:function(e){e.children.length&&e.removeAllChildren();for(var t=e.children,o=0,n=this.children.length;o<n;o++){var i=this.children[o].clone();i.parent=e,t.push(i)}return e}};if(!zot(t)){t=[];for(var n in o)t.push(n);return t}for(var i in o)o.hasOwnProperty(i)&&(e[i]=o[i]);return Object.defineProperty(e,"width",{enumerable:!0,get:function(){var e=this.getBounds();return zot(e)?null:e.width*this.scaleX},set:function(e){var t=this.getBounds();if(zot(t)||0==t.width)zog("width needs bounds set with setBounds()");else{var o=e/t.width;this.scaleX=this.scaleY=o}}}),Object.defineProperty(e,"height",{enumerable:!0,get:function(){var e=this.getBounds();return zot(e)?null:e.height*this.scaleY},set:function(e){var t=this.getBounds();if(zot(t)||0==t.height)zog("height needs bounds set with setBounds()");else{var o=e/t.height;this.scaleX=this.scaleY=o}}}),Object.defineProperty(e,"widthOnly",{enumerable:!0,get:function(){var e=this.getBounds();return zot(e)?null:e.width*this.scaleX},set:function(e){var t=this.getBounds();if(zot(t)||0==t.width)zog("widthOnly needs bounds set with setBounds()");else{var o=e/t.width;this.scaleX=o}}}),Object.defineProperty(e,"heightOnly",{enumerable:!0,get:function(){var e=this.getBounds();return zot(e)?null:e.height*this.scaleY},set:function(e){var t=this.getBounds();if(zot(t)||0==t.height)zog("heightOnly needs bounds set with setBounds()");else{var o=e/t.height;this.scaleY=o}}}),Object.defineProperty(e,"depth",{enumerable:!0,get:function(){return this._depth},set:function(e){if(this._depth=e,!zot(this.vrChannel)){var t=this.vrParallaxDistance?e*this.vrParallax*this.vrParallaxDistance:0;"left"==this.vrChannel?this.x=this.vrStartX+e+t:"right"==this.vrChannel&&(this.x=this.vrStartX-e+t)}}}),Object.defineProperty(e,"blendMode",{enumerable:!0,get:function(){return this.compositeOperation},set:function(e){this.compositeOperation=e}}),e}function zimplify(e){z_d("83.35"),document.window=window,zot(e)&&(e=[]),Array.isArray(e)||(e=[e]);var t=zimify(null,!0),o=["loop","stopAnimate","pauseAnimate","animate","wiggle"];for(var n in zim)(-1==t.indexOf(n)||o.indexOf(n)>=0)&&-1==e.indexOf(n)&&(window[n]=zim[n])}var zim=function(e){return e.Wonder=function(t,o,n,i,r){var a;if(a=zob(e.Wonder,arguments,"wid, client, app, notes, server",this))return a;if(z_d("82"),zot(t))zog("zim.Wonder() - please provide Wonder ID (see http://zimjs.com/wonder/)");else{zot(r)&&(r="http://54.237.229.197:3001/wonder");var s=this;zot(e.wonderSession)&&(e.wonderSession="W"+e.rand (1e5,999999));var l,d=[],c=setInterval(m,1e3),u=0,h=setInterval(function(){u>28&&(d.push({id:t,c:o,a:n,n:i,k:l,t:"e",v:"frequency max - terminated",s:e.wonderSession}),zog("zim.Wonder() - frequency max - terminated"),s.dispose()),u=0},3e4);this.countsOff={},this.timesOff={},this.ordersOff={},this.count=function(r){g(r,"count")&&(l=r,d.push({id:t,c:o,a:n,n:i,k:r,t:"c",v:1,s:e.wonderSession}))};var f={};this.timeStart=function(e){g(e,"time")&&(s.timeEnd(e),l=e,f[e]=(new Date).getTime())};var p={};this.timePause=function(e){g(e,"time")&&(p[e]||(p[e]=(new Date).getTime()))},this.timeUnpause=function(e){if(g(e,"time")&&p[e]){var t=(new Date).getTime()-p[e];f[e]&&(f[e]+=t),delete p[e]}},this.timeEnd=function(r){if(g(r,"time")&&f[r]){var a=p[r]?p[r]:(new Date).getTime(),s=Math.round((a-f[r])/1e3);delete p[r],delete f[r],d.push({id:t,c:o,a:n,n:i,k:r,t:"t",v:s,s:e.wonderSession})}},this.order=function(r,a){g(r,"order")&&(l=r,zot(a)?zog("zim.Wonder order() - please provide an item"):d.push({id:t,c:o,a:n,n:i,k:r,t:"o",v:a,s:e.wonderSession}))},this.countOff=function(e){s.countsOff[e]=1},this.countOn=function(e){delete s.countOff[e]},this.timeOff=function(e){s.timesOff[e]=1},this.timeOn=function(e){delete s.timesOff[e]},this.orderOff=function(e){s.ordersOff[e]=1},this.orderOn=function(e){delete s.ordersOff[e]},this.dispose=function(){return m(),clearInterval(c),clearInterval(h),!0}}function m(){d.length>0&&(e.async(r+"?wonder="+JSON.stringify(d)),d=[],u++)}function g(e,t){return zot(e)?(zog("zim.Wonder "+t+" - please provide a keyword"),!1):!s[t+"sOff"][e]}},e}((zim=function(e){if(e.shuffle=function(e){if(z_d("8"),!zot(e)){var t,o,n=e.length;if(0==n)return e;for(;--n;)t=Math.floor(Math.random()*(n+1)),o=e[n],e[n]=e[t],e[t]=o;return e}},e.rand=function(e,t,o,n){return z_d("9"),zot(e)&&zot(t)?Math.random():((zot(e)||isNaN(e))&&(e=0),(zot(t)||isNaN(t))&&(t=0),e%1==0&&t%1==0||(o=!1),zot(o)&&(o=!0),n&&Math.random()>.5&&(e*=-1,t*=-1),o&&(e>t?e++:t>e&&t++),0==e&&0==t?0:(i=0==t?Math.random()*e:Math.min(e,t)+Math.random()*(Math.max(e,t)-Math.min(e,t)),o?Math.floor(i):i));var i},e.loop=function(t,o,n,i,r,a){var s;if(s=zob(e.loop,arguments,"obj, call, reverse, step, start, end"))return s;if(z_d("9.5"),!zot(t)&&!zot(o)){zot(n)&&(n=!1),(zot(i)||i<=0)&&(i=1);var l="number"==typeof t?"number":t.constructor===Array?"array":t.constructor==={}.constructor?"object":"invalid";if("invalid"!=l)if("number"==l||"array"==l){if(0==(u=p((h="number"==l?t:t.length)-1)))return;if(n)for(var d=r;d>=a;d-=i){if("number"==l)var c=o(d,u,r,a,t);else c=o(t[d],d,u,r,a,t);if(void 0!==c)return c}else for(d=r;d<=a;d+=i){if("number"==l)c=o(d,u,r,a,t);else c=o(t[d],d,u,r,a,t);if(void 0!==c)return c}}else if("object"==l){var u,h=0,f=[];for(var d in t)h++,f.push(d);if(0==(u=p(h-1)))return;if(n)for(d=r;d>=a;d-=i){if(void 0!==(c=o(f[d],t[f[d]],d,u,r,a,t)))return c}else for(d=r;d<=a;d+=i){if(void 0!==(c=o(f[d],t[f[d]],d,u,r,a,t)))return c}}}function p(e){return zot(r)&&(r=n?e:0),zot(a)&&(a=n?0:e),n&&a>r||!n&&r>a?0:(r<0&&a)<0||r>e&&a>e?0:(r=Math.max(0,Math.min(r,e)),a=Math.max(0,Math.min(a,e)),Math.floor((n?r-a:a-r)/i)+1)}},e.timeout=function(e,t){if(z_d("9.7"),!zot(t)&&"function"==typeof t){zot(e)&&(e=1e3),e=zik(e);var o={startTime:Date.now(),time:0,paused:!1,done:!1},n=o.startTime;return o.pause=function(e){zot(e)&&(e=!0),e?cancelAnimationFrame(o.rid):(n=Date.now(),i()),o.paused=e},o.clear=function(){for(var e in o&&cancelAnimationFrame(o.rid),o)delete o[e];o.pause=function(){},o.clear=function(){}},i(),o}function i(){var r=Date.now();if(o.time+=r-n,n=r,o.time>=e)return o.done=!0,t(o),void o.clear();o.rid=requestAnimationFrame(i)}},e.interval=function(e,t,o,n){if(z_d("9.8"),!zot(t)&&"function"==typeof t&&(zot(e)&&(e=1e3),zot(n)&&(n=!1),zot(o)||!(isNaN(o)||o<=0))){zot(o)&&(o=-1);var i,r={count:0,total:o,paused:!1,time:e,active:!0};return n&&setTimeout(function(){t(r),s()},10),r.pause=function(e,o){zot(e)&&(e=!0),e?(clearTimeout(i),clearTimeout(r.id),cancelAnimationFrame(r.rid),r.pauseTimeLeft=r.interval-(Date.now()-r.startTime)):(i=setTimeout(function(){r.count++,t(r),a(),s()},o?0:r.pauseTimeLeft),r.pauseTimeLeft=null),r.paused=e},r.clear=function(){r.active=!1,clearTimeout(i),cancelAnimationFrame(r.rid),clearTimeout(r.id);var e=r.count;for(var t in r)delete r[t];r.active=!1,r.count=e,r.pause=function(){},r.clear=function(){}},a(),r}function a(){r.startTime=Date.now(),r.interval=zik(r.time),r.id=setTimeout(function(){r.paused||r.active&&(r.rid=requestAnimationFrame(a),r.count++,t(r),s())},r.interval)}function s(){-1!=o&&r.count>=(n?r.total-1:r.total)&&r.clear()}},e.copy=function(t,o){if(z_d("10"),zot(o)&&(o=!1),null==t||!(t instanceof Array||t.constructor=={}.constructor))return o&&t.clone?t.clone():t;if(t instanceof Array){for(var n=[],i=0;i<t.length;i++)n[i]=e.copy(t[i],o);return n}if(t.constructor=={}.constructor){var r={};for(var a in t){var s=e.copy(t[a],o);t.hasOwnProperty(a)&&(r[a]=s)}return r}},e.arraysEqual=function(t,o,n){if(z_d("11"),zot(t)||zot(o))return!1;if(zot(n)&&(n=!0),t.length!=o.length)return!1;for(var i=0;i<t.length;i++)if(t[i]instanceof Array&&o[i]instanceof Array){if(!e.arraysEqual(t[i],o[i],n))return!1}else{if(n&&t[i]!=o[i])return!1;if(!n)return e.arraysEqual(t.sort(),o.sort(),!0)}return!0},e.isEmpty=function(e){if(z_d("11.5"),!zot(e)){var t=0;for(var o in e){t++;break}return 0==t}},e.isJSON=function(e){z_d("11.6");try{return JSON.parse(e).constructor=={}.constructor}catch(e){return!1}},e.merge=function(){z_d("12");var e,t,o={};for(e=0;e<arguments.length;e++)for(t in arguments[e])arguments[e].hasOwnProperty(t)&&(o[t]=arguments[e][t]);return o},e.zut=function(e){if(zot(e)||"object"==typeof e)return!0},e.decimals=function(t,o,n,i,r,a,s){if(z_d("13"),zot(t))return 0;zot(o)&&(o=1),zot(n)&&(n=0),zot(i)&&(i=0),zot(i)&&(i=0),zot(r)&&(r=!0),zot(a)&&(a=!1);var l=Math.round(t*Math.pow(10,o))/Math.pow(10,o),d=e.sign(l);if(n>0){var c=String(l).indexOf("."),u=String(l).length;c<0&&(c=u++,l+=".");for(var h=0;h<n-(u-c-1);h++)l+="0"}if(i>0){-1==d&&(l=l.substr(1,l.length-1));c=String(l).indexOf("."),u=String(l).length;var f=c<0?u:c;for(h=0;h<i-f;h++)l="0"+l;-1==d&&(l="-"+l)}return n+i>0&&!r&&0==Number(l)&&(l=0),a&&(l=String(l).replace(".",":")),e.zut(s)?l:null},e.sign=function(e){return z_d("13.1"),e?e<0?-1:1:0},e.constrain=function(e,t,o,n){if(z_d("13.2"),!zot(e))return zot(t)&&(t=0),zot(o)&&(o=Number.MAX_VALUE),o<t&&(max2=t,o=t,t=max2),zot(n)&&(n=!1),n&&e<0?Math.max(-o,Math.min(e,-t)):Math.max(t,Math.min(e,o))},e.dist=function(e,t,o,n){if(z_d("13.3"),!zot(e)&&!zot(t))return zot(o)&&(o=0),zot(n)&&(n=0),Math.sqrt(Math.pow(o-e,2)+Math.pow(n-t,2))},e.angle=function(e,t,o,n){if(z_d("13.4"),!zot(e)&&!zot(t))return zot(o)&&(o=e,e=0),zot(n)&&(n=t,t=0),(180*Math.atan2(n-t,o-e)/Math.PI+360)%360},e.makeID=function(e,t,o){var n;z_d("13.5"),zot(e)&&(e="mixed"),zot(t)&&(t=5),zot(o)&&(o="uppercase");var i=[2,3,4,5,6,7,8,9],r="abcdefghjkmnpqrstuvwxyz".split("");n=e.constructor===Array?e:"numbers"==e?i:"letters"==e?r:i.concat(r);for(var a,s,l="",d=0;d<t;d++)a=n[Math.floor(Math.random()*n.length)],s=Math.random(),"uppercase"==o||"mixed"==o&&s>.5?a.toUpperCase&&(a=a.toUpperCase()):a.toLowerCase&&(a=a.toLowerCase()),l+=String(a);return l},e.smoothStep=function(t,o,n){z_d("13.7");var i=e.constrain((t-o)/(n-o),0,1);return i*i*i*(i*(6*i-15)+10)},e.Noise=function(e){"use strict";z_d("13.9"),zot(e)&&(e=1e6*Math.random());var t=e;this.seed=e;var o=this,n={};function i(e){var t=new Uint32Array(1);return t[0]=1664525*e[0]+1013904223,t}function r(e,t,o){this.dx=-t-e*n.SQUISH_2D,this.dy=-o-e*n.SQUISH_2D,this.xsb=t,this.ysb=o}function a(e,t,o,i){this.dx=-t-e*n.SQUISH_3D,this.dy=-o-e*n.SQUISH_3D,this.dz=-i-e*n.SQUISH_3D,this.xsb=t,this.ysb=o,this.zsb=i}function s(e,t,o,i,r){this.dx=-t-e*n.SQUISH_4D,this.dy=-o-e*n.SQUISH_4D,this.dz=-i-e*n.SQUISH_4D,this.dw=-r-e*n.SQUISH_4D,this.xsb=t,this.ysb=o,this.zsb=i,this.wsb=r}n.NORM_2D=1/47,n.NORM_3D=1/103,n.NORM_4D=1/30,n.SQUISH_2D=(Math.sqrt(3)-1)/2,n.SQUISH_3D=(Math.sqrt(4)-1)/3,n.SQUISH_4D=(Math.sqrt(5)-1)/4,n.STRETCH_2D=(1/Math.sqrt(3)-1)/2,n.STRETCH_3D=(1/Math.sqrt(4)-1)/3,n.STRETCH_4D=(1/Math.sqrt(5)-1)/4,n.base2D=[[1,1,0,1,0,1,0,0,0],[1,1,0,1,0,1,2,1,1]],n.base3D=[[0,0,0,0,1,1,0,0,1,0,1,0,1,0,0,1],[2,1,1,0,2,1,0,1,2,0,1,1,3,1,1,1],[1,1,0,0,1,0,1,0,1,0,0,1,2,1,1,0,2,1,0,1,2,0,1,1]],n.base4D=[[0,0,0,0,0,1,1,0,0,0,1,0,1,0,0,1,0,0,1,0,1,0,0,0,1],[3,1,1,1,0,3,1,1,0,1,3,1,0,1,1,3,0,1,1,1,4,1,1,1,1],[1,1,0,0,0,1,0,1,0,0,1,0,0,1,0,1,0,0,0,1,2,1,1,0,0,2,1,0,1,0,2,1,0,0,1,2,0,1,1,0,2,0,1,0,1,2,0,0,1,1],[3,1,1,1,0,3,1,1,0,1,3,1,0,1,1,3,0,1,1,1,2,1,1,0,0,2,1,0,1,0,2,1,0,0,1,2,0,1,1,0,2,0,1,0,1,2,0,0,1,1]],n.gradients2D=[5,2,2,5,-5,2,-2,5,5,-2,2,-5,-5,-2,-2,-5],n.gradients3D=[-11,4,4,-4,11,4,-4,4,11,11,4,4,4,11,4,4,4,11,-11,-4,4,-4,-11,4,-4,-4,11,11,-4,4,4,-11,4,4,-4,11,-11,4,-4,-4,11,-4,-4,4,-11,11,4,-4,4,11,-4,4,4,-11,-11,-4,-4,-4,-11,-4,-4,-4,-11,11,-4,-4,4,-11,-4,4,-4,-11],n.gradients4D=[3,1,1,1,1,3,1,1,1,1,3,1,1,1,1,3,-3,1,1,1,-1,3,1,1,-1,1,3,1,-1,1,1,3,3,-1,1,1,1,-3,1,1,1,-1,3,1,1,-1,1,3,-3,-1,1,1,-1,-3,1,1,-1,-1,3,1,-1,-1,1,3,3,1,-1,1,1,3,-1,1,1,1,-3,1,1,1,-1,3,-3,1,-1,1,-1,3,-1,1,-1,1,-3,1,-1,1,-1,3,3,-1,-1,1,1,-3,-1,1,1,-1,-3,1,1,-1,-1,3,-3,-1,-1,1,-1,-3,-1,1,-1,-1,-3,1,-1,-1,-1,3,3,1,1,-1,1,3,1,-1,1,1,3,-1,1,1,1,-3,-3,1,1,-1,-1,3,1,-1,-1,1,3,-1,-1,1,1,-3,3,-1,1,-1,1,-3,1,-1,1,-1,3,-1,1,-1,1,-3,-3,-1,1,-1,-1,-3,1,-1,-1,-1,3,-1,-1,-1,1,-3,3,1,-1,-1,1,3,-1,-1,1,1,-3,-1,1,1,-1,-3,-3,1,-1,-1,-1,3,-1,-1,-1,1,-3,-1,-1,1,-1,-3,3,-1,-1,-1,1,-3,-1,-1,1,-1,-3,-1,1,-1,-1,-3,-3,-1,-1,-1,-1,-3,-1,-1,-1,-1,-3,-1,-1,-1,-1,-3],n.lookupPairs2D=[0,1,1,0,4,1,17,0,20,2,21,2,22,5,23,5,26,4,39,3,42,4,43,3],n.lookupPairs3D=[0,2,1,1,2,2,5,1,6,0,7,0,32,2,34,2,129,1,133,1,160,5,161,5,518,0,519,0,546,4,550,4,645,3,647,3,672,5,673,5,674,4,677,3,678,4,679,3,680,13,681,13,682,12,685,14,686,12,687,14,712,20,714,18,809,21,813,23,840,20,841,21,1198,19,1199,22,1226,18,1230,19,1325,23,1327,22,1352,15,1353,17,1354,15,1357,17,1358,16,1359,16,1360,11,1361,10,1362,11,1365,10,1366,9,1367,9,1392,11,1394,11,1489,10,1493,10,1520,8,1521,8,1878,9,1879,9,1906,7,1910,7,2005,6,2007,6,2032,8,2033,8,2034,7,2037,6,2038,7,2039,6],n.lookupPairs4D=[0,3,1,2,2,3,5,2,6,1,7,1,8,3,9,2,10,3,13,2,16,3,18,3,22,1,23,1,24,3,26,3,33,2,37,2,38,1,39,1,41,2,45,2,54,1,55,1,56,0,57,0,58,0,59,0,60,0,61,0,62,0,63,0,256,3,258,3,264,3,266,3,272,3,274,3,280,3,282,3,2049,2,2053,2,2057,2,2061,2,2081,2,2085,2,2089,2,2093,2,2304,9,2305,9,2312,9,2313,9,16390,1,16391,1,16406,1,16407,1,16422,1,16423,1,16438,1,16439,1,16642,8,16646,8,16658,8,16662,8,18437,6,18439,6,18469,6,18471,6,18688,9,18689,9,18690,8,18693,6,18694,8,18695,6,18696,9,18697,9,18706,8,18710,8,18725,6,18727,6,131128,0,131129,0,131130,0,131131,0,131132,0,131133,0,131134,0,131135,0,131352,7,131354,7,131384,7,131386,7,133161,5,133165,5,133177,5,133181,5,133376,9,133377,9,133384,9,133385,9,133400,7,133402,7,133417,5,133421,5,133432,7,133433,5,133434,7,133437,5,147510,4,147511,4,147518,4,147519,4,147714,8,147718,8,147730,8,147734,8,147736,7,147738,7,147766,4,147767,4,147768,7,147770,7,147774,4,147775,4,149509,6,149511,6,149541,6,149543,6,149545,5,149549,5,149558,4,149559,4,149561,5,149565,5,149566,4,149567,4,149760,9,149761,9,149762,8,149765,6,149766,8,149767,6,149768,9,149769,9,149778,8,149782,8,149784,7,149786,7,149797,6,149799,6,149801,5,149805,5,149814,4,149815,4,149816,7,149817,5,149818,7,149821,5,149822,4,149823,4,149824,37,149825,37,149826,36,149829,34,149830,36,149831,34,149832,37,149833,37,149842,36,149846,36,149848,35,149850,35,149861,34,149863,34,149865,33,149869,33,149878,32,149879,32,149880,35,149881,33,149882,35,149885,33,149886,32,149887,32,150080,49,150082,48,150088,49,150098,48,150104,47,150106,47,151873,46,151877,45,151881,46,151909,45,151913,44,151917,44,152128,49,152129,46,152136,49,152137,46,166214,43,166215,42,166230,43,166247,42,166262,41,166263,41,166466,48,166470,43,166482,48,166486,43,168261,45,168263,42,168293,45,168295,42,168512,31,168513,28,168514,31,168517,28,168518,25,168519,25,280952,40,280953,39,280954,40,280957,39,280958,38,280959,38,281176,47,281178,47,281208,40,281210,40,282985,44,282989,44,283001,39,283005,39,283208,30,283209,27,283224,30,283241,27,283256,22,283257,22,297334,41,297335,41,297342,38,297343,38,297554,29,297558,24,297562,29,297590,24,297594,21,297598,21,299365,26,299367,23,299373,26,299383,23,299389,20,299391,20,299584,31,299585,28,299586,31,299589,28,299590,25,299591,25,299592,30,299593,27,299602,29,299606,24,299608,30,299610,29,299621,26,299623,23,299625,27,299629,26,299638,24,299639,23,299640,22,299641,22,299642,21,299645,20,299646,21,299647,20,299648,61,299649,60,299650,61,299653,60,299654,59,299655,59,299656,58,299657,57,299666,55,299670,54,299672,58,299674,55,299685,52,299687,51,299689,57,299693,52,299702,54,299703,51,299704,56,299705,56,299706,53,299709,50,299710,53,299711,50,299904,61,299906,61,299912,58,299922,55,299928,58,299930,55,301697,60,301701,60,301705,57,301733,52,301737,57,301741,52,301952,79,301953,79,301960,76,301961,76,316038,59,316039,59,316054,54,316071,51,316086,54,316087,51,316290,78,316294,78,316306,73,316310,73,318085,77,318087,77,318117,70,318119,70,318336,79,318337,79,318338,78,318341,77,318342,78,318343,77,430776,56,430777,56,430778,53,430781,50,430782,53,430783,50,431e3,75,431002,72,431032,75,431034,72,432809,74,432813,69,432825,74,432829,69,433032,76,433033,76,433048,75,433065,74,433080,75,433081,74,447158,71,447159,68,447166,71,447167,68,447378,73,447382,73,447386,72,447414,71,447418,72,447422,71,449189,70,449191,70,449197,69,449207,68,449213,69,449215,68,449408,67,449409,67,449410,66,449413,64,449414,66,449415,64,449416,67,449417,67,449426,66,449430,66,449432,65,449434,65,449445,64,449447,64,449449,63,449453,63,449462,62,449463,62,449464,65,449465,63,449466,65,449469,63,449470,62,449471,62,449472,19,449473,19,449474,18,449477,16,449478,18,449479,16,449480,19,449481,19,449490,18,449494,18,449496,17,449498,17,449509,16,449511,16,449513,15,449517,15,449526,14,449527,14,449528,17,449529,15,449530,17,449533,15,449534,14,449535,14,449728,19,449729,19,449730,18,449734,18,449736,19,449737,19,449746,18,449750,18,449752,17,449754,17,449784,17,449786,17,451520,19,451521,19,451525,16,451527,16,451528,19,451529,19,451557,16,451559,16,451561,15,451565,15,451577,15,451581,15,451776,19,451777,19,451784,19,451785,19,465858,18,465861,16,465862,18,465863,16,465874,18,465878,18,465893,16,465895,16,465910,14,465911,14,465918,14,465919,14,466114,18,466118,18,466130,18,466134,18,467909,16,467911,16,467941,16,467943,16,468160,13,468161,13,468162,13,468163,13,468164,13,468165,13,468166,13,468167,13,580568,17,580570,17,580585,15,580589,15,580598,14,580599,14,580600,17,580601,15,580602,17,580605,15,580606,14,580607,14,580824,17,580826,17,580856,17,580858,17,582633,15,582637,15,582649,15,582653,15,582856,12,582857,12,582872,12,582873,12,582888,12,582889,12,582904,12,582905,12,596982,14,596983,14,596990,14,596991,14,597202,11,597206,11,597210,11,597214,11,597234,11,597238,11,597242,11,597246,11,599013,10,599015,10,599021,10,599023,10,599029,10,599031,10,599037,10,599039,10,599232,13,599233,13,599234,13,599235,13,599236,13,599237,13,599238,13,599239,13,599240,12,599241,12,599250,11,599254,11,599256,12,599257,12,599258,11,599262,11,599269,10,599271,10,599272,12,599273,12,599277,10,599279,10,599282,11,599285,10,599286,11,599287,10,599288,12,599289,12,599290,11,599293,10,599294,11,599295,10],n.p2D=[0,0,1,-1,0,0,-1,1,0,2,1,1,1,2,2,0,1,2,0,2,1,0,0,0],n.p3D=[0,0,1,-1,0,0,1,0,-1,0,0,-1,1,0,0,0,1,-1,0,0,-1,0,1,0,0,-1,1,0,2,1,1,0,1,1,1,-1,0,2,1,0,1,1,1,-1,1,0,2,0,1,1,1,-1,1,1,1,3,2,1,0,3,1,2,0,1,3,2,0,1,3,1,0,2,1,3,0,2,1,3,0,1,2,1,1,1,0,0,2,2,0,0,1,1,0,1,0,2,0,2,0,1,1,0,0,1,2,0,0,2,2,0,0,0,0,1,1,-1,1,2,0,0,0,0,1,-1,1,1,2,0,0,0,0,1,1,1,-1,2,3,1,1,1,2,0,0,2,2,3,1,1,1,2,2,0,0,2,3,1,1,1,2,0,2,0,2,1,1,-1,1,2,0,0,2,2,1,1,-1,1,2,2,0,0,2,1,-1,1,1,2,0,0,2,2,1,-1,1,1,2,0,2,0,2,1,1,1,-1,2,2,0,0,2,1,1,1,-1,2,0,2,0],n.p4D=[0,0,1,-1,0,0,0,1,0,-1,0,0,1,0,0,-1,0,0,-1,1,0,0,0,0,1,-1,0,0,0,1,0,-1,0,0,-1,0,1,0,0,0,-1,1,0,0,0,0,1,-1,0,0,-1,0,0,1,0,0,-1,0,1,0,0,0,-1,1,0,2,1,1,0,0,1,1,1,-1,0,1,1,1,0,-1,0,2,1,0,1,0,1,1,-1,1,0,1,1,0,1,-1,0,2,0,1,1,0,1,-1,1,1,0,1,0,1,1,-1,0,2,1,0,0,1,1,1,-1,0,1,1,1,0,-1,1,0,2,0,1,0,1,1,-1,1,0,1,1,0,1,-1,1,0,2,0,0,1,1,1,-1,0,1,1,1,0,-1,1,1,1,4,2,1,1,0,4,1,2,1,0,4,1,1,2,0,1,4,2,1,0,1,4,1,2,0,1,4,1,1,0,2,1,4,2,0,1,1,4,1,0,2,1,4,1,0,1,2,1,4,0,2,1,1,4,0,1,2,1,4,0,1,1,2,1,2,1,1,0,0,3,2,1,0,0,3,1,2,0,0,1,2,1,0,1,0,3,2,0,1,0,3,1,0,2,0,1,2,0,1,1,0,3,0,2,1,0,3,0,1,2,0,1,2,1,0,0,1,3,2,0,0,1,3,1,0,0,2,1,2,0,1,0,1,3,0,2,0,1,3,0,1,0,2,1,2,0,0,1,1,3,0,0,2,1,3,0,0,1,2,2,3,1,1,1,0,2,1,1,1,-1,2,2,0,0,0,2,3,1,1,0,1,2,1,1,-1,1,2,2,0,0,0,2,3,1,0,1,1,2,1,-1,1,1,2,2,0,0,0,2,3,1,1,1,0,2,1,1,1,-1,2,0,2,0,0,2,3,1,1,0,1,2,1,1,-1,1,2,0,2,0,0,2,3,0,1,1,1,2,-1,1,1,1,2,0,2,0,0,2,3,1,1,1,0,2,1,1,1,-1,2,0,0,2,0,2,3,1,0,1,1,2,1,-1,1,1,2,0,0,2,0,2,3,0,1,1,1,2,-1,1,1,1,2,0,0,2,0,2,3,1,1,0,1,2,1,1,-1,1,2,0,0,0,2,2,3,1,0,1,1,2,1,-1,1,1,2,0,0,0,2,2,3,0,1,1,1,2,-1,1,1,1,2,0,0,0,2,2,1,1,1,-1,0,1,1,1,0,-1,0,0,0,0,0,2,1,1,-1,1,0,1,1,0,1,-1,0,0,0,0,0,2,1,-1,1,1,0,1,0,1,1,-1,0,0,0,0,0,2,1,1,-1,0,1,1,1,0,-1,1,0,0,0,0,0,2,1,-1,1,0,1,1,0,1,-1,1,0,0,0,0,0,2,1,-1,0,1,1,1,0,-1,1,1,0,0,0,0,0,2,1,1,1,-1,0,1,1,1,0,-1,2,2,0,0,0,2,1,1,-1,1,0,1,1,0,1,-1,2,2,0,0,0,2,1,1,-1,0,1,1,1,0,-1,1,2,2,0,0,0,2,1,1,1,-1,0,1,1,1,0,-1,2,0,2,0,0,2,1,-1,1,1,0,1,0,1,1,-1,2,0,2,0,0,2,1,-1,1,0,1,1,0,1,-1,1,2,0,2,0,0,2,1,1,-1,1,0,1,1,0,1,-1,2,0,0,2,0,2,1,-1,1,1,0,1,0,1,1,-1,2,0,0,2,0,2,1,-1,0,1,1,1,0,-1,1,1,2,0,0,2,0,2,1,1,-1,0,1,1,1,0,-1,1,2,0,0,0,2,2,1,-1,1,0,1,1,0,1,-1,1,2,0,0,0,2,2,1,-1,0,1,1,1,0,-1,1,1,2,0,0,0,2,3,1,1,0,0,0,2,2,0,0,0,2,1,1,1,-1,3,1,0,1,0,0,2,0,2,0,0,2,1,1,1,-1,3,1,0,0,1,0,2,0,0,2,0,2,1,1,1,-1,3,1,1,0,0,0,2,2,0,0,0,2,1,1,-1,1,3,1,0,1,0,0,2,0,2,0,0,2,1,1,-1,1,3,1,0,0,0,1,2,0,0,0,2,2,1,1,-1,1,3,1,1,0,0,0,2,2,0,0,0,2,1,-1,1,1,3,1,0,0,1,0,2,0,0,2,0,2,1,-1,1,1,3,1,0,0,0,1,2,0,0,0,2,2,1,-1,1,1,3,1,0,1,0,0,2,0,2,0,0,2,-1,1,1,1,3,1,0,0,1,0,2,0,0,2,0,2,-1,1,1,1,3,1,0,0,0,1,2,0,0,0,2,2,-1,1,1,1,3,3,2,1,0,0,3,1,2,0,0,4,1,1,1,1,3,3,2,0,1,0,3,1,0,2,0,4,1,1,1,1,3,3,0,2,1,0,3,0,1,2,0,4,1,1,1,1,3,3,2,0,0,1,3,1,0,0,2,4,1,1,1,1,3,3,0,2,0,1,3,0,1,0,2,4,1,1,1,1,3,3,0,0,2,1,3,0,0,1,2,4,1,1,1,1,3,3,2,1,0,0,3,1,2,0,0,2,1,1,1,-1,3,3,2,0,1,0,3,1,0,2,0,2,1,1,1,-1,3,3,0,2,1,0,3,0,1,2,0,2,1,1,1,-1,3,3,2,1,0,0,3,1,2,0,0,2,1,1,-1,1,3,3,2,0,0,1,3,1,0,0,2,2,1,1,-1,1,3,3,0,2,0,1,3,0,1,0,2,2,1,1,-1,1,3,3,2,0,1,0,3,1,0,2,0,2,1,-1,1,1,3,3,2,0,0,1,3,1,0,0,2,2,1,-1,1,1,3,3,0,0,2,1,3,0,0,1,2,2,1,-1,1,1,3,3,0,2,1,0,3,0,1,2,0,2,-1,1,1,1,3,3,0,2,0,1,3,0,1,0,2,2,-1,1,1,1,3,3,0,0,2,1,3,0,0,1,2,2,-1,1,1,1];for(var l=[],d=0;d<n.p2D.length;d+=4){for(var c=n.base2D[n.p2D[d]],u=null,h=null,f=0;f<c.length;f+=3)h=new r(c[f],c[f+1],c[f+2]),null===u?l[d/4]=h:u.next=h,u=h;h.next=new r(n.p2D[d+1],n.p2D[d+2],n.p2D[d+3])}this.lookup2D=[];for(d=0;d<n.lookupPairs2D.length;d+=2)this.lookup2D[n.lookupPairs2D[d]]=l[n.lookupPairs2D[d+1]];var p=[];for(d=0;d<n.p3D.length;d+=9){for(c=n.base3D[n.p3D[d]],u=null,h=null,f=0;f<c.length;f+=4)h=new a(c[f],c[f+1],c[f+2],c[f+3]),null===u?p[d/9]=h:u.next=h,u=h;h.next=new a(n.p3D[d+1],n.p3D[d+2],n.p3D[d+3],n.p3D[d+4]),h.next.next=new a(n.p3D[d+5],n.p3D[d+6],n.p3D[d+7],n.p3D[d+8])}this.lookup3D=[];for(d=0;d<n.lookupPairs3D.length;d+=2)this.lookup3D[n.lookupPairs3D[d]]=p[n.lookupPairs3D[d+1]];var m=[];for(d=0;d<n.p4D.length;d+=16){for(c=n.base4D[n.p4D[d]],u=null,h=null,f=0;f<c.length;f+=5)h=new s(c[f],c[f+1],c[f+2],c[f+3],c[f+4]),null===u?m[d/16]=h:u.next=h,u=h;h.next=new s(n.p4D[d+1],n.p4D[d+2],n.p4D[d+3],n.p4D[d+4],n.p4D[d+5]),h.next.next=new s(n.p4D[d+6],n.p4D[d+7],n.p4D[d+8],n.p4D[d+9],n.p4D[d+10]),h.next.next.next=new s(n.p4D[d+11],n.p4D[d+12],n.p4D[d+13],n.p4D[d+14],n.p4D[d+15])}this.lookup4D=[];for(d=0;d<n.lookupPairs4D.length;d+=2)this.lookup4D[n.lookupPairs4D[d]]=m[n.lookupPairs4D[d+1]];this.perm=new Uint8Array(256),this.perm2D=new Uint8Array(256),this.perm3D=new Uint8Array(256),this.perm4D=new Uint8Array(256);var g=new Uint8Array(256);for(d=0;d<256;d++)g[d]=d;(e=new Uint32Array(1))[0]=t,e=i(i(i(e)));for(d=255;d>=0;d--){e=i(e);var z=new Uint32Array(1);z[0]=(e[0]+31)%(d+1),z[0]<0&&(z[0]+=d+1),this.perm[d]=g[z[0]],this.perm2D[d]=14&this.perm[d],this.perm3D[d]=this.perm[d]%24*3,this.perm4D[d]=252&this.perm[d],g[z[0]]=g[d]}this.simplex1D=function(e){return o.simplex2D(e,1)},this.simplex2D=function(e,t){var i=(e+t)*n.STRETCH_2D,r=[e+i,t+i],a=r[0],s=r[1],l=[Math.floor(a),Math.floor(s)],d=l[0],c=l[1],u=(d+c)*n.SQUISH_2D,h=[e-(d+u),t-(c+u)],f=h[0],p=h[1],m=[a-d,s-c],g=m[0],z=m[1],v=g+z,b=new Uint32Array(4);b[0]=g-z+1,b[1]=v,b[2]=v+z,b[3]=v+g;for(var y=b[0]|b[1]<<1|b[2]<<2|b[3]<<4,w=o.lookup2D[y],x=0;void 0!==w;){var C=[f+w.dx,p+w.dy],T=C[0],k=C[1],E=2-T*T-k*k;if(E>0){var M=[d+w.xsb,c+w.ysb],j=M[0],S=M[1],A=o.perm2D[o.perm[255&j]+S&255];x+=(E*=E)*E*(n.gradients2D[A]*T+n.gradients2D[A+1]*k)}w=w.next}return x*n.NORM_2D},this.simplex3D=function(e,t,i){var r=(e+t+i)*n.STRETCH_3D,a=[e+r,t+r,i+r],s=a[0],l=a[1],d=a[2],c=[Math.floor(s),Math.floor(l),Math.floor(d)],u=c[0],h=c[1],f=c[2],p=(u+h+f)*n.SQUISH_3D,m=[e-(u+p),t-(h+p),i-(f+p)],g=m[0],z=m[1],v=m[2],b=[s-u,l-h,d-f],y=b[0],w=b[1],x=b[2],C=y+w+x,T=new Uint32Array(7);T[0]=w-x+1,T[1]=y-w+1,T[2]=y-x+1,T[3]=C,T[4]=C+x,T[5]=C+w,T[6]=C+y;for(var k=T[0]|T[1]<<1|T[2]<<2|T[3]<<3|T[4]<<5|T[5]<<7|T[6]<<9,E=o.lookup3D[k],M=0;void 0!==E;){var j=[g+E.dx,z+E.dy,v+E.dz],S=j[0],A=j[1],P=j[2],O=2-S*S-A*A-P*P;if(O>0){var I=[u+E.xsb,h+E.ysb,f+E.zsb],D=I[0],B=I[1],L=I[2],X=o.perm3D[o.perm[o.perm[255&D]+B&255]+L&255];M+=(O*=O)*O*(n.gradients3D[X]*S+n.gradients3D[X+1]*A+n.gradients3D[X+2]*P)}E=E.next}return M*n.NORM_3D},this.simplex4D=function(e,t,i,r){var a=(e+t+i+r)*n.STRETCH_4D,s=[e+a,t+a,i+a,r+a],l=s[0],d=s[1],c=s[2],u=s[3],h=[Math.floor(l),Math.floor(d),Math.floor(c),Math.floor(u)],f=h[0],p=h[1],m=h[2],g=h[3],z=(f+p+m+g)*n.SQUISH_4D,v=e-(f+z),b=t-(p+z),y=i-(m+z),w=r-(g+z),x=[l-f,d-p,c-m,u-g],C=x[0],T=x[1],k=x[2],E=x[3],M=C+T+k+E,j=new Uint32Array(11);j[0]=k-E+1,j[1]=T-k+1,j[2]=T-E+1,j[3]=C-T+1,j[4]=C-k+1,j[5]=C-E+1,j[6]=M<<6,j[7]=M+E,j[8]=M+k,j[9]=M+T,j[10]=M+C;for(var S=j[0]|j[1]<<1|j[2]<<2|j[3]<<3|j[4]<<4|j[5]<<5|j[6]<<6|j[7]<<8|j[8]<<11|j[9]<<14|j[10]<<17,A=o.lookup4D[S],P=0;void 0!==A;){var O=[v+A.dx,b+A.dy,y+A.dz,w+A.dw],I=O[0],D=O[1],B=O[2],L=O[3],X=2-I*I-D*D-B*B-L*L;if(X>0){var Y=[f+A.xsb,p+A.ysb,m+A.zsb,g+A.wsb],_=Y[0],R=Y[1],W=Y[2],N=Y[3],F=o.perm4D[o.perm[o.perm[o.perm[255&_]+R&255]+W&255]+N&255];P+=(X*=X)*X*(n.gradients4D[F]*I+n.gradients4D[F+1]*D+n.gradients4D[F+2]*B+n.gradients4D[F+3]*L)}A=A.next}return P*n.NORM_4D}},e.Damp=function(t,o){z_d("14");var n;if(n=zob(e.Damp,arguments,"startValue, damp",this))return n;this.lastValue=zot(t)?0:t,this.damp=zot(o)?.1:o},e.Damp.prototype.convert=function(e){return this.lastValue=this.lastValue+(e-this.lastValue)*this.damp},e.Damp.prototype.immediate=function(e){return this.lastValue=e,this},e.Proportion=function(t,o,n,i,r,a){var s,l,d;if(s=zob(e.Proportion,arguments,"baseMin, baseMax, targetMin, targetMax, factor, targetRound",this))return s;z_d("15"),zot(n)&&(n=0),zot(i)&&(i=1),zot(r)&&(r=1),zot(a)&&(a=!1),this.convert=function(e){if(!isNaN(e))return e=Math.max(e,t),e=Math.min(e,o),l=(e-t)/(o-t),d=r>0?n+(i-n)*l:i-(i-n)*l,a&&(d=Math.round(d)),d}},e.ProportionDamp=function(t,o,n,i,r,a,s){var l;if(l=zob(e.ProportionDamp,arguments,"baseMin, baseMax, targetMin, targetMax, damp, factor, targetRound",this))return l;z_d("16"),zot(n)&&(n=0),zot(i)&&(i=1),zot(r)&&(r=.1),zot(a)&&(a=1),zot(s)&&(s=!1),this.damp=r;var d,c,u,h,f=this,p=0;d=t,p=n;var m=setInterval(g,20);function g(){isNaN(d)||(d=Math.max(d,t),d=Math.min(d,o),c=(d-t)/(o-t),u=i-n,p+=((h=a>0?n+u*c:i-u*c)-p)*f.damp)}this.immediate=function(e){return f.convert(e),g(),p=h,s&&(p=Math.round(p)),f},this.convert=function(e){return d=e,s?Math.round(p):p},this.dispose=function(){return clearInterval(m),!0}},e.Dictionary=function(e){z_d("17"),this.length=0,this.unique=e;var t=this.objects=[],o=this.values=[];this.add=function(e,n){zot(e)||(zot(n)&&(n=!0),this.unique&&this.remove(e),t.push(e),o.push(n),this.length++)},this.at=function(e){if(!zot(e)){var n=t.indexOf(e);return n>-1?o[n]:null}},this.remove=function(e){if(zot(e))return!1;var n=t.indexOf(e);return n>-1&&(t.splice(n,1),o.splice(n,1),this.length--,!0)},this.dispose=function(){return t=null,o=null,this.length=null,!0}},e.swapProperties=function(e,t,o){if(z_d("17.1"),zot(t)||zot(o)||zot(t[e])||zot(o[e]))return!1;var n=o[e];return o[e]=t[e],t[e]=n,!0},e.swapHTML=function(t,o){return z_d("17.2"),e.swapProperties("innerHTML",zid(t),zid(o))},e.scrollX=function(t,o){return z_d("18"),e.abstractScroll("X","Left",t,o)},e.scrollY=function(t,o){return z_d("19"),e.abstractScroll("Y","Top",t,o)},e.abstractScroll=function(t,o,n,i){z_d("20");var r="X"==t?"Y":"X";if(zot(n)){var a=navigator.applicationName;if(-1!=navigator.userAgent.indexOf("Safari")||"Safari"==a);return document.documentElement&&document.documentElement["scroll"+o]||document.body["scroll"+o]}if(zot(i))window.scrollTo(e["scroll"+r](),n);else{i<50&&(i=50);var s=i/50,l=e["scroll"+t](),d=(n-l)/s,c=0,u=setInterval(function(){c++,l+=d,window.scrollTo(e["scroll"+r](),l),c>=s&&(window.scrollTo(e["scroll"+r](),n),clearInterval(u))},50)}return n},e.windowWidth=function(){return z_d("21"),isNaN(window.innerWidth)?window.clientWidth:window.innerWidth},e.windowHeight=function(){return z_d("22"),isNaN(window.innerHeight)?window.clientHeight:window.innerHeight},e.getQueryString=function(e){if(z_d("22.5"),zot(e)&&(e=location.search.replace("?","")),""!=e){for(var t=e.split("&"),o={},n=0;n<t.length;n++){var i=t[n].split("=");void 0===o[i[0]]?o[i[0]]=decodeURIComponent(i[1]):"string"==typeof o[i[0]]?o[i[0]]=[o[i[0]],decodeURIComponent(i[1])]:o[i[0]].push(decodeURIComponent(i[1]))}return o}},e.urlEncode=function(e){z_d("23");e=(e+"").toString();return encodeURIComponent(e).replace(/!/g,"%21").replace(/'/g,"%27").replace(/\(/g,"%28").replace(/\)/g,"%29").replace(/\*/g,"%2A").replace(/%20/g,"+")},e.urlDecode=function(e){return z_d("24"),decodeURIComponent((e+"").replace(/\+/g,"%20"))},e.setCookie=function(e,t,o){if(z_d("25"),!zot(e)&&!zot(t)){if(o){var n=new Date;n.setTime(n.getTime()+24*o*60*60*1e3);var i="; expires="+n.toGMTString()}else i="";return document.cookie=e+"="+escape(t)+i+"; path=/",!0}},e.getCookie=function(e){z_d("26");var t,o=document.cookie.split(/;\s*/),n=new Array;for(i=0;i<o.length;i++)n[(t=o[i].split("="))[0]]=t[1];if(void 0!==n[e])return unescape(n[e])},e.deleteCookie=function(t){return z_d("27"),!zot(e.getCookie(t))&&(e.setCookie(t,"",-1),!0)},e.convertColor=function(e,t){if(z_d("27.5"),zot(t)&&(t=!1),t)3==(e=e.replace("#","")).length&&(e=e.charAt(0)+e.charAt(0)+e.charAt(1)+e.charAt(1)+e.charAt(2)+e.charAt(2));else if("#"==e.charAt(0))return e;var o=["black","aliceblue","antiquewhite","aqua","aquamarine","azure","beige","bisque","blanchedalmond","blue","blueviolet","brown","burlywood","cadetblue","chartreuse","chocolate","coral","cornflowerblue","cornsilk","crimson","cyan","darkblue","darkcyan","darkgoldenrod","darkgray","darkgrey","darkgreen","darkkhaki","darkmagenta","darkolivegreen","darkorange","darkorchid","darkred","darksalmon","darkseagreen","darkslateblue","darkslategray","darkslategrey","darkturquoise","darkviolet","deeppink","deepskyblue","dimgray","dimgrey","dodgerblue","firebrick","floralwhite","forestgreen","fuchsia","gainsboro","ghostwhite","gold","goldenrod","gray","grey","green","greenyellow","honeydew","hotpink","indianred","indigo","ivory","khaki","lavender","lavenderblush","lawngreen","lemonchiffon","lightblue","lightcoral","lightcyan","lightgoldenrodyellow","lightgray","lightgrey","lightgreen","lightpink","lightsalmon","lightseagreen","lightskyblue","lightslategray","lightslategrey","lightsteelblue","lightyellow","lime","limegreen","linen","magenta","maroon","mediumaquamarine","mediumblue","mediumorchid","mediumpurple","mediumseagreen","mediumslateblue","mediumspringgreen","mediumturquoise","mediumvioletred","midnightblue","mintcream","mistyrose","moccasin","navajowhite","navy","oldlace","olive","olivedrab","orange","orangered","orchid","palegoldenrod","palegreen","paleturquoise","palevioletred","papayawhip","peachpuff","peru","pink","plum","powderblue","purple","rebeccapurple","red","rosybrown","royalblue","saddlebrown","salmon","sandybrown","seagreen","seashell","sienna","silver","skyblue","slateblue","slategray","slategrey","snow","springgreen","steelblue","tan","teal","thistle","tomato","turquoise","violet","wheat","white","whitesmoke","yellow","yellowgreen"],n=["000000","f0f8ff","faebd7","00ffff","7fffd4","f0ffff","f5f5dc","ffe4c4","ffebcd","0000ff","8a2be2","a52a2a","deb887","5f9ea0","7fff00","d2691e","ff7f50","6495ed","fff8dc","dc143c","00ffff","00008b","008b8b","b8860b","a9a9a9","a9a9a9","006400","bdb76b","8b008b","556b2f","ff8c00","9932cc","8b0000","e9967a","8fbc8f","483d8b","2f4f4f","2f4f4f","00ced1","9400d3","ff1493","00bfff","696969","696969","1e90ff","b22222","fffaf0","228b22","ff00ff","dcdcdc","f8f8ff","ffd700","daa520","808080","808080","008000","adff2f","f0fff0","ff69b4","cd5c5c","4b0082","fffff0","f0e68c","e6e6fa","fff0f5","7cfc00","fffacd","add8e6","f08080","e0ffff","fafad2","d3d3d3","d3d3d3","90ee90","ffb6c1","ffa07a","20b2aa","87cefa","778899","778899","b0c4de","ffffe0","00ff00","32cd32","faf0e6","ff00ff","800000","66cdaa","0000cd","ba55d3","9370db","3cb371","7b68ee","00fa9a","48d1cc","c71585","191970","f5fffa","ffe4e1","ffe4b5","ffdead","000080","fdf5e6","808000","6b8e23","ffa500","ff4500","da70d6","eee8aa","98fb98","afeeee","db7093","ffefd5","ffdab9","cd853f","ffc0cb","dda0dd","b0e0e6","800080","663399","ff0000","bc8f8f","4169e1","8b4513","fa8072","f4a460","2e8b57","fff5ee","a0522d","c0c0c0","87ceeb","6a5acd","708090","708090","fffafa","00ff7f","4682b4","d2b48c","008080","d8bfd8","ff6347","40e0d0","ee82ee","f5deb3","ffffff","f5f5f5","ffff00","9acd32"];return t?o[-1!=n.indexOf(e.toLowerCase())?n.indexOf(e):0]:"#"+n[-1!=o.indexOf(e.toLowerCase())?o.indexOf(e):0]},e.mobile=function(e){return z_d("28"),zot(e)&&(e=!0),/ip(hone|od|ad)/i.test(navigator.userAgent)?"ios":/android|nexus/i.test(navigator.userAgent)?"android":/blackberry/i.test(navigator.userAgent)?"blackberry":/nokia|phone|mobile/i.test(navigator.userAgent)?"windows":/opera mini|webos/i.test(navigator.userAgent)?"other":!(!e||void 0===window.orientation)},e.async=function(t,o){if(z_d("29"),!zot(t)){var n,i=document.createElement("script");if(o){var r=o.toString().split(/\n/,1)[0].match(/^function\s?([^\s(]*)/)[1];e.async[r]=(n=i,function(e){n&&n.parentNode.removeChild(n),n=null,o(e)})}else e.async.z_s&&e.async.z_s.parentNode&&e.async.z_s.parentNode.removeChild(e.async.z_s),e.async.z_s=i;t.match(/\?/)||(t+="?"),i.setAttribute("src",t+"&r="+Math.random()),document.getElementsByTagName("head")[0].appendChild(i)}},e.extend=function(t,o,n,i,r){var a;if(a=zob(e.extend,arguments,"subclass, superclass, override, prefix, prototype"))return a;if(!zot(t)&&!zot(o)||!zon){zot(i)&&(i="super"),zot(n)&&(n=[]),Array.isArray(n)||(n=[n]),zot(r)&&(r=!0);var s={};for(var l in t.prototype)Object.defineProperty(s,l,Object.getOwnPropertyDescriptor(t.prototype,l));for(l in f.prototype=o.prototype,t.prototype=new f,s)Object.defineProperty(t.prototype,l,Object.getOwnPropertyDescriptor(s,l));var d=t.prototype,c=Object.getPrototypeOf&&Object.getPrototypeOf(d)||d.__proto__;if(c){var u;d[(i+="_")+"constructor"]=c.constructor;for(var h=0;h<n.length;h++)"function"==typeof c[u=n[h]]&&(d[i+u]=c[u]);if(r)for(u in c)d.hasOwnProperty(u)&&"function"==typeof c[u]&&(d[i+u]=c[u])}return t}function f(){this.constructor=t}zog("zim.extend() - please supply a class and its superclass")},"undefined"==typeof createjs)return zon&&zog("ZIM >=4.3.0 requires createjs namespace to be loaded (import createjs before zim)"),e;function t(e,t){t?(e.mouseChildren=!0,e.mouseEnabled=!0,e._enabled=!0):(e.mouseChildren=!1,e.mouseEnabled=!1,e._enabled=!1)}e.Stage=function(t){z_d("50.44"),this.cjsStage_constructor(t),this.type="Stage",this.cache=function(e,t,o,n,i,r){if(zot(o)||zot(t)||zot(o)||zot())if(zot(e)){var a=this.getBounds();if(!zot(a)){var s=this.borderWidth>0?this.borderWidth/2:0;e=a.x-s,t=a.y-s,o=a.width+2*s,n=a.height+2*s}}else o=e,n=t,e=0,t=0;return this.cjsStage_cache(e,t,o,n,i,r),this},this.loop=function(t,o,n,i,r){return e.loop(this,t,o,n,i,r)},this.clone=function(){return this.cloneChildren(this.cloneProps(new e.Stage(t)))}},e.extend(e.Stage,createjs.Stage,["cache","clone"],"cjsStage",!1),e.StageGL=function(t,o){z_d("50.45"),this.cjsStageGL_constructor(t,o),this.type="StageGL",this.cache=function(e,t,o,n,i,r){if(zot(o)||zot(t)||zot(o)||zot())if(zot(e)){var a=this.getBounds();if(!zot(a)){var s=this.borderWidth>0?this.borderWidth/2:0;e=a.x-s,t=a.y-s,o=a.width+2*s,n=a.height+2*s}}else o=e,n=t,e=0,t=0;return this.cjsStageGL_cache(e,t,o,n,i,r),this},this.loop=function(t,o,n,i,r){return e.loop(this,t,o,n,i,r)},this.clone=function(){return this.cloneChildren(this.cloneProps(new e.StageGL(t)))}},e.extend(e.StageGL,createjs.StageGL,["cache","clone"],"cjsStageGL",!1),e.Container=function(t,o,n,i){if(z_d("50.5"),this.cjsContainer_constructor(),this.type="Container",zot(n))r=0,a=t,s=0,l=o;else var r=t,a=n,s=o,l=i;zot(l)&&(l=a),zot(t)||this.setBounds(r,s,a,l),this.cache=function(e,t,o,n,i,r){if(zot(o))if(zot(e)){var a=this.getBounds();if(!zot(a)){var s=this.borderWidth>0?this.borderWidth/2:0;e=a.x-s,t=a.y-s,o=a.width+2*s,n=a.height+2*s}}else o=e,n=t,e=0,t=0;return this.cjsContainer_cache(e,t,o,n,i,r),this},this.clone=function(){return this.cloneChildren(this.cloneProps(new e.Container(r,s,a,l)))}},zimify(e.Container.prototype),e.extend(e.Container,createjs.Container,["cache","clone"],"cjsContainer",!1),e.Shape=function(t,o,n,i,r){z_d("50.6"),this.cjsShape_constructor(r),this.type="Shape";var a=this;if(zot(n))s=0,l=t,d=0,c=o;else var s=t,l=n,d=o,c=i;zot(c)&&(c=l),zot(t)||this.setBounds(s,d,l,c),this.cache=function(e,t,o,n,i,r){if(zot(o))if(zot(e)){var a=this.getBounds();if(!zot(a)){var s=this.borderWidth>0?this.borderWidth/2:0;e=a.x-s,t=a.y-s,o=a.width+2*s,n=a.height+2*s}}else o=e,n=t,e=0,t=0;return this.cjsShape_cache(e,t,o,n,i,r),this},this.clone=function(t){zot(t)&&(t=!0);var o=a.cloneProps(new e.Shape(l,c,s,d,r));return o.graphics=t?a.graphics.clone():a.graphics,o}},e.extend(e.Shape,createjs.Shape,["cache","clone"],"cjsShape",!1),zimify(e.Shape.prototype),e.Bitmap=function(t,o,n,i){z_d("50.7"),this.cjsBitmap_constructor(t);var r=this;this.type="Bitmap",this.id=this.fileID=i,zot(o)||zot(n)||r.setBounds(0,0,o,n),zot(o)&&(o=100),zot(n)&&(n=100),zimDefaultFrame&&(this.imageData=zimDefaultFrame.canvas.getContext("2d").createImageData(o,n),this.drawImageData=function(e,i,a,s,l,d){if(zot(e)&&(e=0),zot(i)&&(i=0),zot(a)&&(a=0),zot(s)&&(s=0),zot(l)&&(l=o),zot(d)&&(d=n),!r.proxyCanvas){var c=r.proxyCanvas=document.createElement("canvas");c.setAttribute("width",o),c.setAttribute("height",n),r.proxyContext=c.getContext("2d"),t=r.image=c}r.proxyContext&&r.proxyContext.putImageData(r.imageData,e,i,a,s,l,d)},zot(t)&&r.drawImageData()),this.clone=function(){return this.cloneProps(new e.Bitmap(t,o,n,r.fileID))}},e.extend(e.Bitmap,createjs.Bitmap,"clone","cjsBitmap",!1),zimify(e.Bitmap.prototype),e.Sprite=function(t,o,n,i,r,a,s,l,d,c,u,h,f,p,m){var g;if(g=zob(e.Sprite,arguments,"image, cols, rows, count, offsetX, offsetY, spacingX, spacingY, width, height, animations, json, id, globalControl, spriteSheet",this))return g;this.type="Sprite",z_d("50.8");var z,v=this;if(zot(h)&&!zot(t)){zot(o)&&(o=1),zot(n)&&(n=1),zot(i)&&(i=o*n),zot(r)&&(r=0),zot(a)&&(a=0),zot(s)&&(s=0),zot(l)&&(l=0),zot(d)&&(d=t.width),zot(c)&&(c=t.height);var b=(d-r+s)/o-s,y=(c-a+l)/n-l,w=[],x=0;e:for(var C=0;C<n;C++)for(var T=0;T<o;T++){if(++x>i)break e;w.push([r+T*(b+s),a+C*(y+l),b,y])}var k={images:[t.image],frames:w,animations:u};z=new createjs.SpriteSheet(k)}else m?u=(z=m).animations:(u=h.animations,z=new createjs.SpriteSheet(h));this.animations=u,this.cjsSprite_constructor(z),zot(f)&&(f=e.makeID()),this.id=f,zot(p)&&(p=!0),v.globalControl=p;var E,M=0;this.parseFrames=function(t,o,n,i){var r=[],a=Number.MAX_VALUE,s=0;if(zot(t))zot(o)&&(o=0),zot(n)&&(n=v.totalFrames-1),d(o,n);else{if(zot(v.animations)||zot(v.animations[t]))return[];l(v.animations[t])}function l(e){var t;Array.isArray(e)?(d((t=e)[0],t[1],t[3]),t[2]&&!zot(v.animations[t[2]])&&l(v.animations[t[2]])):e.constructor=={}.constructor?function(e){if(zot(e.frames))return;zot(e.speed)&&(e.speed=1);for(var t=0;t<e.frames.length;t++)e.speed<a&&(a=e.speed),e.speed>s&&(s=e.speed),r.push({f:e.frames[t],s:e.speed});e.next&&!zot(v.animations[e.next])&&l(v.animations[e.next])}(e):isNaN(e)||r.push({f:Math.floor(e),s:1})}function d(e,t,o){if(zot(o)&&(o=1),t>e)for(var n=e;n<=t;n++)i(n);else for(n=t;n<=e;n++)i(e-n);function i(e){o<a&&(a=o),o>s&&(s=o),r.push({f:e,s:o})}}if(i)return r;a=e.constrain(e.decimals(a),.1),s=e.constrain(e.decimals(s),.1);for(var c,u=[],h=a!=s,f=0;f<r.length;f++)if(c=r[f],h)for(var p=0;p<e.constrain(Math.round(a<1?c.s/a:c.s),.1);p++)u.push(c.f);else u.push(c.f);return u},this.run=function(t,o,n,i,r,a,s,l,d,c,u,h,f,p,m,g,z,b,y,w,x,C,T,k,j){var S,A;if(S=zob(this.run,arguments,"time, label, call, params, wait, waitedCall, waitedParams, loop, loopCount, loopWait, loopCall, loopParams, loopWaitCall, loopWaitParams, rewind, rewindWait, rewindCall, rewindParams, rewindWaitCall, rewindWaitParams, startFrame, endFrame, tweek, id, globalControl"))return S;if(zot(T)&&(T=1),zot(k)||(v.id=k),zot(j)||(v.globalControl=j),Array.isArray(o)){var P,O;A=[];for(var I,D=0,B=0;B<o.length;B++){(P=o[B]).lookup=v.parseFrames(P.label,P.startFrame,P.endFrame),0==B&&(I=P.lookup[0]),delete P.startFrame,delete P.endFrame,P.obj=e.merge(P.obj,{normalizedFrame:P.lookup.length-1}),P.set=e.merge(P.set,{normalizedFrames:{noZik:P.lookup},normalizedFrame:0}),zot(P.wait)&&(P.wait=D*T),O=P.label,delete P.label,A.push(P),D=0;var L=zot(P.time)?t:P.time;C-x>0&&(D=L/(C-x)/2)}if(0==A.length)return this;1==A.length?(t=A[0].time,o=O,X()):v.gotoAndStop(I)}else X();function X(){E=v.parseFrames(o,x,C),M=0,v.gotoAndStop(E[M]),x=C=null,A={normalizedFrame:E.length-1}}if(zot(t)&&(t=1e3),v.running&&v.stopAnimate(v.id),v.running=!0,!Array.isArray(A)){D=0;C-x>0&&(D=t/Math.abs(C-x)/2),E&&E.length>0&&(D=t/E.length/2),zot(c)&&(c=D*T),zot(g)&&(g=D*T)}return e.animate({target:v,obj:A,time:t,ease:"linear",call:function(){n&&"function"==typeof n&&n(i),v.running=!1},params:i,wait:r,waitedCall:a,waitedParams:s,loop:l,loopCount:d,loopWait:c,loopCall:u,loopParams:h,loopWaitCall:f,loopWaitParams:p,rewind:m,rewindWait:g,rewindCall:z,rewindParams:b,rewindWaitCall:y,rewindWaitParams:w,override:!1,id:v.id}),v.runPaused=!1,v},this.runPaused=!0,this.pauseRun=function(t){return zot(t)&&(t=!0),v.runPaused=t,v.globalControl?e.pauseAnimate(t,v.id):v.pauseAnimate(t,v.id),v},this.stopRun=function(){return v.runPaused=!0,v.running=!1,v.globalControl?e.stopAnimate(v.id):v.stopAnimate(v.id),v},Object.defineProperty(this,"frame",{get:function(){return this.currentFrame},set:function(e){e=Math.round(e),this.paused?this.gotoAndStop(e):this.gotoAndPlay(e)}}),Object.defineProperty(this,"normalizedFrame",{get:function(){return M},set:function(e){M=Math.round(e),this.gotoAndStop(E[M])}}),Object.defineProperty(this,"normalizedFrames",{get:function(){return E},set:function(e){E=e}}),Object.defineProperty(this,"totalFrames",{get:function(){return z.getNumFrames()},set:function(e){zog("zim.Sprite - totalFrames is read only")}}),this.clone=function(){return this.cloneProps(new e.Sprite(t,o,n,i,r,a,s,l,d,c,u,h,null,p,m))}},e.extend(e.Sprite,createjs.Sprite,"clone","cjsSprite",!1),zimify(e.Sprite.prototype),e.MovieClip=function(t,o,n,i){var r;if(r=zob(e.MovieClip,arguments,"mode, startPosition, loop, labels",this))return r;this.type="MovieClip",z_d("50.9"),this.cjsMovieClip_constructor(t,o,n,i),this.clone=function(){return this.cloneProps(new e.MovieClip(t,o,n,i))}},e.extend(e.MovieClip,createjs.MovieClip,"clone","cjsMovieClip",!1),zimify(e.MovieClip.prototype),e.Circle=function(t,o,n,i,r){var a;if(a=zob(e.Circle,arguments,"radius, color, borderColor, borderWidth, dashed",this))return a;z_d("51"),this.zimContainer_constructor(),this.type="Circle",zot(t)&&(t=50),zot(r)&&(r=!1),!zot(n)&&zot(i)?i=1:!zot(i)&&zot(n)&&(n="black"),zot(o)&&(o=i>0?"rgba(0,0,0,0)":"black");var s=this,l=t,d=o,c=n,u=i;this.mouseChildren=!1;var h=this.shape=new createjs.Shape;this.addChild(h);var f,p,m,g,z=h.graphics;function v(){z.c(),s.colorCommand=f=z.f(d).command,(zot(u)||u>0)&&(zot(c)&&zot(u)||(zot(c)&&(c="black"),s.borderColorCommand=p=z.s(c).command,s.borderWidthCommand=m=z.ss(u).command,r&&(s.borderDashedCommand=g=z.sd([10,10],5).command))),z.dc(0,0,l),s.setBounds(-l,-l,2*l,2*l)}v(),Object.defineProperty(s,"color",{get:function(){return d},set:function(e){zot(e)&&(e="black"),d=e,f.style=d}}),Object.defineProperty(s,"borderColor",{get:function(){return c},set:function(e){c=e,p?p.style=c:v()}}),Object.defineProperty(s,"borderWidth",{get:function(){return u},set:function(e){e>0||(e=0),u=e,m&&0!=u?(m.width=u,r&&(g.segments=[20,10],g.offset=5)):v()}}),Object.defineProperty(s,"radius",{get:function(){return l},set:function(e){l=e,v()}}),this.clone=function(){return s.cloneProps(new e.Circle(s.radius,s.color,s.borderColor,s.borderWidth,r))}},e.extend(e.Circle,e.Container,"clone","zimContainer",!1),e.Rectangle=function(t,o,n,i,r,a,s,l){var d;if(d=zob(e.Rectangle,arguments,"width, height, color, borderColor, borderWidth, corner, flatBottom, dashed",this))return d;z_d("52"),this.zimContainer_constructor(),this.type="Rectangle",zot(t)&&(t=100),zot(o)&&(o=100),zot(a)&&(a=0),zot(s)&&(s=!1),zot(l)&&(l=!1),!zot(i)&&zot(r)?r=1:!zot(r)&&zot(i)&&(i="black"),zot(n)&&(n=r>0?"rgba(0,0,0,0)":"black");var c=this,u=n,h=i,f=r;this.mouseChildren=!1;var p=this.shape=new createjs.Shape;this.addChild(p);var m,g,z,v=p.graphics;function b(){v.c(),c.colorCommand=m=v.f(u).command,(zot(f)||f>0)&&(zot(h)&&zot(f)||(zot(h)&&(h="black"),c.borderColorCommand=g=v.s(h).command,c.borderWidthCommand=z=v.ss(f).command,l&&(c.borderDashedCommand=borderDashedObj=v.sd([10,10],5).command))),s?v.rc(0,0,t,o,a,a,0,0):a>0?v.rr(0,0,t,o,a):v.r(0,0,t,o),c.setBounds(0,0,t,o)}b(),Object.defineProperty(c,"color",{get:function(){return u},set:function(e){zot(e)&&(e="black"),u=e,m.style=u}}),Object.defineProperty(c,"borderColor",{get:function(){return h},set:function(e){h=e,g?g.style=h:b()}}),Object.defineProperty(c,"borderWidth",{get:function(){return f},set:function(e){e>0||(e=0),f=e,z&&0!=f?(z.width=f,l&&(borderDashedObj.segments=[20,10],borderDashedObj.offset=5)):b()}}),this.clone=function(){return c.cloneProps(new e.Rectangle(t,o,c.color,c.borderColor,c.borderWidth,a,s,l))}},e.extend(e.Rectangle,e.Container,"clone","zimContainer",!1),e.Triangle=function(t,o,n,i,r,a,s,l,d){var c;if(c=zob(e.Triangle,arguments,"a, b, c, color, borderColor, borderWidth, center, adjust, dashed",this))return c;z_d("53"),this.zimContainer_constructor(),this.type="Triangle",zot(t)&&(t=100),zot(o)&&(o=t),zot(n)&&(n=o),-1==n&&(n=Math.sqrt(Math.pow(t,2)+Math.pow(o,2))),zot(s)&&(s=!0),zot(l)&&(l=0),!zot(r)&&zot(a)?a=1:!zot(a)&&zot(r)&&(r="black"),zot(i)&&(i=a>0?"rgba(0,0,0,0)":"black");var u=this,h=i,f=r,p=a;this.mouseChildren=!1;var m=[t,o,n];m.sort(function(e,t){return t-e}),aa=m[0],bb=m[1],cc=m[2];var g=[m.indexOf(t),m.indexOf(o),m.indexOf(n)];if(aa>bb+cc)zog("zim display - Triangle(): invalid triangle lengths");else{var z=this.shape=new createjs.Shape;this.addChild(z);var v,b,y,w=z.graphics;x(),Object.defineProperty(u,"color",{get:function(){return h},set:function(e){zot(e)&&(e="black"),h=e,v.style=h}}),Object.defineProperty(u,"borderColor",{get:function(){return f},set:function(e){f=e,b?b.style=f:x()}}),Object.defineProperty(u,"borderWidth",{get:function(){return p},set:function(e){e>0||(e=0),p=e,y&&0!=p?(y.width=p,d&&(borderDashedObj.segments=[20,10],borderDashedObj.offset=5)):x()}}),this.clone=function(){return u.cloneProps(new e.Triangle(t,o,n,u.color,u.borderColor,u.borderWidth,s,l,d))}}function x(){w.c(),u.colorCommand=v=w.f(h).command,(zot(p)||p>0)&&(zot(f)&&zot(p)||(zot(f)&&(f="black"),u.borderColorCommand=b=w.s(f).command,u.borderWidthCommand=y=w.ss(p).command,d&&(u.borderDashedCommand=borderDashedObj=w.sd([10,10],5).command))),w.mt(0,0),u.one={x:0,y:0},w.lt(t,0),u.two={x:t,y:0};var e=180*Math.acos((Math.pow(bb,2)+Math.pow(cc,2)-Math.pow(aa,2))/(2*bb*cc))/Math.PI,n=180*Math.asin(bb*Math.sin(e*Math.PI/180)/aa)/Math.PI,i=[e,n,180-e-n];u.angles=[i[g[1]],i[g[2]],i[g[0]]];var r=u.angles[1],a=Math.cos(r*Math.PI/180)*o,c=Math.sin(r*Math.PI/180)*o,m=Math.max(t,t-a),x=c;u.setBounds(0,0,m,x),z.y=x,w.lt(t-a,0-c),u.three={x:t-a,y:0-c},w.cp(),s&&(u.regX=m/2,u.regY=x/2),l&&(u.shape.y+=l)}},e.extend(e.Triangle,e.Container,"clone","zimContainer"),e.Squiggle=function(t,o,n,i,r,a,s,l,d,c,u,h,f,p,m){var g;if(g=zob(e.Squiggle,arguments,"color, thickness, points, length, controlLength, controlType, lockControlType, showControls, lockControls, handleSize, toggle, move, ctrlclick, dashed, onTop",this))return g;z_d("53.2"),zot(o)&&(o=6),zot(i)&&(i=300),zot(n)&&(n=5);var z="number"==typeof n?n:n.length;if(0!=z){zot(r)&&(r=i/z),this.zimContainer_constructor(i,r),this.type="Squiggle",zot(p)&&(p=!1),zot(t)&&(t=frame.blue),t.style&&(this.colorCommand=t,t="black"),zot(a)&&(a="mirror"),zot(s)&&(s=!1),zot(l)&&(l=!0);var v=l;zot(d)&&(d=!1),zot(c)&&(c=e.mobile()?20:10),zot(u)&&(u=!0),zot(h)&&(h=!0),zot(f)&&(f=!1),this.toggle=u,this.move=h,this.lockControlType=s,this.ctrlclick=f,this.num=z,zot(m)&&(m=!0);var b,y,w,x,C,T,k,E,M,j=this,S=(this.types=["mirror","straight","free","none"],t),A=o,P=j.move;I(),Object.defineProperty(j,"move",{get:function(){return h},set:function(e){h!=e&&(h=e,e?D():B())}}),Object.defineProperty(j,"toggle",{get:function(){return u},set:function(e){u!=e&&((u=e)?j.move&&D():!v&&j.move&&B())}});var O=d;Object.defineProperty(j,"lockControls",{get:function(){return O},set:function(e){O=e,e?(j.controls.mouseChildren=!1,j.controls.mouseEnabled=!1):(j.controls.mouseChildren=!0,j.controls.mouseEnabled=!0)}}),j.lockControls=O,Object.defineProperty(j,"controlsVisible",{get:function(){return v},set:function(e){v=e,e?j.showControls():j.hideControls()}}),Object.defineProperty(j,"color",{get:function(){return S},set:function(e){zot(e)&&(e="black"),S=e,y.style=S}}),Object.defineProperty(j,"thickness",{get:function(){return A},set:function(e){e>0||(e=0),A=e,w&&0!=A?(w.width=A,p&&(x.segments=[20,10],x.offset=5)):drawShape()}}),Object.defineProperty(j,"points",{get:function(){for(var t,o,n=[],i=0;i<b.length;i++)o=b[i],t=[e.decimals(o[0].x),e.decimals(o[0].y),e.decimals(o[1].x),e.decimals(o[1].y),e.decimals(o[2].x),e.decimals(o[2].y),e.decimals(o[3].x),e.decimals(o[3].y)],o[4]&&"straight"!==o[4]&&t.push(o[4]),n.push(t);return n},set:function(e){j.dispose(),n=e,j.shape&&(j.shape.graphics.clear(),j.sticks.graphics.clear(),j.controls.noDrag(),j.removeAllChildren(),delete j.shape,delete j.sticks,delete j.controls),I(),j.lockControls=O}}),Object.defineProperty(j,"pointObjects",{get:function(){return b},set:function(e){zon&&zog("Squiggle() - pointObjects is read only - but its contents can be manipulated - use squiggle.update() after changes")}}),this.dispose=function(){if(j.shape){j.shape.cursor="default";for(var e=0;e<j.points.length;e++)j.points[e][1].removeAllEventListeners();for(e=0;e<C.length;e++)C[e].removeAllEventListeners();j.sticks.removeFrom(j),j.controls.removeFrom(j),j.shape.removeAllEventListeners(),j.controls.removeAllEventListeners(),j.removeAllEventListeners(),j.toggleStageEvent&&j.stage.off("stagemousedown",j.toggleStageEvent)}}}function I(){j.num=z="number"==typeof n?n:n.length,z=Math.max(2,z),r=i/z,T=j.shape=(new e.Shape).addTo(j);var t=j.sticks=(new e.Shape).addTo(j),u=T.graphics;u.c();var h=t.graphics;h.c();var f,g,P,O,I,L,X,Y,_=c/10*8,R=c,W=e.mobile(),N=j.controls=(new e.Container).addTo(j).drag({onTop:!W});b=[],C=[];for(var F=0;F<z;F++){if(P=(new e.Container).addTo(N),"number"==typeof n){var V=zik(r);g=new e.Container(V,o).pos(F*i/(z-1)-V/2,F%2*V).addTo(j),L=new e.Circle(_,frame.light,frame.dark,2).centerReg(g).pos(V/2,0),O=new e.Rectangle(R,R,J(a),frame.dark,2).centerReg(g).pos(0,0),I=new e.Rectangle(R,R,J(a),frame.dark,2).centerReg(g).pos(V,0);var H=g.localToLocal(L.x,L.y,N);L.x=H.x,L.y=H.y,L.addTo(P);var G=g.localToLocal(O.x,O.y,N);O.x="none"==a?0:G.x-L.x,O.y="none"==a?0:G.y-L.y,O.addTo(P);var U=g.localToLocal(I.x,I.y,N);I.x="none"==a?0:U.x-L.x,I.y="none"==a?0:U.y-L.y,I.addTo(P),P.pos(L.x,L.y),L.x=0,L.y=0,"none"==a&&L.addTo(P)}else X=(Y=n[F])[8]?Y[8]:a,P=(new e.Container).addTo(N).pos(Y[0],Y[1]),L=new e.Circle(_,frame.light,frame.dark,2).centerReg(P).pos(Y[2],Y[3]),O=new e.Rectangle(R,R,J(X),frame.dark,2).centerReg(P,0).pos(Y[4],Y[5]),I=new e.Rectangle(R,R,J(X),frame.dark,2).centerReg(P,0).pos(Y[6],Y[7]);C.push(L),L.set=P,L.rect1=O,L.rect2=I,L.index=F,W?L.on("mousedown",K):L.on("dblclick",Q),O.ball=L,O.other=I,I.ball=L,I.other=O,W&&(L.expand (),O.expand (),I.expand ()),f=[P,L,O,I,Y?Y[8]:a],b.push(f)}var Z,q=!1;function K(e){q?(e.preventDefault(),Q(e)):(q=!0,setTimeout(function(){q=!1},300))}function Q(e){if(!j.lockControlType){var t=e.target,o=b[t.index][4]?b[t.index][4]:a;Math.abs(t.rect1.x)<=2&&Math.abs(t.rect1.y)<=2&&Math.abs(t.rect2.x)<=2&&Math.abs(t.rect2.y)<=2&&(o="none"),"none"==o&&t.parent.addChildAt(t,0),"none"==(o=j.types[(j.types.indexOf(o)+(frame.shiftKey?-1:1)+j.types.length)%j.types.length])&&(t.rect1.x=t.rect1.y=t.rect2.x=t.rect2.y=0,t.parent.addChild(t),e.stopImmediatePropagation()),b[t.index][4]=o,t.rect1.color=J(o),t.rect2.color=J(o),$();var n=new createjs.Event("change");n.controlType="bezierSwitch",j.dispatchEvent(n),t.stage.update()}}function J(e){var t={mirror:frame.purple,free:frame.yellow,none:frame.blue};return t[e]?t[e]:frame.pink}function $(){u.c();var t=e.mobile()?10:6;if(o<t){u.s("rgba(0,0,0,.01)").ss(t);var n=(s=b[0][0]).localToLocal(b[0][1].x,b[0][1].y,T);u.mt(n.x,n.y);for(var i=0;i<b.length;i++){var r=i,a=(i+1)%b.length,s=b[r][0],l=b[r][1],d=b[r][2],c=b[r][3],f=b[a][0],m=b[a][1],g=b[a][2],z=(b[a][3],s.localToLocal(c.x,c.y,T)),v=f.localToLocal(g.x,g.y,T),C=f.localToLocal(m.x,m.y,T);i!=b.length-1&&u.bt(z.x,z.y,v.x,v.y,C.x,C.y)}}j.colorCommand||(j.colorCommand=y=u.s(S).command),j.thicknessCommand||(j.thicknessCommand=w=u.ss(A).command),p&&(j.borderDashedCommand||(j.borderDashedCommand=x=u.sd([10,10],5).command)),n=(s=b[0][0]).localToLocal(b[0][1].x,b[0][1].y,T),u.mt(n.x,n.y),h.c().s(frame.darker).ss(1);for(i=0;i<b.length;i++){r=i,a=(i+1)%b.length,s=b[r][0],l=b[r][1],d=b[r][2],c=b[r][3],f=b[a][0],m=b[a][1],g=b[a][2],b[a][3],z=s.localToLocal(c.x,c.y,T),v=f.localToLocal(g.x,g.y,T),C=f.localToLocal(m.x,m.y,T);i!=b.length-1&&u.bt(z.x,z.y,v.x,v.y,C.x,C.y);n=s.localToLocal(l.x,l.y,T);var k=s.localToLocal(d.x,d.y,T);0==i&&(d.visible=0),0!=i&&h.mt(n.x,n.y).lt(k.x,k.y),i!=b.length-1&&h.mt(n.x,n.y).lt(z.x,z.y),i==b.length-1&&(c.visible=0)}p&&u.append(j.borderDashedCommand),u.append(j.thicknessCommand),u.append(j.colorCommand)}$(),N.on("mousedown",function(e){if(!j.lockControls)if(Z={x:e.target.x,y:e.target.y},e.target.rect1){(t=e.target).startX=t.x,t.startY=t.y,t.rect1.startX=t.rect1.x,t.rect1.startY=t.rect1.y,t.rect2.startX=t.rect2.x,t.rect2.startY=t.rect2.y}else{var t,o=e.target,n=(t=o.ball).index,i=a;if(zot(b[n][4])||(i=b[n][4]),"straight"==i){var r=o.other,s=r.x-t.x,l=r.y-t.y;r.stickLength=Math.sqrt(Math.pow(s,2)+Math.pow(l,2))}}}),N.on("pressmove",function(e){if(!j.lockControls){if(e.target.rect1){var t=(n=e.target).x-n.startX,o=n.y-n.startY;n.rect1.x=n.rect1.startX+t,n.rect1.y=n.rect1.startY+o,n.rect2.x=n.rect2.startX+t,n.rect2.y=n.rect2.startY+o}else{var n,i=e.target,r=i.other,s=(n=i.ball).index,l=a;if(zot(b[s][4])||(l=b[s][4]),"straight"==l||"mirror"==l){var d=i.x-n.x,c=i.y-n.y;if("mirror"==l)r.x=n.x-d,r.y=n.y-c;else{var u=Math.atan2(c,d),h=-r.stickLength*Math.cos(u+Math.PI),f=-r.stickLength*Math.sin(u+Math.PI);r.x=n.x-h,r.y=n.y-f}}}$()}}),N.on("pressup",function(e){if(!j.lockControls){var t=e.target.x!=Z.x||e.target.y!=Z.y,o=new createjs.Event("change");if(e.target.rect1){o.controlType="bezierPoint";var n=e.target,i=n.set,r=n.rect1,a=n.rect2;r.x-=n.x,r.y-=n.y,a.x-=n.x,a.y-=n.y,i.x+=n.x,i.y+=n.y,n.x=0,n.y=0}else o.controlType="bezierHandle";t&&j.dispatchEvent(o)}}),j.changeControl=function(e,t,o,n,i,r,a,s,l){var d;if(d=zob(j.changeControl,arguments,"index, type, rect1X, rect1Y, rect2X, rect2Y, circleX, circleY"))return d;if(zot(e))for(var c=0;c<b.length;c++)j.changeControl(c,t,o,n,i,r,a,s);else{var u=b[e];u[4]=t,"none"==t?(zot(a)||(u[2].x=a),zot(s)||(u[2].y=s),u[2].pos(u[1].x,u[1].y),u[3].pos(u[1].x,u[1].y),u[1].parent.addChild(u[1])):(zot(o)||(u[2].x=o),zot(n)||(u[2].y=n),zot(i)||(u[3].x=i),zot(r)||(u[3].y=r),zot(a)||(u[1].x=a),zot(s)||(u[1].y=s),u[1].parent.addChildAt(u[1],0)),l&&(j.update(),j.stage&&j.stage.update())}},j.update=function(){return $(),j},T.drag({onTop:!1}),k=T.on("mousedown",function(){Z={x:T.x,y:T.y},m&&j.parent.setChildIndex(j,j.parent.numChildren-1)}),E=T.on("pressmove",function(){N.x=T.x,N.y=T.y,t.x=T.x,t.y=T.y}),M=T.on("pressup",function(){var e=T.x!=Z.x||T.y!=Z.y;if(j.x+=T.x,j.y+=T.y,N.x=N.y=t.x=t.y=T.x=T.y=0,e){var o=new createjs.Event("change");o.controlType="move",j.dispatchEvent(o)}j.stage.update()}),j.move||B(!0);j.on("mousedown",function(){j.toggle&&(v||(j.showControls(),j.dispatchEvent("controlsshow")))});j.added(function(){j.toggleStageEvent=j.stage.on("stagemousedown",function(){j.toggle&&j.stage&&v&&!j.hitTestPoint(j.stage.mouseX,j.stage.mouseY,!1)&&(j.hideControls(),j.dispatchEvent("controlshide"))})}),j.on("click",function(){j.ctrlclick&&zimDefaultFrame.ctrlKey&&setTimeout(function(){j.clone(!0).addTo(j.stage).mov(0,100),j.toggle&&(j.hideControls(),j.dispatchEvent("controlshide"));var e=new createjs.Event("change");e.controlType="move",j.dispatchEvent(e),j.stage.update()},50)}),j.hideControls=function(){return N.visible=!1,t.visible=!1,v=!1,j.stage&&j.stage.update(),!j.toggle&&j.move&&B(),j},l||j.hideControls(),j.showControls=function(){return N.visible=!0,t.visible=!0,v=!0,N.pos(T.x,T.y),t.pos(T.x,T.y),j.addChildAt(T,0),j.move&&!j.toggle&&D(),j.stage&&j.stage.update(),j},j.recordData=function(e){zot(e)&&(e=!1);var t={type:"Blob",index:j.parent?j.parent.getChildIndex(j):-1,x:j.x,y:j.y,points:j.recordPoints(),color:j.color,thickness:j.thickness,move:j.move,toggle:j.toggle,controlsVisible:v};return e?JSON.stringify(t):t},j.setData=function(e,t){if(!zot(e)){if(t)try{e=JSON.parse(e)}catch(e){return}var o=e.index;zot(o)&&(o=-1),delete e.index;var n=e.points;for(var i in zot(n)||j.setPoints(n),delete e.points,j.num=n.length,e)j[i]=e[i];return j.parent&&j.parent.setChildIndex(j,o),j.update(),j}},j.recordPoints=function(t){zot(t)&&(t=!1);var o=j.points;if(t){if(!n){var n=new e.Pane({container:j.stage,width:500,height:500,drag:!0}),i=new e.TextArea(400,400);i.centerReg(n)}i.text=JSON.stringify(o),n.show()}return o},j.setPoints=function(e){for(var t,o,n=0;n<e.length;n++)t=b[n],o=e[n],zot(t)||(t[0].x=o[0],t[0].y=o[1],t[1].x=o[2],t[1].y=o[3],t[2].x=o[4],t[2].y=o[5],t[3].x=o[6],t[3].y=o[7],t[4]=o[8]);return j.update(),j},j.clone=function(t){t?j.colorCommand:j.color,t?j.colorCommand:j.color;return j.cloneProps(new e.Squiggle(t?j.colorCommand:j.color,j.lineWidth,j.recordPoints(),i,r,a,s,N.visible,d,c,j.toggle,j.move,j.ctrlclick,p))}}function D(){P||(P=!0,T.drag({onTop:!1}),k=T.on("mousedown",k),E=T.on("pressmove",E),M=T.on("pressup",M))}function B(e){(e||P)&&(P=!1,T.noDrag(),T.off("mousedown",k),T.off("pressmove",E),T.off("pressup",M))}},e.extend(e.Squiggle,e.Container,"clone","zimContainer",!1),e.Blob=function(t,o,n,i,r,a,s,l,d,c,u,h,f,p,m,g){var z;if(z=zob(e.Blob,arguments,"color, borderColor, borderWidth, points, radius, controlLength, controlType, lockControlType, showControls, lockControls, handleSize, toggle, move, ctrlclick, dashed, onTop",this))return z;z_d("53.5"),zot(r)&&(r=100),this.zimContainer_constructor(-r,-r,2*r,2*r),this.type="Blob",zot(m)&&(m=!1),!zot(o)&&zot(n)?n=1:!zot(n)&&zot(o)&&(o="black"),zot(t)&&(t=n>0?"rgba(0,0,0,0)":frame.green),t.style&&(this.colorCommand=t,t="black"),o&&o.style&&(this.borderColorCommand=o,o="black"),zot(i)&&(i=4);var v="number"==typeof i?i:i.length;zot(a)&&(a=4*r/v),zot(s)&&(s="straight"),zot(l)&&(l=!1),zot(d)&&(d=!0);var b=d;zot(c)&&(c=!1),zot(u)&&(u=e.mobile()?20:10),zot(h)&&(h=!0),zot(f)&&(f=!0),zot(p)&&(p=!1),this.toggle=h,this.move=f,this.lockControlType=l,this.ctrlclick=p,this.num=v,zot(g)&&(g=!0);var y,w,x,C,T,k,E,M,j,S,A=this,P=(this.types=["mirror","straight","free","none"],t),O=o,I=n,D=A.move;function B(){if(!((v="number"==typeof i?i:i.length)<=0)){a=4*r/v,E=A.shape=(new e.Shape).addTo(A);var t=A.sticks=(new e.Shape).addTo(A),o=E.graphics;o.c();var n=t.graphics;n.c();var h,p,z,D,B,Y,_,R,W=u/10*8,N=u,F=e.mobile(),V=A.controls=(new e.Container).addTo(A).drag({onTop:!F});y=[],k=[];for(var H=0;H<v;H++){if(z=(new e.Container).addTo(V),"number"==typeof i){var G=zik(a);(p=new e.Container(G,r).reg(G/2,r).addTo(A)).rotation=H/v*360,Y=new e.Circle(W,frame.light,frame.dark,2).centerReg(p).pos(G/2,0),D=new e.Rectangle(N,N,ee(s),frame.dark,2).centerReg(p).pos(0,0),B=new e.Rectangle(N,N,ee(s),frame.dark,2).centerReg(p).pos(G,0);var U=p.localToLocal(Y.x,Y.y,V);Y.x=U.x,Y.y=U.y,Y.addTo(z);var Z=p.localToLocal(D.x,D.y,V);D.x="none"==s?0:Z.x-Y.x,D.y="none"==s?0:Z.y-Y.y,D.addTo(z);var q=p.localToLocal(B.x,B.y,V);B.x="none"==s?0:q.x-Y.x,B.y="none"==s?0:q.y-Y.y,B.addTo(z),z.pos(Y.x,Y.y),Y.x=0,Y.y=0,"none"==s&&Y.addTo(z)}else _=(R=i[H])[8]?R[8]:s,z=(new e.Container).addTo(V).pos(R[0],R[1]),Y=new e.Circle(W,frame.light,frame.dark,2).centerReg(z).pos(R[2],R[3]),D=new e.Rectangle(N,N,ee(_),frame.dark,2).centerReg(z,0).pos(R[4],R[5]),B=new e.Rectangle(N,N,ee(_),frame.dark,2).centerReg(z,0).pos(R[6],R[7]);k.push(Y),Y.set=z,Y.rect1=D,Y.rect2=B,Y.index=H,F?Y.on("mousedown",J):Y.on("dblclick",$),D.ball=Y,D.other=B,B.ball=Y,B.other=D,F&&(Y.expand (),D.expand (),B.expand ()),h=[z,Y,D,B,R?R[8]:s],y.push(h)}var K,Q=!1;te(),V.on("mousedown",function(e){if(!A.lockControls)if(K={x:e.target.x,y:e.target.y},e.target.rect1){(t=e.target).startX=t.x,t.startY=t.y,t.rect1.startX=t.rect1.x,t.rect1.startY=t.rect1.y,t.rect2.startX=t.rect2.x,t.rect2.startY=t.rect2.y}else{var t,o=e.target,n=(t=o.ball).index,i=s;if(zot(y[n][4])||(i=y[n][4]),"straight"==i){var r=o.other,a=r.x-t.x,l=r.y-t.y;r.stickLength=Math.sqrt(Math.pow(a,2)+Math.pow(l,2))}}}),V.on("pressmove",function(e){if(!A.lockControls){if(e.target.rect1){var t=(n=e.target).x-n.startX,o=n.y-n.startY;n.rect1.x=n.rect1.startX+t,n.rect1.y=n.rect1.startY+o,n.rect2.x=n.rect2.startX+t,n.rect2.y=n.rect2.startY+o}else{var n,i=e.target,r=i.other,a=(n=i.ball).index,l=s;if(zot(y[a][4])||(l=y[a][4]),"straight"==l||"mirror"==l){var d=i.x-n.x,c=i.y-n.y;if("mirror"==l)r.x=n.x-d,r.y=n.y-c;else{var u=Math.atan2(c,d),h=-r.stickLength*Math.cos(u+Math.PI),f=-r.stickLength*Math.sin(u+Math.PI);r.x=n.x-h,r.y=n.y-f}}}te()}}),V.on("pressup",function(e){if(!A.lockControls){var t=e.target.x!=K.x||e.target.y!=K.y,o=new createjs.Event("change");if(e.target.rect1){o.controlType="bezierPoint";var n=e.target,i=n.set,r=n.rect1,a=n.rect2;r.x-=n.x,r.y-=n.y,a.x-=n.x,a.y-=n.y,i.x+=n.x,i.y+=n.y,n.x=0,n.y=0}else o.controlType="bezierHandle";t&&A.dispatchEvent(o)}}),A.changeControl=function(e,t,o,n,i,r,a,s,l){var d;if(d=zob(A.changeControl,arguments,"index, type, rect1X, rect1Y, rect2X, rect2Y, circleX, circleY"))return d;if(zot(e)){for(var c=0;c<y.length;c++)A.changeControl(c,t,o,n,i,r,a,s);return A}var u=y[e];return u[4]=t,"none"==t?(zot(a)||(u[1].x=a),zot(s)||(u[1].y=s),u[2].pos(u[1].x,u[1].y),u[3].pos(u[1].x,u[1].y),u[1].parent.addChild(u[1])):(zot(a)||(u[1].x=a),zot(s)||(u[1].y=s),zot(o)||(u[2].x=o),zot(n)||(u[2].y=n),zot(i)||(u[3].x=i),zot(r)||(u[3].y=r),u[1].parent.addChildAt(u[1],0)),l&&(A.update(),A.stage&&A.stage.update()),A},A.update=function(){return te(),A},E.drag({onTop:!1}),M=E.on("mousedown",function(){K={x:E.x,y:E.y},g&&A.parent.setChildIndex(A,A.parent.numChildren-1)}),j=E.on("pressmove",function(){V.x=E.x,V.y=E.y,t.x=E.x,t.y=E.y}),S=E.on("pressup",function(){var e=E.x!=K.x||E.y!=K.y;if(A.x+=E.x,A.y+=E.y,V.x=V.y=t.x=t.y=E.x=E.y=0,e){var o=new createjs.Event("change");o.controlType="move",A.dispatchEvent(o)}A.stage.update()}),f||X(!0);A.on("mousedown",function(){A.toggle&&(b||(A.showControls(),A.dispatchEvent("controlsshow")))});A.added(function(){A.toggleStageEvent=A.stage.on("stagemousedown",function(){A.toggle&&A.stage&&b&&!A.hitTestPoint(A.stage.mouseX,A.stage.mouseY,!1)&&(A.hideControls(),A.dispatchEvent("controlshide"))})}),A.on("click",function(){A.ctrlclick&&zimDefaultFrame.ctrlKey&&setTimeout(function(){A.clone(!0).addTo(A.stage).mov(100),A.toggle&&(A.hideControls(),A.dispatchEvent("controlshide"));var e=new createjs.Event("change");e.controlType="move",A.dispatchEvent(e),A.stage.update()},50)}),A.hideControls=function(){return V.visible=!1,t.visible=!1,b=!1,A.stage&&A.stage.update(),!A.toggle&&A.move&&X(),A},d||A.hideControls(),A.showControls=function(){return V.visible=!0,t.visible=!0,b=!0,V.pos(E.x,E.y),t.pos(E.x,E.y),A.addChildAt(E,0),A.move&&!A.toggle&&L(),A.stage&&A.stage.update(),A},A.recordData=function(e){zot(e)&&(e=!1);var t={type:"Blob",index:A.parent?A.parent.getChildIndex(A):-1,x:A.x,y:A.y,points:A.recordPoints(),color:A.color,borderColor:A.borderColor,borderWidth:A.borderWidth,move:A.move,toggle:A.toggle,controlsVisible:b};return e?JSON.stringify(t):t},A.setData=function(e,t){if(!zot(e)){if(t)try{e=JSON.parse(e)}catch(e){return}var o=e.index;zot(o)&&(o=-1),delete e.index;var n=e.points;for(var i in zot(n)||A.setPoints(n),delete e.points,this.num=n.length,e)A[i]=e[i];return A.parent&&A.parent.setChildIndex(A,o),A}},A.recordPoints=function(t){zot(t)&&(t=!1);var o=A.points;if(t){if(!n){var n=new e.Pane({container:A.stage,width:500,height:500,drag:!0}),i=new e.TextArea(400,400);i.centerReg(n)}i.text=JSON.stringify(o),n.show()}return o},A.setPoints=function(e){for(var t,o,n=0;n<e.length;n++)t=y[n],o=e[n],zot(t)||(t[0].x=o[0],t[0].y=o[1],t[1].x=o[2],t[1].y=o[3],t[2].x=o[4],t[2].y=o[5],t[3].x=o[6],t[3].y=o[7],t[4]=o[8]);return A.update(),A},A.clone=function(t){t?A.colorCommand:A.color,t?A.colorCommand:A.color;return A.cloneProps(new e.Blob(t?A.colorCommand:A.color,t?A.borderColorCommand:A.borderColor,A.borderWidth,A.recordPoints(),r,a,s,l,V.visible,c,u,A.toggle,A.move,A.ctrlclick,m))}}function J(e){Q?(e.preventDefault(),$(e)):(Q=!0,setTimeout(function(){Q=!1},300))}function $(e){if(!A.lockControlType){var t=e.target,o=y[t.index][4]?y[t.index][4]:s;Math.abs(t.rect1.x)<=2&&Math.abs(t.rect1.y)<=2&&Math.abs(t.rect2.x)<=2&&Math.abs(t.rect2.y)<=2&&(o="none"),"none"==o&&t.parent.addChildAt(t,0),"none"==(o=A.types[(A.types.indexOf(o)+(frame.shiftKey?-1:1)+A.types.length)%A.types.length])&&(t.rect1.x=t.rect1.y=t.rect2.x=t.rect2.y=0,t.parent.addChild(t),e.stopImmediatePropagation()),y[t.index][4]=o,t.rect1.color=ee(o),t.rect2.color=ee(o),te();var n=new createjs.Event("change");n.controlType="bezierSwitch",A.dispatchEvent(n),t.stage.update()}}function ee(e){var t={mirror:frame.purple,free:frame.yellow,none:frame.blue};return t[e]?t[e]:frame.pink}function te(){o.c(),A.colorCommand||(A.colorCommand=w=o.f(P).command),(zot(I)||I>0)&&(zot(O)&&zot(I)||(zot(O)&&(O="black"),A.borderColorCommand||(A.borderColorCommand=x=o.s(O).command),A.borderWidthCommand||(A.borderWidthCommand=C=o.ss(I).command),m&&(A.borderDashedCommand||(A.borderDashedCommand=T=o.sd([10,10],5).command))));var e=(a=y[0][0]).localToLocal(y[0][1].x,y[0][1].y,E);o.mt(e.x,e.y),n.c().s(frame.darker).ss(1);for(var t=0;t<y.length;t++){var i=t,r=(t+1)%y.length,a=y[i][0],s=y[i][1],l=y[i][2],d=y[i][3],c=y[r][0],u=y[r][1],h=y[r][2],f=(y[r][3],a.localToLocal(d.x,d.y,E)),p=c.localToLocal(h.x,h.y,E),g=c.localToLocal(u.x,u.y,E);o.bt(f.x,f.y,p.x,p.y,g.x,g.y);e=a.localToLocal(s.x,s.y,E);var z=a.localToLocal(l.x,l.y,E);n.mt(e.x,e.y).lt(z.x,z.y),n.mt(e.x,e.y).lt(f.x,f.y)}o.append(A.colorCommand),m&&o.append(A.borderDashedCommand),A.borderWidthCommand&&o.append(A.borderWidthCommand),A.borderColorCommand&&o.append(A.borderColorCommand)}}function L(){D||(D=!0,E.drag({onTop:!1}),M=E.on("mousedown",M),j=E.on("pressmove",j),S=E.on("pressup",S))}function X(e){(e||D)&&(D=!1,E.noDrag(),E.off("mousedown",M),E.off("pressmove",j),E.off("pressup",S))}B(),Object.defineProperty(A,"move",{get:function(){return f},set:function(e){f!=e&&(f=e,e?L():X())}}),Object.defineProperty(A,"toggle",{get:function(){return h},set:function(e){h!=e&&((h=e)?A.move&&L():!b&&A.move&&X())}}),Object.defineProperty(A,"controlsVisible",{get:function(){return b},set:function(e){b=e,e?A.showControls():A.hideControls()}});var Y=c;Object.defineProperty(A,"lockControls",{get:function(){return Y},set:function(e){Y=e,e?(A.controls.mouseChildren=!1,A.controls.mouseEnabled=!1):(A.controls.mouseChildren=!0,A.controls.mouseEnabled=!0)}}),A.lockControls=Y,Object.defineProperty(A,"color",{get:function(){return P},set:function(e){zot(e)&&(e="black"),P=e,w.style=P}}),Object.defineProperty(A,"borderColor",{get:function(){return O},set:function(e){O=e,x?x.style=O:drawShape()}}),Object.defineProperty(A,"borderWidth",{get:function(){return I},set:function(e){e>0||(e=0),I=e,C&&0!=I?(C.width=I,m&&(T.segments=[20,10],T.offset=5)):drawShape()}}),Object.defineProperty(A,"points",{get:function(){for(var t,o,n=[],i=0;i<y.length;i++)o=y[i],t=[e.decimals(o[0].x),e.decimals(o[0].y),e.decimals(o[1].x),e.decimals(o[1].y),e.decimals(o[2].x),e.decimals(o[2].y),e.decimals(o[3].x),e.decimals(o[3].y)],o[4]&&"straight"!==o[4]&&t.push(o[4]),n.push(t);return n},set:function(e){A.dispose(),i=e,A.shape&&(A.shape.graphics.clear(),A.sticks.graphics.clear(),A.controls.noDrag(),A.removeAllChildren(),delete A.shape,delete A.sticks,delete A.controls),B(),A.lockControls=Y}}),Object.defineProperty(A,"pointObjects",{get:function(){return y},set:function(e){zon&&zog("Blob() - pointObjects is read only - but its contents can be manipulated - use blob.update() after changes")}}),this.dispose=function(){if(A.shape){A.shape.cursor="default";for(var e=0;e<A.points.length;e++)A.points[e][1].removeAllEventListeners();for(e=0;e<k.length;e++)k[e].removeAllEventListeners();A.sticks.removeFrom(A),A.controls.removeFrom(A),A.shape.removeAllEventListeners(),A.controls.removeAllEventListeners(),A.removeAllEventListeners(),A.toggleStageEvent&&A.stage.off("stagemousedown",A.toggleStageEvent)}}},e.extend(e.Blob,e.Container,"clone","zimContainer",!1),e.Label=function(o,n,i,r,a,s,l,d,c,u,h,f,p,m,g,z,v,b,y,w,x,C,T){var k;if(k=zob(e.Label,arguments,"text, size, font, color, rollColor, shadowColor, shadowBlur, align, valign, lineWidth, lineHeight, fontOptions, backing, outlineColor, outlineWidth, backgroundColor, backgroundBorderColor, backgroundBorderWidth, backgroundCorner, backgroundDashed, padding, paddingHorizontal, paddingVertical",this))return k;z_d("54"),this.zimContainer_constructor(),this.type="Label",zot(o)&&(o="LABEL");var E=!1;""===o&&(o=" ",E=!0),zot(n)&&(n=36),zot(i)&&(i="arial"),zot(r)&&(r="black"),zot(a)&&(a=r),zot(s)&&(s=-1),zot(l)&&(l=14),zot(d)&&(d="left"),zot(c)&&(c="top"),zot(f)&&(f=""),!zot(m)&&zot(g)&&(g=Math.round(.2*n)),!zot(g)&&zot(m)&&(m="#000000"),zot(g)&&(g=0),zot(x)&&(x=10),zot(C)&&(C=x),zot(T)&&(T=x);var M=this;this.mouseChildren=!1;var j=this.label=new createjs.Text(String(o),f+" "+n+"px "+i,r);if(j.textAlign=d,j.lineWidth=u,j.lineHeight=h,j.textBaseline="alphabetic",g>0){var S=this.outlineLabel=j.clone();S.color=m,S.outline=g,this.addChild(S)}function A(){var t,o=j.getBounds();if("top"==c?(j.y=n-n/6,S&&(S.y=n-n/6),t=0):"center"==c||"middle"==c?(t=-o.height/2,j.y=.3*n,S&&(S.y=.3*n)):t=-o.height,p){var i=p.getBounds();M.setBounds(i.x,i.y,i.width,i.height)}else zot(z)?(M.setBounds(o.x,t,o.width,o.height),P.graphics.c().f("black").r(M.getBounds().x,M.getBounds().y,M.getBounds().width,M.getBounds().height)):(M.setBounds(o.x,t,o.width,o.height),M.removeChild(M.background),M.background=new e.Rectangle(M.getBounds().width+2*C,M.getBounds().height+2*T,z,v,b,y,null,w),e.center(M.background,M,0));e.center(j,M),j.y+=n/32,S&&(e.center(S,M,0),S.y+=n/32)}if(-1!=s&&l>0&&(j.shadow=new createjs.Shadow(s,3,3,l)),this.addChild(j),zot(p)&&zot(z)){var P=new createjs.Shape;M.hitArea=P}A(),zot(p)||(this.backing=p,e.center(p,this,0)),Object.defineProperty(M,"text",{get:function(){return" "==j.text&&E?"":j.text},set:function(e){E=!1,""===e&&(e=" ",E=!0),j.text=String(e),S&&(S.text=String(e)),A()}}),Object.defineProperty(M,"color",{get:function(){return r},set:function(t){a==r&&(a=t),r=t,j.color=r,e.OPTIMIZE||!zns&&OPTIMIZE||!M.stage||M.stage.update()}}),Object.defineProperty(M,"outlineColor",{get:function(){return m},set:function(t){m=t,S&&(S.color=m),e.OPTIMIZE||!zns&&OPTIMIZE||!M.stage||M.stage.update()}}),Object.defineProperty(M,"rollColor",{get:function(){return a},set:function(e){a=e}}),this._enabled=!0,Object.defineProperty(M,"enabled",{get:function(){return M._enabled},set:function(o){t(M,o),j.color=r,M.mouseChildren=!1,e.OPTIMIZE||!zns&&OPTIMIZE||!M.stage||M.stage.update()}}),this.showRollColor=function(e){return zot(e)&&(e=!0),j.color=e?a:r,M.stage&&M.stage.update(),M},this.on("mouseover",function(e){M.showRollColor()}),this.on("mouseout",function(e){M.showRollColor(!1)}),this.clone=function(){return M.cloneProps(new e.Label(M.text,n,i,r,a,s,l,d,c,u,h,f,zot(p)?null:p.clone(),m,g,z,v,b,y,w,x,C,T))},this.dispose=function(){return M.removeAllEventListeners(),!0}},e.extend(e.Label,e.Container,"clone","zimContainer"),e.Button=function(o,n,i,r,a,s,l,d,c,u,h,f,p,m,g,z,v,b,y,w,x,C,T,k,E,M,j,S,A,P,O,I){var D;if(D=zob(e.Button,arguments,"width, height, label, color, rollColor, borderColor, borderRollColor, borderWidth, corner, shadowColor, shadowBlur, hitPadding, gradient, gloss, flatBottom, dashed, backing, rollBacking, rollPersist, icon, rollIcon, toggle, rollToggle, toggleEvent, wait, waitTime, waitColor, rollWaitColor, waitTextColor, rollWaitTextColor, waitModal, waitEnabled",this))return D;z_d("55"),this.zimContainer_constructor(),this.type="Button",zot(o)&&(o=200),zot(n)&&(n=60),zot(r)&&(r="#C60"),zot(a)&&(a="#F93"),zot(j)&&(j=r),zot(S)&&(S=a),zot(s)&&(s=null),zot(l)&&(l=zot(s)?null:s),zot(d)&&(d=null),zot(c)&&(c=20),zot(u)&&(u="rgba(0,0,0,.3)"),zot(h)&&(h=14),zot(f)&&(f=0),zot(p)&&(p=0),zot(m)&&(m=0),zot(g)&&(g=!1),zot(i)&&(i=zot(w)?"PRESS":""),!zot(C)&&zot(k)&&(k=e.mobile()?"mousedown":"click"),"string"!=typeof i&&"number"!=typeof i||(i=new e.Label(i,36,"arial","white",null,null,null,"center","middle")),zot(y)&&(y=!1),this.rollPersist=y,zot(z)&&(z=!1),zot(C)||"Label"!=C.type||zon&&zog("ZIM Button() - do not pass Label to toggle parameter - just pass a String");var B,L=this;this.mouseChildren=!1,this.cursor="pointer",L.focus=!1,zot(v)?B=new e.Rectangle(o,n,r,s,d,c,g,z):((B=v).x=o/2,B.y=n/2,zot(b)||(b.x=o/2,b.y=n/2,this.rollBacking=b)),this.addChild(B),this.backing=B,zot(w)||(this.addChild(w),w.x=o/2,w.y=n/2,this.icon=w),zot(x)||(this.rollIcon=x,x.x=o/2,x.y=n/2);var X,Y,_=g?0:c;if(p>0&&zot(v)){var R=new createjs.Shape;R.graphics.lf(["rgba(255,255,255,"+p+")","rgba(0,0,0,"+p+")"],[0,1],0,0,0,n-d),R.graphics.rc(d/2,d/2,o-d,n-d,c,c,_,_),B.addChild(R)}if(m>0&&zot(v)){var W=new createjs.Shape;W.graphics.f("rgba(255,255,255,"+m+")"),W.graphics.rc(d/2,d/2,o-d,(n-d)/2,c,c,0,0),W.graphics.f("rgba(0,0,0,"+m+")"),W.graphics.rc(d/2,n/2,o-d,(n-d)/2,0,0,_,_),B.addChild(W)}function N(){(Y=new createjs.Shape).graphics.f("#000").r(-f,-f,o+2*f,n+2*f),L.hitArea=X=Y}f>0&&N(),-1!=u&&h>0&&(B.shadow=new createjs.Shadow(u,3,3,h),zot(b)||(b.shadow=new createjs.Shadow(u,3,3,h))),this.setBounds(0,0,o,n),this.addChild(i),i.center(this),i.y+=1,this.label=i;var F=!1;L.waiting=!1;var V,H,G,U,Z,q=!1,K=L.label.color,Q=L.label.rollColor;this.on("mousedown",function(){F=!0,zot(E)||L.waiting||(q=!0,zot(I)&&(I=!0),O&&(Z=stage.on("stagemousedown",function(e){L.hitTestPoint(stage.mouseX,stage.mouseY)||L.clearWait()},null,!0)),setTimeout(function(){L.waiting=!0},50),H=i.text,G=r,zot(A)||(L.label.color=A),zot(P)||(L.label.rollColor=P),U=L.enabled,!I&&L.enabled&&(L.enabled=!1),L.text=E,B.color=j,zot(M)&&(M=3e4),V&&V.clear(),V=timeout(M,function(){L.enabled||(L.enabled=U),L.clearWait(),L.dispatchEvent("waited")}),L.stage&&L.stage.update())}),this.clearWait=function(){return V?(Z&&stage.off("stagemousedown",Z),V.clear(),L.text=H,B.color=G,L.label.color=K,L.label.rollColor=Q,setTimeout(function(){L.waiting=!1},55),q=!1,L.stage&&L.stage.update(),L):L},this.removeWait=function(){return L.clearWait(),E=null,L},this.on("pressup",function(){F=!1,L.rollPersist&&!J&&$()});var J=!1;function $(){zot(v)?(B.color=q?j:r,B.borderColor=s):zot(b)||(zot(w)&&L.toggled?(L.removeChild(T),L.addChildAt(C,0)):(L.removeChild(b),L.addChildAt(v,0))),zot(x)||(L.toggled?(L.removeChild(T),L.addChild(C)):(L.removeChild(x),L.addChild(w))),L.label.showRollColor(!1),L.stage&&L.stage.update()}this.on("mouseover",function(e){J=!0,zot(v)?(B.color=q?S:a,B.borderColor=l):zot(b)||(zot(w)&&L.toggled?(L.removeChild(C),L.addChildAt(T,0)):(L.removeChild(v),L.addChildAt(b,0)));zot(x)||(L.toggled?(L.removeChild(C),L.addChild(T)):(L.removeChild(w),L.addChild(x)));L.label.showRollColor(),L.stage&&L.stage.update()}),this.on("mouseout",function e(t){J=!1;L.off("mouseout",e);L.rollPersist&&F||$()}),this.toggled=!1,this.toggleObj=C,this.rollToggle=T;var ee=i.text;function te(){"string"==typeof C?(L.text=L.toggled?C:ee,e.OPTIMIZE||!zns&&OPTIMIZE||!L.stage||L.stage.update()):zot(w)?L.setBackings(L.toggled?C:v,L.toggled?T:b):L.setIcons(L.toggled?C:w,L.toggled?T:x)}function oe(t,i,r,a,s){L.contains(L[t])?(L.removeChild(L[t]),L.addChildAt(r,s)):L.contains(L[i])&&(L.removeChild(L[i]),L.addChildAt(a,s)),L[t]=r,L[i]=a,L[t]&&(L[t].x=o/2,L[t].y=n/2),L[i]&&(L[i].x=o/2,L[i].y=n/2),e.OPTIMIZE||!zns&&OPTIMIZE||!L.stage||L.stage.update()}zot(C)||this.on(k,function(){q||(L.toggled=!L.toggled,te(L.toggled))}),Object.defineProperty(L,"text",{get:function(){return" "==i.text?"":i.text},set:function(e){i.text=e,i.center(this),i.y+=1}}),Object.defineProperty(L,"color",{get:function(){return r},set:function(t){r=t,B.color?B.color=r:zon&&zog("zim.Button - backing has no color property"),e.OPTIMIZE||!zns&&OPTIMIZE||!L.stage||L.stage.update()}}),Object.defineProperty(L,"rollColor",{get:function(){return a},set:function(e){a=e}}),Object.defineProperty(L,"borderColor",{get:function(){return s},set:function(e){s=e,B.borderColor&&(B.borderColor=e)}}),Object.defineProperty(L,"borderRollColor",{get:function(){return l},set:function(e){l=e}}),Object.defineProperty(L,"hitPadding",{get:function(){return f},set:function(e){0==(f=e)?X&&(this.hitArea=null):N()}}),this._enabled=!0,Object.defineProperty(L,"enabled",{get:function(){return L._enabled},set:function(o){t(L,o),L.mouseChildren=!1,i.color=i.color,e.OPTIMIZE||!zns&&OPTIMIZE||!L.stage||L.stage.update()}}),this.setBackings=function(e,t){return oe("backing","rollBacking",e,t,0),L},this.setIcons=function(e,t){return oe("icon","rollIcon",e,t,L.numChildren-1),L},this.toggle=function(e){return zot(e)?L.toggled=!L.toggled:L.toggled=e,te(),L},this.clone=function(){var t=new e.Button(o,n,i.clone(),r,a,s,l,d,c,u,h,f,p,m,g,z,zot(v)?null:v.clone(),zot(b)?null:b.clone(),y,zot(w)?null:w.clone(),zot(x)?null:x.clone(),zot(C)?null:"string"==typeof C?C:C.clone(),zot(T)?null:T.clone(),k,E,M,j,S,A,P,O,I);return L.cloneProps(t)},this.dispose=function(){return L.removeAllEventListeners(),L.removeChild(B),L.removeChild(b),L.removeChild(w),L.removeChild(L.label),L.label&&L.label.dispose(),B=null,b=null,w=null,L.label=null,!0}},e.extend(e.Button,e.Container,"clone","zimContainer",!1),e.CheckBox=function(o,n,i,r,a,s){var l;if(l=zob(e.CheckBox,arguments,"size, label, startChecked, color, margin, indicatorType",this))return l;z_d("56"),this.zimContainer_constructor(),this.type="CheckBox",zot(o)&&(o=60),zot(n)&&(n=null),"string"!=typeof n&&"number"!=typeof n||(n=new e.Label(n,5*o/6,"arial",r));var d=!zot(i)&&i;zot(r)&&(r="#111"),zot(a)&&(a=10),"box"!=s&&"square"!=s&&"x"!=s&&(s="check"),this.setBounds(-a,-a,o+2*a,o+2*a);var c=this;this.cursor="pointer";var u=new e.Shape,h=u.graphics;h.f("rgba(255,255,255,.5)").r(0,0,o,o),h.s(r).ss(o/10).r(o/7,o/7,o-o/7*2,o-o/7*2),this.addChild(u);var f=o;n&&(this.addChild(n),n.x=1.3*o+a,n.y=o/8,this.label=n,this.setBounds(-a,-a,o+3*a+n.getBounds().width,Math.max(o+2*a,n.getBounds().height)),f=n.x+n.width);var p=new e.Shape;(h=p.graphics).f("rgba(0,0,0,.01)").r(this.getBounds().x,this.getBounds().y,f+2*a,this.getBounds().height),this.hitArea=p;var m=new e.Shape,g=m.graphics,z="#000";"check"==s?g.f(z).p("AnQAdICBiaIEEDZIF8nfICfB4In/KPg"):"box"==s||"square"==s?g.f(z).dr(-35,-35,70,70):g.f(z).p("AmJEVIEUkTIkXkWIB4h5IEWEYIETkTIB4B3IkTESIEQERIh4B4IkRkRIkSEVg");m.setBounds(-47.5,-47.5,95,95);var v=o/161;m.scaleX=m.scaleY=v,m.alpha=.9,m.x=o/2,m.y=o/2,d&&this.addChild(m),this.on("mousedown"!=e.ACTIONEVENT||!window.zns&&"mousedown"!=ACTIONEVENT?"click":"mousedown",function(e){d=!d,c.setChecked(d),c.dispatchEvent("change")}),Object.defineProperty(c,"checked",{get:function(){return d},set:function(e){c.setChecked(e)}}),Object.defineProperty(c,"text",{get:function(){if(n)return n.text},set:function(t){n&&(n.text=t,e.OPTIMIZE||!zns&&OPTIMIZE||!c.stage||c.stage.update())}}),Object.defineProperty(m,"color",{get:function(){return z},set:function(t){d&&c.removeChild(m),m=new createjs.Shape,g=m.graphics,z=t,g.f(z).p("AnQAdICBiaIEEDZIF8nfICfB4In/KPg"),m.scaleX=m.scaleY=v,m.alpha=.9,m.x=o/2,m.y=o/2,d&&c.addChild(m),e.OPTIMIZE||!zns&&OPTIMIZE||!c.stage||c.stage.update()}}),Object.defineProperty(c,"check",{get:function(){return m},set:function(e){zog("ZIM CheckBox - check is read only")}}),this._enabled=!0,Object.defineProperty(c,"enabled",{get:function(){return c._enabled},set:function(e){t(c,e)}}),this.setChecked=function(t){return zot(t)&&(t=!0),(d=t)?c.addChild(m):c.removeChild(m),e.OPTIMIZE||!zns&&OPTIMIZE||!c.stage||c.stage.update(),c},this.clone=function(){return c.cloneProps(new e.CheckBox(o,n.clone(),i,r,a,s))},this.dispose=function(){return c.removeAllEventListeners(),!0}},e.extend(e.CheckBox,e.Container,"clone","zimContainer",!1),e.RadioButtons=function(o,n,i,r,a,s,l){var d;if(d=zob(e.RadioButtons,arguments,"size, buttons, vertical, color, spacing, margin, always",this))return d;z_d("57"),this.zimContainer_constructor(),this.type="RadioButtons",zot(o)&&(o=60),o=Math.max(5,o),zot(n)&&(n=["A","B","C"]),zot(i)&&(i=!0),zot(r)&&(r="#111"),zot(a)&&(a=i?.2*o:o),zot(s)&&(s=o/5);var c,u=this;if(this.cursor="pointer",this.labels=[],this.dots=[],"string"==typeof n){var h=n;n=[];for(var f=0;f<h.length;f++)n.push({label:h[f]})}var p=new e.Container;function m(e){var t=p.getChildIndex(e.target);l&&u.selectedIndex==t||(u.setSelected(t),u.dispatchEvent("change"))}this.addChild(p),function(){for(var t,s,l=!1,d=n.length-1;d>=0;d--)(t=n[d]).selected&&!0===t.selected&&(l?t.selected="false":(l=!0,u.id=t.id));p.removeAllChildren(),u.buttons=[];for(var h=0,d=0;d<n.length;d++){if("string"==typeof(t=n[d])||"number"==typeof t){var f={selected:!1,label:new e.Label(t,5*o/6,"arial",r)};t=f}(t.label&&"string"==typeof t.label||"number"==typeof t.label)&&(t.label=new e.Label(t.label,5*o/6,"arial",r)),u.labels.push(t.label),t.index=d,n[d]=t,(s=z(t.selected,t.label)).type="RadioButton",s.obj=t,t.selected&&(c=s.obj),p.addChild(s),i?(s.y=h,h+=s.getBounds().height+a):(s.x=h,h+=s.getBounds().width+a)}}();for(var g=0;g<p.numChildren;g++)p.getChildAt(g).on("mousedown"!=e.ACTIONEVENT||!window.zns&&"mousedown"!=ACTIONEVENT?"click":"mousedown",m);function z(t,n){var i=new e.Container;u.buttons.push(i),i.mouseChildren=!1,i.setBounds(-s,-s,o+2*s,o+2*s);var a=new e.Shape,l=a.graphics;l.f("rgba(255,255,255,.5)").dc(o/2,o/2,o/1.85),l.s(r).ss(o/9).dc(o/2,o/2,o/2-o/2/5),i.addChild(a);var d=i.check=new e.Circle(o/5.2,"rgba(0,0,0,.7)");u.dots.push(d),d.mouseEnabled=!1,d.alpha=.95,d.regX=d.regY=-o/2;var c=o;n&&(i.addChild(n),n.x=i.getBounds().width,n.y=o/8,i.setBounds(-s,-s,o+2*s+n.getBounds().width,Math.max(o+2*s,n.getBounds().height)),c=n.x+n.width,i.text=n.text),t&&(i.addChild(d),u.label=n,u.label&&(u.text=n.text));var h=new e.Shape;return(l=h.graphics).f("rgba(0,0,0,.01)").r(i.getBounds().x,i.getBounds().y,c+2*s,i.getBounds().height),i.hitArea=h,i}this.getBounds()||this.setBounds(0,0,o,o),this.setBounds(-s,-s,this.getBounds().width+s,this.getBounds().height+s),this.setSelected=function(t){if(zot(t)&&(t=-1),-1==t||p.getChildAt(t)){for(var o,n=0;n<p.numChildren;n++)(o=p.getChildAt(n)).removeChild(o.check);if(t>=0){o=p.getChildAt(t);var i=-2;c&&(i=c.index),c=o.obj}return-1==t||i==c.index?(c=null,u.id=null,u.label=null,u.text=""):(o.addChild(o.check),u.id=c.id,u.label=c.label,u.label&&(u.text=u.label.text)),e.OPTIMIZE||!zns&&OPTIMIZE||!u.stage||u.stage.update(),u}},Object.defineProperty(u,"selected",{get:function(){return c},set:function(e){zog("ZIM RadioButton - selected is read only")}}),Object.defineProperty(u,"selectedIndex",{get:function(){return c?c.index:-1},set:function(e){var t=e;l&&u.selectedIndex==t||u.setSelected(t)}}),this._enabled=!0,Object.defineProperty(u,"enabled",{get:function(){return u._enabled},set:function(e){t(u,e)}}),this.clone=function(){for(var t=e.copy(n),d=0;d<t.length;d++)t[d].label=t[d].label.clone();return u.cloneProps(new e.RadioButtons(o,t,i,r,a,s,l))},this.dispose=function(){for(var e=0;e<p.numChildren;e++)p.getChildAt(e).removeAllEventListeners();return u.removeAllEventListeners(),!0}},e.extend(e.RadioButtons,e.Container,"clone","zimContainer",!1),e.Pane=function(o,n,i,r,a,s,l,d,c,u,h,f,p,m,g,z,v,b,y,w,x,C){var T;if(T=zob(e.Pane,arguments,"width, height, label, color, drag, resets, modal, corner, backdropColor, shadowColor, shadowBlur, center, displayClose, backdropClose, backing, fadeTime, container, bar, barColor, barHeight, close, closeColor",this))return T;z_d("58"),this.zimContainer_constructor(),this.type="Pane";var k="zim display - Pane(): Please pass in a reference to a container with bounds set as first parameter";if(zot(v)){if(!zimDefaultFrame)return void zog(k);v=zimDefaultFrame.stage}else{if(!v.getBounds)return void zog(k);if(zot(v.getStage))return void zog("zim display - Pane(): The container must have a stage property")}zot(o)&&(o=200),zot(n)&&(n=200),zot(i)&&(i=null),"string"!=typeof i&&"number"!=typeof i||(i=new e.Label(i,40,"arial","black")),zot(r)&&(r="white"),zot(a)&&(a=!1),zot(s)&&(s=!0),zot(l)&&(l=!0),zot(d)&&(d=20),zot(c)&&(c="rgba(0,0,0,.2)"),zot(u)&&(u="rgba(0,0,0,.3)"),zot(h)&&(h=20),zot(f)&&(f=!0),zot(p)&&(p=!0),a&&(p=!1),zot(m)&&(m=!0),zot(z)&&(z=0);var E=this.backdrop=new e.Shape;E.type="CreateJS_Shape";var M=E.graphics;M.f(c),M.drawRect(-5e3,-5e3,1e4,1e4),this.setBounds(-o/2,-n/2,o,n);var j=this;E.on("mousedown"!=e.ACTIONEVENT||!window.zns&&"mousedown"!=ACTIONEVENT?"click":"mousedown",m?D:function(e){e.stopImmediatePropagation()});var S,A,P,O,I=new e.Dictionary(!0);function D(e){B(),v.stage.update(),j.dispatchEvent("close"),e.stopImmediatePropagation()}(E.on("mousedown",function(e){e.stopImmediatePropagation()}),l&&this.addChild(E),S=zot(g)?this.display=new e.Rectangle({width:o,height:n,color:r,corner:d}):g,p&&(S.cursor="pointer",S.on("mousedown"!=e.ACTIONEVENT||!window.zns&&"mousedown"!=ACTIONEVENT?"click":"mousedown",D)),-1!=u&&h>0&&(S.shadow=new createjs.Shadow(u,8,8,h)),S.on("click",function(e){e.stopImmediatePropagation()}),this.resetX,this.resetY,a)&&(S.cursor="pointer",S.on("mousedown",function(e){isNaN(j.resetX)&&(j.resetX=j.x),isNaN(j.resetY)&&(j.resetY=j.y),A=e.stageX-j.x,P=e.stageY-j.y,S.cursor="pointer"}),S.on("pressmove",function(t){var i,r,a,s=(i=t.stageX-A,r=t.stageY-P,i=Math.max(o/2,Math.min(v.getBounds().width-o/2,i)),r=Math.max(n/2,Math.min(v.getBounds().height-n/2,r)),{x:i,y:r});j.x=s.x,j.y=s.y;for(var l=0;l<j.numChildren;l++)(a=j.getChildAt(l)).constructor!=e.TextArea&&a.constructor!=e.Loader||a.resize();v.stage.update()}),this.on("pressup",function(e){S.cursor="pointer",v.stage.update()}));if(S.centerReg(this),i&&(this.addChild(i),e.center(i,this),this.label=i,this.text=i.text,i.mouseEnabled=!1),!zot(b)){"string"==typeof b&&(b=new e.Label(b)),barTitle=b,zot(w)&&(w=1.5*barTitle.height),zot(y)&&(y="rgba(0,0,0,.2)"),j.bar=b=new e.Container(o,w).centerReg(j).mov(0,-n/2+w/2),b.mouseEnabled=!1,b.mouseChildren=!1;j.bar.backing=new e.Rectangle(o,w,y,null,null,.95*d,!0).addTo(b);barTitle.center(b).pos(20)}x&&(zot(C)&&(C="#555"),(x=j.close=new e.Shape(-40,-40,80,80)).graphics.f(C).p("AmJEVIEUkTIkXkWIB4h5IEWEYIETkTIB4B3IkTESIEQERIh4B4IkRkRIkSEVg"),b?x.addTo(j).scaleTo(b,null,50).mov(o/2-30,-n/2+w/2).expand (40):x.addTo(j).sca(.3).mov(o/2-33,-n/2+30),x.cursor="pointer",x.on("mousedown"!=e.ACTIONEVENT||!window.zns&&"mousedown"!=ACTIONEVENT?"click":"mousedown",D));function B(){function t(){var t;v.removeChild(j);for(var o=0;o<j.numChildren;o++)if((t=j.getChildAt(o)).constructor==e.TextArea||t.constructor==e.Loader){var n={obj:t,depth:j.getChildIndex(t)};I.add(t,n)}for(o=j.numChildren-1;o>=0;o--)(t=j.getChildAt(o)).constructor!=e.TextArea&&t.constructor!=e.Loader||j.removeChild(t);if(e.OPTIMIZE||!zns&&OPTIMIZE||v.stage.update(),s&&(isNaN(j.resetX)||(j.x=j.resetX),isNaN(j.resetY)||(j.y=j.resetY)),j.zimAccessibility){var i=j.zimAccessibility;i.resize(j),O?O.focus():j.zimTabTag.nextSibling.focus(),setTimeout(function(){i.talk("Pane has been closed.")},50)}}z>0?j.animate({obj:{alpha:0},time:z,call:t}):t()}Object.defineProperty(j,"text",{get:function(){return" "==i.text?"":i.text},set:function(e){i.text=e}}),this._enabled=!0,Object.defineProperty(j,"enabled",{get:function(){return j._enabled},set:function(e){t(j,e)}}),this.hide=function(){return B(),j},this.show=function(){f&&isNaN(j.resetX)&&(j.x=v.getBounds().width/2,j.y=v.getBounds().height/2),v.addChild(j);for(var e=0;e<I.length;e++)j.addChildAt(I.values[e].obj,I.values[e].depth);if(z>0?(j.alpha=0,j.animate({alpha:1},z)):v.stage&&v.stage.update(),j.zimAccessibility){var t=j.zimAccessibility;setTimeout(function(){t.activatedObject&&(O=t.activatedObject.zimTabTag)},50),t.resize(j),t.tabIndex=j.zimTabIndex}return j},this.toggle=function(){return v.contains(j)?j.hide():j.show(),j},this.clone=function(){var t=i.x,T=i.y,k=j.cloneProps(new e.Pane(o,n,i.clone(),r,a,s,l,d,c,u,h,f,p,m,zot(g)?g.clone():null,z,v,b,y,w,x,C));return k.label.x=t,k.label.y=T,k},this.dispose=function(){return S.removeAllEventListeners(),x&&x.removeAllEventListeners(),j.removeChild(S),S=null,!0}},e.extend(e.Pane,e.Container,"clone","zimContainer",!1),e.Window=function(t,o,n,i,r,a,s,l,d,c,u,h,f,p,m,g,z,v,b,y,w,x,C){var T;if(T=zob(e.Window,arguments,"width, height, color, borderColor, borderWidth, padding, corner, swipe, indicatorActive, indicatorDrag, indicatorColor, indicatorAlpha, indicatorFade, slide, slideDamp, slideSnap, interactive, shadowColor, shadowBlur, paddingHorizontal, paddingVertical, scrollWheel, damp",this))return T;z_d("58.1"),this.zimContainer_constructor(),this.type="Window",zot(t)&&(t=300),zot(o)&&(o=200),zot(n)&&(n="#333"),zot(i)&&(i="#999"),zot(r)&&(r=1),zot(a)&&(a=10),zot(s)&&(s=0),zot(l)&&(l=!0),zot(d)&&(d=!0),zot(c)&&(c=!1),zot(u)&&(u=i),zot(h)&&(h=.3),zot(f)&&(f=!0),c&&(f=!1),zot(p)&&(p=!0),zot(m)&&(m=.6),zot(g)&&(g="vertical"),zot(z)&&(z=!0),zot(v)&&(v="rgba(0,0,0,.3)"),zot(b)&&(b=20),zot(w)&&(w=a),zot(y)&&(y=a),zot(x)&&(x=!0);var k=this;this.scrollX=this.scrollY=this.scrollXMax=this.scrollYMax=0;var E=this.backing=new e.Shape;this.addChild(E);var M=new createjs.Shape,j=M.graphics;this.addChild(M);var S=this.content=new e.Container;if(this.addChild(S),S.mask=M,!z)var A=new createjs.Shape;if(r>0){var P=new createjs.Shape;this.addChild(P)}function O(){k.setBounds(0,0,t,o),E.graphics.c().f(n).rr(0,0,t,o,s),-1!=v&&b>0&&(E.shadow=new createjs.Shadow(v,8,8,b)),r>0&&P.graphics.c().s(i).ss(r).rr(0,0,t,o,s)}O();var I,D,B,L,X,Y,_,R,W,N,F=this.indicator={};if(F.size=6,F.minSize=2*F.size,F.spacing=3.5+r/2,F.margin=0,F.corner=F.size/2,F.showTime=500,F.fadeTime=3e3,d){var V=this.hIndicator=new e.Shape,H=V.graphics;V.alpha=h,this.addChild(V),c&&V.drag({localBounds:!0});var G=this.vIndicator=new e.Shape,U=G.graphics;G.alpha=h,this.addChild(G),c&&G.drag({localBounds:!0})}function Z(){e.dragRect(S,new createjs.Rectangle(0,0,B?-k.scrollXMax:0,L?-k.scrollYMax:0))}this.update=function(){d&&(H.clear(),U.clear()),X=d?F.size+2*F.spacing:0,Y=S.getBounds().width,_=S.getBounds().height,B=Y>t-y&&(!0===l||"auto"==l||"horizontal"==l),L=_>o-w&&(!0===l||"auto"==l||"vertical"==l),k.scrollXMax=Y+2*y-t+(L?X+F.margin:0),k.scrollYMax=_+2*w-o+(B?X+F.margin:0),j.clear();var n=r/2,i=r/2,a=t-(L&&d?F.size+2*F.spacing:0)-(L?0:r),h=o-(B&&d?F.size+2*F.spacing:0)-(B?0:r);j.f("rgba(0,0,0,.01)").rr(n,i,a,h,s),z||(A.graphics.c().f("red").dr(n,i,a,h),S.hitArea=A);var f=Math.max(s,Math.min(F.corner,F.spacing)),p=f+r/2,m=f+(L?X:0)+r/2,g=f+r/2,v=f+(B?X:0)+r/2;if(B&&d&&(indicatorLength=Math.max(F.minSize,(t-p-m)*(t-p-m)/(Y+y+F.margin)),H.f(u).rr(0,0,indicatorLength,F.size,F.corner),V.x=p,V.y=o-F.size-F.spacing,I=new e.Proportion(-k.scrollXMax,0,p,t-indicatorLength-m,-1),c)){V.setBounds(0,0,indicatorLength,F.size);var b=new createjs.Rectangle(p,V.y,t-indicatorLength-p-m,0);V.dragRect(b),V.proportion=new e.Proportion(b.x,b.x+b.width,0,-k.scrollXMax),V.off("pressmove",R),R=V.on("pressmove",function(){S.x=V.proportion.convert(V.x)})}if(L&&d&&(indicatorLength=Math.max(F.minSize,(o-g-v)*(o-g-v)/(_+w+F.margin)),U.f(u).rr(0,0,F.size,indicatorLength,F.corner),G.x=t-F.size-F.spacing,G.y=g,D=new e.Proportion(-k.scrollYMax,0,g,o-indicatorLength-v,-1),c)){G.setBounds(0,0,F.size,indicatorLength);b=new createjs.Rectangle(G.x,g,0,o-indicatorLength-g-v);G.dragRect(b),G.proportion=new e.Proportion(b.y,b.y+b.height,0,-k.scrollYMax),G.off("pressmove",W),W=G.on("pressmove",function(){fe=S.y=G.proportion.convert(G.y)})}ee(),clearTimeout(N),N=setTimeout(function(){Z()},300)},this.resize=function(e,n){return zot(e)&&(e=t),zot(n)&&(n=o),t=e,o=n,O(),k.update(),fe=S.y,C&&me.immediate(fe),k},this.add=function(e){if(ze(e),e.getBounds())return S.addChild(e),0==e.x&&(e.x=y),0==e.y&&(e.y=w),k.update(),k;zog("SwipeBox.add() - please add content with bounds set")},this.remove=function(e){return S.removeChild(e),k.update(),k};var q,K,Q,J=!1;function $(){fe=S.y,C&&me.immediate(fe),d&&ee()}function ee(){A&&(A.x=-S.x,A.y=-S.y),B&&d&&(V.x=I.convert(S.x)),L&&d&&(G.y=D.convert(S.y))}function te(t){e.Ticker.remove($),J=!1,B&&f&&e.animate(V,{alpha:0},F.fadeTime),L&&f&&e.animate(G,{alpha:0},F.fadeTime)}if(l&&S.on("mousedown",function(){J||e.Ticker.add($,S.stage),J=!0,B&&d&&f&&e.animate(V,{alpha:h},F.showTime),L&&d&&f&&e.animate(G,{alpha:h},F.showTime)}),this.on("added",function(){if(ze(k),!l)return;e.drag({obj:S,currentTarget:!0,localBounds:!0,slide:p,slideDamp:m,slideSnap:(!0===l||"auto"==l||"vertical"==l)&&g}),S.getBounds()&&S.getBounds().width>0&&setTimeout(function(){Z()},300)},null,!0),p?S.on("slidestop",te):S.on("mousedown",function(){S.stage.on("stagemouseup",te,null,!0)}),z){var oe,ne,ie;S.on("mousedown",function(){oe=S.stage.mouseX,ne=Date.now()}),S.on("click",function(){Date.now()-ne<600&&Math.abs(S.stage.mouseX-oe)<5&&(k.contentMouse=S.globalToLocal(S.stage.mouseX,S.stage.mouseY),k.dispatchEvent("select"))}),S.on("mouseover",function(){ie=Date.now(),e.Ticker.add(he,S.stage)}),S.on("mouseout",function(){ue||(k.dispatchEvent("hoverout"),ue=!0);e.Ticker.remove(he)});var re=0,ae=0,se=0,le=0,de=300,ce=2,ue=!1;function he(){if(!S.stage)return ue||(k.dispatchEvent("hoverout"),ue=!0),void e.Ticker.remove(he);Math.abs(re-S.stage.mouseX)>ce||Math.abs(ae-S.stage.mouseY)>ce?(ue||(k.dispatchEvent("hoverout"),ue=!0),ie=Date.now(),re=S.stage.mouseX,ae=S.stage.mouseY):Date.now()-ie>de&&((Math.abs(se-S.stage.mouseX)>ce||Math.abs(le-S.stage.mouseY)>ce)&&(k.contentMouse=S.globalToLocal(S.stage.mouseX,S.stage.mouseY),k.dispatchEvent("hoverover"),se=S.stage.mouseX,le=S.stage.mouseY,ue=!1),ie=Date.now())}}var fe=k.scrollY;if(x){function pe(e){if(L&&k.stage&&k.hitTestPoint(k.stage.mouseX,k.stage.mouseY)){zot(e)&&(e=event);var t=e.detail?-19*e.detail:e.wheelDelta;zot(t)&&(t=-19*e.deltaY),fe+=t,fe=Math.max(-k.scrollYMax,Math.min(0,fe)),C||(k.scrollY=fe,S.stage.update())}}q=window.addEventListener("mousewheel",pe),K=window.addEventListener("wheel",pe),Q=window.addEventListener("DOMMouseScroll",pe)}var me,ge=!1;function ze(t){C&&!ge&&t.stage&&(ge=!0,me=new e.Damp(k.scrollY,C),e.Ticker.add(function(){J||zot(fe)||(k.scrollY=me.convert(fe))},t.stage))}Object.defineProperty(k,"scrollX",{get:function(){return S.x},set:function(e){S.x=e,ee()}}),Object.defineProperty(k,"scrollY",{get:function(){return S.y},set:function(e){S.y=e,ee()}}),this.clone=function(x){zot(x)&&(x=!0);var C=k.cloneProps(new e.Window(t,o,n,i,r,a,s,l,d,c,u,h,f,p,m,g,z,v,b,y,w));return x&&(k.content.cloneChildren(C.content),C.update()),C},this.dispose=function(){return x&&(window.removeEventListener("mousewheel",q),window.removeEventListener("wheel",K),window.removeEventListener("DOMMouseScroll",Q)),k.removeAllEventListeners(),V.off("pressmove",R),G.off("pressmove",W),S.removeAllEventListeners(),e.Ticker.remove(he),e.Ticker.remove($),e.noDrag(S),!0}},e.extend(e.Window,e.Container,"clone","zimContainer",!1),e.Waiter=function(t,o,n,i,r,a,s,l){var d;if(d=zob(e.Waiter,arguments,"container, speed, color, circleColor, corner, shadowColor, shadowBlur, fadeTime",this))return d;z_d("59"),this.zimContainer_constructor(),this.type="Waiter";var c="zim display - Waiter(): Please pass in a reference to a container with bounds set as first parameter";if(zot(t)){if(!zimDefaultFrame)return void zog(c);t=zimDefaultFrame.stage}else{if(!t.getBounds)return void zog(c);if(zot(t.stage))return void zog("zim display - Waiter(): The container must have a stage property")}zot(o)&&(o=600),zot(n)&&(n="orange"),zot(i)&&(i="white"),zot(r)&&(r=16),zot(a)&&(a="rgba(0,0,0,.3)"),zot(s)&&(s=14),zot(l)&&(l=0);this.setBounds(-52,-20,104,40);var u=this,h=this.display=new e.Shape;this.addChild(h),h.setBounds(0,0,104,40),h.regX=52,h.regY=20;var f=h.graphics;f.f(n),f.rr(0,0,104,40,r),-1!=a&&s>0&&(h.shadow=new createjs.Shadow(a,3,3,s)),h.on("click",function(e){e.stopImmediatePropagation()});var p,m,g,z=new e.Container;this.addChild(z);for(var v=0;v<3;v++)(p=new createjs.Shape).graphics.f(i).dc(0,0,12),p.x=32*(v-1),z.addChild(p),p.cache(-12,-12,24,24),p.alpha=0;this.hide=function(){function e(){if(u.parent&&u.parent.removeChild(u),t.stage.update(),u.zimAccessibility){var e=u.zimAccessibility;e.resize(u),m?m.focus():u.zimTabTag.nextSibling.focus(),setTimeout(function(){e.talk("Waiter has finished.")},50)}}return l>0?u.animate({obj:{alpha:0},time:l,call:e}):e(),u},this.show=function(){for(var e,n=0,i=0;i<z.numChildren;i++)u.alpha=0,createjs.Tween.get(u,{override:!0}).to({alpha:1},300),g=setTimeout(function(){z&&(e=z.getChildAt(n),createjs.Tween.get(e,{loop:!0}).to({alpha:1},o/3/2).wait(o/3).to({alpha:0},o/3).wait(o-o/3-o/3/2),n++)},i*o/3);if(u.ticker=createjs.Ticker.on("tick",function(){t.stage.update()}),u.x=t.getBounds().width/2,u.y=t.getBounds().height/2,t.addChild(u),l>0&&(u.alpha=0,u.animate({alpha:1},l)),u.zimAccessibility){var r=u.zimAccessibility;setTimeout(function(){r.activatedObject&&(m=r.activatedObject.zimTabTag)},50),r.resize(u),r.talk(u.zimTabTag.getAttribute("aria-label"))}return u},this.clone=function(){return u.cloneProps(new e.Waiter(t,o,n,i,r,a,s,l))},this.dispose=function(){return u.ticker&&createjs.Ticker.off("tick",u.ticker),clearInterval(g),h.removeAllEventListeners(),u.removeChild(h),u.removeChild(z),h=null,z=null,!0}},e.extend(e.Waiter,e.Container,"clone","zimContainer",!1),e.Indicator=function(o,n,i,r,a,s,l,d,c,u,h,f,p,m){var g;if(g=zob(e.Indicator,arguments,"width, height, num, color, offColor, borderColor, backingColor, indicatorType, fill, scale, lightScale, press, shadowColor, shadowBlur",this))return g;z_d("60"),this.zimContainer_constructor(),this.type="Indicator",zot(o)&&(o=300),zot(n)&&(n=50),zot(i)&&(i=6),zot(r)&&(r="#f58e25"),zot(a)&&(a="#666"),a<0&&(a="rgba(0,0,0,.01)"),s<0&&(s=null),zot(l)&&(l=-1),zot(d)&&(d="dot"),zot(c)&&(c=!1),zot(u)&&(u=1),zot(h)&&(h=1),zot(f)&&(f=!1),zot(p)&&(p="rgba(0,0,0,.3)"),zot(m)&&(m=5);var z,v="mousedown"!=e.ACTIONEVENT||!window.zns&&"mousedown"!=ACTIONEVENT?"click":"mousedown",b=this;this.lights=[];new e.Container;if(-1!=l){var y=new e.Rectangle(o,n,l);this.addChild(y),this.backing=y}var w,x=this.lightsContainer=new e.Container;this.addChild(x);var C=.5*n,T=o/(i+1),k=new createjs.Shape;"square"==d||"box"==d?k.graphics.f("black").dr(-T/2/h+C/2,-n/2+C/2,T/h,n):k.graphics.f("black").dr(-T/2/h,-n/2,T/h,n);for(var E=0;E<i;E++)"square"==d||"box"==d?((w=new e.Rectangle(C,C,a,s)).regX=w.width/2,w.regY=w.height/2):w=new e.Circle(C/2,a,s),this.lights.push(w),w.znum=E,w.scaleX=w.scaleY=h,w.hitArea=k,w.x=T+T*E,w.y=n/2,x.addChild(w);if(x.setBounds(0,0,o,n),x.regX=x.x=o/2,x.regY=x.y=n/2,this.addChild(x),-1!=p&&m>0&&(x.shadow=new createjs.Shadow(p,2,2,m)),f){x.cursor="pointer";x.on(v,function(e){z!=e.target.znum&&(M(z=e.target.znum),b.dispatchEvent("change"))})}function M(t){var o;t>=i&&(t=-1);for(var n=0;n<i;n++)o=c&&n<t?r:a,n==t&&(o=r),x.getChildAt(n).color=o;b.zimAccessibility&&b.zimAccessibility.changeTitle(b),e.OPTIMIZE||!zns&&OPTIMIZE||!b.stage||b.stage.update()}x.scaleX=x.scaleY=u,Object.defineProperty(this,"selectedIndex",{get:function(){return z},set:function(t){z=Math.floor(t),M(z=e.constrain(z,-1,i-1))}}),Object.defineProperty(this,"num",{get:function(){return i},set:function(e){zon&&zog("num is read only")}}),this._enabled=!0,Object.defineProperty(b,"enabled",{get:function(){return b._enabled},set:function(e){t(b,e)}}),this.clone=function(){return b.cloneProps(new e.Indicator(o,n,i,r,a,s,l,d,c,u,h,f,p,m))},this.dispose=function(){return b.removeAllEventListeners(),!0}},e.extend(e.Indicator,e.Container,"clone","zimContainer",!1),e.Stepper=function(o,n,i,r,a,s,l,d,c,u,h,f,p,m,g,z,v,b,y,w,x,C,T,k,E,M,j,S,A,P){var O;if(O=zob(e.Stepper,arguments,"list, width, color, borderColor, label, vertical, arrows, corner, shadowColor, shadowBlur, continuous, display, press, hold, holdDelay, holdSpeed, drag, dragSensitivity, dragRange, stepperType, min, max, step, step2, arrows2, arrows2Scale, keyEnabled, keyArrows, rightForward, downForward",this))return O;z_d("61"),this.zimContainer_constructor(),this.type="Stepper",zot(o)&&(o=[0,1,2,3,4,5,6,7,8,9]),zot(n)&&(n=200),zot(i)&&(i="white"),zot(r)&&(r=null),zot(a)&&(a=""),"string"!=typeof a&&"number"!=typeof a||(a=new e.Label(a,64,"arial","#555",null,null,null,"center")),zot(s)&&(s=!1),zot(l)&&(l=!0),zot(d)&&(d=16),zot(c)&&(c="rgba(0,0,0,.3)"),zot(u)&&(u=14),zot(h)&&(h=!1),zot(f)&&(f=!0),zot(p)&&(p=!0),zot(m)&&(m=!0),zot(g)&&(g=400),zot(z)&&(z=200),zot(v)&&(v=!0),(zot(b)||b<=0)&&(b=.1),zot(y)&&(y=200),zot(w)&&(w="list"),zot(x)&&(x=0),zot(C)&&(C=100),zot(T)&&(T=1),zot(k)&&(k=T),zot(E)&&k!=T&&"number"==w&&(E=!0),zot(M)&&(M=.5),zot(j)&&(j=!0),zot(S)&&(S=!0),zot(A)&&(A=!0),zot(P)&&(P="number"!=w);var I,D,B,L,X=this,Y=100,_=T,R=1;if("number"==w){if(x=Number(x),C=Number(C),NaN==x&&(x=0),NaN==C&&(C=100),C<x){R=-1;var W=C;C=x,x=W,D=C}else D=x;this.min=x,this.max=C,0>x&&0<C&&(D=0),T=Math.abs(T),B=Math.max(V(T),V(k))}else if("letter"==w){o="ABCDEFGHIJKLMNOPQRSTUVWXYZ".split(""),"string"!=typeof x&&(x="A"),"string"!=typeof C&&(C="Z"),x=x.substr(0,1).toUpperCase(),C=C.substr(0,1).toUpperCase();var N=o.indexOf(x);N<0&&(x="A",N=0);var F=o.indexOf(C);F<0&&(C="Z",F=o.length),F<N&&(o.reverse(),N=o.length-1-N,F=o.length-1-F),o=o.splice(N,F-N+1)}else w="list";function V(e){var t=String(e).split(".")[1];return t=t?t.length:0}var H=0,G=0;v&&this.on("mousedown",function(){X.zimAccessibility&&X.zimAccessibility.aria||(this.stage.mouseMoveOutside=!0,L=this.stage.on("stagemousemove",function(e){H=e.rawX,G=e.rawY}))},null,!0),this.label=a,a.mouseChildren=!1,a.mouseEnabled=!1;var U,Z,q,K,Q,J,$,ee,te,oe,ne,ie,re,ae=!1;if(l||E){var se=new createjs.Shape;se.graphics.f("rgba(255,255,255,.11)").r(0,0,150,150),se.regX=75,se.regY=87.5}if(l&&(K=this.containerPrev=new e.Container,this.addChild(K),K.hitArea=se,Q=this.arrowPrev=new e.Triangle(Y,80,80,i),-1!=c&&u>0&&(K.shadow=new createjs.Shadow(c,3,3,u)),K.addChild(Q),K.cursor="pointer",K.on("mousedown",function(e){if(!X.zimAccessibility||!X.zimAccessibility.aria){_=T;var t=s?P?1:-1:A?-1:1;he(t),ce(t)}}),m&&K.on("pressup",ue),s?(K.rotation=180,K.x=n/2,K.y=f?K.height+25+Y+K.height/2+25:2*K.height):(K.rotation=-90,K.x=K.height/2,K.y=K.width/2)),f){var le,de=this.textBox=new e.Shape;de.cursor="pointer",this.addChild(de),de.setBounds(0,0,n,Y),null!=r&&de.graphics.s(r).ss(1.5),de.graphics.f(i).rr(0,0,n,Y,d),-1!=c&&u>0&&(de.shadow=new createjs.Shadow(c,3,3,u)),l&&(s?l&&(de.y=Q.height+25):l&&(de.x=Q.height+25)),this.addChild(a),o.length>0&&(I=0,a.text=o[I]),a.x=50+de.x+de.getBounds().width/2,a.y=de.y+(de.getBounds().height-a.getBounds().height)/2,de.on("mousedown",function(e){X.zimAccessibility&&X.zimAccessibility.aria||(le=X.currentValue,p&&he(1),ce(1,!0),"number"==w&&(clearTimeout(q),ae=!0,q=setTimeout(function(){ae=!1},200)))}),de.on("pressup",function(){X.zimAccessibility&&X.zimAccessibility.aria||ae&&(fe(D=Math.round(D),D),X.currentValue!=le&&X.dispatchEvent("change"),le=X.currentValue)})}else o.length>0&&(I=0);function ce(t,o,n){if(m){ie=X.stage.mouseX,holdY=X.stage.mouseY,0==ie&&(ie=1),0==holdY&&(holdY=1),v||(b=1),re=new e.Proportion(0,y,z,z*b);var i=z;U=setTimeout(function(){!0,function e(){Z=setTimeout(function(){var r=t;if(v){var a=Math.abs(H-ie),l=Math.abs(G-holdY);s?(o||n||(a=0),n&&(l=0)):(o||n||(l=0),n&&(a=0)),(a>=10||l>=10)&&(a>l?(_=s?k:T,r=H-ie>0?1:-1,i=re.convert(Math.abs(ie-H))):(_=s?T:k,r=G-holdY>0?1:-1,"number"!=w&&P||(r*=-1),i=re.convert(Math.abs(holdY-G))))}he(r),e()},i)}()},g)}}function ue(){X.zimAccessibility&&X.zimAccessibility.aria||(!1,clearTimeout(U),clearTimeout(Z))}function he(t){var n;if("number"==w){var i=D;D+=_*t*R,D=e.decimals(D,B),h?D>X.max?D=X.min:D<X.min&&(D=X.max):(D>X.max?(D=1==T?X.max:i,f&&(de.cursor="default")):f&&(de.cursor="pointer"),D<X.min&&(D=1==T?X.min:i))}else{if(n=I+t,h)n>o.length-1&&(n=0),n<0&&(n=o.length-1);else{if(n>o.length-1)return void(f&&(de.cursor="default"));if(f&&(de.cursor="pointer"),n<0)return}I=n}fe("number"==w?D:o[I],"number"==w?D:I),X.currentValue!=le&&X.dispatchEvent("change"),le=X.currentValue}function fe(t,n){I=n,f&&("number"==w&&0!=t&&B>0&&(t=e.decimals(t,B,!0)),a.text=t,a.x=de.x+de.getBounds().width/2,a.y=de.y+(de.getBounds().height-a.getBounds().height)/2),l&&(K.alpha=1,Q.color=i,K.cursor="pointer",J.alpha=1,$.color=i,J.cursor="pointer",h||("number"==w?(I==X.min&&(R>0?pe():me()),I==X.max&&(R>0?me():pe())):(0==I&&(s?me():pe()),I==o.length-1&&(s?pe():me())))),!J||e.OPTIMIZE||!zns&&OPTIMIZE||!J.stage?!a||e.OPTIMIZE||!zns&&OPTIMIZE||!a.stage||a.stage.update():J.stage.update(),X.zimAccessibility&&X.zimAccessibility.changeTitle(X,null,!0)}function pe(){l&&(K.alpha=.8,Q.color="#aaa",K.cursor="default")}function me(){l&&(J.alpha=.8,$.color="#aaa",J.cursor="default")}l&&(J=this.containerNext=new e.Container,this.addChild(J),J.hitArea=se.clone(),$=this.arrowNext=new e.Triangle(Y,80,80,i),-1!=c&&u>0&&(J.shadow=new createjs.Shadow(c,3,3,u)),J.addChild($),J.cursor="pointer",J.on("mousedown",function(e){if(!X.zimAccessibility||!X.zimAccessibility.aria){_=T;var t=s?P?-1:1:A?1:-1;he(t),ce(t)}}),m&&J.on("pressup",ue),s?(J.rotation=0,J.x=n/2,J.y=J.getBounds().height/2):(J.rotation=90,J.x=f?de.x+de.getBounds().width+J.getBounds().height/2+25:K.x+K.getBounds().width,J.y=J.getBounds().width/2)),m&&f&&de.on("pressup",ue),E&&((ee=this.prev2=new e.Container).hitArea=se.clone(),te=this.arrowPrev2=new e.Triangle(Y,80,80,"rgba(0,0,0,.2)",i,2),ee.addChild(te),ee.cursor="pointer",ee.sca(M),ee.alpha=.5,ee.on("mousedown",function(e){if(!X.zimAccessibility||!X.zimAccessibility.aria){_=k;var t=s?A?-1:1:P?1:-1;he(t),ce(t,null,!0)}}),m&&ee.on("pressup",ue),(oe=this.next2=new e.Container).hitArea=se.clone(),ne=this.arrowNext2=new e.Triangle(Y,80,80,"rgba(0,0,0,.2)",i,2),oe.addChild(ne),oe.cursor="pointer",oe.sca(M),oe.alpha=.5,oe.on("mousedown",function(e){if(!X.zimAccessibility||!X.zimAccessibility.aria){_=k;var t=s?A?1:-1:P?-1:1;he(t),ce(t,null,!0)}}),m&&oe.on("pressup",ue),s?(ee.y=this.height/2,ee.x=-ee.width/2-25*Math.max(.2,Math.min(1,M)),ee.rotation=270,oe.y=this.height/2,oe.x=this.width+oe.width/2+25*Math.max(.2,Math.min(1,M)),oe.rotation=90):(oe.x=this.width/2,oe.y=-oe.height/2-25*Math.max(.2,Math.min(1,M)),oe.rotation=0,ee.x=this.width/2,ee.y=this.height+ee.height/2+25*Math.max(.2,Math.min(1,M)),ee.rotation=180),this.addChild(ee,oe)),Object.defineProperty(this,"stepperArray",{get:function(){if("number"==w){o=[];for(var e=X.min;e<=X.max;e+=Math.min(T,k))o.push(e)}return o},set:function(e){o=e,X.selectedIndex=X.selectedIndex}}),fe("number"==w?D:o[I],"number"==w?D:I),Object.defineProperty(this,"selectedIndex",{get:function(){return"number"==w?X.stepperArray.indexOf(X.currentValue):I},set:function(e){zot(e)||("number"==w?(I=Math.min(X.stepperArray.length-1,Math.max(0,e)),fe(D=X.stepperArray[I],D)):(e=Math.min(o.length-1,Math.max(0,e)),fe(o[I=e],I)))}}),Object.defineProperty(this,"currentValue",{get:function(){return"number"==w?D:o[I]},set:function(e){if(!zot(e))if("number"==w){if(e=Number(e),X.max>X.min){if(e>X.max||e<X.min)return}else if(e<X.max||e>X.min)return;if(newIndex=X.stepperArray.indexOf(e),newIndex<0)return;I=newIndex,fe(D=X.stepperArray[I],D)}else{if(!(o.indexOf(e)>-1))return;if((e=o.indexOf(e))==X.selectedIndex)return;fe(o[I=e],I)}}}),Object.defineProperty(this,"currentValueEvent",{get:function(){return X.currentValue},set:function(e){String(e)!=String(X.currentValue)&&(X.currentValue=e,X.dispatchEvent("change"))}}),Object.defineProperty(this,"continuous",{get:function(){return h},set:function(e){h=e,"number"==w?fe(D,D):fe(o[X.selectedIndex],X.selectedIndex)}}),this._enabled=!0,Object.defineProperty(X,"enabled",{get:function(){return X._enabled},set:function(n){t(X,n),n?("number"==w?fe(D,D):fe(o[X.selectedIndex],X.selectedIndex),window.addEventListener("keydown",X.keyDownEvent)):(pe(),me(),window.removeEventListener("keydown",X.keyDownEvent),f&&(a.mouseChildren=!1),f&&(a.mouseEnabled=!1)),!J||e.OPTIMIZE||!zns&&OPTIMIZE||!J.stage?!a||e.OPTIMIZE||!zns&&OPTIMIZE||!a.stage||a.stage.update():J.stage.update()}});var ge=!1,ze=!1,ve=!1;this.on("mousedown",function(){X.zimAccessibility&&X.zimAccessibility.aria||(X.focus=!0,ge=!0,ze=!1,ve=!1)}),this.keyDownEvent=function(e){if(X.focus){e||(e=event);var t,o=e.keyCode;if(S&&o>=37&&o<=40){var n=P?40:38,i=A?39:37,r=P?38:40,l=A?37:39;o==n||o==i?(_=s&&o==n||!s&&o==i?T:k,he(1)):o!=r&&o!=l||(_=s&&o==r||!s&&o==l?T:k,he(-1))}if(j)if("number"==w)!e.shiftKey&&o>=48&&o<=57?t=o-48:o>=96&&o<=105?t=o-96:190==o?ze=!0:173==o||189==o?(X.currentValue=-1*X.currentValue,X.currentValue!=le&&X.dispatchEvent("change"),le=X.currentValue,ve=!ve):46==o&&(ge=!0,ze=!1),ge&&!zot(t)?(ze&&(t/=10),ve&&(t*=-1),X.currentValue=t,ge=!1,X.currentValue!=le&&X.dispatchEvent("change"),le=X.currentValue):zot(t)||(ze&&(t=String(t/10).substr(1)),X.currentValue=Number(Math.floor(Number(a.text))+String(t)),X.currentValue!=le&&X.dispatchEvent("change"),le=X.currentValue);else X.currentValue=String.fromCharCode(e.keyCode),X.currentValue!=le&&X.dispatchEvent("change"),le=X.currentValue}},window.addEventListener("keydown",this.keyDownEvent),this.next=function(){he(1)},this.prev=function(){he(-1)},this.clone=function(){return X.cloneProps(new e.Stepper(o,n,i,r,a.clone(),s,l,d,c,u,h,f,p,m,g,z,v,b,y,w,x,C,T,k,E,M,j,S,A,P))},this.dispose=function(){return X.removeAllEventListeners(),window.removeEventListener("keydown",X.keyDownEvent),X.stage&&X.stage.off(L),!0}},e.zut=function(t){if(zot(t)||!t.key)return!0;e.async("http://zimjs.com/gamdata.php?id="+t.key+"&player="+t.player+"&score="+t.score+"&reverse="+t.info.reverse+"&total="+t.info.total+"&allowZero="+t.info.allowZero,t.info.type)},e.extend(e.Stepper,e.Container,"clone","zimContainer",!1),e.Slider=function(o,n,i,r,a,s,l,d,c,u,h,f,p,m){var g;if(g=zob(e.Slider,arguments,"min, max, step, button, barLength, barWidth, barColor, vertical, useTicks, inside, keyArrows, keyArrowsStep, keyArrowsH, keyArrowsV",this))return g;if(z_d("62"),this.zimContainer_constructor(),this.type="Slider",zot(o)&&(o=0),zot(n)&&(n=10),n-o!=0){if(zot(i)&&(i=0),zot(a)&&(a=300),zot(s)&&(s=3),zot(l)&&(l="#666"),zot(d)&&(d=!1),zot(c)&&(c=!1),zot(u)&&(u=!1),zot(h)&&(h=!0),zot(p)&&(p=!0),zot(m)&&(m=!0),zot(f)&&(f=(n-o)/100),zot(r)){var z=30,v=40;d&&(z=50,v=40),r=new e.Button(z,v,"","#fff","#ddd","#666",null,1,0,null,null,30)}var b,y;r.rollPersist=!0,d?(b=r.width,u?(y=a,this.setBounds(0,0,b,y)):(y=a+r.height,this.setBounds(-r.width/2,-r.height/2,b,y))):(y=r.height,u?(b=a,this.setBounds(0,0,b,y)):(b=a+r.width,this.setBounds(-r.width/2,-r.height/2,b,y)));var w,x,C,T,k,E,M,j=this,S=o,A=0;if(this.button=r,this.cursor="pointer",c&&0!=i){T=this.ticks=new e.Shape,this.addChild(T),(k=T.graphics).ss(1).s(l);var P=Math.round((n-o)/i),O=(n-o)/P;if(O!=i&&zon&&zog("zim.Slider():non-divisible step ("+i+") adjusted"),i=O,u)var I=(a-(d?r.height:r.width))/Math.abs(P);else I=a/Math.abs(P)}if(d){var D=u?r.height/2:0;if(c&&0!=i){for(var B=0;B<=Math.abs(P);B++)k.mt(0,D+I*B).lt(20,D+I*B);T.x=10}(w=this.bar=new e.Rectangle(s,a,l)).expand (20,0),this.addChild(w),e.centerReg(r),this.addChild(r),C=w.getBounds(),x=new createjs.Rectangle(C.width/2,C.y+D,0,C.height-2*D)}else{D=u?r.width/2:0;if(c&&0!=i){for(B=0;B<=Math.abs(P);B++)k.mt(D+I*B,0).lt(D+I*B,-20);T.y=-10}(w=this.bar=new e.Rectangle(a,s,l)).expand (0,20),this.addChild(w),e.centerReg(r),this.addChild(r),C=w.getBounds(),x=new createjs.Rectangle(C.x+D,C.height/2,C.width-2*D,0)}r.x=x.x,r.y=x.y,r.on("mousedown",function(e){j.focus=!0;var t=j.globalToLocal(e.stageX,e.stageY);E=t.x-r.x,M=t.y-r.y,j.stage&&(j.stage.mouseMoveOutside=!0)}),r.on("pressmove",function(e){W(e)}),w.on("mousedown",function(e){E=0,M=0,j.zimAccessibility&&j.zimAccessibility.aria||W(e)}),Object.defineProperty(this,"currentValue",{get:function(){return S},set:function(t){zot(t)||(o<n?(t<o&&(t=o),t>n&&(t=n)):(t>o&&(t=o),t<n&&(t=n)),S=t=R(t),d?(r.y=(t-n)/(o-n)*x.height+D,A=r.y):(r.x=(t-o)/(n-o)*x.width+D,A=r.x),F(),e.OPTIMIZE||!zns&&OPTIMIZE||!j.stage||j.stage.update())}}),Object.defineProperty(this,"currentValueEvent",{get:function(){return S},set:function(e){e!=j.currentValue&&(j.currentValue=e,j.dispatchEvent("change"))}}),Object.defineProperty(this,"min",{get:function(){return o},set:function(e){zon&&zog("min is read only")}}),Object.defineProperty(this,"max",{get:function(){return n},set:function(e){zon&&zog("max is read only")}}),Object.defineProperty(this,"step",{get:function(){return i},set:function(e){zon&&zog("step is read only")}}),Object.defineProperty(this,"keyArrowsH",{get:function(){return p},set:function(e){p=e}}),Object.defineProperty(this,"keyArrowsV",{get:function(){return m},set:function(e){m=e}});var L=!1,X=!1,Y=!1,_=!1;this.keyDownEvent=function(e){(j.focus||!j.zimAccessibility&&h)&&(37==e.keyCode&&p?L=!0:40==e.keyCode&&m?X=!0:39==e.keyCode&&p?Y=!0:38==e.keyCode&&m&&(_=!0),null==j.keyInterval&&(L||X||Y||_)&&(V(),j.keyTimeout=setTimeout(function(){null==j.keyInterval&&(L||X||Y||_)&&(j.keyInterval=setInterval(V,40))},140)))},window.addEventListener("keydown",this.keyDownEvent),j.keyUpEvent=function(e){37==e.keyCode?L=!1:40==e.keyCode?X=!1:39==e.keyCode?Y=!1:38==e.keyCode&&(_=!1),null==j.keyInterval||L||X||Y||_||(clearInterval(j.keyInterval),j.keyInterval=null)},window.addEventListener("keyup",this.keyUpEvent),this._enabled=!0,Object.defineProperty(j,"enabled",{get:function(){return j._enabled},set:function(e){t(j,e),e?(window.addEventListener("keydown",j.keyDownEvent),window.addEventListener("keyup",j.keyUpEvent)):(window.removeEventListener("keydown",j.keyDownEvent),window.removeEventListener("keyup",j.keyUpEvent))}}),this.clone=function(){return j.cloneProps(new e.Slider(o,n,i,r.clone(),a,s,l,d,c,u,h,f,p,m))},this.dispose=function(){return window.removeEventListener("keydown",j.keyDownEvent),window.removeEventListener("keyup",j.keyUpEvent),r.removeAllEventListeners(),!0}}else zog("ZIM Slider range must not be 0");function R(e){return 0==i?e:Math.round(e/i)*i}function W(t){var i,a,s,l=j.globalToLocal(t.stageX,t.stageY),c=(i=l.x-E,a=l.y-M,s=x,i=Math.max(s.x,Math.min(s.x+s.width,i)),a=Math.max(s.y,Math.min(s.y+s.height,a)),{x:i,y:a});d?(r.x=c.x,S=R((c.y-x.y)/x.height*(o-n)),r.y=x.y+S*x.height/(o-n),S+=n,r.y!=A&&j.dispatchEvent("change"),A=r.y):(S=R((c.x-x.x)/x.width*(n-o)),r.x=x.x+S*x.width/(n-o),S+=o,r.y=c.y,r.x!=A&&j.dispatchEvent("change"),A=r.x),F(),e.OPTIMIZE||!zns&&OPTIMIZE||!j.stage||j.stage.update()}function N(e){return e>0?1:-1}function F(){j.zimAccessibility&&j.zimAccessibility.changeTitle(j,null,!0)}function V(){(L||X)&&(j.currentValueEvent-=i>0?i*N(n-o):f*N(n-o)),(Y||_)&&(j.currentValueEvent+=i>0?i*N(n-o):f*N(n-o))}},e.extend(e.Slider,e.Container,"clone","zimContainer",!1),e.Dial=function(o,n,i,r,a,s,l,d,c,u,h,f,p,m,g,z,v,b,y,w,x){var C;if(C=zob(e.Dial,arguments,"min, max, step, width, color, indicatorColor, indicatorScale, indicatorType, innerCircle, innerScale, useTicks, innerTicks, tickColor, limit, keyArrows, keyArrowsStep, keyArrowsH, keyArrowsV, continuous, continuousMin, continuousMax",this))return C;if(z_d("63"),this.zimContainer_constructor(),this.type="Dial",zot(o)&&(o=0),zot(n)&&(n=10),n-o!=0){zot(i)&&(i=1),zot(r)&&(r=100),zot(a)&&(a="#666"),zot(s)&&(s="#222"),zot(l)&&(l=1),zot(d)&&(d="arrow"),zot(c)&&(c=!0),zot(u)&&(u=.5),zot(h)&&(h=!0),zot(f)&&(f=!1),zot(p)&&(p=s),zot(m)&&(m=!0),zot(g)&&(g=!0),zot(z)&&(z=(n-o)/100),zot(v)&&(v=!0),zot(b)&&(b=!0),zot(y)&&(y=!1),y&&(m=!1);var T=this;this.cursor="pointer";var k=r/2,E=o,M=0,j=this.backing=new e.Circle(k,a);if(this.addChild(j),c){var S=f?"rgba(0,0,0,.2)":"rgba(0,0,0,.1)";"black"!=a&&"#000"!=a&&"#000000"!=a&&"#111"!=a&&"#111111"!=a||(S="#222");var A=this.inner=new e.Circle(k*u,S);if(this.addChild(A),!f){var P=this.inner2=new e.Circle(k*(u-.1),"rgba(0,0,0,.1)");this.addChild(P)}}var O,I,D,B,L=Math.abs(n-o)/i;if(h&&0!=i){ticks=this.ticks=new e.Container,this.addChild(ticks);for(var X=0;X<(y?L:L+1);X++){var Y;(Y=new e.Rectangle(1,.2*k,p)).regY=k*(f?u-.05:1.28),Y.regX=.5,Y.rotation=360/(y?L:L+1)*X,ticks.addChild(Y)}}if(this.setBounds(-k,-k,r,r),"dot"==d||"circle"==d){var _=this.indicator=new e.Container,R=this.indicatorShape=new e.Circle(.19*k,s);_.addChild(R),e.sca(_,l),_.regY=k-_.getBounds().width*l/2-.07*k}else if("line"==d||"rectangle"==d){_=this.indicator=new e.Container,R=this.indicatorShape=new e.Rectangle(.1*k,.3*k,s);_.addChild(R),e.sca(_,l),_.regY=k-_.getBounds().width*l/2-.07*k,_.regX=.05*k}else{_=this.indicator=new e.Container,R=this.indicatorShape=new e.Triangle(.4*k,.4*k,.4*k,s);_.addChild(R),e.sca(_,l),_.regY=k-_.getBounds().height*l*(f?.85:.75),f&&(R.rotation=180)}_.regY/=l,this.addChild(_);var W=0;if(y)var N=0,F=0,V=0,H=!1,G=!1,U=!0;else o;this.on("mousedown",function(e){if(!T.zimAccessibility||!T.zimAccessibility.aria){O=_.rotation;var t=T.parent.globalToLocal(e.stageX,e.stageY),o=t.x-T.x,n=T.y-t.y;I=180*Math.atan2(o,n)/Math.PI;var i=(new Date).getTime();D=T.on("pressmove",function(e){if(H){var t=T.parent.globalToLocal(e.stageX,e.stageY),o=t.x-T.x,n=T.y-t.y;I=180*Math.atan2(o,n)/Math.PI,O=_.rotation}o=(t=T.parent.globalToLocal(e.stageX,e.stageY)).x-T.x,n=T.y-t.y;var i=180*Math.atan2(o,n)/Math.PI,r=O+i-I;r=(r+36e5)%360,m&&Math.abs(r-W)>180||(te(r),W=r)}),B=this.on("pressup",function(e){(new Date).getTime()-i<200&&(t=T.parent.globalToLocal(e.stageX,e.stageY),o=t.x-T.x,n=T.y-t.y,te(180*Math.atan2(o,n)/Math.PI));O=_.rotation,T.off("pressmove",D),T.off("pressup",B)})}}),Object.defineProperty(this,"currentValue",{get:function(){return E},set:function(t){zot(t)||(y?(H=!1,zot(w)||zot(x)?zot(w)?zot(x)||t>x&&(t=x,H=!0):t<w&&(t=w,H=!0):w<x?(t<w&&(t=w,H=!0),t>x&&(t=x,H=!0)):(t>w&&(t=w,H=!0),t<x&&(t=x,H=!0)),U&&(G=!0,V=360*Math.floor(t/(n-o)))):o<n?(t<o&&(t=m?o:n),t>n&&(t=m?n:o)):(t>o&&(t=m?o:n),t<n&&(t=m?n:o)),E=t,t=J(t),_.rotation=360*(t-o)/(n-o+(y?0:$(n-o)*i)),_.rotation=(_.rotation+36e5)%360,M=t-o,W=_.rotation,ee(),e.OPTIMIZE||!zns&&OPTIMIZE||!T.stage||T.stage.update())}}),Object.defineProperty(this,"currentValueEvent",{get:function(){return E},set:function(e){e!=T.currentValue&&(T.currentValue=e,T.dispatchEvent("change"))}}),Object.defineProperty(this,"min",{get:function(){return o},set:function(e){y?o=e:zon&&zog("min is read only")}}),Object.defineProperty(this,"max",{get:function(){return n},set:function(e){y?n=e:zon&&zog("max is read only")}}),Object.defineProperty(this,"continuous",{get:function(){return y},set:function(e){zon&&zog("continuous is read only")}}),Object.defineProperty(this,"continuousMin",{get:function(){return w},set:function(e){w=e,T.currentValue<w&&(T.currentValue=w)}}),Object.defineProperty(this,"continuousMax",{get:function(){return x},set:function(e){x=e,T.currentValue>x&&(T.currentValue=x)}}),Object.defineProperty(this,"step",{get:function(){return i},set:function(e){zon&&zog("step is read only")}}),Object.defineProperty(this,"keyArrowsH",{get:function(){return v},set:function(e){v=e}}),Object.defineProperty(this,"keyArrowsV",{get:function(){return b},set:function(e){b=e}});var Z=!1,q=!1,K=!1,Q=!1;this.keyDownEvent=function(e){(T.focus||!T.zimAccessibility&&g)&&(37==e.keyCode&&v?Z=!0:40==e.keyCode&&b?q=!0:39==e.keyCode&&v?K=!0:38==e.keyCode&&b&&(Q=!0),null==T.keyInterval&&(Z||q||K||Q)&&(oe(),T.keyTimeout=setTimeout(function(){null==T.keyInterval&&(Z||q||K||Q)&&(T.keyInterval=setInterval(oe,40))},140)))},window.addEventListener("keydown",this.keyDownEvent),T.keyUpEvent=function(e){37==e.keyCode?Z=!1:40==e.keyCode?q=!1:39==e.keyCode?K=!1:38==e.keyCode&&(Q=!1),null==T.keyInterval||Z||q||K||Q||(clearInterval(T.keyInterval),T.keyInterval=null)},window.addEventListener("keyup",this.keyUpEvent),this._enabled=!0,Object.defineProperty(T,"enabled",{get:function(){return T._enabled},set:function(e){t(T,e),e?(T.keyDownEvent=window.addEventListener("keydown",T.keyDownEvent),T.keyUpEvent=window.addEventListener("keyup",T.keyUpEvent)):(window.removeEventListener("keydown",T.keyDownEvent),window.removeEventListener("keyup",T.keyUpEvent))}}),this.clone=function(){return T.cloneProps(new e.Dial(o,n,i,r,a,s,l,d,c,u,h,f,p,m,g,v,b,z,y,w,x))},this.dispose=function(){return T.removeAllEventListeners(),window.removeEventListener("keydown",T.keyDownEvent),window.removeEventListener("keyup",T.keyUpEvent),!0}}else zog("ZIM Dial range must not be 0");function J(e){return 0==i?e:Math.round(e/i)*i}function $(e){return e>0?1:-1}function ee(){T.zimAccessibility&&T.zimAccessibility.changeTitle(T,null,!0)}function te(t){if(y)return G&&(N=t,G=!1),t>N+180?V-=360:t<N-180&&(V+=360),F=V+t,U=!1,T.currentValue=J(F*(n-o)/360),T.dispatchEvent("change"),N=t,U=!0,!0;var r;t<0&&(t+=360),t%=360,0!=i?(r=J((t=Math.min(t,360-360/(L+1)))/(360-360/(L+1))*(n-o)),_.rotation=r*(360-360/(L+1))/(n-o)):(_.rotation=t,r=t/360*(n-o)),r!=M&&(M=r,E=r+o,T.dispatchEvent("change"),e.OPTIMIZE||!zns&&OPTIMIZE||!T.stage||T.stage.update()),ee()}function oe(){(Z||q)&&(T.currentValueEvent-=i>0?i*$(n-o):z*$(n-o)),(K||Q)&&(T.currentValueEvent+=i>0?i*$(n-o):z*$(n-o))}},e.extend(e.Dial,e.Container,"clone","zimContainer",!1),e.Tabs=function(o,n,i,r,a,s,l,d,c,u,h,f,p,m,g,z,v,b,y,w,x,C,T){var k;if(k=zob(e.Tabs,arguments,"width, height, tabs, color, rollColor, offColor, spacing, currentEnabled, corner, labelColor, flatBottom, keyEnabled, gradient, gloss, wait, waitTime, waitColor, rollWaitColor, waitTextColor, rollWaitTextColor, waitModal, waitEnabled, backingColor",this))return k;z_d("65"),this.zimContainer_constructor(),this.type="Tabs",zot(o)&&(o=240),zot(n)&&(n=60),(zot(i)||i.length<=0)&&(i=[{label:1},{label:2},{label:3},{label:4}]),zot(r)&&(r="#333"),zot(a)&&(a="#555"),zot(s)&&(s="#777"),zot(d)&&(d=!1),zot(l)&&(l=1),zot(c)&&(c=0),zot(u)&&(u="white"),zot(h)&&(h=!0),zot(f)&&(f=!0);var E=this;this.keyEnabled=f;var M,j=0,S=[],A=[],P=i.length,O=(o-l*(P-1))/P;if(!zot(T)){var I=this.backing=new e.Rectangle(o,n,T);this.addChildAt(I)}if("number"==typeof i[0]||"string"==typeof i[0])for(var D=0;D<i.length;D++)i[D]={label:String(null!=i[D])?i[D]:"1"};var B,L,X=0,Y=0;for(D=0;D<i.length;D++)zot((B=i[D]).width)&&Y++,X+=zot(B.width)?O:B.width;if(X>o-l*(P-1))for(D=0;D<i.length;D++)(B=i[D]).width=(o-l*(P-1))/X*(zot(B.width)?O:B.width);else if(Math.round(X)<Math.round(o-l*(P-1)))if(Y>0)for(L=(P*O-(X-Y*O))/Y,D=0;D<i.length;D++)(B=i[D]).width=zot(B.width)?L:B.width;else zon&&zog("ZIM Tabs - total less than width"),o=X+l*(P-1);var _,R=0;for(D=0;D<i.length;D++)zot((B=i[D]).label)&&(B.label=" "),_=0==D?zot(B.color)?r:B.color:zot(B.offColor)?s:B.offColor,"string"!=typeof B.label&&"number"!=typeof B.label||(B.label=new e.Label(B.label,n/2,"arial",u)),(M=new e.Button({width:zot(B.width)?O:B.width,height:n,label:B.label,color:_,rollColor:zot(B.rollColor)?a:B.rollColor,corner:c,shadowColor:-1,gradient:p,gloss:m,flatBottom:h,wait:zot(B.wait)?g:B.wait,waitTime:zot(B.waitTime)?z:B.waitTime,waitColor:zot(B.waitColor)?v:B.waitColor,rollWaitColor:zot(B.rollWaitColor)?b:B.rollWaitColor,waitTextColor:zot(B.waitTextColor)?y:B.waitTextColor,rollWaitTextColor:zot(B.rollWaitColor)?w:B.rollWaitTextColor,waitModal:zot(B.waitModal)?x:B.waitModal,waitEnabled:zot(B.waitEnabled)?C:B.waitEnabled})).on("mousedown"!=e.ACTIONEVENT||!window.zns&&"mousedown"!=ACTIONEVENT?"click":"mousedown",function(t){W(t.currentTarget.znum),E.dispatchEvent("change"),e.OPTIMIZE||!zns&&OPTIMIZE||!E.stage||E.stage.update()}),M.znum=D,B.label.znum=D,M.type="TabsButton",S.push(B.label),A.push(M),this.addChild(M),M.x=R,R=M.x+M.width+l,0!=D||d||(M.enabled=!1);function W(e){var t=i[j];t&&(zot(t.wait)&&(A[j].color=zot(t.offColor)?s:t.offColor),d||(A[j].enabled=!0)),(t=i[j=e])&&(zot(t.wait)&&(A[j].color=zot(t.color)?r:t.color),d||(A[j].enabled=!1))}window.addEventListener("keydown",function(t){if(E.keyEnabled&&!E.zimAccessibility&&9==t.keyCode){var o=j;t.shiftKey?W(--o<0?i.length-1:o):W(++o>i.length-1?0:o),E.dispatchEvent("change"),e.OPTIMIZE||!zns&&OPTIMIZE||!E.stage||E.stage.update(),t.preventDefault()}}),Object.defineProperty(this,"selected",{get:function(){return A[j]},set:function(e){zon&&zog("selected is read only - try selectedIndex")}}),Object.defineProperty(this,"selectedIndex",{get:function(){return j},set:function(t){W(t),e.OPTIMIZE||!zns&&OPTIMIZE||!E.stage||E.stage.update()}}),Object.defineProperty(this,"tabs",{get:function(){return j},set:function(t){W(Math.min(Math.max(t,0),i.length-1)),e.OPTIMIZE||!zns&&OPTIMIZE||!E.stage||E.stage.update()}}),Object.defineProperty(this,"color",{get:function(){return r},set:function(t){zog("tabs color property "+t),r=t,zot(i[j].color)&&(A[j].color=r,e.OPTIMIZE||!zns&&OPTIMIZE||!E.stage||E.stage.update())}}),Object.defineProperty(this,"rollColor",{get:function(){return a},set:function(e){a=e;for(var t=0;t<i.length;t++)zot(i[j].rollColor)&&(A[t].rollColor=a)}}),Object.defineProperty(this,"offColor",{get:function(){return s},set:function(t){s=t;for(var o=0;o<i.length;o++)zot(i[j].offColor)&&(A[o].color=s);e.OPTIMIZE||!zns&&OPTIMIZE||!E.stage||E.stage.update()}}),Object.defineProperty(this,"label",{get:function(){return S[j]},set:function(e){zon&&zog("selected is read only - try selectedIndex")}}),Object.defineProperty(this,"text",{get:function(){return null!=S[j]?S[j].text:void 0},set:function(e){zon&&zog("selected is read only - try selectedIndex")}}),Object.defineProperty(this,"buttons",{get:function(){return A},set:function(e){zon&&zog("buttons is read only")}}),Object.defineProperty(this,"labels",{get:function(){return S},set:function(e){zon&&zog("labels is read only")}}),this._enabled=!0,Object.defineProperty(E,"enabled",{get:function(){return E._enabled},set:function(e){t(E,e)}}),this.clone=function(){for(var t=e.copy(i),k=0;k<t.length;k++)t[k].label=t[k].label.clone();return E.cloneProps(new e.Tabs(o,n,t,r,a,s,l,d,c,u,h,f,p,m,g,z,v,b,y,w,x,C,T))},this.dispose=function(){for(var e=0;e<E.buttons.length;e++)E.buttons[e].dispose(),E.labels[e].dispose(),E.buttons[e].removeAllEventListeners();return E.removeAllEventListeners(),!0}},e.extend(e.Tabs,e.Container,"clone","zimContainer",!1),e.Pad=function(o,n,i,r,a,s,l,d,c,u,h,f,p,m,g,z,v,b,y,w,x){var C;if(C=zob(e.Pad,arguments,"width, cols, rows, keys, color, rollColor, offColor, spacing, currentEnabled, corner, labelColor, gradient, gloss, wait, waitTime, waitColor, rollWaitColor, waitTextColor, rollWaitTextColor, waitModal, waitEnabled",this))return C;if(z_d("66"),this.zimContainer_constructor(),this.type="Pad",zot(o)&&(o=150),zot(n)&&(n=3),zot(i)&&(i=n),zot(r)){r=[];for(var T=1;T<=i*n;T++)r.push(T)}zot(c)&&(c=!0),zot(d)&&(d=1);var k,E=this;this.cols=n,this.rows=i;var M,j=o/n-d,S=[],A=0;this.labels=[],this.buttons=[];for(T=0;T<i;T++){for(var P=[],O=0;O<n;O++)P.push(null!=r[A]?r[A]:""),A++;M=S[T]=new e.Tabs({width:o,height:j,tabs:P,color:a,rollColor:s,offColor:l,spacing:d,currentEnabled:c,corner:u,labelColor:h,flatBottom:!1,keyEnabled:!1,gradient:f,gloss:p,wait:m,waitTime:g,waitColor:z,rollWaitColor:v,waitTextColor:b,rollWaitTextColor:y,waitModal:w,waitEnabled:x}),this.labels=this.labels.concat(M.labels),this.buttons=this.buttons.concat(M.buttons),this.addChild(M),M.selectedIndex=-1,M.y=(j+d)*T,M.znum=T,M.on("change",I)}function I(t){var o=t.target;E.selected=o.selected,E.text=o.text,E.label=o.label;for(var i=o.selectedIndex,r=0;r<S.length;r++)S[r].selectedIndex=-1;o.selectedIndex=i,k=o.znum*n+i,E.dispatchEvent("change"),e.OPTIMIZE||!zns&&OPTIMIZE||!E.stage||E.stage.update()}this.tabs=S,Object.defineProperty(this,"selectedIndex",{get:function(){return k},set:function(e){k=e;for(var t=0;t<S.length;t++)S[t].selectedIndex=-1;var o=Math.floor(k/n);o>=0&&o<E.tabs.length&&(E.tabs[o].selectedIndex=k%n)}}),this._enabled=!0,Object.defineProperty(E,"enabled",{get:function(){return E._enabled},set:function(e){t(E,e)}}),this.clone=function(){return E.cloneProps(new e.Pad(o,n,i,r,a,s,l,d,c,u,h,f,p,m,g,z,v,b,y,w,x))},this.dispose=function(){for(var e=0;e<E.tabs.length;e++)E.tabs[e].dispose();return E.removeAllEventListeners(),!0}},e.extend(e.Pad,e.Container,"clone","zimContainer",!1),e.ColorPicker=function(t,o,n,i,r,a,s,l,d,c,u,h,f,p,m){var g;if(g=zob(e.ColorPicker,arguments,"width, colors, cols, spacing, greyPicker, alphaPicker, startColor, drag, shadowColor, shadowBlur, buttonBar, circles, indicator, backingColor, keyArrows",this))return g;z_d("67"),this.zimContainer_constructor(),this.type="ColorPicker",zot(t)&&(t=500),zot(o)&&(k=!0),zot(n)&&(n=10),zot(i)&&(i=2),zot(a)&&(a=!0),zot(r)&&(r=!0),zot(d)&&(d="rgba(0,0,0,.3)"),zot(c)&&(c=14),zot(u)&&(u=!0),zot(l)&&(l=!!u),zot(h)&&(h=!1),zot(f)&&(f=!1,u||(f=!0)),zot(p)&&(p="black"),zot(m)&&(m=!0);var z=this,v="#e472c4",b="#50c4b7",y=1,w=1,x=new createjs.Shape;this.addChild(x),x.x+=i,x.y+=i;var C,T,k=!1,E=[];if(zot(o)){k=!0;var M=6,j=M*M*M;M=Math.ceil(Math.pow(j,.5)),T=(t-i)/18-i;var S=Math.floor(Math.pow(M*M,1/3));C=[];for(var A=0;A<6;A++)for(var P=0;P<6;P++)for(var O=0;O<6;O++)C.push("#"+L(3*A)+L(3*P)+L(3*O));for(o=[],A=0;A<C.length;A++)Y=Math.floor(A/6),o[18*((X=A%6)+6*(S=Y>=18?1:0))+(Y-6*S*3)]=C[A];n=18,E=[b,v]}else T=(t-i)/n-i;var I=Math.ceil(o.length/n),D=String(o[o.length-1]);zot(s)||(D=String(s));var B=b;function L(e){return(e=Math.floor(e).toString(16))+""+e}var X,Y,_,R,W=x.graphics;S=0;for(A=0;A<o.length;A++)Y=A%n,X=Math.floor(A/n),_=Y*(T+i),R=X*(T+i),h?W.f(o[A]).dc(_+T/2,R+T/2,T/2):W.f(o[A]).r(_,R,T,T);var N=R+T+i,F=N;if(r){for(A=0;A<16;A++)E.push("#"+L(A)+L(A)+L(A));for(A=0;A<E.length;A++)Y=Math.floor(A/n),_=(X=A%n)*(T+i),R=Y*(T+i)+N,h?W.f(E[A]).dc(_+T/2,R+T/2,T/2):W.f(E[A]).r(_,R,T,T);N=R+T+i;var V=n,H=Math.ceil(E.length/n)}if(f){function G(e){"#000"==D||"#000000"==D||"black"==D?(f.color="#222",f.alpha=1):(f.color="black",f.alpha=.5),f.x=x.x+e%n*(T+i)+T/2,f.y=x.x+Math.floor(e/n)*(T+i)+T/2}(f=this.indicator=h?new e.Circle(T/2*.5):new e.Rectangle(.5*T,.5*T)).alpha=.5,f.centerReg(),this.addChild(f),G(o.indexOf(D))}if(a){var U=new e.Container;U.setBounds(0,0,600,70),this.addChild(U),U.x=0,U.y=N;var Z=this.alphaBacking=new e.Rectangle(580,50,"#222",null,null,0);U.addChild(Z),e.centerReg(Z,U);var q=this.alphaBut=new e.Button({width:20,height:30,label:"",corner:0,hitPadding:20}),K=this.alphaSlider=new e.Slider(0,1,.05,q,330);K.currentValue=1,U.addChild(K),K.x=40,K.y=U.height/2;var Q=this.alphaText=new e.Label("Alpha: 1",30,null,"orange");U.addChild(Q),Q.x=K.x+K.bar.width+40,Q.y=U.height/2-Q.height/2,U.scaleX=U.scaleY=t/600,K.on("change",function(){Q.text="Alpha: "+me(K.currentValue),ie&&(ie.alpha=w=K.currentValue),u?z.dispatchEvent("set"):z.dispatchEvent("change"),z.stage&&z.stage.update()}),N+=U.height-10}if(u){var J=new e.Container;J.setBounds(0,0,600,100),this.addChild(J),J.x=0,J.y=N+10;var $=this.swatchText=new e.Label(D.toUpperCase().substr(0,7),30,null,"orange");if(J.addChild($),e.centerReg($),$.x=90,$.y=48,l){var ee=this.grip=new e.Shape;J.addChild(ee),ee.graphics.f("rgba(256,256,256,.25)").r(0,0,5,20).r(10,0,5,20).r(20,0,5,20).r(30,0,5,20),ee.x=70,ee.y=65,$.y=40}var te=this.closeBut=new e.Button(90,90,"X","#222","#444",null,null,null,0);J.addChild(te),te.x=600-te.width-10,te.y=0,te.on("mousedown"!=e.ACTIONEVENT||!window.zns&&"mousedown"!=ACTIONEVENT?"click":"mousedown",function(){z.dispatchEvent("close")});var oe=this.okBut=new e.Button(150,90,"OK","#222","#444",null,null,null,0);J.addChild(oe),oe.x=te.x-oe.width-10,oe.y=0,oe.on("mousedown"!=e.ACTIONEVENT||!window.zns&&"mousedown"!=ACTIONEVENT?"click":"mousedown",de);var ne=this.swatchBacking=new e.Shape;J.addChild(ne),(W=ne.graphics).f("black").r(.5,.5,50,89).f("#666").r(50,.5,50,89).f("white").r(100,.5,49.5,89),ne.x=oe.x-150-10,ne.y=0;var ie=this.swatch=new e.Rectangle(150,90,D);J.addChild(ie),ie.x=ne.x,ie.y=0,ie.on("mousedown"!=e.ACTIONEVENT||!window.zns&&"mousedown"!=ACTIONEVENT?"click":"mousedown",de),ie.cursor="pointer",J.scaleX=J.scaleY=t/600,N+=J.height}else x.cursor="pointer";a||u||(N-=10-i);var re=N+10;this.setBounds(0,0,t,re);var ae,se,le=this.backing=new e.Rectangle(t,re,p);function de(){if(D!=B||w!=y){if(k&&r){var t=[b=v,v=B];for(A=0;A<2;A++){var o=x.graphics;Y=Math.floor(A/n),_=(X=A%n)*(T+i),R=Y*(T+i)+F,E[A]=t[A],o.f(le.color).r(_-1,R-1,T+2,T+2).f(t[A]).r(_,R,T,T)}e.OPTIMIZE||!zns&&OPTIMIZE||!z.stage||z.stage.update()}B=D,y=w,z.dispatchEvent("change")}else z.dispatchEvent("close")}(this.addChildAt(le,0),-1!=d&&c>0&&(le.shadow=new createjs.Shadow(d,8,8,c)),l)&&(le.on("mousedown",function(e){ae=e.stageX-z.x,se=e.stageY-z.y,le.cursor="move"}),le.on("pressmove",function(e){z.x=e.stageX-ae,z.y=e.stageY-se,z.stage&&z.stage.update()}),le.on("pressup",function(e){le.cursor="default",z.stage&&z.stage.update()}));var ce=n*(T+i),ue=I*(T+i);if(r)var he=V*(T+i),fe=H*(T+i);function pe(){z.zimAccessibility&&z.zimAccessibility.changeTitle(z,null,!0)}function me(e){return Math.round(e*Math.pow(10,2))/Math.pow(10,2)}x.on("mousedown"!=e.ACTIONEVENT||!window.zns&&"mousedown"!=ACTIONEVENT?"click":"mousedown",function(){var t=e.hitTestGrid(x,ce,ue,n,I,z.stage.mouseX,z.stage.mouseY,0,0,i,i);zot(t)||(D=o[t],u?(ie.color=D,$.text=String(o[t]).toUpperCase().substr(0,7),e.centerReg($),D!=B&&z.dispatchEvent("set")):de()),r&&(t=null,zot(t=e.hitTestGrid(x,he,fe,V,H,z.stage.mouseX,z.stage.mouseY,0,ue,i,i))||(D=E[t],u?(ie.color=D,$.text=E[t].toUpperCase(),e.centerReg($),D!=B&&z.dispatchEvent("set")):de())),f&&G(o.indexOf(D)),u?z.stage&&z.stage.update():f&&z.stage&&z.stage.update(),pe()}),Object.defineProperty(this,"selectedColor",{get:function(){return D},set:function(t){B=D=t,u&&(ie.color=D,$.text=D,e.centerReg($),z.stage&&z.stage.update()),f&&G(o.indexOf(D)),pe()}}),Object.defineProperty(this,"currentValue",{get:function(){return D},set:function(e){z.selectedColor=e}}),Object.defineProperty(this,"currentValueEvent",{get:function(){return D},set:function(e){e!=z.selectedColor&&(z.selectedColor=e,z.dispatchEvent("change"))}}),Object.defineProperty(this,"selectedIndex",{get:function(){return o.indexOf(D)},set:function(t){B=D=o[t],u&&(ie.color=D,$.text=D,e.centerReg($),z.stage&&z.stage.update()),f&&G(o.indexOf(D)),pe()}}),Object.defineProperty(this,"selectedAlpha",{get:function(){return a?me(K.currentValue):1},set:function(e){a&&(y=K.currentValue=e,ie&&(ie.alpha=y),Q&&(Q.text="Alpha: "+me(K.currentValue)),z.stage&&z.stage.update())}}),Object.defineProperty(this,"colors",{get:function(){return r?o.concat(E):o},set:function(e){zon&&zog("Display - ColorPicker() colors is read only - make a new ColorPicker to change")}}),this.keyDownEvent=function(e){if(z.focus||!z.zimAccessibility&&m){var t=z.selectedIndex;function o(){t<0&&(t=z.colors.length-1),t>z.colors.length-1&&(t=0),z.selectedIndex=t,z.dispatchEvent("change"),z.stage&&z.stage.update()}37==e.keyCode||40==e.keyCode?(t--,o()):38!=e.keyCode&&39!=e.keyCode||(t++,o())}},window.addEventListener("keydown",this.keyDownEvent),this.clone=function(){return z.cloneProps(new e.ColorPicker(t,k?null:o,n,i,r,a,s,l,d,c,u,h,f,p,m))},this.dispose=function(){return window.removeEventListener("keydown",z.keyDownEvent),K.dispose(),x.removeAllEventListeners(),le.removeAllEventListeners(),te.removeAllEventListeners(),ie.removeAllEventListeners(),oe.removeAllEventListeners(),!0}},e.extend(e.ColorPicker,e.Container,"clone","zimContainer",!1),e.Loader=function(t,o,n,i,r,a,s,l,d,c,u,h,f,p,m,g,z,v,b,y,w,x,C,T,k){var E;if(E=zob(e.Loader,arguments,"width, height, label, color, rollColor, borderColor, borderRollColor, borderWidth, corner, shadowColor, shadowBlur, hitPadding, gradient, gloss, flatBottom, dashed, backing, rollBacking, rollPersist, icon, rollIcon, toggle, rollToggle, toggleEvent, frame",this))return E;if(z_d("67.5"),zot(t)&&(t=250),zot(o)&&(o=70),zot(i)&&(i="rgba(0,0,0,.05)"),zot(r)&&(r="rgba(0,0,0,.1)"),zot(a)&&(a="rgba(0,0,0,.3)"),zot(l)&&(l=1),zot(g)&&(g=!0),zot(d)&&(d=0),zot(n)&&(n=new e.Label({text:"UPLOAD PIC",color:"rgba(0,0,0,.4)",valign:"center",align:"center"})),zot(k)){if(!zimDefaultFrame)return void(zon&&zog("zim.Loader - please provide a reference to zim Frame"));k=zimDefaultFrame}this.zimButton_constructor(t,o,n,i,r,a,s,l,d,c,u,h,f,p,m,g,z,v,b,y,w,x,C,T),this.type="Loader";var M=this,j=k.stage;n=M.label;var S=M.tag=document.createElement("input");document.body.appendChild(S),S.setAttribute("type","file"),S.setAttribute("multiple","multiple"),S.setAttribute("aria-hidden",!0),S.hidden=!0,S.style.cssText="border:thin solid grey; z-index:2; width:"+t+"px; height:"+o+"px; overflow:hidden; outline:none;position:absolute; left:0px; top:0px; display:none; cursor:pointer; opacity: 0; filter: alpha(opacity=0);",this.addEventListener("mousedown",function(){S.click()}),S.addEventListener("change",P);var A=new createjs.DOMElement(S);function P(t){var o;o=t.dataTransfer&&t.dataTransfer.files&&t.dataTransfer.files.length>0?t.dataTransfer.files:t.target.files;for(var n,i,r,a=[],s=0;s<o.length;s++)i=o[s],r=void 0,(r=new FileReader).onload=function(t){var i=new Image;i.onload=function(){var t=new e.Bitmap(i);if(a.push(t),1==a.length&&(n=t),a.length==o.length){var r=new createjs.Event("loaded");r.bitmaps=a,r.bitmap=n,r.lastBitmap=t,r.total=a.length,M.dispatchEvent(r),S.value=""}},i.src=t.target.result},r.readAsDataURL(i)}j.addChild(A),A.alpha=0,this.resize=function(){return M.stage?(S.setAttribute("aria-hidden",!1),S.hidden=!1,S.style.display="block",setTimeout(function(){var t=M.localToGlobal(0,0);A.x=k.x+t.x*k.scale,A.y=k.y+t.y*k.scale,e.sca(A,k.scale*M.scaleX,k.scale*M.scaleY),j.update()},50),M):(S.setAttribute("aria-hidden",!0),S.hidden=!0,void(S.style.display="none"))},this.resize(),M.on("added",function(){S.style.display="block",S.hidden=!1,S.style.display="block",M.resize()}),M.added(function e(){M.resize();setTimeout(function(){S.style.display="block",S.hidden=!1,S.style.display="block"},50);M.on("added",e,null,!0)}),M.on("removed",function(){S.style.display="none",S.hidden=!0,S.style.display="none"}),k.on("resize",M.resize),(new XMLHttpRequest).upload&&S.addEventListener("drop",function(e){S.removeEventListener("change",P),P(e),setInterval(function(){S.addEventListener("change",P)},100)}),this.save=function(t,o,n,i,r,a,s,l,d){var c;if(c=zob(M.save,arguments,"content, filename, x, y, width, height, cached, cachedBounds, type"))return c;if(zot(t)&&(t=k.stage),zot(d)&&(d="png"),zot(o))o="saved_"+String(e.makeID("numbers",5))+"."+d;else{var u=o.split(".");if(1==u.length)o+="."+d;else{var h=["png","jpg","jpeg"],f=h.indexOf(u[u.length-1].toLowerCase());-1==f?o+="."+d:d=h[f]}}if(zot(n)&&(n=0),zot(i)&&(i=0),zot(r)&&(r=t.getBounds&&t.getBounds()?t.getBounds().width:k.width),zot(a)&&(a=t.getBounds&&t.getBounds()?t.getBounds().height:k.height),t.cache(n,i,r,a),/Edge\/(\d)+/.test(navigator.userAgent)||"ios"==e.mobile()){var p=window.open();p.document.write("<html><head><title>saved</title></head><body style='margin:0px;padding:0px;overflow:hidden'><img src="+t.cacheCanvas.toDataURL("image/"+d)+"></body></html>"),p.document.close()}else{var m=document.createElement("a");m.setAttribute("download",o),m.setAttribute("href",t.cacheCanvas.toDataURL("image/"+d)),m.setAttribute("target","_blank"),document.body.appendChild(m),m.click(),document.body.removeChild(m)}return s?l&&t.cache(cashedBound.x,cashedBound.y,cashedBound.width,cashedBound.height):t.uncache(),M},this.clone=function(){var s=new e.Loader(t,o,zot(n)?null:n.clone(),i,r,a,l,d,c,u,h,f,p,m,zot(z)?null:z.clone(),zot(v)?null:v.clone(),b,zot(y)?null:y.clone(),zot(w)?null:w.clone(),zot(x)?null:"string"==typeof x?x:x.clone(),zot(C)?null:C.clone(),T,g,k);return M.cloneProps(s)},this.dispose=function(){return M.zimButton_dispose(),M.removeAllEventListeners(),M.removeChild(A),document.body.removeChild(S),!0}},e.extend(e.Loader,e.Button,["clone","dispose"],"zimButton",!1),e.TextArea=function(t,o,n,i,r,a,s,l,d,c,u,h,f,p,m,g,z){var v;if(v=zob(e.TextArea,arguments,"width, height, size, padding, color, backingColor, borderColor, borderWidth, corner, shadowColor, shadowBlur, dashed, id, placeholder, readOnly, spellCheck, frame",this))return v;if(z_d("67.6"),zot(t)&&(t=250),zot(o)&&(o=70),zot(n)&&(n=20),zot(i)&&(i=5),zot(r)&&(r="#666"),zot(a)&&(a="rgba(256,256,256,.1)"),zot(s)&&(s="rgba(0,0,0,.1)"),zot(d)&&(d=0),!zot(u)&&zot(c)&&(c="rgba(0,0,0,.3)"),!zot(c)&&zot(u)&&(u=10),zot(z)){if(!zimDefaultFrame)return void(zon&&zog("zim.TextArea - please provide a reference to zim Frame"));z=zimDefaultFrame}this.zimContainer_constructor(t,o),this.type="TextArea";var b=this,y=z.stage,w=this.backing=new e.Rectangle(t,o,a,s,l,d,null,h);-1!=c&&u>0&&(w.shadow=new createjs.Shadow(c,3,3,u)),b.addChild(w);var x=b.tag=document.createElement("textarea");document.body.appendChild(x),zot(f)||(x.setAttribute("id",f),x.setAttribute("name",f)),m&&(x.readonly=!0),g||(x.spellcheck=!1),zot(p)||x.setAttribute("placeholder",p),x.style.cssText="background-color:rgba(0,0,0,.01); color:"+r+"; resize:none; z-index:3; width:"+(t-2*i)+"px; height:"+(o-2*i)+"px; overflow:hidden; outline:none;font-size:"+n+"px; font-family:verdana; border:none; position:absolute; left:0px; top:0px; display:none;",x.addEventListener("change",function(){b.dispatchEvent("change")}),x.addEventListener("input",function(){b.dispatchEvent("input")}),x.addEventListener("focus",function(){z.zil&&window.removeEventListener("keydown",z.zil[0]),b.dispatchEvent("focus")}),x.addEventListener("blur",function(){z.zil&&window.addEventListener("keydown",z.zil[0]),b.dispatchEvent("blur")});var C=new createjs.DOMElement(x);C.alpha=0,this.on("mousedown",function(){setTimeout(function(){x.focus()},100)}),this.setFocus=function(e){return zot(e)&&(e=!0),e?x.focus():x.blur(),b},this.resize=function(){return setTimeout(function(){var t=b.localToGlobal(i,i);C.x=z.x+t.x*z.scale,C.y=z.y+t.y*z.scale,e.sca(C,z.scale*b.scaleX,z.scale*b.scaleY),C.alpha=1,b.stage&&y.update()},50),b},this.resize(),b.added(function e(){y.addChild(C);setTimeout(function(){x.style.display="block"},50);b.resize();b.on("added",e,null,!0)}),b.on("removed",function(){y.removeChild(C),x.style.display="none"}),z.on("resize",b.resize),Object.defineProperty(this,"currentValue",{get:function(){return x.value},set:function(e){x.value=e}}),Object.defineProperty(this,"text",{get:function(){return x.value},set:function(e){x.value=e}}),Object.defineProperty(this,"focus",{get:function(){return document.activeElement==x},set:function(e){b.setFocus(e)}}),Object.defineProperty(this,"readOnly",{get:function(){return x.readOnly},set:function(e){x.readOnly=e}}),this.clone=function(){var v=new e.Loader(t,o,n,i,r,a,s,l,d,c,u,h,f,p,m,g,z);return b.cloneProps(v)},this.dispose=function(){return b.removeAllEventListeners(),b.removeChild(C),document.body.removeChild(x),!0}},e.extend(e.TextArea,e.Container,["clone","dispose"],"zimContainer",!1),e.drag=function(t,o,n,i,r,a,s,l,d,c,u,h,f,p,m){var g;if(g=zob(e.drag,arguments,"obj, rect, overCursor, dragCursor, currentTarget, swipe, localBounds, onTop, surround, slide, slideDamp, slideSnap, reg, removeTweens, startBounds"))return g;if(z_d("31"),!zot(t)&&t.on){t.zimDown&&t.noDrag(),t.cursor=zot(n)?"pointer":n,zot(r)&&(r=!1),zot(a)&&(a=!1),zot(s)&&(s=!1),zot(l)&&(l=!0),zot(d)&&(d=!1),zot(c)&&(c=!1),zot(u)&&(u=.3),zot(h)&&(h=!0);!0!==h&&["horizontal","vertical","auto"].indexOf(h)<0&&(h=!1),zot(f)&&(f=!1),zot(p)&&(p=!0),zot(m)&&(m=!0),e.setSwipe(t,a),t.zimDragRect=o,t.zimLocalBounds=s;var z,v,b,y,w,x,C=!1;if(t.zimAdded=t.on("added",Y,null,!0),t.zimRemoved=t.on("removed",function(){t.zimDragTicker&&e.Ticker.remove(t.zimDragTicker)},null,!0),t.parent&&Y(),c)var T=new e.Damp(t.x,u),k=new e.Damp(t.y,u),E=3,M=0,j=[],S=[],A=t.x,P=t.y,O=t.x,I=t.y,D=t.x,B=t.y,L=-1e4,X=-1e4;return t.pointers={},t.zimDown=t.on("mousedown",function(o){if(t.stage){var n="id"+Math.abs(o.pointerID+1);if(t.pointers[n]=!0,x=r?o.currentTarget:o.target,!t.zimDragRect||x.getBounds()){C=!0,t.stage.mouseMoveOutside=!0,c||(t.zimDragTicker&&e.Ticker.remove(t.zimDragTicker),t.zimDragTicker=e.Ticker.add(function(){},t.stage)),p&&createjs.Tween.removeTweens(x),l&&x.parent.setChildIndex(x,x.parent.numChildren-1);var a=x.parent.globalToLocal(o.stageX,o.stageY);f&&(x.x=a.x,x.y=a.y),z=a.x-x.x,v=a.y-x.y,t.zimDragRect&&(s?(y=e.boundsToGlobal(x.parent,t.zimDragRect),d&&(w=t.zimDragRect)):(y=t.zimDragRect,d&&(w=e.boundsToGlobal(x.parent,t.zimDragRect,!0)))),t.cursor=zot(i)?"pointer":i,c&&(M=0,j=[a.x],S=[a.y],L=-1e4,X=-1e4,t.zimDragMoving=!0)}else zog("zim.drag() - drag object needs bounds set")}},!0),t.zimMove=t.on("pressmove",function(e){C&&_(x,e.stageX,e.stageY)},!0),t.zimPosition=_,t.zimUp=t.on("pressup",function(o){var i="id"+Math.abs(o.pointerID+1);if(delete t.pointers[i],C){if(t.cursor=zot(n)?"pointer":n,c){var r=x.parent.globalToLocal(o.stageX,o.stageY);C=!1,A=r.x,P=r.y,O=x.x,I=x.y,T.immediate(x.x),k.immediate(x.y)}else{var a=0;for(var s in t.pointers)a++;0==a&&e.Ticker.remove(t.zimDragTicker)}t.stage&&t.stage.update()}},!0),t}function Y(){z=0,v=0,t.zimDragRect&&(s?(y=e.boundsToGlobal(t.parent,t.zimDragRect),d&&(w=t.zimDragRect)):(y=t.zimDragRect,d&&(w=e.boundsToGlobal(t.parent,t.zimDragRect,!0)))),y&&m&&(b=t.parent.localToGlobal(t.x,t.y),_(t,b.x,b.y)),c&&(t.zimDragMoving=!0,function(){var o=t.stage;function n(e,o,n,i,r){Math.abs(e.x-L)<.1&&Math.abs(e.y-X)<.1?(t.zimDragMoving=!1,e.x=i,e.y=r,e.dispatchEvent("slidestop")):(L=o,X=n)}t.zimDragTicker=function(){if(x||(x=t),C){var e=x.parent.globalToLocal(o.mouseX,o.mouseY);M++,j.push(e.x),S.push(e.y),M>=E?(D=j.shift(),B=S.shift()):(D=j[0],B=S[0])}else{if(!t.zimDragMoving)return;var i=O+A-D,r=I+P-B;if(y){var a=R(x,i,r);i=a.x,r=a.y}if(h)x.x=T.convert(i),x.y=k.convert(r),n(x,x.x,x.y,i,r);else{var a=R(x,T.convert(i),k.convert(r));x.x=a.x,x.y=a.y,n(x,x.x,x.y,x.x,x.y)}}},e.Ticker.add(t.zimDragTicker,o)}()),zot(t.zimMaskDynamic)||t.zimMaskApply()}function _(o,n,i){if(zot(o)&&(o=x||t),o.parent&&o.stage){if(zot(n)||zot(i)){var r=o.parent.localToGlobal(o.x,o.y);z=v=0,t.zimDragRect&&(s?(y=e.boundsToGlobal(o.parent,t.zimDragRect),d&&(w=o.zimDragRect)):(y=t.zimDragRect,d&&(w=e.boundsToGlobal(o.parent,t.zimDragRect,!0)))),n=r.x,i=r.y,c&&(O=o.x,I=o.y,x=o,T.immediate(O),k.immediate(I))}var a,l=o.parent.globalToLocal(n,i);c&&h?"vertical"==h?(a=R(o,l.x-z,l.y-v),o.x=a.x,o.y=l.y-v):"horizontal"==h?(a=R(o,l.x-z,l.y-v),o.x=l.x-z,o.y=a.y):(o.x=l.x-z,o.y=l.y-v):(a=R(o,l.x-z,l.y-v),o.x=a.x,o.y=a.y)}}function R(e,t,o){if(y)if(d){var n=e.getBounds().width,i=e.getBounds().height,r=e.getBounds().x,a=e.getBounds().y;n<w.width?t=w.x+(w.width-n)/2+(e.regX-r):(t-(e.regX-r)>w.x&&(t=w.x+(e.regX-r)),t-(e.regX-r)+n<w.x+w.width&&(t=w.x+w.width+(e.regX-r)-n)),e.height<w.height?o=w.y+(w.height-i)/2+(e.regY-a):(o-(e.regY-a)>w.y&&(o=w.y+(e.regY-a)),o-(e.regY-a)+i<w.y+w.height&&(o=w.y+w.height+(e.regY-a)-i))}else{var s=e.parent.localToGlobal(t,o);t=Math.max(y.x,Math.min(y.x+y.width,s.x)),o=Math.max(y.y,Math.min(y.y+y.height,s.y)),t=(s=e.parent.globalToLocal(t,o)).x,o=s.y}return{x:t,y:o}}},e.noDrag=function(t){if(z_d("32"),!zot(t)&&t.on)return t.cursor="default",e.setSwipe(t,!0),t.off("added",t.zimAdded),t.off("removed",t.zimRemoved),t.off("mousedown",t.zimDown),t.off("pressmove",t.zimMove),t.off("pressup",t.zimUp),e.Ticker&&t.zimDragSlide&&e.Ticker.remove(t.zimDragSlide),t.zimDragMoving=t.zimAdded=t.zimRemoved=t.zimDown=t.zimMove=t.zimUp=t.zimDragRect=t.zimDragSlide=null,t},e.dragRect=function(e,t){if(z_d("33"),!zot(e)&&e.on&&!zot(t))return e.zimDragRect=t,e.zimDragMoving=!0,e.zimPosition&&e.zimPosition(),e},e.transform=function(t,o,n,i,r,a,s,l,d,c,u,h,f,p,m,g,z,v,b,y,w,x,C){var T;if(T=zob(e.transform,arguments,"obj, move, stretchX, stretchY, scale, rotate, toggle, visible, onTop, showStretch, showRotate, showScale, showReg, showBorder, borderColor, borderWidth, dashed, customCursors, handleSize, regSize, snapDistance, snapRotation, cache"))return T;if(z_d("33.5"),zot(t)||!t.getBounds)return zog("zim methods - transform(): please provide object with bounds set"),t;if(!t.getBounds())return zog("zim methods - transform(): please setBounds() on object"),t;if(!t.parent)return zog("zim methods - transform(): object should be on stage first"),t;zot(o)&&(o=!0),zot(n)&&(n=!0),zot(i)&&(i=!0),zot(r)&&(r=!0),zot(a)&&(a=!0);var k,E=e.mobile();if(zot(s)&&(s=!0),zot(l)&&(l=!0),zot(d)&&(d=!0),zot(c)&&(c=!!E),zot(u)&&(u=!!E),zot(h)&&(h=!0),zot(f)&&(f=!0),zot(p)&&(p=!0),zot(m)&&(m="brown"),zot(g)&&(g=1),zot(v)&&(v=!E),zot(b)&&(b=e.mobile()?20:10),zot(y)&&(y=16),zot(w)&&(w=10),zot(x)&&(x=5),zot(C)&&(C=!0),t.mouseChildren=!1,t.stage)k=t.stage;else{if(!zimDefaultFrame)return t;k=zimDefaultFrame.stage}if(!frame){if(!zimDefaultFrame)return t;frame=zimDefaultFrame}var M=t.getBounds(),j=new e.Shape,S=new e.Shape;S.controlType="reg";var A,P,O,I,D,B,L,X,Y,_,R,W,N=t.parent,F=j.graphics,V=S.graphics,H=new e.Container,G=new e.Container,U=new e.Container,Z=new e.Container,q=new e.Container;if(zot(t.zimMaskDynamic)||t.zimMaskApply(),v){var K=new Container,Q=new Container;function J(e){e==K&&new Triangle(16,12,12,"white").addTo(e).mov(0,-13.5),new Triangle(16,12,12,"white").addTo(e).mov(13.5).rot(90),e==K&&new Triangle(16,12,12,"white").addTo(e).mov(0,13.5).rot(180),new Triangle(16,12,12,"white").addTo(e).mov(-13.5).rot(-90),e==K&&new Triangle(10,7,7,"black").addTo(e).mov(0,-13),new Triangle(10,7,7,"black").addTo(e).mov(13).rot(90),e==K&&new Triangle(10,7,7,"black").addTo(e).mov(0,13).rot(180),new Triangle(10,7,7,"black").addTo(e).mov(-13).rot(-90),C&&e.cache(-20,-20,40,40)}J(K),J(Q);var $={"nw-resize":45,"ne-resize":-45,"n-resize":90,"e-resize":0}}function ee(){var e=t;for(X=0,Y=1,_=1,R=0,W=0;e.parent;)X+=e.rotation,Y*=e.scaleX,_*=e.scaleY,R+=e.skewX,W+=e.skewY,e=e.parent}ee();for(var te=["nw-resize","ne-resize","nw-resize","ne-resize"],oe=[2,3,0,1],ne=0;ne<4;ne++){var ie=new e.Rectangle(b,b,h?"#e472c4":"rgba(0,0,0,0)",h?"#333":"rgba(0,0,0,0)",2);C&&ie.cache(-1,-1,b+2,b+2),ie.centerReg(G),ie.expand (0),ie.rotation=X,B=v?"none":te[ne],ie.drag({overCursor:B,dragCursor:B,onTop:!1}),ie.controlType="corner",ie.cu=te[ne]}for(ne=0;ne<oe.length;ne++)G.getChildAt(ne).op=G.getChildAt(oe[ne]);var re=["n-resize","e-resize","n-resize","e-resize"];oe=[1,1,0,0];for(ne=0;ne<4;ne++){var ae=ne%2==0?t.width/2:b,se=ne%2==0?b:t.height/2;if(c){ie=new e.Rectangle(b,b,"#AAA","#333",2);C&&ie.cache(-1,-1,b+2,b+2)}else ie=new e.Rectangle(ae,se,"rgba(0,0,0,0)");ie.centerReg(ne%2==0?Z:U),ie.rotation=X,ie.expand (0),B=v?"none":re[ne],ie.drag({overCursor:B,dragCursor:B,onTop:!1}),ie.controlType="side",ie.cu=re[ne]}for(ne=0;ne<oe.length;ne++){var le=ne%2==0?Z:U;le.getChildAt(Math.floor(ne/2)).op=le.getChildAt(oe[ne])}var de=["ne-resize","nw-resize","ne-resize","nw-resize"];for(ne=0;ne<4;ne++){(ie=new e.Circle(b,u?"#e472c4":"rgba(0,0,0,0)")).addTo(q),C&&ie.cache(-b,-b,2*b,2*b),ie.expand (0),B=v?"none":de[ne],ie.drag({overCursor:B,dragCursor:B,onTop:!1}),ie.controlType="rotate",ie.cu=de[ne]}var ce=1.8;function ue(){var t=b*ce*e.sign(Y),o=b*ce*e.sign(_);q.getChildAt(0).reg(t,o),q.getChildAt(1).reg(-t,o),q.getChildAt(2).reg(-t,-o),q.getChildAt(3).reg(t,-o),k.update()}function he(){F.c(),V.c(),A=t.localToGlobal(M.x,M.y),P=t.localToGlobal(M.x+M.width,M.y),O=t.localToGlobal(M.x+M.width,M.y+M.height),I=t.localToGlobal(M.x,M.y+M.height),pTM=t.localToGlobal(M.x+M.width/2,M.y),pRM=t.localToGlobal(M.x+M.width,M.y+M.height/2),pBM=t.localToGlobal(M.x+M.width/2,M.y+M.height),pLM=t.localToGlobal(M.x,M.y+M.height/2),D=t.localToGlobal(t.regX,t.regY),pMid=t.localToGlobal(M.x+M.width/2,M.y+M.height/2),L=[A,P,O,I],mids=[pTM,pRM,pBM,pLM],p&&(F.s(m),z&&F.sd([10,5],0),F.ss(g).mt(A.x,A.y).lt(P.x,P.y).lt(O.x,O.y).lt(I.x,I.y).lt(A.x,A.y).cp()),j.setBounds(A.x,A.y,P.x-A.x,I.y-A.y),f&&(V.s("#eee").ss(g).f("rgba(0,0,0,.1)").dc(0,0,y),V.s("#222").ss(g).dc(0,0,.3*y)),ee();for(var o=Math.min(50,Math.abs(R))*e.sign(R),n=Math.min(50,Math.abs(W))*e.sign(W),i=X*e.sign(Y*_)*e.sign(t.scaleX*t.scaleY),r=0;r<L.length;r++){var a=L[r];G.getChildAt(r).pos(a.x,a.y).ske(o,n).rot(i),q.getChildAt(r).pos(a.x,a.y).rot(i);var s=mids[r],l=r%2==0?Z:U;l.getChildAt(Math.floor(r/2)).pos(s.x,s.y).ske(o,n).rot(i),c||l.getChildAt(Math.floor(r/2)).sca(r%2==0?Y/2:1,r%2==0?1:_/2)}S.pos(D.x,D.y)}q.alpha=.5,ue(),he();var fe=new e.Shape(1e3,1e3);function pe(){fe.pos(0,0),fe.graphics.c().f("rgba(0,0,0,.01)").mt(A.x,A.y).lt(P.x,P.y).lt(O.x,O.y).lt(I.x,I.y).lt(A.x,A.y).cp(),fe.reg(D.x,D.y),fe.pos(D.x,D.y)}pe(),H.on("dblclick",function(e){frame.ctrlKey&&t.transformControls.visible&&(t.scaleX=1,t.scaleY=1,t.rotation=0,v&&K.rot(t.rotation),he(),pe(),k.update()),Re(e,!0)});var me=H.on("mousedown",ze),ge=t.on("mousedown",ze);function ze(){t.hitTestPoint(k.mouseX,k.mouseY)?t.transformControls.visible||(v?(Ve=!1,fe.mouseEnabled=!1):frame.canvas.style.cursor="move",t.transformControls.show(),t.dispatchEvent("transformshow")):t.transformControls.visible&&!H.hitTestPoint(k.mouseX,k.mouseY)&&(t.transformControls.hide(),t.dispatchEvent("transformhide"))}var ve,be,ye,we,xe,Ce,Te,ke,Ee,Me,je,Se=k.on("stagemousedown",function(){t.transformControls.visible&&!H.hitTestPoint(k.mouseX,k.mouseY)&&(t.transformControls.hide(),t.dispatchEvent("transformhide"))});s||(H.off("mousedown",me),t.off("mousedown",ge),k.off("stagemousedown",Se));var Ae,Pe,Oe,Ie=!1,De=!1,Be=t.cursor,Le=new Circle(30,"rgba(0,0,0,0)").expand (20);if(v){Le.mouseEnabled=!1,Le.mouseChildren=!1,Le.addChild(Q),G.on("mouseover",We),G.on("mouseout",Ne),U.on("mouseover",We),U.on("mouseout",Ne),Z.on("mouseover",We),Z.on("mouseout",Ne),q.on("mouseover",We),q.on("mouseout",Ne);var Xe=new Circle(30,"rgba(0,0,0,0)").expand (20);Xe.cursor="none"}function Ye(o){if(De=!0,d&&(t.parent.setChildIndex(t,t.parent.numChildren-1),k.addChild(H)),Ae&&k.off("stagemousemove",Ae),ve=o.target.x,be=o.target.y,ke=t.x,Ee=t.y,startSX=t.scaleX,startSY=t.scaleY,"rotate"==o.target.controlType){Ie=!0,ye=t.rotation;var n=k.mouseX,i=k.mouseY,r=N.localToGlobal(ke,Ee);Me=r.x,je=r.y,we=180*Math.atan2(i-je,n-Me)/Math.PI}frame.ctrlKey||"rotate"==o.target.controlType?(xe=Math.abs(ve-t.x),Ce=Math.abs(be-t.y)):(xe=Math.abs(ve-o.target.op.x),Ce=Math.abs(be-o.target.op.y)),"rotate"!=o.target.controlType&&(Te={x:o.target.op.x,y:o.target.op.y}),Le.addTo(k).pos(k.mouseX,k.mouseY),Le.cursor=v?"none":o.target.cu,v&&(Q.rotation=t.rotation*e.sign(Y*_)*e.sign(t.scaleX*t.scaleY)+$[o.target.cu],"side"!=o.target.controlType&&Y*_<0&&(Q.rotation+=90),Xe.addTo(k,1).pos(k.mouseX,k.mouseY)),fe.visible=!1,t.cursor="none"}function _e(o){var n;if(n=frame.ctrlKey&&"corner"==o.target.controlType?xe>Ce?(o.target.x-ke)/(ve-ke):(o.target.y-Ee)/(be-Ee):xe>Ce?(o.target.x-o.target.op.x)/(ve-o.target.op.x):(o.target.y-o.target.op.y)/(be-o.target.op.y),"corner"==o.target.controlType?(t.scaleX=n*startSX,t.scaleY=n*startSY):(t.scaleX="e-resize"==o.target.cu?n*startSX:startSX,t.scaleY="n-resize"==o.target.cu?n*startSY:startSY),he(),Le.pos(k.mouseX,k.mouseY),v&&Xe.pos(k.mouseX,k.mouseY),!frame.ctrlKey||"side"==o.target.controlType){var i=o.target.op.x,r=o.target.op.y;t.x-=(i-Te.x)*e.sign(Y)*e.sign(t.scaleX),t.y-=(r-Te.y)*e.sign(_)*e.sign(t.scaleY)}he()}function Re(e,o){ue();var n=e?e.target.controlType:"move";o&&(n="reset"),v&&Xe.removeFrom(k);var i=!1;Oe=null,"move"==n?(t.x==He.x&&t.y==He.y||((Oe=new createjs.Event("transformed")).transformType="move"),i=fe.hitTestPoint(k.mouseX,k.mouseY)):"corner"==n?(t.scaleX==He.scaleX&&t.scaleY==He.scaleY||((Oe=new createjs.Event("transformed")).transformType="size"),i=G.hitTestPoint(k.mouseX,k.mouseY)):"side"==n?(t.scaleX==He.scaleX&&t.scaleY==He.scaleY||((Oe=new createjs.Event("transformed")).transformType="stretch"),i=U.hitTestPoint(k.mouseX,k.mouseY)||Z.hitTestPoint(k.mouseX,k.mouseY)):"rotate"==n?(t.rotation!=He.rotation&&((Oe=new createjs.Event("transformed")).transformType="rotate"),i=q.hitTestPoint(k.mouseX,k.mouseY)):"reg"==n?t.regX==He.regX&&t.regY==He.regY||((Oe=new createjs.Event("transformed")).transformType="reg"):(Oe=new createjs.Event("transformed")).transformType="reset"==n?"reset":"unknown",i||(Le.removeFrom(k),frame.canvas.style.cursor="default",t.cursor=Be),k.update(),Oe&&t.dispatchEvent(Oe)}function We(o){De||(Le.addTo(k),Xe.addTo(k,1),Le.pos(k.mouseX,k.mouseY),Xe.pos(k.mouseX,k.mouseY),Q.rotation=t.rotation*e.sign(Y*_)*e.sign(t.scaleX*t.scaleY)+$[o.target.cu],"side"!=o.target.controlType&&Y*_<0&&(Q.rotation+=90),k.update(),Ae&&k.off("stagemousemove",Ae),Ae=k.on("stagemousemove",function(e){Le.pos(k.mouseX,k.mouseY),k.update()}))}function Ne(e){k.off("stagemousemove",Ae),De||(t.cursor=Be,Le.removeFrom(k),Xe.removeFrom(k),k.update())}function Fe(){d&&(t.parent.setChildIndex(t,t.parent.numChildren-1),k.addChild(H))}G.on("mousedown",Ye),G.on("pressmove",_e),G.on("pressup",Re),U.on("mousedown",Ye),U.on("pressmove",_e),U.on("pressup",Re),Z.on("mousedown",Ye),Z.on("pressmove",_e),Z.on("pressup",Re),q.on("mousedown",Ye),q.on("pressmove",function(o){var n=180*Math.atan2(k.mouseY-je,k.mouseX-Me)/Math.PI;frame.shiftKey?t.rot(45*Math.round((ye+(n-we)*e.sign(Y)*e.sign(t.scaleX))/45)):t.rot(ye+(n-we)*e.sign(Y)*e.sign(t.scaleX));he(),Le.pos(k.mouseX,k.mouseY),v&&(Q.rotation=t.rotation*e.sign(Y*_)*e.sign(t.scaleX*t.scaleY)+$[o.target.cu],"side"!=o.target.controlType&&Y*_<0&&(Q.rotation+=90),Xe.pos(k.mouseX,k.mouseY));he()}),q.on("pressup",Re),S.drag(),S.on("mousedown",Fe),S.on("pressup",function(o){if(!frame.ctrlKey){for(var n=0;n<L.length;n++)if(e.dist(S.x,S.y,L[n].x,L[n].y)<w){S.x=L[n].x,S.y=L[n].y;break}e.dist(S.x,S.y,pMid.x,pMid.y)<w&&(S.x=pMid.x,S.y=pMid.y)}var i=t.rotation,r=t.globalToLocal(S.x,S.y),a=N.globalToLocal(S.x,S.y);t.reg(r.x,r.y),t.rotation=0,t.pos(t.x+a.x-t.x,t.y+a.y-t.y),t.rotation=i,he(),pe(),Re(o),k.update()});var Ve=!0;B=v?"none":"move",fe.drag({overCursor:B,dragCursor:B,onTop:!1}),fe.controlType="move",v&&(fe.on("mouseover",function(o){if(De||!v||!Ve)return;K.addTo(H).rot(t.rotation*e.sign(Y*_)*e.sign(t.scaleX*t.scaleY)).pos(k.mouseX,k.mouseY),k.update(),Pe&&k.off("stagemousemove",Pe);Pe=k.on("stagemousemove",function(e){K.pos(k.mouseX,k.mouseY),k.update()})}),fe.on("mouseout",function(){if(k.off("stagemousemove",Pe),De)return;K.removeFrom(H),k.update()})),fe.on("mousedown",Fe),fe.on("pressmove",function(){var e=N.globalToLocal(fe.x,fe.y);t.x=e.x,t.y=e.y,he()}),fe.on("pressup",Re);var He,Ge=k.on("stagemouseup",function(){De=!1,fe.mouseEnabled=!0,Ve||t.x==He.x&&t.y==He.y||((Oe=new createjs.Event("transformed")).transformType="move",t.dispatchEvent(Oe)),Ve=!0,fe.visible=!0,Ie&&!frame.ctrlKey&&x>1&&(t.rotation=Math.round(t.rotation/x)*x,he()),pe(),fe.mouseEnabled=!0,Ie=!1,k.update()});function Ue(){He={x:t.x,y:t.y,rotation:t.rotation,regX:t.regX,regY:t.regY,scaleX:t.scaleX,scaleY:t.scaleY}}Ue();var Ze,qe=t.on("mousedown",Ue);H.on("mousedown",Ue);H.addChild(j),o&&H.addChild(fe),r&&H.addChild(G),n&&H.addChild(U),i&&H.addChild(Z),a&&H.addChild(q),H.addChild(S),o&&(t.drag({overCursor:"pointer",dragCursor:"pointer",onTop:!1,removeTweens:!1}),Ze=t.on("pressmove",function(){he(),pe(),ue()}));var Ke=s;return t.transformControls={visible:l,show:function(){return d&&t.parent.setChildIndex(t,t.parent.numChildren-1),k.addChild(H),t.transformControls.visible=!0,k.update(),t},hide:function(){return k.removeChild(H),t.transformControls.visible=!1,v&&(Ae&&k.off("stagemousemove",Ae),Pe&&k.off("stagemousemove",Pe),De=!1,Le.removeFrom(k),Xe.removeFrom(k)),o||(t.cursor=Be),k.update(),t},remove:function(){t.transformControls.hide(),s=!1,o&&(t.noDrag(),t.off("pressmove",Ze))},add:function(){t.transformControls.show(),s=Ke,o&&(t.drag({overCursor:"pointer",dragCursor:"pointer",onTop:!1,removeTweens:!1}),Ze=t.on("pressmove",Ze))},toggleOn:function(){s=Ke=!0,me=H.on("mousedown",me),ge=t.on("mousedown",ge),Se=k.on("stagemousedown",Se)},toggleOff:function(){s=Ke=!1,H.off("mousedown",me),t.off("mousedown",ge),k.off("stagemousedown",Se)},disable:function(){H.mouseChildren=!1,H.mouseEnabled=!1,o&&(t.noDrag(),t.off("pressmove",Ze))},enable:function(){H.mouseChildren=!0,H.mouseEnabled=!0,o&&(t.drag({overCursor:"pointer",dragCursor:"pointer",onTop:!1,removeTweens:!1}),Ze=t.on("pressmove",Ze))},recordData:function(e){var o={type:t.type,index:N.getChildIndex(t),x:t.x,y:t.y,scaleX:t.scaleX,scaleY:t.scaleY,rotation:t.rotation,skewX:t.skewX,skewY:t.skewY,regX:t.regX,regY:t.regY,controls:t.transformControls.visible};return e?JSON.stringify(o):o},setData:function(e,o){if(!zot(e)){o&&(e=JSON.parse(e));var n=e.controls;delete e.controls;var i=e.index;for(var r in zot(i)&&(i=0),delete e.index,e)t[r]=e[r];return he(),pe(),ue(),N.setChildIndex(t,i),n?t.transformControls.show():t.transformControls.hide(),t}},resize:function(){return N=t.parent,he(),pe(),ue(),l&&t.transformControls.show(),t},dispose:function(){t.transformControls.hide(),s=!1,o&&(zog("here"),t.noDrag(),t.off("pressmove",Ze)),H.removeAllEventListeners(),ge&&t.off("mousedown",ge),me&&t.off("mousedown",me),Se&&k.off("stagemousedown",Se),Ae&&k.off("stagemousemove",Ae),Pe&&k.off("stagemousemove",Pe),Ge&&k.off("stagemouseup",Ge),qe&&t.off("mousedown",qe),Ze&&t.off("pressmove",Ze)},scaleControls:G,stretchXControls:U,stretchYControls:Z,rotateControls:q},l&&t.transformControls.show(),t},e.setSwipe=function(e,t){if(z_d("34"),!zot(e)&&e.on)return e.zimNoSwipe=!t||null,e instanceof createjs.Container&&function t(o){var n=o.numChildren;var i;for(var r=0;r<n;r++)(i=o.getChildAt(r)).zimNoSwipe=e.zimNoSwipe,i instanceof createjs.Container&&t(i)}(e),e},e.gesture=function(t,o,n,i,r,a,s,l,d,c,u,h){var f;if(f=zob(e.gesture,arguments,"obj, move, scale, rotate, rect, minScale, maxScale, snapRotate, localBounds, slide, slideEffect, regControl"))return f;if(z_d("34.5"),!zot(t)&&t.on){var p,m;if(zot(o)&&(o=!0),zot(n)&&(n=!0),zot(i)&&(i=!0),zot(d)&&(d=!1),zot(l)&&(l=1),zot(c)&&(c=!1),zot(u)&&(u=5),zot(h)&&(h=!1),zot(t.zimMaskDynamic)||t.zimMaskApply(),!t.zimTouch){var g,z,v,b,y,w,x,C,T=new e.Damp(t.scaleX,.05),k=new e.Damp(t.scaleY,.05),E=t.scaleX/t.scaleY;if(t.zimTouch={move:o,scale:n,rotate:i,pointers:{},checkBounds:function(e,o){if(t.zimTouch.rect){var n=t.zimTouch.rect,i=t.parent.localToGlobal(e,o);e=Math.max(n.x,Math.min(n.x+n.width,i.x)),o=Math.max(n.y,Math.min(n.y+n.height,i.y)),e=(i=t.parent.globalToLocal(e,o)).x,o=i.y}return{x:e,y:o}}},r){t.zimTouch.rect=r,d&&(t.zimTouch.rect=e.boundsToGlobal(t.parent,r));var M=t.zimTouch.checkBounds(t.x,t.y);t.x=M.x,t.y=M.y}c&&(slideSlice=10,slideTotal=5,m=0,p=[],t.zimTouch.slideInterval=e.interval(slideSlice,function(){p[m++%slideTotal]=[t.x,t.y]}),t.zimTouch.slideInterval.pause(),t.animate({x:t.x,y:t.y},10,"quadOut")),t.zimTouch.mousedown=t.on("mousedown",function(o){zot(C)?C=1:C++,h||(x=null,z=t.scaleX,v=t.scaleY,b=t.rotation,y=t.regX,w=t.regY,t.reg(0,0),g=t.getMatrix(),t.regX=y,t.regY=w);var n="id"+Math.abs(o.pointerID+1),i=t.parent.globalToLocal(o.stageX,o.stageY);t.zimTouch.pointers[n]={startX:i.x,startY:i.y,x:i.x,y:i.y},(t.zimTouch.move||t.zimTouch.rotate)&&(t.zimTouch.total=0,e.loop(t.zimTouch.pointers,function(e){t.zimTouch.total++})),c&&1==t.zimTouch.total&&t.zimTouch.slideInterval.pause(!1),j()}),t.zimTouch.pressmove=t.on("pressmove",function(o){var n="id"+Math.abs(o.pointerID+1),i=t.parent.globalToLocal(o.stageX,o.stageY);t.zimTouch.pointers[n].x=i.x,t.zimTouch.pointers[n].y=i.y;var r,l,d=0,c=0,u=0,f=0;e.loop(t.zimTouch.pointers,function(e,t){d+=t.x-t.startX,c+=t.y-t.startY,u+=t.x,f+=t.y}),r=d/t.zimTouch.total,l=c/t.zimTouch.total,d=t.zimTouch.startX+r,c=t.zimTouch.startY+l,u/=t.zimTouch.total,f/=t.zimTouch.total;var p={x:t.x,y:t.y,scaleX:t.scaleX,scaleY:t.scaleY,rotation:t.rotation};if(t.zimTouch.move){var m=t.zimTouch.checkBounds(d,c);p.x=m.x,p.y=m.y}if(2==t.zimTouch.pair.length){var C=t.zimTouch.pair[0],M=t.zimTouch.pair[1];if(t.zimTouch.scale){var j=Math.sqrt(Math.pow(M.startX-C.startX,2)+Math.pow(M.startY-C.startY,2)),S=Math.sqrt(Math.pow(M.x-C.x,2)+Math.pow(M.y-C.y,2)),A=t.zimTouch.startSX+(S/j-1),P=t.zimTouch.startSY+(S/j-1);p.scaleX=A,p.scaleY=P,p.scaleX=T.convert(A),p.scaleY=k.convert(P);var O=!zot(a)&&Math.min(A,P)<a,I=!zot(s)&&Math.max(A,P)>s;(O||I)&&(O?E>1?(p.scaleY=a,p.scaleX=a*E):(p.scaleX=a,p.scaleY=a/E):I&&(E>1?(p.scaleX=s,p.scaleY=s/E):(p.scaleY=s,p.scaleX=s*E)),T.immediate(p.scaleX),k.immediate(p.scaleY))}if(t.zimTouch.rotate){var D=Math.atan2(C.startY-M.startY,C.startX-M.startX)*(180/Math.PI),B=Math.atan2(C.y-M.y,C.x-M.x)*(180/Math.PI)-D;p.rotation=t.zimTouch.startR+B}if(h)t.scaleX=p.scaleX,t.scaleY=p.scaleY,t.rotation=p.rotation,t.x=p.x,t.y=p.y;else{t.reg(0,0);var L=t.parent.localToGlobal(u,f);u=L.x,f=L.y;var X=zot(x)?t.globalToLocal(u,f):t.globalToLocal(x.x,x.y);g.clone().translate(X.x,X.y).rotate(p.rotation-b).scale(p.scaleX/z,p.scaleY/v).translate(-X.x,-X.y).decompose(t),t.x+=r,t.y+=l,x=t.localToGlobal(X.x,X.y),t.reg(y,w)}t.zimTouch.scale&&t.dispatchEvent("scale"),t.zimTouch.rotate&&t.dispatchEvent("rotate"),t.zimTouch.move&&t.dispatchEvent("move")}else t.x=p.x,t.y=p.y,t.zimTouch.move&&t.dispatchEvent("move");t.getStage&&t.stage&&t.stage.update()});function j(){t.zimTouch.pair=[],e.loop(t.zimTouch.pointers,function(e,o,n){o.startX=o.x,o.startY=o.y,n<=1&&t.zimTouch.pair.push(o)}),t.zimTouch.startX=t.x,t.zimTouch.startY=t.y,t.zimTouch.startSX=t.scaleX,t.zimTouch.startSY=t.scaleY,t.zimTouch.startR=t.rotation}t.on("mousedown",function(){var e=1;t.stage.on("stagemousedown",function(){e++}),t.stage.on("stagemouseup",function(){0==--e&&setTimeout(function(){t.zimTouch&&(t.zimTouch.total=0),t.zimTouch&&(t.zimTouch.pointers={}),C=null},50)})},null,!0),t.zimTouch.pressup=t.on("pressup",function(e){var o="id"+Math.abs(e.pointerID+1);if(delete t.zimTouch.pointers[o],(t.zimTouch.move||t.zimTouch.rotate)&&t.zimTouch.total--,i&&!zot(l)&&0==t.zimTouch.total&&(l>0?t.rotation=Math.round(t.rotation/l)*l:0==l&&(t.rotation=Math.round(t.rotation))),c&&0==t.zimTouch.total&&1==C){t.zimTouch.slideInterval.pause();var n=p[(m+1)%p.length],r=p[m%p.length],a=t.x+(n[0]-r[0])*u,s=t.y+(n[1]-r[1])*u,d=t.zimTouch.checkBounds(a,s),h=slideTotal*slideSlice*u*Math.min((t.x-d.x)/(t.x-a)||1,(t.y-d.y)/(t.y-s)||1);t.animate({x:d.x,y:d.y},h,"quadOut",function(){t.dispatchEvent("slidestop")})}0==t.zimTouch.total&&(C=null),t.getStage&&t.stage&&t.stage.update(),j()})}return t}},e.noGesture=function(t,o,n,i){var r;return(r=zob(e.noGesture,arguments,"obj, move, scale, rotate"))?r:(z_d("34.6"),!zot(t)&&t.on&&t.zimTouch?(zot(o)&&(o=!0),zot(n)&&(n=!0),zot(i)&&(i=!0),t.zimTouch.move=!o,t.zimTouch.scale=!n,t.zimTouch.rotate=!i,t.zimTouch.move||t.zimTouch.scale||t.zimTouch.rotate||(t.off("mousedown",t.zimTouch.mousedown),t.off("pressmove",t.zimTouch.pressmove),t.off("pressup",t.zimTouch.pressup),delete t.zimTouch),t):void 0)},e.gestureRect=function(e,t){if(z_d("34.7"),!zot(e)&&e.on&&!zot(t)&&e.zimTouch){e.zimTouch.rect=t;var o=e.zimTouch.checkBounds(e.x,e.y);return e.x=o.x,e.y=o.y,e}},e.hitTestPoint=function(e,t,o,n){if(z_d("35"),!e.stage)return!1;if(!zot(e)&&e.globalToLocal){zot(n)&&(n=!0);var i=e.globalToLocal(t,o),r=e.getBounds();if(n&&r){if(i.x>r.x+r.width||i.x<r.x)return!1;if(i.y>r.y+r.height||i.y<r.y)return!1}return e.hitTest(i.x,i.y)}},e.hitTestReg=function(e,t,o){if(z_d("36"),!e.stage||!t.stage)return!1;if(!zot(e)&&!zot(t)&&e.localToLocal&&t.localToLocal){zot(o)&&(o=!0);var n=t.localToLocal(t.regX,t.regY,e),i=e.getBounds();if(o&&i){if(n.x>i.x+i.width||n.x<i.x)return!1;if(n.y>i.y+i.height||n.y<i.y)return!1}return e.hitTest(n.x,n.y)}},e.hitTestRect=function(t,o,n,i){if(z_d("37"),!t.stage||!o.stage)return!1;if(!zot(t)&&!zot(o)&&t.hitTest&&o.getBounds){zot(n)&&(n=0),zot(i)&&(i=!0);var r=o.getBounds();if(r){var a=t.getBounds();if(i&&a&&!e.hitTestBounds(t,o))return!1;var s,l,d=r.x+r.width/2,c=r.y+r.height/2,u=o.localToLocal(d,c,t);if(t.hitTest(u.x,u.y))return!0;for(var h=0;h<=n;h++){if(s=r.width*(h+1)/(n+1),l=r.height*(h+1)/(n+1),u=o.localToLocal(r.x+s,r.y,t),t.hitTest(u.x,u.y))return!0;if(u=o.localToLocal(r.x+r.width,r.y+l,t),t.hitTest(u.x,u.y))return!0;if(u=o.localToLocal(r.x+r.width-s,r.y+r.height,t),t.hitTest(u.x,u.y))return!0;if(u=o.localToLocal(r.x,r.y+r.height-l,t),t.hitTest(u.x,u.y))return!0}}else zog("zim methods - hitTestRect():\n please setBounds() on param b object")}},e.hitTestCircle=function(t,o,n,i){if(z_d("38"),t.stage&&o.stage&&!zot(t)&&!zot(o)&&t.hitTest&&o.getBounds){zot(n)&&(n=8),zot(i)&&(i=!0);var r=o.getBounds();if(r){var a=t.getBounds();if(i&&a&&!e.hitTestBounds(t,o))return!1;var s=r.x+r.width/2,l=r.y+r.height/2,d=o.localToLocal(s,l,t);if(t.hitTest(d.x,d.y))return!0;for(var c,u,h,f=(r.width+r.height)/2/2,p=0;p<n;p++)if(c=p/n*2*Math.PI,u=s+f*Math.cos(c),h=l+f*Math.sin(c),d=o.localToLocal(u,h,t),t.hitTest(d.x,d.y))return!0}else zog("zim methods - hitTestCircle():\n please setBounds() on param b object")}},e.hitTestCircles=function(e,t,o){if(z_d("38.5"),e.stage&&t.stage&&!zot(e)&&!zot(t)&&e.hitTest&&e.getBounds&&t.getBounds){var n=e.getBounds(),i=t.getBounds();if(n&&i){zot(o)&&(o=0);var r=e.localToGlobal(n.x+n.width/2,n.y+n.height/2),a=t.localToGlobal(i.x+i.width/2,i.y+i.height/2),s=e.getConcatenatedMatrix(),l=t.getConcatenatedMatrix();scale1X=Math.sqrt(s.a*s.a+s.c*s.c),scale1Y=Math.sqrt(s.b*s.b+s.d*s.d),scale2X=Math.sqrt(l.a*l.a+l.c*l.c),scale2Y=Math.sqrt(l.b*l.b+l.d*l.d);var d=Math.sqrt(Math.abs(Math.pow(r.x-a.x,2)+Math.pow(r.y-a.y,2)));return n.width*Math.max(scale1X,scale1Y)/2+i.width*Math.max(scale2X,scale2Y)/2>=d-o}zog("zim methods - hitTestCircles():\n please setBounds() on both objects")}},e.hitTestBounds=function(t,o,n,i){if(z_d("39"),t.stage&&o.stage&&!zot(t)&&!zot(o)&&t.getBounds&&o.getBounds){var r=!1;i&&i.graphics&&(r=!0);var a=t.getBounds(),s=o.getBounds();if(a&&s){zot(n)&&(n=0);var l,d,c=e.boundsToGlobal(t),u=e.boundsToGlobal(o);if(r){var h=i.graphics;h.c(),h.ss(1).s("blue"),h.r(c.x,c.y,c.width,c.height),h.s("green"),h.r(u.x,u.y,u.width,u.height),i.stage.update()}return d=u,!((l=c).x>=d.x+d.width+n||l.x+l.width+n<=d.x||l.y>=d.y+d.height+n||l.y+l.height+n<=d.y)}zog("zim methods - hitTestBounds():\n please setBounds() on both objects")}},e.boundsToGlobal=function(e,t,o){if(z_d("40"),!zot(e)&&e.getBounds){zot(o)&&(o=!1);var n=e.getBounds();if(n||!zot(t)){if(t&&(n=t),o)var i=e.globalToLocal(n.x,n.y),r=e.globalToLocal(n.x+n.width,n.y),a=e.globalToLocal(n.x+n.width,n.y+n.height),s=e.globalToLocal(n.x,n.y+n.height);else i=e.localToGlobal(n.x,n.y),r=e.localToGlobal(n.x+n.width,n.y),a=e.localToGlobal(n.x+n.width,n.y+n.height),s=e.localToGlobal(n.x,n.y+n.height);var l=Math.min(i.x,r.x,a.x,s.x),d=Math.min(i.y,r.y,a.y,s.y),c=Math.max(i.x,r.x,a.x,s.x),u=Math.max(i.y,r.y,a.y,s.y);return new createjs.Rectangle(l,d,c-l,u-d)}zog("zim methods - boundsToGlobal():\n please setBounds() on object (or a rectangle)")}},e.hitTestGrid=function(e,t,o,n,i,r,a,s,l,d,c,u,h){if(z_d("41"),!e.stage)return!1;if(!zot(e)&&!u){var f=e.globalToLocal(r,a);r=f.x,a=f.y}zot(s)&&(s=0),zot(l)&&(l=0),zot(d)&&(d=0),zot(c)&&(c=0);var p=t/n,m=o/i,g=Math.min(n-1,Math.max(0,Math.floor((r-s)/p))),z=Math.min(i-1,Math.max(0,Math.floor((a-l)/m)));if(!(r-s>p*(g+1)-d||r-s<p*g||a-l>m*(z+1)-c||a-l<m*z)){var v=z*n+g;return zot(h)||"index"==h?v:"col"==h?g:"row"==h?z:"array"==h?[v,g,z]:void 0}},e.animate=function(t,o,n,i,r,a,s,l,d,c,u,h,f,p,m,g,z,v,b,y,w,x,C,T,k,E,M,j,S,A,P,O,I,D,B,L){var X;if(X=zob(e.animate,arguments,"target, obj, time, ease, call, params, wait, waitedCall, waitedParams, loop, loopCount, loopWait, loopCall, loopParams, loopWaitCall, loopWaitParams, rewind, rewindWait, rewindCall, rewindParams, rewindWaitCall, rewindWaitParams, sequence, sequenceCall, sequenceParams, sequenceReverse, ticker, props, css, protect, override, from, set, id, events, sequenceTarget"))return X;if(z_d("45"),0==e.ANIMATE||!window.zns&&!ANIMATE)return t;t=zik(t),n=zik(n),i=zik(i),s=zik(s),u=zik(u),h=zik(h),z=zik(z),v=zik(v),E=zik(E),O=zik(O),I=zik(I);var Y={override:!0};if(zot(c)||(Y.loop=c),zot(u)||(Y.count=u),zot(h)||(Y.loopWait=h),zot(f)||(Y.loopCall=f),zot(g)||(Y.loopWaitParams=g),zot(m)||(Y.loopWaitCall=m),zot(p)||(Y.loopParams=p),zot(z)||(Y.rewind=z),zot(v)||(Y.rewindWait=v),zot(b)||(Y.rewindCall=b),zot(y)||(Y.rewindParams=y),zot(w)||(Y.rewindWaitCall=w),zot(x)||(Y.rewindWaitParams=x),zot(j)||(Y=e.merge(Y,j)),j=Y,zot(C)&&(C=0),C>0&&t.addChild){for(var _=[],R=0;R<t.numChildren;R++)_.push(t.getChildAt(R));L=t,t=_}if(t instanceof Array){E&&t.reverse();var W=0;for(R=0;R<t.length;R++)!function(){var l,d=R;if(O)for(var c in t[d].zimObj={},o)l=zik(o[c]),t[d].zimObj[c]=t[d][c],t[d][c]=l;else for(var c in t[d].zimObj={},o)t[d].zimObj[c]=zik(o[c]);setTimeout(function(){var o=t[W];if(W++,e.animate(o,o.zimObj,n,i,r,a,s,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,M,e.copy(j),S,A,P,null,I,D,B,L),d==t.length-1&&T){var l=n||1e3;j&&j.rewind&&(l+=(n||1e3)+(j.rewindWait?j.rewindWait:0)),j&&j.loop&&j.loopWait&&(l+=j.loopWait),setTimeout(function(){T(k)},l)}},C*R)}();return L}var N,F,V,H=n;if(zot(H)&&(H=1e3),zot(i)&&(i="quadInOut"),zot(s)&&(s=0),zot(j)&&(j={override:!0}),zot(a)&&(a=t),zot(M)&&(M=!0),zot(S)&&(S=!1),zot(A)&&(A=!1),zot(O)&&(O=!1),zot(I)&&(I={}),I.scale&&(I.scaleX=I.scaleY=I.scale,delete I.scale),zot(P)||(j.override=P),o instanceof Array){var G,U=1;if(0==o.length)return this;function Z(){for(var t,n,i=s,r=0,a=0;a<o.length;a++)if(!zot((t=o[a]).target)){zot(t.time)&&(t.time=H),i+=t.wait?t.wait:0,n=t.time,t.rewind&&(n=2*n+(t.rewindWait?t.rewindWait:0)),t.loop&&(n*=t.loopCount,n+=(t.loopCount-1)*(t.loopWait?t.loopWait:0));var l={target:t.target,obj:e.copy(t.obj),wait:r+i,waitedCall:t.waitedCall,waitedParams:t.waitedParams,time:t.time,ease:t.ease,from:t.from,rewind:t.rewind,call:t.call,params:t.params,loop:t.loop,loopCount:t.loopCount,loopWait:t.loopWait,loopCall:t.loopCall,loopParams:t.loopParams,loopWaitCall:t.loopWaitCall,loopWaitParams:t.loopWaitParams,rewind:t.rewind,rewindWait:t.rewindWait,rewindCall:t.rewindCall,rewindParams:t.rewindParams,rewindWaitCall:t.rewindWaitCall,rewindWaitParams:t.rewindWaitParams,set:e.copy(t.masterSet),override:!1,id:D};a==o.length-1&&q(l),e.animate(l),r+=i+n,i=0}}function q(e){j.loop&&(!j.count||U<j.count)?e.call=function(){function e(){for(var e=0;e<G.objects.length;e++)G.objects[e].set&&G.objects[e].set(G.values[e]);j.loopWaitCall&&"function"==typeof j.loopWaitCall&&j.loopWaitCall(j.loopWaitParams),Z()}j.loopCall&&"function"==typeof j.loopCall&&j.loopCall(j.loopParams),j.loopWait?N=t.zimTweens[D]=t.zimTween=createjs.Tween.get(t,{override:j.override}).wait(j.loopWait).call(e):e()}:e.call=function(){r&&"function"==typeof r&&r(a),Te(D)},U++}return function(){var n=new e.Dictionary;G=new e.Dictionary;for(var r=0;r<o.length;r++)if(Q=o[r],t||(t=Q.target),zot(Q.target)&&(Q.target=t),zot(Q.ease)&&(Q.ease=i),!zot(Q.target)){if(Q.loop&&(zot(Q.loopCount)||Q.loopCount<=0)&&(Q.loopCount=0,o.splice(r+1,o.length)),zot(Q.obj.scale)||(Q.obj.scaleX=Q.obj.scaleY=Q.obj.scale,delete Q.obj.scale),Q.from){var a=n.at(Q.target);if(a){if(Q.set){var s=e.copy(Q.obj),l=e.merge(a,Q.set);Q.obj=ve(Q.target,Q.obj,l),Q.set=e.merge(Q.set,s)}else Q.set=e.copy(Q.obj),Q.obj=ve(Q.target,Q.obj,a);Q.from=!1}else n.add(Q.target,ve(Q.target,Q.obj,Q.set))}var d={};for(var c in Q.obj)d[c]=Q.set&&Q.set[c]?Q.set[c]:Q.target[c];zot(G.at(Q.target))&&G.add(Q.target,{});var u=e.merge(G.at(Q.target),d);G.remove(Q.target),G.add(Q.target,u),Q.masterSet=e.copy(Q.set)}zot(t.zimTweens)&&(t.zimTweens={})}(),ze(),Z(),t}if(!zot(t)){var K;if(S&&(M=!1),zot(t.zimTweens)&&(t.zimTweens={}),t.stage)K=t.stage;else if("undefined"!=typeof zimDefaultFrame&&zimDefaultFrame)K=zimDefaultFrame.stage;else if(M)return;for(var Q in zot(o.scale)||(o.scaleX=o.scaleY=zik(o.scale),delete o.scale),o){if(!t.zimBusy)break;t.zimBusy[Q]&&delete o[Q]}if(e.isEmpty(o))return t;var J=t.mouseEnabled;for(var R in(A||j.loop||j.rewind)&&(t.mouseEnabled=!1,setTimeout(function(){for(var e in t.zimBusy||(t.zimBusy={}),o)t.zimBusy[e]=!0;t.mouseEnabled=J},70)),ze(),o)o[R]=zik(o[R]);for(R in I)I[R]=zik(I[R]);for(R in j)"waitedCall"!=R&&"waitedParams"!=R&&"loopCall"!=R&&"rewindCall"!=R&&"loopWaitCall"!=R&&"rewindWaitCall"!=R&&(j[R]=zik(j[R]));for(R in o)"string"==typeof o[R]&&(o[R]=t[R]+Number(o[R].replace(/\s/g,"")));for(R in I)"string"==typeof I[R]&&(I[R]=t[R]+Number(I[R].replace(/\s/g,"")));O&&(o=ve(t,o,I,!0));var $=0;if(j.loop&&!zot(j.count)){$=j.count,delete j.count;U=1}var ee,te=0;j.loopWait&&(te=j.loopWait,delete j.loopWait),j.loopCall&&(ee=j.loopCall,delete j.loopCall);var oe,ne=t;j.loopParams&&(ne=j.loopParams,delete j.loopParams),j.loopWaitCall&&(oe=j.loopWaitCall,delete j.loopWaitCall);var ie,re=t;if(j.loopWaitParams&&(re=j.loopWaitParams,delete j.loopWaitParams),j.rewind){if(i){var ae=i;-1==ae.indexOf("InOut")&&(-1!=ae.indexOf("Out")?ae=ae.replace("Out","In"):-1!=ae.indexOf("In")&&(ae=ae.replace("In","Out")))}var se,le,de=0;if(delete j.rewind,j.rewindWait&&(de=j.rewindWait,delete j.rewindWait),j.rewindCall){se=j.rewindCall;var ce=j.rewindParams;zot(ce)&&(ce=t),delete j.rewindCall,delete j.rewindParams}function ue(){se&&"function"==typeof se&&se(ce)}if(j.rewindWaitCall){le=j.rewindWaitCall;var he=j.rewindWaitParams;zot(he)&&(he=t),delete j.rewindWaitCall,delete j.rewindWaitParams}function fe(){le&&"function"==typeof le&&le(he)}function pe(){var e=xe();t.set&&!O&&t.set(I),N=t.zimTweens[D]=t.zimTween=createjs.Tween.get(t,j).to(o,H,createjs.Ease[i]).call(fe).wait(de).call(ue).to(e,H,createjs.Ease[ae]).call(we).wait(te).call(be),Ce()}s>0?N=t.zimTweens[D]=t.zimTween=createjs.Tween.get(t,{override:j.override}).wait(s).call(function(){l&&"function"==typeof l&&l(zot(d)?t:d),pe()}):pe()}else{function me(){t.set&&!O&&t.set(I),N=t.zimTweens[D]=t.zimTween=createjs.Tween.get(t,j).to(o,H,createjs.Ease[i]).call(we).wait(te).call(be),Ce()}s>0?N=t.zimTweens[D]=t.zimTween=createjs.Tween.get(t,{override:j.override}).wait(s).call(function(){l&&"function"==typeof l&&l(zot(d)?t:d),me()}):me()}!S&&M&&(ie=B&&!zot(L)&&L.dispatchEvent?e.Ticker.add(function(){L.dispatchEvent("animation")},K):B&&t.dispatchEvent?e.Ticker.add(function(){t.dispatchEvent("animation")},K):e.Ticker.add(function(){},K)),zot(t.zimMaskDynamic)||t.zimMaskApply();var ge=!1;return Ce(),t.stopAnimate&&t.stopAnimate.real||(t.stopAnimate=function(o,n){if(zot(n)&&(n=!0),zot(o)){if(!n)return t;for(var i in t.zimBusy=null,createjs.Tween.removeTweens(t),t.zimTweens)ke(i);t.zimTweens=null,t.zimIdSets=null,e.idSets&&e.idSets[F||i]&&(delete e.idSets[F||i],e.isEmpty(e.idSets)&&delete e.idSets),e.animatedObjects.remove(t)}else{Array.isArray(o)||(o=[o]);var r=Me(o);for(var i in t.zimTweens)n&&r.indexOf(i)>=0&&Te(i),!n&&r.indexOf(i)<0&&Te(i)}return t},t.stopAnimate.real=!0,t.pauseAnimate=function(e,o,n){if(zot(e)&&(e=!0),zot(n)&&(n=!0),zot(o)&&!n)return t;if(zot(o))for(var i in t.zimTweens)Ee(i,e);else{Array.isArray(o)||(o=[o]);var r=Me(o);for(var i in t.zimTweens)n&&r.indexOf(i)>=0&&Ee(i,e),!n&&r.indexOf(i)<0&&Ee(i,e)}return t}),t}function ze(){zot(D)?D=e.makeID(10):(D=String(D),V=D),zot(t.zimIdSets)&&(t.zimIdSets={}),zot(t.zimIdSets[D])?zot(t.zimTweens[D])||(F=D,D=e.makeID(10),t.zimIdSets[F]=[F],t.zimTweens[F].zimIdSet=F,t.zimIdSets[F].push(D)):(F=D,D=e.makeID(10),t.zimIdSets[F].push(D))}function ve(e,t,o,n){var i={};for(R in t)o&&!zot(o[R])?i[R]=o[R]:i[R]=e[R],n&&(e[R]=t[R]);return i}function be(){ee&&"function"==typeof ee&&ee(ne)}function ye(){oe&&"function"==typeof oe&&oe(re)}function we(){if(j.loop){if(!($>0))return void ye();if(U<$)return ye(),void U++;z?t.set&&t.set(xe()):t.set&&t.set(o)}Te(D),r&&"function"==typeof r&&r(a)}function xe(){var e={};for(var n in o)S?zot(I[n])||O?e[n]=t.style[n]:e[n]=I[n]:zot(I[n])||O?e[n]=t[n]:e[n]=I[n];return e}function Ce(){N.zimObj=o,N.zimTicker=ie,N.zimPaused=ge,F&&(N.zimIdSet=F),V&&(zot(e.idSets)&&(e.idSets={}),zot(e.idSets[V])?e.idSets[V]=[t]:e.idSets[V].indexOf(t)<0&&e.idSets[V].push(t)),e.animatedObjects||(e.animatedObjects=new e.Dictionary(!0)),e.animatedObjects.add(t,!0)}function Te(o){if(!zot(t.zimTweens)&&!zot(t.zimTweens[o])){!function(o){if(t.zimBusy){for(var n in o)delete t.zimBusy[n];e.isEmpty(t.zimBusy)&&(t.zimBusy=null)}}(t.zimTweens[o].zimObj),t.zimTweens[o].paused=!0,ke(o);var n=t.zimTweens[o].zimIdSet;if(!zot(n)&&t.zimIdSets){var i=t.zimIdSets[n];i&&i.splice(i.indexOf(o),1),i&&0==i.length&&(delete t.zimIdSets[n],e.isEmpty(t.zimIdSets)&&delete t.zimIdSets)}if(delete t.zimTweens[o],e.isEmpty(t.zimTweens)&&t.stopAnimate(),t.zimTweens&&t.zimTweens[o]||t.zimIdSets&&t.zimIdSets[n||o]);else if(e.idSets&&e.idSets[n||o]){e.idSets[n||o];var r=e.idSets[n||o].indexOf(t);r>=0&&e.idSets[n||o].splice(r,1),e.idSets[n||o].length<=0&&(delete e.idSets[n||o],e.isEmpty(e.idSets)&&delete e.idSets)}}}function ke(o){var n;n=t.zimTweens[o].zimTicker,setTimeout(function(){n&&e.Ticker.remove(n),n=null},200)}function Ee(o,n){var i=t.zimTweens[o];i.paused=n,n!=i.zimPaused&&(i.zimPaused=n,n?i.zimTicker&&(i.zimAnimateTimeout=setTimeout(function(){e.Ticker.remove(i.zimTicker)},200)):(clearTimeout(i.zimAnimateTimeout),i.zimTicker&&(i.zimTicker=e.Ticker.add(i.zimTicker,K))))}function Me(e){for(var o=[],n=0;n<e.length;n++)t.zimIdSets&&!zot(t.zimIdSets[e[n]])?o=o.concat(t.zimIdSets[e[n]]):o.push(e[n]);return o}},e.stopAnimate=function(t){if(z_d("45.12"),zot(t)){if(e.animatedObjects)for(var o=e.animatedObjects.length-1;o>=0;o--)e.animatedObjects.objects[o].stopAnimate()}else if(Array.isArray(t)||(t=[t]),e.idSets)for(var n=0;n<t.length;n++){var i=t[n];if(e.idSets[i])for(o=e.idSets[i].length-1;o>=0;o--)e.idSets[i][o].stopAnimate(i)}},e.stopZimAnimate=function(t){z_d("45.1"),e.stopAnimate(t)},e.pauseAnimate=function(t,o){if(z_d("45.22"),zot(t)&&(t=!0),zot(o)){if(e.animatedObjects)for(var n=e.animatedObjects.length-1;n>=0;n--)e.animatedObjects.objects[n].pauseAnimate(t)}else if(Array.isArray(o)||(o=[o]),e.idSets)for(var i=0;i<o.length;i++){var r=o[i];if(e.idSets[r])for(n=e.idSets[r].length-1;n>=0;n--)e.idSets[r][n].pauseAnimate(t,r)}},e.pauseZimAnimate=function(t,o){z_d("45.2"),e.pauseAnimate(t,o)},e.wiggle=function(t,o,n,i,r,a,s,l,d,c,u,h,f){var p;if(p=zob(e.wiggle,arguments,"target, property, baseAmount, minAmount, maxAmount, minTime, maxTime, totalTime, type, ease, integer, id, startType"))return p;if(z_d("45.25"),zot(t)||zot(n)||zot(i))return t;zot(r)&&(r=i),zot(a)&&(a=1e3),zot(s)&&(s=a),zot(c)&&(c="quadInOut"),zot(u)&&(u=!1),zot(h)&&(h=e.makeID()),zot(d)&&(d="both"),zot(f)&&(f="both"),zot(l)||(t.wiggleTimeout=setTimeout(function(){t.stopAnimate(h)},l));var m,g=0;return function l(){var p=e.rand (a,s),z={},v={};if(v[o]=n,"negative"==d||0==g&&"negative"==f)var b=-e.rand (i,r,u);else b="positive"==d||0==g&&"positive"==f?e.rand (i,r,u):0==g?e.rand (i,r,u,!0):e.rand (i,r,u)*e.sign(m)*-1;z[o]=n+b,0==g&&(p/=2),m=b,g++,"negative"==d||"positive"==d?e.animate({target:t,obj:z,set:v,ease:c,time:2*p,rewind:!0,override:!1,call:l,id:h,ticker:!!t.stage}):e.animate({target:t,obj:z,ease:c,time:p,override:!1,call:l,id:h,ticker:!!t.stage})}(),t},e.loop=function(t,o,n,i,r,a){var s;if(s=zob(e.loop,arguments,"obj, call, reverse, step, start, end"))return s;if(z_d("45.3"),!zot(t)&&!zot(o)){zot(n)&&(n=!1),(zot(i)||i<=0)&&(i=1);var l="number"==typeof t?"number":t.constructor===Array?"array":t.constructor==={}.constructor?"object":"container";if("container"!=l||t.addChild)if("number"==l||"array"==l){if(0==(f=p((u="number"==l?t:t.length)-1)))return;if(n)for(var d=r;d>=a;d-=i){if("number"==l)var c=o(d,f,r,a,t);else c=o(t[d],d,f,r,a,t);if(void 0!==c)return c}else for(d=r;d<=a;d+=i){if("number"==l)c=o(d,f,r,a,t);else c=o(t[d],d,f,r,a,t);if(void 0!==c)return c}}else if("object"==l){var u=0,h=[];for(var d in t)u++,h.push(d);if(0==(f=p(u-1)))return;if(n)for(d=r;d>=a;d-=i){if(void 0!==(c=o(h[d],t[h[d]],d,f,r,a,t)))return c}else for(d=r;d<=a;d+=i){if(void 0!==(c=o(h[d],t[h[d]],d,f,r,a,t)))return c}}else{var f;if(0==(f=p(t.numChildren-1)))return;if(n)for(d=r;d>=a;d-=i){if(void 0!==(c=o(t.getChildAt(d),d,f,r,a,t)))return c}else for(d=r;d<=a;d+=i){if(void 0!==(c=o(t.getChildAt(d),d,f,r,a,t)))return c}}}function p(e){return zot(r)&&(r=n?e:0),zot(a)&&(a=n?0:e),n&&a>r||!n&&r>a?0:(r<0&&a)<0||r>e&&a>e?0:(r=Math.max(0,Math.min(r,e)),a=Math.max(0,Math.min(a,e)),Math.floor((n?r-a:a-r)/i)+1)}},e.copyMatrix=function(e,t){return z_d("45.5"),e.x=t.x,e.y=t.y,e.scaleX=t.scaleX,e.scaleY=t.scaleY,e.regX=t.regX,e.regY=t.regY,e.rotation=t.rotation,e.skewX=t.skewX,e.skewY=t.skewY,e},e.cur=function(e,t){return z_d("41.1"),zot(e)?(zog("zim methods - cur(): please provide object"),e):(zot(t)&&(t="pointer"),e.cursor=t,e)},e.sha=function(e,t,o,n,i){return z_d("41.2"),zot(e)?(zog("zim methods - sha(): please provide object"),e):(zot(t)&&(t="rgba(0,0,0,.3)"),t.blur?(e.shadow=t,e):(zot(o)&&(o=e.width?.08*e.width:5),zot(n)&&(n=e.height?.08*e.height:5),zot(i)&&(i=e.width?.16*e.width:10),e.shadow=new createjs.Shadow(t,o,n,i),e))},e.pos=function(e,t,o,n,i){if(z_d("41.5"),!zot(e))return zot(t)||(e.x=t),zot(o)||(e.y=o),zot(i)&&(i=!0),!zot(n)&&i&&e.addTo(n),e},e.mov=function(e,t,o){if(z_d("41.6"),!zot(e))return zot(t)||(e.x+=t),zot(o)||(e.y+=o),e},e.dep=function(e,t){if(z_d("41.65"),!zot(e))return zot(t)&&(t=0),e.depth=t,e},e.alp=function(e,t){if(z_d("41.7"),!zot(e))return zot(t)||(e.alpha=t),e},e.rot=function(e,t){if(z_d("41.8"),!zot(e))return zot(t)||(e.rotation=t),e},e.siz=function(e,t,o,n){if(z_d("41.85"),!zot(e))return zot(n)&&(n=!1),zot(t)||zot(o)?zot(t)?zot(o)||(n?e.heightOnly=o:e.height=o):n?e.widthOnly=t:e.width=t:(e.widthOnly=t,e.heightOnly=o),e},e.ske=function(e,t,o){if(z_d("41.9"),!zot(e))return zot(t)||(e.skewX=t),zot(o)||(e.skewY=o),e},e.reg=function(e,t,o){if(z_d("41.95"),!zot(e))return zot(t)||(e.regX=t),zot(o)||(e.regY=o),e},e.sca=function(e,t,o){if(z_d("41.97"),!zot(e)&&!zot(e.scaleX))return zot(t)&&(t=e.scaleX),zot(o)&&(o=t),e.scaleX=t,e.scaleY=o,e},e.scaleTo=function(t,o,n,i,r,a){var s;if(s=zob(e.scaleTo,arguments,"obj, boundObj, percentX, percentY, type, boundsOnly"))return s;if(z_d("43"),!zot(t)&&t.getBounds&&t.getBounds()){if(!zot(o)&&o.getBounds&&o.getBounds()){zot(n)&&(n=-1),zot(i)&&(i=-1),-1==n&&-1==i&&(n=i=100),zot(r)&&(r="smallest"),zot(a)&&(a=!1);var l=o.getBounds().width*n/100*(a?1:o.scaleX),d=o.getBounds().height*i/100*(a?1:o.scaleY);if((-1==n||-1==i)&&"both"!=r&&"stretch"!=r)return-1==n?e.sca(t,d/t.getBounds().height):e.sca(t,l/t.getBounds().width),t;if("both"==r||"stretch"==r)return t.scaleX=-1!=n?l/t.getBounds().width:t.scaleX,t.scaleY=-1!=i?d/t.getBounds().height:t.scaleY,t;if("biggest"==r||"largest"==r||"outside"==r)var c=Math.max(l/t.getBounds().width,d/t.getBounds().height);else c=Math.min(l/t.getBounds().width,d/t.getBounds().height);return e.sca(t,c),t}zog("zim methods - scaleTo(): please provide a boundObject (with setBounds) to scale to")}else zog("zim methods - scaleTo(): please provide an object (with setBounds) to scale")},e.fit=function(t,o,n,i,r,a){var s;if(s=zob(e.fit,arguments,"obj, left, top, width, height, inside"))return s;if(z_d("46"),!zot(t)&&t.getBounds){if(t.getBounds()){if(zot(o)){if(!t.stage)return void zog("zim methods - fit(): please add boundary dimensions or add obj to stage first");if(!t.stage.getBounds())return void zog("zim methods - fit(): please add boundary dimensions or add obj with bounds to stage first");o=0,n=0,i=t.stage.getBounds().width,r=t.stage.getBounds().height}zot(a)&&(a=!0),t.scaleX=t.scaleY=1;var l,d=i,c=r,u=t.getBounds().width,h=t.getBounds().height;l=a?d/c>=u/h?c/h:d/u:d/c>=u/h?d/u:c/h,t.scaleX=t.scaleY=l;var f=u*l,p=h*l;return t.x=(t.regX-t.getBounds().x)*l+o+(d-f)/2,t.y=(t.regY-t.getBounds().y)*l+n+(c-p)/2,{x:t.x,y:t.y,width:f,height:p,scale:l,bX:o,bY:n,bWidth:i,bHeight:r}}zog("zim methods - fit(): please setBounds() on object")}},e.outline=function(t,o,n){var i;if(i=zob(e.outline,arguments,"obj, color, size"))return i;if(z_d("47"),zot(t)||!t.getBounds)return zog("zim methods - outline(): please provide object with bounds set"),t;if(!t.getBounds())return zog("zim methods - outline(): please setBounds() on object"),t;if(!t.parent)return zog("zim methods - outline(): object should be on stage first"),t;zot(o)&&(o="brown"),zot(n)&&(n=2);var r=t.getBounds(),a=new createjs.Shape,s=new createjs.Shape,l=t.parent,d=t.localToLocal(r.x,r.y,l),c=t.localToLocal(r.x+r.width,r.y,l),u=t.localToLocal(r.x+r.width,r.y+r.height,l),h=t.localToLocal(r.x,r.y+r.height,l),f=t.localToLocal(0,0,l),p=a.graphics,m=s.graphics;p.s(o).ss(n).mt(d.x,d.y).lt(c.x,c.y).lt(u.x,u.y).lt(h.x,h.y).lt(d.x,d.y).cp();return m.s("white").ss(n+2),m.mt(-11,0).lt(11,0),m.mt(0,-11).lt(0,11),m.s(o).ss(n),m.mt(-10,0).lt(10,0),m.mt(0,-10).lt(0,10),s.x=f.x,s.y=f.y,s.rotation=t.rotation,p.s("white").ss(n+2).dc(t.x,t.y,16),p.s(o).ss(n).dc(t.x,t.y,16),t.parent.addChild(a),t.parent.addChild(s),a.mouseEnabled=!1,s.mouseEnabled=!1,t.stage&&t.stage.update(),t},e.addTo=function(e,t,o){if(z_d("47.5"),!zot(e)){if(zot(t)){if(!zimDefaultFrame)return void zog("zim methods - addTo(): please provide container");t=zimDefaultFrame.stage}return zot(o)||isNaN(o)?t.addChild(e):t.addChildAt(e,o),e}zog("zim methods - addTo(): please provide object")},e.removeFrom=function(e,t){if(z_d("47.6"),!zot(e))return zot(t)?e.parent.removeChild(e):t.removeChild(e),e;zog("zim methods - removeFrom(): please provide object")},e.added=function(e,t,o,n){if(z_d("47.7"),!zot(e)&&!zot(t)&&"function"==typeof t){if(zot(o)&&(o=100),!e.stage){var i=Date.now(),r=0,a=setInterval(function(){r>5?clearInterval(a):(r++,e.stage&&(t(e.stage,e),clearInterval(a),clearInterval(s)))},10),s=setInterval(function(){n>0&&i-Date.now()>n&&clearInterval(s),e.stage&&(t(e.stage,e),clearInterval(s))},o);return s}t(e.stage,e)}},e.centerReg=function(t,o,n,i){var r;if(r=zob(e.centerReg,arguments,"obj, container, index, add"))return r;if(z_d("48"),zot(t)||!t.getBounds||!t.getBounds())return zog("zim methods - centerReg(): please provide object with bounds set"),t;zot(i)&&(i=!0);var a=t.getBounds();return t.regX=a.x+a.width/2,t.regY=a.y+a.height/2,zot(o)&&t.parent?t:i?e.center(t,o,n):t},e.center=function(t,o,n,i){var r;if(r=zob(e.center,arguments,"obj, container, index, add"))return r;if(z_d("48.1"),!zot(t)&&t.getBounds){if(zot(o)&&zimDefaultFrame&&(o=zimDefaultFrame.stage),!zot(o)&&o.getBounds){var a=t.getBounds(),s=o.getBounds();if(zot(i)&&(i=!0),i&&o.addChild&&(zot(n)||"number"==typeof n&&isNaN(n)?o.addChild(t):o.addChildAt(t,n)),zot(s))return t;if(zot(a))return t.x=o.getBounds().width/2,t.y=o.getBounds().height/2,t;var l=t.localToLocal(t.regX,t.regY,o),d=e.boundsToGlobal(t),c=e.boundsToGlobal(o,d,!0);if(t.x=s.x+s.width/2-c.width/2+(l.x-c.x),t.y=s.y+s.height/2-c.height/2+(l.y-c.y),!i&&o.getStage&&o.stage&&t.parent){var u=o.localToLocal(t.x,t.y,t.parent);t.x=u.x,t.y=u.y}return t}zog("zim.center(): please provide container with bounds")}else zog("zim.center(): please provide object with bounds")},e.place=function(t,o){if(z_d("49"),!zot(t))return zot(o)&&(o="obj"),e.drag({obj:t,currentTarget:!0,dragCursor:"crosshair"}),zog("place "+o+" - to get new position"),t.on("click",function(){zog(o+".x="+Math.round(t.x)+"; "+o+".y="+Math.round(t.y)+";"),zog(o+".pos("+Math.round(t.x)+", "+Math.round(t.y)+");")}),t},e.placeReg=function(t,o){if(z_d("49.5"),!zot(t)){var n=t.stage;if(zot(n))zog("zim.placeReg() - add object to stage before calling placeReg()");else{zot(o)&&(o="obj");var i=t.parent.localToGlobal(t.x,t.y),r=new e.Shape(-25,-25,50,50).addTo(n).pos(i.x,i.y);r.graphics.s("white").mt(-25,0).lt(25,0).mt(0,-25).lt(0,20),r.compositeOperation="difference",r.expand (0),e.drag({obj:r}),zog("place cursor to get new registration point location"),n.on("stagemouseup",function(){var e=t.globalToLocal(r.x,r.y);zog(o+".regX="+Math.round(e.x)+"; "+o+".regY="+Math.round(e.y)+";"),zog(o+".reg("+Math.round(e.x)+", "+Math.round(e.y)+");")})}}},e.expand=function(e,t,o){if(z_d("50"),zot(e)||!e.getBounds||!e.getBounds())return zog("zim methods - expand (): please provide object with bounds set"),e;zot(t)&&(t=20),zot(o)&&(o=t);var n=e.getBounds(),i=new createjs.Shape;return i.graphics.f("0").r(n.x-t,n.y-o,n.width+2*t,n.height+2*o),e.hitArea=i,e},e.setMask=function(t,o,n){if(z_d("50.1"),zot(t)&&zog("zim methods - setMask(): please provide obj"),zot(o))return i(),t;function i(){t.zimMask&&t.zimMask.parent&&t.zimMask.parent.removeChild(t.zimMask),t.zimMask=null,t.zimMaskTicker&&Ticker.remove(t.zimMaskTicker),t.mask=null}var r;function a(){if(n&&(!t.stage||!o.stage))return t;delete r,t.zimMask=o.zimMask=r=o.shape.clone(),e.copyMatrix(r,o),r.regX=o.regX,r.regY=o.regY,o.addChildAt(r,0),r.alpha=0,r.x=o.x+o.shape.x,r.y=o.y+o.shape.y,t.mask=r}return t.zimMaskOriginal&&t.zimMaskOriginal!=o&&i(),zot(n)&&(n=!("Blob"!=o.type&&zot(o.zimDown)&&zot(o.transformControls)&&zot(o.zimTouch)&&zot(o.zimTweens)),o.zimMaskDynamic=n),t.zimMaskOriginal=o,o.zimMaskApply=function(){t.zimMaskTicker&&Ticker.remove(t.zimMaskTicker),t.zimMaskTicker=Ticker.add(a)},o&&o.shape?(a(),n&&o.zimMaskApply()):(r=o,t.mask=r),t},e.ANIMATE=!0,e.OPTIMIZE=!1,e.ACTIONEVENT="mousedown",e.Ticker={stages:null,myUpdate:null,alwaysList:new e.Dictionary,list:new e.Dictionary,setFPS:function(t,o){zot(t)&&zot(o)?(t=30,o=60):zot(t)?t=30:zot(o)&&(o=t),e.Ticker.framerate=createjs.Ticker.framerate=e.mobile()?t:o},setTimingMode:function(e){createjs.Ticker.timingMode=createjs.Ticker.RAF,"synched"==e&&(createjs.Ticker.timingMode=createjs.Ticker.RAF_SYNCHED),"timeout"==e&&(createjs.Ticker.timingMode=createjs.Ticker.TIMEOUT)},add:function(t,o){z_d("30");var n=e.Ticker;return n.has(t,o)?t:(n.framerate||n.setFPS(),!zot(o)&&o.update||(o=zimDefaultFrame.stage),zot(t)||"function"!=typeof t?void zog("zim.Ticker.add() - only add functions"):(n.ticker||(n.ticker=createjs.Ticker.on("tick",n.call)),n.list.at(o)?n.list.at(o).push(t):n.list.add(o,[t]),t))},rawID:{},raw:function(t){z_d("30");var o=e.makeID(7,"letters");return function n(){t(),e.Ticker.rawID[o]=requestAnimationFrame(n)}(),o},removeRaw:function(t){cancelAnimationFrame(e.Ticker.rawID[t]),delete e.Ticker.rawID[t]},call:function(t){for(var o,n,i=e.Ticker,r=0;r<i.list.length;r++){o=i.list.objects[r],n=i.list.values[r];for(var a=0;a<n.length;a++)n[a]();i.alwaysList.at(o)?o.update():n.length>0&&(!zot(i.update)||e.OPTIMIZE||!zns&&OPTIMIZE?i.update&&o.update():o.update())}for(r=0;r<i.alwaysList.length;r++)o=i.alwaysList.objects[r],null==i.list[o]&&o.update()},always:function(t){z_d("30");var o=e.Ticker;o.framerate||o.setFPS(),!zot(t)&&t.update||(t=zimDefaultFrame.stage),o.alwaysList.add(t,!0),o.ticker||(o.ticker=createjs.Ticker.on("tick",o.call))},alwaysOff:function(t){var o=e.Ticker;!zot(t)&&t.update||(t=zimDefaultFrame.stage),o.alwaysList.remove(t)},remove:function(t){var o=e.Ticker;if(zot(t)||"function"!=typeof t)zog("zim.Ticker - only remove functions");else{for(var n=0,i=0;i<o.list.length;i++){o.list.objects[i];var r=o.list.values[i].indexOf(t);r>-1&&o.list.values[i].splice(r,1),n+=o.list.values[i].length}o.alwaysList.length>0||0==n&&(createjs.Ticker.off("tick",o.ticker),o.ticker=null)}},removeAll:function(t){for(var o,n=e.Ticker,i=0,r=0;r<n.list.length;r++)o=n.list.objects[r],(zot(t)||t===o)&&(n.list.values[r]=[]),i+=n.list.values[r].length;n.alwaysList.length>0||0==i&&(createjs.Ticker.off("tick",n.ticker),n.ticker=null)},has:function(t,o){return!zot(o)&&o.update||(o=zimDefaultFrame.stage),e.Ticker.list&&e.Ticker.list.at(o)&&e.Ticker.list.at(o).indexOf(t)>=0},dispose:function(t){for(var o,n=e.Ticker,i=0,r=n.list.length-1;r>=0;r--)o=n.list.objects[r],zot(t)||t===o?(n.list.remove(t),n.alwaysList.remove(t)):i+=n.list.values[r].length;if(!(n.alwaysList.length>0))return 0==i&&(createjs.Ticker.off("tick",n.ticker),n.ticker=null),!0}},Object.defineProperty(e.Ticker,"update",{get:function(){return e.Ticker.myUpdate},set:function(t){var o=e.Ticker;"boolean"!=typeof t&&(t=null),o.myUpdate=t,!1===o.myUpdate&&(cancelAnimationFrame(o.ticker),o.alwaysList=new e.Dictionary)}}),e.Accessibility=function(t,o,n,i,r,a,s,l,d,c,u,h,f,p){var m;if(m=zob(e.Accessibility,arguments,"appName, tabOrder, tabIndex, cycle, decimals, frame, alwaysHighlight, AHTime, AHColor, AHBorderWidth, AHBorderPadding, AHAlpha, AHObject, AHObjectScale",this))return m;if(z_d("30.5"),this.cjsEventDispatcher_constructor(),zot(t)&&(t="application"),zot(i)&&(i=!1),zot(r)&&(r=2),zot(a)&&(a=zimDefaultFrame),zot(s)&&(s=!1),zot(l)&&(l=700),zot(d)&&(d="brown"),zot(c)&&(c=3),zot(u)&&(u=5),zot(h)&&(h=.8),zot(p)&&(p=.8),zot(f)){var g=new e.Shape;g.mouseEnabled=!1}else f.mouseEnabled&&(f.mouseEnabled=!1);var z=this;z.cycle=i,z.decimals=r,z.alwaysHighlight=s,z.AHTime=l,z.AHColor=d,z.AHBorderWidth=c,z.AHBorderPadding=u,z.AHAlpha=h,z.AHObjectScale=p;var v,b,y,w,x,C,T,k,E=-1,M=-1,j=[],S=[],A={RadioButtons:"option",Tabs:"tab",Pad:"key"},P=a.canvas.id,O=e.mobile(),I=!1,D=null,B=[];function L(e){var t=e.currentTarget.boundsToGlobal(),o=t.x+t.width/2,n=t.y+t.height/2;e.stageX<o-5||e.stageX>o+5||e.stageY<n-5||e.stageY>n+5?_():Y()}function X(){w&&(w.innerHTML="")}function Y(){var t,o;D=!0,F(),w&&w.setAttribute("aria-hidden",!1),e.ACTIONEVENT="click",a.stage.removeChild(v),z.alwaysHighlight=!1,a.stage.update();for(var n=0;n<E.length;n++)(o=(t=E[n]).obj.zimTabTag).disabled=!1,t.title=t.title.replace(/\s\(use arrow keys\)/,""),o.setAttribute("aria-label",t.title),o.addEventListener("focus",R)}function _(){D=!1;for(var e=0;e<E.length;e++)E[e].obj.zimTabTag.disabled=!1;F(),s&&function(){for(var e=0;e<j.length;e++){var t=j[e];(!t.zimObject||"Loader"!=t.zimObject.type&&"TextArea"!=t.zimObject.type)&&(j[e].style.left="-2000px")}}()}function R(e){var t=e.currentTarget,o=t.zimObject;M=o.zimTabIndex,o.focus=!0;var n=new createjs.Event("change");n.title=t.getAttribute("aria-label"),z.dispatchEvent(n)}function W(e){D=!1,e.target.focusTab.focus()}function N(){zot(D)||D?Y():_()}function F(){I=!0,b.removeEventListener("focus",N),y.removeEventListener("focus",N),x.removeEventListener("focus",W),C.removeEventListener("focus",W),x.parentNode.removeChild(x),C.parentNode.removeChild(C),T.removeEventListener("focus",W),k.removeEventListener("focus",W),T.parentNode.removeChild(T),k.parentNode.removeChild(k);for(var e=0;e<B.length;e++)B[e][0].off("mousedown",B[e][1])}function V(e){var t=e.currentTarget;if("RadioButton"==t.type||"TabsButton"==t.type||"PadButton"==t.type)for(var o=0;o<t.zimTabParent.buttons.length;o++){var n=t.zimTabParent.buttons[o];n.zimTabTag.setAttribute("aria-label",n.zimTabTag.getAttribute("aria-label").split(" - currently")[0]+(t.zimTabParent.selectedIndex==n.tabIndex?" - currently selected.":" - currently not selected."))}z.tabIndex=e.currentTarget.zimTabIndex,z.activatedObject=t}function H(e){return"TextArea"==e.type||"RadioButtons"==e.type||"Tabs"==e.type||"Pad"==e.type?e.type:"Waiter"==e.type?"Waiter active - please wait":e.text?e.type+" - "+("a"==e.text||"A"==e.text?"eh":e.text):e.type+("Dial"==e.type||"Slider"==e.type||"ColorPicker"==e.type||"Stepper"==e.type?" (use arrow keys)":"")+("TextArea"==e.type?" (press ENTER to edit)":"")}function G(t){var o=t.obj;t.title=t.title.replace(/\.$/,""),"RadioButton"==o.type||"TabsButton"==o.type||"PadButton"==o.type?t.title=t.title+(o.tabIndex==o.zimTabParent.selectedIndex?" - currently selected":" - currently not selected"):"CheckBox"==o.type?t.title=t.title+(o.checked?" - currently checked":" - currently not checked"):"Stepper"==o.type?t.title=t.title+" - currently displaying "+o.currentValue:"Slider"==o.type||"Dial"==o.type?t.title=t.title+" - currently at "+e.decimals(o.currentValue,z.decimals):"ColorPicker"==o.type?t.title=t.title+" - currently at "+o.selectedColor:"TextArea"==o.type?t.title=t.title+(""!=o.tag.value?"":" - placeholder: "+o.tag.placeholder):"Indicator"==o.type&&(t.title=t.title+" - currently "+(o.selectedIndex>=0?"at "+(o.selectedIndex+1)+" of "+o.num:"not indicating")),t.title+="."}function U(e,t,o,n,i){var r;if(n&&(h=n.obj),n&&("TextArea"==h.type||"Loader"==h.type))return(r=h.tag).setAttribute("aria-label",t),h&&r.setAttribute("aria-hidden",!h.stage),"before"==i?o.parentNode.insertBefore(r,o):o.parentNode.insertBefore(r,o.nextSibling),r.style.zIndex=-5,r.zimObject=h,n.obj.zimTabTag=r,j.push(r),r;if(!n||"Dial"!=h.type&&"Slider"!=h.type&&"Stepper"!=h.type&&"ColorPicker"!=h.type)r=document.createElement("div"),h&&(r.zimObject=h),r.innerHTML="tag",r.setAttribute("role","button");else{var s,l,d=[];if("Dial"==h.type||"Slider"==h.type)for(var c=h.step<=0?(h.max-h.min)/20:h.step,u=h.min;u<h.max;u+=c)d.push(h.min+u);else"Stepper"==h.type?d=h.stepperArray:"ColorPicker"==h.type&&(d=h.colors);(r=document.createElement("select")).disabled=!0,r.zimObject=h,r.addEventListener("change",function(e){D&&(e.currentTarget.zimObject.zimTabParent.currentValueEvent=e.target.value,a.stage.update())}),r.size=1;for(u=0;u<d.length;u++)s=d[u],(l=document.createElement("option")).setAttribute("aria-label",s),l.innerHTML=s,r.add(l),s==h.zimTabParent.currentValue&&l.setAttribute("selected","selected");r.setAttribute("role","button")}if(r.setAttribute("id",e),r.setAttribute("tabindex",0),r.setAttribute("aria-label",t),h&&r.setAttribute("aria-hidden",!h.stage),"before"==i?o.parentNode.insertBefore(r,o):o.parentNode.insertBefore(r,o.nextSibling),r.style.position="absolute",n){var h,f=(h=n.obj).boundsToGlobal();r.style.left=a.x+f.x*a.scale+"px",r.style.top=a.y+f.y*a.scale+"px",r.style.width=f.width*a.scale+"px",r.style.height=f.height*a.scale+"px",n.obj.zimTabTag=r}else r.style.left="-1000px",r.style.top=a.y+"px";return r.style.overflow="hidden",r.style.zIndex=-5,r.style.fontSize="20px",j.push(r),r}Object.defineProperty(this,"tabOrder",{get:function(){return E},set:function(e){b&&b.removeEventListener("focus",X),y&&y.removeEventListener("focus",X);for(var o=0;o<j.length;o++)j[o].parentElement&&(j[o].outerHTML="");var n,i;for(j=[],o=0;o<S.length;o++)(n=E[o])&&S[o][0].off("mousedown",S[o][1]);S=[],E=[];var r=[],s=a.canvas,l=0;for(o=0;o<e.length;o++){if((n=e[o]).constructor=={}.constructor){if(!(i=n.obj)||!i.getStage)continue;n.title||(n.title=H(i))}else i=n,n={obj:n,title:H(n)};if("RadioButtons"==i.type||"Tabs"==i.type||"Pad"==i.type){var d=[];l--;for(var c=0;c<i.buttons.length;c++){l++;var u=i.buttons[c],h={obj:u,title:n.title+" - "+A[i.type]+": "+("a"==u.text||"A"==u.text?"eh":u.text)};d.push(h),u.zimTabParent=i,u.zimTabParent.zimAccessibility=z,u.zimTabIndex=o+l,u.tabIndex=c,u.zimAccessibility=z,G(h),s=U(P+"Tab"+(o+l),h.title,s,h),S.push([u,u.on("mousedown",V)]),I||B.push([u,u.on("mousedown",L)])}r=r.concat(d)}else i.zimTabIndex=o+l,i.zimTabParent=i,G(n),i.zimAccessibility=z,S.push([i,i.on("mousedown",V)]),I||B.push([i,i.on("mousedown",L)]),r.push(n),s=U(P+"Tab"+(o+l),n.title,s,n)}(b=z.startAppTag=U(P+"PrefixTab",t+" start",a.canvas,null,"before")).addEventListener("focus",X),I||(b.addEventListener("focus",N),(x=U(P+"noAriaTab","",b,null,"before")).setAttribute("aria-hidden",!0),x.focusTab=b,x.addEventListener("focus",W),(T=U(P+"noAriaTab","",b)).setAttribute("aria-hidden",!0),T.focusTab=b,T.addEventListener("focus",W)),s=U(P+"BufferTab","",s),O&&s.setAttribute("aria-hidden",!0),s=y=z.endAppTag=U(P+"SuffixTab",t+" end",s),y.addEventListener("focus",X),I||(y.addEventListener("focus",N),s=C=U(P+"noAriaTab","",y),C.setAttribute("aria-hidden",!0),C.focusTab=y,C.addEventListener("focus",W),(k=U(P+"noAriaTab","",y,null,"before")).setAttribute("aria-hidden",!0),k.focusTab=y,k.addEventListener("focus",W)),E=r}}),Object.defineProperty(this,"tabIndex",{get:function(){return M},set:function(t){if(_state)if(t<0||t>=E.length)h();else{t!=M&&u();var o=E[t].obj;if(o.stage){if(M=t,o.focus=!0,q=!0,K=!1,z.changeTitle(o),o.zimTabTag.focus(),setTimeout(function(){o.zimTabTag.focus();var e=new createjs.Event("change");e.title=o.zimTabTag.getAttribute("aria-label"),z.dispatchEvent(e)},150),z.alwaysHighlight&&!D){if(z.AHObject){v=z.AHObject;var n=e.boundsToGlobal(o);z.AHObject.alp(z.AHAlpha).addTo(a.stage),z.AHObject.fit(n.x,n.y,n.width,n.height),z.AHObject.sca(z.AHObject.scaleX*z.AHObjectScale),z.AHTime>0&&(Z=setTimeout(function(){a.stage.removeChild(z.AHObject),a.stage.update()},z.AHTime))}else{v=g;var i=o.getBounds(),r=o.localToGlobal(i.x-5,i.y-5),s=o.localToGlobal(i.x+i.width+5,i.y-5),l=o.localToGlobal(i.x+i.width+5,i.y+i.height+5),d=o.localToGlobal(i.x-5,i.y+i.height+5),c=g.graphics;c.clear(),c.s(z.AHColor).ss(z.AHBorderWidth).mt(r.x,r.y).lt(s.x,s.y).lt(l.x,l.y).lt(d.x,d.y).lt(r.x,r.y).cp(),g.alpha=z.AHAlpha,z.AHTime>0&&(Z=setTimeout(function(){a.stage.removeChild(g),a.stage.update()},z.AHTime))}a.stage.addChild(v),a.stage.update()}}else h()}function u(){if(M&&M>-1)E[M].obj.focus=!1;else for(var e=0;e<E.length;e++)E[e].obj.focus=!1}function h(){u(),q=!1,z.AHObject&&a.stage.removeChild(z.AHObject),z.alwaysHighlightShape&&a.stage.removeChild(z.alwaysHighlightShape),a.stage.update(),M=-1}}}),Object.defineProperty(this,"aria",{get:function(){return D},set:function(e){(D=e)&&Y()}}),zot(o)?setTimeout(function(){if(-1==E){E=[];var t=[];e.loop(a.stage,function(e){e.type&&t.push(e)}),z.tabOrder=t,zot(n)||(z.tabIndex=n)}},50):(E=[],z.tabOrder=o,zot(n)||(z.tabIndex=n));var Z,q=!1,K=!0,Q=a.on("keydown",function(e){var t;if(9==e.keyCode&&(function(){for(var e=!1,t=0;t<j.length;t++)if(document.activeElement==j[t]){e=!0;break}return!(document.activeElement!=a.canvas&&!e)}()||(q=!1,-1!=z.tabIndex&&(z.tabIndex=-1)),q?J(e):(t=e,a.shiftKey||zid(P+"PrefixTab")!=document.activeElement&&a.canvas!=document.activeElement?!a.shiftKey||zid(P+"SuffixTab")!=document.activeElement&&zid(P+"BufferTab")!=document.activeElement||(E.length>0&&(E[0].obj.focus=!0),K=!0,q=!0,J(t)):(E.length>0&&(E[E.length-1].obj.focus=!0),K=!0,q=!0,J(t)))),q&&E.length>0&&z.tabIndex>=0&&13==e.keyCode){var o=E[z.tabIndex],n=o.obj;if(o&&n.stage){var i=new createjs.Event("mousedown"),r=new createjs.Event("click");i.fromEnter=r.fromEnter=!0,"Pane"==n.type?(n.backdrop.dispatchEvent(i),n.backdrop.dispatchEvent(r)):(n.dispatchEvent(i),n.dispatchEvent(r))}}});function J(e){e.ctrlKey?$(e.shiftKey?-1:1):(e.shiftKey?z.tab(-1):z.tab(1),e.preventDefault())}function $(e){q=!1,zid(P+(1==e?"SuffixTab":"PrefixTab")).focus(),a.stage.removeChild(f),a.stage.update(),z.tabIndex=-1}this.tab=function(e){if(clearTimeout(Z),v&&a.stage.removeChild(v),zot(e)&&(e=1),0!=E.length)for(var t=0;t<E.length;t++){var o=E[t].obj;if(o.focus){o.focus=!1;var n=t+e,i=(n+1e4*E.length)%E.length,r=E[i];o=r.obj;for(var s=0,l=!1;!o.stage||!(!o.zimTabParent&&(zot(o.enabled)||o.enabled)||o.zimTabParent&&(zot(o.zimTabParent.enabled)||o.zimTabParent.enabled));)if(s++,i=((n+=e)+100*E.length)%E.length,o=(r=E[i]).obj,s==E.length){l=!0;break}if(l||!z.cycle&&n!=i&&!K)return void $(e);K=!1,z.tabIndex=i;break}}else $(e)},this.changeTitle=function(e,t,o){if("number"!=typeof e&&(e=e.zimTabIndex),!zot(e))if(o&&zot(t))z.tabIndex=e;else{var n=E[e],i=n.obj;zot(t)&&(t=i.zimTabTag.getAttribute("aria-label").split(" - currently")[0]),n.title=t,G(n),i.zimTabTag.setAttribute("aria-label",n.title),o&&(z.tabIndex=e)}};var ee=!1;this.talk=function(e){ee||((w=U(P+"TalkTab","",y)).setAttribute("role","alert"),w.setAttribute("aria-hidden",!D),ee=!0),w.setAttribute("aria-label",e),w.innerHTML=" ",w.innerHTML=e;var t=new createjs.Event("change");t.title=e,z.dispatchEvent(t)},this.resize=function(e){if(zot(e)){if(z.alwaysHighlight&&!zot(D))return;for(var t=0;t<E.length;t++)n(E[t].obj)}else{if("number"!=typeof e&&(e=e.zimTabIndex),e<0)return;var o=E[e].obj;if(!o.stage&&v&&o==z.currentObject&&(a.stage.removeChild(v),a.stage.update()),z.alwaysHighlight&&!zot(D))return;n(o)}function n(e){if("TextArea"!=e.type&&"Loader"!=e.type){var t=e.boundsToGlobal(),o=e.zimTabTag;o.style.left=a.x+t.x*a.scale+"px",o.style.top=a.y+t.y*a.scale+"px",o.style.width=t.width*a.scale+"px",o.style.height=t.height*a.scale+"px",o.setAttribute("aria-hidden",!e.stage),o.hidden=!e.stage}else e.resize()}},Object.defineProperty(this,"currentObject",{get:function(){return E[M]&&E[M].obj?E[M].obj:null},set:function(e){for(var t=0;t<E.length;t++)if(E[t].obj==e){z.tabIndex=t;break}}}),_state=!0,Object.defineProperty(this,"enabled",{get:function(){return _state},set:function(e){_state=e}}),this.dispose=function(){z.tabOrder=[];for(var e=0;e<j.length;e++)j[e].parentElement&&(j[e].outerHTML="");z.removeAllEventListeners(),a.off("keydown",Q)}},e.extend(e.Accessibility,createjs.EventDispatcher,null,"cjsEventDispatcher",!1),e.Swipe=function(t,o,n){var i;if(i=zob(e.Swipe,arguments,"obj, distance, duration",this))return i;if(z_d("70"),this.cjsEventDispatcher_constructor(),!zot(t)&&t.on){var r,a,s,l,d,c;zot(o)&&(o=30),zot(n)&&(n=80),this.distance=o,this.duration=n,this.active=!0;var u=this;t.on("mousedown",function(e){function o(){var e=new createjs.Event("swipe");e.obj=u.obj,e.swipeX=e.swipeY=0,u.direction="none",Math.abs(s-r)>Math.abs(l-a)?(s-r>u.distance&&(e.swipeX=1,u.direction="right"),r-s>u.distance&&(e.swipeX=-1,u.direction="left")):(l-a>u.distance&&(e.swipeY=1,u.direction="down"),a-l>u.distance&&(e.swipeY=-1,u.direction="up")),u.dispatchEvent(e)}u.active&&!e.target.zimNoSwipe&&(u.obj=e.target,s=r=e.stageX,l=a=e.stageY,d=!0,u.dispatchEvent("swipedown"),clearTimeout(c),c=setTimeout(function(){d&&(o(),d=!1)},u.duration),t.on("pressmove",function(e){s=e.stageX,l=e.stageY}),t.on("pressup",function(e){d&&(o(),d=!1,clearTimeout(c))}))}),this.disable=function(){u.active=!1},this.enable=function(){u.active=!0}}else zog("zim controls - Swipe():\nPlease pass in object")},e.extend(e.Swipe,createjs.EventDispatcher,null,"cjsEventDispatcher",!1),e.Pages=function(t,o,n,i,r){var a;if(a=zob(e.Pages,arguments,"pages, transition, speed, transitionTable, holder",this))return a;if(z_d("71"),this.zimContainer_constructor(),this.type="Pages",zot(t)&&(t=[]),this.pages=t,zot(o)&&(o="none"),zot(n)&&(n=200),zot(i)&&(i=[]),this.transitionTable=i,zot(r)&&zimDefaultFrame&&(r=zimDefaultFrame.stage),r.getBounds&&r.getBounds()){this.speed=n,this.active=!0;var s=this;s.transitioning=!1;var l,d,c=r.getBounds().width,u=r.getBounds().height;"none"==o&&i==[]||w();for(var h,f,p=["left","right","up","down"],m=0;m<t.length;m++)(h=t[m]).constructor!=={}.constructor&&(h=t[m]={page:t[m]}),h.page.zimSwipeArray=h.swipe?h.swipe:[],h.page.zimOriginalAlpha=h.page.alpha,h.page.parent&&h.page.parent.removeChild(h.page);var g,z=this.page=t[0]?t[0].page:null;this.addChild(z),this.swipe=new e.Swipe(r);var v=!1,b=this.swipe.on("swipe",function(e){if(s.active){var t=e.currentTarget.direction;if("none"!=t){var o="";"left"==t?o="right":"right"==t?o="left":"up"==t?o="down":"down"==t&&(o="up"),t=o;var n=p.indexOf(t);f=z.zimSwipeArray[n],g=[f,t,null,null,!0],s.page=z,s.nextPage=f,s.direction=t,s.dispatchEvent("swipe"),setTimeout(function(){v||s.go(f,t,null,null,!0)},50)}}});this.addPage=function(e,t){zot(t)&&(t=[]);var o={page:e,swipe:t};o.page.zimSwipeArray=o.swipe?o.swipe:[],o.page.zimOriginalAlpha=o.page.alpha,z?o.page.parent&&o.page.parent.removeChild(o.page):(z=s.page=o.page,s.addChild(z))},this.removePage=function(e){s.currentPage==e&&(s.removeChild(e),r.stage&&r.stage.update()),e.zimSwipeArray=null},this.setSwipeArray=function(e,t){zot(t)&&(t=[]);var o={page:e,swipe:t};o.page.zimSwipeArray=o.swipe?o.swipe:[]},this.pause=function(){v=!0},this.unpause=function(){v&&s.go(g[0],g[1],g[2],g[3],g[4])};var y=!0;this.go=function(t,i,a,h,f){if("number"==typeof t){var m=s.pages[t];if(zot(m))return;t=m.page}setTimeout(function(){v=!1},200);for(var g=[{x:c},{x:-c},{y:u},{y:-u}],b=[{x:c/2,alpha:0},{x:-c/2,alpha:0},{y:u/2,alpha:0},{y:-u/2,alpha:0}],w=o,x=n,C=0;C<s.transitionTable.length;C++)if(s.transitionTable[C][0]==z&&s.transitionTable[C][1]==t){w=s.transitionTable[C][2],x=s.transitionTable[C][3];break}if(zot(a)&&(a=w),zot(h)&&(h=x),s.speed=h,s.direction=i,""==t||null==t)s.page=z,s.dispatchEvent("nothing");else if("string"==typeof t)s.page=z,s.dispatchEvent(t);else{if(t==z)return;zot(i)&&(i="right");var T=p.indexOf(i);if(!y)return;function k(e){e[0].uncache(),e[1].uncache(),s.transitioning=!1,s.dispatchEvent("pagetransitioned"),s.removeChild(s.lastPage),s.removeChild(l),s.removeChild(d),y=!0}function E(t){s.removeChild(s.lastPage),e.animate(t.shift(),{alpha:0},s.speed/2,null,k,t)}y=!1,t.x=0,t.y=0,t.alpha=t.zimOriginalAlpha,s.transitioning=!0,"slide"==a?(t.x=-(0|g[T].x),t.y=-(0|g[T].y),t.cache(0,0,(c+1)/t.scaleX,(u+1)/t.scaleY),z.cache(0,0,(c+1)/z.scaleX,(u+1)/z.scaleY),s.addChild(t),s.addChild(z),e.animate(z,g[T],s.speed,null,k,[z,t]),e.animate(t,[{x:0},{x:0},{y:0},{y:0}][T],s.speed)):"reveal"==a?(t.cache(0,0,(c+1)/t.scaleX,(u+1)/t.scaleY),z.cache(0,0,(c+1)/z.scaleX,(u+1)/z.scaleY),s.addChild(t),s.addChild(z),e.animate(z,b[T],s.speed,null,k,[z,t])):"fade"==a?(t.cache(0,0,(c+1)/t.scaleX,(u+1)/t.scaleY),z.cache(0,0,(c+1)/z.scaleX,(u+1)/z.scaleY),t.alpha=1,s.addChild(t),s.addChild(z),e.animate(z,{alpha:0},s.speed,null,k,[z,t])):"black"==a?(t.cache(0,0,(c+1)/t.scaleX,(u+1)/t.scaleY),z.cache(0,0,(c+1)/z.scaleX,(u+1)/z.scaleY),t.alpha=1,s.addChild(t),s.addChild(z),l.alpha=0,s.addChild(l),e.animate(l,{alpha:1},s.speed/2,null,E,[l,z,t])):"clear"==a?(t.cache(0,0,(c+1)/t.scaleX,(u+1)/t.scaleY),z.cache(0,0,(c+1)/z.scaleX,(u+1)/z.scaleY),t.alpha=0,s.addChild(t),s.addChild(z),e.animate(z,{alpha:0},s.speed/2),e.animate(t,{alpha:1},s.speed/2,null,k,[z,t],s.speed/2)):"white"==a?(t.cache(0,0,(c+1)/t.scaleX,(u+1)/t.scaleY),z.cache(0,0,(c+1)/z.scaleX,(u+1)/z.scaleY),t.alpha=1,s.addChild(t),s.addChild(z),d.alpha=0,s.addChild(d),e.animate(d,{alpha:1},s.speed/2,null,E,[d,z,t])):(s.transitioning=!1,s.addChild(t),s.removeChild(z),y=!0),s.lastPage=z,s.page=t,zot(f)&&(f=!1),s.fromSwipe=f,s.dispatchEvent("page"),z=t,r.stage&&r.stage.update()}},this.resize=function(){c=r.getBounds().width,u=r.getBounds().height,"none"==o&&i==[]||w()},this.puff=function(e){for(var o=0;o<t.length;o++)s.addChild(t[o].page);s.addChild(z),e>0&&setTimeout(function(){s.settle()},e)},this.settle=function(){s.removeAllChildren(),s.addChild(z),s.dispatchEvent("puffed")},this.disable=function(){s.active=!1},this.enable=function(){s.active=!0},this.dispose=function(){return s.swipe.off("swipe",b),s.removeAllChildren(),t=null,!0}}else zog("zim controls - Pages():\nholder object must have bounds set");function w(){(l=new createjs.Shape).graphics.f("black").r(0,0,c,u+1),(d=new createjs.Shape).graphics.f("white").r(0,0,c,u+1)}},e.extend(e.Pages,e.Container,"clone","zimContainer",!1),zot(e.ACTIONEVENT)&&(e.ACTIONEVENT="mousedown"),e.HotSpots=function(t,o,n){var i;if(i=zob(e.HotSpots,arguments,"spots, local, mouseDowns",this))return i;if(z_d("72"),this.zimContainer_constructor(),this.type="HotSpots",!zot(t)&&Array.isArray(t)){zot(o)&&(o=!0),zot(n)&&(n=!1);for(var r,a,s="mousedown"!=e.ACTIONEVENT||!window.zns&&"mousedown"!=ACTIONEVENT?"click":"mousedown",l=[],d=0;d<t.length;d++)c(t[d]);this.addHotSpot=function(e,o,n){r={page:e,rect:o,call:n},t.push(r),c(r)},this.show=function(){for(var e=0;e<l.length;e++)(a=l[e]).button||a.show()},this.hide=function(){for(var e=0;e<l.length;e++)(a=l[e]).hide()},this.removeHotSpots=function(o,i){for(var d=t.length-1;d>=0;d--)r=t[d],a=l[d],i&&!Array.isArray(i)&&(i=[i.x,i.y,i.getBounds().width,i.getBounds().height]),(zot(o)&&zot(i)||zot(i)&&o==r.page||zot(o)&&e.arraysEqual(i,r.rect)||o==r.page&&e.arraysEqual(i,r.rect))&&(t.splice(d,1),a.button&&(a.button.off(s,a.button.zimHSEvent),a.button.zimHSEvent=null,n||(a.button.off("mousedown",a.button.zimHSMDEvent),a.button.zimHSMDEvent=null)),a.off(s,u),a.dispose(),l.splice(d,1))},this.dispose=function(){for(var e=0;e<l.length;e++)(a=l[e]).button&&(a.button.off(s,a.button.zimHSEvent),a.button.zimHSCall=null,a.button.zimHSEvent=null,n||(a.button.off("mousedown",a.button.zimHSMDEvent),a.button.zimHSMDEvent=null)),a.off(s,u),a.dispose();return!0}}else zog("zim controls - HotSpots():\nplease provide an array of HotSpot data");function c(t){var i=null;if(!Array.isArray(t.rect)){if(!(i=t.rect))return void zog("zim controls - HotSpots(): HotSpot "+t.page+" "+t.rect+" button does not exist");t.rect=[i.x,i.y,1,1]}(a=new e.HotSpot(t.page,t.rect[0],t.rect[1],t.rect[2],t.rect[3],t.call,o)).zimHSpage=t.page,a.button=i,l.push(a),a.on(s,u),i&&(a.spot.mouseEnabled=!1,a.spot.mouseChildren=!1,i.zimHScall=t.call,i.zimHSEvent=i.on(s,u,!0),n||(i.zimHSMDEvent=i.on("mousedown",function(e){e.stopImmediatePropagation()})),i.cursor="pointer")}function u(e){e.stopImmediatePropagation&&e.stopImmediatePropagation(),window.event&&(window.event.cancelBubble=!0),"function"==typeof e.currentTarget.zimHScall&&e.currentTarget.zimHScall(e)}},e.extend(e.HotSpots,e.Container,"clone","zimContainer",!1),e.HotSpot=function(t,o,n,i,r,a,s){var l;if(l=zob(e.HotSpot,arguments,"obj, x, y, width, height, call, local",this))return l;if(z_d("73"),this.zimContainer_constructor(),this.type="HotSpot",!zot(t)&&t.addChild)if(t instanceof createjs.Container!=0)if(zot(o)||zot(n)||zot(i)||zot(r))zog("zim controls - HotSpot():\nPlease pass in x, y, width, height");else{zot(s)&&(s=!0),eventType="mousedown"!=e.ACTIONEVENT||!window.zns&&"mousedown"!=ACTIONEVENT?"click":"mousedown";var d=i,c=r,u=new createjs.Shape,h=new createjs.Shape;if(s)u.graphics.f("#999999").dr(o,n,d,c),h.graphics.f("#999999").dr(o,n,1,1);else{var f=t.globalToLocal(o,n),p=t.globalToLocal(o+d,n+c),m=p.x-f.x,g=p.y-f.y;u.graphics.f("#999999").dr(f.x,f.y,m,g),h.graphics.f("#999999").dr(f.x,f.y,1,1)}u.alpha=.4,u.mouseEnabled=!1,h.alpha=.01,h.cursor="pointer",this.spot=h;var z=h.on(eventType,function(e){"function"==typeof a&&a()});t.addChild(h),h.hitArea=u,this.show=function(){t.addChild(u)},this.hide=function(){t.removeChild(u)},this.dispose=function(){return h.off(eventType,z),t.removeChild(h),delete h,!0}}else zog("zim controls - HotSpot():\nObjects passed in should be Containers");else zog("zim controls - HotSpot():\nPlease pass in container object for obj")},e.extend(e.HotSpot,e.Container,"clone","zimContainer",!1),e.Manager=function(e){z_d("75");var t=this;this.items=[],this.add=function(e){Array.isArray(e)?t.items=t.items.concat(e):t.items.push(e)},this.remove=function(e){if(zot(e))t.items=[];else{var o;Array.isArray(e)||(e=[e]);for(var n=0;n<e.length;n++){o=e[n];var i=t.items.indexOf(o);-1!=i&&t.items.splice(i,1)}}},this.resize=function(){if(t)for(var e=0;e<t.items.length;e++)t.items[e].resize?t.items[e].resize():t.items.splice(e)},this.dispose=function(){for(var e=t.items.length-1;e>=0;e--)t.items[e].dispose();return t.items=[],t=null,!0}},e.ResizeManager=function(){z_d("75.5"),e.Manager.call(this,"ResizeManager")},e.ResizeManager.prototype=new e.Manager,e.ResizeManager.prototype.constructor=e.ResizeManager,e.TransformManager=function(e,t){z_d("75.7");var n=this;function i(){localStorage&&n.savePersist()}this.items=[],this.add=function(e){var t,o=[];o=Array.isArray(e)?e:[e];for(var i=!1,r=0;r<o.length;r++)t=o[r],0==n.items.length&&0==r&&(i=!0),"Blob"==t.type||"Squiggle"==t.type?(n.persistID||(i?(i=!1,t.controlsVisible=!0,n.currentObject=t):t.controlsVisible=!1),t.on("change",function(e){var t=new createjs.Event("transformed");t.transformObject=e.target,t.transformType=e.controlType,n.dispatchEvent(t)}),t.on("controlsshow",function(e){var t=new createjs.Event("transformshow");n.currentObject=t.transformObject=e.target,n.dispatchEvent(t)}),t.on("controlshide",function(e){var t=new createjs.Event("transformhide");t.transformObject=e.target,n.currentObject=null,n.dispatchEvent(t)})):(transObj=t.transformControls,n.persistID||(i?(i=!1,transObj.show(),n.currentObject=t):transObj.hide()),t.on("transformed",function(e){var t=new createjs.Event("transformed");t.transformObject=e.target,t.transformType=e.transformType,n.dispatchEvent(t)}),t.on("transformshow",function(e){var t=new createjs.Event("transformshow");n.currentObject=t.transformObject=e.target,n.dispatchEvent(t)}),t.on("transformhide",function(e){var t=new createjs.Event("transformhide");t.transformObject=e.target,n.currentObject=null,n.dispatchEvent(t)}));n.items=n.items.concat(e)},this.remove=function(e){if(zot(e))n.items=[];else{var o;Array.isArray(e)||(e=[e]);for(var i=0;i<e.length;i++){o=e[i],n.currentObject==o&&(n.currentObject=null),o.transformedEvent&&(o.off("transformed",o.transformedEvent),o.transformedEvent=null),"Blob"==o.type||"Squiggle"==o.type?o.controlsVisible=!1:o.transformControls.remove();var r=n.items.indexOf(o);-1!=r&&n.items.splice(r,1)}t&&n.savePersist()}},this.show=function(e){if(!zot(e)){if("Blob"==e.type||"Squiggle"==e.type)e.controlsVisible||(e.controlsVisible=!0);else{var t=e.transformControls;if(!t||t.visible)return;t.show()}n.currentObject=e}},this.hide=function(e){if(!zot(e))if(n.currentObject==e&&(n.currentObject=null),"Blob"==e.type||"Squiggle"==e.type)e.controlsVisible&&(e.controlsVisible=!1);else{var t=e.transformControls;if(!t||t.visible)return;t.hide()}},this.hideAll=function(e){for(var t,o,i=0;i<n.items.length;i++)if((o=n.items[i])&&(o.transformControls||o.update)){if(n.items[i]==e)continue;"Blob"==o.type||"Squiggle"==o.type?o.controlsVisible&&(o.controlsVisible=!1):(t=n.items[i].transformControls).visible&&t.hide()}else n.items.splice(i);n.currentObject=null},this.resize=function(){if(n){for(var e,o=0;o<n.items.length;o++)(e=n.items[o])&&(e.transformControls||e.update)?"Blob"==e.type||"Squiggle"==e.type?e.update():e.transformControls.resize():n.items.splice(o);t&&n.savePersist()}},zot(e)||n.add(e);var r="TransformManager persist(persistID) - sorry, must provide id";this.persist=function(e){if(zot(e)&&zon)zog(r);else{if(n.persistID=e,localStorage&&localStorage[e]){var t=n.persistData=JSON.parse(localStorage[e]);if(t.length==n.items.length)for(var o=0;o<n.items.length;o++)t[o].controlsVisible&&(n.currentObject=n.items[o]),!t[o]||"Blob"!=t[o].type&&"Squiggle"!=t[o].type?t[o]&&n.items[o].transformControls.setData(t[o]):n.items[o].setData(t[o])}var a;for(o=0;o<n.items.length;o++)(a=n.items[o]).transformedEvent||("Blob"==a.type||"Squiggle"==a.type?(a.transformedEvent=a.on("change",i),a.transformedEvent=a.on("controlsshow",i),a.transformedEvent=a.on("controlshide",i)):(a.transformedEvent=a.on("transformed",i),a.transformedEvent=a.on("transformshow",i),a.transformedEvent=a.on("transformhide",i)))}},this.savePersist=function(){for(var e=[],t=0;t<n.items.length;t++)it=n.items[t],"Blob"==it.type||"Squiggle"==it.type?it.recordData&&e.push(it.recordData()):it.transformControls&&it.transformControls.recordData&&e.push(it.transformControls.recordData());n.persistData=e,localStorage[n.persistID]=JSON.stringify(e)},this.clearPersist=function(e){zot(e)&&zon?zog(r):(n.persistData=null,localStorage&&localStorage.removeItem(e))},this.stopPersist=function(){for(var e=0;e<n.items.length;e++)it=n.items[e],it.transformedEvent&&("Blob"==it.type||"Squiggle"==it.type?it.off("change",it.transformedEvent):it.off("transformed",it.transformedEvent),it.transformedEvent=null);n.persistData=null},zot(t)||n.persist(t),this.dispose=function(e,t){if(zot(e)&&(e=!0),n.removeAllEventListeners(),n.persistID&&e&&n.stopPersist(),t)for(var i=0;i<n.items.length;i++)o=n.items[i],"Blob"==o.type||"Squiggle"==o.type?o.dispose():o.transformControls.dispose()}},e.extend(e.TransformManager,createjs.EventDispatcher,null,"cjsEventDispatcher",!1),e.Guide=function(t,o,n,i,r){var a;if(a=zob(e.Guide,arguments,"obj, vertical, percent, hideKey, pixelKey",this))return a;if(z_d("76"),this.zimContainer_constructor(),this.type="Guide",zot(t)&&(t=zimDefaultFrame?zimDefaultFrame.stage:"stage"),zot(o)&&(o=!0),"stage"==t||t.addChild&&t.getBounds&&t.getBounds()){zot(n)&&(n=!0),zot(i)&&(i="G"),zot(r)&&(r="P");var s,l,d,c,u,h=this,f=80,p=26,m=f/6+f/2,g=2*p;o?((c=T("#00c5af","white","white")).shape.regX=f+f/6,c.shape.regY=p/2,c.label.x=-f/2-f/6):((c=T("#d61fa0","white","white")).shape.regX=f/2,c.shape.regY=p+p/4,c.label.y=3*-p/4),"stage"!=t&&t.addChild(h);var z,v,b,y,w=e.added(h,function(){"stage"==t?(u=h.stage,t=u):u=t.stage;t.addChild(h),z=t.getBounds().width,v=t.getBounds().height,o?(c.y=v/2,c.label.text="y:"+(h.pixels?Math.round(70*z/100):"70%")):(c.x=z/2,c.label.text="x:"+(h.pixels?Math.round(70*v/100):"70%"));b=new createjs.Shape,h.addChild(b),o?b.x=.7*z:b.y=.7*v,x||(t.addChild(h),E());u.off("stagemousemove",s),s=u.on("stagemousemove",k),u.update()}),x=!1,C={x:0,y:0};Object.defineProperty(this,"pixels",{get:function(){return!n},set:function(e){n=!e,h.resize()}}),window.addEventListener("keydown",M),this.resize=function(){return!!h&&(u&&(E(),k()),!0)},this.dispose=function(){return!!h&&(e.noDrag(b),clearInterval(w),h.removeAllChildren(),window.removeEventListener("keydown",M),h.parent&&h.parent.removeChild(h),h=null,!0)}}else zog("zim controls - Guide(): Please provide container with bounds for the obj (setBounds())");function T(t,o,n){var i=new e.Container;return i.shape=new createjs.Shape,i.shape.graphics.s(o).ss(1).f(t).r(0,0,f,p),i.shape.alpha=.9,i.addChild(i.shape),i.label=new createjs.Text("10","16px verdana",n),i.label.textAlign="center",i.label.textBaseline="middle",i.addChild(i.label),i.mouseChildren=!1,i.mouseEnabled=!1,i}function k(e){var i,r;e?(i=t.globalToLocal(e.rawX,e.rawY),C=i):i={x:C.x,y:C.y},n?o?(r=Math.round(Math.abs(i.x-b.x)/z*100),c.label.text="x:"+Math.max(0,Math.min(r,100))+"%",c.y=Math.max(g,Math.min(i.y,d))):(r=Math.round(Math.abs(i.y-b.y)/v*100),c.label.text="y:"+Math.max(0,Math.min(r,100))+"%",c.x=Math.max(m,Math.min(i.x,l))):o?(r=Math.round(Math.abs(i.x-b.x)),c.label.text="x:"+Math.max(0,Math.min(r,Math.round(z))),c.y=Math.max(g,Math.min(i.y,d))):(r=Math.round(Math.abs(i.y-b.y)),c.label.text="y:"+Math.max(0,Math.min(r,Math.round(v))),c.x=Math.max(m,Math.min(i.x,l))),u&&u.update()}function E(){var n;x=!0,z=t.getBounds().width,v=t.getBounds().height,o?(n="ew-resize",y=new createjs.Rectangle(0,0,z,0)):(n="ns-resize",y=new createjs.Rectangle(0,0,0,v)),e.noDrag(b),setTimeout(function(){e.drag(b,y,n,n,null,null,!0)},500),u.mouseMoveOutside=!0,u.enableMouseOver(10),l=z-2*f/3,d=v-p-p,b.uncache();var i=b.graphics;o?(i.c().s("rgba(0,255,255,.1)").ss(20).mt(0,0).lt(0,v),i.f().s("white").ss(2).mt(0,0).lt(0,v),i.s("#00c5af").sd([20,20]).mt(0,0).lt(0,v).sd(),b.cache(-10,0,20,v)):(i.c().s("rgba(255,0,255,.1)").ss(20).mt(0,0).lt(z,0),i.f().s("white").ss(2).mt(0,0).lt(z,0),i.s("#d61fa0").sd([20,20]).mt(0,0).lt(z,0).sd(),b.cache(0,-10,z,20)),o?c.x=z:c.y=v,h.addChild(c)}function M(e){e||(e=event),u&&(String.fromCharCode(e.keyCode)==i.toUpperCase()&&(h.visible=!h.visible,u.off("stagemousemove",s),h.visible&&(s=u.on("stagemousemove",k,h)),u.update()),String.fromCharCode(e.keyCode)==r.toUpperCase()&&(h.pixels=!h.pixels))}},e.extend(e.Guide,e.Container,"clone","zimContainer",!1),e.GuideManager=function(){z_d("77"),e.Manager.call(this,"GuideManager")},e.GuideManager.prototype=new e.Manager,e.GuideManager.prototype.constructor=e.GuideManager,e.Grid=function(t,o,n,i,r){var a;if(a=zob(e.Grid,arguments,"obj, color, percent, hideKey, pixelKey",this))return a;if(z_d("78"),this.zimContainer_constructor(),this.type="Grid",zot(t)&&(t=zimDefaultFrame?zimDefaultFrame.stage:"stage"),zot(o)&&(o="black"),"stage"==t||t.addChild&&t.getBounds&&t.getBounds()){zot(n)&&(n=!0),zot(i)&&(i="G"),zot(r)&&(r="P");var s,l=this,d=10;this.mouseChildren=!1,this.mouseEnabled=!1;var c=80,u=26,h=k("#dddddd",o,"#333333");h.shape.regX=c/2,h.shape.regY=-u/4,h.label.y=3*u/4;var f=k("#dddddd",o,"#333333");f.shape.regX=-c/6,f.shape.regY=u/2,f.label.x=c/2+c/6;var p,m,g,z=c/6+c/2,v=2*u;h.x=z,f.y=v,h.label.text="x:0",f.label.text="y:0","stage"!=t&&t.addChild(l);var b,y,w,x=e.added(l,function(){"stage"==t?(g=l.stage,t=g):g=t.stage;C||(M(),t.addChild(l));g.off("stagemousemove",s),s=g.on("stagemousemove",E),g.update()}),C=!1,T={x:0,y:0};Object.defineProperty(this,"pixels",{get:function(){return!n},set:function(e){n=!e,l.resize()}}),window.addEventListener("keydown",j),this.resize=function(){return!!l&&(l.removeChild(w),w=null,g&&(M(),E(),setTimeout(function(){l.removeChild(w),w=null,M()},200)),!0)},this.dispose=function(){return clearInterval(x),l.removeAllChildren(),window.removeEventListener("keydown",j),l.parent&&l.parent.removeChild(l),l=null,!0}}else zog("zim controls - Grid(): Please provide container with bounds for the obj (setBounds())");function k(t,o,n){var i=new e.Container;return i.shape=new createjs.Shape,i.shape.graphics.s(o).ss(1).f(t).r(0,0,c,u),i.shape.alpha=.9,i.addChild(i.shape),i.label=new createjs.Text("10","16px verdana",n),i.label.textAlign="center",i.label.textBaseline="middle",i.addChild(i.label),i.mouseChildren=!1,i.mouseEnabled=!1,i}function E(e){var o;e?(o=t.globalToLocal(e.rawX,e.rawY),T=o):o={x:T.x,y:T.y},n?(h.label.text="x:"+Math.max(0,Math.min(Math.round(o.x/b*100),100))+"%",h.x=Math.max(z,Math.min(o.x,p)),f.label.text="y:"+Math.max(0,Math.min(Math.round(o.y/y*100),100))+"%",f.y=Math.max(v,Math.min(o.y,m))):(h.label.text="x:"+Math.max(0,Math.min(Math.round(o.x),Math.round(b))),h.x=Math.max(z,Math.min(o.x,p)),f.label.text="y:"+Math.max(0,Math.min(Math.round(o.y),Math.round(y))),f.y=Math.max(v,Math.min(o.y,m))),g&&g.update()}function M(){C=!0,t&&t.getBounds&&(b=t.getBounds().width,y=t.getBounds().height),g&&(g.mouseMoveOutside=!0,g.enableMouseOver(10)),p=b-2*c/3,m=y-u-u,w=new e.Container,l.addChild(w);var i=new createjs.Shape;w.addChild(i);var r=i.graphics;r.s(o).ss(1);var a=new createjs.Shape;if(w.addChild(a),n){for(s=1;s<22;s++)r.mt(s*b/20,0).lt(s*b/20,y);for(s=1;s<20;s++)r.mt(0,s*y/20).lt(b,s*y/20);i.alpha=.3,(r=a.graphics).s(o).ss(1);for(s=1;s<10;s++)r.mt(s*b/10,0).lt(s*b/10,y);for(s=1;s<10;s++)r.mt(0,s*y/10).lt(b,s*y/10)}else{for(var s=0;s<b/d;s++)r.mt(s*d,0).lt(s*d,y);for(var s=0;s<y/d;s++)r.mt(0,s*d).lt(b,s*d);i.alpha=.3,(r=a.graphics).s(o).ss(1);for(var s=0;s<b/(10*d);s++)r.mt(s*(10*d),0).lt(s*(10*d),y);for(var s=0;s<y/(10*d);s++)r.mt(0,s*(10*d)).lt(b,s*(10*d))}r.s("#FFFFFF").ss(8),r.mt(b/2,y/2-40).lt(b/2,y/2+40),r.mt(b/2-40,y/2).lt(b/2+40,y/2),r.s("#000000").ss(4),r.mt(b/2,y/2-40).lt(b/2,y/2+40),r.mt(b/2-40,y/2).lt(b/2+40,y/2),r.s(o).ss(3),r.dr(0,0,b,y),a.alpha=.5,w.cache(0,0,b,y),l.addChild(h),l.addChild(f),g&&g.update()}function j(e){e||(e=event),g&&(String.fromCharCode(e.keyCode)==i.toUpperCase()&&(l.visible=!l.visible,g.off("stagemousemove",s),l.visible&&(s=g.on("stagemousemove",E,l)),g.update()),String.fromCharCode(e.keyCode)==r.toUpperCase()&&(l.removeChild(w),w=null,l.pixels=!l.pixels))}},e.extend(e.Grid,e.Container,"clone","zimContainer",!1),e.GridManager=function(){z_d("79"),e.Manager.call(this,"GridManager")},e.GridManager.prototype=new e.Manager,e.GridManager.prototype.constructor=e.GridManager,e.Layout=function(t,o,n,i,r,a,s,l){var d;if(d=zob(e.Layout,arguments,"holder, regions, lastMargin, backgroundColor, vertical, regionShape, scalingObject, hideKey",this))return d;if(z_d("80"),this.cjsEventDispatcher_constructor(),!zot(t)&&t.getBounds)if((s=zot(s)?t:s).getBounds&&s.getBounds()){var c=s.getBounds();t.setBounds(0,0,c.width,c.height),zot(n)&&(n=0),zot(r)&&(r=!0),zot(i)&&(i=""),zot(l)&&(l="B");var u,h=new createjs.Shape,f=this;this.active=!0,this.regions=o;var p=0,m="minWidth",g="width",z="height",v="marginLeft",b="maxHeight";r&&(m="minHeight",g="height",z="width",v="marginTop",b="maxWidth","y","x");for(var y=0;y<o.length;y++){if(!(u=o[y]).object||!u.object.getBounds())return void zog("zim controls - Layout(): each region object must have an object with setBounds() set");u[m]||(u[m]=0),u[g]||(u[g]=0),u.backgroundColor||(u.backgroundColor=""),u.given=0,u.maxGiven=0,u[v]||(u[v]=0),u[b]||(u[b]=100),r?(u.align||(u.align="middle"),u.valign||(0==y?u.valign="top":y==o.length-1?u.valign="bottom":u.valign="middle",1==o.length&&(u.valign="middle"))):(u.valign||(u.valign="top"),u.align||(0==y?u.align="left":y==o.length-1?u.align="right":u.align="middle",1==o.length&&(u.align="middle"))),u[g]&&(u[m]=0),p+=u[g]+u[v]}if((p+=n)>100)zog("zim controls - Layout(): cannot fit regions into 100% bounds");else{var w=100-p;x(),this.resize=function(){if(f.active){c=s.getBounds(),t.setBounds(0,0,c.width,c.height),h.graphics.clear(),""!=i&&h.graphics.f(i).r(0,0,c.width,c.height);for(var l=0;l<o.length;l++)(u=o[l]).maxGiven=0,u.marginGiven=0;for(var d,y,C=!0,T=w;C;){0,C=!1,d=!0;for(l=0;l<o.length;l++)(u=o[l]).given>0&&0==u.maxGiven&&(A=u.object.getBounds()[g],(P=u.object.getBounds()[z])/A*(u.given*c[g]/100)>(y=u[b]*c[z]/100)?(u.maxGiven=A/P*y*100/c[g],u.given-u.maxGiven,T-=u.maxGiven):d=!1);if(d)break;totalPrimaries=0;for(l=0;l<o.length;l++)0==(u=o[l])[g]&&0==u.maxGiven&&(totalPrimaries+=u.object.getBounds()[g]);for(l=0;l<o.length;l++)0==(u=o[l])[g]&&0==u.maxGiven&&(u.given=u.object.getBounds()[g]/totalPrimaries*T)}var k=!0;if((u=o[0]).maxGiven>0?u.maxGiven<u[m]&&(u[g]=u[m],k=!1):u.given>0&&u.given<u[m]&&(u[g]=u[m],k=!1),(u=o[o.length-1]).maxGiven>0?u.maxGiven<u[m]&&(u[g]=u[m],k=!1):u.given>0&&u.given<u[m]&&(u[g]=u[m],k=!1),!k){p=0;for(l=0;l<o.length;l++)u=o[l],p+=u[g]+u[v];return(p+=n)>100?void zog("zim display - Layout(): cannot fit regions into 100% bounds"):(w=100-p,x(),void f.resize())}var E=!0,M=0,j=0;for(l=0;l<o.length;l++)M+=(u=o[l])[v],u[g]>0?j+=u[g]:u.maxGiven>0?j+=u.maxGiven:u.given>0&&(j+=u.given),0==u[g]&&(E=!1);if(E||d){var S=100-j-(M+=n);if(M-=n+o[0][v],0!=S&&0!=M)for(l=0;l<o.length;l++)0!=l&&((u=o[l]).marginGiven=u[v]/M*(M+S))}var A,P,O,I,D,B=0,L=0;if(a&&a.graphics){var X=a.graphics;X.c()}for(l=0;l<o.length;l++)(u=o[l]).marginGiven>0?B+=u.marginGiven*c[g]/100:B+=u[v]*c[g]/100,A=(A=u[g]>0?u[g]:u.maxGiven>0?u.maxGiven:u.given>0?u.given:0)*c[g]/100,P=u[b]*c[z]/100,L=(c[z]-P)/2,O=r?e.fit(u.object,L,B,P,A):e.fit(u.object,B,L,A,P),"top"==u.valign?u.object.y=O.bY:"bottom"==u.valign&&(u.object.y=O.bY+O.bHeight-O.height),"left"==u.align?u.object.x=O.bX:"right"==u.align&&(u.object.x=O.bX+O.bWidth-O.width),a&&a.graphics&&(X.s("white").ss(2).r(O.bX,O.bY,O.bWidth,O.bHeight),X.s("#ff8203").sd([20,20]).r(O.bX,O.bY,O.bWidth,O.bHeight).sd()),D=I=0,0!=B&&B+A!=c[g]||(r?D=1:I=1),P==c[z]&&(r?I=1:D=1),""!=u.backgroundColor&&h.graphics.f(u.backgroundColor).r(O.bX,O.bY,O.bWidth+I,O.bHeight+D),B+=A}},this.resize(),a&&t.addChild(a),t.addChildAt(h,0),window.addEventListener("keydown",C),this.disable=function(){f.active=!1,window.removeEventListener("keydown",C),a&&(a.alpha=0)},this.enable=function(){f.active=!0,window.addEventListener("keydown",C),f.resize(),a&&(a.alpha=1)},this.removeShape=function(){a&&(a.graphics.clear(),t.removeChild(a),a=null,a=!1),window.removeEventListener("keydown",C)},this.addShape=function(e,o){f.removeShape(),a=e,window.addEventListener("keydown",C),t.addChild(a),f.resize()},this.dispose=function(){return f.removeShape(),!0}}}else zog("zim controls - Layout(): holder must have bounds set or provide a scalingObject with bounds");else zog("zim controls - Layout(): please provide an object with bounds set that holds the objects being laid out");function x(){for(var e=0,t=0;t<o.length;t++)(u=o[t]).given=0,0==u[g]&&(e+=u.object.getBounds()[g]);for(t=0;t<o.length;t++)0==(u=o[t])[g]&&(u.given=u.object.getBounds()[g]/e*w)}function C(e){e||(e=event),a&&String.fromCharCode(e.keyCode)==l.toUpperCase()&&(a.visible=!a.visible,a.stage&&a.stage.update())}},e.extend(e.Layout,createjs.EventDispatcher,null,"cjsEventDispatcher",!1),e.LayoutManager=function(){z_d("81");var e=this;this.items=[],this.add=function(t){e.items.push(t)},this.resize=function(){for(var t=0;t<e.items.length;t++)e.items[t].resize()},this.disable=function(){for(var t=0;t<e.items.length;t++)e.items[t].disable()},this.enable=function(){for(var t=0;t<e.items.length;t++)e.items[t].enable()},this.dispose=function(){for(var t=0;t<e.items.length;t++)e.items[t].removeShape();return!0}},e.Tile=function(t,o,n,i,r,a,s,l,d){var c;if(c=zob(e.Tile,arguments,"obj, cols, rows, count, spacingH, spacingV, mirrorH, mirrorV, snapToPixel",this))return c;z_d("66.5"),this.zimContainer_constructor(),this.type="Tile",zot(o)&&(o=1),zot(n)&&(n=1),0==i&&(i=null,zon&&zog("ZIM Tile() - count parameter of 0 is ignored - see docs")),zot(r)&&(r=0),zot(a)&&(a=0),zot(s)&&(s=!1),zot(l)&&(l=!1),zot(d)&&(d=!0),d&&(t.stage?t.stage.snapToPixelEnabled=!0:zimDefaultFrame&&(zimDefaultFrame.stage.snapToPixelEnabled=!0));var u,h,f=this,p=0,m=0,g=0;e:for(var z=0;z<n;z++){h=0,m=0;for(var v=0;v<o;v++){if(p++,!zot(i)&&p>i)break e;var b=(u=zik(t).clone()).width,y=u.height;y>h&&(h=y),u.snapToPixel=d,this.addChild(u),s&&v%2==1?(u.scaleX=-u.scaleX,u.x=m+b-2*u.getBounds().x*u.scaleX):u.x=m,l&&z%2==1?(u.scaleY=-u.scaleY,u.y=g+y-2*u.getBounds().y*u.scaleY):u.y=g,m+=b+r}g+=h+a}this.clone=function(){return f.cloneProps(new e.Tile(t,o,n,i,r,a,s,l,d))}},e.extend(e.Tile,e.Container,"clone","zimContainer",!1),e.Parallax=function(t,o,n,i){var r;if(r=zob(e.Parallax,arguments,"layers, damp, auto, stage",this))return r;if(z_d("68"),zot(i))if(t&&t[0]&&t[0].obj&&t[0].obj.stage)i=t[0].obj.stage;else{if(!zimDefaultFrame)return;i=zimDefaultFrame.stage}n=!!zot(n);var a=i.getBounds().width,s=i.getBounds().height,l=this,d=zot(o)?.1:o;this.addLayer=function(t){if(!(zot(t.obj)||zot(t.prop)||zot(t.propChange))){var o={obj:t.obj,prop:t.prop};o[o.prop]=t.propChange,zot(t.input)&&(t.input="mouseX"),o.input=t.input,o.split=zot(t.split)?!("mouseX"!=t.input||!n):t.split;var i=zot(t.inMin)?0:t.inMin,r=zot(t.inMax)?"mouseX"==t.input||"scrollX"==t.input?a:s:t.inMax,l=zot(t.factor)?1:t.factor,u=!zot(t.integer)&&t.integer;return o["p_"+o.prop]=new e.ProportionDamp(i,r,0,o[o.prop],d,l,u),"scale"==o.prop?o["s_"+o.prop]=o.obj.scaleX:"frame"==o.prop?o["s_"+o.prop]=o.obj.currentFrame:o["s_"+o.prop]=o.obj[o.prop],zot(t.immediate)||o["p_"+o.prop].immediate(t.immediate),c.push(o),c.length-1}},this.removeLayer=function(e){if(!zot(e)){var t=c[e];t["p_"+t.prop].dispose(),c.splice(e,1)}},this.immediate=function(e){for(var t,o=0;o<c.length;o++)(t=c[o])["p_"+t.prop].immediate(e[o])},this.dispose=function(){return c=null,n&&e.Ticker.remove(h),!0},t=zot(t)?[]:t;for(var c=[],u=0;u<t.length;u++)this.addLayer(t[u]);if(n)var h=e.Ticker.add(function(e){l.step()},i);this.step=function(t){for(var o,n,r=0;r<c.length;r++)o=c[r],zot(t)?"mouseX"==o.input?n=i.mouseX:"mouseY"==o.input?n=i.mouseY:"scrollX"==o.input?n=e.scrollX():"scrollY"==o.input&&(n=e.scrollY()):n=t,"scale"==o.prop?o.obj.scaleX=o.obj.scaleY=o["s_"+o.prop]+o["p_"+o.prop].convert(n):"frame"==o.prop?o.obj.gotoAndStop(o["s_"+o.prop]+o["p_"+o.prop].convert(n)):(o.obj[o.prop]=o["s_"+o.prop]+o["p_"+o.prop].convert(n),o.split&&(o.obj[o.prop]-=o[o.prop]/2))},Object.defineProperty(l,"damp",{get:function(){return d},set:function(e){var t;d=e;for(var o=0;o<c.length;o++)(t=c[o])["p_"+t.prop].damp=d}})},e.Scroller=function(t,o,n,i,r,a,s){var l;if(l=zob(e.Scroller,arguments,"backing, speed, direction, horizontal, gapFix, stage, container",this))return l;z_d("69"),this.cjsEventDispatcher_constructor();var d=this.backing1=t;if(!zot(d)&&d.getBounds){var c=this.backing2=t.clone();zot(i)&&(i=!0),zot(r)&&(r=0);var u=this;this.speed=zot(o)?1:o;var h=this.baseSpeed=this.speed;this.direction=zot(n)?1:n;var f=i?d.scaleX:d.scaleY;if(d.getBounds())if(a||d.stage)if(d.parent)if(d.parent.addChildAt(c,d.parent.getChildIndex(d)),a=a||d.stage,zot(s)&&(s=a),s.getBounds()){var p,m,g=d.getBounds().width*f-r,z=d.getBounds().height*f-r;i?c.x=g:c.y=z;var v=!1,b=e.Ticker.add(function(e){p||(p=s.getBounds().width,m=s.getBounds().height);if(0==u.speed||0==u.direction)return;i?(d.x-=u.speed*u.direction,d.x<c.x?c.x=d.x+g:c.x=d.x-g,u.direction*u.speed>0?c.x<0&&d.x<c.x?d.x=c.x+g:d.x<0&&c.x<d.x&&(c.x=d.x+g):c.x>p&&c.x>d.x?c.x=d.x-g:d.x>p&&d.x>c.x&&(d.x=c.x-g)):(d.y-=u.speed*u.direction,d.y<c.y?c.y=d.y+z:c.y=d.y-z,u.direction*u.speed>0?c.y<0&&d.y<c.y?d.y=c.y+z:d.y<0&&c.y<d.y&&(c.y=d.y+z):c.y>m&&c.y>d.y?c.y=d.y-z:d.y>m&&d.y>c.y&&(d.y=c.y-z))},a);this.paused=!1,this.pause=function(t,o){return zot(t)&&(t=!0),zot(o)&&(o=0),t?(h=u.speed,o>0?(v=!0,e.animate({target:u,obj:{pausingSpeed:0},ticker:!1,time:o,call:function(){u.speed=0,u.paused=!0,v=!1,u.dispatchEvent("pause")}})):(v=!1,u.speed=0,u.paused=!0,setTimeout(function(){u.dispatchEvent("pause")},10))):(v=!1,o>0?e.animate({target:u,obj:{pausingSpeed:h},ticker:!1,time:o,call:function(){u.speed=h,u.paused=!1,v=!1}}):(u.speed=h,u.paused=!1)),u},Object.defineProperty(u,"percentSpeed",{get:function(){return 0==u.baseSpeed?NaN:u.speed/u.baseSpeed*100},set:function(e){v||u.paused||(u.speed=u.baseSpeed*e/100)}}),Object.defineProperty(u,"pausingSpeed",{get:function(){return 0==u.baseSpeed?NaN:u.speed/u.baseSpeed*100},set:function(e){u.speed=u.baseSpeed*e/100}}),this.dispose=function(){return zon&&zog("bye from Scroller"),e.Ticker.remove(b),!0}}else zog("zim display - Scroller(): please setBounds() on container or stage if no container");else zog("zim display - Scroller(): please add object to container or stage before adding to Scroller");else zog("zim display - Scroller(): please pass in stage parameter or add backing objects to stage to start");else zog("zim display - Scroller(): please setBounds() on backing objects")}},e.extend(e.Scroller,createjs.EventDispatcher,null,"cjsEventDispatcher"),e.Dynamo=function(t,o,n,i,r,a,s,l,d){var c;if(c=zob(e.Dynamo,arguments,"sprite, speed, label, startFrame, endFrame, update, reversible, flip, flipVertical",this))return c;z_d("69.2"),this.cjsEventDispatcher_constructor();var u=this.frames=t.parseFrames(n,i,r,!0);if(0!=u.length){this.totalFrames=u.length;var h=0;zot(o)&&(o=30),zot(s)&&(s=!0);var f=this.baseSpeed=this.speed=o;zot(a)&&(a=!1),zot(l)&&0==s&&(l=!0);var p,m,g,z,v,b=this,y=Date.now(),w=!1;b.scaleX=t.scaleX,b.scaleY=t.scaleY,function e(){if(p=requestAnimationFrame(e),m=u[h].s,0!=b.speed&&0!=m&&(z=1e3/Math.abs(b.speed)*m,(g=Date.now())-y>z)){y=g;var o=b.frame+(b.speed>0||!s?1:-1),n=!1;o>=u.length&&(n=!0,o=0),o<0&&(n=!0,o=u.length-1),b.frame=o,l&&(b.speed<0?t.scaleX=-b.scaleX:t.scaleX=b.scaleX),d&&(b.speed<0?t.scaleY=-b.scaleY:t.scaleY=b.scaleY),n&&b.dispatchEvent("loop"),b.dispatchEvent("change"),a&&t.stage&&t.stage.update(),zot(v)||v!=b.frame||(w=!1,b.speed=0,b.paused=!0,b.dispatchEvent("pause"))}}(),this.paused=!1,this.pause=function(t,o,n){return zot(t)&&(t=!0),zot(o)&&(o=0),t?(f=b.speed,zot(n)?o>0?(w=!0,e.animate({target:b,obj:{pausingSpeed:0},ticker:!1,time:o,call:function(){w=!1,b.speed=0,b.paused=!0,b.dispatchEvent("pause")}})):(w=!1,b.speed=0,b.paused=!0,setTimeout(function(){b.dispatchEvent("pause")},10)):(w=!0,v=n)):(v=null,o>0?(w=!0,e.animate({target:b,obj:{pausingSpeed:f},ticker:!1,time:o,call:function(){w=!1,b.speed=f,b.paused=!1}})):(w=!1,b.speed=f,b.paused=!1)),b},Object.defineProperty(b,"frame",{get:function(){return h},set:function(e){h=Math.round(e)%u.length;var o=u[h];zot(o)||(t.frame=o.f)}}),Object.defineProperty(b,"percentSpeed",{get:function(){return 0==b.baseSpeed?NaN:b.speed/b.baseSpeed*100},set:function(e){w||b.paused||(b.speed=b.baseSpeed*e/100)}}),Object.defineProperty(b,"pausingSpeed",{get:function(){return 0==b.baseSpeed?NaN:b.speed/b.baseSpeed*100},set:function(e){b.speed=b.baseSpeed*e/100}}),this.dispose=function(){cancelAnimationFrame(p)}}},e.extend(e.Dynamo,createjs.EventDispatcher,null,"cjsEventDispatcher"),e.Accelerator=function(e){z_d("69.3"),this.cjsEventDispatcher_constructor();var t=this;this.paused=!1,this.items=[],this.paused=!1,this._percentSpeed=100,this.add=function(e){var o;o=Array.isArray(e)?e:[e];for(var n=0;n<o.length;n++)t.items.indexOf(o[n])<0&&o[n].pause&&t.items.push(o[n]);return t},e&&this.add(e),this.remove=function(e){var o,n;o=Array.isArray(e)?e:[e];for(var i=0;i<o.length;i++)(n=t.items.indexOf(o[i]))>=0&&t.items.splice(n,1);return t},this.pause=function(e,o,n){zot(e)&&(e=!0);var i=[];if(e){zot(n)||(o=null);for(var r=!1,a=0;a<t.items.length;a++)(zot(o)||!zot(n)||t.items[a].totalFrames)&&(!t.items[a].totalFrames||zot(o)&&zot(n))||(t.items[a].pause(!0,o,n),r=!0,i[a]=1,t.items[a].on("pause",function(){t.paused||(s(!0),t.paused=!0,t.dispatchEvent("pause"))},null,!0));r||(s(),t.paused=!0,setTimeout(function(){t.dispatchEvent("pause")},10))}else t.paused=!1,s();function s(o){for(var n=0;n<t.items.length;n++)1!=i[n]&&t.items[n].pause(e)}},Object.defineProperty(t,"percentSpeed",{get:function(){return t._percentSpeed},set:function(e){t._percentSpeed=e;for(var o=0;o<t.items.length;o++)t.items[o].percentSpeed=e}}),this.dispose=function(){for(var e=0;e<t.items.length;e++)t.items[e].dispose();return!0}},e.extend(e.Accelerator,createjs.EventDispatcher,null,"cjsEventDispatcher"),e.Swiper=function(t,o,n,i,r,a,s,l,d,c){var u;if(u=zob(e.Swiper,arguments,"swipeOn, target, property, sensitivity, horizontal, min, max, damp, integer, factor",this))return u;if(z_d("69.5"),this.cjsEventDispatcher_constructor(),!zot(t)&&t.getStage&&t.stage){if(!zot(o)){zot(i)&&(i=1),zot(r)&&(r=!0),zot(l)&&(l=.1),zot(d)&&(d=!1),zot(c)&&(c=1);var h,f,p,m,g,z,v=this,b=t,y=v.desiredValue=o[n];this.target=o,this.property=n;var w=!1;b.canvas?(m=b.on("stagemousedown",function(){w=!0,T(),g=b.on("stagemousemove",k),z=b.on("stagemouseup",function(){w=!1,b.off("stagemousemove",g),b.off("stagemouseup",z),v.dispatchEvent("swipeup")})}),p=b):(p=b.stage,E(),m=b.on("mousedown",T),g=b.on("pressmove",k),z=b.on("pressup",function(){w=!1,v.dispatchEvent("swipeup")}));var x=new e.Damp(v.target[v.property],l);v.target[v.property];v.target.swiperTicker=e.Ticker.add(function(){v.swiperMoving&&(v.target[v.property]=d?Math.round(x.convert(y)):x.convert(y),!w&&Math.abs(v.target[v.property]-y)<(zot(a)||zot(s)?1:Math.abs(s-a)/1e3)?(v.swiperMoving=!1,v.target[v.property]=y,v.immediate(v.target[v.property]),v.dispatchEvent("swipestop")):v.target[v.property])},p),this.immediate=function(e){x.immediate(e),v.target[v.property]=d?Math.round(e):e,v.desiredValue=y=e};var C=!0;Object.defineProperty(v,"enabled",{get:function(){return C},set:function(t){C!=t&&(t?function(){b.canvas?m=b.on("stagemousedown",m):(m=b.on("mousedown",m),g=b.on("pressmove",g),z=b.on("pressup",z));v.immediate(v.target[v.property]),v.target.swiperTicker=e.Ticker.add(v.target.swiperTicker,p)}():M(),C=Boolean(t))}}),this.dispose=function(){M(),x=null}}}else zog("zim.Swiper() - please provide container on stage");function T(){w=!0,h=r?p.mouseX:p.mouseY,f=v.target[v.property],v.dispatchEvent("swipedown")}function k(){var e=h-(r?p.mouseX:p.mouseY);Math.abs(e)>0&&(v.swiperMoving=!0),y=f-e*i*c,zot(a)||(y=Math.max(y,a)),zot(s)||(y=Math.min(y,s)),v.desiredValue=y,v.dispatchEvent("swipemove")}function E(){b.off("mousedown",m),b.off("pressmove",g),b.off("pressup",z)}function M(){b.canvas?(b.off("stagemousedown",m),b.off("stagemousemove",g),b.off("stagemouseup",z)):E(),e.Ticker.remove(v.target.swiperTicker)}},e.extend(e.Swiper,createjs.EventDispatcher,null,"cjsEventDispatcher",!1),e.MotionController=function(t,o,n,i,r,a,s,l,d,c,u,h,f,p,m,g,z){var v;if(v=zob(e.MotionController,arguments,"container, target, type, speed, axis, rect, map, diagonal, damp, flip, rotate, constant, firstPerson, turnSpeed, moveThreshold, stickThreshold, localBounds",this))return v;if(z_d("69.7"),this.cjsEventDispatcher_constructor(),!zot(t)&&t.getStage)if(zot(t.stage))zog("zim Controller(): The Container must be on the stage");else{var b=t.stage;zot(o)&&(o=new e.Container(1,1)),zot(i)&&(i=7),(zot(n)||"mousemove"!=n&&"keydown"!=n&&"gamebutton"!=n&&"gamestick"!=n&&"swipe"!=n&&"manual"!=n)&&(n="mousedown"),zot(r)&&(r="both"),"keydown"==n&&zot(s)&&(s=[[65,37],[68,39],[87,38],[83,40]]),"gamebutton"==n&&zot(s)&&(s=f?[14,15,e.GamePad.RT,e.GamePad.LT]:[14,15,12,13]),"gamestick"==n&&zot(s)&&(s=f?[[0,2],[0,2],[1],[1]]:[0,0,1,1]),"gamestick"==n&&zot(s)&&(s=[0,0,1,1]),zot(l)&&(l=!0),"horizontal"!=r&&"vertical"!=r||(l=!1),zot(d)&&(d="keydown"==n||"gamebutton"==n?1:.1),zot(f)&&(f=!1),zot(p)&&(p=.4*i),zot(m)&&(m=4),zot(g)&&(g=.2);var y=this;this.dirX=0,this.dirY=0,this.speed=i,this.turnSpeed=p,this.axis=r,this.target=o,this.moveThreshold=m,this.stickThreshold=g;var w=y.speed,x=y.speed,C=0;y.rotation=0,y.x=this.target.x,y.y=this.target.y;var T=y.scaleX=o.scaleX;y.scaleY=o.scaleY;if("keydown"==n||"gamebutton"==n){for(var k=0;k<4;k++)Array.isArray(s[k])||(s[k]=[s[k]]);var E=[0,0,0,0],M=[],j=["X","X","Y","Y"],S=[-1,1,-1,1],A={dirX:0,dirY:0};if("keydown"==n)var P=frame.on("keydown",I);else var O=(_=y.gamepad=new e.GamePad).on("buttondown",I);function I(e){var t,o="keydown"==n?e.keyCode:e.buttonCode;for(k=0;k<4;k++)if(s[k].indexOf(o)>-1){if(l||"both"!=y.axis||(A.dirX=A.dirY=0),A["dir"+j[k]]=S[k],E[k]=1,0==(t=M.indexOf(k)))return;return t>0&&M.splice(t,1),void M.unshift(k)}}if(zot(h))if("keydown"==n)var D=frame.on("keyup",L);else var B=_.on("buttonup",L);function L(e){var t,o="keydown"==n?e.keyCode:e.buttonCode;for(k=0;k<4;k++)if(s[k].indexOf(o)>-1){if(E[k]=0,(t=M.indexOf(k))>=0&&M.splice(t,1),"both"!=y.axis||l)A["dir"+j[k]]=-E[2*Math.floor(k/2)]+E[2*Math.floor(k/2)+1];else if(M.length>0){A["dir"+j[k]]=0;var i=M[0];A["dir"+j[i]]=S[i]}else A.dirX=A.dirY=0;return}}var X={rotation:0,speedX:y.speed,speedY:y.speed},Y=e.Ticker.add(function(){if(f)K(A);else{var e=y.speed,t=y.speed;if("both"==y.axis&&0!=A.dirX&&0!=A.dirY){var o=$(A.dirX,A.dirY);e=o.speedX,t=o.speedY}"horizontal"!=y.axis&&"both"!=y.axis||(y.x+=e*A.dirX),"vertical"!=y.axis&&"both"!=y.axis||(y.y+=t*A.dirY),Q()}},b)}else if("mousedown"==n||"mousemove"==n)mouseEvent=b.on("stage"+n,function(){var e=t.globalToLocal(b.mouseX,b.mouseY);y.x=e.x,y.y=e.y,Q()});else if("gamestick"==n){var _=this.gamepad=new e.GamePad;for(k=0;k<4;k++)Array.isArray(s[k])||(s[k]=[s[k]]);X={rotation:0,speedX:y.speed,speedY:y.speed};var R=_.on("data",function(e){for(var t={dirX:0,dirY:0},o=0;o<s[0].length;o++){var n=e.axes[s[0][o]];if(Math.abs(n)>y.stickThreshold){t.dirX=n;break}}for(o=0;o<s[2].length;o++){n=e.axes[s[2][o]];if(Math.abs(n)>y.stickThreshold){t.dirY=n;break}}f?K(t):(y.x+=y.speed*t.dirX,y.y+=y.speed*t.dirY,Q())})}else if("swipe"==n)var W=new e.Swiper(b,y,"x",.8),N=new e.Swiper(b,y,"y",.8,!1),F=W.on("swipemove",function(){Q()});var V=this.x=this.target.x,H=this.y=this.target.y;this.dampX=new e.Damp(V,d),this.dampY=new e.Damp(H,d),this.dampR=new e.Damp(this.target.rotation,d);var G=0,U=0,Z=e.Ticker.add(function(){if(a&&(y.x=e.constrain(y.x,a.x,a.x+a.width),y.y=e.constrain(y.y,a.y,a.y+a.height)),"horizontal"!=y.axis&&"both"!=y.axis||(y.dirX=e.sign(y.x-V),Math.abs(y.x-V)<w?V=y.x:V+=y.dirX*w,y.target.x=y.dampX.convert(V)),"vertical"!=y.axis&&"both"!=y.axis||(y.dirY=e.sign(y.y-H),Math.abs(y.y-H)<x?H=y.y:H+=e.sign(y.y-H)*x,y.target.y=y.dampY.convert(H)),y.dirX!=G||y.dirY!=U){var t=new createjs.Event("change");if(y.dirX!=G){var n=["left",null,"right"];t.dir=n[y.dirX+1],G=y.dirX,"horizontal"!=c&&"both"!=c||(y.scaleX=o.scaleX=y.dirX?Math.abs(o.scaleX)*y.dirX:o.scaleX,C=0!=T&&-1==Math.round(y.scaleX/T)?180:0)}else{n=["up",null,"down"];t.dir=n[y.dirY+1],U=y.dirY,"vertical"!=c&&"both"!=c||(y.scaleY=o.scaleY=y.dirY?Math.abs(o.scaleY)*y.dirY:o.scaleY)}y.dispatchEvent(t)}y.movingX=Math.abs(V-y.target.x)>y.moveThreshold,y.movingY=Math.abs(H-y.target.y)>y.moveThreshold,y.moving=y.movingX||y.movingY,u&&!zot(y.rotation)&&(y.target.rotation=y.dampR.convert(y.rotation))},b);this.immediate=function(e,t,o){!zot(e)&&y.dampX&&(y.dampX.immediate(e),y.x=y.target.x=V=e,W&&W.immediate(e)),!zot(t)&&y.dampY&&(y.dampY.immediate(t),y.y=y.target.y=H=t,N&&N.immediate(t)),!zot(o)&&y.dampR&&(y.dampR.immediate(o),y.rotation=y.target.rotation=o)},this.convert=function(e,t){zot(e)||(y.x=e),zot(t)||(y.y=t),Q()};var q=!0;Object.defineProperty(y,"enabled",{get:function(){return q},set:function(t){q!=t&&(t?function(){"keydown"==n?(P=frame.on("keydown",P),D=frame.on("keyup",D),Y=e.Ticker.add(Y,b)):"gamebutton"==n?(O=_.on("buttondown",O),B=_.on("buttonup",B),Y=e.Ticker.add(Y,b)):"gamestick"==n?R=_.on("data",R):"swipe"==n?(W.enabled=!0,N.enabled=!0,F=W.on("swipemove",F)):"mousedown"!=n&&"mousemove"!=n||(mouseEvent=b.on("stage"+n,mouseEvent));Z=e.Ticker.add(Z,b)}():ee(),q=Boolean(t))}}),this.dispose=function(){ee(),_&&_.dispose(),W&&W.dispose(),N&&W.dispose()}}else zog("zim Controller(): Please pass in a reference to a container as first parameter");function K(e){X.rotation+=e.dirX*y.turnSpeed,y.rotation=X.rotation,X.speedX=Math.sin(X.rotation*Math.PI/180)*y.speed*-e.dirY,X.speedY=-Math.cos(X.rotation*Math.PI/180)*y.speed*-e.dirY,y.x+=X.speedX,y.y+=X.speedY}function Q(){var e=$(y.x-y.target.x,y.y-y.target.y);if(w=e.speedX,x=e.speedY,u)if(y.rotation=e.angle,zot(y.rotation))y.rotation=y.target.rotation;else{y.rotation+=C;var t=J(y.rotation),o=y.target.rotation=J(y.target.rotation);Math.abs(t-o)>180&&(o>t?o-=360:t-=360),y.dampR.immediate(o),y.target.rotation=o,y.rotation=t}}function J(e){return(e%360+360)%360}function $(e,t){var o,n=y.speed,i=y.speed,r=Math.sqrt(Math.pow(e,2)+Math.pow(t,2));return r>0&&(n=Math.abs(e)/r*y.speed,i=Math.abs(t)/r*y.speed,o=90-180*Math.atan2(e,t)/Math.PI),{speedX:n,speedY:i,angle:o}}function ee(){"keydown"==n?(frame.off("keydown",P),frame.off("keyup",D),e.Ticker.remove(Y)):"gamebutton"==n?(_.off("buttondown",O),_.off("buttonup",B),e.Ticker.remove(Y)):"gamestick"==n?_.off("data",R):"swipe"==n?(W.enabled=!1,N.enabled=!1,W.off("swipemove",F)):"mousedown"!=n&&"mousemove"!=n||b.off("stage"+n,mouseEvent),e.Ticker.remove(Z)}},e.extend(e.MotionController,createjs.EventDispatcher,"enabled","cjsEventDispatcher"),e.GamePad=function(){if(z_d("69.8"),this.cjsEventDispatcher_constructor(),!navigator.getGamepads)return this.error=!0,void(zon&&zog("zim.GamePad() - no browswer support"));var e;window.addEventListener("gamepadconnected",o),this.currentIndex=0;var t=this;function o(o){var i,r,a;t.connected=!0,i="gamepadconnected",r=o,(a=new createjs.Event(i)).index=r.gamepad.index,a.id=r.gamepad.id,a.buttons=r.gamepad.buttons,a.axes=r.gamepad.axes,t.dispatchEvent(a);var s=navigator.getGamepads()[t.currentIndex];t.lastData=[];for(var l=0;l<s.buttons.length;l++)t.lastData[l]=s.buttons[l].pressed;!function o(){if(e=requestAnimationFrame(o),t.data=navigator.getGamepads()[t.currentIndex],t.data){for(var i=t.buttons=[],r=0;r<t.data.buttons.length;r++)if(i[r]=t.data.buttons[r].pressed,i[r]!=t.lastData[r]){if(t.lastData[r]=i[r],i[r])var a=new createjs.Event("buttondown");else a=new createjs.Event("buttonup");a.buttonCode=r,a.button=n[r],t.dispatchEvent(a)}(a=new createjs.Event("data")).axes=t.axes=t.data.axes,a.buttons=t.buttons,t.dispatchEvent(a)}}()}var i=setInterval(function(){navigator.getGamepads&&navigator.getGamepads()[0]&&(t.connected||o(),clearInterval(i))},500);var r=window.addEventListener("gamepaddisconnected",function(o){o.gamepad.index==t.currentIndex&&(cancelAnimationFrame(e),connected=!1,t.dispatchEvent("gamepaddisconnected"))});this.dispose=function(){window.removeEventListener("gamepadconnected",o),window.addEventListener("gamepaddisconnected",r),cancelAnimationFrame(e),clearInterval(i),t.connected=!1}};for(var n=["A","B","X","Y","LB","RB","LT","RT","BACK","START","LS","RS","DPAD_UP","DPAD_DOWN","DPAD_LEFT","DPAD_RIGHT"],i=0;i<n.length;i++)e.GamePad[n[i]]=i;var r=["LSX","LSY","RSX","RSY"];for(i=0;i<r.length;i++)e.GamePad[r[i]]=i;return e.extend(e.GamePad,createjs.EventDispatcher,null,"cjsEventDispatcher"),e.Emitter=function(t,o,n,i,r,a,s,l,d,c,u,h,f,p,m,g,z,v,b,y,w,x,C,T,k,E,M,j,S,A){var P;if(P=zob(e.Emitter,arguments,"obj, width, height, interval, num, life, fade, shrink, decayTime, decayStart, trace, traceFadeTime, traceShiftX, traceShiftY, angle, force, gravity, wind, layers, animation, random, horizontal, vertical, sink, sinkForce, cache, events, startPaused, pool, poolMin",this))return P;z_d("69.9"),zot(t)&&(t=[]),zot(o)&&(o=300),zot(n)&&(n=300),zot(i)&&(i=20),"number"==typeof i&&(i=Math.max(10,i)),zot(r)&&(r=1),zot(u)&&(u=!1),zot(h)&&(h=d),zot(f)&&(f=0),zot(p)&&(p=0),zot(a)&&(a=1e3),zot(s)&&(s=!0),zot(l)&&(l=!u),zot(d)&&(d=1e3),zot(m)&&(m={min:0,max:360}),zot(g)&&(g=5),zot(z)&&(z=9.8),zot(v)&&(v=0),zot(b)&&(b="top"),zot(o)&&(o=100),zot(n)&&(n=100),zot(x)&&(x=!1),zot(C)&&(C=!1),!zot(T)&&zot(k)&&(k=10),zot(M)&&(M=!1),zot(j)&&(j=!1),zot(S)&&(S=!0),zot(A)&&(A=0),this.zimContainer_constructor(o,n),this.type="Emitter";var O=this;O.obj=t,O.interval=i,O.num=r,O.life=a,O.fade=s,O.shrink=l,O.decayTime=d,O.decayStart=c,O.trace=u,O.traceFadeTime=h,O.traceShiftX=f,O.traceShiftY=p,O.angle=m,O.force=g,O.gravity=z,O.wind=v,O.layers=b,O.animation=y,O.random=w,O.horizontal=x,O.vertical=C,O.sink=T,O.sinkForce=k,O.events=M,O.startPaused=j,O.pool=S,O.poolMin=A,O.particlesEmitted=0;var I,D,B=[],L=0,X=0;function Y(e){if(O.events&&_("fizzed",e),(e.trace?e.getChildAt(0).endSpurt:e.endSpurt)&&(_("spurtFizzed",e),O.spurting=!1),O.pool&&"end"!=e.pooled)return e.pooled?void(e.visible=!1):(e.pooled=!0,B.push(e),void(e.visible=!1));O.removeChild(e),O.trace&&e.uncache(),e=null}function _(e,t){var o=new createjs.Event(e);o.particle=t.trace?t.getChildAt(0):t,O.dispatchEvent(o)}function R(e){O.pause(),O.spurtCount=O.spurtNum=null,_("spurted",e),e.endSpurt=!0}e.added(O,function(i){D=i,zot(E)&&(E=!D.isWebGL&&e.mobile());E&&(D.snapToPixelEnabled=!0);if(D){x||C||O.centerReg(),O.zimInterval=e.interval(O.interval,function(){var i,r;O.startPaused?O.pause():(t=Array.isArray(O.obj)?O.obj:[O.obj]).length<=0||(Array.isArray(O.interval)?(O.interval.sort(a),i=O.interval[0]):i=O.interval.constructor=={}.constructor?O.interval.min:O.interval,Array.isArray(O.num)?(O.num.sort(a),r=O.num[O.num.length-1]):r=O.num.constructor=={}.constructor?O.num.max:O.num,e.loop(zik(O.num),function(){if(O.decayTime>0){var a={};O.shrink&&(a.scale=0),O.fade&&(a.alpha=0)}if(O.pool&&B.length>0&&X>=Math.max(O.poolMin,(O.life/i+5)*r)){var s=B[L++%B.length];s.visible=!0;var l=s.trace?s.getChildAt(0):s;if(l.emitShape){var d=l.template;l.graphics.c().s(d.s?zik(d.s):null).ss(d.ss?zik(d.ss):null).sd(d.sd?zik(d.sd):null,d.offset?zik(d.offset):null)}s.trace&&s.updateCache(),"top"==O.layers?l.emitShape?s.addTo(O):s.centerReg(O):l.emitShape?s.addTo(O,!0,"bottom"==O.layers?0:e.rand (O.numChildren)):s.centerReg(O,"bottom"==O.layers?0:e.rand (O.numChildren)),s.alpha=1,s.scaleX=1,s.scaleY=1,l.alpha=l.originalAlpha,l.scaleX=l.originalScaleX,l.scaleY=l.originalScaleY,l.endSpurt=!1}else{X++,O.trace&&((s=new e.Container(o,n)).trace=!0);var c=zik(e.shuffle(t)[0]);if("shape"==c.type){var d=c,l=new e.Shape(1,1);l.emitShape=!0,l.template=d,l.graphics.s(d.s?zik(d.s):null).ss(d.ss?zik(d.ss):null).sd(d.sd?zik(d.sd):null,d.offset?zik(d.offset):null),O.trace?l.addTo(s):"top"==O.layers?l.addTo(O):l.addTo(O,"bottom"==O.layers?0:e.rand (O.numChildren))}else{var l=c.clone();l.centerReg||zimify(l),O.trace?l.centerReg(s).pos(-1e3,-1e3):"top"==O.layers?l.centerReg(O):l.centerReg(O,"bottom"==O.layers?0:e.rand (O.numChildren))}O.trace&&("top"==O.layers?s.addTo(O):s.addTo(O,"bottom"==O.layers?0:e.rand (O.numChildren)),s.cache(f,p,o,n)),O.trace||(s=l),s.particle=l,l.originalAlpha=l.alpha,l.originalScaleX=l.scaleX,l.originalScaleY=l.scaleY}O.currentParticle=l,O.particlesEmitted++,s.particleNormal=!0,s.particleDecaying=!1,s.particleFizzing=!1;var u=zik(O.angle),h=zik(O.force),m=h*Math.cos(u*Math.PI/180),g=h*Math.sin(u*Math.PI/180);l.info={position:{x:o/2,y:n/2},velocity:{x:m,y:g}},O.horizontal&&(l.info.position={x:e.rand (0,o),y:O.vertical?n/2:0}),O.vertical&&(l.info.position={x:O.horizontal?o/2:0,y:e.rand (0,n)}),l.emitShape?l.graphics.mt(l.info.position.x,l.info.position.y):l.pos(l.info.position.x,l.info.position.y),O.random&&e.loop(O.random,function(e,t){val=zik(t),"scale"==e?l.sca(val):("x"==e?l.info.position.x=O.horizontal||O.vertical?val:val+o/2:"y"==e&&(l.info.position.y=O.horizontal||O.vertical?val:val+n/2),l[e]=val,l.emitShape&&l.pos(0,0))}),E&&!l.emitShape&&l.cache(l.getBounds().x-10,l.getBounds().y-10,l.getBounds().width+20,l.getBounds().height+20);var z,v=!l.emitShape&&O.shrink;if(O.decayTime>0&&(O.fade||v||O.trace&&O.traceFadeTime>0)){if(O.trace&&O.traceFadeTime>0&&s.animate({obj:{alpha:0},time:O.traceFadeTime,wait:O.life-O.traceFadeTime,waitedCall:function(e){e.particleNormal=!1,e.particleFizzing=!0},call:Y,override:!1,id:"decay"}),O.fade||v){var b={};O.fade&&(b.alpha=0),v&&(b.scaleX=0,b.scaleY=0),l.animate({obj:b,time:O.decayTime,wait:zot(O.decayStart)?O.life-O.decayTime:O.decayStart,waitedCall:function(e){e.parent!=O&&(e=e.parent),e.particleNormal=!1,e.particleDecaying=!0},call:function(t){var o;O.events&&_("decayed",t),t.endSpurt&&_("spurtDecayed",t),O.trace&&O.traceFadeTime>0||(zot(O.decayStart)||O.decayStart+O.decayTime>O.life?Y(t.parent.trace?t.parent:t):(o=s,e.timeout(O.life-(O.decayStart+O.decayTime),function(){Y(o)})))},override:!1,id:"decay"})}}else O.life>0&&((z=s).timeOut=e.timeout(O.life,function(){Y(z)}));if(O.events&&_("emitted",s),function(e){if(zot(O.spurtCount)&&zot(O.spurtNum))return;O.spurtCount++,O.spurtCount>=O.spurtNum&&R(e)}(l),O.animation){var y=zik(O.animation);zot(y.override)&&(y.override=!1),l.animate(e.copy(y))}}));function a(e,t){return e-t}},null,!0);I=O.emitterTicker=e.Ticker.add(function(){e.loop(O,function(t){if(t.trace){var o=t;t=t.getChildAt(0)}var n=t.info,i=0,r=0;if(!zot(O.sink)){var a=O.localToGlobal(n.position.x,n.position.y);if(O.sink.parent&&O.sink.parent.localToGlobal)var s=O.sink.parent.localToGlobal(O.sink.x,O.sink.y);else s=new createjs.Point(zik(O.sink.x),zik(O.sink.y));var l=e.angle(a.x,a.y,s.x,s.y),i=O.sinkForce*Math.cos(l*Math.PI/180),r=O.sinkForce*Math.sin(l*Math.PI/180)}var d=O.wind+i,c=O.gravity+r;n.velocity.x+=d*frameRate,n.velocity.y+=c*frameRate,n.position.x+=n.velocity.x*frameRate*100,n.position.y+=n.velocity.y*frameRate*100,t.emitShape?t.graphics.lt(n.position.x,n.position.y):(t.x=n.position.x,t.y=n.position.y),O.trace&&o&&o.updateCache(t.emitShape?null:"source-over")})},D),frameRate=1/e.Ticker.framerate}}),Object.defineProperty(O,"interval",{get:function(){return i},set:function(e){i=e,O.zimInterval&&(O.zimInterval.time=i)}}),this.spurting=!1,this.spurt=function(t,o,n){var i;if(i=zob(O.spurt,arguments,"num, time, restart"))return i;zot(o)||(e.timeout(zik(o),function(){R(O.currentParticle)}),O.spurting=!0),zot(t)||(O.spurtNum=zik(t),O.spurtCount=0,O.spurting=!0),O.pause(!1,n,null,!0)},this.clearPool=function(){e.loop(O,function(e){e.pooled="end",e.visible||O.removeChild(e)},!0),X=0,L=0,B=[]},O.startPaused||(this.paused=!1),this.pause=function(t,o,n,i){if(O.startPaused=null,zot(t)&&(t=!0),zot(o)&&(o=!1),zot(n)&&(n=!1),t){if(O.paused)return O;n&&(I&&e.Ticker.remove(I),e.loop(O,function(e){e.pauseAnimate(),e.trace&&e.getChildAt(0).pauseAnimate(),e.timeOut&&e.timeOut.pause()})),O.zimInterval.pause(),O.paused=!0}else{if(!O.paused)return O;o&&(e.loop(O,function(e){e.stopAnimate(),e.timeOut&&e.timeOut.clear(),e.trace&&e.getChildAt(0).pauseAnimate()}),O.removeAllChildren()),D&&I&&!e.Ticker.has(D,I)&&(e.Ticker.add(I,D),e.loop(O,function(e){e.pauseAnimate(!1),e.timeOut&&e.timeOut.pause(!1),e.trace&&e.getChildAt(0).pauseAnimate(!1)})),O.zimInterval.pause(!1,i),O.paused=!1}return O},this.resize=function(e,t){zot(e)||(o=e),zot(t)||(n=t),O.setBounds(0,0,o,n),x||C||O.centerReg(),O.clearPool()},this.clone=function(){var t;return t=Array.isArray(O.obj)||O.obj.constructor=={}.constructor?e.copy(O.obj):O.obj.clone?O.obj.clone():O.obj,O.cloneProps(new e.Emitter(t,o,n,O.interval,O.num,O.life,O.fade,O.shrink,O.decayTime,O.decayStart,O.trace,O.traceFadeTime,O.traceShiftX,O.traceShiftY,O.angle,O.force,O.gravity,O.wind,O.layers,O.animation,e.copy(O.random),O.horizontal,O.vertical,O.sink,O.sinkForce,E,O.events,j,O.pool,O.poolMin))},this.dispose=function(){return I&&e.Ticker.remove(I),e.loop(O,function(e){e.stopAnimate()}),O.zimInterval.clear(),!0}},e.extend(e.Emitter,e.Container,"clone","zimContainer",!1),e.SoundWave=function(t,o,n,i,r,a,s,l,d,c){var u;if(u=zob(e.SoundWave,arguments,"num, input, include, smoothing, min, max, operation, baseline, magnify, reduce",this))return u;z_d("69.95"),zot(t)&&(t=120),zot(o)&&(o="mic"),zot(n)&&(n=.1171875),zot(i)&&(i=.85),zot(r)&&(r="mic"==o?-80:-100),zot(a)&&(a="mic"==o?-40:-10),zot(s)&&(s=function(t,o){return t*(.5+1*o/Math.pow(e.SoundWave.bufferLength,.95))}),zot(l)&&(l="mic"==o?0:30),zot(d)&&(d="mic"==o?1:10),zot(c)&&(c=0),e.SoundWave.bufferLength=1024,_num=t;var h=this;h.baseline=l,h.magnify=d,h.reduce=c;var f=new(window.AudioContext||window.webkitAudioContext),p=h.analyser=f.createAnalyser();if(p.minDecibels=r,p.maxDecibels=a,p.smoothingTimeConstant=i,Object.defineProperty(this,"smoothing",{get:function(){return p.smoothingTimeConstant},set:function(e){p.smoothingTimeConstant=e}}),Object.defineProperty(this,"num",{get:function(){return _num},set:function(t){_num=t,(z=Math.floor(n*e.SoundWave.bufferLength/_num))<1&&zog("ZIM SoundWave: num is too big")}}),"mic"==o)return navigator.getUserMedia=navigator.getUserMedia||navigator.webkitGetUserMedia||navigator.mozGetUserMedia||navigator.msGetUserMedia,void(navigator.getUserMedia?navigator.getUserMedia({audio:!0},function(e){v(h.source=f.createMediaStreamSource(e))},function(e){zog("ZIM SoundWave: Error occured: "+e)}):zog("ZIM SoundWave: Sorry, mic not supported"));if(o.type&&"sound"==o.type)zog("ZIM SoundWave: pass in the result of a zim.asset('somesound').play() for the input");else{if(o.playbackResource)var m=o.playbackResource,g=f.createMediaElementSource(m);else m=o,g=f.createMediaElementSource(m);var z;v(g)}function v(t){if(t.connect(p),"mic"!=o&&p.connect(f.destination),p.fftSize=2*e.SoundWave.bufferLength,(z=Math.floor(n*e.SoundWave.bufferLength/_num))<1)zog("ZIM SoundWave: include param is too small or num param is too big");else{var i=p.frequencyBinCount,r=new Uint8Array(i);h.calculate=function(){p.getByteFrequencyData(r);var t=r.map(s);if(1==z)return t;for(var i=[],a=0,l=0;l<=n*e.SoundWave.bufferLength;l++)a+=t[l],0!=l&&l%z==0&&(i.push(Math.max(0,(a/z-h.baseline)*h.magnify-h.reduce)),a=0);return"mic"!=o&&(i[0]*=.75,i[1]*=.85,i[2]*=.9,i[i.length-2]*=.8,i[i.length-1]*=.75),i[i.length-1]*=1.3,i[i.length-2]*=1.2,i[i.length-3]*=1.1,i},setTimeout(function(){h.dispatchEvent("ready")},50)}}},e.extend(e.SoundWave,createjs.EventDispatcher,null,"cjsEventDispatcher",!1),e.Portal=function(t,o){var n;if(n=zob(e.Portal,arguments,"obj, lands",this))return n;if(z_d("69.96"),!zot(t)&&t.stage){var i=this,r=o&&o.numChildren&&o.numChildren>0;if(r){var a=o.getChildAt(o.numChildren-1),s=o.getChildAt(o.numChildren-2);o.setChildIndex(s,o.numChildren-1),s.setMask(t)}t.on(mobile()?"mousedown":"mouseover",function(){i._enabled&&(r&&l(),i.dispatchEvent("enter"))}),t.on(mobile()?"pressup":"mouseout",function(){i._enabled&&i.dispatchEvent("exit")}),Object.defineProperty(this,"portal",{get:function(){return t},set:function(e){!zot(e)&&e.stage||!zon?s.setMask(t):zog("zim.Portal() - please provide a Display Object to act as the portal")}}),Object.defineProperty(this,"currentLand",{get:function(){return a},set:function(e){if(o.contains(e))for(;e!=a;)l()}}),Object.defineProperty(this,"nextLand",{get:function(){return s},set:function(e){zon&&zog("zim.Portal() - nextLand is read only - remake Portal to change")}}),this._enabled=!0,Object.defineProperty(i,"enabled",{get:function(){return i._enabled},set:function(e){i._enabled=e}}),this.dispose=function(){}}function l(){o.setChildIndex(a,0),a=s,s=o.getChildAt(o.numChildren-2),o.setChildIndex(s,o.numChildren-1),a.setMask(null),s.setMask(t),t.stage.update()}},e.extend(e.Portal,createjs.EventDispatcher,null,"cjsEventDispatcher",!1),e.VR=function(t,o,n,i,r,a,s,l,d,c,u,h){var f;if(f=zob(e.VR,arguments,"content, angle, distance, parallax, parallaxAngle, damp, parallaxDamp, startAngle, negativeParallax, boundaryMarkers, swiper, holder",this))return f;if(z_d("69.98"),this.type="VR",zimDefaultFrame){var p=zimDefaultFrame;if(zot(h)||!h.getBounds||!h.getBounds().width)h=p.stage;zot(o)&&(o=0),zot(n)&&(n=100),zot(a)&&(a=.5),zot(i)&&(i=0),zot(r)&&(r=60),zot(s)&&(s=.1),zot(l)&&(l=0),zot(d)&&(d=!1),zot(c)&&(c=!0),zot(u)&&(u=!0),this.angle=o,this.currentAngle=l,e.mobile()&&(u=!1);var m=this,g=h.width,z=h.height;m.zimContainer_constructor();var v=m.left=new e.Container(g/2,z),b=new e.Rectangle(g/2,z,"rgba(0,0,0,.01)");v.addChild(b);var y=m.right=v.clone();m.addChild(v,y),y.x=g/2;var w=m.contentLeft=m.content=t,x=m.contentRight=t.clone();if(0!=l)var C=setTimeout(G,100);else G();var T=[],k=[];if(U(w,x),Z(T,"left"),Z(k,"right"),0!=o&&0!=n){var E=new e.Damp(180+l,a);E.immediate(180+l);var M=!1,j=!1;function S(e){m.currentAngle=e;var t=-m.currentAngle*n/o;if(m.contentLeft.x=t,m.contentRight.x=t,Math.round(m.currentAngle)<=-o/2&&!M)(i=new createjs.Event("boundaryout")).boundary="left",M=!0,m.dispatchEvent(i);else if(Math.round(m.currentAngle)>=o/2&&!j){(i=new createjs.Event("boundaryout")).boundary="right",j=!0,m.dispatchEvent(i)}else if(Math.round(m.currentAngle)>-o/2&&Math.round(m.currentAngle)<o/2){var i=new createjs.Event("boundaryin");M?(i.boundary="left",m.dispatchEvent(i),M=!1):j&&(i.boundary="right",m.dispatchEvent(i),j=!1)}}function A(e){var t=e.parent.localToLocal(e.vrStartX,0,h),i=e.vrParallaxDamp.convert("left"==e.vrChannel?m.contentLeft.x+t.x-g/4:m.contentRight.x+t.x-g/2-g/4);e.depth<=0&&!d&&(i=0),e.vrParallaxDistance=Math.max(-n/o*r/2,Math.min(n/o*r/2,i)),e.dep(e.depth)}p.on("deviceorientation",function(e){S(E.convert((e.rotation.z>180?-180:180)+e.rotation.z+l)-180)}),e.Ticker.always()}if(0!=i&&0!=n){var P=new ProportionDamp(180-r/2,180+r/2,-r/2,r/2,s);if(P.immediate(180),0==o)function O(e,t){e.vrParallaxDistance=e.depth<=0&&!d?0:t,e.dep(e.depth)}function I(e){0!=o&&0!=n?(loop(T,A),loop(k,A)):(loop(T,function(t){O(t,e)}),loop(k,function(t){O(t,e)}))}p.on("deviceorientation",function(e){var t=0;0==o&&0!=i&&0!=n&&(t=P.convert((e.rotation.z>180?-180:180)+e.rotation.z)),I(t)}),e.Ticker.always()}!u||0==n||0==o&&0==i||m.added(function(){var t={swipeAngle:0};m.swiper=new e.Swiper({swipeOn:m,target:t,property:"swipeAngle",sensitivity:.2,damp:.05,factor:-1,min:-330,max:330});Ticker.add(function(){0!=o&&0!=n&&S(t.swipeAngle),0!=i&&0!=n&&I(P.convert(t.swipeAngle+180))})});var D=localStorage&&localStorage.zimEyeAdjust?Number(localStorage.zimEyeAdjust):0,B=D,L=!1;w.startRegX=w.regX,x.startRegX=x.regX;var X=this.adjuster=new e.Container(800,300),Y=(b=X.backing=new e.Rectangle(X.width,X.height,p.lighter).center(X).alp(1).sha("rgba(0,0,0,.2)",0,0,30),X.strip=new e.Rectangle(X.width,X.height/3,p.white).center(X).alp(1),X.label=new e.Label({text:"slide to adjust center of left and right",size:28,color:p.dark,align:"center",valign:"center"}).center(X).pos(null,50),X.close=new e.Rectangle(50,50,p.light).addTo(X).mov(X.width-70,26)),_=new e.Shape(-40,-40,80,80);_.graphics.f(p.dark).p("AmJEVIEUkTIkXkWIB4h5IEWEYIETkTIB4B3IkTESIEQERIh4B4IkRkRIkSEVg"),_.center(Y).sca(.3),Y.cursor="pointer",Y.on("mousedown"!=e.ACTIONEVENT||!window.zns&&"mousedown"!=ACTIONEVENT?"click":"mousedown",function(){m.hideAdjuster(),N.currentValue=(N.max-N.min)/2+B,m.dispatchEvent("closed")});var R=new e.Circle(30,p.dark).center(X).pos(X.width/4);R.shape.alpha=.2,new e.Circle(12,p.dark).center(R);var W=new e.Circle(30,p.dark).center(X).pos(X.width/4*3);W.shape.alpha=.2,new e.Circle(12,p.dark).center(W);var N=X.slider=new e.Slider({min:0,max:30,step:1,useTicks:!0}).centerReg(X).pos(null,X.height-40);N.currentValue=(N.max-N.min)/2+D;var F=new e.Proportion(N.min,N.max,R.x-X.width/4,R.x+X.width/4,-1),V=new e.Proportion(N.min,N.max,W.x-X.width/4,W.x+X.width/4);N.on("change",function(){R.x=F.convert(N.currentValue),W.x=V.convert(N.currentValue)}),new e.Label("closer",24,null,p.silver).centerReg(X).pos(N.x-220,N.y),new e.Label("farther",24,null,p.silver).centerReg(X).pos(N.x+220,N.y),(m.ok=new e.Button({label:"OK",width:90,height:60,corner:0,color:p.blue,rollColor:p.green,shadowColor:-1}).centerReg(X).sca(.8).pos(X.width-58,N.y)).on("mousedown"!=e.ACTIONEVENT||!window.zns&&"mousedown"!=ACTIONEVENT?"click":"mousedown",function(){localStorage&&(localStorage.zimEyeAdjust=N.currentValue-(N.max-N.min)/2),q(),m.hideAdjuster(),m.dispatchEvent("saved"),m.dispatchEvent("closed")}),(m.zero=new e.Button({label:">|<",width:90,height:60,corner:0,color:p.yellow,rollColor:p.green,shadowColor:-1}).centerReg(X).sca(.8).pos(58,N.y)).on("mousedown"!=e.ACTIONEVENT||!window.zns&&"mousedown"!=ACTIONEVENT?"click":"mousedown",function(){N.currentValue=(N.max-N.min)/2,R.x=F.convert(N.currentValue),W.x=V.convert(N.currentValue)});var H=new Proportion(0,30,-h.width/4,h.width/4);q(),this.showAdjuster=function(){if(L)return m;L=!0,R.x=F.convert(N.currentValue),W.x=V.convert(N.currentValue),B=N.currentValue-(N.max-N.min)/2,X.scaleTo(h).center(this),h.stage.update()},this.hideAdjuster=function(){if(!L)return m;L=!1,X.removeFrom(this),h.stage.update()},this.position=function(e,t,o){function n(e){e.vrStartX=t,e.vrParallaxDamp&&e.vrParallaxDamp.immediate(t),e.mov(t,o)}return n(e),n(e.vrMatch),e},this.register=function(e){if(!e.parent||!e.parent.vrMatch)return zon&&zog("ZIM VR() - please only register objects already inside content container"),e;var t=[],o=[];return U(e,e.clone().addTo(e.parent.vrMatch),t,o),Z(t,"left"),Z(o,"right"),e},0!=o&&0!=n&&c&&(m.boundaryRight=new Container,new Circle(24,p.light).addTo(m.boundaryRight).dep(-2),new Triangle(16,16,16,p.yellow,p.grey,null,null,-3).rot(-90).center(m.boundaryRight).dep(-6),m.boundaryRight.center(t).mov(n/2+24),m.boundaryLeft=new Container,new Circle(24,p.light).addTo(m.boundaryLeft).dep(-2),new Triangle(16,16,16,p.yellow,p.grey,null,null,-3).rot(90).center(m.boundaryLeft).dep(-6),m.boundaryLeft.center(t).mov(-n/2-24),m.register(m.boundaryRight),m.register(m.boundaryLeft)),this.remove=function(e){return loop(arguments,function(e,o){t.contains(o)&&(!function e(t){var o=T.indexOf(t);T.indexOf(t)>=0&&(T.splice(o,1),k.splice(o,1)),loop(t,function(t){e(t)})}(o),o.parent.removeChild(o),o.vrMatch.parent.removeChild(o.vrMatch))}),m},this.resize=function(){g=h.width,z=h.height,v.getChildAt(0).widthOnly=y.getChildAt(0).widthOnly=g/2,v.getChildAt(0).heightOnly=y.getChildAt(0).heightOnly=z,y.x=g/2,v.setBounds(0,0,g/2,z),y.setBounds(0,0,g/2,z),0!=l?(clearTimeout(C),C=setTimeout(G,100)):G(),X.scaleTo(h).center(this,null,!1)}}else zon&&zog("zim.VR() - please use ZIM Frame");function G(){w.addTo(v).setMask(v.getChildAt(0)).pos(null,(h.height-w.height)/2),x.addTo(y).setMask(y.getChildAt(0)).pos(null,(h.height-w.height)/2)}function U(e,t,o,n){e.vrMatch=t,t.vrMatch=e,e.cacheCanvas&&t.cache(),e.dep&&!zot(e.depth)&&(T.push(e),k.push(t),zot(o)||o.push(e),zot(n)||n.push(t),t.dep(e.depth)),loop(e,function(e,i){U(e,t.getChildAt(i),o,n)})}function Z(t,r){loop(t,function(t){t.vrChannel=r,t.vrStartX=t.x,0!=o&&0!=n&&(t.vrAngle=o,t.vrDistance=n),0!=i&&0!=n&&(t.vrParallax=i/100,t.vrParallaxDistance=0,0!=o&&(t.vrParallaxDamp=new e.Damp(0,s))),t.dep(t.depth)})}function q(){var e=H.convert(N.currentValue);w.regX=w.startRegX+e,x.regX=x.startRegX-e}},e.extend(e.VR,e.Container,"clone","zimContainer",!1),zon&&zog("ZIM FRAME"),e.Frame=function(t,o,n,i,r,a,s,l,d,c,u,h,f,p,m,g,z,v,b,y){var w;if(w=zob(e.Frame,arguments,"scaling, width, height, color, rollover, touch, scrollTop, align, valign, canvasID, rollPerSecond, delay, canvasCheck, gpu, gpuObj, nextFrame, nextStage, allowDefault, outerColor, loadFailObj",this))return w;z_d("83"),this.cjsEventDispatcher_constructor();var x=this;if("undefined"==typeof zimDefaultFrame&&(zimDefaultFrame=this),zot(f)&&(f=!0),!!window.HTMLCanvasElement||!f){var C=e.mobile();zot(t)&&(t="full"),zot(r)&&(r=!C),zot(a)&&(a=!0),zot(s)&&(s=!0),zot(l)&&(l="center"),zot(d)&&(d="center");var T="";zot(c)&&(zimDefaultFrame!=this?(T=e.makeID(5),c="myCanvas"+T):c="myCanvas"),zot(u)&&(u=20),zot(h)&&(h=0),zot(p)&&(p=!1),zot(v)&&(v=!1),zot(y)&&(y="circles"),this.loadFailObj=y;var k,E=["fit","outside","full"];this.scale=1,this.x=0,this.y=0;var M,j,S,A,P,O=o,I=n,D=!1,B=!1;"interactive"===document.readyState||"complete"===document.readyState?setTimeout(function(){F()},200):document.addEventListener("DOMContentLoaded",F);var L,X=!1,Y="full"==t&&"undefined"!=typeof InstallTrigger;window.addEventListener("resize",function(){Y?X||(X=!0,P=e.Ticker.update,e.Ticker.update=!1,setTimeout(function(){X=!1,k==zimDefaultFrame.stage&&(e.Ticker.update=P)},40),setTimeout(function(){G(),Z()},20)):(G(),Z(),h>0&&C&&setTimeout(function(){G(),Z()},h))}),this.loadAssetsCount=0,this.assets={},this.loadAssets=function(t,o,n,i,r,a,s,l){if(zot(t.src)){var d;if(d=zob(x.loadAssets,arguments,"assets, path, xhr, time, loadTimeout, outputAudioSprite, crossOrigin, fileType"))return d}if(!zot(t)&&(zot(n)&&(n=!1),Array.isArray(t)||(t=[t]),0!=t.length)){zot(i)&&(i=0),zot(r)&&(r=8e3),zot(a)&&(a=!1),zot(s)&&(s="anonymous");var c,u,h,f=!1,p=[],m=/\.([^.]+)$/i,g=[],z=[],v=0,b=!0;for(P=0;P<t.length;P++){if((c=t[P]).constructor=={}.constructor)if(c.audioSprite){L(c=(C=e.copy(c)).src);var y,w=[];for(h=0;h<C.audioSprite.length;h++)y=C.audioSprite[h],w.push({id:y[0],startTime:Math.round(1e3*y[1]),duration:Math.round(1e3*(y[2]-y[1]))});delete C.audioSprite,C.data={audioSprite:w},a&&zog(JSON.stringify(C)),p.push(C)}else if(c.data&&c.data.audioSprite){var C;L(c=(C=e.copy(c)).src),p.push(C)}else c.src.match(/fonts\.googleapis\.com/)?z.push(c):g.push(c);else{L(c);var T={src:c,loadTimeout:r};zot(l)||(T.type=l),p.push(T)}if(f&&b){var E=document.createElement("audio");E.setAttribute("src",(zot(o)?"":o)+c),document.body.appendChild(E),b=!1}}x.loadAssetsCount++,x.isLoading=!0;var M=new e.Queue;if(M.isLoading=!0,M.loadAssetsCount=0,g.length>0){for(var j,S,A=[],P=0;P<g.length;P++)j={src:"url("+((S=g[P]).src.match(/^http/i)?"":o||"")+S.src+")"+(S.type?" format('"+S.type+"')":""),family:S.font},S.weight&&(j.weight=S.weight),S.style&&(j.style=S.style),A.push(j);(O=new createjs.FontLoader({src:A},!0)).on("complete",X),O.on("error",X),O.load(),M.loadAssetsCount++}if(z.length>0){var O;for(P=0;P<z.length;P++)j={src:(S=z[P]).src,type:"fontcss"},M.loadAssetsCount++,(O=new createjs.FontLoader(j,!0)).on("complete",X),O.on("error",X),O.load()}var I=Date.now(),D=new createjs.Event("complete");if(v>0){M.loadAssetsCount++;var B=M.preload=x.preload=new createjs.LoadQueue(n,o,s);f&&B.installPlugin(createjs.Sound),B.on("progress",function(e){M.dispatchEvent(e),x.dispatchEvent(e)}),B.on("error",function(e){M.dispatchEvent(e),x.dispatchEvent(e)}),B.on("fileload",function(t){var n,i=t.item,r=t.item.type;i.id.match(m);if(r&&"sound"==r){var a=[];if(i.data&&i.data.audioSprite)for(var s=0;s<i.data.audioSprite.length;s++)a.push(i.data.audioSprite[s].id);else a.push(i.id);for(s=0;s<a.length;s++)!function(){var e=a[s];n=x.assets[a[s]]={type:"sound",path:o,id:e,play:function(t){var o=createjs.Sound.play(e,t);return o.getStage=function(){return k},o}}}()}else n=x.assets[i.id]="image"==r?new e.Bitmap(t.result,t.result.width,t.result.height,i.id):t.result;var l=new createjs.Event("assetload");l.item=i,l.asset=n,M.dispatchEvent(t),x.dispatchEvent(l)}),x.preloadEvent=B.on("complete",function(e){D=e,M.loadAssetsCount--,0==M.loadAssetsCount&&Y()}),B.loadManifest(p)}return M}function L(e){v++,(u=e.match(m))&&createjs.Sound.SUPPORTED_EXTENSIONS.indexOf(u[1])>=0&&(f=!0)}function X(){M.loadAssetsCount--,0==M.loadAssetsCount&&Y()}function Y(){var e=Date.now();i=Math.max(0,i-(e-I)),setTimeout(function(){x.loadAssetsCount--,x.loadAssetsCount<=0&&(x.isLoading=!1),M.isLoading=!1,M.dispatchEvent(D),x.dispatchEvent(D)},i)}},this.asset=function(e){if(!zot(e)){if(x.assets[e])return x.assets[e];if("circles"==x.loadFailObj)var t=frame.makeCircles(14);else t=x.loadFailObj;return t&&(t.type="EmptyAsset",t.id=e,t.play=function(){if(zon)return zog("zim.Frame - asset("+e+") not found"),{}}),t}},Object.defineProperty(x,"stage",{get:function(){return k},set:function(e){zog("zim.Frame(): stage is read only - see remakeCanvas(), perhaps")}}),Object.defineProperty(x,"width",{get:function(){return O},set:function(e){zog("zim.Frame(): width is read only - see remakeCanvas(), perhaps")}}),Object.defineProperty(x,"height",{get:function(){return I},set:function(e){zog("zim.Frame(): height is read only - see remakeCanvas(), perhaps")}}),Object.defineProperty(this,"color",{get:function(){return i},set:function(t){i=t,zot(t)?zid(c).style.backgroundColor="default":(zid(c).style.backgroundColor=i,!zot(i)&&p&&k.setClearColor(e.convertColor(i)))}}),Object.defineProperty(this,"outerColor",{get:function(){return L},set:function(e){L=e,zet("body").css({backgroundColor:L})}});var _=v;Object.defineProperty(x,"allowDefault",{get:function(){return _},set:function(e){e?(k.preventSelection=!1,document.body.style.overflow="visible",x.zil&&(window.removeEventListener("keydown",x.zil[0]),window.removeEventListener("wheel",x.zil[1]),window.removeEventListener("DOMMouseScroll",x.zil[2]),x.zil=null)):(k.preventSelection=!0,document.body.style.overflow="hidden",zot(x.zil)&&(x.zil=zil())),_=e}});var R=new createjs.Event("keydown");if(this.eventRemove=R.remove,window.addEventListener("keydown",function(e){e.remove=x.eventRemove,x.altKey=e.altKey,x.ctrlKey=e.ctrlKey,x.metaKey=e.metaKey,x.shiftKey=e.shiftKey,x.dispatchEvent(e)}),window.addEventListener("keyup",function(e){x.altKey=e.altKey,x.ctrlKey=e.ctrlKey,x.metaKey=e.metaKey,x.shiftKey=e.shiftKey,e.remove=x.eventRemove,x.dispatchEvent(e)}),window.DeviceMotionEvent&&window.addEventListener("devicemotion",function(e){e.remove=x.eventRemove,x.dispatchEvent(e)}),window.DeviceOrientationEvent){var W=0,N=0;window.addEventListener("deviceorientation",function(e){e.remove=x.eventRemove;var t=360-e.alpha;Math.abs(t-W)>135&&Math.abs(t-W)<225&&(N=0==N?180:0),W=t,e.rotation={x:e.beta,y:e.gamma,z:(t+N)%360},x.dispatchEvent(e)})}this.remakeCanvas=function(e,o){"full"!=t&&(zot(e)&&(e=O),zot(o)&&(o=I),zid(c)&&zid(c).parentNode.removeChild(zid(c)),O=e,I=o,V(),H())},this.dispose=function(){return window.removeEventListener("resize",G),k.removeAllChildren(),k.removeAllEventListeners(),zid(c)&&zid(c).parentNode.removeChild(zid(c)),k=null,x=null,!0},this.orange="#f58e25",this.green="#acd241",this.pink="#e472c4",this.blue="#50c4b7",this.brown="#d1a170",this.yellow="#ebcb35",this.purple="#993399",this.red="#fb4758",this.silver="#999999",this.tin="#777777",this.grey="#555555",this.gray="#555555",this.lighter="#eeeeee",this.light="#cccccc",this.dark="#333333",this.darker="#111111",this.black="#000000",this.white="#FFFFFF",this.clear="rgba(0,0,0,0)",this.faint="rgba(0,0,0,.01)",this.makeCircles=function(t,o){zot(t)&&(t=100);var n=[x.orange,x.green,x.pink,x.blue,x.brown,x.dark];if(o){(r=new e.Container).radius=t;for(var i=0;i<n.length;i++)r.addChild(new Circle(r.radius/n.length*(n.length-i),n[i]))}else{var r,a=(r=new e.Shape).graphics;r.radius=t;for(i=0;i<n.length;i++)a.f(n[i]).dc(0,0,r.radius/n.length*(n.length-i));r.setBounds(-r.radius,-r.radius,2*r.radius,2*r.radius)}return r}}else setTimeout(function(){x.dispatchEvent("failed")},100);function F(){if(!B){if(B=!0,-1==E.indexOf(t)){if(zot(zid(S=t)))return void zog("zim.Frame - scaling: HTML tag with id="+t+" must exist");A=this.tag=zid(S),t=zot(o)||zot(n)?"tag":"inline",0==c.indexOf("myCanvas")&&(c=S+"Canvas")}x.canvasID=c,zot(o)&&(o=500),zot(n)&&(n=500),zot(b)||(x.outerColor=b),V(),H(),C?(s&&setTimeout(function(){window.scrollTo(0,0)},50),setTimeout(function(){G(),x.dispatchEvent("ready"),D=!0,Z()},100),h>100&&setTimeout(function(){G(),Z()},h)):(x.dispatchEvent("ready"),D=!0,Z())}}function V(){var o=x.canvas=document.createElement("canvas");o.setAttribute("id",c),o.setAttribute("tabindex",0),"full"==t||"tag"==t?(o.setAttribute("width",e.windowWidth()),o.setAttribute("height",e.windowHeight())):(o.setAttribute("width",O),o.setAttribute("height",I)),"tag"==t||"inline"==t?A.appendChild(o):document.body.appendChild(o),zot(i)||(o.style.backgroundColor=i),"full"!=t&&"fit"!=t&&"outside"!=t||(o.style.position="absolute",v||(document.body.style.overflow="hidden"))}function H(){G(),-1==E.indexOf(t)||v||(x.zil=zil()),k=p?new e.StageGL(c,m):new e.Stage(c),!zot(i)&&p&&k.setClearColor(e.convertColor(i)),k.setBounds(0,0,O,I),k.width=O,k.height=I,r&&k.enableMouseOver(10),a&&createjs.Touch.enable(k,!1,v),v&&(k.preventSelection=!1),g&&(k.nextStage=g.stage),z&&(k.nextStage=z)}function G(){var o,n,i=zid(c),r=e.windowWidth(),a=e.windowHeight();if((M=x.orientation=r>a?"horizontal":"vertical")!=j&&(j=M,x.dispatchEvent("orientation")),C&&s&&setTimeout(function(){window.scrollTo(0,0)},100),i){if("fit"==t)x.scale=r/a>=O/I?a/I:r/O;else if("outside"==t)x.scale=r/a>=O/I?r/O:a/I;else{if("full"==t)return i.style.left=i.style.top="0px",i.width=O=r,i.height=I=a,k&&(k.setBounds(0,0,O,I),k.width=O,k.height=I,p&&k.updateViewport(O,I)),void U();if("tag"==t)return O=""==A.style.width?A.getAttribute("width")||A.offsetWidth:A.style.width,I=""==A.style.height?A.getAttribute("height")||A.offsetHeight:A.style.height,k&&(k.setBounds(0,0,O,I),k.width=O,k.height=I,p&&k.updateViewport(O,I)),A.style.overflow="hidden",i.width=O,i.height=I,i.style.left=i.style.top="0px",void U();if("inline"==t)return k&&(k.setBounds(0,0,O,I),k.width=O,k.height=I,p&&k.updateViewport(O,I)),i.style.left=i.style.top="0px",void U()}n=I*x.scale,o=O*x.scale,i.style.width=o+"px",i.style.height=n+"px",x.x="left"==l?0:"right"==l?r-o:(r-o)/2,x.y="top"==d?0:"bottom"==d?a-n:(a-n)/2,i.style.left=x.x+"px",i.style.top=x.y+"px",U()}}function U(){if("outside"==t){var e=(zum(frame.canvas.style.width)-windowWidth())/2;"left"==l?(x.visibleLeft=0,x.visibleRight=windowWidth()/(windowWidth()+2*e)*O):"right"==l?(x.visibleLeft=2*e/(windowWidth()+2*e)*O,x.visibleRight=O):(x.visibleLeft=e/(windowWidth()+2*e)*O,x.visibleRight=(windowWidth()+e)/(windowWidth()+2*e)*O);var o=(zum(frame.canvas.style.height)-windowHeight())/2;"top"==d?(x.visibleTop=0,x.visibleBottom=windowHeight()/(windowHeight()+2*o)*I):"bottom"==d?(x.visibleTop=2*o/(windowHeight()+2*o)*I,x.visibleBottom=I):(x.visibleTop=o/(windowHeight()+2*o)*I,x.visibleBottom=(windowHeight()+o)/(windowHeight()+2*o)*I)}else x.visibleLeft=x.visibleTop=0,x.visibleRight=O,x.visibleBottom=I}function Z(){D&&(x.dispatchEvent("resize"),e.OPTIMIZE||!zns&&OPTIMIZE||!k||"full"!=t&&"tag"!=t||k.update())}},e.extend(e.Frame,createjs.EventDispatcher,null,"cjsEventDispatcher",!1),e.Queue=function(){this.cjsEventDispatcher_constructor(),this.isLoading=!0},e.extend(e.Queue,createjs.EventDispatcher,null,"cjsEventDispatcher"),DISTILL=!1,e.distillery=[],e.distill=function(){!window.zns&&e&&(e.DISTILL||window.DISTILL)&&e.distillery.push("83.3","83.35"),zog("zim.distill() - go to http://zimjs.com/distill and enter the following:"),zog(e.distillery.length>0?e.distillery.join(" "):"must set zim.DISTILL=true;")},e.parseAudioSprite=function(e,t){if(z_d("83.25"),!(zot(e)||zot(e.resources)||zot(e.spritemap))){var o,n=e.resources[0],r=e.spritemap,a=[],s={src:n,data:{}};for(i in r)o=r[i],a.push({id:i,startTime:Math.round(1e3*o.start),duration:Math.round(1e3*(o.end-o.start))});return s.data.audioSprite=a,t&&zog(JSON.stringify(s)),s}},e.previewAudioSprite=function(t,o,n){if(z_d("83.26"),!zot(t)){if(zot(o)&&(o=3),zot(n)){if(zot(zimDefaultFrame))return;n=zimDefaultFrame,stage=n.stage}var i=t,r=[],a=[];if(i.constructor=={}.constructor){i.resources&&(i=e.parseAudioSprite(i)),i.audioSprite?loop(i.audioSprite,function(e){r.push(e[0].substr(0,o)),a.push(e[0])}):i.data&&i.data.audioSprite&&loop(i.data.audioSprite,function(e){r.push(e.id.substr(0,o)),a.push(e.id)});var s=new Tabs({tabs:r,width:stageW,currentEnabled:!0}).addTo(stage);return s.on("change",function(){n.asset(a[s.selectedIndex]).play()}),s}}},e}(zim||{}))||{});window.zns||zimplify();