(()=>{var t=t||{};t.helpPage=t.helpPage||{},window.DocsBotAI=window.DocsBotAI||{},((t,e)=>{"use strict";e.selectors={body:"body",helpHubPageID:"help-hub-page",docsbotWidget:"docsbot-widget-embed",optOutMessage:".tec-help-hub-iframe-opt-out-message"},e.DocsBotAIcss="\n\t\t\t\t\t\t/* DocsBot iframe box dimensions */\n\t\t\t\t\t\t.docsbot-iframe-box {\n\t\t\t\t\t\t\theight: 740px;\n\t\t\t\t\t\t\tmax-height: 740px;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\t/* Container styling */\n\t\t\t\t\t\t.docsbot-chat-container {\n\t\t\t\t\t\t\tfont-family: Arial, Helvetica, sans-serif;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\t/* Inner container styling */\n\t\t\t\t\t\t.docsbot-chat-inner-container {\n\t\t\t\t\t\t\tborder-radius: 0;\n\t\t\t\t\t\t\tbackground-color: #ffffff !important;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\t/* Bot message styling */\n\t\t\t\t\t\t.docsbot-chat-bot-message {\n\t\t\t\t\t\t\tborder-color: #334aff;\n\t\t\t\t\t\t\tbackground: #E6E9FF !important;\n\t\t\t\t\t\t\tcolor: #000000 !important;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\t/* Header styling */\n\t\t\t\t\t\t.docsbot-chat-header {\n\t\t\t\t\t\t\tbackground-color: #ffffff !important;\n\t\t\t\t\t\t\tborder-bottom: solid 1px #C3C4C7;\n\t\t\t\t\t\t\tcolor: #000000 !important;\n\t\t\t\t\t\t\tpadding: 10px 24px;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\t/* Header content styling */\n\t\t\t\t\t\t.docsbot-chat-header-content h1 {\n\t\t\t\t\t\t\ttext-align: left;\n\t\t\t\t\t\t}\n\t\t\t\t\t\t.docsbot-chat-header-content span {\n\t\t\t\t\t\t\tdisplay: none;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\t/* Suggested questions container styling */\n\t\t\t\t\t\t.docsbot-chat-suggested-questions-container button {\n\t\t\t\t\t\t\tbackground-color: #F6F7F7 !important;\n\t\t\t\t\t\t\tborder: solid 1px #C3C4C7 !important;\n\t\t\t\t\t\t\tborder-radius: 3px;\n\t\t\t\t\t\t\tcolor: #000000 !important;\n\t\t\t\t\t\t}\n\t\t\t\t\t\t.docsbot-chat-suggested-questions-container span {\n\t\t\t\t\t\t\tcolor: #000000 !important;\n\t\t\t\t\t\t}\n\t\t\t\t\t\t.docsbot-user-chat-message {\n\t\t\t\t\t\t\tbackground-color: #0057C7;\n\t\t\t\t\t\t}\n\t\t\t\t\t",e.setup=()=>{const t=document.getElementById(e.selectors.helpHubPageID),n="1"===t.getAttribute("data-opted-in"),o=document.querySelector(e.selectors.optOutMessage),s=document.getElementById(e.selectors.docsbotWidget);n?(e.loadAndInitializeZendeskWidget(),e.initializeDocsBot()):(o.classList.remove("hide"),s.classList.add("hide"),t.classList.add("blackout"))},e.loadZendeskWidgetScript=t=>new Promise(((e,n)=>{const o=document.createElement("script");o.id="ze-snippet",o.src=`https://static.zdassets.com/ekr/snippet.js?key=${t}`,o.async=!0,document.head.appendChild(o),o.onload=()=>e(),o.onerror=()=>n(new Error("Failed to load Zendesk Web Widget"))})),e.initializeZendesk=()=>{e.isZendeskInitialized=!1;const t=document.getElementById(e.selectors.helpHubPageID);zE("webWidget","hide",(()=>{e.isZendeskInitialized=!0})),zE("webWidget:on","open",(()=>{e.isZendeskInitialized&&t.classList.add("blackout")})),zE("webWidget:on","close",(()=>{zE("webWidget","hide"),t.classList.remove("blackout")}))},e.handlePostMessageEvents=t=>{const n=document.getElementById(e.selectors.helpHubPageID);if(t.origin!==window.location.origin)return;const{action:o,data:s}=t.data;"runScript"===o?"openZendesk"===s&&(zE("webWidget","show"),zE("webWidget","open"),n.classList.add("blackout")):console.warn("Unhandled action:",o)},e.loadAndInitializeZendeskWidget=()=>{e.loadZendeskWidgetScript(helpHubSettings.zendeskChatKey).then((()=>e.initializeZendesk())).catch((t=>console.error("Zendesk Widget failed to load:",t))),window.addEventListener("message",e.handlePostMessageEvents)},e.observeElement=t=>new Promise((e=>{const n=document.querySelector(t);if(n)return e(n);const o=new MutationObserver((n=>{const s=document.querySelector(t);s&&(e(s),o.disconnect())}));o.observe(document.body,{childList:!0,subtree:!0})})),e.initializeDocsBot=()=>{const t=document.getElementById(e.selectors.helpHubPageID);document.getElementById(e.selectors.docsbotWidget).classList.remove("hide"),DocsBotAI.init=t=>new Promise(((n,o)=>{const s=document.createElement("script");s.type="text/javascript",s.async=!0,s.src="https://widget.docsbot.ai/chat.js";const i=document.getElementsByTagName("script")[0];i.parentNode.insertBefore(s,i),s.addEventListener("load",(()=>{Promise.all([window.DocsBotAI.mount({...t}),e.observeElement("#docsbotai-root")]).then(n).catch(o)})),s.addEventListener("error",(t=>{o(t.message)}))})),DocsBotAI.init({id:helpHubSettings.docsbot_key,options:{customCSS:e.DocsBotAIcss},supportCallback:e=>{e.preventDefault(),t.classList.add("blackout"),zE("webWidget","show"),zE("webWidget","open")}})},t(e.setup)})(jQuery,t.helpPage),window.tec=window.tec||{},window.tec.common=window.tec.common||{},window.tec.common.admin=window.tec.common.admin||{},window.tec.common.admin.helpHubIframe={}})();