/*!
* Copyright Zendesk, Inc.
*
* By downloading or accessing this software, You agree to the Zendesk Terms of Service (https://www.zendesk.com/company/terms) and Application Developer and API License Agreement (https://www.zendesk.com/company/application-developer-and-api-license-agreement) and acknowledge that such terms govern Your use of and access to the software.
*
*/
!function(e, t) {
"object" == typeof exports && "object" == typeof module ? module.exports = t() : "function" == typeof define && define.amd ? define([], t) : "object" == typeof exports ? exports.zChat = t() : e.zChat = t();
}(this, function() {
return function(e) {
function t(i) {
if (n[i]) return n[i].exports;
var o = n[i] = {
exports: {},
id: i,
loaded: !1
};
e[i].call(o.exports, o, o.exports, t);
o.loaded = !0;
return o.exports;
}
var n = {};
t.c = n;
return t(0);
}([ function(e, t, n) {
(function(t) {
e.exports = function() {
var e = n(2), i = e;
t(i, "web_sdk");
return i;
}();
}).call(t, n(1));
}, function(e, t) {
function n(e, t) {
if ("function" == typeof e && e.prototype && !e.__jx__no_fqname) {
e.prototype.__jx__fqname_chain = (e.prototype.__jx__fqname_chain || "") + " " + t;
e.prototype.__jx__fqname = t;
}
}
e.exports = n;
}, function(e, t, n) {
(function(t, i, o, r, s, a) {
e.exports = function() {
function e(e) {
if (pe || me) ne(new Error("Zendesk Chat Web SDK has already been initialized. Please ensure that zChat.init() is only called once in your code")); else {
var t = Ne.obj({
account_key: Ne.type("string").ok(),
suppress_console_error: Ne.type("boolean"),
override_proxy: Ne.type("string").ok()
}, {
requiredKeys: [ "account_key" ]
});
if (!ie([ t ], [ e ], "init()")) {
var n = new be("root"), i = new be("root");
Ie() && n.$("livechat").$("ui").$("mobile$bool").update(!0);
c(e, $e, n, i);
}
}
}
function c(e, t, n, i) {
de = t;
pe = n;
me = i;
K();
ge = function(e) {
Te.fire(e.type, e.detail);
};
De.on("data", ge);
_e = function(e) {
var t = e.path ? me.descend(e.path) : me;
t.update(e.update);
};
de.on("message", _e);
ye.ACCOUNT_KEY = e.account_key;
ve = e.suppress_console_error || !1;
Oe.init();
de.init({
root: pe,
overrideProxy: e.override_proxy,
isCookieDenied: function() {
return !1;
},
source: "web_sdk",
lastHost: Oe.DOM.getVariable("web_sdk_last_host"),
source_ver: "1.1.4"
});
pe.$("connection").$("server$string").bindValue(function(e) {
e && Oe.DOM.saveVariable("web_sdk_last_host", e);
});
ke.init(pe, de);
Ee.init(pe);
}
function u() {
de.reconnect();
}
function l() {
return De;
}
function f() {
return qe(me.$("livechat").$("profile").getValue());
}
function h(e, t) {
var n = "setVisitorInfo()", i = Ne.obj({
display_name: Ne.any([ Ne.equal(""), Ne.type("string").regex(Pe) ]),
email: Ne.any([ Ne.equal(""), Ne.type("string").regex(Ae.email) ]),
phone: Ne.any([ Ne.equal(""), Ne.type("string").regex(Re) ])
});
if (!ie([ i, je ], [ e, t ], n)) {
var o = {};
t = t || Le;
"display_name" in e && (o.display_name$string = e.display_name);
"email" in e && (o.email$string = e.email);
"phone" in e && (o.phone$string = e.phone);
pe.$("livechat").$("profile").write(o, se(t));
}
}
function d(e, t) {
var n = "sendChatMsg()", i = Ne.type("string").regex(Pe);
if (!ie([ i, je ], [ e, t ], n)) {
t = t || Le;
ke.sendChatMsg({
msg: e.trim()
}, null, se(t));
}
}
function p(e, t) {
var n = "sendFile()", i = Ne.chain(oe);
ie([ i, je ], [ e, t ], n) || m(e, t);
}
function m(e, t) {
t = t || Le;
$e.reconnectIfServerRetired(function() {
ke.sendFileWithCallback(e, t);
});
}
function g(e) {
var t = "getDepartment()", n = Ne.type("number");
if (!ie([ n ], [ e ], t)) return _(e);
}
function _(e) {
var t = me.$("livechat").$("departments").$(e).getValue();
if (t) return Be(t, e);
}
function v() {
return J(me.$("livechat").$("departments").getValue(), Be);
}
function w() {
var e = me.$("livechat").$("profile").$("department_id$int"), t = e.getValue();
return i(t) ? t : void 0;
}
function b(e, t) {
var n = "setVisitorDefaultDepartment()", i = Ne.type("number").chain(re);
if (!ie([ i, je ], [ e, t ], n)) {
t = t || Le;
pe.$("livechat").$("profile").write({
department_id$int: e
}, se(t));
}
}
function y(e) {
var t = "clearVisitorDefaultDepartment()";
if (!ie([ je ], [ e ], t)) {
e = e || Le;
pe.$("livechat").$("profile").write({
department_id$int: null
}, se(e));
}
}
function $(e, t) {
k("added$string", e, "addTag()", t);
}
function E(e, t) {
k("removed$string", e, "removeTag()", t);
}
function k(e, t, n, i) {
var o = Ne.type("string").regex(Pe).regex(/[^,]/);
if (!ie([ o, je ], [ t, i ], n)) {
i = i || Le;
var r = {};
r[e] = t.trim();
pe.$("livechat").$("channel").$("tags").write(r, se(i));
}
}
function S(e, t) {
var n = "sendVisitorPath()", i = Ne.obj({
title: Ne.type("string").regex(Pe),
url: Ne.type("string").regex(Me)
}, {
requiredKeys: [ "title", "url" ]
});
if (!ie([ i, je ], [ e, t ], n)) {
t = t || Le;
pe.$("livechat").$("session").$("page_path").write({
url$string: e.url,
title$string: e.title
}, se(t));
}
}
function x() {
var e = me.$("livechat").$("channel").$("rating$string").getValue(), t = me.$("livechat").$("channel").$("comment$string").getValue(), n = {};
o(e) || (n.rating = e);
o(t) || (n.comment = t);
return n;
}
function A(e, t) {
var n = "sendChatRating()", i = Ne.any([ Ne.equal(null), Ne.equal("good"), Ne.equal("bad") ]);
if (!ie([ i, je ], [ e, t ], n)) {
t = t || Le;
pe.$("livechat").$("channel").write({
rating$string: e
}, se(t));
}
}
function O(e, t) {
var n = "sendChatComment()", i = Ne.type("string");
if (!ie([ i, je ], [ e, t ], n)) {
t = t || Le;
pe.$("livechat").$("channel").write({
comment$string: e
}, se(t));
}
}
function C(e) {
var t = "endChat()", n = pe.$("livechat").$("channel");
if (!ie([ je ], [ e ], t)) {
e = e || Le;
n.write({
chatting$bool: !1
}, se(e));
}
}
function I() {
return me.$("livechat").$("channel").$("chatting$bool").getValue() || !1;
}
function T() {
return J(me.$("livechat").$("agents").getValue(), We);
}
function D(e) {
return We(me.$("livechat").$("agents").$(e).getValue(), e);
}
function L() {
var e = me.$("livechat"), t = e.$("settings"), n = t.$("operating_hours");
if (t.hasKey("operating_hours")) {
var i = n.$("type$string").getValue(), o = {
enabled: n.$("enabled$bool").getValue(),
type: i,
timezone: t.$("timezone$string").getValue() || "UTC"
};
"account" == i ? o.account_schedule = ae(n.$("schedule").getValue() || {}) : "department" == i && (o.department_schedule = ce(n.$("schedules").getValue(), e.$("departments").getKeys()));
return o;
}
}
function N(e, t) {
var n = "sendOfflineMsg()", i = Ne.obj({
name: Ne.type("string").regex(Pe),
email: Ne.type("string").regex(Ae.email),
message: Ne.type("string").regex(Pe)
}, {
requiredKeys: [ "name", "email", "message" ]
});
if (!ie([ i, je ], [ e, t ], n)) {
t = t || Le;
var o = {
name: {
name$string: "name",
value$string: e.name
},
email: {
name$string: "email",
value$string: e.email
},
message: {
name$string: "message",
value$string: e.message
}
};
"department" in e && (o.department = {
name$string: "department_id",
value$string: e.department
});
pe.$("livechat").$("settings").$("forms").$("offline_form").$("form_submitted").write(o, se(t));
}
}
function R(e, t) {
var n = "sendTyping()", i = Ne.type("boolean");
if (!ie([ i, je ], [ e, t ], n)) {
t = t || Le;
pe.$("livechat").$("channel").$("typing").write({
typing$bool: e
}, se(t));
}
}
function M(e, t) {
var n = "sendEmailTranscript()", i = Ne.type("string").regex(Ae.email);
if (!ie([ i, je ], [ e, t ], n)) {
t = t || Le;
pe.$("livechat").$("channel").write({
email_transcript$string: e
}, se(t));
}
}
function P(e, t) {
return {
id: parseInt(t, 10)
};
}
function j(e) {
var t = e.hasOwnProperty("typing$bool");
return t ? {
type: "typing"
} : null;
}
function U(e) {
var t = e.hasOwnProperty("typing$bool"), n = {
type: "typing",
nick: "agent:trigger"
};
return t ? n : null;
}
function V(e) {
return 0 === e.indexOf("visitor:") ? "visitor" : e;
}
function F(e) {
if (!e.type$string) return null;
if (!e.nick$string) return null;
var t = {
nick: V(e.nick$string),
type: e.type$string
}, n = e.msg$string;
switch (e.type$string) {
case "chat.msg":
if (Ae.file_upload.test(n)) {
if (e.unverified$bool === !0) return null;
var i = /uploaded: (.+)\nURL: (.+)\nType: (.+)\nSize: (.+)(\nThumb: (.+))?/i, o = i.exec(n);
if (!o) return null;
var r = {
mime_type: o[3],
name: o[1],
size: parseInt(o[4], 10),
url: o[2]
};
return we.extend(t, {
type: "chat.file",
display_name: e.display_name$string,
attachment: r
});
}
return we.extend(t, {
display_name: e.display_name$string,
msg: n,
options: e.options$string ? e.options$string.split("/") : []
});
case "chat.rating":
return we.extend(t, {
display_name: e.display_name$string,
new_rating: e.new_rating$string,
rating: e.rating$string
});
case "chat.comment":
return we.extend(t, {
display_name: e.display_name$string,
comment: e.comment$string,
new_comment: e.new_comment$string
});
case "chat.memberjoin":
case "chat.memberleave":
case "chat.request.rating":
return we.extend(t, {
display_name: e.display_name$string
});
case "chat.event":
var s, a = /Please wait while our agents attend to you. There are currently (\d+) visitor\(s\) waiting to be served\./;
return "agent:system" === e.nick$string && (s = a.exec(n)) ? {
type: "chat.wait_queue",
nick: "system.queue",
wait_queue: parseInt(s[1], 10)
} : null;
case "chat.join":
var c = e.history;
if (c && c[0]) {
var u = we.extend({}, c[0]), l = u.timestamp$int;
u.type$string = u.__type$string;
u.display_name$string = u.name$string;
l *= 1e3;
u.timestamp$int = l;
return F(u);
}
return null;
case "chat.file.update":
return null;
default:
return null;
}
}
function z() {
var e, t, n, i = [ "type$string", "timestamp$int" ], o = me.$("livechat").$("channel").$("log").getValue(), r = [];
for (var s in o) if (o.hasOwnProperty(s)) {
if (o[s].type$string) e = o[s]; else {
e = pe.$("livechat").$("channel").$("log").$(s).getValue();
if ("chat.msg" === e.type$string && (e.unverified$bool === !0 || e.failed$bool === !0)) continue;
}
var a = F(e);
if (null === a) continue;
for (var c = 0; c < i.length; c++) {
t = i[c];
n = ee(t);
n in a || (a[n] = e[t]);
}
r.push(a);
}
return r;
}
function q() {
var e = me.$("connection").$("status$string").getValue();
return Fe(e)[0];
}
function B() {
var e = me.$("livechat").$("account").$("status$string").getValue();
return ze(e)[0];
}
function W(e, t, n) {
return function(i, o) {
if (null === i) return {};
for (var a = {}, c = 0, u = e.length; c < u; c++) {
var l = e[c];
l in i && (a[ee(l)] = i[l]);
}
r(t) && Object.keys(a).length && (a[t] = o);
if (s(n)) {
var f = n(i, o);
return null === f ? {} : we.extend(a, f);
}
return a;
};
}
function G(e, t, n) {
me.descend(t).bindValue(function(t) {
var i = n(t);
i.forEach(function(t) {
H(e, t);
});
});
}
function H(e, t) {
if (t) {
if (t instanceof Error) {
if (!t.message) return;
} else if ("object" == typeof t && !Object.keys(t).length) return;
De.fire("data", {
type: e,
detail: t
});
}
}
function K() {
G("connection_update", "connection.status$string", Y(Ue));
G("account_status", "livechat.account.status$string", Y(Ve));
G("visitor_update", "livechat.profile", Z([ "email$string", "phone$string", "display_name$string" ], f));
G("department_update", "livechat.departments", Q([ "name$string", "status$string" ], _));
G("agent_update", "livechat.agents", Q([ "avatar_path$string", "display_name$string", "title$string" ], D));
G("chat", "livechat.channel.log", X(Ke));
G("chat", "livechat.agents", X(Ge));
G("chat", "livechat.triggers.agents", X(He));
}
function Y(e) {
return function(t) {
return void 0 === t ? [ null ] : [ e[t] || null ];
};
}
function X(e) {
return function(t) {
return J(t, e);
};
}
function J(e, t) {
var n = [];
for (var i in e) e.hasOwnProperty(i) && n.push(t(e[i], i));
return n;
}
function Z(e, t) {
return function(n) {
return e.some(function(e) {
return n && e in n;
}) ? [ t() ] : [ null ];
};
}
function Q(e, t) {
return function(n) {
var i = [];
for (var o in n) if (n.hasOwnProperty(o)) {
var r = n[o], s = e.some(function(e) {
return r && e in r;
});
s && i.push(t(o));
}
return i;
};
}
function ee(e) {
return e.split("$")[0];
}
function te(e) {
if (!e || "object" != typeof e) return e;
var t = {};
for (var n in e) if (e.hasOwnProperty(n)) {
var i = ee(n), o = te(e[n]);
t[i] = o;
}
return t;
}
function ne(e, t) {
t = t ? t + ": " : "";
e = new Error("Zendesk Chat Web SDK: Error: " + t + e.message);
ve || window.console && window.console.error && console.error(e.message);
H("error", e);
}
function ie(e, t, n) {
for (var i = 0; i < e.length; i++) {
var o = e[i], r = o(t[i]);
if (r) {
ne(r, n);
return !0;
}
}
return !1;
}
function oe(e) {
var t = Object.prototype.toString.call(e);
if ("[object File]" !== t) return new Error("Expect a File object");
}
function re(e) {
var t = g(e);
if (!t) return new Error("Expect a valid department id");
}
function se(e) {
return function(t) {
var n = "ok" === t.raw.__status ? null : new window.Error("Failed");
e(n);
};
}
function ae(e) {
for (var t, n, i = 7, o = {}, r = 0; r < i; r++) {
var s = e[r] || {};
if (s.enabled$bool) {
t = [];
n = s.periods;
for (var a in n) n.hasOwnProperty(a) && t.push({
start: n[a].start$int,
end: n[a].end$int
});
o[r] = fe(t);
} else o[r] = [];
}
return o;
}
function ce(e, t) {
var n, i = 7, o = {}, r = le(e), s = ue(e, t);
t.forEach(function(e) {
var t = s[e];
o[e] = {};
for (n = 0; n < i; n++) o[e][n] = [];
t.forEach(function(t) {
for (var n in r[t]) r[t].hasOwnProperty(n) && Array.prototype.push.apply(o[e][n], r[t][n]);
});
for (n = 0; n < i; n++) {
var a = o[e][n];
a.length > 1 && (o[e][n] = fe(a));
}
});
return o;
}
function ue(e, t) {
var n, i = {};
t.forEach(function(e) {
i[e] = [];
});
for (var o in e) if (e.hasOwnProperty(o)) {
n = e[o];
for (var r in n.departments) if (n.departments.hasOwnProperty(r)) {
if (!n.departments[r]) continue;
var s = ee(r);
if (!i[s]) continue;
i[s].push(o);
}
}
return i;
}
function le(e) {
var t, n, i = 7, o = {};
for (var r in e) if (e.hasOwnProperty(r)) {
n = e[r];
if (n.hasOwnProperty("deleted_ts$int")) continue;
if (!n.departments) continue;
if (!n.enabled$bool) continue;
t = {};
for (var s = 0; s < i; s++) {
var a = n[s], c = [];
if (a.enabled$bool && a.periods) {
var u = a.periods;
for (var l in u) u.hasOwnProperty(l) && c.push({
start: u[l].start$int,
end: u[l].end$int
});
c.length && (t[s] = c);
}
}
Object.keys(t).length && (o[r] = t);
}
return o;
}
function fe(e) {
function t(e) {
var t, n = [], i = 0;
e.forEach(function(e, o) {
e > 0 && !t && (t = o);
if (e) {
i += e;
if (0 === i) {
n.push({
start: t,
end: o
});
t = void 0;
}
}
});
return n;
}
if (e.length <= 1) return e;
var n = [];
e.forEach(function(e) {
n[e.start] = void 0 !== n[e.start] ? n[e.start] + 1 : 1;
n[e.end] = void 0 !== n[e.end] ? n[e.end] - 1 : -1;
});
return t(n);
}
function he() {
var e = me.$("livechat").$("settings"), t = e.getValue(), n = we.clone(Ce.livechat.settings), i = xe.fullyExtend(n, t), o = Ye(i);
return te(o);
}
var de, pe, me, ge, _e, ve, we = n(10), be = n(11), ye = n(12), $e = n(14), Ee = n(61), ke = n(47), Se = n(62), xe = n(22), Ae = n(59), Oe = n(15), Ce = n(46), Ie = n(32), Te = t.extend({
init: e,
reconnect: u,
getFirehose: l,
setVisitorInfo: h,
getVisitorInfo: f,
setVisitorDefaultDepartment: b,
getVisitorDefaultDepartment: w,
getAllDepartments: v,
getDepartment: g,
clearVisitorDefaultDepartment: y,
addTag: $,
removeTag: E,
sendChatMsg: d,
sendFile: p,
sendVisitorPath: S,
sendChatComment: O,
sendChatRating: A,
getChatInfo: x,
endChat: C,
isChatting: I,
getServingAgentsInfo: T,
sendOfflineMsg: N,
sendTyping: R,
sendEmailTranscript: M,
getChatLog: z,
getConnectionStatus: q,
getAccountStatus: B,
getOperatingHours: L,
_getAccountSettings: he
}), De = t.extend({}), Le = function() {}, Ne = Se, Re = /[0-9]+/, Me = /^(https?|ftps?):\/\//i, Pe = /\S/, je = Ne.any([ Ne.equal(void 0), Ne.type("function") ]), Ue = {
reattached: "connected",
connected: "connecting",
registered: null,
idle_disconnect: "closed",
shutdown: "closed",
error: "closed"
}, Ve = {
online: "online",
offline: "offline",
away: "away",
invalid_account_key: null,
banned: null
}, Fe = Y(Ue), ze = Y(Ve), qe = W([ "email$string", "phone$string", "display_name$string" ]), Be = W([ "name$string", "status$string" ], "id", P), We = W([ "avatar_path$string", "display_name$string", "title$string" ], "nick"), Ge = W([ "typing$bool" ], "nick", j), He = W([ "typing$bool" ], "display_name", U), Ke = W([ "timestamp$int" ], null, F), Ye = W([ "banner", "behavior", "bubble", "chat_button", "chat_window", "concierge", "file_sending", "forms", "greetings", "language", "login", "rating", "sound", "theme", "timezone$string" ]);
a(Te, "meshim_widget_controllers_WebSDKAPI");
return Te;
}();
}).call(t, n(3), n(8), n(7), n(9), n(6), n(1));
}, function(e, t, n) {
(function(t, n) {
e.exports = function() {
function e(e, n) {
var i = {}, o = {}, r = function(n) {
return !e.nodeType && e != window && e != document || ("FORM" != e.tagName || "submit" != n) && (!t.isCustomEvents && (t.isFF && t.isFF < 9 ? !document.createEvent("event")[n.toUpperCase()] : "undefined" == typeof e["on" + n]));
}, s = function(t, n, o) {
if (!t && "function" != typeof n) throw "bad arguments to on / addEventListener";
if (!(t in i)) {
i[t] = [];
r(t) || a(t);
}
i[t].push(n);
return e;
}, a = function(n) {
if (!(n in o)) {
o[n] = function(o) {
o && (o.stopPropagation || d(o));
var r, s = i[n], a = s.length, c = !0;
s._active = !0;
for (r = 0; r < a; r++) try {
if (!s[r]) continue;
s[r].call(e, t.isCustomEvents && o instanceof t.CustomEvent ? o.detail : o) === !1 && (c = !1);
} catch (e) {
f.fire("error", e);
}
s._active = !1;
if (s._dirty) {
for (r = 0; r < a; r++) if (!s[r]) {
r == a - 1 ? s.pop() : s[r--] = s.pop();
a--;
}
s._dirty = !1;
}
if (c === !1) {
if (o) {
o.preventDefault();
o.returnValue = !1;
}
return !1;
}
};
e.attachEvent ? e.attachEvent("on" + n, o[n]) : e.addEventListener && e.addEventListener(n, o[n], !1);
}
}, c = function(t) {
var n = o[t];
if (n) {
e.attachEvent ? e.detachEvent("on" + t, n) : e.addEventListener && e.removeEventListener(t, n, !1);
delete o[t];
delete i[t];
}
}, u = function(t, n) {
var r = i[t];
if (r) {
for (var s = 0, a = r.length; s < a; s++) if (r[s] === n) {
1 == r.length ? o[t] ? c(t) : delete i[t] : r._active ? (r[s] = null, r._dirty = !0) : s == a - 1 ? r.pop() : r[s] = r.pop();
break;
}
return e;
}
}, l = function() {
if (i && o) {
for (var e in o) o.hasOwnProperty(e) && c(e);
i = o = null;
}
}, h = function(n, o) {
if (!t.isCustomEvents || r(n)) {
var s = i[n], a = !0;
if (s && s.length) {
s._active = !0;
var c, u, l;
for (c = 0, u = s.length; c < u; c++) try {
if (!s[c]) continue;
l = s[c].call(e, o);
l === !1 && (a = !1);
} catch (e) {
f.fire("error", e);
}
s._active = !1;
if (s._dirty) {
for (c = 0; c < u; c++) if (!s[c]) {
c == u - 1 ? s.pop() : s[c--] = s.pop();
u--;
}
s._dirty = !1;
}
}
return a;
}
return e.dispatchEvent(new t.CustomEvent(n, {
bubbles: !1,
cancelable: !0,
detail: o
}));
}, d = function(e) {
e.preventDefault = d.preventDefault;
e.stopPropagation = d.stopPropagation;
e.target = e.srcElement;
};
d.preventDefault = function() {
this.returnValue = !1;
};
d.stopPropagation = function() {
this.cancelBubble = !0;
};
var p = {
fire: h,
on: s,
un: u,
unextendEvents: l
};
if (n) return p;
for (var m in p) p.hasOwnProperty(m) && (e[m] = p[m]);
t.bugs.leaksMemory && t.bugs.leaksMemory(function() {
for (var t in p) p.hasOwnProperty(t) && (e[t] = null);
});
return e;
}
function i(e) {
s(0, e);
}
function o(e) {
s(1, e);
}
function r(e) {
s(2, e);
}
function s(e, t) {
e <= h ? t() : d[e].push(t);
}
function a(e) {
for (;h < e; ) {
h++;
for (var t = 0; t < d[h].length; t++) d[h][t]();
d[h] = null;
}
}
function c() {
h > 0 || (document.body && document.body.firstChild ? a(1) : window.setTimeout(c, 200));
}
function u() {
a(2);
}
function l() {
var e;
if (t.isSafari) e = window.setInterval(function() {
if (/loaded|complete/i.test(document.readyState)) {
window.clearInterval(e);
u();
}
}, 20); else if (document.addEventListener) /loaded|complete/i.test(document.readyState) ? u() : document.addEventListener("DOMContentLoaded", u, !1); else if (t.isIE) {
window.attachEvent("onload", u);
var n = document.createElement("document:ready");
e = window.setInterval(function() {
if (/loaded|complete/i.test(document.readyState)) {
n = null;
window.clearInterval(e);
u();
} else {
try {
n.doScroll("left");
} catch (e) {
return;
}
n = null;
window.clearInterval(e);
u();
}
}, 200);
}
}
var f = {
extend: e,
body: e(document.body, !0),
window: e(window, !0),
document: e(document, !0),
runAfterScriptReady: i,
runAfterFirstChildReady: o,
runAfterDomReady: r
};
f.extend(f);
var h = 0, d = [ [], [], [], [] ];
c();
l();
n(f, "jx_core_Events");
return f;
}();
}).call(t, n(4), n(1));
}, function(module, exports, __webpack_require__) {
(function(Assert, isUndefined, $jxml_extends) {
module.exports = function() {
function sniffBrowser() {
function secureURL(e) {
return e.replace(/^http:/, isSecure ? "https:" : "http:");
}
function getWindowClientHeight() {
if (void 0 !== window.innerHeight) return window.innerHeight;
if (document.documentElement) return document.documentElement.offsetHeight;
var e = document.getElementsByTagName("body");
return e.length ? e[0].clientHeight : 0;
}
function getWindowClientWidth() {
if (void 0 !== window.innerWidth) return window.innerWidth;
if (document.documentElement) return document.documentElement.offsetWidth;
var e = document.getElementsByTagName("body");
return e.length ? e[0].clientWidth : 0;
}
function getFlashVersion() {
var e, t = nav.plugins && nav.plugins[FLASH];
if (t) {
e = nav.mimeTypes && nav.mimeTypes[FLASH_MIME_TYPE];
return e && !e.enabledPlugin ? null : t.description;
}
if (window.ActiveXObject) try {
t = new window.ActiveXObject(FLASH_AX);
t.AllowScriptAccess = "always";
return t.GetVariable("$version");
} catch (e) {}
}
function getJavaVersion() {
var e = nav.mimeTypes;
return isIE ? !isWP7 && ("javaEnabled" in nav && nav.javaEnabled()) : e && (e = e[JAVA_MIME_TYPE]) && (e = e.enabledPlugin) ? e.name : void 0;
}
function getScrollbarSize() {
if (!isUndefined(scrollbar_size)) return scrollbar_size;
var e = document.createElement("div"), t = document.createElement("div"), n = e.style, i = t.style;
n.overflow = "auto";
n.width = n.height = "100px";
n.position = "absolute";
n.top = "-1000px";
i.width = "100%";
i.height = "200px";
e.appendChild(t);
document.body.appendChild(e);
scrollbar_size = e.offsetWidth - e.clientWidth;
document.body.removeChild(e);
return scrollbar_size;
}
function detectCSP() {
try {
return eval("false");
} catch (e) {
return !0;
}
}
function checkIE() {
for (var e = 3, t = document.createElement("div"), n = t.getElementsByTagName("i"); t.innerHTML = "",
n[0]; ) ;
return e > 4 ? e : document.documentMode;
}
var nav = navigator, ua = nav.userAgent.toLowerCase(), isNewIE = +(/trident.*rv:? *([0-9]+)/.exec(ua) || [])[1] || !1, isIE = checkIE(), isIE8 = 8 === isIE, isIE7 = 7 === isIE, isIE6 = 6 === isIE, isOpera = !!window.opera && "[object Opera]" === Object.prototype.toString.call(window.opera), isEdge = ua.indexOf("edge") > -1, isChrome = "Google Inc." === nav.vendor, isSafari = "Apple Computer, Inc." === nav.vendor, isWebKit = !isEdge && !isIE && !isOpera && (isChrome || isSafari || /webkit|khtml/.test(ua)), isFF = +/\d+/.exec(/firefox\/\d+/i.exec(nav.userAgent) || ""), isIPhone = ua.indexOf("iphone") !== -1, isIPod = ua.indexOf("ipod") !== -1, isIPad = ua.indexOf("ipad") !== -1, isIOS = isIPhone || isIPad || isIPod, isAndroid = ua.indexOf("android") !== -1, isWP7 = ua.indexOf("wp7") !== -1, isMobile = isIOS || isAndroid || isWP7, scrollbar_size, browser = isIE && "msie" || isFF && "firefox" || isOpera && "opera" || isChrome && "chrome" || isSafari && "safari", version, isStrict = "CSS1Compat" === document.compatMode, isQuirks = !isStrict, isIE5Quirks = isIE && isQuirks && document.documentElement && !!document.documentElement.style.setExpression, engineIE = document.documentMode || isIE, isWindows = ua.indexOf("windows") !== -1 || ua.indexOf("win32") !== -1, isMac = ua.indexOf("macintosh") !== -1 || ua.indexOf("mac os x") !== -1, isSecure = "https:" === document.location.protocol, language = nav.language || nav.browserLanguage || nav.userLanguage || nav.systemLanguage, bugs = {
noBoxSizing: engineIE <= 7,
ie: {
cssBottomRight: isIE6,
cssFixed: isIE6 || isIE5Quirks,
buggyCSS: isIE6 || isIE5Quirks
}
}, isTextContent = "textContent" in document.createElement("div"), isCustomEvents = !1, CustomEvent = null;
try {
if (window.CustomEvent && /\[native code\]|\[object CustomEventConstructor\]/.test(window.CustomEvent.toString())) {
new window.CustomEvent("testevent", {
bubbles: !1,
cancelable: !0,
detail: !0
});
isCustomEvents = !0;
CustomEvent = window.CustomEvent;
}
} catch (e) {}
switch (browser) {
case "msie":
case "firefox":
case "chrome":
version = +/\d+/.exec(new RegExp(browser + "[ /]\\d+").exec(ua) || "");
break;
default:
version = +/\d+/.exec(/version[ \/]\d+/.exec(ua) || "");
}
if (isIE6) {
var cleanupCallbacks = [];
bugs.leaksMemory = function(e) {
Assert.isFunction(e);
cleanupCallbacks.push(e);
};
var cleanup = function() {
for (var e = 0; e < cleanupCallbacks.length; e++) cleanupCallbacks[e]();
};
bugs.leaksMemory.remove = function(e) {
for (var t = cleanupCallbacks.length - 1; t >= 0; t--) e == cleanupCallbacks[t] && cleanupCallbacks.splice(t, 1);
};
window.attachEvent("onunload", cleanup);
}
var FLASH = "Shockwave Flash", FLASH_AX = "ShockwaveFlash.ShockwaveFlash", FLASH_MIME_TYPE = "application/x-shockwave-flash", JAVA_MIME_TYPE = "application/x-java-vm";
return {
browser: browser,
version: version,
isStrict: isStrict,
isQuirks: isQuirks,
isOpera: isOpera,
isSafari: isSafari,
isWebKit: isWebKit,
isChrome: isChrome,
isAndroid: isAndroid,
isIPhone: isIPhone,
isIPod: isIPod,
isIPad: isIPad,
isIOS: isIOS,
isWP7: isWP7,
isMobile: isMobile,
isNewIE: isNewIE,
isEdge: isEdge,
isIE: isIE,
isIE6: isIE6,
isIE7: isIE7,
isIE8: isIE8,
isFF: isFF,
isCustomEvents: isCustomEvents,
CustomEvent: CustomEvent,
engineIE: engineIE,
bugs: bugs,
isWindows: isWindows,
isMac: isMac,
isSecure: isSecure,
secureURL: secureURL,
hasFlash: getFlashVersion(),
hasJava: getJavaVersion(),
language: language,
getScrollbarSize: getScrollbarSize,
getWindowClientHeight: getWindowClientHeight,
getWindowClientWidth: getWindowClientWidth,
isTextContent: isTextContent,
hasCSP: detectCSP()
};
}
var Browser = sniffBrowser();
Browser.sniffBrowser = sniffBrowser;
$jxml_extends(Browser, "jx_core_Browser");
return Browser;
}();
}).call(exports, __webpack_require__(5), __webpack_require__(7), __webpack_require__(1));
}, function(e, t, n) {
(function(t, n) {
e.exports = function() {
function e(e, t) {
e || i.log(t);
}
var i = {
ok: e,
isFunction: function(n, i) {
e(t(n), i);
}
};
i.log = function() {};
n(i, "jx_core_Assert");
return i;
}();
}).call(t, n(6), n(1));
}, function(e, t, n) {
(function(t) {
e.exports = function() {
function e(e) {
return "function" == typeof e;
}
t(e, "jx_core_globals_isFunction");
return e;
}();
}).call(t, n(1));
}, function(e, t, n) {
(function(t) {
e.exports = function() {
var e = function(e) {
return function(t, n) {
return n ? null == t : t === e;
};
}();
t(e, "jx_core_globals_isUndefined");
return e;
}();
}).call(t, n(1));
}, function(e, t, n) {
(function(t) {
e.exports = function() {
function e(e) {
return "number" == typeof e;
}
t(e, "jx_core_globals_isNumber");
return e;
}();
}).call(t, n(1));
}, function(e, t, n) {
(function(t) {
e.exports = function() {
function e(e) {
return "string" == typeof e;
}
t(e, "jx_core_globals_isString");
return e;
}();
}).call(t, n(1));
}, function(e, t, n) {
(function(t) {
e.exports = function() {
var e = function(e, t) {
return e === t || e && t && "object" == typeof e && "object" == typeof t && n(e, t);
}, n = function(t, n) {
var i;
for (i in t) if (!e(t[i], n[i])) return !1;
for (i in n) if (!e(t[i], n[i])) return !1;
return !0;
}, i = function(e) {
if ("object" != typeof e || !e) return e;
var t = {};
for (var n in e) e.hasOwnProperty(n) && (t[n] = i(e[n]));
return t;
}, o = function(e) {
if (e) for (var t = 1, n = arguments.length; t < n; t++) {
var i = arguments[t];
if (i) for (var o in i) i.hasOwnProperty(o) && (e[o] = i[o]);
}
return e;
}, r = {
equal: e,
clone: i,
extend: o
};
t(r, "jx_core_ObjectUtil");
return r;
}();
}).call(t, n(1));
}, function(e, t, n) {
(function(n) {
e.exports = function() {
function e(e, t) {
this.name = e;
this.leaf = /\$[a-z]+$/.test(e);
this.parentNode = t;
this.listeners_value = [];
this.listeners_write = [];
if (!this.leaf) {
this.deleted = !1;
this.listeners_keys = [];
this.childNodes = {};
this.keys = {};
}
}
function i(e, t) {
return Object.prototype.hasOwnProperty.call(e, t);
}
function o(e) {
for (var t = "", n = 0; n < e.length; n++) t += /^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(e[n]) ? "." + e[n] : "[" + JSON.stringify(e[n]) + "]";
return t.substr(1);
}
e.prototype.fqname = function() {
return o(this.path());
};
e.prototype.path = function() {
for (var e = this, t = [ this.name ]; e = e.parentNode; ) t.unshift(e.name);
return t;
};
e.prototype.descend = function(t) {
var n, o, r, s = this;
"string" == typeof t && (t = t.split("."));
for (o = 0, r = t.length; o < r; o++) {
n = t[o];
i(s.childNodes, n) || (s.childNodes[n] = new e(n, s));
s = s.childNodes[n];
}
return s;
};
e.prototype.$$ = e.prototype.descend;
e.prototype.$ = function(t, n, o, r, s, a, c, u, l) {
var f = i(this.childNodes, t) ? this.childNodes[t] : this.childNodes[t] = new e(t, this);
return n ? f.$(n, o, r, s, a, c, u, l) : f;
};
e.prototype.update = function(e, t) {
var n, i, o, r, s;
null != e && this.undeleteParents();
if (this.leaf) {
if (this.value !== e) {
this.value = e;
r = !0;
this.notifyListeners(e, t);
}
} else if (null == e) {
if (!this.deleted) {
r = null;
this.deleted = !0;
for (n in this.childNodes) this.childNodes.hasOwnProperty(n) && this.childNodes[n].update(null, !0);
this.notifyListeners(r, t);
}
} else {
if (this.deleted) {
this.deleted = !1;
r = e;
for (n in e) e.hasOwnProperty(n) && this.$(n).update(e[n], !0);
} else for (n in e) if (e.hasOwnProperty(n)) {
o = this.$(n);
i = e[n];
if (o.leaf) {
if (o.update(i, !0)) {
r || (r = {});
r[n] = i;
}
} else if (void 0 !== (s = o.update(i, !0))) {
r || (r = {});
r[n] = s;
}
}
r && this.notifyListeners(r, t);
}
return r;
};
e.prototype.replace = function(e, t) {
var n, o, r, s, a;
null != e && this.undeleteParents();
if (this.leaf) {
if (this.value !== e) {
this.value = e;
s = !0;
this.notifyListeners(e, t);
}
} else if (null == e) {
if (!this.deleted) {
s = null;
this.deleted = !0;
for (n in this.childNodes) this.childNodes.hasOwnProperty(n) && this.childNodes[n].replace(null, !0);
this.notifyListeners(s, t);
}
} else {
if (this.deleted) {
this.deleted = !1;
s = e;
for (n in e) e.hasOwnProperty(n) && this.$(n).replace(e[n], !0);
} else {
for (n in this.childNodes) if (this.childNodes.hasOwnProperty(n)) {
if (i(e, n)) continue;
r = this.childNodes[n];
if (r.leaf) {
if (r.replace(null, !0)) {
s || (s = {});
s[n] = null;
}
} else if (void 0 !== (a = r.replace(null, !0))) {
s || (s = {});
s[n] = null;
}
}
for (n in e) if (e.hasOwnProperty(n)) {
r = this.$(n);
o = e[n];
if (r.leaf) {
if (r.replace(o, !0)) {
s || (s = {});
s[n] = o;
}
} else if (void 0 !== (a = r.replace(o, !0))) {
s || (s = {});
s[n] = a;
}
}
}
s && this.notifyListeners(s, t);
}
return s;
};
e.prototype.undeleteParents = function() {
for (var e = this.parentNode; e && e.deleted; ) {
e.deleted = !1;
e = e.parentNode;
}
};
e.prototype.write = function(e, t, n) {
if ("function" == typeof t) {
n = t;
t = !1;
}
var i = {
path: this.path(),
value: e
};
"function" == typeof n && (i.func = n);
this.update(e, t || !1);
for (var o = this; o.parentNode; ) o = o.parentNode;
o.notifyWriteListeners(i);
};
e.prototype.bindWrite = function(e) {
this.listeners_write.push(e);
};
e.prototype.bindValue = function(e) {
this.listeners_value.push(e);
try {
e.call(this, this.getValue());
} catch (e) {}
};
e.prototype.bindKeys = function(e) {
if (!this.leaf) {
this.listeners_keys.push(e);
try {
e.call(this, this.getKeys(), []);
} catch (e) {}
}
};
e.prototype.unbindValue = function(e) {
for (var t = 0; t < this.listeners_value.length; t++) if (this.listeners_value[t] == e) {
this.listeners_value.splice(t, 1);
return;
}
};
e.prototype.unbindKeys = function(e) {
if (!this.leaf) for (var t = 0; t < this.listeners_keys.length; t++) if (this.listeners_keys[t] == e) {
this.listeners_keys.splice(t, 1);
return;
}
};
e.prototype.on = function(e, t) {
switch (e) {
case "value":
this.bindValue(t);
break;
case "keys":
this.bindKeys(t);
}
};
e.prototype.un = function(e, t) {
switch (e) {
case "value":
this.unbindValue(t);
break;
case "keys":
this.unbindKeys(t);
}
};
e.prototype.addListener = function(e, t) {
this.listeners[e].push(t);
};
e.prototype.removeListener = function(e, t) {
for (var n = this.listeners[e], i = n.length; i-- > 0; ) n[i] == t && n.splice(i, 1);
};
e.prototype.notifyListeners = function(e, t) {
var n, o, r, s;
if (!this.leaf) if (e) {
for (n in e) if (e.hasOwnProperty(n)) if (null != e[n]) {
if (!i(this.keys, n)) {
this.keys[n] = 1;
o || (o = []);
o.push(n);
}
} else if (i(this.keys, n)) {
delete this.keys[n];
r || (r = []);
r.push(n);
}
} else for (n in this.keys) if (this.keys.hasOwnProperty(n)) {
delete this.keys[n];
r || (r = []);
r.push(n);
}
s = this.listeners_value.concat();
for (var a = 0, c = s.length; a < c; a++) try {
s[a](e);
} catch (e) {}
if (!this.leaf) {
if (o || r) {
s = this.listeners_keys.concat();
for (a = 0, c = s.length; a < c; a++) try {
s[a](o || [], r || []);
} catch (e) {}
}
if (!t && this.parentNode) {
var u = {};
u[this.name] = e;
this.parentNode.notifyListeners(u, t);
}
}
};
e.prototype.notifyWriteListeners = function(e) {
for (var t = this.listeners_write.concat(), n = 0; n < this.listeners_write.length; n++) try {
t[n].call(this, e);
} catch (e) {}
};
e.prototype.getValue = function(e) {
if (e) return this.descend(e).getValue();
if (this.leaf) return this.value;
if (this.deleted) return null;
var t, n, i = {};
for (var o in this.childNodes) if (this.childNodes.hasOwnProperty(o) && null != (n = this.childNodes[o].getValue())) {
i[o] = n;
t = !0;
}
return t ? i : null;
};
e.prototype.hasKey = function(e) {
return i(this.keys, e);
};
e.prototype.getKeys = function() {
if (this.leaf) return null;
var e = [];
for (var t in this.keys) this.keys.hasOwnProperty(t) && e.push(t);
return e;
};
e.prototype.gc = function() {
if (this.leaf) throw new TypeError("Leaf nodes cannot be collected");
var e = !0;
for (var t in this.childNodes) if (this.childNodes.hasOwnProperty(t)) {
var n = this.childNodes[t];
e = n.leaf ? !n.listeners_value.length && null == n.value && (delete this.keys[t],
delete this.childNodes[t]) && e : n.gc() && (delete this.keys[t], delete this.childNodes[t]) && e;
}
return e && this.deleted && !this.listeners_keys.length && !this.listeners_value.length;
};
t.DataNode = e;
n(e, "jx_data_DataNode");
return e;
}();
}).call(t, n(1));
}, function(e, t, n) {
(function(t, n, i, o) {
e.exports = function() {
function e() {
for (var e = r(), t = [ /\/?[?]/, /\/livechat\// ], n = [], i = 0; i < t.length; i++) {
n = e.split(t[i]);
if (n.length) break;
}
var o = n[1], s = n[0], a = /^(https?:)?\/\/[^\/]+/.exec(s), c = s.replace(/^(https?:)?\/\//i, "").split("/")[0], u = c.replace(/(.+\.)(?=.+\..+)/, ""), l = n[0].split("/");
l = l.pop() == c ? n[0] : l.join("/");
a = a && "zopim.com" !== c ? a[0] : "https://v2.zopim.com";
return {
accountKey: o,
brandDomain: u,
baseURL: l,
rootURL: a
};
}
function r() {
if (window.$zopim && window.$zopim.s) return window.$zopim.s.src;
for (var e, t = document.getElementsByTagName("script"), n = /.*zopim.(com|net)\//, i = 0, o = t.length; i < o; i++) {
e = t[i].src || "";
if (n.test(e)) return e;
}
return "";
}
function s() {
var e = ''.toUpperCase();
"<" == e.charAt(0) && (e = "geo");
return e;
}
var a = e(), c = "https://v2.zopim.com/widget", u = c + "/images", l = c + "/sounds", f = c + "/fonts";
t(n.baseURL, !0) && (n.baseURL = i.secureURL(a.baseURL));
var h = {
ASSETS_URL: c,
IMAGES_URL: u,
SOUNDS_URL: l,
FONTS_URL: f,
ASSETS_LEGACY: document.location.protocol + "//cdn.zopim.com/assets",
BRANDING_URL: "https://www.zopim.com",
AVATARS: {
CONCIERGE: u + "/avatar_simple_agent.png",
AGENT: u + "/avatar_simple_agent.png",
VISITOR: u + "/avatar_simple_visitor.png",
DEFAULT: u + "/avatar_simple_visitor.png"
},
ACCOUNT_KEY: a.accountKey,
BRAND_DOMAIN: a.brandDomain,
COUNTRY_CODE: s(),
AUTH_URL: "https://www.zopim.com/auth/$NAME/$KEY-$MID",
AUTH_LOGOUT_URL: "https://www.zopim.com/auth/logout/$KEY-$MID",
IS_POPOUT: window.$zopim_popout,
POPOUT_WINDOW_PREFIX: "zlivechatpopout_",
POPOUT_URL: a.rootURL + "/widget/livechat.html",
CALLBACK_FILE_UPLOAD_PATH: "/client/widget/upload",
FILE_UPLOAD_PATH: "/client/widget/uploads",
FILE_UPLOAD_MAX: 20971520,
RESEND_MSG_TIMEOUT: 5e3,
FILE_REPLACE_SOURCE: /^(\s*https?\:\/\/v2(?:assets|uploads)\.zopim\.)com(\/)/i,
FILE_REPLACE_RESULT: "$1io$2",
CHAT_LOG_REMEMBER_COUNT: 10
};
o(h, "meshim_widget_Config");
return h;
}();
}).call(t, n(7), n(13), n(4), n(1));
}, function(e, t) {
var n = {
build_number: "20170802.003870",
git_commit: "fd65bf4daf306b756e66fde8a954b86e7c1e6724",
release_tag: "!ERR"
};
e.exports = n;
}, function(e, t, n) {
(function(t, i, o, r, s) {
e.exports = function() {
function e(e) {
function t() {
if ("prerender" != document.visibilityState) {
document.removeEventListener("visibilitychange", t);
Oe.connect();
}
}
ne = e.isCookieDenied;
ie = e.overrideProxy;
oe = e.source;
re = e.lastHost;
se = e.source_ver;
B = e.root;
K = B.$("tmp").$("api_settings");
Y = B.$("tmp").$("server_settings");
X = B.$("livechat").$("settings").$("cached$bool");
W = B.$("connection");
J = W.$("server_retired$bool");
Q = W.$("server_ready$bool");
Q.bindValue(l);
J.bindValue(u);
H = B.$("livechat").$("ui").$("mockup$bool").getValue();
if (H) W.$("status$string").update("reattached"); else {
B.$("livechat").$("profile").bindValue(c);
W.$("status$string").bindValue(a);
W.$("socket_status$string").bindValue(I);
B.bindWrite(P);
W.$("reconnect$bool").bindValue(v);
if (window.__z_sdk) z = !0; else {
z = !1;
"visibilityState" in document && "prerender" == document.visibilityState ? document.addEventListener("visibilitychange", t) : Oe.connect();
}
}
}
function a(e) {
ye = "reattached" == e;
ye && P();
ye && z === !1 && T();
if ("idle_disconnect" == e || "shutdown" == e || "error" == e) {
var t = B.$("livechat").$("account").$("status$string").getValue(), n = B.$("connection").$("backoff"), i = n.$("active$int").getValue() || 0, o = n.$("max_seconds$int").getValue();
"invalid_account_key" == t ? fe.warnBadEmbed() : "widget_v2" == oe && "shutdown" == e && i && o && g(o);
p();
}
I();
}
function c(e) {
e && (ne() || ce.IS_POPOUT || e.mid$string && ue.setIdentity(e.mid$string));
}
function u(e) {
Z = e === !0;
}
function l(e) {
ee = e !== !1;
if (ee) {
ke = !1;
f();
}
}
function f() {
for (var e = 0, n = Ee.length; e < n; e++) {
var i = Ee[e];
t(i) && i();
}
Ee = [];
}
function h(e) {
if (!ee || Z) {
W.update({
server_ready$bool: !1
});
Ee.push(e);
if (!ke) {
ke = !0;
G.reconnect();
}
} else e();
}
function d(e) {
G && G.send(e);
}
function p(e) {
G && G.close();
q = !e;
G = null;
be = "";
}
function m() {
window.clearTimeout(Oe.reconnectTimer);
p(!0);
Oe.connect();
}
function g(e) {
window.clearTimeout(Oe.reconnectTimer);
Oe.reconnectTimer = window.setTimeout(function() {
Oe.reconnect();
}, 1e3 * e);
}
function _() {
W.update({
status$string: "idle_disconnect"
});
}
function v(e) {
e && m();
}
function w(e) {
var t = ae || new he(e, "W", null, ge);
t.on("open", function() {
E(e, t);
});
return t;
}
function b() {
var e = y();
try {
te = ve.getGeoAccess(ie, e, 3, 2);
} catch (e) {
window.console && window.console.log("Unable to compute host list");
return;
}
$(_e);
}
function y() {
return re || W.$("server$string").getValue() || "";
}
function $(e) {
function t() {
clearTimeout(o);
i.un("close", t);
$(e);
}
if (!G && !q) {
var n = te.getNextHost();
if (n) {
Se++;
var i = w(n);
we.push(i);
if (te.hasNext()) {
var o = setTimeout(t, e);
i.on("close", t);
}
}
}
}
function E(e, t) {
if (!H) if (G) t.close(); else {
W.update({
socket_status$string: null
});
be = e;
le.increment("conn", [ "tries:" + Se ]);
Se = 0;
le.start("conn_open", t.starttime);
le.end("conn_open", .25, [ "proxy:" + e ]);
G = t;
G.on("break", S);
G.on("message", k);
G.on("reopen", A);
G.on("resume", x);
G.on("error", function() {
var e = this.connect_attempts, t = this.recv_messages;
if (e > 3 && 0 == t) {
p(!0);
$(_e);
}
});
O();
}
}
function k(e) {
if (e) {
if (e.raw && e.raw.__messageID in Ae) {
var t = Ae[e.raw.__messageID];
delete Ae[e.raw.__messageID];
t(e);
}
var n = B;
if ("update" in e) {
if (/^livechat.account/.test(e.path)) {
var i = e.path.split(".");
i.splice(0, 2);
i = i.join(".");
(i ? Y.$("account").descend(i) : Y.$("account")).update(e.update);
fe.fullyExtend(e.update, K.getValue("account"));
}
if (/^livechat/.test(e.path) && "account" in e.update) {
Y.$("account").update(e.update.account);
fe.fullyExtend(e.update.account, K.getValue("account"));
}
if (/^livechat.settings/.test(e.path)) {
var o = e.path.split(".");
o.splice(0, 2);
o = o.join(".");
(o ? Y.$("settings").descend(o) : Y.$("settings")).update(e.update);
fe.fullyExtend(e.update, K.getValue("settings"));
}
e.path && (n = n.descend(e.path));
n.update(e.update);
Oe.fire("message", e);
}
}
}
function S() {
W.update({
socket_status$string: "break"
});
}
function x() {
W.update({
socket_status$string: "resume"
});
}
function A() {
W.update({
socket_status$string: "reconnect"
});
ye = !1;
O();
}
function O() {
if (ce.ACCOUNT_KEY) {
G || Oe.connect();
var e = ue.getIdentity(), t = ne(), n = B.$("livechat").$("ui").getValue("mobile$bool") ? "mobile" : "desktop", o = B.$("livechat").$("settings").$("theme").getValue("name$string"), r = {
__type: "register",
accountKey: ce.ACCOUNT_KEY,
mID: e,
ua: window.navigator.userAgent,
dt: n,
theme: o,
cookie_law: t,
rev: i.git_commit,
source: oe,
source_ver: se
};
if (B.$("livechat").$("ui").$("popout$bool").getValue()) r.popout = !0; else {
r.title = document.title;
r.url = window.location.href;
r.ref = window.document.referrer;
}
var s = Oe._register;
if (s) for (var a in s) s.hasOwnProperty(a) && (r[a] = s[a]);
G.send(r);
}
}
function C() {
return !!X.getValue();
}
function I() {
var e = W.getValue("status$string"), t = W.getValue("socket_status$string");
window.clearTimeout(D.timer);
if ("error" != e) if ("break" == t) if ("idle_disconnect" == e) W.update({
message$string: "idle_disconnect"
}); else {
W.update({
message$string: "reconnecting"
});
D.timer = window.setTimeout(D, 6e4);
} else if (null === t && "registered" == e) W.update({
message$string: "resuming"
}); else if (o(e) && o(t)) {
var n = C() ? "fast_init" : "first_init";
W.update({
message$string: n
});
} else W.update({
message$string: null
}); else D.timer = window.setTimeout(D, 5e3);
}
function T() {
G && B.$("livechat").$("profile").write({
disconnect_timeout$int: U(G.rtt)
});
}
function D() {
W.update({
message$string: "disconnected"
});
}
function L() {
var e = G;
return e ? {
connect_attempts: e.connect_attempts,
connections: e.connections,
disconnects: e.disconnects,
timeout_server: e.timeout_server,
timeout_response_soft: e.timeout_response_soft,
timeout_response_hard: e.timeout_response_hard,
sent_bytes: e.sent_bytes,
recv_bytes: e.recv_bytes,
sent_messages: e.sent_messages,
recv_messages: e.recv_messages,
sent_frames: e.sent_frames,
recv_frames: e.recv_frames,
lost_frames: e.lost_frames,
ooo_frames: e.ooo_frames,
bytes_at_connect: e.bytes_at_connect,
rtt: e.rtt,
clock_skew: e.clock_skew,
reconnect_delay: e.reconnect_delay,
quality: e.quality,
host: e.host,
status: e.status,
zone: window.__$__GEO,
last_frame_time: e.last_frame_time,
local_time: +new Date()
} : {
status: "not connected"
};
}
function N() {
return be;
}
function R() {
return +new Date() - (G ? G.clock_skew : 0);
}
function M(e) {
xe += 1;
Ae[xe] = e;
return xe;
}
function P(e) {
if (e) {
var n = {};
n.path = e.path;
n.value = e.value;
t(e.func) && (n.__messageID = M(e.func));
$e.push(n);
}
if (G && ye) for (;$e.length; ) G.send($e.shift());
}
function j(e) {
return e ? Y.getValue(e) : Y.getValue();
}
function U(e) {
function t(e) {
return e;
}
var n, i, o = 10 * me.SECOND, r = 1 * me.SECOND, s = 120 * me.SECOND, a = 20 * me.SECOND;
e = Math.round(e) || 0;
e = Math.max(r, Math.min(e, o));
n = (e - r) / (o - r);
i = a + t(n) * (s - a);
return Math.floor(i / 1e3);
}
function V(e) {
ae = e;
}
function F() {
Q.unbindValue(l);
J.unbindValue(u);
B.$("livechat").$("profile").unbindValue(c);
W.$("status$string").unbindValue(a);
W.$("socket_status$string").unbindValue(I);
W.$("reconnect$bool").unbindValue(v);
p();
we.forEach(function(e) {
e.close();
e.fire("close");
});
D.timer = clearTimeout(D.timer);
we = [], be = "", ye = !1, $e = [], Ee = [], ke = !1, Se = 0, xe = 0, Ae = {}, z = q = B = W = G = H = K = Y = X = J = Z = Q = ee = te = ne = ie = oe = re = se = ae = null;
}
var z, q, B, W, G, H, K, Y, X, J, Z, Q, ee, te, ne, ie, oe, re, se, ae, ce = n(12), ue = n(15), le = n(29), fe = n(22), he = n(50), de = n(55), pe = n(56), me = n(60), ge = {
FLUSH_DELAY_MS: 0,
RECONNECT_DELAY_MS: 1e4
}, _e = 3e3, ve = new pe(de), we = [], be = "", ye = !1, $e = [], Ee = [], ke = !1, Se = 0, xe = 0, Ae = {}, Oe = r.extend({
init: e,
send: d,
connect: b,
reconnect: m,
disconnect: _,
getConnectionStats: L,
getHost: N,
getServerTime: R,
getServerSettings: j,
reconnectIfServerRetired: h,
registerCallback: M,
getDCTimeoutValue: U,
setSocket: V,
reset: F
});
s(Oe, "meshim_widget_controllers_ConnectionController");
return Oe;
}();
}).call(t, n(6), n(13), n(7), n(3), n(1));
}, function(e, t, n) {
(function(t, i) {
e.exports = function() {
function e() {
$ = w.ACCOUNT_KEY;
}
function o() {
if (w.IS_POPOUT) return v.get(S) || g().get("mid");
var e = l();
return e ? e : v.get(k) || "";
}
function r(e) {
v.set(k, e, {
path: "/",
ttl: 365,
domain: m
});
}
function s() {
var e = f();
if ("boolean" == typeof e) return e;
var t = v.get(x);
t = parseInt(t, 10);
return 0 !== t && (1 === t || void 0);
}
function a() {
v.remove(x, {
path: "/",
domain: m
});
}
function c(e) {
e = t(e);
e = e ? 1 : 0;
v.set(x, e, {
path: "/",
ttl: 365,
domain: m
});
}
function u() {
v.remove(k, {
path: "/",
domain: m
});
_.remove(E);
}
function l() {
var e = v.getJSONCookie("__zlcid");
v.remove("__zlcid", {
path: "/"
});
if (e.mID) return e.mID;
var t = h("__zlcstore");
v.remove("__zlcstore", {
path: "/",
domain: m
});
return t && t.mID ? t.mID : void 0;
}
function f() {
var e, t = h("__zlcprivacy");
if ("boolean" == typeof t) {
e = t;
c(t);
}
return e;
}
function h(e) {
var t = v.getJSONCookie(e);
return t[$];
}
function d(e, t) {
var n = _.get(E) || {};
n[$] || (n[$] = {});
var i = n[$];
i[e] = t;
i.timestamp = +new Date();
_.set(E, n);
}
function p(e) {
var t = _.get(E) || {};
if (!t[$]) return {};
var n = t[$];
if (!n.timestamp) return n[e] || {};
var i = +new Date();
return i - n.timestamp > y ? {} : n[e];
}
var m, g = n(17), _ = n(19), v = n(21), w = n(12), b = n(22), y = 48e4, $ = w.ACCOUNT_KEY, E = "__zlcstore", k = "__zlcmid", S = "__zlcpomid", x = "__zlcprivacy", A = window.location.hostname;
m = /\b(?:\d{1,3}\.){3}\d{1,3}/.test(A) ? A : b.getEffectiveTLD(A);
var O = {
init: e,
DOM: {
saveVariable: d,
getVariable: p
},
Cookie: v,
clearAll: u,
setIdentity: r,
getIdentity: o,
clearAllowCookieLaw: a,
getAllowCookieLaw: s,
setAllowCookieLaw: c
};
i(O, "meshim_widget_controllers_StorageController");
return O;
}();
}).call(t, n(16), n(1));
}, function(e, t, n) {
(function(t) {
e.exports = function() {
function e(e) {
return !!e && "false" != e;
}
t(e, "jx_core_globals_parseBoolean");
return e;
}();
}).call(t, n(1));
}, function(e, t, n) {
(function(t, n) {
e.exports = function() {
function e(t) {
if (!(this instanceof e)) {
s || e._initSingleton(window);
return s;
}
if (t) return e.parseQuery(t);
this.store = {};
}
function i(e, t, n) {
if (void 0 === t && void 0 === n) return e;
void 0 === t && (t = "string");
if (!(t in r)) throw "invalid type requested";
return void 0 === e ? void 0 !== n ? n : r[t] : "boolean" === t ? o.test(e) : "integer" === t ? e === !0 ? 1 : parseInt(e, 10) : "float" === t ? e === !0 ? 1 : parseFloat(e) : e;
}
var o = /^(1|on|true)$/i, r = {
boolean: !1,
integer: 0,
float: 0,
string: ""
}, s = null;
e._initSingleton = function(t) {
s = new e(t.location.search);
};
e.buildQuery = function(e) {
var n, i, o, r, s, a, c = [], u = [];
for (s in e) e.hasOwnProperty(s) && c.push(s);
c.sort();
for (n = 0, o = c.length; n < o; n++) {
s = c[n];
a = e[s];
s = window.encodeURIComponent(s);
if (t(a)) if (1 !== a.length || a[0] !== !0) for (i = 0, r = a.length; i < r; i++) u.push(s + "=" + window.encodeURIComponent(a[i] + "")); else u.push(s); else u.push(s + "=" + window.encodeURIComponent(a + ""));
}
return u.join("&");
};
e.parseQuery = function(t) {
var n, i, o = new e();
t = t.replace(/^\?|\/+$/g, "");
var r, s, a = t.split("&");
for (n = 0, i = a.length; n < i; n++) {
var c = a[n];
if (c.length) {
var u = c.indexOf("=");
if (u <= -1) {
r = c;
s = !0;
} else {
r = c.slice(0, u);
s = window.decodeURIComponent(c.slice(u + 1));
}
o.add(window.decodeURIComponent(r), s);
}
}
return o;
};
e.getHash = function(t, n) {
var i = n || window.location.hash;
return e.parseQuery(i.replace(/^#/, "")).get(t);
};
var a = e.prototype;
a.add = function(e, t) {
this.has(e) ? this.store[e].push(t) : this.store[e] = [ t ];
};
a.has = function(e) {
return this.store.hasOwnProperty(e);
};
a.getLast = function(e, t, n) {
return this.has(e) ? this.getAt(e, this.store[e].length - 1, t, n) : i(void 0, t, n);
};
a.getFirst = function(e, t, n) {
return this.getAt(e, 0, t, n);
};
a.getAt = function(e, t, n, o) {
return i(this.has(e) ? this.store[e][t] : void 0, n, o);
};
a.getRaw = function(e) {
return this.has(e) ? this.store[e].concat() : [];
};
a.get = a.getLast;
a.toString = function() {
return e.buildQuery(this.store);
};
n(e, "meshim_common_QueryString");
return e;
}();
}).call(t, n(18), n(1));
}, function(e, t, n) {
(function(t) {
e.exports = function() {
function e(e) {
return "[object Array]" == Object.prototype.toString.call(e);
}
t(e, "jx_core_globals_isArray");
return e;
}();
}).call(t, n(1));
}, function(e, t, n) {
(function(t) {
e.exports = function() {
function e() {
try {
return l in c && c[l];
} catch (e) {
return !1;
}
}
function i(e) {
return function() {
try {
var t = Array.prototype.slice.call(arguments, 0);
t.unshift(r);
h.appendChild(r);
r.addBehavior("#default#userData");
r.load(l);
var n = e.apply(a, t);
h.removeChild(r);
return n;
} catch (e) {}
};
}
function o(e) {
return e.replace(p, "___");
}
var r, s = n(20), a = {}, c = window, u = c.document, l = "localStorage", f = "__storejs__";
a.disabled = !1;
a.set = function() {};
a.get = function() {};
a.remove = function() {};
a.clear = function() {};
a.transact = function(e, t, n) {
var i = a.get(e);
if (null == n) {
n = t;
t = null;
}
"undefined" == typeof i && (i = t || {});
n(i);
a.set(e, i);
};
a.getAll = function() {};
a.serialize = function(e) {
return s.stringify(e);
};
a.deserialize = function(e) {
if ("string" == typeof e) try {
return s.parse(e);
} catch (t) {
return e || void 0;
}
};
if (e()) {
r = c[l];
a.set = function(e, t) {
if (void 0 === t) return a.remove(e);
r.setItem(e, a.serialize(t));
return t;
};
a.get = function(e) {
return a.deserialize(r.getItem(e));
};
a.remove = function(e) {
r.removeItem(e);
};
a.clear = function() {
r.clear();
};
a.getAll = function() {
for (var e = {}, t = 0; t < r.length; ++t) {
var n = r.key(t);
e[n] = a.get(n);
}
return e;
};
} else if (u.documentElement.addBehavior) {
var h, d;
try {
d = new window.ActiveXObject("htmlfile");
d.open();
d.write('