function Xenioo(n,t){return xenioowebchat.Start(n,t),xenioowebchat}var xenioowebchat=function(){function vo(){var t;if(n.chatareaid){if(t=document.getElementById(n.chatareaid),!t)return}else if(t=document.getElementById("xenioo-conversation-body"),!t)return;n.userid=null;t.innerHTML="";nr()}function yo(n,t){var r=document.getElementById("xenioo-container"),i;return r&&r.remove(),i=document.getElementById("xenioo-chat-widget"),i&&i.remove(),ir=!1,hr(n,t)}function hr(t,i){if(!ir){if(lo=t,ir=!0,ts(),nf=window.navigator.maxTouchPoints>0||window.navigator.msMaxTouchPoints>0||"ontouchstart"in document.documentElement||window.DocumentTouch&&document instanceof DocumentTouch,bt=!1,(/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|ipad|iris|kindle|Android|Silk|lge |maemo|midp|mmp|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows (ce|phone)|xda|xiino/i.test(navigator.userAgent)||/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i.test(navigator.userAgent.substr(0,4)))&&(bt=!0),i&&i.root&&(gt=i.root),i&&i.chid&&(fu=!0),t.indexOf("PREVIEW")!=-1)return sf(t,i),n.preview=!0,this;bc();t=go(t);var r=new XMLHttpRequest,u=this;return r.onreadystatechange=function(){if(r.readyState==4){if(!r.response||r.response=="null")return console.log("%cThis Xenioo chatbot is not correctly configured. The chatbot is not published or the current domain is not whitelisted. Please review your settings or contact Xenioo support.","font-size:18px;color:red;background:yellow"),i&&i.loadError&&i.loadError(""),this;if(r.status==401)return console.log("%cThis Xenioo chatbot is not correctly configured. Server response was: "+r.response,"font-size:18px;color:red;background:yellow"),i&&i.loadError&&i.loadError(r.response),this;u.config=JSON.parse(r.response);i&&i.loadConfigCompleted&&i.loadConfigCompleted(u.config);var n=JSON.parse(r.response);n.avatarontop=!0;n.createbutton=!0;n.createarea=!0;n.enablesounds=!0;n.forceXeniooBrand=!1;n.nocounter=!1;n.buttonanimation=function(){ks(s,at)};n.replyFn=null;n.speakerenabled=!1;n.onChatClose=function(){};n.onChatShow=function(){};n.onChatHide=function(){};n.onDataConnection=function(){};n.onItemRender=function(){};n.onElementRender=function(){};n.onButtonClick=function(){};n.onInit=function(){};n.onReady=function(){};n.onUserSays=function(){};n.onWidgetClick=function(){};n.onChatInteractionStarted=function(){};n.onChatInteractionCompleted=function(){};n.onFloatingAreaRender=function(){};n.onFloatingAreaOpened=function(){};n.onFloatingAreaClosed=function(){};n.onVoiceConfigured=function(){};n.onDestroy=function(){};n.onCalloutDisplay=function(){};n.historymode=0;n.viewmode=0;n.enableautoscrolldown=!0;i&&ns(n,i);n.displaymode||(n.displaymode=so);n.historystartpos||(n.historystartpos=ho);n.readinterval&&(ur=ft=n.readinterval);n.autoscrollwelcomemsg==!1&&(sr=!0);sf(n.Id,{id:n.Id,shid:n.shid,viewmode:n.viewmode,userid:n.userid,chid:n.chid,prid:n.prid,displaymode:n.displaymode,historystartpos:n.historystartpos,name:n.Name,createbutton:n.createbutton,createarea:n.createarea,preview:n.Preview,style:n.Style,additionalstyle:n.AdditionalStyle,appeardelay:n.AppearDelay,behaviour:n.behaviour,avatarinline:n.avatarinline,avatarinlinepos:n.avatarinlinepos,forceXeniooBrand:n.forceXeniooBrand,nocounter:n.nocounter,avatarontop:n.avatarontop,avatar:n.Avatar,UserAvatar:n.UserAvatar,frame:n.Frame,placeholder:n.TextPlaceholder,buttontext:n.SendText,level:n.Level,buttonanimation:n.buttonanimation,enablesounds:n.EnableSounds,rewindchat:n.RewindChat,startopen:n.startopen,chatwidgetanchorid:n.chatwidgetanchorid,chatareaid:n.chatareaid,chattextid:n.chattextid,sendbuttonid:n.sendbuttonid,backcolor:n.BackgroundColor,forecolor:n.ForegroundColor,floatcolor:n.FloatingButtonsColor,Buttons:n.Buttons,subtitle:n.Subtitle,replyFn:n.replyFn,contexttype:n.ContextType,autoopencontext:n.AutoOpenContext,autoclosecontext:n.AutoCloseContext,contextitle:n.ContextTitle,contextheader:n.ContextHeaderText,autoopenchatdelay:n.ChatDelay,autoopenchatmobiledisabled:n.AutoDisplayMobileDisabled,variables:n.variables,tags:n.tags,historymode:n.historymode,waitforwidgetclick:n.WaitForWidgetClick,showbubble:n.CalloutBubble,calloutmode:n.CalloutBubbleMode,hidetimepart:n.hidetimepart,landingpage:n.landingpage,appendchattoid:n.appendchattoid,displayuseravatar:n.displayuseravatar,messagedatetemplate:n.messagedatetemplate,enabletextreader:n.enabletextreader,enablevoicerecording:n.enablevoicerecording,closeifhistory:n.closeifhistory,closeifknown:n.closeifknown,readerperson:n.readerperson,readerlanguage:n.readerlanguage,speakerenabled:n.speakerenabled,disabledchathidessend:n.disabledchathidessend,autoscrollwelcomemsg:n.autoscrollwelcomemsg,enablebubblescripting:n.enablebubblescripting,onChatShow:n.onChatShow,onChatHide:n.onChatHide,onChatClose:n.onChatClose,onDataConnection:n.onDataConnection,onItemRender:n.onItemRender,onElementRender:n.onElementRender,onButtonClick:n.onButtonClick,onInit:n.onInit,onReady:n.onReady,onUserSays:n.onUserSays,onWidgetClick:n.onWidgetClick,onChatInteractionStarted:n.onChatInteractionStarted,onChatInteractionCompleted:n.onChatInteractionCompleted,onVoiceConfigured:n.onVoiceConfigured,onDestroy:n.onDestroy,onCalloutDisplay:n.onCalloutDisplay,onFloatingAreaRender:n.onFloatingAreaRender,onFloatingAreaOpened:n.onFloatingAreaOpened,onFloatingAreaClosed:n.onFloatingAreaClosed,loadCompleted:n.loadCompleted,loadConfigCompleted:n.loadConfigCompleted,loadError:n.loadError,cookieDomain:n.cookieDomain,replywindow:n.replywindow,enableautoscrolldown:n.enableautoscrolldown})}},r.open("GET",k+"/webapi/endpoint/chat/"+t,!0),wr(r),r.send(),this}}function po(){var r=document.getElementById("xenioowebchatscript"),n,t,i;if(r){var e=r.src.replace(/^[^\?]+\??/,""),u=e.split("&"),f={};for(n=0;n0){for(r="?",n.landingUrl.indexOf("?")>0&&(r="&"),t=0;t=0?(k="http://"+n,gt="http://"+n,k.indexOf("8")<0&&(k="http://"+n+":8005",gt="http://"+n+":8005")):(k="https://"+n,gt="https://"+n)):n.indexOf("-")>=0&&n.indexOf("linux")<0?(k="https://"+n+".ngrok.io",gt="https://"+n+".ngrok.io"):(k="https://"+n+".xenioo.com",gt="https://"+n+".xenioo.com");dr="plugin";return}}function is(n){return n.length>=12&&n.indexOf(".")<0}function rs(n){var t=n.replace("_","/");t=t.replace("-","+");t=t.replace("*","=");t=t.replace("*","=");try{return atob(t)}catch{return n}}function sf(t,i){if(n=i,n.onInit)n.onInit(n);n.variables!=null&&n.variables||(n.variables=[]);var o=n.variables.find(n=>n.Name=="user_id");o!=null&&rt(o.Value)&&(n.userid=o.Value);n.tags!=null&&n.tags||(n.tags=[]);nh(t);us(function(){if(fs(),kr="xenioo-"+n.id,n.userid||(n.userid=be(kr)),ac(),vc(),u&&n.chatwidgetanchorid){var t=window.document.getElementById(n.chatwidgetanchorid);u.style.position="absolute";t.appendChild(u)}r==null&&n.chatareaid&&(r=window.document.getElementById(n.chatareaid),r.setAttribute("class","xenioo-conversation-custom"),n.avatarinline&&r.classList.add("x-avatarinline"),r.innerHTML="");e==null&&n.chattextid&&(e=window.document.getElementById(n.chattextid));ut==null&&n.sendbuttonid&&(ut=window.document.getElementById(n.sendbuttonid));n.replyFn!=null&&(bi=n.replyFn,di=function(){},hi=function(){},f=function(){},ki=function(){},pu=function(){});n.onReady&&n.onReady();setTimeout(function(){nr()},n.appeardelay*1e3);ef=n.enableautoscrolldown})}function us(t){c(n.additionalstyle)?n.style.indexOf("://")!=-1?ri(n.style,function(){ri(w+"/plugin/fonts.css",t)}):ri(w+"/plugin/"+n.style+".css",function(){ri(w+"/plugin/fonts.css",t)}):ri(w+"/"+dr+"/"+n.style+".css",function(){ri(n.additionalstyle,function(){ri(w+"/plugin/fonts.css",t)})})}function fs(){if(n.createbutton)es(),cf(),window.document.body.appendChild(at);else{cf();lf(document.body);return}}function es(){var t,i;u=document.createElement("div");u.setAttribute("id","xenioo-chat-widget");u.setAttribute("class","xenioo-chat-widget");u.style.opacity=0;t=document.createElement("div");t.setAttribute("id","xenioo-chat-widget-button");t.setAttribute("class","xenioo-chat-widget-button");t.setAttribute("alt","Chatbot "+n.name+" button");t.style.backgroundColor=n.backcolor;t.style.color=n.forecolor;t.style.backgroundImage="url('"+lr();+ "')";t.style.backgroundSize="cover";u.appendChild(t);n.nocounter||(i=document.createElement("div"),i.setAttribute("id","xenioo-chat-widget-counter"),i.setAttribute("class","xenioo-chat-widget-counter"),i.setAttribute("alt","Chatbot messages counter"),u.appendChild(i),dt=i);at=u;t.onclick=function(){hf(!1)};wi(0)}function hf(t){if(gu=!0,v!=null&&oe(),n.onWidgetClick)n.onWidgetClick(t);if(n.waitforwidgetclick)yt(),nr();else{if(!rf)return;yt()}}function cf(){var r;if(n.createarea){a=document.createElement("div");a.setAttribute("id","xenioo-container");a.classList.add("xenioo-container");a.classList.add("xenioo-chat-reset");n.landingpage&&a.classList.add("xenioo-landing");n.landingpage&&a.classList.add("xenioo-composer-detached");s=document.createElement("div");s.setAttribute("id","xenioo-conversation");s.setAttribute("class","xenioo-conversation");s.classList.add("xenioo-conversation-right");n.displaymode==vt&&s.classList.add("xenioo-conversation-panel");n.frame&&n.frame!="xenioo-frame.jpg"&&(s.style.backgroundImage="url('"+gs(n.frame));+ "')";var u=os(),i=ys(),t=p=ss();n.landingpage||s.appendChild(u);s.appendChild(i);n.landingpage?(t.style.opacity=0,i.appendChild(t)):s.appendChild(t);a.appendChild(s);n.landingpage&&n.appendchattoid?(r=window.document.getElementById(n.appendchattoid),r.appendChild(a)):window.document.body.appendChild(a);ro(n.speakerenabled)}}function os(){var t=document.createElement("div"),i,e,r,u,f,o,s;return t.setAttribute("id","xenioo-conversation-header"),t.setAttribute("class","xenioo-conversation-header"),n.avatarinline&&t.classList.add("x-avatarinline"),t.style.backgroundColor=n.backcolor,t.style.color=n.forecolor,i=document.createElement("div"),i.setAttribute("id","xenioo-conversation-header-title-container"),i.setAttribute("class","xenioo-conversation-header-title-container"),t.appendChild(i),!n.avatarinline&&n.avatarontop&&(e=document.createElement("div"),e.setAttribute("id","xenioo-conversation-header-avatar-container"),e.setAttribute("class","xenioo-conversation-header-avatar-container"),t.appendChild(e)),r=document.createElement("div"),r.setAttribute("id","xenioo-conversation-close-button"),r.setAttribute("class","xenioo-conversation-close-button"),r.onclick=function(){n.onChatClose&&n.onChatClose();yt()},t.appendChild(r),u=document.createElement("div"),u.setAttribute("id","xenioo-conversation-header-title"),u.setAttribute("class","xenioo-conversation-header-title"),u.style.color=n.forecolor,u.innerHTML=n.name,f=document.createElement("div"),f.setAttribute("id","xenioo-conversation-header-subtitle"),f.setAttribute("class","xenioo-conversation-header-subtitle"),f.style.color=n.forecolor,f.innerHTML=n.subtitle,i.appendChild(u),i.appendChild(f),!n.avatarinline&&n.avatarontop&&(o=document.createElement("img"),o.setAttribute("id","xenioo-conversation-header-avatar-image"),o.setAttribute("class","xenioo-conversation-header-avatar-image"),o.src=lr(),e.appendChild(o)),s=document.createElement("div"),s.className="xenioo-close-button-image",s.style.backgroundColor=n.forecolor,r.appendChild(s),t}function ss(){var i=document.createElement("div"),u,r,f,o,s,h,t,c;return i.setAttribute("id","xenioo-conversation-composer"),i.setAttribute("class","xenioo-conversation-composer"),i.style.backgroundColor=n.backcolor,i.style.color=n.forecolor,(n.level=="1"||n.forceXeniooBrand)&&(u=document.createElement("div"),u.setAttribute("id","xenioo-conversation-poweredby"),u.setAttribute("class","xenioo-conversation-poweredby"),i.appendChild(u)),r=document.createElement("div"),r.setAttribute("class","xenioo-conversation-composer-container"),i.appendChild(r),cs(r),n.preview||ls(),ei=document.createElement("div"),ei.setAttribute("id","xenioo-conversation-composer-buttonscontainer"),ei.setAttribute("class","xenioo-conversation-composer-buttonscontainer"),r.appendChild(ei),f=document.createElement("div"),f.setAttribute("id","xenioo-conversation-composer-textarea"),f.setAttribute("class","xenioo-conversation-composer-textarea"),r.appendChild(f),o=document.createElement("div"),o.setAttribute("id","xenioo-conversation-composer-sendbutton"),o.setAttribute("class","xenioo-conversation-composer-sendbutton"),r.appendChild(o),(n.level=="1"||n.forceXeniooBrand)&&(s=document.createElement("div"),s.setAttribute("id","xenioo-conversation-poweredby-text"),s.setAttribute("class","xenioo-conversation-poweredby-text"),s.innerHTML="We're<\/path><\/path><\/g><\/svg><\/i>by Xenioo<\/a>",u.appendChild(s)),h=document.createElement("div"),h.setAttribute("id","xenioo-conversation-textarea"),h.setAttribute("class","xenioo-conversation-textarea"),t=document.createElement("textarea"),t.placeholder=n.placeholder,t.setAttribute("id","xenioo-user-chat-textarea-control"),t.onkeydown=function(n){if(n.keyCode==13)return kt(n.currentTarget.value.trim()),n.currentTarget.value="",n.preventDefault(),!1},f.appendChild(h),h.appendChild(t),c=document.createElement("button"),c.className="xenioo-send-button-image",c.style.backgroundColor=n.forecolor,c.onclick=function(){var n="",i=document.getElementById("xenioo-hidtext");return i==null?n=t.value:(kt("<<__password__>>"+i.value.trim()),event.currentTarget.value="",event.preventDefault()),n&&n.trim().length>0&&(kt(n.trim()),t.value=""),!1},o.appendChild(c),lf(ei),rl(ei),e=t,i}function lf(t){var i=document.getElementById("xenioo-conversation-composer-buttonscontainer");if(i&&(t=i),hs(t),h=document.getElementById("xenioo-attachment"),h){h.style.display="none";return}h=document.createElement("button");h.id="xenioo-attachment";h.className="xenioo-attached-file-image";h.style.display="none";h.style.backgroundColor=n.forecolor;h.onclick=function(){af()};t.prepend(h)}function hs(n){fi=document.createElement("input");fi.type="file";fi.style.display="none";fi.onchange=function(n){hc(n.target.files[0])};n.appendChild(fi)}function af(){fi.click()}function cs(t){var i,r;n.Buttons&&n.Buttons.length>0&&(i=document.createElement("div"),i.setAttribute("id","xenioo-conversation-composer-menubutton"),i.setAttribute("class","xenioo-conversation-composer-menubutton xenioo-conversation-composer-menubutton-image"),i.style.backgroundColor=n.forecolor,t.appendChild(i),i.onclick=function(){si()},r=null,n.contexttype==1?as():t.appendChild(vs()))}function ls(){var i,t,f,r,u,e,o;a&&(i=document.createElement("div"),i.setAttribute("id","xenioo-floating-extra-content"),i.classList.add("xenioo-floating-context"),i.classList.add("xenioo-floating-extra-content-right"),n.displaymode==vt&&i.classList.add("xenioo-floating-extra-content-panel"),t=document.createElement("div"),t.setAttribute("id","xenioo-floating-context-header"),t.setAttribute("class","xenioo-floating-context-header"),t.style.backgroundColor=n.backcolor,t.style.color=n.forecolor,f=document.createElement("div"),f.setAttribute("id","xenioo-floating-extra-content-header-title-container"),f.setAttribute("class","xenioo-floating-context-header-title-container"),t.appendChild(f),r=document.createElement("div"),r.setAttribute("id","xenioo-floating-context-close-button"),r.setAttribute("class","xenioo-floating-context-close-button"),r.onclick=function(){yi()},t.appendChild(r),u=document.createElement("div"),u.setAttribute("id","xenioo-floating-extra-content-header-title"),u.setAttribute("class","xenioo-floating-context-header-title"),u.style.color=n.forecolor,u.innerHTML=n.contextitle,f.appendChild(u),e=document.createElement("div"),e.className="xenioo-close-button-image",e.style.backgroundColor=n.forecolor,r.appendChild(e),t.appendChild(r),i.appendChild(t),o=document.createElement("div"),o.setAttribute("id","xenioo-floating-extra-content-body"),o.setAttribute("class","xenioo-floating-extra-content-body"),i.appendChild(o),a.appendChild(i))}function as(){var i,t,e,r,u,h,f,o,c,s;if(a){for(i=document.createElement("div"),i.setAttribute("id","xenioo-floating-context"),i.classList.add("xenioo-floating-context"),i.classList.add("xenioo-floating-context-right"),t=document.createElement("div"),t.setAttribute("id","xenioo-floating-context-header"),t.setAttribute("class","xenioo-floating-context-header"),t.style.backgroundColor=n.backcolor,t.style.color=n.forecolor,e=document.createElement("div"),e.setAttribute("id","xenioo-floating-context-header-title-container"),e.setAttribute("class","xenioo-floating-context-header-title-container"),t.appendChild(e),r=document.createElement("div"),r.setAttribute("id","xenioo-floating-context-close-button"),r.setAttribute("class","xenioo-floating-context-close-button"),r.onclick=function(){si()},t.appendChild(r),u=document.createElement("div"),u.setAttribute("id","xenioo-floating-context-header-title"),u.setAttribute("class","xenioo-floating-context-header-title"),u.style.color=n.forecolor,u.innerHTML=n.contextitle,e.appendChild(u),h=document.createElement("div"),h.className="xenioo-close-button-image",h.style.backgroundColor=n.forecolor,r.appendChild(h),t.appendChild(r),i.appendChild(t),f=document.createElement("div"),f.setAttribute("id","xenioo-floating-context-body"),f.setAttribute("class","xenioo-floating-context-body"),i.appendChild(f),o=document.createElement("div"),o.setAttribute("id","xenioo-floating-context-body-header"),o.setAttribute("class","xenioo-floating-context-body-header"),o.innerHTML=n.contextheader,f.appendChild(o),c=0;c<\/path><\/g><\/svg>",u=document.createElement("span"),u.innerHTML=e,t.onclick=function(){si()},t.appendChild(u),i.appendChild(t),r=0;r0?(dt.innerHTML=n,dt.style.opacity=1):dt.style.opacity=0)}function nh(t){if(t&&!(t.indexOf("|")<0)){var i=t.split("|");return t=i[0],n.behaviour=i[1],n.preview=i[2]=="True",n.id=t,t}}function kt(n,t,i){c(n)&&(n=e.value,c(n))||e&&e.disabled||bf(n,t,i)}function ht(t,i){if(c(t)||t.indexOf("<<__password__>>")==0||!i&&n.enablebubblescripting)return t;var r=pt(t,"<","<");return r=pt(r,">",">"),r=pt(r,">",">"),r=pt(r,"'","'"),pt(r,'"',"”")}function bf(n,i,r){t()==ao&&rt(i)||(t()>")==0&&(i="******");c(i)&&(i="[data submitted]");u||(i=pc(i));var v="",y="",p="";if(n.displayuseravatar&&(e=bu("profile_pic"),e!=null&&e||(e=n.UserAvatar,e!=null&&e||(e="https://res.xenioo.com/plugin/user_avatar.png")),v="
",y="
<\/div>",p="u-bubble-with-avatar"),t()>o&&(i=="<command>"||i=="")&&r)if(h=kf(r.Command),h=="image")i="";else if(h=="location")if(h.indexOf("|")>0)s=r.Command.substring(9),s=s.substring(0,s.indexOf("|")),i="Show Location On Map<\/a>";else{var s=r.Command.substring(9),l=s.split(";"),a=l[2];a==""&&(a="Location");i=""+a+"<\/a>"}else h!=""&&(i=""+r.Command+"<\/a>");f(v+"
<\/div>
"+i+"<\/div><\/div>"+y);t()==o&&f("
<\/div>")}function kf(n){if(c(n))return"";if(n.indexOf("audio/ogg;")>0||n.indexOf("video/mp4")>0)return"audio";if(n.indexOf("application/pdf")>0)return"file";if(n.indexOf(".")<0)return"";if(n.indexOf("location|")==0||n.indexOf("position:")==0)return"location";var t=n.substr(n.lastIndexOf(".")+1);switch(t){case"jpg":case"jpeg":case"bmp":case"tiff":case"png":case"gif":return"image";case"mp4":case"mpeg":case"webm":return"video";case"mp3":case"ogg":case"oga":return"audio";case"db":case"pdf":case"dat":case"doc":case"ppt":case"xls":case"txt":case"log":case"zip":case"arj":case"rar":case"docx":case"pptx":case"xlsx":case"xenioo":return"file";case"html":return"html"}return""}function df(t){i(t.UserId)&&n.userid==null&&(n.userid=t.UserId,br(kr,n.userid,3650))}function bi(i,u){var s,c,l,h,o,y,v,a;if(i){if(d&&(or=r,r=document.createElement("div")),df(i),(ni==null||ni.length==0||t()ti&&(ti=i.I),s=i.Parts,s){if(typeof u=="undefined"&&(u=0),pe(i),u==0&&(ut&&(ut.disabled=i.ControlType==0&&!d),e&&(e.disabled=i.ControlType==0&&!d),n.landingpage&&p&&(p.style.opacity=i.ControlType==0?0:1),n.onChatInteractionStarted&&n.onChatInteractionStarted()),n.historystartpos!=co||n.chatstarted||(c=document.getElementById("xenioo-conversation-body"),c&&c!=null&&(n.chatstarted=!0,f("
<\/div>"),c.style.display="flex",c.style.flexDirection="column")),s.length==0&&n.preview){yu("Ouch!??<\/b>
Looks like this bot did not send any meaningful message during preview mode.
???Please check that all the interactions items are correctly configured.");yu("Do not despair!<\/b>
If you have troubles building your bot, please try checking out our tutorials!??
https://www.xenioo.com/tutorials/");yu("...Or not?<\/b>
If the last block was just ment to be an execution or data processing, this is fine :)");return}for(uh(i),l=null,h=u;h0&&!gr&&!d){(o.Type==25&&o.Data.ShowTypingIndicator||o.Type!=25)&&oh();setTimeout(function(){di(o,h,s);bi(i,h+1);h==s.length-1&&(wi(b),te(i,o))},o.TypeDelay);break}else di(o,h,s),h==s.length-1&&(wi(b),te(i,o))}d&&(or.insertBefore(r,or.firstChild),r=or);d||pu(r,1e3);l!=null&&t()==st&&(v=Math.abs(new Date-new Date(l))/36e5,v>n.replywindow?(a=document.getElementById("xenioo-outofwindow"),a.style.display="",document.getElementById("xenioo-chat-text").disabled=!0,document.getElementById("xenioo-chat-btn").disabled=!0,document.getElementById("xenioo-message-templates").disabled=!0,document.getElementById("xenioo-attachment").disabled=!0,document.getElementById("xenioo-operator-audio").disabled=!0,document.getElementById("xenioo-operator-attachment").disabled=!0,vi=!0):(a=document.getElementById("xenioo-outofwindow"),a.style.display="none",document.getElementById("xenioo-chat-text").disabled=!1,document.getElementById("xenioo-chat-btn").disabled=!1,document.getElementById("xenioo-message-templates").disabled=!1,document.getElementById("xenioo-attachment").disabled=!1,document.getElementById("xenioo-operator-audio").disabled=!1,document.getElementById("xenioo-operator-attachment").disabled=!1,vi=!1))}}}function uh(n){(n.L>0||n.FL>0)&&t()>o&&d&&dh("
Click here to load previous messages<\/div>")}function gf(){try{return window.localStorage}catch(n){return!1}}function fh(n){var t=document.getElementById("load_history");t.innerText="Please wait...";lt(null,"HISTORY_"+n,null)}function eh(n){if(!gf())return 1;var t=oo(""+n.Creation+"."+n.Text+"."+n.Command),i=window.localStorage.getItem(t);return i&&i!=null?0:(tr.push(t),1)}function ne(){if(gf()){for(var n=0;n<\/div>")}function te(i,u){i.Parts!=null&&i.Parts.length!=0&&(tt!=null&&(tt=null),t()==o&&ie(),!n.preview&&u&&u.Parts.length>0&&u.Parts[0].Data&&u.Parts[0].Data.RedirectToFloating||ps()||u.Type==19||hi(i),i.ControlType==1||t()==st?(ut&&(ut.disabled=vi),e!=null&&(e.disabled=vi),h&&t()==o&&(h.style.display="")):(ut&&(ut.disabled=!i.EnableUserChat),e&&(e.disabled=!i.EnableUserChat)),n.landingpage&&p&&(p.style.opacity=1),e&&!bt&&e.focus(),gr=!1,nu=!1,n.startopen&&(n.startopen=!1,yt()),n.disabledchathidessend&&p&&(i.EnableUserChat?(p.style.display="",r.style.bottom="58px"):(p.style.display="none",r.style.bottom="0px")),sr&&!n.autoscrollwelcomemsg&&(ff=!0),n.onChatInteractionCompleted&&n.onChatInteractionCompleted(),pi()&&ne())}function ie(){if(!io()&&n.enablesounds){rr==null&&(rr=new Audio("https://res.xenioo.com/plugin/bling.mp3"),rr.volume=.5);var t=rr.play();t!==undefined&&t.then(()=>{}).catch(()=>{})}}function hi(t,i){var u,o,e,s,f;(nu=!0,n.hidetimepart)||(o=new Date,u="",u=t.Parts&&t.Parts.length>0?""+t.Parts[t.Parts.length-1].Creation:""+t.Creation,u.indexOf(".")>0&&(u=u.substring(0,u.indexOf("."))),o=new Date(u),e=bu("timezone_offset"),e!=""&&e!=null&&e||(e="0"),s=Number(e)*36e5,o=new Date(o.getTime()+s),f=document.createElement("div"),f.setAttribute("id","x-message-time"),i?f.setAttribute("class","u-message-time"):f.setAttribute("class","x-message-time"),f.innerHTML=sh(o),r&&r.innerHTML.length>0&&(n.landingpage?r.insertBefore(f,p):r.appendChild(f)))}function sh(i){var r;n.messagedatetemplate||(n.messagedatetemplate="Sent hh:mm AMPM");t()>o&&n.messagedatetemplate.indexOf("{date}")<0&&(n.messagedatetemplate=pt(n.messagedatetemplate,"hh:"," {date} hh:"),n.messagedatetemplate=pt(n.messagedatetemplate,"HH:"," {date} HH:"));var s=i.getHours(),u=i.getMinutes(),f=i.getSeconds(),h="am",e=s;return e>12&&(e-=12,h="pm"),u=u<10?"0"+u:u,f=f<10?"0"+f:f,r=n.messagedatetemplate,r=r.replace("HH",s),r=r.replace("hh",e),r=r.replace("mm",u),r=r.replace("ss",f),r=r.replace("AMPM",h),i.getDate()==hu.getDate()&&i.getMonth()==hu.getMonth()&&i.getFullYear()==hu.getFullYear()?r.replace("{date} "," "):r.replace("{date} ",(i.getDate()<9?"0"+i.getDate():i.getDate())+"/"+(i.getMonth()+1<9?"0"+(i.getMonth()+1):i.getMonth()+1)+"/"+i.getFullYear()+" ")}function l(t){if(!n.avatarinline)return"";if(n.avatarinlinepos==0){if(t==0||t>0&&nu)return"
<\/div>"}else return au("xenioo-inline-avatar-image"),"
<\/div>";return""}function ii(){return"x-bubble-text"}function ki(){au("x-tempwait");au("x-form-wait-img")}function au(n){for(var t=document.getElementById(n);t!=null;)t.parentElement.removeChild(t),t=document.getElementById(n)}function di(i,r,u){var v,y,e,p,d,i,s,w,k,a;ki();e=g(ht(i.Text));i.Type!=1&&tt!=null&&(tt=null);i.SubType=="pw"?hh():ch();ku(i.SubType)?(ou=!0,h!=null&&(h.style.display="")):(ou=!1,h!=null&&(h.style.display="none"));r==0&&(li="");switch(i.Type){case 0:case 6:if(c(e)){b>0&&b--;break}v=linkify(e);y=i.Data&&i.Data.CssClass?gi(i.Data.CssClass):"";f("
"+l(r)+"
<\/div>
"+v+"<\/div><\/div><\/div>",null,i);n.calloutmode>0&&(n.calloutmode==2&&r==0||n.calloutmode==1&&r==u.length-1)&&ee(v);gc(i.Text);break;case 1:b>0&&b--;re(e,r,i);ui++;break;case 3:a="";i.Command&&(a=""+a+"<\/a>");f("
"+l(r)+"
"+a+"<\/div><\/div><\/div>",null,i);break;case 9:f("
"+l(r)+"
"+l(r)+"