var $jscomp = $jscomp || {};
$jscomp.scope = {};
$jscomp.createTemplateTagFirstArg = function (a) {
return (a.raw = a);
};
$jscomp.createTemplateTagFirstArgWithRaw = function (a, c) {
a.raw = c;
return a;
};
var chatButtonHtml =
'
\n
\n
\n'
);
},
initializeChat = function (a) {
var c = document.getElementById('chatbot-iframe').getAttribute('data-bot-src');
a.insertAdjacentHTML('beforeend', chatButtonHtml);
a.insertAdjacentHTML('beforeend', getChatContainerHtml(c));
var b = a.querySelector('.aibox-chat-button'),
f = a.querySelector('.aibox-chat-button > img'),
d = a.querySelector('#aibox-chat-container'),
g = a.querySelector('.aibox-openviewport'),
h = a.querySelector('.aibox-closeviewport');
a = function () {
d.style.display = 'block' == d.style.display ? 'none' : 'block';
b.style.display = 'block' == d.style.display ? 'none' : 'block';
};
close_icon = d.querySelector('.aibox-chat-close');
b.onclick = a;
close_icon.onclick = a;
a = function () {
d.classList.contains('aibox-enlarge')
? (d.classList.remove('aibox-enlarge'), g.classList.remove('aibox-viewportnone'), h.classList.add('aibox-viewportnone'))
: (d.classList.add('aibox-enlarge'), g.classList.add('aibox-viewportnone'), h.classList.remove('aibox-viewportnone'));
};
c = function (e) {
['touchmove', 'touchstart'].includes(e.type)
? ((b.style.top = e.touches[0].clientY - 25 + 'px'), (b.style.left = e.touches[0].clientX - 25 + 'px'))
: ((b.style.top = e.y - 25 + 'px'), (b.style.left = e.x - 25 + 'px'));
b.style.width = f.naturalWidth + 'px';
b.style.height = f.naturalHeight + 'px';
};
console.dir(f);
b.addEventListener('drag', c);
b.addEventListener('dragover', function (e) {
e.preventDefault();
});
b.addEventListener('dragend', c);
b.addEventListener('touchstart', c);
b.addEventListener('touchmove', c);
g.onclick = a;
h.onclick = a;
};
function initializeAIBox() {
var a = document.createElement('div'),
c = document.createElement('div');
c.id = 'aibox';
initializeAIBoxStyle(a);
a.appendChild(c);
document.body.appendChild(a);
initializeChat(c);
}
function initializeAIBoxStyle(a) {
style = document.createElement('style');
style.type = 'text/css';
style.innerText =
'\n /* \u653e\u5927 */\n #aibox .aibox-enlarge {\n width: 50%!important;\n height: 100%!important;\n bottom: 0!important;\n right: 0 !important;\n }\n @media only screen and (max-width: 768px){\n #aibox .aibox-enlarge {\n width: 100%!important;\n height: 100%!important;\n right: 0 !important;\n bottom: 0!important;\n }\n }\n \n /* \u5f15\u5bfc */\n \n #aibox .aibox-mask {\n position: fixed;\n z-index: 999;\n background-color: transparent;\n height: 100%;\n width: 100%;\n top: 0;\n left: 0;\n }\n #aibox .aibox-mask .aibox-content {\n width: 64px;\n height: 64px;\n box-shadow: 1px 1px 1px 2000px rgba(0,0,0,.6);\n position: absolute;\n right: 0;\n bottom: 30px;\n z-index: 1000;\n }\n #aibox-chat-container {\n width: 450px;\n height: 600px;\n display:none;\n }\n @media only screen and (max-width: 768px) {\n #aibox-chat-container {\n width: 100%;\n height: 70%;\n right: 0 !important;\n }\n }\n \n #aibox .aibox-chat-button{\n position: fixed;\n bottom: 4rem;\n right: 1rem;\n cursor: pointer;\n max-height:500px;\n max-width:500px;\n }\n #aibox #aibox-chat-container{\n z-index:10000;position: relative;\n border-radius: 8px;\n border: 1px solid #ffffff;\n background: linear-gradient(188deg, rgba(235, 241, 255, 0.20) 39.6%, rgba(231, 249, 255, 0.20) 94.3%), #EFF0F1;\n box-shadow: 0px 4px 8px 0px rgba(31, 35, 41, 0.10);\n position: fixed;bottom: 16px;right: 16px;overflow: hidden;\n }\n\n #aibox #aibox-chat-container .aibox-operate{\n top: 18px;\n right: 15px;\n position: absolute;\n display: flex;\n align-items: center;\n }\n #aibox #aibox-chat-container .aibox-operate .aibox-chat-close{\n margin-left:5px;\n cursor: pointer;\n }\n #aibox #aibox-chat-container .aibox-operate .aibox-openviewport{\n\n cursor: pointer;\n }\n #aibox #aibox-chat-container .aibox-operate .aibox-closeviewport{\n\n cursor: pointer;\n }\n #aibox #aibox-chat-container .aibox-viewportnone{\n display:none;\n }\n #aibox #aibox-chat-container #aibox-chat{\n height:100%;\n width:100%;\n border: none;\n}\n #aibox #aibox-chat-container {\n animation: appear .4s ease-in-out;\n }\n @keyframes appear {\n from {\n height: 0;;\n }\n \n to {\n height: 600px;\n }\n }';
a.appendChild(style);
}
function embedAIChatbot() {
initializeAIBox();
}
window.onload = embedAIChatbot;