document.addEventListener("DOMContentLoaded",(()=>{const n=document.bubbleSettings;n.disable_breathe=!0,n.phone_number="33766312556";let e="";n.show_mobile_only&&(e+="\n @media (min-width: 768px) {\n #OJIAJ978617_coco-body {\n display: none !important;\n }\n }\n ");const t="full-coco-left"===n.tooltip_position?"left: 15px; right: auto;":"right: 15px; left: auto;",o=n.custom_css||"",i=n.disable_breathe?"":"animation: breathe 2s infinite ease-in-out;";let a=document.getElementById("OJIAJ978617_coco-body");a||(a=document.createElement("div"),a.id="OJIAJ978617_coco-body",document.body.appendChild(a));const s=`\n \n\n
\n ${n.whatsapp_message}\n ×\n
\n
\n WhatsApp\n
1
\n
\n\n
\n
\n
\n
\n Profile\n ${n.shop_name}\n
\n
\n ${n.status}\n
\n
\n
×
\n
\n
\n
\n \n \n \n
\n \n \n
\n
\n `;if(a.innerHTML=s,e){const n=document.createElement("style");n.type="text/css",n.innerText=e,document.head.appendChild(n)}const d={cocoBody:a,chatWidget:document.getElementById("OJIAJ978617_chat-widget-container"),whatsappIcon:document.getElementById("OJIAJ978617_whatsapp-icon"),notificationBubble:document.getElementById("OJIAJ978617_notification-bubble"),closeChat:document.getElementById("OJIAJ978617_chat-widget-close"),sendMessageButton:document.getElementById("OJIAJ978617_chat-widget-send"),messageInput:document.querySelector("#OJIAJ978617_chat-widget-footer input"),chatMessages:document.getElementById("OJIAJ978617_chat-messages"),closeAllMessages:document.getElementById("OJIAJ978617_notification-bubble-close"),notificationText:document.getElementById("OJIAJ978617_notification-bubble-text"),headerChatBox:document.getElementById("OJIAJ978617_chat-widget-header"),cartDrawer:document.querySelector(".drawer.is-empty"),poweredBy:document.getElementById("OJIAJ978617_powered-by"),messageNotification:document.getElementById("OJIAJ978617_message-notification"),chatWidgetContent:document.getElementById("OJIAJ978617_chat-widget-content")};if(setTimeout((()=>{d.cocoBody.style.display="block"}),n.delay),d.cartDrawer){new MutationObserver((n=>{n.forEach((n=>{if("class"===n.attributeName){const n=d.cartDrawer.classList.contains("active");d.cocoBody.style.display=n?"none":"block"}}))})).observe(d.cartDrawer,{attributes:!0})}function c(e){let t=n.phone_number;n.is_relayed&&(e=`@[${n.relaying_slug_name}]\n${e}`,t=n.relaying_phone_number);const o=`https://api.whatsapp.com/send/?phone=${t}&text=${encodeURIComponent(e)}`;window.open(o,"_blank")}function r(){const e=document.createElement("div");e.textContent="...",e.className="typing-indicator",d.chatMessages.appendChild(e),setTimeout((()=>{d.chatMessages.removeChild(e),function(){const e=document.createElement("div");e.textContent=n.whatsapp_message_inside,e.className="welcome-message",d.chatMessages.appendChild(e)}()}),2e3)}function l(e=!1){"block"===d.chatWidget.style.display?function(e=!1){d.chatWidget.style.display="none",d.notificationBubble.style.display="flex",localStorage.removeItem("notificationBubbleHidden"),d.chatMessages.innerHTML="",u(),n.show_notification_bubble||(d.notificationBubble.style.display="none");e&&localStorage.setItem("keepClosed","true")}(e):(d.chatWidget.style.display="block",function(n=!1){d.notificationBubble.style.display="none",n&&localStorage.setItem("notificationBubbleHidden","true")}(),r(),b&&(clearInterval(b),d.notificationText.textContent=n.whatsapp_message,b=null))}const p=window.location.href,g=n.path_filter,h=!g||function(n,e){try{return new RegExp(e).test(n)}catch(n){return console.error("Invalid regex pattern:",e),!1}}(p,g);d.notificationText.addEventListener("click",(()=>l())),d.headerChatBox.addEventListener("click",(()=>l())),d.closeAllMessages.addEventListener("click",(()=>{n.show_notification_bubble=!1,localStorage.setItem("notificationBubbleHidden","true"),d.notificationBubble.style.display="none"})),d.sendMessageButton.addEventListener("click",(()=>{const n=d.messageInput.value.trim();n&&(c(n),d.messageInput.value="")})),d.messageInput.addEventListener("keypress",(n=>{"Enter"===n.key&&(n.preventDefault(),d.sendMessageButton.click())})),n.hide_coco_mention&&d.poweredBy&&(d.poweredBy.style.display="none"),n.show_notification_bubble||(d.notificationBubble.style.display="none"),d.chatWidgetContent.addEventListener("click",(n=>{if("BUTTON"===n.target.tagName){c(n.target.getAttribute("data-message"))}})),d.whatsappIcon.addEventListener("click",(()=>l()));let b=null;function u(){if(b)return;let e=1;const t=[n.whatsapp_message,n.button_one,n.button_two,n.button_three];b=setInterval((()=>{d.notificationText.textContent=t[e],e=(e+1)%t.length}),3500)}u(),h||(d.cocoBody.style.display="none",d.whatsappIcon.style.display="none",d.messageNotification&&(d.messageNotification.style.display="none"),d.notificationBubble.style.display="none")}));