!function(){"use strict";var o,t,e="rgba(0, 0, 255, 0.3)",i=function(o,e){var i=e.color,n=e.compositeOperation;t.lineCap="round",t.lineJoin="round",t.globalCompositeOperation=n,t.save(),t.beginPath(),null==o||o.forEach((function(o,e){var i=o.x,n=o.y;t.lineWidth=o.lineWidth||10,0===e?t.moveTo(i,n):t.lineTo(i,n)})),"source-over"===n&&(t.strokeStyle=i),t.stroke(),t.restore()};self.onmessage=function(n){if("init"===n.data.type)return o=n.data.canvas,void(t=o.getContext("2d"));if("draw"===n.data.type){var a;null===(a=t)||void 0===a||a.clearRect(0,0,o.width,o.height);var r=n.data,l=r.maskStrokes,c=r.strokes;!function(o){null==o||o.forEach((function(o){!function(o,t,e){var i=e.color;null==t||t.forEach((function(t){var n=t.x,a=t.y,r=e.lineWidth||10;o.save(),o.fillStyle="rgba(0,0,0,1)",o.globalCompositeOperation="destination-out",o.fillRect(n-r/2,a-r/2,r,r),o.globalCompositeOperation="source-over",o.fillStyle=i,o.fillRect(n-r/2,a-r/2,r,r),o.restore()}))}(t,o,{color:e})}))}(l),function(o){null==o||o.forEach((function(o,t){i(o,{color:e,compositeOperation:"destination-out"}),i(o,{color:e,compositeOperation:"source-over"})}))}(c),s=t.getImageData(0,0,o.width,o.height),self.postMessage({type:"done",imageData:s})}var s}}();