vard=c&&"left"===c?"scrollLeft":"scrollTop",e=!1;returnb[d]>0?!0:(b[d]=1,e=b[d]>0,b[d]=0,e)}})}(jQuery),function(a,b){varc=0,d=Array.prototype.slice,e=a.cleanData;a.cleanData=function(b){for(varc,d=0;null!=(c=b[d]);d++)try{a(c).triggerHandler("remove")}catch(f){}e(b)},a.widget=function(b,c,d){vare,f,g,h,i={},j=b.split(".")[0];b=b.split(".")[1],e=j+"-"+b,d||(d=c,c=a.Widget),a.expr[":"][e.toLowerCase()]=function(b){return!!a.data(b,e)},a[j]=a[j]||{},f=a[j][b],g=a[j][b]=function(a,b){returnthis._createWidget?(arguments.length&&this._createWidget(a,b),void0):newg(a,b)},a.extend(g,f,{version:d.version,_proto:a.extend({},d),_childConstructors:[]}),h=newc,h.options=a.widget.extend({},h.options),a.each(d,function(b,d){returna.isFunction(d)?(i[b]=function(){vara=function(){returnc.prototype[b].apply(this,arguments)},e=function(a){returnc.prototype[b].apply(this,a)};returnfunction(){varb,c=this._super,f=this._superApply;returnthis._super=a,this._superApply=e,b=d.apply(this,arguments),this._super=c,this._superApply=f,b}}(),void0):(i[b]=d,void0)}),g.prototype=a.widget.extend(h,{widgetEventPrefix:f?h.widgetEventPrefix:b},i,{constructor:g,namespace:j,widgetName:b,widgetFullName:e}),f?(a.each(f._childConstructors,function(b,c){vard=c.prototype;a.widget(d.namespace+"."+d.widgetName,g,c._proto)}),deletef._childConstructors):c._childConstructors.push(g),a.widget.bridge(b,g)},a.widget.extend=function(c){for(vare,f,g=d.call(arguments,1),h=0,i=g.length;i>h;h++)for(eing[h])f=g[h][e],g[h].hasOwnProperty(e)&&f!==b&&(c[e]=a.isPlainObject(f)?a.isPlainObject(c[e])?a.widget.extend({},c[e],f):a.widget.extend({},f):f);returnc},a.widget.bridge=function(c,e){varf=e.prototype.widgetFullName||c;a.fn[c]=function(g){varh="string"==typeofg,i=d.call(arguments,1),j=this;returng=!h&&i.length?a.widget.extend.apply(null,[g].concat(i)):g,h?this.each(function(){vard,e=a.data(this,f);returne?a.isFunction(e[g])&&"_"!==g.charAt(0)?(d=e[g].apply(e,i),d!==e&&d!==b?(j=d&&d.jquery?j.pushStack(d.get()):d,!1):void0):a.error("no such method '"+g+"' for "+c+" widget instance"):a.error("cannot call methods on "+c+" prior to initialization; "+"attempted to call method '"+g+"'")}):this.each(function(){varb=a.data(this,f);b?b.option(g||{})._init():a.data(this,f,newe(g,this))}),j}},a.Widget=function(){},a.Widget._childConstructors=[],a.Widget.prototype={widgetName:"widget",widgetEventPrefix:"",defaultElement:"<div>",options:{disabled:!1,create:null},_createWidget:function(b,d){d=a(d||this.defaultElement||this)[0],this.element=a(d),this.uuid=c++,this.eventNamespace="."+this.widgetName+this.uuid,this.options=a.widget.extend({},this.options,this._getCreateOptions(),b),this.bindings=a(),this.hoverable=a(),this.focusable=a(),d!==this&&(a.data(d,this.widgetFullName,this),this._on(!0,this.element,{remove:function(a){a.target===d&&this.destroy()}}),this.document=a(d.style?d.ownerDocument:d.document||d),this.window=a(this.document[0].defaultView||this.document[0].parentWindow)),this._create(),this._trigger("create",null,this._getCreateEventData()),this._init()},_getCreateOptions:a.noop,_getCreateEventData:a.noop,_create:a.noop,_init:a.noop,destroy:function(){this._destroy(),this.element.unbind(this.eventNamespace).removeData(this.widgetName).removeData(this.widgetFullName).removeData(a.camelCase(this.widgetFullName)),this.widget().unbind(this.eventNamespace).removeAttr("aria-disabled").removeClass(this.widgetFullName+"-disabled "+"ui-state-disabled"),this.bindings.unbind(this.eventNamespace),this.hoverable.removeClass("ui-state-hover"),this.focusable.removeClass("ui-state-focus")},_destroy:a.noop,widget:function(){returnthis.element},option:function(c,d){vare,f,g,h=c;if(0===arguments.length)returna.widget.extend({},this.options);if("string"==typeofc)if(h={},e=c.split("."),c=e.shift(),e.length){for(f=h[c]=a.widget.extend({},this.options[c]),g=0;g<e.length-1;g++)f[e[g]]=f[e[g]]||{},f=f[e[g]];if(c=e.pop(),d===b)returnf[c]===b?null:f[c];f[c]=d}else{if(d===b)returnthis.options[c]===b?null:this.options[c];h[c]=d}returnthis._setOptions(h),this},_setOption
}}.call(this,this.containers[c])),this.containers[c].containerCache.over=0);if(this.storedCursor&&(this.document.find("body").css("cursor",this.storedCursor),this.storedStylesheet.remove()),this._storedOpacity&&this.helper.css("opacity",this._storedOpacity),this._storedZIndex&&this.helper.css("zIndex","auto"===this._storedZIndex?"":this._storedZIndex),this.dragging=!1,this.cancelHelperRemoval){if(!b){for(this._trigger("beforeStop",a,this._uiHash()),c=0;c<d.length;c++)d[c].call(this,a);this._trigger("stop",a,this._uiHash())}returnthis.fromOutside=!1,!1}if(b||this._trigger("beforeStop",a,this._uiHash()),this.placeholder[0].parentNode.removeChild(this.placeholder[0]),this.helper[0]!==this.currentItem[0]&&this.helper.remove(),this.helper=null,!b){for(c=0;c<d.length;c++)d[c].call(this,a);this._trigger("stop",a,this._uiHash())}returnthis.fromOutside=!1,!0},_trigger:function(){a.Widget.prototype._trigger.apply(this,arguments)===!1&&this.cancel()},_uiHash:function(b){varc=b||this;return{helper:c.helper,placeholder:c.placeholder||a([]),position:c.position,originalPosition:c.originalPosition,offset:c.positionAbs,item:c.currentItem,sender:b?b.element:null}}})}(jQuery),function(a){varb=a({});a.subscribe=function(){b.on.apply(b,arguments)},a.unsubscribe=function(){b.off.apply(b,arguments)},a.publish=function(){b.trigger.apply(b,arguments)}}(jQuery),!function(a){"use strict";varb=function(a,b){this.init("tooltip",a,b)};b.prototype={constructor:b,init:function(b,c,d){vare,f;this.type=b,this.$element=a(c),this.options=this.getOptions(d),this.enabled=!0,"click"==this.options.trigger?this.$element.on("click."+this.type,this.options.selector,a.proxy(this.toggle,this)):"manual"!=this.options.trigger&&(e="hover"==this.options.trigger?"mouseenter":"focus",f="hover"==this.options.trigger?"mouseleave":"blur",this.$element.on(e+"."+this.type,this.options.selector,a.proxy(this.enter,this)),this.$element.on(f+"."+this.type,this.options.selector,a.proxy(this.leave,this))),this.options.selector?this._options=a.extend({},this.options,{trigger:"manual",selector:""}):this.fixTitle()},getOptions:function(b){returnb=a.extend({},a.fn[this.type].defaults,b,this.$element.data()),b.delay&&"number"==typeofb.delay&&(b.delay={show:b.delay,hide:b.delay}),b},enter:function(b){varc=a(b.currentTarget)[this.type](this._options).data(this.type);returnc.options.delay&&c.options.delay.show?(clearTimeout(this.timeout),c.hoverState="in",this.timeout=setTimeout(function(){"in"==c.hoverState&&c.show()},c.options.delay.show),void0):c.show()},leave:function(b){varc=a(b.currentTarget)[this.type](this._options).data(this.type);returnthis.timeout&&clearTimeout(this.timeout),c.options.delay&&c.options.delay.hide?(c.hoverState="out",this.timeout=setTimeout(function(){"out"==c.hoverState&&c.hide()},c.options.delay.hide),void0):c.hide()},show:function(){vara,b,c,d,e,f,g;if(this.hasContent()&&this.enabled){switch(a=this.tip(),this.setContent(),this.options.animation&&a.addClass("fade"),f="function"==typeofthis.options.placement?this.options.placement.call(this,a[0],this.$element[0]):this.options.placement,b=/in/.test(f),a.remove().css({top:0,left:0,display:"block"}).appendTo(b?this.$element:document.body),c=this.getPosition(b),d=a[0].offsetWidth,e=a[0].offsetHeight,b?f.split(" ")[1]:f){case"bottom":g={top:c.top+c.height,left:c.left+c.width/2-d/2};break;case"top":g={top:c.top-e,left:c.left+c.width/2-d/2};break;case"left":g={top:c.top+c.height/2-e/2,left:c.left-d};break;case"right":g={top:c.top+c.height/2-e/2,left:c.left+c.width}}a.css(g).addClass(f).addClass("in")}},setContent:function(){vara=this.tip(),b=this.getTitle();a.find(".tooltip-inner")[this.options.html?"html":"text"](b),a.removeClass("fade in top bottom left right")},hide:function(){functionb(){varb=setTimeout(function(){c.off(a.support.transition.end).remove()},500);c.one(a.support.transition.end,function(){clearTimeout(b),c.remove()})}varc=this.tip();returnc.removeClass("in"),a.support.transition&&this.$tip.hasClass("fade")?b():c.remove(),this},fixTitle:function(){vara=this.$element;(a.attr("title"
for(vare=0,f=0;d>f;f++){varg=b[f];a[e++]=H[g][0],a[e++]=H[g][1],a[e++]=H[g][2]}returna}varH,I,J,K,L;this.buildColormap=F,this.getColormap=G,this.lookupRGB=D}varc=100,d=256,e=d-1,f=4,g=16,h=1<<g,i=10,j=10,k=h>>j,l=h<<i-j,m=d>>3,n=6,o=1<<n,p=m*o,q=30,r=10,s=1<<r,t=8,u=1<<t,v=r+t,w=1<<v,x=499,y=491,z=487,A=503,B=3*A;a.exports=b}),a("/gif.worker.coffee")}.call(this,this)};try{if(pskl.utils.UserAgent.isIE11)window.GifWorkerURL="/js/lib/gif/gif.ie.worker.js";else{varb=[(a+"").replace(/function \(\)\s?\{/,"").replace(/\}[^}]*$/,"")],c=newBlob(b,{type:"application/javascript"});window.GifWorkerURL=URL.createObjectURL(c)}}catch(d){console.error("Could not create worker",d.message)}}(),function(a){functionb(a,c){if({}.hasOwnProperty.call(b.cache,a))returnb.cache[a];vard=b.resolve(a);if(!d)thrownewError("Failed to resolve module "+a);vare={id:a,require:b,filename:a,exports:{},loaded:!1,parent:c,children:[]};c&&c.children.push(e);varf=a.slice(0,a.lastIndexOf("/")+1);returnb.cache[a]=e.exports,d.call(e.exports,e,e.exports,f,a),e.loaded=!0,b.cache[a]=e.exports}b.modules={},b.cache={},b.resolve=function(a){return{}.hasOwnProperty.call(b.modules,a)?b.modules[a]:void0},b.define=function(a,c){b.modules[a]=c};varc=function(b){returnb="/",{title:"browser",version:"v0.8.19",browser:!0,env:{},argv:[],nextTick:a.setImmediate||function(a){setTimeout(a,0)},cwd:function(){returnb},chdir:function(a){b=a}}}();b.define("/gif.coffee",function(a){functionc(a,b){return{}.hasOwnProperty.call(a,b)}functiond(a,b){for(varc=0,d=b.length;d>c;++c)if(cinb&&b[c]===a)return!0;return!1}functione(a,b){functiond(){this.constructor=a}for(vareinb)c(b,e)&&(a[e]=b[e]);returnd.prototype=b.prototype,a.prototype=newd,a.__super__=b.prototype,a}varf,g,h,i,j;h=b("events",a).EventEmitter,f=b("/browser.coffee",a),j=function(a){functionb(a){varb,c;this.running=!1,this.options={},this.frames=[],this.freeWorkers=[],this.activeWorkers=[],this.setOptions(a);for(bing)c=g[b],null!=this.options[b]?this.options[b]:this.options[b]=c}returne(b,a),g={workerScript:window.GifWorkerURL,workers:2,repeat:0,background:"#fff",quality:10,width:null,height:null,transparent:null,preserveColors:!1},i={delay:500,copy:!1},b.prototype.setOption=function(a,b){returnthis.options[a]=b,null==this._canvas||"width"!==a&&"height"!==a?void0:this._canvas[a]=b},b.prototype.setOptions=function(a){varb,d;returnfunction(e){for(bina)c(a,b)&&(d=a[b],e.push(this.setOption(b,d)));returne}.call(this,[])},b.prototype.addFrame=function(a,b){varc,d;null==b&&(b={}),c={},c.transparent=this.options.transparent;for(dini)c[d]=b[d]||i[d];if(null!=this.options.width||this.setOption("width",a.width),null!=this.options.height||this.setOption("height",a.height),"undefined"!=typeofImageData&&null!=ImageData&&ainstanceofImageData)c.data=a.data;elseif("undefined"!=typeofCanvasRenderingContext2D&&null!=CanvasRenderingContext2D&&ainstanceofCanvasRenderingContext2D||"undefined"!=typeofWebGLRenderingContext&&null!=WebGLRenderingContext&&ainstanceofWebGLRenderingContext)b.copy?c.data=this.getContextData(a):c.context=a;else{if(null==a.childNodes)thrownewError("Invalid image");b.copy?c.data=this.getImageData(a):c.image=a}returnthis.frames.push(c)},b.prototype.render=function(){vara,b;if(this.running)thrownewError("Already running");if(null==this.options.width||null==this.options.height)thrownewError("Width and height must be set prior to rendering");this.running=!0,this.nextFrame=0,this.finishedFrames=0,this.imageParts=function(b){for(varc=function(){vara;a=[];for(varb=0;0<=this.frames.length?b<this.frames.length:b>this.frames.length;0<=this.frames.length?++b:--b)a.push(b);returna}.apply(this,arguments),d=0,e=c.length;e>d;++d)a=c[d],b.push(null);returnb}.call(this,[]),b=this.spawnWorkers();for(varc=function(){vara;a=[];for(varc=0;b>=0?b>c:c>b;b>=0?++c:--c)a.push(c);returna}.apply(this,arguments),d=0,e=c.length;e>d;++d)a=c[d],this.renderNextFrame();returnthis.emit("start"),this.emit("progress",0)},b.prototype.abort=function(){for(vara;;){if(a=this.activeWorkers.shift(
h.append(e),c.blob=0===h.getBlob("application/zip").size}catch(f){c.blob=!1}}}},{__browserify_process:18}],13:[function(a,b){"use strict";functionc(a){a&&(this.data=a,this.length=this.data.length,this.index=0)}vard=a("./dataReader");c.prototype=newd,c.prototype.byteAt=function(a){returnthis.data[a]},c.prototype.lastIndexOfSignature=function(a){for(varb=a.charCodeAt(0),c=a.charCodeAt(1),d=a.charCodeAt(2),e=a.charCodeAt(3),f=this.length-4;f>=0;--f)if(this.data[f]===b&&this.data[f+1]===c&&this.data[f+2]===d&&this.data[f+3]===e)returnf;return-1},c.prototype.readData=function(a){this.checkOffset(a);varb=this.data.subarray(this.index,this.index+a);returnthis.index+=a,b},b.exports=c},{"./dataReader":4}],14:[function(a,b,c){"use strict";functiond(a){returna}functione(a,b){for(varc=0;c<a.length;++c)b[c]=255&a.charCodeAt(c);returnb}functionf(a){varb=65536,d=[],e=a.length,f=c.getTypeOf(a),g=0,h=!0;try{switch(f){case"uint8array":String.fromCharCode.apply(null,newUint8Array(0));break;case"nodebuffer":String.fromCharCode.apply(null,j(0))}}catch(i){h=!1}if(!h){for(vark="",l=0;l<a.length;l++)k+=String.fromCharCode(a[l]);returnk}for(;e>g&&b>1;)try{d.push("array"===f||"nodebuffer"===f?String.fromCharCode.apply(null,a.slice(g,Math.min(g+b,e))):String.fromCharCode.apply(null,a.subarray(g,Math.min(g+b,e)))),g+=b}catch(i){b=Math.floor(b/2)}returnd.join("")}functiong(a,b){for(varc=0;c<a.length;c++)b[c]=a[c];returnb}varh=a("./support"),i=a("./compressions"),j=a("./nodeBuffer");c.string2binary=function(a){for(varb="",c=0;c<a.length;c++)b+=String.fromCharCode(255&a.charCodeAt(c));returnb},c.string2Uint8Array=function(a){returnc.transformTo("uint8array",a)},c.uint8Array2String=function(a){returnc.transformTo("string",a)},c.string2Blob=function(a){varb=c.transformTo("arraybuffer",a);returnc.arrayBuffer2Blob(b)},c.arrayBuffer2Blob=function(a){c.checkSupport("blob");try{returnnewBlob([a],{type:"application/zip"})}catch(b){try{vard=window.BlobBuilder||window.WebKitBlobBuilder||window.MozBlobBuilder||window.MSBlobBuilder,e=newd;returne.append(a),e.getBlob("application/zip")}catch(b){thrownewError("Bug : can't construct the Blob.")}}};vark={};k.string={string:d,array:function(a){returne(a,newArray(a.length))},arraybuffer:function(a){returnk.string.uint8array(a).buffer},uint8array:function(a){returne(a,newUint8Array(a.length))},nodebuffer:function(a){returne(a,j(a.length))}},k.array={string:f,array:d,arraybuffer:function(a){returnnewUint8Array(a).buffer},uint8array:function(a){returnnewUint8Array(a)},nodebuffer:function(a){returnj(a)}},k.arraybuffer={string:function(a){returnf(newUint8Array(a))},array:function(a){returng(newUint8Array(a),newArray(a.byteLength))},arraybuffer:d,uint8array:function(a){returnnewUint8Array(a)},nodebuffer:function(a){returnj(newUint8Array(a))}},k.uint8array={string:f,array:function(a){returng(a,newArray(a.length))},arraybuffer:function(a){returna.buffer},uint8array:d,nodebuffer:function(a){returnj(a)}},k.nodebuffer={string:f,array:function(a){returng(a,newArray(a.length))},arraybuffer:function(a){returnk.nodebuffer.uint8array(a).buffer},uint8array:function(a){returng(a,newUint8Array(a.length))},nodebuffer:d},c.transformTo=function(a,b){if(b||(b=""),!a)returnb;c.checkSupport(a);vard=c.getTypeOf(b),e=k[d][a](b);returne},c.getTypeOf=function(a){return"string"==typeofa?"string":"[object Array]"===Object.prototype.toString.call(a)?"array":h.nodebuffer&&j.test(a)?"nodebuffer":h.uint8array&&ainstanceofUint8Array?"uint8array":h.arraybuffer&&ainstanceofArrayBuffer?"arraybuffer":void0},c.checkSupport=function(a){varb=h[a.toLowerCase()];if(!b)thrownewError(a+" is not supported by this browser")},c.MAX_VALUE_16BITS=65535,c.MAX_VALUE_32BITS=-1,c.pretty=function(a){varb,c,d="";for(c=0;c<(a||"").length;c++)b=a.charCodeAt(c),d+="\\x"+(16>b?"0":"")+b.toString(16).toUpperCase();returnd},c.findCompression=function(a){for(varbini)if(i.hasOwnProperty(b)&&i[b].magic===a)returni[b];returnnull},c.isRegExp=function(a){return"[object RegExp]"===Object.prototype.toStri
})},a.CompositeRenderer.prototype.getZoom=function(){returnthis.getSampleRenderer_().getZoom()},a.CompositeRenderer.prototype.setDisplaySize=function(a,b){this.renderers.forEach(function(c){c.setDisplaySize(a,b)})},a.CompositeRenderer.prototype.getDisplaySize=function(){returnthis.getSampleRenderer_().getDisplaySize()},a.CompositeRenderer.prototype.setOffset=function(a,b){this.renderers.forEach(function(c){c.setOffset(a,b)})},a.CompositeRenderer.prototype.getOffset=function(){returnthis.getSampleRenderer_().getOffset()},a.CompositeRenderer.prototype.setGridWidth=function(a){this.renderers.forEach(function(b){b.setGridWidth(a)})},a.CompositeRenderer.prototype.getGridWidth=function(){returnthis.getSampleRenderer_().getGridWidth()},a.CompositeRenderer.prototype.getSampleRenderer_=function(){if(this.renderers.length>0)returnthis.renderers[0];throw"Renderer manager is empty"}}(),function(){vara=$.namespace("pskl.rendering.layer");a.LayersRenderer=function(a,b,c){pskl.rendering.CompositeRenderer.call(this),this.piskelController=c,this.belowRenderer=newpskl.rendering.frame.FrameRenderer(a,b,["layers-canvas","layers-below-canvas"]),this.aboveRenderer=newpskl.rendering.frame.FrameRenderer(a,b,["layers-canvas","layers-above-canvas"]),this.add(this.belowRenderer),this.add(this.aboveRenderer),this.serializedRendering=""},pskl.utils.inherit(pskl.rendering.layer.LayersRenderer,pskl.rendering.CompositeRenderer),a.LayersRenderer.prototype.render=function(){vara=this.getOffset(),b=this.getDisplaySize(),c=this.piskelController.getLayers(),d=this.piskelController.getCurrentFrameIndex(),e=this.piskelController.getCurrentLayerIndex(),f=[this.getZoom(),this.getGridWidth(),a.x,a.y,b.width,b.height,d,e,c.length].join("-");if(this.serializedRendering!=f){this.serializedRendering=f,this.clear();varg=c.slice(0,e);if(g.length>0){varh=this.getFrameForLayersAt_(d,g);this.belowRenderer.render(h)}vari=c.slice(e+1,c.length);if(i.length>0){varj=this.getFrameForLayersAt_(d,i);this.aboveRenderer.render(j)}}},a.LayersRenderer.prototype.setDisplaySize=function(a,b){varc=this.getDisplaySize();(c.width!==a||c.height!==b)&&this.superclass.setDisplaySize.call(this,a,b)},a.LayersRenderer.prototype.getFrameForLayersAt_=function(a,b){varc=b.map(function(b){returnb.getFrameAt(a)});returnpskl.utils.FrameUtils.merge(c)},a.LayersRenderer.prototype.flush=function(){this.serializedRendering=""}}(),function(){vara=$.namespace("pskl.rendering.frame");a.FrameRenderer=function(a,b,c){if(this.defaultRenderingOptions={supportGridRendering:!1,zoom:1},b=$.extend(!0,{},this.defaultRenderingOptions,b),void0===a)throw"Bad FrameRenderer initialization. <container> undefined.";if(isNaN(b.zoom))throw"Bad FrameRenderer initialization. <zoom> not well defined.";this.container=a,this.zoom=b.zoom,this.offset={x:0,y:0},this.margin={x:0,y:0},this.supportGridRendering=b.supportGridRendering,this.classes=c||[],this.classes.push("canvas"),this.canvas=null,this.displayCanvas=null,this.setDisplaySize(b.width,b.height),this.setGridWidth(pskl.UserSettings.get(pskl.UserSettings.GRID_WIDTH)),$.subscribe(Events.USER_SETTINGS_CHANGED,this.onUserSettingsChange_.bind(this))},pskl.utils.inherit(pskl.rendering.frame.FrameRenderer,pskl.rendering.AbstractRenderer),a.FrameRenderer.prototype.render=function(a){a&&(this.clear(),this.renderFrame_(a))},a.FrameRenderer.prototype.clear=function(){pskl.CanvasUtils.clear(this.canvas),pskl.CanvasUtils.clear(this.displayCanvas)},a.FrameRenderer.prototype.setZoom=function(a){if(a>Constants.MINIMUM_ZOOM){varb=this.offset.x+this.displayWidth/(2*this.zoom),c=this.offset.y+this.displayHeight/(2*this.zoom);this.zoom=a,this.setOffset(b-this.displayWidth/(2*this.zoom),c-this.displayHeight/(2*this.zoom))}},a.FrameRenderer.prototype.getZoom=function(){returnthis.zoom},a.FrameRenderer.prototype.setDisplaySize=function(a,b){this.displayWidth=a,this.displayHeight=b,this.displayCanvas&&($(this.displayCanvas).remove(),this.displayCanvas=null),this.createDisplayCanvas_()},a.FrameRenderer.prototype.getDisplaySize=function(){return{height:this.displayHeight,width:
}},a.PreviewFilmController.prototype.createPreviews_=function(){this.container.html(""),$(".tooltip").remove();for(vara=this.piskelController.getFrameCount(),c=0,d=a;d>c;c++)this.container.append(this.createPreviewTile_(c));vare=document.createElement("div");e.id="add-frame-action",e.className="add-frame-action",e.setAttribute("data-tile-action",b.NEW_FRAME),e.innerHTML="<p class='label'>Add new frame</p>",this.container.append(e);varf=a>1;f&&this.initDragndropBehavior_(),this.updateScrollerOverflows()},a.PreviewFilmController.prototype.initDragndropBehavior_=function(){$("#preview-list").sortable({placeholder:"preview-tile-drop-proxy",update:$.proxy(this.onUpdate_,this),items:".preview-tile"}),$("#preview-list").disableSelection()},a.PreviewFilmController.prototype.onUpdate_=function(a,b){varc=parseInt(b.item.data("tile-number"),10),d=$(".preview-tile").index(b.item);this.piskelController.moveFrame(c,d),this.piskelController.setCurrentFrameIndex(d)},a.PreviewFilmController.prototype.createPreviewTile_=function(a){varc=this.piskelController.getCurrentLayer().getFrameAt(a),d=document.createElement("li");d.setAttribute("data-tile-number",a),d.setAttribute("data-tile-action",b.SELECT),d.classList.add("preview-tile"),this.piskelController.getCurrentFrame()==c&&d.classList.add("selected");vare=document.createElement("div");e.classList.add("canvas-container",pskl.UserSettings.get(pskl.UserSettings.CANVAS_BACKGROUND));varf=document.createElement("div");f.className="canvas-background",e.appendChild(f);varg=document.createElement("button");if(g.setAttribute("rel","tooltip"),g.setAttribute("data-placement","right"),g.setAttribute("data-tile-number",a),g.setAttribute("data-tile-action",b.CLONE),g.setAttribute("title","Duplicate this frame"),g.className="tile-overlay duplicate-frame-action",d.appendChild(g),e.appendChild(this.getCanvasForFrame(c)),d.appendChild(e),a>0||this.piskelController.getFrameCount()>1){varh=document.createElement("button");h.setAttribute("rel","tooltip"),h.setAttribute("data-placement","right"),h.setAttribute("title","Delete this frame"),h.setAttribute("data-tile-number",a),h.setAttribute("data-tile-action",b.DELETE),h.className="tile-overlay delete-frame-action",d.appendChild(h);vari=document.createElement("div");i.className="tile-overlay dnd-action",d.appendChild(i)}varj=document.createElement("div");returnj.className="tile-overlay tile-count",j.innerHTML=a+1,d.appendChild(j),d},a.PreviewFilmController.prototype.getCanvasForFrame=function(a){varb=this.cachedFrameProcessor.get(a,this.zoom);returnb},a.PreviewFilmController.prototype.frameToPreviewCanvas_=function(a){varb=newpskl.rendering.CanvasRenderer(a,this.zoom);b.drawTransparentAs(Constants.TRANSPARENT_COLOR);varc=b.render();returnc.classList.add("tile-view","canvas"),c},a.PreviewFilmController.prototype.clonePreviewCanvas_=function(a){varb=pskl.CanvasUtils.clone(a);returnb.classList.add("tile-view","canvas"),b},a.PreviewFilmController.prototype.calculateZoom_=function(){vara=this.piskelController.getCurrentFrame(),b=a.getHeight(),c=a.getWidth();returnMath.min(Constants.PREVIEW_FILM_SIZE/b,Constants.PREVIEW_FILM_SIZE/c)}}(),function(){vara=$.namespace("pskl.controller");a.LayersListController=function(a){this.piskelController=a},a.LayersListController.prototype.init=function(){this.layerItemTemplate_=pskl.utils.Template.get("layer-item-template"),this.rootEl=document.querySelector(".layers-list-container"),this.layersListEl=document.querySelector(".layers-list"),this.toggleLayerPreviewEl=document.querySelector(".layers-toggle-preview"),this.rootEl.addEventListener("click",this.onClick_.bind(this)),this.toggleLayerPreviewEl.addEventListener("click",this.toggleLayerPreview_.bind(this)),$.subscribe(Events.PISKEL_RESET,this.renderLayerList_.bind(this)),pskl.app.shortcutService.addShortcut("alt+L",this.toggleLayerPreview_.bind(this)),this.renderLayerList_(),this.updateToggleLayerPreview_(),$.subscribe(Events.USER_SETTINGS_CHANGED,$.proxy(this.onUserSettingsChange_,this))},a.LayersListController.prototype.renderLayerList_=function(){thi
},a.PngExportController.prototype.updateStatus_=function(a){if(a){varc="<a class='image-link' href='{{link}}' target='_blank'>{{shortLink}}</a>",d=pskl.utils.Template.replace(c,{link:a,shortLink:this.shorten_(a,b,"...")});this.uploadStatusContainerEl.innerHTML="Your image is now available at : "+d}},a.PngExportController.prototype.updatePreview_=function(a){this.previewContainerEl.innerHTML="<img class='light-picker-background' style='max-width:240px;' src='"+a+"'/>"},a.PngExportController.prototype.shorten_=function(a,b,c){returna.length>b&&(a=a.substring(0,b),a+=c),a}}(),function(){vara=$.namespace("pskl.controller.settings");a.LocalStorageController=function(){},a.LocalStorageController.prototype.init=function(){this.localStorageItemTemplate_=pskl.utils.Template.get("local-storage-item-template"),this.previousSessionTemplate_=pskl.utils.Template.get("previous-session-info-template"),this.service_=pskl.app.localStorageService,this.piskelsList=$(".local-piskels-list"),this.prevSessionContainer=$(".previous-session"),this.fillRestoreSession_(),this.fillLocalPiskelsList_(),this.piskelsList.click(this.onPiskelsListClick_.bind(this))},a.LocalStorageController.prototype.onPiskelsListClick_=function(a){varb=a.target.getAttribute("data-action"),c=a.target.getAttribute("data-name");"load"===b?window.confirm("This will erase your current piskel. Continue ?")&&(this.service_.load(c),$.publish(Events.CLOSE_SETTINGS_DRAWER)):"delete"===b&&window.confirm("This will permanently DELETE this piskel from your computer. Continue ?")&&(this.service_.remove(c),this.fillLocalPiskelsList_())},a.LocalStorageController.prototype.fillRestoreSession_=function(){vara=pskl.app.backupService.getPreviousPiskelInfo();if(a){varb={name:a.name,date:this.formatDate_(a.date,"{{H}}:{{m}} - {{Y}}/{{M}}/{{D}}")};this.prevSessionContainer.html(pskl.utils.Template.replace(this.previousSessionTemplate_,b)),$(".restore-session-button").click(this.onRestorePreviousSessionClick_.bind(this))}elsethis.prevSessionContainer.html("No piskel backup was found on this browser.")},a.LocalStorageController.prototype.onRestorePreviousSessionClick_=function(){window.confirm("This will erase your current workspace. Continue ?")&&(pskl.app.backupService.load(),$.publish(Events.CLOSE_SETTINGS_DRAWER))};varb=function(a){return10>a?"0"+a:""+a};a.LocalStorageController.prototype.formatDate_=function(a,c){a=newDate(a);vard=pskl.utils.Template.replace(c,{Y:a.getFullYear(),M:b(a.getMonth()+1),D:b(a.getDate()),H:b(a.getHours()),m:b(a.getMinutes())});returnd},a.LocalStorageController.prototype.fillLocalPiskelsList_=function(){vara="",b=this.service_.getKeys();b.sort(function(a,b){returna.date<b.date?1:a.date>b.date?-1:0}),b.forEach(function(b){varc=this.formatDate_(b.date,"{{Y}}/{{M}}/{{D}} {{H}}:{{m}}");a+=pskl.utils.Template.replace(this.localStorageItemTemplate_,{name:b.name,date:c})}.bind(this));varc=this.piskelsList.get(0).tBodies[0];c.innerHTML=a}}(),function(){vara=$.namespace("pskl.controller.settings");a.SaveController=function(a){this.piskelController=a},a.SaveController.prototype.init=function(){this.saveForm=$("form[name=save-form]"),this.nameInput=$("#save-name"),this.descriptionInput=$("#save-description"),this.isPublicCheckbox=$("input[name=save-public-checkbox]"),this.saveOnlineButton=$("#save-online-button"),this.saveLocalButton=$("#save-browser-button"),this.saveFileButton=$("#save-file-button"),this.piskelName=$(".piskel-name").get(0),this.saveOnlineStatus=$("#save-online-status"),this.saveFileStatus=$("#save-file-status"),this.timestamp=newDate;vara=this.piskelController.getPiskel().getDescriptor();this.nameInput.val(a.name),this.descriptionInput.val(a.description),this.isPublicCheckbox.prop("checked",a.isPublic),this.saveFileButton.click(this.saveFile_.bind(this)),this.saveLocalButton.click(this.saveLocal_.bind(this)),this.saveOnlineButton.click(this.saveOnline_.bind(this)),this.saveForm.submit(this.onSaveFormSubmit_.bind(this)),this.nameInput.keyup(this.updateLocalStatusFilename_.bind(this)),pskl.app.isLoggedIn()||(this.saveOnlineButton.hide(),$
a&&c&&(window.localStorage.setItem("bkp.prev.piskel",a),window.localStorage.setItem("bkp.prev.info",c)),window.setInterval(this.backup.bind(this),b)},a.BackupService.prototype.backup=function(){vara=this.piskelController.getPiskel(),b=a.getDescriptor(),c=a.getHash(),d={name:b.name,description:b.info,date:Date.now(),hash:c};c!==this.lastHash&&(this.lastHash=c,window.localStorage.setItem("bkp.next.piskel",this.piskelController.serialize()),window.localStorage.setItem("bkp.next.info",JSON.stringify(d)))},a.BackupService.prototype.getPreviousPiskelInfo=function(){vara=window.localStorage.getItem("bkp.prev.info");returna?JSON.parse(a):void0},a.BackupService.prototype.load=function(){vara=window.localStorage.getItem("bkp.prev.piskel"),b=window.localStorage.getItem("bkp.prev.info");a=JSON.parse(a),b=JSON.parse(b),pskl.utils.serialization.Deserializer.deserialize(a,function(a){a.setDescriptor(newpskl.model.piskel.Descriptor(b.name,b.description,!0)),pskl.app.piskelController.setPiskel(a)})}}(),function(){vara=$.namespace("pskl.service");a.BeforeUnloadService=function(a){this.piskelController=a},a.BeforeUnloadService.prototype.init=function(){window.addEventListener("beforeunload",this.onBeforeUnload.bind(this))},a.BeforeUnloadService.prototype.onBeforeUnload=function(a){if(pskl.app.backupService.backup(),pskl.app.savedStatusService.isDirty()){varb="Your Piskel seems to have unsaved changes";return(a||window.event).returnValue=b,b}}}(),function(){vara=$.namespace("pskl.service"),b=50,c=50;a.HistoryService=function(a){this.piskelController=a,this.stateQueue=[],this.currentIndex=-1,this.saveState__b=this.onSaveStateEvent.bind(this),this.lastLoadState=-1},a.HistoryService.SNAPSHOT="SNAPSHOT",a.HistoryService.REPLAY="REPLAY",a.HistoryService.prototype.init=function(){$.subscribe(Events.PISKEL_SAVE_STATE,this.saveState__b),pskl.app.shortcutService.addShortcut("ctrl+Z",this.undo.bind(this)),pskl.app.shortcutService.addShortcut("ctrl+Y",this.redo.bind(this)),this.saveState({type:a.HistoryService.SNAPSHOT})},a.HistoryService.prototype.onSaveStateEvent=function(a,b){this.saveState(b)},a.HistoryService.prototype.saveState=function(c){this.stateQueue=this.stateQueue.slice(0,this.currentIndex+1),this.currentIndex=this.currentIndex+1;vard={action:c,frameIndex:this.piskelController.currentFrameIndex,layerIndex:this.piskelController.currentLayerIndex};(c.type===a.HistoryService.SNAPSHOT||0===this.currentIndex%b)&&(d.piskel=this.piskelController.serialize(!0)),this.stateQueue.push(d)},a.HistoryService.prototype.undo=function(){this.loadState(this.currentIndex-1)},a.HistoryService.prototype.redo=function(){this.loadState(this.currentIndex+1)},a.HistoryService.prototype.isLoadStateAllowed_=function(a){varb=Date.now()-this.lastLoadState>c,d=a>=0&&a<this.stateQueue.length;returnb&&d},a.HistoryService.prototype.getPreviousSnapshotIndex_=function(a){for(varc=0;this.stateQueue[a]&&!this.stateQueue[a].piskel&&(a-=1,!(++c>2*b)););returna},a.HistoryService.prototype.loadState=function(a){try{if(this.isLoadStateAllowed_(a)){this.lastLoadState=Date.now();varb=this.getPreviousSnapshotIndex_(a);if(0>b)throw"Could not find previous SNAPSHOT saved in history stateQueue";varc=this.getSnapshotFromState_(b),d=this.onPiskelLoaded_.bind(this,a,b);pskl.utils.serialization.Deserializer.deserialize(c,d)}}catch(e){window.console.error("[CRITICAL ERROR] : Unable to load a history state."),window.console.error("Can you open an issue on http://github.com/juliandescottes/piskel or contact @piskelapp on twitter ? Thanks !"),window.console.error("Thanks !"),"string"==typeofe?window.console.error(e):(window.console.error(e.message),window.console.error(e.stack))}},a.HistoryService.prototype.getSnapshotFromState_=function(a){varb=this.stateQueue[a],c=b.piskel;return"string"==typeofc&&(c=JSON.parse(c),b.piskel=c),c},a.HistoryService.prototype.onPiskelLoaded_=function(a,b,c){vard=this.getPiskelSize_();c.setDescriptor(this.piskelController.piskel.getDescriptor()),this.piskelController.setPiskel(c);for(vare=b+1;a>=e;e++){varf=this.stateQueue[e];this.setupStat