import{d as t}from"./p-b3907b50.js";const e="lead-connecter-text-widget-prompt-dismissed";const n="lead-connecter-text-widget-input-values";const o="lead-connecter-text-widget-i18n-keys";const s="lead-connecter-live-widget-message-data";var a;(function(t){t[t["INIT"]=0]="INIT";t[t["IN_PROGRESS"]=1]="IN_PROGRESS";t[t["COMPLETED"]=2]="COMPLETED";t[t["ERROR"]=3]="ERROR"})(a||(a={}));var c;(function(t){t[t["NOT_VALIDATED"]=0]="NOT_VALIDATED";t[t["REQUIRED"]=1]="REQUIRED";t[t["INVALID"]=2]="INVALID";t[t["VALID"]=3]="VALID"})(c||(c={}));var i;(function(t){t["EMAIL_SMS_CHAT"]="emailChat";t["LIVE_CHAT"]="liveChat";t["WA_CHAT"]="waChat";t["LIVE_PLUS_EMAIL_CHAT"]="both"})(i||(i={}));var l;(function(t){t["FEEDBACK"]="feedback";t["CONTACT_DETAILS_REQUESTED"]="CONTACT_DETAILS_REQUESTED";t["USER_INACTIVITY"]="USER_INACTIVITY";t["VISITOR_INACTIVITY"]="VISITOR_INACTIVITY";t["ACKNOWLEDGEMENT"]="ACKNOWLEDGEMENT";t["MESSAGE"]="MESSAGE";t["TYPING_OFF"]="TYPING_OFF";t["TYPING_ON"]="TYPING_ON"})(l||(l={}));const r={NAME:{name:"name",type:"text",placeholder:"Name",label:"Name",isRequired:true},PHONE:{name:"phone",type:"text",placeholder:"Mobile Phone",label:"Mobile Phone",isRequired:true},EMAIL:{name:"email",type:"email",placeholder:"E-mail",label:"E-mail",isRequired:true},MESSAGE:{name:"message",type:"text",placeholder:"Message",label:"Message",isRequired:true}};const f="lc-captcha";const u={en:"en-us",de:"de",fr:"fr-fr",nl:"nl",nl_BE:"nl",hu:"hu",pt:"pt-pt",es:"es"};var d;(function(t){t["ChatWidget"]="chat_widget";t["WAChatWidget"]="whatsapp_chat_widget"})(d||(d={}));var h;(function(t){t["CONTACT_DETAILS_REQUESTED"]="CONTACT_DETAILS_REQUESTED"})(h||(h={}));const g={[h.CONTACT_DETAILS_REQUESTED]:"contact_details_requested"};const I="lc-chat-widget-enter-contact-details-msg";const p="G-1X0XQRMB4F";const m=function(t,e=localStorage){let n=e.getItem(t);if(n===null){n={}}else{try{n=JSON.parse(n)}catch(e){console.error("error reading local storage key:"+t);n={}}}return n};const w=function(t=86400,n=""){let o=true;let s=false;let a="";let c="";const i=m(n+e);if(i.hasOwnProperty("value")){if(i.value){const e=i.expires_at;const n=(new Date).getTime();if(e-n0){o=false}}}if(o){const t=v();if(!!t.name){s=true;a=t.name;try{c=a.split(" ")[0]}catch(t){console.warn(t)}}}return{showPrompt:o,isRevisit:s,userName:a,firstName:c}};const E=function(t=86400,n=""){const o=(new Date).getTime()+t*1e3;const s={value:true,expires_at:o};localStorage.setItem(n+e,JSON.stringify(s))};const S=function(t,e){let n=t;let o=false;if(!t||!window.libphonenumber){return{formattedNumber:n,phoneValid:o}}try{const s=window.libphonenumber.parsePhoneNumberFromString(t,e);if(s.country&&s.isValid()&&s.country!==e){n=s.formatInternational()}else if(s.country&&s.isValid()){n=s.formatNational()}else{n=t}o=s.isValid()}catch(t){console.error(t)}return{formattedNumber:n,phoneValid:o}};const N=function(t){return Boolean(/^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/.test(t))};const $=function(t,e,n,o,s=r){const a={};let i=true;const l=Object.keys(s);for(let e=0;e0){for(let t=0;t0){if(n>0&&n<10){o[r.NAME.name]=o[r.NAME.name]+e.outerHTML}if(n>10&&n<20){o[r.PHONE.name]=o[r.PHONE.name]+e.outerHTML}if(n>20&&n<30){o[r.EMAIL.name]=o[r.EMAIL.name]+e.outerHTML}if(n>30&&n<40){o[r.MESSAGE.name]=o[r.MESSAGE.name]+e.outerHTML}}}}}}if(a[s].hasOwnProperty("remove"))a[s].remove()}}return{openIcon:e,closeIcon:n,inputFields:o}}const O=function(t={},e){t=Object.assign({},t);delete t["status"];try{if(e.isValid)localStorage.setItem(n,JSON.stringify(t));else{const o=e.status;if(!!o){const e=Object.keys(o);for(let n=0;n0){return n}else{try{const n=t(`./assets/i18n/${e}.json`);const o=await fetch(n);if(o.ok){const t=await o.json();sessionStorage.setItem(`i18n.${e}`,JSON.stringify(t));return t}}catch(t){console.error(`Error loading locale: ${e}`,t)}}return{}}const R={langId:"en",localizedString:{}};function D(t,e){R.localizedString=t;R.langId=e}function C(t,e=t){return R.localizedString[t]||e}const M=["Interesting!","Yeah, I am also inline with you",`That'd be really cool, though I'm not sure what my schedule is...\n\n I'll update you shortly.`,"Are you sure ?","Perfect!","Ah sh**!","Well, that's Interesting","You are correct","OK Ok OK..."];const L=function(){const t=Math.floor(Math.random()*M.length);return M[t]};const V=function(t,e){if(e)localStorage.removeItem(`${t}_${e}_${s}`);localStorage.removeItem(`${t}_${s}`)};const P=function(t){let e=t.locationId;if(t.widgetId)e=`${t.locationId}_${t.widgetId}`;localStorage.setItem(`${e}_${s}`,JSON.stringify(t))};const j=function({locationId:t,widgetId:e,defaultWidget:n}){let o={};if(e){o=m(`${t}_${e}_${s}`)}if(Object.keys(o).length===0&&(n==null||!!n))o=m(`${t}_${s}`);return o};const x=function({locationId:t,message:e,widgetId:n,defaultWidget:o}){const s=j({locationId:t,widgetId:n,defaultWidget:o});const a={locationId:t,message:e,type:"Live_Chat"};if(n)a.chatWidgetId=n;if(s.hasOwnProperty("conversationId")){a.conversationId=s.conversationId}return a};const G=function({locationId:t,widgetId:e,defaultWidget:n,developerVersion:o}){const s=j({locationId:t,widgetId:e,defaultWidget:n});const a={"Content-Type":"application/json"};if(s.token){a["Authorization"]="Bearer "+s.token}if(o){a["developer_version"]=o}return a};const J=function(t,e=true){const n=new Date(t);let o=null;let s=n.getDate();try{const t=new Intl.DateTimeFormat("en",{month:"short"});o=t.format(new Date)}catch(t){console.log(t)}let a=n.getHours();let c=n.getMinutes();if(String(c).length<2){c=0+String(c)}return e&&o?`${s} ${o}, ${a}:${c}`:`${a}:${c}`};const W=t=>{var e;try{const n=(e=document.cookie.split("; ").find((e=>e.startsWith(`${t}=`))))===null||e===void 0?void 0:e.split("=")[1];return n}catch(t){console.warn(t)}};const q=(t,e)=>[...e];export{d as A,i as C,q as F,p as G,r as I,g as L,a as R,y as S,c as V,W as a,T as b,v as c,S as d,E as e,A as f,C as g,w as h,_ as i,f as j,j as k,P as l,I as m,J as n,l as o,L as p,G as q,V as r,O as s,x as t,D as u,$ as v}; //# sourceMappingURL=p-cb8d467d.js.map