(function ($, Drupal, drupalSettings) { "use strict"; var loading = false, scroll_load; function loadmoreNotify(page,renderElm) { if (page === undefined) page = 1; if (!loading) { loading = true; $.get(Drupal.url('account/notifications?_format=json&page=' + page)) .done(function (data) { loading = false; console.log('Notify respon: ', data); if (typeof data === 'string') data = JSON.parse(data); for (var i in data) { var notify = data[i]; if (renderElm[0].tagName === 'DIV') { var read_class = parseInt( notify.read ) === 0 ? 'unread' : ''; var tmp = '
\n' + ' ' + notify.title + '' + notify.created + '\n' + '
'; } else { var read_class = notify.unread === 1 ? 'not-seen' : ''; var tmp = '
  • \n' + '
    \n' + '
    '+ notify.title +'
    \n' + '
    '+ notify.created +'
    \n' + '
    \n' + '
  • '; } renderElm.append(tmp); } renderElm.children('.fa').remove(); renderElm.data('page', page + 1); renderElm.closest('.orders-column').children('.fa').remove(); try { renderElm.parent().getNiceScroll().resize(); } catch (e) { console.log(e); } }); } } Drupal.behaviors.iot_notification = { attach: function attach(context, settings) { /*if ($('.user-notifications .icon-notification-mb .number').length && $('.user-notification .icon-notification .number').length) { $('.user-notifications .icon-notification-mb .number').html($('.user-notification .icon-notification .number').html()); }*/ //For mobile if ($('.notifi-popup-mobile').length) { $('.icon-notification-mb').click(function(event) { if (!$('#notification-tabs .order-item').length) loadmoreNotify(0, $('#notification-tabs')); $('#notification-tabs').on('click', '.order-item', function (e) { e.preventDefault(); var $this = $(this); $this.parent().hide(); $('.notifi-popup-mobile .title').addClass('active'); $('.notifi-popup-mobile .table-order-content').find('.order-title').html(''); $('.notifi-popup-mobile .table-order-content').find('.time').html(''); $('.notifi-popup-mobile .table-order-content').find('.container-mess-order').html(''); $.get(Drupal.url('account/notification/' + $this.data('id') + '?_format=json')) .done(function (data) { loading = false; if (typeof data === "string") data = JSON.parse(data); $('.notifi-popup-mobile .table-order-content').find('.order-title').html(data.title); $('.notifi-popup-mobile .table-order-content').find('.time').html(data.created); //Remove style and script tag before render var bodyTxt = document.createElement('div'); bodyTxt.innerHTML = data.body; $(bodyTxt).find('script').remove(); $(bodyTxt).find('meta').remove(); $(bodyTxt).find('link[rel="stylesheet"]').remove(); $(bodyTxt).find('style').remove(); $('.notifi-popup-mobile .table-order-content').find('.container-mess-order').html(bodyTxt); //Update message was read if (data.read !== 1) { $.post(Drupal.url('account/notification/' + data.id), {read: 1}) .done(function (read_updated) { if (read_updated == 1) { $this.removeClass('unread'); if ($('.user-notification-wrap li[data-notify="' + data.id + '"]').length) { $('.user-notification-wrap li[data-notify="' + data.id + '"]').remove(); if ($('.user-notification-wrap li.notify-item').length > 0) { $('li.user-notification .icon-notification .number').html($('.user-notification-wrap li.notify-item').length); } else { $('li.user-notification .icon-notification .number').html(''); } } } }); } }); }); }); $('#notification-tabs').on('mousewheel, wheel', function (e) { if (this.scrollTop === this.scrollHeight) { if (scroll_load) clearTimeout(scroll_load); scroll_load = setTimeout(function () { if (!$(this).find('.fa-spin').length) $(this).append(''); loadmoreNotify($(this).data('page'), $('.notifi-cont-wrap .nav-tabs')); }, 400); } }); if ($('.notifi-popup-mobile .table-order-content').find('.container-mess-order').length && settings.notify_detail !== undefined) { //Remove style and script tag before render var bodyTxt = document.createElement('div'); bodyTxt.innerHTML = settings.notify_detail.body; $(bodyTxt).find('script').remove(); $(bodyTxt).find('meta').remove(); $(bodyTxt).find('link[rel="stylesheet"]').remove(); $(bodyTxt).find('style').remove(); $('.notifi-popup-mobile .table-order-content').find('.container-mess-order').html(bodyTxt); } } if ($('.notifi-cont-wrap').length) { //Load first notify if (!$('.notifi-cont-wrap .nav-tabs > li.active').length) { setTimeout(function () { $('.notifi-cont-wrap .nav-tabs > li:first-child').trigger('click'); }, 300); } // $('.notifi-cont-wrap .orders-column').niceScroll(); $('.notifi-cont-wrap .orders-column ul').on('mousewheel, wheel', function (e) { if (this.closest('.orders-column').scrollTop + this.closest('.orders-column').offsetHeight > $('.notifi-cont-wrap .nav-tabs')[0].scrollHeight - 5) { if (!$(this).closest('.orders-column').find('.fa-spin').length) $(this).closest('.orders-column').append(''); if($(this).data('page') == 0){ setTimeout(function(){ // your code. loadmoreNotify(1, $(this)); }.bind(this), 1000); }else { setTimeout(function(){ // your code. loadmoreNotify($(this).data('page'), $(this)); }.bind(this), 1000); } } }); // $('.notifi-cont-wrap .orders-column').on('mousewheel, wheel', function (e) { // if (this.scrollTop + this.offsetHeight === $('.notifi-cont-wrap .nav-tabs')[0].scrollHeight) { // loadmoreNotify($(this).data('page'), $(this)); // //// if (scroll_load) clearTimeout(scroll_load); //// scroll_load = setTimeout(function () { //// if (!$(this).find('.fa-spin').length) $(this).append(''); //// loadmoreNotify($(this).data('page'), $(this)); //// }, 400); // } // }); $('.notifi-cont-wrap .nav-tabs').on('click', 'li', function (e) { if (!loading) { loading = true; $('.notifi-cont-wrap .nav-tabs li.active').removeClass('active'); var $this = $(this); if (!$this.hasClass('active')) { $this.addClass('active'); $.get(Drupal.url('account/notification/' + $this.data('id') + '?_format=json')) .done(function (data) { loading = false; if (typeof data === "string") data = JSON.parse(data); $('.notifi-cont-wrap .table-order-content').find('.order-title').html(data.title + '' + data.created + ''); //Remove style and script tag before render var bodyTxt = document.createElement('div'); bodyTxt.innerHTML = data.body; $(bodyTxt).find('script').remove(); $(bodyTxt).find('meta').remove(); $(bodyTxt).find('link[rel="stylesheet"]').remove(); $(bodyTxt).find('style').remove(); $('.notifi-cont-wrap .table-order-content').find('.container-mess-order').html(bodyTxt); //Update message was read if (data.read !== 1) { $.post(Drupal.url('account/notification/' + data.id), {read: 1}) .done(function (read_updated) { if (read_updated == 1) { if(($this).hasClass('not-seen')) { var unread_cnt = $('li.user-notification .icon-notification .number').html(); if( unread_cnt > 1 ) { $('li.user-notification .icon-notification .number').html(unread_cnt-1); }else { $('li.user-notification .icon-notification .number').html(''); } $this.removeClass('not-seen'); } if ($('.user-notification-wrap li[data-notify="' + data.id + '"]').length) { // $('.user-notification-wrap li[data-notify="' + data.id + '"]').remove(); if ($('.user-notification-wrap li.notify-item').length > 0) { // $('li.user-notification .icon-notification .number').html($('.user-notification-wrap li.notify-item').length); } else { $('li.user-notification .icon-notification .number').html(''); } } } }); } }); } } }); if ($('.notifi-cont-wrap .table-order-content').find('.container-mess-order').length && settings.notify_detail !== undefined) { //Remove style and script tag before render var bodyTxt = document.createElement('div'); bodyTxt.innerHTML = settings.notify_detail.body; $(bodyTxt).find('script').remove(); $(bodyTxt).find('meta').remove(); $(bodyTxt).find('link[rel="stylesheet"]').remove(); $(bodyTxt).find('style').remove(); $('.notifi-cont-wrap .table-order-content').find('.container-mess-order').html(bodyTxt); } } } } })(jQuery, Drupal, drupalSettings); ; !function(t){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=t(),module.exports.introJs=function(){return console.warn('Deprecated: please use require("intro.js") directly, instead of the introJs method of the function'),t().apply(this,arguments)};else if("function"==typeof define&&define.amd)define([],t);else{("undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this).introJs=t()}}(function(){function n(t){this._targetElement=t,this._introItems=[],this._options={nextLabel:"Next →",prevLabel:"← Back",skipLabel:"Skip",doneLabel:"Done",hidePrev:!1,hideNext:!1,tooltipPosition:"bottom",tooltipClass:"",highlightClass:"",exitOnEsc:!0,exitOnOverlayClick:!0,showStepNumbers:!0,keyboardNavigation:!0,showButtons:!0,showBullets:!0,showProgress:!1,scrollToElement:!0,scrollTo:"element",scrollPadding:30,overlayOpacity:.8,positionPrecedence:["bottom","top","right","left"],disableInteraction:!1,helperElementPadding:10,hintPosition:"top-middle",hintButtonLabel:"Got it",hintAnimation:!0,buttonClass:"introjs-button"}}function e(t,i){var e=t.querySelectorAll("*[data-intro]"),n=[];if(this._options.steps)B(this._options.steps,function(t){var e=h(t);if(e.step=n.length+1,"string"==typeof e.element&&(e.element=document.querySelector(e.element)),void 0===e.element||null===e.element){var i=document.querySelector(".introjsFloatingElement");null===i&&((i=document.createElement("div")).className="introjsFloatingElement",document.body.appendChild(i)),e.element=i,e.position="floating"}e.scrollTo=e.scrollTo||this._options.scrollTo,void 0===e.disableInteraction&&(e.disableInteraction=this._options.disableInteraction),null!==e.element&&n.push(e)}.bind(this));else{var o;if(e.length<1)return!1;B(e,function(t){if((!i||t.getAttribute("data-intro-group")===i)&&"none"!==t.style.display){var e=parseInt(t.getAttribute("data-step"),10);o=void 0!==t.getAttribute("data-disable-interaction")?!!t.getAttribute("data-disable-interaction"):this._options.disableInteraction,0o.height&&m(n,"bottom");r.top-s<0&&m(n,"top");r.right+l>o.width&&m(n,"right");r.left-l<0&&m(n,"left");var c=(h=i||"",u=h.indexOf("-"),-1!==u?h.substr(u):"");var h,u;i&&(i=i.split("-")[0]);n.length&&(a="auto"!==i&&-1a.height?(i.className="introjs-arrow left-bottom",e.style.top="-"+(l.height-r.height-20)+"px"):i.className="introjs-arrow left";break;case"left":o||!0!==this._options.showStepNumbers||(e.style.top="15px"),r.top+l.height>a.height?(e.style.top="-"+(l.height-r.height-20)+"px",i.className="introjs-arrow right-bottom"):i.className="introjs-arrow right",e.style.right=r.width+20+"px";break;case"floating":i.style.display="none",e.style.left="50%",e.style.top="50%",e.style.marginLeft="-"+l.width/2+"px",e.style.marginTop="-"+l.height/2+"px",null!=n&&(n.style.left="-"+(l.width/2+18)+"px",n.style.top="-"+(l.height/2+18)+"px");break;case"bottom-right-aligned":i.className="introjs-arrow top-right",f(r,u=0,l,e),e.style.top=r.height+20+"px";break;case"bottom-middle-aligned":i.className="introjs-arrow top-middle",d=r.width/2-l.width/2,o&&(d+=5),f(r,d,l,e)&&(e.style.right=null,p(r,d,l,a,e)),e.style.top=r.height+20+"px";break;default:i.className="introjs-arrow top",p(r,0,l,a,e),e.style.top=r.height+20+"px"}}function p(t,e,i,n,o){return t.left+e+i.width>n.width?(o.style.left=n.width-i.width-t.left+"px",!1):(o.style.left=e+"px",!0)}function f(t,e,i,n){return t.left+t.width-e-i.width<0?(n.style.left=-t.left+"px",!1):(n.style.right=e+"px",!0)}function m(t,e){-1 a.active").className="",r.querySelector('.introjs-bullets li > a[data-stepnumber="'+o.step+'"]').className="active"),r.querySelector(".introjs-progress .introjs-progressbar").style.cssText="width:"+z.call(s)+"%;",r.querySelector(".introjs-progress .introjs-progressbar").setAttribute("aria-valuenow",z.call(s)),d.style.opacity=1,c&&(c.style.opacity=1),null!=i&&/introjs-donebutton/gi.test(i.className)?i.focus():null!=t&&t.focus(),P.call(s,o.scrollTo,o,h)},350)}else{var f=document.createElement("div"),m=document.createElement("div"),b=document.createElement("div"),g=document.createElement("div"),y=document.createElement("div"),v=document.createElement("div"),_=document.createElement("div"),w=document.createElement("div");f.className=a,m.className="introjs-tooltipReferenceLayer",(n=R(o.element))!==document.body&&V(n,o.element),T.call(s,f),T.call(s,m),this._targetElement.appendChild(f),this._targetElement.appendChild(m),b.className="introjs-arrow",y.className="introjs-tooltiptext",y.innerHTML=o.intro,!(v.className="introjs-bullets")===this._options.showBullets&&(v.style.display="none");var C=document.createElement("ul");C.setAttribute("role","tablist");var j=function(){s.goToStep(this.getAttribute("data-stepnumber"))};B(this._introItems,function(t,e){var i=document.createElement("li"),n=document.createElement("a");i.setAttribute("role","presentation"),n.setAttribute("role","tab"),n.onclick=j,e===o.step-1&&(n.className="active"),I(n),n.innerHTML=" ",n.setAttribute("data-stepnumber",t.step),i.appendChild(n),C.appendChild(i)}),v.appendChild(C),!(_.className="introjs-progress")===this._options.showProgress&&(_.style.display="none");var k=document.createElement("div");k.className="introjs-progressbar",k.setAttribute("role","progress"),k.setAttribute("aria-valuemin",0),k.setAttribute("aria-valuemax",100),k.setAttribute("aria-valuenow",z.call(this)),k.style.cssText="width:"+z.call(this)+"%;",_.appendChild(k),!(w.className="introjs-tooltipbuttons")===this._options.showButtons&&(w.style.display="none"),g.className="introjs-tooltip",g.appendChild(y),g.appendChild(v),g.appendChild(_);var x=document.createElement("span");!0===this._options.showStepNumbers&&(x.className="introjs-helperNumberLayer",x.innerHTML=o.step,m.appendChild(x)),g.appendChild(b),m.appendChild(g),(t=document.createElement("a")).onclick=function(){s._introItems.length-1!==s._currentStep&&E.call(s)},I(t),t.innerHTML=this._options.nextLabel,(e=document.createElement("a")).onclick=function(){0!==s._currentStep&&N.call(s)},I(e),e.innerHTML=this._options.prevLabel,(i=document.createElement("a")).className=this._options.buttonClass+" introjs-skipbutton ",I(i),i.innerHTML=this._options.skipLabel,i.onclick=function(){s._introItems.length-1===s._currentStep&&"function"==typeof s._introCompleteCallback&&s._introCompleteCallback.call(s),s._introItems.length-1!==s._currentStep&&"function"==typeof s._introExitCallback&&s._introExitCallback.call(s),"function"==typeof s._introSkipCallback&&s._introSkipCallback.call(s),A.call(s,s._targetElement)},w.appendChild(i),1l?window.scrollBy(0,n.top-(l/2-n.height/2)-this._options.scrollPadding):window.scrollBy(0,n.top-(l/2-n.height/2)+this._options.scrollPadding)}}function q(){B(document.querySelectorAll(".introjs-showElement"),function(t){O(t,/introjs-[a-zA-Z]+/g)})}function B(t,e,i){if(t)for(var n=0,o=t.length;n 1); if (isIOS || iOS13_iPad || isMobileAndroid || isTablet || isMobile) { localStorage.setItem('tour_visited_' + settings.tour.id, true); return; } function activeHandlerTaketest() { var tour_visited = localStorage.getItem('tour_visited_' + settings.tour.id); if (tour_visited) { $('body').removeClass('guide_tour_active'); if (settings.tour.type == 'reading') { Drupal.handlerReadingTest(); } else if (settings.tour.type == 'listening') { Drupal.handlerListeningTest(); } } } if ($('body').hasClass('anonymous-user')) { return; } var tour_first = settings.tour.first; var tour_visited = localStorage.getItem('tour_visited_' + settings.tour.id); if (!$('#first-tour-screen').length && !tour_visited) { $('body').addClass('guide_tour guide_tour_active'); $('body').append(''); $('#first-tour-screen').on('click', '.tour-tip-action .btn', function (e) { e.preventDefault(); $('#first-tour-screen').hide(); localStorage.setItem('tour_visited_' + settings.tour.id, true); if ($(this).hasClass('start-tour')) { var intro = introJs(); // Check element in array data settings.tour.data is exist. Object.keys(settings.tour.data).forEach(function (key) { var element = settings.tour.data[key]['element']; if (!$(element).length) { // Remove element in array data settings.tour.data. delete settings.tour.data[key]; } }); // Format key array data settings.tour.data. settings.tour.data = Object.values(settings.tour.data); intro.setOptions({ steps: settings.tour.data, exitOnOverlayClick: false, }); intro.start(); intro.oncomplete(function () { activeHandlerTaketest(); }); intro.onexit(function () { activeHandlerTaketest(); }); /*intro.oncomplete(function() {});*/ intro.onbeforechange(function (targetElement) { if (!checkVisible(targetElement) && $(targetElement).closest('.split-left').length) { $('#slpit-two').animate({ scrollTop: targetElement.offsetTop, }, 300, function () { intro.refresh(); }); } }); var scrollEnd; $(window).on('scroll', function () { if (scrollEnd) { clearTimeout(scrollEnd); } scrollEnd = setTimeout(function () { intro.refresh(); }, 100); }); } if ($(this).hasClass('dismiss')) { activeHandlerTaketest(); } }); } function checkVisible(elm, evalType) { evalType = evalType || 'visible'; var vpH = $(window).height(), // Viewport Height st = $(window).scrollTop(), // Scroll Top y = $(elm).offset().top, elementHeight = $(elm).height(); if (evalType === 'visible') { return ((y < (vpH + st)) && (y > (st - elementHeight))); } if (evalType === 'above') { return ((y < (vpH + st))); } } if ($('.show-instruction').length && $('#first-tour-screen').length) { $('.show-instruction').parent().on('click', function (e) { e.preventDefault(); $('#first-tour-screen').show(); }); } //Show if first visit var tour_visited = localStorage.getItem('tour_visited_' + settings.tour.id); if (tour_visited === null) { $('#first-tour-screen').show(); $('#stopwatch').addClass('paused'); } } } }; })(jQuery, Drupal, drupalSettings); ; /** * DO NOT EDIT THIS FILE. * See the following change record for more information, * https://www.drupal.org/node/2815083 * @preserve **/ (function ($, Drupal, drupalSettings) { $(document).ready(function () { $.ajax({ type: 'POST', cache: false, url: drupalSettings.statistics.url, data: drupalSettings.statistics.data }); }); })(jQuery, Drupal, drupalSettings);; /** * DO NOT EDIT THIS FILE. * See the following change record for more information, * https://www.drupal.org/node/2815083 * @preserve **/ (function ($, Drupal, drupalSettings, storage) { var currentUserID = parseInt(drupalSettings.user.uid, 10); var secondsIn30Days = 2592000; var thirtyDaysAgo = Math.round(new Date().getTime() / 1000) - secondsIn30Days; var embeddedLastReadTimestamps = false; if (drupalSettings.history && drupalSettings.history.lastReadTimestamps) { embeddedLastReadTimestamps = drupalSettings.history.lastReadTimestamps; } Drupal.history = { fetchTimestamps: function fetchTimestamps(nodeIDs, callback) { if (embeddedLastReadTimestamps) { callback(); return; } $.ajax({ url: Drupal.url('history/get_node_read_timestamps'), type: 'POST', data: { 'node_ids[]': nodeIDs }, dataType: 'json', success: function success(results) { Object.keys(results || {}).forEach(function (nodeID) { storage.setItem('Drupal.history.' + currentUserID + '.' + nodeID, results[nodeID]); }); callback(); } }); }, getLastRead: function getLastRead(nodeID) { if (embeddedLastReadTimestamps && embeddedLastReadTimestamps[nodeID]) { return parseInt(embeddedLastReadTimestamps[nodeID], 10); } return parseInt(storage.getItem('Drupal.history.' + currentUserID + '.' + nodeID) || 0, 10); }, markAsRead: function markAsRead(nodeID) { $.ajax({ url: Drupal.url('history/' + nodeID + '/read'), type: 'POST', dataType: 'json', success: function success(timestamp) { if (embeddedLastReadTimestamps && embeddedLastReadTimestamps[nodeID]) { return; } storage.setItem('Drupal.history.' + currentUserID + '.' + nodeID, timestamp); } }); }, needsServerCheck: function needsServerCheck(nodeID, contentTimestamp) { if (contentTimestamp < thirtyDaysAgo) { return false; } if (embeddedLastReadTimestamps && embeddedLastReadTimestamps[nodeID]) { return contentTimestamp > parseInt(embeddedLastReadTimestamps[nodeID], 10); } var minLastReadTimestamp = parseInt(storage.getItem('Drupal.history.' + currentUserID + '.' + nodeID) || 0, 10); return contentTimestamp > minLastReadTimestamp; } }; })(jQuery, Drupal, drupalSettings, window.localStorage);; /** * DO NOT EDIT THIS FILE. * See the following change record for more information, * https://www.drupal.org/node/2815083 * @preserve **/ (function (window, Drupal, drupalSettings) { window.addEventListener('load', function () { if (drupalSettings.history && drupalSettings.history.nodesToMarkAsRead) { Object.keys(drupalSettings.history.nodesToMarkAsRead).forEach(Drupal.history.markAsRead); } }); })(window, Drupal, drupalSettings);; !function o(a,s,l){function c(t,e){if(!s[t]){if(!a[t]){var n="function"==typeof require&&require;if(!e&&n)return n(t,!0);if(u)return u(t,!0);var r=new Error("Cannot find module '"+t+"'");throw r.code="MODULE_NOT_FOUND",r}var i=s[t]={exports:{}};a[t][0].call(i.exports,function(e){return c(a[t][1][e]||e)},i,i.exports,o,a,s,l)}return s[t].exports}for(var u="function"==typeof require&&require,e=0;e>1,u=23===t?z(2,-24)-z(2,-77):0,f=e<0||0===e&&1/e<0?1:0,p=0;for((e=U(e))!=e||e===1/0?(i=e!=e?1:0,r=l):(r=q(B(e)/G),e*(o=z(2,-r))<1&&(r--,o*=2),2<=(e+=1<=r+c?u/o:u*z(2,1-c))*o&&(r++,o/=2),l<=r+c?(i=0,r=l):1<=r+c?(i=(e*o-1)*z(2,t),r+=c):(i=e*z(2,c-1)*z(2,t),r=0));8<=t;a[p++]=255&i,i/=256,t-=8);for(r=r<>1,s=i-7,l=r-1,c=e[l--],u=127&c;for(c>>=7;0>=-s,s+=t;0>8&255]}function l(e){return[255&e,e>>8&255,e>>16&255,e>>24&255]}function c(e){return r(e,23,4)}function u(e){return r(e,52,8)}function f(e,t){S(e[_],t,{get:function(){return N(this)[t]}})}function p(e,t,n,r){var i=E(+n),o=N(e);if(i+t>o.byteLength)throw F(M);var a=N(o.buffer).bytes,s=i+o.byteOffset,l=a.slice(s,s+t);return r?l:l.reverse()}function d(e,t,n,r,i,o){var a=E(+n),s=N(e);if(a+t>s.byteLength)throw F(M);for(var l=N(s.buffer).bytes,c=a+s.byteOffset,u=r(+i),f=0;fX;)(V=Y[X++])in C||m(C,V,L[V]);W.constructor=C}var J=new D(new C(2)),$=D[_].setInt8;J.setInt8(0,2147483648),J.setInt8(1,2147483649),!J.getInt8(0)&&J.getInt8(1)||b(D[_],{setInt8:function(e,t){$.call(this,e,t<<24>>24)},setUint8:function(e,t){$.call(this,e,t<<24>>24)}},{unsafe:!0})}else C=function(e){x(this,C,P);var t=E(e);R(this,{bytes:A.call(new Array(t),0),byteLength:t}),g||(this.byteLength=t)},D=function(e,t,n){x(this,D,I),x(e,C,I);var r=N(e).byteLength,i=w(t);if(i<0||r>24},getUint8:function(e){return p(this,1,e)[0]},getInt16:function(e,t){var n=p(this,2,e,1>16},getUint16:function(e,t){var n=p(this,2,e,1>>0},getFloat32:function(e,t){return i(p(this,4,e,1"+i+""}},{"../internals/require-object-coercible":116}],32:[function(e,t,n){"use strict";function i(){return this}var o=e("../internals/iterators-core").IteratorPrototype,a=e("../internals/object-create"),s=e("../internals/create-property-descriptor"),l=e("../internals/set-to-string-tag"),c=e("../internals/iterators");t.exports=function(e,t,n){var r=t+" Iterator";return e.prototype=a(o,{next:s(1,n)}),l(e,r,!1,!0),c[r]=i,e}},{"../internals/create-property-descriptor":33,"../internals/iterators":76,"../internals/iterators-core":75,"../internals/object-create":90,"../internals/set-to-string-tag":120}],33:[function(e,t,n){t.exports=function(e,t){return{enumerable:!(1&e),configurable:!(2&e),writable:!(4&e),value:t}}},{}],34:[function(e,t,n){"use strict";var i=e("../internals/to-primitive"),o=e("../internals/object-define-property"),a=e("../internals/create-property-descriptor");t.exports=function(e,t,n){var r=i(t);r in e?o.f(e,r,a(0,n)):e[r]=n}},{"../internals/create-property-descriptor":33,"../internals/object-define-property":92,"../internals/to-primitive":138}],35:[function(e,t,n){"use strict";var r=e("../internals/fails"),i=e("../internals/string-pad").start,o=Math.abs,a=Date.prototype,s=a.getTime,l=a.toISOString;t.exports=r(function(){return"0385-07-25T07:06:39.999Z"!=l.call(new Date(-5e13-1))})||!r(function(){l.call(new Date(NaN))})?function(){if(!isFinite(s.call(this)))throw RangeError("Invalid time value");var e=this,t=e.getUTCFullYear(),n=e.getUTCMilliseconds(),r=t<0?"-":9999")}),b=!d(function(){var e=/(?:)/,t=e.exec;e.exec=function(){return t.apply(this,arguments)};var n="ab".split(e);return 2!==n.length||"a"!==n[0]||"b"!==n[1]});t.exports=function(n,e,t,r){var i=h(n),o=!d(function(){var e={};return e[i]=function(){return 7},7!=""[n](e)}),a=o&&!d(function(){var e=!1,t=/a/;return t.exec=function(){return e=!0,null},"split"===n&&(t.constructor={},t.constructor[y]=function(){return t}),t[i](""),!e});if(!o||!a||"replace"===n&&!m||"split"===n&&!b){var s=/./[i],l=t(i,""[n],function(e,t,n,r,i){return t.exec===g?o&&!i?{done:!0,value:s.call(t,n,r)}:{done:!0,value:e.call(n,t,r)}:{done:!1}}),c=l[0],u=l[1];p(String.prototype,n,c),p(RegExp.prototype,i,2==e?function(e,t){return u.call(e,this,t)}:function(e){return u.call(e,this)}),r&&f(RegExp.prototype[i],"sham",!0)}}},{"../internals/fails":44,"../internals/hide":59,"../internals/redefine":112,"../internals/regexp-exec":114,"../internals/well-known-symbol":145}],46:[function(e,t,n){"use strict";var p=e("../internals/is-array"),d=e("../internals/to-length"),h=e("../internals/bind-context"),g=function(e,t,n,r,i,o,a,s){for(var l,c=i,u=0,f=!!a&&h(a,s,3);udocument.F=Object"),e.close(),p=e.F;n--;)delete p[f][a[n]];return p()};t.exports=Object.create||function(e,t){var n;return null!==e?(r[f]=i(e),n=new r,r[f]=null,n[u]=e):n=p(),void 0===t?n:o(n,t)},s[u]=!0},{"../internals/an-object":7,"../internals/document-create-element":40,"../internals/enum-bug-keys":42,"../internals/hidden-keys":58,"../internals/html":61,"../internals/object-define-properties":91,"../internals/shared-key":121}],91:[function(e,t,n){var r=e("../internals/descriptors"),a=e("../internals/object-define-property"),s=e("../internals/an-object"),l=e("../internals/object-keys");t.exports=r?Object.defineProperties:function(e,t){s(e);for(var n,r=l(t),i=r.length,o=0;oi;)a(r,n=t[i++])&&(~l(o,n)||o.push(n));return o}},{"../internals/array-includes":14,"../internals/has":57,"../internals/hidden-keys":58,"../internals/to-indexed-object":133}],99:[function(e,t,n){var r=e("../internals/object-keys-internal"),i=e("../internals/enum-bug-keys");t.exports=Object.keys||function(e){return r(e,i)}},{"../internals/enum-bug-keys":42,"../internals/object-keys-internal":98}],100:[function(e,t,n){"use strict";var r={}.propertyIsEnumerable,i=Object.getOwnPropertyDescriptor,o=i&&!r.call({1:2},1);n.f=o?function(e){var t=i(this,e);return!!t&&t.enumerable}:r},{}],101:[function(e,t,n){var i=e("../internals/an-object"),o=e("../internals/a-possible-prototype");t.exports=Object.setPrototypeOf||("__proto__"in{}?function(){var n,r=!1,e={};try{(n=Object.getOwnPropertyDescriptor(Object.prototype,"__proto__").set).call(e,[]),r=e instanceof Array}catch(e){}return function(e,t){return i(e),o(t),r?n.call(e,t):e.__proto__=t,e}}():void 0)},{"../internals/a-possible-prototype":3,"../internals/an-object":7}],102:[function(e,t,n){function r(s){return function(e){for(var t,n=u(e),r=c(n),i=r.length,o=0,a=[];o>>0||(s.test(n)?16:10))}:a},{"../internals/global":56,"../internals/string-trim":128,"../internals/whitespaces":146}],107:[function(e,t,n){t.exports=e("../internals/global")},{"../internals/global":56}],108:[function(e,t,n){t.exports=function(e){try{return{error:!1,value:e()}}catch(e){return{error:!0,value:e}}}},{}],109:[function(e,t,n){var r=e("../internals/an-object"),i=e("../internals/is-object"),o=e("../internals/new-promise-capability");t.exports=function(e,t){if(r(e),i(t)&&t.constructor===e)return t;var n=o.f(e);return(0,n.resolve)(t),n.promise}},{"../internals/an-object":7,"../internals/is-object":71,"../internals/new-promise-capability":86}],110:[function(e,t,n){"use strict";function m(e){return e+22+75*(e<26)}function b(e,t,n){var r=0;for(e=n?w(e/700):e>>1,e+=w(e/t);455w((v-a)/f))throw RangeError(x);for(a+=(u-o)*f,o=u,t=0;tv)throw RangeError(x);if(n==o){for(var p=a,d=36;;d+=36){var h=d<=s?1:s+26<=d?26:d-s;if(pr&&(i=i.slice(0,r)),c?o+i:i+o)}}var u=e("../internals/to-length"),f=e("../internals/string-repeat"),p=e("../internals/require-object-coercible"),d=Math.ceil;t.exports={start:r(!1),end:r(!0)}},{"../internals/require-object-coercible":116,"../internals/string-repeat":127,"../internals/to-length":135}],127:[function(e,t,n){"use strict";var i=e("../internals/to-integer"),o=e("../internals/require-object-coercible");t.exports="".repeat||function(e){var t=String(o(this)),n="",r=i(e);if(r<0||r==1/0)throw RangeError("Wrong number of repetitions");for(;0>>=1)&&(t+=t))1&r&&(n+=t);return n}},{"../internals/require-object-coercible":116,"../internals/to-integer":134}],128:[function(e,t,n){function r(n){return function(e){var t=String(i(e));return 1&n&&(t=t.replace(a,"")),2&n&&(t=t.replace(s,"")),t}}var i=e("../internals/require-object-coercible"),o="["+e("../internals/whitespaces")+"]",a=RegExp("^"+o+o+"*"),s=RegExp(o+o+"*$");t.exports={start:r(1),end:r(2),trim:r(3)}},{"../internals/require-object-coercible":116,"../internals/whitespaces":146}],129:[function(e,t,n){function r(e){if(E.hasOwnProperty(e)){var t=E[e];delete E[e],t()}}function i(e){return function(){r(e)}}function o(e){r(e.data)}function a(e){u.postMessage(e+"",y.protocol+"//"+y.host)}var s,l,c,u=e("../internals/global"),f=e("../internals/fails"),p=e("../internals/classof-raw"),d=e("../internals/bind-context"),h=e("../internals/html"),g=e("../internals/document-create-element"),y=u.location,m=u.setImmediate,b=u.clearImmediate,v=u.process,x=u.MessageChannel,w=u.Dispatch,j=0,E={},T="onreadystatechange";m&&b||(m=function(e){for(var t=[],n=1;n=t.length?{value:e.target=void 0,done:!0}:"keys"==n?{value:r,done:!1}:"values"==n?{value:t[r],done:!1}:{value:[r,t[r]],done:!1}},"values"),o.Arguments=o.Array,i("keys"),i("values"),i("entries")},{"../internals/add-to-unscopables":4,"../internals/define-iterator":37,"../internals/internal-state":66,"../internals/iterators":76,"../internals/to-indexed-object":133}],166:[function(e,t,n){"use strict";var r=e("../internals/export"),i=e("../internals/indexed-object"),o=e("../internals/to-indexed-object"),a=e("../internals/sloppy-array-method"),s=[].join,l=i!=Object,c=a("join",",");r({target:"Array",proto:!0,forced:l||c},{join:function(e){return s.call(o(this),void 0===e?",":e)}})},{"../internals/export":43,"../internals/indexed-object":63,"../internals/sloppy-array-method":123,"../internals/to-indexed-object":133}],167:[function(e,t,n){var r=e("../internals/export"),i=e("../internals/array-last-index-of");r({target:"Array",proto:!0,forced:i!==[].lastIndexOf},{lastIndexOf:i})},{"../internals/array-last-index-of":16,"../internals/export":43}],168:[function(e,t,n){"use strict";var r=e("../internals/export"),i=e("../internals/array-iteration").map;r({target:"Array",proto:!0,forced:!e("../internals/array-method-has-species-support")("map")},{map:function(e,t){return i(this,e,1>>=0)?31-i(o(e+.5)*a):32}})},{"../internals/export":43}],196:[function(e,t,n){var r=e("../internals/export"),i=e("../internals/math-expm1"),o=Math.cosh,a=Math.abs,s=Math.E;r({target:"Math",stat:!0,forced:!o||o(710)===1/0},{cosh:function(e){var t=i(a(e)-1)+1;return(t+1/(t*s*s))*(s/2)}})},{"../internals/export":43,"../internals/math-expm1":77}],197:[function(e,t,n){var r=e("../internals/export"),i=e("../internals/math-expm1");r({target:"Math",stat:!0,forced:i!=Math.expm1},{expm1:i})},{"../internals/export":43,"../internals/math-expm1":77}],198:[function(e,t,n){e("../internals/export")({target:"Math",stat:!0},{fround:e("../internals/math-fround")})},{"../internals/export":43,"../internals/math-fround":78}],199:[function(e,t,n){var r=e("../internals/export"),i=Math.hypot,l=Math.abs,c=Math.sqrt;r({target:"Math",stat:!0,forced:!!i&&i(1/0,NaN)!==1/0},{hypot:function(e,t){for(var n,r,i=0,o=0,a=arguments.length,s=0;o>>16)*a+o*(n&i>>>16)<<16>>>0)}})},{"../internals/export":43,"../internals/fails":44}],201:[function(e,t,n){var r=e("../internals/export"),i=Math.log,o=Math.LOG10E;r({target:"Math",stat:!0},{log10:function(e){return i(e)*o}})},{"../internals/export":43}],202:[function(e,t,n){e("../internals/export")({target:"Math",stat:!0},{log1p:e("../internals/math-log1p")})},{"../internals/export":43,"../internals/math-log1p":79}],203:[function(e,t,n){var r=e("../internals/export"),i=Math.log,o=Math.LN2;r({target:"Math",stat:!0},{log2:function(e){return i(e)/o}})},{"../internals/export":43}],204:[function(e,t,n){e("../internals/export")({target:"Math",stat:!0},{sign:e("../internals/math-sign")})},{"../internals/export":43,"../internals/math-sign":80}],205:[function(e,t,n){var r=e("../internals/export"),i=e("../internals/fails"),o=e("../internals/math-expm1"),a=Math.abs,s=Math.exp,l=Math.E;r({target:"Math",stat:!0,forced:i(function(){return-2e-17!=Math.sinh(-2e-17)})},{sinh:function(e){return a(e=+e)<1?(o(e)-o(-e))/2:(s(e-1)-s(-e-1))*(l/2)}})},{"../internals/export":43,"../internals/fails":44,"../internals/math-expm1":77}],206:[function(e,t,n){var r=e("../internals/export"),i=e("../internals/math-expm1"),o=Math.exp;r({target:"Math",stat:!0},{tanh:function(e){var t=i(e=+e),n=i(-e);return t==1/0?1:n==1/0?-1:(t-n)/(o(e)+o(-e))}})},{"../internals/export":43,"../internals/math-expm1":77}],207:[function(e,t,n){e("../internals/set-to-string-tag")(Math,"Math",!0)},{"../internals/set-to-string-tag":120}],208:[function(e,t,n){var r=e("../internals/export"),i=Math.ceil,o=Math.floor;r({target:"Math",stat:!0},{trunc:function(e){return(0S;S++)l(v,j=T[S])&&!l(E,j)&&y(E,j,g(v,j));(E.prototype=x).constructor=E,s(o,b,E)}},{"../internals/classof-raw":23,"../internals/descriptors":39,"../internals/fails":44,"../internals/global":56,"../internals/has":57,"../internals/inherit-if-required":64,"../internals/is-forced":69,"../internals/object-create":90,"../internals/object-define-property":92,"../internals/object-get-own-property-descriptor":93,"../internals/object-get-own-property-names":95,"../internals/redefine":112,"../internals/string-trim":128,"../internals/to-primitive":138}],210:[function(e,t,n){e("../internals/export")({target:"Number",stat:!0},{EPSILON:Math.pow(2,-52)})},{"../internals/export":43}],211:[function(e,t,n){e("../internals/export")({target:"Number",stat:!0},{isFinite:e("../internals/number-is-finite")})},{"../internals/export":43,"../internals/number-is-finite":88}],212:[function(e,t,n){e("../internals/export")({target:"Number",stat:!0},{isInteger:e("../internals/is-integer")})},{"../internals/export":43,"../internals/is-integer":70}],213:[function(e,t,n){e("../internals/export")({target:"Number",stat:!0},{isNaN:function(e){return e!=e}})},{"../internals/export":43}],214:[function(e,t,n){var r=e("../internals/export"),i=e("../internals/is-integer"),o=Math.abs;r({target:"Number",stat:!0},{isSafeInteger:function(e){return i(e)&&o(e)<=9007199254740991}})},{"../internals/export":43,"../internals/is-integer":70}],215:[function(e,t,n){e("../internals/export")({target:"Number",stat:!0},{MAX_SAFE_INTEGER:9007199254740991})},{"../internals/export":43}],216:[function(e,t,n){e("../internals/export")({target:"Number",stat:!0},{MIN_SAFE_INTEGER:-9007199254740991})},{"../internals/export":43}],217:[function(e,t,n){var r=e("../internals/export"),i=e("../internals/parse-float");r({target:"Number",stat:!0,forced:Number.parseFloat!=i},{parseFloat:i})},{"../internals/export":43,"../internals/parse-float":105}],218:[function(e,t,n){var r=e("../internals/export"),i=e("../internals/parse-int");r({target:"Number",stat:!0,forced:Number.parseInt!=i},{parseInt:i})},{"../internals/export":43,"../internals/parse-int":106}],219:[function(e,t,n){"use strict";var r=e("../internals/export"),d=e("../internals/to-integer"),h=e("../internals/this-number-value"),g=e("../internals/string-repeat"),i=e("../internals/fails"),o=1..toFixed,y=Math.floor,m=function(e,t,n){return 0===t?n:t%2==1?m(e,t-1,n*e):m(e*e,t/2,n)};r({target:"Number",proto:!0,forced:o&&("0.000"!==8e-5.toFixed(3)||"1"!==.9.toFixed(0)||"1.25"!==1.255.toFixed(2)||"1000000000000000128"!==(0xde0b6b3a7640080).toFixed(0))||!i(function(){o.call({})})},{toFixed:function(e){function t(e,t){for(var n=-1,r=t;++n<6;)r+=e*u[n],u[n]=r%1e7,r=y(r/1e7)}function n(e){for(var t=6,n=0;0<=--t;)n+=u[t],u[t]=y(n/e),n=n%e*1e7}function r(){for(var e=6,t="";0<=--e;)if(""!==t||0===e||0!==u[e]){var n=String(u[e]);t=""===t?n:t+g.call("0",7-n.length)+n}return t}var i,o,a,s,l=h(this),c=d(e),u=[0,0,0,0,0,0],f="",p="0";if(c<0||20s;)void 0!==(n=i(r,t=o[s++]))&&f(a,t,n);return a}})},{"../internals/create-property":34,"../internals/descriptors":39,"../internals/export":43,"../internals/object-get-own-property-descriptor":93,"../internals/own-keys":104,"../internals/to-indexed-object":133}],232:[function(e,t,n){var r=e("../internals/export"),i=e("../internals/fails"),o=e("../internals/object-get-own-property-names-external").f;r({target:"Object",stat:!0,forced:i(function(){return!Object.getOwnPropertyNames(1)})},{getOwnPropertyNames:o})},{"../internals/export":43,"../internals/fails":44,"../internals/object-get-own-property-names-external":94}],233:[function(e,t,n){var r=e("../internals/export"),i=e("../internals/fails"),o=e("../internals/to-object"),a=e("../internals/object-get-prototype-of"),s=e("../internals/correct-prototype-getter");r({target:"Object",stat:!0,forced:i(function(){a(1)}),sham:!s},{getPrototypeOf:function(e){return a(o(e))}})},{"../internals/correct-prototype-getter":30,"../internals/export":43,"../internals/fails":44,"../internals/object-get-prototype-of":97,"../internals/to-object":136}],234:[function(e,t,n){var r=e("../internals/export"),i=e("../internals/fails"),o=e("../internals/is-object"),a=Object.isExtensible;r({target:"Object",stat:!0,forced:i(function(){a(1)})},{isExtensible:function(e){return!!o(e)&&(!a||a(e))}})},{"../internals/export":43,"../internals/fails":44,"../internals/is-object":71}],235:[function(e,t,n){var r=e("../internals/export"),i=e("../internals/fails"),o=e("../internals/is-object"),a=Object.isFrozen;r({target:"Object",stat:!0,forced:i(function(){a(1)})},{isFrozen:function(e){return!o(e)||!!a&&a(e)}})},{"../internals/export":43,"../internals/fails":44,"../internals/is-object":71}],236:[function(e,t,n){var r=e("../internals/export"),i=e("../internals/fails"),o=e("../internals/is-object"),a=Object.isSealed;r({target:"Object",stat:!0,forced:i(function(){a(1)})},{isSealed:function(e){return!o(e)||!!a&&a(e)}})},{"../internals/export":43,"../internals/fails":44,"../internals/is-object":71}],237:[function(e,t,n){e("../internals/export")({target:"Object",stat:!0},{is:e("../internals/same-value")})},{"../internals/export":43,"../internals/same-value":117}],238:[function(e,t,n){var r=e("../internals/export"),i=e("../internals/to-object"),o=e("../internals/object-keys");r({target:"Object",stat:!0,forced:e("../internals/fails")(function(){o(1)})},{keys:function(e){return o(i(e))}})},{"../internals/export":43,"../internals/fails":44,"../internals/object-keys":99,"../internals/to-object":136}],239:[function(e,t,n){"use strict";var r=e("../internals/export"),i=e("../internals/descriptors"),o=e("../internals/forced-object-prototype-accessors-methods"),a=e("../internals/to-object"),s=e("../internals/to-primitive"),l=e("../internals/object-get-prototype-of"),c=e("../internals/object-get-own-property-descriptor").f;i&&r({target:"Object",proto:!0,forced:o},{__lookupGetter__:function(e){var t,n=a(this),r=s(e,!0);do{if(t=c(n,r))return t.get}while(n=l(n))}})},{"../internals/descriptors":39,"../internals/export":43,"../internals/forced-object-prototype-accessors-methods":47,"../internals/object-get-own-property-descriptor":93,"../internals/object-get-prototype-of":97,"../internals/to-object":136,"../internals/to-primitive":138}],240:[function(e,t,n){"use strict";var r=e("../internals/export"),i=e("../internals/descriptors"),o=e("../internals/forced-object-prototype-accessors-methods"),a=e("../internals/to-object"),s=e("../internals/to-primitive"),l=e("../internals/object-get-prototype-of"),c=e("../internals/object-get-own-property-descriptor").f;i&&r({target:"Object",proto:!0,forced:o},{__lookupSetter__:function(e){var t,n=a(this),r=s(e,!0);do{if(t=c(n,r))return t.set}while(n=l(n))}})},{"../internals/descriptors":39,"../internals/export":43,"../internals/forced-object-prototype-accessors-methods":47,"../internals/object-get-own-property-descriptor":93,"../internals/object-get-prototype-of":97,"../internals/to-object":136,"../internals/to-primitive":138}],241:[function(e,t,n){var r=e("../internals/export"),i=e("../internals/is-object"),o=e("../internals/internal-metadata").onFreeze,a=e("../internals/freezing"),s=e("../internals/fails"),l=Object.preventExtensions;r({target:"Object",stat:!0,forced:s(function(){l(1)}),sham:!a},{preventExtensions:function(e){return l&&i(e)?l(o(e)):e}})},{"../internals/export":43,"../internals/fails":44,"../internals/freezing":50,"../internals/internal-metadata":65,"../internals/is-object":71}],242:[function(e,t,n){var r=e("../internals/export"),i=e("../internals/is-object"),o=e("../internals/internal-metadata").onFreeze,a=e("../internals/freezing"),s=e("../internals/fails"),l=Object.seal;r({target:"Object",stat:!0,forced:s(function(){l(1)}),sham:!a},{seal:function(e){return l&&i(e)?l(o(e)):e}})},{"../internals/export":43,"../internals/fails":44,"../internals/freezing":50,"../internals/internal-metadata":65,"../internals/is-object":71}],243:[function(e,t,n){e("../internals/export")({target:"Object",stat:!0},{setPrototypeOf:e("../internals/object-set-prototype-of")})},{"../internals/export":43,"../internals/object-set-prototype-of":101}],244:[function(e,t,n){var r=e("../internals/redefine"),i=e("../internals/object-to-string"),o=Object.prototype;i!==o.toString&&r(o,"toString",i,{unsafe:!0})},{"../internals/object-to-string":103,"../internals/redefine":112}],245:[function(e,t,n){var r=e("../internals/export"),i=e("../internals/object-to-array").values;r({target:"Object",stat:!0},{values:function(e){return i(e)}})},{"../internals/export":43,"../internals/object-to-array":102}],246:[function(e,t,n){var r=e("../internals/export"),i=e("../internals/parse-float");r({global:!0,forced:parseFloat!=i},{parseFloat:i})},{"../internals/export":43,"../internals/parse-float":105}],247:[function(e,t,n){var r=e("../internals/export"),i=e("../internals/parse-int");r({global:!0,forced:parseInt!=i},{parseInt:i})},{"../internals/export":43,"../internals/parse-int":106}],248:[function(e,t,n){"use strict";var r=e("../internals/export"),c=e("../internals/a-function"),i=e("../internals/new-promise-capability"),o=e("../internals/perform"),u=e("../internals/iterate");r({target:"Promise",stat:!0},{allSettled:function(e){var s=this,t=i.f(s),l=t.resolve,n=t.reject,r=o(function(){var r=c(s.resolve),i=[],o=0,a=1;u(e,function(e){var t=o++,n=!1;i.push(void 0),a++,r.call(s,e).then(function(e){n||(n=!0,i[t]={status:"fulfilled",value:e},--a||l(i))},function(e){n||(n=!0,i[t]={status:"rejected",reason:e},--a||l(i))})}),--a||l(i)});return r.error&&n(r.value),t.promise}})},{"../internals/a-function":2,"../internals/export":43,"../internals/iterate":74,"../internals/new-promise-capability":86,"../internals/perform":108}],249:[function(e,t,n){"use strict";var r=e("../internals/export"),i=e("../internals/is-pure"),o=e("../internals/native-promise-constructor"),a=e("../internals/get-built-in"),s=e("../internals/species-constructor"),l=e("../internals/promise-resolve"),c=e("../internals/redefine");r({target:"Promise",proto:!0,real:!0},{finally:function(t){var n=s(this,a("Promise")),e="function"==typeof t;return this.then(e?function(e){return l(n,t()).then(function(){return e})}:t,e?function(e){return l(n,t()).then(function(){throw e})}:t)}}),i||"function"!=typeof o||o.prototype.finally||c(o.prototype,"finally",a("Promise").prototype.finally)},{"../internals/export":43,"../internals/get-built-in":53,"../internals/is-pure":72,"../internals/native-promise-constructor":82,"../internals/promise-resolve":109,"../internals/redefine":112,"../internals/species-constructor":124}],250:[function(e,t,n){"use strict";function g(e){var t;return!(!w(e)||"function"!=typeof(t=e.then))&&t}function o(f,p,d){if(!p.notified){p.notified=!0;var h=p.reactions;N(function(){for(var e=p.value,t=1==p.state,n=0;h.length>n;){var r,i,o,a=h[n++],s=t?a.ok:a.fail,l=a.resolve,c=a.reject,u=a.domain;try{s?(t||(2===p.rejection&&ie(f,p),p.rejection=1),!0===s?r=e:(u&&u.enter(),r=s(e),u&&(u.exit(),o=!0)),r===a.promise?c(B("Promise-chain cycle")):(i=g(r))?i.call(r,l,c):l(r)):c(e)}catch(e){u&&!o&&u.exit(),c(e)}}p.reactions=[],p.notified=!1,d&&!p.rejection&&ne(f,p)})}}function i(e,t,n){var r,i;K?((r=G.createEvent("Event")).promise=t,r.reason=n,r.initEvent(e,!1,!0),d.dispatchEvent(r)):r={promise:t,reason:n},(i=d["on"+e])?i(r):e===Z&&P("Unhandled promise rejection",n)}function a(t,n,r,i){return function(e){t(n,r,e,i)}}function s(e,t,n,r){t.done||(t.done=!0,r&&(t=r),t.value=n,t.state=2,o(e,t,!0))}var r,l,c,u,f=e("../internals/export"),p=e("../internals/is-pure"),d=e("../internals/global"),h=e("../internals/path"),y=e("../internals/native-promise-constructor"),m=e("../internals/redefine"),b=e("../internals/redefine-all"),v=e("../internals/set-to-string-tag"),x=e("../internals/set-species"),w=e("../internals/is-object"),j=e("../internals/a-function"),E=e("../internals/an-instance"),T=e("../internals/classof-raw"),S=e("../internals/iterate"),A=e("../internals/check-correctness-of-iteration"),O=e("../internals/species-constructor"),k=e("../internals/task").set,N=e("../internals/microtask"),R=e("../internals/promise-resolve"),P=e("../internals/host-report-errors"),I=e("../internals/new-promise-capability"),_=e("../internals/perform"),M=e("../internals/user-agent"),L=e("../internals/internal-state"),C=e("../internals/is-forced"),D=e("../internals/well-known-symbol")("species"),H="Promise",F=L.get,U=L.set,z=L.getterFor(H),q=y,B=d.TypeError,G=d.document,V=d.process,W=d.fetch,Y=V&&V.versions,X=Y&&Y.v8||"",J=I.f,$=J,Q="process"==T(V),K=!!(G&&G.createEvent&&d.dispatchEvent),Z="unhandledrejection",ee=C(H,function(){function t(){}var e=q.resolve(1),n=(e.constructor={})[D]=function(e){e(t,t)};return!((Q||"function"==typeof PromiseRejectionEvent)&&(!p||e.finally)&&e.then(t)instanceof n&&0!==X.indexOf("6.6")&&-1===M.indexOf("Chrome/66"))}),te=ee||!A(function(e){q.all(e).catch(function(){})}),ne=function(n,r){k.call(d,function(){var e,t=r.value;if(re(r)&&(e=_(function(){Q?V.emit("unhandledRejection",t,n):i(Z,n,t)}),r.rejection=Q||re(r)?2:1,e.error))throw e.value})},re=function(e){return 1!==e.rejection&&!e.parent},ie=function(e,t){k.call(d,function(){Q?V.emit("rejectionHandled",e):i("rejectionhandled",e,t.value)})},oe=function(n,r,e,t){if(!r.done){r.done=!0,t&&(r=t);try{if(n===e)throw B("Promise can't be resolved itself");var i=g(e);i?N(function(){var t={done:!1};try{i.call(e,a(oe,n,t,r),a(s,n,t,r))}catch(e){s(n,t,e,r)}}):(r.value=e,r.state=1,o(n,r,!1))}catch(e){s(n,{done:!1},e,r)}}};ee&&(q=function(e){E(this,q,H),j(e),r.call(this);var t=F(this);try{e(a(oe,this,t),a(s,this,t))}catch(e){s(this,t,e)}},(r=function(e){U(this,{type:H,done:!1,notified:!1,parent:!1,reactions:[],rejection:!1,state:0,value:void 0})}).prototype=b(q.prototype,{then:function(e,t){var n=z(this),r=J(O(this,q));return r.ok="function"!=typeof e||e,r.fail="function"==typeof t&&t,r.domain=Q?V.domain:void 0,n.parent=!0,n.reactions.push(r),0!=n.state&&o(this,n,!1),r.promise},catch:function(e){return this.then(void 0,e)}}),l=function(){var e=new r,t=F(e);this.promise=e,this.resolve=a(oe,e,t),this.reject=a(s,e,t)},I.f=J=function(e){return e===q||e===c?new l(e):$(e)},p||"function"!=typeof y||(u=y.prototype.then,m(y.prototype,"then",function(e,t){var n=this;return new q(function(e,t){u.call(n,e,t)}).then(e,t)}),"function"==typeof W&&f({global:!0,enumerable:!0,forced:!0},{fetch:function(e){return R(q,W.apply(d,arguments))}}))),f({global:!0,wrap:!0,forced:ee},{Promise:q}),v(q,H,!1,!0),x(H),c=h[H],f({target:H,stat:!0,forced:ee},{reject:function(e){var t=J(this);return t.reject.call(void 0,e),t.promise}}),f({target:H,stat:!0,forced:p||ee},{resolve:function(e){return R(p&&this===c?q:this,e)}}),f({target:H,stat:!0,forced:te},{all:function(e){var s=this,t=J(s),l=t.resolve,c=t.reject,n=_(function(){var r=j(s.resolve),i=[],o=0,a=1;S(e,function(e){var t=o++,n=!1;i.push(void 0),a++,r.call(s,e).then(function(e){n||(n=!0,i[t]=e,--a||l(i))},c)}),--a||l(i)});return n.error&&c(n.value),t.promise},race:function(e){var n=this,r=J(n),i=r.reject,t=_(function(){var t=j(n.resolve);S(e,function(e){t.call(n,e).then(r.resolve,i)})});return t.error&&i(t.value),r.promise}})},{"../internals/a-function":2,"../internals/an-instance":6,"../internals/check-correctness-of-iteration":22,"../internals/classof-raw":23,"../internals/export":43,"../internals/global":56,"../internals/host-report-errors":60,"../internals/internal-state":66,"../internals/is-forced":69,"../internals/is-object":71,"../internals/is-pure":72,"../internals/iterate":74,"../internals/microtask":81,"../internals/native-promise-constructor":82,"../internals/new-promise-capability":86,"../internals/path":107,"../internals/perform":108,"../internals/promise-resolve":109,"../internals/redefine":112,"../internals/redefine-all":111,"../internals/set-species":119,"../internals/set-to-string-tag":120,"../internals/species-constructor":124,"../internals/task":129,"../internals/user-agent":143,"../internals/well-known-symbol":145}],251:[function(e,t,n){var r=e("../internals/export"),i=e("../internals/get-built-in"),o=e("../internals/a-function"),a=e("../internals/an-object"),s=e("../internals/fails"),l=i("Reflect","apply"),c=Function.apply;r({target:"Reflect",stat:!0,forced:!s(function(){l(function(){})})},{apply:function(e,t,n){return o(e),a(n),l?l(e,t,n):c.call(e,t,n)}})},{"../internals/a-function":2,"../internals/an-object":7,"../internals/export":43,"../internals/fails":44,"../internals/get-built-in":53}],252:[function(e,t,n){var r=e("../internals/export"),i=e("../internals/get-built-in"),l=e("../internals/a-function"),c=e("../internals/an-object"),u=e("../internals/is-object"),f=e("../internals/object-create"),p=e("../internals/function-bind"),o=e("../internals/fails"),d=i("Reflect","construct"),h=o(function(){function e(){}return!(d(function(){},[],e)instanceof e)}),g=!o(function(){d(function(){})}),a=h||g;r({target:"Reflect",stat:!0,forced:a,sham:a},{construct:function(e,t,n){l(e),c(t);var r=arguments.length<3?e:l(n);if(g&&!h)return d(e,t,r);if(e==r){switch(t.length){case 0:return new e;case 1:return new e(t[0]);case 2:return new e(t[0],t[1]);case 3:return new e(t[0],t[1],t[2]);case 4:return new e(t[0],t[1],t[2],t[3])}var i=[null];return i.push.apply(i,t),new(p.apply(e,i))}var o=r.prototype,a=f(u(o)?o:Object.prototype),s=Function.apply.call(e,a,t);return u(s)?s:a}})},{"../internals/a-function":2,"../internals/an-object":7,"../internals/export":43,"../internals/fails":44,"../internals/function-bind":51,"../internals/get-built-in":53,"../internals/is-object":71,"../internals/object-create":90}],253:[function(e,t,n){var r=e("../internals/export"),i=e("../internals/descriptors"),o=e("../internals/an-object"),a=e("../internals/to-primitive"),s=e("../internals/object-define-property");r({target:"Reflect",stat:!0,forced:e("../internals/fails")(function(){Reflect.defineProperty(s.f({},1,{value:1}),1,{value:2})}),sham:!i},{defineProperty:function(e,t,n){o(e);var r=a(t,!0);o(n);try{return s.f(e,r,n),!0}catch(e){return!1}}})},{"../internals/an-object":7,"../internals/descriptors":39,"../internals/export":43,"../internals/fails":44,"../internals/object-define-property":92,"../internals/to-primitive":138}],254:[function(e,t,n){var r=e("../internals/export"),i=e("../internals/an-object"),o=e("../internals/object-get-own-property-descriptor").f;r({target:"Reflect",stat:!0},{deleteProperty:function(e,t){var n=o(i(e),t);return!(n&&!n.configurable)&&delete e[t]}})},{"../internals/an-object":7,"../internals/export":43,"../internals/object-get-own-property-descriptor":93}],255:[function(e,t,n){var r=e("../internals/export"),i=e("../internals/descriptors"),o=e("../internals/an-object"),a=e("../internals/object-get-own-property-descriptor");r({target:"Reflect",stat:!0,sham:!i},{getOwnPropertyDescriptor:function(e,t){return a.f(o(e),t)}})},{"../internals/an-object":7,"../internals/descriptors":39,"../internals/export":43,"../internals/object-get-own-property-descriptor":93}],256:[function(e,t,n){var r=e("../internals/export"),i=e("../internals/an-object"),o=e("../internals/object-get-prototype-of");r({target:"Reflect",stat:!0,sham:!e("../internals/correct-prototype-getter")},{getPrototypeOf:function(e){return o(i(e))}})},{"../internals/an-object":7,"../internals/correct-prototype-getter":30,"../internals/export":43,"../internals/object-get-prototype-of":97}],257:[function(e,t,n){var r=e("../internals/export"),a=e("../internals/is-object"),s=e("../internals/an-object"),l=e("../internals/has"),c=e("../internals/object-get-own-property-descriptor"),u=e("../internals/object-get-prototype-of");r({target:"Reflect",stat:!0},{get:function e(t,n){var r,i,o=arguments.length<3?t:arguments[2];return s(t)===o?t[n]:(r=c.f(t,n))?l(r,"value")?r.value:void 0===r.get?void 0:r.get.call(o):a(i=u(t))?e(i,n,o):void 0}})},{"../internals/an-object":7,"../internals/export":43,"../internals/has":57,"../internals/is-object":71,"../internals/object-get-own-property-descriptor":93,"../internals/object-get-prototype-of":97}],258:[function(e,t,n){e("../internals/export")({target:"Reflect",stat:!0},{has:function(e,t){return t in e}})},{"../internals/export":43}],259:[function(e,t,n){var r=e("../internals/export"),i=e("../internals/an-object"),o=Object.isExtensible;r({target:"Reflect",stat:!0},{isExtensible:function(e){return i(e),!o||o(e)}})},{"../internals/an-object":7,"../internals/export":43}],260:[function(e,t,n){e("../internals/export")({target:"Reflect",stat:!0},{ownKeys:e("../internals/own-keys")})},{"../internals/export":43,"../internals/own-keys":104}],261:[function(e,t,n){var r=e("../internals/export"),i=e("../internals/get-built-in"),o=e("../internals/an-object");r({target:"Reflect",stat:!0,sham:!e("../internals/freezing")},{preventExtensions:function(e){o(e);try{var t=i("Object","preventExtensions");return t&&t(e),!0}catch(e){return!1}}})},{"../internals/an-object":7,"../internals/export":43,"../internals/freezing":50,"../internals/get-built-in":53}],262:[function(e,t,n){var r=e("../internals/export"),i=e("../internals/an-object"),o=e("../internals/a-possible-prototype"),a=e("../internals/object-set-prototype-of");a&&r({target:"Reflect",stat:!0},{setPrototypeOf:function(e,t){i(e),o(t);try{return a(e,t),!0}catch(e){return!1}}})},{"../internals/a-possible-prototype":3,"../internals/an-object":7,"../internals/export":43,"../internals/object-set-prototype-of":101}],263:[function(e,t,n){var r=e("../internals/export"),l=e("../internals/an-object"),c=e("../internals/is-object"),u=e("../internals/has"),f=e("../internals/object-define-property"),p=e("../internals/object-get-own-property-descriptor"),d=e("../internals/object-get-prototype-of"),h=e("../internals/create-property-descriptor");r({target:"Reflect",stat:!0},{set:function e(t,n,r){var i,o,a=arguments.length<4?t:arguments[3],s=p.f(l(t),n);if(!s){if(c(o=d(t)))return e(o,n,r,a);s=h(0)}if(u(s,"value")){if(!1===s.writable||!c(a))return!1;if(i=p.f(a,n)){if(i.get||i.set||!1===i.writable)return!1;i.value=r,f.f(a,n,i)}else f.f(a,n,h(0,r));return!0}return void 0!==s.set&&(s.set.call(a,r),!0)}})},{"../internals/an-object":7,"../internals/create-property-descriptor":33,"../internals/export":43,"../internals/has":57,"../internals/is-object":71,"../internals/object-define-property":92,"../internals/object-get-own-property-descriptor":93,"../internals/object-get-prototype-of":97}],264:[function(e,t,n){var r=e("../internals/descriptors"),i=e("../internals/global"),o=e("../internals/is-forced"),a=e("../internals/inherit-if-required"),s=e("../internals/object-define-property").f,l=e("../internals/object-get-own-property-names").f,c=e("../internals/is-regexp"),u=e("../internals/regexp-flags"),f=e("../internals/redefine"),p=e("../internals/fails"),d=e("../internals/set-species"),h=e("../internals/well-known-symbol")("match"),g=i.RegExp,y=g.prototype,m=/a/g,b=/a/g,v=new g(m)!==m;if(r&&o("RegExp",!v||p(function(){return b[h]=!1,g(m)!=m||g(b)==b||"/a/i"!=g(m,"i")}))){function x(t){t in w||s(w,t,{configurable:!0,get:function(){return g[t]},set:function(e){g[t]=e}})}for(var w=function(e,t){var n=this instanceof w,r=c(e),i=void 0===t;return!n&&r&&e.constructor===w&&i?e:a(v?new g(r&&!i?e.source:e,t):g((r=e instanceof w)?e.source:e,r&&i?u.call(e):t),n?this:y,w)},j=l(g),E=0;j.length>E;)x(j[E++]);(y.constructor=w).prototype=y,f(i,"RegExp",w)}d("RegExp")},{"../internals/descriptors":39,"../internals/fails":44,"../internals/global":56,"../internals/inherit-if-required":64,"../internals/is-forced":69,"../internals/is-regexp":73,"../internals/object-define-property":92,"../internals/object-get-own-property-names":95,"../internals/redefine":112,"../internals/regexp-flags":115,"../internals/set-species":119,"../internals/well-known-symbol":145}],265:[function(e,t,n){"use strict";var r=e("../internals/export"),i=e("../internals/regexp-exec");r({target:"RegExp",proto:!0,forced:/./.exec!==i},{exec:i})},{"../internals/export":43,"../internals/regexp-exec":114}],266:[function(e,t,n){var r=e("../internals/descriptors"),i=e("../internals/object-define-property"),o=e("../internals/regexp-flags");r&&"g"!=/./g.flags&&i.f(RegExp.prototype,"flags",{configurable:!0,get:o})},{"../internals/descriptors":39,"../internals/object-define-property":92,"../internals/regexp-flags":115}],267:[function(e,t,n){"use strict";var r=e("../internals/redefine"),i=e("../internals/an-object"),o=e("../internals/fails"),a=e("../internals/regexp-flags"),s="toString",l=RegExp.prototype,c=l[s],u=o(function(){return"/a/b"!=c.call({source:"a",flags:"b"})}),f=c.name!=s;(u||f)&&r(RegExp.prototype,s,function(){var e=i(this),t=String(e.source),n=e.flags;return"/"+t+"/"+String(void 0===n&&e instanceof RegExp&&!("flags"in l)?a.call(e):n)},{unsafe:!0})},{"../internals/an-object":7,"../internals/fails":44,"../internals/redefine":112,"../internals/regexp-flags":115}],268:[function(e,t,n){"use strict";var r=e("../internals/collection"),i=e("../internals/collection-strong");t.exports=r("Set",function(t){return function(e){return t(this,arguments.length?e:void 0)}},i)},{"../internals/collection":27,"../internals/collection-strong":25}],269:[function(e,t,n){"use strict";var r=e("../internals/export"),i=e("../internals/create-html");r({target:"String",proto:!0,forced:e("../internals/forced-string-html-method")("anchor")},{anchor:function(e){return i(this,"a","name",e)}})},{"../internals/create-html":31,"../internals/export":43,"../internals/forced-string-html-method":48}],270:[function(e,t,n){"use strict";var r=e("../internals/export"),i=e("../internals/create-html");r({target:"String",proto:!0,forced:e("../internals/forced-string-html-method")("big")},{big:function(){return i(this,"big","","")}})},{"../internals/create-html":31,"../internals/export":43,"../internals/forced-string-html-method":48}],271:[function(e,t,n){"use strict";var r=e("../internals/export"),i=e("../internals/create-html");r({target:"String",proto:!0,forced:e("../internals/forced-string-html-method")("blink")},{blink:function(){return i(this,"blink","","")}})},{"../internals/create-html":31,"../internals/export":43,"../internals/forced-string-html-method":48}],272:[function(e,t,n){"use strict";var r=e("../internals/export"),i=e("../internals/create-html");r({target:"String",proto:!0,forced:e("../internals/forced-string-html-method")("bold")},{bold:function(){return i(this,"b","","")}})},{"../internals/create-html":31,"../internals/export":43,"../internals/forced-string-html-method":48}],273:[function(e,t,n){"use strict";var r=e("../internals/export"),i=e("../internals/string-multibyte").codeAt;r({target:"String",proto:!0},{codePointAt:function(e){return i(this,e)}})},{"../internals/export":43,"../internals/string-multibyte":125}],274:[function(e,t,n){"use strict";var r=e("../internals/export"),s=e("../internals/to-length"),l=e("../internals/not-a-regexp"),c=e("../internals/require-object-coercible"),i=e("../internals/correct-is-regexp-logic"),u="".endsWith,f=Math.min;r({target:"String",proto:!0,forced:!i("endsWith")},{endsWith:function(e,t){var n=String(c(this));l(e);var r=1>10),t%1024+56320))}return n.join("")}})},{"../internals/export":43,"../internals/to-absolute-index":131}],279:[function(e,t,n){"use strict";var r=e("../internals/export"),i=e("../internals/not-a-regexp"),o=e("../internals/require-object-coercible");r({target:"String",proto:!0,forced:!e("../internals/correct-is-regexp-logic")("includes")},{includes:function(e,t){return!!~String(o(this)).indexOf(i(e),1=n.length?{value:void 0,done:!0}:(e=i(n,r),t.index+=e.length,{value:e,done:!1})})},{"../internals/define-iterator":37,"../internals/internal-state":66,"../internals/string-multibyte":125}],282:[function(e,t,n){"use strict";var r=e("../internals/export"),i=e("../internals/create-html");r({target:"String",proto:!0,forced:e("../internals/forced-string-html-method")("link")},{link:function(e){return i(this,"a","href",e)}})},{"../internals/create-html":31,"../internals/export":43,"../internals/forced-string-html-method":48}],283:[function(e,t,n){"use strict";function o(e){var t,n,r,i,o,a,s=u(this),l=String(e);return t=h(s,RegExp),void 0===(n=s.flags)&&s instanceof RegExp&&!("flags"in E)&&(n=f.call(s)),r=void 0===n?"":String(n),i=new t(t===RegExp?s.source:s,r),o=!!~r.indexOf("g"),a=!!~r.indexOf("u"),i.lastIndex=c(s.lastIndex),new S(i,l,o,a)}var r=e("../internals/export"),i=e("../internals/create-iterator-constructor"),a=e("../internals/require-object-coercible"),c=e("../internals/to-length"),s=e("../internals/a-function"),u=e("../internals/an-object"),l=e("../internals/classof"),f=e("../internals/regexp-flags"),p=e("../internals/hide"),d=e("../internals/well-known-symbol"),h=e("../internals/species-constructor"),g=e("../internals/advance-string-index"),y=e("../internals/internal-state"),m=e("../internals/is-pure"),b=d("matchAll"),v="RegExp String",x=v+" Iterator",w=y.set,j=y.getterFor(x),E=RegExp.prototype,T=E.exec,S=i(function(e,t,n,r){w(this,{type:x,regexp:e,string:t,global:n,unicode:r,done:!1})},v,function(){var e=j(this);if(e.done)return{value:void 0,done:!0};var t=e.regexp,n=e.string,r=function(e,t){var n,r=e.exec;if("function"!=typeof r)return T.call(e,t);if("object"!=typeof(n=r.call(e,t)))throw TypeError("Incorrect exec result");return n}(t,n);return null===r?{value:void 0,done:e.done=!0}:e.global?(""==String(r[0])&&(t.lastIndex=g(n,c(t.lastIndex),e.unicode)),{value:r,done:!1}):{value:r,done:!(e.done=!0)}});r({target:"String",proto:!0},{matchAll:function(e){var t,n,r,i=a(this);return null!=e&&(void 0===(n=e[b])&&m&&"RegExp"==l(e)&&(n=o),null!=n)?s(n).call(e,i):(t=String(i),r=new RegExp(e,"g"),m?o.call(r,t):r[b](t))}}),m||b in E||p(E,b,o)},{"../internals/a-function":2,"../internals/advance-string-index":5,"../internals/an-object":7,"../internals/classof":24,"../internals/create-iterator-constructor":32,"../internals/export":43,"../internals/hide":59,"../internals/internal-state":66,"../internals/is-pure":72,"../internals/regexp-flags":115,"../internals/require-object-coercible":116,"../internals/species-constructor":124,"../internals/to-length":135,"../internals/well-known-symbol":145}],284:[function(e,t,n){"use strict";var r=e("../internals/fix-regexp-well-known-symbol-logic"),f=e("../internals/an-object"),p=e("../internals/to-length"),i=e("../internals/require-object-coercible"),d=e("../internals/advance-string-index"),h=e("../internals/regexp-exec-abstract");r("match",1,function(r,c,u){return[function(e){var t=i(this),n=null==e?void 0:e[r];return void 0!==n?n.call(e,t):new RegExp(e)[r](String(t))},function(e){var t=u(c,e,this);if(t.done)return t.value;var n=f(e),r=String(this);if(!n.global)return h(n,r);for(var i,o=n.unicode,a=[],s=n.lastIndex=0;null!==(i=h(n,r));){var l=String(i[0]);""===(a[s]=l)&&(n.lastIndex=d(r,p(n.lastIndex),o)),s++}return 0===s?null:a}]})},{"../internals/advance-string-index":5,"../internals/an-object":7,"../internals/fix-regexp-well-known-symbol-logic":45,"../internals/regexp-exec-abstract":113,"../internals/require-object-coercible":116,"../internals/to-length":135}],285:[function(e,t,n){"use strict";var r=e("../internals/export"),i=e("../internals/string-pad").end;r({target:"String",proto:!0,forced:e("../internals/webkit-string-pad-bug")},{padEnd:function(e,t){return i(this,e,1]*>)/g,g=/\$([$&'`]|\d\d?)/g;r("replace",2,function(i,w,j){return[function(e,t){var n=o(this),r=null==e?void 0:e[i];return void 0!==r?r.call(e,n,t):w.call(String(n),e,t)},function(e,t){var n=j(w,e,this,t);if(n.done)return n.value;var r=T(e),i=String(this),o="function"==typeof t;o||(t=String(t));var a=r.global;if(a){var s=r.unicode;r.lastIndex=0}for(var l=[];;){var c=k(r,i);if(null===c)break;if(l.push(c),!a)break;""===String(c[0])&&(r.lastIndex=O(i,S(r.lastIndex),s))}for(var u,f="",p=0,d=0;d>>0;if(0==r)return[];if(void 0===e)return[n];if(!f(e))return y.call(n,e,r);for(var i,o,a,s=[],l=(e.ignoreCase?"i":"")+(e.multiline?"m":"")+(e.unicode?"u":"")+(e.sticky?"y":""),c=0,u=new RegExp(e.source,l+"g");(i=d.call(u,n))&&!(c<(o=u.lastIndex)&&(s.push(n.slice(c,i.index)),1=r));)u.lastIndex===i.index&&u.lastIndex++;return c===n.length?!a&&u.test("")||s.push(""):s.push(n.slice(c)),s.length>r?s.slice(0,r):s}:"0".split(void 0,0).length?function(e,t){return void 0===e&&0===t?[]:y.call(this,e,t)}:y,[function(e,t){var n=p(this),r=null==e?void 0:e[i];return void 0!==r?r.call(e,n,t):b.call(String(n),e,t)},function(e,t){var n=m(b,e,this,t,b!==y);if(n.done)return n.value;var r=v(e),i=String(this),o=x(r,RegExp),a=r.unicode,s=(r.ignoreCase?"i":"")+(r.multiline?"m":"")+(r.unicode?"u":"")+(A?"y":"g"),l=new o(A?r:"^(?:"+r.source+")",s),c=void 0===t?S:t>>>0;if(0==c)return[];if(0===i.length)return null===E(l,i)?[i]:[];for(var u=0,f=0,p=[];fe.key){i.splice(t,0,e);break}t===n&&i.push(e)}r.updateURL()},forEach:function(e,t){for(var n,r=k(this).entries,i=v(e,1=M(256,5-t))return null}else if(255":1,"`":1}),Z=h({},K,{"#":1,"?":1,"{":1,"}":1}),ee=h({},Z,{"/":1,":":1,";":1,"=":1,"@":1,"[":1,"\\":1,"]":1,"^":1,"|":1}),te=function(e,t){var n=g(e,0);return 32e.offset)if(0===o.childNodes.length){if(o.nodeType===S.NODE_TYPE.TEXT_NODE){var g=e.offset>a?e.offset-a:0,y=r&&0===i.length?N(g,c):g,m=Math.abs(y-g),b=c.substr(y),v=r?b.length-k(o,t,b).length:0,x=d-m-v,w=x<=s?f-g:s-a-g+v,j=r&&0===i.length?w-m:w;0o&&a.push({element:e,namespacePriority:n[t]})}),a.sort(function(e,t){return t.namespacePriority-e.namespacePriority}),a.map(function(e){return e.element})}},{"../config":362,"./arrays":368,"./dom":369}]},{},[363]);; /* nicescroll v3.7.4 InuYaksa - MIT - https://nicescroll.areaaperta.com */ !function(e){"function"==typeof define&&define.amd?define(["jquery"],e):"object"==typeof exports?module.exports=e(require("jquery")):e(jQuery)}(function(e){"use strict";var o=!1,t=!1,r=0,i=2e3,s=0,n=e,l=document,a=window,c=n(a),d=[],u=a.requestAnimationFrame||a.webkitRequestAnimationFrame||a.mozRequestAnimationFrame||!1,h=a.cancelAnimationFrame||a.webkitCancelAnimationFrame||a.mozCancelAnimationFrame||!1;if(u)a.cancelAnimationFrame||(h=function(e){});else{var p=0;u=function(e,o){var t=(new Date).getTime(),r=Math.max(0,16-(t-p)),i=a.setTimeout(function(){e(t+r)},r);return p=t+r,i},h=function(e){a.clearTimeout(e)}}var m=a.MutationObserver||a.WebKitMutationObserver||!1,f=Date.now||function(){return(new Date).getTime()},g={zindex:"auto",cursoropacitymin:0,cursoropacitymax:1,cursorcolor:"#424242",cursorwidth:"6px",cursorborder:"1px solid #fff",cursorborderradius:"5px",scrollspeed:40,mousescrollstep:27,touchbehavior:!1,emulatetouch:!1,hwacceleration:!0,usetransition:!0,boxzoom:!1,dblclickzoom:!0,gesturezoom:!0,grabcursorenabled:!0,autohidemode:!0,background:"",iframeautoresize:!0,cursorminheight:32,preservenativescrolling:!0,railoffset:!1,railhoffset:!1,bouncescroll:!0,spacebarenabled:!0,railpadding:{top:0,right:0,left:0,bottom:0},disableoutline:!0,horizrailenabled:!0,railalign:"right",railvalign:"bottom",enabletranslate3d:!0,enablemousewheel:!0,enablekeyboard:!0,smoothscroll:!0,sensitiverail:!0,enablemouselockapi:!0,cursorfixedheight:!1,directionlockdeadzone:6,hidecursordelay:400,nativeparentscrolling:!0,enablescrollonselection:!0,overflowx:!0,overflowy:!0,cursordragspeed:.3,rtlmode:"auto",cursordragontouch:!1,oneaxismousemode:"auto",scriptpath:function(){var e=l.currentScript||function(){var e=l.getElementsByTagName("script");return!!e.length&&e[e.length-1]}(),o=e?e.src.split("?")[0]:"";return o.split("/").length>0?o.split("/").slice(0,-1).join("/")+"/":""}(),preventmultitouchscrolling:!0,disablemutationobserver:!1,enableobserver:!0,scrollbarid:!1},v=!1,w=function(){if(v)return v;var e=l.createElement("DIV"),o=e.style,t=navigator.userAgent,r=navigator.platform,i={};return i.haspointerlock="pointerLockElement"in l||"webkitPointerLockElement"in l||"mozPointerLockElement"in l,i.isopera="opera"in a,i.isopera12=i.isopera&&"getUserMedia"in navigator,i.isoperamini="[object OperaMini]"===Object.prototype.toString.call(a.operamini),i.isie="all"in l&&"attachEvent"in e&&!i.isopera,i.isieold=i.isie&&!("msInterpolationMode"in o),i.isie7=i.isie&&!i.isieold&&(!("documentMode"in l)||7===l.documentMode),i.isie8=i.isie&&"documentMode"in l&&8===l.documentMode,i.isie9=i.isie&&"performance"in a&&9===l.documentMode,i.isie10=i.isie&&"performance"in a&&10===l.documentMode,i.isie11="msRequestFullscreen"in e&&l.documentMode>=11,i.ismsedge="msCredentials"in a,i.ismozilla="MozAppearance"in o,i.iswebkit=!i.ismsedge&&"WebkitAppearance"in o,i.ischrome=i.iswebkit&&"chrome"in a,i.ischrome38=i.ischrome&&"touchAction"in o,i.ischrome22=!i.ischrome38&&i.ischrome&&i.haspointerlock,i.ischrome26=!i.ischrome38&&i.ischrome&&"transition"in o,i.cantouch="ontouchstart"in l.documentElement||"ontouchstart"in a,i.hasw3ctouch=(a.PointerEvent||!1)&&(navigator.MaxTouchPoints>0||navigator.msMaxTouchPoints>0),i.hasmstouch=!i.hasw3ctouch&&(a.MSPointerEvent||!1),i.ismac=/^mac$/i.test(r),i.isios=i.cantouch&&/iphone|ipad|ipod/i.test(r),i.isios4=i.isios&&!("seal"in Object),i.isios7=i.isios&&"webkitHidden"in l,i.isios8=i.isios&&"hidden"in l,i.isios10=i.isios&&a.Proxy,i.isandroid=/android/i.test(t),i.haseventlistener="addEventListener"in e,i.trstyle=!1,i.hastransform=!1,i.hastranslate3d=!1,i.transitionstyle=!1,i.hastransition=!1,i.transitionend=!1,i.trstyle="transform",i.hastransform="transform"in o||function(){for(var e=["msTransform","webkitTransform","MozTransform","OTransform"],t=0,r=e.length;t0;){if(9==e[0].nodeType)return!1;var o=e.css("zIndex");if(!isNaN(o)&&0!==o)return parseInt(o);e=e.parent()}return!1}function x(e,o,t){var r=e.css(o),i=parseFloat(r);if(isNaN(i)){var s=3==(i=I[r]||0)?t?T.win.outerHeight()-T.win.innerHeight():T.win.outerWidth()-T.win.innerWidth():1;return T.isie8&&i&&(i+=1),s?i:0}return i}function S(e,o,t,r){T._bind(e,o,function(r){var i={original:r=r||a.event,target:r.target||r.srcElement,type:"wheel",deltaMode:"MozMousePixelScroll"==r.type?0:1,deltaX:0,deltaZ:0,preventDefault:function(){return r.preventDefault?r.preventDefault():r.returnValue=!1,!1},stopImmediatePropagation:function(){r.stopImmediatePropagation?r.stopImmediatePropagation():r.cancelBubble=!0}};return"mousewheel"==o?(r.wheelDeltaX&&(i.deltaX=-.025*r.wheelDeltaX),r.wheelDeltaY&&(i.deltaY=-.025*r.wheelDeltaY),!i.deltaY&&!i.deltaX&&(i.deltaY=-.025*r.wheelDelta)):i.deltaY=r.detail,t.call(e,i)},r)}function z(e,o,t,r){T.scrollrunning||(T.newscrolly=T.getScrollTop(),T.newscrollx=T.getScrollLeft(),D=f());var i=f()-D;if(D=f(),i>350?A=1:A+=(2-A)/10,e=e*A|0,o=o*A|0,e){if(r)if(e<0){if(T.getScrollLeft()>=T.page.maxw)return!0}else if(T.getScrollLeft()<=0)return!0;var s=e>0?1:-1;X!==s&&(T.scrollmom&&T.scrollmom.stop(),T.newscrollx=T.getScrollLeft(),X=s),T.lastdeltax-=e}if(o){if(function(){var e=T.getScrollTop();if(o<0){if(e>=T.page.maxh)return!0}else if(e<=0)return!0}()){if(M.nativeparentscrolling&&t&&!T.ispage&&!T.zoomactive)return!0;var n=T.view.h>>1;T.newscrolly<-n?(T.newscrolly=-n,o=-1):T.newscrolly>T.page.maxh+n?(T.newscrolly=T.page.maxh+n,o=1):o=0}var l=o>0?1:-1;B!==l&&(T.scrollmom&&T.scrollmom.stop(),T.newscrolly=T.getScrollTop(),B=l),T.lastdeltay-=o}(o||e)&&T.synched("relativexy",function(){var e=T.lastdeltay+T.newscrolly;T.lastdeltay=0;var o=T.lastdeltax+T.newscrollx;T.lastdeltax=0,T.rail.drag||T.doScrollPos(o,e)})}function k(e,o,t){var r,i;return!(t||!q)||(0===e.deltaMode?(r=-e.deltaX*(M.mousescrollstep/54)|0,i=-e.deltaY*(M.mousescrollstep/54)|0):1===e.deltaMode&&(r=-e.deltaX*M.mousescrollstep*50/80|0,i=-e.deltaY*M.mousescrollstep*50/80|0),o&&M.oneaxismousemode&&0===r&&i&&(r=i,i=0,t&&(r<0?T.getScrollLeft()>=T.page.maxw:T.getScrollLeft()<=0)&&(i=r,r=0)),T.isrtlmode&&(r=-r),z(r,i,t,!0)?void(t&&(q=!0)):(q=!1,e.stopImmediatePropagation(),e.preventDefault()))}var T=this;this.version="3.7.4",this.name="nicescroll",this.me=p;var E=n("body"),M=this.opt={doc:E,win:!1};if(n.extend(M,g),M.snapbackspeed=80,e)for(var L in M)void 0!==e[L]&&(M[L]=e[L]);if(M.disablemutationobserver&&(m=!1),this.doc=M.doc,this.iddoc=this.doc&&this.doc[0]?this.doc[0].id||"":"",this.ispage=/^BODY|HTML/.test(M.win?M.win[0].nodeName:this.doc[0].nodeName),this.haswrapper=!1!==M.win,this.win=M.win||(this.ispage?c:this.doc),this.docscroll=this.ispage&&!this.haswrapper?c:this.win,this.body=E,this.viewport=!1,this.isfixed=!1,this.iframe=!1,this.isiframe="IFRAME"==this.doc[0].nodeName&&"IFRAME"==this.win[0].nodeName,this.istextarea="TEXTAREA"==this.win[0].nodeName,this.forcescreen=!1,this.canshowonmouseevent="scroll"!=M.autohidemode,this.onmousedown=!1,this.onmouseup=!1,this.onmousemove=!1,this.onmousewheel=!1,this.onkeypress=!1,this.ongesturezoom=!1,this.onclick=!1,this.onscrollstart=!1,this.onscrollend=!1,this.onscrollcancel=!1,this.onzoomin=!1,this.onzoomout=!1,this.view=!1,this.page=!1,this.scroll={x:0,y:0},this.scrollratio={x:0,y:0},this.cursorheight=20,this.scrollvaluemax=0,"auto"==M.rtlmode){var C=this.win[0]==a?this.body:this.win,P=C.css("writing-mode")||C.css("-webkit-writing-mode")||C.css("-ms-writing-mode")||C.css("-moz-writing-mode");"horizontal-tb"==P||"lr-tb"==P||""===P?(this.isrtlmode="rtl"==C.css("direction"),this.isvertical=!1):(this.isrtlmode="vertical-rl"==P||"tb"==P||"tb-rl"==P||"rl-tb"==P,this.isvertical="vertical-rl"==P||"tb"==P||"tb-rl"==P)}else this.isrtlmode=!0===M.rtlmode,this.isvertical=!1;if(this.scrollrunning=!1,this.scrollmom=!1,this.observer=!1,this.observerremover=!1,this.observerbody=!1,!1!==M.scrollbarid)this.id=M.scrollbarid;else do{this.id="ascrail"+i++}while(l.getElementById(this.id));this.rail=!1,this.cursor=!1,this.cursorfreezed=!1,this.selectiondrag=!1,this.zoom=!1,this.zoomactive=!1,this.hasfocus=!1,this.hasmousefocus=!1,this.visibility=!0,this.railslocked=!1,this.locked=!1,this.hidden=!1,this.cursoractive=!0,this.wheelprevented=!1,this.overflowx=M.overflowx,this.overflowy=M.overflowy,this.nativescrollingarea=!1,this.checkarea=0,this.events=[],this.saved={},this.delaylist={},this.synclist={},this.lastdeltax=0,this.lastdeltay=0,this.detected=w();var N=n.extend({},this.detected);this.canhwscroll=N.hastransform&&M.hwacceleration,this.ishwscroll=this.canhwscroll&&T.haswrapper,this.isrtlmode?this.isvertical?this.hasreversehr=!(N.iswebkit||N.isie||N.isie11):this.hasreversehr=!(N.iswebkit||N.isie&&!N.isie10&&!N.isie11):this.hasreversehr=!1,this.istouchcapable=!1,N.cantouch||!N.hasw3ctouch&&!N.hasmstouch?!N.cantouch||N.isios||N.isandroid||!N.iswebkit&&!N.ismozilla||(this.istouchcapable=!0):this.istouchcapable=!0,M.enablemouselockapi||(N.hasmousecapture=!1,N.haspointerlock=!1),this.debounced=function(e,o,t){T&&(T.delaylist[e]||!1||(T.delaylist[e]={h:u(function(){T.delaylist[e].fn.call(T),T.delaylist[e]=!1},t)},o.call(T)),T.delaylist[e].fn=o)},this.synched=function(e,o){T.synclist[e]?T.synclist[e]=o:(T.synclist[e]=o,u(function(){T&&(T.synclist[e]&&T.synclist[e].call(T),T.synclist[e]=null)}))},this.unsynched=function(e){T.synclist[e]&&(T.synclist[e]=!1)},this.css=function(e,o){for(var t in o)T.saved.css.push([e,t,e.css(t)]),e.css(t,o[t])},this.scrollTop=function(e){return void 0===e?T.getScrollTop():T.setScrollTop(e)},this.scrollLeft=function(e){return void 0===e?T.getScrollLeft():T.setScrollLeft(e)};var R=function(e,o,t,r,i,s,n){this.st=e,this.ed=o,this.spd=t,this.p1=r||0,this.p2=i||1,this.p3=s||0,this.p4=n||1,this.ts=f(),this.df=o-e};if(R.prototype={B2:function(e){return 3*(1-e)*(1-e)*e},B3:function(e){return 3*(1-e)*e*e},B4:function(e){return e*e*e},getPos:function(){return(f()-this.ts)/this.spd},getNow:function(){var e=(f()-this.ts)/this.spd,o=this.B2(e)+this.B3(e)+this.B4(e);return e>=1?this.ed:this.st+this.df*o|0},update:function(e,o){return this.st=this.getNow(),this.ed=e,this.spd=o,this.ts=f(),this.df=this.ed-this.st,this}},this.ishwscroll){this.doc.translate={x:0,y:0,tx:"0px",ty:"0px"},N.hastranslate3d&&N.isios&&this.doc.css("-webkit-backface-visibility","hidden"),this.getScrollTop=function(e){if(!e){var o=v();if(o)return 16==o.length?-o[13]:-o[5];if(T.timerscroll&&T.timerscroll.bz)return T.timerscroll.bz.getNow()}return T.doc.translate.y},this.getScrollLeft=function(e){if(!e){var o=v();if(o)return 16==o.length?-o[12]:-o[4];if(T.timerscroll&&T.timerscroll.bh)return T.timerscroll.bh.getNow()}return T.doc.translate.x},this.notifyScrollEvent=function(e){var o=l.createEvent("UIEvents");o.initUIEvent("scroll",!1,!1,a,1),o.niceevent=!0,e.dispatchEvent(o)};var _=this.isrtlmode?1:-1;N.hastranslate3d&&M.enabletranslate3d?(this.setScrollTop=function(e,o){T.doc.translate.y=e,T.doc.translate.ty=-1*e+"px",T.doc.css(N.trstyle,"translate3d("+T.doc.translate.tx+","+T.doc.translate.ty+",0)"),o||T.notifyScrollEvent(T.win[0])},this.setScrollLeft=function(e,o){T.doc.translate.x=e,T.doc.translate.tx=e*_+"px",T.doc.css(N.trstyle,"translate3d("+T.doc.translate.tx+","+T.doc.translate.ty+",0)"),o||T.notifyScrollEvent(T.win[0])}):(this.setScrollTop=function(e,o){T.doc.translate.y=e,T.doc.translate.ty=-1*e+"px",T.doc.css(N.trstyle,"translate("+T.doc.translate.tx+","+T.doc.translate.ty+")"),o||T.notifyScrollEvent(T.win[0])},this.setScrollLeft=function(e,o){T.doc.translate.x=e,T.doc.translate.tx=e*_+"px",T.doc.css(N.trstyle,"translate("+T.doc.translate.tx+","+T.doc.translate.ty+")"),o||T.notifyScrollEvent(T.win[0])})}else this.getScrollTop=function(){return T.docscroll.scrollTop()},this.setScrollTop=function(e){T.docscroll.scrollTop(e)},this.getScrollLeft=function(){return T.hasreversehr?T.detected.ismozilla?T.page.maxw-Math.abs(T.docscroll.scrollLeft()):T.page.maxw-T.docscroll.scrollLeft():T.docscroll.scrollLeft()},this.setScrollLeft=function(e){return setTimeout(function(){if(T)return T.hasreversehr&&(e=T.detected.ismozilla?-(T.page.maxw-e):T.page.maxw-e),T.docscroll.scrollLeft(e)},1)};this.getTarget=function(e){return!!e&&(e.target?e.target:!!e.srcElement&&e.srcElement)},this.hasParent=function(e,o){if(!e)return!1;for(var t=e.target||e.srcElement||e||!1;t&&t.id!=o;)t=t.parentNode||!1;return!1!==t};var I={thin:1,medium:3,thick:5};this.getDocumentScrollOffset=function(){return{top:a.pageYOffset||l.documentElement.scrollTop,left:a.pageXOffset||l.documentElement.scrollLeft}},this.getOffset=function(){if(T.isfixed){var e=T.win.offset(),o=T.getDocumentScrollOffset();return e.top-=o.top,e.left-=o.left,e}var t=T.win.offset();if(!T.viewport)return t;var r=T.viewport.offset();return{top:t.top-r.top,left:t.left-r.left}},this.updateScrollBar=function(e){var o,t;if(T.ishwscroll)T.rail.css({height:T.win.innerHeight()-(M.railpadding.top+M.railpadding.bottom)}),T.railh&&T.railh.css({width:T.win.innerWidth()-(M.railpadding.left+M.railpadding.right)});else{var r=T.getOffset();if(o={top:r.top,left:r.left-(M.railpadding.left+M.railpadding.right)},o.top+=x(T.win,"border-top-width",!0),o.left+=T.rail.align?T.win.outerWidth()-x(T.win,"border-right-width")-T.rail.width:x(T.win,"border-left-width"),(t=M.railoffset)&&(t.top&&(o.top+=t.top),t.left&&(o.left+=t.left)),T.railslocked||T.rail.css({top:o.top,left:o.left,height:(e?e.h:T.win.innerHeight())-(M.railpadding.top+M.railpadding.bottom)}),T.zoom&&T.zoom.css({top:o.top+1,left:1==T.rail.align?o.left-20:o.left+T.rail.width+4}),T.railh&&!T.railslocked){o={top:r.top,left:r.left},(t=M.railhoffset)&&(t.top&&(o.top+=t.top),t.left&&(o.left+=t.left));var i=T.railh.align?o.top+x(T.win,"border-top-width",!0)+T.win.innerHeight()-T.railh.height:o.top+x(T.win,"border-top-width",!0),s=o.left+x(T.win,"border-left-width");T.railh.css({top:i-(M.railpadding.top+M.railpadding.bottom),left:s,width:T.railh.width})}}},this.doRailClick=function(e,o,t){var r,i,s,n;T.railslocked||(T.cancelEvent(e),"pageY"in e||(e.pageX=e.clientX+l.documentElement.scrollLeft,e.pageY=e.clientY+l.documentElement.scrollTop),o?(r=t?T.doScrollLeft:T.doScrollTop,s=t?(e.pageX-T.railh.offset().left-T.cursorwidth/2)*T.scrollratio.x:(e.pageY-T.rail.offset().top-T.cursorheight/2)*T.scrollratio.y,T.unsynched("relativexy"),r(0|s)):(r=t?T.doScrollLeftBy:T.doScrollBy,s=t?T.scroll.x:T.scroll.y,n=t?e.pageX-T.railh.offset().left:e.pageY-T.rail.offset().top,i=t?T.view.w:T.view.h,r(s>=n?i:-i)))},T.newscrolly=T.newscrollx=0,T.hasanimationframe="requestAnimationFrame"in a,T.hascancelanimationframe="cancelAnimationFrame"in a,T.hasborderbox=!1,this.init=function(){if(T.saved.css=[],N.isoperamini)return!0;if(N.isandroid&&!("hidden"in l))return!0;M.emulatetouch=M.emulatetouch||M.touchbehavior,T.hasborderbox=a.getComputedStyle&&"border-box"===a.getComputedStyle(l.body)["box-sizing"];var e={"overflow-y":"hidden"};if((N.isie11||N.isie10)&&(e["-ms-overflow-style"]="none"),T.ishwscroll&&(this.doc.css(N.transitionstyle,N.prefixstyle+"transform 0ms ease-out"),N.transitionend&&T.bind(T.doc,N.transitionend,T.onScrollTransitionEnd,!1)),T.zindex="auto",T.ispage||"auto"!=M.zindex?T.zindex=M.zindex:T.zindex=b()||"auto",!T.ispage&&"auto"!=T.zindex&&T.zindex>s&&(s=T.zindex),T.isie&&0===T.zindex&&"auto"==M.zindex&&(T.zindex="auto"),!T.ispage||!N.isieold){var i=T.docscroll;T.ispage&&(i=T.haswrapper?T.win:T.doc),T.css(i,e),T.ispage&&(N.isie11||N.isie)&&T.css(n("html"),e),!N.isios||T.ispage||T.haswrapper||T.css(E,{"-webkit-overflow-scrolling":"touch"});var d=n(l.createElement("div"));d.css({position:"relative",top:0,float:"right",width:M.cursorwidth,height:0,"background-color":M.cursorcolor,border:M.cursorborder,"background-clip":"padding-box","-webkit-border-radius":M.cursorborderradius,"-moz-border-radius":M.cursorborderradius,"border-radius":M.cursorborderradius}),d.addClass("nicescroll-cursors"),T.cursor=d;var u=n(l.createElement("div"));u.attr("id",T.id),u.addClass("nicescroll-rails nicescroll-rails-vr");var h,p,f=["left","right","top","bottom"];for(var g in f)p=f[g],(h=M.railpadding[p]||0)&&u.css("padding-"+p,h+"px");u.append(d),u.width=Math.max(parseFloat(M.cursorwidth),d.outerWidth()),u.css({width:u.width+"px",zIndex:T.zindex,background:M.background,cursor:"default"}),u.visibility=!0,u.scrollable=!0,u.align="left"==M.railalign?0:1,T.rail=u,T.rail.drag=!1;var v=!1;!M.boxzoom||T.ispage||N.isieold||(v=l.createElement("div"),T.bind(v,"click",T.doZoom),T.bind(v,"mouseenter",function(){T.zoom.css("opacity",M.cursoropacitymax)}),T.bind(v,"mouseleave",function(){T.zoom.css("opacity",M.cursoropacitymin)}),T.zoom=n(v),T.zoom.css({cursor:"pointer",zIndex:T.zindex,backgroundImage:"url("+M.scriptpath+"zoomico.png)",height:18,width:18,backgroundPosition:"0 0"}),M.dblclickzoom&&T.bind(T.win,"dblclick",T.doZoom),N.cantouch&&M.gesturezoom&&(T.ongesturezoom=function(e){return e.scale>1.5&&T.doZoomIn(e),e.scale<.8&&T.doZoomOut(e),T.cancelEvent(e)},T.bind(T.win,"gestureend",T.ongesturezoom))),T.railh=!1;var w;if(M.horizrailenabled&&(T.css(i,{overflowX:"hidden"}),(d=n(l.createElement("div"))).css({position:"absolute",top:0,height:M.cursorwidth,width:0,backgroundColor:M.cursorcolor,border:M.cursorborder,backgroundClip:"padding-box","-webkit-border-radius":M.cursorborderradius,"-moz-border-radius":M.cursorborderradius,"border-radius":M.cursorborderradius}),N.isieold&&d.css("overflow","hidden"),d.addClass("nicescroll-cursors"),T.cursorh=d,(w=n(l.createElement("div"))).attr("id",T.id+"-hr"),w.addClass("nicescroll-rails nicescroll-rails-hr"),w.height=Math.max(parseFloat(M.cursorwidth),d.outerHeight()),w.css({height:w.height+"px",zIndex:T.zindex,background:M.background}),w.append(d),w.visibility=!0,w.scrollable=!0,w.align="top"==M.railvalign?0:1,T.railh=w,T.railh.drag=!1),T.ispage)u.css({position:"fixed",top:0,height:"100%"}),u.css(u.align?{right:0}:{left:0}),T.body.append(u),T.railh&&(w.css({position:"fixed",left:0,width:"100%"}),w.css(w.align?{bottom:0}:{top:0}),T.body.append(w));else{if(T.ishwscroll){"static"==T.win.css("position")&&T.css(T.win,{position:"relative"});var x="HTML"==T.win[0].nodeName?T.body:T.win;n(x).scrollTop(0).scrollLeft(0),T.zoom&&(T.zoom.css({position:"absolute",top:1,right:0,"margin-right":u.width+4}),x.append(T.zoom)),u.css({position:"absolute",top:0}),u.css(u.align?{right:0}:{left:0}),x.append(u),w&&(w.css({position:"absolute",left:0,bottom:0}),w.css(w.align?{bottom:0}:{top:0}),x.append(w))}else{T.isfixed="fixed"==T.win.css("position");var S=T.isfixed?"fixed":"absolute";T.isfixed||(T.viewport=T.getViewport(T.win[0])),T.viewport&&(T.body=T.viewport,/fixed|absolute/.test(T.viewport.css("position"))||T.css(T.viewport,{position:"relative"})),u.css({position:S}),T.zoom&&T.zoom.css({position:S}),T.updateScrollBar(),T.body.append(u),T.zoom&&T.body.append(T.zoom),T.railh&&(w.css({position:S}),T.body.append(w))}N.isios&&T.css(T.win,{"-webkit-tap-highlight-color":"rgba(0,0,0,0)","-webkit-touch-callout":"none"}),M.disableoutline&&(N.isie&&T.win.attr("hideFocus","true"),N.iswebkit&&T.win.css("outline","none"))}if(!1===M.autohidemode?(T.autohidedom=!1,T.rail.css({opacity:M.cursoropacitymax}),T.railh&&T.railh.css({opacity:M.cursoropacitymax})):!0===M.autohidemode||"leave"===M.autohidemode?(T.autohidedom=n().add(T.rail),N.isie8&&(T.autohidedom=T.autohidedom.add(T.cursor)),T.railh&&(T.autohidedom=T.autohidedom.add(T.railh)),T.railh&&N.isie8&&(T.autohidedom=T.autohidedom.add(T.cursorh))):"scroll"==M.autohidemode?(T.autohidedom=n().add(T.rail),T.railh&&(T.autohidedom=T.autohidedom.add(T.railh))):"cursor"==M.autohidemode?(T.autohidedom=n().add(T.cursor),T.railh&&(T.autohidedom=T.autohidedom.add(T.cursorh))):"hidden"==M.autohidemode&&(T.autohidedom=!1,T.hide(),T.railslocked=!1),N.cantouch||T.istouchcapable||M.emulatetouch||N.hasmstouch){T.scrollmom=new y(T);T.ontouchstart=function(e){if(T.locked)return!1;if(e.pointerType&&("mouse"===e.pointerType||e.pointerType===e.MSPOINTER_TYPE_MOUSE))return!1;if(T.hasmoving=!1,T.scrollmom.timer&&(T.triggerScrollEnd(),T.scrollmom.stop()),!T.railslocked){var o=T.getTarget(e);if(o&&/INPUT/i.test(o.nodeName)&&/range/i.test(o.type))return T.stopPropagation(e);var t="mousedown"===e.type;if(!("clientX"in e)&&"changedTouches"in e&&(e.clientX=e.changedTouches[0].clientX,e.clientY=e.changedTouches[0].clientY),T.forcescreen){var r=e;(e={original:e.original?e.original:e}).clientX=r.screenX,e.clientY=r.screenY}if(T.rail.drag={x:e.clientX,y:e.clientY,sx:T.scroll.x,sy:T.scroll.y,st:T.getScrollTop(),sl:T.getScrollLeft(),pt:2,dl:!1,tg:o},T.ispage||!M.directionlockdeadzone)T.rail.drag.dl="f";else{var i={w:c.width(),h:c.height()},s=T.getContentSize(),l=s.h-i.h,a=s.w-i.w;T.rail.scrollable&&!T.railh.scrollable?T.rail.drag.ck=l>0&&"v":!T.rail.scrollable&&T.railh.scrollable?T.rail.drag.ck=a>0&&"h":T.rail.drag.ck=!1}if(M.emulatetouch&&T.isiframe&&N.isie){var d=T.win.position();T.rail.drag.x+=d.left,T.rail.drag.y+=d.top}if(T.hasmoving=!1,T.lastmouseup=!1,T.scrollmom.reset(e.clientX,e.clientY),o&&t){if(!/INPUT|SELECT|BUTTON|TEXTAREA/i.test(o.nodeName))return N.hasmousecapture&&o.setCapture(),M.emulatetouch?(o.onclick&&!o._onclick&&(o._onclick=o.onclick,o.onclick=function(e){if(T.hasmoving)return!1;o._onclick.call(this,e)}),T.cancelEvent(e)):T.stopPropagation(e);/SUBMIT|CANCEL|BUTTON/i.test(n(o).attr("type"))&&(T.preventclick={tg:o,click:!1})}}},T.ontouchend=function(e){if(!T.rail.drag)return!0;if(2==T.rail.drag.pt){if(e.pointerType&&("mouse"===e.pointerType||e.pointerType===e.MSPOINTER_TYPE_MOUSE))return!1;T.rail.drag=!1;var o="mouseup"===e.type;if(T.hasmoving&&(T.scrollmom.doMomentum(),T.lastmouseup=!0,T.hideCursor(),N.hasmousecapture&&l.releaseCapture(),o))return T.cancelEvent(e)}else if(1==T.rail.drag.pt)return T.onmouseup(e)};var z=M.emulatetouch&&T.isiframe&&!N.hasmousecapture,k=.3*M.directionlockdeadzone|0;T.ontouchmove=function(e,o){if(!T.rail.drag)return!0;if(e.targetTouches&&M.preventmultitouchscrolling&&e.targetTouches.length>1)return!0;if(e.pointerType&&("mouse"===e.pointerType||e.pointerType===e.MSPOINTER_TYPE_MOUSE))return!0;if(2==T.rail.drag.pt){"changedTouches"in e&&(e.clientX=e.changedTouches[0].clientX,e.clientY=e.changedTouches[0].clientY);var t,r;if(r=t=0,z&&!o){var i=T.win.position();r=-i.left,t=-i.top}var s=e.clientY+t,n=s-T.rail.drag.y,a=e.clientX+r,c=a-T.rail.drag.x,d=T.rail.drag.st-n;if(T.ishwscroll&&M.bouncescroll)d<0?d=Math.round(d/2):d>T.page.maxh&&(d=T.page.maxh+Math.round((d-T.page.maxh)/2));else if(d<0?(d=0,s=0):d>T.page.maxh&&(d=T.page.maxh,s=0),0===s&&!T.hasmoving)return T.ispage||(T.rail.drag=!1),!0;var u=T.getScrollLeft();if(T.railh&&T.railh.scrollable&&(u=T.isrtlmode?c-T.rail.drag.sl:T.rail.drag.sl-c,T.ishwscroll&&M.bouncescroll?u<0?u=Math.round(u/2):u>T.page.maxw&&(u=T.page.maxw+Math.round((u-T.page.maxw)/2)):(u<0&&(u=0,a=0),u>T.page.maxw&&(u=T.page.maxw,a=0))),!T.hasmoving){if(T.rail.drag.y===e.clientY&&T.rail.drag.x===e.clientX)return T.cancelEvent(e);var h=Math.abs(n),p=Math.abs(c),m=M.directionlockdeadzone;if(T.rail.drag.ck?"v"==T.rail.drag.ck?p>m&&h<=k?T.rail.drag=!1:h>m&&(T.rail.drag.dl="v"):"h"==T.rail.drag.ck&&(h>m&&p<=k?T.rail.drag=!1:p>m&&(T.rail.drag.dl="h")):h>m&&p>m?T.rail.drag.dl="f":h>m?T.rail.drag.dl=p>k?"f":"v":p>m&&(T.rail.drag.dl=h>k?"f":"h"),!T.rail.drag.dl)return T.cancelEvent(e);T.triggerScrollStart(e.clientX,e.clientY,0,0,0),T.hasmoving=!0}return T.preventclick&&!T.preventclick.click&&(T.preventclick.click=T.preventclick.tg.onclick||!1,T.preventclick.tg.onclick=T.onpreventclick),T.rail.drag.dl&&("v"==T.rail.drag.dl?u=T.rail.drag.sl:"h"==T.rail.drag.dl&&(d=T.rail.drag.st)),T.synched("touchmove",function(){T.rail.drag&&2==T.rail.drag.pt&&(T.prepareTransition&&T.resetTransition(),T.rail.scrollable&&T.setScrollTop(d),T.scrollmom.update(a,s),T.railh&&T.railh.scrollable?(T.setScrollLeft(u),T.showCursor(d,u)):T.showCursor(d),N.isie10&&l.selection.clear())}),T.cancelEvent(e)}return 1==T.rail.drag.pt?T.onmousemove(e):void 0},T.ontouchstartCursor=function(e,o){if(!T.rail.drag||3==T.rail.drag.pt){if(T.locked)return T.cancelEvent(e);T.cancelScroll(),T.rail.drag={x:e.touches[0].clientX,y:e.touches[0].clientY,sx:T.scroll.x,sy:T.scroll.y,pt:3,hr:!!o};var t=T.getTarget(e);return!T.ispage&&N.hasmousecapture&&t.setCapture(),T.isiframe&&!N.hasmousecapture&&(T.saved.csspointerevents=T.doc.css("pointer-events"),T.css(T.doc,{"pointer-events":"none"})),T.cancelEvent(e)}},T.ontouchendCursor=function(e){if(T.rail.drag){if(N.hasmousecapture&&l.releaseCapture(),T.isiframe&&!N.hasmousecapture&&T.doc.css("pointer-events",T.saved.csspointerevents),3!=T.rail.drag.pt)return;return T.rail.drag=!1,T.cancelEvent(e)}},T.ontouchmoveCursor=function(e){if(T.rail.drag){if(3!=T.rail.drag.pt)return;if(T.cursorfreezed=!0,T.rail.drag.hr){T.scroll.x=T.rail.drag.sx+(e.touches[0].clientX-T.rail.drag.x),T.scroll.x<0&&(T.scroll.x=0);var o=T.scrollvaluemaxw;T.scroll.x>o&&(T.scroll.x=o)}else{T.scroll.y=T.rail.drag.sy+(e.touches[0].clientY-T.rail.drag.y),T.scroll.y<0&&(T.scroll.y=0);var t=T.scrollvaluemax;T.scroll.y>t&&(T.scroll.y=t)}return T.synched("touchmove",function(){T.rail.drag&&3==T.rail.drag.pt&&(T.showCursor(),T.rail.drag.hr?T.doScrollLeft(Math.round(T.scroll.x*T.scrollratio.x),M.cursordragspeed):T.doScrollTop(Math.round(T.scroll.y*T.scrollratio.y),M.cursordragspeed))}),T.cancelEvent(e)}}}if(T.onmousedown=function(e,o){if(!T.rail.drag||1==T.rail.drag.pt){if(T.railslocked)return T.cancelEvent(e);T.cancelScroll(),T.rail.drag={x:e.clientX,y:e.clientY,sx:T.scroll.x,sy:T.scroll.y,pt:1,hr:o||!1};var t=T.getTarget(e);return N.hasmousecapture&&t.setCapture(),T.isiframe&&!N.hasmousecapture&&(T.saved.csspointerevents=T.doc.css("pointer-events"),T.css(T.doc,{"pointer-events":"none"})),T.hasmoving=!1,T.cancelEvent(e)}},T.onmouseup=function(e){if(T.rail.drag)return 1!=T.rail.drag.pt||(N.hasmousecapture&&l.releaseCapture(),T.isiframe&&!N.hasmousecapture&&T.doc.css("pointer-events",T.saved.csspointerevents),T.rail.drag=!1,T.cursorfreezed=!1,T.hasmoving&&T.triggerScrollEnd(),T.cancelEvent(e))},T.onmousemove=function(e){if(T.rail.drag){if(1!==T.rail.drag.pt)return;if(N.ischrome&&0===e.which)return T.onmouseup(e);if(T.cursorfreezed=!0,T.hasmoving||T.triggerScrollStart(e.clientX,e.clientY,0,0,0),T.hasmoving=!0,T.rail.drag.hr){T.scroll.x=T.rail.drag.sx+(e.clientX-T.rail.drag.x),T.scroll.x<0&&(T.scroll.x=0);var o=T.scrollvaluemaxw;T.scroll.x>o&&(T.scroll.x=o)}else{T.scroll.y=T.rail.drag.sy+(e.clientY-T.rail.drag.y),T.scroll.y<0&&(T.scroll.y=0);var t=T.scrollvaluemax;T.scroll.y>t&&(T.scroll.y=t)}return T.synched("mousemove",function(){T.cursorfreezed&&(T.showCursor(),T.rail.drag.hr?T.scrollLeft(Math.round(T.scroll.x*T.scrollratio.x)):T.scrollTop(Math.round(T.scroll.y*T.scrollratio.y)))}),T.cancelEvent(e)}T.checkarea=0},N.cantouch||M.emulatetouch)T.onpreventclick=function(e){if(T.preventclick)return T.preventclick.tg.onclick=T.preventclick.click,T.preventclick=!1,T.cancelEvent(e)},T.onclick=!N.isios&&function(e){return!T.lastmouseup||(T.lastmouseup=!1,T.cancelEvent(e))},M.grabcursorenabled&&N.cursorgrabvalue&&(T.css(T.ispage?T.doc:T.win,{cursor:N.cursorgrabvalue}),T.css(T.rail,{cursor:N.cursorgrabvalue}));else{var L=function(e){if(T.selectiondrag){if(e){var o=T.win.outerHeight(),t=e.pageY-T.selectiondrag.top;t>0&&t=o&&(t-=o),T.selectiondrag.df=t}if(0!==T.selectiondrag.df){var r=-2*T.selectiondrag.df/6|0;T.doScrollBy(r),T.debounced("doselectionscroll",function(){L()},50)}}};T.hasTextSelected="getSelection"in l?function(){return l.getSelection().rangeCount>0}:"selection"in l?function(){return"None"!=l.selection.type}:function(){return!1},T.onselectionstart=function(e){T.ispage||(T.selectiondrag=T.win.offset())},T.onselectionend=function(e){T.selectiondrag=!1},T.onselectiondrag=function(e){T.selectiondrag&&T.hasTextSelected()&&T.debounced("selectionscroll",function(){L(e)},250)}}if(N.hasw3ctouch?(T.css(T.ispage?n("html"):T.win,{"touch-action":"none"}),T.css(T.rail,{"touch-action":"none"}),T.css(T.cursor,{"touch-action":"none"}),T.bind(T.win,"pointerdown",T.ontouchstart),T.bind(l,"pointerup",T.ontouchend),T.delegate(l,"pointermove",T.ontouchmove)):N.hasmstouch?(T.css(T.ispage?n("html"):T.win,{"-ms-touch-action":"none"}),T.css(T.rail,{"-ms-touch-action":"none"}),T.css(T.cursor,{"-ms-touch-action":"none"}),T.bind(T.win,"MSPointerDown",T.ontouchstart),T.bind(l,"MSPointerUp",T.ontouchend),T.delegate(l,"MSPointerMove",T.ontouchmove),T.bind(T.cursor,"MSGestureHold",function(e){e.preventDefault()}),T.bind(T.cursor,"contextmenu",function(e){e.preventDefault()})):N.cantouch&&(T.bind(T.win,"touchstart",T.ontouchstart,!1,!0),T.bind(l,"touchend",T.ontouchend,!1,!0),T.bind(l,"touchcancel",T.ontouchend,!1,!0),T.delegate(l,"touchmove",T.ontouchmove,!1,!0)),M.emulatetouch&&(T.bind(T.win,"mousedown",T.ontouchstart,!1,!0),T.bind(l,"mouseup",T.ontouchend,!1,!0),T.bind(l,"mousemove",T.ontouchmove,!1,!0)),(M.cursordragontouch||!N.cantouch&&!M.emulatetouch)&&(T.rail.css({cursor:"default"}),T.railh&&T.railh.css({cursor:"default"}),T.jqbind(T.rail,"mouseenter",function(){if(!T.ispage&&!T.win.is(":visible"))return!1;T.canshowonmouseevent&&T.showCursor(),T.rail.active=!0}),T.jqbind(T.rail,"mouseleave",function(){T.rail.active=!1,T.rail.drag||T.hideCursor()}),M.sensitiverail&&(T.bind(T.rail,"click",function(e){T.doRailClick(e,!1,!1)}),T.bind(T.rail,"dblclick",function(e){T.doRailClick(e,!0,!1)}),T.bind(T.cursor,"click",function(e){T.cancelEvent(e)}),T.bind(T.cursor,"dblclick",function(e){T.cancelEvent(e)})),T.railh&&(T.jqbind(T.railh,"mouseenter",function(){if(!T.ispage&&!T.win.is(":visible"))return!1;T.canshowonmouseevent&&T.showCursor(),T.rail.active=!0}),T.jqbind(T.railh,"mouseleave",function(){T.rail.active=!1,T.rail.drag||T.hideCursor()}),M.sensitiverail&&(T.bind(T.railh,"click",function(e){T.doRailClick(e,!1,!0)}),T.bind(T.railh,"dblclick",function(e){T.doRailClick(e,!0,!0)}),T.bind(T.cursorh,"click",function(e){T.cancelEvent(e)}),T.bind(T.cursorh,"dblclick",function(e){T.cancelEvent(e)})))),M.cursordragontouch&&(this.istouchcapable||N.cantouch)&&(T.bind(T.cursor,"touchstart",T.ontouchstartCursor),T.bind(T.cursor,"touchmove",T.ontouchmoveCursor),T.bind(T.cursor,"touchend",T.ontouchendCursor),T.cursorh&&T.bind(T.cursorh,"touchstart",function(e){T.ontouchstartCursor(e,!0)}),T.cursorh&&T.bind(T.cursorh,"touchmove",T.ontouchmoveCursor),T.cursorh&&T.bind(T.cursorh,"touchend",T.ontouchendCursor)),N.cantouch||M.emulatetouch?(T.bind(N.hasmousecapture?T.win:l,"mouseup",T.ontouchend),T.onclick&&T.bind(l,"click",T.onclick),M.cursordragontouch?(T.bind(T.cursor,"mousedown",T.onmousedown),T.bind(T.cursor,"mouseup",T.onmouseup),T.cursorh&&T.bind(T.cursorh,"mousedown",function(e){T.onmousedown(e,!0)}),T.cursorh&&T.bind(T.cursorh,"mouseup",T.onmouseup)):(T.bind(T.rail,"mousedown",function(e){e.preventDefault()}),T.railh&&T.bind(T.railh,"mousedown",function(e){e.preventDefault()}))):(T.bind(N.hasmousecapture?T.win:l,"mouseup",T.onmouseup),T.bind(l,"mousemove",T.onmousemove),T.onclick&&T.bind(l,"click",T.onclick),T.bind(T.cursor,"mousedown",T.onmousedown),T.bind(T.cursor,"mouseup",T.onmouseup),T.railh&&(T.bind(T.cursorh,"mousedown",function(e){T.onmousedown(e,!0)}),T.bind(T.cursorh,"mouseup",T.onmouseup)),!T.ispage&&M.enablescrollonselection&&(T.bind(T.win[0],"mousedown",T.onselectionstart),T.bind(l,"mouseup",T.onselectionend),T.bind(T.cursor,"mouseup",T.onselectionend),T.cursorh&&T.bind(T.cursorh,"mouseup",T.onselectionend),T.bind(l,"mousemove",T.onselectiondrag)),T.zoom&&(T.jqbind(T.zoom,"mouseenter",function(){T.canshowonmouseevent&&T.showCursor(),T.rail.active=!0}),T.jqbind(T.zoom,"mouseleave",function(){T.rail.active=!1,T.rail.drag||T.hideCursor()}))),M.enablemousewheel&&(T.isiframe||T.mousewheel(N.isie&&T.ispage?l:T.win,T.onmousewheel),T.mousewheel(T.rail,T.onmousewheel),T.railh&&T.mousewheel(T.railh,T.onmousewheelhr)),T.ispage||N.cantouch||/HTML|^BODY/.test(T.win[0].nodeName)||(T.win.attr("tabindex")||T.win.attr({tabindex:++r}),T.bind(T.win,"focus",function(e){o=T.getTarget(e).id||T.getTarget(e)||!1,T.hasfocus=!0,T.canshowonmouseevent&&T.noticeCursor()}),T.bind(T.win,"blur",function(e){o=!1,T.hasfocus=!1}),T.bind(T.win,"mouseenter",function(e){t=T.getTarget(e).id||T.getTarget(e)||!1,T.hasmousefocus=!0,T.canshowonmouseevent&&T.noticeCursor()}),T.bind(T.win,"mouseleave",function(e){t=!1,T.hasmousefocus=!1,T.rail.drag||T.hideCursor()})),T.onkeypress=function(e){if(T.railslocked&&0===T.page.maxh)return!0;e=e||a.event;var r=T.getTarget(e);if(r&&/INPUT|TEXTAREA|SELECT|OPTION/.test(r.nodeName)&&(!(r.getAttribute("type")||r.type||!1)||!/submit|button|cancel/i.tp))return!0;if(n(r).attr("contenteditable"))return!0;if(T.hasfocus||T.hasmousefocus&&!o||T.ispage&&!o&&!t){var i=e.keyCode;if(T.railslocked&&27!=i)return T.cancelEvent(e);var s=e.ctrlKey||!1,l=e.shiftKey||!1,c=!1;switch(i){case 38:case 63233:T.doScrollBy(72),c=!0;break;case 40:case 63235:T.doScrollBy(-72),c=!0;break;case 37:case 63232:T.railh&&(s?T.doScrollLeft(0):T.doScrollLeftBy(72),c=!0);break;case 39:case 63234:T.railh&&(s?T.doScrollLeft(T.page.maxw):T.doScrollLeftBy(-72),c=!0);break;case 33:case 63276:T.doScrollBy(T.view.h),c=!0;break;case 34:case 63277:T.doScrollBy(-T.view.h),c=!0;break;case 36:case 63273:T.railh&&s?T.doScrollPos(0,0):T.doScrollTo(0),c=!0;break;case 35:case 63275:T.railh&&s?T.doScrollPos(T.page.maxw,T.page.maxh):T.doScrollTo(T.page.maxh),c=!0;break;case 32:M.spacebarenabled&&(l?T.doScrollBy(T.view.h):T.doScrollBy(-T.view.h),c=!0);break;case 27:T.zoomactive&&(T.doZoom(),c=!0)}if(c)return T.cancelEvent(e)}},M.enablekeyboard&&T.bind(l,N.isopera&&!N.isopera12?"keypress":"keydown",T.onkeypress),T.bind(l,"keydown",function(e){(e.ctrlKey||!1)&&(T.wheelprevented=!0)}),T.bind(l,"keyup",function(e){e.ctrlKey||!1||(T.wheelprevented=!1)}),T.bind(a,"blur",function(e){T.wheelprevented=!1}),T.bind(a,"resize",T.onscreenresize),T.bind(a,"orientationchange",T.onscreenresize),T.bind(a,"load",T.lazyResize),N.ischrome&&!T.ispage&&!T.haswrapper){var C=T.win.attr("style"),P=parseFloat(T.win.css("width"))+1;T.win.css("width",P),T.synched("chromefix",function(){T.win.attr("style",C)})}T.onAttributeChange=function(e){T.lazyResize(T.isieold?250:30)},M.enableobserver&&(T.isie11||!1===m||(T.observerbody=new m(function(e){if(e.forEach(function(e){if("attributes"==e.type)return E.hasClass("modal-open")&&E.hasClass("modal-dialog")&&!n.contains(n(".modal-dialog")[0],T.doc[0])?T.hide():T.show()}),T.me.clientWidth!=T.page.width||T.me.clientHeight!=T.page.height)return T.lazyResize(30)}),T.observerbody.observe(l.body,{childList:!0,subtree:!0,characterData:!1,attributes:!0,attributeFilter:["class"]})),T.ispage||T.haswrapper||(!1!==m?(T.observer=new m(function(e){e.forEach(T.onAttributeChange)}),T.observer.observe(T.win[0],{childList:!0,characterData:!1,attributes:!0,subtree:!1}),T.observerremover=new m(function(e){e.forEach(function(e){if(e.removedNodes.length>0)for(var o in e.removedNodes)if(T&&e.removedNodes[o]==T.win[0])return T.remove()})}),T.observerremover.observe(T.win[0].parentNode,{childList:!0,characterData:!1,attributes:!1,subtree:!1})):(T.bind(T.win,N.isie&&!N.isie9?"propertychange":"DOMAttrModified",T.onAttributeChange),N.isie9&&T.win[0].attachEvent("onpropertychange",T.onAttributeChange),T.bind(T.win,"DOMNodeRemoved",function(e){e.target==T.win[0]&&T.remove()})))),!T.ispage&&M.boxzoom&&T.bind(a,"resize",T.resizeZoom),T.istextarea&&(T.bind(T.win,"keydown",T.lazyResize),T.bind(T.win,"mouseup",T.lazyResize)),T.lazyResize(30)}if("IFRAME"==this.doc[0].nodeName){var R=function(){T.iframexd=!1;var o;try{(o="contentDocument"in this?this.contentDocument:this.contentWindow._doc).domain}catch(e){T.iframexd=!0,o=!1}if(T.iframexd)return"console"in a&&console.log("NiceScroll error: policy restriced iframe"),!0;if(T.forcescreen=!0,T.isiframe&&(T.iframe={doc:n(o),html:T.doc.contents().find("html")[0],body:T.doc.contents().find("body")[0]},T.getContentSize=function(){return{w:Math.max(T.iframe.html.scrollWidth,T.iframe.body.scrollWidth),h:Math.max(T.iframe.html.scrollHeight,T.iframe.body.scrollHeight)}},T.docscroll=n(T.iframe.body)),!N.isios&&M.iframeautoresize&&!T.isiframe){T.win.scrollTop(0),T.doc.height("");var t=Math.max(o.getElementsByTagName("html")[0].scrollHeight,o.body.scrollHeight);T.doc.height(t)}T.lazyResize(30),T.css(n(T.iframe.body),e),N.isios&&T.haswrapper&&T.css(n(o.body),{"-webkit-transform":"translate3d(0,0,0)"}),"contentWindow"in this?T.bind(this.contentWindow,"scroll",T.onscroll):T.bind(o,"scroll",T.onscroll),M.enablemousewheel&&T.mousewheel(o,T.onmousewheel),M.enablekeyboard&&T.bind(o,N.isopera?"keypress":"keydown",T.onkeypress),N.cantouch?(T.bind(o,"touchstart",T.ontouchstart),T.bind(o,"touchmove",T.ontouchmove)):M.emulatetouch&&(T.bind(o,"mousedown",T.ontouchstart),T.bind(o,"mousemove",function(e){return T.ontouchmove(e,!0)}),M.grabcursorenabled&&N.cursorgrabvalue&&T.css(n(o.body),{cursor:N.cursorgrabvalue})),T.bind(o,"mouseup",T.ontouchend),T.zoom&&(M.dblclickzoom&&T.bind(o,"dblclick",T.doZoom),T.ongesturezoom&&T.bind(o,"gestureend",T.ongesturezoom))};this.doc[0].readyState&&"complete"===this.doc[0].readyState&&setTimeout(function(){R.call(T.doc[0],!1)},500),T.bind(this.doc,"load",R)}},this.showCursor=function(e,o){if(T.cursortimeout&&(clearTimeout(T.cursortimeout),T.cursortimeout=0),T.rail){if(T.autohidedom&&(T.autohidedom.stop().css({opacity:M.cursoropacitymax}),T.cursoractive=!0),T.rail.drag&&1==T.rail.drag.pt||(void 0!==e&&!1!==e&&(T.scroll.y=e/T.scrollratio.y|0),void 0!==o&&(T.scroll.x=o/T.scrollratio.x|0)),T.cursor.css({height:T.cursorheight,top:T.scroll.y}),T.cursorh){var t=T.hasreversehr?T.scrollvaluemaxw-T.scroll.x:T.scroll.x;T.cursorh.css({width:T.cursorwidth,left:!T.rail.align&&T.rail.visibility?t+T.rail.width:t}),T.cursoractive=!0}T.zoom&&T.zoom.stop().css({opacity:M.cursoropacitymax})}},this.hideCursor=function(e){T.cursortimeout||T.rail&&T.autohidedom&&(T.hasmousefocus&&"leave"===M.autohidemode||(T.cursortimeout=setTimeout(function(){T.rail.active&&T.showonmouseevent||(T.autohidedom.stop().animate({opacity:M.cursoropacitymin}),T.zoom&&T.zoom.stop().animate({opacity:M.cursoropacitymin}),T.cursoractive=!1),T.cursortimeout=0},e||M.hidecursordelay)))},this.noticeCursor=function(e,o,t){T.showCursor(o,t),T.rail.active||T.hideCursor(e)},this.getContentSize=T.ispage?function(){return{w:Math.max(l.body.scrollWidth,l.documentElement.scrollWidth),h:Math.max(l.body.scrollHeight,l.documentElement.scrollHeight)}}:T.haswrapper?function(){return{w:T.doc[0].offsetWidth,h:T.doc[0].offsetHeight}}:function(){return{w:T.docscroll[0].scrollWidth,h:T.docscroll[0].scrollHeight}},this.onResize=function(e,o){if(!T||!T.win)return!1;var t=T.page.maxh,r=T.page.maxw,i=T.view.h,s=T.view.w;if(T.view={w:T.ispage?T.win.width():T.win[0].clientWidth,h:T.ispage?T.win.height():T.win[0].clientHeight},T.page=o||T.getContentSize(),T.page.maxh=Math.max(0,T.page.h-T.view.h),T.page.maxw=Math.max(0,T.page.w-T.view.w),T.page.maxh==t&&T.page.maxw==r&&T.view.w==s&&T.view.h==i){if(T.ispage)return T;var n=T.win.offset();if(T.lastposition){var l=T.lastposition;if(l.top==n.top&&l.left==n.left)return T}T.lastposition=n}return 0===T.page.maxh?(T.hideRail(),T.scrollvaluemax=0,T.scroll.y=0,T.scrollratio.y=0,T.cursorheight=0,T.setScrollTop(0),T.rail&&(T.rail.scrollable=!1)):(T.page.maxh-=M.railpadding.top+M.railpadding.bottom,T.rail.scrollable=!0),0===T.page.maxw?(T.hideRailHr(),T.scrollvaluemaxw=0,T.scroll.x=0,T.scrollratio.x=0,T.cursorwidth=0,T.setScrollLeft(0),T.railh&&(T.railh.scrollable=!1)):(T.page.maxw-=M.railpadding.left+M.railpadding.right,T.railh&&(T.railh.scrollable=M.horizrailenabled)),T.railslocked=T.locked||0===T.page.maxh&&0===T.page.maxw,T.railslocked?(T.ispage||T.updateScrollBar(T.view),!1):(T.hidden||T.visibility?!T.railh||T.hidden||T.railh.visibility||T.showRailHr():T.showRail().showRailHr(),T.istextarea&&T.win.css("resize")&&"none"!=T.win.css("resize")&&(T.view.h-=20),T.cursorheight=Math.min(T.view.h,Math.round(T.view.h*(T.view.h/T.page.h))),T.cursorheight=M.cursorfixedheight?M.cursorfixedheight:Math.max(M.cursorminheight,T.cursorheight),T.cursorwidth=Math.min(T.view.w,Math.round(T.view.w*(T.view.w/T.page.w))),T.cursorwidth=M.cursorfixedheight?M.cursorfixedheight:Math.max(M.cursorminheight,T.cursorwidth),T.scrollvaluemax=T.view.h-T.cursorheight-(M.railpadding.top+M.railpadding.bottom),T.hasborderbox||(T.scrollvaluemax-=T.cursor[0].offsetHeight-T.cursor[0].clientHeight),T.railh&&(T.railh.width=T.page.maxh>0?T.view.w-T.rail.width:T.view.w,T.scrollvaluemaxw=T.railh.width-T.cursorwidth-(M.railpadding.left+M.railpadding.right)),T.ispage||T.updateScrollBar(T.view),T.scrollratio={x:T.page.maxw/T.scrollvaluemaxw,y:T.page.maxh/T.scrollvaluemax},T.getScrollTop()>T.page.maxh?T.doScrollTop(T.page.maxh):(T.scroll.y=T.getScrollTop()/T.scrollratio.y|0,T.scroll.x=T.getScrollLeft()/T.scrollratio.x|0,T.cursoractive&&T.noticeCursor()),T.scroll.y&&0===T.getScrollTop()&&T.doScrollTo(T.scroll.y*T.scrollratio.y|0),T)},this.resize=T.onResize;var O=0;this.onscreenresize=function(e){clearTimeout(O);var o=!T.ispage&&!T.haswrapper;o&&T.hideRails(),O=setTimeout(function(){T&&(o&&T.showRails(),T.resize()),O=0},120)},this.lazyResize=function(e){return clearTimeout(O),O=setTimeout(function(){T&&T.resize(),O=0},e||240),T},this.jqbind=function(e,o,t){T.events.push({e:e,n:o,f:t,q:!0}),n(e).on(o,t)},this.mousewheel=function(e,o,t){var r="jquery"in e?e[0]:e;if("onwheel"in l.createElement("div"))T._bind(r,"wheel",o,t||!1);else{var i=void 0!==l.onmousewheel?"mousewheel":"DOMMouseScroll";S(r,i,o,t||!1),"DOMMouseScroll"==i&&S(r,"MozMousePixelScroll",o,t||!1)}};var Y=!1;if(N.haseventlistener){try{var H=Object.defineProperty({},"passive",{get:function(){Y=!0}});a.addEventListener("test",null,H)}catch(e){}this.stopPropagation=function(e){return!!e&&((e=e.original?e.original:e).stopPropagation(),!1)},this.cancelEvent=function(e){return e.cancelable&&e.preventDefault(),e.stopImmediatePropagation(),e.preventManipulation&&e.preventManipulation(),!1}}else Event.prototype.preventDefault=function(){this.returnValue=!1},Event.prototype.stopPropagation=function(){this.cancelBubble=!0},a.constructor.prototype.addEventListener=l.constructor.prototype.addEventListener=Element.prototype.addEventListener=function(e,o,t){this.attachEvent("on"+e,o)},a.constructor.prototype.removeEventListener=l.constructor.prototype.removeEventListener=Element.prototype.removeEventListener=function(e,o,t){this.detachEvent("on"+e,o)},this.cancelEvent=function(e){return(e=e||a.event)&&(e.cancelBubble=!0,e.cancel=!0,e.returnValue=!1),!1},this.stopPropagation=function(e){return(e=e||a.event)&&(e.cancelBubble=!0),!1};this.delegate=function(e,o,t,r,i){var s=d[o]||!1;s||(s={a:[],l:[],f:function(e){for(var o=s.l,t=!1,r=o.length-1;r>=0;r--)if(!1===(t=o[r].call(e.target,e)))return!1;return t}},T.bind(e,o,s.f,r,i),d[o]=s),T.ispage?(s.a=[T.id].concat(s.a),s.l=[t].concat(s.l)):(s.a.push(T.id),s.l.push(t))},this.undelegate=function(e,o,t,r,i){var s=d[o]||!1;if(s)for(var n=0,l=s.l.length;n0)return t;o=!!o.parentNode&&o.parentNode}return!1},this.triggerScrollStart=function(e,o,t,r,i){if(T.onscrollstart){var s={type:"scrollstart",current:{x:e,y:o},request:{x:t,y:r},end:{x:T.newscrollx,y:T.newscrolly},speed:i};T.onscrollstart.call(T,s)}},this.triggerScrollEnd=function(){if(T.onscrollend){var e=T.getScrollLeft(),o=T.getScrollTop(),t={type:"scrollend",current:{x:e,y:o},end:{x:e,y:o}};T.onscrollend.call(T,t)}};var B=0,X=0,D=0,A=1,q=!1;if(this.onmousewheel=function(e){if(T.wheelprevented||T.locked)return!1;if(T.railslocked)return T.debounced("checkunlock",T.resize,250),!1;if(T.rail.drag)return T.cancelEvent(e);if("auto"===M.oneaxismousemode&&0!==e.deltaX&&(M.oneaxismousemode=!1),M.oneaxismousemode&&0===e.deltaX&&!T.rail.scrollable)return!T.railh||!T.railh.scrollable||T.onmousewheelhr(e);var o=f(),t=!1;if(M.preservenativescrolling&&T.checkarea+600T.page.maxh&&(o=T.page.maxh+(o-T.page.maxh)/2|0),e<0?e=e/2|0:e>T.page.maxw&&(e=T.page.maxw+(e-T.page.maxw)/2|0)):(o<0?o=0:o>T.page.maxh&&(o=T.page.maxh),e<0?e=0:e>T.page.maxw&&(e=T.page.maxw)),T.scrollrunning&&e==T.newscrollx&&o==T.newscrolly)return!1;T.newscrolly=o,T.newscrollx=e;var s=T.getScrollTop(),n=T.getScrollLeft(),l={};l.x=e-n,l.y=o-s;var a=0|Math.sqrt(l.x*l.x+l.y*l.y),c=T.prepareTransition(a);T.scrollrunning||(T.scrollrunning=!0,T.triggerScrollStart(n,s,e,o,c),T.cursorupdate.start()),T.scrollendtrapped=!0,N.transitionend||(T.scrollendtrapped&&clearTimeout(T.scrollendtrapped),T.scrollendtrapped=setTimeout(T.onScrollTransitionEnd,c)),T.setScrollTop(T.newscrolly),T.setScrollLeft(T.newscrollx)},this.cancelScroll=function(){if(!T.scrollendtrapped)return!0;var e=T.getScrollTop(),o=T.getScrollLeft();return T.scrollrunning=!1,N.transitionend||clearTimeout(N.transitionend),T.scrollendtrapped=!1,T.resetTransition(),T.setScrollTop(e),T.railh&&T.setScrollLeft(o),T.timerscroll&&T.timerscroll.tm&&clearInterval(T.timerscroll.tm),T.timerscroll=!1,T.cursorfreezed=!1,T.cursorupdate.stop(),T.showCursor(e,o),T},this.onScrollTransitionEnd=function(){if(T.scrollendtrapped){var e=T.getScrollTop(),o=T.getScrollLeft();if(e<0?e=0:e>T.page.maxh&&(e=T.page.maxh),o<0?o=0:o>T.page.maxw&&(o=T.page.maxw),e!=T.newscrolly||o!=T.newscrollx)return T.doScrollPos(o,e,M.snapbackspeed);T.scrollrunning&&T.triggerScrollEnd(),T.scrollrunning=!1,T.scrollendtrapped=!1,T.resetTransition(),T.timerscroll=!1,T.setScrollTop(e),T.railh&&T.setScrollLeft(o),T.cursorupdate.stop(),T.noticeCursor(!1,e,o),T.cursorfreezed=!1}}}else this.doScrollLeft=function(e,o){var t=T.scrollrunning?T.newscrolly:T.getScrollTop();T.doScrollPos(e,t,o)},this.doScrollTop=function(e,o){var t=T.scrollrunning?T.newscrollx:T.getScrollLeft();T.doScrollPos(t,e,o)},this.doScrollPos=function(e,o,t){var r=T.getScrollTop(),i=T.getScrollLeft();((T.newscrolly-r)*(o-r)<0||(T.newscrollx-i)*(e-i)<0)&&T.cancelScroll();var s=!1;if(T.bouncescroll&&T.rail.visibility||(o<0?(o=0,s=!0):o>T.page.maxh&&(o=T.page.maxh,s=!0)),T.bouncescroll&&T.railh.visibility||(e<0?(e=0,s=!0):e>T.page.maxw&&(e=T.page.maxw,s=!0)),T.scrollrunning&&T.newscrolly===o&&T.newscrollx===e)return!0;T.newscrolly=o,T.newscrollx=e,T.dst={},T.dst.x=e-i,T.dst.y=o-r,T.dst.px=i,T.dst.py=r;var n=0|Math.sqrt(T.dst.x*T.dst.x+T.dst.y*T.dst.y),l=T.getTransitionSpeed(n);T.bzscroll={};var a=s?1:.58;T.bzscroll.x=new R(i,T.newscrollx,l,0,0,a,1),T.bzscroll.y=new R(r,T.newscrolly,l,0,0,a,1);f();var c=function(){if(T.scrollrunning){var e=T.bzscroll.y.getPos();T.setScrollLeft(T.bzscroll.x.getNow()),T.setScrollTop(T.bzscroll.y.getNow()),e<=1?T.timer=u(c):(T.scrollrunning=!1,T.timer=0,T.triggerScrollEnd())}};T.scrollrunning||(T.triggerScrollStart(i,r,e,o,l),T.scrollrunning=!0,T.timer=u(c))},this.cancelScroll=function(){return T.timer&&h(T.timer),T.timer=0,T.bzscroll=!1,T.scrollrunning=!1,T};else this.doScrollLeft=function(e,o){var t=T.getScrollTop();T.doScrollPos(e,t,o)},this.doScrollTop=function(e,o){var t=T.getScrollLeft();T.doScrollPos(t,e,o)},this.doScrollPos=function(e,o,t){var r=e>T.page.maxw?T.page.maxw:e;r<0&&(r=0);var i=o>T.page.maxh?T.page.maxh:o;i<0&&(i=0),T.synched("scroll",function(){T.setScrollTop(i),T.setScrollLeft(r)})},this.cancelScroll=function(){};this.doScrollBy=function(e,o){z(0,e)},this.doScrollLeftBy=function(e,o){z(e,0)},this.doScrollTo=function(e,o){var t=o?Math.round(e*T.scrollratio.y):e;t<0?t=0:t>T.page.maxh&&(t=T.page.maxh),T.cursorfreezed=!1,T.doScrollTop(e)},this.checkContentSize=function(){var e=T.getContentSize();e.h==T.page.h&&e.w==T.page.w||T.resize(!1,e)},T.onscroll=function(e){T.rail.drag||T.cursorfreezed||T.synched("scroll",function(){T.scroll.y=Math.round(T.getScrollTop()/T.scrollratio.y),T.railh&&(T.scroll.x=Math.round(T.getScrollLeft()/T.scrollratio.x)),T.noticeCursor()})},T.bind(T.docscroll,"scroll",T.onscroll),this.doZoomIn=function(e){if(!T.zoomactive){T.zoomactive=!0,T.zoomrestore={style:{}};var o=["position","top","left","zIndex","backgroundColor","marginTop","marginBottom","marginLeft","marginRight"],t=T.win[0].style;for(var r in o){var i=o[r];T.zoomrestore.style[i]=void 0!==t[i]?t[i]:""}T.zoomrestore.style.width=T.win.css("width"),T.zoomrestore.style.height=T.win.css("height"),T.zoomrestore.padding={w:T.win.outerWidth()-T.win.width(),h:T.win.outerHeight()-T.win.height()},N.isios4&&(T.zoomrestore.scrollTop=c.scrollTop(),c.scrollTop(0)),T.win.css({position:N.isios4?"absolute":"fixed",top:0,left:0,zIndex:s+100,margin:0});var n=T.win.css("backgroundColor");return(""===n||/transparent|rgba\(0, 0, 0, 0\)|rgba\(0,0,0,0\)/.test(n))&&T.win.css("backgroundColor","#fff"),T.rail.css({zIndex:s+101}),T.zoom.css({zIndex:s+102}),T.zoom.css("backgroundPosition","0 -18px"),T.resizeZoom(),T.onzoomin&&T.onzoomin.call(T),T.cancelEvent(e)}},this.doZoomOut=function(e){if(T.zoomactive)return T.zoomactive=!1,T.win.css("margin",""),T.win.css(T.zoomrestore.style),N.isios4&&c.scrollTop(T.zoomrestore.scrollTop),T.rail.css({"z-index":T.zindex}),T.zoom.css({"z-index":T.zindex}),T.zoomrestore=!1,T.zoom.css("backgroundPosition","0 0"),T.onResize(),T.onzoomout&&T.onzoomout.call(T),T.cancelEvent(e)},this.doZoom=function(e){return T.zoomactive?T.doZoomOut(e):T.doZoomIn(e)},this.resizeZoom=function(){if(T.zoomactive){var e=T.getScrollTop();T.win.css({width:c.width()-T.zoomrestore.padding.w+"px",height:c.height()-T.zoomrestore.padding.h+"px"}),T.onResize(),T.setScrollTop(Math.min(T.page.maxh,e))}},this.init(),n.nicescroll.push(this)},y=function(e){var o=this;this.nc=e,this.lastx=0,this.lasty=0,this.speedx=0,this.speedy=0,this.lasttime=0,this.steptime=0,this.snapx=!1,this.snapy=!1,this.demulx=0,this.demuly=0,this.lastscrollx=-1,this.lastscrolly=-1,this.chkx=0,this.chky=0,this.timer=0,this.reset=function(e,t){o.stop(),o.steptime=0,o.lasttime=f(),o.speedx=0,o.speedy=0,o.lastx=e,o.lasty=t,o.lastscrollx=-1,o.lastscrolly=-1},this.update=function(e,t){var r=f();o.steptime=r-o.lasttime,o.lasttime=r;var i=t-o.lasty,s=e-o.lastx,n=o.nc.getScrollTop()+i,l=o.nc.getScrollLeft()+s;o.snapx=l<0||l>o.nc.page.maxw,o.snapy=n<0||n>o.nc.page.maxh,o.speedx=s,o.speedy=i,o.lastx=e,o.lasty=t},this.stop=function(){o.nc.unsynched("domomentum2d"),o.timer&&clearTimeout(o.timer),o.timer=0,o.lastscrollx=-1,o.lastscrolly=-1},this.doSnapy=function(e,t){var r=!1;t<0?(t=0,r=!0):t>o.nc.page.maxh&&(t=o.nc.page.maxh,r=!0),e<0?(e=0,r=!0):e>o.nc.page.maxw&&(e=o.nc.page.maxw,r=!0),r?o.nc.doScrollPos(e,t,o.nc.opt.snapbackspeed):o.nc.triggerScrollEnd()},this.doMomentum=function(e){var t=f(),r=e?t+e:o.lasttime,i=o.nc.getScrollLeft(),s=o.nc.getScrollTop(),n=o.nc.page.maxh,l=o.nc.page.maxw;o.speedx=l>0?Math.min(60,o.speedx):0,o.speedy=n>0?Math.min(60,o.speedy):0;var a=r&&t-r<=60;(s<0||s>n||i<0||i>l)&&(a=!1);var c=!(!o.speedy||!a)&&o.speedy,d=!(!o.speedx||!a)&&o.speedx;if(c||d){var u=Math.max(16,o.steptime);if(u>50){var h=u/50;o.speedx*=h,o.speedy*=h,u=50}o.demulxy=0,o.lastscrollx=o.nc.getScrollLeft(),o.chkx=o.lastscrollx,o.lastscrolly=o.nc.getScrollTop(),o.chky=o.lastscrolly;var p=o.lastscrollx,m=o.lastscrolly,g=function(){var e=f()-t>600?.04:.02;o.speedx&&(p=Math.floor(o.lastscrollx-o.speedx*(1-o.demulxy)),o.lastscrollx=p,(p<0||p>l)&&(e=.1)),o.speedy&&(m=Math.floor(o.lastscrolly-o.speedy*(1-o.demulxy)),o.lastscrolly=m,(m<0||m>n)&&(e=.1)),o.demulxy=Math.min(1,o.demulxy+e),o.nc.synched("domomentum2d",function(){if(o.speedx){o.nc.getScrollLeft();o.chkx=p,o.nc.setScrollLeft(p)}if(o.speedy){o.nc.getScrollTop();o.chky=m,o.nc.setScrollTop(m)}o.timer||(o.nc.hideCursor(),o.doSnapy(p,m))}),o.demulxy<1?o.timer=setTimeout(g,u):(o.stop(),o.nc.hideCursor(),o.doSnapy(p,m))};g()}else o.doSnapy(o.nc.getScrollLeft(),o.nc.getScrollTop())}},x=e.fn.scrollTop;e.cssHooks.pageYOffset={get:function(e,o,t){var r=n.data(e,"__nicescroll")||!1;return r&&r.ishwscroll?r.getScrollTop():x.call(e)},set:function(e,o){var t=n.data(e,"__nicescroll")||!1;return t&&t.ishwscroll?t.setScrollTop(parseInt(o)):x.call(e,o),this}},e.fn.scrollTop=function(e){if(void 0===e){var o=!!this[0]&&(n.data(this[0],"__nicescroll")||!1);return o&&o.ishwscroll?o.getScrollTop():x.call(this)}return this.each(function(){var o=n.data(this,"__nicescroll")||!1;o&&o.ishwscroll?o.setScrollTop(parseInt(e)):x.call(n(this),e)})};var S=e.fn.scrollLeft;n.cssHooks.pageXOffset={get:function(e,o,t){var r=n.data(e,"__nicescroll")||!1;return r&&r.ishwscroll?r.getScrollLeft():S.call(e)},set:function(e,o){var t=n.data(e,"__nicescroll")||!1;return t&&t.ishwscroll?t.setScrollLeft(parseInt(o)):S.call(e,o),this}},e.fn.scrollLeft=function(e){if(void 0===e){var o=!!this[0]&&(n.data(this[0],"__nicescroll")||!1);return o&&o.ishwscroll?o.getScrollLeft():S.call(this)}return this.each(function(){var o=n.data(this,"__nicescroll")||!1;o&&o.ishwscroll?o.setScrollLeft(parseInt(e)):S.call(n(this),e)})};var z=function(e){var o=this;if(this.length=0,this.name="nicescrollarray",this.each=function(e){return n.each(o,e),o},this.push=function(e){o[o.length]=e,o.length++},this.eq=function(e){return o[e]},e)for(var t=0;t1?n(e,r):s,i.win=r}!("doc"in i)||"win"in i||(i.win=r);var l=r.data("__nicescroll")||!1;l||(i.doc=i.doc||r,l=new b(i,r),r.data("__nicescroll",l)),t.push(l)}),1===t.length?t[0]:t},a.NiceScroll={getjQuery:function(){return e}},n.nicescroll||(n.nicescroll=new z,n.nicescroll.options=g)});; !function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(t="undefined"!=typeof globalThis?globalThis:t||self).uuidv4=e()}(this,(function(){"use strict";var t,e=new Uint8Array(16);function o(){if(!t&&!(t="undefined"!=typeof crypto&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||"undefined"!=typeof msCrypto&&"function"==typeof msCrypto.getRandomValues&&msCrypto.getRandomValues.bind(msCrypto)))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return t(e)}var n=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i;function r(t){return"string"==typeof t&&n.test(t)}for(var i=[],u=0;u<256;++u)i.push((u+256).toString(16).substr(1));return function(t,e,n){var u=(t=t||{}).random||(t.rng||o)();if(u[6]=15&u[6]|64,u[8]=63&u[8]|128,e){n=n||0;for(var f=0;f<16;++f)e[n+f]=u[f];return e}return function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,o=(i[t[e+0]]+i[t[e+1]]+i[t[e+2]]+i[t[e+3]]+"-"+i[t[e+4]]+i[t[e+5]]+"-"+i[t[e+6]]+i[t[e+7]]+"-"+i[t[e+8]]+i[t[e+9]]+"-"+i[t[e+10]]+i[t[e+11]]+i[t[e+12]]+i[t[e+13]]+i[t[e+14]]+i[t[e+15]]).toLowerCase();if(!r(o))throw TypeError("Stringified UUID is invalid");return o}(u)}}));; (function ($, Drupal, drupalSettings) { "use strict"; // -------- GLOBAL variables -------- var tooltipVisible = false; var previousRange = null; var totalTestPart = $('.question-palette__part').length; var userSelectedRange = ''; var clickOutNotetHandler; var noting = false; var originalNoteContent = ''; var noteString = ''; var noteTimestamp = ''; var noteInput = $('#js-note-content'); var highlightTooltip = $('#highlight-box'); var highlighterContent = $('#highlighter-contents'); var currentActivePart = $('.question-palette__part.-active').data('part'); var NoteIds = []; var newAddedNote = 0; var notes = []; var noteSerialized = {}; var initNiceScroll = false; var timer; var iosCheck = isiPhoneOriPad(); var quiz_id; // -------- End GLOBAL variables -------- function isiPhoneOriPad() { var userAgent = navigator.userAgent; var isiPhone = /iPhone/i.test(userAgent); var isiPad = /iPad/i.test(userAgent); var iOS13_iPad = (navigator.platform === 'MacIntel' && navigator.maxTouchPoints > 1); return isiPhone || isiPad || iOS13_iPad; } function checkMobileTablet() { // Check iphone/ipad, mobile, tablet. var isTablet = false; var isMobileAndroid = false; var isMobile = false; // Get the User-Agent string var userAgent = navigator.userAgent.toLowerCase(); // Detect if the device is a tablet if (/(tablet|ipad|playbook|silk)|(android(?!.*mobi))/i.test(userAgent)) { isTablet = true; } if (/mobile/i.test(userAgent)) { isMobile = true; } // Detect if the device is a mobile Android device if (/android/i.test(userAgent) && /mobile/i.test(userAgent)) { isMobileAndroid = true; } var isIOS = /iPad|iPhone|iPod/.test(navigator.userAgent) && !window.MSStream; var iOS13_iPad = (navigator.platform === 'MacIntel' && navigator.maxTouchPoints > 1); if (isIOS || iOS13_iPad || isMobileAndroid || isTablet || isMobile) { return true; } return false; } var generateQuizMode = function () { var mode = drupalSettings.take_test.mode; var quiz_id = drupalSettings.take_test.quiz_id; // Random string for quiz id. var random_string = Math.random().toString(36).substring(2, 15); return quiz_id + '_' + random_string + '_' + mode; } Drupal.getQuizMode = function () { if (quiz_id) { return quiz_id; } quiz_id = generateQuizMode(); } // Get quiz mode. Drupal.getQuizMode(); // Define countdown timer prototype Drupal.CountDownTimer = function (duration, duration_default, granularity) { this.duration = duration; this.granularity = granularity || 1000; this.tickFtns = []; this.running = false; this.pending = false; this.diff = parseInt(duration); this.duration_default = duration_default; } Drupal.CountDownTimer.prototype.start = function () { if (this.running) { return; } this.running = true; var start = Date.now(), that = this, diff, obj; (function timer() { if (that.pending) { return; } var obj_default = Drupal.CountDownTimer.parse(that.duration_default); if (that.duration_default == 0) { diff = parseInt(that.duration) + (((Date.now() - start) / 1000) | 0); if (diff >= 0) { setTimeout(timer, that.granularity); } obj = Drupal.CountDownTimer.parse(diff); var time_over = that.duration_default + diff; that.diff = Drupal.CountDownTimer.parse(time_over); } else { diff = that.duration - (((Date.now() - start) / 1000) | 0); if (diff > 0) { setTimeout(timer, that.granularity); } else { diff = 0; that.running = false; } obj = Drupal.CountDownTimer.parse(diff); var time_over = that.duration_default - diff; that.diff = Drupal.CountDownTimer.parse(time_over); } that.tickFtns.forEach(function (ftn) { ftn.call(this, obj.minutes, obj.seconds, obj_default.minutes); }, that); }()); }; Drupal.CountDownTimer.prototype.onTick = function (ftn) { if (typeof ftn === 'function') { this.tickFtns.push(ftn); } return this; }; Drupal.CountDownTimer.prototype.expired = function () { return !this.running; }; Drupal.CountDownTimer.prototype.timecurrent = function () { return this.diff; }; Drupal.CountDownTimer.prototype.pendingTime = function () { this.pending = true; } Drupal.CountDownTimer.parse = function (seconds) { return { 'minutes': (seconds / 60) | 0, 'seconds': (seconds % 60) | 0 }; }; // End countdown timer prototype // Run time clock. Drupal.runTimeClock = function (timeEndCallback) { var elmDisplay = document.querySelector('#time-clock'); if (elmDisplay) { var timeDuration = elmDisplay.dataset.time, timeDurationDefault = elmDisplay.dataset.durationDefault; timer = new Drupal.CountDownTimer(timeDuration, timeDurationDefault); var timeObj = Drupal.CountDownTimer.parse(timeDuration); formatClockTime(timeObj.minutes, timeObj.seconds, timeObj.minutes); timer.onTick(formatClockTime); // Provided custom callback function will be called at timer end. if (typeof timeEndCallback === 'function') { timer.onTick(timeEndCallback); } else { timer.onTick(timeEnd); } timer.onTick(timeTakeTest); timer.start(); } function timeEnd() { if (this.expired()) { // showTimeIsUpModal(); } } function timeEndAlertModal() { if (this.expired()) { console.log('Time is up! please write your function to submit form here.') } } // Save time current to local storage. function timeTakeTest() { var timecurrent = this.timecurrent(); var minutes = timecurrent.minutes < 10 ? "0" + timecurrent.minutes : timecurrent.minutes; var seconds = timecurrent.seconds < 10 ? "0" + timecurrent.seconds : timecurrent.seconds; if (timecurrent === undefined) { return; } var taketest_string = Drupal.getCookie('taketest'); if (!taketest_string) { return; } localStorage.setItem(taketest_string + quiz_id + '_timecurrent', minutes + ':' + seconds); } // Set flag default for time clock. function formatClockTime(minutes, seconds, minutes_default) { minutes = minutes < 10 ? "0" + minutes : minutes; seconds = seconds < 10 ? seconds : seconds; var timeValue = minutes >= 1 ? minutes : seconds; var timeText = minutes >= 1 ? 'minutes remaining' : 'seconds remaining'; if (minutes < 1) { $('.realtest-header').addClass('time-up'); } if (elmDisplay) { if (parseInt(minutes) < parseInt(minutes_default) && parseInt(minutes) >= 1) { if (parseInt(seconds) == 0 && parseInt(minutes) == 1) { timeValue = "01"; } else { timeValue = parseInt(minutes) + 1; if (parseInt(minutes) < 9) { timeValue = "0" + timeValue; } } } elmDisplay.innerHTML = '' + timeValue + '' + '' + timeText + ''; } } function formatEndTimeAlert(minutes, seconds) { var countDownText = document.getElementById("js-countdown-text"); var seconds = seconds; timeDisplayElm.textContent = seconds; countDownText.textContent = seconds <= 1 ? "sec" : "secs"; } function showTimeIsUpModal() { $("#modal-time-up").modal({ backdrop: 'static', keyboard: false }); var timeDisplayElm = document.querySelector('#js-countdown-number'); if (timeDisplayElm) { var timeDuration = timeDisplayElm.dataset.time, timer = new Drupal.CountDownTimer(timeDuration), timeObj = Drupal.CountDownTimer.parse(timeDuration); formatEndTimeAlert(timeObj.minutes, timeObj.seconds); timer.onTick(formatEndTimeAlert); timer.onTick(timeEndAlertModal); timer.start(); } } } Drupal.pendingTimeClock = function () { // Stop time clock. timer.pendingTime(); } // End function countdown timer. // -------------------------------- // ------ Global functions ------ // Handle show full screen. function showFullScreen() { if (iosCheck) { $('#js-full-screen').hide(); return; } var isFullscreen = false; var fullScreenTooltip = "Full Screen Mode"; var exitFullScreenTooltip = "Exit Full Screen Mode"; // Function to toggle tooltip content based on isFullscreen state function updateTooltip() { var tooltipTitle = isFullscreen ? exitFullScreenTooltip : fullScreenTooltip; $('#js-full-screen').attr({ 'data-original-title': tooltipTitle, 'data-placement': "bottom", 'data-trigger': "hover", }); } $('#js-full-screen').click(function () { var elem = document.documentElement; $(this).toggleClass('active'); if (!isFullscreen) { // if browser is not fullscreen, then request fullscreen if (elem.requestFullscreen) { elem.requestFullscreen(); } else if (elem.mozRequestFullScreen) { elem.mozRequestFullScreen(); } else if (elem.webkitRequestFullscreen) { elem.webkitRequestFullscreen(); } else if (elem.msRequestFullscreen) { elem.msRequestFullscreen(); } isFullscreen = true; } else { // if current browser is fullscreen, then exit fullscreen if (document.exitFullscreen) { document.exitFullscreen(); } else if (document.mozCancelFullScreen) { document.mozCancelFullScreen(); } else if (document.webkitExitFullscreen) { document.webkitExitFullscreen(); } else if (document.msExitFullscreen) { document.msExitFullscreen(); } isFullscreen = false; } // Update the tooltip content after fullscreen change updateTooltip(); setTimeout(function () { $('#notes-container').getNiceScroll().resize(); }, 1000); }); // Check if browser is fullscreen document.addEventListener('fullscreenchange', (event) => { if (document.fullscreenElement != null) { $('#js-full-screen').addClass('active'); isFullscreen = true; updateTooltip(); } else { $('#js-full-screen').removeClass('active'); isFullscreen = false; updateTooltip(); } }); // Call updateTooltip initially to set the correct tooltip updateTooltip(); } // -------------------------------- // NOTE/HIGHLIGHT FUNCTIONS function getQuizId() { // Quiz ID for Listening/Reading test. if (drupalSettings.take_test.quiz_id !== undefined && drupalSettings.take_test.quiz_id !== '' && drupalSettings.take_test.quiz_id != null) { return drupalSettings.take_test.quiz_id; } return ''; if (drupalSettings.wot2.quizID !== undefined && drupalSettings.wot2.quizID !== '' && drupalSettings.wot2.quizID != null) { return drupalSettings.wot2.quizID; } } // (Notepad) Setup note - Black out the text show active note and highlight. function setupNoteApp() { // var quizID = getQuizId(); // // let notes = []; // // Check if localstorage contains any data // const localData = localStorage.getItem('notes_' + quizID); // // Retrieve the list of notes from localstorage // if (localData) { // notes = JSON.parse(localData); // } // // if (notes && notes.length > 0) { // // Display the saved notes // renderNotes(); // } // Handle "input" event on the search input $('#note-search').on('input', function () { const searchTerm = $(this).val().trim().toLowerCase(); if (searchTerm === '') { // If the search term is empty, display the original notes $('#search-results').empty(); $('#notes-container').show(); renderNotes(); } else { const filteredNotes = filterNotes(searchTerm); // Render the filtered notes renderSearchResults(filteredNotes); } }); function filterNotes(searchTerm) { // Filter notes that contain the search term in either selectedText or // noteText return notes.filter((note) => { const selectedText = note.selectedText.toLowerCase(); const noteText = note.noteText.toLowerCase(); return selectedText.includes(searchTerm) || noteText.includes(searchTerm); }); } function renderSearchResults(searchResults) { const searchResultsContainer = $('#search-results'); searchResultsContainer.empty(); if (searchResults.length > 0) { $.each(searchResults, function (index, note) { const searchResultDiv = `
    ${note.selectedText}
    ${note.noteText}
    Edit Delete Are you sure to delete this note? Yes No
    `; // Add search results with delete and cancel function const searchResultElement = $(searchResultDiv); searchResultsContainer.prepend(searchResultElement); }); $('#notes-container').hide(); } else { const noResultsDiv = `
    No matching note found.
    `; searchResultsContainer.append(noResultsDiv); } } function deleteNote(noteId) { // Find a note by its unique ID. const noteIndex = notes.findIndex(note => note.id === noteId); if (noteIndex !== -1) { // Remove a note from the notes array using the found index. notes.splice(noteIndex, 1); // Save the notes array to local storage. // localStorage.setItem('notes_' + quizID, JSON.stringify(notes)); // Display the search results again. const searchTerm = $('#note-search').val().trim().toLowerCase(); if (searchTerm === '') { $('#search-results').empty(); $('#notes-container').show(); renderNotes(); } else { const filteredNotes = filterNotes(searchTerm); renderSearchResults(filteredNotes); } } } function scrollToNotedItem(refItemId, noteOfPart) { if ($(`.noted.${refItemId}`).length) { if (currentActivePart != noteOfPart) { $('.question-palette__part[data-part="' + noteOfPart + '"]').trigger('click', false); highlighterContent.on('transitionend', function () { $(`.noted.${refItemId}`)[0].scrollIntoView({ behavior: 'smooth', block: 'center' }); highlighterContent.off('transitionend'); }); } else { $(`.noted.${refItemId}`)[0].scrollIntoView({ behavior: 'smooth', block: 'center' }); } } } // Handle click event on "Save" button $('#save-note').click(function () { saveNote(); }); // Event delegation for handling delete and cancel click events $(document).on('click', '.notepad__item-more', function (event) { $('.notepad__item-more').removeClass('active'); $(this).toggleClass('active'); }); $(document).on('click', '.notepad__text-confirm.-delete', function (event) { const noteId = $(this).closest('.notepad__item').data('noteId'); const refNoteId = $(this).closest('.notepad__item').data('refId'); deleteNote(noteId); removeNoteOnTestPanel(refNoteId) }); $(document).on('click', '.notepad__delete-confirm', function (event) { event.stopPropagation(); }); $(document).on('click', '.notepad__item-title', function (event) { event.stopPropagation(); var itemNote = $(this).closest('.notepad__item'); var refItemId = itemNote.data('refId'); var noteOfPart = itemNote.data('notePart'); scrollToNotedItem(refItemId, noteOfPart); }); $(document).on('click', '.notepad__more-item-row.-edit', function (event) { var editableDiv = $(this).closest('.notepad__item').find('.notepad__item-content'); var editableDivWrap = $(this).closest('.notepad__item').find('.notepad__item-content-wrap'); var noteId = $(this).closest('.notepad__item').data('noteId'); var btnEditTemplate = `
    `; originalNoteContent = editableDiv.text(); $(this).closest('.notepad__item-more').removeClass('active'); editableDiv.attr("contentEditable", "true").focus(); editableDivWrap.append(btnEditTemplate); $('#notes-container').getNiceScroll().resize(); }); $(document).on('click', '.notepad__btn-cancel', function (event) { var editableDiv = $(this).closest('.notepad__item').find('.notepad__item-content'); editableDiv.text(originalNoteContent).attr("contentEditable", "false"); $(this).closest('.notepad__btns-edit').remove(); }); $(document).on('click', '.notepad__btn-save', function (event) { const noteId = $(this).data('note-id'); const updatedContent = $(this).closest('.notepad__item').find('.notepad__item-content').text().trim(); // Find the note by its unique ID. const noteIndex = notes.findIndex(note => note.id === noteId); if (noteIndex !== -1) { // Update the note's content. notes[noteIndex].noteText = updatedContent; // Save the updated notes array to local storage. // localStorage.setItem('notes_' + quizID, JSON.stringify(notes)); // Optionally, you can re-render the notes to display the updated // content. renderNotes(); } $(this).closest('.notepad__item-content-wrap').find('.notepad__item-content').attr("contentEditable", "false"); $(this).closest('.notepad__btns-edit').remove(); }); $(document).on('click', '.notepad__more-item-row', function (event) { event.stopPropagation(); $(this).toggleClass('active'); const confirmDeleteElm = this.querySelector('.notepad__delete-confirm'); const confirmEditElm = this.closest(".notepad__item").querySelector('.notepad__item-content-wrap'); document.addEventListener('click', clickDeleteItemHandler); document.addEventListener('click', clickEditItemHandler); function clickDeleteItemHandler(event) { if (confirmDeleteElm) { const isInsideConfirmDeleteElm = confirmDeleteElm.contains(event.target); if (!isInsideConfirmDeleteElm) { document.removeEventListener('click', clickDeleteItemHandler); $(confirmDeleteElm).closest('.notepad__item-more').removeClass('active'); $(confirmDeleteElm).closest('.notepad__more-item-row').removeClass('active'); } else { if ($(event.target).is('.notepad__text-confirm')) { document.removeEventListener('click', clickDeleteItemHandler); } } } } function clickEditItemHandler(event) { if (confirmEditElm) { const isInsideConfirmEditElm = confirmEditElm.contains(event.target); if (!isInsideConfirmEditElm) { document.removeEventListener('click', clickEditItemHandler); $('.notepad__btns-edit').remove(); $('.notepad__item-content').attr("contentEditable", "false"); } else { if ($(event.target).is('.iot-grbt')) { document.removeEventListener('click', clickEditItemHandler); } } } } }); document.addEventListener('click', function (event) { const moreNote = document.querySelector('.notepad__item-more.active'); if (moreNote) { const isClickInsideMoreNote = moreNote.contains(event.target); if (!isClickInsideMoreNote) { $(moreNote).removeClass('active') } } }); $(document).on('click', '.notepad__text-confirm.-cancel', function (event) { event.stopPropagation(); $(this).closest('.notepad__item-more').removeClass('active'); $(this).closest('.notepad__more-item-row').removeClass('active'); }); function saveNote() { const inputTextarea = $('#user-note-input'); const noteText = inputTextarea.val().trim(); const selectedText = noteString; const noteOfPart = currentActivePart; const noteRefId = $('#js-note-content').data('id'); if (noteText && selectedText) { // Create a new note object const newNote = { selectedText: selectedText, noteText: noteText, noteOfPart: noteOfPart, noteRefId: noteRefId }; // Add the note to the notes array notes.push(newNote); // Save the notes array to local storage // localStorage.setItem('notes_' + quizID, JSON.stringify(notes)); // Render the notes again renderNotes(); // Clear the textarea content inputTextarea.val(''); noteString = ''; // Hide the tooltip hideHighlightTooltip(); //toggle new note status icon newAddedNote += 1; checkNewNote(); } } } function checkNewNote() { if (newAddedNote > 0) { $('#js-bt-notepad').addClass('active'); } else { $('#js-bt-notepad').removeClass('active'); } } function removeNoteOnTestPanel(noteId) { // Ensure all highlights are serialised first! NoteIds.forEach(function (noteId) { noteSerialized[noteId] = userNote.serializeHighlights(noteId); }); if (noteId) { userNote.removeHighlights(null, noteId); NoteIds = NoteIds.filter((id) => id !== noteId); } hideHighlightTooltip(); } function renderNotes() { const notesContainer = $('#notes-container'); if (notesContainer.length) { notesContainer.empty(); $.each(notes, function (index, note) { const noteId = uuidv4(); // Create a unique ID for each note. note.id = noteId; // Save the ID into the note. const noteDiv = `
    ${note.selectedText}
    ${note.noteText}
    Edit Delete Are you sure to delete this note? Yes No
    `; notesContainer.prepend(noteDiv); }); } } function initNote() { var quizID = getQuizId(); if (highlighterContent.length) { var sandbox = document.getElementById("highlighter-contents"); window.userNote = new TextHighlighter(sandbox, { version: "independencia", useDefaultEvents: false, color: "var(--main-color)", highlightedClass: 'noted', preprocessDescriptors: function (range, descriptors) { var uniqueId = "hlt-" + Math.random() .toString(36) .substring(2, 15) + Math.random() .toString(36) .substring(2, 15); NoteIds.push(uniqueId); addNoteId(uniqueId) var descriptorsWithIds = descriptors.map(function (descriptor) { var wrapper = descriptor[0]; var highlightedText = descriptor[1]; var offset = descriptor[2]; var length = descriptor[3]; var timestamp = $(wrapper).data('timestamp'); addNoteTimestamp(timestamp); noteString = descriptor[1]; return [ wrapper.replace( 'class="noted"', "class=\"noted " + uniqueId + "\"" + " id=\"" + uniqueId + "\"" ), highlightedText, offset, length ]; }); return { descriptors: descriptorsWithIds, meta: { id: uniqueId } }; }, }); $("#user-note-input").on("blur", function () { if (previousRange) { // Select the previous region again var selection = window.getSelection(); selection.removeAllRanges(); selection.addRange(previousRange); } }); highlighterContent.on("mouseup", function () { var selection = window.getSelection(); if (selection.rangeCount > 0) { var range = selection.getRangeAt(0); var selectedText = getSelectedText(); if (selectedText !== "") { showHighlightControl(range); // Update the previous selection with the new selection previousRange = range.cloneRange(); } else { // If there is no new selection, set previousRange to null. previousRange = null; } } }); $(document).on('click', '#js-remove-note', function (event) { // Ensure all highlights are serialised first! NoteIds.forEach(function (noteId) { noteSerialized[noteId] = userNote.serializeHighlights(noteId); }); var noteId = $(this).data('id'); if (noteId) { userNote.removeHighlights(null, noteId); NoteIds = NoteIds.filter((id) => id !== noteId) deleteNote(noteId); } hideHighlightTooltip(); newAddedNote -= 1; checkNewNote(); }); function deleteNote(noteId) { var noteRefId = $('[data-ref-id="' + noteId + '"]').data('noteId'); // Find a note by its unique ID. const noteIndex = notes.findIndex(note => note.id === noteRefId); if (noteIndex !== -1) { // Remove a note from the notes array using the found index. notes.splice(noteIndex, 1); // Save the notes array to local storage. // localStorage.setItem('notes_' + quizID, JSON.stringify(notes)); // Display the search results again. const searchTerm = $('#note-search').val().trim().toLowerCase(); if (searchTerm === '') { $('#search-results').empty(); $('#notes-container').show(); renderNotes(); } else { const filteredNotes = filterNotes(searchTerm); renderSearchResults(filteredNotes); } } } function getSelectedText() { if (window.getSelection) { return window.getSelection().toString(); } else if (document.selection && document.selection.type != "Control") { return document.selection.createRange().text; } return ""; } function addNoteTimestamp(timestamp) { $('#js-note-content').data('timestamp', timestamp); noteTimestamp = timestamp; } function addNoteId(uniqueId) { $('#js-note-content').data('id', uniqueId); } clickOutNotetHandler = function clickOutNotetHandler(event) { if (!highlightTooltip.is(event.target) && highlightTooltip.has(event.target).length === 0) { hideHighlightTooltip(); cancelNote(noteTimestamp); } } function addClassSavedNote(timestamp) { $(`[data-timestamp="${timestamp}"]`).each(function (index, el) { $(this).addClass('saved-note'); }); } function replaceNoteToHightlight(timestamp) { $(`[data-timestamp="${timestamp}"]`).each(function (index, el) { $(this).removeClass('noted').addClass('highlighted'); const currentClass = $(this).attr('class'); const newClass = currentClass.replace(/note-up/g, 'hltr-'); $(this).attr('class', newClass); }); } $('#cancel-note').on('click', function (event) { var timestamp = $('#js-note-content').data('timestamp'); cancelNote(timestamp); }); $('#save-note').on('click', function (event) { var timestamp = $('#js-note-content').data('timestamp'); addClassSavedNote(timestamp); }); // const highlightHandler = hltr.highlightHandler.bind(hltr); const noteHandler = () => userNote.highlightHandler(); $('#js-btn-note').on("click", function () { noting = true; noteHandler(); $(document).on('click', '#highlighter-contents', clickOutNotetHandler); }); $('#js-btn-highlight').on('click', function (event) { if (noting) { var timestamp = $('#js-note-content').data('timestamp'); replaceNoteToHightlight(timestamp); } }); } } function initHighlighter() { if (highlighterContent.length) { var highlightIds = []; var sandbox = document.getElementById("highlighter-contents"); var removeHighlightBtn = document.getElementById("js-remove-highlight"); window.hltr = new TextHighlighter(sandbox, { version: "independencia", useDefaultEvents: false, preprocessDescriptors: function (range, descriptors) { var uniqueId = "hlt-" + Math.random() .toString(36) .substring(2, 15) + Math.random() .toString(36) .substring(2, 15); highlightIds.push(uniqueId); var descriptorsWithIds = descriptors.map(function (descriptor) { var wrapper = descriptor[0]; var highlightedText = descriptor[1]; var offset = descriptor[2]; var length = descriptor[3]; return [ wrapper.replace( 'class="highlighted"', "class=\"highlighted " + uniqueId + "\"" + " id=\"" + uniqueId + "\"" ), highlightedText, offset, length ]; }); return { descriptors: descriptorsWithIds, meta: { id: uniqueId } }; }, }); var serialized = {}; $("#user-note-input").on("blur", function () { if (previousRange) { // Select the previous region again var selection = window.getSelection(); selection.removeAllRanges(); selection.addRange(previousRange); } }); highlighterContent.on("mouseup", function () { var selection = window.getSelection(); if (selection.rangeCount > 0) { var range = selection.getRangeAt(0); var selectedText = getSelectedText(); if (selectedText !== "") { showHighlightControl(range); // Update the previous selection with the new selection previousRange = range.cloneRange(); } else { // If there is no new selection, set previousRange to null. previousRange = null; } } }); $(document).on('click', '#js-remove-highlight', function (event) { // Ensure all highlights are serialised first! highlightIds.forEach(function (highlightId) { serialized[highlightId] = hltr.serializeHighlights(highlightId); }); var highlightId = $(this).data('id'); if (highlightId) { hltr.removeHighlights(null, highlightId); highlightIds = highlightIds.filter((id) => id !== highlightId) } hideHighlightTooltip(); cancelNote(noteTimestamp); }); function getSelectedText() { if (window.getSelection) { return window.getSelection().toString(); } else if (document.selection && document.selection.type != "Control") { return document.selection.createRange().text; } return ""; } // const highlightHandler = hltr.highlightHandler.bind(hltr); const highlightHandler = () => hltr.highlightHandler(); $('#js-btn-highlight').on("click", highlightHandler); } } function cancelNote(timestamp) { $(`[data-timestamp="${timestamp}"]`).each(function (index, el) { const notedText = el.textContent; const parent = el.parentElement; const textNode = document.createTextNode(notedText); parent.replaceChild(textNode, el); }); $(document).off('click', '#highlighter-contents', clickOutNotetHandler); } function showHighlightControl(range) { var highlightMenuWidth = highlightTooltip.outerWidth(); var highlightMenuHalfWidth = highlightMenuWidth / 2; var rect = range.getBoundingClientRect(); var noteWidth = $('#js-note-content').outerWidth(); var viewportWidth = $(window).width(); var highlightMenuLeft = (rect.left + rect.width / 2) - highlightMenuHalfWidth; var highlightMenuRight = highlightMenuLeft + highlightMenuWidth; var highlightNoteLeft = (rect.left + rect.width / 2) - noteWidth / 2; var highlightNoteRight = highlightNoteLeft + noteWidth; $('#js-note-content').removeAttr('style'); // Check if the tooltip exceeds the screen size if (highlightMenuLeft < 0) { highlightMenuLeft = 0; highlightTooltip.removeClass("left right").addClass('left'); $('#js-note-content').css({ left: highlightMenuLeft, 'transform': 'none' }); } else if (highlightMenuRight > viewportWidth) { highlightMenuLeft = viewportWidth - highlightMenuWidth; highlightTooltip.removeClass("left right").addClass('right'); } else { highlightTooltip.removeClass("left right"); if (highlightNoteLeft < 0) { $('#js-note-content').css({ left: (-1 * highlightMenuLeft), 'transform': 'none' }); } else if (highlightNoteRight > viewportWidth) { $('#js-note-content').css({ left: 'initial', right: (highlightMenuRight - viewportWidth), 'transform': 'none' }); } } highlightTooltip.css({ top: rect.top - highlightTooltip.outerHeight(), left: highlightMenuLeft }); } function showHighlightTooltip() { $(document).on('click', '#highlighter-contents', function (event) { var selection = window.getSelection(), range; if ($(event.target).is('input, textarea')) { hideHighlightTooltip(false); return true; } if (selection.rangeCount > 0) { range = selection.getRangeAt(0); if (!range.collapsed || $(event.target).hasClass('highlighted') || $(event.target).hasClass('noted')) { // Display the tooltip for the first time highlightTooltip.show(); tooltipVisible = true; highlightTooltip.removeClass('reactive-note reactive no-range'); if ($(event.target).hasClass('highlighted')) { showHighlightControl($(event.target)[0]); var highlightId = $(event.target).attr('id'); $('#js-remove-highlight').data('id', highlightId); highlightTooltip.addClass('reactive'); } if ($(event.target).hasClass('noted')) { showHighlightControl($(event.target)[0]); var noteId = $(event.target).attr('id'); $('#js-remove-note').data('id', noteId); highlightTooltip.addClass('reactive-note'); } if (range.collapsed) { highlightTooltip.addClass('no-range'); noteTimestamp = ''; $('#js-note-content').data('timestamp', ''); } } else if (!highlightTooltip.is(event.target) && highlightTooltip.has(event.target).length === 0) { hideHighlightTooltip(); } } }); $('#js-btn-highlight').on('click', function (event) { event.preventDefault(); hideHighlightTooltip(); clearUserSelection(); }); var divParent = $('.test-contents, .test-panel'); divParent.on('scroll', function () { if (tooltipVisible) { hideHighlightTooltip(); } }); } function hideHighlightTooltip(clearSelection = true) { $('#user-note-input').val(''); highlightTooltip.hide(); tooltipVisible = false; noting = false; highlightTooltip.removeClass('reactive reactive-note no-range'); noteInput.hide(); userSelectedRange = ''; if (clearSelection) { clearUserSelection(); } $(document).off('click', '#highlighter-contents', clickOutNotetHandler); } // Get user selected text. function getUserSelection() { let selectedText = ''; if (typeof window.getSelection !== 'undefined') { selectedText = window.getSelection().toString(); } else if (typeof document.selection !== 'undefined' && document.selection.type === 'Text') { selectedText = document.selection.createRange().text; } return selectedText; } function clearUserSelection() { if (window.getSelection) { if (window.getSelection().empty) { // Chrome, Firefox, Opera, Safari window.getSelection().empty(); } else if (window.getSelection().removeAllRanges) { // IE window.getSelection().removeAllRanges(); } } else if (document.selection) { // IE 8 and below document.selection.empty(); } } function showNotePad() { if (iosCheck) { $('#js-bt-notepad').hide(); return; } $('#js-bt-notepad, .notepad__close-icon').click(function (event) { $('body').toggleClass('notepad-open'); if ($('body').hasClass('notepad-open')) { var notePadWidth = $('#notepad').outerWidth(); highlighterContent.css({ 'width': `calc(100% - ${notePadWidth}px)`, 'margin-left': 0 }); } else { highlighterContent.removeAttr('style'); } $('.test-panel, .test-contents').getNiceScroll().hide(); highlighterContent.on('transitionstart', function () { $('body').addClass('transitioning'); $('.test-panel, .test-contents').getNiceScroll().hide(); highlighterContent.off('transitionstart'); }); highlighterContent.on('transitionend', function () { $('body').removeClass('transitioning'); $('.test-panel, .test-contents').getNiceScroll().show().resize(); highlighterContent.off('transitionend'); }); }); $('#js-bt-notepad, #notepad').click(function (event) { newAddedNote = 0; $('#js-bt-notepad').removeClass('active'); }); $('#js-btn-note').click(function (event) { $(".highlight-box__note-content").show(); }); $('#cancel-note').click(function (event) { $(highlightTooltip, noteInput).hide(); userSelectedRange = ''; $('#user-note-input').val(''); clearUserSelection(); }); } function setNotepadHeight() { var headerHeight = $('.realtest-header').outerHeight(); var questionPaletteHeight = $('.question-palette').outerHeight(); var windowHeight = $(window).height(); var notepadHeight = windowHeight - (headerHeight + questionPaletteHeight); $('#notepad').css({ height: notepadHeight, }); } // Run nice scroll bar for notes. function runNotesNiceScroll() { var noteContainer = $('#notes-container'); noteContainer.niceScroll({ autohidemode: true, cursorborderradius: 6, cursorwidth: "2px", cursorcolor: "#dfdfdf", }); } // Clear data note. function clearDataNote() { var quizID = getQuizId(); localStorage.removeItem('notes_' + quizID); } // End NOTE/HIGHLIGHT functions //----------------------------------- // Handle next and previous button for take test. function nextPreviousPart() { // Check body have class 'listening-test' or 'reading-test' if (!checkMobileTablet() && ($('body').hasClass('listening-test') || $('body').hasClass('reading-test'))) { return; } var buttons = $('#js-btn-previous, #js-btn-next'); var currentPartIndex, nextPartIndex; var viewElms = ['.test-contents', '.test-panel']; var partPaletteElement = $('.question-palette__part'); var $nav = $('#question-palette-table'); buttons.click(function (event) { currentPartIndex = $('#js-btn-wrap').data('partShow'); if ($(this).hasClass('-next')) { nextPartIndex = currentPartIndex + 1; } else { nextPartIndex = currentPartIndex - 1; } if (nextPartIndex === totalTestPart || nextPartIndex < 0) { event.preventDefault(); return true; } else { updateNavButtons(nextPartIndex); } //active current palette partPaletteElement.eq(nextPartIndex).trigger('click'); currentActivePart = $('.question-palette__part.-active').data('part'); var scrollLeft = 0; var itemGap = 0; var elementIndex = nextPartIndex; // scroll for palette navigation on the tablet for (var i = 0; i <= elementIndex; i++) { if (elementIndex == 0) { scrollLeft = 0; } else { if (i == elementIndex - 1) { scrollLeft = scrollLeft + $('.question-palette__part').eq(i).innerWidth() / 2; } else if (i < elementIndex) { scrollLeft = scrollLeft + $('.question-palette__part').eq(i).innerWidth(); } itemGap += 20; } } $nav.animate({ scrollLeft: scrollLeft + itemGap / 2 }, 'slow'); }); $(document).on('click', '.question-palette__part', function (event, scrollDefault = true) { var scrollLeft = 0; var itemGap = 0; var elementIndex = $(this).index(); var clickActive = $(this).data('clickActive'); if (clickActive == false) { return true; } if (!$(this).hasClass('-active')) { $(partPaletteElement).removeClass('-active'); $(this).addClass('-active'); } else { return; } // scroll for palette navigation on the tablet for (var i = 0; i <= elementIndex; i++) { if (elementIndex == 0) { scrollLeft = 0; } else { if (i == elementIndex - 1) { scrollLeft = scrollLeft + $('.question-palette__part').eq(i).innerWidth() / 2; } else if (i < elementIndex) { scrollLeft = scrollLeft + $('.question-palette__part').eq(i).innerWidth(); } itemGap += 20; } } $nav.animate({ scrollLeft: scrollLeft + itemGap / 2 }, 'slow'); viewElms.forEach(function (currentValue, index, arr) { if ($(currentValue + ':eq(' + elementIndex + ')').length) { $(currentValue).hide(); $(currentValue).eq(elementIndex).show(); if (scrollDefault) { if (initNiceScroll) { $(currentValue + ':eq(' + elementIndex + ')').getNiceScroll(0).doScrollTop(0, 1000); } else { $(currentValue + ':eq(' + elementIndex + ')').animate({ scrollTop: 0 }, 'slow'); } } } }); updateNavButtons(elementIndex, scrollDefault); currentActivePart = $('.question-palette__part.-active').data('part'); }); function updateNavButtons(paletteIndex, scrollDefault = true) { var nextPartIndex = paletteIndex; $('#js-btn-wrap').data('partShow', nextPartIndex); if (nextPartIndex === totalTestPart - 1) { $('#js-btn-next').addClass('-disabled'); $('#js-btn-submit').addClass('-show'); } else { $('#js-btn-next').removeClass('-disabled'); $('#js-btn-submit').removeClass('-show'); } nextPartIndex === 0 ? $('#js-btn-previous').addClass('-disabled') : $('#js-btn-previous').removeClass('-disabled'); viewElms.forEach(function (value) { if ($(value + ':eq(' + nextPartIndex + ')').length) { $(value).hide(); $(value).eq(nextPartIndex).show(); if (scrollDefault) { if (initNiceScroll) { $(value + ':eq(' + nextPartIndex + ')').getNiceScroll(0).doScrollTop(0, 1000); } else { $(value + ':eq(' + nextPartIndex + ')').animate({ scrollTop: 0 }, 'slow'); } } } }); } } // Handle next and previous button for take test. function handleNextPreviousLRPart() { // Check body have class 'listening-test' or 'reading-test' if (!($('body').hasClass('listening-test') || $('body').hasClass('reading-test'))) { return; } if (checkMobileTablet()) { return; } var buttons = $('#js-btn-previous, #js-btn-next'); var currentPartIndex, nextPartIndex; var viewElms = ['.test-contents', '.test-panel']; var $nav = $('#question-palette-table'); var question_first = $('.question-palette__part.-active .question-palette__item').eq(0); var num_question_first = question_first.attr(`data-num`); var partPaletteElement = $('.question-palette__part'); var totalTestPart = partPaletteElement.length; var number_last_question = partPaletteElement.last().find('.question-palette__item:last-child').attr('data-num'); if (number_last_question.toString().indexOf('-') !== -1) { number_last_question = number_last_question.toString().split('-')[1]; } // Default active focus on first question. question_first.addClass('is-selected'); $('.iot-lr-question[data-num="' + num_question_first + '"]').focus(); // Click next/previous button. buttons.click(function (event) { currentPartIndex = $('#js-btn-wrap').data('partShow'); // Handle next button. if ($(this).hasClass('-next')) { var part, element_question; var part_active = $('.question-palette__part.-active').attr('data-part'); // Get number of question active. var num_question = $('.question-palette__item.is-selected').attr('data-num'); if (num_question.toString().indexOf('-') !== -1) { num_question = num_question.toString().split('-')[1]; } num_question++; // Check next question is exist. if ($('.question-palette__item[data-num="' + num_question + '"]').length) { element_question = $('.question-palette__item[data-num="' + num_question + '"]'); part = element_question.closest('.question-palette__part').attr('data-part'); } // Check question elm is multi question. else if ($('.question-palette__item[data-num-start="' + num_question + '"]').length) { element_question = $('.question-palette__item[data-num-start="' + num_question + '"]'); part = element_question.closest('.question-palette__part').attr('data-part'); num_question = element_question.attr('data-num-end'); } // Check part of next question is active. if (part === part_active) { // Trigger click focus next question. element_question.trigger('click'); // Check next question is last question. if (num_question >= parseInt(number_last_question) && part_active == totalTestPart) { $('#js-btn-next').addClass('-disabled'); return; } return; } // Next part. nextPartIndex = currentPartIndex + 1; } else { nextPartIndex = currentPartIndex - 1; } if (nextPartIndex === totalTestPart || nextPartIndex < 0) { event.preventDefault(); return true; } else { updateNavButtons(nextPartIndex); } // Active previous or next part. partPaletteElement.eq(nextPartIndex).trigger('click'); currentActivePart = $('.question-palette__part.-active').data('part'); // Clear active question. $('.question-palette__item').removeClass('is-selected'); // Get first question of previous or next part. var question_first = partPaletteElement.eq(nextPartIndex).find('.question-palette__item').eq(0); var num_question_first = question_first.attr(`data-num`); $('.iot-lr-question[data-num="' + num_question_first + '"]').focus(); $('.question-palette__item[data-num="' + num_question_first + '"]').addClass('is-selected'); // Scroll for palette navigation on the tablet var scrollLeft = 0; var itemGap = 0; var elementIndex = nextPartIndex; for (var i = 0; i <= elementIndex; i++) { if (elementIndex == 0) { scrollLeft = 0; } else { if (i == elementIndex - 1) { scrollLeft = scrollLeft + $('.question-palette__part').eq(i).innerWidth() / 2; } else if (i < elementIndex) { scrollLeft = scrollLeft + $('.question-palette__part').eq(i).innerWidth(); } itemGap += 20; } } $nav.animate({ scrollLeft: scrollLeft + itemGap / 2 }, 'slow'); }); $('.iot-lr-question').focus(function (event) { // Get number of question active. var itemIndex = $(this).attr('data-num'); $('.question-palette__item').removeClass('is-selected'); $('.question-palette__item[data-num="' + itemIndex + '"]').addClass('is-selected'); if (itemIndex != number_last_question) { $('#js-btn-next').removeClass('-disabled'); } else { $('#js-btn-next').addClass('-disabled'); } }); $('.question-palette__item').click(function (event) { $('.question-palette__item').removeClass('is-selected'); $(this).addClass('is-selected'); var itemIndex = $(this).data('num'); if (itemIndex != number_last_question) { $('#js-btn-next').removeClass('-disabled'); } else { $('#js-btn-next').addClass('-disabled'); } }); $(document).on('click', '.question-palette__part', function (event, scrollDefault = true) { var scrollLeft = 0; var itemGap = 0; var elementIndex = $(this).index(); var clickActive = $(this).data('clickActive'); if (clickActive == false) { return true; } if ($(this).hasClass('-active')) { return; } $(partPaletteElement).removeClass('-active'); $(this).addClass('-active'); // scroll for palette navigation on the tablet for (var i = 0; i <= elementIndex; i++) { if (elementIndex == 0) { scrollLeft = 0; } else { if (i == elementIndex - 1) { scrollLeft = scrollLeft + $('.question-palette__part').eq(i).innerWidth() / 2; } else if (i < elementIndex) { scrollLeft = scrollLeft + $('.question-palette__part').eq(i).innerWidth(); } itemGap += 20; } } $nav.animate({ scrollLeft: scrollLeft + itemGap / 2 }, 'slow'); viewElms.forEach(function (currentValue, index, arr) { if ($(currentValue + ':eq(' + elementIndex + ')').length) { $(currentValue).hide(); $(currentValue).eq(elementIndex).show(); if (scrollDefault) { if (initNiceScroll) { $(currentValue + ':eq(' + elementIndex + ')').getNiceScroll(0).doScrollTop(0, 1000); } else { $(currentValue + ':eq(' + elementIndex + ')').animate({ scrollTop: 0 }, 'slow'); } } } }); updateNavButtons(elementIndex, scrollDefault); currentActivePart = $('.question-palette__part.-active').data('part'); // Get first question of previous or next part. var question_first = $(this).find('.question-palette__item').eq(0); // Trigger focus first question. question_first.trigger('click'); }); function updateNavButtons(paletteIndex, scrollDefault = true) { var nextPartIndex = paletteIndex; $('#js-btn-wrap').data('partShow', nextPartIndex); if (nextPartIndex === totalTestPart - 1) { // $('#js-btn-next').addClass('-disabled'); $('#js-btn-submit').addClass('-show'); } else { $('#js-btn-next').removeClass('-disabled'); $('#js-btn-submit').removeClass('-show'); } if (nextPartIndex === 0) { $('#js-btn-previous').addClass('-disabled') } else { $('#js-btn-previous').removeClass('-disabled') } viewElms.forEach(function (value) { if ($(value + ':eq(' + nextPartIndex + ')').length) { $(value).hide(); $(value).eq(nextPartIndex).show(); if (scrollDefault) { if (initNiceScroll) { $(value + ':eq(' + nextPartIndex + ')').getNiceScroll(0).doScrollTop(0, 1000); } else { $(value + ':eq(' + nextPartIndex + ')').animate({ scrollTop: 0 }, 'slow'); } } } }); } } function splitReadingTestScreen() { var spliter; var panelDirection; if ($('.gutter.gutter-horizontal').length) { return; } function initializeSpliter() { var windowWidth = $(window).width(); panelDirection = (windowWidth < 768) ? 'vertical' : 'horizontal'; if ($('#split-one').length && $('#split-two').length) { spliter = Split(['#split-one', '#split-two'], { gutterSize: 4, sizes: [50, 50], direction: panelDirection, onDrag: onDragFunction }); } } function onDragFunction() { $('.test-panel, .test-contents').getNiceScroll().resize(); } function destroyAndRecreateSpliter() { if (spliter) { spliter.destroy(); initializeSpliter(); } } function handleWindowResize() { var windowWidth = $(window).width(); var panelDirectionResize = (windowWidth < 768) ? 'vertical' : 'horizontal'; if (panelDirectionResize !== panelDirection) { destroyAndRecreateSpliter(); panelDirection = panelDirectionResize; } } $(window).resize(handleWindowResize); initializeSpliter(); } // Run nice scroll bar for course introduction. function runTestPanelNiceScroll() { var windowWidth = $(window).width(); var elements = $('.test-panel, .test-contents'); if (windowWidth > 1024) { elements.niceScroll({ autohidemode: false, cursorborderradius: 6, cursorwidth: "8px", cursorcolor: "#dfdfdf", horizrailenabled: false, }); initNiceScroll = true; } else { elements.each(function(index, el) { $(el).getNiceScroll().remove(); initNiceScroll = false; }); } } // Show tooltip buttons. function showButtonsTooltip() { $('#js-full-screen').tooltip({ title: 'Full Screen Mode', placement: "bottom", trigger: "hover" }); if ($('.-practice-mode').length) { return; } $('.realtest-header__bt-submit').tooltip({ title: 'This function is not available in the real IELTS on computer test', placement: "bottom", trigger: "hover" }); } function reloadPage() { if ($('.-practice-mode').length) { return; } if ($('body').hasClass('anonymous-user')) { return; } var unloadCallback = function (event) { if ($('.-test_time-up').length || event.target.id === 'edit-submit') { return; } event.preventDefault(); event.returnValue = ""; return ""; }; window.addEventListener("beforeunload", unloadCallback); var someButton = $('.realtest-header__bt-submit, .modal-view-solution__btn, .waiting-card__btn.iot-grbt, #take-test-form #edit-submit, .speaking-test-page .realtest-header__btn-exit, .modal__button-wrap a, .writing-test .modal-body .iot-bt, .writing-test .modal-exit-test__footer a, #step-test-mic a#js-next-part, .wot2-take-test-form button#edit-submit, .practice-menu__submit, .modal-exit-test .modal--yes'); someButton.on("click", function () { window.removeEventListener("beforeunload", unloadCallback); }); // Disable reload page when submit form SOT. var takeTestForm = document.getElementById('take-test-form'); if (takeTestForm) { $(takeTestForm).on('submit', function () { window.removeEventListener('beforeunload', unloadCallback); }); } } function togglePracticeMenu() { $('#js-practice-menu').once().click(function () { $(this).toggleClass('is-active'); }); $('.practice-menu__item.-has-child').click(function (event) { event.stopPropagation(); var subMenu = $(this).find('ul'); $(this).toggleClass('active'); subMenu.stop().slideToggle(); }); document.addEventListener('click', function (event) { const menu = document.querySelector('.practice-nav'); if (menu) { const isClickInsideMenu = menu.contains(event.target); if (!isClickInsideMenu) { $('#js-practice-menu').removeClass('is-active'); $('.practice-menu__item.-has-child').removeClass('active'); $('.practice-menu__sub-menu').hide(); } } }); } //*** Change the fonsize on the test pages function changeTestPageFontSize() { var fonts = ["font-large", "font-medium", "font-small"]; $.each(fonts, function (i, sector) { $('a.' + sector).on("click", function (e) { $('body').addClass(sector); $('.fontsize-menu__font-link').removeClass('active'); $(this).addClass('active'); fonts.forEach(function (value) { if (value !== sector) { $('body').removeClass(value); } }); $('.mega-menu').toggleClass('active'); $('.mega-menu__font-size').stop().slideUp(); }); }) } function directGuidancePage() { $('.-btn-redirect-guidance-page').on('click', function (event) { event.preventDefault(); var url_general_guidance = drupalSettings.take_test.url_general_guidance; // Load the url general guidance. window.location.href = url_general_guidance; }); } function isMacOSAndSafari() { var userAgent = navigator.userAgent; var platform = navigator.platform; var macOSPlatforms = ['Macintosh', 'MacIntel', 'MacPPC', 'Mac68K']; var isMacOS = macOSPlatforms.indexOf(platform) !== -1; var isSafari = /^((?!chrome|android).)*safari/i.test(userAgent); return isMacOS && isSafari; } function checkMacOsAndSafari() { if (isMacOSAndSafari()) { $('#modal-refusal-safari').modal('show') return true; } } // Create function close popup will redirect to previous url. function closePopup() { $('.close-speaking-test-mode').on('click', function() { var url_redirect = $(this).data('url-redirect'); window.location.href = url_redirect; }); } // ------End GLOBAL functions ------ Drupal.behaviors.UserTakeTest = { attach: function (context, settings) { /* ----------------------------------------------- */ /* ------------- FrontEnd Functions -------------- */ /* ----------------------------------------------- */ /* OnLoad Page */ $(document).ready(function ($) { // Check full_test_fail show modal. var fullTestFail = drupalSettings.take_test.full_test_fail; if (fullTestFail) { $('#modal-full-test-notice').modal('show'); $('body').addClass('disabled-controls full-test-wrong'); directGuidancePage(); return ; } if ($('.speaking-test').length) { closePopup(); // Check MacOs and Safari. checkMacOsAndSafari(); var ioscheck = isiPhoneOriPad(); if(ioscheck) { $('#modal-refusal').modal('show') return true; } } // Global functions. // ----------------------------------- // Call functions for highlight and take note features. // Clear data note. /*clearDataNote();*/ // Show notepad. showNotePad(); //Handle notepad. setupNoteApp(); setNotepadHeight(); $(window).resize(function () { setNotepadHeight(); }); // Run nice scroll bar for notes. runNotesNiceScroll(); // Show button note and highlight when black out the text. initHighlighter(); initNote(); // Show tooltip. showHighlightTooltip(); // End handle for highlight and take note features. // ----------------------------------- // ----------------------------------- // Handle click to switch parts. // Init part panel run nice scroll bar. runTestPanelNiceScroll(); // Next and previous part. nextPreviousPart(); handleNextPreviousLRPart(); splitReadingTestScreen(); // ----------------------------------- // Full Screen Mode. showFullScreen(); // Reload page show warning message. reloadPage(); // Click navbar show submenus. togglePracticeMenu() // Change the font size on the test pages. changeTestPageFontSize() showButtonsTooltip(); // ----------------------------------- // ------End Global functions ------ // ----------------------------------- }) } } })(jQuery, Drupal, drupalSettings); ; (function ($, Drupal, drupalSettings) { "use strict"; var uploading = false; // ----------------------------------- // Load page when click previous button. window.addEventListener( "pageshow", function ( event ) { var historyTraversal = event.persisted || ( typeof window.performance != "undefined" && window.performance.navigation.type === 2 ); if ( historyTraversal ) { // Handle page restore. window.location.reload(); } }); // [READING/LISTENING] Define function save data to local storage // and post data to server. // Handle set cookie. var quiz_id = Drupal.getQuizMode(); Drupal.setCookie = function (name, value, days) { var expires = ""; if (days) { var date = new Date(); date.setTime(date.getTime() + (days * 24 * 60 * 60 * 1000)); expires = "; expires=" + date.toUTCString(); } document.cookie = name + "=" + (value || "") + expires + "; path=/"; } // Handle get cookie. Drupal.getCookie = function (name) { var nameEQ = name + "="; var ca = document.cookie.split(';'); for (var i = 0; i < ca.length; i++) { var c = ca[i]; while (c.charAt(0) == ' ') { c = c.substring(1, c.length); } if (c.indexOf(nameEQ) == 0) { return c.substring(nameEQ.length, c.length); } } return null; } // Handle update the number of answered questions. Drupal.updateAnsweredQuestions = function () { if ($('.question-palette__item').length) { var answers = {} var totalAnswered = 0; var count_questions = $('.question-palette__item').length; var count_questions_not_answered = $('.question-palette__item:not(.-checked)').length; var count_questions_answered = count_questions - count_questions_not_answered; // Get all answered questions. $('.question-palette__item').each(function (index, el) { if ($(this).hasClass('-checked')) { var q_type = $(this).attr('data-q_type') var answer = $(this).attr('data-answer'); $('.modal-review-test__table .result-table').find('[data-num="' + $(this).data('num') + '"] em').text(answer); if (q_type == 15 || q_type == 6) { answer = JSON.parse($(this).attr('data-answer')); $('.modal-review-test__table .result-table').find('[data-num="' + $(this).data('num') + '"] em').text(Object.values(answer).join(",")); if ($(this).data('numStart') && $(this).data('numEnd')) { var numStart = $(this).data('numStart'); var numEnd = $(this).data('numEnd'); var totalGroupQuestion = (numEnd - numStart) + 1; if (totalGroupQuestion > Object.keys(answer).length) { totalAnswered += Object.keys(answer).length; } else { totalAnswered += totalGroupQuestion; } } else { totalAnswered += 1; } } else { totalAnswered += 1; } answers[$(this).data('num')] = { 'num': $(this).data('num'), 'answer': answer, 'q_type': q_type } } else { $('.modal-review-test__table .result-table').find('[data-num="' + $(this).data('num') + '"] em').text(''); } }) // Count answered questions for each part. $('.question-palette__part').each(function (index, el) { var count_questions = $(this).find('.question-palette__item.-checked:not(.-group)').length; var count_questions_group = 0; // For each count group question. $(this).find('.question-palette__item.-checked.-group').each(function (index, el) { var answer = JSON.parse($(this).attr('data-answer')); if ($(this).data('numStart') && $(this).data('numEnd')) { var numStart = $(this).data('numStart'); var numEnd = $(this).data('numEnd'); var totalGroupQuestion = (numEnd - numStart) + 1; if (totalGroupQuestion > Object.keys(answer).length) { count_questions_group += Object.keys(answer).length; } else { count_questions_group += totalGroupQuestion; } } }); var totalAnsweredPart = count_questions + count_questions_group; $(this).find('.question-palette__part-status .number').text(totalAnsweredPart); var totalQuestionPart = $(this).find('span.total').text(); if (totalQuestionPart == totalAnsweredPart) { $(this).addClass('-finished') } else { $(this).removeClass('-finished') } }); // Save answered questions to local storage. var data_quiz = Drupal.getDataLocalStorage(quiz_id); data_quiz = JSON.parse(data_quiz); if (data_quiz) { if (Object.keys(answers).length) { data_quiz['answers'] = answers; } else { delete data_quiz['answers']; } data_quiz['total_answered'] = totalAnswered; Drupal.setDataLocalStorage(quiz_id, data_quiz); } toggleNotifySaved(); } } // Handle set data in local storage. Drupal.setDataLocalStorage = function (quiz_id, data) { var taketest_string = Drupal.getCookie('taketest'); if (!taketest_string) { var randomstring = Math.random().toString(36).slice(-8); Drupal.setCookie('taketest', randomstring, 30); taketest_string = Drupal.getCookie('taketest') } if (localStorage.getItem(taketest_string + quiz_id + '_timecurrent')) { data['time'] = localStorage.getItem(taketest_string + quiz_id + '_timecurrent'); } localStorage.setItem(taketest_string + quiz_id, JSON.stringify(data)); } // Handle get data in local storage. Drupal.getDataLocalStorage = function (quiz_id) { var taketest_string = Drupal.getCookie('taketest'); if (!taketest_string) { return; } if (localStorage.getItem(taketest_string + quiz_id)) { return localStorage.getItem(taketest_string + quiz_id); } return; } // Handler delete data in local storage. Drupal.deleteDataLocalStorage = function (quiz_id) { var taketest_string = Drupal.getCookie('taketest'); if (!taketest_string) { return; } if (localStorage.getItem(taketest_string + quiz_id + '_timecurrent')) { localStorage.removeItem(taketest_string + quiz_id + '_timecurrent'); } if (localStorage.getItem(taketest_string + quiz_id + '_time_audio')) { localStorage.removeItem(taketest_string + quiz_id + '_time_audio'); } if (localStorage.getItem(taketest_string + quiz_id)) { localStorage.removeItem(taketest_string + quiz_id); } } // Handle get item by quiz_id in local storage. Drupal.getItemLocalStorage = function (quiz_id, name_item) { var taketest_string = Drupal.getCookie('taketest'); if (!taketest_string) { return; } if (localStorage.getItem(taketest_string + quiz_id + '_' + name_item)) { return localStorage.getItem(taketest_string + quiz_id + '_' + name_item); } return; } // Handle set item by quiz_id in local storage. Drupal.setItemLocalStorage = function (quiz_id, name_item, value) { var taketest_string = Drupal.getCookie('taketest'); if (!taketest_string) { return; } localStorage.setItem(taketest_string + quiz_id + '_' + name_item, value); } // Format 00:00 to second. Drupal.convertSeconds = function (time) { var arr_time = time.split(':'); var seconds = parseInt(arr_time[0]) * 60 + parseInt(arr_time[1]); return seconds; } // Get csrf token. Drupal.getCsrfToken = function (callback) { var data_settings_take_test = drupalSettings.take_test; var url_rest_csrftoken = data_settings_take_test.url_rest_csrftoken; // Check url rest csrftoken is undefined or not in drupalSettings. if (url_rest_csrftoken === undefined) { return; } $.get(url_rest_csrftoken) .done(function (data) { var csrfToken = data; callback(csrfToken); }); } // Post data to server. Drupal.postNode = function (csrfToken, data, status) { if (uploading) { return false; } uploading = true; var data_settings_take_test = drupalSettings.take_test; var url_store_result = data_settings_take_test.url_store_result; // Check url store result is undefined or not in drupalSettings. if (url_store_result === undefined) { return; } $.ajax({ url: url_store_result, method: 'POST', headers: { 'Content-Type': 'application/json', 'X-CSRF-Token': csrfToken }, data: JSON.stringify(data), success: function (res) { uploading = false; if (status === 1 && res.url) { Drupal.deleteDataLocalStorage(quiz_id) if ('.modal.fade.in'.length) { $('.modal.fade.in').modal('hide'); } if (!$('body').hasClass('-full-test-mode')){ $('#modal-finish').modal('show'); } Drupal.pendingTimeClock(); setTimeout(function () { window.location.pathname = res.url; }, 500); } else { $('.modal-save-draft').modal('show'); } }, error: function (XMLHttpRequest, textStatus, errorThrown) { console.log("Status: " + textStatus); console.log("Error: " + errorThrown); } }); } // if status = 1 => submit test. // if status = 0 => save draft. Drupal.postDataTest = function (status = 1) { var data_post = Drupal.getDataLocalStorage(quiz_id); data_post = JSON.parse(data_post); var time_taketest = Drupal.getItemLocalStorage(quiz_id, 'timecurrent'); if (time_taketest !== null && time_taketest !== undefined && time_taketest !== '') { data_post['time'] = time_taketest; } // Only Listening Test. var time_audio = Drupal.getItemLocalStorage(quiz_id, 'time_audio'); if (time_audio !== null && time_audio !== undefined && time_audio !== '') { data_post['time_audio'] = time_audio; } data_post['status'] = status; if (data_post['answers'] === undefined && data_post['mode'] !== 'full_test') { $('div#modal-do-not-work-lr').modal('show'); return; } // Post data to server. Drupal.getCsrfToken(function (csrfToken) { Drupal.postNode(csrfToken, data_post, status); }); } //Reload data from local storage or draft data. Drupal.reloadDataDefault = function () { // var data_quiz = Drupal.getDataLocalStorage(quiz_id); var mode = drupalSettings.take_test.mode; var parts = drupalSettings.take_test.parts; var duration = drupalSettings.take_test.duration; var ielts_score_id = drupalSettings.take_test.ielts_score_id; var type = drupalSettings.take_test.type; // if (mode !== "practice_test") { Drupal.deleteDataLocalStorage(quiz_id); var data_quiz = null; // } // if (data_quiz == null) { data_quiz = { 'quiz_id': drupalSettings.take_test.quiz_id, 'score_id': '', 'status': 1, 'mode': mode, 'parts': parts, 'duration': duration, 'type': type, } if (ielts_score_id !== undefined) { data_quiz['ielts_score_id'] = ielts_score_id; } // Save data in local storage. Drupal.setDataLocalStorage(quiz_id, data_quiz); // } // else { // data_quiz = JSON.parse(data_quiz); // } // Get data draft. var data_draft = drupalSettings.take_test.data_draft; if (data_draft !== undefined && data_draft != null && mode === "practice_test") { data_quiz['answers'] = data_draft.answers; data_quiz['time'] = data_draft.time; Drupal.setItemLocalStorage(quiz_id, 'timecurrent', data_draft.time); // Save data in local storage. Drupal.setDataLocalStorage(quiz_id, data_quiz); } if (data_quiz) { var time = Drupal.getItemLocalStorage(quiz_id, 'timecurrent'); if (time) { // Convert 00:00 to seconds. var timeArr = time.split(':'); var seconds = parseInt(timeArr[0]) * 60 + parseInt(timeArr[1]); if (data_draft.duration_default != 0) { var seconds_default = $('#time-clock').attr('data-time'); if (seconds_default - parseInt(seconds) > 0) { $('#time-clock').attr('data-time', seconds_default - parseInt(seconds)); } else { Drupal.deleteDataLocalStorage(quiz_id); // Call function reload data default. Drupal.reloadDataDefault(); return; } } else{ $('#time-clock').attr('data-time', parseInt(seconds)); } } var answers = data_quiz.answers; if (answers) { for (var key in answers) { var answer = answers[key]; var num = answer.num; var answer_value = answer.answer; var q_type = answer.q_type var question = $('.question-palette__item[data-num="' + num + '"]'); if (question.length) { if (q_type == 15) { question.attr('data-answer', JSON.stringify(answer_value)); question.attr('data-q_type', q_type); $('.modal-review-test__table .result-table').find('[data-num="' + num + '"] em').text(Object.values(answer_value).join(",")); } else { question.attr('data-answer', answer_value); $('.modal-review-test__table .result-table').find('[data-num="' + num + '"] em').text(answer_value); } question.addClass('-checked'); // Check if question is input text or select option or radio or // checkbox. if ($('.test-panel__item').find('[data-num="' + num + '"]').length) { var inputElm = $('.test-panel__item').find('[data-num="' + num + '"]'); if (inputElm.is('input[type="text"]')) { inputElm.val(answer_value); } else if (inputElm.is('select')) { inputElm.val(answer_value); } else if (inputElm.is('input[type="radio"]')) { inputElm.each(function (index, el) { if ($(this).val() === answer_value) { $(this).prop('checked', true); } }); } else if (inputElm.is('input[type="checkbox"]')) { var answer_checkbox_value = answer_value; inputElm.each(function (index, el) { if (answer_checkbox_value[index]) { $(this).prop('checked', true); } }); } // Render answer for drag and drop question. if (inputElm.is('span')) { inputElm.each(function (index, el) { if ($(this).hasClass('drag-panel__drag-answer-input')) { var parent = $(this).closest('.test-panel__item'); var drag_drop_item = $(this).find('.drag-panel__list-group-item'); var drag_panel_item = parent.find('.drag-panel .drag-panel__list-group-item'); // Find element in drag panel have text equal answer and // remove element. drag_panel_item.each(function (index, el) { if ($(this).text() === answer_value) { drag_drop_item.removeClass('spilled').attr('draggable', 'false').html(answer_value); $(this).remove(); return false; } }) } }) } } countQuestionAnsweredPart(question); } } } } } // ------------------------------------- // Count the number of answered questions in each part. function countQuestionAnsweredPart(element) { var parent = element.parents('.question-palette__part'); var question_answered = parent.find('.question-palette__item.-checked:not(.-group)').length; var question_answered_group = 0; // For each count group question. parent.find('.question-palette__item.-checked.-group').each(function (index, el) { var answer = JSON.parse($(this).attr('data-answer')); if ($(this).data('numStart') && $(this).data('numEnd')) { var numStart = $(this).data('numStart'); var numEnd = $(this).data('numEnd'); var totalGroupQuestion = (numEnd - numStart) + 1; if (totalGroupQuestion > Object.keys(answer).length) { question_answered_group += Object.keys(answer).length; } else { question_answered_group += totalGroupQuestion; } } }); var totalAnsweredPart = question_answered + question_answered_group; parent.find('.question-palette__part-status .number').text(totalAnsweredPart); var totalQuestionPart = parent.find('span.total').text(); if (totalQuestionPart == totalAnsweredPart) { parent.addClass('-finished') } else { parent.removeClass('-finished') } } // Toggle show/hide notify saved. function toggleNotifySaved() { $('.realtest-header__btn-save').removeClass('save_hidden'); setTimeout(function () { $('.realtest-header__btn-save').addClass('save_hidden'); }, 1000) } // Update answered questions. function updateQuestionPaletteResult() { var questionPalette = '#question-palette-table .question-palette__item'; $(document).click(function (event) { // Check event click is checkbox-iot, test-panel__input-answer, radio-iot , iot-dropdown. // highlight the question being pointed to. if ($(event.target).hasClass('checkbox-iot') || $(event.target).hasClass('test-panel__input-answer') || $(event.target).hasClass('radio-iot') || $(event.target).hasClass('iot-dropdown') || $(event.target).hasClass('drag-panel__drag-answer-input')) { // Get number question. var numberQuestion = $(event.target).attr('data-num'); if ($(questionPalette + '[data-num="' + numberQuestion + '"]').length) { // Clear class "is-selected" of all question. $(questionPalette).removeClass('is-selected'); // Add class "is-selected" to question being pointed to. $(questionPalette + '[data-num="' + numberQuestion + '"]').addClass('is-selected'); } } }) //events fired on radio change $('.radio-iot').change(function (event) { var numberQuestion = parseInt($(this).data('num')); var value = $(this).val(); if (!$(questionPalette + '[data-num="' + numberQuestion + '"]').length) { return; } $(questionPalette + '[data-num="' + numberQuestion + '"]').addClass('-checked'); $(questionPalette + '[data-num="' + numberQuestion + '"]').attr('data-answer', value); Drupal.updateAnsweredQuestions(); }); //events fired on check-box change $('.checkbox-iot').change(function (event) { var numberQuestion = $(this).data('num'); if (!$(questionPalette + '[data-num="' + numberQuestion + '"]').length) { return; } var inputElms = $(this).closest('.test-panel__answer').find('input'); var checkedElms = 0; var values = {}; inputElms.each(function (index, el) { if ($(this).is(':checked')) { checkedElms += 1; values[index] = $(this).val(); } }); if (checkedElms) { $(questionPalette + '[data-num="' + numberQuestion + '"]').addClass('-checked'); $(questionPalette + '[data-num="' + numberQuestion + '"]').attr('data-answer', JSON.stringify(values)); $(questionPalette + '[data-num="' + numberQuestion + '"]').attr('data-q_type', $(this).data('q_type')); } else { $(questionPalette + '[data-num="' + numberQuestion + '"]').removeClass('-checked'); $(questionPalette + '[data-num="' + numberQuestion + '"]').removeAttr('data-answer'); } Drupal.updateAnsweredQuestions(); }); //events fired on text input change $('.test-panel__input-answer').bind('keyup keydown change', function (event) { var numberQuestion = parseInt($(this).data('num')); if (!$(questionPalette + '[data-num="' + numberQuestion + '"]').length) { return; } var answerVal = $(this).val().trim(); if (answerVal == '' && !$(questionPalette + '[data-num="' + numberQuestion + '"]').hasClass('-checked')) { return; } if (answerVal.length) { $(questionPalette + '[data-num="' + numberQuestion + '"]').addClass('-checked'); $(questionPalette + '[data-num="' + numberQuestion + '"]').attr('data-answer', answerVal); } else { $(questionPalette + '[data-num="' + numberQuestion + '"]').removeClass('-checked'); $(questionPalette + '[data-num="' + numberQuestion + '"]').removeAttr('data-answer'); } Drupal.updateAnsweredQuestions(); }); //events fired on select option change $('.iot-dropdown').change(function (event) { var numberQuestion = parseInt($(this).data('num')); if (!$(questionPalette + '[data-num="' + numberQuestion + '"]').length) { return; } var selectValue = $(this).val(); if (selectValue) { $(questionPalette + '[data-num="' + numberQuestion + '"]').addClass('-checked'); $(questionPalette + '[data-num="' + numberQuestion + '"]').attr('data-answer', selectValue); } else { $(questionPalette + '[data-num="' + numberQuestion + '"]').removeClass('-checked'); $(questionPalette + '[data-num="' + numberQuestion + '"]').removeAttr('data-answer'); } Drupal.updateAnsweredQuestions(); }); } // Scroll to position when click on question palette (For Listening/Reading // test). function scrollToSpecifiedQuestion() { var offsettop_question = {}; var current_question_scroll_top; $('.question-palette__item').click(function (event) { $('.question-palette__item').each(function () { var itemIndex = $(this).data('num'); var question = $(".take-test__board [data-num='" + itemIndex + "']"); if (offsettop_question[itemIndex] === undefined && $(question).offset().top > 0) { offsettop_question[itemIndex] = $(question).offset().top; } }) $(this).addClass('is-selected'); var itemIndex = $(this).data('num'); var question = $(".take-test__board [data-num='" + itemIndex + "']"); var sectionQuestion = question.parents('.test-panel'); var focusTag = $("input[data-num='" + itemIndex + "'], select[data-num='" + itemIndex + "']"); if (!(current_question_scroll_top == itemIndex)) { var padding_top = 0; if ($(".take-test__board").css('padding-top') !== undefined) { padding_top = parseInt($(".take-test__board").css('padding-top').replace('px', '')); } var question_wrap_offset_top = $(".take-test__board").offset().top; current_question_scroll_top = itemIndex; sectionQuestion.stop().animate({ scrollTop: offsettop_question[itemIndex] - question_wrap_offset_top - padding_top - 50 }, 1000); } // hidden palette on mobile $('body').removeClass('showing-palette'); if (focusTag.length) { focusTag.focus(); } }); } // Render the number of answered questions in modal preview. function renderModalPreview() { if ($('.modal-review-test__table').length) { var arr = {}; var tpl = ''; $('.question-palette__item').once().each(function (index, el) { // Render question palette each group question. var num = $(this).data('num'); // Divided by 4 to get the group question number var groupNum = Math.ceil((index + 1) / 4); // render html for each group question. if (arr[groupNum] === '') { } tpl += '
    Q' + num + ':
    '; // Check index+1 == 4 or index+1 == 8 or index+1 == 12 or index+1 == 16 // to push html to array. if ((index + 1) % 4 === 0) { var elm = $('
    '); elm.append(tpl); arr[groupNum] = elm[0].outerHTML; tpl = ''; } else if (index === $('.question-palette__item').length - 1) { var elm = $('
    '); elm.append(tpl); arr[groupNum] = elm[0].outerHTML; tpl = ''; } }); // Append html of array to modal. for (var key in arr) { $('.modal-review-test__table .result-table').append(arr[key]); } } } // Save draft data. function saveDraftData() { $('.practice-menu__save-draft').once('save_draft').click(function (event) { Drupal.postDataTest(0); }) } // Handle exit test. function handleExitTest() { $('.-btn-exits-test').click(function (event) { event.preventDefault(); var url_collection = drupalSettings.take_test.url_collection; // Load to collection page. window.location.href = url_collection; }) } // Reset data when exit test, reload page, close tab. function resetDataTakeTest() { window.onunload = function () { Drupal.deleteDataLocalStorage(quiz_id) } } Drupal.behaviors.ListeningReadingTakeTest = { attach: function (context, settings) { // Update answered questions. // Drupal.updateAnsweredQuestions(); resetDataTakeTest(); updateQuestionPaletteResult(); scrollToSpecifiedQuestion(); renderModalPreview() saveDraftData(); handleExitTest() } } })(jQuery, Drupal, drupalSettings); ; (function ($, Drupal, drupalSettings) { 'use strict'; var listeningPlayer; var quiz_id = Drupal.getQuizMode(); var flag_change_audio = false; function initListeningPlayer() { if ($('body.listening-test.-practice-mode').length) { return; } var playingStatus = false; var audioSources = []; var audioSourceIndex = 0; var controlBtns = []; if ($('#listening-audio-player').length) { controlBtns = ['mute', 'volume']; } else { return; } // Init audio player. listeningPlayer = new Plyr('.take-test__player', { controls: controlBtns, hideControls: false, youtube: { noCookie: true, }, // debug: true, }); var sources = $('#listening-audio-player').data('sources'); if (sources['youtube'] !== undefined && sources['youtube'] !== null) { var id_youtube = sources['youtube'].replace('https://www.youtube.com/watch?v=', ''); var audioSourceArr = []; var audioObj = {}; audioSourceArr = [ { provider: 'youtube', src: id_youtube, } ] audioObj = { type: 'video', sources: audioSourceArr } audioSources.push(audioObj); } if (sources['aliyun'] !== undefined && sources['aliyun'] !== null) { var audioSourceArr = []; var audioObj = {}; audioSourceArr = [ { src: sources['aliyun'], type: 'audio/mp3', } ] audioObj = { type: 'audio', sources: audioSourceArr } audioSources.push(audioObj); } // Initialize listeningPlayer with the initial source listeningPlayer.source = audioSources[0]; // [ERROR] Listen for error events on audio and video listeningPlayer.on('error', (event) => { const mediaElement = event.detail.plyr.media; // Check for media source error if (mediaElement.error) { console.error('Error on video:', event.detail.message); } // Switch to another audio source if (audioSourceIndex < audioSources.length - 1) { audioSourceIndex += 1; } else { audioSourceIndex = 0; } listeningPlayer.source = audioSources[audioSourceIndex]; }); // [PLAYING] Listen for playing events listeningPlayer.on('playing', event => { if (drupalSettings.tour) { if (!localStorage.getItem('tour_visited_product-tour-listening-take-test-pages') && !$('body').hasClass('-full-test-mode')) { listeningPlayer.pause() $('.take-test__click-play').show(); return; } } if (!playingStatus) { Drupal.runTimeClock(timeEndListening); } playingStatus = true; $('body').removeClass('disabled-controls'); setTimeout(function () { $('.take-test__click-play').hide(); }, 1000) }); // [PLAY] Listen for play events listeningPlayer.on('play', event => { // Check if video is not currently playing if (!listeningPlayer.playing) { console.log('Event to play fired but video not playing'); // Switch to another audio source if (audioSourceIndex < audioSources.length - 1) { audioSourceIndex += 1; } else { audioSourceIndex = 0; } listeningPlayer.source = audioSources[audioSourceIndex]; } }) // [READY] Listen for ready events. listeningPlayer.on('ready', event => { if ($('.test-notice.modal-test-notice').length) { return; } $('#js-click-play').click(function (event) { if ($('body').hasClass('guide_tour_active')) { return; } $('body').removeClass('disabled-controls'); $(this).closest('.take-test__click-play').hide(); listeningPlayer.play(); }); if ($('.listening-test').length) { listeningPlayer.volume = 1; if (listeningPlayer.isYouTube) { listeningPlayer.play(); } else { listeningPlayer.play().catch(error => { console.log(error); }) } } }); // [TIMEUPDATE] Listen for timeupdate events listeningPlayer.on('timeupdate', event => { // check timecurrent is 0 or NaN then show modal. var timecurrent = listeningPlayer.currentTime; if (timecurrent == 0 || isNaN(timecurrent)) { $('.take-test__click-play').show(); $('.take-test__play-btn_click').show() $('body').addClass('disabled-controls'); } else { $('.take-test__click-play').hide(); // Convert time audio play (second) to time (mm:ss). eg: 01:02, 02:30. // Have number 0 before number < 10. var time = listeningPlayer.currentTime; var minutes = Math.floor(time / 60); var seconds = Math.floor(time - minutes * 60); minutes = minutes < 10 ? '0' + minutes : minutes; seconds = seconds < 10 ? '0' + seconds : seconds; var time_format = minutes + ':' + seconds; Drupal.setItemLocalStorage(quiz_id, 'time_audio', time_format) } }) } function initListeningPracticePlayer() { if (!$('body.listening-test.-practice-mode').length) { return; } var playingStatus = false; var audioSources = []; var audioSourceIndex = 1; var controlBtns = []; var flag_pause = false; var mode = drupalSettings.take_test.mode; if ($('#listening-practice-player').length) { controlBtns = ['play-large', 'rewind', 'play', 'fast-forward', 'current-time', 'progress', 'mute', 'volume']; } else { return; } $('.take-test__click-play').show(); $('body').addClass('disabled-controls'); setTimeout(function () { $('.take-test__play-btn_click').show() }, 2000) // Init audio player listeningPlayer = new Plyr('.take-test__player', { controls: controlBtns, hideControls: false, seekTime: 5, youtube: { noCookie: true, }, }); // Get audio sources from data attribute. $('.take-test__audio-option').each(function (index, el) { var audioType = $(this).data('audioType'); var audioSource = $(this).data('audioSource'); var audioSourceArr = []; var audioObj = {}; var audioTypeSouce = audioType == "video" ? "youtube" : "aliyun" if ($(".question-palette__part.-active").length) { var audio_parts = $(".question-palette__part.-active").attr('data-audio') if (!(audio_parts == undefined || audio_parts == null)) { // Remove element listen-from-here. $(".listen-from-here").remove(); $(".question-palette__part.-active").addClass('-play-audio'); // convert json string to object. audio_parts = JSON.parse(audio_parts); if (audio_parts[audioTypeSouce] !== undefined && audio_parts[audioTypeSouce] !== null) { audioSource = audio_parts[audioTypeSouce] } else { return } } } if (audioType === 'video') { audioSourceArr = [ { src: audioSource, provider: 'youtube', }, ]; } else { audioSourceArr = [ { src: audioSource, type: 'audio/mp3', }, ]; } audioObj = { type: audioType, sources: audioSourceArr } audioSources.push(audioObj); }); // Initialize listeningPlayer with the initial source listeningPlayer.source = audioSources[0]; // [Error] Listen for error events on audio and video listeningPlayer.on('error', (event) => { const mediaElement = event.detail.plyr.media; // Check for media source error if (mediaElement.error) { console.error('Error on video:', event.detail.message); } if (audioSources.length > 1) { // Switch to another audio source if (audioSourceIndex < audioSources.length - 1) { audioSourceIndex += 1; } else { audioSourceIndex = 1; } // listeningPlayer.source = audioSources[audioSourceIndex]; // Change select audio source. $("#audio-source").val('Source ' + audioSourceIndex).trigger('change'); } }); // [PLAYING] Listen for playing events listeningPlayer.on('playing', event => { if (drupalSettings.tour) { if (!localStorage.getItem('tour_visited_product-tour-listening-take-test-pages') && !$('body').hasClass('-full-test-mode')) { listeningPlayer.pause() $('.take-test__click-play').show(); return; } } if (!playingStatus) { Drupal.runTimeClock(timeEndListening); } if (listeningPlayer.playing) { playingStatus = true; $('body').removeClass('disabled-controls'); $('.take-test__click-play').hide(); } else { $('.take-test__click-play').show(); $('body').addClass('disabled-controls'); setTimeout(function () { $('.take-test__play-btn_click').show() }, 2000) } }); // [PLAY] Listen for play events listeningPlayer.on('play', event => { // Check if video is not currently playing if (!listeningPlayer.playing) { console.log('Event to play fired but video not playing'); // Switch to another audio source if (audioSourceIndex < audioSources.length) { audioSourceIndex += 1; } else { audioSourceIndex = 1; } // Change audio source. listeningPlayer.source = audioSources[audioSourceIndex-1]; // Change select audio source. $("#audio-source").val('Source ' + audioSourceIndex).trigger('change'); } }) // [READY] Listen for ready events. listeningPlayer.on('ready', event => { if ($('.test-notice.modal-test-notice').length) { return; } // Click to play audio. $('#js-click-play').click(function (event) { if ($('body').hasClass('guide_tour_active')) { return; } $('body').removeClass('disabled-controls'); $(this).closest('.take-test__click-play').hide(); listeningPlayer.play(); }); // if (flag_pause) { // return; // } if ($('.listening-test').length) { listeningPlayer.volume = 1; if (listeningPlayer.isYouTube) { listeningPlayer.play(); } else { listeningPlayer.play().catch(error => { console.log(error); }) } } // Click to change audio source $("#audio-source").on("change", function () { flag_change_audio = true; var audioObject = {}; var audioSourceArr = []; var audioSource = $(this).find("option:selected").data("audioSource"); var audioType = $(this).find("option:selected").data("audioType"); var audioTypeSouce = audioType == "video" ? "youtube" : "aliyun" if ($(".question-palette__part.-active").length) { var audio_parts = $(".question-palette__part.-active").attr('data-audio') if ( audio_parts !== undefined && audio_parts !== null) { // Convert json string to object. audio_parts = JSON.parse(audio_parts); if (audio_parts[audioTypeSouce] !== undefined && audio_parts[audioTypeSouce] !== null) { audioSource = audio_parts[audioTypeSouce] } } } if (audioType === 'video') { audioSourceArr = [ { src: audioSource, provider: 'youtube', }, ]; } else { audioSourceArr = [ { src: audioSource, type: 'audio/mp3', }, ]; } audioObject = { type: audioType, sources: audioSourceArr } listeningPlayer.source = audioObject; }); // Click to listen from here $('.listen-from-here').click(function(event) { var timeToSeek = $(this).data('time') || 0; if (listeningPlayer) { listeningPlayer.currentTime = timeToSeek; if (listeningPlayer.paused) { listeningPlayer.play(); } } }); }); // Click part active to change audio source. $(".question-palette__part").click(function(event) { if($(this).hasClass('-active')) { return; } var audio_parts = $(this).attr("data-audio") // Check audio_parts is undefined or null then return. if (audio_parts == undefined || audio_parts == null) { return } // Convert json string to object. audio_parts = JSON.parse(audio_parts) // Check audio_parts's length is 1 then hide audio source select. if (Object.keys(audio_parts).length == 1) { $(".take-test__audio-source").hide() } else { $(".take-test__audio-source").show() } var audioSource = audio_parts["aliyun"] var audioType = "audio" if (audio_parts["youtube"] !== undefined && audio_parts["youtube"] !== null) { audioSource = audio_parts["youtube"] audioType = "video" } var audioObject = {} var audioSourceArr = [] if (audioType === "video") { audioSourceArr = [ { src: audioSource, provider: "youtube", }, ] } else { audioSourceArr = [ { src: audioSource, type: "audio/mp3", }, ] } audioObject = { type: audioType, sources: audioSourceArr, } // console.log('Change audio source') listeningPlayer.source = audioObject if ($(this).hasClass('-play-audio')) { flag_pause = true; } else { $(this).addClass('-play-audio'); flag_pause = false; } }) // [TIMEUPDATE] Listen for timeupdate events listeningPlayer.on('timeupdate', event => { // check timecurrent is 0 or NaN then show modal. var timecurrent = listeningPlayer.currentTime; if (timecurrent == 0 || isNaN(timecurrent)) { if (flag_change_audio) { return; } if (!$('body').hasClass('-start')) { $('body').addClass('-start'); } else { return; } $('.take-test__click-play').show(); $('body').addClass('disabled-controls'); setTimeout(function () { $('.take-test__play-btn_click').show() }, 2000) } else { flag_change_audio = false; $('.take-test__click-play').hide(); // Convert time audio play (second) to time (mm:ss). eg: 01:02, 02:30. // Have number 0 before number < 10. var time = listeningPlayer.currentTime; var minutes = Math.floor(time / 60); var seconds = Math.floor(time - minutes * 60); minutes = minutes < 10 ? '0' + minutes : minutes; seconds = seconds < 10 ? '0' + seconds : seconds; var time_format = minutes + ':' + seconds; Drupal.setItemLocalStorage(quiz_id, 'time_audio', time_format) } }) } // Handle submit after the time is up. var timeEndListening = function () { if (this.expired()) { var mode = drupalSettings.take_test.mode; $('body').addClass('-test_time-up'); if (mode == 'practice_test') { // Pause audio. listeningPlayer.pause() if ($('.question-palette__item.-checked').length) { $('#modal-time-up').modal('show'); } else { $('#modal-time-up-no-taketest').modal('show'); } } else if (mode == 'simulation_test') { if ($('.question-palette__item.-checked').length) { Drupal.postDataTest(); } else { $('#modal-time-up-no-taketest').modal('show'); } } else { Drupal.postDataTest() } } }; function clickSubmitTakeTest() { var button_submit = $('.realtest-header__bt-submit') button_submit.click(function () { var mode = drupalSettings.take_test.mode; if (mode === 'practice_test') { var timecurrent = Drupal.getItemLocalStorage(quiz_id, 'timecurrent'); // convert 00:00 to second. var timecurrent_seconds = Drupal.convertSeconds(timecurrent); var time_duration_default = $('#time-clock').data('duration-default') if (time_duration_default == 0) { if ($('.question-palette__item.-checked').length) { $('#modal-submit-test').modal('show'); } else { $('#modal-do-not-work-lr').modal('show'); } } else { if (time_duration_default - timecurrent_seconds > 0) { if ($('.question-palette__item.-checked').length) { $('#modal-submit-test').modal('show'); } else { $('#modal-do-not-work-lr').modal('show'); } } else { if ($('.question-palette__item.-checked').length) { $('#modal-time-up').modal('show'); } else { $('#modal-time-up-no-taketest').modal('show'); } } } } else if (mode === 'simulation_test') { var timecurrent = Drupal.getItemLocalStorage(quiz_id, 'timecurrent'); // convert 00:00 to second. var timecurrent_seconds = Drupal.convertSeconds(timecurrent); var time_duration_default = $('#time-clock').data('duration-default') if (time_duration_default - timecurrent_seconds > 0) { if ($('.question-palette__item.-checked').length) { Drupal.postDataTest(); } else { $('#modal-do-not-work-lr').modal('show'); } } else { if ($('.question-palette__item.-checked').length) { Drupal.postDataTest(); } else { $('#modal-time-up-no-taketest').modal('show'); } } } else { Drupal.postDataTest(); } }) } function submitTest() { var button_submit = $('.-btn-submit-test') button_submit.click(function (e) { e.preventDefault() Drupal.postDataTest(); }) } function retakeTest() { $('.-btn-retake').click(function (e) { e.preventDefault(); // Close modal. $('#modal-time-up-no-taketest').modal('hide'); $('#modal-time-up-no-taketest').on('hidden.bs.modal', function (e) { // do something... $('body').removeClass('-test_time-up'); $('.realtest-header').removeClass('time-up'); listeningPlayer.restart(); listeningPlayer.play(); Drupal.runTimeClock(timeEndListening); }) }) } // Handle reading test. Drupal.handlerListeningTest = function () { // Render audio player. initListeningPlayer(); initListeningPracticePlayer(); if (drupalSettings.tour) { if (!localStorage.getItem('tour_visited_product-tour-listening-take-test-pages') && !$('body').hasClass('-full-test-mode')) { return; } } if ($('.modal-test-notice').length) { return; } if ($('.full-test-wrong').length) { return; } if (!$('.listening-test').length) { return; } // Reload data default. Drupal.reloadDataDefault(); clickSubmitTakeTest(); }; // Handle listening test. Drupal.behaviors.ListeningTakeTest = { attach: function (context, settings) { /* OnLoad Window */ window.addEventListener('load', function () { Drupal.handlerListeningTest(); }); if ($('body').hasClass('-test-mode')) { $('body').find('.listen-from-here').remove(); } submitTest(); retakeTest(); } } })(jQuery, Drupal, drupalSettings); ; "object"==typeof navigator&&function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define("Plyr",t):(e="undefined"!=typeof globalThis?globalThis:e||self).Plyr=t()}(this,(function(){"use strict";!function(){if("undefined"!=typeof window)try{var e=new window.CustomEvent("test",{cancelable:!0});if(e.preventDefault(),!0!==e.defaultPrevented)throw new Error("Could not prevent default")}catch(e){var t=function(e,t){var i,s;return(t=t||{}).bubbles=!!t.bubbles,t.cancelable=!!t.cancelable,(i=document.createEvent("CustomEvent")).initCustomEvent(e,t.bubbles,t.cancelable,t.detail),s=i.preventDefault,i.preventDefault=function(){s.call(this);try{Object.defineProperty(this,"defaultPrevented",{get:function(){return!0}})}catch(e){this.defaultPrevented=!0}},i};t.prototype=window.Event.prototype,window.CustomEvent=t}}();var e="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function t(e,t,i){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var i=e[Symbol.toPrimitive];if(void 0!==i){var s=i.call(e,t||"default");if("object"!=typeof s)return s;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[t]=i,e}function i(e,t){for(var i=0;it[0]?1:0})),e._entries&&(e._entries={});for(var i=0;i1?n(s[1]):"")}})}(void 0!==e?e:"undefined"!=typeof window?window:"undefined"!=typeof self?self:e),function(e){if(function(){try{var t=new e.URL("b","http://a");return t.pathname="c d","http://a/c%20d"===t.href&&t.searchParams}catch(e){return!1}}()||function(){var t=e.URL,i=function(t,i){"string"!=typeof t&&(t=String(t)),i&&"string"!=typeof i&&(i=String(i));var s,n=document;if(i&&(void 0===e.location||i!==e.location.href)){i=i.toLowerCase(),(s=(n=document.implementation.createHTMLDocument("")).createElement("base")).href=i,n.head.appendChild(s);try{if(0!==s.href.indexOf(i))throw new Error(s.href)}catch(e){throw new Error("URL unable to set base "+i+" due to "+e)}}var a=n.createElement("a");a.href=t,s&&(n.body.appendChild(a),a.href=a.href);var r=n.createElement("input");if(r.type="url",r.value=t,":"===a.protocol||!/:/.test(a.href)||!r.checkValidity()&&!i)throw new TypeError("Invalid URL");Object.defineProperty(this,"_anchorElement",{value:a});var o=new e.URLSearchParams(this.search),l=!0,c=!0,u=this;["append","delete","set"].forEach((function(e){var t=o[e];o[e]=function(){t.apply(o,arguments),l&&(c=!1,u.search=o.toString(),c=!0)}})),Object.defineProperty(this,"searchParams",{value:o,enumerable:!0});var h=void 0;Object.defineProperty(this,"_updateSearchParams",{enumerable:!1,configurable:!1,writable:!1,value:function(){this.search!==h&&(h=this.search,c&&(l=!1,this.searchParams._fromString(this.search),l=!0))}})},s=i.prototype;["hash","host","hostname","port","protocol"].forEach((function(e){!function(e){Object.defineProperty(s,e,{get:function(){return this._anchorElement[e]},set:function(t){this._anchorElement[e]=t},enumerable:!0})}(e)})),Object.defineProperty(s,"search",{get:function(){return this._anchorElement.search},set:function(e){this._anchorElement.search=e,this._updateSearchParams()},enumerable:!0}),Object.defineProperties(s,{toString:{get:function(){var e=this;return function(){return e.href}}},href:{get:function(){return this._anchorElement.href.replace(/\?$/,"")},set:function(e){this._anchorElement.href=e,this._updateSearchParams()},enumerable:!0},pathname:{get:function(){return this._anchorElement.pathname.replace(/(^\/?)/,"/")},set:function(e){this._anchorElement.pathname=e},enumerable:!0},origin:{get:function(){var e={"http:":80,"https:":443,"ftp:":21}[this._anchorElement.protocol],t=this._anchorElement.port!=e&&""!==this._anchorElement.port;return this._anchorElement.protocol+"//"+this._anchorElement.hostname+(t?":"+this._anchorElement.port:"")},enumerable:!0},password:{get:function(){return""},set:function(e){},enumerable:!0},username:{get:function(){return""},set:function(e){},enumerable:!0}}),i.createObjectURL=function(e){return t.createObjectURL.apply(t,arguments)},i.revokeObjectURL=function(e){return t.revokeObjectURL.apply(t,arguments)},e.URL=i}(),void 0!==e.location&&!("origin"in e.location)){var t=function(){return e.location.protocol+"//"+e.location.hostname+(e.location.port?":"+e.location.port:"")};try{Object.defineProperty(e.location,"origin",{get:t,enumerable:!0})}catch(i){setInterval((function(){e.location.origin=t()}),100)}}}(void 0!==e?e:"undefined"!=typeof window?window:"undefined"!=typeof self?self:e);var r={addCSS:!0,thumbWidth:15,watch:!0};var o=function(e){return null!=e?e.constructor:null},l=function(e,t){return!!(e&&t&&e instanceof t)},c=function(e){return null==e},u=function(e){return o(e)===Object},h=function(e){return o(e)===String},d=function(e){return Array.isArray(e)},m=function(e){return l(e,NodeList)},p={nullOrUndefined:c,object:u,number:function(e){return o(e)===Number&&!Number.isNaN(e)},string:h,boolean:function(e){return o(e)===Boolean},function:function(e){return o(e)===Function},array:d,nodeList:m,element:function(e){return l(e,Element)},event:function(e){return l(e,Event)},empty:function(e){return c(e)||(h(e)||d(e)||m(e))&&!e.length||u(e)&&!Object.keys(e).length}};function g(e,t){if(1>t){var i=function(e){var t="".concat(e).match(/(?:\.(\d+))?(?:[eE]([+-]?\d+))?$/);return t?Math.max(0,(t[1]?t[1].length:0)-(t[2]?+t[2]:0)):0}(t);return parseFloat(e.toFixed(i))}return Math.round(e/t)*t}var f=function(){function e(t,i){(function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")})(this,e),p.element(t)?this.element=t:p.string(t)&&(this.element=document.querySelector(t)),p.element(this.element)&&p.empty(this.element.rangeTouch)&&(this.config=a({},r,{},i),this.init())}return function(e,t,s){t&&i(e.prototype,t),s&&i(e,s)}(e,[{key:"init",value:function(){e.enabled&&(this.config.addCSS&&(this.element.style.userSelect="none",this.element.style.webKitUserSelect="none",this.element.style.touchAction="manipulation"),this.listeners(!0),this.element.rangeTouch=this)}},{key:"destroy",value:function(){e.enabled&&(this.config.addCSS&&(this.element.style.userSelect="",this.element.style.webKitUserSelect="",this.element.style.touchAction=""),this.listeners(!1),this.element.rangeTouch=null)}},{key:"listeners",value:function(e){var t=this,i=e?"addEventListener":"removeEventListener";["touchstart","touchmove","touchend"].forEach((function(e){t.element[i](e,(function(e){return t.set(e)}),!1)}))}},{key:"get",value:function(t){if(!e.enabled||!p.event(t))return null;var i,s=t.target,n=t.changedTouches[0],a=parseFloat(s.getAttribute("min"))||0,r=parseFloat(s.getAttribute("max"))||100,o=parseFloat(s.getAttribute("step"))||1,l=s.getBoundingClientRect(),c=100/l.width*(this.config.thumbWidth/2)/100;return 0>(i=100/l.width*(n.clientX-l.left))?i=0:100i?i-=(100-2*i)*c:50null!=e?e.constructor:null,b=(e,t)=>Boolean(e&&t&&e instanceof t),v=e=>null==e,w=e=>y(e)===Object,T=e=>y(e)===String,k=e=>"function"==typeof e,E=e=>Array.isArray(e),C=e=>b(e,NodeList),S=e=>v(e)||(T(e)||E(e)||C(e))&&!e.length||w(e)&&!Object.keys(e).length;var A={nullOrUndefined:v,object:w,number:e=>y(e)===Number&&!Number.isNaN(e),string:T,boolean:e=>y(e)===Boolean,function:k,array:E,weakMap:e=>b(e,WeakMap),nodeList:C,element:e=>null!==e&&"object"==typeof e&&1===e.nodeType&&"object"==typeof e.style&&"object"==typeof e.ownerDocument,textNode:e=>y(e)===Text,event:e=>b(e,Event),keyboardEvent:e=>b(e,KeyboardEvent),cue:e=>b(e,window.TextTrackCue)||b(e,window.VTTCue),track:e=>b(e,TextTrack)||!v(e)&&T(e.kind),promise:e=>b(e,Promise)&&k(e.then),url:e=>{if(b(e,window.URL))return!0;if(!T(e))return!1;let t=e;e.startsWith("http://")&&e.startsWith("https://")||(t=`http://${e}`);try{return!S(new URL(t).hostname)}catch(e){return!1}},empty:S};const P=(()=>{const e=document.createElement("span"),t={WebkitTransition:"webkitTransitionEnd",MozTransition:"transitionend",OTransition:"oTransitionEnd otransitionend",transition:"transitionend"},i=Object.keys(t).find((t=>void 0!==e.style[t]));return!!A.string(i)&&t[i]})();function M(e,t){setTimeout((()=>{try{e.hidden=!0,e.offsetHeight,e.hidden=!1}catch(e){}}),t)}var x={isIE:Boolean(window.document.documentMode),isEdge:/Edge/g.test(navigator.userAgent),isWebKit:"WebkitAppearance"in document.documentElement.style&&!/Edge/g.test(navigator.userAgent),isIPhone:/iPhone|iPod/gi.test(navigator.userAgent)&&navigator.maxTouchPoints>1,isIPadOS:"MacIntel"===navigator.platform&&navigator.maxTouchPoints>1,isIos:/iPad|iPhone|iPod/gi.test(navigator.userAgent)&&navigator.maxTouchPoints>1};function L(e,t){return t.split(".").reduce(((e,t)=>e&&e[t]),e)}function N(e={},...t){if(!t.length)return e;const i=t.shift();return A.object(i)?(Object.keys(i).forEach((t=>{A.object(i[t])?(Object.keys(e).includes(t)||Object.assign(e,{[t]:{}}),N(e[t],i[t])):Object.assign(e,{[t]:i[t]})})),N(e,...t)):e}function _(e,t){const i=e.length?e:[e];Array.from(i).reverse().forEach(((e,i)=>{const s=i>0?t.cloneNode(!0):t,n=e.parentNode,a=e.nextSibling;s.appendChild(e),a?n.insertBefore(s,a):n.appendChild(s)}))}function I(e,t){A.element(e)&&!A.empty(t)&&Object.entries(t).filter((([,e])=>!A.nullOrUndefined(e))).forEach((([t,i])=>e.setAttribute(t,i)))}function O(e,t,i){const s=document.createElement(e);return A.object(t)&&I(s,t),A.string(i)&&(s.innerText=i),s}function $(e,t,i,s){A.element(t)&&t.appendChild(O(e,i,s))}function j(e){A.nodeList(e)||A.array(e)?Array.from(e).forEach(j):A.element(e)&&A.element(e.parentNode)&&e.parentNode.removeChild(e)}function R(e){if(!A.element(e))return;let{length:t}=e.childNodes;for(;t>0;)e.removeChild(e.lastChild),t-=1}function D(e,t){return A.element(t)&&A.element(t.parentNode)&&A.element(e)?(t.parentNode.replaceChild(e,t),e):null}function q(e,t){if(!A.string(e)||A.empty(e))return{};const i={},s=N({},t);return e.split(",").forEach((e=>{const t=e.trim(),n=t.replace(".",""),a=t.replace(/[[\]]/g,"").split("="),[r]=a,o=a.length>1?a[1].replace(/["']/g,""):"";switch(t.charAt(0)){case".":A.string(s.class)?i.class=`${s.class} ${n}`:i.class=n;break;case"#":i.id=t.replace("#","");break;case"[":i[r]=o}})),N(s,i)}function H(e,t){if(!A.element(e))return;let i=t;A.boolean(i)||(i=!e.hidden),e.hidden=i}function F(e,t,i){if(A.nodeList(e))return Array.from(e).map((e=>F(e,t,i)));if(A.element(e)){let s="toggle";return void 0!==i&&(s=i?"add":"remove"),e.classList[s](t),e.classList.contains(t)}return!1}function U(e,t){return A.element(e)&&e.classList.contains(t)}function V(e,t){const{prototype:i}=Element;return(i.matches||i.webkitMatchesSelector||i.mozMatchesSelector||i.msMatchesSelector||function(){return Array.from(document.querySelectorAll(t)).includes(this)}).call(e,t)}function B(e){return this.elements.container.querySelectorAll(e)}function W(e){return this.elements.container.querySelector(e)}function z(e=null,t=!1){A.element(e)&&e.focus({preventScroll:!0,focusVisible:t})}const K={"audio/ogg":"vorbis","audio/wav":"1","video/webm":"vp8, vorbis","video/mp4":"avc1.42E01E, mp4a.40.2","video/ogg":"theora"},Y={audio:"canPlayType"in document.createElement("audio"),video:"canPlayType"in document.createElement("video"),check(e,t){const i=Y[e]||"html5"!==t;return{api:i,ui:i&&Y.rangeInput}},pip:!(x.isIPhone||!A.function(O("video").webkitSetPresentationMode)&&(!document.pictureInPictureEnabled||O("video").disablePictureInPicture)),airplay:A.function(window.WebKitPlaybackTargetAvailabilityEvent),playsinline:"playsInline"in document.createElement("video"),mime(e){if(A.empty(e))return!1;const[t]=e.split("/");let i=e;if(!this.isHTML5||t!==this.type)return!1;Object.keys(K).includes(i)&&(i+=`; codecs="${K[e]}"`);try{return Boolean(i&&this.media.canPlayType(i).replace(/no/,""))}catch(e){return!1}},textTracks:"textTracks"in document.createElement("video"),rangeInput:(()=>{const e=document.createElement("input");return e.type="range","range"===e.type})(),touch:"ontouchstart"in document.documentElement,transitions:!1!==P,reducedMotion:"matchMedia"in window&&window.matchMedia("(prefers-reduced-motion)").matches},Q=(()=>{let e=!1;try{const t=Object.defineProperty({},"passive",{get:()=>(e=!0,null)});window.addEventListener("test",null,t),window.removeEventListener("test",null,t)}catch(e){}return e})();function X(e,t,i,s=!1,n=!0,a=!1){if(!e||!("addEventListener"in e)||A.empty(t)||!A.function(i))return;const r=t.split(" ");let o=a;Q&&(o={passive:n,capture:a}),r.forEach((t=>{this&&this.eventListeners&&s&&this.eventListeners.push({element:e,type:t,callback:i,options:o}),e[s?"addEventListener":"removeEventListener"](t,i,o)}))}function J(e,t="",i,s=!0,n=!1){X.call(this,e,t,i,!0,s,n)}function G(e,t="",i,s=!0,n=!1){X.call(this,e,t,i,!1,s,n)}function Z(e,t="",i,s=!0,n=!1){const a=(...r)=>{G(e,t,a,s,n),i.apply(this,r)};X.call(this,e,t,a,!0,s,n)}function ee(e,t="",i=!1,s={}){if(!A.element(e)||A.empty(t))return;const n=new CustomEvent(t,{bubbles:i,detail:{...s,plyr:this}});e.dispatchEvent(n)}function te(){this&&this.eventListeners&&(this.eventListeners.forEach((e=>{const{element:t,type:i,callback:s,options:n}=e;t.removeEventListener(i,s,n)})),this.eventListeners=[])}function ie(){return new Promise((e=>this.ready?setTimeout(e,0):J.call(this,this.elements.container,"ready",e))).then((()=>{}))}function se(e){A.promise(e)&&e.then(null,(()=>{}))}function ne(e){return A.array(e)?e.filter(((t,i)=>e.indexOf(t)===i)):e}function ae(e,t){return A.array(e)&&e.length?e.reduce(((e,i)=>Math.abs(i-t)({...e,[t/i]:[t,i]})),{});function le(e){if(!(A.array(e)||A.string(e)&&e.includes(":")))return!1;return(A.array(e)?e:e.split(":")).map(Number).every(A.number)}function ce(e){if(!A.array(e)||!e.every(A.number))return null;const[t,i]=e,s=(e,t)=>0===t?e:s(t,e%t),n=s(t,i);return[t/n,i/n]}function ue(e){const t=e=>le(e)?e.split(":").map(Number):null;let i=t(e);if(null===i&&(i=t(this.config.ratio)),null===i&&!A.empty(this.embed)&&A.array(this.embed.ratio)&&({ratio:i}=this.embed),null===i&&this.isHTML5){const{videoWidth:e,videoHeight:t}=this.media;i=[e,t]}return ce(i)}function he(e){if(!this.isVideo)return{};const{wrapper:t}=this.elements,i=ue.call(this,e);if(!A.array(i))return{};const[s,n]=ce(i),a=100/s*n;if(re(`aspect-ratio: ${s}/${n}`)?t.style.aspectRatio=`${s}/${n}`:t.style.paddingBottom=`${a}%`,this.isVimeo&&!this.config.vimeo.premium&&this.supported.ui){const e=100/this.media.offsetWidth*parseInt(window.getComputedStyle(this.media).paddingBottom,10),i=(e-a)/(e/50);this.fullscreen.active?t.style.paddingBottom=null:this.media.style.transform=`translateY(-${i}%)`}else this.isHTML5&&t.classList.add(this.config.classNames.videoFixedRatio);return{padding:a,ratio:i}}function de(e,t,i=.05){const s=e/t,n=ae(Object.keys(oe),s);return Math.abs(n-s)<=i?oe[n]:[e,t]}const me={getSources(){if(!this.isHTML5)return[];return Array.from(this.media.querySelectorAll("source")).filter((e=>{const t=e.getAttribute("type");return!!A.empty(t)||Y.mime.call(this,t)}))},getQualityOptions(){return this.config.quality.forced?this.config.quality.options:me.getSources.call(this).map((e=>Number(e.getAttribute("size")))).filter(Boolean)},setup(){if(!this.isHTML5)return;const e=this;e.options.speed=e.config.speed.options,A.empty(this.config.ratio)||he.call(e),Object.defineProperty(e.media,"quality",{get(){const t=me.getSources.call(e).find((t=>t.getAttribute("src")===e.source));return t&&Number(t.getAttribute("size"))},set(t){if(e.quality!==t){if(e.config.quality.forced&&A.function(e.config.quality.onChange))e.config.quality.onChange(t);else{const i=me.getSources.call(e).find((e=>Number(e.getAttribute("size"))===t));if(!i)return;const{currentTime:s,paused:n,preload:a,readyState:r,playbackRate:o}=e.media;e.media.src=i.getAttribute("src"),("none"!==a||r)&&(e.once("loadedmetadata",(()=>{e.speed=o,e.currentTime=s,n||se(e.play())})),e.media.load())}ee.call(e,e.media,"qualitychange",!1,{quality:t})}}})},cancelRequests(){this.isHTML5&&(j(me.getSources.call(this)),this.media.setAttribute("src",this.config.blankVideo),this.media.load(),this.debug.log("Cancelled network requests"))}};function pe(e,...t){return A.empty(e)?e:e.toString().replace(/{(\d+)}/g,((e,i)=>t[i].toString()))}const ge=(e="",t="",i="")=>e.replace(new RegExp(t.toString().replace(/([.*+?^=!:${}()|[\]/\\])/g,"\\$1"),"g"),i.toString()),fe=(e="")=>e.toString().replace(/\w\S*/g,(e=>e.charAt(0).toUpperCase()+e.slice(1).toLowerCase()));function ye(e=""){let t=e.toString();return t=function(e=""){let t=e.toString();return t=ge(t,"-"," "),t=ge(t,"_"," "),t=fe(t),ge(t," ","")}(t),t.charAt(0).toLowerCase()+t.slice(1)}function be(e){const t=document.createElement("div");return t.appendChild(e),t.innerHTML}const ve={pip:"PIP",airplay:"AirPlay",html5:"HTML5",vimeo:"Vimeo",youtube:"YouTube"},we={get(e="",t={}){if(A.empty(e)||A.empty(t))return"";let i=L(t.i18n,e);if(A.empty(i))return Object.keys(ve).includes(e)?ve[e]:"";const s={"{seektime}":t.seekTime,"{title}":t.title};return Object.entries(s).forEach((([e,t])=>{i=ge(i,e,t)})),i}};class Te{constructor(e){t(this,"get",(e=>{if(!Te.supported||!this.enabled)return null;const t=window.localStorage.getItem(this.key);if(A.empty(t))return null;const i=JSON.parse(t);return A.string(e)&&e.length?i[e]:i})),t(this,"set",(e=>{if(!Te.supported||!this.enabled)return;if(!A.object(e))return;let t=this.get();A.empty(t)&&(t={}),N(t,e);try{window.localStorage.setItem(this.key,JSON.stringify(t))}catch(e){}})),this.enabled=e.config.storage.enabled,this.key=e.config.storage.key}static get supported(){try{if(!("localStorage"in window))return!1;const e="___test";return window.localStorage.setItem(e,e),window.localStorage.removeItem(e),!0}catch(e){return!1}}}function ke(e,t="text"){return new Promise(((i,s)=>{try{const s=new XMLHttpRequest;if(!("withCredentials"in s))return;s.addEventListener("load",(()=>{if("text"===t)try{i(JSON.parse(s.responseText))}catch(e){i(s.responseText)}else i(s.response)})),s.addEventListener("error",(()=>{throw new Error(s.status)})),s.open("GET",e,!0),s.responseType=t,s.send()}catch(e){s(e)}}))}function Ee(e,t){if(!A.string(e))return;const i="cache",s=A.string(t);let n=!1;const a=()=>null!==document.getElementById(t),r=(e,t)=>{e.innerHTML=t,s&&a()||document.body.insertAdjacentElement("afterbegin",e)};if(!s||!a()){const a=Te.supported,o=document.createElement("div");if(o.setAttribute("hidden",""),s&&o.setAttribute("id",t),a){const e=window.localStorage.getItem(`${i}-${t}`);if(n=null!==e,n){const t=JSON.parse(e);r(o,t.content)}}ke(e).then((e=>{if(!A.empty(e)){if(a)try{window.localStorage.setItem(`${i}-${t}`,JSON.stringify({content:e}))}catch(e){}r(o,e)}})).catch((()=>{}))}}const Ce=e=>Math.trunc(e/60/60%60,10),Se=e=>Math.trunc(e/60%60,10),Ae=e=>Math.trunc(e%60,10);function Pe(e=0,t=!1,i=!1){if(!A.number(e))return Pe(void 0,t,i);const s=e=>`0${e}`.slice(-2);let n=Ce(e);const a=Se(e),r=Ae(e);return n=t||n>0?`${n}:`:"",`${i&&e>0?"-":""}${n}${s(a)}:${s(r)}`}const Me={getIconUrl(){const e=new URL(this.config.iconUrl,window.location),t=window.location.host?window.location.host:window.top.location.host,i=e.host!==t||x.isIE&&!window.svg4everybody;return{url:this.config.iconUrl,cors:i}},findElements(){try{return this.elements.controls=W.call(this,this.config.selectors.controls.wrapper),this.elements.buttons={play:B.call(this,this.config.selectors.buttons.play),pause:W.call(this,this.config.selectors.buttons.pause),restart:W.call(this,this.config.selectors.buttons.restart),rewind:W.call(this,this.config.selectors.buttons.rewind),fastForward:W.call(this,this.config.selectors.buttons.fastForward),mute:W.call(this,this.config.selectors.buttons.mute),pip:W.call(this,this.config.selectors.buttons.pip),airplay:W.call(this,this.config.selectors.buttons.airplay),settings:W.call(this,this.config.selectors.buttons.settings),captions:W.call(this,this.config.selectors.buttons.captions),fullscreen:W.call(this,this.config.selectors.buttons.fullscreen)},this.elements.progress=W.call(this,this.config.selectors.progress),this.elements.inputs={seek:W.call(this,this.config.selectors.inputs.seek),volume:W.call(this,this.config.selectors.inputs.volume)},this.elements.display={buffer:W.call(this,this.config.selectors.display.buffer),currentTime:W.call(this,this.config.selectors.display.currentTime),duration:W.call(this,this.config.selectors.display.duration)},A.element(this.elements.progress)&&(this.elements.display.seekTooltip=this.elements.progress.querySelector(`.${this.config.classNames.tooltip}`)),!0}catch(e){return this.debug.warn("It looks like there is a problem with your custom controls HTML",e),this.toggleNativeControls(!0),!1}},createIcon(e,t){const i="http://www.w3.org/2000/svg",s=Me.getIconUrl.call(this),n=`${s.cors?"":s.url}#${this.config.iconPrefix}`,a=document.createElementNS(i,"svg");I(a,N(t,{"aria-hidden":"true",focusable:"false"}));const r=document.createElementNS(i,"use"),o=`${n}-${e}`;return"href"in r&&r.setAttributeNS("http://www.w3.org/1999/xlink","href",o),r.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",o),a.appendChild(r),a},createLabel(e,t={}){const i=we.get(e,this.config);return O("span",{...t,class:[t.class,this.config.classNames.hidden].filter(Boolean).join(" ")},i)},createBadge(e){if(A.empty(e))return null;const t=O("span",{class:this.config.classNames.menu.value});return t.appendChild(O("span",{class:this.config.classNames.menu.badge},e)),t},createButton(e,t){const i=N({},t);let s=ye(e);const n={element:"button",toggle:!1,label:null,icon:null,labelPressed:null,iconPressed:null};switch(["element","icon","label"].forEach((e=>{Object.keys(i).includes(e)&&(n[e]=i[e],delete i[e])})),"button"!==n.element||Object.keys(i).includes("type")||(i.type="button"),Object.keys(i).includes("class")?i.class.split(" ").some((e=>e===this.config.classNames.control))||N(i,{class:`${i.class} ${this.config.classNames.control}`}):i.class=this.config.classNames.control,e){case"play":n.toggle=!0,n.label="play",n.labelPressed="pause",n.icon="play",n.iconPressed="pause";break;case"mute":n.toggle=!0,n.label="mute",n.labelPressed="unmute",n.icon="volume",n.iconPressed="muted";break;case"captions":n.toggle=!0,n.label="enableCaptions",n.labelPressed="disableCaptions",n.icon="captions-off",n.iconPressed="captions-on";break;case"fullscreen":n.toggle=!0,n.label="enterFullscreen",n.labelPressed="exitFullscreen",n.icon="enter-fullscreen",n.iconPressed="exit-fullscreen";break;case"play-large":i.class+=` ${this.config.classNames.control}--overlaid`,s="play",n.label="play",n.icon="play";break;default:A.empty(n.label)&&(n.label=s),A.empty(n.icon)&&(n.icon=e)}const a=O(n.element);return n.toggle?(a.appendChild(Me.createIcon.call(this,n.iconPressed,{class:"icon--pressed"})),a.appendChild(Me.createIcon.call(this,n.icon,{class:"icon--not-pressed"})),a.appendChild(Me.createLabel.call(this,n.labelPressed,{class:"label--pressed"})),a.appendChild(Me.createLabel.call(this,n.label,{class:"label--not-pressed"}))):(a.appendChild(Me.createIcon.call(this,n.icon)),a.appendChild(Me.createLabel.call(this,n.label))),N(i,q(this.config.selectors.buttons[s],i)),I(a,i),"play"===s?(A.array(this.elements.buttons[s])||(this.elements.buttons[s]=[]),this.elements.buttons[s].push(a)):this.elements.buttons[s]=a,a},createRange(e,t){const i=O("input",N(q(this.config.selectors.inputs[e]),{type:"range",min:0,max:100,step:.01,value:0,autocomplete:"off",role:"slider","aria-label":we.get(e,this.config),"aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":0},t));return this.elements.inputs[e]=i,Me.updateRangeFill.call(this,i),f.setup(i),i},createProgress(e,t){const i=O("progress",N(q(this.config.selectors.display[e]),{min:0,max:100,value:0,role:"progressbar","aria-hidden":!0},t));if("volume"!==e){i.appendChild(O("span",null,"0"));const t={played:"played",buffer:"buffered"}[e],s=t?we.get(t,this.config):"";i.innerText=`% ${s.toLowerCase()}`}return this.elements.display[e]=i,i},createTime(e,t){const i=q(this.config.selectors.display[e],t),s=O("div",N(i,{class:`${i.class?i.class:""} ${this.config.classNames.display.time} `.trim(),"aria-label":we.get(e,this.config),role:"timer"}),"00:00");return this.elements.display[e]=s,s},bindMenuItemShortcuts(e,t){J.call(this,e,"keydown keyup",(i=>{if(![" ","ArrowUp","ArrowDown","ArrowRight"].includes(i.key))return;if(i.preventDefault(),i.stopPropagation(),"keydown"===i.type)return;const s=V(e,'[role="menuitemradio"]');if(!s&&[" ","ArrowRight"].includes(i.key))Me.showMenuPanel.call(this,t,!0);else{let t;" "!==i.key&&("ArrowDown"===i.key||s&&"ArrowRight"===i.key?(t=e.nextElementSibling,A.element(t)||(t=e.parentNode.firstElementChild)):(t=e.previousElementSibling,A.element(t)||(t=e.parentNode.lastElementChild)),z.call(this,t,!0))}}),!1),J.call(this,e,"keyup",(e=>{"Return"===e.key&&Me.focusFirstMenuItem.call(this,null,!0)}))},createMenuItem({value:e,list:t,type:i,title:s,badge:n=null,checked:a=!1}){const r=q(this.config.selectors.inputs[i]),o=O("button",N(r,{type:"button",role:"menuitemradio",class:`${this.config.classNames.control} ${r.class?r.class:""}`.trim(),"aria-checked":a,value:e})),l=O("span");l.innerHTML=s,A.element(n)&&l.appendChild(n),o.appendChild(l),Object.defineProperty(o,"checked",{enumerable:!0,get:()=>"true"===o.getAttribute("aria-checked"),set(e){e&&Array.from(o.parentNode.children).filter((e=>V(e,'[role="menuitemradio"]'))).forEach((e=>e.setAttribute("aria-checked","false"))),o.setAttribute("aria-checked",e?"true":"false")}}),this.listeners.bind(o,"click keyup",(t=>{if(!A.keyboardEvent(t)||" "===t.key){switch(t.preventDefault(),t.stopPropagation(),o.checked=!0,i){case"language":this.currentTrack=Number(e);break;case"quality":this.quality=e;break;case"speed":this.speed=parseFloat(e)}Me.showMenuPanel.call(this,"home",A.keyboardEvent(t))}}),i,!1),Me.bindMenuItemShortcuts.call(this,o,i),t.appendChild(o)},formatTime(e=0,t=!1){if(!A.number(e))return e;return Pe(e,Ce(this.duration)>0,t)},updateTimeDisplay(e=null,t=0,i=!1){A.element(e)&&A.number(t)&&(e.innerText=Me.formatTime(t,i))},updateVolume(){this.supported.ui&&(A.element(this.elements.inputs.volume)&&Me.setRange.call(this,this.elements.inputs.volume,this.muted?0:this.volume),A.element(this.elements.buttons.mute)&&(this.elements.buttons.mute.pressed=this.muted||0===this.volume))},setRange(e,t=0){A.element(e)&&(e.value=t,Me.updateRangeFill.call(this,e))},updateProgress(e){if(!this.supported.ui||!A.event(e))return;let t=0;const i=(e,t)=>{const i=A.number(t)?t:0,s=A.element(e)?e:this.elements.display.buffer;if(A.element(s)){s.value=i;const e=s.getElementsByTagName("span")[0];A.element(e)&&(e.childNodes[0].nodeValue=i)}};if(e)switch(e.type){case"timeupdate":case"seeking":case"seeked":s=this.currentTime,n=this.duration,t=0===s||0===n||Number.isNaN(s)||Number.isNaN(n)?0:(s/n*100).toFixed(2),"timeupdate"===e.type&&Me.setRange.call(this,this.elements.inputs.seek,t);break;case"playing":case"progress":i(this.elements.display.buffer,100*this.buffered)}var s,n},updateRangeFill(e){const t=A.event(e)?e.target:e;if(A.element(t)&&"range"===t.getAttribute("type")){if(V(t,this.config.selectors.inputs.seek)){t.setAttribute("aria-valuenow",this.currentTime);const e=Me.formatTime(this.currentTime),i=Me.formatTime(this.duration),s=we.get("seekLabel",this.config);t.setAttribute("aria-valuetext",s.replace("{currentTime}",e).replace("{duration}",i))}else if(V(t,this.config.selectors.inputs.volume)){const e=100*t.value;t.setAttribute("aria-valuenow",e),t.setAttribute("aria-valuetext",`${e.toFixed(1)}%`)}else t.setAttribute("aria-valuenow",t.value);(x.isWebKit||x.isIPadOS)&&t.style.setProperty("--value",t.value/t.max*100+"%")}},updateSeekTooltip(e){var t,i;if(!this.config.tooltips.seek||!A.element(this.elements.inputs.seek)||!A.element(this.elements.display.seekTooltip)||0===this.duration)return;const s=this.elements.display.seekTooltip,n=`${this.config.classNames.tooltip}--visible`,a=e=>F(s,n,e);if(this.touch)return void a(!1);let r=0;const o=this.elements.progress.getBoundingClientRect();if(A.event(e))r=100/o.width*(e.pageX-o.left);else{if(!U(s,n))return;r=parseFloat(s.style.left,10)}r<0?r=0:r>100&&(r=100);const l=this.duration/100*r;s.innerText=Me.formatTime(l);const c=null===(t=this.config.markers)||void 0===t||null===(i=t.points)||void 0===i?void 0:i.find((({time:e})=>e===Math.round(l)));c&&s.insertAdjacentHTML("afterbegin",`${c.label}
    `),s.style.left=`${r}%`,A.event(e)&&["mouseenter","mouseleave"].includes(e.type)&&a("mouseenter"===e.type)},timeUpdate(e){const t=!A.element(this.elements.display.duration)&&this.config.invertTime;Me.updateTimeDisplay.call(this,this.elements.display.currentTime,t?this.duration-this.currentTime:this.currentTime,t),e&&"timeupdate"===e.type&&this.media.seeking||Me.updateProgress.call(this,e)},durationUpdate(){if(!this.supported.ui||!this.config.invertTime&&this.currentTime)return;if(this.duration>=2**32)return H(this.elements.display.currentTime,!0),void H(this.elements.progress,!0);A.element(this.elements.inputs.seek)&&this.elements.inputs.seek.setAttribute("aria-valuemax",this.duration);const e=A.element(this.elements.display.duration);!e&&this.config.displayDuration&&this.paused&&Me.updateTimeDisplay.call(this,this.elements.display.currentTime,this.duration),e&&Me.updateTimeDisplay.call(this,this.elements.display.duration,this.duration),this.config.markers.enabled&&Me.setMarkers.call(this),Me.updateSeekTooltip.call(this)},toggleMenuButton(e,t){H(this.elements.settings.buttons[e],!t)},updateSetting(e,t,i){const s=this.elements.settings.panels[e];let n=null,a=t;if("captions"===e)n=this.currentTrack;else{if(n=A.empty(i)?this[e]:i,A.empty(n)&&(n=this.config[e].default),!A.empty(this.options[e])&&!this.options[e].includes(n))return void this.debug.warn(`Unsupported value of '${n}' for ${e}`);if(!this.config[e].options.includes(n))return void this.debug.warn(`Disabled value of '${n}' for ${e}`)}if(A.element(a)||(a=s&&s.querySelector('[role="menu"]')),!A.element(a))return;this.elements.settings.buttons[e].querySelector(`.${this.config.classNames.menu.value}`).innerHTML=Me.getLabel.call(this,e,n);const r=a&&a.querySelector(`[value="${n}"]`);A.element(r)&&(r.checked=!0)},getLabel(e,t){switch(e){case"speed":return 1===t?we.get("normal",this.config):`${t}×`;case"quality":if(A.number(t)){const e=we.get(`qualityLabel.${t}`,this.config);return e.length?e:`${t}p`}return fe(t);case"captions":return Ne.getLabel.call(this);default:return null}},setQualityMenu(e){if(!A.element(this.elements.settings.panels.quality))return;const t="quality",i=this.elements.settings.panels.quality.querySelector('[role="menu"]');A.array(e)&&(this.options.quality=ne(e).filter((e=>this.config.quality.options.includes(e))));const s=!A.empty(this.options.quality)&&this.options.quality.length>1;if(Me.toggleMenuButton.call(this,t,s),R(i),Me.checkMenu.call(this),!s)return;const n=e=>{const t=we.get(`qualityBadge.${e}`,this.config);return t.length?Me.createBadge.call(this,t):null};this.options.quality.sort(((e,t)=>{const i=this.config.quality.options;return i.indexOf(e)>i.indexOf(t)?1:-1})).forEach((e=>{Me.createMenuItem.call(this,{value:e,list:i,type:t,title:Me.getLabel.call(this,"quality",e),badge:n(e)})})),Me.updateSetting.call(this,t,i)},setCaptionsMenu(){if(!A.element(this.elements.settings.panels.captions))return;const e="captions",t=this.elements.settings.panels.captions.querySelector('[role="menu"]'),i=Ne.getTracks.call(this),s=Boolean(i.length);if(Me.toggleMenuButton.call(this,e,s),R(t),Me.checkMenu.call(this),!s)return;const n=i.map(((e,i)=>({value:i,checked:this.captions.toggled&&this.currentTrack===i,title:Ne.getLabel.call(this,e),badge:e.language&&Me.createBadge.call(this,e.language.toUpperCase()),list:t,type:"language"})));n.unshift({value:-1,checked:!this.captions.toggled,title:we.get("disabled",this.config),list:t,type:"language"}),n.forEach(Me.createMenuItem.bind(this)),Me.updateSetting.call(this,e,t)},setSpeedMenu(){if(!A.element(this.elements.settings.panels.speed))return;const e="speed",t=this.elements.settings.panels.speed.querySelector('[role="menu"]');this.options.speed=this.options.speed.filter((e=>e>=this.minimumSpeed&&e<=this.maximumSpeed));const i=!A.empty(this.options.speed)&&this.options.speed.length>1;Me.toggleMenuButton.call(this,e,i),R(t),Me.checkMenu.call(this),i&&(this.options.speed.forEach((i=>{Me.createMenuItem.call(this,{value:i,list:t,type:e,title:Me.getLabel.call(this,"speed",i)})})),Me.updateSetting.call(this,e,t))},checkMenu(){const{buttons:e}=this.elements.settings,t=!A.empty(e)&&Object.values(e).some((e=>!e.hidden));H(this.elements.settings.menu,!t)},focusFirstMenuItem(e,t=!1){if(this.elements.settings.popup.hidden)return;let i=e;A.element(i)||(i=Object.values(this.elements.settings.panels).find((e=>!e.hidden)));const s=i.querySelector('[role^="menuitem"]');z.call(this,s,t)},toggleMenu(e){const{popup:t}=this.elements.settings,i=this.elements.buttons.settings;if(!A.element(t)||!A.element(i))return;const{hidden:s}=t;let n=s;if(A.boolean(e))n=e;else if(A.keyboardEvent(e)&&"Escape"===e.key)n=!1;else if(A.event(e)){const s=A.function(e.composedPath)?e.composedPath()[0]:e.target,a=t.contains(s);if(a||!a&&e.target!==i&&n)return}i.setAttribute("aria-expanded",n),H(t,!n),F(this.elements.container,this.config.classNames.menu.open,n),n&&A.keyboardEvent(e)?Me.focusFirstMenuItem.call(this,null,!0):n||s||z.call(this,i,A.keyboardEvent(e))},getMenuSize(e){const t=e.cloneNode(!0);t.style.position="absolute",t.style.opacity=0,t.removeAttribute("hidden"),e.parentNode.appendChild(t);const i=t.scrollWidth,s=t.scrollHeight;return j(t),{width:i,height:s}},showMenuPanel(e="",t=!1){const i=this.elements.container.querySelector(`#plyr-settings-${this.id}-${e}`);if(!A.element(i))return;const s=i.parentNode,n=Array.from(s.children).find((e=>!e.hidden));if(Y.transitions&&!Y.reducedMotion){s.style.width=`${n.scrollWidth}px`,s.style.height=`${n.scrollHeight}px`;const e=Me.getMenuSize.call(this,i),t=e=>{e.target===s&&["width","height"].includes(e.propertyName)&&(s.style.width="",s.style.height="",G.call(this,s,P,t))};J.call(this,s,P,t),s.style.width=`${e.width}px`,s.style.height=`${e.height}px`}H(n,!0),H(i,!1),Me.focusFirstMenuItem.call(this,i,t)},setDownloadUrl(){const e=this.elements.buttons.download;A.element(e)&&e.setAttribute("href",this.download)},create(e){const{bindMenuItemShortcuts:t,createButton:i,createProgress:s,createRange:n,createTime:a,setQualityMenu:r,setSpeedMenu:o,showMenuPanel:l}=Me;this.elements.controls=null,A.array(this.config.controls)&&this.config.controls.includes("play-large")&&this.elements.container.appendChild(i.call(this,"play-large"));const c=O("div",q(this.config.selectors.controls.wrapper));this.elements.controls=c;const u={class:"plyr__controls__item"};return ne(A.array(this.config.controls)?this.config.controls:[]).forEach((r=>{if("restart"===r&&c.appendChild(i.call(this,"restart",u)),"rewind"===r&&c.appendChild(i.call(this,"rewind",u)),"play"===r&&c.appendChild(i.call(this,"play",u)),"fast-forward"===r&&c.appendChild(i.call(this,"fast-forward",u)),"progress"===r){const t=O("div",{class:`${u.class} plyr__progress__container`}),i=O("div",q(this.config.selectors.progress));if(i.appendChild(n.call(this,"seek",{id:`plyr-seek-${e.id}`})),i.appendChild(s.call(this,"buffer")),this.config.tooltips.seek){const e=O("span",{class:this.config.classNames.tooltip},"00:00");i.appendChild(e),this.elements.display.seekTooltip=e}this.elements.progress=i,t.appendChild(this.elements.progress),c.appendChild(t)}if("current-time"===r&&c.appendChild(a.call(this,"currentTime",u)),"duration"===r&&c.appendChild(a.call(this,"duration",u)),"mute"===r||"volume"===r){let{volume:t}=this.elements;if(A.element(t)&&c.contains(t)||(t=O("div",N({},u,{class:`${u.class} plyr__volume`.trim()})),this.elements.volume=t,c.appendChild(t)),"mute"===r&&t.appendChild(i.call(this,"mute")),"volume"===r&&!x.isIos&&!x.isIPadOS){const i={max:1,step:.05,value:this.config.volume};t.appendChild(n.call(this,"volume",N(i,{id:`plyr-volume-${e.id}`})))}}if("captions"===r&&c.appendChild(i.call(this,"captions",u)),"settings"===r&&!A.empty(this.config.settings)){const s=O("div",N({},u,{class:`${u.class} plyr__menu`.trim(),hidden:""}));s.appendChild(i.call(this,"settings",{"aria-haspopup":!0,"aria-controls":`plyr-settings-${e.id}`,"aria-expanded":!1}));const n=O("div",{class:"plyr__menu__container",id:`plyr-settings-${e.id}`,hidden:""}),a=O("div"),r=O("div",{id:`plyr-settings-${e.id}-home`}),o=O("div",{role:"menu"});r.appendChild(o),a.appendChild(r),this.elements.settings.panels.home=r,this.config.settings.forEach((i=>{const s=O("button",N(q(this.config.selectors.buttons.settings),{type:"button",class:`${this.config.classNames.control} ${this.config.classNames.control}--forward`,role:"menuitem","aria-haspopup":!0,hidden:""}));t.call(this,s,i),J.call(this,s,"click",(()=>{l.call(this,i,!1)}));const n=O("span",null,we.get(i,this.config)),r=O("span",{class:this.config.classNames.menu.value});r.innerHTML=e[i],n.appendChild(r),s.appendChild(n),o.appendChild(s);const c=O("div",{id:`plyr-settings-${e.id}-${i}`,hidden:""}),u=O("button",{type:"button",class:`${this.config.classNames.control} ${this.config.classNames.control}--back`});u.appendChild(O("span",{"aria-hidden":!0},we.get(i,this.config))),u.appendChild(O("span",{class:this.config.classNames.hidden},we.get("menuBack",this.config))),J.call(this,c,"keydown",(e=>{"ArrowLeft"===e.key&&(e.preventDefault(),e.stopPropagation(),l.call(this,"home",!0))}),!1),J.call(this,u,"click",(()=>{l.call(this,"home",!1)})),c.appendChild(u),c.appendChild(O("div",{role:"menu"})),a.appendChild(c),this.elements.settings.buttons[i]=s,this.elements.settings.panels[i]=c})),n.appendChild(a),s.appendChild(n),c.appendChild(s),this.elements.settings.popup=n,this.elements.settings.menu=s}if("pip"===r&&Y.pip&&c.appendChild(i.call(this,"pip",u)),"airplay"===r&&Y.airplay&&c.appendChild(i.call(this,"airplay",u)),"download"===r){const e=N({},u,{element:"a",href:this.download,target:"_blank"});this.isHTML5&&(e.download="");const{download:t}=this.config.urls;!A.url(t)&&this.isEmbed&&N(e,{icon:`logo-${this.provider}`,label:this.provider}),c.appendChild(i.call(this,"download",e))}"fullscreen"===r&&c.appendChild(i.call(this,"fullscreen",u))})),this.isHTML5&&r.call(this,me.getQualityOptions.call(this)),o.call(this),c},inject(){if(this.config.loadSprite){const e=Me.getIconUrl.call(this);e.cors&&Ee(e.url,"sprite-plyr")}this.id=Math.floor(1e4*Math.random());let e=null;this.elements.controls=null;const t={id:this.id,seektime:this.config.seekTime,title:this.config.title};let i=!0;A.function(this.config.controls)&&(this.config.controls=this.config.controls.call(this,t)),this.config.controls||(this.config.controls=[]),A.element(this.config.controls)||A.string(this.config.controls)?e=this.config.controls:(e=Me.create.call(this,{id:this.id,seektime:this.config.seekTime,speed:this.speed,quality:this.quality,captions:Ne.getLabel.call(this)}),i=!1);let s;i&&A.string(this.config.controls)&&(e=(e=>{let i=e;return Object.entries(t).forEach((([e,t])=>{i=ge(i,`{${e}}`,t)})),i})(e)),A.string(this.config.selectors.controls.container)&&(s=document.querySelector(this.config.selectors.controls.container)),A.element(s)||(s=this.elements.container);if(s[A.element(e)?"insertAdjacentElement":"insertAdjacentHTML"]("afterbegin",e),A.element(this.elements.controls)||Me.findElements.call(this),!A.empty(this.elements.buttons)){const e=e=>{const t=this.config.classNames.controlPressed;e.setAttribute("aria-pressed","false"),Object.defineProperty(e,"pressed",{configurable:!0,enumerable:!0,get:()=>U(e,t),set(i=!1){F(e,t,i),e.setAttribute("aria-pressed",i?"true":"false")}})};Object.values(this.elements.buttons).filter(Boolean).forEach((t=>{A.array(t)||A.nodeList(t)?Array.from(t).filter(Boolean).forEach(e):e(t)}))}if(x.isEdge&&M(s),this.config.tooltips.controls){const{classNames:e,selectors:t}=this.config,i=`${t.controls.wrapper} ${t.labels} .${e.hidden}`,s=B.call(this,i);Array.from(s).forEach((e=>{F(e,this.config.classNames.hidden,!1),F(e,this.config.classNames.tooltip,!0)}))}},setMediaMetadata(){try{"mediaSession"in navigator&&(navigator.mediaSession.metadata=new window.MediaMetadata({title:this.config.mediaMetadata.title,artist:this.config.mediaMetadata.artist,album:this.config.mediaMetadata.album,artwork:this.config.mediaMetadata.artwork}))}catch(e){}},setMarkers(){var e,t;if(!this.duration||this.elements.markers)return;const i=null===(e=this.config.markers)||void 0===e||null===(t=e.points)||void 0===t?void 0:t.filter((({time:e})=>e>0&&eF(a,r,e);i.forEach((e=>{const t=O("span",{class:this.config.classNames.marker},""),i=e.time/this.duration*100+"%";a&&(t.addEventListener("mouseenter",(()=>{e.label||(a.style.left=i,a.innerHTML=e.label,o(!0))})),t.addEventListener("mouseleave",(()=>{o(!1)}))),t.addEventListener("click",(()=>{this.currentTime=e.time})),t.style.left=i,n.appendChild(t)})),s.appendChild(n),this.config.tooltips.seek||(a=O("span",{class:this.config.classNames.tooltip},""),s.appendChild(a)),this.elements.markers={points:n,tip:a},this.elements.progress.appendChild(s)}};function xe(e,t=!0){let i=e;if(t){const e=document.createElement("a");e.href=i,i=e.href}try{return new URL(i)}catch(e){return null}}function Le(e){const t=new URLSearchParams;return A.object(e)&&Object.entries(e).forEach((([e,i])=>{t.set(e,i)})),t}const Ne={setup(){if(!this.supported.ui)return;if(!this.isVideo||this.isYouTube||this.isHTML5&&!Y.textTracks)return void(A.array(this.config.controls)&&this.config.controls.includes("settings")&&this.config.settings.includes("captions")&&Me.setCaptionsMenu.call(this));var e,t;if(A.element(this.elements.captions)||(this.elements.captions=O("div",q(this.config.selectors.captions)),this.elements.captions.setAttribute("dir","auto"),e=this.elements.captions,t=this.elements.wrapper,A.element(e)&&A.element(t)&&t.parentNode.insertBefore(e,t.nextSibling)),x.isIE&&window.URL){const e=this.media.querySelectorAll("track");Array.from(e).forEach((e=>{const t=e.getAttribute("src"),i=xe(t);null!==i&&i.hostname!==window.location.href.hostname&&["http:","https:"].includes(i.protocol)&&ke(t,"blob").then((t=>{e.setAttribute("src",window.URL.createObjectURL(t))})).catch((()=>{j(e)}))}))}const i=ne((navigator.languages||[navigator.language||navigator.userLanguage||"en"]).map((e=>e.split("-")[0])));let s=(this.storage.get("language")||this.config.captions.language||"auto").toLowerCase();"auto"===s&&([s]=i);let n=this.storage.get("captions");if(A.boolean(n)||({active:n}=this.config.captions),Object.assign(this.captions,{toggled:!1,active:n,language:s,languages:i}),this.isHTML5){const e=this.config.captions.update?"addtrack removetrack":"removetrack";J.call(this,this.media.textTracks,e,Ne.update.bind(this))}setTimeout(Ne.update.bind(this),0)},update(){const e=Ne.getTracks.call(this,!0),{active:t,language:i,meta:s,currentTrackNode:n}=this.captions,a=Boolean(e.find((e=>e.language===i)));this.isHTML5&&this.isVideo&&e.filter((e=>!s.get(e))).forEach((e=>{this.debug.log("Track added",e),s.set(e,{default:"showing"===e.mode}),"showing"===e.mode&&(e.mode="hidden"),J.call(this,e,"cuechange",(()=>Ne.updateCues.call(this)))})),(a&&this.language!==i||!e.includes(n))&&(Ne.setLanguage.call(this,i),Ne.toggle.call(this,t&&a)),this.elements&&F(this.elements.container,this.config.classNames.captions.enabled,!A.empty(e)),A.array(this.config.controls)&&this.config.controls.includes("settings")&&this.config.settings.includes("captions")&&Me.setCaptionsMenu.call(this)},toggle(e,t=!0){if(!this.supported.ui)return;const{toggled:i}=this.captions,s=this.config.classNames.captions.active,n=A.nullOrUndefined(e)?!i:e;if(n!==i){if(t||(this.captions.active=n,this.storage.set({captions:n})),!this.language&&n&&!t){const e=Ne.getTracks.call(this),t=Ne.findTrack.call(this,[this.captions.language,...this.captions.languages],!0);return this.captions.language=t.language,void Ne.set.call(this,e.indexOf(t))}this.elements.buttons.captions&&(this.elements.buttons.captions.pressed=n),F(this.elements.container,s,n),this.captions.toggled=n,Me.updateSetting.call(this,"captions"),ee.call(this,this.media,n?"captionsenabled":"captionsdisabled")}setTimeout((()=>{n&&this.captions.toggled&&(this.captions.currentTrackNode.mode="hidden")}))},set(e,t=!0){const i=Ne.getTracks.call(this);if(-1!==e)if(A.number(e))if(e in i){if(this.captions.currentTrack!==e){this.captions.currentTrack=e;const s=i[e],{language:n}=s||{};this.captions.currentTrackNode=s,Me.updateSetting.call(this,"captions"),t||(this.captions.language=n,this.storage.set({language:n})),this.isVimeo&&this.embed.enableTextTrack(n),ee.call(this,this.media,"languagechange")}Ne.toggle.call(this,!0,t),this.isHTML5&&this.isVideo&&Ne.updateCues.call(this)}else this.debug.warn("Track not found",e);else this.debug.warn("Invalid caption argument",e);else Ne.toggle.call(this,!1,t)},setLanguage(e,t=!0){if(!A.string(e))return void this.debug.warn("Invalid language argument",e);const i=e.toLowerCase();this.captions.language=i;const s=Ne.getTracks.call(this),n=Ne.findTrack.call(this,[i]);Ne.set.call(this,s.indexOf(n),t)},getTracks(e=!1){return Array.from((this.media||{}).textTracks||[]).filter((t=>!this.isHTML5||e||this.captions.meta.has(t))).filter((e=>["captions","subtitles"].includes(e.kind)))},findTrack(e,t=!1){const i=Ne.getTracks.call(this),s=e=>Number((this.captions.meta.get(e)||{}).default),n=Array.from(i).sort(((e,t)=>s(t)-s(e)));let a;return e.every((e=>(a=n.find((t=>t.language===e)),!a))),a||(t?n[0]:void 0)},getCurrentTrack(){return Ne.getTracks.call(this)[this.currentTrack]},getLabel(e){let t=e;return!A.track(t)&&Y.textTracks&&this.captions.toggled&&(t=Ne.getCurrentTrack.call(this)),A.track(t)?A.empty(t.label)?A.empty(t.language)?we.get("enabled",this.config):e.language.toUpperCase():t.label:we.get("disabled",this.config)},updateCues(e){if(!this.supported.ui)return;if(!A.element(this.elements.captions))return void this.debug.warn("No captions element to render to");if(!A.nullOrUndefined(e)&&!Array.isArray(e))return void this.debug.warn("updateCues: Invalid input",e);let t=e;if(!t){const e=Ne.getCurrentTrack.call(this);t=Array.from((e||{}).activeCues||[]).map((e=>e.getCueAsHTML())).map(be)}const i=t.map((e=>e.trim())).join("\n");if(i!==this.elements.captions.innerHTML){R(this.elements.captions);const e=O("span",q(this.config.selectors.caption));e.innerHTML=i,this.elements.captions.appendChild(e),ee.call(this,this.media,"cuechange")}}},_e={enabled:!0,title:"",debug:!1,autoplay:!1,autopause:!0,playsinline:!0,seekTime:10,volume:1,muted:!1,duration:null,displayDuration:!0,invertTime:!0,toggleInvert:!0,ratio:null,clickToPlay:!0,hideControls:!0,resetOnEnd:!1,disableContextMenu:!0,loadSprite:!0,iconPrefix:"plyr",iconUrl:"https://cdn.plyr.io/3.7.8/plyr.svg",blankVideo:"https://cdn.plyr.io/static/blank.mp4",quality:{default:576,options:[4320,2880,2160,1440,1080,720,576,480,360,240],forced:!1,onChange:null},loop:{active:!1},speed:{selected:1,options:[.5,.75,1,1.25,1.5,1.75,2,4]},keyboard:{focused:!0,global:!1},tooltips:{controls:!1,seek:!0},captions:{active:!1,language:"auto",update:!1},fullscreen:{enabled:!0,fallback:!0,iosNative:!1},storage:{enabled:!0,key:"plyr"},controls:["play-large","play","progress","current-time","mute","volume","captions","settings","pip","airplay","fullscreen"],settings:["captions","quality","speed"],i18n:{restart:"Restart",rewind:"Rewind {seektime}s",play:"Play",pause:"Pause",fastForward:"Forward {seektime}s",seek:"Seek",seekLabel:"{currentTime} of {duration}",played:"Played",buffered:"Buffered",currentTime:"Current time",duration:"Duration",volume:"Volume",mute:"Mute",unmute:"Unmute",enableCaptions:"Enable captions",disableCaptions:"Disable captions",download:"Download",enterFullscreen:"Enter fullscreen",exitFullscreen:"Exit fullscreen",frameTitle:"Player for {title}",captions:"Captions",settings:"Settings",pip:"PIP",menuBack:"Go back to previous menu",speed:"Speed",normal:"Normal",quality:"Quality",loop:"Loop",start:"Start",end:"End",all:"All",reset:"Reset",disabled:"Disabled",enabled:"Enabled",advertisement:"Ad",qualityBadge:{2160:"4K",1440:"HD",1080:"HD",720:"HD",576:"SD",480:"SD"}},urls:{download:null,vimeo:{sdk:"https://player.vimeo.com/api/player.js",iframe:"https://player.vimeo.com/video/{0}?{1}",api:"https://vimeo.com/api/oembed.json?url={0}"},youtube:{sdk:"https://www.youtube.com/iframe_api",api:"https://noembed.com/embed?url=https://www.youtube.com/watch?v={0}"},googleIMA:{sdk:"https://imasdk.googleapis.com/js/sdkloader/ima3.js"}},listeners:{seek:null,play:null,pause:null,restart:null,rewind:null,fastForward:null,mute:null,volume:null,captions:null,download:null,fullscreen:null,pip:null,airplay:null,speed:null,quality:null,loop:null,language:null},events:["ended","progress","stalled","playing","waiting","canplay","canplaythrough","loadstart","loadeddata","loadedmetadata","timeupdate","volumechange","play","pause","error","seeking","seeked","emptied","ratechange","cuechange","download","enterfullscreen","exitfullscreen","captionsenabled","captionsdisabled","languagechange","controlshidden","controlsshown","ready","statechange","qualitychange","adsloaded","adscontentpause","adscontentresume","adstarted","adsmidpoint","adscomplete","adsallcomplete","adsimpression","adsclick"],selectors:{editable:"input, textarea, select, [contenteditable]",container:".plyr",controls:{container:null,wrapper:".plyr__controls"},labels:"[data-plyr]",buttons:{play:'[data-plyr="play"]',pause:'[data-plyr="pause"]',restart:'[data-plyr="restart"]',rewind:'[data-plyr="rewind"]',fastForward:'[data-plyr="fast-forward"]',mute:'[data-plyr="mute"]',captions:'[data-plyr="captions"]',download:'[data-plyr="download"]',fullscreen:'[data-plyr="fullscreen"]',pip:'[data-plyr="pip"]',airplay:'[data-plyr="airplay"]',settings:'[data-plyr="settings"]',loop:'[data-plyr="loop"]'},inputs:{seek:'[data-plyr="seek"]',volume:'[data-plyr="volume"]',speed:'[data-plyr="speed"]',language:'[data-plyr="language"]',quality:'[data-plyr="quality"]'},display:{currentTime:".plyr__time--current",duration:".plyr__time--duration",buffer:".plyr__progress__buffer",loop:".plyr__progress__loop",volume:".plyr__volume--display"},progress:".plyr__progress",captions:".plyr__captions",caption:".plyr__caption"},classNames:{type:"plyr--{0}",provider:"plyr--{0}",video:"plyr__video-wrapper",embed:"plyr__video-embed",videoFixedRatio:"plyr__video-wrapper--fixed-ratio",embedContainer:"plyr__video-embed__container",poster:"plyr__poster",posterEnabled:"plyr__poster-enabled",ads:"plyr__ads",control:"plyr__control",controlPressed:"plyr__control--pressed",playing:"plyr--playing",paused:"plyr--paused",stopped:"plyr--stopped",loading:"plyr--loading",hover:"plyr--hover",tooltip:"plyr__tooltip",cues:"plyr__cues",marker:"plyr__progress__marker",hidden:"plyr__sr-only",hideControls:"plyr--hide-controls",isTouch:"plyr--is-touch",uiSupported:"plyr--full-ui",noTransition:"plyr--no-transition",display:{time:"plyr__time"},menu:{value:"plyr__menu__value",badge:"plyr__badge",open:"plyr--menu-open"},captions:{enabled:"plyr--captions-enabled",active:"plyr--captions-active"},fullscreen:{enabled:"plyr--fullscreen-enabled",fallback:"plyr--fullscreen-fallback"},pip:{supported:"plyr--pip-supported",active:"plyr--pip-active"},airplay:{supported:"plyr--airplay-supported",active:"plyr--airplay-active"},previewThumbnails:{thumbContainer:"plyr__preview-thumb",thumbContainerShown:"plyr__preview-thumb--is-shown",imageContainer:"plyr__preview-thumb__image-container",timeContainer:"plyr__preview-thumb__time-container",scrubbingContainer:"plyr__preview-scrubbing",scrubbingContainerShown:"plyr__preview-scrubbing--is-shown"}},attributes:{embed:{provider:"data-plyr-provider",id:"data-plyr-embed-id",hash:"data-plyr-embed-hash"}},ads:{enabled:!1,publisherId:"",tagUrl:""},previewThumbnails:{enabled:!1,src:""},vimeo:{byline:!1,portrait:!1,title:!1,speed:!0,transparent:!1,customControls:!0,referrerPolicy:null,premium:!1},youtube:{rel:0,showinfo:0,iv_load_policy:3,modestbranding:1,customControls:!0,noCookie:!1},mediaMetadata:{title:"",artist:"",album:"",artwork:[]},markers:{enabled:!1,points:[]}},Ie="picture-in-picture",Oe="inline",$e={html5:"html5",youtube:"youtube",vimeo:"vimeo"},je="audio",Re="video";const De=()=>{};class qe{constructor(e=!1){this.enabled=window.console&&e,this.enabled&&this.log("Debugging enabled")}get log(){return this.enabled?Function.prototype.bind.call(console.log,console):De}get warn(){return this.enabled?Function.prototype.bind.call(console.warn,console):De}get error(){return this.enabled?Function.prototype.bind.call(console.error,console):De}}class He{constructor(e){t(this,"onChange",(()=>{if(!this.supported)return;const e=this.player.elements.buttons.fullscreen;A.element(e)&&(e.pressed=this.active);const t=this.target===this.player.media?this.target:this.player.elements.container;ee.call(this.player,t,this.active?"enterfullscreen":"exitfullscreen",!0)})),t(this,"toggleFallback",((e=!1)=>{if(e?this.scrollPosition={x:window.scrollX??0,y:window.scrollY??0}:window.scrollTo(this.scrollPosition.x,this.scrollPosition.y),document.body.style.overflow=e?"hidden":"",F(this.target,this.player.config.classNames.fullscreen.fallback,e),x.isIos){let t=document.head.querySelector('meta[name="viewport"]');const i="viewport-fit=cover";t||(t=document.createElement("meta"),t.setAttribute("name","viewport"));const s=A.string(t.content)&&t.content.includes(i);e?(this.cleanupViewport=!s,s||(t.content+=`,${i}`)):this.cleanupViewport&&(t.content=t.content.split(",").filter((e=>e.trim()!==i)).join(","))}this.onChange()})),t(this,"trapFocus",(e=>{if(x.isIos||x.isIPadOS||!this.active||"Tab"!==e.key)return;const t=document.activeElement,i=B.call(this.player,"a[href], button:not(:disabled), input:not(:disabled), [tabindex]"),[s]=i,n=i[i.length-1];t!==n||e.shiftKey?t===s&&e.shiftKey&&(n.focus(),e.preventDefault()):(s.focus(),e.preventDefault())})),t(this,"update",(()=>{if(this.supported){let e;e=this.forceFallback?"Fallback (forced)":He.nativeSupported?"Native":"Fallback",this.player.debug.log(`${e} fullscreen enabled`)}else this.player.debug.log("Fullscreen not supported and fallback disabled");F(this.player.elements.container,this.player.config.classNames.fullscreen.enabled,this.supported)})),t(this,"enter",(()=>{this.supported&&(x.isIos&&this.player.config.fullscreen.iosNative?this.player.isVimeo?this.player.embed.requestFullscreen():this.target.webkitEnterFullscreen():!He.nativeSupported||this.forceFallback?this.toggleFallback(!0):this.prefix?A.empty(this.prefix)||this.target[`${this.prefix}Request${this.property}`]():this.target.requestFullscreen({navigationUI:"hide"}))})),t(this,"exit",(()=>{if(this.supported)if(x.isIos&&this.player.config.fullscreen.iosNative)this.player.isVimeo?this.player.embed.exitFullscreen():this.target.webkitEnterFullscreen(),se(this.player.play());else if(!He.nativeSupported||this.forceFallback)this.toggleFallback(!1);else if(this.prefix){if(!A.empty(this.prefix)){const e="moz"===this.prefix?"Cancel":"Exit";document[`${this.prefix}${e}${this.property}`]()}}else(document.cancelFullScreen||document.exitFullscreen).call(document)})),t(this,"toggle",(()=>{this.active?this.exit():this.enter()})),this.player=e,this.prefix=He.prefix,this.property=He.property,this.scrollPosition={x:0,y:0},this.forceFallback="force"===e.config.fullscreen.fallback,this.player.elements.fullscreen=e.config.fullscreen.container&&function(e,t){const{prototype:i}=Element;return(i.closest||function(){let e=this;do{if(V.matches(e,t))return e;e=e.parentElement||e.parentNode}while(null!==e&&1===e.nodeType);return null}).call(e,t)}(this.player.elements.container,e.config.fullscreen.container),J.call(this.player,document,"ms"===this.prefix?"MSFullscreenChange":`${this.prefix}fullscreenchange`,(()=>{this.onChange()})),J.call(this.player,this.player.elements.container,"dblclick",(e=>{A.element(this.player.elements.controls)&&this.player.elements.controls.contains(e.target)||this.player.listeners.proxy(e,this.toggle,"fullscreen")})),J.call(this,this.player.elements.container,"keydown",(e=>this.trapFocus(e))),this.update()}static get nativeSupported(){return!!(document.fullscreenEnabled||document.webkitFullscreenEnabled||document.mozFullScreenEnabled||document.msFullscreenEnabled)}get useNative(){return He.nativeSupported&&!this.forceFallback}static get prefix(){if(A.function(document.exitFullscreen))return"";let e="";return["webkit","moz","ms"].some((t=>!(!A.function(document[`${t}ExitFullscreen`])&&!A.function(document[`${t}CancelFullScreen`]))&&(e=t,!0))),e}static get property(){return"moz"===this.prefix?"FullScreen":"Fullscreen"}get supported(){return[this.player.config.fullscreen.enabled,this.player.isVideo,He.nativeSupported||this.player.config.fullscreen.fallback,!this.player.isYouTube||He.nativeSupported||!x.isIos||this.player.config.playsinline&&!this.player.config.fullscreen.iosNative].every(Boolean)}get active(){if(!this.supported)return!1;if(!He.nativeSupported||this.forceFallback)return U(this.target,this.player.config.classNames.fullscreen.fallback);const e=this.prefix?this.target.getRootNode()[`${this.prefix}${this.property}Element`]:this.target.getRootNode().fullscreenElement;return e&&e.shadowRoot?e===this.target.getRootNode().host:e===this.target}get target(){return x.isIos&&this.player.config.fullscreen.iosNative?this.player.media:this.player.elements.fullscreen??this.player.elements.container}}function Fe(e,t=1){return new Promise(((i,s)=>{const n=new Image,a=()=>{delete n.onload,delete n.onerror,(n.naturalWidth>=t?i:s)(n)};Object.assign(n,{onload:a,onerror:a,src:e})}))}const Ue={addStyleHook(){F(this.elements.container,this.config.selectors.container.replace(".",""),!0),F(this.elements.container,this.config.classNames.uiSupported,this.supported.ui)},toggleNativeControls(e=!1){e&&this.isHTML5?this.media.setAttribute("controls",""):this.media.removeAttribute("controls")},build(){if(this.listeners.media(),!this.supported.ui)return this.debug.warn(`Basic support only for ${this.provider} ${this.type}`),void Ue.toggleNativeControls.call(this,!0);A.element(this.elements.controls)||(Me.inject.call(this),this.listeners.controls()),Ue.toggleNativeControls.call(this),this.isHTML5&&Ne.setup.call(this),this.volume=null,this.muted=null,this.loop=null,this.quality=null,this.speed=null,Me.updateVolume.call(this),Me.timeUpdate.call(this),Me.durationUpdate.call(this),Ue.checkPlaying.call(this),F(this.elements.container,this.config.classNames.pip.supported,Y.pip&&this.isHTML5&&this.isVideo),F(this.elements.container,this.config.classNames.airplay.supported,Y.airplay&&this.isHTML5),F(this.elements.container,this.config.classNames.isTouch,this.touch),this.ready=!0,setTimeout((()=>{ee.call(this,this.media,"ready")}),0),Ue.setTitle.call(this),this.poster&&Ue.setPoster.call(this,this.poster,!1).catch((()=>{})),this.config.duration&&Me.durationUpdate.call(this),this.config.mediaMetadata&&Me.setMediaMetadata.call(this)},setTitle(){let e=we.get("play",this.config);if(A.string(this.config.title)&&!A.empty(this.config.title)&&(e+=`, ${this.config.title}`),Array.from(this.elements.buttons.play||[]).forEach((t=>{t.setAttribute("aria-label",e)})),this.isEmbed){const e=W.call(this,"iframe");if(!A.element(e))return;const t=A.empty(this.config.title)?"video":this.config.title,i=we.get("frameTitle",this.config);e.setAttribute("title",i.replace("{title}",t))}},togglePoster(e){F(this.elements.container,this.config.classNames.posterEnabled,e)},setPoster(e,t=!0){return t&&this.poster?Promise.reject(new Error("Poster already set")):(this.media.setAttribute("data-poster",e),this.elements.poster.removeAttribute("hidden"),ie.call(this).then((()=>Fe(e))).catch((t=>{throw e===this.poster&&Ue.togglePoster.call(this,!1),t})).then((()=>{if(e!==this.poster)throw new Error("setPoster cancelled by later call to setPoster")})).then((()=>(Object.assign(this.elements.poster.style,{backgroundImage:`url('${e}')`,backgroundSize:""}),Ue.togglePoster.call(this,!0),e))))},checkPlaying(e){F(this.elements.container,this.config.classNames.playing,this.playing),F(this.elements.container,this.config.classNames.paused,this.paused),F(this.elements.container,this.config.classNames.stopped,this.stopped),Array.from(this.elements.buttons.play||[]).forEach((e=>{Object.assign(e,{pressed:this.playing}),e.setAttribute("aria-label",we.get(this.playing?"pause":"play",this.config))})),A.event(e)&&"timeupdate"===e.type||Ue.toggleControls.call(this)},checkLoading(e){this.loading=["stalled","waiting"].includes(e.type),clearTimeout(this.timers.loading),this.timers.loading=setTimeout((()=>{F(this.elements.container,this.config.classNames.loading,this.loading),Ue.toggleControls.call(this)}),this.loading?250:0)},toggleControls(e){const{controls:t}=this.elements;if(t&&this.config.hideControls){const i=this.touch&&this.lastSeekTime+2e3>Date.now();this.toggleControls(Boolean(e||this.loading||this.paused||t.pressed||t.hover||i))}},migrateStyles(){Object.values({...this.media.style}).filter((e=>!A.empty(e)&&A.string(e)&&e.startsWith("--plyr"))).forEach((e=>{this.elements.container.style.setProperty(e,this.media.style.getPropertyValue(e)),this.media.style.removeProperty(e)})),A.empty(this.media.style)&&this.media.removeAttribute("style")}};class Ve{constructor(e){t(this,"firstTouch",(()=>{const{player:e}=this,{elements:t}=e;e.touch=!0,F(t.container,e.config.classNames.isTouch,!0)})),t(this,"global",((e=!0)=>{const{player:t}=this;t.config.keyboard.global&&X.call(t,window,"keydown keyup",this.handleKey,e,!1),X.call(t,document.body,"click",this.toggleMenu,e),Z.call(t,document.body,"touchstart",this.firstTouch)})),t(this,"container",(()=>{const{player:e}=this,{config:t,elements:i,timers:s}=e;!t.keyboard.global&&t.keyboard.focused&&J.call(e,i.container,"keydown keyup",this.handleKey,!1),J.call(e,i.container,"mousemove mouseleave touchstart touchmove enterfullscreen exitfullscreen",(t=>{const{controls:n}=i;n&&"enterfullscreen"===t.type&&(n.pressed=!1,n.hover=!1);let a=0;["touchstart","touchmove","mousemove"].includes(t.type)&&(Ue.toggleControls.call(e,!0),a=e.touch?3e3:2e3),clearTimeout(s.controls),s.controls=setTimeout((()=>Ue.toggleControls.call(e,!1)),a)}));const n=()=>{if(!e.isVimeo||e.config.vimeo.premium)return;const t=i.wrapper,{active:s}=e.fullscreen,[n,a]=ue.call(e),r=re(`aspect-ratio: ${n} / ${a}`);if(!s)return void(r?(t.style.width=null,t.style.height=null):(t.style.maxWidth=null,t.style.margin=null));const[o,l]=[Math.max(document.documentElement.clientWidth||0,window.innerWidth||0),Math.max(document.documentElement.clientHeight||0,window.innerHeight||0)],c=o/l>n/a;r?(t.style.width=c?"auto":"100%",t.style.height=c?"100%":"auto"):(t.style.maxWidth=c?l/a*n+"px":null,t.style.margin=c?"0 auto":null)},a=()=>{clearTimeout(s.resized),s.resized=setTimeout(n,50)};J.call(e,i.container,"enterfullscreen exitfullscreen",(t=>{const{target:s}=e.fullscreen;if(s!==i.container)return;if(!e.isEmbed&&A.empty(e.config.ratio))return;n();("enterfullscreen"===t.type?J:G).call(e,window,"resize",a)}))})),t(this,"media",(()=>{const{player:e}=this,{elements:t}=e;if(J.call(e,e.media,"timeupdate seeking seeked",(t=>Me.timeUpdate.call(e,t))),J.call(e,e.media,"durationchange loadeddata loadedmetadata",(t=>Me.durationUpdate.call(e,t))),J.call(e,e.media,"ended",(()=>{e.isHTML5&&e.isVideo&&e.config.resetOnEnd&&(e.restart(),e.pause())})),J.call(e,e.media,"progress playing seeking seeked",(t=>Me.updateProgress.call(e,t))),J.call(e,e.media,"volumechange",(t=>Me.updateVolume.call(e,t))),J.call(e,e.media,"playing play pause ended emptied timeupdate",(t=>Ue.checkPlaying.call(e,t))),J.call(e,e.media,"waiting canplay seeked playing",(t=>Ue.checkLoading.call(e,t))),e.supported.ui&&e.config.clickToPlay&&!e.isAudio){const i=W.call(e,`.${e.config.classNames.video}`);if(!A.element(i))return;J.call(e,t.container,"click",(s=>{([t.container,i].includes(s.target)||i.contains(s.target))&&(e.touch&&e.config.hideControls||(e.ended?(this.proxy(s,e.restart,"restart"),this.proxy(s,(()=>{se(e.play())}),"play")):this.proxy(s,(()=>{se(e.togglePlay())}),"play")))}))}e.supported.ui&&e.config.disableContextMenu&&J.call(e,t.wrapper,"contextmenu",(e=>{e.preventDefault()}),!1),J.call(e,e.media,"volumechange",(()=>{e.storage.set({volume:e.volume,muted:e.muted})})),J.call(e,e.media,"ratechange",(()=>{Me.updateSetting.call(e,"speed"),e.storage.set({speed:e.speed})})),J.call(e,e.media,"qualitychange",(t=>{Me.updateSetting.call(e,"quality",null,t.detail.quality)})),J.call(e,e.media,"ready qualitychange",(()=>{Me.setDownloadUrl.call(e)}));const i=e.config.events.concat(["keyup","keydown"]).join(" ");J.call(e,e.media,i,(i=>{let{detail:s={}}=i;"error"===i.type&&(s=e.media.error),ee.call(e,t.container,i.type,!0,s)}))})),t(this,"proxy",((e,t,i)=>{const{player:s}=this,n=s.config.listeners[i];let a=!0;A.function(n)&&(a=n.call(s,e)),!1!==a&&A.function(t)&&t.call(s,e)})),t(this,"bind",((e,t,i,s,n=!0)=>{const{player:a}=this,r=a.config.listeners[s],o=A.function(r);J.call(a,e,t,(e=>this.proxy(e,i,s)),n&&!o)})),t(this,"controls",(()=>{const{player:e}=this,{elements:t}=e,i=x.isIE?"change":"input";if(t.buttons.play&&Array.from(t.buttons.play).forEach((t=>{this.bind(t,"click",(()=>{se(e.togglePlay())}),"play")})),this.bind(t.buttons.restart,"click",e.restart,"restart"),this.bind(t.buttons.rewind,"click",(()=>{e.lastSeekTime=Date.now(),e.rewind()}),"rewind"),this.bind(t.buttons.fastForward,"click",(()=>{e.lastSeekTime=Date.now(),e.forward()}),"fastForward"),this.bind(t.buttons.mute,"click",(()=>{e.muted=!e.muted}),"mute"),this.bind(t.buttons.captions,"click",(()=>e.toggleCaptions())),this.bind(t.buttons.download,"click",(()=>{ee.call(e,e.media,"download")}),"download"),this.bind(t.buttons.fullscreen,"click",(()=>{e.fullscreen.toggle()}),"fullscreen"),this.bind(t.buttons.pip,"click",(()=>{e.pip="toggle"}),"pip"),this.bind(t.buttons.airplay,"click",e.airplay,"airplay"),this.bind(t.buttons.settings,"click",(t=>{t.stopPropagation(),t.preventDefault(),Me.toggleMenu.call(e,t)}),null,!1),this.bind(t.buttons.settings,"keyup",(t=>{[" ","Enter"].includes(t.key)&&("Enter"!==t.key?(t.preventDefault(),t.stopPropagation(),Me.toggleMenu.call(e,t)):Me.focusFirstMenuItem.call(e,null,!0))}),null,!1),this.bind(t.settings.menu,"keydown",(t=>{"Escape"===t.key&&Me.toggleMenu.call(e,t)})),this.bind(t.inputs.seek,"mousedown mousemove",(e=>{const i=t.progress.getBoundingClientRect(),s=100/i.width*(e.pageX-i.left);e.currentTarget.setAttribute("seek-value",s)})),this.bind(t.inputs.seek,"mousedown mouseup keydown keyup touchstart touchend",(t=>{const i=t.currentTarget,s="play-on-seeked";if(A.keyboardEvent(t)&&!["ArrowLeft","ArrowRight"].includes(t.key))return;e.lastSeekTime=Date.now();const n=i.hasAttribute(s),a=["mouseup","touchend","keyup"].includes(t.type);n&&a?(i.removeAttribute(s),se(e.play())):!a&&e.playing&&(i.setAttribute(s,""),e.pause())})),x.isIos){const t=B.call(e,'input[type="range"]');Array.from(t).forEach((e=>this.bind(e,i,(e=>M(e.target)))))}this.bind(t.inputs.seek,i,(t=>{const i=t.currentTarget;let s=i.getAttribute("seek-value");A.empty(s)&&(s=i.value),i.removeAttribute("seek-value"),e.currentTime=s/i.max*e.duration}),"seek"),this.bind(t.progress,"mouseenter mouseleave mousemove",(t=>Me.updateSeekTooltip.call(e,t))),this.bind(t.progress,"mousemove touchmove",(t=>{const{previewThumbnails:i}=e;i&&i.loaded&&i.startMove(t)})),this.bind(t.progress,"mouseleave touchend click",(()=>{const{previewThumbnails:t}=e;t&&t.loaded&&t.endMove(!1,!0)})),this.bind(t.progress,"mousedown touchstart",(t=>{const{previewThumbnails:i}=e;i&&i.loaded&&i.startScrubbing(t)})),this.bind(t.progress,"mouseup touchend",(t=>{const{previewThumbnails:i}=e;i&&i.loaded&&i.endScrubbing(t)})),x.isWebKit&&Array.from(B.call(e,'input[type="range"]')).forEach((t=>{this.bind(t,"input",(t=>Me.updateRangeFill.call(e,t.target)))})),e.config.toggleInvert&&!A.element(t.display.duration)&&this.bind(t.display.currentTime,"click",(()=>{0!==e.currentTime&&(e.config.invertTime=!e.config.invertTime,Me.timeUpdate.call(e))})),this.bind(t.inputs.volume,i,(t=>{e.volume=t.target.value}),"volume"),this.bind(t.controls,"mouseenter mouseleave",(i=>{t.controls.hover=!e.touch&&"mouseenter"===i.type})),t.fullscreen&&Array.from(t.fullscreen.children).filter((e=>!e.contains(t.container))).forEach((i=>{this.bind(i,"mouseenter mouseleave",(i=>{t.controls&&(t.controls.hover=!e.touch&&"mouseenter"===i.type)}))})),this.bind(t.controls,"mousedown mouseup touchstart touchend touchcancel",(e=>{t.controls.pressed=["mousedown","touchstart"].includes(e.type)})),this.bind(t.controls,"focusin",(()=>{const{config:i,timers:s}=e;F(t.controls,i.classNames.noTransition,!0),Ue.toggleControls.call(e,!0),setTimeout((()=>{F(t.controls,i.classNames.noTransition,!1)}),0);const n=this.touch?3e3:4e3;clearTimeout(s.controls),s.controls=setTimeout((()=>Ue.toggleControls.call(e,!1)),n)})),this.bind(t.inputs.volume,"wheel",(t=>{const i=t.webkitDirectionInvertedFromDevice,[s,n]=[t.deltaX,-t.deltaY].map((e=>i?-e:e)),a=Math.sign(Math.abs(s)>Math.abs(n)?s:n);e.increaseVolume(a/50);const{volume:r}=e.media;(1===a&&r<1||-1===a&&r>0)&&t.preventDefault()}),"volume",!1)})),this.player=e,this.lastKey=null,this.focusTimer=null,this.lastKeyDown=null,this.handleKey=this.handleKey.bind(this),this.toggleMenu=this.toggleMenu.bind(this),this.firstTouch=this.firstTouch.bind(this)}handleKey(e){const{player:t}=this,{elements:i}=t,{key:s,type:n,altKey:a,ctrlKey:r,metaKey:o,shiftKey:l}=e,c="keydown"===n,u=c&&s===this.lastKey;if(a||r||o||l)return;if(!s)return;if(c){const n=document.activeElement;if(A.element(n)){const{editable:s}=t.config.selectors,{seek:a}=i.inputs;if(n!==a&&V(n,s))return;if(" "===e.key&&V(n,'button, [role^="menuitem"]'))return}switch([" ","ArrowLeft","ArrowUp","ArrowRight","ArrowDown","0","1","2","3","4","5","6","7","8","9","c","f","k","l","m"].includes(s)&&(e.preventDefault(),e.stopPropagation()),s){case"0":case"1":case"2":case"3":case"4":case"5":case"6":case"7":case"8":case"9":u||(h=parseInt(s,10),t.currentTime=t.duration/10*h);break;case" ":case"k":u||se(t.togglePlay());break;case"ArrowUp":t.increaseVolume(.1);break;case"ArrowDown":t.decreaseVolume(.1);break;case"m":u||(t.muted=!t.muted);break;case"ArrowRight":t.forward();break;case"ArrowLeft":t.rewind();break;case"f":t.fullscreen.toggle();break;case"c":u||t.toggleCaptions();break;case"l":t.loop=!t.loop}"Escape"===s&&!t.fullscreen.usingNative&&t.fullscreen.active&&t.fullscreen.toggle(),this.lastKey=s}else this.lastKey=null;var h}toggleMenu(e){Me.toggleMenu.call(this.player,e)}}var Be=function(e,t){return e(t={exports:{}},t.exports),t.exports}((function(e,t){e.exports=function(){var e=function(){},t={},i={},s={};function n(e,t){e=e.push?e:[e];var n,a,r,o=[],l=e.length,c=l;for(n=function(e,i){i.length&&o.push(e),--c||t(o)};l--;)a=e[l],(r=i[a])?n(a,r):(s[a]=s[a]||[]).push(n)}function a(e,t){if(e){var n=s[e];if(i[e]=t,n)for(;n.length;)n[0](e,t),n.splice(0,1)}}function r(t,i){t.call&&(t={success:t}),i.length?(t.error||e)(i):(t.success||e)(t)}function o(t,i,s,n){var a,r,l=document,c=s.async,u=(s.numRetries||0)+1,h=s.before||e,d=t.replace(/[\?|#].*$/,""),m=t.replace(/^(css|img)!/,"");n=n||0,/(^css!|\.css$)/.test(d)?((r=l.createElement("link")).rel="stylesheet",r.href=m,(a="hideFocus"in r)&&r.relList&&(a=0,r.rel="preload",r.as="style")):/(^img!|\.(png|gif|jpg|svg|webp)$)/.test(d)?(r=l.createElement("img")).src=m:((r=l.createElement("script")).src=t,r.async=void 0===c||c),r.onload=r.onerror=r.onbeforeload=function(e){var l=e.type[0];if(a)try{r.sheet.cssText.length||(l="e")}catch(e){18!=e.code&&(l="e")}if("e"==l){if((n+=1){Be(e,{success:t,error:i})}))}function ze(e){e&&!this.embed.hasPlayed&&(this.embed.hasPlayed=!0),this.media.paused===e&&(this.media.paused=!e,ee.call(this,this.media,e?"play":"pause"))}const Ke={setup(){const e=this;F(e.elements.wrapper,e.config.classNames.embed,!0),e.options.speed=e.config.speed.options,he.call(e),A.object(window.Vimeo)?Ke.ready.call(e):We(e.config.urls.vimeo.sdk).then((()=>{Ke.ready.call(e)})).catch((t=>{e.debug.warn("Vimeo SDK (player.js) failed to load",t)}))},ready(){const e=this,t=e.config.vimeo,{premium:i,referrerPolicy:s,...n}=t;let a=e.media.getAttribute("src"),r="";A.empty(a)?(a=e.media.getAttribute(e.config.attributes.embed.id),r=e.media.getAttribute(e.config.attributes.embed.hash)):r=function(e){const t=e.match(/^.*(vimeo.com\/|video\/)(\d+)(\?.*&*h=|\/)+([\d,a-f]+)/);return t&&5===t.length?t[4]:null}(a);const o=r?{h:r}:{};i&&Object.assign(n,{controls:!1,sidedock:!1});const l=Le({loop:e.config.loop.active,autoplay:e.autoplay,muted:e.muted,gesture:"media",playsinline:e.config.playsinline,...o,...n}),c=(u=a,A.empty(u)?null:A.number(Number(u))?u:u.match(/^.*(vimeo.com\/|video\/)(\d+).*/)?RegExp.$2:u);var u;const h=O("iframe"),d=pe(e.config.urls.vimeo.iframe,c,l);if(h.setAttribute("src",d),h.setAttribute("allowfullscreen",""),h.setAttribute("allow",["autoplay","fullscreen","picture-in-picture","encrypted-media","accelerometer","gyroscope"].join("; ")),A.empty(s)||h.setAttribute("referrerPolicy",s),i||!t.customControls)h.setAttribute("data-poster",e.poster),e.media=D(h,e.media);else{const t=O("div",{class:e.config.classNames.embedContainer,"data-poster":e.poster});t.appendChild(h),e.media=D(t,e.media)}t.customControls||ke(pe(e.config.urls.vimeo.api,d)).then((t=>{!A.empty(t)&&t.thumbnail_url&&Ue.setPoster.call(e,t.thumbnail_url).catch((()=>{}))})),e.embed=new window.Vimeo.Player(h,{autopause:e.config.autopause,muted:e.muted}),e.media.paused=!0,e.media.currentTime=0,e.supported.ui&&e.embed.disableTextTrack(),e.media.play=()=>(ze.call(e,!0),e.embed.play()),e.media.pause=()=>(ze.call(e,!1),e.embed.pause()),e.media.stop=()=>{e.pause(),e.currentTime=0};let{currentTime:m}=e.media;Object.defineProperty(e.media,"currentTime",{get:()=>m,set(t){const{embed:i,media:s,paused:n,volume:a}=e,r=n&&!i.hasPlayed;s.seeking=!0,ee.call(e,s,"seeking"),Promise.resolve(r&&i.setVolume(0)).then((()=>i.setCurrentTime(t))).then((()=>r&&i.pause())).then((()=>r&&i.setVolume(a))).catch((()=>{}))}});let p=e.config.speed.selected;Object.defineProperty(e.media,"playbackRate",{get:()=>p,set(t){e.embed.setPlaybackRate(t).then((()=>{p=t,ee.call(e,e.media,"ratechange")})).catch((()=>{e.options.speed=[1]}))}});let{volume:g}=e.config;Object.defineProperty(e.media,"volume",{get:()=>g,set(t){e.embed.setVolume(t).then((()=>{g=t,ee.call(e,e.media,"volumechange")}))}});let{muted:f}=e.config;Object.defineProperty(e.media,"muted",{get:()=>f,set(t){const i=!!A.boolean(t)&&t;e.embed.setMuted(!!i||e.config.muted).then((()=>{f=i,ee.call(e,e.media,"volumechange")}))}});let y,{loop:b}=e.config;Object.defineProperty(e.media,"loop",{get:()=>b,set(t){const i=A.boolean(t)?t:e.config.loop.active;e.embed.setLoop(i).then((()=>{b=i}))}}),e.embed.getVideoUrl().then((t=>{y=t,Me.setDownloadUrl.call(e)})).catch((e=>{this.debug.warn(e)})),Object.defineProperty(e.media,"currentSrc",{get:()=>y}),Object.defineProperty(e.media,"ended",{get:()=>e.currentTime===e.duration}),Promise.all([e.embed.getVideoWidth(),e.embed.getVideoHeight()]).then((t=>{const[i,s]=t;e.embed.ratio=de(i,s),he.call(this)})),e.embed.setAutopause(e.config.autopause).then((t=>{e.config.autopause=t})),e.embed.getVideoTitle().then((t=>{e.config.title=t,Ue.setTitle.call(this)})),e.embed.getCurrentTime().then((t=>{m=t,ee.call(e,e.media,"timeupdate")})),e.embed.getDuration().then((t=>{e.media.duration=t,ee.call(e,e.media,"durationchange")})),e.embed.getTextTracks().then((t=>{e.media.textTracks=t,Ne.setup.call(e)})),e.embed.on("cuechange",(({cues:t=[]})=>{const i=t.map((e=>function(e){const t=document.createDocumentFragment(),i=document.createElement("div");return t.appendChild(i),i.innerHTML=e,t.firstChild.innerText}(e.text)));Ne.updateCues.call(e,i)})),e.embed.on("loaded",(()=>{if(e.embed.getPaused().then((t=>{ze.call(e,!t),t||ee.call(e,e.media,"playing")})),A.element(e.embed.element)&&e.supported.ui){e.embed.element.setAttribute("tabindex",-1)}})),e.embed.on("bufferstart",(()=>{ee.call(e,e.media,"waiting")})),e.embed.on("bufferend",(()=>{ee.call(e,e.media,"playing")})),e.embed.on("play",(()=>{ze.call(e,!0),ee.call(e,e.media,"playing")})),e.embed.on("pause",(()=>{ze.call(e,!1)})),e.embed.on("timeupdate",(t=>{e.media.seeking=!1,m=t.seconds,ee.call(e,e.media,"timeupdate")})),e.embed.on("progress",(t=>{e.media.buffered=t.percent,ee.call(e,e.media,"progress"),1===parseInt(t.percent,10)&&ee.call(e,e.media,"canplaythrough"),e.embed.getDuration().then((t=>{t!==e.media.duration&&(e.media.duration=t,ee.call(e,e.media,"durationchange"))}))})),e.embed.on("seeked",(()=>{e.media.seeking=!1,ee.call(e,e.media,"seeked")})),e.embed.on("ended",(()=>{e.media.paused=!0,ee.call(e,e.media,"ended")})),e.embed.on("error",(t=>{e.media.error=t,ee.call(e,e.media,"error")})),t.customControls&&setTimeout((()=>Ue.build.call(e)),0)}};function Ye(e){e&&!this.embed.hasPlayed&&(this.embed.hasPlayed=!0),this.media.paused===e&&(this.media.paused=!e,ee.call(this,this.media,e?"play":"pause"))}function Qe(e){return e.noCookie?"https://www.youtube-nocookie.com":"http:"===window.location.protocol?"http://www.youtube.com":void 0}const Xe={setup(){if(F(this.elements.wrapper,this.config.classNames.embed,!0),A.object(window.YT)&&A.function(window.YT.Player))Xe.ready.call(this);else{const e=window.onYouTubeIframeAPIReady;window.onYouTubeIframeAPIReady=()=>{A.function(e)&&e(),Xe.ready.call(this)},We(this.config.urls.youtube.sdk).catch((e=>{this.debug.warn("YouTube API failed to load",e)}))}},getTitle(e){ke(pe(this.config.urls.youtube.api,e)).then((e=>{if(A.object(e)){const{title:t,height:i,width:s}=e;this.config.title=t,Ue.setTitle.call(this),this.embed.ratio=de(s,i)}he.call(this)})).catch((()=>{he.call(this)}))},ready(){const e=this,t=e.config.youtube,i=e.media&&e.media.getAttribute("id");if(!A.empty(i)&&i.startsWith("youtube-"))return;let s=e.media.getAttribute("src");A.empty(s)&&(s=e.media.getAttribute(this.config.attributes.embed.id));const n=(a=s,A.empty(a)?null:a.match(/^.*(youtu.be\/|v\/|u\/\w\/|embed\/|watch\?v=|&v=)([^#&?]*).*/)?RegExp.$2:a);var a;const r=O("div",{id:`${e.provider}-${Math.floor(1e4*Math.random())}`,"data-poster":t.customControls?e.poster:void 0});if(e.media=D(r,e.media),t.customControls){const t=e=>`https://i.ytimg.com/vi/${n}/${e}default.jpg`;Fe(t("maxres"),121).catch((()=>Fe(t("sd"),121))).catch((()=>Fe(t("hq")))).then((t=>Ue.setPoster.call(e,t.src))).then((t=>{t.includes("maxres")||(e.elements.poster.style.backgroundSize="cover")})).catch((()=>{}))}e.embed=new window.YT.Player(e.media,{videoId:n,host:Qe(t),playerVars:N({},{autoplay:e.config.autoplay?1:0,hl:e.config.hl,controls:e.supported.ui&&t.customControls?0:1,disablekb:1,playsinline:e.config.playsinline&&!e.config.fullscreen.iosNative?1:0,cc_load_policy:e.captions.active?1:0,cc_lang_pref:e.config.captions.language,widget_referrer:window?window.location.href:null},t),events:{onError(t){if(!e.media.error){const i=t.data,s={2:"The request contains an invalid parameter value. For example, this error occurs if you specify a video ID that does not have 11 characters, or if the video ID contains invalid characters, such as exclamation points or asterisks.",5:"The requested content cannot be played in an HTML5 player or another error related to the HTML5 player has occurred.",100:"The video requested was not found. This error occurs when a video has been removed (for any reason) or has been marked as private.",101:"The owner of the requested video does not allow it to be played in embedded players.",150:"The owner of the requested video does not allow it to be played in embedded players."}[i]||"An unknown error occurred";e.media.error={code:i,message:s},ee.call(e,e.media,"error")}},onPlaybackRateChange(t){const i=t.target;e.media.playbackRate=i.getPlaybackRate(),ee.call(e,e.media,"ratechange")},onReady(i){if(A.function(e.media.play))return;const s=i.target;Xe.getTitle.call(e,n),e.media.play=()=>{Ye.call(e,!0),s.playVideo()},e.media.pause=()=>{Ye.call(e,!1),s.pauseVideo()},e.media.stop=()=>{s.stopVideo()},e.media.duration=s.getDuration(),e.media.paused=!0,e.media.currentTime=0,Object.defineProperty(e.media,"currentTime",{get:()=>Number(s.getCurrentTime()),set(t){e.paused&&!e.embed.hasPlayed&&e.embed.mute(),e.media.seeking=!0,ee.call(e,e.media,"seeking"),s.seekTo(t)}}),Object.defineProperty(e.media,"playbackRate",{get:()=>s.getPlaybackRate(),set(e){s.setPlaybackRate(e)}});let{volume:a}=e.config;Object.defineProperty(e.media,"volume",{get:()=>a,set(t){a=t,s.setVolume(100*a),ee.call(e,e.media,"volumechange")}});let{muted:r}=e.config;Object.defineProperty(e.media,"muted",{get:()=>r,set(t){const i=A.boolean(t)?t:r;r=i,s[i?"mute":"unMute"](),s.setVolume(100*a),ee.call(e,e.media,"volumechange")}}),Object.defineProperty(e.media,"currentSrc",{get:()=>s.getVideoUrl()}),Object.defineProperty(e.media,"ended",{get:()=>e.currentTime===e.duration});const o=s.getAvailablePlaybackRates();e.options.speed=o.filter((t=>e.config.speed.options.includes(t))),e.supported.ui&&t.customControls&&e.media.setAttribute("tabindex",-1),ee.call(e,e.media,"timeupdate"),ee.call(e,e.media,"durationchange"),clearInterval(e.timers.buffering),e.timers.buffering=setInterval((()=>{e.media.buffered=s.getVideoLoadedFraction(),(null===e.media.lastBuffered||e.media.lastBufferedUe.build.call(e)),50)},onStateChange(i){const s=i.target;clearInterval(e.timers.playing);switch(e.media.seeking&&[1,2].includes(i.data)&&(e.media.seeking=!1,ee.call(e,e.media,"seeked")),i.data){case-1:ee.call(e,e.media,"timeupdate"),e.media.buffered=s.getVideoLoadedFraction(),ee.call(e,e.media,"progress");break;case 0:Ye.call(e,!1),e.media.loop?(s.stopVideo(),s.playVideo()):ee.call(e,e.media,"ended");break;case 1:t.customControls&&!e.config.autoplay&&e.media.paused&&!e.embed.hasPlayed?e.media.pause():(Ye.call(e,!0),ee.call(e,e.media,"playing"),e.timers.playing=setInterval((()=>{ee.call(e,e.media,"timeupdate")}),50),e.media.duration!==s.getDuration()&&(e.media.duration=s.getDuration(),ee.call(e,e.media,"durationchange")));break;case 2:e.muted||e.embed.unMute(),Ye.call(e,!1);break;case 3:ee.call(e,e.media,"waiting")}ee.call(e,e.elements.container,"statechange",!1,{code:i.data})}}})}},Je={setup(){this.media?(F(this.elements.container,this.config.classNames.type.replace("{0}",this.type),!0),F(this.elements.container,this.config.classNames.provider.replace("{0}",this.provider),!0),this.isEmbed&&F(this.elements.container,this.config.classNames.type.replace("{0}","video"),!0),this.isVideo&&(this.elements.wrapper=O("div",{class:this.config.classNames.video}),_(this.media,this.elements.wrapper),this.elements.poster=O("div",{class:this.config.classNames.poster}),this.elements.wrapper.appendChild(this.elements.poster)),this.isHTML5?me.setup.call(this):this.isYouTube?Xe.setup.call(this):this.isVimeo&&Ke.setup.call(this)):this.debug.warn("No media element found!")}};class Ge{constructor(e){t(this,"load",(()=>{this.enabled&&(A.object(window.google)&&A.object(window.google.ima)?this.ready():We(this.player.config.urls.googleIMA.sdk).then((()=>{this.ready()})).catch((()=>{this.trigger("error",new Error("Google IMA SDK failed to load"))})))})),t(this,"ready",(()=>{var e;this.enabled||((e=this).manager&&e.manager.destroy(),e.elements.displayContainer&&e.elements.displayContainer.destroy(),e.elements.container.remove()),this.startSafetyTimer(12e3,"ready()"),this.managerPromise.then((()=>{this.clearSafetyTimer("onAdsManagerLoaded()")})),this.listeners(),this.setupIMA()})),t(this,"setupIMA",(()=>{this.elements.container=O("div",{class:this.player.config.classNames.ads}),this.player.elements.container.appendChild(this.elements.container),google.ima.settings.setVpaidMode(google.ima.ImaSdkSettings.VpaidMode.ENABLED),google.ima.settings.setLocale(this.player.config.ads.language),google.ima.settings.setDisableCustomPlaybackForIOS10Plus(this.player.config.playsinline),this.elements.displayContainer=new google.ima.AdDisplayContainer(this.elements.container,this.player.media),this.loader=new google.ima.AdsLoader(this.elements.displayContainer),this.loader.addEventListener(google.ima.AdsManagerLoadedEvent.Type.ADS_MANAGER_LOADED,(e=>this.onAdsManagerLoaded(e)),!1),this.loader.addEventListener(google.ima.AdErrorEvent.Type.AD_ERROR,(e=>this.onAdError(e)),!1),this.requestAds()})),t(this,"requestAds",(()=>{const{container:e}=this.player.elements;try{const t=new google.ima.AdsRequest;t.adTagUrl=this.tagUrl,t.linearAdSlotWidth=e.offsetWidth,t.linearAdSlotHeight=e.offsetHeight,t.nonLinearAdSlotWidth=e.offsetWidth,t.nonLinearAdSlotHeight=e.offsetHeight,t.forceNonLinearFullSlot=!1,t.setAdWillPlayMuted(!this.player.muted),this.loader.requestAds(t)}catch(e){this.onAdError(e)}})),t(this,"pollCountdown",((e=!1)=>{if(!e)return clearInterval(this.countdownTimer),void this.elements.container.removeAttribute("data-badge-text");this.countdownTimer=setInterval((()=>{const e=Pe(Math.max(this.manager.getRemainingTime(),0)),t=`${we.get("advertisement",this.player.config)} - ${e}`;this.elements.container.setAttribute("data-badge-text",t)}),100)})),t(this,"onAdsManagerLoaded",(e=>{if(!this.enabled)return;const t=new google.ima.AdsRenderingSettings;t.restoreCustomPlaybackStateOnAdBreakComplete=!0,t.enablePreloading=!0,this.manager=e.getAdsManager(this.player,t),this.cuePoints=this.manager.getCuePoints(),this.manager.addEventListener(google.ima.AdErrorEvent.Type.AD_ERROR,(e=>this.onAdError(e))),Object.keys(google.ima.AdEvent.Type).forEach((e=>{this.manager.addEventListener(google.ima.AdEvent.Type[e],(e=>this.onAdEvent(e)))})),this.trigger("loaded")})),t(this,"addCuePoints",(()=>{A.empty(this.cuePoints)||this.cuePoints.forEach((e=>{if(0!==e&&-1!==e&&e{const{container:t}=this.player.elements,i=e.getAd(),s=e.getAdData();switch((e=>{ee.call(this.player,this.player.media,`ads${e.replace(/_/g,"").toLowerCase()}`)})(e.type),e.type){case google.ima.AdEvent.Type.LOADED:this.trigger("loaded"),this.pollCountdown(!0),i.isLinear()||(i.width=t.offsetWidth,i.height=t.offsetHeight);break;case google.ima.AdEvent.Type.STARTED:this.manager.setVolume(this.player.volume);break;case google.ima.AdEvent.Type.ALL_ADS_COMPLETED:this.player.ended?this.loadAds():this.loader.contentComplete();break;case google.ima.AdEvent.Type.CONTENT_PAUSE_REQUESTED:this.pauseContent();break;case google.ima.AdEvent.Type.CONTENT_RESUME_REQUESTED:this.pollCountdown(),this.resumeContent();break;case google.ima.AdEvent.Type.LOG:s.adError&&this.player.debug.warn(`Non-fatal ad error: ${s.adError.getMessage()}`)}})),t(this,"onAdError",(e=>{this.cancel(),this.player.debug.warn("Ads error",e)})),t(this,"listeners",(()=>{const{container:e}=this.player.elements;let t;this.player.on("canplay",(()=>{this.addCuePoints()})),this.player.on("ended",(()=>{this.loader.contentComplete()})),this.player.on("timeupdate",(()=>{t=this.player.currentTime})),this.player.on("seeked",(()=>{const e=this.player.currentTime;A.empty(this.cuePoints)||this.cuePoints.forEach(((i,s)=>{t{this.manager&&this.manager.resize(e.offsetWidth,e.offsetHeight,google.ima.ViewMode.NORMAL)}))})),t(this,"play",(()=>{const{container:e}=this.player.elements;this.managerPromise||this.resumeContent(),this.managerPromise.then((()=>{this.manager.setVolume(this.player.volume),this.elements.displayContainer.initialize();try{this.initialized||(this.manager.init(e.offsetWidth,e.offsetHeight,google.ima.ViewMode.NORMAL),this.manager.start()),this.initialized=!0}catch(e){this.onAdError(e)}})).catch((()=>{}))})),t(this,"resumeContent",(()=>{this.elements.container.style.zIndex="",this.playing=!1,se(this.player.media.play())})),t(this,"pauseContent",(()=>{this.elements.container.style.zIndex=3,this.playing=!0,this.player.media.pause()})),t(this,"cancel",(()=>{this.initialized&&this.resumeContent(),this.trigger("error"),this.loadAds()})),t(this,"loadAds",(()=>{this.managerPromise.then((()=>{this.manager&&this.manager.destroy(),this.managerPromise=new Promise((e=>{this.on("loaded",e),this.player.debug.log(this.manager)})),this.initialized=!1,this.requestAds()})).catch((()=>{}))})),t(this,"trigger",((e,...t)=>{const i=this.events[e];A.array(i)&&i.forEach((e=>{A.function(e)&&e.apply(this,t)}))})),t(this,"on",((e,t)=>(A.array(this.events[e])||(this.events[e]=[]),this.events[e].push(t),this))),t(this,"startSafetyTimer",((e,t)=>{this.player.debug.log(`Safety timer invoked from: ${t}`),this.safetyTimer=setTimeout((()=>{this.cancel(),this.clearSafetyTimer("startSafetyTimer()")}),e)})),t(this,"clearSafetyTimer",(e=>{A.nullOrUndefined(this.safetyTimer)||(this.player.debug.log(`Safety timer cleared from: ${e}`),clearTimeout(this.safetyTimer),this.safetyTimer=null)})),this.player=e,this.config=e.config.ads,this.playing=!1,this.initialized=!1,this.elements={container:null,displayContainer:null},this.manager=null,this.loader=null,this.cuePoints=null,this.events={},this.safetyTimer=null,this.countdownTimer=null,this.managerPromise=new Promise(((e,t)=>{this.on("loaded",e),this.on("error",t)})),this.load()}get enabled(){const{config:e}=this;return this.player.isHTML5&&this.player.isVideo&&e.enabled&&(!A.empty(e.publisherId)||A.url(e.tagUrl))}get tagUrl(){const{config:e}=this;if(A.url(e.tagUrl))return e.tagUrl;return`https://go.aniview.com/api/adserver6/vast/?${Le({AV_PUBLISHERID:"58c25bb0073ef448b1087ad6",AV_CHANNELID:"5a0458dc28a06145e4519d21",AV_URL:window.location.hostname,cb:Date.now(),AV_WIDTH:640,AV_HEIGHT:480,AV_CDIM2:e.publisherId})}`}}function Ze(e=0,t=0,i=255){return Math.min(Math.max(e,t),i)}const et=e=>{const t=[];return e.split(/\r\n\r\n|\n\n|\r\r/).forEach((e=>{const i={};e.split(/\r\n|\n|\r/).forEach((e=>{if(A.number(i.startTime)){if(!A.empty(e.trim())&&A.empty(i.text)){const t=e.trim().split("#xywh=");[i.text]=t,t[1]&&([i.x,i.y,i.w,i.h]=t[1].split(","))}}else{const t=e.match(/([0-9]{2})?:?([0-9]{2}):([0-9]{2}).([0-9]{2,3})( ?--> ?)([0-9]{2})?:?([0-9]{2}):([0-9]{2}).([0-9]{2,3})/);t&&(i.startTime=60*Number(t[1]||0)*60+60*Number(t[2])+Number(t[3])+Number(`0.${t[4]}`),i.endTime=60*Number(t[6]||0)*60+60*Number(t[7])+Number(t[8])+Number(`0.${t[9]}`))}})),i.text&&t.push(i)})),t},tt=(e,t)=>{const i={};return e>t.width/t.height?(i.width=t.width,i.height=1/e*t.width):(i.height=t.height,i.width=e*t.height),i};class it{constructor(e){t(this,"load",(()=>{this.player.elements.display.seekTooltip&&(this.player.elements.display.seekTooltip.hidden=this.enabled),this.enabled&&this.getThumbnails().then((()=>{this.enabled&&(this.render(),this.determineContainerAutoSizing(),this.listeners(),this.loaded=!0)}))})),t(this,"getThumbnails",(()=>new Promise((e=>{const{src:t}=this.player.config.previewThumbnails;if(A.empty(t))throw new Error("Missing previewThumbnails.src config attribute");const i=()=>{this.thumbnails.sort(((e,t)=>e.height-t.height)),this.player.debug.log("Preview thumbnails",this.thumbnails),e()};if(A.function(t))t((e=>{this.thumbnails=e,i()}));else{const e=(A.string(t)?[t]:t).map((e=>this.getThumbnail(e)));Promise.all(e).then(i)}})))),t(this,"getThumbnail",(e=>new Promise((t=>{ke(e).then((i=>{const s={frames:et(i),height:null,urlPrefix:""};s.frames[0].text.startsWith("/")||s.frames[0].text.startsWith("http://")||s.frames[0].text.startsWith("https://")||(s.urlPrefix=e.substring(0,e.lastIndexOf("/")+1));const n=new Image;n.onload=()=>{s.height=n.naturalHeight,s.width=n.naturalWidth,this.thumbnails.push(s),t()},n.src=s.urlPrefix+s.frames[0].text}))})))),t(this,"startMove",(e=>{if(this.loaded&&A.event(e)&&["touchmove","mousemove"].includes(e.type)&&this.player.media.duration){if("touchmove"===e.type)this.seekTime=this.player.media.duration*(this.player.elements.inputs.seek.value/100);else{var t,i;const s=this.player.elements.progress.getBoundingClientRect(),n=100/s.width*(e.pageX-s.left);this.seekTime=this.player.media.duration*(n/100),this.seekTime<0&&(this.seekTime=0),this.seekTime>this.player.media.duration-1&&(this.seekTime=this.player.media.duration-1),this.mousePosX=e.pageX,this.elements.thumb.time.innerText=Pe(this.seekTime);const a=null===(t=this.player.config.markers)||void 0===t||null===(i=t.points)||void 0===i?void 0:i.find((({time:e})=>e===Math.round(this.seekTime)));a&&this.elements.thumb.time.insertAdjacentHTML("afterbegin",`${a.label}
    `)}this.showImageAtCurrentTime()}})),t(this,"endMove",(()=>{this.toggleThumbContainer(!1,!0)})),t(this,"startScrubbing",(e=>{(A.nullOrUndefined(e.button)||!1===e.button||0===e.button)&&(this.mouseDown=!0,this.player.media.duration&&(this.toggleScrubbingContainer(!0),this.toggleThumbContainer(!1,!0),this.showImageAtCurrentTime()))})),t(this,"endScrubbing",(()=>{this.mouseDown=!1,Math.ceil(this.lastTime)===Math.ceil(this.player.media.currentTime)?this.toggleScrubbingContainer(!1):Z.call(this.player,this.player.media,"timeupdate",(()=>{this.mouseDown||this.toggleScrubbingContainer(!1)}))})),t(this,"listeners",(()=>{this.player.on("play",(()=>{this.toggleThumbContainer(!1,!0)})),this.player.on("seeked",(()=>{this.toggleThumbContainer(!1)})),this.player.on("timeupdate",(()=>{this.lastTime=this.player.media.currentTime}))})),t(this,"render",(()=>{this.elements.thumb.container=O("div",{class:this.player.config.classNames.previewThumbnails.thumbContainer}),this.elements.thumb.imageContainer=O("div",{class:this.player.config.classNames.previewThumbnails.imageContainer}),this.elements.thumb.container.appendChild(this.elements.thumb.imageContainer);const e=O("div",{class:this.player.config.classNames.previewThumbnails.timeContainer});this.elements.thumb.time=O("span",{},"00:00"),e.appendChild(this.elements.thumb.time),this.elements.thumb.imageContainer.appendChild(e),A.element(this.player.elements.progress)&&this.player.elements.progress.appendChild(this.elements.thumb.container),this.elements.scrubbing.container=O("div",{class:this.player.config.classNames.previewThumbnails.scrubbingContainer}),this.player.elements.wrapper.appendChild(this.elements.scrubbing.container)})),t(this,"destroy",(()=>{this.elements.thumb.container&&this.elements.thumb.container.remove(),this.elements.scrubbing.container&&this.elements.scrubbing.container.remove()})),t(this,"showImageAtCurrentTime",(()=>{this.mouseDown?this.setScrubbingContainerSize():this.setThumbContainerSizeAndPos();const e=this.thumbnails[0].frames.findIndex((e=>this.seekTime>=e.startTime&&this.seekTime<=e.endTime)),t=e>=0;let i=0;this.mouseDown||this.toggleThumbContainer(t),t&&(this.thumbnails.forEach(((t,s)=>{this.loadedImages.includes(t.frames[e].text)&&(i=s)})),e!==this.showingThumb&&(this.showingThumb=e,this.loadImage(i)))})),t(this,"loadImage",((e=0)=>{const t=this.showingThumb,i=this.thumbnails[e],{urlPrefix:s}=i,n=i.frames[t],a=i.frames[t].text,r=s+a;if(this.currentImageElement&&this.currentImageElement.dataset.filename===a)this.showImage(this.currentImageElement,n,e,t,a,!1),this.currentImageElement.dataset.index=t,this.removeOldImages(this.currentImageElement);else{this.loadingImage&&this.usingSprites&&(this.loadingImage.onload=null);const i=new Image;i.src=r,i.dataset.index=t,i.dataset.filename=a,this.showingThumbFilename=a,this.player.debug.log(`Loading image: ${r}`),i.onload=()=>this.showImage(i,n,e,t,a,!0),this.loadingImage=i,this.removeOldImages(i)}})),t(this,"showImage",((e,t,i,s,n,a=!0)=>{this.player.debug.log(`Showing thumb: ${n}. num: ${s}. qual: ${i}. newimg: ${a}`),this.setImageSizeAndOffset(e,t),a&&(this.currentImageContainer.appendChild(e),this.currentImageElement=e,this.loadedImages.includes(n)||this.loadedImages.push(n)),this.preloadNearby(s,!0).then(this.preloadNearby(s,!1)).then(this.getHigherQuality(i,e,t,n))})),t(this,"removeOldImages",(e=>{Array.from(this.currentImageContainer.children).forEach((t=>{if("img"!==t.tagName.toLowerCase())return;const i=this.usingSprites?500:1e3;if(t.dataset.index!==e.dataset.index&&!t.dataset.deleting){t.dataset.deleting=!0;const{currentImageContainer:e}=this;setTimeout((()=>{e.removeChild(t),this.player.debug.log(`Removing thumb: ${t.dataset.filename}`)}),i)}}))})),t(this,"preloadNearby",((e,t=!0)=>new Promise((i=>{setTimeout((()=>{const s=this.thumbnails[0].frames[e].text;if(this.showingThumbFilename===s){let n;n=t?this.thumbnails[0].frames.slice(e):this.thumbnails[0].frames.slice(0,e).reverse();let a=!1;n.forEach((e=>{const t=e.text;if(t!==s&&!this.loadedImages.includes(t)){a=!0,this.player.debug.log(`Preloading thumb filename: ${t}`);const{urlPrefix:e}=this.thumbnails[0],s=e+t,n=new Image;n.src=s,n.onload=()=>{this.player.debug.log(`Preloaded thumb filename: ${t}`),this.loadedImages.includes(t)||this.loadedImages.push(t),i()}}})),a||i()}}),300)})))),t(this,"getHigherQuality",((e,t,i,s)=>{if(e{this.showingThumbFilename===s&&(this.player.debug.log(`Showing higher quality thumb for: ${s}`),this.loadImage(e+1))}),300)}})),t(this,"toggleThumbContainer",((e=!1,t=!1)=>{const i=this.player.config.classNames.previewThumbnails.thumbContainerShown;this.elements.thumb.container.classList.toggle(i,e),!e&&t&&(this.showingThumb=null,this.showingThumbFilename=null)})),t(this,"toggleScrubbingContainer",((e=!1)=>{const t=this.player.config.classNames.previewThumbnails.scrubbingContainerShown;this.elements.scrubbing.container.classList.toggle(t,e),e||(this.showingThumb=null,this.showingThumbFilename=null)})),t(this,"determineContainerAutoSizing",(()=>{(this.elements.thumb.imageContainer.clientHeight>20||this.elements.thumb.imageContainer.clientWidth>20)&&(this.sizeSpecifiedInCSS=!0)})),t(this,"setThumbContainerSizeAndPos",(()=>{const{imageContainer:e}=this.elements.thumb;if(this.sizeSpecifiedInCSS){if(e.clientHeight>20&&e.clientWidth<20){const t=Math.floor(e.clientHeight*this.thumbAspectRatio);e.style.width=`${t}px`}else if(e.clientHeight<20&&e.clientWidth>20){const t=Math.floor(e.clientWidth/this.thumbAspectRatio);e.style.height=`${t}px`}}else{const t=Math.floor(this.thumbContainerHeight*this.thumbAspectRatio);e.style.height=`${this.thumbContainerHeight}px`,e.style.width=`${t}px`}this.setThumbContainerPos()})),t(this,"setThumbContainerPos",(()=>{const e=this.player.elements.progress.getBoundingClientRect(),t=this.player.elements.container.getBoundingClientRect(),{container:i}=this.elements.thumb,s=t.left-e.left+10,n=t.right-e.left-i.clientWidth-10,a=this.mousePosX-e.left-i.clientWidth/2,r=Ze(a,s,n);i.style.left=`${r}px`,i.style.setProperty("--preview-arrow-offset",a-r+"px")})),t(this,"setScrubbingContainerSize",(()=>{const{width:e,height:t}=tt(this.thumbAspectRatio,{width:this.player.media.clientWidth,height:this.player.media.clientHeight});this.elements.scrubbing.container.style.width=`${e}px`,this.elements.scrubbing.container.style.height=`${t}px`})),t(this,"setImageSizeAndOffset",((e,t)=>{if(!this.usingSprites)return;const i=this.thumbContainerHeight/t.h;e.style.height=e.naturalHeight*i+"px",e.style.width=e.naturalWidth*i+"px",e.style.left=`-${t.x*i}px`,e.style.top=`-${t.y*i}px`})),this.player=e,this.thumbnails=[],this.loaded=!1,this.lastMouseMoveTime=Date.now(),this.mouseDown=!1,this.loadedImages=[],this.elements={thumb:{},scrubbing:{}},this.load()}get enabled(){return this.player.isHTML5&&this.player.isVideo&&this.player.config.previewThumbnails.enabled}get currentImageContainer(){return this.mouseDown?this.elements.scrubbing.container:this.elements.thumb.imageContainer}get usingSprites(){return Object.keys(this.thumbnails[0].frames[0]).includes("w")}get thumbAspectRatio(){return this.usingSprites?this.thumbnails[0].frames[0].w/this.thumbnails[0].frames[0].h:this.thumbnails[0].width/this.thumbnails[0].height}get thumbContainerHeight(){if(this.mouseDown){const{height:e}=tt(this.thumbAspectRatio,{width:this.player.media.clientWidth,height:this.player.media.clientHeight});return e}return this.sizeSpecifiedInCSS?this.elements.thumb.imageContainer.clientHeight:Math.floor(this.player.media.clientWidth/this.thumbAspectRatio/4)}get currentImageElement(){return this.mouseDown?this.currentScrubbingImageElement:this.currentThumbnailImageElement}set currentImageElement(e){this.mouseDown?this.currentScrubbingImageElement=e:this.currentThumbnailImageElement=e}}const st={insertElements(e,t){A.string(t)?$(e,this.media,{src:t}):A.array(t)&&t.forEach((t=>{$(e,this.media,t)}))},change(e){L(e,"sources.length")?(me.cancelRequests.call(this),this.destroy.call(this,(()=>{this.options.quality=[],j(this.media),this.media=null,A.element(this.elements.container)&&this.elements.container.removeAttribute("class");const{sources:t,type:i}=e,[{provider:s=$e.html5,src:n}]=t,a="html5"===s?i:"div",r="html5"===s?{}:{src:n};Object.assign(this,{provider:s,type:i,supported:Y.check(i,s,this.config.playsinline),media:O(a,r)}),this.elements.container.appendChild(this.media),A.boolean(e.autoplay)&&(this.config.autoplay=e.autoplay),this.isHTML5&&(this.config.crossorigin&&this.media.setAttribute("crossorigin",""),this.config.autoplay&&this.media.setAttribute("autoplay",""),A.empty(e.poster)||(this.poster=e.poster),this.config.loop.active&&this.media.setAttribute("loop",""),this.config.muted&&this.media.setAttribute("muted",""),this.config.playsinline&&this.media.setAttribute("playsinline","")),Ue.addStyleHook.call(this),this.isHTML5&&st.insertElements.call(this,"source",t),this.config.title=e.title,Je.setup.call(this),this.isHTML5&&Object.keys(e).includes("tracks")&&st.insertElements.call(this,"track",e.tracks),(this.isHTML5||this.isEmbed&&!this.supported.ui)&&Ue.build.call(this),this.isHTML5&&this.media.load(),A.empty(e.previewThumbnails)||(Object.assign(this.config.previewThumbnails,e.previewThumbnails),this.previewThumbnails&&this.previewThumbnails.loaded&&(this.previewThumbnails.destroy(),this.previewThumbnails=null),this.config.previewThumbnails.enabled&&(this.previewThumbnails=new it(this))),this.fullscreen.update()}),!0)):this.debug.warn("Invalid source format")}};class nt{constructor(e,i){if(t(this,"play",(()=>A.function(this.media.play)?(this.ads&&this.ads.enabled&&this.ads.managerPromise.then((()=>this.ads.play())).catch((()=>se(this.media.play()))),this.media.play()):null)),t(this,"pause",(()=>this.playing&&A.function(this.media.pause)?this.media.pause():null)),t(this,"togglePlay",(e=>(A.boolean(e)?e:!this.playing)?this.play():this.pause())),t(this,"stop",(()=>{this.isHTML5?(this.pause(),this.restart()):A.function(this.media.stop)&&this.media.stop()})),t(this,"restart",(()=>{this.currentTime=0})),t(this,"rewind",(e=>{this.currentTime-=A.number(e)?e:this.config.seekTime})),t(this,"forward",(e=>{this.currentTime+=A.number(e)?e:this.config.seekTime})),t(this,"increaseVolume",(e=>{const t=this.media.muted?0:this.volume;this.volume=t+(A.number(e)?e:0)})),t(this,"decreaseVolume",(e=>{this.increaseVolume(-e)})),t(this,"airplay",(()=>{Y.airplay&&this.media.webkitShowPlaybackTargetPicker()})),t(this,"toggleControls",(e=>{if(this.supported.ui&&!this.isAudio){const t=U(this.elements.container,this.config.classNames.hideControls),i=void 0===e?void 0:!e,s=F(this.elements.container,this.config.classNames.hideControls,i);if(s&&A.array(this.config.controls)&&this.config.controls.includes("settings")&&!A.empty(this.config.settings)&&Me.toggleMenu.call(this,!1),s!==t){const e=s?"controlshidden":"controlsshown";ee.call(this,this.media,e)}return!s}return!1})),t(this,"on",((e,t)=>{J.call(this,this.elements.container,e,t)})),t(this,"once",((e,t)=>{Z.call(this,this.elements.container,e,t)})),t(this,"off",((e,t)=>{G(this.elements.container,e,t)})),t(this,"destroy",((e,t=!1)=>{if(!this.ready)return;const i=()=>{document.body.style.overflow="",this.embed=null,t?(Object.keys(this.elements).length&&(j(this.elements.buttons.play),j(this.elements.captions),j(this.elements.controls),j(this.elements.wrapper),this.elements.buttons.play=null,this.elements.captions=null,this.elements.controls=null,this.elements.wrapper=null),A.function(e)&&e()):(te.call(this),me.cancelRequests.call(this),D(this.elements.original,this.elements.container),ee.call(this,this.elements.original,"destroyed",!0),A.function(e)&&e.call(this.elements.original),this.ready=!1,setTimeout((()=>{this.elements=null,this.media=null}),200))};this.stop(),clearTimeout(this.timers.loading),clearTimeout(this.timers.controls),clearTimeout(this.timers.resized),this.isHTML5?(Ue.toggleNativeControls.call(this,!0),i()):this.isYouTube?(clearInterval(this.timers.buffering),clearInterval(this.timers.playing),null!==this.embed&&A.function(this.embed.destroy)&&this.embed.destroy(),i()):this.isVimeo&&(null!==this.embed&&this.embed.unload().then(i),setTimeout(i,200))})),t(this,"supports",(e=>Y.mime.call(this,e))),this.timers={},this.ready=!1,this.loading=!1,this.failed=!1,this.touch=Y.touch,this.media=e,A.string(this.media)&&(this.media=document.querySelectorAll(this.media)),(window.jQuery&&this.media instanceof jQuery||A.nodeList(this.media)||A.array(this.media))&&(this.media=this.media[0]),this.config=N({},_e,nt.defaults,i||{},(()=>{try{return JSON.parse(this.media.getAttribute("data-plyr-config"))}catch(e){return{}}})()),this.elements={container:null,fullscreen:null,captions:null,buttons:{},display:{},progress:{},inputs:{},settings:{popup:null,menu:null,panels:{},buttons:{}}},this.captions={active:null,currentTrack:-1,meta:new WeakMap},this.fullscreen={active:!1},this.options={speed:[],quality:[]},this.debug=new qe(this.config.debug),this.debug.log("Config",this.config),this.debug.log("Support",Y),A.nullOrUndefined(this.media)||!A.element(this.media))return void this.debug.error("Setup failed: no suitable element passed");if(this.media.plyr)return void this.debug.warn("Target already setup");if(!this.config.enabled)return void this.debug.error("Setup failed: disabled by config");if(!Y.check().api)return void this.debug.error("Setup failed: no support");const s=this.media.cloneNode(!0);s.autoplay=!1,this.elements.original=s;const n=this.media.tagName.toLowerCase();let a=null,r=null;switch(n){case"div":if(a=this.media.querySelector("iframe"),A.element(a)){if(r=xe(a.getAttribute("src")),this.provider=function(e){return/^(https?:\/\/)?(www\.)?(youtube\.com|youtube-nocookie\.com|youtu\.?be)\/.+$/.test(e)?$e.youtube:/^https?:\/\/player.vimeo.com\/video\/\d{0,9}(?=\b|\/)/.test(e)?$e.vimeo:null}(r.toString()),this.elements.container=this.media,this.media=a,this.elements.container.className="",r.search.length){const e=["1","true"];e.includes(r.searchParams.get("autoplay"))&&(this.config.autoplay=!0),e.includes(r.searchParams.get("loop"))&&(this.config.loop.active=!0),this.isYouTube?(this.config.playsinline=e.includes(r.searchParams.get("playsinline")),this.config.youtube.hl=r.searchParams.get("hl")):this.config.playsinline=!0}}else this.provider=this.media.getAttribute(this.config.attributes.embed.provider),this.media.removeAttribute(this.config.attributes.embed.provider);if(A.empty(this.provider)||!Object.values($e).includes(this.provider))return void this.debug.error("Setup failed: Invalid provider");this.type=Re;break;case"video":case"audio":this.type=n,this.provider=$e.html5,this.media.hasAttribute("crossorigin")&&(this.config.crossorigin=!0),this.media.hasAttribute("autoplay")&&(this.config.autoplay=!0),(this.media.hasAttribute("playsinline")||this.media.hasAttribute("webkit-playsinline"))&&(this.config.playsinline=!0),this.media.hasAttribute("muted")&&(this.config.muted=!0),this.media.hasAttribute("loop")&&(this.config.loop.active=!0);break;default:return void this.debug.error("Setup failed: unsupported type")}this.supported=Y.check(this.type,this.provider),this.supported.api?(this.eventListeners=[],this.listeners=new Ve(this),this.storage=new Te(this),this.media.plyr=this,A.element(this.elements.container)||(this.elements.container=O("div"),_(this.media,this.elements.container)),Ue.migrateStyles.call(this),Ue.addStyleHook.call(this),Je.setup.call(this),this.config.debug&&J.call(this,this.elements.container,this.config.events.join(" "),(e=>{this.debug.log(`event: ${e.type}`)})),this.fullscreen=new He(this),(this.isHTML5||this.isEmbed&&!this.supported.ui)&&Ue.build.call(this),this.listeners.container(),this.listeners.global(),this.config.ads.enabled&&(this.ads=new Ge(this)),this.isHTML5&&this.config.autoplay&&this.once("canplay",(()=>se(this.play()))),this.lastSeekTime=0,this.config.previewThumbnails.enabled&&(this.previewThumbnails=new it(this))):this.debug.error("Setup failed: no support")}get isHTML5(){return this.provider===$e.html5}get isEmbed(){return this.isYouTube||this.isVimeo}get isYouTube(){return this.provider===$e.youtube}get isVimeo(){return this.provider===$e.vimeo}get isVideo(){return this.type===Re}get isAudio(){return this.type===je}get playing(){return Boolean(this.ready&&!this.paused&&!this.ended)}get paused(){return Boolean(this.media.paused)}get stopped(){return Boolean(this.paused&&0===this.currentTime)}get ended(){return Boolean(this.media.ended)}set currentTime(e){if(!this.duration)return;const t=A.number(e)&&e>0;this.media.currentTime=t?Math.min(e,this.duration):0,this.debug.log(`Seeking to ${this.currentTime} seconds`)}get currentTime(){return Number(this.media.currentTime)}get buffered(){const{buffered:e}=this.media;return A.number(e)?e:e&&e.length&&this.duration>0?e.end(0)/this.duration:0}get seeking(){return Boolean(this.media.seeking)}get duration(){const e=parseFloat(this.config.duration),t=(this.media||{}).duration,i=A.number(t)&&t!==1/0?t:0;return e||i}set volume(e){let t=e;A.string(t)&&(t=Number(t)),A.number(t)||(t=this.storage.get("volume")),A.number(t)||({volume:t}=this.config),t>1&&(t=1),t<0&&(t=0),this.config.volume=t,this.media.volume=t,!A.empty(e)&&this.muted&&t>0&&(this.muted=!1)}get volume(){return Number(this.media.volume)}set muted(e){let t=e;A.boolean(t)||(t=this.storage.get("muted")),A.boolean(t)||(t=this.config.muted),this.config.muted=t,this.media.muted=t}get muted(){return Boolean(this.media.muted)}get hasAudio(){return!this.isHTML5||(!!this.isAudio||(Boolean(this.media.mozHasAudio)||Boolean(this.media.webkitAudioDecodedByteCount)||Boolean(this.media.audioTracks&&this.media.audioTracks.length)))}set speed(e){let t=null;A.number(e)&&(t=e),A.number(t)||(t=this.storage.get("speed")),A.number(t)||(t=this.config.speed.selected);const{minimumSpeed:i,maximumSpeed:s}=this;t=Ze(t,i,s),this.config.speed.selected=t,setTimeout((()=>{this.media&&(this.media.playbackRate=t)}),0)}get speed(){return Number(this.media.playbackRate)}get minimumSpeed(){return this.isYouTube?Math.min(...this.options.speed):this.isVimeo?.5:.0625}get maximumSpeed(){return this.isYouTube?Math.max(...this.options.speed):this.isVimeo?2:16}set quality(e){const t=this.config.quality,i=this.options.quality;if(!i.length)return;let s=[!A.empty(e)&&Number(e),this.storage.get("quality"),t.selected,t.default].find(A.number),n=!0;if(!i.includes(s)){const e=ae(i,s);this.debug.warn(`Unsupported quality option: ${s}, using ${e} instead`),s=e,n=!1}t.selected=s,this.media.quality=s,n&&this.storage.set({quality:s})}get quality(){return this.media.quality}set loop(e){const t=A.boolean(e)?e:this.config.loop.active;this.config.loop.active=t,this.media.loop=t}get loop(){return Boolean(this.media.loop)}set source(e){st.change.call(this,e)}get source(){return this.media.currentSrc}get download(){const{download:e}=this.config.urls;return A.url(e)?e:this.source}set download(e){A.url(e)&&(this.config.urls.download=e,Me.setDownloadUrl.call(this))}set poster(e){this.isVideo?Ue.setPoster.call(this,e,!1).catch((()=>{})):this.debug.warn("Poster can only be set for video")}get poster(){return this.isVideo?this.media.getAttribute("poster")||this.media.getAttribute("data-poster"):null}get ratio(){if(!this.isVideo)return null;const e=ce(ue.call(this));return A.array(e)?e.join(":"):e}set ratio(e){this.isVideo?A.string(e)&&le(e)?(this.config.ratio=ce(e),he.call(this)):this.debug.error(`Invalid aspect ratio specified (${e})`):this.debug.warn("Aspect ratio can only be set for video")}set autoplay(e){this.config.autoplay=A.boolean(e)?e:this.config.autoplay}get autoplay(){return Boolean(this.config.autoplay)}toggleCaptions(e){Ne.toggle.call(this,e,!1)}set currentTrack(e){Ne.set.call(this,e,!1),Ne.setup.call(this)}get currentTrack(){const{toggled:e,currentTrack:t}=this.captions;return e?t:-1}set language(e){Ne.setLanguage.call(this,e,!1)}get language(){return(Ne.getCurrentTrack.call(this)||{}).language}set pip(e){if(!Y.pip)return;const t=A.boolean(e)?e:!this.pip;A.function(this.media.webkitSetPresentationMode)&&this.media.webkitSetPresentationMode(t?Ie:Oe),A.function(this.media.requestPictureInPicture)&&(!this.pip&&t?this.media.requestPictureInPicture():this.pip&&!t&&document.exitPictureInPicture())}get pip(){return Y.pip?A.empty(this.media.webkitPresentationMode)?this.media===document.pictureInPictureElement:this.media.webkitPresentationMode===Ie:null}setPreviewThumbnails(e){this.previewThumbnails&&this.previewThumbnails.loaded&&(this.previewThumbnails.destroy(),this.previewThumbnails=null),Object.assign(this.config.previewThumbnails,e),this.config.previewThumbnails.enabled&&(this.previewThumbnails=new it(this))}static supported(e,t){return Y.check(e,t)}static loadSprite(e,t){return Ee(e,t)}static setup(e,t={}){let i=null;return A.string(e)?i=Array.from(document.querySelectorAll(e)):A.nodeList(e)?i=Array.from(e):A.array(e)&&(i=e.filter(A.element)),A.empty(i)?null:i.map((e=>new nt(e,t)))}}var at;return nt.defaults=(at=_e,JSON.parse(JSON.stringify(at))),nt})); ; !function(a){"use strict";if("function"==typeof define&&define.amd)define(["jquery","moment"],a);else if("object"==typeof exports)module.exports=a(require("jquery"),require("moment"));else{if("undefined"==typeof jQuery)throw"bootstrap-datetimepicker requires jQuery to be loaded first";if("undefined"==typeof moment)throw"bootstrap-datetimepicker requires Moment.js to be loaded first";a(jQuery,moment)}}(function(a,b){"use strict";if(!b)throw new Error("bootstrap-datetimepicker requires Moment.js to be loaded first");var c=function(c,d){var e,f,g,h,i,j,k,l={},m=!0,n=!1,o=!1,p=0,q=[{clsName:"days",navFnc:"M",navStep:1},{clsName:"months",navFnc:"y",navStep:1},{clsName:"years",navFnc:"y",navStep:10},{clsName:"decades",navFnc:"y",navStep:100}],r=["days","months","years","decades"],s=["top","bottom","auto"],t=["left","right","auto"],u=["default","top","bottom"],v={up:38,38:"up",down:40,40:"down",left:37,37:"left",right:39,39:"right",tab:9,9:"tab",escape:27,27:"escape",enter:13,13:"enter",pageUp:33,33:"pageUp",pageDown:34,34:"pageDown",shift:16,16:"shift",control:17,17:"control",space:32,32:"space",t:84,84:"t",delete:46,46:"delete"},w={},x=function(){return void 0!==b.tz&&void 0!==d.timeZone&&null!==d.timeZone&&""!==d.timeZone},y=function(a){var c;return c=void 0===a||null===a?b():b.isDate(a)||b.isMoment(a)?b(a):x()?b.tz(a,j,d.useStrict,d.timeZone):b(a,j,d.useStrict),x()&&c.tz(d.timeZone),c},z=function(a){if("string"!=typeof a||a.length>1)throw new TypeError("isEnabled expects a single character string parameter");switch(a){case"y":return i.indexOf("Y")!==-1;case"M":return i.indexOf("M")!==-1;case"d":return i.toLowerCase().indexOf("d")!==-1;case"h":case"H":return i.toLowerCase().indexOf("h")!==-1;case"m":return i.indexOf("m")!==-1;case"s":return i.indexOf("s")!==-1;default:return!1}},A=function(){return z("h")||z("m")||z("s")},B=function(){return z("y")||z("M")||z("d")},C=function(){var b=a("").append(a("").append(a("").addClass("prev").attr("data-action","previous").append(a("").addClass(d.icons.previous))).append(a("").addClass("picker-switch").attr("data-action","pickerSwitch").attr("colspan",d.calendarWeeks?"6":"5")).append(a("").addClass("next").attr("data-action","next").append(a("").addClass(d.icons.next)))),c=a("").append(a("").append(a("").attr("colspan",d.calendarWeeks?"8":"7")));return[a("
    ").addClass("datepicker-days").append(a("").addClass("table-condensed").append(b).append(a(""))),a("
    ").addClass("datepicker-months").append(a("
    ").addClass("table-condensed").append(b.clone()).append(c.clone())),a("
    ").addClass("datepicker-years").append(a("
    ").addClass("table-condensed").append(b.clone()).append(c.clone())),a("
    ").addClass("datepicker-decades").append(a("
    ").addClass("table-condensed").append(b.clone()).append(c.clone()))]},D=function(){var b=a(""),c=a(""),e=a("");return z("h")&&(b.append(a("
    ").append(a("").attr({href:"#",tabindex:"-1",title:d.tooltips.incrementHour}).addClass("btn").attr("data-action","incrementHours").append(a("").addClass(d.icons.up)))),c.append(a("").append(a("").addClass("timepicker-hour").attr({"data-time-component":"hours",title:d.tooltips.pickHour}).attr("data-action","showHours"))),e.append(a("").append(a("").attr({href:"#",tabindex:"-1",title:d.tooltips.decrementHour}).addClass("btn").attr("data-action","decrementHours").append(a("").addClass(d.icons.down))))),z("m")&&(z("h")&&(b.append(a("").addClass("separator")),c.append(a("").addClass("separator").html(":")),e.append(a("").addClass("separator"))),b.append(a("").append(a("").attr({href:"#",tabindex:"-1",title:d.tooltips.incrementMinute}).addClass("btn").attr("data-action","incrementMinutes").append(a("").addClass(d.icons.up)))),c.append(a("").append(a("").addClass("timepicker-minute").attr({"data-time-component":"minutes",title:d.tooltips.pickMinute}).attr("data-action","showMinutes"))),e.append(a("").append(a("").attr({href:"#",tabindex:"-1",title:d.tooltips.decrementMinute}).addClass("btn").attr("data-action","decrementMinutes").append(a("").addClass(d.icons.down))))),z("s")&&(z("m")&&(b.append(a("").addClass("separator")),c.append(a("").addClass("separator").html(":")),e.append(a("").addClass("separator"))),b.append(a("").append(a("").attr({href:"#",tabindex:"-1",title:d.tooltips.incrementSecond}).addClass("btn").attr("data-action","incrementSeconds").append(a("").addClass(d.icons.up)))),c.append(a("").append(a("").addClass("timepicker-second").attr({"data-time-component":"seconds",title:d.tooltips.pickSecond}).attr("data-action","showSeconds"))),e.append(a("").append(a("").attr({href:"#",tabindex:"-1",title:d.tooltips.decrementSecond}).addClass("btn").attr("data-action","decrementSeconds").append(a("").addClass(d.icons.down))))),h||(b.append(a("").addClass("separator")),c.append(a("").append(a("").addClass("separator"))),a("
    ").addClass("timepicker-picker").append(a("").addClass("table-condensed").append([b,c,e]))},E=function(){var b=a("
    ").addClass("timepicker-hours").append(a("
    ").addClass("table-condensed")),c=a("
    ").addClass("timepicker-minutes").append(a("
    ").addClass("table-condensed")),d=a("
    ").addClass("timepicker-seconds").append(a("
    ").addClass("table-condensed")),e=[D()];return z("h")&&e.push(b),z("m")&&e.push(c),z("s")&&e.push(d),e},F=function(){var b=[];return d.showTodayButton&&b.push(a("
    ").append(a("").attr({"data-action":"today",title:d.tooltips.today}).append(a("").addClass(d.icons.today)))),!d.sideBySide&&B()&&A()&&b.push(a("").append(a("").attr({"data-action":"togglePicker",title:d.tooltips.selectTime}).append(a("").addClass(d.icons.time)))),d.showClear&&b.push(a("").append(a("").attr({"data-action":"clear",title:d.tooltips.clear}).append(a("").addClass(d.icons.clear)))),d.showClose&&b.push(a("").append(a("").attr({"data-action":"close",title:d.tooltips.close}).append(a("").addClass(d.icons.close)))),a("").addClass("table-condensed").append(a("").append(a("").append(b)))},G=function(){var b=a("
    ").addClass("bootstrap-datetimepicker-widget dropdown-menu"),c=a("
    ").addClass("datepicker").append(C()),e=a("
    ").addClass("timepicker").append(E()),f=a("
      ").addClass("list-unstyled"),g=a("
    • ").addClass("picker-switch"+(d.collapse?" accordion-toggle":"")).append(F());return d.inline&&b.removeClass("dropdown-menu"),h&&b.addClass("usetwentyfour"),z("s")&&!h&&b.addClass("wider"),d.sideBySide&&B()&&A()?(b.addClass("timepicker-sbs"),"top"===d.toolbarPlacement&&b.append(g),b.append(a("
      ").addClass("row").append(c.addClass("col-md-6")).append(e.addClass("col-md-6"))),"bottom"===d.toolbarPlacement&&b.append(g),b):("top"===d.toolbarPlacement&&f.append(g),B()&&f.append(a("
    • ").addClass(d.collapse&&A()?"collapse in":"").append(c)),"default"===d.toolbarPlacement&&f.append(g),A()&&f.append(a("
    • ").addClass(d.collapse&&B()?"collapse":"").append(e)),"bottom"===d.toolbarPlacement&&f.append(g),b.append(f))},H=function(){var b,e={};return b=c.is("input")||d.inline?c.data():c.find("input").data(),b.dateOptions&&b.dateOptions instanceof Object&&(e=a.extend(!0,e,b.dateOptions)),a.each(d,function(a){var c="date"+a.charAt(0).toUpperCase()+a.slice(1);void 0!==b[c]&&(e[a]=b[c])}),e},I=function(){var b,e=(n||c).position(),f=(n||c).offset(),g=d.widgetPositioning.vertical,h=d.widgetPositioning.horizontal;if(d.widgetParent)b=d.widgetParent.append(o);else if(c.is("input"))b=c.after(o).parent();else{if(d.inline)return void(b=c.append(o));b=c,c.children().first().after(o)}if("auto"===g&&(g=f.top+1.5*o.height()>=a(window).height()+a(window).scrollTop()&&o.height()+c.outerHeight()a(window).width()?"right":"left"),"top"===g?o.addClass("top").removeClass("bottom"):o.addClass("bottom").removeClass("top"),"right"===h?o.addClass("pull-right"):o.removeClass("pull-right"),"static"===b.css("position")&&(b=b.parents().filter(function(){return"static"!==a(this).css("position")}).first()),0===b.length)throw new Error("datetimepicker component should be placed within a non-static positioned container");o.css({top:"top"===g?"auto":e.top+c.outerHeight(),bottom:"top"===g?b.outerHeight()-(b===c?0:e.top):"auto",left:"left"===h?b===c?0:e.left:"auto",right:"left"===h?"auto":b.outerWidth()-c.outerWidth()-(b===c?0:e.left)})},J=function(a){"dp.change"===a.type&&(a.date&&a.date.isSame(a.oldDate)||!a.date&&!a.oldDate)||c.trigger(a)},K=function(a){"y"===a&&(a="YYYY"),J({type:"dp.update",change:a,viewDate:f.clone()})},L=function(a){o&&(a&&(k=Math.max(p,Math.min(3,k+a))),o.find(".datepicker > div").hide().filter(".datepicker-"+q[k].clsName).show())},M=function(){var b=a("
    "),c=f.clone().startOf("w").startOf("d");for(d.calendarWeeks===!0&&b.append(a(""),d.calendarWeeks&&c.append('"),j.push(c)),k=["day"],b.isBefore(f,"M")&&k.push("old"),b.isAfter(f,"M")&&k.push("new"),b.isSame(e,"d")&&!m&&k.push("active"),R(b,"d")||k.push("disabled"),b.isSame(y(),"d")&&k.push("today"),0!==b.day()&&6!==b.day()||k.push("weekend"),J({type:"dp.classify",date:b,classNames:k}),c.append('"),b.add(1,"d");h.find("tbody").empty().append(j),T(),U(),V()}},X=function(){var b=o.find(".timepicker-hours table"),c=f.clone().startOf("d"),d=[],e=a("");for(f.hour()>11&&!h&&c.hour(12);c.isSame(f,"d")&&(h||f.hour()<12&&c.hour()<12||f.hour()>11);)c.hour()%4===0&&(e=a(""),d.push(e)),e.append('"),c.add(1,"h");b.empty().append(d)},Y=function(){for(var b=o.find(".timepicker-minutes table"),c=f.clone().startOf("h"),e=[],g=a(""),h=1===d.stepping?5:d.stepping;f.isSame(c,"h");)c.minute()%(4*h)===0&&(g=a(""),e.push(g)),g.append('"),c.add(h,"m");b.empty().append(e)},Z=function(){for(var b=o.find(".timepicker-seconds table"),c=f.clone().startOf("m"),d=[],e=a("");f.isSame(c,"m");)c.second()%20===0&&(e=a(""),d.push(e)),e.append('"),c.add(5,"s");b.empty().append(d)},$=function(){var a,b,c=o.find(".timepicker span[data-time-component]");h||(a=o.find(".timepicker [data-action=togglePeriod]"),b=e.clone().add(e.hours()>=12?-12:12,"h"),a.text(e.format("A")),R(b,"h")?a.removeClass("disabled"):a.addClass("disabled")),c.filter("[data-time-component=hours]").text(e.format(h?"HH":"hh")),c.filter("[data-time-component=minutes]").text(e.format("mm")),c.filter("[data-time-component=seconds]").text(e.format("ss")),X(),Y(),Z()},_=function(){o&&(W(),$())},aa=function(a){var b=m?null:e;if(!a)return m=!0,g.val(""),c.data("date",""),J({type:"dp.change",date:!1,oldDate:b}),void _();if(a=a.clone().locale(d.locale),x()&&a.tz(d.timeZone),1!==d.stepping)for(a.minutes(Math.round(a.minutes()/d.stepping)*d.stepping).seconds(0);d.minDate&&a.isBefore(d.minDate);)a.add(d.stepping,"minutes");R(a)?(e=a,f=e.clone(),g.val(e.format(i)),c.data("date",e.format(i)),m=!1,_(),J({type:"dp.change",date:e.clone(),oldDate:b})):(d.keepInvalid?J({type:"dp.change",date:a,oldDate:b}):g.val(m?"":e.format(i)),J({type:"dp.error",date:a,oldDate:b}))},ba=function(){var b=!1;return o?(o.find(".collapse").each(function(){var c=a(this).data("collapse");return!c||!c.transitioning||(b=!0,!1)}),b?l:(n&&n.hasClass("btn")&&n.toggleClass("active"),o.hide(),a(window).off("resize",I),o.off("click","[data-action]"),o.off("mousedown",!1),o.remove(),o=!1,J({type:"dp.hide",date:e.clone()}),g.blur(),f=e.clone(),l)):l},ca=function(){aa(null)},da=function(a){return void 0===d.parseInputDate?(!b.isMoment(a)||a instanceof Date)&&(a=y(a)):a=d.parseInputDate(a),a},ea={next:function(){var a=q[k].navFnc;f.add(q[k].navStep,a),W(),K(a)},previous:function(){var a=q[k].navFnc;f.subtract(q[k].navStep,a),W(),K(a)},pickerSwitch:function(){L(1)},selectMonth:function(b){var c=a(b.target).closest("tbody").find("span").index(a(b.target));f.month(c),k===p?(aa(e.clone().year(f.year()).month(f.month())),d.inline||ba()):(L(-1),W()),K("M")},selectYear:function(b){var c=parseInt(a(b.target).text(),10)||0;f.year(c),k===p?(aa(e.clone().year(f.year())),d.inline||ba()):(L(-1),W()),K("YYYY")},selectDecade:function(b){var c=parseInt(a(b.target).data("selection"),10)||0;f.year(c),k===p?(aa(e.clone().year(f.year())),d.inline||ba()):(L(-1),W()),K("YYYY")},selectDay:function(b){var c=f.clone();a(b.target).is(".old")&&c.subtract(1,"M"),a(b.target).is(".new")&&c.add(1,"M"),aa(c.date(parseInt(a(b.target).text(),10))),A()||d.keepOpen||d.inline||ba()},incrementHours:function(){var a=e.clone().add(1,"h");R(a,"h")&&aa(a)},incrementMinutes:function(){var a=e.clone().add(d.stepping,"m");R(a,"m")&&aa(a)},incrementSeconds:function(){var a=e.clone().add(1,"s");R(a,"s")&&aa(a)},decrementHours:function(){var a=e.clone().subtract(1,"h");R(a,"h")&&aa(a)},decrementMinutes:function(){var a=e.clone().subtract(d.stepping,"m");R(a,"m")&&aa(a)},decrementSeconds:function(){var a=e.clone().subtract(1,"s");R(a,"s")&&aa(a)},togglePeriod:function(){aa(e.clone().add(e.hours()>=12?-12:12,"h"))},togglePicker:function(b){var c,e=a(b.target),f=e.closest("ul"),g=f.find(".in"),h=f.find(".collapse:not(.in)");if(g&&g.length){if(c=g.data("collapse"),c&&c.transitioning)return;g.collapse?(g.collapse("hide"),h.collapse("show")):(g.removeClass("in"),h.addClass("in")),e.is("span")?e.toggleClass(d.icons.time+" "+d.icons.date):e.find("span").toggleClass(d.icons.time+" "+d.icons.date)}},showPicker:function(){o.find(".timepicker > div:not(.timepicker-picker)").hide(),o.find(".timepicker .timepicker-picker").show()},showHours:function(){o.find(".timepicker .timepicker-picker").hide(),o.find(".timepicker .timepicker-hours").show()},showMinutes:function(){o.find(".timepicker .timepicker-picker").hide(),o.find(".timepicker .timepicker-minutes").show()},showSeconds:function(){o.find(".timepicker .timepicker-picker").hide(),o.find(".timepicker .timepicker-seconds").show()},selectHour:function(b){var c=parseInt(a(b.target).text(),10);h||(e.hours()>=12?12!==c&&(c+=12):12===c&&(c=0)),aa(e.clone().hours(c)),ea.showPicker.call(l)},selectMinute:function(b){aa(e.clone().minutes(parseInt(a(b.target).text(),10))),ea.showPicker.call(l)},selectSecond:function(b){aa(e.clone().seconds(parseInt(a(b.target).text(),10))),ea.showPicker.call(l)},clear:ca,today:function(){var a=y();R(a,"d")&&aa(a)},close:ba},fa=function(b){return!a(b.currentTarget).is(".disabled")&&(ea[a(b.currentTarget).data("action")].apply(l,arguments),!1)},ga=function(){var b,c={year:function(a){return a.month(0).date(1).hours(0).seconds(0).minutes(0)},month:function(a){return a.date(1).hours(0).seconds(0).minutes(0)},day:function(a){return a.hours(0).seconds(0).minutes(0)},hour:function(a){return a.seconds(0).minutes(0)},minute:function(a){return a.seconds(0)}};return g.prop("disabled")||!d.ignoreReadonly&&g.prop("readonly")||o?l:(void 0!==g.val()&&0!==g.val().trim().length?aa(da(g.val().trim())):m&&d.useCurrent&&(d.inline||g.is("input")&&0===g.val().trim().length)&&(b=y(),"string"==typeof d.useCurrent&&(b=c[d.useCurrent](b)),aa(b)),o=G(),M(),S(),o.find(".timepicker-hours").hide(),o.find(".timepicker-minutes").hide(),o.find(".timepicker-seconds").hide(),_(),L(),a(window).on("resize",I),o.on("click","[data-action]",fa),o.on("mousedown",!1),n&&n.hasClass("btn")&&n.toggleClass("active"),I(),o.show(),d.focusOnShow&&!g.is(":focus")&&g.focus(),J({type:"dp.show"}),l)},ha=function(){return o?ba():ga()},ia=function(a){var b,c,e,f,g=null,h=[],i={},j=a.which,k="p";w[j]=k;for(b in w)w.hasOwnProperty(b)&&w[b]===k&&(h.push(b),parseInt(b,10)!==j&&(i[b]=!0));for(b in d.keyBinds)if(d.keyBinds.hasOwnProperty(b)&&"function"==typeof d.keyBinds[b]&&(e=b.split(" "),e.length===h.length&&v[j]===e[e.length-1])){for(f=!0,c=e.length-2;c>=0;c--)if(!(v[e[c]]in i)){f=!1;break}if(f){g=d.keyBinds[b];break}}g&&(g.call(l,o),a.stopPropagation(),a.preventDefault())},ja=function(a){w[a.which]="r",a.stopPropagation(),a.preventDefault()},ka=function(b){var c=a(b.target).val().trim(),d=c?da(c):null;return aa(d),b.stopImmediatePropagation(),!1},la=function(){g.on({change:ka,blur:d.debug?"":ba,keydown:ia,keyup:ja,focus:d.allowInputToggle?ga:""}),c.is("input")?g.on({focus:ga}):n&&(n.on("click",ha),n.on("mousedown",!1))},ma=function(){g.off({change:ka,blur:blur,keydown:ia,keyup:ja,focus:d.allowInputToggle?ba:""}),c.is("input")?g.off({focus:ga}):n&&(n.off("click",ha),n.off("mousedown",!1))},na=function(b){var c={};return a.each(b,function(){var a=da(this);a.isValid()&&(c[a.format("YYYY-MM-DD")]=!0)}),!!Object.keys(c).length&&c},oa=function(b){var c={};return a.each(b,function(){c[this]=!0}),!!Object.keys(c).length&&c},pa=function(){var a=d.format||"L LT";i=a.replace(/(\[[^\[]*\])|(\\)?(LTS|LT|LL?L?L?|l{1,4})/g,function(a){var b=e.localeData().longDateFormat(a)||a;return b.replace(/(\[[^\[]*\])|(\\)?(LTS|LT|LL?L?L?|l{1,4})/g,function(a){return e.localeData().longDateFormat(a)||a})}),j=d.extraFormats?d.extraFormats.slice():[],j.indexOf(a)<0&&j.indexOf(i)<0&&j.push(i),h=i.toLowerCase().indexOf("a")<1&&i.replace(/\[.*?\]/g,"").indexOf("h")<1,z("y")&&(p=2),z("M")&&(p=1),z("d")&&(p=0),k=Math.max(p,k),m||aa(e)};if(l.destroy=function(){ba(),ma(),c.removeData("DateTimePicker"),c.removeData("date")},l.toggle=ha,l.show=ga,l.hide=ba,l.disable=function(){return ba(),n&&n.hasClass("btn")&&n.addClass("disabled"),g.prop("disabled",!0),l},l.enable=function(){return n&&n.hasClass("btn")&&n.removeClass("disabled"),g.prop("disabled",!1),l},l.ignoreReadonly=function(a){if(0===arguments.length)return d.ignoreReadonly;if("boolean"!=typeof a)throw new TypeError("ignoreReadonly () expects a boolean parameter");return d.ignoreReadonly=a,l},l.options=function(b){if(0===arguments.length)return a.extend(!0,{},d);if(!(b instanceof Object))throw new TypeError("options() options parameter should be an object");return a.extend(!0,d,b),a.each(d,function(a,b){if(void 0===l[a])throw new TypeError("option "+a+" is not recognized!");l[a](b)}),l},l.date=function(a){if(0===arguments.length)return m?null:e.clone();if(!(null===a||"string"==typeof a||b.isMoment(a)||a instanceof Date))throw new TypeError("date() parameter must be one of [null, string, moment or Date]");return aa(null===a?null:da(a)),l},l.format=function(a){if(0===arguments.length)return d.format;if("string"!=typeof a&&("boolean"!=typeof a||a!==!1))throw new TypeError("format() expects a string or boolean:false parameter "+a);return d.format=a,i&&pa(),l},l.timeZone=function(a){if(0===arguments.length)return d.timeZone;if("string"!=typeof a)throw new TypeError("newZone() expects a string parameter");return d.timeZone=a,l},l.dayViewHeaderFormat=function(a){if(0===arguments.length)return d.dayViewHeaderFormat;if("string"!=typeof a)throw new TypeError("dayViewHeaderFormat() expects a string parameter");return d.dayViewHeaderFormat=a,l},l.extraFormats=function(a){if(0===arguments.length)return d.extraFormats;if(a!==!1&&!(a instanceof Array))throw new TypeError("extraFormats() expects an array or false parameter");return d.extraFormats=a,j&&pa(),l},l.disabledDates=function(b){if(0===arguments.length)return d.disabledDates?a.extend({},d.disabledDates):d.disabledDates;if(!b)return d.disabledDates=!1,_(),l;if(!(b instanceof Array))throw new TypeError("disabledDates() expects an array parameter");return d.disabledDates=na(b),d.enabledDates=!1,_(),l},l.enabledDates=function(b){if(0===arguments.length)return d.enabledDates?a.extend({},d.enabledDates):d.enabledDates;if(!b)return d.enabledDates=!1,_(),l;if(!(b instanceof Array))throw new TypeError("enabledDates() expects an array parameter");return d.enabledDates=na(b),d.disabledDates=!1,_(),l},l.daysOfWeekDisabled=function(a){if(0===arguments.length)return d.daysOfWeekDisabled.splice(0);if("boolean"==typeof a&&!a)return d.daysOfWeekDisabled=!1,_(),l;if(!(a instanceof Array))throw new TypeError("daysOfWeekDisabled() expects an array parameter");if(d.daysOfWeekDisabled=a.reduce(function(a,b){return b=parseInt(b,10),b>6||b<0||isNaN(b)?a:(a.indexOf(b)===-1&&a.push(b),a)},[]).sort(),d.useCurrent&&!d.keepInvalid){for(var b=0;!R(e,"d");){if(e.add(1,"d"),31===b)throw"Tried 31 times to find a valid date";b++}aa(e)}return _(),l},l.maxDate=function(a){if(0===arguments.length)return d.maxDate?d.maxDate.clone():d.maxDate;if("boolean"==typeof a&&a===!1)return d.maxDate=!1,_(),l;"string"==typeof a&&("now"!==a&&"moment"!==a||(a=y()));var b=da(a);if(!b.isValid())throw new TypeError("maxDate() Could not parse date parameter: "+a);if(d.minDate&&b.isBefore(d.minDate))throw new TypeError("maxDate() date parameter is before options.minDate: "+b.format(i));return d.maxDate=b,d.useCurrent&&!d.keepInvalid&&e.isAfter(a)&&aa(d.maxDate),f.isAfter(b)&&(f=b.clone().subtract(d.stepping,"m")),_(),l},l.minDate=function(a){if(0===arguments.length)return d.minDate?d.minDate.clone():d.minDate;if("boolean"==typeof a&&a===!1)return d.minDate=!1,_(),l;"string"==typeof a&&("now"!==a&&"moment"!==a||(a=y()));var b=da(a);if(!b.isValid())throw new TypeError("minDate() Could not parse date parameter: "+a);if(d.maxDate&&b.isAfter(d.maxDate))throw new TypeError("minDate() date parameter is after options.maxDate: "+b.format(i));return d.minDate=b,d.useCurrent&&!d.keepInvalid&&e.isBefore(a)&&aa(d.minDate),f.isBefore(b)&&(f=b.clone().add(d.stepping,"m")),_(),l},l.defaultDate=function(a){if(0===arguments.length)return d.defaultDate?d.defaultDate.clone():d.defaultDate;if(!a)return d.defaultDate=!1,l;"string"==typeof a&&(a="now"===a||"moment"===a?y():y(a));var b=da(a);if(!b.isValid())throw new TypeError("defaultDate() Could not parse date parameter: "+a);if(!R(b))throw new TypeError("defaultDate() date passed is invalid according to component setup validations");return d.defaultDate=b,(d.defaultDate&&d.inline||""===g.val().trim())&&aa(d.defaultDate),l},l.locale=function(a){if(0===arguments.length)return d.locale;if(!b.localeData(a))throw new TypeError("locale() locale "+a+" is not loaded from moment locales!");return d.locale=a,e.locale(d.locale),f.locale(d.locale),i&&pa(),o&&(ba(),ga()),l},l.stepping=function(a){return 0===arguments.length?d.stepping:(a=parseInt(a,10),(isNaN(a)||a<1)&&(a=1),d.stepping=a,l)},l.useCurrent=function(a){var b=["year","month","day","hour","minute"];if(0===arguments.length)return d.useCurrent;if("boolean"!=typeof a&&"string"!=typeof a)throw new TypeError("useCurrent() expects a boolean or string parameter");if("string"==typeof a&&b.indexOf(a.toLowerCase())===-1)throw new TypeError("useCurrent() expects a string parameter of "+b.join(", "));return d.useCurrent=a,l},l.collapse=function(a){if(0===arguments.length)return d.collapse;if("boolean"!=typeof a)throw new TypeError("collapse() expects a boolean parameter");return d.collapse===a?l:(d.collapse=a,o&&(ba(),ga()),l)},l.icons=function(b){if(0===arguments.length)return a.extend({},d.icons);if(!(b instanceof Object))throw new TypeError("icons() expects parameter to be an Object");return a.extend(d.icons,b),o&&(ba(),ga()),l},l.tooltips=function(b){if(0===arguments.length)return a.extend({},d.tooltips);if(!(b instanceof Object))throw new TypeError("tooltips() expects parameter to be an Object");return a.extend(d.tooltips,b),o&&(ba(),ga()),l},l.useStrict=function(a){if(0===arguments.length)return d.useStrict;if("boolean"!=typeof a)throw new TypeError("useStrict() expects a boolean parameter");return d.useStrict=a,l},l.sideBySide=function(a){if(0===arguments.length)return d.sideBySide;if("boolean"!=typeof a)throw new TypeError("sideBySide() expects a boolean parameter");return d.sideBySide=a,o&&(ba(),ga()),l},l.viewMode=function(a){if(0===arguments.length)return d.viewMode;if("string"!=typeof a)throw new TypeError("viewMode() expects a string parameter");if(r.indexOf(a)===-1)throw new TypeError("viewMode() parameter must be one of ("+r.join(", ")+") value");return d.viewMode=a,k=Math.max(r.indexOf(a),p),L(),l},l.toolbarPlacement=function(a){if(0===arguments.length)return d.toolbarPlacement;if("string"!=typeof a)throw new TypeError("toolbarPlacement() expects a string parameter");if(u.indexOf(a)===-1)throw new TypeError("toolbarPlacement() parameter must be one of ("+u.join(", ")+") value");return d.toolbarPlacement=a,o&&(ba(),ga()),l},l.widgetPositioning=function(b){if(0===arguments.length)return a.extend({},d.widgetPositioning);if("[object Object]"!=={}.toString.call(b))throw new TypeError("widgetPositioning() expects an object variable");if(b.horizontal){if("string"!=typeof b.horizontal)throw new TypeError("widgetPositioning() horizontal variable must be a string");if(b.horizontal=b.horizontal.toLowerCase(),t.indexOf(b.horizontal)===-1)throw new TypeError("widgetPositioning() expects horizontal parameter to be one of ("+t.join(", ")+")");d.widgetPositioning.horizontal=b.horizontal}if(b.vertical){if("string"!=typeof b.vertical)throw new TypeError("widgetPositioning() vertical variable must be a string");if(b.vertical=b.vertical.toLowerCase(),s.indexOf(b.vertical)===-1)throw new TypeError("widgetPositioning() expects vertical parameter to be one of ("+s.join(", ")+")");d.widgetPositioning.vertical=b.vertical}return _(),l},l.calendarWeeks=function(a){if(0===arguments.length)return d.calendarWeeks;if("boolean"!=typeof a)throw new TypeError("calendarWeeks() expects parameter to be a boolean value");return d.calendarWeeks=a,_(),l},l.showTodayButton=function(a){if(0===arguments.length)return d.showTodayButton;if("boolean"!=typeof a)throw new TypeError("showTodayButton() expects a boolean parameter");return d.showTodayButton=a,o&&(ba(),ga()),l},l.showClear=function(a){if(0===arguments.length)return d.showClear;if("boolean"!=typeof a)throw new TypeError("showClear() expects a boolean parameter");return d.showClear=a,o&&(ba(),ga()),l},l.widgetParent=function(b){if(0===arguments.length)return d.widgetParent;if("string"==typeof b&&(b=a(b)),null!==b&&"string"!=typeof b&&!(b instanceof a))throw new TypeError("widgetParent() expects a string or a jQuery object parameter");return d.widgetParent=b,o&&(ba(),ga()),l},l.keepOpen=function(a){if(0===arguments.length)return d.keepOpen;if("boolean"!=typeof a)throw new TypeError("keepOpen() expects a boolean parameter");return d.keepOpen=a,l},l.focusOnShow=function(a){if(0===arguments.length)return d.focusOnShow;if("boolean"!=typeof a)throw new TypeError("focusOnShow() expects a boolean parameter");return d.focusOnShow=a,l},l.inline=function(a){if(0===arguments.length)return d.inline;if("boolean"!=typeof a)throw new TypeError("inline() expects a boolean parameter");return d.inline=a,l},l.clear=function(){return ca(),l},l.keyBinds=function(a){return 0===arguments.length?d.keyBinds:(d.keyBinds=a,l)},l.getMoment=function(a){return y(a)},l.debug=function(a){if("boolean"!=typeof a)throw new TypeError("debug() expects a boolean parameter");return d.debug=a,l},l.allowInputToggle=function(a){if(0===arguments.length)return d.allowInputToggle;if("boolean"!=typeof a)throw new TypeError("allowInputToggle() expects a boolean parameter");return d.allowInputToggle=a,l},l.showClose=function(a){if(0===arguments.length)return d.showClose;if("boolean"!=typeof a)throw new TypeError("showClose() expects a boolean parameter");return d.showClose=a,l},l.keepInvalid=function(a){if(0===arguments.length)return d.keepInvalid;if("boolean"!=typeof a)throw new TypeError("keepInvalid() expects a boolean parameter"); return d.keepInvalid=a,l},l.datepickerInput=function(a){if(0===arguments.length)return d.datepickerInput;if("string"!=typeof a)throw new TypeError("datepickerInput() expects a string parameter");return d.datepickerInput=a,l},l.parseInputDate=function(a){if(0===arguments.length)return d.parseInputDate;if("function"!=typeof a)throw new TypeError("parseInputDate() sholud be as function");return d.parseInputDate=a,l},l.disabledTimeIntervals=function(b){if(0===arguments.length)return d.disabledTimeIntervals?a.extend({},d.disabledTimeIntervals):d.disabledTimeIntervals;if(!b)return d.disabledTimeIntervals=!1,_(),l;if(!(b instanceof Array))throw new TypeError("disabledTimeIntervals() expects an array parameter");return d.disabledTimeIntervals=b,_(),l},l.disabledHours=function(b){if(0===arguments.length)return d.disabledHours?a.extend({},d.disabledHours):d.disabledHours;if(!b)return d.disabledHours=!1,_(),l;if(!(b instanceof Array))throw new TypeError("disabledHours() expects an array parameter");if(d.disabledHours=oa(b),d.enabledHours=!1,d.useCurrent&&!d.keepInvalid){for(var c=0;!R(e,"h");){if(e.add(1,"h"),24===c)throw"Tried 24 times to find a valid date";c++}aa(e)}return _(),l},l.enabledHours=function(b){if(0===arguments.length)return d.enabledHours?a.extend({},d.enabledHours):d.enabledHours;if(!b)return d.enabledHours=!1,_(),l;if(!(b instanceof Array))throw new TypeError("enabledHours() expects an array parameter");if(d.enabledHours=oa(b),d.disabledHours=!1,d.useCurrent&&!d.keepInvalid){for(var c=0;!R(e,"h");){if(e.add(1,"h"),24===c)throw"Tried 24 times to find a valid date";c++}aa(e)}return _(),l},l.viewDate=function(a){if(0===arguments.length)return f.clone();if(!a)return f=e.clone(),l;if(!("string"==typeof a||b.isMoment(a)||a instanceof Date))throw new TypeError("viewDate() parameter must be one of [string, moment or Date]");return f=da(a),K(),l},c.is("input"))g=c;else if(g=c.find(d.datepickerInput),0===g.length)g=c.find("input");else if(!g.is("input"))throw new Error('CSS class "'+d.datepickerInput+'" cannot be applied to non input element');if(c.hasClass("input-group")&&(n=0===c.find(".datepickerbutton").length?c.find(".input-group-addon"):c.find(".datepickerbutton")),!d.inline&&!g.is("input"))throw new Error("Could not initialize DateTimePicker without an input element");return e=y(),f=e.clone(),a.extend(!0,d,H()),l.options(d),pa(),la(),g.prop("disabled")&&l.disable(),g.is("input")&&0!==g.val().trim().length?aa(da(g.val().trim())):d.defaultDate&&void 0===g.attr("placeholder")&&aa(d.defaultDate),d.inline&&ga(),l};return a.fn.datetimepicker=function(b){b=b||{};var d,e=Array.prototype.slice.call(arguments,1),f=!0,g=["destroy","hide","show","toggle"];if("object"==typeof b)return this.each(function(){var d,e=a(this);e.data("DateTimePicker")||(d=a.extend(!0,{},a.fn.datetimepicker.defaults,b),e.data("DateTimePicker",c(e,d)))});if("string"==typeof b)return this.each(function(){var c=a(this),g=c.data("DateTimePicker");if(!g)throw new Error('bootstrap-datetimepicker("'+b+'") method was called on an element that is not using DateTimePicker');d=g[b].apply(g,e),f=d===g}),f||a.inArray(b,g)>-1?this:d;throw new TypeError("Invalid arguments for DateTimePicker: "+b)},a.fn.datetimepicker.defaults={timeZone:"",format:!1,dayViewHeaderFormat:"MMMM YYYY",extraFormats:!1,stepping:1,minDate:!1,maxDate:!1,useCurrent:!0,collapse:!0,locale:b.locale(),defaultDate:!1,disabledDates:!1,enabledDates:!1,icons:{time:"glyphicon glyphicon-time",date:"glyphicon glyphicon-calendar",up:"glyphicon glyphicon-chevron-up",down:"glyphicon glyphicon-chevron-down",previous:"glyphicon glyphicon-chevron-left",next:"glyphicon glyphicon-chevron-right",today:"glyphicon glyphicon-screenshot",clear:"glyphicon glyphicon-trash",close:"glyphicon glyphicon-remove"},tooltips:{today:"Go to today",clear:"Clear selection",close:"Close the picker",selectMonth:"Select Month",prevMonth:"Previous Month",nextMonth:"Next Month",selectYear:"Select Year",prevYear:"Previous Year",nextYear:"Next Year",selectDecade:"Select Decade",prevDecade:"Previous Decade",nextDecade:"Next Decade",prevCentury:"Previous Century",nextCentury:"Next Century",pickHour:"Pick Hour",incrementHour:"Increment Hour",decrementHour:"Decrement Hour",pickMinute:"Pick Minute",incrementMinute:"Increment Minute",decrementMinute:"Decrement Minute",pickSecond:"Pick Second",incrementSecond:"Increment Second",decrementSecond:"Decrement Second",togglePeriod:"Toggle Period",selectTime:"Select Time"},useStrict:!1,sideBySide:!1,daysOfWeekDisabled:!1,calendarWeeks:!1,viewMode:"days",toolbarPlacement:"default",showTodayButton:!1,showClear:!1,showClose:!1,widgetPositioning:{horizontal:"auto",vertical:"auto"},widgetParent:null,ignoreReadonly:!1,keepOpen:!1,focusOnShow:!0,inline:!1,keepInvalid:!1,datepickerInput:".datepickerinput",keyBinds:{up:function(a){if(a){var b=this.date()||this.getMoment();a.find(".datepicker").is(":visible")?this.date(b.clone().subtract(7,"d")):this.date(b.clone().add(this.stepping(),"m"))}},down:function(a){if(!a)return void this.show();var b=this.date()||this.getMoment();a.find(".datepicker").is(":visible")?this.date(b.clone().add(7,"d")):this.date(b.clone().subtract(this.stepping(),"m"))},"control up":function(a){if(a){var b=this.date()||this.getMoment();a.find(".datepicker").is(":visible")?this.date(b.clone().subtract(1,"y")):this.date(b.clone().add(1,"h"))}},"control down":function(a){if(a){var b=this.date()||this.getMoment();a.find(".datepicker").is(":visible")?this.date(b.clone().add(1,"y")):this.date(b.clone().subtract(1,"h"))}},left:function(a){if(a){var b=this.date()||this.getMoment();a.find(".datepicker").is(":visible")&&this.date(b.clone().subtract(1,"d"))}},right:function(a){if(a){var b=this.date()||this.getMoment();a.find(".datepicker").is(":visible")&&this.date(b.clone().add(1,"d"))}},pageUp:function(a){if(a){var b=this.date()||this.getMoment();a.find(".datepicker").is(":visible")&&this.date(b.clone().subtract(1,"M"))}},pageDown:function(a){if(a){var b=this.date()||this.getMoment();a.find(".datepicker").is(":visible")&&this.date(b.clone().add(1,"M"))}},enter:function(){this.hide()},escape:function(){this.hide()},"control space":function(a){a&&a.find(".timepicker").is(":visible")&&a.find('.btn[data-action="togglePeriod"]').click()},t:function(){this.date(this.getMoment())},delete:function(){this.clear()}},debug:!1,allowInputToggle:!1,disabledTimeIntervals:!1,disabledHours:!1,enabledHours:!1,viewDate:!1},a.fn.datetimepicker});;
    ").addClass("cw").text("#"));c.isBefore(f.clone().endOf("w"));)b.append(a("").addClass("dow").text(c.format("dd"))),c.add(1,"d");o.find(".datepicker-days thead").append(b)},N=function(a){return d.disabledDates[a.format("YYYY-MM-DD")]===!0},O=function(a){return d.enabledDates[a.format("YYYY-MM-DD")]===!0},P=function(a){return d.disabledHours[a.format("H")]===!0},Q=function(a){return d.enabledHours[a.format("H")]===!0},R=function(b,c){if(!b.isValid())return!1;if(d.disabledDates&&"d"===c&&N(b))return!1;if(d.enabledDates&&"d"===c&&!O(b))return!1;if(d.minDate&&b.isBefore(d.minDate,c))return!1;if(d.maxDate&&b.isAfter(d.maxDate,c))return!1;if(d.daysOfWeekDisabled&&"d"===c&&d.daysOfWeekDisabled.indexOf(b.day())!==-1)return!1;if(d.disabledHours&&("h"===c||"m"===c||"s"===c)&&P(b))return!1;if(d.enabledHours&&("h"===c||"m"===c||"s"===c)&&!Q(b))return!1;if(d.disabledTimeIntervals&&("h"===c||"m"===c||"s"===c)){var e=!1;if(a.each(d.disabledTimeIntervals,function(){if(b.isBetween(this[0],this[1]))return e=!0,!1}),e)return!1}return!0},S=function(){for(var b=[],c=f.clone().startOf("y").startOf("d");c.isSame(f,"y");)b.push(a("").attr("data-action","selectMonth").addClass("month").text(c.format("MMM"))),c.add(1,"M");o.find(".datepicker-months td").empty().append(b)},T=function(){var b=o.find(".datepicker-months"),c=b.find("th"),g=b.find("tbody").find("span");c.eq(0).find("span").attr("title",d.tooltips.prevYear),c.eq(1).attr("title",d.tooltips.selectYear),c.eq(2).find("span").attr("title",d.tooltips.nextYear),b.find(".disabled").removeClass("disabled"),R(f.clone().subtract(1,"y"),"y")||c.eq(0).addClass("disabled"),c.eq(1).text(f.year()),R(f.clone().add(1,"y"),"y")||c.eq(2).addClass("disabled"),g.removeClass("active"),e.isSame(f,"y")&&!m&&g.eq(e.month()).addClass("active"),g.each(function(b){R(f.clone().month(b),"M")||a(this).addClass("disabled")})},U=function(){var a=o.find(".datepicker-years"),b=a.find("th"),c=f.clone().subtract(5,"y"),g=f.clone().add(6,"y"),h="";for(b.eq(0).find("span").attr("title",d.tooltips.prevDecade),b.eq(1).attr("title",d.tooltips.selectDecade),b.eq(2).find("span").attr("title",d.tooltips.nextDecade),a.find(".disabled").removeClass("disabled"),d.minDate&&d.minDate.isAfter(c,"y")&&b.eq(0).addClass("disabled"),b.eq(1).text(c.year()+"-"+g.year()),d.maxDate&&d.maxDate.isBefore(g,"y")&&b.eq(2).addClass("disabled");!c.isAfter(g,"y");)h+=''+c.year()+"",c.add(1,"y");a.find("td").html(h)},V=function(){var a,c=o.find(".datepicker-decades"),g=c.find("th"),h=b({y:f.year()-f.year()%100-1}),i=h.clone().add(100,"y"),j=h.clone(),k=!1,l=!1,m="";for(g.eq(0).find("span").attr("title",d.tooltips.prevCentury),g.eq(2).find("span").attr("title",d.tooltips.nextCentury),c.find(".disabled").removeClass("disabled"),(h.isSame(b({y:1900}))||d.minDate&&d.minDate.isAfter(h,"y"))&&g.eq(0).addClass("disabled"),g.eq(1).text(h.year()+"-"+i.year()),(h.isSame(b({y:2e3}))||d.maxDate&&d.maxDate.isBefore(i,"y"))&&g.eq(2).addClass("disabled");!h.isAfter(i,"y");)a=h.year()+12,k=d.minDate&&d.minDate.isAfter(h,"y")&&d.minDate.year()<=a,l=d.maxDate&&d.maxDate.isAfter(h,"y")&&d.maxDate.year()<=a,m+=''+(h.year()+1)+" - "+(h.year()+12)+"",h.add(12,"y");m+="",c.find("td").html(m),g.eq(1).text(j.year()+1+"-"+h.year())},W=function(){var b,c,g,h=o.find(".datepicker-days"),i=h.find("th"),j=[],k=[];if(B()){for(i.eq(0).find("span").attr("title",d.tooltips.prevMonth),i.eq(1).attr("title",d.tooltips.selectMonth),i.eq(2).find("span").attr("title",d.tooltips.nextMonth),h.find(".disabled").removeClass("disabled"),i.eq(1).text(f.format(d.dayViewHeaderFormat)),R(f.clone().subtract(1,"M"),"M")||i.eq(0).addClass("disabled"),R(f.clone().add(1,"M"),"M")||i.eq(2).addClass("disabled"),b=f.clone().startOf("M").startOf("w").startOf("d"),g=0;g<42;g++)0===b.weekday()&&(c=a("
    '+b.week()+"'+b.date()+"
    '+c.format(h?"HH":"hh")+"
    '+c.format("mm")+"
    '+c.format("ss")+"