zammad/zammad

View on GitHub
public/assets/chat/chat.min.js

Summary

Maintainability
A
0 mins
Test Coverage
window.zammadChatTemplates||(window.zammadChatTemplates={}),window.zammadChatTemplates.agent=function(e){function t(e){return e&&e.ecoSafe?e:void 0!==e&&null!=e?s(e):""}var n=[],o=(e=e||{}).safe,s=e.escape,s=(e.safe=function(e){return e&&e.ecoSafe?e:(void 0!==e&&null!=e||(e=""),(e=new String(e)).ecoSafe=!0,e)},s||(e.escape=function(e){return(""+e).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}));return function(){!function(){this.agent.avatar&&(n.push('\n<img class="zammad-chat-agent-avatar" src="'),n.push(t(this.agent.avatar)),n.push('">\n')),n.push('\n<span class="zammad-chat-agent-sentence">\n  <span class="zammad-chat-agent-name">'),n.push(t(this.agent.name)),n.push("</span>\n</span>")}.call(this)}.call(e),e.safe=o,e.escape=s,n.join("")},window.zammadChatTemplates||(window.zammadChatTemplates={}),window.zammadChatTemplates.chat=function(e){function t(e){return e&&e.ecoSafe?e:void 0!==e&&null!=e?s(e):""}var n=[],o=(e=e||{}).safe,s=e.escape,s=(e.safe=function(e){return e&&e.ecoSafe?e:(void 0!==e&&null!=e||(e=""),(e=new String(e)).ecoSafe=!0,e)},s||(e.escape=function(e){return(""+e).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}));return function(){!function(){n.push('<div class="zammad-chat'),this.flat&&n.push(t(" zammad-chat--flat")),n.push('"'),this.fontSize&&n.push(t(" style='font-size: "+this.fontSize+"'")),n.push('>\n  <div class="zammad-chat-header js-chat-open"'),this.background&&n.push(t(" style='background: "+this.background+"'")),n.push('>\n    <div class="zammad-chat-header-controls js-chat-toggle">\n      <span class="zammad-chat-agent-status zammad-chat-is-hidden js-chat-status" data-status="online"></span>\n      <span class="zammad-chat-header-icon">\n        <svg class="zammad-chat-header-icon-open" width="13" height="7" viewBox="0 0 13 7"><path d="M10.807 7l1.4-1.428-5-4.9L6.5-.02l-.7.7-4.9 4.9 1.414 1.413L6.5 2.886 10.807 7z" fill-rule="evenodd"/></svg>\n        <svg class="zammad-chat-header-icon-close" width="13" height="13" viewBox="0 0 13 13"><path d="m2.241.12l-2.121 2.121 4.243 4.243-4.243 4.243 2.121 2.121 4.243-4.243 4.243 4.243 2.121-2.121-4.243-4.243 4.243-4.243-2.121-2.121-4.243 4.243-4.243-4.243" fill-rule="evenodd"/></svg>\n      </span>\n    </div>\n    <div class="zammad-chat-agent zammad-chat-is-hidden">\n    </div>\n    <div class="zammad-chat-welcome">\n      <svg class="zammad-chat-icon" viewBox="0 0 24 24" width="24" height="24"><path d="M2 5C2 4 3 3 4 3h16c1 0 2 1 2 2v10C22 16 21 17 20 17H4C3 17 2 16 2 15V5zM12 17l6 4v-4h-6z"/></svg>\n      <span class="zammad-chat-welcome-text">'),n.push(this.T(this.title)),n.push('</span>\n    </div>\n  </div>\n  <div class="zammad-chat-modal"></div>\n  <div class="zammad-scroll-hint is-hidden">\n    <svg class="zammad-scroll-hint-icon" width="20" height="18" viewBox="0 0 20 18"><path d="M0,2.00585866 C0,0.898053512 0.898212381,0 1.99079514,0 L18.0092049,0 C19.1086907,0 20,0.897060126 20,2.00585866 L20,11.9941413 C20,13.1019465 19.1017876,14 18.0092049,14 L1.99079514,14 C0.891309342,14 0,13.1029399 0,11.9941413 L0,2.00585866 Z M10,14 L16,18 L16,14 L10,14 Z" fill-rule="evenodd"/></svg>\n    '),n.push(this.T(this.scrollHint)),n.push('\n  </div>\n  <div class="zammad-chat-body"></div>\n  <form class="zammad-chat-controls">\n    <div class="zammad-chat-input" rows="1" placeholder="'),n.push(this.T("Compose your message…")),n.push('" contenteditable="true"></div>\n    <button type="submit" class="zammad-chat-button zammad-chat-send"'),this.background&&n.push(t(" style='background: "+this.background+"'")),n.push(">"),n.push(this.T("Send")),n.push("</button>\n  </form>\n</div>")}.call(this)}.call(e),e.safe=o,e.escape=s,n.join("")},window.zammadChatTemplates||(window.zammadChatTemplates={}),window.zammadChatTemplates.customer_timeout=function(e){var t=[],n=(e=e||{}).safe,o=e.escape,o=(e.safe=function(e){return e&&e.ecoSafe?e:(void 0!==e&&null!=e||(e=""),(e=new String(e)).ecoSafe=!0,e)},o||(e.escape=function(e){return(""+e).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}));return function(){!function(){var e;t.push('<div class="zammad-chat-modal-text">\n  '),this.agent?(t.push("\n    "),t.push(this.T("Since you didn't respond in the last %s minutes your conversation with <strong>%s</strong> was closed.",this.delay,this.agent))):(t.push("\n    "),t.push(this.T("Since you didn't respond in the last %s minutes your conversation was closed.",this.delay))),t.push("\n  "),t.push('\n  <br>\n  <div class="zammad-chat-button js-restart"'),this.background&&t.push((e=" style='background: "+this.background+"'")&&e.ecoSafe?e:void 0!==e&&null!=e?o(e):""),t.push(">"),t.push(this.T("Start new conversation")),t.push("</div>\n</div>")}.call(this)}.call(e),e.safe=n,e.escape=o,t.join("")},window.zammadChatTemplates||(window.zammadChatTemplates={}),window.zammadChatTemplates.loader=function(e){var t=[],n=(e=e||{}).safe,o=e.escape,o=(e.safe=function(e){return e&&e.ecoSafe?e:(void 0!==e&&null!=e||(e=""),(e=new String(e)).ecoSafe=!0,e)},o||(e.escape=function(e){return(""+e).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}));return function(){!function(){t.push('<span class="zammad-chat-loading-animation">\n  <span class="zammad-chat-loading-circle"></span>\n  <span class="zammad-chat-loading-circle"></span>\n  <span class="zammad-chat-loading-circle"></span>\n</span>\n<span class="zammad-chat-modal-text">'),t.push(this.T("Connecting")),t.push("</span>")}.call(this)}.call(e),e.safe=n,e.escape=o,t.join("")},window.zammadChatTemplates||(window.zammadChatTemplates={}),window.zammadChatTemplates.message=function(e){function t(e){return e&&e.ecoSafe?e:void 0!==e&&null!=e?s(e):""}var n=[],o=(e=e||{}).safe,s=e.escape,s=(e.safe=function(e){return e&&e.ecoSafe?e:(void 0!==e&&null!=e||(e=""),(e=new String(e)).ecoSafe=!0,e)},s||(e.escape=function(e){return(""+e).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}));return function(){!function(){n.push('<div class="zammad-chat-message zammad-chat-message--'),n.push(t(this.from)),n.push(t(this.unreadClass)),n.push('">\n  <span class="zammad-chat-message-body"'),this.background&&"customer"===this.from&&n.push(t(" style='background: "+this.background+"'")),n.push(">"),n.push(this.message),n.push("</span>\n</div>")}.call(this)}.call(e),e.safe=o,e.escape=s,n.join("")},window.zammadChatTemplates||(window.zammadChatTemplates={}),window.zammadChatTemplates.status=function(e){var t=[],n=(e=e||{}).safe,o=e.escape,o=(e.safe=function(e){return e&&e.ecoSafe?e:(void 0!==e&&null!=e||(e=""),(e=new String(e)).ecoSafe=!0,e)},o||(e.escape=function(e){return(""+e).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}));return function(){!function(){t.push('<div class="zammad-chat-status">\n  <div class="zammad-chat-status-inner">\n    '),t.push(this.status),t.push("\n  </div>\n</div>")}.call(this)}.call(e),e.safe=n,e.escape=o,t.join("")},window.zammadChatTemplates||(window.zammadChatTemplates={}),window.zammadChatTemplates.timestamp=function(e){function t(e){return e&&e.ecoSafe?e:void 0!==e&&null!=e?s(e):""}var n=[],o=(e=e||{}).safe,s=e.escape,s=(e.safe=function(e){return e&&e.ecoSafe?e:(void 0!==e&&null!=e||(e=""),(e=new String(e)).ecoSafe=!0,e)},s||(e.escape=function(e){return(""+e).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}));return function(){!function(){n.push('<div class="zammad-chat-timestamp"><strong>'),n.push(t(this.label)),n.push("</strong> "),n.push(t(this.time)),n.push("</div>")}.call(this)}.call(e),e.safe=o,e.escape=s,n.join("")},window.zammadChatTemplates||(window.zammadChatTemplates={}),window.zammadChatTemplates.typingIndicator=function(e){var t=[],n=(e=e||{}).safe,o=e.escape,o=(e.safe=function(e){return e&&e.ecoSafe?e:(void 0!==e&&null!=e||(e=""),(e=new String(e)).ecoSafe=!0,e)},o||(e.escape=function(e){return(""+e).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}));return function(){!function(){t.push('<div class="zammad-chat-message zammad-chat-message--typing zammad-chat-message--agent">\n  <span class="zammad-chat-message-body">\n    <span class="zammad-chat-loading-animation">\n      <span class="zammad-chat-loading-circle"></span>\n      <span class="zammad-chat-loading-circle"></span>\n      <span class="zammad-chat-loading-circle"></span>\n    </span>\n  </span>\n</div>')}.call(this)}.call(e),e.safe=n,e.escape=o,t.join("")},window.zammadChatTemplates||(window.zammadChatTemplates={}),window.zammadChatTemplates.waiting_list_timeout=function(e){var t=[],n=(e=e||{}).safe,o=e.escape,o=(e.safe=function(e){return e&&e.ecoSafe?e:(void 0!==e&&null!=e||(e=""),(e=new String(e)).ecoSafe=!0,e)},o||(e.escape=function(e){return(""+e).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}));return function(){!function(){var e;t.push('<div class="zammad-chat-modal-text">\n  '),t.push(this.T("We are sorry, it is taking longer than expected to get a slot. Please try again later or send us an email. Thank you!")),t.push('\n  <br>\n  <div class="zammad-chat-button js-restart"'),this.background&&t.push((e=" style='background: "+this.background+"'")&&e.ecoSafe?e:void 0!==e&&null!=e?o(e):""),t.push(">"),t.push(this.T("Start new conversation")),t.push("</div>\n</div>")}.call(this)}.call(e),e.safe=n,e.escape=o,t.join("")},window.zammadChatTemplates||(window.zammadChatTemplates={}),window.zammadChatTemplates.waiting=function(e){var t=[],n=(e=e||{}).safe,o=e.escape,o=(e.safe=function(e){return e&&e.ecoSafe?e:(void 0!==e&&null!=e||(e=""),(e=new String(e)).ecoSafe=!0,e)},o||(e.escape=function(e){return(""+e).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}));return function(){!function(){t.push('<div class="zammad-chat-modal-text">\n  <span class="zammad-chat-loading-animation">\n    <span class="zammad-chat-loading-circle"></span>\n    <span class="zammad-chat-loading-circle"></span>\n    <span class="zammad-chat-loading-circle"></span>\n  </span>\n  '),t.push(this.T("All colleagues are busy.")),t.push("<br>\n  "),t.push(this.T("You are on waiting list position <strong>%s</strong>.",this.position)),t.push("\n</div>")}.call(this)}.call(e),e.safe=n,e.escape=o,t.join("")},function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e=e||self).DOMPurify=t()}(this,function(){"use strict";function Ie(){for(var e=arguments.length,t=Array(e),n=0;n<e;n++)t[n]=arguments[n];return u(o,t)}var o,s=Object.hasOwnProperty,i=Object.setPrototypeOf,a=Object.isFrozen,r=Object.getPrototypeOf,l=Object.getOwnPropertyDescriptor,_e=Object.freeze,e=Object.seal,c=Object.create,t="undefined"!=typeof Reflect&&Reflect,d=(d=t.apply)||function(e,t,n){return e.apply(t,n)},_e=_e||function(e){return e},e=e||function(e){return e},u=(u=t.construct)||function(e,t){return new(Function.prototype.bind.apply(e,[null].concat(function(e){if(Array.isArray(e)){for(var t=0,n=Array(e.length);t<e.length;t++)n[t]=e[t];return n}return Array.from(e)}(t))))},De=h(Array.prototype.forEach),Ee=h(Array.prototype.pop),Re=h(Array.prototype.push),Le=h(String.prototype.toLowerCase),Me=h(String.prototype.match),Ne=h(String.prototype.replace),Pe=h(String.prototype.indexOf),et=h(String.prototype.trim),Fe=h(RegExp.prototype.test);o=TypeError;function h(s){return function(e){for(var t=arguments.length,n=Array(1<t?t-1:0),o=1;o<t;o++)n[o-1]=arguments[o];return d(s,e,n)}}function He(e,t){i&&i(e,null);for(var n=t.length;n--;){var o,s=t[n];"string"!=typeof s||(o=Le(s))!==s&&(a(t)||(t[n]=o),s=o),e[s]=!0}return e}function Be(e){var t=c(null),n=void 0;for(n in e)d(s,e,[n])&&(t[n]=e[n]);return t}function We(e,t){for(;null!==e;){var n=l(e,t);if(n){if(n.get)return h(n.get);if("function"==typeof n.value)return h(n.value)}e=r(e)}return function(e){return console.warn("fallback value for",e),null}}var Ue=_e(["a","abbr","acronym","address","area","article","aside","audio","b","bdi","bdo","big","blink","blockquote","body","br","button","canvas","caption","center","cite","code","col","colgroup","content","data","datalist","dd","decorator","del","details","dfn","dialog","dir","div","dl","dt","element","em","fieldset","figcaption","figure","font","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","img","input","ins","kbd","label","legend","li","main","map","mark","marquee","menu","menuitem","meter","nav","nobr","ol","optgroup","option","output","p","picture","pre","progress","q","rp","rt","ruby","s","samp","section","select","shadow","small","source","spacer","span","strike","strong","style","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","time","tr","track","tt","u","ul","var","video","wbr"]),Ve=_e(["svg","a","altglyph","altglyphdef","altglyphitem","animatecolor","animatemotion","animatetransform","circle","clippath","defs","desc","ellipse","filter","font","g","glyph","glyphref","hkern","image","line","lineargradient","marker","mask","metadata","mpath","path","pattern","polygon","polyline","radialgradient","rect","stop","style","switch","symbol","text","textpath","title","tref","tspan","view","vkern"]),qe=_e(["feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence"]),tt=_e(["animate","color-profile","cursor","discard","fedropshadow","feimage","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","foreignobject","hatch","hatchpath","mesh","meshgradient","meshpatch","meshrow","missing-glyph","script","set","solidcolor","unknown","use"]),Qe=_e(["math","menclose","merror","mfenced","mfrac","mglyph","mi","mlabeledtr","mmultiscripts","mn","mo","mover","mpadded","mphantom","mroot","mrow","ms","mspace","msqrt","mstyle","msub","msup","msubsup","mtable","mtd","mtext","mtr","munder","munderover"]),nt=_e(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),Ye=_e(["#text"]),Ke=_e(["accept","action","align","alt","autocapitalize","autocomplete","autopictureinpicture","autoplay","background","bgcolor","border","capture","cellpadding","cellspacing","checked","cite","class","clear","color","cols","colspan","controls","controlslist","coords","crossorigin","datetime","decoding","default","dir","disabled","disablepictureinpicture","disableremoteplayback","download","draggable","enctype","enterkeyhint","face","for","headers","height","hidden","high","href","hreflang","id","inputmode","integrity","ismap","kind","label","lang","list","loading","loop","low","max","maxlength","media","method","min","minlength","multiple","muted","name","noshade","novalidate","nowrap","open","optimum","pattern","placeholder","playsinline","poster","preload","pubdate","radiogroup","readonly","rel","required","rev","reversed","role","rows","rowspan","spellcheck","scope","selected","shape","size","sizes","span","srclang","start","src","srcset","step","style","summary","tabindex","title","translate","type","usemap","valign","value","width","xmlns","slot"]),Ge=_e(["accent-height","accumulate","additive","alignment-baseline","ascent","attributename","attributetype","azimuth","basefrequency","baseline-shift","begin","bias","by","class","clip","clippathunits","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","cx","cy","d","dx","dy","diffuseconstant","direction","display","divisor","dur","edgemode","elevation","end","fill","fill-opacity","fill-rule","filter","filterunits","flood-color","flood-opacity","font-family","font-size","font-size-adjust","font-stretch","font-style","font-variant","font-weight","fx","fy","g1","g2","glyph-name","glyphref","gradientunits","gradienttransform","height","href","id","image-rendering","in","in2","k","k1","k2","k3","k4","kerning","keypoints","keysplines","keytimes","lang","lengthadjust","letter-spacing","kernelmatrix","kernelunitlength","lighting-color","local","marker-end","marker-mid","marker-start","markerheight","markerunits","markerwidth","maskcontentunits","maskunits","max","mask","media","method","mode","min","name","numoctaves","offset","operator","opacity","order","orient","orientation","origin","overflow","paint-order","path","pathlength","patterncontentunits","patterntransform","patternunits","points","preservealpha","preserveaspectratio","primitiveunits","r","rx","ry","radius","refx","refy","repeatcount","repeatdur","restart","result","rotate","scale","seed","shape-rendering","specularconstant","specularexponent","spreadmethod","startoffset","stddeviation","stitchtiles","stop-color","stop-opacity","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke","stroke-width","style","surfacescale","systemlanguage","tabindex","targetx","targety","transform","text-anchor","text-decoration","text-rendering","textlength","type","u1","u2","unicode","values","viewbox","visibility","version","vert-adv-y","vert-origin-x","vert-origin-y","width","word-spacing","wrap","writing-mode","xchannelselector","ychannelselector","x","x1","x2","xmlns","y","y1","y2","z","zoomandpan"]),Je=_e(["accent","accentunder","align","bevelled","close","columnsalign","columnlines","columnspan","denomalign","depth","dir","display","displaystyle","encoding","fence","frame","height","href","id","largeop","length","linethickness","lspace","lquote","mathbackground","mathcolor","mathsize","mathvariant","maxsize","minsize","movablelimits","notation","numalign","open","rowalign","rowlines","rowspacing","rowspan","rspace","rquote","scriptlevel","scriptminsize","scriptsizemultiplier","selection","separator","separators","stretchy","subscriptshift","supscriptshift","symmetric","voffset","width","xmlns"]),Ze=_e(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),ot=e(/\{\{[\s\S]*|[\s\S]*\}\}/gm),st=e(/<%[\s\S]*|[\s\S]*%>/gm),it=e(/^data-[\-\w.\u00B7-\uFFFF]/),at=e(/^aria-[\-\w]+$/),rt=e(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|cid|xmpp):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),lt=e(/^(?:\w+script|data):/i),ct=e(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),Xe="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e};function $e(e){if(Array.isArray(e)){for(var t=0,n=Array(e.length);t<e.length;t++)n[t]=e[t];return n}return Array.from(e)}return function L(){var r=0<arguments.length&&void 0!==arguments[0]?arguments[0]:"undefined"==typeof window?null:window,c=function(e){return L(e)};if(c.version="2.3.1",c.removed=[],!r||!r.document||9!==r.document.nodeType)return c.isSupported=!1,c;var l=r.document,s=r.document,M=r.DocumentFragment,e=r.HTMLTemplateElement,d=r.Node,N=r.Element,t=r.NodeFilter,n=r.NamedNodeMap,P=void 0===n?r.NamedNodeMap||r.MozNamedAttrMap:n,F=r.Text,H=r.Comment,B=r.DOMParser,n=r.trustedTypes,o=N.prototype,W=We(o,"cloneNode"),U=We(o,"nextSibling"),V=We(o,"childNodes"),a=We(o,"parentNode"),u=("function"!=typeof e||(o=s.createElement("template")).content&&o.content.ownerDocument&&(s=o.content.ownerDocument),function(e,t){if("object"!==(void 0===e?"undefined":Xe(e))||"function"!=typeof e.createPolicy)return null;var n=null,o="data-tt-policy-suffix",t="dompurify"+((n=t.currentScript&&t.currentScript.hasAttribute(o)?t.currentScript.getAttribute(o):n)?"#"+n:"");try{return e.createPolicy(t,{createHTML:function(e){return e}})}catch(e){return console.warn("TrustedTypes policy "+t+" could not be created."),null}}(n,l)),q=u&&A?u.createHTML(""):"",e=s,i=e.implementation,Q=e.createNodeIterator,Y=e.createDocumentFragment,K=e.getElementsByTagName,G=l.importNode,o={};try{o=Be(s).documentMode?s.documentMode:{}}catch(L){}function h(e){D&&D===e||(e=Be(e=e&&"object"===(void 0===e?"undefined":Xe(e))?e:{}),b="ALLOWED_TAGS"in e?He({},e.ALLOWED_TAGS):ae,w="ALLOWED_ATTR"in e?He({},e.ALLOWED_ATTR):re,we="ADD_URI_SAFE_ATTR"in e?He(Be(Te),e.ADD_URI_SAFE_ATTR):Te,ve="ADD_DATA_URI_TAGS"in e?He(Be(be),e.ADD_DATA_URI_TAGS):be,j="FORBID_CONTENTS"in e?He({},e.FORBID_CONTENTS):ye,T="FORBID_TAGS"in e?He({},e.FORBID_TAGS):{},le="FORBID_ATTR"in e?He({},e.FORBID_ATTR):{},O="USE_PROFILES"in e&&e.USE_PROFILES,ce=!1!==e.ALLOW_ARIA_ATTR,de=!1!==e.ALLOW_DATA_ATTR,ue=e.ALLOW_UNKNOWN_PROTOCOLS||!1,C=e.SAFE_FOR_TEMPLATES||!1,S=e.WHOLE_DOCUMENT||!1,z=e.RETURN_DOM||!1,k=e.RETURN_DOM_FRAGMENT||!1,me=!1!==e.RETURN_DOM_IMPORT,A=e.RETURN_TRUSTED_TYPE||!1,pe=e.FORCE_BODY||!1,ge=!1!==e.SANITIZE_DOM,fe=!1!==e.KEEP_CONTENT,x=e.IN_PLACE||!1,v=e.ALLOWED_URI_REGEXP||v,_=e.NAMESPACE||I,C&&(de=!1),k&&(z=!0),O&&(b=He({},[].concat($e(Ye))),w=[],!0===O.html&&(He(b,Ue),He(w,Ke)),!0===O.svg&&(He(b,Ve),He(w,Ge),He(w,Ze)),!0===O.svgFilters&&(He(b,qe),He(w,Ge),He(w,Ze)),!0===O.mathMl&&(He(b,Qe),He(w,Je),He(w,Ze))),e.ADD_TAGS&&He(b=b===ae?Be(b):b,e.ADD_TAGS),e.ADD_ATTR&&He(w=w===re?Be(w):w,e.ADD_ATTR),e.ADD_URI_SAFE_ATTR&&He(we,e.ADD_URI_SAFE_ATTR),e.FORBID_CONTENTS&&He(j=j===ye?Be(j):j,e.FORBID_CONTENTS),fe&&(b["#text"]=!0),S&&He(b,["html","head","body"]),b.table&&(He(b,["tbody"]),delete T.tbody),_e&&_e(e),D=e)}function p(t){Re(c.removed,{element:t});try{t.parentNode.removeChild(t)}catch(e){try{t.outerHTML=q}catch(e){t.remove()}}}function J(e){var t=void 0,n=void 0,o=(pe?e="<remove></remove>"+e:n=(o=Me(e,/^[\r\n\t ]+/))&&o[0],u?u.createHTML(e):e);if(_===I)try{t=(new B).parseFromString(o,"text/html")}catch(e){}if(!t||!t.documentElement){t=i.createDocument(_,"template",null);try{t.documentElement.innerHTML=te?"":o}catch(e){}}return o=t.body||t.documentElement,e&&n&&o.insertBefore(s.createTextNode(n),o.childNodes[0]||null),_===I?K.call(t,S?"html":"body")[0]:S?t.documentElement:o}function Z(e){return Q.call(e.ownerDocument||e,e,t.SHOW_ELEMENT|t.SHOW_COMMENT|t.SHOW_TEXT,null,!1)}function m(e){return"object"===(void 0===d?"undefined":Xe(d))?e instanceof d:e&&"object"===(void 0===e?"undefined":Xe(e))&&"number"==typeof e.nodeType&&"string"==typeof e.nodeName}function X(e){var t;if(R("beforeSanitizeElements",e,null),!((n=e)instanceof F||n instanceof H||"string"==typeof n.nodeName&&"string"==typeof n.textContent&&"function"==typeof n.removeChild&&n.attributes instanceof P&&"function"==typeof n.removeAttribute&&"function"==typeof n.setAttribute&&"string"==typeof n.namespaceURI&&"function"==typeof n.insertBefore))return p(e),1;if(Me(e.nodeName,/[\u0080-\uFFFF]/))return p(e),1;var n=Le(e.nodeName);if(R("uponSanitizeElement",e,{tagName:n,allowedTags:b}),!m(e.firstElementChild)&&(!m(e.content)||!m(e.content.firstElementChild))&&Fe(/<[/\w]/g,e.innerHTML)&&Fe(/<[/\w]/g,e.textContent))return p(e),1;if("select"===n&&Fe(/<template/i,e.innerHTML))return p(e),1;if(b[n]&&!T[n])return(!(e instanceof N)||function(e){var t=a(e),n=(t&&t.tagName||(t={namespaceURI:I,tagName:"template"}),Le(e.tagName)),o=Le(t.tagName);if(e.namespaceURI===Se)return t.namespaceURI===I?"svg"===n:t.namespaceURI===Ce?"svg"===n&&("annotation-xml"===o||ke[o]):Boolean(E[n]);if(e.namespaceURI===Ce)return t.namespaceURI===I?"math"===n:t.namespaceURI===Se?"math"===n&&Ae[o]:Boolean(xe[n]);if(e.namespaceURI!==I)return!1;if(t.namespaceURI===Se&&!Ae[o])return!1;if(t.namespaceURI===Ce&&!ke[o])return!1;e=He({},["title","style","font","a","script"]);return!xe[n]&&(e[n]||!E[n])}(e))&&("noscript"!==n&&"noembed"!==n||!Fe(/<\/no(script|embed)/i,e.innerHTML))?(C&&3===e.nodeType&&(t=e.textContent,t=Ne(t,f," "),t=Ne(t,y," "),e.textContent!==t&&(Re(c.removed,{element:e.cloneNode()}),e.textContent=t)),R("afterSanitizeElements",e,null),!1):(p(e),!0);if(fe&&!j[n]){var o=a(e)||e.parentNode,s=V(e)||e.childNodes;if(s&&o)for(var i=s.length-1;0<=i;--i)o.insertBefore(W(s[i],!0),U(e))}return p(e),1}function $(e){var t=void 0,n=void 0,o=(R("beforeSanitizeAttributes",e,null),e.attributes);if(o){for(var s={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:w},n=o.length;n--;){r=o[n];var i=r.name,a=r.namespaceURI,t=et(r.value),r=Le(i);if(s.attrName=r,s.attrValue=t,s.keepAttr=!0,s.forceKeepAttr=void 0,R("uponSanitizeAttribute",e,s),t=s.attrValue,!s.forceKeepAttr&&(Oe(i,e),s.keepAttr))if(Fe(/\/>/i,t))Oe(i,e);else{C&&(t=Ne(t,f," "),t=Ne(t,y," "));var l=e.nodeName.toLowerCase();if(je(l,r,t))try{a?e.setAttributeNS(a,i,t):e.setAttribute(i,t),Ee(c.removed)}catch(e){}}}R("afterSanitizeAttributes",e,null)}}function ee(e){var t,n=Z(e);for(R("beforeSanitizeShadowDOM",e,null);t=n.nextNode();)R("uponSanitizeShadowNode",t,null),X(t)||(t.content instanceof M&&ee(t.content),$(t));R("afterSanitizeShadowDOM",e,null)}var te,g={},f=(c.isSupported="function"==typeof a&&i&&void 0!==i.createHTMLDocument&&9!==o,ot),y=st,ne=it,oe=at,se=lt,ie=ct,v=rt,b=null,ae=He({},[].concat($e(Ue),$e(Ve),$e(qe),$e(Qe),$e(Ye))),w=null,re=He({},[].concat($e(Ke),$e(Ge),$e(Je),$e(Ze))),T=null,le=null,ce=!0,de=!0,ue=!1,C=!1,S=!1,he=!1,pe=!1,z=!1,k=!1,me=!0,A=!1,ge=!0,fe=!0,x=!1,O={},j=null,ye=He({},["annotation-xml","audio","colgroup","desc","foreignobject","head","iframe","math","mi","mn","mo","ms","mtext","noembed","noframes","noscript","plaintext","script","style","svg","template","thead","title","video","xmp"]),ve=null,be=He({},["audio","video","img","source","image","track"]),we=null,Te=He({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),Ce="http://www.w3.org/1998/Math/MathML",Se="http://www.w3.org/2000/svg",I="http://www.w3.org/1999/xhtml",_=I,D=null,ze=s.createElement("form"),ke=He({},["mi","mo","mn","ms","mtext"]),Ae=He({},["foreignobject","desc","title","annotation-xml"]),E=He({},Ve),xe=(He(E,qe),He(E,tt),He({},Qe)),Oe=(He(xe,nt),function(e,t){try{Re(c.removed,{attribute:t.getAttributeNode(e),from:t})}catch(e){Re(c.removed,{attribute:null,from:t})}if(t.removeAttribute(e),"is"===e&&!w[e])if(z||k)try{p(t)}catch(e){}else try{t.setAttribute(e,"")}catch(e){}}),R=function(e,t,n){g[e]&&De(g[e],function(e){e.call(c,t,n,D)})},je=function(e,t,n){if(ge&&("id"===t||"name"===t)&&(n in s||n in ze))return!1;if((!de||le[t]||!Fe(ne,t))&&(!ce||!Fe(oe,t))){if(!w[t]||le[t])return!1;if(!we[t]&&!Fe(v,Ne(n,ie,""))&&("src"!==t&&"xlink:href"!==t&&"href"!==t||"script"===e||0!==Pe(n,"data:")||!ve[e])&&(!ue||Fe(se,Ne(n,ie,"")))&&n)return!1}return!0};return c.sanitize=function(e,t){var n,o=void 0,s=void 0,i=void 0;if("string"!=typeof(e=(te=!e)?"\x3c!--\x3e":e)&&!m(e)){if("function"!=typeof e.toString)throw Ie("toString is not a function");if("string"!=typeof(e=e.toString()))throw Ie("dirty is not a string, aborting")}if(!c.isSupported){if("object"===Xe(r.toStaticHTML)||"function"==typeof r.toStaticHTML){if("string"==typeof e)return r.toStaticHTML(e);if(m(e))return r.toStaticHTML(e.outerHTML)}return e}if(he||h(t),c.removed=[],!(x="string"==typeof e?!1:x))if(e instanceof d)1===(t=(o=J("\x3c!----\x3e")).ownerDocument.importNode(e,!0)).nodeType&&"BODY"===t.nodeName||"HTML"===t.nodeName?o=t:o.appendChild(t);else{if(!z&&!C&&!S&&-1===e.indexOf("<"))return u&&A?u.createHTML(e):e;if(!(o=J(e)))return z?null:q}o&&pe&&p(o.firstChild);for(var a=Z(x?e:o);n=a.nextNode();)3===n.nodeType&&n===s||X(n)||(n.content instanceof M&&ee(n.content),$(n),s=n);if(s=null,x)return e;if(z){if(k)for(i=Y.call(o.ownerDocument);o.firstChild;)i.appendChild(o.firstChild);else i=o;return i=me?G.call(l,i,!0):i}t=S?o.outerHTML:o.innerHTML;return C&&(t=Ne(t,f," "),t=Ne(t,y," ")),u&&A?u.createHTML(t):t},c.setConfig=function(e){h(e),he=!0},c.clearConfig=function(){D=null,he=!1},c.isValidAttribute=function(e,t,n){D||h({});e=Le(e),t=Le(t);return je(e,t,n)},c.addHook=function(e,t){"function"==typeof t&&(g[e]=g[e]||[],Re(g[e],t))},c.removeHook=function(e){g[e]&&Ee(g[e])},c.removeHooks=function(e){g[e]&&(g[e]=[])},c.removeAllHooks=function(){g={}},c}()});var bind=function(e,t){return function(){return e.apply(t,arguments)}},slice=[].slice,extend=function(e,t){for(var n in t)hasProp.call(t,n)&&(e[n]=t[n]);function o(){this.constructor=e}return o.prototype=t.prototype,e.prototype=new o,e.__super__=t.prototype,e},hasProp={}.hasOwnProperty;!function(h,p){var t,n,o,s,i,e;function a(e){this.options=h.extend({},this.defaults,e),this.log=new n({debug:this.options.debug,logPrefix:this.options.logPrefix||this.logPrefix})}function r(e){this.log=bind(this.log,this),this.error=bind(this.error,this),this.notice=bind(this.notice,this),this.debug=bind(this.debug,this),this.options=h.extend({},this.defaults,e)}function l(e){this.stop=bind(this.stop,this),this.start=bind(this.start,this),l.__super__.constructor.call(this,e)}function c(e){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),c.__super__.constructor.call(this,e)}function d(e){if(this.removeAttributes=bind(this.removeAttributes,this),this.startTimeoutObservers=bind(this.startTimeoutObservers,this),this.onCssLoaded=bind(this.onCssLoaded,this),this.setAgentOnlineState=bind(this.setAgentOnlineState,this),this.onConnectionEstablished=bind(this.onConnectionEstablished,this),this.setSessionId=bind(this.setSessionId,this),this.onConnectionReestablished=bind(this.onConnectionReestablished,this),this.reconnect=bind(this.reconnect,this),this.destroy=bind(this.destroy,this),this.onScrollHintClick=bind(this.onScrollHintClick,this),this.detectScrolledtoBottom=bind(this.detectScrolledtoBottom,this),this.onLeaveTemporary=bind(this.onLeaveTemporary,this),this.onAgentTypingEnd=bind(this.onAgentTypingEnd,this),this.onAgentTypingStart=bind(this.onAgentTypingStart,this),this.onQueue=bind(this.onQueue,this),this.onQueueScreen=bind(this.onQueueScreen,this),this.onWebSocketClose=bind(this.onWebSocketClose,this),this.onCloseAnimationEnd=bind(this.onCloseAnimationEnd,this),this.close=bind(this.close,this),this.toggle=bind(this.toggle,this),this.sessionClose=bind(this.sessionClose,this),this.onOpenAnimationEnd=bind(this.onOpenAnimationEnd,this),this.open=bind(this.open,this),this.renderMessage=bind(this.renderMessage,this),this.receiveMessage=bind(this.receiveMessage,this),this.onSubmit=bind(this.onSubmit,this),this.onFocus=bind(this.onFocus,this),this.onInput=bind(this.onInput,this),this.onReopenSession=bind(this.onReopenSession,this),this.onError=bind(this.onError,this),this.onWebSocketMessage=bind(this.onWebSocketMessage,this),this.send=bind(this.send,this),this.checkForEnter=bind(this.checkForEnter,this),this.render=bind(this.render,this),this.view=bind(this.view,this),this.T=bind(this.T,this),this.options=h.extend({},this.defaults,e),d.__super__.constructor.call(this,this.options),this.isFullscreen=p.matchMedia&&p.matchMedia("(max-width: 768px)").matches,this.scrollRoot=h(this.getScrollRoot()),h)return p.WebSocket&&sessionStorage?this.options.chatId?(this.options.lang||(this.options.lang=h("html").attr("lang")),this.options.lang&&(this.translations[this.options.lang]||(this.log.debug("lang: No "+this.options.lang+" found, try first two letters"),this.options.lang=this.options.lang.replace(/-.+?$/,"")),this.log.debug("lang: "+this.options.lang)),this.options.host||this.detectHost(),this.loadCss(),this.io=new t(this.options),this.io.set({onOpen:this.render,onClose:this.onWebSocketClose,onMessage:this.onWebSocketMessage,onError:this.onError}),void this.io.connect()):(this.state="unsupported",void this.log.error("Chat: need chatId as option!")):(this.state="unsupported",void this.log.notice("Chat: Browser not supported!"));this.state="unsupported",this.log.notice("Chat: no jquery found!")}e=(e=document.getElementsByTagName("script"))[e.length-1],i=p.location.protocol.replace(":",""),e&&e.src&&(s=e.src.match(".*://([^:/]*).*")[1],i=e.src.match("(.*)://[^:/]*.*")[1]),a.prototype.defaults={debug:!1},e=a,r.prototype.defaults={debug:!1},r.prototype.debug=function(){var e=1<=arguments.length?slice.call(arguments,0):[];if(this.options.debug)return this.log("debug",e)},r.prototype.notice=function(){var e=1<=arguments.length?slice.call(arguments,0):[];return this.log("notice",e)},r.prototype.error=function(){var e=1<=arguments.length?slice.call(arguments,0):[];return this.log("error",e)},r.prototype.log=function(e,t){var n,o,s,i;if(t.unshift("||"),t.unshift(e),t.unshift(this.options.logPrefix),console.log.apply(console,t),this.options.debug){for(i="",o=0,s=t.length;o<s;o++)i+=" ","object"==typeof(n=t[o])?i+=JSON.stringify(n):n&&n.toString?i+=n.toString():i+=n;return h(".js-chatLogDisplay").prepend("<div>"+i+"</div>")}},n=r,extend(l,e),l.prototype.timeoutStartedAt=null,l.prototype.logPrefix="timeout",l.prototype.defaults={debug:!1,timeout:4,timeoutIntervallCheck:.5},l.prototype.start=function(){var e,t,n;return this.stop(),t=new Date,e=function(){var e=new Date-new Date(t.getTime()+1e3*n.options.timeout*60);if(n.log.debug("Timeout check for "+n.options.timeout+" minutes (left "+e/1e3+" sec.)"),!(e<0))return n.stop(),n.options.callback()},(n=this).log.debug("Start timeout in "+this.options.timeout+" minutes"),this.intervallId=setInterval(e,1e3*this.options.timeoutIntervallCheck*60)},l.prototype.stop=function(){if(this.intervallId)return this.log.debug("Stop timeout of "+this.options.timeout+" minutes"),clearInterval(this.intervallId)},o=l,extend(c,e),c.prototype.logPrefix="io",c.prototype.set=function(e){var t,n,o=[];for(t in e)n=e[t],o.push(this.options[t]=n);return o},c.prototype.connect=function(){var t,s,n,o;return this.log.debug("Connecting to "+this.options.host),this.ws=new p.WebSocket(""+this.options.host),this.ws.onopen=(t=this,function(e){return t.log.debug("onOpen",e),t.options.onOpen(e),t.ping()}),this.ws.onmessage=(s=this,function(e){var t,n,o=JSON.parse(e.data);for(s.log.debug("onMessage",e.data),t=0,n=o.length;t<n;t++)"pong"===o[t].event&&s.ping();if(s.options.onMessage)return s.options.onMessage(o)}),this.ws.onclose=(n=this,function(e){if(n.log.debug("close websocket connection",e),n.pingDelayId&&clearTimeout(n.pingDelayId),n.manualClose){if(n.log.debug("manual close, onClose callback"),n.manualClose=!1,n.options.onClose)return n.options.onClose(e)}else if(n.log.debug("error close, onError callback"),n.options.onError)return n.options.onError("Connection lost...")}),this.ws.onerror=(o=this,function(e){if(o.log.debug("onError",e),o.options.onError)return o.options.onError(e)})},c.prototype.close=function(){return this.log.debug("close websocket manually"),this.manualClose=!0,this.ws.close()},c.prototype.reconnect=function(){return this.log.debug("reconnect"),this.close(),this.connect()},c.prototype.send=function(e,t){return this.log.debug("send",e,t=null==t?{}:t),e=JSON.stringify({event:e,data:t}),this.ws.send(e)},c.prototype.ping=function(){var e;return(e=this).pingDelayId=setTimeout(function(){return e.send("ping")},29e3)},t=c,extend(d,e),d.prototype.defaults={chatId:void 0,show:!0,target:h("body"),host:"",debug:!1,flat:!1,lang:void 0,cssAutoload:!0,cssUrl:void 0,fontSize:void 0,buttonClass:"open-zammad-chat",inactiveClass:"is-inactive",title:"<strong>Chat</strong> with us!",scrollHint:"Scroll down to see new messages",idleTimeout:6,idleTimeoutIntervallCheck:.5,inactiveTimeout:8,inactiveTimeoutIntervallCheck:.5,waitingListTimeout:4,waitingListTimeoutIntervallCheck:.5,onReady:void 0,onCloseAnimationEnd:void 0,onError:void 0,onOpenAnimationEnd:void 0,onConnectionReestablished:void 0,onSessionClosed:void 0,onConnectionEstablished:void 0,onCssLoaded:void 0},d.prototype.logPrefix="chat",d.prototype._messageCount=0,d.prototype.isOpen=!1,d.prototype.blinkOnlineInterval=null,d.prototype.stopBlinOnlineStateTimeout=null,d.prototype.showTimeEveryXMinutes=2,d.prototype.lastTimestamp=null,d.prototype.lastAddedType=null,d.prototype.inputDisabled=!1,d.prototype.inputTimeout=null,d.prototype.isTyping=!1,d.prototype.state="offline",d.prototype.initialQueueDelay=1e4,d.prototype.translations={cs:{"<strong>Chat</strong> with us!":"<strong>Chatujte</strong> s námi!","All colleagues are busy.":"Všichni kolegové jsou vytíženi.","Chat closed by %s":"%s ukončil konverzaci","Compose your message…":"Napište svou zprávu…",Connecting:"Připojování","Connection lost":"Připojení ztraceno","Connection re-established":"Připojení obnoveno",Offline:"Offline",Online:"Online","Scroll down to see new messages":"Srolujte dolů pro zobrazení nových zpráv",Send:"Odeslat","Since you didn't respond in the last %s minutes your conversation was closed.":"Jelikož jste nereagovali v posledních %s minutách, vaše konverzace byla uzavřena.","Since you didn't respond in the last %s minutes your conversation with <strong>%s</strong> was closed.":"Jelikož jste nereagovali v posledních %s minutách, vaše konverzace s <strong>%s</strong> byla uzavřena.","Start new conversation":"Zahájit novou konverzaci",Today:"Dnes","We are sorry, it is taking longer than expected to get a slot. Please try again later or send us an email. Thank you!":"Omlouváme se, že musíte čekat déle, než je vhodné pro získání slotu. Prosím, zkuste to později, případně nám napište e-mail. Děkujeme!","You are on waiting list position <strong>%s</strong>.":"Jste <strong>%s</strong>. v pořadí na čekací listině."},da:{"<strong>Chat</strong> with us!":"<strong>Chat</strong> med os!","All colleagues are busy.":"Alle medarbejdere er optaget.","Chat closed by %s":"Chat lukket af %s","Compose your message…":"Skriv din besked…",Connecting:"Forbinder","Connection lost":"Forbindelse mistet","Connection re-established":"Forbindelse genoprettet",Offline:"Offline",Online:"Online","Scroll down to see new messages":"Scroll ned for at se nye beskeder",Send:"Afsend","Since you didn't respond in the last %s minutes your conversation was closed.":"","Since you didn't respond in the last %s minutes your conversation with <strong>%s</strong> was closed.":"","Start new conversation":"Start en ny samtale",Today:"I dag","We are sorry, it is taking longer than expected to get a slot. Please try again later or send us an email. Thank you!":"","You are on waiting list position <strong>%s</strong>.":"Du er i kø som nummer <strong>%s</strong>."},de:{"<strong>Chat</strong> with us!":"<strong>Chatte</strong> mit uns!","All colleagues are busy.":"Alle Kollegen sind beschäftigt.","Chat closed by %s":"Chat von %s geschlossen","Compose your message…":"Verfassen Sie Ihre Nachricht…",Connecting:"Verbinde","Connection lost":"Verbindung verloren","Connection re-established":"Verbindung wieder aufgebaut",Offline:"Offline",Online:"Online","Scroll down to see new messages":"Nach unten scrollen um neue Nachrichten zu sehen",Send:"Senden","Since you didn't respond in the last %s minutes your conversation was closed.":"Da Sie innerhalb der letzten %s Minuten nicht reagiert haben, wurde Ihre Unterhaltung geschlossen.","Since you didn't respond in the last %s minutes your conversation with <strong>%s</strong> was closed.":"Da Sie innerhalb der letzten %s Minuten nicht reagiert haben, wurde Ihre Unterhaltung mit <strong>%s</strong> geschlossen.","Start new conversation":"Neue Unterhaltung starten",Today:"Heute","We are sorry, it is taking longer than expected to get a slot. Please try again later or send us an email. Thank you!":"Entschuldigung, es dauert länger als erwartet einen freien Platz zu bekommen. Versuchen Sie es später erneut oder senden Sie uns eine E-Mail. Vielen Dank!","You are on waiting list position <strong>%s</strong>.":"Sie sind in der Warteliste auf Position <strong>%s</strong>."},es:{"<strong>Chat</strong> with us!":"<strong>Chatee</strong> con nosotros!","All colleagues are busy.":"Todos los colegas están ocupados.","Chat closed by %s":"Chat cerrado por %s","Compose your message…":"Escribe tu mensaje…",Connecting:"Conectando","Connection lost":"Conexión perdida","Connection re-established":"Conexión reestablecida",Offline:"Desconectado",Online:"En línea","Scroll down to see new messages":"Desplace hacia abajo para ver nuevos mensajes",Send:"Enviar","Since you didn't respond in the last %s minutes your conversation was closed.":"Debido a que usted no ha respondido en los últimos %s minutos, su conversación se ha cerrado.","Since you didn't respond in the last %s minutes your conversation with <strong>%s</strong> was closed.":"Debido a que usted no ha respondido en los últimos %s minutos, su conversación con <strong>%s</strong> se ha cerrado.","Start new conversation":"Iniciar nueva conversación",Today:"Hoy","We are sorry, it is taking longer than expected to get a slot. Please try again later or send us an email. Thank you!":"Lo sentimos, estamos tardando más de lo esperado para asignar un agente. Inténtelo de nuevo más tarde o envíenos un correo electrónico. ¡Gracias!","You are on waiting list position <strong>%s</strong>.":"Usted está en la posición <strong>%s</strong> de la lista de espera."},fr:{"<strong>Chat</strong> with us!":"<strong>Chattez</strong> avec nous !","All colleagues are busy.":"Tous les agents sont occupés.","Chat closed by %s":"Chat fermé par %s","Compose your message…":"Écrivez votre message…",Connecting:"Connexion","Connection lost":"Connexion perdue","Connection re-established":"Connexion ré-établie",Offline:"Hors-ligne",Online:"En ligne","Scroll down to see new messages":"Défiler vers le bas pour voir les nouveaux messages",Send:"Envoyer","Since you didn't respond in the last %s minutes your conversation was closed.":"Sans réponse de votre part depuis %s minutes, votre conservation a été fermée.","Since you didn't respond in the last %s minutes your conversation with <strong>%s</strong> was closed.":"Sans réponse de votre part depuis %s minutes, votre conversation avec <strong>%s</strong> a été fermée.","Start new conversation":"Démarrer une nouvelle conversation",Today:"Aujourd'hui","We are sorry, it is taking longer than expected to get a slot. Please try again later or send us an email. Thank you!":"Nous sommes désolés, trouver un agent disponible prend plus de temps que prévu. Réessayez plus tard ou envoyez-nous un mail. Merci !","You are on waiting list position <strong>%s</strong>.":"Vous êtes actuellement en position <strong>%s</strong> dans la file d'attente."},hr:{"<strong>Chat</strong> with us!":"<strong>Čavrljajte</strong> sa nama!","All colleagues are busy.":"Svi kolege su zauzeti.","Chat closed by %s":"%s zatvara chat","Compose your message…":"Sastavite poruku…",Connecting:"Povezivanje","Connection lost":"Veza prekinuta","Connection re-established":"Veza je ponovno uspostavljena",Offline:"Odsutan",Online:"Dostupan(a)","Scroll down to see new messages":"Pomaknite se prema dolje da biste vidjeli nove poruke",Send:"Šalji","Since you didn't respond in the last %s minutes your conversation was closed.":"Budući da niste odgovorili u posljednjih %s minuta, Vaš je razgovor zatvoren.","Since you didn't respond in the last %s minutes your conversation with <strong>%s</strong> was closed.":"Budući da niste odgovorili u posljednjih %s minuta, Vaš je razgovor s <strong>%</strong>s zatvoren.","Start new conversation":"Započni novi razgovor",Today:"Danas","We are sorry, it is taking longer than expected to get a slot. Please try again later or send us an email. Thank you!":"Oprostite, proces traje duže nego što se očekivalo da biste dobili slobodan termin. Molimo, pokušajte ponovno kasnije ili nam pošaljite e-mail. Hvala!","You are on waiting list position <strong>%s</strong>.":"Nalazite se u redu čekanja na poziciji <strong>%s</strong>."},hu:{"<strong>Chat</strong> with us!":"<strong>Csevegjen</strong> velünk!","All colleagues are busy.":"Minden munkatársunk foglalt.","Chat closed by %s":"A csevegés %s által lezárva","Compose your message…":"Fogalmazza meg üzenetét…",Connecting:"Csatlakozás","Connection lost":"A kapcsolat megszakadt","Connection re-established":"A kapcsolat helyreállt",Offline:"Offline",Online:"Online","Scroll down to see new messages":"Görgessen lefelé az új üzenetek megtekintéséhez",Send:"Küldés","Since you didn't respond in the last %s minutes your conversation was closed.":"Mivel az elmúlt %s percben nem válaszolt, a beszélgetése lezárásra került.","Since you didn't respond in the last %s minutes your conversation with <strong>%s</strong> was closed.":"Mivel az elmúlt %s percben nem válaszolt, <strong>%s</strong> munkatársunkkal folytatott beszélgetését lezártuk.","Start new conversation":"Új beszélgetés indítása",Today:"Ma","We are sorry, it is taking longer than expected to get a slot. Please try again later or send us an email. Thank you!":"Sajnáljuk, hogy a vártnál hosszabb ideig tart a helyfoglalás. Kérjük, próbálja meg később újra, vagy küldjön nekünk egy e-mailt. Köszönjük!","You are on waiting list position <strong>%s</strong>.":"Ön a várólistán a <strong>%s</strong> helyen szerepel."},it:{"<strong>Chat</strong> with us!":"<strong>Chatta</strong> con noi!","All colleagues are busy.":"Tutti i colleghi sono occupati.","Chat closed by %s":"Chat chiusa da %s","Compose your message…":"Scrivi il tuo messaggio…",Connecting:"Connessione in corso","Connection lost":"Connessione persa","Connection re-established":"Connessione ristabilita",Offline:"Offline",Online:"Online","Scroll down to see new messages":"Scorri verso il basso per vedere i nuovi messaggi",Send:"Invia","Since you didn't respond in the last %s minutes your conversation was closed.":"Dato che non hai risposto negli ultimi %s minuti, la conversazione è stata chiusa.","Since you didn't respond in the last %s minutes your conversation with <strong>%s</strong> was closed.":"Dato che non hai risposto negli ultimi %s minuti, la conversazione con <strong>%s</strong> è stata chiusa.","Start new conversation":"Avvia una nuova chat",Today:"Oggi","We are sorry, it is taking longer than expected to get a slot. Please try again later or send us an email. Thank you!":"Siamo spiacenti, ci vuole più tempo del previsto per ottenere uno spazio libero. Riprova più tardi o inviaci un'e-mail. Grazie!","You are on waiting list position <strong>%s</strong>.":"Sei alla posizione <strong>%s</strong> della lista di attesa."},lt:{"<strong>Chat</strong> with us!":"<strong>Kalbėkitės</strong> su mumis!","All colleagues are busy.":"Visi kolegos užimti.","Chat closed by %s":"%s uždarė pokalbį","Compose your message…":"Rašykite žinutę…",Connecting:"Jungiamasi","Connection lost":"Dingo ryšys","Connection re-established":"Ryšys atnaujintas",Offline:"Atsijungęs",Online:"Prisijungęs","Scroll down to see new messages":"Naujos žinutės žemiau",Send:"Siųsti","Since you didn't respond in the last %s minutes your conversation was closed.":"Jūsų pokalbis buvo uždarytas, nes nieko neatsakėte per %s minučių.","Since you didn't respond in the last %s minutes your conversation with <strong>%s</strong> was closed.":"Jūsų pokalbis su <strong>%s</strong> buvo uždarytas, nes nieko neatsakėte per %s minučių.","Start new conversation":"Pradėti naują pokalbį",Today:"Šiandien","We are sorry, it is taking longer than expected to get a slot. Please try again later or send us an email. Thank you!":"Atsiprašome, kad tenka laukti atskymo. Bandykite vėliau arba rašykite el. paštu. Ačiū!","You are on waiting list position <strong>%s</strong>.":"Esate <strong>%s</strong> eilėje."},nl:{"<strong>Chat</strong> with us!":"<strong>Chat</strong> met ons!","All colleagues are busy.":"Alle collega's zijn bezet.","Chat closed by %s":"Chat gesloten door %s","Compose your message…":"Stel je bericht op…",Connecting:"Verbinden","Connection lost":"Verbinding verbroken","Connection re-established":"Verbinding hersteld",Offline:"Offline",Online:"Online","Scroll down to see new messages":"Scroll naar beneden om nieuwe tickets te bekijken",Send:"Verstuur","Since you didn't respond in the last %s minutes your conversation was closed.":"De chat is afgesloten omdat je de laatste %s minuten niet hebt gereageerd.","Since you didn't respond in the last %s minutes your conversation with <strong>%s</strong> was closed.":"Je chat met <strong>%s</strong> is afgesloten omdat je niet hebt gereageerd in de laatste %s minuten.","Start new conversation":"Nieuw gesprek starten",Today:"Vandaag","We are sorry, it is taking longer than expected to get a slot. Please try again later or send us an email. Thank you!":"Het spijt ons, het duurt langer dan verwacht om een chat te starten. Probeer het later nog eens of stuur ons een e-mail. Bedankt!","You are on waiting list position <strong>%s</strong>.":"Je bevindt zich op wachtlijstpositie <strong>%s</strong>."},pl:{"<strong>Chat</strong> with us!":"<strong>Czatuj</strong> z nami!","All colleagues are busy.":"Wszyscy agenci są zajęci.","Chat closed by %s":"Chat zamknięty przez %s","Compose your message…":"Skomponuj swoją wiadomość…",Connecting:"Łączenie","Connection lost":"Utracono połączenie","Connection re-established":"Ponowne nawiązanie połączenia",Offline:"Offline",Online:"Online","Scroll down to see new messages":"Skroluj w dół, aby zobaczyć wiadomości",Send:"Wyślij","Since you didn't respond in the last %s minutes your conversation was closed.":"Ponieważ nie odpowiedziałeś w ciągu ostatnich %s minut, Twoja rozmowa została zamknięta.","Since you didn't respond in the last %s minutes your conversation with <strong>%s</strong> was closed.":"Ponieważ nie odpowiedziałeś w ciągu ostatnich %s minut, Twoja rozmowa z <strong>%s</strong> została zamknięta.","Start new conversation":"Rozpocznij nową rozmowę",Today:"Dzisiaj","We are sorry, it is taking longer than expected to get a slot. Please try again later or send us an email. Thank you!":"Przepraszamy, znalezienie wolnego konsultanta zajmuje więcej czasu niż oczekiwano. Spróbuj ponownie później lub wyślij nam e-mail. Dziękujemy!","You are on waiting list position <strong>%s</strong>.":"Jesteś na pozycji listy oczekujących <strong>%s</strong>."},"pt-br":{"<strong>Chat</strong> with us!":"<strong>Converse</strong> conosco!","All colleagues are busy.":"Nossos atendentes estão ocupados.","Chat closed by %s":"Chat encerrado por %s","Compose your message…":"Escreva sua mensagem…",Connecting:"Conectando","Connection lost":"Conexão perdida","Connection re-established":"Conexão restabelecida",Offline:"Desconectado",Online:"Online","Scroll down to see new messages":"Rolar para baixo para ver novas mensagems",Send:"Enviar","Since you didn't respond in the last %s minutes your conversation was closed.":"Como você não respondeu nos últimos %s minutos, sua conversa foi encerrada.","Since you didn't respond in the last %s minutes your conversation with <strong>%s</strong> was closed.":"Como você não respondeu nos últimos %s minutos, sua conversa com <strong>%s</strong> foi encerrada.","Start new conversation":"Iniciar uma nova conversa",Today:"Hoje","We are sorry, it is taking longer than expected to get a slot. Please try again later or send us an email. Thank you!":"Lamentamos, está demorando mais do que o esperado para conseguir uma vaga. Tente novamente mais tarde ou envie-nos um e-mail. Obrigado!","You are on waiting list position <strong>%s</strong>.":"Você está na posição <strong>%s</strong> da lista de espera."},ru:{"<strong>Chat</strong> with us!":"<strong>Напишите</strong> нам!","All colleagues are busy.":"Все коллеги заняты.","Chat closed by %s":"Чат закрыт %s","Compose your message…":"Составьте сообщение…",Connecting:"Подключение","Connection lost":"Подключение потеряно","Connection re-established":"Подключение восстановлено",Offline:"Оффлайн",Online:"В сети","Scroll down to see new messages":"Прокрутите вниз, чтобы увидеть новые сообщения",Send:"Отправить","Since you didn't respond in the last %s minutes your conversation was closed.":"","Since you didn't respond in the last %s minutes your conversation with <strong>%s</strong> was closed.":"","Start new conversation":"Начать новую беседу",Today:"Сегодня","We are sorry, it is taking longer than expected to get a slot. Please try again later or send us an email. Thank you!":"","You are on waiting list position <strong>%s</strong>.":"Вы находитесь в списке ожидания <strong>%s</strong>."},sr:{"<strong>Chat</strong> with us!":"<strong>Ћаскајте</strong> са нама!","All colleagues are busy.":"Све колеге су заузете.","Chat closed by %s":"Ћаскање затворено од стране %s","Compose your message…":"Напишите поруку…",Connecting:"Повезивање","Connection lost":"Веза је изгубљена","Connection re-established":"Веза је поново успостављена",Offline:"Одсутан(а)",Online:"Доступан(а)","Scroll down to see new messages":"Скролујте на доле за нове поруке",Send:"Пошаљи","Since you didn't respond in the last %s minutes your conversation was closed.":"Пошто нисте одговорили у последњих %s минут(a), ваш разговор је завршен.","Since you didn't respond in the last %s minutes your conversation with <strong>%s</strong> was closed.":"Пошто нисте одговорили у последњих %s минут(a), ваш разговор са <strong>%s</strong> је завршен.","Start new conversation":"Започни нови разговор",Today:"Данас","We are sorry, it is taking longer than expected to get a slot. Please try again later or send us an email. Thank you!":"Жао нам је, добијање празног термина траје дуже од очекиваног. Молимо покушајте поново касније или нам пошаљите имејл поруку. Хвала вам!","You are on waiting list position <strong>%s</strong>.":"Ви сте тренутно <strong>%s.</strong> у реду за чекање."},"sr-latn-rs":{"<strong>Chat</strong> with us!":"<strong>Ćaskajte</strong> sa nama!","All colleagues are busy.":"Sve kolege su zauzete.","Chat closed by %s":"Ćaskanje zatvoreno od strane %s","Compose your message…":"Napišite poruku…",Connecting:"Povezivanje","Connection lost":"Veza je izgubljena","Connection re-established":"Veza je ponovo uspostavljena",Offline:"Odsutan(a)",Online:"Dostupan(a)","Scroll down to see new messages":"Skrolujte na dole za nove poruke",Send:"Pošalji","Since you didn't respond in the last %s minutes your conversation was closed.":"Pošto niste odgovorili u poslednjih %s minut(a), vaš razgovor je završen.","Since you didn't respond in the last %s minutes your conversation with <strong>%s</strong> was closed.":"Pošto niste odgovorili u poslednjih %s minut(a), vaš razgovor sa <strong>%s</strong> je završen.","Start new conversation":"Započni novi razgovor",Today:"Danas","We are sorry, it is taking longer than expected to get a slot. Please try again later or send us an email. Thank you!":"Žao nam je, dobijanje praznog termina traje duže od očekivanog. Molimo pokušajte ponovo kasnije ili nam pošaljite imejl poruku. Hvala vam!","You are on waiting list position <strong>%s</strong>.":"Vi ste trenutno <strong>%s.</strong> u redu za čekanje."},sv:{"<strong>Chat</strong> with us!":"<strong>Chatta</strong> med oss!","All colleagues are busy.":"Alla kollegor är upptagna.","Chat closed by %s":"Chatt stängd av %s","Compose your message…":"Skriv ditt meddelande …",Connecting:"Ansluter","Connection lost":"Anslutningen försvann","Connection re-established":"Anslutningen återupprättas",Offline:"Offline",Online:"Online","Scroll down to see new messages":"Bläddra ner för att se nya meddelanden",Send:"Skicka","Since you didn't respond in the last %s minutes your conversation was closed.":"Din chatt avslutades då du inte svarade inom %s minuter.","Since you didn't respond in the last %s minutes your conversation with <strong>%s</strong> was closed.":"Chatten stängdes eftersom du inte svarat inom %s minuter i din konversation med <strong>%s</strong>.","Start new conversation":"Starta ny konversation",Today:"Idag","We are sorry, it is taking longer than expected to get a slot. Please try again later or send us an email. Thank you!":"Det tar tyvärr längre tid än förväntat att få en ledig plats. Försök igen senare eller skicka ett mejl till oss. Tack!","You are on waiting list position <strong>%s</strong>.":"Du är på väntelistan som position <strong>%s</strong>."},"zh-cn":{"<strong>Chat</strong> with us!":"发起<strong>即时对话</strong>!","All colleagues are busy.":"所有同事都很忙。","Chat closed by %s":"对话被 %s 终止","Compose your message…":"编辑您的信息…",Connecting:"连接中","Connection lost":"连接丢失","Connection re-established":"正在重新建立连接",Offline:"离线",Online:"在线","Scroll down to see new messages":"向下滚动以查看新消息",Send:"发送","Since you didn't respond in the last %s minutes your conversation was closed.":"","Since you didn't respond in the last %s minutes your conversation with <strong>%s</strong> was closed.":"","Start new conversation":"开始新的会话",Today:"今天","We are sorry, it is taking longer than expected to get a slot. Please try again later or send us an email. Thank you!":"","You are on waiting list position <strong>%s</strong>.":"您目前的等候位置是第 <strong>%s</strong> 位."}},d.prototype.sessionId=void 0,d.prototype.scrolledToBottom=!0,d.prototype.scrollSnapTolerance=10,d.prototype.richTextFormatKey={66:!0,73:!0,85:!0,83:!0},d.prototype.T=function(){var e,t,n,o,s=arguments[0],i=2<=arguments.length?slice.call(arguments,1):[];if(this.options.lang&&"en"!==this.options.lang&&(this.translations[this.options.lang]?((o=this.translations[this.options.lang])[s]||this.log.notice("Translation needed for '"+s+"'"),s=o[s]||s):this.log.notice("Translation '"+this.options.lang+"' needed!")),i)for(t=0,n=i.length;t<n;t++)e=i[t],s=s.replace(/%s/,e);return s},d.prototype.view=function(t){return n=this,function(e){return(e=e||{}).T=n.T,e.background=n.options.background,e.flat=n.options.flat,e.fontSize=n.options.fontSize,p.zammadChatTemplates[t](e)};var n},d.prototype.getScrollRoot=function(){var e,t,n;return"scrollingElement"in document?document.scrollingElement:(n=(t=document.documentElement).scrollTop,t.scrollTop=n+1,e=t.scrollTop,(t.scrollTop=n)<e?t:document.body)},d.prototype.render=function(){return this.el&&h(".zammad-chat").get(0)||this.renderBase(),h("."+this.options.buttonClass).addClass(this.options.inactiveClass),this.setAgentOnlineState("online"),this.log.debug("widget rendered"),this.startTimeoutObservers(),this.idleTimeout.start(),this.sessionId=sessionStorage.getItem("sessionId"),this.send("chat_status_customer",{session_id:this.sessionId,url:p.location.href})},d.prototype.renderBase=function(){var n,a,l,e,t;if(this.el=h(this.view("chat")({title:this.options.title,scrollHint:this.options.scrollHint})),this.options.target.append(this.el),this.input=this.el.find(".zammad-chat-input"),this.el.find(".js-chat-open").on("click",this.open),this.el.find(".js-chat-toggle").on("click",this.toggle),this.el.find(".js-chat-status").on("click",this.stopPropagation),this.el.find(".zammad-chat-controls").on("submit",this.onSubmit),this.el.find(".zammad-chat-body").on("scroll",this.detectScrolledtoBottom),this.el.find(".zammad-scroll-hint").on("click",this.onScrollHintClick),this.input.on({keydown:this.checkForEnter,input:this.onInput}),this.input.on("keydown",(n=this,function(e){var t=!1;if((t=(e.altKey||e.ctrlKey||!e.metaKey)&&(e.altKey||!e.ctrlKey||e.metaKey)?t:!0)&&n.richTextFormatKey[e.keyCode])return e.preventDefault(),66===e.keyCode?(document.execCommand("bold"),!0):73===e.keyCode?(document.execCommand("italic"),!0):85===e.keyCode?(document.execCommand("underline"),!0):83===e.keyCode?(document.execCommand("strikeThrough"),!0):void 0})),this.input.on("paste",(a=this,function(t){var n,o,s,e,i;if(t.stopPropagation(),t.preventDefault(),t.clipboardData)o=t.clipboardData;else if(p.clipboardData)o=p.clipboardData;else{if(!t.originalEvent.clipboardData)throw"No clipboardData support";o=t.originalEvent.clipboardData}if(e=!1,o&&o.items&&o.items[0]&&("file"!==(n=o.items[0]).kind||"image/png"!==n.type&&"image/jpeg"!==n.type||(n=n.getAsFile(),(i=new FileReader).onload=function(e){var e=e.target.result,s=document.createElement("img");return s.src=e,a.resizeImage(s.src,460,"auto",2,"image/jpeg","auto",function(e,t,n,o){return a.isRetina()&&(t/=2,0),s='<img style="width: 100%; max-width: '+t+'px;" src="'+e+'">',document.execCommand("insertHTML",!1,s)})},i.readAsDataURL(n),e=!0)),!e){n=i=void 0;try{i=o.getData("text/html"),n="html",i&&0!==i.length||(n="text",i=o.getData("text/plain")),i&&0!==i.length||(n="text2",i=o.getData("text"))}catch(e){t=e,console.log("Sorry, can't insert markup because browser is not supporting it."),n="text3",i=o.getData("text")}return"text"!==n&&"text2"!==n&&"text3"!==n||(i=(i="<div>"+i.replace(/\n/g,"</div><div>")+"</div>").replace(/<div><\/div>/g,"<div><br></div>")),console.log("p",n,i),"html"===n&&(e=DOMPurify.sanitize(i),a.log.debug("sanitized HTML clipboard",e),t=h("<div>"+e+"</div>"),o=!1,e=i,s=new RegExp("<(/w|w):[A-Za-z]"),e.match(s)&&(o=!0,e=e.replace(s,"")),s=new RegExp("<(/o|o):[A-Za-z]"),e.match(s)&&(o=!0,e=e.replace(s,"")),o&&(t=a.wordFilter(t)),(t=h(t)).contents().each(function(){if(8===this.nodeType)return h(this).remove()}),t.find("a, font, small, time, form, label").replaceWith(function(){return h(this).contents()}),t.find("textarea").each(function(){var e=this.outerHTML;return s=new RegExp("<"+this.tagName,"i"),e=e.replace(s,"<div"),s=new RegExp("</"+this.tagName,"i"),e=e.replace(s,"</div"),h(this).replaceWith(e)}),t.find("font, img, svg, input, select, button, style, applet, embed, noframes, canvas, script, frame, iframe, meta, link, title, head, fieldset").remove(),a.removeAttributes(t),i=t.html()),"text3"===n?a.pasteHtmlAtCaret(i):document.execCommand("insertHTML",!1,i),!0}})),this.input.on("drop",(l=this,function(e){var t,a,r;if(e.stopPropagation(),e.preventDefault(),p.dataTransfer)t=p.dataTransfer;else{if(!e.originalEvent.dataTransfer)throw"No clipboardData support";t=e.originalEvent.dataTransfer}if(a=e.clientX,r=e.clientY,(e=t.files[0]).type.match("image.*"))return(t=new FileReader).onload=function(e){var e=e.target.result,i=document.createElement("img");return i.src=e,l.resizeImage(i.src,460,"auto",2,"image/jpeg","auto",function(e,t,n,o){var s;return l.isRetina()&&(t/=2,0),i=(i=h('<img style="width: 100%; max-width: '+t+'px;" src="'+e+'">')).get(0),document.caretPositionFromPoint?(t=document.caretPositionFromPoint(a,r),(s=document.createRange()).setStart(t.offsetNode,t.offset),s.collapse(),s.insertNode(i)):document.caretRangeFromPoint?(s=document.caretRangeFromPoint(a,r)).insertNode(i):console.log("could not find carat")})},t.readAsDataURL(e)})),h(p).on("beforeunload",(e=this,function(){return e.onLeaveTemporary()})),h(p).on("hashchange",(t=this,function(){if(!t.isOpen)return t.idleTimeout.start();t.sessionId&&t.send("chat_session_notice",{session_id:t.sessionId,message:p.location.href})})),this.isFullscreen)return this.input.on({focus:this.onFocus,focusout:this.onFocusOut})},d.prototype.stopPropagation=function(e){return e.stopPropagation()},d.prototype.checkForEnter=function(e){if(!this.inputDisabled&&!e.shiftKey&&13===e.keyCode)return e.preventDefault(),this.sendMessage()},d.prototype.send=function(e,t){return(t=null==t?{}:t).chat_id=this.options.chatId,this.io.send(e,t)},d.prototype.onWebSocketMessage=function(e){for(var t,n=0,o=e.length;n<o;n++)switch(t=e[n],this.log.debug("ws:onmessage",t),t.event){case"chat_error":this.log.notice(t.data),t.data&&"chat_disabled"===t.data.state&&this.destroy({remove:!0});break;case"chat_session_message":if(t.data.self_written)return;this.receiveMessage(t.data);break;case"chat_session_typing":if(t.data.self_written)return;this.onAgentTypingStart();break;case"chat_session_start":this.onConnectionEstablished(t.data);break;case"chat_session_queue":this.onQueueScreen(t.data);break;case"chat_session_closed":case"chat_session_left":this.onSessionClosed(t.data);break;case"chat_session_notice":this.addStatus(this.T(t.data.message));break;case"chat_status_customer":switch(t.data.state){case"online":this.sessionId=void 0,!this.options.cssAutoload||this.cssLoaded?this.onReady():this.socketReady=!0;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: "+t.data.queue);break;case"reconnect":this.onReopenSession(t.data)}}},d.prototype.onReady=function(){var e;if(this.log.debug("widget ready for use"),h("."+this.options.buttonClass).on("click",this.open).removeClass(this.options.inactiveClass),"function"==typeof(e=this.options).onReady&&e.onReady(),this.options.show)return this.show()},d.prototype.onError=function(e){var t;return this.log.debug(e),this.addStatus(e),h("."+this.options.buttonClass).hide(),this.isOpen?(this.disableInput(),this.destroy({remove:!1})):this.destroy({remove:!0}),"function"==typeof(t=this.options).onError?t.onError(e):void 0},d.prototype.onReopenSession=function(e){var t,n,o,s,i;if(this.log.debug("old messages",e.session),this.inactiveTimeout.start(),i=sessionStorage.getItem("unfinished_message"),e.agent){for(this.onConnectionEstablished(e),t=0,n=(s=e.session).length;t<n;t++)o=s[t],this.renderMessage({message:o.content,id:o.id,from:o.created_by_id?"agent":"customer"});i&&this.input.html(i)}if(e.position&&this.onQueue(e),this.show(),this.open(),this.scrollToBottom(),i)return this.input.trigger("focus")},d.prototype.onInput=function(){return this.el.find(".zammad-chat-message--unread").removeClass("zammad-chat-message--unread"),sessionStorage.setItem("unfinished_message",this.input.html()),this.onTyping()},d.prototype.onFocus=function(){var e;if(h(p).scrollTop(10),e=0<h(p).scrollTop(),h(p).scrollTop(0),e)return this.log.notice("virtual keyboard shown")},d.prototype.onFocusOut=function(){},d.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}),this.inactiveTimeout.start()},d.prototype.onSubmit=function(e){return e.preventDefault(),this.sendMessage()},d.prototype.sendMessage=function(){var e,t=this.input.html();if(t)return this.inactiveTimeout.start(),sessionStorage.removeItem("unfinished_message"),e=this.view("message")({message:t,from:"customer",id:this._messageCount++,unreadClass:""}),this.maybeAddTimestamp(),this.el.find(".zammad-chat-message--typing").get(0)?(this.lastAddedType="typing-placeholder",this.el.find(".zammad-chat-message--typing").before(e)):(this.lastAddedType="message--customer",this.el.find(".zammad-chat-body").append(e)),this.input.html(""),this.scrollToBottom(),this.send("chat_session_message",{content:t,id:this._messageCount,session_id:this.sessionId})},d.prototype.receiveMessage=function(e){return this.inactiveTimeout.start(),this.onAgentTypingEnd(),this.maybeAddTimestamp(),this.renderMessage({message:e.message.content,id:e.id,from:"agent"}),this.scrollToBottom({showHint:!0})},d.prototype.renderMessage=function(e){return this.lastAddedType="message--"+e.from,e.unreadClass=document.hidden?" zammad-chat-message--unread":"",this.el.find(".zammad-chat-body").append(this.view("message")(e))},d.prototype.open=function(){var e;if(!this.isOpen)return this.isOpen=!0,this.log.debug("open widget"),this.show(),this.sessionId||this.showLoader(),this.el.addClass("zammad-chat-is-open"),e=this.el.height()-this.el.find(".zammad-chat-header").outerHeight(),this.el.css("bottom",-e),this.sessionId?(this.el.css("bottom",0),this.onOpenAnimationEnd()):(this.el.animate({bottom:0},500,this.onOpenAnimationEnd),this.send("chat_session_init",{url:p.location.href}));this.log.debug("widget already open, block")},d.prototype.onOpenAnimationEnd=function(){var e;return this.idleTimeout.stop(),this.isFullscreen&&this.disableScrollOnRoot(),"function"==typeof(e=this.options).onOpenAnimationEnd?e.onOpenAnimationEnd():void 0},d.prototype.sessionClose=function(){return this.send("chat_session_close",{session_id:this.sessionId}),this.inactiveTimeout.stop(),this.waitingListTimeout.stop(),sessionStorage.removeItem("unfinished_message"),this.onInitialQueueDelayId&&clearTimeout(this.onInitialQueueDelayId),this.setSessionId(void 0)},d.prototype.toggle=function(e){return this.isOpen?this.close(e):this.open(e)},d.prototype.close=function(e){if(this.isOpen)return this.initDelayId&&clearTimeout(this.initDelayId),this.sessionId&&(this.log.debug("session close before widget close"),this.sessionClose()),this.log.debug("close widget"),e&&e.stopPropagation(),this.isFullscreen&&this.enableScrollOnRoot(),e=this.el.height()-this.el.find(".zammad-chat-header").outerHeight(),this.el.animate({bottom:-e},500,this.onCloseAnimationEnd);this.log.debug("can't close widget, it's not open")},d.prototype.onCloseAnimationEnd=function(){var e;return this.el.css("bottom",""),this.el.removeClass("zammad-chat-is-open"),this.showLoader(),this.el.find(".zammad-chat-welcome").removeClass("zammad-chat-is-hidden"),this.el.find(".zammad-chat-agent").addClass("zammad-chat-is-hidden"),this.el.find(".zammad-chat-agent-status").addClass("zammad-chat-is-hidden"),this.isOpen=!1,"function"==typeof(e=this.options).onCloseAnimationEnd&&e.onCloseAnimationEnd(),this.io.reconnect()},d.prototype.onWebSocketClose=function(){if(!this.isOpen)return this.el?(this.el.removeClass("zammad-chat-is-shown"),this.el.removeClass("zammad-chat-is-loaded")):void 0},d.prototype.show=function(){if("offline"!==this.state)return this.el.addClass("zammad-chat-is-loaded"),this.el.addClass("zammad-chat-is-shown")},d.prototype.disableInput=function(){return this.inputDisabled=!0,this.input.prop("contenteditable",!1),this.el.find(".zammad-chat-send").prop("disabled",!0),this.io.close()},d.prototype.enableInput=function(){return this.inputDisabled=!1,this.input.prop("contenteditable",!0),this.el.find(".zammad-chat-send").prop("disabled",!1)},d.prototype.hideModal=function(){return this.el.find(".zammad-chat-modal").html("")},d.prototype.onQueueScreen=function(e){var t,n;if(this.setSessionId(e.session_id),t=function(){return n.onQueue(e),n.waitingListTimeout.start()},!(n=this).initialQueueDelay||this.onInitialQueueDelayId)return this.onInitialQueueDelayId&&clearTimeout(this.onInitialQueueDelayId),t();this.onInitialQueueDelayId=setTimeout(t,this.initialQueueDelay)},d.prototype.onQueue=function(e){return this.log.notice("onQueue",e.position),this.inQueue=!0,this.el.find(".zammad-chat-modal").html(this.view("waiting")({position:e.position}))},d.prototype.onAgentTypingStart=function(){if(this.stopTypingId&&clearTimeout(this.stopTypingId),this.stopTypingId=setTimeout(this.onAgentTypingEnd,3e3),!this.el.find(".zammad-chat-message--typing").get(0)&&(this.maybeAddTimestamp(),this.el.find(".zammad-chat-body").append(this.view("typingIndicator")()),this.isVisible(this.el.find(".zammad-chat-message--typing"),!0)))return this.scrollToBottom()},d.prototype.onAgentTypingEnd=function(){return this.el.find(".zammad-chat-message--typing").remove()},d.prototype.onLeaveTemporary=function(){if(this.sessionId)return this.send("chat_session_leave_temporary",{session_id:this.sessionId})},d.prototype.maybeAddTimestamp=function(){var e,t,n=Date.now();if(!this.lastTimestamp||n-this.lastTimestamp>6e4*this.showTimeEveryXMinutes)return e=this.T("Today"),t=(new Date).toTimeString().substr(0,5),"timestamp"===this.lastAddedType?(this.updateLastTimestamp(e,t),this.lastTimestamp=n):(this.el.find(".zammad-chat-body").append(this.view("timestamp")({label:e,time:t})),this.lastTimestamp=n,this.lastAddedType="timestamp",this.scrollToBottom())},d.prototype.updateLastTimestamp=function(e,t){if(this.el)return this.el.find(".zammad-chat-body").find(".zammad-chat-timestamp").last().replaceWith(this.view("timestamp")({label:e,time:t}))},d.prototype.addStatus=function(e){if(this.el)return this.maybeAddTimestamp(),this.el.find(".zammad-chat-body").append(this.view("status")({status:e})),this.scrollToBottom()},d.prototype.detectScrolledtoBottom=function(){var e=this.el.find(".zammad-chat-body").scrollTop()+this.el.find(".zammad-chat-body").outerHeight();if(this.scrolledToBottom=Math.abs(e-this.el.find(".zammad-chat-body").prop("scrollHeight"))<=this.scrollSnapTolerance,this.scrolledToBottom)return this.el.find(".zammad-scroll-hint").addClass("is-hidden")},d.prototype.showScrollHint=function(){return this.el.find(".zammad-scroll-hint").removeClass("is-hidden"),this.el.find(".zammad-chat-body").scrollTop(this.el.find(".zammad-chat-body").scrollTop()+this.el.find(".zammad-scroll-hint").outerHeight())},d.prototype.onScrollHintClick=function(){return this.el.find(".zammad-chat-body").animate({scrollTop:this.el.find(".zammad-chat-body").prop("scrollHeight")},300)},d.prototype.scrollToBottom=function(e){e=(null!=e?e:{showHint:!1}).showHint;return this.scrolledToBottom?this.el.find(".zammad-chat-body").scrollTop(h(".zammad-chat-body").prop("scrollHeight")):e?this.showScrollHint():void 0},d.prototype.destroy=function(e){return this.log.debug("destroy widget",e=null==e?{}:e),this.setAgentOnlineState("offline"),e.remove&&this.el&&(this.el.remove(),h("."+this.options.buttonClass).hide()),this.waitingListTimeout&&this.waitingListTimeout.stop(),this.inactiveTimeout&&this.inactiveTimeout.stop(),this.idleTimeout&&this.idleTimeout.stop(),this.io.close()},d.prototype.reconnect=function(){return this.log.notice("reconnecting"),this.disableInput(),this.lastAddedType="status",this.setAgentOnlineState("connecting"),this.addStatus(this.T("Connection lost"))},d.prototype.onConnectionReestablished=function(){var e;return this.lastAddedType="status",this.setAgentOnlineState("online"),this.addStatus(this.T("Connection re-established")),"function"==typeof(e=this.options).onConnectionReestablished?e.onConnectionReestablished():void 0},d.prototype.onSessionClosed=function(e){var t;return this.addStatus(this.T("Chat closed by %s",e.realname)),this.disableInput(),this.setAgentOnlineState("offline"),this.inactiveTimeout.stop(),"function"==typeof(t=this.options).onSessionClosed?t.onSessionClosed(e):void 0},d.prototype.setSessionId=function(e){return void 0===(this.sessionId=e)?sessionStorage.removeItem("sessionId"):sessionStorage.setItem("sessionId",e)},d.prototype.onConnectionEstablished=function(e){var t;return this.onInitialQueueDelayId&&clearTimeout(this.onInitialQueueDelayId),this.inQueue=!1,e.agent&&(this.agent=e.agent),e.session_id&&this.setSessionId(e.session_id),this.el.find(".zammad-chat-body").html(""),this.el.find(".zammad-chat-agent").html(this.view("agent")({agent:this.agent})),this.enableInput(),this.hideModal(),this.el.find(".zammad-chat-welcome").addClass("zammad-chat-is-hidden"),this.el.find(".zammad-chat-agent").removeClass("zammad-chat-is-hidden"),this.el.find(".zammad-chat-agent-status").removeClass("zammad-chat-is-hidden"),this.isFullscreen||this.input.trigger("focus"),this.setAgentOnlineState("online"),this.waitingListTimeout.stop(),this.idleTimeout.stop(),this.inactiveTimeout.start(),"function"==typeof(t=this.options).onConnectionEstablished?t.onConnectionEstablished(e):void 0},d.prototype.showCustomerTimeout=function(){var e;return this.el.find(".zammad-chat-modal").html(this.view("customer_timeout")({agent:this.agent.name,delay:this.options.inactiveTimeout})),e=function(){return location.reload()},this.el.find(".js-restart").on("click",e),this.sessionClose()},d.prototype.showWaitingListTimeout=function(){var e;return this.el.find(".zammad-chat-modal").html(this.view("waiting_list_timeout")({delay:this.options.watingListTimeout})),e=function(){return location.reload()},this.el.find(".js-restart").on("click",e),this.sessionClose()},d.prototype.showLoader=function(){return this.el.find(".zammad-chat-modal").html(this.view("loader")())},d.prototype.setAgentOnlineState=function(e){var t;if(this.state=e,this.el)return t=e.charAt(0).toUpperCase()+e.slice(1),this.el.find(".zammad-chat-agent-status").attr("data-status",e).text(this.T(t))},d.prototype.detectHost=function(){var e="https"===i?"wss://":"ws://";return this.options.host=""+e+s+"/ws"},d.prototype.loadCss=function(){var e,t;if(this.options.cssAutoload)return(t=this.options.cssUrl)||(t=this.options.host.replace(/^wss/i,"https").replace(/^ws/i,"http").replace(/\/ws$/i,""),t+="/assets/chat/chat.css"),this.log.debug("load css from '"+t+"'"),t="@import url('"+t+"');",(e=document.createElement("link")).onload=this.onCssLoaded,e.rel="stylesheet",e.href="data:text/css,"+escape(t),document.getElementsByTagName("head")[0].appendChild(e)},d.prototype.onCssLoaded=function(){var e;return this.cssLoaded=!0,this.socketReady&&this.onReady(),"function"==typeof(e=this.options).onCssLoaded?e.onCssLoaded():void 0},d.prototype.startTimeoutObservers=function(){var e,t,n;return this.idleTimeout=new o({logPrefix:"idleTimeout",debug:this.options.debug,timeout:this.options.idleTimeout,timeoutIntervallCheck:this.options.idleTimeoutIntervallCheck,callback:(e=this,function(){return e.log.debug("Idle timeout reached, hide widget",new Date),e.destroy({remove:!0})})}),this.inactiveTimeout=new o({logPrefix:"inactiveTimeout",debug:this.options.debug,timeout:this.options.inactiveTimeout,timeoutIntervallCheck:this.options.inactiveTimeoutIntervallCheck,callback:(t=this,function(){return t.log.debug("Inactive timeout reached, show timeout screen.",new Date),t.showCustomerTimeout(),t.destroy({remove:!1})})}),this.waitingListTimeout=new o({logPrefix:"waitingListTimeout",debug:this.options.debug,timeout:this.options.waitingListTimeout,timeoutIntervallCheck:this.options.waitingListTimeoutIntervallCheck,callback:(n=this,function(){return n.log.debug("Waiting list timeout reached, show timeout screen.",new Date),n.showWaitingListTimeout(),n.destroy({remove:!1})})})},d.prototype.disableScrollOnRoot=function(){return this.rootScrollOffset=this.scrollRoot.scrollTop(),this.scrollRoot.css({overflow:"hidden",position:"fixed"})},d.prototype.enableScrollOnRoot=function(){return this.scrollRoot.scrollTop(this.rootScrollOffset),this.scrollRoot.css({overflow:"",position:""})},d.prototype.isVisible=function(e,t,n,o){var s,i,a,r,l,c,d,u;if(!(e.length<1))return s=h(p),a=(e=1<e.length?e.eq(0):e).get(0),u=s.width(),d=s.height(),o=o||"both",n=!0!==n||a.offsetWidth*a.offsetHeight,"function"==typeof a.getBoundingClientRect?(r=0<=(a=a.getBoundingClientRect()).top&&a.top<d,l=0<a.bottom&&a.bottom<=d,c=0<=a.left&&a.left<u,a=0<a.right&&a.right<=u,r=t?r||l:r&&l,l=t?c||a:c&&a,"both"===o?n&&r&&l:"vertical"===o?n&&r:"horizontal"===o?n&&l:void 0):(a=(c=s.scrollTop())+d,l=(r=s.scrollLeft())+u,u=(s=(d=e.offset()).top)+e.height(),e=(d=d.left)+e.width(),i=!0===t?u:s,s=!0===t?s:u,u=!0===t?e:d,t=!0===t?d:e,"both"===o?!!n&&s<=a&&c<=i&&t<=l&&r<=u:"vertical"===o?!!n&&s<=a&&c<=i:"horizontal"===o?!!n&&t<=l&&r<=u:void 0)},d.prototype.isRetina=function(){var e;return!!p.matchMedia&&((e=p.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)"))&&e.matches||1<p.devicePixelRatio)},d.prototype.resizeImage=function(e,o,s,i,a,r,l,t){var c;return null==o&&(o="auto"),null==s&&(s="auto"),null==i&&(i=1),null==t&&(t=!0),(c=new Image).onload=function(){var e,t=c.width,n=c.height;return console.log("ImageService","current size",t,n),"auto"===s&&"auto"===o&&(o=t,s=n),"auto"===s&&(s=n/(t/o)),e=!1,(o="auto"===o?n/(t/s):o)<t||s<n?(e=!0,o*=i,s*=i):(o=t,s=n),(t=document.createElement("canvas")).width=o,t.height=s,t.getContext("2d").drawImage(c,0,0,o,s),"auto"===r&&(r=o<200&&s<200?1:o<400&&s<400?.9:o<600&&s<600?.8:o<900&&s<900?.7:.6),n=t.toDataURL(a,r),e?(console.log("ImageService","resize",o/i,s/i,r,.75*n.length/1024/1024,"in mb"),void l(n,o/i,s/i,!0)):(console.log("ImageService","no resize",o,s,r,.75*n.length/1024/1024,"in mb"),l(n,o,s,!1))},c.src=e},d.prototype.pasteHtmlAtCaret=function(e){var t,n,o,s,i=void 0,a=void 0;if(p.getSelection){if((i=p.getSelection()).getRangeAt&&i.rangeCount){for((a=i.getRangeAt(0)).deleteContents(),(t=document.createElement("div")).innerHTML=e,n=document.createDocumentFragment(s,o);s=t.firstChild;)o=n.appendChild(s);if(a.insertNode(n),o)return(a=a.cloneRange()).setStartAfter(o),a.collapse(!0),i.removeAllRanges(),i.addRange(a)}}else if(document.selection&&"Control"!==document.selection.type)return document.selection.createRange().pasteHTML(e)},d.prototype.wordFilter=function(e){var l,c,t=e.html();return t=(t=(t=(t=t.replace(/<!--[\s\S]+?-->/gi,"")).replace(/<(!|script[^>]*>.*?<\/script(?=[>\s])|\/?(\?xml(:\w+)?|img|meta|link|style|\w:\w+)(?=[\s\/>]))[^>]*>/gi,"")).replace(/<(\/?)s>/gi,"<$1strike>")).replace(/&nbsp;/gi," "),e.html(t),h("p",e).each(function(){var e=h(this).attr("style"),e=/mso-list:\w+ \w+([0-9]+)/.exec(e);if(e)return h(this).data("_listLevel",parseInt(e[1],10))}),l=0,c=null,h("p",e).each(function(){var e,t,n,o,s,i,a,r=h(this).data("_listLevel");if(void 0===r)return l=0;if(a=h(this).text(),n="<ul></ul>",/^\s*\w+\./.test(a)&&(n=(a=/([0-9])\./.exec(a))?null!=(o=1<(a=parseInt(a[1],10)))?o:'<ol start="'+a+{'"></ol>':"<ol></ol>"}:"<ol></ol>"),l<r&&(c=0===l?(h(this).before(n),h(this).prev()):h(n).appendTo(c)),r<l)for(e=t=s=e,i=l-r;s<=i?t<=i:i<=t;e=s<=i?++t:--t)c=c.parent();return h("span:first",this).remove(),c.append("<li>"+h(this).html()+"</li>"),h(this).remove(),l=r}),h("[style]",e).removeAttr("style"),h("[align]",e).removeAttr("align"),h("span",e).replaceWith(function(){return h(this).contents()}),h("span:empty",e).remove(),h("[class^='Mso']",e).removeAttr("class"),h("p:empty",e).remove(),e},d.prototype.removeAttribute=function(e){var t,n,o,s,i;if(e){for(t=h(e),o=0,s=(i=e.attributes).length;o<s;o++)(n=i[o])&&n.name&&e.removeAttribute(n.name);return t.removeAttr("style").removeAttr("class").removeAttr("lang").removeAttr("type").removeAttr("align").removeAttr("id").removeAttr("wrap").removeAttr("title")}},d.prototype.removeAttributes=function(e,t){var n,o;return(t=null==t?!0:t)&&e.each((n=this,function(e,t){return n.removeAttribute(t)})),e.find("*").each((o=this,function(e,t){return o.removeAttribute(t)})),e},p.ZammadChat=d}(window.jQuery,window);