(()=>{"use strict";var e,t,r={94521:(e,t,r)=>{r(58671),r(44338),r(66450),r(69333),r(3790),r(14858),r(78493);var a=r(84142);let n,i,o=null,s=0;self.onmessage=async e=>{let{data:t}=e;if(t.canvas){console.log("segmeneter.worker: received canvas, initializing",t);try{const e=await a.n.forVisionTasks("".concat(t.assetsPath,"/mediapipe/tasks-vision/wasm"));o=await a.cW.createFromOptions(e,{baseOptions:{modelAssetPath:"".concat(t.assetsPath,"/mediapipe/tasks-vision/selfie_segmenter_landscape.tflite"),delegate:"GPU"},outputCategoryMask:!0,outputConfidenceMasks:!1,runningMode:"VIDEO"})}catch(e){console.error("segmeneter.worker: failed to initialize segmenter",e)}n=t.canvas.getContext("2d");const e=new OffscreenCanvas(640,480).getContext("2d",{willReadFrequently:!0});if(!e)return void console.error("segmeneter.worker: failed to create temp canvas context");i=e}else t.frame&&o?(n.canvas.width===t.width&&n.canvas.height===t.height||(console.log("segmeneter.worker: resizing output canvas",t.width,t.height),n.canvas.width=t.width,n.canvas.height=t.height),i.canvas.width===t.width&&i.canvas.height===t.height||(console.log("segmeneter.worker: resizing temp canvas",t.width,t.height),i.canvas.width=t.width,i.canvas.height=t.height),o.segmentForVideo(t.frame,performance.now(),async e=>{if(!e.categoryMask)return void console.warn("segmeneter.worker: no category mask in result");n.filter="blur(".concat(s,"px)"),n.drawImage(t.frame,0,0,t.width,t.height),n.filter="none",i.globalCompositeOperation="source-over",i.drawImage(t.frame,0,0,t.width,t.height),i.globalCompositeOperation="destination-in";const r=i.getImageData(0,0,t.width,t.height).data;let a=0;const o=e.categoryMask.getAsFloat32Array();for(let e=0;e<o.length;e++)o[e]>0&&(r[a]=0,r[a+1]=0,r[a+2]=0,r[a+3]=0),a+=4;const c=new Uint8ClampedArray(r.buffer),l=new ImageData(c,t.width,t.height);n.drawImage(await createImageBitmap(l),0,0)})):"blurIntensity"in t&&(s=t.blurIntensity)}}},a={};function n(e){var t=a[e];if(void 0!==t)return t.exports;var i=a[e]={exports:{}};return r[e](i,i.exports,n),i.exports}n.m=r,n.x=()=>{var e=n.O(void 0,[297],()=>n(94521));return n.O(e)},e=[],n.O=(t,r,a,i)=>{if(!r){var o=1/0;for(h=0;h<e.length;h++){for(var[r,a,i]=e[h],s=!0,c=0;c<r.length;c++)(!1&i||o>=i)&&Object.keys(n.O).every(e=>n.O[e](r[c]))?r.splice(c--,1):(s=!1,i<o&&(o=i));if(s){e.splice(h--,1);var l=a();void 0!==l&&(t=l)}}return t}i=i||0;for(var h=e.length;h>0&&e[h-1][2]>i;h--)e[h]=e[h-1];e[h]=[r,a,i]},n.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return n.d(t,{a:t}),t},n.d=(e,t)=>{for(var r in t)n.o(t,r)&&!n.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},n.f={},n.e=e=>Promise.all(Object.keys(n.f).reduce((t,r)=>(n.f[r](e,t),t),[])),n.u=e=>e+".a9255e15cd95d0063133.js",n.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),(()=>{var e;n.g.importScripts&&(e=n.g.location+"");var t=n.g.document;if(!e&&t&&(t.currentScript&&(e=t.currentScript.src),!e)){var r=t.getElementsByTagName("script");r.length&&(e=r[r.length-1].src)}if(!e)throw new Error("Automatic publicPath is not supported in this browser");e=e.replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/"),n.p=e})(),(()=>{var e={521:1};n.f.i=(t,r)=>{e[t]||importScripts(n.p+n.u(t))};var t=self.webpackChunk=self.webpackChunk||[],r=t.push.bind(t);t.push=t=>{var[a,i,o]=t;for(var s in i)n.o(i,s)&&(n.m[s]=i[s]);for(o&&o(n);a.length;)e[a.pop()]=1;r(t)}})(),t=n.x,n.x=()=>n.e(297).then(t),n.x()})();