import {b}from'./chunk-JQF6P6X7.js';var c=class{constructor(r,s,i){this.captureListenerSet=false;this.propertyPushSource=new b;this.coreEngine=r,this.Module=s,this.workerFunctions=i,this.setup();}sparkScanDidUpdateSession(r){this.workerFunctions.postMessage({type:"sparkScanDidUpdateSession",payload:JSON.parse(r.toJson())});}getSparkScanDeserializer(){return this.sparkScanDeserializer}setup(){let r=this.Module.SparkScanListener.extend("SparkScanListener",{didScan:(t,e,a)=>{this.sparkScanDidScan(e,a),t.delete(),e.delete(),a.delete();},didUpdateSession:(t,e,a)=>{this.sparkScanDidUpdateSession(e),t.delete(),e.delete(),a.delete();}}),s=this.Module.Feedback.extend("Feedback",{emit:()=>{this.successFeedback();}}),i=this.Module.SparkScanDeserializerListener.extend("SparkScanDeserializerListener",{onModeDeserializationFinished:(t,e,a)=>{this.captureListenerSet||(e.addListener(new r,1),e.setSuccessFeedback(new s),e.setPropertyPushSource(this.propertyPushSource),this.captureListenerSet=true),t.delete(),e.delete(),a.delete();},onModeDeserializationStarted(t,e,a){t.delete(),e.delete(),a.delete();},onSettingsDeserializationStarted(t,e,a){t.delete(),e.delete(),a.delete();},onSettingsDeserializationFinished(t,e,a){t.delete(),e.delete(),a.delete();},onOverlayDeserializationStarted(t,e,a){t.delete(),e.delete(),a.delete();},onOverlayDeserializationFinished:(t,e,a)=>{var n;(n=this.sparkScanOverlay)==null||n.delete(),this.sparkScanOverlay=e,t.delete(),a.delete();}});this.sparkScanDeserializer=new this.Module.SparkScanDeserializer,this.sparkScanDeserializer.setListener(new i);}emitErrorFeedback(r){var s;(s=this.sparkScanOverlay)==null||s.onErrorFeedbackEmitted(r);}overlayReadyForDraw(){var r;(r=this.sparkScanOverlay)==null||r.onReadyForNewData();}analyticsManagerPropertyChanged(r){this.propertyPushSource.getBehaviorSubject(r.key).setProperty(r);}successFeedback(){this.workerFunctions.postMessage({type:"successFeedback"});}sparkScanDidScan(r,s){let i=this.coreEngine.convertToLoadableFrameData(s);this.workerFunctions.postMessage({type:"sparkScanDidScan",payload:{session:JSON.parse(r.toJson()),frameData:i}});}};export{c as a};