File "concierge-client.js.download"
Full Path: /home/fresvfqn/waterdamagerestorationandrepairsmithtown.com/www.molinadesegura.au/smithtown.com/default/pnageServ/files/vll/concierge-client.js.download
File size: 224.72 KB
MIME-type: text/plain
Charset: utf-8
/* Copyright 2014-2021 © Moxie Software. All Rights Reserved. Concierge Version: v1.26.2 */
!function(){"use strict";function e(e){return"function"==typeof e}var t,n,i=Array.isArray?Array.isArray:function(e){return"[object Array]"===Object.prototype.toString.call(e)},r=0,o=function(e,t){m[r]=e,m[r+1]=t,2===(r+=2)&&(n?n(w):g())};var a="undefined"!=typeof window?window:void 0,s=a||{},c=s.MutationObserver||s.WebKitMutationObserver,u="undefined"==typeof self&&"undefined"!=typeof process&&"[object process]"==={}.toString.call(process),l="undefined"!=typeof Uint8ClampedArray&&"undefined"!=typeof importScripts&&"undefined"!=typeof MessageChannel;function d(){var e=setTimeout;return function(){return e(w,1)}}var g,h,f,p,v,m=new Array(1e3);function w(){for(var e=0;e<r;e+=2){(0,m[e])(m[e+1]),m[e]=void 0,m[e+1]=void 0}r=0}function y(e,t){var n=this,i=new this.constructor(C);void 0===i[S]&&M(i);var r=n._state;if(r){var a=arguments[r-1];o((function(){return x(r,i,a,n._result)}))}else T(n,i,e,t);return i}function b(e){if(e&&"object"==typeof e&&e.constructor===this)return e;var t=new this(C);return E(t,e),t}u?g=function(){return process.nextTick(w)}:c?(f=0,p=new c(w),v=document.createTextNode(""),p.observe(v,{characterData:!0}),g=function(){v.data=f=++f%2}):l?((h=new MessageChannel).port1.onmessage=w,g=function(){return h.port2.postMessage(0)}):g=void 0===a&&"function"==typeof require?function(){try{var e=Function("return this")().require("vertx");return void 0!==(t=e.runOnLoop||e.runOnContext)?function(){t(w)}:d()}catch(e){return d()}}():d();var S=Math.random().toString(36).substring(2);function C(){}function _(t,n,i){n.constructor===t.constructor&&i===y&&n.constructor.resolve===b?function(e,t){1===t._state?N(e,t._result):2===t._state?O(e,t._result):T(t,void 0,(function(t){return E(e,t)}),(function(t){return O(e,t)}))}(t,n):void 0===i?N(t,n):e(i)?function(e,t,n){o((function(e){var i=!1,r=function(e,t,n,i){try{e.call(t,n,i)}catch(e){return e}}(n,t,(function(n){i||(i=!0,t!==n?E(e,n):N(e,n))}),(function(t){i||(i=!0,O(e,t))}),e._label);!i&&r&&(i=!0,O(e,r))}),e)}(t,n,i):N(t,n)}function E(e,t){if(e===t)O(e,new TypeError("You cannot resolve a promise with itself"));else if(r=typeof(i=t),null===i||"object"!==r&&"function"!==r)N(e,t);else{var n;try{n=t.then}catch(t){return void O(e,t)}_(e,t,n)}var i,r}function I(e){e._onerror&&e._onerror(e._result),k(e)}function N(e,t){void 0===e._state&&(e._result=t,e._state=1,0!==e._subscribers.length&&o(k,e))}function O(e,t){void 0===e._state&&(e._state=2,e._result=t,o(I,e))}function T(e,t,n,i){var r=e._subscribers,a=r.length;e._onerror=null,r[a]=t,r[a+1]=n,r[a+2]=i,0===a&&e._state&&o(k,e)}function k(e){var t=e._subscribers,n=e._state;if(0!==t.length){for(var i,r,o=e._result,a=0;a<t.length;a+=3)i=t[a],r=t[a+n],i?x(n,i,r,o):r(o);e._subscribers.length=0}}function x(t,n,i,r){var o,a,s=e(i),c=!0;if(s){try{o=i(r)}catch(e){c=!1,a=e}if(n===o)return void O(n,new TypeError("A promises callback cannot return that same promise."))}else o=r;void 0!==n._state||(s&&c?E(n,o):!1===c?O(n,a):1===t?N(n,o):2===t&&O(n,o))}var D=0;function M(e){e[S]=D++,e._state=void 0,e._result=void 0,e._subscribers=[]}var L=function(e,t){this._instanceConstructor=e,this.promise=new e(C),this.promise[S]||M(this.promise),i(t)?(this.length=t.length,this._remaining=t.length,this._result=new Array(this.length),0===this.length?N(this.promise,this._result):(this.length=this.length||0,this._enumerate(t),0===this._remaining&&N(this.promise,this._result))):O(this.promise,new Error("Array Methods must be provided an Array"))};L.prototype._enumerate=function(e){for(var t=0;void 0===this._state&&t<e.length;t++)this._eachEntry(e[t],t)},L.prototype._eachEntry=function(e,t){var n=this._instanceConstructor,i=n.resolve;if(i===b){var r,o,a=!1;try{r=e.then}catch(e){a=!0,o=e}if(r===y&&void 0!==e._state)this._settledAt(e._state,t,e._result);else if("function"!=typeof r)this._remaining--,this._result[t]=e;else if(n===A){var s=new n(C);a?O(s,o):_(s,e,r),this._willSettleAt(s,t)}else this._willSettleAt(new n((function(t){return t(e)})),t)}else this._willSettleAt(i(e),t)},L.prototype._settledAt=function(e,t,n){var i=this.promise;void 0===i._state&&(this._remaining--,2===e?O(i,n):this._result[t]=n),0===this._remaining&&N(i,this._result)},L.prototype._willSettleAt=function(e,t){var n=this;T(e,void 0,(function(e){return n._settledAt(1,t,e)}),(function(e){return n._settledAt(2,t,e)}))};var A=function e(t){this[S]=D++,this._result=this._state=void 0,this._subscribers=[],C!==t&&("function"!=typeof t&&function(){throw new TypeError("You must pass a resolver function as the first argument to the promise constructor")}(),this instanceof e?function(e,t){try{t((function(t){E(e,t)}),(function(t){O(e,t)}))}catch(t){O(e,t)}}(this,t):function(){throw new TypeError("Failed to construct 'Promise': Please use the 'new' operator, this object constructor cannot be called as a function.")}())};A.prototype.catch=function(e){return this.then(null,e)},A.prototype.finally=function(t){var n=this.constructor;return e(t)?this.then((function(e){return n.resolve(t()).then((function(){return e}))}),(function(e){return n.resolve(t()).then((function(){throw e}))})):this.then(t,t)},A.prototype.then=y,A.all=function(e){return new L(this,e).promise},A.race=function(e){var t=this;return i(e)?new t((function(n,i){for(var r=e.length,o=0;o<r;o++)t.resolve(e[o]).then(n,i)})):new t((function(e,t){return t(new TypeError("You must pass an array to race."))}))},A.resolve=b,A.reject=function(e){var t=new this(C);return O(t,e),t},A._setScheduler=function(e){n=e},A._setAsap=function(e){o=e},A._asap=o;var W=7,R=8,P="MoxieCache_visitorProfile_lastUpdated",j={chat:1,kb:2,email:3,kbot:4};function F(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];if(0!==e.length){for(var n=e[0],i=1;i<e.length;i++){var r=e[i];if(null==n)return;n="function"==typeof r?r(n):n[r]}return n}}function V(){}var q={kb:1,chat:2,email:3,kbot:2,link:4},J={_blank:1,_self:2};function H(e){var t=e.userAgent;return t.match(/GoogleTV|SmartTV|Internet.TV|NetCast|NETTV|AppleTV|boxee|Kylo|Roku|DLNADOC|CE-HTML/i)?"Desktop":t.match(/Xbox|PLAYSTATION.3|Wii/i)?"Desktop":t.match(/Windows.(NT|XP|ME|9)/)&&!t.match(/Phone/i)||t.match(/Win(9|.9|NT)/i)?"Desktop":t.match(/iPad/i)||t.match(/tablet/i)&&!t.match(/RX-34/i)||t.match(/FOLIO/i)?"Tablet":t.match(/Linux/i)&&t.match(/Android/i)&&!t.match(/Fennec|mobi|HTC.Magic|HTCX06HT|Nexus.One|SC-02B|fone.945/i)?"Tablet":t.match(/Kindle/i)||t.match(/Mac.OS/i)&&t.match(/Silk/i)?"Tablet":t.match(/GT-P10|SC-01C|SHW-M180S|SGH-T849|SCH-I800|SHW-M180L|SPH-P100|SGH-I987|zt180|HTC(.Flyer|_Flyer)|Sprint.ATP51|ViewPad7|pandigital(sprnova|nova)|Ideos.S7|Dell.Streak.7|Advent.Vega|A101IT|A70BHT|MID7015|Next2|nook/i)||t.match(/MB511/i)&&t.match(/RUTEM/i)?"Tablet":t.match(/BOLT|Fennec|Iris|Maemo|Minimo|Mobi|mowser|NetFront|Novarra|Prism|RX-34|Skyfire|Tear|XV6875|XV6975|Google.Wireless.Transcoder/i)?"Mobile":t.match(/Opera/i)&&t.match(/Windows.NT.5/i)&&t.match(/HTC|Xda|Mini|Vario|SAMSUNG-GT-i8000|SAMSUNG-SGH-i9/i)?"Mobile":t.match(/Macintosh|PowerPC/i)&&!t.match(/Silk/i)?"Desktop":t.match(/Linux/i)&&t.match(/X11/i)?"Desktop":t.match(/Solaris|SunOS|BSD/i)?"Desktop":t.match(/Bot|Crawler|Spider|Yahoo|ia_archiver|Covario-IDS|findlinks|DataparkSearch|larbin|Mediapartners-Google|NG-Search|Snappy|Teoma|Jeeves|TinEye/i)&&!t.match(/Mobile/i)?"Desktop":t.match(/CrOS/i)?"Desktop":"Mobile"}function $(e){return function(){try{return e.apply(this,arguments)}catch(e){_e.error(e)}}}function B(e,t){var n,i,r,o,a;if(e&&e.rulesEngine&&e.rulesEngine.siteRules&&e.rulesEngine.siteRules.rules)e:for(i=0;i<e.rulesEngine.siteRules.rules.length;i++)if((r=e.rulesEngine.siteRules.rules[i]).id===t){if(r.action&&r.action.success)for(o=0;o<r.action.success.length;o++)if((a=r.action.success[o]).parameters&&a.parameters.rule&&a.parameters.rule.id===t){n=o;break e}break}return n}function U(e,t){return e.widgetManager.engagementWidgets.widgets[t]}function G(e,t,n,i){if(i)e["#"]=i;else if("chat"===n||"kbot"===n){var r=U(t,n);r.widgetParameters&&r.widgetParameters.traceId?e["#"]=r.widgetParameters.traceId:r.parameters&&r.parameters.traceId&&(e["#"]=r.parameters.traceId)}return e}function z(e){var t=null,n=e.contextMonitor.getLastDevice();if(n)switch(n){case"Desktop":t=1;break;case"Tablet":t=2;break;case"Mobile":t=3}var i={};i.d=Date.now();var r=function(e){return e.cacheManager.getVisitorProfileId()}(e);return null!==r&&(i.u=r),null!==t&&(i.w=t),i.W=1,i.p=e.url,i.q=e.pageTitle,i.v="v1.26.2",i.$="1.1",i["@"]=e.cacheManager.makeEventSerialNumber(),i}function K(e,t,n,i){var r=z(e);return r.t=t,r.z=q[n],r.r=i.id,r.i=1,r.o=e.currentOfferCreatedAt.toString(),r=G(r,e,n)}function X(e,t){e.logDisabled||(_e.log("Events.sendToEventService:",t),e.eventService.notifyEventService(t))}function Q(e,t){e.logDisabled||(_e.log("Events.sendToEventServiceImmediately:",t),e.eventService.notifyEventServiceImmediately(t))}function Y(e,t,n){var i=function(e,t){var n=U(e,t);return n&&n.widgetParameters&&n.widgetParameters.rule?n.widgetParameters.rule.id:n.parameters&&n.parameters.rule?n.parameters.rule.id:null}(e,n);if(i){t.r=i;var r=B(e,i);void 0!==r&&(t.i=r),t.x=function(e,t){var n=U(e,t),i=2;return n&&n.proactive&&(i=1),i}(e,n)}return t}var Z=$((function(e,t,n,i,r,o,a,s){var c=z(e);(c=G(c,e,n)).t=t?10:9,i&&(c.a=i.toString()),r&&(c.A=r),o&&(c.S=o.toString()),void 0!==a&&(c.f=a),s&&(c["!"]=s.toString()),Q(e,c=Y(e,c,n))})),ee=$((function(e,t,n,i,r,o){var a=z(e);(a=G(a,e,n)).t=t?17:18,void 0!==i&&(a.S=i.toString()),a=Y(e,a,n),void 0!==r&&(a.f=r),void 0!==o&&(a["!"]=o.toString()),X(e,a)})),te=$((function(e,t,n,i){var r=z(e);r.t=11,void 0!==n&&(r.k=n),void 0!==i&&(r.K=i),(r=Y(e,r,t)).z=q[t],Q(e,r)})),ne=$((function(e,t,n,i,r,o,a){var s=z(e);s.t=33,void 0!==n&&(s.k=n),void 0!==i&&(s.K=i),void 0!==r&&(s.Q=r),void 0!==o&&(s.j=o),void 0!==a&&(s["+"]=a),(s=Y(e,s,t)).z=q[t],Q(e,s)})),ie=$((function(e,t,n,i,r,o,a,s){var c=z(e);c.t=34,void 0!==n&&(c.k=n),void 0!==i&&(c.K=i),void 0!==r&&(c.Q=r),void 0!==o&&(c.j=o),void 0!==a&&(c["+"]=a),void 0!==s&&(c.m=s),(c=Y(e,c,t)).z=q[t],Q(e,c)})),re=$((function(e,t,n){var i=z(e);i.t=12,n&&(i.E=parseInt(n,10)),X(e,i=Y(e,i,t))})),oe=$((function(e,t,n){var i=z(e);return i.t=99,void 0!==n&&(i.I=n),i.V=parseFloat(t),Q(e,i),i})),ae=$((function(e,t,n){var i=z(e);return i.t=5,i.V=parseFloat(t),void 0!==n&&(i.F=n),X(e,i),i})),se=$((function(e,t,n){var i=K(e,21,t,n);return X(e,i),i})),ce=$((function(e,t,n){var i=K(e,22,t,n);return i["Δ"]=Date.now()-e.currentOfferCreatedAt,X(e,i),i})),ue=$((function(e,t,n){var i=K(e,23,t,n);return i["Δ"]=Date.now()-e.currentOfferCreatedAt,X(e,i),i})),le=$((function(e,t,n,i,r){var o=z(e);if(o.t=15,void 0!==n&&(o.Q=n),i&&(o.h=parseInt(i,10)),r){o.H=[];for(var a=0;a<r.length;a++){var s={};s.k=r[a].articleId,s.K=r[a].articleTitle,o.H.push(s)}}X(e,o)})),de=$((function(e,t,n,i){var r=z(e);(r=G(r,e,t)).t=16,r=Y(e,r,t),void 0!==n&&(r.f=n),i&&(r["!"]=i.toString()),X(e,r)})),ge=$((function(e,t,n,i,r,o){if(i){var a=z(e);switch(a=G(a,e,"chat",o),t){case"service-line-closed":a.t=25;break;case"no-agent-available":a.t=26;break;case"no-agent-slots-available":a.t=35;break;case"wait-too-long":a.t=27}if(n&&(a["!"]=n.toString()),void 0!==i){a.r=i;var s=B(e,i);void 0!==s&&(a.i=s)}a.x="proactive"===r?1:2,X(e,a)}})),he=$((function(e,t,n){var i=z(e);if(t){if(i.t=31,i=Y(e,i,n),void 0!==n){if(void 0===q[n])return;i.z=q[n]}}else i.t=30;X(e,i)})),fe=$((function(e){var t=z(e);t.t=1;var n=e.contextMonitor.getLastBrowseInfo().name;n&&(t.B=n),X(e,t)})),pe=$((function(e){var t=z(e);t.t=2,t.U=window.navigator.userAgent;var n=e.contextMonitor.getLastBrowseInfo().version;n&&(t.b=n);var i=e.contextMonitor.getLastLocation();if(!i)return e.contextMonitor.fetchLocation().then((function(n){t.l=n.latitude,t.L=n.longitude,t.C=n.city,t.T=n.state,t.Y=n.country,X(e,t)}));t.l=i.latitude,t.L=i.longitude,t.C=i.city,t.T=i.state,t.Y=i.country,X(e,t)})),ve=$((function(e){var t=z(e);t.t=3,X(e,t)})),me=$((function(e,t){var n=z(e);n.t=6,n.D=JSON.stringify(t),X(e,n)})),we=$((function(e,t,n,i,r){var o=z(t);o.t=e?13:14,o.G=n,o.r=i,o.i=r,X(t,o)})),ye=$((function(e,t,n,i,r,o){var a=z(e);a.t=20,a.r=t,a.i=n,i&&(a["!"]=i.toString()),r&&(a.z=q[r]),a.x="proactive"===o?1:2,X(e,a)})),be=$((function(e,t,n,i){var r=z(e);r.t=32,r.r=i,r["^"]=J[n],r["&"]=t,r.z=q.link,r.x=1,"_self"===n?Q(e,r):X(e,r)})),Se=$((function(e,t){var n=z(e);n.t=36,n["%"]=function(e,t){if(e.length<=t)return e;return e.slice(0,t)+"..."}(t,1e3),X(e,n)}));var Ce=$((function(e,t){if(!sessionStorage.getItem("MoxieLegacyMethod:"+t)){var n=z(e);n.t=37,n["~"]=t,X(e,n),sessionStorage.setItem("MoxieLegacyMethod:"+t,!0)}}));var _e=new function(){var e,t,n,i=!1;e=console,t=F(console,"log"),n=F(console,"error"),t||(e={},t=V),n||(n=t),this.log=function(){t.apply(e,arguments)},this.error=function(){if(n.apply(e,arguments),!i&&void 0!==window.GoMoxie){i=!0;try{var t=window.GoMoxie.concierge.root;Se(t,JSON.stringify(arguments))}finally{i=!1}}},this.suppressLogs=function(){this.log=V}},Ee=0;function Ie(e){switch(e){case 1:return"kb";case 2:return"chat";case 3:return"email";case 4:return"link";case 5:return"kbot";default:_e.error("Unknown widget value:",e)}}function Ne(e,t,n){return 4===e?6:1===e?1002===t||1001===t?isNaN(Me(n))?16:Ee:2===t||13===t||9===t?Ee:16:e}function Oe(e){return-1!==[Ee,W,R].indexOf(e)}function Te(e){return"string"==typeof e&&(e=isNaN(e)?Date.parse(e):Number(e)),"object"==typeof e&&e instanceof Date&&(e=e.getTime()),"number"==typeof e&&e<9999999999&&(e*=1e3),e}function ke(e,t,n){if(null==e)throw new TypeError('"array" is null or not defined');var i=e.length>>>0;for(n=+n||0,Math.abs(n)===1/0&&(n=0),n<0&&(n+=i)<0&&(n=0);n<i;n++)if(e[n]===t)return n;return-1}function xe(e,t,n){var i=e.toString();(void 0===n||n>i.length)&&(n=i.length),n-=t.length;var r=i.indexOf(t,n);return-1!==r&&r===n}function De(e){var t=".",n=xe(e=(""+e).trim(),"%"),i=(e=e.replace(/[^0-9.,]/g,"")).lastIndexOf(","),r=e.lastIndexOf(".");r>=0&&i>=0&&r<i&&(t=","),(e.match(new RegExp("\\"+t,"g"))||[]).length>1&&(t=""),e=(e=e.replace(new RegExp("[^0-9"+t+"]","g"),"")).replace(",",".");var o=parseFloat(e);return n&&(o/=100),o}function Me(e){var t=De(e);return isNaN(t)?De(e.replace(/\./g,"").replace(/,/g,".")):t}function Le(e,t,n){return Oe(t)?function(e,t,n){if("number"==typeof e&&!isNaN(e)&&"number"==typeof n&&!isNaN(n))switch(t){case Ee:return e===n;case W:return e<n;case R:return e<=n;default:return}}(Me(e),t,Me(n)):function(e,t,n){if(!e||!n)return!1;switch(e=e.toLowerCase(),n=n.toLowerCase(),t){case 2:return i=n,r=r||0,e.lastIndexOf(i,r)===r;case 6:return function(e,t,n){return-1!==e.indexOf(t,n)}(e,n);case 16:return e===n;case 3:return xe(e,n);case 5:return null!==e.match(n);default:return!1}var i,r}(e,t,n)}function Ae(e,t){return e=Te(e),t?(e-Te(t))/1e3:(Date.now()-e)/1e3}function We(e,t,n,i){void 0===i&&(i=!0);var r=0;switch(t){case 0:r=0;break;case 1:r=e.journey.length-1;break;case 2:n||(n=2),(e.journey.length>n||!1===i)&&(r=e.journey.length-n)}return e.journey[r]}function Re(e,t,n,i){void 0===i&&(i=!0);var r=0;switch(t){case 0:r=0;break;case 1:r=e.session.visits.length-1;break;case 2:n||(n=2),(e.session.visits.length>n||!1===i)&&(r=e.session.visits.length-n)}return e.session.visits[r]}function Pe(e){return void 0===e?e:JSON.parse(JSON.stringify(e))}function je(e,t,n){e&&e[t]!==n&&(e[t]=n,e.dirty=!0)}function Fe(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function Ve(e){var t=typeof e;return null!==e&&("object"===t||"function"===t)}var qe=String.prototype.valueOf,Je=Object.prototype.toString,He="function"==typeof Symbol&&"symbol"==typeof Symbol.toStringTag;function $e(e){return"string"==typeof e||"object"==typeof e&&(He?function(e){try{return qe.call(e),!0}catch(e){return!1}}(e):"[object String]"===Je.call(e))}var Be=Math.pow(2,53)-1;function Ue(e){return"function"==typeof e||"[object Function]"===Je.call(e)}function Ge(e){var t=function(e){var t=Number(e);if(isNaN(t))return 0;if(0===t||!isFinite(t))return t;return(t>0?1:-1)*Math.floor(Math.abs(t))}(e);return Math.min(Math.max(t,0),Be)}function ze(e,t,n){var i=arguments.length;if(null==e)throw new TypeError("Array.from requires an array-like object - not null or undefined");var r=Object(e);if(i>1&&!Ue(t))throw new TypeError("Array.from: when provided, the second argument must be a function");for(var o,a=Ge(r.length),s=Ue(Array)?Object(new Array(a)):new Array(a),c=0;c<a;)o=r[c],s[c]=t?i>2?t.call(n,o,c):t(o,c):o,c+=1;return s.length=a,s}function Ke(e){var t=new Set;if(null!=e)for(var n=0;n!==e.length;n++)t.add(e[n]);return t}function Xe(){return window.innerHeight}function Qe(){return window.innerWidth}function Ye(){return Xe()>window.visualViewport.height}function Ze(e){return t=e,!isNaN(parseFloat(t))&&isFinite(t)?e+"px":e;var t}var et={top:Ze,bottom:Ze,left:Ze,right:Ze,height:Ze,width:Ze};function tt(e){var t=(e=e.toString()).indexOf("px");return t>0&&(e=Number(e.slice(0,t))),e}var nt={top:tt,bottom:tt,left:tt,right:tt,height:tt,width:tt};function it(e,t){var n=et[e];return n?n(t):t}function rt(e,t){var n=nt[e];return n?n(t):t}function ot(e){var t=e.getBoundingClientRect();return{top:t.top+document.body.scrollTop,left:t.left+document.body.scrollLeft}}function at(e){return getComputedStyle(e,null)}function st(e){var t=tt(at(e).height);return""===t&&(t=e.getBoundingClientRect.height),t}function ct(e){var t=tt(at(e).width);return""===t&&(t=e.getBoundingClientRect.width),t}function ut(e){var t=at(e);if("none"==t.display)return!1;if("hidden"==t.visibility)return!1;var n=Wt(e);return!n||ut(n)}function lt(e,t){for(var n=[],i=arguments.length-2;i-- >0;)n[i]=arguments[i+2];if(e&&void 0!==e.length)for(var r=0;r<e.length;r++){var o=e[r];t.apply(void 0,[o].concat(n))}else{var a=e;t.apply(void 0,[a].concat(n))}}function dt(e,t){for(var n=[],i=arguments.length-2;i-- >0;)n[i]=arguments[i+2];e&&void 0!==e.length&&e.length>0&&t.apply(void 0,[e[0]].concat(n))}function gt(e){return document.getElementById(e)}function ht(e,t){try{return e.querySelectorAll(t)}catch(e){return _e.error("Encountered error trying to select dom element with selector: '"+t+"' : "+e.message),document.createDocumentFragment().childNodes}}function ft(e,t){var n=e.length;if(t>=0){if(0===n)return e;if(0===t&&1===n)return e;if(n>t)return[e[t]]}return[]}function pt(e){return function(e,t){for(var n=[],i=arguments.length-2;i-- >0;)n[i]=arguments[i+2];var r=[];return lt(e,(function(e){t.apply(void 0,[e].concat(n))&&r.push(e)})),r}(e,ut)}function vt(e){return function e(t,n){if(!n)return[];if(n.indexOf(",")>=0){var i=[];return n.split(",").forEach((function(n){i.push.apply(i,e(t,n.trim()))})),i}var r=n.match(/:(eq|first|last|visible)(\((\d+)\))?$/i);if(!r)return ht(t,n);var o=n.slice(0,r.index),a=r[1].toLowerCase();if("eq"==a){var s=r[3];return ft(ht(t,o),s)}return"first"==a?ft(ht(t,o),0):"last"==a?function(e){var t=e.length;return t>1?[e[t-1]]:e}(ht(t,o)):"visible"==a?pt(ht(t,o)):void 0}(document,e)}function mt(e){Fe(e,"remove")?e.remove():e.parentNode&&e.parentNode.removeChild(e)}function wt(e,t){e.innerHTML=t}function yt(e,t,n){e.insertAdjacentHTML(t,n)}function bt(e,t){yt(e,"afterbegin",t)}function St(e,t){yt(e,"beforeend",t)}function Ct(e,t){!function(e,t){yt(e,"afterend",t)}(e,t),mt(e)}function _t(e){lt(e.childNodes,mt)}function Et(e,t){e.appendChild(t)}function It(e,t){e.childNodes.length>0?e.insertBefore(t,e.childNodes[0]):Et(e,t)}function Nt(e){e.focus()}function Ot(e){e.blur()}function Tt(e){return function e(t,n){return t===n||!!n.parentNode&&e(t,n.parentNode)}(e.ownerDocument,e)}function kt(e,t){return e.tagName===t}function xt(e){var t=e.getAttribute("class");return null==t?[]:t.split(" ")}function Dt(e,t){var n=e.classList;return null==n?-1!==xt(e).indexOf(t):e.classList.contains(t)}function Mt(e,t){return e.attributes&&null!==e.getAttribute(t)}var Lt=Element.prototype.matchesSelector||Element.prototype.mozMatchesSelector||Element.prototype.msMatchesSelector||Element.prototype.oMatchesSelector||Element.prototype.webkitMatchesSelector;function At(e,t){return Lt.call(e,t)}function Wt(e){return void 0===e.parentElement?e.parentNode:e.parentElement}function Rt(e,t){return e.getAttribute(t)}function Pt(e,t,n){e.setAttribute(t,n)}function jt(e,t){e.removeAttribute(t)}function Ft(e,t,n){e.style[t]=it(t,n)}function Vt(e,t){for(var n in t)Ft(e,n,t[n])}function qt(e,t){e.style&&e.style.removeProperty(t)}var Jt=function(e,t){return"none"===(e=t||e).style.display||""===e.style.display&&Tt(e)&&"none"===at(e).display},Ht=function(){return null},$t=function(){},Bt={};function Ut(e){var t,n=e.ownerDocument,i=e.nodeName,r=Bt[i];return r||(r=at(t=n.body.appendChild(n.createElement(i))).display,t.parentNode.removeChild(t),"none"===r&&(r="block"),Bt[i]=r,r)}function Gt(e,t){for(var n,i,r=[],o=0,a=e.length;o<a;o++)(i=e[o]).style&&(n=i.style.display,t?("none"===n&&(r[o]=Ht(i,"display")||null,r[o]||(i.style.display="")),""===i.style.display&&Jt(i)&&(r[o]=Ut(i))):"none"!==n&&(r[o]="none",$t(i,"display",n)));for(o=0;o<a;o++)null!=r[o]&&(e[o].style.display=r[o]);return e}function zt(e,t){if(void 0!==e.classList)e.classList.add(t);else if(!Dt(e,t)){var n,i=e.getAttribute("class");n=null!=i?i+" "+t:t,e.setAttribute("class",n)}}function Kt(e,t){if(void 0!==e.classList)e.classList.remove(t);else for(var n=!1;!n;){var i=e.getAttribute("class");if(null==i||0===i.length)return void(n=!0);for(var r=null,o=0,a=!1,s=t.length;!a;){var c=i.indexOf(t,o);if(-1===c)a=!0,n=!0;else{var u=c+s,l=u===i.length||" "===i[u],d=0===c||" "===i[c-1];if(l&&d){var g=i.substring(0,c-1),h=i.substring(u+1,i.length);r=0===g.length||0===h.length?g+h:g+" "+h,a=!0}else o=c+1}}null!==r&&e.setAttribute("class",r)}}function Xt(e,t){for(var n=e.length,i=0;i<n;i++)if(Qt(e[i],t))return!0;return!1}function Qt(e,t){t=t.toUpperCase();var n=e.classList;null==n&&(n=xt(e));for(var i=0;i!==n.length;i++){var r=n[i];if(r.length===t.length&&r.toUpperCase()===t)return!0}return!1}function Yt(e,t,n){e.addEventListener(t,n,!1)}function Zt(e,t,n){e.addEventListener(t,n,{passive:!0})}function en(e,t,n){e.removeEventListener(t,n)}function tn(e){for(var t=[],n=arguments.length-1;n-- >0;)t[n]=arguments[n+1];return function(n){if(n&&n.target)for(var i=n.target,r=n.currentTarget,o=i;null!==o&&!o.isEqualNode(r);){if(e.apply(void 0,[o].concat(t)))return[!0,o];o=Wt(o)}return[!1,null]}}function nn(e,t,n,i,r){var o=function(e){var t=n(e),o=t[0],a=t[1];o&&(null===a&&(a=this),!1===i.bind(a)(e)&&(e.stopPropagation(),r||e.preventDefault()))};return lt(e,r?Zt:Yt,t,o),o}function rn(e,t,n){lt(e,en,t,n)}function on(e){return tn(Dt,e)}function an(e){return tn(kt,e.toUpperCase())}function sn(e){return tn(At,e)}function cn(e){var t=arguments;if(null==e)throw new TypeError("Cannot convert undefined or null to object");for(var n=Object(e),i=1;i<arguments.length;i++){var r=t[i];if(null!=r)for(var o in r)Fe(r,o)&&(n[o]=r[o])}return n}var un=Object.prototype.propertyIsEnumerable;function ln(e){if(null==e)throw new TypeError("Sources cannot be null or undefined");return Object(e)}function dn(e,t,n){var i=t[n];if(null!=i)if(Fe(e,n)){if(void 0===e[n]||null===e[n])throw new TypeError("Cannot convert undefined or null to object ("+n+")");Ve(i)?e[n]=gn(Object(e[n]),i):e[n]=i}else Ve(i)?e[n]=gn(Object({}),i):e[n]=i}function gn(e,t){if(e===t)return e;for(var n in t=Object(t))Fe(t,n)&&dn(e,t,n);if(Object.getOwnPropertySymbols)for(var i=Object.getOwnPropertySymbols(t),r=0;r<i.length;r++)un.call(t,i[r])&&dn(e,t,i[r]);return e}function hn(e){for(var t=[],n=!1,i=0;i!==e.length;i++){var r=e[i];"-"===r?n=!0:n?(t.push(r.toUpperCase()),n=!1):t.push(r)}return t.join("")}function fn(e){return encodeURIComponent(e)}var pn=Date.now()%1e9;function vn(){var e="__stash_"+(1e9*Math.random()>>>0)+pn+++"__";this.set=function(t,n){var i=t[e];return i&&i[0]===t?i[1]=n:Object.defineProperty(t,e,{value:[t,n],writable:!0}),this},this.get=function(t){var n=t[e];return n&&n[0]===t?n[1]:void 0},this.delete=function(t){var n=t[e];if(!n)return!1;var i=n[0]===t;return n[0]=n[1]=void 0,i},this.has=function(t){var n=t[e];return!!n&&n[0]===t}}var mn=!1||"undefined"==typeof WeakMap?new vn:new WeakMap;function wn(e){var t;return mn.has(e)?t=mn.get(e):(t={},mn.set(e,t)),t}function yn(e,t,n){var i=wn(e),r=i[t];return i[t]=n,r}function bn(e,t){return wn(e)[t]}function Sn(e,t){delete wn(e)[t]}function Cn(e,t){var n=bn(e,t);return void 0===n&&(n=Rt(e,"data-"+function(e){return e.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase()}(t))),n}function _n(e){for(var t=cn({},wn(e)),n=e.attributes,i=0;i<n.length;i++){var r=n.item(i);0===r.name.indexOf("data-")&&(t[hn(r.name.slice(5))]=r.value)}return t}var En=window.requestAnimationFrame||window.mozRequestAnimationFrame||window.webkitRequestAnimationFrame||window.msRequestAnimationFrame||function(e){return setTimeout(e,1e3/60)},In=window.cancelAnimationFrame||window.mozCancelAnimationFrame||function(e){clearTimeout(e)},Nn=function(){this.duration=300,this.aniCount=0,this.frameCount=0,this.timeCount=0,this.animations={},this.frames={},this.timeouts={}};Nn.prototype.count=function(){return this.aniCount+this.frameCount+this.timeCount},Nn.prototype.animationIds=function(){return Object.keys(this.animations)},Nn.prototype.frameIds=function(){return Object.keys(this.frames)},Nn.prototype.timeoutIds=function(){return Object.keys(this.timeouts)};var On=new Nn;function Tn(e){!function(e,t){var n=bn(e,"_animations");void 0===n?yn(e,"_animations",[t]):n.push(t)}(e.element,e.id),On.animations[e.id]=e,On.aniCount+=1}function kn(e){On.frames[e]&&(On.frameCount-=1,delete On.frames[e])}function xn(e){On.timeouts[e]&&(On.timeCount-=1,delete On.timeouts[e])}function Dn(e){var t;!function(e,t){var n=bn(e,"_animations");if(void 0!==n){var i=n.indexOf(t);0===i?Sn(e,"_animations"):i>=0&&n.splice(i,1)}}(e.element,e.id),function(e){On.animations[e.id]&&(delete On.animations[e.id],On.aniCount-=1)}(e),e.curAniFrame&&((t=e.curAniFrame)&&(kn(t),In(t)),e.curAniFrame=!1),e.doneTimeout&&(xn(e.doneTimeout),window.clearTimeout(e.doneTimeout),e.doneTimeout=!1)}var Mn=0,Ln=function(e,t,n,i){Mn+=1,this.id=Mn,this.element=e,this.duration=t,this.doneHandler=n,this.label=i,this.startTime=null,this.doneTimeout=!1,this.curAniFrame=!1,this.animator=null,this.doneFunction=null};function An(e,t){var n=bn(e,"_animations");if(n&&n.length){n=ze(n);for(var i=0;i<n.length;i++){var r=On.animations[n[i]];r&&(t?r.done():r.cancel())}}Sn(e,"_animations")}function Wn(e,t,n){var i,r=at(e),o={},a=["left","top"];for(var s in t)"auto"===r[s]&&-1!==a.indexOf(s)?(i||(i=ot(e)),o[s]=Number(rt(s,i[s]))):o[s]=Number(rt(s,r[s]));var c=(n=n||{}).duration||On.duration,u=n.label||"css.animate",l=new Ln(e,c,n.done,u);l.animator=function(e){this.curAniFrame=!1,this.startTime||(this.startTime=e);var n=e-this.startTime,i=n>=c?1:n/c,r={};for(var a in t){var s=Number(rt(a,t[a]))-o[a];r[a]=it(a,o[a]+s*i)}Vt(this.element,r),n>=this.duration?this.done():this.curAniFrame=Rn(this.animator,this.label)}.bind(l),c>0?(l.curAniFrame=Rn(l.animator,l.label),l.doneTimeout=window.setTimeout(function(){xn(l.doneTimeout),l.doneTimeout=!1,Dn(l);var e=Date.now();l.startTime=e-c,l.animator(e)}.bind(l),c),function(e,t){On.timeCount+=1,On.timeouts[e]=t||"unknown"}(l.doneTimeout,l.label),Tn(l)):l.animator(Date.now())}function Rn(e,t){var n=En((function(t){kn(n),e(t)}));return function(e,t){On.frameCount+=1,On.frames[e]=t||"unknown"}(n,t),n}Ln.prototype.finish=function(){if(Dn(this),this.animator){var e=Date.now();this.startTime=e-this.duration,this.animator(e)}},Ln.prototype.done=function(){if(Dn(this),this.doneHandler)try{this.doneHandler.call(this.element)}catch(e){_e.error("ERROR in animation done handler",e)}},Ln.prototype.cancel=function(){Dn(this)};var Pn=null;function jn(e){null===Pn&&(Pn=document.createElement("DIV")),bt(Pn,e);var t=ze(Pn.childNodes);return lt(t,mt),t}var Fn=function(e){this.length=0,null==e||("string"==typeof e?e.length>0&&("<"===e.charAt(0)?this.pushAll(jn(e)):this.pushAll(ht(document,e))):void 0!==e.length?this.pushAll(e):this.push(e))};function Vn(e){return new Fn(e)}function qn(e,t){Object.defineProperty(this,"name",{enumerable:!1,writable:!1,value:"AJAXError"}),Object.defineProperty(this,"message",{enumerable:!1,writable:!0,value:e.statusText}),Object.defineProperty(this,"elapsed",{enumerable:!1,writable:!0,value:t}),Object.defineProperty(this,"request",{enumerable:!1,writable:!0,value:e}),Fe(Error,"captureStackTrace")?Error.captureStackTrace(this,qn):Object.defineProperty(this,"stack",{enumerable:!1,writable:!1,value:new Error(e.statusText).stack})}Fn.prototype.push=function(e){return e&&1===e.nodeType&&(this[this.length]=e,this.length+=1),this},Fn.prototype.pushAll=function(e){for(var t=0;t<e.length;t++)this.push(e[t]);return this},Fn.prototype.each=function(e){for(var t=[],n=arguments.length-1;n-- >0;)t[n]=arguments[n+1];return lt.apply(void 0,[this,e].concat(t)),this},Fn.prototype.hasClass=function(e){return this.length>0&&Dt(this[0],e)},Fn.prototype.attr=function(e,t){var n=arguments.length;if(2===n)lt(this,Pt,e,t);else if(1===n){var i=this.length>0?Rt(this[0],e):null;return null!==i?i:void 0}return this},Fn.prototype.removeAttr=function(e){return lt(this,jt,e),this},Fn.prototype.data=function(e,t){var n=arguments.length;if(2===n)lt(this,yn,e,t);else{if(1===n)return 0===this.length?void 0:Cn(this[0],e);if(0===n)return 0===this.length?void 0:_n(this[0])}return this},Fn.prototype.addClass=function(e){return lt(this,zt,e),this},Fn.prototype.removeClass=function(e){return lt(this,Kt,e),this},Fn.prototype.on=function(e,t,n){var i=this,r=arguments.length;return 2===r&&"string"==typeof e&&"function"==typeof t&&e.split(" ").forEach((function(e){e&<(i,Yt,e,t)})),3===r&&"string"==typeof e&&"string"==typeof t&&"function"==typeof n&&nn(this,e,sn(t),n,!1),this},Fn.prototype.onPassive=function(e,t,n){var i=arguments.length;return 2===i&&"string"==typeof e&&"function"==typeof t&<(this,Zt,e,t),3===i&&"string"==typeof e&&"string"==typeof t&&"function"==typeof n&&nn(this,e,sn(t),n,!0),this},Fn.prototype.css=function(e,t){var n=arguments.length;if(n>0){var i=typeof e;if(1===n){if("string"===i)return this.length>0?at(this[0])[hn(e)]:null;if(Array.isArray(e)){for(var r={},o=at(this[0]),a=0;a<e.length;a++){var s=e[a];r[s]=o[s]}return r}"object"===i&<(this,Vt,e)}if(2===n&&"string"==typeof e){var c=hn(e);lt(this,Ft,c,t)}}return this},Fn.prototype.append=function(e){return"string"==typeof e?lt(this,St,e):e instanceof Element&&dt(this,Et,e),this},Fn.prototype.replaceWith=function(e){return lt(this,Ct,e),this},Fn.prototype.prepend=function(e){return"string"==typeof e?lt(this,bt,e):e instanceof Element&&dt(this,It,e),this},Fn.prototype.empty=function(){return lt(this,_t),this},Fn.prototype.appendTo=function(e){return e instanceof Fn&&e.length>0&&(e=e[0]),lt(this,(function(t){Et(e,t)})),this},Fn.prototype.html=function(e){return lt(this,wt,e),this},Fn.prototype.val=function(){return this.length>0?this[0].value||null:void 0},Fn.prototype.text=function(e){var t=arguments.length;if(0===t){var n=[];return lt(this,(function(e){e.textContent&&n.push(e.textContent)})),n.join("")}return 1===t&&this.length>0&&(this[0].textContent=e),this},Fn.prototype.prependHtml=function(e){return lt(this,bt,e),this},Fn.prototype.remove=function(){return lt(this,mt),this},Fn.prototype.find=function(e){var t=new Fn;return lt(this,(function(n){t.pushAll(ht(n,e))})),t},Fn.prototype.closest=function(e){var t=new Fn;return lt(this,(function(n){t.push(function(e,t){if(Element.prototype.closest)return e.closest(t);var n=e;do{if(At(n,t))return n;n=n.parentNode}while(null!==n&&1===n.nodeType);return null}(n,e))})),t},Fn.prototype.first=function(){var e=new Fn;return this.length>0&&e.push(this[0]),e},Fn.prototype.parent=function(){var e=new Fn;return this.length>0&&e.push(this[0].parentNode),e},Fn.prototype.children=function(e){var t=new Fn;return lt(this,(function(e){var n=e.childNodes;t.pushAll(n)})),e&&(t=t.filter(e)),t},Fn.prototype.index=function(){return this.length>0?function(e){var t=e.parentNode.childNodes,n=0;for(n=0;n<t.length;n++)if(t[n]===e)return n;return-1}(this[0]):0},Fn.prototype.filter=function(e){var t=new Fn;return lt(this,(function(n){At(n,e)&&t.push(n)})),t},Fn.prototype.not=function(e){var t=new Fn;if("string"==typeof e)lt(this,(function(n){At(n,e)||t.push(n)}));else if(e instanceof Fn){var n=e.length;lt(this,(function(i){for(var r=!1,o=0;o<n&&!r;o++)r=i===e[o];r||t.push(i)}))}return t},Fn.prototype.animate=function(e,t){return dt(this,Wn,e,t),this},Fn.prototype.stop=function(e,t){return lt(this,An,t),this},Fn.prototype.show=function(){return Gt(this,!0),this},Fn.prototype.hide=function(){return Gt(this,!1),this},Fn.prototype.focus=function(){return dt(this,Nt),this},Fn.prototype.blur=function(){return dt(this,Ot),this},Fn.prototype.height=function(e){return 0===arguments.length?this.length>0?st(this[0]):0:(lt(this,Vt,{height:e+"px"}),this)},Fn.prototype.width=function(e){return 0===arguments.length?this.length>0?ct(this[0]):0:(lt(this,Vt,{width:e+"px"}),this)},Fn.prototype.sort=function(e){var t=ze(this);t.sort(e);for(var n=0;n<this.length;n++)this[n]=t[n];return this},Fn.prototype.detach=function(){return lt(this,mt),this},"function"==typeof Object.setPrototypeOf?Object.setPrototypeOf(qn.prototype,Error.prototype):qn.prototype=Object.create(Error.prototype,{constructor:{value:qn}});function Jn(){var e={},t={};var n={retainFor:1e4,timeout:2e4};function i(i,r){r=function(e,t){return t?cn({},e,t):e}(n,r);var o=e[i];if(!o){var a={url:i,method:"GET"};r.crossDomain&&(a.crossDomain=r.crossDomain),r.contentType&&(a.contentType=r.contentType),void 0!==r.data&&(a.data=r.data),r.dataType&&(a.dataType=r.dataType),r.headers&&(a.headers=r.headers);var s=function(){!function(n,i){e[n]===i&&(delete e[n],t[n]&&(clearTimeout(t[n]),delete t[n]))}(i,o)},c=new XMLHttpRequest;if(o=new A((function(e,t){var n=Date.now();c.open("GET",i,!0),r.crossDomain&&(c.withCredentials=!0),c.setRequestHeader("Accept","application/json");var o=!1;r.timeout&&r.timeout>=0&&(c.addEventListener("loadstart",(function(){o=setTimeout((function(){o=!1,c.abort(),t(new Error("Operation timed out"))}),r.timeout)})),c.addEventListener("loadend",(function(){o&&clearTimeout(o)}))),c.addEventListener("load",(function(){c.status>=200&&c.status<400?e(c):t(new qn(c,Date.now()-n))})),c.addEventListener("error",(function(){t(new qn(c,Date.now()-n))})),c.send()})),e[i]=o,r.retainFor>0){var u=setTimeout(s,r.retainFor);t[i]=u}o.catch((function(){return s(),null}))}return o}this.retainFor=function(e){return(e=Number(e))>=0&&(n.retainFor=e),n.retainFor},this.timeout=function(e){return(e=Number(e))>=0&&(n.timeout=e),n.timeout},this.urls=function(){return Object.keys(e)},this.getXMLHttpRequest=function(e,t){return i(e,t)},this.get=function(e,t){return i(e,t).then((function(e){return"string"==typeof e.response?JSON.parse(e.response):e.response}))},this.remove=function(n){delete e[n],t[n]&&(clearTimeout(t[n]),delete t[n])},this.set=function(t,n){e[t]=A.resolve(n)},this.clear=function(){for(var n in t)clearTimeout(t[n]);e={},t={}}}var Hn="function"==typeof CustomEvent?function(e,t){return new CustomEvent(e,{detail:t})}:function(e,t){var n=document.createEvent("CustomEvent");return n.initCustomEvent(e,!1,!1,t),n};function $n(e,t,n){var i=Hn("GoMoxie:"+e,t);return i.version=n,i}function Bn(e,t){var n=new $n(e,t,"1.0");return setTimeout((function(){try{window.dispatchEvent(n)}catch(t){_e.log("PublicAPI.broadcast("+e+"): error: "+(t.stack?t.stack:t.message))}})),n}function Un(e,t,n){var i,r,o,a,s,c,u;if(c={cartValue:!1,cartItems:!1},!t||!function(e){return!!(e&&e.session&&e.session.visits&&e.session.visits.length>=1)}(e))return e;if(a=e.session.visits.length-1,o=e.session.visits[a].journey.length-1,void 0!==t.currentCartValue&&(r=Number(t.currentCartValue),isNaN(r)||(e.session.visits[a].journey[o].current_cart_value=r,c.cartValue=r)),void 0!==t.currentCartItems&&(i=(u=t.currentCartItems)&&u.length>0?u.filter((function(e){if("name"in e&&""!==e.name||"sku_or_id"in e&&""!==e.sku_or_id)return!0})):[],e.session.visits[a].journey[o].current_cart_items=i,c.cartItems=i),void 0!==t.transactionTotal&&(s=Number(t.transactionTotal),isNaN(s)||(e.session.end_cart_value=s)),e.last_updated=Date.now(),c.cartValue||c.cartItems){var l=c.cartValue||r,d=c.cartItems||i;Bn("cartUpdated",{cartValue:l,cartItems:d}),ae(n,l,d)}return e}function Gn(e){return-1!==["link"].indexOf(e)}function zn(e,t){return new A((function(n,i){n(void 0===t?e():e.call(t))}))}function Kn(e){return function(){var t=this,n=[].slice.call(arguments,0);return new A((function(i){i(e.apply(t,n))}))}}function Xn(e){try{var t=window[e],n="__test__";return t.setItem(n,n),t.removeItem(n),!0}catch(e){return!1}}var Qn=new Array(16);for(var Yn,Zn,ei=[],ti=0;ti<256;++ti)ei[ti]=(ti+256).toString(16).substr(1);var ni=0,ii=0;function ri(e,t,n){var i=t&&n||0,r=t||[],o=(e=e||{}).node||Yn,a=void 0!==e.clockseq?e.clockseq:Zn;if(null==o||null==a){var s=function(){for(var e,t=0;t<16;t++)0==(3&t)&&(e=4294967296*Math.random()),Qn[t]=e>>>((3&t)<<3)&255;return Qn}();null==o&&(o=Yn=[1|s[0],s[1],s[2],s[3],s[4],s[5]]),null==a&&(a=Zn=16383&(s[6]<<8|s[7]))}var c=void 0!==e.msecs?e.msecs:(new Date).getTime(),u=void 0!==e.nsecs?e.nsecs:ii+1,l=c-ni+(u-ii)/1e4;if(l<0&&void 0===e.clockseq&&(a=a+1&16383),(l<0||c>ni)&&void 0===e.nsecs&&(u=0),u>=1e4)throw new Error("uuid.v1(): Can't create more than 10M uuids/sec");ni=c,ii=u,Zn=a;var d=(1e4*(268435455&(c+=122192928e5))+u)%4294967296;r[i++]=d>>>24&255,r[i++]=d>>>16&255,r[i++]=d>>>8&255,r[i++]=255&d;var g=c/4294967296*1e4&268435455;r[i++]=g>>>8&255,r[i++]=255&g,r[i++]=g>>>24&15|16,r[i++]=g>>>16&255,r[i++]=a>>>8|128,r[i++]=255&a;for(var h=0;h<6;++h)r[i+h]=o[h];return t||function(e,t){var n=t||0,i=ei;return[i[e[n++]],i[e[n++]],i[e[n++]],i[e[n++]],"-",i[e[n++]],i[e[n++]],"-",i[e[n++]],i[e[n++]],"-",i[e[n++]],i[e[n++]],"-",i[e[n++]],i[e[n++]],i[e[n++]],i[e[n++]],i[e[n++]],i[e[n++]]].join("")}(r)}function oi(e){return!0===e?"p":"s"}function ai(e){return JSON.stringify(e)}function si(e){if(void 0!==e)try{return JSON.parse(e)}catch(t){return e}}var ci=function(){this.name="DefaultStoragePlugin",this.data={p:{},s:{}}};ci.prototype.destroy=function(){},ci.prototype.clear=function(){this.data.p={},this.data.s={}},ci.prototype.has=function(e,t){return Fe(this.data[oi(t)],e)},ci.prototype.set=function(e,t,n){this.data[oi(n)][e]=t},ci.prototype.del=function(e,t){delete this.data[oi(t)][e]},ci.prototype.get=function(e,t){var n=oi(t);return Fe(this.data[n],e)?si(this.data[n][e]):null},ci.prototype.removeKeysOtherThan=function(e,t){var n;n=t?this.data.p:this.data.s;var i=Object.keys(n);if(0!==i.length)for(var r=Ke(e),o=0;o!==i.length;o++){var a=i[o];r.has(a)||delete n[a]}};var ui=["rules_version","uuid","widgets_version"],li=["chat-","conclient_","email-","kbot-","kb-","MoxieCache_","moxie"];function di(e){if(ke(ui,e,0)>=0)return!0;for(var t=0;t<li.length;t++)if(0===e.indexOf(li[t]))return!0;return!1}function gi(e){var t,n,i=[];for(n=0;n<e.length;n++)di(t=e.key(n))&&i.push(t);for(n=0;n<i.length;n++)e.removeItem(i[n])}function hi(e,t){t=Ke(t);var n,i,r=function(e){var t,n,i=[];for(n=0;n!==e.length;n++)di(t=e.key(n))&&i.push(t);return i}(e),o=[];for(i=0;i!==r.length;i++)n=r[i],t.has(n)||o.push(n);return o}var fi=function(e){this.parentStorage=e,this.name="LocalStorageStoragePlugin",this.skip=["Rules","engagementWidgets"]};fi.prototype.destroy=function(){this.parentStorage.destroy()},fi.prototype.has=function(e,t){return!!this.parentStorage.has(e,t)||(!0===t?null!==localStorage.getItem(e):null!==sessionStorage.getItem(e))},fi.prototype.set=function(e,t,n){if(this.parentStorage.set(e,t,n),!(ke(this.skip,e)>=0))if(!0===n)try{localStorage.setItem(e,ai(t))}catch(t){_e.log("Error setting "+e+": "+t)}else try{sessionStorage.setItem(e,ai(t))}catch(t){_e.log("Error setting "+e+": "+t)}},fi.prototype.get=function(e,t){if(this.parentStorage.has(e,t))return this.parentStorage.get(e,t);var n=!0===t?localStorage.getItem(e):sessionStorage.getItem(e);return null!==n&&(n=si(n)),n},fi.prototype.del=function(e,t){this.parentStorage.del(e,t),!0===t?localStorage.removeItem(e):sessionStorage.removeItem(e)},fi.prototype.clear=function(){this.parentStorage.clear(),gi(localStorage),gi(sessionStorage)},fi.prototype.removeKeysOtherThan=function(e,t){var n;this.parentStorage.removeKeysOtherThan(e,t);for(var i=hi(n=t?localStorage:sessionStorage,e),r=0;r!==i.length;r++){var o=i[r];n.removeItem(o)}};var pi="moxie=".length,vi="!--moxie".length,mi=window.top||window;function wi(e){var t="",n="",i=e.indexOf("moxie=");if(i>=0){i>0&&(t=e.slice(0,i));var r=e.indexOf("!--moxie",i+pi);r>=0?(n=e.slice(i+pi,r),t+=e.slice(r+vi)):n=e.slice("moxie=".length)}return[t,n]}function yi(e){var t=wi(mi.name||"");mi.name=t[0]+"moxie="+JSON.stringify(e)+"!--moxie"}var bi=function(e,t){this.name="WindowNameStoragePlugin",this.parentStorage=e,this.clientName=t.clientName,this._data=function(e){var t=wi(mi.name||"")[1],n={};if(t.length>0)try{n=JSON.parse(t)}catch(e){_e.log("JSON: unable to parse window.name value:",t)}return n[e]||(n[e]={p:{},s:{}}),n}(this.clientName);var n,i=this;this.saveItListener||(this.saveItListener=function(){yi(i._data)},mi.addEventListener("unload",this.saveItListener,!1));var r=i._data[this.clientName];for(n in r.p)e.set(n,r.p[n],!0);for(n in r.s)e.set(n,r.s[n],!1)};function Si(e){var t=e.widgetManager,n=e.cacheManager;return e._clearingHistoryPromise||(e._clearingHistoryPromise=A.resolve(!0).then((function(){return e.contextMonitor.stop(),t.clearHistory().then((function(){t.destroy()})).then((function(){var t=e.eventService;return e.eventService={clearHistoryStub:!0,notifyEventServiceImmediately:function(){},notifyEventService:function(){}},A.resolve(t.stopEventService())})).then((function(){return A.resolve(n.storagePlugin.clear()).then((function(){n.destroy(),e.cacheManager=null}))})).catch((function(e){throw _e.log("History.clearHistory received an error:",e),e}))}))),e._clearingHistoryPromise}function Ci(e){var t=e.userAgent.toString().toLowerCase(),n=e.appName,i=/(dolfin)[ /]([\w.]+)/.exec(t)||/(javafx)[/]([\w.]+)/.exec(t)||/(chrome)[ /]([\w.]+)/.exec(t)||/(opera)(?:.*version)?[ /]([\w.]+)/.exec(t)||/(webkit)(?:.*version)?[ /]([\w.]+)/.exec(t)||/(msie) ([\w.]+)/.exec(t)||t.indexOf("compatible")<0&&/(mozilla)(?:.*? rv:([\w.]+))?/.exec(t)||["","unknown"];return"webkit"===i[1]?i=/fbav|instagram/.test(t)&&/(iphone|ipad|ipod)/.test(t)?[i[0],"safari",i[2]]:/(iphone|ipad|ipod)\/?\s*(\.?\d+(\.\d+)*)/.exec(t)||/(android)[ /]([\w._-]+);/.exec(t)||[i[0],"safari",i[2]]:"mozilla"===i[1]?/trident/.test(t)?i[1]="MSIE":i[1]="firefox":/polaris|natebrowser|([010|011|016|017|018|019]{3}\d{3,4}\d{4}$)/.test(t)&&(i[1]="Polaris"),[i[1].toLowerCase(),"unknown"===i[2]?[n,window.navigator.appVersion,"-?"]:i[2]]}bi.prototype.destroy=function(){this.parentStorage.destroy(),this.saveItListener&&(mi.removeEventListener("unload",this.saveItListener),delete this.saveItListener)},bi.prototype.has=function(e,t){return this.parentStorage.has(e,t)},bi.prototype.set=function(e,t,n){if(this.parentStorage.set(e,t,n),!this.skipSaveForKey||!this.skipSaveForKey(e)){var i=!1;!0===n?(this._data[this.clientName].p[e]!==t&&(i=!0),this._data[this.clientName].p[e]=t):(this._data[this.clientName].s[e]!==t&&(i=!0),this._data[this.clientName].s[e]=t),i&&yi(this._data)}},bi.prototype.get=function(e,t){var n=!0===t?this._data[this.clientName].p[e]:this._data[this.clientName].s[e];if(void 0!==n)try{return JSON.parse(n)}catch(e){return n}return this.parentStorage.has(e,t)?(n=this.parentStorage.get(e,t),this.skipSaveForKey&&this.skipSaveForKey(e)?n:(!0===t?this._data[this.clientName].p[e]=n:this._data[this.clientName].s[e]=n,yi(this._data),n)):null},bi.prototype.del=function(e,t){this.parentStorage.del(e,t),!0===t?delete this._data[this.clientName].p[e]:delete this._data[this.clientName].s[e],yi(this._data)},bi.prototype.clear=function(){this.parentStorage.clear(),this._data[this.clientName].p={},this._data[this.clientName].s={},yi(this._data)};var _i={},Ei=0,Ii={},Ni=0,Oi={},Ti={};var ki=!1;function xi(){ki||(_e.error("Double load of concierge suspected"),ki=!0)}function Di(e,t){var n=++Ni;return t.bridgeName="storage_bridge",t.requesterId=e.id,t.requestId=n,t.client=e.concierge.clientName,t.signature="moxie_concierge",e&&e.ifrm&&e.ifrm.contentWindow&&e.ifrm.contentWindow.postMessage?(function(){if("function"==typeof window.CustomEvent)return!1;window.CustomEvent=function(e,t){t=t||{bubbles:!1,cancelable:!1,detail:null};var n=document.createEvent("CustomEvent");return n.initCustomEvent(e,t.bubbles,t.cancelable,t.detail),n}}(),e.ifrm.contentWindow.postMessage(JSON.stringify(t),"*"),new A((function(i,r){var o=setTimeout((function(){if(o=!1,r(new Error("TIMEOUT waiting for shared storage.")),e.concierge.isTestMode){var t=new CustomEvent("stopWriting");document.dispatchEvent(t)}}),6e3);if(e.concierge.isTestMode){var a=new CustomEvent("storagePost");document.dispatchEvent(a)}var s=function(){o&&(clearTimeout(o),o=!1)};Oi[n]={message:t,resolve:function(e){s(),i(e)},reject:function(e){s(),r(e)}}})).finally((function(){delete Oi[n]}))):(xi(),A.resolve(!0))}function Mi(e,t){this.useSharedStorage=!1,this.parentStorage=e,this.concierge=t,this.scriptLocation=t.scriptLocation,this.created=Date.now(),this.sharedStorageId=function(e){var t=Ii[e];return t||(t="concierge-shared-storage",++Ei>1&&(t=t+"-"+Ei),Ii[e]=t),t}(this.scriptLocation),this.id=Date.now()}function Li(e){this.name="InvalidArgumentException",this.message=e,this.toString=function(){return this.name+": "+this.message}}function Ai(e){return xe(e,"_file")&&e.indexOf("profileJSON")<0||"Rules"===e||"engagementWidgets"===e}function Wi(e,t,n,i){return A.resolve(e.storagePlugin.set(t,n,i))}Mi.prototype.destroy=function(e){e&&this.parentStorage.destroy(),mt(this.ifrm),this.removeListener?(this.removeListener(),delete this.ifrm):xi()},Mi.prototype.init=function(){var e=this;if(_i[this.id]=this,this.data={p:{},s:{}},e.ifrm=gt(e.sharedStorageId),!e.ifrm){e.ifrm=document.createElement("iframe"),e.ifrm.setAttribute("id",e.sharedStorageId),e.ifrm.setAttribute("tabindex","-1");var t=e.scriptLocation+"/client/storage_bridge.html";e.ifrm.setAttribute("src",t),e.ifrm.setAttribute("sandbox","allow-scripts allow-same-origin");var n=function(t){if("."===e.scriptLocation||0===e.scriptLocation.indexOf(t.origin)){var n={};try{n="string"==typeof t.data?JSON.parse(t.data):t.data}catch(e){}if(n&&"storage_bridge"===n.bridgeName){var i,r,o,a=e;if(n.requesterId&&_i[n.requesterId]&&(a=_i[n.requesterId]),n.requesterId===a.id)n.error?(i=n.requestId,r=new Error("Error from shared storage: "+n.error.message),(o=Oi[i])?o.reject(r):_e.log("SharedStorageBridge: rejectRequest("+i+", "+JSON.stringify(r)+") cannot find outstanding request")):"updated"===n.request?(_e.log("CONCIERGE StoragePlugin update: ",n),"moxie_cc"!==n.key||n.newValue||Si(e.concierge).catch((function(e){_e.log("ERROR clearing history"+e)}))):function(e,t){var n=Oi[e];n?n.resolve(t):_e.log("SharedStorageBridge: resolveRequest("+e+", "+JSON.stringify(t)+") cannot find outstanding request")}(n.requestId,n);else ki||_e.log('CONCIERGE StoragePlugin request ID mismatch: plug in "'+a.id+'" receved an event for "'+n.requesterId+'"')}}};e.removeListener=function(){window.removeEventListener("message",n,!1)},Ti[e.scriptLocation]=new A((function(t){e.ifrm.onload=function(e){e.target&&e.target.src&&t(e)}})).then((function(){window.addEventListener("message",n,!1)})),e.ifrm.style.display="none",document.body.appendChild(e.ifrm)}return Ti[e.scriptLocation].then((function(){var t="safari"===Ci(window.navigator)[0];return Di(e,{request:"init",shadowInSessionStorage:t}).then((function(t){for(var n in e.parentStorage.removeKeysOtherThan(Object.keys(t.lsValue),!0),e.parentStorage.removeKeysOtherThan(Object.keys(t.ssValue),!1),t.lsValue)e.parentStorage.set(n,t.lsValue[n],!0);for(var i in t.ssValue)e.parentStorage.set(i,t.ssValue[i],!1);e.useSharedStorage=!0}),(function(t){throw _e.log("SharedStoragePlugin#init: Failed to load from shared storage, removing listener: "+t.message),e.removeListener(),t}))}))},Mi.prototype.name="SharedStoragePlugin",Mi.prototype.has=function(e,t){return this.parentStorage.has(e,t)},Mi.prototype.get=function(e,t){return this.parentStorage.get(e,t)},Mi.prototype.clear=function(){this.parentStorage.clear();return Di(this,{request:"clear"}).then((function(e){return"ack"===e.request}))},Mi.prototype.set=function(e,t,n){if(this.parentStorage.set(e,t,n),!this.skipSaveForKey||!this.skipSaveForKey(e))return Di(this,{request:"store",key:e,value:t,persist:!0===n}).then((function(e){return"ack"===e.request}))},Mi.prototype.del=function(e,t){return this.parentStorage.del(e,t),Di(this,{request:"remove",key:e,persist:!0===t}).then((function(e){return"ack"===e.request}))};var Ri=0;function Pi(e){this.id=++Ri,this.concierge=e,this.storagePlugin=this.defaultStoragePlugin=new ci;var t=Xn("sessionStorage");Xn("localStorage")&&t?(this.storagePlugin=new fi(this.defaultStoragePlugin),this.storagePluginToLoad="SharedStorage"):this.storagePluginToLoad="window.name",this.eventSerialNumber=null,this.saveEventSerialNumber=null,t&&(this.saveEventSerial=this.storeEventSerialNumberSessionStorage,this.eventSerialNumber=this.readEventSerialNumberFromSessionStorage())}function ji(e,t,n){return A.resolve(e.storagePlugin.del(t,n))}function Fi(e){return"MoxieCache_"+e+"_file"}function Vi(e){if(e&&(delete e.last_updated,delete e.last_submitted,e.session&&e.session.visits)){var t=e.session.visits.length-1;if(t>=0){var n=e.session.visits[t].journey;if(n){var i=n.length-1;i>=0&&(e.session.visits[t].journey[i].end_time=0)}}}}function qi(e){var t=Fi("profileJSON");return function(e,t){return A.resolve(e.storagePlugin.get(t,!0)).then((function(e){return e?void 0===e.contents?(_e.log("Loaded "+t+" from localStorage, but .contents was undefined"),null):(_e.log("Loaded "+t+" from localStorage"),e.contents):null}))}(e,t).then((function(e){if(null!==e)try{return JSON.parse(e)}catch(e){_e.log("Error parsing profile: "+e.message)}return null})).then((function(t){if(null!==t)return e.setData("profileJSON",JSON.stringify(t),!0)})).then((function(){return e}))}function Ji(e){return function(e){return e.storagePlugin.get("moxie_cc",!0)||e.storagePlugin.get("uuid",!0)}(e)?e.autoLoadProperties().then(qi).then((function(){return e})):function(e){_e.log("Creating new identity");var t=e.makeProfileId();return A.all([Wi(e,"uuid",t,!0),Wi(e,"moxie_cc",t+"|2147483647",!0)]).then((function(){return e.uuid=t,e}))}(e).then(qi).then((function(){return e}))}Pi.prototype.storeEventSerialNumberSessionStorage=function(e){window.sessionStorage.setItem("moxie_concierge_event_serial_number",JSON.stringify(e))},Pi.prototype.readEventSerialNumberFromSessionStorage=function(){var e=window.sessionStorage.getItem("moxie_concierge_event_serial_number");if(null==e||""===e)return null;var t=null;try{t=JSON.parse(e)}catch(e){return _e.log("Could not read serial number from session storage: "+e.message),null}return"number"!=typeof t?null:Math.floor(t)!==t?null:t<0||t>4294967295?null:t},Pi.prototype.makeEventSerialNumber=function(){null===this.eventSerialNumber&&(this.eventSerialNumber=Math.floor(Math.random()*(Math.pow(2,32)-1)));var e=this.eventSerialNumber++;return this.saveEventSerial&&this.saveEventSerial(this.eventSerialNumber),this.eventSerialNumber>4294967295&&(this.eventSerialNumber=0),e},Pi.prototype.cleanup=function(){delete this.profileJSON,delete this.uuid},Pi.prototype.destroy=function(){this.cleanup(),this.storagePlugin.destroy()},Pi.prototype.skipSaveForKey=Ai,Pi.prototype.isValidUserProfile=function(e){return void 0!==e.session&&void 0!==e.session.id},Pi.prototype.getVisitorProfileId=function(){return this.getDataClone("uuid")},Pi.prototype.emitEvent=function(e){var t;return"function"==typeof CustomEvent?t=new CustomEvent(e):(t=document.createEvent("CustomEvent")).initCustomEvent(e,!0,!0,{}),_e.log("CacheManager: emitting profile update event: "+JSON.stringify(t)),this.dispatchEvent(window,t)},Pi.prototype.dispatchEvent=function(e,t){return e.dispatchEvent(t)},Pi.prototype.resetVisitorProfile=function(){var e=this;return this.concierge.contextMonitor.stop(),ji(this,Fi("profileJSON"),!0).then((function(){e.visitorProfile=null;var t=e.concierge.contextMonitor.createNewProfile();return e.setData("profileJSON",JSON.stringify(t))})).then((function(){e.concierge.contextMonitor.start()}))},Pi.prototype.setData=Kn((function(e,t,n){if(!$e(t))throw new Li("Cannot set "+e+", data must be a string.");if("profileJSON"===e){var i,r=this.getDataClone("profileJSON");try{i=JSON.parse(t)}catch(t){throw new Li("Cannot set "+e+", data is invalid JSON.")}var o=!1,a=!n&&function(e,t){var n=!1;if(e&&e.session&&e.session.visits&&e.session.visits.length>0){var i=e.session.visits.slice(-1)[0];if(i.journey&&i.journey.length>0){var r=i.journey.slice(-1)[0];new Date-new Date(r.end_time)>60*t*1e3&&(n=!0)}else n=!0}else n=!0;return n}(r,30),s=!1;if(n||null!=r){if(void 0!==i.customData)if(r&&void 0!==r.customData)JSON.stringify(r.customData)!==JSON.stringify(i.customData)&&(s=!0);else s=!0}else o=!0,void 0!==i.customData&&(s=!0);return o&&fe(this.concierge),a&&pe(this.concierge),s&&me(this.concierge,i.customData),this.storeProfile(t)}if(e===P)return this[P]=t,Wi(this,P,t,!0);if("rules_version"===e)return this.rules_version=t,Wi(this,"rules_version",t,!0);if("widgets_version"===e)return this.widgets_version=t,Wi(this,"widgets_version",t,!0);throw new Li("Cannot set "+e+", unknown property.")})),Pi.prototype.storeProfile=Kn((function(e){var t,n=JSON.parse(e);if(this.isValidUserProfile(n)){this.profileJSON=n;var i=(t=0,{contents:e,timestamp:(new Date).getTime(),version:t});return Wi(this,Fi("profileJSON"),i,!0)}throw new Li("Cannot store profile, it is not valid.")})),Pi.prototype.setVolatileData=Kn((function(e,t){if("moxie_channels_custom_data"===e||"moxie_channels_form_data"===e)return this[e]=t;throw new Li("Cannot set "+e+".")})),Pi.prototype.getVolatileData=function(e){return this[e]},Pi.prototype.profileUpdated=function(e){var t=this.getDataClone("profileJSON"),n=Pe(e);return Vi(n),Vi(t),JSON.stringify(t)!==JSON.stringify(n)},Pi.prototype.getData=function(e){var t=this[e];return t?"object"==typeof t?Pe(this[e]):this[e]:null},Pi.prototype.getDataClone=function(e){return this.getData(e)},Pi.prototype.getDataObject=function(e){return this[e]?this[e]:null},Pi.prototype.removeClientCache=function(e,t){return ji(this,"conclient_"+e,t)},Pi.prototype.setClientCache=function(e,t,n){return Wi(this,"conclient_"+e,t,n)},Pi.prototype.getClientCache=function(e,t){return this.storagePlugin.get("conclient_"+e,t)},Pi.prototype.removeWidgetCache=function(e,t,n){return ji(this,e+"-"+t,n)},Pi.prototype.setWidgetCache=function(e,t,n,i){return Wi(this,e+"-"+t,n,i)},Pi.prototype.getWidgetCache=function(e,t,n){return this.storagePlugin.get(e+"-"+t,n)},Pi.prototype.clearWidgetCacheKey=function(e,t){for(var n=[],i=this.storagePlugin;i.parentStorage;)i=i.parentStorage;var r,o=t?"p":"s",a=Object.keys(i.data[o]);for(r=0;r<a.length;r++)xe(a[r],e)&&n.push(ji(this,a[r],t));return A.all(n)},Pi.prototype.init=function(){var e=this;if(!this.ready){var t,n=A.resolve(e);"window.name"===e.storagePluginToLoad?(e.storagePlugin=new bi(e.storagePlugin,e.concierge),e.storagePlugin.skipSaveForKey=Ai):"SharedStorage"===e.storagePluginToLoad&&(t=new Mi(e.storagePlugin,e.concierge),n=n.then((function(){return t.init()})).then((function(){e.storagePlugin=t,t.skipSaveForKey=Ai})).catch((function(e){t&&t.destroy(!1),_e.log("FAILED to initialize the SharedStoragePlugin falling back to using regular localStorage: "+e.message)})).then((function(){return e}))),this.ready=n}return this.ready.then(Ji)};var Hi=function(e,t){A.resolve(e.storagePlugin.get(t,!0)).then((function(n){e[t]=n}))};Pi.prototype.autoLoadProperties=function(){var e=this,t=[];return t.push(e.storagePlugin.get("moxie_cc",!0)),t.push(e.storagePlugin.get("uuid",!0)),t.push(Hi(e,P)),t.push(Hi(e,"rules_version")),t.push(Hi(e,"widgets_version")),A.all(t).then((function(t){var n,i=t[0],r=t[1];return n=i?i.split("|").shift():r,e.uuid=n,e}))},Pi.prototype.makeProfileId=function(){return ri()};var $i=null,Bi=null,Ui=null;function Gi(e){this.monitoredRules=[],this.concierge=e,this.rulesEngine=e.rulesEngine,this.cacheManager=e.cacheManager,this.moxieData=window.MoxieData||{},this.getLastLocation=function(){return $i},this.getLastDevice=function(){return Bi},this.getLastBrowseInfo=function(){return Ui};var t=0,n=0;this.nextMonitorId=function(){return++n},this.start=function(){var e=this;t=setInterval((function(){e.poll()}),1e3)},this.stop=function(){t>0&&(clearInterval(t),t=0)}}Gi.prototype.cleanup=function(){this.stop()},Gi.prototype.evalRules=function(){this.monitoredRules.forEach((function(e){this.rulesEngine.evalRule(e)?(this.rulesEngine.queueActions(e),this.unregister(e),e.monitor=!1):this.rulesEngine.rulesSucceeded[e.id]&&this.unregister(e)}),this)},Gi.prototype.fetchLocation=function(){return this.concierge.httpGet(this.concierge.serviceUrl.location,{type:"GET"}).then((function(e){var t=e.subdivisions&&e.subdivisions.length?e.subdivisions[0].names.en:"";return{city:e.city?e.city.names.en:"",state:t,country:e.country?e.country.names.en:"",ip_address:"",zip:"",longitude:e.location?e.location.longitude:"",latitude:e.location?e.location.latitude:""}}))},Gi.prototype.recordEngagementValue=function(){var e=this.cacheManager.getDataClone("profileJSON"),t=We(Re(e,1),1).current_cart_value;return void 0===e.session.first_engagement_cart_value&&(e.session.dirty=!0,e.session.first_engagement_cart_value=t),void 0===e.session.visits[e.session.visits.length-1].first_engagement_cart_value&&(e.session.visits[e.session.visits.length-1].first_engagement_cart_value=t),this.cacheManager.setData("profileJSON",JSON.stringify(e))},Gi.prototype.parseMappedContext=function(e){if(void 0!==e){"string"==typeof e&&(e=[e]);var t=function(e,t){t.replace(/^\$\[/,"").replace(/\]\$$/,"");var n=Vn(vt(t)),i=n.text()||n.val();return i?i.trim():""};for(var n in e)Fe(e,n)&&"string"==typeof e[n]&&(e[n]=e[n].replace(/\$\[(.*?)\]\$/g,t));return e}},Gi.prototype.initTracking=function(){var e,t=0,n=0,i=this.cacheManager.getDataClone("profileJSON"),r=!1,o=!1,a=Ci(navigator);Ui={name:a[0],version:a[1]},Bi=H(navigator);var s=Number(this.cacheManager.getData(P)),c=this;if(null==i)(i={id:this.cacheManager.getData("uuid"),dirty:!0,tags:null,ip_address:"",all_device_names:[],all_browsers:[{name:Ui[0],version:Ui[1],language:navigator.language}],all_locations:null,preferences:{never_invite_to_chat:!1,language:navigator.language},session:null,history:{visits:0,last_visit:Date.now(),articles_viewed:0,invited_chat:0,refused_chat:0},last_updated:Date.now(),last_submitted:0}).all_device_names.push(Bi),r=!0,o=!0;else{if(Number(We(Re(i,1),1).end_time)<s&&(t=i.session.visits.length-1,e=i.session.visits[t].journey.length-1,i.session.visits[t].journey[e].end_time=s,i.last_updated=s),!0!==i.session.transaction_completed&&!0!==this.moxieData.transactionComplete||(this.moxieData.transactionComplete&&(i.session.transaction_completed=this.moxieData.transactionComplete=!0,i.session.end_cart_value=this.moxieData.transactionTotal,Bn("transactionCompleted",{transactionTotal:this.moxieData.transactionTotal,cart:{value:this.moxieData.currentCartValue,items:this.moxieData.currentCartItems}}),oe(this.concierge,this.moxieData.transactionTotal),this.cacheManager.setData("profileJSON",JSON.stringify(i))),void 0!==this.moxieData.customData&&this.concierge.publicAPI.customData(this.concierge,this.moxieData.customData),i.session=null),void 0!==i.session&&null!==i.session&&void 0!==i.session.visits){var u=Ae(We(Re(i,0)).start_time);(u>2592e3||isNaN(u))&&(i.session=null)}null!==i.session&&0!==i.session.visits.length&&((n=Ae(We(Re(i,1),1).end_time))>1800||isNaN(n))&&(o=!0)}if(null===i.session||void 0===i.session){var l={};l.id=ri(),l.visits=[],l.dirty=!0,l.end_cart_value=0,i.session=l,r=!0,o=!0}if(o){var d={};d.id=ri(),d.dirty=!0,d.journey=[],d.browser={name:Ui[0],version:Ui[1],language:navigator.language},d.device={},d.device.name=H(navigator),d.referral={url:document.referrer.substr(0,200)},d.journey=[],i.session.visits.push(d),i.history.visits+=1,r=!0}var g={};g.id=ri(),g.dirty=!0,g.url=this.concierge.url.substr(0,200),g.title=this.concierge.pageTitle.substr(0,200),g.start_time=Date.now(),g.end_time=Date.now(),g.referral={url:document.referrer.substr(0,200)};var h=We(Re(i,1),1),f=h&&h.current_cart_value?h.current_cart_value:0;if(void 0!==this.moxieData.customData&&this.concierge.publicAPI.customData(this.concierge,this.moxieData.customData),void 0!==this.moxieData.currentCartValue){g.current_cart_value=this.moxieData.currentCartValue;var p=this.moxieData.currentCartItems||(h&&h.current_cart_items?h.current_cart_items:[]);Bn("cartUpdated",{cartValue:this.moxieData.currentCartValue,cartItems:p}),ae(this.concierge,this.moxieData.currentCartValue,p)}else g.current_cart_value=f;if(void 0!==this.moxieData.currentCartItems){var v;for(g.current_cart_items=[],v=0;v<this.moxieData.currentCartItems.length;v++)g.current_cart_items.push({name:this.moxieData.currentCartItems[v].name?this.moxieData.currentCartItems[v].name:"",sku_or_id:this.moxieData.currentCartItems[v].skuOrId,value:this.moxieData.currentCartItems[v].value,quantity:this.moxieData.currentCartItems[v].quantity,uom:this.moxieData.currentCartItems[v].uom,description:this.moxieData.currentCartItems[v].description})}else{var m=h&&h.current_cart_items?h.current_cart_items:[];g.current_cart_items=Pe(m)}t=i.session.visits.length-1;return i.history.last_visit=Date.now(),(r?this.fetchLocation().then((function(e){$i=e,je(i,"ip_address",e.ip_address),je(i.session,"ip_address",e.ip_address);var n=!0;if(i.all_locations)for(var r=0;r<i.all_locations.length;r++)if(i.all_locations[r].city===e.city){n=!1;break}n&&(i.all_locations=i.all_locations||[],i.all_locations.push(e)),o&&(i.session.visits[t].ip_address=e.ip_address,i.session.visits[t].location=e)})).catch((function(e){_e.log("Failed to fetch location: "+JSON.stringify(e))})):A.resolve()).then((function(){return i.session.visits[t].journey.push(g),c.cacheManager.setData("profileJSON",JSON.stringify(i)).then((function(){return{rules:1,widgets:c.concierge.configuration.widgets.version}}))}))},Gi.prototype.createNewProfile=function(){var e=Date.now();return{last_updated:e,last_submitted:0,history:{last_visit:e},session:{id:ri(),dirty:!0,visits:[{journey:[{id:ri(),dirty:!0,start_time:e,end_time:e,title:this.concierge.pageTitle.substr(0,200),url:this.concierge.url.substr(0,200),current_cart_value:0,current_cart_items:[]}]}],transaction_completed:!1,end_cart_value:0}}},Gi.prototype.poll=function(){var e=Date.now(),t=this;zn((function(){t.evalRules();var n=[];if(n.push(t.cacheManager.setData(P,e.toString(),!0)),"function"==typeof document.hasFocus&&document.hasFocus()){var i=t.cacheManager.getDataClone("profileJSON"),r=i.session.visits.length-1,o=i.session.visits[r].journey.length-1;i.session.visits[r].journey[o].end_time=e,i.last_updated=e,n.push(t.cacheManager.setData("profileJSON",JSON.stringify(i)))}return A.all(n)})).catch((function(e){_e.log("ContextMonitor.poll: error "+(e.stack?e.stack:e.message))}))},Gi.prototype.register=function(e){e.monitor&&!e.monitorId&&(e.monitorId=this.nextMonitorId(),this.monitoredRules.push(e))},Gi.prototype.unregister=function(e){if(e.monitor&&void 0!==e.monitorId)for(var t=e.monitorId,n=0;n<this.monitoredRules.length;n++)if(this.monitoredRules[n].monitorId===t){this.monitoredRules.splice(n,1),e.monitorId=!1;break}},Gi.prototype.tagProfile=function(e,t){var n=this.cacheManager.getData("profileJSON");n.tags=n.tags||[];var i={status:!1,tags:e.tag.filter((function(e){return-1===n.tags.indexOf(e)}))};return i.tags.length&&(n.tags=n.tags||[],n.tags=n.tags.concat(i.tags),this.cacheManager.setData("profileJSON",JSON.stringify(n)),i.status=!0),i},Gi.prototype.removeProfileTag=function(e,t){var n=this.cacheManager.getData("profileJSON");n.tags=n.tags||[];var i={status:!1,tags:e.tag.filter((function(e){return-1!==n.tags.indexOf(e)}))};return i.tags.length&&(n.tags=n.tags.filter((function(e){return-1===i.tags.indexOf(e)})),0===n.tags.length&&(n.tags=null),this.cacheManager.setData("profileJSON",JSON.stringify(n)),i.status=!0),i};var zi=function(e){this.concierge=e};function Ki(e,t){return e.then((function(e){try{var n=t(e);void 0!==n&&(e=n)}catch(e){_e.error("Error in callback function: "+e)}return e}))}zi.prototype.log=function(e){_e.log(e)},zi.prototype.location=function(){return this.concierge.scriptLocation+"/widgets/"+this.concierge.assetVersion.widgets+"/translation.json"},zi.prototype.navigator=function(){return navigator},zi.prototype.htmlElement=function(){return document.documentElement},zi.prototype.sanitizeLang=function(e){return e=(e=e.toLowerCase()).replace("_","-")},zi.prototype.parentLang=function(e){return e?e.split("-").slice(0,-1).join("-"):""},zi.prototype.detectLanguage=function(){var e=this.navigator(),t=this.htmlElement(),n=this.sanitizeLang(t.getAttribute("lang")||t.getAttribute("xml:lang")||e.languages&&e.languages[0]||e.language||e.userLanguage||this.data.defaultLanguage||"en");return this.log("Language: "+n),n},zi.prototype.getValue=function(e,t){var n=this.data.sourceLangs[e];return!(!n||!Fe(this.data.langs[n],t))&&this.data.langs[n][t]},zi.prototype.translate=function(e,t){for(var n=this.data.selectedLanguage,i=!1,r=!1;n;){if(!1!==(i=this.getValue(n,e)))return i;n===this.data.defaultLanguage&&(r=!0),(n=this.parentLang(n))||r||(n=this.data.defaultLanguage)}return t||"__"+e+"__"},zi.prototype.handleJSONResponse=function(e){this.data=e,e.selectedLanguage=this.detectLanguage(),e.defaultLanguage=this.sanitizeLang(e.defaultLanguage);for(var t={},n=Object.keys(e.langs),i=0;i<n.length;i++)t[this.sanitizeLang(n[i])]=n[i];e.sourceLangs=t,this.concierge.langOptions={defaultLanguage:e.defaultLanguage,selectedLanguage:e.selectedLanguage}},zi.prototype.init=function(){this.handleJSONResponse(this.concierge.configuration.translations)};var Xi=function(){this.callbacks=[]};function Qi(e){this.concierge=e,this.names={}}function Yi(){this.isRunning=!1,this.whenDone=A.resolve(!0),this.queue=[]}function Zi(e){_e.log("ActionQueue: Error thrown from run promise, "+JSON.stringify(e))}function er(e){this[1]=function(t,n,i){return e.widgetManager.addWidget(n,{id:t.id,action:i,name:t.name,source:t.source})},this[2]=function(t,n,i){var r=e.widgetManager.findWidget(n.widget);return e.widgetManager.removeWidget(r)},this[3]=function(t,n,i){return e.widgetManager.notify(n,{id:t.id,action:i,name:t.name,source:t.source})},this[4]=function(t,n,i){return e.contextMonitor.tagProfile(n,{id:t.id,action:i,name:t.name,source:t.source})},this[5]=function(t,n,i){return e.contextMonitor.removeProfileTag(n,{id:t.id,action:i,name:t.name,source:t.source})}}function tr(e){var t=e.cacheManager;this.conciergeItem=function(t){return e[t]},this.visitorProfileGetTags=function(){return t.getData("profileJSON").tags},this.visitsToSite=function(){return F(t.getData("profileJSON"),"history","visits")},this.currentCartValue=function(){return We(Re(t.getData("profileJSON"),1),1).current_cart_value},this.productsInCart=function(){return We(Re(t.getData("profileJSON"),1),1).current_cart_items},this.userDeviceName=function(){return Re(t.getData("profileJSON"),1).device.name.toLowerCase()},this.secondsOnCurrentPage=function(){var e=We(Re(t.getData("profileJSON"),1),1);return Ae(Date.now(),e.start_time)},this.secondsOnSite=function(){var e=Re(t.getData("profileJSON"),1),n=We(e,0);return Ae(We(e,1).end_time,n.start_time)},this.secondsFromLastVisit=function(){var e,n=Re(t.getData("profileJSON"),2,2,!1);if(n){var i=We(n,2,1,!1);void 0!==i&&void 0!==i.end_time&&(e=Ae(i.end_time))}return e},this.numberOfPagesVisited=function(){return Re(t.getData("profileJSON"),1).journey.length},this.geographicLocationItem=function(e){return Re(t.getData("profileJSON"),1).location[e]},this.numberOfTimesPageViewed=function(){for(var n=Re(t.getData("profileJSON"),1),i=0,r=1;r<=n.journey.length;r++){We(n,2,r,!1).url===e.url&&i++}return i},this.referralURL=function(){return We(Re(t.getData("profileJSON"),1),1).referral.url},this.lastPageVisitedItem=function(e){return We(Re(t.getData("profileJSON"),1),2)[e]},this.previouslyVisitedItems=function(e){for(var n=Re(t.getData("profileJSON"),1),i=[],r=1;r<=n.journey.length;r++){var o=We(n,2,r,!1);i.push(o[e])}return i},this.elementCount=function(e){return Vn(vt(e)).length},this.elementValue=function(e){var t=Vn(vt(e)),n={},i=!1;return t[0]&&"SELECT"===t[0].nodeName&&(t=Vn(vt(e)).find("option:checked"),i=!0),i?(n.value=t.val(),n.text=t.text()):n.value=t.val()||t.text(),n},this.customValue=function(e){return F(window,"MoxieData",e)}}function nr(e){this.siteRules=null,this.isTestMode=e.isTestMode,this.concierge=e,this.actionQueue=new Yi,this.rulesSucceeded={},this.categorySucceeded={},this.categorySucceeded[1]={},this.categorySucceeded[2]={},this.categorySucceeded[3]={},this.categorySucceeded[4]={},this.categorySucceeded[5]={}}Xi.prototype.add=function(e){this.callbacks.push(e)},Xi.prototype.doCallbacksAsync=function(e){for(var t=A.resolve(e),n=0;n<this.callbacks.length;n++)t=Ki(t,this.callbacks[n]);return t},Xi.prototype.doCallbacksSync=function(e){for(var t=0;t<this.callbacks.length;t++)try{var n=this.callbacks[t](e);void 0!==n&&(e=n)}catch(e){_e.error("Error in callback function: "+e)}return e},Qi.prototype.getServiceLines=function(){var e,t;return this.linesPromise||(this.linesPromise=(e=this.concierge,t=e.serviceUrl.connector+"/connector/channels/service_lines",e.httpGet(t).then((function(e){for(var t={},n=e.response,i=0;i<n.length;i+=1)t[n[i].id]=n[i].name;return t})).catch((function(e){throw _e.log("Error in fetchServiceLines"+e),e})))),this.linesPromise},Qi.prototype.setName=function(e,t){this.names[e]=A.resolve(t)},Qi.prototype.getName=function(e){return this.names[e]?this.names[e]:this.getServiceLines().then((function(t){return t[e]})).catch((function(){}))},Yi.prototype={done:function(){return 0===this.queue.length?(this.isRunning=!1,this.finishedRunning&&this.finishedRunning(!0),!0):this.next()},enqueue:function(e){return this.queue.unshift(e),this.run()},next:function(){var e=this,t=this.queue.pop();return zn((function(){var e=A.resolve(t.func(t.params.rule,t.params.parameters,t.params.type));return t.postAction?t.postAction(e):e})).catch((function(e){_e.log("ActionQueue: Error thrown while executing action, "+t.label+"; "+e.message+"; "+e.stack)})).finally((function(){return e.done()}))},run:function(){var e=this;return!e.isRunning&&e.queue.length>0&&(e.isRunning=!0,e.whenDone=new A((function(t){e.finishedRunning=t})),setTimeout((function(){return e.isRunning?e.next().catch(Zi):null}))),this.whenDone}},nr.prototype.ActionLibrary=er,nr.prototype.CriteriaLibrary=tr;var ir=function(e,t){return void 0===e?e:t?!e:e},rr=function(e,t,n){return e?[n,t]:[t,n]},or=function(e,t,n){var i,r,o,a,s,c,u,l,d,g,h,f,p,v,m,w,y,b,S,C,_,E=n[0],I=n[2],N=n[5];if(1e3===E){for(var O=!0,T=0;T<I.length;T++)if(!or(e,t,I[T])){O=!1;break}return N?!O:O}if(1001===E){for(var k=!1,x=0;x<I.length;x++)if(or(e,t,I[x])){k=!0;break}return N?!k:k}var D,M,L,A,W=n[1],R=n[3],P=n[4];try{switch(W){case 21:return M=Date.now(),L=(i=rr(R,M,60*I*1e3))[0],A=i[1],D=Le(L,Ne(E,W),A),ir(D,N);case 19:return M=e.conciergeItem("url"),L=(r=rr(R,M,I))[0],A=r[1],D=Le(L,Ne(E,W),A),ir(D,N);case 20:return M=e.conciergeItem("pageTitle"),L=(o=rr(R,M,I))[0],A=o[1],D=Le(L,Ne(E,W),A),ir(D,N);case 1:return(M=e.visitorProfileGetTags())&&M.length?(D=-1!==M.indexOf(I),ir(D,N)):ir(!1,N);case 2:return M=e.visitsToSite(),L=(a=rr(R,M,I))[0],A=a[1],D=Le(L,Ne(E,W),A),ir(D,N);case 3:return M=e.currentCartValue(),L=(s=rr(R,M,I))[0],A=s[1],D=Le(L,Ne(E,W),A),ir(D,N);case 4:M=e.productsInCart(),D=!1;for(var j=0;j<M.length;j++){var F=M[j],V=Ne(E,W),q=rr(R,I,F.name),J=q[0],H=q[1],$=rr(R,I,F.skuOrId),B=$[0],U=$[1],G=rr(R,I,F.sku_or_id),z=G[0],K=G[1];if(Le(J,V,H)||"string"==typeof B&&"string"==typeof U&&Le(B,V,U)||"string"==typeof z&&"string"==typeof K&&Le(z,V,K)){D=!0;break}}return ir(D,N);case 5:return M=e.userDeviceName(),L=(c=rr(R,M,I))[0],A=c[1],D=Le(L,Ne(E,W),A),ir(D,N);case 7:return M=e.secondsOnCurrentPage(),D=Le(L=(u=rr(R,M,I))[0],E,A=u[1]),ir(D,N);case 8:return!!(M=e.secondsFromLastVisit())&&(!(I>0)||(L=(l=rr(R,M,I))[0],A=l[1],D=Le(L,Ne(E,W),A),ir(D,N)));case 9:return M=e.numberOfPagesVisited(),L=(d=rr(R,M,I))[0],A=d[1],D=Le(L,Ne(E,W),A),ir(D,N);case 10:return M=e.geographicLocationItem("city"),L=(g=rr(R,M,I))[0],A=g[1],D=Le(L,Ne(E,W),A),ir(D,N);case 11:return M=e.geographicLocationItem("state"),L=(h=rr(R,M,I))[0],A=h[1],D=Le(L,Ne(E,W),A),ir(D,N);case 12:return M=e.geographicLocationItem("country"),L=(f=rr(R,M,I))[0],A=f[1],D=Le(L,Ne(E,W),A),ir(D,N);case 13:return M=e.numberOfTimesPageViewed(),L=(p=rr(R,M,I))[0],A=p[1],D=Le(L,Ne(E,W),A),ir(D,N);case 14:return M=e.referralURL(),L=(v=rr(R,M,I))[0],A=v[1],D=Le(L,Ne(E,W),A),ir(D,N);case 15:return M=e.lastPageVisitedItem("url"),L=(m=rr(R,M,I))[0],A=m[1],D=Le(L,Ne(E,W),A),ir(D,N);case 16:return M=e.lastPageVisitedItem("title"),L=(w=rr(R,M,I))[0],A=w[1],D=Le(L,Ne(E,W),A),ir(D,N);case 17:case 18:if((M=18===W?e.previouslyVisitedItems("title"):e.previouslyVisitedItems("url"))&&M.length){D=!1;for(var X=0;X<M.length;X++)if(L=(y=rr(R,M[X],I))[0],A=y[1],Le(L,Ne(E,W),A)){D=!0;break}return ir(D)}return!1;case 22:return M=e.secondsOnSite(),L=(b=rr(R,M,I))[0],A=b[1],D=Le(L,Ne(E,W),A),ir(D,N);case 1e3:return M=e.elementCount(P),ir(D=M>=1,N);case 1001:return M=e.elementValue(P),Oe(E=Ne(E,W,I))&&isNaN(Me(M.value))&&(M.value="",M.text&&(isNaN(Me(M.text))||(M.value=M.text,delete M.text))),""!==M.value&&(!(D=Le(L=(S=rr(R,M.value,I))[0],E,A=S[1]))&&M.text&&(D=Le(L=(C=rr(R,M.text,I))[0],E,A=C[1])),ir(D,N));case 1002:return null!=(M=e.customValue(P))&&""!==M&&(L=(_=rr(R,M,I))[0],A=_[1],void 0!==(D=Le(L,Ne(E,W,I),A))&&ir(D,N));default:return _e.error("Unknown Scope/Criteria input value:",W),!1}}catch(e){var Q=t[0];return _e.error('Moxie Concierge Client: Scope/Criteria Eval Error ("'+Q+'" input:'+W+"): "+e.message),!1}},ar=function(e,t){var n=t[3];return null===n||or(e,t,n)},sr=function(e){var t=e[6];return{name:e[0],id:e[1],source:"offer",monitor:e[2],action:{success:e[5]},criteria:e[6],ruleArray:e,hasEvent:!!t}},cr=function(e,t,n){var i=this,r=Vn(vt(t)),o=r.length,a=function(t){i.evalRule(e,!0)&&i.queueActions(e)},s=!0;return this.isTestMode&&(s=-1===window.location.search.indexOf("noDirectEventHandlers")),s&<(r,(function(e){Zt(e,n,a),i.eventListenerArgs.push([e,[n,a]])})),o};function ur(e){for(var t=e.type,n=this.bodyEventListeners[t],i=[],r=0;r!==n.length;r++){for(var o=n[r],a=this.siteRules.rules[o][6],s=!1,c=0;c!==a.length&&!s;c++){var u=a[c],l=u[0];if(-1!==u[1].indexOf(t)){var d=vt(l);if(0!==d.length)for(var g=e.target;null!=g&&!s;){for(var h=0;h!==d.length&&!s;h++){s=d[h].isSameNode(g)}g=g.parentNode}}}s&&i.push(o)}for(var f=0;f!==i.length;f++){var p=i[f],v=this.ruleObjectsByIndex[p];this.evalRule(v,!0)&&this.queueActions(v)}}nr.prototype.removeAllEventListeners=function(){this.eventListenerArgs.forEach((function(e){var t=e[0],n=e[1];en.apply(void 0,[t].concat(n))}))},nr.prototype.init=function(e){var t=this;this.siteRules=e,this.actionLibrary=new er(this.concierge),this.criteriaLibrary=new tr(this.concierge),this.bodyEventListeners={},this.ruleObjectsByIndex=[],this.eventListenerArgs=[];for(var n=0;n<this.siteRules.rules.length;n++){var i=this.siteRules.rules[n],r=sr(i);if(ar(this.criteriaLibrary,i)){this.ruleObjectsByIndex[n]=r;var o=i[6];if(o&&o.length)for(var a=0;a!==o.length;a++){var s=o[a],c=s[0],u=s[1];if(u&&u.length)for(var l=0;l!==u.length;l++){var d=u[l];0===cr.bind(this)(r,c,d)&&(void 0===this.bodyEventListeners[d]&&(this.bodyEventListeners[d]=[]),-1===this.bodyEventListeners[d].indexOf(n)&&this.bodyEventListeners[d].push(n))}}}r.monitor&&!r.hasEvent&&this.concierge.contextMonitor.register(r)}var g=document.body,h=!0;if(this.isTestMode&&(h=-1===window.location.search.indexOf("noBodyEventHandler")),g&&h){var f=ur.bind(this);Object.keys(this.bodyEventListeners).forEach((function(e){Zt(g,e,f),t.eventListenerArgs.push([g,[e,f]])}))}},nr.prototype.getSiteRules=function(){return this.siteRules||{}},nr.prototype.getSiteSettings=function(){return this.siteRules.settings||{}},nr.prototype.queueWaitTime=function(){return this.siteRules&&this.siteRules.settings&&this.siteRules.settings.queue_wait_time>=0?this.siteRules.settings.queue_wait_time:5},nr.prototype.minTimeBetween=function(){return this.siteRules&&this.siteRules.settings&&this.siteRules.settings.min_time_between>=0?this.siteRules.settings.min_time_between:60},nr.prototype.hideWhenServiceLineClosed=function(){return this.siteRules&&this.siteRules.settings&&this.siteRules.settings.hide_on_demand_chat_when_service_line_is_closed},nr.prototype.checkQueueWaitTimeForReactive=function(){return this.siteRules&&this.siteRules.settings&&this.siteRules.settings.use_min_time_between_for_on_demand_chat},nr.prototype.checkQueueWaitTimeForProactive=function(){return this.siteRules&&this.siteRules.settings&&this.siteRules.settings.use_min_time_between_for_proactive_chat},nr.prototype.run=function(){var e,t,n;for(e=[],t=0;t<this.siteRules.rules.length;t++){var i=this.siteRules.rules[t],r=sr(i);n=this.evalRule(r),e.push({ruleset:r,success:n}),n&&F(r,"action","success")&&this.queueActions(r)}return e},nr.prototype.evalRule=function(e,t){if(t=!!t,e.hasEvent&&!t)return!1;var n=e.ruleArray,i=n[1];if(this.rulesSucceeded[i])return!1;var r=ar(this.criteriaLibrary,n);return!!r&&(!!(r=function(e,t){var n=t[4];return null===n||or(e,t,n)}(this.criteriaLibrary,n))&&(n[5]&&(this.rulesSucceeded[i]=!0),!0))},nr.prototype.isRedundantAction=function(e,t,n,i){return 4!==e&&5!==e&&(!i&&((!n||!n.length)&&(this.categorySucceeded[e][t]||this.categorySucceeded[2][t])))},nr.prototype.isRemoveOk=function(e){return this.categorySucceeded[1][e]||this.categorySucceeded[3][e]},nr.prototype.queueActions=function(e){var t,n,i,r,o,a=e.criteria,s=void 0!==e.monitorId||e.hasEvent,c=this.concierge.cacheManager.getDataClone("profileJSON"),u=[1,3,4,5];if(e.action&&e.action.success)for(var l=0;l<e.action.success.length;l++)if(n=(t=e.action.success[l])[0],i=t[1],r=t[2],null!==i&&(r.widget=Ie(i)),!(this.isRedundantAction(n,i,a,s)||2===n&&this.isRemoveOk(i))){o=-1!==u.indexOf(n)&&function(e,t,n,i,r,o){return o.then((function(n){if(n&&n.status)if(1===t||3===t){var o=null;n.parameters&&n.parameters.serviceLineId&&(o=n.parameters.serviceLineId);var a=null;n.parameters&&n.parameters.widget&&(a=n.parameters.widget);var s="reactive";3===t&&(s="proactive"),ye(e,i,r,o,a,s)}else if(4===t||5===t){we(4===t,e,n.tags,i,r)}return null}))}.bind(void 0,this.concierge,n,c,e.id,l);try{this.actionQueue.enqueue({label:e.name+":"+l+":"+n,func:this.actionLibrary[n],params:{rule:e,parameters:this.concierge.contextMonitor.parseMappedContext(r),type:"success"},postAction:o}),this.categorySucceeded[n][i]=!0}catch(t){_e.log('Moxie Concierge Client: Action Function Error ("'+e.name+'" action:'+l+"): "+t.message)}}};function lr(e){var t,n;this.wm=e,this.concierge=e.concierge,Yr(e)?this.spots=((t={}).single=new dr("single"),t):this.spots=((n={}).chat=new dr("chat"),n.kb=new dr("kb"),n.email=new dr("email"),n),this.offer=null,this.notification=null,this.open=null,this.active=[],this.alive=[]}function dr(e){this.name=e,this.reactive=null,this.widget=null,this.twiddled=!1}function gr(e,t){return e.spots[t]}function hr(e,t){var n=t.preferredSpotName();return n?Yr(e.wm)?"single":Fe(e.spots,n)?n:null:null}function fr(e,t){if(e.wm.notificationDisplayed())return!1;if(vr(e))return!1;if(pr(e))return!1;if(mr(e))return!1;var n=hr(e,t);if(n){var i=F(gr(e,n),"widget");if(i&&!i.hasFinished&&0!==i.state)return!1}return!0}function pr(e){return!!e.offer}function vr(e){return!!e.open}function mr(e){return!!e.notification}function wr(e,t){return Gr(t)?function(e,t){if(null===t.preferredSpotName())return!0;var n=gr(e,t.spot);if(n){if(!n.widget)return!0;if(Ar(e,n.widget))return!1;if(n.widget.hasFinished)return!0;if(n.widget.priority<t.priority)return!0;if(0===n.widget.state)return!0}return!1}(e,t):t.parameters.proactive||!1?function(e,t){if(pr(e))return!1;if(null===t.preferredSpotName())return!0;var n=gr(e,t.spot);if(n){if(!n.widget)return!0;if(n.widget.priority<t.priority)return!0;if(n.widget.hasFinished)return!0;if(0===n.widget.state)return!0}return!1}(e,t):function(e,t){var n=gr(e,t.spot);if(n){if(!n.reactive)return!0;if(n.reactive.priority<t.priority)return!0}return!1}(e,t)}function yr(e,t){t&&(e.open===t&&no(e.wm,!1),t.unload())}function br(e,t){var n=gr(e,t.spot);n&&n.widget!==t&&(yr(e,n.widget),n.widget=t,e.wm.engagementWidgets.widgets[t.name]=t,e.wm.widgetsType.updateWidgetElement(t),e.notification&&e.wm.widgetsType.updateNotification())}function Sr(e,t){var n=gr(e,t);return n&&n.widget?n.widget:null}function Cr(e,t,n){var i=t.spot;if(t.parameters.proactive&&!e.wm.loadingActiveWidgets)return e.offer=t,void function(e,t,n){var i=gr(e,t);i&&!i.widget&&br(e,n)}(e,i,t);var r=gr(e,i);r&&(Gr(t)||(r.reactive=t),(n||function(e,t,n){return!t||!Ar(e,t)&&(!!t.hasFinished||(n.priority>t.priority||0===t.state))}(e,r.widget,t))&&br(e,t))}function _r(e,t){var n=t.parameters;n.rule=n.rule||{},n.proactive=!0;var i=t.label();if(function(e){var t=1e3*e.rulesEngine.minTimeBetween();if(t<=0)return!1;return Date.now()<function(e){var t=Number(e.cacheManager.getClientCache("lastNotified"));return isNaN(t)?0:t}(e)+t}(e.concierge))return _e.log("wmStateMakeOffer("+i+"): notified too soon"),A.resolve(zr);if(!fr(e,t))return _e.log("wmStateMakeOffer("+i+"): cannot display notification"),A.resolve(zr);if(function(e){for(var t=e.active,n=t.length,i=0;i<n;i++)if(t[i].configuration.blockOffersWhileActive)return!0;return!1}(e))return _e.log("wmStateMakeOffer("+i+"): blockOffersWhileActive true"),A.resolve(zr);_e.log("wmStateMakeOffer("+i+"): invoked.");var r=e.wm,o=r.createEngagementRecord(t);t.engagementId=o;var a={status:!0,ref:t,parameters:t.parameters,engagementId:o,rule:t.parameters.rule};return t.beforeNotify(a).then(oo(r,(function(){return Lr(e,t)}))).then(oo(r,(function(){return fr(e,t)?(Mr(e,t),t.autoOpen?A.resolve(r.widgetsType.openConcierge(t)).then((function(){return zr})):a):(_e.log("WidgetManager.notify("+i+"): cannot display notification after beforeNotify is complete"),A.resolve(zr))}))).then(oo(r,(function(){t.notificationType=1,e.notification=t,r.showNotification(t);var n=r.getEngagementRecord(o);return null!==n&&(n.decision_type="Ignored",r.setEngagementRecord(o,n)),a}))).then(oo(r,(function(e){return _e.log("wmStateMakeOffer("+i+"): ready to notify."),e}))).catch((function(e){var t=e.message?e.message:e;return _e.log("wmStateMakeOffer("+i+"): error: "+t+"\n"+e.stack),zr}))}function Er(e,t){var n=gr(e,t);null!=n&&(_e.log('wmState twiddling spot: "'+t+'"'),n.twiddled=!0)}function Ir(e){if(pr(e)){var t=e.offer;!function(e,t){if(!t)return;var n=t.engagementId,i=e.getEngagementRecord(n),r=t.parameters;if("chat"===t.name){if(i.proactive&&r.rule){var o=new Date(i.time).getTime();i.chat.time_to_decide=Math.round(((new Date).getTime()-o)/1e3),i.decision_type="Declined",e.setEngagementRecord(n,i)}}else null!==i&&i.proactive&&(i.decision_type="Declined",e.setEngagementRecord(n,i))}(e.wm,t),Nr(e),e.wm.broadcastCloseProactiveNotification(t,"declined")}}function Nr(e){if(pr(e)){var t=e.offer,n=gr(e,t.spot);e.offer=null,n&&n.widget===t?n.reactive&&n.reactive!==t&&br(e,n.reactive):yr(e,t)}}function Or(e){if(mr(e)){var t=e.notification;Bn("notification",{widgetName:Qr(t.name),rule:t.parameters.rule,engagementId:t.engagementId,notificationType:ro(t.notificationType),status:"closed"}),e.wm.setNotificationType(0);var n=e.wm.widgetsType.closeNotification();return e.notification=null,n}}function Tr(e){if(mr(e)){var t=e.notification;Or(e),pr(e)?function(e){var t=e.offer;t&&(e.offer=null,e.wm.broadcastCloseProactiveNotification(t,"accepted"),br(e,t),0===t.state&&t.execute(e.wm),Er(e,t.spot))}(e):e.wm.showWidget(t)}}function kr(e){mr(e)&&(Or(e),pr(e)&&Ir(e))}function xr(e){mr(e)&&(Or(e),pr(e)&&function(e){pr(e)&&Nr(e)}(e))}function Dr(e,t){var n=t.label();return Lr(e,t).then((function(i){return i.status?(Mr(e,t),t.autoOpen?A.resolve(e.wm.widgetsType.openConcierge(t)).then((function(){return i})):i):(_e.log("WidgetManager.addWidget("+n+"): did not add widget"),i)})).catch((function(e){return _e.log("WidgetManager.addWidget("+n+"): failed: "+e),_e.log(e.stack),zr}))}function Mr(e,t){var n=e.wm,i=t.name,r=t.spot;if(Cr(e,t,!1),r){var o=eo(r);if(0===o.length)n.widgetsType.addWidget(t);else{var a=o.find("button");t.buttonEnabled?a.removeAttr("disabled"):a.attr("disabled","")}}t.shouldDisplayBell()&&(n.shouldDisplayBell=!0),Vn("#concierge").show();var s=Vn("#concierge-tab");Yr(n)&&n.isMobile()&&n.shouldDisplayBell?s.show():n.shouldDisplayBell&&!Yr(n)?s.show():s.hide(),_e.log("wmStateAddWidget("+t.label()+"): complete OK"),Bn("widgetAdded",{widgetName:Qr(i),rule:{id:F(t,"parameters","rule","id"),name:F(t,"parameters","rule","name")}})}function Lr(e,t){t.parameters=t.parameters||{};var n=t.parameters,i=e.wm,r=t.engagementId;if(_e.log("wmStatePrepareToAddWidget called with:",n,r),n.proactive=n.proactive||!1,n.rule=n.rule||{},Gr(t)&&(t.priority=2),t.spot=hr(e,t),!wr(e,t))return A.resolve(zr);var o=t.label();_e.log("wmStatePrepareToAddWidget("+o+"): invoked.'");var a={status:!0,ref:t,parameters:n,proactive:n.proactive,engagementId:r,ruleSettings:i.concierge.rulesEngine.getSiteSettings()};return t.beforeAdd(a).then(oo(i,(function(e){return void 0!==t.prepareToLoad&&(t.prepareToLoadPromise=t.prepareToLoad(e).then((function(e){return e&&e.autoOpen?i.widgetsType.openConcierge(t):e}))),e})))}function Ar(e,t){return ke(e.active,t)>=0}function Wr(e,t){ke(e.alive,t)<0&&e.alive.push(t)}function Rr(e,t){var n=ke(e.alive,t);n>=0&&e.alive.splice(n,1)}function Pr(e,t){var n=e.wm.concierge.cacheManager.getClientCache("drag_position",!0);return n&&n.left&&n.top&&n.initialElemData&&n.initialConfigData&&(e.wm.isDragConfigDataEqualToCurrent(n.initialConfigData)?(e.wm.widgetAreaDragData.x=n.left,e.wm.widgetAreaDragData.y=n.top,e.wm.widgetAreaDragData.initialElemData=n.initialElemData,e.wm.widgetAreaDragData.draggedByUser=!0):e.wm.concierge.cacheManager.removeClientCache("drag_position",!0)),Ar(e,t)?A.resolve(null):(t.active=!0,e.active.push(t),Bn("widgetActivated",{widgetName:t.name}),Fr(e))}function jr(e,t){var n=ke(e.active,t);n>=0&&(t.active=!1,e.active.splice(n,1),Fr(e)),0===e.active.length&&e.wm.concierge.cacheManager.removeClientCache("drag_position",!0)}function Fr(e){var t=e.active.map((function(e){return{widgetName:e.name,loadParams:e.parameters}}));return e.wm.concierge.cacheManager.setClientCache("activeWidgets",t)}function Vr(e){return 9===e}function qr(e){return 13===e}function Jr(e){return 32===e}function Hr(e){return 38===e}function $r(e){return 40===e}var Br=["onafterprint","onbeforeprint","onbeforeunload","onerror","onhashchange","onload","onmessage","onoffline","ononline","onpagehide","onpageshow","onpopstate","onresize","onstorage","onunload","onblur","onchange","oncontextmenu","onfocus","oninput","oninvalid","onreset","onsearch","onselect","onsubmit","onkeydown","onkeypress","onkeyup","onclick","ondblclick","onmousedown","onmousemove","onmouseout","onmouseover","onmouseup","onmousewheel","onwheel","ondrag","ondragend","ondragenter","ondragleave","ondragover","ondragstart","ondrop","onscroll","oncopy","oncut","onpaste","onabort","oncanplay","oncanplaythrough","oncuechange","ondurationchange","onemptied","onended","onerror","onloadeddata","onloadedmetadata","onloadstart","onpause","onplay","onplaying","onprogress","onratechange","onseeked","onseeking","onstalled","onsuspend","ontimeupdate","onvolumechange","onwaiting","ontoggle"];function Ur(e){return"externalAPI"===e||"externalLink"===e}function Gr(e){return Ur(F(e,"parameters","rule","source"))}var zr={status:!1};function Kr(e){return"kbot"===e}function Xr(e){return function(e){return"chat"===e}(e)||Kr(e)}function Qr(e){return Kr(e)?"chat":e}function Yr(e){return!!e.engagementWidgets.globalSettings.singleChannelMode}function Zr(e,t){var n=gr(e,t.spot);return!n||(!n.widget||t!==n.widget&&(!Ar(e,n.widget)&&(!!t.parameters&&!!function(e,t){if(!e||!t)return!0;var n=e.parameters,i=t.parameters;if(!n||!i)return!1;if(e.name!==t.name)return!0;switch(e.name){case"chat":if(parseInt(n.portalId,10)!==parseInt(i.portalId,10))return!0;break;case"kb":if(parseInt(n.portalId,10)!==parseInt(i.portalId,10))return!0;if(""+n.searchText!=""+i.searchText)return!0;if(""+n.articleId!=""+i.articleId)return!0;break;case"email":if(parseInt(n.mailboxId,10)!==parseInt(i.mailboxId,10))return!0}return!1}(n.widget,t))))}function eo(e){return Vn('#concierge-widgets ul li[data-spot="'+e+'"]')}function to(e){if(void 0!==e){var t,n;try{t=e.width.animVal.value,n=e.height.animVal.value}catch(e){return!1}Rt(e,"viewBox")||Pt(e,"viewBox","0 0 "+t+" "+n),Pt(e,"height",25),Pt(e,"width",25)}}function no(e,t){var n=A.resolve(),i=e.wmState.open;if(!i)return n;var r=Vn("#concierge-widget-area");r.removeClass("con-open"),e.widgetsType.closeWidgets&&e.widgetsType.closeWidgets();var o=i.name;return e.$concierge.find("#concierge-widgets li[data-widget="+o+"] .con-icon").attr("aria-expanded","false"),"Tablet"===e.device&&(r.hasClass("con-animating")&&(n=n.then((function(){return r.promise()}))),n=n.then((function(){e.makePositionFixed(),e.forceBlur()}))),e.$concierge.removeClass("con-open-widget"),e.openWidget=!1,e.wmState.open=null,n.then((function(){if(e.widgetsType.focusWidgetButton(o),t)return Bn("widgetClosed",{widgetName:o})})).catch((function(e){_e.log("Error Closing Widget:"+e)}))}function io(e){var t;void 0===e&&(e="");try{t=(new DOMParser).parseFromString(e,"text/html")}catch(t){return _e.error("DomParser failed to parse:",e,"with error:",t),""}return ze(t.getElementsByTagName("*")).forEach((function(e){"SCRIPT"===e.nodeName?e.parentElement.removeChild(e):Br.forEach((function(t){e.removeAttribute(t)}))})),t.documentElement.outerHTML}function ro(e){var t="other";return 2===e?t="widgetMessage":1===e&&(t="proactiveOffer"),t}function oo(e,t){return function(n){return!e._disabled&&n&&n.status?t(n):n&&!n.status?n:zr}}function ao(e,t){var n=e.wmState,i=Vn("#concierge-widgets ul"),r=i.children("li");if(!(r.length<=1)){var o=t?1:-1;r.sort((function(e,t){var i=e.getAttribute("data-spot"),r=t.getAttribute("data-spot"),a=gr(n,i).widget.sortKey,s=gr(n,r).widget.sortKey;return a>s?1*o:a<s?-1*o:0})),r.detach().appendTo(i)}}function so(e,t,n,i,r){if(e&&parseInt(t,10)>n&&!i&&!r)throw new Error("queue wait time is too long");return!0}function co(e,t){var n=e.getDataClone("profileJSON"),i=n.session.visits.length-1,r=n.session.visits[i].journey.length-1;n.session.visits[i].journey[r].engagements||(n.session.visits[i].journey[r].engagements=[]),n.session.visits[i].journey[r].engagements.push(t),e.setData("profileJSON",JSON.stringify(n))}function uo(e,t,n){for(var i=e.getData("profileJSON"),r=i.session.visits[i.session.visits.length-1].journey,o=r.length-1,a=JSON.stringify(n),s=o;s>=0;s--){var c=r[s].engagements;if(c)for(var u=c.length-1;u>=0;u--){var l=c[u];if(l.id===t){if(JSON.stringify(l)===a)return A.resolve();if(n.dirty=!0,s===o)c[u]=n;else{c.splice(u,1),0===c.length&&delete r[s].engagements;var d=r[o];d.engagements?d.engagements.push(n):d.engagements=[n]}return e.setData("profileJSON",JSON.stringify(i))}}}return A.resolve()}function lo(e,t){for(var n=e.getDataObject("profileJSON"),i=n.session.visits.length-1,r=0;r<n.session.visits[i].journey.length;r++)if(n.session.visits[i].journey[r].engagements)for(var o=0;o<n.session.visits[i].journey[r].engagements.length;o++)if(n.session.visits[i].journey[r].engagements[o].id===t)return Pe(n.session.visits[i].journey[r].engagements[o]);return null}function go(e,t){t=t||{},this.concierge=e,this.isValid=this.validateParams(t),this.config=t}function ho(e,t){t&&(t.conciergeV2=this,e.isTestMode&&(this.root=e)),this.broadcast=ho.broadcast,this.transactionComplete=function(t){return e.ready.then((function(){var n,i,r,o;return n=e.cacheManager,(r=n.getDataClone("profileJSON")).last_updated=Date.now(),r.session.transaction_completed=!0,void 0!==t&&(r=Un(r,t,e),o=t.vendorTxnId),i=We(Re(r,1),1),e.contextMonitor.stop(),n.setData("profileJSON",JSON.stringify(r),!0).then((function(){return Bn("transactionCompleted",{transactionTotal:r.session.end_cart_value,cart:{value:i.current_cart_value,items:i.current_cart_items}}),oe(e,r.session.end_cart_value,o),e.contextMonitor.initTracking().then((function(){e.contextMonitor.start()}))}))}))},this.updateSession=function(t){return e.ready.then((function(){var n,i;return t=t||{},i=Un((n=e.cacheManager).getDataClone("profileJSON"),t,e),n.setData("profileJSON",JSON.stringify(i))}))},this.startEngagement=function(t){return e.ready.then((function(){var n=e.widgetManager;if(!t||"string"!=typeof t.widget)throw _e.log("GoMoxie.concierge.startEngagement: missing required configuration parameter"),new Error("GoMoxie.concierge.startEngagement: missing required configuration parameter");if(Gn(t.widget))return A.reject(new Error("The engagement type is not allowed: "+t.widget));if(!n.engagementWidgets.widgets[t.widget])throw _e.log('GoMoxie.concierge.startEngagement: invalid value for configuration parameter "widget"'),new Error('GoMoxie.concierge.startEngagement: invalid value for configuration parameter "widget"');if(!n.isValidEngagementConfig(t))throw _e.log("GoMoxie.concierge.startEngagement: invalid widget configuration"),new Error("GoMoxie.concierge.startEngagement: invalid widget configuration");return n.startExternal("externalAPI",t)}))},this.closeNotification=function(t){return e.ready.then((function(){var n=e.widgetManager;return t?kr(n.wmState):xr(n.wmState)}))},this.startTrackingEngagement=function(t){return e.ready.then((function(){new go(e,t).startEngagement()}))},this.updatePage=function(t,n){var i=null;return e.ready.catch((function(){return!1})).then((function(){return e.eventService.clearHistoryStub||(i=e.eventService),e.rulesEngine.removeAllEventListeners(),e.contextMonitor.stop(),e.cacheManager&&e.cacheManager.cleanup(),e.widgetManager.destroy(),null})).then((function(){return e.prepare(t,n,{eventService:i}),e.init()})).then((function(){return function(e){delete e._clearingHistoryPromise}(e),null}))},this.clearHistory=function(){var t=e.loadState;if("READY"!==t&&"LOADING"!==t)return A.reject(new Error("Invalid State: "+t+". Can only be invoked in READY or LOADING states."));function n(){return e.loadState="CLEARING",Si(e)}return e.loadState="CLEARING",("READY"===t?n():e.apiReady.then(n)).then((function(){return e.loadState="CLEARED",null}))};var n={},i=function(e){return e.status},r=function(e){return _e.log("checkAvailability error thrown: "+e.message),!1};this.checkAvailability=function(t,o){return e.ready.then((function(){if("chat"===t&&void 0===o.portalId)return e.rulesEngine.actionQueue.whenDone})).then((function(){var a={parameters:o},s=e.widgetManager,c="availability";if("chat"===t){if(void 0===o.portalId){var u=s.engagementWidgets.widgets.chat.portalId;if(void 0===u)throw new Error("No Moxie portal/mailbox ID specified for engagement.");a.parameters.portalId=u}a.ruleSettings=e.rulesEngine.getSiteSettings(),c+="|"+o.portalId+"|"+s.device}var l=s.engagementWidgets.widgets[t],d=Date.now(),g=n[c];return g&&g.timeout>d?g.value:(g={timeout:d+5e3,value:l.checkAvailability(a).then(i,r)},n[c]=g,g.value)}))},this.customData=function(t){return e.ready.then((function(){var n=e.cacheManager,i=n.getDataClone("profileJSON");if(void 0===i)throw new Error("Could not find visitor profile.");if(void 0===t)return i.customData;if(!JSON.stringify(t))throw new Error("Could not stringify customData");return i.customData=t,n.setData("profileJSON",JSON.stringify(i)).then((function(){return t}))}))},this.channelsData=function(t){return e.ready.then((function(){var n=e.cacheManager;return void 0===t?n.getVolatileData("moxie_channels_custom_data"):n.setVolatileData("moxie_channels_custom_data",t)}))},this.channelsFormData=function(t){return e.ready.then((function(){var n=e.cacheManager;return void 0===t?n.getVolatileData("moxie_channels_form_data"):n.setVolatileData("moxie_channels_form_data",t)}))},this.onQuestionnaireLoaded=function(t){e.onQuestionnaireLoadedCallbacks.add(t)},this.onQuestionnaireSubmit=function(t){e.onQuestionnaireSubmitCallbacks.add(t)}}function fo(){function e(e){return e.status}function t(e){return _e.log("checkAvailability error thrown: "+e.message),"false"}this.broadcast=fo.broadcast,this.transactionComplete=function(e,t){var n,i,r;return n=e.cacheManager,(r=n.getDataClone("profileJSON")).last_updated=Date.now(),r.session.transaction_completed=!0,void 0!==t&&(r=Un(r,t,e)),i=We(Re(r,1),1),e.contextMonitor.stop(),n.setData("profileJSON",JSON.stringify(r),!0).then((function(){return fo.broadcast("transactionCompleted",{transactionTotal:r.session.end_cart_value,cart:{value:i.current_cart_value,items:i.current_cart_items}}),oe(e,r.session.end_cart_value),Ce(e,"transactionComplete"),e.contextMonitor.initTracking().then((function(){e.contextMonitor.start()}))}))},this.updateSession=function(e,t){var n,i;t=t||{},i=Un((n=e.cacheManager).getDataClone("profileJSON"),t,e),n.setData("profileJSON",JSON.stringify(i))},this.startEngagement=function(e,t){var n,i,r={};if(i=e.widgetManager,t&&"string"==typeof t.widget){if(Gn(t.widget))throw new Error("The engagement type is not allowed: "+t.widget);if(i.engagementWidgets.widgets[t.widget]){if(i.isValidEngagementConfig(t)){for(n in Fe(t,"enableChatDeflection")&&!0===t.enableChatDeflection&&(t.widget="kbot"),t)Fe(t,n)&&(r[n]=t[n]);var o,a={name:t.ruleName,source:"externalAPI",id:-2,action:"success"};return r.rule=a,o=i.addWidget(t,a).then((function(e){!1!==i.openWidget&&i.openWidget!==t.widget&&i.hideWidget(!0),kr(i.wmState),i.showWidget(e.ref),i.showConcierge(),i.widgetsType.openConcierge()})),Ce(e,"startEngagement"),o}_e.log("GoMoxie.concierge.startEngagement: invalid widget configuration")}else _e.log('GoMoxie.concierge.startEngagement: invalid value for configuration parameter "widget"')}else _e.log("GoMoxie.concierge.startEngagement: missing required configuration parameter")},this.closeNotification=function(e,t){var n=e.widgetManager;return Ce(e,"closeNotification"),t?kr(n.wmState):xr(n.wmState)},this.startTrackingEngagement=function(e,t){new go(e,t).startEngagement(),Ce(e,"startTrackingEngagement")},this.updatePage=function(e,t,n){var i;return e.ready.catch((function(){return!1})).then((function(){return e.eventService.stub||(i=e.eventService),e.rulesEngine.removeAllEventListeners(),e.contextMonitor.stop(),e.cacheManager.cleanup(),e.widgetManager.destroy(),null})).then((function(){return Ce(e,"updatePage"),e.init(t,n,{eventService:i})}))},this.checkAvailability=function(n,i,r,o){var a,s,c,u,l,d,g,h,f,p,v;if(a={parameters:r},s=n.cacheManager,c=n.widgetManager,h=r.portalId,u="availability",l="availability-timestamp","chat"===i){if(void 0===h){if(void 0===(g=c.engagementWidgets.widgets.chat.portalId))return void _e.log("No Moxie portal/mailbox ID specified for engagement.");h=g,a.parameters.portalId=h}a.ruleSettings=n.rulesEngine.getSiteSettings(),u+="|"+h+"|"+c.device,l+="|"+h+"|"+c.device}return d=c.engagementWidgets.widgets[i],p=1e5,(f=s.getWidgetCache(i,l,!1))&&(p=(Date.now()-f)/1e3),v=f&&p<=5&&s.getWidgetCache(i,u,!1)?A.resolve(s.getWidgetCache(u)):d.checkAvailability(a).then(e,t).then((function(e){return A.all([s.setWidgetCache(i,u,e,!1),s.setWidgetCache(i,l,Date.now(),!1)]).then((function(){return e}))})),Ce(n,"checkAvailability"),v.then((function(e){return o(e),e}))},this.customData=function(e,t){var n,i;return i=(n=e.cacheManager).getDataClone("profileJSON"),void 0===t?void 0!==i?i.customData:void 0:JSON.stringify(t)?(i.customData=t,n.setData("profileJSON",JSON.stringify(i)),!0):(Ce(e,"customData"),!1)},this.channelsData=function(e,t){var n=e.cacheManager;if(void 0===t)return n.getVolatileData("moxie_channels_custom_data");try{n.setVolatileData("moxie_channels_custom_data",t)}catch(e){return _e.log("channelsData: "+e),!1}return Ce(e,"channelsData"),!0},this.channelsFormData=function(e,t){var n=e.cacheManager;if(void 0===t)return n.getVolatileData("moxie_channels_form_data");try{n.setVolatileData("moxie_channels_form_data",t)}catch(e){return _e.log("Error: "+e),!1}return Ce(e,"channelsFormData"),!0},this.onQuestionnaireLoaded=function(e,t){e.onQuestionnaireLoadedCallbacks.add(t)},this.onQuestionnaireSubmit=function(e,t){e.onQuestionnaireSubmitCallbacks.add(t)},this.registerMethods=function(e,t){void 0!==t&&void 0!==t.concierge&&(t.concierge.updateSession=this.updateSession.bind(void 0,e),t.concierge.transactionComplete=this.transactionComplete.bind(void 0,e),t.concierge.startEngagement=this.startEngagement.bind(void 0,e),t.concierge.checkAvailability=this.checkAvailability.bind(void 0,e),t.concierge.customData=this.customData.bind(void 0,e),t.concierge.closeNotification=this.closeNotification.bind(void 0,e),t.concierge.channelsData=this.channelsData.bind(void 0,e),t.concierge.channelsFormData=this.channelsFormData.bind(void 0,e),t.concierge.startTrackingEngagement=this.startTrackingEngagement.bind(void 0,e),t.concierge.onQuestionnaireLoaded=this.onQuestionnaireLoaded.bind(void 0,e),t.concierge.onQuestionnaireSubmit=this.onQuestionnaireSubmit.bind(void 0,e),t.concierge.updatePage=this.updatePage.bind(void 0,e),e.isTestMode&&(t.concierge.root=e))}}function po(e){return e.signature="moxie_concierge",e}go.prototype.startEngagement=function(){if(!this.isValid)return _e.log("GoMoxie.concierge.startTrackingEngagement: unable to start engagement that had an invalid configuration"),!1;var e=function(e){var t={chat:null,decision_type:"",email:null,id:ri(),kb:null,name:e.engagementType,proactive:!1,rule:{name:e.ruleName,source:"externalAPI",id:-2,ruleAction:"success"},time:Date.now(),type:2};for(var n in e)"engagementType"!==n&&"ruleName"!==n&&Fe(e,n)&&(t[n]=e[n]);return t}(this.config);return co(this.concierge.cacheManager,e),!0},go.prototype.validateParams=function(e){var t,n;for(t in n=!0,"object"==typeof e&&e.engagementType&&e.ruleName||(_e.log("GoMoxie.concierge.TrackingEngagement.validateParams: missing required configuration parameter"),n=!1),e)Fe(e,t)&&"string"!=typeof e[t]&&(_e.log("GoMoxie.concierge.TrackingEngagement.validateParams: invalid engagement parameter: "+t),n=!1);return n},ho.broadcast=Bn,fo.broadcast=Bn;var vo=[" ","\n","\t"];function mo(){this.outputRaw=[],this.outputSub=[],this.currentSub=null,this.state=1,this.compiled=[],this.actions=[]}function wo(e){var t=new mo;return t.compile(e),function(e){return t.evaluate(e)}}mo.prototype.compile=function(e){var t,n;for(t=0;t!==e.length;t++)switch(n=e[t],this.state){case 1:this.handleStateInput(n);break;case 2:this.handleStateOpen(n);break;case 4:this.handleStateSubOperator(n);break;case 3:this.handleStateSubInit(n);break;case 5:this.handleStateSub(n);break;case 6:this.handleStateSubFinal(n);break;case 7:this.handleStateClose(n)}var i=[],r=null;for(t=0;t!==this.outputRaw.length;t++)null===(n=this.outputRaw[t])?null!==r&&(i.push([r,t]),r=null):null===r&&(r=t);null!==r&&i.push([r,this.outputRaw.length]),this.outputSub.reduce((function(e,t){return null!==t&&e.push(t),e}),[]);var o=0;for(t=0;t!==i.length;t++){r=i[t][0];for(var a=i[t][1];o!==r;o++)this.actions.push(2),this.compiled.push(this.outputSub[o]);this.compiled.push(this.outputRaw.slice(r,a).join("")),o=a,this.actions.push(1)}this.outputRaw=null,this.outputSub=null},mo.prototype.evaluate=function(e){for(var t,n=[],i=0;i!==this.actions.length;i++){switch(this.actions[i]){case 1:n.push(this.compiled[i]);break;case 2:null!=(t=e[this.compiled[i]])&&n.push(t)}}return n.join("")},mo.prototype.handleStateInput=function(e){"<"===e?this.state=2:(this.outputRaw.push(e),this.outputSub.push(null))},mo.prototype.handleStateOpen=function(e){"%"===e?this.state=4:(this.outputRaw.push("<"),this.outputRaw.push(e),this.outputSub.push(null),this.outputSub.push(null),this.state=1)},mo.prototype.handleStateSubOperator=function(e){if("="!==e)throw new Error("Operator for the template must be '=', not '"+e+"'");this.state=3},mo.prototype.handleStateSubInit=function(e){-1===vo.indexOf(e)&&(this.currentSub=[e],this.state=5)},mo.prototype.handleStateSub=function(e){if(-1===vo.indexOf(e))return"%"===e?(this.finishSub(),void(this.state=7)):void this.currentSub.push(e);this.finishSub(),this.state=6},mo.prototype.finishSub=function(){this.outputSub.push(this.currentSub.join("")),this.outputRaw.push(null),this.currentSub=null},mo.prototype.handleStateSubFinal=function(e){if(-1===vo.indexOf(e)){if("%"!==e)throw new Error("Stray character '"+e+"' after substitution");this.state=7}},mo.prototype.handleStateClose=function(e){if(">"!==e)throw new Error("Invalid sequence '"+e+"' after closing percent sign");this.state=1};var yo=function(e){e.$notifAnimate&&(e.$notifAnimate.stop(!0,!0),delete e.$notifAnimate),e.$areaAnimate&&(e.$areaAnimate.stop(!0,!0),delete e.$areaAnimate)},bo=function(e){return 0===e.tabStyle.cascade},So=function(e,t){var n=t.index();if(n<0)return 0;bo(e)||(n=t.parent().children("li").length-(n+1));return n+1},Co=function(e,t,n){var i=e.widgetsType.getNotification(),r=t.children("ul").first(),o=r.height(),a=r.children("li").length,s={display:"block",height:o+65},c={opacity:1},u={opacity:0};if(bo(e)?(c.top=40,u.top=-(50*a-10),s.top=25):(c.bottom=-10,u.bottom=-(o+30),s.bottom=25),r.data("animating")?(r.stop(),i.stop()):(r.css(c),t.addClass("con-animating")),t.css(s),r.data("animating",!0).animate(u,{label:"desktopWidgetsClose",done:function(){t.removeAttr("style"),t.removeClass("con-animating"),r.removeAttr("style").data("animating",!1)}}),e.widgetsType.notificationDisplayed){yo(n);var l={};l[bo(e)?"top":"bottom"]=0,i.animate(l,{label:"desktopNotificationSlideClosed"})}},_o=function(e,t,n){var i=t.find(".con-notch"),r={},o=So(e,n);return r[bo(e)?"top":"bottom"]=function(e,t){return Yr(e)?13:65*t+13}(e,o),"tab-widgets-content"===e.state?(i.animate(r,{label:"adjustNotch"}),!1):(i.css(r),!0)},Eo=function(e){var t=e.$concierge;e.engagementWidgets.globalSettings.hideMoxieBranding&&t.addClass("hide-moxie")},Io=function(e,t){var n=e.$concierge.find("#concierge-widget-area");if(_o(e,n,t)){n.hasClass("con-animating")?n.stop():n.css({opacity:0,right:50,display:"inline-block"}),Eo(e);var i={opacity:1};void 0!==e.widgetAreaDragData.x&&void 0!==e.widgetAreaDragData.y?(n.addClass("free-floating"),i.left=e.widgetAreaDragData.x,i.top=e.widgetAreaDragData.y):i.right=75,n.addClass("con-animating").addClass("con-open").animate(i,{label:"desktopOpenArea",done:function(t,i){delete e.widgetsType.$areaAnimate,function(e,t){for(var n in t)qt(e,t[n])}(n[0],["display","opacity","right"]),n.removeClass("con-animating"),i||"object"!=typeof window.visualViewport||e.widgetsType.applyKeyboardOffset(),e.widgetAreaDragData&&e.widgetAreaDragData.draggedByUser&&e.widgetAreaDragData.resizedWhileMinimized&&e.dragFixAfterResize()}})}e.state="tab-widgets-content",e.widgetsType.$areaAnimate=n},No=function(e,t){"object"==typeof window.visualViewport&&e.widgetsType.resetKeyboardOffset();var n=e.$concierge.find("#concierge-widget-area");"tab-widgets-content"===e.state&&(n.hasClass("con-animating")?n.stop():n.css({opacity:1,right:75,display:"block"}),t.css({display:"block"}),n.addClass("con-animating").removeClass("con-open").animate({opacity:0,right:50,display:"none"},{label:"desktopCloseArea",done:function(){delete e.widgetsType.$areaAnimate,n.removeAttr("style"),n.removeClass("con-animating"),t.removeAttr("style")}}),e.state="tab-widgets",e.widgetsType.$areaAnimate=n)},Oo=function(e){var t=e.$concierge.find("#concierge-widgets"),n=e.$concierge.find("#concierge-tab");"tab"===e.state?(e.$concierge.addClass("with-widgets").removeClass("con-closed"),n.addClass("con-pressed"),n.attr("aria-expanded","true"),e.state="tab-widgets",function(e,t,n){var i=e.widgetsType.getNotification(),r=t.children("ul").first(),o=r.height(),a=r.children("li").length,s={height:o+50+15},c={opacity:0},u={opacity:1};if(bo(e)?(c.top=-(50*a-10),u.top=40,s.top=25):(c.bottom=-(o+30),u.bottom=-10,s.bottom=25),r.data("animating")?(r.stop(),i.stop()):(r.css(c),t.css(s),t.addClass("con-animating")),r.data("animating",!0).animate(u,{label:"desktopWidgetsOpen",done:function(){t.removeAttr("style"),t.removeClass("con-animating"),r.removeAttr("style").data("animating",!1)}}),mr(e.wmState)){var l={},d=eo(e.wmState.notification.spot),g=65*So(e,d);1===d.length&&(l[bo(e)?"top":"bottom"]=g),i.animate(l,{label:"desktopNotificationSlideOpen",done:function(){delete n.$notifAnimate}}),n.$notifAnimate=i}}(e,t,this)):"tab-widgets-content"===e.state?(e.$concierge.find("#concierge-widget-area").removeClass("con-open"),n.removeClass("con-pressed"),n.attr("aria-expanded","false"),e.$concierge.removeClass("with-widgets"),To(e),e.state="tab",Co(e,t,this),e.$concierge.addClass("con-closed")):(n.removeClass("con-pressed"),n.attr("aria-expanded","false"),e.$concierge.removeClass("with-widgets"),e.state="tab",Co(e,t,this),e.$concierge.addClass("con-closed"))},To=function(e){var t=e.$concierge.find("#concierge-widgets li.con-active");t.removeClass("con-active").removeClass("con-pressed"),t.find(".con-notch").remove(),t.find(".con-icon").attr("aria-expanded","false");var n=e.$concierge.find("#concierge-widget-area .concierge-widget.con-active"),i=A.resolve(null);return e.openWidget&&(i=i.then((function(){return e.hideWidget(!1)}))),i.then((function(){return No(e,n)}))},ko=function(e,t){var n=t.parameters,i=t.engagementId,r=eo(t.spot);if(r.hasClass("con-active"))return e.openWidget&&e.openWidget!==t.name?e.hideWidget(!1):A.resolve(null);r.addClass("con-active").addClass("con-pressed"),r.find(".con-icon").attr("aria-expanded","true");var o=n.rule.source;return i&&"offer"!==o&&"notification"!==o&&"button"!==o&&(n.rule.source="internal"),t.execute(e)},xo=function(){var e=Vn(this);e.addClass("con-pressed"),e.data("pressing",1),"concierge-tab"===e.attr("id")&&e.attr("aria-expanded","true"),e.find(".con-icon")&&e.find(".con-icon").attr("aria-expanded","true")},Do=function(){var e=Vn(this);1===e.data("pressing")&&(e.data("pressing",0),e.removeClass("con-pressed"),e.find(".con-icon")&&e.find(".con-icon").attr("aria-expanded","false"),"concierge-tab"===e.attr("id")&&e.attr("aria-expanded","false"))},Mo=function(){return'<div id="concierge" class="con-right con-closed<%= CON_CLOSED %>">\n <button id="concierge-tab" type="button" aria-label="<%= CONCIERGE %>" aria-expanded="false" aria-haspopup="true">\n <%= CONCIERGE_TAB_ICON_SVG %>\n </button>\n <div id="concierge-widgets"><ul id="concierge-widgets-ul"<%= CON_ROLE_ATTRIBUTE %>></ul></div>\n <div id="concierge-widget-area" tabindex="0" role="dialog" aria-live="assertive" aria-label=""><div class="con-notch"><div class="con-notch-inner"></div></div></div>\n\n <div id="con-notification" class="con-inactive" role="alert" aria-live="assertive">\n \x3c!--\n CON-5221: Don\'t include (causes JAWS and NVDA to read twice):\n aria-labelledby="con-notification-title" aria-describedby="con-notification-body"\n --\x3e\n <div class="con-notch"><div class="con-notch-inner"></div></div>\n <h2 id="con-notification-title" class="concierge-notification-title" aria-hidden="true" tabindex="0">Live Chat</h2>\n <div class="con-notification-content">\n <div class="con-notification-icon" aria-live="off" aria-hidden="true"></div>\n <div id="con-notification-body" aria-hidden="true">\n \x3c!--\n CON-5221: Don\'t include (causes JAWS to skip reading):\n aria-live="polite" aria-atomic="true"\n --\x3e\n <div class="con-notification-body" tabindex="0"></div>\n <div class="con-notification-helptext"><%=NOTIFICATION_ANNOUNCE%></div>\n </div>\n <div class="con-notification-calltoaction" role="link" tabindex="0"></div>\n </div>\n <button class="con-x" aria-label="<%= CLOSE_ICON %>">\n <svg focusable="false" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" enable-background="new 0 0 20 20" stroke-width="0">\n <title><%= CLOSE_ICON %></title>\n <polygon points="17.3,1.1 10.2,8.3 3.1,1.1 1.3,2.9 8.4,10 1.3,17.1 3.1,18.9 10.2,11.8 17.3,18.9 19.1,17.1 11.9,10 19.1,2.9 "/>\n </svg>\n </button>\n </div>\n</div>\n'};function Lo(e){this.html=Mo,this.cssType="desktop",this.notificationDisplayed=!1,this.visualViewportHasScroll=!1,this.visualViewportHasResize=!1;var t=this;this.start=function(){var n=e.$concierge.find("#concierge-tab"),o=e.$concierge.find("#concierge-widgets");n.on("mousedown",xo),n.onPassive("touchstart",xo),n.on("mouseleave",Do);var a=function(i){("click"===i.type||qr(i.which))&&("click"===i.type&&n.removeClass("highlight"),Vn(this).removeClass("con-pressed").data("pressing",0).attr("aria-expanded","false"),he(e.concierge,!1),Bn("bellClicked",{}),t.toggleWindow())};n.on("click",a),n.on("keypress",a),n.on("keyup",(function(e){Vr(e.which)?Vn(this).addClass("highlight"):Hr(e.which)?i(Vn(this)):$r(e.which)&&r(Vn(this))})),n.on("blur",(function(){Vn(this).removeClass("highlight")})),nn(o,"mousedown",an("li"),xo),nn(o,"touchstart",an("li"),xo,!0),nn(o,"mouseleave",an("li"),Do);var s=function(t){("click"===t.type||qr(t.which))&&(Vn(this).removeClass("con-pressed").data("pressing",0),Vn(this).find(".con-icon").attr("aria-expanded","false"),zn((function(){return function(e,t){var n=Vn(t.target).closest("li"),i=n.data("spot"),r=Sr(e.wmState,i);if(r){if(r.buttonEnabled){var o=r.name,a=Qr(o),s=r.parameters;return n.removeClass("highlight"),(s=s||{}).rule=s.rule||{},s.rule.source="button",zn((function(){return n.hasClass("con-active")?e.hideWidget(!1):ko(e,r)})).then((function(){return he(e.concierge,!0,o),Bn("buttonClicked",{buttonName:a}),null}))}}else _e.log("DesktopWidgets: widgetsClicked: could not find widget for spot, "+i)}(e,t)})).catch((function(e){_e.log((e.stack,e.stack))})))};nn(o,"click",an("li"),s),nn(o,"keypress",an("li"),s);var c=function(n){if("click"===n.type||qr(n.which)||Jr(n.which)){var i=Vn(n.target);if(i.hasClass("con-x")||i.closest(".con-x").length>0)kr(e.wmState);else{var r=e.wmState.notification;Tr(e.wmState),r&&r.shouldDisplayBell()&&e.$concierge.hasClass("con-closed")&&(t.toggleWindow(),e.state="tab-widgets")}}};e.$concierge.find("#con-notification").on("click",c).on("keypress",c)},this.toggleWindow=function(){Oo.call(this,e)},this.focusWidgetButton=function(t){e.$concierge.find("#concierge-widgets li[data-widget="+t+"] .con-icon").focus()};function n(e,t,n){if(mr(e.wmState)){n=n||{};var i=0,r=e.wmState.notification,o=eo(r.spot);o.length>0&&!Yr(e)&&e.$concierge.hasClass("with-widgets")&&(i=65*So(e,o)),n[bo(e)?"top":"bottom"]=i,t.css(n);var a=!0;if(r.spot){var s=gr(e.wmState,r.spot);s.widget&&s.widget.preferredSpotName()===r.preferredSpotName()&&(a=!1)}a?function(e){e.addClass("free-floating")}(t):function(e){e.removeClass("free-floating")}(t)}}this.makeWidgetActive=function(e){e.addClass("con-active")},this.makeWidgetInactive=function(e){e.removeClass("con-active")},this.openWidget=function(t){var n=t.name,i=e.$concierge.find("#concierge-widget-area");!function(e,t){var n={kb:"K B Engagement Widget",chat:"Live Chat",kbot:"Live Chat",email:"Email Engagement Widget"}[e]||"";t.attr("aria-label",n)}(n,i);var r=e.widgetAreaForWidget(n),o=i.children(".concierge-widget.con-active").not(r);function a(){Vn(this).removeAttr("style")}this.makeWidgetInactive(o),this.makeWidgetActive(r),e.$concierge.find("#concierge-widgets li.con-active").removeClass("con-active").removeClass("con-pressed"),e.$concierge.find("#concierge-widgets li.con-active .con-icon").attr("aria-expanded","false"),"Tablet"===e.device&&r.find("iframe.widget-content").css({overflow:"auto"});var s=e.$concierge.find("#concierge-widgets li[data-widget="+n+"]");s.addClass("con-active").addClass("con-pressed"),s.find(".con-icon").attr("aria-expanded","true"),"tab-widgets-content"===e.state&&o.length>0&&(_e.log("openWidget(): invoked and willHide sent to already opened widget -"+o.data("widget")),Eo(e),e.postMessageToWidget(o.data("widget"),"willHide"),r.css({opacity:.3}).animate({opacity:1},{label:"desktopOpenWidget",done:a}),o.css({display:"block",position:"absolute",top:2,height:"calc(100% - 4px)",width:"100%","padding-right":"4px",opacity:1,"z-index":100}).animate({opacity:0},{label:"desktopCloseWidget",done:a})),Io(e,s)},this.closeWidgets=function(){e.$concierge.find("#concierge-widgets li.con-active").removeClass("con-active").removeClass("con-pressed"),e.$concierge.find("#concierge-widgets li.con-active .con-icon").attr("aria-expanded","false");var t=e.$concierge.find("#concierge-widget-area .concierge-widget.con-active");this.makeWidgetInactive(t),t.removeAttr("style"),No(e,t),e.$concierge.find("#concierge-widget-area").removeClass("con-open"),e.state="tab"},this.getNotification=function(){return e.$concierge.find("#con-notification")},this.getNotificationBody=function(){return e.$concierge.find("#con-notification-body")},this.getNotificationTitle=function(){return e.$concierge.find("#con-notification-title")},this.setAriaHidden=function(e){this.getNotificationBody().attr("aria-hidden",e),this.getNotificationTitle().attr("aria-hidden",e)},this.canDisplayNotification=function(){return!this.notificationDisplayed&&!e.$concierge.hasClass("con-open-widget")},this.maybeHandleOffset=function(){var t;0===e.tabStyle.verticalAnchor?t=window.visualViewport.offsetTop:(t=0,Ye()&&(t=window.visualViewport.height-Xe()+window.visualViewport.offsetTop,t=Math.min(t,0))),this.conciergePrevOffset!==t&&(this.conciergePrevOffset=t,this.conElem.style.transform="translateY("+t+"px) scale("+1/window.visualViewport.scale+")",e.dragResizeHandler())},this.viewportHandler=function(e){this.conElem&&this.maybeHandleOffset()},this.applyKeyboardOffset=function(){this.conElem=gt("concierge"),window.visualViewport&&(this.visualViewportHasScroll||(this.visualViewportHasScroll=!0,Yt(window.visualViewport,"scroll",this.viewportHandler.bind(this))),this.visualViewportHasResize||(this.visualViewportHasResize=!0,Yt(window.visualViewport,"resize",this.viewportHandler.bind(this))))},this.resetKeyboardOffset=function(){this.conElem=null,window.visualViewport&&(this.visualViewportHasScroll&&(this.visualViewportHasScroll=!1,en(window.visualViewport,"scroll",this.viewportHandler.bind(this))),this.visualViewportHasResize&&(this.visualViewportHasResize=!1,en(window.visualViewport,"resize",this.viewportHandler.bind(this))))},this.updateNotification=function(){var t=this.getNotification();n(e,t,{})},this.displayNotification=function(){var t=this;this.notificationDisplayed=!0;var i=this.getNotification();i.addClass("con-active").removeClass("con-inactive"),this.setAriaHidden("false"),i.removeAttr("style");n(e,i,{opacity:0}),i.animate({opacity:1},{label:"desktopShowNotification",done:function(e,n){delete t.$notifAnimate,n||"object"!=typeof window.visualViewport||t.applyKeyboardOffset()}}),t.$notifAnimate=i},this.closeNotification=function(){"object"==typeof window.visualViewport&&this.resetKeyboardOffset();var e=this;this.notificationDisplayed=!1;var t=this.getNotification();t&&(t.animate({opacity:0},{label:"desktopHideNotification",done:function(){delete e.$notifAnimate,t.addClass("con-inactive").removeClass("con-active").removeAttr("style"),e.setAriaHidden("true")}}),e.$notifAnimate=t)},this.openConcierge=function(t){"tab-widgets-content"!==e.state&&(e.state="tab-widgets");var n=e.$concierge.find("#concierge-widgets");e.$concierge.addClass("with-widgets").removeClass("con-closed");var i=e.$concierge.find("#concierge-tab");if(i.addClass("con-pressed"),i.attr("aria-expanded","true"),n.addClass("con-visible"),t)return ko(e,t)};var i=function(t){if(!Yr(e)){var n=null;1===(n="concierge-tab"===t.attr("id")?Vn("#concierge-widgets-ul li").last():t.prev()).length?(n.find(".con-icon").focus(),n.addClass("highlight")):Vn("#concierge-tab").focus().addClass("highlight")}},r=function(t){if(!Yr(e)){var n=null;1===(n="concierge-tab"===t.attr("id")?Vn("#concierge-widgets-ul li").first():t.next()).length?(n.find(".con-icon").focus(),n.addClass("highlight")):Vn("#concierge-tab").focus().addClass("highlight")}};this.createWidgetElement=function(t){var n=Yr(e)?"":' role="menuitem"',o=e.concierge.getTranslation(Qr(t.name),"title"),a="";t.buttonEnabled||(a="disabled");var s=Vn('<li data-spot="'+t.spot+'" data-widget="'+t.name+'"'+n+'><button type="button" aria-expanded="false" class="con-icon" '+a+' aria-label="'+o+'">'+t.icon.svg+"</button></li>"),c=s.find("svg");c.length>0&&to(c[0]);var u=s.find(".con-icon");return u.on("keyup",(function(e){Vr(e.which)?s.addClass("highlight"):Hr(e.which)?i(s):$r(e.which)&&r(s)})),u.on("blur",(function(){s.removeClass("highlight")})),s},this.updateWidgetElement=function(t){var n=eo(t.spot);if(n.length>0){n.attr("data-widget",t.name);var i=e.concierge.getTranslation(Qr(t.name),"title"),r=n.find("button");r.attr("aria-label",i),r.html(t.icon.svg);var o=n.find("svg");o.length>0&&to(o[0])}},this.addWidget=function(t){_e.log("DesktopWidgets: addWidget:",t.name,t);var i=Vn("#concierge-widgets ul"),r=this.createWidgetElement(t);return i.append(r[0]),ao(e,bo(e)),n(e,this.getNotification()),Yr(e)&&e.$concierge.removeClass("con-closed"),r};var o=function(t){var n={right:e.tabStyle.horizontalOffset,bottom:""},i=window.pageYOffset;0===e.tabStyle.verticalAnchor?n.top=e.tabStyle.verticalOffset+i:n.top=i+Xe()-(e.tabStyle.verticalOffset+50),t.css(n)},a=function(t){var n={right:e.tabStyle.horizontalOffset};0===e.tabStyle.verticalAnchor?n.top=e.tabStyle.verticalOffset:n.bottom=e.tabStyle.verticalOffset,t.css(n)};this.fixPosition=function(e,t){"javascript"===e?(t.addClass("position-method-javascript"),_e.log("Concierge Client: PositionMethod - Javascript"),this.scrollHandler||(this.scrollHandler=function(){o(t)},Yt(window,"scroll",this.scrollHandler)),o(t)):a(t)},this.beforeAppend=function(t){var n=[],i={right:e.tabStyle.horizontalOffset};a(t),bo(e)?n.push("con-top"):n.push("con-bottom"),t.addClass(n.join(" ")),t.css(i)},this.destroy=function(){yo(this),this.scrollHandler&&en(window,"scroll",this.scrollHandler),Vn("#concierge-style-desktop").remove(),this.resetKeyboardOffset()}}function Ao(e){this.html=function(){return'<div id="concierge" class="con-right con-closed /DEVICE/">\n <div id="concierge-backdrop"></div>\n <button id="concierge-tab" type="button" aria-label="<%= CONCIERGE %>" aria-expanded="false">\n <%= CONCIERGE_TAB_ICON_SVG %>\n </button>\n <div id="concierge-widgets">\n <div class="con-widgets"><ul id="concierge-widgets-ul"<%= CON_ROLE_ATTRIBUTE %>></ul></div>\n <div class="con-notch con-notch1"></div>\n <div class="con-notch con-notch2"></div>\n </div>\n <div id="concierge-widget-area" role="dialog" aria-live="assertive" aria-label=""></div>\n\n <div id="con-notification" role="alert" aria-live="assertive" class="con-inactive">\n \x3c!--\n CON-5221: Don\'t include (causes JAWS and NVDA to read twice):\n aria-labelledby=" con-notification-title" aria-describedby="con-notification-body"\n --\x3e\n <h2 id="con-notification-title" class="concierge-notification-title" aria-hidden="true" tabindex="0">Notification</h2>\n <div class="con-notification-content">\n <div class="con-notification-icon" aria-live="off" aria-hidden="true"></div>\n <div id="con-notification-body" class="con-notification-body" tabindex="0" aria-hidden="true"></div>\n \x3c!--\n CON-5221: Don\'t include (causes JAWS to skip reading):\n aria-live="polite" aria-atomic="true"\n --\x3e\n <div class="con-notification-calltoaction" role="link" tabindex="0"></div>\n </div>\n <button class="con-x" aria-label="<%= CLOSE_ICON %>">\n <svg focusable="false" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" enable-background="new 0 0 20 20" stroke-width="0">\n <title><%= CLOSE_ICON %></title>\n <polygon points="17.3,1.1 10.2,8.3 3.1,1.1 1.3,2.9 8.4,10 1.3,17.1 3.1,18.9 10.2,11.8 17.3,18.9 19.1,17.1 11.9,10 19.1,2.9 "/>\n </svg>\n </button>\n </div>\n</div>\n'},this.cssType="mobile",this.openWidgetCount=0,this.bodyOrigStyle="",this.bodyOrigClasses="",this.htmlOrigStyle="",this.htmlOrigClasses="",this.start=function(){var t=this;navigator.userAgent.match(/instagram/i)&&navigator.userAgent.match(/iphone/i)&&(e.$concierge.addClass("instagram"),e.$concierge.find("#concierge-widget-area").css("height",window.innerHeight+"px")),e.$concierge.find("#concierge-tab").onPassive("touchstart",(function(){Vn(this).addClass("con-pressed").attr("aria-expanded","true"),function(e){var t=e.$concierge.find("#concierge-widgets");if(Wo(e,t),Yr(e)){var n=gr(e.wmState,"single").widget;_e.log("widget "+n.name+" clicked");var i=Qr(n.name);he(e.concierge,!0,n.name),Bn("buttonClicked",{buttonName:i}),n.parameters.rule.source="button",n.execute(e)}else!function(e){e.$concierge.hasClass("con-open")||!e.shouldDisplayBell?Ro(e):function(e){var t=e.$concierge.find("#concierge-widgets");e.$concierge.find("#concierge-tab").attr("aria-expanded","true"),Wo(e,t),t.data("animation","opening"),e.$concierge.removeClass("con-pressed").removeClass("con-closed");var n=t.attr("style");t.removeAttr("style");var i=t.height();void 0===n||!1===n?t.css({overflow:"hidden",opacity:0,height:0}):t.attr("style",n);t.animate({height:i,opacity:1},{label:"mobileOpenMenu",done:function(){t.data("animation",!1),t.removeAttr("style"),e.$concierge.addClass("con-open")}})}(e)}(e)}(e)})).on("touchend",(function(){Vn(this).removeClass("con-pressed")})),e.$concierge.onPassive("touchstart",".con-widgets li",(function(){Vn(this).addClass("con-pressed"),Vn(this).find(".con-icon").attr("aria-expanded","true")})).on("touchend",".con-widgets li",(function(){var t=Vn(this);t.removeClass("con-pressed"),t.find(".con-icon");var n=t.data("spot"),i=Sr(e.wmState,n);if(i){var r=i.name;return i.parameters.rule.source="button",_e.log("widget "+r+" clicked"),i.execute(e).then((function(){return he(e.concierge,!0,r),Bn("buttonClicked",{buttonName:Qr(r)}),!1}))}_e.log("MobileWidgets: widgetsClicked: could not find widget for spot, "+n)})),e.$concierge.find("#concierge-backdrop").on("click",(function(){xr(e.wmState),Ro(e)}));var n=function(t){if("click"===t.type||qr(t.which)||Jr(t.which)){var n=Vn(t.target);n.hasClass("con-x")||n.closest(".con-x").length>0?kr(e.wmState):Tr(e.wmState)}};e.$concierge.find("#con-notification").on("click",n),e.$concierge.find("#con-notification").on("keypress",n);var i=!1;this.orientationListener=function(){if(t.notificationDisplayed){var e=t.getNotification();i&&clearTimeout(i),i=setTimeout((function(){i=!1,e.css({width:Qe()})}),500)}},window.addEventListener("orientationchange",this.orientationListener)},this.focusWidgetButton=function(t){Yr(e)?e.$concierge.find("#concierge-tab").focus():e.$concierge.find("#concierge-widgets li[data-widget="+t+"]").focus()};this.addScrollFix=function(){var e=Vn("html");this.htmlOrigStyle=e.attr("style"),this.htmlOrigClasses=e.attr("class"),e.attr("style",""),e.attr("class",""),e.addClass("concierge-modal-displayed");var t=Vn("body");this.bodyOrigStyle=t.attr("style"),this.bodyOrigClasses=t.attr("class"),t.attr("style",""),t.attr("class",""),t.addClass("concierge-modal-displayed"),this.scrollFixApplied=!0},this.removeScrollFix=function(){if(this.scrollFixApplied){var e=Vn("html");e.removeClass("concierge-modal-displayed"),e.attr("style",this.htmlOrigStyle),delete this.htmlOrigStyle,e.attr("class",this.htmlOrigClasses),delete this.htmlOrigClasses;var t=Vn("body");t.removeClass("concierge-modal-displayed"),t.attr("style",this.bodyOrigStyle),delete this.bodyStyleRemoved,t.attr("class",this.bodyOrigClasses),delete this.bodyOrigClasses,Vn("#concierge-widget-area").css({top:""}),delete this.scrollFixApplied}},this.makeWidgetActive=function(e){e.length>0&&(0===this.openWidgetCount&&this.addScrollFix(),e.addClass("con-active"),this.openWidgetCount+=e.length)},this.makeWidgetInactive=function(e){e.length>0&&(e.removeClass("con-active"),this.openWidgetCount-=e.length,0===this.openWidgetCount&&this.removeScrollFix())};this.openWidget=function(t){var n=t.name;!function(e,t){var n={kb:"K B Engagement Widget",chat:"Live Chat",kbot:"Live Chat",email:"Email Engagement Widget"}[e]||"";t.attr("aria-label",n)}(n,e.$concierge.find("#concierge-widget-area"));var i=e.widgetAreaForWidget(n),r=e.$concierge.find("#concierge-widget-area .concierge-widget.con-active").not(i),o=this;this.makeWidgetActive(i),this.$widgetAnimating=i,function(e){var t=e.$concierge;e.engagementWidgets.globalSettings.hideMoxieBranding&&t.addClass("hide-moxie")}(e),i.attr("aria-expanded","true"),i.css({"z-index":1,opacity:0}).animate({opacity:1},{label:"mobileOpenWidget",done:function(){delete o.$widgetAnimating,o.makeWidgetInactive(r),r.attr("aria-expanded","false"),i.removeAttr("style")}}),Ro(e)},this.closeWidgets=function(){var t=e.$concierge.find("#concierge-widget-area .concierge-widget.con-active"),n=this;t.css({opacity:1}).animate({opacity:0},{label:"mobileCloseWidgets",done:function(){_e.log("close complete"),n.makeWidgetInactive(t),t.removeAttr("style").attr("aria-expanded","false")}})},this.getNotification=function(){return e.$concierge.find("#con-notification")},this.getNotificationBody=function(){return e.$concierge.find("#con-notification-body")},this.getNotificationTitle=function(){return e.$concierge.find("#con-notification-title")},this.setAriaHidden=function(e){this.getNotificationBody().attr("aria-hidden",e),this.getNotificationTitle().attr("aria-hidden",e)},this.canDisplayNotification=function(){return!this.notificationDisplayed&&!e.$concierge.hasClass("con-open-widget")},this.fixPosition=function(e,t){if("javascript"===e){t.addClass("position-method-javascript"),_e.log("Concierge Client: PositionMethod - Javascript");var n=function(){var e=Xe();t.css({top:e})};window.addEventListener("scroll",n),n()}};var t=!1,n=this;this.fixNotificationsUsingVisualViewport=function(){var e=gt("con-notification");e&&(t=!1,e.style.transform="translateY("+window.visualViewport.offsetTop+"px) scale("+1/window.visualViewport.scale+")")},this.viewportHandler=function(){t||(t=!0,Rn(n.fixNotificationsUsingVisualViewport,"mobileNotifScrollFix"))},this.applyNotificationKeyboardOffset=function(){window.visualViewport.addEventListener("scroll",this.viewportHandler),window.visualViewport.addEventListener("resize",this.viewportHandler),this.viewportHandler()},this.resetNotificationKeyboardOffset=function(){window.visualViewport.removeEventListener("scroll",this.viewportHandler),window.visualViewport.removeEventListener("resize",this.viewportHandler)},this.updateNotification=function(){},this.displayNotification=function(t){var n=this;this.notificationDisplayed=!0,_e.log("opening notification.");var i=this.getNotification();i.data("parameters",t.parameters),i.addClass("con-active").removeClass("con-inactive"),this.setAriaHidden("false");var r="0px";e.engagementWidgets.globalSettings.notificationMobileVerticalOffset&&(r=e.engagementWidgets.globalSettings.notificationMobileVerticalOffset.toString()+"px"),n.$notifAnimating=i,i.css({top:"-150px"}).animate({top:r},{label:"mobileShowNotification",done:function(){n.$notifAnimating=!1;var e=Qe();i.css({width:e}),"object"==typeof window.visualViewport&&n.applyNotificationKeyboardOffset()}})},this.closeNotification=function(){"object"==typeof window.visualViewport&&this.resetNotificationKeyboardOffset();var e=this;this.notificationDisplayed=!1;var t=this.getNotification();t&&t.animate({opacity:0},{label:"mobileHideNotification",done:function(){t.addClass("con-inactive").removeClass("con-active").removeAttr("style"),e.setAriaHidden("true")}})},this.openConcierge=function(){},this.destroy=function(){this.$notifAnimating&&(this.$notifAnimating.stop(!0,!0),delete this.$notifAnimating),this.$widgetAnimating&&(this.$widgetAnimating.stop(!0,!0),delete this.$widgetAnimating),this.orientationListener&&(window.removeEventListener("orientationchange",this.orientationListener),delete this.orientationListener),this.removeScrollFix(),Vn("#concierge-style-mobile").remove()},this.createWidgetElement=function(t){var n=Yr(e)?"":' role="menuitem"',i=e.concierge.getTranslation(Qr(t.name),"title");return Vn('<li data-spot="'+t.spot+'" data-widget="'+t.name+'"'+n+'><button type="button" aria-expanded="false" class="con-icon" aria-label="'+i+'">'+t.icon.svg+'</button><span class="con-mobile-primary-menu">'+i+"</span></li>")},this.updateWidgetElement=function(t){var n=eo(t.spot),i=n.find("button");if(Yr(e)){var r=Vn("#concierge-tab");i.pushAll(r),n.pushAll(r)}n.attr("data-widget",t.name),n.attr("data-spot",t.spot);var o=e.concierge.getTranslation(Qr(t.name),"title");n.find(".con-mobile-primary-menu").text(o),i.attr("aria-label",o),i.html(t.icon.svg);var a=i.find("svg");a.length>0&&to(a[0])},this.addWidget=function(t){_e.log("MobileWidgets: addWidget:",t.name,t);var n=Vn("#concierge-widgets ul"),i=this.createWidgetElement(t);if(n.append(i[0]),ao(e,!0),Yr(e)){var r=Vn("#concierge-tab");return r.html(t.icon.svg),r.attr("data-widget",t.name),r.attr("data-spot",t.spot),r}return i}}function Wo(e,t){var n=t.data("animation");return n&&("opening"===n?(t.stop(),e.$concierge.addClass("con-open")):"closing"===n&&t.stop(),t.data("animation",!1)),n}function Ro(e){var t=e.$concierge.find("#concierge-widgets");(e.$concierge.find("#concierge-tab").attr("aria-expanded","false"),e.$concierge.hasClass("con-closed"))||"closing"!==t.data("animation")&&(Wo(e,t),t.data("animation","closing"),e.$concierge.removeClass("con-pressed").removeClass("con-open"),t.css({overflow:"hidden"}),t.animate({opacity:0,height:0},{label:"mobileCloseMenu",done:function(){t.data("animation",!1),t.removeAttr("style"),e.$concierge.addClass("con-closed")}}))}function Po(){}Po.prototype.markChat=function(e,t,n){var i=Date.now();return e.transient_data?(e.transient_data.vp_data.chat.session_id=Math.abs(parseInt(t)),"start"===n&&(e.transient_data.vp_data.chat.start_time=i),"end"===n&&(e.transient_data.vp_data.chat.end_time=i)):e.transient_data={vp_data:{chat:{session_id:t,start_time:i}}},_e.log("Marking chat "+t+" as "+n),e};var jo=function(e,t){cn(this,t),this.parameters=this.parameters||{},this.configuration=this.configuration||{},this.configuration.connectorUrl=e.serviceUrl.connector,function(e,t){var n=t.widgetManager;e.priority=1,e.state=0,e.buttonEnabled=!0,e.preferredSpotName=function(){return this.name},e.getSpotName=function(){return this.spot},e.label=function(){var e=F(this,"parameters","rule","name");return e?this.name+":"+e:this.name},e.checkAvailability=function(){return A.resolve({status:!0})},e.shouldDisplayBell=function(){return!0},e.beforeNotify=function(e){return A.resolve(Fo(e,!0))},e.beforeAdd=function(e){return A.resolve(Fo(e,!0))},e.beforeLoad=function(){},e.getRemoteURL=function(){if(this.remoteURL)return this.remoteURL},e.hideWidget=function(){n.wmState.open===this&&n.hideWidget(!1)},e.closeWidget=function(){if(this.spot){var e=gr(n.wmState,this.spot);this.hasFinished=!0,e.widget===this&&e.reactive&&e.reactive!==this&&br(n.wmState,e.reactive)}},e.destroy=function(e){},e.unload=function(){0!==this.state&&(n.widgetAreaForWidget(this.name).remove(),this.state=0)},e.execute=function(e){var t=this;return e.concierge.cacheManager.removeWidgetCache(this.name,"widget-closed").then((function(){e.showWidget(t)}))}}(this,e)};function Fo(e,t){return(e=e||{}).status=t,e}function Vo(e){var t;return e.getAllResponseHeaders().indexOf("x-trace-id")>=0&&(t=e.getResponseHeader("x-trace-id")),t}var qo=function(e){function t(t,n){e.call(this,t,n),Uo(this,t),function(e,t){var n=t.widgetManager,i=t.cacheManager;e.beforeAdd=function(e){var r,o,a=e.ref,s=e.parameters,c=Ho(n.device),u=a.name,l=a.getEngagmentId(),d=a.getSuspendedSession(),g=a.getActiveSession();if(!e.ruleSettings)throw new Error("obj.ruleSettings is missing");return o=e.ruleSettings.skip_chat_queue_status_check?t.serviceUrl.connector+"/connector/channels/portal_with_service_line/"+s.portalId+"/device/"+c:t.serviceUrl.connector+"/connector/channels/portals_with_queue_status/"+s.portalId+"/device/"+c,t.httpGetXMLHttpRequest(o).then((function(o){var c,h=JSON.parse(o.responseText);if(s.traceId=Vo(o),e.ruleSettings.skip_chat_queue_status_check)s.serviceLineId||(s.serviceLineId=h.response.serviceLineId,s.serviceLine=h.response.serviceLineName),t.serviceLines.setName(s.serviceLineId,s.serviceLine),c=h.response;else{if(s.serviceLineId||(s.serviceLineId=h.response.queueStatus.id,s.serviceLine=h.response.queueStatus.name),t.serviceLines.setName(s.serviceLineId,s.serviceLine),!h.response)throw new Error("status.response evaluates to false");var f=s.rule&&s.rule.source?s.rule.source:"internal";if(!Ur(f)&&e.ruleSettings.hide_on_demand_chat_when_service_line_is_closed&&"true"!==h.response.queueStatus.queueopen)throw new Error("service line is closed");if(r="true"===h.response.queueStatus.slotavailable,!Ur(f)&&e.ruleSettings.hide_on_demand_chat_when_no_available_agent_slots&&!r&&!d&&!g&&!e.engagementId)throw new Error("spot not available");so(e.ruleSettings.check_queue_wait_time_for_on_demand_chat,F(h,"response","queueStatus","holdtime"),e.ruleSettings.queue_wait_time,d,g),c=h.response.portalData}s.widgetpath=t.scriptLocation+"/widgets/chat/"+t.assetVersion.widgets+"/",s.langOptions=t.langOptions;var p=0;c.deviceList.length>1&&(p=Ho(n.device));var v="<%=host %>/netagent/cimlogin.aspx?questid=<%=questId %>&portid=<%=portalId %>&defaultStyleId=<%=styleId %>&widgetpath=<%=widgetpath %>&flyout=1";v=wo(v)({host:s.host,questId:c.deviceList[p].questid,styleId:c.deviceList[p].styleid,portalId:c.deviceList[p].styleid,widgetpath:t.scriptLocation+"/widgets/chat/"+t.assetVersion.widgets+"/"}),("string"==typeof a.remoteURL||a.remoteURL instanceof String)&&(a.remoteURL={}),a.portalId=s.portalId,a.remoteURL[s.portalId]=v,a.oldRemoteUrl=v,navigator.appVersion&&-1!==navigator.appVersion.indexOf("MSIE 10")?a.remoteURL[s.portalId]+="&fullScreen=false":"Mobile"!==n.device&&"Tablet"!==n.device||(a.remoteURL[s.portalId]+="&fullScreen=true"),e.engagementId&&e.engagementId!==l&&(l=!1);var m=0!==n.notificationType;return s.questId=c.deviceList[p].questid,s.styleId=c.deviceList[p].styleid,a.shouldReplaceIframeSrc=!0,d&&l?(m&&n.widgetsType.closeNotification(),i.removeWidgetCache(u,"suspended_session",!0),void(a.autoOpen=!0)):n.loadingActiveWidgets&&g&&l?(a.origRemoteURL=a.remoteURL,a.oldRemoteUrl=a.remoteURL[s.portalId],a.remoteURL[s.portalId]=wo(g)({host:s.host,widgetpath:t.scriptLocation+"/widgets/chat/"+t.assetVersion.widgets+"/"}),navigator.appVersion&&-1!==navigator.appVersion.indexOf("MSIE 10")?a.remoteURL[s.portalId]+="&fullScreen=false":"Mobile"!==n.device&&"Tablet"!==n.device||(a.remoteURL[s.portalId]+="&fullScreen=true"),t.cacheManager.getWidgetCache(u,"widget-closed")||m?n.loadWidget(a):void(a.autoOpen=!0)):void 0})).then((function(){return e.status=!0,e}))},e.beforeNotify=function(i){var r=t.rulesEngine,o=Ho(n.device),a=60;r.queueWaitTime&&(a=r.queueWaitTime());var s=i.rule,c=null;s&&s.id?c=s.id:_e.log("Chat Widget:beforeNotify: rule id missing from obj:",i);var u=i.parameters,l=t.serviceUrl.connector+"/connector/channels/queue_status/"+u.portalId+"/device/"+o;return t.httpGetXMLHttpRequest(l).then((function(r){var o=JSON.parse(r.responseText);u.traceId=Vo(r);var s=o.response.id;if(u.serviceLineId=o.response.id,u.serviceLine=o.response.name,t.serviceLines.setName(u.serviceLineId,u.serviceLine),t.cacheManager.getWidgetCache(e.name,"suspended_session",!0))return i.status=!1,function(e,t){for(var n=e.getData("profileJSON"),i=n.session.visits.length-1,r=0;r<n.session.visits[i].journey.length;r++)if(n.session.visits[i].journey[r].engagements)for(var o=0;o<n.session.visits[i].journey[r].engagements.length;o++)if(n.session.visits[i].journey[r].engagements[o].id===t)return n.session.visits[i].journey[r].engagements.splice(o,1),e.setData("profileJSON",JSON.stringify(n));return A.resolve()}(t.cacheManager,i.engagementId).then((function(){return i}));var l=parseInt(o.response.holdtime||"0",10);if("true"===o.response.slotavailable&&"true"===o.response.queueopen&&"true"===o.response.agentavailable&&l<a)i.status=!0;else{var d=function(e){var t=arguments;e=ln(e);for(var n=1;n<arguments.length;n++)gn(e,t[n]);return e}({},n.getEngagementRecord(i.engagementId));"false"===o.response.queueopen?(d.chat.missed_reason=2,ge(t,"service-line-closed",s,c,"proactive",u.traceId)):l>=a?(d.chat.missed_reason=3,ge(t,"wait-too-long",s,c,"proactive",u.traceId)):"false"===o.response.agentavailable?(d.chat.missed_reason=1,ge(t,"no-agent-available",s,c,"proactive",u.traceId)):"true"!==o.response.slotavailable&&ge(t,"no-agent-slots-available",s,c,"proactive"),n.setEngagementRecord(i.engagementId,d),i.status=!1}return i}))},e.startNewSession=function(){var n=t.widgetManager,r=Ho(n.device),o=t.serviceUrl.connector+"/connector/channels/queue_status/"+e.parameters.portalId+"/device/"+r;return t.httpGet(o).then((function(r){if(e.shouldReplaceIframeSrc){var o=e.getRemoteURL();"true"!==r.response.slotavailable&&(o=Bo(i,e.oldRemoteUrl)),navigator.appVersion&&-1!==navigator.appVersion.indexOf("MSIE 10")?o+="&fullScreen=false":"Mobile"!==n.device&&"Tablet"!==n.device||(o+="&fullScreen=true"),Vn("#concierge-widget-chat .widget-content").attr("src",o)}else Vn("#concierge-widget-chat iframe.widget-content").replaceWith('<iframe frameborder="no" class="widget-content" sandbox="allow-scripts allow-forms allow-same-origin allow-orientation-lock allow-pointer-lock allow-popups allow-popups-to-escape-sandbox allow-top-navigation allow-top-navigation-by-user-activation"></iframe>'),t.widgetManager.writeSrcToIframe(e.name)}))},e.checkAvailability=function(e){var i=e.parameters,r=Ho(n.device);if(!e.ruleSettings)return A.resolve({status:!1});var o=t.serviceUrl.connector+"/connector/channels/queue_status/"+i.portalId+"/device/"+r;return t.httpGet(o).then((function(t){return t.response?e.ruleSettings.hide_on_demand_chat_when_service_line_is_closed&&"true"!==t.response.queueopen?{status:!1}:e.ruleSettings.hide_on_demand_chat_when_no_available_agent_slots&&"true"!==t.response.slotavailable?{status:!1}:e.ruleSettings.check_queue_wait_time_for_on_demand_chat&&parseInt(t.response.holdtime,10)>e.ruleSettings.queue_wait_time?{status:!1}:{status:!0}:{status:!1}})).catch((function(e){return _e.log("checkAvailability error thrown: "+e),{status:!1}}))},e&&e.titleBar&&(e.titleBar.onclick=function(){n.hideWidget(!1),Bn("widgetMinimized",{widgetName:e.name})})}(this,t)}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t}(jo),Jo={};function Ho(e){var t=Jo[e];return t||(t=0),t}Jo.Mobile=1,Jo.Tablet=2,Jo.Desktop=3;var $o=function(e){return parseInt(e)};function Bo(e,t){var n,i=e.getVolatileData("moxie_channels_custom_data");if(function(e,t){if(e)for(var n=t.split("&"),i=0;i<n.length;i++){var r=n[i].split("=");0===i&&((r=r[0].split("?"))[0]=r[1]),e&&Fe(e,r[0])&&delete e[r[0]]}}(i,t),i){if("object"!=typeof i)try{i=JSON.parse(i)}catch(e){_e.log("Error parsing "+i+": err")}"object"==typeof i&&(n=i,0!==Object.keys(n).length)&&(t=t+"&"+function(e){for(var t=[],n=Object.keys(e),i=0;i<n.length;i++){var r=n[i];if(Array.isArray(e[r])){var o,a=[];for(o=0;o<e[r].length;o++)a.push(fn(r+"[]")+"="+fn(e[r][o]));t.push(a.join("&"))}else t.push(fn(r)+"="+fn(e[r]))}return t.join("&")}(i))}return t}function Uo(e,t){var n=t.widgetManager,i=t.cacheManager;e.getEngagmentId=function(){return i.getWidgetCache(this.name,"engagement_id",!0)},e.getActiveSession=function(){return i.getWidgetCache(this.name,"active_session")},e.getSuspendedSession=function(){return i.getWidgetCache(this.name,"suspended_session",!0)},e.closeWidget=function(){},e.getRemoteURL=function(){var e,t=this.remoteURL,n=this.parameters.portalId;return e="object"==typeof t?t[n]:t,Bo(i,e)},e.updateBroadcastPayload=function(e,n){if(this.parameters){var i=this.parameters;if(i.portalId&&(n.portalId=i.portalId),i.serviceLineId){var r=i.serviceLineId;return n.serviceLineId=r,t.serviceLines.getName(r).then((function(e){return n.serviceLine=e,n}))}}return A.resolve(n)},e.handleChannelsMessage=function(e,t){var r=this.name;switch(_e.log("Event: "+e.call+" URL: "+e.url+" DATA: "+t.data),e.call){case"openSurvey":n.handleBroadcast(r,"surveyLoaded",{sessionId:$o(n.concierge.cacheManager.getWidgetCache(r,"sessionId"))}),i.setWidgetCache(r,"surveyOpen",!0),n.widgetAreaIFrameForWidget(r).attr("src",e.url);break;case"setReturnFromSurvey":n.handleBroadcast(r,"surveyCompleted",{sessionId:$o(n.concierge.cacheManager.getWidgetCache(r,"sessionId"))}),n.hideWidget(!1);break;case"setFlyoutContent":n.widgetAreaIFrameForWidget(r).attr("src",e.url);break;case"chatFocus":"Tablet"===n.device&&"object"!=typeof window.visualViewport&&(n.makePositionAbsolute(),n.needsForceBlur=!0);break;case"chatBlur":break;case"getTabInfo":n.handleGetTabInfo(t,r);break;case"setChatInProgress":var o=parseInt(e.sessionId);0===e.sessionId&&"Tablet"===n.device&&"object"!=typeof window.visualViewport&&(n.makePositionAbsolute(),n.needsForceBlur=!0),n.handleSetChatInProgress(o,r,this.parameters),o>0&&n.handleBroadcast(r,"chatSessionStarted",{sessionId:o})}},e.beforeLoad=function(){t.widgetManager.channelsWidget=this}}var Go=function(e){function t(t,n){e.call(this,t,n),this.baseHideWidget=this.hideWidget,this.hideWidget=function(){this.baseHideWidget(),this.closeWidget()}}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t}(jo);function zo(e,t,n,i,r,o,a,s){Object.defineProperty(this,"name",{value:t,enumerable:!0,writable:!1}),Object.defineProperty(this,"maxLength",{value:n,enumerable:!0,writable:!1}),Object.defineProperty(this,"required",{value:i,enumerable:!0,writable:!1}),Object.defineProperty(this,"label",{value:r,enumerable:!0,writable:!1}),Object.defineProperty(this,"type",{value:o,enumerable:!0,writable:!1}),Object.defineProperty(this,"defaultvalue",{value:a,enumerable:!0,writable:!1}),Object.defineProperty(this,"options",{value:s,enumerable:!0,writable:!1}),this.hide=e}function Ko(){this.hide=!1,this.questions=[]}zo.prototype.setAnswer=function(e){var t=void 0!==e.hide?e.hide:this.hide;if("16"===this.type||"15"===this.type||"4"===this.type||"6"===this.type){for(var n=0;n<this.options.length;n++)if(this.options[n].value===e.value){this.answer=e.value,this.hide=t;break}}else this.answer=e.value,this.hide=t},Ko.prototype.getQuestionByName=function(e){for(var t=0;t<this.questions.length;t++)if(this.questions[t].name===e)return this.questions[t];return null},Ko.prototype.loadQuestions=function(e){for(var t=0;t!==e.length;t++){var n=e[t],i=new zo(!1,n.formatParameters.elementname,n.formatParameters.elementmaxlength,n.formatParameters.elementrequired,n.actualquestion,n.type,n.formatParameters.elementdefaultvalue||n.formatParameters.elementchecked,n.options);"14"===i.type?i.answer="true"===n.formatParameters.elementchecked:i.answer=i.defaultvalue,this.questions.push(i)}},Ko.load=function(e){var t=new Ko;t.hide=!0===e.hide;for(var n=e.questions?e.questions.length:0,i=0;i<n;i++){var r=e.questions[i],o=new zo(r.hide,r.name,r.maxLength,r.required,r.label,r.type,r.defaultvalue,r.options);o.answer=r.answer,t.questions.push(o)}return void 0!==e.sendChatTranscript&&(t.sendChatTranscript=e.sendChatTranscript),t},Ko.prototype.toJson=function(){return JSON.stringify(this)};var Xo=function(e){function t(t,n){e.call(this,t,n),Uo(this,t),function(e,t){var n=t.widgetManager,i=t.cacheManager;e.preferredSpotName=function(){return"chat"},e.titleBar.onclick=function(){sessionStorage.getItem("kbot-disableTitleClick")||(n.hideWidget(!1),Bn("widgetMinimized",{widgetName:"kbot"}),i.setWidgetCache("kbot","shouldReopen",!1,!1))},e.sendSearchGuid=function(e,n){var r={chat_session_id:e},o=n.kbPortalId,a=i.getWidgetCache("kbot","search-guid",!1);if(o&&a&&e){var s=new XMLHttpRequest,c=t.serviceUrl.connector+"/connector/kb/suggestions/"+o+"/"+a;s.open("PUT",c,!0),s.setRequestHeader("Content-Type","application/json"),s.withCredentials=!1,s.onerror=function(){_e.log("Received failure response from connector endpoint for kb search_guid")},s.onreadystatechange=function(){this.readyState===XMLHttpRequest.DONE&&200===this.status&&(_e.log("Sent to kb: "+JSON.stringify(r)),i.removeWidgetCache("kbot","search-guid",!1))},s.send(JSON.stringify(r))}},e.prepareToLoad=function(r){var o,a=r.parameters,s="questionnaire-"+r.parameters.questId,c=t.serviceUrl.connector+"/connector/channels/questionnaire/"+a.questId+"/"+a.styleId;return t.httpGetXMLHttpRequest(c).then((function(e){var n=JSON.parse(e.responseText);return r.parameters.parameters=n.response.parameters,r.parameters.traceId=Vo(e),(o=new Ko).loadQuestions(n.response.questions),t.onQuestionnaireLoadedCallbacks.doCallbacksAsync(o)})).then((function(){return i.setWidgetCache("kbot",s,o.toJson())})).then((function(){return sessionStorage.getItem("MoxieFlyout.chatInProgress")?e.autoOpen=!0:i.getWidgetCache("kbot","shouldReopen",!1)&&"null"===sessionStorage.getItem("MoxieFlyout.chatInProgress")&&(e.autoOpen=!0),e})).catch((function(t){return _e.log("kbot failed in prepare to load:"+JSON.stringify(t)),n.removeWidget(e),null}))},e.shouldRebuildIframe=function(){var e=this.getActiveSession(),t=i.getWidgetCache(this.name,"rebuildIframe",!1),n=i.getWidgetCache(this.name,"surveyOpen",!1);return t&&!e&&!n},e.beforeAdd=function(r){var o,a,s=r.ref,c=r.parameters,u=Ho(n.device),l=this.getEngagmentId(),d=this.getSuspendedSession(),g=this.getActiveSession(),h=i.getWidgetCache("kbot","active_kb_session");if(!r.ruleSettings)throw new Error("obj.ruleSettings is missing");return a=r.ruleSettings.skip_chat_queue_status_check?t.serviceUrl.connector+"/connector/channels/portal_with_service_line/"+c.portalId+"/device/"+u:t.serviceUrl.connector+"/connector/channels/queue_status/"+c.portalId+"/device/"+u,t.httpGetXMLHttpRequest(a).then((function(e){var n=JSON.parse(e.responseText);if(c.traceId=Vo(e),r.ruleSettings.skip_chat_queue_status_check)c.serviceLineId||(c.serviceLineId=n.response.serviceLineId,c.serviceLine=n.response.serviceLineName),t.serviceLines.setName(c.serviceLineId,c.serviceLine);else{if(c.serviceLineId||(c.serviceLineId=n.response.id,c.serviceLine=n.response.name),t.serviceLines.setName(c.serviceLineId,c.serviceLine),c.serviceLineStatus={open:"true"===n.response.queueopen,slotAvailable:"true"===n.response.slotavailable},!n.response)throw new Error("status.response evaluates to false");if(!Ur(c.rule.source)&&r.ruleSettings.hide_on_demand_chat_when_service_line_is_closed&&"true"!==n.response.queueopen)throw new Error("service line is closed");if(o="true"===n.response.slotavailable,!Ur(c.rule.source)&&r.ruleSettings.hide_on_demand_chat_when_no_available_agent_slots&&!o&&!d&&!g&&!r.engagementId)throw new Error("slot not available");so(r.ruleSettings.check_queue_wait_time_for_on_demand_chat,F(n,"response","holdtime"),r.ruleSettings.queue_wait_time,d,g)}if(c.widgetpath=t.scriptLocation+"/widgets/kbot/"+t.assetVersion.widgets+"/",c.langOptions=t.langOptions,r.ruleSettings.skip_chat_queue_status_check)return n;var i=t.serviceUrl.connector+"/connector/channels/portals/"+c.portalId;return t.httpGetXMLHttpRequest(i).then((function(e){var t=JSON.parse(e.responseText);return c.traceId=Vo(e),t}))})).then((function(o){var a=0;o.response.deviceList.length>1&&(a=Ho(n.device));(!s.remoteURL||"string"==typeof s.remoteURL||s.remoteURL instanceof String)&&(s.remoteURL={}),s.portalId=c.portalId,s.remoteURL[c.portalId]=wo("<%=host %>/netagent/cimlogin.aspx?questid=<%=questId %>&portid=<%=portalId %>&defaultStyleId=<%=styleId %>&widgetpath=<%=widgetpath %>&flyout=1")({host:c.host,questId:o.response.deviceList[a].questid,styleId:o.response.deviceList[a].styleid,portalId:o.response.deviceList[a].styleid,widgetpath:t.scriptLocation+"/widgets/kbot/"+t.assetVersion.widgets+"/"}),s.hashedQuestId=o.response.deviceList[a].questid,s.hashedPortalId=o.response.deviceList[a].styleid,navigator.appVersion&&-1!==navigator.appVersion.indexOf("MSIE 10")?(c.fullScreen=!1,s.remoteURL[c.portalId]+="&fullScreen=false"):"Mobile"!==n.device&&"Tablet"!==n.device||(c.fullScreen=!0,s.remoteURL[c.portalId]+="&fullScreen=true"),r.engagementId&&r.engagementId!==l&&(l=!1);var u=0!==n.notificationType;if(c.questId=o.response.deviceList[a].questid,c.styleId=o.response.deviceList[a].styleid,i.getWidgetCache("kbot","suspended_session",!0)&&l)return u&&n.widgetsType.closeNotification(),e.shouldReplaceIframeSrc=!0,i.removeWidgetCache("kbot","suspended_session",!0),void(e.autoOpen=!0);var d=i.getWidgetCache("kbot","widget-closed");if(n.loadingActiveWidgets&&g&&l)return e.shouldReplaceIframeSrc=!0,s.origRemoteURL=s.remoteURL,s.oldRemoteUrl=s.remoteURL[c.portalId],s.remoteURL[c.portalId]=wo(g)({host:c.host,widgetpath:t.scriptLocation+"/widgets/kbot/"+t.assetVersion.widgets+"/"}),d||u?n.loadWidget(e):void(e.autoOpen=!0);if(n.loadingActiveWidgets&&h&&l){var f=i.getWidgetCache("kbot","shouldReopen",!1);return d||u||!f?n.loadWidget(e):void(e.autoOpen=!0)}})).then((function(){return r.status=!0,r}))},e.beforeNotify=function(e){return A.resolve(Fo(e,!1))},e.startNewSession=function(){var e=t.widgetManager.createEngagementRecord(this,"kb");i.setWidgetCache("kbot","engagement_id",e,!0),i.removeWidgetCache("kbot","active_session"),i.removeWidgetCache("kbot","surveyOpen"),Vn("#concierge-widget-kbot iframe.widget-content").replaceWith('<iframe frameborder="no" class="widget-content" ></iframe>'),t.widgetManager.writeSrcToIframe("kbot"),delete this.shouldReplaceIframeSrc},e.createChatEngagementRecord=function(){var e=t.widgetManager.createEngagementRecord(this,"chat");return i.setWidgetCache("kbot","engagement_id",e,!0),{id:e,data:t.widgetManager.getEngagementRecord(e)}}}(this,t)}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t}(jo);var Qo=function(e){function t(t,n){e.call(this,t,n),function(e,t){e.beforeAdd=function(n){if(n.parameters.langOptions=t.langOptions,!n.ruleSettings)throw new Error("obj.ruleSettings is missing");return e.parameters.ruleSettings=n.ruleSettings,n.status=!0,A.resolve(n)}}(this,t)}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t}(jo);var Yo=function(e){function t(t,n){e.call(this,t,n),function(e,t){e.name="bell",e.priority=0,e.buttonEnabled=!1,e.icon=F(t,"widgetManager","engagementWidgets","conciergeTab","icon"),e.preferredSpotName=function(){return"bell"},e.execute=function(e){return A.resolve(null)}}(this,t)}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t}(jo);var Zo=function(e){function t(t,n){e.call(this,t,n),this.engagement_type=5,function(e,t){var n=t.widgetManager;e.priority=0,e.shouldDisplayBell=function(){return!1},e.preferredSpotName=function(){return null},e.beforeAdd=function(e){if(Yr(n)){var i=n.wmState;if(null===i.spots.single.widget)return Dr(i,new Yo(t,{rule:{source:"internal"},parameters:{}})).then((function(t){return Fo(e,t.status)}))}return A.resolve(Fo(e,!0))},e.execute=function(n){var i=this;if(!i.isExecuting){var r=this.parameters;return i.isExecuting=!0,"_blank"===r.linkStrategy?(ea(t,r),Wr(n.wmState,e),i._openTimeout=setTimeout((function(){i.isExecuting=!1,Rr(n.wmState,e),delete i._openTimeout}),1e3),window.open(r.url,r.linkStrategy,"noopener")):t.logDisabled?window.open(r.url,r.linkStrategy,"noopener"):(window.addEventListener("GoMoxie:PriorityEvents",(function(){window.open(r.url,r.linkStrategy,"noopener")}),!1),Wr(n.wmState,e),this._openTimeout=setTimeout((function(){delete i._openTimeout,window.open(r.url,r.linkStrategy,"noopener")}),3e3),ea(t,r)),A.resolve(null)}},e.destroy=function(t){Rr(t.wmState,e),this._openTimeout&&clearTimeout(this._openTimeout)}}(this,t)}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t}(jo);function ea(e,t){Bn("linkFollowed",{strategy:t.linkStrategy,url:t.url}),be(e,t.url,t.linkStrategy,t.rule.id)}function ta(e){e.bridgeListener=na.bind(e),window.addEventListener("message",e.bridgeListener,!1)}function na(e,t){var n=ra,i=!1;null!=t&&(n=t.doPostMessage,i=!0);var r,o=this.concierge,a=o.cacheManager,s=this.wmState;if("string"==typeof e.data&&"SessionCleared"!==e.data)try{r=JSON.parse(e.data)}catch(t){return _e.log("WidgetBridge received invalid JSON: ",t),void _e.log("Payload was:"+e.data)}else r=e.data;if(r&&r.call&&this.channelsWidget)this.channelsWidget.handleChannelsMessage(r,e);else{var c=r.widget;if(c){var u=this.engagementWidgets.widgets[c];if(u){var l=u.parameters;if(function(e,t){var n=window.location.hostname,i=(e.cacheManager.getClientCache("channelsHosts")||[]).map((function(e){return ia(e)})),r=ia(e.scriptLocation),o=ia(t.origin),a=[n,r].concat(i);if(!o||a.every((function(e){return o!==e}))){var s=['The domain "',document.domain,'" ','rejected message from un-trusted domain: "',o,'"'].join("");return _e.error(s),!1}return!0}(o,e)){var d,g=e.data,h=e.data.parameters;if(_e.log("["+g.type+"] message accepted from: "+e.origin),!i&&"_multi"===g.type)return d=oa(this,c,e,g,h),void n(e,d);d={};var f=null,p=null;switch(g.type){case"focusEvent":"Tablet"===this.device&&"object"!=typeof window.visualViewport&&(this.makePositionAbsolute(),this.needsForceBlur=!0);break;case"blurEvent":"Tablet"===this.device&&"object"!=typeof window.visualViewport&&(this.needsForceBlur=!1);break;case"resetConcierge":no(this,!0),this.removeWidget(u,!0),this.addWidget(u.parameters,u.parameters.rule);break;case"getVisitorProfile":f="profileJSON",d={type:"getVisitorProfileResponse",replyForMsgId:g.msgId,parameters:{data:a.getData(f)}},n(e,d);break;case"setVisitorProfile":f="profileJSON",a.setData(f,JSON.stringify(h.data));break;case"getEngagementRecord":p=a.getWidgetCache(c,"engagement_id",!0),d={type:"getEngagementRecordResponse",replyForMsgId:g.msgId,parameters:{id:p,data:lo(a,p)}},n(e,d);break;case"onQuestionnaireSubmit":d={type:"onQuestionnaireSubmitResponse",replyForMsgId:g.msgId},o.onQuestionnaireSubmitCallbacks?o.onQuestionnaireSubmitCallbacks.doCallbacksAsync(Ko.load(h.data)).then((function(t){d.parameters=t.toJson(),n(e,d)})):(d.parameters=JSON.stringify(h),n(e,d));break;case"getParameters":d={type:"getParametersResponse",replyForMsgId:g.msgId,parameters:{data:l}},n(e,d);break;case"setEngagementRecord":p=a.getWidgetCache(c,"engagement_id",!0),uo(a,p,h.data);break;case"createEngagementRecord":p=this.createEngagementRecord(u),a.setWidgetCache(c,"engagement_id",p,!0),d={type:"createEngagementRecordResponse",replyForMsgId:g.msgId,parameters:{id:p,data:this.getEngagementRecord(p)}},n(e,d);break;case"getWidgetInitData":d={type:"getWidgetInitDataResponse",replyForMsgId:g.msgId,parameters:{data:{clientHref:window.location.href,parameters:u.parameters,configuration:u.configuration,translation:o.localization.data}}},n(e,d);break;case"getConfiguration":d={type:"getConfigurationResponse",replyForMsgId:g.msgId,parameters:{data:u.configuration}},n(e,d);break;case"getCache":d={type:"getCacheResponse",replyForMsgId:g.msgId,parameters:{key:h.key,value:a.getWidgetCache(c,h.key,h.persist)}},n(e,d);break;case"getCacheData":d={type:"getCacheDataResponse",replyForMsgId:g.msgId,parameters:{key:h.key,value:a.getData(h.key)}},n(e,d);break;case"getTranslation":d={type:"getTranslationResponse",replyForMsgId:g.msgId,parameters:{value:o.localization.data}},n(e,d);break;case"getOtherCache":d={type:"getOtherCacheResponse",replyForMsgId:g.msgId,parameters:{key:h.key,value:a.getWidgetCache(c,h.key,h.persist)}},n(e,d);break;case"setCache":a.setWidgetCache(c,h.key,h.value,h.persist);break;case"removeCache":a.removeWidgetCache(c,h.key,h.persist);break;case"notificationMessage":if(pr(s)||vr(s))return;h.title&&(h.title=o.getTranslation(Qr(c),h.title)),u.parameters.title=h.title,u.parameters.message=h.message,u.parameters.icon=h.icon,u.parameters.callToAction=h.callToAction,u.parameters.notificationType=2,u.notificationType=2,this.showNotification(u);break;case"updateWidgetTitle":this.updateWidgetTitle(c,h);break;case"updateTabText":Vn("#concierge .con_tab_text").text(h.text);break;case"hideWidget":u.hideWidget();break;case"setServiceLineId":this.setServiceLineId(h,c);break;case"setActive":h.active?Pr(s,u):jr(s,u);break;case"handleClose":a.setWidgetCache(c,"willHandleClose",h.value,!0);break;case"callFunction":d={type:"callFunctionResponse",replyForMsgId:g.msgId,parameters:{}},u[h.funcName]&&(d.parameters.result=u[h.funcName](h.funcArgs)),n(e,d);break;case"broadcast":this.handleBroadcast(c,h.eventType,h.data)}}}}}}function ia(e){if(!e)return"";var t=e.match(/(https?:\/\/)([^/]+)/);return t?t[2]:""}var ra=function(e,t){e&&e.source&&e.source.postMessage(po(t),e.origin)},oa=function(e,t,n,i,r){var o=[],a=[],s={doPostMessage:function(e,t){o.push(t)}};return r.calls.forEach((function(i){i.parameters.signature=r.signature,i.parameters.widget=t,i.widget=t;var c=o.length,u=!1;try{e.bridgeListener({data:i,origin:n.origin},s)}catch(e){u=!0,o.push(null),a.push(e.name)}u||(a.push(null),o.length===c&&o.push(null))})),{type:"_multiResponse",replyForMsgId:i.msgId,parameters:{success:o,failure:a}}};"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self&&self;var aa,sa=function(e,t){return e(t={exports:{}},t.exports),t.exports}((function(e,t){
/*!
* displacejs.js 1.3.2 - Tiny javascript library to create moveable DOM elements.
* Copyright (c) 2019 Catalin Covic - https://github.com/catc/displace
* License: MIT
*/
e.exports=function(e){function t(i){if(n[i])return n[i].exports;var r=n[i]={exports:{},id:i,loaded:!1};return e[i].call(r.exports,r,r.exports,t),r.loaded=!0,r.exports}var n={};return t.m=e,t.c=n,t.p="",t(0)}([function(e,t,n){var i=function(e){return e&&e.__esModule?e:{default:e}}(n(1));e.exports=i.default},function(e,t,n){function i(){var e=this,t=this.el,n=this.opts||s,i={};if(t.style.position="absolute",this.handle=n.handle||t,n.constrain){for(var c=n.relativeTo||t.parentNode,u=t,l=0,d=0;u!==c;)u=u.parentNode,(0,r.isRelative)(u)&&(l-=u.offsetLeft,d-=u.offsetTop),u===c&&(l+=u.offsetLeft,d+=u.offsetTop);var g=l+c.offsetWidth-t.offsetWidth,h=d+c.offsetHeight-t.offsetHeight;i.xClamp=(0,r.generateClamp)(l,g),i.yClamp=(0,r.generateClamp)(d,h)}this.opts=n,this.data=i,this.events={mousedown:o.mousedown.bind(this),mouseup:o.mouseup.bind(this),touchstart:o.touchstart.bind(this),touchstop:o.touchstop.bind(this),scrollFix:function(t){e.isDragging&&t.preventDefault()}},this.handleMove=a(this.opts.customMove),this.handle.addEventListener("mousedown",this.events.mousedown,!1),this.handle.addEventListener("touchstart",this.events.touchstart,!1),document.addEventListener("touchmove",this.events.scrollFix,{passive:!1})}Object.defineProperty(t,"__esModule",{value:!0});var r=n(2),o=n(3),a=(0,r.generateMoveFn)(),s={constrain:!1,relativeTo:null,handle:null,ignoreFn:null,highlightInputs:!1,onMouseDown:null,onMouseMove:null,onMouseUp:null,onTouchStart:null,onTouchMove:null,onTouchStop:null,customMove:null},c=function(){function e(t,n){if(function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),!t)throw Error("Must include moveable element");this.el=t,this.opts=n,i.call(this)}return e.prototype.reinit=function(){this.destroy(),i.call(this)},e.prototype.destroy=function(){var e=this.events;this.handle.removeEventListener("mousedown",e.mousedown,!1),document.removeEventListener("mousemove",e.mousemove,!1),document.removeEventListener("mouseup",e.mouseup,!1),this.handle.removeEventListener("touchstart",e.touchstart,!1),document.removeEventListener("touchmove",e.touchmove,!1),document.removeEventListener("touchstop",e.touchstop,!1),document.removeEventListener("touchmove",this.events.scrollFix,{passive:!1})},e}();t.default=function(e,t){return new c(e,t)}},function(e,t){function n(e,t,n){e.style.left=t+"px",e.style.top=n+"px"}Object.defineProperty(t,"__esModule",{value:!0}),t.generateClamp=function(e,t){return function(n){return Math.min(Math.max(n,e),t)}},t.isRelative=function(e){return"relative"===window.getComputedStyle(e).position},t.generateMoveFn=function(){return window.requestAnimationFrame?function(e){var t=e||n;return function(e,n,i){window.requestAnimationFrame((function(){t(e,n,i)}))}}:function(e){return function(t,i,r){(e||n)(t,i,r)}}}},function(e,t){function n(e,t,n){var i=this.el,r=this.opts,o=this.data;"function"==typeof r.onMouseMove&&r.onMouseMove(i,n);var a=n.clientX-e,s=n.clientY-t;return r.constrain&&(a=o.xClamp(a),s=o.yClamp(s)),this.handleMove(i,a,s),n.preventDefault(),!1}function i(e,t,n){var i=this.el,r=this.opts,o=this.data;"function"==typeof r.onTouchMove&&r.onTouchMove(i,n);var a=n.targetTouches[0],s=a.clientX-e,c=a.clientY-t;return r.constrain&&(s=o.xClamp(s),c=o.yClamp(c)),this.handleMove(i,s,c),n.preventDefault(),!1}Object.defineProperty(t,"__esModule",{value:!0}),t.mousedown=function(e){var t=this.opts;if(t.highlightInputs){var i=e.target.tagName.toLowerCase();if("input"===i||"textarea"===i)return}if(!t.ignoreFn||!t.ignoreFn(e)){if(0===e.button){var r=this.el,o=this.events;"function"==typeof t.onMouseDown&&t.onMouseDown(r,e);var a=e.clientX-r.offsetLeft,s=e.clientY-r.offsetTop;o.mousemove=n.bind(this,a,s),document.addEventListener("mousemove",o.mousemove,!1),document.addEventListener("mouseup",o.mouseup,!1)}e.preventDefault()}},t.mousemove=n,t.mouseup=function(e){var t=this.el,n=this.opts,i=this.events;"function"==typeof n.onMouseUp&&n.onMouseUp(t,e),document.removeEventListener("mouseup",i.mouseup,!1),document.removeEventListener("mousemove",i.mousemove,!1)},t.touchstart=function(e){var t=this.opts;if(t.highlightInputs){var n=e.target.tagName.toLowerCase();if("input"===n||"textarea"===n)return}if(!t.ignoreFn||!t.ignoreFn(e)){var r=this.el,o=this.events;"function"==typeof t.onTouchStart&&t.onTouchStart(r,e);var a=e.targetTouches[0],s=a.clientX-r.offsetLeft,c=a.clientY-r.offsetTop;o.touchmove=i.bind(this,s,c),this.isDragging=!0,document.addEventListener("touchmove",o.touchmove,!1),document.addEventListener("touchend",o.touchstop,!1),document.addEventListener("touchcancel",o.touchstop,!1)}},t.touchmove=i,t.touchstop=function(e){this.isDragging=!1;var t=this.el,n=this.opts,i=this.events;"function"==typeof n.onTouchStop&&n.onTouchStop(t,e),document.removeEventListener("touchmove",i.touchmove,!1),document.removeEventListener("touchend",i.touchstop,!1),document.removeEventListener("touchcancel",i.touchstop,!1)}}])})),ca=(aa=sa)&&aa.__esModule&&Object.prototype.hasOwnProperty.call(aa,"default")?aa.default:aa;sa.displacejs;function ua(e){this.shouldDisplayBell=!1,this.KNOWN_WIDGETS={chat:{requires:["portalId","host"]},email:{requires:["mailboxId"]},kb:{requires:["articleLimit","portalId","searchText"]},kbot:{requires:["portalId","host"]}},this.notificationType=0;var t=navigator;this.concierge=e,this.journeyViewManager=new Po(e),this.stashedConciergeCss={top:"",bottom:""},this.needsForceBlur=!1,this.state="tab",this.device=H(t),this.openWidget=!1,this.widgetLoadPromises={},this.windowHasDragResize=!1,_e.log("WidgetManager constructor: device="+this.device),"Mobile"===this.device?this.widgetsType=new Ao(this):this.widgetsType=new Lo(this),this.bridgeListener={},this.initDraggableData()}function la(e){var t,n=e.concierge.cacheManager;return e.tabStyle=e.tabStyle||{verticalOffset:"100",verticalAnchor:1,horizontalOffset:"20",cascade:1},n&&e.engagementWidgets&&(t=e.engagementWidgets).conciergeTab&&t.conciergeTab.tabStyle&&(void 0!==t.conciergeTab.tabStyle.verticalOffset&&(e.tabStyle.verticalOffset=t.conciergeTab.tabStyle.verticalOffset),void 0!==t.conciergeTab.tabStyle.verticalAnchor&&(e.tabStyle.verticalAnchor=t.conciergeTab.tabStyle.verticalAnchor),void 0!==t.conciergeTab.tabStyle.horizontalOffset&&(e.tabStyle.horizontalOffset=t.conciergeTab.tabStyle.horizontalOffset),void 0!==t.conciergeTab.tabStyle.cascade&&(e.tabStyle.cascade=t.conciergeTab.tabStyle.cascade)),e.tabStyle}function da(e,t){var n,i,r,o,a,s=t.widget,c={},u=e.engagementWidgets.widgets[s].parameters;return"email"===s?(r="mailboxId",i="mailbox ID"):(r="portalId",i="portal ID"),u&&(a=u[r],n=u.host),(o=t[r]||a)||_e.log("No Moxie "+i+" specified for engagement."),c[r]=o,Xr(s)&&function(e,t,n){var i=e||t;i||_e.log("No Moxie chat host specified for engagement.");n.host=i}(t.host,n,c),c}function ga(e){window.MOXIE_CONCIERGE&&delete window.MOXIE_CONCIERGE.startEngagement,e.dataStartListener&&(rn(document,"click",e.dataStartListener),delete e.dataStartListener),e.windowHasDragResize&&(en(window,"resize",e.dragResizeHandler.bind(this)),e.windowHasDragResize=!1),function(e){e.bridgeListener&&(window.removeEventListener("message",e.bridgeListener,!1),delete e.bridgeListener)}(e)}function ha(e){e.initEngagementWidgets(),ta(e),la(e),function(e){var t=e.widgetsType.html();t=(t=t.replace(/\/SCRIPT_LOCATION\//g,e.concierge.scriptLocation+"/")).replace(/\/DEVICE\//g,e.device);var n=!1;if(e.concierge.cacheManager&&e.engagementWidgets&&(n=e.engagementWidgets).conciergeTab&&n.conciergeTab.icon&&n.conciergeTab.icon.svg){var i=n.conciergeTab.icon.svg;t=t.replace(/<!-- replace: ICON -->/g,i)}var r=Vn(t=wo(t)({concierge:e.concierge,CONCIERGE_TAB_ICON_SVG:e.engagementWidgets.conciergeTab.icon.svg,CON_CLOSED:Yr(e)?" single-channel":"",CON_ROLE_ATTRIBUTE:Yr(e)?"":' role="menu"',CLOSE_ICON:e.concierge.getTranslation("common","CLOSE_ICON"),CONCIERGE:e.concierge.getTranslation("common","CONCIERGE"),NOTIFICATION_ANNOUNCE:e.concierge.getTranslation("common","NOTIFICATION_ANNOUNCE")})),o=function(t){if("click"===t.type||13===t.which||32===t.which)return e.closeWidget(!1),!1};nn(r,"click",on("con-close-area"),o),nn(r,"keypress",on("con-close-area"),o);var a=on("con-widget-title-section");nn(r,"keyup",a,(function(){return Vt(this,{outline:"-webkit-focus-ring-color auto 5px"}),!1})),nn(r,"blur",a,(function(){return Vt(this,{outline:"none"}),!1}));var s=function(t){if("click"===t.type&&Vt(this,{outline:"none"}),"click"===t.type||13===t.which||32===t.which){var n=Vn(this).closest(".concierge-widget").data("widget");e.postMessageToWidget(n,"titleClicked");var i=e.engagementWidgets.widgets[n];return i.titleBar.onclick&&i.titleBar.onclick(e),!1}};nn(r,"click",a,s),nn(r,"keypress",a,s),e.widgetsType.beforeAppend&&e.widgetsType.beforeAppend(r),Vn("body").append(r[0]),r.hide()}(e);var t=Vn("#concierge .con-icon svg");void 0!==t&&t.length>0&&to(t[0]),e.$concierge=Vn("#concierge"),e.widgetsType.start()}ua.prototype.startExternal=function(e,t){var n=this,i=!0===t.enableChatDeflection||"true"===t.enableChatDeflection;null!==t.widget&&void 0!==t.widget||(t.widget=t.startEngagement),"chat"===t.widget&&i&&(t.widget="kbot");var r=[];"kbot"===t.widget||"chat"===t.widget?(r.push("kbot"),r.push("chat")):r.push(t.widget);var o,a=null;if(r.forEach((function(e){null===a&&(function(e,t){var n=!1;return Object.keys(e.spots).forEach((function(i){var r=e.spots[i];r.widget&&r.widget.name===t&&(n=r.twiddled)})),n}(n.wmState,e)&&(a=e))})),null!==a){var s=A.resolve(null);return _e.log('WidgetManager.startExternal not starting widget "'+t.widget+'" because the spot is twiddled'),(null!==(o=this.wmState).open&&void 0!==o.open?o.open.name:null)!==a&&(_e.log('WidgetManager.startExternal is showing existing widget "'+a+'"'),"tab"===this.state&&this.widgetsType.toggleWindow&&(s=s.then((function(){return n.widgetsType.toggleWindow()}))),s=s.then((function(){return n.showWidget(n.findWidget(a))}))),s.then((function(){return{status:!1}}))}delete t.startEngagement,delete t.enableChatDeflection,t.ruleSource=e;var c=["externalLink","externalAPI"];if(t.ruleId=-1*(1+c.indexOf(e)),t.action="success",null===t.widget||void 0===t.widget||""===t.widget)return _e.log("WidgetManager.startExternal invoked with improper widget specification"),A.resolve({status:!1,invalid:!0});var u=this;cn(t,da(this,t));var l=null;l="kbot"===t.widget?["kbot","chat"]:"chat"===t.widget?["chat","kbot"]:[t.widget];var d=A.resolve(null);return l.forEach((function(e){var t=n.findWidget(e);null!=t&&(_e.log('WidgetManager.startExternal Removing widget: "'+e+'"'),d=d.then((function(){return u.removeWidget(t,!0)})))})),d.then((function(){return function(e,t){var n={name:t.ruleName,source:t.ruleSource,id:t.ruleId,action:t.action},i=A.resolve();return i=i.then((function(){if(e.notificationDisplayed())return _e.log("WidgetManager.displayWidget("+t.widget+":"+t.ruleName+"): is closing the notification"),xr(e.wmState)})).then((function(){return e.addWidget(t,n)})).then((function(n){if(n&&void 0!==n.status&&!1===n.status)return _e.log("WidgetManager.displayWidget("+t.widget+":"+t.ruleName+"): halted because addWidget failed"),n;var i=A.resolve(null);return!1!==e.openWidget&&e.openWidget!==t.widget&&(i=i.then((function(){return e.hideWidget(!0)}))),i.then((function(){return e.showWidget(n.ref)})).then((function(){return e.showConcierge()})).then((function(){return e.widgetsType.openConcierge()})).then((function(){return{ref:n.ref,status:!0}}))})).catch((function(e){return _e.log("WidgetManager.displayWidget("+t.widget+":"+t.ruleName+"): failed: "+e),_e.log(e.stack),zr}))}(n,t)}))},ua.prototype.findWidget=function(e){for(var t in this.wmState.spots){var n=this.wmState.spots[t];if(n.widget&&n.widget.name===e)return n.widget;if(n.reactive&&n.reactive.name===e)return n.reactive}return this.wmState.offer&&this.wmState.offer.name===e?this.wmState.offer:this.engagementWidgets.widgets[e]},ua.prototype.initDraggableData=function(){this.widgetAreaDragData||(this.widgetAreaDragData={draggedByUser:!1,initialElemData:null,currentElemData:null,parentData:null,resizedWhileMinimized:!1})},ua.prototype.removeDraggableData=function(){delete this.widgetAreaDragData},ua.prototype.dragStartHandler=function(e,t){this.$concierge.find("#concierge-iframe-cover").show(),zt(e,"is-dragging"),this.widgetAreaDragData.currentElemData=e.getBoundingClientRect(),this.widgetAreaDragData.parentData=e.parentNode.getBoundingClientRect(),this.widgetAreaDragData.draggedByUser||(Vn(e).addClass("free-floating"),this.widgetAreaDragData.initialElemData=this.widgetAreaDragData.currentElemData,this.widgetAreaDragData.draggedByUser=!0)},ua.prototype.dragMaxCalculations=function(){var e,t=document.body.getBoundingClientRect().width-this.widgetAreaDragData.parentData.left,n=0-(this.widgetAreaDragData.currentElemData.width-t),i=this.widgetAreaDragData.parentData.right-this.widgetAreaDragData.initialElemData.right-this.widgetAreaDragData.parentData.width,r=this.widgetAreaDragData.currentElemData.width+i,o=0-r;this.widgetAreaDragData.parentData.left>r&&(o=0-this.widgetAreaDragData.parentData.left);var a=window.visualViewport?window.visualViewport.height:window.innerHeight;if(1===this.tabStyle.verticalAnchor){var s=a-this.widgetAreaDragData.parentData.top;e=0-this.widgetAreaDragData.currentElemData.height+s}else e=a-this.widgetAreaDragData.currentElemData.height-this.widgetAreaDragData.initialElemData.top;return{minX:o,maxX:n,minY:0-this.widgetAreaDragData.parentData.top,maxY:e}},ua.prototype.dragMoveHandler=function(e,t,n){if(this.widgetAreaDragData.currentElemData){var i=this.dragMaxCalculations(),r=i.minX,o=i.maxX,a=i.minY,s=i.maxY;t=Math.min(t,o),t=Math.max(t,r),n=Math.min(n,s),n=Math.max(n,a)}this.widgetAreaDragData.x=t,this.widgetAreaDragData.y=n,Vt(e,{left:this.widgetAreaDragData.x,top:this.widgetAreaDragData.y})},ua.prototype.dragConfigData=function(){return{moveableWidgets:this.engagementWidgets.globalSettings.moveableWidgets,tabStyle:this.tabStyle}},ua.prototype.isDragConfigDataEqualToCurrent=function(e){if("object"!=typeof e)return!1;var t=this.dragConfigData();if(e.moveableWidgets!==t.moveableWidgets||"object"!=typeof e.tabStyle||"object"!=typeof t.tabStyle)return!1;for(var n=["cascade","horizontalOffset","verticalAnchor","verticalOffset"],i=0;i<n.length;i++){var r=n[i];if(e.tabStyle[r]!==t.tabStyle[r])return!1}return!0},ua.prototype.dragEndHandler=function(e,t){this.$concierge.find("#concierge-iframe-cover").hide(),Kt(e,"is-dragging"),void 0===this.widgetAreaDragData.initialConfigData&&(this.widgetAreaDragData.initialConfigData=this.dragConfigData()),this.concierge.cacheManager.setClientCache("drag_position",{left:this.widgetAreaDragData.x,top:this.widgetAreaDragData.y,initialElemData:this.widgetAreaDragData.initialElemData,initialConfigData:this.widgetAreaDragData.initialConfigData},!0)},ua.prototype.dragCheck=function(e){var t=[];if("function"==typeof e.composedPath)for(var n=e.composedPath(),i=n.length,r=0;r<i&&"concierge-widget-area"!==n[r].id;r++)t.push(n[r]);else if(e.target){var o=e.target;for(t.push(o);o.parentNode&&"concierge-widget-area"!==(o=o.parentNode).id;)t.push(o)}for(var a=["con-widget-icon","clickable-title","con-close-area"],s=0;s<a.length;s++)if(Xt(t,a[s]))return!0;return!1},ua.prototype.dragFixAfterResize=function(){if(this.widgetAreaDragData&&this.widgetAreaDragData.draggedByUser)if(vr(this.wmState)){this.widgetAreaDragData.resizedWhileMinimized=!1;var e=this.$concierge.find("#concierge-widget-area");this.dragStartHandler(e[0]),this.dragMoveHandler(e[0],this.widgetAreaDragData.x,this.widgetAreaDragData.y),this.dragEndHandler(e[0])}else t=this.wmState,n=!1,Object.keys(t.spots).forEach((function(e){t.spots[e].widget&&(n=!0)})),n&&(this.widgetAreaDragData.resizedWhileMinimized=!0);var t,n},ua.prototype.dragResizeHandler=function(e){this.draggableWidgetArea&&this.dragFixAfterResize()},ua.prototype.addEventListeners=function(){var e=this;if(window.MOXIE_CONCIERGE=window.MOXIE_CONCIERGE||{},window.MOXIE_CONCIERGE.startEngagement=function(t){return e.startExternal("externalAPI",t)},this.dataStartListener&&rn(document,"click",this.dataStartListener),this.dataStartListener=nn(document,"click",tn(Mt,"data-moxie-start-engagement"),(function(t){var n=function(e){var t=/^moxie(.*)/,n={};for(var i in e)if(Fe(e,i)&&t.test(i)){var r=i.replace(t,"$1");n[r=r.charAt(0).toLowerCase()+r.slice(1)]=e[i]}return n}(Vn(this).data());return e.startExternal("externalLink",n),!1})),!e.isMobile()&&e.engagementWidgets.globalSettings.moveableWidgets){var t=e.$concierge.find("#concierge-widget-area");t.addClass("moveable-widget"),e.draggableWidgetArea=ca(t[0],{onMouseDown:e.dragStartHandler.bind(e),onTouchStart:e.dragStartHandler.bind(e),customMove:e.dragMoveHandler.bind(e),onMouseUp:e.dragEndHandler.bind(e),onTouchStop:e.dragEndHandler.bind(e),ignoreFn:e.dragCheck}),e.windowHasDragResize||(Yt(window,"resize",e.dragResizeHandler.bind(e)),window.visualViewport&&Yt(window.visualViewport,"resize",e.dragResizeHandler.bind(e)),e.windowHasDragResize=!0)}},ua.prototype.isMobile=function(){return"Mobile"===this.device},ua.prototype.createEngagementRecord=function(e,t){var n=function(e,t){var n=e.name,i=e.parameters.proactive,r=e.parameters.rule,o=Kr(t=t||e.name)?"kb":t,a={id:ri(),dirty:!0,time:Date.now(),type:j[t],name:o,proactive:void 0!==i&&i,rule:void 0!==r?r:null,decision_type:"",kb:null,chat:null,email:null};return Xr(n)?a.chat={agents:[],missed_reason:0}:"email"===n&&(a.email={sent:!1}),a}(e,t);return co(this.concierge.cacheManager,n),n.id},ua.prototype.getEngagementRecord=function(e){return lo(this.concierge.cacheManager,e)},ua.prototype.setEngagementRecord=function(e,t){return uo(this.concierge.cacheManager,e,t)},ua.prototype.getWidgetParameters=function(e){return this.widgetParameters[e]},ua.prototype.toggleWindow=function(){this.widgetsType.toggleWindow(this)},ua.prototype.knownWidgets={chat:qo,kbot:Xo,kb:Qo,email:Go},ua.prototype.simpleWidgets={link:Zo},ua.prototype.createWidget=function(e){var t,n=this.concierge,i=JSON.parse(JSON.stringify(F(n,"configuration","widgets","widgets",e)||{}));return(t=this.knownWidgets[e]?new this.knownWidgets[e](n,i):this.simpleWidgets[e]?new this.simpleWidgets[e](n,i):new jo(n,i)).name=e,t},ua.prototype.initEngagementWidgets=function(){var e=JSON.parse(JSON.stringify(F(this.concierge,"configuration","widgets")||{}));for(var t in e.widgets)e.widgets[t]=this.createWidget(t);for(var n in self.simpleWidgets)e.widgets[n]=this.createWidget(t);this.engagementWidgets=e,this.wmState=new lr(this)},ua.prototype.addWidget=function(e,t,n){var i,r=e.widget;return(i=this.createWidget(r)).widgetParameters=e,i.parameters=e,i.parameters.rule=t,i.parameters.proactive=i.parameters.proactive||!1,i.engagementId=n,Dr(this.wmState,i)},ua.prototype.removeWidget=function(e,t){e&&(_e.log('WidgetManager.removeWidget("'+e.name+'"): invoked.'),function(e,t){if(t){_e.log('wmStateRemoveWidget called with: "'+t.name+'"'),e.notification===t&&xr(e);var n=t.spot;if(_e.log('wmStateRemoveWidget spotName is: "'+n+'"'),n){var i=gr(e,n);i.widget&&i.widget.name===t.name&&(i.reactive||i.widget.widgetParameters&&i.widget.widgetParameters.rule.id<0)?(_e.log("wmStateRemoveWidget: remove reactive widget of same name"),yr(e,i.widget),eo(n).remove(),i.reactive=i.widget=null):(_e.log("wmStateRemoveWidget: remove not reactive"),i.reactive===t&&(i.reactive=null),i.widget===t&&i.reactive&&br(e,i.reactive))}}}(this.wmState,e),e.destroy(this),t||Vn("#concierge-widgets ul li").length||Vn("#concierge").hide())},ua.prototype.updateWidgetTitle=function(e,t){var n=this.widgetAreaForWidget(e),i=n.find(".concierge-widget-header .con-widget-title"),r=t.text;i.text(r&&this.concierge.getTranslation(e,r,""));var o="";switch(t.buttonType||""){case"minimizeIcon":o=this.concierge.getTranslation("common","MINIMIZE_ICON");break;case"searchIcon":o=this.concierge.getTranslation("common","SEARCH_ICON");break;case"backIcon":o=this.concierge.getTranslation("common","BACK_ICON");break;default:o=""}var a=n.find(".concierge-widget-header .con-widget-icon");a.empty();var s=t.graphic||"";if(s.length){if("<"===s.charAt(0))a.html(s);else{var c=this.concierge.scriptLocation+"/widgets/"+e+"/"+s;a.html('<img src="'+c+'" />')}a.attr("title",o)}var u=n.find(".concierge-widget-header .con-widget-title-section");t.hasCallback?u.addClass("clickable-title").addClass(".clickable-title"):u.removeClass("clickable-title").removeClass(".clickable-title")},ua.prototype.makePositionAbsolute=function(){var e;"absolute"!==this.$concierge.css("position")&&(this.stashedConciergeCss=this.$concierge.css(["top","bottom"]),e=this.$concierge.offset().top,this.$concierge.css({position:"absolute",top:e,bottom:""}))},ua.prototype.makePositionFixed=function(){var e,t;"fixed"!==this.$concierge.css("position")&&this.stashedConciergeCss&&(t="auto"!==this.stashedConciergeCss.top?"top":"bottom",e=this.$concierge.offset().top-document.body.scrollTop,this.$concierge.css({position:"fixed",top:e,bottom:"auto"}),"top"===t?this.$concierge.animate({top:this.stashedConciergeCss.top},{label:"makePositionFixedTop"}):this.$concierge.animate({top:Xe()-parseInt(this.stashedConciergeCss.bottom,10)-this.$concierge.height()},{label:"makePositionFixedBottom",done:function(){this.$concierge.css({top:"auto",bottom:this.stashedConciergeCss.bottom})}.bind(this)}))},ua.prototype.handleGetTabInfo=function(e,t){var n=this.concierge.cacheManager.getWidgetCache(t,"cookieId",!0);n||(n=Math.ceil(1e5*Math.random()),this.concierge.cacheManager.setWidgetCache(t,"cookieId",n,!0)),e.source.postMessage(JSON.stringify(po({origWindowName:window.name,cookieID:n,currentOrigin:window.location.protocol+window.location.host,previousOrigin:window.location.protocol+window.location.host,sessionId:this.concierge.cacheManager.getWidgetCache(t,"sessionId")})),e.origin)},ua.prototype.handleSetChatInProgress=function(e,t,n){var i=this.engagementWidgets.widgets[t];i&&void 0!==i.sendSearchGuid&&i.sendSearchGuid(e,n),this.concierge.cacheManager.setWidgetCache(t,"sessionId",Math.abs(parseInt(e))),e>0?this.markChat(e,"start"):e<0&&this.markChat(e,"end")},ua.prototype.setNotificationType=function(e){return e>=0&&e<=2&&(this.notificationType=e,!0)},ua.prototype.handleBroadcast=function(e,t,n){if(this[e+"HandleBroadcast"]&&this[e+"HandleBroadcast"](e,t,n))return A.resolve(!0);var i=this,r=this.engagementWidgets.widgets[e],o="widget:"+Qr(e)+":"+t;return(r&&r.updateBroadcastPayload?r.updateBroadcastPayload(o,n):A.resolve(n)).then((function(t){switch(function(e,t,n,i){try{switch(n){case"widget:chat:agentJoinedSession":Z(e.concierge,!0,t,i.agentId,i.agentName,i.sessionId,i.serviceLine,i.serviceLineId);break;case"widget:chat:agentLeftSession":i.agentId&&Z(e.concierge,!1,t,i.agentId,i.agentName,i.sessionId,i.serviceLine,i.serviceLineId);break;case"widget:chat:articleViewed":case"widget:kb:articleViewed":te(e.concierge,t,i.articleId,i.articleTitle);break;case"widget:chat:articleRated":case"widget:kb:articleRated":ne(e.concierge,t,i.articleId,i.articleTitle,i.search,i.ratingType,i.rating);break;case"widget:chat:articleCommented":case"widget:kb:articleCommented":ie(e.concierge,t,i.articleId,i.articleTitle,i.search,i.ratingType,i.rating,i.comment);break;case"widget:chat:chatSessionStarted":ee(e.concierge,!0,t,i.sessionId,i.serviceLine,i.serviceLineId);break;case"widget:chat:chatSessionEnded":ee(e.concierge,!1,t,i.sessionId,i.serviceLine,i.serviceLineId),function(e,t){var n=t.sessionId;n&&e.concierge.cacheManager.setWidgetCache("kbot","lastChatSessionEnded",n,!1)}(e,i);break;case"widget:email:emailSent":re(e.concierge,t,i.mailboxId);break;case"widget:kb:portalSearched":case"widget:chat:portalSearched":le(e.concierge,t,i.searchText,i.portalId,i.articlesList);break;case"widget:chat:prechatQuestionnaireComplete":de(e.concierge,t,i.serviceLine,i.serviceLineId)}}catch(e){_e.log("Error in processBroadcast"+e)}}(i,e,o,t),o){case"widget:chat:agentJoinedSession":t.device=i.concierge.contextMonitor.getLastDevice(),t.type=i.concierge.widgetManager.engagementWidgets.widgets[e].proactive?"PROACTIVE":"REACTIVE",Bn(o,t);break;default:Bn(o,t)}return null})).catch((function(e){_e.log("handleBroadcast Error:"+e)}))},ua.prototype.markChat=function(e,t){var n=this.concierge.cacheManager.getData("profileJSON"),i=this.journeyViewManager.markChat(n,e,t);this.concierge.cacheManager.setData("profileJSON",JSON.stringify(i))},ua.prototype.showNotification=function(e){_e.log("WidgetManager.showNotification called:",e.name),this.wmState.notification!==e&&xr(this.wmState),this.wmState.notification=e,function(e,t){var n=t.parameters,i=n.title,r=n.message,o=n.icon,a=n.callToAction,s=e.widgetsType.getNotification();s.attr("data-spot",t.spot),s.attr("data-widget",t.name),s.find(".concierge-notification-title").text(i||""),s.find(".con-notification-body").html(io(r));var c=s.find(".con-notification-calltoaction");a&&a.length?(c.show(),c.html(io(a)),c.attr("tabindex","0")):(c.hide(),c.attr("tabindex","-1"));var u=s.find(".con-notification-icon"),l="";if(o){u.show();var d=e.concierge.scriptLocation+"";xe(d,"/")||(d+="/"),l='<img alt="" tabindex="-1" src="'+(o=(o=o.replace(/\/SCRIPT_LOCATION\//g,d)).replace(/^http:/,""))+'" role="presentation">'}else u.hide();u.html(l)}(this,e),this.widgetsType.displayNotification(e,e.engagementId),this.setNotificationType(e.notificationType);var t,n,i=Qr(e.name);Bn("notification",{engagementId:e.engagementId,notificationType:ro(e.notificationType),widgetName:i,status:"displayed",rule:e.parameters.rule}),1===e.notificationType&&(t=this.concierge,n=Date.now(),t.cacheManager.setClientCache("lastNotified",n),Bn("proactiveOffer",{widgetName:i,status:"displayed",rule:e.parameters.rule,device:this.concierge.contextMonitor.getLastDevice()}),this.concierge.currentOfferCreatedAt=Date.now(),se(this.concierge,i,e.parameters.rule))},ua.prototype.notificationDisplayed=function(){return mr(this.wmState)},ua.prototype.broadcastCloseProactiveNotification=function(e,t){var n=e.parameters;Bn("proactiveOffer",{widgetName:n.widget,status:t,rule:n.rule,device:this.concierge.contextMonitor.getLastDevice()}),"accepted"===t?ce(this.concierge,n.widget,n.rule):"declined"===t&&ue(this.concierge,n.widget,n.rule)},ua.prototype.postMessageToWidget=function(e,t,n){var i,r,o=this,a=this.engagementWidgets.widgets[e],s=this.concierge.cacheManager.getWidgetCache(e,"active_session");"willClose"!==t&&"willTerminate"!==t||jr(this.wmState,a),s&&a.remoteURL&&n?(r=Xr(e)&&"object"==typeof a.remoteURL?a.remoteURL[a.portalId]:a.remoteURL,i=r.match(/^https?:\/\/[^/]+/)[0]):i="*";var c=this.widgetAreaIFrameForWidget(e);if(c.length){var u=c[0].contentWindow,l={widget:e,type:t,parameters:n},d=function(){u.postMessage(po(l),i),_e.log(l.type+" message posted to : "+i),"willTerminate"===t&&o.handleBroadcast(e,"widgetTerminated",{})},g=c.data("loadPromise");return g?g.then(d):zn(d)}return"willTerminate"===t&&o.handleBroadcast(e,"widgetTerminated",{}),A.resolve()},ua.prototype.callWidgetFunction=function(e,t,n){var i,r,o=this.engagementWidgets.widgets[e];o.remoteURL?(r=Xr(e)&&"object"==typeof o.remoteURL?o.remoteURL[o.portalId]:o.remoteURL,i=r.match(/^https?:\/\/[^/]+/)[0]):i="*";var a=this.widgetAreaIFrameForWidget(e),s=a[0].contentWindow,c={widget:e,type:"functionCall",parameters:{functionName:t,functionData:n}},u=function(){s.postMessage(po(c),i),_e.log(c.type+" message posted to : "+i)};return a.data("loaded")?A.resolve(u()):(a.data("loadPromise")||A.resolve()).then(u)},ua.prototype.writeSrcToIframe=function(e){var t=this.widgetAreaIFrameForWidget(e);if(t.length>0){var n=this.concierge.scriptLocation+"/widgets/"+e+"/"+this.concierge.assetVersion.widgets+"/index.html";t.attr("src",n)}},ua.prototype.widgetAreaForWidget=function(e){return this.$concierge.find("#concierge-widget-"+e)},ua.prototype.widgetAreaIFrameForWidget=function(e){return this.widgetAreaForWidget(e).find("iframe")},ua.prototype.loadWidget=function(e){var t=e.name,n=e.parameters,i=e.engagementId;if(_e.log('WidgetManager.loadWidget("'+t+'", "'+JSON.stringify(n)+'", '+i+'"): invoked.'),!this._disabled){var r=i;if(!e.state){"externalAPI"!==n.rule.source&&(e.widgetParameters=n);var o=Vn("#concierge-widget-area");if(0===this.widgetAreaForWidget(t).length){var a={widget:e,widgetName:t,CLOSE_ICON:this.concierge.getTranslation("common","CLOSE_ICON"),FOOTER:this.concierge.getTranslation("common","FOOTER")},s="";this.engagementWidgets.globalSettings&&!this.engagementWidgets.globalSettings.hideMoxieBranding&&(s=wo('<div class="concierge-widget-footer concierge-drag-handle">\n <span class="powered" aria-label="<%= FOOTER %> go moxie.com"><%=FOOTER%></span>\n\x3c!-- Generator: Adobe Illustrator 24.0.3, SVG Export Plug-In . SVG Version: 6.00 Build 0) --\x3e\n<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"\n\t viewBox="0 0 1000 321" style="enable-background:new 0 0 1000 321;" xml:space="preserve">\n<style type="text/css">\n\t.st0{fill:#FFFFFF;}\n</style>\n<g>\n\t<path class="st0" d="M228.07,162.16c37.08,0,67.15-30.06,67.15-67.15c0-37.09-30.06-67.15-67.15-67.15\n\t\tc-37.09,0-67.15,30.06-67.15,67.15C160.92,132.09,190.98,162.16,228.07,162.16z M228.07,68.41c14.69,0,26.6,11.91,26.6,26.6\n\t\tc0,14.69-11.91,26.6-26.6,26.6c-14.69,0-26.6-11.91-26.6-26.6C201.46,80.32,213.37,68.41,228.07,68.41z"/>\n\t<path class="st0" d="M143.14,74.86c-0.26-0.81-0.53-1.61-0.82-2.41c-0.22-0.62-0.46-1.23-0.7-1.84c-0.1-0.25-0.19-0.5-0.3-0.75\n\t\tc-12.28-30.37-46.11-49.72-82.55-39.03C37.8,36.99,21.24,53.44,14.99,74.4c-7.88,26.44,0.07,51.56,16.61,68.09\n\t\tc12.13,12.19,28.9,19.77,47.4,19.82l0.17,0c6.94,0,13.81-1.07,20.42-3.18c1.35-0.43,2.68-0.91,4.01-1.43\n\t\tc0.92-0.36,1.91,0.31,1.91,1.29l0,22.79l0,58.59l0.01,0.21l0,0.04c0.04,0.36-0.01,0.84-0.05,1.34c-0.05,0.5-0.09,0.99-0.09,1.49\n\t\tc0,15.71-13.63,28.26-29.56,26.18c-12.04-1.57-21.62-11.4-22.83-23.48c-1.58-15.77,8.19-27.42,26.8-28.36\n\t\tc1.52-0.08,3.62-0.16,5.28-0.22c0.94-0.03,2.63-0.41,3.02-0.69c1.68-1.23,1.41-2.91,1.41-3.36l-0.31-16.97l0.31-16.26\n\t\tc0-1.87-1.41-3.42-3.27-3.62c-2.31-0.24-4.64-0.37-6.97-0.37c-5.34,0-10.52,0.65-15.5,1.83c-0.56,0.13-1.13,0.25-1.68,0.4\n\t\tc0,0-0.01,0-0.01,0c-29.63,7.85-51.28,35.5-49.89,67.87c1.44,33.5,27.88,61.11,61.29,63.95c39.46,3.36,72.65-27.95,72.65-66.9\n\t\tc0-1.7,0.2-146.03,0.2-148.31c0-6.8-1.05-13.55-3.07-20C143.21,75.07,143.18,74.97,143.14,74.86z M102.42,107.68\n\t\tc-1.35,2.49-3.09,4.76-5.18,6.72c-4.92,4.63-11.34,7.18-18.06,7.18l-0.16,0l-0.15,0c-1.36,0-2.69-0.11-3.99-0.31\n\t\tc-0.25-0.04-0.51-0.09-0.76-0.13c-0.14-0.03-0.28-0.05-0.42-0.08c-11.23-2.3-19.88-11.68-21.08-23.27\n\t\tc-0.09-0.86-0.13-1.74-0.13-2.62c0-14.56,11.85-26.41,26.39-26.41l0.12,0l0.17,0c14.56,0,26.41,11.85,26.41,26.41\n\t\tC105.58,99.53,104.49,103.86,102.42,107.68z"/>\n\t<path class="st0" d="M960.54,177.63l-797.42,0c-2.4,0-4.34,1.94-4.34,4.34l0.31,14.07l-0.31,16.45c0,2.4,1.94,4.34,4.34,4.34\n\t\tl797.42,0c2.4,0,4.34-1.94,4.34-4.34l-0.31-16.28l0.31-14.24C964.88,179.57,962.94,177.63,960.54,177.63z"/>\n\t<path class="st0" d="M917.82,79.2l0-15.6l43.22,0c1.7,0,3.09-1.43,3.09-3.19V37.67c0-1.76-1.39-3.19-3.09-3.19l-45.72,0.34\n\t\tl-39.47-0.34c-1.7,0-3.09,1.43-3.09,3.19l0,117.07c0,1.76,1.39,3.19,3.09,3.19l41.15-0.17l44.26,0.17c2.53,0,4.59-2.05,4.59-4.59\n\t\tl0-27.24c0-1.76-1.39-3.19-3.09-3.19l-44.93,0l0-13.47l33.51,0c1.7,0,3.09-1.43,3.09-3.18l0-23.88c0-1.76-1.39-3.18-3.09-3.18\n\t\tL917.82,79.2z"/>\n\t<path class="st0" d="M485.85,40.75c0-0.95-0.04-1.92-0.12-2.88c-0.13-1.6-1.35-2.81-2.83-2.81l-20.05,0.34l-18.05-0.34\n\t\tc-0.78,0-1.54,0.36-2.07,0.98l-0.04,0.05l-40.36,43.14c-0.05,0.05-0.13,0.05-0.18,0L361.8,36.08l-0.04-0.05\n\t\tc-0.53-0.62-1.29-0.98-2.07-0.98l-16.92,0.34l-21.18-0.34c-1.48,0-2.7,1.21-2.83,2.81c-0.08,0.97-0.12,1.94-0.12,2.88l0,110.37\n\t\tl0.01,3.26c0,1.72,1.27,3.11,2.84,3.11l21.13-0.52l20.33,0.51c1.57,0,2.84-1.4,2.84-3.11l0-54.83c0-0.18,0.22-0.27,0.34-0.14\n\t\tl34.12,36.19l0.03,0.04c0.45,0.51,1.04,0.82,1.67,0.92v0.03l0.04,0h0v0l0.02,0l0.02,0c0.01,0,0.01,0,0.02,0l0.02,0\n\t\tc0.05,0,0.11,0,0.16,0c0.05,0,0.11,0.01,0.16,0l0.02,0c0.01,0,0.01,0,0.02,0l0.02,0l0.02,0v0h0l0.04,0v-0.03\n\t\tc0.63-0.09,1.23-0.41,1.67-0.92l0.03-0.04l34.12-36.19c0.12-0.13,0.34-0.04,0.34,0.14l0,54.83c0,1.72,1.27,3.11,2.84,3.11\n\t\tl21.51-0.51l19.95,0.52c1.57,0,2.84-1.4,2.84-3.11l0.01-3.26L485.85,40.75z"/>\n\t<path class="st0" d="M780.14,153.59l-48.52-59.39c-0.06-0.07-0.06-0.18,0-0.25l48-55.4l0.03-0.05c0.28-0.42,0.43-0.95,0.43-1.5\n\t\tc0-1.33-0.88-2.41-1.97-2.41l-27.29,0.51l-16.6-0.51c-0.55,0-1.07,0.28-1.47,0.79l-25.52,28.2c-0.36,0.39-0.97,0.39-1.33,0\n\t\tl-25.52-28.2c-0.39-0.51-0.92-0.79-1.47-0.79l-17.15,0.51l-26.73-0.51c-1.09,0-1.97,1.08-1.97,2.41c0,0.54,0.15,1.08,0.43,1.5\n\t\tl0.03,0.05l48,55.4c0.06,0.07,0.06,0.18,0,0.25l-48.52,59.39c-0.26,0.4-0.41,0.94-0.41,1.48v0.57c0,1.32,0.88,2.4,1.97,2.4\n\t\tl27.51-0.34l15.97,0.34c0.59,0,1.16-0.33,1.53-0.88l0.07-0.1l26.7-32.41c0.11-0.14,0.33-0.14,0.44,0l26.7,32.41l0.07,0.1\n\t\tc0.37,0.55,0.94,0.88,1.53,0.88l14.39-0.34l29.09,0.34c1.09,0,1.97-1.08,1.97-2.4v-0.57C780.55,154.52,780.4,153.99,780.14,153.59z\n\t\t"/>\n\t<g>\n\t\t<path class="st0" d="M611.83,49.23c-1.46-1.46-3.01-2.87-4.6-4.18c-2.4-1.98-4.96-3.8-7.61-5.41c-2.68-1.63-5.49-3.07-8.37-4.29\n\t\t\tc-1.17-0.5-2.43-0.98-3.96-1.51c-4.97-1.73-10.14-2.83-15.4-3.3c-0.37-0.03-0.74-0.07-1.11-0.1c-0.25-0.02-0.49-0.03-0.74-0.05\n\t\t\tc-0.59-0.04-1.17-0.07-1.76-0.09c-0.06,0-0.12-0.01-0.18-0.01l-0.16,0c-0.39-0.01-0.78-0.02-1.18-0.03l-0.25-0.01\n\t\t\tc-0.01,0-0.02,0-0.03,0l-0.01,0c-0.14,0-0.28,0-0.42,0c-0.14,0-0.28-0.01-0.42,0l-0.01,0c-0.01,0-0.02,0-0.03,0l-0.25,0.01\n\t\t\tc-0.4,0-0.79,0.02-1.18,0.03l-0.16,0c-0.06,0-0.12,0.01-0.18,0.01c-0.59,0.02-1.18,0.05-1.76,0.09c-0.25,0.01-0.49,0.03-0.74,0.05\n\t\t\tc-0.37,0.03-0.74,0.06-1.11,0.1c-5.26,0.47-10.43,1.57-15.4,3.3c-1.53,0.53-2.78,1.01-3.96,1.51c-2.88,1.22-5.7,2.66-8.37,4.29\n\t\t\tc-2.65,1.61-5.21,3.43-7.61,5.41c-1.59,1.31-3.14,2.72-4.6,4.18c-12.24,12.24-18.98,28.49-18.98,45.76\n\t\t\tc0,10.7,2.68,21.32,7.75,30.7c1.27,2.35,2.75,4.7,4.39,6.99l0.17,0.23c0.26,0.36,0.52,0.73,0.79,1.09\n\t\t\tc11.04,14.58,27.2,23.61,45.05,25.4c0.1,0.01,0.21,0.02,0.31,0.03c0.4,0.04,0.8,0.07,1.21,0.1c0.2,0.02,0.41,0.03,0.61,0.04\n\t\t\tc0.34,0.02,0.69,0.05,1.03,0.06c0.29,0.02,0.58,0.03,0.87,0.04c0.28,0.01,0.55,0.02,0.83,0.03c0.52,0.01,1.04,0.02,1.56,0.02\n\t\t\tc0.06,0,0.11,0,0.17,0c0.01,0,0.01,0,0.01,0c0,0,0.01,0,0.01,0c0.06,0,0.11,0,0.17,0c0.52,0,1.04-0.01,1.56-0.02\n\t\t\tc0.28-0.01,0.56-0.02,0.83-0.03c0.29-0.01,0.58-0.02,0.87-0.04c0.34-0.02,0.69-0.04,1.03-0.06c0.2-0.01,0.41-0.03,0.61-0.04\n\t\t\tc0.4-0.03,0.81-0.07,1.21-0.1c0.1-0.01,0.21-0.02,0.31-0.03c17.85-1.79,34.01-10.82,45.05-25.4c0.27-0.36,0.53-0.72,0.79-1.09\n\t\t\tl0.17-0.23c1.65-2.29,3.12-4.64,4.39-6.99c5.07-9.38,7.75-20,7.75-30.7C630.82,77.72,624.08,61.47,611.83,49.23z M589.27,103.03\n\t\t\tL589.27,103.03c-0.1,0.28-0.2,0.56-0.31,0.83c-0.26,0.67-0.51,1.25-0.76,1.77c-0.19,0.4-0.41,0.82-0.7,1.33\n\t\t\tc-0.38,0.68-0.81,1.37-1.27,2.03c-0.83,1.2-1.75,2.3-2.73,3.29l-0.07,0.07c-4.65,4.65-10.82,7.21-17.37,7.21c0,0-0.01,0-0.01,0\n\t\t\ts-0.01,0-0.01,0c-6.55,0-12.71-2.56-17.37-7.21l-0.07-0.07c-0.98-0.98-1.9-2.09-2.73-3.29c-0.46-0.66-0.89-1.35-1.27-2.03\n\t\t\tc-0.29-0.51-0.51-0.93-0.7-1.33c-0.25-0.52-0.5-1.09-0.76-1.77c-0.1-0.27-0.21-0.55-0.31-0.83l0,0c-0.9-2.59-1.36-5.3-1.36-8.04\n\t\t\tc0-2.9,0.5-5.74,1.49-8.43c0.82-2.23,1.96-4.34,3.39-6.25c0.31-0.41,0.65-0.84,1.09-1.34c0.44-0.51,0.84-0.95,1.23-1.33\n\t\t\tc4.65-4.65,10.81-7.2,17.36-7.2c0,0,0.01,0,0.01,0s0.01,0,0.01,0c6.55,0,12.71,2.56,17.36,7.2c0.38,0.38,0.78,0.82,1.23,1.33\n\t\t\tc0.44,0.51,0.78,0.93,1.09,1.34c1.43,1.91,2.57,4.02,3.39,6.25c0.99,2.7,1.49,5.54,1.49,8.43\n\t\t\tC590.63,97.73,590.17,100.43,589.27,103.03z"/>\n\t</g>\n\t<path class="st0" d="M845.57,88c-0.05-15.29-0.1-27.38-0.14-35.93c-0.03-4.9,0.12-8.68,0.09-11.54c-0.01-0.56-0.01-1.52-0.01-2.48\n\t\tc0-1.68-1.42-3.04-3.17-3.04l-18.85,0.51L804.31,35c-1.75,0-3.17,1.36-3.17,3.04c0,0.97,0,1.93-0.01,2.48\n\t\tc-0.03,2.86,0.12,6.64,0.09,11.54c-0.05,8.55-0.1,20.64-0.15,35.93c-0.08,25.83-0.13,51.91-0.13,52.26l0,16.23\n\t\tc0,1.05,0.89,1.9,1.98,1.9l20.4-0.43h0.69l19.71,0.43c1.09,0,1.98-0.85,1.98-1.9l0-16.23C845.71,139.91,845.65,113.83,845.57,88z"\n\t\t/>\n\t<g>\n\t\t<path class="st0" d="M991.06,19.08c0,5.52-4.4,9.97-9.9,9.97c-5.52,0-9.95-4.45-9.95-9.97c0-5.52,4.43-9.92,9.95-9.92\n\t\t\tC986.66,9.16,991.06,13.56,991.06,19.08z M989.2,19.08c0-4.45-3.63-8.05-8.03-8.05c-4.48,0-8.08,3.6-8.08,8.05\n\t\t\tc0,4.45,3.6,8.11,8.08,8.11C985.57,27.19,989.2,23.53,989.2,19.08z M979.91,24.81h-2.61l0-11.55h4.83c1.79,0,2.93,1.07,2.93,3.04\n\t\t\tc0,1.47-0.61,2.56-2.32,2.83v0.05c0.56,0.03,2.27,0.16,2.27,2.24c0,0.75,0.05,2.91,0.29,3.39h-2.56\n\t\t\tc-0.35-0.69-0.35-1.47-0.35-2.24c0-1.36,0.21-2.53-1.81-2.53h-0.67L979.91,24.81z M979.91,18.41h1.17c1.04,0,1.36-0.96,1.36-1.71\n\t\t\tc0-1.09-0.53-1.52-1.36-1.52h-1.17L979.91,18.41z"/>\n\t</g>\n</g>\n</svg>\n</div>')(a)),a.moxieBranding=s;var c=wo('<div class="concierge-widget" id="concierge-widget-<%= widgetName %>" data-widget="<%= widgetName %>">\n <header class="concierge-widget-header concierge-drag-handle">\n <div class="con-widget-title-section">\n <div class="con-widget-icon"></div>\n <h2 class="con-widget-title" tabindex="0"><%= widget.title %></h2>\n </div>\n <div class="con-close-area">\n <button type="button" class="con-close-widget" aria-label="<%= CLOSE_ICON %>">\n <svg focusable="false" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" enable-background="new 0 0 20 20" stroke-width="0">\n <title><%= CLOSE_ICON %></title>\n <polygon points="17.3,1.1 10.2,8.3 3.1,1.1 1.3,2.9 8.4,10 1.3,17.1 3.1,18.9 10.2,11.8 17.3,18.9 19.1,17.1 11.9,10 19.1,2.9 "/>\n </svg>\n </button>\n </div>\n </header>\n\n <div id="concierge-iframe-cover" class="widget-content"></div>\n <iframe\n allow="geolocation"\n frameborder="no"\n class="widget-content"\n aria-live="polite"\n aria-atomic="true">\n </iframe>\n <%= moxieBranding %>\n</div>\n')(a);c=c.replace(/\/SCRIPT_LOCATION\//g,this.concierge.scriptLocation+"/"),o.append(c)}void 0===i&&(i=this.createEngagementRecord(e),r=i),e.state=2,e.proactive=n&&n.proactive||!1,_e.log("WidgetManager.loadWidget("+t+"): set widget.proactive="+e.proactive),e.beforeLoad();var u=this,l=this.concierge.cacheManager.getWidgetCache(t,"active_session");if(l||e.shouldReplaceIframeSrc){var d=this.widgetAreaIFrameForWidget(t),g=e.getRemoteURL();_e.log("WidgetManager.loadWidget("+t+"): requests iframe src="+g,"hasActive:",l,"shouldReplace:",e.shouldReplaceIframeSrc),d.data("loadPromise",i=new A((function(e){d.attr("src",g),d.on("load",(function(){d.data("loaded")||(d.data("loaded",!0),e(r))}))})))}else void 0!==e.prepareToLoadPromise?e.prepareToLoadPromise.then((function(){u.writeSrcToIframe(t)})):this.writeSrcToIframe(t);this.updateWidgetTitle(t,{text:e.titleBar&&e.titleBar.text?"title":"",graphic:e.titleBar&&e.titleBar.graphic?e.titleBar.graphic:null})}var h=this.concierge.getTranslation(t,"title","Concierge");return this.widgetAreaIFrameForWidget(t).attr("title",h),i}},ua.prototype.replaceWidget=function(e){var t=this,n={status:!0,ref:e,parameters:e.parameters,ruleSettings:this.concierge.rulesEngine.getSiteSettings(),engagementId:e.engagementId};return e.beforeAdd(n).then((function(n){return n&&n.status&&Cr(t.wmState,e,!0),n}))},ua.prototype.getSeenChannelsHosts=function(){return this.seenChannelsHosts||(this.seenChannelsHosts=this.concierge.cacheManager.getClientCache("channelsHosts")||[]),this.seenChannelsHosts},ua.prototype.registerChatHost=function(e){var t=this.getSeenChannelsHosts();ke(t,e)<0&&(t.push(e),this.seenChannelsHosts=t,this.concierge.cacheManager.setClientCache("channelsHosts",t,!1))},ua.prototype.showWidget=function(e){var t=e.name,n=e.parameters,i=e.engagementId,r=this.wmState;_e.log("WidgetManager.showWidget("+t+", "+JSON.stringify(e.parameters)+", "+i+"): invoked.");var o=A.resolve();if(e){var a=this,s=Vn("#concierge-widget-area");Xr(t)&&n.host&&this.registerChatHost(n.host),o=o.then((function(){return e.spot&&Zr(r,e)?a.replaceWidget(e):"function"==typeof e.shouldRebuildIframe&&e.shouldRebuildIframe()?(a.widgetAreaIFrameForWidget(t).replaceWith('<iframe frameborder="no" class="widget-content" allow="geolocation" sandbox="allow-scripts allow-forms allow-same-origin allow-orientation-lock allow-pointer-lock allow-popups allow-popups-to-escape-sandbox allow-top-navigation allow-top-navigation-by-user-activation"></iframe>'),zn((function(){a.writeSrcToIframe(t)})).then((function(){return a.concierge.cacheManager.removeWidgetCache(t,"rebuildIframe",!1)}))):void 0})).then((function(){e.proactive=n&&n.proactive||!1,_e.log("WidgetManager.showWidget("+e.label()+"): set widget.proactive="+e.proactive)})).then((function(){return e.state?A.resolve(a.postMessageToWidget(t,"willShow",n)).then((function(){return a.concierge.cacheManager.getWidgetCache(t,"engagement_id",!0)})):a.loadWidget(e)})).then((function(n){return n&&null!==a.getEngagementRecord(n)||(n=a.createEngagementRecord(e)),e.engagementId=i=n,a.concierge.cacheManager.setWidgetCache(t,"engagement_id",i,!0)})).then((function(){var e,n=a.getEngagementRecord(i);if(Xr(t)){if(null===n)_e.log('WidgetManager.showWidget("'+i+'"): was null.');else if(n.proactive&&void 0===n.chat.time_to_decide){var r=new Date(n.time).getTime();n.chat.time_to_decide=Math.round(((new Date).getTime()-r)/1e3),n.chat.missed_reason=0,n.decision_type="Accepted",e=a.setEngagementRecord(i,n)}}else null!==n&&n.proactive&&(n.decision_type="Accepted",e=a.setEngagementRecord(i,n));return e||(e=A.resolve()),e.then((function(){return a.concierge.contextMonitor.recordEngagementValue()}))})).then((function(){if(a.notificationDisplayed())return _e.log("WidgetManager.showWidget("+e.label()+"): ignoring the notification"),xr(r)})).then((function(){return s.addClass("con-open"),a.$concierge.addClass("con-open-widget"),r.open=e,Er(a.wmState,e.spot),a.openWidget!==t?(a.widgetsType.openWidget(e),Bn("widgetOpened",{widgetName:t,source:n.rule.source}),a.openWidget=t):a.widgetsType.makeWidgetActive(a.widgetAreaForWidget(t)),null}))}return o},ua.prototype.forceBlur=function(){if(this.needsForceBlur){Vn("#concierge").append('<input type="text" id="fakefocus" style="width:1px; height:1px" />');var e=Vn("#fakefocus");e.focus(),e.blur(),e.remove(),this.needsForceBlur=!1}},ua.prototype.hideWidget=function(e){var t=this,n=t.postMessageToWidget(t.openWidget,"willHide");return e||(n=n.then((function(){return no(t,!1)}))),n},ua.prototype.closeWidget=function(e){var t=this,n=t.postMessageToWidget(t.openWidget,"willClose"),i=this.wmState.open;return e||t.concierge.cacheManager.getWidgetCache(t.openWidget,"willHandleClose",!0)||(n=n.then((function(){return no(t,!0)})).then((function(){i&&i.closeWidget()}))),n},ua.prototype.fixPosition=function(e){this.widgetsType.fixPosition&&this.widgetsType.fixPosition(e,this.$concierge)},ua.prototype.expandConcierge=function(){_e.log("WidgetManager.expandConcierge(): invoked.")},ua.prototype.collapseConcierge=function(){_e.log("WidgetManager.collapseConcierge(): invoked.")},ua.prototype.preloadCSS=function(){return la(this),function(e){var t="concierge-style-"+e.widgetsType.cssType;return 0===Vn("#"+t).length?new A((function(n){var i=e.concierge.scriptLocation+"/widgets/"+e.concierge.assetVersion.widgets+"/"+e.widgetsType.cssType+".css",r=document.getElementsByTagName("head")[0],o=document.createElement("link");o.onload=function(){n(!0)},o.id=t,o.rel="stylesheet",o.type="text/css",o.href=i,o.media="all",r.appendChild(o)})):A.resolve(!0)}(this)},ua.prototype.init=function(){_e.log("WidgetManager.init(): invoked."),this.$concierge=Vn("#concierge"),0===this.$concierge.length&&ha(this)},ua.prototype.showConcierge=function(){_e.log("WidgetManager.showConcierge(): invoked."),Vn("#concierge-widgets ul li").length>0&&Vn("#concierge").show()},ua.prototype.hideConcierge=function(){_e.log("WidgetManager.hideConcierge(): invoked."),Vn("#concierge").hide()},ua.prototype.getWidgetPath=function(e){return this.concierge.widgetPath+e+"/"},ua.prototype.setServiceLineId=function(e,t){var n=this;if(t&&t.parameters){var i=t.name,r=t.parameters;r.serviceLineId!==e.serviceLineId&&(r.serviceLineId=e.serviceLineId,this.concierge.serviceLines.getName(e.serviceLineId).then((function(i){return r.serviceLine=i,r.serviceLineId=e.serviceLineId,r.parameters&&r.parameters.queue&&(r.parameters.queue=e.serviceLineId),Pr(n.wmState,t),null})).catch((function(t){_e.log('setServiceLineId("'+i+'", '+JSON.stringify(e)+"): ERROR: "+t)})))}},ua.prototype.loadActiveWidgets=function(){var e=this,t=e.wmState.wm.concierge.cacheManager.getClientCache("activeWidgets")||[],n=null,i=[];e.loadingActiveWidgets=!0;for(var r=0;r<t.length;r++)t[r].loadParams&&(n=this.concierge.cacheManager.getWidgetCache(t[r].widgetName,"engagement_id",!0),i.push(this.addWidget(t[r].loadParams,t[r].loadParams.rule,n).then((function(t){if(t&&t.status)return Pr(e.wmState,t.ref).then((function(n){return Er(e.wmState,t.ref.spot),n}))}))));return A.all(i).finally((function(){delete e.loadingActiveWidgets}))},ua.prototype.notify=function(e,t){_e.log("WidgetManager.notify called with:",e,t);var n=e.widget,i=this.createWidget(n);return e.rule=t||{},e.proactive=!0,i.parameters=e,_r(this.wmState,i)},ua.prototype.terminateWidget=function(e,t){void 0===t&&(t=!1);var n=this,i=e.name;if(!Xr(i))return A.resolve(!0);if(!Ar(n.wmState,e)||!function(e,t){return t&&0!==t.state}(n.wmState,e))return A.resolve(!0);var r=new A((function(e,r){var o=null;t&&(o=setTimeout((function(){r("willTerminate not answered with widgetTerminated in timely manner")}),1e3)),n[i+"HandleBroadcast"]=function(t,r){return t===i&&"widgetTerminated"===r&&(null!==o&&clearTimeout(o),delete n[i+"HandleBroadcast"],_e.log("WidgetManager.clearHistory: widgetTerminated answered. Resolving Promise"),e(!0),!0)}}));return n.postMessageToWidget(i,"willTerminate").then((function(){return r}))},ua.prototype.disable=function(){this._disabled=!0},ua.prototype.enable=function(){this._disabled&&delete this._disabled},ua.prototype.clearHistory=function(){for(var e=this,t={},n=this.getSeenChannelsHosts(),i=0;i!==n.length;i++)t[n[i]]=!0;var r=A.resolve(!0);e.disable();for(var o=function(t){return function(){return e.removeWidget(t)}},a=function(e){return function(){var t=document.createElement("iframe");t.setAttribute("id","concierge.clear.history"),t.setAttribute("tabindex","-1"),t.style.display="none",t.style.height="400px",t.style.width="300px";var n,i=e+"/netagent/ClearChatSession.aspx";return t.setAttribute("src",i),t.setAttribute("sandbox","allow-scripts allow-same-origin"),new A((function(i){var r=function(e){"SessionCleared"===e.data&&(window.removeEventListener("message",r,!1),e.fromTimeout?i(!1):i(!0))};window.addEventListener("message",r,!1),document.body.appendChild(t),n=window.setTimeout((function(){_e.log("WidgetManager.clearHistory("+e+'): timeout waiting for "SessionCleared" event. Proceeding with clearHistory process.'),r({data:"SessionCleared",fromTimeout:!0})}),1e3)})).then((function(e){e&&n&&clearTimeout(n),t.remove?t.remove():null!==t.parentNode&&t.parentNode.removeChild(t)}))}},s=Object.keys(e.wmState.spots),c=[],u=0;u<s.length;u+=1){var l=gr(e.wmState,s[u]);if(l&&l.widget){var d=s[u];l.widget.parameters&&l.widget.parameters.host&&(t[l.widget.parameters.host]=!0),c.push(e.terminateWidget(l.widget,!0).catch((function(e){_e.error("Could not terminate widget in spot "+d+": "+e)})).then(o(l.widget)))}}r=r.then(A.all(c)),c=[];for(var g=Object.keys(t),h=0;h<g.length;h+=1)c.push(a(g[h])());return r=r.then(A.all(c))},ua.prototype.destroy=function(){if(ga(this),this.draggableWidgetArea&&(this.draggableWidgetArea.destroy(),delete this.draggableWidgetArea,this.removeDraggableData()),this.wmState){for(var e in this.removeWidget(this.wmState.notification),this.wmState.spots){var t=gr(this.wmState,e);this.removeWidget(t.reactive),this.removeWidget(t.widget)}for(var n=ze(this.wmState.alive),i=0;i<n.length;i++)this.removeWidget(n[i])}Vn("#concierge-widget-area .concierge-widget iframe").remove(),Vn("#concierge-widget-area .concierge-widget").remove(),this.widgetsType.destroy&&this.widgetsType.destroy()},ua.prototype.isValidEngagementConfig=function(e){var t;if(void 0===e||!e.widget||!this.KNOWN_WIDGETS[e.widget])return!1;for(t=0;t<this.KNOWN_WIDGETS[e.widget].requires.length;t++)if(void 0===e[this.KNOWN_WIDGETS[e.widget].requires[t]])return!1;return!0};var fa=function(e){var t,n=e.Symbol;return"function"==typeof n?n.observable?t=n.observable:(t=n("observable"),n.observable=t):t="@@observable",t}("undefined"!=typeof self?self:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof module?module:Function("return this")()),pa=function(){return Math.random().toString(36).substring(7).split("").join(".")},va={INIT:"@@redux/INIT"+pa(),REPLACE:"@@redux/REPLACE"+pa(),PROBE_UNKNOWN_ACTION:function(){return"@@redux/PROBE_UNKNOWN_ACTION"+pa()}};function ma(e){if("object"!=typeof e||null===e)return!1;for(var t=e;null!==Object.getPrototypeOf(t);)t=Object.getPrototypeOf(t);return Object.getPrototypeOf(e)===t}function wa(e,t,n){var i;if("function"==typeof t&&"function"==typeof n||"function"==typeof n&&"function"==typeof arguments[3])throw new Error("It looks like you are passing several store enhancers to createStore(). This is not supported. Instead, compose them together to a single function.");if("function"==typeof t&&void 0===n&&(n=t,t=void 0),void 0!==n){if("function"!=typeof n)throw new Error("Expected the enhancer to be a function.");return n(wa)(e,t)}if("function"!=typeof e)throw new Error("Expected the reducer to be a function.");var r=e,o=t,a=[],s=a,c=!1;function u(){s===a&&(s=a.slice())}function l(){if(c)throw new Error("You may not call store.getState() while the reducer is executing. The reducer has already received the state as an argument. Pass it down from the top reducer instead of reading it from the store.");return o}function d(e){if("function"!=typeof e)throw new Error("Expected the listener to be a function.");if(c)throw new Error("You may not call store.subscribe() while the reducer is executing. If you would like to be notified after the store has been updated, subscribe from a component and invoke store.getState() in the callback to access the latest state. See https://redux.js.org/api-reference/store#subscribelistener for more details.");var t=!0;return u(),s.push(e),function(){if(t){if(c)throw new Error("You may not unsubscribe from a store listener while the reducer is executing. See https://redux.js.org/api-reference/store#subscribelistener for more details.");t=!1,u();var n=s.indexOf(e);s.splice(n,1),a=null}}}function g(e){if(!ma(e))throw new Error("Actions must be plain objects. Use custom middleware for async actions.");if(void 0===e.type)throw new Error('Actions may not have an undefined "type" property. Have you misspelled a constant?');if(c)throw new Error("Reducers may not dispatch actions.");try{c=!0,o=r(o,e)}finally{c=!1}for(var t=a=s,n=0;n<t.length;n++){(0,t[n])()}return e}function h(e){if("function"!=typeof e)throw new Error("Expected the nextReducer to be a function.");r=e,g({type:va.REPLACE})}function f(){var e,t=d;return(e={subscribe:function(e){if("object"!=typeof e||null===e)throw new TypeError("Expected the observer to be an object.");function n(){e.next&&e.next(l())}return n(),{unsubscribe:t(n)}}})[fa]=function(){return this},e}return g({type:va.INIT}),(i={dispatch:g,subscribe:d,getState:l,replaceReducer:h})[fa]=f,i}function ya(e,t){var n=t&&t.type;return"Given "+(n&&'action "'+String(n)+'"'||"an action")+', reducer "'+e+'" returned undefined. To ignore an action, you must explicitly return the previous state. If you want this reducer to hold no value, you can return null instead of undefined.'}function ba(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Sa(e,t){var n=Object.keys(e);return Object.getOwnPropertySymbols&&n.push.apply(n,Object.getOwnPropertySymbols(e)),t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n}function Ca(e){for(var t=arguments,n=1;n<arguments.length;n++){var i=null!=t[n]?t[n]:{};n%2?Sa(i,!0).forEach((function(t){ba(e,t,i[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(i)):Sa(i).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(i,t))}))}return e}function _a(){for(var e=arguments,t=arguments.length,n=new Array(t),i=0;i<t;i++)n[i]=e[i];return 0===n.length?function(e){return e}:1===n.length?n[0]:n.reduce((function(e,t){return function(){return e(t.apply(void 0,arguments))}}))}function Ea(e){return function(t){var n=t.dispatch,i=t.getState;return function(t){return function(r){return"function"==typeof r?r(n,i,e):t(r)}}}}var Ia=Ea();Ia.withExtraArgument=Ea;var Na=function(e,t){return function(e){for(var t=Object.keys(e),n=t.length,i=new Array(n);n--;)i[n]=[t[n],e[t[n]]];return i}(t).filter((function(t){var n=t[0];t[1];return n!==e})).reduce((function(e,t){var n,i=t[0],r=t[1];return cn(e,((n={})[i]=r,n))}),{})},Oa="function"==typeof CustomEvent?function(e,t){return new CustomEvent(e,{detail:t})}:function(e,t){var n=document.createEvent("CustomEvent");return n.initCustomEvent(e,!1,!1,t),n},Ta=function(e,t,n){var i=Oa("GoMoxie:"+e,t);return i.version=n,i},ka=["u","w","W","p","q","V","v","$"],xa={events:[],eventsCount:0,sending:[],batchTimerState:"INITIALIZED",lastServerCallOK:!0,priorityEventAdded:!1,prevState:{},terminating:!1,failureStreak:0};var Da=function(e){for(var t=Object.keys(e),n={},i=0;i<t.length;i++){var r=t[i];"function"==typeof e[r]&&(n[r]=e[r])}var o,a=Object.keys(n);try{!function(e){Object.keys(e).forEach((function(t){var n=e[t];if(void 0===n(void 0,{type:va.INIT}))throw new Error('Reducer "'+t+"\" returned undefined during initialization. If the state passed to the reducer is undefined, you must explicitly return the initial state. The initial state may not be undefined. If you don't want to set a value for this reducer, you can use null instead of undefined.");if(void 0===n(void 0,{type:va.PROBE_UNKNOWN_ACTION()}))throw new Error('Reducer "'+t+"\" returned undefined when probed with a random type. Don't try to handle "+va.INIT+' or other actions in "redux/*" namespace. They are considered private. Instead, you must return the current state for any unknown actions, unless it is undefined, in which case you must return the initial state, regardless of the action type. The initial state may not be undefined, but can be null.')}))}(n)}catch(e){o=e}return function(e,t){if(void 0===e&&(e={}),o)throw o;for(var i=!1,r={},s=0;s<a.length;s++){var c=a[s],u=n[c],l=e[c],d=u(l,t);if(void 0===d){var g=ya(c,t);throw new Error(g)}r[c]=d,i=i||d!==l}return(i=i||a.length!==Object.keys(e).length)?r:e}}({schemaVersion:function(e,t){return void 0===e&&(e=1),e},eventService:function(e,t){void 0===e&&(e=xa);var n=Na("prevState",e),i=JSON.parse(JSON.stringify(n));if(!e.terminating)switch(t.type){case"ADD_EVENT":return cn(n,{prevState:i},{events:e.events.concat([Na("type",t)]),eventsCount:e.eventsCount+1});case"ADD_PRIORITY_EVENT":return cn(n,{prevState:i},{events:e.events.concat([Na("type",t)]),eventsCount:e.eventsCount+1,priorityEventAdded:!0})}switch(t.type){case"SEND_EVENTS":return cn(n,{prevState:i},{events:[],eventsCount:0,sending:e.events});case"SEND_PRIORITY_EVENTS":return cn(n,{prevState:i},{events:[],eventsCount:0,sending:e.events,priorityEventAdded:!1});case"CLEAR_SENT":return cn(n,{prevState:i},{sending:[],lastServerCallOK:!0,failureStreak:0});case"RETRY_SENT":return cn(n,{prevState:i},{events:e.sending.concat(e.events),eventsCount:e.eventsCount+e.sending.length,sending:[],lastServerCallOK:!1,failureStreak:e.failureStreak+1});case"SET_TIMER_STATE":return cn(n,{prevState:i},{batchTimerState:t.value||!1});case"TERMINATING":return cn(n,{prevState:i},{terminating:!0})}return e}});function Ma(e,t,n){var i=3e4;return n>0&&(i+=1333*Math.pow(n,2),i=Math.min(3e5,i)),new A((function(n,r){var o=new XMLHttpRequest;o.open("POST",t.serverEndpoint),o.timeout=i,o.setRequestHeader("Content-Type","application/json"),o.setRequestHeader("Accept","application/json"),o.onload=function(e){return n({status:o.status,body:o.response})},o.onerror=function(e){return n({status:o.status,message:"Could not read error response, probably because CORS headers are missing."})},o.send(JSON.stringify(function(e){for(var t={e:[]},n={},i=JSON.parse(JSON.stringify(e)),r=0;r<ka.length;r++){var o=ka[r],a=La(i.map((function(e){return e.payload[o]})));if(1===a.length&&void 0!==a[0]){n[o]=a[0];for(var s=0;s<i.length;s++){delete i[s].payload[o]}}}return(t=cn(n,t)).e=i.map((function(e){return e.payload})),t.d=Date.now(),t}(e)))})).catch((function(e){return console.error("Concierge encountered a fatal error when trying to send events:",e),{status:-1,message:e.message}}))}function La(e){for(var t=[],n=0;n<e.length;n++){var i=e[n];-1===Aa(t,i)&&t.push(i)}return t}function Aa(e,t,n){var i=isFinite(n)?Math.floor(n):0,r=e instanceof Object?e:new Object(e),o=isFinite(r.length)?Math.floor(r.length):0;if(i>=o)return-1;if(i<0&&(i=Math.max(o+i,0)),void 0===t){do{if(i in r&&void 0===r[i])return i}while(++i<o)}else do{if(r[i]===t)return i}while(++i<o);return-1}var Wa=function(e,t){if("SEND_PRIORITY_EVENTS"===e){var n=new Ta("PriorityEvents",{status:t});window.dispatchEvent(n)}},Ra=function(e,t){return function(n,i){if(i().eventService.events.length>0){n({type:e});var r=i().eventService.failureStreak;Ma(i().eventService.sending,t,r).then((function(t){t&&!i().eventService.terminating&&(t.status>=200&&t.status<300||t.status>=400&&t.status<500?(Wa(e,!0),n(ja())):r>=8640?(Wa(e,!1),n(ja())):(Wa(e,!1),n({type:"RETRY_SENT"})))}))}}};function Pa(e){return Ra("SEND_EVENTS",e)}function ja(){return{type:"CLEAR_SENT"}}var Fa=function(e,t){void 0===t&&(t=function(e){return e}),this.timeout_in_ms=e,this.stateChangeCallbackFn=t,this.timerState="INITIALIZED"};Fa.prototype.timerInternalState=function(){return this.timerState},Fa.prototype.startTimer=function(e){var t=this;void 0===e&&(e=this.timeout_in_ms);this.timer=setTimeout((function(){t.timerState="EXPIRED",t.stateChangeCallbackFn("EXPIRED")}),e),this.timerState="RUNNING",this.stateChangeCallbackFn("RUNNING")},Fa.prototype.cancelTimer=function(){clearTimeout(this.timer),this.timerState="CANCELLED",this.stateChangeCallbackFn("CANCELLED")};var Va=[function(e){var t={schemaVersion:1,eventService:cn({},e.eventService,{terminating:!1})};return cn({},e,t)}],qa=function(){try{var e=localStorage.getItem("moxieState");if(null===e)return;return function(e,t){void 0===t&&(t=Va);var n=e.schemaVersion||0,i=t.length;n<i&&t.slice(n,i).forEach((function(t){return e=t(e)}));return e}(JSON.parse(e))}catch(e){return}};function Ja(e,t,n){e.subscribe((function(){var i=e.getState().eventService.prevState.eventsCount,r=e.getState().eventService.eventsCount;if(i!==r){var o=e.getState().eventService.prevState.lastServerCallOK,a=e.getState().eventService.lastServerCallOK,s=e.getState().eventService.priorityEventAdded,c=0===e.getState().eventService.sending.length;c&&s?(t.cancelTimer(),e.dispatch(function(e){return Ra("SEND_PRIORITY_EVENTS",e)}(n))):c&&a&&r>=5?(t.cancelTimer(),e.dispatch(Pa(n))):0===i&&r>=1?(t.cancelTimer(),a?t.startTimer():t.startTimer(1e4)):!0===o&&!1===a&&(t.cancelTimer(),t.startTimer(1e4))}})),e.subscribe((function(){var t=e.getState().eventService.prevState.batchTimerState,i=e.getState().eventService.batchTimerState;t!==i&&"EXPIRED"===i&&e.dispatch(Pa(n))})),e.subscribe((function(){var t=e.getState().eventService.prevState.eventsCount,n=e.getState().eventService.eventsCount,i=e.getState().eventService.prevState.sending,r=e.getState().eventService.sending,o=e.getState().eventService.terminating;(t!==n||i!==r)&&!o&&function(e){try{var t=JSON.stringify(e);localStorage.setItem("moxieState",t)}catch(e){return}}(e.getState())}))}var Ha=function(e){if(this.store=null,this.batchTimer=null,this.config=e,this.startEventService(),void 0===this.config.serverEndpoint)throw"serverEndpoint config value is required for the EventService"};function $a(e){this.scriptElement=e,this.engagementWidgetsVersion=null,this.engagementRulesVersion=null}Ha.prototype.notifyEventService=function(e){this.store.dispatch({type:"ADD_EVENT",payload:e})},Ha.prototype.notifyEventServiceImmediately=function(e){this.store.dispatch({type:"ADD_PRIORITY_EVENT",payload:e})},Ha.prototype.startEventService=function(){var e=qa();null!=e&&null!==e.eventService&&void 0!==e.eventService&&(e.eventService.failureStreak=0),this.store=wa(Da,e,function(){for(var e=arguments,t=arguments.length,n=new Array(t),i=0;i<t;i++)n[i]=e[i];return function(e){return function(){var t=e.apply(void 0,arguments),i=function(){throw new Error("Dispatching while constructing your middleware is not allowed. Other middleware would not be applied to this dispatch.")},r={getState:t.getState,dispatch:function(){return i.apply(void 0,arguments)}},o=n.map((function(e){return e(r)}));return Ca({},t,{dispatch:i=_a.apply(void 0,o)(t.dispatch)})}}}(Ia));var t,n=(t=this.store,function(e){t.dispatch({type:"SET_TIMER_STATE",value:e})});this.batchTimer=new Fa(5e3,n),Ja(this.store,this.batchTimer,this.config),this.store.dispatch({type:"CLEAR_SENT"}),this.batchTimer.startTimer()},Ha.prototype.stopEventService=function(){this.store.dispatch({type:"TERMINATING"}),this.batchTimer.cancelTimer(),this.store.dispatch({type:"CLEAR_SENT"}),this.store.dispatch(Pa(this.config)),function(){try{localStorage.removeItem("moxieState")}catch(e){return}}()},$a.prototype.logError=function(e,t){var n=e+": ";t.stack?n+=t.stack:t.message?n+=t.message:n+=t.toString(),_e.error(n)},$a.prototype.getTranslation=function(e,t,n){return this.localization.translate(e+".client."+t,n)},$a.prototype.registerNamespace=function(){return window.GoMoxie=window.GoMoxie||{},window.GoMoxie.concierge={},window.GoMoxie.console=_e,this.isTestMode||_e.suppressLogs(),window.GoMoxie};function Ba(){return function(){var e,t=["JxBrowser","MoxieAgentClient","JavaFX"];for(e=0;e!==t.length;e++)if(-1!==window.navigator.userAgent.indexOf(t[e]))return!1;var n=!1,i=Ci(window.navigator);if(-1!==ke(["chrome","firefox","safari","msie","android"],i[0]))if("msie"===i[0]){if(-1!==window.navigator.userAgent.toLowerCase().indexOf("iemobile"))return!1;n=parseInt(i[1])>=11}else n="android"!==i[0]||parseFloat(i[1])>=5;else n=!1;return n}()}function Ua(){var e="Concierge failed to load: ";if(!Ba())throw Bn("conciergeFailedToLoad",e+="unsupported browser"),new Error(e);if(!function(){var e=!1;try{e=void 0!==window.localStorage.getItem("MoxieUndefinedKey")}catch(e){_e.error(e)}return e}())throw Bn("conciergeFailedToLoad",e+="localStorage required"),new Error(e);return!0}$a.prototype.prepare=function(e,t,n){n=n||{},Vn("#concierge").remove(),this.url=e,this.pageTitle=t,this.scriptLocation=this.scriptElement.getScriptLocation(),this.isTestMode=this.scriptElement.getTestMode(),this.logDisabled=this.scriptElement.getLogFlag(),this.clientName=this.scriptElement.getClientName(),this.positionMethod=this.scriptElement.getDisplayConfiguration().positionMethod,this.conciergeHost=this.scriptElement.getConciergeHost(),this.separator=this.scriptElement.getConciergeSeparator(),this.protocol=0===this.scriptLocation.indexOf("https:")?"https:":"http:",this.currentOfferCreatedAt=null,this.gomoxie=this.registerNamespace(),this.loadState="LOADING",this.serviceUrl={connector:this.protocol+"//connector"+this.separator+this.clientName+"."+this.conciergeHost,location:this.protocol+"//location."+this.conciergeHost,events:this.protocol+"//events"+this.separator+this.clientName+"."+this.conciergeHost+"/1.1/events"},this.assetVersion={rules:"",widgets:""},this.onQuestionnaireLoadedCallbacks=new Xi,this.onQuestionnaireSubmitCallbacks=new Xi,this.httpGet=this.httpGet||(new Jn).get,this.httpGetXMLHttpRequest=this.httpGetXMLHttpRequest||(new Jn).getXMLHttpRequest,this.localization=n.localization||new zi(this),this.rulesEngine=n.rulesEngine||new nr(this),this.eventService=n.eventService||new Ha({serverEndpoint:this.serviceUrl.events}),this.publicAPI=n.publicAPI||new fo,this.publicAPI.registerMethods(this,this.gomoxie),this.publicApiV2=n.publicApiV2||new ho(this,this.gomoxie),this.cacheManager=this.cacheManager||n.cacheManager||new Pi(this),this.widgetManager=n.widgetManager||new ua(this),this.contextMonitor=n.contextMonitor||new Gi(this),this.serviceLines=n.serviceLines||new Qi(this)},$a.prototype.prepareAndInit=function(e,t,n){return this.prepare(e,t,n),this.init()},$a.prototype.initAPI=function(){var e=this,t=e.scriptLocation+"/config/latest/2/web/configuration.json";return-1!==this.url.indexOf("MoxieTest=true")&&sessionStorage.setItem("MoxieConfigCacheBust","true"),"true"===sessionStorage.getItem("MoxieConfigCacheBust")&&(t+="?cacheBuster="+Date.now()),this.apiReady=A.all([this.httpGet(t).then((function(t){return e.configuration=t,e.assetVersion.widgets=t.widgets.version,e.localization.init(),e.widgetManager.preloadCSS()})),e.cacheManager.init()]).then((function(){return e.contextMonitor.initTracking()})).then((function(){return e.widgetManager.init(),e.rulesEngine.init(e.configuration),e.widgetManager.loadActiveWidgets()})).then((function(){return function(e,t){var n=new $n(e,t,"1.0");try{window.dispatchEvent(n)}catch(t){_e.log("PublicAPI.broadcastNow("+e+"): error: "+(t.stack?t.stack:t.message))}return n}("apiReady")})),this.apiReady},$a.prototype.init=function(){var e,t=this;return this.ready=this.initAPI().then((e=function(){return t.contextMonitor.start(),t.rulesEngine.run(),t.widgetManager.addEventListeners(t.widgetManager),t.widgetManager.showConcierge(),t.widgetManager.fixPosition(t.positionMethod),ve(t),Bn("conciergeReady"),t.loadState="READY",!0},function(){return"LOADING"===t.loadState?e():null})),this.ready.catch((function(e){t.loadState="FAILED",t.logError("Concierge Unexpected Error",e),Bn("conciergeFailedToLoad")})),this.ready};var Ga=["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"],za=/^(?:([^:/?#]+):)?(?:\/\/((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:/?#]*)(?::(\d*))?))?((((?:[^?#/]*\/)*)([^?#]*))(?:\?([^#]*))?(?:#(.*))?)/,Ka=/^(?:(?![^:@]+:[^:@/]*@)([^:/?#.]+):)?(?:\/\/)?((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#/]*\.[^?#/.]+(?:[?#]|$)))*\/?)?([^?#/]*))(?:\?([^#]*))?(?:#(.*))?)/,Xa=/(?:^|&)([^&=]*)=?([^&]*)/g;function Qa(e){Ua(),this.element=e}Qa.getScriptElement=function(){for(var e=document.getElementsByTagName("script"),t=0;t<e.length;t++)if(e[t].getAttribute("data-concierge")||e[t].getAttribute("concierge"))return new Qa(e[t]);return null},cn(Qa.prototype,{getSourceUri:function(){return function(e,t){for(var n=t?za:Ka.exec(e),i={queryKey:{}},r=14;r--;)i[Ga[r]]=n[r]||"";return i.query.replace(Xa,(function(e,t,n){t&&(i.queryKey[t]=n)})),i}(this.element.src,!1)},getTestMode:function(){var e=this.getSourceUri();return e.queryKey.testmode?"true"===e.queryKey.testmode:localStorage.getItem("Moxie_testmode")},getLogFlag:function(){var e=this.getSourceUri();return e.queryKey.log?"false"===e.queryKey.log:localStorage.getItem("Moxie_log")},getAttribute:function(e){return this.element.getAttribute(e)},getScriptLocation:function(){var e=this.getAttribute("data-concierge-script-location");if(e)return e;var t=this.getSourceUri(),n=[t.protocol,"://",t.host];80===t.port&&443===t.port||!t.port||n.push(":"+t.port);var i=t.path?t.path.split("/").slice(0,-2).join("/"):"";return n.push(i),n.join("")},getClientName:function(){return this.getAttribute("data-client")?this.getAttribute("data-client"):this.getScriptLocation().match(/([^/]+)$/).pop()},getConciergeHost:function(){return this.getAttribute("data-concierge-host")?this.getAttribute("data-concierge-host"):"gomoxie.solutions"},getConciergeSeparator:function(){var e="-",t=this.getSourceUri();return t.queryKey.separator&&(e=t.queryKey.separator),e},getDisplayConfiguration:function(){var e=this.getAttribute("data-display-config");return e&&(e=JSON.parse(e)),e&&"object"==typeof e?{positionMethod:e.positionMethod||"css"}:{positionMethod:"css"}}}),function(){var e;try{Ua();var t=new $a(Qa.getScriptElement()),n=document.location.href,i=document.title;e=t.prepareAndInit(n,i)}catch(t){_e.error(t),e=A.reject(t)}window.conciergeReady=window.conciergeReady||e}()}();