chat-no-jquery.js 122 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720
  1. if (!window.zammadChatTemplates) {
  2. window.zammadChatTemplates = {};
  3. }
  4. window.zammadChatTemplates["agent"] = function(__obj) {
  5. if (!__obj) __obj = {};
  6. var __out = [], __capture = function(callback) {
  7. var out = __out, result;
  8. __out = [];
  9. callback.call(this);
  10. result = __out.join('');
  11. __out = out;
  12. return __safe(result);
  13. }, __sanitize = function(value) {
  14. if (value && value.ecoSafe) {
  15. return value;
  16. } else if (typeof value !== 'undefined' && value != null) {
  17. return __escape(value);
  18. } else {
  19. return '';
  20. }
  21. }, __safe, __objSafe = __obj.safe, __escape = __obj.escape;
  22. __safe = __obj.safe = function(value) {
  23. if (value && value.ecoSafe) {
  24. return value;
  25. } else {
  26. if (!(typeof value !== 'undefined' && value != null)) value = '';
  27. var result = new String(value);
  28. result.ecoSafe = true;
  29. return result;
  30. }
  31. };
  32. if (!__escape) {
  33. __escape = __obj.escape = function(value) {
  34. return ('' + value)
  35. .replace(/&/g, '&')
  36. .replace(/</g, '&lt;')
  37. .replace(/>/g, '&gt;')
  38. .replace(/"/g, '&quot;');
  39. };
  40. }
  41. (function() {
  42. (function() {
  43. if (this.agent.avatar) {
  44. __out.push('\n<img class="zammad-chat-agent-avatar" src="');
  45. __out.push(__sanitize(this.agent.avatar));
  46. __out.push('">\n');
  47. }
  48. __out.push('\n<span class="zammad-chat-agent-sentence">\n <span class="zammad-chat-agent-name">');
  49. __out.push(__sanitize(this.agent.name));
  50. __out.push('</span>\n</span>');
  51. }).call(this);
  52. }).call(__obj);
  53. __obj.safe = __objSafe, __obj.escape = __escape;
  54. return __out.join('');
  55. };
  56. if (!window.zammadChatTemplates) {
  57. window.zammadChatTemplates = {};
  58. }
  59. window.zammadChatTemplates["chat"] = function(__obj) {
  60. if (!__obj) __obj = {};
  61. var __out = [], __capture = function(callback) {
  62. var out = __out, result;
  63. __out = [];
  64. callback.call(this);
  65. result = __out.join('');
  66. __out = out;
  67. return __safe(result);
  68. }, __sanitize = function(value) {
  69. if (value && value.ecoSafe) {
  70. return value;
  71. } else if (typeof value !== 'undefined' && value != null) {
  72. return __escape(value);
  73. } else {
  74. return '';
  75. }
  76. }, __safe, __objSafe = __obj.safe, __escape = __obj.escape;
  77. __safe = __obj.safe = function(value) {
  78. if (value && value.ecoSafe) {
  79. return value;
  80. } else {
  81. if (!(typeof value !== 'undefined' && value != null)) value = '';
  82. var result = new String(value);
  83. result.ecoSafe = true;
  84. return result;
  85. }
  86. };
  87. if (!__escape) {
  88. __escape = __obj.escape = function(value) {
  89. return ('' + value)
  90. .replace(/&/g, '&amp;')
  91. .replace(/</g, '&lt;')
  92. .replace(/>/g, '&gt;')
  93. .replace(/"/g, '&quot;');
  94. };
  95. }
  96. (function() {
  97. (function() {
  98. __out.push('<div class="zammad-chat');
  99. if (this.flat) {
  100. __out.push(__sanitize(' zammad-chat--flat'));
  101. }
  102. __out.push('"');
  103. if (this.fontSize) {
  104. __out.push(__sanitize(" style='font-size: " + this.fontSize + "'"));
  105. }
  106. __out.push('>\n <div class="zammad-chat-header js-chat-open"');
  107. if (this.background) {
  108. __out.push(__sanitize(" style='background: " + this.background + "'"));
  109. }
  110. __out.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">');
  111. __out.push(this.T(this.title));
  112. __out.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 ');
  113. __out.push(this.T(this.scrollHint));
  114. __out.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="');
  115. __out.push(this.T('Compose your message…'));
  116. __out.push('" contenteditable="true"></div>\n <button type="submit" class="zammad-chat-button zammad-chat-send"');
  117. if (this.background) {
  118. __out.push(__sanitize(" style='background: " + this.background + "'"));
  119. }
  120. __out.push('>');
  121. __out.push(this.T('Send'));
  122. __out.push('</button>\n </form>\n</div>');
  123. }).call(this);
  124. }).call(__obj);
  125. __obj.safe = __objSafe, __obj.escape = __escape;
  126. return __out.join('');
  127. };
  128. if (!window.zammadChatTemplates) {
  129. window.zammadChatTemplates = {};
  130. }
  131. window.zammadChatTemplates["customer_timeout"] = function(__obj) {
  132. if (!__obj) __obj = {};
  133. var __out = [], __capture = function(callback) {
  134. var out = __out, result;
  135. __out = [];
  136. callback.call(this);
  137. result = __out.join('');
  138. __out = out;
  139. return __safe(result);
  140. }, __sanitize = function(value) {
  141. if (value && value.ecoSafe) {
  142. return value;
  143. } else if (typeof value !== 'undefined' && value != null) {
  144. return __escape(value);
  145. } else {
  146. return '';
  147. }
  148. }, __safe, __objSafe = __obj.safe, __escape = __obj.escape;
  149. __safe = __obj.safe = function(value) {
  150. if (value && value.ecoSafe) {
  151. return value;
  152. } else {
  153. if (!(typeof value !== 'undefined' && value != null)) value = '';
  154. var result = new String(value);
  155. result.ecoSafe = true;
  156. return result;
  157. }
  158. };
  159. if (!__escape) {
  160. __escape = __obj.escape = function(value) {
  161. return ('' + value)
  162. .replace(/&/g, '&amp;')
  163. .replace(/</g, '&lt;')
  164. .replace(/>/g, '&gt;')
  165. .replace(/"/g, '&quot;');
  166. };
  167. }
  168. (function() {
  169. (function() {
  170. __out.push('<div class="zammad-chat-modal-text">\n ');
  171. if (this.agent) {
  172. __out.push('\n ');
  173. __out.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));
  174. __out.push('\n ');
  175. } else {
  176. __out.push('\n ');
  177. __out.push(this.T('Since you didn\'t respond in the last %s minutes your conversation was closed.', this.delay));
  178. __out.push('\n ');
  179. }
  180. __out.push('\n <br>\n <div class="zammad-chat-button js-restart"');
  181. if (this.background) {
  182. __out.push(__sanitize(" style='background: " + this.background + "'"));
  183. }
  184. __out.push('>');
  185. __out.push(this.T('Start new conversation'));
  186. __out.push('</div>\n</div>');
  187. }).call(this);
  188. }).call(__obj);
  189. __obj.safe = __objSafe, __obj.escape = __escape;
  190. return __out.join('');
  191. };
  192. if (!window.zammadChatTemplates) {
  193. window.zammadChatTemplates = {};
  194. }
  195. window.zammadChatTemplates["loader"] = function(__obj) {
  196. if (!__obj) __obj = {};
  197. var __out = [], __capture = function(callback) {
  198. var out = __out, result;
  199. __out = [];
  200. callback.call(this);
  201. result = __out.join('');
  202. __out = out;
  203. return __safe(result);
  204. }, __sanitize = function(value) {
  205. if (value && value.ecoSafe) {
  206. return value;
  207. } else if (typeof value !== 'undefined' && value != null) {
  208. return __escape(value);
  209. } else {
  210. return '';
  211. }
  212. }, __safe, __objSafe = __obj.safe, __escape = __obj.escape;
  213. __safe = __obj.safe = function(value) {
  214. if (value && value.ecoSafe) {
  215. return value;
  216. } else {
  217. if (!(typeof value !== 'undefined' && value != null)) value = '';
  218. var result = new String(value);
  219. result.ecoSafe = true;
  220. return result;
  221. }
  222. };
  223. if (!__escape) {
  224. __escape = __obj.escape = function(value) {
  225. return ('' + value)
  226. .replace(/&/g, '&amp;')
  227. .replace(/</g, '&lt;')
  228. .replace(/>/g, '&gt;')
  229. .replace(/"/g, '&quot;');
  230. };
  231. }
  232. (function() {
  233. (function() {
  234. __out.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">');
  235. __out.push(this.T('Connecting'));
  236. __out.push('</span>');
  237. }).call(this);
  238. }).call(__obj);
  239. __obj.safe = __objSafe, __obj.escape = __escape;
  240. return __out.join('');
  241. };
  242. if (!window.zammadChatTemplates) {
  243. window.zammadChatTemplates = {};
  244. }
  245. window.zammadChatTemplates["message"] = function(__obj) {
  246. if (!__obj) __obj = {};
  247. var __out = [], __capture = function(callback) {
  248. var out = __out, result;
  249. __out = [];
  250. callback.call(this);
  251. result = __out.join('');
  252. __out = out;
  253. return __safe(result);
  254. }, __sanitize = function(value) {
  255. if (value && value.ecoSafe) {
  256. return value;
  257. } else if (typeof value !== 'undefined' && value != null) {
  258. return __escape(value);
  259. } else {
  260. return '';
  261. }
  262. }, __safe, __objSafe = __obj.safe, __escape = __obj.escape;
  263. __safe = __obj.safe = function(value) {
  264. if (value && value.ecoSafe) {
  265. return value;
  266. } else {
  267. if (!(typeof value !== 'undefined' && value != null)) value = '';
  268. var result = new String(value);
  269. result.ecoSafe = true;
  270. return result;
  271. }
  272. };
  273. if (!__escape) {
  274. __escape = __obj.escape = function(value) {
  275. return ('' + value)
  276. .replace(/&/g, '&amp;')
  277. .replace(/</g, '&lt;')
  278. .replace(/>/g, '&gt;')
  279. .replace(/"/g, '&quot;');
  280. };
  281. }
  282. (function() {
  283. (function() {
  284. __out.push('<div class="zammad-chat-message zammad-chat-message--');
  285. __out.push(__sanitize(this.from));
  286. __out.push(__sanitize(this.unreadClass));
  287. __out.push('">\n <span class="zammad-chat-message-body"');
  288. if (this.background && this.from === 'customer') {
  289. __out.push(__sanitize(" style='background: " + this.background + "'"));
  290. }
  291. __out.push('>');
  292. __out.push(this.message);
  293. __out.push('</span>\n</div>');
  294. }).call(this);
  295. }).call(__obj);
  296. __obj.safe = __objSafe, __obj.escape = __escape;
  297. return __out.join('');
  298. };
  299. if (!window.zammadChatTemplates) {
  300. window.zammadChatTemplates = {};
  301. }
  302. window.zammadChatTemplates["status"] = function(__obj) {
  303. if (!__obj) __obj = {};
  304. var __out = [], __capture = function(callback) {
  305. var out = __out, result;
  306. __out = [];
  307. callback.call(this);
  308. result = __out.join('');
  309. __out = out;
  310. return __safe(result);
  311. }, __sanitize = function(value) {
  312. if (value && value.ecoSafe) {
  313. return value;
  314. } else if (typeof value !== 'undefined' && value != null) {
  315. return __escape(value);
  316. } else {
  317. return '';
  318. }
  319. }, __safe, __objSafe = __obj.safe, __escape = __obj.escape;
  320. __safe = __obj.safe = function(value) {
  321. if (value && value.ecoSafe) {
  322. return value;
  323. } else {
  324. if (!(typeof value !== 'undefined' && value != null)) value = '';
  325. var result = new String(value);
  326. result.ecoSafe = true;
  327. return result;
  328. }
  329. };
  330. if (!__escape) {
  331. __escape = __obj.escape = function(value) {
  332. return ('' + value)
  333. .replace(/&/g, '&amp;')
  334. .replace(/</g, '&lt;')
  335. .replace(/>/g, '&gt;')
  336. .replace(/"/g, '&quot;');
  337. };
  338. }
  339. (function() {
  340. (function() {
  341. __out.push('<div class="zammad-chat-status">\n <div class="zammad-chat-status-inner">\n ');
  342. __out.push(this.status);
  343. __out.push('\n </div>\n</div>');
  344. }).call(this);
  345. }).call(__obj);
  346. __obj.safe = __objSafe, __obj.escape = __escape;
  347. return __out.join('');
  348. };
  349. if (!window.zammadChatTemplates) {
  350. window.zammadChatTemplates = {};
  351. }
  352. window.zammadChatTemplates["timestamp"] = function(__obj) {
  353. if (!__obj) __obj = {};
  354. var __out = [], __capture = function(callback) {
  355. var out = __out, result;
  356. __out = [];
  357. callback.call(this);
  358. result = __out.join('');
  359. __out = out;
  360. return __safe(result);
  361. }, __sanitize = function(value) {
  362. if (value && value.ecoSafe) {
  363. return value;
  364. } else if (typeof value !== 'undefined' && value != null) {
  365. return __escape(value);
  366. } else {
  367. return '';
  368. }
  369. }, __safe, __objSafe = __obj.safe, __escape = __obj.escape;
  370. __safe = __obj.safe = function(value) {
  371. if (value && value.ecoSafe) {
  372. return value;
  373. } else {
  374. if (!(typeof value !== 'undefined' && value != null)) value = '';
  375. var result = new String(value);
  376. result.ecoSafe = true;
  377. return result;
  378. }
  379. };
  380. if (!__escape) {
  381. __escape = __obj.escape = function(value) {
  382. return ('' + value)
  383. .replace(/&/g, '&amp;')
  384. .replace(/</g, '&lt;')
  385. .replace(/>/g, '&gt;')
  386. .replace(/"/g, '&quot;');
  387. };
  388. }
  389. (function() {
  390. (function() {
  391. __out.push('<div class="zammad-chat-timestamp"><strong>');
  392. __out.push(__sanitize(this.label));
  393. __out.push('</strong> ');
  394. __out.push(__sanitize(this.time));
  395. __out.push('</div>');
  396. }).call(this);
  397. }).call(__obj);
  398. __obj.safe = __objSafe, __obj.escape = __escape;
  399. return __out.join('');
  400. };
  401. if (!window.zammadChatTemplates) {
  402. window.zammadChatTemplates = {};
  403. }
  404. window.zammadChatTemplates["typingIndicator"] = function(__obj) {
  405. if (!__obj) __obj = {};
  406. var __out = [], __capture = function(callback) {
  407. var out = __out, result;
  408. __out = [];
  409. callback.call(this);
  410. result = __out.join('');
  411. __out = out;
  412. return __safe(result);
  413. }, __sanitize = function(value) {
  414. if (value && value.ecoSafe) {
  415. return value;
  416. } else if (typeof value !== 'undefined' && value != null) {
  417. return __escape(value);
  418. } else {
  419. return '';
  420. }
  421. }, __safe, __objSafe = __obj.safe, __escape = __obj.escape;
  422. __safe = __obj.safe = function(value) {
  423. if (value && value.ecoSafe) {
  424. return value;
  425. } else {
  426. if (!(typeof value !== 'undefined' && value != null)) value = '';
  427. var result = new String(value);
  428. result.ecoSafe = true;
  429. return result;
  430. }
  431. };
  432. if (!__escape) {
  433. __escape = __obj.escape = function(value) {
  434. return ('' + value)
  435. .replace(/&/g, '&amp;')
  436. .replace(/</g, '&lt;')
  437. .replace(/>/g, '&gt;')
  438. .replace(/"/g, '&quot;');
  439. };
  440. }
  441. (function() {
  442. (function() {
  443. __out.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>');
  444. }).call(this);
  445. }).call(__obj);
  446. __obj.safe = __objSafe, __obj.escape = __escape;
  447. return __out.join('');
  448. };
  449. if (!window.zammadChatTemplates) {
  450. window.zammadChatTemplates = {};
  451. }
  452. window.zammadChatTemplates["waiting_list_timeout"] = function(__obj) {
  453. if (!__obj) __obj = {};
  454. var __out = [], __capture = function(callback) {
  455. var out = __out, result;
  456. __out = [];
  457. callback.call(this);
  458. result = __out.join('');
  459. __out = out;
  460. return __safe(result);
  461. }, __sanitize = function(value) {
  462. if (value && value.ecoSafe) {
  463. return value;
  464. } else if (typeof value !== 'undefined' && value != null) {
  465. return __escape(value);
  466. } else {
  467. return '';
  468. }
  469. }, __safe, __objSafe = __obj.safe, __escape = __obj.escape;
  470. __safe = __obj.safe = function(value) {
  471. if (value && value.ecoSafe) {
  472. return value;
  473. } else {
  474. if (!(typeof value !== 'undefined' && value != null)) value = '';
  475. var result = new String(value);
  476. result.ecoSafe = true;
  477. return result;
  478. }
  479. };
  480. if (!__escape) {
  481. __escape = __obj.escape = function(value) {
  482. return ('' + value)
  483. .replace(/&/g, '&amp;')
  484. .replace(/</g, '&lt;')
  485. .replace(/>/g, '&gt;')
  486. .replace(/"/g, '&quot;');
  487. };
  488. }
  489. (function() {
  490. (function() {
  491. __out.push('<div class="zammad-chat-modal-text">\n ');
  492. __out.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!'));
  493. __out.push('\n <br>\n <div class="zammad-chat-button js-restart"');
  494. if (this.background) {
  495. __out.push(__sanitize(" style='background: " + this.background + "'"));
  496. }
  497. __out.push('>');
  498. __out.push(this.T('Start new conversation'));
  499. __out.push('</div>\n</div>');
  500. }).call(this);
  501. }).call(__obj);
  502. __obj.safe = __objSafe, __obj.escape = __escape;
  503. return __out.join('');
  504. };
  505. if (!window.zammadChatTemplates) {
  506. window.zammadChatTemplates = {};
  507. }
  508. window.zammadChatTemplates["waiting"] = function(__obj) {
  509. if (!__obj) __obj = {};
  510. var __out = [], __capture = function(callback) {
  511. var out = __out, result;
  512. __out = [];
  513. callback.call(this);
  514. result = __out.join('');
  515. __out = out;
  516. return __safe(result);
  517. }, __sanitize = function(value) {
  518. if (value && value.ecoSafe) {
  519. return value;
  520. } else if (typeof value !== 'undefined' && value != null) {
  521. return __escape(value);
  522. } else {
  523. return '';
  524. }
  525. }, __safe, __objSafe = __obj.safe, __escape = __obj.escape;
  526. __safe = __obj.safe = function(value) {
  527. if (value && value.ecoSafe) {
  528. return value;
  529. } else {
  530. if (!(typeof value !== 'undefined' && value != null)) value = '';
  531. var result = new String(value);
  532. result.ecoSafe = true;
  533. return result;
  534. }
  535. };
  536. if (!__escape) {
  537. __escape = __obj.escape = function(value) {
  538. return ('' + value)
  539. .replace(/&/g, '&amp;')
  540. .replace(/</g, '&lt;')
  541. .replace(/>/g, '&gt;')
  542. .replace(/"/g, '&quot;');
  543. };
  544. }
  545. (function() {
  546. (function() {
  547. __out.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 ');
  548. __out.push(this.T('All colleagues are busy.'));
  549. __out.push('<br>\n ');
  550. __out.push(this.T('You are on waiting list position <strong>%s</strong>.', this.position));
  551. __out.push('\n</div>');
  552. }).call(this);
  553. }).call(__obj);
  554. __obj.safe = __objSafe, __obj.escape = __escape;
  555. return __out.join('');
  556. };
  557. /*! @license DOMPurify 2.3.1 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/2.3.1/LICENSE */
  558. !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";var e=Object.hasOwnProperty,t=Object.setPrototypeOf,n=Object.isFrozen,r=Object.getPrototypeOf,o=Object.getOwnPropertyDescriptor,i=Object.freeze,a=Object.seal,l=Object.create,c="undefined"!=typeof Reflect&&Reflect,s=c.apply,u=c.construct;s||(s=function(e,t,n){return e.apply(t,n)}),i||(i=function(e){return e}),a||(a=function(e){return e}),u||(u=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))))});var f,m=x(Array.prototype.forEach),d=x(Array.prototype.pop),p=x(Array.prototype.push),g=x(String.prototype.toLowerCase),h=x(String.prototype.match),y=x(String.prototype.replace),v=x(String.prototype.indexOf),b=x(String.prototype.trim),T=x(RegExp.prototype.test),A=(f=TypeError,function(){for(var e=arguments.length,t=Array(e),n=0;n<e;n++)t[n]=arguments[n];return u(f,t)});function x(e){return function(t){for(var n=arguments.length,r=Array(n>1?n-1:0),o=1;o<n;o++)r[o-1]=arguments[o];return s(e,t,r)}}function S(e,r){t&&t(e,null);for(var o=r.length;o--;){var i=r[o];if("string"==typeof i){var a=g(i);a!==i&&(n(r)||(r[o]=a),i=a)}e[i]=!0}return e}function w(t){var n=l(null),r=void 0;for(r in t)s(e,t,[r])&&(n[r]=t[r]);return n}function N(e,t){for(;null!==e;){var n=o(e,t);if(n){if(n.get)return x(n.get);if("function"==typeof n.value)return x(n.value)}e=r(e)}return function(e){return console.warn("fallback value for",e),null}}var k=i(["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"]),E=i(["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"]),D=i(["feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence"]),O=i(["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"]),R=i(["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"]),_=i(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),M=i(["#text"]),L=i(["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"]),F=i(["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"]),I=i(["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"]),C=i(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),z=a(/\{\{[\s\S]*|[\s\S]*\}\}/gm),H=a(/<%[\s\S]*|[\s\S]*%>/gm),U=a(/^data-[\-\w.\u00B7-\uFFFF]/),j=a(/^aria-[\-\w]+$/),B=a(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|cid|xmpp):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),P=a(/^(?:\w+script|data):/i),W=a(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),G="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 q(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)}var K=function(){return"undefined"==typeof window?null:window},V=function(e,t){if("object"!==(void 0===e?"undefined":G(e))||"function"!=typeof e.createPolicy)return null;var n=null,r="data-tt-policy-suffix";t.currentScript&&t.currentScript.hasAttribute(r)&&(n=t.currentScript.getAttribute(r));var o="dompurify"+(n?"#"+n:"");try{return e.createPolicy(o,{createHTML:function(e){return e}})}catch(e){return console.warn("TrustedTypes policy "+o+" could not be created."),null}};return function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:K(),n=function(t){return e(t)};if(n.version="2.3.1",n.removed=[],!t||!t.document||9!==t.document.nodeType)return n.isSupported=!1,n;var r=t.document,o=t.document,a=t.DocumentFragment,l=t.HTMLTemplateElement,c=t.Node,s=t.Element,u=t.NodeFilter,f=t.NamedNodeMap,x=void 0===f?t.NamedNodeMap||t.MozNamedAttrMap:f,Y=t.Text,X=t.Comment,$=t.DOMParser,Z=t.trustedTypes,J=s.prototype,Q=N(J,"cloneNode"),ee=N(J,"nextSibling"),te=N(J,"childNodes"),ne=N(J,"parentNode");if("function"==typeof l){var re=o.createElement("template");re.content&&re.content.ownerDocument&&(o=re.content.ownerDocument)}var oe=V(Z,r),ie=oe&&ze?oe.createHTML(""):"",ae=o,le=ae.implementation,ce=ae.createNodeIterator,se=ae.createDocumentFragment,ue=ae.getElementsByTagName,fe=r.importNode,me={};try{me=w(o).documentMode?o.documentMode:{}}catch(e){}var de={};n.isSupported="function"==typeof ne&&le&&void 0!==le.createHTMLDocument&&9!==me;var pe=z,ge=H,he=U,ye=j,ve=P,be=W,Te=B,Ae=null,xe=S({},[].concat(q(k),q(E),q(D),q(R),q(M))),Se=null,we=S({},[].concat(q(L),q(F),q(I),q(C))),Ne=null,ke=null,Ee=!0,De=!0,Oe=!1,Re=!1,_e=!1,Me=!1,Le=!1,Fe=!1,Ie=!1,Ce=!0,ze=!1,He=!0,Ue=!0,je=!1,Be={},Pe=null,We=S({},["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"]),Ge=null,qe=S({},["audio","video","img","source","image","track"]),Ke=null,Ve=S({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),Ye="http://www.w3.org/1998/Math/MathML",Xe="http://www.w3.org/2000/svg",$e="http://www.w3.org/1999/xhtml",Ze=$e,Je=!1,Qe=null,et=o.createElement("form"),tt=function(e){Qe&&Qe===e||(e&&"object"===(void 0===e?"undefined":G(e))||(e={}),e=w(e),Ae="ALLOWED_TAGS"in e?S({},e.ALLOWED_TAGS):xe,Se="ALLOWED_ATTR"in e?S({},e.ALLOWED_ATTR):we,Ke="ADD_URI_SAFE_ATTR"in e?S(w(Ve),e.ADD_URI_SAFE_ATTR):Ve,Ge="ADD_DATA_URI_TAGS"in e?S(w(qe),e.ADD_DATA_URI_TAGS):qe,Pe="FORBID_CONTENTS"in e?S({},e.FORBID_CONTENTS):We,Ne="FORBID_TAGS"in e?S({},e.FORBID_TAGS):{},ke="FORBID_ATTR"in e?S({},e.FORBID_ATTR):{},Be="USE_PROFILES"in e&&e.USE_PROFILES,Ee=!1!==e.ALLOW_ARIA_ATTR,De=!1!==e.ALLOW_DATA_ATTR,Oe=e.ALLOW_UNKNOWN_PROTOCOLS||!1,Re=e.SAFE_FOR_TEMPLATES||!1,_e=e.WHOLE_DOCUMENT||!1,Fe=e.RETURN_DOM||!1,Ie=e.RETURN_DOM_FRAGMENT||!1,Ce=!1!==e.RETURN_DOM_IMPORT,ze=e.RETURN_TRUSTED_TYPE||!1,Le=e.FORCE_BODY||!1,He=!1!==e.SANITIZE_DOM,Ue=!1!==e.KEEP_CONTENT,je=e.IN_PLACE||!1,Te=e.ALLOWED_URI_REGEXP||Te,Ze=e.NAMESPACE||$e,Re&&(De=!1),Ie&&(Fe=!0),Be&&(Ae=S({},[].concat(q(M))),Se=[],!0===Be.html&&(S(Ae,k),S(Se,L)),!0===Be.svg&&(S(Ae,E),S(Se,F),S(Se,C)),!0===Be.svgFilters&&(S(Ae,D),S(Se,F),S(Se,C)),!0===Be.mathMl&&(S(Ae,R),S(Se,I),S(Se,C))),e.ADD_TAGS&&(Ae===xe&&(Ae=w(Ae)),S(Ae,e.ADD_TAGS)),e.ADD_ATTR&&(Se===we&&(Se=w(Se)),S(Se,e.ADD_ATTR)),e.ADD_URI_SAFE_ATTR&&S(Ke,e.ADD_URI_SAFE_ATTR),e.FORBID_CONTENTS&&(Pe===We&&(Pe=w(Pe)),S(Pe,e.FORBID_CONTENTS)),Ue&&(Ae["#text"]=!0),_e&&S(Ae,["html","head","body"]),Ae.table&&(S(Ae,["tbody"]),delete Ne.tbody),i&&i(e),Qe=e)},nt=S({},["mi","mo","mn","ms","mtext"]),rt=S({},["foreignobject","desc","title","annotation-xml"]),ot=S({},E);S(ot,D),S(ot,O);var it=S({},R);S(it,_);var at=function(e){var t=ne(e);t&&t.tagName||(t={namespaceURI:$e,tagName:"template"});var n=g(e.tagName),r=g(t.tagName);if(e.namespaceURI===Xe)return t.namespaceURI===$e?"svg"===n:t.namespaceURI===Ye?"svg"===n&&("annotation-xml"===r||nt[r]):Boolean(ot[n]);if(e.namespaceURI===Ye)return t.namespaceURI===$e?"math"===n:t.namespaceURI===Xe?"math"===n&&rt[r]:Boolean(it[n]);if(e.namespaceURI===$e){if(t.namespaceURI===Xe&&!rt[r])return!1;if(t.namespaceURI===Ye&&!nt[r])return!1;var o=S({},["title","style","font","a","script"]);return!it[n]&&(o[n]||!ot[n])}return!1},lt=function(e){p(n.removed,{element:e});try{e.parentNode.removeChild(e)}catch(t){try{e.outerHTML=ie}catch(t){e.remove()}}},ct=function(e,t){try{p(n.removed,{attribute:t.getAttributeNode(e),from:t})}catch(e){p(n.removed,{attribute:null,from:t})}if(t.removeAttribute(e),"is"===e&&!Se[e])if(Fe||Ie)try{lt(t)}catch(e){}else try{t.setAttribute(e,"")}catch(e){}},st=function(e){var t=void 0,n=void 0;if(Le)e="<remove></remove>"+e;else{var r=h(e,/^[\r\n\t ]+/);n=r&&r[0]}var i=oe?oe.createHTML(e):e;if(Ze===$e)try{t=(new $).parseFromString(i,"text/html")}catch(e){}if(!t||!t.documentElement){t=le.createDocument(Ze,"template",null);try{t.documentElement.innerHTML=Je?"":i}catch(e){}}var a=t.body||t.documentElement;return e&&n&&a.insertBefore(o.createTextNode(n),a.childNodes[0]||null),Ze===$e?ue.call(t,_e?"html":"body")[0]:_e?t.documentElement:a},ut=function(e){return ce.call(e.ownerDocument||e,e,u.SHOW_ELEMENT|u.SHOW_COMMENT|u.SHOW_TEXT,null,!1)},ft=function(e){return!(e instanceof Y||e instanceof X)&&!("string"==typeof e.nodeName&&"string"==typeof e.textContent&&"function"==typeof e.removeChild&&e.attributes instanceof x&&"function"==typeof e.removeAttribute&&"function"==typeof e.setAttribute&&"string"==typeof e.namespaceURI&&"function"==typeof e.insertBefore)},mt=function(e){return"object"===(void 0===c?"undefined":G(c))?e instanceof c:e&&"object"===(void 0===e?"undefined":G(e))&&"number"==typeof e.nodeType&&"string"==typeof e.nodeName},dt=function(e,t,r){de[e]&&m(de[e],(function(e){e.call(n,t,r,Qe)}))},pt=function(e){var t=void 0;if(dt("beforeSanitizeElements",e,null),ft(e))return lt(e),!0;if(h(e.nodeName,/[\u0080-\uFFFF]/))return lt(e),!0;var r=g(e.nodeName);if(dt("uponSanitizeElement",e,{tagName:r,allowedTags:Ae}),!mt(e.firstElementChild)&&(!mt(e.content)||!mt(e.content.firstElementChild))&&T(/<[/\w]/g,e.innerHTML)&&T(/<[/\w]/g,e.textContent))return lt(e),!0;if("select"===r&&T(/<template/i,e.innerHTML))return lt(e),!0;if(!Ae[r]||Ne[r]){if(Ue&&!Pe[r]){var o=ne(e)||e.parentNode,i=te(e)||e.childNodes;if(i&&o)for(var a=i.length-1;a>=0;--a)o.insertBefore(Q(i[a],!0),ee(e))}return lt(e),!0}return e instanceof s&&!at(e)?(lt(e),!0):"noscript"!==r&&"noembed"!==r||!T(/<\/no(script|embed)/i,e.innerHTML)?(Re&&3===e.nodeType&&(t=e.textContent,t=y(t,pe," "),t=y(t,ge," "),e.textContent!==t&&(p(n.removed,{element:e.cloneNode()}),e.textContent=t)),dt("afterSanitizeElements",e,null),!1):(lt(e),!0)},gt=function(e,t,n){if(He&&("id"===t||"name"===t)&&(n in o||n in et))return!1;if(De&&!ke[t]&&T(he,t));else if(Ee&&T(ye,t));else{if(!Se[t]||ke[t])return!1;if(Ke[t]);else if(T(Te,y(n,be,"")));else if("src"!==t&&"xlink:href"!==t&&"href"!==t||"script"===e||0!==v(n,"data:")||!Ge[e]){if(Oe&&!T(ve,y(n,be,"")));else if(n)return!1}else;}return!0},ht=function(e){var t=void 0,r=void 0,o=void 0,i=void 0;dt("beforeSanitizeAttributes",e,null);var a=e.attributes;if(a){var l={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:Se};for(i=a.length;i--;){var c=t=a[i],s=c.name,u=c.namespaceURI;if(r=b(t.value),o=g(s),l.attrName=o,l.attrValue=r,l.keepAttr=!0,l.forceKeepAttr=void 0,dt("uponSanitizeAttribute",e,l),r=l.attrValue,!l.forceKeepAttr&&(ct(s,e),l.keepAttr))if(T(/\/>/i,r))ct(s,e);else{Re&&(r=y(r,pe," "),r=y(r,ge," "));var f=e.nodeName.toLowerCase();if(gt(f,o,r))try{u?e.setAttributeNS(u,s,r):e.setAttribute(s,r),d(n.removed)}catch(e){}}}dt("afterSanitizeAttributes",e,null)}},yt=function e(t){var n=void 0,r=ut(t);for(dt("beforeSanitizeShadowDOM",t,null);n=r.nextNode();)dt("uponSanitizeShadowNode",n,null),pt(n)||(n.content instanceof a&&e(n.content),ht(n));dt("afterSanitizeShadowDOM",t,null)};return n.sanitize=function(e,o){var i=void 0,l=void 0,s=void 0,u=void 0,f=void 0;if((Je=!e)&&(e="\x3c!--\x3e"),"string"!=typeof e&&!mt(e)){if("function"!=typeof e.toString)throw A("toString is not a function");if("string"!=typeof(e=e.toString()))throw A("dirty is not a string, aborting")}if(!n.isSupported){if("object"===G(t.toStaticHTML)||"function"==typeof t.toStaticHTML){if("string"==typeof e)return t.toStaticHTML(e);if(mt(e))return t.toStaticHTML(e.outerHTML)}return e}if(Me||tt(o),n.removed=[],"string"==typeof e&&(je=!1),je);else if(e instanceof c)1===(l=(i=st("\x3c!----\x3e")).ownerDocument.importNode(e,!0)).nodeType&&"BODY"===l.nodeName||"HTML"===l.nodeName?i=l:i.appendChild(l);else{if(!Fe&&!Re&&!_e&&-1===e.indexOf("<"))return oe&&ze?oe.createHTML(e):e;if(!(i=st(e)))return Fe?null:ie}i&&Le&&lt(i.firstChild);for(var m=ut(je?e:i);s=m.nextNode();)3===s.nodeType&&s===u||pt(s)||(s.content instanceof a&&yt(s.content),ht(s),u=s);if(u=null,je)return e;if(Fe){if(Ie)for(f=se.call(i.ownerDocument);i.firstChild;)f.appendChild(i.firstChild);else f=i;return Ce&&(f=fe.call(r,f,!0)),f}var d=_e?i.outerHTML:i.innerHTML;return Re&&(d=y(d,pe," "),d=y(d,ge," ")),oe&&ze?oe.createHTML(d):d},n.setConfig=function(e){tt(e),Me=!0},n.clearConfig=function(){Qe=null,Me=!1},n.isValidAttribute=function(e,t,n){Qe||tt({});var r=g(e),o=g(t);return gt(r,o,n)},n.addHook=function(e,t){"function"==typeof t&&(de[e]=de[e]||[],p(de[e],t))},n.removeHook=function(e){de[e]&&d(de[e])},n.removeHooks=function(e){de[e]&&(de[e]=[])},n.removeAllHooks=function(){de={}},n}()}));
  559. //# sourceMappingURL=purify.min.js.map
  560. var extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },
  561. hasProp = {}.hasOwnProperty,
  562. bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; },
  563. slice = [].slice;
  564. (function(window) {
  565. var Base, Core, Io, Log, Timeout, ZammadChat, myScript, scriptHost, scriptProtocol, scripts;
  566. scripts = document.getElementsByTagName('script');
  567. myScript = scripts[scripts.length - 1];
  568. scriptProtocol = window.location.protocol.replace(':', '');
  569. if (myScript && myScript.src) {
  570. scriptHost = myScript.src.match('.*://([^:/]*).*')[1];
  571. scriptProtocol = myScript.src.match('(.*)://[^:/]*.*')[1];
  572. }
  573. Core = (function() {
  574. Core.prototype.defaults = {
  575. debug: false
  576. };
  577. function Core(options) {
  578. var key, ref, value;
  579. this.options = {};
  580. ref = this.defaults;
  581. for (key in ref) {
  582. value = ref[key];
  583. this.options[key] = value;
  584. }
  585. for (key in options) {
  586. value = options[key];
  587. this.options[key] = value;
  588. }
  589. }
  590. return Core;
  591. })();
  592. Base = (function(superClass) {
  593. extend(Base, superClass);
  594. function Base(options) {
  595. Base.__super__.constructor.call(this, options);
  596. this.log = new Log({
  597. debug: this.options.debug,
  598. logPrefix: this.options.logPrefix || this.logPrefix
  599. });
  600. }
  601. return Base;
  602. })(Core);
  603. Log = (function(superClass) {
  604. extend(Log, superClass);
  605. function Log() {
  606. this.log = bind(this.log, this);
  607. this.error = bind(this.error, this);
  608. this.notice = bind(this.notice, this);
  609. this.debug = bind(this.debug, this);
  610. return Log.__super__.constructor.apply(this, arguments);
  611. }
  612. Log.prototype.debug = function() {
  613. var items;
  614. items = 1 <= arguments.length ? slice.call(arguments, 0) : [];
  615. if (!this.options.debug) {
  616. return;
  617. }
  618. return this.log('debug', items);
  619. };
  620. Log.prototype.notice = function() {
  621. var items;
  622. items = 1 <= arguments.length ? slice.call(arguments, 0) : [];
  623. return this.log('notice', items);
  624. };
  625. Log.prototype.error = function() {
  626. var items;
  627. items = 1 <= arguments.length ? slice.call(arguments, 0) : [];
  628. return this.log('error', items);
  629. };
  630. Log.prototype.log = function(level, items) {
  631. var element, item, j, len, logString;
  632. items.unshift('||');
  633. items.unshift(level);
  634. items.unshift(this.options.logPrefix);
  635. console.log.apply(console, items);
  636. if (!this.options.debug) {
  637. return;
  638. }
  639. logString = '';
  640. for (j = 0, len = items.length; j < len; j++) {
  641. item = items[j];
  642. logString += ' ';
  643. if (typeof item === 'object') {
  644. logString += JSON.stringify(item);
  645. } else if (item && item.toString) {
  646. logString += item.toString();
  647. } else {
  648. logString += item;
  649. }
  650. }
  651. element = document.querySelector('.js-chatLogDisplay');
  652. if (element) {
  653. return element.innerHTML = '<div>' + logString + '</div>' + element.innerHTML;
  654. }
  655. };
  656. return Log;
  657. })(Core);
  658. Timeout = (function(superClass) {
  659. extend(Timeout, superClass);
  660. function Timeout() {
  661. this.stop = bind(this.stop, this);
  662. this.start = bind(this.start, this);
  663. return Timeout.__super__.constructor.apply(this, arguments);
  664. }
  665. Timeout.prototype.timeoutStartedAt = null;
  666. Timeout.prototype.logPrefix = 'timeout';
  667. Timeout.prototype.defaults = {
  668. debug: false,
  669. timeout: 4,
  670. timeoutIntervallCheck: 0.5
  671. };
  672. Timeout.prototype.start = function() {
  673. var check, timeoutStartedAt;
  674. this.stop();
  675. timeoutStartedAt = new Date;
  676. check = (function(_this) {
  677. return function() {
  678. var timeLeft;
  679. timeLeft = new Date - new Date(timeoutStartedAt.getTime() + _this.options.timeout * 1000 * 60);
  680. _this.log.debug("Timeout check for " + _this.options.timeout + " minutes (left " + (timeLeft / 1000) + " sec.)");
  681. if (timeLeft < 0) {
  682. return;
  683. }
  684. _this.stop();
  685. return _this.options.callback();
  686. };
  687. })(this);
  688. this.log.debug("Start timeout in " + this.options.timeout + " minutes");
  689. return this.intervallId = setInterval(check, this.options.timeoutIntervallCheck * 1000 * 60);
  690. };
  691. Timeout.prototype.stop = function() {
  692. if (!this.intervallId) {
  693. return;
  694. }
  695. this.log.debug("Stop timeout of " + this.options.timeout + " minutes");
  696. return clearInterval(this.intervallId);
  697. };
  698. return Timeout;
  699. })(Base);
  700. Io = (function(superClass) {
  701. extend(Io, superClass);
  702. function Io() {
  703. this.ping = bind(this.ping, this);
  704. this.send = bind(this.send, this);
  705. this.reconnect = bind(this.reconnect, this);
  706. this.close = bind(this.close, this);
  707. this.connect = bind(this.connect, this);
  708. this.set = bind(this.set, this);
  709. return Io.__super__.constructor.apply(this, arguments);
  710. }
  711. Io.prototype.logPrefix = 'io';
  712. Io.prototype.set = function(params) {
  713. var key, results, value;
  714. results = [];
  715. for (key in params) {
  716. value = params[key];
  717. results.push(this.options[key] = value);
  718. }
  719. return results;
  720. };
  721. Io.prototype.connect = function() {
  722. this.log.debug("Connecting to " + this.options.host);
  723. this.ws = new window.WebSocket("" + this.options.host);
  724. this.ws.onopen = (function(_this) {
  725. return function(e) {
  726. _this.log.debug('onOpen', e);
  727. _this.options.onOpen(e);
  728. return _this.ping();
  729. };
  730. })(this);
  731. this.ws.onmessage = (function(_this) {
  732. return function(e) {
  733. var j, len, pipe, pipes;
  734. pipes = JSON.parse(e.data);
  735. _this.log.debug('onMessage', e.data);
  736. for (j = 0, len = pipes.length; j < len; j++) {
  737. pipe = pipes[j];
  738. if (pipe.event === 'pong') {
  739. _this.ping();
  740. }
  741. }
  742. if (_this.options.onMessage) {
  743. return _this.options.onMessage(pipes);
  744. }
  745. };
  746. })(this);
  747. this.ws.onclose = (function(_this) {
  748. return function(e) {
  749. _this.log.debug('close websocket connection', e);
  750. if (_this.pingDelayId) {
  751. clearTimeout(_this.pingDelayId);
  752. }
  753. if (_this.manualClose) {
  754. _this.log.debug('manual close, onClose callback');
  755. _this.manualClose = false;
  756. if (_this.options.onClose) {
  757. return _this.options.onClose(e);
  758. }
  759. } else {
  760. _this.log.debug('error close, onError callback');
  761. if (_this.options.onError) {
  762. return _this.options.onError('Connection lost...');
  763. }
  764. }
  765. };
  766. })(this);
  767. return this.ws.onerror = (function(_this) {
  768. return function(e) {
  769. _this.log.debug('onError', e);
  770. if (_this.options.onError) {
  771. return _this.options.onError(e);
  772. }
  773. };
  774. })(this);
  775. };
  776. Io.prototype.close = function() {
  777. this.log.debug('close websocket manually');
  778. this.manualClose = true;
  779. return this.ws.close();
  780. };
  781. Io.prototype.reconnect = function() {
  782. this.log.debug('reconnect');
  783. this.close();
  784. return this.connect();
  785. };
  786. Io.prototype.send = function(event, data) {
  787. var msg;
  788. if (data == null) {
  789. data = {};
  790. }
  791. this.log.debug('send', event, data);
  792. msg = JSON.stringify({
  793. event: event,
  794. data: data
  795. });
  796. return this.ws.send(msg);
  797. };
  798. Io.prototype.ping = function() {
  799. var localPing;
  800. localPing = (function(_this) {
  801. return function() {
  802. return _this.send('ping');
  803. };
  804. })(this);
  805. return this.pingDelayId = setTimeout(localPing, 29000);
  806. };
  807. return Io;
  808. })(Base);
  809. ZammadChat = (function(superClass) {
  810. extend(ZammadChat, superClass);
  811. ZammadChat.prototype.defaults = {
  812. chatId: void 0,
  813. show: true,
  814. target: document.querySelector('body'),
  815. host: '',
  816. debug: false,
  817. flat: false,
  818. lang: void 0,
  819. cssAutoload: true,
  820. cssUrl: void 0,
  821. fontSize: void 0,
  822. buttonClass: 'open-zammad-chat',
  823. inactiveClass: 'is-inactive',
  824. title: '<strong>Chat</strong> with us!',
  825. scrollHint: 'Scroll down to see new messages',
  826. idleTimeout: 6,
  827. idleTimeoutIntervallCheck: 0.5,
  828. inactiveTimeout: 8,
  829. inactiveTimeoutIntervallCheck: 0.5,
  830. waitingListTimeout: 4,
  831. waitingListTimeoutIntervallCheck: 0.5,
  832. onReady: void 0,
  833. onCloseAnimationEnd: void 0,
  834. onError: void 0,
  835. onOpenAnimationEnd: void 0,
  836. onConnectionReestablished: void 0,
  837. onSessionClosed: void 0,
  838. onConnectionEstablished: void 0,
  839. onCssLoaded: void 0
  840. };
  841. ZammadChat.prototype.logPrefix = 'chat';
  842. ZammadChat.prototype._messageCount = 0;
  843. ZammadChat.prototype.isOpen = false;
  844. ZammadChat.prototype.blinkOnlineInterval = null;
  845. ZammadChat.prototype.stopBlinOnlineStateTimeout = null;
  846. ZammadChat.prototype.showTimeEveryXMinutes = 2;
  847. ZammadChat.prototype.lastTimestamp = null;
  848. ZammadChat.prototype.lastAddedType = null;
  849. ZammadChat.prototype.inputDisabled = false;
  850. ZammadChat.prototype.inputTimeout = null;
  851. ZammadChat.prototype.isTyping = false;
  852. ZammadChat.prototype.state = 'offline';
  853. ZammadChat.prototype.initialQueueDelay = 10000;
  854. ZammadChat.prototype.translations = {
  855. 'cs': {
  856. '<strong>Chat</strong> with us!': '<strong>Chatujte</strong> s námi!',
  857. 'All colleagues are busy.': 'Všichni kolegové jsou vytíženi.',
  858. 'Chat closed by %s': '%s ukončil konverzaci',
  859. 'Compose your message…': 'Napište svou zprávu…',
  860. 'Connecting': 'Připojování',
  861. 'Connection lost': 'Připojení ztraceno',
  862. 'Connection re-established': 'Připojení obnoveno',
  863. 'Offline': 'Offline',
  864. 'Online': 'Online',
  865. 'Scroll down to see new messages': 'Srolujte dolů pro zobrazení nových zpráv',
  866. 'Send': 'Odeslat',
  867. '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.',
  868. '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.',
  869. 'Start new conversation': 'Zahájit novou konverzaci',
  870. 'Today': 'Dnes',
  871. '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!',
  872. 'You are on waiting list position <strong>%s</strong>.': 'Jste <strong>%s</strong>. v pořadí na čekací listině.'
  873. },
  874. 'da': {
  875. '<strong>Chat</strong> with us!': '<strong>Chat</strong> med os!',
  876. 'All colleagues are busy.': 'Alle medarbejdere er optaget.',
  877. 'Chat closed by %s': 'Chat lukket af %s',
  878. 'Compose your message…': 'Skriv din besked…',
  879. 'Connecting': 'Forbinder',
  880. 'Connection lost': 'Forbindelse mistet',
  881. 'Connection re-established': 'Forbindelse genoprettet',
  882. 'Offline': 'Offline',
  883. 'Online': 'Online',
  884. 'Scroll down to see new messages': 'Scroll ned for at se nye beskeder',
  885. 'Send': 'Afsend',
  886. 'Since you didn\'t respond in the last %s minutes your conversation was closed.': '',
  887. 'Since you didn\'t respond in the last %s minutes your conversation with <strong>%s</strong> was closed.': '',
  888. 'Start new conversation': 'Start en ny samtale',
  889. 'Today': 'I dag',
  890. 'We are sorry, it is taking longer than expected to get a slot. Please try again later or send us an email. Thank you!': '',
  891. 'You are on waiting list position <strong>%s</strong>.': 'Du er i kø som nummer <strong>%s</strong>.'
  892. },
  893. 'de': {
  894. '<strong>Chat</strong> with us!': '<strong>Chatte</strong> mit uns!',
  895. 'All colleagues are busy.': 'Alle Kollegen sind beschäftigt.',
  896. 'Chat closed by %s': 'Chat von %s geschlossen',
  897. 'Compose your message…': 'Verfassen Sie Ihre Nachricht…',
  898. 'Connecting': 'Verbinde',
  899. 'Connection lost': 'Verbindung verloren',
  900. 'Connection re-established': 'Verbindung wieder aufgebaut',
  901. 'Offline': 'Offline',
  902. 'Online': 'Online',
  903. 'Scroll down to see new messages': 'Nach unten scrollen um neue Nachrichten zu sehen',
  904. 'Send': 'Senden',
  905. '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.',
  906. '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.',
  907. 'Start new conversation': 'Neue Unterhaltung starten',
  908. 'Today': 'Heute',
  909. '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!',
  910. 'You are on waiting list position <strong>%s</strong>.': 'Sie sind in der Warteliste auf Position <strong>%s</strong>.'
  911. },
  912. 'es': {
  913. '<strong>Chat</strong> with us!': '<strong>Chatee</strong> con nosotros!',
  914. 'All colleagues are busy.': 'Todos los colegas están ocupados.',
  915. 'Chat closed by %s': 'Chat cerrado por %s',
  916. 'Compose your message…': 'Escribe tu mensaje…',
  917. 'Connecting': 'Conectando',
  918. 'Connection lost': 'Conexión perdida',
  919. 'Connection re-established': 'Conexión reestablecida',
  920. 'Offline': 'Desconectado',
  921. 'Online': 'En línea',
  922. 'Scroll down to see new messages': 'Desplace hacia abajo para ver nuevos mensajes',
  923. 'Send': 'Enviar',
  924. '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.',
  925. '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.',
  926. 'Start new conversation': 'Iniciar nueva conversación',
  927. 'Today': 'Hoy',
  928. '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!',
  929. 'You are on waiting list position <strong>%s</strong>.': 'Usted está en la posición <strong>%s</strong> de la lista de espera.'
  930. },
  931. 'fr': {
  932. '<strong>Chat</strong> with us!': '<strong>Chattez</strong> avec nous !',
  933. 'All colleagues are busy.': 'Tous les agents sont occupés.',
  934. 'Chat closed by %s': 'Chat fermé par %s',
  935. 'Compose your message…': 'Écrivez votre message…',
  936. 'Connecting': 'Connexion',
  937. 'Connection lost': 'Connexion perdue',
  938. 'Connection re-established': 'Connexion ré-établie',
  939. 'Offline': 'Hors-ligne',
  940. 'Online': 'En ligne',
  941. 'Scroll down to see new messages': 'Défiler vers le bas pour voir les nouveaux messages',
  942. 'Send': 'Envoyer',
  943. '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.',
  944. '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.',
  945. 'Start new conversation': 'Démarrer une nouvelle conversation',
  946. 'Today': 'Aujourd\'hui',
  947. '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 !',
  948. 'You are on waiting list position <strong>%s</strong>.': 'Vous êtes actuellement en position <strong>%s</strong> dans la file d\'attente.'
  949. },
  950. 'hr': {
  951. '<strong>Chat</strong> with us!': '<strong>Čavrljajte</strong> sa nama!',
  952. 'All colleagues are busy.': 'Svi agenti su zauzeti.',
  953. 'Chat closed by %s': '%s zatvara chat',
  954. 'Compose your message…': 'Sastavite poruku…',
  955. 'Connecting': 'Povezivanje',
  956. 'Connection lost': 'Veza prekinuta',
  957. 'Connection re-established': 'Veza je ponovno uspostavljena',
  958. 'Offline': 'Odsutan',
  959. 'Online': 'Dostupan(a)',
  960. 'Scroll down to see new messages': 'Pomaknite se prema dolje da biste vidjeli nove poruke',
  961. 'Send': 'Pošalji',
  962. '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.',
  963. '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.',
  964. 'Start new conversation': 'Započni novi razgovor',
  965. 'Today': 'Danas',
  966. '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, traje duže nego inače za dobiti slobodan termin. Molimo, pokušajte ponovno kasnije ili nam pošaljite e-mail. Hvala!',
  967. 'You are on waiting list position <strong>%s</strong>.': 'Nalazite se u redu čekanja na poziciji <strong>%s</strong>.'
  968. },
  969. 'hu': {
  970. '<strong>Chat</strong> with us!': '<strong>Csevegjen</strong> velünk!',
  971. 'All colleagues are busy.': 'Minden munkatársunk foglalt.',
  972. 'Chat closed by %s': 'A csevegés %s által lezárva',
  973. 'Compose your message…': 'Fogalmazza meg üzenetét…',
  974. 'Connecting': 'Csatlakozás',
  975. 'Connection lost': 'A kapcsolat megszakadt',
  976. 'Connection re-established': 'A kapcsolat helyreállt',
  977. 'Offline': 'Offline',
  978. 'Online': 'Online',
  979. 'Scroll down to see new messages': 'Görgessen lefelé az új üzenetek megtekintéséhez',
  980. 'Send': 'Küldés',
  981. '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.',
  982. '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.',
  983. 'Start new conversation': 'Új beszélgetés indítása',
  984. 'Today': 'Ma',
  985. '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!',
  986. 'You are on waiting list position <strong>%s</strong>.': 'Ön a várólistán a <strong>%s</strong> helyen szerepel.'
  987. },
  988. 'it': {
  989. '<strong>Chat</strong> with us!': '<strong>Chatta</strong> con noi!',
  990. 'All colleagues are busy.': 'Tutti i colleghi sono occupati.',
  991. 'Chat closed by %s': 'Chat chiusa da %s',
  992. 'Compose your message…': 'Scrivi il tuo messaggio…',
  993. 'Connecting': 'Connessione in corso',
  994. 'Connection lost': 'Connessione persa',
  995. 'Connection re-established': 'Connessione ristabilita',
  996. 'Offline': 'Offline',
  997. 'Online': 'Online',
  998. 'Scroll down to see new messages': 'Scorri verso il basso per vedere i nuovi messaggi',
  999. 'Send': 'Invia',
  1000. '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.',
  1001. '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.',
  1002. 'Start new conversation': 'Avvia una nuova chat',
  1003. 'Today': 'Oggi',
  1004. '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!',
  1005. 'You are on waiting list position <strong>%s</strong>.': 'Sei alla posizione <strong>%s</strong> della lista di attesa.'
  1006. },
  1007. 'lt': {
  1008. '<strong>Chat</strong> with us!': '<strong>Kalbėkitės</strong> su mumis!',
  1009. 'All colleagues are busy.': 'Visi kolegos užimti.',
  1010. 'Chat closed by %s': '%s uždarė pokalbį',
  1011. 'Compose your message…': 'Rašykite žinutę…',
  1012. 'Connecting': 'Jungiamasi',
  1013. 'Connection lost': 'Dingo ryšys',
  1014. 'Connection re-established': 'Ryšys atnaujintas',
  1015. 'Offline': 'Atsijungęs',
  1016. 'Online': 'Prisijungęs',
  1017. 'Scroll down to see new messages': 'Naujos žinutės žemiau',
  1018. 'Send': 'Siųsti',
  1019. '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ų.',
  1020. '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ų.',
  1021. 'Start new conversation': 'Pradėti naują pokalbį',
  1022. 'Today': 'Šiandien',
  1023. '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ū!',
  1024. 'You are on waiting list position <strong>%s</strong>.': 'Esate <strong>%s</strong> eilėje.'
  1025. },
  1026. 'nl': {
  1027. '<strong>Chat</strong> with us!': '<strong>Chat</strong> met ons!',
  1028. 'All colleagues are busy.': 'Alle collega\'s zijn bezet.',
  1029. 'Chat closed by %s': 'Chat gesloten door %s',
  1030. 'Compose your message…': 'Stel je bericht op…',
  1031. 'Connecting': 'Verbinden',
  1032. 'Connection lost': 'Verbinding verbroken',
  1033. 'Connection re-established': 'Verbinding hersteld',
  1034. 'Offline': 'Offline',
  1035. 'Online': 'Online',
  1036. 'Scroll down to see new messages': 'Scroll naar beneden om nieuwe tickets te bekijken',
  1037. 'Send': 'Verstuur',
  1038. '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.',
  1039. '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.',
  1040. 'Start new conversation': 'Nieuw gesprek starten',
  1041. 'Today': 'Vandaag',
  1042. '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!',
  1043. 'You are on waiting list position <strong>%s</strong>.': 'Je bevindt zich op wachtlijstpositie <strong>%s</strong>.'
  1044. },
  1045. 'pl': {
  1046. '<strong>Chat</strong> with us!': '<strong>Czatuj</strong> z nami!',
  1047. 'All colleagues are busy.': 'Wszyscy agenci są zajęci.',
  1048. 'Chat closed by %s': 'Chat zamknięty przez %s',
  1049. 'Compose your message…': 'Skomponuj swoją wiadomość…',
  1050. 'Connecting': 'Łączenie',
  1051. 'Connection lost': 'Utracono połączenie',
  1052. 'Connection re-established': 'Ponowne nawiązanie połączenia',
  1053. 'Offline': 'Offline',
  1054. 'Online': 'Online',
  1055. 'Scroll down to see new messages': 'Skroluj w dół, aby zobaczyć wiadomości',
  1056. 'Send': 'Wyślij',
  1057. '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.',
  1058. '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.',
  1059. 'Start new conversation': 'Rozpocznij nową rozmowę',
  1060. 'Today': 'Dzisiaj',
  1061. '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!',
  1062. 'You are on waiting list position <strong>%s</strong>.': 'Jesteś na pozycji listy oczekujących <strong>%s</strong>.'
  1063. },
  1064. 'pt-br': {
  1065. '<strong>Chat</strong> with us!': '<strong>Converse</strong> conosco!',
  1066. 'All colleagues are busy.': 'Nossos atendentes estão ocupados.',
  1067. 'Chat closed by %s': 'Chat encerrado por %s',
  1068. 'Compose your message…': 'Escreva sua mensagem…',
  1069. 'Connecting': 'Conectando',
  1070. 'Connection lost': 'Conexão perdida',
  1071. 'Connection re-established': 'Conexão restabelecida',
  1072. 'Offline': 'Desconectado',
  1073. 'Online': 'Online',
  1074. 'Scroll down to see new messages': 'Rolar para baixo para ver novas mensagems',
  1075. 'Send': 'Enviar',
  1076. '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.',
  1077. '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.',
  1078. 'Start new conversation': 'Iniciar uma nova conversa',
  1079. 'Today': 'Hoje',
  1080. '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!',
  1081. 'You are on waiting list position <strong>%s</strong>.': 'Você está na posição <strong>%s</strong> da lista de espera.'
  1082. },
  1083. 'ro': {
  1084. '<strong>Chat</strong> with us!': '<strong>Comunică</strong> cu noi!',
  1085. 'All colleagues are busy.': 'Toți colegii sunt ocupați momentan.',
  1086. 'Chat closed by %s': 'Chat închis de către %s',
  1087. 'Compose your message…': 'Compune-ți mesajul…',
  1088. 'Connecting': 'Se conectează',
  1089. 'Connection lost': 'Conexiune pierdută',
  1090. 'Connection re-established': 'Conexiune restabilită',
  1091. 'Offline': 'Offline',
  1092. 'Online': 'Online',
  1093. 'Scroll down to see new messages': 'Derulați în jos pentru a vedea mesajele noi',
  1094. 'Send': 'Trimite',
  1095. 'Since you didn\'t respond in the last %s minutes your conversation was closed.': 'Deoarece nu ai răspuns în ultimele %s minute, conversația ta a fost închisă.',
  1096. 'Since you didn\'t respond in the last %s minutes your conversation with <strong>%s</strong> was closed.': 'Deoarece nu ai răspuns în ultimele %s minute, conversația ta cu <strong>%s</strong> a fost închisă.',
  1097. 'Start new conversation': 'Începe o conversație nouă',
  1098. 'Today': 'Azi',
  1099. 'We are sorry, it is taking longer than expected to get a slot. Please try again later or send us an email. Thank you!': 'Ne pare rău, durează mai mult decât ne așteptam să obținem un loc. Te rugăm să încerci din nou mai târziu sau să ne trimiți un email. Mulțumim!',
  1100. 'You are on waiting list position <strong>%s</strong>.': 'Aveți poziția <strong>%s</strong> în lista de așteptare.'
  1101. },
  1102. 'ru': {
  1103. '<strong>Chat</strong> with us!': '<strong>Напишите</strong> нам!',
  1104. 'All colleagues are busy.': 'Все коллеги заняты.',
  1105. 'Chat closed by %s': 'Чат закрыт %s',
  1106. 'Compose your message…': 'Составьте сообщение…',
  1107. 'Connecting': 'Подключение',
  1108. 'Connection lost': 'Подключение потеряно',
  1109. 'Connection re-established': 'Подключение восстановлено',
  1110. 'Offline': 'Оффлайн',
  1111. 'Online': 'В сети',
  1112. 'Scroll down to see new messages': 'Прокрутите вниз, чтобы увидеть новые сообщения',
  1113. 'Send': 'Отправить',
  1114. 'Since you didn\'t respond in the last %s minutes your conversation was closed.': 'Поскольку Вы не ответили в течение последних %s минут, Ваш разговор был закрыт.',
  1115. 'Since you didn\'t respond in the last %s minutes your conversation with <strong>%s</strong> was closed.': 'Поскольку Вы не ответили в течение последних %s минут, Ваш разговор с <strong>%s</strong> был закрыт.',
  1116. 'Start new conversation': 'Начать новый разговор',
  1117. 'Today': 'Сегодня',
  1118. 'We are sorry, it is taking longer than expected to get a slot. Please try again later or send us an email. Thank you!': 'Извините, получение свободного слота занимает больше времени, чем ожидалось. Пожалуйста, повторите попытку позже или отправьте нам электронное письмо. Благодарим Вас!',
  1119. 'You are on waiting list position <strong>%s</strong>.': 'Вы находитесь в списке ожидания <strong>%s</strong>.'
  1120. },
  1121. 'sr': {
  1122. '<strong>Chat</strong> with us!': '<strong>Ћаскајте</strong> са нама!',
  1123. 'All colleagues are busy.': 'Све колеге су заузете.',
  1124. 'Chat closed by %s': 'Ћаскање затворено од стране %s',
  1125. 'Compose your message…': 'Напишите поруку…',
  1126. 'Connecting': 'Повезивање',
  1127. 'Connection lost': 'Веза је изгубљена',
  1128. 'Connection re-established': 'Веза је поново успостављена',
  1129. 'Offline': 'Одсутан(а)',
  1130. 'Online': 'Доступан(а)',
  1131. 'Scroll down to see new messages': 'Скролујте на доле за нове поруке',
  1132. 'Send': 'Пошаљи',
  1133. 'Since you didn\'t respond in the last %s minutes your conversation was closed.': 'Пошто нисте одговорили у последњих %s минут(a), ваш разговор је завршен.',
  1134. 'Since you didn\'t respond in the last %s minutes your conversation with <strong>%s</strong> was closed.': 'Пошто нисте одговорили у последњих %s минут(a), ваш разговор са <strong>%s</strong> је завршен.',
  1135. 'Start new conversation': 'Започни нови разговор',
  1136. 'Today': 'Данас',
  1137. 'We are sorry, it is taking longer than expected to get a slot. Please try again later or send us an email. Thank you!': 'Жао нам је, добијање празног термина траје дуже од очекиваног. Молимо покушајте поново касније или нам пошаљите имејл поруку. Хвала вам!',
  1138. 'You are on waiting list position <strong>%s</strong>.': 'Ви сте тренутно <strong>%s.</strong> у реду за чекање.'
  1139. },
  1140. 'sr-latn-rs': {
  1141. '<strong>Chat</strong> with us!': '<strong>Ćaskajte</strong> sa nama!',
  1142. 'All colleagues are busy.': 'Sve kolege su zauzete.',
  1143. 'Chat closed by %s': 'Ćaskanje zatvoreno od strane %s',
  1144. 'Compose your message…': 'Napišite poruku…',
  1145. 'Connecting': 'Povezivanje',
  1146. 'Connection lost': 'Veza je izgubljena',
  1147. 'Connection re-established': 'Veza je ponovo uspostavljena',
  1148. 'Offline': 'Odsutan(a)',
  1149. 'Online': 'Dostupan(a)',
  1150. 'Scroll down to see new messages': 'Skrolujte na dole za nove poruke',
  1151. 'Send': 'Pošalji',
  1152. '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.',
  1153. '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.',
  1154. 'Start new conversation': 'Započni novi razgovor',
  1155. 'Today': 'Danas',
  1156. '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!',
  1157. 'You are on waiting list position <strong>%s</strong>.': 'Vi ste trenutno <strong>%s.</strong> u redu za čekanje.'
  1158. },
  1159. 'sv': {
  1160. '<strong>Chat</strong> with us!': '<strong>Chatta</strong> med oss!',
  1161. 'All colleagues are busy.': 'Alla kollegor är upptagna.',
  1162. 'Chat closed by %s': 'Chatt stängd av %s',
  1163. 'Compose your message…': 'Skriv ditt meddelande …',
  1164. 'Connecting': 'Ansluter',
  1165. 'Connection lost': 'Anslutningen försvann',
  1166. 'Connection re-established': 'Anslutningen återupprättas',
  1167. 'Offline': 'Offline',
  1168. 'Online': 'Online',
  1169. 'Scroll down to see new messages': 'Bläddra ner för att se nya meddelanden',
  1170. 'Send': 'Skicka',
  1171. 'Since you didn\'t respond in the last %s minutes your conversation was closed.': 'Din chatt avslutades då du inte svarade inom %s minuter.',
  1172. '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>.',
  1173. 'Start new conversation': 'Starta ny konversation',
  1174. 'Today': 'Idag',
  1175. '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!',
  1176. 'You are on waiting list position <strong>%s</strong>.': 'Du är på väntelistan som position <strong>%s</strong>.'
  1177. },
  1178. 'zh-cn': {
  1179. '<strong>Chat</strong> with us!': '发起<strong>即时对话</strong>!',
  1180. 'All colleagues are busy.': '所有同事都很忙。',
  1181. 'Chat closed by %s': '对话已被 %s 关闭',
  1182. 'Compose your message…': '编辑您的信息…',
  1183. 'Connecting': '连接中',
  1184. 'Connection lost': '连接丢失',
  1185. 'Connection re-established': '正在重新建立连接',
  1186. 'Offline': '离线',
  1187. 'Online': '在线',
  1188. 'Scroll down to see new messages': '向下滚动以查看新消息',
  1189. 'Send': '发送',
  1190. 'Since you didn\'t respond in the last %s minutes your conversation was closed.': '"由于您超过 %s 分钟没有任何回复',
  1191. 'Since you didn\'t respond in the last %s minutes your conversation with <strong>%s</strong> was closed.': '"由于您超过 %s 分钟没有回复',
  1192. 'Start new conversation': '开始新的会话',
  1193. 'Today': '今天',
  1194. 'We are sorry, it is taking longer than expected to get a slot. Please try again later or send us an email. Thank you!': '',
  1195. 'You are on waiting list position <strong>%s</strong>.': '您目前的等候位置是第 <strong>%s</strong> 位.'
  1196. }
  1197. };
  1198. ZammadChat.prototype.sessionId = void 0;
  1199. ZammadChat.prototype.scrolledToBottom = true;
  1200. ZammadChat.prototype.scrollSnapTolerance = 10;
  1201. ZammadChat.prototype.richTextFormatKey = {
  1202. 66: true,
  1203. 73: true,
  1204. 85: true,
  1205. 83: true
  1206. };
  1207. ZammadChat.prototype.T = function() {
  1208. var item, items, j, len, string, translations;
  1209. string = arguments[0], items = 2 <= arguments.length ? slice.call(arguments, 1) : [];
  1210. if (this.options.lang && this.options.lang !== 'en') {
  1211. if (!this.translations[this.options.lang]) {
  1212. this.log.notice("Translation '" + this.options.lang + "' needed!");
  1213. } else {
  1214. translations = this.translations[this.options.lang];
  1215. if (!translations[string]) {
  1216. this.log.notice("Translation needed for '" + string + "'");
  1217. }
  1218. string = translations[string] || string;
  1219. }
  1220. }
  1221. if (items) {
  1222. for (j = 0, len = items.length; j < len; j++) {
  1223. item = items[j];
  1224. string = string.replace(/%s/, item);
  1225. }
  1226. }
  1227. return string;
  1228. };
  1229. ZammadChat.prototype.view = function(name) {
  1230. return (function(_this) {
  1231. return function(options) {
  1232. if (!options) {
  1233. options = {};
  1234. }
  1235. options.T = _this.T;
  1236. options.background = _this.options.background;
  1237. options.flat = _this.options.flat;
  1238. options.fontSize = _this.options.fontSize;
  1239. return window.zammadChatTemplates[name](options);
  1240. };
  1241. })(this);
  1242. };
  1243. function ZammadChat(options) {
  1244. this.removeAttributes = bind(this.removeAttributes, this);
  1245. this.startTimeoutObservers = bind(this.startTimeoutObservers, this);
  1246. this.onCssLoaded = bind(this.onCssLoaded, this);
  1247. this.setAgentOnlineState = bind(this.setAgentOnlineState, this);
  1248. this.onConnectionEstablished = bind(this.onConnectionEstablished, this);
  1249. this.setSessionId = bind(this.setSessionId, this);
  1250. this.onConnectionReestablished = bind(this.onConnectionReestablished, this);
  1251. this.reconnect = bind(this.reconnect, this);
  1252. this.destroy = bind(this.destroy, this);
  1253. this.onScrollHintClick = bind(this.onScrollHintClick, this);
  1254. this.detectScrolledtoBottom = bind(this.detectScrolledtoBottom, this);
  1255. this.onLeaveTemporary = bind(this.onLeaveTemporary, this);
  1256. this.onAgentTypingEnd = bind(this.onAgentTypingEnd, this);
  1257. this.onAgentTypingStart = bind(this.onAgentTypingStart, this);
  1258. this.onQueue = bind(this.onQueue, this);
  1259. this.onQueueScreen = bind(this.onQueueScreen, this);
  1260. this.onWebSocketClose = bind(this.onWebSocketClose, this);
  1261. this.onCloseAnimationEnd = bind(this.onCloseAnimationEnd, this);
  1262. this.close = bind(this.close, this);
  1263. this.toggle = bind(this.toggle, this);
  1264. this.sessionClose = bind(this.sessionClose, this);
  1265. this.onOpenAnimationEnd = bind(this.onOpenAnimationEnd, this);
  1266. this.open = bind(this.open, this);
  1267. this.renderMessage = bind(this.renderMessage, this);
  1268. this.receiveMessage = bind(this.receiveMessage, this);
  1269. this.onSubmit = bind(this.onSubmit, this);
  1270. this.onInput = bind(this.onInput, this);
  1271. this.onReopenSession = bind(this.onReopenSession, this);
  1272. this.onError = bind(this.onError, this);
  1273. this.onWebSocketMessage = bind(this.onWebSocketMessage, this);
  1274. this.send = bind(this.send, this);
  1275. this.onKeydown = bind(this.onKeydown, this);
  1276. this.onPaste = bind(this.onPaste, this);
  1277. this.onDrop = bind(this.onDrop, this);
  1278. this.render = bind(this.render, this);
  1279. this.view = bind(this.view, this);
  1280. this.T = bind(this.T, this);
  1281. ZammadChat.__super__.constructor.call(this, options);
  1282. if (typeof jQuery !== 'undefined' && this.options.target instanceof jQuery) {
  1283. this.log.notice('Chat: target option is a jQuery object. jQuery is not a requirement for the chat any more.');
  1284. this.options.target = this.options.target.get(0);
  1285. }
  1286. this.isFullscreen = window.matchMedia && window.matchMedia('(max-width: 768px)').matches;
  1287. this.scrollRoot = this.getScrollRoot();
  1288. if (!window.WebSocket || !sessionStorage) {
  1289. this.state = 'unsupported';
  1290. this.log.notice('Chat: Browser not supported!');
  1291. return;
  1292. }
  1293. if (!this.options.chatId) {
  1294. this.state = 'unsupported';
  1295. this.log.error('Chat: need chatId as option!');
  1296. return;
  1297. }
  1298. if (!this.options.lang) {
  1299. this.options.lang = document.documentElement.getAttribute('lang');
  1300. }
  1301. if (this.options.lang) {
  1302. if (!this.translations[this.options.lang]) {
  1303. this.log.debug("lang: No " + this.options.lang + " found, try first two letters");
  1304. this.options.lang = this.options.lang.replace(/-.+?$/, '');
  1305. }
  1306. this.log.debug("lang: " + this.options.lang);
  1307. }
  1308. if (!this.options.host) {
  1309. this.detectHost();
  1310. }
  1311. this.loadCss();
  1312. this.io = new Io(this.options);
  1313. this.io.set({
  1314. onOpen: this.render,
  1315. onClose: this.onWebSocketClose,
  1316. onMessage: this.onWebSocketMessage,
  1317. onError: this.onError
  1318. });
  1319. this.io.connect();
  1320. }
  1321. ZammadChat.prototype.getScrollRoot = function() {
  1322. var end, html, start;
  1323. if ('scrollingElement' in document) {
  1324. return document.scrollingElement;
  1325. }
  1326. html = document.documentElement;
  1327. start = parseInt(html.pageYOffset, 10);
  1328. html.pageYOffset = start + 1;
  1329. end = parseInt(html.pageYOffset, 10);
  1330. html.pageYOffset = start;
  1331. if (end > start) {
  1332. return html;
  1333. } else {
  1334. return document.body;
  1335. }
  1336. };
  1337. ZammadChat.prototype.render = function() {
  1338. var btn;
  1339. if (!this.el || !document.querySelector('.zammad-chat')) {
  1340. this.renderBase();
  1341. }
  1342. btn = document.querySelector("." + this.options.buttonClass);
  1343. if (btn) {
  1344. btn.classList.add(this.options.inactiveClass);
  1345. }
  1346. this.setAgentOnlineState('online');
  1347. this.log.debug('widget rendered');
  1348. this.startTimeoutObservers();
  1349. this.idleTimeout.start();
  1350. this.sessionId = sessionStorage.getItem('sessionId');
  1351. return this.send('chat_status_customer', {
  1352. session_id: this.sessionId,
  1353. url: window.location.href
  1354. });
  1355. };
  1356. ZammadChat.prototype.renderBase = function() {
  1357. if (this.el) {
  1358. this.el.remove();
  1359. }
  1360. this.options.target.insertAdjacentHTML('beforeend', this.view('chat')({
  1361. title: this.options.title,
  1362. scrollHint: this.options.scrollHint
  1363. }));
  1364. this.el = this.options.target.querySelector('.zammad-chat');
  1365. this.input = this.el.querySelector('.zammad-chat-input');
  1366. this.body = this.el.querySelector('.zammad-chat-body');
  1367. this.el.querySelector('.js-chat-open').addEventListener('click', this.open);
  1368. this.el.querySelector('.js-chat-toggle').addEventListener('click', this.toggle);
  1369. this.el.querySelector('.js-chat-status').addEventListener('click', this.stopPropagation);
  1370. this.el.querySelector('.zammad-chat-controls').addEventListener('submit', this.onSubmit);
  1371. this.body.addEventListener('scroll', this.detectScrolledtoBottom);
  1372. this.el.querySelector('.zammad-scroll-hint').addEventListener('click', this.onScrollHintClick);
  1373. this.input.addEventListener('keydown', this.onKeydown);
  1374. this.input.addEventListener('input', this.onInput);
  1375. this.input.addEventListener('paste', this.onPaste);
  1376. this.input.addEventListener('drop', this.onDrop);
  1377. window.addEventListener('beforeunload', this.onLeaveTemporary);
  1378. return window.addEventListener('hashchange', (function(_this) {
  1379. return function() {
  1380. if (_this.isOpen) {
  1381. if (_this.sessionId) {
  1382. _this.send('chat_session_notice', {
  1383. session_id: _this.sessionId,
  1384. message: window.location.href
  1385. });
  1386. }
  1387. return;
  1388. }
  1389. return _this.idleTimeout.start();
  1390. };
  1391. })(this));
  1392. };
  1393. ZammadChat.prototype.stopPropagation = function(event) {
  1394. return event.stopPropagation();
  1395. };
  1396. ZammadChat.prototype.onDrop = function(e) {
  1397. var dataTransfer, file, reader, x, y;
  1398. e.stopPropagation();
  1399. e.preventDefault();
  1400. if (window.dataTransfer) {
  1401. dataTransfer = window.dataTransfer;
  1402. } else if (e.dataTransfer) {
  1403. dataTransfer = e.dataTransfer;
  1404. } else {
  1405. throw 'No clipboardData support';
  1406. }
  1407. x = e.clientX;
  1408. y = e.clientY;
  1409. file = dataTransfer.files[0];
  1410. if (file.type.match('image.*')) {
  1411. reader = new FileReader();
  1412. reader.onload = (function(_this) {
  1413. return function(e) {
  1414. var insert;
  1415. insert = function(dataUrl, width) {
  1416. var img, pos, range, result;
  1417. if (_this.isRetina()) {
  1418. width = width / 2;
  1419. }
  1420. result = dataUrl;
  1421. img = new Image();
  1422. img.style.width = '100%';
  1423. img.style.maxWidth = width + 'px';
  1424. img.src = result;
  1425. if (document.caretPositionFromPoint) {
  1426. pos = document.caretPositionFromPoint(x, y);
  1427. range = document.createRange();
  1428. range.setStart(pos.offsetNode, pos.offset);
  1429. range.collapse();
  1430. return range.insertNode(img);
  1431. } else if (document.caretRangeFromPoint) {
  1432. range = document.caretRangeFromPoint(x, y);
  1433. return range.insertNode(img);
  1434. } else {
  1435. return console.log('could not find carat');
  1436. }
  1437. };
  1438. return _this.resizeImage(e.target.result, 460, 'auto', 2, 'image/jpeg', 'auto', insert);
  1439. };
  1440. })(this);
  1441. return reader.readAsDataURL(file);
  1442. }
  1443. };
  1444. ZammadChat.prototype.onPaste = function(e) {
  1445. var clipboardData, docType, html, htmlTmp, imageFile, imageInserted, item, j, k, l, len, len1, len2, len3, m, match, newTag, node, outer, reader, ref, ref1, ref2, ref3, regex, replacementTag, sanitized, text;
  1446. e.stopPropagation();
  1447. e.preventDefault();
  1448. if (e.clipboardData) {
  1449. clipboardData = e.clipboardData;
  1450. } else if (window.clipboardData) {
  1451. clipboardData = window.clipboardData;
  1452. } else if (e.clipboardData) {
  1453. clipboardData = e.clipboardData;
  1454. } else {
  1455. throw 'No clipboardData support';
  1456. }
  1457. imageInserted = false;
  1458. if (clipboardData && clipboardData.items && clipboardData.items[0]) {
  1459. item = clipboardData.items[0];
  1460. if (item.kind === 'file' && (item.type === 'image/png' || item.type === 'image/jpeg')) {
  1461. imageFile = item.getAsFile();
  1462. reader = new FileReader();
  1463. reader.onload = (function(_this) {
  1464. return function(e) {
  1465. var insert;
  1466. insert = function(dataUrl, width) {
  1467. var img;
  1468. if (_this.isRetina()) {
  1469. width = width / 2;
  1470. }
  1471. img = new Image();
  1472. img.style.width = '100%';
  1473. img.style.maxWidth = width + 'px';
  1474. img.src = dataUrl;
  1475. return document.execCommand('insertHTML', false, img);
  1476. };
  1477. return _this.resizeImage(e.target.result, 460, 'auto', 2, 'image/jpeg', 'auto', insert);
  1478. };
  1479. })(this);
  1480. reader.readAsDataURL(imageFile);
  1481. imageInserted = true;
  1482. }
  1483. }
  1484. if (imageInserted) {
  1485. return;
  1486. }
  1487. text = void 0;
  1488. docType = void 0;
  1489. try {
  1490. text = clipboardData.getData('text/html');
  1491. docType = 'html';
  1492. if (!text || text.length === 0) {
  1493. docType = 'text';
  1494. text = clipboardData.getData('text/plain');
  1495. }
  1496. if (!text || text.length === 0) {
  1497. docType = 'text2';
  1498. text = clipboardData.getData('text');
  1499. }
  1500. } catch (error) {
  1501. e = error;
  1502. console.log('Sorry, can\'t insert markup because browser is not supporting it.');
  1503. docType = 'text3';
  1504. text = clipboardData.getData('text');
  1505. }
  1506. if (docType === 'text' || docType === 'text2' || docType === 'text3') {
  1507. text = '<div>' + text.replace(/\n/g, '</div><div>') + '</div>';
  1508. text = text.replace(/<div><\/div>/g, '<div><br></div>');
  1509. }
  1510. console.log('p', docType, text);
  1511. if (docType === 'html') {
  1512. html = document.createElement('div');
  1513. sanitized = DOMPurify.sanitize(text);
  1514. this.log.debug('sanitized HTML clipboard', sanitized);
  1515. html.innerHTML = sanitized;
  1516. match = false;
  1517. htmlTmp = text;
  1518. regex = new RegExp('<(/w|w)\:[A-Za-z]');
  1519. if (htmlTmp.match(regex)) {
  1520. match = true;
  1521. htmlTmp = htmlTmp.replace(regex, '');
  1522. }
  1523. regex = new RegExp('<(/o|o)\:[A-Za-z]');
  1524. if (htmlTmp.match(regex)) {
  1525. match = true;
  1526. htmlTmp = htmlTmp.replace(regex, '');
  1527. }
  1528. if (match) {
  1529. html = this.wordFilter(html);
  1530. }
  1531. ref = html.childNodes;
  1532. for (j = 0, len = ref.length; j < len; j++) {
  1533. node = ref[j];
  1534. if (node.nodeType === 8) {
  1535. node.remove();
  1536. }
  1537. }
  1538. ref1 = html.querySelectorAll('a, font, small, time, form, label');
  1539. for (k = 0, len1 = ref1.length; k < len1; k++) {
  1540. node = ref1[k];
  1541. node.outerHTML = node.innerHTML;
  1542. }
  1543. replacementTag = 'div';
  1544. ref2 = html.querySelectorAll('textarea');
  1545. for (l = 0, len2 = ref2.length; l < len2; l++) {
  1546. node = ref2[l];
  1547. outer = node.outerHTML;
  1548. regex = new RegExp('<' + node.tagName, 'i');
  1549. newTag = outer.replace(regex, '<' + replacementTag);
  1550. regex = new RegExp('</' + node.tagName, 'i');
  1551. newTag = newTag.replace(regex, '</' + replacementTag);
  1552. node.outerHTML = newTag;
  1553. }
  1554. ref3 = html.querySelectorAll('font, img, svg, input, select, button, style, applet, embed, noframes, canvas, script, frame, iframe, meta, link, title, head, fieldset');
  1555. for (m = 0, len3 = ref3.length; m < len3; m++) {
  1556. node = ref3[m];
  1557. node.remove();
  1558. }
  1559. this.removeAttributes(html);
  1560. text = html.innerHTML;
  1561. }
  1562. if (docType === 'text3') {
  1563. this.pasteHtmlAtCaret(text);
  1564. } else {
  1565. document.execCommand('insertHTML', false, text);
  1566. }
  1567. return true;
  1568. };
  1569. ZammadChat.prototype.onKeydown = function(e) {
  1570. var richtTextControl;
  1571. if (!this.inputDisabled && !e.shiftKey && e.keyCode === 13) {
  1572. e.preventDefault();
  1573. this.sendMessage();
  1574. }
  1575. richtTextControl = false;
  1576. if (!e.altKey && !e.ctrlKey && e.metaKey) {
  1577. richtTextControl = true;
  1578. } else if (!e.altKey && e.ctrlKey && !e.metaKey) {
  1579. richtTextControl = true;
  1580. }
  1581. if (richtTextControl && this.richTextFormatKey[e.keyCode]) {
  1582. e.preventDefault();
  1583. if (e.keyCode === 66) {
  1584. document.execCommand('bold');
  1585. return true;
  1586. }
  1587. if (e.keyCode === 73) {
  1588. document.execCommand('italic');
  1589. return true;
  1590. }
  1591. if (e.keyCode === 85) {
  1592. document.execCommand('underline');
  1593. return true;
  1594. }
  1595. if (e.keyCode === 83) {
  1596. document.execCommand('strikeThrough');
  1597. return true;
  1598. }
  1599. }
  1600. };
  1601. ZammadChat.prototype.send = function(event, data) {
  1602. if (data == null) {
  1603. data = {};
  1604. }
  1605. data.chat_id = this.options.chatId;
  1606. return this.io.send(event, data);
  1607. };
  1608. ZammadChat.prototype.onWebSocketMessage = function(pipes) {
  1609. var j, len, pipe;
  1610. for (j = 0, len = pipes.length; j < len; j++) {
  1611. pipe = pipes[j];
  1612. this.log.debug('ws:onmessage', pipe);
  1613. switch (pipe.event) {
  1614. case 'chat_error':
  1615. this.log.notice(pipe.data);
  1616. if (pipe.data && pipe.data.state === 'chat_disabled') {
  1617. this.destroy({
  1618. remove: true
  1619. });
  1620. }
  1621. break;
  1622. case 'chat_session_message':
  1623. if (pipe.data.self_written) {
  1624. return;
  1625. }
  1626. this.receiveMessage(pipe.data);
  1627. break;
  1628. case 'chat_session_typing':
  1629. if (pipe.data.self_written) {
  1630. return;
  1631. }
  1632. this.onAgentTypingStart();
  1633. break;
  1634. case 'chat_session_start':
  1635. this.onConnectionEstablished(pipe.data);
  1636. break;
  1637. case 'chat_session_queue':
  1638. this.onQueueScreen(pipe.data);
  1639. break;
  1640. case 'chat_session_closed':
  1641. this.onSessionClosed(pipe.data);
  1642. break;
  1643. case 'chat_session_left':
  1644. this.onSessionClosed(pipe.data);
  1645. break;
  1646. case 'chat_status_customer':
  1647. switch (pipe.data.state) {
  1648. case 'online':
  1649. this.sessionId = void 0;
  1650. if (!this.options.cssAutoload || this.cssLoaded) {
  1651. this.onReady();
  1652. } else {
  1653. this.socketReady = true;
  1654. }
  1655. break;
  1656. case 'offline':
  1657. this.onError('Zammad Chat: No agent online');
  1658. break;
  1659. case 'chat_disabled':
  1660. this.onError('Zammad Chat: Chat is disabled');
  1661. break;
  1662. case 'no_seats_available':
  1663. this.onError("Zammad Chat: Too many clients in queue. Clients in queue: " + pipe.data.queue);
  1664. break;
  1665. case 'reconnect':
  1666. this.onReopenSession(pipe.data);
  1667. }
  1668. }
  1669. }
  1670. };
  1671. ZammadChat.prototype.onReady = function() {
  1672. var base, btn;
  1673. this.log.debug('widget ready for use');
  1674. btn = document.querySelector("." + this.options.buttonClass);
  1675. if (btn) {
  1676. btn.addEventListener('click', this.open);
  1677. btn.classList.remove(this.options.inactiveClass);
  1678. }
  1679. if (typeof (base = this.options).onReady === "function") {
  1680. base.onReady();
  1681. }
  1682. if (this.options.show) {
  1683. return this.show();
  1684. }
  1685. };
  1686. ZammadChat.prototype.onError = function(message) {
  1687. var base, btn;
  1688. this.log.debug(message);
  1689. this.addStatus(message);
  1690. btn = document.querySelector("." + this.options.buttonClass);
  1691. if (btn) {
  1692. btn.classList.add('zammad-chat-is-hidden');
  1693. }
  1694. if (this.isOpen) {
  1695. this.disableInput();
  1696. this.destroy({
  1697. remove: false
  1698. });
  1699. } else {
  1700. this.destroy({
  1701. remove: true
  1702. });
  1703. }
  1704. return typeof (base = this.options).onError === "function" ? base.onError(message) : void 0;
  1705. };
  1706. ZammadChat.prototype.onReopenSession = function(data) {
  1707. var j, len, message, ref, unfinishedMessage;
  1708. this.log.debug('old messages', data.session);
  1709. this.inactiveTimeout.start();
  1710. unfinishedMessage = sessionStorage.getItem('unfinished_message');
  1711. if (data.agent) {
  1712. this.onConnectionEstablished(data);
  1713. ref = data.session;
  1714. for (j = 0, len = ref.length; j < len; j++) {
  1715. message = ref[j];
  1716. this.renderMessage({
  1717. message: message.content,
  1718. id: message.id,
  1719. from: message.created_by_id ? 'agent' : 'customer'
  1720. });
  1721. }
  1722. if (unfinishedMessage) {
  1723. this.input.innerHTML = unfinishedMessage;
  1724. }
  1725. }
  1726. if (data.position) {
  1727. this.onQueue(data);
  1728. }
  1729. this.show();
  1730. this.open();
  1731. this.scrollToBottom();
  1732. if (unfinishedMessage) {
  1733. return this.input.focus();
  1734. }
  1735. };
  1736. ZammadChat.prototype.onInput = function() {
  1737. var j, len, message, ref;
  1738. ref = this.el.querySelectorAll('.zammad-chat-message--unread');
  1739. for (j = 0, len = ref.length; j < len; j++) {
  1740. message = ref[j];
  1741. message.classList.remove('zammad-chat-message--unread');
  1742. }
  1743. sessionStorage.setItem('unfinished_message', this.input.innerHTML);
  1744. return this.onTyping();
  1745. };
  1746. ZammadChat.prototype.onTyping = function() {
  1747. if (this.isTyping && this.isTyping > new Date(new Date().getTime() - 1500)) {
  1748. return;
  1749. }
  1750. this.isTyping = new Date();
  1751. this.send('chat_session_typing', {
  1752. session_id: this.sessionId
  1753. });
  1754. return this.inactiveTimeout.start();
  1755. };
  1756. ZammadChat.prototype.onSubmit = function(event) {
  1757. event.preventDefault();
  1758. return this.sendMessage();
  1759. };
  1760. ZammadChat.prototype.sendMessage = function() {
  1761. var message, messageElement;
  1762. message = this.input.innerHTML;
  1763. if (!message) {
  1764. return;
  1765. }
  1766. this.inactiveTimeout.start();
  1767. sessionStorage.removeItem('unfinished_message');
  1768. messageElement = this.view('message')({
  1769. message: message,
  1770. from: 'customer',
  1771. id: this._messageCount++,
  1772. unreadClass: ''
  1773. });
  1774. this.maybeAddTimestamp();
  1775. if (this.el.querySelector('.zammad-chat-message--typing')) {
  1776. this.lastAddedType = 'typing-placeholder';
  1777. this.el.querySelector('.zammad-chat-message--typing').insertAdjacentHTML('beforebegin', messageElement);
  1778. } else {
  1779. this.lastAddedType = 'message--customer';
  1780. this.body.insertAdjacentHTML('beforeend', messageElement);
  1781. }
  1782. this.input.innerHTML = '';
  1783. this.scrollToBottom();
  1784. return this.send('chat_session_message', {
  1785. content: message,
  1786. id: this._messageCount,
  1787. session_id: this.sessionId
  1788. });
  1789. };
  1790. ZammadChat.prototype.receiveMessage = function(data) {
  1791. this.inactiveTimeout.start();
  1792. this.onAgentTypingEnd();
  1793. this.maybeAddTimestamp();
  1794. this.renderMessage({
  1795. message: data.message.content,
  1796. id: data.id,
  1797. from: 'agent'
  1798. });
  1799. return this.scrollToBottom({
  1800. showHint: true
  1801. });
  1802. };
  1803. ZammadChat.prototype.renderMessage = function(data) {
  1804. this.lastAddedType = "message--" + data.from;
  1805. data.unreadClass = document.hidden ? ' zammad-chat-message--unread' : '';
  1806. return this.body.insertAdjacentHTML('beforeend', this.view('message')(data));
  1807. };
  1808. ZammadChat.prototype.open = function() {
  1809. var remainerHeight;
  1810. if (this.isOpen) {
  1811. this.log.debug('widget already open, block');
  1812. return;
  1813. }
  1814. this.isOpen = true;
  1815. this.log.debug('open widget');
  1816. this.show();
  1817. if (!this.sessionId) {
  1818. this.showLoader();
  1819. }
  1820. this.el.classList.add('zammad-chat-is-open');
  1821. remainerHeight = this.el.clientHeight - this.el.querySelector('.zammad-chat-header').offsetHeight;
  1822. this.el.style.transform = "translateY(" + remainerHeight + "px)";
  1823. this.el.clientHeight;
  1824. if (!this.sessionId) {
  1825. this.el.addEventListener('transitionend', this.onOpenAnimationEnd);
  1826. this.el.classList.add('zammad-chat--animate');
  1827. this.el.clientHeight;
  1828. this.el.style.transform = '';
  1829. return this.send('chat_session_init', {
  1830. url: window.location.href
  1831. });
  1832. } else {
  1833. this.el.style.transform = '';
  1834. return this.onOpenAnimationEnd();
  1835. }
  1836. };
  1837. ZammadChat.prototype.onOpenAnimationEnd = function() {
  1838. var base;
  1839. this.el.removeEventListener('transitionend', this.onOpenAnimationEnd);
  1840. this.el.classList.remove('zammad-chat--animate');
  1841. this.idleTimeout.stop();
  1842. if (this.isFullscreen) {
  1843. this.disableScrollOnRoot();
  1844. }
  1845. return typeof (base = this.options).onOpenAnimationEnd === "function" ? base.onOpenAnimationEnd() : void 0;
  1846. };
  1847. ZammadChat.prototype.sessionClose = function() {
  1848. this.send('chat_session_close', {
  1849. session_id: this.sessionId
  1850. });
  1851. this.inactiveTimeout.stop();
  1852. this.waitingListTimeout.stop();
  1853. sessionStorage.removeItem('unfinished_message');
  1854. if (this.onInitialQueueDelayId) {
  1855. clearTimeout(this.onInitialQueueDelayId);
  1856. }
  1857. return this.setSessionId(void 0);
  1858. };
  1859. ZammadChat.prototype.toggle = function(event) {
  1860. if (this.isOpen) {
  1861. return this.close(event);
  1862. } else {
  1863. return this.open(event);
  1864. }
  1865. };
  1866. ZammadChat.prototype.close = function(event) {
  1867. var remainerHeight;
  1868. if (!this.isOpen) {
  1869. this.log.debug('can\'t close widget, it\'s not open');
  1870. return;
  1871. }
  1872. if (this.initDelayId) {
  1873. clearTimeout(this.initDelayId);
  1874. }
  1875. if (this.sessionId) {
  1876. this.log.debug('session close before widget close');
  1877. this.sessionClose();
  1878. }
  1879. this.log.debug('close widget');
  1880. if (event) {
  1881. event.stopPropagation();
  1882. }
  1883. if (this.isFullscreen) {
  1884. this.enableScrollOnRoot();
  1885. }
  1886. remainerHeight = this.el.clientHeight - this.el.querySelector('.zammad-chat-header').offsetHeight;
  1887. this.el.addEventListener('transitionend', this.onCloseAnimationEnd);
  1888. this.el.classList.add('zammad-chat--animate');
  1889. document.offsetHeight;
  1890. return this.el.style.transform = "translateY(" + remainerHeight + "px)";
  1891. };
  1892. ZammadChat.prototype.onCloseAnimationEnd = function() {
  1893. var base;
  1894. this.el.removeEventListener('transitionend', this.onCloseAnimationEnd);
  1895. this.el.classList.remove('zammad-chat-is-open', 'zammad-chat--animate');
  1896. this.el.style.transform = '';
  1897. this.showLoader();
  1898. this.el.querySelector('.zammad-chat-welcome').classList.remove('zammad-chat-is-hidden');
  1899. this.el.querySelector('.zammad-chat-agent').classList.add('zammad-chat-is-hidden');
  1900. this.el.querySelector('.zammad-chat-agent-status').classList.add('zammad-chat-is-hidden');
  1901. this.isOpen = false;
  1902. if (typeof (base = this.options).onCloseAnimationEnd === "function") {
  1903. base.onCloseAnimationEnd();
  1904. }
  1905. return this.io.reconnect();
  1906. };
  1907. ZammadChat.prototype.onWebSocketClose = function() {
  1908. if (this.isOpen) {
  1909. return;
  1910. }
  1911. if (this.el) {
  1912. this.el.classList.remove('zammad-chat-is-shown');
  1913. return this.el.classList.remove('zammad-chat-is-loaded');
  1914. }
  1915. };
  1916. ZammadChat.prototype.show = function() {
  1917. if (this.state === 'offline') {
  1918. return;
  1919. }
  1920. this.el.classList.add('zammad-chat-is-loaded');
  1921. return this.el.classList.add('zammad-chat-is-shown');
  1922. };
  1923. ZammadChat.prototype.disableInput = function() {
  1924. this.inputDisabled = true;
  1925. this.input.setAttribute('contenteditable', false);
  1926. this.el.querySelector('.zammad-chat-send').disabled = true;
  1927. return this.io.close();
  1928. };
  1929. ZammadChat.prototype.enableInput = function() {
  1930. this.inputDisabled = false;
  1931. this.input.setAttribute('contenteditable', true);
  1932. return this.el.querySelector('.zammad-chat-send').disabled = false;
  1933. };
  1934. ZammadChat.prototype.hideModal = function() {
  1935. return this.el.querySelector('.zammad-chat-modal').innerHTML = '';
  1936. };
  1937. ZammadChat.prototype.onQueueScreen = function(data) {
  1938. var show;
  1939. this.setSessionId(data.session_id);
  1940. show = (function(_this) {
  1941. return function() {
  1942. _this.onQueue(data);
  1943. return _this.waitingListTimeout.start();
  1944. };
  1945. })(this);
  1946. if (this.initialQueueDelay && !this.onInitialQueueDelayId) {
  1947. this.onInitialQueueDelayId = setTimeout(show, this.initialQueueDelay);
  1948. return;
  1949. }
  1950. if (this.onInitialQueueDelayId) {
  1951. clearTimeout(this.onInitialQueueDelayId);
  1952. }
  1953. return show();
  1954. };
  1955. ZammadChat.prototype.onQueue = function(data) {
  1956. this.log.notice('onQueue', data.position);
  1957. this.inQueue = true;
  1958. return this.el.querySelector('.zammad-chat-modal').innerHTML = this.view('waiting')({
  1959. position: data.position
  1960. });
  1961. };
  1962. ZammadChat.prototype.onAgentTypingStart = function() {
  1963. if (this.stopTypingId) {
  1964. clearTimeout(this.stopTypingId);
  1965. }
  1966. this.stopTypingId = setTimeout(this.onAgentTypingEnd, 3000);
  1967. if (this.el.querySelector('.zammad-chat-message--typing')) {
  1968. return;
  1969. }
  1970. this.maybeAddTimestamp();
  1971. this.body.insertAdjacentHTML('beforeend', this.view('typingIndicator')());
  1972. if (!this.isVisible(this.el.querySelector('.zammad-chat-message--typing'), true)) {
  1973. return;
  1974. }
  1975. return this.scrollToBottom();
  1976. };
  1977. ZammadChat.prototype.onAgentTypingEnd = function() {
  1978. if (this.el.querySelector('.zammad-chat-message--typing')) {
  1979. return this.el.querySelector('.zammad-chat-message--typing').remove();
  1980. }
  1981. };
  1982. ZammadChat.prototype.onLeaveTemporary = function() {
  1983. if (!this.sessionId) {
  1984. return;
  1985. }
  1986. return this.send('chat_session_leave_temporary', {
  1987. session_id: this.sessionId
  1988. });
  1989. };
  1990. ZammadChat.prototype.maybeAddTimestamp = function() {
  1991. var label, time, timestamp;
  1992. timestamp = Date.now();
  1993. if (!this.lastTimestamp || (timestamp - this.lastTimestamp) > this.showTimeEveryXMinutes * 60000) {
  1994. label = this.T('Today');
  1995. time = new Date().toTimeString().substr(0, 5);
  1996. if (this.lastAddedType === 'timestamp') {
  1997. this.updateLastTimestamp(label, time);
  1998. return this.lastTimestamp = timestamp;
  1999. } else {
  2000. this.body.insertAdjacentHTML('beforeend', this.view('timestamp')({
  2001. label: label,
  2002. time: time
  2003. }));
  2004. this.lastTimestamp = timestamp;
  2005. this.lastAddedType = 'timestamp';
  2006. return this.scrollToBottom();
  2007. }
  2008. }
  2009. };
  2010. ZammadChat.prototype.updateLastTimestamp = function(label, time) {
  2011. var timestamps;
  2012. if (!this.el) {
  2013. return;
  2014. }
  2015. timestamps = this.el.querySelectorAll('.zammad-chat-body .zammad-chat-timestamp');
  2016. if (!timestamps) {
  2017. return;
  2018. }
  2019. return timestamps[timestamps.length - 1].outerHTML = this.view('timestamp')({
  2020. label: label,
  2021. time: time
  2022. });
  2023. };
  2024. ZammadChat.prototype.addStatus = function(status) {
  2025. if (!this.el) {
  2026. return;
  2027. }
  2028. this.maybeAddTimestamp();
  2029. this.body.insertAdjacentHTML('beforeend', this.view('status')({
  2030. status: status
  2031. }));
  2032. return this.scrollToBottom();
  2033. };
  2034. ZammadChat.prototype.detectScrolledtoBottom = function() {
  2035. var scrollBottom;
  2036. scrollBottom = this.body.scrollTop + this.body.offsetHeight;
  2037. this.scrolledToBottom = Math.abs(scrollBottom - this.body.scrollHeight) <= this.scrollSnapTolerance;
  2038. if (this.scrolledToBottom) {
  2039. return this.el.querySelector('.zammad-scroll-hint').classList.add('is-hidden');
  2040. }
  2041. };
  2042. ZammadChat.prototype.showScrollHint = function() {
  2043. this.el.querySelector('.zammad-scroll-hint').classList.remove('is-hidden');
  2044. return this.body.scrollTop = this.body.scrollTop + this.el.querySelector('.zammad-scroll-hint').offsetHeight;
  2045. };
  2046. ZammadChat.prototype.onScrollHintClick = function() {
  2047. return this.body.scrollTo({
  2048. top: this.body.scrollHeight,
  2049. behavior: 'smooth'
  2050. });
  2051. };
  2052. ZammadChat.prototype.scrollToBottom = function(arg) {
  2053. var showHint;
  2054. showHint = (arg != null ? arg : {
  2055. showHint: false
  2056. }).showHint;
  2057. if (this.scrolledToBottom) {
  2058. return this.body.scrollTop = this.body.scrollHeight;
  2059. } else if (showHint) {
  2060. return this.showScrollHint();
  2061. }
  2062. };
  2063. ZammadChat.prototype.destroy = function(params) {
  2064. var btn;
  2065. if (params == null) {
  2066. params = {};
  2067. }
  2068. this.log.debug('destroy widget', params);
  2069. this.setAgentOnlineState('offline');
  2070. if (params.remove && this.el) {
  2071. this.el.remove();
  2072. btn = document.querySelector("." + this.options.buttonClass);
  2073. if (btn) {
  2074. btn.classList.add(this.options.inactiveClass);
  2075. btn.style.display = 'none';
  2076. }
  2077. }
  2078. if (this.waitingListTimeout) {
  2079. this.waitingListTimeout.stop();
  2080. }
  2081. if (this.inactiveTimeout) {
  2082. this.inactiveTimeout.stop();
  2083. }
  2084. if (this.idleTimeout) {
  2085. this.idleTimeout.stop();
  2086. }
  2087. return this.io.close();
  2088. };
  2089. ZammadChat.prototype.reconnect = function() {
  2090. this.log.notice('reconnecting');
  2091. this.disableInput();
  2092. this.lastAddedType = 'status';
  2093. this.setAgentOnlineState('connecting');
  2094. return this.addStatus(this.T('Connection lost'));
  2095. };
  2096. ZammadChat.prototype.onConnectionReestablished = function() {
  2097. var base;
  2098. this.lastAddedType = 'status';
  2099. this.setAgentOnlineState('online');
  2100. this.addStatus(this.T('Connection re-established'));
  2101. return typeof (base = this.options).onConnectionReestablished === "function" ? base.onConnectionReestablished() : void 0;
  2102. };
  2103. ZammadChat.prototype.onSessionClosed = function(data) {
  2104. var base;
  2105. this.addStatus(this.T('Chat closed by %s', data.realname));
  2106. this.disableInput();
  2107. this.setAgentOnlineState('offline');
  2108. this.inactiveTimeout.stop();
  2109. return typeof (base = this.options).onSessionClosed === "function" ? base.onSessionClosed(data) : void 0;
  2110. };
  2111. ZammadChat.prototype.setSessionId = function(id) {
  2112. this.sessionId = id;
  2113. if (id === void 0) {
  2114. return sessionStorage.removeItem('sessionId');
  2115. } else {
  2116. return sessionStorage.setItem('sessionId', id);
  2117. }
  2118. };
  2119. ZammadChat.prototype.onConnectionEstablished = function(data) {
  2120. var base;
  2121. if (this.onInitialQueueDelayId) {
  2122. clearTimeout(this.onInitialQueueDelayId);
  2123. }
  2124. this.inQueue = false;
  2125. if (data.agent) {
  2126. this.agent = data.agent;
  2127. }
  2128. if (data.session_id) {
  2129. this.setSessionId(data.session_id);
  2130. }
  2131. this.body.innerHTML = '';
  2132. this.el.querySelector('.zammad-chat-agent').innerHTML = this.view('agent')({
  2133. agent: this.agent
  2134. });
  2135. this.enableInput();
  2136. this.hideModal();
  2137. this.el.querySelector('.zammad-chat-welcome').classList.add('zammad-chat-is-hidden');
  2138. this.el.querySelector('.zammad-chat-agent').classList.remove('zammad-chat-is-hidden');
  2139. this.el.querySelector('.zammad-chat-agent-status').classList.remove('zammad-chat-is-hidden');
  2140. if (!this.isFullscreen) {
  2141. this.input.focus();
  2142. }
  2143. this.setAgentOnlineState('online');
  2144. this.waitingListTimeout.stop();
  2145. this.idleTimeout.stop();
  2146. this.inactiveTimeout.start();
  2147. return typeof (base = this.options).onConnectionEstablished === "function" ? base.onConnectionEstablished(data) : void 0;
  2148. };
  2149. ZammadChat.prototype.showCustomerTimeout = function() {
  2150. this.el.querySelector('.zammad-chat-modal').innerHTML = this.view('customer_timeout')({
  2151. agent: this.agent.name,
  2152. delay: this.options.inactiveTimeout
  2153. });
  2154. this.el.querySelector('.js-restart').addEventListener('click', function() {
  2155. return location.reload();
  2156. });
  2157. return this.sessionClose();
  2158. };
  2159. ZammadChat.prototype.showWaitingListTimeout = function() {
  2160. this.el.querySelector('.zammad-chat-modal').innerHTML = this.view('waiting_list_timeout')({
  2161. delay: this.options.watingListTimeout
  2162. });
  2163. this.el.querySelector('.js-restart').addEventListener('click', function() {
  2164. return location.reload();
  2165. });
  2166. return this.sessionClose();
  2167. };
  2168. ZammadChat.prototype.showLoader = function() {
  2169. return this.el.querySelector('.zammad-chat-modal').innerHTML = this.view('loader')();
  2170. };
  2171. ZammadChat.prototype.setAgentOnlineState = function(state) {
  2172. var capitalizedState;
  2173. this.state = state;
  2174. if (!this.el) {
  2175. return;
  2176. }
  2177. capitalizedState = state.charAt(0).toUpperCase() + state.slice(1);
  2178. this.el.querySelector('.zammad-chat-agent-status').dataset.status = state;
  2179. return this.el.querySelector('.zammad-chat-agent-status').textContent = this.T(capitalizedState);
  2180. };
  2181. ZammadChat.prototype.detectHost = function() {
  2182. var protocol;
  2183. protocol = 'ws://';
  2184. if (scriptProtocol === 'https') {
  2185. protocol = 'wss://';
  2186. }
  2187. return this.options.host = "" + protocol + scriptHost + "/ws";
  2188. };
  2189. ZammadChat.prototype.loadCss = function() {
  2190. var newSS, styles, url;
  2191. if (!this.options.cssAutoload) {
  2192. return;
  2193. }
  2194. url = this.options.cssUrl;
  2195. if (!url) {
  2196. url = this.options.host.replace(/^wss/i, 'https').replace(/^ws/i, 'http').replace(/\/ws$/i, '');
  2197. url += '/assets/chat/chat.css';
  2198. }
  2199. this.log.debug("load css from '" + url + "'");
  2200. styles = "@import url('" + url + "');";
  2201. newSS = document.createElement('link');
  2202. newSS.onload = this.onCssLoaded;
  2203. newSS.rel = 'stylesheet';
  2204. newSS.href = 'data:text/css,' + escape(styles);
  2205. return document.getElementsByTagName('head')[0].appendChild(newSS);
  2206. };
  2207. ZammadChat.prototype.onCssLoaded = function() {
  2208. var base;
  2209. this.cssLoaded = true;
  2210. if (this.socketReady) {
  2211. this.onReady();
  2212. }
  2213. return typeof (base = this.options).onCssLoaded === "function" ? base.onCssLoaded() : void 0;
  2214. };
  2215. ZammadChat.prototype.startTimeoutObservers = function() {
  2216. this.idleTimeout = new Timeout({
  2217. logPrefix: 'idleTimeout',
  2218. debug: this.options.debug,
  2219. timeout: this.options.idleTimeout,
  2220. timeoutIntervallCheck: this.options.idleTimeoutIntervallCheck,
  2221. callback: (function(_this) {
  2222. return function() {
  2223. _this.log.debug('Idle timeout reached, hide widget', new Date);
  2224. return _this.destroy({
  2225. remove: true
  2226. });
  2227. };
  2228. })(this)
  2229. });
  2230. this.inactiveTimeout = new Timeout({
  2231. logPrefix: 'inactiveTimeout',
  2232. debug: this.options.debug,
  2233. timeout: this.options.inactiveTimeout,
  2234. timeoutIntervallCheck: this.options.inactiveTimeoutIntervallCheck,
  2235. callback: (function(_this) {
  2236. return function() {
  2237. _this.log.debug('Inactive timeout reached, show timeout screen.', new Date);
  2238. _this.showCustomerTimeout();
  2239. return _this.destroy({
  2240. remove: false
  2241. });
  2242. };
  2243. })(this)
  2244. });
  2245. return this.waitingListTimeout = new Timeout({
  2246. logPrefix: 'waitingListTimeout',
  2247. debug: this.options.debug,
  2248. timeout: this.options.waitingListTimeout,
  2249. timeoutIntervallCheck: this.options.waitingListTimeoutIntervallCheck,
  2250. callback: (function(_this) {
  2251. return function() {
  2252. _this.log.debug('Waiting list timeout reached, show timeout screen.', new Date);
  2253. _this.showWaitingListTimeout();
  2254. return _this.destroy({
  2255. remove: false
  2256. });
  2257. };
  2258. })(this)
  2259. });
  2260. };
  2261. ZammadChat.prototype.disableScrollOnRoot = function() {
  2262. this.rootScrollOffset = this.scrollRoot.scrollTop;
  2263. this.scrollRoot.style.overflow = 'hidden';
  2264. return this.scrollRoot.style.position = 'fixed';
  2265. };
  2266. ZammadChat.prototype.enableScrollOnRoot = function() {
  2267. this.scrollRoot.scrollTop = this.rootScrollOffset;
  2268. this.scrollRoot.style.overflow = '';
  2269. return this.scrollRoot.style.position = '';
  2270. };
  2271. ZammadChat.prototype.isVisible = function(el, partial, hidden, direction) {
  2272. var bViz, clientSize, hVisible, lViz, rViz, rec, tViz, vVisible, vpHeight, vpWidth;
  2273. if (el.length < 1) {
  2274. return;
  2275. }
  2276. vpWidth = window.innerWidth;
  2277. vpHeight = window.innerHeight;
  2278. direction = direction ? direction : 'both';
  2279. clientSize = hidden === true ? t.offsetWidth * t.offsetHeight : true;
  2280. rec = el.getBoundingClientRect();
  2281. tViz = rec.top >= 0 && rec.top < vpHeight;
  2282. bViz = rec.bottom > 0 && rec.bottom <= vpHeight;
  2283. lViz = rec.left >= 0 && rec.left < vpWidth;
  2284. rViz = rec.right > 0 && rec.right <= vpWidth;
  2285. vVisible = partial ? tViz || bViz : tViz && bViz;
  2286. hVisible = partial ? lViz || rViz : lViz && rViz;
  2287. if (direction === 'both') {
  2288. return clientSize && vVisible && hVisible;
  2289. } else if (direction === 'vertical') {
  2290. return clientSize && vVisible;
  2291. } else if (direction === 'horizontal') {
  2292. return clientSize && hVisible;
  2293. }
  2294. };
  2295. ZammadChat.prototype.isRetina = function() {
  2296. var mq;
  2297. if (window.matchMedia) {
  2298. 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)');
  2299. return mq && mq.matches || (window.devicePixelRatio > 1);
  2300. }
  2301. return false;
  2302. };
  2303. ZammadChat.prototype.resizeImage = function(dataURL, x, y, sizeFactor, type, quallity, callback, force) {
  2304. var imageObject;
  2305. if (x == null) {
  2306. x = 'auto';
  2307. }
  2308. if (y == null) {
  2309. y = 'auto';
  2310. }
  2311. if (sizeFactor == null) {
  2312. sizeFactor = 1;
  2313. }
  2314. if (force == null) {
  2315. force = true;
  2316. }
  2317. imageObject = new Image();
  2318. imageObject.onload = function() {
  2319. var canvas, context, factor, imageHeight, imageWidth, newDataUrl, resize;
  2320. imageWidth = imageObject.width;
  2321. imageHeight = imageObject.height;
  2322. console.log('ImageService', 'current size', imageWidth, imageHeight);
  2323. if (y === 'auto' && x === 'auto') {
  2324. x = imageWidth;
  2325. y = imageHeight;
  2326. }
  2327. if (y === 'auto') {
  2328. factor = imageWidth / x;
  2329. y = imageHeight / factor;
  2330. }
  2331. if (x === 'auto') {
  2332. factor = imageWidth / y;
  2333. x = imageHeight / factor;
  2334. }
  2335. resize = false;
  2336. if (x < imageWidth || y < imageHeight) {
  2337. resize = true;
  2338. x = x * sizeFactor;
  2339. y = y * sizeFactor;
  2340. } else {
  2341. x = imageWidth;
  2342. y = imageHeight;
  2343. }
  2344. canvas = document.createElement('canvas');
  2345. canvas.width = x;
  2346. canvas.height = y;
  2347. context = canvas.getContext('2d');
  2348. context.drawImage(imageObject, 0, 0, x, y);
  2349. if (quallity === 'auto') {
  2350. if (x < 200 && y < 200) {
  2351. quallity = 1;
  2352. } else if (x < 400 && y < 400) {
  2353. quallity = 0.9;
  2354. } else if (x < 600 && y < 600) {
  2355. quallity = 0.8;
  2356. } else if (x < 900 && y < 900) {
  2357. quallity = 0.7;
  2358. } else {
  2359. quallity = 0.6;
  2360. }
  2361. }
  2362. newDataUrl = canvas.toDataURL(type, quallity);
  2363. if (resize) {
  2364. console.log('ImageService', 'resize', x / sizeFactor, y / sizeFactor, quallity, (newDataUrl.length * 0.75) / 1024 / 1024, 'in mb');
  2365. callback(newDataUrl, x / sizeFactor, y / sizeFactor, true);
  2366. return;
  2367. }
  2368. console.log('ImageService', 'no resize', x, y, quallity, (newDataUrl.length * 0.75) / 1024 / 1024, 'in mb');
  2369. return callback(newDataUrl, x, y, false);
  2370. };
  2371. return imageObject.src = dataURL;
  2372. };
  2373. ZammadChat.prototype.pasteHtmlAtCaret = function(html) {
  2374. var el, frag, lastNode, node, range, sel;
  2375. sel = void 0;
  2376. range = void 0;
  2377. if (window.getSelection) {
  2378. sel = window.getSelection();
  2379. if (sel.getRangeAt && sel.rangeCount) {
  2380. range = sel.getRangeAt(0);
  2381. range.deleteContents();
  2382. el = document.createElement('div');
  2383. el.innerHTML = html;
  2384. frag = document.createDocumentFragment(node, lastNode);
  2385. while (node = el.firstChild) {
  2386. lastNode = frag.appendChild(node);
  2387. }
  2388. range.insertNode(frag);
  2389. if (lastNode) {
  2390. range = range.cloneRange();
  2391. range.setStartAfter(lastNode);
  2392. range.collapse(true);
  2393. sel.removeAllRanges();
  2394. return sel.addRange(range);
  2395. }
  2396. }
  2397. } else if (document.selection && document.selection.type !== 'Control') {
  2398. return document.selection.createRange().pasteHTML(html);
  2399. }
  2400. };
  2401. ZammadChat.prototype.wordFilter = function(editor) {
  2402. 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;
  2403. content = editor.html();
  2404. content = content.replace(/<!--[\s\S]+?-->/gi, '');
  2405. content = content.replace(/<(!|script[^>]*>.*?<\/script(?=[>\s])|\/?(\?xml(:\w+)?|img|meta|link|style|\w:\w+)(?=[\s\/>]))[^>]*>/gi, '');
  2406. content = content.replace(/<(\/?)s>/gi, '<$1strike>');
  2407. content = content.replace(/&nbsp;/gi, ' ');
  2408. editor.innerHTML = content;
  2409. ref = editor.querySelectorAll('p');
  2410. for (j = 0, len = ref.length; j < len; j++) {
  2411. p = ref[j];
  2412. str = p.getAttribute('style');
  2413. matches = /mso-list:\w+ \w+([0-9]+)/.exec(str);
  2414. if (matches) {
  2415. p.dataset._listLevel = parseInt(matches[1], 10);
  2416. }
  2417. }
  2418. last_level = 0;
  2419. pnt = null;
  2420. ref1 = editor.querySelectorAll('p');
  2421. for (k = 0, len1 = ref1.length; k < len1; k++) {
  2422. p = ref1[k];
  2423. cur_level = p.dataset._listLevel;
  2424. if (cur_level !== void 0) {
  2425. txt = p.textContent;
  2426. list_tag = '<ul></ul>';
  2427. if (/^\s*\w+\./.test(txt)) {
  2428. matches = /([0-9])\./.exec(txt);
  2429. if (matches) {
  2430. start = parseInt(matches[1], 10);
  2431. list_tag = (ref2 = start > 1) != null ? ref2 : '<ol start="' + start + {
  2432. '"></ol>': '<ol></ol>'
  2433. };
  2434. } else {
  2435. list_tag = '<ol></ol>';
  2436. }
  2437. }
  2438. if (cur_level > last_level) {
  2439. if (last_level === 0) {
  2440. p.insertAdjacentHTML('beforebegin', list_tag);
  2441. pnt = p.previousElementSibling;
  2442. } else {
  2443. }
  2444. pnt.insertAdjacentHTML('beforeend', list_tag);
  2445. }
  2446. if (cur_level < last_level) {
  2447. for (i = l = ref3 = i, ref4 = last_level - cur_level; ref3 <= ref4 ? l <= ref4 : l >= ref4; i = ref3 <= ref4 ? ++l : --l) {
  2448. pnt = pnt.parentNode;
  2449. }
  2450. }
  2451. if (p.querySelector('span:first')) {
  2452. p.querySelector('span:first').remove();
  2453. }
  2454. pnt.insertAdjacentHTML('beforeend', '<li>' + p.innerHTML + '</li>');
  2455. p.remove();
  2456. last_level = cur_level;
  2457. } else {
  2458. last_level = 0;
  2459. }
  2460. }
  2461. ref5 = editor.querySelectorAll('[style]');
  2462. for (m = 0, len2 = ref5.length; m < len2; m++) {
  2463. el = ref5[m];
  2464. el.removeAttribute('style');
  2465. }
  2466. ref6 = editor.querySelectorAll('[align]');
  2467. for (n = 0, len3 = ref6.length; n < len3; n++) {
  2468. el = ref6[n];
  2469. el.removeAttribute('align');
  2470. }
  2471. ref7 = editor.querySelectorAll('span');
  2472. for (o = 0, len4 = ref7.length; o < len4; o++) {
  2473. el = ref7[o];
  2474. el.outerHTML = el.innerHTML;
  2475. }
  2476. ref8 = editor.querySelectorAll('span:empty');
  2477. for (q = 0, len5 = ref8.length; q < len5; q++) {
  2478. el = ref8[q];
  2479. el.remove();
  2480. }
  2481. ref9 = editor.querySelectorAll("[class^='Mso']");
  2482. for (r = 0, len6 = ref9.length; r < len6; r++) {
  2483. el = ref9[r];
  2484. el.removeAttribute('class');
  2485. }
  2486. ref10 = editor.querySelectorAll('p:empty');
  2487. for (s = 0, len7 = ref10.length; s < len7; s++) {
  2488. el = ref10[s];
  2489. el.remove();
  2490. }
  2491. return editor;
  2492. };
  2493. ZammadChat.prototype.removeAttribute = function(element) {
  2494. var att, j, len, ref, results;
  2495. if (!element) {
  2496. return;
  2497. }
  2498. ref = element.attributes;
  2499. results = [];
  2500. for (j = 0, len = ref.length; j < len; j++) {
  2501. att = ref[j];
  2502. results.push(element.removeAttribute(att.name));
  2503. }
  2504. return results;
  2505. };
  2506. ZammadChat.prototype.removeAttributes = function(html) {
  2507. var j, len, node, ref;
  2508. ref = html.querySelectorAll('*');
  2509. for (j = 0, len = ref.length; j < len; j++) {
  2510. node = ref[j];
  2511. this.removeAttribute(node);
  2512. }
  2513. return html;
  2514. };
  2515. return ZammadChat;
  2516. })(Base);
  2517. return window.ZammadChat = ZammadChat;
  2518. })(window);