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,CAAQ,aACvC,EAAE,MAAA,CAAO,WAAA,CAAY,CAAE,YAAa,6BAA8B,UAAW,CAAU,EAAG,IAC5F,MAAU,EAAE,IAAA,EAAQ,AAAuB,mCAAvB,EAAE,IAAA,CAAK,WAAA,CACzB,aAAa,OAAA,CAAQ,YAAa,EAAE,IAAA,CAAK,SAD3C,EAEU,AAAW,mCAAX,EAAE,IAAA,CACV,EAAE,MAAA,CAAO,WAAA,CAAY,CAAE,YAAa,iCAAkC,aAAc,KAAK,KAAA,CAAM,aAAa,OAAA,CAAQ,iBAAmB,QAAS,EAAG,KAC1I,EAAE,IAAA,EAAQ,AAAuB,kCAAvB,EAAE,IAAA,CAAK,WAAA,EAC1B,aAAa,OAAA,CAAQ,eAAgB,EAAE,IAAA,CAAK,YADtC,CAGV,CAGF,EAGgD,EAyB9C,EAAG,IACL,E","sources":["","webwhiz-sdk.js"],"sourcesContent":["(function () {\nvar $a4aff3bcc0534934$var$__WEBWHIZ__URL = $a4aff3bcc0534934$var$__WEBWHIZ__getWidgetURL();\nfunction $a4aff3bcc0534934$var$__WEBWHIZ__ready(fn) {\n if (document.readyState !== \"loading\") {\n fn();\n return;\n }\n document.addEventListener(\"DOMContentLoaded\", fn);\n}\nconst $a4aff3bcc0534934$var$widgetStyle = `\n.webwhiz-widget {\n position: fixed;\n z-index: 9999999;\n max-height: calc(100% - 30px);\n right: 20px;\n bottom: 20px;\n min-width: 80px;\n height: 80px;\n width: 80px;\n max-width: calc(100% - 40px);\n}\n.webwhiz-widget.wb-align-left {\n left: 0;\n right: auto;\n}\n.webwhiz-widget.wb-expand {\n width: 416px;\n height: 610px;\n min-width: 370px;\n}\n.webwhiz-widget.wb-maximize {\n width: 50%;\n height: calc(100% - 30px)\n}\n@media only screen and (device-width: 768px),\n only screen and (max-width: 768px){\n .webwhiz-widget.wb-maximize {\n width: 100%;\n height: 100%;\n }\n .webwhiz-widget {\n right: 0;\n bottom: 0;\n }\n .webwhiz-widget.wb-expand {\n width: 100%;\n height: 100%;\n min-width: 0;\n left: 0;\n right: 10px;\n bottom: 10px;\n top: 0;\n max-width: 100%;\n max-height: 100%;\n }\n}\n.webwhiz__msg-popup {\n position: fixed;\n bottom: 106px;\n max-width: fit-content;\n display: flex;\n flex-direction: column;\n max-width: 320px;\n opacity: 0;\n align-items: end;\n transition: all 0.3s ease-in-out;\n transform: translate3d(0px, 10px, 0px);\n}\n.webwhiz__msg-popup.webwhiz__msg-popup-left {\n left: 20px;\n}\n.webwhiz__msg-popup.webwhiz__msg-popup-right {\n right: 20px;\n}\n.webwhiz__msg-popup.webwhiz__msg-popup--show {\n opacity: 1;\n transform: translate3d(0px, 0px, 0px);\n}\n\n.webwhiz__msg-popup-item {\n cursor: pointer;\n padding: 20px;\n background-color: #FFF;\n display: inline-flex;\n width: auto;\n margin: 5px 0;\n font-size: 14px;\n border-radius: 6px;\n line-height: 1.5;\n color: #333;\n box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);\n}\n.webwhiz__msg-popup-close-btn {\n cursor: pointer;\n border-radius: 12px;\n background-color: #fff;\n font-size: 12px;\n color: rgba(0,0,0,0.65);\n border: 1px solid rgba(0,0,0,0.18);\n opacity: 0;\n width: 22px;\n height: 22px;\n display: flex;\n align-items: center;\n justify-content: center;\n position: relative;\n transition: opacity 0.3s ease-in-out;\n}\n\n.webwhiz__msg-popup-close-btn svg {\n width: 14px;\n height: 14px;\n flex-shrink: 0;\n}\n\n.webwhiz__msg-popup:hover .webwhiz__msg-popup-close-btn {\n opacity: 0.8;\n}\n.webwhiz__msg-popup .webwhiz__msg-popup-close-btn:hover {\n opacity: 1;\n}\n`;\nfunction $a4aff3bcc0534934$var$__WEBWHIZ__addIframe() {\n var ifrm = document.createElement(\"iframe\");\n const kbId = $a4aff3bcc0534934$var$__WEBWHIZ__getChatbotId();\n ifrm.setAttribute(\"class\", \"webwhiz-widget\");\n ifrm.setAttribute(\"id\", \"webwhiz-widget\");\n ifrm.setAttribute(\"data-powered-by\", \"https://www.webwhiz.ai/\");\n ifrm.setAttribute(\"frameborder\", \"0\");\n const scriptEl = document.getElementById(\"__webwhizSdk__\");\n const container = scriptEl.getAttribute(\"container\") || scriptEl.getAttribute(\"data-container\");\n if (container) {\n const $container = document.querySelector(container);\n if ($container) $container.appendChild(ifrm);\n } else {\n var styleSheet = document.createElement(\"style\");\n styleSheet.innerText = $a4aff3bcc0534934$var$widgetStyle;\n document.head.appendChild(styleSheet);\n document.body.appendChild(ifrm);\n }\n const baseUrl = $a4aff3bcc0534934$var$__WEBWHIZ__getBaseURL();\n ifrm.setAttribute(\"src\", $a4aff3bcc0534934$var$__WEBWHIZ__URL + \"?kbId=\" + kbId + \"&baseUrl=\" + baseUrl);\n return ifrm;\n}\nfunction $a4aff3bcc0534934$var$addPopup(config) {\n const welcomeMessagesHTML = config.welcomeMessages.map((msg)=>{\n return `
${msg}
`;\n }).join(\"\");\n const closeBtn = ``;\n let popupPositionClass = \"\";\n if (config.position === \"left\") popupPositionClass = \"webwhiz__msg-popup-left\";\n else popupPositionClass = \"webwhiz__msg-popup-right\";\n document.body.insertAdjacentHTML(\"beforeend\", `
${closeBtn}${welcomeMessagesHTML}
`);\n document.getElementById(\"webwhiz__msg-popup-close-btn\").onclick = ()=>{\n $a4aff3bcc0534934$var$removePopup();\n };\n const popupItems = document.getElementsByClassName(\"webwhiz__msg-popup-item\");\n for (const popupItem of popupItems)popupItem.onclick = ()=>{\n $a4aff3bcc0534934$var$openWidget();\n };\n setTimeout(()=>{\n const popup = document.getElementById(\"webwhiz__msg-popup\");\n if (popup) popup.classList.add(\"webwhiz__msg-popup--show\");\n }, config.popupDelay || 3000);\n}\nfunction $a4aff3bcc0534934$var$openWidget() {\n const iframe = document.getElementById(\"webwhiz-widget\");\n iframe.contentWindow.postMessage({\n messageType: \"webwhiz:expandWidget\"\n }, \"*\");\n}\nfunction $a4aff3bcc0534934$var$removePopup() {\n const popup = document.getElementById(\"webwhiz__msg-popup\");\n if (popup) {\n popup.classList.remove(\"webwhiz__msg-popup--show\");\n localStorage.setItem(\"webwhiz__popupRemoved\", true);\n setTimeout(()=>{\n popup.remove();\n }, 350);\n }\n}\nfunction $a4aff3bcc0534934$var$__WEBWHIZ__getEventHandler(ifrm) {\n const iframe = document.getElementById(\"webwhiz-widget\");\n const scriptEl = document.getElementById(\"__webwhizSdk__\");\n const container = scriptEl.getAttribute(\"container\") || scriptEl.getAttribute(\"data-container\");\n function webWhizEventHandler(e) {\n if (e.data === \"webwhiz:widget_expand\") {\n iframe.classList.add(\"wb-expand\");\n $a4aff3bcc0534934$var$removePopup();\n } else if (e.data === \"webwhiz:widget_collapse\") setTimeout(()=>{\n iframe.classList.remove(\"wb-expand\", \"wb-maximize\");\n }, 350);\n else if (e.data === \"webwhiz:widget_maximize\") iframe.classList.add(\"wb-maximize\");\n else if (e.data === \"webwhiz:widget_minimize\") iframe.classList.remove(\"wb-maximize\");\n else if (e.data && e.data.messageType === \"webwhiz:widget_config\") {\n const config = e.data.config || {};\n if (config.position === \"left\") iframe.classList.add(\"wb-align-left\");\n const popupRemoved = JSON.parse(localStorage.getItem(\"webwhiz__popupRemoved\"));\n if (!popupRemoved && config.showAsPopup && config.welcomeMessages && config.welcomeMessages.length > 0 && !container) $a4aff3bcc0534934$var$addPopup(config);\n } else if (e.data === \"webwhiz:widget_clear_history\") {\n localStorage.removeItem(\"sessionId\");\n localStorage.removeItem(\"isManualChat\");\n e.source.postMessage({\n messageType: \"webwhiz:recieve_session_id\",\n sessionId: \"\"\n }, \"*\");\n } else if (e.data === \"webwhiz:request_meta_data\") {\n const scriptEl = document.getElementById(\"__webwhizSdk__\");\n const container = scriptEl.getAttribute(\"container\") || scriptEl.getAttribute(\"data-container\");\n e.source.postMessage({\n messageType: \"webwhiz:recieve_meta_data\",\n url: window.location.href,\n container: container\n }, \"*\");\n } else if (e.data === \"webwhiz:request_session_id\") {\n const sessionId = localStorage.getItem(\"sessionId\");\n e.source.postMessage({\n messageType: \"webwhiz:recieve_session_id\",\n sessionId: sessionId\n }, \"*\");\n } else if (e.data && e.data.messageType === \"webwhiz:recieve_new_session_id\") localStorage.setItem(\"sessionId\", e.data.sessionId);\n else if (e.data === \"webwhiz:request_is_manual_chat\") e.source.postMessage({\n messageType: \"webwhiz:recieve_is_manual_chat\",\n isManualChat: JSON.parse(localStorage.getItem(\"isManualChat\") || \"false\")\n }, \"*\");\n else if (e.data && e.data.messageType === \"webwhiz:update_is_manual_chat\") localStorage.setItem(\"isManualChat\", e.data.isManualChat);\n }\n return webWhizEventHandler;\n}\nfunction $a4aff3bcc0534934$var$__WEBWHIZ__addEventListeners(ifrm) {\n window.onmessage = $a4aff3bcc0534934$var$__WEBWHIZ__getEventHandler(ifrm);\n}\nfunction $a4aff3bcc0534934$var$__WEBWHIZ__getChatbotId() {\n const scriptEl = document.getElementById(\"__webwhizSdk__\");\n const chatbotId = scriptEl.getAttribute(\"chatbotId\") || scriptEl.getAttribute(\"data-chatbot-id\");\n return chatbotId;\n}\nfunction $a4aff3bcc0534934$var$__WEBWHIZ__getWidgetURL() {\n const scriptEl = document.getElementById(\"__webwhizSdk__\");\n const baseURL = scriptEl.getAttribute(\"widgetUrl\") || scriptEl.getAttribute(\"data-widget-url\") || \"https://widget.nitbg.com\";\n return baseURL || \"https://widget.webwhiz.ai/\";\n}\nfunction $a4aff3bcc0534934$var$__WEBWHIZ__getBaseURL() {\n const scriptEl = document.getElementById(\"__webwhizSdk__\");\n const baseURL = scriptEl.getAttribute(\"baseUrl\") || scriptEl.getAttribute(\"data-base-url\") || \"https://chatapi.nitbg.com\";\n return baseURL || \"https://api.webwhiz.ai\";\n}\n$a4aff3bcc0534934$var$__WEBWHIZ__ready(()=>{\n setTimeout(()=>{\n var ifrm = $a4aff3bcc0534934$var$__WEBWHIZ__addIframe();\n $a4aff3bcc0534934$var$__WEBWHIZ__addEventListeners(ifrm);\n }, 1000);\n});\n\n})();\n//# sourceMappingURL=webwhiz-sdk.js.map\n","var __WEBWHIZ__URL = __WEBWHIZ__getWidgetURL();\n\nfunction __WEBWHIZ__ready(fn) {\n if (document.readyState !== \"loading\") {\n fn();\n return;\n }\n document.addEventListener(\"DOMContentLoaded\", fn);\n}\n\n\nconst widgetStyle = `\n.webwhiz-widget {\n position: fixed;\n z-index: 9999999;\n max-height: calc(100% - 30px);\n right: 20px;\n bottom: 20px;\n min-width: 80px;\n height: 80px;\n width: 80px;\n max-width: calc(100% - 40px);\n}\n.webwhiz-widget.wb-align-left {\n left: 0;\n right: auto;\n}\n.webwhiz-widget.wb-expand {\n width: 416px;\n height: 610px;\n min-width: 370px;\n}\n.webwhiz-widget.wb-maximize {\n width: 50%;\n height: calc(100% - 30px)\n}\n@media only screen and (device-width: 768px),\n only screen and (max-width: 768px){\n .webwhiz-widget.wb-maximize {\n width: 100%;\n height: 100%;\n }\n .webwhiz-widget {\n right: 0;\n bottom: 0;\n }\n .webwhiz-widget.wb-expand {\n width: 100%;\n height: 100%;\n min-width: 0;\n left: 0;\n right: 10px;\n bottom: 10px;\n top: 0;\n max-width: 100%;\n max-height: 100%;\n }\n}\n.webwhiz__msg-popup {\n position: fixed;\n bottom: 106px;\n max-width: fit-content;\n display: flex;\n flex-direction: column;\n max-width: 320px;\n opacity: 0;\n align-items: end;\n transition: all 0.3s ease-in-out;\n transform: translate3d(0px, 10px, 0px);\n}\n.webwhiz__msg-popup.webwhiz__msg-popup-left {\n left: 20px;\n}\n.webwhiz__msg-popup.webwhiz__msg-popup-right {\n right: 20px;\n}\n.webwhiz__msg-popup.webwhiz__msg-popup--show {\n opacity: 1;\n transform: translate3d(0px, 0px, 0px);\n}\n\n.webwhiz__msg-popup-item {\n cursor: pointer;\n padding: 20px;\n background-color: #FFF;\n display: inline-flex;\n width: auto;\n margin: 5px 0;\n font-size: 14px;\n border-radius: 6px;\n line-height: 1.5;\n color: #333;\n box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);\n}\n.webwhiz__msg-popup-close-btn {\n cursor: pointer;\n border-radius: 12px;\n background-color: #fff;\n font-size: 12px;\n color: rgba(0,0,0,0.65);\n border: 1px solid rgba(0,0,0,0.18);\n opacity: 0;\n width: 22px;\n height: 22px;\n display: flex;\n align-items: center;\n justify-content: center;\n position: relative;\n transition: opacity 0.3s ease-in-out;\n}\n\n.webwhiz__msg-popup-close-btn svg {\n width: 14px;\n height: 14px;\n flex-shrink: 0;\n}\n\n.webwhiz__msg-popup:hover .webwhiz__msg-popup-close-btn {\n opacity: 0.8;\n}\n.webwhiz__msg-popup .webwhiz__msg-popup-close-btn:hover {\n opacity: 1;\n}\n`\n\n\nfunction __WEBWHIZ__addIframe() {\n var ifrm = document.createElement(\"iframe\");\n const kbId = __WEBWHIZ__getChatbotId();\n ifrm.setAttribute(\"class\", \"webwhiz-widget\");\n ifrm.setAttribute(\"id\", \"webwhiz-widget\");\n ifrm.setAttribute(\"data-powered-by\", \"https://www.webwhiz.ai/\");\n ifrm.setAttribute(\"frameborder\", \"0\");\n\n const scriptEl = document.getElementById(\"__webwhizSdk__\");\n const container = scriptEl.getAttribute('container') || scriptEl.getAttribute('data-container');\n\n\n if (container) {\n const $container = document.querySelector(container);\n if ($container) {\n $container.appendChild(ifrm);\n }\n } else {\n var styleSheet = document.createElement('style');\n styleSheet.innerText = widgetStyle;\n document.head.appendChild(styleSheet);\n document.body.appendChild(ifrm);\n }\n\n const baseUrl = __WEBWHIZ__getBaseURL();\n ifrm.setAttribute(\"src\", __WEBWHIZ__URL + '?kbId=' + kbId +'&baseUrl=' + baseUrl);\n return ifrm;\n}\n\nfunction addPopup(config) {\n const welcomeMessagesHTML = config.welcomeMessages.map(msg => {\n return `
${msg}
`\n }).join(''); \n const closeBtn = ``\n let popupPositionClass = ''\n if(config.position === 'left') {\n popupPositionClass = 'webwhiz__msg-popup-left'\n } else {\n popupPositionClass = 'webwhiz__msg-popup-right'\n }\n document.body.insertAdjacentHTML('beforeend', `
${closeBtn}${welcomeMessagesHTML}
`);\n document.getElementById('webwhiz__msg-popup-close-btn').onclick = () => {\n removePopup();\n }\n const popupItems = document.getElementsByClassName('webwhiz__msg-popup-item');\n for (const popupItem of popupItems) {\n popupItem.onclick = () => {\n openWidget();\n };\n }\n setTimeout(() => {\n const popup = document.getElementById('webwhiz__msg-popup');\n if(popup) {\n popup.classList.add('webwhiz__msg-popup--show');\n }\n }, config.popupDelay || 3000);\n}\n\nfunction openWidget() {\n const iframe = document.getElementById(\"webwhiz-widget\");\n\n iframe.contentWindow.postMessage({ messageType: 'webwhiz:expandWidget' }, '*');\n}\n\nfunction removePopup() {\n const popup = document.getElementById('webwhiz__msg-popup');\n if(popup) {\n popup.classList.remove('webwhiz__msg-popup--show');\n localStorage.setItem(\"webwhiz__popupRemoved\", true);\n setTimeout(() => {\n popup.remove();\n }, 350);\n }\n}\n\nfunction __WEBWHIZ__getEventHandler(ifrm) {\n const iframe = document.getElementById(\"webwhiz-widget\");\n const scriptEl = document.getElementById(\"__webwhizSdk__\");\n const container = scriptEl.getAttribute('container') || scriptEl.getAttribute('data-container');\n function webWhizEventHandler(e) {\n if (e.data === \"webwhiz:widget_expand\") {\n iframe.classList.add(\"wb-expand\");\n removePopup();\n } else if (e.data === \"webwhiz:widget_collapse\") {\n setTimeout(() => {\n iframe.classList.remove(\"wb-expand\", \"wb-maximize\");\n }, 350);\n } else if (e.data === \"webwhiz:widget_maximize\") {\n iframe.classList.add(\"wb-maximize\");\n } else if (e.data === \"webwhiz:widget_minimize\") {\n iframe.classList.remove(\"wb-maximize\");\n } else if (e.data && e.data.messageType === 'webwhiz:widget_config') {\n const config = e.data.config || {};\n if (config.position === 'left'){\n iframe.classList.add(\"wb-align-left\");\n }\n const popupRemoved = JSON.parse(localStorage.getItem(\"webwhiz__popupRemoved\"));\n if(!popupRemoved && config.showAsPopup && config.welcomeMessages && config.welcomeMessages.length > 0 && !container) {\n addPopup(config);\n }\n } else if (e.data === \"webwhiz:widget_clear_history\") {\n localStorage.removeItem('sessionId');\n localStorage.removeItem('isManualChat');\n e.source.postMessage({ messageType: 'webwhiz:recieve_session_id', sessionId: '' }, '*');\n } else if (e.data === \"webwhiz:request_meta_data\") {\n const scriptEl = document.getElementById(\"__webwhizSdk__\");\n const container = scriptEl.getAttribute('container') || scriptEl.getAttribute('data-container');\n e.source.postMessage({ messageType: 'webwhiz:recieve_meta_data', url: window.location.href, container: container }, '*');\n } else if (e.data === \"webwhiz:request_session_id\") {\n const sessionId = localStorage.getItem(\"sessionId\");\n e.source.postMessage({ messageType: 'webwhiz:recieve_session_id', sessionId: sessionId }, '*');\n } else if(e.data && e.data.messageType === 'webwhiz:recieve_new_session_id') {\n localStorage.setItem(\"sessionId\", e.data.sessionId);\n } else if(e.data === 'webwhiz:request_is_manual_chat') {\n e.source.postMessage({ messageType: 'webwhiz:recieve_is_manual_chat', isManualChat: JSON.parse(localStorage.getItem(\"isManualChat\") || 'false') }, '*');\n } else if(e.data && e.data.messageType === 'webwhiz:update_is_manual_chat') {\n localStorage.setItem(\"isManualChat\", e.data.isManualChat);\n }\n }\n\n return webWhizEventHandler;\n}\n\nfunction __WEBWHIZ__addEventListeners(ifrm) {\n window.onmessage = __WEBWHIZ__getEventHandler(ifrm);\n}\n\nfunction __WEBWHIZ__getChatbotId() {\n const scriptEl = document.getElementById(\"__webwhizSdk__\");\n const chatbotId = scriptEl.getAttribute('chatbotId') || scriptEl.getAttribute('data-chatbot-id');\n return chatbotId;\n}\n\nfunction __WEBWHIZ__getWidgetURL() {\n const scriptEl = document.getElementById(\"__webwhizSdk__\");\n const baseURL = scriptEl.getAttribute('widgetUrl') || scriptEl.getAttribute('data-widget-url') || process.env.WW_WIDGET_URL;\n return baseURL || 'https://widget.webwhiz.ai/';\n}\n\nfunction __WEBWHIZ__getBaseURL() {\n const scriptEl = document.getElementById(\"__webwhizSdk__\");\n const baseURL = scriptEl.getAttribute('baseUrl') || scriptEl.getAttribute('data-base-url') || process.env.WW_BASE_URL;\n return baseURL || 'https://api.webwhiz.ai';\n}\n\n__WEBWHIZ__ready(() => {\n setTimeout(() => {\n var ifrm = __WEBWHIZ__addIframe();\n __WEBWHIZ__addEventListeners(ifrm);\n }, 1000);\n});\n"],"names":["$a4aff3bcc0534934$var$__WEBWHIZ__URL","$a4aff3bcc0534934$var$__WEBWHIZ__getWidgetURL","scriptEl","document","getElementById","baseURL","getAttribute","$a4aff3bcc0534934$var$widgetStyle","$a4aff3bcc0534934$var$removePopup","popup","classList","remove","localStorage","setItem","setTimeout","$a4aff3bcc0534934$var$__WEBWHIZ__ready","fn","readyState","addEventListener","$a4aff3bcc0534934$var$__WEBWHIZ__addIframe","ifrm","createElement","kbId","$a4aff3bcc0534934$var$__WEBWHIZ__getChatbotId","chatbotId","setAttribute","container","$container","querySelector","appendChild","styleSheet","innerText","head","body","baseUrl","$a4aff3bcc0534934$var$__WEBWHIZ__getBaseURL","window","onmessage","$a4aff3bcc0534934$var$__WEBWHIZ__getEventHandler","iframe","e","data","add","messageType","config","position","popupRemoved","JSON","parse","getItem","showAsPopup","welcomeMessages","length","$a4aff3bcc0534934$var$addPopup","welcomeMessagesHTML","map","msg","join","closeBtn","popupPositionClass","insertAdjacentHTML","onclick","popupItems","getElementsByClassName","popupItem","$a4aff3bcc0534934$var$openWidget","contentWindow","postMessage","popupDelay","removeItem","source","sessionId","url","location","href","isManualChat"],"version":3,"file":"webwhiz-sdk.js.map"}