"use strict";(self.webpackChunklernplattform_frontend=self.webpackChunklernplattform_frontend||[]).push([[47156],{184218:function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.default=class{constructor(e,t,r,i){this.delegate=e,this.reportingPeriodMillis=t,this.filterCPUUtilization=r,this.logger=i,this._processingFilter=!0,this.lastReportedEventTimestamp=0,this.lastFilterCompleteTimestamp=0,this.filterTotalMillis=0,this.filterCount=0,this.framerate=0,this.filterDurationNotifyMillis=0,this.setSegmentationDuration()}reportEvent(e){const t=e-this.lastReportedEventTimestamp;if(t>=this.reportingPeriodMillis){const r=this.filterCount,i=this.filterTotalMillis;if(this.filterCount=0,this.filterTotalMillis=0,this.lastReportedEventTimestamp=e,0===this.framerate||0===r)return;const s=Math.round(i/r),o=Math.round(this.framerate*(t/1e3))-r,n=Math.round(100*i/t);s>=this.filterDurationNotifyMillis&&this.delegate.filterFrameDurationHigh({framesDropped:o,avgFilterDurationMillis:s,framerate:this.framerate,periodMillis:t}),n>=this.filterCPUUtilization&&this.delegate.filterCPUUtilizationHigh({cpuUtilization:n,filterMillis:i,periodMillis:t})}}setSegmentationDuration(){this.filterDurationNotifyMillis=Math.round(1e3/this.framerate*.8)}frameReceived(e){e!==this.framerate&&(this.framerate=e,this.logger.info(`frame counter setting frame rate to ${this.framerate}`),this.setSegmentationDuration());const t=Date.now();this.reportEvent(t)}filterSubmitted(){this._processingFilter=!0,this.lastFilterCompleteTimestamp=Date.now()}filterComplete(){this.filterTotalMillis+=Date.now()-this.lastFilterCompleteTimestamp,this._processingFilter=!1,this.filterCount++}get processingSegment(){return this._processingFilter}}},946605:function(e,t,r){var i=this&&this.__awaiter||function(e,t,r,i){return new(r||(r=Promise))((function(s,o){function n(e){try{l(i.next(e))}catch(e){o(e)}}function a(e){try{l(i.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?s(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(n,a)}l((i=i.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0});const s=r(41364),o=r(315128),n=r(756387),a=r(956244),l=r(576741),c=()=>n.default.builder().withSelfieSegmentationDefaults().build(),u="https://static.sdkassets.chime.aws",d={worker:`${u}/bgblur/workers/worker.js`,wasm:`${u}/bgblur/wasm/_cwt-wasm.wasm`,simd:`${u}/bgblur/wasm/_cwt-wasm-simd.wasm`};t.default=class{static defaultAssetSpec(){const e=l.default.sdkVersionSemVer;return{assetGroup:`sdk-${e.major}.${e.minor}`}}static createUrlWithParams(e,t){const r=new URL(e),i=Object.keys(t);for(const e of i)void 0!==t[e]&&r.searchParams.set(e,t[e]);return r.toString()}static resolveSpec(e){const{paths:t=d,model:r=c(),assetGroup:i=this.defaultAssetSpec().assetGroup,revisionID:s=this.defaultAssetSpec().revisionID}=e||{},o={assetGroup:i,revisionID:s,sdk:encodeURIComponent(l.default.sdkVersion),ua:encodeURIComponent(l.default.sdkUserAgentLowResolution)};return t.worker=this.createUrlWithParams(t.worker,o),t.wasm=this.createUrlWithParams(t.wasm,o),t.simd=this.createUrlWithParams(t.simd,o),r.path=this.createUrlWithParams(r.path,o),{paths:t,model:r,assetGroup:i,revisionID:s}}static resolveOptions(e){return e.reportingPeriodMillis||(e.reportingPeriodMillis=1e3),e.filterCPUUtilization?(e.filterCPUUtilization<0||e.filterCPUUtilization>100)&&(e.logger.warn("filterCPUUtilization must be set to a range between 0 and 100 percent. Falling back to default of 30 percent"),e.filterCPUUtilization=30):e.filterCPUUtilization=30,e}static isSupported(e,t){const{logger:r}=t;return"undefined"==typeof globalThis?(r.info("Browser does not have globalThis."),Promise.resolve(!1)):(new a.default).supportsBackgroundFilter()?o.supportsWASM(globalThis,r)?this.supportsBackgroundFilter(globalThis,e,r):(r.info("Browser does not support WASM."),Promise.resolve(!1)):(r.info("Browser is not supported."),Promise.resolve(!1))}static supportsBackgroundFilter(e=globalThis,t,r){return i(this,void 0,void 0,(function*(){if(!o.supportsWorker(e,r))return r.info("Browser does not support web workers."),!1;const i=t.paths.worker;try{const e=yield s.loadWorker(i,"BackgroundFilterWorker",{},null);try{e.terminate()}catch(e){r.info(`Failed to terminate worker. ${e.message}`)}return!0}catch(e){return r.info(`Failed to fetch and instantiate test worker ${e.message}`),!1}}))}}},672806:function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.default=class{constructor(){this.observers=new Set}addObserver(e){this.observers.add(e)}removeObserver(e){this.observers.delete(e)}filterFrameDurationHigh(e){var t;for(const r of this.observers)null===(t=r.filterFrameDurationHigh)||void 0===t||t.call(r,e)}filterCPUUtilizationHigh(e){var t;for(const r of this.observers)null===(t=r.filterCPUUtilizationHigh)||void 0===t||t.call(r,e)}}},363111:function(e,t,r){var i=this&&this.__awaiter||function(e,t,r,i){return new(r||(r=Promise))((function(s,o){function n(e){try{l(i.next(e))}catch(e){o(e)}}function a(e){try{l(i.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?s(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(n,a)}l((i=i.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0});const s=r(280117),o=r(509766);class n extends s.default{constructor(e,t){super("background replacement",e,t,new o.default),this.replacementBlob=t.imageBlob,this.logger.info("BackgroundReplacement processor successfully created"),this.logger.info(`BackgroundReplacement spec: ${this.stringify(this.spec)}`),this.logger.info(`BackgroundReplacement options: ${this.stringify(t)}`)}setImageBlob(e){return i(this,void 0,void 0,(function*(){this.replacementBlob=e,this.replacementImage=yield n.loadImage(this.createReplacementObjectUrl())}))}initOnFirstExecution(){}drawImageWithMask(e,t){t||(t=new ImageData(this.spec.model.input.width,this.spec.model.input.height)),this.scaledCanvas.getContext("2d").putImageData(t,0,0);const{canvasCtx:r,targetCanvas:i}=this,{width:s,height:o}=i;r.save(),r.clearRect(0,0,s,o),r.drawImage(this.scaledCanvas,0,0,s,o),r.globalCompositeOperation="source-in",r.drawImage(e,0,0,s,o),r.globalCompositeOperation="destination-over",r.drawImage(this.replacementImage,0,0,i.width,i.height),r.restore()}static loadImageExecutor(e,t,r){const i=new Image;i.crossOrigin="Anonymous",i.addEventListener("load",(()=>{e(i)}),!1),i.addEventListener("error",(e=>{t(new Error(`Could not load replacement image ${i.src}: ${e.message}`))}),!1),i.src=r}static loadImage(e){return i(this,void 0,void 0,(function*(){return new Promise(((t,r)=>this.loadImageExecutor(t,r,e)))}))}revokeReplacementObjectUrl(){this.replacementObjectUrl&&URL.revokeObjectURL(this.replacementObjectUrl)}createReplacementObjectUrl(){return this.revokeReplacementObjectUrl(),this.replacementObjectUrl=URL.createObjectURL(this.replacementBlob),this.replacementObjectUrl}loadAssets(){const e=Object.create(null,{loadAssets:{get:()=>super.loadAssets}});return i(this,void 0,void 0,(function*(){this.replacementImage=yield n.loadImage(this.createReplacementObjectUrl()),e.loadAssets.call(this)}))}addObserver(e){this.delegate.addObserver(e)}removeObserver(e){this.delegate.removeObserver(e)}destroy(){const e=Object.create(null,{destroy:{get:()=>super.destroy}});return i(this,void 0,void 0,(function*(){e.destroy.call(this),this.revokeReplacementObjectUrl()}))}setEventController(e){this.eventController?this.eventController=e:(this.eventController=e,this.publishBackgroundFilterEvent())}publishBackgroundFilterEvent(){this.eventController.publishEvent("backgroundFilterConfigSelected",{backgroundBlurEnabled:"false",backgroundBlurStrength:"low",backgroundReplacementEnabled:"true",backgroundFilterVersion:1})}}t.default=n},692557:function(e,t,r){var i=this&&this.__awaiter||function(e,t,r,i){return new(r||(r=Promise))((function(s,o){function n(e){try{l(i.next(e))}catch(e){o(e)}}function a(e){try{l(i.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?s(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(n,a)}l((i=i.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0});const s=r(946605),o=r(443804),n=r(53293),a=r(590255),l=r(363111);class c extends a.default{loadAssets(){return i(this,void 0,void 0,(function*(){}))}addObserver(){}removeObserver(){}setImageBlob(){return i(this,void 0,void 0,(function*(){}))}}class u extends s.default{static create(e,t){return i(this,void 0,void 0,(function*(){e=this.resolveSpec(e),t=this.resolveOptions(t),yield this.resolveOptionsAsync(t);const{logger:r}=t;if(!(yield u.isSupported(e,t)))return r.warn("Using no-op processor because background replacement is not supported"),new c;r.info("Using background replacement filter");const i=new l.default(e,t);return yield i.loadAssets(),i}))}static resolveOptions(e={}){const t=Object.assign({},e);return t.logger||(t.logger=new o.default("BackgroundReplacementProcessor",n.default.INFO)),super.resolveOptions(t)}static resolveOptionsAsync(e){return i(this,void 0,void 0,(function*(){if(!e.imageBlob){const t=document.createElement("canvas");t.width=100,t.height=100;const r=t.getContext("2d");r.fillStyle="blue",r.fillRect(0,0,100,100);const i=yield new Promise((e=>{t.toBlob(e)}));e.imageBlob=i}}))}static isSupported(e,t){const r=Object.create(null,{isSupported:{get:()=>super.isSupported}});return i(this,void 0,void 0,(function*(){e=this.resolveSpec(e),t=this.resolveOptions(t),yield this.resolveOptionsAsync(t);const i=t.imageBlob,s=URL.createObjectURL(i);try{yield l.default.loadImage(s)}catch(e){return t.logger.info(`Failed to fetch load replacement image ${e.message}`),!1}finally{URL.revokeObjectURL(s)}return r.isSupported.call(this,e,t)}))}}t.default=u},509766:function(e,t,r){Object.defineProperty(t,"__esModule",{value:!0});const i=r(672806);class s extends i.default{}t.default=s}}]);