>>24],i+=x[(16711680&C)>>16],a+=x[(65280&C)>>8],n+=x[255&C],r+=R[b],s++}w[l=T+y]=o/r,S[l]=i/r,M[l]=a/r,E[l]=n/r}T+=f}for(h=(u=-P)*f,_=T=0;_>>16,e[r+1]=(65280&t[i])>>>8,e[r+2]=255&t[i],e[r+3]=(4278190080&t[i])>>>24},D._toImageData=function(e){return e instanceof ImageData?e:e.getContext("2d").getImageData(0,0,e.width,e.height)},D._createImageData=function(e,t){return D._tmpCanvas=document.createElement("canvas"),D._tmpCtx=D._tmpCanvas.getContext("2d"),this._tmpCtx.createImageData(e,t)},D.apply=function(e,t,r){var i=e.getContext("2d"),a=i.getImageData(0,0,e.width,e.height),n=t(a,r);n instanceof ImageData?i.putImageData(n,0,0,0,0,e.width,e.height):i.putImageData(a,0,0,0,0,e.width,e.height)},D.threshold=function(e,t){var r=D._toPixels(e);void 0===t&&(t=.5);for(var i=Math.floor(255*t),a=0;a>8)/i,r[a+1]=255*(o*t>>8)/i,r[a+2]=255*(s*t>>8)/i}},D.dilate=function(e){for(var t,r,i,a,n,o,s,l,u,h,d,c,f,p,m,v,g,y=D._toPixels(e),_=0,b=y.length?y.length/4:0,x=new Int32Array(b);_>16&255)+151*(i>>8&255)+28*(255&i))<(m=77*(d>>16&255)+151*(d>>8&255)+28*(255&d))&&(a=d,n=m),n<(p=77*((h=D._getARGB(y,o))>>16&255)+151*(h>>8&255)+28*(255&h))&&(a=h,n=p),n<(v=77*(c>>16&255)+151*(c>>8&255)+28*(255&c))&&(a=c,n=v),n<(g=77*(f>>16&255)+151*(f>>8&255)+28*(255&f))&&(a=f,n=g),x[_++]=a;D._setPixels(y,x)},D.erode=function(e){for(var t,r,i,a,n,o,s,l,u,h,d,c,f,p,m,v,g,y=D._toPixels(e),_=0,b=y.length?y.length/4:0,x=new Int32Array(b);_>16&255)+151*(d>>8&255)+28*(255&d))<(n=77*(i>>16&255)+151*(i>>8&255)+28*(255&i))&&(a=d,n=m),(p=77*((h=D._getARGB(y,o))>>16&255)+151*(h>>8&255)+28*(255&h))>16&255)+151*(c>>8&255)+28*(255&c))>16&255)+151*(f>>8&255)+28*(255&f))=t.delay){var r=Math.floor(t.timeDisplayed/t.delay);if(t.timeDisplayed=0,t.displayIndex+=r,t.loopCount=Math.floor(t.displayIndex/t.numFrames),null!==t.loopLimit&&t.loopCount>=t.loopLimit)t.playing=!1;else{var i=t.displayIndex%t.numFrames;this.drawingContext.putImageData(t.frames[i],0,0),t.displayIndex=i,this.setModified(!0)}}},a.default.Image.prototype._setProperty=function(e,t){this[e]=t,this.setModified(!0)},a.default.Image.prototype.loadPixels=function(){a.default.Renderer2D.prototype.loadPixels.call(this),this.setModified(!0)},a.default.Image.prototype.updatePixels=function(e,t,r,i){a.default.Renderer2D.prototype.updatePixels.call(this,e,t,r,i),this.setModified(!0)},a.default.Image.prototype.get=function(e,t,r,i){return a.default._validateParameters("p5.Image.get",arguments),a.default.Renderer2D.prototype.get.apply(this,arguments)},a.default.Image.prototype._getPixel=a.default.Renderer2D.prototype._getPixel,a.default.Image.prototype.set=function(e,t,r){a.default.Renderer2D.prototype.set.call(this,e,t,r),this.setModified(!0)},a.default.Image.prototype.resize=function(e,t){0===e&&0===t?(e=this.canvas.width,t=this.canvas.height):0===e?e=this.canvas.width*t/this.canvas.height:0===t&&(t=this.canvas.height*e/this.canvas.width),e=Math.floor(e),t=Math.floor(t);var r=document.createElement("canvas");if(r.width=e,r.height=t,this.gifProperties)for(var i=this.gifProperties,a=function(e,t){for(var r=0,i=0;i/g,">").replace(/"/g,""").replace(/'/g,"'")}function l(e,t){t&&!0!==t&&"true"!==t||(t=""),e||(e="untitled");var r="";return e&&e.includes(".")&&(r=e.split(".").pop()),t&&r!==t&&(r=t,e="".concat(e,".").concat(r)),[e,r]}e("../core/error_helpers"),g.default.prototype.loadJSON=function(){for(var e=arguments.length,t=new Array(e),r=0;r"),a.print("");if('="text/html;charset=utf-8" />',a.print(' '),a.print(""),a.print(""),a.print(" "),"0"!==n[0]){a.print(" ");for(var h=0;h".concat(d)),a.print(" ")}a.print("
")}for(var c=0;c");for(var f=0;f".concat(p)),a.print(" ")}a.print(" ")}a.print("
"),a.print(""),a.print("