"use strict";function FlipImageData(e,t,s){const r=4*t,o=new Uint8Array(r),n=e.buffer;for(let e=0,t=Math.floor(s/2);eSendResult(o,e))).catch((e=>SendError(o,"Rejection in job handler: "+e))):SendResult(o,a)}else console.error(`no handler for message type '${s}'`)}self.dispatchPort=null,self.outputPort=null,self.workerNumber=-1,self.activeJobId=null,self.sentBlobs=new Map,self.sentBuffers=new Map,self.JobHandlers={},self.JobHandlers.ProcessImageData=function(e){const t=e.buffer,s=new Uint8Array(t),r=e.width,o=e.height;return e.flipY&&FlipImageData(s,r,o),e.unpremultiply&&UnpremultiplyImageData(s),{result:t,transferables:[t]}},self.addEventListener("message",(e=>{const t=e.data,s=t.type;switch(s){case"init":return self.workerNumber=t.number,self.dispatchPort=t["dispatch-port"],self.dispatchPort.onmessage=OnDispatchWorkerMessage,void(self.outputPort=t["output-port"]);case"terminate":return void self.close();default:return void console.error("unknown message '"+s+"'")}}));