'use strict';const chatOpener=document.querySelector("#chat-opener"),scripts={js:"/_file/santi/santi.min.js",css:"/_file/santi/santi.css"};if("undefined"===typeof sandiConfig)var sandiConfig={startQuestion:""};
const sandi={showWelcomeMessage(){let a=document.querySelector(".sandi-chat-opener__button-body");void 0!==a&&a.classList.add("welcome-message");a=document.querySelector(".sandi-welcome-message");void 0!==a&&(a.style.display="block")},hideWelcomeMessage(){let a=document.querySelector(".sandi-chat-opener__button-body");void 0!==a&&a.classList.remove("welcome-message");a=document.querySelector(".sandi-welcome-message");void 0!==a&&(a.style.display="none")},welcomeTimeout:setTimeout(()=>{sandi.showWelcomeMessage()},
5E3)};window.setInterval(function(){let a=document.getElementById("chat-opener");a.classList.add("shake-logo");setTimeout(function(){a.classList.remove("shake-logo")},2E3)},5E3);let scriptsLoaded=!1;
function loadScript(a){const c=a.match(/\.[0-9a-z]+$/i)[0];return new Promise(function(d){const e=document.querySelector("head");let b;".js"===c?(b=document.createElement("script"),b.type="text/javascript",b.src=a):".css"===c&&(b=document.createElement("link"),b.type="text/css",b.setAttribute("rel","stylesheet"),b.setAttribute("href",a));b.onload=function(){d()};e.appendChild(b)})}
function loadScriptsAndOpenChat(){scriptsLoaded?openChat():loadScript("//www.santander.pl/_file/santi/vue.min.js").then(()=>loadScript(scripts.js)).then(()=>loadScript(scripts.css)).then(()=>{openChat();scriptsLoaded=!0})}chatOpener.addEventListener("click",loadScriptsAndOpenChat);
function openChat(){clearTimeout(sandi.welcomeTimeout);const a=document.getElementById("sandi");if("none"===a.style.display){try{eventOnOpenChat()}catch(c){console.error(c)}a.style.display="block";sandi.hideWelcomeMessage();document.querySelector("#input").focus()}else{const c=document.getElementById("showRating");try{eventOnCloseChat()}catch(d){console.error(d)}app.answers=[];app.close=!1;document.cookie="chatseen\x3dtrue";closeDropDown();c.style.display="none";a.style.display="none";chatCloud.style.display=
"none"}}function eventOnCloseChat(){utag.link({event_category:"santi-fold-chat",event_action:getSiteTitle(),event_label:"Zamknij chatbota"})}function eventOnOpenChat(){utag.link({event_category:"santi-chat-opener",event_action:getSiteTitle(),event_label:"Otw\u00f3rz chatbota"})}function getSiteTitle(){return document.title.replace(" | Santander Bank Polska (dawniej BZWBK)","")};