easyproctor-hml 2.5.24 → 2.5.25

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/esm/index.js CHANGED
@@ -12676,12 +12676,12 @@ var VolumeMeter = class {
12676
12676
  async start(options = {}) {
12677
12677
  return new Promise((resolve, reject) => {
12678
12678
  try {
12679
- const audioContext = new AudioContext();
12680
- this.analyser = audioContext.createAnalyser();
12681
- const microphone = audioContext.createMediaStreamSource(this.stream);
12679
+ this.audioContext = new AudioContext();
12680
+ this.analyser = this.audioContext.createAnalyser();
12681
+ this.microphone = this.audioContext.createMediaStreamSource(this.stream);
12682
12682
  this.analyser.smoothingTimeConstant = 0.8;
12683
12683
  this.analyser.fftSize = 1024;
12684
- microphone.connect(this.analyser);
12684
+ this.microphone.connect(this.analyser);
12685
12685
  const processAudio = () => {
12686
12686
  const array = new Uint8Array(this.analyser.frequencyBinCount);
12687
12687
  this.analyser.getByteFrequencyData(array);
@@ -12703,6 +12703,8 @@ var VolumeMeter = class {
12703
12703
  if (this.animationFrameId !== null) {
12704
12704
  cancelAnimationFrame(this.animationFrameId);
12705
12705
  }
12706
+ this.microphone.disconnect();
12707
+ this.analyser.disconnect();
12706
12708
  }
12707
12709
  getVolume() {
12708
12710
  return this.volume;
@@ -17789,6 +17791,7 @@ var NoiseRecorder = class {
17789
17791
  await this.stopSoundRecord();
17790
17792
  await this.volumeMeter && this.volumeMeter.stop();
17791
17793
  this.audioWorkletNode && this.audioWorkletNode.disconnect();
17794
+ this.context && this.context.close();
17792
17795
  }
17793
17796
  async pauseRecording() {
17794
17797
  }
package/index.js CHANGED
@@ -30773,12 +30773,12 @@ var VolumeMeter = class {
30773
30773
  async start(options = {}) {
30774
30774
  return new Promise((resolve, reject) => {
30775
30775
  try {
30776
- const audioContext = new AudioContext();
30777
- this.analyser = audioContext.createAnalyser();
30778
- const microphone = audioContext.createMediaStreamSource(this.stream);
30776
+ this.audioContext = new AudioContext();
30777
+ this.analyser = this.audioContext.createAnalyser();
30778
+ this.microphone = this.audioContext.createMediaStreamSource(this.stream);
30779
30779
  this.analyser.smoothingTimeConstant = 0.8;
30780
30780
  this.analyser.fftSize = 1024;
30781
- microphone.connect(this.analyser);
30781
+ this.microphone.connect(this.analyser);
30782
30782
  const processAudio = () => {
30783
30783
  const array = new Uint8Array(this.analyser.frequencyBinCount);
30784
30784
  this.analyser.getByteFrequencyData(array);
@@ -30800,6 +30800,8 @@ var VolumeMeter = class {
30800
30800
  if (this.animationFrameId !== null) {
30801
30801
  cancelAnimationFrame(this.animationFrameId);
30802
30802
  }
30803
+ this.microphone.disconnect();
30804
+ this.analyser.disconnect();
30803
30805
  }
30804
30806
  getVolume() {
30805
30807
  return this.volume;
@@ -35886,6 +35888,7 @@ var NoiseRecorder = class {
35886
35888
  await this.stopSoundRecord();
35887
35889
  await this.volumeMeter && this.volumeMeter.stop();
35888
35890
  this.audioWorkletNode && this.audioWorkletNode.disconnect();
35891
+ this.context && this.context.close();
35889
35892
  }
35890
35893
  async pauseRecording() {
35891
35894
  }
@@ -6,6 +6,8 @@ export declare class VolumeMeter {
6
6
  private stream;
7
7
  private analyser;
8
8
  private animationFrameId;
9
+ private microphone;
10
+ private audioContext;
9
11
  constructor(stream: MediaStream);
10
12
  start(options?: VolumeMeterOptions): Promise<any>;
11
13
  stop(): void;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "easyproctor-hml",
3
- "version": "2.5.24",
3
+ "version": "2.5.25",
4
4
  "description": "Modulo web de gravação do EasyProctor",
5
5
  "main": "./index.js",
6
6
  "module": "./esm/index.js",
@@ -77,7 +77,7 @@ Minimum version required to store current data is: `+o+`.
77
77
  File size: ${i.size}`),new Error("Failed to upload to AWS")}}async upload(t,r,n){let{file:i,onProgress:o}=t;try{let s=l=>{let h=l.loadedBytes/i.size*100;o&&o(Math.round(h))},a;if(n){if(this.imageBatchNum===this.contImages){let l=[];for(let d=this.imageBatchNum;d<this.imageBatchNum+20;d++)l.push({objectName:`${this.proctoringId}/${this.proctoringId}_${d+1}.jpg`,contentType:"image/jpeg"});(await this.backend.getSignedUrlImage(r,l)).map(d=>{this.imageUrlPackage.push(d)}),this.imageBatchNum+=20}}else a=await this.backend.getSignedUrl(r,i,this.proctoringId);let c=!1;return n?c=await vr.request({url:this.imageUrlPackage[this.contImages],method:"PUT",headers:{"Content-Type":i.type,"x-ms-blob-type":"BlockBlob"},data:i,onUploadProgress:l=>{s({loadedBytes:l.loaded})}}).then(()=>!0).catch(()=>!1).finally(()=>{this.contImages++}):c=await vr.request({url:a,method:"PUT",headers:{"Content-Type":i.type,"x-ms-blob-type":"BlockBlob"},data:i,onUploadProgress:l=>{s({loadedBytes:l.loaded})}}).then(()=>!0).catch(()=>!1),{storage:"upload",url:a,uploaded:c}}catch{throw ue.registerError(this.proctoringId,`Failed to upload to AWS
78
78
  File name: ${i.name}
79
79
  File type: ${i.type}
80
- File size: ${i.size}`),new Error("Failed to upload to AWS")}}};var Xg="not_shared_first_screen",Jg="not_shared_screen",Fa="multiple_monitors_detected",Yg="proctoring_already_started",Ma="proctoring_not_started";var Sd="another_stream_active",kd="stream_under_minimum_permitted",Zg="browser_not_supported",Qg="token_missing",e0="credentials_missing";var t0="spy_scan_api_not_found";var r0="external_camera_not_started";var Ua=class extends Bi{constructor(t,r,n="videoPreviewFrameDetection",i="liveViewFrameDetection"){super("ObjectDetector","https://storage.googleapis.com/mediapipe-models/object_detector/efficientdet_lite0/float16/1/efficientdet_lite0.tflite",t,r,n,i)}stopDetection(){super.stopDetection(),this.numPersonsSent>0&&this.handleOk("person_ok","person_detection_on_stream")}displayVideoDetections(t){for(let r of this.children)this.liveView.removeChild(r);this.children.splice(0);for(let r of t.detections){let n=window.innerWidth,i=window.innerHeight,o=this.video.offsetWidth,s=this.video.offsetHeight,a=o/n,c=s/i,l=o-r.boundingBox.width*a-r.boundingBox.originX*a,h=r.boundingBox.originY*c,d=(r.boundingBox.width-10)*a,m=r.boundingBox.height*c,p=document.createElement("p");p.innerText=r.categories[0].categoryName+" - with "+Math.round(parseFloat(r.categories[0].score)*100)+"% confidence.",p.style.right=l-20+"px",p.style.top=h+"px",p.style.width=d+"px";let g={zIndex:"2",position:"absolute",border:"1px dashed #fff"};Object.assign(p.style,{...g,margin:"0",fontSize:"9px",paddingBottom:"5px",paddingTop:"5px",color:"#fff",backgroundColor:"#007f8b"});let f=document.createElement("div");f.setAttribute("class","highlighter"),f.style.right=l-20+"px",f.style.top=h+"px",f.style.width=d+"px",f.style.height=m-20+"px",Object.assign(f.style,{...g,zIndex:"1",background:"rgba(0, 255, 0, 0.25)"}),this.liveView.appendChild(f),this.liveView.appendChild(p),this.children.push(f),this.children.push(p)}}verify(t){let r=t.detections.filter(i=>i.categories.some(o=>o.categoryName==="person")).length,n=t.detections.filter(i=>i.categories.some(o=>o.categoryName==="cell phone")).length;this.paramsConfig.videoBehaviourParameters?.detectPerson&&r!==this.numPersonsSent&&(r===0?(this.handleAlert("no_person_detected","person_detection_on_stream"),this.numPersonsSent=r):r>1?(this.handleAlert("multiple_persons_detected","person_detection_on_stream"),this.numPersonsSent=r):(this.handleOk("person_ok","person_detection_on_stream"),this.numPersonsSent=r)),this.paramsConfig.videoBehaviourParameters?.detectCellPhone&&n!==this.numCellphoneSent&&(n>0?(this.handleAlert("cellphone_detected","mobile_detection_on_stream"),this.numCellphoneSent=n):(this.handleOk("cellphone_ok","mobile_detection_on_stream"),this.numCellphoneSent=n))}};var gn=class{constructor(t){this.volume=null;this.animationFrameId=null;this.stream=t}async start(t={}){return new Promise((r,n)=>{try{let i=new AudioContext;this.analyser=i.createAnalyser();let o=i.createMediaStreamSource(this.stream);this.analyser.smoothingTimeConstant=.8,this.analyser.fftSize=1024,o.connect(this.analyser);let s=()=>{let a=new Uint8Array(this.analyser.frequencyBinCount);this.analyser.getByteFrequencyData(a);let l=a.reduce((h,d)=>h+d,0)/a.length;this.setVolume(l),t.setVolume&&t.setVolume(l),this.animationFrameId=requestAnimationFrame(s)};this.animationFrameId=requestAnimationFrame(s),r(!0)}catch(i){this.stop(),n(`Error: ${i}`)}})}stop(){this.animationFrameId!==null&&cancelAnimationFrame(this.animationFrameId)}getVolume(){return this.volume}setVolume(t){this.volume=t}};var s0=ul(i0()),Zr=class{constructor(t,r,n,i,o){this.blobs=[];this.paramsConfig={audioBehaviourParameters:{recordingBitrate:128,noiseLimit:40},imageBehaviourParameters:{useUploadImage:!0,uploadInterval:20,saveVideo:!0},videoBehaviourParameters:{detectPerson:!1,detectFace:!1,detectCellPhone:!1}};this.options={cameraId:void 0,microphoneId:void 0,onBufferSizeError:!1,onBufferSizeErrorCallback:t=>{},proctoringType:"IMAGE",onChangeDevicesCallback:t=>{},onRealtimeAlertsCallback:t=>{}};this.videoOptions={width:640,height:480,minWidth:0,minHeight:0};this.blobsRTC=[];this.imageCount=0;this.filesToUpload=[];this.animationFrameId=null;this.isCanvasLoopActive=!1;this.hardwareStream=null;this.internalClonedStream=null;this.currentRetries=0;this.packageCount=0;this.noiseWait=20;this.options=t,this.videoOptions=r,this.backend=i,this.backendToken=o,n&&(this.paramsConfig=n)}setProctoringId(t){this.proctoringId=t,this.proctoringId&&this.backend&&(this.upload=new Yr(this.proctoringId,this.backend)),La(t)}async initializeDetectors(){ag(),(this.paramsConfig.videoBehaviourParameters?.detectPerson||this.paramsConfig.videoBehaviourParameters?.detectCellPhone)&&(this.objectDetection=new Ua({onRealtimeAlertsCallback:t=>this.options.onRealtimeAlertsCallback(t)},this.paramsConfig),await this.objectDetection.initializeDetector()),this.paramsConfig.videoBehaviourParameters?.detectFace&&(this.faceDetection=new Li({onRealtimeAlertsCallback:t=>this.options.onRealtimeAlertsCallback(t)},this.paramsConfig),await this.faceDetection.initializeDetector())}configImageCapture(){this.video=document.createElement("video"),this.canvas=document.createElement("canvas"),this.video.srcObject=this.cameraStream,this.video.play(),this.video.muted=!0,screen.orientation?.type.includes("portrait")&&Fr()?(console.log("configurando canvas em portrait"),this.canvas.width=this.videoOptions.height/2,this.canvas.height=this.videoOptions.width/2):(this.canvas.width=this.videoOptions.width/2,this.canvas.height=this.videoOptions.height/2)}async bufferError(t){console.log("buffer error Camera Recorder params "+this.paramsConfig.videoBehaviourParameters);let r=this.paramsConfig.videoBehaviourParameters?.retryEnabled||!1,n=this.paramsConfig.videoBehaviourParameters?.maxRetries||3;r&&this.currentRetries<n?(console.log("buffer error Camera Recorder retry"),await this.recordingStop(),await this.startRecording({retry:!0}),this.currentRetries++,this.options.onBufferSizeErrorCallback&&this.options.onBufferSizeErrorCallback(this.cameraStream)):this.options.onBufferSizeErrorCallback&&this.options.onBufferSizeErrorCallback()}async startStream(t){let{cameraId:r,microphoneId:n,onBufferSizeErrorCallback:i}=this.options,o={audio:{deviceId:n},video:{deviceId:r,width:this.videoOptions.width,height:this.videoOptions.height,frameRate:15}};try{this.hardwareStream=await navigator.mediaDevices.getUserMedia(o)}catch(d){throw d.toString()=="NotReadableError: Could not start video source"?"N\xE3o foi poss\xEDvel conectar a camera, ela pode estar sendo utilizada por outro programa":d}this.cameraStream=this.hardwareStream;let a=this.cameraStream.getVideoTracks()[0].getSettings(),{width:c=0,height:l=0}=a;if(screen.orientation?.type.includes("portrait")&&Fr()&&this.videoOptions.width==l&&this.videoOptions.height==c&&([c,l]=[l,c]),this.videoOptions.minWidth>c||this.videoOptions.minHeight>l)throw kd;if(this.videoOptions.width!==c||this.videoOptions.height!==l)throw ue.registerAnotherStream(this.proctoringId,`Maybe have another stream active
80
+ File size: ${i.size}`),new Error("Failed to upload to AWS")}}};var Xg="not_shared_first_screen",Jg="not_shared_screen",Fa="multiple_monitors_detected",Yg="proctoring_already_started",Ma="proctoring_not_started";var Sd="another_stream_active",kd="stream_under_minimum_permitted",Zg="browser_not_supported",Qg="token_missing",e0="credentials_missing";var t0="spy_scan_api_not_found";var r0="external_camera_not_started";var Ua=class extends Bi{constructor(t,r,n="videoPreviewFrameDetection",i="liveViewFrameDetection"){super("ObjectDetector","https://storage.googleapis.com/mediapipe-models/object_detector/efficientdet_lite0/float16/1/efficientdet_lite0.tflite",t,r,n,i)}stopDetection(){super.stopDetection(),this.numPersonsSent>0&&this.handleOk("person_ok","person_detection_on_stream")}displayVideoDetections(t){for(let r of this.children)this.liveView.removeChild(r);this.children.splice(0);for(let r of t.detections){let n=window.innerWidth,i=window.innerHeight,o=this.video.offsetWidth,s=this.video.offsetHeight,a=o/n,c=s/i,l=o-r.boundingBox.width*a-r.boundingBox.originX*a,h=r.boundingBox.originY*c,d=(r.boundingBox.width-10)*a,m=r.boundingBox.height*c,p=document.createElement("p");p.innerText=r.categories[0].categoryName+" - with "+Math.round(parseFloat(r.categories[0].score)*100)+"% confidence.",p.style.right=l-20+"px",p.style.top=h+"px",p.style.width=d+"px";let g={zIndex:"2",position:"absolute",border:"1px dashed #fff"};Object.assign(p.style,{...g,margin:"0",fontSize:"9px",paddingBottom:"5px",paddingTop:"5px",color:"#fff",backgroundColor:"#007f8b"});let f=document.createElement("div");f.setAttribute("class","highlighter"),f.style.right=l-20+"px",f.style.top=h+"px",f.style.width=d+"px",f.style.height=m-20+"px",Object.assign(f.style,{...g,zIndex:"1",background:"rgba(0, 255, 0, 0.25)"}),this.liveView.appendChild(f),this.liveView.appendChild(p),this.children.push(f),this.children.push(p)}}verify(t){let r=t.detections.filter(i=>i.categories.some(o=>o.categoryName==="person")).length,n=t.detections.filter(i=>i.categories.some(o=>o.categoryName==="cell phone")).length;this.paramsConfig.videoBehaviourParameters?.detectPerson&&r!==this.numPersonsSent&&(r===0?(this.handleAlert("no_person_detected","person_detection_on_stream"),this.numPersonsSent=r):r>1?(this.handleAlert("multiple_persons_detected","person_detection_on_stream"),this.numPersonsSent=r):(this.handleOk("person_ok","person_detection_on_stream"),this.numPersonsSent=r)),this.paramsConfig.videoBehaviourParameters?.detectCellPhone&&n!==this.numCellphoneSent&&(n>0?(this.handleAlert("cellphone_detected","mobile_detection_on_stream"),this.numCellphoneSent=n):(this.handleOk("cellphone_ok","mobile_detection_on_stream"),this.numCellphoneSent=n))}};var gn=class{constructor(t){this.volume=null;this.animationFrameId=null;this.stream=t}async start(t={}){return new Promise((r,n)=>{try{this.audioContext=new AudioContext,this.analyser=this.audioContext.createAnalyser(),this.microphone=this.audioContext.createMediaStreamSource(this.stream),this.analyser.smoothingTimeConstant=.8,this.analyser.fftSize=1024,this.microphone.connect(this.analyser);let i=()=>{let o=new Uint8Array(this.analyser.frequencyBinCount);this.analyser.getByteFrequencyData(o);let a=o.reduce((c,l)=>c+l,0)/o.length;this.setVolume(a),t.setVolume&&t.setVolume(a),this.animationFrameId=requestAnimationFrame(i)};this.animationFrameId=requestAnimationFrame(i),r(!0)}catch(i){this.stop(),n(`Error: ${i}`)}})}stop(){this.animationFrameId!==null&&cancelAnimationFrame(this.animationFrameId),this.microphone.disconnect(),this.analyser.disconnect()}getVolume(){return this.volume}setVolume(t){this.volume=t}};var s0=ul(i0()),Zr=class{constructor(t,r,n,i,o){this.blobs=[];this.paramsConfig={audioBehaviourParameters:{recordingBitrate:128,noiseLimit:40},imageBehaviourParameters:{useUploadImage:!0,uploadInterval:20,saveVideo:!0},videoBehaviourParameters:{detectPerson:!1,detectFace:!1,detectCellPhone:!1}};this.options={cameraId:void 0,microphoneId:void 0,onBufferSizeError:!1,onBufferSizeErrorCallback:t=>{},proctoringType:"IMAGE",onChangeDevicesCallback:t=>{},onRealtimeAlertsCallback:t=>{}};this.videoOptions={width:640,height:480,minWidth:0,minHeight:0};this.blobsRTC=[];this.imageCount=0;this.filesToUpload=[];this.animationFrameId=null;this.isCanvasLoopActive=!1;this.hardwareStream=null;this.internalClonedStream=null;this.currentRetries=0;this.packageCount=0;this.noiseWait=20;this.options=t,this.videoOptions=r,this.backend=i,this.backendToken=o,n&&(this.paramsConfig=n)}setProctoringId(t){this.proctoringId=t,this.proctoringId&&this.backend&&(this.upload=new Yr(this.proctoringId,this.backend)),La(t)}async initializeDetectors(){ag(),(this.paramsConfig.videoBehaviourParameters?.detectPerson||this.paramsConfig.videoBehaviourParameters?.detectCellPhone)&&(this.objectDetection=new Ua({onRealtimeAlertsCallback:t=>this.options.onRealtimeAlertsCallback(t)},this.paramsConfig),await this.objectDetection.initializeDetector()),this.paramsConfig.videoBehaviourParameters?.detectFace&&(this.faceDetection=new Li({onRealtimeAlertsCallback:t=>this.options.onRealtimeAlertsCallback(t)},this.paramsConfig),await this.faceDetection.initializeDetector())}configImageCapture(){this.video=document.createElement("video"),this.canvas=document.createElement("canvas"),this.video.srcObject=this.cameraStream,this.video.play(),this.video.muted=!0,screen.orientation?.type.includes("portrait")&&Fr()?(console.log("configurando canvas em portrait"),this.canvas.width=this.videoOptions.height/2,this.canvas.height=this.videoOptions.width/2):(this.canvas.width=this.videoOptions.width/2,this.canvas.height=this.videoOptions.height/2)}async bufferError(t){console.log("buffer error Camera Recorder params "+this.paramsConfig.videoBehaviourParameters);let r=this.paramsConfig.videoBehaviourParameters?.retryEnabled||!1,n=this.paramsConfig.videoBehaviourParameters?.maxRetries||3;r&&this.currentRetries<n?(console.log("buffer error Camera Recorder retry"),await this.recordingStop(),await this.startRecording({retry:!0}),this.currentRetries++,this.options.onBufferSizeErrorCallback&&this.options.onBufferSizeErrorCallback(this.cameraStream)):this.options.onBufferSizeErrorCallback&&this.options.onBufferSizeErrorCallback()}async startStream(t){let{cameraId:r,microphoneId:n,onBufferSizeErrorCallback:i}=this.options,o={audio:{deviceId:n},video:{deviceId:r,width:this.videoOptions.width,height:this.videoOptions.height,frameRate:15}};try{this.hardwareStream=await navigator.mediaDevices.getUserMedia(o)}catch(d){throw d.toString()=="NotReadableError: Could not start video source"?"N\xE3o foi poss\xEDvel conectar a camera, ela pode estar sendo utilizada por outro programa":d}this.cameraStream=this.hardwareStream;let a=this.cameraStream.getVideoTracks()[0].getSettings(),{width:c=0,height:l=0}=a;if(screen.orientation?.type.includes("portrait")&&Fr()&&this.videoOptions.width==l&&this.videoOptions.height==c&&([c,l]=[l,c]),this.videoOptions.minWidth>c||this.videoOptions.minHeight>l)throw kd;if(this.videoOptions.width!==c||this.videoOptions.height!==l)throw ue.registerAnotherStream(this.proctoringId,`Maybe have another stream active
81
81
  Video Options: ${JSON.stringify(this.videoOptions,null,2)}
82
82
  Setting: ${JSON.stringify(a,null,2)}`),Sd}async stopStream(){this.cameraStream&&this.cameraStream.getTracks().forEach(t=>t.stop()),this.internalClonedStream&&(this.internalClonedStream.getTracks().forEach(t=>t.stop()),this.internalClonedStream=null),this.hardwareStream&&(this.hardwareStream.getTracks().forEach(t=>t.stop()),this.hardwareStream=null)}async startRecording(t){console.log("startRecording Camera Recorder"),(this.paramsConfig.videoBehaviourParameters?.detectPerson||this.paramsConfig.videoBehaviourParameters?.detectCellPhone||this.paramsConfig.videoBehaviourParameters?.detectFace)&&!t?.retry&&(console.log("startRecording Camera Recorder initializeDetectors"),await this.initializeDetectors());let{cameraId:r,microphoneId:n,onBufferSizeErrorCallback:i}=this.options,o={audio:{deviceId:n},video:{deviceId:r,width:this.videoOptions.width,height:this.videoOptions.height,frameRate:15}};try{this.hardwareStream=await navigator.mediaDevices.getUserMedia(o)}catch(_){throw console.log("startRecording Camera Recorder error",_),_.toString()=="NotReadableError: Could not start video source"?"N\xE3o foi poss\xEDvel conectar a camera, ela pode estar sendo utilizada por outro programa":_}this.cameraStream=this.hardwareStream;let a=this.cameraStream.getVideoTracks()[0].getSettings(),{width:c=0,height:l=0}=a,{startRecording:h,stopRecording:d,pauseRecording:m,resumeRecording:p,recorderOptions:g,getBufferSize:f}=Wn(this.cameraStream,this.blobs,this.videoOptions,this.options.onBufferSizeError,_=>this.bufferError(_),!1);if(this.recordingStart=h,this.recordingStop=d,this.recordingPause=m,this.recordingResume=p,this.recorderOptions=g,this.getBufferSize=f,console.log("startRecording Camera Recorder recordingStart"),this.recordingStart(),screen.orientation?.type.includes("portrait")&&Fr()&&this.videoOptions.width==l&&this.videoOptions.height==c&&([c,l]=[l,c]),this.videoOptions.minWidth>c||this.videoOptions.minHeight>l)throw kd;if(this.videoOptions.width!==c||this.videoOptions.height!==l)throw ue.registerAnotherStream(this.proctoringId,`Maybe have another stream active
83
83
  Video Options: ${JSON.stringify(this.videoOptions,null,2)}
@@ -434,7 +434,7 @@ Para iniciar um exame utilize uma outra c\xE2mera.`),o.setAttribute("class","che
434
434
  File size: ${n.size}`),new Error("Error on machine download")}}};var Wa=class{constructor(t,r){this.session=t;this.recorders=r}async startAll(){this.session.start();for(let t of this.recorders)await t.startRecording({retry:!1})}async pauseAll(){this.session.pause();for(let t of this.recorders)await t.pauseRecording()}async resumeAll(){this.session.resume();for(let t of this.recorders)await t.resumeRecording()}async stopAll(){for(let t of this.recorders)await t.stopRecording();this.session.stop()}async saveAllOnSession(){for(let t of this.recorders)await t.saveOnSession(this.session)}};var $i=class{constructor(t,r,n){this.session=t;this.proctoringId=r;this.uploadServices=n}async upload(t,r){await this.uploadRecordings(t,r)}async uploadRecordings(t,r){await this.uploadAllFiles(t,r),this.session.hasSomethingToUpload||this.session.setUploaded()}async uploadAllFiles(t,r){for(let n=0;n<this.session.recordings.length;n++){let i=this.session.recordings[n];if(i.upload)continue;let o=a=>{let c=(n*100+a)/this.session.recordings.length;r&&r(c)},s=await this.uploadFile(i,t,o).catch(()=>{});s&&(i.upload||(i.upload={storage:"upload",awsUrl:"",azureUrl:""}),s.uploaded&&(i.upload.storage=s.storage),s.storage==="upload"?s.url&&(i.upload.azureUrl=s.url):s.url&&(i.upload.awsUrl=s.url))}r&&r(100)}async uploadFile(t,r,n){for await(let i of this.uploadServices){let o=await i.upload({file:t.file,onProgress:s=>{n&&n(s)}},r);if(o){let s="";return t.file.name.search("camera")!==-1?s="Camera":t.file.name.search("screen")!==-1?s="Screen":t.file.name.search("audio")!==-1&&(s="Audio"),ue.registerUploadFile(this.proctoringId,`Upload File
435
435
  Name: ${t.file.name}
436
436
  Type: ${t.file.type}
437
- Size: ${t.file.size}`,s),o}}throw new Error("Could not upload")}};var $a=class{constructor(t,r){this.alerts=[];this.lastActivityTime=Date.now();this.IDLE_THRESHOLD_MS=3e4;this.handleVisibilityChange=()=>{document.visibilityState==="visible"?this.handleReturnFocus():this.handleLostFocus()};this.handleLostFocus=()=>{if(this.getRelativeTime()>1e4){let t={begin:this.getRelativeTime(),end:0,alert:25,type:3};this.onLostFocusCallback(t),this.alerts.push(t)}};this.handleReturnFocus=()=>{let t=this.alerts[this.alerts.length-1];t&&(this.onFocusCallback({begin:t.begin,end:this.getRelativeTime(),alert:25,type:3}),t.end=this.getRelativeTime())};this.handleResize=()=>{clearTimeout(this.resizeTimeout),this.resizeTimeout=setTimeout(()=>{let t=window.screen.availWidth,r=window.outerWidth;if(r<t*.85){let n=`Split Screen Detectado: Janela ocupa ${(r/t*100).toFixed(0)}% da tela`;this.createAlert(43,3,n),this.onRealtimeAlertCallback&&this.onRealtimeAlertCallback({status:"ALERT",description:n,type:"split_screen"})}},1e3)};this.handleUserActivity=t=>{this.lastActivityTime=Date.now(),console.log("\u{1F449} handleUserActivity",t)};this.handleCopy=t=>{t.preventDefault();let r="Tentativa de Copiar (Clipboard)";this.createAlert(42,3,r),this.onRealtimeAlertCallback&&this.onRealtimeAlertCallback({status:"ALERT",description:r,type:"clipboard_copy"})};this.handleCut=t=>{t.preventDefault();let r="Tentativa de Recortar (Clipboard)";this.createAlert(42,3,r),this.onRealtimeAlertCallback&&this.onRealtimeAlertCallback({status:"ALERT",description:r,type:"clipboard_cut"})};this.handlePaste=t=>{t.preventDefault();let r="Tentativa de Colar (Clipboard)";this.createAlert(42,3,r),this.onRealtimeAlertCallback&&this.onRealtimeAlertCallback({status:"ALERT",description:r,type:"clipboard_paste"})};this.onLostFocusCallback=t.onLostFocusCallback,this.onFocusCallback=t.onFocusCallback,this.onRealtimeAlertCallback=t.onRealtimeAlertCallback,this.optionsProctoring=r}async startRecording(){this.startTime=new Date(Date.now()),this.alerts=[],this.attachListeners()}async pauseRecording(){this.detachListeners()}async resumeRecording(){this.attachListeners()}async stopRecording(){this.detachListeners()}async saveOnSession(t){this.alerts.forEach(r=>{t.addAlert(r)})}attachListeners(){this.optionsProctoring.captureScreen&&(window.addEventListener("visibilitychange",this.handleVisibilityChange),window.addEventListener("resize",this.handleResize),window.document.addEventListener("copy",this.handleCopy),window.document.addEventListener("cut",this.handleCut),window.document.addEventListener("paste",this.handlePaste))}detachListeners(){window.removeEventListener("visibilitychange",this.handleVisibilityChange),window.removeEventListener("resize",this.handleResize),window.document.removeEventListener("copy",this.handleCopy),window.document.removeEventListener("cut",this.handleCut),window.document.removeEventListener("paste",this.handlePaste)}addBackgroundEvent(t,r=200){this.createAlert(r,3,t),this.onRealtimeAlertCallback&&this.onRealtimeAlertCallback({status:"ALERT",description:t,type:"background_event"})}getRelativeTime(){return Date.now()-this.startTime.getTime()}createAlert(t,r,n){this.alerts.push({begin:this.getRelativeTime(),end:this.getRelativeTime(),alert:t,type:r})}addAlert({alert:t,type:r}){this.alerts.push({begin:Date.now()-this.startTime.getTime(),end:Date.now()-this.startTime.getTime(),alert:t,type:r})}};var Ga=class{constructor(t,r){this.blobs=[];this.options={cameraId:void 0,microphoneId:void 0};this.audioParams={recordingBitrate:128};r&&(this.audioParams=r),t&&(this.options=t)}async startRecording(){let t={audio:{deviceId:this.options.microphoneId||"default"}};this.audioStream=await navigator.mediaDevices.getUserMedia(t);let{startRecording:r,stopRecording:n,pauseRecording:i,resumeRecording:o}=Wn(this.audioStream,this.blobs,null,void 0,void 0,!0);this.recordingStart=r,this.recordingStop=n,this.recordingPause=i,this.recordingResume=o,this.recordingStart()}async pauseRecording(){}async resumeRecording(){}async stopRecording(){this.recordingStop&&await this.recordingStop()}async saveOnSession(t,r,n){t.addRecording({device:"",file:new File(this.blobs,`EP_${t.id}_audio_${r&&n&&`${r}_${n}`||"0"}.webm`,{type:"audio/webm"}),origin:"Mic"})}};var Kn=typeof self<"u"?self:{};function $n(){throw Error("Invalid UTF8")}function l0(e,t){return t=String.fromCharCode.apply(null,t),e==null?t:e+t}var qa,Ad,y_=typeof TextDecoder<"u",b_,v_=typeof TextEncoder<"u";function G0(e){if(v_)e=(b_||=new TextEncoder).encode(e);else{let r=0,n=new Uint8Array(3*e.length);for(let i=0;i<e.length;i++){var t=e.charCodeAt(i);if(t<128)n[r++]=t;else{if(t<2048)n[r++]=t>>6|192;else{if(t>=55296&&t<=57343){if(t<=56319&&i<e.length){let o=e.charCodeAt(++i);if(o>=56320&&o<=57343){t=1024*(t-55296)+o-56320+65536,n[r++]=t>>18|240,n[r++]=t>>12&63|128,n[r++]=t>>6&63|128,n[r++]=63&t|128;continue}i--}t=65533}n[r++]=t>>12|224,n[r++]=t>>6&63|128}n[r++]=63&t|128}}e=r===n.length?n:n.subarray(0,r)}return e}var $d,ec;e:{for(Td=["CLOSURE_FLAGS"],Ka=Kn,Xa=0;Xa<Td.length;Xa++)if((Ka=Ka[Td[Xa]])==null){ec=null;break e}ec=Ka}var Td,Ka,Xa,Jo,h0=ec&&ec[610401301];$d=h0!=null&&h0;var d0=Kn.navigator;function Md(e){return!!$d&&!!Jo&&Jo.brands.some((({brand:t})=>t&&t.indexOf(e)!=-1))}function cr(e){var t;return(t=Kn.navigator)&&(t=t.userAgent)||(t=""),t.indexOf(e)!=-1}function vn(){return!!$d&&!!Jo&&Jo.brands.length>0}function Id(){return vn()?Md("Chromium"):(cr("Chrome")||cr("CriOS"))&&!(!vn()&&cr("Edge"))||cr("Silk")}Jo=d0&&d0.userAgentData||null;var __=!vn()&&(cr("Trident")||cr("MSIE"));!cr("Android")||Id(),Id(),cr("Safari")&&(Id()||!vn()&&cr("Coast")||!vn()&&cr("Opera")||!vn()&&cr("Edge")||(vn()?Md("Microsoft Edge"):cr("Edg/"))||vn()&&Md("Opera"));var q0={},$o=null;function w_(e){let t=e.length,r=3*t/4;r%3?r=Math.floor(r):"=.".indexOf(e[t-1])!=-1&&(r="=.".indexOf(e[t-2])!=-1?r-2:r-1);let n=new Uint8Array(r),i=0;return(function(o,s){function a(l){for(;c<o.length;){let h=o.charAt(c++),d=$o[h];if(d!=null)return d;if(!/^[\s\xa0]*$/.test(h))throw Error("Unknown base64 encoding at char: "+h)}return l}K0();let c=0;for(;;){let l=a(-1),h=a(0),d=a(64),m=a(64);if(m===64&&l===-1)break;s(l<<2|h>>4),d!=64&&(s(h<<4&240|d>>2),m!=64&&s(d<<6&192|m))}})(e,(function(o){n[i++]=o})),i!==r?n.subarray(0,i):n}function K0(){if(!$o){$o={};var e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789".split(""),t=["+/=","+/","-_=","-_.","-_"];for(let r=0;r<5;r++){let n=e.concat(t[r].split(""));q0[r]=n;for(let i=0;i<n.length;i++){let o=n[i];$o[o]===void 0&&($o[o]=i)}}}}var X0=typeof Uint8Array<"u",J0=!__&&typeof btoa=="function";function u0(e){if(!J0){var t;t===void 0&&(t=0),K0(),t=q0[t];var r=Array(Math.floor(e.length/3)),n=t[64]||"";let c=0,l=0;for(;c<e.length-2;c+=3){var i=e[c],o=e[c+1],s=e[c+2],a=t[i>>2];i=t[(3&i)<<4|o>>4],o=t[(15&o)<<2|s>>6],s=t[63&s],r[l++]=a+i+o+s}switch(a=0,s=n,e.length-c){case 2:s=t[(15&(a=e[c+1]))<<2]||n;case 1:e=e[c],r[l]=t[e>>2]+t[(3&e)<<4|a>>4]+s+n}return r.join("")}for(t="",r=0,n=e.length-10240;r<n;)t+=String.fromCharCode.apply(null,e.subarray(r,r+=10240));return t+=String.fromCharCode.apply(null,r?e.subarray(r):e),btoa(t)}var f0=/[-_.]/g,S_={"-":"+",_:"/",".":"="};function k_(e){return S_[e]||""}function Y0(e){if(!J0)return w_(e);f0.test(e)&&(e=e.replace(f0,k_)),e=atob(e);let t=new Uint8Array(e.length);for(let r=0;r<e.length;r++)t[r]=e.charCodeAt(r);return t}function hc(e){return X0&&e!=null&&e instanceof Uint8Array}var Yi={};function Zi(){return E_||=new wn(null,Yi)}function Gd(e){Z0(Yi);var t=e.g;return(t=t==null||hc(t)?t:typeof t=="string"?Y0(t):null)==null?t:e.g=t}var wn=class{i(){return new Uint8Array(Gd(this)||0)}constructor(e,t){if(Z0(t),this.g=e,e!=null&&e.length===0)throw Error("ByteString should be constructed with non-empty values")}},E_,C_;function Z0(e){if(e!==Yi)throw Error("illegal external caller")}function Q0(e,t){e.__closure__error__context__984382||(e.__closure__error__context__984382={}),e.__closure__error__context__984382.severity=t}function p0(){let e=Error("int32");return Q0(e,"warning"),e}var dc=typeof Symbol=="function"&&typeof Symbol()=="symbol",x_=new Set;function uc(e,t,r=!1,n=!1){return e=typeof Symbol=="function"&&typeof Symbol()=="symbol"?n&&Symbol.for&&e?Symbol.for(e):e!=null?Symbol(e):Symbol():t,r&&x_.add(e),e}var A_=uc("jas",void 0,!0,!0),Rd=uc(void 0,"2ex"),Ho=uc(void 0,"1oa",!0),Qi=uc(void 0,Symbol(),!0),se=dc?A_:"M",e1={M:{value:0,configurable:!0,writable:!0,enumerable:!1}},t1=Object.defineProperties;function qd(e,t){dc||se in e||t1(e,e1),e[se]|=t}function ct(e,t){dc||se in e||t1(e,e1),e[se]=t}function T_(e,t){ct(t,-30975&(0|e))}function Ud(e,t){ct(t,-30941&(34|e))}function Kd(){return typeof BigInt=="function"}function lr(e){return Array.prototype.slice.call(e)}var Xd,Zo={},I_={};function m0(e){return!(!e||typeof e!="object"||e.g!==I_)}function Jd(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)&&e.constructor===Object}function r1(e,t){if(e!=null){if(typeof e=="string")e=e?new wn(e,Yi):Zi();else if(e.constructor!==wn)if(hc(e))e=e.length?new wn(new Uint8Array(e),Yi):Zi();else{if(!t)throw Error();e=void 0}}return e}function tc(e){return!(!Array.isArray(e)||e.length)&&!!(1&(0|e[se]))}var g0=[];function Yn(e){if(2&e)throw Error()}function Yd(e){return Qi?e[Qi]:void 0}ct(g0,55),Xd=Object.freeze(g0);var n1=Object.freeze({}),Zd=typeof Kn.BigInt=="function"&&typeof Kn.BigInt(0)=="bigint",Nd=e=>Zd?e>=P_&&e<=O_:e[0]==="-"?y0(e,R_):y0(e,D_),R_=Number.MIN_SAFE_INTEGER.toString(),P_=Zd?BigInt(Number.MIN_SAFE_INTEGER):void 0,D_=Number.MAX_SAFE_INTEGER.toString(),O_=Zd?BigInt(Number.MAX_SAFE_INTEGER):void 0;function y0(e,t){if(e.length>t.length)return!1;if(e.length<t.length||e===t)return!0;for(let r=0;r<e.length;r++){let n=e[r],i=t[r];if(n>i)return!1;if(n<i)return!0}}var B_=typeof Uint8Array.prototype.slice=="function",i1,De=0,Ge=0;function b0(e){let t=e>>>0;De=t,Ge=(e-t)/4294967296>>>0}function eo(e){if(e<0){b0(-e);let[t,r]=tu(De,Ge);De=t>>>0,Ge=r>>>0}else b0(e)}function o1(e){let t=i1||=new DataView(new ArrayBuffer(8));t.setFloat32(0,+e,!0),Ge=0,De=t.getUint32(0,!0)}function Qd(e,t){let r=4294967296*t+(e>>>0);return Number.isSafeInteger(r)?r:Yo(e,t)}function eu(e,t){let r=2147483648&t;return r&&(t=~t>>>0,(e=1+~e>>>0)==0&&(t=t+1>>>0)),typeof(e=Qd(e,t))=="number"?r?-e:e:r?"-"+e:e}function Yo(e,t){if(e>>>=0,(t>>>=0)<=2097151)var r=""+(4294967296*t+e);else Kd()?r=""+(BigInt(t)<<BigInt(32)|BigInt(e)):(e=(16777215&e)+6777216*(r=16777215&(e>>>24|t<<8))+6710656*(t=t>>16&65535),r+=8147497*t,t*=2,e>=1e7&&(r+=e/1e7>>>0,e%=1e7),r>=1e7&&(t+=r/1e7>>>0,r%=1e7),r=t+v0(r)+v0(e));return r}function v0(e){return e=String(e),"0000000".slice(e.length)+e}function fc(e){if(e.length<16)eo(Number(e));else if(Kd())e=BigInt(e),De=Number(e&BigInt(4294967295))>>>0,Ge=Number(e>>BigInt(32)&BigInt(4294967295));else{let t=+(e[0]==="-");Ge=De=0;let r=e.length;for(let n=t,i=(r-t)%6+t;i<=r;n=i,i+=6){let o=Number(e.slice(n,i));Ge*=1e6,De=1e6*De+o,De>=4294967296&&(Ge+=Math.trunc(De/4294967296),Ge>>>=0,De>>>=0)}if(t){let[n,i]=tu(De,Ge);De=n,Ge=i}}}function tu(e,t){return t=~t,e?e=1+~e:t+=1,[e,t]}var s1=typeof BigInt=="function"?BigInt.asIntN:void 0,L_=typeof BigInt=="function"?BigInt.asUintN:void 0,Go=Number.isSafeInteger,pc=Number.isFinite,rc=Math.trunc;function Qo(e){return e==null||typeof e=="number"?e:e==="NaN"||e==="Infinity"||e==="-Infinity"?Number(e):void 0}function _0(e){if(e!=null&&typeof e!="boolean"){var t=typeof e;throw Error(`Expected boolean but got ${t!="object"?t:e?Array.isArray(e)?"array":t:"null"}: ${e}`)}return e}var F_=/^-?([1-9][0-9]*|0)(\.[0-9]+)?$/;function ru(e){switch(typeof e){case"bigint":return!0;case"number":return pc(e);case"string":return F_.test(e);default:return!1}}function Xn(e){if(e==null)return e;if(typeof e=="string"&&e)e=+e;else if(typeof e!="number")return;return pc(e)?0|e:void 0}function w0(e){if(e[0]==="-")return!1;let t=e.length;return t<20||t===20&&Number(e.substring(0,6))<184467}function a1(e){return e=rc(e),Go(e)||(eo(e),e=eu(De,Ge)),e}function c1(e){var t=rc(Number(e));if(Go(t))return String(t);if((t=e.indexOf("."))!==-1&&(e=e.substring(0,t)),t=e.length,!(e[0]==="-"?t<20||t===20&&Number(e.substring(0,7))>-922337:t<19||t===19&&Number(e.substring(0,6))<922337))if(fc(e),e=De,2147483648&(t=Ge))if(Kd())e=""+(BigInt(0|t)<<BigInt(32)|BigInt(e>>>0));else{let[r,n]=tu(e,t);e="-"+Yo(r,n)}else e=Yo(e,t);return e}function zd(e){return e==null?e:typeof e=="bigint"?(Nd(e)?e=Number(e):(e=s1(64,e),e=Nd(e)?Number(e):String(e)),e):ru(e)?typeof e=="number"?a1(e):c1(e):void 0}function M_(e){if(e==null)return e;var t=typeof e;if(t==="bigint")return String(L_(64,e));if(ru(e)){if(t==="string")return t=rc(Number(e)),Go(t)&&t>=0?e=String(t):((t=e.indexOf("."))!==-1&&(e=e.substring(0,t)),w0(e)||(fc(e),e=Yo(De,Ge))),e;if(t==="number")return(e=rc(e))>=0&&Go(e)?e:(function(r){if(r<0){eo(r);var n=Yo(De,Ge);return r=Number(n),Go(r)?r:n}return w0(n=String(r))?n:(eo(r),Qd(De,Ge))})(e)}}function l1(e){if(typeof e!="string")throw Error();return e}function nc(e){if(e!=null&&typeof e!="string")throw Error();return e}function Sn(e){return e==null||typeof e=="string"?e:void 0}function h1(e,t,r){if(e!=null&&typeof e=="object"&&e.B===Zo)return e;if(Array.isArray(e)){var n=0|e[se],i=n;return i===0&&(i|=32&r),(i|=2&r)!==n&&ct(e,i),new t(e)}}function d1(e,t,r,n,i){if(e!=null){if(Array.isArray(e))e=tc(e)?void 0:i&&2&(0|e[se])?e:nu(e,t,r,n!==void 0,i);else if(Jd(e)){let o={};for(let s in e)o[s]=d1(e[s],t,r,n,i);e=o}else e=t(e,n);return e}}function nu(e,t,r,n,i){let o=n||r?0|e[se]:0,s=n?!!(32&o):void 0;n=lr(e);for(let a=0;a<n.length;a++)n[a]=d1(n[a],t,r,s,i);return r&&((e=Yd(e))&&(n[Qi]=lr(e)),r(o,n)),n}function U_(e){return e.B===Zo?e.toJSON():(function(t){switch(typeof t){case"number":return isFinite(t)?t:String(t);case"bigint":return Nd(t)?Number(t):String(t);case"boolean":return t?1:0;case"object":if(t)if(Array.isArray(t)){if(tc(t))return}else{if(hc(t))return u0(t);if(t instanceof wn){let r=t.g;return r==null?"":typeof r=="string"?r:t.g=u0(r)}}}return t})(e)}function N_(e){return nu(e,U_,void 0,void 0,!1)}var u1,z_;function qo(e,t,r){return e=f1(e,t[0],t[1],r?1:2),t!==u1&&r&&qd(e,16384),e}function f1(e,t,r,n){if(e==null){var i=96;r?(e=[r],i|=512):e=[],t&&(i=-33521665&i|(1023&t)<<15)}else{if(!Array.isArray(e))throw Error("narr");if(2048&(i=0|e[se]))throw Error("farr");if(64&i)return e;if(n===1||n===2||(i|=64),r&&(i|=512,r!==e[0]))throw Error("mid");e:{if(n=(r=e).length){let o=n-1;if(Jd(r[o])){if((t=o-(512&(i|=256)?0:-1))>=1024)throw Error("pvtlmt");i=-33521665&i|(1023&t)<<15;break e}}if(t){if((t=Math.max(t,n-(512&i?0:-1)))>1024)throw Error("spvt");i=-33521665&i|(1023&t)<<15}}}return ct(e,i),e}function p1(e,t,r=Ud){if(e!=null){if(X0&&e instanceof Uint8Array)return t?e:new Uint8Array(e);if(Array.isArray(e)){var n=0|e[se];return 2&n?e:(t&&=n===0||!!(32&n)&&!(64&n||!(16&n)),t?(ct(e,-12293&(34|n)),e):nu(e,p1,4&n?Ud:r,!0,!0))}return e.B===Zo&&(e=2&(n=0|(r=e.l)[se])?e:new e.constructor(mc(r,n,!0))),e}}function m1(e){let t=e.l;return new e.constructor(mc(t,0|t[se],!1))}function mc(e,t,r){let n=r||2&t?Ud:T_,i=!!(32&t);return e=(function(o,s,a){let c=lr(o);var l=c.length;let h=256&s?c[l-1]:void 0;for(l+=h?-1:0,s=512&s?1:0;s<l;s++)c[s]=a(c[s]);if(h){s=c[s]={};for(let d in h)s[d]=a(h[d])}return(o=Yd(o))&&(c[Qi]=lr(o)),c})(e,t,(o=>p1(o,i,n))),qd(e,32|(r?2:0)),e}function iu(e){let t=e.l,r=0|t[se];return 2&r?new e.constructor(mc(t,r,!1)):e}function _r(e,t){return Zn(e=e.l,0|e[se],t)}function Zn(e,t,r,n){if(r===-1)return null;var i=r+(512&t?0:-1);let o=e.length-1;return i>=o&&256&t?e[o][r]:n&&256&t&&(t=e[o][r])!=null?(e[i]!=null&&Rd!=null&&((i=(e=C_??={})[Rd]||0)>=4||(e[Rd]=i+1,Q0(e=Error(),"incident"),(function(s){Kn.setTimeout((()=>{throw s}),0)})(e))),t):i<=o?e[i]:void 0}function pt(e,t,r){let n=e.l,i=0|n[se];return Yn(i),lt(n,i,t,r),e}function lt(e,t,r,n){let i=512&t?0:-1,o=r+i;var s=e.length-1;return o>=s&&256&t?(e[s][r]=n,t):o<=s?(e[o]=n,256&t&&r in(e=e[s])&&delete e[r],t):(n!==void 0&&(r>=(s=t>>15&1023||536870912)?n!=null&&(e[s+i]={[r]:n},ct(e,t|=256)):e[o]=n),t)}function g1(e){let t=0|(e=e.l)[se],r=Zn(e,t,1),n=r1(r,!0);return n!=null&&n!==r&&lt(e,t,1,n),n}function y1(e,t,r,n,i){let o=e.l,s=2&(e=0|o[se])?1:n;i=!!i;let a=0|(n=ou(o,e,t))[se];if(!(4&a)){4&a&&(n=lr(n),a=en(a,e),e=lt(o,e,t,n));let c=0,l=0;for(;c<n.length;c++){let h=r(n[c]);h!=null&&(n[l++]=h)}l<c&&(n.length=l),a=su(a,e),r=-4097&(20|a),a=r&=-8193,ct(n,a),2&a&&Object.freeze(n)}return s===1||s===4&&32&a?Qr(a)||(i=a,a|=2,a!==i&&ct(n,a),Object.freeze(n)):(s===2&&Qr(a)&&(n=lr(n),a=en(a,e),a=kn(a,e,i),ct(n,a),e=lt(o,e,t,n)),Qr(a)||(t=a,a=kn(a,e,i),a!==t&&ct(n,a))),n}function ou(e,t,r,n){return e=Zn(e,t,r,n),Array.isArray(e)?e:Xd}function su(e,t){return e===0&&(e=en(e,t)),1|e}function Qr(e){return!!(2&e)&&!!(4&e)||!!(2048&e)}function S0(e,t,r){let n=0|(e=e.l)[se];if(Yn(n),r==null)lt(e,n,t);else{var i=0|r[se],o=i,s=Qr(i),a=s||Object.isFrozen(r);for(s||(i=0),a||(r=lr(r),o=0,i=kn(i=en(i,n),n,!0),a=!1),i|=21,s=0;s<r.length;s++){let c=r[s],l=l1(c);Object.is(c,l)||(a&&(r=lr(r),o=0,i=kn(i=en(i,n),n,!0),a=!1),r[s]=l)}i!==o&&(a&&(r=lr(r),i=kn(i=en(i,n),n,!0)),ct(r,i)),lt(e,n,t,r)}}function b1(e,t){let r=0|(e=e.l)[se];Yn(r),lt(e,r,2,t===""?void 0:t)}function es(e,t,r,n,i){Yn(t);var o=!(!(64&t)&&16384&t);let s=(i=ou(e,t,r,i))!==Xd;if(o||!s){let a=o=s?0|i[se]:0;(!s||2&a||Qr(a)||4&a&&!(32&a))&&(i=lr(i),a=en(a,t),t=lt(e,t,r,i)),a=-13&su(a,t),a=kn(n?-17&a:16|a,t,!0),a!==o&&ct(i,a)}return i}function Pd(e,t){var r=c2;return cu(au(e=e.l),e,0|e[se],r)===t?t:-1}function au(e){if(dc)return e[Ho]??(e[Ho]=new Map);if(Ho in e)return e[Ho];let t=new Map;return Object.defineProperty(e,Ho,{value:t}),t}function v1(e,t,r,n){let i=au(e),o=cu(i,e,t,r);return o!==n&&(o&&(t=lt(e,t,o)),i.set(r,n)),t}function cu(e,t,r,n){let i=e.get(n);if(i!=null)return i;i=0;for(let o=0;o<n.length;o++){let s=n[o];Zn(t,r,s)!=null&&(i!==0&&(r=lt(t,r,i)),i=s)}return e.set(n,i),i}function lu(e,t,r,n){let i,o=0|e[se];if((n=Zn(e,o,r,n))!=null&&n.B===Zo)return(t=iu(n))!==n&&lt(e,o,r,t),t.l;if(Array.isArray(n)){let s=0|n[se];i=2&s?qo(mc(n,s,!1),t,!0):64&s?n:qo(i,t,!0)}else i=qo(void 0,t,!0);return i!==n&&lt(e,o,r,i),i}function _1(e,t,r,n){let i=0|(e=e.l)[se];return(t=h1(n=Zn(e,i,r,n),t,i))!==n&&t!=null&&lt(e,i,r,t),t}function wr(e,t,r){if((t=_1(e,t,r,!1))==null)return t;let n=0|(e=e.l)[se];if(!(2&n)){let i=iu(t);i!==t&&lt(e,n,r,t=i)}return t}function w1(e,t,r,n,i,o){e=e.l;var s=!!(2&t);let a=s?1:n;i=!!i,o&&=!s;var c=0|(n=ou(e,t,1))[se];if(!(s=!!(4&c))){var l=n,h=t;let d=!!(2&(c=su(c,t)));d&&(h|=2);let m=!d,p=!0,g=0,f=0;for(;g<l.length;g++){let b=h1(l[g],r,h);if(b instanceof r){if(!d){let _=!!(2&(0|b.l[se]));m&&=!_,p&&=_}l[f++]=b}}f<g&&(l.length=f),c|=4,c=p?16|c:-17&c,ct(l,c=m?8|c:-9&c),d&&Object.freeze(l)}if(o&&!(8&c||!n.length&&(a===1||a===4&&32&c))){for(Qr(c)&&(n=lr(n),c=en(c,t),t=lt(e,t,1,n)),r=n,o=c,l=0;l<r.length;l++)(c=r[l])!==(h=iu(c))&&(r[l]=h);o|=8,ct(r,o=r.length?-17&o:16|o),c=o}return a===1||a===4&&32&c?Qr(c)||(t=c,(c|=!n.length||16&c&&(!s||32&c)?2:2048)!==t&&ct(n,c),Object.freeze(n)):(a===2&&Qr(c)&&(ct(n=lr(n),c=kn(c=en(c,t),t,i)),t=lt(e,t,1,n)),Qr(c)||(e=c,(c=kn(c,t,i))!==e&&ct(n,c))),n}function hu(e,t){let r=0|e.l[se];return w1(e,r,t,n1===void 0?2:4,!1,!(2&r))}function Sr(e,t,r,n){return n==null&&(n=void 0),pt(e,r,n)}function Dd(e,t,r){var n=i2;r==null&&(r=void 0);e:{let i=0|(e=e.l)[se];if(Yn(i),r==null){let o=au(e);if(cu(o,e,i,n)!==t)break e;o.set(n,0)}else i=v1(e,i,n,t);lt(e,i,t,r)}}function en(e,t){return-2049&(e=32|(2&t?2|e:-3&e))}function kn(e,t,r){return 32&t&&r||(e&=-33),e}function S1(e,t){var r=xu;let n=0|e.l[se];Yn(n),e=w1(e,n,r,2,!0),t=t??new r,e.push(t),e[se]=2&(0|t.l[se])?-9&e[se]:-17&e[se]}function Ot(e,t,r){Yn(0|e.l[se]),y1(e,t,Sn,2,!0).push(l1(r))}function k1(e,t){return Error(`Invalid wire type: ${e} (at position ${t})`)}function du(){return Error("Failed to read varint, encoding is invalid.")}function E1(e,t){return Error(`Tried to read past the end of the data ${t} > ${e}`)}function uu(e){if(typeof e=="string")return{buffer:Y0(e),u:!1};if(Array.isArray(e))return{buffer:new Uint8Array(e),u:!1};if(e.constructor===Uint8Array)return{buffer:e,u:!1};if(e.constructor===ArrayBuffer)return{buffer:new Uint8Array(e),u:!1};if(e.constructor===wn)return{buffer:Gd(e)||new Uint8Array(0),u:!0};if(e instanceof Uint8Array)return{buffer:new Uint8Array(e.buffer,e.byteOffset,e.byteLength),u:!1};throw Error("Type not convertible to a Uint8Array, expected a Uint8Array, an ArrayBuffer, a base64 encoded string, a ByteString or an Array of numbers")}function fu(e,t){let r,n=0,i=0,o=0,s=e.i,a=e.g;do r=s[a++],n|=(127&r)<<o,o+=7;while(o<32&&128&r);for(o>32&&(i|=(127&r)>>4),o=3;o<32&&128&r;o+=7)r=s[a++],i|=(127&r)<<o;if(qn(e,a),r<128)return t(n>>>0,i>>>0);throw du()}function pu(e){let t=0,r=e.g,n=r+10,i=e.i;for(;r<n;){let o=i[r++];if(t|=o,(128&o)==0)return qn(e,r),!!(127&t)}throw du()}function Bt(e){let t=e.i,r=e.g,n=t[r++],i=127&n;if(128&n&&(n=t[r++],i|=(127&n)<<7,128&n&&(n=t[r++],i|=(127&n)<<14,128&n&&(n=t[r++],i|=(127&n)<<21,128&n&&(n=t[r++],i|=n<<28,128&n&&128&t[r++]&&128&t[r++]&&128&t[r++]&&128&t[r++]&&128&t[r++])))))throw du();return qn(e,r),i}function jd(e){var t=e.i;let r=e.g,n=t[r],i=t[r+1],o=t[r+2];return t=t[r+3],qn(e,e.g+4),(n<<0|i<<8|o<<16|t<<24)>>>0}function Vd(e){var t=jd(e);e=2*(t>>31)+1;let r=t>>>23&255;return t&=8388607,r==255?t?NaN:e*(1/0):r==0?1401298464324817e-60*e*t:e*Math.pow(2,r-150)*(t+8388608)}function j_(e){return Bt(e)}function Od(e,t,{C:r=!1}={}){e.C=r,t&&(t=uu(t),e.i=t.buffer,e.m=t.u,e.s=0,e.j=e.i.length,e.g=e.s)}function qn(e,t){if(e.g=t,t>e.j)throw E1(e.j,t)}function C1(e,t){if(t<0)throw Error(`Tried to read a negative byte length: ${t}`);let r=e.g,n=r+t;if(n>e.j)throw E1(t,e.j-r);return e.g=n,r}function x1(e,t){if(t==0)return Zi();var r=C1(e,t);return e.C&&e.m?r=e.i.subarray(r,r+t):(e=e.i,r=r===(t=r+t)?new Uint8Array(0):B_?e.slice(r,t):new Uint8Array(e.subarray(r,t))),r.length==0?Zi():new wn(r,Yi)}var k0=[];function A1(e){var t=e.g;if(t.g==t.j)return!1;e.j=e.g.g;var r=Bt(e.g)>>>0;if(t=r>>>3,!((r&=7)>=0&&r<=5))throw k1(r,e.j);if(t<1)throw Error(`Invalid field number: ${t} (at position ${e.j})`);return e.m=t,e.i=r,!0}function Za(e){switch(e.i){case 0:e.i!=0?Za(e):pu(e.g);break;case 1:qn(e=e.g,e.g+8);break;case 2:if(e.i!=2)Za(e);else{var t=Bt(e.g)>>>0;qn(e=e.g,e.g+t)}break;case 5:qn(e=e.g,e.g+4);break;case 3:for(t=e.m;;){if(!A1(e))throw Error("Unmatched start-group tag: stream EOF");if(e.i==4){if(e.m!=t)throw Error("Unmatched end-group tag");break}Za(e)}break;default:throw k1(e.i,e.j)}}function gc(e,t,r){let n=e.g.j,i=Bt(e.g)>>>0,o=e.g.g+i,s=o-n;if(s<=0&&(e.g.j=o,r(t,e,void 0,void 0,void 0),s=o-e.g.g),s)throw Error(`Message parsing ended unexpectedly. Expected to read ${i} bytes, instead read ${i-s} bytes, either the data ended unexpectedly or the message misreported its own length`);e.g.g=o,e.g.j=n}function mu(e){var t=Bt(e.g)>>>0,r=C1(e=e.g,t);if(e=e.i,y_){var n,i=e;(n=Ad)||(n=Ad=new TextDecoder("utf-8",{fatal:!0})),t=r+t,i=r===0&&t===i.length?i:i.subarray(r,t);try{var o=n.decode(i)}catch(a){if(qa===void 0){try{n.decode(new Uint8Array([128]))}catch{}try{n.decode(new Uint8Array([97])),qa=!0}catch{qa=!1}}throw!qa&&(Ad=void 0),a}}else{t=(o=r)+t,r=[];let a,c=null;for(;o<t;){var s=e[o++];s<128?r.push(s):s<224?o>=t?$n():(a=e[o++],s<194||(192&a)!=128?(o--,$n()):r.push((31&s)<<6|63&a)):s<240?o>=t-1?$n():(a=e[o++],(192&a)!=128||s===224&&a<160||s===237&&a>=160||(192&(n=e[o++]))!=128?(o--,$n()):r.push((15&s)<<12|(63&a)<<6|63&n)):s<=244?o>=t-2?$n():(a=e[o++],(192&a)!=128||a-144+(s<<28)>>30!=0||(192&(n=e[o++]))!=128||(192&(i=e[o++]))!=128?(o--,$n()):(s=(7&s)<<18|(63&a)<<12|(63&n)<<6|63&i,s-=65536,r.push(55296+(s>>10&1023),56320+(1023&s)))):$n(),r.length>=8192&&(c=l0(c,r),r.length=0)}o=l0(c,r)}return o}function T1(e){let t=Bt(e.g)>>>0;return x1(e.g,t)}function gu(e,t,r){var n=Bt(e.g)>>>0;for(n=e.g.g+n;e.g.g<n;)r.push(t(e.g))}var Ja=[];function V_(e){return e}var Ki;function I1(e,t,r){t.g?t.j(e,t.g,t.i,r):t.j(e,t.i,r)}var Ue=class{constructor(e,t){this.l=f1(e,t)}toJSON(){let e=!Ki;try{return e&&(Ki=N_),R1(this)}finally{e&&(Ki=void 0)}}u(){return!!(2&(0|this.l[se]))}};function R1(e){var t=e.l;{t=(e=Ki(t))!==t;let l=e.length;if(l){var r=e[l-1],n=Jd(r);n?l--:r=void 0;var i=e;if(n){e:{var o,s=r,a=!1;if(s)for(let h in s)isNaN(+h)?(o??={})[h]=s[h]:(n=s[h],Array.isArray(n)&&(tc(n)||m0(n)&&n.size===0)&&(n=null),n==null&&(a=!0),n!=null&&((o??={})[h]=n));if(a||(o=s),o)for(let h in o){a=o;break e}a=null}s=a==null?r!=null:a!==r}for(;l>0&&((o=i[l-1])==null||tc(o)||m0(o)&&o.size===0);l--)var c=!0;(i!==e||s||c)&&(t?(c||s||a)&&(i.length=l):i=Array.prototype.slice.call(i,0,l),a&&i.push(a)),c=i}else c=e}return c}function E0(e){return e?/^\d+$/.test(e)?(fc(e),new Hd(De,Ge)):null:H_||=new Hd(0,0)}Ue.prototype.B=Zo,Ue.prototype.toString=function(){try{return Ki=V_,R1(this).toString()}finally{Ki=void 0}};var Hd=class{constructor(e,t){this.i=e>>>0,this.g=t>>>0}},H_;function C0(e){return e?/^-?\d+$/.test(e)?(fc(e),new Wd(De,Ge)):null:W_||=new Wd(0,0)}var Wd=class{constructor(e,t){this.i=e>>>0,this.g=t>>>0}},W_;function Xi(e,t,r){for(;r>0||t>127;)e.g.push(127&t|128),t=(t>>>7|r<<25)>>>0,r>>>=7;e.g.push(t)}function ts(e,t){for(;t>127;)e.g.push(127&t|128),t>>>=7;e.g.push(t)}function yc(e,t){if(t>=0)ts(e,t);else{for(let r=0;r<9;r++)e.g.push(127&t|128),t>>=7;e.g.push(1)}}function ic(e,t){e.g.push(t>>>0&255),e.g.push(t>>>8&255),e.g.push(t>>>16&255),e.g.push(t>>>24&255)}function to(e,t){t.length!==0&&(e.j.push(t),e.i+=t.length)}function kr(e,t,r){ts(e.g,8*t+r)}function bc(e,t){return kr(e,t,2),t=e.g.end(),to(e,t),t.push(e.i),t}function vc(e,t){var r=t.pop();for(r=e.i+e.g.length()-r;r>127;)t.push(127&r|128),r>>>=7,e.i++;t.push(r),e.i++}function _c(e,t,r){kr(e,t,2),ts(e.g,r.length),to(e,e.g.end()),to(e,r)}function Er(){let e=class{constructor(){throw Error()}};return Object.setPrototypeOf(e,e.prototype),e}var yu=Er(),P1=Er(),bu=Er(),vu=Er(),D1=Er(),O1=Er(),B1=Er(),L1=Er(),ro=class{constructor(e,t,r){this.g=e,this.i=t,e=yu,this.j=!!e&&r===e||!1}};function _u(e,t){return new ro(e,t,yu)}function F1(e,t,r,n,i){(t=z1(t,n))!=null&&(r=bc(e,r),i(t,e),vc(e,r))}var $_=_u((function(e,t,r,n,i){return e.i===2&&(gc(e,lu(t,n,r),i),!0)}),F1),G_=_u((function(e,t,r,n,i){return e.i===2&&(gc(e,lu(t,n,r,!0),i),!0)}),F1),wc=Symbol(),wu=Symbol(),x0=Symbol(),A0=Symbol(),M1,U1;function Qn(e,t,r,n){var i=n[e];if(i)return i;(i={}).P=n,i.A=(function(d){switch(typeof d){case"boolean":return u1||=[0,void 0,!0];case"number":return d>0?void 0:d===0?z_||=[0,void 0]:[-d,void 0];case"string":return[0,d];case"object":return d}})(n[0]);var o=n[1];let s=1;o&&o.constructor===Object&&(i.H=o,typeof(o=n[++s])=="function"&&(i.I=!0,M1??=o,U1??=n[s+1],o=n[s+=2]));let a={};for(;o&&Array.isArray(o)&&o.length&&typeof o[0]=="number"&&o[0]>0;){for(var c=0;c<o.length;c++)a[o[c]]=o;o=n[++s]}for(c=1;o!==void 0;){let d;typeof o=="number"&&(c+=o,o=n[++s]);var l=void 0;if(o instanceof ro?d=o:(d=$_,s--),d?.j){o=n[++s],l=n;var h=s;typeof o=="function"&&(o=o(),l[h]=o),l=o}for(h=c+1,typeof(o=n[++s])=="number"&&o<0&&(h-=o,o=n[++s]);c<h;c++){let m=a[c];l?r(i,c,d,l,m):t(i,c,d,m)}}return n[e]=i}function N1(e){return Array.isArray(e)?e[0]instanceof ro?e:[G_,e]:[e,void 0]}function z1(e,t){return e instanceof Ue?e.l:Array.isArray(e)?qo(e,t,!1):void 0}function Su(e,t,r,n){let i=r.g;e[t]=n?(o,s,a)=>i(o,s,a,n):i}function ku(e,t,r,n,i){let o=r.g,s,a;e[t]=(c,l,h)=>o(c,l,h,a||=Qn(wu,Su,ku,n).A,s||=Eu(n),i)}function Eu(e){let t=e[x0];if(t!=null)return t;let r=Qn(wu,Su,ku,e);return t=r.I?(n,i)=>M1(n,i,r):(n,i)=>{let o=0|n[se];for(;A1(i)&&i.i!=4;){var s=i.m,a=r[s];if(a==null){var c=r.H;c&&(c=c[s])&&(c=q_(c))!=null&&(a=r[s]=c)}a!=null&&a(i,n,s)||(s=(a=i).j,Za(a),a.G?a=void 0:(c=a.g.g-s,a.g.g=s,a=x1(a.g,c)),s=n,a&&((c=s[Qi])?c.push(a):s[Qi]=[a]))}return 16384&o&&qd(n,34),!0},e[x0]=t}function q_(e){let t=(e=N1(e))[0].g;if(e=e[1]){let r=Eu(e),n=Qn(wu,Su,ku,e).A;return(i,o,s)=>t(i,o,s,n,r)}return t}function Sc(e,t,r){e[t]=r.i}function kc(e,t,r,n){let i,o,s=r.i;e[t]=(a,c,l)=>s(a,c,l,o||=Qn(wc,Sc,kc,n).A,i||=j1(n))}function j1(e){let t=e[A0];if(!t){let r=Qn(wc,Sc,kc,e);t=(n,i)=>V1(n,i,r),e[A0]=t}return t}function V1(e,t,r){for(var n=0|e[se],i=512&n?0:-1,o=e.length,s=512&n?1:0,a=o+(256&n?-1:0);s<a;s++){let c=e[s];if(c==null)continue;let l=s-i,h=T0(r,l);h&&h(t,c,l)}if(256&n){n=e[o-1];for(let c in n)i=+c,Number.isNaN(i)||(o=n[i])!=null&&(a=T0(r,i))&&a(t,o,i)}if(e=Yd(e))for(to(t,t.g.end()),r=0;r<e.length;r++)to(t,Gd(e[r])||new Uint8Array(0))}function T0(e,t){var r=e[t];if(r)return r;if((r=e.H)&&(r=r[t])){var n=(r=N1(r))[0].i;if(r=r[1]){let i=j1(r),o=Qn(wc,Sc,kc,r).A;r=e.I?U1(o,i):(s,a,c)=>n(s,a,c,o,i)}else r=n;return e[t]=r}}function Ec(e,t){if(Array.isArray(t)){var r=0|t[se];if(4&r)return t;for(var n=0,i=0;n<t.length;n++){let o=e(t[n]);o!=null&&(t[i++]=o)}return i<n&&(t.length=i),ct(t,-12289&(5|r)),2&r&&Object.freeze(t),t}}function wt(e,t,r){return new ro(e,t,r)}function Cc(e,t,r){return new ro(e,t,r)}function St(e,t,r){lt(e,0|e[se],t,r)}function H1(e,t,r){if(t=(function(n){if(n==null)return n;let i=typeof n;if(i==="bigint")return String(s1(64,n));if(ru(n)){if(i==="string")return c1(n);if(i==="number")return a1(n)}})(t),t!=null&&(typeof t=="string"&&C0(t),t!=null))switch(kr(e,r,0),typeof t){case"number":e=e.g,eo(t),Xi(e,De,Ge);break;case"bigint":r=BigInt.asUintN(64,t),r=new Wd(Number(r&BigInt(4294967295)),Number(r>>BigInt(32))),Xi(e.g,r.i,r.g);break;default:r=C0(t),Xi(e.g,r.i,r.g)}}function W1(e,t,r){(t=Xn(t))!=null&&t!=null&&(kr(e,r,0),yc(e.g,t))}function $1(e,t,r){(t=t==null||typeof t=="boolean"?t:typeof t=="number"?!!t:void 0)!=null&&(kr(e,r,0),e.g.g.push(t?1:0))}function G1(e,t,r){(t=Sn(t))!=null&&_c(e,r,G0(t))}function q1(e,t,r,n,i){(t=z1(t,n))!=null&&(r=bc(e,r),i(t,e),vc(e,r))}function K1(e,t,r){(t=t==null||typeof t=="string"||hc(t)||t instanceof wn?t:void 0)!=null&&_c(e,r,uu(t).buffer)}var K_=wt((function(e,t,r){if(e.i!==1)return!1;var n=e.g;e=jd(n);let i=jd(n);n=2*(i>>31)+1;let o=i>>>20&2047;return e=4294967296*(1048575&i)+e,St(t,r,o==2047?e?NaN:n*(1/0):o==0?5e-324*n*e:n*Math.pow(2,o-1075)*(e+4503599627370496)),!0}),(function(e,t,r){(t=Qo(t))!=null&&(kr(e,r,1),e=e.g,(r=i1||=new DataView(new ArrayBuffer(8))).setFloat64(0,+t,!0),De=r.getUint32(0,!0),Ge=r.getUint32(4,!0),ic(e,De),ic(e,Ge))}),Er()),X1=wt((function(e,t,r){return e.i===5&&(St(t,r,Vd(e.g)),!0)}),(function(e,t,r){(t=Qo(t))!=null&&(kr(e,r,5),e=e.g,o1(t),ic(e,De))}),O1),X_=Cc((function(e,t,r){return(e.i===5||e.i===2)&&(t=es(t,0|t[se],r,!1,!1),e.i==2?gu(e,Vd,t):t.push(Vd(e.g)),!0)}),(function(e,t,r){if((t=Ec(Qo,t))!=null&&t.length){kr(e,r,2),ts(e.g,4*t.length);for(let n=0;n<t.length;n++)r=e.g,o1(t[n]),ic(r,De)}}),O1),oc=wt((function(e,t,r){return e.i===0&&(St(t,r,fu(e.g,eu)),!0)}),H1,D1),Bd=wt((function(e,t,r){return e.i===0&&(St(t,r,(e=fu(e.g,eu))===0?void 0:e),!0)}),H1,D1),J_=wt((function(e,t,r){return e.i===0&&(St(t,r,fu(e.g,Qd)),!0)}),(function(e,t,r){if((t=M_(t))!=null&&(typeof t=="string"&&E0(t),t!=null))switch(kr(e,r,0),typeof t){case"number":e=e.g,eo(t),Xi(e,De,Ge);break;case"bigint":r=BigInt.asUintN(64,t),r=new Hd(Number(r&BigInt(4294967295)),Number(r>>BigInt(32))),Xi(e.g,r.i,r.g);break;default:r=E0(t),Xi(e.g,r.i,r.g)}}),Er()),En=wt((function(e,t,r){return e.i===0&&(St(t,r,Bt(e.g)),!0)}),W1,vu),Cu=Cc((function(e,t,r){return(e.i===0||e.i===2)&&(t=es(t,0|t[se],r,!1,!1),e.i==2?gu(e,Bt,t):t.push(Bt(e.g)),!0)}),(function(e,t,r){if((t=Ec(Xn,t))!=null&&t.length){r=bc(e,r);for(let n=0;n<t.length;n++)yc(e.g,t[n]);vc(e,r)}}),vu),Gi=wt((function(e,t,r){return e.i===0&&(St(t,r,(e=Bt(e.g))===0?void 0:e),!0)}),W1,vu),Wt=wt((function(e,t,r){return e.i===0&&(St(t,r,pu(e.g)),!0)}),$1,P1),Ji=wt((function(e,t,r){return e.i===0&&(St(t,r,(e=pu(e.g))===!1?void 0:e),!0)}),$1,P1),sr=Cc((function(e,t,r){return e.i===2&&(e=mu(e),es(t,0|t[se],r,!1).push(e),!0)}),(function(e,t,r){if((t=Ec(Sn,t))!=null)for(let s=0;s<t.length;s++){var n=e,i=r,o=t[s];o!=null&&_c(n,i,G0(o))}}),bu),_n=wt((function(e,t,r){return e.i===2&&(St(t,r,(e=mu(e))===""?void 0:e),!0)}),G1,bu),Ze=wt((function(e,t,r){return e.i===2&&(St(t,r,mu(e)),!0)}),G1,bu),ar=(function(e,t,r=yu){return new ro(e,t,r)})((function(e,t,r,n,i){return e.i===2&&(n=qo(void 0,n,!0),es(t,0|t[se],r,!0).push(n),gc(e,n,i),!0)}),(function(e,t,r,n,i){if(Array.isArray(t))for(let o=0;o<t.length;o++)q1(e,t[o],r,n,i)})),ft=_u((function(e,t,r,n,i,o){return e.i===2&&(v1(t,0|t[se],o,r),gc(e,t=lu(t,n,r),i),!0)}),q1),J1=wt((function(e,t,r){return e.i===2&&(St(t,r,T1(e)),!0)}),K1,B1),Y_=wt((function(e,t,r){return e.i===0&&(St(t,r,(e=Bt(e.g)>>>0)===0?void 0:e),!0)}),(function(e,t,r){t=(function(n){if(n==null)return n;if(typeof n=="string"&&n)n=+n;else if(typeof n!="number")return;return pc(n)?n>>>0:void 0})(t),t!=null&&t!=null&&(kr(e,r,0),ts(e.g,t))}),Er()),Jn=wt((function(e,t,r){return e.i===0&&(St(t,r,Bt(e.g)),!0)}),(function(e,t,r){(t=Xn(t))!=null&&(t=parseInt(t,10),kr(e,r,0),yc(e.g,t))}),L1),sc=class{constructor(t,r){this.i=t,this.g=r,this.j=Sr,this.defaultValue=void 0}};function Y1(e,t){return(r,n)=>{if(Ja.length){let o=Ja.pop();o.o(n),Od(o.g,r,n),r=o}else r=new class{constructor(o,s){if(k0.length){let a=k0.pop();Od(a,o,s),o=a}else o=new class{constructor(a,c){this.i=null,this.m=!1,this.g=this.j=this.s=0,Od(this,a,c)}clear(){this.i=null,this.m=!1,this.g=this.j=this.s=0,this.C=!1}}(o,s);this.g=o,this.j=this.g.g,this.i=this.m=-1,this.o(s)}o({G:o=!1}={}){this.G=o}}(r,n);try{let o=new e,s=o.l;Eu(t)(s,r);var i=o}finally{r.g.clear(),r.m=-1,r.i=-1,Ja.length<100&&Ja.push(r)}return i}}var I0=[0,_n,wt((function(e,t,r){return e.i===2&&(St(t,r,(e=T1(e))===Zi()?void 0:e),!0)}),(function(e,t,r){if(t!=null){if(t instanceof Ue){let n=t.R;return void(n&&(t=n(t),t!=null&&_c(e,r,uu(t).buffer)))}if(Array.isArray(t))return}K1(e,t,r)}),B1)],Ld,R0=globalThis.trustedTypes;function P0(e){Ld===void 0&&(Ld=(function(){let r=null;if(!R0)return r;try{let n=i=>i;r=R0.createPolicy("goog#html",{createHTML:n,createScript:n,createScriptURL:n})}catch{}return r})());var t=Ld;return new class{constructor(r){this.g=r}toString(){return this.g+""}}(t?t.createScriptURL(e):e)}function Z_(e,...t){if(t.length===0)return P0(e[0]);let r=e[0];for(let n=0;n<t.length;n++)r+=encodeURIComponent(t[n])+e[n+1];return P0(r)}var Z1=[0,En,Jn,Wt,-1,Cu,Jn,-1],Q_=class extends Ue{constructor(e){super(e)}},Q1=[0,Wt,Ze,Wt,Jn,-1,Cc((function(e,t,r){return(e.i===0||e.i===2)&&(t=es(t,0|t[se],r,!1,!1),e.i==2?gu(e,j_,t):t.push(Bt(e.g)),!0)}),(function(e,t,r){if((t=Ec(Xn,t))!=null&&t.length){r=bc(e,r);for(let n=0;n<t.length;n++)yc(e.g,t[n]);vc(e,r)}}),L1),Ze,-1,[0,Wt,-1],Jn,Wt,-1],e2=[0,Ze,-2],D0=class extends Ue{constructor(e){super(e)}},t2=[0],r2=[0,En,Wt,1,Wt,-3],n2=class extends Ue{constructor(e){super(e,2)}},xc={};xc[336783863]=[0,Ze,Wt,-1,En,[0,[1,2,3,4,5,6,7,8],ft,t2,ft,Q1,ft,e2,ft,r2,ft,Z1,ft,[0,Ze,-2],ft,[0,Ze,Jn],ft,[0,Jn,Ze]],[0,Ze],Wt,[0,[1,3],[2,4],ft,[0,Cu],-1,ft,[0,sr],-1,ar,[0,Ze,-1]],Ze];var O0,B0=[0,Bd,-1,Ji,-3,Bd,Cu,_n,Gi,Bd,-1,Ji,Gi,Ji,-2,_n],xu=class extends Ue{constructor(e){super(e,500)}o(e){return Sr(this,0,7,e)}},Ko=[-1,{}],L0=[0,Ze,1,Ko],F0=[0,Ze,sr,Ko],Au=class extends Ue{constructor(e){super(e,500)}o(e){return Sr(this,0,1001,e)}};Au.prototype.g=(O0=[-500,ar,[-500,_n,-1,sr,-3,[-2,xc,Wt],ar,I0,Gi,-1,L0,F0,ar,[0,_n,Ji],_n,B0,Gi,sr,987,sr],4,ar,[-500,Ze,-1,[-1,{}],998,Ze],ar,[-500,Ze,sr,-1,[-2,{},Wt],997,sr,-1],Gi,ar,[-500,Ze,sr,Ko,998,sr],sr,Gi,L0,F0,ar,[0,_n,-1,Ko],sr,-2,B0,_n,-1,Ji,[0,Ji,Y_],978,Ko,ar,I0],function(){let e=new class{constructor(){this.j=[],this.i=0,this.g=new class{constructor(){this.g=[]}length(){return this.g.length}end(){let o=this.g;return this.g=[],o}}}};V1(this.l,e,Qn(wc,Sc,kc,O0)),to(e,e.g.end());let t=new Uint8Array(e.i),r=e.j,n=r.length,i=0;for(let o=0;o<n;o++){let s=r[o];t.set(s,i),i+=s.length}return e.j=[t],t});var e3=class extends Ue{constructor(e){super(e)}},t3=class extends Ue{constructor(e){super(e)}g(){return hu(this,e3)}},r3=[0,ar,[0,En,X1,Ze,-1]],M0=class extends Ue{constructor(e){super(e)}},U0=class extends Ue{constructor(e){super(e)}},i2=[1,2,3,4,5],ac=class extends Ue{constructor(e){super(e)}g(){return g1(this)!=null}i(){return Sn(_r(this,2))!=null}},cc=class extends Ue{constructor(e){super(e)}},o2=class extends Ue{constructor(e){super(e)}},s2=[0,[0,J1,Ze,[0,En,oc,-1],[0,J_,oc]],Wt,[0,i2,ft,r2,ft,Q1,ft,Z1,ft,t2,ft,e2],Jn],n3=new sc(451755788,o2);xc[451755788]=[0,s2,[0,Ze,En,X1,sr,-1],K_];var N0=class extends Ue{constructor(e){super(e)}},a2=class extends Ue{constructor(e){super(e)}},i3=new sc(487277289,a2);xc[487277289]=[0,s2,[0,Wt,-1]];var o3=class extends Ue{constructor(e){super(e)}},s3=Y1(class extends Ue{constructor(e){super(e)}},[0,ar,[0,1,En,Ze,r3],oc]),z0=class extends Ue{constructor(e){super(e)}},a3=class extends Ue{constructor(e){super(e)}J(){let e=g1(this);return e??Zi()}},c3=class extends Ue{constructor(e){super(e)}},c2=[1,2],j0=Y1(class extends Ue{constructor(e){super(e)}},[0,ar,[0,c2,ft,[0,X_],ft,[0,J1],En,Ze],oc]);function l3(){var e=navigator;return typeof OffscreenCanvas<"u"&&(!(function(t=navigator){return(t=t.userAgent).includes("Safari")&&!t.includes("Chrome")})(e)||!!((e=e.userAgent.match(/Version\/([\d]+).*Safari/))&&e.length>=1&&Number(e[1])>=17))}async function V0(e){if(typeof importScripts!="function"){let t=document.createElement("script");return t.src=e.toString(),t.crossOrigin="anonymous",new Promise(((r,n)=>{t.addEventListener("load",(()=>{r()}),!1),t.addEventListener("error",(i=>{n(i)}),!1),document.body.appendChild(t)}))}importScripts(e.toString())}function ie(e,t,r){e.m||console.error("No wasm multistream support detected: ensure dependency inclusion of :gl_graph_runner_internal_multi_input target"),r(t=e.h.stringToNewUTF8(t)),e.h._free(t)}function H0(e,t,r){e.m||console.error("No wasm multistream support detected: ensure dependency inclusion of :gl_graph_runner_internal_multi_input target");let n=new Uint32Array(t.length);for(let i=0;i<t.length;i++)n[i]=e.h.stringToNewUTF8(t[i]);t=e.h._malloc(4*n.length),e.h.HEAPU32.set(n,t>>2),r(t);for(let i of n)e.h._free(i);e.h._free(t)}function yn(e,t,r){e.h.simpleListeners=e.h.simpleListeners||{},e.h.simpleListeners[t]=r}function Gn(e,t,r){let n=[];e.h.simpleListeners=e.h.simpleListeners||{},e.h.simpleListeners[t]=(i,o,s)=>{o?(r(n,s),n=[]):n.push(i)}}var h3=(function(e){return class extends e{N(){this.h._registerModelResourcesGraphService()}}})(class{constructor(e,t){this.j=!0,this.h=e,this.g=null,this.i=0,this.m=typeof this.h._addIntToInputStream=="function",t!==void 0?this.h.canvas=t:l3()?this.h.canvas=new OffscreenCanvas(1,1):(console.warn("OffscreenCanvas not supported and GraphRunner constructor glCanvas parameter is undefined. Creating backup canvas."),this.h.canvas=document.createElement("canvas"))}async initializeGraph(e){let t=await(await fetch(e)).arrayBuffer();e=!(e.endsWith(".pbtxt")||e.endsWith(".textproto")),this.setGraph(new Uint8Array(t),e)}setGraphFromString(e){this.setGraph(new TextEncoder().encode(e),!1)}setGraph(e,t){let r=e.length,n=this.h._malloc(r);this.h.HEAPU8.set(e,n),t?this.h._changeBinaryGraph(r,n):this.h._changeTextGraph(r,n),this.h._free(n)}configureAudio(e,t,r,n,i){this.h._configureAudio||console.warn('Attempting to use configureAudio without support for input audio. Is build dep ":gl_graph_runner_audio" missing?'),ie(this,n||"input_audio",(o=>{ie(this,i=i||"audio_header",(s=>{this.h._configureAudio(o,s,e,t??0,r)}))}))}setAutoResizeCanvas(e){this.j=e}setAutoRenderToScreen(e){this.h._setAutoRenderToScreen(e)}setGpuBufferVerticalFlip(e){this.h.gpuOriginForWebTexturesIsBottomLeft=e}attachErrorListener(e){this.h.errorListener=e}attachEmptyPacketListener(e,t){this.h.emptyPacketListeners=this.h.emptyPacketListeners||{},this.h.emptyPacketListeners[e]=t}addAudioToStream(e,t,r){this.addAudioToStreamWithShape(e,0,0,t,r)}addAudioToStreamWithShape(e,t,r,n,i){let o=4*e.length;this.i!==o&&(this.g&&this.h._free(this.g),this.g=this.h._malloc(o),this.i=o),this.h.HEAPF32.set(e,this.g/4),ie(this,n,(s=>{this.h._addAudioToInputStream(this.g,t,r,s,i)}))}addGpuBufferToStream(e,t,r){ie(this,t,(n=>{if(!this.h.canvas)throw Error("No OpenGL canvas configured.");n?this.h._bindTextureToStream(n):this.h._bindTextureToCanvas();let i=this.h.canvas.getContext("webgl2")||this.h.canvas.getContext("webgl");if(!i)throw Error("Failed to obtain WebGL context from the provided canvas. `getContext()` should only be invoked with `webgl` or `webgl2`.");this.h.gpuOriginForWebTexturesIsBottomLeft&&i.pixelStorei(i.UNPACK_FLIP_Y_WEBGL,!0),i.texImage2D(i.TEXTURE_2D,0,i.RGBA,i.RGBA,i.UNSIGNED_BYTE,e),this.h.gpuOriginForWebTexturesIsBottomLeft&&i.pixelStorei(i.UNPACK_FLIP_Y_WEBGL,!1);let[o,s]=e.videoWidth!==void 0?[e.videoWidth,e.videoHeight]:e.naturalWidth!==void 0?[e.naturalWidth,e.naturalHeight]:e.displayWidth!==void 0?[e.displayWidth,e.displayHeight]:[e.width,e.height];!this.j||o===this.h.canvas.width&&s===this.h.canvas.height||(this.h.canvas.width=o,this.h.canvas.height=s);let[a,c]=[o,s];this.h._addBoundTextureToStream(n,a,c,r)}))}addBoolToStream(e,t,r){ie(this,t,(n=>{this.h._addBoolToInputStream(e,n,r)}))}addDoubleToStream(e,t,r){ie(this,t,(n=>{this.h._addDoubleToInputStream(e,n,r)}))}addFloatToStream(e,t,r){ie(this,t,(n=>{this.h._addFloatToInputStream(e,n,r)}))}addIntToStream(e,t,r){ie(this,t,(n=>{this.h._addIntToInputStream(e,n,r)}))}addUintToStream(e,t,r){ie(this,t,(n=>{this.h._addUintToInputStream(e,n,r)}))}addStringToStream(e,t,r){ie(this,t,(n=>{ie(this,e,(i=>{this.h._addStringToInputStream(i,n,r)}))}))}addStringRecordToStream(e,t,r){ie(this,t,(n=>{H0(this,Object.keys(e),(i=>{H0(this,Object.values(e),(o=>{this.h._addFlatHashMapToInputStream(i,o,Object.keys(e).length,n,r)}))}))}))}addProtoToStream(e,t,r,n){ie(this,r,(i=>{ie(this,t,(o=>{let s=this.h._malloc(e.length);this.h.HEAPU8.set(e,s),this.h._addProtoToInputStream(s,e.length,o,i,n),this.h._free(s)}))}))}addEmptyPacketToStream(e,t){ie(this,e,(r=>{this.h._addEmptyPacketToInputStream(r,t)}))}addBoolVectorToStream(e,t,r){ie(this,t,(n=>{let i=this.h._allocateBoolVector(e.length);if(!i)throw Error("Unable to allocate new bool vector on heap.");for(let o of e)this.h._addBoolVectorEntry(i,o);this.h._addBoolVectorToInputStream(i,n,r)}))}addDoubleVectorToStream(e,t,r){ie(this,t,(n=>{let i=this.h._allocateDoubleVector(e.length);if(!i)throw Error("Unable to allocate new double vector on heap.");for(let o of e)this.h._addDoubleVectorEntry(i,o);this.h._addDoubleVectorToInputStream(i,n,r)}))}addFloatVectorToStream(e,t,r){ie(this,t,(n=>{let i=this.h._allocateFloatVector(e.length);if(!i)throw Error("Unable to allocate new float vector on heap.");for(let o of e)this.h._addFloatVectorEntry(i,o);this.h._addFloatVectorToInputStream(i,n,r)}))}addIntVectorToStream(e,t,r){ie(this,t,(n=>{let i=this.h._allocateIntVector(e.length);if(!i)throw Error("Unable to allocate new int vector on heap.");for(let o of e)this.h._addIntVectorEntry(i,o);this.h._addIntVectorToInputStream(i,n,r)}))}addUintVectorToStream(e,t,r){ie(this,t,(n=>{let i=this.h._allocateUintVector(e.length);if(!i)throw Error("Unable to allocate new unsigned int vector on heap.");for(let o of e)this.h._addUintVectorEntry(i,o);this.h._addUintVectorToInputStream(i,n,r)}))}addStringVectorToStream(e,t,r){ie(this,t,(n=>{let i=this.h._allocateStringVector(e.length);if(!i)throw Error("Unable to allocate new string vector on heap.");for(let o of e)ie(this,o,(s=>{this.h._addStringVectorEntry(i,s)}));this.h._addStringVectorToInputStream(i,n,r)}))}addBoolToInputSidePacket(e,t){ie(this,t,(r=>{this.h._addBoolToInputSidePacket(e,r)}))}addDoubleToInputSidePacket(e,t){ie(this,t,(r=>{this.h._addDoubleToInputSidePacket(e,r)}))}addFloatToInputSidePacket(e,t){ie(this,t,(r=>{this.h._addFloatToInputSidePacket(e,r)}))}addIntToInputSidePacket(e,t){ie(this,t,(r=>{this.h._addIntToInputSidePacket(e,r)}))}addUintToInputSidePacket(e,t){ie(this,t,(r=>{this.h._addUintToInputSidePacket(e,r)}))}addStringToInputSidePacket(e,t){ie(this,t,(r=>{ie(this,e,(n=>{this.h._addStringToInputSidePacket(n,r)}))}))}addProtoToInputSidePacket(e,t,r){ie(this,r,(n=>{ie(this,t,(i=>{let o=this.h._malloc(e.length);this.h.HEAPU8.set(e,o),this.h._addProtoToInputSidePacket(o,e.length,i,n),this.h._free(o)}))}))}addBoolVectorToInputSidePacket(e,t){ie(this,t,(r=>{let n=this.h._allocateBoolVector(e.length);if(!n)throw Error("Unable to allocate new bool vector on heap.");for(let i of e)this.h._addBoolVectorEntry(n,i);this.h._addBoolVectorToInputSidePacket(n,r)}))}addDoubleVectorToInputSidePacket(e,t){ie(this,t,(r=>{let n=this.h._allocateDoubleVector(e.length);if(!n)throw Error("Unable to allocate new double vector on heap.");for(let i of e)this.h._addDoubleVectorEntry(n,i);this.h._addDoubleVectorToInputSidePacket(n,r)}))}addFloatVectorToInputSidePacket(e,t){ie(this,t,(r=>{let n=this.h._allocateFloatVector(e.length);if(!n)throw Error("Unable to allocate new float vector on heap.");for(let i of e)this.h._addFloatVectorEntry(n,i);this.h._addFloatVectorToInputSidePacket(n,r)}))}addIntVectorToInputSidePacket(e,t){ie(this,t,(r=>{let n=this.h._allocateIntVector(e.length);if(!n)throw Error("Unable to allocate new int vector on heap.");for(let i of e)this.h._addIntVectorEntry(n,i);this.h._addIntVectorToInputSidePacket(n,r)}))}addUintVectorToInputSidePacket(e,t){ie(this,t,(r=>{let n=this.h._allocateUintVector(e.length);if(!n)throw Error("Unable to allocate new unsigned int vector on heap.");for(let i of e)this.h._addUintVectorEntry(n,i);this.h._addUintVectorToInputSidePacket(n,r)}))}addStringVectorToInputSidePacket(e,t){ie(this,t,(r=>{let n=this.h._allocateStringVector(e.length);if(!n)throw Error("Unable to allocate new string vector on heap.");for(let i of e)ie(this,i,(o=>{this.h._addStringVectorEntry(n,o)}));this.h._addStringVectorToInputSidePacket(n,r)}))}attachBoolListener(e,t){yn(this,e,t),ie(this,e,(r=>{this.h._attachBoolListener(r)}))}attachBoolVectorListener(e,t){Gn(this,e,t),ie(this,e,(r=>{this.h._attachBoolVectorListener(r)}))}attachIntListener(e,t){yn(this,e,t),ie(this,e,(r=>{this.h._attachIntListener(r)}))}attachIntVectorListener(e,t){Gn(this,e,t),ie(this,e,(r=>{this.h._attachIntVectorListener(r)}))}attachUintListener(e,t){yn(this,e,t),ie(this,e,(r=>{this.h._attachUintListener(r)}))}attachUintVectorListener(e,t){Gn(this,e,t),ie(this,e,(r=>{this.h._attachUintVectorListener(r)}))}attachDoubleListener(e,t){yn(this,e,t),ie(this,e,(r=>{this.h._attachDoubleListener(r)}))}attachDoubleVectorListener(e,t){Gn(this,e,t),ie(this,e,(r=>{this.h._attachDoubleVectorListener(r)}))}attachFloatListener(e,t){yn(this,e,t),ie(this,e,(r=>{this.h._attachFloatListener(r)}))}attachFloatVectorListener(e,t){Gn(this,e,t),ie(this,e,(r=>{this.h._attachFloatVectorListener(r)}))}attachStringListener(e,t){yn(this,e,t),ie(this,e,(r=>{this.h._attachStringListener(r)}))}attachStringVectorListener(e,t){Gn(this,e,t),ie(this,e,(r=>{this.h._attachStringVectorListener(r)}))}attachProtoListener(e,t,r){yn(this,e,t),ie(this,e,(n=>{this.h._attachProtoListener(n,r||!1)}))}attachProtoVectorListener(e,t,r){Gn(this,e,t),ie(this,e,(n=>{this.h._attachProtoVectorListener(n,r||!1)}))}attachAudioListener(e,t,r){this.h._attachAudioListener||console.warn('Attempting to use attachAudioListener without support for output audio. Is build dep ":gl_graph_runner_audio_out" missing?'),yn(this,e,((n,i)=>{n=new Float32Array(n.buffer,n.byteOffset,n.length/4),t(n,i)})),ie(this,e,(n=>{this.h._attachAudioListener(n,r||!1)}))}finishProcessing(){this.h._waitUntilIdle()}closeGraph(){this.h._closeGraph(),this.h.simpleListeners=void 0,this.h.emptyPacketListeners=void 0}}),l2=class extends h3{};async function d3(e,t,r){return e=await(async(n,i,o,s)=>{if(i&&await V0(i),!self.ModuleFactory||o&&(await V0(o),!self.ModuleFactory))throw Error("ModuleFactory not set.");return self.Module&&s&&((i=self.Module).locateFile=s.locateFile,s.mainScriptUrlOrBlob&&(i.mainScriptUrlOrBlob=s.mainScriptUrlOrBlob)),s=await self.ModuleFactory(self.Module||s),self.ModuleFactory=self.Module=void 0,new n(s,null)})(e,t.wasmLoaderPath,t.assetLoaderPath,{locateFile:n=>n.endsWith(".wasm")?t.wasmBinaryPath.toString():t.assetBinaryPath&&n.endsWith(".data")?t.assetBinaryPath.toString():n}),await e.o(r),e}async function h2(e,t,r){return d3(e,t,r)}function Fd(e,t){let r=wr(e.baseOptions,ac,1)||new ac;typeof t=="string"?(pt(r,2,nc(t)),pt(r,1)):t instanceof Uint8Array&&(pt(r,1,r1(t,!1)),pt(r,2)),Sr(e.baseOptions,0,1,r)}function d2(e,t){let r=t.baseOptions||{};if(t.baseOptions?.modelAssetBuffer&&t.baseOptions?.modelAssetPath)throw Error("Cannot set both baseOptions.modelAssetPath and baseOptions.modelAssetBuffer");if(!(wr(e.baseOptions,ac,1)?.g()||wr(e.baseOptions,ac,1)?.i()||t.baseOptions?.modelAssetBuffer||t.baseOptions?.modelAssetPath))throw Error("Either baseOptions.modelAssetPath or baseOptions.modelAssetBuffer must be set");if((function(n,i){let o=wr(n.baseOptions,U0,3);if(!o){var s=o=new U0;Dd(s,4,new D0)}"delegate"in i&&(i.delegate==="GPU"?Dd(i=o,2,s=new Q_):Dd(i=o,4,s=new D0)),Sr(n.baseOptions,0,3,o)})(e,r),r.modelAssetPath)return fetch(r.modelAssetPath.toString()).then((n=>{if(n.ok)return n.arrayBuffer();throw Error(`Failed to fetch model: ${r.modelAssetPath} (${n.status})`)})).then((n=>{try{e.g.h.FS_unlink("/model.dat")}catch{}e.g.h.FS_createDataFile("/","model.dat",new Uint8Array(n),!0,!1,!1),Fd(e,"/model.dat"),e.v()}));if(r.modelAssetBuffer instanceof Uint8Array)Fd(e,r.modelAssetBuffer);else if(r.modelAssetBuffer)return(async function(n){let i=[];for(var o=0;;){let{done:s,value:a}=await n.read();if(s)break;i.push(a),o+=a.length}if(i.length===0)return new Uint8Array(0);if(i.length===1)return i[0];n=new Uint8Array(o),o=0;for(let s of i)n.set(s,o),o+=s.length;return n})(r.modelAssetBuffer).then((n=>{Fd(e,n),e.v()}));return e.v(),Promise.resolve()}function W0(e){try{let t=e.j.length;if(t===1)throw Error(e.j[0].message);if(t>1)throw Error("Encountered multiple errors: "+e.j.map((r=>r.message)).join(", "))}finally{e.j=[]}}function qi(e,t){e.s=Math.max(e.s,t)}var Qa=class{constructor(e){this.g=e,this.j=[],this.s=0,this.g.setAutoRenderToScreen(!1)}setGraph(e,t){this.g.attachErrorListener(((r,n)=>{this.j.push(Error(n))})),this.g.N(),this.g.setGraph(e,t),W0(this)}finishProcessing(){this.g.finishProcessing(),W0(this)}close(){this.g.closeGraph()}};async function Xo(e,t,r){return h2(e,t,r)}Qa.prototype.close=Qa.prototype.close,(function(e,t){e=e.split(".");var r,n=Kn;for((e[0]in n)||n.execScript===void 0||n.execScript("var "+e[0]);e.length&&(r=e.shift());)e.length||t===void 0?n=n[r]&&n[r]!==Object.prototype[r]?n[r]:n[r]={}:n[r]=t})("TaskRunner",Qa);var lc=class extends Qa{constructor(){super(...arguments),this.F=48e3}O(e){this.F=e}};function u3(e){let t={classifications:hu(e,o3).map((r=>(function(n,i=-1,o=""){return{categories:n.map((s=>{var a=Xn(_r(s,1))??0??-1;let c=s.l,l=0|c[se],h=Zn(c,l,2),d=Qo(h);return d!=null&&d!==h&&lt(c,l,2,d),{index:a,score:d??0??0,categoryName:Sn(_r(s,3))??""??"",displayName:Sn(_r(s,4))??""??""}})),headIndex:i,headName:o}})(wr(r,t3,4)?.g()??[],Xn(_r(r,2))??0,Sn(_r(r,3))??"")))};return zd(_r(e,2))!=null&&(t.timestampMs=zd(_r(e,2))??0),t}lc.prototype.setDefaultSampleRate=lc.prototype.O;var or=class extends lc{constructor(e,t){super(new l2(e,t)),this.m=[],Sr(e=this.i=new o2,0,1,t=new cc)}get baseOptions(){return wr(this.i,cc,1)}set baseOptions(e){Sr(this.i,0,1,e)}o(e){var t=this.i,r=wr(this.i,M0,2);if(r=r?m1(r):new M0,e.displayNamesLocale!==void 0?pt(r,1,nc(e.displayNamesLocale)):e.displayNamesLocale===void 0&&pt(r,1),e.maxResults!==void 0){var n=e.maxResults;if(n!=null){if(typeof n!="number"||!pc(n))throw p0();n|=0}pt(r,2,n)}else"maxResults"in e&&pt(r,2);if(e.scoreThreshold!==void 0){if((n=e.scoreThreshold)!=null&&typeof n!="number")throw Error(`Value of float/double field must be a number, found ${typeof n}: ${n}`);pt(r,3,n)}else"scoreThreshold"in e&&pt(r,3);return e.categoryAllowlist!==void 0?S0(r,4,e.categoryAllowlist):"categoryAllowlist"in e&&pt(r,4),e.categoryDenylist!==void 0?S0(r,5,e.categoryDenylist):"categoryDenylist"in e&&pt(r,5),Sr(t,0,2,r),d2(this,e)}K(e,t){return this.D(e,t??this.F,this.s+1)}D(e,t,r){return this.g.addDoubleToStream(t,"sample_rate",r),this.g.addAudioToStreamWithShape(e,1,e.length,"audio_in",r),this.m=[],this.finishProcessing(),[...this.m]}v(){var e=new Au;Ot(e,10,"audio_in"),Ot(e,10,"sample_rate"),Ot(e,15,"timestamped_classifications");let t=new n2;I1(t,n3,this.i);let r=new xu;b1(r,nc("mediapipe.tasks.audio.audio_classifier.AudioClassifierGraph")),Ot(r,3,"AUDIO:audio_in"),Ot(r,3,"SAMPLE_RATE:sample_rate"),Ot(r,4,"TIMESTAMPED_CLASSIFICATIONS:timestamped_classifications"),r.o(t),S1(e,r),this.g.attachProtoVectorListener("timestamped_classifications",((n,i)=>{(function(o,s){s.forEach((a=>{a=s3(a),o.m.push(u3(a))}))})(this,n),qi(this,i)})),this.g.attachEmptyPacketListener("timestamped_classifications",(n=>{qi(this,n)})),e=e.g(),this.setGraph(new Uint8Array(e),!0)}};function $0(e){return{embeddings:hu(e,c3).map((t=>{let r={headIndex:Xn(_r(t,3))??0??-1,headName:Sn(_r(t,4))??""??""};if(_1(t,z0,Pd(t,1))!==void 0)r.floatEmbedding=y1(wr(t,z0,Pd(t,1)),1,Qo,n1===void 0?2:4).slice();else{let n=new Uint8Array(0);r.quantizedEmbedding=wr(t,a3,Pd(t,2))?.J()?.i()??n}return r})),timestampMs:zd(_r(e,2))??0}}or.prototype.classify=or.prototype.K,or.prototype.setOptions=or.prototype.o,or.createFromModelPath=function(e,t){return h2(or,e,{baseOptions:{modelAssetPath:t}})},or.createFromModelBuffer=function(e,t){return Xo(or,e,{baseOptions:{modelAssetBuffer:t}})},or.createFromOptions=function(e,t){return Xo(or,e,t)};var Mr=class extends lc{constructor(e,t){super(new l2(e,t)),this.m=[],Sr(e=this.i=new a2,0,1,t=new cc)}get baseOptions(){return wr(this.i,cc,1)}set baseOptions(e){Sr(this.i,0,1,e)}o(e){var t=this.i,r=wr(this.i,N0,2);return r=r?m1(r):new N0,e.l2Normalize!==void 0?pt(r,1,_0(e.l2Normalize)):"l2Normalize"in e&&pt(r,1),e.quantize!==void 0?pt(r,2,_0(e.quantize)):"quantize"in e&&pt(r,2),Sr(t,0,2,r),d2(this,e)}L(e,t){return this.D(e,t??this.F,this.s+1)}D(e,t,r){return this.g.addDoubleToStream(t,"sample_rate",r),this.g.addAudioToStreamWithShape(e,1,e.length,"audio_in",r),this.m=[],this.finishProcessing(),this.m}v(){var e=new Au;Ot(e,10,"audio_in"),Ot(e,10,"sample_rate"),Ot(e,15,"embeddings_out"),Ot(e,15,"timestamped_embeddings_out");let t=new n2;I1(t,i3,this.i);let r=new xu;b1(r,nc("mediapipe.tasks.audio.audio_embedder.AudioEmbedderGraph")),Ot(r,3,"AUDIO:audio_in"),Ot(r,3,"SAMPLE_RATE:sample_rate"),Ot(r,4,"EMBEDDINGS:embeddings_out"),Ot(r,4,"TIMESTAMPED_EMBEDDINGS:timestamped_embeddings_out"),r.o(t),S1(e,r),this.g.attachProtoListener("embeddings_out",((n,i)=>{n=j0(n),this.m.push($0(n)),qi(this,i)})),this.g.attachEmptyPacketListener("embeddings_out",(n=>{qi(this,n)})),this.g.attachProtoVectorListener("timestamped_embeddings_out",((n,i)=>{for(let o of n)n=j0(o),this.m.push($0(n));qi(this,i)})),this.g.attachEmptyPacketListener("timestamped_embeddings_out",(n=>{qi(this,n)})),e=e.g(),this.setGraph(new Uint8Array(e),!0)}},Ya;Mr.prototype.embed=Mr.prototype.L,Mr.prototype.setOptions=Mr.prototype.o,Mr.createFromModelPath=function(e,t){return Xo(Mr,e,{baseOptions:{modelAssetPath:t}})},Mr.createFromModelBuffer=function(e,t){return Xo(Mr,e,{baseOptions:{modelAssetBuffer:t}})},Mr.createFromOptions=function(e,t){return Xo(Mr,e,t)};var f3=new Uint8Array([0,97,115,109,1,0,0,0,1,5,1,96,0,1,123,3,2,1,0,10,10,1,8,0,65,0,253,15,253,98,11]);async function u2(){if(Ya===void 0)try{await WebAssembly.instantiate(f3),Ya=!0}catch{Ya=!1}return Ya}async function Wo(e,t=Z_``){let r=await u2()?"wasm_internal":"wasm_nosimd_internal";return{wasmLoaderPath:`${t}/${e}_${r}.js`,wasmBinaryPath:`${t}/${e}_${r}.wasm`}}var bn=class{};bn.forVisionTasks=function(e){return Wo("vision",e)},bn.forTextTasks=function(e){return Wo("text",e)},bn.forGenAiExperimentalTasks=function(e){return Wo("genai_experimental",e)},bn.forGenAiTasks=function(e){return Wo("genai",e)},bn.forAudioTasks=function(e){return Wo("audio",e)},bn.isSimdSupported=function(){return u2()};function p3(e,t){let r=e.reduce((a,c)=>a+c.length,0),n=new ArrayBuffer(44+r*2),i=new DataView(n),o=(a,c,l)=>{for(let h=0;h<l.length;h++)a.setUint8(c+h,l.charCodeAt(h))};o(i,0,"RIFF"),i.setUint32(4,36+r*2,!0),o(i,8,"WAVE"),o(i,12,"fmt "),i.setUint32(16,16,!0),i.setUint16(20,1,!0),i.setUint16(22,1,!0),i.setUint32(24,t,!0),i.setUint32(28,t*2,!0),i.setUint16(32,2,!0),i.setUint16(34,16,!0),o(i,36,"data"),i.setUint32(40,r*2,!0);let s=44;for(let a of e)for(let c=0;c<a.length;c++){let l=Math.max(-1,Math.min(1,a[c]));i.setInt16(s,l<0?l*32768:l*32767,!0),s+=2}return new Blob([i],{type:"audio/wav"})}var Ac=class{constructor(t,r,n,i,o,s,a){this.recordingInProgress=!1;this.recordIndex=1;this.countLoopTimes=0;this.examStartTime=0;this.recordingStartTime=0;this.recordingEndTime=0;this.isSpeech=!1;this.preRollBuffer=[];this.recordingChunks=[];this.PRE_ROLL_SECONDS=2;this.SAMPLE_RATE=16e3;this.MAX_PRE_ROLL_CHUNKS=4;this.lastNoiseTime=0;this.SILENCE_THRESHOLD=3e3;this.optionsProctoring=t,this.proctoringSession=r,this.paramsConfig=n,this.cameraRecorder=i,this.onRealtimeAlertsCallback=o,this.backend=s,this.backendToken=a}setProctoringId(t){this.proctoringId=t,this.proctoringId&&this.backend&&(this.upload=new Yr(this.proctoringId,this.backend))}async startRecording(){this.examStartTime=Date.now(),await this.createAudioClassifier(),this.audioRecorder=new Ga(void 0,this.paramsConfig.audioBehaviourParameters),this.intervalNoiseDetection=setInterval(()=>this.onNoiseDetectedRecord(),200),this.streamingAudioClassification()}async stopRecording(){clearInterval(this.intervalNoiseDetection),await this.stopSoundRecord(),await this.volumeMeter&&this.volumeMeter.stop(),this.audioWorkletNode&&this.audioWorkletNode.disconnect()}async pauseRecording(){}async resumeRecording(){}async saveOnSession(t){}async onNoiseDetectedRecord(){!this.volumeMeter&&this.cameraRecorder.cameraStream&&(this.volumeMeter=new gn(this.cameraRecorder.cameraStream),this.volumeMeter.start().catch(i=>{console.log(i),this.volumeMeter=void 0}));let t=this.paramsConfig.audioBehaviourParameters?.noiseLimit||40,r=this.volumeMeter?.getVolume()||0;this.isSpeech=this.isSpeech||this.hasDesiredResult(this.audioClassificationResult),!this.isSpeech&&!this.recordingInProgress&&(t=t*1.25);let n=r>=t;if(n&&(this.lastNoiseTime=Date.now()),n&&!this.recordingInProgress){this.recordingInProgress=!0,this.recordingChunks=[...this.preRollBuffer];let o=this.preRollBuffer.reduce((a,c)=>a+c.length,0)/this.SAMPLE_RATE*1e3,s=Date.now()-this.examStartTime;this.recordingStartTime=s-o,this.recordingStartTime<0&&(this.recordingStartTime=0)}else if(this.recordingInProgress){let i=Date.now()-this.lastNoiseTime,o=Date.now()-this.recordingStartTime;i>=this.SILENCE_THRESHOLD&&o>=3e3&&this.countLoopTimes>4&&(await this.stopSoundRecord(),this.paramsConfig.videoBehaviourParameters?.detectNoise&&!this.isSpeech&&this.onRealtimeAlertsCallback({status:"ALERT",description:"Barulho detectado",type:"audio_detection_on_stream"}),this.paramsConfig.videoBehaviourParameters?.detectSpeech&&this.isSpeech&&this.onRealtimeAlertsCallback({status:"ALERT",description:"Fala detectada",type:"audio_detection_on_stream"}),this.recordingInProgress=!1,this.recordIndex++,this.countLoopTimes=0,this.isSpeech=!1),this.countLoopTimes++}}async stopSoundRecord(){if(!this.recordingInProgress&&this.recordingChunks.length===0||(this.recordingEndTime=Date.now()-this.examStartTime,this.optionsProctoring.proctoringType!=="REALTIME"))return;let t=p3(this.recordingChunks,this.SAMPLE_RATE),r=new File([t],`EP_${this.proctoringSession.id}_${this.recordingStartTime}_${this.recordingEndTime}_${this.isSpeech?"speech":"noise"}.wav`,{type:"audio/wav"});this.uploadRecord(r),this.recordingChunks=[],this.recordingInProgress=!1}download(t){let r=URL.createObjectURL(t),n=document.createElement("a");document.body.appendChild(n),n.style.display="none",n.href=r,n.download=t.name,n.click(),window.URL.revokeObjectURL(r)}uploadRecord(t){t&&this.upload&&this.backendToken&&this.upload.upload({file:t},this.backendToken)}hasDesiredResult(t){if(t==null)return!1;for(let r of t){let n=r.name.toLowerCase().includes("speech");if(this.optionsProctoring.proctoringType!=="REALTIME")return n;let i=parseFloat(r.score)>.22;if(n&&i)return!0}return!1}async createAudioClassifier(){let t=await bn.forAudioTasks("https://cdn.jsdelivr.net/npm/@mediapipe/tasks-audio@0.10.0/wasm");this.audioClassifier=await or.createFromOptions(t,{scoreThreshold:.15,maxResults:1,baseOptions:{modelAssetPath:"https://storage.googleapis.com/mediapipe-models/audio_classifier/yamnet/float32/1/yamnet.tflite"}})}async streamingAudioClassification(){this.context=new AudioContext({sampleRate:this.SAMPLE_RATE});try{await this.context.audioWorklet.addModule(URL.createObjectURL(new Blob([m3],{type:"text/javascript"})))}catch{throw new Error("\u274C Error loading audio worklet module")}let t=this.context.createMediaStreamSource(this.cameraRecorder.cameraStream);this.audioWorkletNode=new AudioWorkletNode(this.context,"audio-processor"),this.audioWorkletNode.port.onmessage=r=>{let n=r.data;this.preRollBuffer.push(n),this.preRollBuffer.length>this.MAX_PRE_ROLL_CHUNKS&&this.preRollBuffer.shift(),this.recordingInProgress&&this.recordingChunks.push(n);let o=this.audioClassifier.classify(n)[0].classifications[0].categories;o.length>0&&(this.audioClassificationResult=[{name:o[0].categoryName,score:o[0].score.toFixed(3)}])},t.connect(this.audioWorkletNode),this.audioWorkletNode.connect(this.context.destination)}},m3=`
437
+ Size: ${t.file.size}`,s),o}}throw new Error("Could not upload")}};var $a=class{constructor(t,r){this.alerts=[];this.lastActivityTime=Date.now();this.IDLE_THRESHOLD_MS=3e4;this.handleVisibilityChange=()=>{document.visibilityState==="visible"?this.handleReturnFocus():this.handleLostFocus()};this.handleLostFocus=()=>{if(this.getRelativeTime()>1e4){let t={begin:this.getRelativeTime(),end:0,alert:25,type:3};this.onLostFocusCallback(t),this.alerts.push(t)}};this.handleReturnFocus=()=>{let t=this.alerts[this.alerts.length-1];t&&(this.onFocusCallback({begin:t.begin,end:this.getRelativeTime(),alert:25,type:3}),t.end=this.getRelativeTime())};this.handleResize=()=>{clearTimeout(this.resizeTimeout),this.resizeTimeout=setTimeout(()=>{let t=window.screen.availWidth,r=window.outerWidth;if(r<t*.85){let n=`Split Screen Detectado: Janela ocupa ${(r/t*100).toFixed(0)}% da tela`;this.createAlert(43,3,n),this.onRealtimeAlertCallback&&this.onRealtimeAlertCallback({status:"ALERT",description:n,type:"split_screen"})}},1e3)};this.handleUserActivity=t=>{this.lastActivityTime=Date.now(),console.log("\u{1F449} handleUserActivity",t)};this.handleCopy=t=>{t.preventDefault();let r="Tentativa de Copiar (Clipboard)";this.createAlert(42,3,r),this.onRealtimeAlertCallback&&this.onRealtimeAlertCallback({status:"ALERT",description:r,type:"clipboard_copy"})};this.handleCut=t=>{t.preventDefault();let r="Tentativa de Recortar (Clipboard)";this.createAlert(42,3,r),this.onRealtimeAlertCallback&&this.onRealtimeAlertCallback({status:"ALERT",description:r,type:"clipboard_cut"})};this.handlePaste=t=>{t.preventDefault();let r="Tentativa de Colar (Clipboard)";this.createAlert(42,3,r),this.onRealtimeAlertCallback&&this.onRealtimeAlertCallback({status:"ALERT",description:r,type:"clipboard_paste"})};this.onLostFocusCallback=t.onLostFocusCallback,this.onFocusCallback=t.onFocusCallback,this.onRealtimeAlertCallback=t.onRealtimeAlertCallback,this.optionsProctoring=r}async startRecording(){this.startTime=new Date(Date.now()),this.alerts=[],this.attachListeners()}async pauseRecording(){this.detachListeners()}async resumeRecording(){this.attachListeners()}async stopRecording(){this.detachListeners()}async saveOnSession(t){this.alerts.forEach(r=>{t.addAlert(r)})}attachListeners(){this.optionsProctoring.captureScreen&&(window.addEventListener("visibilitychange",this.handleVisibilityChange),window.addEventListener("resize",this.handleResize),window.document.addEventListener("copy",this.handleCopy),window.document.addEventListener("cut",this.handleCut),window.document.addEventListener("paste",this.handlePaste))}detachListeners(){window.removeEventListener("visibilitychange",this.handleVisibilityChange),window.removeEventListener("resize",this.handleResize),window.document.removeEventListener("copy",this.handleCopy),window.document.removeEventListener("cut",this.handleCut),window.document.removeEventListener("paste",this.handlePaste)}addBackgroundEvent(t,r=200){this.createAlert(r,3,t),this.onRealtimeAlertCallback&&this.onRealtimeAlertCallback({status:"ALERT",description:t,type:"background_event"})}getRelativeTime(){return Date.now()-this.startTime.getTime()}createAlert(t,r,n){this.alerts.push({begin:this.getRelativeTime(),end:this.getRelativeTime(),alert:t,type:r})}addAlert({alert:t,type:r}){this.alerts.push({begin:Date.now()-this.startTime.getTime(),end:Date.now()-this.startTime.getTime(),alert:t,type:r})}};var Ga=class{constructor(t,r){this.blobs=[];this.options={cameraId:void 0,microphoneId:void 0};this.audioParams={recordingBitrate:128};r&&(this.audioParams=r),t&&(this.options=t)}async startRecording(){let t={audio:{deviceId:this.options.microphoneId||"default"}};this.audioStream=await navigator.mediaDevices.getUserMedia(t);let{startRecording:r,stopRecording:n,pauseRecording:i,resumeRecording:o}=Wn(this.audioStream,this.blobs,null,void 0,void 0,!0);this.recordingStart=r,this.recordingStop=n,this.recordingPause=i,this.recordingResume=o,this.recordingStart()}async pauseRecording(){}async resumeRecording(){}async stopRecording(){this.recordingStop&&await this.recordingStop()}async saveOnSession(t,r,n){t.addRecording({device:"",file:new File(this.blobs,`EP_${t.id}_audio_${r&&n&&`${r}_${n}`||"0"}.webm`,{type:"audio/webm"}),origin:"Mic"})}};var Kn=typeof self<"u"?self:{};function $n(){throw Error("Invalid UTF8")}function l0(e,t){return t=String.fromCharCode.apply(null,t),e==null?t:e+t}var qa,Ad,y_=typeof TextDecoder<"u",b_,v_=typeof TextEncoder<"u";function G0(e){if(v_)e=(b_||=new TextEncoder).encode(e);else{let r=0,n=new Uint8Array(3*e.length);for(let i=0;i<e.length;i++){var t=e.charCodeAt(i);if(t<128)n[r++]=t;else{if(t<2048)n[r++]=t>>6|192;else{if(t>=55296&&t<=57343){if(t<=56319&&i<e.length){let o=e.charCodeAt(++i);if(o>=56320&&o<=57343){t=1024*(t-55296)+o-56320+65536,n[r++]=t>>18|240,n[r++]=t>>12&63|128,n[r++]=t>>6&63|128,n[r++]=63&t|128;continue}i--}t=65533}n[r++]=t>>12|224,n[r++]=t>>6&63|128}n[r++]=63&t|128}}e=r===n.length?n:n.subarray(0,r)}return e}var $d,ec;e:{for(Td=["CLOSURE_FLAGS"],Ka=Kn,Xa=0;Xa<Td.length;Xa++)if((Ka=Ka[Td[Xa]])==null){ec=null;break e}ec=Ka}var Td,Ka,Xa,Jo,h0=ec&&ec[610401301];$d=h0!=null&&h0;var d0=Kn.navigator;function Md(e){return!!$d&&!!Jo&&Jo.brands.some((({brand:t})=>t&&t.indexOf(e)!=-1))}function cr(e){var t;return(t=Kn.navigator)&&(t=t.userAgent)||(t=""),t.indexOf(e)!=-1}function vn(){return!!$d&&!!Jo&&Jo.brands.length>0}function Id(){return vn()?Md("Chromium"):(cr("Chrome")||cr("CriOS"))&&!(!vn()&&cr("Edge"))||cr("Silk")}Jo=d0&&d0.userAgentData||null;var __=!vn()&&(cr("Trident")||cr("MSIE"));!cr("Android")||Id(),Id(),cr("Safari")&&(Id()||!vn()&&cr("Coast")||!vn()&&cr("Opera")||!vn()&&cr("Edge")||(vn()?Md("Microsoft Edge"):cr("Edg/"))||vn()&&Md("Opera"));var q0={},$o=null;function w_(e){let t=e.length,r=3*t/4;r%3?r=Math.floor(r):"=.".indexOf(e[t-1])!=-1&&(r="=.".indexOf(e[t-2])!=-1?r-2:r-1);let n=new Uint8Array(r),i=0;return(function(o,s){function a(l){for(;c<o.length;){let h=o.charAt(c++),d=$o[h];if(d!=null)return d;if(!/^[\s\xa0]*$/.test(h))throw Error("Unknown base64 encoding at char: "+h)}return l}K0();let c=0;for(;;){let l=a(-1),h=a(0),d=a(64),m=a(64);if(m===64&&l===-1)break;s(l<<2|h>>4),d!=64&&(s(h<<4&240|d>>2),m!=64&&s(d<<6&192|m))}})(e,(function(o){n[i++]=o})),i!==r?n.subarray(0,i):n}function K0(){if(!$o){$o={};var e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789".split(""),t=["+/=","+/","-_=","-_.","-_"];for(let r=0;r<5;r++){let n=e.concat(t[r].split(""));q0[r]=n;for(let i=0;i<n.length;i++){let o=n[i];$o[o]===void 0&&($o[o]=i)}}}}var X0=typeof Uint8Array<"u",J0=!__&&typeof btoa=="function";function u0(e){if(!J0){var t;t===void 0&&(t=0),K0(),t=q0[t];var r=Array(Math.floor(e.length/3)),n=t[64]||"";let c=0,l=0;for(;c<e.length-2;c+=3){var i=e[c],o=e[c+1],s=e[c+2],a=t[i>>2];i=t[(3&i)<<4|o>>4],o=t[(15&o)<<2|s>>6],s=t[63&s],r[l++]=a+i+o+s}switch(a=0,s=n,e.length-c){case 2:s=t[(15&(a=e[c+1]))<<2]||n;case 1:e=e[c],r[l]=t[e>>2]+t[(3&e)<<4|a>>4]+s+n}return r.join("")}for(t="",r=0,n=e.length-10240;r<n;)t+=String.fromCharCode.apply(null,e.subarray(r,r+=10240));return t+=String.fromCharCode.apply(null,r?e.subarray(r):e),btoa(t)}var f0=/[-_.]/g,S_={"-":"+",_:"/",".":"="};function k_(e){return S_[e]||""}function Y0(e){if(!J0)return w_(e);f0.test(e)&&(e=e.replace(f0,k_)),e=atob(e);let t=new Uint8Array(e.length);for(let r=0;r<e.length;r++)t[r]=e.charCodeAt(r);return t}function hc(e){return X0&&e!=null&&e instanceof Uint8Array}var Yi={};function Zi(){return E_||=new wn(null,Yi)}function Gd(e){Z0(Yi);var t=e.g;return(t=t==null||hc(t)?t:typeof t=="string"?Y0(t):null)==null?t:e.g=t}var wn=class{i(){return new Uint8Array(Gd(this)||0)}constructor(e,t){if(Z0(t),this.g=e,e!=null&&e.length===0)throw Error("ByteString should be constructed with non-empty values")}},E_,C_;function Z0(e){if(e!==Yi)throw Error("illegal external caller")}function Q0(e,t){e.__closure__error__context__984382||(e.__closure__error__context__984382={}),e.__closure__error__context__984382.severity=t}function p0(){let e=Error("int32");return Q0(e,"warning"),e}var dc=typeof Symbol=="function"&&typeof Symbol()=="symbol",x_=new Set;function uc(e,t,r=!1,n=!1){return e=typeof Symbol=="function"&&typeof Symbol()=="symbol"?n&&Symbol.for&&e?Symbol.for(e):e!=null?Symbol(e):Symbol():t,r&&x_.add(e),e}var A_=uc("jas",void 0,!0,!0),Rd=uc(void 0,"2ex"),Ho=uc(void 0,"1oa",!0),Qi=uc(void 0,Symbol(),!0),se=dc?A_:"M",e1={M:{value:0,configurable:!0,writable:!0,enumerable:!1}},t1=Object.defineProperties;function qd(e,t){dc||se in e||t1(e,e1),e[se]|=t}function ct(e,t){dc||se in e||t1(e,e1),e[se]=t}function T_(e,t){ct(t,-30975&(0|e))}function Ud(e,t){ct(t,-30941&(34|e))}function Kd(){return typeof BigInt=="function"}function lr(e){return Array.prototype.slice.call(e)}var Xd,Zo={},I_={};function m0(e){return!(!e||typeof e!="object"||e.g!==I_)}function Jd(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)&&e.constructor===Object}function r1(e,t){if(e!=null){if(typeof e=="string")e=e?new wn(e,Yi):Zi();else if(e.constructor!==wn)if(hc(e))e=e.length?new wn(new Uint8Array(e),Yi):Zi();else{if(!t)throw Error();e=void 0}}return e}function tc(e){return!(!Array.isArray(e)||e.length)&&!!(1&(0|e[se]))}var g0=[];function Yn(e){if(2&e)throw Error()}function Yd(e){return Qi?e[Qi]:void 0}ct(g0,55),Xd=Object.freeze(g0);var n1=Object.freeze({}),Zd=typeof Kn.BigInt=="function"&&typeof Kn.BigInt(0)=="bigint",Nd=e=>Zd?e>=P_&&e<=O_:e[0]==="-"?y0(e,R_):y0(e,D_),R_=Number.MIN_SAFE_INTEGER.toString(),P_=Zd?BigInt(Number.MIN_SAFE_INTEGER):void 0,D_=Number.MAX_SAFE_INTEGER.toString(),O_=Zd?BigInt(Number.MAX_SAFE_INTEGER):void 0;function y0(e,t){if(e.length>t.length)return!1;if(e.length<t.length||e===t)return!0;for(let r=0;r<e.length;r++){let n=e[r],i=t[r];if(n>i)return!1;if(n<i)return!0}}var B_=typeof Uint8Array.prototype.slice=="function",i1,De=0,Ge=0;function b0(e){let t=e>>>0;De=t,Ge=(e-t)/4294967296>>>0}function eo(e){if(e<0){b0(-e);let[t,r]=tu(De,Ge);De=t>>>0,Ge=r>>>0}else b0(e)}function o1(e){let t=i1||=new DataView(new ArrayBuffer(8));t.setFloat32(0,+e,!0),Ge=0,De=t.getUint32(0,!0)}function Qd(e,t){let r=4294967296*t+(e>>>0);return Number.isSafeInteger(r)?r:Yo(e,t)}function eu(e,t){let r=2147483648&t;return r&&(t=~t>>>0,(e=1+~e>>>0)==0&&(t=t+1>>>0)),typeof(e=Qd(e,t))=="number"?r?-e:e:r?"-"+e:e}function Yo(e,t){if(e>>>=0,(t>>>=0)<=2097151)var r=""+(4294967296*t+e);else Kd()?r=""+(BigInt(t)<<BigInt(32)|BigInt(e)):(e=(16777215&e)+6777216*(r=16777215&(e>>>24|t<<8))+6710656*(t=t>>16&65535),r+=8147497*t,t*=2,e>=1e7&&(r+=e/1e7>>>0,e%=1e7),r>=1e7&&(t+=r/1e7>>>0,r%=1e7),r=t+v0(r)+v0(e));return r}function v0(e){return e=String(e),"0000000".slice(e.length)+e}function fc(e){if(e.length<16)eo(Number(e));else if(Kd())e=BigInt(e),De=Number(e&BigInt(4294967295))>>>0,Ge=Number(e>>BigInt(32)&BigInt(4294967295));else{let t=+(e[0]==="-");Ge=De=0;let r=e.length;for(let n=t,i=(r-t)%6+t;i<=r;n=i,i+=6){let o=Number(e.slice(n,i));Ge*=1e6,De=1e6*De+o,De>=4294967296&&(Ge+=Math.trunc(De/4294967296),Ge>>>=0,De>>>=0)}if(t){let[n,i]=tu(De,Ge);De=n,Ge=i}}}function tu(e,t){return t=~t,e?e=1+~e:t+=1,[e,t]}var s1=typeof BigInt=="function"?BigInt.asIntN:void 0,L_=typeof BigInt=="function"?BigInt.asUintN:void 0,Go=Number.isSafeInteger,pc=Number.isFinite,rc=Math.trunc;function Qo(e){return e==null||typeof e=="number"?e:e==="NaN"||e==="Infinity"||e==="-Infinity"?Number(e):void 0}function _0(e){if(e!=null&&typeof e!="boolean"){var t=typeof e;throw Error(`Expected boolean but got ${t!="object"?t:e?Array.isArray(e)?"array":t:"null"}: ${e}`)}return e}var F_=/^-?([1-9][0-9]*|0)(\.[0-9]+)?$/;function ru(e){switch(typeof e){case"bigint":return!0;case"number":return pc(e);case"string":return F_.test(e);default:return!1}}function Xn(e){if(e==null)return e;if(typeof e=="string"&&e)e=+e;else if(typeof e!="number")return;return pc(e)?0|e:void 0}function w0(e){if(e[0]==="-")return!1;let t=e.length;return t<20||t===20&&Number(e.substring(0,6))<184467}function a1(e){return e=rc(e),Go(e)||(eo(e),e=eu(De,Ge)),e}function c1(e){var t=rc(Number(e));if(Go(t))return String(t);if((t=e.indexOf("."))!==-1&&(e=e.substring(0,t)),t=e.length,!(e[0]==="-"?t<20||t===20&&Number(e.substring(0,7))>-922337:t<19||t===19&&Number(e.substring(0,6))<922337))if(fc(e),e=De,2147483648&(t=Ge))if(Kd())e=""+(BigInt(0|t)<<BigInt(32)|BigInt(e>>>0));else{let[r,n]=tu(e,t);e="-"+Yo(r,n)}else e=Yo(e,t);return e}function zd(e){return e==null?e:typeof e=="bigint"?(Nd(e)?e=Number(e):(e=s1(64,e),e=Nd(e)?Number(e):String(e)),e):ru(e)?typeof e=="number"?a1(e):c1(e):void 0}function M_(e){if(e==null)return e;var t=typeof e;if(t==="bigint")return String(L_(64,e));if(ru(e)){if(t==="string")return t=rc(Number(e)),Go(t)&&t>=0?e=String(t):((t=e.indexOf("."))!==-1&&(e=e.substring(0,t)),w0(e)||(fc(e),e=Yo(De,Ge))),e;if(t==="number")return(e=rc(e))>=0&&Go(e)?e:(function(r){if(r<0){eo(r);var n=Yo(De,Ge);return r=Number(n),Go(r)?r:n}return w0(n=String(r))?n:(eo(r),Qd(De,Ge))})(e)}}function l1(e){if(typeof e!="string")throw Error();return e}function nc(e){if(e!=null&&typeof e!="string")throw Error();return e}function Sn(e){return e==null||typeof e=="string"?e:void 0}function h1(e,t,r){if(e!=null&&typeof e=="object"&&e.B===Zo)return e;if(Array.isArray(e)){var n=0|e[se],i=n;return i===0&&(i|=32&r),(i|=2&r)!==n&&ct(e,i),new t(e)}}function d1(e,t,r,n,i){if(e!=null){if(Array.isArray(e))e=tc(e)?void 0:i&&2&(0|e[se])?e:nu(e,t,r,n!==void 0,i);else if(Jd(e)){let o={};for(let s in e)o[s]=d1(e[s],t,r,n,i);e=o}else e=t(e,n);return e}}function nu(e,t,r,n,i){let o=n||r?0|e[se]:0,s=n?!!(32&o):void 0;n=lr(e);for(let a=0;a<n.length;a++)n[a]=d1(n[a],t,r,s,i);return r&&((e=Yd(e))&&(n[Qi]=lr(e)),r(o,n)),n}function U_(e){return e.B===Zo?e.toJSON():(function(t){switch(typeof t){case"number":return isFinite(t)?t:String(t);case"bigint":return Nd(t)?Number(t):String(t);case"boolean":return t?1:0;case"object":if(t)if(Array.isArray(t)){if(tc(t))return}else{if(hc(t))return u0(t);if(t instanceof wn){let r=t.g;return r==null?"":typeof r=="string"?r:t.g=u0(r)}}}return t})(e)}function N_(e){return nu(e,U_,void 0,void 0,!1)}var u1,z_;function qo(e,t,r){return e=f1(e,t[0],t[1],r?1:2),t!==u1&&r&&qd(e,16384),e}function f1(e,t,r,n){if(e==null){var i=96;r?(e=[r],i|=512):e=[],t&&(i=-33521665&i|(1023&t)<<15)}else{if(!Array.isArray(e))throw Error("narr");if(2048&(i=0|e[se]))throw Error("farr");if(64&i)return e;if(n===1||n===2||(i|=64),r&&(i|=512,r!==e[0]))throw Error("mid");e:{if(n=(r=e).length){let o=n-1;if(Jd(r[o])){if((t=o-(512&(i|=256)?0:-1))>=1024)throw Error("pvtlmt");i=-33521665&i|(1023&t)<<15;break e}}if(t){if((t=Math.max(t,n-(512&i?0:-1)))>1024)throw Error("spvt");i=-33521665&i|(1023&t)<<15}}}return ct(e,i),e}function p1(e,t,r=Ud){if(e!=null){if(X0&&e instanceof Uint8Array)return t?e:new Uint8Array(e);if(Array.isArray(e)){var n=0|e[se];return 2&n?e:(t&&=n===0||!!(32&n)&&!(64&n||!(16&n)),t?(ct(e,-12293&(34|n)),e):nu(e,p1,4&n?Ud:r,!0,!0))}return e.B===Zo&&(e=2&(n=0|(r=e.l)[se])?e:new e.constructor(mc(r,n,!0))),e}}function m1(e){let t=e.l;return new e.constructor(mc(t,0|t[se],!1))}function mc(e,t,r){let n=r||2&t?Ud:T_,i=!!(32&t);return e=(function(o,s,a){let c=lr(o);var l=c.length;let h=256&s?c[l-1]:void 0;for(l+=h?-1:0,s=512&s?1:0;s<l;s++)c[s]=a(c[s]);if(h){s=c[s]={};for(let d in h)s[d]=a(h[d])}return(o=Yd(o))&&(c[Qi]=lr(o)),c})(e,t,(o=>p1(o,i,n))),qd(e,32|(r?2:0)),e}function iu(e){let t=e.l,r=0|t[se];return 2&r?new e.constructor(mc(t,r,!1)):e}function _r(e,t){return Zn(e=e.l,0|e[se],t)}function Zn(e,t,r,n){if(r===-1)return null;var i=r+(512&t?0:-1);let o=e.length-1;return i>=o&&256&t?e[o][r]:n&&256&t&&(t=e[o][r])!=null?(e[i]!=null&&Rd!=null&&((i=(e=C_??={})[Rd]||0)>=4||(e[Rd]=i+1,Q0(e=Error(),"incident"),(function(s){Kn.setTimeout((()=>{throw s}),0)})(e))),t):i<=o?e[i]:void 0}function pt(e,t,r){let n=e.l,i=0|n[se];return Yn(i),lt(n,i,t,r),e}function lt(e,t,r,n){let i=512&t?0:-1,o=r+i;var s=e.length-1;return o>=s&&256&t?(e[s][r]=n,t):o<=s?(e[o]=n,256&t&&r in(e=e[s])&&delete e[r],t):(n!==void 0&&(r>=(s=t>>15&1023||536870912)?n!=null&&(e[s+i]={[r]:n},ct(e,t|=256)):e[o]=n),t)}function g1(e){let t=0|(e=e.l)[se],r=Zn(e,t,1),n=r1(r,!0);return n!=null&&n!==r&&lt(e,t,1,n),n}function y1(e,t,r,n,i){let o=e.l,s=2&(e=0|o[se])?1:n;i=!!i;let a=0|(n=ou(o,e,t))[se];if(!(4&a)){4&a&&(n=lr(n),a=en(a,e),e=lt(o,e,t,n));let c=0,l=0;for(;c<n.length;c++){let h=r(n[c]);h!=null&&(n[l++]=h)}l<c&&(n.length=l),a=su(a,e),r=-4097&(20|a),a=r&=-8193,ct(n,a),2&a&&Object.freeze(n)}return s===1||s===4&&32&a?Qr(a)||(i=a,a|=2,a!==i&&ct(n,a),Object.freeze(n)):(s===2&&Qr(a)&&(n=lr(n),a=en(a,e),a=kn(a,e,i),ct(n,a),e=lt(o,e,t,n)),Qr(a)||(t=a,a=kn(a,e,i),a!==t&&ct(n,a))),n}function ou(e,t,r,n){return e=Zn(e,t,r,n),Array.isArray(e)?e:Xd}function su(e,t){return e===0&&(e=en(e,t)),1|e}function Qr(e){return!!(2&e)&&!!(4&e)||!!(2048&e)}function S0(e,t,r){let n=0|(e=e.l)[se];if(Yn(n),r==null)lt(e,n,t);else{var i=0|r[se],o=i,s=Qr(i),a=s||Object.isFrozen(r);for(s||(i=0),a||(r=lr(r),o=0,i=kn(i=en(i,n),n,!0),a=!1),i|=21,s=0;s<r.length;s++){let c=r[s],l=l1(c);Object.is(c,l)||(a&&(r=lr(r),o=0,i=kn(i=en(i,n),n,!0),a=!1),r[s]=l)}i!==o&&(a&&(r=lr(r),i=kn(i=en(i,n),n,!0)),ct(r,i)),lt(e,n,t,r)}}function b1(e,t){let r=0|(e=e.l)[se];Yn(r),lt(e,r,2,t===""?void 0:t)}function es(e,t,r,n,i){Yn(t);var o=!(!(64&t)&&16384&t);let s=(i=ou(e,t,r,i))!==Xd;if(o||!s){let a=o=s?0|i[se]:0;(!s||2&a||Qr(a)||4&a&&!(32&a))&&(i=lr(i),a=en(a,t),t=lt(e,t,r,i)),a=-13&su(a,t),a=kn(n?-17&a:16|a,t,!0),a!==o&&ct(i,a)}return i}function Pd(e,t){var r=c2;return cu(au(e=e.l),e,0|e[se],r)===t?t:-1}function au(e){if(dc)return e[Ho]??(e[Ho]=new Map);if(Ho in e)return e[Ho];let t=new Map;return Object.defineProperty(e,Ho,{value:t}),t}function v1(e,t,r,n){let i=au(e),o=cu(i,e,t,r);return o!==n&&(o&&(t=lt(e,t,o)),i.set(r,n)),t}function cu(e,t,r,n){let i=e.get(n);if(i!=null)return i;i=0;for(let o=0;o<n.length;o++){let s=n[o];Zn(t,r,s)!=null&&(i!==0&&(r=lt(t,r,i)),i=s)}return e.set(n,i),i}function lu(e,t,r,n){let i,o=0|e[se];if((n=Zn(e,o,r,n))!=null&&n.B===Zo)return(t=iu(n))!==n&&lt(e,o,r,t),t.l;if(Array.isArray(n)){let s=0|n[se];i=2&s?qo(mc(n,s,!1),t,!0):64&s?n:qo(i,t,!0)}else i=qo(void 0,t,!0);return i!==n&&lt(e,o,r,i),i}function _1(e,t,r,n){let i=0|(e=e.l)[se];return(t=h1(n=Zn(e,i,r,n),t,i))!==n&&t!=null&&lt(e,i,r,t),t}function wr(e,t,r){if((t=_1(e,t,r,!1))==null)return t;let n=0|(e=e.l)[se];if(!(2&n)){let i=iu(t);i!==t&&lt(e,n,r,t=i)}return t}function w1(e,t,r,n,i,o){e=e.l;var s=!!(2&t);let a=s?1:n;i=!!i,o&&=!s;var c=0|(n=ou(e,t,1))[se];if(!(s=!!(4&c))){var l=n,h=t;let d=!!(2&(c=su(c,t)));d&&(h|=2);let m=!d,p=!0,g=0,f=0;for(;g<l.length;g++){let b=h1(l[g],r,h);if(b instanceof r){if(!d){let _=!!(2&(0|b.l[se]));m&&=!_,p&&=_}l[f++]=b}}f<g&&(l.length=f),c|=4,c=p?16|c:-17&c,ct(l,c=m?8|c:-9&c),d&&Object.freeze(l)}if(o&&!(8&c||!n.length&&(a===1||a===4&&32&c))){for(Qr(c)&&(n=lr(n),c=en(c,t),t=lt(e,t,1,n)),r=n,o=c,l=0;l<r.length;l++)(c=r[l])!==(h=iu(c))&&(r[l]=h);o|=8,ct(r,o=r.length?-17&o:16|o),c=o}return a===1||a===4&&32&c?Qr(c)||(t=c,(c|=!n.length||16&c&&(!s||32&c)?2:2048)!==t&&ct(n,c),Object.freeze(n)):(a===2&&Qr(c)&&(ct(n=lr(n),c=kn(c=en(c,t),t,i)),t=lt(e,t,1,n)),Qr(c)||(e=c,(c=kn(c,t,i))!==e&&ct(n,c))),n}function hu(e,t){let r=0|e.l[se];return w1(e,r,t,n1===void 0?2:4,!1,!(2&r))}function Sr(e,t,r,n){return n==null&&(n=void 0),pt(e,r,n)}function Dd(e,t,r){var n=i2;r==null&&(r=void 0);e:{let i=0|(e=e.l)[se];if(Yn(i),r==null){let o=au(e);if(cu(o,e,i,n)!==t)break e;o.set(n,0)}else i=v1(e,i,n,t);lt(e,i,t,r)}}function en(e,t){return-2049&(e=32|(2&t?2|e:-3&e))}function kn(e,t,r){return 32&t&&r||(e&=-33),e}function S1(e,t){var r=xu;let n=0|e.l[se];Yn(n),e=w1(e,n,r,2,!0),t=t??new r,e.push(t),e[se]=2&(0|t.l[se])?-9&e[se]:-17&e[se]}function Ot(e,t,r){Yn(0|e.l[se]),y1(e,t,Sn,2,!0).push(l1(r))}function k1(e,t){return Error(`Invalid wire type: ${e} (at position ${t})`)}function du(){return Error("Failed to read varint, encoding is invalid.")}function E1(e,t){return Error(`Tried to read past the end of the data ${t} > ${e}`)}function uu(e){if(typeof e=="string")return{buffer:Y0(e),u:!1};if(Array.isArray(e))return{buffer:new Uint8Array(e),u:!1};if(e.constructor===Uint8Array)return{buffer:e,u:!1};if(e.constructor===ArrayBuffer)return{buffer:new Uint8Array(e),u:!1};if(e.constructor===wn)return{buffer:Gd(e)||new Uint8Array(0),u:!0};if(e instanceof Uint8Array)return{buffer:new Uint8Array(e.buffer,e.byteOffset,e.byteLength),u:!1};throw Error("Type not convertible to a Uint8Array, expected a Uint8Array, an ArrayBuffer, a base64 encoded string, a ByteString or an Array of numbers")}function fu(e,t){let r,n=0,i=0,o=0,s=e.i,a=e.g;do r=s[a++],n|=(127&r)<<o,o+=7;while(o<32&&128&r);for(o>32&&(i|=(127&r)>>4),o=3;o<32&&128&r;o+=7)r=s[a++],i|=(127&r)<<o;if(qn(e,a),r<128)return t(n>>>0,i>>>0);throw du()}function pu(e){let t=0,r=e.g,n=r+10,i=e.i;for(;r<n;){let o=i[r++];if(t|=o,(128&o)==0)return qn(e,r),!!(127&t)}throw du()}function Bt(e){let t=e.i,r=e.g,n=t[r++],i=127&n;if(128&n&&(n=t[r++],i|=(127&n)<<7,128&n&&(n=t[r++],i|=(127&n)<<14,128&n&&(n=t[r++],i|=(127&n)<<21,128&n&&(n=t[r++],i|=n<<28,128&n&&128&t[r++]&&128&t[r++]&&128&t[r++]&&128&t[r++]&&128&t[r++])))))throw du();return qn(e,r),i}function jd(e){var t=e.i;let r=e.g,n=t[r],i=t[r+1],o=t[r+2];return t=t[r+3],qn(e,e.g+4),(n<<0|i<<8|o<<16|t<<24)>>>0}function Vd(e){var t=jd(e);e=2*(t>>31)+1;let r=t>>>23&255;return t&=8388607,r==255?t?NaN:e*(1/0):r==0?1401298464324817e-60*e*t:e*Math.pow(2,r-150)*(t+8388608)}function j_(e){return Bt(e)}function Od(e,t,{C:r=!1}={}){e.C=r,t&&(t=uu(t),e.i=t.buffer,e.m=t.u,e.s=0,e.j=e.i.length,e.g=e.s)}function qn(e,t){if(e.g=t,t>e.j)throw E1(e.j,t)}function C1(e,t){if(t<0)throw Error(`Tried to read a negative byte length: ${t}`);let r=e.g,n=r+t;if(n>e.j)throw E1(t,e.j-r);return e.g=n,r}function x1(e,t){if(t==0)return Zi();var r=C1(e,t);return e.C&&e.m?r=e.i.subarray(r,r+t):(e=e.i,r=r===(t=r+t)?new Uint8Array(0):B_?e.slice(r,t):new Uint8Array(e.subarray(r,t))),r.length==0?Zi():new wn(r,Yi)}var k0=[];function A1(e){var t=e.g;if(t.g==t.j)return!1;e.j=e.g.g;var r=Bt(e.g)>>>0;if(t=r>>>3,!((r&=7)>=0&&r<=5))throw k1(r,e.j);if(t<1)throw Error(`Invalid field number: ${t} (at position ${e.j})`);return e.m=t,e.i=r,!0}function Za(e){switch(e.i){case 0:e.i!=0?Za(e):pu(e.g);break;case 1:qn(e=e.g,e.g+8);break;case 2:if(e.i!=2)Za(e);else{var t=Bt(e.g)>>>0;qn(e=e.g,e.g+t)}break;case 5:qn(e=e.g,e.g+4);break;case 3:for(t=e.m;;){if(!A1(e))throw Error("Unmatched start-group tag: stream EOF");if(e.i==4){if(e.m!=t)throw Error("Unmatched end-group tag");break}Za(e)}break;default:throw k1(e.i,e.j)}}function gc(e,t,r){let n=e.g.j,i=Bt(e.g)>>>0,o=e.g.g+i,s=o-n;if(s<=0&&(e.g.j=o,r(t,e,void 0,void 0,void 0),s=o-e.g.g),s)throw Error(`Message parsing ended unexpectedly. Expected to read ${i} bytes, instead read ${i-s} bytes, either the data ended unexpectedly or the message misreported its own length`);e.g.g=o,e.g.j=n}function mu(e){var t=Bt(e.g)>>>0,r=C1(e=e.g,t);if(e=e.i,y_){var n,i=e;(n=Ad)||(n=Ad=new TextDecoder("utf-8",{fatal:!0})),t=r+t,i=r===0&&t===i.length?i:i.subarray(r,t);try{var o=n.decode(i)}catch(a){if(qa===void 0){try{n.decode(new Uint8Array([128]))}catch{}try{n.decode(new Uint8Array([97])),qa=!0}catch{qa=!1}}throw!qa&&(Ad=void 0),a}}else{t=(o=r)+t,r=[];let a,c=null;for(;o<t;){var s=e[o++];s<128?r.push(s):s<224?o>=t?$n():(a=e[o++],s<194||(192&a)!=128?(o--,$n()):r.push((31&s)<<6|63&a)):s<240?o>=t-1?$n():(a=e[o++],(192&a)!=128||s===224&&a<160||s===237&&a>=160||(192&(n=e[o++]))!=128?(o--,$n()):r.push((15&s)<<12|(63&a)<<6|63&n)):s<=244?o>=t-2?$n():(a=e[o++],(192&a)!=128||a-144+(s<<28)>>30!=0||(192&(n=e[o++]))!=128||(192&(i=e[o++]))!=128?(o--,$n()):(s=(7&s)<<18|(63&a)<<12|(63&n)<<6|63&i,s-=65536,r.push(55296+(s>>10&1023),56320+(1023&s)))):$n(),r.length>=8192&&(c=l0(c,r),r.length=0)}o=l0(c,r)}return o}function T1(e){let t=Bt(e.g)>>>0;return x1(e.g,t)}function gu(e,t,r){var n=Bt(e.g)>>>0;for(n=e.g.g+n;e.g.g<n;)r.push(t(e.g))}var Ja=[];function V_(e){return e}var Ki;function I1(e,t,r){t.g?t.j(e,t.g,t.i,r):t.j(e,t.i,r)}var Ue=class{constructor(e,t){this.l=f1(e,t)}toJSON(){let e=!Ki;try{return e&&(Ki=N_),R1(this)}finally{e&&(Ki=void 0)}}u(){return!!(2&(0|this.l[se]))}};function R1(e){var t=e.l;{t=(e=Ki(t))!==t;let l=e.length;if(l){var r=e[l-1],n=Jd(r);n?l--:r=void 0;var i=e;if(n){e:{var o,s=r,a=!1;if(s)for(let h in s)isNaN(+h)?(o??={})[h]=s[h]:(n=s[h],Array.isArray(n)&&(tc(n)||m0(n)&&n.size===0)&&(n=null),n==null&&(a=!0),n!=null&&((o??={})[h]=n));if(a||(o=s),o)for(let h in o){a=o;break e}a=null}s=a==null?r!=null:a!==r}for(;l>0&&((o=i[l-1])==null||tc(o)||m0(o)&&o.size===0);l--)var c=!0;(i!==e||s||c)&&(t?(c||s||a)&&(i.length=l):i=Array.prototype.slice.call(i,0,l),a&&i.push(a)),c=i}else c=e}return c}function E0(e){return e?/^\d+$/.test(e)?(fc(e),new Hd(De,Ge)):null:H_||=new Hd(0,0)}Ue.prototype.B=Zo,Ue.prototype.toString=function(){try{return Ki=V_,R1(this).toString()}finally{Ki=void 0}};var Hd=class{constructor(e,t){this.i=e>>>0,this.g=t>>>0}},H_;function C0(e){return e?/^-?\d+$/.test(e)?(fc(e),new Wd(De,Ge)):null:W_||=new Wd(0,0)}var Wd=class{constructor(e,t){this.i=e>>>0,this.g=t>>>0}},W_;function Xi(e,t,r){for(;r>0||t>127;)e.g.push(127&t|128),t=(t>>>7|r<<25)>>>0,r>>>=7;e.g.push(t)}function ts(e,t){for(;t>127;)e.g.push(127&t|128),t>>>=7;e.g.push(t)}function yc(e,t){if(t>=0)ts(e,t);else{for(let r=0;r<9;r++)e.g.push(127&t|128),t>>=7;e.g.push(1)}}function ic(e,t){e.g.push(t>>>0&255),e.g.push(t>>>8&255),e.g.push(t>>>16&255),e.g.push(t>>>24&255)}function to(e,t){t.length!==0&&(e.j.push(t),e.i+=t.length)}function kr(e,t,r){ts(e.g,8*t+r)}function bc(e,t){return kr(e,t,2),t=e.g.end(),to(e,t),t.push(e.i),t}function vc(e,t){var r=t.pop();for(r=e.i+e.g.length()-r;r>127;)t.push(127&r|128),r>>>=7,e.i++;t.push(r),e.i++}function _c(e,t,r){kr(e,t,2),ts(e.g,r.length),to(e,e.g.end()),to(e,r)}function Er(){let e=class{constructor(){throw Error()}};return Object.setPrototypeOf(e,e.prototype),e}var yu=Er(),P1=Er(),bu=Er(),vu=Er(),D1=Er(),O1=Er(),B1=Er(),L1=Er(),ro=class{constructor(e,t,r){this.g=e,this.i=t,e=yu,this.j=!!e&&r===e||!1}};function _u(e,t){return new ro(e,t,yu)}function F1(e,t,r,n,i){(t=z1(t,n))!=null&&(r=bc(e,r),i(t,e),vc(e,r))}var $_=_u((function(e,t,r,n,i){return e.i===2&&(gc(e,lu(t,n,r),i),!0)}),F1),G_=_u((function(e,t,r,n,i){return e.i===2&&(gc(e,lu(t,n,r,!0),i),!0)}),F1),wc=Symbol(),wu=Symbol(),x0=Symbol(),A0=Symbol(),M1,U1;function Qn(e,t,r,n){var i=n[e];if(i)return i;(i={}).P=n,i.A=(function(d){switch(typeof d){case"boolean":return u1||=[0,void 0,!0];case"number":return d>0?void 0:d===0?z_||=[0,void 0]:[-d,void 0];case"string":return[0,d];case"object":return d}})(n[0]);var o=n[1];let s=1;o&&o.constructor===Object&&(i.H=o,typeof(o=n[++s])=="function"&&(i.I=!0,M1??=o,U1??=n[s+1],o=n[s+=2]));let a={};for(;o&&Array.isArray(o)&&o.length&&typeof o[0]=="number"&&o[0]>0;){for(var c=0;c<o.length;c++)a[o[c]]=o;o=n[++s]}for(c=1;o!==void 0;){let d;typeof o=="number"&&(c+=o,o=n[++s]);var l=void 0;if(o instanceof ro?d=o:(d=$_,s--),d?.j){o=n[++s],l=n;var h=s;typeof o=="function"&&(o=o(),l[h]=o),l=o}for(h=c+1,typeof(o=n[++s])=="number"&&o<0&&(h-=o,o=n[++s]);c<h;c++){let m=a[c];l?r(i,c,d,l,m):t(i,c,d,m)}}return n[e]=i}function N1(e){return Array.isArray(e)?e[0]instanceof ro?e:[G_,e]:[e,void 0]}function z1(e,t){return e instanceof Ue?e.l:Array.isArray(e)?qo(e,t,!1):void 0}function Su(e,t,r,n){let i=r.g;e[t]=n?(o,s,a)=>i(o,s,a,n):i}function ku(e,t,r,n,i){let o=r.g,s,a;e[t]=(c,l,h)=>o(c,l,h,a||=Qn(wu,Su,ku,n).A,s||=Eu(n),i)}function Eu(e){let t=e[x0];if(t!=null)return t;let r=Qn(wu,Su,ku,e);return t=r.I?(n,i)=>M1(n,i,r):(n,i)=>{let o=0|n[se];for(;A1(i)&&i.i!=4;){var s=i.m,a=r[s];if(a==null){var c=r.H;c&&(c=c[s])&&(c=q_(c))!=null&&(a=r[s]=c)}a!=null&&a(i,n,s)||(s=(a=i).j,Za(a),a.G?a=void 0:(c=a.g.g-s,a.g.g=s,a=x1(a.g,c)),s=n,a&&((c=s[Qi])?c.push(a):s[Qi]=[a]))}return 16384&o&&qd(n,34),!0},e[x0]=t}function q_(e){let t=(e=N1(e))[0].g;if(e=e[1]){let r=Eu(e),n=Qn(wu,Su,ku,e).A;return(i,o,s)=>t(i,o,s,n,r)}return t}function Sc(e,t,r){e[t]=r.i}function kc(e,t,r,n){let i,o,s=r.i;e[t]=(a,c,l)=>s(a,c,l,o||=Qn(wc,Sc,kc,n).A,i||=j1(n))}function j1(e){let t=e[A0];if(!t){let r=Qn(wc,Sc,kc,e);t=(n,i)=>V1(n,i,r),e[A0]=t}return t}function V1(e,t,r){for(var n=0|e[se],i=512&n?0:-1,o=e.length,s=512&n?1:0,a=o+(256&n?-1:0);s<a;s++){let c=e[s];if(c==null)continue;let l=s-i,h=T0(r,l);h&&h(t,c,l)}if(256&n){n=e[o-1];for(let c in n)i=+c,Number.isNaN(i)||(o=n[i])!=null&&(a=T0(r,i))&&a(t,o,i)}if(e=Yd(e))for(to(t,t.g.end()),r=0;r<e.length;r++)to(t,Gd(e[r])||new Uint8Array(0))}function T0(e,t){var r=e[t];if(r)return r;if((r=e.H)&&(r=r[t])){var n=(r=N1(r))[0].i;if(r=r[1]){let i=j1(r),o=Qn(wc,Sc,kc,r).A;r=e.I?U1(o,i):(s,a,c)=>n(s,a,c,o,i)}else r=n;return e[t]=r}}function Ec(e,t){if(Array.isArray(t)){var r=0|t[se];if(4&r)return t;for(var n=0,i=0;n<t.length;n++){let o=e(t[n]);o!=null&&(t[i++]=o)}return i<n&&(t.length=i),ct(t,-12289&(5|r)),2&r&&Object.freeze(t),t}}function wt(e,t,r){return new ro(e,t,r)}function Cc(e,t,r){return new ro(e,t,r)}function St(e,t,r){lt(e,0|e[se],t,r)}function H1(e,t,r){if(t=(function(n){if(n==null)return n;let i=typeof n;if(i==="bigint")return String(s1(64,n));if(ru(n)){if(i==="string")return c1(n);if(i==="number")return a1(n)}})(t),t!=null&&(typeof t=="string"&&C0(t),t!=null))switch(kr(e,r,0),typeof t){case"number":e=e.g,eo(t),Xi(e,De,Ge);break;case"bigint":r=BigInt.asUintN(64,t),r=new Wd(Number(r&BigInt(4294967295)),Number(r>>BigInt(32))),Xi(e.g,r.i,r.g);break;default:r=C0(t),Xi(e.g,r.i,r.g)}}function W1(e,t,r){(t=Xn(t))!=null&&t!=null&&(kr(e,r,0),yc(e.g,t))}function $1(e,t,r){(t=t==null||typeof t=="boolean"?t:typeof t=="number"?!!t:void 0)!=null&&(kr(e,r,0),e.g.g.push(t?1:0))}function G1(e,t,r){(t=Sn(t))!=null&&_c(e,r,G0(t))}function q1(e,t,r,n,i){(t=z1(t,n))!=null&&(r=bc(e,r),i(t,e),vc(e,r))}function K1(e,t,r){(t=t==null||typeof t=="string"||hc(t)||t instanceof wn?t:void 0)!=null&&_c(e,r,uu(t).buffer)}var K_=wt((function(e,t,r){if(e.i!==1)return!1;var n=e.g;e=jd(n);let i=jd(n);n=2*(i>>31)+1;let o=i>>>20&2047;return e=4294967296*(1048575&i)+e,St(t,r,o==2047?e?NaN:n*(1/0):o==0?5e-324*n*e:n*Math.pow(2,o-1075)*(e+4503599627370496)),!0}),(function(e,t,r){(t=Qo(t))!=null&&(kr(e,r,1),e=e.g,(r=i1||=new DataView(new ArrayBuffer(8))).setFloat64(0,+t,!0),De=r.getUint32(0,!0),Ge=r.getUint32(4,!0),ic(e,De),ic(e,Ge))}),Er()),X1=wt((function(e,t,r){return e.i===5&&(St(t,r,Vd(e.g)),!0)}),(function(e,t,r){(t=Qo(t))!=null&&(kr(e,r,5),e=e.g,o1(t),ic(e,De))}),O1),X_=Cc((function(e,t,r){return(e.i===5||e.i===2)&&(t=es(t,0|t[se],r,!1,!1),e.i==2?gu(e,Vd,t):t.push(Vd(e.g)),!0)}),(function(e,t,r){if((t=Ec(Qo,t))!=null&&t.length){kr(e,r,2),ts(e.g,4*t.length);for(let n=0;n<t.length;n++)r=e.g,o1(t[n]),ic(r,De)}}),O1),oc=wt((function(e,t,r){return e.i===0&&(St(t,r,fu(e.g,eu)),!0)}),H1,D1),Bd=wt((function(e,t,r){return e.i===0&&(St(t,r,(e=fu(e.g,eu))===0?void 0:e),!0)}),H1,D1),J_=wt((function(e,t,r){return e.i===0&&(St(t,r,fu(e.g,Qd)),!0)}),(function(e,t,r){if((t=M_(t))!=null&&(typeof t=="string"&&E0(t),t!=null))switch(kr(e,r,0),typeof t){case"number":e=e.g,eo(t),Xi(e,De,Ge);break;case"bigint":r=BigInt.asUintN(64,t),r=new Hd(Number(r&BigInt(4294967295)),Number(r>>BigInt(32))),Xi(e.g,r.i,r.g);break;default:r=E0(t),Xi(e.g,r.i,r.g)}}),Er()),En=wt((function(e,t,r){return e.i===0&&(St(t,r,Bt(e.g)),!0)}),W1,vu),Cu=Cc((function(e,t,r){return(e.i===0||e.i===2)&&(t=es(t,0|t[se],r,!1,!1),e.i==2?gu(e,Bt,t):t.push(Bt(e.g)),!0)}),(function(e,t,r){if((t=Ec(Xn,t))!=null&&t.length){r=bc(e,r);for(let n=0;n<t.length;n++)yc(e.g,t[n]);vc(e,r)}}),vu),Gi=wt((function(e,t,r){return e.i===0&&(St(t,r,(e=Bt(e.g))===0?void 0:e),!0)}),W1,vu),Wt=wt((function(e,t,r){return e.i===0&&(St(t,r,pu(e.g)),!0)}),$1,P1),Ji=wt((function(e,t,r){return e.i===0&&(St(t,r,(e=pu(e.g))===!1?void 0:e),!0)}),$1,P1),sr=Cc((function(e,t,r){return e.i===2&&(e=mu(e),es(t,0|t[se],r,!1).push(e),!0)}),(function(e,t,r){if((t=Ec(Sn,t))!=null)for(let s=0;s<t.length;s++){var n=e,i=r,o=t[s];o!=null&&_c(n,i,G0(o))}}),bu),_n=wt((function(e,t,r){return e.i===2&&(St(t,r,(e=mu(e))===""?void 0:e),!0)}),G1,bu),Ze=wt((function(e,t,r){return e.i===2&&(St(t,r,mu(e)),!0)}),G1,bu),ar=(function(e,t,r=yu){return new ro(e,t,r)})((function(e,t,r,n,i){return e.i===2&&(n=qo(void 0,n,!0),es(t,0|t[se],r,!0).push(n),gc(e,n,i),!0)}),(function(e,t,r,n,i){if(Array.isArray(t))for(let o=0;o<t.length;o++)q1(e,t[o],r,n,i)})),ft=_u((function(e,t,r,n,i,o){return e.i===2&&(v1(t,0|t[se],o,r),gc(e,t=lu(t,n,r),i),!0)}),q1),J1=wt((function(e,t,r){return e.i===2&&(St(t,r,T1(e)),!0)}),K1,B1),Y_=wt((function(e,t,r){return e.i===0&&(St(t,r,(e=Bt(e.g)>>>0)===0?void 0:e),!0)}),(function(e,t,r){t=(function(n){if(n==null)return n;if(typeof n=="string"&&n)n=+n;else if(typeof n!="number")return;return pc(n)?n>>>0:void 0})(t),t!=null&&t!=null&&(kr(e,r,0),ts(e.g,t))}),Er()),Jn=wt((function(e,t,r){return e.i===0&&(St(t,r,Bt(e.g)),!0)}),(function(e,t,r){(t=Xn(t))!=null&&(t=parseInt(t,10),kr(e,r,0),yc(e.g,t))}),L1),sc=class{constructor(t,r){this.i=t,this.g=r,this.j=Sr,this.defaultValue=void 0}};function Y1(e,t){return(r,n)=>{if(Ja.length){let o=Ja.pop();o.o(n),Od(o.g,r,n),r=o}else r=new class{constructor(o,s){if(k0.length){let a=k0.pop();Od(a,o,s),o=a}else o=new class{constructor(a,c){this.i=null,this.m=!1,this.g=this.j=this.s=0,Od(this,a,c)}clear(){this.i=null,this.m=!1,this.g=this.j=this.s=0,this.C=!1}}(o,s);this.g=o,this.j=this.g.g,this.i=this.m=-1,this.o(s)}o({G:o=!1}={}){this.G=o}}(r,n);try{let o=new e,s=o.l;Eu(t)(s,r);var i=o}finally{r.g.clear(),r.m=-1,r.i=-1,Ja.length<100&&Ja.push(r)}return i}}var I0=[0,_n,wt((function(e,t,r){return e.i===2&&(St(t,r,(e=T1(e))===Zi()?void 0:e),!0)}),(function(e,t,r){if(t!=null){if(t instanceof Ue){let n=t.R;return void(n&&(t=n(t),t!=null&&_c(e,r,uu(t).buffer)))}if(Array.isArray(t))return}K1(e,t,r)}),B1)],Ld,R0=globalThis.trustedTypes;function P0(e){Ld===void 0&&(Ld=(function(){let r=null;if(!R0)return r;try{let n=i=>i;r=R0.createPolicy("goog#html",{createHTML:n,createScript:n,createScriptURL:n})}catch{}return r})());var t=Ld;return new class{constructor(r){this.g=r}toString(){return this.g+""}}(t?t.createScriptURL(e):e)}function Z_(e,...t){if(t.length===0)return P0(e[0]);let r=e[0];for(let n=0;n<t.length;n++)r+=encodeURIComponent(t[n])+e[n+1];return P0(r)}var Z1=[0,En,Jn,Wt,-1,Cu,Jn,-1],Q_=class extends Ue{constructor(e){super(e)}},Q1=[0,Wt,Ze,Wt,Jn,-1,Cc((function(e,t,r){return(e.i===0||e.i===2)&&(t=es(t,0|t[se],r,!1,!1),e.i==2?gu(e,j_,t):t.push(Bt(e.g)),!0)}),(function(e,t,r){if((t=Ec(Xn,t))!=null&&t.length){r=bc(e,r);for(let n=0;n<t.length;n++)yc(e.g,t[n]);vc(e,r)}}),L1),Ze,-1,[0,Wt,-1],Jn,Wt,-1],e2=[0,Ze,-2],D0=class extends Ue{constructor(e){super(e)}},t2=[0],r2=[0,En,Wt,1,Wt,-3],n2=class extends Ue{constructor(e){super(e,2)}},xc={};xc[336783863]=[0,Ze,Wt,-1,En,[0,[1,2,3,4,5,6,7,8],ft,t2,ft,Q1,ft,e2,ft,r2,ft,Z1,ft,[0,Ze,-2],ft,[0,Ze,Jn],ft,[0,Jn,Ze]],[0,Ze],Wt,[0,[1,3],[2,4],ft,[0,Cu],-1,ft,[0,sr],-1,ar,[0,Ze,-1]],Ze];var O0,B0=[0,Bd,-1,Ji,-3,Bd,Cu,_n,Gi,Bd,-1,Ji,Gi,Ji,-2,_n],xu=class extends Ue{constructor(e){super(e,500)}o(e){return Sr(this,0,7,e)}},Ko=[-1,{}],L0=[0,Ze,1,Ko],F0=[0,Ze,sr,Ko],Au=class extends Ue{constructor(e){super(e,500)}o(e){return Sr(this,0,1001,e)}};Au.prototype.g=(O0=[-500,ar,[-500,_n,-1,sr,-3,[-2,xc,Wt],ar,I0,Gi,-1,L0,F0,ar,[0,_n,Ji],_n,B0,Gi,sr,987,sr],4,ar,[-500,Ze,-1,[-1,{}],998,Ze],ar,[-500,Ze,sr,-1,[-2,{},Wt],997,sr,-1],Gi,ar,[-500,Ze,sr,Ko,998,sr],sr,Gi,L0,F0,ar,[0,_n,-1,Ko],sr,-2,B0,_n,-1,Ji,[0,Ji,Y_],978,Ko,ar,I0],function(){let e=new class{constructor(){this.j=[],this.i=0,this.g=new class{constructor(){this.g=[]}length(){return this.g.length}end(){let o=this.g;return this.g=[],o}}}};V1(this.l,e,Qn(wc,Sc,kc,O0)),to(e,e.g.end());let t=new Uint8Array(e.i),r=e.j,n=r.length,i=0;for(let o=0;o<n;o++){let s=r[o];t.set(s,i),i+=s.length}return e.j=[t],t});var e3=class extends Ue{constructor(e){super(e)}},t3=class extends Ue{constructor(e){super(e)}g(){return hu(this,e3)}},r3=[0,ar,[0,En,X1,Ze,-1]],M0=class extends Ue{constructor(e){super(e)}},U0=class extends Ue{constructor(e){super(e)}},i2=[1,2,3,4,5],ac=class extends Ue{constructor(e){super(e)}g(){return g1(this)!=null}i(){return Sn(_r(this,2))!=null}},cc=class extends Ue{constructor(e){super(e)}},o2=class extends Ue{constructor(e){super(e)}},s2=[0,[0,J1,Ze,[0,En,oc,-1],[0,J_,oc]],Wt,[0,i2,ft,r2,ft,Q1,ft,Z1,ft,t2,ft,e2],Jn],n3=new sc(451755788,o2);xc[451755788]=[0,s2,[0,Ze,En,X1,sr,-1],K_];var N0=class extends Ue{constructor(e){super(e)}},a2=class extends Ue{constructor(e){super(e)}},i3=new sc(487277289,a2);xc[487277289]=[0,s2,[0,Wt,-1]];var o3=class extends Ue{constructor(e){super(e)}},s3=Y1(class extends Ue{constructor(e){super(e)}},[0,ar,[0,1,En,Ze,r3],oc]),z0=class extends Ue{constructor(e){super(e)}},a3=class extends Ue{constructor(e){super(e)}J(){let e=g1(this);return e??Zi()}},c3=class extends Ue{constructor(e){super(e)}},c2=[1,2],j0=Y1(class extends Ue{constructor(e){super(e)}},[0,ar,[0,c2,ft,[0,X_],ft,[0,J1],En,Ze],oc]);function l3(){var e=navigator;return typeof OffscreenCanvas<"u"&&(!(function(t=navigator){return(t=t.userAgent).includes("Safari")&&!t.includes("Chrome")})(e)||!!((e=e.userAgent.match(/Version\/([\d]+).*Safari/))&&e.length>=1&&Number(e[1])>=17))}async function V0(e){if(typeof importScripts!="function"){let t=document.createElement("script");return t.src=e.toString(),t.crossOrigin="anonymous",new Promise(((r,n)=>{t.addEventListener("load",(()=>{r()}),!1),t.addEventListener("error",(i=>{n(i)}),!1),document.body.appendChild(t)}))}importScripts(e.toString())}function ie(e,t,r){e.m||console.error("No wasm multistream support detected: ensure dependency inclusion of :gl_graph_runner_internal_multi_input target"),r(t=e.h.stringToNewUTF8(t)),e.h._free(t)}function H0(e,t,r){e.m||console.error("No wasm multistream support detected: ensure dependency inclusion of :gl_graph_runner_internal_multi_input target");let n=new Uint32Array(t.length);for(let i=0;i<t.length;i++)n[i]=e.h.stringToNewUTF8(t[i]);t=e.h._malloc(4*n.length),e.h.HEAPU32.set(n,t>>2),r(t);for(let i of n)e.h._free(i);e.h._free(t)}function yn(e,t,r){e.h.simpleListeners=e.h.simpleListeners||{},e.h.simpleListeners[t]=r}function Gn(e,t,r){let n=[];e.h.simpleListeners=e.h.simpleListeners||{},e.h.simpleListeners[t]=(i,o,s)=>{o?(r(n,s),n=[]):n.push(i)}}var h3=(function(e){return class extends e{N(){this.h._registerModelResourcesGraphService()}}})(class{constructor(e,t){this.j=!0,this.h=e,this.g=null,this.i=0,this.m=typeof this.h._addIntToInputStream=="function",t!==void 0?this.h.canvas=t:l3()?this.h.canvas=new OffscreenCanvas(1,1):(console.warn("OffscreenCanvas not supported and GraphRunner constructor glCanvas parameter is undefined. Creating backup canvas."),this.h.canvas=document.createElement("canvas"))}async initializeGraph(e){let t=await(await fetch(e)).arrayBuffer();e=!(e.endsWith(".pbtxt")||e.endsWith(".textproto")),this.setGraph(new Uint8Array(t),e)}setGraphFromString(e){this.setGraph(new TextEncoder().encode(e),!1)}setGraph(e,t){let r=e.length,n=this.h._malloc(r);this.h.HEAPU8.set(e,n),t?this.h._changeBinaryGraph(r,n):this.h._changeTextGraph(r,n),this.h._free(n)}configureAudio(e,t,r,n,i){this.h._configureAudio||console.warn('Attempting to use configureAudio without support for input audio. Is build dep ":gl_graph_runner_audio" missing?'),ie(this,n||"input_audio",(o=>{ie(this,i=i||"audio_header",(s=>{this.h._configureAudio(o,s,e,t??0,r)}))}))}setAutoResizeCanvas(e){this.j=e}setAutoRenderToScreen(e){this.h._setAutoRenderToScreen(e)}setGpuBufferVerticalFlip(e){this.h.gpuOriginForWebTexturesIsBottomLeft=e}attachErrorListener(e){this.h.errorListener=e}attachEmptyPacketListener(e,t){this.h.emptyPacketListeners=this.h.emptyPacketListeners||{},this.h.emptyPacketListeners[e]=t}addAudioToStream(e,t,r){this.addAudioToStreamWithShape(e,0,0,t,r)}addAudioToStreamWithShape(e,t,r,n,i){let o=4*e.length;this.i!==o&&(this.g&&this.h._free(this.g),this.g=this.h._malloc(o),this.i=o),this.h.HEAPF32.set(e,this.g/4),ie(this,n,(s=>{this.h._addAudioToInputStream(this.g,t,r,s,i)}))}addGpuBufferToStream(e,t,r){ie(this,t,(n=>{if(!this.h.canvas)throw Error("No OpenGL canvas configured.");n?this.h._bindTextureToStream(n):this.h._bindTextureToCanvas();let i=this.h.canvas.getContext("webgl2")||this.h.canvas.getContext("webgl");if(!i)throw Error("Failed to obtain WebGL context from the provided canvas. `getContext()` should only be invoked with `webgl` or `webgl2`.");this.h.gpuOriginForWebTexturesIsBottomLeft&&i.pixelStorei(i.UNPACK_FLIP_Y_WEBGL,!0),i.texImage2D(i.TEXTURE_2D,0,i.RGBA,i.RGBA,i.UNSIGNED_BYTE,e),this.h.gpuOriginForWebTexturesIsBottomLeft&&i.pixelStorei(i.UNPACK_FLIP_Y_WEBGL,!1);let[o,s]=e.videoWidth!==void 0?[e.videoWidth,e.videoHeight]:e.naturalWidth!==void 0?[e.naturalWidth,e.naturalHeight]:e.displayWidth!==void 0?[e.displayWidth,e.displayHeight]:[e.width,e.height];!this.j||o===this.h.canvas.width&&s===this.h.canvas.height||(this.h.canvas.width=o,this.h.canvas.height=s);let[a,c]=[o,s];this.h._addBoundTextureToStream(n,a,c,r)}))}addBoolToStream(e,t,r){ie(this,t,(n=>{this.h._addBoolToInputStream(e,n,r)}))}addDoubleToStream(e,t,r){ie(this,t,(n=>{this.h._addDoubleToInputStream(e,n,r)}))}addFloatToStream(e,t,r){ie(this,t,(n=>{this.h._addFloatToInputStream(e,n,r)}))}addIntToStream(e,t,r){ie(this,t,(n=>{this.h._addIntToInputStream(e,n,r)}))}addUintToStream(e,t,r){ie(this,t,(n=>{this.h._addUintToInputStream(e,n,r)}))}addStringToStream(e,t,r){ie(this,t,(n=>{ie(this,e,(i=>{this.h._addStringToInputStream(i,n,r)}))}))}addStringRecordToStream(e,t,r){ie(this,t,(n=>{H0(this,Object.keys(e),(i=>{H0(this,Object.values(e),(o=>{this.h._addFlatHashMapToInputStream(i,o,Object.keys(e).length,n,r)}))}))}))}addProtoToStream(e,t,r,n){ie(this,r,(i=>{ie(this,t,(o=>{let s=this.h._malloc(e.length);this.h.HEAPU8.set(e,s),this.h._addProtoToInputStream(s,e.length,o,i,n),this.h._free(s)}))}))}addEmptyPacketToStream(e,t){ie(this,e,(r=>{this.h._addEmptyPacketToInputStream(r,t)}))}addBoolVectorToStream(e,t,r){ie(this,t,(n=>{let i=this.h._allocateBoolVector(e.length);if(!i)throw Error("Unable to allocate new bool vector on heap.");for(let o of e)this.h._addBoolVectorEntry(i,o);this.h._addBoolVectorToInputStream(i,n,r)}))}addDoubleVectorToStream(e,t,r){ie(this,t,(n=>{let i=this.h._allocateDoubleVector(e.length);if(!i)throw Error("Unable to allocate new double vector on heap.");for(let o of e)this.h._addDoubleVectorEntry(i,o);this.h._addDoubleVectorToInputStream(i,n,r)}))}addFloatVectorToStream(e,t,r){ie(this,t,(n=>{let i=this.h._allocateFloatVector(e.length);if(!i)throw Error("Unable to allocate new float vector on heap.");for(let o of e)this.h._addFloatVectorEntry(i,o);this.h._addFloatVectorToInputStream(i,n,r)}))}addIntVectorToStream(e,t,r){ie(this,t,(n=>{let i=this.h._allocateIntVector(e.length);if(!i)throw Error("Unable to allocate new int vector on heap.");for(let o of e)this.h._addIntVectorEntry(i,o);this.h._addIntVectorToInputStream(i,n,r)}))}addUintVectorToStream(e,t,r){ie(this,t,(n=>{let i=this.h._allocateUintVector(e.length);if(!i)throw Error("Unable to allocate new unsigned int vector on heap.");for(let o of e)this.h._addUintVectorEntry(i,o);this.h._addUintVectorToInputStream(i,n,r)}))}addStringVectorToStream(e,t,r){ie(this,t,(n=>{let i=this.h._allocateStringVector(e.length);if(!i)throw Error("Unable to allocate new string vector on heap.");for(let o of e)ie(this,o,(s=>{this.h._addStringVectorEntry(i,s)}));this.h._addStringVectorToInputStream(i,n,r)}))}addBoolToInputSidePacket(e,t){ie(this,t,(r=>{this.h._addBoolToInputSidePacket(e,r)}))}addDoubleToInputSidePacket(e,t){ie(this,t,(r=>{this.h._addDoubleToInputSidePacket(e,r)}))}addFloatToInputSidePacket(e,t){ie(this,t,(r=>{this.h._addFloatToInputSidePacket(e,r)}))}addIntToInputSidePacket(e,t){ie(this,t,(r=>{this.h._addIntToInputSidePacket(e,r)}))}addUintToInputSidePacket(e,t){ie(this,t,(r=>{this.h._addUintToInputSidePacket(e,r)}))}addStringToInputSidePacket(e,t){ie(this,t,(r=>{ie(this,e,(n=>{this.h._addStringToInputSidePacket(n,r)}))}))}addProtoToInputSidePacket(e,t,r){ie(this,r,(n=>{ie(this,t,(i=>{let o=this.h._malloc(e.length);this.h.HEAPU8.set(e,o),this.h._addProtoToInputSidePacket(o,e.length,i,n),this.h._free(o)}))}))}addBoolVectorToInputSidePacket(e,t){ie(this,t,(r=>{let n=this.h._allocateBoolVector(e.length);if(!n)throw Error("Unable to allocate new bool vector on heap.");for(let i of e)this.h._addBoolVectorEntry(n,i);this.h._addBoolVectorToInputSidePacket(n,r)}))}addDoubleVectorToInputSidePacket(e,t){ie(this,t,(r=>{let n=this.h._allocateDoubleVector(e.length);if(!n)throw Error("Unable to allocate new double vector on heap.");for(let i of e)this.h._addDoubleVectorEntry(n,i);this.h._addDoubleVectorToInputSidePacket(n,r)}))}addFloatVectorToInputSidePacket(e,t){ie(this,t,(r=>{let n=this.h._allocateFloatVector(e.length);if(!n)throw Error("Unable to allocate new float vector on heap.");for(let i of e)this.h._addFloatVectorEntry(n,i);this.h._addFloatVectorToInputSidePacket(n,r)}))}addIntVectorToInputSidePacket(e,t){ie(this,t,(r=>{let n=this.h._allocateIntVector(e.length);if(!n)throw Error("Unable to allocate new int vector on heap.");for(let i of e)this.h._addIntVectorEntry(n,i);this.h._addIntVectorToInputSidePacket(n,r)}))}addUintVectorToInputSidePacket(e,t){ie(this,t,(r=>{let n=this.h._allocateUintVector(e.length);if(!n)throw Error("Unable to allocate new unsigned int vector on heap.");for(let i of e)this.h._addUintVectorEntry(n,i);this.h._addUintVectorToInputSidePacket(n,r)}))}addStringVectorToInputSidePacket(e,t){ie(this,t,(r=>{let n=this.h._allocateStringVector(e.length);if(!n)throw Error("Unable to allocate new string vector on heap.");for(let i of e)ie(this,i,(o=>{this.h._addStringVectorEntry(n,o)}));this.h._addStringVectorToInputSidePacket(n,r)}))}attachBoolListener(e,t){yn(this,e,t),ie(this,e,(r=>{this.h._attachBoolListener(r)}))}attachBoolVectorListener(e,t){Gn(this,e,t),ie(this,e,(r=>{this.h._attachBoolVectorListener(r)}))}attachIntListener(e,t){yn(this,e,t),ie(this,e,(r=>{this.h._attachIntListener(r)}))}attachIntVectorListener(e,t){Gn(this,e,t),ie(this,e,(r=>{this.h._attachIntVectorListener(r)}))}attachUintListener(e,t){yn(this,e,t),ie(this,e,(r=>{this.h._attachUintListener(r)}))}attachUintVectorListener(e,t){Gn(this,e,t),ie(this,e,(r=>{this.h._attachUintVectorListener(r)}))}attachDoubleListener(e,t){yn(this,e,t),ie(this,e,(r=>{this.h._attachDoubleListener(r)}))}attachDoubleVectorListener(e,t){Gn(this,e,t),ie(this,e,(r=>{this.h._attachDoubleVectorListener(r)}))}attachFloatListener(e,t){yn(this,e,t),ie(this,e,(r=>{this.h._attachFloatListener(r)}))}attachFloatVectorListener(e,t){Gn(this,e,t),ie(this,e,(r=>{this.h._attachFloatVectorListener(r)}))}attachStringListener(e,t){yn(this,e,t),ie(this,e,(r=>{this.h._attachStringListener(r)}))}attachStringVectorListener(e,t){Gn(this,e,t),ie(this,e,(r=>{this.h._attachStringVectorListener(r)}))}attachProtoListener(e,t,r){yn(this,e,t),ie(this,e,(n=>{this.h._attachProtoListener(n,r||!1)}))}attachProtoVectorListener(e,t,r){Gn(this,e,t),ie(this,e,(n=>{this.h._attachProtoVectorListener(n,r||!1)}))}attachAudioListener(e,t,r){this.h._attachAudioListener||console.warn('Attempting to use attachAudioListener without support for output audio. Is build dep ":gl_graph_runner_audio_out" missing?'),yn(this,e,((n,i)=>{n=new Float32Array(n.buffer,n.byteOffset,n.length/4),t(n,i)})),ie(this,e,(n=>{this.h._attachAudioListener(n,r||!1)}))}finishProcessing(){this.h._waitUntilIdle()}closeGraph(){this.h._closeGraph(),this.h.simpleListeners=void 0,this.h.emptyPacketListeners=void 0}}),l2=class extends h3{};async function d3(e,t,r){return e=await(async(n,i,o,s)=>{if(i&&await V0(i),!self.ModuleFactory||o&&(await V0(o),!self.ModuleFactory))throw Error("ModuleFactory not set.");return self.Module&&s&&((i=self.Module).locateFile=s.locateFile,s.mainScriptUrlOrBlob&&(i.mainScriptUrlOrBlob=s.mainScriptUrlOrBlob)),s=await self.ModuleFactory(self.Module||s),self.ModuleFactory=self.Module=void 0,new n(s,null)})(e,t.wasmLoaderPath,t.assetLoaderPath,{locateFile:n=>n.endsWith(".wasm")?t.wasmBinaryPath.toString():t.assetBinaryPath&&n.endsWith(".data")?t.assetBinaryPath.toString():n}),await e.o(r),e}async function h2(e,t,r){return d3(e,t,r)}function Fd(e,t){let r=wr(e.baseOptions,ac,1)||new ac;typeof t=="string"?(pt(r,2,nc(t)),pt(r,1)):t instanceof Uint8Array&&(pt(r,1,r1(t,!1)),pt(r,2)),Sr(e.baseOptions,0,1,r)}function d2(e,t){let r=t.baseOptions||{};if(t.baseOptions?.modelAssetBuffer&&t.baseOptions?.modelAssetPath)throw Error("Cannot set both baseOptions.modelAssetPath and baseOptions.modelAssetBuffer");if(!(wr(e.baseOptions,ac,1)?.g()||wr(e.baseOptions,ac,1)?.i()||t.baseOptions?.modelAssetBuffer||t.baseOptions?.modelAssetPath))throw Error("Either baseOptions.modelAssetPath or baseOptions.modelAssetBuffer must be set");if((function(n,i){let o=wr(n.baseOptions,U0,3);if(!o){var s=o=new U0;Dd(s,4,new D0)}"delegate"in i&&(i.delegate==="GPU"?Dd(i=o,2,s=new Q_):Dd(i=o,4,s=new D0)),Sr(n.baseOptions,0,3,o)})(e,r),r.modelAssetPath)return fetch(r.modelAssetPath.toString()).then((n=>{if(n.ok)return n.arrayBuffer();throw Error(`Failed to fetch model: ${r.modelAssetPath} (${n.status})`)})).then((n=>{try{e.g.h.FS_unlink("/model.dat")}catch{}e.g.h.FS_createDataFile("/","model.dat",new Uint8Array(n),!0,!1,!1),Fd(e,"/model.dat"),e.v()}));if(r.modelAssetBuffer instanceof Uint8Array)Fd(e,r.modelAssetBuffer);else if(r.modelAssetBuffer)return(async function(n){let i=[];for(var o=0;;){let{done:s,value:a}=await n.read();if(s)break;i.push(a),o+=a.length}if(i.length===0)return new Uint8Array(0);if(i.length===1)return i[0];n=new Uint8Array(o),o=0;for(let s of i)n.set(s,o),o+=s.length;return n})(r.modelAssetBuffer).then((n=>{Fd(e,n),e.v()}));return e.v(),Promise.resolve()}function W0(e){try{let t=e.j.length;if(t===1)throw Error(e.j[0].message);if(t>1)throw Error("Encountered multiple errors: "+e.j.map((r=>r.message)).join(", "))}finally{e.j=[]}}function qi(e,t){e.s=Math.max(e.s,t)}var Qa=class{constructor(e){this.g=e,this.j=[],this.s=0,this.g.setAutoRenderToScreen(!1)}setGraph(e,t){this.g.attachErrorListener(((r,n)=>{this.j.push(Error(n))})),this.g.N(),this.g.setGraph(e,t),W0(this)}finishProcessing(){this.g.finishProcessing(),W0(this)}close(){this.g.closeGraph()}};async function Xo(e,t,r){return h2(e,t,r)}Qa.prototype.close=Qa.prototype.close,(function(e,t){e=e.split(".");var r,n=Kn;for((e[0]in n)||n.execScript===void 0||n.execScript("var "+e[0]);e.length&&(r=e.shift());)e.length||t===void 0?n=n[r]&&n[r]!==Object.prototype[r]?n[r]:n[r]={}:n[r]=t})("TaskRunner",Qa);var lc=class extends Qa{constructor(){super(...arguments),this.F=48e3}O(e){this.F=e}};function u3(e){let t={classifications:hu(e,o3).map((r=>(function(n,i=-1,o=""){return{categories:n.map((s=>{var a=Xn(_r(s,1))??0??-1;let c=s.l,l=0|c[se],h=Zn(c,l,2),d=Qo(h);return d!=null&&d!==h&&lt(c,l,2,d),{index:a,score:d??0??0,categoryName:Sn(_r(s,3))??""??"",displayName:Sn(_r(s,4))??""??""}})),headIndex:i,headName:o}})(wr(r,t3,4)?.g()??[],Xn(_r(r,2))??0,Sn(_r(r,3))??"")))};return zd(_r(e,2))!=null&&(t.timestampMs=zd(_r(e,2))??0),t}lc.prototype.setDefaultSampleRate=lc.prototype.O;var or=class extends lc{constructor(e,t){super(new l2(e,t)),this.m=[],Sr(e=this.i=new o2,0,1,t=new cc)}get baseOptions(){return wr(this.i,cc,1)}set baseOptions(e){Sr(this.i,0,1,e)}o(e){var t=this.i,r=wr(this.i,M0,2);if(r=r?m1(r):new M0,e.displayNamesLocale!==void 0?pt(r,1,nc(e.displayNamesLocale)):e.displayNamesLocale===void 0&&pt(r,1),e.maxResults!==void 0){var n=e.maxResults;if(n!=null){if(typeof n!="number"||!pc(n))throw p0();n|=0}pt(r,2,n)}else"maxResults"in e&&pt(r,2);if(e.scoreThreshold!==void 0){if((n=e.scoreThreshold)!=null&&typeof n!="number")throw Error(`Value of float/double field must be a number, found ${typeof n}: ${n}`);pt(r,3,n)}else"scoreThreshold"in e&&pt(r,3);return e.categoryAllowlist!==void 0?S0(r,4,e.categoryAllowlist):"categoryAllowlist"in e&&pt(r,4),e.categoryDenylist!==void 0?S0(r,5,e.categoryDenylist):"categoryDenylist"in e&&pt(r,5),Sr(t,0,2,r),d2(this,e)}K(e,t){return this.D(e,t??this.F,this.s+1)}D(e,t,r){return this.g.addDoubleToStream(t,"sample_rate",r),this.g.addAudioToStreamWithShape(e,1,e.length,"audio_in",r),this.m=[],this.finishProcessing(),[...this.m]}v(){var e=new Au;Ot(e,10,"audio_in"),Ot(e,10,"sample_rate"),Ot(e,15,"timestamped_classifications");let t=new n2;I1(t,n3,this.i);let r=new xu;b1(r,nc("mediapipe.tasks.audio.audio_classifier.AudioClassifierGraph")),Ot(r,3,"AUDIO:audio_in"),Ot(r,3,"SAMPLE_RATE:sample_rate"),Ot(r,4,"TIMESTAMPED_CLASSIFICATIONS:timestamped_classifications"),r.o(t),S1(e,r),this.g.attachProtoVectorListener("timestamped_classifications",((n,i)=>{(function(o,s){s.forEach((a=>{a=s3(a),o.m.push(u3(a))}))})(this,n),qi(this,i)})),this.g.attachEmptyPacketListener("timestamped_classifications",(n=>{qi(this,n)})),e=e.g(),this.setGraph(new Uint8Array(e),!0)}};function $0(e){return{embeddings:hu(e,c3).map((t=>{let r={headIndex:Xn(_r(t,3))??0??-1,headName:Sn(_r(t,4))??""??""};if(_1(t,z0,Pd(t,1))!==void 0)r.floatEmbedding=y1(wr(t,z0,Pd(t,1)),1,Qo,n1===void 0?2:4).slice();else{let n=new Uint8Array(0);r.quantizedEmbedding=wr(t,a3,Pd(t,2))?.J()?.i()??n}return r})),timestampMs:zd(_r(e,2))??0}}or.prototype.classify=or.prototype.K,or.prototype.setOptions=or.prototype.o,or.createFromModelPath=function(e,t){return h2(or,e,{baseOptions:{modelAssetPath:t}})},or.createFromModelBuffer=function(e,t){return Xo(or,e,{baseOptions:{modelAssetBuffer:t}})},or.createFromOptions=function(e,t){return Xo(or,e,t)};var Mr=class extends lc{constructor(e,t){super(new l2(e,t)),this.m=[],Sr(e=this.i=new a2,0,1,t=new cc)}get baseOptions(){return wr(this.i,cc,1)}set baseOptions(e){Sr(this.i,0,1,e)}o(e){var t=this.i,r=wr(this.i,N0,2);return r=r?m1(r):new N0,e.l2Normalize!==void 0?pt(r,1,_0(e.l2Normalize)):"l2Normalize"in e&&pt(r,1),e.quantize!==void 0?pt(r,2,_0(e.quantize)):"quantize"in e&&pt(r,2),Sr(t,0,2,r),d2(this,e)}L(e,t){return this.D(e,t??this.F,this.s+1)}D(e,t,r){return this.g.addDoubleToStream(t,"sample_rate",r),this.g.addAudioToStreamWithShape(e,1,e.length,"audio_in",r),this.m=[],this.finishProcessing(),this.m}v(){var e=new Au;Ot(e,10,"audio_in"),Ot(e,10,"sample_rate"),Ot(e,15,"embeddings_out"),Ot(e,15,"timestamped_embeddings_out");let t=new n2;I1(t,i3,this.i);let r=new xu;b1(r,nc("mediapipe.tasks.audio.audio_embedder.AudioEmbedderGraph")),Ot(r,3,"AUDIO:audio_in"),Ot(r,3,"SAMPLE_RATE:sample_rate"),Ot(r,4,"EMBEDDINGS:embeddings_out"),Ot(r,4,"TIMESTAMPED_EMBEDDINGS:timestamped_embeddings_out"),r.o(t),S1(e,r),this.g.attachProtoListener("embeddings_out",((n,i)=>{n=j0(n),this.m.push($0(n)),qi(this,i)})),this.g.attachEmptyPacketListener("embeddings_out",(n=>{qi(this,n)})),this.g.attachProtoVectorListener("timestamped_embeddings_out",((n,i)=>{for(let o of n)n=j0(o),this.m.push($0(n));qi(this,i)})),this.g.attachEmptyPacketListener("timestamped_embeddings_out",(n=>{qi(this,n)})),e=e.g(),this.setGraph(new Uint8Array(e),!0)}},Ya;Mr.prototype.embed=Mr.prototype.L,Mr.prototype.setOptions=Mr.prototype.o,Mr.createFromModelPath=function(e,t){return Xo(Mr,e,{baseOptions:{modelAssetPath:t}})},Mr.createFromModelBuffer=function(e,t){return Xo(Mr,e,{baseOptions:{modelAssetBuffer:t}})},Mr.createFromOptions=function(e,t){return Xo(Mr,e,t)};var f3=new Uint8Array([0,97,115,109,1,0,0,0,1,5,1,96,0,1,123,3,2,1,0,10,10,1,8,0,65,0,253,15,253,98,11]);async function u2(){if(Ya===void 0)try{await WebAssembly.instantiate(f3),Ya=!0}catch{Ya=!1}return Ya}async function Wo(e,t=Z_``){let r=await u2()?"wasm_internal":"wasm_nosimd_internal";return{wasmLoaderPath:`${t}/${e}_${r}.js`,wasmBinaryPath:`${t}/${e}_${r}.wasm`}}var bn=class{};bn.forVisionTasks=function(e){return Wo("vision",e)},bn.forTextTasks=function(e){return Wo("text",e)},bn.forGenAiExperimentalTasks=function(e){return Wo("genai_experimental",e)},bn.forGenAiTasks=function(e){return Wo("genai",e)},bn.forAudioTasks=function(e){return Wo("audio",e)},bn.isSimdSupported=function(){return u2()};function p3(e,t){let r=e.reduce((a,c)=>a+c.length,0),n=new ArrayBuffer(44+r*2),i=new DataView(n),o=(a,c,l)=>{for(let h=0;h<l.length;h++)a.setUint8(c+h,l.charCodeAt(h))};o(i,0,"RIFF"),i.setUint32(4,36+r*2,!0),o(i,8,"WAVE"),o(i,12,"fmt "),i.setUint32(16,16,!0),i.setUint16(20,1,!0),i.setUint16(22,1,!0),i.setUint32(24,t,!0),i.setUint32(28,t*2,!0),i.setUint16(32,2,!0),i.setUint16(34,16,!0),o(i,36,"data"),i.setUint32(40,r*2,!0);let s=44;for(let a of e)for(let c=0;c<a.length;c++){let l=Math.max(-1,Math.min(1,a[c]));i.setInt16(s,l<0?l*32768:l*32767,!0),s+=2}return new Blob([i],{type:"audio/wav"})}var Ac=class{constructor(t,r,n,i,o,s,a){this.recordingInProgress=!1;this.recordIndex=1;this.countLoopTimes=0;this.examStartTime=0;this.recordingStartTime=0;this.recordingEndTime=0;this.isSpeech=!1;this.preRollBuffer=[];this.recordingChunks=[];this.PRE_ROLL_SECONDS=2;this.SAMPLE_RATE=16e3;this.MAX_PRE_ROLL_CHUNKS=4;this.lastNoiseTime=0;this.SILENCE_THRESHOLD=3e3;this.optionsProctoring=t,this.proctoringSession=r,this.paramsConfig=n,this.cameraRecorder=i,this.onRealtimeAlertsCallback=o,this.backend=s,this.backendToken=a}setProctoringId(t){this.proctoringId=t,this.proctoringId&&this.backend&&(this.upload=new Yr(this.proctoringId,this.backend))}async startRecording(){this.examStartTime=Date.now(),await this.createAudioClassifier(),this.audioRecorder=new Ga(void 0,this.paramsConfig.audioBehaviourParameters),this.intervalNoiseDetection=setInterval(()=>this.onNoiseDetectedRecord(),200),this.streamingAudioClassification()}async stopRecording(){clearInterval(this.intervalNoiseDetection),await this.stopSoundRecord(),await this.volumeMeter&&this.volumeMeter.stop(),this.audioWorkletNode&&this.audioWorkletNode.disconnect(),this.context&&this.context.close()}async pauseRecording(){}async resumeRecording(){}async saveOnSession(t){}async onNoiseDetectedRecord(){!this.volumeMeter&&this.cameraRecorder.cameraStream&&(this.volumeMeter=new gn(this.cameraRecorder.cameraStream),this.volumeMeter.start().catch(i=>{console.log(i),this.volumeMeter=void 0}));let t=this.paramsConfig.audioBehaviourParameters?.noiseLimit||40,r=this.volumeMeter?.getVolume()||0;this.isSpeech=this.isSpeech||this.hasDesiredResult(this.audioClassificationResult),!this.isSpeech&&!this.recordingInProgress&&(t=t*1.25);let n=r>=t;if(n&&(this.lastNoiseTime=Date.now()),n&&!this.recordingInProgress){this.recordingInProgress=!0,this.recordingChunks=[...this.preRollBuffer];let o=this.preRollBuffer.reduce((a,c)=>a+c.length,0)/this.SAMPLE_RATE*1e3,s=Date.now()-this.examStartTime;this.recordingStartTime=s-o,this.recordingStartTime<0&&(this.recordingStartTime=0)}else if(this.recordingInProgress){let i=Date.now()-this.lastNoiseTime,o=Date.now()-this.recordingStartTime;i>=this.SILENCE_THRESHOLD&&o>=3e3&&this.countLoopTimes>4&&(await this.stopSoundRecord(),this.paramsConfig.videoBehaviourParameters?.detectNoise&&!this.isSpeech&&this.onRealtimeAlertsCallback({status:"ALERT",description:"Barulho detectado",type:"audio_detection_on_stream"}),this.paramsConfig.videoBehaviourParameters?.detectSpeech&&this.isSpeech&&this.onRealtimeAlertsCallback({status:"ALERT",description:"Fala detectada",type:"audio_detection_on_stream"}),this.recordingInProgress=!1,this.recordIndex++,this.countLoopTimes=0,this.isSpeech=!1),this.countLoopTimes++}}async stopSoundRecord(){if(!this.recordingInProgress&&this.recordingChunks.length===0||(this.recordingEndTime=Date.now()-this.examStartTime,this.optionsProctoring.proctoringType!=="REALTIME"))return;let t=p3(this.recordingChunks,this.SAMPLE_RATE),r=new File([t],`EP_${this.proctoringSession.id}_${this.recordingStartTime}_${this.recordingEndTime}_${this.isSpeech?"speech":"noise"}.wav`,{type:"audio/wav"});this.uploadRecord(r),this.recordingChunks=[],this.recordingInProgress=!1}download(t){let r=URL.createObjectURL(t),n=document.createElement("a");document.body.appendChild(n),n.style.display="none",n.href=r,n.download=t.name,n.click(),window.URL.revokeObjectURL(r)}uploadRecord(t){t&&this.upload&&this.backendToken&&this.upload.upload({file:t},this.backendToken)}hasDesiredResult(t){if(t==null)return!1;for(let r of t){let n=r.name.toLowerCase().includes("speech");if(this.optionsProctoring.proctoringType!=="REALTIME")return n;let i=parseFloat(r.score)>.22;if(n&&i)return!0}return!1}async createAudioClassifier(){let t=await bn.forAudioTasks("https://cdn.jsdelivr.net/npm/@mediapipe/tasks-audio@0.10.0/wasm");this.audioClassifier=await or.createFromOptions(t,{scoreThreshold:.15,maxResults:1,baseOptions:{modelAssetPath:"https://storage.googleapis.com/mediapipe-models/audio_classifier/yamnet/float32/1/yamnet.tflite"}})}async streamingAudioClassification(){this.context=new AudioContext({sampleRate:this.SAMPLE_RATE});try{await this.context.audioWorklet.addModule(URL.createObjectURL(new Blob([m3],{type:"text/javascript"})))}catch{throw new Error("\u274C Error loading audio worklet module")}let t=this.context.createMediaStreamSource(this.cameraRecorder.cameraStream);this.audioWorkletNode=new AudioWorkletNode(this.context,"audio-processor"),this.audioWorkletNode.port.onmessage=r=>{let n=r.data;this.preRollBuffer.push(n),this.preRollBuffer.length>this.MAX_PRE_ROLL_CHUNKS&&this.preRollBuffer.shift(),this.recordingInProgress&&this.recordingChunks.push(n);let o=this.audioClassifier.classify(n)[0].classifications[0].categories;o.length>0&&(this.audioClassificationResult=[{name:o[0].categoryName,score:o[0].score.toFixed(3)}])},t.connect(this.audioWorkletNode),this.audioWorkletNode.connect(this.context.destination)}},m3=`
438
438
  class AudioProcessor extends AudioWorkletProcessor {
439
439
  bufferSize;
440
440
  inputBuffer;