/*! * Bootstrap v4.6.2 (https://getbootstrap.com/) * Copyright 2011-2022 The Bootstrap Authors * Copyright 2011-2022 Twitter, Inc. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) */ if ('undefined' == typeof vajQuery) throw new Error("Bootstrap's JavaScript requires jQuery"); +(function (a) { 'use strict'; var b = a.fn.jquery.split(' ')[0].split('.'); //if ((b[0] < 2 && b[1] < 9) || (1 == b[0] && 9 == b[1] && b[2] < 1) || b[0] > 2) throw new Error("Bootstrap's JavaScript requires jQuery version 1.9.1 or higher, but lower than version 3"); })(vajQuery), +(function (a) { 'use strict'; function b() { var a = document.createElement('bootstrap'), b = {WebkitTransition: 'webkitTransitionEnd', MozTransition: 'transitionend', OTransition: 'oTransitionEnd otransitionend', transition: 'transitionend'}; for (var c in b) if (void 0 !== a.style[c]) return {end: b[c]}; return !1; } (a.fn.emulateTransitionEnd = function (b) { var c = !1, d = this; a(this).one('bsTransitionEnd', function () { c = !0; }); var e = function () { c || a(d).trigger(a.support.transition.end); }; return setTimeout(e, b), this; }), a(function () { (a.support.transition = b()), a.support.transition && (a.event.special.bsTransitionEnd = { bindType: a.support.transition.end, delegateType: a.support.transition.end, handle: function (b) { return a(b.target).is(this) ? b.handleObj.handler.apply(this, arguments) : void 0; } }); }); })(vajQuery), +(function (a) { 'use strict'; function b(b) { return this.each(function () { var c = a(this), e = c.data('bs.alert'); e || c.data('bs.alert', (e = new d(this))), 'string' == typeof b && e[b].call(c); }); } var c = '[data-dismiss="alert"]', d = function (b) { a(b).on('click', c, this.close); }; (d.VERSION = '4.6.2'), (d.TRANSITION_DURATION = 150), (d.prototype.close = function (b) { function c() { g.detach().trigger('closed.bs.alert').remove(); } var e = a(this), f = e.attr('data-target'); f || ((f = e.attr('href')), (f = f && f.replace(/.*(?=#[^\s]*$)/, ''))); var g = a(f); b && b.preventDefault(), g.length || (g = e.closest('.alert')), g.trigger((b = a.Event('close.bs.alert'))), b.isDefaultPrevented() || (g.removeClass('in'), a.support.transition && g.hasClass('fade') ? g.one('bsTransitionEnd', c).emulateTransitionEnd(d.TRANSITION_DURATION) : c()); }); var e = a.fn.alert; (a.fn.alert = b), (a.fn.alert.Constructor = d), (a.fn.alert.noConflict = function () { return (a.fn.alert = e), this; }), a(document).on('click.bs.alert.data-api', c, d.prototype.close); })(vajQuery), +(function (a) { 'use strict'; function b(b) { return this.each(function () { var d = a(this), e = d.data('bs.button'), f = 'object' == typeof b && b; e || d.data('bs.button', (e = new c(this, f))), 'toggle' == b ? e.toggle() : b && e.setState(b); }); } var c = function (b, d) { (this.$element = a(b)), (this.options = a.extend({}, c.DEFAULTS, d)), (this.isLoading = !1); }; (c.VERSION = '4.6.2'), (c.DEFAULTS = {loadingText: 'loading...'}), (c.prototype.setState = function (b) { var c = 'disabled', d = this.$element, e = d.is('input') ? 'val' : 'html', f = d.data(); (b += 'Text'), null == f.resetText && d.data('resetText', d[e]()), setTimeout( a.proxy(function () { d[e](null == f[b] ? this.options[b] : f[b]), 'loadingText' == b ? ((this.isLoading = !0), d.addClass(c).attr(c, c)) : this.isLoading && ((this.isLoading = !1), d.removeClass(c).removeAttr(c)); }, this), 0 ); }), (c.prototype.toggle = function () { var a = !0, b = this.$element.closest('[data-toggle="buttons"]'); if (b.length) { var c = this.$element.find('input'); 'radio' == c.prop('type') ? (c.prop('checked') && (a = !1), b.find('.active').removeClass('active'), this.$element.addClass('active')) : 'checkbox' == c.prop('type') && (c.prop('checked') !== this.$element.hasClass('active') && (a = !1), this.$element.toggleClass('active')), c.prop('checked', this.$element.hasClass('active')), a && c.trigger('change'); } else this.$element.attr('aria-pressed', !this.$element.hasClass('active')), this.$element.toggleClass('active'); }); var d = a.fn.button; (a.fn.button = b), (a.fn.button.Constructor = c), (a.fn.button.noConflict = function () { return (a.fn.button = d), this; }), a(document) .on('click.bs.button.data-api', '[data-toggle^="button"]', function (c) { var d = a(c.target); d.hasClass('btn') || (d = d.closest('.btn')), b.call(d, 'toggle'), a(c.target).is('input[type="radio"]') || a(c.target).is('input[type="checkbox"]') || c.preventDefault(); }) .on('focus.bs.button.data-api blur.bs.button.data-api', '[data-toggle^="button"]', function (b) { a(b.target) .closest('.btn') .toggleClass('focus', /^focus(in)?$/.test(b.type)); }); })(vajQuery), +(function (a) { 'use strict'; function b(b) { return this.each(function () { var d = a(this), e = d.data('bs.carousel'), f = a.extend({}, c.DEFAULTS, d.data(), 'object' == typeof b && b), g = 'string' == typeof b ? b : f.slide; e || d.data('bs.carousel', (e = new c(this, f))), 'number' == typeof b ? e.to(b) : g ? e[g]() : f.interval && e.pause().cycle(); }); } var c = function (b, c) { (this.$element = a(b)), (this.$indicators = this.$element.find('.carousel-indicators')), (this.options = c), (this.paused = null), (this.sliding = null), (this.interval = null), (this.$active = null), (this.$items = null), this.options.keyboard && this.$element.on('keydown.bs.carousel', a.proxy(this.keydown, this)), 'hover' == this.options.pause && !('ontouchstart' in document.documentElement) && this.$element.on('mouseenter.bs.carousel', a.proxy(this.pause, this)).on('mouseleave.bs.carousel', a.proxy(this.cycle, this)); }; (c.VERSION = '4.6.2'), (c.TRANSITION_DURATION = 600), (c.DEFAULTS = {interval: 5e3, pause: 'hover', wrap: !0, keyboard: !0}), (c.prototype.keydown = function (a) { if (!/input|textarea/i.test(a.target.tagName)) { switch (a.which) { case 37: this.prev(); break; case 39: this.next(); break; default: return; } a.preventDefault(); } }), (c.prototype.cycle = function (b) { return b || (this.paused = !1), this.interval && clearInterval(this.interval), this.options.interval && !this.paused && (this.interval = setInterval(a.proxy(this.next, this), this.options.interval)), this; }), (c.prototype.getItemIndex = function (a) { return (this.$items = a.parent().children('.item')), this.$items.index(a || this.$active); }), (c.prototype.getItemForDirection = function (a, b) { var c = this.getItemIndex(b), d = ('prev' == a && 0 === c) || ('next' == a && c == this.$items.length - 1); if (d && !this.options.wrap) return b; var e = 'prev' == a ? -1 : 1, f = (c + e) % this.$items.length; return this.$items.eq(f); }), (c.prototype.to = function (a) { var b = this, c = this.getItemIndex((this.$active = this.$element.find('.item.active'))); return a > this.$items.length - 1 || 0 > a ? void 0 : this.sliding ? this.$element.one('slid.bs.carousel', function () { b.to(a); }) : c == a ? this.pause().cycle() : this.slide(a > c ? 'next' : 'prev', this.$items.eq(a)); }), (c.prototype.pause = function (b) { return b || (this.paused = !0), this.$element.find('.next, .prev').length && a.support.transition && (this.$element.trigger(a.support.transition.end), this.cycle(!0)), (this.interval = clearInterval(this.interval)), this; }), (c.prototype.next = function () { return this.sliding ? void 0 : this.slide('next'); }), (c.prototype.prev = function () { return this.sliding ? void 0 : this.slide('prev'); }), (c.prototype.slide = function (b, d) { var e = this.$element.find('.item.active'), f = d || this.getItemForDirection(b, e), g = this.interval, h = 'next' == b ? 'left' : 'right', i = this; if (f.hasClass('active')) return (this.sliding = !1); var j = f[0], k = a.Event('slide.bs.carousel', {relatedTarget: j, direction: h}); if ((this.$element.trigger(k), !k.isDefaultPrevented())) { if (((this.sliding = !0), g && this.pause(), this.$indicators.length)) { this.$indicators.find('.active').removeClass('active'); var l = a(this.$indicators.children()[this.getItemIndex(f)]); l && l.addClass('active'); } var m = a.Event('slid.bs.carousel', {relatedTarget: j, direction: h}); return ( a.support.transition && this.$element.hasClass('slide') ? (f.addClass(b), f[0].offsetWidth, e.addClass(h), f.addClass(h), e .one('bsTransitionEnd', function () { f.removeClass([b, h].join(' ')).addClass('active'), e.removeClass(['active', h].join(' ')), (i.sliding = !1), setTimeout(function () { i.$element.trigger(m); }, 0); }) .emulateTransitionEnd(c.TRANSITION_DURATION)) : (e.removeClass('active'), f.addClass('active'), (this.sliding = !1), this.$element.trigger(m)), g && this.cycle(), this ); } }); var d = a.fn.carousel; (a.fn.carousel = b), (a.fn.carousel.Constructor = c), (a.fn.carousel.noConflict = function () { return (a.fn.carousel = d), this; }); var e = function (c) { var d, e = a(this), f = a(e.attr('data-target') || ((d = e.attr('href')) && d.replace(/.*(?=#[^\s]+$)/, ''))); if (f.hasClass('carousel')) { var g = a.extend({}, f.data(), e.data()), h = e.attr('data-slide-to'); h && (g.interval = !1), b.call(f, g), h && f.data('bs.carousel').to(h), c.preventDefault(); } }; a(document).on('click.bs.carousel.data-api', '[data-slide]', e).on('click.bs.carousel.data-api', '[data-slide-to]', e), a(window).on('load', function () { a('[data-ride="carousel"]').each(function () { var c = a(this); b.call(c, c.data()); }); }); })(vajQuery), +(function (a) { 'use strict'; function b(b) { var c, d = b.attr('data-target') || ((c = b.attr('href')) && c.replace(/.*(?=#[^\s]+$)/, '')); return a(d); } function c(b) { return this.each(function () { var c = a(this), e = c.data('bs.collapse'), f = a.extend({}, d.DEFAULTS, c.data(), 'object' == typeof b && b); !e && f.toggle && /show|hide/.test(b) && (f.toggle = !1), e || c.data('bs.collapse', (e = new d(this, f))), 'string' == typeof b && e[b](); }); } var d = function (b, c) { (this.$element = a(b)), (this.options = a.extend({}, d.DEFAULTS, c)), (this.$trigger = a('[data-toggle="collapse"][href="#' + b.id + '"],[data-toggle="collapse"][data-target="#' + b.id + '"]')), (this.transitioning = null), this.options.parent ? (this.$parent = this.getParent()) : this.addAriaAndCollapsedClass(this.$element, this.$trigger), this.options.toggle && this.toggle(); }; (d.VERSION = '4.6.2'), (d.TRANSITION_DURATION = 350), (d.DEFAULTS = {toggle: !0}), (d.prototype.dimension = function () { var a = this.$element.hasClass('width'); return a ? 'width' : 'height'; }), (d.prototype.show = function () { if (!this.transitioning && !this.$element.hasClass('in')) { var b, e = this.$parent && this.$parent.children('.panel').children('.in, .collapsing'); if (!(e && e.length && ((b = e.data('bs.collapse')), b && b.transitioning))) { var f = a.Event('show.bs.collapse'); if ((this.$element.trigger(f), !f.isDefaultPrevented())) { e && e.length && (c.call(e, 'hide'), b || e.data('bs.collapse', null)); var g = this.dimension(); this.$element.removeClass('collapse').addClass('collapsing')[g](0).attr('aria-expanded', !0), this.$trigger.removeClass('collapsed').attr('aria-expanded', !0), (this.transitioning = 1); var h = function () { this.$element.removeClass('collapsing').addClass('collapse in')[g](''), (this.transitioning = 0), this.$element.trigger('shown.bs.collapse'); }; if (!a.support.transition) return h.call(this); var i = a.camelCase(['scroll', g].join('-')); this.$element.one('bsTransitionEnd', a.proxy(h, this)).emulateTransitionEnd(d.TRANSITION_DURATION)[g](this.$element[0][i]); } } } }), (d.prototype.hide = function () { if (!this.transitioning && this.$element.hasClass('in')) { var b = a.Event('hide.bs.collapse'); if ((this.$element.trigger(b), !b.isDefaultPrevented())) { var c = this.dimension(); this.$element[c](this.$element[c]())[0].offsetHeight, this.$element.addClass('collapsing').removeClass('collapse in').attr('aria-expanded', !1), this.$trigger.addClass('collapsed').attr('aria-expanded', !1), (this.transitioning = 1); var e = function () { (this.transitioning = 0), this.$element.removeClass('collapsing').addClass('collapse').trigger('hidden.bs.collapse'); }; return a.support.transition ? void this.$element[c](0).one('bsTransitionEnd', a.proxy(e, this)).emulateTransitionEnd(d.TRANSITION_DURATION) : e.call(this); } } }), (d.prototype.toggle = function () { this[this.$element.hasClass('in') ? 'hide' : 'show'](); }), (d.prototype.getParent = function () { return a(this.options.parent) .find('[data-toggle="collapse"][data-parent="' + this.options.parent + '"]') .each( a.proxy(function (c, d) { var e = a(d); this.addAriaAndCollapsedClass(b(e), e); }, this) ) .end(); }), (d.prototype.addAriaAndCollapsedClass = function (a, b) { var c = a.hasClass('in'); a.attr('aria-expanded', c), b.toggleClass('collapsed', !c).attr('aria-expanded', c); }); var e = a.fn.collapse; (a.fn.collapse = c), (a.fn.collapse.Constructor = d), (a.fn.collapse.noConflict = function () { return (a.fn.collapse = e), this; }), a(document).on('click.bs.collapse.data-api', '[data-toggle="collapse"]', function (d) { var e = a(this); if(e.attr('data-target') && e.attr('data-target').match(/.*(?=#[^\s]+$)/) === null){ return; }else{ e.attr('data-target') || d.preventDefault(); var f = b(e), g = f.data('bs.collapse'), h = g ? 'toggle' : e.data(); c.call(f, h); } }); })(vajQuery), +(function (a) { 'use strict'; function b(b) { var c = b.attr('data-target'); c || ((c = b.attr('href')), (c = c && /#[A-Za-z]/.test(c) && c.replace(/.*(?=#[^\s]*$)/, ''))); var d = c && a(c); return d && d.length ? d : b.parent(); } function c(c) { (c && 3 === c.which) || (a(e).remove(), a(f).each(function () { var d = a(this), e = b(d), f = {relatedTarget: this}; e.hasClass('open') && ((c && 'click' == c.type && /input|textarea/i.test(c.target.tagName) && a.contains(e[0], c.target)) || (e.trigger((c = a.Event('hide.bs.dropdown', f))), c.isDefaultPrevented() || (d.attr('aria-expanded', 'false'), e.removeClass('open').trigger(a.Event('hidden.bs.dropdown', f))))); })); } function d(b) { return this.each(function () { var c = a(this), d = c.data('bs.dropdown'); d || c.data('bs.dropdown', (d = new g(this))), 'string' == typeof b && d[b].call(c); }); } var e = '.dropdown-backdrop', f = '[data-toggle="dropdown"]', g = function (b) { a(b).on('click.bs.dropdown', this.toggle); }; (g.VERSION = '4.6.2'), (g.prototype.toggle = function (d) { var e = a(this); if(e.attr('data-target') && e.attr('data-target').match(/.*(?=#[^\s]+$)/) === null){ return !1; }else { if (!e.is('.disabled, :disabled')){ var f = b(e), g = f.hasClass('open'); if ((c(), !g)) { 'ontouchstart' in document.documentElement && !f.closest('.navbar-nav').length && a(document.createElement('div')).addClass('dropdown-backdrop').insertAfter(a(this)).on('click', c); var h = {relatedTarget: this}; if ((f.trigger((d = a.Event('show.bs.dropdown', h))), d.isDefaultPrevented())) return; e.trigger('focus').attr('aria-expanded', 'true'), f.toggleClass('open').trigger(a.Event('shown.bs.dropdown', h)); } return !1; } } }), (g.prototype.keydown = function (c) { if (/(38|40|27|32)/.test(c.which) && !/input|textarea/i.test(c.target.tagName)) { var d = a(this); if ((c.preventDefault(), c.stopPropagation(), !d.is('.disabled, :disabled'))) { var e = b(d), g = e.hasClass('open'); if ((!g && 27 != c.which) || (g && 27 == c.which)) return 27 == c.which && e.find(f).trigger('focus'), d.trigger('click'); var h = ' li:not(.disabled):visible a', i = e.find('.dropdown-menu' + h); if (i.length) { var j = i.index(c.target); 38 == c.which && j > 0 && j--, 40 == c.which && j < i.length - 1 && j++, ~j || (j = 0), i.eq(j).trigger('focus'); } } } }); var h = a.fn.dropdown; (a.fn.dropdown = d), (a.fn.dropdown.Constructor = g), (a.fn.dropdown.noConflict = function () { return (a.fn.dropdown = h), this; }), a(document) .on('click.bs.dropdown.data-api', c) .on('click.bs.dropdown.data-api', '.dropdown form', function (a) { a.stopPropagation(); }) .on('click.bs.dropdown.data-api', f, g.prototype.toggle) .on('keydown.bs.dropdown.data-api', f, g.prototype.keydown) .on('keydown.bs.dropdown.data-api', '.dropdown-menu', g.prototype.keydown); })(vajQuery), +(function (a) { 'use strict'; function b(b, d) { return this.each(function () { var e = a(this), f = e.data('bs.modal'), g = a.extend({}, c.DEFAULTS, e.data(), 'object' == typeof b && b); f || e.data('bs.modal', (f = new c(this, g))), 'string' == typeof b ? f[b](d) : g.show && f.show(d); }); } var c = function (b, c) { (this.options = c), (this.$body = a(document.body)), (this.$element = a(b)), (this.$dialog = this.$element.find('.modal-dialog')), (this.$backdrop = null), (this.isShown = null), (this.originalBodyPad = null), (this.scrollbarWidth = 0), (this.ignoreBackdropClick = !1), this.options.remote && this.$element.find('.modal-content').load( this.options.remote, a.proxy(function () { this.$element.trigger('loaded.bs.modal'); }, this) ); }; (c.VERSION = '4.6.2'), (c.TRANSITION_DURATION = 300), (c.BACKDROP_TRANSITION_DURATION = 150), (c.DEFAULTS = {backdrop: !0, keyboard: !0, show: !0}), (c.prototype.toggle = function (a) { return this.isShown ? this.hide() : this.show(a); }), (c.prototype.show = function (b) { var d = this, e = a.Event('show.bs.modal', {relatedTarget: b}); this.$element.trigger(e), this.isShown || e.isDefaultPrevented() || ((this.isShown = !0), this.checkScrollbar(), this.setScrollbar(), this.$body.addClass('modal-open'), this.escape(), this.resize(), this.$element.on('click.dismiss.bs.modal', '[data-dismiss="modal"]', a.proxy(this.hide, this)), this.$dialog.on('mousedown.dismiss.bs.modal', function () { d.$element.one('mouseup.dismiss.bs.modal', function (b) { a(b.target).is(d.$element) && (d.ignoreBackdropClick = !0); }); }), this.backdrop(function () { var e = a.support.transition && d.$element.hasClass('fade'); d.$element.parent().length || d.$element.appendTo(d.$body), d.$element.show().scrollTop(0), d.adjustDialog(), e && d.$element[0].offsetWidth, d.$element.addClass('in'), d.enforceFocus(); var f = a.Event('shown.bs.modal', {relatedTarget: b}); e ? d.$dialog .one('bsTransitionEnd', function () { d.$element.trigger('focus').trigger(f); }) .emulateTransitionEnd(c.TRANSITION_DURATION) : d.$element.trigger('focus').trigger(f); })); }), (c.prototype.hide = function (b) { b && b.preventDefault(), (b = a.Event('hide.bs.modal')), this.$element.trigger(b), this.isShown && !b.isDefaultPrevented() && ((this.isShown = !1), this.escape(), this.resize(), a(document).off('focusin.bs.modal'), this.$element.removeClass('in').off('click.dismiss.bs.modal').off('mouseup.dismiss.bs.modal'), this.$dialog.off('mousedown.dismiss.bs.modal'), a.support.transition && this.$element.hasClass('fade') ? this.$element.one('bsTransitionEnd', a.proxy(this.hideModal, this)).emulateTransitionEnd(c.TRANSITION_DURATION) : this.hideModal()); }), (c.prototype.enforceFocus = function () { a(document) .off('focusin.bs.modal') .on( 'focusin.bs.modal', a.proxy(function (a) { this.$element[0] === a.target || this.$element.has(a.target).length || this.$element.trigger('focus'); }, this) ); }), (c.prototype.escape = function () { this.isShown && this.options.keyboard ? this.$element.on( 'keydown.dismiss.bs.modal', a.proxy(function (a) { 27 == a.which && this.hide(); }, this) ) : this.isShown || this.$element.off('keydown.dismiss.bs.modal'); }), (c.prototype.resize = function () { this.isShown ? a(window).on('resize.bs.modal', a.proxy(this.handleUpdate, this)) : a(window).off('resize.bs.modal'); }), (c.prototype.hideModal = function () { var a = this; this.$element.hide(), this.backdrop(function () { a.$body.removeClass('modal-open'), a.resetAdjustments(), a.resetScrollbar(), a.$element.trigger('hidden.bs.modal'); }); }), (c.prototype.removeBackdrop = function () { this.$backdrop && this.$backdrop.remove(), (this.$backdrop = null); }), (c.prototype.backdrop = function (b) { var d = this, e = this.$element.hasClass('fade') ? 'fade' : ''; var ibmchat = this.$body; var ibmModalBackdrop = ' '; if (this.$element.hasClass('chatbotModal')) { ibmchat = document.getElementById('ibm-va'); ibmModalBackdrop = 'chatbotModalBackdrop '; if (this.$element.hasClass('openForm')) { ibmModalBackdrop = 'openFormBackdrop '; ibmchat = document.getElementById('ibmchat'); } if (ibmchat === undefined || ibmchat === null) { ibmchat = this.$body; } } if (this.$element.hasClass('fade')) if (this.isShown && this.options.backdrop) { var f = a.support.transition && e; if ( ((this.$backdrop = a(document.createElement('div')) .addClass('modal-backdrop ' + ibmModalBackdrop + e) .appendTo(ibmchat)), this.$element.on( 'click.dismiss.bs.modal', a.proxy(function (a) { return this.ignoreBackdropClick ? void (this.ignoreBackdropClick = !1) : void (a.target === a.currentTarget && ('static' == this.options.backdrop ? this.$element[0].focus() : this.hide())); }, this) ), f && this.$backdrop[0].offsetWidth, this.$backdrop.addClass('in'), !b) ) return; f ? this.$backdrop.one('bsTransitionEnd', b).emulateTransitionEnd(c.BACKDROP_TRANSITION_DURATION) : b(); } else if (!this.isShown && this.$backdrop) { this.$backdrop.removeClass('in'); var g = function () { d.removeBackdrop(), b && b(); }; a.support.transition && this.$element.hasClass('fade') ? this.$backdrop.one('bsTransitionEnd', g).emulateTransitionEnd(c.BACKDROP_TRANSITION_DURATION) : g(); } else b && b(); }), (c.prototype.handleUpdate = function () { this.adjustDialog(); }), (c.prototype.adjustDialog = function () { var a = this.$element[0].scrollHeight > document.documentElement.clientHeight; this.$element.css({paddingLeft: !this.bodyIsOverflowing && a ? this.scrollbarWidth : '', paddingRight: this.bodyIsOverflowing && !a ? this.scrollbarWidth : ''}); }), (c.prototype.resetAdjustments = function () { this.$element.css({paddingLeft: '', paddingRight: ''}); }), (c.prototype.checkScrollbar = function () { var a = window.innerWidth; if (!a) { var b = document.documentElement.getBoundingClientRect(); a = b.right - Math.abs(b.left); } (this.bodyIsOverflowing = document.body.clientWidth < a), (this.scrollbarWidth = this.measureScrollbar()); }), (c.prototype.setScrollbar = function () { var a = parseInt(this.$body.css('padding-right') || 0, 10); (this.originalBodyPad = document.body.style.paddingRight || ''), this.bodyIsOverflowing && this.$body.css('padding-right', a + this.scrollbarWidth); }), (c.prototype.resetScrollbar = function () { this.$body.css('padding-right', this.originalBodyPad); }), (c.prototype.measureScrollbar = function () { var a = document.createElement('div'); (a.className = 'modal-scrollbar-measure'), this.$body.append(a); var b = a.offsetWidth - a.clientWidth; return this.$body[0].removeChild(a), b; }); var d = a.fn.modal; (a.fn.modal = b), (a.fn.modal.Constructor = c), (a.fn.modal.noConflict = function () { return (a.fn.modal = d), this; }), a(document).on('click.bs.modal.data-api', '[data-toggle="modal"]', function (c) { var d = a(this); if(d.attr('data-target') && d.attr('data-target').match(/.*(?=#[^\s]+$)/) === null){ return; }else{ var e = d.attr('href'), f = a(d.attr('data-target') || (e && e.replace(/.*(?=#[^\s]+$)/, ''))), g = f.data('bs.modal') ? 'toggle' : a.extend({remote: !/#/.test(e) && e}, f.data(), d.data()); d.is('a') && c.preventDefault(), f.one('show.bs.modal', function (a) { a.isDefaultPrevented() || f.one('hidden.bs.modal', function () { d.is(':visible') && d.trigger('focus'); }); }), b.call(f, g, this); } }); })(vajQuery), +(function (a) { 'use strict'; function b(b) { return this.each(function () { var d = a(this), e = d.data('bs.tooltip'), f = 'object' == typeof b && b; (e || !/destroy|hide/.test(b)) && (e || d.data('bs.tooltip', (e = new c(this, f))), 'string' == typeof b && e[b]()); }); } var c = function (a, b) { (this.type = null), (this.options = null), (this.enabled = null), (this.timeout = null), (this.hoverState = null), (this.$element = null), (this.inState = null), this.init('tooltip', a, b); }; (c.VERSION = '4.6.2'), (c.TRANSITION_DURATION = 150), (c.DEFAULTS = { animation: !0, placement: 'top', selector: !1, template: '', trigger: 'hover focus', title: '', delay: 0, html: !1, container: !1, viewport: {selector: 'body', padding: 0} }), (c.prototype.init = function (b, c, d) { if ( ((this.enabled = !0), (this.type = b), (this.$element = a(c)), (this.options = this.getOptions(d)), (this.$viewport = this.options.viewport && a(a.isFunction(this.options.viewport) ? this.options.viewport.call(this, this.$element) : this.options.viewport.selector || this.options.viewport)), (this.inState = {click: !1, hover: !1, focus: !1}), this.$element[0] instanceof document.constructor && !this.options.selector) ) throw new Error('`selector` option must be specified when initializing ' + this.type + ' on the window.document object!'); for (var e = this.options.trigger.split(' '), f = e.length; f--; ) { var g = e[f]; if ('click' == g) this.$element.on('click.' + this.type, this.options.selector, a.proxy(this.toggle, this)); else if ('manual' != g) { var h = 'hover' == g ? 'mouseenter' : 'focusin', i = 'hover' == g ? 'mouseleave' : 'focusout'; this.$element.on(h + '.' + this.type, this.options.selector, a.proxy(this.enter, this)), this.$element.on(i + '.' + this.type, this.options.selector, a.proxy(this.leave, this)); } } this.options.selector ? (this._options = a.extend({}, this.options, {trigger: 'manual', selector: ''})) : this.fixTitle(); }), (c.prototype.getDefaults = function () { return c.DEFAULTS; }), (c.prototype.getOptions = function (b) { return (b = a.extend({}, this.getDefaults(), this.$element.data(), b)), b.delay && 'number' == typeof b.delay && (b.delay = {show: b.delay, hide: b.delay}), b; }), (c.prototype.getDelegateOptions = function () { var b = {}, c = this.getDefaults(); return ( this._options && a.each(this._options, function (a, d) { c[a] != d && (b[a] = d); }), b ); }), (c.prototype.enter = function (b) { var c = b instanceof this.constructor ? b : a(b.currentTarget).data('bs.' + this.type); return ( c || ((c = new this.constructor(b.currentTarget, this.getDelegateOptions())), a(b.currentTarget).data('bs.' + this.type, c)), b instanceof a.Event && (c.inState['focusin' == b.type ? 'focus' : 'hover'] = !0), c.tip().hasClass('in') || 'in' == c.hoverState ? void (c.hoverState = 'in') : (clearTimeout(c.timeout), (c.hoverState = 'in'), c.options.delay && c.options.delay.show ? void (c.timeout = setTimeout(function () { 'in' == c.hoverState && c.show(); }, c.options.delay.show)) : c.show()) ); }), (c.prototype.isInStateTrue = function () { for (var a in this.inState) if (this.inState[a]) return !0; return !1; }), (c.prototype.leave = function (b) { var c = b instanceof this.constructor ? b : a(b.currentTarget).data('bs.' + this.type); return ( c || ((c = new this.constructor(b.currentTarget, this.getDelegateOptions())), a(b.currentTarget).data('bs.' + this.type, c)), b instanceof a.Event && (c.inState['focusout' == b.type ? 'focus' : 'hover'] = !1), c.isInStateTrue() ? void 0 : (clearTimeout(c.timeout), (c.hoverState = 'out'), c.options.delay && c.options.delay.hide ? void (c.timeout = setTimeout(function () { 'out' == c.hoverState && c.hide(); }, c.options.delay.hide)) : c.hide()) ); }), (c.prototype.show = function () { var b = a.Event('show.bs.' + this.type); if (this.hasContent() && this.enabled) { this.$element.trigger(b); var d = a.contains(this.$element[0].ownerDocument.documentElement, this.$element[0]); if (b.isDefaultPrevented() || !d) return; var e = this, f = this.tip(), g = this.getUID(this.type); this.setContent(), f.attr('id', g), this.$element.attr('aria-describedby', g), this.options.animation && f.addClass('fade'); var h = 'function' == typeof this.options.placement ? this.options.placement.call(this, f[0], this.$element[0]) : this.options.placement, i = /\s?auto?\s?/i, j = i.test(h); j && (h = h.replace(i, '') || 'top'), f .detach() .css({top: 0, left: 0, display: 'block'}) .addClass(h) .data('bs.' + this.type, this), this.options.container ? f.appendTo(this.options.container) : f.insertAfter(this.$element), this.$element.trigger('inserted.bs.' + this.type); var k = this.getPosition(), l = f[0].offsetWidth, m = f[0].offsetHeight; if (j) { var n = h, o = this.getPosition(this.$viewport); (h = 'bottom' == h && k.bottom + m > o.bottom ? 'top' : 'top' == h && k.top - m < o.top ? 'bottom' : 'right' == h && k.right + l > o.width ? 'left' : 'left' == h && k.left - l < o.left ? 'right' : h), f.removeClass(n).addClass(h); } var p = this.getCalculatedOffset(h, k, l, m); this.applyPlacement(p, h); var q = function () { var a = e.hoverState; e.$element.trigger('shown.bs.' + e.type), (e.hoverState = null), 'out' == a && e.leave(e); }; a.support.transition && this.$tip.hasClass('fade') ? f.one('bsTransitionEnd', q).emulateTransitionEnd(c.TRANSITION_DURATION) : q(); } }), (c.prototype.applyPlacement = function (b, c) { var d = this.tip(), e = d[0].offsetWidth, f = d[0].offsetHeight, g = parseInt(d.css('margin-top'), 10), h = parseInt(d.css('margin-left'), 10); isNaN(g) && (g = 0), isNaN(h) && (h = 0), (b.top += g), (b.left += h), a.offset.setOffset( d[0], a.extend( { using: function (a) { d.css({top: Math.round(a.top), left: Math.round(a.left)}); } }, b ), 0 ), d.addClass('in'); var i = d[0].offsetWidth, j = d[0].offsetHeight; 'top' == c && j != f && (b.top = b.top + f - j); var k = this.getViewportAdjustedDelta(c, b, i, j); k.left ? (b.left += k.left) : (b.top += k.top); var l = /top|bottom/.test(c), m = l ? 2 * k.left - e + i : 2 * k.top - f + j, n = l ? 'offsetWidth' : 'offsetHeight'; d.offset(b), this.replaceArrow(m, d[0][n], l); }), (c.prototype.replaceArrow = function (a, b, c) { this.arrow() .css(c ? 'left' : 'top', 50 * (1 - a / b) + '%') .css(c ? 'top' : 'left', ''); }), (c.prototype.setContent = function () { var a = this.tip(), b = this.getTitle(); a.find('.tooltip-inner')[this.options.html ? 'html' : 'text'](b), a.removeClass('fade in top bottom left right'); }), (c.prototype.hide = function (b) { function d() { 'in' != e.hoverState && f.detach(), e.$element.removeAttr('aria-describedby').trigger('hidden.bs.' + e.type), b && b(); } var e = this, f = a(this.$tip), g = a.Event('hide.bs.' + this.type); return ( this.$element.trigger(g), g.isDefaultPrevented() ? void 0 : (f.removeClass('in'), a.support.transition && f.hasClass('fade') ? f.one('bsTransitionEnd', d).emulateTransitionEnd(c.TRANSITION_DURATION) : d(), (this.hoverState = null), this) ); }), (c.prototype.fixTitle = function () { var a = this.$element; (a.attr('title') || 'string' != typeof a.attr('data-original-title')) && a.attr('data-original-title', a.attr('title') || '').attr('title', ''); }), (c.prototype.hasContent = function () { return this.getTitle(); }), (c.prototype.getPosition = function (b) { b = b || this.$element; var c = b[0], d = 'BODY' == c.tagName, e = c.getBoundingClientRect(); null == e.width && (e = a.extend({}, e, {width: e.right - e.left, height: e.bottom - e.top})); var f = d ? {top: 0, left: 0} : b.offset(), g = {scroll: d ? document.documentElement.scrollTop || document.body.scrollTop : b.scrollTop()}, h = d ? {width: a(window).width(), height: a(window).height()} : null; return a.extend({}, e, g, h, f); }), (c.prototype.getCalculatedOffset = function (a, b, c, d) { return 'bottom' == a ? {top: b.top + b.height, left: b.left + b.width / 2 - c / 2} : 'top' == a ? {top: b.top - d, left: b.left + b.width / 2 - c / 2} : 'left' == a ? {top: b.top + b.height / 2 - d / 2, left: b.left - c} : {top: b.top + b.height / 2 - d / 2, left: b.left + b.width}; }), (c.prototype.getViewportAdjustedDelta = function (a, b, c, d) { var e = {top: 0, left: 0}; if (!this.$viewport) return e; var f = (this.options.viewport && this.options.viewport.padding) || 0, g = this.getPosition(this.$viewport); if (/right|left/.test(a)) { var h = b.top - f - g.scroll, i = b.top + f - g.scroll + d; h < g.top ? (e.top = g.top - h) : i > g.top + g.height && (e.top = g.top + g.height - i); } else { var j = b.left - f, k = b.left + f + c; j < g.left ? (e.left = g.left - j) : k > g.right && (e.left = g.left + g.width - k); } return e; }), (c.prototype.getTitle = function () { var a, b = this.$element, c = this.options; return (a = b.attr('data-original-title') || ('function' == typeof c.title ? c.title.call(b[0]) : c.title)); }), (c.prototype.getUID = function (a) { do a += ~~(1e6 * Math.random()); while (document.getElementById(a)); return a; }), (c.prototype.tip = function () { if (!this.$tip && ((this.$tip = a(this.options.template)), 1 != this.$tip.length)) throw new Error(this.type + ' `template` option must consist of exactly 1 top-level element!'); return this.$tip; }), (c.prototype.arrow = function () { return (this.$arrow = this.$arrow || this.tip().find('.tooltip-arrow')); }), (c.prototype.enable = function () { this.enabled = !0; }), (c.prototype.disable = function () { this.enabled = !1; }), (c.prototype.toggleEnabled = function () { this.enabled = !this.enabled; }), (c.prototype.toggle = function (b) { var c = this; b && ((c = a(b.currentTarget).data('bs.' + this.type)), c || ((c = new this.constructor(b.currentTarget, this.getDelegateOptions())), a(b.currentTarget).data('bs.' + this.type, c))), b ? ((c.inState.click = !c.inState.click), c.isInStateTrue() ? c.enter(c) : c.leave(c)) : c.tip().hasClass('in') ? c.leave(c) : c.enter(c); }), (c.prototype.destroy = function () { var a = this; clearTimeout(this.timeout), this.hide(function () { a.$element.off('.' + a.type).removeData('bs.' + a.type), a.$tip && a.$tip.detach(), (a.$tip = null), (a.$arrow = null), (a.$viewport = null); }); }); var d = a.fn.tooltip; (a.fn.tooltip = b), (a.fn.tooltip.Constructor = c), (a.fn.tooltip.noConflict = function () { return (a.fn.tooltip = d), this; }); })(vajQuery), +(function (a) { 'use strict'; function b(b) { return this.each(function () { var d = a(this), e = d.data('bs.popover'), f = 'object' == typeof b && b; (e || !/destroy|hide/.test(b)) && (e || d.data('bs.popover', (e = new c(this, f))), 'string' == typeof b && e[b]()); }); } var c = function (a, b) { this.init('popover', a, b); }; if (!a.fn.tooltip) throw new Error('Popover requires tooltip.js'); (c.VERSION = '4.6.2'), (c.DEFAULTS = a.extend({}, a.fn.tooltip.Constructor.DEFAULTS, { placement: 'right', trigger: 'click', content: '', template: '' })), (c.prototype = a.extend({}, a.fn.tooltip.Constructor.prototype)), (c.prototype.constructor = c), (c.prototype.getDefaults = function () { return c.DEFAULTS; }), (c.prototype.setContent = function () { var a = this.tip(), b = this.getTitle(), c = this.getContent(); a.find('.popover-title')[this.options.html ? 'html' : 'text'](b), a.find('.popover-content').children().detach().end()[this.options.html ? ('string' == typeof c ? 'html' : 'append') : 'text'](c), a.removeClass('fade top bottom left right in'), a.find('.popover-title').html() || a.find('.popover-title').hide(); }), (c.prototype.hasContent = function () { return this.getTitle() || this.getContent(); }), (c.prototype.getContent = function () { var a = this.$element, b = this.options; return a.attr('data-content') || ('function' == typeof b.content ? b.content.call(a[0]) : b.content); }), (c.prototype.arrow = function () { return (this.$arrow = this.$arrow || this.tip().find('.arrow')); }); var d = a.fn.popover; (a.fn.popover = b), (a.fn.popover.Constructor = c), (a.fn.popover.noConflict = function () { return (a.fn.popover = d), this; }); })(vajQuery), +(function (a) { 'use strict'; function b(c, d) { (this.$body = a(document.body)), (this.$scrollElement = a(a(c).is(document.body) ? window : c)), (this.options = a.extend({}, b.DEFAULTS, d)), (this.selector = (this.options.target || '') + ' .nav li > a'), (this.offsets = []), (this.targets = []), (this.activeTarget = null), (this.scrollHeight = 0), this.$scrollElement.on('scroll.bs.scrollspy', a.proxy(this.process, this)), this.refresh(), this.process(); } function c(c) { return this.each(function () { var d = a(this), e = d.data('bs.scrollspy'), f = 'object' == typeof c && c; e || d.data('bs.scrollspy', (e = new b(this, f))), 'string' == typeof c && e[c](); }); } (b.VERSION = '4.6.2'), (b.DEFAULTS = {offset: 10}), (b.prototype.getScrollHeight = function () { return this.$scrollElement[0].scrollHeight || Math.max(this.$body[0].scrollHeight, document.documentElement.scrollHeight); }), (b.prototype.refresh = function () { var b = this, c = 'offset', d = 0; (this.offsets = []), (this.targets = []), (this.scrollHeight = this.getScrollHeight()), a.isWindow(this.$scrollElement[0]) || ((c = 'position'), (d = this.$scrollElement.scrollTop())), this.$body .find(this.selector) .map(function () { var b = a(this), e = b.data('target') || b.attr('href'), f = /^#./.test(e) && a(e); return (f && f.length && f.is(':visible') && [[f[c]().top + d, e]]) || null; }) .sort(function (a, b) { return a[0] - b[0]; }) .each(function () { b.offsets.push(this[0]), b.targets.push(this[1]); }); }), (b.prototype.process = function () { var a, b = this.$scrollElement.scrollTop() + this.options.offset, c = this.getScrollHeight(), d = this.options.offset + c - this.$scrollElement.height(), e = this.offsets, f = this.targets, g = this.activeTarget; if ((this.scrollHeight != c && this.refresh(), b >= d)) return g != (a = f[f.length - 1]) && this.activate(a); if (g && b < e[0]) return (this.activeTarget = null), this.clear(); for (a = e.length; a--; ) g != f[a] && b >= e[a] && (void 0 === e[a + 1] || b < e[a + 1]) && this.activate(f[a]); }), (b.prototype.activate = function (b) { (this.activeTarget = b), this.clear(); var c = this.selector + '[data-target="' + b + '"],' + this.selector + '[href="' + b + '"]', d = a(c).parents('li').addClass('active'); d.parent('.dropdown-menu').length && (d = d.closest('li.dropdown').addClass('active')), d.trigger('activate.bs.scrollspy'); }), (b.prototype.clear = function () { a(this.selector).parentsUntil(this.options.target, '.active').removeClass('active'); }); var d = a.fn.scrollspy; (a.fn.scrollspy = c), (a.fn.scrollspy.Constructor = b), (a.fn.scrollspy.noConflict = function () { return (a.fn.scrollspy = d), this; }), a(window).on('load.bs.scrollspy.data-api', function () { a('[data-spy="scroll"]').each(function () { var b = a(this); c.call(b, b.data()); }); }); })(vajQuery), +(function (a) { 'use strict'; function b(b) { return this.each(function () { var d = a(this), e = d.data('bs.tab'); if(d.attr('data-target') && d.attr('data-target').match(/.*(?=#[^\s]+$)/) === null){ return; }else{ e || d.data('bs.tab', (e = new c(this))), 'string' == typeof b && e[b](); } }); } var c = function (b) { this.element = a(b); }; (c.VERSION = '4.6.2'), (c.TRANSITION_DURATION = 150), (c.prototype.show = function () { var b = this.element, c = b.closest('ul:not(.dropdown-menu)'), d = b.data('target'); if ((d || ((d = b.attr('href')), (d = d && d.replace(/.*(?=#[^\s]*$)/, ''))), !b.parent('li').hasClass('active'))) { var e = c.find('.active:last a'), f = a.Event('hide.bs.tab', {relatedTarget: b[0]}), g = a.Event('show.bs.tab', {relatedTarget: e[0]}); if ((e.trigger(f), b.trigger(g), !g.isDefaultPrevented() && !f.isDefaultPrevented())) { var h = a(d); this.activate(b.closest('li'), c), this.activate(h, h.parent(), function () { e.trigger({type: 'hidden.bs.tab', relatedTarget: b[0]}), b.trigger({type: 'shown.bs.tab', relatedTarget: e[0]}); }); } } }), (c.prototype.activate = function (b, d, e) { function f() { g.removeClass('active').find('> .dropdown-menu > .active').removeClass('active').end().find('[data-toggle="tab"]').attr('aria-expanded', !1), b.addClass('active').find('[data-toggle="tab"]').attr('aria-expanded', !0), h ? (b[0].offsetWidth, b.addClass('in')) : b.removeClass('fade'), b.parent('.dropdown-menu').length && b.closest('li.dropdown').addClass('active').end().find('[data-toggle="tab"]').attr('aria-expanded', !0), e && e(); } var g = d.find('> .active'), h = e && a.support.transition && ((g.length && g.hasClass('fade')) || !!d.find('> .fade').length); g.length && h ? g.one('bsTransitionEnd', f).emulateTransitionEnd(c.TRANSITION_DURATION) : f(), g.removeClass('in'); }); var d = a.fn.tab; (a.fn.tab = b), (a.fn.tab.Constructor = c), (a.fn.tab.noConflict = function () { return (a.fn.tab = d), this; }); var e = function (c) { c.preventDefault(), b.call(a(this), 'show'); }; a(document).on('click.bs.tab.data-api', '[data-toggle="tab"]', e).on('click.bs.tab.data-api', '[data-toggle="pill"]', e); })(vajQuery), +(function (a) { 'use strict'; function b(b) { return this.each(function () { var d = a(this), e = d.data('bs.affix'), f = 'object' == typeof b && b; e || d.data('bs.affix', (e = new c(this, f))), 'string' == typeof b && e[b](); }); } var c = function (b, d) { (this.options = a.extend({}, c.DEFAULTS, d)), (this.$target = a(this.options.target).on('scroll.bs.affix.data-api', a.proxy(this.checkPosition, this)).on('click.bs.affix.data-api', a.proxy(this.checkPositionWithEventLoop, this))), (this.$element = a(b)), (this.affixed = null), (this.unpin = null), (this.pinnedOffset = null), this.checkPosition(); }; (c.VERSION = '4.6.2'), (c.RESET = 'affix affix-top affix-bottom'), (c.DEFAULTS = {offset: 0, target: window}), (c.prototype.getState = function (a, b, c, d) { var e = this.$target.scrollTop(), f = this.$element.offset(), g = this.$target.height(); if (null != c && 'top' == this.affixed) return c > e ? 'top' : !1; if ('bottom' == this.affixed) return null != c ? (e + this.unpin <= f.top ? !1 : 'bottom') : a - d >= e + g ? !1 : 'bottom'; var h = null == this.affixed, i = h ? e : f.top, j = h ? g : b; return null != c && c >= e ? 'top' : null != d && i + j >= a - d ? 'bottom' : !1; }), (c.prototype.getPinnedOffset = function () { if (this.pinnedOffset) return this.pinnedOffset; this.$element.removeClass(c.RESET).addClass('affix'); var a = this.$target.scrollTop(), b = this.$element.offset(); return (this.pinnedOffset = b.top - a); }), (c.prototype.checkPositionWithEventLoop = function () { setTimeout(a.proxy(this.checkPosition, this), 1); }), (c.prototype.checkPosition = function () { if (this.$element.is(':visible')) { var b = this.$element.height(), d = this.options.offset, e = d.top, f = d.bottom, g = Math.max(a(document).height(), a(document.body).height()); 'object' != typeof d && (f = e = d), 'function' == typeof e && (e = d.top(this.$element)), 'function' == typeof f && (f = d.bottom(this.$element)); var h = this.getState(g, b, e, f); if (this.affixed != h) { null != this.unpin && this.$element.css('top', ''); var i = 'affix' + (h ? '-' + h : ''), j = a.Event(i + '.bs.affix'); if ((this.$element.trigger(j), j.isDefaultPrevented())) return; (this.affixed = h), (this.unpin = 'bottom' == h ? this.getPinnedOffset() : null), this.$element .removeClass(c.RESET) .addClass(i) .trigger(i.replace('affix', 'affixed') + '.bs.affix'); } 'bottom' == h && this.$element.offset({top: g - b - f}); } }); var d = a.fn.affix; (a.fn.affix = b), (a.fn.affix.Constructor = c), (a.fn.affix.noConflict = function () { return (a.fn.affix = d), this; }), a(window).on('load', function () { a('[data-spy="affix"]').each(function () { var c = a(this), d = c.data(); (d.offset = d.offset || {}), null != d.offsetBottom && (d.offset.bottom = d.offsetBottom), null != d.offsetTop && (d.offset.top = d.offsetTop), b.call(c, d); }); }); })(vajQuery); /*! For license information please see jsencrypt.min.js.LICENSE.txt */ !function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.JSEncrypt=e():t.JSEncrypt=e()}(window,(()=>(()=>{var t={155:t=>{var e,i,r=t.exports={};function n(){throw new Error("setTimeout has not been defined")}function s(){throw new Error("clearTimeout has not been defined")}function o(t){if(e===setTimeout)return setTimeout(t,0);if((e===n||!e)&&setTimeout)return e=setTimeout,setTimeout(t,0);try{return e(t,0)}catch(i){try{return e.call(null,t,0)}catch(i){return e.call(this,t,0)}}}!function(){try{e="function"==typeof setTimeout?setTimeout:n}catch(t){e=n}try{i="function"==typeof clearTimeout?clearTimeout:s}catch(t){i=s}}();var h,a=[],u=!1,c=-1;function f(){u&&h&&(u=!1,h.length?a=h.concat(a):c=-1,a.length&&l())}function l(){if(!u){var t=o(f);u=!0;for(var e=a.length;e;){for(h=a,a=[];++c1)for(var i=1;i{for(var r in e)i.o(e,r)&&!i.o(t,r)&&Object.defineProperty(t,r,{enumerable:!0,get:e[r]})},i.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e);var r={};return(()=>{"use strict";i.d(r,{default:()=>ct});var t="0123456789abcdefghijklmnopqrstuvwxyz";function e(e){return t.charAt(e)}function n(t,e){return t&e}function s(t,e){return t|e}function o(t,e){return t^e}function h(t,e){return t&~e}function a(t){if(0==t)return-1;var e=0;return 0==(65535&t)&&(t>>=16,e+=16),0==(255&t)&&(t>>=8,e+=8),0==(15&t)&&(t>>=4,e+=4),0==(3&t)&&(t>>=2,e+=2),0==(1&t)&&++e,e}function u(t){for(var e=0;0!=t;)t&=t-1,++e;return e}var c,f="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",l="=";function p(t){var e,i,r="";for(e=0;e+3<=t.length;e+=3)i=parseInt(t.substring(e,e+3),16),r+=f.charAt(i>>6)+f.charAt(63&i);for(e+1==t.length?(i=parseInt(t.substring(e,e+1),16),r+=f.charAt(i<<2)):e+2==t.length&&(i=parseInt(t.substring(e,e+2),16),r+=f.charAt(i>>2)+f.charAt((3&i)<<4));(3&r.length)>0;)r+=l;return r}function g(t){var i,r="",n=0,s=0;for(i=0;i>2),s=3&o,n=1):1==n?(r+=e(s<<2|o>>4),s=15&o,n=2):2==n?(r+=e(s),r+=e(o>>2),s=3&o,n=3):(r+=e(s<<2|o>>4),r+=e(15&o),n=0))}return 1==n&&(r+=e(s<<2)),r}var d,v={decode:function(t){var e;if(void 0===d){var i="= \f\n\r\t \u2028\u2029";for(d=Object.create(null),e=0;e<64;++e)d["ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".charAt(e)]=e;for(d["-"]=62,d._=63,e=0;e=4?(r[r.length]=n>>16,r[r.length]=n>>8&255,r[r.length]=255&n,n=0,s=0):n<<=6}}switch(s){case 1:throw new Error("Base64 encoding incomplete: at least 2 bits missing");case 2:r[r.length]=n>>10;break;case 3:r[r.length]=n>>16,r[r.length]=n>>8&255}return r},re:/-----BEGIN [^-]+-----([A-Za-z0-9+\/=\s]+)-----END [^-]+-----|begin-base64[^\n]+\n([A-Za-z0-9+\/=\s]+)====/,unarmor:function(t){var e=v.re.exec(t);if(e)if(e[1])t=e[1];else{if(!e[2])throw new Error("RegExp out of sync");t=e[2]}return v.decode(t)}},m=1e13,y=function(){function t(t){this.buf=[+t||0]}return t.prototype.mulAdd=function(t,e){var i,r,n=this.buf,s=n.length;for(i=0;i0&&(n[i]=e)},t.prototype.sub=function(t){var e,i,r=this.buf,n=r.length;for(e=0;e=0;--r)i+=(m+e[r]).toString().substring(1);return i},t.prototype.valueOf=function(){for(var t=this.buf,e=0,i=t.length-1;i>=0;--i)e=e*m+t[i];return e},t.prototype.simplify=function(){var t=this.buf;return 1==t.length?t[0]:this},t}(),b="…",T=/^(\d\d)(0[1-9]|1[0-2])(0[1-9]|[12]\d|3[01])([01]\d|2[0-3])(?:([0-5]\d)(?:([0-5]\d)(?:[.,](\d{1,3}))?)?)?(Z|[-+](?:[0]\d|1[0-2])([0-5]\d)?)?$/,S=/^(\d\d\d\d)(0[1-9]|1[0-2])(0[1-9]|[12]\d|3[01])([01]\d|2[0-3])(?:([0-5]\d)(?:([0-5]\d)(?:[.,](\d{1,3}))?)?)?(Z|[-+](?:[0]\d|1[0-2])([0-5]\d)?)?$/;function E(t,e){return t.length>e&&(t=t.substring(0,e)+b),t}var w,D=function(){function t(e,i){this.hexDigits="0123456789ABCDEF",e instanceof t?(this.enc=e.enc,this.pos=e.pos):(this.enc=e,this.pos=i)}return t.prototype.get=function(t){if(void 0===t&&(t=this.pos++),t>=this.enc.length)throw new Error("Requesting byte offset ".concat(t," on a stream of length ").concat(this.enc.length));return"string"==typeof this.enc?this.enc.charCodeAt(t):this.enc[t]},t.prototype.hexByte=function(t){return this.hexDigits.charAt(t>>4&15)+this.hexDigits.charAt(15&t)},t.prototype.hexDump=function(t,e,i){for(var r="",n=t;n176)return!1}return!0},t.prototype.parseStringISO=function(t,e){for(var i="",r=t;r191&&n<224?String.fromCharCode((31&n)<<6|63&this.get(r++)):String.fromCharCode((15&n)<<12|(63&this.get(r++))<<6|63&this.get(r++))}return i},t.prototype.parseStringBMP=function(t,e){for(var i,r,n="",s=t;s127,s=n?255:0,o="";r==s&&++t4){for(o=r,i<<=3;0==(128&(+o^s));)o=+o<<1,--i;o="("+i+" bit)\n"}n&&(r-=256);for(var h=new y(r),a=t+1;a=a;--u)s+=h>>u&1?"1":"0";if(s.length>i)return n+E(s,i)}return n+s},t.prototype.parseOctetString=function(t,e,i){if(this.isASCII(t,e))return E(this.parseStringISO(t,e),i);var r=e-t,n="("+r+" byte)\n";r>(i/=2)&&(e=t+i);for(var s=t;si&&(n+=b),n},t.prototype.parseOID=function(t,e,i){for(var r="",n=new y,s=0,o=t;oi)return E(r,i);n=new y,s=0}}return s>0&&(r+=".incomplete"),r},t}(),x=function(){function t(t,e,i,r,n){if(!(r instanceof R))throw new Error("Invalid tag value.");this.stream=t,this.header=e,this.length=i,this.tag=r,this.sub=n}return t.prototype.typeName=function(){switch(this.tag.tagClass){case 0:switch(this.tag.tagNumber){case 0:return"EOC";case 1:return"BOOLEAN";case 2:return"INTEGER";case 3:return"BIT_STRING";case 4:return"OCTET_STRING";case 5:return"NULL";case 6:return"OBJECT_IDENTIFIER";case 7:return"ObjectDescriptor";case 8:return"EXTERNAL";case 9:return"REAL";case 10:return"ENUMERATED";case 11:return"EMBEDDED_PDV";case 12:return"UTF8String";case 16:return"SEQUENCE";case 17:return"SET";case 18:return"NumericString";case 19:return"PrintableString";case 20:return"TeletexString";case 21:return"VideotexString";case 22:return"IA5String";case 23:return"UTCTime";case 24:return"GeneralizedTime";case 25:return"GraphicString";case 26:return"VisibleString";case 27:return"GeneralString";case 28:return"UniversalString";case 30:return"BMPString"}return"Universal_"+this.tag.tagNumber.toString();case 1:return"Application_"+this.tag.tagNumber.toString();case 2:return"["+this.tag.tagNumber.toString()+"]";case 3:return"Private_"+this.tag.tagNumber.toString()}},t.prototype.content=function(t){if(void 0===this.tag)return null;void 0===t&&(t=1/0);var e=this.posContent(),i=Math.abs(this.length);if(!this.tag.isUniversal())return null!==this.sub?"("+this.sub.length+" elem)":this.stream.parseOctetString(e,e+i,t);switch(this.tag.tagNumber){case 1:return 0===this.stream.get(e)?"false":"true";case 2:return this.stream.parseInteger(e,e+i);case 3:return this.sub?"("+this.sub.length+" elem)":this.stream.parseBitString(e,e+i,t);case 4:return this.sub?"("+this.sub.length+" elem)":this.stream.parseOctetString(e,e+i,t);case 6:return this.stream.parseOID(e,e+i,t);case 16:case 17:return null!==this.sub?"("+this.sub.length+" elem)":"(no elem)";case 12:return E(this.stream.parseStringUTF(e,e+i),t);case 18:case 19:case 20:case 21:case 22:case 26:return E(this.stream.parseStringISO(e,e+i),t);case 30:return E(this.stream.parseStringBMP(e,e+i),t);case 23:case 24:return this.stream.parseTime(e,e+i,23==this.tag.tagNumber)}return null},t.prototype.toString=function(){return this.typeName()+"@"+this.stream.pos+"[header:"+this.header+",length:"+this.length+",sub:"+(null===this.sub?"null":this.sub.length)+"]"},t.prototype.toPrettyString=function(t){void 0===t&&(t="");var e=t+this.typeName()+" @"+this.stream.pos;if(this.length>=0&&(e+="+"),e+=this.length,this.tag.tagConstructed?e+=" (constructed)":!this.tag.isUniversal()||3!=this.tag.tagNumber&&4!=this.tag.tagNumber||null===this.sub||(e+=" (encapsulates)"),e+="\n",null!==this.sub){t+=" ";for(var i=0,r=this.sub.length;i6)throw new Error("Length over 48 bits not supported at position "+(t.pos-1));if(0===i)return null;e=0;for(var r=0;r>6,this.tagConstructed=0!=(32&e),this.tagNumber=31&e,31==this.tagNumber){var i=new y;do{e=t.get(),i.mulAdd(128,127&e)}while(128&e);this.tagNumber=i.simplify()}}return t.prototype.isUniversal=function(){return 0===this.tagClass},t.prototype.isEOC=function(){return 0===this.tagClass&&0===this.tagNumber},t}(),B=[2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53,59,61,67,71,73,79,83,89,97,101,103,107,109,113,127,131,137,139,149,151,157,163,167,173,179,181,191,193,197,199,211,223,227,229,233,239,241,251,257,263,269,271,277,281,283,293,307,311,313,317,331,337,347,349,353,359,367,373,379,383,389,397,401,409,419,421,431,433,439,443,449,457,461,463,467,479,487,491,499,503,509,521,523,541,547,557,563,569,571,577,587,593,599,601,607,613,617,619,631,641,643,647,653,659,661,673,677,683,691,701,709,719,727,733,739,743,751,757,761,769,773,787,797,809,811,821,823,827,829,839,853,857,859,863,877,881,883,887,907,911,919,929,937,941,947,953,967,971,977,983,991,997],O=(1<<26)/B[B.length-1],A=function(){function t(t,e,i){null!=t&&("number"==typeof t?this.fromNumber(t,e,i):null==e&&"string"!=typeof t?this.fromString(t,256):this.fromString(t,e))}return t.prototype.toString=function(t){if(this.s<0)return"-"+this.negate().toString(t);var i;if(16==t)i=4;else if(8==t)i=3;else if(2==t)i=1;else if(32==t)i=5;else{if(4!=t)return this.toRadix(t);i=2}var r,n=(1<0)for(a>a)>0&&(s=!0,o=e(r));h>=0;)a>(a+=this.DB-i)):(r=this[h]>>(a-=i)&n,a<=0&&(a+=this.DB,--h)),r>0&&(s=!0),s&&(o+=e(r));return s?o:"0"},t.prototype.negate=function(){var e=M();return t.ZERO.subTo(this,e),e},t.prototype.abs=function(){return this.s<0?this.negate():this},t.prototype.compareTo=function(t){var e=this.s-t.s;if(0!=e)return e;var i=this.t;if(0!=(e=i-t.t))return this.s<0?-e:e;for(;--i>=0;)if(0!=(e=this[i]-t[i]))return e;return 0},t.prototype.bitLength=function(){return this.t<=0?0:this.DB*(this.t-1)+K(this[this.t-1]^this.s&this.DM)},t.prototype.mod=function(e){var i=M();return this.abs().divRemTo(e,null,i),this.s<0&&i.compareTo(t.ZERO)>0&&e.subTo(i,i),i},t.prototype.modPowInt=function(t,e){var i;return i=t<256||e.isEven()?new I(e):new N(e),this.exp(t,i)},t.prototype.clone=function(){var t=M();return this.copyTo(t),t},t.prototype.intValue=function(){if(this.s<0){if(1==this.t)return this[0]-this.DV;if(0==this.t)return-1}else{if(1==this.t)return this[0];if(0==this.t)return 0}return(this[1]&(1<<32-this.DB)-1)<>24},t.prototype.shortValue=function(){return 0==this.t?this.s:this[0]<<16>>16},t.prototype.signum=function(){return this.s<0?-1:this.t<=0||1==this.t&&this[0]<=0?0:1},t.prototype.toByteArray=function(){var t=this.t,e=[];e[0]=this.s;var i,r=this.DB-t*this.DB%8,n=0;if(t-- >0)for(r>r)!=(this.s&this.DM)>>r&&(e[n++]=i|this.s<=0;)r<8?(i=(this[t]&(1<>(r+=this.DB-8)):(i=this[t]>>(r-=8)&255,r<=0&&(r+=this.DB,--t)),0!=(128&i)&&(i|=-256),0==n&&(128&this.s)!=(128&i)&&++n,(n>0||i!=this.s)&&(e[n++]=i);return e},t.prototype.equals=function(t){return 0==this.compareTo(t)},t.prototype.min=function(t){return this.compareTo(t)<0?this:t},t.prototype.max=function(t){return this.compareTo(t)>0?this:t},t.prototype.and=function(t){var e=M();return this.bitwiseTo(t,n,e),e},t.prototype.or=function(t){var e=M();return this.bitwiseTo(t,s,e),e},t.prototype.xor=function(t){var e=M();return this.bitwiseTo(t,o,e),e},t.prototype.andNot=function(t){var e=M();return this.bitwiseTo(t,h,e),e},t.prototype.not=function(){for(var t=M(),e=0;e=this.t?0!=this.s:0!=(this[e]&1<1){var c=M();for(r.sqrTo(o[1],c);h<=u;)o[h]=M(),r.mulTo(c,o[h-2],o[h]),h+=2}var f,l,p=t.t-1,g=!0,d=M();for(n=K(t[p])-1;p>=0;){for(n>=a?f=t[p]>>n-a&u:(f=(t[p]&(1<0&&(f|=t[p-1]>>this.DB+n-a)),h=i;0==(1&f);)f>>=1,--h;if((n-=h)<0&&(n+=this.DB,--p),g)o[f].copyTo(s),g=!1;else{for(;h>1;)r.sqrTo(s,d),r.sqrTo(d,s),h-=2;h>0?r.sqrTo(s,d):(l=s,s=d,d=l),r.mulTo(d,o[f],s)}for(;p>=0&&0==(t[p]&1<=0?(r.subTo(n,r),i&&s.subTo(h,s),o.subTo(a,o)):(n.subTo(r,n),i&&h.subTo(s,h),a.subTo(o,a))}return 0!=n.compareTo(t.ONE)?t.ZERO:a.compareTo(e)>=0?a.subtract(e):a.signum()<0?(a.addTo(e,a),a.signum()<0?a.add(e):a):a},t.prototype.pow=function(t){return this.exp(t,new V)},t.prototype.gcd=function(t){var e=this.s<0?this.negate():this.clone(),i=t.s<0?t.negate():t.clone();if(e.compareTo(i)<0){var r=e;e=i,i=r}var n=e.getLowestSetBit(),s=i.getLowestSetBit();if(s<0)return e;for(n0&&(e.rShiftTo(s,e),i.rShiftTo(s,i));e.signum()>0;)(n=e.getLowestSetBit())>0&&e.rShiftTo(n,e),(n=i.getLowestSetBit())>0&&i.rShiftTo(n,i),e.compareTo(i)>=0?(e.subTo(i,e),e.rShiftTo(1,e)):(i.subTo(e,i),i.rShiftTo(1,i));return s>0&&i.lShiftTo(s,i),i},t.prototype.isProbablePrime=function(t){var e,i=this.abs();if(1==i.t&&i[0]<=B[B.length-1]){for(e=0;e=0;--e)t[e]=this[e];t.t=this.t,t.s=this.s},t.prototype.fromInt=function(t){this.t=1,this.s=t<0?-1:0,t>0?this[0]=t:t<-1?this[0]=t+this.DV:this.t=0},t.prototype.fromString=function(e,i){var r;if(16==i)r=4;else if(8==i)r=3;else if(256==i)r=8;else if(2==i)r=1;else if(32==i)r=5;else{if(4!=i)return void this.fromRadix(e,i);r=2}this.t=0,this.s=0;for(var n=e.length,s=!1,o=0;--n>=0;){var h=8==r?255&+e[n]:F(e,n);h<0?"-"==e.charAt(n)&&(s=!0):(s=!1,0==o?this[this.t++]=h:o+r>this.DB?(this[this.t-1]|=(h&(1<>this.DB-o):this[this.t-1]|=h<=this.DB&&(o-=this.DB))}8==r&&0!=(128&+e[0])&&(this.s=-1,o>0&&(this[this.t-1]|=(1<0&&this[this.t-1]==t;)--this.t},t.prototype.dlShiftTo=function(t,e){var i;for(i=this.t-1;i>=0;--i)e[i+t]=this[i];for(i=t-1;i>=0;--i)e[i]=0;e.t=this.t+t,e.s=this.s},t.prototype.drShiftTo=function(t,e){for(var i=t;i=0;--h)e[h+s+1]=this[h]>>r|o,o=(this[h]&n)<=0;--h)e[h]=0;e[s]=o,e.t=this.t+s+1,e.s=this.s,e.clamp()},t.prototype.rShiftTo=function(t,e){e.s=this.s;var i=Math.floor(t/this.DB);if(i>=this.t)e.t=0;else{var r=t%this.DB,n=this.DB-r,s=(1<>r;for(var o=i+1;o>r;r>0&&(e[this.t-i-1]|=(this.s&s)<>=this.DB;if(t.t>=this.DB;r+=this.s}else{for(r+=this.s;i>=this.DB;r-=t.s}e.s=r<0?-1:0,r<-1?e[i++]=this.DV+r:r>0&&(e[i++]=r),e.t=i,e.clamp()},t.prototype.multiplyTo=function(e,i){var r=this.abs(),n=e.abs(),s=r.t;for(i.t=s+n.t;--s>=0;)i[s]=0;for(s=0;s=0;)t[i]=0;for(i=0;i=e.DV&&(t[i+e.t]-=e.DV,t[i+e.t+1]=1)}t.t>0&&(t[t.t-1]+=e.am(i,e[i],t,2*i,0,1)),t.s=0,t.clamp()},t.prototype.divRemTo=function(e,i,r){var n=e.abs();if(!(n.t<=0)){var s=this.abs();if(s.t0?(n.lShiftTo(u,o),s.lShiftTo(u,r)):(n.copyTo(o),s.copyTo(r));var c=o.t,f=o[c-1];if(0!=f){var l=f*(1<1?o[c-2]>>this.F2:0),p=this.FV/l,g=(1<=0&&(r[r.t++]=1,r.subTo(y,r)),t.ONE.dlShiftTo(c,y),y.subTo(o,o);o.t=0;){var b=r[--v]==f?this.DM:Math.floor(r[v]*p+(r[v-1]+d)*g);if((r[v]+=o.am(0,b,r,m,0,c))0&&r.rShiftTo(u,r),h<0&&t.ZERO.subTo(r,r)}}},t.prototype.invDigit=function(){if(this.t<1)return 0;var t=this[0];if(0==(1&t))return 0;var e=3&t;return(e=(e=(e=(e=e*(2-(15&t)*e)&15)*(2-(255&t)*e)&255)*(2-((65535&t)*e&65535))&65535)*(2-t*e%this.DV)%this.DV)>0?this.DV-e:-e},t.prototype.isEven=function(){return 0==(this.t>0?1&this[0]:this.s)},t.prototype.exp=function(e,i){if(e>4294967295||e<1)return t.ONE;var r=M(),n=M(),s=i.convert(this),o=K(e)-1;for(s.copyTo(r);--o>=0;)if(i.sqrTo(r,n),(e&1<0)i.mulTo(n,s,r);else{var h=r;r=n,n=h}return i.revert(r)},t.prototype.chunkSize=function(t){return Math.floor(Math.LN2*this.DB/Math.log(t))},t.prototype.toRadix=function(t){if(null==t&&(t=10),0==this.signum()||t<2||t>36)return"0";var e=this.chunkSize(t),i=Math.pow(t,e),r=U(i),n=M(),s=M(),o="";for(this.divRemTo(r,n,s);n.signum()>0;)o=(i+s.intValue()).toString(t).substr(1)+o,n.divRemTo(r,n,s);return s.intValue().toString(t)+o},t.prototype.fromRadix=function(e,i){this.fromInt(0),null==i&&(i=10);for(var r=this.chunkSize(i),n=Math.pow(i,r),s=!1,o=0,h=0,a=0;a=r&&(this.dMultiply(n),this.dAddOffset(h,0),o=0,h=0))}o>0&&(this.dMultiply(Math.pow(i,o)),this.dAddOffset(h,0)),s&&t.ZERO.subTo(this,this)},t.prototype.fromNumber=function(e,i,r){if("number"==typeof i)if(e<2)this.fromInt(1);else for(this.fromNumber(e,r),this.testBit(e-1)||this.bitwiseTo(t.ONE.shiftLeft(e-1),s,this),this.isEven()&&this.dAddOffset(1,0);!this.isProbablePrime(i);)this.dAddOffset(2,0),this.bitLength()>e&&this.subTo(t.ONE.shiftLeft(e-1),this);else{var n=[],o=7&e;n.length=1+(e>>3),i.nextBytes(n),o>0?n[0]&=(1<>=this.DB;if(t.t>=this.DB;r+=this.s}else{for(r+=this.s;i>=this.DB;r+=t.s}e.s=r<0?-1:0,r>0?e[i++]=r:r<-1&&(e[i++]=this.DV+r),e.t=i,e.clamp()},t.prototype.dMultiply=function(t){this[this.t]=this.am(0,t-1,this,0,0,this.t),++this.t,this.clamp()},t.prototype.dAddOffset=function(t,e){if(0!=t){for(;this.t<=e;)this[this.t++]=0;for(this[e]+=t;this[e]>=this.DV;)this[e]-=this.DV,++e>=this.t&&(this[this.t++]=0),++this[e]}},t.prototype.multiplyLowerTo=function(t,e,i){var r=Math.min(this.t+t.t,e);for(i.s=0,i.t=r;r>0;)i[--r]=0;for(var n=i.t-this.t;r=0;)i[r]=0;for(r=Math.max(e-this.t,0);r0)if(0==e)i=this[0]%t;else for(var r=this.t-1;r>=0;--r)i=(e*i+this[r])%t;return i},t.prototype.millerRabin=function(e){var i=this.subtract(t.ONE),r=i.getLowestSetBit();if(r<=0)return!1;var n=i.shiftRight(r);(e=e+1>>1)>B.length&&(e=B.length);for(var s=M(),o=0;o0&&(i.rShiftTo(o,i),r.rShiftTo(o,r));var h=function(){(s=i.getLowestSetBit())>0&&i.rShiftTo(s,i),(s=r.getLowestSetBit())>0&&r.rShiftTo(s,r),i.compareTo(r)>=0?(i.subTo(r,i),i.rShiftTo(1,i)):(r.subTo(i,r),r.rShiftTo(1,r)),i.signum()>0?setTimeout(h,0):(o>0&&r.lShiftTo(o,r),setTimeout((function(){e(r)}),0))};setTimeout(h,10)}},t.prototype.fromNumberAsync=function(e,i,r,n){if("number"==typeof i)if(e<2)this.fromInt(1);else{this.fromNumber(e,r),this.testBit(e-1)||this.bitwiseTo(t.ONE.shiftLeft(e-1),s,this),this.isEven()&&this.dAddOffset(1,0);var o=this,h=function(){o.dAddOffset(2,0),o.bitLength()>e&&o.subTo(t.ONE.shiftLeft(e-1),o),o.isProbablePrime(i)?setTimeout((function(){n()}),0):setTimeout(h,0)};setTimeout(h,0)}else{var a=[],u=7&e;a.length=1+(e>>3),i.nextBytes(a),u>0?a[0]&=(1<=0?t.mod(this.m):t},t.prototype.revert=function(t){return t},t.prototype.reduce=function(t){t.divRemTo(this.m,null,t)},t.prototype.mulTo=function(t,e,i){t.multiplyTo(e,i),this.reduce(i)},t.prototype.sqrTo=function(t,e){t.squareTo(e),this.reduce(e)},t}(),N=function(){function t(t){this.m=t,this.mp=t.invDigit(),this.mpl=32767&this.mp,this.mph=this.mp>>15,this.um=(1<0&&this.m.subTo(e,e),e},t.prototype.revert=function(t){var e=M();return t.copyTo(e),this.reduce(e),e},t.prototype.reduce=function(t){for(;t.t<=this.mt2;)t[t.t++]=0;for(var e=0;e>15)*this.mpl&this.um)<<15)&t.DM;for(t[i=e+this.m.t]+=this.m.am(0,r,t,e,0,this.m.t);t[i]>=t.DV;)t[i]-=t.DV,t[++i]++}t.clamp(),t.drShiftTo(this.m.t,t),t.compareTo(this.m)>=0&&t.subTo(this.m,t)},t.prototype.mulTo=function(t,e,i){t.multiplyTo(e,i),this.reduce(i)},t.prototype.sqrTo=function(t,e){t.squareTo(e),this.reduce(e)},t}(),P=function(){function t(t){this.m=t,this.r2=M(),this.q3=M(),A.ONE.dlShiftTo(2*t.t,this.r2),this.mu=this.r2.divide(t)}return t.prototype.convert=function(t){if(t.s<0||t.t>2*this.m.t)return t.mod(this.m);if(t.compareTo(this.m)<0)return t;var e=M();return t.copyTo(e),this.reduce(e),e},t.prototype.revert=function(t){return t},t.prototype.reduce=function(t){for(t.drShiftTo(this.m.t-1,this.r2),t.t>this.m.t+1&&(t.t=this.m.t+1,t.clamp()),this.mu.multiplyUpperTo(this.r2,this.m.t+1,this.q3),this.m.multiplyLowerTo(this.q3,this.m.t+1,this.r2);t.compareTo(this.r2)<0;)t.dAddOffset(1,this.m.t+1);for(t.subTo(this.r2,t);t.compareTo(this.m)>=0;)t.subTo(this.m,t)},t.prototype.mulTo=function(t,e,i){t.multiplyTo(e,i),this.reduce(i)},t.prototype.sqrTo=function(t,e){t.squareTo(e),this.reduce(e)},t}();function M(){return new A(null)}function L(t,e){return new A(t,e)}var j="undefined"!=typeof navigator;j&&"Microsoft Internet Explorer"==navigator.appName?(A.prototype.am=function(t,e,i,r,n,s){for(var o=32767&e,h=e>>15;--s>=0;){var a=32767&this[t],u=this[t++]>>15,c=h*a+u*o;n=((a=o*a+((32767&c)<<15)+i[r]+(1073741823&n))>>>30)+(c>>>15)+h*u+(n>>>30),i[r++]=1073741823&a}return n},w=30):j&&"Netscape"!=navigator.appName?(A.prototype.am=function(t,e,i,r,n,s){for(;--s>=0;){var o=e*this[t++]+i[r]+n;n=Math.floor(o/67108864),i[r++]=67108863&o}return n},w=26):(A.prototype.am=function(t,e,i,r,n,s){for(var o=16383&e,h=e>>14;--s>=0;){var a=16383&this[t],u=this[t++]>>14,c=h*a+u*o;n=((a=o*a+((16383&c)<<14)+i[r]+n)>>28)+(c>>14)+h*u,i[r++]=268435455&a}return n},w=28),A.prototype.DB=w,A.prototype.DM=(1<>>16)&&(t=e,i+=16),0!=(e=t>>8)&&(t=e,i+=8),0!=(e=t>>4)&&(t=e,i+=4),0!=(e=t>>2)&&(t=e,i+=2),0!=(e=t>>1)&&(t=e,i+=1),i}A.ZERO=U(0),A.ONE=U(1);var k,_,z=function(){function t(){this.i=0,this.j=0,this.S=[]}return t.prototype.init=function(t){var e,i,r;for(e=0;e<256;++e)this.S[e]=e;for(i=0,e=0;e<256;++e)i=i+this.S[e]+t[e%t.length]&255,r=this.S[e],this.S[e]=this.S[i],this.S[i]=r;this.i=0,this.j=0},t.prototype.next=function(){var t;return this.i=this.i+1&255,this.j=this.j+this.S[this.i]&255,t=this.S[this.i],this.S[this.i]=this.S[this.j],this.S[this.j]=t,this.S[t+this.S[this.i]&255]},t}(),Z=256,G=null;if(null==G){G=[],_=0;var $=void 0;if("undefined"!=typeof window&&window.crypto&&window.crypto.getRandomValues){var Y=new Uint32Array(256);for(window.crypto.getRandomValues(Y),$=0;$=256||_>=Z)window.removeEventListener?window.removeEventListener("mousemove",X,!1):window.detachEvent&&window.detachEvent("onmousemove",X);else try{var e=t.x+t.y;G[_++]=255&e,J+=1}catch(t){}};"undefined"!=typeof window&&(window.addEventListener?window.addEventListener("mousemove",X,!1):window.attachEvent&&window.attachEvent("onmousemove",X))}function Q(){if(null==k){for(k=new z;_0&&e.length>0?(this.n=L(t,16),this.e=parseInt(e,16)):console.error("Invalid RSA public key")},t.prototype.encrypt=function(t){var e=this.n.bitLength()+7>>3,i=function(t,e){if(e=0&&e>0;){var n=t.charCodeAt(r--);n<128?i[--e]=n:n>127&&n<2048?(i[--e]=63&n|128,i[--e]=n>>6|192):(i[--e]=63&n|128,i[--e]=n>>6&63|128,i[--e]=n>>12|224)}i[--e]=0;for(var s=new W,o=[];e>2;){for(o[0]=0;0==o[0];)s.nextBytes(o);i[--e]=o[0]}return i[--e]=2,i[--e]=0,new A(i)}(t,e);if(null==i)return null;var r=this.doPublic(i);if(null==r)return null;for(var n=r.toString(16),s=n.length,o=0;o<2*e-s;o++)n="0"+n;return n},t.prototype.setPrivate=function(t,e,i){null!=t&&null!=e&&t.length>0&&e.length>0?(this.n=L(t,16),this.e=parseInt(e,16),this.d=L(i,16)):console.error("Invalid RSA private key")},t.prototype.setPrivateEx=function(t,e,i,r,n,s,o,h){null!=t&&null!=e&&t.length>0&&e.length>0?(this.n=L(t,16),this.e=parseInt(e,16),this.d=L(i,16),this.p=L(r,16),this.q=L(n,16),this.dmp1=L(s,16),this.dmq1=L(o,16),this.coeff=L(h,16)):console.error("Invalid RSA private key")},t.prototype.generate=function(t,e){var i=new W,r=t>>1;this.e=parseInt(e,16);for(var n=new A(e,16);;){for(;this.p=new A(t-r,1,i),0!=this.p.subtract(A.ONE).gcd(n).compareTo(A.ONE)||!this.p.isProbablePrime(10););for(;this.q=new A(r,1,i),0!=this.q.subtract(A.ONE).gcd(n).compareTo(A.ONE)||!this.q.isProbablePrime(10););if(this.p.compareTo(this.q)<=0){var s=this.p;this.p=this.q,this.q=s}var o=this.p.subtract(A.ONE),h=this.q.subtract(A.ONE),a=o.multiply(h);if(0==a.gcd(n).compareTo(A.ONE)){this.n=this.p.multiply(this.q),this.d=n.modInverse(a),this.dmp1=this.d.mod(o),this.dmq1=this.d.mod(h),this.coeff=this.q.modInverse(this.p);break}}},t.prototype.decrypt=function(t){var e=L(t,16),i=this.doPrivate(e);return null==i?null:function(t,e){for(var i=t.toByteArray(),r=0;r=i.length)return null;for(var n="";++r191&&s<224?(n+=String.fromCharCode((31&s)<<6|63&i[r+1]),++r):(n+=String.fromCharCode((15&s)<<12|(63&i[r+1])<<6|63&i[r+2]),r+=2)}return n}(i,this.n.bitLength()+7>>3)},t.prototype.generateAsync=function(t,e,i){var r=new W,n=t>>1;this.e=parseInt(e,16);var s=new A(e,16),o=this,h=function(){var e=function(){if(o.p.compareTo(o.q)<=0){var t=o.p;o.p=o.q,o.q=t}var e=o.p.subtract(A.ONE),r=o.q.subtract(A.ONE),n=e.multiply(r);0==n.gcd(s).compareTo(A.ONE)?(o.n=o.p.multiply(o.q),o.d=s.modInverse(n),o.dmp1=o.d.mod(e),o.dmq1=o.d.mod(r),o.coeff=o.q.modInverse(o.p),setTimeout((function(){i()}),0)):setTimeout(h,0)},a=function(){o.q=M(),o.q.fromNumberAsync(n,1,r,(function(){o.q.subtract(A.ONE).gcda(s,(function(t){0==t.compareTo(A.ONE)&&o.q.isProbablePrime(10)?setTimeout(e,0):setTimeout(a,0)}))}))},u=function(){o.p=M(),o.p.fromNumberAsync(t-n,1,r,(function(){o.p.subtract(A.ONE).gcda(s,(function(t){0==t.compareTo(A.ONE)&&o.p.isProbablePrime(10)?setTimeout(a,0):setTimeout(u,0)}))}))};setTimeout(u,0)};setTimeout(h,0)},t.prototype.sign=function(t,e,i){var r=function(t,e){if(e15)throw"ASN.1 length too long to represent by 8x: n = "+t.toString(16);return(128+i).toString(16)+e},this.getEncodedHex=function(){return(null==this.hTLV||this.isModified)&&(this.hV=this.getFreshValueHex(),this.hL=this.getLengthHexFromValue(),this.hTLV=this.hT+this.hL+this.hV,this.isModified=!1),this.hTLV},this.getValueHex=function(){return this.getEncodedHex(),this.hV},this.getFreshValueHex=function(){return""}},rt.asn1.DERAbstractString=function(t){rt.asn1.DERAbstractString.superclass.constructor.call(this),this.getString=function(){return this.s},this.setString=function(t){this.hTLV=null,this.isModified=!0,this.s=t,this.hV=stohex(this.s)},this.setStringHex=function(t){this.hTLV=null,this.isModified=!0,this.s=null,this.hV=t},this.getFreshValueHex=function(){return this.hV},void 0!==t&&("string"==typeof t?this.setString(t):void 0!==t.str?this.setString(t.str):void 0!==t.hex&&this.setStringHex(t.hex))},it.lang.extend(rt.asn1.DERAbstractString,rt.asn1.ASN1Object),rt.asn1.DERAbstractTime=function(t){rt.asn1.DERAbstractTime.superclass.constructor.call(this),this.localDateToUTC=function(t){return utc=t.getTime()+6e4*t.getTimezoneOffset(),new Date(utc)},this.formatDate=function(t,e,i){var r=this.zeroPadding,n=this.localDateToUTC(t),s=String(n.getFullYear());"utc"==e&&(s=s.substr(2,2));var o=s+r(String(n.getMonth()+1),2)+r(String(n.getDate()),2)+r(String(n.getHours()),2)+r(String(n.getMinutes()),2)+r(String(n.getSeconds()),2);if(!0===i){var h=n.getMilliseconds();if(0!=h){var a=r(String(h),3);o=o+"."+(a=a.replace(/[0]+$/,""))}}return o+"Z"},this.zeroPadding=function(t,e){return t.length>=e?t:new Array(e-t.length+1).join("0")+t},this.getString=function(){return this.s},this.setString=function(t){this.hTLV=null,this.isModified=!0,this.s=t,this.hV=stohex(t)},this.setByDateValue=function(t,e,i,r,n,s){var o=new Date(Date.UTC(t,e-1,i,r,n,s,0));this.setByDate(o)},this.getFreshValueHex=function(){return this.hV}},it.lang.extend(rt.asn1.DERAbstractTime,rt.asn1.ASN1Object),rt.asn1.DERAbstractStructured=function(t){rt.asn1.DERAbstractString.superclass.constructor.call(this),this.setByASN1ObjectArray=function(t){this.hTLV=null,this.isModified=!0,this.asn1Array=t},this.appendASN1Object=function(t){this.hTLV=null,this.isModified=!0,this.asn1Array.push(t)},this.asn1Array=new Array,void 0!==t&&void 0!==t.array&&(this.asn1Array=t.array)},it.lang.extend(rt.asn1.DERAbstractStructured,rt.asn1.ASN1Object),rt.asn1.DERBoolean=function(){rt.asn1.DERBoolean.superclass.constructor.call(this),this.hT="01",this.hTLV="0101ff"},it.lang.extend(rt.asn1.DERBoolean,rt.asn1.ASN1Object),rt.asn1.DERInteger=function(t){rt.asn1.DERInteger.superclass.constructor.call(this),this.hT="02",this.setByBigInteger=function(t){this.hTLV=null,this.isModified=!0,this.hV=rt.asn1.ASN1Util.bigIntToMinTwosComplementsHex(t)},this.setByInteger=function(t){var e=new A(String(t),10);this.setByBigInteger(e)},this.setValueHex=function(t){this.hV=t},this.getFreshValueHex=function(){return this.hV},void 0!==t&&(void 0!==t.bigint?this.setByBigInteger(t.bigint):void 0!==t.int?this.setByInteger(t.int):"number"==typeof t?this.setByInteger(t):void 0!==t.hex&&this.setValueHex(t.hex))},it.lang.extend(rt.asn1.DERInteger,rt.asn1.ASN1Object),rt.asn1.DERBitString=function(t){if(void 0!==t&&void 0!==t.obj){var e=rt.asn1.ASN1Util.newObject(t.obj);t.hex="00"+e.getEncodedHex()}rt.asn1.DERBitString.superclass.constructor.call(this),this.hT="03",this.setHexValueIncludingUnusedBits=function(t){this.hTLV=null,this.isModified=!0,this.hV=t},this.setUnusedBitsAndHexValue=function(t,e){if(t<0||7=2?(n[n.length]=s,s=0,o=0):s<<=4}}if(o)throw new Error("Hex encoding incomplete: 4 bits missing");return n}(t):v.unarmor(t),n=x.decode(r);if(3===n.sub.length&&(n=n.sub[2].sub[0]),9===n.sub.length){e=n.sub[1].getHexStringValue(),this.n=L(e,16),i=n.sub[2].getHexStringValue(),this.e=parseInt(i,16);var s=n.sub[3].getHexStringValue();this.d=L(s,16);var o=n.sub[4].getHexStringValue();this.p=L(o,16);var h=n.sub[5].getHexStringValue();this.q=L(h,16);var a=n.sub[6].getHexStringValue();this.dmp1=L(a,16);var u=n.sub[7].getHexStringValue();this.dmq1=L(u,16);var f=n.sub[8].getHexStringValue();this.coeff=L(f,16)}else{if(2!==n.sub.length)return!1;if(n.sub[0].sub){var l=n.sub[1].sub[0];e=l.sub[0].getHexStringValue(),this.n=L(e,16),i=l.sub[1].getHexStringValue(),this.e=parseInt(i,16)}else e=n.sub[0].getHexStringValue(),this.n=L(e,16),i=n.sub[1].getHexStringValue(),this.e=parseInt(i,16)}return!0}catch(t){return!1}},e.prototype.getPrivateBaseKey=function(){var t={array:[new rt.asn1.DERInteger({int:0}),new rt.asn1.DERInteger({bigint:this.n}),new rt.asn1.DERInteger({int:this.e}),new rt.asn1.DERInteger({bigint:this.d}),new rt.asn1.DERInteger({bigint:this.p}),new rt.asn1.DERInteger({bigint:this.q}),new rt.asn1.DERInteger({bigint:this.dmp1}),new rt.asn1.DERInteger({bigint:this.dmq1}),new rt.asn1.DERInteger({bigint:this.coeff})]};return new rt.asn1.DERSequence(t).getEncodedHex()},e.prototype.getPrivateBaseKeyB64=function(){return p(this.getPrivateBaseKey())},e.prototype.getPublicBaseKey=function(){var t=new rt.asn1.DERSequence({array:[new rt.asn1.DERObjectIdentifier({oid:"1.2.840.113549.1.1.1"}),new rt.asn1.DERNull]}),e=new rt.asn1.DERSequence({array:[new rt.asn1.DERInteger({bigint:this.n}),new rt.asn1.DERInteger({int:this.e})]}),i=new rt.asn1.DERBitString({hex:"00"+e.getEncodedHex()});return new rt.asn1.DERSequence({array:[t,i]}).getEncodedHex()},e.prototype.getPublicBaseKeyB64=function(){return p(this.getPublicBaseKey())},e.wordwrap=function(t,e){if(!t)return t;var i="(.{1,"+(e=e||64)+"})( +|$\n?)|(.{1,"+e+"})";return t.match(RegExp(i,"g")).join("\n")},e.prototype.getPrivateKey=function(){var t="-----BEGIN RSA PRIVATE KEY-----\n";return(t+=e.wordwrap(this.getPrivateBaseKeyB64())+"\n")+"-----END RSA PRIVATE KEY-----"},e.prototype.getPublicKey=function(){var t="-----BEGIN PUBLIC KEY-----\n";return(t+=e.wordwrap(this.getPublicBaseKeyB64())+"\n")+"-----END PUBLIC KEY-----"},e.hasPublicKeyProperty=function(t){return(t=t||{}).hasOwnProperty("n")&&t.hasOwnProperty("e")},e.hasPrivateKeyProperty=function(t){return(t=t||{}).hasOwnProperty("n")&&t.hasOwnProperty("e")&&t.hasOwnProperty("d")&&t.hasOwnProperty("p")&&t.hasOwnProperty("q")&&t.hasOwnProperty("dmp1")&&t.hasOwnProperty("dmq1")&&t.hasOwnProperty("coeff")},e.prototype.parsePropertiesFrom=function(t){this.n=t.n,this.e=t.e,t.hasOwnProperty("d")&&(this.d=t.d,this.p=t.p,this.q=t.q,this.dmp1=t.dmp1,this.dmq1=t.dmq1,this.coeff=t.coeff)},e}(tt),at=i(155),ut=void 0!==at?null===(st=at.env)||void 0===st?void 0:"3.3.2":void 0;const ct=function(){function t(t){void 0===t&&(t={}),t=t||{},this.default_key_size=t.default_key_size?parseInt(t.default_key_size,10):1024,this.default_public_exponent=t.default_public_exponent||"010001",this.log=t.log||!1,this.key=null}return t.prototype.setKey=function(t){this.log&&this.key&&console.warn("A key was already set, overriding existing."),this.key=new ht(t)},t.prototype.setPrivateKey=function(t){this.setKey(t)},t.prototype.setPublicKey=function(t){this.setKey(t)},t.prototype.decrypt=function(t){try{return this.getKey().decrypt(g(t))}catch(t){return!1}},t.prototype.encrypt=function(t){try{return p(this.getKey().encrypt(t))}catch(t){return!1}},t.prototype.sign=function(t,e,i){try{return p(this.getKey().sign(t,e,i))}catch(t){return!1}},t.prototype.verify=function(t,e,i){try{return this.getKey().verify(t,g(e),i)}catch(t){return!1}},t.prototype.getKey=function(t){if(!this.key){if(this.key=new ht,t&&"[object Function]"==={}.toString.call(t))return void this.key.generateAsync(this.default_key_size,this.default_public_exponent,t);this.key.generate(this.default_key_size,this.default_public_exponent)}return this.key},t.prototype.getPrivateKey=function(){return this.getKey().getPrivateKey()},t.prototype.getPrivateKeyB64=function(){return this.getKey().getPrivateBaseKeyB64()},t.prototype.getPublicKey=function(){return this.getKey().getPublicKey()},t.prototype.getPublicKeyB64=function(){return this.getKey().getPublicBaseKeyB64()},t.version=ut,t}()})(),r.default})()));/* global vajQuery, va_openForm, va_openForms, google, va_preSendWebSocket, va_applyExtraInputMask */ /* global webBotSettings, chatbotModal, vaCreateModal, vaCreateErrorModal, va_testMode */ /* global va_afterInit_extra, va_processExtraInfo, va_initAiEvent_extra, va_applyUrlClick, va_useAppBrowser*/ /* global lasteMsg, va_openFormHandler, invokeAppJs, timeoutReset, va_onWsClose, va_onWsError, va_extraWebHandler, vaCreateRatingModal*/ /** * */ var va_sessionTime = 0; var va_intervalObj; var va_wsSessionTime = 0; var va_wsIntervalObj; var va_inputMask = ''; var va_disableInput = false; var quickReplyAlign = 'left'; var va_timer; var va_initialLocation; var va_taipei = {lat: 25.048069, lng: 121.517101}; var va_browserSupportFlag = new Boolean(); var va_marker = false; //Has the user plotted their location marker? var va_map; var va_geocoder; var mapPostbackVal = ''; var lastReceiver = ''; var specialChar = 'https://va.transglobe.com.tw/'; var va_ws; var lastedEventType = ''; var lastedText = ''; var lastedValue = ''; var lastedType = ''; var isNeedSaveAutoAskingLog = false; var lastedData = undefined; var va_isReloadLog = false; var va_reloadLog = 0; var va_scrollCount = 0; var va_greeting = va_randomGreeting(); var va_init = true, va_rec = false, va_openForm = '', va_openForms = [], va_excludeEventType = [], va_askTo = 'watson'; var va_testMode = false; var singleSentenceSatisfy = 'show'; //show or hide var webBotSettings = '{"loads":{"createVa":"tgl-va.js","js":{"default":["ibm-bootstrap.min.js","jsencrypt.min.js"],"assignVars":["aiEvent.js","tgl-aiEvent.js","openForm.js","registerTerm.js","autocompleteList.js"]},"css":{"default":["ibm-va-bootstrap.css"],"assignVars":["comp.css","openForm.css","autocompleteList.css"]},"crypto":{"public":"id_rsa.pub"}},"botName":"『伊將』","boticon":[{"channel":"default","description":"預設","botIcon":"tgl","botName":"『伊將』","web":{"position":"bottom","x-offset":25,"y-offset":32},"mobile_1024":{"position":"bottom","x-offset":125,"y-offset":0},"mobile_768":{"position":"bottom","x-offset":125,"y-offset":0},"mobile_460":{"position":"bottom","x-offset":125,"y-offset":0},"mobile":{"position":"bottom","x-offset":125,"y-offset":0},"iconDisplay":true},{"channel":"CSIS","description":"CSIS","botIcon":"tgl","botName":"『伊將』","web":{"position":"bottom","x-offset":70,"y-offset":32},"mobile_1024":{"position":"top","x-offset":77,"y-offset":15},"mobile_768":{"position":"top","x-offset":77,"y-offset":15},"mobile_460":{"position":"top","x-offset":77,"y-offset":15},"mobile":{"position":"top","x-offset":77,"y-offset":15},"iconDisplay":true},{"channel":"EC","description":"EC","botIcon":"tgl","botName":"『伊將』","web":{"position":"bottom","x-offset":25,"y-offset":32},"mobile_1024":{"position":"bottom","x-offset":125,"y-offset":0},"mobile_768":{"position":"bottom","x-offset":125,"y-offset":0},"mobile_460":{"position":"bottom","x-offset":125,"y-offset":0},"mobile":{"position":"bottom","x-offset":125,"y-offset":0},"iconDisplay":true},{"channel":"CW","description":"官網","botIcon":"tgl","botName":"『伊將』","web":{"position":"bottom","x-offset":110,"y-offset":77},"mobile_1024":{"position":"bottom","x-offset":125,"y-offset":45},"mobile_768":{"position":"bottom","x-offset":125,"y-offset":10},"mobile_460":{"position":"bottom","x-offset":65,"y-offset":35},"mobile":{"position":"top","x-offset":320,"y-offset":2},"iconDisplay":true}],"openForm":{},"cwUrl":{"prod":"https://www.transglobe.com.tw/","uat":"https://tgluat.transglobe.com.tw/"},"fs":{"Lev1":{"s":"14","m":"16","l":"18"},"Lev2":{"s":"16","m":"20","l":"24"}},"urlConfig":{"cwUrl":"https://www.transglobe.com.tw","csisUrl":"https://eservice.transglobe.com.tw","ecUrl":"https://e-commerce.transglobe.com.tw","mpos":"https://mpos.transglobe.com.tw"}}'; webBotSettings = JSON.parse(webBotSettings); va_showMsg(webBotSettings); var va_display_status = 'true'; function va_randomGreeting() { var mainWelcome= 'main_welcome1'; var nowDate = new Date(); var specialFirstStartDate = new Date(2023, 5, 14); var specialFirstEndDate = new Date(2023, 5, 27); var specialStartDate = new Date(2023, 2, 20); var specialEndDate = new Date(2023, 5, 27); if (nowDate > specialFirstStartDate && nowDate < specialFirstEndDate) { mainWelcome = 'main_welcome1_端午節'; } else if (nowDate > specialStartDate && nowDate < specialEndDate) { mainWelcome = 'main_welcome1_個人化服務'; } // var welcomeList = mainWelcomeList; // 依需求更換不同的welcomeList // var index = Math.floor(Math.random() * welcomeList.length); return mainWelcome; } function va_showMsg(msg, tag, toDialog) { if (toDialog === undefined) { toDialog = false; } if (va_testMode && va_testMode === true) { //follow toDialog } else { toDialog = false; } if (tag === undefined) { tag = ''; } var today = new Date(); today.setTime(today.getTime() + 8 * 60 * 60 * 1000); today = today.toISOString(); try { if (msg && msg.constructor && msg.constructor === String) { console.log(`[${today}] ${tag}:${msg}`); if (toDialog) { appendDialog(msg, 'false', '0'); } } else { console.log(`[${today}] ${tag}:`); console.log(msg); if (toDialog) { if (tag.length > 0) { appendDialog(tag + ':', 'false', '0'); } appendDialog(JSON.stringify(msg).replace(/,/g, ', '), 'false', '0'); } } } catch (e) { console.error(`${tag} catch error:`) console.error(e) console.error(msg); } } vajQuery(function () { sessionStorage.removeItem('PIPInfo'); vajQuery('#cbSend').hide(); vajQuery('#cbSendGrey').show(); vajQuery('#boxSignOut').hide(); //sessionStorage.setItem('vaClient', '18.119.158.134'); window.onbeforeunload = closingCode; function closingCode() { return null; } window.onbeforeunload = function (event) { return va_closeWebSocket(); }; vajQuery('#ibmchatbox').click(function () { $('#vaChatbox').trigger('click'); }); $('#vaChatbox').click(function () { vajQuery('#ibmchatbox').removeClass('welcomeDiv'); sessionStorage.setItem('vaWelcome', 'true'); getRefNoLog(va_init); getTheAutoCompleteList(); if (vajQuery(window).height() < 420 || vajQuery(window).width() < 568) { vajQuery('body').addClass('no-scroll'); } vaTriggerOpen(); vajQuery('#cbEye').toggle(false); if (va_isReloadLog === false) { //scrollBottom(); } changeSize(); if (document.getElementById('chatbotContent')) { changeContentFz(null, 's'); } else { sessionStorage.setItem('scaleFz', 's'); } }); vajQuery('#vaChatbox').click(function () { vajQuery('#ibmchatbox').removeClass('welcomeDiv'); sessionStorage.setItem('vaWelcome', 'true'); getRefNoLog(va_init); getTheAutoCompleteList(); if (vajQuery(window).height() < 420 || vajQuery(window).width() < 568) { vajQuery('body').addClass('no-scroll'); } vaTriggerOpen(); vajQuery('#cbEye').toggle(false); if (va_isReloadLog === false) { //scrollBottom(); } changeSize(); }); /** * Chatbot on close */ vajQuery('#boxclose').click(function () { if (sessionStorage.getItem('wholeSatisfactionSurvey') === 'match') { vaWholeSatisfactionSurvey(sessionStorage.getItem('uid'), 1, {}); } else { vaTriggerOpen(); vajQuery('#cbEye').toggle(false); vajQuery('body').removeClass('no-scroll'); } }); vajQuery('#boxInfo').click(function () { createPIPInfoModal(); }); vajQuery('#boxSignOut').click(function () { if (vajQuery('#boxSignOutModal').length) { chatbotModal('boxSignOutModal', 'show'); } else { var modalWindow = vajQuery(''); var modalDialog = vajQuery(''); var modalContent = vajQuery(''); var modalBody = vajQuery(''); var modalFooter = vajQuery(''); modalContent.append(modalBody); modalContent.append(modalFooter); modalDialog.append(modalContent); modalWindow.append(modalDialog); vajQuery('#ibmchatbox').after(modalWindow); vajQuery('#soModalOK').click(function () { chatbotModal('boxSignOutModal', 'hide'); vajQuery('#quickReply').empty(); quickReplyAlign = 'left'; vaTriggerOpen(true); va_sendWebSocket('logout', 'text', '//clear', ''); if (sessionStorage.getItem('loginToken') !== undefined) { sessionStorage.removeItem('loginToken'); } if (sessionStorage.getItem('refNo') !== undefined) { sessionStorage.removeItem('refNo'); } if (sessionStorage.getItem('scrollButtom') !== undefined) { sessionStorage.removeItem('scrollButtom'); } vajQuery('#boxSignOut').hide(); setTimeout(function () { clearMaintainMsg(); vajQuery('.cbIntent').remove(); vajQuery('.cbQDiv').remove(); if (va_askTo === 'agent') { appendFirstDialog(0, '現已在保戶專區登出會員身份,而結束與文字客服對話,祝你順心,接下來由智能客服' + webBotSettings.botName + '為你服務!', 'false'); } else { appendFirstDialog(0, '重新載入對話完成\r\n請重新輸入您的問題', 'false'); } va_askTo = 'watson'; va_sendWebSocket('greeting', 'postback', '', va_greeting); va_inputMask = ''; va_changeInput(va_inputMask); vajQuery('#quickReply').empty(); }, 1000); }); vajQuery('#soModalCancel').click(function () { chatbotModal('boxSignOutModal', 'hide'); }); chatbotModal('boxSignOutModal', 'show'); } }); vajQuery('#boxRefresh').click(function () { if (vajQuery('#boxRefreshModal').length) { chatbotModal('boxRefreshModal', 'show'); // vajQuery('#boxRefreshModal').modal('show'); } else { var modalWindow = vajQuery(''); var modalDialog = vajQuery(''); var modalContent = vajQuery(''); var modalBody = vajQuery(''); var modalFooter = vajQuery(''); modalContent.append(modalBody); modalContent.append(modalFooter); modalDialog.append(modalContent); modalWindow.append(modalDialog); vajQuery('#ibmchatbox').after(modalWindow); vajQuery('#rfModalOK').click(function () { refreshChatEvent(true); }); vajQuery('#rfModalCancel').click(function () { chatbotModal('boxRefreshModal', 'hide'); // vajQuery('#boxRefreshModal').modal('hide'); }); chatbotModal('boxRefreshModal', 'show'); // vajQuery('#boxRefreshModal').modal('show'); } }); vajQuery('#boxMaximize').click(function () { vajQuery('#ibmchat').addClass('chatbotDivMax'); vajQuery('#ctContent').addClass('ctContentMax'); vajQuery('#cbInput').addClass('cbFooter2Max'); vajQuery('#cbSecInput').addClass('cbFooter2Max'); vajQuery('#boxMaximize').toggle(false); vajQuery('#boxRestore').toggle(true); vajQuery('body').addClass('no-scroll'); if (sessionStorage.getItem('scrollButtom') === 'true') { scrollBottom(); } changeSize(); //set menu width vajQuery('.chatbotFooter .ctMenu-list').addClass('menuMax'); //set maintainMsg,stopTextServiceMsg width vajQuery('.ibm-va .maintainMsg').css('max-width', '100%'); vajQuery('.ibm-va .stopTextServiceMsg').css('max-width', '100%'); }); vajQuery('#boxRestore').click(function () { vajQuery('#ibmchat').removeClass('chatbotDivMax'); vajQuery('#ctContent').removeClass('ctContentMax'); vajQuery('#cbInput').removeClass('cbFooter2Max'); vajQuery('#cbSecInput').removeClass('cbFooter2Max'); vajQuery('#boxMaximize').toggle(true); vajQuery('#boxRestore').toggle(false); vajQuery('body').removeClass('no-scroll'); if (sessionStorage.getItem('scrollButtom') === 'true') { scrollBottom(); } changeSize(); //set menu width vajQuery('.chatbotFooter .ctMenu-list').removeClass('menuMax'); //set maintainMsg,stopTextServiceMsg width vajQuery('.ibm-va .maintainMsg').css('max-width', '400px'); vajQuery('.ibm-va .stopTextServiceMsg').css('max-width', '400px'); }); vajQuery('#boxScaleFz').click(function () { var fz = sessionStorage.getItem('scaleFz'); var targetFz = 's'; if (fz === 's') { targetFz = 'm'; } else if (fz === 'm') { targetFz = 'l'; } else if (fz === 'l') { targetFz = 's'; } changeContentFz(fz, targetFz); }); function changeSize() { vajQuery('[id^=Intent_Slider]').each(function () { var vajQuerythis = vajQuery(this); coverIt(vajQuerythis); }); } function coverIt(div) { var slider = div.find('[id^=Slider]'); var offset = slider.scrollLeft(); if (vajQuery('#chatbotContent').width() === slider[0].scrollWidth) { div.find('.left').css('display', 'none'); div.find('.right').css('display', 'none'); } else if (offset <= 0) { div.find('.left').hide(); div.find('.right').show(); } else if (offset + vajQuery('#chatbotContent').width() + 5 > slider[0].scrollWidth) { div.find('.left').show(); div.find('.right').hide(); } else { div.find('.left').show(); div.find('.right').show(); } } vajQuery('#cbSend').click(function (e) { if (vajQuery('#cbInput').is(':visible')) { if (vajQuery.trim(vajQuery('#cbInput').val()) !== '') { var input = va_escapeHtml(vajQuery.trim(vajQuery('#cbInput').val())); appendQuery(input); va_sendWebSocket('input', 'text', input); vajQuery('#cbInput').val(''); vajQuery('#cbSecInput').val(''); vajQuery('#cbSend').hide(); vajQuery('#cbSendGrey').show(); vajQuery('#quickReply').empty(); } } else if (vajQuery('#cbSecInput').is(':visible')) { if (vajQuery.trim(vajQuery('#cbSecInput').val()) !== '') { var input = va_escapeHtml(vajQuery.trim(vajQuery('#cbSecInput').val())); if (va_inputMask === 'id') { var dialog = ''; for (var i = 0; i < 3; i++) { dialog += '•'; } appendQuery(input.substring(0, 4) + dialog + input.substring(7)); } else if (va_inputMask === 'all') { var dialog = ''; for (var i = 0; i < input.length; i++) { dialog += '•'; } appendQuery(dialog); } else { va_applyExtraInputMask(e, input); } va_sendWebSocket('input', 'text', input); vajQuery('#cbInput').val(''); vajQuery('#cbSecInput').val(''); vajQuery('#cbSend').hide(); vajQuery('#cbSendGrey').show(); vajQuery('#quickReply').empty(); } } }); vajQuery('#cbInput').change(function () { if (vajQuery.trim(vajQuery('#cbInput').val()) !== '') { vajQuery('#cbSend').show(); vajQuery('#cbSendGrey').hide(); } else { vajQuery('#cbSend').hide(); vajQuery('#cbSendGrey').show(); } }); vajQuery('#cbInput').focus(function () { scrollBottom(); }); vajQuery('#cbInput').keypress(function (e) { if (e.keyCode === 13) { if (vajQuery.trim(vajQuery('#cbInput').val()) !== '') { var input = va_escapeHtml(vajQuery.trim(vajQuery('#cbInput').val())); appendQuery(input); va_sendWebSocket('input', 'text', input); vajQuery('#cbInput').val(''); vajQuery('#cbSecInput').val(''); vajQuery('#cbSend').hide(); vajQuery('#cbSendGrey').show(); vajQuery('#quickReply').empty(); } } }); vajQuery('#cbInput').keyup(function (e) { if (vajQuery.trim(vajQuery('#cbInput').val()) !== '') { vajQuery('#cbSend').show(); vajQuery('#cbSendGrey').hide(); } else { vajQuery('#cbSend').hide(); vajQuery('#cbSendGrey').show(); } }); vajQuery('#cbSecInput').change(function () { if (vajQuery.trim(vajQuery('#cbSecInput').val()) !== '') { vajQuery('#cbSend').show(); vajQuery('#cbSendGrey').hide(); } else { vajQuery('#cbSend').hide(); vajQuery('#cbSendGrey').show(); } }); vajQuery('#cbSecInput').keypress(function (e) { if (e.keyCode === 13) { if (vajQuery.trim(vajQuery('#cbSecInput').val()) !== '') { var input = va_escapeHtml(vajQuery.trim(vajQuery('#cbSecInput').val())); if (va_inputMask === 'id') { var dialog = ''; for (var i = 0; i < 3; i++) { dialog += '•'; } appendQuery(input.substring(0, 4) + dialog + input.substring(7)); } else if (va_inputMask === 'all') { var dialog = ''; for (var i = 0; i < input.length; i++) { dialog += '•'; } appendQuery(dialog); } else { va_applyExtraInputMask(e, input); } va_sendWebSocket('input', 'text', input); vajQuery('#cbInput').val(''); vajQuery('#cbSecInput').val(''); vajQuery('#cbSend').hide(); vajQuery('#cbSendGrey').show(); vajQuery('#quickReply').empty(); } } }); vajQuery('#cbSecInput').keyup(function (e) { if (vajQuery.trim(vajQuery('#cbSecInput').val()) !== '') { vajQuery('#cbSend').show(); vajQuery('#cbSendGrey').hide(); } else { vajQuery('#cbSend').hide(); vajQuery('#cbSendGrey').show(); } }); vajQuery('#ctContent').scroll(function () { var contentH = vajQuery('#ctContent').scrollTop() + vajQuery('#ctContent').innerHeight(); var scrollH = vajQuery('#ctContent')[0].scrollHeight - 5; if (contentH < scrollH) { vajQuery('#backDown').show(); } else { vajQuery('#backDown').hide(); } }); vajQuery('#backDown').click(function () { scrollBottom(); }); var webchat = GetURLParameter('webchat'); var intent = GetPagebackParameter('?' + webchat, 'intent'); var param = GetPagebackParameter('?' + webchat, 'back'); var triggerVa = GetURLParameter('triggerVa'); if (intent !== undefined && intent !== '') { appendQuery(intent); if (param === undefined || param === '') { va_sendWebSocket('link', 'text', intent, ''); } else { va_sendWebSocket('link', 'postback', intent, param); } vajQuery('#vaChatbox').trigger('click'); } else if (triggerVa !== undefined && triggerVa === 'true') { vajQuery('#vaChatbox').trigger('click'); } else if (sessionStorage.getItem('vaTriggerOpen') === 'true') { vaTriggerClick(); sessionStorage.removeItem('vaTriggerOpen'); } va_initAiEvent_extra(); }); function refreshChatEvent(open) { sessionStorage.removeItem('wholeSatisfactionSurvey'); chatbotModal('boxRefreshModal', 'hide'); vajQuery('#quickReply').empty(); quickReplyAlign = 'left'; vaTriggerOpen(open); va_sendWebSocket('refresh', 'text', '//clear', ''); // va_closeWebSocket(); //if (sessionStorage.getItem('loginToken') !== undefined) sessionStorage.removeItem('loginToken'); if (sessionStorage.getItem('refNo') !== undefined) { sessionStorage.removeItem('refNo'); } if (sessionStorage.getItem('scrollButtom') !== undefined) { sessionStorage.removeItem('scrollButtom'); } setTimeout(function () { clearMaintainMsg(); vajQuery('.cbIntent').remove(); vajQuery('.cbQDiv').remove(); if (va_askTo === 'agent') { appendFirstDialog(0, '你已結束與文字客服對話,祝你順心,接下來由智能客服' + webBotSettings.botName + '為你服務!', 'false'); } refreshBackgroundImage(); // appendFirstDialog(0, '重新載入對話完成\r\n請重新輸入您的問題', 'false'); // getRefNo(false); va_askTo = 'watson'; va_sendWebSocket('greeting', 'postback', '', va_randomGreeting()); appendWaittingDialog(false); va_inputMask = ''; va_changeInput(va_inputMask); vajQuery('#quickReply').empty(); }, 1000); } /* Refresh background image for possible updated festival settings. */ function refreshBackgroundImage() { const chatDiv = document.querySelector('#ibmchat'); const backgroundImage = getComputedStyle(chatDiv).backgroundImage; const urlIndexStart = backgroundImage.indexOf(`url("`) + 5; let urlIndexEnd = backgroundImage.lastIndexOf(`?`); if(urlIndexEnd === -1) { urlIndexEnd = backgroundImage.lastIndexOf(`")`); } const url = backgroundImage.substring(urlIndexStart, urlIndexEnd); chatDiv.style.backgroundImage = `url("${url}?${new Date().getTime()}")`; } function getRefNoLog(first) { if (first) { var refNo = sessionStorage.getItem('refNo'); if (refNo === undefined || refNo === 'Null' || refNo === '' || refNo === null) { va_afterInit(); } else { try { var logUrl = 'https://va.transglobe.com.tw/api/getConversationLogByRefNo?refNo=' + refNo; $.getJSON(logUrl, { format: 'json', random: new Date().getTime() }) .done(function (data) { if (data && data.recordSet && data.recordSet.length > 0) { va_isReloadLog = true; va_reloadLog = 0; va_scrollCount = 0; $('.loaderMain').show(); for (var i = 0; i < data.recordSet.length; i++) { if (data.recordSet[i].LogSource === 'ConversationLog') { var outputMeta = JSON.parse(jsonEscape(data.recordSet[i].OutputMeta)); va_reloadLog += outputMeta.contents.length; outputMeta.extraInfo = { requestId: data.recordSet[i].RequestID }; if (i === 0) { renderVaContent(outputMeta); } else { va_reloadLog += 1; appendQuery(jsonEscape(data.recordSet[i].RawText)); renderVaContent(outputMeta); } if (outputMeta !== undefined && outputMeta.quickReply !== undefined) { va_reloadLog += 1; } } else { va_reloadLog += 1; if (data.recordSet[i].MessageSource === 'ChatBot') { appendQuery(jsonEscape(data.recordSet[i].RawText)); } else { let extraInfoData = { askTo: 'agent' }; appendFirstDialog(0, jsonEscape(data.recordSet[i].RawText), 'false', extraInfoData); } } } checkAutoAsk(); if (data.lastAns !== undefined && data.lastAns !== '') { va_reloadLog += 1; data.lastAns.extraInfo = {}; renderVaContent(data.lastAns); } } va_afterInit(); va_rec = true; }) .fail(function (data) { va_afterInit(); }) } catch (e) { console.error(e); va_afterInit(); } } va_init = false; } } function va_afterInit() { if (vajQuery('#chatbotContent').children().length < 4) { if (sessionStorage.getItem('closeAgent') === 'true') { appendFirstDialog(0, '現已在保戶專區登出會員身份,而結束與文字客服對話,祝你順心,接下來由智能客服' + webBotSettings.botName + '為你服務!', 'false'); sessionStorage.removeItem('closeAgent'); } const urlParams = new URLSearchParams(window.location.search); if (urlParams !== undefined && urlParams !== null && urlParams !== '' && urlParams.get('text') !== undefined && urlParams.get('text') !== null && urlParams.get('text') !== '') { var text = ''; try { text = decodeURIComponent(escape(window.atob(decodeURIComponent(urlParams.get('text'))))); if (text !== undefined && text !== null && text !== '') { appendQuery(text); va_sendWebSocket('QR', 'text', text, text); isNeedSaveAutoAskingLog = true; } else { va_sendWebSocket('greeting', 'postback', '', va_greeting); } } catch (e) { text = ''; isNeedSaveAutoAskingLog = false; va_sendWebSocket('greeting', 'postback', '', va_greeting); } } else { va_sendWebSocket('greeting', 'postback', '', va_greeting); } va_resetTimeout(); } if (va_isReloadLog === true) { va_isReloadLog = false; //scrollBottom(); if (sessionStorage.getItem('scrollButtom') === 'true') { scrollBottom(); } else { $('.loaderMain').hide(); } } if (va_afterInit_extra) { va_afterInit_extra(); var getPostWordingUrl = 'https://va.transglobe.com.tw/api/getPostWording'; $.getJSON(getPostWordingUrl, { format: 'json', random: Math.random() }) .done(function (data) { if (data && data.postWording && data.isValid === '1') { vajQuery('#maintainMsg').addClass('maintainMsg'); vajQuery('#maintainMsgBk').addClass('maintainMsgBk'); vajQuery('#maintainMsgBk').html( '提醒您,為免受詐騙集團侵擾,請勿點擊不明訊息或連結,避免外洩帳號密碼及OTP驗證碼以保障您的權益及個資安全。請詳閱「隱私權保護聲明及網路安全提醒」,如已瞭解並同意,歡迎進行對話服務。' ); vajQuery('#maintainMsg').html( data.postWording ); } }) .fail(function (data) { console.error(`Get post wording failed: ${data}`); }); setTimeout(function () { clearMaintainMsg(); }, 6000); } } function clearMaintainMsg() { vajQuery('#maintainMsg').html(''); vajQuery('#maintainMsgBk').html(''); vajQuery('#maintainMsg').removeClass('maintainMsg'); vajQuery('#maintainMsgBk').removeClass('maintainMsgBk'); } function clearStopTextServiceMsg() { vajQuery('#stopTextServiceMsg').hide(); vajQuery('#stopTextServiceMsgBk').hide(); } function showStopTextServiceMsg() { vajQuery('#stopTextServiceMsg').show(); vajQuery('#stopTextServiceMsg').attr('style', vajQuery('#stopTextServiceMsg').attr('style') + 'display:block !important;'); vajQuery('#stopTextServiceMsgBk').show(); } function va_connectionWebSocket() { va_showMsg(va_ws, 'va_connectionWebSocket, va_ws='); if (va_ws) { va_showMsg('(va_ws.readyState !== 1)=' + (va_ws.readyState !== 1), 'va_connectionWebSocket, check readyState'); } if (va_ws === undefined || va_ws.readyState !== 1) { va_ws = new WebSocket('wss://va.transglobe.com.tw/messaging'); // setTimeout(() => { // if (va_ws.readyState !== 1) { // showMsg('連線失敗', '初始化', true); // } // }, 3000); va_ws.onopen = function (message) { if (lastedText !== '' || lastedValue !== '') { va_sendWebSocket(lastedEventType, lastedType, lastedText, lastedValue, lastedData); } lastedEventType = ''; lastedText = ''; lastedType = ''; lastedValue = ''; lastedData = undefined; }; va_ws.onmessage = function (message) { receiverMsg(message); }; va_ws.onerror = function (event) { console.error(`WebSocket error: ${event}`); vajQuery('#circleG').remove(); lasteMsg = ''; va_inputMask = ''; va_changeInput(va_inputMask); if (va_onWsError) { va_onWsError(event); } }; va_ws.onclose = function (event) { console.info('WebSocket closed.'); vajQuery('#circleG').remove(); lasteMsg = ''; va_inputMask = ''; va_changeInput(va_inputMask); if (va_onWsClose) { va_onWsClose(event); } }; } } function receiverMsg(message) { setTimeout(function () { var data = JSON.parse(message.data); //check askTo if (data.extraInfo.askTo !== undefined) { va_askTo = data.extraInfo.askTo; } renderVaContent(data); va_rec = true; }, 200); } function va_extraInfoHandler(data) { if (data !== undefined && data.extraInfo !== undefined) { if (data.extraInfo.refNo !== undefined) { sessionStorage.setItem('refNo', data.extraInfo.refNo); } if (data.extraInfo.uid !== undefined) { sessionStorage.setItem('uid', data.extraInfo.uid); } if (va_processExtraInfo) { //各專案自行掛載 try { va_processExtraInfo(data); } catch (e) { va_showMsg('va_processExtraInfo exception'); va_showMsg(e); } } var text = ''; var lineToken = ''; var source = ''; const urlParams = new URLSearchParams(window.location.search); try { if (urlParams) { text = decodeURIComponent(escape(window.atob(decodeURIComponent(urlParams.get('text'))))); lineToken = urlParams.get('lineToken'); source = urlParams.get('source'); const obj = { question: text, lineToken: lineToken, source: source }; saveAutoAskingLog(obj); } } catch (e) { text = ''; } } } function renderVaContent(data, message) { if (message === undefined) { message = ''; } //檢查是否為文字客服 if (data.extraInfo.askTo === 'agent') { showStopTextServiceMsg(); } else { clearStopTextServiceMsg(); } setTimeout(function () { if (data && data.extraInfo && data.extraInfo.eventType === 'openForm' && !data.extraInfo.oaReturn) { vaOpenFormModal('hide'); } }, 1); var theEnd = false; if (data && data.extraInfo && data.extraInfo.eventType === 'openForm') { theEnd = va_openFormHandler(data); } else if (data && data.extraInfo && data.extraInfo.eventType === 'openModal') { theEnd = va_openModalHandler(data, message); } if (theEnd) { } else if (data && data.extraInfo && data.extraInfo.eventType === 'mute') { //回應:靜音 va_extraInfoHandler(data); } else if (data !== undefined && data.contents !== undefined) { lastReceiver = message; vajQuery.each(data.contents, function (i, item) { var rating = item.rating; // var rating = 'false'; if (singleSentenceSatisfy === 'hide') { rating = 'false'; } if (data.contents.length !== i + 1) { rating = 'false'; } var type = item.type; if (type === 'text') { if (item.payload.text !== '') { if (i === 0) { appendFirstDialog(i, item.payload.text, rating, data.extraInfo); } else if (i === data.contents.length - 1) { appendEndDialog(item.payload.text, rating, data.extraInfo.requestId); } else { appendDialog(item.payload.text, rating, data.extraInfo.requestId, data.extraInfo.eventType); } } } else if (type === 'slider') { appendSlider(i, item.payload.elements, rating, data.extraInfo); } else if (type === 'image') { appendImage(i, item.payload, rating, data.extraInfo); } else if (type === 'video') { appendVideoDialog(i, item.payload, rating, data.extraInfo.requestId); } va_sleep(10); }); va_disableInput = false; quickReplyAlign = 'left'; va_inputMask = ''; if (data !== undefined && data.web !== undefined) { if (data.web.disableInput !== undefined) { va_disableInput = data.web.disableInput; } if (data.web.quickReplyAlign !== undefined) { quickReplyAlign = data.web.quickReplyAlign; } if (data.web.inputMask !== undefined) { va_inputMask = data.web.inputMask; } if (data.web.inputType !== undefined) { if (!va_isReloadLog) { if (data.web.inputType !== '' && va_openForms.indexOf(data.web.inputType.split('|')[0]) >= 0) { if (data.extraInfo.uid !== undefined) { sessionStorage.setItem('uid', data.extraInfo.uid); } vaCreateModal(data.web.inputType, '', data.extraInfo.requestId); } } } va_extraWebHandler(data); } va_changeInput(va_inputMask); if (data !== undefined && data.quickReply !== undefined) { appendReply(data.quickReply.replies, data.extraInfo.requestId); } else { vajQuery('#quickReply').empty(); } va_disabledDialog(va_disableInput); va_extraInfoHandler(data); } vajQuery('#circleG').remove(); va_resetTimeout(); try { // eslint-disable-next-line no-undef // dynaGWS.Replay(); //20240716 更新難字 已無需重整 } catch (e) {} } function va_closeWebSocket() { if (va_ws !== undefined && va_ws.readyState === 1) { lastedText = ''; lastedValue = ''; lastedType = ''; lastedData = undefined; va_ws.close(); } } /* eslint-disable-next-line */ function checkChannel() { if (sessionStorage.getItem('channel') === 'APP') { invokeAppJs('VA trigger'); } } function va_sendWebSocket(inEventType, inType, inText, inValue, inData) { if (['input', 'menu', 'QR', 'Button'].includes(inEventType)) { sessionStorage.setItem('wholeSatisfactionSurvey', 'match'); sessionStorage.setItem('scrollButtom', 'true'); } var inLocation = '', inToken = '', inChannel = '', vaClient = '', refNo = ''; vaClient = '18.119.158.134'; if (sessionStorage.getItem('location') !== null) { inLocation = sessionStorage.getItem('location'); } if (sessionStorage.getItem('loginToken') !== null) { inToken = sessionStorage.getItem('loginToken'); } if (sessionStorage.getItem('channel') !== null) { inChannel = sessionStorage.getItem('channel'); } if (sessionStorage.getItem('vaClient') !== null) { vaClient = '18.119.158.134'; } if (sessionStorage.getItem('refNo') !== null) { refNo = sessionStorage.getItem('refNo'); } if (inChannel === undefined || inChannel === 'Null' || inChannel === '' || inChannel === null) { var data = JSON.parse('{"contents":[{"type":"text","payload":{"text":"很抱歉,網路連線異常,請重新整理或稍後再試,謝謝!"}, "rating": "false"}], "extraInfo":{}}'); renderVaContent(data); sessionStorage.removeItem('channel'); sessionStorage.removeItem('refNo'); } else { if (inValue === undefined || inValue === 'undefined') { inValue = ''; } if (inText === undefined) { inText = ''; } if (va_ws === undefined || va_ws.readyState !== 1) { va_connectionWebSocket(); lastedEventType = inEventType; lastedType = inType; lastedText = inText; lastedValue = inValue; lastedData = inData; } else { var sendDate = { eventType: inEventType, type: inType, text: inText, value: inValue, location: inLocation, token: inToken, channel: inChannel, vaClient: vaClient, refNo: refNo, data: inData, askTo: va_askTo }; sendDate = va_preSendWebSocket(sendDate); va_ws.send(JSON.stringify(sendDate)); if (inEventType === 'greeting') { appendWaittingDialog(false); } else if (!(inText === 'timeout' || va_excludeEventType.indexOf(inEventType) >= 0 || va_excludeEventType.indexOf(inValue) >= 0)) { appendWaittingDialog(true); } } } } function appendWaittingDialog(isButtom) { setTimeout(function () { let agentImg = ''; if (va_askTo !== undefined && va_askTo === 'agent') { agentImg = 'cbAgentImgDiv'; } vajQuery('#circleG').remove(); var dialog = "
"; dialog += "
"; dialog += "
"; dialog += "
"; dialog += "
"; dialog += "
"; dialog += '
'; appendComp(dialog); if (isButtom === true) { scrollBottom(); } $('.loaderMain').hide(); }, 100); } function checkSpecialChar(content) { var regexp = new RegExp(/\[@[\s\S]+?@\]/g); var matches = regexp.exec(content); if (matches === null) { //不符 } else { //符合 content = content.replace(/\[@/g, ''); } return content; } function appendComp(content, requestID) { if (requestID !== undefined) { content = replaceLink(content, requestID); } vajQuery('#quickReply').before(checkSpecialChar(content)); vajQuery('#quickReply') .prev('.cbIntent') .find('.satisfy') .bind('click', function (e) { vaCreateRatingModal(vajQuery(e.target).data('requestid')); }); } /** * 對話框(起始) */ function appendFirstDialog(i, content, rating, extraInfo) { let agentImg = ''; if (extraInfo === undefined) { extraInfo = {}; } else if (extraInfo.askTo === 'agent') { agentImg = 'cbAgentImgDiv'; } var dialog = "
"; if (i === 0) { dialog += "
"; } else { dialog += "
"; } dialog += "
"; dialog += jsonEscape(content); if (rating === 'false') { dialog += '
' + appendTime() + '
'; } else { dialog += '
' + appendTime() + ''; } appendComp(dialog, extraInfo.requestId); if (sessionStorage.getItem('scrollButtom') === 'true') { scrollBottom(); } else { $('.loaderMain').hide(); } } /** * 對話框(中間) * eventType for scrollbuttom */ function appendDialog(content, rating, requestID, eventType) { var dialog = "
"; dialog += "
"; dialog += "
"; dialog += jsonEscape(content); if (rating === 'false') { dialog += '
' + appendTime() + '
'; } else { dialog += '
' + appendTime() + ''; } appendComp(dialog, requestID); if (sessionStorage.getItem('scrollButtom') === 'true') { scrollBottom(); } else { $('.loaderMain').hide(); } } /** * 對話框(結束) */ function appendEndDialog(content, rating, requestID) { var dialog = "
"; dialog += "
"; dialog += "
"; dialog += jsonEscape(content); if (rating === 'false') { dialog += '
' + appendTime() + '
'; } else { dialog += '
' + appendTime() + ''; } appendComp(dialog, requestID); scrollBottom(); } /** * 對話框(發問) */ function appendQuery(content) { if (content !== undefined && content !== null && content !== '') { vajQuery('#quickReply').empty(); var dialog = "
"; dialog += appendTime() + "
"; dialog += "
"; dialog += content; dialog += '
'; appendComp(dialog); scrollBottom(); va_resetTimeout(); // vajQuery('#boxInfo3').show(); } } /** * 對話框(按鈕) */ function appendReply(content, requestId) { vajQuery('#quickReply').empty(); var dialog = ''; dialog += "
"; for (var i = 0; i < content.length; i++) { dialog += "= 0) { window.location.href = event.target.dataset.value; } else { window.open(event.target.dataset.value); } } else { window.open(event.target.dataset.value); } } } else if (event.target.dataset.value === '//logout') { if (sessionStorage.getItem('wholeSatisfactionSurvey') === 'match') { vaWholeSatisfactionSurvey(sessionStorage.getItem('uid'), 1, {}); } else { quickReplyAlign = 'left'; vaTriggerOpen(true); va_sendWebSocket('logout', 'text', 'logout', ''); // va_closeWebSocket(); if (sessionStorage.getItem('loginToken') !== undefined) { sessionStorage.removeItem('loginToken'); } if (sessionStorage.getItem('refNo') !== undefined) { sessionStorage.removeItem('refNo'); } if (sessionStorage.getItem('scrollButtom') !== undefined) { sessionStorage.removeItem('scrollButtom'); } setTimeout(function () { clearMaintainMsg(); vajQuery('.cbIntent').remove(); vajQuery('.cbQDiv').remove(); appendQuery('登出'); va_askTo = 'watson'; va_sendWebSocket('greeting', 'postback', '', va_greeting); vajQuery('#quickReply').empty(); }, 1000); } } else if (event.target.dataset.value === 'continue') { appendQuery(event.target.text); //va_sendWebSocket(event.target.dataset.type, event.target.text, event.target.dataset.value); receiverMsg(lastReceiver); } else if (event.target.dataset.value.indexOf('.html') >= 0) { saveWebChatLog(event); openQrModal(event.target.dataset.value); vajQuery('#quickReply').empty(); } else if (va_openForms.indexOf(event.target.dataset.value.split('|')[0]) >= 0) { saveWebChatLog(event); vaCreateModal(event.target.dataset.value, event.target.text, event.target.requestid); } else { saveWebChatLog(event); if (event.target.dataset.type === 'text') { appendQuery(event.target.dataset.value); } else { appendQuery(event.target.text); } va_sendWebSocket('QR', event.target.dataset.type, event.target.text, event.target.dataset.value); vajQuery('#quickReply').empty(); } } }); vajQuery('#reply-control-left').bind('click', function (event) { vajQuery('#reply-Div') .stop() .animate({ scrollLeft: vajQuery('#reply-Div').scrollLeft() - 100 }); }); vajQuery('#reply-control-right').bind('click', function (event) { vajQuery('#reply-Div') .stop() .animate({ scrollLeft: vajQuery('#reply-Div').scrollLeft() + 100 }); }); scrollBottom(); } vajQuery('#quickReply').bind('mouseenter touchstart', function (event) { if (document.getElementById('reply-Div') !== undefined) { if (vajQuery('#reply-Div').prop('scrollWidth') !== undefined) { if (vajQuery('#quickReply').width() < document.getElementById('reply-Div').scrollWidth) { vajQuery('#reply-control-left').toggle(true); vajQuery('#reply-control-right').toggle(true); } } } }); vajQuery('#quickReply').bind('mouseleave touchend', function (event) { vajQuery('#reply-control-left').toggle(false); vajQuery('#reply-control-right').toggle(false); }); /** * 對話框(Slider) */ function appendSlider(i, content, rating, extraInfo) { var name = genSliderName(); var iName = 'Intent_' + name; let agentImg = ''; if (extraInfo === undefined) { extraInfo = {}; } else if (extraInfo.askTo === 'agent') { agentImg = 'cbAgentImgDiv'; } var dialog = "
"; if (i === 0) { if (content.length > 1) { dialog += "
"; } else { dialog += "
"; } } else { dialog += "
"; } dialog += "
"; if (content.length > 1) { dialog += ''; } var hasImage = false; dialog += "
"; var textMax = ''; var tt_titleMax = ''; var tt_textMax = ''; var buttonMax = 0; for (i = 0; i < content.length; i++) { if (i === 0) { dialog += "
"; } else { dialog += "
"; } dialog += "
"; if (vajQuery.trim(content[i].imageUrl) !== '') { hasImage = true; // dialog += "
0) { dialog += "
"; } else { dialog += "
"; } } dialog += "
"; var tt = ''; tt += "
"; tt += jsonEscape(content[i].title); tt += '
'; if (va_getByteLength(tt_titleMax) < va_getByteLength(jsonUnEscape(content[i].title))) { tt_titleMax = jsonUnEscape(content[i].title); } if (vajQuery.trim(content[i].text) !== '') { tt += "
"; tt += jsonEscape(content[i].text); tt += '
'; if (va_getByteRow(tt_textMax) <= va_getByteRow(jsonUnEscape(content[i].text))) { tt_textMax = jsonUnEscape(content[i].text); } } else { tt += "
"; tt += '
'; } dialog += tt; dialog += "
"; dialog += tt; dialog += '
'; } else { if (vajQuery.trim(content[i].imageUrl) !== '') { if (vajQuery.trim(content[i].text) !== '') { if (va_getByteLength(textMax) < va_getByteLength(jsonUnEscape(content[i].text))) { textMax = jsonUnEscape(content[i].text); } dialog += "
"; dialog += "
"; dialog += jsonEscape(content[i].text); dialog += '
'; dialog += "
"; dialog += jsonEscape(content[i].text); dialog += '
'; dialog += '
'; } } else { if (vajQuery.trim(content[i].text) !== '') { if (va_getByteLength(textMax) < va_getByteLength(jsonUnEscape(content[i].text))) { textMax = jsonUnEscape(content[i].text); } dialog += "
"; dialog += "
"; dialog += jsonEscape(content[i].text); dialog += '
'; dialog += "
"; dialog += jsonEscape(content[i].text); dialog += '
'; dialog += '
'; } } } if (content[i].buttons !== undefined && content[i].buttons.length > 0) { if (buttonMax < content[i].buttons.length) { buttonMax = content[i].buttons.length; } for (var b = 0; b < content[i].buttons.length; b++) { if (content[i].buttons[b].type === 'url') { dialog += "'; } else if (content[i].buttons[b].type === 'location') { dialog += "'; } else if (content[i].buttons[b].type === 'phoneNumber') { dialog += "'; } else if (content[i].buttons[b].type === 'openForm') { dialog += "'; } else { dialog += "'; } } } if (rating === 'false') { dialog += '
'; } else { dialog += '
'; } } dialog += '
'; if (content.length > 1) { dialog += ''; } dialog += '
'; appendComp(dialog, extraInfo.requestId); vajQuery('#' + name) .find('.slider-a') .bind('click', function (event) { if (va_askTo === 'agent') { vaEndTextServiceModal(event); } else { if (event.target.dataset.type === 'phoneNumber') { saveWebChatLog(event); } else if (event.target.dataset.type === 'url') { var clickProcess = ''; if (va_applyUrlClick) { clickProcess = va_applyUrlClick(event.target.dataset.value, event); } if (clickProcess === '') { saveWebChatLog(event); if (event.target.dataset.value.target !== undefined && event.target.dataset.value.target !== '') { if (event.target.dataset.value.target.indexOf(sessionStorage.getItem('channel')) >= 0) { window.location.href = event.target.dataset.value; } else { window.open(event.target.dataset.value); } } else { window.open(event.target.dataset.value); } } } else if (event.target.dataset.type === 'openForm') { vaOpenForm(event); } else if (event.target.dataset.type !== 'url' && event.target.dataset.type !== 'location' && event.target.dataset.type !== 'phoneNumber') { if (event.target.dataset.value.indexOf('C:F00_要求_轉接文字客服') >= 0) { vaConnectTextService(); } saveWebChatLog(event); appendQuery(event.target.text); va_sendWebSocket('Button', event.target.dataset.type, event.target.text, event.target.dataset.value); } else if (event.target.dataset.type === 'location') { mapPostbackVal = event.target.dataset.value; } // if (event.target.dataset.type !== 'url' && event.target.dataset.type !== 'location' && event.target.dataset.type !== 'phoneNumber') { // appendQuery(event.target.text); // va_sendWebSocket('Button', event.target.dataset.type, event.target.text, event.target.dataset.value); // } else { // mapPostbackVal = event.target.dataset.value; // } } }); vajQuery('#' + name).bind('scroll touchmove touchend', function (event) { clearTimeout(va_timer); va_timer = setTimeout(function () { var offset = vajQuery('#' + name).scrollLeft(); if (offset <= 0) { vajQuery('#' + iName) .find('.left') .hide(); vajQuery('#' + iName) .find('.right') .show(); } else if (offset + vajQuery('#chatbotContent').width() + 5 >= vajQuery('#' + name)[0].scrollWidth) { vajQuery('#' + iName) .find('.left') .show(); vajQuery('#' + iName) .find('.right') .hide(); } else { vajQuery('#' + iName) .find('.left') .show(); vajQuery('#' + iName) .find('.right') .show(); } }, 100); }); vajQuery('#' + iName) .find('.operation') .bind('click', function (event) { event.preventDefault(); var op = vajQuery(this).data('operation') + 270; // var curLeft = vajQuery('#' + name).scrollLeft(); vajQuery('#' + name) .stop() .animate({ scrollLeft: op }); }); if (vajQuery('#chatbotContent').width() === vajQuery('#' + name)[0].scrollWidth) { vajQuery('#' + iName) .find('.left') .css('display', 'none'); vajQuery('#' + iName) .find('.right') .css('display', 'none'); } if (!hasImage) { vajQuery('#' + iName).removeClass('c_hidden'); } vajQuery('#' + name) .find('img') .first() .on('load', function () { vajQuery('#' + iName).removeClass('c_hidden'); vajQuery(this).removeClass('c_hidden'); if (sessionStorage.getItem('scrollButtom') === 'true') { scrollBottom(); } else { $('.loaderMain').hide(); } }); vajQuery('#' + name) .find('img') .on('error', function () { vajQuery('#' + iName).removeClass('c_hidden'); vajQuery(this).removeClass('c_hidden'); vajQuery(this).attr('alt', '圖片載入失敗...'); vajQuery(this).attr('src', 'https://va.transglobe.com.tw/api/sliderImg/web/notfound.png'); if (sessionStorage.getItem('scrollButtom') === 'true') { scrollBottom(); } else { $('.loaderMain').hide(); } }); setTimeout(function () { vajQuery('#' + name) .find('.tt.c_hidden') .find('.cttitle') .each(function () { var vajQuerythis = vajQuery(this); vajQuerythis.html(jsonEscape(tt_titleMax)); }); vajQuery('#' + name) .find('.tt.c_hidden') .find('.text') .each(function () { var vajQuerythis = vajQuery(this); vajQuerythis.html(jsonEscape(tt_textMax)); }); vajQuery('#' + name) .find('.text.c_hidden') .each(function () { var vajQuerythis = vajQuery(this); vajQuerythis.html(jsonEscape(textMax)); }); vajQuery('#' + name) .find('.singleText.c_hidden') .each(function () { var vajQuerythis = vajQuery(this); vajQuerythis.html(jsonEscape(textMax)); }); vajQuery('#' + name) .find('.rows') .each(function () { var vajQuerythis = vajQuery(this); var first = vajQuerythis.find('.slider-div').first(); var size = vajQuerythis.find('.slider-div').length; if (buttonMax > size) { for (var k = 0; k < buttonMax - size; k++) { first.before("
 
"); } } }); if (!hasImage) { if (sessionStorage.getItem('scrollButtom') === 'true') { scrollBottom(); } else { $('.loaderMain').hide(); } } }, 10); vajQuery('#' + name) .find('.map') .bind('click', function (event) { if (vajQuery('#modalMap').length > 0) { va_getlocation(); } else { var modalWindowMap = vajQuery(''); var modalDialogMap = vajQuery(''); var modalContentMap = vajQuery(''); var modalHeaderMap = vajQuery(''); var modalCloseMap = vajQuery(''); var modalTitleMap = vajQuery(''); var modalBodyMap = vajQuery(''); var modalMap = vajQuery('
'); var modalFooterMap = vajQuery( '' ); modalHeaderMap.append(modalCloseMap); modalHeaderMap.append(modalTitleMap); modalBodyMap.append(modalMap); modalContentMap.append(modalHeaderMap); modalContentMap.append(modalBodyMap); modalContentMap.append(modalFooterMap); modalDialogMap.append(modalContentMap); modalWindowMap.append(modalDialogMap); vajQuery('#ibmchatbox').after(modalWindowMap); vajQuery('#map_canvas').before(''); setTimeout(function () { va_initialize(); }, 1000); vajQuery('#myLocation').bind('click', function (event) { vajQuery('#myLocation').trigger('hover'); va_getlocation(); }); vajQuery('#cfmLocation').bind('click', function (event) { if (vajQuery.trim(vajQuery('#location').html()) === '') { alert('請點選地圖選擇您所在位置'); vajQuery('#cfmLocation').trigger('hover'); return false; } else { appendQuery(vajQuery('#address').html()); var n = mapPostbackVal.search('|'); if (n > 0) { va_sendWebSocket('location', 'postback', '', mapPostbackVal + ',' + vajQuery('#location').html() + ',addr:' + vajQuery('#address').html()); } else { va_sendWebSocket('location', 'postback', '', mapPostbackVal + '|' + vajQuery('#location').html() + ',addr:' + vajQuery('#address').html()); } } }); } chatbotModal('modalMap', 'show'); // vajQuery('#modalMap').modal(); }); } /** * 對話框(Image) */ function appendImage(i, content, rating, extraInfo) { var name = genSliderName(); var iName = 'Intent_' + name; let agentImg = ''; if (extraInfo === undefined) { extraInfo = {}; } else if (extraInfo.askTo === 'agent') { agentImg = 'cbAgentImgDiv'; } const linkStr = content.link ? `'${content.link}'` : ''; const dialog = `
${content.imageName}
`; appendComp(dialog); vajQuery('#' + name) .find('img') .first() .on('load', function () { vajQuery('#' + iName).removeClass('c_hidden'); vajQuery(this).removeClass('c_hidden'); if (sessionStorage.getItem('scrollButtom') === 'true') { scrollBottom(); } else { $('.loaderMain').hide(); } }); vajQuery('#' + name) .find('img') .on('error', function () { vajQuery('#' + iName).removeClass('c_hidden'); vajQuery(this).removeClass('c_hidden'); vajQuery(this).attr('alt', '圖片載入失敗...'); if (sessionStorage.getItem('scrollButtom') === 'true') { scrollBottom(); } else { $('.loaderMain').hide(); } }); } /** * 對話框(時間) */ function appendTime() { var dialog = "
"; dialog += new Date().getHours() < 10 ? '0' + new Date().getHours() : new Date().getHours(); dialog += ':'; dialog += new Date().getMinutes() < 10 ? '0' + new Date().getMinutes() : new Date().getMinutes(); dialog += '
'; return dialog; } function genSliderName() { var dateObj = new Date(); var name = 'Slider' + dateObj.getHours() + '' + dateObj.getMinutes() + '' + dateObj.getSeconds() + '' + dateObj.getMilliseconds(); return name; } //這裡是設定session timeout倒數時間 function va_setTimer() { var seconds = 15; var reminder = 10; //var seconds = 3; //var reminder = 1; //實際重複執行的倒數方法 var interval = setInterval(function () { va_sessionTime++; if (va_sessionTime < seconds) { //跳出視窗提醒他 if (va_sessionTime === reminder) { vaTriggerOpen(true); var content = JSON.parse('[{"label":"繼續使用","value":"continue"}, {"label":"離開","value":"//logout","type":"text"}]'); quickReplyAlign = 'center'; appendFirstDialog(0, '閒置時間超過10分鐘,是否繼續使用?', 'false'); appendReply(content); } } else { clearInterval(interval); //清除此倒數方法 va_intervalObj = null; va_clearSession(); //清除該使用者session //transfer back to watson if (va_askTo === 'agent') { va_askTo = 'watson'; } } }, 60000); //設定每分鐘執行 return interval; } //如果使用者點擊了提示視窗欲重整timeout時間,便執行此方法,事實上只是發送request請求到server以重新計算時間 function va_resetTimeout() { va_sessionTime = 0; va_wsSessionTime = 0; if (va_intervalObj !== null || va_intervalObj !== undefined) { clearInterval(va_intervalObj); va_intervalObj = null; } if (va_wsIntervalObj !== null || va_wsIntervalObj !== undefined) { clearInterval(va_wsIntervalObj); va_wsIntervalObj = null; } va_resetTimeout_extra(); } function va_setCloseTimer() { var vaColseTimer = 5; // var seconds = 1; var interval = setInterval(function () { va_wsSessionTime++; if (va_wsSessionTime >= vaColseTimer) { clearInterval(va_wsIntervalObj); //清除此倒數方法 va_wsIntervalObj = null; vaTriggerOpen(true); // va_sendWebSocket('timeout', 'text', 'timeout', ''); va_closeWebSocket(); if (sessionStorage.getItem('refNo') !== undefined) { sessionStorage.removeItem('refNo'); } if (sessionStorage.getItem('scrollButtom') !== undefined) { sessionStorage.removeItem('scrollButtom'); } vajQuery('.cbIntent').remove(); vajQuery('.cbQDiv').remove(); if (va_askTo === 'agent') { clearStopTextServiceMsg(); appendFirstDialog(0, '你已結束與文字客服對話,祝你順心,接下來由智能客服' + webBotSettings.botName + '為你服務!', 'false'); } else { appendFirstDialog(0, '因閒置時間超過五分鐘,系統自動清除對話。如果您有任何疑問,請您重新提問喔!', 'false'); } va_askTo = 'watson'; vajQuery('#quickReply').empty(); va_inputMask = ''; va_changeInput(va_inputMask); vajQuery('#circleG').remove(); // vajQuery('#boxInfo3').hide(); // getRefNo(false); } }, 60000); //設定每分鐘執行 return interval; } //清除使用者session使用的方法 function va_clearSession() { clearInterval(va_intervalObj); vaTriggerOpen(true); // vajQuery('#chatbotContent').empty(); va_sendWebSocket('timeout', 'text', 'timeout', ''); // va_closeWebSocket(); vajQuery('.cbIntent').remove(); vajQuery('.cbQDiv').remove(); if (sessionStorage.getItem('loginToken') !== undefined) { sessionStorage.removeItem('loginToken'); } if (sessionStorage.getItem('refNo') !== undefined) { sessionStorage.removeItem('refNo'); } if (sessionStorage.getItem('scrollButtom') !== undefined) { sessionStorage.removeItem('scrollButtom'); } vajQuery('#boxSignOut').hide(); appendFirstDialog(0, '因操作逾時,系統已自動登出。如果您有任何疑問,請您重新提問喔!', 'false'); // vajQuery('#boxInfo3').hide(); //vajQuery('.reply-Div').remove(); if (vajQuery('.loginModalDialog').length !== 0) { vajQuery('.loginModalDialog').hide(); } if (vajQuery('.openFormBackdrop').length !== 0) { vajQuery('.openFormBackdrop').hide(); } if (vajQuery('.chatbotModal').length !== 0) { vajQuery('.chatbotModal').hide(); } if (vajQuery('.chatbotModalBackdrop').length !== 0) { vajQuery('.chatbotModalBackdrop').hide(); } if (vajQuery('.birthdayCelebrationModalBackdrop').length !== 0) { vajQuery('.birthdayCelebrationModalBackdrop').hide(); } vajQuery('#quickReply').empty(); va_inputMask = ''; va_changeInput(va_inputMask); vajQuery('#circleG').remove(); // getRefNo(false); } function va_changeInput(input) { if (input === 'id' || input === 'all') { vajQuery('#cbSecInput').show(); vajQuery('#cbInput').hide(); } else { vajQuery('#cbInput').show(); vajQuery('#cbSecInput').hide(); } //vajQuery('#cbInput').val(''); vajQuery('#cbSecInput').val(''); } function va_disabledDialog(disabled) { if (disabled === true || disabled === 'true') { vajQuery('#cbSend').attr('disabled', 'disabled'); vajQuery('#cbInput').attr('disabled', 'disabled'); } else { vajQuery('#cbSend').removeAttr('disabled'); vajQuery('#cbInput').removeAttr('disabled'); } } function jsonUnEscape(str) { if (str !== undefined) { return str.replace(/</g, '<').replace(/>/g, '>').replace(/'/g, "'").replace(/(/g, '(').replace(/)/g, ')').replace('/&/g', '&'); } else { return ''; } } function jsonEscape(str) { if (str !== undefined) { str = str.replace(//g, '>').replace(/'/g, ''').replace(/\(/g, '(').replace(/\)/g, ')').replace('/&(?!amp;|quot;|gt;|lt;|#39;|#40;|#41;)/g', '&').replace(/\r\n/g, '
'); return str; } else { return ''; } } function replaceLink(str, requestID) { var data = str; var i = 0; var regex = new RegExp(/\.:\.LS\.(.*?)\.LE\.:\./g); var matches = str.match(regex); if (matches) { matches.forEach(function (element) { var linkLabel = element.substr(6, element.indexOf('=', i) - 6); var linkHref = element.substr(element.indexOf('=', i) + 1, element.length - element.indexOf('=', i) - 7); var link = ''; link += '"; link += linkLabel; link += ''; data = data.substr(0, data.indexOf(element)) + link + data.substr(data.indexOf(element) + element.length); }); } return data; } /* eslint-disable-next-line */ function activeReply(obj) { appendQuery(obj.label); vajQuery('#quickReply').empty(); } function handleNoGeolocation(errorFlag) { document.getElementById('location').innerHTML = ''; if (errorFlag === true) { document.getElementById('address').innerHTML = '地圖定位失敗,請點選地圖選擇您所在位置'; } else { document.getElementById('address').innerHTML = '您的瀏覽器不支援定位服務,請點選地圖選擇您所在位置'; } va_initialLocation = va_taipei; va_map.setCenter(va_initialLocation); if (va_marker !== false) { va_marker.setMap(null); va_marker = false; } } function va_initialize() { var myOptions = { zoom: 14, zoomControl: false, mapTypeId: google.maps.MapTypeId.ROADMAP, mapTypeControl: false, scaleControl: false, streetViewControl: false, rotateControl: false, fullscreenControl: false }; va_map = new google.maps.Map(document.getElementById('map_canvas'), myOptions); va_geocoder = new google.maps.Geocoder(); // Try W3C Geolocation (Preferred) if (navigator.geolocation) { va_browserSupportFlag = true; navigator.geolocation.getCurrentPosition( function (position) { va_initialLocation = {lat: position.coords.latitude, lng: position.coords.longitude}; va_map.setCenter(va_initialLocation); va_marker = new google.maps.va_marker({ position: va_initialLocation, map: va_map, title: '目前所在位置' }); document.getElementById('location').innerHTML = 'lng:' + va_initialLocation.lng + ',lat:' + va_initialLocation.lat; va_geocoder.geocode({location: va_initialLocation}, function (results, status) { if (status === 'OK') { if (results[0]) { document.getElementById('address').innerHTML = results[0].formatted_address; } else { window.alert('No results found'); } } else { window.alert('Geocoder failed due to: ' + status); } }); }, function () { handleNoGeolocation(va_browserSupportFlag); } ); } else { // Browser doesn't support Geolocation va_browserSupportFlag = false; handleNoGeolocation(va_browserSupportFlag); } google.maps.event.addListener(va_map, 'click', function (event) { //Get the location that the user clicked. var clickedLocation = event.latLng; //If the marker hasn't been added. if (va_marker === false) { //Create the marker. va_marker = new google.maps.Marker({ position: clickedLocation, map: va_map, draggable: true //make it draggable }); //Listen for drag events! //google.maps.event.addListener(marker, 'dragend', function(event){ //markerLocation(); //}); } else { //Marker has already been added, so just change its location. va_marker.setPosition(clickedLocation); } va_geocoder.geocode({location: clickedLocation}, function (results, status) { if (status === 'OK') { if (results[0]) { document.getElementById('address').innerHTML = results[0].formatted_address; document.getElementById('location').innerHTML = 'lng:' + clickedLocation.lng() + ',lat:' + clickedLocation.lat(); } else { window.alert('No results found'); } } else { window.alert('Geocoder failed due to: ' + status); } }); //Get the marker's location. //markerLocation(); }); } /* eslint-disable-next-line */ function codeAddress() { var address = document.getElementById('address').innerHTML; va_geocoder.geocode({address: address}, function (results, status) { if (status === 'OK') { va_map.setCenter(results[0].geometry.location); //If the marker hasn't been added. if (va_marker === false) { //Create the marker. va_marker = new google.maps.Marker({ position: results[0].geometry.location, map: va_map, draggable: true //make it draggable }); //Listen for drag events! //google.maps.event.addListener(marker, 'dragend', function(event){ //markerLocation(); //}); } else { //Marker has already been added, so just change its location. va_marker.setPosition(results[0].geometry.location); } } else { alert('Geocode was not successful for the following reason: ' + status); } }); } function va_getlocation() { if (navigator.geolocation) { va_browserSupportFlag = true; navigator.geolocation.getCurrentPosition( function (position) { va_initialLocation = {lat: position.coords.latitude, lng: position.coords.longitude}; va_map.setCenter(va_initialLocation); if (va_marker === false) { //Create the marker. va_marker = new google.maps.Marker({ position: va_initialLocation, map: va_map, title: '目前所在位置' }); } else { //Marker has already been added, so just change its location. va_marker.setPosition(va_initialLocation); } document.getElementById('location').innerHTML = 'lng:' + va_initialLocation.lng + ',lat:' + va_initialLocation.lat; va_geocoder.geocode({location: va_initialLocation}, function (results, status) { if (status === 'OK') { if (results[0]) { document.getElementById('address').innerHTML = results[0].formatted_address; } else { window.alert('No results found'); } } else { window.alert('Geocoder failed due to: ' + status); } }); }, function () { handleNoGeolocation(va_browserSupportFlag); } ); } else { // Browser doesn't support Geolocation va_browserSupportFlag = false; handleNoGeolocation(va_browserSupportFlag); } } function GetURLParameter(sParam) { var queryString = ''; try { // queryString = atob(window.location.search.substring(1)); queryString = window.location.search.substring(1); } catch (e) {} var sPageURL = decodeURI(queryString); var sURLVariables = sPageURL.split('&'); for (var i = 0; i < sURLVariables.length; i++) { var sParameterIndex = sURLVariables[i].search('='); var sParameterName = sURLVariables[i].substr(0, sParameterIndex); if (sParameterName === sParam) { return sURLVariables[i].substr(sParameterIndex + 1); } } } function scrollBottom() { if (va_isReloadLog !== true && va_scrollCount >= va_reloadLog) { vajQuery('#ctContent').animate( { scrollTop: vajQuery('#ctContent')[0].scrollHeight }, 500 ); setTimeout(function () { if (vajQuery('.openForm').hasClass('in')) { } else { $('.loaderMain').hide(); } }, 500); } else { va_scrollCount++; } } function va_escapeHtml(unsafe) { return va_fullToHalf(unsafe).replace(//g, '>').replace(/"/g, '"').replace(/'/g, ''').replace(/\(/g, '(').replace(/\)/g, ')').replace('/&(?!amp;|quot;|gt;|lt;|#39;|#40;|#41;)/g', '&'); } function va_fullToHalf(val) { var v = val; if (v === 'NaN' || v === null || v === '' || v === undefined) { return ''; } else { //全行轉半型 var result = ''; for (var i = 0; i < v.length; i++) { if (v.charCodeAt(i) === 12288) { result += ' '; } else { if (v.charCodeAt(i) > 65280 && v.charCodeAt(i) < 65375) { result += String.fromCharCode(v.charCodeAt(i) - 65248); } else { result += String.fromCharCode(v.charCodeAt(i)); } } } v = result; return v; } } function openQrModal(url) { if (vajQuery('#qrModal').length > 0) { vajQuery('#qrModal').remove(); } var modalWindow = vajQuery(''); var modalDialog = vajQuery(''); var modalContent = vajQuery(''); var modalBody = vajQuery(''); var modal = vajQuery(''); var param3 = GetQrParameter(url, 'param3'); var param5 = GetQrParameter(url, 'param5'); var param6 = GetQrParameter(url, 'param6'); var btn = ''; var modalFooter = vajQuery(btn); modalBody.append(modal); modalContent.append(modalBody); modalContent.append(modalFooter); modalDialog.append(modalContent); modalWindow.append(modalDialog); vajQuery('#ibmchatbox').after(modalWindow); chatbotModal('qrModal', 'show'); // vajQuery('#qrModal').modal(); vajQuery('#qrCfmBtn').bind('click', function (event) { appendQuery(event.target.dataset.label); va_sendWebSocket('Button', 'postback', event.target.dataset.label, event.target.dataset.value); }); } var va_inFrom; var va_inChannel; var va_inValue; var va_inUrl; /* eslint-disable-next-line */ function openPageBackModal(event, url) { if (url.indexOf('openPageBackModal|') === 0) { url = url.replace('openPageBackModal|', ''); } if (event) { saveWebChatLog(event); } if (vajQuery('#pagebackModal').length > 0) { vajQuery('#pagebackModal').remove(); } va_inFrom = GetPagebackUrl(url, 'param1'); va_inChannel = GetPagebackUrl(url, 'param2'); va_inValue = GetPagebackUrl(url, 'param3'); va_inUrl = GetPagebackUrl(url, 'param4'); if (va_inUrl.indexOf('.pdf') >= 0) { va_inUrl = 'https://va.transglobe.com.tw/pdfViewer/web/viewer.html?file=' + va_inUrl + '#page=1'; } var modalWindow = vajQuery(''); var modalDialog = vajQuery(''); var modalContent = vajQuery(''); var modalBody = vajQuery(''); var modal = vajQuery(''); var modalFooter = vajQuery( '' ); modalBody.append(modal); modalContent.append(modalBody); modalContent.append(modalFooter); modalDialog.append(modalContent); modalWindow.append(modalDialog); vajQuery('#ibmchatbox').after(modalWindow); var docName = va_inUrl.substring(va_inUrl.lastIndexOf('/') + 1); vajQuery('#pbkCfmBtn').bind('click', function (event) { var vaClient = ''; if (sessionStorage.getItem('vaClient') !== undefined) { vaClient = '18.119.158.134'; } va_sendWebSocket('Button', 'pageback', '條款同意書', va_inValue, {url: docName}); chatbotModal('pagebackModal', 'hide'); }); chatbotModal('pagebackModal', 'show'); } var va_inChangeUrl; //變更聲明書 function openChangDeclaration(event, url) { if (url.indexOf('openChangDeclaration|') === 0) { url = url.replace('openChangDeclaration|', ''); } if (event) { saveWebChatLog(event); } if (vajQuery('#changDeclaration').length > 0) { vajQuery('#changDeclaration').remove(); } va_inChangeUrl = url.split('url:')[1]; if (va_inChangeUrl.indexOf('.pdf') >= 0) { va_inChangeUrl = 'https://va.transglobe.com.tw/pdfViewer/web/viewer.html?file=' + va_inChangeUrl + '#page=1'; } var modalWindow = vajQuery(''); var modalDialog = vajQuery(''); var modalContent = vajQuery(''); var modalBody = vajQuery(''); var modal = vajQuery(''); var modalFooter = vajQuery( '' ); modalBody.append(modal); modalContent.append(modalBody); modalContent.append(modalFooter); modalDialog.append(modalContent); modalWindow.append(modalDialog); vajQuery('#ibmchatbox').after(modalWindow); chatbotModal('pagebackModal', 'show'); vajQuery('#pbkCfmBtn').bind('click', function (event) { try { var vaClient = ''; if (sessionStorage.getItem('vaClient') !== undefined) { vaClient = '18.119.158.134'; } $('.loaderMain').show(); va_sendWebSocket('openForm', 'formback', vajQuery(event.target).data('text'), 'getPolicyChangeList', ''); chatbotModal('pagebackModal', 'hide'); } catch (e) { $('.loaderMain').hide(); } }); vajQuery('#pbkCancelBtn').bind('click', function (event) { var vaClient = ''; if (sessionStorage.getItem('vaClient') !== undefined) { vaClient = '18.119.158.134'; } va_sendWebSocket('cancel', 'postback', '', 'F12_保單基本資料變更_取消'); chatbotModal('pagebackModal', 'hide'); }); } function GetPagebackUrl(url, sParam) { var queryString = ''; try { var sPageURL = decodeURI(url); var sURLVariables = sPageURL.split('&'); for (var i = 0; i < sURLVariables.length; i++) { var sParameterIndex = sURLVariables[i].search('='); var sParameterName = sURLVariables[i].substr(0, sParameterIndex); if (sParameterName === sParam) { return sURLVariables[i].substr(sParameterIndex + 1); } } } catch (e) {} } function GetPagebackParameter(url, sParam) { var queryString = ''; try { queryString = atob(url.split('?')[1]); var sPageURL = decodeURI(queryString); var sURLVariables = sPageURL.split('&'); for (var i = 0; i < sURLVariables.length; i++) { var sParameterIndex = sURLVariables[i].search('='); var sParameterName = sURLVariables[i].substr(0, sParameterIndex); if (sParameterName === sParam) { return sURLVariables[i].substr(sParameterIndex + 1); } } } catch (e) {} } function vaLogout() { vajQuery('#quickReply').empty(); quickReplyAlign = 'left'; // vaTriggerOpen(true); va_sendWebSocket('logout', 'text', '//clear', ''); // va_closeWebSocket(); if (sessionStorage.getItem('loginToken') !== undefined) { sessionStorage.removeItem('loginToken'); } if (sessionStorage.getItem('refNo') !== undefined) { sessionStorage.removeItem('refNo'); } if (sessionStorage.getItem('scrollButtom') !== undefined) { sessionStorage.removeItem('scrollButtom'); } if (va_askTo === 'agent' && sessionStorage.getItem('channel') === 'CSIS') { sessionStorage.setItem('closeAgent', 'true'); } // vajQuery('#boxSignOut').hide(); setTimeout(function () { clearMaintainMsg(); vajQuery('.cbIntent').remove(); vajQuery('.cbQDiv').remove(); appendFirstDialog(0, '重新載入對話完成\r\n請重新輸入您的問題', 'false'); // getRefNo(false); va_sendWebSocket('greeting', 'postback', '', va_greeting); va_inputMask = ''; va_changeInput(va_inputMask); vajQuery('#quickReply').empty(); }, 1000); } function GetQrParameter(url, sParam) { var sPageURL = url.split('?')[1]; var sURLVariables = sPageURL.split('&'); for (var i = 0; i < sURLVariables.length; i++) { var sParameterIndex = sURLVariables[i].search('='); var sParameterName = sURLVariables[i].substr(0, sParameterIndex); if (sParameterName === sParam) { return sURLVariables[i].substr(sParameterIndex + 1); } } } function chatbotModal(id, action) { try { if (action === 'show') { vajQuery('#' + id).modal({backdrop: 'static', keyboard: false}); } else { vajQuery('#' + id).modal(action); } } catch (e) { $('#' + id).modal(action); } } function vaOpenFormModal(action) { try { vajQuery('.openForm').modal(action); $('.loaderMain').hide(); if (action === 'hide') { va_openForm = ''; } } catch (e) { $('.openForm').modal(action); } } function vaDisplay(status) { if (status === true || status === 'true') { if (va_display_status === true || va_display_status === 'true') { vajQuery('#ibmchatbox').show(); } } else { vajQuery('#chatbotBtnHello').hide(); vajQuery('#ibmchatbox').hide(); } } function chatbotHtmlInit() { forChatBotHtml(); rmBoxClose(); vaChangeSizeMaxTrigger(); } function checkAutoAsk() { const urlParams = new URLSearchParams(window.location.search); var text = ''; var lineToken = ''; var source = ''; try { if (urlParams.get('text') !== undefined && urlParams.get('text') !== null && urlParams.get('text') !== '') { text = decodeURIComponent(escape(window.atob(decodeURIComponent(urlParams.get('text'))))); lineToken = urlParams.get('lineToken'); source = urlParams.get('source'); if (text !== undefined && text !== null && text !== '') { appendQuery(text); va_sendWebSocket('QR', 'text', text, text); isNeedSaveAutoAskingLog = true; } const obj = { question: text, lineToken: lineToken, source: source }; saveAutoAskingLog(obj); } } catch (e) { text = ''; console.error(e); } } function vaChangeSizeMaxTrigger() { vajQuery('#ibmchat').addClass('chatbotDivMax'); vajQuery('#ctContent').addClass('ctContentMax'); vajQuery('#cbInput').addClass('cbFooter2Max'); vajQuery('#cbSecInput').addClass('cbFooter2Max'); vajQuery('#boxMaximize').toggle(false); vajQuery('#boxRestore').toggle(true); vajQuery('body').addClass('no-scroll'); if (sessionStorage.getItem('scrollButtom') === 'true') { scrollBottom(); } else { $('.loaderMain').hide(); } changeSize(); //set menu width vajQuery('.chatbotFooter .ctMenu-list').addClass('menuMax'); //set maintainMsg,stopTextServiceMsg width vajQuery('#maintainMsg').css('max-width', '100%'); vajQuery('.ibm-va .stopTextServiceMsg').css('max-width', '100%'); vajQuery('.ibm-va .maintainMsg').css('flex-direction', 'column'); } function changeSize() { vajQuery('[id^=Intent_Slider]').each(function () { var vajQuerythis = vajQuery(this); coverIt(vajQuerythis); }); } function coverIt(div) { var slider = div.find('[id^=Slider]'); var offset = slider.scrollLeft(); if (vajQuery('#chatbotContent').width() === slider[0].scrollWidth) { div.find('.left').css('display', 'none'); div.find('.right').css('display', 'none'); } else if (offset <= 0) { div.find('.left').hide(); div.find('.right').show(); } else if (offset + vajQuery('#chatbotContent').width() + 5 > slider[0].scrollWidth) { div.find('.left').show(); div.find('.right').hide(); } else { div.find('.left').show(); div.find('.right').show(); } } function rmBoxClose() { vajQuery('#boxclose').remove(); vajQuery('#boxRestore').remove(); vajQuery('#boxMaximize').remove(); } function getTheAutoCompleteList() { var autoCompleteList = []; var listMaxSize = 0; vajQuery .ajax({ url: 'https://va.transglobe.com.tw/api/getTheAutoCompleteListIsValid', type: 'GET', cache: false, datatype: 'json' }) .done(function (res) { if (res) { res = JSON.parse(res); autoCompleteList = res.autoCompleteList; if (autoCompleteList) { autoCompleteList.sort((a, b) => +a.sort - +b.sort); } listMaxSize = res.listMaxSize; autocomplete(document.getElementById('cbInput'), autoCompleteList, listMaxSize); } }) .fail(function (res) {}); } function forChatBotHtml() { vajQuery('#ibmchatbox').removeClass('welcomeDiv'); sessionStorage.setItem('vaWelcome', 'true'); getRefNoLog(va_init); getTheAutoCompleteList(); if (vajQuery(window).height() < 420 || vajQuery(window).width() < 568) { vajQuery('body').addClass('no-scroll'); } vaTriggerOpen(); vajQuery('#cbEye').toggle(false); if (va_isReloadLog === false && sessionStorage.getItem('scrollButtom') === 'true') { scrollBottom(); } else { $('.loaderMain').hide(); } changeSize(); } function appendFirstDialogFromAPI(inputString) { if (inputString === '') { va_sendWebSocket('greeting', 'postback', '', va_greeting); } else { va_sendWebSocket('greeting', 'postback', '', va_greeting); } } function vaTriggerClick() { $('#vaChatbox').trigger('click'); } function vaTriggerOpen(open) { $('#ibmchat').toggle(open); vaDisplay(!$('#ibmchat').is(':visible')); } function va_getByteLength(data) { var arr = data.match(/[^\x00-\xff]/gi); return arr === null ? data.length : data.length + arr.length; } function va_getByteRow(data) { let num = data.split('\r\n').length; data.split('\r\n').forEach(function (element) { if (element.length > 18) { num += Math.floor(element.length / 19); } }); return num; } function va_sleep(milliseconds) { var start = new Date().getTime(); for (var i = 0; i < 1e7; i++) { if (new Date().getTime() - start > milliseconds) { break; } } } /* eslint-disable-next-line */ function triggerVa(input, value) { try { if (va_rec) { vaTriggerOpen(true); input = va_escapeHtml(input); value = va_escapeHtml(value); appendQuery(input); va_sendWebSocket('link', 'postback', input, value); } else { vaTriggerClick(); va_checkTriggerClick(input, value); } } catch (e) { console.error(e); } } function va_checkTriggerClick(input, value) { if (va_rec) { input = va_escapeHtml(input); value = va_escapeHtml(value); appendQuery(input); va_sendWebSocket('link', 'postback', input, value); } else { setTimeout(function () { va_checkTriggerClick(input, value); }, 1000); } } function va_preloader(imgs) { try { var hostImages = 'https://va.transglobe.com.tw/webChat/images/'; imgs.forEach(function (img) { if (document.images) { var img1 = new Image(); img1.src = hostImages + img; } }); } catch (e) { console.error(e); } } function createPIPInfoModal() { if (vajQuery('#boxInfoModal').length > 0) { vajQuery('#boxInfoModal').remove(); } var modalWindow = vajQuery(''); var modalDialog = vajQuery(''); var modalContent = vajQuery(''); var modalHeader = vajQuery(''); var modalClose = vajQuery(''); var modalTitle = vajQuery(''); var modalBody = vajQuery(''); var modal = vajQuery(''); modalBody.append(modal); modalHeader.append(modalClose); modalHeader.append(modalTitle); modalContent.append(modalHeader); modalContent.append(modalBody); modalDialog.append(modalContent); modalWindow.append(modalDialog); vajQuery('#ibmchatbox').after(modalWindow); chatbotModal('boxInfoModal', 'show'); } function vaExternalBrowser(event, url) { saveWebChatLog(event); if (va_useAppBrowser) { va_useAppBrowser(event, url); } } function saveAutoAskingLog(e) { try { if (isNeedSaveAutoAskingLog) { var obj = { refNo: sessionStorage.getItem('refNo'), channel: sessionStorage.getItem('channel'), location: sessionStorage.getItem('location'), question: e.question, lineToken: e.lineToken, source: e.source }; vajQuery .ajax({ url: 'https://va.transglobe.com.tw/api/saveAutoAskingLog', type: 'POST', cache: false, data: obj, datatype: 'json' }) .done(function (res) { isNeedSaveAutoAskingLog = false; }) .fail(function (res) { console.error(`Save auto asking log failed: ${res}`); }); } } catch (e) { console.error(e); } } function saveWebChatLog(e) { try { var obj = { requestID: vajQuery(e.target).data('requestid'), elementType: vajQuery(e.target).data('elementtype'), actionType: vajQuery(e.target).data('type'), elementText: vajQuery(e.target).data('text'), elementValue: vajQuery(e.target).data('value') }; if (obj.requestID) { vajQuery .ajax({ url: 'https://va.transglobe.com.tw/api/saveWebChatLog', type: 'POST', cache: false, data: obj, datatype: 'json' }) .fail(function (res) { console.error(res); }); } else { console.error(`Invalid Request ID: ${obj}`); } } catch (e) { console.error(e); } } function vaOpenForm(e) { try { saveWebChatLog(e); } catch (e) { console.error(e); } try { var requestID = vajQuery(e.target).data('requestid'); var elementValue = vajQuery(e.target).data('value'); var elementText = vajQuery(e.target).data('text'); vaCreateModal(elementValue, elementText, requestID); } catch (e) { console.error(e); } } function appendVideoDialog(i, content, rating, requestID) { setTimeout(function () { let agentImg = ''; if (va_askTo !== undefined && va_askTo === 'agent') { agentImg = 'cbAgentImgDiv'; } vajQuery('#circleG').remove(); var dialog = "
"; dialog += "
"; dialog += '
'; dialog += ' '; dialog += '
'; appendComp(dialog); scrollBottom(); }, 100); } function changeContentFz(srcFz, targetFz) { if (srcFz === null) { srcFz = sessionStorage.getItem('scaleFz'); } sessionStorage.setItem('scaleFz', targetFz); var contentFzLev = document.getElementById('chatbotContent').querySelectorAll('.fsLev'); if (contentFzLev.length > 0) { const lev1 = 'fsLev first-'; const lev2 = 'fsLev second-'; contentFzLev.forEach((fzItem) => { fzItem.classList.value = fzItem.classList.value.replace(lev1 + srcFz, lev1 + targetFz); fzItem.classList.value = fzItem.classList.value.replace(lev2 + srcFz, lev2 + targetFz); }); } } function openLink(link) { if(link) { window.open(link, '_blank'); } }/* global vajQuery, va_testMode, va_inputMask, appendQuery, va_sendWebSocket, vaDisplay*/ va_testMode = true; $(function () { //survey open & reload if (sessionStorage.getItem('wholeSatisfactionSurvey') === 'show' && window.performance && performance.navigation.type === performance.navigation.TYPE_RELOAD) { surveyClose(null); } }); /** * vajQuery onload event的額外處理 */ function va_initAiEvent_extra() { window.onbeforeunload = function (event) { try { if (sessionStorage.getItem('refNo')) { if (!sessionStorage.getItem('refNo').indexOf('web') === 0) { sessionStorage.removeItem('refNo'); } return va_closeWebSocket(); } } catch (e) {} }; //do something if (sessionStorage.getItem('channel') !== 'EC' && sessionStorage.getItem('channel') !== 'EC') { if (sessionStorage.getItem('isfirstView')) { va_rmMainHello(); } else { sessionStorage.setItem('isfirstView', true); if (vajQuery('.chatbotBtnHello').length) { vajQuery('.chatbotBtnHello').show(); window.setTimeout(va_rmMainHello, 10000); } } } if (!/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)) { vajQuery('.chatbotBtn').hover( function () { vajQuery('.chatbotBtnWelcome').show(); if (vajQuery('.chatbotBtnHello').length && sessionStorage.getItem('channel') !== 'EC') { vajQuery('.chatbotBtnHello').hide(); } }, function () { vajQuery('.chatbotBtnWelcome').hide(); if (vajQuery('.chatbotBtnHello').length && sessionStorage.getItem('channel') !== 'EC') { vajQuery('.chatbotBtnHello').show(); } } ); } vajQuery('#chatbotContent').click(function () { //close menu when clicking elsewhere if ($('.ctMenu-list')[0].className.indexOf('in') !== -1) { $('.cbBtn-menu')[0].click(); } }); //結束文字客服 vajQuery('#stopTextServiceMsg').click(function () { // eslint-disable-next-line no-undef vaEndTextServiceModal(); }); // eslint-disable-next-line no-undef if (sessionStorage.getItem('vaDisplay') === 'false') { vaDisplay(false); va_display_status = sessionStorage.getItem('vaDisplay'); sessionStorage.removeItem('vaDisplay'); } else { vaDisplay(va_display_status); } if (sessionStorage.getItem('channel') === 'CW') { $(window).scroll(function () { var windowHeight = $(window).innerHeight(); var vaCheckCWFooter = $('.copyright').offset().top - $(window).scrollTop() - 20; if (vaCheckCWFooter <= windowHeight) { vajQuery('#ibmchatbox').addClass('chatbotBtnBottom'); vajQuery('#chatbotBtnWelcome').addClass('chatbotBtnWelcomeBottom'); if (vajQuery('.chatbotBtnHello').length && sessionStorage.getItem('channel') !== 'EC') { vajQuery('#chatbotBtnHello').addClass('chatbotBtnHelloBottom'); } } else { vajQuery('#ibmchatbox').removeClass('chatbotBtnBottom'); vajQuery('#chatbotBtnWelcome').removeClass('chatbotBtnWelcomeBottom'); if (vajQuery('.chatbotBtnHello').length && sessionStorage.getItem('channel') !== 'EC') { vajQuery('#chatbotBtnHello').removeClass('chatbotBtnHelloBottom'); } } }); $(window).resize(function () { var windowHeight = $(window).innerHeight(); var vaCheckCWFooter = $('.copyright').offset().top - $(window).scrollTop() - 20; if (vaCheckCWFooter <= windowHeight) { vajQuery('#ibmchatbox').addClass('chatbotBtnBottom'); vajQuery('#chatbotBtnWelcome').addClass('chatbotBtnWelcomeBottom'); if (vajQuery('.chatbotBtnHello').length && sessionStorage.getItem('channel') !== 'EC') { vajQuery('#chatbotBtnHello').addClass('chatbotBtnHelloBottom'); } } else { vajQuery('#ibmchatbox').removeClass('chatbotBtnBottom'); vajQuery('#chatbotBtnWelcome').removeClass('chatbotBtnWelcomeBottom'); if (vajQuery('.chatbotBtnHello').length && sessionStorage.getItem('channel') !== 'EC') { vajQuery('#chatbotBtnHello').removeClass('chatbotBtnHelloBottom'); } } }); } } /** * chatbot頁面開啟後, init動作後的額外處理 */ function va_afterInit_extra() {} /** * chatbot頁面開啟後, resetTimeout動作後的額外處理 */ function va_resetTimeout_extra() { if (sessionStorage.getItem('channel') !== 'CSIS') { // if (sessionStorage.getItem('loginToken') !== undefined && sessionStorage.getItem('loginToken') !== '') { if (va_askTo !== 'agent') { va_intervalObj = va_setTimer(); } else { va_wsIntervalObj = va_setCloseTimer(); } // } else { // if (va_askTo !== 'agent') { // va_wsIntervalObj = va_setCloseTimer(); // } // } } else if (sessionStorage.getItem('channel') === 'CSIS') { if (sessionStorage.getItem('loginToken') !== undefined && sessionStorage.getItem('loginToken') !== '') { try { timeoutReset(); } catch (e) { console.log(e); } } else { // va_wsIntervalObj = va_setCloseTimer(); if (va_askTo !== 'agent') { va_intervalObj = va_setTimer(); } else { va_wsIntervalObj = va_setCloseTimer(); } } } } function va_rmMainHello() { $('#chatbotBtnHello').remove(); } /** * 接收到Humix回應後, 有extraInfo時呼叫 */ function va_processExtraInfo(data) { if (data.extraInfo.token !== undefined) { var tt = sessionStorage.getItem('loginToken'); sessionStorage.setItem('loginToken', data.extraInfo.token); if (data.extraInfo.token !== '' && data.extraInfo.token !== 'undefined' && data.extraInfo.token !== 'null' && data.extraInfo.token !== null) { if (sessionStorage.getItem('channel') === 'CSIS') { //CSIS不顯示登出鍵 try { if (tt !== data.extraInfo.token) { logonVerify(); } } catch (e) { console.log(e); } } else { vajQuery('#boxSignOut').show(); } } else { vajQuery('#boxSignOut').hide(); } } setTimeout(function () { if (data.extraInfo.modalType !== 'alive') { chatbotModal('idleEndTextServiceModal', 'hide'); } chatbotModal('connectCustomerServiceModal', 'hide'); }, 1); va_askTo = data.extraInfo.askTo; } /** * 利用app function開啟外部瀏覽器 * @param {*} event * @param {*} url */ function va_useAppBrowser(event, url) {} /** * 依不同的url/(sub)channel定義link的onclick, 若不須處理則回傳'' * @param {*} url */ function va_applyUrlClick(url, event) { var clickProcess = ''; if (url.indexOf('pageback.html') > 0) { openPageBackModal(event, url); clickProcess = true; } else if (url.indexOf('/cs/services/bot/rp') > 0) { url += '&token=' + sessionStorage.getItem('loginToken'); url += '&refNo=' + sessionStorage.getItem('refNo'); window.open(url, 'vacsis'); clickProcess = true; saveWebChatLog(event); } else if (url.indexOf('csis://') === 0) { va_openCSIS(event, url); clickProcess = true; saveWebChatLog(event); } else if (url.indexOf('.pdf') >= 0 && url.indexOf(webBotSettings.cwUrl.uat) >= 0) { url = url.replace(webBotSettings.cwUrl.uat, webBotSettings.cwUrl.prod); window.open(url); clickProcess = true; saveWebChatLog(event); } return clickProcess; } /** * 回傳theEnd, 為true時, 代表此次回傳已處理完成, 若為false, 代表需要後續處理 * @param {*} data */ // function va_openFormHandler(data) { // var theEnd = false; // return theEnd; // } /** * web內其他(disableInput,quickReplyAlign,inputMask,inputType以外)參數的處理 * @param {*} data */ function va_extraWebHandler(data) {} /** * 在va_sendWebSocket傳送Data之前的處理 * @param {*} sendData */ function va_preSendWebSocket(sendData) { //for ref: // sendData.text = sendData.text.replace('以前', ' 以前'); // sendData.text = sendData.text.replace('以後', ' 以後'); return sendData; } // eslint-disable-next-line no-unused-vars function va_onWsError(event) { var clickProcess = ''; if (va_askTo === 'agent') { va_wsIntervalObj = va_setCloseTimer(); } return clickProcess; } // eslint-disable-next-line no-unused-vars function va_onWsClose(event) { var clickProcess = ''; if (va_askTo === 'agent') { va_wsIntervalObj = va_setCloseTimer(); } return clickProcess; } /** * 增加va_inputMask的處理 * @param {*} e * @param {*} input */ function va_applyExtraInputMask(e, input) { //for ref: if (va_inputMask === 'xxxx') { var dialog = ''; for (var i = 0; i < input.length; i++) { dialog += '•'; } appendQuery(dialog); } } // eslint-disable-next-line no-unused-vars function menuPostback(text, value) { appendQuery(text); va_sendWebSocket('menu', 'postback', text, value); if(vajQuery('#cbCollapseMenu').hasClass('menuMax')){ vajQuery('#cbCollapseMenu').attr('class', 'ctMenu-list collapse menuMax'); } else { vajQuery('#cbCollapseMenu').attr('class', 'ctMenu-list collapse'); } vajQuery('#cbCollapseMenu').attr('aria-expanded', 'false'); vajQuery('#cbCollapseMenu').attr('style', 'overflow: hidden; height: 0px;'); } function va_openCSIS(event, url) { saveWebChatLog(event); var data = url.replace('csis://', ''); var pageId = ''; var csisData = []; try { var sPageURL = decodeURI(data); pageId = sPageURL.split('?')[0]; csisData.push({name: 'pgId', value: pageId}); var sURLVariables = sPageURL.split('?')[1].split('&'); for (var i = 0; i < sURLVariables.length; i++) { var sParameterIndex = sURLVariables[i].search('='); var sParameterName = sURLVariables[i].substr(0, sParameterIndex); if (sParameterName !== '') { csisData.push({name: sParameterName, value: sURLVariables[i].substr(sParameterIndex + 1)}); } } console.log(csisData); } catch (e) { console.log(e); } try { if (sessionStorage.getItem('loginToken') !== undefined && sessionStorage.getItem('loginToken') !== '') { functionRouter(pageId, csisData); } else { var csisRedirectUrl = '/cs/services/bot/rp'; for (var i = 0; i < csisData.length; i++) { if (i == 0) { csisRedirectUrl += '?'; } else { csisRedirectUrl += '&'; } csisRedirectUrl += csisData[0].name + '=' + csisData[0].value; } window.open(csisRedirectUrl, 'vacsis'); } } catch (e) { console.log(e); } } /* global vajQuery, va_openForm, va_openForms, webBotSettings, chatbotModal, va_sendWebSocket, vaOpenFormModal, openPageBackModal, va_excludeEventType*/ let loanReasons; let bankCode; let myRegisterOTPTimer; let myPsrnOTPTimer; let myOTPTimer; let myMobileOnePsrnOTPTimer; let myLoanOTPTimer; let myChangeConfirmOTPTimer; $(function () { va_openForms.push('login'); va_openForms.push('loginBirthday'); va_openForms.push('loan'); va_openForms.push('repayment'); va_openForms.push('openPageBackModal'); va_openForms.push('loanRecord'); va_openForms.push('policyData'); va_openForms.push('mposLogin'); va_openForms.push('openChangDeclaration'); va_openForms.push('change'); va_openForms.push('openBasicChangeForm'); va_openForms.push('register'); va_openForms.push('openNetworkChange'); va_openForms.push('openElectronicAllElectronic'); va_openForms.push('openElectronicAllNetwork'); va_excludeEventType.push('alive'); va_excludeEventType.push('login'); va_excludeEventType.push('survey'); va_excludeEventType.push('mposLogin'); va_excludeEventType.push('checkPolicyBasicChangeData'); va_excludeEventType.push('validRegisterData'); va_excludeEventType.push('checkTheBasicChangeData'); va_excludeEventType.push('sendCaptchaByCSIS'); va_excludeEventType.push('changePolicyLoan'); va_excludeEventType.push('getLoanDistribute'); va_excludeEventType.push('openMemberService'); va_excludeEventType.push('checkOTP'); }); function vaCreateModal(value, text, requestId) { va_openForm = value.split('|')[0]; if (va_openForm !== undefined) { switch (va_openForm) { case 'login': //登入 vaCreateLoginModal(value, text, requestId); break; case 'loginBirthday': //登入生日驗證 vaCreateLoginBirthdayModal(); break; case 'loan': //借款 let maxLoanAmount = value.split('|maxLoanAmount:')[1].split('/')[0]; let currency = value.split('currency:')[1].split('/')[0]; let loanMoneyName = value.split('loanMoneyName:')[1]; vaCreateLoanModal(null, maxLoanAmount, currency, loanMoneyName); break; case 'repayment': //還款 vaCreateRepaymentModal(); break; case 'openPageBackModal': // 當保戶有保單沒信箱且沒手機需要先進行契變 let hasEmailOrPhone = value.split('hasEmailOrPhone:')[1].split(',')[0]; if(hasEmailOrPhone === 'N'){ var data ={oaReturn:{}} data.oaReturn.errorMsg = '尚有要保人電子郵件信箱及手機號碼空白的保單,請先變更要保人「電子郵件信箱或手機號碼」。' data.oaReturn.hasEmailOrPhone = hasEmailOrPhone vaCreateLoanDistriErrorModal(data) } else { openPageBackModal(null, value); } break; case 'loanRecord': vaCreateLoanRecordModal(value); break; case 'policyData': vaCreatePolicyDataModal(); break; case 'mposLogin': vaCreateMposLoginModal(value, text, requestId); break; case 'openChangDeclaration': openChangDeclaration(null, value); break; case 'change': let policyDataList = value.split('|policyDataList:')[1]; vaCreateChangeInfoModal(policyDataList); break; case 'openBasicChangeForm': vaCreateBasicChangeFormModal(value); case 'register': vaCreateRegisterModal(null); break; case 'openNetworkChange': vaCreateOpenNetworkModal(value); break; case 'openElectronicAllElectronic': vaCreateOpenElectronicAllElectronicModal(value); break; case 'openElectronicAllNetwork': vaCreateOpenElectronicAllNetworkModal(value); break; default: alert('OpenForm Error'); break; } } } function va_openModalHandler(data, message) { switch (data.extraInfo.modalType) { case 'alive': // alert('Alive Modal'); vaIdleEndTextServiceModal(); break; case 'login': vaCreateLoginModal(data.extraInfo.modalType, '', data.extraInfo.requestId); break; case 'mposLogin': vaCreateMposLoginModal(data.extraInfo.modalType, '', data.extraInfo.requestId); break; case 'survey': // 文字客服連線關閉後,客服滿意度 // alert('Survey Modal'); lastReceiver = message; vaCreateTextServiceRatingModal(data); break; default: alert('show:' + data.extraInfo.modalType); break; } return false; } function va_openFormHandler(data) { let isLogin = va_openForm === 'login' ? true : false; if (data.extraInfo.oaReturn && data.extraInfo.oaReturn.returnCode !== '0000') { switch (va_openForm) { case 'login': //登入error if (data.extraInfo.oaReturn.returnCode === 'loginBirthday') { vaCreateLoginBirthdayModal(); } else if (data.extraInfo.oaReturn.returnCode === 'registerError') { if (vajQuery('#registerModal').length !== 0) { chatbotModal('registerModal', 'hide'); } va_openForm = 'register'; vaCreateRegisterErrorModal(data.extraInfo.oaReturn); } else if (data.extraInfo.oaReturn.returnCode === 'register') { va_openForm = 'register'; if (vajQuery('#registerModal').length !== 0) { chatbotModal('registerModal', 'hide'); } vaCreateRegisterOTPModal(data.extraInfo.oaReturn); } else { vaCreateLoginErrorModal(data.extraInfo); } break; case 'loan': if (data.extraInfo.oaReturn.returnCode === 'loanDistributeError') { vaCreateLoanDistriErrorModal(data.extraInfo); } else if (data.extraInfo.oaReturn.returnCode === 'loanOTP') { vaCreateOTPMessageModal(data.extraInfo.oaReturn); } else if (data.extraInfo.oaReturn.returnCode === 'OTPSuccess') { vaCreateLoanOTPSuccessModal(data.extraInfo.oaReturn); } else if (data.extraInfo.oaReturn.returnCode === 'OTPError') { vaCreateCheckLoanOTPErrorMessageModal(data.extraInfo.oaReturn); } else { vaCreateLoanDistriModal(data.extraInfo); } break; case 'mposLogin': vaCreateLoginErrorModal(data.extraInfo); break; case 'change': if (data.extraInfo.oaReturn.returnCode === 'changeOTP') { vaCreateOTPMessageModal(data.extraInfo.oaReturn); } else if (data.extraInfo.oaReturn.returnCode === 'changeError') { vaCreateCheckBasicErrorMessageModal(data.extraInfo.oaReturn); } else if (data.extraInfo.oaReturn.returnCode === 'showHit') { vaCreateHitModal(data.extraInfo.oaReturn); } else if(data.extraInfo.oaReturn.returnCode === 'OTPSuccess'){ vaCreateChangeOTPSuccessModal(data.extraInfo.oaReturn); } else if (data.extraInfo.oaReturn.returnCode === 'OTPError') { // OTP錯誤 vaCreateCheckChangeOTPErrorMessageModal(data.extraInfo.oaReturn); } else { vaChangeFinalConfirmModal(data.extraInfo); } break; case 'register': if (data.extraInfo.oaReturn.returnCode === 'checkOTPError') { vaCreateCheckRegisterOTPErrorMessageModal(data.extraInfo.oaReturn); } else if (data.extraInfo.oaReturn.returnCode === 'registerOTP') { vaCreateOTPMessageModal(data.extraInfo.oaReturn); } else if (data.extraInfo.oaReturn.returnCode === 'checkPasswordError') { vaCreateCheckRegisterPasswordErrorMessageModal(data.extraInfo.oaReturn); } else if (data.extraInfo.oaReturn.returnCode === 'registerError') { vaCreateRegisterErrorModal(data.extraInfo.oaReturn); } else if (data.extraInfo.oaReturn.returnCode === 'register') { if (vajQuery('#registerModal').length !== 0) { chatbotModal('registerModal', 'hide'); } vaCreateRegisterOTPModal(data.extraInfo.oaReturn); } else if (data.extraInfo.oaReturn.returnCode === 'setThePassword') { if (vajQuery('#registerOTPModal').length !== 0) { chatbotModal('registerOTPModal', 'hide'); } vaCreateRegisterPasswordModal(data.extraInfo.oaReturn); } else if (data.extraInfo.oaReturn.returnCode === 'checkPasswordSuccess') { if (vajQuery('#registerPasswordModal').length !== 0) { chatbotModal('registerPasswordModal', 'hide'); } vaCreateRegisterTermModal(data.extraInfo.oaReturn); } break; case 'openNetworkChange': if (data.extraInfo.oaReturn.returnCode === 'openPermissionsError') { // 檢核變更資料錯誤 vaCreateCheckOpenNetworkErrorMessageModal(data.extraInfo.oaReturn); } else if (data.extraInfo.oaReturn.returnCode === 'OTPError') { // OTP錯誤 vaCreateCheckOpenNetworkOTPErrorMessageModal(data.extraInfo.oaReturn); } else if (data.extraInfo.oaReturn.returnCode === 'openError') { // 開通失敗錯誤 vaCreateOpenNetworkrrorMessageModal(data.extraInfo.oaReturn); } else if (data.extraInfo.oaReturn.returnCode === 'openNetworkOTP') { // 重發OTP提醒 if(data.extraInfo.oaReturn.hasError == 'Y'){ vaCreateCheckOpenNetworkErrorMessageModal(data.extraInfo.oaReturn); } else if (data.extraInfo.oaReturn.IsReSend == 'Y') { // || data.extraInfo.oaReturn.hasError == 'Y' vaCreateOTPMessageModal(data.extraInfo.oaReturn); } else if(data.extraInfo.oaReturn.type === 'phone'){ vaCreateOpenNetworkPhoneOTPModal(data.extraInfo.oaReturn); } else if(data.extraInfo.oaReturn.type === 'email'){ vaCreateOpenNetworkOTPModal(data.extraInfo.oaReturn); } } else if (data.extraInfo.oaReturn.returnCode === 'OTPSuccess') { // OTP正確 vaCreateOpenNetworkConfirmModal(data.extraInfo.oaReturn); } else if (data.extraInfo.oaReturn.returnCode === 'openCheckPermissions') { // 檢核變更資料正確 進入信箱OTP var endtime = addMinutes(new Date(), 5); let year = endtime.getFullYear(); let month = ('0' + (endtime.getMonth() + 1)).slice(-2); let day = ('0' + endtime.getDate()).slice(-2); let hour = endtime.getHours(); let minute = endtime.getMinutes(); var endTime; if (minute < 10) { endTime = year + '/' + month + '/' + day + ' ' + hour + ':0' + minute; } endTime = year + '/' + month + '/' + day + ' ' + hour + ':' + minute; const value = { returnCode: 'openNetworkOTP', email: data.extraInfo.oaReturn.email, sendTheOTPType: 'E', IsReSend: 'N', policyDataList: data.extraInfo.oaReturn.policyDataList, endTime: endTime, phone: data.extraInfo.oaReturn.phone, hasPhone: data.extraInfo.oaReturn.hasPhone, type: data.extraInfo.oaReturn.type }; va_sendWebSocket('openForm', 'formback', '', 'sendCaptchaByCSIS', value); } else if (data.extraInfo.oaReturn.returnCode === 'openCheckPermissionsPhone') { // 檢核變更資料正確 進入手機OTP var endtime = addMinutes(new Date(), 5); let year = endtime.getFullYear(); let month = ('0' + (endtime.getMonth() + 1)).slice(-2); let day = ('0' + endtime.getDate()).slice(-2); let hour = endtime.getHours(); let minute = endtime.getMinutes(); var endTime; let policyDataList = data.extraInfo.oaReturn.policyDataList; if (minute < 10) { endTime = year + '/' + month + '/' + day + ' ' + hour + ':0' + minute; } endTime = year + '/' + month + '/' + day + ' ' + hour + ':' + minute; const value = { returnCode: 'openNetworkOTP', email: data.extraInfo.oaReturn.email, phone: data.extraInfo.oaReturn.phone, sendTheOTPType: 'P', IsReSend: 'N', policyDataList: data.extraInfo.oaReturn.policyDataList, policyNo: policyDataList[0].policyCode, endTime: endTime, type: 'phone' }; va_sendWebSocket('openForm', 'formback', '', 'sendCaptchaByCSIS', value); } break; case 'openElectronicAllElectronic': case 'openElectronicAllNetwork': if (data.extraInfo.oaReturn.returnCode === 'openPermissionsError') { // 檢核變更資料錯誤 vaCreateCheckOpenElectronicNoticeErrorMessageModal(data.extraInfo.oaReturn); } else if (data.extraInfo.oaReturn.returnCode === 'openCheckPermissions') { // 檢核變更資料正確 var endtime = addMinutes(new Date(), 5); let year = endtime.getFullYear(); let month = ('0' + (endtime.getMonth() + 1)).slice(-2); let day = ('0' + endtime.getDate()).slice(-2); let hour = endtime.getHours(); let minute = endtime.getMinutes(); var endTime; if (minute < 10) { endTime = year + '/' + month + '/' + day + ' ' + hour + ':0' + minute; } endTime = year + '/' + month + '/' + day + ' ' + hour + ':' + minute; const value = { returnCode: 'openElectronicOTP', email: data.extraInfo.oaReturn.email, sendTheOTPType: 'E', IsReSend: 'N', policyDataList: data.extraInfo.oaReturn.policyDataList, endTime: endTime, phone: data.extraInfo.oaReturn.phone, hasPhone: data.extraInfo.oaReturn.hasPhone, type: data.extraInfo.oaReturn.type }; va_sendWebSocket('openForm', 'formback', '', 'sendCaptchaByCSIS', value); } else if (data.extraInfo.oaReturn.returnCode === 'openElectronicOTP') { // 重發OTP提醒 if(data.extraInfo.oaReturn.hasError == 'Y'){ vaCreateCheckOpenNetworkErrorMessageModal(data.extraInfo.oaReturn); } else if (data.extraInfo.oaReturn.IsReSend == 'Y') { // || data.extraInfo.oaReturn.hasError == 'Y' vaCreateOTPMessageModal(data.extraInfo.oaReturn); } else if (data.extraInfo.oaReturn.type === 'phone') { vaCreateOpenElectronicPhoneOTPModal(data.extraInfo.oaReturn); } else if(data.extraInfo.oaReturn.type === 'email'){ vaCreateOpenElectronicOTPModal(data.extraInfo.oaReturn); } } else if (data.extraInfo.oaReturn.returnCode === 'OTPError') { // OTP錯誤 vaCreateCheckOpenElectronicOTPErrorMessageModal(data.extraInfo.oaReturn); } else if (data.extraInfo.oaReturn.returnCode === 'OTPSuccess') { // OTP正確 vaCreateOpenElectronicConfirmModal(data.extraInfo.oaReturn); } else if (data.extraInfo.oaReturn.returnCode === 'openCheckPermissionsPhone') { // 檢核變更資料正確 進入手機OTP var endtime = addMinutes(new Date(), 5); let year = endtime.getFullYear(); let month = ('0' + (endtime.getMonth() + 1)).slice(-2); let day = ('0' + endtime.getDate()).slice(-2); let hour = endtime.getHours(); let minute = endtime.getMinutes(); var endTime; let policyDataList = data.extraInfo.oaReturn.policyDataList; if (minute < 10) { endTime = year + '/' + month + '/' + day + ' ' + hour + ':0' + minute; } endTime = year + '/' + month + '/' + day + ' ' + hour + ':' + minute; const value = { returnCode: 'openElectronicOTP', email: data.extraInfo.oaReturn.email, phone: data.extraInfo.oaReturn.phone, sendTheOTPType: 'P', IsReSend: 'N', policyDataList: data.extraInfo.oaReturn.policyDataList, policyNo: policyDataList[0].policyCode, endTime: endTime, type: 'phone', }; va_sendWebSocket('openForm', 'formback', '', 'sendCaptchaByCSIS', value); } break; default: alert('OpenForm Error'); break; } return true; } else { vaOpenFormModal('hide'); if (isLogin) { if (data.extraInfo.birthdayCelebration) setTimeout(function () { vaCreatebirthdayCelebrationModal(false); }, 500); } va_openForm = ''; return false; } } function vaCreateMposLoginModal(value, text, requestId) { if (vajQuery('#loginModal').length) { chatbotModal('loginModal', 'hide'); setTimeout(function () { vajQuery('#loginModal').remove(); vaCreateMposLoginModal(value, text, requestId); }, 500); } else { var captchaSvg; vajQuery .ajax({ url: 'https://va.transglobe.com.tw/api/genCaptcha', type: 'POST', cache: false, data: JSON.stringify({ uuid: sessionStorage.getItem('uid') }), contentType: 'application/json; charset=utf-8', dataType: 'html', async: false }) .done(function (res) { captchaSvg = res; }) .fail(function (res) { console.log('fail:' + JSON.stringify(res)); }); let loginModal = ''; loginModal += ''; vajQuery('#ibmchat').append(loginModal); chatbotModal('loginModal', 'show'); vajQuery('.loginModalDialog') .find('input') .bind('change', function (e) { if (vajQuery('#useracc').val() !== '' && vajQuery('#captchaCode').val() !== '' && vajQuery('#usersosi').val() !== '') { vajQuery('#loginSubmit').removeClass('disabled'); } else { vajQuery('#loginSubmit').addClass('disabled'); } }); vajQuery('.loginModalDialog') .find('input') .bind('keyup', function (e) { if (vajQuery('#useracc').val() !== '' && vajQuery('#captchaCode').val() !== '' && vajQuery('#usersosi').val() !== '') { vajQuery('#loginSubmit').removeClass('disabled'); } else { vajQuery('#loginSubmit').addClass('disabled'); } }); vajQuery('.loginModalDialog') .find('input') .bind('focus', function (e) { vajQuery(e.target).parent('.row').addClass('active'); }); vajQuery('.loginModalDialog') .find('input') .bind('blur', function (e) { if (vajQuery(e.target).val().length === 0) { vajQuery(e.target).parent('.row').removeClass('active'); } }); vajQuery('.maskInfo').bind('click', function (e) { if (vajQuery(e.target).hasClass('unmask')) { vajQuery(e.target).parent('.row').children('input').attr('type', 'password'); vajQuery(e.target).removeClass('unmask'); } else { vajQuery(e.target).parent('.row').children('input').attr('type', 'text'); vajQuery(e.target).addClass('unmask'); } }); vajQuery('#loginInfo').bind('click', function (e) { vajQuery('.tiptext').css('visibility', 'visible'); }); vajQuery('#loginCloseWhite').bind('click', function (e) { vajQuery('.tiptext').css('visibility', 'hidden'); }); vajQuery('#loginSubmit').bind('click', function (e) { // console.log('submit'); try { $('.loaderMain').show(); var elementValue = vajQuery(e.target).data('value'); var elementText = vajQuery(e.target).data('text'); var jscrypto = new JSEncrypt(); jscrypto.setPublicKey(RSA_PUBLICKEY); var data = { //登入 useracc: vajQuery('#useracc').val(), usersosi: jscrypto.encrypt(vajQuery('#usersosi').val()), captchaCode: vajQuery('#captchaCode').val() }; va_sendWebSocket('openForm', 'formback', elementText, elementValue, data); } catch (e) { $('.loaderMain').hide(); } }); } } function vaCreateLoginModal(value, text, requestId) { if (vajQuery('#loginModal').length) { chatbotModal('loginModal', 'hide'); setTimeout(function () { vajQuery('#loginModal').remove(); vaCreateLoginModal(value, text, requestId); }, 500); } else { var captchaSvg; vajQuery .ajax({ url: 'https://va.transglobe.com.tw/api/genCaptcha', type: 'POST', cache: false, data: JSON.stringify({ uuid: sessionStorage.getItem('uid') }), contentType: 'application/json; charset=utf-8', dataType: 'html', async: false }) .done(function (res) { captchaSvg = res; }) .fail(function (res) { console.log('fail:' + JSON.stringify(res)); }); let loginModal = ''; loginModal += ''; vajQuery('#ibmchat').append(loginModal); chatbotModal('loginModal', 'show'); vajQuery('.loginModalDialog') .find('input') .bind('change', function (e) { if (vajQuery('#useracc').val() !== '' && vajQuery('#captchaCode').val() !== '' && vajQuery('#usersosi').val() !== '') { vajQuery('#loginSubmit').removeClass('disabled'); } else { vajQuery('#loginSubmit').addClass('disabled'); } }); vajQuery('.loginModalDialog') .find('input') .bind('keyup', function (e) { if (vajQuery('#useracc').val() !== '' && vajQuery('#captchaCode').val() !== '' && vajQuery('#usersosi').val() !== '') { vajQuery('#loginSubmit').removeClass('disabled'); } else { vajQuery('#loginSubmit').addClass('disabled'); } }); vajQuery('.loginModalDialog') .find('input') .bind('focus', function (e) { vajQuery(e.target).parent('.row').addClass('active'); }); vajQuery('.loginModalDialog') .find('input') .bind('blur', function (e) { if (vajQuery(e.target).val().length === 0) { vajQuery(e.target).parent('.row').removeClass('active'); } }); vajQuery('.maskInfo').bind('click', function (e) { if (vajQuery(e.target).hasClass('unmask')) { vajQuery(e.target).parent('.row').children('input').attr('type', 'password'); vajQuery(e.target).removeClass('unmask'); } else { vajQuery(e.target).parent('.row').children('input').attr('type', 'text'); vajQuery(e.target).addClass('unmask'); } }); vajQuery('#loginInfo').bind('click', function (e) { vajQuery('.tiptext').css('visibility', 'visible'); }); vajQuery('#loginCloseWhite').bind('click', function (e) { vajQuery('.tiptext').css('visibility', 'hidden'); }); vajQuery('#loginSubmit').bind('click', function (e) { // console.log('submit'); try { $('.loaderMain').show(); var elementValue = vajQuery(e.target).data('value'); var elementText = vajQuery(e.target).data('text'); var jscrypto = new JSEncrypt(); jscrypto.setPublicKey(RSA_PUBLICKEY); var data = { //登入 useracc: vajQuery('#useracc').val().trim(), /* comment by genix@20240820, apply E2EE encrypted the plain password via public key */ usersosi: jscrypto.encrypt(vajQuery('#usersosi').val()), captchaCode: vajQuery('#captchaCode').val() }; va_sendWebSocket('openForm', 'formback', elementText, elementValue, data); } catch (e) { $('.loaderMain').hide(); } }); vajQuery('#regAccBtn').bind('click', function (e) { try { if (vajQuery('#loginModal').length) { chatbotModal('loginModal', 'hide'); } $('.loaderMain').show(); vaCreateRegisterModal(); } catch (e) { $('.loaderMain').hide(); } }); } } function vaCreateLoginBirthdayModal() { $('.loaderMain').hide(); chatbotModal('loginModal', 'hide'); if (vajQuery('#birthdayModal').length) { chatbotModal('birthdayModal', 'hide'); setTimeout(function () { vajQuery('#birthdayModal').remove(); vaCreateLoginBirthdayModal(); }, 500); } else { let thisYear = new Date().getFullYear(); let years = ''; years += '
'; years += ' '; years += '
'; let thisMonth = new Date().getMonth() + 1 >= 10 ? new Date().getMonth() + 1 : '0' + (new Date().getMonth() + 1); let months = ''; months += '
'; months += ' '; months += '
'; let days = ''; let thisDate = new Date().getDate() >= 10 ? new Date().getDate() : '0' + new Date().getDate(); days += '
'; days += ' '; days += '
'; let birthdayModal = ''; birthdayModal += ''; vajQuery('#ibmchat').append(birthdayModal); chatbotModal('birthdayModal', 'show'); vajQuery('#yearOptions li').click(function (e) { vajQuery('#year div').html(vajQuery(e.target).html()); //月份不得大於當月 let newMonth = ''; for (let i = 1; i <= 12; i++) { if (new Date().getFullYear().toString() === vajQuery(e.target).html()) { if (i <= new Date().getMonth() + 1) { newMonth += i < 10 ? '
  • 0' + i + '
  • ' : '
  • ' + i + '
  • '; } } else { newMonth += i < 10 ? '
  • 0' + i + '
  • ' : '
  • ' + i + '
  • '; } } vajQuery('#monthOptions').html(newMonth); vajQuery('#month div').html('01'); // 調整天數 / 不得大於今天 var lastDay = new Date(vajQuery(e.target).html(), vajQuery('#month div').html(), 0); var day = lastDay.getDate(); let newDays = ''; for (let i = 1; i <= day; i++) { if (new Date().getFullYear().toString() === vajQuery(e.target).html() && new Date().getMonth() + 1 === parseInt(vajQuery('#month div').html(), 10)) { if (i <= new Date().getDate()) { newDays += i < 10 ? '
  • 0' + i + '
  • ' : '
  • ' + i + '
  • '; } } else { newDays += i < 10 ? '
  • 0' + i + '
  • ' : '
  • ' + i + '
  • '; } } vajQuery('#dayOptions').html(newDays); vajQuery('#day div').html('01'); }); vajQuery('.chatbotModal').on('click', '#monthOptions li', function (e) { vajQuery('#month div').html(vajQuery(e.target).html()); var lastDay = new Date(vajQuery('#year div').html(), vajQuery(e.target).html(), 0); var day = lastDay.getDate(); let newDays = ''; for (let i = 1; i <= day; i++) { if (new Date().getFullYear() === parseInt(vajQuery('#year div').html(), 10) && new Date().getMonth() + 1 === parseInt(vajQuery(e.target).html(), 10)) { if (i <= new Date().getDate()) { newDays += i < 10 ? '
  • 0' + i + '
  • ' : '
  • ' + i + '
  • '; } } else { newDays += i < 10 ? '
  • 0' + i + '
  • ' : '
  • ' + i + '
  • '; } } vajQuery('#dayOptions').html(newDays); vajQuery('#day div').html('01'); }); vajQuery('.chatbotModal').on('click', '#dayOptions li', function (e) { vajQuery('#day div').html(vajQuery(e.target).html()); }); vajQuery('#loginBirthdaySubmit').bind('click', function (e) { try { $('.loaderMain').show(); let data = { // 生日參數 bYear: vajQuery('#year div').html(), bMonth: vajQuery('#month div').html(), bDay: vajQuery('#day div').html() }; va_sendWebSocket('openForm', 'formback', '', 'loginBirthday', data); } catch (e) { $('.loaderMain').hide(); } }); } } function vaCreateLoginErrorModal(extraInfo) { /** * A:有效 B:出生年月日不正確 C:系統維護中 D:圖形驗證碼有誤 F:密碼錯誤 G:Mpos通路不符 H:Mpos密碼錯誤, I:失效(三日臨櫃) L:停用(錯五次密碼) S:失效(五年未登入) N:帳號不存在 */ if (vajQuery('#loginErrModal').length) { chatbotModal('loginErrModal', 'hide'); vajQuery('#loginErrModal').remove(); vaCreateLoginErrorModal(extraInfo); } else { var modalWindow = vajQuery(''); var modalDialog = vajQuery(''); var modalContent = vajQuery(''); //核身成功 if (extraInfo.oaReturn.returnCode === 'A') { var modalBody = vajQuery(''); } else { //核身失敗 var modalBody = vajQuery( '' ); } //webBotSettings var footerContent = ''; var modalFooter = vajQuery(footerContent); modalContent.append(modalBody); modalContent.append(modalFooter); modalDialog.append(modalContent); modalWindow.append(modalDialog); vajQuery('#ibmchatbox').after(modalWindow); vajQuery('#register').bind('click', function (e) { try { if (vajQuery('#loginErrModal').length) { chatbotModal('loginErrModal', 'hide'); } if (vajQuery('#loginModal').length) { chatbotModal('loginModal', 'hide'); } $('.loaderMain').show(); vaCreateRegisterModal(); } catch (e) { $('.loaderMain').hide(); } }); vajQuery('#loginErrModal') .find('.modal-footer') .find('a') .each(function () { var vajQuerythis = vajQuery(this); vajQuerythis.data('elementtype', 'Event'); vajQuerythis.data('requestid', vajQuery('#loginModal').data('requestid')); vajQuerythis.data('text', vajQuery(this).html()); vajQuerythis.data('type', ''); vajQuerythis.data('value', ''); }); vajQuery('#relogin').click(function () { chatbotModal('loginErrModal', 'hide'); chatbotModal('loginModal', 'hide'); vaCreateLoginModal('login', '', vajQuery('#loginModal').data('requestid')); }); vajQuery('#reloginAgent').click(function () { chatbotModal('loginErrModal', 'hide'); }); vajQuery('#reloginBirthday').click(function () { chatbotModal('loginErrModal', 'hide'); chatbotModal('birthdayModal', 'hide'); vaCreateLoginBirthdayModal(); }); vajQuery('#loginErrorCancel').click(function () { chatbotModal('loginErrModal', 'hide'); chatbotModal('loginModal', 'hide'); chatbotModal('birthdayModal', 'hide'); }); vajQuery('#loginErrorClose').click(function () { chatbotModal('loginErrModal', 'hide'); chatbotModal('birthdayModal', 'hide'); vajQuery('#captchaCode').val(''); reloadCaptcha(); }); chatbotModal('loginErrModal', 'show'); if (extraInfo.oaReturn.returnCode === 'A') { //核身成功,3秒後自動關窗 setTimeout(function () { chatbotModal('loginErrModal', 'hide'); }, 3000); } } $('.loaderMain').hide(); } function vaCreatePolicyDataModal() { if (vajQuery('#policyDataModal').length) { chatbotModal('policyDataModal', 'hide'); vajQuery('#policyDataModal').remove(); vaCreatePolicyDataModal(); } else { let policyDataModal = ''; policyDataModal += ''; vajQuery('#ibmchat').append(policyDataModal); setTimeout(function () { chatbotModal('policyDataModal', 'show'); }, 500); vajQuery('#policyDataModalSubmit').bind('click', function (e) { chatbotModal('policyDataModal', 'hide'); }); } } function vaCreateRegisterModal(data) { vajQuery('#userEmail').remove(); vajQuery('#userPhone').remove(); if (vajQuery('#registerModal').length !== 0) { chatbotModal('registerModal', 'hide'); vajQuery('#registerModal').remove(); vaCreateRegisterModal(data); } else { let registerModal = ''; registerModal += '