!function(){let t=null;function n(t){return/^[0-9]+$/.test(t||"")&&parseInt(t,10)>0?parseInt(t,10):null}function e(t){return/^#?([0-9a-fA-F]{3}|[0-9a-fA-F]{6})$/.test(t||"")?t:""}function o(t){try{const n=new URL(t).origin;return n===window.location.origin||/^https:\/\/(www|recette)\.monrendezvousveto\.(fr|quebec)$/.test(n)?n:null}catch(t){return null}}function c(t){return(JSON.stringify(t)||"null").replace(/</g,"\\u003c")}function a(t){try{return["http:","https:"].includes(new URL(t,window.location.href).protocol)}catch(t){return!1}}const r={iframe:null,contentContainer:null,fps:10,initElements(t){let{iframe:n}=t;n&&(this.iframe=n,this.contentContainer=n.contentWindow.document.body.querySelector(".content-container"),this.contentContainer&&this.loop())},loop(){this.recalcHeight({iframe:this.iframe,contentContainer:this.contentContainer}),setTimeout((()=>{this.loop()}),1e3/this.fps)},recalcHeight(t){let{iframe:n,contentContainer:e}=t;n.style.height="".concat(e.offsetHeight,"px")}},i={state:{analytics:!1,debug:!1},checkAnalytics(){const t=this.getScript();t.dataset.analytics&&(this.state.analytics=!0),t.dataset.debug&&(this.state.debug=!0)},getScript:()=>document.querySelector("[data-widget-clinic]"),scrollBackToTop(){const t=document.querySelector("#vetowidget");t&&t.scrollIntoView(!0)},handleEvent(t){this.state.debug&&console.log("Handling event",t),this.state.analytics&&window.dataLayer&&window.dataLayer.push&&(console.log("Pushing to datalayer"),dataLayer.push(t))}};!function(){const s=document.currentScript.src;window.addEventListener("load",(()=>{!function(a){let{currentScript:s}=a;const l=document.querySelector("#vetowidget");if(!l)return;const d=i.getScript();let u=e(d.dataset.primaryColor),h=e(d.dataset.secondaryColor);const p=d.dataset.customer||"";let w=parseInt(d.dataset.widgetClinic,10);const g=d.dataset.chv,m=d.dataset.confirmUrl||"";let f=d.dataset.locale||navigator.language||"fr";f=f.split("-")[0].toLowerCase(),["fr","en"].includes(f)||(f="fr");const v=document.createElement("iframe");t=v,v.style.border="none",v.style.width="100%",v.style.height="500px",l.appendChild(v);const y=function(){const t=window.location.search.substring(1),n={},e=("?"===t[0]?t.substr(1):t).split("&");for(let t=0;t<e.length;t++){const o=e[t].split("=");n[decodeURIComponent(o[0])]=decodeURIComponent(o[1]||"")}return n}();n(y.clinic)&&(w=n(y.clinic)),e(y.primaryColor)&&(u=e(y.primaryColor)),e(y.secondaryColor)&&(h=e(y.secondaryColor));const C=document.querySelector('script[src*="widget.monrendezvousveto"][data-widget-clinic]');let b,j,L="fr";if(C&&C.src.includes("quebec")&&(L="quebec"),"quebec"===L)b="CA";else{var S,U;const t=["FR","BE","LU","CH","CA"],n=(d.dataset.country||"").toUpperCase(),e=t.includes(n)?n:null;b=null!==(S=null!==(U=null!=e?e:function(){const t=window.location.hostname;return t.endsWith(".be")?"BE":t.endsWith(".lu")?"LU":t.endsWith(".ch")?"CH":t.endsWith(".ca")?"CA":null}())&&void 0!==U?U:function(){var n;const e=null===(n=(navigator.language||"").split("-")[1])||void 0===n?void 0:n.toUpperCase();return t.includes(e)?e:null}())&&void 0!==S?S:"FR"}const E=d.dataset.mode;if(E)j="prod"===E?"https://www.monrendezvousveto.".concat(L):"https://recette.monrendezvousveto.".concat(L);else if(o(y.baseURL))j=o(y.baseURL);else if(s)try{const t=new URL(s).origin;t.includes("widget.monrendezvousveto")||(j=t)}catch(t){}j||(j="https://www.monrendezvousveto.".concat(L)),console.log("current script",j),console.log("current country",b),i.checkAnalytics();const q="\n    <head>\n        <script>\n            (function(h,o,t,j,a,r){\n                h.hj=h.hj||function(){(h.hj.q=h.hj.q||[]).push(arguments)};\n                h._hjSettings={hjid:2072395,hjsv:6};\n                a=o.getElementsByTagName('head')[0];\n                r=o.createElement('script');r.async=1;\n                r.src=t+h._hjSettings.hjid+j+h._hjSettings.hjsv;\n                a.appendChild(r);\n            })(window,document,'https://static.hotjar.com/c/hotjar-','.js?sv=');\n        <\/script>\n    </head>\n    <body class=\"widget-mrdvv\">\n        <div id=\"vetowidget\"></div>\n        <script>\n        window.currentLocale = \"".concat(f,'";\n        window.fallbackLocale = "').concat("fr",'";\n        const globalVars = {\n            clinic: ').concat(c(w),",\n            url: ").concat(c(j),",\n            colors: {\n                primary: ").concat(c(u),",\n                secondary: ").concat(c(h),"\n            },\n            customer: ").concat(c(p),",\n            isCHV: ").concat(!!g,",\n            confirmUrl: ").concat(c(m),",\n            country: ").concat(c(b),"\n        };\n        <\/script>\n        ").concat("",'\n        <script src="').concat(j,'/bundles/app/assets/js/new/widget.entry.js"><\/script>\n    </body>\n    ');v.contentWindow.document.open(),v.contentWindow.document.write(q),v.contentWindow.document.close(),v.addEventListener("load",(()=>{r.initElements({iframe:v})}))}({currentScript:s})})),window.addEventListener("message",(n=>{n.data&&n.data.id&&t&&n.source===t.contentWindow&&("ar_redirect"===n.data.id&&a(n.data.url)&&(window.location=n.data.url),"forgotten_redirect"===n.data.id&&a(n.data.url)&&window.open(n.data.url,"blank"),"scroll"===n.data.id&&i.scrollBackToTop(),"event"===n.data.id&&n.data.event&&i.handleEvent(n.data.event))}))}()}();