easyproctor 2.5.7 → 2.5.8
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/README.md +3 -0
- package/esm/index.js +1 -3
- package/index.js +1 -3
- package/package.json +1 -1
- package/unpkg/easyproctor.min.js +2 -2
package/README.md
CHANGED
package/esm/index.js
CHANGED
|
@@ -9497,8 +9497,6 @@ var FaceDetection = class extends BaseDetection {
|
|
|
9497
9497
|
}
|
|
9498
9498
|
verify(result) {
|
|
9499
9499
|
var _a2;
|
|
9500
|
-
console.log("this.numFacesSent", this.numFacesSent);
|
|
9501
|
-
console.log("result.detections.length", result.detections.length);
|
|
9502
9500
|
if (((_a2 = this.paramsConfig.videoBehaviourParameters) == null ? void 0 : _a2.detectFace) && result.detections.length !== this.numFacesSent) {
|
|
9503
9501
|
this.numFacesSent = result.detections.length;
|
|
9504
9502
|
if (result.detections.length === 0) {
|
|
@@ -13698,7 +13696,7 @@ Setting: ${JSON.stringify(settings, null, 2)}`
|
|
|
13698
13696
|
});
|
|
13699
13697
|
const fixedBlob = await (0, import_fix_webm_duration.default)(rawBlob, this.duration);
|
|
13700
13698
|
const file = new File(
|
|
13701
|
-
[
|
|
13699
|
+
[rawBlob],
|
|
13702
13700
|
`EP_${session.id}_camera_0.webm`,
|
|
13703
13701
|
{ type: rawBlob.type }
|
|
13704
13702
|
);
|
package/index.js
CHANGED
|
@@ -26782,8 +26782,6 @@ var FaceDetection = class extends BaseDetection {
|
|
|
26782
26782
|
}
|
|
26783
26783
|
verify(result) {
|
|
26784
26784
|
var _a2;
|
|
26785
|
-
console.log("this.numFacesSent", this.numFacesSent);
|
|
26786
|
-
console.log("result.detections.length", result.detections.length);
|
|
26787
26785
|
if (((_a2 = this.paramsConfig.videoBehaviourParameters) == null ? void 0 : _a2.detectFace) && result.detections.length !== this.numFacesSent) {
|
|
26788
26786
|
this.numFacesSent = result.detections.length;
|
|
26789
26787
|
if (result.detections.length === 0) {
|
|
@@ -31795,7 +31793,7 @@ Setting: ${JSON.stringify(settings, null, 2)}`
|
|
|
31795
31793
|
});
|
|
31796
31794
|
const fixedBlob = await (0, import_fix_webm_duration.default)(rawBlob, this.duration);
|
|
31797
31795
|
const file = new File(
|
|
31798
|
-
[
|
|
31796
|
+
[rawBlob],
|
|
31799
31797
|
`EP_${session.id}_camera_0.webm`,
|
|
31800
31798
|
{ type: rawBlob.type }
|
|
31801
31799
|
);
|
package/package.json
CHANGED
package/unpkg/easyproctor.min.js
CHANGED
|
@@ -63,7 +63,7 @@ Minimum version required to store current data is: `+o+`.
|
|
|
63
63
|
border-radius: 50%;
|
|
64
64
|
display: block;
|
|
65
65
|
}
|
|
66
|
-
`,document.getElementsByTagName("head")[0].appendChild(n),console.log("BaseDetection enableCam OK")}async predictWebcam(){if(this.lastVideoTime===-1&&await this.detector.setOptions({runningMode:"VIDEO"}),Date.now()-this.lastExecutionDate>=1e3){let r=Date.now();if(this.lastExecutionDate=r,this.video.currentTime!==this.lastVideoTime){this.lastVideoTime=this.video.currentTime;let n=this.detector.detectForVideo(this.video,r);this.verify(n)}}this.animationFrameId=setTimeout(()=>{this.predictWebcam()},0)}handleAlert(t,r){this.options.onRealtimeAlertsCallback&&this.options.onRealtimeAlertsCallback({status:"ALERT",description:this.alertTranslate(t),type:r,category:t,begin:0,end:0}),this.options.onRealtimeAlertsCallback==null&&this.error&&(this.error.innerText=t)}handleOk(t,r){this.options.onRealtimeAlertsCallback&&this.options.onRealtimeAlertsCallback({status:"OK",description:this.alertTranslate(t),type:r,category:t,begin:0,end:0}),this.error&&(this.error.innerText="")}displayVideoDetections(t){}verify(t){}alertTranslate(t){switch(t){case"multiple_faces_detected":return"M\xFAltiplas faces detectadas";case"no_face_detected":return"Nenhuma face encontrada";case"multiple_persons_detected":return"M\xFAltiplas pessoas detectadas";case"no_person_detected":return"Nenhuma pessoa encontrada";case"cellphone_detected":return"Celular detectado";case"wrong_position_face_detected":return"Face na posi\xE7\xE3o errada";case"person_ok":return"Pessoa detectada";case"cellphone_ok":return"Nenhum celular detectadoa";case"face_ok":return"Face detectada";case"ok_position_face_detected":return"Face na posi\xE7\xE3o correta";case"wrong_face_size_detected":return"Face muito perto da c\xE2mera, afaste-se um pouco mais";case"wrong_face_position_edge_detected":return"Face muito pr\xF3xima da borda, mova-se para o centro da tela";case"wrong_face_position_move_right_detected":return"Face n\xE3o centralizada, mova-se para a direita";case"wrong_face_position_move_left_detected":return"Face n\xE3o centralizada, mova-se para a esquerda";case"wrong_face_position_move_top_detected":return"Face n\xE3o centralizada, mova-se para cima";case"wrong_face_position_move_bottom_detected":return"Face n\xE3o centralizada, mova-se para baixo";case"face_turned_left_detected":return"Face virada para a esquerda, centralize-a";case"face_turned_right_detected":return"Face virada para a direita, centralize-a";case"face_turned_up_detected":return"Face virada para cima, centralize-a";case"face_turned_down_detected":return"Face virada para baixo, centralize-a";default:return t}}};function ig(){let e=document.createElement("div");e.setAttribute("id","liveViewFrameDetection");let t=document.createElement("erro");t.setAttribute("id","errorFrameDetection");let r=document.createElement("video");r.setAttribute("id","videoPreviewFrameDetection"),r.muted=!0,e.style.width="320px",e.style.height="180px",e.style.position="fixed",e.style.bottom="30px",e.style.right="30px",e.style.display="none",r.style.width="100%",r.style.height="100%",r.style.background="#000",e.appendChild(t),e.appendChild(r),document.body.appendChild(e)}var Oi=class extends Bi{constructor(r,n,i="videoPreviewFrameDetection",o="liveViewFrameDetection"){super("FaceDetector","https://storage.googleapis.com/mediapipe-models/face_detector/blaze_face_short_range/float16/1/blaze_face_short_range.tflite",r,n,i,o);this.emmitedPositionAlert=!1;this.emmitedFaceAlert=!1;console.log("FaceDetection constructor"),this.numFacesSent=-1}stopDetection(){super.stopDetection(),this.emmitedFaceAlert&&this.handleOk("face_stop","face_detection_on_stream")}displayVideoDetections(r){for(let s of this.children)this.liveView.removeChild(s);this.children.splice(0);let n=this.video;if(n.videoWidth===0||n.videoHeight===0)return;let i=n.offsetWidth/n.videoWidth,o=n.offsetHeight/n.videoHeight;for(let s of r.detections){let a=s.boundingBox,l=(n.videoWidth-a.originX-a.width)*i,h=a.originY*o,d=(a.width-10)*i,m=a.height*o,u=document.createElement("div");u.setAttribute("class","highlighter"),Object.assign(u.style,{right:`${l+20}px`,top:`${h}px`,width:`${d}px`,height:`${m-10}px`,zIndex:"1",position:"absolute",border:"1px dashed #fff",background:"rgba(0, 255, 0, 0.25)",transform:"scaleX(-1)"});let g=document.createElement("p"),f=s.categories[0].score?Math.round(parseFloat(s.categories[0].score)*100):0;if(g.innerText=`Confidence: ${f}%`,Object.assign(g.style,{right:`${l+20}px`,top:`${h-50}px`,width:`${d}px`,zIndex:"2",position:"absolute",margin:"0",fontSize:"12px",padding:"5px",color:"#fff",backgroundColor:"#007f8b",textAlign:"center",transform:"scaleX(-1)"}),this.liveView.appendChild(u),this.liveView.appendChild(g),this.children.push(u),this.children.push(g),s.keypoints)for(let b of s.keypoints){let _=document.createElement("span");_.className="key-point";let x=b.x<2?b.x*n.videoWidth:b.x,k=b.y<2?b.y*n.videoHeight:b.y,E=(n.videoWidth-x)*i,D=k*o;Object.assign(_.style,{right:`${E+20}px`,top:`${D-3}px`,position:"absolute",width:"6px",height:"6px",borderRadius:"50%",backgroundColor:"red",zIndex:"3"}),this.liveView.appendChild(_),this.children.push(_)}}}verify(r){if(console.log("this.numFacesSent",this.numFacesSent),console.log("result.detections.length",r.detections.length),this.paramsConfig.videoBehaviourParameters?.detectFace&&r.detections.length!==this.numFacesSent)if(this.numFacesSent=r.detections.length,r.detections.length===0){this.handleAlert("no_face_detected","face_detection_on_stream"),this.emmitedFaceAlert=!0;return}else if(r.detections.length>1){this.handleAlert("multiple_faces_detected","face_detection_on_stream"),this.emmitedFaceAlert=!0;return}else this.handleOk("face_ok","face_detection_on_stream"),this.emmitedFaceAlert=!1;if(r.detections.length===0)return;let n=!1,i=document.getElementById(this.classVideo),o=i.videoWidth,s=i.videoHeight,a=r.detections[0],c=a.boundingBox,l=a.keypoints,h=l[0],d=l[1],m=l[3],u=l[4],g=l[5],f=l[2];o>s&&(c.height/s>.7?(!this.emmitedPositionAlert&&this.handleAlert("wrong_face_size_detected","position_detection_on_stream"),n=!0,this.emmitedPositionAlert=!0):c.width/o>.7&&(!this.emmitedPositionAlert&&this.handleAlert("wrong_face_size_detected","position_detection_on_stream"),this.emmitedPositionAlert=!0,n=!0));let b=[c.originX,c.originY],_=[c.originX+c.width,c.originY+c.height];(b[0]<.1*c.width||b[1]<.2*c.height||_[0]>o-.1*c.width||_[1]>s-5)&&(!this.emmitedPositionAlert&&this.handleAlert("wrong_face_position_edge_detected","position_detection_on_stream"),this.emmitedPositionAlert=!0,n=!0);let x=b[0],k=o-_[0],R=b[1],E=s-_[1];x>2*k&&(!this.emmitedPositionAlert&&this.handleAlert("wrong_face_position_move_right_detected","position_detection_on_stream"),this.emmitedPositionAlert=!0,n=!0),R>4*E&&(!this.emmitedPositionAlert&&this.handleAlert("wrong_face_position_move_top_detected","position_detection_on_stream"),this.emmitedPositionAlert=!0,n=!0),k>2*x&&(!this.emmitedPositionAlert&&this.handleAlert("wrong_face_position_move_left_detected","position_detection_on_stream"),this.emmitedPositionAlert=!0,n=!0),E>3*R&&(!this.emmitedPositionAlert&&this.handleAlert("wrong_face_position_move_bottom_detected","position_detection_on_stream"),this.emmitedPositionAlert=!0,n=!0),n==!1&&(this.emmitedPositionAlert&&this.handleOk("ok_position_face_detected","position_detection_on_stream"),this.emmitedPositionAlert=!1)}};function Po(e,t){return function(){return e.apply(t,arguments)}}var{toString:ev}=Object.prototype,{getPrototypeOf:Xh}=Object,ya=(e=>t=>{let r=ev.call(t);return e[r]||(e[r]=r.slice(8,-1).toLowerCase())})(Object.create(null)),yr=e=>(e=e.toLowerCase(),t=>ya(t)===e),ba=e=>t=>typeof t===e,{isArray:Ui}=Array,Do=ba("undefined");function tv(e){return e!==null&&!Do(e)&&e.constructor!==null&&!Do(e.constructor)&&Ht(e.constructor.isBuffer)&&e.constructor.isBuffer(e)}var sg=yr("ArrayBuffer");function rv(e){let t;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?t=ArrayBuffer.isView(e):t=e&&e.buffer&&sg(e.buffer),t}var nv=ba("string"),Ht=ba("function"),ag=ba("number"),va=e=>e!==null&&typeof e=="object",iv=e=>e===!0||e===!1,ga=e=>{if(ya(e)!=="object")return!1;let t=Xh(e);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(Symbol.toStringTag in e)&&!(Symbol.iterator in e)},ov=yr("Date"),sv=yr("File"),av=yr("Blob"),cv=yr("FileList"),lv=e=>va(e)&&Ht(e.pipe),hv=e=>{let t;return e&&(typeof FormData=="function"&&e instanceof FormData||Ht(e.append)&&((t=ya(e))==="formdata"||t==="object"&&Ht(e.toString)&&e.toString()==="[object FormData]"))},dv=yr("URLSearchParams"),[uv,pv,fv,mv]=["ReadableStream","Request","Response","Headers"].map(yr),gv=e=>e.trim?e.trim():e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function Bo(e,t,{allOwnKeys:r=!1}={}){if(e===null||typeof e>"u")return;let n,i;if(typeof e!="object"&&(e=[e]),Ui(e))for(n=0,i=e.length;n<i;n++)t.call(null,e[n],n,e);else{let o=r?Object.getOwnPropertyNames(e):Object.keys(e),s=o.length,a;for(n=0;n<s;n++)a=o[n],t.call(null,e[a],a,e)}}function cg(e,t){t=t.toLowerCase();let r=Object.keys(e),n=r.length,i;for(;n-- >0;)if(i=r[n],t===i.toLowerCase())return i;return null}var Vn=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global,lg=e=>!Do(e)&&e!==Vn;function Kh(){let{caseless:e}=lg(this)&&this||{},t={},r=(n,i)=>{let o=e&&cg(t,i)||i;ga(t[o])&&ga(n)?t[o]=Kh(t[o],n):ga(n)?t[o]=Kh({},n):Ui(n)?t[o]=n.slice():t[o]=n};for(let n=0,i=arguments.length;n<i;n++)arguments[n]&&Bo(arguments[n],r);return t}var yv=(e,t,r,{allOwnKeys:n}={})=>(Bo(t,(i,o)=>{r&&Ht(i)?e[o]=Po(i,r):e[o]=i},{allOwnKeys:n}),e),bv=e=>(e.charCodeAt(0)===65279&&(e=e.slice(1)),e),vv=(e,t,r,n)=>{e.prototype=Object.create(t.prototype,n),e.prototype.constructor=e,Object.defineProperty(e,"super",{value:t.prototype}),r&&Object.assign(e.prototype,r)},_v=(e,t,r,n)=>{let i,o,s,a={};if(t=t||{},e==null)return t;do{for(i=Object.getOwnPropertyNames(e),o=i.length;o-- >0;)s=i[o],(!n||n(s,e,t))&&!a[s]&&(t[s]=e[s],a[s]=!0);e=r!==!1&&Xh(e)}while(e&&(!r||r(e,t))&&e!==Object.prototype);return t},wv=(e,t,r)=>{e=String(e),(r===void 0||r>e.length)&&(r=e.length),r-=t.length;let n=e.indexOf(t,r);return n!==-1&&n===r},Sv=e=>{if(!e)return null;if(Ui(e))return e;let t=e.length;if(!ag(t))return null;let r=new Array(t);for(;t-- >0;)r[t]=e[t];return r},kv=(e=>t=>e&&t instanceof e)(typeof Uint8Array<"u"&&Xh(Uint8Array)),xv=(e,t)=>{let n=(e&&e[Symbol.iterator]).call(e),i;for(;(i=n.next())&&!i.done;){let o=i.value;t.call(e,o[0],o[1])}},Ev=(e,t)=>{let r,n=[];for(;(r=e.exec(t))!==null;)n.push(r);return n},Cv=yr("HTMLFormElement"),Av=e=>e.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(r,n,i){return n.toUpperCase()+i}),og=(({hasOwnProperty:e})=>(t,r)=>e.call(t,r))(Object.prototype),Tv=yr("RegExp"),hg=(e,t)=>{let r=Object.getOwnPropertyDescriptors(e),n={};Bo(r,(i,o)=>{let s;(s=t(i,o,e))!==!1&&(n[o]=s||i)}),Object.defineProperties(e,n)},Iv=e=>{hg(e,(t,r)=>{if(Ht(e)&&["arguments","caller","callee"].indexOf(r)!==-1)return!1;let n=e[r];if(Ht(n)){if(t.enumerable=!1,"writable"in t){t.writable=!1;return}t.set||(t.set=()=>{throw Error("Can not rewrite read-only method '"+r+"'")})}})},Rv=(e,t)=>{let r={},n=i=>{i.forEach(o=>{r[o]=!0})};return Ui(e)?n(e):n(String(e).split(t)),r},Pv=()=>{},Dv=(e,t)=>e!=null&&Number.isFinite(e=+e)?e:t;function Bv(e){return!!(e&&Ht(e.append)&&e[Symbol.toStringTag]==="FormData"&&e[Symbol.iterator])}var Ov=e=>{let t=new Array(10),r=(n,i)=>{if(va(n)){if(t.indexOf(n)>=0)return;if(!("toJSON"in n)){t[i]=n;let o=Ui(n)?[]:{};return Bo(n,(s,a)=>{let c=r(s,i+1);!Do(c)&&(o[a]=c)}),t[i]=void 0,o}}return n};return r(e,0)},Uv=yr("AsyncFunction"),Fv=e=>e&&(va(e)||Ht(e))&&Ht(e.then)&&Ht(e.catch),dg=((e,t)=>e?setImmediate:t?((r,n)=>(Vn.addEventListener("message",({source:i,data:o})=>{i===Vn&&o===r&&n.length&&n.shift()()},!1),i=>{n.push(i),Vn.postMessage(r,"*")}))(`axios@${Math.random()}`,[]):r=>setTimeout(r))(typeof setImmediate=="function",Ht(Vn.postMessage)),Lv=typeof queueMicrotask<"u"?queueMicrotask.bind(Vn):typeof process<"u"&&process.nextTick||dg,T={isArray:Ui,isArrayBuffer:sg,isBuffer:tv,isFormData:hv,isArrayBufferView:rv,isString:nv,isNumber:ag,isBoolean:iv,isObject:va,isPlainObject:ga,isReadableStream:uv,isRequest:pv,isResponse:fv,isHeaders:mv,isUndefined:Do,isDate:ov,isFile:sv,isBlob:av,isRegExp:Tv,isFunction:Ht,isStream:lv,isURLSearchParams:dv,isTypedArray:kv,isFileList:cv,forEach:Bo,merge:Kh,extend:yv,trim:gv,stripBOM:bv,inherits:vv,toFlatObject:_v,kindOf:ya,kindOfTest:yr,endsWith:wv,toArray:Sv,forEachEntry:xv,matchAll:Ev,isHTMLForm:Cv,hasOwnProperty:og,hasOwnProp:og,reduceDescriptors:hg,freezeMethods:Iv,toObjectSet:Rv,toCamelCase:Av,noop:Pv,toFiniteNumber:Dv,findKey:cg,global:Vn,isContextDefined:lg,isSpecCompliantForm:Bv,toJSONObject:Ov,isAsyncFn:Uv,isThenable:Fv,setImmediate:dg,asap:Lv};function Fi(e,t,r,n,i){Error.call(this),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=new Error().stack,this.message=e,this.name="AxiosError",t&&(this.code=t),r&&(this.config=r),n&&(this.request=n),i&&(this.response=i,this.status=i.status?i.status:null)}T.inherits(Fi,Error,{toJSON:function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:T.toJSONObject(this.config),code:this.code,status:this.status}}});var ug=Fi.prototype,pg={};["ERR_BAD_OPTION_VALUE","ERR_BAD_OPTION","ECONNABORTED","ETIMEDOUT","ERR_NETWORK","ERR_FR_TOO_MANY_REDIRECTS","ERR_DEPRECATED","ERR_BAD_RESPONSE","ERR_BAD_REQUEST","ERR_CANCELED","ERR_NOT_SUPPORT","ERR_INVALID_URL"].forEach(e=>{pg[e]={value:e}});Object.defineProperties(Fi,pg);Object.defineProperty(ug,"isAxiosError",{value:!0});Fi.from=(e,t,r,n,i,o)=>{let s=Object.create(ug);return T.toFlatObject(e,s,function(c){return c!==Error.prototype},a=>a!=="isAxiosError"),Fi.call(s,e.message,t,r,n,i),s.cause=e,s.name=e.name,o&&Object.assign(s,o),s};var ce=Fi;var _a=null;function Jh(e){return T.isPlainObject(e)||T.isArray(e)}function mg(e){return T.endsWith(e,"[]")?e.slice(0,-2):e}function fg(e,t,r){return e?e.concat(t).map(function(i,o){return i=mg(i),!r&&o?"["+i+"]":i}).join(r?".":""):t}function Mv(e){return T.isArray(e)&&!e.some(Jh)}var Nv=T.toFlatObject(T,{},null,function(t){return/^is[A-Z]/.test(t)});function zv(e,t,r){if(!T.isObject(e))throw new TypeError("target must be an object");t=t||new(_a||FormData),r=T.toFlatObject(r,{metaTokens:!0,dots:!1,indexes:!1},!1,function(f,b){return!T.isUndefined(b[f])});let n=r.metaTokens,i=r.visitor||h,o=r.dots,s=r.indexes,c=(r.Blob||typeof Blob<"u"&&Blob)&&T.isSpecCompliantForm(t);if(!T.isFunction(i))throw new TypeError("visitor must be a function");function l(g){if(g===null)return"";if(T.isDate(g))return g.toISOString();if(!c&&T.isBlob(g))throw new ce("Blob is not supported. Use a Buffer instead.");return T.isArrayBuffer(g)||T.isTypedArray(g)?c&&typeof Blob=="function"?new Blob([g]):Buffer.from(g):g}function h(g,f,b){let _=g;if(g&&!b&&typeof g=="object"){if(T.endsWith(f,"{}"))f=n?f:f.slice(0,-2),g=JSON.stringify(g);else if(T.isArray(g)&&Mv(g)||(T.isFileList(g)||T.endsWith(f,"[]"))&&(_=T.toArray(g)))return f=mg(f),_.forEach(function(k,R){!(T.isUndefined(k)||k===null)&&t.append(s===!0?fg([f],R,o):s===null?f:f+"[]",l(k))}),!1}return Jh(g)?!0:(t.append(fg(b,f,o),l(g)),!1)}let d=[],m=Object.assign(Nv,{defaultVisitor:h,convertValue:l,isVisitable:Jh});function u(g,f){if(!T.isUndefined(g)){if(d.indexOf(g)!==-1)throw Error("Circular reference detected in "+f.join("."));d.push(g),T.forEach(g,function(_,x){(!(T.isUndefined(_)||_===null)&&i.call(t,_,T.isString(x)?x.trim():x,f,m))===!0&&u(_,f?f.concat(x):[x])}),d.pop()}}if(!T.isObject(e))throw new TypeError("data must be an object");return u(e),t}var mn=zv;function gg(e){let t={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(e).replace(/[!'()~]|%20|%00/g,function(n){return t[n]})}function yg(e,t){this._pairs=[],e&&mn(e,this,t)}var bg=yg.prototype;bg.append=function(t,r){this._pairs.push([t,r])};bg.toString=function(t){let r=t?function(n){return t.call(this,n,gg)}:gg;return this._pairs.map(function(i){return r(i[0])+"="+r(i[1])},"").join("&")};var wa=yg;function jv(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}function Oo(e,t,r){if(!t)return e;let n=r&&r.encode||jv;T.isFunction(r)&&(r={serialize:r});let i=r&&r.serialize,o;if(i?o=i(t,r):o=T.isURLSearchParams(t)?t.toString():new wa(t,r).toString(n),o){let s=e.indexOf("#");s!==-1&&(e=e.slice(0,s)),e+=(e.indexOf("?")===-1?"?":"&")+o}return e}var Yh=class{constructor(){this.handlers=[]}use(t,r,n){return this.handlers.push({fulfilled:t,rejected:r,synchronous:n?n.synchronous:!1,runWhen:n?n.runWhen:null}),this.handlers.length-1}eject(t){this.handlers[t]&&(this.handlers[t]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(t){T.forEach(this.handlers,function(n){n!==null&&t(n)})}},Zh=Yh;var Sa={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1};var vg=typeof URLSearchParams<"u"?URLSearchParams:wa;var _g=typeof FormData<"u"?FormData:null;var wg=typeof Blob<"u"?Blob:null;var Sg={isBrowser:!0,classes:{URLSearchParams:vg,FormData:_g,Blob:wg},protocols:["http","https","file","blob","url","data"]};var td={};Ay(td,{hasBrowserEnv:()=>ed,hasStandardBrowserEnv:()=>Vv,hasStandardBrowserWebWorkerEnv:()=>Hv,navigator:()=>Qh,origin:()=>Wv});var ed=typeof window<"u"&&typeof document<"u",Qh=typeof navigator=="object"&&navigator||void 0,Vv=ed&&(!Qh||["ReactNative","NativeScript","NS"].indexOf(Qh.product)<0),Hv=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function",Wv=ed&&window.location.href||"http://localhost";var je={...td,...Sg};function rd(e,t){return mn(e,new je.classes.URLSearchParams,Object.assign({visitor:function(r,n,i,o){return je.isNode&&T.isBuffer(r)?(this.append(n,r.toString("base64")),!1):o.defaultVisitor.apply(this,arguments)}},t))}function $v(e){return T.matchAll(/\w+|\[(\w*)]/g,e).map(t=>t[0]==="[]"?"":t[1]||t[0])}function Gv(e){let t={},r=Object.keys(e),n,i=r.length,o;for(n=0;n<i;n++)o=r[n],t[o]=e[o];return t}function qv(e){function t(r,n,i,o){let s=r[o++];if(s==="__proto__")return!0;let a=Number.isFinite(+s),c=o>=r.length;return s=!s&&T.isArray(i)?i.length:s,c?(T.hasOwnProp(i,s)?i[s]=[i[s],n]:i[s]=n,!a):((!i[s]||!T.isObject(i[s]))&&(i[s]=[]),t(r,n,i[s],o)&&T.isArray(i[s])&&(i[s]=Gv(i[s])),!a)}if(T.isFormData(e)&&T.isFunction(e.entries)){let r={};return T.forEachEntry(e,(n,i)=>{t($v(n),i,r,0)}),r}return null}var ka=qv;function Kv(e,t,r){if(T.isString(e))try{return(t||JSON.parse)(e),T.trim(e)}catch(n){if(n.name!=="SyntaxError")throw n}return(r||JSON.stringify)(e)}var nd={transitional:Sa,adapter:["xhr","http","fetch"],transformRequest:[function(t,r){let n=r.getContentType()||"",i=n.indexOf("application/json")>-1,o=T.isObject(t);if(o&&T.isHTMLForm(t)&&(t=new FormData(t)),T.isFormData(t))return i?JSON.stringify(ka(t)):t;if(T.isArrayBuffer(t)||T.isBuffer(t)||T.isStream(t)||T.isFile(t)||T.isBlob(t)||T.isReadableStream(t))return t;if(T.isArrayBufferView(t))return t.buffer;if(T.isURLSearchParams(t))return r.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),t.toString();let a;if(o){if(n.indexOf("application/x-www-form-urlencoded")>-1)return rd(t,this.formSerializer).toString();if((a=T.isFileList(t))||n.indexOf("multipart/form-data")>-1){let c=this.env&&this.env.FormData;return mn(a?{"files[]":t}:t,c&&new c,this.formSerializer)}}return o||i?(r.setContentType("application/json",!1),Kv(t)):t}],transformResponse:[function(t){let r=this.transitional||nd.transitional,n=r&&r.forcedJSONParsing,i=this.responseType==="json";if(T.isResponse(t)||T.isReadableStream(t))return t;if(t&&T.isString(t)&&(n&&!this.responseType||i)){let s=!(r&&r.silentJSONParsing)&&i;try{return JSON.parse(t)}catch(a){if(s)throw a.name==="SyntaxError"?ce.from(a,ce.ERR_BAD_RESPONSE,this,null,this.response):a}}return t}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:je.classes.FormData,Blob:je.classes.Blob},validateStatus:function(t){return t>=200&&t<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};T.forEach(["delete","get","head","post","put","patch"],e=>{nd.headers[e]={}});var Li=nd;var Xv=T.toObjectSet(["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"]),kg=e=>{let t={},r,n,i;return e&&e.split(`
|
|
66
|
+
`,document.getElementsByTagName("head")[0].appendChild(n),console.log("BaseDetection enableCam OK")}async predictWebcam(){if(this.lastVideoTime===-1&&await this.detector.setOptions({runningMode:"VIDEO"}),Date.now()-this.lastExecutionDate>=1e3){let r=Date.now();if(this.lastExecutionDate=r,this.video.currentTime!==this.lastVideoTime){this.lastVideoTime=this.video.currentTime;let n=this.detector.detectForVideo(this.video,r);this.verify(n)}}this.animationFrameId=setTimeout(()=>{this.predictWebcam()},0)}handleAlert(t,r){this.options.onRealtimeAlertsCallback&&this.options.onRealtimeAlertsCallback({status:"ALERT",description:this.alertTranslate(t),type:r,category:t,begin:0,end:0}),this.options.onRealtimeAlertsCallback==null&&this.error&&(this.error.innerText=t)}handleOk(t,r){this.options.onRealtimeAlertsCallback&&this.options.onRealtimeAlertsCallback({status:"OK",description:this.alertTranslate(t),type:r,category:t,begin:0,end:0}),this.error&&(this.error.innerText="")}displayVideoDetections(t){}verify(t){}alertTranslate(t){switch(t){case"multiple_faces_detected":return"M\xFAltiplas faces detectadas";case"no_face_detected":return"Nenhuma face encontrada";case"multiple_persons_detected":return"M\xFAltiplas pessoas detectadas";case"no_person_detected":return"Nenhuma pessoa encontrada";case"cellphone_detected":return"Celular detectado";case"wrong_position_face_detected":return"Face na posi\xE7\xE3o errada";case"person_ok":return"Pessoa detectada";case"cellphone_ok":return"Nenhum celular detectadoa";case"face_ok":return"Face detectada";case"ok_position_face_detected":return"Face na posi\xE7\xE3o correta";case"wrong_face_size_detected":return"Face muito perto da c\xE2mera, afaste-se um pouco mais";case"wrong_face_position_edge_detected":return"Face muito pr\xF3xima da borda, mova-se para o centro da tela";case"wrong_face_position_move_right_detected":return"Face n\xE3o centralizada, mova-se para a direita";case"wrong_face_position_move_left_detected":return"Face n\xE3o centralizada, mova-se para a esquerda";case"wrong_face_position_move_top_detected":return"Face n\xE3o centralizada, mova-se para cima";case"wrong_face_position_move_bottom_detected":return"Face n\xE3o centralizada, mova-se para baixo";case"face_turned_left_detected":return"Face virada para a esquerda, centralize-a";case"face_turned_right_detected":return"Face virada para a direita, centralize-a";case"face_turned_up_detected":return"Face virada para cima, centralize-a";case"face_turned_down_detected":return"Face virada para baixo, centralize-a";default:return t}}};function ig(){let e=document.createElement("div");e.setAttribute("id","liveViewFrameDetection");let t=document.createElement("erro");t.setAttribute("id","errorFrameDetection");let r=document.createElement("video");r.setAttribute("id","videoPreviewFrameDetection"),r.muted=!0,e.style.width="320px",e.style.height="180px",e.style.position="fixed",e.style.bottom="30px",e.style.right="30px",e.style.display="none",r.style.width="100%",r.style.height="100%",r.style.background="#000",e.appendChild(t),e.appendChild(r),document.body.appendChild(e)}var Oi=class extends Bi{constructor(r,n,i="videoPreviewFrameDetection",o="liveViewFrameDetection"){super("FaceDetector","https://storage.googleapis.com/mediapipe-models/face_detector/blaze_face_short_range/float16/1/blaze_face_short_range.tflite",r,n,i,o);this.emmitedPositionAlert=!1;this.emmitedFaceAlert=!1;console.log("FaceDetection constructor"),this.numFacesSent=-1}stopDetection(){super.stopDetection(),this.emmitedFaceAlert&&this.handleOk("face_stop","face_detection_on_stream")}displayVideoDetections(r){for(let s of this.children)this.liveView.removeChild(s);this.children.splice(0);let n=this.video;if(n.videoWidth===0||n.videoHeight===0)return;let i=n.offsetWidth/n.videoWidth,o=n.offsetHeight/n.videoHeight;for(let s of r.detections){let a=s.boundingBox,l=(n.videoWidth-a.originX-a.width)*i,h=a.originY*o,d=(a.width-10)*i,m=a.height*o,u=document.createElement("div");u.setAttribute("class","highlighter"),Object.assign(u.style,{right:`${l+20}px`,top:`${h}px`,width:`${d}px`,height:`${m-10}px`,zIndex:"1",position:"absolute",border:"1px dashed #fff",background:"rgba(0, 255, 0, 0.25)",transform:"scaleX(-1)"});let g=document.createElement("p"),f=s.categories[0].score?Math.round(parseFloat(s.categories[0].score)*100):0;if(g.innerText=`Confidence: ${f}%`,Object.assign(g.style,{right:`${l+20}px`,top:`${h-50}px`,width:`${d}px`,zIndex:"2",position:"absolute",margin:"0",fontSize:"12px",padding:"5px",color:"#fff",backgroundColor:"#007f8b",textAlign:"center",transform:"scaleX(-1)"}),this.liveView.appendChild(u),this.liveView.appendChild(g),this.children.push(u),this.children.push(g),s.keypoints)for(let b of s.keypoints){let _=document.createElement("span");_.className="key-point";let x=b.x<2?b.x*n.videoWidth:b.x,k=b.y<2?b.y*n.videoHeight:b.y,E=(n.videoWidth-x)*i,D=k*o;Object.assign(_.style,{right:`${E+20}px`,top:`${D-3}px`,position:"absolute",width:"6px",height:"6px",borderRadius:"50%",backgroundColor:"red",zIndex:"3"}),this.liveView.appendChild(_),this.children.push(_)}}}verify(r){if(this.paramsConfig.videoBehaviourParameters?.detectFace&&r.detections.length!==this.numFacesSent)if(this.numFacesSent=r.detections.length,r.detections.length===0){this.handleAlert("no_face_detected","face_detection_on_stream"),this.emmitedFaceAlert=!0;return}else if(r.detections.length>1){this.handleAlert("multiple_faces_detected","face_detection_on_stream"),this.emmitedFaceAlert=!0;return}else this.handleOk("face_ok","face_detection_on_stream"),this.emmitedFaceAlert=!1;if(r.detections.length===0)return;let n=!1,i=document.getElementById(this.classVideo),o=i.videoWidth,s=i.videoHeight,a=r.detections[0],c=a.boundingBox,l=a.keypoints,h=l[0],d=l[1],m=l[3],u=l[4],g=l[5],f=l[2];o>s&&(c.height/s>.7?(!this.emmitedPositionAlert&&this.handleAlert("wrong_face_size_detected","position_detection_on_stream"),n=!0,this.emmitedPositionAlert=!0):c.width/o>.7&&(!this.emmitedPositionAlert&&this.handleAlert("wrong_face_size_detected","position_detection_on_stream"),this.emmitedPositionAlert=!0,n=!0));let b=[c.originX,c.originY],_=[c.originX+c.width,c.originY+c.height];(b[0]<.1*c.width||b[1]<.2*c.height||_[0]>o-.1*c.width||_[1]>s-5)&&(!this.emmitedPositionAlert&&this.handleAlert("wrong_face_position_edge_detected","position_detection_on_stream"),this.emmitedPositionAlert=!0,n=!0);let x=b[0],k=o-_[0],R=b[1],E=s-_[1];x>2*k&&(!this.emmitedPositionAlert&&this.handleAlert("wrong_face_position_move_right_detected","position_detection_on_stream"),this.emmitedPositionAlert=!0,n=!0),R>4*E&&(!this.emmitedPositionAlert&&this.handleAlert("wrong_face_position_move_top_detected","position_detection_on_stream"),this.emmitedPositionAlert=!0,n=!0),k>2*x&&(!this.emmitedPositionAlert&&this.handleAlert("wrong_face_position_move_left_detected","position_detection_on_stream"),this.emmitedPositionAlert=!0,n=!0),E>3*R&&(!this.emmitedPositionAlert&&this.handleAlert("wrong_face_position_move_bottom_detected","position_detection_on_stream"),this.emmitedPositionAlert=!0,n=!0),n==!1&&(this.emmitedPositionAlert&&this.handleOk("ok_position_face_detected","position_detection_on_stream"),this.emmitedPositionAlert=!1)}};function Po(e,t){return function(){return e.apply(t,arguments)}}var{toString:ev}=Object.prototype,{getPrototypeOf:Xh}=Object,ya=(e=>t=>{let r=ev.call(t);return e[r]||(e[r]=r.slice(8,-1).toLowerCase())})(Object.create(null)),yr=e=>(e=e.toLowerCase(),t=>ya(t)===e),ba=e=>t=>typeof t===e,{isArray:Ui}=Array,Do=ba("undefined");function tv(e){return e!==null&&!Do(e)&&e.constructor!==null&&!Do(e.constructor)&&Ht(e.constructor.isBuffer)&&e.constructor.isBuffer(e)}var sg=yr("ArrayBuffer");function rv(e){let t;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?t=ArrayBuffer.isView(e):t=e&&e.buffer&&sg(e.buffer),t}var nv=ba("string"),Ht=ba("function"),ag=ba("number"),va=e=>e!==null&&typeof e=="object",iv=e=>e===!0||e===!1,ga=e=>{if(ya(e)!=="object")return!1;let t=Xh(e);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(Symbol.toStringTag in e)&&!(Symbol.iterator in e)},ov=yr("Date"),sv=yr("File"),av=yr("Blob"),cv=yr("FileList"),lv=e=>va(e)&&Ht(e.pipe),hv=e=>{let t;return e&&(typeof FormData=="function"&&e instanceof FormData||Ht(e.append)&&((t=ya(e))==="formdata"||t==="object"&&Ht(e.toString)&&e.toString()==="[object FormData]"))},dv=yr("URLSearchParams"),[uv,pv,fv,mv]=["ReadableStream","Request","Response","Headers"].map(yr),gv=e=>e.trim?e.trim():e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function Bo(e,t,{allOwnKeys:r=!1}={}){if(e===null||typeof e>"u")return;let n,i;if(typeof e!="object"&&(e=[e]),Ui(e))for(n=0,i=e.length;n<i;n++)t.call(null,e[n],n,e);else{let o=r?Object.getOwnPropertyNames(e):Object.keys(e),s=o.length,a;for(n=0;n<s;n++)a=o[n],t.call(null,e[a],a,e)}}function cg(e,t){t=t.toLowerCase();let r=Object.keys(e),n=r.length,i;for(;n-- >0;)if(i=r[n],t===i.toLowerCase())return i;return null}var Vn=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global,lg=e=>!Do(e)&&e!==Vn;function Kh(){let{caseless:e}=lg(this)&&this||{},t={},r=(n,i)=>{let o=e&&cg(t,i)||i;ga(t[o])&&ga(n)?t[o]=Kh(t[o],n):ga(n)?t[o]=Kh({},n):Ui(n)?t[o]=n.slice():t[o]=n};for(let n=0,i=arguments.length;n<i;n++)arguments[n]&&Bo(arguments[n],r);return t}var yv=(e,t,r,{allOwnKeys:n}={})=>(Bo(t,(i,o)=>{r&&Ht(i)?e[o]=Po(i,r):e[o]=i},{allOwnKeys:n}),e),bv=e=>(e.charCodeAt(0)===65279&&(e=e.slice(1)),e),vv=(e,t,r,n)=>{e.prototype=Object.create(t.prototype,n),e.prototype.constructor=e,Object.defineProperty(e,"super",{value:t.prototype}),r&&Object.assign(e.prototype,r)},_v=(e,t,r,n)=>{let i,o,s,a={};if(t=t||{},e==null)return t;do{for(i=Object.getOwnPropertyNames(e),o=i.length;o-- >0;)s=i[o],(!n||n(s,e,t))&&!a[s]&&(t[s]=e[s],a[s]=!0);e=r!==!1&&Xh(e)}while(e&&(!r||r(e,t))&&e!==Object.prototype);return t},wv=(e,t,r)=>{e=String(e),(r===void 0||r>e.length)&&(r=e.length),r-=t.length;let n=e.indexOf(t,r);return n!==-1&&n===r},Sv=e=>{if(!e)return null;if(Ui(e))return e;let t=e.length;if(!ag(t))return null;let r=new Array(t);for(;t-- >0;)r[t]=e[t];return r},kv=(e=>t=>e&&t instanceof e)(typeof Uint8Array<"u"&&Xh(Uint8Array)),xv=(e,t)=>{let n=(e&&e[Symbol.iterator]).call(e),i;for(;(i=n.next())&&!i.done;){let o=i.value;t.call(e,o[0],o[1])}},Ev=(e,t)=>{let r,n=[];for(;(r=e.exec(t))!==null;)n.push(r);return n},Cv=yr("HTMLFormElement"),Av=e=>e.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(r,n,i){return n.toUpperCase()+i}),og=(({hasOwnProperty:e})=>(t,r)=>e.call(t,r))(Object.prototype),Tv=yr("RegExp"),hg=(e,t)=>{let r=Object.getOwnPropertyDescriptors(e),n={};Bo(r,(i,o)=>{let s;(s=t(i,o,e))!==!1&&(n[o]=s||i)}),Object.defineProperties(e,n)},Iv=e=>{hg(e,(t,r)=>{if(Ht(e)&&["arguments","caller","callee"].indexOf(r)!==-1)return!1;let n=e[r];if(Ht(n)){if(t.enumerable=!1,"writable"in t){t.writable=!1;return}t.set||(t.set=()=>{throw Error("Can not rewrite read-only method '"+r+"'")})}})},Rv=(e,t)=>{let r={},n=i=>{i.forEach(o=>{r[o]=!0})};return Ui(e)?n(e):n(String(e).split(t)),r},Pv=()=>{},Dv=(e,t)=>e!=null&&Number.isFinite(e=+e)?e:t;function Bv(e){return!!(e&&Ht(e.append)&&e[Symbol.toStringTag]==="FormData"&&e[Symbol.iterator])}var Ov=e=>{let t=new Array(10),r=(n,i)=>{if(va(n)){if(t.indexOf(n)>=0)return;if(!("toJSON"in n)){t[i]=n;let o=Ui(n)?[]:{};return Bo(n,(s,a)=>{let c=r(s,i+1);!Do(c)&&(o[a]=c)}),t[i]=void 0,o}}return n};return r(e,0)},Uv=yr("AsyncFunction"),Fv=e=>e&&(va(e)||Ht(e))&&Ht(e.then)&&Ht(e.catch),dg=((e,t)=>e?setImmediate:t?((r,n)=>(Vn.addEventListener("message",({source:i,data:o})=>{i===Vn&&o===r&&n.length&&n.shift()()},!1),i=>{n.push(i),Vn.postMessage(r,"*")}))(`axios@${Math.random()}`,[]):r=>setTimeout(r))(typeof setImmediate=="function",Ht(Vn.postMessage)),Lv=typeof queueMicrotask<"u"?queueMicrotask.bind(Vn):typeof process<"u"&&process.nextTick||dg,T={isArray:Ui,isArrayBuffer:sg,isBuffer:tv,isFormData:hv,isArrayBufferView:rv,isString:nv,isNumber:ag,isBoolean:iv,isObject:va,isPlainObject:ga,isReadableStream:uv,isRequest:pv,isResponse:fv,isHeaders:mv,isUndefined:Do,isDate:ov,isFile:sv,isBlob:av,isRegExp:Tv,isFunction:Ht,isStream:lv,isURLSearchParams:dv,isTypedArray:kv,isFileList:cv,forEach:Bo,merge:Kh,extend:yv,trim:gv,stripBOM:bv,inherits:vv,toFlatObject:_v,kindOf:ya,kindOfTest:yr,endsWith:wv,toArray:Sv,forEachEntry:xv,matchAll:Ev,isHTMLForm:Cv,hasOwnProperty:og,hasOwnProp:og,reduceDescriptors:hg,freezeMethods:Iv,toObjectSet:Rv,toCamelCase:Av,noop:Pv,toFiniteNumber:Dv,findKey:cg,global:Vn,isContextDefined:lg,isSpecCompliantForm:Bv,toJSONObject:Ov,isAsyncFn:Uv,isThenable:Fv,setImmediate:dg,asap:Lv};function Fi(e,t,r,n,i){Error.call(this),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=new Error().stack,this.message=e,this.name="AxiosError",t&&(this.code=t),r&&(this.config=r),n&&(this.request=n),i&&(this.response=i,this.status=i.status?i.status:null)}T.inherits(Fi,Error,{toJSON:function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:T.toJSONObject(this.config),code:this.code,status:this.status}}});var ug=Fi.prototype,pg={};["ERR_BAD_OPTION_VALUE","ERR_BAD_OPTION","ECONNABORTED","ETIMEDOUT","ERR_NETWORK","ERR_FR_TOO_MANY_REDIRECTS","ERR_DEPRECATED","ERR_BAD_RESPONSE","ERR_BAD_REQUEST","ERR_CANCELED","ERR_NOT_SUPPORT","ERR_INVALID_URL"].forEach(e=>{pg[e]={value:e}});Object.defineProperties(Fi,pg);Object.defineProperty(ug,"isAxiosError",{value:!0});Fi.from=(e,t,r,n,i,o)=>{let s=Object.create(ug);return T.toFlatObject(e,s,function(c){return c!==Error.prototype},a=>a!=="isAxiosError"),Fi.call(s,e.message,t,r,n,i),s.cause=e,s.name=e.name,o&&Object.assign(s,o),s};var ce=Fi;var _a=null;function Jh(e){return T.isPlainObject(e)||T.isArray(e)}function mg(e){return T.endsWith(e,"[]")?e.slice(0,-2):e}function fg(e,t,r){return e?e.concat(t).map(function(i,o){return i=mg(i),!r&&o?"["+i+"]":i}).join(r?".":""):t}function Mv(e){return T.isArray(e)&&!e.some(Jh)}var Nv=T.toFlatObject(T,{},null,function(t){return/^is[A-Z]/.test(t)});function zv(e,t,r){if(!T.isObject(e))throw new TypeError("target must be an object");t=t||new(_a||FormData),r=T.toFlatObject(r,{metaTokens:!0,dots:!1,indexes:!1},!1,function(f,b){return!T.isUndefined(b[f])});let n=r.metaTokens,i=r.visitor||h,o=r.dots,s=r.indexes,c=(r.Blob||typeof Blob<"u"&&Blob)&&T.isSpecCompliantForm(t);if(!T.isFunction(i))throw new TypeError("visitor must be a function");function l(g){if(g===null)return"";if(T.isDate(g))return g.toISOString();if(!c&&T.isBlob(g))throw new ce("Blob is not supported. Use a Buffer instead.");return T.isArrayBuffer(g)||T.isTypedArray(g)?c&&typeof Blob=="function"?new Blob([g]):Buffer.from(g):g}function h(g,f,b){let _=g;if(g&&!b&&typeof g=="object"){if(T.endsWith(f,"{}"))f=n?f:f.slice(0,-2),g=JSON.stringify(g);else if(T.isArray(g)&&Mv(g)||(T.isFileList(g)||T.endsWith(f,"[]"))&&(_=T.toArray(g)))return f=mg(f),_.forEach(function(k,R){!(T.isUndefined(k)||k===null)&&t.append(s===!0?fg([f],R,o):s===null?f:f+"[]",l(k))}),!1}return Jh(g)?!0:(t.append(fg(b,f,o),l(g)),!1)}let d=[],m=Object.assign(Nv,{defaultVisitor:h,convertValue:l,isVisitable:Jh});function u(g,f){if(!T.isUndefined(g)){if(d.indexOf(g)!==-1)throw Error("Circular reference detected in "+f.join("."));d.push(g),T.forEach(g,function(_,x){(!(T.isUndefined(_)||_===null)&&i.call(t,_,T.isString(x)?x.trim():x,f,m))===!0&&u(_,f?f.concat(x):[x])}),d.pop()}}if(!T.isObject(e))throw new TypeError("data must be an object");return u(e),t}var mn=zv;function gg(e){let t={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(e).replace(/[!'()~]|%20|%00/g,function(n){return t[n]})}function yg(e,t){this._pairs=[],e&&mn(e,this,t)}var bg=yg.prototype;bg.append=function(t,r){this._pairs.push([t,r])};bg.toString=function(t){let r=t?function(n){return t.call(this,n,gg)}:gg;return this._pairs.map(function(i){return r(i[0])+"="+r(i[1])},"").join("&")};var wa=yg;function jv(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}function Oo(e,t,r){if(!t)return e;let n=r&&r.encode||jv;T.isFunction(r)&&(r={serialize:r});let i=r&&r.serialize,o;if(i?o=i(t,r):o=T.isURLSearchParams(t)?t.toString():new wa(t,r).toString(n),o){let s=e.indexOf("#");s!==-1&&(e=e.slice(0,s)),e+=(e.indexOf("?")===-1?"?":"&")+o}return e}var Yh=class{constructor(){this.handlers=[]}use(t,r,n){return this.handlers.push({fulfilled:t,rejected:r,synchronous:n?n.synchronous:!1,runWhen:n?n.runWhen:null}),this.handlers.length-1}eject(t){this.handlers[t]&&(this.handlers[t]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(t){T.forEach(this.handlers,function(n){n!==null&&t(n)})}},Zh=Yh;var Sa={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1};var vg=typeof URLSearchParams<"u"?URLSearchParams:wa;var _g=typeof FormData<"u"?FormData:null;var wg=typeof Blob<"u"?Blob:null;var Sg={isBrowser:!0,classes:{URLSearchParams:vg,FormData:_g,Blob:wg},protocols:["http","https","file","blob","url","data"]};var td={};Ay(td,{hasBrowserEnv:()=>ed,hasStandardBrowserEnv:()=>Vv,hasStandardBrowserWebWorkerEnv:()=>Hv,navigator:()=>Qh,origin:()=>Wv});var ed=typeof window<"u"&&typeof document<"u",Qh=typeof navigator=="object"&&navigator||void 0,Vv=ed&&(!Qh||["ReactNative","NativeScript","NS"].indexOf(Qh.product)<0),Hv=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function",Wv=ed&&window.location.href||"http://localhost";var je={...td,...Sg};function rd(e,t){return mn(e,new je.classes.URLSearchParams,Object.assign({visitor:function(r,n,i,o){return je.isNode&&T.isBuffer(r)?(this.append(n,r.toString("base64")),!1):o.defaultVisitor.apply(this,arguments)}},t))}function $v(e){return T.matchAll(/\w+|\[(\w*)]/g,e).map(t=>t[0]==="[]"?"":t[1]||t[0])}function Gv(e){let t={},r=Object.keys(e),n,i=r.length,o;for(n=0;n<i;n++)o=r[n],t[o]=e[o];return t}function qv(e){function t(r,n,i,o){let s=r[o++];if(s==="__proto__")return!0;let a=Number.isFinite(+s),c=o>=r.length;return s=!s&&T.isArray(i)?i.length:s,c?(T.hasOwnProp(i,s)?i[s]=[i[s],n]:i[s]=n,!a):((!i[s]||!T.isObject(i[s]))&&(i[s]=[]),t(r,n,i[s],o)&&T.isArray(i[s])&&(i[s]=Gv(i[s])),!a)}if(T.isFormData(e)&&T.isFunction(e.entries)){let r={};return T.forEachEntry(e,(n,i)=>{t($v(n),i,r,0)}),r}return null}var ka=qv;function Kv(e,t,r){if(T.isString(e))try{return(t||JSON.parse)(e),T.trim(e)}catch(n){if(n.name!=="SyntaxError")throw n}return(r||JSON.stringify)(e)}var nd={transitional:Sa,adapter:["xhr","http","fetch"],transformRequest:[function(t,r){let n=r.getContentType()||"",i=n.indexOf("application/json")>-1,o=T.isObject(t);if(o&&T.isHTMLForm(t)&&(t=new FormData(t)),T.isFormData(t))return i?JSON.stringify(ka(t)):t;if(T.isArrayBuffer(t)||T.isBuffer(t)||T.isStream(t)||T.isFile(t)||T.isBlob(t)||T.isReadableStream(t))return t;if(T.isArrayBufferView(t))return t.buffer;if(T.isURLSearchParams(t))return r.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),t.toString();let a;if(o){if(n.indexOf("application/x-www-form-urlencoded")>-1)return rd(t,this.formSerializer).toString();if((a=T.isFileList(t))||n.indexOf("multipart/form-data")>-1){let c=this.env&&this.env.FormData;return mn(a?{"files[]":t}:t,c&&new c,this.formSerializer)}}return o||i?(r.setContentType("application/json",!1),Kv(t)):t}],transformResponse:[function(t){let r=this.transitional||nd.transitional,n=r&&r.forcedJSONParsing,i=this.responseType==="json";if(T.isResponse(t)||T.isReadableStream(t))return t;if(t&&T.isString(t)&&(n&&!this.responseType||i)){let s=!(r&&r.silentJSONParsing)&&i;try{return JSON.parse(t)}catch(a){if(s)throw a.name==="SyntaxError"?ce.from(a,ce.ERR_BAD_RESPONSE,this,null,this.response):a}}return t}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:je.classes.FormData,Blob:je.classes.Blob},validateStatus:function(t){return t>=200&&t<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};T.forEach(["delete","get","head","post","put","patch"],e=>{nd.headers[e]={}});var Li=nd;var Xv=T.toObjectSet(["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"]),kg=e=>{let t={},r,n,i;return e&&e.split(`
|
|
67
67
|
`).forEach(function(s){i=s.indexOf(":"),r=s.substring(0,i).trim().toLowerCase(),n=s.substring(i+1).trim(),!(!r||t[r]&&Xv[r])&&(r==="set-cookie"?t[r]?t[r].push(n):t[r]=[n]:t[r]=t[r]?t[r]+", "+n:n)}),t};var xg=Symbol("internals");function Uo(e){return e&&String(e).trim().toLowerCase()}function xa(e){return e===!1||e==null?e:T.isArray(e)?e.map(xa):String(e)}function Jv(e){let t=Object.create(null),r=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g,n;for(;n=r.exec(e);)t[n[1]]=n[2];return t}var Yv=e=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(e.trim());function id(e,t,r,n,i){if(T.isFunction(n))return n.call(this,t,r);if(i&&(t=r),!!T.isString(t)){if(T.isString(n))return t.indexOf(n)!==-1;if(T.isRegExp(n))return n.test(t)}}function Zv(e){return e.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(t,r,n)=>r.toUpperCase()+n)}function Qv(e,t){let r=T.toCamelCase(" "+t);["get","set","has"].forEach(n=>{Object.defineProperty(e,n+r,{value:function(i,o,s){return this[n].call(this,t,i,o,s)},configurable:!0})})}var Mi=class{constructor(t){t&&this.set(t)}set(t,r,n){let i=this;function o(a,c,l){let h=Uo(c);if(!h)throw new Error("header name must be a non-empty string");let d=T.findKey(i,h);(!d||i[d]===void 0||l===!0||l===void 0&&i[d]!==!1)&&(i[d||c]=xa(a))}let s=(a,c)=>T.forEach(a,(l,h)=>o(l,h,c));if(T.isPlainObject(t)||t instanceof this.constructor)s(t,r);else if(T.isString(t)&&(t=t.trim())&&!Yv(t))s(kg(t),r);else if(T.isHeaders(t))for(let[a,c]of t.entries())o(c,a,n);else t!=null&&o(r,t,n);return this}get(t,r){if(t=Uo(t),t){let n=T.findKey(this,t);if(n){let i=this[n];if(!r)return i;if(r===!0)return Jv(i);if(T.isFunction(r))return r.call(this,i,n);if(T.isRegExp(r))return r.exec(i);throw new TypeError("parser must be boolean|regexp|function")}}}has(t,r){if(t=Uo(t),t){let n=T.findKey(this,t);return!!(n&&this[n]!==void 0&&(!r||id(this,this[n],n,r)))}return!1}delete(t,r){let n=this,i=!1;function o(s){if(s=Uo(s),s){let a=T.findKey(n,s);a&&(!r||id(n,n[a],a,r))&&(delete n[a],i=!0)}}return T.isArray(t)?t.forEach(o):o(t),i}clear(t){let r=Object.keys(this),n=r.length,i=!1;for(;n--;){let o=r[n];(!t||id(this,this[o],o,t,!0))&&(delete this[o],i=!0)}return i}normalize(t){let r=this,n={};return T.forEach(this,(i,o)=>{let s=T.findKey(n,o);if(s){r[s]=xa(i),delete r[o];return}let a=t?Zv(o):String(o).trim();a!==o&&delete r[o],r[a]=xa(i),n[a]=!0}),this}concat(...t){return this.constructor.concat(this,...t)}toJSON(t){let r=Object.create(null);return T.forEach(this,(n,i)=>{n!=null&&n!==!1&&(r[i]=t&&T.isArray(n)?n.join(", "):n)}),r}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map(([t,r])=>t+": "+r).join(`
|
|
68
68
|
`)}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(t){return t instanceof this?t:new this(t)}static concat(t,...r){let n=new this(t);return r.forEach(i=>n.set(i)),n}static accessor(t){let n=(this[xg]=this[xg]={accessors:{}}).accessors,i=this.prototype;function o(s){let a=Uo(s);n[a]||(Qv(i,s),n[a]=!0)}return T.isArray(t)?t.forEach(o):o(t),this}};Mi.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]);T.reduceDescriptors(Mi.prototype,({value:e},t)=>{let r=t[0].toUpperCase()+t.slice(1);return{get:()=>e,set(n){this[r]=n}}});T.freezeMethods(Mi);var at=Mi;function Fo(e,t){let r=this||Li,n=t||r,i=at.from(n.headers),o=n.data;return T.forEach(e,function(a){o=a.call(r,o,i.normalize(),t?t.status:void 0)}),i.normalize(),o}function Lo(e){return!!(e&&e.__CANCEL__)}function Eg(e,t,r){ce.call(this,e??"canceled",ce.ERR_CANCELED,t,r),this.name="CanceledError"}T.inherits(Eg,ce,{__CANCEL__:!0});var Or=Eg;function Mo(e,t,r){let n=r.config.validateStatus;!r.status||!n||n(r.status)?e(r):t(new ce("Request failed with status code "+r.status,[ce.ERR_BAD_REQUEST,ce.ERR_BAD_RESPONSE][Math.floor(r.status/100)-4],r.config,r.request,r))}function od(e){let t=/^([-+\w]{1,25})(:?\/\/|:)/.exec(e);return t&&t[1]||""}function e_(e,t){e=e||10;let r=new Array(e),n=new Array(e),i=0,o=0,s;return t=t!==void 0?t:1e3,function(c){let l=Date.now(),h=n[o];s||(s=l),r[i]=c,n[i]=l;let d=o,m=0;for(;d!==i;)m+=r[d++],d=d%e;if(i=(i+1)%e,i===o&&(o=(o+1)%e),l-s<t)return;let u=h&&l-h;return u?Math.round(m*1e3/u):void 0}}var Cg=e_;function t_(e,t){let r=0,n=1e3/t,i,o,s=(l,h=Date.now())=>{r=h,i=null,o&&(clearTimeout(o),o=null),e.apply(null,l)};return[(...l)=>{let h=Date.now(),d=h-r;d>=n?s(l,h):(i=l,o||(o=setTimeout(()=>{o=null,s(i)},n-d)))},()=>i&&s(i)]}var Ag=t_;var Ni=(e,t,r=3)=>{let n=0,i=Cg(50,250);return Ag(o=>{let s=o.loaded,a=o.lengthComputable?o.total:void 0,c=s-n,l=i(c),h=s<=a;n=s;let d={loaded:s,total:a,progress:a?s/a:void 0,bytes:c,rate:l||void 0,estimated:l&&a&&h?(a-s)/l:void 0,event:o,lengthComputable:a!=null,[t?"download":"upload"]:!0};e(d)},r)},sd=(e,t)=>{let r=e!=null;return[n=>t[0]({lengthComputable:r,total:e,loaded:n}),t[1]]},ad=e=>(...t)=>T.asap(()=>e(...t));var Tg=je.hasStandardBrowserEnv?((e,t)=>r=>(r=new URL(r,je.origin),e.protocol===r.protocol&&e.host===r.host&&(t||e.port===r.port)))(new URL(je.origin),je.navigator&&/(msie|trident)/i.test(je.navigator.userAgent)):()=>!0;var Ig=je.hasStandardBrowserEnv?{write(e,t,r,n,i,o){let s=[e+"="+encodeURIComponent(t)];T.isNumber(r)&&s.push("expires="+new Date(r).toGMTString()),T.isString(n)&&s.push("path="+n),T.isString(i)&&s.push("domain="+i),o===!0&&s.push("secure"),document.cookie=s.join("; ")},read(e){let t=document.cookie.match(new RegExp("(^|;\\s*)("+e+")=([^;]*)"));return t?decodeURIComponent(t[3]):null},remove(e){this.write(e,"",Date.now()-864e5)}}:{write(){},read(){return null},remove(){}};function cd(e){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(e)}function ld(e,t){return t?e.replace(/\/?\/$/,"")+"/"+t.replace(/^\/+/,""):e}function No(e,t,r){let n=!cd(t);return e&&(n||r==!1)?ld(e,t):t}var Rg=e=>e instanceof at?{...e}:e;function br(e,t){t=t||{};let r={};function n(l,h,d,m){return T.isPlainObject(l)&&T.isPlainObject(h)?T.merge.call({caseless:m},l,h):T.isPlainObject(h)?T.merge({},h):T.isArray(h)?h.slice():h}function i(l,h,d,m){if(T.isUndefined(h)){if(!T.isUndefined(l))return n(void 0,l,d,m)}else return n(l,h,d,m)}function o(l,h){if(!T.isUndefined(h))return n(void 0,h)}function s(l,h){if(T.isUndefined(h)){if(!T.isUndefined(l))return n(void 0,l)}else return n(void 0,h)}function a(l,h,d){if(d in t)return n(l,h);if(d in e)return n(void 0,l)}let c={url:o,method:o,data:o,baseURL:s,transformRequest:s,transformResponse:s,paramsSerializer:s,timeout:s,timeoutMessage:s,withCredentials:s,withXSRFToken:s,adapter:s,responseType:s,xsrfCookieName:s,xsrfHeaderName:s,onUploadProgress:s,onDownloadProgress:s,decompress:s,maxContentLength:s,maxBodyLength:s,beforeRedirect:s,transport:s,httpAgent:s,httpsAgent:s,cancelToken:s,socketPath:s,responseEncoding:s,validateStatus:a,headers:(l,h,d)=>i(Rg(l),Rg(h),d,!0)};return T.forEach(Object.keys(Object.assign({},e,t)),function(h){let d=c[h]||i,m=d(e[h],t[h],h);T.isUndefined(m)&&d!==a||(r[h]=m)}),r}var Ea=e=>{let t=br({},e),{data:r,withXSRFToken:n,xsrfHeaderName:i,xsrfCookieName:o,headers:s,auth:a}=t;t.headers=s=at.from(s),t.url=Oo(No(t.baseURL,t.url,t.allowAbsoluteUrls),e.params,e.paramsSerializer),a&&s.set("Authorization","Basic "+btoa((a.username||"")+":"+(a.password?unescape(encodeURIComponent(a.password)):"")));let c;if(T.isFormData(r)){if(je.hasStandardBrowserEnv||je.hasStandardBrowserWebWorkerEnv)s.setContentType(void 0);else if((c=s.getContentType())!==!1){let[l,...h]=c?c.split(";").map(d=>d.trim()).filter(Boolean):[];s.setContentType([l||"multipart/form-data",...h].join("; "))}}if(je.hasStandardBrowserEnv&&(n&&T.isFunction(n)&&(n=n(t)),n||n!==!1&&Tg(t.url))){let l=i&&o&&Ig.read(o);l&&s.set(i,l)}return t};var r_=typeof XMLHttpRequest<"u",Pg=r_&&function(e){return new Promise(function(r,n){let i=Ea(e),o=i.data,s=at.from(i.headers).normalize(),{responseType:a,onUploadProgress:c,onDownloadProgress:l}=i,h,d,m,u,g;function f(){u&&u(),g&&g(),i.cancelToken&&i.cancelToken.unsubscribe(h),i.signal&&i.signal.removeEventListener("abort",h)}let b=new XMLHttpRequest;b.open(i.method.toUpperCase(),i.url,!0),b.timeout=i.timeout;function _(){if(!b)return;let k=at.from("getAllResponseHeaders"in b&&b.getAllResponseHeaders()),E={data:!a||a==="text"||a==="json"?b.responseText:b.response,status:b.status,statusText:b.statusText,headers:k,config:e,request:b};Mo(function(I){r(I),f()},function(I){n(I),f()},E),b=null}"onloadend"in b?b.onloadend=_:b.onreadystatechange=function(){!b||b.readyState!==4||b.status===0&&!(b.responseURL&&b.responseURL.indexOf("file:")===0)||setTimeout(_)},b.onabort=function(){b&&(n(new ce("Request aborted",ce.ECONNABORTED,e,b)),b=null)},b.onerror=function(){n(new ce("Network Error",ce.ERR_NETWORK,e,b)),b=null},b.ontimeout=function(){let R=i.timeout?"timeout of "+i.timeout+"ms exceeded":"timeout exceeded",E=i.transitional||Sa;i.timeoutErrorMessage&&(R=i.timeoutErrorMessage),n(new ce(R,E.clarifyTimeoutError?ce.ETIMEDOUT:ce.ECONNABORTED,e,b)),b=null},o===void 0&&s.setContentType(null),"setRequestHeader"in b&&T.forEach(s.toJSON(),function(R,E){b.setRequestHeader(E,R)}),T.isUndefined(i.withCredentials)||(b.withCredentials=!!i.withCredentials),a&&a!=="json"&&(b.responseType=i.responseType),l&&([m,g]=Ni(l,!0),b.addEventListener("progress",m)),c&&b.upload&&([d,u]=Ni(c),b.upload.addEventListener("progress",d),b.upload.addEventListener("loadend",u)),(i.cancelToken||i.signal)&&(h=k=>{b&&(n(!k||k.type?new Or(null,e,b):k),b.abort(),b=null)},i.cancelToken&&i.cancelToken.subscribe(h),i.signal&&(i.signal.aborted?h():i.signal.addEventListener("abort",h)));let x=od(i.url);if(x&&je.protocols.indexOf(x)===-1){n(new ce("Unsupported protocol "+x+":",ce.ERR_BAD_REQUEST,e));return}b.send(o||null)})};var n_=(e,t)=>{let{length:r}=e=e?e.filter(Boolean):[];if(t||r){let n=new AbortController,i,o=function(l){if(!i){i=!0,a();let h=l instanceof Error?l:this.reason;n.abort(h instanceof ce?h:new Or(h instanceof Error?h.message:h))}},s=t&&setTimeout(()=>{s=null,o(new ce(`timeout ${t} of ms exceeded`,ce.ETIMEDOUT))},t),a=()=>{e&&(s&&clearTimeout(s),s=null,e.forEach(l=>{l.unsubscribe?l.unsubscribe(o):l.removeEventListener("abort",o)}),e=null)};e.forEach(l=>l.addEventListener("abort",o));let{signal:c}=n;return c.unsubscribe=()=>T.asap(a),c}},Dg=n_;var i_=function*(e,t){let r=e.byteLength;if(!t||r<t){yield e;return}let n=0,i;for(;n<r;)i=n+t,yield e.slice(n,i),n=i},o_=async function*(e,t){for await(let r of s_(e))yield*i_(r,t)},s_=async function*(e){if(e[Symbol.asyncIterator]){yield*e;return}let t=e.getReader();try{for(;;){let{done:r,value:n}=await t.read();if(r)break;yield n}}finally{await t.cancel()}},hd=(e,t,r,n)=>{let i=o_(e,t),o=0,s,a=c=>{s||(s=!0,n&&n(c))};return new ReadableStream({async pull(c){try{let{done:l,value:h}=await i.next();if(l){a(),c.close();return}let d=h.byteLength;if(r){let m=o+=d;r(m)}c.enqueue(new Uint8Array(h))}catch(l){throw a(l),l}},cancel(c){return a(c),i.return()}},{highWaterMark:2})};var Aa=typeof fetch=="function"&&typeof Request=="function"&&typeof Response=="function",Og=Aa&&typeof ReadableStream=="function",a_=Aa&&(typeof TextEncoder=="function"?(e=>t=>e.encode(t))(new TextEncoder):async e=>new Uint8Array(await new Response(e).arrayBuffer())),Ug=(e,...t)=>{try{return!!e(...t)}catch{return!1}},c_=Og&&Ug(()=>{let e=!1,t=new Request(je.origin,{body:new ReadableStream,method:"POST",get duplex(){return e=!0,"half"}}).headers.has("Content-Type");return e&&!t}),Bg=64*1024,dd=Og&&Ug(()=>T.isReadableStream(new Response("").body)),Ca={stream:dd&&(e=>e.body)};Aa&&(e=>{["text","arrayBuffer","blob","formData","stream"].forEach(t=>{!Ca[t]&&(Ca[t]=T.isFunction(e[t])?r=>r[t]():(r,n)=>{throw new ce(`Response type '${t}' is not supported`,ce.ERR_NOT_SUPPORT,n)})})})(new Response);var l_=async e=>{if(e==null)return 0;if(T.isBlob(e))return e.size;if(T.isSpecCompliantForm(e))return(await new Request(je.origin,{method:"POST",body:e}).arrayBuffer()).byteLength;if(T.isArrayBufferView(e)||T.isArrayBuffer(e))return e.byteLength;if(T.isURLSearchParams(e)&&(e=e+""),T.isString(e))return(await a_(e)).byteLength},h_=async(e,t)=>{let r=T.toFiniteNumber(e.getContentLength());return r??l_(t)},Fg=Aa&&(async e=>{let{url:t,method:r,data:n,signal:i,cancelToken:o,timeout:s,onDownloadProgress:a,onUploadProgress:c,responseType:l,headers:h,withCredentials:d="same-origin",fetchOptions:m}=Ea(e);l=l?(l+"").toLowerCase():"text";let u=Dg([i,o&&o.toAbortSignal()],s),g,f=u&&u.unsubscribe&&(()=>{u.unsubscribe()}),b;try{if(c&&c_&&r!=="get"&&r!=="head"&&(b=await h_(h,n))!==0){let E=new Request(t,{method:"POST",body:n,duplex:"half"}),D;if(T.isFormData(n)&&(D=E.headers.get("content-type"))&&h.setContentType(D),E.body){let[I,N]=sd(b,Ni(ad(c)));n=hd(E.body,Bg,I,N)}}T.isString(d)||(d=d?"include":"omit");let _="credentials"in Request.prototype;g=new Request(t,{...m,signal:u,method:r.toUpperCase(),headers:h.normalize().toJSON(),body:n,duplex:"half",credentials:_?d:void 0});let x=await fetch(g),k=dd&&(l==="stream"||l==="response");if(dd&&(a||k&&f)){let E={};["status","statusText","headers"].forEach(q=>{E[q]=x[q]});let D=T.toFiniteNumber(x.headers.get("content-length")),[I,N]=a&&sd(D,Ni(ad(a),!0))||[];x=new Response(hd(x.body,Bg,I,()=>{N&&N(),f&&f()}),E)}l=l||"text";let R=await Ca[T.findKey(Ca,l)||"text"](x,e);return!k&&f&&f(),await new Promise((E,D)=>{Mo(E,D,{data:R,headers:at.from(x.headers),status:x.status,statusText:x.statusText,config:e,request:g})})}catch(_){throw f&&f(),_&&_.name==="TypeError"&&/fetch/i.test(_.message)?Object.assign(new ce("Network Error",ce.ERR_NETWORK,e,g),{cause:_.cause||_}):ce.from(_,_&&_.code,e,g)}});var ud={http:_a,xhr:Pg,fetch:Fg};T.forEach(ud,(e,t)=>{if(e){try{Object.defineProperty(e,"name",{value:t})}catch{}Object.defineProperty(e,"adapterName",{value:t})}});var Lg=e=>`- ${e}`,d_=e=>T.isFunction(e)||e===null||e===!1,Ta={getAdapter:e=>{e=T.isArray(e)?e:[e];let{length:t}=e,r,n,i={};for(let o=0;o<t;o++){r=e[o];let s;if(n=r,!d_(r)&&(n=ud[(s=String(r)).toLowerCase()],n===void 0))throw new ce(`Unknown adapter '${s}'`);if(n)break;i[s||"#"+o]=n}if(!n){let o=Object.entries(i).map(([a,c])=>`adapter ${a} `+(c===!1?"is not supported by the environment":"is not available in the build")),s=t?o.length>1?`since :
|
|
69
69
|
`+o.map(Lg).join(`
|
|
@@ -79,7 +79,7 @@ Minimum version required to store current data is: `+o+`.
|
|
|
79
79
|
File type: ${i.type}
|
|
80
80
|
File size: ${i.size}`),new Error("Failed to upload to AWS")}}};var Gg="not_shared_first_screen",qg="not_shared_screen",Fa="multiple_monitors_detected",Kg="proctoring_already_started",La="proctoring_not_started";var Xg="another_stream_active",Jg="stream_under_minimum_permitted",Yg="browser_not_supported",Zg="token_missing",Qg="credentials_missing";var e0="spy_scan_api_not_found";var t0="external_camera_not_started";var Ma=class extends Bi{constructor(t,r,n="videoPreviewFrameDetection",i="liveViewFrameDetection"){super("ObjectDetector","https://storage.googleapis.com/mediapipe-models/object_detector/efficientdet_lite0/float16/1/efficientdet_lite0.tflite",t,r,n,i)}stopDetection(){super.stopDetection(),this.numPersonsSent>0&&this.handleOk("person_ok","person_detection_on_stream")}displayVideoDetections(t){for(let r of this.children)this.liveView.removeChild(r);this.children.splice(0);for(let r of t.detections){let n=window.innerWidth,i=window.innerHeight,o=this.video.offsetWidth,s=this.video.offsetHeight,a=o/n,c=s/i,l=o-r.boundingBox.width*a-r.boundingBox.originX*a,h=r.boundingBox.originY*c,d=(r.boundingBox.width-10)*a,m=r.boundingBox.height*c,u=document.createElement("p");u.innerText=r.categories[0].categoryName+" - with "+Math.round(parseFloat(r.categories[0].score)*100)+"% confidence.",u.style.right=l-20+"px",u.style.top=h+"px",u.style.width=d+"px";let g={zIndex:"2",position:"absolute",border:"1px dashed #fff"};Object.assign(u.style,{...g,margin:"0",fontSize:"9px",paddingBottom:"5px",paddingTop:"5px",color:"#fff",backgroundColor:"#007f8b"});let f=document.createElement("div");f.setAttribute("class","highlighter"),f.style.right=l-20+"px",f.style.top=h+"px",f.style.width=d+"px",f.style.height=m-20+"px",Object.assign(f.style,{...g,zIndex:"1",background:"rgba(0, 255, 0, 0.25)"}),this.liveView.appendChild(f),this.liveView.appendChild(u),this.children.push(f),this.children.push(u)}}verify(t){let r=t.detections.filter(i=>i.categories.some(o=>o.categoryName==="person")).length,n=t.detections.filter(i=>i.categories.some(o=>o.categoryName==="cell phone")).length;this.paramsConfig.videoBehaviourParameters?.detectPerson&&r!==this.numPersonsSent&&(r===0?(this.handleAlert("no_person_detected","person_detection_on_stream"),this.numPersonsSent=r):r>1?(this.handleAlert("multiple_persons_detected","person_detection_on_stream"),this.numPersonsSent=r):(this.handleOk("person_ok","person_detection_on_stream"),this.numPersonsSent=r)),this.paramsConfig.videoBehaviourParameters?.detectCellPhone&&n!==this.numCellphoneSent&&(n>0?(this.handleAlert("cellphone_detected","mobile_detection_on_stream"),this.numCellphoneSent=n):(this.handleOk("cellphone_ok","mobile_detection_on_stream"),this.numCellphoneSent=n))}};var gn=class{constructor(t){this.volume=null;this.animationFrameId=null;this.stream=t}async start(t={}){return new Promise((r,n)=>{try{this.audioContext=new AudioContext,this.analyser=this.audioContext.createAnalyser(),this.microphone=this.audioContext.createMediaStreamSource(this.stream),this.analyser.smoothingTimeConstant=.8,this.analyser.fftSize=1024,this.microphone.connect(this.analyser);let i=()=>{let o=new Uint8Array(this.analyser.frequencyBinCount);this.analyser.getByteFrequencyData(o);let a=o.reduce((c,l)=>c+l,0)/o.length;this.setVolume(a),t.setVolume&&t.setVolume(a),this.animationFrameId=requestAnimationFrame(i)};this.animationFrameId=requestAnimationFrame(i),r(!0)}catch(i){this.stop(),n(`Error: ${i}`)}})}stop(){this.animationFrameId!==null&&cancelAnimationFrame(this.animationFrameId),this.audioContext?.close(),this.microphone?.disconnect(),this.analyser?.disconnect()}getVolume(){return this.volume}setVolume(t){this.volume=t}};var i0=lo(n0()),o0=lo(wd()),Zr=class{constructor(t,r,n,i,o){this.blobs=[];this.paramsConfig={audioBehaviourParameters:{recordingBitrate:128,noiseLimit:40},imageBehaviourParameters:{useUploadImage:!0,uploadInterval:20,saveVideo:!0},videoBehaviourParameters:{detectPerson:!1,detectFace:!1,detectCellPhone:!1}};this.options={cameraId:void 0,microphoneId:void 0,onBufferSizeError:!1,onBufferSizeErrorCallback:t=>{},proctoringType:"IMAGE",onChangeDevicesCallback:t=>{},onRealtimeAlertsCallback:t=>{}};this.videoOptions={width:640,height:480,minWidth:0,minHeight:0};this.blobsRTC=[];this.imageCount=0;this.filesToUpload=[];this.animationFrameId=null;this.isCanvasLoopActive=!1;this.hardwareStream=null;this.internalClonedStream=null;this.videoElement=null;this.duration=0;this.currentRetries=0;this.packageCount=0;this.noiseWait=20;this.options=t,this.videoOptions=r,this.backend=i,this.backendToken=o,n&&(this.paramsConfig=n)}setProctoringId(t){this.proctoringId=t,this.proctoringId&&this.backend&&(this.upload=new Yr(this.proctoringId,this.backend)),Oa(t)}async initializeDetectors(){ig(),(this.paramsConfig.videoBehaviourParameters?.detectPerson||this.paramsConfig.videoBehaviourParameters?.detectCellPhone)&&(this.objectDetection=new Ma({onRealtimeAlertsCallback:t=>{t.begin=Date.now()-(this.getStartTime()?.getTime()||0),t.end=Date.now()-(this.getStartTime()?.getTime()||0),this.options.onRealtimeAlertsCallback(t)}},this.paramsConfig),await this.objectDetection.initializeDetector()),this.paramsConfig.videoBehaviourParameters?.detectFace&&(this.faceDetection=new Oi({onRealtimeAlertsCallback:t=>{t.begin=Date.now()-(this.getStartTime()?.getTime()||0),t.end=Date.now()-(this.getStartTime()?.getTime()||0),this.options.onRealtimeAlertsCallback(t)}},this.paramsConfig),await this.faceDetection.initializeDetector())}configImageCapture(){this.video=document.createElement("video"),this.canvas=document.createElement("canvas"),this.video.srcObject=this.cameraStream,this.video.play(),this.video.muted=!0,screen.orientation?.type.includes("portrait")&&Fr()?(console.log("configurando canvas em portrait"),this.canvas.width=this.videoOptions.height/2,this.canvas.height=this.videoOptions.width/2):(this.canvas.width=this.videoOptions.width/2,this.canvas.height=this.videoOptions.height/2)}async bufferError(t){console.log("buffer error Camera Recorder params ");let r=this.paramsConfig.videoBehaviourParameters?.retryEnabled||!1,n=this.paramsConfig.videoBehaviourParameters?.maxRetries||3;r&&this.currentRetries<n?(await this.recordingStop(),await this.startRecording(),this.currentRetries++,this.options.onBufferSizeErrorCallback&&this.options.onBufferSizeErrorCallback(this.cameraStream)):this.options.onBufferSizeErrorCallback&&this.options.onBufferSizeErrorCallback()}async startStream(){let{cameraId:t,microphoneId:r,onBufferSizeErrorCallback:n}=this.options,i={audio:{deviceId:r},video:{deviceId:t,width:this.videoOptions.width,height:this.videoOptions.height,frameRate:15}};try{this.hardwareStream=await navigator.mediaDevices.getUserMedia(i)}catch(h){throw h.toString()=="NotReadableError: Could not start video source"?"N\xE3o foi poss\xEDvel conectar a camera, ela pode estar sendo utilizada por outro programa":h}this.cameraStream=this.hardwareStream;let s=this.cameraStream.getVideoTracks()[0].getSettings(),{width:a=0,height:c=0}=s;if(screen.orientation?.type.includes("portrait")&&Fr()&&this.videoOptions.width==c&&this.videoOptions.height==a&&([a,c]=[c,a]),this.videoOptions.minWidth>a||this.videoOptions.minHeight>c)throw Jg;if(this.videoOptions.width!==a||this.videoOptions.height!==c)throw be.registerAnotherStream(this.proctoringId,`Maybe have another stream active
|
|
81
81
|
Video Options: ${JSON.stringify(this.videoOptions,null,2)}
|
|
82
|
-
Setting: ${JSON.stringify(s,null,2)}`),Xg}async stopStream(){this.cameraStream&&this.cameraStream.getTracks().forEach(t=>t.stop()),this.internalClonedStream&&(this.internalClonedStream.getTracks().forEach(t=>t.stop()),this.internalClonedStream=null),this.hardwareStream&&(this.hardwareStream.getTracks().forEach(t=>t.stop()),this.hardwareStream=null)}async waitForVideoFlow(){return new Promise(t=>{let r=()=>{if(this.videoElement&&this.videoElement?.readyState>=3)return t();requestAnimationFrame(r)};r()})}async attachAndWarmup(t){this.videoElement=document.createElement("video"),this.videoElement.srcObject=t,this.videoElement.muted=!0,await this.videoElement.play().catch(r=>{}),await new Promise(r=>{if(this.videoElement&&this.videoElement?.readyState>=1)return r();this.videoElement&&(this.videoElement.onloadedmetadata=()=>r())}),console.log("CameraRecorder checking metadata ok"),await this.waitForVideoFlow(),console.log("CameraRecorder waiting for video flow ok"),await new Promise(r=>setTimeout(r,300))}async startRecording(){console.log("CameraRecorder startRecording"),await this.startStream(),await this.attachAndWarmup(this.cameraStream);let{startRecording:t,stopRecording:r,pauseRecording:n,resumeRecording:i,recorderOptions:o,getBufferSize:s,getStartTime:a}=Vo(this.cameraStream,this.blobs,this.options.onBufferSizeError,c=>this.bufferError(c),!1);this.recordingStart=t,this.recordingStop=r,this.recordingPause=n,this.recordingResume=i,this.recorderOptions=o,this.getBufferSize=s,this.getStartTime=a;try{await new Promise(c=>setTimeout(c,500)),await this.recordingStart()}catch(c){console.log("Camera Recorder error",c),this.stopRecording();let l=this.paramsConfig.videoBehaviourParameters?.maxRetries||3;if(this.currentRetries<l)console.log("Camera Recorder retry",this.currentRetries),this.currentRetries++,await this.startRecording();else throw c}(this.paramsConfig.videoBehaviourParameters?.detectPerson||this.paramsConfig.videoBehaviourParameters?.detectCellPhone||this.paramsConfig.videoBehaviourParameters?.detectFace)&&await this.initializeDetectors(),this.paramsConfig.videoBehaviourParameters?.detectFace&&await this.faceDetection.enableCam(this.cameraStream),(this.paramsConfig.videoBehaviourParameters?.detectPerson||this.paramsConfig.videoBehaviourParameters?.detectCellPhone)&&await this.objectDetection.enableCam(this.cameraStream),this.filesToUpload=[],this.options.proctoringType=="REALTIME"&&await this.startRealtimeCapture(),this.packageCount=0,console.log("Camera Recorder started OK")}async stopRecording(){console.log("Camera Recorder stopRecording"),this.isCanvasLoopActive=!1,this.faceDetection&&this.faceDetection.detecting&&this.faceDetection.stopDetection(),this.objectDetection&&this.objectDetection.detecting&&this.objectDetection.stopDetection(),clearInterval(this.imageInterval),clearInterval(this.sendFrameInterval),this.volumeMeter&&this.volumeMeter.stop(),this.intervalNoiseDetection&&clearInterval(this.intervalNoiseDetection),this.recordingStop&&await this.recordingStop(),this.duration=Date.now()-this.getStartTime()?.getTime()||0;try{this.animationFrameId&&(cancelAnimationFrame(this.animationFrameId),this.animationFrameId=null),this.cameraStream&&this.cameraStream.getTracks().forEach(t=>t.stop()),this.internalClonedStream&&(this.internalClonedStream.getTracks().forEach(t=>t.stop()),this.internalClonedStream=null),this.hardwareStream&&(this.hardwareStream.getTracks().forEach(t=>t.stop()),this.hardwareStream=null),this.videoElement&&(this.videoElement?.remove(),this.videoElement=null),this.video&&this.video?.remove(),this.canvas&&this.canvas?.remove()}catch{console.error("Erro ao parar os streams de m\xEDdia.")}this.options.proctoringType=="REALTIME"&&this.upload&&this.backendToken&&(await this.sendPackage(this.filesToUpload),await this.filesToUpload.splice(0,this.filesToUpload.length))}async pauseRecording(){await this.recordingPause()}async resumeRecording(){await this.recordingResume()}async getCurrentImageBase64(){return!this.video||!this.canvas?this.configImageCapture():this.video.srcObject!==this.cameraStream&&(this.video.srcObject=this.cameraStream,await this.video.play()),this.video.paused&&await this.video.play(),await new Promise(t=>{if(this.video.readyState>=2){t();return}let r=()=>{this.video.removeEventListener("loadedmetadata",r),setTimeout(()=>t(),50)};this.video.addEventListener("loadedmetadata",r),setTimeout(()=>{this.video.removeEventListener("loadedmetadata",r),t()},500)}),this.canvas.getContext("2d").drawImage(this.video,0,0,this.canvas.width,this.canvas.height),this.canvas.toDataURL("image/jpeg")}async captureFrame(){let t,r=this.paramsConfig.videoBehaviourParameters?.realtimePackageSize;this.canvas.getContext("2d").drawImage(this.video,0,0,this.canvas.width,this.canvas.height);let n=this.canvas.toDataURL("image/jpeg");if(this.proctoringId==null)return;if(r==this.imageCount){this.imageCount=0;let o=[...this.filesToUpload];this.sendPackage(o),await this.filesToUpload.splice(0,this.filesToUpload.length)}let i=`${this.proctoringId}_${this.imageCount+1}.jpg`;t=await this.getFile(n,i,"image/jpeg"),t&&t.size>10&&r>0&&(this.filesToUpload.push(t),this.imageCount++)}async startRealtimeCapture(){this.configImageCapture(),this.imageCount=0,await this.captureFrame(),this.imageInterval=setInterval(async()=>{await this.captureFrame()},this.paramsConfig.videoBehaviourParameters?.realtimeCaptureInterval*1e3)}async sendPackage(t){let r=!1,n=0,i=this.paramsConfig.videoBehaviourParameters?.realtimePackageSize,o=this.paramsConfig.videoBehaviourParameters?.realtimeCaptureInterval;if(this.upload&&this.backendToken&&!r&&this.filesToUpload.length>0){n=0,r=!0;let s=new i0.default;for(let d of t)s.file(d.name,d);let a=await s.generateAsync({type:"blob"}),c="realtime_package_"+i*o*this.packageCount+".zip",l=new File([a],c,{type:"application/zip"});(await this.upload.uploadPackage({file:l},this.backendToken)).uploaded==!0?this.packageCount++:console.log("erro no upload do pacote"),r=!1}else if(r&&(n++,n==3)){n=0;let s=this.videoOptions.width/2,a=this.videoOptions.height/2;s<320&&(s=320),a<180&&(a=180),this.canvas.width=s,this.canvas.height=a}}download(t){let r=URL.createObjectURL(t),n=document.createElement("a");document.body.appendChild(n),n.style.display="none",n.href=r,n.download=t.name,n.click(),window.URL.revokeObjectURL(r)}async saveOnSession(t){this.blobs!=null&&be.registerSaveOnSession(this.proctoringId,`Blobs Length: ${this.blobs.length} Buffer Size: ${this.getBufferSize()} `);let r=this.cameraStream.getVideoTracks()[0].getSettings(),n=this.cameraStream.getAudioTracks()[0].getSettings();if(this.options.proctoringType=="VIDEO"||this.options.proctoringType=="REALTIME"||this.options.proctoringType=="IMAGE"&&this.paramsConfig.imageBehaviourParameters?.saveVideo){let i=new Blob(this.blobs,{type:this.recorderOptions?.mimeType||"video/webm"}),o=await(0,o0.default)(i,this.duration),s=new File([
|
|
82
|
+
Setting: ${JSON.stringify(s,null,2)}`),Xg}async stopStream(){this.cameraStream&&this.cameraStream.getTracks().forEach(t=>t.stop()),this.internalClonedStream&&(this.internalClonedStream.getTracks().forEach(t=>t.stop()),this.internalClonedStream=null),this.hardwareStream&&(this.hardwareStream.getTracks().forEach(t=>t.stop()),this.hardwareStream=null)}async waitForVideoFlow(){return new Promise(t=>{let r=()=>{if(this.videoElement&&this.videoElement?.readyState>=3)return t();requestAnimationFrame(r)};r()})}async attachAndWarmup(t){this.videoElement=document.createElement("video"),this.videoElement.srcObject=t,this.videoElement.muted=!0,await this.videoElement.play().catch(r=>{}),await new Promise(r=>{if(this.videoElement&&this.videoElement?.readyState>=1)return r();this.videoElement&&(this.videoElement.onloadedmetadata=()=>r())}),console.log("CameraRecorder checking metadata ok"),await this.waitForVideoFlow(),console.log("CameraRecorder waiting for video flow ok"),await new Promise(r=>setTimeout(r,300))}async startRecording(){console.log("CameraRecorder startRecording"),await this.startStream(),await this.attachAndWarmup(this.cameraStream);let{startRecording:t,stopRecording:r,pauseRecording:n,resumeRecording:i,recorderOptions:o,getBufferSize:s,getStartTime:a}=Vo(this.cameraStream,this.blobs,this.options.onBufferSizeError,c=>this.bufferError(c),!1);this.recordingStart=t,this.recordingStop=r,this.recordingPause=n,this.recordingResume=i,this.recorderOptions=o,this.getBufferSize=s,this.getStartTime=a;try{await new Promise(c=>setTimeout(c,500)),await this.recordingStart()}catch(c){console.log("Camera Recorder error",c),this.stopRecording();let l=this.paramsConfig.videoBehaviourParameters?.maxRetries||3;if(this.currentRetries<l)console.log("Camera Recorder retry",this.currentRetries),this.currentRetries++,await this.startRecording();else throw c}(this.paramsConfig.videoBehaviourParameters?.detectPerson||this.paramsConfig.videoBehaviourParameters?.detectCellPhone||this.paramsConfig.videoBehaviourParameters?.detectFace)&&await this.initializeDetectors(),this.paramsConfig.videoBehaviourParameters?.detectFace&&await this.faceDetection.enableCam(this.cameraStream),(this.paramsConfig.videoBehaviourParameters?.detectPerson||this.paramsConfig.videoBehaviourParameters?.detectCellPhone)&&await this.objectDetection.enableCam(this.cameraStream),this.filesToUpload=[],this.options.proctoringType=="REALTIME"&&await this.startRealtimeCapture(),this.packageCount=0,console.log("Camera Recorder started OK")}async stopRecording(){console.log("Camera Recorder stopRecording"),this.isCanvasLoopActive=!1,this.faceDetection&&this.faceDetection.detecting&&this.faceDetection.stopDetection(),this.objectDetection&&this.objectDetection.detecting&&this.objectDetection.stopDetection(),clearInterval(this.imageInterval),clearInterval(this.sendFrameInterval),this.volumeMeter&&this.volumeMeter.stop(),this.intervalNoiseDetection&&clearInterval(this.intervalNoiseDetection),this.recordingStop&&await this.recordingStop(),this.duration=Date.now()-this.getStartTime()?.getTime()||0;try{this.animationFrameId&&(cancelAnimationFrame(this.animationFrameId),this.animationFrameId=null),this.cameraStream&&this.cameraStream.getTracks().forEach(t=>t.stop()),this.internalClonedStream&&(this.internalClonedStream.getTracks().forEach(t=>t.stop()),this.internalClonedStream=null),this.hardwareStream&&(this.hardwareStream.getTracks().forEach(t=>t.stop()),this.hardwareStream=null),this.videoElement&&(this.videoElement?.remove(),this.videoElement=null),this.video&&this.video?.remove(),this.canvas&&this.canvas?.remove()}catch{console.error("Erro ao parar os streams de m\xEDdia.")}this.options.proctoringType=="REALTIME"&&this.upload&&this.backendToken&&(await this.sendPackage(this.filesToUpload),await this.filesToUpload.splice(0,this.filesToUpload.length))}async pauseRecording(){await this.recordingPause()}async resumeRecording(){await this.recordingResume()}async getCurrentImageBase64(){return!this.video||!this.canvas?this.configImageCapture():this.video.srcObject!==this.cameraStream&&(this.video.srcObject=this.cameraStream,await this.video.play()),this.video.paused&&await this.video.play(),await new Promise(t=>{if(this.video.readyState>=2){t();return}let r=()=>{this.video.removeEventListener("loadedmetadata",r),setTimeout(()=>t(),50)};this.video.addEventListener("loadedmetadata",r),setTimeout(()=>{this.video.removeEventListener("loadedmetadata",r),t()},500)}),this.canvas.getContext("2d").drawImage(this.video,0,0,this.canvas.width,this.canvas.height),this.canvas.toDataURL("image/jpeg")}async captureFrame(){let t,r=this.paramsConfig.videoBehaviourParameters?.realtimePackageSize;this.canvas.getContext("2d").drawImage(this.video,0,0,this.canvas.width,this.canvas.height);let n=this.canvas.toDataURL("image/jpeg");if(this.proctoringId==null)return;if(r==this.imageCount){this.imageCount=0;let o=[...this.filesToUpload];this.sendPackage(o),await this.filesToUpload.splice(0,this.filesToUpload.length)}let i=`${this.proctoringId}_${this.imageCount+1}.jpg`;t=await this.getFile(n,i,"image/jpeg"),t&&t.size>10&&r>0&&(this.filesToUpload.push(t),this.imageCount++)}async startRealtimeCapture(){this.configImageCapture(),this.imageCount=0,await this.captureFrame(),this.imageInterval=setInterval(async()=>{await this.captureFrame()},this.paramsConfig.videoBehaviourParameters?.realtimeCaptureInterval*1e3)}async sendPackage(t){let r=!1,n=0,i=this.paramsConfig.videoBehaviourParameters?.realtimePackageSize,o=this.paramsConfig.videoBehaviourParameters?.realtimeCaptureInterval;if(this.upload&&this.backendToken&&!r&&this.filesToUpload.length>0){n=0,r=!0;let s=new i0.default;for(let d of t)s.file(d.name,d);let a=await s.generateAsync({type:"blob"}),c="realtime_package_"+i*o*this.packageCount+".zip",l=new File([a],c,{type:"application/zip"});(await this.upload.uploadPackage({file:l},this.backendToken)).uploaded==!0?this.packageCount++:console.log("erro no upload do pacote"),r=!1}else if(r&&(n++,n==3)){n=0;let s=this.videoOptions.width/2,a=this.videoOptions.height/2;s<320&&(s=320),a<180&&(a=180),this.canvas.width=s,this.canvas.height=a}}download(t){let r=URL.createObjectURL(t),n=document.createElement("a");document.body.appendChild(n),n.style.display="none",n.href=r,n.download=t.name,n.click(),window.URL.revokeObjectURL(r)}async saveOnSession(t){this.blobs!=null&&be.registerSaveOnSession(this.proctoringId,`Blobs Length: ${this.blobs.length} Buffer Size: ${this.getBufferSize()} `);let r=this.cameraStream.getVideoTracks()[0].getSettings(),n=this.cameraStream.getAudioTracks()[0].getSettings();if(this.options.proctoringType=="VIDEO"||this.options.proctoringType=="REALTIME"||this.options.proctoringType=="IMAGE"&&this.paramsConfig.imageBehaviourParameters?.saveVideo){let i=new Blob(this.blobs,{type:this.recorderOptions?.mimeType||"video/webm"}),o=await(0,o0.default)(i,this.duration),s=new File([i],`EP_${t.id}_camera_0.webm`,{type:i.type});t.addRecording({device:`Audio
|
|
83
83
|
Sample Rate: ${n.sampleRate}
|
|
84
84
|
Sample Size: ${n.sampleSize}
|
|
85
85
|
|