1/** 2 * Integration, assono KI-Chatbot - v.1.7.0 | assono GmbH 3 * Default chatbot integration for any website 4 */ 5 6!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(t="undefined"!=typeof globalThis?globalThis:t||self).Chatbot=e()}(this,(function(){"use strict";var t=Object.prototype.toString,e=Array.isArray||function(e){return"[object Array]"===t.call(e)};function n(t){return"function"==typeof t}function o(t){return t.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g,"\\$&")}function a(t,e){return null!=t&&"object"==typeof t&&e in t}var s=RegExp.prototype.test;var i=/\S/;function r(t){return!function(t,e){return s.call(t,e)}(i,t)}var c={"&":"&","<":"<",">":">",'"':""","'":"'","/":"/","`":"`","=":"="};var d=/\s*/,l=/\s+/,u=/\s*=/,h=/\s*\}/,w=/#|\^|\/|>|\{|&|=|!/;function p(t){this.string=t,this.tail=t,this.pos=0}function b(t,e){this.view=t,this.cache={".":this.view},this.parent=e}function f(){this.templateCache={_cache:{},set:function(t,e){this._cache[t]=e},get:function(t){return this._cache[t]},clear:function(){this._cache={}}}}p.prototype.eos=function(){return""===this.tail},p.prototype.scan=function(t){var e=this.tail.match(t);if(!e||0!==e.index)return"";var n=e[0];return this.tail=this.tail.substring(n.length),this.pos+=n.length,n},p.prototype.scanUntil=function(t){var e,n=this.tail.search(t);switch(n){case-1:e=this.tail,this.tail="";break;case 0:e="";break;default:e=this.tail.substring(0,n),this.tail=this.tail.substring(n)}return this.pos+=e.length,e},b.prototype.push=function(t){return new b(t,this)},b.prototype.lookup=function(t){var e,o,s,i=this.cache;if(i.hasOwnProperty(t))e=i[t];else{for(var r,c,d,l=this,u=!1;l;){if(t.indexOf(".")>0)for(r=l.view,c=t.split("."),d=0;null!=r&&d<c.length;)d===c.length-1&&(u=a(r,c[d])||(o=r,s=c[d],null!=o&&"object"!=typeof o&&o.hasOwnProperty&&o.hasOwnProperty(s))),r=r[c[d++]];else r=l.view[t],u=a(l.view,t);if(u){e=r;break}l=l.parent}i[t]=e}return n(e)&&(e=e.call(this.view)),e},f.prototype.clearCache=function(){void 0!==this.templateCache&&this.templateCache.clear()},f.prototype.parse=function(t,n){var a=this.templateCache,s=t+":"+(n||g.tags).join(":"),i=void 0!==a,c=i?a.get(s):void 0;return null==c&&(c=function(t,n){if(!t)return[];var a,s,i,c=!1,b=[],f=[],m=[],v=!1,y=!1,_="",C=0;function A(){if(v&&!y)for(;m.length;)delete f[m.pop()];else m=[];v=!1,y=!1}function L(t){if("string"==typeof t&&(t=t.split(l,2)),!e(t)||2!==t.length)throw new Error("Invalid tags: "+t);a=new RegExp(o(t[0])+"\\s*"),s=new RegExp("\\s*"+o(t[1])),i=new RegExp("\\s*"+o("}"+t[1]))}L(n||g.tags);for(var T,E,x,S,I,M,k=new p(t);!k.eos();){if(T=k.pos,x=k.scanUntil(a))for(var O=0,P=x.length;O<P;++O)r(S=x.charAt(O))?(m.push(f.length),_+=S):(y=!0,c=!0,_+=" "),f.push(["text",S,T,T+1]),T+=1,"\n"===S&&(A(),_="",C=0,c=!1);if(!k.scan(a))break;if(v=!0,E=k.scan(w)||"name",k.scan(d),"="===E?(x=k.scanUntil(u),k.scan(u),k.scanUntil(s)):"{"===E?(x=k.scanUntil(i),k.scan(h),k.scanUntil(s),E="&"):x=k.scanUntil(s),!k.scan(s))throw new Error("Unclosed tag at "+k.pos);if(I=">"==E?[E,x,T,k.pos,_,C,c]:[E,x,T,k.pos],C++,f.push(I),"#"===E||"^"===E)b.push(I);else if("/"===E){if(!(M=b.pop()))throw new Error('Unopened section "'+x+'" at '+T);if(M[1]!==x)throw new Error('Unclosed section "'+M[1]+'" at '+T)}else"name"===E||"{"===E||"&"===E?y=!0:"="===E&&L(x)}if(A(),M=b.pop())throw new Error('Unclosed section "'+M[1]+'" at '+k.pos);return function(t){for(var e,n=[],o=n,a=[],s=0,i=t.length;s<i;++s)switch((e=t[s])[0]){case"#":case"^":o.push(e),a.push(e),o=e[4]=[];break;case"/":a.pop()[5]=e[2],o=a.length>0?a[a.length-1][4]:n;break;default:o.push(e)}return n}(function(t){for(var e,n,o=[],a=0,s=t.length;a<s;++a)(e=t[a])&&("text"===e[0]&&n&&"text"===n[0]?(n[1]+=e[1],n[3]=e[3]):(o.push(e),n=e));return o}(f))}(t,n),i&&a.set(s,c)),c},f.prototype.render=function(t,e,n,o){var a=this.getConfigTags(o),s=this.parse(t,a),i=e instanceof b?e:new b(e,void 0);return this.renderTokens(s,i,n,t,o)},f.prototype.renderTokens=function(t,e,n,o,a){for(var s,i,r,c="",d=0,l=t.length;d<l;++d)r=void 0,"#"===(i=(s=t[d])[0])?r=this.renderSection(s,e,n,o,a):"^"===i?r=this.renderInverted(s,e,n,o,a):">"===i?r=this.renderPartial(s,e,n,a):"&"===i?r=this.unescapedValue(s,e):"name"===i?r=this.escapedValue(s,e,a):"text"===i&&(r=this.rawValue(s)),void 0!==r&&(c+=r);return c},f.prototype.renderSection=function(t,o,a,s,i){var r=this,c="",d=o.lookup(t[1]);if(d){if(e(d))for(var l=0,u=d.length;l<u;++l)c+=this.renderTokens(t[4],o.push(d[l]),a,s,i);else if("object"==typeof d||"string"==typeof d||"number"==typeof d)c+=this.renderTokens(t[4],o.push(d),a,s,i);else if(n(d)){if("string"!=typeof s)throw new Error("Cannot use higher-order sections without the original template");
6null!=(d=d.call(o.view,s.slice(t[3],t[5]),(function(t){return r.render(t,o,a,i)})))&&(c+=d)}else c+=this.renderTokens(t[4],o,a,s,i);return c}},f.prototype.renderInverted=function(t,n,o,a,s){var i=n.lookup(t[1]);if(!i||e(i)&&0===i.length)return this.renderTokens(t[4],n,o,a,s)},f.prototype.indentPartial=function(t,e,n){for(var o=e.replace(/[^ \t]/g,""),a=t.split("\n"),s=0;s<a.length;s++)a[s].length&&(s>0||!n)&&(a[s]=o+a[s]);return a.join("\n")},f.prototype.renderPartial=function(t,e,o,a){if(o){var s=this.getConfigTags(a),i=n(o)?o(t[1]):o[t[1]];if(null!=i){var r=t[6],c=t[5],d=t[4],l=i;0==c&&d&&(l=this.indentPartial(i,d,r));var u=this.parse(l,s);return this.renderTokens(u,e,o,l,a)}}},f.prototype.unescapedValue=function(t,e){var n=e.lookup(t[1]);if(null!=n)return n},f.prototype.escapedValue=function(t,e,n){var o=this.getConfigEscape(n)||g.escape,a=e.lookup(t[1]);if(null!=a)return"number"==typeof a&&o===g.escape?String(a):o(a)},f.prototype.rawValue=function(t){return t[1]},f.prototype.getConfigTags=function(t){return e(t)?t:t&&"object"==typeof t?t.tags:void 0},f.prototype.getConfigEscape=function(t){return t&&"object"==typeof t&&!e(t)?t.escape:void 0};var g={name:"mustache.js",version:"4.2.0",tags:["{{","}}"],clearCache:void 0,escape:void 0,parse:void 0,render:void 0,Scanner:void 0,Context:void 0,Writer:void 0,set templateCache(t){m.templateCache=t},get templateCache(){return m.templateCache}},m=new f;g.clearCache=function(){return m.clearCache()},g.parse=function(t,e){return m.parse(t,e)},g.render=function(t,n,o,a){if("string"!=typeof t)throw new TypeError('Invalid template! Template should be a "string" but "'+((e(s=t)?"array":typeof s)+'" was given as the first argument for mustache#render(template, view, partials)'));var s;return m.render(t,n,o,a)},g.escape=function(t){return String(t).replace(/[&<>"'`=\/]/g,(function(t){return c[t]}))},g.Scanner=p,g.Context=b,g.Writer=f;let v={el:null,windowSrc:"",windowWidth:null,windowHeight:null,windowIsResizable:!0,windowContainerTitle:"Geöffnetes Fenster",windowTitle:"Chatbot",windowMatchButtonImage:!0,windowGreeting:null,windowPreferredLanguage:"",windowTheme:null,windowConsentYoutube:!0,windowConsentGoogleMaps:!0,windowEnableTrackingEvents:!1,windowShowMenubar:!0,windowChannel:null,button:!0,buttonText:"",buttonAriaLabel:"",buttonMessages:[],buttonImageSrc:"",buttonImageAlt:"",buttonHasBadge:!1,buttonIsAnimated:!1,buttonIsReversed:!1,buttonUseServerConfig:!1,buttonContainerAriaLabel:"Chatbot für Fragen"};return function(t){let e={parent:null,window:null,iframe:null,button:null},n={};for(let e in v)n[e]=t&&e in t?t[e]:v[e];let o={x:0,y:0,width:0,height:0,isActive:!1,isLeft:!1,iRight:!1,isTop:!1,start:t=>{if(!this.isOpen)return;o.isActive=!0,t.preventDefault(),e.iframe.style.pointerEvents="none",o.isLeft=t.target.className.includes("-left"),o.isRight=t.target.className.includes("-right"),o.isTop=t.target.className.includes("-top"),o.x=t.clientX,o.y=t.clientY;let n=window.getComputedStyle(e.window);o.width=parseInt(n.width,10),o.height=parseInt(n.height,10),document.addEventListener("mousemove",o.move),document.addEventListener("mouseup",o.end)},move:t=>{let n=t.clientX-o.x,a=t.clientY-o.y;o.isLeft&&(e.window.style.maxWidth=o.width+-1*n+"px"),o.isRight&&(e.window.style.maxWidth=o.width+n+"px"),o.isTop&&(e.window.style.maxHeight=o.height+-1*a+"px")},end:()=>{o.isActive=!1,document.removeEventListener("mousemove",o.move),document.removeEventListener("mouseup",o.end),e.iframe.style.removeProperty("pointer-events")}};this.isOpen=!1,this.open=function(t){e.window&&(e.window.classList.add("assono-chatbot-window--open"),e.window.classList.remove("assono-chatbot-window--closed"),e.window.setAttribute("role","dialog"),e.window.setAttribute("aria-modal","true"),e.window.setAttribute("aria-title",n.windowContainerTitle)),e.iframe&&(e.iframe.style.removeProperty("display"),e.iframe.hasAttribute("data-src")?(e.iframe.setAttribute("src",e.iframe.getAttribute("data-src")),e.iframe.removeAttribute("data-src"),e.iframe.contentWindow.focus(),window.addEventListener("message",(n=>{"CHATBOT_WINDOW_LOADED"!==n.data&&"CHAT_WINDOW_LOADED"!==n.data||(this.sendUserMessageToChat(t),e.iframe.contentWindow.postMessage("focusTextArea","*"))}))):(e.iframe.contentWindow.focus(),e.iframe.contentWindow.postMessage("focusTextArea","*"),this.sendUserMessageToChat(t)),window.visualVie
6wport.addEventListener("resize",(()=>{const t={name:"innerHeightObject",innerHeight:window.visualViewport.height};e.iframe.contentWindow.postMessage(t,"*")}))),e.button&&(e.button.classList.add("assono-chatbot-button--closed"),e.button.classList.remove("assono-chatbot-button--open"),e.button.classList.remove("assono-chatbot-button--animated"),e.button.setAttribute("disabled","")),this.isOpen=!0,this.emit("open")},this.close=function(){e.window&&(e.window.classList.add("assono-chatbot-window--closed"),e.window.classList.remove("assono-chatbot-window--open"),e.window.removeAttribute("role"),e.window.removeAttribute("aria-modal"),e.window.removeAttribute("aria-title")),e.iframe&&!window.matchMedia("preferes-reduced-media: no-preference")&&(e.iframe.style.display="none"),e.button&&(e.button.classList.add("assono-chatbot-button--open"),e.button.classList.remove("assono-chatbot-button--closed"),e.button.classList.add("assono-chatbot-button--used"),e.button.removeAttribute("disabled"),e.button.focus()),o.isActive&&o.end(),this.isOpen=!1,this.emit("close")},this.exportMessages=function(){e.iframe&&this.isOpen&&e.iframe.contentWindow.postMessage("EXPORT_CHAT","*")},this.openFeedbackOverlay=function(){e.iframe&&this.isOpen&&e.iframe.contentWindow.postMessage("OPEN_FEEDBACK_OVERLAY","*")},this.sendUserMessageToChat=function(t){t&&"string"==typeof t&&e.iframe.contentWindow.postMessage({userMessageChatInput:t},"*")};let a=[];this.on=function(t,e){"function"==typeof e&&t&&a.push({name:t,callback:e})},this.emit=function(t,e){if(t){e=Array.isArray(e)?e:[];for(let n=0;n<a.length;n++)a[n].name===t&&a[n].callback.call(this,...e)}};let s=()=>{let t=new URL(n.windowSrc),a=!1;if(Array.isArray(n.buttonImageSrc)&&n.buttonImageSrc.length>0&&(a=Math.floor(Math.random()*n.buttonImageSrc.length),n.buttonImageSrc=n.buttonImageSrc[a]),!1!==a&&n.windowMatchButtonImage&&t.searchParams.append("avatar",a),"number"==typeof n.windowGreeting&&n.windowGreeting>=0?t.searchParams.append("greeting",n.windowGreeting):!1===n.windowGreeting&&t.searchParams.append("greeting","false"),n.windowPreferredLanguage&&"string"==typeof n.windowPreferredLanguage&&t.searchParams.append("language",n.windowPreferredLanguage.replace(/\s+/g,"")),"number"==typeof n.windowTheme&&n.windowTheme>=0&&t.searchParams.append("theme",n.windowTheme),n.windowConsentYoutube||t.searchParams.append("consent-youtube","false"),n.windowConsentGoogleMaps||t.searchParams.append("consent-google-maps","false"),n.windowEnableTrackingEvents&&t.searchParams.append("enable-tracking-events","true"),n.windowShowMenubar||t.searchParams.append("menubar","false"),n.windowChannel&&"string"==typeof n.windowChannel&&t.searchParams.append("channel",n.windowChannel),t.searchParams.append("ref",window.location.href.split(/[?#]/)[0]),n.windowSrc=t.toString(),!n.buttonAriaLabel&&n.buttonText&&(n.buttonAriaLabel=n.buttonText),n.buttonAriaLabel||(n.buttonAriaLabel="Chatbot öffnen"),e.parent="string"==typeof n.el?document.querySelector(n.el):null,!e.parent){let t=document.createElement("section"),o=n.buttonContainerAriaLabel??v.buttonContainerAriaLabel;t.setAttribute("aria-label",o),document.body.appendChild(t),e.parent=t}if(e.parent.hasAttribute("id")||e.parent.setAttribute("id","chatbot"),e.parent.classList.add("assono-chatbot"),e.parent.innerHTML+=g.render('<div class="assono-chatbot-window assono-chatbot-window--closed"><div class="assono-chatbot-window__wrapper"><iframe class="assono-chatbot-window__iframe" src="" data-src="{{windowSrc}}" title="{{windowTitle}}" style="display: none" allow="microphone"></iframe>{{#windowIsResizable}}<div class="assono-chatbot-window__resizer assono-chatbot-window__resizer--left"></div><div class="assono-chatbot-window__resizer assono-chatbot-window__resizer--right"></div><div class="assono-chatbot-window__resizer assono-chatbot-window__resizer--top"></div><div class="assono-chatbot-window__resizer assono-chatbot-window__resizer--top-left"></div><div class="assono-chatbot-window__resizer assono-chatbot-window__resizer--top-right"></div>{{/windowIsResizable}}</div></div>',n)+(n.button?g.render('<button class="assono-chatbot-button assono-chatbot-button--open" aria-label="{{buttonAriaLabel}}"><div class="assono-chatbot-button__wrapper"><div class="assono-chatbot-button__content">{{#buttonImageSrc}} <img class="assono-chatbot-button__image" src="{{buttonImageSrc}}" alt="{{buttonImageAlt}}"> {{/buttonImageSrc}} {{buttonText}} {{#buttonHasBadge}} <svg class="assono-chatbot-button__badge" aria-hidden="true" focusable="false" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg">
6<path d="M14 6V18H11.733V8.33523H11.6648L9 10.0057V7.82386L11.8807 6H14Z"/></svg> {{/buttonHasBadge}}</div>{{#buttonMessages.length}}<div class="assono-chatbot-button__greeting">{{#buttonMessages}}<div class="assono-chatbot-button__message">{{.}} <svg class="assono-chatbot-button__tip" aria-hidden="true" focusable="false" viewBox="0 0 20 12" xmlns="http://www.w3.org/2000/svg"><path d="M3-4V6.277a1 1 0 001.496.868L17 0v-4H3z"/></svg></div>{{/buttonMessages}}</div>{{/buttonMessages.length}}</div></button>',n):""),e.window=e.parent.querySelector(".assono-chatbot-window"),e.iframe=e.parent.querySelector(".assono-chatbot-window__iframe"),e.button=e.parent.querySelector(".assono-chatbot-button"),e.window&&e.iframe&&(e.window.addEventListener("transitionend",(()=>{this.isOpen||(e.iframe.style.display="none")})),n.windowWidth&&(e.window.style.maxWidth=n.windowWidth+"px"),n.windowHeight&&(e.window.style.maxHeight=n.windowHeight+"px"),e.window.classList.toggle("assono-chatbot-window--resizable",n.windowIsResizable)),e.button&&(e.button.addEventListener("click",this.open.bind(this)),e.button.classList.toggle("assono-chatbot-button--animated",n.buttonIsAnimated),e.button.classList.toggle("assono-chatbot-button--messages",n.buttonMessages.length>0),e.button.classList.toggle("assono-chatbot-button--reversed",n.buttonIsReversed),e.button.classList.add("assono-chatbot-button--theme-"+("number"==typeof n.windowTheme?n.windowTheme:0))),window.addEventListener("message",(t=>{if("CLOSE_CHATBOT"!==t.data&&"CHATBOT_CLOSE"!==t.data||this.close(),"object"==typeof t.data&&"CHATBOT_TRACKING_EVENT"===t.data.type){let e=[];e.push(t.data.data),this.emit("track",e)}})),n.windowIsResizable)for(let t of e.window.querySelectorAll(".assono-chatbot-window__resizer"))t.addEventListener("mousedown",o.start)};n.buttonUseServerConfig?async function(){let t=new URL(n.windowSrc);if(!t)return{};let e=await fetch(t.origin+"/req/api/rest/settings/design");if(!e.ok)throw new Error("Error: "+e.status);return await e.json()}().then((t=>{t.data&&(t.data.avatar.length>1?(n.buttonImageSrc=[],t.data.avatar.forEach((t=>{n.buttonImageSrc.push(t.url)}))):1===t.data.avatar.length&&(n.buttonImageSrc=t.data.avatar[0].avatar.url)),s()})).catch((t=>{s()})):s()}}));
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.