easyproctor 1.1.2 → 1.1.3

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
@@ -24385,7 +24385,6 @@ var CameraRecorder = class {
24385
24385
  this.recordingPause = pauseRecording;
24386
24386
  this.recordingResume = resumeRecording;
24387
24387
  this.recordingStart();
24388
- this.photoShotsCycle();
24389
24388
  }
24390
24389
  async stopRecording() {
24391
24390
  this.recordingStop && await this.recordingStop();
@@ -24397,30 +24396,6 @@ var CameraRecorder = class {
24397
24396
  async resumeRecording() {
24398
24397
  await this.recordingResume();
24399
24398
  }
24400
- photoShotsCycle() {
24401
- const track = this.cameraStream.getVideoTracks()[0];
24402
- this.imageCapture = new ImageCapture(track);
24403
- this.imageInterval = setInterval(() => {
24404
- this.imageCapture.takePhoto().then((blob) => {
24405
- return createImageBitmap(blob);
24406
- }).then(async (imageBitmap) => {
24407
- const canvas = document.createElement("canvas");
24408
- canvas.width = 1280;
24409
- canvas.height = 720;
24410
- const ctx = canvas.getContext("bitmaprenderer");
24411
- ctx.transferFromImageBitmap(imageBitmap);
24412
- const blob = await new Promise((res) => canvas.toBlob(res));
24413
- if (blob instanceof Blob && this.azureUpload && this.backendToken) {
24414
- this.azureUpload.upload({
24415
- file: new File([blob], `EP_${this.proctoringId}_image_${this.imageCount}.jpg`, {
24416
- type: "image/jpeg"
24417
- })
24418
- }, this.backendToken);
24419
- this.imageCount++;
24420
- }
24421
- }).catch((error) => console.log(error));
24422
- }, 15e3);
24423
- }
24424
24399
  async saveOnSession(session) {
24425
24400
  const settings = this.cameraStream.getVideoTracks()[0].getSettings();
24426
24401
  const settingsAudio = this.cameraStream.getAudioTracks()[0].getSettings();
package/index.js CHANGED
@@ -35919,7 +35919,6 @@ var CameraRecorder = class {
35919
35919
  this.recordingPause = pauseRecording;
35920
35920
  this.recordingResume = resumeRecording;
35921
35921
  this.recordingStart();
35922
- this.photoShotsCycle();
35923
35922
  }
35924
35923
  async stopRecording() {
35925
35924
  this.recordingStop && await this.recordingStop();
@@ -35931,30 +35930,6 @@ var CameraRecorder = class {
35931
35930
  async resumeRecording() {
35932
35931
  await this.recordingResume();
35933
35932
  }
35934
- photoShotsCycle() {
35935
- const track = this.cameraStream.getVideoTracks()[0];
35936
- this.imageCapture = new ImageCapture(track);
35937
- this.imageInterval = setInterval(() => {
35938
- this.imageCapture.takePhoto().then((blob) => {
35939
- return createImageBitmap(blob);
35940
- }).then(async (imageBitmap) => {
35941
- const canvas = document.createElement("canvas");
35942
- canvas.width = 1280;
35943
- canvas.height = 720;
35944
- const ctx = canvas.getContext("bitmaprenderer");
35945
- ctx.transferFromImageBitmap(imageBitmap);
35946
- const blob = await new Promise((res) => canvas.toBlob(res));
35947
- if (blob instanceof Blob && this.azureUpload && this.backendToken) {
35948
- this.azureUpload.upload({
35949
- file: new File([blob], `EP_${this.proctoringId}_image_${this.imageCount}.jpg`, {
35950
- type: "image/jpeg"
35951
- })
35952
- }, this.backendToken);
35953
- this.imageCount++;
35954
- }
35955
- }).catch((error) => console.log(error));
35956
- }, 15e3);
35957
- }
35958
35933
  async saveOnSession(session) {
35959
35934
  const settings = this.cameraStream.getVideoTracks()[0].getSettings();
35960
35935
  const settingsAudio = this.cameraStream.getAudioTracks()[0].getSettings();
@@ -34,6 +34,5 @@ export declare class CameraRecorder implements IRecorder {
34
34
  stopRecording(): Promise<void>;
35
35
  pauseRecording(): Promise<void>;
36
36
  resumeRecording(): Promise<void>;
37
- photoShotsCycle(): void;
38
37
  saveOnSession(session: ProctoringSession): Promise<void>;
39
38
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "easyproctor",
3
- "version": "1.1.2",
3
+ "version": "1.1.3",
4
4
  "description": "Modulo web de gravação do EasyProctor",
5
5
  "main": "./index.js",
6
6
  "module": "./esm/index.js",
@@ -21,7 +21,7 @@ bitsperframe: %d
21
21
  `,{name:v},!0);else{d=[];for(var p=0;p<s.length;p++){var B=s[p],z=n(B,v+"["+p+"]");d.push(z)}}return d}function a(s,v,d){var p;return s&&(p={},Tt(s,function(B,z){if(v==="string")z===void 0?p[B]="undefined":z===null?p[B]="null":z.toString?p[B]=z.toString():p[B]="invalid field: toString() is not defined.";else if(v==="number")if(z===void 0)p[B]="undefined";else if(z===null)p[B]="null";else{var ee=parseFloat(z);isNaN(ee)?p[B]="NaN":p[B]=ee}else p[B]="invalid field: "+d+" is of unknown type.",e.throwInternal(Pe.CRITICAL,p[B],null,!0)})),p}})}return t}();var ym=function(){function t(){var e=Hn(),r=ir(),n=!1,i=!0;gt(t,this,function(a){try{if(e&&Tn(e,"online",d)&&(Tn(e,"offline",p),n=!0),r){var s=r.body||r;Wt(s.ononline)||(s.ononline=d,s.onoffline=p,n=!0)}if(n){var v=Rr();v&&!ke(v.onLine)&&(i=v.onLine)}}catch{n=!1}a.isListening=n,a.isOnline=function(){var B=!0,z=Rr();return n?B=i:z&&!ke(z.onLine)&&(B=z.onLine),B},a.isOffline=function(){return!a.isOnline()};function d(){i=!0}function p(){i=!1}})}return t.Offline=new t,t}();var cc=ym.Offline;var Em=8,df=function(){function t(){}return t.prototype.getHashCodeScore=function(e){var r=this.getHashCode(e)/t.INT_MAX_VALUE;return r*100},t.prototype.getHashCode=function(e){if(e==="")return 0;for(;e.length<Em;)e=e.concat(e);for(var r=5381,n=0;n<e.length;++n)r=(r<<5)+r+e.charCodeAt(n),r=r&r;return Math.abs(r)},t.INT_MAX_VALUE=2147483647,t}();var vf=function(){function t(){var e=this,r=new df,n=new Da;e.getSamplingScore=function(i){var a=0;return i.tags&&i.tags[n.userId]?a=r.getHashCodeScore(i.tags[n.userId]):i.ext&&i.ext.user&&i.ext.user.id?a=r.getHashCodeScore(i.ext.user.id):i.tags&&i.tags[n.operationId]?a=r.getHashCodeScore(i.tags[n.operationId]):i.ext&&i.ext.telemetryTrace&&i.ext.telemetryTrace.traceID?a=r.getHashCodeScore(i.ext.telemetryTrace.traceID):a=Math.random()*100,a}}return t}();var mf=function(){function t(e,r){this.INT_MAX_VALUE=2147483647;var n=r||$n(null);(e>100||e<0)&&(n.throwInternal(Pe.WARNING,we.SampleRateOutOfRange,"Sampling rate is out of range (0..100). Sampling will be disabled, you may be sending too much data which may affect your AI service level.",{samplingRate:e},!0),e=100),this.sampleRate=e,this.samplingScoreGenerator=new vf}return t.prototype.isSampledIn=function(e){var r=this.sampleRate,n=!1;return r==null||r>=100||e.baseType===en.dataType?!0:(n=this.samplingScoreGenerator.getSamplingScore(e)<r,n)},t}();var ei,wm=65e3;function qs(t){try{return t.responseText}catch{}return null}function pf(){return{endpointUrl:function(){return"https://dc.services.visualstudio.com/v2/track"},emitLineDelimitedJson:function(){return!1},maxBatchInterval:function(){return 15e3},maxBatchSizeInBytes:function(){return 102400},disableTelemetry:function(){return!1},enableSessionStorageBuffer:function(){return!0},isRetryDisabled:function(){return!1},isBeaconApiDisabled:function(){return!0},disableXhr:function(){return!1},onunloadDisableFetch:function(){return!1},onunloadDisableBeacon:function(){return!1},instrumentationKey:function(){},namePrefix:function(){},samplingPercentage:function(){return 100},customHeaders:function(){},convertUndefined:function(){},eventsLimitInMem:function(){return 1e4}}}var Rm=(ei={},ei[Jr.dataType]=lc,ei[Pn.dataType]=uf,ei[kr.dataType]=lf,ei[Bn.dataType]=cf,ei[xr.dataType]=of,ei[en.dataType]=sf,ei[tn.dataType]=af,ei),uc=function(t){ut(e,t);function e(){var r=t.call(this)||this;r.priority=1001,r.identifier=Io;var n,i,a,s=!1,v,d,p,B={},z=0,ee,te;return r._senderConfig=pf(),gt(e,r,function(k,ce){function P(){wr("Method not implemented.")}k.pause=function(){gr(),s=!0},k.resume=function(){s&&(s=!1,i=null,k._buffer.size()>k._senderConfig.maxBatchSizeInBytes()&&k.triggerSend(!0,null,10),hr())},k.flush=function(){if(!s){gr();try{k.triggerSend(!0,null,1)}catch(le){k.diagLog().throwInternal(Pe.CRITICAL,we.FlushFailed,"flush failed, telemetry will not be collected: "+_t(le),{exception:it(le)})}}},k.onunloadFlush=function(){if(!s)if((k._senderConfig.onunloadDisableBeacon()===!1||k._senderConfig.isBeaconApiDisabled()===!1)&&Fi())try{k.triggerSend(!0,Ge,2)}catch(le){k.diagLog().throwInternal(Pe.CRITICAL,we.FailedToSendQueuedTelemetry,"failed to flush with beacon sender on page unload, telemetry will not be collected: "+_t(le),{exception:it(le)})}else k.flush()},k.teardown=P,k.addHeader=function(le,Le){B[le]=Le},k.initialize=function(le,Le,$e,ae){ce.initialize(le,Le,$e,ae);var be=k._getTelCtx(),Ie=k.identifier;d=new ff(Le.logger),n=0,i=null,a=0,k._sender=null,p=0;var Ce=k.diagLog(),Be=pf();Tt(Be,function(ot,mt){k._senderConfig[ot]=function(){return be.getConfig(Ie,ot,mt())}}),k._buffer=k._senderConfig.enableSessionStorageBuffer()&&Xi()?new rf(Ce,k._senderConfig):new tf(Ce,k._senderConfig),k._sample=new mf(k._senderConfig.samplingPercentage(),Ce),T(le)||Ce.throwInternal(Pe.CRITICAL,we.InvalidInstrumentationKey,"Invalid Instrumentation key "+le.instrumentationKey),!Ki(k._senderConfig.endpointUrl())&&k._senderConfig.customHeaders()&&k._senderConfig.customHeaders().length>0&&tt(k._senderConfig.customHeaders(),function(ot){r.addHeader(ot.header,ot.value)});var Ye=k._senderConfig,Fe=null;!Ye.disableXhr()&&xs()?Fe=Dt:!Ye.disableXhr()&&Ui()&&(Fe=st),!Fe&&bs()&&(Fe=Xt),ee=Fe||st,!Ye.isBeaconApiDisabled()&&Fi()&&(Fe=ft),k._sender=Fe||st,!Ye.onunloadDisableFetch()&&bs(!0)?te=yt:Fi()?te=ft:!Ye.disableXhr()&&xs()?te=Dt:!Ye.disableXhr()&&Ui()?te=st:te=ee},k.processTelemetry=function(le,Le){Le=k._getTelCtx(Le);try{if(k._senderConfig.disableTelemetry())return;if(!le){Le.diagLog().throwInternal(Pe.CRITICAL,we.CannotSendEmptyTelemetry,"Cannot send empty telemetry");return}if(le.baseData&&!le.baseType){Le.diagLog().throwInternal(Pe.CRITICAL,we.InvalidEvent,"Cannot send telemetry without baseData and baseType");return}if(le.baseType||(le.baseType="EventData"),!k._sender){Le.diagLog().throwInternal(Pe.CRITICAL,we.SenderNotInitialized,"Sender was not initialized");return}if(oe(le))le[Ta]=k._sample.sampleRate;else{Le.diagLog().throwInternal(Pe.WARNING,we.TelemetrySampledAndNotSent,"Telemetry item was sampled out and not sent",{SampleRate:k._sample.sampleRate});return}var $e=k._senderConfig.convertUndefined()||void 0,ae=le.iKey||k._senderConfig.instrumentationKey(),be=e.constructEnvelope(le,ae,Le.diagLog(),$e);if(!be){Le.diagLog().throwInternal(Pe.CRITICAL,we.CreateEnvelopeError,"Unable to create an AppInsights envelope");return}var Ie=!1;if(le.tags&&le.tags[Aa]&&(tt(le.tags[Aa],function(Fe){try{Fe&&Fe(be)===!1&&(Ie=!0,Le.diagLog().warnToConsole("Telemetry processor check returns false"))}catch(ot){Le.diagLog().throwInternal(Pe.CRITICAL,we.TelemetryInitializerFailed,"One of telemetry initializers failed, telemetry item will not be sent: "+_t(ot),{exception:it(ot)},!0)}}),delete le.tags[Aa]),Ie)return;var Ce=d.serialize(be),Be=k._buffer,Ye=Be.size();Ye+Ce.length>k._senderConfig.maxBatchSizeInBytes()&&k.triggerSend(!0,null,10),Be.enqueue(Ce),hr()}catch(Fe){Le.diagLog().throwInternal(Pe.WARNING,we.FailedAddingTelemetryToBuffer,"Failed adding telemetry to the sender's buffer, some telemetry will be lost: "+_t(Fe),{exception:it(Fe)})}k.processNext(le,Le)},k._xhrReadyStateChange=function(le,Le,$e){le.readyState===4&&se(le.status,Le,le.responseURL,$e,St(le),qs(le)||le.response)},k.triggerSend=function(le,Le,$e){if(le===void 0&&(le=!0),!s)try{var ae=k._buffer;if(k._senderConfig.disableTelemetry())ae.clear();else{if(ae.count()>0){var be=ae.getItems();Qe($e||0,le),Le?Le.call(r,be,le):k._sender(be,le)}a=+new Date}gr()}catch(Ce){var Ie=xa();(!Ie||Ie>9)&&k.diagLog().throwInternal(Pe.CRITICAL,we.TransmissionFailed,"Telemetry transmission failed, some telemetry will be lost: "+_t(Ce),{exception:it(Ce)})}},k._onError=function(le,Le,$e){k.diagLog().throwInternal(Pe.WARNING,we.OnError,"Failed to send telemetry.",{message:Le}),k._buffer.clearSent(le)},k._onPartialSuccess=function(le,Le){for(var $e=[],ae=[],be=Le.errors.reverse(),Ie=0,Ce=be;Ie<Ce.length;Ie++){var Be=Ce[Ie],Ye=le.splice(Be.index,1)[0];$t(Be.statusCode)?ae.push(Ye):$e.push(Ye)}le.length>0&&k._onSuccess(le,Le.itemsAccepted),$e.length>0&&k._onError($e,St(null,["partial success",Le.itemsAccepted,"of",Le.itemsReceived].join(" "))),ae.length>0&&(an(ae),k.diagLog().throwInternal(Pe.WARNING,we.TransmissionFailed,"Partial success. Delivered: "+le.length+", Failed: "+$e.length+". Will retry to send "+ae.length+" our of "+Le.itemsReceived+" items"))},k._onSuccess=function(le,Le){k._buffer.clearSent(le)},k._xdrOnLoad=function(le,Le){var $e=qs(le);if(le&&($e+""=="200"||$e===""))n=0,k._onSuccess(Le,0);else{var ae=sr($e);ae&&ae.itemsReceived&&ae.itemsReceived>ae.itemsAccepted&&!k._senderConfig.isRetryDisabled()?k._onPartialSuccess(Le,ae):k._onError(Le,Nt(le))}};function oe(le){return k._sample.isSampledIn(le)}function se(le,Le,$e,ae,be,Ie){var Ce=null;if(k._appId||(Ce=sr(Ie),Ce&&Ce.appId&&(k._appId=Ce.appId)),(le<200||le>=300)&&le!==0){if((le===301||le===307||le===308)&&!xe($e)){k._onError(Le,be);return}!k._senderConfig.isRetryDisabled()&&$t(le)?(an(Le),k.diagLog().throwInternal(Pe.WARNING,we.TransmissionFailed,". Response code "+le+". Will retry to send "+Le.length+" items.")):k._onError(Le,be)}else if(cc.isOffline()){if(!k._senderConfig.isRetryDisabled()){var Be=10;an(Le,Be),k.diagLog().throwInternal(Pe.WARNING,we.TransmissionFailed,". Offline - Response Code: ".concat(le,". Offline status: ").concat(cc.isOffline(),". Will retry to send ").concat(Le.length," items."))}}else xe($e),le===206?(Ce||(Ce=sr(Ie)),Ce&&!k._senderConfig.isRetryDisabled()?k._onPartialSuccess(Le,Ce):k._onError(Le,be)):(n=0,k._onSuccess(Le,ae))}function xe(le){return p>=10?!1:!ke(le)&&le!==""&&le!==k._senderConfig.endpointUrl()?(k._senderConfig.endpointUrl=function(){return le},++p,!0):!1}function Ge(le,Le){te?te(le,!1):ft(le,Le)}function lt(le){var Le=Rr(),$e=k._buffer,ae=k._senderConfig.endpointUrl(),be=k._buffer.batchPayloads(le),Ie=new Blob([be],{type:"text/plain;charset=UTF-8"}),Ce=Le.sendBeacon(ae,Ie);return Ce&&($e.markAsSent(le),k._onSuccess(le,le.length)),Ce}function ft(le,Le){if(ur(le)&&le.length>0&&!lt(le)){for(var $e=[],ae=0;ae<le.length;ae++){var be=le[ae];lt([be])||$e.push(be)}$e.length>0&&(ee($e,!0),k.diagLog().throwInternal(Pe.WARNING,we.TransmissionFailed,". Failed to send telemetry with Beacon API, retried with normal sender."))}}function st(le,Le){var $e=new XMLHttpRequest,ae=k._senderConfig.endpointUrl();try{$e[Mn]=!0}catch{}$e.open("POST",ae,Le),$e.setRequestHeader("Content-type","application/json"),Ki(ae)&&$e.setRequestHeader(Ct.sdkContextHeader,Ct.sdkContextHeaderAppIdRequest),tt(un(B),function(Ie){$e.setRequestHeader(Ie,B[Ie])}),$e.onreadystatechange=function(){return k._xhrReadyStateChange($e,le,le.length)},$e.onerror=function(Ie){return k._onError(le,St($e),Ie)};var be=k._buffer.batchPayloads(le);$e.send(be),k._buffer.markAsSent(le)}function yt(le,Le){if(ur(le)){for(var $e=le.length,ae=0;ae<le.length;ae++)$e+=le[ae].length;z+$e<=wm?tr(le,!1):Fi()?ft(le,Le):(ee&&ee(le,!0),k.diagLog().throwInternal(Pe.WARNING,we.TransmissionFailed,". Failed to send telemetry with Beacon API, retried with xhrSender."))}}function Xt(le,Le){tr(le,!0)}function tr(le,Le){var $e,ae=k._senderConfig.endpointUrl(),be=k._buffer.batchPayloads(le),Ie=new Blob([be],{type:"application/json"}),Ce=new Headers,Be=be.length,Ye=!1,Fe=!1;Ki(ae)&&Ce.append(Ct.sdkContextHeader,Ct.sdkContextHeaderAppIdRequest),tt(un(B),function(Ee){Ce.append(Ee,B[Ee])});var ot=($e={method:"POST",headers:Ce,body:Ie},$e[Mn]=!0,$e);Le||(ot.keepalive=!0,Ye=!0,z+=Be);var mt=new Request(ae,ot);try{mt[Mn]=!0}catch{}k._buffer.markAsSent(le);try{fetch(mt).then(function(Ee){Le||(z-=Be,Be=0),Fe||(Fe=!0,Ee.ok?Ee.text().then(function(br){se(Ee.status,le,Ee.url,le.length,Ee.statusText,br)}):k._onError(le,Ee.statusText))}).catch(function(Ee){Le||(z-=Be,Be=0),Fe||(Fe=!0,k._onError(le,Ee.message))})}catch(Ee){Fe||k._onError(le,it(Ee))}Ye&&!Fe&&(Fe=!0,k._onSuccess(le,le.length))}function sr(le){try{if(le&&le!==""){var Le=vr().parse(le);if(Le&&Le.itemsReceived&&Le.itemsReceived>=Le.itemsAccepted&&Le.itemsReceived-Le.itemsAccepted===Le.errors.length)return Le}}catch($e){k.diagLog().throwInternal(Pe.CRITICAL,we.InvalidBackendResponse,"Cannot parse the response. "+_t($e),{response:le})}return null}function an(le,Le){if(Le===void 0&&(Le=1),!(!le||le.length===0)){var $e=k._buffer;$e.clearSent(le),n++;for(var ae=0,be=le;ae<be.length;ae++){var Ie=be[ae];$e.enqueue(Ie)}Tr(Le),hr()}}function Tr(le){var Le=10,$e;if(n<=1)$e=Le;else{var ae=(Math.pow(2,n)-1)/2,be=Math.floor(Math.random()*ae*Le)+1;be=le*be,$e=Math.max(Math.min(be,3600),Le)}var Ie=fr()+$e*1e3;i=Ie}function hr(){if(!v&&!s){var le=i?Math.max(0,i-fr()):0,Le=Math.max(k._senderConfig.maxBatchInterval(),le);v=setTimeout(function(){v=null,k.triggerSend(!0,null,1)},Le)}}function gr(){clearTimeout(v),v=null,i=null}function $t(le){return le===408||le===429||le===500||le===503}function St(le,Le){return le?"XMLHttpRequest,Status:"+le.status+",Response:"+qs(le)||le.response||"":Le}function Dt(le,Le){var $e=k._buffer,ae=Hn(),be=new XDomainRequest;be.onload=function(){return k._xdrOnLoad(be,le)},be.onerror=function(Ye){return k._onError(le,Nt(be),Ye)};var Ie=ae&&ae.location&&ae.location.protocol||"";if(k._senderConfig.endpointUrl().lastIndexOf(Ie,0)!==0){k.diagLog().throwInternal(Pe.WARNING,we.TransmissionFailed,". Cannot send XDomain request. The endpoint URL protocol doesn't match the hosting page protocol."),$e.clear();return}var Ce=k._senderConfig.endpointUrl().replace(/^(https?:)/,"");be.open("POST",Ce);var Be=$e.batchPayloads(le);be.send(Be),$e.markAsSent(le)}function Nt(le,Le){return le?"XDomainRequest,Response:"+qs(le)||"":Le}function It(){var le="getNotifyMgr";return k.core[le]?k.core[le]():k.core._notificationManager}function Qe(le,Le){var $e=It();if($e&&$e.eventsSendRequest)try{$e.eventsSendRequest(le,Le)}catch(ae){k.diagLog().throwInternal(Pe.CRITICAL,we.NotificationException,"send request notification failed: "+_t(ae),{exception:it(ae)})}}function T(le){var Le=ke(le.disableInstrumentationKeyValidation)?!1:le.disableInstrumentationKeyValidation;if(Le)return!0;var $e="^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$",ae=new RegExp($e);return ae.test(le.instrumentationKey)}}),r}return e.constructEnvelope=function(r,n,i,a){var s;n!==r.iKey&&!ke(n)?s=Qt(Qt({},r),{iKey:n}):s=r;var v=Rm[s.baseType]||lc;return v(i,s,a)},e}(In);var Tm="ai_session",fc=function(){function t(){}return t}();var hf=function(){function t(e,r){var n=this,i,a,s=$n(r),v=Vi(r);gt(t,n,function(d){e||(e={}),at(e.sessionExpirationMs)||(e.sessionExpirationMs=function(){return t.acquisitionSpan}),at(e.sessionRenewalMs)||(e.sessionRenewalMs=function(){return t.renewalSpan}),d.config=e;var p=d.config.sessionCookiePostfix&&d.config.sessionCookiePostfix()?d.config.sessionCookiePostfix():d.config.namePrefix&&d.config.namePrefix()?d.config.namePrefix():"";i=function(){return Tm+p},d.automaticSession=new fc,d.update=function(){var ce=fr(),P=!1,oe=d.automaticSession;oe.id||(P=!B(oe,ce));var se=d.config.sessionExpirationMs();if(!P&&se>0){var xe=d.config.sessionRenewalMs(),Ge=ce-oe.acquisitionDate,lt=ce-oe.renewalDate;P=Ge<0||lt<0,P=P||Ge>se,P=P||lt>xe}P?ee(ce):(!a||ce-a>t.cookieUpdateInterval)&&te(oe,ce)},d.backup=function(){var ce=d.automaticSession;k(ce.id,ce.acquisitionDate,ce.renewalDate)};function B(ce,P){var oe=!1,se=v.get(i());if(se&&at(se.split))oe=z(ce,se);else{var xe=jl(s,i());xe&&(oe=z(ce,xe))}return oe||!!ce.id}function z(ce,P){var oe=!1,se=", session will be reset",xe=P.split("|");if(xe.length>=2)try{var Ge=+xe[1]||0,lt=+xe[2]||0;isNaN(Ge)||Ge<=0?s.throwInternal(Pe.WARNING,we.SessionRenewalDateIsZero,"AI session acquisition date is 0"+se):isNaN(lt)||lt<=0?s.throwInternal(Pe.WARNING,we.SessionRenewalDateIsZero,"AI session renewal date is 0"+se):xe[0]&&(ce.id=xe[0],ce.acquisitionDate=Ge,ce.renewalDate=lt,oe=!0)}catch(ft){s.throwInternal(Pe.CRITICAL,we.ErrorParsingAISessionCookie,"Error parsing ai_session value ["+(P||"")+"]"+se+" - "+_t(ft),{exception:it(ft)})}return oe}function ee(ce){var P=d.config||{},oe=(P.getNewId?P.getNewId():null)||Ra;d.automaticSession.id=oe(P.idLength?P.idLength():22),d.automaticSession.acquisitionDate=ce,te(d.automaticSession,ce),Ns()||s.throwInternal(Pe.WARNING,we.BrowserDoesNotSupportLocalStorage,"Browser does not support local storage. Session durations will be inaccurate.")}function te(ce,P){var oe=ce.acquisitionDate;ce.renewalDate=P;var se=d.config,xe=se.sessionRenewalMs(),Ge=oe+se.sessionExpirationMs()-P,lt=[ce.id,oe,P],ft=0;Ge<xe?ft=Ge/1e3:ft=xe/1e3;var st=se.cookieDomain?se.cookieDomain():null;v.set(i(),lt.join("|"),se.sessionExpirationMs()>0?ft:null,st),a=P}function k(ce,P,oe){Gl(s,i(),[ce,P,oe].join("|"))}})}return t.acquisitionSpan=864e5,t.renewalSpan=18e5,t.cookieUpdateInterval=6e4,t}();var _f=function(){function t(){}return t}();var Sf=function(){function t(){this.id="browser",this.deviceClass="Browser"}return t}();var Am="2.7.4",gf=function(){function t(e){this.sdkVersion=(e.sdkExtension&&e.sdkExtension()?e.sdkExtension()+"_":"")+"javascript:"+Am}return t}();function bf(t){return!(typeof t!="string"||!t||t.match(/,|;|=| |\|/))}var xf=function(){function t(e,r){this.isNewUser=!1,this.isUserCookieSet=!1;var n=$n(r),i=Vi(r),a;gt(t,this,function(s){s.config=e;var v=s.config.userCookiePostfix&&s.config.userCookiePostfix()?s.config.userCookiePostfix():"";a=function(){return t.userCookieName+v};var d=i.get(a());if(d){s.isNewUser=!1;var p=d.split(t.cookieSeparator);p.length>0&&(s.id=p[0],s.isUserCookieSet=!!s.id)}function B(){var oe=e||{},se=(oe.getNewId?oe.getNewId():null)||Ra,xe=se(oe.idLength?e.idLength():22);return xe}function z(oe){var se=Pr(new Date);s.accountAcquisitionDate=se,s.isNewUser=!0;var xe=[oe,se];return xe}function ee(oe){var se=31536e3;s.isUserCookieSet=i.set(a(),oe,se)}if(!s.id){s.id=B();var te=z(s.id);ee(te.join(t.cookieSeparator));var k=e.namePrefix&&e.namePrefix()?e.namePrefix()+"ai_session":"ai_session";Xl(n,k)}s.accountId=e.accountId?e.accountId():void 0;var ce=i.get(t.authUserCookieName);if(ce){ce=decodeURI(ce);var P=ce.split(t.cookieSeparator);P[0]&&(s.authenticatedId=P[0]),P.length>1&&P[1]&&(s.accountId=P[1])}s.setAuthenticatedUserContext=function(oe,se,xe){xe===void 0&&(xe=!1);var Ge=!bf(oe)||se&&!bf(se);if(Ge){n.throwInternal(Pe.WARNING,we.SetAuthContextFailedAccountName,"Setting auth user context failed. User auth/account id should be of type string, and not contain commas, semi-colons, equal signs, spaces, or vertical-bars.",!0);return}s.authenticatedId=oe;var lt=s.authenticatedId;se&&(s.accountId=se,lt=[s.authenticatedId,s.accountId].join(t.cookieSeparator)),xe&&i.set(t.authUserCookieName,encodeURI(lt))},s.clearAuthenticatedUserContext=function(){s.authenticatedId=null,s.accountId=null,i.del(t.authUserCookieName)},s.update=function(oe){if(s.id!==oe||!s.isUserCookieSet){var se=oe||B(),xe=z(se);ee(xe.join(t.cookieSeparator))}}})}return t.cookieSeparator="|",t.userCookieName="ai_user",t.authUserCookieName="ai_authUser",t}();var yf=function(){function t(){}return t}();var Ef=function(){function t(e,r,n,i){var a=this;a.traceID=e||zr(),a.parentID=r,a.name=n;var s=$r();!n&&s&&s.pathname&&(a.name=s.pathname),a.name=Mt(i,a.name)}return t}();var zs="ext",js="tags";function Oa(t,e){t&&t[e]&&un(t[e]).length===0&&delete t[e]}var wf=function(){function t(e,r){var n=this,i=e.logger;this.appId=function(){return null},this.getSessionId=function(){return null},gt(t,this,function(a){a.application=new _f,a.internal=new gf(r),Oi()&&(a.sessionManager=new hf(r,e),a.device=new Sf,a.location=new yf,a.user=new xf(r,e),a.telemetryTrace=new Ef(void 0,void 0,void 0,i),a.session=new fc),a.getSessionId=function(){var s=a.session,v=null;if(s&&et(s.id))v=s.id;else{var d=(a.sessionManager||{}).automaticSession;v=d&&et(d.id)?d.id:null}return v},a.applySessionContext=function(s,v){ht(dr(s.ext,Dr.AppExt),"sesId",a.getSessionId(),et)},a.applyOperatingSystemContxt=function(s,v){ht(s.ext,Dr.OSExt,a.os)},a.applyApplicationContext=function(s,v){var d=a.application;if(d){var p=dr(s,js);ht(p,Pt.applicationVersion,d.ver,et),ht(p,Pt.applicationBuild,d.build,et)}},a.applyDeviceContext=function(s,v){var d=a.device;if(d){var p=dr(dr(s,zs),Dr.DeviceExt);ht(p,"localId",d.id,et),ht(p,"ip",d.ip,et),ht(p,"model",d.model,et),ht(p,"deviceClass",d.deviceClass,et)}},a.applyInternalContext=function(s,v){var d=a.internal;if(d){var p=dr(s,js);ht(p,Pt.internalAgentVersion,d.agentVersion,et),ht(p,Pt.internalSdkVersion,d.sdkVersion,et),(s.baseType===Yn.dataType||s.baseType===kr.dataType)&&(ht(p,Pt.internalSnippet,d.snippetVer,et),ht(p,Pt.internalSdkSrc,d.sdkSrc,et))}},a.applyLocationContext=function(s,v){var d=n.location;d&&ht(dr(s,js,[]),Pt.locationIp,d.ip,et)},a.applyOperationContext=function(s,v){var d=a.telemetryTrace;if(d){var p=dr(dr(s,zs),Dr.TraceExt,{traceID:void 0,parentID:void 0});ht(p,"traceID",d.traceID,et),ht(p,"name",d.name,et),ht(p,"parentID",d.parentID,et)}},a.applyWebContext=function(s,v){var d=n.web;d&&ht(dr(s,zs),Dr.WebExt,d)},a.applyUserContext=function(s,v){var d=a.user;if(d){var p=dr(s,js,[]);ht(p,Pt.userAccountId,d.accountId,et);var B=dr(dr(s,zs),Dr.UserExt);ht(B,"id",d.id,et),ht(B,"authId",d.authenticatedId,et)}},a.cleanUp=function(s,v){var d=s.ext;d&&(Oa(d,Dr.DeviceExt),Oa(d,Dr.UserExt),Oa(d,Dr.WebExt),Oa(d,Dr.OSExt),Oa(d,Dr.AppExt),Oa(d,Dr.TraceExt))}})}return t}();var Im=function(t){ut(e,t);function e(){var r=t.call(this)||this;r.priority=110,r.identifier=_i;var n,i;return gt(e,r,function(a,s){a.initialize=function(d,p,B,z){s.initialize(d,p,B,z);var ee=a._getTelCtx(),te=a.identifier,k=e.getDefaultConfig();i=i||{},Tt(k,function(ce,P){i[ce]=function(){return ee.getConfig(te,ce,P())}}),a.context=new wf(p,i),n=Ul(B,Io),a.context.appId=function(){return n?n._appId:null},a._extConfig=i},a.processTelemetry=function(d,p){if(!ke(d)){p=a._getTelCtx(p),d.name===kr.envelopeType&&p.diagLog().resetInternalMessageCount();var B=a.context||{};B.session&&typeof a.context.session.id!="string"&&B.sessionManager&&B.sessionManager.update();var z=B.user;if(z&&!z.isUserCookieSet&&z.update(B.user.id),v(d,p),z&&z.isNewUser){z.isNewUser=!1;var ee=new Yn(we.SendBrowserInfoOnUserInit,(Rr()||{}).userAgent||"");p.diagLog().logInternalMessage(Pe.CRITICAL,ee)}a.processNext(d,p)}};function v(d,p){dr(d,"tags",[]),dr(d,"ext",{});var B=a.context;B.applySessionContext(d,p),B.applyApplicationContext(d,p),B.applyDeviceContext(d,p),B.applyOperationContext(d,p),B.applyUserContext(d,p),B.applyOperatingSystemContxt(d,p),B.applyWebContext(d,p),B.applyLocationContext(d,p),B.applyInternalContext(d,p),B.cleanUp(d,p)}}),r}return e.getDefaultConfig=function(){var r={instrumentationKey:function(){},accountId:function(){return null},sessionRenewalMs:function(){return 18e5},samplingPercentage:function(){return 100},sessionExpirationMs:function(){return 864e5},cookieDomain:function(){return null},sdkExtension:function(){return null},isBrowserLinkTrackingEnabled:function(){return!1},appId:function(){return null},getSessionId:function(){return null},namePrefix:function(){},sessionCookiePostfix:function(){},userCookiePostfix:function(){},idLength:function(){return 22},getNewId:function(){return null}};return r},e}(In),dc=Im;var rn="properties";function Rf(t,e,r){var n=0,i=t[e],a=t[r];return i&&a&&(n=mr(i,a)),n}function Qi(t,e,r,n,i){var a=0,s=Rf(r,n,i);return s&&(a=gi(t,e,Qr(s))),a}function gi(t,e,r){var n="ajaxPerf",i=0;if(t&&e&&r){var a=t[n]=t[n]||{};a[e]=r,i=1}return i}function Cm(t,e){var r=t.perfTiming,n=e[rn]||{},i=0,a="name",s="Start",v="End",d="domainLookup",p="connect",B="redirect",z="request",ee="response",te="duration",k="startTime",ce=d+s,P=d+v,oe=p+s,se=p+v,xe=z+s,Ge=z+v,lt=ee+s,ft=ee+v,st=B+s,yt=B=v,Xt="transferSize",tr="encodedBodySize",sr="decodedBodySize",an="serverTiming";if(r){i|=Qi(n,B,r,st,yt),i|=Qi(n,d,r,ce,P),i|=Qi(n,p,r,oe,se),i|=Qi(n,z,r,xe,Ge),i|=Qi(n,ee,r,lt,ft),i|=Qi(n,"networkConnect",r,k,se),i|=Qi(n,"sentRequest",r,xe,ft);var Tr=r[te];Tr||(Tr=Rf(r,k,ft)||0),i|=gi(n,te,Tr),i|=gi(n,"perfTotal",Tr);var hr=r[an];if(hr){var gr={};tt(hr,function($t,St){var Dt=J0($t[a]||""+St),Nt=gr[Dt]||{};Tt($t,function(It,Qe){(It!==a&&et(Qe)||Sa(Qe))&&(Nt[It]&&(Qe=Nt[It]+";"+Qe),(Qe||!et(Qe))&&(Nt[It]=Qe))}),gr[Dt]=Nt}),i|=gi(n,an,gr)}i|=gi(n,Xt,r[Xt]),i|=gi(n,tr,r[tr]),i|=gi(n,sr,r[sr])}else t.perfMark&&(i|=gi(n,"missing",t.perfAttempts));i&&(e[rn]=n)}var Mm=function(){function t(){var e=this;e.openDone=!1,e.setRequestHeaderDone=!1,e.sendDone=!1,e.abortDone=!1,e.stateChangeAttached=!1}return t}();var vc=function(){function t(e,r,n){var i=this,a=n,s="responseText";i.perfMark=null,i.completed=!1,i.requestHeadersSize=null,i.requestHeaders=null,i.responseReceivingDuration=null,i.callbackDuration=null,i.ajaxTotalDuration=null,i.aborted=0,i.pageUrl=null,i.requestUrl=null,i.requestSize=0,i.method=null,i.status=null,i.requestSentTime=null,i.responseStartedTime=null,i.responseFinishedTime=null,i.callbackFinishedTime=null,i.endTime=null,i.xhrMonitoringState=new Mm,i.clientFailure=0,i.traceID=e,i.spanID=r,gt(t,i,function(v){v.getAbsoluteUrl=function(){return v.requestUrl?ks(v.requestUrl):null},v.getPathName=function(){return v.requestUrl?Qn(a,Ds(v.method,v.requestUrl)):null},v.CreateTrackItem=function(d,p,B){var z;if(v.ajaxTotalDuration=Math.round(mr(v.requestSentTime,v.responseFinishedTime)*1e3)/1e3,v.ajaxTotalDuration<0)return null;var ee=(z={id:"|"+v.traceID+"."+v.spanID,target:v.getAbsoluteUrl(),name:v.getPathName(),type:d,startTime:null,duration:v.ajaxTotalDuration,success:+v.status>=200&&+v.status<400,responseCode:+v.status,method:v.method},z[rn]={HttpMethod:v.method},z);if(v.requestSentTime&&(ee.startTime=new Date,ee.startTime.setTime(v.requestSentTime)),Cm(v,ee),p&&un(v.requestHeaders).length>0&&(ee[rn]=ee[rn]||{},ee[rn].requestHeaders=v.requestHeaders),B){var te=B();if(te){var k=te.correlationContext;if(k&&(ee.correlationContext=k),te.headerMap&&un(te.headerMap).length>0&&(ee[rn]=ee[rn]||{},ee[rn].responseHeaders=te.headerMap),v.errorStatusText&&v.status>=400){var ce=te.type;ee[rn]=ee[rn]||{},(ce===""||ce==="text")&&(ee[rn][s]=te[s]?te.statusText+" - "+te[s]:te.statusText),ce==="json"&&(ee[rn][s]=te.response?te.statusText+" - "+JSON.stringify(te.response):te.statusText)}}}return ee}})}return t}();var mc=function(){function t(e,r){var n=this;n.traceFlag=t.DEFAULT_TRACE_FLAG,n.version=t.DEFAULT_VERSION,e&&t.isValidTraceId(e)?n.traceId=e:n.traceId=zr(),r&&t.isValidSpanId(r)?n.spanId=r:n.spanId=zr().substr(0,16)}return t.isValidTraceId=function(e){return e.match(/^[0-9a-f]{32}$/)&&e!=="00000000000000000000000000000000"},t.isValidSpanId=function(e){return e.match(/^[0-9a-f]{16}$/)&&e!=="0000000000000000"},t.prototype.toString=function(){var e=this;return"".concat(e.version,"-").concat(e.traceId,"-").concat(e.spanId,"-").concat(e.traceFlag)},t.DEFAULT_TRACE_FLAG="01",t.DEFAULT_VERSION="00",t}();var Tf="ai.ajxmn.",Po="diagLog",nn="ajaxData",If="throwInternal",Bo="fetch",Af=0;function Pm(){var t=cn();return!t||ke(t.Request)||ke(t.Request[Gt])||ke(t[Bo])?null:t[Bo]}function Bm(t){var e=!1;if(Ui()){var r=XMLHttpRequest[Gt];e=!ke(r)&&!ke(r.open)&&!ke(r.send)&&!ke(r.abort)}var n=xa();if(n&&n<9&&(e=!1),e)try{var i=new XMLHttpRequest;i[nn]={};var a=XMLHttpRequest[Gt].open;XMLHttpRequest[Gt].open=a}catch(s){e=!1,No(t,we.FailedMonitorAjaxOpen,"Failed to enable XMLHttpRequest monitoring, extension is not supported",{exception:it(s)})}return e}function Gs(t){var e="";try{!ke(t)&&!ke(t[nn])&&!ke(t[nn].requestUrl)&&(e+="(url: '"+t[nn].requestUrl+"')")}catch{}return e}function No(t,e,r,n,i){t[Po]()[If](Pe.CRITICAL,e,r,n,i)}function La(t,e,r,n,i){t[Po]()[If](Pe.WARNING,e,r,n,i)}function Mo(t,e,r){return function(n){No(t,e,r,{ajaxDiagnosticsMessage:Gs(n.inst),exception:it(n.err)})}}function Fa(t,e){return t&&e?t.indexOf(e):-1}var pc=function(t){ut(e,t);function e(){var r=t.call(this)||this;r.identifier=e.identifier,r.priority=120;var n="trackDependencyDataInternal",i=$r(),a=!1,s=!1,v=i&&i.host&&i.host.toLowerCase(),d=e.getEmptyConfig(),p=!1,B=!1,z=0,ee,te,k,ce,P=!1,oe=0,se=!1,xe=[],Ge={},lt,ft;return gt(e,r,function(st,yt){st.initialize=function(ae,be,Ie,Ce){if(!st.isInitialized()){yt.initialize(ae,be,Ie,Ce);var Be=st._getTelCtx(),Ye=e.getDefaultConfig();Tt(Ye,function(br,Ar){d[br]=Be.getConfig(e.identifier,br,Ar)});var Fe=d.distributedTracingMode;if(p=d.enableRequestHeaderTracking,B=d.enableAjaxErrorStatusText,P=d.enableAjaxPerfTracking,oe=d.maxAjaxCallsPerView,se=d.enableResponseHeaderTracking,lt=d.excludeRequestFromAutoTrackingPatterns,ft=d.addRequestContext,k=Fe===dn.AI||Fe===dn.AI_AND_W3C,te=Fe===dn.AI_AND_W3C||Fe===dn.W3C,P){var ot=ae.instrumentationKey||"unkwn";ot.length>5?ce=Tf+ot.substring(ot.length-5)+".":ce=Tf+ot+"."}if(d.disableAjaxTracking===!1&&an(),tr(),Ie.length>0&&Ie){for(var mt=void 0,Ee=0;!mt&&Ee<Ie.length;)Ie[Ee]&&Ie[Ee].identifier===_i&&(mt=Ie[Ee]),Ee++;mt&&(ee=mt.context)}}},st.teardown=function(){tt(xe,function(ae){ae.rm()}),xe=[],a=!1,s=!1,st.setInitialized(!1)},st.trackDependencyData=function(ae,be){st[n](ae,be)},st.includeCorrelationHeaders=function(ae,be,Ie,Ce){var Be=st._currentWindowHost||v;if(be){if(Jn.canIncludeCorrelationHeader(d,ae.getAbsoluteUrl(),Be)){if(Ie||(Ie={}),Ie.headers=new Headers(Ie.headers||(be instanceof Request?be.headers||{}:{})),k){var Ye="|"+ae.traceID+"."+ae.spanID;Ie.headers.set(Ct.requestIdHeader,Ye),p&&(ae.requestHeaders[Ct.requestIdHeader]=Ye)}var Fe=d.appId||ee&&ee.appId();if(Fe&&(Ie.headers.set(Ct.requestContextHeader,Ct.requestContextAppIdFormat+Fe),p&&(ae.requestHeaders[Ct.requestContextHeader]=Ct.requestContextAppIdFormat+Fe)),te){var ot=new mc(ae.traceID,ae.spanID);Ie.headers.set(Ct.traceParentHeader,ot.toString()),p&&(ae.requestHeaders[Ct.traceParentHeader]=ot.toString())}}return Ie}else if(Ce){if(Jn.canIncludeCorrelationHeader(d,ae.getAbsoluteUrl(),Be)){if(k){var Ye="|"+ae.traceID+"."+ae.spanID;Ce.setRequestHeader(Ct.requestIdHeader,Ye),p&&(ae.requestHeaders[Ct.requestIdHeader]=Ye)}var Fe=d.appId||ee&&ee.appId();if(Fe&&(Ce.setRequestHeader(Ct.requestContextHeader,Ct.requestContextAppIdFormat+Fe),p&&(ae.requestHeaders[Ct.requestContextHeader]=Ct.requestContextAppIdFormat+Fe)),te){var ot=new mc(ae.traceID,ae.spanID);Ce.setRequestHeader(Ct.traceParentHeader,ot.toString()),p&&(ae.requestHeaders[Ct.traceParentHeader]=ot.toString())}}return Ce}},st[n]=function(ae,be,Ie){if(oe===-1||z<oe){(d.distributedTracingMode===dn.W3C||d.distributedTracingMode===dn.AI_AND_W3C)&&typeof ae.id=="string"&&ae.id[ae.id.length-1]!=="."&&(ae.id+="."),ke(ae.startTime)&&(ae.startTime=new Date);var Ce=mn.create(ae,tn.dataType,tn.envelopeType,st[Po](),be,Ie);st.core.track(Ce)}else z===oe&&No(st,we.MaxAjaxPerPVExceeded,"Maximum ajax per page view limit reached, ajax monitoring is paused until the next trackPageView(). In order to increase the limit set the maxAjaxCallsPerView configuration parameter.",!0);++z};function Xt(ae){var be=!0;return(ae||d.ignoreHeaders)&&tt(d.ignoreHeaders,function(Ie){if(Ie.toLowerCase()===ae.toLowerCase())return be=!1,-1}),be}function tr(){var ae=Pm();if(!!ae){var be=cn(),Ie=ae.polyfill;d.disableFetchTracking===!1?(xe.push(xo(be,Bo,{req:function(Ce,Be,Ye){var Fe;if(a&&!Tr(null,Be,Ye)&&!(Ie&&s)){var ot=Ce.ctx();Fe=T(Be,Ye);var mt=st.includeCorrelationHeaders(Fe,Be,Ye);mt!==Ye&&Ce.set(1,mt),ot.data=Fe}},rsp:function(Ce,Be){var Ye=Ce.ctx().data;Ye&&(Ce.rslt=Ce.rslt.then(function(Fe){return Le(Ce,(Fe||{}).status,Be,Fe,Ye,function(){var ot={statusText:Fe.statusText,headerMap:null,correlationContext:$e(Fe)};if(se){var mt={};Fe.headers.forEach(function(Ee,br){Xt(br)&&(mt[br]=Ee)}),ot.headerMap=mt}return ot}),Fe}).catch(function(Fe){throw Le(Ce,0,Be,null,Ye,null,{error:Fe.message}),Fe}))},hkErr:Mo(st,we.FailedMonitorAjaxOpen,"Failed to monitor Window.fetch, monitoring data for this fetch call may be incorrect.")})),a=!0):Ie&&xe.push(xo(be,Bo,{req:function(Ce,Be,Ye){Tr(null,Be,Ye)}})),Ie&&(be[Bo].polyfill=Ie)}}function sr(ae,be,Ie){xe.push(kl(ae,be,Ie))}function an(){Bm(st)&&!s&&(sr(XMLHttpRequest,"open",{req:function(ae,be,Ie,Ce){var Be=ae.inst,Ye=Be[nn];!Tr(Be,Ie)&&hr(Be,!0)&&((!Ye||!Ye.xhrMonitoringState.openDone)&&gr(Be,be,Ie,Ce),$t(Be))},hkErr:Mo(st,we.FailedMonitorAjaxOpen,"Failed to monitor XMLHttpRequest.open, monitoring data for this ajax call may be incorrect.")}),sr(XMLHttpRequest,"send",{req:function(ae,be){var Ie=ae.inst,Ce=Ie[nn];hr(Ie)&&!Ce.xhrMonitoringState.sendDone&&(It("xhr",Ce),Ce.requestSentTime=Ma(),st.includeCorrelationHeaders(Ce,void 0,void 0,Ie),Ce.xhrMonitoringState.sendDone=!0)},hkErr:Mo(st,we.FailedMonitorAjaxSend,"Failed to monitor XMLHttpRequest, monitoring data for this ajax call may be incorrect.")}),sr(XMLHttpRequest,"abort",{req:function(ae){var be=ae.inst,Ie=be[nn];hr(be)&&!Ie.xhrMonitoringState.abortDone&&(Ie.aborted=1,Ie.xhrMonitoringState.abortDone=!0)},hkErr:Mo(st,we.FailedMonitorAjaxAbort,"Failed to monitor XMLHttpRequest.abort, monitoring data for this ajax call may be incorrect.")}),p&&sr(XMLHttpRequest,"setRequestHeader",{req:function(ae,be,Ie){var Ce=ae.inst;hr(Ce)&&Xt(be)&&(Ce[nn].requestHeaders[be]=Ie)},hkErr:Mo(st,we.FailedMonitorAjaxSetRequestHeader,"Failed to monitor XMLHttpRequest.setRequestHeader, monitoring data for this ajax call may be incorrect.")}),s=!0)}function Tr(ae,be,Ie){var Ce=!1,Be=((et(be)?be:(be||{}).url||"")||"").toLowerCase();if(tt(lt,function(ot){var mt=ot;et(ot)&&(mt=new RegExp(ot)),Ce||(Ce=mt.test(Be))}),Ce)return Ce;var Ye=Fa(Be,"?"),Fe=Fa(Be,"#");return(Ye===-1||Fe!==-1&&Fe<Ye)&&(Ye=Fe),Ye!==-1&&(Be=Be.substring(0,Ye)),ke(ae)?ke(be)||(Ce=(typeof be=="object"?be[Mn]===!0:!1)||(Ie?Ie[Mn]===!0:!1)):Ce=ae[Mn]===!0||Be[Mn]===!0,!Ce&&Be&&Ki(Be)&&(Ce=!0),Ce?Ge[Be]||(Ge[Be]=1):Ge[Be]&&(Ce=!0),Ce}function hr(ae,be){var Ie=!0,Ce=s;return ke(ae)||(Ie=be===!0||!ke(ae[nn])),Ce&&Ie}function gr(ae,be,Ie,Ce){var Be=ee&&ee.telemetryTrace&&ee.telemetryTrace.traceID||zr(),Ye=zr().substr(0,16),Fe=new vc(Be,Ye,st[Po]());Fe.method=be,Fe.requestUrl=Ie,Fe.xhrMonitoringState.openDone=!0,Fe.requestHeaders={},Fe.async=Ce,Fe.errorStatusText=B,ae[nn]=Fe}function $t(ae){ae[nn].xhrMonitoringState.stateChangeAttached=Tn(ae,"readystatechange",function(){try{ae&&ae.readyState===4&&hr(ae)&&Dt(ae)}catch(Ie){var be=it(Ie);(!be||Fa(be.toLowerCase(),"c00c023f")===-1)&&No(st,we.FailedMonitorAjaxRSC,"Failed to monitor XMLHttpRequest 'readystatechange' event handler, monitoring data for this ajax call may be incorrect.",{ajaxDiagnosticsMessage:Gs(ae),exception:be})}})}function St(ae){try{var be=ae.responseType;if(be===""||be==="text")return ae.responseText}catch{}return null}function Dt(ae){var be=ae[nn];be.responseFinishedTime=Ma(),be.status=ae.status;function Ie(Ce,Be){var Ye=Be||{};Ye.ajaxDiagnosticsMessage=Gs(ae),Ce&&(Ye.exception=it(Ce)),La(st,we.FailedMonitorAjaxDur,"Failed to calculate the duration of the ajax call, monitoring data for this ajax call won't be sent.",Ye)}Qe("xmlhttprequest",be,function(){try{var Ce=be.CreateTrackItem("Ajax",p,function(){var Ye={statusText:ae.statusText,headerMap:null,correlationContext:Nt(ae),type:ae.responseType,responseText:St(ae),response:ae.response};if(se){var Fe=ae.getAllResponseHeaders();if(Fe){var ot=Jt(Fe).split(/[\r\n]+/),mt={};tt(ot,function(Ee){var br=Ee.split(": "),Ar=br.shift(),yr=br.join(": ");Xt(Ar)&&(mt[Ar]=yr)}),Ye.headerMap=mt}}return Ye}),Be=void 0;try{ft&&(Be=ft({status:ae.status,xhr:ae}))}catch{La(st,we.FailedAddingCustomDefinedRequestContext,"Failed to add custom defined request context as configured call back may missing a null check.")}Ce?(Be!==void 0&&(Ce.properties=Qt(Qt({},Ce.properties),Be)),st[n](Ce)):Ie(null,{requestSentTime:be.requestSentTime,responseFinishedTime:be.responseFinishedTime})}finally{try{ae[nn]=null}catch{}}},function(Ce){Ie(Ce,null)})}function Nt(ae){try{var be=ae.getAllResponseHeaders();if(be!==null){var Ie=Fa(be.toLowerCase(),Ct.requestContextHeaderLowerCase);if(Ie!==-1){var Ce=ae.getResponseHeader(Ct.requestContextHeader);return Jn.getCorrelationContext(Ce)}}}catch(Be){La(st,we.FailedMonitorAjaxGetCorrelationHeader,"Failed to get Request-Context correlation header as it may be not included in the response or not accessible.",{ajaxDiagnosticsMessage:Gs(ae),exception:it(Be)})}}function It(ae,be){if(be.requestUrl&&ce&&P){var Ie=Zr();if(Ie&&at(Ie.mark)){Af++;var Ce=ce+ae+"#"+Af;Ie.mark(Ce);var Be=Ie.getEntriesByName(Ce);Be&&Be.length===1&&(be.perfMark=Be[0])}}}function Qe(ae,be,Ie,Ce){var Be=be.perfMark,Ye=Zr(),Fe=d.maxAjaxPerfLookupAttempts,ot=d.ajaxPerfLookupDelay,mt=be.requestUrl,Ee=0;(function br(){try{if(Ye&&Be){Ee++;for(var Ar=null,yr=Ye.getEntries(),ea=yr.length-1;ea>=0;ea--){var pn=yr[ea];if(pn){if(pn.entryType==="resource")pn.initiatorType===ae&&(Fa(pn.name,mt)!==-1||Fa(mt,pn.name)!==-1)&&(Ar=pn);else if(pn.entryType==="mark"&&pn.name===Be.name){be.perfTiming=Ar;break}if(pn.startTime<Be.startTime-1e3)break}}}!Be||be.perfTiming||Ee>=Fe||be.async===!1?(Be&&at(Ye.clearMarks)&&Ye.clearMarks(Be.name),be.perfAttempts=Ee,Ie()):setTimeout(br,ot)}catch(a0){Ce(a0)}})()}function T(ae,be){var Ie=ee&&ee.telemetryTrace&&ee.telemetryTrace.traceID||zr(),Ce=zr().substr(0,16),Be=new vc(Ie,Ce,st[Po]());Be.requestSentTime=Ma(),Be.errorStatusText=B,ae instanceof Request?Be.requestUrl=ae?ae.url:"":Be.requestUrl=ae;var Ye="GET";be&&be.method?Ye=be.method:ae&&ae instanceof Request&&(Ye=ae.method),Be.method=Ye;var Fe={};if(p){var ot=new Headers((be?be.headers:0)||(ae instanceof Request?ae.headers||{}:{}));ot.forEach(function(mt,Ee){Xt(Ee)&&(Fe[Ee]=mt)})}return Be.requestHeaders=Fe,It("fetch",Be),Be}function le(ae){var be="";try{ke(ae)||(typeof ae=="string"?be+="(url: '".concat(ae,"')"):be+="(url: '".concat(ae.url,"')"))}catch(Ie){No(st,we.FailedMonitorAjaxOpen,"Failed to grab failed fetch diagnostics message",{exception:it(Ie)})}return be}function Le(ae,be,Ie,Ce,Be,Ye,Fe){if(!Be)return;function ot(mt,Ee,br){var Ar=br||{};Ar.fetchDiagnosticsMessage=le(Ie),Ee&&(Ar.exception=it(Ee)),La(st,mt,"Failed to calculate the duration of the fetch call, monitoring data for this fetch call won't be sent.",Ar)}Be.responseFinishedTime=Ma(),Be.status=be,Qe("fetch",Be,function(){var mt=Be.CreateTrackItem("Fetch",p,Ye),Ee;try{ft&&(Ee=ft({status:be,request:Ie,response:Ce}))}catch{La(st,we.FailedAddingCustomDefinedRequestContext,"Failed to add custom defined request context as configured call back may missing a null check.")}mt?(Ee!==void 0&&(mt.properties=Qt(Qt({},mt.properties),Ee)),st[n](mt)):ot(we.FailedMonitorAjaxDur,null,{requestSentTime:Be.requestSentTime,responseFinishedTime:Be.responseFinishedTime})},function(mt){ot(we.FailedMonitorAjaxGetCorrelationHeader,mt,null)})}function $e(ae){if(ae&&ae.headers)try{var be=ae.headers.get(Ct.requestContextHeader);return Jn.getCorrelationContext(be)}catch(Ie){La(st,we.FailedMonitorAjaxGetCorrelationHeader,"Failed to get Request-Context correlation header as it may be not included in the response or not accessible.",{fetchDiagnosticsMessage:le(ae),exception:it(Ie)})}}}),r}return e.getDefaultConfig=function(){var r={maxAjaxCallsPerView:500,disableAjaxTracking:!1,disableFetchTracking:!0,excludeRequestFromAutoTrackingPatterns:void 0,disableCorrelationHeaders:!1,distributedTracingMode:dn.AI_AND_W3C,correlationHeaderExcludedDomains:["*.blob.core.windows.net","*.blob.core.chinacloudapi.cn","*.blob.core.cloudapi.de","*.blob.core.usgovcloudapi.net"],correlationHeaderDomains:void 0,correlationHeaderExcludePatterns:void 0,appId:void 0,enableCorsCorrelation:!1,enableRequestHeaderTracking:!1,enableResponseHeaderTracking:!1,enableAjaxErrorStatusText:!1,enableAjaxPerfTracking:!1,maxAjaxPerfLookupAttempts:3,ajaxPerfLookupDelay:25,ignoreHeaders:["Authorization","X-API-Key","WWW-Authenticate"],addRequestContext:void 0};return r},e.getEmptyConfig=function(){var r=this.getDefaultConfig();return Tt(r,function(n){r[n]=void 0}),r},e.prototype.processTelemetry=function(r,n){this.processNext(r,n)},e.identifier="AjaxDependencyPlugin",e}(In);var hc,Cf=["snippet","dependencies","properties","_snippetVersion","appInsightsNew","getSKUDefaults"];var _c=function(){function t(e){var r=this;r._snippetVersion=""+(e.sv||e.version||""),e.queue=e.queue||[],e.version=e.version||2;var n=e.config||{};if(n.connectionString){var i=Yl(n.connectionString),a=i.ingestionendpoint;n.endpointUrl=a?"".concat(a,"/v2/track"):n.endpointUrl,n.instrumentationKey=i.instrumentationkey||n.instrumentationKey}r.appInsights=new oc,r.properties=new dc,r.dependencies=new pc,r.core=new Cl,r._sender=new uc,r.snippet=e,r.config=n,r.getSKUDefaults()}return t.prototype.getCookieMgr=function(){return this.appInsights.getCookieMgr()},t.prototype.trackEvent=function(e,r){this.appInsights.trackEvent(e,r)},t.prototype.trackPageView=function(e){var r=e||{};this.appInsights.trackPageView(r)},t.prototype.trackPageViewPerformance=function(e){var r=e||{};this.appInsights.trackPageViewPerformance(r)},t.prototype.trackException=function(e,r){e&&!e.exception&&e.error&&(e.exception=e.error),this.appInsights.trackException(e,r)},t.prototype._onerror=function(e){this.appInsights._onerror(e)},t.prototype.trackTrace=function(e,r){this.appInsights.trackTrace(e,r)},t.prototype.trackMetric=function(e,r){this.appInsights.trackMetric(e,r)},t.prototype.startTrackPage=function(e){this.appInsights.startTrackPage(e)},t.prototype.stopTrackPage=function(e,r,n,i){this.appInsights.stopTrackPage(e,r,n,i)},t.prototype.startTrackEvent=function(e){this.appInsights.startTrackEvent(e)},t.prototype.stopTrackEvent=function(e,r,n){this.appInsights.stopTrackEvent(e,r,n)},t.prototype.addTelemetryInitializer=function(e){return this.appInsights.addTelemetryInitializer(e)},t.prototype.setAuthenticatedUserContext=function(e,r,n){n===void 0&&(n=!1),this.properties.context.user.setAuthenticatedUserContext(e,r,n)},t.prototype.clearAuthenticatedUserContext=function(){this.properties.context.user.clearAuthenticatedUserContext()},t.prototype.trackDependencyData=function(e){this.dependencies.trackDependencyData(e)},t.prototype.flush=function(e){var r=this;e===void 0&&(e=!0),Vn(this.core,function(){return"AISKU.flush"},function(){tt(r.core.getTransmissionControls(),function(n){tt(n,function(i){i.flush(e)})})},null,e)},t.prototype.onunloadFlush=function(e){e===void 0&&(e=!0),tt(this.core.getTransmissionControls(),function(r){tt(r,function(n){n.onunloadFlush?n.onunloadFlush():n.flush(e)})})},t.prototype.loadAppInsights=function(e,r,n){var i=this;e===void 0&&(e=!1);var a=this;function s(v){if(v){var d="";ke(a._snippetVersion)||(d+=a._snippetVersion),e&&(d+=".lg"),a.context&&a.context.internal&&(a.context.internal.snippetVer=d||"-"),Tt(a,function(p,B){et(p)&&!at(B)&&p&&p[0]!=="_"&&Cf.indexOf(p)===-1&&(v[p]=B)})}}return e&&a.config.extensions&&a.config.extensions.length>0&&wr("Extensions not allowed in legacy mode"),Vn(a.core,function(){return"AISKU.loadAppInsights"},function(){var v=[];v.push(a._sender),v.push(a.properties),v.push(a.dependencies),v.push(a.appInsights),a.core.initialize(a.config,v,r,n),a.context=a.properties.context,hc&&a.context&&(a.context.internal.sdkSrc=hc),s(a.snippet),a.emptyQueue(),a.pollInternalLogs(),a.addHousekeepingBeforeUnload(i)}),a},t.prototype.updateSnippetDefinitions=function(e){tl(e,this,function(r){return r&&Cf.indexOf(r)===-1})},t.prototype.emptyQueue=function(){var e=this;try{if(ur(e.snippet.queue)){for(var r=e.snippet.queue.length,n=0;n<r;n++){var i=e.snippet.queue[n];i()}e.snippet.queue=void 0,delete e.snippet.queue}}catch(s){var a={};s&&at(s.toString)&&(a.exception=s.toString())}},t.prototype.pollInternalLogs=function(){this.core.pollInternalLogs()},t.prototype.stopPollingInternalLogs=function(){this.core.stopPollingInternalLogs()},t.prototype.addHousekeepingBeforeUnload=function(e){if(Oi()||gs()){var r=function(){e.onunloadFlush(!1),tt(e.appInsights.core._extensions,function(a){if(a.identifier===_i)return a&&a.context&&a.context._sessionManager&&a.context._sessionManager.backup(),-1})},n=!1,i=e.appInsights.config.disablePageUnloadEvents;e.appInsights.config.disableFlushOnBeforeUnload||(n=Pl(r,i),n=bo(r,i)||n,!n&&!vl()&&e.appInsights.core.logger.throwInternal(Pe.CRITICAL,we.FailedToAddHandlerForOnBeforeUnload,"Could not add handler for beforeunload and pagehide")),!n&&!e.appInsights.config.disableFlushOnUnload&&bo(r,i)}},t.prototype.getSender=function(){return this._sender},t.prototype.getSKUDefaults=function(){var e=this;e.config.diagnosticLogInterval=e.config.diagnosticLogInterval&&e.config.diagnosticLogInterval>0?e.config.diagnosticLogInterval:1e4},t}();(function(){var t=null,e=!1,r=["://js.monitor.azure.com/","://az416426.vo.msecnd.net/"];try{var n=(document||{}).currentScript;n&&(t=n.src)}catch{}if(t)try{var i=t.toLowerCase();if(i){for(var a="",s=0;s<r.length;s++)if(i.indexOf(r[s])!==-1){a="cdn"+(s+1),i.indexOf("/scripts/")===-1&&(i.indexOf("/next/")!==-1?a+="-next":i.indexOf("/beta/")!==-1&&(a+="-beta")),hc=a+(e?".mod":"");break}}}catch{}})();var Ua,Mf=t=>(Ua=new _c({config:{instrumentationKey:t}}),Ua.loadAppInsights(),Ua),bi={START:"start",FINISH:"finish",ERROR:"error",UPLOAD_VIDEO:"upload_video"},Nm=t=>Ua.trackException({exception:t}),xi=(t,e)=>Ua.trackEvent({name:t,properties:e}),km=(t,e,r)=>Ua.trackPageView({name:t,uri:e,properties:r}),Yt={trackPage:km,trackError:Nm,registerStart:(t,e,r)=>xi(bi.START,{proctoringId:t,success:e,description:r}),registerFinish:(t,e,r)=>xi(bi.FINISH,{proctoringId:t,success:e,description:r}),registerError:(t,e)=>xi(bi.ERROR,{proctoringId:t,description:e}),registerUpload:(t,e,r,n,i)=>xi(bi.UPLOAD_VIDEO,{proctoringId:t,success:e,description:r,serviceType:n,uploadTime:i}),registerUploadFile:(t,e,r)=>xi(bi.UPLOAD_VIDEO,{proctoringId:t,description:e,fileType:r}),registerChangeDevice:(t,e,r)=>xi(bi.UPLOAD_VIDEO,{proctoringId:t,inOrOut:e,devicesChanged:r}),registerStopSharingScreen:(t,e)=>xi(bi.UPLOAD_VIDEO,{proctoringId:t,description:e}),registerErrorRecorderRTC:(t,e)=>xi(bi.UPLOAD_VIDEO,{proctoringId:t,description:e})};var Ji=class{constructor(e,r){this.backend=r;this.proctoringId=e}async upload(e,r){let{file:n,onProgress:i}=e;try{let a=d=>{let p=d.loadedBytes/n.size*100;i&&i(Math.round(p))},s=await this.backend.getAzureSignedUrl(r,n,this.proctoringId),v=await ua.request({url:s,method:"PUT",headers:{"x-ms-blob-type":"BlockBlob"},data:n,onUploadProgress:d=>{a({loadedBytes:d.loaded})}}).then(()=>!0).catch(()=>!1);return{storage:"AzureBlob",url:s,uploaded:v}}catch{throw Yt.registerError(this.proctoringId,`Failed to upload to Azure
22
22
  File name: ${n.name}
23
23
  File type: ${n.type}
24
- File size: ${n.size}`),new Error("Failed to upload to azure")}}};var zn=class{constructor(e,r,n,i,a){this.blobs=[];this.options={cameraId:void 0,microphoneId:void 0};this.videoOptions={width:640,height:480};this.blobsRTC=[];this.imageCount=0;this.options=e,this.videoOptions=r,this.backend=n,this.backendToken=i,this.proctoringId=a,this.proctoringId&&this.backend&&(this.azureUpload=new Ji(this.proctoringId,this.backend))}async startRecording(){let{cameraId:e,microphoneId:r}=this.options,n={audio:{deviceId:r},video:{deviceId:e,width:this.videoOptions.width,height:this.videoOptions.height,frameRate:15}};try{this.cameraStream=await navigator.mediaDevices.getUserMedia(n)}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}let{startRecording:i,stopRecording:a,pauseRecording:s,resumeRecording:v}=Qa(this.cameraStream,this.blobs);this.recordingStart=i,this.recordingStop=a,this.recordingPause=s,this.recordingResume=v,this.recordingStart(),this.photoShotsCycle()}async stopRecording(){this.recordingStop&&await this.recordingStop(),clearInterval(this.imageInterval)}async pauseRecording(){await this.recordingPause()}async resumeRecording(){await this.recordingResume()}photoShotsCycle(){let e=this.cameraStream.getVideoTracks()[0];this.imageCapture=new ImageCapture(e),this.imageInterval=setInterval(()=>{this.imageCapture.takePhoto().then(r=>createImageBitmap(r)).then(async r=>{let n=document.createElement("canvas");n.width=1280,n.height=720,n.getContext("bitmaprenderer").transferFromImageBitmap(r);let a=await new Promise(s=>n.toBlob(s));a instanceof Blob&&this.azureUpload&&this.backendToken&&(this.azureUpload.upload({file:new File([a],`EP_${this.proctoringId}_image_${this.imageCount}.jpg`,{type:"image/jpeg"})},this.backendToken),this.imageCount++)}).catch(r=>console.log(r))},15e3)}async saveOnSession(e){let r=this.cameraStream.getVideoTracks()[0].getSettings(),n=this.cameraStream.getAudioTracks()[0].getSettings();e.addRecording({device:`Audio
24
+ File size: ${n.size}`),new Error("Failed to upload to azure")}}};var zn=class{constructor(e,r,n,i,a){this.blobs=[];this.options={cameraId:void 0,microphoneId:void 0};this.videoOptions={width:640,height:480};this.blobsRTC=[];this.imageCount=0;this.options=e,this.videoOptions=r,this.backend=n,this.backendToken=i,this.proctoringId=a,this.proctoringId&&this.backend&&(this.azureUpload=new Ji(this.proctoringId,this.backend))}async startRecording(){let{cameraId:e,microphoneId:r}=this.options,n={audio:{deviceId:r},video:{deviceId:e,width:this.videoOptions.width,height:this.videoOptions.height,frameRate:15}};try{this.cameraStream=await navigator.mediaDevices.getUserMedia(n)}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}let{startRecording:i,stopRecording:a,pauseRecording:s,resumeRecording:v}=Qa(this.cameraStream,this.blobs);this.recordingStart=i,this.recordingStop=a,this.recordingPause=s,this.recordingResume=v,this.recordingStart()}async stopRecording(){this.recordingStop&&await this.recordingStop(),clearInterval(this.imageInterval)}async pauseRecording(){await this.recordingPause()}async resumeRecording(){await this.recordingResume()}async saveOnSession(e){let r=this.cameraStream.getVideoTracks()[0].getSettings(),n=this.cameraStream.getAudioTracks()[0].getSettings();e.addRecording({device:`Audio
25
25
  Sample Rate: ${n.sampleRate}
26
26
  Sample Size: ${n.sampleSize}`,file:new File(this.blobs,`EP_${e.id}_camera_0.webm`,{type:"video/webm"}),origin:"Camera"})}};var Xs=class{constructor(){}async takePicture(e,r){return console.log("take picture"),await this.takePictureInterface(e,r)}async startCapture(e="default"){let r=document.querySelector("#cameraStream"),n={audio:!1,video:{facingMode:"user",aspectRatio:1.777777778,width:{min:640,ideal:640,max:1920},height:{min:400,ideal:480},deviceId:e}};this.cameraRecorder=new zn({cameraId:e},{width:640,height:480}),await this.cameraRecorder.startRecording(),r.srcObject=this.cameraRecorder.cameraStream,r.play()}shot(){console.log("shot");let e=document.querySelector("#cameraStream"),r=document.querySelector("#canvas"),n=document.querySelector("#image");r.width=e.videoWidth,r.height=e.videoHeight,r.getContext("2d").drawImage(e,0,0,e.videoWidth,e.videoHeight),n.src=r.toDataURL("image/jpg"),this.base64=r.toDataURL("image/jpg")}takePictureInterface(e,r){return new Promise(n=>{let i=document.createElement("div");i.setAttribute("id","authPhoto"),i.style.backgroundColor="rgba(0,0,0,0.4)",i.style.zIndex="1000",i.style.position="fixed",i.style.top="0",i.style.left="0",i.style.height="100vh",i.style.width="100%",i.style.display="flex",i.style.alignItems="center",i.style.justifyContent="center";let a=document.createElement("div");a.style.backgroundColor="#fff",a.style.zIndex="1001",a.style.width="800px",a.style.maxHeight="95vh",a.style.borderRadius="10px",a.style.display="flex",a.style.flexDirection="column",a.style.alignItems="center",a.style.boxSizing="border-box";let s=document.createElement("h3");s.innerText=e||"Biometria Facial",s.style.color="rgba(0, 0, 0, .7)",s.style.fontWeight="bold",s.style.fontSize="20px",s.style.marginBottom="15px",s.style.padding="20px 0px 0px",s.style.width="100%",s.style.textAlign="center",a.appendChild(s);let v=document.createElement("p");v.innerText=r||"Encaixe seu rosto no formato e clique no bot\xE3o abaixo",v.style.color="rgba(0, 0, 0, .7)",v.style.fontWeight="normal",v.style.fontSize="16px",v.style.marginBottom="15px",v.style.padding="0px 0px 20px",v.style.borderBottom="2px solid rgba(0, 0, 0, .1)",v.style.width="100%",v.style.textAlign="center",a.appendChild(v);let d=document.createElement("div"),p=document.createElement("h3"),B=document.createElement("select");B.setAttribute("id","cameraSelect"),d.style.padding="0 20px",d.style.width="100%",d.style.display="flex",d.style.justifyContent="space-between",d.style.marginBottom="15px",p.innerText="C\xE2mera",p.style.color="rgba(0, 0, 0, .75)",p.style.fontWeight="bold",p.style.fontSize="16px",d.appendChild(p),d.appendChild(B),a.appendChild(d);let z=document.createElement("div"),ee=document.createElement("video");ee.setAttribute("id","cameraStream"),ee.muted=!0,z.style.width="100%",z.style.height="50vh",z.style.display="flex",z.style.justifyContent="center",z.style.position="relative",ee.style.backgroundColor="#000",ee.style.borderRadius="10px",ee.style.width="auto",ee.style.height="auto",ee.style.minHeight="100%",z.appendChild(ee);let te=document.createElement("canvas");te.setAttribute("id","canvas"),te.style.display="none",te.style.width="100%",te.style.height="100%";let k=document.createElement("img");k.setAttribute("id","image"),k.style.objectFit="contain",k.style.display="none",k.style.borderRadius="8px",z.appendChild(te),z.appendChild(k);let ce=document.createElement("div");ce.setAttribute("class","facial-biometry__mask"),ce.style.width="100%",ce.style.height="100%",ce.style.position="absolute",ce.style.top="0px",ce.style.left="0px",ce.style.backgroundColor="#fff",ce.style.opacity="0.6";let P=document.createElement("div");P.setAttribute("class","biometry__frame"),P.style.width="100%",P.style.height="100%",P.style.position="absolute",P.style.top="0px",P.style.left="0px",P.style.zIndex="10",z.appendChild(ce),z.appendChild(P),a.appendChild(z),this.addStyleMask();let oe=document.createElement("button"),se=document.createElement("div");oe.setAttribute("id","confirmBtn"),se.style.width="100%",se.style.display="flex",se.style.alignItems="center",se.style.justifyContent="center",oe.style.background="url('https://iarisprod.blob.core.windows.net/imagens/camera.svg') no-repeat center",oe.style.width="70px",oe.style.height="70px",oe.style.borderRadius="70px",oe.style.border="none",oe.style.backgroundColor="#16a34a",oe.style.margin="20px 0",se.appendChild(oe),a.appendChild(se);let xe=document.createElement("button");xe.style.background="url('https://iarisprod.blob.core.windows.net/imagens/close.svg') no-repeat center",xe.style.width="70px",xe.style.height="70px",xe.style.borderRadius="70px",xe.style.border="none",xe.style.backgroundColor="#e74141",xe.style.margin="20px 20px";let Ge=document.createElement("button");Ge.style.background="url('https://iarisprod.blob.core.windows.net/imagens/check.svg') no-repeat center",Ge.style.width="70px",Ge.style.height="70px",Ge.style.borderRadius="70px",Ge.style.border="none",Ge.style.backgroundColor="#16a34a",Ge.style.margin="20px 20px",i.appendChild(a),document.body.appendChild(i),this.setSelectOption(),this.startCapture(),oe.addEventListener("click",()=>{se.removeChild(oe),se.appendChild(xe),se.appendChild(Ge),this.shot(),ee.style.display="none",k.style.display="block"}),xe.addEventListener("click",()=>{se.appendChild(oe),se.removeChild(xe),se.removeChild(Ge),ee.style.display="block",k.style.display="none"}),Ge.addEventListener("click",()=>{this.closeInterface(),n({base64:this.base64})})})}async setSelectOption(){let e=document.querySelector("#cameraSelect"),r=await xn();e&&(e.value="default");let n=(i,a)=>{let s=document.createElement("option");return s.setAttribute("value",a),s.innerHTML=i,s};r.cameras.forEach(i=>{let a=n(i.label,i.id);e?.appendChild(a)}),this.onSelectOptionChange()}async onSelectOptionChange(){let e=document.querySelector("#cameraSelect");e?.addEventListener("change",async()=>{this.startCapture(e?.value)})}async closeInterface(){await this.cameraRecorder.stopRecording(),document.querySelector("#authPhoto")?.remove()}async addStyleMask(){let e=`
27
27
  .facial-biometry__mask {