PageSourceSearch

https://abp.io/__bundles/Components.ChatBot.Default.cshtml.A77AF75…17DE775E1EFB36BD73.js?_v=639261952548056784

js abp.io collected 2026-10-01 10:36:58 UTC 9,774 bytes, 1 lines download raw bytes

1(function(){"use strict";const n={isOpen:!1,isLoading:!1,conversionId:null,hasLoadedLastConversation:!1,messageQueue:[],isTyping:!1,init(){this.bindEvents();this.initializeConversionId();this.showWelcomeBadge();this.setupKeyboardShortcuts()},bindEvents(){const t=document.getElementById("abp-chatbot-button"),i=document.getElementById("abp-chatbot-close"),r=document.getElementById("abp-chatbot-send"),n=document.getElementById("abp-chatbot-input"),u=document.getElementById("abp-chatbot-new-chat");t?.addEventListener("click",async()=>await this.toggleChat());i?.addEventListener("click",()=>this.closeChat());r?.addEventListener("click",()=>this.sendMessage());u?.addEventListener("click",()=>this.startNewChat());n?.addEventListener("keypress",async n=>{n.key!=="Enter"||n.shiftKey||(n.preventDefault(),await this.sendMessage())});n?.addEventListener("input",()=>{this.autoResizeInput(),this.updateSendButtonState()});n?.addEventListener("focus",()=>{this.onInputFocus()});n?.addEventListener("blur",()=>{this.onInputBlur()});document.addEventListener("click",async n=>{this.isOpen&&!document.getElementById("abp-chatbot-container").contains(n.target)&&await this.closeChat()})},setupKeyboardShortcuts(){document.addEventListener("keydown",async n=>{n.key==="Escape"&&this.isOpen&&await this.closeChat(),(n.ctrlKey||n.metaKey)&&n.key==="k"&&!this.isOpen&&(n.preventDefault(),await this.openChat())})},initializeConversionId(){this.conversionId=this.generateGuid()},generateGuid(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(n){var t=Math.random()*16|0,i=n=="x"?t:t&3|8;return i.toString(16)})},showWelcomeBadge(){const n=document.getElementById("abp-chatbot-badge");n&&(n.style.display="block",setTimeout(()=>{n.style.animation="pulse 2s infinite"},100))},hideBadge(){const n=document.getElementById("abp-chatbot-badge");n&&(n.style.animation="none",n.style.display="none")},async toggleChat(){this.isOpen?await this.closeChat():await this.openChat()},async openChat(){const n=document.getElementById("abp-chatbot-window"),t=document.getElementById("abp-chatbot-button");n&&t&&(n.classList.add("open"),t.classList.add("open"),this.isOpen=!0,this.hideBadge(),abp.currentUser.isAuthenticated&&!this.hasLoadedLastConversation&&await this.loadLastConversation(),setTimeout(()=>{const n=document.getElementById("abp-chatbot-input");n?.focus();this.scrollToBottom(!0)},400))},async closeChat(){const n=document.getElementById("abp-chatbot-window"),t=document.getElementById("abp-chatbot-button");n&&t&&(n.style.transform="scale(0.95) translateY(10px)",n.style.opacity="0",await this.delay(200),n.classList.remove("open"),t.classList.remove("open"),n.style.transform="",n.style.opacity="",this.isOpen=!1)},async loadLastConversation(){if(!this.hasLoadedLastConversation){const n=localStorage.getItem("abp-chatbot-new-chat-started");if(n==="true"){this.hasLoadedLastConversation=!0;return}try{this.setInputState(!1);this.showLoading();const n=await this.callLastConversationApi();n.hasConversation&&n.messages&&n.messages.length>0&&(this.conversionId=n.conversationId,await this.addMessages(n.messages),this.scrollToBottom(!1))}catch(t){}finally{this.hasLoadedLastConversation=!0;this.hideLoading();this.setInputState(!0)}}},addMessages(n){for(let t=0;t<n.length;t++){const i=n[t],r=i.role==="user"?"user":"bot";this.addMessage(i.message,r,!1,!1)}},delay(n){return new Promise(t=>setTimeout(t,n))},async callLastConversationApi(){return new Promise((n,t)=>{abp.ajax({url:"/api/chatbot/last-conversation/messages",type:"GET",abpHandleError:!1}).then(t=>{n(t)}).catch(n=>{t(n)})})},startNewChat(){this.initializeConversionId();localStorage.setItem("abp-chatbot-new-chat-started","true");this.clearMessagesAnimated();setTimeout(()=>{if(abp.currentUser.isAuthenticated){let n;abp.currentUser.name?(n=abp.currentUser.name,abp.currentUser.surName&&(n+=" "+abp.currentUser.surName)):n=abp.currentUser.userName?abp.currentUser.userName:"there";this.addMessage(`Hi ${n}! I’m your AI assistant here to answer general questions and share conceptual guidance about ABP.  If you have any technical questions, please visit [abp.io/support](https://abp.io/support/questions) or open an issue on [ABP GitHub repo](https://github.com/abpframework/abp/issues).`,"bot",!1,!0)}const n=document.getElementById("abp-chatbot-input");n?.focus()},300)},clearMessagesAnimated(){const n=document.getElementById("abp-chatbot-messages");n&&(n.style.opacity="0",n.style.transform="translateY(10px)",setTimeout(()=>{n.innerHTML="",n.style.opacity="1",n.style.transform="translateY(0)"},200))},async sendMessage(){if(!abp.currentUser.isAuthenticated){this.showLoginPrompt();return}const n=document.getElementById("abp-chatbot-input"),t=n?.value.trim();if(t&&!this.isLoading){localStorage.removeItem("abp-chatbot-new-chat-started");this.setInputState(!1);n.value="";this.autoResizeInput();this.updateSendButtonState();await this.addMessage(t,"user");this.showLoading();try{const n=await this.callChatApi(t);if(this.hideLoading(),n.isSuccessful)this.addMessage(n.response,"bot"),this.hideLoading(),n.humanSupportRequested&&(await this.delay(2e3),await this.redirectToHumanSupport());
1else{await this.addMessage(n.errorMessage||"❌ Something went wrong. Please try again.","bot",!0);throw new Error(n.errorMessage||"API error");}}catch(i){await this.addMessage("🔧 I'm having trouble right now. Redirecting you to human support for assistance.","bot",!0);this.hideLoading();await this.delay(2e3);await this.redirectToHumanSupport()}finally{this.setInputState(!0);setTimeout(()=>{n?.focus()},100)}}},showLoginPrompt(){const n=encodeURIComponent(window.location.pathname),t="/Account/Login?returnUrl="+n;this.addMessage(`🔐 Please log in to start chatting! ${t}`,"bot",!1,!0)},setInputState(n){const t=document.getElementById("abp-chatbot-input"),i=document.getElementById("abp-chatbot-send");t&&(t.disabled=!n,t.style.opacity=n?"1":"0.7");i&&(i.disabled=!n)},updateSendButtonState(){const t=document.getElementById("abp-chatbot-input"),n=document.getElementById("abp-chatbot-send");if(t&&n&&abp.currentUser.isAuthenticated){const i=t.value.trim().length>0;n.style.opacity=i?"1":"0.6";n.style.transform=i?"scale(1)":"scale(0.9)"}},onInputFocus(){const n=document.getElementById("abp-chatbot-input-container");n&&(n.style.borderColor="#667eea",n.style.boxShadow="0 0 0 2px rgba(102, 126, 234, 0.1)")},onInputBlur(){const n=document.getElementById("abp-chatbot-input-container");n&&(n.style.borderColor="#e9ecef",n.style.boxShadow="none")},async callChatApi(n){const t={message:n,conversionId:this.conversionId,currentPage:window.location.href};return new Promise((n,i)=>{abp.ajax({url:"/api/chatbot/chat",type:"POST",data:JSON.stringify(t),contentType:"application/json",abpHandleError:!1}).then(t=>{n(t)}).catch(n=>{i(n)})})},escapeHtml(n){const t=document.createElement("div");return t.textContent=n,t.innerHTML},processAutoLinks(n){const t=this.escapeHtml(n);return t.replace(/(https?:\/\/[^\s<>"']+)/gi,n=>{const t=n.replace(/[.,;:!?'")\]}]+$/,"");try{const n=new URL(t);if(n.protocol==="http:"||n.protocol==="https:")return`<a href="${this.escapeHtml(t)}" target="_blank" rel="noopener noreferrer">${this.escapeHtml(t)}</a>`}catch(i){}return this.escapeHtml(n)})},createSecureMessageContent(n,t){return t==="bot"?this.processAutoLinks(n):this.escapeHtml(n)},addMessage(n,t,i=false,r=true){const e=document.getElementById("abp-chatbot-messages");if(e){const u=document.createElement("div");u.className=`abp-chatbot-message abp-chatbot-message-${t}`;i&&u.classList.add("error");const f=document.createElement("div");f.className="abp-chatbot-message-content";f.innerHTML=this.createSecureMessageContent(n,t);u.appendChild(f);u.style.opacity="0";u.style.transform="translateY(20px)";e.appendChild(u);requestAnimationFrame(()=>{u.style.transition="all 0.3s ease-out",u.style.opacity="1",u.style.transform="translateY(0)"});r&&this.scrollToBottom()}},scrollToBottom(n=true){const t=document.getElementById("abp-chatbot-messages");t&&(n?t.scrollTo({top:t.scrollHeight,behavior:"smooth"}):t.scrollTop=t.scrollHeight)},showLoading(){this.isLoading=!0;const n=document.getElementById("abp-chatbot-loading");n&&(n.style.display="block",this.scrollToBottom())},hideLoading(){this.isLoading=!1;const n=document.getElementById("abp-chatbot-loading");n&&(n.style.display="none")},autoResizeInput(){const n=document.getElementById("abp-chatbot-input");n&&(n.style.height="auto",n.style.height=Math.min(n.scrollHeight,100)+"px",n.style.transition="height 0.2s ease")},async redirectToHumanSupport(){try{if(window.Tawk_API=window.Tawk_API||{},typeof window.Tawk_API.getStatus=="function"){const n=window.Tawk_API.getStatus();if(n==="offline"){this.addMessage("📝 Our support team is currently offline. Redirecting you to our contact page...","bot",!1);await this.delay(1500);window.location.href="/contact";return}}window.Tawk_API.showWidget();window.Tawk_API.maximize();window.Tawk_API.start();await this.closeChat()}catch(n){this.addMessage("📝 Redirecting you to our contact page...","bot",!1);await this.delay(1500);window.location.href="/contact"}}};document.readyState==="loading"?document.addEventListener("DOMContentLoaded",()=>n.init()):n.init();document.addEventListener("DOMContentLoaded",function(){const t=document.getElementById("abp-chatbot-container");if(t){t.addEventListener("click",async function(t){const i=t.target.closest("button");i&&i.id==="abp-chatbot-send"&&abp.currentUser.isAuthenticated&&await n.sendMessage()});const i=document.getElementById("abp-chatbot-input");i&&i.addEventListener("keypress",async function(t){t.key!=="Enter"||t.shiftKey||!abp.currentUser.isAuthenticated||n.isLoading||(t.preventDefault(),await n.sendMessage())})}});window.AbpChatBot=n})();

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.