1var Me=Object.defineProperty;var Ne=(v,i,e)=>i in v?Me(v,i,{enumerable:!0,configurable:!0,writable:!0,value:e}):v[i]=e;var E=(v,i,e)=>(Ne(v,typeof i!="symbol"?i+"":i,e),e);import{j as t}from"./ui-916dc9d9.js";import{t as he,w as ke,u as Te,F as Y,N as Ue,B as F,aq as J,I as De,ar as K,as as Ae,a0 as Le,P as We,at as Oe,au as $,av as Q,aw as Fe,ax as Ie,x as ze,ay as Re}from"./index-b93ebc97.js";import{r as y,d as $e,g as Ve}from"./vendor-aea060b0.js";import{p as I,a as le,D as Be,b as ce}from"./pdf-viewer-9b371a90.js";import{I as Ge}from"./IconCircleCheck-f8f43b13.js";import"./motion-b076d11a.js";var ue={exports:{}};(function(v,i){(function(s,a){v.exports=a(y)})($e,function(e){return function(s){var a={};function l(r){if(a[r])return a[r].exports;var h=a[r]={i:r,l:!1,exports:{}};return s[r].call(h.exports,h,h.exports,l),h.l=!0,h.exports}return l.m=s,l.c=a,l.d=function(r,h,m){l.o(r,h)||Object.defineProperty(r,h,{enumerable:!0,get:m})},l.r=function(r){typeof Symbol<"u"&&Symbol.toStringTag&&Object.defineProperty(r,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(r,"__esModule",{value:!0})},l.t=function(r,h){if(h&1&&(r=l(r)),h&8||h&4&&typeof r=="object"&&r&&r.__esModule)return r;var m=Object.create(null);if(l.r(m),Object.defineProperty(m,"default",{enumerable:!0,value:r}),h&2&&typeof r!="string")for(var x in r)l.d(m,x,(function(g){return r[g]}).bind(null,x));return m},l.n=function(r){var h=r&&r.__esModule?function(){return r.default}:function(){return r};return l.d(h,"a",h),h},l.o=function(r,h){return Object.prototype.hasOwnProperty.call(r,h)},l.p="",l(l.s="./src/react-webcam.tsx")}({
1"./src/react-webcam.tsx":function(s,a,l){l.r(a);var r=l("react"),h=function(){var _=function(f,n){return _=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(o,c){o.__proto__=c}||function(o,c){for(var u in c)c.hasOwnProperty(u)&&(o[u]=c[u])},_(f,n)};return function(f,n){_(f,n);function o(){this.constructor=f}f.prototype=n===null?Object.create(n):(o.prototype=n.prototype,new o)}}(),m=function(){return m=Object.assign||function(_){for(var f,n=1,o=arguments.length;n<o;n++){f=arguments[n];for(var c in f)Object.prototype.hasOwnProperty.call(f,c)&&(_[c]=f[c])}return _},m.apply(this,arguments)},x=function(_,f){var n={};for(var o in _)Object.prototype.hasOwnProperty.call(_,o)&&f.indexOf(o)<0&&(n[o]=_[o]);if(_!=null&&typeof Object.getOwnPropertySymbols=="function")for(var c=0,o=Object.getOwnPropertySymbols(_);c<o.length;c++)f.indexOf(o[c])<0&&Object.prototype.propertyIsEnumerable.call(_,o[c])&&(n[o[c]]=_[o[c]]);return n};(function(){typeof window>"u"||(navigator.mediaDevices===void 0&&(navigator.mediaDevices={}),navigator.mediaDevices.getUserMedia===void 0&&(navigator.mediaDevices.getUserMedia=function(f){var n=navigator.getUserMedia||navigator.webkitGetUserMedia||navigator.mozGetUserMedia||navigator.msGetUserMedia;return n?new Promise(function(o,c){n.call(navigator,f,o,c)}):Promise.reject(new Error("getUserMedia is not implemented in this browser"))}))})();function g(){return!!(navigator.mediaDevices&&navigator.mediaDevices.getUserMedia)}var S=function(_){h(f,_);function f(n){var o=_.call(this,n)||this;return o.canvas=null,o.ctx=null,o.requestUserMediaId=0,o.unmounted=!1,o.state={hasUserMedia:!1},o}return f.prototype.componentDidMount=function(){var n=this,o=n.state,c=n.props;if(this.unmounted=!1,!g()){c.onUserMediaError("getUserMedia not supported");return}o.hasUserMedia||this.requestUserMedia(),c.children&&typeof c.children!="function"&&console.warn("children must be a function")},f.prototype.componentDidUpdate=function(n){var o=this.props;if(!g()){o.onUserMediaError("getUserMedia not supported");return}var c=JSON.stringify(n.audioConstraints)!==JSON.stringify(o.audioConstraints),u=JSON.stringify(n.videoConstraints)!==JSON.stringify(o.videoConstraints),b=n.minScreenshotWidth!==o.minScreenshotWidth,j=n.minScreenshotHeight!==o.minScreenshotHeight;(u||b||j)&&(this.canvas=null,this.ctx=null),(c||u)&&(this.stopAndCleanup(),this.requestUserMedia())},f.prototype.componentWillUnmount=function(){this.unmounted=!0,this.stopAndCleanup()},f.stopMediaStream=function(n){n&&(n.getVideoTracks&&n.getAudioTracks?(n.getVideoTracks().map(function(o){n.removeTrack(o),o.stop()}),n.getAudioTracks().map(function(o){n.removeTrack(o),o.stop()})):n.stop())},f.prototype.stopAndCleanup=function(){var n=this.state;n.hasUserMedia&&(f.stopMediaStream(this.stream),n.src&&window.URL.revokeObjectURL(n.src))},f.prototype.getScreenshot=function(n){var o=this,c=o.state,u=o.props;if(!c.hasUserMedia)return null;var b=this.getCanvas(n);return b&&b.toDataURL(u.screenshotFormat,u.screenshotQuality)},f.prototype.getCanvas=function(n){var o=this,c=o.state,u=o.props;if(!this.video||!c.hasUserMedia||!this.video.videoHeight)return null;if(!this.ctx){var b=this.video.videoWidth,j=this.video.videoHeight;if(!this.props.forceScreenshotSourceSize){var p=b/j;b=u.minScreenshotWidth||this.video.clientWidth,j=b/p,u.minScreenshotHeight&&j<u.minScreenshotHeight&&(j=u.minScreenshotHeight,b=j*p)}this.canvas=document.createElement("canvas"),this.canvas.width=(n==null?void 0:n.width)||b,this.canvas.height=(n==null?void 0:n.height)||j,this.ctx=this.canvas.getContext("2d")}var d=this,P=d.ctx,C=d.canvas;return P&&C&&(C.width=(n==null?void 0:n.width)||C.width,C.height=(n==null?void 0:n.height)||C.height,u.mirrored&&(P.translate(C.width,0),P.scale(-1,1)),P.imageSmoothingEnabled=u.imageSmoothing,P.drawImage(this.video,0,0,(n==null?void 0:n.width)||C.width,(n==null?void 0:n.height)||C.height),u.mirrored&&(P.scale(-1,1),P.translate(-C.width,0))),C},f.prototype.requestUserMedia=function(){var n=this,o=this.props,c=function(j,p){var d={video:typeof p<"u"?p:!0};o.audio&&(d.audio=typeof j<"u"?j:!0),n.requestUserMediaId++;var P=n.requestUserMediaId;navigator.mediaDevices.getUserMedia(d).then(function(C){n.unmounted||P!==n.requestUserMediaId?f.stopMediaStream(C):n.handleUserMedia(null,C)}).catch(function(C){n.handleUserMedia(C)})};if("mediaDevices"in navigator)c(o.audioConstraints,o.videoConstraints);else{var u=function(j){return{optional:[{sourceId:j}]}},b=function(j){var p=j.deviceId;return typeof p=="string"?p:Array.isArray(p)&&p.length>0?p[0]:typeof p=="object"&&p.ideal?p.ideal:null};MediaStreamTrack.getSources(function(j){var p=null,d=null;
1j.forEach(function(T){T.kind==="audio"?p=T.id:T.kind==="video"&&(d=T.id)});var P=b(o.audioConstraints);P&&(p=P);var C=b(o.videoConstraints);C&&(d=C),c(u(p),u(d))})}},f.prototype.handleUserMedia=function(n,o){var c=this.props;if(n||!o){this.setState({hasUserMedia:!1}),c.onUserMediaError(n);return}this.stream=o;try{this.video&&(this.video.srcObject=o),this.setState({hasUserMedia:!0})}catch{this.setState({hasUserMedia:!0,src:window.URL.createObjectURL(o)})}c.onUserMedia(o)},f.prototype.render=function(){var n=this,o=this,c=o.state,u=o.props,b=u.audio;u.forceScreenshotSourceSize;var j=u.disablePictureInPicture;u.onUserMedia,u.onUserMediaError,u.screenshotFormat,u.screenshotQuality,u.minScreenshotWidth,u.minScreenshotHeight,u.audioConstraints,u.videoConstraints,u.imageSmoothing;var p=u.mirrored,d=u.style,P=d===void 0?{}:d,C=u.children,T=x(u,["audio","forceScreenshotSourceSize","disablePictureInPicture","onUserMedia","onUserMediaError","screenshotFormat","screenshotQuality","minScreenshotWidth","minScreenshotHeight","audioConstraints","videoConstraints","imageSmoothing","mirrored","style","children"]),N=p?m(m({},P),{transform:(P.transform||"")+" scaleX(-1)"}):P,D={getScreenshot:this.getScreenshot.bind(this)};return r.createElement(r.Fragment,null,r.createElement("video",m({autoPlay:!0,disablePictureInPicture:j,src:c.src,muted:!b,playsInline:!0,ref:function(L){n.video=L},style:N},T)),C&&C(D))},f.defaultProps={audio:!1,disablePictureInPicture:!1,forceScreenshotSourceSize:!1,imageSmoothing:!0,mirrored:!1,onUserMedia:function(){},onUserMediaError:function(){},screenshotFormat:"image/webp",screenshotQuality:.92},f}(r.Component);a.default=S}
vendor: 11,674 bytes, lines 1-4
1,react:function(s,a){s.exports=e}}).default})})(ue);var qe=ue.exports;const He=Ve(qe);/*! 2 * Signature Pad v5.1.2 | https://github.com/szimek/signature_pad 3 * (c) 2025 Szymon Nowak | Released under the MIT license 4 */var B=class{constructor(v,i,e,s){E(this,"x");E(this,"y");E(this,"pressure");E(this,"time");if(isNaN(v)||isNaN(i))throw new Error(`Point is invalid: (${v}, ${i})`);this.x=+v,this.y=+i,this.pressure=e||0,this.time=s||Date.now()}distanceTo(v){return Math.sqrt(Math.pow(this.x-v.x,2)+Math.pow(this.y-v.y,2))}equals(v){return this.x===v.x&&this.y===v.y&&this.pressure===v.pressure&&this.time===v.time}velocityFrom(v){return this.time!==v.time?this.distanceTo(v)/(this.time-v.time):0}},Xe=class me{constructor(i,e,s,a,l,r){this.startPoint=i,this.control2=e,this.control1=s,this.endPoint=a,this.startWidth=l,this.endWidth=r}static fromPoints(i,e){const s=this.calculateControlPoints(i[0],i[1],i[2]).c2,a=this.calculateControlPoints(i[1],i[2],i[3]).c1;return new me(i[1],s,a,i[2],e.start,e.end)}static calculateControlPoints(i,e,s){const a=i.x-e.x,l=i.y-e.y,r=e.x-s.x,h=e.y-s.y,m={x:(i.x+e.x)/2,y:(i.y+e.y)/2},x={x:(e.x+s.x)/2,y:(e.y+s.y)/2},g=Math.sqrt(a*a+l*l),S=Math.sqrt(r*r+h*h),_=m.x-x.x,f=m.y-x.y,n=g+S==0?0:S/(g+S),o={x:x.x+_*n,y:x.y+f*n},c=e.x-o.x,u=e.y-o.y;return{c1:new B(m.x+c,m.y+u),c2:new B(x.x+c,x.y+u)}}length(){let e=0,s,a;for(let l=0;l<=10;l+=1){const r=l/10,h=this.point(r,this.startPoint.x,this.control1.x,this.control2.x,this.endPoint.x),m=this.point(r,this.startPoint.y,this.control1.y,this.control2.y,this.endPoint.y);if(l>0){const x=h-s,g=m-a;e+=Math.sqrt(x*x+g*g)}s=h,a=m}return e}point(i,e,s,a,l){return e*(1-i)*(1-i)*(1-i)+3*s*(1-i)*(1-i)*i+3*a*(1-i)*i*i+l*i*i*i}},Je=class{constructor(){E(this,"_et");try{this._et=new EventTarget}catch{this._et=document}}addEventListener(v,i,e){this._et.addEventListener(v,i,e)}dispatchEvent(v){return this._et.dispatchEvent(v)}removeEventListener(v,i,e){this._et.removeEventListener(v,i,e)}};function Ke(v,i=250){let e=0,s=null,a,l,r;const h=()=>{e=Date.now(),s=null,a=v.apply(l,r),s||(l=null,r=[])};return function(...x){const g=Date.now(),S=i-(g-e);return l=this,r=x,S<=0||S>i?(s&&(clearTimeout(s),s=null),e=g,a=v.apply(l,r),s||(l=null,r=[])):s||(s=window.setTimeout(h,S)),a}}var Qe=class Z extends Je{constructor(e,s={}){super();E(this,"dotSize");E(this,"minWidth");E(this,"maxWidth");E(this,"penColor");E(this,"minDistance");E(this,"velocityFilterWeight");E(this,"compositeOperation");E(this,"backgroundColor");E(this,"throttle");E(this,"canvasContextOptions");E(this,"_ctx");E(this,"_drawingStroke",!1);E(this,"_isEmpty",!0);E(this,"_dataUrl");E(this,"_dataUrlOptions");E(this,"_lastPoints",[]);E(this,"_data",[]);E(this,"_lastVelocity",0);E(this,"_lastWidth",0);E(this,"_strokeMoveUpdate");E(this,"_strokePointerId");this.canvas=e,this.velocityFilterWeight=s.velocityFilterWeight||.7,this.minWidth=s.minWidth||.5,this.maxWidth=s.maxWidth||2.5,this.throttle=s.throttle??16,this.minDistance=s.minDistance??5,this.dotSize=s.dotSize||0,this.penColor=s.penColor||"black",this.backgroundColor=s.backgroundColor||"rgba(0,0,0,0)",this.compositeOperation=s.compositeOperation||"source-over",this.canvasContextOptions=s.canvasContextOptions??{},this._strokeMoveUpdate=this.throttle?Ke(Z.prototype._strokeUpdate,this.throttle):Z.prototype._strokeUpdate,this._handleMouseDown=this._handleMouseDown.bind(this),this._handleMouseMove=this._handleMouseMove.bind(this),this._handleMouseUp=this._handleMouseUp.bind(this),this._handleTouchStart=this._handleTouchStart.bind(this),this._handleTouchMove=this._handleTouchMove.bind(this),this._handleTouchEnd=this._handleTouchEnd.bind(this),this._handlePointerDown=this._handlePointerDown.bind(this),this._handlePointerMove=this._handlePointerMove.bind(this),this._handlePointerUp=this._handlePointerUp.bind(this),this._handlePointerCancel=this._handlePointerCancel.bind(this),this._handleTouchCancel=this._handleTouchCancel.bind(this),this._ctx=e.getContext("2d",this.canvasContextOptions),this.clear(),this.on()}clear(){const{_ctx:e,canvas:s}=this;e.fillStyle=this.backgroundColor,e.clearRect(0,0,s.width,s.height),e.fillRect(0,0,s.width,s.height),this._data=[],this._reset(this._getPointGroupOptions()),this._isEmpty=!0,this._dataUrl=void 0,this._dataUrlOptions=void 0,this._strokePointerId=void 0}redraw(){const e=this._data,s=this._dataUrl,a=this._dataUrlOptions;this.clear(),s&&this.fromDataURL(s,a),this.fromData(e,{clear:!1})}fromDataURL(e,s={}){return new Promise((a,l)=>{const r=new Image,h=s.ratio||window.devicePixelRatio||1,m=s.width||this.canvas.width/h,x=s.height||this.canvas.height/h,g=s.xOffset||0,S=s.yOffset||0;this._reset(this._getPointGroupOptions()),r.onload=()=>{this._ctx.drawImage(r,g,S,m,x),a()},r.onerror=_=>{l(_)},r.crossOrigin="anonymous",r.src=e,this._isEmpty=!1,this._dataUrl=e,this._dataUrlOptions={...s}})}toDataURL(e="image/png",s){switch(e){case"image/svg+xml":return typeof s!="object"&&(s=void 0),`data:image/svg+xml;base64,${btoa(this.toSVG(s))}`;default:return typeof s!="number"&&(s=void 0),this.canvas.toDataURL(e,s)}}on(){this.canvas.style.touchAction="none",this.canvas.style.msTouchAction="none",this.canvas.style.userSelect="none";const e=/Macintosh/.test(navigator.userAgent)&&"ontouchstart"in document;window.PointerEvent&&!e?this._handlePointerEvents():(this._handleMouseEvents(),"ontouchstart"in window&&this._handleTouchEvents())}off(){this.canvas.style.touchAction="auto",this.canvas.style.msTouchAction="auto",this.canvas.style.userSelect="auto",this.canvas.removeEventListener("pointerdown",this._handlePointerDown),this.canvas.removeEventListener("mousedown",this._handleMouseDown),this.canvas.removeEventListener("touchstart",this._handleTouchStart),this._removeMoveUpEventListeners()}_getListenerFunctions(){const e=window.document===this.canvas.ownerDocument?window:this.canvas.ownerDocument.defaultView??this.canvas.ownerDocument;return{addEventListener:e.addEventListener.bind(e),removeEventListener:e.removeEventListener.bind(e)}}_removeMoveUpEventListeners(){const{removeEventListener:e}=this._getListenerFunctions();e("pointermove",this._handlePointerMove),e("pointerup",this._handlePointerUp),e("pointercancel",this._handlePointerCancel),e("mousemove",this._handleMouseMove),e("mouseup",this._handleMouseUp),e("touchmove",this._handleTouchMove),e("touchend",this._handleTouchEnd),e("touchcancel",this._handleTouchCancel)}isEmpty(){return this._isEmpty}fromData(e,{clear:s=!0}={}){s&&this.clear(),this._fromData(e,this._drawCurve.bind(this),this._drawDot.bind(this)),this._data=this._data.concat(e)}toData(){return this._data}_isLeftButtonPressed(e,s){return s?e.buttons===1:(e.buttons&1)===1}_pointerEventToSignatureEvent(e){return{event:e,type:e.type,x:e.clientX,y:e.clientY,pressure:"pressure"in e?e.pressure:0}}_touchEventToSignatureEvent(e){const s=e.changedTouches[0];return{event:e,type:e.type,x:s.clientX,y:s.clientY,pressure:s.force}}_handleMouseDown(e){!this._isLeftButtonPressed(e,!0)||this._drawingStroke||this._strokeBegin(this._pointerEventToSignatureEvent(e))}_handleMouseMove(e){if(!this._isLeftButtonPressed(e,!0)||!this._drawingStroke){this._strokeEnd(this._pointerEventToSignatureEvent(e),!1);return}this._strokeMoveUpdate(this._pointerEventToSignatureEvent(e))}_handleMouseUp(e){this._isLeftButtonPressed(e)||this._strokeEnd(this._pointerEventToSignatureEvent(e))}_handleTouchStart(e){e.targetTouches.length!==1||this._drawingStroke||(e.cancelable&&e.preventDefault(),this._strokeBegin(this._touchEventToSignatureEvent(e)))}_handleTouchMove(e){if(e.targetTouches.length===1){if(e.cancelable&&e.preventDefault(),!this._drawingStroke){this._strokeEnd(this._touchEventToSignatureEvent(e),!1);return}this._strokeMoveUpdate(this._touchEventToSignatureEvent(e))}}_handleTouchEnd(e){e.targetTouches.length===0&&(e.cancelable&&e.preventDefault(),this._strokeEnd(this._touchEventToSignatureEvent(e)))}_handlePointerCancel(e){this._allowPointerId(e)&&(e.preventDefault(),this._strokeEnd(this._pointerEventToSignatureEvent(e),!1))}_handleTouchCancel(e){e.cancelable&&e.preventDefault(),this._strokeEnd(this._touchEventToSignatureEvent(e),!1)}_getPointerId(e){return e.persistentDeviceId||e.pointerId}_allowPointerId(e,s=!1){return typeof this._strokePointerId>"u"?s:this._getPointerId(e)===this._strokePointerId}_handlePointerDown(e){this._drawingStroke||!this._isLeftButtonPressed(e)||!this._allowPointerId(e,!0)||(this._strokePointerId=this._getPointerId(e),e.preventDefault(),this._strokeBegin(this._pointerEventToSignatureEvent(e)))}_handlePointerMove(e){if(this._allowPointerId(e)){if(!this._isLeftButtonPressed(e,!0)||!this._drawingStroke){this._strokeEnd(this._pointerEventToSignatureEvent(e),!1);return}e.preventDefault(),this._strokeMoveUpdate(this._pointerEventToSignatureEvent(e))}}_handlePointerUp(e){this._isLeftButtonPressed(e)||!this._allowPointerId(e)||(e.preventDefault(),this._strokeEnd(this._pointerEventToSignatureEvent(e)))}_getPointGroupOptions(e){return{penColor:e&&"penColor"in e?e.penColor:this.penColor,dotSize:e&&"dotSize"in e?e.dotSize:this.dotSize,minWidth:e&&"minWidth"in e?e.minWidth:this.minWidth,maxWidth:e&&"maxWidth"in e?e.maxWidth:this.maxWidth,velocityFilterWeight:e&&"velocityFilterWeight"in e?e.velocityFilterWeight:this.velocityFilterWeight,compositeOperation:e&&"compositeOperation"in e?e.compositeOperation:this.compositeOperation}}_strokeBegin(e){if(!this.dispatchEvent(new CustomEvent("beginStroke",{detail:e,cancelable:!0})))return;const{addEventListener:a}=this._getListenerFunctions();switch(e.event.type){case"mousedown":a("mousemove",this._handleMouseMove,{passive:!1}),a("mouseup",this._handleMouseUp,{passive:!1});break;case"touchstart":a("touchmove",this._handleTouchMove,{passive:!1}),a("touchend",this._handleTouchEnd,{passive:!1}),a("touchcancel",this._handleTouchCancel,{passive:!1});break;case"pointerdown":a("pointermove",this._handlePointerMove,{passive:!1}),a("pointerup",this._handlePointerUp,{passive:!1}),a("pointercancel",this._handlePointerCancel,{passive:!1});break}this._drawingStroke=!0;const l=this._getPointGroupOptions(),r={...l,points:[]};this._data.push(r),this._reset(l),this._strokeUpdate(e)}_strokeUpdate(e){if(!this._drawingStroke)return;if(this._data.length===0){this._strokeBegin(e);return}this.dispatchEvent(new CustomEvent("beforeUpdateStroke",{detail:e}));const s=this._createPoint(e.x,e.y,e.pressure),a=this._data[this._data.length-1],l=a.points,r=l.length>0&&l[l.length-1],h=r?s.distanceTo(r)<=this.minDistance:!1,m=this._getPointGroupOptions(a);if(!r||!(r&&h)){const x=this._addPoint(s,m);r?x&&this._drawCurve(x,m):this._drawDot(s,m),l.push({time:s.time,x:s.x,y:s.y,pressure:s.pressure})}this.dispatchEvent(new CustomEvent("afterUpdateStroke",{detail:e}))}_strokeEnd(e,s=!0){this._removeMoveUpEventListeners(),this._drawingStroke&&(s&&this._strokeUpdate(e),this._drawingStroke=!1,this._strokePointerId=void 0,this.dispatchEvent(new CustomEvent("endStroke",{detail:e})))}_handlePointerEvents(){this._drawingStroke=!1,this.canvas.addEventListener("pointerdown",this._handlePointerDown,{passive:!1})}_handleMouseEvents(){this._drawingStroke=!1,this.canvas.addEventListener("mousedown",this._handleMouseDown,{passive:!1})}_handleTouchEvents(){this.canvas.addEventListener("touchstart",this._handleTouchStart,{passive:!1})}_reset(e){this._lastPoints=[],this._lastVelocity=0,this._lastWidth=(e.minWidth+e.maxWidth)/2,this._ctx.fillStyle=e.penColor,this._ctx.globalCompositeOperation=e.compositeOperation}_createPoint(e,s,a){const l=this.canvas.getBoundingClientRect();return new B(e-l.left,s-l.top,a,new Date().getTime())}_addPoint(e,s){const{_lastPoints:a}=this;if(a.push(e),a.length>2){a.length===3&&a.unshift(a[0]);
4const l=this._calculateCurveWidths(a[1],a[2],s),r=Xe.fromPoints(a,l);return a.shift(),r}return null}_calculateCurveWidths(e,s,a){const l=a.velocityFilterWeight*s.velocityFrom(e)+(1-a.velocityFilterWeight)*this._lastVelocity,r=this._strokeWidth(l,a),h={end:r,start:this._lastWidth};return this._lastVelocity=l,this._lastWidth=r,h}_strokeWidth(e,s){return Math.max(s.maxWidth/(e+1),s.minWidth)}_drawCurveSegment(e,s,a){const l=this._ctx;l.moveTo(e,s),l.arc(e,s,a,0,2*Math.PI,!1),this._isEmpty=!1}_drawCurve(e,s){const a=this._ctx,l=e.endWidth-e.startWidth,r=Math.ceil(e.length())*2;a.beginPath(),a.fillStyle=s.penColor;for(let h=0;h<r;h+=1){const m=h/r,x=m*m,g=x*m,S=1-m,_=S*S,f=_*S;let n=f*e.startPoint.x;n+=3*_*m*e.control1.x,n+=3*S*x*e.control2.x,n+=g*e.endPoint.x;let o=f*e.startPoint.y;o+=3*_*m*e.control1.y,o+=3*S*x*e.control2.y,o+=g*e.endPoint.y;const c=Math.min(e.startWidth+g*l,s.maxWidth);this._drawCurveSegment(n,o,c)}a.closePath(),a.fill()}_drawDot(e,s){const a=this._ctx,l=s.dotSize>0?s.dotSize:(s.minWidth+s.maxWidth)/2;a.beginPath(),this._drawCurveSegment(e.x,e.y,l),a.closePath(),a.fillStyle=s.penColor,a.fill()}_fromData(e,s,a){for(const l of e){const{points:r}=l,h=this._getPointGroupOptions(l);if(r.length>1)for(let m=0;m<r.length;m+=1){const x=r[m],g=new B(x.x,x.y,x.pressure,x.time);m===0&&this._reset(h);const S=this._addPoint(g,h);S&&s(S,h)}else this._reset(h),a(r[0],h)}}toSVG({includeBackgroundColor:e=!1,includeDataUrl:s=!1}={}){var S,_,f,n,o;const a=this._data,l=Math.max(window.devicePixelRatio||1,1),r=0,h=0,m=this.canvas.width/l,x=this.canvas.height/l,g=document.createElementNS("http://www.w3.org/2000/svg","svg");if(g.setAttribute("xmlns","http://www.w3.org/2000/svg"),g.setAttribute("xmlns:xlink","http://www.w3.org/1999/xlink"),g.setAttribute("viewBox",`${r} ${h} ${m} ${x}`),g.setAttribute("width",m.toString()),g.setAttribute("height",x.toString()),e&&this.backgroundColor){const c=document.createElement("rect");c.setAttribute("width","100%"),c.setAttribute("height","100%"),c.setAttribute("fill",this.backgroundColor),g.appendChild(c)}if(s&&this._dataUrl){const c=((S=this._dataUrlOptions)==null?void 0:S.ratio)||window.devicePixelRatio||1,u=((_=this._dataUrlOptions)==null?void 0:_.width)||this.canvas.width/c,b=((f=this._dataUrlOptions)==null?void 0:f.height)||this.canvas.height/c,j=((n=this._dataUrlOptions)==null?void 0:n.xOffset)||0,p=((o=this._dataUrlOptions)==null?void 0:o.yOffset)||0,d=document.createElement("image");d.setAttribute("x",j.toString()),d.setAttribute("y",p.toString()),d.setAttribute("width",u.toString()),d.setAttribute("height",b.toString()),d.setAttribute("preserveAspectRatio","none"),d.setAttribute("href",this._dataUrl),g.appendChild(d)}return this._fromData(a,(c,{penColor:u})=>{const b=document.createElement("path");if(!isNaN(c.control1.x)&&!isNaN(c.control1.y)&&!isNaN(c.control2.x)&&!isNaN(c.control2.y)){const j=`M ${c.startPoint.x.toFixed(3)},${c.startPoint.y.toFixed(3)} C ${c.control1.x.toFixed(3)},${c.control1.y.toFixed(3)} ${c.control2.x.toFixed(3)},${c.control2.y.toFixed(3)} ${c.endPoint.x.toFixed(3)},${c.endPoint.y.toFixed(3)}`;b.setAttribute("d",j),b.setAttribute("stroke-width",(c.endWidth*2.25).toFixed(3)),b.setAttribute("stroke",u),b.setAttribute("fill","none"),b.setAttribute("stroke-linecap","round"),g.appendChild(b)}},(c,{penColor:u,dotSize:b,minWidth:j,maxWidth:p})=>{const d=document.createElement("circle"),P=b>0?b:(j+p)/2;d.setAttribute("r",P.toString()),d.setAttribute("cx",c.x.toString()),d.setAttribute("cy",c.y.toString()),d.setAttribute("fill",u),g.appendChild(d)}),g.outerHTML}};function Ye(v,i,e){var s=e||{},a=s.noTrailing,l=a===void 0?!1:a,r=s.noLeading,h=r===void 0?!1:r,m=s.debounceMode,x=m===void 0?void 0:m,g,S=!1,_=0;function f(){g&&clearTimeout(g)}function n(c){var u=c||{},b=u.upcomingOnly,j=b===void 0?!1:b;f(),S=!j}function o(){for(var c=arguments.length,u=new Array(c),b=0;b<c;b++)u[b]=arguments[b];var j=this,p=Date.now()-_;if(S)return;function d(){_=Date.now(),i.apply(j,u)}function P(){g=void 0}!h&&x&&!g&&d(),f(),x===void 0&&p>v?h?(_=Date.now(),l||(g=setTimeout(x?P:d,v))):d():l!==!0&&(g=setTimeout(x?P:d,x===void 0?v-p:v))}return o.cancel=n,o}
4function Ze(v,i,e){var s=e||{},a=s.atBegin,l=a===void 0?!1:a;return Ye(v,i,{debounceMode:l!==!1})}class V extends y.PureComponent{constructor(i){super(i),Object.defineProperty(this,"canvasRef",{enumerable:!0,configurable:!0,writable:!0,value:y.createRef()}),Object.defineProperty(this,"signaturePad",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"callResizeHandler",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.state={canvasWidth:0,canvasHeight:0},this.callResizeHandler=Ze(this.props.debounceInterval,this.handleResize.bind(this))}componentDidMount(){const i=this.canvasRef.current;i&&(this.props.width&&this.props.height||(i.style.width="100%",window.addEventListener("resize",this.callResizeHandler)),this.signaturePad=new Qe(i,this.props.options),this.scaleCanvas(i))}componentWillUnmount(){this.props.width&&this.props.height||window.removeEventListener("resize",this.callResizeHandler),this.signaturePad.off()}get instance(){return this.signaturePad}get canvas(){return this.canvasRef}set dotSize(i){this.signaturePad.dotSize=i}get dotSize(){return this.signaturePad.dotSize}set minWidth(i){this.signaturePad.minWidth=i}get minWidth(){return this.signaturePad.minWidth}set maxWidth(i){this.signaturePad.maxWidth=i}get maxWidth(){return this.signaturePad.maxWidth}set throttle(i){this.signaturePad.throttle=i}get throttle(){return this.signaturePad.throttle}set backgroundColor(i){this.signaturePad.backgroundColor=i}get backgroundColor(){return this.signaturePad.backgroundColor}
4set penColor(i){this.signaturePad.penColor=i}get penColor(){return this.signaturePad.penColor}set velocityFilterWeight(i){this.signaturePad.velocityFilterWeight=i}get velocityFilterWeight(){return this.signaturePad.velocityFilterWeight}isEmpty(){return this.signaturePad.isEmpty()}clear(){this.signaturePad.clear()}redraw(){this.signaturePad.redraw()}fromDataURL(i,e={}){this.signaturePad.fromDataURL(i,e)}toDataURL(i,e){return this.signaturePad.toDataURL(i,e)}toSvgDataUrl(i){return this.signaturePad.toDataURL("image/svg+xml",i)}toSVG(i){return this.signaturePad.toSVG(i)}fromData(i){this.signaturePad.fromData(i)}toData(){return this.signaturePad.toData()}off(){this.signaturePad.off()}on(){this.signaturePad.on()}handleResize(){const i=this.canvasRef.current;i&&this.scaleCanvas(i)}scaleCanvas(i){const e=Math.max(window.devicePixelRatio||1,1),s=(this.props.width||i.offsetWidth)*e,a=(this.props.height||i.offsetHeight)*e,{canvasWidth:l,canvasHeight:r}=this.state;if(s===l&&a===r)return;i.width=s,i.height=a,this.setState({canvasWidth:s,canvasHeight:a});const h=i.getContext("2d");h&&h.scale(e,e),this.props.redrawOnResize&&this.signaturePad&&this.redraw()}render(){const{canvasProps:i}=this.props;return y.createElement("canvas",Object.assign({"data-testid":"canvas-element",ref:this.canvasRef},i))}}Object.defineProperty(V,"displayName",{enumerable:!0,configurable:!0,writable:!0,value:"react-signature-pad-wrapper"}),Object.defineProperty(V,"propTypes",{enumerable:!0,configurable:!0,writable:!0,value:{width:I.number,height:I.number,options:I.object,canvasProps:I.object,redrawOnResize:I.bool,debounceInterval:I.number}}),Object.defineProperty(V,"defaultProps",{enumerable:!0,configurable:!0,writable:!0,value:{redrawOnResize:!1,debounceInterval:150}});function et({open:v,setOpen:i,aditionalClasses:e="max-w-[440px] p-4 lg:p-6 overflow-y-auto",document:s}){var oe;const[a,l]=y.useState(!1),[r,h]=y.useState(!1),[m,x]=y.useState(!1),[g,S]=y.useState(!1),[_,f]=y.useState(!1),[n,o]=y.useState(!1),[c,u]=y.useState(!1),[b,j]=y.useState(!1),[p,d]=y.useState(0),[P,C]=y.useState(""),[T,N]=y.useState(""),[D,L]=y.useState(!1),[W,z]=y.useState(!1),{isLargeScreen:ee}=he(),te=ke(),fe=Te(),[O,G]=y.useState(""),A=y.useRef(null),pe=()=>
4{s!=null&&s.pendingSignatureMethods||d(12),R(s==null?void 0:s.pendingSignatureMethods)},q=()=>{var w;i(!1),(s==null?void 0:s.signatureType)===2?(A!=null&&A.current&&((w=A.current)==null||w.clear()),d(15)):d(1)};function R(w){if(N(""),L(!1),(w==null?void 0:w.length)>0)switch(w[0]){case 2:d(2);break;case 1:d(6);break;case 3:d(11);break;case 4:d(14);break;default:d(9);break}else return fe(Oe(!0)),d(9)}const ge=()=>{l(!0),$(s.id,{selfie:P}).then(w=>{var M;R((M=w.data)==null?void 0:M.pendingSignatureMethods),l(!1)}).catch(()=>{d(7),l(!1)})},xe=()=>{x(!0),Q(s.id,1).then(()=>{d(8),x(!1)}).catch(()=>{d(7),x(!1)})},ve=()=>{S(!0),Q(s.id,3).then(()=>{d(12),S(!1)}).catch(()=>{d(7),S(!1)})},be=()=>{if(f(!0),!O||O==""||O=="default")return alert("Selecione um email");Q(s.id,4,O).then(()=>{d(8),f(!1)}).catch(()=>{d(15),f(!1)})},se=()=>{o(!0),$(s.id,{smsToken:T}).then(w=>{var M;R((M=w.data)==null?void 0:M.pendingSignatureMethods)}).catch(()=>{d(7)}).finally(()=>{o(!1)})},ie=()=>{u(!0),$(s.id,{whatsAppToken:T}).then(w=>{var M;R((M=w.data)==null?void 0:M.pendingSignatureMethods)}).catch(()=>{d(7),u(!1)})},ae=()=>{j(!0),$(s.id,{emailToken:T}).then(w=>{var M;R((M=w.data)==null?void 0:M.pendingSignatureMethods)}).catch(()=>{d(7),j(!1)})};function H(w){return w.replace(/(\d{2})(\d{5})(\d{4})/,"($1) $2-$3")}const k=Y.h3` 5 text-2xl lg:text-[24px] leading-[120%] lg:leading-[160%] font-semibold text-neutral-900 max-w-[80%] 6 `,U=Y.p` 7 text-base leading-6 text-defaultText mt-2 max-w-[80%] 8 ${w=>w.semibold?"font-semibold":""} 9 `,X=y.useRef(null),ye=y.useCallback(()=>{const w=X.current.getScreenshot();C(w),d(5)},[X]),[_e,we]=y.useState({}),[je,re]=y.useState([]),ne=y.useCallback(w=>re(w.filter(({kind:M})=>M==="videoinput")),[re]);y.useEffect(()=>{navigator.mediaDevices.enumerateDevices().then(ne)},[ne]),y.useEffect(()=>{var w;!O&&((w=s==null?void 0:s.mailList)==null?void 0:w.length)>0?G(s==null?void 0:s.mailList[0]):!O&&(s!=null&&s.mail)&&G(s.mail)},[s,O]),y.useEffect(()=>{(s==null?void 0:s.signatureType)===2?d(16):d(1)},[s]);const Se=()=>{d(17)},Pe=()=>{var M;if(A.current.isEmpty())return;h(!0);const w=(M=A==null?void 0:A.current)==null?void 0:M.toDataURL();Fe(s.id,{signature:w}).then(()=>{d(18)}).catch(()=>{d(19)}).finally(()=>{h(!1)})};function Ce(){d(4),C(""),z(!0),setTimeout(()=>{z(!1)},6e3)}function Ee(){return t.jsx("div",{className:"relative w-full overflow-y-hidden",children:t.jsx(He,{audio:!1,height:"100%",ref:X,screenshotFormat:"image/png",width:"100%",mirrored:!0,className:W?"hidden":"w-full max-h-[400px] aspect-auto",videoConstraints:{deviceId:_e,width:ee?1280:640,height:ee?720:360}})})}return t.jsx(t.Fragment,{children:t.jsxs(Ue,{open:v,setOpen:i,aditionalClasses:e,children:[p===1&&t.jsxs(t.Fragment,{children:[t.jsx(k,{children:"Assinatura de contrato"}),t.jsx(U,{children:"Para assinar o contrato, precisamos seguir algumas etapas. Deseja continuar?"}),t.jsxs("div",{className:"flex flex-row items-center gap-2 pt-4",children:[t.jsx("button",{className:"btn-base-submit-selfie text-xs lg:text-base text-neutral-900 border border-primary hover:bg-primaryTransparent ",onClick:q,title:"Não, assinar depois.",children:"Não, assinar depois."}),t.jsx("button",{className:"btn-base-submit-selfie font-medium text-xs lg:text-base bg-primary text-primaryContrast border border-primary hover:brightness-95",onClick:pe,title:"Sim, continuar",children:"Sim, continuar"})]})]}),p===2&&t.jsxs(t.Fragment,{children:[t.jsx(k,{className:"px-2",children:"Selfie"}),t.jsxs("div",{className:"flex flex-col text-sm leading-6 mt-2 gap-2 mb-4 text-gray-900 p-2",children:[t.jsx("span",{children:"Precisamos de uma selfie sua para garantir a autenticidade da assinatura."}),t.jsx("span",{children:"Fique tranquilo, sua foto será criptografada e jamais será disponibilizada a terceiros."}),t.jsxs("span",{children:["Para registro da selfie é necessário tirar uma foto segurando o documento de identificação. Este documento pode ser o ",t.jsx("b",{children:"RG ou CNH"}),"."]})]}),t.jsx("div",{className:"actions",children:t.jsx("button",{className:"btn-base-submit-selfie text-sm pt-2 lg:text-base text-primaryContrast bg-primary hover:brightness-95",title:"Avançar",onClick:()=>d(3),children:"Avançar"})})]}),p===3&&t.jsxs(t.Fragment,{children:[t.jsx("div",{className:"flex items-center p-3 font-semibold text-gray-900 lg:text-xl text-lg text-center",children:"Faça uma selfie segurando sua identidade para validar sua assinatura"}),t.jsxs("div",{className:"flex flex-col gap-3 mt-4 mb-6",children:[t.jsxs("div",{className:"flex items-start gap-2",children:[t.jsx("div",{className:"flex-shrink-0 w-6 h-6 bg-primary text-primaryContrast rounded-full flex items-center justify-center text-sm font-bold",children:"1"}),t.jsx("span",{className:"text-sm text-gray-700",children:"Escolha um ambiente bem iluminado para tirar sua foto."})]}),t.jsxs("div",{className:"flex items-start gap-3",children:[t.jsx("div",{className:"flex-shrink-0 w-6 h-6 bg-primary text-primaryContrast rounded-full flex items-center justify-center text-sm font-bold",children:"2"}),t.jsx("span",{className:"text-sm text-gray-700",children:"Segure seu documento de identidade próximo ao seu rosto."})]}),t.jsxs("div",{className:"flex items-start gap-3",children:[t.jsx("div",{className:"flex-shrink-0 w-6 h-6 bg-primary text-primaryContrast rounded-full flex items-center justify-center text-sm font-bold",children:"3"}),t.jsx("span",{className:"text-sm text-gray-700",children:"Mantenha o rosto e o documento visÃveis e legÃveis na mesma foto."})]}),t.jsxs("div",{className:"flex items-start gap-3",children:[t.jsx("div",{className:"flex-shrink-0 w-6 h-6 bg-primary text-primaryContrast rounded-full flex items-center justify-center text-sm font-bold",children:"4"}),t.jsx("span",{className:"text-sm text-gray-700",children:"Não use óculos escuros, boné ou objetos que cubram o rosto."})]})]}),t.jsx("div",{className:"flex justify-center mb-3",children:t.jsx("img",{src:"/images/selfie/selfie-doc.png",alt:"Instruções para tirar selfie com documento",className:"w-52 h-auto rounded-lg"})}),t.jsx("div",{className:"actions",children:t.jsx("button",{className:"btn-base-submit-selfie w-full text-sm lg:text-base text-primaryContrast bg-primary hover:bg-primaryTransparent10 border-0 rounded-lg py-3 font-medium",title:"Estou pronto!",onClick:Ce,children:"Estou pronto!"})})]}),p===4&&t.jsxs(t.Fragment,{children:[t.jsx(k,{children:"Selfie"}),t.jsx("select",{className:"my-6 select-input ",onChange:w=>we(w.target.value),children:je.map((w,M)=>t.jsx("option",{value:w==null?void 0:w.deviceId,children:(w==null?void 0:w.label)||`Device ${M+1}`},M))}),W&&t.jsx("div",{className:"h-[400px] w-full lg:h-full lg:w-full flex flex-col items-center justify-center skeleton-bg lg:aspect-video",children:t.jsx("p",{className:"text-primary text-base font-semibold mt-4",children:"Carregando câmera..."})}),t.jsx(Ee,{}),t.jsx("button",{className:"btn-base-submit-selfie mt-3 text-sm lg:text-base text-primaryContrast bg-primary hover:brightness-95",title:"Tirar foto",onClick:ye,children:"Tirar foto"})]}),p===5&&t.jsxs(t.Fragment,{children:[t.jsx(k,{children:"Selfie"}),t.jsx(U,{children:"Confira sua foto, ela ficou boa?"}),t.jsx("div",{className:"mt-4 max-h-[400px] lg:max-h-[220px]",children:t.jsx("img",{alt:"Selfie",className:"selfie max-h-[400px] lg:max-h-[220px] mx-auto",src:P})}),t.jsxs("div",{className:"flex flex-row mt-3",children:[" ",t.jsx("button",{className:"btn-base-submit-selfie text-xs lg:text-base text-neutral-900 border border-primary hover:bg-primaryTransparent mr-2",title:"Tirar outra",onClick:()=>d(4),disabled:a,children:"Tirar outra"}),t.jsxs("button",{className:"btn-base-submit-selfie text-sm lg:text-base bg-primary text-primaryContrast border border-primary hover:brightness-95",title:"Sim, avançar",onClick:ge,disabled:a||!P,children:[a&&t.jsx(F,{type:"loading",message:"Salvando"}),!a&&"Sim, avançar"]})]})]}),p===6&&t.jsxs(t.Fragment,{children:[t.jsx(k,{children:"Validação SMS"}),t.jsxs(U,{children:["Agora, vamos enviar um SMS para o seguinte celular:"," ",t.jsx("span",{className:"text-defaultTextDark font-bold",children:`${H(s.phone)}`})]}),t.jsxs("button",{className:"btn-base-submit text-sm lg:text-base bg-primary text-primaryContrast border border-primary hover:brightness-95",title:"Avançar",onClick:xe,disabled:m,children:[m&&t.jsx(F,{type:"loading",message:"Env
9iando código"}),!m&&"Avançar"]})]}),p===8&&t.jsxs(t.Fragment,{children:[t.jsx(k,{children:"Validação SMS"}),t.jsxs(U,{children:["Insira o código recebido em ",t.jsx("br",{}),t.jsx("span",{className:"text-defaultTextDark font-bold",children:`${H(s.phone)}`})," para continuarmos."]}),t.jsx(J,{validationCode:T,setValidationCode:N,onKeyEnterFunc:se,isCodeFilled:D,setIsCodeFilled:L}),t.jsxs("button",{className:"btn-base-submit text-xs lg:text-sm text-defaultTextDark border border-primary hover:bg-primaryTransparent",title:"Avançar",onClick:se,disabled:!D||n,children:[n&&t.jsx(F,{type:"loading",message:"Validando código"}),!n&&"Avançar"]})]}),p===9&&t.jsxs("div",{className:"flex flex-col justify-center items-center",children:[t.jsx(De,{className:"fill-success w-12 h-12"}),t.jsx(k,{className:"text-center mt-2",children:"Documento assinado com sucesso!"}),t.jsx(U,{className:"text-center",children:"Está tudo pronto! Seu contrato já está assinado e você vai receber uma cópia assinada em seu e-mail."}),t.jsx("button",{className:"btn-base-submit text-sm lg:text-base bg-primary text-primaryContrast border border-primary hover:brightness-95",onClick:()=>te("/"),title:"Finalizar",children:"Finalizar"})]}),p===7&&t.jsxs("div",{className:"flex flex-col justify-center items-center",children:[t.jsx(K,{className:"fill-errordefault w-12 h-12 min-w-[24px] min-h-[24px]"}),t.jsx(k,{className:"text-center mt-2",children:"Poxa, tivemos um problema"}),t.jsx(U,{className:"text-center",children:"Desculpe, aconteceu algo inesperado durante a assinatura do seu contrato. Por favor, tente novamente."}),t.jsx("button",{className:"btn-base-submit text-sm lg:text-base bg-primary text-primaryContrast border border-primary hover:brightness-95",onClick:()=>d(1),title:"Tentar novamente",children:"Tentar novamente"})]}),p===10&&t.jsxs(t.Fragment,{children:[t.jsx(k,{className:"text-errordefault",children:"Código de validação incorreto"}),t.jsx(U,{children:"Desculpe, o código que você digitou não é válido. Por favor, tente novamente."}),t.jsx("button",{className:"btn-base-submit text-sm lg:text-base bg-primary text-primaryContrast border border-primary hover:brightness-95",onClick:()=>d(6),title:"Tentar novamente",children:"Tentar novamente"})]}),p===11&&t.jsxs(t.Fragment,{children:[t.jsx(k,{children:"Validação WhatsApp"}),t.jsxs(U,{children:["Agora, vamos enviar um código, via WhatsApp, para o celular"," ",t.jsx("span",{className:"text-defaultTextDark font-bold",children:`${H(s.phone)}`})]}),t.jsxs("button",{className:"btn-base-submit text-sm lg:text-base bg-primary text-primaryContrast border border-primary hover:brightness-95",title:"Avançar",onClick:ve,disabled:g,children:[g&&t.jsx(F,{type:"loading",message:"Enviando código"}),!g&&"Avançar"]})]}),p===12&&t.jsxs(t.Fragment,{children:[t.jsx(k,{children:"Validação WhatsApp"}),t.jsx(U,{children:"Insira o código recebido pelo WhatsApp para continuarmos."}),t.jsx(J,{validationCode:T,setValidationCode:N,onKeyEnterFunc:ie,isCodeFilled:D,setIsCodeFilled:L}),t.jsxs("button",{className:"btn-base-submit text-xs lg:text-sm text-defaultTextDark border border-primary hover:bg-primaryTransparent",title:"Avançar",onClick:ie,disabled:!D||c,children:[c&&t.jsx(F,{type:"loading",message:"Validando código"}),!c&&"Avançar"]})]}),p===14&&t.jsxs(t.Fragment,{children:[t.jsx(k,{children:"Validação Email"}),t.jsxs(U,{children:["Agora, vamos enviar um código, para o email"," ",s!=null&&s.mailList&&((oe=s==null?void 0:s.mailList)==null?void 0:oe.length)>1?t.jsx("span",{className:"text-neutral-900 font-bold",children:t.jsx(Ae,{title:"Selecione o e-mail",options:(s==null?void 0:s.mailList)&&(s==null?void 0:s.mailList.map(w=>({value:w,key:w}))),value:O,setter:G})}):t.jsx("span",{className:"text-neutral-900 font-bold",children:s==null?void 0:s.mail})]}),t.jsxs("button",{className:"btn-base-submit text-sm lg:text-base bg-primary text-primaryContrast border border-primary hover:brightness-95",title:"Avançar",onClick:be,disabled:_,children:[_&&t.jsx(F,{type:"loading",message:"Enviando código"}),!_&&"Avançar"]})]}),p===15&&t.jsxs(t.Fragment,{children:[t.jsx(k,{children:"Validação Email"}),t.jsx(U,{children:"Insira o código recebido pelo email para continuarmos."}),t.jsx(J,{validationCode:T,setValidationCode:N,onKeyEnterFunc:ae,isCodeFilled:D,setIsCodeFilled:L}),t.jsxs("button",{className:"btn-base-submit text-xs lg:text-sm text-defaultTextDark border border-primary hover:bg-primaryTransparent",title:"Avançar",onClick:ae,disabled:!D||b,children:[b&&t.jsx(F,{type:"loading",message:"Validando código"}),!b&&"Avançar"]})]}),p===13&&t.jsxs("div",{className:"flex flex-col justify-center items-center",children:[t.jsx(K,{className:"fill-errordefault w-12 h-12 min-w-[24px] min-h-[24px]"}),t.jsx(k,{className:"text-center mt-2",children:"Contrato sem métodos de assinatura"}),t.jsx(U,{className:"text-center",children:"Desculpe, não foi possÃvel assinar o seu contrato. Por favor, entre em contato com o suporte."})]}),p===16&&t.jsxs(t.Fragment,{children:[t.jsx(k,{children:"Aceite de documento"}),t.jsx(U,{children:"Ao clicar em 'Assinar', você concorda com os termos do documento. Deseja continuar?"}),t.jsxs("div",{className:"flex flex-row items-start",children:[t.jsx("button",{className:"btn-base-submit text-xs lg:text-base text-neutral-900 border border-primary hover:bg-primaryTransparent mr-2",onClick:q,title:"Não, assinar depois.",children:"Não, assinar depois"}),t.jsx("button",{className:"btn-base-submit text-sm lg:text-base bg-primary text-primaryContrast border border-primary hover:brightness-95",onClick:Se,title:"Assinar",children:"Assinar"})]})]}),p===17&&t.jsxs(t.Fragment,{children:[t.jsx(k,{children:"Aceite de documento"}),t.jsx(U,{children:"Desenhe sua assinatura abaixo para prosseguir:"}),t.jsx("div",{className:"bg-neutral-100 w-full h-44 lg:h-72 border border-gray-200 rounded-lg mb-4 mt-4",children:t.jsx(V,{ref:A})}),t.jsxs("div",{className:"flex flex-row items-center justify-center text-sm cursor-pointer",onClick:()=>A.current.clear(),children:["Limpar ",t.jsx(Le,{className:"ml-1",size:16})]}),t.jsxs("div",{className:"flex flex-row items-start",children:[t.jsx("button",{className:"btn-base-submit text-xs lg:text-base text-neutral-900 border border-primary hover:bg-primaryTransparent mr-2",onClick:q,title:"Cancelar",children:"Cancelar"}),t.jsx(We,{disabled:r,action:Pe,label:r?"Salvando assinatura":"Assinar"})]})]}),p===18&&t.jsxs("div",{className:"flex flex-col justify-center items-center",children:[t.jsxs("div",{className:"flex flex-col items-center justify-center",children:[t.jsx(Ge,{className:"text-success",size:115}),t.jsx("h2",{children:"Aceite de documento realizado com sucesso!"})]}),t.jsx("button",{className:"btn-base-submit text-sm lg:text-base bg-primary text-primaryContrast border border-primary hover:brightness-95",onClick:()=>te("/documents"),title:"Finalizar",children:"Finalizar"})]}),p===19&&t.jsxs("div",{className:"flex flex-col justify-center items-center",children:[t.jsx(K,{className:"fill-errordefault w-12 h-12 min-w-[24px] min-h-[24px]"}),t.jsx(k,{className:"text-center mt-2",children:"Falha ao realizar aceite"}),t.jsx(U,{className:"text-center",children:"Aconteceu algo inesperado durante o aceite do seu documento. Por favor, tente novamente."}),t.jsx("button",{className:"btn-base-submit text-sm lg:text-base bg-primary text-primaryContrast border border-primary hover:brightness-95",onClick:()=>d(16),title:"Tentar novamente",children:"Tentar novamente"})]})]})})}function de(v){return Ie({tag:"svg",attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{fill:"none",strokeWidth:"2",d:"M12,17 L12,19 M12,10 L12,16 M12,3 L2,22 L22,22 L12,3 Z"}}]})(v)}ce.GlobalWorkerOptions.workerSrc=`//cdnjs.cloudflare.com/ajax/libs/pdf.js/${ce.version}/pdf.worker.min.js`;function lt(){const[v,i]=y.useState(!0),[e,s]=y.useState(null),[a,l]=y.useState(null),[r,h]=y.useState(1),[m,x]=y.useState(!1),[g,S]=y.useState(null),[_,f]=y.useState(null),[n,o]=y.useState(!1),{documentId:c}=ze(),{isLargeScreen:u}=he(),b=Y.h1`text-lg font-semibold text-gray-900 max-w-[80%]`,j="Erro ao carregar o documento PDF, por favor, entre em contato com o suporte.",p=y.useCallback(({numPages:N})=>{l(N),o(!1),f(null)},[]),d=y.useCallback(N=>
9{f({message:j,code:N.message}),o(!1)},[]),P=y.useCallback(()=>{o(!0),f(null)},[]);y.useEffect(()=>{c&&(i(!0),S(null),Re(c).then(N=>{N!=null&&N.data?s(N.data):S({message:"Documento não encontrado"})}).catch(N=>{S({message:j})}).finally(()=>{i(!1)}))},[c]),y.useEffect(()=>{(e==null?void 0:e.status)===1&&x(!0)},[e]);const C=y.useMemo(()=>e!=null&&e.pdf?`data:application/pdf;base64,${e.pdf}`:null,[e==null?void 0:e.pdf]),T=y.useMemo(()=>{if(!a)return null;if(a<=10)return Array.from(new Array(a),(W,z)=>t.jsx(le,{pageNumber:z+1,renderTextLayer:!1,renderAnnotationLayer:!1},`page_${z+1}`));const N=Math.max(1,r-2),D=Math.min(a,r+2),L=[];for(let W=N;W<=D;W++)L.push(t.jsx(le,{pageNumber:W,renderTextLayer:!1,renderAnnotationLayer:!1},`page_${W}`));return L},[a,r]);return v?t.jsxs("div",{className:"signature-page relative",children:[t.jsx("div",{className:"header w-full sticky top-0 p-3 lg:py-4 lg:px-16",children:t.jsx("div",{className:"animate-pulse bg-gray-200 h-6 w-1/3 rounded"})}),t.jsx("div",{className:"pdf flex justify-center items-center min-h-[400px]",children:t.jsx("div",{className:"animate-spin rounded-full h-12 w-12 border-b-2 border-primary"})})]}):g||!e?t.jsxs("div",{className:"signature-page relative",children:[t.jsx("div",{className:"header w-full sticky top-0 p-3 lg:py-4 lg:px-16",children:t.jsx(b,{children:"Erro ao carregar documento"})}),t.jsx("div",{className:"pdf flex justify-center items-center min-h-[400px]",children:t.jsxs("div",{className:"text-center",children:[t.jsx(de,{className:"mx-auto mb-4 text-yellow-500",size:48}),t.jsx("p",{className:"text-gray-600",children:(g==null?void 0:g.message)||"Documento não encontrado"})]})})]}):t.jsxs("div",{className:"signature-page relative",children:[t.jsxs("div",{className:"header w-full sticky top-0 p-3 lg:py-4 lg:px-16 bg-white border-b z-10",children:[t.jsx(b,{children:e.name}),e.status===1&&t.jsxs("button",{className:"btn-base-submit !w-auto !mt-0 border border-primary bg-primaryTransparent !py-2 items-center justify-center",title:"Assinar documento",onClick:()=>x(!0),"aria-label":`Assinar ${e.signatureType===1?"contrato":"documento"}`,children:[u&&e.signatureType===1&&"Assinar contrato",u&&e.signatureType===2&&"Assinar documento",!u&&"Assinar"]}),e.status!==1&&t.jsx("div",{className:"bg-supportsuccess p-2 text-sm rounded text-success",children:"Contrato já está assinado"})]}),t.jsxs("div",{className:"pdf",children:[n&&t.jsxs("div",{className:"flex justify-center items-center py-8",children:[t.jsx("div",{className:"animate-spin rounded-full h-8 w-8 border-b-2 border-primary"}),t.jsx("span",{className:"ml-2 text-gray-600",children:"Carregando PDF..."})]}),_&&t.jsx("div",{className:"flex justify-center items-center min-h-[400px]",children:t.jsxs("div",{className:"text-center",children:[t.jsx(de,{className:"mx-auto mb-4 text-yellow-500",size:48}),t.jsx("p",{className:"text-gray-600",children:_.message}),e.status===1&&t.jsx("p",{className:"text-sm text-gray-500 mt-2",children:"Você ainda pode assinar o documento clicando no botão acima."})]})}),C&&!_&&t.jsxs(t.Fragment,{children:[t.jsx(Be,{file:C,onLoadSuccess:p,onLoadError:d,onLoadStart:P,loading:"",error:"",children:T}),a&&a>10&&t.jsxs("div",{className:"flex justify-center items-center gap-4 py-4 bg-gray-50",children:[t.jsx("button",{onClick:()=>h(Math.max(1,r-1)),disabled:r<=1,className:"px-3 py-1 bg-white border rounded disabled:opacity-50 disabled:cursor-not-allowed","aria-label":"Página anterior",children:"â Anterior"}),t.jsxs("span",{className:"text-sm text-gray-600",children:["Página ",r," de ",a]}),t.jsx("button",{onClick:()=>h(Math.min(a,r+1)),disabled:r>=a,className:"px-3 py-1 bg-white border rounded disabled:opacity-50 disabled:cursor-not-allowed","aria-label":"Próxima página",children:"Próxima â"})]})]})]}),e.status===1&&t.jsx(et,{document:e,setOpen:()=>x(!1),open:m})]})}export{lt as default};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.