(window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["chunk-fe968d28","chunk-4e73c2e5"],{"1ffa":function(e,t,a){},"2b6b":function(e,t,a){"use strict";a("b99c")},"2bc9":function(e,t,a){"use strict";a("1ffa")},"585d":function(e,t,a){e.exports=a.p+"img/rg_verso.c3ab9031.png"},"6a1f":function(e,t,a){"use strict";a("75a0")},"75a0":function(e,t,a){},"78a1":function(e,t,a){"use strict";a("e9cd")},"7fef":function(e,t,a){e.exports=a.p+"img/rg_frente.3ddffe7d.png"},8032:function(e,t,a){e.exports=a.p+"img/selfie_instruction.960b562f.png"},"81d5":function(e,t,a){"use strict";var n=a("7b0b"),r=a("23cb"),i=a("07fa");e.exports=function(e){var t=n(this),a=i(t),o=arguments.length,s=r(o>1?arguments[1]:void 0,a),c=o>2?arguments[2]:void 0,d=void 0===c?a:r(c,a);while(d>s)t[s++]=e;return t}},a548:function(e,t,a){"use strict";a.d(t,"a",(function(){return c}));var n=a("d4ec"),r=a("bee2"),i=a("8f33"),o=a("262e"),s=(a("99af"),a("c0e9")),c=function(e){function t(){return Object(n["a"])(this,t),Object(i["a"])(this,t,arguments)}return Object(o["a"])(t,e),Object(r["a"])(t,[{key:"existsDocument",value:function(e){return this.get("types/".concat(e,"/exists"))}},{key:"getQrCodeDataToUploadDocument",value:function(e){return this.get("types/".concat(e,"/qrcode"))}},{key:"uploadDocument",value:function(e,t,a){return this.post("types/".concat(e,"/").concat(t,"/upload"),{document:a})}}],[{key:"build",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null;return new this(this.resource,null,e)}}])}(s["a"]);c.resource="/api/v1/document_persons"},acc8:function(e,t,a){"use strict";a.r(t);var n=function(){var e=this,t=e._self._c;return t("div",[e.shouldShowDocumentCapture?t("DocumentCapture",{key:e.captureKey,attrs:{isFront:e.isFront,photoAccepted:e.handlePhotoAccepted}}):e._e(),e.shouldShowSelfCapture?t("SelfCapture",{key:e.captureSelfKey,on:{selfieCaptured:e.selfieCaptured}}):e._e(),e.showDocumentCaptureFinished?t("DocumentCaptureFinished"):e._e()],1)},r=[],i=a("c7eb"),o=a("1da1"),s=(a("14d9"),function(){var e=this,t=e._self._c;return t("div",{ref:"cameraContainer",staticClass:"camera-view"},[t("vs-popup",{attrs:{active:e.showHelpModal,title:"Instruções","button-close-hidden":!0},on:{"update:active":function(t){e.showHelpModal=t}}},[t("div",{staticClass:"text-center"},[t("img",{staticClass:"mx-auto",staticStyle:{"max-width":"90px"},attrs:{src:e.getImageSrc,alt:"document"}}),t("h2",{staticClass:"text-lg font-semibold mb-2"},[e._v(e._s(e.isFront?"Documento Frente":"Documento Verso"))]),e.showPortraitWarning?t("p",{staticClass:"text-danger font-semibold mb-1"},[e._v("A captura de documento deve ser feita em modo paisagem.")]):e._e(),t("p",{staticClass:"text-gray-600 mb-4"},[e._v("Posicione o documento em uma mesa, centralize-o na marcação e realize a captura da foto.")]),t("vs-button",{staticClass:"px-4 py-2",attrs:{color:"success"},on:{click:function(t){e.showHelpModal=!1}}},[e._v(" OK, entendi ")])],1)]),t("vs-popup",{ref:"popupWarning",attrs:{active:e.showPortraitWarning,title:"Atenção","button-close-hidden":!0}},[t("div",{staticClass:"text-center"},[t("p",{staticClass:"text-gray-600 mb-4"},[e._v("A captura de documento deve ser feita em modo paisagem. Por favor, vire o dispositivo.")])])]),e.capturedImage&&!e.showPortraitWarning?t("div",{staticClass:"preview grid grid-cols-3 gap-4"},[t("div",{staticClass:"col-span-2"},[t("img",{staticClass:"mx-auto",staticStyle:{"max-width":"100%"},attrs:{src:e.capturedImage,alt:"captured document"}})]),t("div",{staticClass:"flex flex-col justify-center items-center"},[t("p",{staticClass:"text-gray-600 mb-4"},[e._v("A foto está legível?")]),t("vs-button",{staticClass:"px-4 py-2",attrs:{color:"success"},on:{click:e.acceptPhoto}},[e._v(" Sim, prosseguir ")]),t("vs-button",{staticClass:"px-4 py-2 mt-2",attrs:{color:"danger"},on:{click:e.retryPhoto}},[e._v(" Não, tentar novamente ")])],1)]):e._e(),t("video",{directives:[{name:"show",rawName:"v-show",value:!e.capturedImage&&!e.showPortraitWarning,expression:"!capturedImage && !showPortraitWarning"}],ref:"video",staticClass:"video",attrs:{autoplay:"",playsinline:""}}),t("canvas",{directives:[{name:"show",rawName:"v-show",value:!e.capturedImage&&!e.showPortraitWarning,expression:"!capturedImage && !showPortraitWarning"}],ref:"overlay",staticClass:"overlay"}),t("vs-button",{directives:[{name:"show",rawName:"v-show",value:!e.capturedImage&&!e.showPortraitWarning,expression:"!capturedImage && !showPortraitWarning"}],staticClass:"capture-button",attrs:{color:"primary",icon:"camera"},on:{click:e.capturePhoto}})],1)}),c=[],d=(a("b0c0"),a("d3b7"),a("159b"),{props:{isFront:{type:Boolean,default:!0},photoAccepted:{type:Function,default:null}},data:function(){return{showHelpModal:!0,showPortraitWarning:!1,capturedImage:null,rectWidth:null,rectHeight:null,rectX:null,rectY:null,videoStream:null}},computed:{getImageSrc:function(){return this.isFront?a("7fef"):a("585d")}},mounted:function(){this.startCamera(),window.addEventListener("resize",this.handleOrientationChange),document.addEventListener("click",this.handleClickPopup),this.handleOrientationChange()},beforeDestroy:function(){document.removeEventListener("click",this.handleClickPopup)},methods:{startCamera:function(){var e=this;return Object(o["a"])(Object(i["a"])().mark((function t(){var a,n;return Object(i["a"])().wrap((function(t){while(1)switch(t.prev=t.next){case 0:return t.prev=0,a={video:{facingMode:"environment",width:{ideal:1280},height:{ideal:720}}},t.next=4,navigator.mediaDevices.getUserMedia(a);case 4:n=t.sent,e.$refs.video.srcObject=n,e.videoStream=n,e.drawOverlay(),t.next=14;break;case 10:t.prev=10,t.t0=t["catch"](0),console.error("Error accessing the camera: ",t.t0),"NotAllowedError"===t.t0.name?alert("Permissões de câmera ou microfone negadas. Verifique as permissões no navegador."):"NotFoundError"===t.t0.name?alert("Dispositivo de câmera não encontrado."):alert("Erro ao acessar a câmera. Por favor, tente novamente.");case 14:case"end":return t.stop()}}),t,null,[[0,10]])})))()},handleOrientationChange:function(){var e=window.innerHeight>window.innerWidth,t=this.$refs.cameraContainer,a=this.$refs.video,n=this.$refs.overlay;this.isPortrait=e,this.rectWidth=.8*window.innerWidth,this.rectHeight=.7*window.innerHeight,this.rectX=(window.innerWidth-this.rectWidth)/4,this.rectY=(window.innerHeight-this.rectHeight)/2,e?this.showPortraitWarning=!0:(this.showPortraitWarning=!1,t&&(t.style.width="100%",t.style.height="100%"),a&&(a.style.transform="rotate(0deg)",a.style.height="auto"),n&&(n.width=window.innerWidth,n.height=window.innerHeight))},drawOverlay:function(){var e=this,t=this.$refs.overlay,a=t.getContext("2d"),n=function(){a.clearRect(0,0,t.width,t.height),e.drawDocumentFrame(a,t.width,t.height),requestAnimationFrame(n)};n()},drawDocumentFrame:function(e,t,a){if(!this.isPortrait){e.strokeStyle="green",e.lineWidth=2,e.setLineDash([5,5]),e.strokeRect(this.rectX,this.rectY,this.rectWidth,this.rectHeight);var n=this.isFront?"Frente do documento":"Verso do documento";e.font="25px Arial",e.textAlign="center",e.fillStyle="white";var r=e.measureText(n).width,i=25;e.fillStyle="rgba(0, 0, 0, 0.6)",e.fillRect(t/2.5-r/2-10,this.rectY-i-20,r+20,i+20),e.fillStyle="white",e.fillText(n,t/2.5,this.rectY-10)}},capturePhoto:function(){var e=this.$refs.video,t=document.createElement("canvas"),a=t.getContext("2d");t.width=this.rectWidth,t.height=this.rectHeight;var n=e.videoWidth,r=e.videoHeight,i=n/window.innerWidth,o=r/window.innerHeight,s=this.rectX*i,c=this.rectY*o,d=this.rectWidth*i,u=this.rectHeight*o;a.drawImage(e,s,c,d,u,0,0,this.rectWidth,this.rectHeight);var l=t.toDataURL("image/png");this.capturedImage=l},acceptPhoto:function(){var e=this;this.videoStream&&this.videoStream.getTracks().forEach((function(e){return e.stop()})),this.photoAccepted(this.capturedImage,(function(){}),(function(){e.instructionText="Não foi possível enviar os documentos, tente novamente.",e.uploadErrorFlag=!0})),this.capturedImage=null},retryPhoto:function(){this.capturedImage=null,this.startCamera()},checkPermissions:function(){return Object(o["a"])(Object(i["a"])().mark((function e(){var t;return Object(i["a"])().wrap((function(e){while(1)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,navigator.permissions.query({name:"camera"});case 3:return t=e.sent,e.next=6,navigator.permissions.query({name:"microphone"});case 6:if(e.sent,"granted"===t.state){e.next=10;break}return alert("Permissões para acessar câmera ou microfone não concedidas. Por favor, autorize o uso."),e.abrupt("return",!1);case 10:return e.abrupt("return",!0);case 13:return e.prev=13,e.t0=e["catch"](0),console.error("Erro ao verificar permissões: ",e.t0),e.abrupt("return",!1);case 17:case"end":return e.stop()}}),e,null,[[0,13]])})))()},handleClickPopup:function(e){this.$refs.popupWarning.$el;this.showPortraitWarning&&e.stopPropagation()}}}),u=d,l=(a("2bc9"),a("2877")),h=Object(l["a"])(u,s,c,!1,null,"747c55ec",null),p=h.exports,v=function(){var e=this,t=e._self._c;return t("div",{ref:"cameraContainer",staticClass:"camera-view"},[t("vs-popup",{attrs:{active:e.showHelpModal,title:"Instruções","button-close-hidden":!0},on:{"update:active":function(t){e.showHelpModal=t}}},[t("div",{staticClass:"text-center"},[t("h2",{staticClass:"text-lg font-semibold mb-2"},[e._v(e._s(e.titleInstruction))]),t("img",{staticClass:"mx-auto",staticStyle:{"max-width":"90px"},attrs:{src:a("8032"),alt:"document"}}),e.showLandscapeWarning?t("p",{staticClass:"text-danger font-semibold mb-1"},[e._v("A captura deve ser feita em modo retrato.")]):e._e(),t("p",{staticClass:"text-gray-600 mb-4"},[e._v("Coloque seu rosto dentro da área oval.")]),t("vs-button",{staticClass:"px-4 py-2",attrs:{color:"success"},on:{click:function(t){e.showHelpModal=!1}}},[e._v(" OK, entendi ")])],1)]),t("vs-popup",{ref:"popupWarning",attrs:{active:e.showLandscapeWarning,color:"danger",title:"Atenção","button-close-hidden":!0,"click-outside":!1},on:{close:e.handleClosePopup}},[t("div",{staticClass:"text-center"},[t("p",{staticClass:"text-gray-600 mb-4"},[e._v("A captura deve ser feita em modo retrato. Por favor, vire o dispositivo.")])])]),t("video",{directives:[{name:"show",rawName:"v-show",value:!e.capturedVideo&&!e.showLandscapeWarning,expression:"!capturedVideo && !showLandscapeWarning"}],ref:"video",staticClass:"video",attrs:{autoplay:"",playsinline:""}}),t("canvas",{directives:[{name:"show",rawName:"v-show",value:!e.capturedVideo&&!e.showLandscapeWarning,expression:"!capturedVideo && !showLandscapeWarning"}],ref:"overlay",staticClass:"overlay"}),t("p",{directives:[{name:"show",rawName:"v-show",value:!e.capturedVideo&&!e.showLandscapeWarning,expression:"!capturedVideo && !showLandscapeWarning"}],staticClass:"instructions"},[e._v(e._s(e.instructionText))]),t("vs-button",{directives:[{name:"show",rawName:"v-show",value:!e.capturedVideo&&!e.showLandscapeWarning,expression:"!capturedVideo && !showLandscapeWarning"}],staticClass:"capture-button",attrs:{disabled:!e.canCapture,color:"primary",icon:"camera"},on:{click:e.captureSelfie}},[e._v(e._s(e.buttonText))])],1)},m=[],f=(a("cb29"),{props:{videoRecorded:{type:Function,default:null},retryUpload:{type:Function,default:null},type:{type:String,default:null}},data:function(){return{showHelpModal:!0,showLandscapeWarning:!1,capturedVideo:null,videoStream:null,mediaRecorder:null,recordedChunks:[],ovalWidth:null,ovalHeight:null,ovalX:null,ovalY:null,instructionText:"Encaixe o seu rosto na área oval abaixo",detectionActive:!0,borderColor:"white",canCapture:!0,buttonText:"Ok",uploadErrorFlag:!1}},computed:{titleInstruction:function(){return"Self (Foto da Face)"}},mounted:function(){this.startCamera(),window.addEventListener("resize",this.handleOrientationChange),document.addEventListener("click",this.handleClickPopup),this.handleOrientationChange()},beforeDestroy:function(){document.removeEventListener("click",this.handleClickPopup)},methods:{startCamera:function(){var e=this;return Object(o["a"])(Object(i["a"])().mark((function t(){var a,n;return Object(i["a"])().wrap((function(t){while(1)switch(t.prev=t.next){case 0:return t.prev=0,a={audio:!1,video:{width:{ideal:720},height:{ideal:1280},facingMode:"user"}},t.next=4,navigator.mediaDevices.getUserMedia(a);case 4:n=t.sent,e.$refs.video.srcObject=n,e.videoStream=n,e.drawOverlay(),t.next=14;break;case 10:t.prev=10,t.t0=t["catch"](0),console.error("Error accessing the camera: ",t.t0),"NotAllowedError"===t.t0.name?alert("Permissões de câmera ou microfone negadas. Verifique as permissões no navegador."):"NotFoundError"===t.t0.name?alert("Dispositivo de câmera não encontrado."):alert("Erro ao acessar a câmera. Por favor, tente novamente.");case 14:case"end":return t.stop()}}),t,null,[[0,10]])})))()},handleOrientationChange:function(){var e=window.innerWidth>window.innerHeight;this.isLandscape=e,e?this.showLandscapeWarning=!0:(this.ovalWidth=.8*window.innerWidth,this.ovalHeight=.6*window.innerHeight,this.ovalX=(window.innerWidth-this.ovalWidth)/2,this.ovalY=(window.innerHeight-this.ovalHeight)/2,this.showLandscapeWarning=!1,this.drawOverlay())},drawOverlay:function(){var e=this.$refs.overlay;if(e&&!this.isLandscape){var t=e.getContext("2d");e.width=window.innerWidth,e.height=window.innerHeight,t.clearRect(0,0,e.width,e.height),t.fillStyle="rgba(0, 0, 0, 0.5)",t.fillRect(0,0,e.width,e.height),t.globalCompositeOperation="destination-out",t.beginPath(),t.ellipse(this.ovalX+this.ovalWidth/2,this.ovalY+this.ovalHeight/2,this.ovalWidth/2,this.ovalHeight/2,0,0,2*Math.PI),t.fill(),t.globalCompositeOperation="source-over",t.strokeStyle=this.borderColor,t.lineWidth=4,t.setLineDash([5,5]),t.stroke();var a=this.ovalX+this.ovalWidth/2,n=this.ovalY+this.ovalHeight/2;t.strokeStyle="white",t.lineWidth=2,t.setLineDash([]),t.beginPath(),t.moveTo(a,n-10),t.lineTo(a,n+10),t.stroke(),t.beginPath(),t.moveTo(a-10,n),t.lineTo(a+10,n),t.stroke()}},captureSelfie:function(e,t){var a=document.createElement("canvas"),n=a.getContext("2d"),r=this.$refs.video;a.width=r.videoWidth,a.height=r.videoHeight,n.drawImage(r,0,0,a.width,a.height);var i=a.toDataURL("image/png");this.$emit("selfieCaptured",i,e,t)},checkPermissions:function(){return Object(o["a"])(Object(i["a"])().mark((function e(){var t;return Object(i["a"])().wrap((function(e){while(1)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,navigator.permissions.query({name:"camera"});case 3:return t=e.sent,e.next=6,navigator.permissions.query({name:"microphone"});case 6:if(e.sent,"granted"===t.state){e.next=10;break}return alert("Permissões para acessar câmera ou microfone não concedidas. Por favor, autorize o uso."),e.abrupt("return",!1);case 10:return e.abrupt("return",!0);case 13:return e.prev=13,e.t0=e["catch"](0),console.error("Erro ao verificar permissões: ",e.t0),e.abrupt("return",!1);case 17:case"end":return e.stop()}}),e,null,[[0,13]])})))()},handleClickPopup:function(e){this.$refs.popupWarning.$el;this.showLandscapeWarning&&e.stopPropagation()},handleClosePopup:function(){}}}),g=f,w=(a("2b6b"),Object(l["a"])(g,v,m,!1,null,"25226092",null)),b=w.exports,C=function(){var e=this,t=e._self._c;return t("div",{ref:"cameraContainer",staticClass:"camera-view"},[t("vs-popup",{attrs:{active:e.showHelpModal,title:"Instruções"},on:{"update:active":function(t){e.showHelpModal=t}}},[t("div",{staticClass:"text-center"},[t("h2",{staticClass:"text-lg font-semibold mb-2"},[e._v(e._s(e.titleInstruction))]),t("img",{staticClass:"mx-auto",staticStyle:{"max-width":"90px"},attrs:{src:a("8032"),alt:"document"}}),t("p",{staticClass:"text-gray-600 mb-4"},[e._v("Coloque seu rosto dentro da área oval.")]),t("vs-button",{staticClass:"px-4 py-2",attrs:{color:"success"},on:{click:function(t){e.showHelpModal=!1}}},[e._v(" OK, entendi ")])],1)]),t("vs-popup",{attrs:{active:e.showLandscapeWarning,title:"Atenção","button-close-hidden":!0},on:{"update:active":function(t){e.showLandscapeWarning=t}}},[t("div",{staticClass:"text-center"},[t("p",{staticClass:"text-gray-600 mb-4"},[e._v("A captura deve ser feita em modo retrato. Por favor, vire o dispositivo.")])])]),t("video",{directives:[{name:"show",rawName:"v-show",value:!e.capturedVideo&&!e.showLandscapeWarning,expression:"!capturedVideo && !showLandscapeWarning"}],ref:"video",staticClass:"video",attrs:{autoplay:"",playsinline:""}}),t("canvas",{directives:[{name:"show",rawName:"v-show",value:!e.capturedVideo&&!e.showLandscapeWarning,expression:"!capturedVideo && !showLandscapeWarning"}],ref:"overlay",staticClass:"overlay"}),t("p",{directives:[{name:"show",rawName:"v-show",value:!e.capturedVideo&&!e.showLandscapeWarning,expression:"!capturedVideo && !showLandscapeWarning"}],staticClass:"instructions"},[e._v(e._s(e.instructionText))]),t("vs-button",{directives:[{name:"show",rawName:"v-show",value:!e.capturedVideo&&!e.showLandscapeWarning,expression:"!capturedVideo && !showLandscapeWarning"}],staticClass:"capture-button",attrs:{disabled:!e.canCapture,color:"primary",icon:"camera"},on:{click:e.nextInstruction}},[e._v(e._s(e.buttonText))])],1)},x=[],y={props:{videoRecorded:{type:Function,default:null},retryUpload:{type:Function,default:null},type:{type:String,default:null}},data:function(){return{showHelpModal:!0,showLandscapeWarning:!1,capturedVideo:null,videoStream:null,mediaRecorder:null,recordedChunks:[],ovalWidth:null,ovalHeight:null,ovalX:null,ovalY:null,instructionText:"Encaixe o seu rosto na área oval abaixo",currentInstructionIndex:-1,detectionActive:!0,borderColor:"white",canCapture:!0,instructions:["Olhe para a esquerda","Olhe para a direita","Olhe para cima","Olhe para baixo"],buttonText:"Ok",uploadErrorFlag:!1}},computed:{titleInstruction:function(){return!this.type||"both"!==this.type&&"liveness-video"!==this.type?"Self (Foto da Face)":"Prova de Vida"}},mounted:function(){this.startCamera(),window.addEventListener("resize",this.handleOrientationChange),this.handleOrientationChange()},methods:{startCamera:function(){var e=this;return Object(o["a"])(Object(i["a"])().mark((function t(){var a,n;return Object(i["a"])().wrap((function(t){while(1)switch(t.prev=t.next){case 0:return t.prev=0,a={audio:!1,video:{width:{ideal:720},height:{ideal:1280},facingMode:"user"}},t.next=4,navigator.mediaDevices.getUserMedia(a);case 4:n=t.sent,e.$refs.video.srcObject=n,e.videoStream=n,e.drawOverlay(),t.next=14;break;case 10:t.prev=10,t.t0=t["catch"](0),console.error("Error accessing the camera: ",t.t0),"NotAllowedError"===t.t0.name?alert("Permissões de câmera ou microfone negadas. Verifique as permissões no navegador."):"NotFoundError"===t.t0.name?alert("Dispositivo de câmera não encontrado."):alert("Erro ao acessar a câmera. Por favor, tente novamente.");case 14:case"end":return t.stop()}}),t,null,[[0,10]])})))()},handleOrientationChange:function(){var e=window.innerWidth>window.innerHeight;this.isLandscape=e,this.ovalWidth=.8*window.innerWidth,this.ovalHeight=.6*window.innerHeight,this.ovalX=(window.innerWidth-this.ovalWidth)/2,this.ovalY=(window.innerHeight-this.ovalHeight)/2,e?this.showLandscapeWarning=!0:(this.showLandscapeWarning=!1,this.drawOverlay())},drawOverlay:function(){var e=this.$refs.overlay,t=e.getContext("2d");e.width=window.innerWidth,e.height=window.innerHeight,t.clearRect(0,0,e.width,e.height),t.fillStyle="rgba(0, 0, 0, 0.5)",t.fillRect(0,0,e.width,e.height),t.globalCompositeOperation="destination-out",t.beginPath(),t.ellipse(this.ovalX+this.ovalWidth/2,this.ovalY+this.ovalHeight/2,this.ovalWidth/2,this.ovalHeight/2,0,0,2*Math.PI),t.fill(),t.globalCompositeOperation="source-over",t.strokeStyle=this.borderColor,t.lineWidth=4,t.setLineDash([5,5]),t.stroke()},captureVideo:function(){this.mediaRecorder&&"inactive"!==this.mediaRecorder.state&&this.mediaRecorder.stop()},acceptVideo:function(){this.videoStream&&this.videoStream.getTracks().forEach((function(e){return e.stop()})),this.$emit("videoAccepted",this.capturedVideo),this.capturedVideo=null},retryVideo:function(){this.capturedVideo=null,this.startCamera()},setupMediaRecorder:function(e){var t=this;this.mediaRecorder=new MediaRecorder(e),this.mediaRecorder.ondataavailable=function(e){e.data.size>0&&t.recordedChunks.push(e.data)},this.mediaRecorder.onstop=Object(o["a"])(Object(i["a"])().mark((function e(){var a,n;return Object(i["a"])().wrap((function(e){while(1)switch(e.prev=e.next){case 0:a=new Blob(t.recordedChunks,{type:"video/webm"}),n=new FileReader,n.onloadend=Object(o["a"])(Object(i["a"])().mark((function e(){var a;return Object(i["a"])().wrap((function(e){while(1)switch(e.prev=e.next){case 0:a=n.result,t.videoRecorded(a,(function(){t.incrementInstructionIndex()}),(function(){t.instructionText="Não foi possível enviar os documentos e vídeo da prova de vida, tente novamente.",t.uploadErrorFlag=!0}));case 2:case"end":return e.stop()}}),e)}))),n.readAsDataURL(a);case 4:case"end":return e.stop()}}),e)}))),this.mediaRecorder.start(),this.captureSelfie()},captureSelfie:function(e,t){var a=document.createElement("canvas"),n=a.getContext("2d"),r=this.$refs.video;a.width=r.videoWidth,a.height=r.videoHeight,n.drawImage(r,0,0,a.width,a.height);var i=a.toDataURL("image/png");this.$emit("selfieCaptured",i,e,t)},nextInstruction:function(){var e=this;return Object(o["a"])(Object(i["a"])().mark((function t(){return Object(i["a"])().wrap((function(t){while(1)switch(t.prev=t.next){case 0:if("doc-photo"!==e.type){t.next=3;break}return e.captureSelfie((function(){}),(function(){e.instructionText="Não foi possível enviar os documentos e a self (foto do face), tente novamente.",e.uploadErrorFlag=!0})),t.abrupt("return");case 3:if(!(e.currentInstructionIndex<e.instructions.length)){t.next=12;break}if(3!==e.currentInstructionIndex||!e.uploadErrorFlag){t.next=7;break}return e.retryUpload((function(){e.incrementInstructionIndex()}),(function(){e.uploadErrorFlag=!0})),t.abrupt("return");case 7:if(3!==e.currentInstructionIndex||e.uploadErrorFlag){t.next=10;break}return e.captureVideo(),t.abrupt("return");case 10:-1===e.currentInstructionIndex&&e.setupMediaRecorder(e.videoStream),e.incrementInstructionIndex();case 12:case"end":return t.stop()}}),t)})))()},incrementInstructionIndex:function(){this.currentInstructionIndex++,this.instructionText=this.instructions[this.currentInstructionIndex],this.buttonText=this.currentInstructionIndex===this.instructions.length-1?"Finalizar":"Avançar"},checkPermissions:function(){return Object(o["a"])(Object(i["a"])().mark((function e(){var t;return Object(i["a"])().wrap((function(e){while(1)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,navigator.permissions.query({name:"camera"});case 3:return t=e.sent,e.next=6,navigator.permissions.query({name:"microphone"});case 6:if(e.sent,"granted"===t.state){e.next=10;break}return alert("Permissões para acessar câmera ou microfone não concedidas. Por favor, autorize o uso."),e.abrupt("return",!1);case 10:return e.abrupt("return",!0);case 13:return e.prev=13,e.t0=e["catch"](0),console.error("Erro ao verificar permissões: ",e.t0),e.abrupt("return",!1);case 17:case"end":return e.stop()}}),e,null,[[0,13]])})))()}}},W=y,k=(a("78a1"),Object(l["a"])(W,C,x,!1,null,"25874ab8",null)),O=k.exports,_=a("fbb7"),P=a("a548"),I={components:{DocumentCapture:p,SelfCapture:b,LifeProofCapture:O,DocumentCaptureFinished:_["default"]},props:{type:{type:String,default:"both"},token:{type:String,default:""}},data:function(){return{key:0,document:{photo_front:"",photo_back:"",photo_face:"",video:""},service:{service:null},isFront:!0,captureSelfKey:0,captureKey:0,documentCompleted:!1,selfCompleted:!1,liveProofCompleted:!1,videoUploadError:!1}},computed:{shouldShowDocumentCapture:function(){return("both"===this.type||"doc-photo"===this.type)&&!this.documentCompleted},shouldShowSelfCapture:function(){return("both"===this.type||"doc-photo"===this.type)&&this.documentCompleted&&!this.selfCompleted},shouldShowLifeProofCapture:function(){return("both"===this.type||"liveness-video"===this.type)&&!this.liveProofCompleted},showDocumentCaptureFinished:function(){return"both"===this.type||"liveness-video"===this.type?this.documentCompleted&&this.selfCompleted&&this.liveProofCompleted:"doc-photo"===this.type&&(this.documentCompleted&&this.selfCompleted)}},methods:{sendDocument:function(e,t){var a=this;return Object(o["a"])(Object(i["a"])().mark((function e(){return Object(i["a"])().wrap((function(e){while(1)switch(e.prev=e.next){case 0:return a.$vs.loading(),e.prev=1,e.next=4,a.service.uploadDocument(a.type,a.token,a.document);case 4:a.$vs.loading.close(),"both"!==a.type&&"doc-photo"!==a.type||(a.documentCompleted=!0,a.selfCompleted=!0),"both"!==a.type&&"liveness-video"!==a.type||(a.liveProofCompleted=!0),e.next=17;break;case 9:e.prev=9,e.t0=e["catch"](1),a.$vs.loading.close(),a.videoUploadError=!0,a.documentCompleted=!1,a.selfCompleted=!1,a.clearData(),a.notifyError(a.$vs,a.$t("document_person.send_doc_error"),5e3,"top-center");case 17:case"end":return e.stop()}}),e,null,[[1,9]])})))()},clearData:function(){this.document.photo_front=null,this.document.photo_back=null,this.isFront=!0,this.document.photo_face=null,this.document.video=null},handlePhotoAccepted:function(e,t,a){this.isFront?(this.document.photo_front=e,this.isFront=!1):this.document.photo_back=e,this.document.photo_front&&this.document.photo_back&&(this.documentCompleted=!0),this.captureKey+=1},handleLifeProofAccepted:function(e){},videoRecorded:function(e,t,a){this.document.video=e,"both"!==this.type&&"liveness-video"!==this.type||this.sendDocument(t,a)},selfieCaptured:function(e,t,a){this.document.photo_face=e,this.document.photo_face&&this.sendDocument(t,a)},retryUpload:function(e,t){var a=this;return Object(o["a"])(Object(i["a"])().mark((function n(){return Object(i["a"])().wrap((function(n){while(1)switch(n.prev=n.next){case 0:if(!a.videoUploadError){n.next=4;break}return a.videoUploadError=!1,n.next=4,a.sendDocument(e,t);case 4:case"end":return n.stop()}}),n)})))()},completeOnboarding:function(){this.$router.push("/document_capture_finished")}},beforeMount:function(){this.service=P["a"].build(this.$vs)}},S=I,L=Object(l["a"])(S,n,r,!1,null,null,null);t["default"]=L.exports},b99c:function(e,t,a){},cb29:function(e,t,a){"use strict";var n=a("23e7"),r=a("81d5"),i=a("44d2");n({target:"Array",proto:!0},{fill:r}),i("fill")},e9cd:function(e,t,a){},fbb7:function(e,t,a){"use strict";a.r(t);var n=function(){var e=this;e._self._c;return e._m(0)},r=[function(){var e=this,t=e._self._c;return t("div",{staticClass:"finished-onboarding"},[t("div",{staticClass:"message-container"},[t("h2",[e._v("Processo finalizado!")]),t("p",[e._v("O processo de captura e envio da documentação foi enviado e está sendo analisado.")]),t("p",[e._v("Agora aguarde as instruções da página que acesso o QRCode.")])])])}],i={methods:{}},o=i,s=(a("6a1f"),a("2877")),c=Object(s["a"])(o,n,r,!1,null,"33962ee4",null);t["default"]=c.exports}}]);