Sid Gifari File Manager
🏠 Root
/
home
/
genremedia08
/
thepassage.overlookedtracks.com
/
wp-content9
/
plugins
/
echo-knowledge-base
/
js
/
ai
/
Editing: ai-chat-display.min.js
(function(){"use strict";if(!window.EPKBChatUtils){console.error("AI Chat Display: EPKBChatUtils module not loaded");return}const{parseMessageFormatting:e}=window.EPKBChatUtils;function a(e,a=20){e=e.replace("#","");let t=parseInt(e.substring(0,2),16);let s=parseInt(e.substring(2,4),16);let i=parseInt(e.substring(4,6),16);t=Math.floor(t*(1-a/100));s=Math.floor(s*(1-a/100));i=Math.floor(i*(1-a/100));const n=e=>{const a=e.toString(16);return a.length===1?"0"+a:a};return"#"+n(t)+n(s)+n(i)}function t(a){const{memo:t,createElement:s}=a;return t((function a({message:t,isUser:i,widgetColors:n}){const o=typeof t==="object"&&t!==null?t.text||t.content||String(t):String(t);const l=!i?e(o):o;const c=i?n?.userMessageGradient?{background:n.userMessageGradient}:{}:n?.aiMessageGradient?{background:n.aiMessageGradient}:{};return s("div",{className:`epkb-ai-chat-message ${i?"epkb-ai-chat-message--user":"epkb-ai-chat-message--assistant"}`},s("div",{className:"epkb-ai-chat-message-bubble",style:c},s("div",{className:"epkb-ai-chat-message-content",...!i&&l!==o?{dangerouslySetInnerHTML:{__html:l}}:{}},!i&&l!==o?null:o)))}),((e,a)=>e.message===a.message&&e.isUser===a.isUser&&e.widgetColors?.userMessageGradient===a.widgetColors?.userMessageGradient&&e.widgetColors?.aiMessageGradient===a.widgetColors?.aiMessageGradient))}function s(e,a){const{createElement:t}=a;const{isOpen:s,isExpanded:i,messages:n,inputValue:o,isTyping:l,errorMessage:c,isInitialConversationLoading:d,isSending:h,handoffEnabled:r,handoffActive:b,handoffSubmitted:p,handoffSubmitting:f,handoffButtonVisible:m,handoffButtonText:k,handoffConsentText:u,handoffForm:g,handoffErrors:v,handoffI18n:N,feedbackUI:C,setIsOpen:w,setIsExpanded:_,setInputValue:y,handleSend:x,handleKeyDown:M,clearConversation:I,handleHandoffSubmit:T,handleHandoffFieldChange:S,handleHandoffButtonClick:E,handleHandoffClose:H,handleFeedbackUp:B,handleFeedbackDown:U,handleFeedbackTryDifferent:F,handleFeedbackTalkToHuman:V,chatWindowRef:z,messagesEndRef:A,inputRef:G,toggleButtonRef:P,config:D,widgetColors:K,isAdmin:L,showTechnicalLogs:R,configError:$,Message:O,TypingIndicator:W,LoadingSkeleton:j}=e;return t("div",{className:"epkb-ai-chat-widget"},s&&t("div",{className:`epkb-ai-chat-window${i?" epkb-ai-chat-window--expanded":""}`,role:"dialog","aria-modal":"true","aria-label":D.widget_header_title||"AI Assistant",ref:z},t("div",{className:"epkb-ai-chat-header",style:{background:K.headerGradient}},t("h3",null,D.widget_header_title||"AI Assistant"),t("div",{className:"epkb-ai-chat-header-actions"},n.length>1&&!b&&!p&&t("button",{onClick:e=>{const a=e.currentTarget;a.classList.add("epkb-ai-chat-new--animating");setTimeout((()=>{I()}),500)},className:"epkb-ai-chat-new",title:"New Conversation","aria-label":"Start new conversation",style:{backgroundColor:K.newButton}},t("svg",{viewBox:"0 0 24 24",fill:"currentColor",width:"20",height:"20","aria-hidden":"true"},t("path",{d:"M17.65 6.35C16.2 4.9 14.21 4 12 4c-4.42 0-7.99 3.58-7.99 8s3.57 8 7.99 8c3.73 0 6.84-2.55 7.73-6h-2.08c-.82 2.33-3.04 4-5.65 4-3.31 0-6-2.69-6-6s2.69-6 6-6c1.66 0 3.14.69 4.22 1.78L13 11h7V4l-2.35 2.35z"}))),t("button",{onClick:()=>_(!i),className:"epkb-ai-chat-expand",title:i?"Collapse":"Expand","aria-label":i?"Collapse chat window":"Expand chat window"},t("svg",{viewBox:"0 0 24 24",fill:"currentColor",width:"16",height:"16","aria-hidden":"true"},t("path",{d:i?"M5 16h3v3h2v-5H5v2zm3-8H5v2h5V5H8v3zm6 11h2v-3h3v-2h-5v5zm2-11V5h-2v5h5V8h-3z":"M7 14H5v5h5v-2H7v-3zm-2-4h2V7h3V5H5v5zm12 7h-3v2h5v-5h-2v3zM14 5v2h3v3h2V5h-5z"}))),t("button",{onClick:()=>w(false),className:"epkb-ai-chat-close","aria-label":"Close chat"},t("span",null,"×")))),t("div",{className:"epkb-ai-chat-messages"},$?t("div",{className:"epkb-ai-chat-config-error"},t("p",null,$.message),$.settings_url&&t("a",{href:$.settings_url,target:"_blank",rel:"noopener noreferrer"},"Update settings")):d&&n.length===1?t(j):n.map((e=>{const a=e.messageId||e.id;const s=!e.isUser&&C?.messageId&&a===C.messageId;const i=s?C.mode:"none";return t("div",{key:a,className:"epkb-ai-chat-message-row"},t(O,{message:e.text,isUser:e.isUser,widgetColors:K}),i==="buttons"&&t("div",{className:"epkb-ai-chat-feedback"},t("button",{type:"button",className:"epkb-ai-chat-feedback-btn epkb-ai-chat-feedback-btn--up",onClick:B,"aria-label":N?.thumbs_up_text||"Helpful"},t("span",{className:"epkbfa epkbfa-thumbs-up","aria-hidden":"true"}),t("span",{className:"epkb-ai-chat-feedback-text"},N?.thumbs_up_text||"Helpful")),t("button",{type:"button",className:"epkb-ai-chat-feedback-btn epkb-ai-chat-feedback-btn--down",onClick:U,"aria-label":N?.thumbs_down_text||"Not helpful"},t("span",{className:"epkbfa epkbfa-thumbs-down","aria-hidden":"true"}),t("span",{className:"epkb-ai-chat-feedback-text"},N?.thumbs_down_text||"Not helpful"))),i==="thanks"&&t("div",{className:"epkb-ai-chat-feedback epkb-ai-chat-feedback--thanks"},t("span",{className:"epkb-ai-chat-feedback-thanks"},C?.thanksText||"")),i==="message"&&t("div",{className:"epkb-ai-chat-feedback epkb-ai-chat-feedback--choices"},C?.choicePrompt&&t("span",{className:"epkb-ai-chat-feedback-choice-title"},C.choicePrompt)),i==="choices"&&t("div",{className:"epkb-ai-chat-feedback epkb-ai-chat-feedback--choices"},C?.choicePrompt&&t("span",{className:"epkb-ai-chat-feedback-choice-title"},C.choicePrompt),t("div",{className:"epkb-ai-chat-feedback-choice-actions"},t("button",{type:"button",className:"epkb-ai-chat-feedback-choice-btn",onClick:F},C?.tryDifferentText||""),t("button",{type:"button",className:"epkb-ai-chat-feedback-choice-btn epkb-ai-chat-feedback-choice-btn--primary",onClick:V},C?.talkToHumanText||""))))})),!$&&l&&t(W),t("div",{ref:A}),!$&&c&&t("div",{id:"epkb-ai-chat-error-container",className:"epkb-ai-chat-error",style:{position:"sticky",bottom:0,marginTop:"10px"}},t("div",{className:"epkb-ai-chat-error__message"},c))),!$&&t("div",{className:"epkb-ai-chat-input-container"},!b&&!p&&t("div",{className:"epkb-ai-chat-input-wrapper"},t("input",{ref:G,type:"text",value:o,onChange:e=>y(e.target.value),onKeyDown:M,placeholder:D.input_placeholder_text||"Type your message...",className:"epkb-ai-chat-input"}),t("button",{onClick:x,className:`epkb-ai-chat-send ${h?"epkb-ai-chat-send--loading":""}`,disabled:!o.trim()||h,"aria-label":h?"Sending message":"Send message",style:{backgroundColor:K.sendButton}},h?"↻":"➤")),r&&!b&&!p&&m&&t("div",{className:"epkb-ai-chat-handoff"},t("button",{type:"button",className:"epkb-ai-chat-handoff-button",onClick:E},k||(N?.form_title||"Contact an Agent"))),b&&!p&&t("div",{className:"epkb-ai-chat-handoff"},t("form",{className:"epkb-ai-chat-handoff-form",onSubmit:T},t("div",{className:"epkb-ai-chat-handoff-header"},t("div",{className:"epkb-ai-chat-handoff-title"},N?.form_title||"Contact an Agent"),t("button",{type:"button",className:"epkb-ai-chat-handoff-close",onClick:H,"aria-label":N?.close_label||"Close"},N?.close_label||"Close")),t("div",{className:"epkb-ai-chat-handoff-field"},t("label",{className:"epkb-ai-chat-handoff-label",htmlFor:"epkb-ai-chat-handoff-first-name"},N?.first_name_label||"First Name"),t("input",{id:"epkb-ai-chat-handoff-first-name",type:"text",className:"epkb-ai-chat-handoff-input",value:g?.first_name||"",onChange:e=>S("first_name",e.target.value),disabled:f}),v?.first_name&&t("div",{className:"epkb-ai-chat-handoff-error"},v.first_name)),t("div",{className:"epkb-ai-chat-handoff-field"},t("label",{className:"epkb-ai-chat-handoff-label",htmlFor:"epkb-ai-chat-handoff-email"},N?.email_label||"Email"),t("input",{id:"epkb-ai-chat-handoff-email",type:"email",className:"epkb-ai-chat-handoff-input",value:g?.email||"",onChange:e=>S("email",e.target.value),disabled:f}),v?.email&&t("div",{className:"epkb-ai-chat-handoff-error"},v.email)),t("div",{className:"epkb-ai-chat-handoff-field"},t("label",{className:"epkb-ai-chat-handoff-label",htmlFor:"epkb-ai-chat-handoff-message"},N?.message_label||"Message"),t("textarea",{id:"epkb-ai-chat-handoff-message",className:"epkb-ai-chat-handoff-textarea",value:g?.message||"",onChange:e=>S("message",e.target.value),disabled:f,rows:3}),v?.message&&t("div",{className:"epkb-ai-chat-handoff-error"},v.message)),u&&t("div",{className:"epkb-ai-chat-handoff-consent"},u),v?.form&&t("div",{className:"epkb-ai-chat-handoff-error"},v.form),t("button",{type:"submit",className:"epkb-ai-chat-handoff-submit",disabled:f},f?N?.submitting_label||"Submitting...":N?.submit_label||"Submit"))))),t("button",{onClick:()=>w(!s),className:`epkb-ai-chat-toggle ${s?"epkb-ai-chat-toggle--open":""}`,"aria-label":s?"Close chat":"Open chat",style:{backgroundColor:K.launcher},ref:P},s?"×":"💬"))}window.EPKBChatDisplay={darkenColor:a,createMessageComponent:t,renderChatWidget:s}})();
Save
Cancel