easyproctor-hml 2.5.12 → 2.5.13

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
@@ -10598,7 +10598,6 @@ Setting: ${JSON.stringify(settings, null, 2)}`
10598
10598
  const video = document.createElement("video");
10599
10599
  video.srcObject = this.internalClonedStream;
10600
10600
  video.muted = true;
10601
- video.playsInline = true;
10602
10601
  video.play();
10603
10602
  const canvas = document.createElement("canvas");
10604
10603
  const ctx = canvas.getContext("2d");
@@ -11013,9 +11012,6 @@ var DeviceCheckerUI = class {
11013
11012
  const center = document.createElement("div");
11014
11013
  video.setAttribute("id", "cameraStream");
11015
11014
  video.muted = true;
11016
- video.setAttribute("playsinline", "true");
11017
- video.setAttribute("webkit-playsinline", "true");
11018
- video.autoplay = true;
11019
11015
  const divCameraStyles = {
11020
11016
  width: "100%",
11021
11017
  display: "flex",
@@ -19458,10 +19454,10 @@ Upload Services: ${uploaderServices}`,
19458
19454
  });
19459
19455
  }
19460
19456
  await this.backend.finishAndSendUrls(this.context).then((finishResponse) => {
19461
- var _a2, _b;
19457
+ var _a2, _b, _c2, _d;
19462
19458
  trackers.registerFinish(this.proctoringSession.id, true, "");
19463
19459
  console.log("finishResponse: ", finishResponse);
19464
- options.onFinish && options.onFinish((_a2 = finishResponse == null ? void 0 : finishResponse.score) != null ? _a2 : 100, (_b = finishResponse == null ? void 0 : finishResponse.approved) != null ? _b : true);
19460
+ options.onFinish && options.onFinish((_a2 = finishResponse == null ? void 0 : finishResponse.score) != null ? _a2 : 100, (_b = finishResponse == null ? void 0 : finishResponse.scoreThreshold) != null ? _b : 70, (_c2 = finishResponse == null ? void 0 : finishResponse.approved) != null ? _c2 : true, (_d = finishResponse == null ? void 0 : finishResponse.justification) != null ? _d : "");
19465
19461
  }).catch((error) => {
19466
19462
  trackers.registerFinish(
19467
19463
  this.proctoringSession.id,
package/index.js CHANGED
@@ -28695,7 +28695,6 @@ Setting: ${JSON.stringify(settings, null, 2)}`
28695
28695
  const video = document.createElement("video");
28696
28696
  video.srcObject = this.internalClonedStream;
28697
28697
  video.muted = true;
28698
- video.playsInline = true;
28699
28698
  video.play();
28700
28699
  const canvas = document.createElement("canvas");
28701
28700
  const ctx = canvas.getContext("2d");
@@ -29110,9 +29109,6 @@ var DeviceCheckerUI = class {
29110
29109
  const center = document.createElement("div");
29111
29110
  video.setAttribute("id", "cameraStream");
29112
29111
  video.muted = true;
29113
- video.setAttribute("playsinline", "true");
29114
- video.setAttribute("webkit-playsinline", "true");
29115
- video.autoplay = true;
29116
29112
  const divCameraStyles = {
29117
29113
  width: "100%",
29118
29114
  display: "flex",
@@ -34707,10 +34703,10 @@ Upload Services: ${uploaderServices}`,
34707
34703
  });
34708
34704
  }
34709
34705
  await this.backend.finishAndSendUrls(this.context).then((finishResponse) => {
34710
- var _a2, _b;
34706
+ var _a2, _b, _c2, _d;
34711
34707
  trackers.registerFinish(this.proctoringSession.id, true, "");
34712
34708
  console.log("finishResponse: ", finishResponse);
34713
- options.onFinish && options.onFinish((_a2 = finishResponse == null ? void 0 : finishResponse.score) != null ? _a2 : 100, (_b = finishResponse == null ? void 0 : finishResponse.approved) != null ? _b : true);
34709
+ options.onFinish && options.onFinish((_a2 = finishResponse == null ? void 0 : finishResponse.score) != null ? _a2 : 100, (_b = finishResponse == null ? void 0 : finishResponse.scoreThreshold) != null ? _b : 70, (_c2 = finishResponse == null ? void 0 : finishResponse.approved) != null ? _c2 : true, (_d = finishResponse == null ? void 0 : finishResponse.justification) != null ? _d : "");
34714
34710
  }).catch((error) => {
34715
34711
  trackers.registerFinish(
34716
34712
  this.proctoringSession.id,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "easyproctor-hml",
3
- "version": "2.5.12",
3
+ "version": "2.5.13",
4
4
  "description": "Modulo web de gravação do EasyProctor",
5
5
  "main": "./index.js",
6
6
  "module": "./esm/index.js",
@@ -15,7 +15,7 @@ export interface ProctoringContext {
15
15
  }
16
16
  export interface ProctoringFinisherOptions {
17
17
  onProgress?: (percentage: number) => void;
18
- onFinish?: (score: number, approved: boolean) => void;
18
+ onFinish?: (score: number, scoreThreshold: number, approved: boolean, justification: string) => void;
19
19
  }
20
20
  export interface ProctoringChangeDevicesOptions {
21
21
  status?: (devices: DevicesChanged) => void;
@@ -80,7 +80,7 @@ Setting: ${JSON.stringify(a,null,2)}`),Bg;this.paramsConfig.imageBehaviourParame
80
80
  Sample Size: ${n.sampleSize}
81
81
 
82
82
  Video:
83
- ${JSON.stringify(this.recorderOptions)}`,file:new File(this.blobs,`EP_${t.id}_camera_0.webm`,{type:this.recorderOptions?.mimeType||"video/webm"}),origin:"Camera"})}async getFile(t,r,n){return new Promise((o,i)=>{t.length>5&&fetch(t).then(s=>s.blob()).then(s=>{let a=new File([s],r,{type:n});o(a)}).catch(s=>{i(s)})})}onNoiseDetected(){if(this.options.proctoringType==="REALTIME")return;!this.volumeMeter&&this.cameraStream&&(this.volumeMeter=new xr(this.cameraStream),this.volumeMeter.start().catch(r=>{console.log(r),this.volumeMeter=void 0})),(this.volumeMeter?.getVolume()??0)>=(this.paramsConfig.audioBehaviourParameters?.noiseLimit||40)&&(console.log("entrou"+this.noiseWait),this.noiseWait>=20&&(this.options.onRealtimeAlertsCallback({status:"ALERT",description:"Barulho detectado",type:"audio_detection_on_stream"}),this.noiseWait=0)),this.noiseWait++}createRotatedStream(t){this.internalClonedStream=t.clone();let r=document.createElement("video");r.srcObject=this.internalClonedStream,r.muted=!0,r.playsInline=!0,r.play();let n=document.createElement("canvas"),o=n.getContext("2d"),s=t.getVideoTracks()[0].getSettings(),a=s.width||640,c=s.height||480;n.width=c,n.height=a;let l=()=>{r.paused||r.ended||this.isCanvasLoopActive&&(o&&(o.clearRect(0,0,n.width,n.height),o.drawImage(r,0,0,n.width,n.height)),this.isCanvasLoopActive&&(this.animationFrameId=requestAnimationFrame(l)))};r.onplaying=()=>{this.isCanvasLoopActive=!0,l()};let h=n.captureStream(30);return t.getAudioTracks().forEach(d=>{h.addTrack(d)}),h}};var fa=class{constructor(t=mt,r){this.videoOptions={width:1080,height:720,minWidth:0,minHeight:0};this.options={...mt,...t,captureScreen:!1,allowMultipleMonitors:!0,allowOnlyFirstMonitor:!1},this.videoOptions={...this.videoOptions,...r}}checkDevicesInterface(){this.addStyleMask();let t=document.createElement("style");t.type="text/css",t.innerHTML=`
83
+ ${JSON.stringify(this.recorderOptions)}`,file:new File(this.blobs,`EP_${t.id}_camera_0.webm`,{type:this.recorderOptions?.mimeType||"video/webm"}),origin:"Camera"})}async getFile(t,r,n){return new Promise((o,i)=>{t.length>5&&fetch(t).then(s=>s.blob()).then(s=>{let a=new File([s],r,{type:n});o(a)}).catch(s=>{i(s)})})}onNoiseDetected(){if(this.options.proctoringType==="REALTIME")return;!this.volumeMeter&&this.cameraStream&&(this.volumeMeter=new xr(this.cameraStream),this.volumeMeter.start().catch(r=>{console.log(r),this.volumeMeter=void 0})),(this.volumeMeter?.getVolume()??0)>=(this.paramsConfig.audioBehaviourParameters?.noiseLimit||40)&&(console.log("entrou"+this.noiseWait),this.noiseWait>=20&&(this.options.onRealtimeAlertsCallback({status:"ALERT",description:"Barulho detectado",type:"audio_detection_on_stream"}),this.noiseWait=0)),this.noiseWait++}createRotatedStream(t){this.internalClonedStream=t.clone();let r=document.createElement("video");r.srcObject=this.internalClonedStream,r.muted=!0,r.play();let n=document.createElement("canvas"),o=n.getContext("2d"),s=t.getVideoTracks()[0].getSettings(),a=s.width||640,c=s.height||480;n.width=c,n.height=a;let l=()=>{r.paused||r.ended||this.isCanvasLoopActive&&(o&&(o.clearRect(0,0,n.width,n.height),o.drawImage(r,0,0,n.width,n.height)),this.isCanvasLoopActive&&(this.animationFrameId=requestAnimationFrame(l)))};r.onplaying=()=>{this.isCanvasLoopActive=!0,l()};let h=n.captureStream(30);return t.getAudioTracks().forEach(d=>{h.addTrack(d)}),h}};var fa=class{constructor(t=mt,r){this.videoOptions={width:1080,height:720,minWidth:0,minHeight:0};this.options={...mt,...t,captureScreen:!1,allowMultipleMonitors:!0,allowOnlyFirstMonitor:!1},this.videoOptions={...this.videoOptions,...r}}checkDevicesInterface(){this.addStyleMask();let t=document.createElement("style");t.type="text/css",t.innerHTML=`
84
84
  .alert-div {
85
85
  display: flex;
86
86
  align-items: center;
@@ -360,7 +360,7 @@ Setting: ${JSON.stringify(a,null,2)}`),Bg;this.paramsConfig.imageBehaviourParame
360
360
  height: 50px !important;
361
361
  }
362
362
  }
363
- `,document.getElementsByTagName("head")[0].appendChild(t);let r=document.createElement("div");r.setAttribute("id","checkDevices");let n={backgroundColor:"rgba(0,0,0,0.4)",zIndex:"1000",position:"fixed",top:"0",left:"0",height:"100vh",width:"100%",maxWidth:"100vw",display:"flex",alignItems:"center",justifyContent:"center",overflow:"auto",boxSizing:"border-box"};this.applyStyles(r,n);let o=document.createElement("div");o.setAttribute("class","modal-responsive");let i={backgroundColor:"#fff",zIndex:"1001",width:"90%",maxWidth:"600px",borderRadius:"10px",display:"flex",flexDirection:"column",alignItems:"center",boxSizing:"border-box",overflow:"hidden"};this.applyStyles(o,i);let s=document.createElement("h3");s.innerText="Checagem de dispositivos";let a={color:"rgba(0, 0, 0, .7)",fontWeight:"bold",fontSize:"20px",marginBottom:"15px",padding:"20px 0px",borderBottom:"2px solid rgba(0, 0, 0, .1)",width:"100%",textAlign:"center"};this.applyStyles(s,a),o.appendChild(s);let c=document.createElement("div");c.setAttribute("class","camera-header-responsive");let l=document.createElement("h3"),h=document.createElement("select");h.setAttribute("id","cameraSelect");let d={padding:"0 20px",width:"100%",display:"flex",justifyContent:"space-between",marginBottom:"15px"};this.applyStyles(c,d),l.innerText="C\xE2mera";let u={color:"rgba(0, 0, 0, .75)",fontWeight:"bold",fontSize:"16px"};this.applyStyles(l,u),h.style.maxWidth="400px",h.style.minWidth="150px",h.style.width="100%",h.style.boxSizing="border-box",c.appendChild(l),c.appendChild(h),o.appendChild(c);let b=document.createElement("div");b.setAttribute("id","liveCheckDevices"),b.setAttribute("class","camera-container-responsive");let m=document.createElement("div");m.setAttribute("class","video-responsive");let f=document.createElement("video"),y=document.createElement("div");f.setAttribute("id","cameraStream"),f.muted=!0,f.setAttribute("playsinline","true"),f.setAttribute("webkit-playsinline","true"),f.autoplay=!0;let v={width:"100%",display:"flex",justifyContent:"space-between",gap:"20px",borderBottom:"2px solid rgba(0, 0, 0, .1)",paddingBottom:"15px",paddingLeft:"20px",paddingRight:"20px",boxSizing:"border-box",transform:"rotateY(180deg)"};this.applyStyles(b,v);let _={width:"100%",maxWidth:"320px",height:"auto",maxHeight:"240px",objectFit:"contain",backgroundColor:"#000",borderRadius:"10px",marginBottom:"15px"};this.applyStyles(f,_),this.applyStyles(m,{position:"relative",width:"100%",maxWidth:"320px",maxHeight:"240px",boxSizing:"border-box"});let x=document.createElement("div");x.setAttribute("class","alert-div"),x.setAttribute("id","alertDivResolution");let B=document.createElement("error");B.setAttribute("id","resolutionAlert"),B.innerText="Resolu\xE7\xE3o m\xEDnima",B.style.marginLeft="10px",B.style.marginRight="5px";let O=document.createElement("span"),R=document.createElement("div"),ue=document.createElement("div");O.setAttribute("id","checkmark_resolution"),R.setAttribute("id","checkmark_stem_resolution"),ue.setAttribute("id","checkmark_kick_resolution"),O.appendChild(R),O.appendChild(ue);let se=document.createElement("span"),Vr=document.createElement("div"),Ui=document.createElement("div");se.setAttribute("class","info"),se.setAttribute("id","info_resolution"),Vr.setAttribute("class","info_stem"),Ui.setAttribute("class","info_kick"),se.appendChild(Vr),se.appendChild(Ui),x.appendChild(O),x.appendChild(B),x.appendChild(se);let Hr=document.createElement("div");Hr.setAttribute("class","alert-div"),Hr.setAttribute("id","alertDivFacePosition");let mn=document.createElement("error");mn.setAttribute("id","facePositionAlert"),mn.innerText="Posicionamento da face",mn.style.marginLeft="10px";let gn=document.createElement("span"),Ni=document.createElement("div"),ji=document.createElement("div");gn.setAttribute("id","checkmark_FacePosition"),Ni.setAttribute("id","checkmark_stem_FacePosition"),ji.setAttribute("id","checkmark_kick_FacePosition"),gn.appendChild(Ni),gn.appendChild(ji),Hr.appendChild(gn),Hr.appendChild(mn);let hr=document.createElement("div");hr.setAttribute("class","alert-div"),hr.setAttribute("id","alertDivAmbientVerify");let Vi=document.createElement("error");Vi.setAttribute("id","ambientVerifyAlert"),Vi.innerText="Verifica\xE7\xE3o do ambiente",Vi.style.marginLeft="10px";let Hi=document.createElement("span"),xu=document.createElement("div"),Au=document.createElement("div");Hi.setAttribute("id","checkmark_AmbientVerify"),xu.setAttribute("id","checkmark_stem_AmbientVerify"),Au.setAttribute("id","checkmark_kick_AmbientVerify"),Hi.appendChild(xu),Hi.appendChild(Au),hr.appendChild(Hi),hr.appendChild(Vi);let yn=document.createElement("div");yn.setAttribute("class","alert-div"),yn.setAttribute("id","alertDivSpyCam"),yn.style.display="none";let zi=document.createElement("error");zi.setAttribute("id","SpyCamAlert"),zi.innerText="Verifica\xE7\xE3o de Spy Cam",zi.style.marginLeft="10px";let Wi=document.createElement("span"),Tu=document.createElement("div"),Iu=document.createElement("div");Wi.setAttribute("id","checkmark_SpyCam"),Tu.setAttribute("id","checkmark_stem_SpyCam"),Iu.setAttribute("id","checkmark_kick_SpyCam"),Wi.appendChild(Tu),Wi.appendChild(Iu),yn.appendChild(Wi),yn.appendChild(zi),y.style.transform="rotateY(180deg)",y.style.display="flex",y.style.flexDirection="column",y.style.flex="1",y.style.minWidth="0",y.appendChild(x),y.appendChild(Hr),y.appendChild(hr),y.appendChild(yn),b.appendChild(y),m.appendChild(f),m.style.flexShrink="0",b.appendChild(m);let Xt=document.createElement("div");Xt.setAttribute("class","facial-biometry__mask"),Xt.style.width="100%",Xt.style.height="100%",Xt.style.position="absolute",Xt.style.top="0px",Xt.style.left="0px",Xt.style.backgroundColor="#fff",Xt.style.opacity="0.6";let dr=document.createElement("div");dr.setAttribute("class","biometry__frame"),dr.style.width="100%",dr.style.height="100%",dr.style.position="absolute",dr.style.top="0px",dr.style.left="0px",dr.style.zIndex="10",m.appendChild(Xt),m.appendChild(dr),o.appendChild(b);let xo=document.createElement("div");xo.setAttribute("class","mic-header-responsive");let Nc=document.createElement("h3"),bn=document.createElement("select");bn.setAttribute("id","micSelect");let ry={padding:"0 20px",width:"100%",display:"flex",justifyContent:"space-between",margin:"15px 0"};this.applyStyles(xo,ry),Nc.innerText="Microfone";let ny={color:"rgba(0, 0, 0, .7)",fontWeight:"bold",fontSize:"16px"};this.applyStyles(Nc,ny),bn.style.maxWidth="400px",bn.style.minWidth="150px",bn.style.width="100%",bn.style.boxSizing="border-box",xo.appendChild(Nc),xo.appendChild(bn),o.appendChild(xo);let Ao=document.createElement("div");Ao.setAttribute("class","mic-container-responsive");let oy={width:"100%",padding:"0px 20px",display:"flex",boxSizing:"border-box"};this.applyStyles(Ao,oy);let To=document.createElement("div");To.setAttribute("class","mic-meter-responsive");let iy={display:"flex",flexDirection:"column",justifyContent:"space-between",paddingBottom:"15px"};this.applyStyles(To,iy);let $i=document.createElement("div");$i.setAttribute("id","audioStream");let sy={display:"flex",marginBottom:"15px"};this.applyStyles($i,sy);let ay={height:"16px",width:"5px",marginRight:"5px",borderRadius:"10px",backgroundColor:"rgba(0, 0, 0, .3)"};for(let Mu=0;Mu<25;Mu++){let Lu=document.createElement("div");this.applyStyles(Lu,ay),$i.appendChild(Lu)}let vn=document.createElement("div");vn.setAttribute("class","range-responsive");let Pu=document.createElement("p"),Ru=document.createElement("p"),Du=document.createElement("p"),cy={width:"100%",maxWidth:"250px",display:"flex",justifyContent:"space-between",boxSizing:"border-box"};this.applyStyles(vn,cy),Pu.innerText="0",Ru.innerText="50",Du.innerText="100",vn.appendChild(Pu),vn.appendChild(Ru),vn.appendChild(Du);let wn=document.createElement("div");wn.setAttribute("class","alert-div"),wn.setAttribute("id","alertDivMicrophone");let ly={display:"flex",alignItems:"center",justifyContent:"center",width:"100%"};this.applyStyles(wn,ly);let qi=document.createElement("error");qi.setAttribute("id","microphoneAlert"),qi.innerText="Teste de funcionamento",qi.style.marginLeft="10px";let Gi=document.createElement("span"),Ou=document.createElement("div"),Bu=document.createElement("div");Gi.setAttribute("id","checkmark_microphone"),Ou.setAttribute("id","checkmark_stem_microphone"),Bu.setAttribute("id","checkmark_kick_microphone"),Gi.appendChild(Ou),Gi.appendChild(Bu),wn.appendChild(Gi),wn.appendChild(qi),To.appendChild($i),To.appendChild(vn);let Io=document.createElement("p");Io.setAttribute("class","pronounce-responsive"),Io.innerText='Pronuncie em voz alta: "Testando..."',Io.style.textAlign="start";let hy={width:"calc(100% - 40px)",marginLeft:"20px",marginRight:"20px",marginBottom:"15px",boxSizing:"border-box",padding:"0 10px"};this.applyStyles(Io,hy),Ao.appendChild(To),Ao.appendChild(wn),o.appendChild(Io),o.appendChild(Ao);let Po=document.createElement("div"),dy={width:"100%",display:"flex",alignItems:"center",justifyContent:"center",borderTop:"2px solid rgba(0, 0, 0, .1)",boxSizing:"border-box"};this.applyStyles(Po,dy);let Ro=document.createElement("button");Ro.setAttribute("id","cancelBtn"),Ro.setAttribute("class","button-responsive"),Ro.innerText="Cancelar";let uy={width:"100%",height:"70px",backgroundColor:"#FFF",border:"none",color:"rgba(0, 0, 0, .7)",fontWeight:"bold",borderRadius:"10px",paddingTop:"5px",paddingBottom:"5px"};this.applyStyles(Ro,uy);let jc=document.createElement("span");jc.setAttribute("class","divider-responsive");let py={width:"3px",height:"70px",margin:"0px 2px",background:"rgba(0, 0, 0, .1)"};this.applyStyles(jc,py);let zr=document.createElement("button");zr.innerText="Continuar",zr.setAttribute("id","confirmBtn"),zr.setAttribute("class","button-responsive");let fy={width:"100%",height:"70px",backgroundColor:"#FFF",border:"none",color:"rgba(0, 0, 0, .7)",fontWeight:"bold",borderRadius:"10px",paddingTop:"5px",paddingBottom:"5px"};this.applyStyles(zr,fy),this.options.useSpyScan&&(zr.style.cursor="not-allowed",zr.setAttribute("disabled","true")),Po.appendChild(Ro),Po.appendChild(jc),Po.appendChild(zr),o.appendChild(Po),r.appendChild(o),document.body.appendChild(r)}async setSelectOption(t,r){let n=document.querySelector("#cameraSelect"),o=document.querySelector("#micSelect"),i=await St();n&&(n.value=t.cameraId||"default"),o&&(o.value=t.microphoneId||"default");let s=(a,c)=>{let l=document.createElement("option");return l.setAttribute("value",c),l.innerHTML=a,l};i.cameras.forEach(a=>{let c=s(a.label,a.id);n?.appendChild(c)}),i.microphones.forEach(a=>{let c=s(a.label,a.id);o?.appendChild(c)}),this.onSelectOptionChange(a=>r(a))}async onSelectOptionChange(t){let r=document.querySelector("#cameraSelect"),n=document.querySelector("#micSelect");r?.addEventListener("change",()=>t({cameraId:r?.value,microphoneId:n?.value})),n?.addEventListener("change",()=>t({cameraId:r?.value,microphoneId:n?.value}))}closeModal(){document.querySelector("#checkDevices")?.remove()}modalActions(t){let r=document.getElementById("cancelBtn"),n=document.getElementById("confirmBtn"),o=document.getElementById("cameraSelect"),i=document.getElementById("micSelect");return new Promise((s,a)=>{r?.addEventListener("click",()=>{t(),this.closeModal(),a({result:!1})}),n?.addEventListener("click",()=>{n.disabled||(t(),this.closeModal(),s({cameraId:o?.value,microphoneId:i?.value,result:!0}))})})}realtimeAlertsUI(t){let r=document.getElementById("facePositionAlert"),n=document.getElementById("ambientVerifyAlert"),o=document.getElementById("checkmark_FacePosition"),i=document.getElementById("checkmark_stem_FacePosition"),s=document.getElementById("checkmark_kick_FacePosition"),a=document.getElementById("alertDivAmbientVerify"),c=document.getElementById("checkmark_AmbientVerify"),l=document.getElementById("checkmark_stem_AmbientVerify"),h=document.getElementById("checkmark_kick_AmbientVerify");t.status==="OK"?(r&&(r.style.color="#16A34A"),n&&(n.style.color="#16A34A"),a&&a.setAttribute("title",""),o&&(o.setAttribute("class","checkmark"),i.setAttribute("class","checkmark_stem"),s.setAttribute("class","checkmark_kick")),c&&(c.setAttribute("class","checkmark"),l.setAttribute("class","checkmark_stem"),h.setAttribute("class","checkmark_kick"))):(o&&(t.type==="position_detection_on_stream"||t.type==="face_detection_on_stream")&&(r&&(r.style.color="#FF0000"),o.setAttribute("class","checkmark_error"),i.setAttribute("class","checkmark_stem_error"),s.setAttribute("class","checkmark_kick_error")),c&&t.description==="M\xFAltiplas faces detectadas"&&(n&&(n.style.color="#FF0000"),a&&a.setAttribute("title",`${t.description}`),c.setAttribute("class","checkmark_error"),l.setAttribute("class","checkmark_stem_error"),h.setAttribute("class","checkmark_kick_error")))}waitingSpyDevices(t){let r=document.getElementById("SpyCamAlert"),n=document.getElementById("alertDivSpyCam");if(n&&(n.style.display="flex"),t){r&&(r.style.color="#c7c7c7"),r&&(r.innerText="Verificando Spy Cam...");let o=document.getElementById("confirmBtn");o&&o.setAttribute("disabled","true"),o&&(o.style.cursor="not-allowed")}else{r&&(r.style.color="#16A34A"),r&&(r.innerText="Verifica\xE7\xE3o de Spy Cam");let o=document.getElementById("confirmBtn");o&&o.setAttribute("disabled","false"),o&&(o.style.cursor="pointer")}}isSpyDevicesUI(t){let r=document.getElementById("SpyCamAlert"),n=document.getElementById("confirmBtn"),o=document.getElementById("alertDivSpyCam");o&&(o.style.display="flex");let i=document.getElementById("checkmark_SpyCam"),s=document.getElementById("checkmark_stem_SpyCam"),a=document.getElementById("checkmark_kick_SpyCam");t?(r&&(r.style.color="#16A34A"),i&&(i.setAttribute("class","checkmark"),s.setAttribute("class","checkmark_stem"),a.setAttribute("class","checkmark_kick"))):i&&(r&&(r.style.color="#FF0000"),i.setAttribute("class","checkmark_error"),s.setAttribute("class","checkmark_stem_error"),a.setAttribute("class","checkmark_kick_error")),this.options.useSpyScan&&n?.removeAttribute("disabled"),n&&(n.style.cursor="pointer")}isUnderResolutionUI(t){let r=document.getElementById("resolutionAlert"),n=document.getElementById("alertDivResolution"),o=document.getElementById("info_resolution"),i=document.getElementById("checkmark_resolution"),s=document.getElementById("checkmark_stem_resolution"),a=document.getElementById("checkmark_kick_resolution");t?(r.style.color="#16A34A",o&&(o.style.display="none"),r.setAttribute("title",""),i.setAttribute("class","checkmark"),s.setAttribute("class","checkmark_stem"),a.setAttribute("class","checkmark_kick")):(r.style.color="#FF0000",o&&(o.style.display="block"),n.setAttribute("title",`A c\xE2mera n\xE3o satisfaz a resolu\xE7\xE3o m\xEDnima exigida (${this.videoOptions.minWidth}x${this.videoOptions.minHeight}).
363
+ `,document.getElementsByTagName("head")[0].appendChild(t);let r=document.createElement("div");r.setAttribute("id","checkDevices");let n={backgroundColor:"rgba(0,0,0,0.4)",zIndex:"1000",position:"fixed",top:"0",left:"0",height:"100vh",width:"100%",maxWidth:"100vw",display:"flex",alignItems:"center",justifyContent:"center",overflow:"auto",boxSizing:"border-box"};this.applyStyles(r,n);let o=document.createElement("div");o.setAttribute("class","modal-responsive");let i={backgroundColor:"#fff",zIndex:"1001",width:"90%",maxWidth:"600px",borderRadius:"10px",display:"flex",flexDirection:"column",alignItems:"center",boxSizing:"border-box",overflow:"hidden"};this.applyStyles(o,i);let s=document.createElement("h3");s.innerText="Checagem de dispositivos";let a={color:"rgba(0, 0, 0, .7)",fontWeight:"bold",fontSize:"20px",marginBottom:"15px",padding:"20px 0px",borderBottom:"2px solid rgba(0, 0, 0, .1)",width:"100%",textAlign:"center"};this.applyStyles(s,a),o.appendChild(s);let c=document.createElement("div");c.setAttribute("class","camera-header-responsive");let l=document.createElement("h3"),h=document.createElement("select");h.setAttribute("id","cameraSelect");let d={padding:"0 20px",width:"100%",display:"flex",justifyContent:"space-between",marginBottom:"15px"};this.applyStyles(c,d),l.innerText="C\xE2mera";let u={color:"rgba(0, 0, 0, .75)",fontWeight:"bold",fontSize:"16px"};this.applyStyles(l,u),h.style.maxWidth="400px",h.style.minWidth="150px",h.style.width="100%",h.style.boxSizing="border-box",c.appendChild(l),c.appendChild(h),o.appendChild(c);let b=document.createElement("div");b.setAttribute("id","liveCheckDevices"),b.setAttribute("class","camera-container-responsive");let m=document.createElement("div");m.setAttribute("class","video-responsive");let f=document.createElement("video"),y=document.createElement("div");f.setAttribute("id","cameraStream"),f.muted=!0;let v={width:"100%",display:"flex",justifyContent:"space-between",gap:"20px",borderBottom:"2px solid rgba(0, 0, 0, .1)",paddingBottom:"15px",paddingLeft:"20px",paddingRight:"20px",boxSizing:"border-box",transform:"rotateY(180deg)"};this.applyStyles(b,v);let _={width:"100%",maxWidth:"320px",height:"auto",maxHeight:"240px",objectFit:"contain",backgroundColor:"#000",borderRadius:"10px",marginBottom:"15px"};this.applyStyles(f,_),this.applyStyles(m,{position:"relative",width:"100%",maxWidth:"320px",maxHeight:"240px",boxSizing:"border-box"});let x=document.createElement("div");x.setAttribute("class","alert-div"),x.setAttribute("id","alertDivResolution");let B=document.createElement("error");B.setAttribute("id","resolutionAlert"),B.innerText="Resolu\xE7\xE3o m\xEDnima",B.style.marginLeft="10px",B.style.marginRight="5px";let O=document.createElement("span"),R=document.createElement("div"),ue=document.createElement("div");O.setAttribute("id","checkmark_resolution"),R.setAttribute("id","checkmark_stem_resolution"),ue.setAttribute("id","checkmark_kick_resolution"),O.appendChild(R),O.appendChild(ue);let se=document.createElement("span"),Vr=document.createElement("div"),Ui=document.createElement("div");se.setAttribute("class","info"),se.setAttribute("id","info_resolution"),Vr.setAttribute("class","info_stem"),Ui.setAttribute("class","info_kick"),se.appendChild(Vr),se.appendChild(Ui),x.appendChild(O),x.appendChild(B),x.appendChild(se);let Hr=document.createElement("div");Hr.setAttribute("class","alert-div"),Hr.setAttribute("id","alertDivFacePosition");let mn=document.createElement("error");mn.setAttribute("id","facePositionAlert"),mn.innerText="Posicionamento da face",mn.style.marginLeft="10px";let gn=document.createElement("span"),Ni=document.createElement("div"),ji=document.createElement("div");gn.setAttribute("id","checkmark_FacePosition"),Ni.setAttribute("id","checkmark_stem_FacePosition"),ji.setAttribute("id","checkmark_kick_FacePosition"),gn.appendChild(Ni),gn.appendChild(ji),Hr.appendChild(gn),Hr.appendChild(mn);let hr=document.createElement("div");hr.setAttribute("class","alert-div"),hr.setAttribute("id","alertDivAmbientVerify");let Vi=document.createElement("error");Vi.setAttribute("id","ambientVerifyAlert"),Vi.innerText="Verifica\xE7\xE3o do ambiente",Vi.style.marginLeft="10px";let Hi=document.createElement("span"),xu=document.createElement("div"),Au=document.createElement("div");Hi.setAttribute("id","checkmark_AmbientVerify"),xu.setAttribute("id","checkmark_stem_AmbientVerify"),Au.setAttribute("id","checkmark_kick_AmbientVerify"),Hi.appendChild(xu),Hi.appendChild(Au),hr.appendChild(Hi),hr.appendChild(Vi);let yn=document.createElement("div");yn.setAttribute("class","alert-div"),yn.setAttribute("id","alertDivSpyCam"),yn.style.display="none";let zi=document.createElement("error");zi.setAttribute("id","SpyCamAlert"),zi.innerText="Verifica\xE7\xE3o de Spy Cam",zi.style.marginLeft="10px";let Wi=document.createElement("span"),Tu=document.createElement("div"),Iu=document.createElement("div");Wi.setAttribute("id","checkmark_SpyCam"),Tu.setAttribute("id","checkmark_stem_SpyCam"),Iu.setAttribute("id","checkmark_kick_SpyCam"),Wi.appendChild(Tu),Wi.appendChild(Iu),yn.appendChild(Wi),yn.appendChild(zi),y.style.transform="rotateY(180deg)",y.style.display="flex",y.style.flexDirection="column",y.style.flex="1",y.style.minWidth="0",y.appendChild(x),y.appendChild(Hr),y.appendChild(hr),y.appendChild(yn),b.appendChild(y),m.appendChild(f),m.style.flexShrink="0",b.appendChild(m);let Xt=document.createElement("div");Xt.setAttribute("class","facial-biometry__mask"),Xt.style.width="100%",Xt.style.height="100%",Xt.style.position="absolute",Xt.style.top="0px",Xt.style.left="0px",Xt.style.backgroundColor="#fff",Xt.style.opacity="0.6";let dr=document.createElement("div");dr.setAttribute("class","biometry__frame"),dr.style.width="100%",dr.style.height="100%",dr.style.position="absolute",dr.style.top="0px",dr.style.left="0px",dr.style.zIndex="10",m.appendChild(Xt),m.appendChild(dr),o.appendChild(b);let xo=document.createElement("div");xo.setAttribute("class","mic-header-responsive");let Nc=document.createElement("h3"),bn=document.createElement("select");bn.setAttribute("id","micSelect");let ry={padding:"0 20px",width:"100%",display:"flex",justifyContent:"space-between",margin:"15px 0"};this.applyStyles(xo,ry),Nc.innerText="Microfone";let ny={color:"rgba(0, 0, 0, .7)",fontWeight:"bold",fontSize:"16px"};this.applyStyles(Nc,ny),bn.style.maxWidth="400px",bn.style.minWidth="150px",bn.style.width="100%",bn.style.boxSizing="border-box",xo.appendChild(Nc),xo.appendChild(bn),o.appendChild(xo);let Ao=document.createElement("div");Ao.setAttribute("class","mic-container-responsive");let oy={width:"100%",padding:"0px 20px",display:"flex",boxSizing:"border-box"};this.applyStyles(Ao,oy);let To=document.createElement("div");To.setAttribute("class","mic-meter-responsive");let iy={display:"flex",flexDirection:"column",justifyContent:"space-between",paddingBottom:"15px"};this.applyStyles(To,iy);let $i=document.createElement("div");$i.setAttribute("id","audioStream");let sy={display:"flex",marginBottom:"15px"};this.applyStyles($i,sy);let ay={height:"16px",width:"5px",marginRight:"5px",borderRadius:"10px",backgroundColor:"rgba(0, 0, 0, .3)"};for(let Mu=0;Mu<25;Mu++){let Lu=document.createElement("div");this.applyStyles(Lu,ay),$i.appendChild(Lu)}let vn=document.createElement("div");vn.setAttribute("class","range-responsive");let Pu=document.createElement("p"),Ru=document.createElement("p"),Du=document.createElement("p"),cy={width:"100%",maxWidth:"250px",display:"flex",justifyContent:"space-between",boxSizing:"border-box"};this.applyStyles(vn,cy),Pu.innerText="0",Ru.innerText="50",Du.innerText="100",vn.appendChild(Pu),vn.appendChild(Ru),vn.appendChild(Du);let wn=document.createElement("div");wn.setAttribute("class","alert-div"),wn.setAttribute("id","alertDivMicrophone");let ly={display:"flex",alignItems:"center",justifyContent:"center",width:"100%"};this.applyStyles(wn,ly);let qi=document.createElement("error");qi.setAttribute("id","microphoneAlert"),qi.innerText="Teste de funcionamento",qi.style.marginLeft="10px";let Gi=document.createElement("span"),Ou=document.createElement("div"),Bu=document.createElement("div");Gi.setAttribute("id","checkmark_microphone"),Ou.setAttribute("id","checkmark_stem_microphone"),Bu.setAttribute("id","checkmark_kick_microphone"),Gi.appendChild(Ou),Gi.appendChild(Bu),wn.appendChild(Gi),wn.appendChild(qi),To.appendChild($i),To.appendChild(vn);let Io=document.createElement("p");Io.setAttribute("class","pronounce-responsive"),Io.innerText='Pronuncie em voz alta: "Testando..."',Io.style.textAlign="start";let hy={width:"calc(100% - 40px)",marginLeft:"20px",marginRight:"20px",marginBottom:"15px",boxSizing:"border-box",padding:"0 10px"};this.applyStyles(Io,hy),Ao.appendChild(To),Ao.appendChild(wn),o.appendChild(Io),o.appendChild(Ao);let Po=document.createElement("div"),dy={width:"100%",display:"flex",alignItems:"center",justifyContent:"center",borderTop:"2px solid rgba(0, 0, 0, .1)",boxSizing:"border-box"};this.applyStyles(Po,dy);let Ro=document.createElement("button");Ro.setAttribute("id","cancelBtn"),Ro.setAttribute("class","button-responsive"),Ro.innerText="Cancelar";let uy={width:"100%",height:"70px",backgroundColor:"#FFF",border:"none",color:"rgba(0, 0, 0, .7)",fontWeight:"bold",borderRadius:"10px",paddingTop:"5px",paddingBottom:"5px"};this.applyStyles(Ro,uy);let jc=document.createElement("span");jc.setAttribute("class","divider-responsive");let py={width:"3px",height:"70px",margin:"0px 2px",background:"rgba(0, 0, 0, .1)"};this.applyStyles(jc,py);let zr=document.createElement("button");zr.innerText="Continuar",zr.setAttribute("id","confirmBtn"),zr.setAttribute("class","button-responsive");let fy={width:"100%",height:"70px",backgroundColor:"#FFF",border:"none",color:"rgba(0, 0, 0, .7)",fontWeight:"bold",borderRadius:"10px",paddingTop:"5px",paddingBottom:"5px"};this.applyStyles(zr,fy),this.options.useSpyScan&&(zr.style.cursor="not-allowed",zr.setAttribute("disabled","true")),Po.appendChild(Ro),Po.appendChild(jc),Po.appendChild(zr),o.appendChild(Po),r.appendChild(o),document.body.appendChild(r)}async setSelectOption(t,r){let n=document.querySelector("#cameraSelect"),o=document.querySelector("#micSelect"),i=await St();n&&(n.value=t.cameraId||"default"),o&&(o.value=t.microphoneId||"default");let s=(a,c)=>{let l=document.createElement("option");return l.setAttribute("value",c),l.innerHTML=a,l};i.cameras.forEach(a=>{let c=s(a.label,a.id);n?.appendChild(c)}),i.microphones.forEach(a=>{let c=s(a.label,a.id);o?.appendChild(c)}),this.onSelectOptionChange(a=>r(a))}async onSelectOptionChange(t){let r=document.querySelector("#cameraSelect"),n=document.querySelector("#micSelect");r?.addEventListener("change",()=>t({cameraId:r?.value,microphoneId:n?.value})),n?.addEventListener("change",()=>t({cameraId:r?.value,microphoneId:n?.value}))}closeModal(){document.querySelector("#checkDevices")?.remove()}modalActions(t){let r=document.getElementById("cancelBtn"),n=document.getElementById("confirmBtn"),o=document.getElementById("cameraSelect"),i=document.getElementById("micSelect");return new Promise((s,a)=>{r?.addEventListener("click",()=>{t(),this.closeModal(),a({result:!1})}),n?.addEventListener("click",()=>{n.disabled||(t(),this.closeModal(),s({cameraId:o?.value,microphoneId:i?.value,result:!0}))})})}realtimeAlertsUI(t){let r=document.getElementById("facePositionAlert"),n=document.getElementById("ambientVerifyAlert"),o=document.getElementById("checkmark_FacePosition"),i=document.getElementById("checkmark_stem_FacePosition"),s=document.getElementById("checkmark_kick_FacePosition"),a=document.getElementById("alertDivAmbientVerify"),c=document.getElementById("checkmark_AmbientVerify"),l=document.getElementById("checkmark_stem_AmbientVerify"),h=document.getElementById("checkmark_kick_AmbientVerify");t.status==="OK"?(r&&(r.style.color="#16A34A"),n&&(n.style.color="#16A34A"),a&&a.setAttribute("title",""),o&&(o.setAttribute("class","checkmark"),i.setAttribute("class","checkmark_stem"),s.setAttribute("class","checkmark_kick")),c&&(c.setAttribute("class","checkmark"),l.setAttribute("class","checkmark_stem"),h.setAttribute("class","checkmark_kick"))):(o&&(t.type==="position_detection_on_stream"||t.type==="face_detection_on_stream")&&(r&&(r.style.color="#FF0000"),o.setAttribute("class","checkmark_error"),i.setAttribute("class","checkmark_stem_error"),s.setAttribute("class","checkmark_kick_error")),c&&t.description==="M\xFAltiplas faces detectadas"&&(n&&(n.style.color="#FF0000"),a&&a.setAttribute("title",`${t.description}`),c.setAttribute("class","checkmark_error"),l.setAttribute("class","checkmark_stem_error"),h.setAttribute("class","checkmark_kick_error")))}waitingSpyDevices(t){let r=document.getElementById("SpyCamAlert"),n=document.getElementById("alertDivSpyCam");if(n&&(n.style.display="flex"),t){r&&(r.style.color="#c7c7c7"),r&&(r.innerText="Verificando Spy Cam...");let o=document.getElementById("confirmBtn");o&&o.setAttribute("disabled","true"),o&&(o.style.cursor="not-allowed")}else{r&&(r.style.color="#16A34A"),r&&(r.innerText="Verifica\xE7\xE3o de Spy Cam");let o=document.getElementById("confirmBtn");o&&o.setAttribute("disabled","false"),o&&(o.style.cursor="pointer")}}isSpyDevicesUI(t){let r=document.getElementById("SpyCamAlert"),n=document.getElementById("confirmBtn"),o=document.getElementById("alertDivSpyCam");o&&(o.style.display="flex");let i=document.getElementById("checkmark_SpyCam"),s=document.getElementById("checkmark_stem_SpyCam"),a=document.getElementById("checkmark_kick_SpyCam");t?(r&&(r.style.color="#16A34A"),i&&(i.setAttribute("class","checkmark"),s.setAttribute("class","checkmark_stem"),a.setAttribute("class","checkmark_kick"))):i&&(r&&(r.style.color="#FF0000"),i.setAttribute("class","checkmark_error"),s.setAttribute("class","checkmark_stem_error"),a.setAttribute("class","checkmark_kick_error")),this.options.useSpyScan&&n?.removeAttribute("disabled"),n&&(n.style.cursor="pointer")}isUnderResolutionUI(t){let r=document.getElementById("resolutionAlert"),n=document.getElementById("alertDivResolution"),o=document.getElementById("info_resolution"),i=document.getElementById("checkmark_resolution"),s=document.getElementById("checkmark_stem_resolution"),a=document.getElementById("checkmark_kick_resolution");t?(r.style.color="#16A34A",o&&(o.style.display="none"),r.setAttribute("title",""),i.setAttribute("class","checkmark"),s.setAttribute("class","checkmark_stem"),a.setAttribute("class","checkmark_kick")):(r.style.color="#FF0000",o&&(o.style.display="block"),n.setAttribute("title",`A c\xE2mera n\xE3o satisfaz a resolu\xE7\xE3o m\xEDnima exigida (${this.videoOptions.minWidth}x${this.videoOptions.minHeight}).
364
364
  Para iniciar um exame utilize uma outra c\xE2mera.`),i.setAttribute("class","checkmark_error"),s.setAttribute("class","checkmark_stem_error"),a.setAttribute("class","checkmark_kick_error"))}videoDeviceInterfaceUI(t){let r=document.querySelector("#cameraStream");r&&(r.srcObject=t,r.play().catch(n=>{console.warn("Erro ao iniciar preview de v\xEDdeo:",n)}))}audioDeviceInterfaceUIAllowedAmbient(t){let r=document.getElementById("ambientVerifyAlert"),n=document.getElementById("alertDivAmbientVerify"),o=document.getElementById("checkmark_AmbientVerify"),i=document.getElementById("checkmark_stem_AmbientVerify"),s=document.getElementById("checkmark_kick_AmbientVerify");t?(r&&(r.style.color="#16A34A"),n&&n.setAttribute("title",""),o.setAttribute("class","checkmark"),i.setAttribute("class","checkmark_stem"),s.setAttribute("class","checkmark_kick")):(r&&(r.style.color="#FF0000"),n&&n.setAttribute("title","Ambiente apresentando muito ru\xEDdo!"),o.setAttribute("class","checkmark_error"),i.setAttribute("class","checkmark_stem_error"),s.setAttribute("class","checkmark_kick_error"))}audioDeviceInterfaceUIMicrophoneWorks(t){let r=document.getElementById("microphoneAlert"),n=document.getElementById("alertDivMicrophone"),o=document.getElementById("checkmark_microphone"),i=document.getElementById("checkmark_stem_microphone"),s=document.getElementById("checkmark_kick_microphone");t?(r&&(r.style.color="#16A34A"),n&&n.setAttribute("title",""),o&&o.setAttribute("class","checkmark"),i&&i.setAttribute("class","checkmark_stem"),s&&s.setAttribute("class","checkmark_kick")):(r&&(r.style.color="#FF0000"),n&&n.setAttribute("title","Microfone n\xE3o est\xE1 funcionando corretamente!"),o&&o.setAttribute("class","checkmark_error"),i&&i.setAttribute("class","checkmark_stem_error"),s&&s.setAttribute("class","checkmark_kick_error"))}audioDeviceInterfaceUIErrorExec(){let t=document.getElementById("microphoneAlert"),r=document.getElementById("checkmark_microphone"),n=document.getElementById("checkmark_stem_microphone"),o=document.getElementById("checkmark_kick_microphone");t&&(t.style.color="#FF0000"),r&&r.setAttribute("class","checkmark_error"),n&&n.setAttribute("class","checkmark_stem_error"),o&&o.setAttribute("class","checkmark_kick_error")}audioDeviceInterfaceUIPills(t){let n=document.querySelector("#audioStream")?.querySelectorAll("div"),o=document.querySelector("#audioText"),i=t/4;n?.forEach((s,a)=>{a<Math.ceil(i)?s.style.backgroundColor="rgb(22, 163, 74)":s.style.backgroundColor="rgba(0, 0, 0, .3)"}),o&&(o.innerText=t.toFixed(0).toString())}async addStyleMask(){let t=`
365
365
  .facial-biometry__mask {
366
366
  mask-image: url('https://iarisprod.blob.core.windows.net/imagens/square.svg'), url('https://iarisprod.blob.core.windows.net/imagens/face-mask.svg');
@@ -507,6 +507,6 @@ Upload Services: ${n}`,this.serviceType),Ei()!=="1.0.0.0"&&(r=new so(this.procto
507
507
  Upload Services: ${n}
508
508
  Upload backup for Safe Browser`,this.serviceType)}))}),L.registerUpload(this.proctoringSession.id,!0,`upload success
509
509
 
510
- Upload Services: ${n}`,this.serviceType)),this.proctoringSession.alerts.length>0&&await this.backend.saveAlerts(this.context,this.proctoringSession).catch(i=>{L.registerFinish(this.proctoringSession.id,!1,"save-screen error: "+i)}),await this.backend.finishAndSendUrls(this.context).then(i=>{L.registerFinish(this.proctoringSession.id,!0,""),console.log("finishResponse: ",i),t.onFinish&&t.onFinish(i?.score??100,i?.approved??!0)}).catch(i=>{L.registerFinish(this.proctoringSession.id,!1,"finish error: "+i)}),this.appChecker){let i=this.appChecker.getExternalCameraSessionId();console.log("externalSessionId -> ",i),i!="null"&&await this.backend.externalCameraFinish(i)}this.state="Stop"}catch(r){throw await this.cancel(),L.registerFinish(this.proctoringId,!1,`Token: ${this.context.token}
510
+ Upload Services: ${n}`,this.serviceType)),this.proctoringSession.alerts.length>0&&await this.backend.saveAlerts(this.context,this.proctoringSession).catch(i=>{L.registerFinish(this.proctoringSession.id,!1,"save-screen error: "+i)}),await this.backend.finishAndSendUrls(this.context).then(i=>{L.registerFinish(this.proctoringSession.id,!0,""),console.log("finishResponse: ",i),t.onFinish&&t.onFinish(i?.score??100,i?.scoreThreshold??70,i?.approved??!0,i?.justification??"")}).catch(i=>{L.registerFinish(this.proctoringSession.id,!1,"finish error: "+i)}),this.appChecker){let i=this.appChecker.getExternalCameraSessionId();console.log("externalSessionId -> ",i),i!="null"&&await this.backend.externalCameraFinish(i)}this.state="Stop"}catch(r){throw await this.cancel(),L.registerFinish(this.proctoringId,!1,`Token: ${this.context.token}
511
511
  Error: `+r),this.state="Stop",r}}async verifyMultipleMonitors(t){if(!t.allowMultipleMonitors&&await Xi())throw L.registerError(this.proctoringId,"Multiplas telas detectadas!"),da}async verifyBrowser(){let t=await Ig();if(t!=="chrome"&&t!=="firefox"&&!Cr())throw L.registerBrowserNotSupported(this.proctoringId,`Browser n\xE3o suportado:
512
512
  Tentativa utilizando o browser ${t}`),Lg}async initConfig(t){try{let r=await this.backend.getParamsConfig(this.context);this.paramsConfig={...this.paramsConfig,...r,audioBehaviourParameters:{...this.paramsConfig.audioBehaviourParameters,...r.audioBehaviourParameters},imageBehaviourParameters:{...this.paramsConfig.imageBehaviourParameters,...r.imageBehaviourParameters},videoBehaviourParameters:{...this.paramsConfig.videoBehaviourParameters,...r.videoBehaviourParameters}},t&&(this.geolocation=await K0().then(n=>n).catch(n=>{throw n.message})),Pg(this.backend),this.sessionOptions?.useSpyScan&&(this.spyCam=new no(this.context,{onRealtimeAlertsCallback:n=>this.onRealtimeAlertsCallback(n)}))}catch(r){throw this.proctoringId&&L.registerError(this.proctoringId,"Erro no initConfig!"),await this.cancel(),r}}async getServerDate(){let t=await this.backend.getServerHour(this.context.token).catch(n=>{L.registerError(this.proctoringId,"N\xE3o foi poss\xEDvel requisitar a data do servidor!")});return t?new Date(t.toString()):new Date}async pause(){if(this.state!=="Recording")throw L.registerError(this.proctoringId,"Proctoring n\xE3o iniciado!"),ua;await this.recorder.stopAll(),await this.recorder.saveAllOnSession(),await this.repository.save(this.proctoringSession),this.state="Paused"}async resume(){if(this.state!="Paused")throw ua;return await this.verifyBrowser(),await this.verifyMultipleMonitors(this.sessionOptions),await this.recorder.startAll(),this.proctoringSession.recordings=[],await this.repository.save(this.proctoringSession),this.state="Recording",{cameraStream:this.allRecorders.cameraRecorder.cameraStream,_screenStream:this.allRecorders.screenRecorder?.screenStream}}async startChallenge(t){if(!this.sessionOptions.useChallenge)throw new Error("useChallenge is set as false on start method");await this.extensionEasycatcher.checkExtensionInstalled().catch(n=>{throw new Error("EasyCatcher Extension is not installed")}),this.extensionEasycatcher.start();let r=Date.now()-this.sessionStartTime;await this.backend.startChallenge({proctoringId:this.proctoringId,templateId:t,start:r}).then(n=>{console.log(n),this.challengeId=n.id}).catch(n=>{throw L.registerError(this.proctoringId,"N\xE3o foi poss\xEDvel iniciar desafio!"),n}),this.isChallengeRunning=!0}async stopChallenge(){if(!this.isChallengeRunning)throw new Error("Challenge not started");try{let t=await this.extensionEasycatcher.getSessionData(),r=Date.now()-this.sessionStartTime;await this.backend.stopChallenge(this.challengeId,{end:r,data:t}).catch(n=>{L.registerError(this.proctoringId,"N\xE3o foi poss\xEDvel finalizar o desafio no backend!")}),this.isChallengeRunning=!1}catch(t){L.registerError(this.proctoringId,"Erro ao recuperar dados da extens\xE3o: "+t.message)}}};var Uc=class e{static{this.isModalOpen=!1}constructor(t){this.backend=new ft({type:t?.type||"prod",token:t.token})}async signInTerms(){if(e.isModalOpen)return Promise.reject();e.isModalOpen=!0;try{let t=await this.openModal();return new Promise(r=>{r(t)})}catch(t){return this.closeModal(),Promise.reject(t)}}openModal(){return new Promise((t,r)=>{let n=document.createElement("div");n.setAttribute("id","signTermModal");let o={backgroundColor:"rgba(0,0,0,0.4)",zIndex:"1000",position:"fixed",top:"0",left:"0",height:"100vh",width:"100%",display:"flex",alignItems:"center",justifyContent:"center"};this.applyStyles(n,o);let i=document.createElement("div"),s={backgroundColor:"#fff",zIndex:"1001",width:"850px",maxHeight:"95%",borderRadius:"10px",display:"flex",flexDirection:"column",alignItems:"center"};this.applyStyles(i,s);let a=document.createElement("h3");a.innerText="Termo de consentimento para coleta e uso de dados";let c={color:"rgba(0, 0, 0, .7)",fontWeight:"bold",fontSize:"20px",marginBottom:"15px",padding:"20px 0px",borderBottom:"2px solid rgba(0, 0, 0, .1)",width:"100%",textAlign:"center"};this.applyStyles(a,c),i.appendChild(a);let l=document.createElement("iframe"),h="https://docs.google.com/document/u/3/d/e/2PACX-1vRMgrLhDLyDP8BHmotfPDpwAFaDHqK-mA4eBJ0Cy1mDdvHcWLsx47H4otII_4qi4rhtSf6B0OO97e9c/pub";this.backend.signTermUrl().then(se=>{if(!se)throw new Error("N\xE3o foi poss\xEDvel obter o termo de consentimento");l.setAttribute("src",se)}).catch(()=>{l.setAttribute("src",h)});let d={width:"100%",height:"500px",border:"1px solid rgba(0, 0, 0, .1)",margin:"20px",borderRadius:"5px"};this.applyStyles(l,d),i.appendChild(l);let u=document.createElement("div"),b=document.createElement("input");b.setAttribute("type","checkbox"),b.setAttribute("id","termsCheckbox");let m=document.createElement("label");m.setAttribute("for","termsCheckbox"),m.innerText="Li e aceito os termos e condi\xE7\xF5es";let f={display:"flex",alignItems:"center",gap:"10px",margin:"20px",width:"100%",paddingLeft:"20px"};this.applyStyles(u,f),u.appendChild(b),u.appendChild(m),i.appendChild(u);let y=document.createElement("div"),v={width:"100%",display:"flex",alignItems:"center",justifyContent:"center",borderTop:"2px solid rgba(0, 0, 0, .1)"};this.applyStyles(y,v);let _=document.createElement("button");_.innerText="Cancelar";let x={width:"100%",height:"70px",backgroundColor:"#FFF",border:"none",color:"rgba(0, 0, 0, .7)",fontWeight:"bold",borderRadius:"10px",paddingTop:"5px",paddingBottom:"5px"};this.applyStyles(_,x),_.addEventListener("click",()=>{this.closeModal(),t(!1)});let B=document.createElement("span"),O={width:"3px",height:"70px",margin:"0px 2px",background:"rgba(0, 0, 0, .1)"};this.applyStyles(B,O);let R=document.createElement("button");R.innerText="Continuar",R.setAttribute("id","confirmBtn");let ue={width:"100%",height:"70px",backgroundColor:"#FFF",border:"none",color:"rgba(0, 0, 0, .7)",fontWeight:"bold",borderRadius:"10px",paddingTop:"5px",paddingBottom:"5px",disabled:!0,cursor:"not-allowed"};this.applyStyles(R,ue),R.disabled=!0,R.addEventListener("click",()=>{this.closeModal(),this.backend.signTerm().then(()=>{t(!0)})}),b.addEventListener("change",se=>{R.disabled=!se.target.checked,se.target.checked?(R.style.color="#007bff",R.style.cursor="pointer"):(R.style.color="rgba(0, 0, 0, .7)",R.style.cursor="not-allowed")}),y.appendChild(_),y.appendChild(B),y.appendChild(R),i.appendChild(y),n.appendChild(i),document.body.appendChild(n)})}async closeModal(){e.isModalOpen=!1,document.querySelector("#signTermModal")?.remove()}applyStyles(t,r){for(let[n,o]of Object.entries(r))t.style[n]=o}};function Cu(e,t="prod"){e.showConsole||(console.log=()=>{},console.warn=()=>{},console.error=()=>{});let r={type:t,clientId:e.clientId,examId:e.examId,token:e.token,credentials:e.credentials,showConsole:e.showConsole},n=new Fc(r),o=new ma(r),i=new Uc(r),s=new oo,a=n.login.bind(n),c=n.start.bind(n),l=async ji=>{let hr=o.getDeviceCheckResult();return hr&&n.setDeviceCheckData(hr),c(ji)},h=n.finish.bind(n),d=n.startChallenge.bind(n),u=n.stopChallenge.bind(n),b=n.pause.bind(n),m=n.resume.bind(n),f=n.setOnFocusCallback.bind(n),y=n.setOnLostFocusCallback.bind(n),v=n.onChangeDevices.bind(n),_=n.setOnBufferSizeErrorCallback.bind(n),x=n.setOnStopSharingScreenCallback.bind(n),B=n.onRealtimeAlerts.bind(n),O=i.signInTerms.bind(i),R=o.checkDevices.bind(o),ue=n.appChecker.checkExternalCamera.bind(n.appChecker),se=n.appChecker.startSession.bind(n.appChecker),Vr=n.appChecker.takePicture.bind(n.appChecker),Ui=n.appChecker.goToPositionGuide.bind(n.appChecker),Hr=n.appChecker.startTransmission.bind(n.appChecker),mn=o.runCheckDevicesFlow.bind(o),gn=o.changeSelectedDevice.bind(o),Ni=s.takePicture.bind(s);return{login:a,start:l,finish:h,startChallenge:d,stopChallenge:u,onFocus:f,onLostFocus:y,onChangeDevices:v,onBufferSizeError:_,onRealtimeAlerts:B,checkDevices:R,runCheckDevicesFlow:mn,changeSelectedDevice:gn,capturePhoto:Ni,enumarateDevices:St,checkPermissions:Ki,checkIfhasMultipleMonitors:Xi,onStopSharingScreen:x,signInTerms:O,checkExternalCamera:ue,startExternalCameraSession:se,takeExternalCameraPicture:Vr,goToExternalCameraPositionStep:Ui,startExternalCameraTransmission:Hr}}typeof window<"u"&&(window.useProctoring=Cu);})();