<\/div>/g, '
');
+ }
+ console.log('p', docType, text);
+ if (docType === 'html') {
+ html = document.createElement('div');
+ html.innerHTML = text;
+ match = false;
+ htmlTmp = text;
+ regex = new RegExp('<(/w|w)\:[A-Za-z]');
+ if (htmlTmp.match(regex)) {
+ match = true;
+ htmlTmp = htmlTmp.replace(regex, '');
+ }
+ regex = new RegExp('<(/o|o)\:[A-Za-z]');
+ if (htmlTmp.match(regex)) {
+ match = true;
+ htmlTmp = htmlTmp.replace(regex, '');
+ }
+ if (match) {
+ html = this.wordFilter(html);
+ }
+ ref = html.childNodes;
+ for (j = 0, len = ref.length; j < len; j++) {
+ node = ref[j];
+ if (node.nodeType === 8) {
+ node.remove();
+ }
+ }
+ ref1 = html.querySelectorAll('a, font, small, time, form, label');
+ for (k = 0, len1 = ref1.length; k < len1; k++) {
+ node = ref1[k];
+ node.outerHTML = node.innerHTML;
+ }
+ replacementTag = 'div';
+ ref2 = html.querySelectorAll('textarea');
+ for (l = 0, len2 = ref2.length; l < len2; l++) {
+ node = ref2[l];
+ outer = node.outerHTML;
+ regex = new RegExp('<' + node.tagName, 'i');
+ newTag = outer.replace(regex, '<' + replacementTag);
+ regex = new RegExp('' + node.tagName, 'i');
+ newTag = newTag.replace(regex, '' + replacementTag);
+ node.outerHTML = newTag;
+ }
+ ref3 = html.querySelectorAll('font, img, svg, input, select, button, style, applet, embed, noframes, canvas, script, frame, iframe, meta, link, title, head, fieldset');
+ for (m = 0, len3 = ref3.length; m < len3; m++) {
+ node = ref3[m];
+ node.remove();
+ }
+ this.removeAttributes(html);
+ text = html.innerHTML;
+ }
+ if (docType === 'text3') {
+ this.pasteHtmlAtCaret(text);
+ } else {
+ document.execCommand('insertHTML', false, text);
+ }
+ return true;
+ };
+
+ ZammadChat.prototype.onKeydown = function(e) {
+ var richtTextControl;
+ if (!e.shiftKey && e.keyCode === 13) {
+ e.preventDefault();
+ this.sendMessage();
+ }
+ richtTextControl = false;
+ if (!e.altKey && !e.ctrlKey && e.metaKey) {
+ richtTextControl = true;
+ } else if (!e.altKey && e.ctrlKey && !e.metaKey) {
+ richtTextControl = true;
+ }
+ if (richtTextControl && this.richTextFormatKey[e.keyCode]) {
+ e.preventDefault();
+ if (e.keyCode === 66) {
+ document.execCommand('bold');
+ return true;
+ }
+ if (e.keyCode === 73) {
+ document.execCommand('italic');
+ return true;
+ }
+ if (e.keyCode === 85) {
+ document.execCommand('underline');
+ return true;
+ }
+ if (e.keyCode === 83) {
+ document.execCommand('strikeThrough');
+ return true;
+ }
+ }
+ };
+
+ ZammadChat.prototype.send = function(event, data) {
+ if (data == null) {
+ data = {};
+ }
+ data.chat_id = this.options.chatId;
+ return this.io.send(event, data);
+ };
+
+ ZammadChat.prototype.onWebSocketMessage = function(pipes) {
+ var j, len, pipe;
+ for (j = 0, len = pipes.length; j < len; j++) {
+ pipe = pipes[j];
+ this.log.debug('ws:onmessage', pipe);
+ switch (pipe.event) {
+ case 'chat_error':
+ this.log.notice(pipe.data);
+ if (pipe.data && pipe.data.state === 'chat_disabled') {
+ this.destroy({
+ remove: true
+ });
+ }
+ break;
+ case 'chat_session_message':
+ if (pipe.data.self_written) {
+ return;
+ }
+ this.receiveMessage(pipe.data);
+ break;
+ case 'chat_session_typing':
+ if (pipe.data.self_written) {
+ return;
+ }
+ this.onAgentTypingStart();
+ break;
+ case 'chat_session_start':
+ this.onConnectionEstablished(pipe.data);
+ break;
+ case 'chat_session_queue':
+ this.onQueueScreen(pipe.data);
+ break;
+ case 'chat_session_closed':
+ this.onSessionClosed(pipe.data);
+ break;
+ case 'chat_session_left':
+ this.onSessionClosed(pipe.data);
+ break;
+ case 'chat_status_customer':
+ switch (pipe.data.state) {
+ case 'online':
+ this.sessionId = void 0;
+ if (!this.options.cssAutoload || this.cssLoaded) {
+ this.onReady();
+ } else {
+ this.socketReady = true;
+ }
+ break;
+ case 'offline':
+ this.onError('Zammad Chat: No agent online');
+ break;
+ case 'chat_disabled':
+ this.onError('Zammad Chat: Chat is disabled');
+ break;
+ case 'no_seats_available':
+ this.onError("Zammad Chat: Too many clients in queue. Clients in queue: " + pipe.data.queue);
+ break;
+ case 'reconnect':
+ this.onReopenSession(pipe.data);
+ }
+ }
+ }
+ };
+
+ ZammadChat.prototype.onReady = function() {
+ var btn;
+ this.log.debug('widget ready for use');
+ btn = document.querySelector("." + this.options.buttonClass);
+ if (btn) {
+ btn.addEventListener('click', this.open);
+ btn.classList.remove(this.inactiveClass);
+ }
+ if (this.options.show) {
+ return this.show();
+ }
+ };
+
+ ZammadChat.prototype.onError = function(message) {
+ this.log.debug(message);
+ this.addStatus(message);
+ document.querySelector("." + this.options.buttonClass).classList.add('zammad-chat-is-hidden');
+ if (this.isOpen) {
+ this.disableInput();
+ return this.destroy({
+ remove: false
+ });
+ } else {
+ return this.destroy({
+ remove: true
+ });
+ }
+ };
+
+ ZammadChat.prototype.onReopenSession = function(data) {
+ var j, len, message, ref, unfinishedMessage;
+ this.log.debug('old messages', data.session);
+ this.inactiveTimeout.start();
+ unfinishedMessage = sessionStorage.getItem('unfinished_message');
+ if (data.agent) {
+ this.onConnectionEstablished(data);
+ ref = data.session;
+ for (j = 0, len = ref.length; j < len; j++) {
+ message = ref[j];
+ this.renderMessage({
+ message: message.content,
+ id: message.id,
+ from: message.created_by_id ? 'agent' : 'customer'
+ });
+ }
+ if (unfinishedMessage) {
+ this.input.innerHTML = unfinishedMessage;
+ }
+ }
+ if (data.position) {
+ this.onQueue(data);
+ }
+ this.show();
+ this.open();
+ this.scrollToBottom();
+ if (unfinishedMessage) {
+ return this.input.focus();
+ }
+ };
+
+ ZammadChat.prototype.onInput = function() {
+ var j, len, message, ref;
+ ref = this.el.querySelectorAll('.zammad-chat-message--unread');
+ for (j = 0, len = ref.length; j < len; j++) {
+ message = ref[j];
+ node.classList.remove('zammad-chat-message--unread');
+ }
+ sessionStorage.setItem('unfinished_message', this.input.innerHTML);
+ return this.onTyping();
+ };
+
+ ZammadChat.prototype.onTyping = function() {
+ if (this.isTyping && this.isTyping > new Date(new Date().getTime() - 1500)) {
+ return;
+ }
+ this.isTyping = new Date();
+ this.send('chat_session_typing', {
+ session_id: this.sessionId
+ });
+ return this.inactiveTimeout.start();
+ };
+
+ ZammadChat.prototype.onSubmit = function(event) {
+ event.preventDefault();
+ return this.sendMessage();
+ };
+
+ ZammadChat.prototype.sendMessage = function() {
+ var message, messageElement;
+ message = this.input.innerHTML;
+ if (!message) {
+ return;
+ }
+ this.inactiveTimeout.start();
+ sessionStorage.removeItem('unfinished_message');
+ messageElement = this.view('message')({
+ message: message,
+ from: 'customer',
+ id: this._messageCount++,
+ unreadClass: ''
+ });
+ this.maybeAddTimestamp();
+ if (this.el.querySelector('.zammad-chat-message--typing')) {
+ this.lastAddedType = 'typing-placeholder';
+ this.el.querySelector('.zammad-chat-message--typing').insertAdjacentHTML('beforebegin', messageElement);
+ } else {
+ this.lastAddedType = 'message--customer';
+ this.body.insertAdjacentHTML('beforeend', messageElement);
+ }
+ this.input.innerHTML = '';
+ this.scrollToBottom();
+ return this.send('chat_session_message', {
+ content: message,
+ id: this._messageCount,
+ session_id: this.sessionId
+ });
+ };
+
+ ZammadChat.prototype.receiveMessage = function(data) {
+ this.inactiveTimeout.start();
+ this.onAgentTypingEnd();
+ this.maybeAddTimestamp();
+ this.renderMessage({
+ message: data.message.content,
+ id: data.id,
+ from: 'agent'
+ });
+ return this.scrollToBottom({
+ showHint: true
+ });
+ };
+
+ ZammadChat.prototype.renderMessage = function(data) {
+ this.lastAddedType = "message--" + data.from;
+ data.unreadClass = document.hidden ? ' zammad-chat-message--unread' : '';
+ return this.body.insertAdjacentHTML('beforeend', this.view('message')(data));
+ };
+
+ ZammadChat.prototype.open = function() {
+ var remainerHeight;
+ if (this.isOpen) {
+ this.log.debug('widget already open, block');
+ return;
+ }
+ this.isOpen = true;
+ this.log.debug('open widget');
+ this.show();
+ if (!this.sessionId) {
+ this.showLoader();
+ }
+ this.el.classList.add('zammad-chat-is-open');
+ remainerHeight = this.el.clientHeight - this.el.querySelector('.zammad-chat-header').offsetHeight;
+ this.el.style.transform = "translateY(" + remainerHeight + "px)";
+ this.el.clientHeight;
+ if (!this.sessionId) {
+ this.el.addEventListener('transitionend', this.onOpenTransitionend);
+ this.el.classList.add('zammad-chat--animate');
+ this.el.clientHeight;
+ this.el.style.transform = '';
+ return this.send('chat_session_init', {
+ url: window.location.href
+ });
+ } else {
+ this.el.style.transform = '';
+ return this.onOpenTransitionend();
+ }
+ };
+
+ ZammadChat.prototype.onOpenTransitionend = function() {
+ this.el.removeEventListener('transitionend', this.onOpenTransitionend);
+ this.el.classList.remove('zammad-chat--animate');
+ this.idleTimeout.stop();
+ if (this.isFullscreen) {
+ return this.disableScrollOnRoot();
+ }
+ };
+
+ ZammadChat.prototype.sessionClose = function() {
+ this.send('chat_session_close', {
+ session_id: this.sessionId
+ });
+ this.inactiveTimeout.stop();
+ this.waitingListTimeout.stop();
+ sessionStorage.removeItem('unfinished_message');
+ if (this.onInitialQueueDelayId) {
+ clearTimeout(this.onInitialQueueDelayId);
+ }
+ return this.setSessionId(void 0);
+ };
+
+ ZammadChat.prototype.toggle = function(event) {
+ if (this.isOpen) {
+ return this.close(event);
+ } else {
+ return this.open(event);
+ }
+ };
+
+ ZammadChat.prototype.close = function(event) {
+ var remainerHeight;
+ if (!this.isOpen) {
+ this.log.debug('can\'t close widget, it\'s not open');
+ return;
+ }
+ if (this.initDelayId) {
+ clearTimeout(this.initDelayId);
+ }
+ if (!this.sessionId) {
+ this.log.debug('can\'t close widget without sessionId');
+ return;
+ }
+ this.log.debug('close widget');
+ if (event) {
+ event.stopPropagation();
+ }
+ this.sessionClose();
+ if (this.isFullscreen) {
+ this.enableScrollOnRoot();
+ }
+ remainerHeight = this.el.clientHeight - this.el.querySelector('.zammad-chat-header').offsetHeight;
+ this.el.addEventListener('transitionend', this.onCloseTransitionend);
+ this.el.classList.add('zammad-chat--animate');
+ document.offsetHeight;
+ return this.el.style.transform = "translateY(" + remainerHeight + "px)";
+ };
+
+ ZammadChat.prototype.onCloseTransitionend = function() {
+ this.el.removeEventListener('transitionend', this.onCloseTransitionend);
+ this.el.classList.remove('zammad-chat-is-open', 'zammad-chat--animate');
+ this.el.style.transform = '';
+ this.showLoader();
+ this.el.querySelector('.zammad-chat-welcome').classList.remove('zammad-chat-is-hidden');
+ this.el.querySelector('.zammad-chat-agent').classList.add('zammad-chat-is-hidden');
+ this.el.querySelector('.zammad-chat-agent-status').classList.add('zammad-chat-is-hidden');
+ this.isOpen = false;
+ return this.io.reconnect();
+ };
+
+ ZammadChat.prototype.onWebSocketClose = function() {
+ if (this.isOpen) {
+ return;
+ }
+ if (this.el) {
+ this.el.classList.remove('zammad-chat-is-shown');
+ return this.el.classList.remove('zammad-chat-is-loaded');
+ }
+ };
+
+ ZammadChat.prototype.show = function() {
+ if (this.state === 'offline') {
+ return;
+ }
+ this.el.classList.add('zammad-chat-is-loaded');
+ return this.el.classList.add('zammad-chat-is-shown');
+ };
+
+ ZammadChat.prototype.disableInput = function() {
+ this.input.disabled = true;
+ return this.el.querySelector('.zammad-chat-send').disabled = true;
+ };
+
+ ZammadChat.prototype.enableInput = function() {
+ this.input.disabled = false;
+ return this.el.querySelector('.zammad-chat-send').disabled = false;
+ };
+
+ ZammadChat.prototype.hideModal = function() {
+ return this.el.querySelector('.zammad-chat-modal').innerHTML = '';
+ };
+
+ ZammadChat.prototype.onQueueScreen = function(data) {
+ var show;
+ this.setSessionId(data.session_id);
+ show = (function(_this) {
+ return function() {
+ _this.onQueue(data);
+ return _this.waitingListTimeout.start();
+ };
+ })(this);
+ if (this.initialQueueDelay && !this.onInitialQueueDelayId) {
+ this.onInitialQueueDelayId = setTimeout(show, this.initialQueueDelay);
+ return;
+ }
+ if (this.onInitialQueueDelayId) {
+ clearTimeout(this.onInitialQueueDelayId);
+ }
+ return show();
+ };
+
+ ZammadChat.prototype.onQueue = function(data) {
+ this.log.notice('onQueue', data.position);
+ this.inQueue = true;
+ return this.el.querySelector('.zammad-chat-modal').innerHTML = this.view('waiting')({
+ position: data.position
+ });
+ };
+
+ ZammadChat.prototype.onAgentTypingStart = function() {
+ if (this.stopTypingId) {
+ clearTimeout(this.stopTypingId);
+ }
+ this.stopTypingId = setTimeout(this.onAgentTypingEnd, 3000);
+ if (this.el.querySelector('.zammad-chat-message--typing')) {
+ return;
+ }
+ this.maybeAddTimestamp();
+ this.body.insertAdjacentHTML('beforeend', this.view('typingIndicator')());
+ if (!this.isVisible(this.el.querySelector('.zammad-chat-message--typing'), true)) {
+ return;
+ }
+ return this.scrollToBottom();
+ };
+
+ ZammadChat.prototype.onAgentTypingEnd = function() {
+ if (this.el.querySelector('.zammad-chat-message--typing')) {
+ return this.el.querySelector('.zammad-chat-message--typing').remove();
+ }
+ };
+
+ ZammadChat.prototype.onLeaveTemporary = function() {
+ if (!this.sessionId) {
+ return;
+ }
+ return this.send('chat_session_leave_temporary', {
+ session_id: this.sessionId
+ });
+ };
+
+ ZammadChat.prototype.maybeAddTimestamp = function() {
+ var label, time, timestamp;
+ timestamp = Date.now();
+ if (!this.lastTimestamp || (timestamp - this.lastTimestamp) > this.showTimeEveryXMinutes * 60000) {
+ label = this.T('Today');
+ time = new Date().toTimeString().substr(0, 5);
+ if (this.lastAddedType === 'timestamp') {
+ this.updateLastTimestamp(label, time);
+ return this.lastTimestamp = timestamp;
+ } else {
+ this.body.insertAdjacentHTML('beforeend', this.view('timestamp')({
+ label: label,
+ time: time
+ }));
+ this.lastTimestamp = timestamp;
+ this.lastAddedType = 'timestamp';
+ return this.scrollToBottom();
+ }
+ }
+ };
+
+ ZammadChat.prototype.updateLastTimestamp = function(label, time) {
+ var timestamps;
+ if (!this.el) {
+ return;
+ }
+ timestamps = this.el.querySelectorAll('.zammad-chat-body .zammad-chat-timestamp');
+ if (!timestamps) {
+ return;
+ }
+ return timestamps[timestamps.length - 1].outerHTML = this.view('timestamp')({
+ label: label,
+ time: time
+ });
+ };
+
+ ZammadChat.prototype.addStatus = function(status) {
+ if (!this.el) {
+ return;
+ }
+ this.maybeAddTimestamp();
+ this.body.insertAdjacentHTML('beforeend', this.view('status')({
+ status: status
+ }));
+ return this.scrollToBottom();
+ };
+
+ ZammadChat.prototype.detectScrolledtoBottom = function() {
+ var scrollBottom;
+ scrollBottom = this.body.scrollTop + this.body.offsetHeight;
+ this.scrolledToBottom = Math.abs(scrollBottom - this.body.scrollHeight) <= this.scrollSnapTolerance;
+ if (this.scrolledToBottom) {
+ return this.el.querySelector('.zammad-scroll-hint').classList.add('is-hidden');
+ }
+ };
+
+ ZammadChat.prototype.showScrollHint = function() {
+ this.el.querySelector('.zammad-scroll-hint').classList.remove('is-hidden');
+ return this.body.scrollTop = this.body.scrollTop + this.el.querySelector('.zammad-scroll-hint').offsetHeight;
+ };
+
+ ZammadChat.prototype.onScrollHintClick = function() {
+ return this.body.scrollTo({
+ top: this.body.scrollHeight,
+ behavior: 'smooth'
+ });
+ };
+
+ ZammadChat.prototype.scrollToBottom = function(arg) {
+ var showHint;
+ showHint = (arg != null ? arg : {
+ showHint: false
+ }).showHint;
+ if (this.scrolledToBottom) {
+ return this.body.scrollTop = this.body.scrollHeight;
+ } else if (showHint) {
+ return this.showScrollHint();
+ }
+ };
+
+ ZammadChat.prototype.destroy = function(params) {
+ if (params == null) {
+ params = {};
+ }
+ this.log.debug('destroy widget', params);
+ this.setAgentOnlineState('offline');
+ if (params.remove && this.el) {
+ this.el.remove();
+ }
+ if (this.waitingListTimeout) {
+ this.waitingListTimeout.stop();
+ }
+ if (this.inactiveTimeout) {
+ this.inactiveTimeout.stop();
+ }
+ if (this.idleTimeout) {
+ this.idleTimeout.stop();
+ }
+ return this.io.close();
+ };
+
+ ZammadChat.prototype.reconnect = function() {
+ this.log.notice('reconnecting');
+ this.disableInput();
+ this.lastAddedType = 'status';
+ this.setAgentOnlineState('connecting');
+ return this.addStatus(this.T('Connection lost'));
+ };
+
+ ZammadChat.prototype.onConnectionReestablished = function() {
+ this.lastAddedType = 'status';
+ this.setAgentOnlineState('online');
+ return this.addStatus(this.T('Connection re-established'));
+ };
+
+ ZammadChat.prototype.onSessionClosed = function(data) {
+ this.addStatus(this.T('Chat closed by %s', data.realname));
+ this.disableInput();
+ this.setAgentOnlineState('offline');
+ return this.inactiveTimeout.stop();
+ };
+
+ ZammadChat.prototype.setSessionId = function(id) {
+ this.sessionId = id;
+ if (id === void 0) {
+ return sessionStorage.removeItem('sessionId');
+ } else {
+ return sessionStorage.setItem('sessionId', id);
+ }
+ };
+
+ ZammadChat.prototype.onConnectionEstablished = function(data) {
+ if (this.onInitialQueueDelayId) {
+ clearTimeout(this.onInitialQueueDelayId);
+ }
+ this.inQueue = false;
+ if (data.agent) {
+ this.agent = data.agent;
+ }
+ if (data.session_id) {
+ this.setSessionId(data.session_id);
+ }
+ this.body.innerHTML = '';
+ this.el.querySelector('.zammad-chat-agent').innerHTML = this.view('agent')({
+ agent: this.agent
+ });
+ this.enableInput();
+ this.hideModal();
+ this.el.querySelector('.zammad-chat-welcome').classList.add('zammad-chat-is-hidden');
+ this.el.querySelector('.zammad-chat-agent').classList.remove('zammad-chat-is-hidden');
+ this.el.querySelector('.zammad-chat-agent-status').classList.remove('zammad-chat-is-hidden');
+ if (!this.isFullscreen) {
+ this.input.focus();
+ }
+ this.setAgentOnlineState('online');
+ this.waitingListTimeout.stop();
+ this.idleTimeout.stop();
+ return this.inactiveTimeout.start();
+ };
+
+ ZammadChat.prototype.showCustomerTimeout = function() {
+ this.el.querySelector('.zammad-chat-modal').innerHTML = this.view('customer_timeout')({
+ agent: this.agent.name,
+ delay: this.options.inactiveTimeout
+ });
+ this.el.querySelector('.js-restart').addEventListener('click', function() {
+ return location.reload();
+ });
+ return this.sessionClose();
+ };
+
+ ZammadChat.prototype.showWaitingListTimeout = function() {
+ this.el.querySelector('.zammad-chat-modal').innerHTML = this.view('waiting_list_timeout')({
+ delay: this.options.watingListTimeout
+ });
+ this.el.querySelector('.js-restart').addEventListener('click', function() {
+ return location.reload();
+ });
+ return this.sessionClose();
+ };
+
+ ZammadChat.prototype.showLoader = function() {
+ return this.el.querySelector('.zammad-chat-modal').innerHTML = this.view('loader')();
+ };
+
+ ZammadChat.prototype.setAgentOnlineState = function(state) {
+ var capitalizedState;
+ this.state = state;
+ if (!this.el) {
+ return;
+ }
+ capitalizedState = state.charAt(0).toUpperCase() + state.slice(1);
+ this.el.querySelector('.zammad-chat-agent-status').dataset.status = state;
+ return this.el.querySelector('.zammad-chat-agent-status').textContent = this.T(capitalizedState);
+ };
+
+ ZammadChat.prototype.detectHost = function() {
+ var protocol;
+ protocol = 'ws://';
+ if (scriptProtocol === 'https') {
+ protocol = 'wss://';
+ }
+ return this.options.host = "" + protocol + scriptHost + "/ws";
+ };
+
+ ZammadChat.prototype.loadCss = function() {
+ var newSS, styles, url;
+ if (!this.options.cssAutoload) {
+ return;
+ }
+ url = this.options.cssUrl;
+ if (!url) {
+ url = this.options.host.replace(/^wss/i, 'https').replace(/^ws/i, 'http').replace(/\/ws/i, '');
+ url += '/assets/chat/chat.css';
+ }
+ this.log.debug("load css from '" + url + "'");
+ styles = "@import url('" + url + "');";
+ newSS = document.createElement('link');
+ newSS.onload = this.onCssLoaded;
+ newSS.rel = 'stylesheet';
+ newSS.href = 'data:text/css,' + escape(styles);
+ return document.getElementsByTagName('head')[0].appendChild(newSS);
+ };
+
+ ZammadChat.prototype.onCssLoaded = function() {
+ this.cssLoaded = true;
+ if (this.socketReady) {
+ return this.onReady();
+ }
+ };
+
+ ZammadChat.prototype.startTimeoutObservers = function() {
+ this.idleTimeout = new Timeout({
+ logPrefix: 'idleTimeout',
+ debug: this.options.debug,
+ timeout: this.options.idleTimeout,
+ timeoutIntervallCheck: this.options.idleTimeoutIntervallCheck,
+ callback: (function(_this) {
+ return function() {
+ _this.log.debug('Idle timeout reached, hide widget', new Date);
+ return _this.destroy({
+ remove: true
+ });
+ };
+ })(this)
+ });
+ this.inactiveTimeout = new Timeout({
+ logPrefix: 'inactiveTimeout',
+ debug: this.options.debug,
+ timeout: this.options.inactiveTimeout,
+ timeoutIntervallCheck: this.options.inactiveTimeoutIntervallCheck,
+ callback: (function(_this) {
+ return function() {
+ _this.log.debug('Inactive timeout reached, show timeout screen.', new Date);
+ _this.showCustomerTimeout();
+ return _this.destroy({
+ remove: false
+ });
+ };
+ })(this)
+ });
+ return this.waitingListTimeout = new Timeout({
+ logPrefix: 'waitingListTimeout',
+ debug: this.options.debug,
+ timeout: this.options.waitingListTimeout,
+ timeoutIntervallCheck: this.options.waitingListTimeoutIntervallCheck,
+ callback: (function(_this) {
+ return function() {
+ _this.log.debug('Waiting list timeout reached, show timeout screen.', new Date);
+ _this.showWaitingListTimeout();
+ return _this.destroy({
+ remove: false
+ });
+ };
+ })(this)
+ });
+ };
+
+ ZammadChat.prototype.disableScrollOnRoot = function() {
+ this.rootScrollOffset = this.scrollRoot.scrollTop;
+ this.scrollRoot.style.overflow = 'hidden';
+ return this.scrollRoot.style.position = 'fixed';
+ };
+
+ ZammadChat.prototype.enableScrollOnRoot = function() {
+ this.scrollRoot.scrollTop = this.rootScrollOffset(+'px');
+ this.scrollRoot.style.overflow = '';
+ return this.scrollRoot.style.position = '';
+ };
+
+ ZammadChat.prototype.isVisible = function(el, partial, hidden, direction) {
+ var bViz, clientSize, hVisible, lViz, rViz, rec, tViz, vVisible, vpHeight, vpWidth;
+ if (el.length < 1) {
+ return;
+ }
+ vpWidth = window.innerWidth;
+ vpHeight = window.innerHeight;
+ direction = direction ? direction : 'both';
+ clientSize = hidden === true ? t.offsetWidth * t.offsetHeight : true;
+ rec = el.getBoundingClientRect();
+ tViz = rec.top >= 0 && rec.top < vpHeight;
+ bViz = rec.bottom > 0 && rec.bottom <= vpHeight;
+ lViz = rec.left >= 0 && rec.left < vpWidth;
+ rViz = rec.right > 0 && rec.right <= vpWidth;
+ vVisible = partial ? tViz || bViz : tViz && bViz;
+ hVisible = partial ? lViz || rViz : lViz && rViz;
+ if (direction === 'both') {
+ return clientSize && vVisible && hVisible;
+ } else if (direction === 'vertical') {
+ return clientSize && vVisible;
+ } else if (direction === 'horizontal') {
+ return clientSize && hVisible;
+ }
+ };
+
+ ZammadChat.prototype.isRetina = function() {
+ var mq;
+ if (window.matchMedia) {
+ mq = window.matchMedia('only screen and (min--moz-device-pixel-ratio: 1.3), only screen and (-o-min-device-pixel-ratio: 2.6/2), only screen and (-webkit-min-device-pixel-ratio: 1.3), only screen and (min-device-pixel-ratio: 1.3), only screen and (min-resolution: 1.3dppx)');
+ return mq && mq.matches || (window.devicePixelRatio > 1);
+ }
+ return false;
+ };
+
+ ZammadChat.prototype.resizeImage = function(dataURL, x, y, sizeFactor, type, quallity, callback, force) {
+ var imageObject;
+ if (x == null) {
+ x = 'auto';
+ }
+ if (y == null) {
+ y = 'auto';
+ }
+ if (sizeFactor == null) {
+ sizeFactor = 1;
+ }
+ if (force == null) {
+ force = true;
+ }
+ imageObject = new Image();
+ imageObject.onload = function() {
+ var canvas, context, factor, imageHeight, imageWidth, newDataUrl, resize;
+ imageWidth = imageObject.width;
+ imageHeight = imageObject.height;
+ console.log('ImageService', 'current size', imageWidth, imageHeight);
+ if (y === 'auto' && x === 'auto') {
+ x = imageWidth;
+ y = imageHeight;
+ }
+ if (y === 'auto') {
+ factor = imageWidth / x;
+ y = imageHeight / factor;
+ }
+ if (x === 'auto') {
+ factor = imageWidth / y;
+ x = imageHeight / factor;
+ }
+ resize = false;
+ if (x < imageWidth || y < imageHeight) {
+ resize = true;
+ x = x * sizeFactor;
+ y = y * sizeFactor;
+ } else {
+ x = imageWidth;
+ y = imageHeight;
+ }
+ canvas = document.createElement('canvas');
+ canvas.width = x;
+ canvas.height = y;
+ context = canvas.getContext('2d');
+ context.drawImage(imageObject, 0, 0, x, y);
+ if (quallity === 'auto') {
+ if (x < 200 && y < 200) {
+ quallity = 1;
+ } else if (x < 400 && y < 400) {
+ quallity = 0.9;
+ } else if (x < 600 && y < 600) {
+ quallity = 0.8;
+ } else if (x < 900 && y < 900) {
+ quallity = 0.7;
+ } else {
+ quallity = 0.6;
+ }
+ }
+ newDataUrl = canvas.toDataURL(type, quallity);
+ if (resize) {
+ console.log('ImageService', 'resize', x / sizeFactor, y / sizeFactor, quallity, (newDataUrl.length * 0.75) / 1024 / 1024, 'in mb');
+ callback(newDataUrl, x / sizeFactor, y / sizeFactor, true);
+ return;
+ }
+ console.log('ImageService', 'no resize', x, y, quallity, (newDataUrl.length * 0.75) / 1024 / 1024, 'in mb');
+ return callback(newDataUrl, x, y, false);
+ };
+ return imageObject.src = dataURL;
+ };
+
+ ZammadChat.prototype.pasteHtmlAtCaret = function(html) {
+ var el, frag, lastNode, node, range, sel;
+ sel = void 0;
+ range = void 0;
+ if (window.getSelection) {
+ sel = window.getSelection();
+ if (sel.getRangeAt && sel.rangeCount) {
+ range = sel.getRangeAt(0);
+ range.deleteContents();
+ el = document.createElement('div');
+ el.innerHTML = html;
+ frag = document.createDocumentFragment(node, lastNode);
+ while (node = el.firstChild) {
+ lastNode = frag.appendChild(node);
+ }
+ range.insertNode(frag);
+ if (lastNode) {
+ range = range.cloneRange();
+ range.setStartAfter(lastNode);
+ range.collapse(true);
+ sel.removeAllRanges();
+ return sel.addRange(range);
+ }
+ }
+ } else if (document.selection && document.selection.type !== 'Control') {
+ return document.selection.createRange().pasteHTML(html);
+ }
+ };
+
+ ZammadChat.prototype.wordFilter = function(editor) {
+ var content, cur_level, el, i, j, k, l, last_level, len, len1, len2, len3, len4, len5, len6, len7, list_tag, m, matches, n, o, p, pnt, q, r, ref, ref1, ref10, ref2, ref3, ref4, ref5, ref6, ref7, ref8, ref9, s, start, str, txt;
+ content = editor.html();
+ content = content.replace(//gi, '');
+ content = content.replace(/<(!|script[^>]*>.*?<\/script(?=[>\s])|\/?(\?xml(:\w+)?|img|meta|link|style|\w:\w+)(?=[\s\/>]))[^>]*>/gi, '');
+ content = content.replace(/<(\/?)s>/gi, '<$1strike>');
+ content = content.replace(/ /gi, ' ');
+ editor.innerHTML = content;
+ ref = editor.querySelectorAll('p');
+ for (j = 0, len = ref.length; j < len; j++) {
+ p = ref[j];
+ str = p.getAttribute('style');
+ matches = /mso-list:\w+ \w+([0-9]+)/.exec(str);
+ if (matches) {
+ p.dataset._listLevel = parseInt(matches[1], 10);
+ }
+ }
+ last_level = 0;
+ pnt = null;
+ ref1 = editor.querySelectorAll('p');
+ for (k = 0, len1 = ref1.length; k < len1; k++) {
+ p = ref1[k];
+ cur_level = p.dataset._listLevel;
+ if (cur_level !== void 0) {
+ txt = p.textContent;
+ list_tag = '
';
+ if (/^\s*\w+\./.test(txt)) {
+ matches = /([0-9])\./.exec(txt);
+ if (matches) {
+ start = parseInt(matches[1], 10);
+ list_tag = (ref2 = start > 1) != null ? ref2 : '
': '
'
+ };
+ } else {
+ list_tag = '
';
+ }
+ }
+ if (cur_level > last_level) {
+ if (last_level === 0) {
+ p.insertAdjacentHTML('beforebegin', list_tag);
+ pnt = p.previousElementSibling;
+ } else {
+
+ }
+ pnt.insertAdjacentHTML('beforeend', list_tag);
+ }
+ if (cur_level < last_level) {
+ for (i = l = ref3 = i, ref4 = last_level - cur_level; ref3 <= ref4 ? l <= ref4 : l >= ref4; i = ref3 <= ref4 ? ++l : --l) {
+ pnt = pnt.parentNode;
+ }
+ }
+ if (p.querySelector('span:first')) {
+ p.querySelector('span:first').remove();
+ }
+ pnt.insertAdjacentHTML('beforeend', '
' + p.innerHTML + '');
+ p.remove();
+ last_level = cur_level;
+ } else {
+ last_level = 0;
+ }
+ }
+ ref5 = editor.querySelectorAll('[style]');
+ for (m = 0, len2 = ref5.length; m < len2; m++) {
+ el = ref5[m];
+ el.removeAttribute('style');
+ }
+ ref6 = editor.querySelectorAll('[align]');
+ for (n = 0, len3 = ref6.length; n < len3; n++) {
+ el = ref6[n];
+ el.removeAttribute('align');
+ }
+ ref7 = editor.querySelectorAll('span');
+ for (o = 0, len4 = ref7.length; o < len4; o++) {
+ el = ref7[o];
+ el.outerHTML = el.innerHTML;
+ }
+ ref8 = editor.querySelectorAll('span:empty');
+ for (q = 0, len5 = ref8.length; q < len5; q++) {
+ el = ref8[q];
+ el.remove();
+ }
+ ref9 = editor.querySelectorAll("[class^='Mso']");
+ for (r = 0, len6 = ref9.length; r < len6; r++) {
+ el = ref9[r];
+ el.removeAttribute('class');
+ }
+ ref10 = editor.querySelectorAll('p:empty');
+ for (s = 0, len7 = ref10.length; s < len7; s++) {
+ el = ref10[s];
+ el.remove();
+ }
+ return editor;
+ };
+
+ ZammadChat.prototype.removeAttribute = function(element) {
+ var att, j, len, ref, results;
+ if (!element) {
+ return;
+ }
+ ref = element.attributes;
+ results = [];
+ for (j = 0, len = ref.length; j < len; j++) {
+ att = ref[j];
+ results.push(element.removeAttribute(att.name));
+ }
+ return results;
+ };
+
+ ZammadChat.prototype.removeAttributes = function(html) {
+ var j, len, node, ref;
+ ref = html.querySelectorAll('*');
+ for (j = 0, len = ref.length; j < len; j++) {
+ node = ref[j];
+ this.removeAttribute(node);
+ }
+ return html;
+ };
+
+ return ZammadChat;
+
+ })(Base);
+ return window.ZammadChat = ZammadChat;
+})(window);
+
+if (!window.zammadChatTemplates) {
+ window.zammadChatTemplates = {};
+}
+window.zammadChatTemplates["chat"] = function (__obj) {
+ if (!__obj) __obj = {};
+ var __out = [], __capture = function(callback) {
+ var out = __out, result;
+ __out = [];
+ callback.call(this);
+ result = __out.join('');
+ __out = out;
+ return __safe(result);
+ }, __sanitize = function(value) {
+ if (value && value.ecoSafe) {
+ return value;
+ } else if (typeof value !== 'undefined' && value != null) {
+ return __escape(value);
+ } else {
+ return '';
+ }
+ }, __safe, __objSafe = __obj.safe, __escape = __obj.escape;
+ __safe = __obj.safe = function(value) {
+ if (value && value.ecoSafe) {
+ return value;
+ } else {
+ if (!(typeof value !== 'undefined' && value != null)) value = '';
+ var result = new String(value);
+ result.ecoSafe = true;
+ return result;
+ }
+ };
+ if (!__escape) {
+ __escape = __obj.escape = function(value) {
+ return ('' + value)
+ .replace(/&/g, '&')
+ .replace(//g, '>')
+ .replace(/"/g, '"');
+ };
+ }
+ (function() {
+ (function() {
+ __out.push('
');
+
+ }).call(this);
+
+ }).call(__obj);
+ __obj.safe = __objSafe, __obj.escape = __escape;
+ return __out.join('');
+};
+
+if (!window.zammadChatTemplates) {
+ window.zammadChatTemplates = {};
+}
+window.zammadChatTemplates["customer_timeout"] = function (__obj) {
+ if (!__obj) __obj = {};
+ var __out = [], __capture = function(callback) {
+ var out = __out, result;
+ __out = [];
+ callback.call(this);
+ result = __out.join('');
+ __out = out;
+ return __safe(result);
+ }, __sanitize = function(value) {
+ if (value && value.ecoSafe) {
+ return value;
+ } else if (typeof value !== 'undefined' && value != null) {
+ return __escape(value);
+ } else {
+ return '';
+ }
+ }, __safe, __objSafe = __obj.safe, __escape = __obj.escape;
+ __safe = __obj.safe = function(value) {
+ if (value && value.ecoSafe) {
+ return value;
+ } else {
+ if (!(typeof value !== 'undefined' && value != null)) value = '';
+ var result = new String(value);
+ result.ecoSafe = true;
+ return result;
+ }
+ };
+ if (!__escape) {
+ __escape = __obj.escape = function(value) {
+ return ('' + value)
+ .replace(/&/g, '&')
+ .replace(//g, '>')
+ .replace(/"/g, '"');
+ };
+ }
+ (function() {
+ (function() {
+ __out.push('
\n ');
+
+ if (this.agent) {
+ __out.push('\n ');
+ __out.push(this.T('Since you didn\'t respond in the last %s minutes your conversation with
%s got closed.', this.delay, this.agent));
+ __out.push('\n ');
+ } else {
+ __out.push('\n ');
+ __out.push(this.T('Since you didn\'t respond in the last %s minutes your conversation got closed.', this.delay));
+ __out.push('\n ');
+ }
+
+ __out.push('\n
\n
');
+
+ __out.push(this.T('Start new conversation'));
+
+ __out.push('
\n
');
+
+ }).call(this);
+
+ }).call(__obj);
+ __obj.safe = __objSafe, __obj.escape = __escape;
+ return __out.join('');
+};
+
+if (!window.zammadChatTemplates) {
+ window.zammadChatTemplates = {};
+}
+window.zammadChatTemplates["loader"] = function (__obj) {
+ if (!__obj) __obj = {};
+ var __out = [], __capture = function(callback) {
+ var out = __out, result;
+ __out = [];
+ callback.call(this);
+ result = __out.join('');
+ __out = out;
+ return __safe(result);
+ }, __sanitize = function(value) {
+ if (value && value.ecoSafe) {
+ return value;
+ } else if (typeof value !== 'undefined' && value != null) {
+ return __escape(value);
+ } else {
+ return '';
+ }
+ }, __safe, __objSafe = __obj.safe, __escape = __obj.escape;
+ __safe = __obj.safe = function(value) {
+ if (value && value.ecoSafe) {
+ return value;
+ } else {
+ if (!(typeof value !== 'undefined' && value != null)) value = '';
+ var result = new String(value);
+ result.ecoSafe = true;
+ return result;
+ }
+ };
+ if (!__escape) {
+ __escape = __obj.escape = function(value) {
+ return ('' + value)
+ .replace(/&/g, '&')
+ .replace(//g, '>')
+ .replace(/"/g, '"');
+ };
+ }
+ (function() {
+ (function() {
+ __out.push('
\n \n \n \n\n
');
+
+ __out.push(this.T('Connecting'));
+
+ __out.push('');
+
+ }).call(this);
+
+ }).call(__obj);
+ __obj.safe = __objSafe, __obj.escape = __escape;
+ return __out.join('');
+};
+
+if (!window.zammadChatTemplates) {
+ window.zammadChatTemplates = {};
+}
+window.zammadChatTemplates["message"] = function (__obj) {
+ if (!__obj) __obj = {};
+ var __out = [], __capture = function(callback) {
+ var out = __out, result;
+ __out = [];
+ callback.call(this);
+ result = __out.join('');
+ __out = out;
+ return __safe(result);
+ }, __sanitize = function(value) {
+ if (value && value.ecoSafe) {
+ return value;
+ } else if (typeof value !== 'undefined' && value != null) {
+ return __escape(value);
+ } else {
+ return '';
+ }
+ }, __safe, __objSafe = __obj.safe, __escape = __obj.escape;
+ __safe = __obj.safe = function(value) {
+ if (value && value.ecoSafe) {
+ return value;
+ } else {
+ if (!(typeof value !== 'undefined' && value != null)) value = '';
+ var result = new String(value);
+ result.ecoSafe = true;
+ return result;
+ }
+ };
+ if (!__escape) {
+ __escape = __obj.escape = function(value) {
+ return ('' + value)
+ .replace(/&/g, '&')
+ .replace(//g, '>')
+ .replace(/"/g, '"');
+ };
+ }
+ (function() {
+ (function() {
+ __out.push('
\n ');
+
+ __out.push(this.message);
+
+ __out.push('\n
');
+
+ }).call(this);
+
+ }).call(__obj);
+ __obj.safe = __objSafe, __obj.escape = __escape;
+ return __out.join('');
+};
+
+if (!window.zammadChatTemplates) {
+ window.zammadChatTemplates = {};
+}
+window.zammadChatTemplates["status"] = function (__obj) {
+ if (!__obj) __obj = {};
+ var __out = [], __capture = function(callback) {
+ var out = __out, result;
+ __out = [];
+ callback.call(this);
+ result = __out.join('');
+ __out = out;
+ return __safe(result);
+ }, __sanitize = function(value) {
+ if (value && value.ecoSafe) {
+ return value;
+ } else if (typeof value !== 'undefined' && value != null) {
+ return __escape(value);
+ } else {
+ return '';
+ }
+ }, __safe, __objSafe = __obj.safe, __escape = __obj.escape;
+ __safe = __obj.safe = function(value) {
+ if (value && value.ecoSafe) {
+ return value;
+ } else {
+ if (!(typeof value !== 'undefined' && value != null)) value = '';
+ var result = new String(value);
+ result.ecoSafe = true;
+ return result;
+ }
+ };
+ if (!__escape) {
+ __escape = __obj.escape = function(value) {
+ return ('' + value)
+ .replace(/&/g, '&')
+ .replace(//g, '>')
+ .replace(/"/g, '"');
+ };
+ }
+ (function() {
+ (function() {
+ __out.push('
\n
\n ');
+
+ __out.push(this.status);
+
+ __out.push('\n
\n
');
+
+ }).call(this);
+
+ }).call(__obj);
+ __obj.safe = __objSafe, __obj.escape = __escape;
+ return __out.join('');
+};
+
+if (!window.zammadChatTemplates) {
+ window.zammadChatTemplates = {};
+}
+window.zammadChatTemplates["timestamp"] = function (__obj) {
+ if (!__obj) __obj = {};
+ var __out = [], __capture = function(callback) {
+ var out = __out, result;
+ __out = [];
+ callback.call(this);
+ result = __out.join('');
+ __out = out;
+ return __safe(result);
+ }, __sanitize = function(value) {
+ if (value && value.ecoSafe) {
+ return value;
+ } else if (typeof value !== 'undefined' && value != null) {
+ return __escape(value);
+ } else {
+ return '';
+ }
+ }, __safe, __objSafe = __obj.safe, __escape = __obj.escape;
+ __safe = __obj.safe = function(value) {
+ if (value && value.ecoSafe) {
+ return value;
+ } else {
+ if (!(typeof value !== 'undefined' && value != null)) value = '';
+ var result = new String(value);
+ result.ecoSafe = true;
+ return result;
+ }
+ };
+ if (!__escape) {
+ __escape = __obj.escape = function(value) {
+ return ('' + value)
+ .replace(/&/g, '&')
+ .replace(//g, '>')
+ .replace(/"/g, '"');
+ };
+ }
+ (function() {
+ (function() {
+ __out.push('
');
+
+ __out.push(__sanitize(this.label));
+
+ __out.push(' ');
+
+ __out.push(__sanitize(this.time));
+
+ __out.push('
');
+
+ }).call(this);
+
+ }).call(__obj);
+ __obj.safe = __objSafe, __obj.escape = __escape;
+ return __out.join('');
+};
+
+if (!window.zammadChatTemplates) {
+ window.zammadChatTemplates = {};
+}
+window.zammadChatTemplates["typingIndicator"] = function (__obj) {
+ if (!__obj) __obj = {};
+ var __out = [], __capture = function(callback) {
+ var out = __out, result;
+ __out = [];
+ callback.call(this);
+ result = __out.join('');
+ __out = out;
+ return __safe(result);
+ }, __sanitize = function(value) {
+ if (value && value.ecoSafe) {
+ return value;
+ } else if (typeof value !== 'undefined' && value != null) {
+ return __escape(value);
+ } else {
+ return '';
+ }
+ }, __safe, __objSafe = __obj.safe, __escape = __obj.escape;
+ __safe = __obj.safe = function(value) {
+ if (value && value.ecoSafe) {
+ return value;
+ } else {
+ if (!(typeof value !== 'undefined' && value != null)) value = '';
+ var result = new String(value);
+ result.ecoSafe = true;
+ return result;
+ }
+ };
+ if (!__escape) {
+ __escape = __obj.escape = function(value) {
+ return ('' + value)
+ .replace(/&/g, '&')
+ .replace(//g, '>')
+ .replace(/"/g, '"');
+ };
+ }
+ (function() {
+ (function() {
+ __out.push('
\n \n \n \n \n \n \n \n
');
+
+ }).call(this);
+
+ }).call(__obj);
+ __obj.safe = __objSafe, __obj.escape = __escape;
+ return __out.join('');
+};
+
+if (!window.zammadChatTemplates) {
+ window.zammadChatTemplates = {};
+}
+window.zammadChatTemplates["waiting"] = function (__obj) {
+ if (!__obj) __obj = {};
+ var __out = [], __capture = function(callback) {
+ var out = __out, result;
+ __out = [];
+ callback.call(this);
+ result = __out.join('');
+ __out = out;
+ return __safe(result);
+ }, __sanitize = function(value) {
+ if (value && value.ecoSafe) {
+ return value;
+ } else if (typeof value !== 'undefined' && value != null) {
+ return __escape(value);
+ } else {
+ return '';
+ }
+ }, __safe, __objSafe = __obj.safe, __escape = __obj.escape;
+ __safe = __obj.safe = function(value) {
+ if (value && value.ecoSafe) {
+ return value;
+ } else {
+ if (!(typeof value !== 'undefined' && value != null)) value = '';
+ var result = new String(value);
+ result.ecoSafe = true;
+ return result;
+ }
+ };
+ if (!__escape) {
+ __escape = __obj.escape = function(value) {
+ return ('' + value)
+ .replace(/&/g, '&')
+ .replace(//g, '>')
+ .replace(/"/g, '"');
+ };
+ }
+ (function() {
+ (function() {
+ __out.push('
\n \n \n \n \n \n ');
+
+ __out.push(this.T('All colleagues are busy.'));
+
+ __out.push('
\n ');
+
+ __out.push(this.T('You are on waiting list position %s.', this.position));
+
+ __out.push('\n
');
+
+ }).call(this);
+
+ }).call(__obj);
+ __obj.safe = __objSafe, __obj.escape = __escape;
+ return __out.join('');
+};
+
+if (!window.zammadChatTemplates) {
+ window.zammadChatTemplates = {};
+}
+window.zammadChatTemplates["waiting_list_timeout"] = function (__obj) {
+ if (!__obj) __obj = {};
+ var __out = [], __capture = function(callback) {
+ var out = __out, result;
+ __out = [];
+ callback.call(this);
+ result = __out.join('');
+ __out = out;
+ return __safe(result);
+ }, __sanitize = function(value) {
+ if (value && value.ecoSafe) {
+ return value;
+ } else if (typeof value !== 'undefined' && value != null) {
+ return __escape(value);
+ } else {
+ return '';
+ }
+ }, __safe, __objSafe = __obj.safe, __escape = __obj.escape;
+ __safe = __obj.safe = function(value) {
+ if (value && value.ecoSafe) {
+ return value;
+ } else {
+ if (!(typeof value !== 'undefined' && value != null)) value = '';
+ var result = new String(value);
+ result.ecoSafe = true;
+ return result;
+ }
+ };
+ if (!__escape) {
+ __escape = __obj.escape = function(value) {
+ return ('' + value)
+ .replace(/&/g, '&')
+ .replace(//g, '>')
+ .replace(/"/g, '"');
+ };
+ }
+ (function() {
+ (function() {
+ __out.push('
\n ');
+
+ __out.push(this.T('We are sorry, it takes longer as expected to get an empty slot. Please try again later or send us an email. Thank you!'));
+
+ __out.push('\n
\n
');
+
+ __out.push(this.T('Start new conversation'));
+
+ __out.push('
\n
');
+
+ }).call(this);
+
+ }).call(__obj);
+ __obj.safe = __objSafe, __obj.escape = __escape;
+ return __out.join('');
+};
diff --git a/public/assets/chat/chat-no-jquery.min.js b/public/assets/chat/chat-no-jquery.min.js
new file mode 100644
index 000000000..079c0cbcc
--- /dev/null
+++ b/public/assets/chat/chat-no-jquery.min.js
@@ -0,0 +1,2 @@
+window.zammadChatTemplates||(window.zammadChatTemplates={}),window.zammadChatTemplates.agent=function(e){e||(e={});var t,s=[],n=function(e){return e&&e.ecoSafe?e:"undefined"!=typeof e&&null!=e?i(e):""},o=e.safe,i=e.escape;return t=e.safe=function(e){if(e&&e.ecoSafe)return e;"undefined"!=typeof e&&null!=e||(e="");var t=new String(e);return t.ecoSafe=!0,t},i||(i=e.escape=function(e){return(""+e).replace(/&/g,"&").replace(//g,">").replace(/"/g,""")}),function(){(function(){this.agent.avatar&&(s.push('\n
\n')),s.push('\n
\n '),s.push(n(this.agent.name)),s.push("\n")}).call(this)}.call(e),e.safe=o,e.escape=i,s.join("")};var extend=function(e,t){function s(){this.constructor=e}for(var n in t)hasProp.call(t,n)&&(e[n]=t[n]);return s.prototype=t.prototype,e.prototype=new s,e.__super__=t.prototype,e},hasProp={}.hasOwnProperty,bind=function(e,t){return function(){return e.apply(t,arguments)}},slice=[].slice;!function(e){var s,n,o,i,a,r,l,c,d,h;return h=document.getElementsByTagName("script"),l=h[h.length-1],d=e.location.protocol.replace(":",""),l&&l.src&&(c=l.src.match(".*://([^:/]*).*")[1],d=l.src.match("(.*)://[^:/]*.*")[1]),n=function(){function e(e){var t,s,n;this.options={},s=this.defaults;for(t in s)n=s[t],this.options[t]=n;for(t in e)n=e[t],this.options[t]=n}return e.prototype.defaults={debug:!1},e}(),s=function(e){function t(e){t.__super__.constructor.call(this,e),this.log=new i({debug:this.options.debug,logPrefix:this.options.logPrefix||this.logPrefix})}return extend(t,e),t}(n),i=function(e){function t(){return this.log=bind(this.log,this),this.error=bind(this.error,this),this.notice=bind(this.notice,this),this.debug=bind(this.debug,this),t.__super__.constructor.apply(this,arguments)}return extend(t,e),t.prototype.debug=function(){var e;if(e=1<=arguments.length?slice.call(arguments,0):[],this.options.debug)return this.log("debug",e)},t.prototype.notice=function(){var e;return e=1<=arguments.length?slice.call(arguments,0):[],this.log("notice",e)},t.prototype.error=function(){var e;return e=1<=arguments.length?slice.call(arguments,0):[],this.log("error",e)},t.prototype.log=function(e,t){var s,n,o,i,a;if(t.unshift("||"),t.unshift(e),t.unshift(this.options.logPrefix),console.log.apply(console,t),this.options.debug){for(a="",o=0,i=t.length;o
"+a+" "+s.innerHTML:void 0}},t}(n),a=function(e){function t(){return this.stop=bind(this.stop,this),this.start=bind(this.start,this),t.__super__.constructor.apply(this,arguments)}return extend(t,e),t.prototype.timeoutStartedAt=null,t.prototype.logPrefix="timeout",t.prototype.defaults={debug:!1,timeout:4,timeoutIntervallCheck:.5},t.prototype.start=function(){var e,t;return this.stop(),t=new Date,e=function(e){return function(){var s;if(s=new Date-new Date(t.getTime()+1e3*e.options.timeout*60),e.log.debug("Timeout check for "+e.options.timeout+" minutes (left "+s/1e3+" sec.)"),!(s<0))return e.stop(),e.options.callback()}}(this),this.log.debug("Start timeout in "+this.options.timeout+" minutes"),this.intervallId=setInterval(e,1e3*this.options.timeoutIntervallCheck*60)},t.prototype.stop=function(){if(this.intervallId)return this.log.debug("Stop timeout of "+this.options.timeout+" minutes"),clearInterval(this.intervallId)},t}(s),o=function(t){function s(){return this.ping=bind(this.ping,this),this.send=bind(this.send,this),this.reconnect=bind(this.reconnect,this),this.close=bind(this.close,this),this.connect=bind(this.connect,this),this.set=bind(this.set,this),s.__super__.constructor.apply(this,arguments)}return extend(s,t),s.prototype.logPrefix="io",s.prototype.set=function(e){var t,s,n;s=[];for(t in e)n=e[t],s.push(this.options[t]=n);return s},s.prototype.connect=function(){return this.log.debug("Connecting to "+this.options.host),this.ws=new e.WebSocket(""+this.options.host),this.ws.onopen=function(e){return function(t){return e.log.debug("onOpen",t),e.options.onOpen(t),e.ping()}}(this),this.ws.onmessage=function(e){return function(t){var s,n,o,i;for(i=JSON.parse(t.data),e.log.debug("onMessage",t.data),s=0,n=i.length;s