function ownKeys(t,e){var n,o=Object.keys(t);return Object.getOwnPropertySymbols&&(n=Object.getOwnPropertySymbols(t),e&&(n=n.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),o.push.apply(o,n)),o}function _objectSpread(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{};e%2?ownKeys(Object(n),!0).forEach(function(e){_defineProperty(t,e,n[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):ownKeys(Object(n)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))})}return t}function _defineProperty(e,t,n){return(t=_toPropertyKey(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function _toConsumableArray(e){return _arrayWithoutHoles(e)||_iterableToArray(e)||_unsupportedIterableToArray(e)||_nonIterableSpread()}function _nonIterableSpread(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function _iterableToArray(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}function _arrayWithoutHoles(e){if(Array.isArray(e))return _arrayLikeToArray(e)}function _slicedToArray(e,t){return _arrayWithHoles(e)||_iterableToArrayLimit(e,t)||_unsupportedIterableToArray(e,t)||_nonIterableRest()}function _nonIterableRest(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function _unsupportedIterableToArray(e,t){var n;if(e)return"string"==typeof e?_arrayLikeToArray(e,t):"Map"===(n="Object"===(n={}.toString.call(e).slice(8,-1))&&e.constructor?e.constructor.name:n)||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?_arrayLikeToArray(e,t):void 0}function _arrayLikeToArray(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,o=Array(t);n<t;n++)o[n]=e[n];return o}function _iterableToArrayLimit(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var o,a,r,i,c=[],d=!0,s=!1;try{if(r=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;d=!1}else for(;!(d=(o=r.call(n)).done)&&(c.push(o.value),c.length!==t);d=!0);}catch(e){s=!0,a=e}finally{try{if(!d&&null!=n.return&&(i=n.return(),Object(i)!==i))return}finally{if(s)throw a}}return c}}function _arrayWithHoles(e){if(Array.isArray(e))return e}function _typeof(e){return(_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function _classCallCheck(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function _defineProperties(e,t){for(var n=0;n<t.length;n++){var o=t[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,_toPropertyKey(o.key),o)}}function _createClass(e,t,n){return t&&_defineProperties(e.prototype,t),n&&_defineProperties(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function _toPropertyKey(e){e=_toPrimitive(e,"string");return"symbol"==_typeof(e)?e:e+""}function _toPrimitive(e,t){if("object"!=_typeof(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0===n)return("string"===t?String:Number)(e);n=n.call(e,t||"default");if("object"!=_typeof(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}(()=>{var t,r,a,i,v=JSON.parse('{"RL":"https://storage.googleapis.com/widget.kenect.com/","Nc":"https://storage.googleapis.com/widget.kenect.com/build/index.html.gz","EO":"resources/button.html.gz","E9":"resources/prompt.html.gz","sD":"resources/comment.svg.gz","jr":"resources/close.svg.gz","LA":"resources/close-white.svg.gz","to":"https://storage.googleapis.com/widget.kenect.com/instances","WG":"resources/scripts/newRelic.js.gz","$b":"https://int-widget-events.kenect.com/api/v1","Xj":"SqkXDo90D#8iplyGTg0$"}'),G=function(e,t){var t=36e5*(t=t||24),n=new Date;return Math.abs(e.getTime()-n.getTime())>=t},c=function(e,t){var n=(n=e.getItem(t.key))?JSON.parse(n):{},o=n.updated_at;return!o||G(new Date(o),t.expiry)?(e.setItem(t.key,JSON.stringify({})),{}):n.visits},W={key:"autopluck",expiry:24};function d(e){return t||(e=e||window,t=window.localStorage),t}function s(e){var t=d(),n=c(t,r);n[e]||(n[e]=0),n[e]+=1,(e={}).visits=n,e.updated_at=(new Date).toISOString(),t.setItem(r.key,JSON.stringify(e))}function e(e,t){function n(e){s(t.location.toString()),setInterval(function(){t.location.toString()!==i&&(s(t.location.toString()),i=t.location.toString())},2e3)}function o(e){return t=d(),o=(o=c(t,r))||[],t=(t=e)||[],a=Object.keys(o),t.reduce(function(e,t){var n=0;return t=(t||"").toLowerCase(),a.forEach(function(e){e.toLowerCase().match(t.toLowerCase())&&(n+=o[e])}),e[t]=n,e},{});var o,a,t}return t=t||window,a=t.document,r=Object.assign({},W,e),"complete"===a.readyState||"loading"!==a.readyState&&!a.documentElement.doScroll?n():a.addEventListener("DOMContentLoaded",n),{matches:o,contains:function(e){return 0<o([e])[e]}}}function E(e,t){(n=document.querySelectorAll("#widget-style-".concat(t)))&&n.length&&n.forEach(function(e){return e.parentNode.removeChild(e)}),n=t,(t=document.createElement("style")).id="widget-style-".concat(n),t.type="text/css";var n=t;n.innerHTML=e,document.head.appendChild(n)}function _(e){e=e.token;return"\n.reset-".concat(e," {\n  all: unset;\n}\n.iframe-").concat(e," {\n  border: none;\n  width: 100%;\n  height: 100%;\n  z-index: 2147483000;\n  box-sizing: border-box;\n}\n.display-none-").concat(e," {\n  display: none !important;\n}\n.hide-prompt-").concat(e," {\n  height: 0 !important;\n  width: 0 !important;\n  overflow: hidden !important;\n}\n.shadow-").concat(e," {\n  box-shadow: 0px 6px 10px rgba(26, 26, 26, 0.14), 0px 1px 18px rgba(26, 26, 26, 0.12), 0px 4px 4px rgba(26, 26, 26, 0.2);\n}\n.visibility-hidden-").concat(e," {\n  visibility: hidden;\n}\n  ")}function b(e){e=e.token;return"\n@media only screen and (max-width: 400px) {\n  .iframe-".concat(e," {\n    height: 100%;\n    width: 100%;\n    border-radius: 0;\n    left: 0;\n    top: 0;\n  }\n  .widget-iframe-").concat(e," {\n    max-height: 100%;\n  }\n  #prompt-").concat(e," {\n    max-width: 90vw;\n  }\n}\n  ")}var n="Please consider enabling localStorage, caching and/or cookies on this browser for the best user experience.";function l(e){var t,n,o,a;if(e)return a=null==(o=(o=T(e="widget-session-".concat(e)))?JSON.parse(o):{})?void 0:o.id,t=(null==o?void 0:o.startTime)||0,o=(null==o?void 0:o.latestActivity)||0,n=(new Date).getTime(),a={id:(o=o&&864e5<n-o)||!a?"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(e){var t=16*Math.random()|0;return("x"==e?t:3&t|8).toString(16)}):a,startTime:o||!t?n:t,latestActivity:n},I(e,JSON.stringify(a)),a;throw new Error("Widget token not declared for session")}function I(e,t){try{localStorage.setItem(e,t)}catch(e){console.warn(n)}}function T(e){try{return localStorage.getItem(e)}catch(e){console.warn(n)}}var u="EVENT_WIDGET_OPENED",f="EVENT_WIDGET_CLOSED",p="EVENT_SEND_MESSAGE",S="EVENT_PROMPT_CLOSED",k="WIDGET_LOADED",x="TOGGLE_IFRAME",D="OPEN_IFRAME",O="CLOSE_IFRAME",L=function(){var e;"true"===(null==(e=T("KENECT_DEBUGGING"))?void 0:e.toLocaleLowerCase())&&(e=console).log.apply(e,arguments)};function A(e,t,n,o){var a=t.height,t=t.width,e=e.token,r=document.getElementById(n),n=document.getElementById("".concat(n,"-iframe"));o&&r.classList.remove("visibility-hidden-".concat(e)),n.setAttribute("style","height:".concat(a,"px; width:").concat(t,"px; min-height:").concat(a,"px; min-width:").concat(t,"px; "))}function H(e,t,n,o){var a=e.token,e=e.buttonMessage,r=document.getElementById(t),i=document.createElement("iframe");i.src=n,i.id="".concat(t,"-iframe"),i.className="iframe-".concat(a),"function"==typeof o?((n=document.createElement("button")).id="widget-button-".concat(a),n.className="reset-".concat(a),n.onclick=o,n.tabIndex=0,n.title=e||"Text Us",i.tabIndex=-1,i.ariaLabel="Contact Support Widget",n.appendChild(i),r.appendChild(n)):(i.ariaLabel="Widget prompt message",r.appendChild(i))}function C(e,t,n){document.getElementById(n?t:"".concat(t,"-iframe")).contentWindow.postMessage({type:"WIDGET_DATA",widgetInfo:e,URLS:{icon:"".concat(v.RL).concat(v.sD),close:"".concat(v.RL).concat(v.jr),close_white:"".concat(v.RL).concat(v.LA)}},"*")}function P(e,t,n){var o,a,r,i,c=e.token,d=e.urlTrackingWords,e=e.buttonMessage,s=document.getElementById("iframe-wrapper-".concat(c)),l=document.getElementById("widget-button-".concat(c));s&&l&&(i=s.classList.contains("display-none-".concat(c)),r=document.getElementById("prompt-".concat(c)),(o=document.getElementById("kenect-aria-live"))||((o=document.createElement("div")).id="kenect-aria-live",o.setAttribute("aria-live","assertive"),o.setAttribute("role","status"),o.style.position="absolute",o.style.left="-9999px",o.tabIndex=-1,document.body.appendChild(o)),null!=r&&r.classList.add("hide-prompt-".concat(c)),a=document.getElementById("iframe-".concat(c)),i?(s.classList.remove("display-none-".concat(c)),window.postMessage({type:u},"*"),o.textContent="Support window opened.",l.title="Close support window",l.ariaLabel="Close support window",a&&setTimeout(function(){a.focus()},2e3)):(s.classList.add("display-none-".concat(c)),window.postMessage({type:f},"*"),o.textContent="Support window closed.",l.title=e||"Text Us",l.ariaLabel="Open support window"),a&&(r={type:"PAGE_DATA",href:window.location.href,width:window.innerWidth,height:window.innerHeight,stats:t.matches(d),dealerId:n},L("PAGE_DATA",r),a.contentWindow.postMessage(r,"*")),null!=(i=document.getElementById("button-".concat(c,"-iframe"))))&&i.contentWindow.postMessage({type:"TOGGLE_WIDGET"},"*")}function h(t){var n=1<arguments.length&&void 0!==arguments[1]?arguments[1]:60;try{t()}catch(e){var o=0,a=setInterval(function(){if(o<n)try{t(),clearInterval(a)}catch(e){o++}else clearInterval(a)},1e3)}}var B=_createClass(function e(t){_classCallCheck(this,e),this.widgetInfo=t||{},this.chatId="".concat(window.crypto.randomUUID(),":").concat((new Date).toISOString())},[{key:"handleEvent",value:function(e){var t,n,o,a=this,e=null==e||null==(e=e.data)?void 0:e.type,r=null==(r=this.widgetInfo)?void 0:r.token;e===u&&(t=document.getElementById("iframe-".concat(r)),n=l(r),window.sd&&sd("getSessionId",function(e){o=e}),window.sdb&&sdb("getSessionId",function(e){o=e}),window.digitalData&&(window.digitalData.chatId=this.chatId,window.digitalData.newEvent({type:"CustomTagEvent",eventName:"sms",eventAction:"chat",attributes:{provider:"Kenect"}})),setTimeout(function(){var e={sdSessionId:o,chatId:a.chatId,chatSessionId:null==(e=window._satellite)?void 0:e.getVar("chatSessionId"),chatLeadId:n.startTime,formTransactionId:null==(e=window._satellite)?void 0:e.getVar("formTransactionId")};L("WIDGET_INFO_EXTRA_DATA",e),t.contentWindow.postMessage({type:"WIDGET_INFO_EXTRA_DATA",extraData:e},"*")},150))}}]);function V(e,t){this.name="AggregateError",this.errors=e,this.message=t||""}V.prototype=Error.prototype;var o=setTimeout;function U(e){return Boolean(e&&void 0!==e.length)}function F(){}function y(e){if(!(this instanceof y))throw new TypeError("Promises must be constructed via new");if("function"!=typeof e)throw new TypeError("not a function");this._state=0,this._handled=!1,this._value=void 0,this._deferreds=[],q(e,this)}function K(n,o){for(;3===n._state;)n=n._value;0!==n._state?(n._handled=!0,y._immediateFn(function(){var e,t=1===n._state?o.onFulfilled:o.onRejected;if(null!==t){try{e=t(n._value)}catch(e){return void g(o.promise,e)}w(o.promise,e)}else(1===n._state?w:g)(o.promise,n._value)})):n._deferreds.push(o)}function w(e,t){try{if(t===e)throw new TypeError("A promise cannot be resolved with itself.");if(t&&("object"==_typeof(t)||"function"==typeof t)){var n=t.then;if(t instanceof y)return e._state=3,e._value=t,m(e);if("function"==typeof n)return q((o=n,a=t,function(){o.apply(a,arguments)}),e)}e._state=1,e._value=t,m(e)}catch(t){g(e,t)}var o,a}function g(e,t){e._state=2,e._value=t,m(e)}function m(e){2===e._state&&0===e._deferreds.length&&y._immediateFn(function(){e._handled||y._unhandledRejectionFn(e._value)});for(var t=0,n=e._deferreds.length;t<n;t++)K(e,e._deferreds[t]);e._deferreds=null}function z(e,t,n){this.onFulfilled="function"==typeof e?e:null,this.onRejected="function"==typeof t?t:null,this.promise=n}function q(e,t){var n=!1;try{e(function(e){n||(n=!0,w(t,e))},function(e){n||(n=!0,g(t,e))})}catch(e){n||(n=!0,g(t,e))}}y.prototype.catch=function(e){return this.then(null,e)},y.prototype.then=function(e,t){var n=new this.constructor(F);return K(this,new z(e,t,n)),n},y.prototype.finally=function(t){var n=this.constructor;return this.then(function(e){return n.resolve(t()).then(function(){return e})},function(e){return n.resolve(t()).then(function(){return n.reject(e)})})},y.all=function(t){return new y(function(a,r){if(!U(t))return r(new TypeError("Promise.all accepts an array"));var i=Array.prototype.slice.call(t);if(0===i.length)return a([]);var c=i.length;for(var e=0;e<i.length;e++)!function t(n,e){try{if(e&&("object"==_typeof(e)||"function"==typeof e)){var o=e.then;if("function"==typeof o)return o.call(e,function(e){t(n,e)},r)}i[n]=e,0==--c&&a(i)}catch(n){r(n)}}(e,i[e])})},y.any=function(r){var i=this;return new i(function(e,t){if(!r||void 0===r.length)return t(new TypeError("Promise.any accepts an array"));var n=Array.prototype.slice.call(r);if(0===n.length)return t();for(var o=[],a=0;a<n.length;a++)try{i.resolve(n[a]).then(e).catch(function(e){o.push(e),o.length===n.length&&t(new V(o,"All promises were rejected"))})}catch(e){t(e)}})},y.allSettled=function(n){return new this(function(a,e){if(!n||void 0===n.length)return e(new TypeError(_typeof(n)+" "+n+" is not iterable(cannot read property Symbol(Symbol.iterator))"));var r=Array.prototype.slice.call(n);if(0===r.length)return a([]);var i=r.length;for(var t=0;t<r.length;t++)!function t(n,e){if(e&&("object"==_typeof(e)||"function"==typeof e)){var o=e.then;if("function"==typeof o)return o.call(e,function(e){t(n,e)},function(e){r[n]={status:"rejected",reason:e},0==--i&&a(r)})}r[n]={status:"fulfilled",value:e},0==--i&&a(r)}(t,r[t])})},y.resolve=function(t){return t&&"object"==_typeof(t)&&t.constructor===y?t:new y(function(e){e(t)})},y.reject=function(n){return new y(function(e,t){t(n)})},y.race=function(a){return new y(function(e,t){if(!U(a))return t(new TypeError("Promise.race accepts an array"));for(var n=0,o=a.length;n<o;n++)y.resolve(a[n]).then(e,t)})},y._immediateFn="function"==typeof setImmediate?function(e){setImmediate(e)}:function(e){o(e,0)},y._unhandledRejectionFn=function(e){"undefined"!=typeof console&&console&&console.warn("Possible Unhandled Promise Rejection:",e)};var N,R,J=y,X="".concat(v.RL).concat(v.WG),Z=_createClass(function e(t){_classCallCheck(this,e),this.widgetInfo=t||{},window.Promise=J;t=document.createElement("script");t.type="text/javascript",t.src=X,document.head.appendChild(t)},[{key:"handleEvent",value:function(t){var e,n=this;switch(null==t||null==(e=t.data)?void 0:e.type){case p:h(function(){var e;return null==(e=window.newrelic)?void 0:e.addPageAction("EVENT_SEND_MESSAGE",{widgetType:n.widgetInfo.type,token:n.widgetInfo.token,eventData:t.data.data,session:l(null==(e=n.widgetInfo)?void 0:e.token)})});break;case u:h(function(){var e;return null==(e=window.newrelic)?void 0:e.addPageAction("EVENT_WIDGET_OPENED",{widgetType:n.widgetInfo.type,token:n.widgetInfo.token,eventData:t.data.data,session:l(null==(e=n.widgetInfo)?void 0:e.token)})});break;case f:h(function(){var e;return null==(e=window.newrelic)?void 0:e.addPageAction("EVENT_WIDGET_CLOSED",{widgetType:n.widgetInfo.type,token:n.widgetInfo.token,eventData:t.data.data,session:l(null==(e=n.widgetInfo)?void 0:e.token)})});break;case"EVENT_LOCATION_SELECTED":h(function(){var e;return null==(e=window.newrelic)?void 0:e.addPageAction("EVENT_LOCATION_SELECTED",{widgetType:n.widgetInfo.type,token:n.widgetInfo.token,eventData:t.data.data,session:l(null==(e=n.widgetInfo)?void 0:e.token)})});break;case"EVENT_DEPARTMENT_SELECTED":h(function(){var e;return null==(e=window.newrelic)?void 0:e.addPageAction("EVENT_DEPARTMENT_SELECTED",{widgetType:n.widgetInfo.type,token:n.widgetInfo.token,eventData:t.data.data,session:l(null==(e=n.widgetInfo)?void 0:e.token)})});break;case S:h(function(){var e;return null==(e=window.newrelic)?void 0:e.addPageAction("EVENT_PROMPT_CLOSED",{widgetType:n.widgetInfo.type,token:n.widgetInfo.token,eventData:t.data.data,session:l(null==(e=n.widgetInfo)?void 0:e.token)})});break;case"EVENT_KENECT_LOGO_PRESSED":h(function(){var e;return null==(e=window.newrelic)?void 0:e.addPageAction("EVENT_KENECT_LOGO_PRESSED",{widgetType:n.widgetInfo.type,token:n.widgetInfo.token,eventData:t.data.data,session:l(null==(e=n.widgetInfo)?void 0:e.token)})});break;case"EVENT_KENECT_LOGO_PRESSED_WITH_FORM_FILLED":h(function(){var e;return null==(e=window.newrelic)?void 0:e.addPageAction("EVENT_KENECT_LOGO_PRESSED_WITH_FORM_FILLED",{widgetType:n.widgetInfo.type,token:n.widgetInfo.token,eventData:t.data.data,session:l(null==(e=n.widgetInfo)?void 0:e.token)})});break;case"EVENT_WIDGET_ERROR":h(function(){var e;return null==(e=window.newrelic)?void 0:e.noticeError("EVENT_WIDGET_ERROR",{widgetType:n.widgetInfo.type,token:n.widgetInfo.token,eventData:t.data.data,session:l(null==(e=n.widgetInfo)?void 0:e.token)})});break;case k:h(function(){var e;return null==(e=window.newrelic)?void 0:e.addPageAction("IMPRESSION",{widgetType:n.widgetInfo.type,token:n.widgetInfo.token,session:l(null==(e=widgetInfo)?void 0:e.token)})})}}}]),j="Kenect",M="text",$=_createClass(function e(t,n){_classCallCheck(this,e),this.collectorInfo=n,this.widgetInfo=t},[{key:"handleSD",value:function(){for(var e,t=arguments.length,n=new Array(t),o=0;o<t;o++)n[o]=arguments[o];L.apply(void 0,["PROCESSED_EVENT",this.collectorInfo.type].concat(n)),this.collectorInfo.type===Q?window.sd&&(e=window).sd.apply(e,n):this.collectorInfo.type===ee&&window.sdb&&(e=window).sdb.apply(e,n)}},{key:"handleEvent",value:function(o){var e,a=this,t=null==o||null==(t=o.data)?void 0:t.type,r=null==(e=this.widgetInfo)?void 0:e.token;switch(t){case p:h(function(){var e=null==(e=o.data.data)?void 0:e.message,t=l(r);a.handleSD("dataLayer",{chatType:M,chatProvider:j,chatSessionId:t.id,chatLeadId:t.startTime,events:"chatUserMessage",chatMessageType:"user",chatMessageContent:e}),a.handleSD("send"),a.handleSD("dataLayer",{chatType:M,chatProvider:j,chatSessionId:t.id,chatLeadId:t.startTime,events:"chatLead"}),a.handleSD("send")});break;case"EVENT_SEND_MESSAGE_CONFIRMATION":h(function(){var e=_slicedToArray(null==(e=o.data.data)?void 0:e.confirmationMessages,2),t=e[0],e=e[1],n=l(r);a.handleSD("dataLayer",{chatType:M,chatProvider:j,chatSessionId:n.id,events:"chatUserMessage",chatMessageType:"agent",chatMessageContent:null==t?void 0:t.text,chatLeadId:n.startTime}),a.handleSD("send"),a.handleSD("dataLayer",{chatType:M,chatProvider:j,chatSessionId:n.id,chatLeadId:n.startTime,events:"chatUserMessage",chatMessageType:"agent",chatMessageContent:null==e?void 0:e.text}),a.handleSD("send")});break;case u:h(function(){var e=l(r);a.handleSD("dataLayer",{chatType:M,chatSessionId:e.id,chatProvider:j,events:"chatClick"}),a.handleSD("send")});break;case f:h(function(){var e=l(r);a.handleSD("dataLayer",{chatType:M,chatSessionId:e.id,chatProvider:j,events:"chatClosed"}),a.handleSD("send")});break;case k:h(function(){var e=l(r);a.handleSD("dataLayer",{chatType:M,chatSessionId:e.id,chatProvider:j,events:"chatImpression"}),a.handleSD("send")})}}}]),Y=_createClass(function e(t){_classCallCheck(this,e),this.widgetInfo=t||{}},[{key:"handleEvent",value:function(e){var t,n=this,e=null==e||null==(e=e.data)?void 0:e.type,o=l(null==(t=this.widgetInfo)?void 0:t.token);switch(e){case p:h(function(){n.sendEvent(o,["chat_user_message","chat_agent_message","chat_lead"])},3);break;case u:h(function(){return n.sendEvent(o,["chat_click"])},3);break;case f:h(function(){return n.sendEvent(o,["chat_closed"])},3);break;case k:h(function(){return n.sendEvent(o,["chat_impression"])},3)}}},{key:"sendEvent",value:function(e,t){var t=t.map(function(e){return{eventType:e}}),n=this.getDeviceType(),e={sessionId:e.id,chatLeadId:e.startTime,widgetId:this.widgetInfo.token,organizationId:this.widgetInfo.organizationId,locationId:null==(e=this.widgetInfo)?void 0:e.defaultLocationId,brandId:null==(e=this.widgetInfo)?void 0:e.brandId,brandName:null==(e=this.widgetInfo)?void 0:e.brandName,deviceType:n,events:t};this.httpRequest(e)}},{key:"httpRequest",value:function(e){var t=new XMLHttpRequest,n="".concat(v.$b,"/widget-events"),e=JSON.stringify(e);t.open("POST",n,!0),t.setRequestHeader("Content-type","application/json"),t.setRequestHeader("Authorization",v.Xj),t.send(e)}},{key:"getDeviceType",value:function(){return/Mobi/.test(navigator.userAgent)?"Mobile":"Desktop"}}]),Q="SHIFT_DIGITAL",ee="SHIFT_DIGITAL_BMW",te=_createClass(function e(t){_classCallCheck(this,e);var n=(null==t?void 0:t.collectors)||[],o=[].concat(_toConsumableArray(null!=t&&t.hideNewRelic?[]:[new Z(t)]),_toConsumableArray(null==v.Xj||"SqkXDo90D#8iplyGTg0$"===v.Xj?[]:[new Y(t)]),_toConsumableArray(t?[new B(t)]:[]));n.forEach(function(e){switch(e.type){case ee:case Q:o.push(new $(t,e))}}),L("Collectors",o),this.collectors=o},[{key:"handleEvent",value:function(t){this.collectors.forEach(function(e){e.handleEvent(t)})}}]);function ne(){var t,e,n,o,a;t=oe,===N?(e=(n=document.getElementById("kenect-token")).getAttribute("token"),n=n.getAttribute("previewinfo"),o="".concat(v.to,"/").concat(e,".json"),"WIDGET_PREVIEW"===e?(N=_objectSpread(_objectSpread({},JSON.parse(decodeURIComponent(n))),{},{token:"WIDGET_PREVIEW",previewInfo:n}),t()):((a=new XMLHttpRequest).open("GET",o,!0),a.setRequestHeader("Content-Type","text/javascript"),a.onreadystatechange=function(){var e;this.readyState!==XMLHttpRequest.DONE||200!==this.status&&204!==this.status||(e=JSON.parse(a.responseText),N=e,t())},a.send(null))):t()}function oe(){var e,t,n,o,a,r,i,c,d,s,l,u,f,p,h,y,w=(m=N).token,g=m.showOnMobile,m="OEM"===m.type;document.getElementById("widget-".concat(w))||window.innerWidth<600&&!g||(g=!m,n=new URL(window.location).searchParams.get("widget")===w,g&&(g=document.createElement("div"),h=document.createElement("div"),y=document.createElement("div"),g.id="widget-".concat(w),g.className="reset-".concat(w," widget-container-").concat(w),h.id="button-".concat(w),h.className="reset-".concat(w," visibility-hidden-").concat(w),y.id="prompt-".concat(w),y.className="reset-".concat(w," hide-prompt-").concat(w),g.appendChild(y),g.appendChild(h),document.body.appendChild(g),y="".concat(v.RL).concat(v.EO),H(N,"button-".concat(w),y,function(){return P(N,R)}),n||(h="".concat(v.RL).concat(v.E9),H(N,"prompt-".concat(w),h),t=(g=N).token,g.showPrompt?g.prompt&&(e=document.getElementById("prompt-".concat(t)),g=T("widget-closed-".concat(t)),y=(new Date).getTime(),(null!==g?y-g:1800001)<18e5?e.classList.add("hide-prompt-".concat(t)):setTimeout(function(){e.classList.remove("hide-prompt-".concat(t))},5e3)):document.getElementById("prompt-".concat(t)).classList.add("hide-prompt-".concat(t)))),p=R,w=(f=N).token,h=f.previewInfo,y=document.createElement("iframe"),g=document.createElement("div"),h="token=".concat(encodeURIComponent(w)).concat(h?"&previewInfo="+h:""),y.src="".concat(v.Nc,"?").concat(h),y.className="iframe-".concat(w," widget-iframe-").concat(w," shadow-").concat(w),y.id="iframe-".concat(w),y.title="Contact Support Widget",y.tabIndex=0,g.id="iframe-wrapper-".concat(w),g.className="reset-".concat(w," display-none-").concat(w," backdrop-").concat(w),g.onclick=function(){return P(f,p)},g.append(y),document.body.append(g),l=R,u=(s=N).token,document.addEventListener("click",function(e){var t;(null==(t=e.target)||null==(t=t.dataset)?void 0:t.widgetToggle)===u&&(e=null==(t=e.target)||null==(t=t.dataset)?void 0:t.dealerId,P(s,l,e))}),r=R,i=n,c=(a=N).token,window.removeEventListener("message",window["MessageHandler_".concat(c)]),window.toggleKenectWidget=function(){return P(a,r)},d=new te(a),window["MessageHandler_".concat(c)]=function(e){switch(d.handleEvent(e),e.data.type){case x:case D:case O:case"".concat(x,"_").concat(c):case"".concat(D,"_").concat(c):case"".concat(O,"_").concat(c):P(a,r,e.data.dealerId);break;case S:t=a.token,document.getElementById("prompt-".concat(t)).classList.add("hide-prompt-".concat(t)),I("widget-closed-".concat(t),(new Date).getTime().toString());break;case"PROMPT_PAGE_LOADED":C(a,"prompt-".concat(c));break;case"BUTTON_PAGE_LOADED":C(a,"button-".concat(c));break;case k:C(a,"iframe-".concat(c),!0);break;case"RESIZE_PROMPT":A(a,_objectSpread(_objectSpread({},e.data),{},{width:e.data.width,height:e.data.height}),"prompt-".concat(c));break;case"RESIZE_BUTTON":A(a,e.data,"button-".concat(c),!0),i&&P(a,r)}var t},window.addEventListener("message",window["MessageHandler_".concat(c)]),m?(g=(w=N).token,E("\n".concat(_(w),"\n.backdrop-").concat(g," {\n  position: fixed;\n  top: 0;\n  left: 0;\n  width: 100%;\n  height: 100%;\n  z-index: 2147483000;\n  display: flex;\n  align-items: center;\n  justify-content: center;\n}\n.widget-iframe-").concat(g," {\n  border-radius: 10px;\n  height: 640px;\n  width: 320px;\n  background: #f7f7f7;\n  max-height: calc(100% - 100px);\n}\n").concat(b(w),"\n  "),g)):(m=(n=N).token,E("\n".concat(_(n),"\n\nbutton.reset-").concat(m," {\n  background: none;\n}\n\nbutton.reset-").concat(m,":hover {\n  background: none;\n}\n\n.widget-iframe-").concat(m," {\n  position: fixed;\n  bottom: 85px;\n  right: 20px;\n  border-radius: 10px;\n  height: 640px;\n  width: 320px;\n  background: #f7f7f7;\n  max-height: calc(100% - 100px);\n}\n\n#prompt-").concat(m," {\n  margin: 0 4px;\n}\n#prompt-").concat(m,"-iframe {\n  background: transparent;\n  box-shadow: none;\n  margin-bottom: -16px !important;\n}\n\n.widget-container-").concat(m," {\n  transform: translateY(0);\n  transition: all .1s;\n  display: flex;\n}\n#widget-").concat(m," {\n  position: fixed;\n  display: flex;\n  z-index: 2147483000;\n}\n.btn-text-").concat(m," {\n  color: white;\n}\n").concat((w=n.token,g=n.displayCorner,o=n.customCSS,g=g?g.split("_"):["BOTTOM","RIGHT"],o=o||"",(o+="TOP"===g[0]?"\n      #widget-".concat(w," {\n        top: 0;\n      }\n      .widget-container-").concat(w," {\n        flex-direction: column-reverse;\n      }\n      .iframe-").concat(w," {\n        top: 85px;\n      }\n    "):"\n      #widget-".concat(w," {\n        bottom: 0;\n      }\n      .widget-container-").concat(w," {\n        flex-direction: column;\n      }\n      .iframe-").concat(w," {\n        bottom: 85px;\n      }\n    "))+("RIGHT"===g[1]?"\n      #widget-".concat(w," {\n        right: 0;\n      }\n      #button-").concat(w," {\n        align-self: flex-end;\n      }\n      .iframe-").concat(w," {\n        right: 16px;\n      }\n    "):"\n      #widget-".concat(w," {\n        left: 0;\n      }\n      #button-").concat(w," {\n        align-self: flex-start;\n      }\n      .iframe-").concat(w," {\n        left: 16px;\n      }\n    "))),"\n").concat(b(n),"\n"),m)),L("WIDGET_INITIALIZED"))}N=,R=e({key:"autopluck",expiry:24},window),"complete"===document.readyState?ne():window.addEventListener("load",ne)})();