/* Where possible, we changed noninclusive terms to align with our company value of Equality. We maintained certain terms to avoid any effect on customer implementations. */ embedded_svc.defineFeature("LiveAgent",function(b){function r(a,c){this.name=a;this.data=c}function k(a){this.liveAgentAPI=a;this.running=!1;this.pingScript=this.pingTimeoutTimer=void 0;this.sid=b.getCookie("liveagent_sid")}function l(){this.createElements();this.registerMessageHandlers()}function n(){this.visitCount=0;this.originalReferrer=void 0;this.pages=[]}function g(){this.connection=new k(this);this.fileTransfer=new l;this.visitorInfo=new n;this.browserSessionInfo={};this.INVITATIONS_CONTAINER_ID= "esw-invite-container";this.INVITE_RESOURCE_ID="esw-invite-resource";this.INVITE_API_ID="esw-invite-api";this.inviteButton={};this.hasInvitationsLoaded=!!document.getElementById("snapins_invite");this.isInvitationsRendered=!!document.getElementById("snapins_invite");b.setDefaultButtonText("LiveAgent","Chat with an Expert","Agent Offline","Live chat:");b.addDefaultSetting("avatarImgURL","");b.addDefaultSetting("prechatBackgroundImgURL","");b.addDefaultSetting("waitingStateBackgroundImgURL","");b.addDefaultSetting("smallCompanyLogoImgURL", "");b.addDefaultSetting("headerBackgroundURL","");b.addDefaultSetting("extraPrechatInfo",[]);b.addDefaultSetting("extraPrechatFormDetails",[]);b.addDefaultSetting("agentAvailableOnButtonClick",!1);b.settings.isOfflineSupportEnabled&&(b.settings.offlineSupportMinimizedText=b.settings.offlineSupportMinimizedText||"Contact Us");b.addMessageHandler("liveagent.chatCanceledOnDifferentTab",function(){b.fireEvent("liveagent.chatCanceledOnDifferentTab")});b.addEventHandler("error",this.disconnect.bind(this)); b.addEventHandler("sessionDataRetrieved",function(a){q=embedded_svc.liveAgentAPI.constructChatSettingsEndpointURL();a.CHASITOR_SERIALIZED_KEY?(b.settings.agentAvailableOnButtonClick=!0,this.ping()):(embedded_svc.menu||embedded_svc.settings.disableDeploymentDataPrefetch||embedded_svc.liveAgentAPI.getChatSettings(),b.loadFeatureScript("Invite",function(){embedded_svc.liveAgentAPI.getButtonSettings();document.querySelector("style#inert-style")||b.loadScriptFromDirectory("utils","inert")}));this.visitorInfo.initialize(a); return!!a.CHASITOR_SERIALIZED_KEY}.bind(this));b.addEventHandler("beforeCreate",function(){b.settings.visitorInfo=this.visitorInfo.getInfo()}.bind(this));b.addEventHandler("validateInit",function(a){if("string"!==typeof a.baseLiveAgentURL)throw Error("Invalid Live Agent chat URL: "+a.baseLiveAgentURL);if("string"!==typeof a.baseLiveAgentContentURL)throw Error("Invalid Live Agent content URL: "+a.baseLiveAgentContentURL);if(!this.isButtonId(a.buttonId))throw Error("Invalid ButtonId Parameter Value: "+ a.buttonId);if(!this.isDeploymentId(a.deploymentId))throw Error("Invalid DeploymentId Parameter Value: "+a.deploymentId);return!0}.bind(this));b.addEventHandler("onSettingsCallCompleted",function(){b.liveAgentAPI.hasInviteButton()&&this.hasInvitationsLoaded&&(this.isInvitationsRendered?t(b.liveAgentAPI.inviteButton):b.liveAgentAPI.appendInvitationsComponent())}.bind(this));b.addEventHandler("onInvitationResourceLoaded",function(){b.liveAgentAPI.hasInviteButton()&&!this.isInvitationsRendered&&b.liveAgentAPI.appendInvitationsComponent()}.bind(this)); b.loadStorageScript("Chasitor");b.registerStorageKeys("CHASITOR_SERIALIZED_KEY LA_ESW_CHAT_SCROLL_POSITION LA_ESW_UNSEEN_MESSAGES LA_ESW_SHOW_QUEUE_POSITION LA_VISITOR_INFO LA_ESW_FILE_TOKEN LA_ESW_FILE_UPLOAD_SERVLET_URL CHATBOT_FOOTER_MENU PRECHAT_FORM_DETAILS PRECHAT_ENTITIES".split(" "));"LiveAgent"===b.settings.entryFeature&&this.updateButton()}function t(a){var c=String(a.inviteRules);if("undefined"!==typeof window.JSON)var d=window.JSON.parse(c);else throw embedded_svc.utils.error("Browser does not support JSON.parse"), Error("Error during JSON.parse");(c=document.getElementById("snapins_invite"))&&b.inviteAPI&&"Custom"!==a.inviteRenderer&&(b.inviteAPI.inviteButton.addTracker(c,a),b.inviteAPI.inviteButton.setRules(d.rules,d.filter),b.inviteAPI.inviteButton.setOnlineState(a.isAvailable))}var q,p=0;k.prototype.send=function(a,c){var d=c||{};c="Visitor";var e="",f=!1;if(this.pingScript)this.onError("SCRT did not handle response before sending another message.");else{1