PageSourceSearch

https://www.goperceval.fr/_next/static/chunks/pages/assurance-auto/tarif-0fe2f92aedd9ae95.js

js goperceval.fr collected 2026-10-04 17:44:10 UTC 219,516 bytes, 2 lines download raw bytes

1(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[709],{621019:function(e,t,n){(window.__NEXT_P=window.__NEXT_P||[]).push(["/assurance-auto/tarif",function(){return n(987609)}])},400182:function(e,t,n){"use strict";var r=n(828),i=n(470024),a=(n(667294),n(375071)),o=(0,i.cn)(null);t.Z=function(){var e=(0,r.Z)((0,i.KO)(o),2),t=e[0],n=e[1];return{constants:t,getConstants:function(){a.Z.get("constants/".concat("PER_APP"),n)}}}},230500:function(e,t,n){"use strict";var r=n(785893),i=(n(667294),n(597206));t.Z=function(e){var t=e.noLoader;return(0,r.jsx)("div",{className:"d-center",style:{position:"fixed",width:"100%",height:"100%",top:0,left:0,zIndex:"999999"},children:!t&&(0,r.jsx)(i.Z,{})})}},418299:function(e,t,n){"use strict";n.d(t,{Z:function(){return v}});var r=n(828),i=n(667294),a=n(735627),o=n(351572),s=n(409669),l=n.n(s),c=n(11107),u=n(415097),d=n(946489),m=n.n(d),p=n(916806),f=n(289470),h=!0,v=function(){l().defaults.withCredentials=!0;var e=(0,r.Z)((0,a.Z)(),2),t=e[0],n=e[1],s=(0,o.Y)(t,n),d=function(e,t,n){return{getConstants:function(){t({type:u.L.LOAD_CONSTANT,payload:!0}),l().get("https://api.goperceval.fr/constants/PER_APP").then((function(e){t({type:u.L.GET_CONSTANTS,payload:e.data})})).catch((function(e){e=c.Z.filterError(e,t,u.L.LOAD_CONSTANT)}))}}}(0,n),v=function(e,t,n){return{getProducts:function(){t({type:f.P.LOAD_PRODUCT,payload:!0}),t({type:f.P.GET_PRODUCTS,payload:[{id:"AC",name:"Assurance Construction",description1:"RC Pro &",description2:"D\xe9cennale",image:"https://lh3.googleusercontent.com/gd7vl3Bb-PPYSzae1LJSO3gsuhY5u6vlpbB2CPa-sC5MzWVZo9zo4Q1ImKbrbbDGtA=s360-rw"},{id:"PJ",name:"Protection Juridique Pro",description1:"+ de 100 juristes \xe0 vos c\xf4t\xe9s.",description2:"Frais d'avocat pris en charge",image:"https://lh3.googleusercontent.com/gd7vl3Bb-PPYSzae1LJSO3gsuhY5u6vlpbB2CPa-sC5MzWVZo9zo4Q1ImKbrbbDGtA=s360-rw"},{id:"MP",name:"Multirisque Pro",description1:"Prot\xe9gez vos locaux",description2:"et les biens de votre entreprise",image:"https://lh3.googleusercontent.com/gd7vl3Bb-PPYSzae1LJSO3gsuhY5u6vlpbB2CPa-sC5MzWVZo9zo4Q1ImKbrbbDGtA=s360-rw"}]})}}}(0,n);return(0,i.useEffect)((function(){if(localStorage.jwtToken&&h){h=!1;var e=m()(localStorage.jwtToken);n({type:p.b.SET_CURRENT_USER,payload:e});var t=Date.now()/1e3;e.exp<t&&s.logoutUser()}d.getConstants(),v.getProducts(),l().get("https://api.goperceval.fr/auth/me/PER_APP").then((function(e){var t=m()(e.data);null===dataLayer||void 0===dataLayer||dataLayer.push({event:"USER_BACK",email:t.email}),n({type:p.b.SET_CURRENT_USER,payload:t})})).catch((function(e){s.logoutUser(!0)}))}),[]),null}},701045:function(e,t,n){var r=n(734155),i=n(667294);function a(e){return e&&"object"===typeof e&&"default"in e?e:{default:e}}var o=a(i);function s(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}var l="undefined"!==typeof r&&r.env&&!0,c=function(e){return"[object String]"===Object.prototype.toString.call(e)},u=function(){var e,t,n,r=function(e){var t=void 0===e?{}:e,n=t.name,r=void 0===n?"stylesheet":n,i=t.optimizeForSpeed,a=void 0===i?l:i;d(c(r),"`name` must be a string"),this._name=r,this._deletedRulePlaceholder="#"+r+"-deleted-rule____{}",d("boolean"===typeof a,"`optimizeForSpeed` must be a boolean"),this._optimizeForSpeed=a,this._serverSheet=void 0,this._tags=[],this._injected=!1,this._rulesCount=0;var o=document.querySelector('meta[property="csp-nonce"]');this._nonce=o?o.getAttribute("content"):null},i=r.prototype;return i.setOptimizeForSpeed=function(e){d("boolean"===typeof e,"`setOptimizeForSpeed` accepts a boolean"),d(0===this._rulesCount,"optimizeForSpeed cannot be when rules have already been inserted"),this.flush(),this._optimizeForSpeed=e,this.inject()},i.isOptimizeForSpeed=function(){return this._optimizeForSpeed},i.inject=function(){var e=this;if(d(!this._injected,"sheet already injected"),this._injected=!0,this._optimizeForSpeed)return this._tags[0]=this.makeStyleTag(this._name),this._optimizeForSpeed="insertRule"in this.getSheet(),void(this._optimizeForSpeed||(l||console.warn("StyleSheet: optimizeForSpeed mode not supported falling back to standard mode."),this.flush(),this._injected=!0));this._serverSheet={cssRules:[],insertRule:function(t,n){return"number"===typeof n?e._serverSheet.cssRules[n]={cssText:t}:e._serverSheet.cssRules.push({cssText:t}),n},deleteRule:function(t){e._serverSheet.cssRules[t]=null}}},i.getSheetForTag=function(e){if(e.sheet)return e.sheet;for(var t=0;t<document.styleSheets.length;t++)if(document.styleSheets[t].ownerNode===e)return document.styleSheets[t]}
1,i.getSheet=function(){return this.getSheetForTag(this._tags[this._tags.length-1])},i.insertRule=function(e,t){if(d(c(e),"`insertRule` accepts only strings"),this._optimizeForSpeed){var n=this.getSheet();"number"!==typeof t&&(t=n.cssRules.length);try{n.insertRule(e,t)}catch(i){return l||console.warn("StyleSheet: illegal rule: \n\n"+e+"\n\nSee https://stackoverflow.com/q/20007992 for more info"),-1}}else{var r=this._tags[t];this._tags.push(this.makeStyleTag(this._name,e,r))}return this._rulesCount++},i.replaceRule=function(e,t){if(this._optimizeForSpeed){var n=this.getSheet();if(t.trim()||(t=this._deletedRulePlaceholder),!n.cssRules[e])return e;n.deleteRule(e);try{n.insertRule(t,e)}catch(i){l||console.warn("StyleSheet: illegal rule: \n\n"+t+"\n\nSee https://stackoverflow.com/q/20007992 for more info"),n.insertRule(this._deletedRulePlaceholder,e)}}else{var r=this._tags[e];d(r,"old rule at index `"+e+"` not found"),r.textContent=t}return e},i.deleteRule=function(e){if(this._optimizeForSpeed)this.replaceRule(e,"");else{var t=this._tags[e];d(t,"rule at index `"+e+"` not found"),t.parentNode.removeChild(t),this._tags[e]=null}},i.flush=function(){this._injected=!1,this._rulesCount=0,this._tags.forEac
1h((function(e){return e&&e.parentNode.removeChild(e)})),this._tags=[]},i.cssRules=function(){var e=this;return this._tags.reduce((function(t,n){return n?t=t.concat(Array.prototype.map.call(e.getSheetForTag(n).cssRules,(function(t){return t.cssText===e._deletedRulePlaceholder?null:t}))):t.push(null),t}),[])},i.makeStyleTag=function(e,t,n){t&&d(c(t),"makeStyleTag accepts only strings as second parameter");var r=document.createElement("style");this._nonce&&r.setAttribute("nonce",this._nonce),r.type="text/css",r.setAttribute("data-"+e,""),t&&r.appendChild(document.createTextNode(t));var i=document.head||document.getElementsByTagName("head")[0];return n?i.insertBefore(r,n):i.appendChild(r),r},e=r,(t=[{key:"length",get:function(){return this._rulesCount}}])&&s(e.prototype,t),n&&s(e,n),r}();function d(e,t){if(!e)throw new Error("StyleSheet: "+t+".")}var m=function(e){for(var t=5381,n=e.length;n;)t=33*t^e.charCodeAt(--n);return t>>>0},p={};function f(e,t){if(!t)return"jsx-"+e;var n=String(t),r=e+n;return p[r]||(p[r]="jsx-"+m(e+"-"+n)),p[r]}function h(e,t){var n=e+t;return p[n]||(p[n]=t.replace(/__jsx-style-dynamic-selector/g,e)),p[n]}var v=function(){var e=function(e){var t=void 0===e?{}:e,n=t.styleSheet,r=void 0===n?null:n,i=t.optimizeForSpeed,a=void 0!==i&&i;this._sheet=r||new u({name:"styled-jsx",optimizeForSpeed:a}),this._sheet.inject(),r&&"boolean"===typeof a&&(this._sheet.setOptimizeForSpeed(a),this._optimizeForSpeed=this._sheet.isOptimizeForSpeed()),this._fromServer=void 0,this._indices={},this._instancesCounts={}},t=e.prototype;return t.add=function(e){var t=this;void 0===this._optimizeForSpeed&&(this._optimizeForSpeed=Array.isArray(e.children),this._sheet.setOptimizeForSpeed(this._optimizeForSpeed),this._optimizeForSpeed=this._sheet.isOptimizeForSpeed()),this._fromServer||(this._fromServer=this.selectFromServer(),this._instancesCounts=Object.keys(this._fromServer).reduce((function(e,t){return e[t]=0,e}),{}));var n=this.getIdAndRules(e),r=n.styleId,i=n.rules;if(r in this._instancesCounts)this._instancesCounts[r]+=1;else{var a=i.map((function(e){return t._sheet.insertRule(e)})).filter((function(e){return-1!==e}));this._indices[r]=a,this._instancesCounts[r]=1}},t.remove=function(e){var t=this,n=this.getIdAndRules(e).styleId;if(function(e,t){if(!e)throw new Error("StyleSheetRegistry: "+t+".")}(n in this._instancesCounts,"styleId: `"+n+"` not found"),this._instancesCounts[n]-=1,this._instancesCounts[n]<1){var r=this._fromServer&&this._fromServer[n];r?(r.parentNode.removeChild(r),delete this._fromServer[n]):(this._indices[n].forEach((function(e){return t._sheet.deleteRule(e)})),delete this._indices[n]),delete this._instancesCounts[n]}},t.update=function(e,t){this.add(t),this.remove(e)},t.flush=function(){this._sheet.flush(),this._sheet.inject(),this._fromServer=void 0,this._indices={},this._instancesCounts={}},t.cssRules=function(){var e=this,t=this._fromServer?Object.keys(this._fromServer).map((function(t){return[t,e._fromServer[t]]})):[],n=this._sheet.cssRules();return t.concat(Object.keys(this._indices).map((function(t){return[t,e._indices[t].map((function(e){return n[e].cssText})).join(e._optimizeForSpeed?"":"\n")]})).filter((function(e){return Boolean(e[1])})))},t.styles=function(e){return function(e,t){return void 0===t&&(t={}),e.map((function(e){var n=e[0],r=e[1];return o.default.createElement("style",{id:"__"+n,key:"__"+n,nonce:t.nonce?t.nonce:void 0,dangerouslySetInnerHTML:{__html:r}})}))}(this.cssRules(),e)},t.getIdAndRules=function(e){var t=e.children,n=e.dynamic,r=e.id;if(n){var i=f(r,n);return{styleId:i,rules:Array.isArray(t)?t.map((function(e){return h(i,e)})):[h(i,t)]}}return{styleId:f(r),rules:Array.isArray(t)?t:[t]}},t.selectFromServer=function(){return Array.prototype.slice.call(document.querySelectorAll('[id^="__jsx-"]')).reduce((function(e,t){return e[t.id.slice(2)]=t,e}),{})},e}();var g=i.createContext(null);function x(){return new v}function _(){return i.useContext(g)}g.displayName="StyleSheetContext";var b=o.default.useInsertionEffect||o.default.useLayoutEffect,y=x();function E(e){var t=y||_();return t?(b((function(){return t.add(e),function(){t.remove(e)}}),[e.id,String(e.dynamic)]),null):null}E.dynamic=function(e){return e.map((function(e){return f(e[0],e[1])})).join(" ")},t.style=E},960357:function(e,t,n){"use strict";e.exports=n(701045).style},987609:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return Hn}});var r,i=n(785893),a=n(667294),o=n(445345),s=n(400182),l=n(809008),c=n.n(l),u=n(302225),d=n(591037),m=n(873595),p=n(828),f=n(470024),h=n(375071),v=n(414924),g=n(499490),x=n(626042),_=n(382538),b=n(269396),y=n(999534),E=n(629815),S=n(582222),I=n(605244),N=n(735627),C=n(147568),w=n(197582),T=n(960357),j=n.n(T),R=function(e){var t=e.text,n=e.children,r=e.placement,a=void 0===r?"top":r;return(0,i.jsxs)("div",{className:"jsx-dd7ff1cb6cfc7e3 position-relative d-inline-block cursor-pointer",children:[n,(0,i.jsxs)("div",{style:(0,b.Z)((0,x.Z)({},function(){switch(a){case"bottom":return{top:"100%",left:"50%",transform:"translateX(-50%)",marginTop:"5px"};case"left":return{top:"50%",right:"100%",transform:"translateY(-50%)",marginRight:"5px"};case"right":return{top:"50%",left:"100%",transform:"translateY(-50%)",marginLeft:"5px"};default:return{bottom:"100%",left:"50%",transform:"translateX(-50%)",marginBottom:"5px"}}}
1()),{fontSize:"12px",whiteSpace:"nowrap",opacity:0,visibility:"hidden",transition:"opacity 0.3s, visibility 0.3s",zIndex:1e3,pointerEvents:"none"}),className:"jsx-dd7ff1cb6cfc7e3 position-absolute bg-white shadow-sm border text-dark px-2 py-1 rounded tooltip-content",children:[t,(0,i.jsx)("div",{style:function(){switch(a){case"bottom":return{position:"absolute",bottom:"100%",left:"50%",transform:"translateX(-50%)",width:0,height:0,borderLeft:"5px solid transparent",borderRight:"5px solid transparent",borderBottom:"5px solid #343a40"};case"left":return{position:"absolute",top:"50%",left:"100%",transform:"translateY(-50%)",width:0,height:0,borderTop:"5px solid transparent",borderBottom:"5px solid transparent",borderLeft:"5px solid #343a40"};case"right":return{position:"absolute",top:"50%",right:"100%",transform:"translateY(-50%)",width:0,height:0,borderTop:"5px solid transparent",borderBottom:"5px solid transparent",borderRight:"5px solid #343a40"};default:return{position:"absolute",top:"100%",left:"50%",transform:"translateX(-50%)",width:0,height:0,borderLeft:"5px solid transparent",borderRight:"5px solid transparent",borderTop:"5px solid #343a40"}}}(),className:"jsx-dd7ff1cb6cfc7e3"})]}),(0,i.jsx)(j(),{id:"dd7ff1cb6cfc7e3",children:".position-relative.jsx-dd7ff1cb6cfc7e3:hover .tooltip-content.jsx-dd7ff1cb6cfc7e3{opacity:1!important;visibility:visible!important}"})]})},A=n(572132),k=new Uint8Array(16);function O(){if(!r&&!(r="undefined"!==typeof crypto&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||"undefined"!==typeof msCrypto&&"function"===typeof msCrypto.getRandomValues&&msCrypto.getRandomValues.bind(msCrypto)))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return r(k)}var P=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i;for(var D=function(e){return"string"===typeof e&&P.test(e)},L=[],M=0;M<256;++M)L.push((M+256).toString(16).substr(1));var U=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=(L[e[t+0]]+L[e[t+1]]+L[e[t+2]]+L[e[t+3]]+"-"+L[e[t+4]]+L[e[t+5]]+"-"+L[e[t+6]]+L[e[t+7]]+"-"+L[e[t+8]]+L[e[t+9]]+"-"+L[e[t+10]]+L[e[t+11]]+L[e[t+12]]+L[e[t+13]]+L[e[t+14]]+L[e[t+15]]).toLowerCase();if(!D(n))throw TypeError("Stringified UUID is invalid");return n};var q=function(e,t,n){var r=(e=e||{}).random||(e.rng||O)();if(r[6]=15&r[6]|64,r[8]=63&r[8]|128,t){n=n||0;for(var i=0;i<16;++i)t[n+i]=r[i];return t}return U(r)},z=function(e,t){return e&&"string"===typeof e&&"date"===t?function(e){if(!e||"string"!==typeof e)return e;try{var t=g.ou.fromFormat(e,"dd/MM/yyyy");if(t.isValid)return t.toISODate();var n=g.ou.fromFormat(e,"dd/MM/yy");if(n.isValid)return n.toISODate()}catch(r){console.warn("Erreur lors du formatage de la date:",e,r)}return e}(e):e},Z=(0,f.cn)({}),F=(0,f.cn)(!1),B=(0,f.cn)((function(e){var t=e(Z),n=Object.values(t);return{total:n.length,uploading:n.filter((function(e){return"uploading"===e.status})).length,converting:n.filter((function(e){return"converting"===e.status})).length,processing:n.filter((function(e){return"processing"===e.status})).length,completed:n.filter((function(e){return"completed"===e.status})).length,error:n.filter((function(e){return"error"===e.status})).length,hasActive:n.some((function(e){return["uploading","converting","processing"].includes(e.status)}))}})),V=(0,f.cn)(null,(function(e,t,n){var r=e(Z);switch(n.type){case"ADD_EXTRACTION":t(Z,(0,b.Z)((0,x.Z)({},r),(0,v.Z)({},n.extraction.id,n.extraction))),t(F,!0);break;case"UPDATE_EXTRACTION":r[n.id]&&t(Z,(0,b.Z)((0,x.Z)({},r),(0,v.Z)({},n.id,(0,x.Z)({},r[n.id],n.updates))));break;case"REMOVE_EXTRACTION":var i=(0,x.Z)({},r);delete i[n.id],t(Z,i);break;case"CLEAR_COMPLETED":var a={};Object.entries(r).forEach((function(e){var t=(0,p.Z)(e,2),n=t[0],r=t[1];"completed"!==r.status&&(a[n]=r)})),t(Z,a);break;case"TOGGLE_WIDGET":t(F,!e(F));break;case"OPEN_WIDGET":t(F,!0);break;case"CLOSE_WIDGET":t(F,!1)}})),Q=null;function G(){return W.apply(this,arguments)}function W(){return(W=(0,C.Z)((function(){var e;return(0,w.__generator)(this,(function(t){switch(t.label){case 0:return Q?[3,3]:[4,Promise.all([n.e(824),n.e(39),n.e(738)]).then(n.t.bind(n,178783,23))];case 1:return Q=t.sent(),[4,Promise.all([n.e(927),n.e(657)]).then(n.t.bind(n,327657,23))];case 2:e=t.sent(),Q.GlobalWorkerOptions.workerSrc=e,t.label=3;case 3:return[2,Q]}}))}))).apply(this,arguments)}function H(e){return K.apply(this,arguments)}function K(){return K=(0,C.Z)((function(e){var t,n,r,i,a,o,s,l,c,u,d,m,p,f,h,v,g,x,_,b,y,E,S,I,N,C,T,j,R,A,k,O,P,D,L,M,U,q=arguments;return(0,w.__generator)(this,(function(w){switch(w.label){case 0:t=q.length>1&&void 0!==q[1]?q[1]:{},n=t.scale,r=void 0===n?2:n,i=t.quality,a=void 0===i?.85:i,o=t.format,s=void 0===o?"jpeg":o,l=t.maxPages,c=void 0===l?10:l,w.label=1;case 1:return w.trys.push([1,12,,13]),[4,G()];case 2:return u=w.sent(),[4,e.arrayBuffer()];case 3:return d=w.sent(),m=new Uint8Array(d),[4,u.getDocument({data:m,useSystemFonts:!0}).promise];case 4:p=w.sent(),f=Math.min(p.numPages,c),console.log("PDF charg\xe9: ".concat(p.numPages," page(s), conversion de ").concat(f," page(s)")),h=[],v=0,g=0,x=1,w.label=5;case 5:return x<=f?[4,p.getPage(x)]:[3,9];case 6:return _=w.sent(),b=_.getViewport({scale:r}),y=document.createElement("canvas"),E=y.getContext("2d"),y.width=b.
1width,y.height=b.height,E.fillStyle="white",E.fillRect(0,0,y.width,y.height),[4,_.render({canvasContext:E,viewport:b}).promise];case 7:w.sent(),h.push(y),v=Math.max(v,b.width),g=Math.max(g,b.height),console.log("Page ".concat(x,"/").concat(f," rendue: ").concat(Math.round(b.width),"x").concat(Math.round(b.height),"px")),w.label=8;case 8:return x++,[3,5];case 9:return S=g*f,I=document.createElement("canvas"),N=I.getContext("2d"),I.width=v,I.height=S,N.fillStyle="white",N.fillRect(0,0,I.width,I.height),C=0,h.forEach((function(e){var t=v/e.width,n=g/e.height,r=Math.min(t,n),i=e.width*r,a=e.height*r,o=(v-i)/2,s=(g-a)/2;N.drawImage(e,o,C+s,i,a),C+=g})),console.log("Image combin\xe9e: ".concat(Math.round(I.width),"x").concat(Math.round(I.height),"px")),T=1e3,j=I,I.width>T&&(R=T/I.width,A=T,k=Math.round(I.height*R),j=document.createElement("canvas"),O=j.getContext("2d"),j.width=A,j.height=k,O.fillStyle="white",O.fillRect(0,0,j.width,j.height),O.imageSmoothingEnabled=!0,O.imageSmoothingQuality="high",O.drawImage(I,0,0,A,k),console.log("Image redimensionn\xe9e pour OCR: ".concat(A,"x").concat(k,"px (facteur: ").concat(R.toFixed(2),")"))),console.log("Image finale: ".concat(Math.round(j.width),"x").concat(Math.round(j.height),"px")),[4,new Promise((function(e){"jpeg"===s?j.toBlob(e,"image/jpeg",a):j.toBlob(e,"
1image/png")}))];case 10:return P=w.sent(),D="jpeg"===s?"jpg":"png",L=e.name.replace(/\.pdf$/i,""),M=new File([P],"".concat(L,"_").concat(f,"pages.").concat(D),{type:"image/".concat(s)}),console.log("Conversion r\xe9ussie: ".concat(e.name," (").concat((e.size/1024).toFixed(1),"KB, ").concat(p.numPages," pages) \u2192 ").concat(M.name," (").concat((M.size/1024).toFixed(1),"KB)")),[4,p.destroy()];case 11:return w.sent(),[2,M];case 12:throw U=w.sent(),console.error("Erreur lors de la conversion PDF:",U),new Error("Impossible de convertir le PDF: ".concat(U.message));case 13:return[2]}}))})),K.apply(this,arguments)}var J=function(){var e=(0,p.Z)((0,f.KO)(Z),1)[0],t=(0,p.Z)((0,f.KO)(F),1)[0],n=(0,p.Z)((0,f.KO)(B),1)[0],r=(0,p.Z)((0,f.KO)(V),2)[1],i=function(e){if(!["image/jpeg","image/png","image/gif","image/webp","application/pdf"].includes(e.type))throw new Error('Le fichier "'.concat(e.name,"\" n'est pas support\xe9. Utilisez JPG, PNG, GIF, WEBP ou PDF."));if(e.size>33554432){var t=(e.size/1024/1024).toFixed(1);throw new Error('Le fichier "'.concat(e.name,'" est trop volumineux (').concat(t,"MB). Maximum: 10MB."))}},o=function(e){if(console.log("getDocumentTypeFromSchema - schema re\xe7u:",e),!e)return null;if(e.documentType)return console.log("documentType trouv\xe9 directement:",e.documentType),e.documentType;var t=Object.values(e)[0];return t&&t.docType?(console.log("docType trouv\xe9 dans firstField:",t.docType),t.docType):(console.log("Aucun type de document trouv\xe9"),null)},s=(0,a.useCallback)(function(){var e=(0,C.Z)((function(e){var t,n,a,s,c,u=arguments;return(0,w.__generator)(this,(function(d){switch(d.label){case 0:t=u.length>1&&void 0!==u[1]?u[1]:null,n=u.length>2&&void 0!==u[2]?u[2]:null,a=q(),d.label=1;case 1:return d.trys.push([1,3,,4]),i(e),s={id:a,fileName:e.name,fileSize:e.size,status:"uploading",progress:0,schema:t,documentType:o(t),result:null,error:null,onComplete:n,startTime:new Date},r({type:"ADD_EXTRACTION",extraction:s}),[4,l(a,e,t,n,s.documentType)];case 2:return d.sent(),[2,a];case 3:throw c=d.sent(),r({type:"UPDATE_EXTRACTION",id:a,updates:{status:"error",error:c.message,endTime:new Date}}),c;case 4:return[2]}}
1))}));return function(t){return e.apply(this,arguments)}}(),[r]),l=(0,a.useCallback)(function(){var e=(0,C.Z)((function(e,t,n,i,a){var o,s,l,c,u,d,m;return(0,w.__generator)(this,(function(f){switch(f.label){case 0:if(f.trys.push([0,7,,8]),console.log("processExtraction - extractionId:",e,"onComplete:",i,"documentType:",a),o=t,!function(e){return e&&"application/pdf"===e.type}(t))return[3,4];console.log("PDF d\xe9tect\xe9, conversion en image..."),r({type:"UPDATE_EXTRACTION",id:e,updates:{status:"converting",progress:25}}),f.label=1;case 1:return f.trys.push([1,3,,4]),[4,H(t,{scale:2,quality:.85,format:"jpeg",maxPages:4})];case 2:return o=f.sent(),console.log("PDF converti: ".concat(t.name," \u2192 ").concat(o.name)),s=URL.createObjectURL(o),console.log("%c\ud83d\uddbc\ufe0f IMAGE CONVERTIE - Cliquez pour ouvrir dans un nouvel onglet","background: #4CAF50; color: white; padding: 4px 8px; border-radius: 3px; font-weight: bold;"),console.log("Fichier: ".concat(o.name)),console.log("Taille: ".concat((o.size/1024).toFixed(1)," KB")),console.log("URL: ".concat(s)),r({type:"UPDATE_EXTRACTION",id:e,updates:{convertedImageUrl:s,convertedFileName:o.name}}),[3,4];case 3:throw l=f.sent(),console.error("Erreur de conversion PDF:",l),new Error("Impossible de convertir le PDF: ".concat(l.message));case 4:return r({type:"UPDATE_EXTRACTION",id:e,updates:{status:"processing",progress:50}}),(c=new FormData).append("document",o),n&&c.append("schema",JSON.stringify(n)),"https://perceval-ia-assurance-auto-production.osc-fr1.scalingo.io/ocr",[4,fetch("https://perceval-ia-assurance-auto-production.osc-fr1.scalingo.io/ocr",{method:"POST",headers:{"X-API-Key":"XUuajpUhcMP8ZdFysWKV"},body:c})];case 5:return[4,f.sent().json()];case 6:if(!(u=f.sent()).success)throw new Error(u.error||"Erreur inconnue lors de l'extraction");return console.log("Extraction r\xe9ussie, donn\xe9es:",u.extracted_data),i&&u.extracted_data?(console.log("Appel du callback onComplete avec:",u.extracted_data,a),d=function(e,t){if(!e||"object"!==typeof e)return console.warn("formatExtractedOCRDataFromSchema: extractedData invalide",e),e;if(!t||"object"!==typeof t)return console.warn("formatExtractedOCRDataFromSchema: schema invalide",t),e;console.log("formatExtractedOCRDataFromSchema - extractedData:",e),console.log("formatExtractedOCRDataFromSchema - schema:",t);var n={};return Object.entries(e).forEach((function(e){var r=(0,p.Z)(e,2),i=r[0],a=r[1],o=t[i];if(o&&o.type){var s=z(a,o.type);n[i]=s,console.log("Formatage ".concat(i,': "').concat(a,'" (').concat(o.type,') -> "').concat(s,'"'))}else n[i]=a,console.log("Pas de formatage pour ".concat(i,': "').concat(a,'" (pas de config)'))})),console.log("formatExtractedOCRDataFromSchema - r\xe9sultat:",n),n}(u.extracted_data,n),i(d,a)):console.log("Callback non appel\xe9 - onComplete:",i,"data.extracted_data:",u.extracted_data),r({type:"UPDATE_EXTRACTION",id:e,updates:{status:"completed",progress:100,result:u,endTime:new Date}}),[3,8];case 7:return m=f.sent(),r({type:"UPDATE_EXTRACTION",id:e,updates:{status:"error",error:m.message,endTime:new Date}}),[3,8];case 8:return[2]}}
1))}));return function(t,n,r,i,a){return e.apply(this,arguments)}}(),[r]),c=(0,a.useCallback)((function(t){var n=e[t];(null===n||void 0===n?void 0:n.convertedImageUrl)&&URL.revokeObjectURL(n.convertedImageUrl),r({type:"REMOVE_EXTRACTION",id:t})}),[r,e]),u=(0,a.useCallback)((function(){r({type:"CLEAR_COMPLETED"})}),[r]),d=(0,a.useCallback)((function(){r({type:"TOGGLE_WIDGET"})}),[r]),m=(0,a.useCallback)((function(){r({type:"CLOSE_WIDGET"})}),[r]),h=(0,a.useCallback)((function(){r({type:"OPEN_WIDGET"})}),[r]);return{extractions:e,isWidgetOpen:t,stats:n,startExtraction:s,removeExtraction:c,clearCompleted:u,toggleWidget:d,closeWidget:m,openWidget:h}},Y=function(e){var t=(0,a.useState)(!1),n=t[0],r=t[1];return{isDragOver:n,dragHandlers:{onDragOver:(0,a.useCallback)((function(e){e.preventDefault(),r(!0)}),[]),onDragLeave:(0,a.useCallback)((function(e){e.preventDefault(),r(!1)}),[]),onDrop:(0,a.useCallback)((function(t){t.preventDefault(),r(!1);var n=t.dataTransfer.files;n.length>0&&e&&e(n[0])}),[e])}}},X=n(758120),$=n.n(X),ee=(0,a.forwardRef)((function(e,t){var n=e.schema,r=e.onDataExtracted,o=e.onFileDrop,s=e.onFileUploaded,l=e.title,c=e.documentType,u=e.description,d=e.isUploaded,m=void 0!==d&&d,p=(0,a.useRef)(null),f=(0,a.useState)(!1),h=f[0],v=f[1],g=J(),_=g.startExtraction,y=g.extractions,E=(g.stats,g.removeExtraction),S=function(){var e=(0,C.Z)((function(e){var t;return(0,w.__generator)(this,(function(i){switch(i.label){case 0:console.log("AssistantOCR - processFile appel\xe9 avec:",e,"schema:",n,"onDataExtracted:",r),i.label=1;case 1:return i.trys.push([1,3,,4]),s&&s(),[4,_(e,n,r)];case 2:return i.sent(),[3,4];case 3:return t=i.sent(),A.Am.error(t.message||"Une erreur est survenue lors de l'envoi du document."),[3,4];case 4:return[2]}}
1))}));return function(t){return e.apply(this,arguments)}}();(0,a.useImperativeHandle)(t,(function(){return{processFile:function(e){o&&o(e),S(e)}}}));var I=Y(S),N=I.isDragOver,T=I.dragHandlers,j=c,R=Object.values(y).find((function(e){return e.documentType===j&&["uploading","processing","converting","error"].includes(e.status)}));return(0,i.jsxs)("div",{className:$().container,children:[R?(0,i.jsx)("div",{className:"".concat($().uploadArea," ").concat($().processing),children:(0,i.jsxs)("div",{className:"text-center",children:[(0,i.jsx)("div",{className:"mb-3",children:function(e){switch(e){case"uploading":return(0,i.jsx)("i",{className:"fas fa-upload text-info"});case"processing":return(0,i.jsx)("i",{className:"fas fa-cog fa-spin text-warning"});case"completed":return(0,i.jsx)("i",{className:"fas fa-check-circle text-success"});case"error":return(0,i.jsx)("i",{className:"fas fa-exclamation-circle text-danger"});default:return(0,i.jsx)("i",{className:"fas fa-file text-muted"})}}(R.status)}),(0,i.jsx)("h5",{className:"mb-2",style:{fontSize:"1.1rem"},children:function(e){return zt[e]||e||"Document"}(R.documentType)}),(0,i.jsx)("p",{className:"text-muted mb-2",style:{fontSize:"0.9rem"},children:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:25;if(e.length<=t)return e;var n=e.split(".").pop(),r=e.substring(0,e.lastIndexOf(".")),i=t-n.length-4;if(i<=0)return"...".concat(n);var a=r.substring(0,Math.ceil(i/2)),o=r.substring(r.length-Math.floor(i/2));return"".concat(a,"...").concat(o,".").concat(n)}(R.fileName)}),(0,i.jsxs)("p",{className:"text-muted mb-3",style:{fontSize:"0.8rem"},children:[function(e){if(0===e)return"0 B";var t=Math.floor(Math.log(e)/Math.log(1024));return parseFloat((e/Math.pow(1024,t)).toFixed(1))+" "+["B","KB","MB","GB"][t]}(R.fileSize)," \u2022"," ",function(e){switch(e){case"uploading":return"Upload en cours...";case"processing":return"Extraction en cours...";case"completed":return"Termin\xe9";case"error":return"Erreur";default:return"En attente"}}(R.status)]}),(0,i.jsx)("div",{className:"progress mx-auto mb-3",style:{height:"6px",width:"80%"},children:(0,i.jsx)("div",{className:"progress-bar bg-primary",style:{width:"".concat(R.progress,"%")}})}),"error"===R.status&&R.error&&(0,i.jsxs)(i.Fragment,{children:[(0,i.jsxs)("div",{className:"alert alert-danger py-2 mt-3",style:{fontSize:"0.8rem"},children:[(0,i.jsx)("i",{className:"fas fa-exclamation-triangle mr-1"}),R.error]}),(0,i.jsxs)("button",{type:"button",className:"btn btn-outline-primary btn-sm mt-2",onClick:function(){return E(R.id)},children:[(0,i.jsx)("i",{className:"fas fa-redo mr-1"}),"R\xe9essayer"]})]})]})}):(0,i.jsxs)("div",(0,b.Z)((0,x.Z)({className:"".concat($().uploadArea," ").concat(N?$().dragover:"")},T),{children:[l&&(0,i.jsxs)("strong",{className:$().title,children:[(0,i.jsx)("i",{className:"fa fa-file mr-2"})," ",l,"RELEVE_INFORMATION"===c&&u&&(0,i.jsx)("i",{className:"fa fa-question-circle shadow",onClick:function(e){e.stopPropagation(),v(!0)},style:{cursor:"pointer",fontSize:"18px",marginLeft:"8px"}})]}),m&&(0,i.jsxs)("div",{style:{backgroundColor:"#d4edda",color:"#155724",padding:"8px 12px",borderRadius:"8px",fontSize:"13px",marginBottom:"12px",display:"flex",alignItems:"center",gap:"8px"},children:[(0,i.jsx)("i",{className:"fas fa-check-circle"}),(0,i.jsx)("span",{children:"Vous avez bien envoy\xe9 ce document"})]}),(0,i.jsxs)("p",{style:{fontSize:14},children:["D\xe9posez votre document ici",(0,i.jsx)("br",{}),"ou"]}),(0,i.jsx)("button",{className:$().uploadBtn,onClick:function(){var e;null===(e=p.current)||void 0===e||e.click()},type:"button",children:"Choisir un fichier"}),(0,i.jsx)("input",{ref:p,type:"file",className:$().fileInput,accept:".jpg,.jpeg,.png,.gif,.webp,.pdf",onChange:function(e){var t=e.target.files[0];t&&(o&&o(t),S(t))}}),(0,i.jsx)("div",{className:$().supportedFormats,children:"Formats : JPG, JPEG, PNG, GIF, WEBP, PDF (max 32 MB)"})]})),h&&(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)("div",{className:"modal fade show",style:{display:"block"},tabIndex:"-1",role:"dialog","aria-hidden":"true",onClick:function(){return v(!1)},children:(0,i.jsx)("div",{className:"modal-dialog modal-dialog-centered",role:"document",onClick:function(e){return e.stopPropagation()},children:(0,i.jsxs)("div",{className:"modal-content",children:[(0,i.jsxs)("div",{className:"modal-header",children:[(0,i.jsxs)("h5",{className:"modal-title",children:[(0,i.jsx)("i",{className:"fa fa-info-circle mr-2 text-primary"}),l]}),(0,i.jsx)("button",{type:"button",className:"close",onClick:function(){return v(!1)},"aria-label":"Close",children:(0,i.jsx)("span",{"aria-hidden":"true",children:"\xd7"})})]}),(0,i.jsx)("div",{className:"modal-body",style:{maxHeight:"70vh",overflowY:"auto"},children:(0,i.jsx)("p",{style:{fontSize:"15px",lineHeight:"1.6",margin:0,whiteSpace:"pre-line",textAlign:"left",paddingLeft:"8px"},children:u})}),(0,i.jsx)("div",{className:"modal-footer",children:(0,i.jsx)("button",{type:"button",className:"btn btn-secondary",onClick:function(){return v(!1)},children:"Fermer"})})]})})}),(0,i.jsx)("div",{className:"modal-backdrop fade show",onClick:function(){return v(!1)}})]})]})}));ee.displayName="AssistantOCR";var te=ee,ne=n(734155),re=(0,f.cn)(null),ie=(0,f.cn)(!1),ae=(0,f.cn)(null),oe=(0,f.cn)([]),se=(0,f.cn)(!1),le=(0,f.cn)(null),ce=(0,f.cn)("true"===ne.env.MOCK_FORM),ue=(0,f.cn)(!0),de=(0,f.cn)({}),me=(0,f.cn)([]),pe=(0,f.cn)(null),fe=(0,f.cn)(!1),he=(0,f.cn)(null),ve=(0,f.cn)({}),ge=(0,f.cn)(null),xe=function(e){var t=e.documentType,n=e.text,r=(0,a.useState)(!1),o=r[0],s=r[1],l=(0,p.Z)((0,f.KO)($e),1)[0],c=rt().actions,u=(0,f.Dv)(he),d=(0,a.useState)(!1),m=d[0],h=d[1],v=(0,a.useRef)(null),g=(0,a.useRef)(0),x=function(){s(!1)},_=function(){var e=(0,C.Z)((function(e){return(0,w.__generator)(this,(function(n){switch(n.label){case 0:return u?[4,u(e,qt[t]||t)]:[3,2];case 1:n.sent(),n.label=2;case 2:return[2]}}
1))}));return function(t){return e.apply(this,arguments)}}(),b=(0,a.useCallback)((function(e){e.preventDefault(),g.current++,h(!0)}),[]),y=(0,a.useCallback)((function(e){e.preventDefault()}),[]),E=(0,a.useCallback)((function(e){e.preventDefault(),g.current--,g.current<=0&&(g.current=0,h(!1))}),[]),S=(0,a.useCallback)((function(e){e.preventDefault(),e.stopPropagation(),g.current=0,h(!1);var t=e.dataTransfer.files;t.length>0&&v.current&&v.current.processFile(t[0])}),[]);return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(R,{text:"Scannez ce document pour gagner du temps",children:(0,i.jsx)("button",{className:"btn btn-default border-0 px-2 py-1",style:{minHeight:"unset",color:"#7b2bef"},onClick:function(){s(!0)},tabIndex:-1,children:n})}),o&&(0,i.jsxs)("div",{className:"modal fade show",style:{display:"block",zIndex:1050},tabIndex:"-1",role:"dialog","aria-hidden":"true",onClick:x,onDragEnter:b,onDragOver:y,onDragLeave:E,onDrop:S,children:[m&&(0,i.jsx)("div",{style:{position:"fixed",inset:0,zIndex:1060,background:"rgba(79, 70, 229, 0.08)",border:"4px dashed #4f46e5",display:"flex",alignItems:"center",justifyContent:"center",pointerEvents:"none"},children:(0,i.jsxs)("div",{style:{background:"#fff",borderRadius:"20px",padding:"40px 60px",boxShadow:"0 8px 32px rgba(79,70,229,0.18)",textAlign:"center"},children:[(0,i.jsx)("i",{className:"fas fa-cloud-upload-alt",style:{fontSize:"48px",color:"#4f46e5",marginBottom:"12px"}}),(0,i.jsx)("p",{style:{fontSize:"20px",fontWeight:"700",color:"#4f46e5",margin:0},children:"D\xe9posez votre fichier ici"})]})}),(0,i.jsx)("div",{className:"modal-dialog modal-lg",role:"document",onClick:function(e){return e.stopPropagation()},children:(0,i.jsxs)("div",{className:"modal-content",children:[(0,i.jsxs)("div",{className:"modal-header",children:[(0,i.jsx)("h5",{className:"modal-title",children:zt[t]}),(0,i.jsx)("button",{type:"button",className:"close",onClick:x,"aria-label":"Close",children:(0,i.jsx)("span",{"aria-hidden":"true",children:"\xd7"})})]}),(0,i.jsxs)("div",{className:"modal-body",children:[Zt[t]&&(0,i.jsx)("div",{className:"d-flex justify-content-center align-items-end",style:{gap:"16px",marginBottom:"20px"},children:Zt[t].map((function(e,n){return(0,i.jsxs)("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",gap:"8px"},children:[(0,i.jsx)("img",{src:e.src,alt:e.alt,style:{maxHeight:Zt[t].length>1?"100px":"130px",maxWidth:"100%",objectFit:"contain",borderRadius:"8px",boxShadow:"0 2px 8px rgba(0,0,0,0.1)"}}),Zt[t].length>1&&(0,i.jsx)("span",{style:{fontSize:"11px",color:"#6b7280",fontWeight:"500"},children:e.alt})]},n)}))}),(0,i.jsx)(te,{ref:v,schema:l[t],onDataExtracted:function(e,t){console.log("OpenOCRModalButton - handleDataExtracted appel\xe9 avec:",e,t),console.log("OpenOCRModalButton - actions.onOCRDataReceived:",c.onOCRDataReceived),c.onOCRDataReceived(e,t),x()},onFileDrop:_,onFileUploaded:function(){x(),c.onOCRUploadStarted(qt[t]||t)},documentType:qt[t]||t})]}),(0,i.jsx)("div",{className:"modal-footer",children:(0,i.jsx)("button",{type:"button",className:"btn btn-secondary",onClick:x,children:"Fermer"})})]})})]}),o&&(0,i.jsx)("div",{className:"modal-backdrop fade show",style:{zIndex:1040},onClick:x})]})},_e=n(597206),be=function(e){var t=e.goToFirstIncompleteStep,n=(0,p.Z)((0,N.Z)(),2),r=n[0],a=n[1],o=(0,I.n)(r,a);return(0,i.jsxs)("div",{className:"text-center",style:{maxWidth:"500px",margin:"0 auto"},children:[(0,i.jsxs)("div",{className:"mb-3",children:[(0,i.jsx)("div",{className:"d-inline-flex align-items-center justify-content-center bg-success rounded-circle mb-2",style:{width:"56px",height:"56px"},children:(0,i.jsx)("i",{className:"fas fa-check text-white",style:{fontSize:"1.75rem"}})}),(0,i.jsx)("h5",{className:"font-weight-bold mb-1",style:{fontSize:"1.25rem"},children:"Session vocale termin\xe9e"}),(0,i.jsx)("p",{className:"text-muted mb-0",style:{fontSize:"0.9rem"},children:"Vos r\xe9ponses ont \xe9t\xe9 int\xe9gr\xe9es automatiquement"})]}),(0,i.jsx)("div",{className:"mb-3 p-3 text-left",style:{background:"#f8f9fa",borderRadius:"12px",border:"1px solid #e9ecef"},children:(0,i.jsxs)("div",{className:"d-flex align-items-start",children:[(0,i.jsx)("div",{className:"d-flex align-items-center justify-content-center bg-success rounded-circle mr-3",style:{width:"40px",height:"40px",minWidth:"40px",flexShrink:0},children:(0,i.jsx)("i",{className:"fas fa-magic text-white",style:{fontSize:"1rem"}})}),(0,i.jsxs)("div",{children:[(0,i.jsx)("h6",{className:"font-weight-bold mb-1",style:{fontSize:"0.95rem"},children:"Remplissage automatique effectu\xe9"}),(0,i.jsx)("p",{className:"text-muted mb-0",style:{fontSize:"0.85rem",lineHeight:"1.4"},children:"Vos r\xe9ponses vocales ont \xe9t\xe9 analys\xe9es et saisies dans le formulaire."})]})]})}),(0,i.jsxs)("button",{className:"btn btn-primary w-100 mb-3",onClick:function(){o.updateModal({isOpen:!1,content:null}),setTimeout((function(){t()}),100)},style:{borderRadius:"10px",padding:"0.875rem 1.5rem",fontSize:"1rem",fontWeight:"600",transition:"all 0.2s ease",boxShadow:"0 2px 8px rgba(0, 123, 255, 0.15)"},onMouseEnter:function(e){e.target.style.transform="translateY(-1px)",e.target.style.boxShadow="0 4px 12px rgba(0, 123, 255, 0.25)"},onMouseLeave:function(e){e.target.style.transform="translateY(0)",e.target.style.boxShadow="0 2px 8px rgba(0, 123, 255, 0.15)"},children:[(0,i.jsx)("i",{className:"fas fa-arrow-right mr-2"}),"Continuer le questionnaire"]}),(0,i.jsxs)("div",{className:"d-flex align-items-center justify-content-center",children:[(0,i.jsx)("i",{className:"fas fa-info-circle text-muted mr-2",style:{fontSize:"0.875rem"}}),(0,i.jsx)("small",{className:"text-muted",style:{fontSize:"0.8rem"},children:"Vous pourrez modifier vos r\xe9ponses \xe0 tout moment"})]})]})},ye=function(){return(0,i.jsx)("div",{className:"text-center",style:{maxWidth:"500px",margin:"0 auto"},children:(0,i.jsxs)("div",{className:"mb-3",children:[(0,i.jsx)("div",{className:"d-inline-flex align-items-center justify-content-center rounded-circle mb-2",style:{width:"56px",height:"56px",background:"linear-gradient(135deg, #4f46e5, #7c3aed)"},children:(0,i.jsx)("i",{className:"fas fa-paper-plane text-white",style:{fontSize:"1.5rem"}})}),(0,i.jsx)("h5",{className:"font-weight-bold mt-2",style:{fontSize:"1.25rem"},children:"Finalisation de votre demande"}),(0,i.jsx)("div",{className:"spinner-border mt-2",role:"status",style:{color:"#4f46e5",width:"1.5rem",height:"1.5rem"},children:(0,i.jsx)("span",{className:"sr-only",children:"Chargement..."})})]})})},Ee=function(e,t){if(!e||!t)return!0;
1if(Array.isArray(e))return e.every((function(e){return Ee(e,t)}));var n=t[e.dependsOn];if(void 0===n||null===n||""===n)return!1;switch(e.operator||"equals"){case"equals":return n===e.value||"string"===typeof n&&"oui"===n.toLowerCase()&&!0===e.value||"string"===typeof n&&"non"===n.toLowerCase()&&!1===e.value;case"not_equals":return n!==e.value;case"greater_than":return Number(n)>e.value;case"less_than":return Number(n)<e.value;case"contains":return"string"===typeof n&&n.toLowerCase().includes(e.value.toLowerCase());case"in":return Array.isArray(e.value)&&e.value.includes(n);case"not_in":return Array.isArray(e.value)&&!e.value.includes(n);case"within_months":var r=Number(e.value);if(isNaN(r))return!1;var i=g.ou.fromISO(String(n));return!!i.isValid&&i>=g.ou.now().minus({months:r});default:return!1}},Se=function(e,t){if(!e||!t)return!0;if(Array.isArray(e))return e.every((function(e){return Se(e,t)}));var n=t[e.dependsOn];return void 0===n||null===n||""===n||Ee(e,t)},Ie={essentiel:[],confort:["garantie_assistance_active"],serenite:["garantie_accessoires_amenagements_active","garantie_assistance_active"]},Ne=["garantie_du_conducteur_active","garantie_accessoires_amenagements_active","garantie_assistance_active","garantie_protection_juridique_active","garantie_vehicule_remplacement_active","garantie_rupture_activite_active","garantie_indemnisation_valeur_majoree_active","garantie_remboursement_credit_active","garantie_pack_valeur_neuf_active"],Ce=function(e,t,n,r,i){console.log("\ud83d\udccb Changement de formule: ".concat(t," \u2192 ").concat(n));var a=(0,x.Z)({},e),o=Ie[n]||[];(o.forEach((function(e){a[e]="1",console.log("\u2705 Garantie activ\xe9e automatiquement: ".concat(e))})),t&&Ie[t])&&Ie[t].forEach((function(e){o.includes(e)||(a[e]="",console.log("\u274c Garantie d\xe9sactiv\xe9e: ".concat(e)))}));return Ne.forEach((function(e){var t=r[e];t&&t.condition&&(i(t.condition,(0,b.Z)((0,x.Z)({},a),{formule:n}))||o.includes(e)||(a[e]="",console.log("\ud83d\udeab Garantie non disponible d\xe9sactiv\xe9e: ".concat(e))))})),a};function we(e,t){return null!=t&&"undefined"!==typeof Symbol&&t[Symbol.hasInstance]?!!t[Symbol.hasInstance](e):e instanceof t}var Te=n(409669),je=n.n(Te)().create({withCredentials:!0,headers:{"Content-Type":"application/json"}}),Re=(0,f.cn)(null),Ae=(0,f.cn)(!1),ke="https://graal-api.goperceval.fr/api/",Oe=!1,Pe=null,De=function(){var e=(0,C.Z)((function(){return(0,w.__generator)(this,(function(e){return Oe&&Pe||(Oe=!0,Pe=(0,C.Z)((function(){var e,t;return(0,w.__generator)(this,(function(n){switch(n.label){case 0:return n.trys.push([0,2,3,4]),[4,je.post("".concat(ke,"login"),{},{headers:{"X-API-KEY":"FSOG9rOx6OgZ6qu8LdULIqyaeEfR2yffKLdW4op7"}})];case 1:return(e=n.sent()).data.token?(je.defaults.headers.common.Authorization="Bearer ".concat(e.data.token),[2,{success:!0,data:e.data}]):[2,{success:!1,error:"Jeton de connexion \xe0 graal-api invalide"}];case 2:return t=n.sent(),console.error("Erreur d'authentification graal-api:",t),[2,{success:!1,error:"Erreur lors de l'authentification avec graal-api"}];case 3:return Oe=!1,Pe=null,[7];case 4:return[2]}}
1))}))()),[2,Pe]}))}));return function(){return e.apply(this,arguments)}}(),Le=function(){var e=(0,C.Z)((function(e,t){var n,r,i,a,o;return(0,w.__generator)(this,(function(s){switch(s.label){case 0:return je.defaults.headers.common.Authorization?[3,2]:[4,De()];case 1:if(!(n=s.sent()).success)throw new Error(n.error);s.label=2;case 2:r=we(t,FormData),i=r?{}:{"Content-Type":"application/json"},s.label=3;case 3:return s.trys.push([3,5,,9]),[4,je.post("".concat(ke).concat(e),t,{headers:i})];case 4:return[2,s.sent().data];case 5:return a=s.sent(),401!==(null===(o=a.response)||void 0===o?void 0:o.status)?[3,8]:(delete je.defaults.headers.common.Authorization,[4,De()]);case 6:return s.sent().success?[4,je.post("".concat(ke).concat(e),t,{headers:i})]:[3,8];case 7:return[2,s.sent().data];case 8:throw a;case 9:return[2]}}))}));return function(t,n){return e.apply(this,arguments)}}(),Me=function(){var e=(0,C.Z)((function(e,t){var n,r,i,a,o;return(0,w.__generator)(this,(function(s){switch(s.label){case 0:return je.defaults.headers.common.Authorization?[3,2]:[4,De()];case 1:if(!(n=s.sent()).success)throw new Error(n.error);s.label=2;case 2:r=we(t,FormData),i=r?{}:{"Content-Type":"application/json"},s.label=3;case 3:return s.trys.push([3,5,,9]),[4,je.patch("".concat(ke).concat(e),t,{headers:i})];case 4:return[2,s.sent().data];case 5:return a=s.sent(),401!==(null===(o=a.response)||void 0===o?void 0:o.status)?[3,8]:(delete je.defaults.headers.common.Authorization,[4,De()]);case 6:return s.sent().success?[4,je.patch("".concat(ke).concat(e),t,{headers:i})]:[3,8];case 7:return[2,s.sent().data];case 8:throw a;case 9:return[2]}}
1))}));return function(t,n){return e.apply(this,arguments)}}(),Ue=function(){var e=(0,p.Z)((0,f.KO)(Re),2),t=e[0],n=e[1],r=(0,p.Z)((0,f.KO)(Ae),2),i=r[0],o=r[1],s=(0,a.useState)(""),l=s[0],c=s[1],u=(0,a.useCallback)((0,C.Z)((function(){var e;return(0,w.__generator)(this,(function(t){switch(t.label){case 0:return[4,De()];case 1:return(e=t.sent()).success?(n(e.data),o(!0),c("")):(c(e.error),o(!1)),[2,e.success]}}))})),[n,o]),d=(0,a.useCallback)(function(){var e=(0,C.Z)((function(e,t){return(0,w.__generator)(this,(function(n){return[2,Le(e,t)]}))}));return function(t,n){return e.apply(this,arguments)}}(),[]),m=(0,a.useCallback)(function(){var e=(0,C.Z)((function(e,t){return(0,w.__generator)(this,(function(n){return[2,Me(e,t)]}))}));return function(t,n){return e.apply(this,arguments)}}(),[]);return{graalApiAuth:t,isGraalAuthenticated:i,graalApiError:l,actions:{authenticateWithGraalApi:u,postToGraalApi:d,patchToGraalApi:m}}},qe=null,ze=!1,Ze=!1,Fe=null,Be=null,Ve=!1,Qe=null,Ge=null,We=function(e){Ve&&(Ze&&Be?(qe&&clearTimeout(qe),Ge=e,qe=setTimeout((function(){qe=null,Ge=null,Qe&&Qe(e,Be)}),1500)):console.log("[LeadPersistence] Lead pas encore cr\xe9\xe9, sauvegarde ignor\xe9e"))},He=function(){var e=(0,C.Z)((function(){var e,t;return(0,w.__generator)(this,(function(n){switch(n.label){case 0:if(qe&&(clearTimeout(qe),qe=null),!Ge||!Qe)return[2];e=Ge,Ge=null,t=0,n.label=1;case 1:return t<30&&ze?[4,new Promise((function(e){return setTimeout(e,100)}))]:[3,4];case 2:n.sent(),n.label=3;case 3:return t++,[3,1];case 4:return[4,Qe(e,Be)];case 5:return n.sent(),[2]}}))}));return function(){return e.apply(this,arguments)}}(),Ke=function(e){var t,n,r,i=(0,p.Z)((0,N.Z)(),1)[0],o=(0,p.Z)((0,f.KO)(re),1)[0],s=(0,f.b9)(re),l=(0,p.Z)((0,f.KO)(pe),2),c=l[0],u=l[1],d=(0,p.Z)((0,f.KO)(fe),2),m=d[0],h=d[1],g=(0,f.b9)(ce),_=(0,f.b9)(he),y=(0,f.b9)(ve),E=(0,a.useState)(!1),I=E[0],T=E[1],j=(0,a.useState)(null),R=j[0],k=j[1],O=i.auth.isAuthenticated,P=Ue().actions;(0,a.useEffect)((function(){Be=c}),[c]),(0,a.useEffect)((function(){Ve=O}),[O]),(0,a.useEffect)((function(){var e;null===(e=i.auth.user)||void 0===e?void 0:e.id}),[null===(t=i.auth.user)||void 0===t?void 0:t.id]);var D=(0,a.useRef)(null===(n=i.auth.user)||void 0===n?void 0:n.id);(0,a.useEffect)((function(){var e;D.current=null===(e=i.auth.user)||void 0===e?void 0:e.id}),[null===(r=i.auth.user)||void 0===r?void 0:r.id]);var L=(0,a.useCallback)(function(){var e=(0,C.Z)((function(e,t){var n,r,i,a,o,s,l,c,d,m,p,f;return(0,w.__generator)(this,(function(v){switch(v.label){case 0:if(ze)return console.log("[LeadPersistence] Sauvegarde d\xe9j\xe0 en cours, replanification"),Ge=e,qe&&clearTimeout(qe),qe=setTimeout((function(){qe=null,Ge=null,Qe&&Qe(e,Be||t)}),500),[2];if(!e)return[2];if(n=JSON.stringify(e),Fe===n&&t)return console.log("[LeadPersistence] \xc9tat identique, pas de sauvegarde"),[2];r=(0,b.Z)((0,x.Z)({},e),{type_produit:"AUTO",id:t||null,id_utilisateur:D.current||null}),ze=!0,h(!0),v.label=1;case 1:return v.trys.push([1,3,4,5]),console.log("[LeadPersistence] Sauvegarde en cours...",t?"UPDATE":"CREATE"),console.log("[LeadPersistence] Payload:",JSON.stringify(r,null,2)),console.log("[LeadPersistence] type_produit type:",(0,S.Z)(r.type_produit),r.type_produit),[4,P.postToGraalApi("new-leads",r)];case 2:a=v.sent(),Fe=n,(o=(null===(i=a.data)||void 0===i?void 0:i.uuid)||a.uuid)&&!t?(u(o),Be=o,Ze=!0,console.log("[LeadPersistence] Lead cr\xe9\xe9 avec l'ID:",o)):console.log("[LeadPersistence] Lead mis \xe0 jour:",t);try{s=(0,b.Z)((0,x.Z)({},e),{lead_id:o||t}),localStorage.setItem("perceval_form_state",JSON.stringify(s)),console.log("[LeadPersistence] localStorage mis \xe0 jour avec lead_id:",o||t)}catch(g){console.error("[LeadPersistence] Erreur mise \xe0 jour localStorage:",g)}return[3,5];case 3:return l=v.sent(),console.error("[LeadPersistence] Erreur:",l),(null===(c=l.response)||void 0===c||null===(d=c.data)||void 0===d?void 0:d.message)?A.Am.error(l.response.data.message):(null===(m=l.response)||void 0===m||null===(p=m.data)||void 0===p?void 0:p.errors)?(f=Object.values(l.response.data.errors)[0],Array.isArray(f)&&f.length>0?A.Am.error(f[0]):A.Am.error("Une erreur est survenue lors de l'enregistrement.")):A.Am.error("Une erreur est survenue lors de l'enregistrement."),[3,5];case 4:return ze=!1,h(!1),[7];case 5:return[2]}}
1))}));return function(t,n){return e.apply(this,arguments)}}(),[P,u,h]);(0,a.useEffect)((function(){Qe=L}),[L]);var M=(0,a.useCallback)(function(){var e=(0,C.Z)((function(e,t){var n,r,i;return(0,w.__generator)(this,(function(a){switch(a.label){case 0:if(!c)return console.error("[LeadPersistence] Impossible d'uploader le document: pas de lead_id"),A.Am.error("Erreur lors de l'upload du document. Veuillez r\xe9essayer."),[2,{success:!1,error:"No lead ID"}];(n=new FormData).append("file",e),n.append("type",t),a.label=1;case 1:return a.trys.push([1,3,,4]),console.log("[LeadPersistence] Upload du document ".concat(t," pour le lead ").concat(c)),[4,P.postToGraalApi("new-leads/".concat(c,"/ajouter-document"),n)];case 2:return r=a.sent(),console.log("[LeadPersistence] Upload r\xe9ussi pour ".concat(t),r),y((function(e){return(0,b.Z)((0,x.Z)({},e),(0,v.Z)({},t,!0))})),[2,{success:!0,data:r}];case 3:return i=a.sent(),console.error("[LeadPersistence] Erreur lors de l'upload du document ".concat(t,":"),i),A.Am.error("Une erreur est survenue lors de l'upload du document. Veuillez r\xe9essayer."),[2,{success:!1,error:i}];case 4:return[2]}}
1))}));return function(t,n){return e.apply(this,arguments)}}(),[c,P]);(0,a.useEffect)((function(){_((function(){return M}))}),[M,_]);var U=(0,a.useRef)(!1);(0,a.useEffect)((function(){var e=(null===o||void 0===o?void 0:o.email_utilisateur)&&(null===o||void 0===o?void 0:o.user_id);if(O&&o&&e&&!Ze&&!U.current){try{var t=localStorage.getItem("perceval_form_state");if(t){var n=JSON.parse(t);if(n&&Object.keys(n).length>0){console.log("[LeadPersistence] FormState trouv\xe9 en localStorage, pas de cr\xe9ation de lead");var r=n.user_id,i=D.current;return r&&i&&r===i?(console.log("[LeadPersistence] Le lead appartient \xe0 l'utilisateur connect\xe9 (user_id:",i,") - Affichage de la modal"),k(n),T(!0),void(U.current=!0)):r&&i&&r!==i?(console.log("[LeadPersistence] Le lead appartient \xe0 un autre utilisateur (saved:",r,"/ current:",i,") - Reset et cr\xe9ation d'un nouveau lead"),localStorage.removeItem("perceval_form_state"),u(null),Be=null,Ze=!1,U.current=!0,console.log("[LeadPersistence] Cr\xe9ation d'un nouveau lead pour l'utilisateur actuel"),void L(o,null)):(r||(console.log("[LeadPersistence] Pas de user_id dans le lead sauvegard\xe9 - Affichage de la modal"),k(n),T(!0)),void(U.current=!0))}}}catch(a){console.error("[LeadPersistence] Erreur lecture localStorage:",a)}U.current=!0,console.log("[LeadPersistence] Cr\xe9ation initiale du lead"),L(o,null)}}),[O,o,L]);var q=(0,a.useCallback)((function(){R&&(console.log("[LeadPersistence] Reprise du lead existant"),s(R),T(!1),R.lead_id&&(u(R.lead_id),Be=R.lead_id,console.log("[LeadPersistence] Lead ID restaur\xe9:",R.lead_id)),Ze=!0,g(!0),e&&setTimeout((function(){e(R)}),400))}),[R,s,u,g,e]),z=(0,a.useCallback)((function(){console.log("[LeadPersistence] Recommencer de z\xe9ro"),localStorage.removeItem("perceval_form_state"),T(!1),u(null),Be=null,Ze=!1,console.log("[LeadPersistence] Cr\xe9ation d'un n
1ouveau lead"),L(o,null)}),[u,L,o]);return{leadId:c,isSavingLead:m,showModal:I,handleResumeLead:q,handleRestartLead:z,uploadDocument:M}},Je={civilite_utilisateur:"1",nom_utilisateur:"Dupont",prenom_utilisateur:"Jean",telephone_utilisateur:"0692123456",email_utilisateur:"[email protected]",marque_vehicule:"Peugeot",modele_vehicule:"308",version_vehicule:"Allure",immatriculation_vehicule:"FG-123-HJ",energie_vehicule:"ES",puissance_fiscale:"7",carrosserie_vehicule:"berline",date_acquisition:"2015-11-23",date_premiere_circulation:"2015-11-23",financement_vehicule:"comptant",lieu_garage:"saint_denis",type_garage:"ferme",usage_vehicule:"prive_travail",kilometrage_annuel:"15000",commune_utilisateur:"saint_denis",conducteur1_date_naissance:"1988-11-23",conducteur1_date_permis:"2015-11-23",conducteur1_bonus_malus:"",sinistres_36_mois:"2",formule:"confort",garantie_du_conducteur_active:"1",garantie_accessoires_amenagements_active:"1",garantie_assistance_active:"",garantie_protection_juridique_active:"1",garantie_vehicule_remplacement_active:"2",garantie_indemnisation_valeur_majoree_active:"1",garantie_remboursement_credit_active:"",garantie_pack_valeur_neuf_active:""},Ye=n(734155),Xe=(0,f.cn)((function(e){var t=e(Vt),n=e(re),r=e(me),i=function(e,n){var r,i=(0,x.Z)({id:e},n.ia_params);if(n.condition&&(i.condition=n.condition),null===(r=n.ia_params)||void 0===r?void 0:r.bloc){var a=n.ia_params.bloc,o=Object.values(t).filter((function(e){var t;return(null===(t=e.ia_params)||void 0===t?void 0:t.bloc)===a})).length;i.totalQuestionsInBlock=o}return n.datas&&Array.isArray(n.datas)&&(i.options=n.datas.map((function(e){return{id:e.id,label:e.name,description:e.description||null}}))),i};return t?n?{questions:Object.entries(t).filter((function(e){var t=(0,p.Z)(e,2),i=t[0],a=t[1],o=n[i],s=void 0===o||o==a.defaultValue||!o,l=a.ia_params,c=!r.includes(i),u=Se(a.condition,n);return s&&l&&c&&u})).map((function(e){var t=(0,p.Z)(e,2),n=t[0],r=t[1];return i(n,r)}))}:{questions:Object.entries(t).filter((function(e){return(0,p.Z)(e,2)[1].ia_params})).filter((function(e){var t=(0,p.Z)(e,1)[0];return!r.includes(t)})).map((function(e){var t=(0,p.Z)(e,2),n=t[0],r=t[1];return i(n,r)}))}:{questions:[]}})),$e=(0,f.cn)((function(e){var t=e(Vt);if(!t)return{};var n={};return Object.keys(qt).forEach((function(e){n[e]={}})),Object.entries(t).forEach((function(e){var t=(0,p.Z)(e,2),r=t[0],i=t[1];if(i.ocr_params){var a=i.ocr_params,o=a.document_type,s=(0,y.Z)(a,["document_type"]),l=Object.keys(qt).find((function(e){return qt[e]===o}));l&&(n[l][r]=(0,b.Z)((0,x.Z)({},s),{docType:o}))}})),n})),et=function(e,t){var n=[];return e[t]&&Object.keys(e[t]).forEach((function(e){n.push(e)})),n},tt=["marque_vehicule","modele_vehicule","version_vehicule"],nt=/^[A-Za-z0-9. \xe9\xc9\xe0\xe8\xf9\xc0\xc8\xd9\xe2\xea\xee\xf4\xfb\xc2\xca\xce\xd4\xdb\xeb\xef\xfc\xff\xcb\xcf\xdc\u0178-]*$/,rt=function(){var e=(0,p.Z)((0,N.Z)(),2),t=e[0],n=e[1],r=(0,p.Z)((0,f.KO)(ue),2),a=r[0],o=r[1],s=(0,p.Z)((0,f.KO)(re),2),l=s[0],c=s[1],u=(0,p.Z)((0,f.KO)(de),2),d=u[0],m=u[1],h=(0,p.Z)((0,f.KO)(Vt),2),_=h[0],y=(h[1],(0,p.Z)((0,f.KO)(ie),2)),C=y[0],w=y[1],T=(0,p.Z)((0,f.KO)(ae),2),j=T[0],R=T[1],A=(0,p.Z)((0,f.KO)(me),2),k=A[0],O=A[1],P=(0,p.Z)((0,f.KO)($e),1)[0],D=(0,p.Z)((0,f.KO)(oe),2),L=D[0],M=D[1],U=(0,p.Z)((0,f.KO)(se),2),q=(U[0],U[1]),z=(0,p.Z)((0,f.KO)(le),2),Z=z[0],F=z[1],B=(0,p.Z)((0,f.KO)(ce),2),V=B[0],Q=B[1],G=(0,p.Z)((0,f.KO)(pe),1)[
10],W=(0,I.n)(t,n),H=function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];c((function(n){var r=(0,x.Z)({},n,e);return e.formule&&n&&e.formule!==n.formule&&(r=Ce(r,n.formule,e.formule,_,Ee)),t||We(r),r}))},K=function(e){console.log("INPUT TYPE",e.target);var t=e.target.value;if(["conducteur1_date_naissance","conducteur1_date_permis","date_acquisition","date_premiere_circulation","sinistre1_date","sinistre2_date","sinistre3_date"].includes(e.target.name))t=g.ou.fromJSDate(new Date(e.target.value)).toFormat("yyyy-MM-dd");else if("conducteur1_bonus_malus"===e.target.name){var n=e.target.value.replace(",","."),r=(n=n.replace(/[^\d.-]/g,"")).split(".");r.length>2&&(n=r[0]+"."+r.slice(1).join(""));var i=parseFloat(n);t=isNaN(i)?"":n}if(tt.includes(e.target.name)){var a=!!t&&!nt.test(t);m((function(t){return(0,b.Z)((0,x.Z)({},t),(0,v.Z)({},e.target.name,a?"Les caract\xe8res sp\xe9ciaux ne sont pas autoris\xe9s.":void 0))}))}H((0,v.Z)({},e.target.name,t))},J=function(e){_&&e&&F(e)},Y=function(){var e=function(e){var t=Ut[e],r=Object.entries(_).filter((function(e){var r=(0,p.Z)(e,2),i=(r[0],r[1]),a=i.category===t.id,o=Ee(i.condition,n);return a&&o})).sort((function(e,t){var n=(0,p.Z)(e,2)[1],r=(0,p.Z)(t,2)[1];return(n.order||0)-(r.order||0)})).find((function(e){var t=(0,p.Z)(e,2),r=t[0],i=(t[1],n[r]);return!i||""===i||null===i||void 0===i}));if(r){var i=(0,p.Z)(r,1)[0];return F(null),setTimeout((function(){F(i)}),0),{v:i}}},t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,n=t||l;if(_&&n){for(var r=0;r<Ut.length;r++){var i=e(r);if("object"===(0,S.Z)(i))return i.v}return null}},X=Ut.length,$=function(e){},ee=function(e,t){if(t)return[(0,i.jsx)(_e.Z,{size:20})];var n=[];return e.ocr_params&&n.push((0,i.jsx)(xe,{documentType:e.ocr_params.document_type,text:(0,i.jsxs)("span",{children:[(0,i.jsx)("i",{className:"fa fa-camera"})," ",zt[e.ocr_params.document_type]]})})),n};return{isLoading:a,formState:l,questionsConfig:_,isVocalSessionActive:C,currentVocalQuestion:j,commonInputProps:function(e){var t=!!k.includes(e.name);return{error:d,onBlur:$,change:K,labelClassname:"w-100",fullWidth:!0,required:!e.isBooleanBtnList,btnInline:!0,name:e.name,label:e.label,value:l[e.name],placeholder:e.placeholder||"",labelActions:ee(e,t),datas:e.datas,dataIndex:"id",dataLabel:"name",type:Bt[e.type],disabled:t,isBooleanBtnList:e.isBooleanBtnList,info:e.info,noBg:e.isBooleanBtnList,noPaddingOnFormGroup:e.isBooleanBtnList,containerStyle:{textAlign:"center",borderRadius:40,borderBottom:e.isBooleanBtnList?"0":"3px solid #d4d4d4"},innerLabelStyle:{color:"#4f46e5",fontSize:"1.4rem",fontWeight:"800",lineHeight:"1.9rem",paddingRight:0},inputStyle:{textAlign:"center"},noRounded:!0,noShadow:!0}
1},totalSteps:X,steps:Ut,currentQuestionId:Z,showStepsAfterVocal:V,isFormComplete:function(){var e=function(e){var t=Ut[e];return"garanties"===t.id?"continue":Object.entries(_).filter((function(e){var r=(0,p.Z)(e,2),i=(r[0],r[1]),a=i.category===t.id,o=Ee(i.condition,n);return a&&o})).some((function(e){var t=(0,p.Z)(e,2),r=t[0],i=(t[1],n[r]);return!i||""===i||null===i||void 0===i}))?{v:!1}:void 0},t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,n=t||l;if(!_||!n)return!1;for(var r=0;r<Ut.length;r++){var i=e(r);if("object"===(0,S.Z)(i))return i.v}return!0}(),leadId:G,actions:{initializeFormState:function(){var e={};(Object.keys(_).forEach((function(t){e[t]=_[t].defaultValue})),"true"===Ye.env.MOCK_FORM)&&(function(){try{var e=localStorage.getItem("perceval_form_state");return e&&JSON.parse(e)&&Object.keys(JSON.parse(e)).length>0}catch(t){return!1}}()?console.log("[MOCK] Lead existant trouv\xe9 en localStorage, mock ignor\xe9"):(console.log("[MOCK] Pr\xe9-remplissage du formulaire avec les donn\xe9es mock"),Object.keys(Je).forEach((function(t){t in e&&(e[t]=Je[t])}))));var t=sessionStorage.getItem("perceval_utm_source");t&&/^[A-Za-z0-9_-]{1,50}$/.test(t)&&(e.source_lead=t),H(e,!0),o(!1)},onChangeInput:K,onUpdatePartialFormState:function(e,t){e&&"object"===typeof e&&(H((0,x.Z)({},e)),t&&console.log("Question r\xe9pondue par l'assistant vocal: ".concat(t),e[t]))},onUpdateVocalSessionState:function(e,t){w(e),e||(q(!1),"form_submitted"===t?W.updateModal({isOpen:!0,title:"",content:(0,i.jsx)(ye,{})}):W.updateModal({isOpen:!0,title:"Fin de la session vocale",content:(0,i.jsx)(be,{goToFirstIncompleteStep:Y})}))},onUpdateCurrentVocalQuestion:function(e){R(e),console.log("Question vocale actuelle",e),e&&J(e)},onOCRUploadStarted:function(e){console.log("onOCRUploadStarted",e);var t=et(P,e);console.log("Questions \xe0 d\xe9sactiver pour",e,":",t),O((function(e){var n=(0,E.Z)(e);return t.forEach((function(e){n.includes(e)||n.push(e)})),n}))},onOCRDataReceived:function(e,t){if(console.log("Donn\xe9es OCR re\xe7ues:",e),console.log("Type de document upload\xe9:",t),e&&"object"===typeof e){var n=et(P,t);console.log("Questions \xe0 r\xe9activer pour",t,":",n),O((function(e){return e.filter((function(e){return!n.includes(e)}))})),H((0,x.Z)({},e)),t&&!L.includes(t)&&M((function(e){return(0,E.Z)(e).concat([t])})),console.log("Donn\xe9es OCR re\xe7ues et int\xe9gr\xe9es au formulaire:",e),console.log("Type de document upload\xe9:",t)}},onOpenAssistantVocal:function(){q(!0),Q(!0)},onCloseAssistantVocal:function(){q(!1)},onShowStepsAfterVocal:function(){Q(!0)},goToQuestion:J,goToFirstIncompleteQuestion:Y}}},it=function(e){var t=e.category,n=e.wrapperClassName,r=rt(),a=r.formState,o=r.commonInputProps,s=Qt().questionsConfig,l=Object.entries(s).filter((function(e){var n=(0,p.Z)(e,2),r=(n[0],n[1]),i=r.category===t,o=Ee(r.condition,a);return i&&o}));return(0,i.jsx)(i.Fragment,{children:l.map((function(e){var t=(0,p.Z)(e,2),r=t[0],a=t[1],s=(0,i.jsx)(_.Z,(0,x.Z)({},o(a)),r);return n?(0,i.jsx)("div",{className:n,children:s},r):s}))})},at=function(){return(0,i.jsx)(it,{category:"conducteur"})},ot=function(){var e=rt().formState,t=Qt().questionsConfig,n=Ie[null===e||void 0===e?void 0:e.formule]||[];return(0,i.jsxs)("div",{className:"w-100",children:[(0,i.jsx)(it,{category:"formule"}),n.length>0&&(0,i.jsxs)("div",{className:"mt-4",children:[(0,i.jsxs)("div",{style:{fontSize:"14px",fontWeight:"600",color:"#172B4D",marginBottom:"16px",display:"flex",alignItems:"center",gap:"8px"},children:[(0,i.jsx)("i",{className:"fas fa-check-circle",style:{color:"#10b981",fontSize:"16px"}}),"Garanties incluses dans cette formule"]}),(0,i.jsx)("div",{className:"row",children:n.map((function(e){var n=t[e];return n?(0,i.jsx)("div",{className:"col-12 col-md-6 mb-3",children:(0,i.jsx)("div",{style:{padding:"20px 24px",borderRadius:"16px",background:"linear-gradient(135deg, #10b981 0%, #059669 100%)",border:"none",boxShadow:"0 4px 12px rgba(16, 185, 129, 0.25)",color:"#FFFFFF"},children:(0,i.jsxs)("div",{className:"d-flex align-items-center justify-content-between",children:[(0,i.jsxs)("div",{className:"d-flex align-items-center",style:{gap:"12px"},children:[(0,i.jsx)("div",{style:{width:"44px",height:"44px",borderRadius:"12px",background:"rgba(255, 255, 255, 0.2)",display:"flex",alignItems:"center",justifyContent:"center"},children:(0,i.jsx)("i",{className:"fas fa-check",style:{fontSize:"20px",color:"#FFFFFF"}})}),(0,i.jsxs)("div",{style:{flex:1},children:[(0,i.jsx)("div",{style:{fontSize:"16px",fontWeight:"600",color:"#FFFFFF",marginBottom:"4px"},children:n.label}),n.info&&(0,i.jsx)("div",{style:{fontSize:"13px",color:"rgba(255, 255, 255, 0.9)",lineHeight:"1.4"},children:n.info})]})]}),(0,i.jsx)("div",{style:{padding:"6px 12px",borderRadius:"8px",background:"rgba(255, 255, 255, 0.25)",fontSize:"12px",fontWeight:"600",color:"#FFFFFF",whiteSpace:"nowrap"},children:"Inclus"})]})})},e):null}))})]})]})},st=function(e){var t=e.embed,n=rt(),r=n.actions,a=n.isFormComplete;return(0,i.jsxs)("div",{style:{maxWidth:"720px",margin:"0 auto",textAlign:"center"},children:[(0,i.jsx)("img",{src:"/images/auto/ondes.webp",style:{width:140}}),(0,i.jsx)("h1",{style:{fontSize:"30px",fontWeight:"800",color:"#c249df",margin:"0 0 10px",letterSpacing:"-0.02em"},children:"Parlez, Merlin s'occupe du reste"}),(0,i.jsxs)("p",{style:{color:"#6b7280",fontSize:"17px",margin:"0 0 30px",lineHeight:"1.5"},children:["Il vous guide \xe9tape par \xe9tape",(0,i.jsx)("br",{}),"pour pr\xe9parer votre devis en quelques minutes."]}),(0,i.jsx)("div",{style:{display:"flex",flexWrap:"wrap",gap:"24px",margin:"0 auto 36px",textAlign:"center",maxWidth:"600px",justifyContent:"center"},children:[{src:"/images/auto/micro.webp",alt:"Micro",text:(0,i.jsxs)(i.Fragment,{children:["Autorisez l'acc\xe8s",(0,i.jsx)("br",{}),"\xe0 votre micro"]})},{src:"/images/auto/conversation.webp",alt:"Conversation",text:"R\xe9pondez \xe0 voix haute, comme \xe0 un conseiller"},{src:"/images/auto/securite.webp",alt:"S\xe9curit\xe9",text:"Vos donn\xe9es vocales ne sont ni stock\xe9es, ni partag\xe9es"}].map((function(e){return(0,i.jsxs)("div",{style:{flex:"1 1 140px",maxWidth:"180px",display:"flex",flexDirection:"column",alignItems:"center"},children:[(0,i.jsx)("img",{src:e.src,alt:e.alt,style:{width:72,height:72,marginBottom:"12px"}}),(0,i.jsx)("p",{style:{fontSize:"13px",color:"#6b7280",lineHeight:"1.5",margin:0},children:e.text})]},e.alt)}))}),a?(0,i.jsx)("div",{style:{background:"#d1fae5",borderRadius:"12px",padding:"20px",marginTop:"20px",minHeight:171},className:"d-center",children:(0,i.jsx)("p",{style:{color:"#065f46",fontSize:"16px",lineHeight:"1.6",margin:"0",fontWeight:"500"},children:"Toutes les informations n\xe9cessaires ont bien \xe9t\xe9 compl\xe9t\xe9es. Vous pouvez maintenant estimer votre tarif et recevoir votre devis."})}):(0,i.jsxs)(i.Fragment,{children:[(0,i.jsxs)("div",{style:{display:"flex",flexDirection:"column",gap:"10px",alignItems:"center",marginTop:"20px"},children:[(0,i.jsx)("button",{onClick:function(){r.onOpenAssistantVocal(),t||modal_actions.updateModal({isOpen:!1,content:null})},style:(0,v.Z)({cursor:"pointer",borderRadius:"14px",padding:"15px 28px",fontWeight:"600",fontSize:"17px",border:"none",background:"#4f46e5",color:"#fff",boxShadow:"0 10px 22px rgba(79,70,229,.25)",transition:".2s ease"},"background","linear-gradient(139deg, #ff22e8, #16b6c4)"),onMouseEnter:function(e){e.currentTarget.style.transform="translateY(-1px)"},onMouseLeave:function(e){e.currentTarget.style.transform="translateY(0)"},children:"Parlez \xe0 Merlin"}),(0,i.jsx)("button",{onClick:function(){r.onShowStepsAfterVocal(),setTimeout((function(){r.goToFirstIncompleteQuestion()}),100)},style:{cursor:"pointer",borderRadius:"14px",padding:"15px 28px",fontWeight:"600",fontSize:"17px",border:"none",background:"#f3f4f6",color:"#9ca3af",transition:".2s ease"},onMouseEnter:function(e){e.currentTarget.style.background="#e5e7eb"},onMouseLeave:function(e){e.currentTarget.style.background="#f3f4f6"},children:"Utilisez le clavier"})]}),(0,i.jsx)("p",{style:{marginTop:"18px",fontSize:"13px",color:"#6b7280"},children:"Vous pourrez revenir au formulaire classique \xe0 tout moment."})]})]})},lt=[{key:"CARTE_GRISE",icon:"fa-car"},{key:"PERMIS_CONDUIRE",icon:"fa-id-card"},{key:"RELEVE_INFORMATION",icon:"fa-file-alt"}],ct=function(){var e=(0,p.Z)((0,f.KO)($e),1)[0],t=rt().actions,n=(0,f.Dv)(he),r=(0,f.Dv)(ve),o=(0,a.useState)(null),s=o[0],l=o[1],c=(0,a.useState)(!1),u=c[0],d=c[1],m=(0,a.useRef)(null),h=(0,a.useRef)(0),v=(0,a.useCallback)((function(e){e.preventDefault(),h.current++,d(!0)}),[]),g=(0,a.useCallback)((function(e){e.preventDefault()}),[]),x=(0,a.useCallback)((function(e){e.preventDefault(),h.current--,h.current<=0&&(h.current=0,d(!1))}),[]),_=(0,a.useCallback)((function(e){e.preventDefault(),e.stopPropagation(),h.current=0,d(!1);var t=e.dataTransfer.files;t.length>
10&&m.current&&m.current.processFile(t[0])}),[]),b=function(){var e=(0,C.Z)((function(e,t){return(0,w.__generator)(this,(function(r){switch(r.label){case 0:return console.log("".concat(t," file dropped:"),e),n?[4,n(e,t)]:[3,2];case 1:r.sent(),r.label=2;case 2:return[2]}}))}));return function(t,n){return e.apply(this,arguments)}}();return(0,i.jsxs)("div",{style:{maxWidth:"780px",margin:"0 auto",textAlign:"center"},children:[(0,i.jsx)("h1",{style:{margin:"0 0 8px 0",fontSize:"40px",fontWeight:"800",color:"#4f46e5",letterSpacing:"-0.02em"},children:"Gagnez du temps !"}),(0,i.jsx)("span",{style:{margin:"0 0 8px 0",fontSize:"28px",fontWeight:"800",color:"#4f46e5",letterSpacing:"-0.02em"},children:"(\xe9tape facultative)"}),(0,i.jsxs)("p",{style:{margin:"8px 0 40px",color:"#6b7280",fontSize:"18px",lineHeight:"1.6"},children:["D\xe9posez vos documents ou prenez-les en photo avec votre mobile.",(0,i.jsx)("br",{}),"Merlin analysera automatiquement les informations n\xe9cessaires",(0,i.jsx)("br",{}),"pour \xe9tablir votre tarif sur mesure en quelques instants."]}),(0,i.jsx)("div",{className:"d-flex flex-wrap justify-content-center mx-auto aa-documents-grid",style:{gap:"20px",marginTop:"24px"},children:lt.map((function(e){var t=e.key,n=e.icon,a=r[qt[t]];return(0,i.jsxs)("button",{type:"button",onClick:function(){return l(t)},style:{display:"flex",alignItems:"center",gap:"12px",padding:"16px 24px",borderRadius:"14px",border:a?"2px solid #22c55e":"2px solid #e5e7eb",background:a?"#f0fdf4":"#fff",cursor:"pointer",transition:"all 0.2s ease",boxShadow:"0 2px 8px rgba(0,0,0,0.06)"},onMouseEnter:function(e){a||(e.currentTarget.style.borderColor="#4f46e5",e.currentTarget.style.transform="translateY(-2px)",e.currentTarget.style.boxShadow="0 4px 12px rgba(79,70,229,0.15)")},onMouseLeave:function(e){a||(e.currentTarget.style.borderColor="#e5e7eb",e.currentTarget.style.transform="translateY(0)",e.currentTarget.style.boxShadow="0 2px 8px rgba(0,0,0,0.06)")},children:[(0,i.jsx)("i",{className:"fas ".concat(a?"fa-check-circle":n),style:{fontSize:"20px",color:a?"#22c55e":"#4f46e5"}}),(0,i.jsx)("span",{style:{fontSize:"15px",fontWeight:"600",color:a?"#166534":"#1f2937"},children:zt[t]}),a&&(0,i.jsx)("span",{style:{fontSize:"11px",color:"#22c55e",fontWeight:"500",marginLeft:"auto"},children:"Envoy\xe9"})]},t)}))}),(0,i.jsx)("button",{type:"button",onClick:function(){var e=document.getElementById("step-assistant_vocal");if(e){var t=e.closest(".overflow-auto");t&&t.scrollTo({top:Math.max(0,e.offsetTop-100),behavior:"smooth"})}},style:{marginTop:"28px",background:"none",border:"none",color:"#6b7280",fontSize:"15px",cursor:"pointer",textDecoration:"underline",padding:"8px 16px"},children:"Je n'ai pas mes documents"}),s&&(0,i.jsxs)(i.Fragment,{children:[(0,i.jsxs)("div",{className:"modal fade show",style:{display:"block",zIndex:1050},tabIndex:"-1",role:"dialog","aria-hidden":"true",onClick:function(){return l(null)},onDragEnter:v,onDragOver:g,onDragLeave:x,onDrop:_,children:[u&&(0,i.jsx)("div",{style:{position:"fixed",inset:0,zIndex:1060,background:"rgba(79, 70, 229, 0.08)",border:"4px dashed #4f46e5",display:"flex",alignItems:"center",justifyContent:"center",pointerEvents:"none"},children:(0,i.jsxs)("div",{style:{background:"#fff",borderRadius:"20px",padding:"40px 60px",boxShadow:"0 8px 32px rgba(79,70,229,0.18)",textAlign:"center"},children:[(0,i.jsx)("i",{className:"fas fa-cloud-upload-alt",style:{fontSize:"48px",color:"#4f46e5",marginBottom:"12px"}}),(0,i.jsx)("p",{style:{fontSize:"20px",fontWeight:"700",color:"#4f46e5",margin:0},children:"D\xe9posez votre fichier ici"})]})}),(0,i.jsx)("div",{className:"modal-dialog modal-dialog-centered",role:"document",onClick:function(e){return e.stopPropagation()},children:(0,i.jsxs)("div",{className:"modal-content",style:{borderRadius:"20px",overflow:"hidden"},children:[(0,i.jsxs)("div",{className:"modal-header justify-content-between align-items-center",style:{borderBottom:"none",padding:"20px 24px 0"},children:[(0,i.jsxs)("h5",{className:"modal-title",style:{fontWeight:"700",color:"#4f46e5"},children:[(0,i.jsx)("i",{className:"fa fa-file mr-2"}),zt[s]]}),(0,i.jsx)("button",{type:"button",className:"close",onClick:function(){return l(null)},"aria-label":"Close",children:(0,i.jsx)("span",{"aria-hidden":"true",children:"\xd7"})})]}),(0,i.jsxs)("div",{className:"modal-body",style:{padding:"16px 24px 24px"},children:[Zt[s]&&(0,i.jsx)("div",{className:"d-flex justify-content-center align-items-end",style:{gap:"16px",marginBottom:"20px"},children:Zt[s].map((function(e,t){return(0,i.jsxs)("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",gap:"8px"},children:[(0,i.jsx)("img",{src:e.src,alt:e.alt,style:{maxHeight:Zt[s].length>1?"100px":"130px",maxWidth:"100%",objectFit:"contain",borderRadius:"8px"}}),Zt[s].length>1&&(0,i.jsx)("span",{style:{fontSize:"11px",color:"#6b7280",fontWeight:"500"},children:e.alt})]},t)}))}
1),(0,i.jsx)(te,{ref:m,schema:e[s],onDataExtracted:t.onOCRDataReceived,onFileDrop:function(e){return b(e,qt[s])},onUploadStarted:function(){return t.onOCRUploadStarted(qt[s])},title:null,documentType:qt[s],description:"RELEVE_INFORMATION"===s?Ft.RELEVE_INFORMATION:void 0,isUploaded:r[qt[s]]})]})]})})]}),(0,i.jsx)("div",{className:"modal-backdrop fade show",style:{zIndex:1040},onClick:function(){return l(null)}})]})]})},ut=n(150259),dt=n(351572),mt=n(916806),pt=function(){var e,t,n=(0,ut.xX)().executeRecaptcha,r=(0,a.useState)(!1),i=r[0],o=r[1],s=(0,a.useState)(!1),l=s[0],c=s[1],u=(0,a.useState)(0),d=(u[0],u[1]),m=(0,p.Z)((0,f.KO)(re),2),g=m[0],_=m[1],y=(0,p.Z)((0,N.Z)(),2),E=y[0],S=y[1];console.log("state",E);var I=E.auth.isAuthenticated,T=(0,a.useState)({}),j=T[0],R=T[1],A=(0,dt.Y)(E,S),k=g.email_utilisateur||"",O=g.nom_utilisateur||"",P=g.prenom_utilisateur||"",D=g.telephone_utilisateur||"",L=(g.civilite_utilisateur,(0,a.useState)({emailChecked:!1,userExists:!1,isCheckingEmail:!1,isLoginUser:!1,password:"",newPassword:"",newPasswordConfirm:"",gender:"",optIn:!1})),M=L[0],U=L[1],q=(0,a.useCallback)((0,C.Z)((function(){var e;return(0,w.__generator)(this,(function(t){switch(t.label){case 0:return n?[4,n()]:(console.log("Execute recaptcha not yet available"),[2]);case 1:return e=t.sent(),console.log("Recaptcha token:",e),e&&!i&&o(e),[2]}}))})),[n,i]),z=function(e){U((function(t){return(0,x.Z)({},t,e)}))},Z=function(){_((function(e){return(0,b.Z)((0,x.Z)({}
1,e),{email_utilisateur:"",nom_utilisateur:"",prenom_utilisateur:"",telephone_utilisateur:"",user_id:null})})),U({emailChecked:!1,userExists:!1,isCheckingEmail:!1,isLoginUser:!1,password:"",newPassword:"",newPasswordConfirm:"",gender:"",optIn:!1}),A.logoutUser()};return(0,a.useEffect)((function(){if(i&&!I){var e=M.password||M.newPassword;k&&e&&A.loginUser({login:k,password:e,captchaToken:i})}}),[i,I]),(0,a.useEffect)((function(){M.emailChecked&&z({emailChecked:!1})}),[k]),(0,a.useEffect)((function(){var e,t;((null===(e=E.errors)||void 0===e?void 0:e.login)||(null===(t=E.errors)||void 0===t?void 0:t.password))&&(d((function(e){return e+1})),z({isLoginUser:!1}),c(!1),o(null),R({auth:E.errors.login||E.errors.password||"Erreur d'authentification"}))}),[null===(e=E.errors)||void 0===e?void 0:e.login,null===(t=E.errors)||void 0===t?void 0:t.password]),(0,a.useEffect)((function(){if(I&&E.auth.user){var e=E.auth.user;_((function(t){return(0,b.Z)((0,x.Z)({},t),{email_utilisateur:e.email||t.email_utilisateur,nom_utilisateur:e.lastname||t.nom_utilisateur,prenom_utilisateur:e.firstname||t.prenom_utilisateur,telephone_utilisateur:e.phone||t.telephone_utilisateur,civilite_utilisateur:e.gender+""||t.civilite_utilisateur,user_id:e.id})}))}}),[I,E.auth.user]),{email:k,nom:O,prenom:P,telephone:D,userAuthState:M,isAuthenticated:I,authErrors:j,showRecaptcha:l,currentUser:E.auth.user,inputChange:function(e){var t=e.target,n=t.name,r=t.value,i=t.type,a=t.checked,o="checkbox"===i?a:r;["email_utilisateur","nom_utilisateur","prenom_utilisateur","telephone_utilisateur"].includes(n)?_((function(e){return(0,b.Z)((0,x.Z)({},e),(0,v.Z)({},n,o))})):z((0,v.Z)({},n,o))},checkUserExists:function(){k&&(z({isCheckingEmail:!0}),h.Z.post("customers/exists",{email:k},(function(e){z({userExists:e.exists,emailChecked:!0,isCheckingEmail:!1})}),(function(e){z({isCheckingEmail:!1}),R({email:"Erreur lors de la v\xe9rification de l'email"})})))},loginHandle:function(e){if(e&&e.preventDefault(),I)return!1;z({isLoginUser:!0}),c(!0),q()},createAccount:function(){if(k&&M.newPassword&&O&&P)if(M.newPassword===M.newPasswordConfirm)if(D&&10===D.length)if(M.optIn){z({isLoginUser:!0});var e={email:k,newPassword:M.newPassword,newPasswordConfirm:M.newPasswordConfirm,firstname:P,lastname:O,phone:D,gender:parseInt(M.gender),optIn:M.optIn,status:{emailChecked:!0,userExists:!1,isCheckingEmail:!1}};h.Z.post("customers",e,(function(e){_((function(t){return(0,b.Z)((0,x.Z)({},t),{user_id:e.id,civilite_utilisateur:M.gender+""})})),q()}),(function(e){z({isLoginUser:!1}),R({form:e.message||"Erreur lors de la cr\xe9ation du compte"})}))}else R({optIn:"Veuillez accepter de recevoir des offres par email"});else R({telephone_utilisateur:"Le num\xe9ro de t\xe9l\xe9phone doit contenir 10 chiffres"});else R({newPasswordConfirm:"Les mots de passe ne correspondent pas"});else R({form:"Veuillez remplir tous les champs obligatoires"})},logoutHandle:Z,refreshLogin:function(){h.Z.get("auth/me/".concat("PER_APP"),(function(e){var t=jwt_decode(e);S({type:mt.b.SET_CURRENT_USER,payload:t}),_((function(e){return(0,b.Z)((0,x.Z)({},e),{email_utilisateur:t.email,nom_utilisateur:t.lastname,prenom_utilisateur:t.firstname,telephone_utilisateur:t.phone,civilite_utilisateur:t.gender+"",user_id:t.id})}))}),(function(e){return Z()}))},verifyCallback:q,setFormState:_,updateUserAuthState:z}},ft=function(e){var t=e.user,n=e.onLogout;return(0,i.jsx)("div",{className:"w-100",children:(0,i.jsxs)("div",{className:"bg-purple rounded d-flex flex-wrap align-items-center justify-content-between py-2 px-4 text-white",style:{gap:10},children:[(0,i.jsxs)("div",{className:"py-2",children:[(0,i.jsx)("i",{className:"fas fa-check-circle mr-2 "}),(0,i.jsx)("strong",{children:"Bienvenue "})," ",t.firstname," ",t.lastname," !"]}),(0,i.jsxs)("button",{type:"button",className:"btn btn-sm btn-default text-white border-0 rounded-pill px-0",onClick:n,children:[(0,i.jsx)("i",{className:"fas fa-sign-out-alt mr-1"}),"D\xe9connexion"]})]})})},ht=function(e){var t=e.userAuthState,n=e.inputChange,r=e.onSubmit,a=e.isLoading,o=e.errors;return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)("div",{className:"col-12 col-md-6",children:(0,i.jsx)(_.Z,{label:"Mot de passe",name:"newPassword",type:"password",value:t.newPassword,change:n,error:o,labelClassname:"w-100",minLength:6,minUppercase:1,minLowercase:3,minNumber:1})}),(0,i.jsx)("div",{className:"col-12 col-md-6",children:(0,i.jsx)(_.Z,{label:"Confirmer le mot de passe",name:"newPasswordConfirm",type:"password",value:t.newPasswordConfirm,change:n,error:o,labelClassname:"w-100",minLength:6,minUppercase:1,minLowercase:3,minNumber:1})}),(0,i.jsx)("div",{className:"col-12",children:(0,i.jsx)(_.Z,{label:"Civilit\xe9",name:"gender",type:"btnList",btnInline:!0,datas:[{id:"1",name:"Monsieur"},{id:"2",name:"Madame"}],value:t.gender,change:n,dataIndex:"id",dataLabel:"name",fullWidth:!0,labelClassname:"w-100",error:o})}),t.gender&&(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)("div",{className:"col-12 col-md-6",children:(0,i.jsx)(_.Z,{label:"Pr\xe9nom",name:"prenom_utilisateur",type:"text",value:t.prenom,change:n,error:o,labelClassname:"w-100"})}),(0,i.jsx)("div",{className:"col-12 col-md-6",children:(0,i.jsx)(_.Z,{label:"Nom",name:"nom_utilisateur",type:"text",value:t.nom,change:n,error:o,labelClassname:"w-100"})}),(0,i.jsx)("div",{className:"col-12 col-md-6",children:(0,i.jsx)(_.Z,{label:"T\xe9l\xe9phone",name:"telephone_utilisateur",type:"tel",value:t.telephone,change:n,error:o,labelClassname:"w-100"})}),(0,i.jsx)("div",{className:"col-12",children:(0,i.jsx)(_.Z,{label:"J'accepte que mes informations soient utilis\xe9es dans le cadre de ma demande",name:"optIn",type:"checkbox",checked:t.optIn,change:n,error:o,labelClassname:"w-100",inputStyle:{height:"auto"},noBg:!0})}),(0,i.jsxs)("div",{className:"col-12",children:[o.form&&(0,i.jsx)("div",{className:"alert alert-danger",children:o.form}),o.optIn&&(0,i.jsx)("div",{className:"alert alert-danger",children:o.optIn}),(0,i.jsx)("button",{disabled:a,className:"btn btn-primary btn-lg w-100 shadow",onClick:r,type:"button",children:a?(0,i.jsx)(_e.Z,{color:"white"}):"Cr\xe9er mon compte"})]})]})]})},vt=function(e){var t=e.userAuthState,n=e.inputChange,r=e.onSubmit,a=e.errors;return(0,i.jsx)("div",{className:"col-12 col-md-6",children:(0,i.jsxs)("form",{onSubmit:function(e){e.preventDefault(),r()},children:[(0,i.jsx)(_.Z,{label:"Mot de passe",type:"password",name:"password",value:t.password,change:n,error:a,labelClassname:"w-100",minLength:6,minUppercase:1,minLowercase:3,minNumber:1}),a.auth&&(0,i.jsx)("p",{className:"text-danger",children:a.auth}),(0,i.jsxs)("div",{className:"d-flex justify-content-between align-items-center flex-wrap w-100",style:{gap:15},children:[(0,i.jsx)("a",{href:"".concat("https://app.goperceval.fr/","?fpwd=true"),target:"_blank",rel:"noopener noreferrer",children:"Mot de passe oubli\xe9 ?"}),(0,i.jsx)("button",{className:"btn btn-primary",type:"submit",disabled:!t.password.length,children:t.isLoginUser?(0,i.jsx)(_e.Z,{size:20,color:"white"}):"Connexion"})]})]})})},gt=function(){var e=pt(),t=e.email,n=e.nom,r=e.prenom,o=e.telephone,s=e.userAuthState,l=e.isAuthenticated,c=e.authErrors,u=e.currentUser,d=e.inputChange,m=e.checkUserExists,p=e.loginH
1andle,f=e.createAccount,h=e.logoutHandle,v=e.setFormState,g=e.updateUserAuthState,y=(0,a.useRef)(null),E=(0,a.useRef)(s.emailChecked);return(0,a.useEffect)((function(){if(!E.current&&s.emailChecked){var e=setTimeout((function(){y.current&&y.current.scrollIntoView({behavior:"smooth",block:"start"})}),200);return function(){return clearTimeout(e)}}E.current=s.emailChecked}),[s.emailChecked]),l&&u?(0,i.jsx)(ft,{user:u,onLogout:h}):(0,i.jsxs)("div",{className:"w-100",children:[(0,i.jsx)("div",{className:"row py-2",children:(0,i.jsx)("div",{className:"col-12",children:(0,i.jsx)("div",{className:"text-center mb-0",children:(0,i.jsx)("p",{className:"text-muted font-italic py-2 mb-0 rounded px-3",style:{borderLeft:"4px solid #e0e0e0",background:"#f6f6f6"},children:"Pour commencer votre demande de devis, nous avons besoin de quelques informations"})})})}),(0,i.jsx)("div",{className:"row mb-4",children:(0,i.jsx)("div",{className:"col-12",children:(0,i.jsx)("div",{className:"card shadow-none",children:(0,i.jsxs)("div",{className:"card-body px-0 py-4 ",children:[(0,i.jsxs)("div",{className:"d-flex align-items-start mb-3",children:[(0,i.jsx)("div",{className:"bg-primary text-white rounded-circle d-flex align-items-center justify-content-center mr-3",style:{width:40,height:40,minWidth:40},children:(0,i.jsx)("strong",{children:"1"})}),(0,i.jsxs)("div",{children:[(0,i.jsx)("h5",{className:"mb-1 font-weight-bold",children:"V\xe9rification de votre email"}),(0,i.jsx)("p",{className:"text-muted mb-0",children:"Entrez votre adresse email pour v\xe9rifier si vous avez d\xe9j\xe0 un compte"})]})]}),(0,i.jsx)("form",{onSubmit:function(e){e.preventDefault(),m()},children:(0,i.jsxs)("div",{className:"row",children:[(0,i.jsx)("div",{className:"col-12 col-md-8",children:(0,i.jsx)(_.Z,{label:"Adresse email",name:"email_utilisateur",type:"email",value:t,change:d,error:c,labelClassname:"w-100",placeholder:"[email protected]",margin:"mb-0"})}),(0,i.jsxs)("div",{className:"col-12 col-md-4 d-flex align-items-end pt-4",children:[!s.emailChecked&&(0,i.jsx)("button",{className:"btn btn-primary btn-block",type:"submit",disabled:!t.length||s.isCheckingEmail,children:s.isCheckingEmail?(0,i.jsx)(_e.Z,{size:20,color:"white"}):(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)("i",{className:"fas fa-check mr-2"}),"V\xe9rifier"]})}),s.emailChecked&&(0,i.jsxs)("button",{className:"btn btn-outline-secondary btn-block",type:"button",onClick:function(){v((function(e){return(0,b.Z)((0,x.Z)({},e),{email_utilisateur:""})})),g({emailChecked:!1,userExists:!1})},children:[(0,i.jsx)("i",{className:"fas fa-edit mr-2"}),"Modifier"]})]})]})})]})})})}),s.emailChecked&&(0,i.jsx)("div",{className:"row",ref:y,children:(0,i.jsx)("div",{className:"col-12",children:(0,i.jsx)("div",{className:"card shadow-none",children:(0,i.jsxs)("div",{className:"card-body px-0 py-4 ",children:[(0,i.jsxs)("div",{className:"d-flex align-items-start mb-3",children:[(0,i.jsx)("div",{className:"bg-primary text-white rounded-circle d-flex align-items-center justify-content-center mr-3",style:{width:40,height:40,minWidth:40},children:(0,i.jsx)("strong",{children:"2"})}),(0,i.jsx)("div",{className:"flex-grow-1",children:s.userExists?(0,i.jsxs)(i.Fragment,{children:[(0,i.jsxs)("h5",{className:"mb-1 font-weight-bold",children:[(0,i.jsx)("i",{className:"fas fa-check-circle text-success mr-2"}),"Compte existant d\xe9tect\xe9"]}),(0,i.jsx)("p",{className:"text-muted mb-0",children:"Connectez-vous avec votre mot de passe pour continuer"})]}):(0,i.jsxs)(i.Fragment,{children:[(0,i.jsxs)("h5",{className:"mb-1 font-weight-bold",children:[(0,i.jsx)("i",{className:"fas fa-user-plus text-primary mr-2"}),"Cr\xe9ation de votre compte"]}),(0,i.jsx)("p",{className:"text-muted mb-0",children:"Quelques informations pour cr\xe9er votre compte et s\xe9curiser votre devis"})]})})]}),(0,i.jsx)("div",{className:"row",children:s.userExists?(0,i.jsx)(vt,{userAuthState:s,inputChange:d,onSubmit:p,errors:c}):(0,i.jsx)(ht,{userAuthState:(0,b.Z)((0,x.Z)({},s),{nom:n,prenom:r,telephone:o}),inputChange:d,onSubmit:f,isLoading:s.isLoginUser,errors:c})})]})})})}),!s.emailChecked&&(0,i.jsx)("div",{className:"row mt-4",children:(0,i.jsx)("div",{className:"col-12",children:(0,i.jsxs)("div",{className:"alert alert-info border-0 d-flex align-items-start",children:[(0,i.jsx)("i",{className:"fas fa-shield-alt mt-1 mr-3"}),(0,i.jsxs)("div",{children:[(0,i.jsx)("strong",{children:"Vos donn\xe9es sont s\xe9curis\xe9es"}),(0,i.jsx)("p",{className:"mb-0 small",children:"Nous utilisons vos informations uniquement pour traiter votre demande de devis. Elles ne seront jamais partag\xe9es avec des tiers sans votre consentement."})]})]})})})]})},xt=function(){return(0,i.jsx)(i.Fragment,{children:(0,i.jsx)(it,{category:"vehicule"})})},_t=[{nom:"Les Avirons",code:"97401",codeDepartement:"974",siren:"219740016",codeEpci:"249740077",codeRegion:"04",codesPostaux:["97425"],population:11434},{nom:"Bras-Panon",code:"97402",codeDepartement:"974",siren:"219740024",codeEpci:"249740093",codeRegion:"04",codesPostaux:["97412"],population:13344},{nom:"Entre-Deux",code:"97403",codeDepartement:"974",siren:"219740032",codeEpci:"249740085",codeRegion:"04",codesPostaux:["97414"],population:7105},{nom:"L'\xc9tang-Sal\xe9",code:"97404",codeDepartement:"974",siren:"219740040",codeEpci:"249740077",codeRegion:"04",codesPostaux:["97427"],population:13836},{nom:"Petite-\xcele",code:"97405",codeDepartement:"974",siren:"219740057",codeEpci:"249740077",codeRegion:"04",codesPostaux:["97429"],population:12617},{nom:"La Plaine-des-Palmistes",code:"97406",codeDepartement:"974",siren:"219740065",codeEpci:"249740093",codeRegion:"04",codesPostaux:["97431"],population:6821},{nom:"Le Port",code:"97407",codeDepartement:"974",siren:"219740073",codeEpci:"249740101",codeRegion:"04",codesPostaux:["97420"],population:33336},{nom:"La Possession",code:"97408",codeDepartement:"974",siren:"219740081",codeEpci:"249740101",codeRegion:"04",codesPostaux:["97419"],population:35245},{nom:"Saint-Andr\xe9",code:"97409",codeDepartement:"974",siren:"219740099",codeEpci:"249740093",codeRegion:"04",codesPostaux:["97440"],population:57150},{nom:"Saint-Beno\xeet",code:"97410",codeDepartement:"974",siren:"219740107",codeEpci:"249740093",codeRegion:"04",codesPostaux:["97437","97470"],population:37023},{nom:"Saint-Denis",code:"97411",codeDepartement:"974",siren:"219740115",codeEpci:"249740119",codeRegion:"04",codesPostaux:["97400","97417","97490"],population:154765},{nom:"Saint-Joseph",code:"97412",codeDepartement:"974",siren:"219740123",codeEpci:"249740085",codeRegion:"04",codesPostaux:["97480"],population:38807},{nom:"Saint-Leu",code:"97413",codeDepartement:"974",siren:"219740131",codeEpci:"249740101",codeRegion:"04",codesPostaux:["97416","97424","97436"],population:34893},{nom:"Saint-Louis",code:"97414",codeDepartement:"974",siren:"219740149",codeEpci:"249740077",codeRegion:"04",codesPostaux:["97421","97450"],population:53935},{nom:"Saint-Paul",code:"97415",codeDepartement:"974",siren:"219740156",codeEpci:"249740101",codeRegion:"04",codesPostaux:["97411","97422","97423","97434","97435","97460"],population:105240},{nom:"Saint-Pierre",code:"97416",codeDepartement:"974",siren:"219740164",codeEpci:"249740077",codeRegion:"04",codesPostaux:["97410","97432"],population:84077},{nom:"Saint-Philippe",code:"97417",codeDepartement:"974",siren:"219740172",codeEpci:"249740085",codeRegion:"04",codesPostaux:["97442"],population:5074},{nom:"Sainte-Marie",code:"97418",codeDepartement:"974",siren:"219740180",codeEpci:"249740119",codeRegion:"04",codesPostaux:["97438"],population:34344},{nom:"Sainte-Rose",code:"97419",codeDepartement:"974",siren:"219740198",codeEpci:"249740093",codeRegion:"04",codesPostaux:["97439"],population:6343},{nom:"Sainte-Suzanne",code:"97420",codeDepartement:"974",siren:"219740206",codeEpci:"249740119",codeRegion:"04",codesPostaux:["97441"],population:24293},{nom:"Salazie",code:"97421",codeDepartement:"974",siren:"219740214",codeEpci:"249740093",codeRegion:"04",codesPostaux:["97433"],population:7243},{nom:"Le Tampon",code:"97422",codeDepartement:"974",siren:"219740222",codeEpci:"249740085",codeRegion:"04",codesPostaux:["97418","97430"],population:81943},{nom:"Les Trois-Bassins",code:"97423",codeDepartement:"974",siren:"219740230",codeEpci:"249740101",codeRegion:"04",codesPostaux:["97426"],population:6899},{nom:"Cilaos",code:"97424",codeDepartement:"974",siren:"219740248",codeEpci:"249740077",codeRegion:"04",codesPostaux:["97413"],population:5390}].map((function(e){var t=e.nom||"";return{id:t.toLowerCase().normalize("NFD").replace(/[\u0300-\u036f]/g,"").replace(/[^a-z0-9]+/g,"_").replace(/^_+|_+$/g,""),name:t}})),bt=function(){return(0,i.jsx)("div",{className:"w-100",children:(0,i.jsx)("div",{className:"row",children:(0,i.jsx)(it,{category:"garanties",wrapperClassName:"col-12 col-md-6 mb-3"})})})},yt=n(811163),Et={resultCard:{background:"linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%)",borderRadius:"16px",overflow:"hidden"},primeAmount:{fontSize:"3.5rem",fontWeight:"700",color:"#4f46e5",lineHeight:"1.1"},primeUnit:{fontSize:"1.25rem",fontWeight:"400",color:"#6c757d"},monthlyAmount:{fontSize:"1.1rem",color:"#495057"},fourchette:{background:"#fff",borderRadius:"12px",padding:"1rem"},fourchetteValue:{fontSize:"1.25rem",fontWeight:"600",color:"#212529"},badge:{padding:"0.5rem 1rem",borderRadius:"20px",fontSize:"0.875rem",fontWeight:"500"},facteurBadge:{background:"#fff",border:"1px solid #dee2e6",borderRadius:"8px",padding:"0.4rem 0.75rem",fontSize:"0.8rem",color:"#495057",display:"inline-block",marginRight:"0.5rem",marginBottom:"0.5rem"},disclaimer:{background:"rgba(108, 117, 125, 0.1)",borderRadius:"8px",padding:"1rem"}},St=function(e){switch(e){case"haute":return"badge-success";case"moyenne":return"badge-warning";default:return"badge-secondary"}},It=function(e){var t,n,r,a,o,s=e.estimation,l=e.compact,c=void 0!==l&&l;if(!s)return null;var u=c?(0,b.Z)((0,x.Z)({},Et.resultCard),{maxWidth:"100%"}):Et.resultCard,d=c?(0,b.Z)((0,x.Z)({},Et.primeAmount),{fontSize:"1.9rem"}):Et.primeAmount,m=c?(0,b.Z)((0,x.Z)({},Et.monthlyAmount),{fontSize:"1.0rem"}):Et.monthlyAmount;return(0,i.jsx)("div",{style:u,children:(0,i.jsxs)("div",{className:c?"p-3":"p-4",children:[(0,i.jsxs)("div",{className:"text-center mb-2 pb-3",children:[(0,i.jsx)("p",{className:"text-muted mb-2",style:{fontSize:c?"0.9rem":"1rem"},children:"Votre prime estim\xe9e"}),(0,i.jsxs)("div",{style:d,children:[null===(t=s.prime_mensuelle_ttc)||void 0===t?void 0:t.toLocaleStr
1ing("fr-FR",{minimumFractionDigits:2,maximumFractionDigits:2})," ","\u20ac",(0,i.jsx)("span",{style:Et.primeUnit,children:"/mois"})]}),(0,i.jsxs)("p",{className:"mt-2 mb-0",style:m,children:["soit"," ",(0,i.jsxs)("strong",{children:[null===(n=s.prime_annuelle_ttc)||void 0===n?void 0:n.toLocaleString("fr-FR",{minimumFractionDigits:2,maximumFractionDigits:2})," ","\u20ac /an"]})]})]}),(0,i.jsxs)("div",{className:"d-flex justify-content-center ".concat(c?"":"mb-4"),style:Et.fourchette,children:[(0,i.jsxs)("div",{className:"text-center px-4",children:[(0,i.jsxs)("small",{className:"text-muted d-block mb-1",style:{lineHeight:"18px"},children:[!c&&(0,i.jsx)("i",{className:"fas fa-arrow-down mr-1"}),"Fourchette basse"]}),(0,i.jsxs)("span",{style:Et.fourchetteValue,children:[null===(r=s.fourchette_min)||void 0===r?void 0:r.toLocaleString("fr-FR")," \u20ac"]})]}),(0,i.jsx)("div",{style:{width:"1px",background:"#dee2e6",margin:"0 1.5rem"}}),(0,i.jsxs)("div",{className:"text-center px-4",children:[(0,i.jsxs)("small",{className:"text-muted d-block mb-1",style:{lineHeight:"18px"},children:[!c&&(0,i.jsx)("i",{className:"fas fa-arrow-up mr-1"}),"Fourchette haute"]}),(0,i.jsxs)("span",{style:Et.fourchetteValue,children:[null===(a=s.fourchette_max)||void 0===a?void 0:a.toLocaleString("fr-FR")," \u20ac"]})]})]}),!c&&(0,i.jsx)("div",{className:"text-center mb-4",children:(0,i.jsxs)("span",{className:"badge ".concat(St(s.confiance)),style:Et.badge,children:[(0,i.jsx)("i",{className:"fas fa-check-circle mr-1"}),"Confiance : ",s.confiance]})}),!c&&(null===(o=s.facteurs_cles)||void 0===o?void 0:o.length)>0&&(0,i.jsxs)("div",{className:"pt-3 mt-3",style:{borderTop:"1px solid #dee2e6"},children:[(0,i.jsxs)("p",{className:"text-muted mb-3",style:{fontSize:"0.9rem"},children:[(0,i.jsx)("i",{className:"fas fa-info-circle mr-2"}),"Facteurs pris en compte :"]}),(0,i.jsx)("div",{children:s.facteurs_cles.map((function(e,t){return(0,i.jsx)("span",{style:Et.facteurBadge,children:e},t)}))})]}),!c&&(0,i.jsx)("div",{className:"mt-4",style:Et.disclaimer,children:(0,i.jsxs)("p",{className:"text-muted mb-0",style:{fontSize:"0.85rem"},children:[(0,i.jsx)("i",{className:"fas fa-info-circle mr-2"}),'Cette estimation est indicative et bas\xe9e sur un mod\xe8le IA. Cliquez sur "Recevoir mon devis" afin que notre \xe9quipe calcule votre tarif d\xe9finitif apr\xe8s v\xe9rification de votre dossier.']})})]})})},Nt=[{key:"marque_vehicule",label:"Marque du v\xe9hicule"},{key:"modele_vehicule",label:"Mod\xe8le du v\xe9hicule"},{key:"puissance_fiscale",label:"Puissance fiscale"},{key:"date_premiere_circulation",label:"Date de 1\xe8re circulation"},{key:"conducteur1_date_naissance",label:"Date de naissance"},{key:"conducteur1_date_permis",label:"Date du permis"},{key:"conducteur1_bonus_malus",label:"Bonus/Malus"},{key:"usage_vehicule",label:"Usage du v\xe9hicule"},{key:"type_garage",label:"Type de garage"},{key:"formule",label:"Formule d'assurance"}],Ct=function(){var e=(0,f.Dv)(re),t=rt().actions,n=(0,a.useState)(!1),r=n[0],o=n[1],s=(0,p.Z)((0,f.KO)(ge),2),l=s[0],c=s[1],u=(0,a.useState)(null),d=u[0],m=u[1];(0,a.useEffect)((function(){l&&(c(null),m(null))}),[null===e||void 0===e?void 0:e.marque_vehicule,null===e||void 0===e?void 0:e.modele_vehicule,null===e||void 0===e?void 0:e.puissance_fiscale,null===e||void 0===e?void 0:e.energie_vehicule,null===e||void 0===e?void 0:e.date_premiere_circulation,null===e||void 0===e?void 0:e.conducteur1_date_naissance,null===e||void 0===e?void 0:e.conducteur1_date_permis,null===e||void 0===e?void 0:e.conducteur1_bonus_malus,null===e||void 0===e?void 0:e.usage_vehicule,null===e||void 0===e?void 0:e.type_garage,null===e||void 0===e?void 0:e.formule,null===e||void 0===e?void 0:e.financement_vehicule,null===e||void 0===e?void 0:e.date_acquisition,null===e||void 0===e?void 0:e.carrosserie_vehicule,null===e||void 0===e?void 0:e.lieu_garage,null===e||void 0===e?void 0:e.kilometrage_annuel,null===e||void 0===e?void 0:e.commune_utilisateur,null===e||void 0===e?void 0:e.conducteur1_bonus_malus,null===e||void 0===e?void 0:e.sinistres_36_mois,null===e||void 0===e?void 0:e.sinistre2_presence,null===e||void 0===e?void 0:e.sinistre3_presence]);var h=0===(0,a.useMemo)((function(){return e?Nt.filter((function(t){var n=t.key,r=e[n];return void 0===r||null===r||""===r})):Nt}),[e]).length,v=function(){var n=(0,C.Z)((function(){var n,r,i;return(0,w.__generator)(this,(function(a){switch(a.label){case 0:o(!0),m(null),c(null),a.label=1;case 1:return a.trys.push([1,4,5,6]),[4,fetch("".concat("https://perceval-ia-assurance-auto-production.osc-fr1.scalingo.io","/api/estimate-premium"),{method:"POST",headers:{"Content-Type":"application/json","X-API-Key":"XUuajpUhcMP8ZdFysWKV"},body:JSON.stringify({formData:e})})];case 2:return[4,a.sent().json()];case 3:return(n=a.sent()).success?(c(n.estimation),r={},n.estimation.prime_annuelle_ttc&&(r.prime_annuelle_ttc=n.estimation.prime_annuelle_ttc),n.estimation.fourchette_min&&(r.fourchette_prime_annuelle_min=n.estimation.fourchette_min),n.estimation.fourchette_max&&(r.fourchette_prime_annuelle_max=n.estimation.fourchette_max),Object.keys(r).length>0&&t.onUpdatePartialFormState(r)):m(n.error||"Erreur lors de l'estimation"),[3,6];case 4:return i=a.sent(),console.error("Erreur estimation:",i),m("Impossible de contacter le serveur d'estimation"),[3,6];case 5:return o(!1),[7];case 6:return[2]}}
1))}));return function(){return n.apply(this,arguments)}}();return(0,i.jsxs)("div",{children:[!h&&(0,i.jsx)("div",{className:"alert alert-warning",role:"alert",style:{borderRadius:"10px"},children:(0,i.jsxs)("div",{className:"d-flex align-items-start",children:[(0,i.jsx)("i",{className:"fas fa-exclamation-circle mr-3 mt-1",style:{fontSize:"1.25rem"}}),(0,i.jsxs)("div",{children:[(0,i.jsx)("strong",{className:"d-block mb-2",children:"Veuillez compl\xe9ter le formulaire"}),(0,i.jsx)("p",{className:"mb-2",style:{fontSize:"0.9rem"},children:"Pour obtenir une estimation, veuillez remplir tous les champs requis."})]})]})}),h&&(0,i.jsx)("button",{onClick:v,disabled:r,style:{cursor:r?"not-allowed":"pointer",borderRadius:"14px",padding:"15px 28px",fontWeight:"600",fontSize:"17px",border:"none",background:"linear-gradient(139deg, #ff22e8, #16b6c4)",color:"#fff",boxShadow:"0 10px 22px rgba(79,70,229,.25)",transition:".2s ease",opacity:r?.7:1},onMouseEnter:function(e){r||(e.currentTarget.style.transform="translateY(-1px)")},onMouseLeave:function(e){r||(e.currentTarget.style.transform="translateY(0)")},children:r?(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)("span",{className:"spinner-border spinner-border-sm mr-2",role:"status","aria-hidden":"true"}),"Estimation en cours..."]}):(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)("i",{className:"fas fa-magic mr-2"}),"Estimer ma prime"]})}),d&&(0,i.jsxs)("div",{className:"alert alert-danger mt-4",role:"alert",children:[(0,i.jsx)("i",{className:"fas fa-exclamation-triangle mr-2"}),d]}),l&&(0,i.jsx)("div",{className:"mt-4",children:(0,i.jsx)(It,{estimation:l})})]})},wt=function(){var e=(0,yt.useRouter)(),t=rt(),n=t.isFormComplete,r=t.leadId,o=t.formState,s=t.actions,l=Ue().actions,c=(0,a.useState)(!1),u=c[0],d=c[1];console.log("formState",o);var m=function(){var t=(0,C.Z)((function(){var t,i,a,c;return(0,w.__generator)(this,(function(u){switch(u.label){case 0:if(!n)return s.goToFirstIncompleteQuestion(),[2];if(!r)return console.error("Lead ID is missing"),A.Am.error("Une erreur est survenue lors de l'envoi de votre demande. Veuillez recharger la page et r\xe9essayer."),[2];console.log("process.env.NODE_ENV",{event:"Purchase",ecommerce:{purchase:{actionField:{id:r,revenue:o.prime_annuelle_ttc||"0",tax:"0",paymentMode:"none"},products:["AUTO"]}}}),null===(t=null===window||void 0===window?void 0:window.dataLayer)||void 0===t||t.push({event:"Purchase",ecommerce:{purchase:{actionField:{id:r,revenue:o.prime_annuelle_ttc||"0",tax:"0",paymentMode:"none"},products:["AUTO"]}}}),d(!0),u.label=1;case 1:return u.trys.push([1,4,,5]),[4,He()];case 2:return u.sent(),[4,l.patchToGraalApi("new-leads/".concat(r,"/finaliser"),{})];case 3:return u.sent(),e.push("/assurance-auto/succes"),[3,5];case 4:return i=u.sent(),console.error("Erreur lors de la finalisation du lead:",i),A.Am.error((null===(a=i.response)||void 0===a||null===(c=a.data)||void 0===c?void 0:c.message)||"Une erreur est survenue lors de l'envoi de votre demande. Veuillez r\xe9essayer."),d(!1),[3,5];case 5:return[2]}}
1))}));return function(){return t.apply(this,arguments)}}(),p={card:{borderRadius:"16px",border:"none",boxShadow:"0 4px 20px rgba(0, 0, 0, 0.08)"},cardBody:{padding:"2rem"},title:{fontSize:"1.25rem",fontWeight:"600",color:"#212529"},icon:{width:"40px",height:"40px",borderRadius:"10px",background:"linear-gradient(135deg, #4f46e5 0%, #7c3aed 100%)",display:"inline-flex",alignItems:"center",justifyContent:"center",marginRight:"1rem"},finalizeButton:{width:"100%",padding:"1.25rem 2rem",fontSize:"1.125rem",fontWeight:"600",borderRadius:"12px",border:"none",background:"linear-gradient(135deg, #4f46e5 0%, #7c3aed 100%)",color:"white",cursor:"pointer",transition:"all 0.3s ease",boxShadow:"0 4px 15px rgba(79, 70, 229, 0.3)"},finalizeButtonDisabled:{background:"#e5e7eb",color:"#9ca3af",cursor:"not-allowed",boxShadow:"none"}};return(0,i.jsxs)("div",{className:"w-100",children:[(0,i.jsx)("div",{className:"row",children:(0,i.jsx)("div",{className:"col-12",children:(0,i.jsx)("div",{className:"card",style:p.card,children:(0,i.jsxs)("div",{style:p.cardBody,children:[(0,i.jsxs)("div",{className:"d-flex align-items-center mb-4",children:[(0,i.jsx)("div",{style:p.icon,children:(0,i.jsx)("i",{className:"fas fa-calculator text-white"})}),(0,i.jsx)("h5",{className:"mb-0",style:p.title,children:"Estimation de votre prime"})]}),(0,i.jsx)("p",{className:"text-muted mb-4",children:"Obtenez une estimation instantan\xe9e de votre prime d'assurance bas\xe9e sur les informations que vous avez renseign\xe9es."}),(0,i.jsx)(Ct,{})]})})})}),(0,i.jsx)("div",{className:"row mt-4",children:(0,i.jsxs)("div",{className:"col-12",children:[(0,i.jsx)("button",{onClick:m,disabled:u,style:(0,b.Z)((0,x.Z)({},p.finalizeButton,!n||u?p.finalizeButtonDisabled:{}),{cursor:n&&u?"not-allowed":"pointer"}),onMouseEnter:function(e){n&&!u&&(e.target.style.transform="translateY(-2px)",e.target.style.boxShadow="0 6px 20px rgba(79, 70, 229, 0.4)")},onMouseLeave:function(e){n&&!u&&(e.target.style.transform="translateY(0)",e.target.style.boxShadow="0 4px 15px rgba(79, 70, 229, 0.3)")},children:u?(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)("i",{className:"fas fa-spinner fa-spin",style:{marginRight:"0.5rem"}}),"Envoi en cours..."]}):"Recevoir mon devis"}),!n&&!u&&(0,i.jsxs)("div",{style:{marginTop:"1rem",padding:"1rem",backgroundColor:"#fef3c7",borderRadius:"8px",border:"1px solid #fbbf24",display:"flex",alignItems:"center",gap:"0.75rem"},children:[(0,i.jsx)("i",{className:"fas fa-exclamation-circle",style:{color:"#d97706",fontSize:"1.25rem"}}),(0,i.jsx)("div",{style:{flex:1},children:(0,i.jsxs)("p",{style:{margin:0,color:"#78350f",fontSize:"0.95rem"},children:["Il manque des informations pour finaliser votre demande."," ",(0,i.jsx)("a",{onClick:function(e){e.preventDefault(),s.goToFirstIncompleteQuestion()},style:{color:"#d97706",fontWeight:"600",textDecoration:"underline",cursor:"pointer"},children:"Compl\xe9ter le formulaire"})]})})]})]})})]})},Tt="Le bonus/malus doit \xeatre un nombre compris entre 0.50 et 3.50 (ex: 0.85, 1.00, 1.25)";function jt(e){if(null===e||void 0===e)return null;var t=String(e).trim().replace(",",".");return/^\d+(\.\d+)?$/.test(t)?parseFloat(t).toFixed(2):null}var Rt=/^([A-Z]{2})(\d{3})([A-Z]{2})$/,At=/^(\d{1,4})([A-Z]{1,3})(\d{2})$/;function kt(e){if(null===e||void 0===e)return null;var t=String(e).toUpperCase().replace(/[^A-Z0-9]/g,""),n=t.match(Rt);if(n)return"".concat(n[1],"-").concat(n[2],"-").concat(n[3]);var r=t.match(At);return r?"".concat(r[1],"-").concat(r[2],"-").concat(r[3]):null}var Ot,Pt,Dt={VEHICULE_IDENTITE:"vehicule_identite",VEHICULE_IMMAT:"vehicule_immatriculation",VEHICULE_CARACTERISTIQUES:"vehicule_caracteristiques",VEHICULE_DATES:"vehicule_dates",VEHICULE_STATIONNEMENT:"vehicule_stationnement",VEHICULE_FINANCEMENT:"vehicule_financement",VEHICULE_USAGE:"vehicule_usage",UTILISATEUR_LOCALISATION:"utilisateur_localisation",CONDUCTEUR_IDENTITE:"conducteur_identite",CONDUCTEUR_EXPERIENCE:"conducteur_experience",SINISTRES_GENERAL:"sinistres_general",SINISTRE_1:"sinistre_1",SINISTRE_2_PRESENCE:"sinistre_2_presence",SINISTRE_2:"sinistre_2",SINISTRE_3_PRESENCE:"sinistre_3_presence",SINISTRE_3:"sinistre_3",FORMULE:"formule",FRANCHISE:"franchise",GARANTIE_CONDUCTEUR:"garantie_conducteur",GARANTIE_ACCESSOIRES:"garantie_accessoires",GARANTIE_ASSISTANCE:"garantie_assistance",GARANTIE_PROTECTION_JURIDIQUE:"garantie_protection_juridique",GARANTIE_VEHICULE_REMPLACEMENT:"garantie_vehicule_remplacement",GARANTIE_INDEMNISATION_MAJOREE:"garantie_indemnisation_majoree",GARANTIE_REMBOURSEMENT_CREDIT:"garantie_remboursement_credit",GARANTIE_PACK_VALEUR_NEUF:"garantie_pack_valeur_neuf"},Lt=(Ot={},(0,v.Z)(Ot,Dt.VEHICULE_IDENTITE,"Identit\xe9 du v\xe9hicule"),(0,v.Z)(Ot,Dt.VEHICULE_IMMAT,"Immatriculation"),(0,v.Z)(Ot,Dt.VEHICULE_CARACTERISTIQUES,"Caract\xe9ristiques techniques"),(0,v.Z)(Ot,Dt.VEHICULE_DATES,"Dates du v\xe9hicule"),(0,v.Z)(Ot,Dt.VEHICULE_STATIONNEMENT,"Stationnement"),(0,v.Z)(Ot,Dt.VEHICULE_FINANCEMENT,"Financement"),(0,v.Z)(Ot,Dt.VEHICULE_USAGE,"Usage et kilom\xe9trage"),(0,v.Z)(Ot,Dt.UTILISATEUR_LOCALISATION,"L
1ocalisation"),(0,v.Z)(Ot,Dt.CONDUCTEUR_IDENTITE,"Identit\xe9 du conducteur"),(0,v.Z)(Ot,Dt.CONDUCTEUR_EXPERIENCE,"Exp\xe9rience de conduite"),(0,v.Z)(Ot,Dt.SINISTRES_GENERAL,"Sinistres"),(0,v.Z)(Ot,Dt.SINISTRE_1,"Premier sinistre"),(0,v.Z)(Ot,Dt.SINISTRE_2_PRESENCE,"Autre sinistre ?"),(0,v.Z)(Ot,Dt.SINISTRE_2,"Deuxi\xe8me sinistre"),(0,v.Z)(Ot,Dt.SINISTRE_3_PRESENCE,"Autre sinistre ?"),(0,v.Z)(Ot,Dt.SINISTRE_3,"Troisi\xe8me sinistre"),(0,v.Z)(Ot,Dt.FORMULE,"Choix de la formule"),(0,v.Z)(Ot,Dt.FRANCHISE,"Franchise"),(0,v.Z)(Ot,Dt.GARANTIE_CONDUCTEUR,"Garantie du conducteur"),(0,v.Z)(Ot,Dt.GARANTIE_ACCESSOIRES,"Accessoires et am\xe9nagements"),(0,v.Z)(Ot,Dt.GARANTIE_ASSISTANCE,"Assistance"),(0,v.Z)(Ot,Dt.GARANTIE_PROTECTION_JURIDIQUE,"Protection juridique"),(0,v.Z)(Ot,Dt.GARANTIE_VEHICULE_REMPLACEMENT,"V\xe9hicule de remplacement"),(0,v.Z)(Ot,Dt.GARANTIE_INDEMNISATION_MAJOREE,"Indemnisation valeur major\xe9e"),(0,v.Z)(Ot,Dt.GARANTIE_REMBOURSEMENT_CREDIT,"Remboursement du cr\xe9dit"),(0,v.Z)(Ot,Dt.GARANTIE_PACK_VALEUR_NEUF,"Pack valeur \xe0 neuf"),[Dt.VEHICULE_IDENTITE,Dt.VEHICULE_IMMAT,Dt.VEHICULE_CARACTERISTIQUES,Dt.VEHICULE_DATES,Dt.VEHICULE_STATIONNEMENT,Dt.VEHICULE_FINANCEMENT,Dt.VEHICULE_USAGE,Dt.UTILISATEUR_LOCALISATION,Dt.CONDUCTEUR_IDENTITE,Dt.CONDUCTEUR_EXPERIENCE,Dt.SINISTRES_GENERAL,Dt.SINISTRE_1,Dt.SINISTRE_2_PRESENCE,Dt.SINISTRE_2,Dt.SINISTRE_3_PRESENCE,Dt.SINISTRE_3,Dt.FORMULE,Dt.FRANCHISE,Dt.GARANTIE_CONDUCTEUR,Dt.GARANTIE_ACCESSOIRES,Dt.GARANTIE_ASSISTANCE,Dt.GARANTIE_PROTECTION_JURIDIQUE,Dt.GARANTIE_VEHICULE_REMPLACEMENT,Dt.GARANTIE_RUPTURE_ACTIVITE,Dt.GARANTIE_INDEMNISATION_MAJOREE,Dt.GARANTIE_REMBOURSEMENT_CREDIT,Dt.GARANTIE_PACK_VALEUR_NEUF]),Mt=(Pt={},(0,v.Z)(Pt,Dt.VEHICULE_IDENTITE,"Quelle est la *marque*, le *mod\xe8le* et la *finition* de votre v\xe9hicule ?"),(0,v.Z)(Pt,Dt.VEHICULE_IMMAT,"Quelle est l'*immatriculation* de votre v\xe9hicule ?"),(0,v.Z)(Pt,Dt.VEHICULE_CARACTERISTIQUES,"Quel est le *carburant*, la *puissance fiscale* et le type de *carrosserie* de votre v\xe9hicule ?"),(0,v.Z)(Pt,Dt.VEHICULE_DATES,"Quelle est la *date d'achat*, la *date de premi\xe8re mise en circulation* et le *mode de financement* de votre v\xe9hicule ?"),(0,v.Z)(Pt,Dt.VEHICULE_STATIONNEMENT,"Dans quelle *commune* et *o\xf9* votre v\xe9hicule est-il *stationn\xe9 la nuit* ?"),(0,v.Z)(Pt,Dt.VEHICULE_FINANCEMENT,"Comment avez-vous *financ\xe9* votre v\xe9hicule ?"),(0,v.Z)(Pt,Dt.VEHICULE_USAGE,"Quel est l'*usage* de votre v\xe9hicule et combien de *kilom\xe8tres* parcourez-vous *par an* ?"),(0,v.Z)(Pt,Dt.UTILISATEUR_LOCALISATION,"Dans quelle *commune* habitez-vous ?"),(0,v.Z)(Pt,Dt.CONDUCTEUR_IDENTITE,"Quelle est votre *date de naissance* et la *date d'obtention de votre permis* de conduire ?"),(0,v.Z)(Pt,Dt.CONDUCTEUR_EXPERIENCE,"Quel est votre coefficient *bonus/malus* ?"),(0,v.Z)(Pt,Dt.SINISTRES_GENERAL,"Avez-vous eu des *sinistres* dans les *36 derniers mois* ?"),(0,v.Z)(Pt,Dt.SINISTRE_1,"Quelle \xe9tait la *nature* et la *date* du *premier sinistre* ?"),(0,v.Z)(Pt,Dt.SINISTRE_2_PRESENCE,"Avez-vous eu un *deuxi\xe8me sinistre* dans les *36 derniers mois* ?"),(0,v.Z)(Pt,Dt.SINISTRE_2,"Quelle \xe9tait la *nature* et la *date* du *deuxi\xe8me sinistre* ?"),(0,v.Z)(Pt,Dt.SINISTRE_3_PRESENCE,"Avez-vous eu un *troisi\xe8me sinistre* dans les *36 derniers mois* ?"),(0,v.Z)(Pt,Dt.SINISTRE_3,"Quelle \xe9tait la *nature* et la *date* du *troisi\xe8me sinistre* ?"),(0,v.Z)(Pt,Dt.FORMULE,"Quelle *formule d'assurance* souhaitez-vous ? *Essentiel* pour les garanties de base, *Confort* pour une protection \xe9tendue, ou *S\xe9r\xe9nit\xe9* pour une couverture compl\xe8te ?"),(0,v.Z)(Pt,Dt.FRANCHISE,"Souhaitez-vous un contrat *avec* ou *sans franchise* ?"),(0,v.Z)(Pt,Dt.GARANTIE_CONDUCTEUR,"Souhaitez-vous la *Garantie du conducteur* ? Couvre vos *blessures* m\xeame si vous \xeates responsable."),(0,v.Z)(Pt,Dt.GARANTIE_ACCESSOIRES,"Souhaitez-vous la garantie *Accessoires et am\xe9nagements* ? Rembourse les *\xe9quipements endommag\xe9s*."),(0,v.Z)(Pt,Dt.GARANTIE_ASSISTANCE,"Souhaitez-vous la garantie *Assistance* ? *Remorquage* et *rapatriement* en cas de panne ou accident."),(0,v.Z)(Pt,Dt.GARANTIE_PROTECTION_JURIDIQUE,"Souhaitez-vous la *Protection juridique* ? *D\xe9fense* et *conseil* en cas de litige."),(0,v.Z)(Pt,Dt.GARANTIE_VEHICULE_REMPLACEMENT,"Souhaitez-vous la garantie *V\xe9hicule de remplacement* ? *Voiture de pr\xeat* si immobilisation."),(0,v.Z)(Pt,Dt.GARANTIE_INDEMNISATION_MAJOREE,"Souhaitez-vous un *meilleur remboursement* si perte totale du v\xe9hicule ? *+30%* de la valeur expertis\xe9e."),(0,v.Z)(Pt,Dt.GARANTIE_REMBOURSEMENT_CREDIT,"Souhaitez-vous le *Remboursement du cr\xe9dit* ? R\xe8gle le *solde du pr\xeat* si besoin."),(0,v.Z)(Pt,Dt.GARANTIE_PACK_VALEUR_NEUF,"Souhaitez-vous un *remboursement valeur \xe0 neuf* si votre v\xe9hicule \xe0 moins de 2 ans ?"),Pt),Ut=[{id:"utilisateur",title:"Utilisateur",showTitle:!0,shortTitle:"Utilisateur",icon:"fa-user",component:(0,i.jsx)(gt,{})},{id:"pieces",title:"Pieces Justificatives",showTitle:!1,shortTitle:"Documents",icon:"fa-file",component:(0,i.jsx)(ct,{})},{id:"assistant_vocal",title:"Assistant vocal",showTitle:!1,shortTitle:"Assistant",icon:"fa-microphone",component:(0,i.jsx)(st,{embed:!0})},{id:"vehicule",title:"V\xe9hicule",showTitle:!0,shortTitle:"V\xe9hicule",icon:"fa-car",component:(0,i.jsx)(xt,{})},{id:"conducteur",title:"Conducteur",showTitle:!0,shortTitle:"Conducteur",icon:"fa-id-card",component:(0,i.jsx)(at,{})},{id:"formule",title:"Formule",showTitle:!0,shortTitle:"Formule",icon:"fa-cog",component:(0,i.jsx)(ot,{})},{id:"garanties",title:"Options",showTitle:!0,shortTitle:"Options",icon:"fa-shield-alt",component:(0,i.jsx)(bt,{})},{id:"actions",title:"Estimation & Actions",showTitle:!0,shortTitle:"Estimation",icon:"fa-calculator",component:(0,i.jsx)(wt,{})}],qt={CARTE_GRISE:"CARTE_GRISE",PERMIS_CONDUIRE:"PERMIS_CONDUIRE",RELEVE_INFORMATION:"RELEVE_INFORMATION"},zt={CARTE_GRISE:"Carte grise",PERMIS_CONDUIRE:"Permis de conduire",RELEVE_INFORMATION:"Relev\xe9 d'informations"},Zt={CARTE_GRISE:[{src:"/images/auto/carte-grise-ferme.webp",alt:"Carte grise"}],PERMIS_CONDUIRE:[{src:"/images/auto/permis-new.webp",alt:"Permis de conduire (nouveau format)"},{src:"/images/auto/permis-old.webp",alt:"Permis de conduire (ancien format)"}],RELEVE_INFORMATION:[{src:"/images/auto/releve.webp",alt:"Relev\xe9 d'informations"}]},Ft={RELEVE_INFORMATION:"Relev\xe9 d'information (relev\xe9 de sinistralit\xe9)\n\nDocument officiel que vous devez demander \xe0 votre assureur actuel ou \xe0 vos anciens assureurs. Il n'est pas envoy\xe9 automatiquement.\n\nIl r\xe9capitule vos ant\xe9c\xe9dents d'assurance auto sur une p\xe9riode donn\xe9e, notamment :\n\n\u2022 La liste des sinistres d\xe9clar\xe9s\n\u2022 Pour chaque sinistre : la date, la nature (bris de glace, incendie, vol, collision), l'existence de dommages mat\xe9riels et/ou corporels, et votre taux de responsabilit\xe9 (0%, 50%, 100%)\n\u2022 Votre coefficient bonus-malus \xe0 la date d'\xe9dition du document\n\nCe document est dat\xe9 du jour o\xf9 il est \xe9dit\xe9. Il est d\xe9livr\xe9 gratuitement et l'assureur a l'obligation de vous le fournir sur simple demande.\n\nIl sert \xe0 un nouvel assureur pour v\xe9rifier vos ant\xe9c\xe9dents, reprendre votre bonus-malus et calculer votre tarif de mani\xe8re plus pr\xe9cise."},Bt={BTN_LIST:"btnList",TEXT:"text",CHECK_BTN_LIST:"checkBtnList",NUMBER_INT:"number",DATE:"date",SELECT:"select",CHECKBOX:"checkbox"},Vt=(0,f.cn)({civilite_utilisateur:{category:"utilisateur",label:"Vous \xeates ?",type:"BTN_LIST",n
1ame:"civilite_utilisateur",datas:[{name:"Un homme",id:"1"},{name:"Une femme",id:"2"}],defaultValue:""},nom_utilisateur:{category:"utilisateur",label:"Votre nom",type:"TEXT",name:"nom_utilisateur",placeholder:"Ex: Dupont",defaultValue:""},prenom_utilisateur:{category:"utilisateur",label:"Votre pr\xe9nom",type:"TEXT",name:"prenom_utilisateur",placeholder:"Ex: Jean",defaultValue:""},telephone_utilisateur:{category:"utilisateur",label:"Votre num\xe9ro de t\xe9l\xe9phone",type:"TEXT",name:"telephone_utilisateur",placeholder:"Ex: 0692123456",defaultValue:""},email_utilisateur:{category:"utilisateur",label:"Votre adresse email",type:"TEXT",name:"email_utilisateur",placeholder:"Ex: [email protected]",defaultValue:""},marque_vehicule:{category:"vehicule",label:"Marque du v\xe9hicule",type:"TEXT",name:"marque_vehicule",placeholder:"Ex: Peugeot, Renault, BMW...",defaultValue:"",ia_params:{text:"Quelle est la marque de votre v\xe9hicule ?",text_short:"Marque du v\xe9hicule",type:"string",validation:"Marque automobile (ex: Peugeot, Renault, BMW, etc.)",bloc:Dt.VEHICULE_IDENTITE,hint:"La marque peut \xeatre trouv\xe9e sur votre carte grise ou directement sur votre voiture."},ocr_params:{document_type:"CARTE_GRISE",label:"Marque du v\xe9hicule",box:"D.1",type:"string",hint:"Marque en D.1."}},modele_vehicule:{category:"vehicule",label:"Mod\xe8le du v\xe9hicule",type:"TEXT",name:"modele_vehicule",placeholder:"Ex: 308, Clio, S\xe9rie 3...",defaultValue:"",ia_params:{text:"Quel est le mod\xe8le exact de votre v\xe9hicule ?",text_short:"Mod\xe8le du v\xe9hicule",type:"string",validation:"Mod\xe8le pr\xe9cis (ex: 308, Clio, S\xe9rie 3, etc.)",bloc:Dt.VEHICULE_IDENTITE},ocr_params:{document_type:"CARTE_GRISE",label:"Modele du v\xe9hicule",box:"D.3",type:"string",hint:"Modele en D.3."}},version_vehicule:{category:"vehicule",label:"Finition",type:"TEXT",name:"version_vehicule",placeholder:"Ex: GTI, Sport, Confort...",defaultValue:"",ia_params:{text:"Quelle est la finition de votre v\xe9hicule ?",text_short:"Finition du v\xe9hicule",type:"string",validation:"Version ou finition du v\xe9hicule (ex: GTI, Sport, Confort). Si aucune finition sp\xe9cifique, r\xe9pondre 'Aucune'",bloc:Dt.VEHICULE_IDENTITE}},immatriculation_vehicule:{category:"vehicule",label:"Num\xe9ro d'immatriculation",type:"TEXT",name:"immatriculation_vehicule",placeholder:"Ex: AA-123-BB ou 123-ABC-12",defaultValue:"",ia_params:{text:"Quelle est l'immatriculation de votre v\xe9hicule ?",text_short:"Immatriculation",type:"string",validation:"Num\xe9ro d'immatriculation VALIDE exig\xe9, enregistr\xe9 en MAJUSCULES avec tirets (ex: AA-123-BB, 123-ABC-45). Ne jamais enregistrer la forme \xe9pel\xe9e caract\xe8re par caract\xe8re.",bloc:Dt.VEHICULE_IMMAT,validate:function(e){return function(e){return null===kt(e)?"Num\xe9ro d'immatriculation invali
1de. Format attendu : AA-123-BB (nouveau format) ou 123-ABC-45 (ancien format)":null}(e)},normalizeAnswer:function(e){return kt(e)}},ocr_params:{document_type:"CARTE_GRISE",label:"Num\xe9ro d'immatriculation",box:"A",type:"string",pattern:"^([A-Z]{2}-?\\d{3}-?[A-Z]{2}|\\d{1,4}-?[A-Z]{1,3}-?\\d{2})$",normalize:["uppercase","strip_spaces"],hint:"Utiliser la case A. Majuscules, format AA-123-AA ou anciens formats."}},energie_vehicule:{category:"vehicule",label:"Carburant",type:"SELECT",name:"energie_vehicule",datas:[{name:"Essence",id:"ES"},{name:"Diesel",id:"GO"},{name:"\xc9lectrique",id:"EL"},{name:"Hybride",id:"HY"},{name:"GPL",id:"GP"}],defaultValue:"",ia_params:{text:"Quel est le carburant de votre v\xe9hicule ?",text_short:"Carburant",type:"string",validation:"Type de carburant du v\xe9hicule",bloc:Dt.VEHICULE_CARACTERISTIQUES},ocr_params:{document_type:"CARTE_GRISE",label:"Type d'\xe9nergie / carburant",box:"P.3",type:"string",pattern:"",normalize:["string_corresponding_to_option_id"],hint:"Type de carburant en P.3. Renvoyer une string correspondant \xe0 l'option ('ES' pour Essence, 'GO' pour diesel, 'EL' pour \xe9lectrique, 'HY' pour hybride, 'GP' pour GPL)."}},puissance_fiscale:{category:"vehicule",label:"Puissance fiscale",type:"NUMBER_INT",name:"puissance_fiscale",placeholder:"Ex: 7 (en chevaux fiscaux)",defaultValue:"",ia_params:{text:"Quelle est la puissance fiscale de votre v\xe9hicule ?",text_short:"Puissance fiscale",type:"number",validation:"Nombre entier compris entre 3 et 60 repr\xe9sentant la puissance fiscale en chevaux. Toute valeur non comprise entre 3 et 60 inclus doit \xeatre refus\xe9e.",bloc:Dt.VEHICULE_CARACTERISTIQUES,suffix:"chevaux",validate:function(e){var t=Number(e);return Number.isFinite(t)&&Number.isInteger(t)&&(t<3||t>60)?"La puissance fiscale doit \xeatre un nombre entier compris entre 1 et 60 chevaux":null}},ocr_params:{document_type:"CARTE_GRISE",label:"Puissance administrative nationale",box:"P.6",type:"number",pattern:"^\\d{1,2}$",normalize:["number_int"],hint:"Puissance fiscale en P.6 (chevaux fiscaux). Nomber entier attendu."}},carrosserie_vehicule:{category:"vehicule",label:"Carrosserie",type:"SELECT",name:"carrosserie_vehicule",datas:[{name:"Citadine",id:"citadine"},{name:"Berline",id:"berline"},{name:"Break",id:"break"},{name:"Coup\xe9",id:"coupe"},{name:"Cabriolet",id:"cabriolet"},{name:"Monospace",id:"monospace"},{name:"SUV",id:"suv"},{name:"4x4",id:"4x4"},{name:"Utilitaire",id:"utilitaire"}],defaultValue:"",ia_params:{text:"Quel est le type de carrosserie de votre v\xe9hicule ?",text_short:"Carrosserie",type:"string",validation:"Type de carrosserie",bloc:Dt.VEHICULE_CARACTERISTIQUES},ocr_params:{document_type:"CARTE_GRISE",label:"Carrosserie du v\xe9hicule",box:"J.3",type:"string",pattern:"",normalize:["string_corresponding_to_option_id"],hint:"Type de carrosserie en J.3 \xe0 mapper sur les options (citadine, berline, break, coupe, cabriolet, monospace, suv, 4x4, utilitaire). Ne rien mettre si ne correspond \xe0 aucune des options."}},date_acquisition:{category:"vehicule",label:"Date d'achat",type:"DATE",name:"date_acquisition",defaultValue:null,ia_params:{text:"Quelle est la date d'achat de votre v\xe9hicule ?",text_short:"Date d'achat",type:"date",validation:"Date au format JJ/MM/AAAA",bloc:Dt.VEHICULE_DATES}},date_premiere_circulation:{category:"vehicule",label:"Date de premi\xe8re mise en circulation",type:"DATE",name:"date_premiere_circulation",defaultValue:null,ia_params:{text:"Quelle est la date de premi\xe8re mise en circulation de votre v\xe9hicule ?",text_short:"Date de 1\xe8re circulation",type:"date",validation:"Date au format JJ/MM/AAAA. La date de premi\xe8re mise en circulation ne peut pas \xeatre post\xe9rieure \xe0 la date d'achat.",bloc:Dt.VEHICULE_DATES},ocr_params:{document_type:"CARTE_GRISE",label:"Date de premi\xe8re immatriculation",box:"B",type:"date",pattern:"^\\d{2}/\\d{2}/\\d{4}$",normalize:["date_format_dd_mm_yyyy"],hint:"Date de premi\xe8re immatriculation en case B. Format DD/MM/YYYY."}},financement_vehicule:{category:"vehicule",label:"Mode de financement du v\xe9hicule",type:"BTN_LIST",n
1ame:"financement_vehicule",datas:[{name:"Comptant",id:"comptant"},{name:"Cr\xe9dit automobile",id:"credit"},{name:"Leasing",id:"leasing"},{name:"Location longue dur\xe9e",id:"lld"}],defaultValue:"",ia_params:{text:"Comment avez-vous financ\xe9 votre v\xe9hicule ?",text_short:"Financement",type:"string",validation:"Mode de financement",bloc:Dt.VEHICULE_DATES}},lieu_garage:{category:"vehicule",label:"Dans quelle commune votre v\xe9hicule est-il stationn\xe9 habituellement ?",type:"SELECT",name:"lieu_garage",datas:_t,defaultValue:"",ia_params:{text:"Dans quelle commune est gar\xe9 votre v\xe9hicule habituellement ?",text_short:"Lieu de garage",type:"string",validation:"Commune ou lieu de stationnement habituel",bloc:Dt.VEHICULE_STATIONNEMENT}},type_garage:{category:"vehicule",label:"Type de garage (o\xf9 le v\xe9hicule est en g\xe9n\xe9ral stationn\xe9 la nuit)",type:"BTN_LIST",name:"type_garage",datas:[{name:"Garage ferm\xe9",id:"ferme"},{name:"Parking couvert",id:"couvert"},{name:"Parking d\xe9couvert",id:"decouvert"},{name:"Pas de garage clos",id:"aucun"}],defaultValue:"",ia_params:{text:"O\xf9 votre v\xe9hicule est-il stationn\xe9 la nuit ?",text_short:"Type de garage",type:"string",validation:"Type de stationnement nocturne",bloc:Dt.VEHICULE_STATIONNEMENT}},usage_vehicule:{category:"vehicule",label:"Usage du v\xe9hicule",type:"BTN_LIST",name:"usage_vehicule",datas:[{name:"Priv\xe9 uniquement",id:"prive"},{name:"Priv\xe9 / trajet travail",id:"prive_travail"},{name:"Professionnel",id:"professionnel"}],defaultValue:"",ia_params:{text:"Utilisez-vous votre v\xe9hicule pour des trajets personnels, professionnels ou les deux ?",text_short:"Usage du v\xe9hicule",type:"string",validation:"Usage du v\xe9hicule",bloc:Dt.VEHICULE_USAGE}},kilometrage_annuel:{category:"vehicule",label:"Kilom\xe9trage annuel parcouru avec le v\xe9hicule \xe0 assurer",type:"NUMBER_INT",name:"kilometrage_annuel",placeholder:"Ex: 12000",defaultValue:"",ia_params:{text:"Combien de kilom\xe8tres parcourez-vous par an avec ce v\xe9hicule ?",text_short:"Kilom\xe9trage annuel",type:"number",validation:"Nombre entier positif coh\xe9rent pour une voiture",bloc:Dt.VEHICULE_USAGE}},commune_utilisateur:{category:"conducteur",label:"Quelle est votre commune de r\xe9sidence ?",type:"SELECT",name:"commune_utilisateur",datas:_t,defaultValue:"",ia_params:{text:"Dans quelle commune habitez-vous ?",text_short:"Commune de r\xe9sidence",type:"string",validation:"Commune de r\xe9sidence",bloc:Dt.UTILISATEUR_LOCALISATION}},conducteur1_date_naissance:{category:"conducteur",label:"Date de naissance du conducteur principal",type:"DATE",name:"conducteur1_date_naissance",defaultValue:"",ia_params:{text:"Quelle est votre date de naissance ?",text_short:"Date de naissance",type:"date",validation:"Date au format JJ/MM/AAAA. Le conducteur doit avoir au minimum 17 ans.",bloc:Dt.CONDUCTEUR_IDENTITE,validate:function(e){var t=g.ou.fromFormat(e,"dd/MM/yyyy");return t.isValid&&Math.floor(-t.diffNow("years").years)<17?"Le conducteur doit avoir au minimum 17 ans":null}},ocr_params:{document_type:"PERMIS_CONDUIRE",label:"Date de naissance",box:"3",type:"date",pattern:"^\\d{2}/\\d{2}/\\d{4}$",normalize:["date_format_dd_mm_yyyy"],hint:"Date de naissance en case 3. Format DD/MM/YYYY."}},conducteur1_date_permis:{category:"conducteur",label:"Date d'obtention du permis",type:"DATE",name:"conducteur1_date_permis",defaultValue:"",ia_params:{text:"Quelle est la date d'obtention de votre permis de conduire ?",text_short:"Date du permis",type:"date",validation:"Date au format JJ/MM/AAAA. Le permis ne peut pas avoir \xe9t\xe9 obtenu avant les 17 ans du conducteur.",bloc:Dt.CONDUCTEUR_IDENTITE,validate:function(e,t,n){var r=g.ou.fromFormat(e,"dd/MM/yyyy");if(!r.isValid)return null;var i=(null===t||void 0===t?void 0:t.conducteur1_date_naissance)||(null===n||void 0===n?void 0:n.conducteur1_date_naissance);if(!i)return null;var a=g.ou.fromFormat(i,"dd/MM/yyyy");return a.isValid&&r.diff(a,"years").years<17?"Le permis ne peut pas avoir \xe9t\xe9 obtenu avant les 17 ans du conducteur":null}},ocr_params:{document_type:"PERMIS_CONDUIRE",label:"Date d'obtention du permis",box:"10",type:"date",pattern:"^\\d{2}/\\d{2}/\\d{4}$",normalize:["date_format_dd_mm_yyyy"],hint:"Date de d\xe9livrance du permis en case 10. Format DD/MM/YYYY."}},conducteur1_bonus_malus:{category:"conducteur",label:"Bonus/Malus",type:"TEXT",name:"conducteur1_bonus_malus",placeholder:"Ex: 0.76, 1.00, 1.25",defaultValue:"",ia_params:{text:"Quel est votre coefficient bonus/malus ?",text_short:"Bonus/Malus",type:"string",validation:"Nombre d\xe9cimal COMPRIS ENTRE 0.50 ET 3.50, d\xe9cimales s\xe9par\xe9es par un point (ex: 0.76, 1.00, 1.25). Toute valeur hors de cette plage doit \xeatre refus\xe9e.",bloc:Dt.CONDUCTEUR_EXPERIENCE,validate:function(e){return function(e){var t=jt(e);if(null===t)return Tt;var n=parseFloat(t);return n<.5||n>3.5?Tt:null}(e)},normalizeAnswer:function(e){return jt(e)},defaultWhenSkipped:"1",defaultWhenSkippedMessage:"Pas de souci. Je vais renseigner la valeur par d\xe9faut de 1, que vous pourrez ajuster dans le formulaire."},ocr_params:{document_type:"RELEVE_INFORMATION",label:"Coefficiant de r\xe9duction-majoration (ou bonus/malus)",box:"",type:"string",pattern:"",normalize:["number_2_decimals_separated_by_dot"],hint:"Coefficient de r\xe9duction-majoration appel\xe9 commun\xe9ment bonnus/malus. Valeur d\xe9cimale comprise en 0.5 et 3.5."}},sinistres_36_mois:{category:"conducteur",label:"Avez-vous d\xe9clar\xe9 un ou plusieurs sinistres au cours des 36 derniers mois ?",type:"BTN_LIST",n
1ame:"sinistres_36_mois",datas:[{name:"Oui",id:"1"},{name:"Non",id:"2"}],defaultValue:"",ia_params:{text:"Avez-vous eu des sinistres dans les 36 derniers mois ?",text_short:"Sinistres 36 mois",type:"string",validation:"R\xe9pondre par oui ou non",bloc:Dt.SINISTRES_GENERAL},ocr_params:{document_type:"RELEVE_INFORMATION",label:"Pr\xe9sence ou absence de sinitres d\xe9clar\xe9s",box:"",type:"string",pattern:"",normalize:["string_corresponding_to_option_id"],hint:"Renvoyer une string : '1' si des sinitres ont eu lieu, '2' si aucun sinitre."}},sinistre1_nature:{category:"conducteur",label:"Quelle est la nature du 1er sinistre ?",type:"SELECT",name:"sinistre1_nature",datas:[{name:"Collision",id:"collision"},{name:"Vol / Incendie / Stationnement",id:"vol_incendie"},{name:"Bris de glace",id:"bris_glace"},{name:"D\xe9g\xe2ts naturels",id:"degats_naturels"},{name:"Autre",id:"autre"}],defaultValue:"",condition:{dependsOn:"sinistres_36_mois",value:"1",operator:"equals"},ia_params:{text:"Quelle \xe9tait la nature du premier sinistre ?",text_short:"Nature sinistre 1",type:"string",validation:"Type de sinistre",bloc:Dt.SINISTRE_1},ocr_params:{document_type:"RELEVE_INFORMATION",label:"Nature du premier sinistre",box:"",type:"string",pattern:"",normalize:["string_corresponding_to_option_id"],hint:"Uniquement pour le premier sinistre. Renvoyer une string selon le type de sinistre d\xe9duit parmi : 'collision', 'vol_incendie', 'bris_glace', 'degats_naturels', 'autre'."}},sinistre1_date:{category:"conducteur",label:"Date du 1er sinistre",type:"DATE",name:"sinistre1_date",defaultValue:"",condition:{dependsOn:"sinistres_36_mois",value:"1",operator:"equals"},ia_params:{text:"Quelle \xe9tait la date du premier sinistre ?",text_short:"Date sinistre 1",type:"date",validation:"Date au format JJ/MM/AAAA",bloc:Dt.SINISTRE_1},ocr_params:{document_type:"RELEVE_INFORMATION",label:"Date du premier sinistre",box:"",type:"date",pattern:"",normalize:["date_format_dd_mm_yyyy"],hint:"Date du premier sinistre. Format DD/MM/YYYY."}},sinistre2_presence:{category:"conducteur",label:"Avez-vous eu un deuxi\xe8me sinistre au cours des 36 derniers mois ?",type:"BTN_LIST",name:"sinistre2_presence",datas:[{name:"Oui",id:"1"},{name:"Non",id:"2"}],defaultValue:"",condition:{dependsOn:"sinistres_36_mois",value:"1",operator:"equals"},ia_params:{text:"Avez-vous eu un deuxi\xe8me sinistre dans les 36 derniers mois ?",text_short:"Sinistre 2 pr\xe9sent",type:"string",validation:"R\xe9pondre par oui ou non",bloc:Dt.SINISTRE_2_PRESENCE},ocr_params:{document_type:"RELEVE_INFORMATION",label:"Pr\xe9sence ou absence d'un deuxi\xe8me sinitre d\xe9clar\xe9",box:"",type:"string",pattern:"",normalize:["string_corresponding_to_option_id"],hint:"Si un deuxi\xe8me sinistre a eu lieu. Renvoyer une string : '1' si le deuxi\xe8me sinistre a eu lieu, '2' si aucun deuxi\xe8me sinitre."}},sinistre2_nature:{category:"conducteur",label:"Quelle est la nature du 2\xe8me sinistre ?",type:"SELECT",name:"sinistre2_nature",datas:[{name:"Collision",id:"collision"},{name:"Vol / Incendie / Stationnement",id:"vol_incendie"},{name:"Bris de glace",id:"bris_glace"},{name:"D\xe9g\xe2ts naturels",id:"degats_naturels"},{name:"Autre",id:"autre"}],defaultValue:"",condition:{dependsOn:"sinistre2_presence",value:"1",operator:"equals"},ia_params:{text:"Quelle \xe9tait la nature du deuxi\xe8me sinistre ?",text_short:"Nature sinistre 2",type:"string",validation:"Type de sinistre",bloc:Dt.SINISTRE_2},ocr_params:{document_type:"RELEVE_INFORMATION",label:"Nature du deuxi\xe8me sinistre",box:"",type:"string",pattern:"",normalize:["string_corresponding_to_option_id"],hint:"Uniquement pour le deuxi\xe8me sinistre. Renvoyer une string selon le type de sinistre d\xe9duit parmi : 'collision', 'vol_incendie', 'bris_glace', 'degats_naturels', 'autre'."}},sinistre2_date:{category:"conducteur",label:"Date du 2\xe8me sinistre",type:"DATE",name:"sinistre2_date",defaultValue:"",condition:{dependsOn:"sinistre2_presence",value:"1",operator:"equals"},ia_params:{text:"Quelle \xe9tait la date du deuxi\xe8me sinistre ?",text_short:"Date sinistre 2",type:"date",validation:"Date au format JJ/MM/AAAA",bloc:Dt.SINISTRE_2},ocr_params:{document_type:"RELEVE_INFORMATION",label:"Date du deuxi\xe8me sinistre",box:"",type:"date",pattern:"",normalize:["date_format_dd_mm_yyyy"],hint:"Date du deuxi\xe8me sinistre. Format DD/MM/YYYY."}},sinistre3_presence:{category:"conducteur",label:"Avez-vous eu un troisi\xe8me sinistre au cours des 36 derniers mois ?",type:"BTN_LIST",n
1ame:"sinistre3_presence",datas:[{name:"Oui",id:"1"},{name:"Non",id:"2"}],defaultValue:"",condition:{dependsOn:"sinistre2_presence",value:"1",operator:"equals"},ia_params:{text:"Avez-vous eu un troisi\xe8me sinistre dans les 36 derniers mois ?",text_short:"Sinistre 3 pr\xe9sent",type:"string",validation:"R\xe9pondre par oui ou non",bloc:Dt.SINISTRE_3_PRESENCE},ocr_params:{document_type:"RELEVE_INFORMATION",label:"Pr\xe9sence ou absence d'un troisi\xe8me sinistre",box:"",type:"string",pattern:"",normalize:["string_corresponding_to_option_id"],hint:"Si un troisi\xe8me sinistre a eu lieu. Renvoyer une string : '1' si le troisi\xe8me sinistre a eu lieu, '2' si aucun troisi\xe8me sinitre."}},sinistre3_nature:{category:"conducteur",label:"Quelle est la nature du 3\xe8me sinistre ?",type:"SELECT",name:"sinistre3_nature",datas:[{name:"Collision",id:"collision"},{name:"Vol / Incendie / Stationnement",id:"vol_incendie"},{name:"Bris de glace",id:"bris_glace"},{name:"D\xe9g\xe2ts naturels",id:"degats_naturels"},{name:"Autre",id:"autre"}],defaultValue:"",condition:{dependsOn:"sinistre3_presence",value:"1",operator:"equals"},ia_params:{text:"Quelle \xe9tait la nature du troisi\xe8me sinistre ?",text_short:"Nature sinistre 3",type:"string",validation:"Type de sinistre",bloc:Dt.SINISTRE_3}},sinistre3_date:{category:"conducteur",label:"Date du 3\xe8me sinistre",type:"DATE",name:"sinistre3_date",defaultValue:"",condition:{dependsOn:"sinistre3_presence",value:"1",operator:"equals"},ia_params:{text:"Quelle \xe9tait la date du troisi\xe8me sinistre ?",text_short:"Date sinistre 3",type:"date",validation:"Date au format JJ/MM/AAAA",bloc:Dt.SINISTRE_3}},formule:{category:"formule",label:"Type de formule souhait\xe9",type:"BTN_LIST",name:"formule",datas:[{name:"Essentiel (Tiers)",id:"essentiel"},{name:"Confort (Tiers \xe9tendu)",id:"confort"},{name:"S\xe9r\xe9nit\xe9 (Tous risques modulable)",id:"serenite"}],defaultValue:"",ia_params:{text:"Quelle formule d'assurance souhaitez-vous ? S\xe9r\xe9nit\xe9 pour une couverture compl\xe8te, Confort pour une protection \xe9tendue, ou Essentiel pour les garanties de base ?",text_short:"Formule d'assurance",type:"string",validation:"Renvoyer l'identifiant de la formule choisie",bloc:Dt.FORMULE}},contrat_avec_franchise:{category:"formule",label:"Souhaitez-vous un contrat avec ou sans franchise ?",type:"BTN_LIST",name:"contrat_avec_franchise",datas:[{name:"Avec franchise",id:"1"},{name:"Sans franchise",id:"2"}],defaultValue:"",condition:{dependsOn:"formule",value:["confort","serenite"],operator:"in"},ia_params:{text:"Souhaitez-vous un contrat avec ou sans franchise ?",text_short:"Franchise",type:"string",validation:"Si l'utilisateur veut une franchise (ou r\xe9pond 'avec', 'oui', etc.) \u2192 enregistrer '1'. Si l'utilisateur ne veut PAS de franchise (ou r\xe9pond 'sans', 'non', etc.) \u2192 enregistrer '2'.",bloc:Dt.FRANCHISE,hint:"La franchise est une somme qui reste \xe0 votre charge en cas de sinistre. Avec franchise, votre cotisation est moins \xe9lev\xe9e mais vous payez une part en cas d'accident. Sans franchise, votre cotisation est plus \xe9lev\xe9e mais vous n'avez rien \xe0 payer en cas de sinistre."}},garantie_du_conducteur_active:{category:"garanties",label:"Garantie du conducteur",type:"BTN_LIST",isBooleanBtnList:!0,name:"garantie_du_conducteur_active",info:"Couvre vos blessures en cas d'accident, m\xeame responsable, ou d'agression lors d'un vol.",datas:[{name:"Oui",id:"1"},{name:"Non",id:"2"}],defaultValue:"",condition:{dependsOn:"formule",value:["essentiel","confort","serenite"],operator:"in"},ia_params:{text:"Souhaitez-vous activer la garantie du conducteur ? Elle couvre vos blessures en cas d'accident, m\xeame responsable, ou d'agression lors d'un vol.",text_short:"Garantie du conducteur",type:"string",validation:"R\xe9pondre par oui ou non",bloc:Dt.GARANTIE_CONDUCTEUR}},garantie_accessoires_amenagements_active:{category:"garanties",label:"Accessoires et am\xe9nagements",type:"BTN_LIST",isBooleanBtnList:!0,name:"garantie_accessoires_amenagements_active",info:"Rembourse les accessoires ou am\xe9nagements endommag\xe9s apr\xe8s un sinistre garanti.",datas:[{name:"Oui",id:"1"},{name:"Non",id:"2"}],defaultValue:"",condition:{dependsOn:"formule",value:"confort",operator:"equals"},ia_params:{text:"Souhaitez-vous activer la garantie accessoires et am\xe9nagements ? Elle rembourse les accessoires ou am\xe9nagements endommag\xe9s apr\xe8s un sinistre garanti.",text_short:"Accessoires et am\xe9nagements",type:"string",validation:"R\xe9pondre par oui ou non",bloc:Dt.GARANTIE_ACCESSOIRES}},garantie_assistance_active:{category:"garanties",label:"Assistance",type:"BTN_LIST",isBooleanBtnList:!0,name:"garantie_assistance_active",info:"Prend en charge le remorquage, le retour \xe0 domicile et le rapatriement en cas de panne ou d'accident.",datas:[{name:"Oui",id:"1"},{name:"Non",id:"2"}],defaultValue:"",condition:{dependsOn:"formule",value:"essentiel",operator:"equals"},ia_params:{text:"Souhaitez-vous activer la garantie assistance ? Elle prend en charge le remorquage, le retour \xe0 domicile et le rapatriement en cas de panne ou d'accident.",text_short:"Assistance",type:"string",validation:"R\xe9pondre par oui ou non",bloc:Dt.GARANTIE_ASSISTANCE}},garantie_protection_juridique_active:{category:"garanties",label:"Protection juridique",type:"BTN_LIST",isBooleanBtnList:!0,name:"garantie_protection_juridique_active",info:"Vous d\xe9fend et vous conseille en cas de litige ou d'infraction li\xe9e \xe0 votre v\xe9hicule.",datas:[{name:"Oui",id:"1"},{name:"Non",id:"2"}],defaultValue:"",condition:{dependsOn:"formule",value:["essentiel","confort","serenite"],operator:"in"},ia_params:{text:"Souhaitez-vous activer la garantie protection juridique ? Elle vous d\xe9fend et vous conseille en cas de litige ou d'infraction li\xe9e \xe0 votre v\xe9hicule.",text_short:"Protection juridique",type:"string",validation:"R\xe9pondre par oui ou non",bloc:Dt.GARANTIE_PROTECTION_JURIDIQUE}},garantie_vehicule_remplacement_active:{category:"garanties",label:"V\xe9hicule de remplacement",type:"BTN_LIST",isBooleanBtnList:!0,name:"garantie_vehicule_remplacement_active",info:"Fournit une voiture de pr\xeat en cas d'immobilisation apr\xe8s un sinistre.",datas:[{name:"Oui",id:"1"},{name:"Non",id:"2"}],defaultValue:"",condition:{dependsOn:"formule",value:["confort","serenite"],operator:"in"},ia_params:{text:"Souhaitez-vous activer la garantie v\xe9hicule de remplacement ? Elle fournit une voiture de pr\xeat en cas d'immobilisation apr\xe8s un sinistre.",text_short:"V\xe9hicule de remplacement",type:"string",validation:"R\xe9pondre par oui ou non",bloc:Dt.GARANTIE_VEHICULE_REMPLACEMENT}},garantie_indemnisation_valeur_majoree_active:{category:"garanties",label:"Indemnisation valeur major\xe9e",type:"BTN_LIST",isBooleanBtnList:!0,name:"garantie_indemnisation_valeur_majoree_active",info:"Verse une indemnit\xe9 30% sup\xe9rieure \xe0 la valeur estim\xe9e du v\xe9hicule en cas de perte totale.",datas:[{name:"Oui",id:"1"},{name:"Non",id:"2"}],defaultValue:"",condition:{dependsOn:"formule",value:["confort","serenite"],operator:"in"},ia_params:{text:"Souhaitez-vous activer la garantie indemnisation valeur major\xe9e ? Elle verse une indemnit\xe9 30% sup\xe9rieure \xe0 la valeur estim\xe9e du v\xe9hicule en cas de perte totale.",text_short:"Indemnisation valeur major\xe9e",type:"string",validation:"R\xe9pondre par oui ou non",bloc:Dt.GARANTIE_INDEMNISATION_MAJOREE}},garantie_remboursement_credit_active:{category:"garanties",label:"Remboursement du cr\xe9dit",type:"BTN_LIST",isBooleanBtnList:!0,name:"garantie_remboursement_credit_active",info:"R\xe8gle le solde du pr\xeat auto si l'indemnisation est inf\xe9rieure au capital restant d\xfb.",datas:[{name:"Oui",id:"1"},{name:"Non",id:"2"}],defaultValue:"",condition:[{dependsOn:"formule",value:"serenite",operator:"equals"},{dependsOn:"financement_vehicule",value:"comptant",operator:"not_equals"},{dependsOn:"financement_vehicule",value:"lld",operator:"not_equals"}],ia_params:{text:"Souhaitez-vous activer la garantie remboursement du cr\xe9dit ? Elle r\xe8gle le solde du pr\xeat auto si l'indemnisation est inf\xe9rieure au capital restant d\xfb.",text_short:"Remboursement du cr\xe9dit",type:"string",validation:"R\xe9pondre par oui ou non",bloc:Dt.GARANTIE_REMBOURSEMENT_CREDIT}},garantie_pack_valeur_neuf_active:{category:"garanties",label:"Pack valeur \xe0 neuf",type:"BTN_LIST",isBooleanBtnList:!0,name:"garantie_pack_valeur_neuf_active",info:"Rembourse le v\xe9hicule \xe0 sa valeur neuve pendant 2 ans, puis +30% de sa valeur d'expert.",datas:[{name:"Oui",id:"1"},{name:"Non",id:"2"}],defaultValue:"",condition:[{dependsOn:"formule",value:"serenite",operator:"equals"},{dependsOn:"date_premiere_circulation",value:24,operator:"within_months"}],ia_params:{text:"Souhaitez-vous activer la garantie pack valeur \xe0 neuf ? Elle rembourse le v\xe9hicule \xe0 sa valeur neuve pendant 2 ans, puis +30% de sa valeur d'expert.",text_short:"Pack valeur \xe0 neuf",type:"string",validation:"R\xe9pondre par oui ou non",bloc:Dt.GARANTIE_PACK_VALEUR_NEUF}}}),Qt=function(){var e=(0,p.Z)((0,f.KO)(Vt),2),t=e[0];e[1];return{questionsConfig:t}},Gt=n(230500),Wt=(n(890544),function(e){var t,n=e.extraction,r=zt[n.documentType]||n.documentType||"Document",a=(null===(t=n.result)||void 0===t?void 0:t.extracted_data)||{},o=Object.entries(a).filter((function(e){var t=(0,p.Z)(e,2)[1];return null!==t&&void 0!==t&&""!==t})),s=o.length;return(0,i.jsxs)("div",{className:"d-flex align-items-start",style:{gap:"10px"},children:[(0,i.jsx)("div",{className:"flex-shrink-0",children:(0,i.jsx)("i",{className:"fas fa-check-circle",style:{fontSize:"1.2rem",color:"#28a745"}})}),(0,i.jsxs)("div",{className:"flex-grow-1",children:[(0,i.jsx)("div",{className:"font-weight-bold",style:{fontSize:"0.9rem",marginBottom:"4px"},children:r}),(0,i.jsx)("div",{style:{fontSize:"0.8rem",color:"#6c757d"},children:0===s?"Aucune information exploitable":"".concat(s," information").concat(s>1?"s":""," extraite").concat(s>1?"s":"")})]})]})}),Ht=function(e,t){A.Am.success((0,i.jsx)(Wt,{extraction:e}),{autoClose:5e3,position:"bottom-right",className:"custom-ocr-toast",bodyClassName:"custom-ocr-toast-body"})},Kt=function(e){var t=e.extraction,n=zt[t.documentType]||t.documentType||"Document",r=t.error||"Une erreur est survenue";return(0,i.jsxs)("div",{className:"d-flex align-items-start",style:{gap:"10px"},children:[(0,i.jsx)("div",{className:"flex-shrink-0",children:(0,i.jsx)("i",{className:"fas fa-exclamation-circle",style:{fontSize:"1.2rem",color:"#dc3545"}})}),(0,i.jsxs)("div",{className:"flex-grow-1",children:[(0,i.jsx)("div",{className:"font-weight-bold",style:{fontSize:"0.9rem",marginBottom:"4px"},children:n}),(0,i.jsx)("div",{style:{fontSize:"0.8rem",color:"#6c757d"},children:r.length>60?r.substring(0,60)+"...":r})]})]})},Jt=function(e){A.Am.error((0,i.jsx)(Kt,{extraction:e}),{autoClose:5e3,position:"bottom-right",className:"custom-ocr-toast",bodyClassName:"custom-ocr-toast-body"})},Yt=function(){var e=J(),t=rt().actions||{},n=(t.onShowStepsAfterVocal,t.goToQuestion,(0,f.Dv)(Vt)),r=e.extractions,i=e.removeExtraction,o=(0,a.useRef)(new Set);return(0,a.useEffect)((function(){Object.values(r).forEach((function(e){"completed"!==e.status&&"error"!==e.status||o.current.has(e.id)||(o.current.add(e.id),"completed"===e.status?Ht(e,n):"error"===e.status&&Jt(e),setTimeout((function(){i(e.id)}),5e3))}))}),[r,n,i]),null},Xt=function(e){var t=e.isOpen,n=e.children;return(0,i.jsx)("div",{style:{position:"fixed",bottom:0,left:0,width:"100%",zIndex:99999},children:t?n:null})},$t=function(e){var t=e.size,n=void 0===t?60:t,r=e.color,o=void 0===r?"#ffffff"
1:r,s=e.dotCount,l=void 0===s?6:s,c=e.duration,u=void 0===c?1200:c,d=e.radiusFactor,m=void 0===d?.35:d,p=e.persistenceDuration,f=void 0===p?400:p,h=e.orbitDuration,v=void 0===h?8e3:h,g=(0,a.useRef)(null),x=(0,a.useRef)(0),_=(0,a.useRef)(0);(0,a.useEffect)((function(){var e=g.current;if(e){var t=Array.from(e.querySelectorAll("[data-orbit-dot]"));if(t.length){var r=(n||60)*m,i=function(e){_.current||(_.current=e);var n=e-_.current,a=u/l,o=n%(u+(l-1)*a+f),s=n%v/v*Math.PI*2;t.forEach((function(e,t){var n=o-t*a,i=n/u;if(i<0){var l=s,c=Math.cos(l)*r,d=Math.sin(l)*r;return e.style.transform="translate(".concat(c,"px, ").concat(d,"px)"),e.style.opacity="1",void(e.style.scale="1")}if(i>1){if((n-u)/f>1){var m=s,p=Math.cos(m)*r,h=Math.sin(m)*r;return e.style.transform="translate(".concat(p,"px, ").concat(h,"px)"),e.style.opacity="1",void(e.style.scale="1")}var v=s+2*Math.PI,g=Math.cos(v)*r,x=Math.sin(v)*r;return e.style.transform="translate(".concat(g,"px, ").concat(x,"px)"),e.style.opacity="1",void(e.style.scale="1")}var _,b=(_=i>=.98?1:i)<.5?4*_*_*_:1-Math.pow(-2*_+2,3)/2,y=s+b*Math.PI*2,E=Math.cos(y)*r,S=Math.sin(y)*r;e.style.transform="translate(".concat(E,"px, ").concat(S,"px)"),e.style.opacity="1",e.style.scale="1"})),x.current=requestAnimationFrame(i)};return x.current=requestAnimationFrame(i),function(){x.current&&cancelAnimationFrame(x.current),_.current=0}}}}),[n,l,u,m,f,v]);for(var b=[],y=0;y<l;y++)b.push((0,i.jsx)("div",{"data-orbit-dot":!0},y));var E=.14*n;return(0,i.jsx)("div",{ref:g,style:{position:"relative",width:n,height:n,transform:"translateZ(0)"},children:b.map((function(e,t){return(0,i.jsx)("div",{"data-orbit-dot":!0,style:{position:"absolute",top:"50%",left:"50%",width:E,height:E,marginLeft:-E/2,marginTop:-E/2,borderRadius:"50%",backgroundColor:o,transform:"translate(0, 0)",opacity:0}},t)}))})};function en(e){var t=e.audioStream,n=e.microphoneStream,r=e.isActive,o=void 0!==r&&r,s=e.assistantState,l=void 0===s?"idle":s,c=e.size,u=void 0===c?400:c,d=(0,a.useRef)(null),m=(0,a.useRef)(null),f=(0,a.useRef)(null),h=(0,a.useRef)(null),v=(0,a.useRef)(null),g=(0,a.useRef)(null),_=(0,a.useRef)(null),b=(0,a.useRef)(!1),y=(0,a.useRef)([]),E=(0,a.useRef)([]),S=(0,a.useRef)([]),I=(0,a.useRef)([]),N=(0,a.useRef)([]),C=(0,a.useRef)([]),w=((0,a.useRef)([]),(0,a.useRef)(0)),T=((0,a.useRef)([]),(0,a.useRef)(0)),j=((0,a.useRef)(.008),(0,a.useRef)(1)),R=(0,a.useRef)([{r:255,g:0,b:255},{r:224,g:64,b:251},{r:139,g:92,b:246},{r:168,g:85,b:247},{r:255,g:0,b:200}]),A=(0,a.useRef)({r:224,g:64,b:251}),k="processing"===l||"connecting"===l||"idle"===l,O=(0,a.useRef)(null),P=(0,a.useRef)(null),D=(0,a.useRef)(null),L=(0,a.useRef)(!1),M=(0,a.useRef)(0),U=(0,a.useRef)(!1);return(0,a.useEffect)((function(){if(!L.current){var e=function(e){return new Promise((function(t,n){var r=new Image;r.onload=function(){return t(r)},r.onerror=n,r.src=e}))};Promise.all([e("/images/icons/vis_speak.png"),e("/images/icons/vis_mic.png"),e("/images/icons/vis_load.png")]).then((function(e){var t=(0,p.Z)(e,3),n=t[0],r=t[1],i=t[2];O.current=n,P.current=r,D.current=i,L.current=!0})).catch((function(e){console.error("Erreur lors du chargement des ic\xf4nes:",e)}))}}),[]),(0,a.useEffect)((function(){if(t&&o){try{var e=new(window.AudioContext||window.webkitAudioContext);f.current=e;var n=e.createAnalyser();n.fftSize=64,n.smoothingTimeConstant=.3,h.current=n;var r=n.frequencyBinCount,i=new Uint8Array(r);v.current=i,e.createMediaStreamSource(t).connect(n),console.log("\ud83c\udfb5 AudioVisualizer: Assistant audio initialized")}catch(a){console.error("\u274c AudioVisualizer: Failed to initialize assistant audio:",a)}return function(){f.current&&(f.current.close(),f.current=null)}}}),[t,o]),(0,a.useEffect)((function(){if(n&&o)try{var e=f.current||new(window.AudioContext||window.webkitAudioContext);f.current||(f.current=e);var t=e.createAnalyser();t.fftSize=64,t.smoothingTimeConstant=.3,g.current=t;var r=t.frequencyBinCount,i=new Uint8Array(r);_.current=i,e.createMediaStreamSource(n).connect(t),console.log("\ud83c\udfa4 AudioVisualizer: Microphone audio initialized")}catch(a){console.error("\u274c AudioVisualizer: Failed to initialize microphone audio:",a)}}),[n,o]),(0,a.useEffect)((function(){var e=d.current;if(e){var t=window.devicePixelRatio||1;e.width=u*t,e.height=u*t,e.style.width="".concat(u,"px"),e.style.height="".concat(u,"px");var n=e.getContext("2d");n.scale(t,t);var r=u/2,i=u/2,a=70,s=0,l=function(){var e=T.current;n.clearRect(0,0,u,u);var t=null,c=!1,d=!1;if(h.current&&v.current&&o){h.current.getByteFrequencyData(v.current);var p=(t=v.current).reduce((function(e,t){return e+t}),0)/t.length,f=p>5,D=Date.now();if(f)M.current=D,U.current=!0;else{var q=D-M.current;U.current=q<1e3}c=U.current}if(g.current&&_.current&&o){g.current.getByteFrequencyData(_.current);var z=_.current,Z=z.reduce((function(e,t){return e+t}),0)/z.length;(d=Z>30)&&!c&&(t=z)}var F,B=c||d;b.current=B,F=k?{r:64,g:251,b:150}:c?{r:224,g:64,b:251}:{r:64,g:150,b:251};var V=.02;A.current.r+=(F.r-A.current.r)*V,A.current.g+=(F.g-A.current.g)*V,A.current.b+=(F.b-A.current.b)*V;var Q=Math.floor(A.current.r),G=Math.floor(A.current.g),W=Math.floor(A.current.b),H="rgb(".concat(Q,", ").concat(G,", ").concat(W,")"),K=("rgb(".concat(Math.floor(.8*Q),", ").concat(Math.floor(.8*G),", ").concat(Math.floor(1.2*W),")"),12
10),J=2*Math.PI/K;if(n.beginPath(),y.current.length!==K&&(y.current=new Array(K).fill(0),E.current=new Array(K).fill(0),S.current=new Array(K).fill(0),N.current=new Array(K).fill(0),I.current=new Array(K).fill(0),C.current=new Array(K).fill(0)),t&&B){for(var Y=Math.floor(.6*t.length),X=0,$=0;$<Y;$++)X+=t[$];var ee=X/Y/255;s=Math.pow(ee,.8)}else s=0;w.current+=.4*(s-w.current);for(var te=w.current,ne=[],re=0;re<K;re++){for(var ie,ae=re*J,oe=0,se=ae-Math.PI,le=0;le<5;le++){var ce=3+1.2*le,ue=1-.15*le,de=e*(1.2+.6*le)+1.7*le;oe+=Math.sin(se*ce-de)*ue}var me=oe/5*10*(B?te:0)*(c?1.6:1.5);if(k)me=10*(.5*Math.sin(e+.3*re)+.5)*.3;S.current[re]=me;var pe=.25*(me-y.current[re]);E.current[re]+=pe,E.current[re]*=.92,y.current[re]+=E.current[re],ie=y.current[re];var fe=a+ie,he=r+Math.cos(ae)*fe,ve=i+Math.sin(ae)*fe;ne.push({x:he,y:ve,distortion:ie,angle:ae})}var ge,xe=B?2:1;j.current+=.15*(xe-j.current),ge=k?{r:0,g:255,b:150}:c?{r:255,g:0,b:255}:{r:0,g:200,b:255};var _e=.05;R.current[0]||(R.current[0]=(0,x.Z)({},ge)),R.current[0].r+=(ge.r-R.current[0].r)*_e,R.current[0].g+=(ge.g-R.current[0].g)*_e,R.current[0].b+=(ge.b-R.current[0].b)*_e;var be=R.current[0],ye=Math.floor(be.r),Ee=Math.floor(be.g),Se=Math.floor(be.b),Ie=n.createRadialGradient(r,i,a,r,i,82.6);Ie.addColorStop(0,"rgba(".concat(ye,", ").concat(Ee,", ").concat(Se,", 0.8)")),Ie.addColorStop(.3,"rgba(".concat(ye,", ").concat(Ee,", ").concat(Se,", 0.4)")),Ie.addColorStop(.6,"rgba(".concat(ye,", ").concat(Ee,", ").concat(Se,", 0.15)")),Ie.addColorStop(1,"rgba(".concat(ye,", ").concat(Ee,", ").concat(Se,", 0)")),n.fillStyle=Ie,n.fillRect(0,0,u,u);var Ne=n.createRadialGradient(r,i,0,r,i,a),Ce=Math.floor(.08*ye),we=Math.floor(.08*Ee),Te=Math.floor(.08*Se),je=Math.floor(.12*ye),Re=Math.floor(.12*Ee),Ae=Math.floor(.12*Se),ke=Math.floor(.2*ye),Oe=Math.floor(.2*Ee),Pe=Math.floor(.2*Se);if(Ne.addColorStop(0,"rgba(".concat(Ce,", ").concat(we,", ").concat(Te,", 0.98)")),Ne.addColorStop(.5,"rgba(".concat(je,", ").concat(Re,", ").concat(Ae,", 0.95)")),Ne.addColorStop(.85,"rgba(".concat(ke,", ").concat(Oe,", ").concat(Pe,", 0.8)")),Ne.addColorStop(1,"rgba(".concat(ke,", ").concat(Oe,", ").concat(Pe,", 0)")),n.fillStyle=Ne,n.beginPath(),n.arc(r,i,a,0,2*Math.PI),n.fill(),n.save(),n.beginPath(),ne.length>0){n.moveTo(ne[0].x,ne[0].y);for(var De=1;De<ne.length;De++)n.lineTo(ne[De].x,ne[De].y)}n.closePath(),n.clip();var Le=a*j.current*.6,Me=n.createRadialGradient(r,i,0,r,i,Le);Me.addColorStop(0,"rgba(".concat(ye,", ").concat(Ee,", ").concat(Se,", 0.8)")),Me.addColorStop(.4,"rgba(".concat(ye,", ").concat(Ee,", ").concat(Se,", 0.5)")),Me.addColorStop(.7,"rgba(".concat(ye,", ").concat(Ee,", ").concat(Se,", 0.2)")),Me.addColorStop(1,"rgba(".concat(ye,", ").concat(Ee,", ").concat(Se,", 0)")),n.fillStyle=Me,n.fill();var Ue=n.createRadialGradient(r,i-21,0,r,i-21,35);Ue.addColorStop(0,"rgba(255, 255, 255, 0.4)"),Ue.addColorStop(.5,"rgba(255, 255, 255, 0.15)"),Ue.addColorStop(1,"rgba(255, 255, 255, 0)"),n.fillStyle=Ue,n.fill();var qe=n.createRadialGradient(r,i+28,0,r,i+28,28);qe.addColorStop(0,"rgba(0, 0, 0, 0.3)"),qe.addColorStop(.6,"rgba(0, 0, 0, 0.1)"),qe.addColorStop(1,"rgba(0, 0, 0, 0)"),n.fillStyle=qe,n.fill();n.strokeStyle=H,n.lineWidth=.6,n.globalAlpha=.12,n.beginPath();for(var ze=0;ze<24;ze++){var Ze=ze/24*Math.PI*2,Fe=ne[Math.floor(ze/24*ne.length)];n.moveTo(r+17.5*Math.cos(Ze),i+17.5*Math.sin(Ze)),n.lineTo(Fe.x,Fe.y)}n.stroke(),n.restore(),n.globalAlpha=1,n.beginPath();for(var Be=0;Be<ne.length;Be++){var Ve=ne[Be],Qe=Ve.angle,Ge=r+Math.cos(Qe)*(a+Ve.distortion),We=i+Math.sin(Qe)*(a+Ve.distortion);0===Be?n.moveTo(Ge,We):n.lineTo(Ge,We)}n.closePath(),n.strokeStyle="white",n.lineWidth=1.5,n.shadowBlur=20,n.shadowColor="rgba(".concat(ye,", ").concat(Ee,", ").concat(Se,", 0.8)"),n.stroke(),n.shadowBlur=40,n.shadowColor="rgba(".concat(ye,", ").concat(Ee,", ").concat(Se,", 0.4)"),n.stroke(),n.beginPath();for(var He=0;He<K;He++){for(var Ke=He*J,Je=0,Ye=Ke,Xe=0;Xe<5;Xe++){var $e=3+1.2*Xe,et=1-.15*Xe,tt=e*(1.2+.6*Xe)+1.7*Xe;Je+=Math.sin(Ye*$e-tt)*et}var nt=Je/5*10*(B?te:0)*(c?1.6:1.5);C.current[He]=nt;var rt=.25*(nt-N.current[He]);I.current[He]+=rt,I.current[He]*=.92,N.current[He]+=I.current[He];var it=N.current[He],at=a+it,ot=r+Math.cos(Ke)*at,st=i+Math.sin(Ke)*at;0===He?n.moveTo(ot,st):n.lineTo(ot,st)}if(n.closePath(),n.globalAlpha=.5,n.strokeStyle="white",n.lineWidth=1.5,n.shadowBlur=20,n.shadowColor="rgba(".concat(ye,", ").concat(Ee,", ").concat(Se,", 0.6)"),n.stroke(),n.shadowBlur=40,n.shadowColor="rgba(".concat(ye,", ").concat(Ee,", ").concat(Se,", 0.3)"),n.stroke(),n.globalAlpha=1,n.shadowBlur=0,n.save(),n.beginPath(),ne.length>0){n.moveTo(ne[0].x,ne[0].y);for(var lt=1;lt<ne.length;lt++)n.lineTo(ne[lt].x,ne[lt].y)}n.closePath(),n.clip();var ct=n.createRadialGradient(r,i,0,r,i,49);if(ct.addColorStop(0,"rgba(".concat(Q,", ").concat(G,", ").concat(W,", 0.12)")),ct.addColorStop(.6,"rgba(".concat(Q,", ").concat(G,", ").concat(W,", 0.03)")),ct.addColorStop(1,"rgba(".concat(Q,", ").concat(G,", ").concat(W,", 0)")),n.fillStyle=ct,n.fill(),n.restore(
1),L.current){var ut=null;if(ut=c?O.current:k?null:P.current){var dt=119;n.save(),n.globalAlpha=1,n.drawImage(ut,r-59.5,i-59.5,dt,dt),n.restore()}}var mt=n.createRadialGradient(r,i,0,r,i,0);mt.addColorStop(0,"rgba(255, 255, 255, 0.8)"),mt.addColorStop(.9,"rgba(255, 255, 255, 0.75)"),mt.addColorStop(.97,"rgba(255, 255, 255, 0.2)"),mt.addColorStop(1,"rgba(255, 255, 255, 0)"),n.fillStyle=mt,n.globalAlpha=1,n.shadowBlur=0,n.beginPath(),n.arc(r,i,0,0,2*Math.PI),n.fill(),T.current+=.075,m.current=requestAnimationFrame(l)};return l(),function(){m.current&&cancelAnimationFrame(m.current)}}}),[l,o,u]),(0,i.jsxs)("div",{style:{position:"relative",width:"150px",height:"150px",overflow:"visible"},children:[(0,i.jsx)("canvas",{ref:d,width:u,height:u,style:{position:"absolute",top:"50%",left:"50%",transform:"translate(-50%, -50%)",display:"block"}}),k&&(0,i.jsx)("div",{style:{position:"absolute",top:"50%",left:"50%",transform:"translate(-50%, -50%)",pointerEvents:"none"},children:(0,i.jsx)($t,{color:"#ffffff",size:80})})]})}function tn(e){var t=e.questionnaireManager,n=e.isSessionActive,r=e.assistantState,o=void 0===r?"idle":r,s=e.stopSession,l=e.currentBlock,c=void 0===l?null:l,u=(e.previousBlock,e.audioStream),d=void 0===u?null:u,m=e.microphoneStream,h=void 0===m?null:m,v=e.answersCount,g=void 0===v?0:v,_=e.errorMessage,y=void 0===_?null:_,S=(0,f.Dv)(Vt),I=(0,f.Dv)(ge),N=(0,a.useState)({current:0,total:0,isComplete:!1}),C=N[0],w=N[1],T=(0,a.useState)([]),j=T[0],R=T[1],A=(0,a.useRef)(null),k=(0,a.useRef)({}),O=(0,a.useRef)(null),P=(0,a.useState)({}),D=P[0],L=P[1];(0,a.useEffect)((function(){if(t&&t.config){var e=new Map;t.config.questions.forEach((function(t){var n=t.bloc;n&&(e.has(n)||e.set(n,{blocId:n,questions:[],allQuestionsInBlock:[]}),e.get(n).questions.push(t),e.get(n).allQuestionsInBlock.push(t))}));var n=Array.from(e.values()).map((function(e){var n=c&&c.blocId===e.blocId;if(t.answers&&e.blocId){var r=new Set(e.questions.map((function(e){return e.id}))),i=Object.keys(t.answers).filter((function(t){var n,i=S[t];return i&&(null===(n=i.ia_params)||void 0===n?void 0:n.bloc)===e.blocId&&!r.has(t)})),a=i.map((function(e){var t,n,r,i=S[e];return{id:e,bloc:null===i||void 0===i||null===(t=i.ia_params)||void 0===t?void 0:t.bloc,options:null===i||void 0===i||null===(n=i.datas)||void 0===n?void 0:n.map((function(e){return{id:e.id,label:e.name,name:e.name}})),type:null===i||void 0===i||null===(r=i.ia_params)||void 0===r?void 0:r.type}}));e.allQuestionsInBlock=(0,E.Z)(a).concat((0,E.Z)(e.questions))}var o=e.questions.every((function(e){return t.answers&&t.answers[e.id]}));return(0,b.Z)((0,x.Z)({},e),{status:n?"current":o?"completed":"pending"})}));R(n);var r=n.length,i=n.filter((function(e){return"completed"===e.status})).length,a=n.some((function(e){return"current"===e.status}));if(I)w({current:r,total:r,isComplete:!0});else w({current:i+(a?.5:0),total:r,isComplete:r>0&&i>=r&&!a})}else R([])}),[t,c,g,I]);var M=function(){if(c&&c.blocId&&k.current[c.blocId]){var e=k.current[c.blocId];if(e&&A.current){var t=A.current,n=e.getBoundingClientRect(),r=t.getBoundingClientRect(),i=r.top+.6*r.height,a=n.top+n.height/2-i;t.scrollBy({top:a,behavior:"smooth"})}}};(0,a.useEffect)((function(){c&&c.blocId&&k.current[c.blocId]&&setTimeout((function(){M()}),100)}),[c]),(0,a.useEffect)((function(){I&&O.current&&A.current&&setTimeout((function(){O.current.scrollIntoView({behavior:"smooth",block:"center"})}),200)}),[I]),(0,a.useEffect)((function(){var e=function(){M()};return window.addEventListener("resize",e),function(){window.removeEventListener("resize",e)}}),[c]);var U=function(){if(A.current){var e=A.current.getBoundingClientRect(),t=e.bottom,n={};j.forEach((function(r){if("completed"===r.status){var i=k.current[r.blocId];if(i){var a=i.getBoundingClientRect().bottom,o=Math.abs(a-t),s=e.height,l=Math.min(o/s,1),c=1-.5*Math.pow(l,.43);c=Math.max(.5,Math.min(1,c));var u=400*Math.pow(l,2);n[r.blocId]={scale:c,translateY:u}}}})),L(n)}};(0,a.useEffect)((function(){var e=A.current;if(e){var t=e.scrollTop,n=function(n){var r=e.scrollTop;if(r>t&&c&&k.current[c.blocId]){var i=k.current[c.blocId],a=e.getBoundingClientRect(),o=i.getBoundingClientRect();if(o.top>=a.top&&o.bottom<=a.bottom)return n.preventDefault(),void(e.scrollTop=t)}t=r,U()};return e.addEventListener("scroll",n),U(),function(){e.removeEventListener("scroll",n)}}}),[j,c]);var q=function(e){if(!e||!e.questions||0===e.questions.length)return null;var n="completed"===e.status,r="current"===e.status,a="pending"===e.status,o=a?"#adb5bd":"#898CCE",s=Mt[e.blocId];if(!s)return null;var l=function(e){if(!e)return[];for(var t=[],n=!1,r="",i=0;i<e.length;i++){var a=e[i];"*"===a?(r&&(t.push({text:r,highlighted:n}),r=""),n=!n):r+=a}return r&&t.push({text:r,highlighted:n}),t}(s),c=n&&D[e.blocId]?D[e.blocId]:null;return(0,i.jsxs)("div",{ref:function(t){t&&(k.current[e.blocId]=t)},className:a?"question-pending":r?"question-current":n?"question-completed":"",style:(0,x.Z)({padding:"12px 0",textAlign:"center",display:"flex",flexDirection:"column",justifyContent:"flex-start",transformOrigin:"center top"},null!==c&&{transform:"scale(".concat(c.scale,") translateY(").concat(c.translateY,"px)"),transition:"transform 0.2s ease-out"}),children:[(0,i.jsx)("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",marginBottom:"12px"},children:(0,i.jsx)("div",{className:"assistant-ui-question",style:{color:o,opacity:a?.5:1},children:l.map((function(e,t){return(0,i.jsx)("span",{style:{fontWeight:e.highlighted?"800":"inherit",color:e.highlighted?"#0E15A3":"inherit"},children:e.text},t)}))})}),(n||r)&&(0,i.jsx)("div",{style:{display:"flex",flexWrap:"wrap",gap:"8px",justifyContent:"center",minHeight:90},children:(e.allQuestionsInBlock||e.questions).filter((function(e){return!e.condition||Ee(e.condition,(null===t||void 0===t?void 0:t.answers
1)||{})})).map((function(e){var n,r,a,o=null===t||void 0===t||null===(n=t.answers)||void 0===n?void 0:n[e.id];if(!o||"__SKIPPED__"===o)return null;var s=o;if(e.options&&Array.isArray(e.options)){var l=e.options.find((function(e){return e.id===o}));l&&(s=l.label||l.name||o)}if("date"===e.type&&"string"===typeof s&&/^\d{4}-\d{2}-\d{2}$/.test(s)){var c=(0,p.Z)(s.split("-"),3),u=c[0],d=c[1],m=c[2];s="".concat(m,"/").concat(d,"/").concat(u)}var f=S[e.id],h=null===f||void 0===f||null===(r=f.ia_params)||void 0===r?void 0:r.prefix,v=null===f||void 0===f||null===(a=f.ia_params)||void 0===a?void 0:a.suffix;return h&&(s="".concat(h," ").concat(s)),v&&(s="".concat(s," ").concat(v)),(0,i.jsxs)("span",{style:{display:"inline-flex",alignItems:"center",gap:"6px",padding:"6px 12px",backgroundColor:"#59ad56",color:"white",borderRadius:"12px",fontSize:"18px",fontWeight:"700",whiteSpace:"nowrap",maxHeight:40},children:[(0,i.jsx)("i",{className:"fa fa-check",style:{fontSize:"14px"}}),s]},e.id)}))})]})};return(0,i.jsx)("div",{className:"assistant-widget animated fadeInDown fast",style:{position:"fixed",top:"0",left:"0",right:"0",bottom:"0",width:"100vw",height:"100dvh",backgroundColor:"rgba(248, 249, 250, 0.98)",zIndex:999,display:"flex",alignItems:"center",justifyContent:"center",overflow:"hidden"},children:(0,i.jsxs)("div",{style:{width:"100%",height:"100%",backgroundColor:"white",padding:"36px 16px 20px 16px",borderRadius:"8px",maxHeight:"100dvh",overflow:"hidden",display:"flex",alignItems:"center",flexDirection:"column",position:"relative"},children:[(0,i.jsx)("div",{style:{position:"absolute",top:"16px",right:"16px",width:"46px",height:"46px",borderRadius:"50%",background:"white",border:"2px solid #A7A0A0",display:"flex",alignItems:"center",justifyContent:"center",cursor:"pointer",transition:"all 0.2s ease",zIndex:10},onClick:s,children:(0,i.jsx)("i",{className:"fas fa-times",style:{color:"#A7A0A0",fontSize:"26px"}})}),(0,i.jsx)("div",{ref:A,className:"scroll-container",style:{position:"relative",flex:1,overflowY:"auto",overflowX:"hidden",padding:"0 16px",maxWidth:500,margin:"0 auto",width:"100%"},children:y?(0,i.jsxs)("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",height:"100%",padding:"40px 20px",textAlign:"center"},children:[(0,i.jsx)("i",{className:y.includes("microphone")?"fas fa-microphone-slash":"fas fa-exclamation-triangle",style:{fontSize:"64px",color:y.includes("microphone")?"#ffc107":"#dc3545",marginBottom:"24px"}}),(0,i.jsx)("div",{style:{fontSize:"20px",fontWeight:"600",color:"#343a40",marginBottom:"12px"},children:y.includes("microphone")?"Acc\xe8s au microphone requis":"Erreur de connexion"}),(0,i.jsx)("div",{style:{fontSize:"16px",color:"#6c757d",marginBottom:"32px",maxWidth:"400px"},children:y}),(0,i.jsx)("button",{onClick:s,style:{padding:"12px 32px",backgroundColor:"#898CCE",color:"white",border:"none",borderRadius:"8px",fontSize:"16px",fontWeight:"600",cursor:"pointer",transition:"background-color 0.2s"},onMouseEnter:function(e){return e.target.style.backgroundColor="#7a7db8"},onMouseLeave:function(e){return e.target.style.backgroundColor="#898CCE"},children:"Fermer"})]}):j.length>0?(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)("div",{style:{height:"calc(100% - 150px)"}}),j.filter((function(e){var n=e.allQuestionsInBlock||e.questions;return!(!n||0===n.length)&&n.some((function(e){return!e.condition||Ee(e.condition,(null===t||void 0===t?void 0:t.answers)||{})}))})).map((function(e){return(0,i.jsx)("div",{children:q(e)},e.blocId)})),I&&(0,i.jsx)("div",{ref:O,style:{padding:"16px 0",animation:"fadeInUp 0.5s ease-out"},children:(0,i.jsx)(It,{estimation:I,compact:!0})})]}):(0,i.jsx)("div",{style:{textAlign:"center",color:"#6c757d",fontSize:"12px",padding:"20px"},children:n?"En attente de la premi\xe8re question...":"Chargement de l'assistant..."})}),!y&&(0,i.jsx)("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",paddingTop:"20px",paddingBottom:"10px",flexShrink:0},children:(0,i.jsx)(en,{audioStream:d,microphoneStream:h,isActive:n,assistantState:o,size:200})}),!y&&(0,i.jsx)("div",{style:{width:"100%",maxWidth:"400px",display:"flex",justifyContent:"center",alignItems:"center",paddingTop:"20px",flexShrink:0},children:(0,i.jsx)("div",{style:{position:"relative",width:300,height:"4px",backgroundColor:"#e9ecef",borderRadius:"2px",overflow:"hidden"},children:(0,i.jsx)("div",{style:{position:"absolute",top:0,left:"".concat(C.total>0?50-C.current/C.total*50:50,"%"),right:"".concat(C.total>0?50-C.current/C.total*50:50,"%"),height:"100%",backgroundColor:"#898CCE",transition:"left 0.3s ease, right 0.3s ease"}})})})]})})}var nn=n(51438),rn=n(352951);function an(e){return e&&"string"===typeof e?e.toLowerCase().normalize("NFD").replace(/[\u0300-\u036f]/g,"").replace(/[^a-z0-9]+/g,"").trim():""}var on=function(){function e(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[];(0,nn.Z)(this,e),this.config=t&&t.questions&&t.questions.length?t:{questions:[]},this.currentIndex=0,this.answers=(0,x.Z)({},n),this.currentBlockIndex=0,this.processedBlocks=new Set,this.askedQuestions=new Set,r&&"object"===typeof r&&!Array.isArray(r)?this.allQuestions=Object.entries(r).map((function(e){var t=(0,p.Z)(e,2),n=t[0],r=t[1];return(0,x.Z)({id:n},r)})):Array.isArray(r)&&r.length>0?this.allQuestions=r:(this.allQuestions=this.config.questions,console.warn("\u26a0\ufe0f Fallback to config.questions:",this.allQuestions.length,"questions"))}return(0,rn.Z)(e,[{key:"getProgress",value:function(){return{current:this.currentIndex+1,total:this.config.questions.length,percentage:Math.round(this.currentIndex/this.config.questions.length*100),answers:this.answers,isComplete:this.currentIndex>=this.config.questions.length}}},{key:"isComplete",value:function(){return this.currentIndex>=this.config.questions.length}},{key:"peekCurrentQuestion",value:function(){for(var e=this.currentIndex;e<this.config.questions.length;){var t=this.config.questions[e];if(!t.condition)return t;if(Ee(t.condition,this.answers))return t;e++}return null}},{key:"skipToNextValidQuestion",value:function(){for(;this.currentIndex<this.config.questions.length;){var e=this.config.questions[this.currentIndex];if(!e.condition||Ee(e.condition,this.answers))break;this.currentIndex++}}},{key:"recalculateCurrentIndex",value:function(){for(var e=0;e<this.config.questions.length;e++){var t=this.config.questions[e];if(!this.answers.hasOwnProperty(t.id)&&(!t.condition||Ee(t.condition,this.answers)))return void(this.currentIndex=e)}this.currentIndex=this.config.questions.length}},{key:"reset",value:function(){this.currentIndex=0,this.currentBlockIndex=0,this.answers={},this.askedQuestions.clear(),this.processedBlocks.clear()}},{key:"validateAnswer",value:function(e,t){var n,r,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(!e)return{isValid:!1,error:"Question non trouv\xe9e"};if(null===t||void 0===t||""===t)return{isValid:!0,isEmpty:!0};switch(e.type){case"string":if(e.options&&e.options.length>0){var a=e.options.map((function(e){return e.id}));if(a.includes(t))return{isValid:!0};var o=an(t),s=e.options.find((function(e){var t=an(e.id),n=an(e.name);return t===o||n===o}));return s?{isValid:!0,normalizedValue:s.id}:{isValid:!1,error:"R\xe9ponse invalide. Options valides: ".concat(a.join(", "))}}if("string"===typeof t&&t.trim().length<2)return{isValid:!1,error:"R\xe9ponse trop courte"};break;case"number":var l=parseFloat(t);if(isNaN(l))return{isValid:!1,error:"R\xe9ponse doit \xeatre un nombre"};break;case"date":var c=g.ou.fromFormat(t,"dd/MM/yyyy");if(!c.isValid)return{isValid:!1,error:"Format de date invalide"}}var u,d=(null===(n=e.ia_params)||void 0===n?void 0:n.normalizeAnswer)||e.normalizeAnswer;if(d){var m=d(t);null!==m&&void 0!==m&&(u=m)}var p=(null===(r=e.ia_params)||void 0===r?void 0:r.validate)||e.validate;if(p){var f=p(void 0!==u?u:t,i,this.answers);if(f)return{isValid:!1,error:f}}return void 0!==u?{isValid:!0,normalizedValue:u}:{isValid:!0}}},{key:"getPendingRequiredQuestions",value:function(){var e=this;return this.allQuestions.filter((function(t){var n;if(!t.bloc&&!(null===(n=t.ia_params)||void 0===n?void 0:n.bloc))return!1;
1if(!(!t.condition||Ee(t.condition,e.answers)))return!1;var r=e.answers[t.id];return!(void 0!==r&&null!==r&&""!==r&&"__SKIPPED__"!==r)}))}},{key:"getEligibleQuestions",value:function(){var e=this;return this.config.questions.filter((function(t){var n=e.answers[t.id],r=!("__SKIPPED__"===n)&&(!e.answers.hasOwnProperty(t.id)||null===n||void 0===n||""===n),i=!e.askedQuestions.has(t.id),a=!t.condition||Ee(t.condition,e.answers);return r&&i&&a}))}},{key:"getAvailableBlocks",value:function(){var e=this.getEligibleQuestions(),t=new Map;e.forEach((function(e){var n=e.bloc;n&&(t.has(n)||t.set(n,[]),t.get(n).push(e))}));var n=Lt,r=[];return n.forEach((function(e){t.has(e)&&r.push({blocId:e,questions:t.get(e)})})),t.forEach((function(e,t){n.includes(t)||r.push({blocId:t,questions:e})})),r}},{key:"getFirstBlock",value:function(){var e,t=this,n=this.getAvailableBlocks();if(this.currentBlockIndex=0,this.processedBlocks.clear(),0===n.length)return null;var r=n[0];this.processedBlocks.add(r.blocId);var i=(null===(e=r.questions[0])||void 0===e?void 0:e.totalQuestionsInBlock)||r.questions.length;return r.questions.forEach((function(e){t.askedQuestions.add(e.id)})),{questions:r.questions,blockIndex:this.currentBlockIndex,blocId:r.blocId,totalQuestionsInBlock:i}}},{key:"getNextBlock",value:function(){var e,t=this,n=this.getAvailableBlocks().find((function(e){return!t.processedBlocks.has(e.blocId)}));if(!n)return null;this.currentBlockIndex++,this.processedBlocks.add(n.blocId);var r=(null===(e=n.questions[0])||void 0===e?void 0:e.totalQuestionsInBlock)||n.questions.length;return n.questions.forEach((function(e){t.askedQuestions.add(e.id)})),{questions:n.questions,blockIndex:this.currentBlockIndex,blocId:n.blocId,totalQuestionsInBlock:r}}},{key:"validateAndSaveAnswersBlock",value:function(e){var t={success:!1,validAnswers:{},errors:{},correctedPrevious:!1};if(!e||"object"!==typeof e)return t.errors.general="Format de r\xe9ponses invalide",t;var n=!0,r=!1,i=void 0;try{for(var a,o=this,s=function(){var n=(0,p.Z)(a.value,2),r=n[0],i=n[1],s=o.config.questions.find((function(e){return e.id===r}));if(s||(s=o.allQuestions.find((function(e){return e.id===r})))&&(t.correctedPrevious=!0),!s)return console.error("\u274c\u274c\u274c QUESTION NOT FOUND: ".concat(r)),console.error("Available in current block:",o.config.questions.map((function(e){return e.id}))),console.error("Available in allQuestions:",o.allQuestions.map((function(e){return e.id}))),console.error("allQuestions contains marque_vehicule?",o.allQuestions.some((function(e){return"marque_vehicule"===e.id}))),t.errors[r]="Question non trouv\xe9e","continue";var l=o.validateAnswer(s,i,e);if(l.isValid)if(l.isEmpty){var c,u,d,m=null!==(d=s.defaultWhenSkipped)&&void 0!==d?d:null===(c=s.ia_params)||void 0===c?void 0:c.defaultWhenSkipped,f=s.defaultWhenSkippedMessage||(null===(u=s.ia_params)||void 0===u?void 0:u.defaultWhenSkippedMessage)||null;if(void 0!==m&&null!==m){var h=z(m,s.type);o.answers[r]=h,t.validAnswers[r]=h,t.defaultsApplied||(t.defaultsApplied=[]),t.defaultsApplied.push({questionId:r,value:h,message:f})}else o.answers[r]="__SKIPPED__",t.validAnswers[r]=""}else{var v=l.normalizedValue||i,g=z(v,s.type);o.answers[r]=g,t.validAnswers[r]=g}else t.errors[r]=l.error},l=Object.entries(e)[Symbol.iterator]();!(n=(a=l.next()).done);n=!0)s()}catch(c){r=!0,i=c}finally{try{n||null==l.return||l.return()}finally{if(r)throw i}}return t.success=0===Object.keys(t.errors).length,t}}]),e}(),sn=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null;(0,nn.Z)(this,e),this.sessionId=this.generateSessionId(),this.leadId=t,this.isLogging=!0}return(0,rn.Z)(e,[{key:"generateSessionId",value:function(){var e=(new Date).toISOString().replace(/[:.]/g,"-"),t=Math.random().toString(36).substring(2,8);return"".concat(e,"-").concat(t)}},{key:"setLogging",value:function(e){this.isLogging=e}},{key:"logUserMessage",value:function(e){var t=this;return(0,C.Z)((function(){return(0,w.__generator)(this,(function(n){switch(n.label){case 0:return t.isLogging?[4,t.sendLog("user",e)]:[2];case 1:return n.sent(),[2]}}))}))()}},{key:"logAssistantMessage",value:function(e){var t=this;return(0,C.Z)((function(){return(0,w.__generator)(this,(function(n){switch(n.label){case 0:return t.isLogging?[4,t.sendLog("assistant",e)]:[2];case 1:return n.sent(),[2]}}))}))()}},{key:"logSystemEvent",value:function(e,t){var n=this;return(0,C.Z)((function(){return(0,w.__generator)(this,(function(r){switch(r.label){case 0:return n.isLogging?[4,n.sendLog("system","".concat(e,": ").concat(t))]:[2];case 1:return r.sent(),[2]}}))}))()}},{key:"logQuestionnaireAnswer",value:function(e,t){var n=this;return(0,C.Z)((function(){return(0,w.__generator)(this,(function(r){switch(r.label){case 0:return n.isLogging?[4,n.sendLog("questionnaire","".concat(e,": ").concat(t))]:[2];case 1:return r.sent(),[2]}}))}))()}},{key:"logSessionStart",value:function(){var e=this;return(0,C.Z)((function(){return(0,w.__generator)(this,(function(t){switch(t.label){case 0:return e.isLogging?[4,e.sendLog("session","Session started")]:[2];case 1:return t.sent(),[2]}}))}))()}},{key:"logSessionEnd",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=this;return(0,C.Z)((function(){return(0,w.__generator)(this,(function(n){switch(n.label){case 0:return t.isLogging?[4,t.sendLog("session","Session ended - Final answers: ".concat(JSON.stringify(e)))]:[2];case 1:return n.sent(),[2]}}))}))()}},{key:"sendLog",value:function(e,t){var n=this;return(0,C.Z)((function(){var r,i,a;return(0,w.__generator)(this,(function(o){switch(o.label){case 0:return o.trys.push([0,2,,3]),n.leadId?(r=(new Date).toISOString(),i="".concat(e,": ").concat(t),[4,Le("new-leads/".concat(n.leadId,"/ajouter-retranscription"),{date:r,text:i})]):(console.warn("Cannot send log: leadId is not set"),[2]);case 1:return o.sent(),[3,3];case 2:return a=o.sent(),console.error("Failed to log transcript:",a),[3,3];case 3:return[2]}}
1))}))()}},{key:"getSessionId",value:function(){return this.sessionId}},{key:"newSession",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null;this.sessionId=this.generateSessionId(),e&&(this.leadId=e),this.logSessionStart()}},{key:"setLeadId",value:function(e){this.leadId=e}}]),e}();function ln(e){return e.map((function(e){return"\nQUESTION: ".concat(e.text,"\nID: ").concat(e.id,"\nVALIDATION: ").concat(e.validation||"R\xe9ponse libre","\n").concat(e.options?e.options.length>10?"OPTIONS DISPONIBLES: ".concat(e.options.length," communes de l'\xeele de la R\xe9union.\nINSTRUCTION SP\xc9CIALE: NE PAS \xe9num\xe9rer toutes les communes. Demande simplement \xe0 l'utilisateur de pr\xe9ciser sa commune. Si la r\xe9ponse ne correspond \xe0 aucune commune valide, demande-lui de reformuler ou d'\xeatre plus pr\xe9cis.\nNOTE: Les communes seront valid\xe9es automatiquement par correspondance approximative (normalisation, accents, casse)."):"OPTIONS DISPONIBLES (cite UNIQUEMENT les labels \xe0 l'utilisateur, JAMAIS les IDs):\n".concat(e.options.map((function(e){return'  - Label: "'.concat(e.label||e.name,'" \u2192 ID \xe0 utiliser pour validation: "').concat(e.id,'"')})).join("\n")):"","\n").concat(e.hint?"HINT: ".concat(e.hint):"","\n")})).join("\n")}function cn(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,n=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null,i=ln(e.questions),a=r&&e.questions.length<r;console.log("\ud83d\udcca Block ".concat(e.blocId,": hasPartialAnswers=").concat(a,", totalQuestions=").concat(r,", remainingQuestions=").concat(e.questions.length),{hasPartialAnswers:a,totalQuestionsInBlock:r,remainingQuestions:e.questions.length,questionIds:e.questions.map((function(e){return e.id})),blocId:e.blocId});var o=t&&!a?'QUESTION CONDENS\xc9E \xc0 POSER: "'.concat(t,'"\n\n'):"",s="Commence par ta phrase d'ouverture officielle COMPL\xc8TE (la pr\xe9sentation de Merlin d\xe9finie dans tes instructions), M\xcaME si des r\xe9ponses existent d\xe9j\xe0 (reprise d'une demande en cours), puis ",l=t&&!a?"IMPORTANT: ".concat(n?"".concat(s,"pose"):"Pose",' EXACTEMENT la question condens\xe9e fournie ci-dessus : "').concat(t,'"'):a?"IMPORTANT: ".concat(n?"".concat(s,"construis"):"Construis"," une question condens\xe9e qui regroupe UNIQUEMENT les questions ci-dessus (certaines questions de ce bloc ont d\xe9j\xe0 \xe9t\xe9 r\xe9pondues). Pose cette question de fa\xe7on naturelle et concise."):n?"IMPORTANT: ".concat(s,"pose toutes ces questions ensemble en une seule fois, naturellement."):"Pose maintenant toutes ces questions ensemble en une seule fois, naturellement.",c=n?"":"SI ET SEULEMENT SI tu as explicitement annonc\xe9 une v\xe9rification que tu n'as pas encore effectu\xe9e (ex: une date rest\xe9e \xe0 confirmer apr\xe8s une interruption) : fais-la d'abord, puis encha\xeene sur ce bloc. SINON, encha\xeene DIRECTEMENT : ne re-confirme AUCUNE r\xe9ponse d\xe9j\xe0 comprise ou d\xe9j\xe0 enregistr\xe9e.\n\n",u=e.questions.map((function(e){return'"'.concat(e.id,'": "reponse_valide"')})).join(", "),d=n?"PREMIER BLOC":"BLOC SUIVANT";return"".concat(d,":\n\n").concat(o).concat(i,"\n\n").concat(c).concat(l,"\n\nRAPPEL : C'est la PREMI\xc8RE FOIS que tu poses ces questions, donc NE CITE PAS les options/formats/validations dans ta question.\n\nQuand tu recevras les r\xe9ponses, appelle validate_and_save_answers avec la structure: { ").concat(u," }")}function un(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;return cn(e,t,!0,n)}function dn(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;return cn(e,t,!1,n)}var mn=["marque_vehicule","modele_vehicule","puissance_fiscale","date_premiere_circulation","conducteur1_date_naissance","conducteur1_date_permis","conducteur1_bonus_malus","usage_vehicule","type_garage","formule"];function pn(e){return fn.apply(this,arguments)}function fn(){return(fn=(0,C.Z)((function(e){var t,n;return(0,w.__generator)(this,(function(r){switch(r.label){case 0:return r.trys.push([0,3,,4]),[4,fetch("".concat("https://perceval-ia-assurance-auto-production.osc-fr1.scalingo.io","/api/estimate-premium"),{method:"POST",headers:{"Content-Type":"application/json","X-API-Key":"XUuajpUhcMP8ZdFysWKV"},body:JSON.stringify({formData:e})})];case 1:return[4,r.sent().json()];case 2:return(t=r.sent()).success?[2,{success:!0,estimation:t.estimation}]:[2,{success:!1,error:t.error||"Erreur estimation"}];case 3:return n=r.sent(),console.error("\u274c Erreur appel estimation:",n),[2,{success:!1,error:"Impossible de contacter le serveur"}];case 4:return[2]}}
1))}))).apply(this,arguments)}var hn={echoCancellation:!0,noiseSuppression:!0,autoGainControl:!0,sampleRate:24e3,channelCount:1};function vn(e){window.hasActiveResponse?window.shouldCreateResponseAfterDone=!0:e({type:"response.create"})}function gn(e,t){var n,r=(null===t||void 0===t||null===(n=t.current)||void 0===n?void 0:n.allQuestions)||[];return(e||[]).map((function(e){var t,n=r.find((function(t){return t.id===e}));return{id:e,text:(null===n||void 0===n||null===(t=n.ia_params)||void 0===t?void 0:t.text)||(null===n||void 0===n?void 0:n.text)||e}}))}function xn(e){var t=e.questionConfig,n=e.reponseConfig,r=e.onUpdateFormState,o=e.onUpdateSessionState,s=e.onUpdateCurrentQuestion,l=e.onSubmitForm,c=function(){return function(e,t){var n=(0,x.Z)({},e,Object.fromEntries(Object.entries(t).filter((function(e){return"__SKIPPED__"!==(0,p.Z)(e,2)[1]})))),r=mn.filter((function(e){var t=n[e];return void 0===t||null===t||""===t}));return r.length>0&&console.log("\ud83d\udcca Estimation impossible, champs manquants:",r),{canEstimate:0===r.length,mergedState:n,missing:r}}(q,Z.current.answers)},u=function(){!function(e){console.log("\ud83d\udd07 VAD strict pour pr\xe9sentation estimation"),e({type:"session.update",session:{type:"realtime",audio:{input:{turn_detection:{type:"server_vad",threshold:.95,prefix_padding_ms:800,silence_duration_ms:1500,create_response:!0,interrupt_response:!0}}}}})}(g)},d=function(){!function(e){console.log("\ud83d\udd0a R\xe9activation VAD"),e({type:"session.update",session:{type:"realtime",audio:{input:{turn_detection:{type:"server_vad",threshold:.8,prefix_padding_ms:800,silence_duration_ms:800,create_response:!0,interrupt_response:!0}}}}})}(g)},m=function(){oe.current&&(console.log("\ud83c\udfa4\ud83d\udeab Microphone d\xe9sactiv\xe9"),oe.current.enabled=!1)},h=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"manual";F.current.logSessionEnd(Z.current.answers,e),v(),j&&j.close(),ie.current&&(ie.current.getSenders().forEach((function(e){e.track&&e.track.stop()})),ie.current.close()),y(!1),R(null),ie.current=null,W("idle"),O(null),o&&o(!1,e),s&&s(null)},v=function(){le.current&&(clearTimeout(le.current),le.current=null)},g=function(e){if(j&&"open"===j.readyState){var t=(new Date).toLocaleTimeString();e.event_id=e.event_id||crypto.randomUUID(),console.log("Sending message:",e),j.send(JSON.stringify(e)),e.t
1imestamp||(e.timestamp=t),N((function(t){return[e].concat((0,E.Z)(t))}))}else console.error("Failed to send message - data channel not available or not open",{hasDataChannel:!!j,readyState:null===j||void 0===j?void 0:j.readyState,message:e})},_=(0,a.useState)(!1),b=_[0],y=_[1],S=(0,a.useState)([]),I=S[0],N=S[1],T=(0,a.useState)(null),j=T[0],R=T[1],A=(0,a.useState)(null),k=A[0],O=A[1],P=(0,a.useState)(0),D=P[0],L=P[1],M=(0,f.Dv)(Vt),U=(0,f.Dv)(pe),q=(0,f.Dv)(re),z=(0,f.b9)(ge),Z=(0,a.useRef)(new on({questions:M},{},M)),F=(0,a.useRef)(new sn(U)),B=(0,a.useState)(!1),V=(B[0],B[1]),Q=(0,a.useState)("idle"),G=Q[0],W=Q[1],H=(0,a.useState)(null),K=H[0],J=H[1],Y=(0,a.useState)(null),X=Y[0],$=Y[1],ee=(0,a.useState)(null),te=ee[0],ne=ee[1],ie=(0,a.useRef)(null),ae=(0,a.useRef)(null),oe=(0,a.useRef)(null),se=(0,a.useRef)(null),le=(0,a.useRef)(null),ce=(0,a.useRef)(0),ue=(0,a.useRef)(null),de=(0,a.useRef)([]);function me(){return me=(0,C.Z)((function(){var e,r,i,a,o,s,l,c,u,d,m,p,f,h;return(0,w.__generator)(this,(function(v){switch(v.label){case 0:J(null),v.label=1;case 1:return v.trys.push([1,10,,11]),e=(0,x.Z)({},n),Object.keys(e).forEach((function(t){e[t]&&""!=e[t]||delete e[t]})),Z.current=new on(t,e,M),console.log("questionConfig",t),console.log("reponseConfigFiltered",e),[4,fetch("https://perceval-ia-assurance-auto-production.osc-fr1.scalingo.io/token",{method:"POST",headers:{"Content-Type":"application/json",Accept:"application/json","X-API-Key":"XUuajpUhcMP8ZdFysWKV"},body:JSON.stringify({config:t,reponseConfig:e})})];case 2:if(!(r=v.sent()).ok)throw new Error("Erreur lors de la r\xe9cup\xe9ration du token: ".concat(r.status));return[4,r.json()];case 3:if(i=v.sent(),!(a=i.value))throw new Error("Token d'authentification invalide");return o=new RTCPeerConnection,ae.current=document.createElement("audio"),ae.current.autoplay=!0,o.ontrack=function(e){ae.current.srcObject=e.streams[0],O(e.streams[0])},[4,navigator.mediaDevices.getUserMedia({audio:hn})];case 4:return s=v.sent(),se.current=s,oe.current=s.getTracks()[0],o.addTrack(oe.current),l=o.createDataChannel("oai-events"),R(l),[4,o.createOffer()];case 5:return c=v.sent(),[4,o.setLocalDescription(c)];case 6:return v.sent(),[4,fetch("https://api.openai.com/v1/realtime/calls",{method:"POST",body:c.sdp,headers:{Authorization:"Bearer ".concat(a),"Content-Type":"application/sdp"}})];case 7:if(!(u=v.sent()).ok)throw new Error("Erreur lors de la connexion \xe0 l'API Realtime: ".concat(u.status));return m={type:"answer"},[4,u.text()];case 8:return m.sdp=v.sent(),d=m,[4,o.setRemoteDescription(d)];case 9:return v.sent(),ie.current=o,[3,11];case 10:return p=v.sent(),console.error("Erreur lors du d\xe9marrage de la session:",p),"NotAllowedError"===p.name||"PermissionDeniedError"===p.name||(null===(f=p.message)||void 0===f?void 0:f.includes("Permission denied"))||(null===(h=p.message)||void 0===h?void 0:h.includes("permission"))?J("Acc\xe8s au microphone refus\xe9. Pour utiliser l'assistant vocal, veuillez autoriser l'acc\xe8s au microphone dans les param\xe8tres de votre navigateur, puis rafra\xeechir la page."):J("L'assistant vocal est indisponible pour le moment. Veuillez r\xe9essayer plus tard."),W("error"),oe.current&&(oe.current.stop(),oe.current=null),se.current&&(se.current.getTracks().forEach((function(e){return e.stop()})),se.current=null),ie.current&&(ie.current.close(),ie.current=null),ae.current&&(ae.current.srcObject=null,ae.current=null),[3,11];case 11:return[2]}}
1))})),me.apply(this,arguments)}return(0,a.useEffect)((function(){M&&M.length>0&&(Z.current.config={questions:M},Z.current.allQuestions=M)}),[M]),(0,a.useEffect)((function(){!function(){me.apply(this,arguments)}()}),[]),(0,a.useEffect)((function(){console.log("EVENTS",I)}),[I]),(0,a.useEffect)((function(){if(j){var e=!0;j.addEventListener("message",(function(t){var n,i=JSON.parse(t.data);if(i.timestamp||(i.timestamp=(new Date).toLocaleTimeString()),N((function(e){return[i].concat((0,E.Z)(e))})),"conversation.item.created"===i.type&&(null===(n=i.item)||void 0===n?void 0:n.id)&&(de.current.unshift(i.item.id),de.current.length>20&&(console.log("\u26a0\ufe0f History size: ".concat(de.current.length," items - triggering cleanup")),de.current=function(e,t,n){if(t.length>n){var r=t.slice(n);console.log("\u2702\ufe0f Cleaning conversation history: keeping ".concat(n," items, deleting ").concat(r.length," old items")),r.forEach((function(t){e({type:"conversation.item.delete",item_id:t})}));var i=t.slice(0,n);return console.log("\u2705 History cleaned: ".concat(i.length," items remaining")),i}return t}(g,de.current,12))),"conversation.item.input_audio_transcription.completed"===i.type&&F.current.logUserMessage(i.transcript||"Audio non transcrit"),"response.output_audio_transcript.done"===i.type&&(console.log("\ud83d\udcdd Assistant transcript event:",i),F.current.logAssistantMessage(i.transcript||"R\xe9ponse audio")),"response.created"===i.t
1ype&&(console.log("\ud83c\udfa4 Assistant started speaking"),window.hasActiveResponse=!0,W("speaking"),v(),e&&oe.current&&(oe.current.enabled=!1)),"response.output_audio_transcript.done"===i.type&&(console.log("\ud83d\udc42 Assistant finished speaking, now listening"),W("listening"),v()),"output_audio_buffer.stopped"===i.type&&window.pendingSubmitStop&&(console.log("\ud83d\udd1a Audio termin\xe9 apr\xe8s submit_form, fermeture de session"),window.pendingSubmitStop=!1,window.pendingSubmitStopTimeout&&(clearTimeout(window.pendingSubmitStopTimeout),window.pendingSubmitStopTimeout=null),h("form_submitted")),"response.done"===i.type)if(console.log("\ud83c\udfc1 Response completed"),window.hasActiveResponse=!1,v(),e&&(e=!1,setTimeout((function(){oe.current&&(oe.current.enabled=!0)}),1e4)),window.estimationPresentationInProgress&&(console.log("\ud83d\udcca Pr\xe9sentation estimation termin\xe9e, r\xe9activation VAD"),window.estimationPresentationInProgress=!1,g({type:"input_audio_buffer.clear"}),d()),window.shouldSendNextBlock&&window.nextBlockData){console.log(" Sending next block after response.done"),window.shouldSendNextBlock=!1;var a=window.nextBlockData;window.nextBlockData=null,ue.current=a,setTimeout((function(){var e=Mt[a.blocId]||null;g({type:"conversation.item.create",item:{type:"message",role:"user",content:[{type:"input_text",text:dn(a,e,a.totalQuestionsInBlock)}]}}),ne(X),$(a),console.log("\u2705 currentBlock updated after sending to API"),setTimeout((function(){g({type:"response.create"})}),200)}),200)}else if(window.shouldSendCompletionMessage)console.log(" Sending completion message after response.done"),window.shouldSendCompletionMessage=!1,setTimeout((function(){g({type:"conversation.item.create",item:{type:"message",role:"user",content:[{type:"input_text",text:"Dis exactement cette phrase : 'Parfait ! Merci pour vos r\xe9ponses. Vous allez retrouver toutes ces informations dans le formulaire pour finaliser votre devis. \xc0 tr\xe8s bient\xf4t !'"}]}}),setTimeout((function(){g({type:"response.create"})}),200)}),200);else if(window.shouldRequestCorrections&&window.correctionData){console.log("\ud83d\udd04 Requesting corrections after response.done");var o=window.correctionData;window.shouldRequestCorrections=!1,window.correctionData=null,setTimeout((function(){var e=Object.entries(o).map((function(e){var t=(0,p.Z)(e,2),n=t[0],r=t[1];return"- ".concat(n,": ").concat(r)})).join("\n");g({type:"conversation.item.create",item:{type:"message",role:"user",content:[{type:"input_text",text:"ERREURS DE VALIDATION:\n\n".concat(e,"\n\nDemande \xe0 l'utilisateur de corriger UNIQUEMENT les r\xe9ponses incorrectes. Ne redemande pas les r\xe9ponses d\xe9j\xe0 valid\xe9es.")}]}}),setTimeout((function(){g({type:"response.create"})}),200)}),200)}else window.shouldCreateResponseAfterDone&&(console.log("\ud83d\udd01 Creating deferred response after response.done"),window.shouldCreateResponseAfterDone=!1,setTimeout((function(){g({type:"response.create"})}),200));if("input_audio_buffer.speech_started"===i.type&&(console.log("\ud83d\udde3\ufe0f User started speaking"),W("listening"),v()),"input_audio_buffer.speech_stopped"===i.type&&(console.log("\u23f8\ufe0f User stopped speaking, processing..."),W("processing"),v(),le.current=setTimeout((function(){console.log("Forced response timeout triggered - assistant may be stuck"),g({type:"response.create"})}),5e3)),"response.function_call_arguments.done"===i.type){console.log("\ud83d\udd27 Function call arguments completed:",i.name),W("processing"),v();var s=i.call_id,f=i.name,x=i.arguments,_={};try{_=JSON.parse(x)}catch(w){console.error("Erreur lors du parsing des arguments:",w,"Arguments re\xe7us:",x),_={}}var b={sendClientEvent:g,questionnaireManager:Z,transcriptLogger:F,questionsFromAtom:M,onUpdateFormState:r,setCurrentAnswersCount:L,setIsQuestionnaireComplete:V,setPreviousBlock:ne,setCurrentBlock:$,currentBlock:X,lastAskedBlockRef:ue,blocksProcessedRef:ce,setEstimation:z,canEstimatePremium:c,fetchEstimation:pn,disableVAD:u,disableMicrophone:m,stopSession:h,onSubmitForm:l},y={},S=null,I=!1;if("validate_and_save_answers"===f){var C=function(e,t){var n,r,i=t.questionnaireManager,a=t.transcriptLogger,o=t.onUpdateFormState,s=t.setCurrentAnswersCount,l=t.setIsQuestionnaire
1Complete,c=t.setPreviousBlock,u=t.setCurrentBlock,d=t.currentBlock,m=t.lastAskedBlockRef,f=t.blocksProcessedRef,h=t.canEstimatePremium;console.log("\ud83d\udd04 Processing answers for block:",e);var v=e.answers||e,g=i.current.validateAndSaveAnswersBlock(v);if(console.log("\ud83d\udcca Block validation result:",g),g.defaultsApplied&&g.defaultsApplied.length>0){var x=g.defaultsApplied.map((function(e){return e.message})).filter(Boolean);x.length>0&&(g.defaultValueAnnouncement="AVANT toute autre action ou question, dis TEXTUELLEMENT au client la ou les phrases suivantes (et rien d'autre \xe0 ce sujet) : ".concat(x.map((function(e){return'"'.concat(e,'"')})).join(" ")," Poursuis ENSUITE le flux normal."))}g.validAnswers&&Object.keys(g.validAnswers).length>0&&Object.entries(g.validAnswers).forEach((function(e){var t=(0,p.Z)(e,2),n=t[0],r=t[1];a.current.logQuestionnaireAnswer(n,r)})),g.validAnswers&&Object.keys(g.validAnswers).length>0&&o&&(o(Object.fromEntries(Object.entries(i.current.answers).filter((function(e){return"__SKIPPED__"!==(0,p.Z)(e,2)[1]}))),Object.keys(g.validAnswers)),s(Object.keys(i.current.answers).length));var _,b,y=g.validAnswers?Object.keys(g.validAnswers):[],E=(null===(n=m.current)||void 0===n||null===(r=n.questions)||void 0===r?void 0:r.map((function(e){return e.id})))||[],S=y.length>0&&E.length>0&&y.some((function(e){return!E.includes(e)})),I=null;if(g.success&&0===Object.keys(g.errors).length&&!S){var N,C=(_=(null===(N=m.current)||void 0===N?void 0:N.questions)||[],b=i.current.answers,(_||[]).filter((function(e){var t=null===b||void 0===b?void 0:b[e.id];return"__SKIPPED__"!==t&&(null===t||void 0===t||""===t)})));if(C.length>0)return console.log("\u26a0\ufe0f Unanswered questions remain in current block:",C.map((function(e){return e.id}))),g.pendingBlockQuestions=C.map((function(e){var t;return{id:e.id,text:(null===(t=e.ia_params)||void 0===t?void 0:t.text)||e.text||e.id}})),g.message="ATTENTION : certaines questions de ce bloc n'ont pas de r\xe9ponse enregistr\xe9e : ".concat(g.pendingBlockQuestions.map((function(e){return'"'.concat(e.text,'" (id: ').concat(e.id,")")})).join(", "),". REPOSE ces questions au client MAINTENANT. Si sa r\xe9ponse ne correspond \xe0 aucune option valide, cite-lui les options possibles. S'il ne peut vraiment pas r\xe9pondre, enregistre une cha\xeene vide via validate_and_save_answers pour passer. N'avance PAS tant que ces questions n'ont pas \xe9t\xe9 trait\xe9es."),{result:g,nextBlockData:null,isCorrection:S};var w=i.current.getNextBlock();if(w&&w.questions.length>0)I={questions:w.questions,blockIndex:w.blockIndex,blocId:w.blocId,totalQuestionsInBlock:w.totalQuestionsInBlock},f.current+=1;else{l(!0),c(d),u(null);var T=h(),j=T.canEstimate,R=T.missing;if(j)console.log("\ud83d\udcca Formulaire complet - Estimation possible"),g.isComplete=!0,g.completionMessage="Toutes les questions ont \xe9t\xe9 pos\xe9es et le formulaire est complet. ANNONCE BRI\xc8VEMENT au client que tu vas lancer une estimation de sa prime d'assurance et que cela peut prendre quelques secondes. Ensuite, appelle IMM\xc9DIATEMENT la fonction request_tarif_estimation.";else{console.log("\ud83d\udcca Formulaire incomplet - Pas d'estimation possible, manquants:",R);var A=gn(R,i);g.isComplete=!0,g.missingEstimationFields=A,g.completionMessage='Toutes les questions ont \xe9t\xe9 pos\xe9es, mais il manque des informations n\xe9cessaires au calcul de l\'estimation tarifaire (l\'estimation est FACULTATIVE). Explique-le au client avec tact, puis demande-lui UNE SEULE FOIS s\'il peut fournir les informations list\xe9es dans missingEstimationFields (cite leur "text" de fa\xe7on regroup\xe9e et concise). DEUX SC\xc9NARIOS : (A) Il FOURNIT les r\xe9ponses \u2192 appelle validate_and_save_answers avec les r\xe9ponses, puis encha\xeene request_tarif_estimation si le syst\xe8me te l\'indique. (B) Il INDIQUE qu\'il ne les a pas, ne les conna\xeet pas, ou souhaite avancer (ex: "je ne sais pas", "j\'ai pas", "on avance", "tant pis") \u2192 N\'INSISTE PAS, ne redemande pas, et encha\xeene IMM\xc9DIATEMENT vers la soumission : dis bri\xe8vement au client que tu vas transmettre sa demande en l\'\xe9tat sans estimation, puis appelle check_form_completeness pour initier le flux de soumission (voir section SOUMISSION DU FORMULAIRE).'}}}else if(S){var k;if(console.log("\ud83d\udd04 Correction detected, checking if last block still needs answers"),!(((null===(k=m.current)||void 0===k?void 0:k.questions)||[]).filter((function(e){return!i.current.answers.hasOwnProperty(e.id)||null===i.current.answers[e.id]||void 0===i.current.answers[e.id]||""===i.current.answers[e.id]})).length>0)){var O=i.current.getNextBlock();if(O&&O.questions.length>0)return I={questions:O.questions,blockIndex:O.blockIndex,blocId:O.blocId,totalQuestionsInBlock:O.totalQuestionsInBlock},f.current+=1,{result:g,nextBlockData:I,isCorrection:!1};l(!0),c(d),u(null);var P=h(),D=P.canEstimate,L=P.missing;if(D)console.log("\ud83d\udcca Correction trait\xe9e, formulaire complet - Estimation possible"),g.isComplete=!0,g.completionMessage="La correction a \xe9t\xe9 prise en compte. Le formulaire est complet. ANNONCE BRI\xc8VEMENT au client que tu vas relancer une estimation de sa prime d'assurance et que cela peut prendre quelques secondes. Ensuite, appelle IMM\xc9DIATEMENT la fonction request_tarif_estimation.";else{console.log("\ud83d\udcca Correction trait\xe9e, formulaire incomplet - Pas d'estimation possible, manquants:",L);var M=gn(L,i);g.isComplete=!0,g.missingEstimationFields=M,g.completionMessage="La correction a \xe9t\xe9 prise en compte, mais il manque encore des informations n\xe9cessaires au calcul de l'estimation (l'estimation est FACULTATIVE). Si le client vient de te confirmer qu'il n'a pas ces informations, N'INSISTE PAS et encha\xeene IMM\xc9DIATEMENT vers la soumission : dis-lui bri\xe8vement que tu transmets sa demande en l'\xe9tat sans estimation, puis appelle check_form_completeness pour initier le flux de soumission. Sinon, redemande-lui UNE SEULE FOIS les informations list\xe9es dans missingEstimationFields (champ \"text\") de fa\xe7on regroup\xe9e, puis applique la m\xeame r\xe8gle : r\xe9ponses \u2192 validate_and_save_answers ; refus \u2192 passer \xe0 la soumission via check_form_completeness."}return{result:g,nextBlockData:null,isCorrection:!1}}console.log("\ud83d\udd04 Last block still has unanswered questions, will resend")}return{result:g,nextBlockData:I,isCorrection:S}}(_,b);y=C.result,S=C.nextBlockData,I=C.isCorrection}else if("get_question_details"===f)y=function(e,t){var n=t.questionnaireManager,r=t.questionsFromAtom;console.log("\ud83d\udd0d Getting question details for:",e.question_ids);var i={questions:(Array.isArray(e.question_ids)?e.question_ids:[e.question_ids]).map((function(e){var t,i,a,o,s,l=r[e];if(!l)return{id:e,error:"Question non trouv\xe9e"};var c=n.current.answers[e],u={id:e,text:null===(t=l.ia_params)||void 0===t?void 0:t.text,text_short:null===(i=l.ia_params)||void 0===i?void 0:i.text_short,type:null===(a=l.ia_params)||void 0===a?void 0:a.type,validation:null===(o=l.ia_params)||void 0===o?void 0:o.validation,current_answer:c||null,bloc:null===(s=l.ia_params)||void 0===s?void 0:s.bloc};return l.datas&&Array.isArray(l.datas)&&(u.options=l.datas.map((function(e){return{id:e.id,name:e.name}}))),u}))};return console.log("\ud83d\udccb Question details retrieved:",i),i}(_,b);else{if("request_tarif_estimation"===f)return void function(e,t){var n=t.sendClientEvent,r=t.fetchEstimation,i=t.disableVAD,a=t.setEstimation,o=t.onUpdateFormState,s=t.canEstimatePremium;console.log("\ud83d\udcca request_tarif_estimation appel\xe9 par GPT");var l=s(),c=l.canEstimate,u=l.mergedState;if(window.estimationFormData=null,!c)return console.error("\u274c Donn\xe9es insuffisantes pour l'estimation"),n({type:"conversation.item.create",item:{type:"function_call_output",call_id:e,output:JSON.stringify({success:!1,error:"Donn\xe9es du formulaire non disponibles",message:"L'estimation n'a pas pu \xeatre r\xe9alis\xe9e. Dis au client que ses r\xe9ponses sont enregistr\xe9es et qu'il pourra obtenir son estimation depuis le formulaire."})}}),void n({type:"response.create"});var d=u;i(),r(d).then((function(t){var r;if(console.log("\ud83d\udcca Estimation re\xe7ue, envoi du r\xe9sultat \xe0 GPT",t.success),null===t||void 0===t?void 0:t.success){var i=t.estimation;if(r={success:!0,estimation:{prime_mensuelle_ttc:i.prime_mensuelle_ttc,prime_annuelle_ttc:i.prime_annuelle_ttc,fourchette_min:i.fourchette_min,fourchette_max:i.fourchette_max,confiance:i.confiance,facteur
1s_cles:i.facteurs_cles},message:'Voici l\'estimation de la prime d\'assurance. Pr\xe9sente les r\xe9sultats au client UNE SEULE FOIS : d\'abord le montant mensuel, puis annuel, puis une phrase simple pour la fourchette ("La fourchette de votre prime se situe entre X et Y euros annuel"), et les facteurs cl\xe9s. IMPORTANT : prononce les montants en toutes lettres sous la forme "X euros Y" (ex: 62.68 \u2192 "soixante-deux euros soixante-huit"), jamais "virgule" ni "point". Pr\xe9cise que c\'est une estimation indicative. Termine en proposant au client soit de modifier des r\xe9ponses, soit de soumettre sa demande de devis s\'il est satisfait. R\xc8GLES STRICTES POST-PR\xc9SENTATION : (1) NE RECOMMENCE JAMAIS la pr\xe9sentation depuis le d\xe9but, m\xeame si le client te relance, t\'interromp, ou semble ne pas avoir entendu \u2014 au pire, redis UNIQUEMENT le montant mensuel et l\'annuel de fa\xe7on concise. (2) Si tu es interrompu pendant la pr\xe9sentation, NE LA REPRENDS PAS : demande directement au client ce qu\'il souhaite faire (modifier une r\xe9ponse, soumettre, ou poser une question). (3) Si le client confirme vouloir soumettre, suis la proc\xe9dure de la section SOUMISSION DU FORMULAIRE (check_form_completeness d\'abord).'},a(i),o&&i.prime_annuelle_ttc){var s={};i.prime_annuelle_ttc&&(s.prime_annuelle_ttc=i.prime_annuelle_ttc),i.fourchette_min&&(s.fourchette_prime_annuelle_min=i.fourchette_min),i.fourchette_max&&(s.fourchette_prime_annuelle_max=i.fourchette_max),o(s)}}else r={success:!1,error:(null===t||void 0===t?void 0:t.error)||"Erreur lors de l'estimation",message:"L'estimation n'a pas pu \xeatre r\xe9alis\xe9e. Dis au client que toutes ses r\xe9ponses sont bien enregistr\xe9es et qu'il pourra obtenir son estimation directement depuis le formulaire."};n({type:"conversation.item.create",item:{type:"function_call_output",call_id:e,output:JSON.stringify(r)}}),window.estimationPresentationInProgress=!0,setTimeout((function(){n({type:"response.create"})}),200)}))}(s,b);if("check_form_completeness"===f)y=function(e){var t,n,r,i=e.questionnaireManager,a=(null===i||void 0===i||null===(t=i.current)||void 0===t||null===(n=t.getPendingRequiredQuestions)||void 0===n?void 0:n.call(t))||[];if(0===a.length)return{is_complete:!0,message:"Toutes les r\xe9ponses obligatoires sont pr\xe9sentes. Tu peux maintenant appeler submit_form."};var o=a.map((function(e){var t;return{id:e.id,text:(null===(t=e.ia_params)||void 0===t?void 0:t.text)||e.text||e.id}})),s=(null===i||void 0===i||null===(r=i.current)||void 0===r?void 0:r.answers)||{};return a.every((function(e){return"__SKIPPED__"===s[e.id]}))?{is_complete:!1,all_missing_already_skipped:!0,missing_question_ids:o.map((function(e){return e.id})),missing_questions:o,message:'Le formulaire reste incomplet, mais toutes les informations manquantes ont D\xc9J\xc0 \xe9t\xe9 marqu\xe9es comme indisponibles par le client lors du questionnaire. NE LES REDEMANDE PAS. Demande au client une CONFIRMATION EXPLICITE qu\'il souhaite transmettre sa demande de devis en l\'\xe9tat (ex: "Souhaitez-vous que je transmette votre demande de devis en l\'\xe9tat ?"). N\'appelle submit_form QUE si le client r\xe9pond clairement OUI (ex: "oui", "c\'est bon", "allez-y", "envoyez"). Si sa r\xe9ponse est ambigu\xeb ou n\xe9gative, ne soumets pas et redemande confirmation ou propose une autre action.'}:{is_complete:!1,all_missing_already_skipped:!1,missing_question_ids:o.map((function(e){return e.id})),missing_questions:o,message:"Le formulaire est incomplet : des r\xe9ponses obligatoires manquent. Informe bri\xe8vement le client des informations manquantes (libell\xe9s dans missing_questions[].text) et demande-lui s'il peut les fournir. S'il les fournit \u2192 appelle validate_and_save_answers puis rappelle check_form_completeness. S'il indique qu'il n'a pas ces informations \u2192 demande-lui une CONFIRMATION EXPLICITE qu'il souhaite malgr\xe9 tout transmettre sa demande en l'\xe9tat. N'appelle submit_form QUE s'il r\xe9pond clairement OUI. En cas de r\xe9ponse ambigu\xeb ou n\xe9gative, ne soumets pas."}}(b);else{if("submit_form"===f)return void function(e,t){var n,r,i=t.onSubmitForm,a=t.stopSession,o=t.questionnaireManager,s=t.disableMicrophone;console.log("\ud83d\udccb submit_form appel\xe9 par GPT"),s&&s();var l=(null===o||void 0===o||null===(n=o.current)||void 0===n||null===(r=n.getPendingRequiredQuestions)||void 0===r?void 0:r.call(n))||[];l.length>0&&console.warn("\u2139\ufe0f Soumission avec questions obligatoires manquantes (soumission partielle):",l.map((function(e){return e.id}))),window.pendingSubmitStop=!0,window.pendingSubmitStopTimeout&&clearTimeout(window.pendingSubmitStopTimeout),window.pendingSubmitStopTimeout=setTimeout((function(){window.pendingSubmitStop&&(console.warn("\u23f1\ufe0f Timeout en attente de output_audio_buffer.stopped, fermeture forc\xe9e"),window.pendingSubmitStop=!1,a("form_submitted"))}),5e3),i?i().then((function(e){console.log("\ud83d\udccb R\xe9sultat soumission formulaire:",e),(null===e||void 0===e?void 0:e.success)||console.error("\u274c \xc9chec soumission formulaire:",null===e||void 0===e?void 0:e.error)})):console.error("\u274c onSubmitForm callback non disponible")}(0,b);"end_questionnaire_session"===f&&(y=function(e){var t=e.setIsQuestionnaire
1Complete,n=e.stopSession;return t(!0),setTimeout((function(){console.log("Stopping session..."),n()}),3e3),{success:!0,message:"Session termin\xe9e par l'assistant"}}(b))}}g({type:"conversation.item.create",item:{type:"function_call_output",call_id:s,output:JSON.stringify(y)}}),function(e,t,n,r,i){var a=i.sendClientEvent,o=i.lastAskedBlockRef;"validate_and_save_answers"===e?r&&o.current?(console.log("\ud83d\udd04 Correction: resending last asked block after response.done"),window.shouldSendNextBlock=!0,window.nextBlockData=o.current):n?(console.log("\u2705 Block validated, sending next block after response.done"),window.shouldSendNextBlock=!0,window.nextBlockData=n):!t.success&&Object.keys(t.errors).length>0?(console.log("\u274c Block has errors, preparing correction request"),window.shouldRequestCorrections=!0,window.correctionData=t.errors):t.pendingBlockQuestions?(console.log("\u26a0\ufe0f Block has unanswered questions, triggering re-ask response"),vn(a)):t.isComplete&&(console.log("\u2705 Questionnaire complete, triggering response.create"),vn(a)):"get_question_details"===e?(console.log("\ud83d\udd04 get_question_details completed, triggering new response"),vn(a)):"check_form_completeness"===e&&(console.log("\ud83d\udd0d check_form_completeness completed, triggering new response"),vn(a))}(f,y,S,I,b)}})),j.addEventListener("open",(function(){if(y(!0),N([]),W("idle"),L(0),window.shouldSendNextBlock=!1,window.nextBlockData=null,window.hasActiveResponse=!1,window.shouldCreateResponseAfterDone=!1,window.shouldRequestCorrections=!1,window.correctionData=null,window.shouldRefreshContext=!1,window.shouldSendCompletionMessage=!1,window.estimationFormData=null,window.estimationPresentationInProgress=!1,window.pendingSubmitStop=!1,window.pendingSubmitStopTimeout&&(clearTimeout(window.pendingSubmitStopTimeout),window.pendingSubmitStopTimeout=null),ce.current=0,de.current=[],o&&o(!0),F.current.newSession(U),V(!1),g({type:"input_audio_buffer.clear"}),s){var e=Z.current.peekCurrentQuestion();e&&e.id?s(e.id):s(null)}setTimeout((function(){!function(){var e,t=Z.current.getFirstBlock();if(console.log("\ud83d\udd0d First block debug:",t),console.log("\ud83d\udd0d Questions in first block:",null===t||void 0===t?void 0:t.questions),console.log("\ud83d\udd0d Question labels:",null===t||void 0===t||null===(e=t.questions)||void 0===e?void 0:e.map((function(e){return{id:e.id,text:e.text}}))),t&&t.questions.length>0){$(t),ne(null),ue.current=t;var n=Mt[t.blocId]||null;setTimeout((function(){g({type:"conversation.item.create",item:{type:"message",role:"user",content:[{type:"input_text",text:un(t,n,t.totalQuestionsInBlock)}]}}),setTimeout((function(){g({type:"response.create"})}),200)}),200)}else console.error("No first block available",{firstBlock:t})}()}),100)}))}}),[j]),(0,i.jsx)(i.Fragment,{children:(0,i.jsx)(tn,{questionnaireManager:Z.current,isSessionActive:b,assistantState:G,stopSession:h,currentBlock:X,previousBlock:te,audioStream:k,microphoneStream:se.current,answersCount:D,errorMessage:K})})}var _n=n(906805),bn=function(e){var t=e.children;return(0,i.jsx)(_n.ww.div,{initial:{opacity:0}
1,exit:{opacity:0},animate:{opacity:1},transition:{duration:.5},style:{originX:.5,originY:0},className:"pt-3 pb-5",children:t})},yn=function(e){var t=e.steps,n=e.activeSectionIndex,r=e.containerRef,o=e.onStepClick,s=(0,a.useState)(0),l=s[0],c=s[1],u=(0,a.useState)(!1),d=(u[0],u[1]),m=rt(),p=(m.formState,m.questionsConfig,(0,a.useRef)(null)),f=(0,a.useRef)([]),h=(0,a.useCallback)((function(){var e;if(!r.current||0===t.length)return 0;var i=r.current,a=n,o=i.querySelector("#step-".concat(null===(e=t[n])||void 0===e?void 0:e.id));if(o&&n<t.length-1){var s=o.getBoundingClientRect(),l=i.getBoundingClientRect(),c=s.top-l.top,u=s.height;if(c<l.height&&c+u>0){var d=Math.max(0,Math.min(1,-c/u));a=n+d}}var m=a/(t.length-1)*100;return Math.min(100,Math.max(0,m))}),[t,n,r]),v=(0,a.useCallback)((function(){if(r.current){var e=r.current,t=e.querySelector("#step-assistant_vocal");if(t){var n=t.getBoundingClientRect(),i=e.getBoundingClientRect(),a=n.bottom<i.top;d(a)}else d(!1)}}),[r]),g=(0,a.useCallback)((function(){if(p.current&&0!==t.length){var e=p.current,r=f.current[n];if(r){var i=e.offsetWidth,a=r.offsetLeft-i/2+r.offsetWidth/2;e.scrollTo({left:Math.max(0,a),behavior:"smooth"})}}}),[n,t.length]);(0,a.useEffect)((function(){var e=r.current;if(e){var t=function(){c(h()),v()};return e.addEventListener("scroll",t),t(),function(){return e.removeEventListener("scroll",t)}}}),[h,v]),(0,a.useEffect)((function(){g()}),[g]);return(0,i.jsx)(i.Fragment,{children:(0,i.jsx)("div",{className:"position-absolute overflow-hidden border border-purple shadow-sm animated fadeIn fast col-lg-8 rounded-pill",style:{top:10,zIndex:1e3,padding:"10px 0px",borderBottom:"2px solid #e9ecef",background:"rgba(238, 242, 255, 0.83)",backdropFilter:"blur(10px)"},children:(0,i.jsxs)("div",{ref:p,style:{overflowX:"auto",overflowY:"hidden",scrollbarWidth:"none",msOverflowStyle:"none",WebkitOverflowScrolling:"touch",paddingLeft:"15px",paddingRight:"15px"},className:"jsx-4e5032396ec3fb7a timeline-scroll-container",children:[(0,i.jsx)(j(),{id:"4e5032396ec3fb7a",children:".timeline-scroll-container.jsx-4e5032396ec3fb7a::-webkit-scrollbar{display:none}@media(min-width:768px){.timeline-steps-wrapper.jsx-4e5032396ec3fb7a{-webkit-box-pack:justify!important;-webkit-justify-content:space-between!important;-moz-box-pack:justify!important;-ms-flex-pack:justify!important;justify-content:space-between!important;width:100%;gap:0!important}}"}),(0,i.jsxs)("div",{style:{minWidth:"max-content",gap:"20px",justifyContent:"flex-start"},className:"jsx-4e5032396ec3fb7a d-flex align-items-center position-relative timeline-steps-wrapper",children:[(0,i.jsx)("div",{style:{top:"37%",left:"20px",right:"20px",height:"4px",backgroundColor:"#fff",borderRadius:"2px",transform:"translateY(-50%)",zIndex:1},className:"jsx-4e5032396ec3fb7a position-absolute"}),(0,i.jsx)("div",{style:{top:"37%",left:"20px",height:"4px",backgroundColor:"#4f46e5",borderRadius:"2px",transform:"translateY(-50%)",width:"calc(".concat(l,"% - 40px)"),transition:"width 0.3s ease-out",zIndex:2},className:"jsx-4e5032396ec3fb7a position-absolute"}),t.map((function(e,t){var r=t<3||t<=n;return(0,i.jsxs)("div",{ref:function(e){return f.current[t]=e},style:{cursor:"pointer",zIndex:3,flex:"0 0 auto",minWidth:"70px"},onClick:function(){return function(e,t){o&&o(e,t)}(e,t)},className:"jsx-4e5032396ec3fb7a d-flex flex-column align-items-center position-relative",children:[(0,i.jsx)("div",{style:{width:"40px",height:"40px",fontSize:"0.9rem",fontWeight:"bold",transition:"all 0.3s cubic-bezier(0.4, 0, 0.2, 1)",boxShadow:r?"0 4px 12px rgba(79, 70, 229, 0.4)":"0 2px 4px rgba(0,0,0,0.1)"},className:"jsx-4e5032396ec3fb7a "+"d-flex align-items-center justify-content-center rounded-circle transition-all ".concat(r?"bg-purple text-white shadow-lg":"bg-light text-muted border"),children:(0,i.jsx)("i",{style:{fontSize:"0.9rem"},className:"jsx-4e5032396ec3fb7a "+"fa ".concat(e.icon)})}),(0,i.jsx)("span",{style:{fontSize:"0.65rem",maxWidth:"70px",lineHeight:"1.2",transition:"all 0.3s ease",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},className:"jsx-4e5032396ec3fb7a mt-2 text-center transition-all text-muted",children:e.shortTitle||e.title})]},e.id)}))]})]})})})},En=function(e){var t=e.steps,n=e.currentQuestionId,r=(0,f.Dv)(ce),o=(0,a.useState)(new Set),s=o[0],l=o[1],c=(0,a.useState)(0),u=c[0],d=c[1],m=(0,a.useRef)(null),h=(0,a.useRef)([]),v=(0,a.useRef)(null),g=(0,a.useRef)(null),x=(0,p.Z)((0,N.Z)(),1)[0].auth.isAuthenticated,_=(0,a.useRef)(x),b=(0,a.useRef)(s),y=(0,a.useRef)(u);b.current=s,y.current=u;var E=(0,a.useCallback)((function(e){g.current&&clearTimeout(g.current),g.current=setTimeout((function(){var e=0,t=-1,n=new Set;h.current.forEach((function(n,r){if(n&&m.current){var i=n.getBoundingClientRect(),a=m.current.getBoundingClientRect();if(i.top<a.bottom-80&&i.bottom>a.top+80){var o=(Math.min(i.bottom,a.bottom-80)-Math.max(i.top,a.top+80)
1)/i.height;o>t&&(t=o,e=r)}}}));for(var r=0;r<=e;r++)n.add(r);l(n),d(e)}),50)}),[]),S=(0,a.useCallback)((function(e,t){var n=document.getElementById("step-".concat(e.id));if(n&&m.current){var r=n.offsetTop;m.current.scrollTo({top:Math.max(0,r-100),behavior:"smooth"})}}),[]),I=(0,a.useCallback)((function(e){if(e&&m.current){var t=document.querySelector('[data-question-id="'.concat(e,'"]'));if(t){var n=t.offsetTop;m.current.scrollTo({top:Math.max(0,n-150),behavior:"smooth"})}}}),[]);(0,a.useEffect)((function(){if(n){var e=setTimeout((function(){I(n)}),100);return function(){return clearTimeout(e)}}}),[n,I]),(0,a.useEffect)((function(){if(!_.current&&x){var e=setTimeout((function(){var e=document.getElementById("step-utilisateur");if(e&&m.current){var t=e.offsetTop;m.current.scrollTo({top:Math.max(0,t-120),behavior:"smooth"})}}),300);return function(){return clearTimeout(e)}}_.current=x}),[x]),(0,a.useEffect)((function(){if(m.current)return v.current=new IntersectionObserver(E,{root:m.current,rootMargin:"-80px 0px 0px 0px",threshold:[.01,.5,1]}),h.current.forEach((function(e){e&&v.current.observe(e)})),setTimeout((function(){h.current.length>0&&E([])}),100),function(){v.current&&v.current.disconnect(),g.current&&clearTimeout(g.current)}}),[t.length,r]);var C=function(){if(!x)return t.filter((function(e){return"utilisateur"===e.id}));if(!r){var e=t.findIndex((function(e){return"assistant_vocal"===e.id}));if(-1!==e)return t.slice(0,e+1)}return t}();return(0,i.jsxs)("div",{className:"container-fluid h-100 px-0",children:[r&&(0,i.jsx)("div",{className:"d-none d-md-flex justify-content-center",children:(0,i.jsx)(yn,{steps:t,activeSectionIndex:u,containerRef:m,onStepClick:S})}),(0,i.jsx)("div",{ref:m,className:"overflow-auto",style:{height:"100vh",paddingTop:"120px"},children:(0,i.jsxs)("div",{className:"container",children:[(0,i.jsx)("div",{className:"row justify-content-center",children:(0,i.jsxs)("div",{className:"col-lg-8",children:[(0,i.jsx)("h1",{className:"h1 text-purple text-center",style:{fontWeight:"800"},children:"Devis Assurance Auto"}),(0,i.jsxs)("div",{className:"d-flex justify-content-center align-items-center mb-3",style:{gap:5},children:[(0,i.jsx)("span",{className:"text-primary",children:"pour les r\xe9sidents de l'\xeele de La R\xe9union"}),(0,i.jsx)("div",{className:"d-center",children:(0,i.jsx)("img",{src:"/images/auto/drapeau-reunion.png",width:"20",alt:"Drapeau de la R\xe9union"})})]}),C.map((function(e,t){return(0,i.jsx)("div",{ref:function(e){return h.current[t]=e},className:"mb-5",id:"step-".concat(e.id),"data-section-index":t,children:(0,i.jsxs)(bn,{children:[e.showTitle&&(0,i.jsx)("div",{className:"section-header pb-4 mb-5",children:(0,i.jsxs)("h2",{className:"position-relative justify-content-center flex-column text-purple pb-2 d-flex align-items-center",style:{gap:10},children:[(0,i.jsx)("span",{className:"shadow border border-purple text-purple rounded-pill text-white d-flex justify-content-center align-items-center",style:{width:70,height:70,background:"#eef2ff"},children:(0,i.jsx)("i",{className:"fa ".concat(e.icon),style:{fontSize:"1.8rem"}})}),(0,i.jsx)("span",{className:"shadow bg-purple position-absolute px-4 py-2 text-white rounded-pill",style:{fontSize:"1.8rem",fontWeight:"800",top:55},children:e.title})]})}),(0,i.jsx)("div",{className:"step-content",children:e.component})]})},e.id)}))]})}),(0,i.jsx)("div",{className:"row justify-content-center mt-4 pb-4",children:(0,i.jsx)("div",{className:"col-lg-8",children:(0,i.jsx)("div",{className:"sticky-bottom bg-white pt-3 border-top"})})})]})})]})},Sn=n(307297),In=n(930411);function Nn(){var e=(0,Sn.Z)(["\n  position: fixed;\n  top: 0;\n  left: 0;\n  right: 0;\n  bottom: 0;\n  background-color: rgba(0, 0, 0, 0.5);\n  display: ",";\n  align-items: center;\n  justify-content: center;\n  z-index: 10000;\n  animation: fadeIn 0.3s ease-in-out;\n\n  @keyframes fadeIn {\n    from {\n      opacity: 0;\n    }\n    to {\n      opacity: 1;\n    }\n  }\n"]);return Nn=function(){return e},e}function Cn(){var e=(0,Sn.Z)(["\n  background: white;\n  border-radius: 16px;\n  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.15);\n  max-width: 580px;\n  width: 90%;\n  max-height: 90vh;\n  overflow-y: auto;\n  animation: slideUp 0.3s ease-out;\n\n  @keyframes slideUp {\n    from {\n      transform: translateY(50px);\n      opacity: 0;\n    }\n    to {\n      transform: translateY(0);\n      opacity: 1;\n    }\n  }\n"]);return Cn=function(){return e},e}function wn(){var e=(0,Sn.Z)(["\n  padding: 28px 32px 20px;
1\n  border-bottom: 1px solid #f0f0f0;\n  display: flex;\n  align-items: center;\n  font-size: 1.125rem;\n  font-weight: 600;\n  color: #2d3748;\n\n  i {\n    margin-right: 12px;\n    color: #5b5fc7;\n    font-size: 1.25rem;\n  }\n"]);return wn=function(){return e},e}function Tn(){var e=(0,Sn.Z)(["\n  padding: 40px 32px 32px;\n"]);return Tn=function(){return e},e}function jn(){var e=(0,Sn.Z)(["\n  text-align: center;\n  margin-bottom: 20px;\n\n  i {\n    font-size: 3.5rem;\n    color: #5b5fc7;\n  }\n"]);return jn=function(){return e},e}function Rn(){var e=(0,Sn.Z)(["\n  text-align: center;\n  margin-bottom: 12px;\n  font-weight: 600;\n  color: #2d3748;\n  font-size: 1.125rem;\n"]);return Rn=function(){return e},e}function An(){var e=(0,Sn.Z)(["\n  text-align: center;\n  color: #718096;\n  margin-bottom: 32px;\n  line-height: 1.65;\n  font-size: 0.9375rem;\n"]);return An=function(){return e},e}function kn(){var e=(0,Sn.Z)(["\n  display: grid;\n  grid-template-columns: 1fr 1fr;\n  gap: 20px;\n  margin-top: 24px;\n\n  @media (max-width: 576px) {\n    grid-template-columns: 1fr;\n  }\n"]);return kn=function(){return e},e}function On(){var e=(0,Sn.Z)(["\n  border: 2px solid ",";\n  border-radius: 12px;\n  padding: 28px 20px;\n  text-align: center;\n  cursor: pointer;\n  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);\n  background: ",";\n\n  &:hover {\n    transform: translateY(-2px);\n    box-shadow: 0 12px 24px rgba(91, 95, 199, 0.15);\n    border-color: ",";\n    background: ",";\n  }\n\n  &:active {\n    transform: translateY(0);\n  }\n\n  i {\n    font-size: 2.75rem;\n    color: ",";\n    margin-bottom: 16px;\n    display: block;\n  }\n\n  h6 {\n    font-weight: 600;\n    margin-bottom: 6px;\n    color: #2d3748;\n    font-size: 0.9375rem;\n  }\n\n  p {\n    font-size: 0.8125rem;\n    color: #718096;\n    margin: 0;\n    line-height: 1.5;\n  }\n"]);return On=function(){return e},e}function Pn(){var e=(0,Sn.Z)(["\n  padding: 20px 32px 28px;\n  text-align: center;\n  border-top: 1px solid #f0f0f0;\n  background: #fafafa;\n  border-radius: 0 0 16px 16px;\n\n  small {\n    color: #718096;\n    font-size: 0.8125rem;\n    display: flex;\n    align-items: center;\n    justify-content: center;\n\n    i {\n      margin-right: 8px;\n      color: #a0aec0;\n    }\n  }\n"]);return Pn=function(){return e},e}var Dn=In.ZP.div(Nn(),(function(e){return e.isOpen?"flex":"none"})),Ln=In.ZP.div(Cn()),Mn=In.ZP.div(wn()),Un=In.ZP.div(Tn()),qn=In.ZP.div(jn()),zn=In.ZP.h5(Rn()),Zn=In.ZP.p(An()),Fn=In.ZP.div(kn()),Bn=In.ZP.div(On(),(function(e){return e.primary?"#5b5fc7":"#e2e8f0"}),(function(e){return e.primary?"#f7f7fe":"white"}),(function(e){return e.primary?"#5b5fc7":"#cbd5e0"}),(function(e){return e.primary?"#f0f0fd":"#fafafa"}),(function(e){return e.primary?"#5b5fc7":"#718096"})),Vn=In.ZP.div(Pn()),Qn=function(e){var t=e.isOpen,n=e.onResume,r=e.onRestart;return t?(0,i.jsx)(Dn,{isOpen:t,children:(0,i.jsxs)(Ln,{children:[(0,i.jsxs)(Mn,{children:[(0,i.jsx)("i",{className:"fas fa-file-alt"}),"Devis en cours d\xe9tect\xe9"]}),(0,i.jsxs)(Un,{children:[(0,i.jsx)(qn,{children:(0,i.jsx)("i",{className:"fas fa-clipboard-list"})}),(0,i.jsx)(zn,{children:"Nous avons trouv\xe9 un devis en cours"}),(0,i.jsx)(Zn,{children:"Vous avez commenc\xe9 un devis pr\xe9c\xe9demment. Souhaitez-vous le reprendre o\xf9 vous en \xe9tiez, ou recommencer un nouveau devis ?"}),(0,i.jsxs)(Fn,{children:[(0,i.jsxs)(Bn,{onClick:r,children:[(0,i.jsx)("i",{className:"fas fa-redo-alt"}),(0,i.jsx)("h6",{children:"Recommencer de z\xe9ro"}),(0,i.jsx)("p",{children:"Effacer et cr\xe9er un nouveau devis"})]}),(0,i.jsxs)(Bn,{primary:!0,onClick:n,children:[(0,i.jsx)("i",{className:"fas fa-play-circle"}),(0,i.jsx)("h6",{children:"Reprendre mon devis"}),(0,i.jsx)("p",{children:"Continuez l\xe0 o\xf9 vous vous \xeates arr\xeat\xe9"})]})]})]}),(0,i.jsx)(Vn,{children:(0,i.jsxs)("small",{children:[(0,i.jsx)("i",{className:"fas fa-lock"}),"Vos donn\xe9es sont s\xe9curis\xe9es et sauvegard\xe9es"]})})]})}):null},Gn=function(){var e=rt(),t=e.isLoading,n=e.actions,r=e.currentQuestionId,o=e.steps,s=e.formState,l=e.leadId,c=(0,f.Dv)(Xe),u=(0,p.Z)((0,f.KO)(se),1)[0],d=(0,yt.useRouter)(),m=Ue().actions,h=(0,a.useRef)(l);h.current=l;var v=(0,a.useCallback)((0,C.Z)((function(){var e;return(0,w.__generator)(this,(function(t){switch(t.label){case 0:if(!h.current)return[2,{success:!1,error:"Lead ID manquant"}];t.label=1;case 1:return t.trys.push([1,4,,5]),[4,He()];case 2:return t.sent(),[4,m.patchToGraalApi("new-leads/".concat(h.current,"/finaliser"),{})];case 3:return t.sent(),d.push("/assurance-auto/succes"),[2,{success:!0}];case 4:return e=t.sent(),console.error("Erreur lors de la finalisation du lead:",e),[2,{success:!1,error:e.message}];case 5:return[2]}}
1))})),[m,d]),g=Ke((function(e){n.goToFirstIncompleteQuestion(e)})),x=g.showModal,_=g.handleResumeLead,b=g.handleRestartLead;g.uploadDocument;return(0,a.useEffect)((function(){n.initializeFormState()}),[]),t?(0,i.jsx)(Gt.Z,{}):(0,i.jsxs)("div",{className:"h-100 d-flex flex-column",children:[(0,i.jsx)(En,{currentQuestionId:r,steps:o}),(0,i.jsx)(Xt,{isOpen:u,children:(0,i.jsx)(xn,{questionConfig:c,reponseConfig:s,onUpdateFormState:n.onUpdatePartialFormState,onUpdateSessionState:n.onUpdateVocalSessionState,onUpdateCurrentQuestion:function(e){return n.onUpdateCurrentVocalQuestion(e)},onSubmitForm:v})}),(0,i.jsx)(Yt,{}),(0,i.jsx)(Qn,{isOpen:x,onResume:_,onRestart:b})]})},Wn=n(418299),Hn=function(){var e=(0,s.Z)(),t=(e.constants,e.getConstants),n=Qt().questionsConfig;return(0,a.useEffect)((function(){t()}),[]),null==n?(0,i.jsx)(Gt.Z,{}):(0,i.jsx)(u.Z,{rootReducer:d.Z,children:(0,i.jsxs)(ut.pm,{reCaptchaKey:"6LcyI7QZAAAAAIKWu3co1tElIw3jkEMxoo887czo",children:[(0,i.jsx)(Wn.Z,{}),(0,i.jsx)(o.Z,{}),(0,i.jsxs)(c(),{children:[(0,i.jsx)("link",{rel:"stylesheet",href:"https://kit-free.fontawesome.com/releases/latest/css/free.min.css",media:"all"}),(0,i.jsx)("link",{rel:"stylesheet",href:"/css/form-custom-assurance-auto.css",crossOrigin:"anonymous"})]}),(0,i.jsx)("div",{id:"blur-container"}),(0,i.jsx)(Gn,{}),(0,i.jsx)(A.Ix,{}),(0,i.jsx)(m.Z,{})]})})}},758120:function(e){e.exports={container:"AssistantOCR_container__Mcx8S",title:"AssistantOCR_title__BaW23",uploadArea:"AssistantOCR_uploadArea__6tbCF",dragover:"AssistantOCR_dragover__rqsAT",processing:"AssistantOCR_processing__lTvrL",fileInput:"AssistantOCR_fileInput__oaNAH",uploadBtn:"AssistantOCR_uploadBtn__vSQb8",loading:"AssistantOCR_loading__Pmhst",spinner:"AssistantOCR_spinner__qRGpe",spin:"AssistantOCR_spin__6dj4p",result:"AssistantOCR_result__GGPeV",success:"AssistantOCR_success__iuMGm",error:"AssistantOCR_error__6kUCW",jsonOutput:"AssistantOCR_jsonOutput__fx22T",fileInfo:"AssistantOCR_fileInfo__c1_a_",supportedFormats:"AssistantOCR_supportedFormats__CqaSJ"}},51438:function(e,t,n){"use strict";function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}n.d(t,{Z:function(){return r}})},352951:function(e,t,n){"use strict";function r(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function i(e,t,n){return t&&r(e.prototype,t),n&&r(e,n),e}n.d(t,{Z:function(){return i}})}},function(e){e.O(0,[634,430,664,546,965,236,774,888,179],(function(){return t=621019,e(e.s=t);var t}));var t=e.O();_N_E=t}]);
2//# sourceMappingURL=tarif-0fe2f92aedd9ae95.js.map

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.